@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
@@ -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
+ /** The dialog's built-in copy: the locale it is read in, the house translate shape, placeholders. */
3
+ export interface ConsentI18nHelper {
4
+ /** A locale reduced to one the built-in copy carries — its base tag, else `en`. */
5
+ normalizeLocale: (locale?: string) => ConsentLocale;
6
+ /** `(key, defaultValue) => string`, the house shape, backed by the built-in bundle. */
7
+ defaultConsentTranslate: (locale?: string) => (key: string, defaultValue: string) => string;
8
+ /** Substitute `{{name}}` placeholders. Enough for the two the policy page needs. */
9
+ interpolate: (text: string, values: Record<string, string | number>) => string;
10
+ }
11
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/i18n/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD,qGAAqG;AACrG,MAAM,WAAW,iBAAiB;IAChC,mFAAmF;IACnF,eAAe,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,aAAa,CAAA;IACnD,uFAAuF;IACvF,uBAAuB,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,MAAM,CAAA;IAC3F,oFAAoF;IACpF,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,MAAM,CAAA;CAC/E"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/i18n/types.ts"],"names":[],"mappings":""}
@@ -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/build/i18n.d.ts CHANGED
@@ -1,16 +1,6 @@
1
- import type { ConsentLocale } from './consts.js';
2
- /**
3
- * The dialog's copy, in the box.
4
- *
5
- * Carried here rather than registered into an i18n framework because one of the three consumers is
6
- * an Astro site with React islands and no OwlMeans i18n at all — and a consent dialog that renders
7
- * raw keys is worse than no dialog. An application that HAS translations passes `translate` and
8
- * overrides every one of these.
9
- */
10
- export declare const DEFAULT_CONSENT_MESSAGES: Record<ConsentLocale, Record<string, string>>;
11
- export declare const normalizeLocale: (locale?: string) => ConsentLocale;
12
- /** `(key, defaultValue) => string`, the house shape, backed by the built-in bundle. */
1
+ import type { ConsentI18nHelper } from './i18n/types.js';
2
+ export declare const createConsentI18nHelper: () => ConsentI18nHelper;
3
+ export declare const consentI18nHelper: ConsentI18nHelper;
4
+ /** @deprecated compat:factory-refactor — use `consentI18nHelper.defaultConsentTranslate(…)` */
13
5
  export declare const defaultConsentTranslate: (locale?: string) => (key: string, defaultValue: string) => string;
