mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-12-18 18:47:11 +00:00
Fix chatwoot import issue by checking whether we're in an execution environment before loading the script
This commit is contained in:
parent
66f59c8d41
commit
47a087c73b
1 changed files with 19 additions and 14 deletions
|
@ -1,14 +1,19 @@
|
||||||
(function (d, t) {
|
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
|
||||||
var BASE_URL = "https://app.chatwoot.com";
|
|
||||||
var g = d.createElement(t), s = d.getElementsByTagName(t)[0];
|
// Only execute on client-side
|
||||||
g.src = BASE_URL + "/packs/js/sdk.js";
|
if (ExecutionEnvironment.canUseDOM) {
|
||||||
g.defer = true;
|
(function (d, t) {
|
||||||
g.async = true;
|
var BASE_URL = "https://app.chatwoot.com";
|
||||||
s.parentNode.insertBefore(g, s);
|
var g = d.createElement(t), s = d.getElementsByTagName(t)[0];
|
||||||
g.onload = function () {
|
g.src = BASE_URL + "/packs/js/sdk.js";
|
||||||
window.chatwootSDK.run({
|
g.defer = true;
|
||||||
websiteToken: 'cFxvnLSjfE2UF4UUiPCA5NsF',
|
g.async = true;
|
||||||
baseUrl: BASE_URL
|
s.parentNode.insertBefore(g, s);
|
||||||
})
|
g.onload = function () {
|
||||||
}
|
window.chatwootSDK.run({
|
||||||
})(document, 'script');
|
websiteToken: 'cFxvnLSjfE2UF4UUiPCA5NsF',
|
||||||
|
baseUrl: BASE_URL
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})(document, 'script');
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue