@justeattakeaway/pie-cookie-banner 1.9.1 → 1.10.1

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
@@ -40,7 +40,9 @@ Ideally, you should install the component using the **`@justeattakeaway/pie-webc
40
40
  | `country` | 2 character country code | Used to load the localisation data for the component strings. If not provided, the default country of `'gb'` will be used. Note this value is case-insensitive. | `"gb"` |
41
41
  | `language` | 2 character language code | Used to load the localisation data for the component strings. If not provided, the default language of the country will be used. Note this value is case-insensitive. | `"en"` |
42
42
  | `cookieStatementLink` | — | The URL of the cookie statement page the banner should link to. | `""` |
43
- | `cookieTechnologiesLink`| — | The URL for the cookie technology link. | `""` |
43
+ | `personalizedLabel` | — | An optional override for the personalised preference label in the "Manage preferences" modal. Supports plain text. When omitted or empty, the built-in locale string is used. | `""` |
44
+ | `personalizedDescription` | — | An optional override for the personalised preference description in the "Manage preferences" modal. Supports plain text or HTML `<a>` or `<pie-link>` tags (e.g. `<a href="...">Privacy Policy</a>`). The HTML is sanitised, so only the allowed link attributes are preserved and any others are stripped or normalised. When omitted or empty, the built-in locale string is used. | `""` |
45
+ | `cookieTechnologiesLink` | — | The URL for the cookie technology link. | `""` |
44
46
  | `defaultPreferences` | `all`, `necessary`, `functional`, `analytical`, `personalized` | Allows default preferences to be passed in by the consumer, for example `{ 'functional': true, 'personalized': true, 'analytical': true }`. | `{}` |
45
47
  | `openLinksInSameTab` | `true`, `false` | When true, external links (Cookie Statement, Cookie Technologies) will open in the same tab (`target="_self"`). When false, links open in a new browser tab (`target="_blank"`). | `false` |
46
48
 
@@ -58,6 +58,23 @@ export declare interface CookieBannerProps {
58
58
  * The URL of the cookie statement page the banner should link to.
59
59
  */
60
60
  cookieStatementLink: string;
61
+ /**
62
+ * An optional override for the personalised preference label rendered in the
63
+ * "Manage preferences" modal. When provided, this string replaces the locale-defined
64
+ * label for the personalised preference. Consumers can include plain text.
65
+ * When omitted or set to an empty string, the built-in locale string is used.
66
+ */
67
+ personalizedLabel?: string;
68
+ /**
69
+ * An optional override for the personalised preference description rendered in the
70
+ * "Manage preferences" modal. When provided, this string replaces the locale-defined
71
+ * description for the personalised preference. Consumers can include plain text,
72
+ * HTML anchor tags (e.g. `<a href="...">Privacy Policy</a>`), or `<pie-link>` tags
73
+ * to embed a privacy policy link. The HTML is sanitised, so only the allowed link
74
+ * attributes are preserved and any others are stripped or normalised. When omitted or
75
+ * set to an empty string, the built-in locale string is used.
76
+ */
77
+ personalizedDescription?: string;
61
78
  /**
62
79
  * The URL for the cookie technology link.
63
80
  */
@@ -150,6 +167,8 @@ export declare class PieCookieBanner extends PieElement implements CookieBannerP
150
167
  hasPrimaryActionsOnly: boolean;
151
168
  defaultPreferences: Partial<Record<PreferenceIds, boolean>>;
152
169
  cookieStatementLink: string;
170
+ personalizedLabel: string;
171
+ personalizedDescription: string;
153
172
  cookieTechnologiesLink: string;
154
173
  country: string;
155
174
  language: string;
@@ -174,6 +193,20 @@ export declare class PieCookieBanner extends PieElement implements CookieBannerP
174
193
  private _customTagEnhancers;
175
194
  private _localiseText;
176
195
  private _localiseRichText;
196
+ /**
197
+ * Renders a preference label.
198
+ * For the personalised preference, uses the consumer-supplied `personalizedLabel`
199
+ * prop when provided as plain text, and falls back to the built-in locale string otherwise.
200
+ */
201
+ private _renderPreferenceLabel;
202
+ /**
203
+ * Renders a preference description.
204
+ * For the personalised preference, uses the consumer-supplied `personalizedDescription`
205
+ * prop when provided (allowing consumers to embed their own privacy policy link using
206
+ * plain HTML `<a>` or `<pie-link>` tags), and falls back to the built-in locale string otherwise.
207
+ * All other preferences use the plain locale text with HTML sanitisation.
208
+ */
209
+ private _renderPreferenceDescription;
177
210
  /**
178
211
  * Handles closing the modal and re-displaying the cookie banner
179
212
  * and making the cookie banner visible