{"version":3,"names":["empty","lowerCase","str","toLowerCase","upperCase","toUpperCase","camelCase","replaceAccents","removeNonWord","replace","unCamelCase","properCase","pascalCase","sentenceCase","slugify","delimeter","trim","hyphenate","unhyphenate","underscore","normalizeLineBreaks","lineEnd","search","contains","substring","fromIndex","indexOf","crop","maxChars","append","truncate","escapeRegExp","ESCAPE_CHARS","escapeHtml","unescapeHtml","escapeUnicode","shouldEscapePrintable","ch","test","charCodeAt","toString","slice","stripHtmlTags","removeNonASCII","interpolate","template","replacements","syntax","stache","replaceFn","_match","prop","rpad","minLen","length","repeat","lpad","n","Array","join","onlyFullWords","substr","lastIndexOf","WHITE_SPACES","ltrim","chars","start","len","charLen","found","i","c","charAt","rtrim","end","abbreviate","match","StringUtils","getModalWordings","currentLanguage","wordings_en","header","provinceDropdownLabel","errorMessage","description","defaultSelectedProvince","confirm","ok","wordings_fr","includes","popupMessageModalScss","PopupMessageModalStyle0","PopupMessageModal","this","wordings","handleAction","popupButtonAction","emit","componentWillLoad","language","getLanguage","render","h","key","id","class","isOpen","message","onClick","buttonLabel","regionalSelectorButtonCss","RegionalSelectorButtonStyle0","RegionalSelectorButton","buttonAction","type","bind","global","factory","module","exports","assign","target","arguments","source","defaultConverter","read","value","decodeURIComponent","write","encodeURIComponent","init","converter","defaultAttributes","set","name","attributes","document","expires","Date","now","toUTCString","escape","stringifiedAttributes","attributeName","split","cookie","get","cookies","jar","parts","e","Object","create","remove","withAttributes","withConverter","freeze","api","path","getFilteredProvincesViaAllowedProvinces","allowedProvinces","provinceListData","getProvinceSelectionModalData","defaultProvinces","provinces","newProvinces","filter","province","uriParams","URLSearchParams","window","location","console","log","provinces_en","provincePlaceholder","label","provinces_fr","RegionalSelectorModal","hasError","isCookieSet","provinceList","showErrorMessage","connectedCallback","ketchScript","throwException","redirectOnSubmitTo","redirectOnSubmit","redirectOnSelectedProvinces","redirectOnSelectedProvincesTo","redirectOnSelectedProvince","documentElement","lang","Cookies","undefined","error","triggerKetch","openKetch","selectedProvince","sharedProvinceCookie","ketchProvinceCookie","redirectTo","url","href","getErrorStyle","popupButtonActionHandler","event","detail","isPopupMessageOpen","modal","hidden","handleProvinceSelect","handleSubmit","errorClass","dropdownElem","getElementById","focus","redirectOnSelectedProvincesWithMsg","ref","el","onInput","map","option"],"sources":["src/utils/string-utils.ts","src/utils/wordings.ts","src/components/popup-message-modal/popup-message-modal.scss?tag=popup-message-modal","src/components/popup-message-modal/popup-message-modal.tsx","src/components/regional-selector-button/regional-selector-button.css?tag=regional-selector-button","src/components/regional-selector-button/regional-selector-button.tsx","node_modules/js-cookie/dist/js.cookie.js","src/utils/province-list.ts","src/components/regional-selector-modal/regional-selector-modal.tsx"],"sourcesContent":["// String utils\r\n//\r\n// resources:\r\n// -- mout, https://github.com/mout/mout/tree/master/src/string\r\n\r\nexport function empty(): string {\r\n return '';\r\n}\r\n\r\n/**\r\n * \"Safer\" String.toLowerCase()\r\n */\r\nexport function lowerCase(str: string): string {\r\n return str.toLowerCase();\r\n}\r\n\r\n/**\r\n * \"Safer\" String.toUpperCase()\r\n */\r\nexport function upperCase(str: string): string {\r\n return str.toUpperCase();\r\n}\r\n\r\n/**\r\n * Convert string to camelCase text.\r\n */\r\nexport function camelCase(str): string {\r\n str = replaceAccents(str);\r\n str = removeNonWord(str)\r\n .replace(/\\-/g, \" \") //convert all hyphens to spaces\r\n .replace(/\\s[a-z]/g, upperCase) //convert first char of each word to UPPERCASE\r\n .replace(/\\s+/g, \"\") //remove spaces\r\n .replace(/^[A-Z]/g, lowerCase); //convert first char to lowercase\r\n return str;\r\n}\r\n\r\n/**\r\n * Add space between camelCase text.\r\n */\r\nexport function unCamelCase(str): string {\r\n str = str.replace(/([a-z\\xE0-\\xFF])([A-Z\\xC0\\xDF])/g, \"$1 $2\");\r\n str = str.toLowerCase(); //add space between camelCase text\r\n return str;\r\n}\r\n\r\n/**\r\n * UPPERCASE first char of each word.\r\n */\r\nexport function properCase(str): string {\r\n return lowerCase(str).replace(/^\\w|\\s\\w/g, upperCase);\r\n}\r\n\r\n/**\r\n * camelCase + UPPERCASE first char\r\n */\r\nexport function pascalCase(str): string {\r\n return camelCase(str).replace(/^[a-z]/, upperCase);\r\n}\r\n\r\n/**\r\n * UPPERCASE first char of each sentence and lowercase other chars.\r\n */\r\nexport function sentenceCase(str): string {\r\n // Replace first char of each sentence (new line or after '.\\s+') to\r\n // UPPERCASE\r\n return lowerCase(str).replace(/(^\\w)|\\.\\s+(\\w)/gm, upperCase);\r\n}\r\n\r\n/**\r\n * Convert to lower case, remove accents, remove non-word chars and\r\n * replace spaces with the specified delimeter.\r\n * Does not split camelCase text.\r\n */\r\nexport function slugify(str, delimeter): string {\r\n if (delimeter == null) {\r\n delimeter = \"-\";\r\n }\r\n\r\n str = replaceAccents(str);\r\n str = removeNonWord(str);\r\n str = trim(str, '') //should come after removeNonWord\r\n .replace(/ +/g, delimeter) //replace spaces with delimeter\r\n .toLowerCase();\r\n\r\n return str;\r\n}\r\n\r\n/**\r\n * Replaces spaces with hyphens, split camelCase text, remove non-word chars, remove accents and convert to lower case.\r\n */\r\nexport function hyphenate(str): string {\r\n str = unCamelCase(str);\r\n return slugify(str, \"-\");\r\n}\r\n\r\n/**\r\n * Replaces hyphens with spaces. (only hyphens between word chars)\r\n */\r\nexport function unhyphenate(str): string {\r\n return str.replace(/(\\w)(-)(\\w)/g, \"$1 $3\");\r\n}\r\n\r\n/**\r\n * Replaces spaces with underscores, split camelCase text, remove\r\n * non-word chars, remove accents and convert to lower case.\r\n */\r\nexport function underscore(str): string {\r\n str = unCamelCase(str);\r\n return slugify(str, \"_\");\r\n}\r\n\r\n/**\r\n * Remove non-word chars.\r\n */\r\nexport function removeNonWord(str): string {\r\n return str.replace(/[^0-9a-zA-Z\\xC0-\\xFF \\-]/g, \"\");\r\n}\r\n\r\n/**\r\n * Convert line-breaks from DOS/MAC to a single standard (UNIX by default)\r\n */\r\nexport function normalizeLineBreaks(str, lineEnd): string {\r\n lineEnd = lineEnd || \"\\n\";\r\n\r\n return str\r\n .replace(/\\r\\n/g, lineEnd) // DOS\r\n .replace(/\\r/g, lineEnd) // Mac\r\n .replace(/\\n/g, lineEnd); // Unix\r\n}\r\n\r\n/**\r\n * Replaces all accented chars with regular ones\r\n */\r\nexport function replaceAccents(str): string {\r\n // verifies if the String has accents and replace them\r\n if (str.search(/[\\xC0-\\xFF]/g) > -1) {\r\n str = str\r\n .replace(/[\\xC0-\\xC5]/g, \"A\")\r\n .replace(/[\\xC6]/g, \"AE\")\r\n .replace(/[\\xC7]/g, \"C\")\r\n .replace(/[\\xC8-\\xCB]/g, \"E\")\r\n .replace(/[\\xCC-\\xCF]/g, \"I\")\r\n .replace(/[\\xD0]/g, \"D\")\r\n .replace(/[\\xD1]/g, \"N\")\r\n .replace(/[\\xD2-\\xD6\\xD8]/g, \"O\")\r\n .replace(/[\\xD9-\\xDC]/g, \"U\")\r\n .replace(/[\\xDD]/g, \"Y\")\r\n .replace(/[\\xDE]/g, \"P\")\r\n .replace(/[\\xE0-\\xE5]/g, \"a\")\r\n .replace(/[\\xE6]/g, \"ae\")\r\n .replace(/[\\xE7]/g, \"c\")\r\n .replace(/[\\xE8-\\xEB]/g, \"e\")\r\n .replace(/[\\xEC-\\xEF]/g, \"i\")\r\n .replace(/[\\xF1]/g, \"n\")\r\n .replace(/[\\xF2-\\xF6\\xF8]/g, \"o\")\r\n .replace(/[\\xF9-\\xFC]/g, \"u\")\r\n .replace(/[\\xFE]/g, \"p\")\r\n .replace(/[\\xFD\\xFF]/g, \"y\");\r\n }\r\n\r\n return str;\r\n}\r\n\r\n/**\r\n * Searches for a given substring\r\n */\r\nexport function contains(str, substring, fromIndex): boolean {\r\n return str.indexOf(substring, fromIndex) !== -1;\r\n}\r\n\r\n/**\r\n * Truncate string at full words.\r\n */\r\nexport function crop(str, maxChars, append): string {\r\n return truncate(str, maxChars, append, true);\r\n}\r\n\r\n/**\r\n * Escape RegExp string chars.\r\n */\r\nexport function escapeRegExp(str): string {\r\n var ESCAPE_CHARS = /[\\\\.+*?\\^$\\[\\](){}\\/'#]/g;\r\n return str.replace(ESCAPE_CHARS, \"\\\\$&\");\r\n}\r\n\r\n/**\r\n * Escapes a string for insertion into HTML.\r\n */\r\nexport function escapeHtml(str): string {\r\n str = str\r\n .replace(/&/g, \"&\")\r\n .replace(//g, \">\")\r\n .replace(/'/g, \"'\")\r\n .replace(/\"/g, \""\");\r\n\r\n return str;\r\n}\r\n\r\n/**\r\n * Unescapes HTML special chars\r\n */\r\nexport function unescapeHtml(str): string {\r\n str = str\r\n .replace(/&/g, \"&\")\r\n .replace(/</g, \"<\")\r\n .replace(/>/g, \">\")\r\n .replace(/'/g, \"'\")\r\n .replace(/"/g, '\"');\r\n return str;\r\n}\r\n\r\n/**\r\n * Escape string into unicode sequences\r\n */\r\nexport function escapeUnicode(str, shouldEscapePrintable): string {\r\n return str.replace(/[\\s\\S]/g, function (ch) {\r\n // skip printable ASCII chars if we should not escape them\r\n if (!shouldEscapePrintable && /[\\x20-\\x7E]/.test(ch)) {\r\n return ch;\r\n }\r\n // we use \"000\" and slice(-4) for brevity, need to pad zeros,\r\n // unicode escape always have 4 chars after \"\\u\"\r\n return \"\\\\u\" + (\"000\" + ch.charCodeAt(0).toString(16)).slice(-4);\r\n });\r\n}\r\n\r\n/**\r\n * Remove HTML tags from string.\r\n */\r\nexport function stripHtmlTags(str): string {\r\n return str.replace(/<[^>]*>/g, \"\");\r\n}\r\n\r\n/**\r\n * Remove non-printable ASCII chars\r\n */\r\nexport function removeNonASCII(str): string {\r\n // Matches non-printable ASCII chars -\r\n // http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters\r\n return str.replace(/[^\\x20-\\x7E]/g, \"\");\r\n}\r\n\r\n/**\r\n * String interpolation\r\n */\r\nexport function interpolate(template, replacements, syntax): string {\r\n var stache = /\\{\\{(\\w+)\\}\\}/g; //mustache-like\r\n\r\n var replaceFn = function (_match, prop) {\r\n return prop in replacements ? replacements[prop] : \"\";\r\n };\r\n\r\n return template.replace(syntax || stache, replaceFn);\r\n}\r\n\r\n/**\r\n * Pad string with `char` if its' length is smaller than `minLen`\r\n */\r\nexport function rpad(str, minLen, ch): string {\r\n ch = ch || \" \";\r\n return str.length < minLen ? str + repeat(ch, minLen - str.length) : str;\r\n}\r\n\r\n/**\r\n * Pad string with `char` if its' length is smaller than `minLen`\r\n */\r\nexport function lpad(str, minLen, ch): string {\r\n ch = ch || \" \";\r\n\r\n return str.length < minLen ? repeat(ch, minLen - str.length) + str : str;\r\n}\r\n\r\n/**\r\n * Repeat string n times\r\n */\r\nexport function repeat(str, n): string {\r\n return new Array(n + 1).join(str);\r\n}\r\n\r\n/**\r\n * Limit number of chars.\r\n */\r\nexport function truncate(str, maxChars, append, onlyFullWords): string {\r\n append = append || \"...\";\r\n maxChars = onlyFullWords ? maxChars + 1 : maxChars;\r\n\r\n str = trim(str, '');\r\n if (str.length <= maxChars) {\r\n return str;\r\n }\r\n str = str.substr(0, maxChars - append.length);\r\n //crop at last space or remove trailing whitespace\r\n str = onlyFullWords ? str.substr(0, str.lastIndexOf(\" \")) : trim(str, '');\r\n return str + append;\r\n}\r\n\r\nvar WHITE_SPACES = [\r\n \" \",\r\n \"\\n\",\r\n \"\\r\",\r\n \"\\t\",\r\n \"\\f\",\r\n \"\\v\",\r\n \"\\u00A0\",\r\n \"\\u1680\",\r\n \"\\u180E\",\r\n \"\\u2000\",\r\n \"\\u2001\",\r\n \"\\u2002\",\r\n \"\\u2003\",\r\n \"\\u2004\",\r\n \"\\u2005\",\r\n \"\\u2006\",\r\n \"\\u2007\",\r\n \"\\u2008\",\r\n \"\\u2009\",\r\n \"\\u200A\",\r\n \"\\u2028\",\r\n \"\\u2029\",\r\n \"\\u202F\",\r\n \"\\u205F\",\r\n \"\\u3000\"\r\n];\r\n\r\n/**\r\n * Remove chars from beginning of string.\r\n */\r\nexport function ltrim(str, chars): string {\r\n chars = chars || WHITE_SPACES;\r\n\r\n var start = 0,\r\n len = str.length,\r\n charLen = chars.length,\r\n found = true,\r\n i,\r\n c;\r\n\r\n while (found && start < len) {\r\n found = false;\r\n i = -1;\r\n c = str.charAt(start);\r\n\r\n while (++i < charLen) {\r\n if (c === chars[i]) {\r\n found = true;\r\n start++;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return start >= len ? \"\" : str.substr(start, len);\r\n}\r\n\r\n/**\r\n * Remove chars from end of string.\r\n */\r\nexport function rtrim(str, chars): string {\r\n chars = chars || WHITE_SPACES;\r\n\r\n var end = str.length - 1,\r\n charLen = chars.length,\r\n found = true,\r\n i,\r\n c;\r\n\r\n while (found && end >= 0) {\r\n found = false;\r\n i = -1;\r\n c = str.charAt(end);\r\n\r\n while (++i < charLen) {\r\n if (c === chars[i]) {\r\n found = true;\r\n end--;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return end >= 0 ? str.substring(0, end + 1) : \"\";\r\n}\r\n\r\n/**\r\n * Remove white-spaces from beginning and end of string.\r\n */\r\nexport function trim(str, chars): string {\r\n chars = chars || WHITE_SPACES;\r\n return ltrim(rtrim(str, chars), chars);\r\n}\r\n\r\n/**\r\n * Capture all capital letters following a word boundary (in case the\r\n * input is in all caps)\r\n */\r\nexport function abbreviate(str): string {\r\n return str.match(/\\b([A-Z])/g).join(\"\");\r\n}\r\n\r\nexport default {\r\n empty, lowerCase, upperCase, camelCase, unCamelCase, properCase, pascalCase,\r\n sentenceCase, slugify, hyphenate, unhyphenate, underscore, removeNonWord, normalizeLineBreaks,\r\n replaceAccents, contains, crop, escapeRegExp, escapeHtml, unescapeHtml, escapeUnicode,\r\n stripHtmlTags, removeNonASCII, interpolate, rpad, lpad, repeat, truncate, ltrim, rtrim,\r\n trim, abbreviate\r\n}\r\n","import StringUtils from './string-utils';\r\n\r\nexport function getModalWordings(currentLanguage: string) {\r\n const wordings_en = {\r\n header: 'Welcome!',\r\n provinceDropdownLabel: 'Please select your province.',\r\n errorMessage: 'Oops! Looks like you forgot to fill this in.',\r\n description: 'This information will be used for your cookie management.',\r\n defaultSelectedProvince: 'Select',\r\n confirm: 'Confirm',\r\n ok: 'OK',\r\n };\r\n\r\n const wordings_fr = {\r\n header: 'Bienvenue!',\r\n provinceDropdownLabel: 'Veuillez sélectionner votre province.',\r\n errorMessage: 'Oops! On dirait que vous avez oublié de remplir ceci.',\r\n description: 'Ces informations seront utilisées pour votre gestion des cookies.',\r\n defaultSelectedProvince: 'Sélectionner',\r\n confirm: 'Confirmer',\r\n ok: 'OK'\r\n };\r\n // Use StringUtils for case-sentitve check\r\n\r\n if (StringUtils.contains(currentLanguage, 'en', 0)) { return wordings_en; }\r\n return currentLanguage.includes('fr') ? wordings_fr : wordings_en;\r\n}\r\n",".modal-container {\r\n z-index: 10000;\r\n visibility: hidden;\r\n transition: all 0.3s ease-in-out, visibility 0.3s linear;\r\n position: fixed;\r\n inset: 0;\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n padding: 1rem;\r\n\r\n &.is-open {\r\n visibility: visible;\r\n background: rgba(0, 0, 0, 0.5);\r\n }\r\n}\r\n\r\n.rsm-popup-popup-wrapper {\r\n position: relative;\r\n border-radius: 8px;\r\n width: 90%;\r\n margin: 0 auto;\r\n max-width: 500px;\r\n min-height: 30vh;\r\n max-height: 80vh;\r\n background: white;\r\n margin-top: auto;\r\n margin-bottom: auto;\r\n display: flex;\r\n flex-direction: column;\r\n box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);\r\n\r\n @media (min-width: 640px) {\r\n min-height: 50vh;\r\n max-height: 70vh;\r\n }\r\n}\r\n\r\n.rsm-popup-message-modal-container {\r\n background: white;\r\n border-radius: 8px;\r\n display: flex;\r\n flex-direction: column;\r\n height: 100%;\r\n padding: 3rem;\r\n gap: 1rem;\r\n justify-content: space-between;\r\n margin-top: 1rem;\r\n\r\n @media (min-width: 768px) {\r\n padding: 2rem;\r\n gap: 1.5rem;\r\n }\r\n}\r\n\r\n.rsm-popup-modal-body {\r\n flex: 1;\r\n overflow-y: auto;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n padding:0 1rem;\r\n\r\n @media (min-width: 640px) {\r\n padding: 1rem;\r\n }\r\n}\r\n\r\n.rsm-popup-message-modal-message {\r\n font-family: inherit;\r\n font-weight: 400;\r\n font-size: 16px;\r\n line-height: 1.6;\r\n text-align: center;\r\n margin-bottom: 2rem;\r\n padding: 0 1rem;\r\n\r\n @media (min-width: 640px) {\r\n font-size: 18px;\r\n margin: 3rem 0;\r\n }\r\n\r\n @media (min-width: 768px) {\r\n .rsm-popup-message-modal-message \r\n {\r\n font-size: 20px;\r\n padding: 0 2rem;\r\n }\r\n }\r\n\r\n @media (min-width: 1024px) \r\n {\r\n font-size: 1.375rem;\r\n }\r\n}\r\n\r\n.rsm-popup-modal-buttons {\r\n border-top: 2px solid #e5e7eb;\r\n padding: 1rem 0 0;\r\n\r\n @media (min-width: 768px) {\r\n padding: 1.5rem 0 0;\r\n }\r\n}\r\n\r\n.rsm-popup-modal-footer {\r\n width: 100%;\r\n min-width: 280px;\r\n margin: 0 auto;\r\n display: flex;\r\n justify-content: center;\r\n flex-shrink: 0;\r\n\r\n @media (max-width: 480px){\r\n max-width: 100%;\r\n }\r\n\r\n @media (min-width: 640px) {\r\n .rsm-popup-modal-footer {\r\n min-width: 250px;\r\n padding: 1rem;\r\n }\r\n }\r\n}","import { Component, h, Prop, EventEmitter, Event } from '@stencil/core';\r\nimport { getModalWordings } from '../../utils/wordings';\r\nimport { getLanguage } from '../../utils/utils';\r\n\r\n@Component({\r\n tag: 'popup-message-modal',\r\n styleUrl: 'popup-message-modal.scss',\r\n shadow: false\r\n})\r\nexport class PopupMessageModal {\r\n\r\n // Props\r\n @Prop({ mutable: true, reflect: true })\r\n @Prop({ mutable: true, reflect: true }) message: string;\r\n @Prop() isOpen: boolean = false;\r\n @Prop() buttonIsClicked: boolean = false;\r\n @Prop() selectedProvince: string;\r\n private wordings = {};\r\n\r\n // Events\r\n @Event() private popupButtonAction: EventEmitter;\r\n\r\n // Functions\r\n private handleAction = () => {\r\n this.popupButtonAction.emit();\r\n }\r\n\r\n componentWillLoad() {\r\n const language = getLanguage();\r\n this.wordings = getModalWordings(language);\r\n }\r\n\r\n render() {\r\n return (\r\n
\r\n\r\n\r\n {/* Wrapper */}\r\n
\r\n\r\n {/* Container */}\r\n
\r\n\r\n {/* Body */}\r\n \r\n
\r\n

{this.message}

\r\n
\r\n \r\n {/* Footer */}\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n\r\n
\r\n
\r\n )\r\n }\r\n}",":host {\r\n display: block;\r\n width: 100%;\r\n}\r\n\r\n.rsm-confirm-button-style {\r\n display: block;\r\n width: 100%;\r\n max-width: 400px;\r\n padding: 1rem 2rem;\r\n margin: 0 auto;\r\n font-size: 1rem;\r\n font-weight: 500;\r\n background-color: #0066cc;\r\n color: white;\r\n border: none;\r\n border-radius: 4px;\r\n cursor: pointer;\r\n transition: all 0.3s ease;\r\n text-align: center;\r\n line-height: 1.5;\r\n letter-spacing: 0.025rem;\r\n margin: 0 auto;\r\n}\r\n.rsm-confirm-button-style:hover{\r\n background-color: #0052a3;\r\n}","import { Component, h, Prop, Event, EventEmitter } from '@stencil/core';\r\n\r\n@Component({\r\n tag: 'regional-selector-button',\r\n styleUrl: 'regional-selector-button.css',\r\n shadow: false,\r\n})\r\nexport class RegionalSelectorButton {\r\n\r\n @Prop() buttonLabel: string;\r\n\r\n // Events\r\n @Event() private buttonAction: EventEmitter;\r\n\r\n handleAction() {\r\n this.buttonAction.emit();\r\n }\r\n\r\n render() {\r\n return (\r\n \r\n );\r\n }\r\n\r\n}\r\n","/*! 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","import StringUtils from './string-utils';\r\n\r\nexport function getFilteredProvincesViaAllowedProvinces(currentLanguage: string, allowedProvinces: any): any {\r\n const provinceListData = getProvinceSelectionModalData(currentLanguage);\r\n const defaultProvinces = provinceListData.provinces;\r\n const newProvinces = defaultProvinces.filter(function (province) {\r\n return allowedProvinces.split(',').includes(province.value);\r\n });\r\n if (newProvinces && newProvinces.length) { provinceListData.provinces = newProvinces; }\r\n\r\n return provinceListData;\r\n}\r\nexport function getProvinceSelectionModalData(currentLanguage: string): any {\r\n\r\n const uriParams = new URLSearchParams(window.location.search);\r\n const language = uriParams.get('lang') || 'en'; // Default to 'en'\r\n console.log('Language used:', language);\r\n\r\n const provinces_en = {\r\n provincePlaceholder: \"Select\",\r\n provinces: [\r\n { label: \"Other Region\", value: \"OTHERS\" },\r\n { label: \"Alberta\", value: \"AB\" },\r\n { label: \"British Columbia\", value: \"BC\" },\r\n { label: \"Manitoba\", value: \"MB\" },\r\n { label: \"Newfoundland and Labrador\", value: \"NL\" },\r\n { label: \"New Brunswick\", value: \"NB\" },\r\n { label: \"Northwest Territories\", value: \"NT\" },\r\n { label: \"Nova Scotia\", value: \"NS\" },\r\n { label: \"Nunavut\", value: \"NU\" },\r\n { label: \"Ontario\", value: \"ON\" },\r\n { label: \"Prince Edward Island\", value: \"PE\" },\r\n { label: \"Quebec\", value: \"QC\" },\r\n { label: \"Saskatchewan\", value: \"SK\" },\r\n { label: \"Yukon\", value: \"YT\" }\r\n ]\r\n };\r\n\r\n const provinces_fr = {\r\n provincePlaceholder: \"Sélectionnez\",\r\n provinces: [\r\n { label: \"Autre Région\", value: \"OTHERS\" },\r\n { label: \"Alberta\", value: \"AB\" },\r\n { label: \"Colombie-Britannique\", value: \"BC\" },\r\n { label: \"Manitoba\", value: \"MB\" },\r\n { label: \"Terre-Neuve-et-Labrador\", value: \"NL\" },\r\n { label: \"Nouveau-Brunswick\", value: \"NB\" },\r\n { label: \"Territoires du Nord-Ouest\", value: \"NT\" },\r\n { label: \"Nouvelle-Écosse\", value: \"NS\" },\r\n { label: \"Nunavut\", value: \"NU\" },\r\n { label: \"Ontario\", value: \"ON\" },\r\n { label: \"Île-du-Prince-Édouard\", value: \"PE\" },\r\n { label: \"Québec\", value: \"QC\" },\r\n { label: \"Saskatchewan\", value: \"SK\" },\r\n { label: \"Yukon\", value: \"YT\" }\r\n ]\r\n };\r\n\r\n return StringUtils.contains(currentLanguage, 'fr', 0) ? provinces_fr : provinces_en;\r\n}\r\nexport default getProvinceSelectionModalData;","import { Component, h, Listen, Prop } from '@stencil/core';\r\nimport Cookies from 'js-cookie';\r\nimport { getProvinceSelectionModalData } from '../../utils/province-list';\r\nimport { getFilteredProvincesViaAllowedProvinces } from '../../utils/province-list';\r\nimport { getModalWordings } from '../../utils/wordings';\r\nimport { getLanguage } from '../../utils/utils';\r\n\r\n@Component({\r\n tag: 'regional-selector-modal',\r\n shadow: false,\r\n assetsDirs: ['assets']\r\n})\r\nexport class RegionalSelectorModal {\r\n\r\n // Props \r\n /**\r\n * The 'allowed-provinces' attribute is used to show what provinces the consumer will be displayed under the province dropdown. \r\n * This is comma separated value where the values are the 2 character keys of provinces e.g. AB,BC,MB,NL,NB,NT,NS,NU,ON,PE,QC,SK,YT,OTHERS.\r\n */\r\n @Prop() allowedProvinces: string = '';\r\n /**\r\n * The 'error-class' attribute is used to style the error message.\r\n */\r\n @Prop({ mutable: true }) errorClass: string = '';\r\n /**\r\n * This 'is-open' signals the modal to be displayed or not.\r\n */\r\n @Prop() isOpen: boolean = false;\r\n /**\r\n * This 'is-popup-message-open' attribute displays the popup-message modal as long as the 'redirect-on-selected-provinces-with-msg' attribute is not empty.\r\n */\r\n @Prop({ mutable: true }) isPopupMessageOpen: boolean = false;\r\n /**\r\n * The 'ketch-script' attribute is the actual Ketch script of the domain. This varies depending on what application it is, e.g. Websites, Customer Portals, or Quote Engines.\r\n */\r\n @Prop() ketchScript!: string;\r\n /**\r\n * The 'open-ketch' attribute can be toggled if consumer needs to display the Ketch banner. This is ideal when the consumer doesn't use redirects. \r\n */\r\n @Prop() openKetch: boolean = false;\r\n /**\r\n * The 'redirect-on-selected-provinces' attribute is a list of provinces that when the user selects any from the list, they will be redirect.\r\n * This setting is in conjuction with the 'redirect-on-selected-province-to' as it needs to have a destination.\r\n */\r\n @Prop() redirectOnSelectedProvinces: string = '';\r\n /**\r\n * The 'redirect-on-selected-provinces-to' attribute is the redirect destination whenever the user selects a certain province.\r\n */\r\n @Prop() redirectOnSelectedProvincesTo: string = '';\r\n /**\r\n * The 'redirect-on-selected-provinces-with-msg' attribute is the message that the popup message modal will be displaying.\r\n */\r\n @Prop() redirectOnSelectedProvincesWithMsg: string = '';\r\n /**\r\n * The 'redirect-on-submit-to' attribute is the redirect destination when the user hits the confirm button inside the regional selector modal.\r\n */\r\n @Prop() redirectOnSubmitTo: string = '';\r\n /**\r\n * The 'redirect-on-submit' attribute is a flag that let's the regional selector mode know that it will redirect the user to a certain destination.\r\n */\r\n @Prop() redirectOnSubmit: boolean = false;\r\n /**\r\n * The 'redirect-on-selected-province' is a flag that will let the modal know if it will redirect the user to a certain destination.\r\n */\r\n @Prop() redirectOnSelectedProvince: boolean = false;\r\n private hasError: boolean = false;\r\n private isCookieSet: boolean = false;\r\n private modal: HTMLDivElement;\r\n private provinceList = {}\r\n private selectedProvince: string;\r\n private showErrorMessage: boolean = false;\r\n private wordings = {}\r\n\r\n // Lifecycles\r\n connectedCallback() {\r\n if (this.ketchScript === '') {\r\n this.throwException('Missing \"ketchScript\" property. This property is required.');\r\n }\r\n\r\n if (this.redirectOnSubmitTo) { this.redirectOnSubmit = true; }\r\n if (this.redirectOnSelectedProvinces && this.redirectOnSelectedProvincesTo) { this.redirectOnSelectedProvince = true; }\r\n else if (this.redirectOnSubmit && !this.redirectOnSelectedProvince &&\r\n ((this.redirectOnSelectedProvinces && !this.redirectOnSelectedProvincesTo) ||\r\n (!this.redirectOnSelectedProvinces && this.redirectOnSelectedProvincesTo))) {\r\n this.throwException('When using REDIRECT | SELECTED PROVINCE feature. Please provide values to both \"redirect-on-selected-provinces-to\" and \"redirect-on-selected-provinces\" attributes.');\r\n }\r\n }\r\n\r\n componentWillLoad() {\r\n if (this.hasError) { return; }\r\n\r\n // Use a regex to check if the URL contains 'fr-CA or 'fr'\r\n const language = getLanguage();\r\n console.log('Selected language: ', language);\r\n // Set the languge attribute in the HTML document to the selected language\r\n document.documentElement.lang = language;\r\n\r\n // Check for existing province cookie\r\n const cookie = Cookies.get(\"userProvince\");\r\n if (cookie !== \"\" && cookie !== undefined) {\r\n this.isCookieSet = true;\r\n }\r\n\r\n // Load province list and wordings based on the selected language \r\n if (this.allowedProvinces !== '') {\r\n this.provinceList = getFilteredProvincesViaAllowedProvinces(language, this.allowedProvinces);\r\n } else {\r\n this.provinceList = getProvinceSelectionModalData(language);\r\n }\r\n\r\n this.wordings = getModalWordings(language);\r\n }\r\n\r\n // Functions\r\n private throwException(message) {\r\n this.hasError = true;\r\n console.error(message);\r\n return;\r\n }\r\n\r\n private triggerKetch(openKetch = false) {\r\n if (this.ketchScript !== '') {\r\n console.log('Send selected province ' + this.selectedProvince + ' from the dropdown.');\r\n (window as any).sharedProvinceCookie.ketchProvinceCookie(this.selectedProvince, this.ketchScript, openKetch);\r\n }\r\n }\r\n\r\n private redirectTo(url) {\r\n window.location.href = url;\r\n }\r\n\r\n private getErrorStyle(): string {\r\n return \"mt-2 sm:ml-4 sm:mr-4 text-xs font-semibold text-red-600 rsm-error-message\";\r\n }\r\n\r\n // Events\r\n @Listen('popupButtonAction')\r\n popupButtonActionHandler(event: CustomEvent) {\r\n console.log('Popup message button clicked: ', event.detail);\r\n this.isPopupMessageOpen = false;\r\n this.modal.hidden = true;\r\n if (this.redirectOnSelectedProvincesTo) {\r\n this.redirectTo(this.redirectOnSelectedProvincesTo);\r\n }\r\n }\r\n\r\n async handleProvinceSelect(event: any) {\r\n console.log(event.target.value);\r\n this.selectedProvince = event.target.value;\r\n }\r\n\r\n async handleSubmit() {\r\n console.log('Confirm button is clicked. OnSubmit is now in progress.');\r\n\r\n this.errorClass = ' hidden';\r\n // VALIDATE IF THE USER SELECTS 0 FROM THE DROPDOWN \r\n if (this.selectedProvince === undefined || this.selectedProvince === '00') {\r\n const dropdownElem = document.getElementById('dropdown-province') as HTMLElement;\r\n dropdownElem.focus();\r\n this.showErrorMessage = true;\r\n this.errorClass = this.getErrorStyle();\r\n return;\r\n }\r\n\r\n // NO REDIRECT FEATURE\r\n if (!this.redirectOnSubmit && !this.redirectOnSelectedProvince) {\r\n // FORCE KETCH TO OPEN EVEN WHEN THE ATTRIBUTE WAS NOT SET\r\n this.triggerKetch(true);\r\n this.modal.hidden = true;\r\n return;\r\n }\r\n\r\n // MAKE SURE TO SET THE OPEN-KETCH to TRUE IF IT NEEDS TO SHOW THE KETCH\r\n this.triggerKetch(this.openKetch);\r\n\r\n // REDIRECT FEATURE\r\n if (this.redirectOnSubmit && !this.redirectOnSelectedProvince) { this.redirectTo(this.redirectOnSubmitTo); }\r\n else if (this.redirectOnSelectedProvince && this.redirectOnSelectedProvinces.split(',').includes(this.selectedProvince)) {\r\n this.isPopupMessageOpen = (this.redirectOnSelectedProvincesWithMsg ? true : false);\r\n if (!this.isPopupMessageOpen) {\r\n this.redirectTo(this.redirectOnSelectedProvincesTo);\r\n }\r\n }\r\n else if (this.redirectOnSubmitTo) {\r\n this.redirectTo(this.redirectOnSubmitTo);\r\n }\r\n }\r\n\r\n render() {\r\n if (this.isCookieSet || this.hasError) { return; }\r\n else {\r\n if (!this.showErrorMessage) { this.errorClass = ' hidden'; }\r\n return (\r\n
this.modal = el as HTMLDivElement}>\r\n\r\n {/* Wrapper */}\r\n
\r\n\r\n {/* Container */}\r\n
\r\n\r\n {/* Header */}\r\n
\r\n

