;(() => { function getWindowTop(w) { try { if (w.parent.document) { return getWindowTop(w.parent) } } catch (e) { return w } } var webchatWindow = getWindowTop(window) if (webchatWindow.responsa == null) { webchatWindow.responsa = { alreadyLaunched: false, configuration: undefined } } var responsa = webchatWindow.responsa responsa.init = function (configuration = {}, channelHostUri = undefined) { if (this.alreadyLaunched || (!this.configuration && !configuration)) { return } var botId = '65707bdd3882a709cc2cebf1' var managerUri = 'https://manager.channel.prod.goresponsa.com' channelHostUri = channelHostUri ?? 'https://vuscom.webchat.channel.prod.goresponsa.com' this.configuration = Object.assign(this.configuration || { managerUri }, configuration || {}) if (!this.configuration.botId && botId) this.configuration.botId = botId if (this.configuration.managerUri == null) this.configuration.managerUri = managerUri this.alreadyLaunched = true var doc = webchatWindow.document var now = new Date() //now.setMinutes(0) now.setSeconds(0) now.setMilliseconds(0) var scriptPolyfillShadowDOM = doc.createElement('script') scriptPolyfillShadowDOM.src = 'https://cdnjs.cloudflare.com/ajax/libs/shadydom/1.9.0/shadydom.min.js' doc.body.append(scriptPolyfillShadowDOM) var src = '{channel_host_uri}/responsa-webchat.min.js?timestamp={timestamp}' .replace('{channel_host_uri}', channelHostUri) .replace('{timestamp}', now.getTime()) var scriptEl = doc.createElement('script') scriptEl.src = src scriptEl.defer = true doc.body.append(scriptEl) this.loadedScripts = [scriptPolyfillShadowDOM, scriptEl] }.bind(responsa) responsa.unload = function () { this.loadedScripts?.forEach((s) => { s.remove() }) this.alreadyLaunched = false }.bind(responsa) window.addEventListener('load', () => responsa.init(false)) })()