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,EAAUjB,KAAKC,OACrB,QAAwB,CACpB9I,MAAO,kBACP+I,iBAAkB,SAClBgB,UAAWD,EAAUlB,GAAa,MAElCtH,EACAhD,KAAK2K,YAGL3K,KAAK6K,QACT,GAER,EACAA,OAAQ,WACJa,mBAAmB1L,KAAKoK,cACxBpK,KAAKoK,aAAeuB,oBAAoB3L,KAAK4L,QAAQhB,KAAK5K,MAAO,CAC7D6L,QAAS,KAEjB,EACAD,QAAS,WACLnK,OAAOqK,OAAOC,YAAY,CACtB/J,SAAU,oBACV3B,IAAKwI,SAASrI,SAASwL,KACvB/J,OAAQgI,EAAOhI,UAChB,IACP,EACA0I,UAAW,WACPe,mBAAmB1L,KAAKqK,iBACxBrK,KAAKqK,gBAAkBsB,oBAAoB3L,KAAKiM,WAAWrB,KAAK5K,MAAO,CACnE6L,QAAS,KAEjB,EACAI,WAAY,WACRxK,OAAOqK,OAAOC,YAAY,CACtB/J,SAAU,MACVrB,KAAM,aACNsB,OAAQgI,EAAOhI,UAChB,IACP,GAEOvC,MACf,GACJ,C","sources":["webpack://@whistleout/webui/./Areas/Widgets/js/EmbedProductModal.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":["import { initBootstrapSelect } from '../../Shared/js/vendor/deferred/bootstrap-select';\n\n(function () {\n 'use strict';\n\n // HACK: async/await doesn't work with jQuery here for some reason\n wo$(() => initBootstrapSelect().then(() => {\n\n var page = wo$('#share-product');\n if (!page.length) return;\n var data = WhistleOut.readLookupData(page);\n\n var controller = {\n init: function () {\n controller.updateTransactUrl();\n\n page.find('#embed-code, #share-url').off('click').click(\n function () {\n WhistleOut.focusAndSelect(this, true);\n WhistleOut.triggerPopoverNotification(this, data.resources.copied, 'bottom');\n });\n\n page.find('[data-shortcode-input]').off('click').click(\n function () {\n WhistleOut.focusAndSelect(this, true);\n WhistleOut.triggerPopoverNotification(this, data.resources.copied);\n });\n\n page.find('#transact-url').off('input').on('input',\n function () {\n controller.updateTransactUrl();\n });\n\n page.on('show.bs.modal',\n 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 WhistleOut.applySelectPicker(page.find('#widget-mode'));\n page.find('#widget-mode').selectpicker('val', ['standard']);\n\n page.find('#widget-mode').off('change', controller.updatePreview).on('change', function () {\n controller.updatePreview(true);\n });\n\n wo$(window).on('message',\n function (event) {\n if (event.originalEvent.data &&\n Object.prototype.hasOwnProperty.call(event.originalEvent.data, 'sentinel') &&\n event.originalEvent.data.sentinel === 'whistleout-widget') {\n page.find('#embed-preview').height(event.originalEvent.data.height);\n }\n });\n },\n\n updateTransactUrl: function () {\n var url = page.find('#transact-url').val();\n var transactShortcodeInput = page.find('[data-original-shortcode]');\n var originalShortcode = transactShortcodeInput.data('original-shortcode');\n if (originalShortcode) {\n var updatedShortcode = originalShortcode.replace('REPLACE_URL', url);\n transactShortcodeInput.val(updatedShortcode);\n\n var outputDiv = page.find('[data-original-output]');\n var originalOutput = outputDiv.data('original-output');\n var updatedOutput = originalOutput.replace('REPLACE_URL', url);\n outputDiv.html(updatedOutput);\n\n if (!outputDiv.data('bs.popover')) {\n outputDiv.popover({\n trigger: 'hover',\n placement: 'top',\n html: true,\n content: function () {\n return page.find('[data-original-output]').data('original-output').replace('REPLACE_URL', page.find('#transact-url').val());\n }\n });\n }\n }\n },\n\n updatePreview: function (refreshWidget) {\n var code;\n\n var amp = false;\n var compact = false;\n var cta = false;\n var ctaWide = false;\n\n var selectedOptions = page.find('#widget-mode').selectpicker('val');\n if (wo$.inArray('amp', selectedOptions) > -1) {\n amp = true;\n }\n if (wo$.inArray('compact', selectedOptions) > -1) {\n compact = true;\n }\n if (wo$.inArray('cta', selectedOptions) > -1) {\n cta = true;\n }\n if (wo$.inArray('cta-wide', selectedOptions) > -1) {\n ctaWide = true;\n }\n\n var query = '';\n if (compact) {\n query = WhistleOut.updateQueryStringParameter(query, 'layout', 'Compact');\n } else if (cta) {\n query = WhistleOut.updateQueryStringParameter(query, 'layout', 'CTA');\n } else if (ctaWide) {\n query = WhistleOut.updateQueryStringParameter(query, 'layout', 'CTA-Wide');\n }\n\n var embedAmpUrl = (data.embedAmpUrl + query).replace(/&/g, '&');\n var embedIFrameUrl = (data.embedIFrameUrl + '?' + query).replace(/&/g, '&');\n if (amp) {\n code = data.embedAmpFormatString.replace('{ampurl}', embedAmpUrl);\n } else {\n var embedUrl = data.embedUrl + query;\n if (data.encode) embedUrl = embedUrl.replace(/&/g, '&');\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 if (compact) {\n previewUrl = WhistleOut.updateQueryStringParameter(previewUrl, 'layout', 'Compact');\n } else if (cta) {\n previewUrl = WhistleOut.updateQueryStringParameter(previewUrl, 'layout', 'CTA');\n }\n else if (ctaWide) {\n previewUrl = WhistleOut.updateQueryStringParameter(previewUrl, 'layout', 'CTA-Wide');\n }\n\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}());\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":["wo$","initBootstrapSelect","then","page","length","data","WhistleOut","readLookupData","controller","init","updateTransactUrl","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","applySelectPicker","selectpicker","window","event","originalEvent","Object","prototype","hasOwnProperty","call","sentinel","height","val","transactShortcodeInput","originalShortcode","updatedShortcode","replace","outputDiv","updatedOutput","html","popover","trigger","placement","content","refreshWidget","code","amp","compact","cta","ctaWide","selectedOptions","inArray","query","updateQueryStringParameter","embedAmpUrl","embedIFrameUrl","embedAmpFormatString","embedUrl","encode","embedFormatString","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","apply","assign","widget","getWidget","widgetInit","resizeTaskId","resizeTaskAmpId","startTime","Date","now","widget_placement","parentElement","resizeAmp","bind","resize","context","contentType","applyPopover","showTracking","initWidget","fail","jqXHR","textStatus","responseText","remove","endTime","duration","cancelIdleCallback","requestIdleCallback","_resize","timeout","parent","postMessage","href","_resizeAmp"],"sourceRoot":""}