Skip to content

Commit

Permalink
Adding types and passing the delay to the initialize function
Browse files Browse the repository at this point in the history
Fix spelling
  • Loading branch information
Siggnja committed Apr 30, 2021
1 parent bb29b5e commit 97186f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const IntercomProvider: React.FC<IntercomProviderProps> = ({
onUnreadCountChange,
shouldInitialize = !isSSR,
apiBase,
initializeDelayInMs,
...rest
}) => {
const isBooted = React.useRef(autoBoot);
Expand All @@ -36,7 +37,7 @@ export const IntercomProvider: React.FC<IntercomProviderProps> = ({
);

if (!isSSR && !window.Intercom && shouldInitialize) {
initialize(appId);
initialize(appId, initializeDelayInMs);
// Only add listeners on initialization
if (onHide) IntercomAPI('onHide', onHide);
if (onShow) IntercomAPI('onShow', onShow);
Expand Down
6 changes: 6 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,4 +419,10 @@ export type IntercomProviderProps = {
* Format https://${INTERCOM_APP_ID}.intercom-messenger.com
*/
apiBase?: string;
/**
* Indicates if the intercom initialization should be delayed
*
* @remarks If not set delay is set to 0ms
* */
initializeDelayInMs?: number;
};

0 comments on commit 97186f9

Please sign in to comment.