@owlmeans/consent 0.1.18-rc.8 → 0.1.18

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.
Files changed (120) hide show
  1. package/README.md +229 -0
  2. package/build/consts.d.ts +84 -23
  3. package/build/consts.d.ts.map +1 -1
  4. package/build/consts.js +110 -29
  5. package/build/consts.js.map +1 -1
  6. package/build/consts.local.d.ts +12 -0
  7. package/build/consts.local.d.ts.map +1 -0
  8. package/build/consts.local.js +12 -0
  9. package/build/consts.local.js.map +1 -0
  10. package/build/geo/types.d.ts +47 -0
  11. package/build/geo/types.d.ts.map +1 -0
  12. package/build/geo/types.js +2 -0
  13. package/build/geo/types.js.map +1 -0
  14. package/build/geo.d.ts +4 -0
  15. package/build/geo.d.ts.map +1 -0
  16. package/build/geo.js +96 -0
  17. package/build/geo.js.map +1 -0
  18. package/build/gtobserver/types.d.ts +75 -0
  19. package/build/gtobserver/types.d.ts.map +1 -0
  20. package/build/gtobserver/types.js +2 -0
  21. package/build/gtobserver/types.js.map +1 -0
  22. package/build/gtobserver.d.ts +7 -0
  23. package/build/gtobserver.d.ts.map +1 -0
  24. package/build/gtobserver.js +142 -0
  25. package/build/gtobserver.js.map +1 -0
  26. package/build/i18n/be.json +9 -4
  27. package/build/i18n/de.json +9 -4
  28. package/build/i18n/en.json +9 -4
  29. package/build/i18n/es.json +9 -4
  30. package/build/i18n/fr.json +9 -4
  31. package/build/i18n/pl.json +9 -4
  32. package/build/i18n/ru.json +9 -4
  33. package/build/i18n/types.d.ts +11 -0
  34. package/build/i18n/types.d.ts.map +1 -0
  35. package/build/i18n/types.js +2 -0
  36. package/build/i18n/types.js.map +1 -0
  37. package/build/i18n/uk.json +9 -4
  38. package/build/i18n.d.ts +4 -14
  39. package/build/i18n.d.ts.map +1 -1
  40. package/build/i18n.js +12 -27
  41. package/build/i18n.js.map +1 -1
  42. package/build/index.d.ts +13 -6
  43. package/build/index.d.ts.map +1 -1
  44. package/build/index.js +5 -4
  45. package/build/index.js.map +1 -1
  46. package/build/linker/types.d.ts +59 -0
  47. package/build/linker/types.d.ts.map +1 -0
  48. package/build/linker/types.js +2 -0
  49. package/build/linker/types.js.map +1 -0
  50. package/build/linker.d.ts +5 -76
  51. package/build/linker.d.ts.map +1 -1
  52. package/build/linker.js +290 -339
  53. package/build/linker.js.map +1 -1
  54. package/build/plugins/types.d.ts +42 -0
  55. package/build/plugins/types.d.ts.map +1 -0
  56. package/build/plugins/types.js +2 -0
  57. package/build/plugins/types.js.map +1 -0
  58. package/build/plugins.d.ts +4 -69
  59. package/build/plugins.d.ts.map +1 -1
  60. package/build/plugins.js +73 -62
  61. package/build/plugins.js.map +1 -1
  62. package/build/storage/types.d.ts +31 -0
  63. package/build/storage/types.d.ts.map +1 -0
  64. package/build/storage/types.js +2 -0
  65. package/build/storage/types.js.map +1 -0
  66. package/build/storage.d.ts +6 -22
  67. package/build/storage.d.ts.map +1 -1
  68. package/build/storage.js +72 -81
  69. package/build/storage.js.map +1 -1
  70. package/build/store.d.ts +2 -2
  71. package/build/store.d.ts.map +1 -1
  72. package/build/store.js +116 -67
  73. package/build/store.js.map +1 -1
  74. package/build/types.d.ts +147 -26
  75. package/build/types.d.ts.map +1 -1
  76. package/build/types.local.d.ts +9 -0
  77. package/build/types.local.d.ts.map +1 -0
  78. package/build/types.local.js +2 -0
  79. package/build/types.local.js.map +1 -0
  80. package/package.json +3 -3
  81. package/src/consts.local.ts +16 -0
  82. package/src/consts.ts +126 -34
  83. package/src/geo/types.ts +49 -0
  84. package/src/geo.ts +122 -0
  85. package/src/gtobserver/types.ts +73 -0
  86. package/src/gtobserver.ts +182 -0
  87. package/src/i18n/be.json +9 -4
  88. package/src/i18n/de.json +9 -4
  89. package/src/i18n/en.json +9 -4
  90. package/src/i18n/es.json +9 -4
  91. package/src/i18n/fr.json +9 -4
  92. package/src/i18n/pl.json +9 -4
  93. package/src/i18n/ru.json +9 -4
  94. package/src/i18n/types.ts +11 -0
  95. package/src/i18n/uk.json +9 -4
  96. package/src/i18n.ts +20 -32
  97. package/src/index.ts +13 -13
  98. package/src/linker/types.ts +59 -0
  99. package/src/linker.ts +301 -364
  100. package/src/plugins/types.ts +42 -0
  101. package/src/plugins.ts +82 -106
  102. package/src/storage/types.ts +31 -0
  103. package/src/storage.ts +75 -77
  104. package/src/store.ts +122 -69
  105. package/src/types.local.ts +9 -0
  106. package/src/types.ts +153 -25
  107. package/tests/consent.spec.ts +26 -28
  108. package/tests/geo.spec.ts +474 -0
  109. package/tests/linker.spec.ts +144 -309
  110. package/tests/tracking.spec.ts +14 -14
  111. package/build/functional.d.ts +0 -35
  112. package/build/functional.d.ts.map +0 -1
  113. package/build/functional.js +0 -67
  114. package/build/functional.js.map +0 -1
  115. package/build/gtm.d.ts +0 -72
  116. package/build/gtm.d.ts.map +0 -1
  117. package/build/gtm.js +0 -182
  118. package/build/gtm.js.map +0 -1
  119. package/src/functional.ts +0 -73
  120. package/src/gtm.ts +0 -220
