@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.
- package/README.md +229 -0
- package/build/consts.d.ts +84 -23
- package/build/consts.d.ts.map +1 -1
- package/build/consts.js +110 -29
- package/build/consts.js.map +1 -1
- package/build/consts.local.d.ts +12 -0
- package/build/consts.local.d.ts.map +1 -0
- package/build/consts.local.js +12 -0
- package/build/consts.local.js.map +1 -0
- package/build/geo/types.d.ts +47 -0
- package/build/geo/types.d.ts.map +1 -0
- package/build/geo/types.js +2 -0
- package/build/geo/types.js.map +1 -0
- package/build/geo.d.ts +4 -0
- package/build/geo.d.ts.map +1 -0
- package/build/geo.js +96 -0
- package/build/geo.js.map +1 -0
- package/build/gtobserver/types.d.ts +75 -0
- package/build/gtobserver/types.d.ts.map +1 -0
- package/build/gtobserver/types.js +2 -0
- package/build/gtobserver/types.js.map +1 -0
- package/build/gtobserver.d.ts +7 -0
- package/build/gtobserver.d.ts.map +1 -0
- package/build/gtobserver.js +142 -0
- package/build/gtobserver.js.map +1 -0
- package/build/i18n/be.json +9 -4
- package/build/i18n/de.json +9 -4
- package/build/i18n/en.json +9 -4
- package/build/i18n/es.json +9 -4
- package/build/i18n/fr.json +9 -4
- package/build/i18n/pl.json +9 -4
- package/build/i18n/ru.json +9 -4
- package/build/i18n/types.d.ts +11 -0
- package/build/i18n/types.d.ts.map +1 -0
- package/build/i18n/types.js +2 -0
- package/build/i18n/types.js.map +1 -0
- package/build/i18n/uk.json +9 -4
- package/build/i18n.d.ts +4 -14
- package/build/i18n.d.ts.map +1 -1
- package/build/i18n.js +12 -27
- package/build/i18n.js.map +1 -1
- package/build/index.d.ts +13 -6
- package/build/index.d.ts.map +1 -1
- package/build/index.js +5 -4
- package/build/index.js.map +1 -1
- package/build/linker/types.d.ts +59 -0
- package/build/linker/types.d.ts.map +1 -0
- package/build/linker/types.js +2 -0
- package/build/linker/types.js.map +1 -0
- package/build/linker.d.ts +5 -76
- package/build/linker.d.ts.map +1 -1
- package/build/linker.js +290 -339
- package/build/linker.js.map +1 -1
- package/build/plugins/types.d.ts +42 -0
- package/build/plugins/types.d.ts.map +1 -0
- package/build/plugins/types.js +2 -0
- package/build/plugins/types.js.map +1 -0
- package/build/plugins.d.ts +4 -69
- package/build/plugins.d.ts.map +1 -1
- package/build/plugins.js +73 -62
- package/build/plugins.js.map +1 -1
- package/build/storage/types.d.ts +31 -0
- package/build/storage/types.d.ts.map +1 -0
- package/build/storage/types.js +2 -0
- package/build/storage/types.js.map +1 -0
- package/build/storage.d.ts +6 -22
- package/build/storage.d.ts.map +1 -1
- package/build/storage.js +72 -81
- package/build/storage.js.map +1 -1
- package/build/store.d.ts +2 -2
- package/build/store.d.ts.map +1 -1
- package/build/store.js +116 -67
- package/build/store.js.map +1 -1
- package/build/types.d.ts +147 -26
- package/build/types.d.ts.map +1 -1
- package/build/types.local.d.ts +9 -0
- package/build/types.local.d.ts.map +1 -0
- package/build/types.local.js +2 -0
- package/build/types.local.js.map +1 -0
- package/package.json +3 -3
- package/src/consts.local.ts +16 -0
- package/src/consts.ts +126 -34
- package/src/geo/types.ts +49 -0
- package/src/geo.ts +122 -0
- package/src/gtobserver/types.ts +73 -0
- package/src/gtobserver.ts +182 -0
- package/src/i18n/be.json +9 -4
- package/src/i18n/de.json +9 -4
- package/src/i18n/en.json +9 -4
- package/src/i18n/es.json +9 -4
- package/src/i18n/fr.json +9 -4
- package/src/i18n/pl.json +9 -4
- package/src/i18n/ru.json +9 -4
- package/src/i18n/types.ts +11 -0
- package/src/i18n/uk.json +9 -4
- package/src/i18n.ts +20 -32
- package/src/index.ts +13 -13
- package/src/linker/types.ts +59 -0
- package/src/linker.ts +301 -364
- package/src/plugins/types.ts +42 -0
- package/src/plugins.ts +82 -106
- package/src/storage/types.ts +31 -0
- package/src/storage.ts +75 -77
- package/src/store.ts +122 -69
- package/src/types.local.ts +9 -0
- package/src/types.ts +153 -25
- package/tests/consent.spec.ts +26 -28
- package/tests/geo.spec.ts +474 -0
- package/tests/linker.spec.ts +144 -309
- package/tests/tracking.spec.ts +14 -14
- package/build/functional.d.ts +0 -35
- package/build/functional.d.ts.map +0 -1
- package/build/functional.js +0 -67
- package/build/functional.js.map +0 -1
- package/build/gtm.d.ts +0 -72
- package/build/gtm.d.ts.map +0 -1
- package/build/gtm.js +0 -182
- package/build/gtm.js.map +0 -1
- package/src/functional.ts +0 -73
- package/src/gtm.ts +0 -220
package/build/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
|
+
/** 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 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/i18n/types.ts"],"names":[],"mappings":""}
|
package/build/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/build/i18n.d.ts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
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
|
package/build/i18n.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
22
|
-
|
|
23
|
-
|
|
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,
|
|
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 './
|
|
10
|
+
export * from './gtobserver.js';
|
|
5
11
|
export * from './store.js';
|
|
6
|
-
export * from './functional.js';
|
|
7
12
|
export * from './i18n.js';
|
|
8
|
-
export
|
|
9
|
-
export {
|
|
10
|
-
export
|
|
11
|
-
export {
|
|
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
|
package/build/index.d.ts.map
CHANGED
|
@@ -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,
|
|
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 './
|
|
3
|
+
export * from './gtobserver.js';
|
|
4
4
|
export * from './store.js';
|
|
5
|
-
export * from './functional.js';
|
|
6
5
|
export * from './i18n.js';
|
|
7
|
-
export
|
|
8
|
-
export {
|
|
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
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
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 @@
|
|
|
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
|
-
|
|
4
|
-
export declare const
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
/**
|
|
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
|
package/build/linker.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linker.d.ts","sourceRoot":"","sources":["../src/linker.ts"],"names":[],"mappings":"
|
|
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"}
|