@nationalarchives/frontend 0.1.25-prerelease → 0.1.26-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 (190) hide show
  1. package/nationalarchives/all.css +2 -2
  2. package/nationalarchives/all.css.map +1 -1
  3. package/nationalarchives/all.js +1 -1
  4. package/nationalarchives/all.js.map +1 -1
  5. package/nationalarchives/all.mjs +0 -11
  6. package/nationalarchives/components/_index.scss +8 -0
  7. package/nationalarchives/components/breadcrumbs/breadcrumbs.css +1 -1
  8. package/nationalarchives/components/breadcrumbs/breadcrumbs.css.map +1 -1
  9. package/nationalarchives/components/breadcrumbs/breadcrumbs.js +1 -1
  10. package/nationalarchives/components/breadcrumbs/breadcrumbs.js.map +1 -1
  11. package/nationalarchives/components/breadcrumbs/breadcrumbs.mjs +1 -1
  12. package/nationalarchives/components/breadcrumbs/breadcrumbs.scss +1 -1
  13. package/nationalarchives/components/button/_button-group.scss +4 -0
  14. package/nationalarchives/components/button/button.css +1 -1
  15. package/nationalarchives/components/button/button.css.map +1 -1
  16. package/nationalarchives/components/button/button.scss +89 -26
  17. package/nationalarchives/components/button/button.stories.js +52 -5
  18. package/nationalarchives/components/button/macro-options.json +18 -0
  19. package/nationalarchives/components/button/template.njk +15 -6
  20. package/nationalarchives/components/card/card.css +1 -1
  21. package/nationalarchives/components/card/card.css.map +1 -1
  22. package/nationalarchives/components/card/card.scss +4 -38
  23. package/nationalarchives/components/card/fixtures.json +1 -1
  24. package/nationalarchives/components/card/template.njk +8 -6
  25. package/nationalarchives/components/checkboxes/_index.scss +1 -0
  26. package/nationalarchives/components/checkboxes/checkboxes.css +1 -0
  27. package/nationalarchives/components/checkboxes/checkboxes.css.map +1 -0
  28. package/nationalarchives/components/checkboxes/checkboxes.scss +143 -0
  29. package/nationalarchives/components/checkboxes/checkboxes.stories.js +238 -0
  30. package/nationalarchives/components/checkboxes/fixtures.json +4 -0
  31. package/nationalarchives/components/checkboxes/macro-options.json +102 -0
  32. package/nationalarchives/components/checkboxes/macro.njk +3 -0
  33. package/nationalarchives/components/checkboxes/template.njk +35 -0
  34. package/nationalarchives/components/cookie-banner/cookie-banner.css +1 -1
  35. package/nationalarchives/components/cookie-banner/cookie-banner.css.map +1 -1
  36. package/nationalarchives/components/cookie-banner/cookie-banner.js +1 -1
  37. package/nationalarchives/components/cookie-banner/cookie-banner.js.map +1 -1
  38. package/nationalarchives/components/cookie-banner/cookie-banner.mjs +2 -0
  39. package/nationalarchives/components/cookie-banner/cookie-banner.stories.js +11 -0
  40. package/nationalarchives/components/cookie-banner/fixtures.json +28 -9
  41. package/nationalarchives/components/cookie-banner/macro-options.json +12 -0
  42. package/nationalarchives/components/cookie-banner/template.njk +1 -1
  43. package/nationalarchives/components/date-input/_index.scss +1 -0
  44. package/nationalarchives/components/date-input/date-input.css +1 -0
  45. package/nationalarchives/components/date-input/date-input.css.map +1 -0
  46. package/nationalarchives/components/date-input/date-input.scss +48 -0
  47. package/nationalarchives/components/date-input/date-input.stories.js +116 -0
  48. package/nationalarchives/components/date-input/fixtures.json +4 -0
  49. package/nationalarchives/components/date-input/macro-options.json +96 -0
  50. package/nationalarchives/components/date-input/macro.njk +3 -0
  51. package/nationalarchives/components/date-input/template.njk +45 -0
  52. package/nationalarchives/components/date-search/_index.scss +1 -0
  53. package/nationalarchives/components/date-search/date-search.css +1 -0
  54. package/nationalarchives/components/date-search/date-search.css.map +1 -0
  55. package/nationalarchives/components/date-search/date-search.scss +27 -0
  56. package/nationalarchives/components/date-search/date-search.stories.js +121 -0
  57. package/nationalarchives/components/date-search/fixtures.json +4 -0
  58. package/nationalarchives/components/date-search/macro-options.json +94 -0
  59. package/nationalarchives/components/date-search/macro.njk +3 -0
  60. package/nationalarchives/components/date-search/template.njk +27 -0
  61. package/nationalarchives/components/featured-records/featured-records.css +1 -1
  62. package/nationalarchives/components/featured-records/featured-records.css.map +1 -1
  63. package/nationalarchives/components/filters/filters.css +1 -1
  64. package/nationalarchives/components/filters/filters.css.map +1 -1
  65. package/nationalarchives/components/filters/filters.scss +0 -8
  66. package/nationalarchives/components/filters/template.njk +1 -1
  67. package/nationalarchives/components/footer/footer.css +1 -1
  68. package/nationalarchives/components/footer/footer.css.map +1 -1
  69. package/nationalarchives/components/footer/footer.scss +3 -5
  70. package/nationalarchives/components/footer/template.njk +10 -6
  71. package/nationalarchives/components/gallery/gallery.css +1 -1
  72. package/nationalarchives/components/gallery/gallery.css.map +1 -1
  73. package/nationalarchives/components/gallery/gallery.scss +0 -11
  74. package/nationalarchives/components/gallery/gallery.stories.js +8 -10
  75. package/nationalarchives/components/gallery/template.njk +1 -1
  76. package/nationalarchives/components/grid/grid.css +1 -1
  77. package/nationalarchives/components/grid/grid.css.map +1 -1
  78. package/nationalarchives/components/header/header.css +1 -1
  79. package/nationalarchives/components/header/header.css.map +1 -1
  80. package/nationalarchives/components/header/header.scss +30 -29
  81. package/nationalarchives/components/header/header.stories.js +0 -41
  82. package/nationalarchives/components/header/template.njk +1 -1
  83. package/nationalarchives/components/hero/hero.css +1 -1
  84. package/nationalarchives/components/hero/hero.css.map +1 -1
  85. package/nationalarchives/components/hero/hero.scss +1 -5
  86. package/nationalarchives/components/index-grid/fixtures.json +324 -1
  87. package/nationalarchives/components/index-grid/index-grid.css +1 -1
  88. package/nationalarchives/components/index-grid/index-grid.css.map +1 -1
  89. package/nationalarchives/components/index-grid/index-grid.scss +13 -10
  90. package/nationalarchives/components/index-grid/index-grid.stories.js +24 -13
  91. package/nationalarchives/components/index-grid/macro-options.json +34 -29
  92. package/nationalarchives/components/index-grid/template.njk +13 -8
  93. package/nationalarchives/components/message/message.css +1 -1
  94. package/nationalarchives/components/message/message.css.map +1 -1
  95. package/nationalarchives/components/message/message.scss +1 -6
  96. package/nationalarchives/components/message/template.njk +1 -1
  97. package/nationalarchives/components/pagination/pagination.css +1 -1
  98. package/nationalarchives/components/pagination/pagination.css.map +1 -1
  99. package/nationalarchives/components/pagination/template.njk +32 -17
  100. package/nationalarchives/components/phase-banner/phase-banner.css +1 -1
  101. package/nationalarchives/components/phase-banner/phase-banner.css.map +1 -1
  102. package/nationalarchives/components/phase-banner/phase-banner.scss +2 -3
  103. package/nationalarchives/components/picture/picture.css +1 -1
  104. package/nationalarchives/components/picture/picture.css.map +1 -1
  105. package/nationalarchives/components/picture/picture.js.map +1 -1
  106. package/nationalarchives/components/picture/picture.mjs +0 -4
  107. package/nationalarchives/components/picture/picture.scss +1 -1
  108. package/nationalarchives/components/picture/template.njk +1 -1
  109. package/nationalarchives/components/radios/_index.scss +1 -0
  110. package/nationalarchives/components/radios/fixtures.json +4 -0
  111. package/nationalarchives/components/radios/macro-options.json +102 -0
  112. package/nationalarchives/components/radios/macro.njk +3 -0
  113. package/nationalarchives/components/radios/radios.css +1 -0
  114. package/nationalarchives/components/radios/radios.css.map +1 -0
  115. package/nationalarchives/components/radios/radios.scss +131 -0
  116. package/nationalarchives/components/radios/radios.stories.js +241 -0
  117. package/nationalarchives/components/radios/template.njk +35 -0
  118. package/nationalarchives/components/search-field/_index.scss +1 -0
  119. package/nationalarchives/components/search-field/fixtures.json +4 -0
  120. package/nationalarchives/components/search-field/macro-options.json +68 -0
  121. package/nationalarchives/components/search-field/macro.njk +3 -0
  122. package/nationalarchives/components/search-field/search-field.css +1 -0
  123. package/nationalarchives/components/search-field/search-field.css.map +1 -0
  124. package/nationalarchives/components/search-field/search-field.scss +32 -0
  125. package/nationalarchives/components/search-field/search-field.stories.js +88 -0
  126. package/nationalarchives/components/search-field/template.njk +32 -0
  127. package/nationalarchives/components/select/_index.scss +1 -0
  128. package/nationalarchives/components/select/fixtures.json +4 -0
  129. package/nationalarchives/components/select/macro-options.json +114 -0
  130. package/nationalarchives/components/select/macro.njk +3 -0
  131. package/nationalarchives/components/select/select.css +1 -0
  132. package/nationalarchives/components/select/select.css.map +1 -0
  133. package/nationalarchives/components/select/select.scss +51 -0
  134. package/nationalarchives/components/select/select.stories.js +194 -0
  135. package/nationalarchives/components/select/template.njk +29 -0
  136. package/nationalarchives/components/sensitive-image/sensitive-image.css +1 -1
  137. package/nationalarchives/components/sensitive-image/sensitive-image.css.map +1 -1
  138. package/nationalarchives/components/sensitive-image/template.njk +1 -1
  139. package/nationalarchives/components/skip-link/skip-link.css +1 -1
  140. package/nationalarchives/components/skip-link/skip-link.css.map +1 -1
  141. package/nationalarchives/components/skip-link/template.njk +1 -1
  142. package/nationalarchives/components/tabs/tabs.css +1 -1
  143. package/nationalarchives/components/tabs/tabs.css.map +1 -1
  144. package/nationalarchives/components/tabs/tabs.js +1 -1
  145. package/nationalarchives/components/tabs/tabs.js.map +1 -1
  146. package/nationalarchives/components/tabs/tabs.mjs +1 -1
  147. package/nationalarchives/components/tabs/tabs.scss +11 -1
  148. package/nationalarchives/components/tabs/template.njk +1 -1
  149. package/nationalarchives/components/text-input/_index.scss +1 -0
  150. package/nationalarchives/components/text-input/fixtures.json +4 -0
  151. package/nationalarchives/components/text-input/macro-options.json +118 -0
  152. package/nationalarchives/components/text-input/macro.njk +3 -0
  153. package/nationalarchives/components/text-input/template.njk +30 -0
  154. package/nationalarchives/components/text-input/text-input.css +1 -0
  155. package/nationalarchives/components/text-input/text-input.css.map +1 -0
  156. package/nationalarchives/components/text-input/text-input.scss +44 -0
  157. package/nationalarchives/components/text-input/text-input.stories.js +188 -0
  158. package/nationalarchives/components/textarea/_index.scss +1 -0
  159. package/nationalarchives/components/textarea/fixtures.json +4 -0
  160. package/nationalarchives/components/textarea/macro-options.json +106 -0
  161. package/nationalarchives/components/textarea/macro.njk +3 -0
  162. package/nationalarchives/components/textarea/template.njk +27 -0
  163. package/nationalarchives/components/textarea/textarea.css +1 -0
  164. package/nationalarchives/components/textarea/textarea.css.map +1 -0
  165. package/nationalarchives/components/textarea/textarea.scss +45 -0
  166. package/nationalarchives/components/textarea/textarea.stories.js +127 -0
  167. package/nationalarchives/lib/cookies.mjs +7 -1
  168. package/nationalarchives/prototype-kit.css +2 -2
  169. package/nationalarchives/prototype-kit.css.map +1 -1
  170. package/nationalarchives/prototype-kit.scss +0 -8
  171. package/nationalarchives/stories/utilities/colour-schemes/colour-schemes.stories.js +301 -31
  172. package/nationalarchives/stories/utilities/forms/forms.mdx +117 -0
  173. package/nationalarchives/stories/utilities/typography/typography.stories.js +0 -6
  174. package/nationalarchives/templates/layouts/_generic.njk +1 -1
  175. package/nationalarchives/tools/_colour.scss +48 -27
  176. package/nationalarchives/tools/_typography.scss +0 -1
  177. package/nationalarchives/utilities/_a11y.scss +6 -2
  178. package/nationalarchives/utilities/_colour.scss +10 -6
  179. package/nationalarchives/utilities/_debug.scss +3 -4
  180. package/nationalarchives/utilities/_forms.scss +93 -0
  181. package/nationalarchives/utilities/_index.scss +1 -0
  182. package/nationalarchives/utilities/_lists.scss +1 -1
  183. package/nationalarchives/utilities/_overrides.scss +1 -1
  184. package/nationalarchives/utilities/_typography.scss +66 -57
  185. package/nationalarchives/variables/_colour.scss +14 -10
  186. package/nationalarchives/variables/_forms.scss +2 -0
  187. package/nationalarchives/variables/_index.scss +1 -0
  188. package/nationalarchives/variables/_typography.scss +2 -2
  189. package/package.json +15 -15
  190. package/nationalarchives/stories/utilities/overrides/overrides.mdx +0 -53
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("TNAFrontend",[],t):"object"==typeof exports?exports.TNAFrontend=t():e.TNAFrontend=t()}(self,(()=>(()=>{"use strict";var e={774:(e,t,i)=>{function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function r(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,o)}return i}function n(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?r(Object(i),!0).forEach((function(t){u(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,o=new Array(t);i<t;i++)o[i]=e[i];return o}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var i=0;i<t.length;i++){var o=t[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,f(o.key),o)}}function l(e,t,i){return t&&a(e.prototype,t),i&&a(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e,t,i){return(t=f(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function f(e){var t=function(e,t){if("object"!==o(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,"string");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===o(t)?t:String(t)}i.d(t,{Z:()=>p});var h=function(){function e(){if(s(this,e),u(this,"events",{}),e._instance)return e._instance;e._instance=this}return l(e,[{key:"on",value:function(e,t){var i;Object.prototype.hasOwnProperty.call(this.events,e)||(this.events[e]=[]),this.events[e]=[].concat(function(e){if(Array.isArray(e))return c(e)}(i=this.events[e])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(i)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?c(e,t):void 0}}(i)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[t])}},{key:"trigger",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Object.prototype.hasOwnProperty.call(this.events,e)&&this.events[e].forEach((function(e){return e.call(t,i)}))}}]),e}(),p=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s(this,e),u(this,"extraPolicies",[]),u(this,"domain",""),u(this,"secure",!0),u(this,"policiesKey","");var o=i.domain,r=void 0===o?"":o,n=i.secure,c=void 0===n||n,a=i.policiesKey,l=void 0===a?"cookies_policy":a;this.extraPolicies=t,this.domain=r,this.secure=c,this.policiesKey=l,this.events=new h,this.init()}return l(e,[{key:"init",value:function(){this.savePolicies(n(n(n({},Object.fromEntries(this.extraPolicies.map((function(e){return[e.toLowerCase(),!1]})))),{},{usage:!1,settings:!1},this.policies),{},{essential:!0}))}},{key:"all",get:function(){var e={};return document.cookie.split("; ").filter((function(e){return e})).forEach((function(t){var i=t.trim().split("=");i[0]&&(e[i[0]]=i[1])})),e}},{key:"policies",get:function(){try{return JSON.parse(this.get(this.policiesKey)||"{}")}catch(e){return{}}}},{key:"exists",value:function(e){return Object.prototype.hasOwnProperty.call(this.all,e)}},{key:"hasValue",value:function(e,t){return this.get(e)==t}},{key:"get",value:function(e){return this.exists(e)?decodeURIComponent(this.all[e]):null}},{key:"set",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.maxAge,r=void 0===o?31536e3:o,n=i.path,c=void 0===n?"/":n,s=i.sameSite,a=void 0===s?"Lax":s,l=i.domain,u=void 0===l?this.domain:l,f=i.secure,h=void 0===f?this.secure:f;if(e){var p="".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(t),";").concat(u?" domain=".concat(u,"; "):""," samesite=").concat(a,"; path=").concat(c,"; max-age=").concat(r).concat(h?"; secure":"");document.cookie=p,this.events.trigger("setCookie",{key:e,value:t,maxAge:r,path:c,sameSite:a,domain:u,secure:h,cookie:p})}}},{key:"delete",value:function(e){var t={maxAge:-1,path:arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",domain:(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)||void 0};this.set(e,"",t),this.events.trigger("deleteCookie",n({key:e},t))}},{key:"deleteAll",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Object.keys(this.all).forEach((function(o){e.delete(o,t,i)})),this.events.trigger("deleteAllCookies",{path:t,domain:i})}},{key:"acceptPolicy",value:function(e){this.setPolicy(e,!0),this.events.trigger("acceptPolicy",e),this.events.trigger("changePolicy",u({},e,!0))}},{key:"rejectPolicy",value:function(e){this.setPolicy(e,!1),this.events.trigger("rejectPolicy",e),this.events.trigger("changePolicy",u({},e,!1))}},{key:"setPolicy",value:function(e,t){var i;"essential"!==e&&(this.savePolicies(n(n({},this.policies),{},(u(i={},e,t),u(i,"essential",!0),i))),this.events.trigger("changePolicy",u({},e,t)))}},{key:"acceptAllPolicies",value:function(){var e=Object.fromEntries(Object.keys(this.policies).map((function(e){return[e.toLowerCase(),!0]})));this.savePolicies(e),this.events.trigger("acceptAllPolicies"),this.events.trigger("changePolicy",e)}},{key:"rejectAllPolicies",value:function(){var e=n(n({},Object.fromEntries(Object.keys(this.policies).map((function(e){return[e.toLowerCase(),!1]})))),{},{essential:!0});this.savePolicies(e),this.events.trigger("rejectAllPolicies"),this.events.trigger("changePolicy",e)}},{key:"savePolicies",value:function(e){this.set(this.policiesKey,JSON.stringify(e))}},{key:"isPolicyAccepted",value:function(e){return Object.prototype.hasOwnProperty.call(this.policies,e)?!0===this.policies[e]:null}},{key:"on",value:function(e,t){this.events.on(e,t)}}]),e}()}},t={};function i(o){var r=t[o];if(void 0!==r)return r.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,i),n.exports}i.d=(e,t)=>{for(var o in t)i.o(t,o)&&!i.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{i.r(o),i.d(o,{CookieBanner:()=>n});var e=i(774);function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,i){for(var o=0;o<i.length;o++){var r=i[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,n=function(e,i){if("object"!==t(e)||null===e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var r=o.call(e,"string");if("object"!==t(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===t(n)?n:String(n)),r)}var n}var n=function(){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.$module=e,this.$acceptButton=e&&e.querySelector('[value="accept"]'),this.$rejectButton=e&&e.querySelector('[value="reject"]'),this.$prompt=e&&e.querySelector(".tna-cookie-banner__message--prompt"),this.$acceptedMessage=e&&e.querySelector(".tna-cookie-banner__message--accepted"),this.$rejectedMessage=e&&e.querySelector(".tna-cookie-banner__message--rejected"),this.$closeButtons=e&&e.querySelectorAll('[value="close"]')}var i,o;return i=t,(o=[{key:"init",value:function(){var t,i=this;if(this.$module&&this.$acceptButton&&this.$rejectButton&&this.$prompt&&this.$acceptedMessage&&this.$rejectedMessage&&this.$closeButtons){var o=this.$module.getAttribute("data-policies")||"",r=this.$module.getAttribute("data-domain")||void 0,n=this.$module.getAttribute("data-secure")||void 0,c=this.$module.getAttribute("data-policies-key")||void 0;this.cookies=new((null===(t=window.TNAFrontend)||void 0===t?void 0:t.Cookies)||e.Z)(o.split(",").filter((function(e){return e})).map((function(e){return e.trim()})),{domain:r,secure:n,policiesKey:c}),this.cookiePreferencesSet=this.$module.getAttribute("data-preferenceskey")||"cookie_preferences_set",this.cookies.hasValue(this.cookiePreferencesSet,"true")||(this.$module.removeAttribute("hidden"),this.$acceptButton.addEventListener("click",(function(){return i.accept()})),this.$rejectButton.addEventListener("click",(function(){return i.reject()})))}}},{key:"accept",value:function(){this.$prompt.setAttribute("hidden",!0),this.complete(),this.$acceptedMessage.removeAttribute("hidden"),this.$acceptedMessage.focus(),this.$acceptedMessage.setAttribute("tabindex","-1"),this.cookies.acceptAllPolicies()}},{key:"reject",value:function(){this.$prompt.setAttribute("hidden",!0),this.complete(),this.$rejectedMessage.removeAttribute("hidden"),this.$rejectedMessage.focus(),this.$rejectedMessage.setAttribute("tabindex","-1"),this.cookies.rejectAllPolicies()}},{key:"complete",value:function(){var e=this;this.cookies.set(this.cookiePreferencesSet,!0),this.$closeButtons.forEach((function(t){t.addEventListener("click",(function(){return e.close()}))}))}},{key:"close",value:function(){this.$module.setAttribute("hidden",!0)}}])&&r(i.prototype,o),Object.defineProperty(i,"prototype",{writable:!1}),t}()})(),o})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("TNAFrontend",[],t):"object"==typeof exports?exports.TNAFrontend=t():e.TNAFrontend=t()}(self,(()=>(()=>{"use strict";var e={774:(e,t,i)=>{function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function r(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,o)}return i}function n(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?r(Object(i),!0).forEach((function(t){u(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,o=new Array(t);i<t;i++)o[i]=e[i];return o}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var i=0;i<t.length;i++){var o=t[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,h(o.key),o)}}function l(e,t,i){return t&&a(e.prototype,t),i&&a(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e,t,i){return(t=h(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function h(e){var t=function(e,t){if("object"!==o(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,"string");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===o(t)?t:String(t)}i.d(t,{Z:()=>p});var f=function(){function e(){if(s(this,e),u(this,"events",{}),e._instance)return e._instance;e._instance=this}return l(e,[{key:"on",value:function(e,t){var i;Object.prototype.hasOwnProperty.call(this.events,e)||(this.events[e]=[]),this.events[e]=[].concat(function(e){if(Array.isArray(e))return c(e)}(i=this.events[e])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(i)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?c(e,t):void 0}}(i)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[t])}},{key:"trigger",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Object.prototype.hasOwnProperty.call(this.events,e)&&this.events[e].forEach((function(e){return e.call(t,i)}))}}]),e}(),p=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s(this,e),u(this,"extraPolicies",[]),u(this,"domain",""),u(this,"path",""),u(this,"secure",!0),u(this,"policiesKey","");var o=i.domain,r=void 0===o?"":o,n=i.path,c=void 0===n?"/":n,a=i.secure,l=void 0===a||a,h=i.policiesKey,p=void 0===h?"cookies_policy":h;this.extraPolicies=t,this.domain=r,this.path=c,this.secure=l,this.policiesKey=p,this.events=new f,this.init()}return l(e,[{key:"init",value:function(){this.savePolicies(n(n(n({},Object.fromEntries(this.extraPolicies.map((function(e){return[e.toLowerCase(),!1]})))),{},{usage:!1,settings:!1},this.policies),{},{essential:!0}))}},{key:"all",get:function(){var e={};return document.cookie.split("; ").filter((function(e){return e})).forEach((function(t){var i=t.trim().split("=");i[0]&&(e[i[0]]=i[1])})),e}},{key:"policies",get:function(){try{return JSON.parse(this.get(this.policiesKey)||"{}")}catch(e){return{}}}},{key:"exists",value:function(e){return Object.prototype.hasOwnProperty.call(this.all,e)}},{key:"hasValue",value:function(e,t){return this.get(e)==t}},{key:"get",value:function(e){return this.exists(e)?decodeURIComponent(this.all[e]):null}},{key:"set",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.maxAge,r=void 0===o?31536e3:o,n=i.sameSite,c=void 0===n?"Lax":n,s=i.domain,a=void 0===s?this.domain:s,l=i.path,u=void 0===l?this.path:l,h=i.secure,f=void 0===h?this.secure:h;if(e){var p="".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(t),";").concat(a?" domain=".concat(a,"; "):""," samesite=").concat(c,"; path=").concat(u,"; max-age=").concat(r).concat(f?"; secure":"");document.cookie=p,this.events.trigger("setCookie",{key:e,value:t,maxAge:r,path:u,sameSite:c,domain:a,secure:f,cookie:p})}}},{key:"delete",value:function(e){var t={maxAge:-1,path:arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",domain:(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)||void 0};this.set(e,"",t),this.events.trigger("deleteCookie",n({key:e},t))}},{key:"deleteAll",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Object.keys(this.all).forEach((function(o){e.delete(o,t,i)})),this.events.trigger("deleteAllCookies",{path:t,domain:i})}},{key:"acceptPolicy",value:function(e){this.setPolicy(e,!0),this.events.trigger("acceptPolicy",e),this.events.trigger("changePolicy",u({},e,!0))}},{key:"rejectPolicy",value:function(e){this.setPolicy(e,!1),this.events.trigger("rejectPolicy",e),this.events.trigger("changePolicy",u({},e,!1))}},{key:"setPolicy",value:function(e,t){"essential"!==e&&(this.savePolicies(n(n({},this.policies),{},u(u({},e,t),"essential",!0))),this.events.trigger("changePolicy",u({},e,t)))}},{key:"acceptAllPolicies",value:function(){var e=Object.fromEntries(Object.keys(this.policies).map((function(e){return[e.toLowerCase(),!0]})));this.savePolicies(e),this.events.trigger("acceptAllPolicies"),this.events.trigger("changePolicy",e)}},{key:"rejectAllPolicies",value:function(){var e=n(n({},Object.fromEntries(Object.keys(this.policies).map((function(e){return[e.toLowerCase(),!1]})))),{},{essential:!0});this.savePolicies(e),this.events.trigger("rejectAllPolicies"),this.events.trigger("changePolicy",e)}},{key:"savePolicies",value:function(e){this.set(this.policiesKey,JSON.stringify(e))}},{key:"isPolicyAccepted",value:function(e){return Object.prototype.hasOwnProperty.call(this.policies,e)?!0===this.policies[e]:null}},{key:"on",value:function(e,t){this.events.on(e,t)}}]),e}()}},t={};function i(o){var r=t[o];if(void 0!==r)return r.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,i),n.exports}i.d=(e,t)=>{for(var o in t)i.o(t,o)&&!i.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{i.r(o),i.d(o,{CookieBanner:()=>n});var e=i(774);function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,i){for(var o=0;o<i.length;o++){var r=i[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,n=function(e,i){if("object"!==t(e)||null===e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var r=o.call(e,"string");if("object"!==t(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===t(n)?n:String(n)),r)}var n}var n=function(){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.$module=e,this.$acceptButton=e&&e.querySelector('[value="accept"]'),this.$rejectButton=e&&e.querySelector('[value="reject"]'),this.$prompt=e&&e.querySelector(".tna-cookie-banner__message--prompt"),this.$acceptedMessage=e&&e.querySelector(".tna-cookie-banner__message--accepted"),this.$rejectedMessage=e&&e.querySelector(".tna-cookie-banner__message--rejected"),this.$closeButtons=e&&e.querySelectorAll('[value="close"]')}var i,o;return i=t,(o=[{key:"init",value:function(){var t,i=this;if(this.$module&&this.$acceptButton&&this.$rejectButton&&this.$prompt&&this.$acceptedMessage&&this.$rejectedMessage&&this.$closeButtons){var o=this.$module.getAttribute("data-policies")||"",r=this.$module.getAttribute("data-domain")||void 0,n=this.$module.getAttribute("data-path")||void 0,c=this.$module.getAttribute("data-secure")||void 0,s=this.$module.getAttribute("data-policies-key")||void 0;this.cookies=new((null===(t=window.TNAFrontend)||void 0===t?void 0:t.Cookies)||e.Z)(o.split(",").filter((function(e){return e})).map((function(e){return e.trim()})),{domain:r,path:n,secure:c,policiesKey:s}),this.cookiePreferencesSet=this.$module.getAttribute("data-preferenceskey")||"cookie_preferences_set",this.cookies.hasValue(this.cookiePreferencesSet,"true")||(this.$module.removeAttribute("hidden"),this.$acceptButton.addEventListener("click",(function(){return i.accept()})),this.$rejectButton.addEventListener("click",(function(){return i.reject()})))}}},{key:"accept",value:function(){this.$prompt.setAttribute("hidden",!0),this.complete(),this.$acceptedMessage.removeAttribute("hidden"),this.$acceptedMessage.focus(),this.$acceptedMessage.setAttribute("tabindex","-1"),this.cookies.acceptAllPolicies()}},{key:"reject",value:function(){this.$prompt.setAttribute("hidden",!0),this.complete(),this.$rejectedMessage.removeAttribute("hidden"),this.$rejectedMessage.focus(),this.$rejectedMessage.setAttribute("tabindex","-1"),this.cookies.rejectAllPolicies()}},{key:"complete",value:function(){var e=this;this.cookies.set(this.cookiePreferencesSet,!0),this.$closeButtons.forEach((function(t){t.addEventListener("click",(function(){return e.close()}))}))}},{key:"close",value:function(){this.$module.setAttribute("hidden",!0)}}])&&r(i.prototype,o),Object.defineProperty(i,"prototype",{writable:!1}),t}()})(),o})()));
2
2
  //# sourceMappingURL=cookie-banner.js.map
