{"version":3,"sources":["webpack://datalayer/webpack/bootstrap","webpack://datalayer/./Shared/utils/datalayer.mapping.ts","webpack://datalayer/./Shared/utils/cookies.ts","webpack://datalayer/./Shared/utils/cookieTypes.ts","webpack://datalayer/./Shared/utils/datalayer.consent.ts"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","cookies_1","cookieTypes_1","datalayer_consent_1","getCookieStatus","getCookie","acceptCookies","setCookie","cookies","Map","setConsentCookie","denyCookies","cookieToModeMapping","analytical-cookies","functional-cookies","video-cookies","tracking-cookies","getCurrentCookies","map","cookie","requiredCookies","includes","updateConsent","data","defaultContent","forEach","isAccepted","gtag","updateInitialConsent","window","cname","cvalue","exdays","Date","setTime","getTime","expires","toUTCString","document","ca","split","length","charAt","substring","indexOf","consentTypes","_","_i","arguments","dataLayer","push","console","log","updateConsentMode","mapping","pushConsent","cType","cChoice","_a","pushAllConsentTypes","update","ad_storage","ad_user_data","ad_personalization","analytics_storage","functionality_storage","personalization_storage","security_storage"],"mappings":"0BACA,IAAAA,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,GAAA,CACAG,EAAAH,EACAI,GAAA,EACAH,QAAA,IAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QA0DA,OArDAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,EAAA,CAA0CK,YAAA,EAAAC,IAAAL,KAK1CZ,EAAAkB,EAAA,SAAAhB,GACA,oBAAAiB,eAAAC,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GAGC,IAFA,IAAItD,EAAOsD,EAAQ,IACfS,EAAKD,SAASnB,OAAOqB,MAAM,KACtBvE,EAAI,EAAGA,EAAIsE,EAAGE,OAAQxE,IAAK,CAElC,IADA,IAAIK,EAAIiE,EAAGtE,GACW,KAAfK,EAAEoE,OAAO,IACdpE,EAAIA,EAAEqE,UAAU,GAElB,GAAuB,GAAnBrE,EAAEsE,QAAQpE,GACZ,OAAOF,EAAEqE,UAAUnE,EAAKiE,OAAQnE,EAAEmE,QAGtC,MAAO,sHCrBE1E,EAAAyC,QAAU,CACrB,qBACA,qBACA,gBACA,oBAQWzC,EAAAqD,gBAA4B,CAAC,qBAAsB,6LCZnDrD,EAAA8E,aAAe,CAAC,aAAc,eAAgB,qBAAsB,oBAAqB,wBAAyB,0BAA2B,oBAuB1J,SAAgBlB,QAAK,IAAAmB,EAAA,GAAAC,EAAA,EAAAA,EAAAC,UAAAP,OAAAM,IAAAD,EAAAC,GAAAC,UAAAD,GACnB,IAAME,EAAapB,OAAeoB,UAC9BA,EACFA,EAAUC,KAAKF,WAEfG,QAAQC,IAAI,4CAA6CJ,WAVhDjF,EAAAsF,kBAAoB,SAA4BC,GAAwC,gBAACnC,EAAoBO,GAC1G4B,EAAQnC,GAChBM,QAAQ,SAAArC,GAAQ,OAAAmE,EAAYnE,EAAMsC,EAAa,UAAY,cAGnE3D,EAAA4D,OASA,IAAM4B,EAAyE,SAACC,EAAOC,SAErF9B,EAAK,UAAW,WADD+B,EAAA,IAAMF,GAAQC,EAAOC,KAIzB3F,EAAA4F,oBAA2D,SAACC,GACvEjC,EAAK,UAAW,SAAUiC,IAGf7F,EAAAyD,eAAoC,CAC/CqC,WAAc,SACdC,aAAgB,SAChBC,mBAAsB,SACtBC,kBAAqB,UACrBC,sBAAyB,UACzBC,wBAA2B,SAC3BC,iBAAoB","file":"datalayer.bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","import { getCookie, setCookie } from \"./cookies\"\nimport { CookieAccepted, CookieName, cookies, requiredCookies } from \"./cookieTypes\"\nimport { ConsentMapping, defaultContent, FullConsentUpdate, gtag } from \"./datalayer.consent\"\n\nexport type CookieStatus = \"not_touched\" | \"accepted\" | \"denied\" | \"changing\"\n\nexport const getCookieStatus: () => Exclude = () =>\n getCookie(\"cookies\") === \"accepted\" ? \"accepted\" : getCookie(\"cookies\") === \"denied\" ? \"denied\" : \"not_touched\"\n\nexport const acceptCookies = (): void => {\n setCookie(\"cookies\", \"accepted\", 1000)\n \n const cookies: Map = new Map(\n ([\n ['functional-cookies', 'yes'],\n ['analytical-cookies', 'yes'],\n ['video-cookies', 'yes'],\n ['tracking-cookies', 'yes'],\n ] as [CookieName, CookieAccepted][])\n );\n \n setConsentCookie(cookies)\n}\n\nexport const denyCookies = (): void => {\n setCookie(\"cookies\", \"denied\", 1000)\n\n const cookies: Map = new Map(\n ([\n ['functional-cookies', 'yes'],\n ['analytical-cookies', 'yes'],\n ['video-cookies', 'no'],\n ['tracking-cookies', 'no'],\n ] as [CookieName, CookieAccepted][])\n );\n \n setConsentCookie(cookies)\n}\n\nconst cookieToModeMapping: ConsentMapping = { \n 'analytical-cookies': ['analytics_storage'], \n 'functional-cookies': ['functionality_storage', 'security_storage'], \n 'video-cookies': [], \n 'tracking-cookies': ['personalization_storage', 'ad_personalization', 'ad_storage', 'ad_user_data'], \n} \n\nexport const getCurrentCookies: () => Map = () =>\n new Map(cookies.map((cookie) => [cookie, getCookie(cookie) === 'yes' || requiredCookies.includes(cookie) ? 'yes' : 'no']))\n\nexport const updateConsent = (cookies: Map) => {\n const data: FullConsentUpdate = defaultContent\n cookies.forEach((isAccepted, cookie) => {\n var modes = cookieToModeMapping[cookie]\n modes.forEach(mode => data[mode] = isAccepted == 'yes' ? 'granted' : 'denied')\n })\n gtag('consent', 'update', data);\n}\n\nexport const setConsentCookie = (cookies: Map) => { \n updateConsent(cookies) \n cookies.forEach((isAccepted, cookie) => setCookie(cookie, isAccepted, 1000))\n} \n\nexport function updateInitialConsent () {\n updateConsent(getCurrentCookies())\n}\n\nwindow.updateInitialConsent = updateInitialConsent","export const setCookie: (cname:string, cvalue:string, exdays: number) => void =\n (cname, cvalue, exdays) => {\n var d = new Date();\n d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));\n var expires = \"expires=\" + d.toUTCString();\n document.cookie = cname + \"=\" + cvalue + \";\" + expires + \";path=/\";\n }\n\nexport const getCookie: (cname:string) => string = \n (cname:string) => {\n var name = cname + \"=\";\n var ca = document.cookie.split(';');\n for (var i = 0; i < ca.length; i++) {\n var c = ca[i];\n while (c.charAt(0) == ' ') {\n c = c.substring(1);\n }\n if (c.indexOf(name) == 0) {\n return c.substring(name.length, c.length);\n }\n }\n return \"\";\n }","export const cookies = [\n 'functional-cookies',\n 'analytical-cookies',\n 'video-cookies',\n 'tracking-cookies',\n] as const\n\nexport type Cookie = typeof cookies[number]\n\nexport type CookieAccepted = \"yes\" | \"no\"\n\nexport type CookieName = 'functional-cookies' | 'analytical-cookies' | 'video-cookies' | 'tracking-cookies' \nexport const requiredCookies: Cookie[] = ['functional-cookies', 'analytical-cookies']\n","export const consentTypes = ['ad_storage', 'ad_user_data', 'ad_personalization', 'analytics_storage', 'functionality_storage', 'personalization_storage', 'security_storage'] as const\n\nexport type ConsentType = typeof consentTypes[number]\nexport type ConsentChoice = 'denied' | 'granted'\n\nexport type ConsentMapping = {\n [Key in CookieTypes]: ConsentType[]\n}\n\nexport type FullConsentUpdate = { [Key in ConsentType]: ConsentChoice }\n\n/**\n * Send consent updates based on a cookie type and a mapping between cookie types and consent types\n * \n * @param mapping Curried argument: maps between site specific cookies and consent types\n * @param cookie Site specific cookie that triggers an update to consent\n * @param isAccepted Whether the site specific cookie is accepted or not\n */\nexport const updateConsentMode = (mapping: ConsentMapping) => (cookie: CookieType, isAccepted: boolean) => {\n const modes = mapping[cookie]\n modes.forEach(mode => pushConsent(mode, isAccepted ? 'granted' : 'denied'))\n}\n\nexport function gtag(..._: any[]) {\n const dataLayer = (window as any).dataLayer\n if (dataLayer) {\n dataLayer.push(arguments)\n } else {\n console.log(\"DataLayer not found, failed to push event\", arguments)\n } \n}\n\nconst pushConsent: (consentType: ConsentType, choice: ConsentChoice) => void = (cType, cChoice) => {\n const selection = { [cType]: cChoice }\n gtag('consent', 'update', selection)\n}\n\nexport const pushAllConsentTypes: (update: FullConsentUpdate) => void = (update) => {\n gtag('consent', 'update', update)\n}\n\nexport const defaultContent: FullConsentUpdate = {\n 'ad_storage': 'denied',\n 'ad_user_data': 'denied',\n 'ad_personalization': 'denied',\n 'analytics_storage': 'granted',\n 'functionality_storage': 'granted',\n 'personalization_storage': 'denied',\n 'security_storage': 'granted'\n}"],"sourceRoot":""}