@justeattakeaway/pie-cookie-banner 0.11.13 → 0.13.0

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.
package/dist/index.d.ts CHANGED
@@ -110,7 +110,7 @@ export declare class PieCookieBanner extends LitElement implements CookieBannerP
110
110
  private _displayCookieBanner;
111
111
  /**
112
112
  * Handles saving the user cookie preferences, closing the modal and the cookie banner
113
- * Creates a state object for the save event, indicating the isChecked status
113
+ * Creates a state object for the save event, indicating the checked status
114
114
  * of each preference except for the `all` preference.
115
115
  * @example {
116
116
  * functional: false,
@@ -169,7 +169,7 @@ export declare class PieCookieBanner extends LitElement implements CookieBannerP
169
169
  export declare interface Preference {
170
170
  id: PreferenceIds;
171
171
  isDisabled?: boolean;
172
- isChecked?: boolean;
172
+ checked?: boolean;
173
173
  hasDivider?: boolean;
174
174
  hasDescription?: boolean;
175
175
  }
package/dist/index.js CHANGED
@@ -8,8 +8,8 @@ import "@justeattakeaway/pie-link";
8
8
  import "@justeattakeaway/pie-modal";
9
9
  import "@justeattakeaway/pie-switch";
10
10
  import { defineCustomElement as _ } from "@justeattakeaway/pie-webc-core";
11
- const w = `*{margin:0}.c-cookieBanner{--cb-font-family: var(--dt-font-interactive-m-family);--cb-font-size: calc(var(--dt-font-body-l-size) * 1px);--cb-line-height: calc(var(--dt-font-body-l-line-height) * 1px);--cb-font-weight: var(--dt-font-body-l-weight);--cb-padding-inline: var(--dt-spacing-d);--cb-padding-block: var(--dt-spacing-d);--cb-offset: 0;color-scheme:only dark;background-color:var(--dt-color-background-dark);color:var(--dt-color-content-inverse);font-family:var(--cb-font-family);font-size:var(--cb-font-size);line-height:var(--cb-line-height);font-weight:var(--cb-font-weight);padding-block-start:var(--cb-padding-block);padding-block-end:var(--cb-padding-block);max-height:432px;position:fixed;bottom:var(--cb-offset);left:var(--cb-offset);right:var(--cb-offset);border-top-left-radius:var(--dt-radius-rounded-c);border-top-right-radius:var(--dt-radius-rounded-c);z-index:var(--dt-z-index-cookie-banner)}@media (min-width: 700px) and (orientation: landscape){.c-cookieBanner{--cb-padding-inline: var(--dt-spacing-f);--cb-offset: var(--dt-spacing-d);max-height:90%;border-bottom-left-radius:var(--dt-radius-rounded-c);border-bottom-right-radius:var(--dt-radius-rounded-c)}}.c-cookieBanner[isCookieBannerHidden]{display:none}.c-cookieBanner-title,.c-cookieBanner-body,.c-cookieBanner-actions{padding-inline-start:var(--cb-padding-inline);padding-inline-end:var(--cb-padding-inline)}.c-cookieBanner-title{--cb-title-font-size: var(--dt-font-heading-s-size--narrow);--cb-title-line-height: var(--dt-font-heading-s-line-height--narrow);font-size:calc(var(--cb-title-font-size) * 1px);font-weight:var(--dt-font-heading-s-weight);line-height:calc(var(--cb-title-line-height) * 1px)}@media (min-width: 700px) and (orientation: landscape){.c-cookieBanner-title{--cb-title-font-size: var(--dt-font-heading-s-size--wide);--cb-title-line-height: var(--dt-font-heading-s-line-height--wide)}}.c-cookieBanner-body{--cb-scroll-shadow-color: var(--dt-color-black);margin-block-start:var(--dt-spacing-a);max-height:200px;overflow-y:auto;background:linear-gradient(to bottom,transparent,var(--dt-color-background-dark) 75%) center bottom,linear-gradient(transparent,var(--cb-scroll-shadow-color)) center bottom;background-repeat:no-repeat;background-size:100% 48px,100% 8px;background-attachment:local,scroll}@media (min-width: 700px) and (orientation: landscape){.c-cookieBanner-body{max-height:150px}}.c-cookieBanner-actions{--cb-actions-flex-dir: column;margin-block-start:var(--dt-spacing-d);display:flex;gap:var(--dt-spacing-d);flex-direction:var(--cb-actions-flex-dir)}.c-cookieBanner-actions>pie-link{text-align:center;align-self:center}@media (min-width: 700px) and (orientation: landscape){.c-cookieBanner-actions{--cb-actions-flex-dir: row-reverse;justify-content:flex-start;align-items:center}}.c-cookieBanner-subheading{--cb-subheading-font-size: var(--dt-font-heading-s-size--narrow);--cb-subheading-line-height: var(--dt-font-heading-s-line-height--narrow);font-size:calc(var(--cb-subheading-font-size) * 1px);font-weight:var(--dt-font-heading-s-weight);line-height:calc(var(--cb-subheading-line-height) * 1px)}@media (min-width: 700px) and (orientation: landscape){.c-cookieBanner-subheading{--cb-subheading-font-size: var(--dt-font-heading-s-size--wide);--cb-subheading-line-height: var(--dt-font-heading-s-line-height--wide)}}.c-cookieBanner-description{font-size:calc(var(--dt-font-body-s-size) * 1px);line-height:calc(var(--dt-font-body-s-line-height) * 1px)}.c-cookieBanner-preference{display:flex;gap:var(--dt-spacing-d);justify-content:space-between;margin-block:var(--dt-spacing-e)}.c-cookieBanner-preference p{margin-block-start:var(--dt-spacing-b)}.c-cookieBanner-preference:last-child{margin-block-end:0}
12
- `, x = "pie-cookie-banner-accept-all", C = "pie-cookie-banner-necessary-only", B = "pie-cookie-banner-manage-prefs", $ = "pie-cookie-banner-prefs-saved", A = [
11
+ const x = `*{margin:0}.c-cookieBanner{--cb-font-family: var(--dt-font-interactive-m-family);--cb-font-size: calc(var(--dt-font-body-l-size) * 1px);--cb-line-height: calc(var(--dt-font-body-l-line-height) * 1px);--cb-font-weight: var(--dt-font-body-l-weight);--cb-padding-inline: var(--dt-spacing-d);--cb-padding-block: var(--dt-spacing-d);--cb-offset: 0;color-scheme:only dark;background-color:var(--dt-color-background-dark);color:var(--dt-color-content-inverse);font-family:var(--cb-font-family);font-size:var(--cb-font-size);line-height:var(--cb-line-height);font-weight:var(--cb-font-weight);padding-block-start:var(--cb-padding-block);padding-block-end:var(--cb-padding-block);max-height:432px;position:fixed;bottom:var(--cb-offset);left:var(--cb-offset);right:var(--cb-offset);border-top-left-radius:var(--dt-radius-rounded-c);border-top-right-radius:var(--dt-radius-rounded-c);z-index:var(--dt-z-index-cookie-banner)}@media (min-width: 700px) and (orientation: landscape){.c-cookieBanner{--cb-padding-inline: var(--dt-spacing-f);--cb-offset: var(--dt-spacing-d);max-height:90%;border-bottom-left-radius:var(--dt-radius-rounded-c);border-bottom-right-radius:var(--dt-radius-rounded-c)}}.c-cookieBanner[isCookieBannerHidden]{display:none}.c-cookieBanner-title,.c-cookieBanner-body,.c-cookieBanner-actions{padding-inline-start:var(--cb-padding-inline);padding-inline-end:var(--cb-padding-inline)}.c-cookieBanner-title{--cb-title-font-size: var(--dt-font-heading-s-size--narrow);--cb-title-line-height: var(--dt-font-heading-s-line-height--narrow);font-size:calc(var(--cb-title-font-size) * 1px);font-weight:var(--dt-font-heading-s-weight);line-height:calc(var(--cb-title-line-height) * 1px)}@media (min-width: 700px) and (orientation: landscape){.c-cookieBanner-title{--cb-title-font-size: var(--dt-font-heading-s-size--wide);--cb-title-line-height: var(--dt-font-heading-s-line-height--wide)}}.c-cookieBanner-body{--cb-scroll-shadow-color: var(--dt-color-black);margin-block-start:var(--dt-spacing-a);max-height:200px;overflow-y:auto;background:linear-gradient(to bottom,transparent,var(--dt-color-background-dark) 75%) center bottom,linear-gradient(transparent,var(--cb-scroll-shadow-color)) center bottom;background-repeat:no-repeat;background-size:100% 48px,100% 8px;background-attachment:local,scroll}@media (min-width: 700px) and (orientation: landscape){.c-cookieBanner-body{max-height:150px}}.c-cookieBanner-actions{--cb-actions-flex-dir: column;margin-block-start:var(--dt-spacing-d);display:flex;gap:var(--dt-spacing-d);flex-direction:var(--cb-actions-flex-dir)}.c-cookieBanner-actions>pie-link{text-align:center;align-self:center}@media (min-width: 700px) and (orientation: landscape){.c-cookieBanner-actions{--cb-actions-flex-dir: row-reverse;justify-content:flex-start;align-items:center}}.c-cookieBanner-subheading{--cb-subheading-font-size: var(--dt-font-heading-s-size--narrow);--cb-subheading-line-height: var(--dt-font-heading-s-line-height--narrow);font-size:calc(var(--cb-subheading-font-size) * 1px);font-weight:var(--dt-font-heading-s-weight);line-height:calc(var(--cb-subheading-line-height) * 1px)}@media (min-width: 700px) and (orientation: landscape){.c-cookieBanner-subheading{--cb-subheading-font-size: var(--dt-font-heading-s-size--wide);--cb-subheading-line-height: var(--dt-font-heading-s-line-height--wide)}}.c-cookieBanner-description{font-size:calc(var(--dt-font-body-s-size) * 1px);line-height:calc(var(--dt-font-body-s-line-height) * 1px)}.c-cookieBanner-preference{display:flex;gap:var(--dt-spacing-d);justify-content:space-between;margin-block:var(--dt-spacing-e)}.c-cookieBanner-preference p{margin-block-start:var(--dt-spacing-b)}.c-cookieBanner-preference:last-child{margin-block-end:0}
12
+ `, w = "pie-cookie-banner-accept-all", B = "pie-cookie-banner-necessary-only", C = "pie-cookie-banner-manage-prefs", $ = "pie-cookie-banner-prefs-saved", A = [
13
13
  {
14
14
  id: "all",
15
15
  hasDivider: !0,
@@ -18,7 +18,7 @@ const w = `*{margin:0}.c-cookieBanner{--cb-font-family: var(--dt-font-interactiv
18
18
  {
19
19
  id: "necessary",
20
20
  isDisabled: !0,
21
- isChecked: !0,
21
+ checked: !0,
22
22
  hasDescription: !0
23
23
  },
24
24
  {
@@ -37,8 +37,8 @@ const w = `*{margin:0}.c-cookieBanner{--cb-font-family: var(--dt-font-interactiv
37
37
  function u(a) {
38
38
  console.error(`[localisation-utils]: ${a}`);
39
39
  }
40
- function O(a, e) {
41
- const n = (t) => String.prototype.split.call(e, t).filter(Boolean).reduce((r, o) => r != null && typeof r == "object" ? r[o] : r, a), i = n(/[,[\]]+?/) || n(/[,[\].]+?/);
40
+ function T(a, e) {
41
+ const n = (t) => String.prototype.split.call(e, t).filter(Boolean).reduce((o, r) => o != null && typeof o == "object" ? o[r] : o, a), i = n(/[,[\]]+?/) || n(/[,[\].]+?/);
42
42
  return typeof i != "string" ? "" : i;
43
43
  }
44
44
  function b(a, e) {
@@ -46,34 +46,34 @@ function b(a, e) {
46
46
  throw new Error('"locale" parameter cannot be empty');
47
47
  if (!e)
48
48
  throw new Error('"key" parameter cannot be empty');
49
- const n = O(a, e);
49
+ const n = T(a, e);
50
50
  return n || (u(`Couldn't find a value for the key "${e}", it will be used as fallback.`), e);
51
51
  }
52
- function E(a) {
52
+ function O(a) {
53
53
  const n = a.map((t) => `(<${t}.*>.*</${t}>)`).join("|");
54
54
  return new RegExp(n, "igm");
55
55
  }
56
- function T(a, e) {
56
+ function E(a, e) {
57
57
  const n = Object.keys(e);
58
58
  if (n.length === 0)
59
59
  return [a];
60
- const i = E(n);
60
+ const i = O(n);
61
61
  return a.split(i).filter((t) => !!t).map((t) => {
62
62
  if (!t.match(i))
63
63
  return t;
64
- const o = t.match(/<(.*)>(.*)<\/.*>/);
65
- if (!o)
64
+ const r = t.match(/<(.*)>(.*)<\/.*>/);
65
+ if (!r)
66
66
  return t;
67
- const [, d, c] = o;
67
+ const [, d, c] = r;
68
68
  return [d, c];
69
69
  }).map((t) => {
70
70
  if (!Array.isArray(t))
71
71
  return t;
72
- const [o, d] = t, c = e[o];
73
- return c || typeof c == "function" ? c(d) : (u(`Custom tag "${o}" does not have a matching enhancer function`), d);
72
+ const [r, d] = t, c = e[r];
73
+ return c || typeof c == "function" ? c(d) : (u(`Custom tag "${r}" does not have a matching enhancer function`), d);
74
74
  });
75
75
  }
76
- function M(a, e, n) {
76
+ function S(a, e, n) {
77
77
  if (!a)
78
78
  throw new Error('"locale" parameter cannot be empty');
79
79
  if (!e)
@@ -81,17 +81,21 @@ function M(a, e, n) {
81
81
  if (!n)
82
82
  throw new Error('"customTagEnhancers" parameter cannot be empty');
83
83
  const i = b(a, e);
84
- return T(i, n);
84
+ return E(i, n);
85
85
  }
86
- const N = {
86
+ const M = {
87
87
  title: "Cookies",
88
88
  description: "We use our own and third party cookies and other tech to enhance and personalise your user experience, optimize analytics, and show ads with third parties (read our <linkStatement>Statement</linkStatement>). Necessary cookies are always set. Click <linkNecessaryOnly>Necessary only</linkNecessaryOnly> to continue without accepting more. Click <linkManagePreferences>Manage preferences</linkManagePreferences> to share your preferences or <linkAcceptAll>Accept all</linkAcceptAll>.",
89
89
  cta: {
90
90
  managePreferences: "Manage preferences",
91
91
  necessaryOnly: "Necessary only",
92
92
  acceptAll: "Accept all"
93
+ },
94
+ links: {
95
+ cookieStatement: "en/cookiestatement",
96
+ cookieTechnologies: "en/technologies"
93
97
  }
94
- }, S = {
98
+ }, N = {
95
99
  title: "Manage your preferences",
96
100
  description: "You can find all the information in the <linkCookieStatement>Cookie Statement</linkCookieStatement> and <linkCookieTechList>Cookie technology list</linkCookieTechList>.",
97
101
  all: {
@@ -120,24 +124,24 @@ const N = {
120
124
  }
121
125
  }
122
126
  }, z = {
123
- banner: N,
124
- preferencesManagement: S
127
+ banner: M,
128
+ preferencesManagement: N
125
129
  };
126
130
  var P = Object.defineProperty, R = Object.getOwnPropertyDescriptor, p = (a, e, n, i) => {
127
- for (var t = i > 1 ? void 0 : i ? R(e, n) : e, r = a.length - 1, o; r >= 0; r--)
128
- (o = a[r]) && (t = (i ? o(e, n, t) : o(t)) || t);
131
+ for (var t = i > 1 ? void 0 : i ? R(e, n) : e, o = a.length - 1, r; o >= 0; o--)
132
+ (r = a[o]) && (t = (i ? r(e, n, t) : r(t)) || t);
129
133
  return i && t && P(e, n, t), t;
130
134
  };
131
135
  const D = "pie-cookie-banner";
132
136
  class l extends m {
133
137
  constructor() {
134
138
  super(...arguments), this._isCookieBannerHidden = !1, this._isModalOpen = !1, this.hasPrimaryActionsOnly = !1, this.locale = z, this._customTagEnhancers = {
135
- linkStatement: (e) => s`<pie-link variant="inverse">${e}</pie-link>`,
139
+ linkStatement: (e) => s`<pie-link href="${this._localiseText("banner.links.cookieStatement")}" variant="inverse" target="_blank">${e}</pie-link>`,
136
140
  linkNecessaryOnly: (e) => s`<pie-link data-test-id="body-necessary-only" tag="button" variant="inverse" @click="${this._onNecessaryOnly}">${e}</pie-link>`,
137
141
  linkManagePreferences: (e) => s`<pie-link data-test-id="body-manage-prefs" tag="button" variant="inverse" @click="${this._openManagePreferencesModal}">${e}</pie-link>`,
138
142
  linkAcceptAll: (e) => s`<pie-link data-test-id="body-accept-all" tag="button" variant="inverse" @click="${this._onAcceptAll}">${e}</pie-link>`,
139
- linkCookieStatement: (e) => s`<pie-link href="#" size="small" target="_blank">${e}</pie-link>`,
140
- linkCookieTechList: (e) => s`<pie-link href="#" size="small" target="_blank">${e}</pie-link>`
143
+ linkCookieStatement: (e) => s`<pie-link href="${this._localiseText("banner.links.cookieStatement")}" size="small" target="_blank">${e}</pie-link>`,
144
+ linkCookieTechList: (e) => s`<pie-link href="${this._localiseText("banner.links.cookieTechnologies")}" size="small" target="_blank">${e}</pie-link>`
141
145
  }, this._dispatchCookieBannerCustomEvent = (e, n) => {
142
146
  const i = new CustomEvent(e, {
143
147
  bubbles: !0,
@@ -146,27 +150,27 @@ class l extends m {
146
150
  });
147
151
  this.dispatchEvent(i);
148
152
  }, this._onNecessaryOnly = () => {
149
- this._dispatchCookieBannerCustomEvent(C), this._isCookieBannerHidden = !0;
153
+ this._dispatchCookieBannerCustomEvent(B), this._isCookieBannerHidden = !0;
150
154
  }, this._onAcceptAll = () => {
151
- this._dispatchCookieBannerCustomEvent(x), this._isCookieBannerHidden = !0;
155
+ this._dispatchCookieBannerCustomEvent(w), this._isCookieBannerHidden = !0;
152
156
  }, this._openManagePreferencesModal = () => {
153
- this._isCookieBannerHidden = !0, this._dispatchCookieBannerCustomEvent(B), this._isModalOpen = !0;
157
+ this._isCookieBannerHidden = !0, this._dispatchCookieBannerCustomEvent(C), this._isModalOpen = !0;
154
158
  }, this._handleSwitchStates = (e) => {
155
159
  const { id: n } = e == null ? void 0 : e.currentTarget, i = [...this._preferencesNodes].find(({ id: t }) => t === "all");
156
160
  if (n === i.id) {
157
- const t = e.target.checked;
158
- this._preferencesNodes.forEach((r) => {
159
- r.isChecked = r.isDisabled ? r.isChecked : t;
161
+ const { checked: t } = e.target;
162
+ this._preferencesNodes.forEach((o) => {
163
+ o.checked = o.isDisabled ? o.checked : t;
160
164
  });
161
165
  } else
162
- i.isChecked = [...this._preferencesNodes].filter(({ id: t }) => t !== "all").every(({ isChecked: t }) => t);
166
+ i.checked = [...this._preferencesNodes].filter(({ id: t }) => t !== "all").every(({ checked: t }) => t);
163
167
  };
164
168
  }
165
169
  _localiseText(e) {
166
170
  return b(this.locale, e);
167
171
  }
168
172
  _localiseRichText(e) {
169
- return M(this.locale, e, this._customTagEnhancers);
173
+ return S(this.locale, e, this._customTagEnhancers);
170
174
  }
171
175
  /**
172
176
  * Handles closing the modal and re-displaying the cookie banner
@@ -177,7 +181,7 @@ class l extends m {
177
181
  }
178
182
  /**
179
183
  * Handles saving the user cookie preferences, closing the modal and the cookie banner
180
- * Creates a state object for the save event, indicating the isChecked status
184
+ * Creates a state object for the save event, indicating the checked status
181
185
  * of each preference except for the `all` preference.
182
186
  * @example {
183
187
  * functional: false,
@@ -186,7 +190,7 @@ class l extends m {
186
190
  */
