@nationalarchives/frontend 0.1.23-prerelease → 0.1.25-prerelease

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/README.md +22 -0
  2. package/govuk-prototype-kit.config.json +4 -12
  3. package/nationalarchives/all.css +2 -2
  4. package/nationalarchives/all.css.map +1 -1
  5. package/nationalarchives/all.js +1 -1
  6. package/nationalarchives/all.js.map +1 -1
  7. package/nationalarchives/assets/fonts/OpenSans-Regular.ttf +0 -0
  8. package/nationalarchives/assets/fonts/RobotoMono-Medium.ttf +0 -0
  9. package/nationalarchives/components/_index.scss +1 -1
  10. package/nationalarchives/components/breadcrumbs/breadcrumbs.css +1 -1
  11. package/nationalarchives/components/breadcrumbs/breadcrumbs.css.map +1 -1
  12. package/nationalarchives/components/breadcrumbs/breadcrumbs.stories.js +1 -1
  13. package/nationalarchives/components/button/button.css +1 -1
  14. package/nationalarchives/components/button/button.css.map +1 -1
  15. package/nationalarchives/components/button/button.scss +12 -12
  16. package/nationalarchives/components/button/template.njk +2 -2
  17. package/nationalarchives/components/card/card.css +1 -1
  18. package/nationalarchives/components/card/card.css.map +1 -1
  19. package/nationalarchives/components/card/card.scss +9 -4
  20. package/nationalarchives/components/card/card.stories.js +27 -78
  21. package/nationalarchives/components/card/fixtures.json +17 -17
  22. package/nationalarchives/components/card/macro-options.json +47 -17
  23. package/nationalarchives/components/card/template.njk +47 -46
  24. package/nationalarchives/components/cookie-banner/cookie-banner.css +1 -1
  25. package/nationalarchives/components/cookie-banner/cookie-banner.css.map +1 -1
  26. package/nationalarchives/components/cookie-banner/cookie-banner.js +1 -1
  27. package/nationalarchives/components/cookie-banner/cookie-banner.js.map +1 -1
  28. package/nationalarchives/components/cookie-banner/cookie-banner.mjs +17 -16
  29. package/nationalarchives/components/cookie-banner/cookie-banner.scss +1 -1
  30. package/nationalarchives/components/cookie-banner/cookie-banner.stories.js +95 -45
  31. package/nationalarchives/components/cookie-banner/fixtures.json +84 -1
  32. package/nationalarchives/components/cookie-banner/macro-options.json +7 -1
  33. package/nationalarchives/components/cookie-banner/template.njk +4 -4
  34. package/nationalarchives/components/featured-records/_index.scss +1 -0
  35. package/nationalarchives/components/featured-records/featured-records.css +1 -0
  36. package/nationalarchives/components/featured-records/featured-records.css.map +1 -0
  37. package/nationalarchives/components/featured-records/featured-records.scss +95 -0
  38. package/nationalarchives/components/featured-records/featured-records.stories.js +51 -0
  39. package/nationalarchives/components/featured-records/fixtures.json +4 -0
  40. package/nationalarchives/components/featured-records/macro-options.json +70 -0
  41. package/nationalarchives/components/featured-records/macro.njk +3 -0
  42. package/nationalarchives/components/featured-records/template.njk +20 -0
  43. package/nationalarchives/components/filters/filters.css +1 -1
  44. package/nationalarchives/components/filters/filters.css.map +1 -1
  45. package/nationalarchives/components/filters/filters.scss +6 -6
  46. package/nationalarchives/components/filters/template.njk +1 -1
  47. package/nationalarchives/components/footer/footer.css +1 -1
  48. package/nationalarchives/components/footer/footer.css.map +1 -1
  49. package/nationalarchives/components/footer/footer.scss +2 -5
  50. package/nationalarchives/components/footer/footer.stories.js +1 -1
  51. package/nationalarchives/components/footer/template.njk +4 -4
  52. package/nationalarchives/components/gallery/gallery.css +1 -1
  53. package/nationalarchives/components/gallery/gallery.css.map +1 -1
  54. package/nationalarchives/components/gallery/gallery.scss +2 -2
  55. package/nationalarchives/components/gallery/gallery.stories.js +2 -2
  56. package/nationalarchives/components/grid/grid.css +1 -1
  57. package/nationalarchives/components/grid/grid.css.map +1 -1
  58. package/nationalarchives/components/grid/grid.scss +12 -0
  59. package/nationalarchives/components/grid/grid.stories.js +12 -0
  60. package/nationalarchives/components/header/header.css +1 -1
  61. package/nationalarchives/components/header/header.css.map +1 -1
  62. package/nationalarchives/components/header/header.scss +59 -27
  63. package/nationalarchives/components/header/header.stories.js +4 -6
  64. package/nationalarchives/components/header/macro-options.json +2 -2
  65. package/nationalarchives/components/header/template.njk +4 -4
  66. package/nationalarchives/components/hero/hero.css +1 -1
  67. package/nationalarchives/components/hero/hero.css.map +1 -1
  68. package/nationalarchives/components/hero/hero.scss +6 -6
  69. package/nationalarchives/components/hero/hero.stories.js +6 -0
  70. package/nationalarchives/components/index-grid/index-grid.css +1 -1
  71. package/nationalarchives/components/index-grid/index-grid.css.map +1 -1
  72. package/nationalarchives/components/index-grid/index-grid.scss +1 -1
  73. package/nationalarchives/components/index-grid/index-grid.stories.js +3 -1
  74. package/nationalarchives/components/message/message.css +1 -1
  75. package/nationalarchives/components/message/message.css.map +1 -1
  76. package/nationalarchives/components/pagination/macro-options.json +6 -0
  77. package/nationalarchives/components/pagination/pagination.css +1 -1
  78. package/nationalarchives/components/pagination/pagination.css.map +1 -1
  79. package/nationalarchives/components/pagination/pagination.scss +5 -1
  80. package/nationalarchives/components/pagination/pagination.stories.js +417 -2
  81. package/nationalarchives/components/pagination/template.njk +10 -3
  82. package/nationalarchives/components/phase-banner/fixtures.json +5 -41
  83. package/nationalarchives/components/phase-banner/macro-options.json +6 -0
  84. package/nationalarchives/components/phase-banner/phase-banner.css +1 -1
  85. package/nationalarchives/components/phase-banner/phase-banner.css.map +1 -1
  86. package/nationalarchives/components/phase-banner/phase-banner.scss +1 -1
  87. package/nationalarchives/components/phase-banner/phase-banner.stories.js +4 -28
  88. package/nationalarchives/components/phase-banner/template.njk +3 -1
  89. package/nationalarchives/components/picture/picture.css +1 -1
  90. package/nationalarchives/components/picture/picture.css.map +1 -1
  91. package/nationalarchives/components/picture/picture.scss +5 -4
  92. package/nationalarchives/components/sensitive-image/sensitive-image.css +1 -1
  93. package/nationalarchives/components/sensitive-image/sensitive-image.css.map +1 -1
  94. package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +3 -0
  95. package/nationalarchives/components/skip-link/skip-link.css +1 -1
  96. package/nationalarchives/components/skip-link/skip-link.css.map +1 -1
  97. package/nationalarchives/components/skip-link/skip-link.stories.js +4 -1
  98. package/nationalarchives/components/tabs/tabs.css +1 -1
  99. package/nationalarchives/components/tabs/tabs.css.map +1 -1
  100. package/nationalarchives/components/tabs/tabs.js +1 -1
  101. package/nationalarchives/components/tabs/tabs.js.map +1 -1
  102. package/nationalarchives/components/tabs/tabs.mjs +0 -4
  103. package/nationalarchives/components/tabs/tabs.stories.js +6 -3
  104. package/nationalarchives/lib/cookies.mjs +165 -62
  105. package/nationalarchives/prototype-kit.css +23 -0
  106. package/nationalarchives/prototype-kit.css.map +1 -0
  107. package/nationalarchives/{_prototype-kit.scss → prototype-kit.scss} +3 -3
  108. package/nationalarchives/stories/utilities/colour-schemes/colour-schemes.stories.js +189 -74
  109. package/nationalarchives/stories/utilities/lists/lists.mdx +18 -0
  110. package/nationalarchives/stories/utilities/{typography → lists}/lists.stories.js +1 -1
  111. package/nationalarchives/stories/utilities/overrides/overrides.mdx +27 -20
  112. package/nationalarchives/stories/utilities/overrides/overrides.stories.js +19 -2
  113. package/nationalarchives/stories/utilities/tables/tables.mdx +8 -0
  114. package/nationalarchives/stories/utilities/tables/tables.stories.js +45 -0
  115. package/nationalarchives/stories/utilities/typography/heading-groups.stories.js +59 -19
  116. package/nationalarchives/stories/utilities/typography/typography.mdx +3 -25
  117. package/nationalarchives/stories/utilities/typography/typography.stories.js +28 -2
  118. package/nationalarchives/templates/layouts/_generic.njk +1 -0
  119. package/nationalarchives/templates/layouts/_prototype-kit.njk +4 -1
  120. package/nationalarchives/tests/cookies.test.js +427 -0
  121. package/nationalarchives/tests/uuid.test.js +17 -0
  122. package/nationalarchives/tools/_colour.scss +15 -20
  123. package/nationalarchives/tools/_spacing.scss +91 -2
  124. package/nationalarchives/tools/_typography.scss +15 -8
  125. package/nationalarchives/utilities/_a11y.scss +2 -1
  126. package/nationalarchives/utilities/_colour.scss +100 -0
  127. package/nationalarchives/utilities/_global.scss +2 -98
  128. package/nationalarchives/utilities/_index.scss +2 -0
  129. package/nationalarchives/utilities/_lists.scss +5 -0
  130. package/nationalarchives/utilities/_overrides.scss +16 -36
  131. package/nationalarchives/utilities/_tables.scss +86 -0
  132. package/nationalarchives/utilities/_typography.scss +150 -71
  133. package/nationalarchives/variables/_colour.scss +10 -8
  134. package/nationalarchives/variables/_spacing.scss +14 -9
  135. package/nationalarchives/variables/_typography.scss +10 -7
  136. package/package.json +14 -14
  137. package/nationalarchives/assets/fonts/OpenSans-Medium.ttf +0 -0
  138. package/nationalarchives/assets/fonts/fa-regular-400.ttf +0 -0
  139. package/nationalarchives/assets/fonts/fa-regular-400.woff2 +0 -0
  140. package/nationalarchives/components/profile/_index.scss +0 -1
  141. package/nationalarchives/components/profile/fixtures.json +0 -4
  142. package/nationalarchives/components/profile/macro-options.json +0 -14
  143. package/nationalarchives/components/profile/macro.njk +0 -3
  144. package/nationalarchives/components/profile/profile.css +0 -1
  145. package/nationalarchives/components/profile/profile.css.map +0 -1
  146. package/nationalarchives/components/profile/profile.scss +0 -5
  147. package/nationalarchives/components/profile/profile.stories.js +0 -31
  148. package/nationalarchives/components/profile/template.njk +0 -15
  149. package/nationalarchives/lib/font-awesome/regular.css +0 -5
  150. package/nationalarchives/lib/font-awesome/regular.css.map +0 -1
  151. package/nationalarchives/lib/font-awesome/regular.scss +0 -28
  152. package/nationalarchives/stories/development/about.mdx +0 -122
  153. package/nationalarchives/stories/development/contributing.mdx +0 -32
  154. package/nationalarchives/stories/development/cookies.mdx +0 -82
  155. package/nationalarchives/stories/development/publishing.mdx +0 -15
  156. package/nationalarchives/stories/development/structure.mdx +0 -88
  157. package/nationalarchives/stories/development/using/compiled.mdx +0 -9
  158. package/nationalarchives/stories/development/using/hosted.mdx +0 -53
  159. package/nationalarchives/stories/development/using/npm.mdx +0 -59