@@ -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,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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C9G,KAAK+G,WACL/G,KAAK+F,iBAAiBW,gBAAgB,UACtC1G,KAAK+F,iBAAiBiB,QACtBhH,KAAK+F,iBAAiBe,aAAa,WAAY,MAC/C9G,KAAKqG,QAAQY,mBACf,GAAC,CAAA/G,IAAA,SAAAC,MAED,WACEH,KAAK8F,QAAQgB,aAAa,UAAU,GACpC9G,KAAK+G,WACL/G,KAAKgG,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":""}
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,OAAON,K,gkBAAM,CAAEC,GAC/C,GAEA,CAAAH,IAA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IAAA,SAAAC,MAED,WACEH,KAAK8F,QAAQgB,aAAa,UAAU,GACpC9G,KAAK+G,WACL/G,KAAKgG,iBAAiBU,gBAAgB,UACtC1G,KAAKgG,iBAAiBgB,QACtBhH,KAAKgG,iBAAiBc,aAAa,WAAY,MAC/C9G,KAAKqG,QAAQa,mBACf,GAAC,CAAAhH,IAAA,WAAAC,MAED,WAAW,IAAA+D,EAAA,KACTlE,KAAKqG,QAAQpC,IAAIjE,KAAKwG,sBAAsB,GAC5CxG,KAAKiG,cAAchF,SAAQ,SAACkG,GAC1BA,EAAaR,iBAAiB,SAAS,kBAAMzC,EAAKkD,OAAO,GAC3D,GACF,GAAC,CAAAlH,IAAA,QAAAC,MAED,WACEH,KAAK0F,QAAQoB,aAAa,UAAU,EACtC,M,oEAACrB,CAAA,CA1FsB,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 path = \"\";\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.path=\"\"] - 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 path = \"/\",\n secure = true,\n policiesKey = \"cookies_policy\",\n } = options;\n this.extraPolicies = extraPolicies;\n this.domain = domain;\n this.path = path;\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.path=this.path] - The path 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 sameSite = \"Lax\",\n domain = this.domain,\n path = this.path,\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 path = this.$module.getAttribute(\"data-path\") || 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 path,\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$path","path","_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$sameSite","sameSite","_options$domain2","_options$path2","_options$secure2","encodeURIComponent","trigger","set","_this2","keys","policy","setPolicy","accepted","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":""}
@@ -29,6 +29,7 @@ export class CookieBanner {
29
29
 
30
30
  const policies = this.$module.getAttribute("data-policies") || "";
31
31
  const domain = this.$module.getAttribute("data-domain") || undefined;
32
+ const path = this.$module.getAttribute("data-path") || undefined;
32
33
  const secure = this.$module.getAttribute("data-secure") || undefined;
33
34
  const policiesKey =
34
35
  this.$module.getAttribute("data-policies-key") || undefined;
@@ -40,6 +41,7 @@ export class CookieBanner {
40
41
  .map((policy) => policy.trim()),
41
42
  {
42
43
  domain,
44
+ path,
43
45
  secure,
44
46
  policiesKey,
45
47
  },
@@ -5,11 +5,13 @@ import { within, userEvent } from "@storybook/testing-library";
5
5
  import Cookies from "../../lib/cookies.mjs";
6
6
 
7
7
  const argTypes = {
8
+ serviceName: { control: "text" },
8
9
  cookiesUrl: { control: "text" },
9
10
  policies: { control: "text" },
10
11
  policiesKey: { control: "text" },
11
12
  preferencesSetKey: { control: "text" },
12
13
  cookiesDomain: { control: "text" },
14
+ cookiesPath: { control: "text" },
13
15
  allowInsecure: { control: "boolean" },
14
16
  classes: { control: "text" },
15
17
  attributes: { control: "object" },
@@ -27,22 +29,26 @@ export default {
27
29
  };
28
30
 
29
31
  const Template = ({
32
+ serviceName,
30
33
  cookiesUrl,
31
34
  policies,
32
35
  policiesKey,
33
36
  preferencesSetKey,
34
37
  cookiesDomain,
38
+ cookiesPath,
35
39
  allowInsecure,
36
40
  classes,
37
41
  attributes,
38
42
  }) =>
39
43
  CookieBanner({
40
44
  params: {
45
+ serviceName,
41
46
  cookiesUrl,
42
47
  policies,
43
48
  policiesKey,
44
49
  preferencesSetKey,
45
50
  cookiesDomain,
51
+ cookiesPath,
46
52
  allowInsecure,
47
53
  classes,
48
54
  attributes,
@@ -57,6 +63,7 @@ Standard.args = {
57
63
 
58
64
  export const Accept = Template.bind({});
59
65
  Accept.args = {
66
+ serviceName: "My service",
60
67
  cookiesUrl: "#",
61
68
  allowInsecure: true,
62
69
  classes: "tna-cookie-banner--demo",
@@ -97,6 +104,7 @@ Accept.play = async ({ canvasElement }) => {
97
104
 
98
105
  export const Reject = Template.bind({});
99
106
  Reject.args = {
107
+ serviceName: "My service",
100
108
  cookiesUrl: "#",
101
109
  classes: "tna-cookie-banner--demo",
102
110
  };
@@ -132,6 +140,7 @@ Reject.play = async ({ canvasElement }) => {
132
140
 
133
141
  export const CustomPolicies = Template.bind({});
134
142
  CustomPolicies.args = {
143
+ serviceName: "My service",
135
144
  cookiesUrl: "#",
136
145
  policies: "custom",
137
146
  classes: "tna-cookie-banner--demo",
@@ -166,6 +175,7 @@ CustomPolicies.play = async ({ args, canvasElement }) => {
166
175
 
167
176
  export const Existing = Template.bind({});
168
177
  Existing.args = {
178
+ serviceName: "My service",
169
179
  cookiesUrl: "#",
170
180
  allowInsecure: true,
171
181
  classes: "tna-cookie-banner--demo",
@@ -200,6 +210,7 @@ Existing.play = async ({ canvasElement }) => {
200
210
 
201
211
  // export const EventHandling = Template.bind({});
202
212
  // EventHandling.args = {
213
+ // serviceName: "My service",
203
214
  // cookiesUrl: "#",
204
215
  // policies: "custom",
205
216
  // classes: "tna-cookie-banner--demo",
@@ -4,83 +4,102 @@
4
4
  {
5
5
  "name": "minimal",
6
6
  "options": {
7
+ "serviceName": "My service",
7
8
  "cookiesUrl": "/cookies"
8
9
  },
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
+ "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-path=\"\" data-insecure=\"false\" role=\"region\" aria-label=\"Cookies on My service\" 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
11
  "hidden": false
11
12
  },
12
13
  {
13
14
  "name": "custom preferences set key",
14
15
  "options": {
16
+ "serviceName": "My service",
15
17
  "cookiesUrl": "/cookies",
16
18
  "cookiesPreferencesSetKey": "custom"
17
19
  },
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>",
20
+ "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-path=\"\" data-insecure=\"false\" role=\"region\" aria-label=\"Cookies on My service\" 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
21
  "hidden": false
20
22
  },
21
23
  {
22
24
  "name": "custom policies",
23
25
  "options": {
26
+ "serviceName": "My service",
24
27
  "cookiesUrl": "/cookies",
25
28
  "policies": "custom"
26
29
  },
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>",
30
+ "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-path=\"\" data-insecure=\"false\" role=\"region\" aria-label=\"Cookies on My service\" 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
31
  "hidden": false
29
32
  },
30
33
  {
31
34
  "name": "custom policies key",
32
35
  "options": {
36
+ "serviceName": "My service",
33
37
  "cookiesUrl": "/cookies",
34
38
  "policiesKey": "custom_key"
35
39
  },
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>",
40
+ "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-path=\"\" data-insecure=\"false\" role=\"region\" aria-label=\"Cookies on My service\" 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
41
  "hidden": false
38
42
  },
39
43
  {
40
44
  "name": "with domain",
41
45
  "options": {
46
+ "serviceName": "My service",
42
47
  "cookiesUrl": "/cookies",
43
48
  "cookiesDomain": "nationalarchives.gov.uk"
44
49
  },
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>",
50
+ "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-path=\"\" data-insecure=\"false\" role=\"region\" aria-label=\"Cookies on My service\" 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>",
51
+ "hidden": false
52
+ },
53
+ {
54
+ "name": "with path",
55
+ "options": {
56
+ "serviceName": "My service",
57
+ "cookiesUrl": "/cookies",
58
+ "cookiesPath": "/my-service"
59
+ },
60
+ "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-path=\"/my-service\" data-insecure=\"false\" role=\"region\" aria-label=\"Cookies on My service\" 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
61
  "hidden": false
47
62
  },
48
63
  {
49
64
  "name": "with preferences set key",
50
65
  "options": {
66
+ "serviceName": "My service",
51
67
  "cookiesUrl": "/cookies",
52
68
  "preferencesSetKey": "custom_preferences_set_key"
53
69
  },
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>",
70
+ "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-path=\"\" data-insecure=\"false\" role=\"region\" aria-label=\"Cookies on My service\" 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
71
  "hidden": false
56
72
  },
57
73
  {
58
74
  "name": "insecure",
59
75
  "options": {
76
+ "serviceName": "My service",
60
77
  "cookiesUrl": "/cookies",
61
78
  "allowInsecure": true
62
79
  },
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>",
80
+ "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-path=\"\" data-insecure=\"true\" role=\"region\" aria-label=\"Cookies on My service\" 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
81
  "hidden": false
65
82
  },
66
83
  {
67
84
  "name": "with classes",
68
85
  "options": {
86
+ "serviceName": "My service",
69
87
  "cookiesUrl": "/cookies",
70
88
  "classes": "tna-cookie-banner--fixture"
71
89
  },
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>",
90
+ "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-path=\"\" data-insecure=\"false\" role=\"region\" aria-label=\"Cookies on My service\" 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
91
  "hidden": false
74
92
  },
75
93
  {
76
94
  "name": "with attributes",
77
95
  "options": {
96
+ "serviceName": "My service",
78
97
  "cookiesUrl": "/cookies",
79
98
  "attributes": {
80
99
  "data-fixturetest": "pass"
81
100
  }
82
101
  },
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>",
102
+ "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-path=\"\" data-insecure=\"false\" role=\"region\" aria-label=\"Cookies on My service\" 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
103
  "hidden": false
85
104
  }
86
105
  ]
@@ -1,4 +1,10 @@
1
1
  [
2
+ {
3
+ "name": "serviceName",
4
+ "type": "string",
5
+ "required": true,
6
+ "description": ""
7
+ },
2
8
  {
3
9
  "name": "cookiesUrl",
4
10
  "type": "string",
@@ -23,6 +29,12 @@
23
29
  "required": false,
24
30
  "description": ""
25
31
  },
32
+ {
33
+ "name": "cookiesPath",
34
+ "type": "string",
35
+ "required": false,
36
+ "description": ""
37
+ },
26
38
  {
27
39
  "name": "allowInsecure",
28
40
  "type": "boolean",
@@ -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 }}" 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>
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-path="{{ params.cookiesPath if params.cookiesPath }}" data-insecure="{{ true if params.allowInsecure else 'false' }}" role="region" aria-label="Cookies on {{ params.serviceName }}" {%- 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>
@@ -0,0 +1 @@
1
+ @use "date-input";