{"version":3,"file":"/js/bundle-envoy.dev.js","mappings":";;;;;;;;;;;;;;AAAA;AACA;AACA;AACA,kBAAkB,sBAAsB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,EAAE;AACtC,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B;;AAE1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,kCAAkC;;AAElC;AACA;AACA;;AAEA;AACA;AACA,qEAAqE;AACrE;AACA;AACA,0CAA0C;AAC1C;AACA,uEAAuE;AACvE;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,6DAA6D;AAC7D;AACA,oBAAoB,oBAAoB;AACxC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,QAAQ;AACR;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA,WAAW;AACX;AACA,OAAO;AACP;AACA,6CAA6C;AAC7C,OAAO;AACP;AACA,6BAA6B;AAC7B;AACA,KAAK;AACL;AACA,oBAAoB,yCAAyC;AAC7D,mBAAmB;AACnB;AACA;AACA;;AAEA,mCAAmC,WAAW;AAC9C;;AAE0B;;;;;;;UCrI1B;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;ACNgC;AAEhC,IAAMC,KAAK,GAAG;EACbC,WAAW,EAAE,aAAa;EAC1BC,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ACCC,OAAO,EAAE,IAAI,CAAC7C,QAAQ;MACtB8C,MAAM,EAAE;IACT,CACD,CAAC;EACF,CAAC;EACDrC,SAAS,WAAAA,UAAA,EAAG;IACX,IAAI,CAACR,KAAK,GAAG,IAAI,CAAC8C,gBAAgB,CAAC,CAAC;EACrC,CAAC;EACDC,cAAc,WAAAA,eAAA,EAAG;IAChB,OAAOnD,iDAAO,CAAC6C,GAAG,CAAC,IAAI,CAAC3C,WAAW,CAAC;EACrC,CAAC;EACDgD,gBAAgB,WAAAA,iBAAA,EAAG;IAClB,IAAME,YAAY,GAAG,IAAI,CAACD,cAAc,CAAC,CAAC;IAC1C,IAAK,OAAOC,YAAY,KAAK,QAAQ,EAAG;MACvC,OAAO,IAAIC,GAAG,CAAC,CAAC;IACjB;IAEA,OAAO,IAAIA,GAAG,CAACC,IAAI,CAACC,KAAK,CAACH,YAAY,CAAC,CAAC;EACzC,CAAC;EACDL,cAAc,WAAAA,eAAA,EAAG;IAChB,IAAIS,GAAG,GAAGC,KAAK,CAACC,IAAI,CAAC,IAAI,CAACtD,KAAK,CAACuD,OAAO,CAAC,CAAC,CAAC;IAC1CH,GAAG,CAACI,IAAI,CAAC,CAAE,MAAM,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC,CAAE,CAAC;IAChC,OAAOR,IAAI,CAACS,SAAS,CAACP,GAAG,CAAC;EAC3B;AACD,CAAC;AACDvD,KAAK,CAACQ,IAAI,CAAC,CAAC;AACZO,MAAM,CAACgD,UAAU,GAAG/D,KAAK,C","sources":["webpack://EPIC-2021/./node_modules/js-cookie/dist/js.cookie.mjs","webpack://EPIC-2021/webpack/bootstrap","webpack://EPIC-2021/webpack/runtime/define property getters","webpack://EPIC-2021/webpack/runtime/hasOwnProperty shorthand","webpack://EPIC-2021/webpack/runtime/make namespace object","webpack://EPIC-2021/./js/src/envoy.js"],"sourcesContent":["/*! js-cookie v3.0.5 | MIT */\n/* eslint-disable no-var */\nfunction 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 */\nvar 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\nfunction 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\nvar api = init(defaultConverter, { path: '/' });\n/* eslint-enable no-var */\n\nexport { api as default };\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import Cookies from 'js-cookie';\n\nconst Envoy = {\n\tcookie_name: 'rapyd_envoy',\n\tlifetime: null,\n\tattrs: null,\n\tparams: [ 'utm_source', 'utm_medium', 'utm_name', 'utm_term', 'utm_campaign', 'utm_content' ],\n\tcallbacks: {\n\t\tonBeforeFormSubmit: (event) => Envoy.onBeforeFormSubmit(event),\n\t},\n\tinit() {\n\t\tconst days_per_month = 30;\n\t\tconst months = 6;\n\t\tthis.loadAttrs();\n\t\tthis.lifetime = days_per_month * months;\n\t\tif ( this.hasAttrs() ) {\n\t\t\tthis.saveAttrs();\n\t\t}\n\t\tthis.setupHubSpotEventHandlers();\n\t},\n\tsetupHubSpotEventHandlers() {\n\t\twindow.addEventListener('message', this.messageCallback.bind(this));\n\t},\n\tmessageCallback(event) {\n\t\tif ( event?.data?.type === 'hsFormCallback' ) {\n\t\t\tif ( typeof this.callbacks[event.data.eventName] === 'function' ) {\n\t\t\t\tthis.callbacks[event.data.eventName](event);\n\t\t\t}\n\t\t}\n\t},\n\tonBeforeFormSubmit(event) {\n\t\t// Check if it's a form we're interested in\n\t\tconst form_ids = window.HubSpotUtmFormIds || [];\n\n\t\tif (\n\t\t\t!form_ids.includes('all')\n\t\t\t&& !form_ids.includes(event.data.id)\n\t\t) {\n\t\t\t// Do nothing if we don't have a form that should have UTM codes\n\t\t\treturn;\n\t\t}\n\n\t\t// Set params in form\n\t\tthis.attrs.forEach( (value, key) => {\n\t\t\tif ( key === 'date' ) { return; }\n\t\t\tconst $inputs = document.querySelectorAll(`.hs-input[name=\"${key}\"]`);\n\t\t\tif ( $inputs.length > 0 ) {\n\t\t\t\tfor ( let i = 0; i < $inputs.length; i++ ) {\n\t\t\t\t\t$inputs[i].value = value;\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t},\n\thasAttrs() {\n\t\tlet search_params = new URLSearchParams(document.location.search);\n\t\tthis.params.forEach( name => {\n\t\t\tif ( search_params.has(name) ) {\n\t\t\t\tthis.attrs.set(name, search_params.get(name));\n\t\t\t}\n\t\t} );\n\t\treturn this.attrs.size > 0;\n\t},\n\tsaveAttrs() {\n\t\tCookies.set(\n\t\t\tthis.cookie_name,\n\t\t\tthis.serializeAttrs(),\n\t\t\t{\n\t\t\t\texpires: this.lifetime,\n\t\t\t\tdomain: '.rapyd.net',\n\t\t\t}\n\t\t);\n\t},\n\tloadAttrs() {\n\t\tthis.attrs = this.unserializeAttrs();\n\t},\n\tgetCookieValue() {\n\t\treturn Cookies.get(this.cookie_name);\n\t},\n\tunserializeAttrs() {\n\t\tconst cookie_value = this.getCookieValue();\n\t\tif ( typeof cookie_value !== 'string' ) {\n\t\t\treturn new Map();\n\t\t}\n\n\t\treturn new Map(JSON.parse(cookie_value));\n\t},\n\tserializeAttrs() {\n\t\tlet arr = Array.from(this.attrs.entries());\n\t\tarr.push([ 'date', Date.now() ]);\n\t\treturn JSON.stringify(arr);\n\t}\n};\nEnvoy.init();\nwindow.RapydEnvoy = Envoy;\n\n"],"names":["Cookies","Envoy","cookie_name","lifetime","attrs","params","callbacks","onBeforeFormSubmit","event","init","days_per_month","months","loadAttrs","hasAttrs","saveAttrs","setupHubSpotEventHandlers","window","addEventListener","messageCallback","bind","_event$data","data","type","eventName","form_ids","HubSpotUtmFormIds","includes","id","forEach","value","key","$inputs","document","querySelectorAll","concat","length","i","_this","search_params","URLSearchParams","location","search","name","has","set","get","size","serializeAttrs","expires","domain","unserializeAttrs","getCookieValue","cookie_value","Map","JSON","parse","arr","Array","from","entries","push","Date","now","stringify","RapydEnvoy"],"sourceRoot":""}