Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { IntercomContextValues, IntercomProviderProps } from './contextTypes';
import { IntercomAPI } from './intercom';
import { IntercomProps, RawIntercomBootProps } from './types';
import { mapIntercomPropsToRawIntercomProps } from './mappers';
import { isEmptyObject } from './utils';

export const IntercomProvider = ({
appId,
Expand All @@ -15,7 +16,17 @@ export const IntercomProvider = ({
onHide,
onShow,
onUnreadCountChange,
...rest
}: IntercomProviderProps) => {
if (!isEmptyObject(rest))
logger.log(
'error',
[
'some invalid props were passed to IntercomProvider. ',
`Please check following props: ${Object.keys(rest).join(', ')}.`,
].join(''),
);

const [isBooted, setIsBooted] = useState(autoBoot);

if (!window.Intercom) {
Expand Down
2 changes: 2 additions & 0 deletions src/utils.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const isEmptyObject = (obj: object) =>
Object.keys(obj).length === 0 && obj.constructor === Object;