package/src/i18n/be.json CHANGED
@@ -2,9 +2,7 @@
2
2
  "title": "Налады файлаў cookie",
3
3
  "description": "Мы выкарыстоўваем файлы cookie, каб палепшыць ваш досвед прагляду, паказваць персаналізаваную рэкламу ці змесціва і аналізаваць наш трафік. Націскаючы «Прыняць усе», вы пагаджаецеся на выкарыстанне файлаў cookie.",
4
4
  "essential": "Неабходныя файлы cookie",
5
- "essentialDesc": "Патрэбныя для працы сайта — уваход, бяспека і захаванне гэтых налад. Іх нельга адключыць.",
6
- "functional": "Функцыянальныя файлы cookie",
7
- "functionalDesc": "Запамінаюць вашы налады, напрыклад мову інтэрфейсу, каб вам не даводзілася задаваць іх зноў.",
5
+ "essentialDesc": "Патрэбныя для працы сайта — уваход, бяспека і захаванне вашага выбару адносна файлаў cookie і мовы інтэрфейсу. Іх нельга адключыць.",
8
6
  "analytics": "Аналітычныя файлы cookie",
9
7
  "analyticsDesc": "Дапамагаюць нам паляпшаць наш вэб-сайт, збіраючы і паведамляючы інфармацыю пра яго выкарыстанне.",
10
8
  "marketing": "Маркетынгавыя файлы cookie",
@@ -34,5 +32,12 @@
34
32
  "privacy": "Палітыка прыватнасці",
35
33
  "terms": "Умовы карыстання",
36
34
  "domains": "Гэты выбар распаўсюджваецца на {{domains}}.",
37
- "policyDomains": "Гэты выбар распаўсюджваецца на наступныя дамены:"
35
+ "policyDomains": "Гэты выбар распаўсюджваецца на наступныя дамены:",
36
+ "barTitle": "Файлы cookie на гэтым сайце",
37
+ "barDescription": "Мы выкарыстоўваем неабходныя файлы cookie для працы сайта — для ўваходу, забеспячэння бяспекі і запамінання вашага выбару. З вашай згоды мы таксама выкарыстоўвалі б наступныя неабавязковыя файлы cookie: {{categories}}. Яны застаюцца выключанымі, пакуль вы іх не дазволіце, а свой выбар вы можаце ў любы момант змяніць або адклікаць у наладах файлаў cookie.",
38
+ "barDescriptionEssential": "Гэты сайт выкарыстоўвае толькі неабходныя файлы cookie — для ўваходу, забеспячэння бяспекі і запамінання вашага выбару. Яны не патрабуюць згоды і не могуць быць адключаны.",
39
+ "acceptMandatory": "Прыняць толькі неабходныя",
40
+ "locating": "Вызначаем ваш рэгіён…",
41
+ "autoReason": "Гэтыя налады ўжыты аўтаматычна, бо там, адкуль вы праглядаеце сайт, згода на файлы cookie не патрабуецца. Вы можаце змяніць іх у любы момант.",
42
+ "policyRegional": "Там, дзе закон месца знаходжання наведвальніка патрабуе папярэдняй згоды, — у ЕС і ЕЭЗ, Вялікабрытаніі, Швейцарыі і іншых краінах з падобнымі правіламі — неабавязковыя файлы cookie застаюцца выключанымі, пакуль наведвальнік іх не дазволіць. У астатніх краінах яны ўключаны па змаўчанні, акрамя выпадкаў, калі браўзер перадае сігнал Global Privacy Control, які ўлічваецца як адмова; іх можна адключыць у любы момант кнопкай ніжэй."
38
43
  }
package/src/i18n/de.json CHANGED
@@ -2,9 +2,7 @@
2
2
  "title": "Cookie-Einstellungen",
3
3
  "description": "Wir verwenden Cookies, um Ihr Surferlebnis zu verbessern, personalisierte Anzeigen oder Inhalte bereitzustellen und unseren Datenverkehr zu analysieren. Indem Sie auf „Alle akzeptieren\" klicken, stimmen Sie der Verwendung von Cookies zu.",
4
4
  "essential": "Notwendige Cookies",