@@ -1 +1 @@
1
- {"version":3,"file":"components/cookie-banner/cookie-banner.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,cAAe,GAAIH,GACA,iBAAZC,QACdA,QAAqB,YAAID,IAE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,kBAAM9F,EAAK+F,QAAQ,IAChElF,KAAKoE,cAAca,iBAAiB,SAAS,kBAAM9F,EAAKgG,QAAQ,KAxBlE,CA0BF,GAAC,CAAA7E,IAAA,SAAAR,MAED,WACEE,KAAKqE,QAAQe,aAAa,UAAU,GACpCpF,KAAKqF,WACLrF,KAAKsE,iBAAiBU,gBAAgB,UACtChF,KAAKsE,iBAAiBgB,QACtBtF,KAAKsE,iBAAiBc,aAAa,WAAY,MAC/CpF,KAAK2E,QAAQY,oBACTvF,KAAK6E,qBACP7E,KAAK6E,oBAAoBlC,MAAM,KAAK1C,SAAQ,SAACuF,GAC3C,IAAMC,EAAUxE,SAASyE,cAAc,UACvCD,EAAQE,IAAMH,EACdvE,SAAS2E,KAAKC,YAAYJ,EAC5B,GAEJ,GAAC,CAAAnF,IAAA,SAAAR,MAED,WACEE,KAAKqE,QAAQe,aAAa,UAAU,GACpCpF,KAAKqF,WACLrF,KAAKuE,iBAAiBS,gBAAgB,UACtChF,KAAKuE,iBAAiBe,QACtBtF,KAAKuE,iBAAiBa,aAAa,WAAY,MAC/CpF,KAAK2E,QAAQmB,mBACf,GAAC,CAAAxF,IAAA,WAAAR,MAED,WAAW,IAAAwC,EAAA,KACTtC,KAAK2E,QAAQ/D,IAAIZ,KAAK8E,sBAAsB,GAC5C9E,KAAKwE,cAAcvE,SAAQ,SAAC8F,GAC1BA,EAAad,iBAAiB,SAAS,kBAAM3C,EAAK0D,OAAO,GAC3D,GACF,GAAC,CAAA1F,IAAA,QAAAR,MAED,WACEE,KAAKiE,QAAQmB,aAAa,UAAU,EACtC,M,oEAACpB,CAAA,CAvFsB,E","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/./src/nationalarchives/lib/cookies.mjs","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/cookie-banner/cookie-banner.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = factory();\n})(self, () => {\nreturn ","/**\n * Class to handle cookies.\n * @class Cookies\n * @constructor\n * @public\n */\nexport default class Cookies {\n /** @protected */\n #policies = {};\n\n /**\n * Create a cookie handler.\n * @param {string[]} [policies=usage,settings] - The cookie policies to manage.\n * @param {string} [cookiesPolicyKey=cookies_policy] - The name of the cookie.\n */\n constructor(\n policies = [\"usage\", \"settings\"],\n cookiesPolicyKey = \"cookies_policy\",\n ) {\n this.cookiesPolicyKey = cookiesPolicyKey;\n policies.forEach((policy) => {\n this.#policies[policy.toLowerCase()] = false;\n });\n this.#policies.essential = true;\n }\n\n get policies() {\n return this.exists(this.cookiesPolicyKey)\n ? (this.#policies = {\n ...this.#policies,\n ...this.allPolicies,\n })\n : this.#policies;\n }\n\n set policies(newPolicyValues) {\n this.#policies = newPolicyValues;\n }\n\n /** @protected */\n #deserialise(cookieString) {\n const deserialised = {};\n cookieString.split(\";\").forEach((cookie) => {\n const parts = cookie.trim().split(\"=\");\n deserialised[parts[0]] = parts[1];\n });\n return deserialised;\n }\n\n get all() {\n return this.#deserialise(document.cookie);\n }\n\n /**\n * Check to see whether a cookie exists or not.\n * @param {string} key - The cookie name.\n * @returns {boolean}\n */\n exists(key) {\n return Object.prototype.hasOwnProperty.call(this.all, key);\n }\n\n /**\n * Check to see whether a cookie has a particular value.\n * @param {string} key - The cookie name.\n * @param {string|number|boolean} value - The value to check against.\n * @returns\n */\n hasValue(key, value) {\n return this.get(key) == value;\n }\n\n /**\n * Get a cookie.\n * @param {string} key - The cookie name.\n * @returns {string|number|boolean}\n */\n get(key) {\n return this.exists(key) ? decodeURIComponent(this.all[key]) : null;\n }\n\n /**\n * Set a cookie.\n * @param {string} key - The cookie name.\n * @param {string|number|boolean} value - The cookie value.\n * @param {Object} options\n * @param {number} [options.maxAge=31536000] - The maximum age of the cookie in seconds.\n * @param {string} [options.path=/] - The path to register the cookie for.\n * @param {string} [options.sameSite=Lax] - The sameSite attribute.\n */\n set(key, value, options = {}) {\n const {\n maxAge = 60 * 60 * 24 * 365,\n path = \"/\",\n sameSite = \"Lax\",\n } = options;\n document.cookie = `${encodeURIComponent(key)}=${encodeURIComponent(\n value,\n )}; SameSite=${sameSite}; path=${path}; max-age=${maxAge}; Secure`;\n }\n\n /**\n * Delete a cookie.\n * @param {string} key - The cookie name.\n * @param {string} [path=/] - The path to the cookie is registered on.\n */\n delete(key, path = \"/\") {\n this.set(key, \"\", 0, path);\n }\n\n get allPolicies() {\n return JSON.parse(this.get(this.cookiesPolicyKey) || \"{}\");\n }\n\n /**\n * Accept a policy.\n * @param {string} policy - The name of the policy.\n */\n acceptPolicy(policy) {\n this.#setPolicy(policy, true);\n this.savePolicies();\n }\n\n /**\n * Reject a policy.\n * @param {string} policy - The name of the policy.\n */\n rejectPolicy(policy) {\n if (policy === \"essential\") {\n return;\n }\n this.#setPolicy(policy, false);\n this.savePolicies();\n }\n\n /** @protected */\n #setPolicy(policy, accepted) {\n this.policies = {\n ...this.policies,\n [policy]: accepted,\n essential: true,\n };\n }\n\n /**\n * Commit the policy preferences to the browser.\n */\n savePolicies() {\n this.set(this.cookiesPolicyKey, JSON.stringify(this.policies));\n }\n\n /**\n * Accept all the cookie policies.\n */\n acceptAllPolicies() {\n Object.keys(this.policies).forEach((policy) =>\n this.#setPolicy(policy, true),\n );\n this.savePolicies();\n }\n\n /**\n * Reject all the cookie policies.\n */\n rejectAllPolicies() {\n Object.keys(this.policies).forEach((policy) =>\n this.#setPolicy(policy, false),\n );\n this.savePolicies();\n }\n\n /**\n * Get the acceptance status of a policy.\n * @param {string} policy - The name of the policy.\n * @returns {boolean}\n */\n isPolicyAccepted(policy) {\n return Object.prototype.hasOwnProperty.call(this.policies, policy)\n ? this.policies[policy] === true\n : null;\n }\n}\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 = (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 = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (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 \"../../lib/cookies.mjs\";\n\nexport class CookieBanner {\n constructor($module) {\n this.$module = $module;\n this.$acceptButton = $module && $module.querySelector('[value=\"accept\"]');\n this.$rejectButton = $module && $module.querySelector('[value=\"reject\"]');\n this.$prompt =\n $module && $module.querySelector(\".tna-cookie-banner__message--prompt\");\n this.$acceptedMessage =\n $module && $module.querySelector(\".tna-cookie-banner__message--accepted\");\n this.$rejectedMessage =\n $module && $module.querySelector(\".tna-cookie-banner__message--rejected\");\n this.$closeButtons = $module && $module.querySelectorAll('[value=\"close\"]');\n }\n\n init() {\n if (\n !this.$module ||\n !this.$acceptButton ||\n !this.$rejectButton ||\n !this.$prompt ||\n !this.$acceptedMessage ||\n !this.$rejectedMessage ||\n !this.$closeButtons\n ) {\n return;\n }\n\n const policies = this.$module.getAttribute(\"data-policies\");\n if (!policies) {\n return;\n }\n this.cookies = new Cookies(\n policies.split(\",\").map((policy) => policy.trim()),\n );\n\n this.loadScriptsOnAccept = this.$module.getAttribute(\"data-acceptscripts\");\n\n this.cookiePreferencesSet =\n this.$module.getAttribute(\"data-preferenceskey\") ||\n \"cookies_preferences_set\";\n const cookiePreferencesSet = this.cookies.hasValue(\n this.cookiePreferencesSet,\n \"true\",\n );\n\n if (!cookiePreferencesSet) {\n this.$module.removeAttribute(\"hidden\");\n\n this.$acceptButton.addEventListener(\"click\", () => this.accept());\n this.$rejectButton.addEventListener(\"click\", () => this.reject());\n }\n }\n\n accept() {\n this.$prompt.setAttribute(\"hidden\", true);\n this.complete();\n this.$acceptedMessage.removeAttribute(\"hidden\");\n this.$acceptedMessage.focus();\n this.$acceptedMessage.setAttribute(\"tabindex\", \"-1\");\n this.cookies.acceptAllPolicies();\n if (this.loadScriptsOnAccept) {\n this.loadScriptsOnAccept.split(\",\").forEach((script) => {\n const $script = document.createElement(\"script\");\n $script.src = script;\n document.head.appendChild($script);\n });\n }\n }\n\n reject() {\n this.$prompt.setAttribute(\"hidden\", true);\n this.complete();\n this.$rejectedMessage.removeAttribute(\"hidden\");\n this.$rejectedMessage.focus();\n this.$rejectedMessage.setAttribute(\"tabindex\", \"-1\");\n this.cookies.rejectAllPolicies();\n }\n\n complete() {\n this.cookies.set(this.cookiePreferencesSet, true);\n this.$closeButtons.forEach(($closeButton) => {\n $closeButton.addEventListener(\"click\", () => this.close());\n });\n }\n\n close() {\n this.$module.setAttribute(\"hidden\", true);\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","Cookies","_this","policies","arguments","length","undefined","cookiesPolicyKey","_classCallCheck","_classPrivateMethodInitSpec","_setPolicy","_deserialise","writable","value","_policies","this","forEach","policy","_classPrivateFieldGet","toLowerCase","essential","key","get","exists","_classPrivateFieldSet","_objectSpread","allPolicies","set","newPolicyValues","_classPrivateMethodGet","_deserialise2","call","document","cookie","Object","prototype","hasOwnProperty","all","decodeURIComponent","options","_options$maxAge","maxAge","_options$path","path","_options$sameSite","sameSite","concat","encodeURIComponent","JSON","parse","_setPolicy2","savePolicies","stringify","_this2","keys","_this3","cookieString","deserialised","split","parts","trim","accepted","_objectSpread2","_defineProperty","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","d","definition","o","defineProperty","enumerable","obj","prop","r","Symbol","toStringTag","CookieBanner","$module","$acceptButton","querySelector","$rejectButton","$prompt","$acceptedMessage","$rejectedMessage","$closeButtons","querySelectorAll","getAttribute","cookies","map","loadScriptsOnAccept","cookiePreferencesSet","hasValue","removeAttribute","addEventListener","accept","reject","setAttribute","complete","focus","acceptAllPolicies","script","$script","createElement","src","head","appendChild","rejectAllPolicies","$closeButton","close"],"sourceRoot":""}
1
+ {"version":3,"file":"components/cookie-banner/cookie-banner.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,cAAe,GAAIH,GACA,iBAAZC,QACdA,QAAqB,YAAID,IAEzBD,EAAkB,YAAIC,GACvB,CATD,CASGK,MAAM,I,2tDCTF,IAAMC,EAAkB,WAG7B,SAAAA,IACE,GADYC,EAAA,KAAAD,GAAAE,EAAA,cAFL,CAAC,GAGJF,EAAmBG,UACrB,OAAOH,EAAmBG,UAE5BH,EAAmBG,UAAYC,IACjC,CAqBC,OAnBDC,EAAAL,EAAA,EAAAM,IAAA,KAAAC,MAKA,SAAGC,EAAOC,G,MACHC,OAAOC,UAAUC,eAAeC,KAAKT,KAAKU,OAAQN,KACrDJ,KAAKU,OAAON,GAAS,IAEvBJ,KAAKU,OAAON,GAAS,GAAHO,O,+CAAOX,KAAKU,O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iBAAiBU,gBAAgB,UACtC1G,KAAKgG,iBAAiBgB,QACtBhH,KAAKgG,iBAAiBc,aAAa,WAAY,MAC/C9G,KAAKqG,QAAQa,mBACf,GAAC,CAAAhH,IAAA,WAAAC,MAED,WAAW,IAAA8D,EAAA,KACTjE,KAAKqG,QAAQrC,IAAIhE,KAAKwG,sBAAsB,GAC5CxG,KAAKiG,cAAchF,SAAQ,SAACkG,GAC1BA,EAAaR,iBAAiB,SAAS,kBAAM1C,EAAKmD,OAAO,GAC3D,GACF,GAAC,CAAAlH,IAAA,QAAAC,MAED,WACEH,KAAK0F,QAAQoB,aAAa,UAAU,EACtC,M,oEAACrB,CAAA,CAxFsB,E","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/./src/nationalarchives/lib/cookies.mjs","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/cookie-banner/cookie-banner.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = factory();\n})(self, () => {\nreturn ","export class CookieEventHandler {\n events = {};\n\n constructor() {\n if (CookieEventHandler._instance) {\n return CookieEventHandler._instance;\n }\n CookieEventHandler._instance = this;\n }\n\n /**\n * Add an event listener.\n * @param {string} event - The event to add a listener for.\n * @param {function} callback - The callback function to call when the event is triggered.\n */\n on(event, callback) {\n if (!Object.prototype.hasOwnProperty.call(this.events, event)) {\n this.events[event] = [];\n }\n this.events[event] = [...this.events[event], callback];\n }\n\n /** @protected */\n trigger(event, data = {}) {\n if (Object.prototype.hasOwnProperty.call(this.events, event)) {\n this.events[event].forEach((eventToTrigger) =>\n eventToTrigger.call(this, data),\n );\n }\n }\n}\n\n/**\n * Class to handle cookies.\n * @class Cookies\n * @constructor\n * @public\n */\nexport default class Cookies {\n /** @protected */\n extraPolicies = [];\n /** @protected */\n domain = \"\";\n /** @protected */\n secure = true;\n /** @protected */\n policiesKey = \"\";\n\n /**\n * Create a cookie handler.\n * @param {string[]} [extraPolicies=[]] - The extra cookie policies to manage in addition to essential, settings and usage.\n * @param {string} [options.domain=\"\"] - The domain to register the cookie with.\n * @param {string} [options.secure=true] - Only set cookie in HTTPS environments.\n * @param {string} [options.policiesKey=cookies_policy] - The name of the cookie.\n */\n constructor(extraPolicies = [], options = {}) {\n const {\n domain = \"\",\n secure = true,\n policiesKey = \"cookies_policy\",\n } = options;\n this.extraPolicies = extraPolicies;\n this.domain = domain;\n this.secure = secure;\n this.policiesKey = policiesKey;\n this.events = new CookieEventHandler();\n this.init();\n }\n\n /** @protected */\n init() {\n this.savePolicies({\n ...Object.fromEntries(\n this.extraPolicies.map((k) => [k.toLowerCase(), false]),\n ),\n usage: false,\n settings: false,\n ...this.policies,\n essential: true,\n });\n }\n\n get all() {\n const deserialised = {};\n document.cookie\n .split(\"; \")\n .filter((x) => x)\n .forEach((cookie) => {\n const parts = cookie.trim().split(\"=\");\n if (parts[0]) {\n deserialised[parts[0]] = parts[1];\n }\n });\n return deserialised;\n }\n\n get policies() {\n try {\n return JSON.parse(this.get(this.policiesKey) || \"{}\");\n } catch (e) {\n return {};\n }\n }\n\n /**\n * Check to see whether a cookie exists or not.\n * @param {string} key - The cookie name.\n * @returns {boolean}\n */\n exists(key) {\n return Object.prototype.hasOwnProperty.call(this.all, key);\n }\n\n /**\n * Check to see whether a cookie has a particular value.\n * @param {string} key - The cookie name.\n * @param {string|number|boolean} value - The value to check against.\n * @returns\n */\n hasValue(key, value) {\n return this.get(key) == value;\n }\n\n /**\n * Get a cookie.\n * @param {string} key - The cookie name.\n * @returns {string|number|boolean}\n */\n get(key) {\n return this.exists(key) ? decodeURIComponent(this.all[key]) : null;\n }\n\n /**\n * Set a cookie.\n * @param {string} key - The cookie name.\n * @param {string|number|boolean} value - The cookie value.\n * @param {Object} options\n * @param {number} [options.maxAge=31536000] - The maximum age of the cookie in seconds.\n * @param {string} [options.path=/] - The path to register the cookie for.\n * @param {string} [options.sameSite=Lax] - The sameSite attribute.\n * @param {string} [options.domain=this.domain] - The domain to register the cookie with.\n * @param {string} [options.secure=this.secure] - Only set cookie in HTTPS environments.\n */\n set(key, value, options = {}) {\n const {\n maxAge = 60 * 60 * 24 * 365,\n path = \"/\",\n sameSite = \"Lax\",\n domain = this.domain,\n secure = this.secure,\n } = options;\n if (!key) {\n return;\n }\n const cookie = `${encodeURIComponent(key)}=${encodeURIComponent(value)};${\n domain ? ` domain=${domain}; ` : \"\"\n } samesite=${sameSite}; path=${path}; max-age=${maxAge}${\n secure ? \"; secure\" : \"\"\n }`;\n document.cookie = cookie;\n this.events.trigger(\"setCookie\", {\n key,\n value,\n maxAge,\n path,\n sameSite,\n domain,\n secure,\n cookie,\n });\n }\n\n /**\n * Delete a cookie.\n * @param {string} key - The cookie name.\n * @param {string} [path=/] - The path to the cookie is registered on.\n */\n delete(key, path = \"/\", domain = null) {\n const options = { maxAge: -1, path, domain: domain || undefined };\n this.set(key, \"\", options);\n this.events.trigger(\"deleteCookie\", { key, ...options });\n }\n\n /**\n * Delete all cookies.\n */\n deleteAll(path = \"/\", domain = null) {\n Object.keys(this.all).forEach((cookie) => {\n this.delete(cookie, path, domain);\n });\n this.events.trigger(\"deleteAllCookies\", { path, domain });\n }\n\n /**\n * Accept a policy.\n * @param {string} policy - The name of the policy.\n */\n acceptPolicy(policy) {\n this.setPolicy(policy, true);\n this.events.trigger(\"acceptPolicy\", policy);\n this.events.trigger(\"changePolicy\", { [policy]: true });\n }\n\n /**\n * Reject a policy.\n * @param {string} policy - The name of the policy.\n */\n rejectPolicy(policy) {\n this.setPolicy(policy, false);\n this.events.trigger(\"rejectPolicy\", policy);\n this.events.trigger(\"changePolicy\", { [policy]: false });\n }\n\n /**\n * Set a policy.\n * @param {string} policy - The name of the policy.\n * @param {boolean} accepted - Whether the policy is accepted or not.\n */\n setPolicy(policy, accepted) {\n if (policy === \"essential\") {\n return;\n }\n this.savePolicies({\n ...this.policies,\n [policy]: accepted,\n essential: true,\n });\n this.events.trigger(\"changePolicy\", { [policy]: accepted });\n }\n\n /**\n * Accept all the cookie policies.\n */\n acceptAllPolicies() {\n const allPolicies = Object.fromEntries(\n Object.keys(this.policies).map((k) => [k.toLowerCase(), true]),\n );\n this.savePolicies(allPolicies);\n this.events.trigger(\"acceptAllPolicies\");\n this.events.trigger(\"changePolicy\", allPolicies);\n }\n\n /**\n * Reject all the cookie policies.\n */\n rejectAllPolicies() {\n const allPolicies = {\n ...Object.fromEntries(\n Object.keys(this.policies).map((k) => [k.toLowerCase(), false]),\n ),\n essential: true,\n };\n this.savePolicies(allPolicies);\n this.events.trigger(\"rejectAllPolicies\");\n this.events.trigger(\"changePolicy\", allPolicies);\n }\n\n /**\n * Commit policy preferences to the browser.\n * @param {object} policies - The policies to commit.\n */\n savePolicies(policies) {\n this.set(this.policiesKey, JSON.stringify(policies));\n }\n\n /**\n * Get the acceptance status of a policy.\n * @param {string} policy - The name of the policy.\n * @returns {boolean}\n */\n isPolicyAccepted(policy) {\n return Object.prototype.hasOwnProperty.call(this.policies, policy)\n ? this.policies[policy] === true\n : null;\n }\n\n /**\n * Add an event listener.\n * @param {string} event - The event to add a listener for.\n * @param {function} callback - The callback function to call when the event is triggered.\n */\n on(event, callback) {\n this.events.on(event, callback);\n }\n}\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 = (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 = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (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 \"../../lib/cookies.mjs\";\n\nexport class CookieBanner {\n constructor($module) {\n this.$module = $module;\n this.$acceptButton = $module && $module.querySelector('[value=\"accept\"]');\n this.$rejectButton = $module && $module.querySelector('[value=\"reject\"]');\n this.$prompt =\n $module && $module.querySelector(\".tna-cookie-banner__message--prompt\");\n this.$acceptedMessage =\n $module && $module.querySelector(\".tna-cookie-banner__message--accepted\");\n this.$rejectedMessage =\n $module && $module.querySelector(\".tna-cookie-banner__message--rejected\");\n this.$closeButtons = $module && $module.querySelectorAll('[value=\"close\"]');\n }\n\n init() {\n if (\n !this.$module ||\n !this.$acceptButton ||\n !this.$rejectButton ||\n !this.$prompt ||\n !this.$acceptedMessage ||\n !this.$rejectedMessage ||\n !this.$closeButtons\n ) {\n return;\n }\n\n const policies = this.$module.getAttribute(\"data-policies\") || \"\";\n const domain = this.$module.getAttribute(\"data-domain\") || undefined;\n const secure = this.$module.getAttribute(\"data-secure\") || undefined;\n const policiesKey =\n this.$module.getAttribute(\"data-policies-key\") || undefined;\n\n this.cookies = new (window.TNAFrontend?.Cookies || Cookies)(\n policies\n .split(\",\")\n .filter((x) => x)\n .map((policy) => policy.trim()),\n {\n domain,\n secure,\n policiesKey,\n },\n );\n\n this.cookiePreferencesSet =\n this.$module.getAttribute(\"data-preferenceskey\") ||\n \"cookie_preferences_set\";\n const cookiePreferencesSet = this.cookies.hasValue(\n this.cookiePreferencesSet,\n \"true\",\n );\n\n if (!cookiePreferencesSet) {\n this.$module.removeAttribute(\"hidden\");\n\n this.$acceptButton.addEventListener(\"click\", () => this.accept());\n this.$rejectButton.addEventListener(\"click\", () => this.reject());\n }\n }\n\n accept() {\n this.$prompt.setAttribute(\"hidden\", true);\n this.complete();\n this.$acceptedMessage.removeAttribute(\"hidden\");\n this.$acceptedMessage.focus();\n this.$acceptedMessage.setAttribute(\"tabindex\", \"-1\");\n this.cookies.acceptAllPolicies();\n }\n\n reject() {\n this.$prompt.setAttribute(\"hidden\", true);\n this.complete();\n this.$rejectedMessage.removeAttribute(\"hidden\");\n this.$rejectedMessage.focus();\n this.$rejectedMessage.setAttribute(\"tabindex\", \"-1\");\n this.cookies.rejectAllPolicies();\n }\n\n complete() {\n this.cookies.set(this.cookiePreferencesSet, true);\n this.$closeButtons.forEach(($closeButton) => {\n $closeButton.addEventListener(\"click\", () => this.close());\n });\n }\n\n close() {\n this.$module.setAttribute(\"hidden\", true);\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","CookieEventHandler","_classCallCheck","_defineProperty","_instance","this","_createClass","key","value","event","callback","Object","prototype","hasOwnProperty","call","events","concat","_this","data","arguments","length","undefined","forEach","eventToTrigger","Cookies","extraPolicies","options","_options$domain","domain","_options$secure","secure","_options$policiesKey","policiesKey","init","savePolicies","_objectSpread","fromEntries","map","k","toLowerCase","usage","settings","policies","essential","get","deserialised","document","cookie","split","filter","x","parts","trim","JSON","parse","e","all","exists","decodeURIComponent","_options$maxAge","maxAge","_options$path","path","_options$sameSite","sameSite","_options$domain2","_options$secure2","encodeURIComponent","trigger","set","_this2","keys","policy","setPolicy","accepted","_objectSpread2","allPolicies","stringify","on","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","d","definition","o","defineProperty","enumerable","obj","prop","r","Symbol","toStringTag","CookieBanner","$module","$acceptButton","querySelector","$rejectButton","$prompt","$acceptedMessage","$rejectedMessage","$closeButtons","querySelectorAll","_window$TNAFrontend","getAttribute","cookies","window","TNAFrontend","cookiePreferencesSet","hasValue","removeAttribute","addEventListener","accept","reject","setAttribute","complete","focus","acceptAllPolicies","rejectAllPolicies","$closeButton","close"],"sourceRoot":""}
@@ -27,19 +27,27 @@ export class CookieBanner {
27
27
  return;
28
28
  }
