@justeattakeaway/pie-cookie-banner 1.8.2 → 1.9.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/cdn_dist/index.js +62 -49
- package/custom-elements.json +30 -0
- package/dist/index.js +905 -203
- package/package.json +11 -10
- package/src/index.ts +3 -2
- package/src/localisation-utils.ts +56 -0
package/custom-elements.json
CHANGED
|
@@ -530,6 +530,28 @@
|
|
|
530
530
|
],
|
|
531
531
|
"description": "Localises a plain text string\nIf the key is not found, it will be used as fallback"
|
|
532
532
|
},
|
|
533
|
+
{
|
|
534
|
+
"kind": "function",
|
|
535
|
+
"name": "sanitiseDescriptionHtml",
|
|
536
|
+
"return": {
|
|
537
|
+
"type": {
|
|
538
|
+
"text": "string"
|
|
539
|
+
}
|
|
540
|
+
},
|
|
541
|
+
"parameters": [
|
|
542
|
+
{
|
|
543
|
+
"name": "input",
|
|
544
|
+
"type": {
|
|
545
|
+
"text": "string"
|
|
546
|
+
}
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
"name": "linkTarget",
|
|
550
|
+
"default": "'_blank'"
|
|
551
|
+
}
|
|
552
|
+
],
|
|
553
|
+
"description": "Sanitises an HTML string to allow only safe <a> tags, and normalises anchor\nattributes to respect the component's link-target behaviour.\n\nUses DOMPurify for the core sanitisation:\n- Strips all non-<a> elements (keeping their text content).\n- Removes unsafe href protocols (javascript:, data:, vbscript:).\n- Removes non-allowlisted attributes (only href, rel, target survive).\n\nA post-sanitisation hook then enforces target/rel:\n- Sets target to linkTarget (overrides any existing target).\n- Ensures rel contains \"noopener noreferrer\" when target=\"_blank\"\n (prevents reverse-tabnabbing).\n\nIn SSR / non-browser environments (no `window`), all HTML is stripped and\nonly the text content is returned — the client will re-render with the full\nsanitisation pass after hydration."
|
|
554
|
+
},
|
|
533
555
|
{
|
|
534
556
|
"kind": "function",
|
|
535
557
|
"name": "localiseRichText",
|
|
@@ -573,6 +595,14 @@
|
|
|
573
595
|
"module": "src/localisation-utils.js"
|
|
574
596
|
}
|
|
575
597
|
},
|
|
598
|
+
{
|
|
599
|
+
"kind": "js",
|
|
600
|
+
"name": "sanitiseDescriptionHtml",
|
|
601
|
+
"declaration": {
|
|
602
|
+
"name": "sanitiseDescriptionHtml",
|
|
603
|
+
"module": "src/localisation-utils.js"
|
|
604
|
+
}
|
|
605
|
+
},
|
|
576
606
|
{
|
|
577
607
|
"kind": "js",
|
|
578
608
|
"name": "localiseRichText",
|