{this.wordings['header']}

\r\n
\r\n\r\n {/* Body */}\r\n
\r\n
\r\n \r\n \r\n

{this.wordings['errorMessage']}

\r\n

\r\n {this.wordings['description']}\r\n

\r\n
\r\n
\r\n\r\n {/* Footer */} \r\n
\r\n \r\n
\r\n
\r\n
\r\n\r\n \r\n \r\n
\r\n\r\n );\r\n }\r\n }\r\n}\r\n"],"mappings":"+FAKgBA,IACZ,MAAO,EACX,C,SAKgBC,EAAUC,GACtB,OAAOA,EAAIC,aACf,C,SAKgBC,EAAUF,GACtB,OAAOA,EAAIG,aACf,C,SAKgBC,EAAUJ,GACtBA,EAAMK,EAAeL,GACrBA,EAAMM,EAAcN,GACfO,QAAQ,MAAO,KACfA,QAAQ,WAAYL,GACpBK,QAAQ,OAAQ,IAChBA,QAAQ,UAAWR,GACxB,OAAOC,CACX,C,SAKgBQ,EAAYR,GACxBA,EAAMA,EAAIO,QAAQ,mCAAoC,SACtDP,EAAMA,EAAIC,cACV,OAAOD,CACX,C,SAKgBS,EAAWT,GACvB,OAAOD,EAAUC,GAAKO,QAAQ,YAAaL,EAC/C,C,SAKgBQ,EAAWV,GACvB,OAAOI,EAAUJ,GAAKO,QAAQ,SAAUL,EAC5C,C,SAKgBS,EAAaX,GAGzB,OAAOD,EAAUC,GAAKO,QAAQ,oBAAqBL,EACvD,C,SAOgBU,EAAQZ,EAAKa,GACzB,GAAIA,GAAa,KAAM,CACnBA,EAAY,G,CAGhBb,EAAMK,EAAeL,GACrBA,EAAMM,EAAcN,GACpBA,EAAMc,EAAKd,EAAK,IACXO,QAAQ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