From 97186f9e161ee78daf96873e59c517c8b86078e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigur=C3=B0ur=20Gunnar=20Nj=C3=A1lsson?= Date: Fri, 30 Apr 2021 12:19:05 +0000 Subject: [PATCH] Adding types and passing the delay to the initialize function Fix spelling --- src/provider.tsx | 3 ++- src/types.ts | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/provider.tsx b/src/provider.tsx index 221f8105..35c2227f 100644 --- a/src/provider.tsx +++ b/src/provider.tsx @@ -22,6 +22,7 @@ export const IntercomProvider: React.FC = ({ onUnreadCountChange, shouldInitialize = !isSSR, apiBase, + initializeDelayInMs, ...rest }) => { const isBooted = React.useRef(autoBoot); @@ -36,7 +37,7 @@ export const IntercomProvider: React.FC = ({ ); 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); diff --git a/src/types.ts b/src/types.ts index d07b8003..dcbdc08c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -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; };