{"version":3,"sources":["webpack:///./src/ac/js/components/Component.js","webpack:///./src/ac/js/components/PhoneSwap.js","webpack:///./node_modules/js-cookie/dist/js.cookie.js"],"names":["domTree","WeakMap","configuration","Component","el","config","arguments","length","undefined","_classCallCheck","this","Error","$el","jQuery","$","set","hasOwnProperty","dom","setupDefaults","addListeners","get","elements","__webpack_require__","PhoneSwap","_this","_possibleConstructorReturn","__proto__","Object","getPrototypeOf","call","setPPCFranchiseId","setLocalizedFranchiseId","idInQueryString","localizedFID","ppcFID","setPPCFranchiseIdCookie","parsePhoneNumbers","swap","$phoneElements","phoneNumbers","idCookieName","metadataCookieName","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_step","_iterator","Symbol","iterator","next","done","origNum","value","getAttribute","includes","replace","addPhoneNumberToList","strippedNum","err","return","num","push","data","fid","URL","window","location","searchParams","isValidFranchiseId","getFranchiseIdFromCookie","_jsCookie2","default","expires","cookieName","yoTrackInfo","_typeof","numbers","yotrackId","id","YoTrack","api","swapPhones","line","console","log","getMetadata","metadata","isSEMSession","factory","assign","target","i","source","key","init","converter","defaultAttributes","name","attributes","document","Date","now","toUTCString","encodeURIComponent","decodeURIComponent","escape","stringifiedAttributes","attributeName","split","cookie","write","create","cookies","jar","parts","slice","join","found","read","e","remove","withAttributes","withConverter","freeze","path","module","exports"],"mappings":"ohBAAA,IAAMA,EAAU,IAAIC,QACdC,EAAgB,IAAID,QA4BpBE,aAOJ,SAAAA,EAAYC,GAAgB,IAAZC,EAAYC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,MAC1B,+FAD0BG,CAAAC,KAAAP,QACR,IAAPC,EACT,MAAM,IAAIO,MAAM,wEASlBD,KAAKE,IAAMR,aAAcS,EAAST,EAAKU,EAAEV,GAEjB,IAApBM,KAAKE,IAAIL,SAEbP,EAAQe,IAAIL,SACZR,EAAca,IAAIL,KAAML,GAEpBK,KAAKL,OAAOW,eAAe,SAC7BN,KAAKO,IAAMP,KAAKL,OAAOY,K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AgB,IAOAO,OAAA,SAAAvB,EAAAC,GACAnF,EACAkF,EACA,GACAR,KAAqBS,GACrB1B,SAAA,MAIAiD,eAAA,SAAAvB,GACA,OAAAJ,EAAApF,KAAAqF,UAAAN,KAA+C/E,KAAAwF,gBAE/CwB,cAAA,SAAA3B,GACA,OAAAD,EAAAL,KAA+B/E,KAAAqF,aAAArF,KAAAwF,eAI/BA,YAAqB9C,MAAAzB,OAAAgG,OAAA3B,IACrBD,WAAoB3C,MAAAzB,OAAAgG,OAAA5B,MAKpBD,EAnHAwB,KAAA,SAAAlE,GAIA,MAHA,MAAAA,EAAA,KACAA,IAAA+D,MAAA,OAEA/D,EAAAG,QAAA,mBAAwCiD,qBAExCM,MAAA,SAAA1D,GACA,OAAAmD,mBAAAnD,GAAAG,QACA,2CACAiD,uBA0GoCoB,KAAA,OA1IpCC,EAAAC,QAAAtC","file":"23.1408cf746553242fe7fb.js","sourcesContent":["const domTree = new WeakMap();\nconst configuration = new WeakMap();\n\n/**\n * Component is a class that should be extended for every component that's being made. It\n * is a helper class to keep the code uniform.\n *\n * __PLEASE NOTE__: This is only to be extended, not instantiated.\n *\n * @example\n * import Component from 'component';\n *\n * class Foo extends Component {\n * construction(el){\n * super(el);\n * }\n *\n * setupDefaults(){\n * // ...defaults go here\n * }\n *\n * addListeners(){\n * // ...listeners go here\n * }\n * }\n *\n * // Create a new Foo component\n * new Foo('.foo');\n */\nclass Component {\n /**\n * Component constructor - see {@link config} on how to pass in additional configuration to the constructor\n *\n * @param {string|Object} el - Main DOM element, you can pass a string such as `'.foo'` __or__ a jQuery object such as `$('.foo')`\n * @param {Object} [config={ }] - Additional component configuration; reachable with `this.config`\n */\n constructor(el, config = {}){\n if (typeof el === 'undefined') {\n throw new Error('You must provide an element as a String type or a jQuery object type');\n }\n\n /**\n * Main class element, this will be a jQuery instance\n * This can be reachable at any time in your superclass with `this.$el`\n *\n * @type {Object}\n */\n this.$el = el instanceof jQuery ? el : $(el);\n\n if (this.$el.length === 0) return;\n\n domTree.set(this, {});\n configuration.set(this, config);\n\n if (this.config.hasOwnProperty('dom')) {\n this.dom = this.config.dom;\n }\n\n this.setupDefaults();\n this.addListeners();\n }\n\n /**\n * This method is used for override;\n * It's called directly after the element and configuration have been set up\n * @abstract\n */\n setupDefaults(){}\n\n /**\n * This method is used for override;\n * It's called directly after `setupDefaults()`, so everything is ready and setup at this point.\n * @abstract\n */\n addListeners(){}\n\n /**\n * Get component configuration\n *\n * @example\n * class Foo extends Component {\n * construction(el, config){\n * super(el, config);\n * }\n *\n * setupDefaults(){\n * console.log(this.config.name); // Outputs \"Foo\"\n * }\n * }\n *\n * // Create a new Foo component with some configuration\n * new Foo('.foo', {\n * name: 'Foo'\n * });\n *\n * @type {Object}\n */\n get config(){\n return configuration.get(this);\n }\n\n /**\n * Set DOM object\n *\n * @example\n * class Foo extends Component {\n * construction(el){\n * super(el);\n * }\n *\n * setupDefaults(){\n * this.dom = {\n * $container: this.$el.find('.container')\n * }\n * }\n *\n * addListeners(){\n * //DOM object is available\n * console.log(this.dom.$container);\n * }\n * }\n *\n * // Create a new Foo component\n * new Foo('.foo');\n *\n * @type {Object}\n */\n set dom(elements){\n elements = {\n ...this.dom,\n ...elements\n };\n\n domTree.set(this, elements);\n }\n\n /**\n * Get DOM object\n *\n * @example\n * this.dom\n *\n * @type {Object}\n */\n get dom(){\n return domTree.get(this);\n }\n}\n\nexport default Component;\n\n\n\n// WEBPACK FOOTER //\n// ./src/ac/js/components/Component.js","import Component from 'component';\nimport Cookies from 'js-cookie';\n\nclass PhoneSwap extends Component {\n constructor(el) {\n super(el);\n\n this.setPPCFranchiseId();\n this.setLocalizedFranchiseId();\n\n // If the PPC query params exists, then skip this and go right to the phone swap\n if (!this.idInQueryString) {\n if (typeof this.localizedFID !== 'undefined') {\n this.ppcFID = this.localizedFID;\n this.setPPCFranchiseIdCookie(this.ppcFID);\n }\n }\n\n this.parsePhoneNumbers();\n this.swap();\n }\n\n setupDefaults() {\n this.$phoneElements = this.$el;\n this.phoneNumbers = [];\n this.ppcFID = null; //Franchise ID passed in from PPC campaign\n this.localizedFID = null; //Franchise ID of the localized franchise\n this.idCookieName = 'yotrack-fid';\n this.metadataCookieName = 'YoTrackMetaDataWidget';\n this.idInQueryString = false;\n }\n\n parsePhoneNumbers() {\n for(const item of this.$phoneElements) {\n let origNum = item.getAttribute('href');\n\n if (origNum.includes('tel:')) {\n origNum = origNum.replace('tel:', '');\n\n if (origNum !== '') {\n this.addPhoneNumberToList(origNum);\n\n const strippedNum = origNum.replace(/\\D/g, '');\n this.addPhoneNumberToList(strippedNum);\n }\n }\n }\n }\n\n addPhoneNumberToList(num) {\n if (!this.phoneNumbers.includes(num)) {\n this.phoneNumbers.push(num);\n }\n }\n\n // Get FID of the current localized page\n setLocalizedFranchiseId() {\n this.localizedFID = $('[data-fid]').data('fid');\n }\n\n // Get FID associated with a particular PPC campaign\n setPPCFranchiseId() {\n const url = new URL(window.location);\n let fid = url.searchParams.get('fid');\n\n if (!this.isValidFranchiseId(fid)) {\n fid = this.getFranchiseIdFromCookie(this.idCookieName);\n } else {\n this.idInQueryString = true;\n this.setPPCFranchiseIdCookie(fid);\n }\n\n this.ppcFID = fid;\n }\n\n setPPCFranchiseIdCookie(fid) {\n Cookies.set(this.idCookieName, fid, { expires: 14 });\n }\n\n getFranchiseIdFromCookie(cookieName) {\n const fid = Cookies.get(cookieName);\n\n if (this.isValidFranchiseId(fid)) {\n return fid;\n }\n\n return null;\n }\n\n isValidFranchiseId(fid) {\n if (typeof fid === 'undefined' || fid === null || fid === 'undefined' || fid === '') {\n return false;\n }\n\n return true;\n }\n\n\n swap() {\n if (!this.isValidFranchiseId(this.ppcFID) || this.phoneNumbers.length === 0) {\n return;\n }\n //get info attached to body tag. jquery will automatically parse JSON\n const yoTrackInfo = $('[data-hfc-yotrack-info]').data('hfc-yotrack-info');\n if (typeof (yoTrackInfo) === 'object') {\n\n const numbers = this.phoneNumbers;\n //yotrack id is embedded in html attribute\n const yotrackId = yoTrackInfo.id;\n const cookieName = this.metadataCookieName;\n\n window.YoTrack(yotrackId,\n (err, api) => {\n if (err) {\n\n window.YoTrack(yotrackId,\n (err, api) => {\n api.swapPhones(numbers,\n (err, line) => {\n console.log('Error: ', err)\n console.log('Phone Number: ', line)\n })\n })\n } else {\n api.swapPhones(numbers,\n (err, line) => {\n console.log('Error: ', err)\n console.log('Phone Number: ', line)\n })\n }\n\n api.getMetadata((err, metadata) => {\n Cookies.set(cookieName, metadata, { expires: 1 });\n console.log('Meta-data: ', metadata)\n });\n\n api.isSEMSession((err, isSEMSession) => {\n console.log('Is SEM Session: ', isSEMSession /*true or false*/);\n });\n });\n }\n }\n}\n\n\nexport default PhoneSwap;\n\n\n\n// WEBPACK FOOTER //\n// ./src/ac/js/components/PhoneSwap.js","/*! js-cookie v3.0.5 | MIT */\n;\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (function () {\n var current = global.Cookies;\n var exports = global.Cookies = factory();\n exports.noConflict = function () { global.Cookies = current; return exports; };\n })());\n})(this, (function () { 'use strict';\n\n /* eslint-disable no-var */\n function assign (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n target[key] = source[key];\n }\n }\n return target\n }\n /* eslint-enable no-var */\n\n /* eslint-disable no-var */\n var defaultConverter = {\n read: function (value) {\n if (value[0] === '\"') {\n value = value.slice(1, -1);\n }\n return value.replace(/(%[\\dA-F]{2})+/gi, decodeURIComponent)\n },\n write: function (value) {\n return encodeURIComponent(value).replace(\n /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,\n decodeURIComponent\n )\n }\n };\n /* eslint-enable no-var */\n\n /* eslint-disable no-var */\n\n function init (converter, defaultAttributes) {\n function set (name, value, attributes) {\n if (typeof document === 'undefined') {\n return\n }\n\n attributes = assign({}, defaultAttributes, attributes);\n\n if (typeof attributes.expires === 'number') {\n attributes.expires = new Date(Date.now() + attributes.expires * 864e5);\n }\n if (attributes.expires) {\n attributes.expires = attributes.expires.toUTCString();\n }\n\n name = encodeURIComponent(name)\n .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)\n .replace(/[()]/g, escape);\n\n var stringifiedAttributes = '';\n for (var attributeName in attributes) {\n if (!attributes[attributeName]) {\n continue\n }\n\n stringifiedAttributes += '; ' + attributeName;\n\n if (attributes[attributeName] === true) {\n continue\n }\n\n // Considers RFC 6265 section 5.2:\n // ...\n // 3. If the remaining unparsed-attributes contains a %x3B (\";\")\n // character:\n // Consume the characters of the unparsed-attributes up to,\n // not including, the first %x3B (\";\") character.\n // ...\n stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];\n }\n\n return (document.cookie =\n name + '=' + converter.write(value, name) + stringifiedAttributes)\n }\n\n function get (name) {\n if (typeof document === 'undefined' || (arguments.length && !name)) {\n return\n }\n\n // To prevent the for loop in the first place assign an empty array\n // in case there are no cookies at all.\n var cookies = document.cookie ? document.cookie.split('; ') : [];\n var jar = {};\n for (var i = 0; i < cookies.length; i++) {\n var parts = cookies[i].split('=');\n var value = parts.slice(1).join('=');\n\n try {\n var found = decodeURIComponent(parts[0]);\n jar[found] = converter.read(value, found);\n\n if (name === found) {\n break\n }\n } catch (e) {}\n }\n\n return name ? jar[name] : jar\n }\n\n return Object.create(\n {\n set,\n get,\n remove: function (name, attributes) {\n set(\n name,\n '',\n assign({}, attributes, {\n expires: -1\n })\n );\n },\n withAttributes: function (attributes) {\n return init(this.converter, assign({}, this.attributes, attributes))\n },\n withConverter: function (converter) {\n return init(assign({}, this.converter, converter), this.attributes)\n }\n },\n {\n attributes: { value: Object.freeze(defaultAttributes) },\n converter: { value: Object.freeze(converter) }\n }\n )\n }\n\n var api = init(defaultConverter, { path: '/' });\n /* eslint-enable no-var */\n\n return api;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/js-cookie/dist/js.cookie.js\n// module id = 669\n// module chunks = 23"],"sourceRoot":""}