From 66f59c8d41202ab1c03116ece6822490119e938a Mon Sep 17 00:00:00 2001 From: sabaimran Date: Sun, 8 Dec 2024 16:51:43 -0800 Subject: [PATCH] Add Chatwoot to documentation See repo: https://github.com/chatwoot/chatwoot --- documentation/docusaurus.config.js | 4 +++- documentation/src/components/ChatwootWidget.js | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 documentation/src/components/ChatwootWidget.js diff --git a/documentation/docusaurus.config.js b/documentation/docusaurus.config.js index 6fcff6bc..13f4e906 100644 --- a/documentation/docusaurus.config.js +++ b/documentation/docusaurus.config.js @@ -37,6 +37,9 @@ const config = { locales: ['en'], }, + // Add a widget for Chatwoot for live chat if users need help + clientModules: [require.resolve('./src/components/ChatwootWidget.js')], + presets: [ [ 'classic', @@ -69,7 +72,6 @@ const config = { }), ], ], - themeConfig: /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ ({ diff --git a/documentation/src/components/ChatwootWidget.js b/documentation/src/components/ChatwootWidget.js new file mode 100644 index 00000000..61d72684 --- /dev/null +++ b/documentation/src/components/ChatwootWidget.js @@ -0,0 +1,14 @@ +(function (d, t) { + var BASE_URL = "https://app.chatwoot.com"; + var g = d.createElement(t), s = d.getElementsByTagName(t)[0]; + g.src = BASE_URL + "/packs/js/sdk.js"; + g.defer = true; + g.async = true; + s.parentNode.insertBefore(g, s); + g.onload = function () { + window.chatwootSDK.run({ + websiteToken: 'cFxvnLSjfE2UF4UUiPCA5NsF', + baseUrl: BASE_URL + }) + } +})(document, 'script');