5
- "essentialDesc": "Erforderlich, damit die Website funktioniert — Anmeldung, Sicherheit und das Speichern dieser Einstellungen. Sie lassen sich nicht abschalten.",
6
- "functional": "Funktionale Cookies",
7
- "functionalDesc": "Merken sich Ihre Auswahl, etwa die Oberflächensprache, damit Sie nicht erneut wählen müssen.",
5
+ "essentialDesc": "Erforderlich, damit die Website funktioniert — Anmeldung, Sicherheit und das Speichern Ihrer Cookie-Auswahl und der Oberflächensprache. Sie lassen sich nicht abschalten.",
8
6
  "analytics": "Analyse-Cookies",
9
7
  "analyticsDesc": "Helfen uns, unsere Website zu verbessern, indem sie Informationen zur Nutzung sammeln und melden.",
10
8
  "marketing": "Marketing-Cookies",
@@ -34,5 +32,12 @@
34
32
  "privacy": "Datenschutzerklärung",
35
33
  "terms": "Nutzungsbedingungen",
36
34
  "domains": "Diese Wahl gilt für {{domains}}.",
37
- "policyDomains": "Diese Wahl gilt für die folgenden Domains:"
35
+ "policyDomains": "Diese Wahl gilt für die folgenden Domains:",
36
+ "barTitle": "Cookies auf dieser Website",
37
+ "barDescription": "Wir verwenden notwendige Cookies, damit diese Website funktioniert – für die Anmeldung, die Sicherheit und um Ihre Auswahl zu speichern. Mit Ihrer Einwilligung würden wir außerdem diese optionalen Cookies verwenden: {{categories}}. Sie bleiben deaktiviert, bis Sie sie erlauben, und Sie können Ihre Auswahl jederzeit in den Cookie-Einstellungen ändern oder widerrufen.",
38
+ "barDescriptionEssential": "Diese Website verwendet nur notwendige Cookies – für die Anmeldung, die Sicherheit und um Ihre Auswahl zu speichern. Sie erfordern keine Einwilligung und können nicht deaktiviert werden.",
39
+ "acceptMandatory": "Nur notwendige akzeptieren",
40
+ "locating": "Ihre Region wird ermittelt …",
41
+ "autoReason": "Diese Einstellungen wurden automatisch angewendet, weil dort, von wo aus Sie die Website aufrufen, keine Cookie-Einwilligung erforderlich ist. Sie können sie jederzeit ändern.",
42
+ "policyRegional": "Wo das Recht am Aufenthaltsort der Besucher eine vorherige Einwilligung verlangt – in der EU und im EWR, im Vereinigten Königreich, in der Schweiz und in weiteren Ländern mit ähnlichen Regeln –, bleiben optionale Cookies deaktiviert, bis sie erlaubt werden. Anderswo sind sie standardmäßig aktiviert, außer wenn der Browser ein Global-Privacy-Control-Signal sendet, das als Ablehnung beachtet wird; sie lassen sich jederzeit über die Schaltfläche unten deaktivieren."
38
43
  }
package/src/i18n/en.json CHANGED
@@ -2,9 +2,7 @@
2
2
  "title": "Cookie Preferences",
3
3
  "description": "We use cookies to enhance your browsing experience, serve personalized ads or content, and analyze our traffic. By clicking \"Accept All\", you consent to our use of cookies.",
4
4
  "essential": "Essential Cookies",
5
- "essentialDesc": "Required for the site to work — signing in, security and remembering these preferences. They cannot be switched off.",
6
- "functional": "Functional Cookies",
7
- "functionalDesc": "Remember your choices, such as the interface language, so you do not have to make them again.",
5
+ "essentialDesc": "Required for the site to work — signing in, security, and remembering your cookie choices and interface language. They cannot be switched off.",
8
6
  "analytics": "Analytics Cookies",
9
7
  "analyticsDesc": "Help us improve our website by collecting and reporting information on its usage.",
10
8
  "marketing": "Marketing Cookies",
@@ -34,5 +32,12 @@
34
32
  "privacy": "Privacy Policy",
35
33
  "terms": "Terms & Conditions",
36
34
  "domains": "This choice applies to {{domains}}.",
37
- "policyDomains": "This choice applies across these domains:"
35
+ "policyDomains": "This choice applies across these domains:",
36
+ "barTitle": "Cookies on this site",
37
+ "barDescription": "We use essential cookies to make this site work — for signing in, security and remembering your choices. With your consent we would also use these optional cookies: {{categories}}. They stay off until you allow them, and you can change or withdraw your choice at any time in the cookie preferences.",
38
+ "barDescriptionEssential": "This site uses only essential cookies — for signing in, security and remembering your choices. They need no consent and cannot be switched off.",
39
+ "acceptMandatory": "Accept only mandatory",
40
+ "locating": "Checking your region…",
41
+ "autoReason": "These settings were applied automatically, because cookie consent is not required where you are browsing from. You can change them at any time.",
42
+ "policyRegional": "Where the law of the visitor's location requires prior consent — the EU and EEA, the United Kingdom, Switzerland and other countries with similar rules — optional cookies stay off until the visitor allows them. Elsewhere they are switched on by default, except when the browser sends a Global Privacy Control signal, which is honoured as a refusal; they can be switched off at any time with the button below."
38
43
  }
package/src/i18n/es.json CHANGED
@@ -2,9 +2,7 @@
2
2
  "title": "Preferencias de cookies",
