Hi there, I am wondering if anyone has experience integrating the WebChat Widget - Version 2 to a Gatsby JS site?
I have tried the following in the gatsby-ssr.js file (which basically adds the script imports to the bodY). The below gives me access to the window._genesys object and the customPlugin which I register in chat.js:
export const onRenderBody = ({ setPostBodyComponents }) => { setPostBodyComponents([ <script src="https://apps.mypurecloud.com.au/widgets/9.0/cxbus.min.js" onLoad={
javascript:CXBus.configure({debug:false,pluginsPath:'https://apps.mypurecloud.com.au/widgets/9.0/plugins/'}); CXBus.loadPlugin('widgets-core');} />, <script src={
${withPrefix('chat.js')}} /> ]) }
But when trying to run:
customPlugin.command('WebChat.open', getAdvancedConfig());
I get this error:
webchat.min.js:1 Uncaught SyntaxError: Unexpected token '<'
Not sure if this helps, but if anyone has experience that would be greatly appreciated.