fix: Add resetTriggered flag to fix reset loop (#4079)
This commit is contained in:
parent
cebb1bf871
commit
87a6266ddc
2 changed files with 6 additions and 1 deletions
|
@ -25,6 +25,7 @@ const runSDK = ({ baseUrl, websiteToken }) => {
|
|||
launcherTitle: chatwootSettings.launcherTitle || '',
|
||||
showPopoutButton: chatwootSettings.showPopoutButton || false,
|
||||
widgetStyle: chatwootSettings.widgetStyle || 'standard',
|
||||
resetTriggered: false,
|
||||
|
||||
toggle(state) {
|
||||
IFrameHelper.events.toggleBubble(state);
|
||||
|
@ -100,6 +101,8 @@ const runSDK = ({ baseUrl, websiteToken }) => {
|
|||
baseUrl: window.$chatwoot.baseUrl,
|
||||
websiteToken: window.$chatwoot.websiteToken,
|
||||
});
|
||||
|
||||
window.$chatwoot.resetTriggered = true;
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -136,7 +136,9 @@ export const IFrameHelper = {
|
|||
if (window.$chatwoot.user) {
|
||||
IFrameHelper.sendMessage('set-user', window.$chatwoot.user);
|
||||
}
|
||||
dispatchWindowEvent({ eventName: CHATWOOT_READY });
|
||||
if (!window.$chatwoot.resetTriggered) {
|
||||
dispatchWindowEvent({ eventName: CHATWOOT_READY });
|
||||
}
|
||||
},
|
||||
error: ({ errorType, data }) => {
|
||||
dispatchWindowEvent({ eventName: CHATWOOT_ERROR, data: data });
|
||||
|
|
Loading…
Reference in a new issue