3
3
  "description": "Utilizamos cookies para mejorar tu experiencia de navegación, ofrecer anuncios o contenido personalizados y analizar nuestro tráfico. Al hacer clic en «Aceptar todo», aceptas nuestro uso de cookies.",
4
4
  "essential": "Cookies esenciales",
5
- "essentialDesc": "Necesarias para que el sitio funcione: inicio de sesión, seguridad y recordar estas preferencias. No se pueden desactivar.",
6
- "functional": "Cookies funcionales",
7
- "functionalDesc": "Recuerdan tus preferencias, como el idioma de la interfaz, para que no tengas que elegirlas de nuevo.",
5
+ "essentialDesc": "Necesarias para que el sitio funcione: inicio de sesión, seguridad y recordar tus decisiones sobre cookies y el idioma de la interfaz. No se pueden desactivar.",
8
6
  "analytics": "Cookies analíticas",
9
7
  "analyticsDesc": "Nos ayudan a mejorar nuestro sitio web recopilando e informando sobre su uso.",
10
8
  "marketing": "Cookies de marketing",
@@ -34,5 +32,12 @@
34
32
  "privacy": "Política de privacidad",
35
33
  "terms": "Términos y condiciones",
36
34
  "domains": "Esta elección se aplica a {{domains}}.",
37
- "policyDomains": "Esta elección se aplica a los siguientes dominios:"
35
+ "policyDomains": "Esta elección se aplica a los siguientes dominios:",
36
+ "barTitle": "Cookies en este sitio",
37
+ "barDescription": "Usamos cookies esenciales para que este sitio funcione: para iniciar sesión, por seguridad y para recordar tus elecciones. Con tu consentimiento también usaríamos estas cookies opcionales: {{categories}}. Permanecen desactivadas hasta que las permitas, y puedes cambiar o retirar tu elección en cualquier momento en las preferencias de cookies.",
38
+ "barDescriptionEssential": "Este sitio solo usa cookies esenciales: para iniciar sesión, por seguridad y para recordar tus elecciones. No requieren consentimiento y no se pueden desactivar.",
39
+ "acceptMandatory": "Aceptar solo las esenciales",
40
+ "locating": "Comprobando tu región…",
41
+ "autoReason": "Esta configuración se aplicó automáticamente porque, desde donde navegas, no se requiere consentimiento para las cookies. Puedes cambiarla en cualquier momento.",
42
+ "policyRegional": "Donde la ley del lugar en que se encuentra el visitante exige consentimiento previo —la UE y el EEE, el Reino Unido, Suiza y otros países con normas similares—, las cookies opcionales permanecen desactivadas hasta que el visitante las permita. En el resto están activadas por defecto, salvo cuando el navegador envía una señal Global Privacy Control, que se respeta como rechazo; pueden desactivarse en cualquier momento con el botón de abajo."
38
43
  }
package/src/i18n/fr.json CHANGED
@@ -2,9 +2,7 @@
2
2
  "title": "Préférences de cookies",
3
3
  "description": "Nous utilisons des cookies pour améliorer votre navigation, proposer des publicités ou contenus personnalisés et analyser notre trafic. En cliquant sur « Tout accepter », vous consentez à leur utilisation.",
4
4
  "essential": "Cookies essentiels",
5
- "essentialDesc": "Nécessaires au fonctionnement du site : connexion, sécurité et mémorisation de ces préférences. Ils ne peuvent pas être désactivés.",
6
- "functional": "Cookies fonctionnels",
7
- "functionalDesc": "Mémorisent vos choix, comme la langue de l'interface, afin que vous n'ayez pas à les refaire.",
5
+ "essentialDesc": "Nécessaires au fonctionnement du site : connexion, sécurité et mémorisation de vos choix en matière de cookies et de la langue de l'interface. Ils ne peuvent pas être désactivés.",
8
6
  "analytics": "Cookies analytiques",
9
7
  "analyticsDesc": "Nous aident à améliorer notre site en recueillant et en analysant des informations sur son utilisation.",
10
8
  "marketing": "Cookies marketing",
@@ -34,5 +32,12 @@
34
32
  "privacy": "Politique de confidentialité",
35
33
  "terms": "Conditions générales",
36
34
  "domains": "Ce choix s'applique à {{domains}}.",
37
- "policyDomains": "Ce choix s'applique aux domaines suivants :"
35
+ "policyDomains": "Ce choix s'applique aux domaines suivants :",
36
+ "barTitle": "Cookies sur ce site",
37
+ "barDescription": "Nous utilisons des cookies essentiels au fonctionnement de ce site : pour la connexion, la sécurité et la mémorisation de vos choix. Avec votre consentement, nous utiliserions également ces cookies facultatifs : {{categories}}. Ils restent désactivés tant que vous ne les autorisez pas, et vous pouvez modifier ou retirer votre choix à tout moment dans les préférences de cookies.",
38
+ "barDescriptionEssential": "Ce site n'utilise que des cookies essentiels : pour la connexion, la sécurité et la mémorisation de vos choix. Ils ne nécessitent pas de consentement et ne peuvent pas être désactivés.",
39
+ "acceptMandatory": "Accepter uniquement les essentiels",
40
+ "locating": "Vérification de votre région…",
41
+ "autoReason": "Ces paramètres ont été appliqués automatiquement, car le consentement aux cookies n'est pas requis là où vous naviguez. Vous pouvez les modifier à tout moment.",
42
+ "policyRegional": "Là où la loi du lieu où se trouve le visiteur exige un consentement préalable — l'UE et l'EEE, le Royaume-Uni, la Suisse et d'autres pays aux règles similaires —, les cookies facultatifs restent désactivés tant que le visiteur ne les autorise pas. Ailleurs, ils sont activés par défaut, sauf lorsque le navigateur envoie un signal Global Privacy Control, respecté comme un refus ; ils peuvent être désactivés à tout moment avec le bouton ci-dessous."
38
43
  }
