@justeattakeaway/pie-cookie-banner 0.15.0 → 0.16.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/README.md CHANGED
@@ -75,7 +75,9 @@ import { PieCookieBanner } from '@justeattakeaway/pie-cookie-banner/dist/react';
75
75
  | Property | Type | Default | Description |
76
76
  |---|---|---|---|
77
77
  | hasPrimaryActionsOnly | `Boolean` | `false` | When true, sets the variant to "primary" for the button which accepts necessary cookies only. |
78
- | locale | `Object` | {English language locale} | Assigns the localisation data for the component strings |
78
+ | locale | `Object` | {English language locale} | Assigns the localisation data for the component strings. |
79
+ | cookieStatementLink | `String` | `''` | Allows a url to be passed for the cookie statement link. |
80
+ | cookieTechnologiesLink | `String` | `''` | Allows a url to be passed for the cookie technology link. |
79
81
 
80
82
  In your markup or JSX, you can then use these to set the properties for the `pie-cookie-banner` component:
81
83
 
@@ -147,6 +147,26 @@
147
147
  "default": "defaultLocale",
148
148
  "attribute": "locale"
149
149
  },
150
+ {
151
+ "kind": "field",
152
+ "name": "cookieStatementLink",
153
+ "type": {
154
+ "text": "string"
155
+ },
156
+ "privacy": "public",
157
+ "default": "''",
158
+ "attribute": "cookieStatementLink"
159
+ },
160
+ {
161
+ "kind": "field",
162
+ "name": "cookieTechnologiesLink",
163
+ "type": {
164
+ "text": "string"
165
+ },
166
+ "privacy": "public",
167
+ "default": "''",
168
+ "attribute": "cookieTechnologiesLink"
169
+ },
150
170
  {
151
171
  "kind": "field",
152
172
  "name": "_preferencesNodes",
@@ -161,7 +181,7 @@
161
181
  "text": "CustomTagEnhancers"
162
182
  },
163
183
  "privacy": "private",
164
- "default": "{\n linkStatement: (tagContent: string) => html`<pie-link href=\"${this._localiseText('banner.links.cookieStatement')}\" variant=\"inverse\" target=\"_blank\">${tagContent}</pie-link>`,\n linkNecessaryOnly: (tagContent: string) => html`<pie-link data-test-id=\"body-necessary-only\" tag=\"button\" variant=\"inverse\" @click=\"${this._onNecessaryOnly}\">${tagContent}</pie-link>`,\n linkManagePreferences: (tagContent: string) => html`<pie-link data-test-id=\"body-manage-prefs\" tag=\"button\" variant=\"inverse\" @click=\"${this._openManagePreferencesModal}\">${tagContent}</pie-link>`,\n linkAcceptAll: (tagContent: string) => html`<pie-link data-test-id=\"body-accept-all\" tag=\"button\" variant=\"inverse\" @click=\"${this._onAcceptAll}\">${tagContent}</pie-link>`,\n linkCookieStatement: (tagContent: string) => html`<pie-link href=\"${this._localiseText('banner.links.cookieStatement')}\" size=\"small\" target=\"_blank\">${tagContent}</pie-link>`,\n linkCookieTechList: (tagContent: string) => html`<pie-link href=\"${this._localiseText('banner.links.cookieTechnologies')}\" size=\"small\" target=\"_blank\">${tagContent}</pie-link>`,\n }"
184
+ "default": "{\n linkStatement: (tagContent: string) => html`<pie-link href=\"${this.cookieStatementLink}\" variant=\"inverse\" target=\"_blank\" data-test-id=\"cookie-statement-link\">${tagContent}</pie-link>`,\n linkNecessaryOnly: (tagContent: string) => html`<pie-link data-test-id=\"body-necessary-only\" tag=\"button\" variant=\"inverse\" @click=\"${this._onNecessaryOnly}\">${tagContent}</pie-link>`,\n linkManagePreferences: (tagContent: string) => html`<pie-link data-test-id=\"body-manage-prefs\" tag=\"button\" variant=\"inverse\" @click=\"${this._openManagePreferencesModal}\">${tagContent}</pie-link>`,\n linkAcceptAll: (tagContent: string) => html`<pie-link data-test-id=\"body-accept-all\" tag=\"button\" variant=\"inverse\" @click=\"${this._onAcceptAll}\">${tagContent}</pie-link>`,\n linkCookieStatement: (tagContent: string) => html`<pie-link href=\"${this.cookieStatementLink}\" size=\"small\" target=\"_blank\" data-test-id=\"cookie-statement-link\">${tagContent}</pie-link>`,\n linkCookieTechList: (tagContent: string) => html`<pie-link href=\"${this.cookieTechnologiesLink}\" size=\"small\" target=\"_blank\" data-test-id=\"cookie-technology-link\">${tagContent}</pie-link>`,\n }"
165
185
  },