29
29
 
30
- const policies = this.$module.getAttribute("data-policies");
31
- if (!policies) {
32
- return;
33
- }
34
- this.cookies = new Cookies(
35
- policies.split(",").map((policy) => policy.trim()),
36
- );
30
+ const policies = this.$module.getAttribute("data-policies") || "";
31
+ const domain = this.$module.getAttribute("data-domain") || undefined;
32
+ const secure = this.$module.getAttribute("data-secure") || undefined;
33
+ const policiesKey =
34
+ this.$module.getAttribute("data-policies-key") || undefined;
37
35
 
38
- this.loadScriptsOnAccept = this.$module.getAttribute("data-acceptscripts");
36
+ this.cookies = new (window.TNAFrontend?.Cookies || Cookies)(
37
+ policies
38
+ .split(",")
39
+ .filter((x) => x)
40
+ .map((policy) => policy.trim()),
41
+ {
42
+ domain,
43
+ secure,
44
+ policiesKey,
45
+ },
46
+ );
39
47
 
40
48
  this.cookiePreferencesSet =
41
49
  this.$module.getAttribute("data-preferenceskey") ||
42
- "cookies_preferences_set";
50
+ "cookie_preferences_set";
43
51
  const cookiePreferencesSet = this.cookies.hasValue(
44
52
  this.cookiePreferencesSet,
45
53
  "true",
@@ -60,13 +68,6 @@ export class CookieBanner {
60
68
  this.$acceptedMessage.focus();
61
69
  this.$acceptedMessage.setAttribute("tabindex", "-1");
62
70
  this.cookies.acceptAllPolicies();
63
- if (this.loadScriptsOnAccept) {
64
- this.loadScriptsOnAccept.split(",").forEach((script) => {
65
- const $script = document.createElement("script");
66
- $script.src = script;
67
- document.head.appendChild($script);
68
- });
69
- }
70
71
  }
71
72
 
72
73
  reject() {
@@ -7,7 +7,7 @@
7
7
  @use "../grid";
8
8
 
9
9
  .tna-cookie-banner {
10
- @include colour.invert;
10
+ @include colour.contrast;
11
11
 
12
12
  padding-top: 2rem;
13
13
  padding-bottom: 2rem;
@@ -5,10 +5,12 @@ import { within, userEvent } from "@storybook/testing-library";
5
5
  import Cookies from "../../lib/cookies.mjs";
6
6
 
7
7
  const argTypes = {
8
- url: { control: "text" },
8
+ cookiesUrl: { control: "text" },
9
9
  policies: { control: "text" },
10
- cookiesPreferencesSetKey: { control: "text" },
11
- loadScriptsOnAccept: { control: "text" },
10
+ policiesKey: { control: "text" },
11
+ preferencesSetKey: { control: "text" },
12
+ cookiesDomain: { control: "text" },
13
+ allowInsecure: { control: "boolean" },
12
14
  classes: { control: "text" },
13
15
  attributes: { control: "object" },
14
16
  };
@@ -25,19 +27,23 @@ export default {
25
27
  };
26
28
 
27
29
  const Template = ({
28
- url,
30
+ cookiesUrl,
29
31
  policies,
30
- cookiesPreferencesSetKey,
31
- loadScriptsOnAccept,
32
+ policiesKey,
33
+ preferencesSetKey,
34
+ cookiesDomain,
35
+ allowInsecure,
32
36
  classes,
33
37
  attributes,
34
38
  }) =>
35
39
  CookieBanner({
36
40
  params: {
37
- url,
41
+ cookiesUrl,
38
42
  policies,
39
- cookiesPreferencesSetKey,
40
- loadScriptsOnAccept,
43
+ policiesKey,
44
+ preferencesSetKey,
45
+ cookiesDomain,
46
+ allowInsecure,
41
47
  classes,
42
48
  attributes,
43
49
  },
@@ -49,23 +55,19 @@ Standard.args = {
49
55
  classes: "tna-cookie-banner--demo",
50
56
  };
51
57
 
52
- const deleteAllCookies = (cookies) => {
53
- Object.keys(cookies.all).forEach((cookie) => cookies.delete(cookie));
54
- };
55
-
56
58
  export const Accept = Template.bind({});
57
59
  Accept.args = {
58
60
  cookiesUrl: "#",
61
+ allowInsecure: true,
59
62
  classes: "tna-cookie-banner--demo",
60
63
  };
61
64
  Accept.play = async ({ canvasElement }) => {
62
- const cookies = new Cookies();
63
- deleteAllCookies(cookies);
64
-
65
+ const cookies = new window.TNAFrontend.Cookies();
65
66
  await expect(cookies.isPolicyAccepted("essential")).toEqual(true);
66
67
  await expect(cookies.isPolicyAccepted("usage")).toEqual(false);
67
68
  await expect(cookies.isPolicyAccepted("settings")).toEqual(false);
68
69
  await expect(cookies.isPolicyAccepted("unknown")).toEqual(null);
70
+ await expect(cookies.exists("cookie_preferences_set")).toEqual(false);
69
71
 
70
72
  const canvas = within(canvasElement);
71
73
  const acceptButton = canvas.getByText("Accept cookies");
@@ -78,6 +80,11 @@ Accept.play = async ({ canvasElement }) => {
78
80
  await expect(cookies.isPolicyAccepted("usage")).toEqual(true);
79
81
  await expect(cookies.isPolicyAccepted("settings")).toEqual(true);
80
82
  await expect(cookies.isPolicyAccepted("unknown")).toEqual(null);
83
+ await expect(cookies.exists("cookie_preferences_set")).toEqual(true);
84
+ await expect(cookies.get("cookie_preferences_set")).toEqual("true");
85
+ await expect(cookies.hasValue("cookie_preferences_set", "true")).toEqual(
86
+ true,
87
+ );
81
88
  await expect(acceptButton).not.toBeVisible();
82
89
  await expect(rejectButton).not.toBeVisible();
83
90
 
@@ -86,8 +93,6 @@ Accept.play = async ({ canvasElement }) => {
86
93
  // await userEvent.click(closeButton);
87
94
 
88
95
  // await expect(closeButton).not.toBeVisible();
89
-
90
- deleteAllCookies(cookies);
91
96
  };
92
97
 
93
98
  export const Reject = Template.bind({});
@@ -97,12 +102,11 @@ Reject.args = {
97
102
  };
98
103
  Reject.play = async ({ canvasElement }) => {
99
104
  const cookies = new Cookies();
100
- deleteAllCookies(cookies);
101
-
102
105
  await expect(cookies.isPolicyAccepted("essential")).toEqual(true);
103
106
  await expect(cookies.isPolicyAccepted("usage")).toEqual(false);
104
107
  await expect(cookies.isPolicyAccepted("settings")).toEqual(false);
105
108
  await expect(cookies.isPolicyAccepted("unknown")).toEqual(null);
109
+ await expect(cookies.exists("cookie_preferences_set")).toEqual(false);
106
110
 
107
111
  const canvas = within(canvasElement);
108
112
  const acceptButton = canvas.getByText("Accept cookies");
@@ -115,10 +119,15 @@ Reject.play = async ({ canvasElement }) => {
115
119
  await expect(cookies.isPolicyAccepted("usage")).toEqual(false);
116
120
  await expect(cookies.isPolicyAccepted("settings")).toEqual(false);
117
121
  await expect(cookies.isPolicyAccepted("unknown")).toEqual(null);
122
+ await expect(cookies.exists("cookie_preferences_set")).toEqual(true);
123
+ await expect(cookies.get("cookie_preferences_set")).toEqual("true");
124
+ await expect(cookies.hasValue("cookie_preferences_set", "true")).toEqual(
125
+ true,
126
+ );
118
127
  await expect(acceptButton).not.toBeVisible();
119
128
  await expect(rejectButton).not.toBeVisible();
120
129
 
121
- deleteAllCookies(cookies);
130
+ await cookies.deleteAll();
122
131
  };
123
132
 
124
133
  export const CustomPolicies = Template.bind({});
@@ -127,51 +136,92 @@ CustomPolicies.args = {
127
136
  policies: "custom",
128
137
  classes: "tna-cookie-banner--demo",
129
138
  };
139
+ CustomPolicies.parameters = {
140
+ chromatic: { disableSnapshot: true },
141
+ };
130
142
  CustomPolicies.play = async ({ args, canvasElement }) => {
131
143
  const cookies = new Cookies(args.policies.split(","));
132
- deleteAllCookies(cookies);
133
-
134
144
  await expect(cookies.isPolicyAccepted("essential")).toEqual(true);
135
- await expect(cookies.isPolicyAccepted("usage")).toEqual(null);
136
- await expect(cookies.isPolicyAccepted("settings")).toEqual(null);
145
+ await expect(cookies.isPolicyAccepted("usage")).toEqual(false);
146
+ await expect(cookies.isPolicyAccepted("settings")).toEqual(false);
137
147
  await expect(cookies.isPolicyAccepted("custom")).toEqual(false);
148
+ await expect(cookies.exists("cookie_preferences_set")).toEqual(false);
138
149
 
139
150
  const canvas = within(canvasElement);
140
151
  const acceptButton = canvas.getByText("Accept cookies");
141
152
  await userEvent.click(acceptButton);
142
153
 
143
154
  await expect(cookies.isPolicyAccepted("essential")).toEqual(true);
144
- await expect(cookies.isPolicyAccepted("usage")).toEqual(null);
145
- await expect(cookies.isPolicyAccepted("settings")).toEqual(null);
155
+ await expect(cookies.isPolicyAccepted("usage")).toEqual(true);
156
+ await expect(cookies.isPolicyAccepted("settings")).toEqual(true);
146
157
  await expect(cookies.isPolicyAccepted("custom")).toEqual(true);
158
+ await expect(cookies.exists("cookie_preferences_set")).toEqual(true);
159
+ await expect(cookies.get("cookie_preferences_set")).toEqual("true");
160
+ await expect(cookies.hasValue("cookie_preferences_set", "true")).toEqual(
161
+ true,
162
+ );
147
163
 
148
- deleteAllCookies(cookies);
164
+ await cookies.deleteAll();
149
165
  };
150
166
 
151
- export const AddScriptsOnAccept = Template.bind({});
152
- AddScriptsOnAccept.args = {
167
+ export const Existing = Template.bind({});
168
+ Existing.args = {
153
169
  cookiesUrl: "#",
154
- loadScriptsOnAccept: "my-usage-script.js",
170
+ allowInsecure: true,
155
171
  classes: "tna-cookie-banner--demo",
156
172
  };
157
- AddScriptsOnAccept.play = async ({ args, canvasElement }) => {
173
+ Existing.decorators = [
174
+ (Story) => {
175
+ const cookies = new Cookies();
176
+ cookies.set("cookie_preferences_set", true);
177
+ return Story();
178
+ },
179
+ ];
180
+ Existing.play = async ({ canvasElement }) => {
158
181
  const cookies = new Cookies();
159
- deleteAllCookies(cookies);
160
-
161
- const noScript = document.querySelector(
162
- `script[src="${args.loadScriptsOnAccept}"]`,
182
+ await expect(cookies.isPolicyAccepted("essential")).toEqual(true);
183
+ await expect(cookies.isPolicyAccepted("usage")).toEqual(false);
184
+ await expect(cookies.isPolicyAccepted("settings")).toEqual(false);
185
+ await expect(cookies.isPolicyAccepted("unknown")).toEqual(null);
186
+ await expect(cookies.exists("cookie_preferences_set")).toEqual(true);
187
+ await expect(cookies.get("cookie_preferences_set")).toEqual("true");
188
+ await expect(cookies.hasValue("cookie_preferences_set", "true")).toEqual(
189
+ true,
163
190
  );
164
- await expect(noScript).toEqual(null);
165
191
 
166
192
  const canvas = within(canvasElement);
167
193
  const acceptButton = canvas.getByText("Accept cookies");
168
- await userEvent.click(acceptButton);
169
-
170
- const script = document.querySelector(
171
- `script[src="${args.loadScriptsOnAccept}"]`,
172
- );
173
- await expect(script).toBeTruthy();
194
+ const rejectButton = canvas.getByText("Reject cookies");
195
+ await expect(acceptButton).not.toBeVisible();
196
+ await expect(rejectButton).not.toBeVisible();
174
197
 
175
- deleteAllCookies(cookies);
176
- script.remove();
198
+ await cookies.deleteAll();
177
199
  };
200
+
201
+ // export const EventHandling = Template.bind({});
202
+ // EventHandling.args = {
203
+ // cookiesUrl: "#",
204
+ // policies: "custom",
205
+ // classes: "tna-cookie-banner--demo",
206
+ // };
207
+ // EventHandling.play = async ({ args, canvasElement }) => {
208
+ // deleteAllCookies();
209
+
210
+ // const cookies = new Cookies();
211
+
212
+ // const onChangePolicy = jest.fn(data => {
213
+ // console.log(data)
214
+ // })
215
+ // cookies.on("changePolicy", onChangePolicy)
216
+
217
+ // const canvas = within(canvasElement);
218
+ // const acceptButton = canvas.getByText("Accept cookies");
219
+ // await userEvent.click(acceptButton);
220
+
221
+ // await expect(onChangePolicy.mock).toHaveBeenCalledTimes(1);
222
+ // await expect(onChangePolicy.mock.calls).toHaveLength(1);
223
+ // await expect(onChangePolicy.mock.results[0].value).toHaveProperty("custom");
224
+ // await expect(onChangePolicy.mock.results[0].value.custom).toEqual(true);
225
+
226
+ // deleteAllCookies();
227
+ // };
@@ -1,4 +1,87 @@
1
1
  {
2
2
  "component": "cookie-banner",
3
- "fixtures": []
3
+ "fixtures": [
4
+ {
5
+ "name": "minimal",
6
+ "options": {
7
+ "cookiesUrl": "/cookies"
8
+ },
9
+ "html": "<div class=\"tna-cookie-banner \" role=\"region\" aria-label=\"Cookie usage\" data-module=\"tna-cookie-banner\" data-policies=\"\" data-preferenceskey=\"cookie_preferences_set\" data-policies-key=\"\" data-domain=\"\" data-insecure=\"false\" hidden><div class=\"tna-container\"><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--prompt\"><h2 class=\"tna-heading-m\">This website uses cookies</h2><p>We use some essential cookies to make this service work.</p><p>We'd also like to use analytics cookies so we can understand how you use the service and make improvements.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"accept\">Accept cookies</button><button class=\"tna-button \" value=\"reject\">Reject cookies</button><a href=\"/cookies\" class=\"tna-button tna-button--plain\" role=\"button\">Set cookie preferences</a></div></div><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--accepted\" tabindex=\"0\" hidden><p>You have accepted optional cookies. You can change your cookie settings on the <a href=\"/cookies\">Cookies page</a>.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"close\">Close this message</button></div></div><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--rejected\" tabindex=\"0\" hidden><p>You have rejected optional cookies. You can change your cookie settings on the <a href=\"/cookies\">Cookies page</a>.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"close\">Close this message</button></div></div></div></div>",
10
+ "hidden": false
11
+ },
12
+ {
13
+ "name": "custom preferences set key",
14
+ "options": {
15
+ "cookiesUrl": "/cookies",
16
+ "cookiesPreferencesSetKey": "custom"
17
+ },
18
+ "html": "<div class=\"tna-cookie-banner \" role=\"region\" aria-label=\"Cookie usage\" data-module=\"tna-cookie-banner\" data-policies=\"\" data-preferenceskey=\"cookie_preferences_set\" data-policies-key=\"\" data-domain=\"\" data-insecure=\"false\" hidden><div class=\"tna-container\"><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--prompt\"><h2 class=\"tna-heading-m\">This website uses cookies</h2><p>We use some essential cookies to make this service work.</p><p>We'd also like to use analytics cookies so we can understand how you use the service and make improvements.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"accept\">Accept cookies</button><button class=\"tna-button \" value=\"reject\">Reject cookies</button><a href=\"/cookies\" class=\"tna-button tna-button--plain\" role=\"button\">Set cookie preferences</a></div></div><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--accepted\" tabindex=\"0\" hidden><p>You have accepted optional cookies. You can change your cookie settings on the <a href=\"/cookies\">Cookies page</a>.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"close\">Close this message</button></div></div><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--rejected\" tabindex=\"0\" hidden><p>You have rejected optional cookies. You can change your cookie settings on the <a href=\"/cookies\">Cookies page</a>.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"close\">Close this message</button></div></div></div></div>",
19
+ "hidden": false
20
+ },
21
+ {
22
+ "name": "custom policies",
23
+ "options": {
24
+ "cookiesUrl": "/cookies",
25
+ "policies": "custom"
26
+ },
27
+ "html": "<div class=\"tna-cookie-banner \" role=\"region\" aria-label=\"Cookie usage\" data-module=\"tna-cookie-banner\" data-policies=\"custom\" data-preferenceskey=\"cookie_preferences_set\" data-policies-key=\"\" data-domain=\"\" data-insecure=\"false\" hidden><div class=\"tna-container\"><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--prompt\"><h2 class=\"tna-heading-m\">This website uses cookies</h2><p>We use some essential cookies to make this service work.</p><p>We'd also like to use analytics cookies so we can understand how you use the service and make improvements.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"accept\">Accept cookies</button><button class=\"tna-button \" value=\"reject\">Reject cookies</button><a href=\"/cookies\" class=\"tna-button tna-button--plain\" role=\"button\">Set cookie preferences</a></div></div><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--accepted\" tabindex=\"0\" hidden><p>You have accepted optional cookies. You can change your cookie settings on the <a href=\"/cookies\">Cookies page</a>.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"close\">Close this message</button></div></div><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--rejected\" tabindex=\"0\" hidden><p>You have rejected optional cookies. You can change your cookie settings on the <a href=\"/cookies\">Cookies page</a>.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"close\">Close this message</button></div></div></div></div>",
28
+ "hidden": false
29
+ },
30
+ {
31
+ "name": "custom policies key",
32
+ "options": {
33
+ "cookiesUrl": "/cookies",
34
+ "policiesKey": "custom_key"
35
+ },
36
+ "html": "<div class=\"tna-cookie-banner \" role=\"region\" aria-label=\"Cookie usage\" data-module=\"tna-cookie-banner\" data-policies=\"\" data-preferenceskey=\"cookie_preferences_set\" data-policies-key=\"custom_key\" data-domain=\"\" data-insecure=\"false\" hidden><div class=\"tna-container\"><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--prompt\"><h2 class=\"tna-heading-m\">This website uses cookies</h2><p>We use some essential cookies to make this service work.</p><p>We'd also like to use analytics cookies so we can understand how you use the service and make improvements.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"accept\">Accept cookies</button><button class=\"tna-button \" value=\"reject\">Reject cookies</button><a href=\"/cookies\" class=\"tna-button tna-button--plain\" role=\"button\">Set cookie preferences</a></div></div><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--accepted\" tabindex=\"0\" hidden><p>You have accepted optional cookies. You can change your cookie settings on the <a href=\"/cookies\">Cookies page</a>.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"close\">Close this message</button></div></div><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--rejected\" tabindex=\"0\" hidden><p>You have rejected optional cookies. You can change your cookie settings on the <a href=\"/cookies\">Cookies page</a>.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"close\">Close this message</button></div></div></div></div>",
37
+ "hidden": false
38
+ },
39
+ {
40
+ "name": "with domain",
41
+ "options": {
42
+ "cookiesUrl": "/cookies",
43
+ "cookiesDomain": "nationalarchives.gov.uk"
44
+ },
45
+ "html": "<div class=\"tna-cookie-banner \" role=\"region\" aria-label=\"Cookie usage\" data-module=\"tna-cookie-banner\" data-policies=\"\" data-preferenceskey=\"cookie_preferences_set\" data-policies-key=\"\" data-domain=\"nationalarchives.gov.uk\" data-insecure=\"false\" hidden><div class=\"tna-container\"><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--prompt\"><h2 class=\"tna-heading-m\">This website uses cookies</h2><p>We use some essential cookies to make this service work.</p><p>We'd also like to use analytics cookies so we can understand how you use the service and make improvements.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"accept\">Accept cookies</button><button class=\"tna-button \" value=\"reject\">Reject cookies</button><a href=\"/cookies\" class=\"tna-button tna-button--plain\" role=\"button\">Set cookie preferences</a></div></div><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--accepted\" tabindex=\"0\" hidden><p>You have accepted optional cookies. You can change your cookie settings on the <a href=\"/cookies\">Cookies page</a>.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"close\">Close this message</button></div></div><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--rejected\" tabindex=\"0\" hidden><p>You have rejected optional cookies. You can change your cookie settings on the <a href=\"/cookies\">Cookies page</a>.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"close\">Close this message</button></div></div></div></div>",
46
+ "hidden": false
47
+ },
48
+ {
49
+ "name": "with preferences set key",
50
+ "options": {
51
+ "cookiesUrl": "/cookies",
52
+ "preferencesSetKey": "custom_preferences_set_key"
53
+ },
54
+ "html": "<div class=\"tna-cookie-banner \" role=\"region\" aria-label=\"Cookie usage\" data-module=\"tna-cookie-banner\" data-policies=\"\" data-preferenceskey=\"custom_preferences_set_key\" data-policies-key=\"\" data-domain=\"\" data-insecure=\"false\" hidden><div class=\"tna-container\"><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--prompt\"><h2 class=\"tna-heading-m\">This website uses cookies</h2><p>We use some essential cookies to make this service work.</p><p>We'd also like to use analytics cookies so we can understand how you use the service and make improvements.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"accept\">Accept cookies</button><button class=\"tna-button \" value=\"reject\">Reject cookies</button><a href=\"/cookies\" class=\"tna-button tna-button--plain\" role=\"button\">Set cookie preferences</a></div></div><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--accepted\" tabindex=\"0\" hidden><p>You have accepted optional cookies. You can change your cookie settings on the <a href=\"/cookies\">Cookies page</a>.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"close\">Close this message</button></div></div><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--rejected\" tabindex=\"0\" hidden><p>You have rejected optional cookies. You can change your cookie settings on the <a href=\"/cookies\">Cookies page</a>.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"close\">Close this message</button></div></div></div></div>",
55
+ "hidden": false
56
+ },
57
+ {
58
+ "name": "insecure",
59
+ "options": {
60
+ "cookiesUrl": "/cookies",
61
+ "allowInsecure": true
62
+ },
63
+ "html": "<div class=\"tna-cookie-banner \" role=\"region\" aria-label=\"Cookie usage\" data-module=\"tna-cookie-banner\" data-policies=\"\" data-preferenceskey=\"cookie_preferences_set\" data-policies-key=\"\" data-domain=\"\" data-insecure=\"true\" hidden><div class=\"tna-container\"><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--prompt\"><h2 class=\"tna-heading-m\">This website uses cookies</h2><p>We use some essential cookies to make this service work.</p><p>We'd also like to use analytics cookies so we can understand how you use the service and make improvements.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"accept\">Accept cookies</button><button class=\"tna-button \" value=\"reject\">Reject cookies</button><a href=\"/cookies\" class=\"tna-button tna-button--plain\" role=\"button\">Set cookie preferences</a></div></div><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--accepted\" tabindex=\"0\" hidden><p>You have accepted optional cookies. You can change your cookie settings on the <a href=\"/cookies\">Cookies page</a>.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"close\">Close this message</button></div></div><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--rejected\" tabindex=\"0\" hidden><p>You have rejected optional cookies. You can change your cookie settings on the <a href=\"/cookies\">Cookies page</a>.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"close\">Close this message</button></div></div></div></div>",
64
+ "hidden": false
65
+ },
66
+ {
67
+ "name": "with classes",
68
+ "options": {
69
+ "cookiesUrl": "/cookies",
70
+ "classes": "tna-cookie-banner--fixture"
71
+ },
72
+ "html": "<div class=\"tna-cookie-banner tna-cookie-banner--fixture\" role=\"region\" aria-label=\"Cookie usage\" data-module=\"tna-cookie-banner\" data-policies=\"\" data-preferenceskey=\"cookie_preferences_set\" data-policies-key=\"\" data-domain=\"\" data-insecure=\"false\" hidden><div class=\"tna-container\"><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--prompt\"><h2 class=\"tna-heading-m\">This website uses cookies</h2><p>We use some essential cookies to make this service work.</p><p>We'd also like to use analytics cookies so we can understand how you use the service and make improvements.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"accept\">Accept cookies</button><button class=\"tna-button \" value=\"reject\">Reject cookies</button><a href=\"/cookies\" class=\"tna-button tna-button--plain\" role=\"button\">Set cookie preferences</a></div></div><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--accepted\" tabindex=\"0\" hidden><p>You have accepted optional cookies. You can change your cookie settings on the <a href=\"/cookies\">Cookies page</a>.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"close\">Close this message</button></div></div><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--rejected\" tabindex=\"0\" hidden><p>You have rejected optional cookies. You can change your cookie settings on the <a href=\"/cookies\">Cookies page</a>.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"close\">Close this message</button></div></div></div></div>",
73
+ "hidden": false
74
+ },
75
+ {
76
+ "name": "with attributes",
77
+ "options": {
78
+ "cookiesUrl": "/cookies",
79
+ "attributes": {
80
+ "data-fixturetest": "pass"
81
+ }
82
+ },
83
+ "html": "<div class=\"tna-cookie-banner \" role=\"region\" aria-label=\"Cookie usage\" data-module=\"tna-cookie-banner\" data-policies=\"\" data-preferenceskey=\"cookie_preferences_set\" data-policies-key=\"\" data-domain=\"\" data-insecure=\"false\" data-fixturetest=\"pass\" hidden><div class=\"tna-container\"><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--prompt\"><h2 class=\"tna-heading-m\">This website uses cookies</h2><p>We use some essential cookies to make this service work.</p><p>We'd also like to use analytics cookies so we can understand how you use the service and make improvements.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"accept\">Accept cookies</button><button class=\"tna-button \" value=\"reject\">Reject cookies</button><a href=\"/cookies\" class=\"tna-button tna-button--plain\" role=\"button\">Set cookie preferences</a></div></div><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--accepted\" tabindex=\"0\" hidden><p>You have accepted optional cookies. You can change your cookie settings on the <a href=\"/cookies\">Cookies page</a>.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"close\">Close this message</button></div></div><div class=\"tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--rejected\" tabindex=\"0\" hidden><p>You have rejected optional cookies. You can change your cookie settings on the <a href=\"/cookies\">Cookies page</a>.</p><div class=\"tna-button-group\"><button class=\"tna-button \" value=\"close\">Close this message</button></div></div></div></div>",
84
+ "hidden": false
85
+ }
86
+ ]
4
87
  }
@@ -18,11 +18,17 @@
18
18
  "description": ""
19
19
  },
20
20
  {
21
- "name": "loadScriptsOnAccept",
21
+ "name": "cookiesDomain",
22
22
  "type": "string",
23
23
  "required": false,
24
24
  "description": ""
25
25
  },
26
+ {
27
+ "name": "allowInsecure",
28
+ "type": "boolean",
29
+ "required": false,
30
+ "description": ""
31
+ },
26
32
  {
27
33
  "name": "classes",
28
34
  "type": "string",
@@ -1,7 +1,7 @@
1
1
  {% from "nationalarchives/components/button/macro.njk" import tnaButton %}
2
2
 
3
3
  {%- set containerClasses = [params.classes] if params.classes else [] -%}
4
- <div class="tna-cookie-banner {{ containerClasses | join(' ') }}" role="region" aria-label="Cookie usage" data-module="tna-cookie-banner" data-policies="{{ params.policies if params.policies else 'usage,settings' }}" data-preferenceskey="{{ params.cookiesPreferencesSetKey if params.cookiesPreferencesSetKey else 'cookies_preferences_set' }}"{% if params.loadScriptsOnAccept %} data-acceptscripts="{{ params.loadScriptsOnAccept }}"{% endif %}{%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %} hidden>
4
+ <div class="tna-cookie-banner {{ containerClasses | join(' ') }}" role="region" aria-label="Cookie usage" data-module="tna-cookie-banner" data-policies="{{ params.policies if params.policies }}" data-preferenceskey="{{ params.preferencesSetKey if params.preferencesSetKey else 'cookie_preferences_set' }}" data-policies-key="{{ params.policiesKey if params.policiesKey }}" data-domain="{{ params.cookiesDomain if params.cookiesDomain }}" data-insecure="{{ true if params.allowInsecure else 'false' }}" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %} hidden>
5
5
  <div class="tna-container">
6
6
  <div class="tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--prompt">
7
7
  <h2 class="tna-heading-m">This website uses cookies</h2>
@@ -24,14 +24,14 @@
24
24
  }) }}
25
25
  {{ tnaButton({
26
26
  text: "Set cookie preferences",
27
- href: "#",
27
+ href: params.cookiesUrl,
28
28
  plain: true
29
29
  }) }}
30
30
  </div>
31
31
  </div>
32
32
  <div class="tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--accepted" tabindex="0" hidden>
33
33
  <p>
34
- You have accepted optional cookies. You can change your cookie settings on the <a href="#">Cookies page</a>.
34
+ You have accepted optional cookies. You can change your cookie settings on the <a href="{{ params.cookiesUrl }}">Cookies page</a>.
35
35
  </p>
36
36
  <div class="tna-button-group">
37
37
  {{ tnaButton({
@@ -45,7 +45,7 @@
45
45
  </div>
46
46
  <div class="tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--rejected" tabindex="0" hidden>
47
47
  <p>
48
- You have rejected optional cookies. You can change your cookie settings on the <a href="#">Cookies page</a>.
48
+ You have rejected optional cookies. You can change your cookie settings on the <a href="{{ params.cookiesUrl }}">Cookies page</a>.
49
49
  </p>
50
50
  <div class="tna-button-group">
51
51
  {{ tnaButton({
@@ -0,0 +1 @@
1
+ @use "featured-records";