package/src/i18n/pl.json CHANGED
@@ -2,9 +2,7 @@
2
2
  "title": "Preferencje dotyczące plików cookie",
3
3
  "description": "Używamy plików cookie w celu ulepszenia Twojego doświadczenia podczas przeglądania, wyświetlania spersonalizowanych reklam lub treści oraz analizowania naszego ruchu. Klikając „Akceptuj wszystkie\", wyrażasz zgodę na używanie przez nas plików cookie.",
4
4
  "essential": "Niezbędne pliki cookie",
5
- "essentialDesc": "Wymagane do działania witryny — logowanie, bezpieczeństwo i zapamiętanie tych ustawień. Nie można ich wyłączyć.",
6
- "functional": "Funkcjonalne pliki cookie",
7
- "functionalDesc": "Zapamiętują Twoje wybory, np. język interfejsu, aby nie trzeba było wybierać od nowa.",
5
+ "essentialDesc": "Wymagane do działania witryny — logowanie, bezpieczeństwo oraz zapamiętanie Twoich wyborów dotyczących plików cookie i języka interfejsu. Nie można ich wyłączyć.",
8
6
  "analytics": "Analityczne pliki cookie",
9
7
  "analyticsDesc": "Pomagają nam ulepszać naszą witrynę internetową, zbierając i raportując informacje o jej użytkowaniu.",
10
8
  "marketing": "Marketingowe pliki cookie",
@@ -34,5 +32,12 @@
34
32
  "privacy": "Polityka prywatności",
35
33
  "terms": "Regulamin",
36
34
  "domains": "Ten wybór dotyczy: {{domains}}.",
37
- "policyDomains": "Ten wybór dotyczy następujących domen:"
35
+ "policyDomains": "Ten wybór dotyczy następujących domen:",
36
+ "barTitle": "Pliki cookie w tym serwisie",
37
+ "barDescription": "Używamy niezbędnych plików cookie, aby serwis działał — do logowania, zapewnienia bezpieczeństwa i zapamiętania Twoich wyborów. Za Twoją zgodą użylibyśmy również tych opcjonalnych plików cookie: {{categories}}. Pozostają wyłączone, dopóki na nie nie zezwolisz, a swój wybór możesz w każdej chwili zmienić lub wycofać w preferencjach plików cookie.",
38
+ "barDescriptionEssential": "Ten serwis używa wyłącznie niezbędnych plików cookie — do logowania, zapewnienia bezpieczeństwa i zapamiętania Twoich wyborów. Nie wymagają one zgody i nie można ich wyłączyć.",
39
+ "acceptMandatory": "Akceptuj tylko niezbędne",
40
+ "locating": "Sprawdzamy Twój region…",
41
+ "autoReason": "Te ustawienia zastosowano automatycznie, ponieważ tam, skąd przeglądasz serwis, zgoda na pliki cookie nie jest wymagana. Możesz je zmienić w każdej chwili.",
42
+ "policyRegional": "Tam, gdzie prawo miejsca pobytu odwiedzającego wymaga uprzedniej zgody — w UE i EOG, w Wielkiej Brytanii, Szwajcarii i innych krajach o podobnych przepisach — opcjonalne pliki cookie pozostają wyłączone, dopóki odwiedzający na nie nie zezwoli. W pozostałych krajach są domyślnie włączone, chyba że przeglądarka wysyła sygnał Global Privacy Control, który traktujemy jako odmowę; w każdej chwili można je wyłączyć przyciskiem poniżej."
38
43
  }
package/src/i18n/ru.json CHANGED
@@ -2,9 +2,7 @@
2
2
  "title": "Настройки файлов cookie",
3
3
  "description": "Мы используем файлы cookie, чтобы улучшить ваш опыт просмотра, показывать персонализированную рекламу или контент и анализировать наш трафик. Нажимая «Принять все», вы соглашаетесь на использование файлов cookie.",
4
4
  "essential": "Необходимые файлы cookie",
5
- "essentialDesc": "Нужны для работы сайта — вход, безопасность и сохранение этих настроек. Их нельзя отключить.",
6
- "functional": "Функциональные файлы cookie",
7
- "functionalDesc": "Запоминают ваши настройки, например язык интерфейса, чтобы не приходилось задавать их заново.",
5
+ "essentialDesc": "Нужны для работы сайта — вход, безопасность и сохранение вашего выбора по файлам cookie и языка интерфейса. Их нельзя отключить.",
8
6
  "analytics": "Аналитические файлы cookie",
9
7
  "analyticsDesc": "Помогают нам улучшать наш сайт, собирая и предоставляя информацию о его использовании.",
