fix: Return if window.$chatwoot is already defined (#3847)

This commit is contained in:
Pranav Raj S 2022-01-25 16:39:19 -08:00 committed by GitHub
parent 8cff690640
commit 23965fbaa3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -27,6 +27,10 @@ export const hasUserKeys = user =>
REQUIRED_USER_KEYS.reduce((acc, key) => acc || !!user[key], false); REQUIRED_USER_KEYS.reduce((acc, key) => acc || !!user[key], false);
const runSDK = ({ baseUrl, websiteToken }) => { const runSDK = ({ baseUrl, websiteToken }) => {
if (window.$chatwoot) {
return;
}
const chatwootSettings = window.chatwootSettings || {}; const chatwootSettings = window.chatwootSettings || {};
window.$chatwoot = { window.$chatwoot = {
baseUrl, baseUrl,