react-use-intercom
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -24,3 +24,3 @@ /// <reference types="react" /> | ||
* @remarks This method will effectively clear out any user data that you have been passing through the JS API. | ||
* @see {@link https://developers.intercom.com/installing-intercom/docs/intercom-javascript#section-intercomshutdown} | ||
@@ -156,2 +156,9 @@ */ | ||
shouldInitialize?: boolean; | ||
/** | ||
* If you need to route your Messenger requests through a different endpoint than the default | ||
* | ||
* @remarks Generally speaking, this is not needed. | ||
* Format https://${INTERCOM_APP_ID}.intercom-messenger.com | ||
*/ | ||
apiBase?: string; | ||
}; |
/// <reference types="react" /> | ||
import { IntercomContextValues, IntercomProviderProps } from './contextTypes'; | ||
export declare const IntercomProvider: ({ appId, autoBoot, children, onHide, onShow, onUnreadCountChange, shouldInitialize, ...rest }: IntercomProviderProps) => JSX.Element; | ||
export declare const IntercomProvider: ({ appId, autoBoot, children, onHide, onShow, onUnreadCountChange, shouldInitialize, apiBase, ...rest }: IntercomProviderProps) => JSX.Element; | ||
export declare const useIntercomContext: () => IntercomContextValues; |
@@ -95,2 +95,40 @@ 'use strict'; | ||
var NO_INTERCOM_PROVIDER_MESSAGE = 'Please wrap your component with `IntercomProvider`.'; | ||
var IntercomContext = /*#__PURE__*/React.createContext({ | ||
boot: function boot() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
shutdown: function shutdown() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
hardShutdown: function hardShutdown() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
update: function update() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
hide: function hide() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
show: function show() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
showMessages: function showMessages() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
showNewMessages: function showNewMessages() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
getVisitorId: function getVisitorId() { | ||
log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
return ''; | ||
}, | ||
startTour: function startTour() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
trackEvent: function trackEvent() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
} | ||
}); | ||
// @ts-nocheck | ||
@@ -144,40 +182,2 @@ | ||
var NO_INTERCOM_PROVIDER_MESSAGE = 'Please wrap your component with `IntercomProvider`.'; | ||
var IntercomContext = /*#__PURE__*/React.createContext({ | ||
boot: function boot() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
shutdown: function shutdown() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
hardShutdown: function hardShutdown() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
update: function update() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
hide: function hide() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
show: function show() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
showMessages: function showMessages() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
showNewMessages: function showNewMessages() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
getVisitorId: function getVisitorId() { | ||
log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
return ''; | ||
}, | ||
startTour: function startTour() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
trackEvent: function trackEvent() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
} | ||
}); | ||
/** | ||
@@ -265,6 +265,8 @@ * Removes object entries where the value equals to `undefined` | ||
shouldInitialize = _ref$shouldInitialize === void 0 ? !isSSR : _ref$shouldInitialize, | ||
rest = _objectWithoutPropertiesLoose(_ref, ["appId", "autoBoot", "children", "onHide", "onShow", "onUnreadCountChange", "shouldInitialize"]); | ||
apiBase = _ref.apiBase, | ||
rest = _objectWithoutPropertiesLoose(_ref, ["appId", "autoBoot", "children", "onHide", "onShow", "onUnreadCountChange", "shouldInitialize", "apiBase"]); | ||
if (!isEmptyObject(rest)) log('error', ['some invalid props were passed to IntercomProvider. ', "Please check following props: " + Object.keys(rest).join(', ') + "."].join('')); | ||
var memoizedAppId = React.useRef(appId); | ||
var memoizedApiBase = React.useRef(apiBase); | ||
var isBooted = React.useRef(autoBoot); | ||
@@ -281,8 +283,12 @@ var memoizedShouldInitialize = React.useRef(shouldInitialize); | ||
if (autoBoot) { | ||
IntercomAPI('boot', { | ||
IntercomAPI('boot', _extends({ | ||
app_id: memoizedAppId.current | ||
}, memoizedApiBase.current && { | ||
api_base: memoizedApiBase.current | ||
})); | ||
window.intercomSettings = _extends({ | ||
app_id: memoizedAppId.current | ||
}, memoizedApiBase.current && { | ||
api_base: memoizedApiBase.current | ||
}); | ||
window.intercomSettings = { | ||
app_id: memoizedAppId.current | ||
}; | ||
} | ||
@@ -318,2 +324,4 @@ } | ||
app_id: memoizedAppId.current | ||
}, memoizedApiBase.current && { | ||
api_base: memoizedApiBase.current | ||
}, props && mapIntercomPropsToRawIntercomProps(props)); | ||
@@ -320,0 +328,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}var n="undefined"==typeof window,o=function(e){if(!n&&window.Intercom){for(var t=arguments.length,o=new Array(t>1?t-1:0),r=1;r<t;r++)o[r-1]=arguments[r];return window.Intercom.apply(null,[e].concat(o))}},r=e.createContext({boot:function(){},shutdown:function(){},hardShutdown:function(){},update:function(){},hide:function(){},show:function(){},showMessages:function(){},showNewMessages:function(){},getVisitorId:function(){return""},startTour:function(){},trackEvent:function(){}}),a=function(e){return t({company_id:e.companyId,name:e.name,created_at:e.createdAt,plan:e.plan,monthly_spend:e.monthlySpend,user_count:e.userCount,size:e.size,website:e.website,industry:e.industry},e.customAttributes)},u=function(e){return{type:e.type,image_url:e.imageUrl}},i=function(e){return function e(t){return Object.keys(t).forEach((function(n){t[n]&&"object"==typeof t[n]?e(t[n]):void 0===t[n]&&delete t[n]})),t}(t({},{custom_launcher_selector:(n=e).customLauncherSelector,alignment:n.alignment,vertical_padding:n.verticalPadding,horizontal_padding:n.horizontalPadding,hide_default_launcher:n.hideDefaultLauncher,session_duration:n.sessionDuration,action_color:n.actionColor,background_color:n.backgroundColor},function(e){var n;return t({email:e.email,user_id:e.userId,created_at:e.createdAt,name:e.name,phone:e.phone,last_request_at:e.lastRequestAt,unsubscribed_from_emails:e.unsubscribedFromEmails,language_override:e.languageOverride,utm_campaign:e.utmCampaign,utm_content:e.utmContent,utm_medium:e.utmMedium,utm_source:e.utmSource,utm_term:e.utmTerm,avatar:e.avatar&&u(e.avatar),user_hash:e.userHash,company:e.company&&a(e.company),companies:null==(n=e.companies)?void 0:n.map(a)},e.customAttributes)}(e)));var n};exports.IntercomProvider=function(a){var u,c=a.appId,s=a.autoBoot,d=void 0!==s&&s,l=a.children,f=a.onHide,m=a.onShow,h=a.onUnreadCountChange,p=a.shouldInitialize,w=void 0===p?!n:p,g=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)t.indexOf(n=a[o])>=0||(r[n]=e[n]);return r}(a,["appId","autoBoot","children","onHide","onShow","onUnreadCountChange","shouldInitialize"]);u=g,(0!==Object.keys(u).length||u.constructor!==Object)&&["some invalid props were passed to IntercomProvider. ","Please check following props: "+Object.keys(g).join(", ")+"."].join("");var v=e.useRef(c),b=e.useRef(d),_=e.useRef(w);n||window.Intercom||!_.current||(function(e){var t=window,n=t.Intercom;if("function"==typeof n)n("reattach_activator"),n("update",t.intercomSettings);else{var o=document,r=function e(){e.c(arguments)};r.q=[],r.c=function(e){r.q.push(e)},t.Intercom=r;var a=function(){var t=o.createElement("script");t.type="text/javascript",t.async=!0,t.src="https://widget.intercom.io/widget/"+e;var n=o.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n)};t.attachEvent?t.attachEvent("onload",a):t.addEventListener("load",a,!1)}}(v.current),f&&o("onHide",f),m&&o("onShow",m),h&&o("onUnreadCountChange",h),d&&(o("boot",{app_id:v.current}),window.intercomSettings={app_id:v.current}));var y=e.useCallback((function(e,t){if((window.Intercom||_.current)&&b.current)return t()}),[]),C=e.useCallback((function(e){if((window.Intercom||_.current)&&!b.current){var n=t({app_id:v.current},e&&i(e));window.intercomSettings=n,o("boot",n),b.current=!0}}),[]),k=e.useCallback((function(){b.current&&(o("shutdown"),b.current=!1)}),[]),I=e.useCallback((function(){b.current&&(o("shutdown"),delete window.Intercom,delete window.intercomSettings,b.current=!1)}),[]),S=e.useCallback((function(){y("update",(function(){var e=(new Date).getTime();o("update",{last_requested_at:e})}))}),[y]),E=e.useCallback((function(e){y("update",(function(){if(e){var n=i(e);window.intercomSettings=t({},window.intercomSettings,n),o("update",n)}else S()}))}),[y,S]),M=e.useCallback((function(){y("hide",(function(){o("hide")}))}),[y]),j=e.useCallback((function(){y("show",(function(){return o("show")}))}),[y]),O=e.useCallback((function(){y("showMessages",(function(){o("showMessages")}))}),[y]),P=e.useCallback((function(e){y("showNewMessage",(function(){e?o("showNewMessage",e):o("showNewMessage")}))}),[y]),x=e.useCallback((function(){return y("getVisitorId",(function(){return o("getVisitorId")}))}),[y]),N=e.useCallback((function(e){y("startTour",(function(){o("startTour",e)}))}),[y]),T=e.useCallback((function(e,t){y("trackEvent",(function(){t?o("trackEvent",e,t):o("trackEvent",e)}))}),[y]),q=e.useMemo((function(){return{boot:C,shutdown:k,hardShutdown:I,update:E,hide:M,show:j,showMessages:O,showNewMessages:P,getVisitorId:x,startTour:N,trackEvent:T}}),[C,k,I,E,M,j,O,P,x,N,T]),z=e.useMemo((function(){return l}),[l]);return e.createElement(r.Provider,{value:q},z)},exports.useIntercom=function(){return e.useContext(r)}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}var n="undefined"==typeof window,o=function(e){if(!n&&window.Intercom){for(var t=arguments.length,o=new Array(t>1?t-1:0),r=1;r<t;r++)o[r-1]=arguments[r];return window.Intercom.apply(null,[e].concat(o))}},r=e.createContext({boot:function(){},shutdown:function(){},hardShutdown:function(){},update:function(){},hide:function(){},show:function(){},showMessages:function(){},showNewMessages:function(){},getVisitorId:function(){return""},startTour:function(){},trackEvent:function(){}}),a=function(e){return t({company_id:e.companyId,name:e.name,created_at:e.createdAt,plan:e.plan,monthly_spend:e.monthlySpend,user_count:e.userCount,size:e.size,website:e.website,industry:e.industry},e.customAttributes)},u=function(e){return{type:e.type,image_url:e.imageUrl}},i=function(e){return function e(t){return Object.keys(t).forEach((function(n){t[n]&&"object"==typeof t[n]?e(t[n]):void 0===t[n]&&delete t[n]})),t}(t({},{custom_launcher_selector:(n=e).customLauncherSelector,alignment:n.alignment,vertical_padding:n.verticalPadding,horizontal_padding:n.horizontalPadding,hide_default_launcher:n.hideDefaultLauncher,session_duration:n.sessionDuration,action_color:n.actionColor,background_color:n.backgroundColor},function(e){var n;return t({email:e.email,user_id:e.userId,created_at:e.createdAt,name:e.name,phone:e.phone,last_request_at:e.lastRequestAt,unsubscribed_from_emails:e.unsubscribedFromEmails,language_override:e.languageOverride,utm_campaign:e.utmCampaign,utm_content:e.utmContent,utm_medium:e.utmMedium,utm_source:e.utmSource,utm_term:e.utmTerm,avatar:e.avatar&&u(e.avatar),user_hash:e.userHash,company:e.company&&a(e.company),companies:null==(n=e.companies)?void 0:n.map(a)},e.customAttributes)}(e)));var n};exports.IntercomProvider=function(a){var u,c=a.appId,s=a.autoBoot,d=void 0!==s&&s,l=a.children,f=a.onHide,m=a.onShow,p=a.onUnreadCountChange,h=a.shouldInitialize,w=void 0===h?!n:h,g=a.apiBase,v=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)t.indexOf(n=a[o])>=0||(r[n]=e[n]);return r}(a,["appId","autoBoot","children","onHide","onShow","onUnreadCountChange","shouldInitialize","apiBase"]);u=v,(0!==Object.keys(u).length||u.constructor!==Object)&&["some invalid props were passed to IntercomProvider. ","Please check following props: "+Object.keys(v).join(", ")+"."].join("");var b=e.useRef(c),_=e.useRef(g),y=e.useRef(d),C=e.useRef(w);n||window.Intercom||!C.current||(function(e){var t=window,n=t.Intercom;if("function"==typeof n)n("reattach_activator"),n("update",t.intercomSettings);else{var o=document,r=function e(){e.c(arguments)};r.q=[],r.c=function(e){r.q.push(e)},t.Intercom=r;var a=function(){var t=o.createElement("script");t.type="text/javascript",t.async=!0,t.src="https://widget.intercom.io/widget/"+e;var n=o.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n)};t.attachEvent?t.attachEvent("onload",a):t.addEventListener("load",a,!1)}}(b.current),f&&o("onHide",f),m&&o("onShow",m),p&&o("onUnreadCountChange",p),d&&(o("boot",t({app_id:b.current},_.current&&{api_base:_.current})),window.intercomSettings=t({app_id:b.current},_.current&&{api_base:_.current})));var k=e.useCallback((function(e,t){if((window.Intercom||C.current)&&y.current)return t()}),[]),I=e.useCallback((function(e){if((window.Intercom||C.current)&&!y.current){var n=t({app_id:b.current},_.current&&{api_base:_.current},e&&i(e));window.intercomSettings=n,o("boot",n),y.current=!0}}),[]),S=e.useCallback((function(){y.current&&(o("shutdown"),y.current=!1)}),[]),E=e.useCallback((function(){y.current&&(o("shutdown"),delete window.Intercom,delete window.intercomSettings,y.current=!1)}),[]),M=e.useCallback((function(){k("update",(function(){var e=(new Date).getTime();o("update",{last_requested_at:e})}))}),[k]),j=e.useCallback((function(e){k("update",(function(){if(e){var n=i(e);window.intercomSettings=t({},window.intercomSettings,n),o("update",n)}else M()}))}),[k,M]),O=e.useCallback((function(){k("hide",(function(){o("hide")}))}),[k]),P=e.useCallback((function(){k("show",(function(){return o("show")}))}),[k]),x=e.useCallback((function(){k("showMessages",(function(){o("showMessages")}))}),[k]),N=e.useCallback((function(e){k("showNewMessage",(function(){e?o("showNewMessage",e):o("showNewMessage")}))}),[k]),T=e.useCallback((function(){return k("getVisitorId",(function(){return o("getVisitorId")}))}),[k]),q=e.useCallback((function(e){k("startTour",(function(){o("startTour",e)}))}),[k]),z=e.useCallback((function(e,t){k("trackEvent",(function(){t?o("trackEvent",e,t):o("trackEvent",e)}))}),[k]),A=e.useMemo((function(){return{boot:I,shutdown:S,hardShutdown:E,update:j,hide:O,show:P,showMessages:x,showNewMessages:N,getVisitorId:T,startTour:q,trackEvent:z}}),[I,S,E,j,O,P,x,N,T,q,z]),B=e.useMemo((function(){return l}),[l]);return e.createElement(r.Provider,{value:A},B)},exports.useIntercom=function(){return e.useContext(r)}; | ||
//# sourceMappingURL=react-use-intercom.cjs.production.min.js.map |
@@ -91,2 +91,40 @@ import { createContext, useRef, useCallback, useMemo, createElement, useContext } from 'react'; | ||
var NO_INTERCOM_PROVIDER_MESSAGE = 'Please wrap your component with `IntercomProvider`.'; | ||
var IntercomContext = /*#__PURE__*/createContext({ | ||
boot: function boot() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
shutdown: function shutdown() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
hardShutdown: function hardShutdown() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
update: function update() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
hide: function hide() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
show: function show() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
showMessages: function showMessages() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
showNewMessages: function showNewMessages() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
getVisitorId: function getVisitorId() { | ||
log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
return ''; | ||
}, | ||
startTour: function startTour() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
trackEvent: function trackEvent() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
} | ||
}); | ||
// @ts-nocheck | ||
@@ -140,40 +178,2 @@ | ||
var NO_INTERCOM_PROVIDER_MESSAGE = 'Please wrap your component with `IntercomProvider`.'; | ||
var IntercomContext = /*#__PURE__*/createContext({ | ||
boot: function boot() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
shutdown: function shutdown() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
hardShutdown: function hardShutdown() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
update: function update() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
hide: function hide() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
show: function show() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
showMessages: function showMessages() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
showNewMessages: function showNewMessages() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
getVisitorId: function getVisitorId() { | ||
log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
return ''; | ||
}, | ||
startTour: function startTour() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
}, | ||
trackEvent: function trackEvent() { | ||
return log('error', NO_INTERCOM_PROVIDER_MESSAGE); | ||
} | ||
}); | ||
/** | ||
@@ -261,6 +261,8 @@ * Removes object entries where the value equals to `undefined` | ||
shouldInitialize = _ref$shouldInitialize === void 0 ? !isSSR : _ref$shouldInitialize, | ||
rest = _objectWithoutPropertiesLoose(_ref, ["appId", "autoBoot", "children", "onHide", "onShow", "onUnreadCountChange", "shouldInitialize"]); | ||
apiBase = _ref.apiBase, | ||
rest = _objectWithoutPropertiesLoose(_ref, ["appId", "autoBoot", "children", "onHide", "onShow", "onUnreadCountChange", "shouldInitialize", "apiBase"]); | ||
if (!isEmptyObject(rest)) log('error', ['some invalid props were passed to IntercomProvider. ', "Please check following props: " + Object.keys(rest).join(', ') + "."].join('')); | ||
var memoizedAppId = useRef(appId); | ||
var memoizedApiBase = useRef(apiBase); | ||
var isBooted = useRef(autoBoot); | ||
@@ -277,8 +279,12 @@ var memoizedShouldInitialize = useRef(shouldInitialize); | ||
if (autoBoot) { | ||
IntercomAPI('boot', { | ||
IntercomAPI('boot', _extends({ | ||
app_id: memoizedAppId.current | ||
}, memoizedApiBase.current && { | ||
api_base: memoizedApiBase.current | ||
})); | ||
window.intercomSettings = _extends({ | ||
app_id: memoizedAppId.current | ||
}, memoizedApiBase.current && { | ||
api_base: memoizedApiBase.current | ||
}); | ||
window.intercomSettings = { | ||
app_id: memoizedAppId.current | ||
}; | ||
} | ||
@@ -314,2 +320,4 @@ } | ||
app_id: memoizedAppId.current | ||
}, memoizedApiBase.current && { | ||
api_base: memoizedApiBase.current | ||
}, props && mapIntercomPropsToRawIntercomProps(props)); | ||
@@ -316,0 +324,0 @@ |
@@ -226,2 +226,3 @@ export declare type RawMessengerAttributes = { | ||
app_id: string; | ||
api_base?: string; | ||
} & RawIntercomProps; | ||
@@ -228,0 +229,0 @@ export declare type IntercomProps = MessengerAttributes & DataAttributes; |
@@ -7,3 +7,3 @@ { | ||
"homepage": "https://github.com/devrnt/react-use-intercom#readme", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"license": "MIT", | ||
@@ -73,3 +73,3 @@ "main": "dist/index.js", | ||
"bundlesize": "^0.18.0", | ||
"cypress": "5.3.0", | ||
"cypress": "5.4.0", | ||
"dotenv": "^8.2.0", | ||
@@ -76,0 +76,0 @@ "husky": "^4.2.5", |
@@ -76,2 +76,3 @@ <p align="center"><img src="./assets/logo.png" alt="Logo" height="120px" style="margin-top: 20px;"/></p> | ||
| shouldInitialize | boolean | indicates if the Intercom should be initialized. Can be used in multistaged environment | false | true | | ||
| apiBase | string | If you need to route your Messenger requests through a different endpoint than the default. Generally speaking, this is not needed.<br/> Format: `https://${INTERCOM_APP_ID}.intercom-messenger.com` (See: [https://github.com/devrnt/react-use-intercom/pull/96](https://github.com/devrnt/react-use-intercom/pull/96)) | false | | | ||
@@ -78,0 +79,0 @@ #### Example |
@@ -10,3 +10,3 @@ import { IntercomProps } from './types'; | ||
* @param props the standard optional intercom props | ||
* | ||
* | ||
* @see {@link https://developers.intercom.com/installing-intercom/docs/intercom-javascript#section-intercomboot-intercomsettings} | ||
@@ -25,3 +25,3 @@ | ||
* @remarks This method will effectively clear out any user data that you have been passing through the JS API. | ||
* @see {@link https://developers.intercom.com/installing-intercom/docs/intercom-javascript#section-intercomshutdown} | ||
@@ -158,2 +158,10 @@ */ | ||
shouldInitialize?: boolean; | ||
/** | ||
* If you need to route your Messenger requests through a different endpoint than the default | ||
* | ||
* @remarks Generally speaking, this is not needed. | ||
* Format https://${INTERCOM_APP_ID}.intercom-messenger.com | ||
*/ | ||
apiBase?: string; | ||
}; |
@@ -247,3 +247,6 @@ export type RawMessengerAttributes = { | ||
export type RawIntercomBootProps = { app_id: string } & RawIntercomProps; | ||
export type RawIntercomBootProps = { | ||
app_id: string; | ||
api_base?: string; | ||
} & RawIntercomProps; | ||
@@ -250,0 +253,0 @@ export type IntercomProps = MessengerAttributes & DataAttributes; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
185488
2164
275