166
186
  {
167
187
  "kind": "method",
@@ -345,6 +365,22 @@
345
365
  "module": "/locales/en-gb.json"
346
366
  },
347
367
  "fieldName": "locale"
368
+ },
369
+ {
370
+ "name": "cookieStatementLink",
371
+ "type": {
372
+ "text": "string"
373
+ },
374
+ "default": "''",
375
+ "fieldName": "cookieStatementLink"
376
+ },
377
+ {
378
+ "name": "cookieTechnologiesLink",
379
+ "type": {
380
+ "text": "string"
381
+ },
382
+ "default": "''",
383
+ "fieldName": "cookieTechnologiesLink"
348
384
  }
349
385
  ],
350
386
  "superclass": {
package/dist/index.d.ts CHANGED
@@ -53,6 +53,14 @@ export declare interface CookieBannerProps {
53
53
  * Assigns the data for localising the component strings
54
54
  */
55
55
  locale: CookieBannerLocale;
56
+ /**
57
+ * Allows consumers to pass in a specific cookie statement link.
58
+ */
59
+ cookieStatementLink: string;
60
+ /**
61
+ * Allows consumers to pass in a specific cookie technology link.
62
+ */
63
+ cookieTechnologiesLink: string;
56
64
  }
57
65
 
58
66
  export declare interface CustomTagEnhancers {
@@ -99,6 +107,8 @@ export declare class PieCookieBanner extends LitElement implements CookieBannerP
99
107
  private _isModalOpen;
100
108
  hasPrimaryActionsOnly: boolean;
101
109
  locale: CookieBannerLocale;
110
+ cookieStatementLink: string;
111
+ cookieTechnologiesLink: string;
102
112
  _preferencesNodes: NodeListOf<PieSwitch>;
103
113
  private _customTagEnhancers;
104
114
  private _localiseText;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { unsafeCSS as k, LitElement as m, html as s, nothing as h } from "lit";
2
- import { state as f, property as g, queryAll as v } from "lit/decorators.js";
1
+ import { unsafeCSS as b, LitElement as m, html as s, nothing as f } from "lit";
2
+ import { state as g, property as h, queryAll as v } from "lit/decorators.js";
3
3
  import { repeat as y } from "lit/directives/repeat.js";
4
4
  import "@justeattakeaway/pie-button";
5
5
  import "@justeattakeaway/pie-divider";
@@ -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 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 = [
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", 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,
@@ -34,22 +34,22 @@ const x = `*{margin:0}.c-cookieBanner{--cb-font-family: var(--dt-font-interactiv
34
34
  hasDescription: !0
35
35
  }
36
36
  ];
37
- function u(a) {
37
+ function k(a) {
38
38
  console.error(`[localisation-utils]: ${a}`);
39
39
  }
40
- function T(a, e) {
40
+ function O(a, e) {
41
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
- function b(a, e) {
44
+ function u(a, e) {
45
45
  if (!a)
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 = T(a, e);
50
- return n || (u(`Couldn't find a value for the key "${e}", it will be used as fallback.`), e);
49
+ const n = O(a, e);
50
+ return n || (k(`Couldn't find a value for the key "${e}", it will be used as fallback.`), e);
51
51
  }
52
- function O(a) {
52
+ function T(a) {
53
53
  const n = a.map((t) => `(<${t}.*>.*</${t}>)`).join("|");
54
54
  return new RegExp(n, "igm");
55
55
  }
@@ -57,20 +57,20 @@ function E(a, e) {
57
57
  const n = Object.keys(e);
58
58
  if (n.length === 0)
59
59
  return [a];
60
- const i = O(n);
60
+ const i = T(n);
61
61
  return a.split(i).filter((t) => !!t).map((t) => {
62
62
  if (!t.match(i))
63
63
  return t;
64
64
  const r = t.match(/<(.*)>(.*)<\/.*>/);
65
65
  if (!r)
66
66
  return t;
67
- const [, d, c] = r;
68
- return [d, c];
67
+ const [, p, l] = r;
68
+ return [p, l];
69
69
  }).map((t) => {
70
70
  if (!Array.isArray(t))
71
71
  return t;
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);
72
+ const [r, p] = t, l = e[r];
73
+ return l || typeof l == "function" ? l(p) : (k(`Custom tag "${r}" does not have a matching enhancer function`), p);
74
74
  });
75
75
  }
76
76
  function S(a, e, n) {
@@ -80,7 +80,7 @@ function S(a, e, n) {
80
80
  throw new Error('"key" parameter cannot be empty');
81
81
  if (!n)
82
82
  throw new Error('"customTagEnhancers" parameter cannot be empty');
83
- const i = b(a, e);
83
+ const i = u(a, e);
84
84
  return E(i, n);
85
85
  }
86
86
  const M = {
@@ -90,10 +90,6 @@ const M = {
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"
97
93
  }
98
94
  }, N = {
99
95
  title: "Manage your preferences",
@@ -127,21 +123,21 @@ const M = {
127
123
  banner: M,
128
124
  preferencesManagement: N
129
125
  };
130
- var P = Object.defineProperty, R = Object.getOwnPropertyDescriptor, p = (a, e, n, i) => {
131
- for (var t = i > 1 ? void 0 : i ? R(e, n) : e, o = a.length - 1, r; o >= 0; o--)
126
+ var P = Object.defineProperty, L = Object.getOwnPropertyDescriptor, d = (a, e, n, i) => {
127
+ for (var t = i > 1 ? void 0 : i ? L(e, n) : e, o = a.length - 1, r; o >= 0; o--)
132
128
  (r = a[o]) && (t = (i ? r(e, n, t) : r(t)) || t);
133
129
  return i && t && P(e, n, t), t;
134
130
  };
135
- const L = "pie-cookie-banner";
136
- class l extends m {
131
+ const R = "pie-cookie-banner";
132
+ class c extends m {
137
133
  constructor() {
138
- super(...arguments), this._isCookieBannerHidden = !1, this._isModalOpen = !1, this.hasPrimaryActionsOnly = !1, this.locale = z, this._customTagEnhancers = {
139
- linkStatement: (e) => s`<pie-link href="${this._localiseText("banner.links.cookieStatement")}" variant="inverse" target="_blank">${e}</pie-link>`,
134
+ super(...arguments), this._isCookieBannerHidden = !1, this._isModalOpen = !1, this.hasPrimaryActionsOnly = !1, this.locale = z, this.cookieStatementLink = "", this.cookieTechnologiesLink = "", this._customTagEnhancers = {
135
+ linkStatement: (e) => s`<pie-link href="${this.cookieStatementLink}" variant="inverse" target="_blank" data-test-id="cookie-statement-link">${e}</pie-link>`,
140
136
  linkNecessaryOnly: (e) => s`<pie-link data-test-id="body-necessary-only" tag="button" variant="inverse" @click="${this._onNecessaryOnly}">${e}</pie-link>`,
141
137
  linkManagePreferences: (e) => s`<pie-link data-test-id="body-manage-prefs" tag="button" variant="inverse" @click="${this._openManagePreferencesModal}">${e}</pie-link>`,
142
138
  linkAcceptAll: (e) => s`<pie-link data-test-id="body-accept-all" tag="button" variant="inverse" @click="${this._onAcceptAll}">${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>`
139
+ linkCookieStatement: (e) => s`<pie-link href="${this.cookieStatementLink}" size="small" target="_blank" data-test-id="cookie-statement-link">${e}</pie-link>`,
140
+ linkCookieTechList: (e) => s`<pie-link href="${this.cookieTechnologiesLink}" size="small" target="_blank" data-test-id="cookie-technology-link">${e}</pie-link>`
145
141
  }, this._dispatchCookieBannerCustomEvent = (e, n) => {
146
142
  const i = new CustomEvent(e, {
147
143
  bubbles: !0,
@@ -152,7 +148,7 @@ class l extends m {
152
148
  }, this._onNecessaryOnly = () => {
153
149
  this._dispatchCookieBannerCustomEvent(B), this._isCookieBannerHidden = !0;
154
150
  }, this._onAcceptAll = () => {
155
- this._dispatchCookieBannerCustomEvent(w), this._isCookieBannerHidden = !0;
151
+ this._dispatchCookieBannerCustomEvent(x), this._isCookieBannerHidden = !0;
156
152
  }, this._openManagePreferencesModal = () => {
157
153
  this._isCookieBannerHidden = !0, this._dispatchCookieBannerCustomEvent(C), this._isModalOpen = !0;
158
154
  }, this._handleSwitchStates = (e) => {
@@ -167,7 +163,7 @@ class l extends m {
167
163
  };
168
164
  }
169
165
  _localiseText(e) {
170
- return b(this.locale, e);
166
+ return u(this.locale, e);
171
167
  }
172
168
  _localiseRichText(e) {
173
169
  return S(this.locale, e, this._customTagEnhancers);
@@ -205,12 +201,12 @@ class l extends m {
205
201
  hasDivider: t,
206
202
  hasDescription: o
207
203
  }) {
208
- const r = this._localiseText(`preferencesManagement.${e}.title`), d = `preferencesManagement.${e}.description`, c = o && this._localiseText(d);
204
+ const r = this._localiseText(`preferencesManagement.${e}.title`), p = `preferencesManagement.${e}.description`, l = o && this._localiseText(p);
209
205
  return s`
210
206
  <div class="c-cookieBanner-preference">
211
207
  <div>
212
208
  <h3 class="c-cookieBanner-subheading">${r}</h3>
213
- ${c ? s`<p class="c-cookieBanner-description">${c}</p>` : h}
209
+ ${l ? s`<p class="c-cookieBanner-description">${l}</p>` : f}
214
210
  </div>
215
211
  <pie-switch
216
212
  id="${e}"
@@ -219,7 +215,7 @@ class l extends m {
219
215
  @change="${this._handleSwitchStates}">
220
216
  </pie-switch>
221
217
  </div>
222
- ${t ? s`<pie-divider></pie-divider>` : h}`;
218
+ ${t ? s`<pie-divider></pie-divider>` : f}`;
223
219
  }
224
220
  /**
225
221
  * Renders the modal content.
@@ -290,28 +286,34 @@ class l extends m {
290
286
  </aside>`;
291
287
  }
292
288
  }
293
- l.styles = k(x);
294
- p([
295
- f()
296
- ], l.prototype, "_isCookieBannerHidden", 2);
297
- p([
298
- f()
299
- ], l.prototype, "_isModalOpen", 2);
300
- p([
301
- g({ type: Boolean })
302
- ], l.prototype, "hasPrimaryActionsOnly", 2);
303
- p([
304
- g({ type: Object })
305
- ], l.prototype, "locale", 2);
306
- p([
289
+ c.styles = b(w);
290
+ d([
291
+ g()
292
+ ], c.prototype, "_isCookieBannerHidden", 2);
293
+ d([
294
+ g()
295
+ ], c.prototype, "_isModalOpen", 2);
296
+ d([
297
+ h({ type: Boolean })
298
+ ], c.prototype, "hasPrimaryActionsOnly", 2);
299
+ d([
300
+ h({ type: Object })
301
+ ], c.prototype, "locale", 2);
302
+ d([
303
+ h({ type: String })
304
+ ], c.prototype, "cookieStatementLink", 2);
305
+ d([
306
+ h({ type: String })
307
+ ], c.prototype, "cookieTechnologiesLink", 2);
308
+ d([
307
309
  v("pie-switch")
308
- ], l.prototype, "_preferencesNodes", 2);
309
- _(L, l);
310
+ ], c.prototype, "_preferencesNodes", 2);
311
+ _(R, c);
310
312
  export {
311
- w as ON_COOKIE_BANNER_ACCEPT_ALL,
313
+ x as ON_COOKIE_BANNER_ACCEPT_ALL,
312
314
  C as ON_COOKIE_BANNER_MANAGE_PREFS,
313
315
  B as ON_COOKIE_BANNER_NECESSARY_ONLY,
314
316
  $ as ON_COOKIE_BANNER_PREFS_SAVED,
315
- l as PieCookieBanner,
317
+ c as PieCookieBanner,
316
318
  A as preferences
317
319
  };
package/dist/react.d.ts CHANGED
@@ -54,6 +54,14 @@ export declare interface CookieBannerProps {
54
54
  * Assigns the data for localising the component strings
55
55
  */
56
56
  locale: CookieBannerLocale;
57
+ /**
58
+ * Allows consumers to pass in a specific cookie statement link.
59
+ */
60
+ cookieStatementLink: string;
61
+ /**
62
+ * Allows consumers to pass in a specific cookie technology link.
63
+ */
64
+ cookieTechnologiesLink: string;
57
65
  }
58
66
 
59
67
  export declare interface CustomTagEnhancers {
@@ -102,6 +110,8 @@ declare class PieCookieBanner_2 extends LitElement implements CookieBannerProps
102
110
  private _isModalOpen;
103
111
  hasPrimaryActionsOnly: boolean;
104
112
  locale: CookieBannerLocale;
113
+ cookieStatementLink: string;
114
+ cookieTechnologiesLink: string;
105
115
  _preferencesNodes: NodeListOf<PieSwitch>;
106
116
  private _customTagEnhancers;
107
117
  private _localiseText;
@@ -170,10 +180,10 @@ declare class PieCookieBanner_2 extends LitElement implements CookieBannerProps
170
180
  }
171
181
 
172
182
  declare type PieCookieBannerEvents = {
173
- onPieCookieBannerAcceptAll?: (event: CustomEvent<any>) => void;
174
- onPieCookieBannerNecessaryOnly?: (event: CustomEvent<any>) => void;
175
- onPieCookieBannerManagePrefs?: (event: CustomEvent<any>) => void;
176
- onPieCookieBannerPrefsSaved?: (event: CustomEvent<any>) => void;
183
+ onPieCookieBannerAcceptAll?: (event: CustomEvent) => void;
184
+ onPieCookieBannerNecessaryOnly?: (event: CustomEvent) => void;
185
+ onPieCookieBannerManagePrefs?: (event: CustomEvent) => void;
186
+ onPieCookieBannerPrefsSaved?: (event: CustomEvent) => void;
177
187
  };
178
188
 
179
189
  export declare interface Preference {
@@ -6,10 +6,6 @@
6
6
  "managePreferences": "Управление на предпочитанията",
7
7
  "necessaryOnly": "Само необходимите",
8
8
  "acceptAll": "Приемане на всички"
9
- },
10
- "links": {
11
- "cookieStatement": "bg/cookiestatement",
12
- "cookieTechnologies": "bg/technologies"
13
9
  }
14
10
  },
15
11
  "preferencesManagement": {
@@ -6,10 +6,6 @@
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"
13
9
  }
14
10
  },
15
11
  "preferencesManagement": {
@@ -6,10 +6,6 @@
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"
13
9
  }
14
10
  },
15
11
  "preferencesManagement": {
@@ -6,10 +6,6 @@
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"
13
9
  }
14
10
  },
15
11
  "preferencesManagement": {
@@ -6,10 +6,6 @@
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"
13
9
  }
14
10
  },
15
11
  "preferencesManagement": {
@@ -6,10 +6,6 @@
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"
13
9
  }
14
10
  },
15
11
  "preferencesManagement": {
@@ -6,10 +6,6 @@
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"
13
9
  }
14
10
  },
15
11
  "preferencesManagement": {
@@ -6,10 +6,6 @@
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"
13
9
  }
14
10
  },
15
11
  "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.15.0",
4
+ "version": "0.16.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -35,17 +35,17 @@
35
35
  "@custom-elements-manifest/analyzer": "0.9.0",
36
36
  "@justeat/pie-design-tokens": "5.9.0",
37
37
  "@justeattakeaway/pie-components-config": "0.9.0",
38
- "@justeattakeaway/pie-wrapper-react": "0.13.0",
38
+ "@justeattakeaway/pie-wrapper-react": "0.14.0",
39
39
  "cem-plugin-module-file-extensions": "0.0.5"
40
40
  },
41
41
  "dependencies": {
42
- "@justeattakeaway/pie-button": "0.45.0",
43
- "@justeattakeaway/pie-divider": "0.12.0",
44
- "@justeattakeaway/pie-icon-button": "0.27.0",
45
- "@justeattakeaway/pie-link": "0.14.0",
46
- "@justeattakeaway/pie-modal": "0.38.0",
47
- "@justeattakeaway/pie-switch": "0.24.0",
48
- "@justeattakeaway/pie-webc-core": "0.17.0"
42
+ "@justeattakeaway/pie-button": "0.45.2",
43
+ "@justeattakeaway/pie-divider": "0.12.1",
44
+ "@justeattakeaway/pie-icon-button": "0.27.2",
45
+ "@justeattakeaway/pie-link": "0.15.0",
46
+ "@justeattakeaway/pie-modal": "0.38.2",
47
+ "@justeattakeaway/pie-switch": "0.25.0",
48
+ "@justeattakeaway/pie-webc-core": "0.17.1"
49
49
  },
50
50
  "volta": {
51
51
  "extends": "../../../package.json"
package/src/defs.ts CHANGED
@@ -52,6 +52,16 @@ export interface CookieBannerProps {
52
52
  * Assigns the data for localising the component strings
53
53
  */
54
54
  locale: CookieBannerLocale;
55
+
56
+ /**
57
+ * Allows consumers to pass in a specific cookie statement link.
58
+ */
59
+ cookieStatementLink: string;
60
+
61
+ /**
62
+ * Allows consumers to pass in a specific cookie technology link.
63
+ */
64
+ cookieTechnologiesLink: string;
55
65
  }
56
66
 
57
67
  /**
package/src/index.ts CHANGED
@@ -57,16 +57,22 @@ export class PieCookieBanner extends LitElement implements CookieBannerProps {
57
57
  @property({ type: Object })
58
58
  public locale:CookieBannerLocale = defaultLocale;
59
59
 
60
+ @property({ type: String })
61
+ public cookieStatementLink = '';
62
+
63
+ @property({ type: String })
64
+ public cookieTechnologiesLink = '';
65
+
60
66
  @queryAll('pie-switch')
61
67
  _preferencesNodes!: NodeListOf<PieSwitch>;
62
68
 
63
69
  private _customTagEnhancers: CustomTagEnhancers = {
64
- linkStatement: (tagContent: string) => html`<pie-link href="${this._localiseText('banner.links.cookieStatement')}" variant="inverse" target="_blank">${tagContent}</pie-link>`,
70
+ linkStatement: (tagContent: string) => html`<pie-link href="${this.cookieStatementLink}" variant="inverse" target="_blank" data-test-id="cookie-statement-link">${tagContent}</pie-link>`,
65
71
  linkNecessaryOnly: (tagContent: string) => html`<pie-link data-test-id="body-necessary-only" tag="button" variant="inverse" @click="${this._onNecessaryOnly}">${tagContent}</pie-link>`,
66
72
  linkManagePreferences: (tagContent: string) => html`<pie-link data-test-id="body-manage-prefs" tag="button" variant="inverse" @click="${this._openManagePreferencesModal}">${tagContent}</pie-link>`,
67
73
  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>`,
74
+ linkCookieStatement: (tagContent: string) => html`<pie-link href="${this.cookieStatementLink}" size="small" target="_blank" data-test-id="cookie-statement-link">${tagContent}</pie-link>`,
75
+ linkCookieTechList: (tagContent: string) => html`<pie-link href="${this.cookieTechnologiesLink}" size="small" target="_blank" data-test-id="cookie-technology-link">${tagContent}</pie-link>`,
70
76
  };
71
77
 
72
78
  private _localiseText (key:string):string {
package/src/react.ts CHANGED
@@ -21,10 +21,11 @@ const PieCookieBannerReact = createComponent({
21
21
  type ReactBaseType = React.HTMLAttributes<HTMLElement>
22
22
 
23
23
  type PieCookieBannerEvents = {
24
- onPieCookieBannerAcceptAll?: (event: CustomEvent<any>) => void;
25
- onPieCookieBannerNecessaryOnly?: (event: CustomEvent<any>) => void;
26
- onPieCookieBannerManagePrefs?: (event: CustomEvent<any>) => void;
27
- onPieCookieBannerPrefsSaved?: (event: CustomEvent<any>) => void;
24
+ onPieCookieBannerAcceptAll?: (event: CustomEvent) => void;
25
+ onPieCookieBannerNecessaryOnly?: (event: CustomEvent) => void;
26
+ onPieCookieBannerManagePrefs?: (event: CustomEvent) => void;
27
+ onPieCookieBannerPrefsSaved?: (event: CustomEvent) => void;
28
28
  };
29
29
 
30
- export const PieCookieBanner = PieCookieBannerReact as React.ForwardRefExoticComponent<React.PropsWithoutRef<CookieBannerProps> & React.RefAttributes<PieCookieBannerLit> & PieCookieBannerEvents & ReactBaseType>;
30
+ export const PieCookieBanner = PieCookieBannerReact as React.ForwardRefExoticComponent<React.PropsWithoutRef<CookieBannerProps>
31
+ & React.RefAttributes<PieCookieBannerLit> & PieCookieBannerEvents & ReactBaseType>;