10
8
  "marketing": "Маркетинговые файлы cookie",
@@ -34,5 +32,12 @@
34
32
  "privacy": "Политика конфиденциальности",
35
33
  "terms": "Условия использования",
36
34
  "domains": "Этот выбор применяется к {{domains}}.",
37
- "policyDomains": "Этот выбор применяется к следующим доменам:"
35
+ "policyDomains": "Этот выбор применяется к следующим доменам:",
36
+ "barTitle": "Файлы cookie на этом сайте",
37
+ "barDescription": "Мы используем необходимые файлы cookie для работы сайта — для входа, обеспечения безопасности и запоминания вашего выбора. С вашего согласия мы также использовали бы следующие необязательные файлы cookie: {{categories}}. Они остаются выключенными, пока вы их не разрешите, а свой выбор вы можете в любой момент изменить или отозвать в настройках файлов cookie.",
38
+ "barDescriptionEssential": "Этот сайт использует только необходимые файлы cookie — для входа, обеспечения безопасности и запоминания вашего выбора. Они не требуют согласия и не могут быть отключены.",
39
+ "acceptMandatory": "Принять только необходимые",
40
+ "locating": "Определяем ваш регион…",
41
+ "autoReason": "Эти настройки применены автоматически, поскольку там, откуда вы просматриваете сайт, согласие на файлы cookie не требуется. Вы можете изменить их в любой момент.",
42
+ "policyRegional": "Там, где закон места пребывания посетителя требует предварительного согласия, — в ЕС и ЕЭЗ, Великобритании, Швейцарии и других странах с аналогичными правилами — необязательные файлы cookie остаются выключенными, пока посетитель их не разрешит. В остальных странах они включены по умолчанию, кроме случаев, когда браузер передаёт сигнал Global Privacy Control, который учитывается как отказ; их можно отключить в любой момент кнопкой ниже."
38
43
  }
@@ -0,0 +1,11 @@
1
+ import type { ConsentLocale } from '../types.js'
2
+
3
+ /** The dialog's built-in copy: the locale it is read in, the house translate shape, placeholders. */
4
+ export interface ConsentI18nHelper {
5
+ /** A locale reduced to one the built-in copy carries — its base tag, else `en`. */
6
+ normalizeLocale: (locale?: string) => ConsentLocale
7
+ /** `(key, defaultValue) => string`, the house shape, backed by the built-in bundle. */
8
+ defaultConsentTranslate: (locale?: string) => (key: string, defaultValue: string) => string
9
+ /** Substitute `{{name}}` placeholders. Enough for the two the policy page needs. */
10
+ interpolate: (text: string, values: Record<string, string | number>) => string
11
+ }
package/src/i18n/uk.json CHANGED
@@ -2,9 +2,7 @@
2
2
  "title": "Налаштування файлів cookie",
3
3
  "description": "Ми використовуємо файли cookie, щоб покращити ваш досвід перегляду, показувати персоналізовану рекламу чи вміст і аналізувати наш трафік. Натискаючи «Прийняти всі», ви погоджуєтеся на використання файлів cookie.",
4
4
  "essential": "Необхідні файли cookie",
5
- "essentialDesc": "Потрібні для роботи сайту — вхід, безпека та збереження цих налаштувань. Їх не можна вимкнути.",
6
- "functional": "Функціональні файли cookie",
7
- "functionalDesc": "Запам’ятовують ваші налаштування, наприклад мову інтерфейсу, щоб вам не доводилося вибирати їх знову.",
5
+ "essentialDesc": "Потрібні для роботи сайту — вхід, безпека та збереження вашого вибору щодо файлів cookie і мови інтерфейсу. Їх не можна вимкнути.",
8
6
  "analytics": "Аналітичні файли cookie",
9
7
  "analyticsDesc": "Допомагають нам покращувати наш вебсайт, збираючи та надаючи інформацію про його використання.",
10
8
  "marketing": "Маркетингові файли cookie",
@@ -34,5 +32,12 @@
34
32
  "privacy": "Політика конфіденційності",
35
33
  "terms": "Умови користування",
36
34
  "domains": "Цей вибір застосовується до {{domains}}.",
37
- "policyDomains": "Цей вибір застосовується до таких доменів:"
35
+ "policyDomains": "Цей вибір застосовується до таких доменів:",
36
+ "barTitle": "Файли cookie на цьому сайті",
37
+ "barDescription": "Ми використовуємо необхідні файли cookie для роботи сайту — для входу, забезпечення безпеки та запам'ятовування вашого вибору. За вашою згодою ми також використовували б такі необов'язкові файли cookie: {{categories}}. Вони залишаються вимкненими, доки ви їх не дозволите, а свій вибір ви можете будь-коли змінити або відкликати в налаштуваннях файлів cookie.",
38
+ "barDescriptionEssential": "Цей сайт використовує лише необхідні файли cookie — для входу, забезпечення безпеки та запам'ятовування вашого вибору. Вони не потребують згоди й не можуть бути вимкнені.",
39
+ "acceptMandatory": "Прийняти лише необхідні",
40
+ "locating": "Визначаємо ваш регіон…",
41
+ "autoReason": "Ці налаштування застосовано автоматично, оскільки там, звідки ви переглядаєте сайт, згода на файли cookie не потрібна. Ви можете змінити їх будь-коли.",
42
+ "policyRegional": "Там, де закон місця перебування відвідувача вимагає попередньої згоди, — у ЄС і ЄЕЗ, Великій Британії, Швейцарії та інших країнах із подібними правилами — необов'язкові файли cookie залишаються вимкненими, доки відвідувач їх не дозволить. В інших країнах вони ввімкнені за замовчуванням, крім випадків, коли браузер надсилає сигнал Global Privacy Control, який враховується як відмова; їх можна будь-коли вимкнути кнопкою нижче."
38
43
  }
