@justeattakeaway/pie-cookie-banner 0.26.6 → 0.26.7
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/custom-elements.json +0 -26
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1 -1
- package/dist/react.d.ts +4 -3
- package/package.json +1 -1
- package/src/defs-react.ts +2 -2
- package/src/defs.ts +1 -0
- package/src/index.ts +9 -11
- package/src/localisation-utils.ts +3 -8
- package/src/react.ts +1 -1
package/custom-elements.json
CHANGED
|
@@ -152,9 +152,6 @@
|
|
|
152
152
|
{
|
|
153
153
|
"kind": "field",
|
|
154
154
|
"name": "defaultPreferences",
|
|
155
|
-
"type": {
|
|
156
|
-
"text": "CookieBannerProps['defaultPreferences']"
|
|
157
|
-
},
|
|
158
155
|
"privacy": "public",
|
|
159
156
|
"attribute": "defaultPreferences"
|
|
160
157
|
},
|
|
@@ -199,11 +196,6 @@
|
|
|
199
196
|
"kind": "method",
|
|
200
197
|
"name": "_localiseText",
|
|
201
198
|
"privacy": "private",
|
|
202
|
-
"return": {
|
|
203
|
-
"type": {
|
|
204
|
-
"text": "string"
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
199
|
"parameters": [
|
|
208
200
|
{
|
|
209
201
|
"name": "key",
|
|
@@ -217,11 +209,6 @@
|
|
|
217
209
|
"kind": "method",
|
|
218
210
|
"name": "_localiseRichText",
|
|
219
211
|
"privacy": "private",
|
|
220
|
-
"return": {
|
|
221
|
-
"type": {
|
|
222
|
-
"text": "Array<string|TemplateResult>"
|
|
223
|
-
}
|
|
224
|
-
},
|
|
225
212
|
"parameters": [
|
|
226
213
|
{
|
|
227
214
|
"name": "key",
|
|
@@ -281,11 +268,6 @@
|
|
|
281
268
|
"kind": "method",
|
|
282
269
|
"name": "renderPreference",
|
|
283
270
|
"privacy": "private",
|
|
284
|
-
"return": {
|
|
285
|
-
"type": {
|
|
286
|
-
"text": "TemplateResult"
|
|
287
|
-
}
|
|
288
|
-
},
|
|
289
271
|
"parameters": [
|
|
290
272
|
{
|
|
291
273
|
"name": "{\n id, checked, disabled, hasDivider, hasDescription,\n }",
|
|
@@ -300,11 +282,6 @@
|
|
|
300
282
|
"kind": "method",
|
|
301
283
|
"name": "renderModalContent",
|
|
302
284
|
"privacy": "private",
|
|
303
|
-
"return": {
|
|
304
|
-
"type": {
|
|
305
|
-
"text": "TemplateResult"
|
|
306
|
-
}
|
|
307
|
-
},
|
|
308
285
|
"description": "Renders the modal content."
|
|
309
286
|
}
|
|
310
287
|
],
|
|
@@ -345,9 +322,6 @@
|
|
|
345
322
|
},
|
|
346
323
|
{
|
|
347
324
|
"name": "defaultPreferences",
|
|
348
|
-
"type": {
|
|
349
|
-
"text": "CookieBannerProps['defaultPreferences']"
|
|
350
|
-
},
|
|
351
325
|
"fieldName": "defaultPreferences"
|
|
352
326
|
},
|
|
353
327
|
{
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { ComponentDefaultProps } from '@justeattakeaway/pie-webc-core';
|
|
|
2
2
|
import type { CSSResult } from 'lit';
|
|
3
3
|
import type { LitElement } from 'lit';
|
|
4
4
|
import { PieSwitch } from '@justeattakeaway/pie-switch';
|
|
5
|
-
import { TemplateResult } from 'lit';
|
|
5
|
+
import type { TemplateResult } from 'lit-html';
|
|
6
|
+
import { TemplateResult as TemplateResult_2 } from 'lit';
|
|
6
7
|
|
|
7
8
|
export declare interface CookieBannerLocale {
|
|
8
9
|
banner: {
|
|
@@ -73,7 +74,7 @@ export declare interface CookieBannerProps {
|
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
export declare interface CustomTagEnhancers {
|
|
76
|
-
[key: string]: (tagContent: string) =>
|
|
77
|
+
[key: string]: (tagContent: string) => TemplateResult_2;
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
export declare type DefaultProps = ComponentDefaultProps<CookieBannerProps>;
|
|
@@ -119,7 +120,7 @@ export declare class PieCookieBanner extends LitElement implements CookieBannerP
|
|
|
119
120
|
private _isCookieBannerHidden;
|
|
120
121
|
private _isModalOpen;
|
|
121
122
|
hasPrimaryActionsOnly: boolean;
|
|
122
|
-
defaultPreferences:
|
|
123
|
+
defaultPreferences: Partial<Record<PreferenceIds, boolean>>;
|
|
123
124
|
locale: CookieBannerLocale;
|
|
124
125
|
cookieStatementLink: string;
|
|
125
126
|
cookieTechnologiesLink: string;
|
package/dist/index.js
CHANGED
|
@@ -268,7 +268,7 @@ const I = "pie-cookie-banner", k = class k extends $ {
|
|
|
268
268
|
@click="${this._openManagePreferencesModal}"
|
|
269
269
|
tag="button"
|
|
270
270
|
variant="inverse"
|
|
271
|
-
isBold
|
|
271
|
+
isBold>
|
|
272
272
|
${this._localiseText("banner.cta.managePreferences")}
|
|
273
273
|
</pie-link>
|
|
274
274
|
</div>
|
package/dist/react.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import type { CSSResult } from 'lit';
|
|
|
3
3
|
import type { LitElement } from 'lit';
|
|
4
4
|
import { PieSwitch } from '@justeattakeaway/pie-switch';
|
|
5
5
|
import * as React_2 from 'react';
|
|
6
|
-
import { TemplateResult } from 'lit';
|
|
6
|
+
import type { TemplateResult } from 'lit-html';
|
|
7
|
+
import { TemplateResult as TemplateResult_2 } from 'lit';
|
|
7
8
|
|
|
8
9
|
export declare interface CookieBannerLocale {
|
|
9
10
|
banner: {
|
|
@@ -74,7 +75,7 @@ export declare interface CookieBannerProps {
|
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
export declare interface CustomTagEnhancers {
|
|
77
|
-
[key: string]: (tagContent: string) =>
|
|
78
|
+
[key: string]: (tagContent: string) => TemplateResult_2;
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
export declare type DefaultProps = ComponentDefaultProps<CookieBannerProps>;
|
|
@@ -122,7 +123,7 @@ declare class PieCookieBanner_2 extends LitElement implements CookieBannerProps
|
|
|
122
123
|
private _isCookieBannerHidden;
|
|
123
124
|
private _isModalOpen;
|
|
124
125
|
hasPrimaryActionsOnly: boolean;
|
|
125
|
-
defaultPreferences:
|
|
126
|
+
defaultPreferences: Partial<Record<PreferenceIds, boolean>>;
|
|
126
127
|
locale: CookieBannerLocale;
|
|
127
128
|
cookieStatementLink: string;
|
|
128
129
|
cookieTechnologiesLink: string;
|
package/package.json
CHANGED
package/src/defs-react.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import type React from 'react';
|
|
2
2
|
|
|
3
|
-
export type ReactBaseType = React.HTMLAttributes<HTMLElement
|
|
3
|
+
export type ReactBaseType = React.HTMLAttributes<HTMLElement>;
|
package/src/defs.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
LitElement, html, unsafeCSS,
|
|
2
|
+
LitElement, html, unsafeCSS, nothing,
|
|
3
3
|
} from 'lit';
|
|
4
4
|
import { property, state, queryAll } from 'lit/decorators.js';
|
|
5
5
|
import { repeat } from 'lit/directives/repeat.js';
|
|
@@ -9,21 +9,19 @@ import '@justeattakeaway/pie-divider';
|
|
|
9
9
|
import '@justeattakeaway/pie-icon-button';
|
|
10
10
|
import '@justeattakeaway/pie-link';
|
|
11
11
|
import '@justeattakeaway/pie-modal';
|
|
12
|
-
/* eslint-disable import/no-duplicates */
|
|
13
12
|
import '@justeattakeaway/pie-switch';
|
|
14
|
-
import { PieSwitch } from '@justeattakeaway/pie-switch';
|
|
13
|
+
import { type PieSwitch } from '@justeattakeaway/pie-switch';
|
|
15
14
|
import { defineCustomElement, dispatchCustomEvent } from '@justeattakeaway/pie-webc-core';
|
|
16
|
-
/* eslint-enable import/no-duplicates */
|
|
17
15
|
|
|
18
16
|
import styles from './cookie-banner.scss?inline';
|
|
19
17
|
import {
|
|
20
|
-
CookieBannerProps,
|
|
21
18
|
ON_COOKIE_BANNER_ACCEPT_ALL,
|
|
22
19
|
ON_COOKIE_BANNER_NECESSARY_ONLY,
|
|
23
20
|
ON_COOKIE_BANNER_MANAGE_PREFS,
|
|
24
21
|
ON_COOKIE_BANNER_PREFS_SAVED,
|
|
25
22
|
defaultProps,
|
|
26
23
|
preferences,
|
|
24
|
+
type CookieBannerProps,
|
|
27
25
|
type Preference,
|
|
28
26
|
type PreferenceIds,
|
|
29
27
|
type CookieBannerLocale,
|
|
@@ -55,7 +53,7 @@ export class PieCookieBanner extends LitElement implements CookieBannerProps {
|
|
|
55
53
|
public hasPrimaryActionsOnly = defaultProps.hasPrimaryActionsOnly;
|
|
56
54
|
|
|
57
55
|
@property({ type: Object })
|
|
58
|
-
public defaultPreferences
|
|
56
|
+
public defaultPreferences = defaultProps.defaultPreferences;
|
|
59
57
|
|
|
60
58
|
@property({ type: Object })
|
|
61
59
|
public locale:CookieBannerLocale = defaultProps.locale;
|
|
@@ -78,11 +76,11 @@ export class PieCookieBanner extends LitElement implements CookieBannerProps {
|
|
|
78
76
|
linkCookieTechList: (tagContent: string) => html`<pie-link href="${this.cookieTechnologiesLink}" size="small" target="_blank" data-test-id="cookie-technology-link">${tagContent}</pie-link>`,
|
|
79
77
|
};
|
|
80
78
|
|
|
81
|
-
private _localiseText (key:string)
|
|
79
|
+
private _localiseText (key: string) {
|
|
82
80
|
return localiseText(this.locale, key);
|
|
83
81
|
}
|
|
84
82
|
|
|
85
|
-
private _localiseRichText (key:string)
|
|
83
|
+
private _localiseRichText (key: string) {
|
|
86
84
|
return localiseRichText(this.locale, key, this._customTagEnhancers);
|
|
87
85
|
}
|
|
88
86
|
|
|
@@ -173,7 +171,7 @@ export class PieCookieBanner extends LitElement implements CookieBannerProps {
|
|
|
173
171
|
*/
|
|
174
172
|
private renderPreference ({
|
|
175
173
|
id, checked, disabled, hasDivider, hasDescription,
|
|
176
|
-
}: Preference)
|
|
174
|
+
}: Preference) {
|
|
177
175
|
const title = this._localiseText(`preferencesManagement.${id}.title`);
|
|
178
176
|
const descriptionLocaleKey = `preferencesManagement.${id}.description`;
|
|
179
177
|
// Ensure not to display fallback text as description as its expected that some items might not have its own description
|
|
@@ -203,7 +201,7 @@ export class PieCookieBanner extends LitElement implements CookieBannerProps {
|
|
|
203
201
|
* Renders the modal content.
|
|
204
202
|
* @private
|
|
205
203
|
*/
|
|
206
|
-
private renderModalContent ()
|
|
204
|
+
private renderModalContent () {
|
|
207
205
|
return html`
|
|
208
206
|
<p class="c-cookieBanner-description" data-test-id="modal-description">
|
|
209
207
|
${this._localiseRichText('preferencesManagement.description')}
|
|
@@ -261,7 +259,7 @@ export class PieCookieBanner extends LitElement implements CookieBannerProps {
|
|
|
261
259
|
@click="${this._openManagePreferencesModal}"
|
|
262
260
|
tag="button"
|
|
263
261
|
variant="inverse"
|
|
264
|
-
isBold
|
|
262
|
+
isBold>
|
|
265
263
|
${this._localiseText('banner.cta.managePreferences')}
|
|
266
264
|
</pie-link>
|
|
267
265
|
</div>
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
} from '
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
type CookieBannerLocale,
|
|
7
|
-
type CustomTagEnhancers,
|
|
8
|
-
} from './defs';
|
|
1
|
+
import { type TemplateResult } from 'lit';
|
|
2
|
+
|
|
3
|
+
import { type CookieBannerLocale, type CustomTagEnhancers } from './defs';
|
|
9
4
|
|
|
10
5
|
function logError (message:string):void {
|
|
11
6
|
console.error(`[localisation-utils]: ${message}`);
|
package/src/react.ts
CHANGED
|
@@ -18,7 +18,7 @@ const PieCookieBannerReact = createComponent({
|
|
|
18
18
|
},
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
type ReactBaseType = React.HTMLAttributes<HTMLElement
|
|
21
|
+
type ReactBaseType = React.HTMLAttributes<HTMLElement>;
|
|
22
22
|
|
|
23
23
|
type PieCookieBannerEvents = {
|
|
24
24
|
onPieCookieBannerAcceptAll?: (event: CustomEvent) => void;
|