187
191
  _handlePreferencesSaved() {
188
192
  let e = {};
189
- [...this._preferencesNodes].filter(({ id: n }) => n !== "all").forEach(({ id: n, isChecked: i }) => {
193
+ [...this._preferencesNodes].filter(({ id: n }) => n !== "all").forEach(({ id: n, checked: i }) => {
190
194
  e = { ...e, [n]: i };
191
195
  }), this._dispatchCookieBannerCustomEvent($, e), this._isModalOpen = !1, this._isCookieBannerHidden = !0;
192
196
  }
@@ -196,21 +200,21 @@ class l extends m {
196
200
  */
197
201
  renderPreference({
198
202
  id: e,
199
- isChecked: n,
203
+ checked: n,
200
204
  isDisabled: i,
201
205
  hasDivider: t,
202
- hasDescription: r
206
+ hasDescription: o
203
207
  }) {
204
- const o = this._localiseText(`preferencesManagement.${e}.title`), d = `preferencesManagement.${e}.description`, c = r && this._localiseText(d);
208
+ const r = this._localiseText(`preferencesManagement.${e}.title`), d = `preferencesManagement.${e}.description`, c = o && this._localiseText(d);
205
209
  return s`
206
210
  <div class="c-cookieBanner-preference">
207
211
  <div>
208
- <h3 class="c-cookieBanner-subheading">${o}</h3>
212
+ <h3 class="c-cookieBanner-subheading">${r}</h3>
209
213
  ${c ? s`<p class="c-cookieBanner-description">${c}</p>` : h}
210
214
  </div>
211
215
  <pie-switch
212
216
  id="${e}"
213
- ?isChecked="${n}"
217
+ ?checked="${n}"
214
218
  ?isDisabled="${i}"
215
219
  @change="${this._handleSwitchStates}">
216
220
  </pie-switch>
@@ -286,7 +290,7 @@ class l extends m {
286
290
  </aside>`;
287
291
  }
288
292
  }
289
- l.styles = k(w);
293
+ l.styles = k(x);
290
294
  p([
291
295
  f()
292
296
  ], l.prototype, "_isCookieBannerHidden", 2);
@@ -304,9 +308,9 @@ p([
304
308
  ], l.prototype, "_preferencesNodes", 2);
305
309
  _(D, l);
306
310
  export {
307
- x as ON_COOKIE_BANNER_ACCEPT_ALL,
308
- B as ON_COOKIE_BANNER_MANAGE_PREFS,
309
- C as ON_COOKIE_BANNER_NECESSARY_ONLY,
311
+ w as ON_COOKIE_BANNER_ACCEPT_ALL,
312
+ C as ON_COOKIE_BANNER_MANAGE_PREFS,
313
+ B as ON_COOKIE_BANNER_NECESSARY_ONLY,
310
314
  $ as ON_COOKIE_BANNER_PREFS_SAVED,
311
315
  l as PieCookieBanner,
312
316
  A as preferences
package/dist/react.d.ts CHANGED
@@ -119,7 +119,7 @@ declare class PieCookieBanner_2 extends LitElement implements CookieBannerProps
119
119
  private _displayCookieBanner;
120
120
  /**
121
121
  * Handles saving the user cookie preferences, closing the modal and the cookie banner
122
- * Creates a state object for the save event, indicating the isChecked status
122
+ * Creates a state object for the save event, indicating the checked status
123
123
  * of each preference except for the `all` preference.
124
124
  * @example {
125
125
  * functional: false,
@@ -178,7 +178,7 @@ declare class PieCookieBanner_2 extends LitElement implements CookieBannerProps
178
178
  export declare interface Preference {
179
179
  id: PreferenceIds;
180
180
  isDisabled?: boolean;
181
- isChecked?: boolean;
181
+ checked?: boolean;
182
182
  hasDivider?: boolean;
183
183
  hasDescription?: boolean;
184
184
  }
@@ -6,6 +6,10 @@
6
6
  "managePreferences": "Управление на предпочитанията",
7
7
  "necessaryOnly": "Само необходимите",
8
8
  "acceptAll": "Приемане на всички"
9
+ },
10
+ "links": {
11
+ "cookieStatement": "bg/cookiestatement",
12
+ "cookieTechnologies": "bg/technologies"
9
13
  }
10
14
  },
11
15
  "preferencesManagement": {
@@ -6,6 +6,10 @@
6
6
  "managePreferences": "Einstellungen verwalten",
7
7
  "necessaryOnly": "Nur notwendige",
8
8
  "acceptAll": "Alle annehmen"
9
+ },
10
+ "links": {
11
+ "cookieStatement": "de/cookiestatement",
12
+ "cookieTechnologies": "de/technologies"
9
13
  }
10
14
  },
11
15
  "preferencesManagement": {
@@ -6,6 +6,10 @@
6
6
  "managePreferences": "Administrer præferencer",
7
7
  "necessaryOnly": "Kun nødvendige",
8
8
  "acceptAll": "Accepter alle"
9
+ },
10
+ "links": {
11
+ "cookieStatement": "cookie-erklaering",
12
+ "cookieTechnologies": "teknologier"
9
13
  }
10
14
  },
11
15
  "preferencesManagement": {
@@ -6,6 +6,10 @@
6
6
  "managePreferences": "Manage preferences",
7
7
  "necessaryOnly": "Necessary only",
8
8
  "acceptAll": "Accept all"
9
+ },
10
+ "links": {
11
+ "cookieStatement": "en/cookiestatement",
12
+ "cookieTechnologies": "en/technologies"
9
13
  }
10
14
  },
11
15
  "preferencesManagement": {
@@ -6,6 +6,10 @@
6
6
  "managePreferences": "Gérer les préférences",
7
7
  "necessaryOnly": " Cookies essentiels uniquement",
8
8
  "acceptAll": "Tout accepter"
9
+ },
10
+ "links": {
11
+ "cookieStatement": "fr/cookiestatement",
12
+ "cookieTechnologies": "fr/technologies"
9
13
  }
10
14
  },
11
15
  "preferencesManagement": {
@@ -6,6 +6,10 @@
6
6
  "managePreferences": "Gestisci preferenze",
7
7
  "necessaryOnly": " Solo necessari",
8
8
  "acceptAll": "Accetta tutti"
9
+ },
10
+ "links": {
11
+ "cookieStatement": "it/cookiestatement",
12
+ "cookieTechnologies": "it/technologies"
9
13
  }
10
14
  },
11
15
  "preferencesManagement": {
@@ -6,6 +6,10 @@
6
6
  "managePreferences": "Beheer voorkeuren",
7
7
  "necessaryOnly": "Alleen noodzakelijk",
8
8
  "acceptAll": "Alles accepteren"
9
+ },
10
+ "links": {
11
+ "cookieStatement": "nl/cookieverklaring",
12
+ "cookieTechnologies": "nl/technologies"
9
13
  }
10
14
  },
11
15
  "preferencesManagement": {
@@ -6,6 +6,10 @@
6
6
  "managePreferences": "Zarządzaj ustawieniami",
7
7
  "necessaryOnly": "Tylko niezbędne",
8
8
  "acceptAll": "Zaakceptuj wszystkie"
9
+ },
10
+ "links": {
11
+ "cookieStatement": "pl/polityka-cookies",
12
+ "cookieTechnologies": "pl/technologies"
9
13
  }
10
14
  },
11
15
  "preferencesManagement": {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-cookie-banner",
3
3
  "description": "PIE Design System Cookie Banner built using Web Components",
4
- "version": "0.11.13",
4
+ "version": "0.13.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -30,7 +30,7 @@
30
30
  "license": "Apache-2.0",
31
31
  "devDependencies": {
32
32
  "@justeat/pie-design-tokens": "5.9.0",
33
- "@justeattakeaway/pie-components-config": "0.6.1"
33
+ "@justeattakeaway/pie-components-config": "0.7.0"
34
34
  },
35
35
  "dependencies": {
36
36
  "@justeattakeaway/pie-button": "0.41.0",
@@ -38,7 +38,7 @@
38
38
  "@justeattakeaway/pie-icon-button": "0.24.3",
39
39
  "@justeattakeaway/pie-link": "0.11.3",
40
40
  "@justeattakeaway/pie-modal": "0.35.5",
41
- "@justeattakeaway/pie-switch": "0.19.0",
41
+ "@justeattakeaway/pie-switch": "0.20.0",
42
42
  "@justeattakeaway/pie-webc-core": "0.13.0"
43
43
  },
44
44
  "volta": {
package/src/defs.ts CHANGED
@@ -87,7 +87,7 @@ export type PreferenceIds = 'all' | 'necessary' | 'functional' | 'analytical' |
87
87
  export interface Preference {
88
88
  id: PreferenceIds;
89
89
  isDisabled?: boolean;
90
- isChecked?: boolean;
90
+ checked?: boolean;
91
91
  hasDivider?: boolean;
92
92
  hasDescription?: boolean;
93
93
  }
@@ -101,7 +101,7 @@ export const preferences: Preference[] = [
101
101
  {
102
102
  id: 'necessary',
103
103
  isDisabled: true,
104
- isChecked: true,
104
+ checked: true,
105
105
  hasDescription: true,
106
106
  },
107
107
  {
package/src/index.ts CHANGED
@@ -60,13 +60,13 @@ export class PieCookieBanner extends LitElement implements CookieBannerProps {
60
60
  @queryAll('pie-switch')
61
61
  _preferencesNodes!: NodeListOf<PieSwitch>;
62
62
 
63
- private _customTagEnhancers:CustomTagEnhancers = {
64
- linkStatement: (tagContent:string) => html`<pie-link variant="inverse">${tagContent}</pie-link>`,
65
- linkNecessaryOnly: (tagContent:string) => html`<pie-link data-test-id="body-necessary-only" tag="button" variant="inverse" @click="${this._onNecessaryOnly}">${tagContent}</pie-link>`,
66
- linkManagePreferences: (tagContent:string) => html`<pie-link data-test-id="body-manage-prefs" tag="button" variant="inverse" @click="${this._openManagePreferencesModal}">${tagContent}</pie-link>`,
67
- linkAcceptAll: (tagContent:string) => html`<pie-link data-test-id="body-accept-all" tag="button" variant="inverse" @click="${this._onAcceptAll}">${tagContent}</pie-link>`,
68
- linkCookieStatement: (tagContent:string) => html`<pie-link href="#" size="small" target="_blank">${tagContent}</pie-link>`,
69
- linkCookieTechList: (tagContent:string) => html`<pie-link href="#" size="small" target="_blank">${tagContent}</pie-link>`,
63
+ private _customTagEnhancers: CustomTagEnhancers = {
64
+ linkStatement: (tagContent: string) => html`<pie-link href="${this._localiseText('banner.links.cookieStatement')}" variant="inverse" target="_blank">${tagContent}</pie-link>`,
65
+ linkNecessaryOnly: (tagContent: string) => html`<pie-link data-test-id="body-necessary-only" tag="button" variant="inverse" @click="${this._onNecessaryOnly}">${tagContent}</pie-link>`,
66
+ linkManagePreferences: (tagContent: string) => html`<pie-link data-test-id="body-manage-prefs" tag="button" variant="inverse" @click="${this._openManagePreferencesModal}">${tagContent}</pie-link>`,
67
+ linkAcceptAll: (tagContent: string) => html`<pie-link data-test-id="body-accept-all" tag="button" variant="inverse" @click="${this._onAcceptAll}">${tagContent}</pie-link>`,
68
+ linkCookieStatement: (tagContent: string) => html`<pie-link href="${this._localiseText('banner.links.cookieStatement')}" size="small" target="_blank">${tagContent}</pie-link>`,
69
+ linkCookieTechList: (tagContent: string) => html`<pie-link href="${this._localiseText('banner.links.cookieTechnologies')}" size="small" target="_blank">${tagContent}</pie-link>`,
70
70
  };
71
71
 
72
72
  private _localiseText (key:string):string {
@@ -88,7 +88,7 @@ export class PieCookieBanner extends LitElement implements CookieBannerProps {
88
88
 
89
89
  /**
90
90
  * Handles saving the user cookie preferences, closing the modal and the cookie banner
91
- * Creates a state object for the save event, indicating the isChecked status
91
+ * Creates a state object for the save event, indicating the checked status
92
92
  * of each preference except for the `all` preference.
93
93
  * @example {
94
94
  * functional: false,
@@ -100,8 +100,8 @@ export class PieCookieBanner extends LitElement implements CookieBannerProps {
100
100
 
101
101
  [...this._preferencesNodes]
102
102
  .filter(({ id }) => id !== 'all')
103
- .forEach(({ id, isChecked }) => {
104
- state = { ...state, [id]: isChecked };
103
+ .forEach(({ id, checked }) => {
104
+ state = { ...state, [id]: checked };
105
105
  });
106
106
 
107
107
  this._dispatchCookieBannerCustomEvent(ON_COOKIE_BANNER_PREFS_SAVED, state);
@@ -169,14 +169,14 @@ export class PieCookieBanner extends LitElement implements CookieBannerProps {
169
169
  const toggleAllNode = [...this._preferencesNodes].find(({ id }) => id === 'all') as PieSwitch;
170
170
 
171
171
  if (id === toggleAllNode.id) {
172
- const isChecked = (e.target as HTMLInputElement).checked;
172
+ const { checked } = e.target as HTMLInputElement;
173
173
  this._preferencesNodes.forEach((node) => {
174
- node.isChecked = node.isDisabled ? node.isChecked : isChecked;
174
+ node.checked = node.isDisabled ? node.checked : checked;
175
175
  });
176
176
  } else {
177
- toggleAllNode.isChecked = [...this._preferencesNodes]
177
+ toggleAllNode.checked = [...this._preferencesNodes]
178
178
  .filter(({ id }) => id !== 'all')
179
- .every(({ isChecked }) => isChecked);
179
+ .every(({ checked }) => checked);
180
180
  }
181
181
  };
182
182
 
@@ -185,7 +185,7 @@ export class PieCookieBanner extends LitElement implements CookieBannerProps {
185
185
  * @private
186
186
  */
187
187
  private renderPreference ({
188
- id, isChecked, isDisabled, hasDivider, hasDescription,
188
+ id, checked, isDisabled, hasDivider, hasDescription,
189
189
  }: Preference): TemplateResult {
190
190
  const title = this._localiseText(`preferencesManagement.${id}.title`);
191
191
  const descriptionLocaleKey = `preferencesManagement.${id}.description`;
@@ -200,7 +200,7 @@ export class PieCookieBanner extends LitElement implements CookieBannerProps {
200
200
  </div>
201
201
  <pie-switch
202
202
  id="${id}"
203
- ?isChecked="${isChecked}"
203
+ ?checked="${checked}"
204
204
  ?isDisabled="${isDisabled}"
205
205
  @change="${this._handleSwitchStates}">
206
206
  </pie-switch>