{"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
{this.wordings['errorMessage']}
\r\n\r\n {this.wordings['description']}\r\n
\r\n