package/src/i18n.ts CHANGED
@@ -1,39 +1,27 @@
1
- import { CONSENT_LOCALES } from './consts.js'
2
- import type { ConsentLocale } from './consts.js'
1
+ import { CONSENT_LOCALES, DEFAULT_CONSENT_MESSAGES } from './consts.js'
2
+ import type { ConsentLocale } from './types.js'
3
+ import type { ConsentI18nHelper } from './i18n/types.js'
3
4
 
4
- import en from './i18n/en.json' with { type: 'json' }
5
- import pl from './i18n/pl.json' with { type: 'json' }
6
- import ru from './i18n/ru.json' with { type: 'json' }
7
- import be from './i18n/be.json' with { type: 'json' }
8
- import uk from './i18n/uk.json' with { type: 'json' }
9
- import es from './i18n/es.json' with { type: 'json' }
10
- import de from './i18n/de.json' with { type: 'json' }
11
- import fr from './i18n/fr.json' with { type: 'json' }
5
+ export const createConsentI18nHelper = (): ConsentI18nHelper => {
6
+ const normalizeLocale = (locale?: string): ConsentLocale => {
7
+ const base = (locale ?? 'en').toLowerCase().split('-')[0]
12
8
 
13
- /**
14
- * The dialog's copy, in the box.
15
- *
16
- * Carried here rather than registered into an i18n framework because one of the three consumers is
17
- * an Astro site with React islands and no OwlMeans i18n at all — and a consent dialog that renders
18
- * raw keys is worse than no dialog. An application that HAS translations passes `translate` and
19
- * overrides every one of these.
20
- */
21
- export const DEFAULT_CONSENT_MESSAGES: Record<ConsentLocale, Record<string, string>> = {
22
- en, pl, ru, be, uk, es, de, fr,
23
- }
9
+ return CONSENT_LOCALES.includes(base as ConsentLocale) ? base as ConsentLocale : 'en'
10
+ }
11
+
12
+ const defaultConsentTranslate = (locale?: string) =>
13
+ (key: string, defaultValue: string): string =>
14
+ DEFAULT_CONSENT_MESSAGES[normalizeLocale(locale)]?.[key] ?? defaultValue
24
15
 
25
- export const normalizeLocale = (locale?: string): ConsentLocale => {
26
- const base = (locale ?? 'en').toLowerCase().split('-')[0]
16
+ const interpolate = (text: string, values: Record<string, string | number>): string =>
17
+ text.replace(/\{\{([a-z]+)\}\}/gi, (whole, name: string) =>
18
+ values[name] != null ? String(values[name]) : whole)
27
19
 
28
- return CONSENT_LOCALES.includes(base as ConsentLocale) ? base as ConsentLocale : 'en'
20
+ return { normalizeLocale, defaultConsentTranslate, interpolate }
29
21
  }
30
22
 
31
- /** `(key, defaultValue) => string`, the house shape, backed by the built-in bundle. */
32
- export const defaultConsentTranslate = (locale?: string) =>
33
- (key: string, defaultValue: string): string =>
34
- DEFAULT_CONSENT_MESSAGES[normalizeLocale(locale)]?.[key] ?? defaultValue
23
+ export const consentI18nHelper = createConsentI18nHelper()
35
24
 
36
- /** Substitute `{{name}}` placeholders. Enough for the two the policy page needs. */
37
- export const interpolate = (text: string, values: Record<string, string | number>): string =>
38
- text.replace(/\{\{([a-z]+)\}\}/gi, (whole, name: string) =>
39
- values[name] != null ? String(values[name]) : whole)
25
+ /** @deprecated compat:factory-refactor — use `consentI18nHelper.defaultConsentTranslate(…)` */
26
+ export const defaultConsentTranslate = (locale?: string): (key: string, defaultValue: string) => string =>
27
+ consentI18nHelper.defaultConsentTranslate(locale)
package/src/index.ts CHANGED
@@ -1,18 +1,18 @@
1
1
  export type * from './types.js'
2
+ export type * from './gtobserver/types.js'
3
+ export type * from './i18n/types.js'
4
+ export type * from './linker/types.js'
5
+ export type * from './plugins/types.js'
6
+ export type * from './storage/types.js'
7
+ export type * from './geo/types.js'
2
8
  export * from './consts.js'
3
9
  export * from './storage.js'
4
- export * from './gtm.js'
10
+ export * from './gtobserver.js'
5
11
  export * from './store.js'
6
- export * from './functional.js'
7
12
  export * from './i18n.js'
8
- export type { ConsentPlugin } from './plugins.js'
9
- export {
10
- registerConsentPlugin, consentPlugins, decorateConsentUrl, consentDomains, adoptConsent,
11
- startConsentPlugins, adoptConsentLanguage,
12
- } from './plugins.js'
13
- export type { ConsentLinkPayload } from './linker.js'
14
- export {
15
- consentLinker, encodeConsentLink, decodeConsentLink, stripConsentLinkParam, consentLinkerScript,
16
- writeConsentLanguage,
17
- CONSENT_LINK_PARAM, CONSENT_LINK_MAX_AGE, CONSENT_LINK_SKEW,
18
- } from './linker.js'
13
+ export * from './geo.js'
14
+ export type { ConsentPlugin } from './types.js'
15
+ export { createConsentPluginHelper, consentPluginHelper, decorateConsentUrl } from './plugins.js'
16
+ export type { ConsentLinkPayload } from './types.js'
17
+ export { createConsentLinkHelper, consentLinkHelper, encodeConsentLink, consentLinkerScript } from './linker.js'
18
+ export { CONSENT_LINK_PARAM, CONSENT_LINK_MAX_AGE, CONSENT_LINK_SKEW } from './consts.js'
@@ -0,0 +1,59 @@
1
+ import type { ConsentLinkPayload, ConsentOptions, ConsentPlugin, ConsentRecord } from '../types.js'
2
+
3
+ /** Cross-domain consent: the decorated-link parameter, the linker plugin and its inline twin. */
4
+ export interface ConsentLinkHelper {
5
+ /**
6
+ * The link parameter's value: the current document's decision as `c` (one `0`/`1` per optional
7
+ * category — empty while `record` is `null`, i.e. before the visitor has decided, and for an
8
+ * automatic decision, which is not the visitor's to carry) and, when
9
+ * `opts.linker.language` is set, the page's language as `l`.
10
+ */
11
+ encodeConsentLink: (record: ConsentRecord | null, opts?: ConsentOptions) => string
12
+ /** Parse-only — no trust decision here, that is `consentLinker(opts).adopt`'s job. Never throws. */
13
+ decodeConsentLink: (value: string) => ConsentLinkPayload | null
14
+ /**
15
+ * Persist an adopted language where the application's i18n layer reads its explicit choice from —
16
+ * `linker.language.storageKey`, `owlmeans-lng` by default. Unconditional: the interface language is
17
+ * strictly necessary storage (the visitor picked it, and the site cannot speak to them without it),
18
+ * so no cookie decision — none yet, a refusal, an old record — stands between it and the device.
19
+ *
20
+ * It overwrites what is there on purpose: the carried language is the one the visitor was reading a
21
+ * moment ago, which outranks a choice they made on this domain some other day. Storage that refuses
22
+ * the write is not an error. Returns whether the language was written.
23
+ */
24
+ writeConsentLanguage: (language: string, opts?: ConsentOptions) => boolean
25
+ /**
26
+ * Cross-domain consent: share this decision, and adopt one, between the domains named in
27
+ * `opts.linker.domains`.
28
+ *
29
+ * `start` decorates outgoing first-party links; `adopt` reads and validates an incoming one;
30
+ * `domains` discloses the list a dialog or policy page names. `decorate` is generic (a bare `URL`,
31
+ * no DOM) so the same trust rule serves a real anchor click and a programmatic navigation
32
+ * (`decorateConsentUrl`) alike — the `rel="noreferrer"` exemption is a DOM-only concept and is
33
+ * therefore checked by `start`'s click handler, never here.
34
+ */
35
+ consentLinker: () => ConsentPlugin
36
+ /**
37
+ * Remove the link parameter from the visible URL, keeping every other parameter and the hash — the
38
+ * real-TS equivalent of what {@link consentLinkerScript}'s embedded fragment already did inline.
39
+ * Idempotent: a page with no head script calls this from `consentStore.init` and it strips once; a
40
+ * page that ALSO carried the head script finds the parameter already gone and does nothing.
41
+ */
42
+ stripConsentLinkParam: (opts: ConsentOptions) => void
43
+ /**
44
+ * The inline `<head>` fragment that adopts a decorated link's decision and strips the parameter —
45
+ * standalone, so a page can stamp it even where nothing else here runs (a legal page with no tag
46
+ * script). `@owlmeans/web-gtm`'s `consentBootstrapScript` embeds this SAME fragment right after
47
+ * pushing Consent Mode's defaults, so a page that has both never runs it twice with different
48
+ * effect — the second attempt finds the parameter already gone and does nothing.
49
+ *
50
+ * Mirrors `consentLinker().adopt` exactly (v2, referrer + freshness/skew + full optional coverage +
51
+ * no existing record — or only an automatic one, which the visitor's own choice replaces), but as hand-rolled JS text rather than a call into this module — the same
52
+ * discipline `consentBootstrapScript`/`consentGateScript` already follow, because this has to run
53
+ * before any bundle (this module included) has loaded. The parameter is ALWAYS stripped via
54
+ * `history.replaceState`, whether or not the trust rule accepts it: a stale or foreign `owlcc` is
55
+ * exactly as much noise as an adopted one, and neither belongs in the visible URL or in what a page
56
+ * reload, a shared link or a browser history entry carries forward.
57
+ */
58
+ consentLinkerScript: (opts: ConsentOptions) => string
59
+ }