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BACVzB,IAAKsH,SAASnH,SAASwK,KACvBjJ,OAAQiH,EAAOjH,UAChB,IACP,EACA2H,UAAW,WACPgB,mBAAmB1K,KAAKoJ,iBACxBpJ,KAAKoJ,gBAAkBuB,oBAAoB3K,KAAKiL,WAAWtB,KAAK3J,MAAO,CACnE6K,QAAS,KAEjB,EACAI,WAAY,WACR1J,OAAOuJ,OAAOC,YAAY,CACtBjJ,SAAU,MACVnB,KAAM,aACNoB,OAAQiH,EAAOjH,UAChB,IACP,GAEOpC,MACf,GACJ,C","sources":["webpack://@whistleout/webui/./Areas/Widgets/js/EmbedPhoneModal.js","webpack://@whistleout/webui/./Areas/Widgets/js/common/utils/EventHelper.js","webpack://@whistleout/webui/../node_modules/.pnpm/core-js@3.31.1/node_modules/core-js/modules/esnext.iterator.find.js","webpack://@whistleout/webui/./Areas/Widgets/js/common/common.ts","webpack://@whistleout/webui/./Areas/Widgets/js/common/index.ts","webpack://@whistleout/webui/./Areas/Widgets/js/common/widget.ts"],"sourcesContent":["(function () {\n 'use strict';\n\n function main() {\n\n var page = wo$('#share-phone');\n if (!page.length) return;\n var data = WhistleOut.readLookupData(page);\n\n var controller = {\n init: function () {\n page.find('#embed-code, #share-url').off('click').click(function () {\n WhistleOut.focusAndSelect(this, true);\n WhistleOut.triggerPopoverNotification(this, data.resources.copied, 'bottom');\n });\n\n page.on('show.bs.modal', function () {\n var url = WhistleOut.replaceQueryString(data.embedInfoUrl, location.search);\n wo$.ajax({\n type: 'GET',\n url: url,\n async: true\n }).done(function (updatedData) {\n data = updatedData;\n controller.updateShareUrl();\n }).always(function () {\n controller.updatePreview(true);\n });\n if (page.find('input#showWidgetCode').length) {\n page.find('input#showWidgetCode').prop('checked', false);\n page.find('input#embed-code').addClass('hidden');\n }\n });\n\n page.find('input#showWidgetCode').change(function () {\n if (this.checked) {\n page.find('input#embed-code').removeClass('hidden');\n page.find('input#embed-code').click();\n }\n else {\n page.find('input#embed-code').addClass('hidden');\n }\n });\n\n page.find('#amp').off('click').on('click', function () {\n controller.updatePreview(false);\n });\n\n wo$(window).on('message',\n function (event) {\n if (event.originalEvent.data && Object.prototype.hasOwnProperty.call(event.originalEvent.data, 'sentinel') && event.originalEvent.data.sentinel === 'whistleout-widget') {\n page.find('#embed-preview').height(event.originalEvent.data.height);\n }\n });\n },\n\n updatePreview: function (refreshWidget) {\n var code;\n var amp = page.find('#amp').is(':checked');\n var embedAmpUrl = data.embedAmpUrl.replace(/&/g, '&');\n var embedIFrameUrl = data.embedIFrameUrl.replace(/&/g, '&');\n if (amp) {\n code = data.embedAmpFormatString.replace('{ampurl}', embedAmpUrl);\n } else {\n var embedUrl = data.encode ? data.embedUrl.replace(/&/g, '&') : data.embedUrl;\n code = data.embedFormatString\n .replace('{url}', embedUrl)\n .replace('{ampurl}', embedAmpUrl)\n .replace('{iframeurl}', embedIFrameUrl);\n }\n\n page.find('#embed-code')\n .val(code)\n .css('background-color', 'rgba(255,255,0,.3)')\n .animate({\n backgroundColor: 'white'\n }, 2000);\n\n if (refreshWidget) {\n var previewUrl = data.previewUrl;\n page.find('#embed-preview').attr('src', previewUrl);\n }\n },\n\n updateShareUrl: function () {\n page.find('#share-url').val(data.shareUrl);\n }\n };\n\n controller.init();\n };\n\n WhistleOut.initModule(import.meta.url, main);\n\n}());\n","export function addEventListener(elements, events, handler) {\n _addOrRemoveListener('add', elements, events, handler);\n}\n\nexport function removeEventListener(elements, events, handler) {\n _addOrRemoveListener('remove', elements, events, handler);\n}\n\nexport function _addOrRemoveListener(action, elements, events, handler) {\n const eventsArray = events.split(' ');\n\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n\n for (let j = 0; j < eventsArray.length; j++) {\n const event = eventsArray[j];\n\n if (action === 'add') {\n element.addEventListener(event, handler);\n } else {\n element.removeEventListener(event, handler);\n }\n }\n }\n}\n","'use strict';\nvar $ = require('../internals/export');\nvar iterate = require('../internals/iterate');\nvar aCallable = require('../internals/a-callable');\nvar anObject = require('../internals/an-object');\nvar getIteratorDirect = require('../internals/get-iterator-direct');\n\n// `Iterator.prototype.find` method\n// https://github.com/tc39/proposal-iterator-helpers\n$({ target: 'Iterator', proto: true, real: true }, {\n find: function find(predicate) {\n anObject(this);\n aCallable(predicate);\n var record = getIteratorDirect(this);\n var counter = 0;\n return iterate(record, function (value, stop) {\n if (predicate(value, counter++)) return stop(value);\n }, { IS_RECORD: true, INTERRUPTED: true }).result;\n }\n});\n","/* globals ga */\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { WhistleOutContext } from '../../../Shared/js/common/common';\nexport class WhistleOutContextWidget extends WhistleOutContext {\n constructor() {\n super();\n this.scope = 'widget';\n }\n pushGtmEvent(category, action, label, value) {\n try {\n const analyticsClientSideData = this.getAnalyticsClientSideData();\n const data = analyticsClientSideData.data;\n this.pushDataLayerItem({\n event: `wo_${category}_${action}`.toLowerCase(),\n customCategory: category,\n customAction: action,\n customLabel: label,\n customValue: isNaN(value) ? undefined : +value,\n customCountry: data.country,\n customProductAreaId: data.productAreaId\n });\n }\n catch (err) {\n this.Rollbar.error(`WhistleOut.pushGtmEvent: category=${category}, action=${action}, label=${label}`, err);\n }\n }\n sendPageView(url) {\n const analyticsClientSideData = this.getAnalyticsClientSideData();\n const config = analyticsClientSideData.config;\n try {\n if (config.trackPageImpression) {\n if ((!url || url.length <= 0) && analyticsClientSideData.data)\n url = analyticsClientSideData.data.trackingUrl;\n wo$.each(config.accounts, function (index, account) {\n ga('create', account.accountNumber, { name: account.trackerId, useAmpClientId: true }, 'auto');\n if (account.linkIdTracking) {\n ga(account.trackerId + '.require', 'linkid');\n }\n ga(account.trackerId + '.set', 'anonymizeIp', true);\n if (!url || url.length <= 0) {\n ga(account.trackerId + '.send', 'pageview');\n }\n else {\n ga(account.trackerId + '.send', 'pageview', {\n page: url\n });\n }\n });\n }\n }\n catch (err) {\n this.Rollbar.error(`WhistleOut.sendPageView url=${url}`, err);\n }\n }\n pushGtmWidgetPageView(url) {\n try {\n const analyticsClientSideData = this.getAnalyticsClientSideData();\n const customCountry = analyticsClientSideData.data.country;\n if (!url || url.length <= 0) {\n url = analyticsClientSideData.data.trackingUrl;\n }\n if (!url || url.length <= 0)\n url = `${location.pathname}${location.search}`;\n const dataLayerValue = {\n event: 'widgetCustomPageView',\n customUrl: url,\n customCountry: customCountry\n };\n this.pushDataLayerItem(dataLayerValue);\n }\n catch (err) {\n this.Rollbar.error('WhistleOut.ushGtmPageView', err);\n }\n }\n trackPageView(url) {\n try {\n this.sendPageView(url);\n this.pushGtmWidgetPageView(url);\n }\n catch (err) {\n this.Rollbar.error(`WhistleOut.trackPageView url=${url}`, err);\n }\n }\n encodeHtml(str) {\n const el = document.createElement('span');\n el.append(document.createTextNode(str));\n return el.innerHTML;\n }\n init() {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.isInitRequested) {\n return;\n }\n yield this.initBase();\n });\n }\n}\n","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport '../../../Shared/js/polyfills';\nimport { WhistleOutContextWidget as WhistleOutContext } from './common';\nimport { widgetInit } from './widget';\n(() => __awaiter(void 0, void 0, void 0, function* () {\n if (window.WhistleOut.isInitRequested) {\n return;\n }\n yield import(/* webpackMode: 'eager' */ '../vendor');\n // Some properties of window.WhistleOut can be initialised\n // by inline scripts before this main initialisation,\n // so we need to merge it\n window.WhistleOut = Object.assign(new WhistleOutContext(), window.WhistleOut || {});\n yield window.WhistleOut.init();\n widgetInit();\n}))();\n","import { pushDataLayerItemWidget } from '../../../Shared/js/utils/datalayer';\nimport * as EventHelper from './utils/EventHelper';\nexport function getWidget() {\n return wo$('#widget');\n}\nexport function widgetInit() {\n wo$(function () {\n const widget = getWidget();\n if (!widget.length)\n return;\n const controller = {\n resizeTaskId: null,\n resizeTaskAmpId: null,\n init: function () {\n const amp = widget.data('amp').toLowerCase() === 'true';\n const url = widget.data('url');\n const startTime = Date.now();\n pushDataLayerItemWidget({\n event: 'widget_load_begin',\n widget_placement: 'iframe'\n });\n const el = widget[0];\n if (amp) {\n EventHelper.addEventListener([window, el, el.parentElement], 'resize', this.resizeAmp.bind(this));\n EventHelper.addEventListener([window], 'load', this.resizeAmp.bind(this));\n }\n else {\n EventHelper.addEventListener([window, el, el.parentElement], 'resize', this.resize.bind(this));\n EventHelper.addEventListener([window], 'load', this.resize.bind(this));\n }\n wo$.ajax({\n context: this,\n type: 'GET',\n url: url,\n contentType: 'text/html'\n })\n .done(function (data) {\n widget.find('#widget-content').html(data);\n WhistleOut.applyPopover();\n WhistleOut.showTracking();\n if (WhistleOut.initWidget) {\n WhistleOut.initWidget();\n }\n })\n .fail(function (jqXHR, textStatus, error) {\n widget.find('#widget-content').html(widget.find('#widget-error').html());\n WhistleOut.Rollbar.error(`ajax error in Widget.js requesting ${url}, status: ${textStatus}, error: ${error}, responseText: ${jqXHR.responseText}`);\n pushDataLayerItemWidget({\n event: 'widget_error',\n widget_placement: 'iframe',\n error: error\n });\n })\n .always(() => {\n widget.find('#widget-error').remove();\n widget.find('#widget-loading').remove();\n const endTime = Date.now();\n pushDataLayerItemWidget({\n event: 'widget_load_end',\n widget_placement: 'iframe',\n duration: (endTime - startTime) / 1000\n });\n if (amp) {\n this.resizeAmp();\n }\n else {\n this.resize();\n }\n });\n },\n resize: function () {\n cancelIdleCallback(this.resizeTaskId);\n this.resizeTaskId = requestIdleCallback(this._resize.bind(this), {\n timeout: 300\n });\n },\n _resize: function () {\n window.parent.postMessage({\n sentinel: 'whistleout-widget',\n url: document.location.href,\n height: widget.height()\n }, '*');\n },\n resizeAmp: function () {\n cancelIdleCallback(this.resizeTaskAmpId);\n this.resizeTaskAmpId = requestIdleCallback(this._resizeAmp.bind(this), {\n timeout: 300\n });\n },\n _resizeAmp: function () {\n window.parent.postMessage({\n sentinel: 'amp',\n type: 'embed-size',\n height: widget.height()\n }, '*');\n }\n };\n controller.init();\n });\n}\n"],"names":["WhistleOut","initModule","import","page","wo$","length","data","readLookupData","controller","init","find","off","click","focusAndSelect","this","triggerPopoverNotification","resources","copied","on","url","replaceQueryString","embedInfoUrl","location","search","ajax","type","async","done","updatedData","updateShareUrl","always","updatePreview","prop","addClass","change","checked","removeClass","window","event","originalEvent","Object","prototype","hasOwnProperty","call","sentinel","height","refreshWidget","code","amp","is","embedAmpUrl","replace","embedIFrameUrl","embedAmpFormatString","embedUrl","encode","embedFormatString","val","css","animate","backgroundColor","previewUrl","attr","shareUrl","addEventListener","elements","events","handler","action","eventsArray","split","i","element","j","_addOrRemoveListener","$","iterate","aCallable","anObject","getIteratorDirect","target","proto","real","predicate","record","counter","value","stop","IS_RECORD","INTERRUPTED","result","WhistleOutContextWidget","constructor","super","scope","pushGtmEvent","category","label","getAnalyticsClientSideData","pushDataLayerItem","toLowerCase","customCategory","customAction","customLabel","customValue","isNaN","undefined","customCountry","country","customProductAreaId","productAreaId","err","Rollbar","error","sendPageView","analyticsClientSideData","config","trackPageImpression","trackingUrl","each","accounts","index","account","ga","accountNumber","name","trackerId","useAmpClientId","linkIdTracking","pushGtmWidgetPageView","pathname","dataLayerValue","customUrl","trackPageView","encodeHtml","str","el","document","createElement","append","createTextNode","innerHTML","thisArg","generator","isInitRequested","initBase","P","Promise","resolve","reject","fulfilled","step","next","e","rejected","then","apply","assign","widget","getWidget","widgetInit","resizeTaskId","resizeTaskAmpId","startTime","Date","now","widget_placement","parentElement","resizeAmp","bind","resize","context","contentType","html","applyPopover","showTracking","initWidget","fail","jqXHR","textStatus","responseText","remove","endTime","duration","cancelIdleCallback","requestIdleCallback","_resize","timeout","parent","postMessage","href","_resizeAmp"],"sourceRoot":""}