; (() => { 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 = '642edefe3882a730b92a52cf' var gatewayUri = 'https://manager.channel.prod.goresponsa.com' var voipUri = '' channelHostUri = channelHostUri ?? 'https://infinite.webchat.channel.prod.goresponsa.com' this.configuration = Object.assign(this.configuration || { gatewayUri, voipUri }, configuration || {}) if (!this.configuration.botId && botId) this.configuration.botId = botId if (this.configuration.gatewayUri == null) this.configuration.gatewayUri = gatewayUri if (this.configuration.voipUri == null) this.configuration.voipUri = voipUri 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)) })()