14
- /** Substitute `{{name}}` placeholders. Enough for the two the policy page needs. */
15
- export declare const interpolate: (text: string, values: Record<string, string | number>) => string;
16
6
  //# sourceMappingURL=i18n.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAWhD;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAElF,CAAA;AAED,eAAO,MAAM,eAAe,YAAa,MAAM,KAAG,aAIjD,CAAA;AAED,uFAAuF;AACvF,eAAO,MAAM,uBAAuB,YAAa,MAAM,WAC/C,MAAM,gBAAgB,MAAM,KAAG,MACqC,CAAA;AAE5E,oFAAoF;AACpF,eAAO,MAAM,WAAW,SAAU,MAAM,UAAU,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAG,MAE5B,CAAA"}
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAExD,eAAO,MAAM,uBAAuB,QAAO,iBAgB1C,CAAA;AAED,eAAO,MAAM,iBAAiB,mBAA4B,CAAA;AAE1D,+FAA+F;AAC/F,eAAO,MAAM,uBAAuB,YAAa,MAAM,KAAG,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,MAC9C,CAAA"}
package/build/i18n.js CHANGED
@@ -1,29 +1,14 @@
1
- import { CONSENT_LOCALES } from './consts.js';
2
- import en from './i18n/en.json' with { type: 'json' };
3
- import pl from './i18n/pl.json' with { type: 'json' };
4
- import ru from './i18n/ru.json' with { type: 'json' };
5
- import be from './i18n/be.json' with { type: 'json' };
6
- import uk from './i18n/uk.json' with { type: 'json' };
7
- import es from './i18n/es.json' with { type: 'json' };
8
- import de from './i18n/de.json' with { type: 'json' };
9
- import fr from './i18n/fr.json' with { type: 'json' };
10
- /**
11
- * The dialog's copy, in the box.
12
- *
13
- * Carried here rather than registered into an i18n framework because one of the three consumers is
14
- * an Astro site with React islands and no OwlMeans i18n at all — and a consent dialog that renders
15
- * raw keys is worse than no dialog. An application that HAS translations passes `translate` and
16
- * overrides every one of these.
17
- */
18
- export const DEFAULT_CONSENT_MESSAGES = {
19
- en, pl, ru, be, uk, es, de, fr,
1
+ import { CONSENT_LOCALES, DEFAULT_CONSENT_MESSAGES } from './consts.js';
2
+ export const createConsentI18nHelper = () => {
3
+ const normalizeLocale = (locale) => {
4
+ const base = (locale ?? 'en').toLowerCase().split('-')[0];
5
+ return CONSENT_LOCALES.includes(base) ? base : 'en';
6
+ };
7
+ const defaultConsentTranslate = (locale) => (key, defaultValue) => DEFAULT_CONSENT_MESSAGES[normalizeLocale(locale)]?.[key] ?? defaultValue;
8
+ const interpolate = (text, values) => text.replace(/\{\{([a-z]+)\}\}/gi, (whole, name) => values[name] != null ? String(values[name]) : whole);
9
+ return { normalizeLocale, defaultConsentTranslate, interpolate };
20
10
  };
21
- export const normalizeLocale = (locale) => {
22
- const base = (locale ?? 'en').toLowerCase().split('-')[0];
23
- return CONSENT_LOCALES.includes(base) ? base : 'en';
24
- };
25
- /** `(key, defaultValue) => string`, the house shape, backed by the built-in bundle. */
26
- export const defaultConsentTranslate = (locale) => (key, defaultValue) => DEFAULT_CONSENT_MESSAGES[normalizeLocale(locale)]?.[key] ?? defaultValue;
27
- /** Substitute `{{name}}` placeholders. Enough for the two the policy page needs. */
28
- export const interpolate = (text, values) => text.replace(/\{\{([a-z]+)\}\}/gi, (whole, name) => values[name] != null ? String(values[name]) : whole);
11
+ export const consentI18nHelper = createConsentI18nHelper();
12
+ /** @deprecated compat:factory-refactor — use `consentI18nHelper.defaultConsentTranslate(…)` */
13
+ export const defaultConsentTranslate = (locale) => consentI18nHelper.defaultConsentTranslate(locale);
29
14
  //# sourceMappingURL=i18n.js.map
package/build/i18n.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.js","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAG7C,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACrD,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACrD,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACrD,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACrD,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACrD,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACrD,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACrD,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AAErD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAkD;IACrF,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;CAC/B,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAe,EAAiB,EAAE;IAChE,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAEzD,OAAO,eAAe,CAAC,QAAQ,CAAC,IAAqB,CAAC,CAAC,CAAC,CAAC,IAAqB,CAAC,CAAC,CAAC,IAAI,CAAA;AACvF,CAAC,CAAA;AAED,uFAAuF;AACvF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,MAAe,EAAE,EAAE,CACzD,CAAC,GAAW,EAAE,YAAoB,EAAU,EAAE,CAC5C,wBAAwB,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,YAAY,CAAA;AAE5E,oFAAoF;AACpF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,MAAuC,EAAU,EAAE,CAC3F,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE,CACzD,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA"}
1
+ {"version":3,"file":"i18n.js","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAIvE,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAsB,EAAE;IAC7D,MAAM,eAAe,GAAG,CAAC,MAAe,EAAiB,EAAE;QACzD,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;QAEzD,OAAO,eAAe,CAAC,QAAQ,CAAC,IAAqB,CAAC,CAAC,CAAC,CAAC,IAAqB,CAAC,CAAC,CAAC,IAAI,CAAA;IACvF,CAAC,CAAA;IAED,MAAM,uBAAuB,GAAG,CAAC,MAAe,EAAE,EAAE,CAClD,CAAC,GAAW,EAAE,YAAoB,EAAU,EAAE,CAC5C,wBAAwB,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,YAAY,CAAA;IAE5E,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,MAAuC,EAAU,EAAE,CACpF,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE,CACzD,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;IAExD,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,WAAW,EAAE,CAAA;AAClE,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,uBAAuB,EAAE,CAAA;AAE1D,+FAA+F;AAC/F,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,MAAe,EAAiD,EAAE,CACxG,iBAAiB,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAA"}
package/build/index.d.ts CHANGED
@@ -1,12 +1,19 @@
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 { registerConsentPlugin, consentPlugins, decorateConsentUrl, consentDomains, adoptConsent, startConsentPlugins, adoptConsentLanguage, } from './plugins.js';
10
- export type { ConsentLinkPayload } from './linker.js';
11
- export { consentLinker, encodeConsentLink, decodeConsentLink, stripConsentLinkParam, consentLinkerScript, writeConsentLanguage, CONSENT_LINK_PARAM, CONSENT_LINK_MAX_AGE, CONSENT_LINK_SKEW, } 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';
12
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EACL,qBAAqB,EAAE,cAAc,EAAE,kBAAkB,EAAE,cAAc,EAAE,YAAY,EACvF,mBAAmB,EAAE,oBAAoB,GAC1C,MAAM,cAAc,CAAA;AACrB,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,EACL,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,mBAAmB,EAC/F,oBAAoB,EACpB,kBAAkB,EAAE,oBAAoB,EAAE,iBAAiB,GAC5D,MAAM,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAA;AAC/B,mBAAmB,uBAAuB,CAAA;AAC1C,mBAAmB,iBAAiB,CAAA;AACpC,mBAAmB,mBAAmB,CAAA;AACtC,mBAAmB,oBAAoB,CAAA;AACvC,mBAAmB,oBAAoB,CAAA;AACvC,mBAAmB,gBAAgB,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjG,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAChH,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA"}
package/build/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  export * from './consts.js';
2
2
  export * from './storage.js';
3
- export * from './gtm.js';
3
+ export * from './gtobserver.js';
4
4
  export * from './store.js';
5
- export * from './functional.js';
6
5
  export * from './i18n.js';
7
- export { registerConsentPlugin, consentPlugins, decorateConsentUrl, consentDomains, adoptConsent, startConsentPlugins, adoptConsentLanguage, } from './plugins.js';
8
- export { consentLinker, encodeConsentLink, decodeConsentLink, stripConsentLinkParam, consentLinkerScript, writeConsentLanguage, CONSENT_LINK_PARAM, CONSENT_LINK_MAX_AGE, CONSENT_LINK_SKEW, } from './linker.js';
6
+ export * from './geo.js';
7
+ export { createConsentPluginHelper, consentPluginHelper, decorateConsentUrl } from './plugins.js';
8
+ export { createConsentLinkHelper, consentLinkHelper, encodeConsentLink, consentLinkerScript } from './linker.js';
9
+ export { CONSENT_LINK_PARAM, CONSENT_LINK_MAX_AGE, CONSENT_LINK_SKEW } from './consts.js';
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AAEzB,OAAO,EACL,qBAAqB,EAAE,cAAc,EAAE,kBAAkB,EAAE,cAAc,EAAE,YAAY,EACvF,mBAAmB,EAAE,oBAAoB,GAC1C,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,mBAAmB,EAC/F,oBAAoB,EACpB,kBAAkB,EAAE,oBAAoB,EAAE,iBAAiB,GAC5D,MAAM,aAAa,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AAExB,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAEjG,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAChH,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA"}
@@ -0,0 +1,59 @@
1
+ import type { ConsentLinkPayload, ConsentOptions, ConsentPlugin, ConsentRecord } from '../types.js';
2
+ /** Cross-domain consent: the decorated-link parameter, the linker plugin and its inline twin. */
3
+ export interface ConsentLinkHelper {
4
+ /**
5
+ * The link parameter's value: the current document's decision as `c` (one `0`/`1` per optional
6
+ * category — empty while `record` is `null`, i.e. before the visitor has decided, and for an
7
+ * automatic decision, which is not the visitor's to carry) and, when
8
+ * `opts.linker.language` is set, the page's language as `l`.
9
+ */
10
+ encodeConsentLink: (record: ConsentRecord | null, opts?: ConsentOptions) => string;
11
+ /** Parse-only — no trust decision here, that is `consentLinker(opts).adopt`'s job. Never throws. */
12
+ decodeConsentLink: (value: string) => ConsentLinkPayload | null;
13
+ /**
14
+ * Persist an adopted language where the application's i18n layer reads its explicit choice from —
15
+ * `linker.language.storageKey`, `owlmeans-lng` by default. Unconditional: the interface language is
16
+ * strictly necessary storage (the visitor picked it, and the site cannot speak to them without it),
17
+ * so no cookie decision — none yet, a refusal, an old record — stands between it and the device.
18
+ *
19
+ * It overwrites what is there on purpose: the carried language is the one the visitor was reading a
20
+ * moment ago, which outranks a choice they made on this domain some other day. Storage that refuses
21
+ * the write is not an error. Returns whether the language was written.
22
+ */
23
+ writeConsentLanguage: (language: string, opts?: ConsentOptions) => boolean;
24
+ /**
25
+ * Cross-domain consent: share this decision, and adopt one, between the domains named in
26
+ * `opts.linker.domains`.
27
+ *
28
+ * `start` decorates outgoing first-party links; `adopt` reads and validates an incoming one;
29
+ * `domains` discloses the list a dialog or policy page names. `decorate` is generic (a bare `URL`,
30
+ * no DOM) so the same trust rule serves a real anchor click and a programmatic navigation
31
+ * (`decorateConsentUrl`) alike — the `rel="noreferrer"` exemption is a DOM-only concept and is
32
+ * therefore checked by `start`'s click handler, never here.
33
+ */
34
+ consentLinker: () => ConsentPlugin;
35
+ /**
36
+ * Remove the link parameter from the visible URL, keeping every other parameter and the hash — the
37
+ * real-TS equivalent of what {@link consentLinkerScript}'s embedded fragment already did inline.
38
+ * Idempotent: a page with no head script calls this from `consentStore.init` and it strips once; a
39
+ * page that ALSO carried the head script finds the parameter already gone and does nothing.
40
+ */
41
+ stripConsentLinkParam: (opts: ConsentOptions) => void;
42
+ /**
43
+ * The inline `<head>` fragment that adopts a decorated link's decision and strips the parameter —
44
+ * standalone, so a page can stamp it even where nothing else here runs (a legal page with no tag
45
+ * script). `@owlmeans/web-gtm`'s `consentBootstrapScript` embeds this SAME fragment right after
46
+ * pushing Consent Mode's defaults, so a page that has both never runs it twice with different
47
+ * effect — the second attempt finds the parameter already gone and does nothing.
48
+ *
49
+ * Mirrors `consentLinker().adopt` exactly (v2, referrer + freshness/skew + full optional coverage +
50
+ * 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
51
+ * discipline `consentBootstrapScript`/`consentGateScript` already follow, because this has to run
52
+ * before any bundle (this module included) has loaded. The parameter is ALWAYS stripped via
53
+ * `history.replaceState`, whether or not the trust rule accepts it: a stale or foreign `owlcc` is
54
+ * exactly as much noise as an adopted one, and neither belongs in the visible URL or in what a page
55
+ * reload, a shared link or a browser history entry carries forward.
56
+ */
57
+ consentLinkerScript: (opts: ConsentOptions) => string;
58
+ }
59
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/linker/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEnG,iGAAiG;AACjG,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,iBAAiB,EAAE,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,EAAE,IAAI,CAAC,EAAE,cAAc,KAAK,MAAM,CAAA;IAClF,oGAAoG;IACpG,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,kBAAkB,GAAG,IAAI,CAAA;IAC/D;;;;;;;;;OASG;IACH,oBAAoB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,KAAK,OAAO,CAAA;IAC1E;;;;;;;;;OASG;IACH,aAAa,EAAE,MAAM,aAAa,CAAA;IAClC;;;;;OAKG;IACH,qBAAqB,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAA;IACrD;;;;;;;;;;;;;;OAcG;IACH,mBAAmB,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,MAAM,CAAA;CACtD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/linker/types.ts"],"names":[],"mappings":""}
package/build/linker.d.ts CHANGED
@@ -1,80 +1,9 @@
1
- import type { ConsentPlugin } from './plugins.js';
2
1
  import type { ConsentOptions, ConsentRecord } from './types.js';
3
- /** The URL parameter a decorated link carries the decision in, absent an override. */
4
- export declare const CONSENT_LINK_PARAM = "owlcc";
5
- /** How old a decorated link's timestamp may be and still be trusted, in seconds, absent an override. */
6
- export declare const CONSENT_LINK_MAX_AGE = 300;
7
- /** Clock skew allowed the OTHER way — a timestamp up to this far in the future is still trusted. */
8
- export declare const CONSENT_LINK_SKEW = 60;
9
- declare const CONSENT_LINK_VERSION = 2;
10
- /** The decoded, not-yet-validated payload a decorated link's parameter carries. */
11
- export interface ConsentLinkPayload {
12
- v: typeof CONSENT_LINK_VERSION;
13
- /** One entry per OPTIONAL category this site knows, `1` granted / `0` denied. */
14
- c: Record<string, 0 | 1>;
15
- /** Unix seconds the link was decorated at. */
16
- t: number;
17
- /**
18
- * The interface language of the page the link was on (a BCP 47 tag, lower-cased) — present only
19
- * when the sender has `linker.language` set and its `<html lang>` names one. Optional on the
20
- * wire, so a receiver that predates it reads the same `v: 2` payload and ignores the field.
21
- */
22
- l?: string;
23
- }
24
- /**
25
- * The link parameter's value: the current document's decision as `c` (one `0`/`1` per optional
26
- * category — empty while `record` is `null`, i.e. before the visitor has decided) and, when
27
- * `opts.linker.language` is set, the page's language as `l`.
28
- */
2
+ import type { ConsentLinkHelper } from './linker/types.js';
3
+ export declare const createConsentLinkHelper: () => ConsentLinkHelper;
4
+ export declare const consentLinkHelper: ConsentLinkHelper;
5
+ /** @deprecated compat:factory-refactor — use `consentLinkHelper.encodeConsentLink(…)` */
29
6
  export declare const encodeConsentLink: (record: ConsentRecord | null, opts?: ConsentOptions) => string;
30
- /** Parse-only — no trust decision here, that is `consentLinker(opts).adopt`'s job. Never throws. */
31
- export declare const decodeConsentLink: (value: string) => ConsentLinkPayload | null;
32
- /**
33
- * Persist an adopted language where the application's i18n layer reads its explicit choice from —
34
- * `linker.language.storageKey`, `owlmeans-lng` by default — and only while the visitor has GRANTED
35
- * `functional` on this document (a stored record, or the one adopted from the very link that
36
- * carried the language). Without that grant nothing is written and `false` comes back: remembering
37
- * a preference on a visitor's device is storage like any other, and a refusal ("reject all") is an
38
- * answer, not a gap to fill. The gate lives here, not in the callers, so no caller can forget it.
39
- *
40
- * It overwrites what is there on purpose: the carried language is the one the visitor was reading a
41
- * moment ago, which outranks a choice they made on this domain some other day. Storage that refuses
42
- * the write is not an error. Returns whether the language was written.
43
- */
44
- export declare const writeConsentLanguage: (language: string, opts?: ConsentOptions) => boolean;
45
- /**
46
- * Cross-domain consent: share this decision, and adopt one, between the domains named in
47
- * `opts.linker.domains`.
48
- *
49
- * `start` decorates outgoing first-party links; `adopt` reads and validates an incoming one;
50
- * `domains` discloses the list a dialog or policy page names. `decorate` is generic (a bare `URL`,
51
- * no DOM) so the same trust rule serves a real anchor click and a programmatic navigation
52
- * (`decorateConsentUrl`) alike — the `rel="noreferrer"` exemption is a DOM-only concept and is
53
- * therefore checked by `start`'s click handler, never here.
54
- */
55
- export declare const consentLinker: () => ConsentPlugin;
56
- /**
57
- * Remove the link parameter from the visible URL, keeping every other parameter and the hash — the
58
- * real-TS equivalent of what {@link consentLinkerScript}'s embedded fragment already did inline.
59
- * Idempotent: a page with no head script calls this from `consentStore.init` and it strips once; a
60
- * page that ALSO carried the head script finds the parameter already gone and does nothing.
61
- */
62
- export declare const stripConsentLinkParam: (opts: ConsentOptions) => void;
63
- /**
64
- * The inline `<head>` fragment that adopts a decorated link's decision and strips the parameter —
65
- * standalone, so a page can stamp it even where nothing else here runs (a legal page with no tag
66
- * script). `@owlmeans/web-gtm`'s `consentBootstrapScript` embeds this SAME fragment right after
67
- * pushing Consent Mode's defaults, so a page that has both never runs it twice with different
68
- * effect — the second attempt finds the parameter already gone and does nothing.
69
- *
70
- * Mirrors `consentLinker().adopt` exactly (v2, referrer + freshness/skew + full optional coverage +
71
- * no existing record), but as hand-rolled JS text rather than a call into this module — the same
72
- * discipline `consentBootstrapScript`/`consentGateScript` already follow, because this has to run
73
- * before any bundle (this module included) has loaded. The parameter is ALWAYS stripped via
74
- * `history.replaceState`, whether or not the trust rule accepts it: a stale or foreign `owlcc` is
75
- * exactly as much noise as an adopted one, and neither belongs in the visible URL or in what a page
76
- * reload, a shared link or a browser history entry carries forward.
77
- */
7
+ /** @deprecated compat:factory-refactor — use `consentLinkHelper.consentLinkerScript(…)` */
78
8
  export declare const consentLinkerScript: (opts: ConsentOptions) => string;
79
- export {};
80
9
  //# sourceMappingURL=linker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"linker.d.ts","sourceRoot":"","sources":["../src/linker.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAGjD,OAAO,KAAK,EAAmB,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAEhF,sFAAsF;AACtF,eAAO,MAAM,kBAAkB,UAAU,CAAA;AACzC,wGAAwG;AACxG,eAAO,MAAM,oBAAoB,MAAM,CAAA;AACvC,oGAAoG;AACpG,eAAO,MAAM,iBAAiB,KAAK,CAAA;AAEnC,QAAA,MAAM,oBAAoB,IAAI,CAAA;AAE9B,mFAAmF;AACnF,MAAM,WAAW,kBAAkB;IACjC,CAAC,EAAE,OAAO,oBAAoB,CAAA;IAC9B,iFAAiF;IACjF,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;IACxB,8CAA8C;IAC9C,CAAC,EAAE,MAAM,CAAA;IACT;;;;OAIG;IACH,CAAC,CAAC,EAAE,MAAM,CAAA;CACX;AAqCD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,WAAY,aAAa,GAAG,IAAI,SAAS,cAAc,KAAG,MAavF,CAAA;AAED,oGAAoG;AACpG,eAAO,MAAM,iBAAiB,UAAW,MAAM,KAAG,kBAAkB,GAAG,IAuBtE,CAAA;AAyDD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,aAAc,MAAM,SAAS,cAAc,KAAG,OAY9E,CAAA;AAQD;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,QAAO,aA2FhC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,SAAU,cAAc,KAAG,IAgB5D,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,SAAU,cAAc,KAAG,MAoE1D,CAAA"}
1
+ {"version":3,"file":"linker.d.ts","sourceRoot":"","sources":["../src/linker.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAkC,cAAc,EAAE,aAAa,EAAsB,MAAM,YAAY,CAAA;AAInH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE1D,eAAO,MAAM,uBAAuB,QAAO,iBA6U1C,CAAA;AAED,eAAO,MAAM,iBAAiB,mBAA4B,CAAA;AAE1D,yFAAyF;AACzF,eAAO,MAAM,iBAAiB,WAAY,aAAa,GAAG,IAAI,SAAS,cAAc,KAAG,MACrC,CAAA;AAEnD,2FAA2F;AAC3F,eAAO,MAAM,mBAAmB,SAAU,cAAc,KAAG,MAAqD,CAAA"}