@owlmeans/consent 0.1.18-rc.10 → 0.1.18-rc.11
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/build/consts.d.ts +11 -2
- package/build/consts.d.ts.map +1 -1
- package/build/consts.js +19 -0
- package/build/consts.js.map +1 -1
- package/build/gtm/types.d.ts +75 -0
- package/build/gtm/types.d.ts.map +1 -0
- package/build/gtm/types.js +2 -0
- package/build/gtm/types.js.map +1 -0
- package/build/gtm.d.ts +5 -70
- package/build/gtm.d.ts.map +1 -1
- package/build/gtm.js +125 -175
- package/build/gtm.js.map +1 -1
- 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.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 +7 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/build/linker/types.d.ts +58 -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 +6 -52
- package/build/linker.d.ts.map +1 -1
- package/build/linker.js +278 -314
- package/build/linker.js.map +1 -1
- package/build/plugins/types.d.ts +33 -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 +5 -28
- package/build/plugins.d.ts.map +1 -1
- package/build/plugins.js +49 -61
- 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 +70 -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 +18 -18
- package/build/store.js.map +1 -1
- package/build/types.d.ts +6 -3
- package/build/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/consts.ts +23 -2
- package/src/gtm/types.ts +73 -0
- package/src/gtm.ts +142 -188
- package/src/i18n/types.ts +11 -0
- package/src/i18n.ts +19 -31
- package/src/index.ts +7 -5
- package/src/linker/types.ts +58 -0
- package/src/linker.ts +283 -314
- package/src/plugins/types.ts +33 -0
- package/src/plugins.ts +56 -63
- package/src/storage/types.ts +31 -0
- package/src/storage.ts +73 -77
- package/src/store.ts +18 -18
- package/src/types.ts +4 -3
- package/tests/consent.spec.ts +26 -28
- package/tests/linker.spec.ts +67 -67
- package/tests/tracking.spec.ts +14 -14
package/build/consts.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ConsentCategory } from './types.js';
|
|
1
|
+
import type { ConsentCategory, ConsentLocale } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Where a visitor's choice is stored.
|
|
4
4
|
*
|
|
@@ -38,7 +38,16 @@ export declare const CONSENT_MARKETING = "marketing";
|
|
|
38
38
|
* language part has to run in an inline `<head>` script, before any bundle exists.
|
|
39
39
|
*/
|
|
40
40
|
export declare const CONSENT_LANGUAGE_KEY = "owlmeans-lng";
|
|
41
|
-
export declare const CONSENT_LOCALES: readonly [
|
|
41
|
+
export declare const CONSENT_LOCALES: readonly ["en", "pl", "ru", "be", "uk", "es", "de", "fr"];
|
|
42
|
+
/**
|
|
43
|
+
* The dialog's copy, in the box.
|
|
44
|
+
*
|
|
45
|
+
* Carried here rather than registered into an i18n framework because one of the three consumers is
|
|
46
|
+
* an Astro site with React islands and no OwlMeans i18n at all — and a consent dialog that renders
|
|
47
|
+
* raw keys is worse than no dialog. An application that HAS translations passes `translate` and
|
|
48
|
+
* overrides every one of these.
|
|
49
|
+
*/
|
|
50
|
+
export declare const DEFAULT_CONSENT_MESSAGES: Record<ConsentLocale, Record<string, string>>;
|
|
42
51
|
/**
|
|
43
52
|
* The categories every OwlMeans surface starts with.
|
|
44
53
|
*
|
package/build/consts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAWhE;;;;;GAKG;AACH,eAAO,MAAM,WAAW,wBAAwB,CAAA;AAEhD,eAAO,MAAM,mBAAmB,MAAM,CAAA;AAEtC;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,IAAI,CAAA;AAEvC,2FAA2F;AAC3F,eAAO,MAAM,kBAAkB,uBAAuB,CAAA;AAEtD;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,qBAAqB,CAAA;AAE/C,eAAO,MAAM,iBAAiB,cAAc,CAAA;AAC5C,eAAO,MAAM,iBAAiB,cAAc,CAAA;AAC5C,eAAO,MAAM,iBAAiB,cAAc,CAAA;AAE5C;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,iBAAiB,CAAA;AAElD,eAAO,MAAM,eAAe,2DAA+F,CAAA;AAE3H;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAElF,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,EAAE,eAAe,EAmBvD,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,QAAQ,CAQxE,CAAA;AAED,sFAAsF;AACtF,eAAO,MAAM,kBAAkB,UAAU,CAAA;AAEzC,wGAAwG;AACxG,eAAO,MAAM,oBAAoB,MAAM,CAAA;AAEvC,oGAAoG;AACpG,eAAO,MAAM,iBAAiB,KAAK,CAAA"}
|
package/build/consts.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import en from './i18n/en.json' with { type: 'json' };
|
|
2
|
+
import pl from './i18n/pl.json' with { type: 'json' };
|
|
3
|
+
import ru from './i18n/ru.json' with { type: 'json' };
|
|
4
|
+
import be from './i18n/be.json' with { type: 'json' };
|
|
5
|
+
import uk from './i18n/uk.json' with { type: 'json' };
|
|
6
|
+
import es from './i18n/es.json' with { type: 'json' };
|
|
7
|
+
import de from './i18n/de.json' with { type: 'json' };
|
|
8
|
+
import fr from './i18n/fr.json' with { type: 'json' };
|
|
1
9
|
/**
|
|
2
10
|
* Where a visitor's choice is stored.
|
|
3
11
|
*
|
|
@@ -38,6 +46,17 @@ export const CONSENT_MARKETING = 'marketing';
|
|
|
38
46
|
*/
|
|
39
47
|
export const CONSENT_LANGUAGE_KEY = 'owlmeans-lng';
|
|
40
48
|
export const CONSENT_LOCALES = ['en', 'pl', 'ru', 'be', 'uk', 'es', 'de', 'fr'];
|
|
49
|
+
/**
|
|
50
|
+
* The dialog's copy, in the box.
|
|
51
|
+
*
|
|
52
|
+
* Carried here rather than registered into an i18n framework because one of the three consumers is
|
|
53
|
+
* an Astro site with React islands and no OwlMeans i18n at all — and a consent dialog that renders
|
|
54
|
+
* raw keys is worse than no dialog. An application that HAS translations passes `translate` and
|
|
55
|
+
* overrides every one of these.
|
|
56
|
+
*/
|
|
57
|
+
export const DEFAULT_CONSENT_MESSAGES = {
|
|
58
|
+
en, pl, ru, be, uk, es, de, fr,
|
|
59
|
+
};
|
|
41
60
|
/**
|
|
42
61
|
* The categories every OwlMeans surface starts with.
|
|
43
62
|
*
|
package/build/consts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAE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ACD;QACE,GAAG,EAAE,iBAAiB;QACtB,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe;QACtD,SAAS,EAAE,qBAAqB;QAChC,OAAO,EAAE,CAAC,mBAAmB,CAAC;KAC/B;IACD;QACE,GAAG,EAAE,iBAAiB;QACtB,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe;QACtD,SAAS,EAAE,qBAAqB;QAChC,OAAO,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,oBAAoB,CAAC;KAC9D;CACF,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAyC;IAC3E,UAAU,EAAE,QAAQ;IACpB,YAAY,EAAE,QAAQ;IACtB,kBAAkB,EAAE,QAAQ;IAC5B,iBAAiB,EAAE,QAAQ;IAC3B,qBAAqB,EAAE,QAAQ;IAC/B,uBAAuB,EAAE,QAAQ;IACjC,gBAAgB,EAAE,SAAS;CAC5B,CAAA;AAED,sFAAsF;AACtF,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAA;AAEzC,wGAAwG;AACxG,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAA;AAEvC,oGAAoG;AACpG,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAA"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { ConsentCategory, ConsentOptions, ConsentRecord } from '../types.js';
|
|
2
|
+
/** Google Consent Mode: the queue, the signals a decision implies, and the inline scripts. */
|
|
3
|
+
export interface ConsentModeHelper {
|
|
4
|
+
/**
|
|
5
|
+
* Push onto the tag-manager queue in the shape Google's own snippet uses.
|
|
6
|
+
*
|
|
7
|
+
* `arguments`, not an array literal. Both work with today's Consent API, but `arguments` is what
|
|
8
|
+
* `gtag.js` itself emits, and a page that carries both this and Google's snippet should not have
|
|
9
|
+
* two shapes in one queue.
|
|
10
|
+
*/
|
|
11
|
+
gtagConsent: (..._args: unknown[]) => void;
|
|
12
|
+
/** Every signal the configured categories drive, at its pre-consent value. */
|
|
13
|
+
consentDefaults: (categories?: ConsentCategory[]) => Record<string, 'granted' | 'denied'>;
|
|
14
|
+
/** Every signal, at the value this record implies. */
|
|
15
|
+
consentUpdate: (record: ConsentRecord, categories?: ConsentCategory[]) => Record<string, 'granted' | 'denied'>;
|
|
16
|
+
/**
|
|
17
|
+
* Declare what is denied, before any tag can act.
|
|
18
|
+
*
|
|
19
|
+
* Idempotent through a window flag, because the page may carry this call twice — once inline in
|
|
20
|
+
* the document head, once from whatever bundle mounts the dialog — and a second `default` after a
|
|
21
|
+
* tag has loaded is worse than none: it can widen what was already narrowed.
|
|
22
|
+
*/
|
|
23
|
+
pushConsentDefaults: (opts?: ConsentOptions) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Apply a decision: globals first, then the signal update, then any per-category events.
|
|
26
|
+
*
|
|
27
|
+
* The order is load-bearing. A tag that fires on the update event reads the globals in the same
|
|
28
|
+
* turn, so writing them afterwards would let the first firing see the previous answer.
|
|
29
|
+
*/
|
|
30
|
+
applyConsent: (record: ConsentRecord, opts?: ConsentOptions) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Whether a stored decision grants tracking at all — a signal-bearing category, not merely the
|
|
33
|
+
* required essential one.
|
|
34
|
+
*
|
|
35
|
+
* "Signal-bearing" is what a required category can never be: it exists to gate whether a LOADER
|
|
36
|
+
* runs, and a required category is disclosure, not a question — everyone gets it. Only a category
|
|
37
|
+
* that both is optional and drives at least one Consent Mode signal counts, which is exactly what
|
|
38
|
+
* `googleTagHeadScript`'s `'basic'` mode gates a Google tag behind.
|
|
39
|
+
*/
|
|
40
|
+
trackingGranted: (record: ConsentRecord | null, categories?: ConsentCategory[]) => boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The inline script a document stamps ABOVE its tag-manager snippet.
|
|
43
|
+
*
|
|
44
|
+
* It exists because the defaults have to be on the queue before `gtm.js` loads, and a React bundle
|
|
45
|
+
* cannot be: by the time an island mounts, the container has been running for hundreds of
|
|
46
|
+
* milliseconds and has already decided what it may do. Emitting it from the HTML is the only
|
|
47
|
+
* ordering that holds — and it reads the stored record too, so a returning visitor's tags are not
|
|
48
|
+
* denied for the first paint of every page.
|
|
49
|
+
*/
|
|
50
|
+
consentBootstrapScript: (opts?: ConsentOptions) => string;
|
|
51
|
+
/**
|
|
52
|
+
* Withhold a loader until a stored or later decision grants tracking.
|
|
53
|
+
*
|
|
54
|
+
* The counterpart to `consentBootstrapScript` for the `'basic'` gated loading mode
|
|
55
|
+
* (`@owlmeans/web-gtm`'s `GOOGLE_TAG_DEFAULT_MODE`): where the bootstrap always declares Consent
|
|
56
|
+
* Mode's defaults so a tag may load cookieless, this withholds the tag itself — the loader string
|
|
57
|
+
* is only ever reached once `trackingGranted` is true, either because a returning visitor's stored
|
|
58
|
+
* record already says so, or because `applyConsent` later dispatches {@link CONSENT_EVENT} with
|
|
59
|
+
* one that does. The listener removes itself on the first passing event, so the loader — which
|
|
60
|
+
* marks its own element and refuses to run twice — is asked to run at most once from here.
|
|
61
|
+
*
|
|
62
|
+
* `loaderExpr` is a complete statement or expression that runs the loader when reached — the
|
|
63
|
+
* self-invoking IIFE string `googleTagHeadScript`'s `gtagScript`/`gtmContainerScript` already
|
|
64
|
+
* produce, embedded here verbatim rather than called. It is placed inline exactly as
|
|
65
|
+
* `consentBootstrapScript`'s own output is: dynamic values (the storage key, the category shape,
|
|
66
|
+
* the event name) are JSON-encoded so nothing configured can break out of a string literal, and
|
|
67
|
+
* escaping the RESULT for HTML (`</script`, `<!--`) is left to whoever composes the final inline
|
|
68
|
+
* script — the same discipline `consentBootstrapScript` follows, and `googleTagHeadScript` already
|
|
69
|
+
* applies to the whole script it stamps.
|
|
70
|
+
*/
|
|
71
|
+
consentGateScript: (loaderExpr: string, opts?: ConsentOptions & {
|
|
72
|
+
categories?: ConsentCategory[];
|
|
73
|
+
}) => string;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @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sourceRoot":"","sources":["../../src/gtm/types.ts"],"names":[],"mappings":""}
|
package/build/gtm.d.ts
CHANGED
|
@@ -1,72 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* `gtag.js` itself emits, and a page that carries both this and Google's snippet should not have
|
|
7
|
-
* two shapes in one queue.
|
|
8
|
-
*/
|
|
9
|
-
export declare function gtagConsent(..._args: unknown[]): void;
|
|
10
|
-
/** Every signal the configured categories drive, at its pre-consent value. */
|
|
11
|
-
export declare const consentDefaults: (categories?: ConsentCategory[]) => Record<string, 'granted' | 'denied'>;
|
|
12
|
-
/** Every signal, at the value this record implies. */
|
|
13
|
-
export declare const consentUpdate: (record: ConsentRecord, categories?: ConsentCategory[]) => Record<string, 'granted' | 'denied'>;
|
|
14
|
-
/**
|
|
15
|
-
* Declare what is denied, before any tag can act.
|
|
16
|
-
*
|
|
17
|
-
* Idempotent through a window flag, because the page may carry this call twice — once inline in
|
|
18
|
-
* the document head, once from whatever bundle mounts the dialog — and a second `default` after a
|
|
19
|
-
* tag has loaded is worse than none: it can widen what was already narrowed.
|
|
20
|
-
*/
|
|
21
|
-
export declare const pushConsentDefaults: (opts?: ConsentOptions) => void;
|
|
22
|
-
/**
|
|
23
|
-
* Apply a decision: globals first, then the signal update, then any per-category events.
|
|
24
|
-
*
|
|
25
|
-
* The order is load-bearing. A tag that fires on the update event reads the globals in the same
|
|
26
|
-
* turn, so writing them afterwards would let the first firing see the previous answer.
|
|
27
|
-
*/
|
|
28
|
-
export declare const applyConsent: (record: ConsentRecord, opts?: ConsentOptions) => void;
|
|
29
|
-
/**
|
|
30
|
-
* Whether a stored decision grants tracking at all — a signal-bearing category, not merely the
|
|
31
|
-
* required essential one.
|
|
32
|
-
*
|
|
33
|
-
* "Signal-bearing" is what a required category can never be: it exists to gate whether a LOADER
|
|
34
|
-
* runs, and a required category is disclosure, not a question — everyone gets it. Only a category
|
|
35
|
-
* that both is optional and drives at least one Consent Mode signal counts, which is exactly what
|
|
36
|
-
* `googleTagHeadScript`'s `'basic'` mode gates a Google tag behind.
|
|
37
|
-
*/
|
|
38
|
-
export declare const trackingGranted: (record: ConsentRecord | null, categories?: ConsentCategory[]) => boolean;
|
|
39
|
-
/**
|
|
40
|
-
* The inline script a document stamps ABOVE its tag-manager snippet.
|
|
41
|
-
*
|
|
42
|
-
* It exists because the defaults have to be on the queue before `gtm.js` loads, and a React bundle
|
|
43
|
-
* cannot be: by the time an island mounts, the container has been running for hundreds of
|
|
44
|
-
* milliseconds and has already decided what it may do. Emitting it from the HTML is the only
|
|
45
|
-
* ordering that holds — and it reads the stored record too, so a returning visitor's tags are not
|
|
46
|
-
* denied for the first paint of every page.
|
|
47
|
-
*/
|
|
1
|
+
import type { ConsentOptions } from './types.js';
|
|
2
|
+
import type { ConsentModeHelper } from './gtm/types.js';
|
|
3
|
+
export declare const createConsentModeHelper: () => ConsentModeHelper;
|
|
4
|
+
export declare const consentModeHelper: ConsentModeHelper;
|
|
5
|
+
/** @deprecated compat:factory-refactor — use `consentModeHelper.consentBootstrapScript(…)` */
|
|
48
6
|
export declare const consentBootstrapScript: (opts?: ConsentOptions) => string;
|
|
49
|
-
/**
|
|
50
|
-
* Withhold a loader until a stored or later decision grants tracking.
|
|
51
|
-
*
|
|
52
|
-
* The counterpart to `consentBootstrapScript` for the `'basic'` gated loading mode
|
|
53
|
-
* (`@owlmeans/web-gtm`'s `GOOGLE_TAG_DEFAULT_MODE`): where the bootstrap always declares Consent
|
|
54
|
-
* Mode's defaults so a tag may load cookieless, this withholds the tag itself — the loader string
|
|
55
|
-
* is only ever reached once `trackingGranted` is true, either because a returning visitor's stored
|
|
56
|
-
* record already says so, or because `applyConsent` later dispatches {@link CONSENT_EVENT} with
|
|
57
|
-
* one that does. The listener removes itself on the first passing event, so the loader — which
|
|
58
|
-
* marks its own element and refuses to run twice — is asked to run at most once from here.
|
|
59
|
-
*
|
|
60
|
-
* `loaderExpr` is a complete statement or expression that runs the loader when reached — the
|
|
61
|
-
* self-invoking IIFE string `googleTagHeadScript`'s `gtagScript`/`gtmContainerScript` already
|
|
62
|
-
* produce, embedded here verbatim rather than called. It is placed inline exactly as
|
|
63
|
-
* `consentBootstrapScript`'s own output is: dynamic values (the storage key, the category shape,
|
|
64
|
-
* the event name) are JSON-encoded so nothing configured can break out of a string literal, and
|
|
65
|
-
* escaping the RESULT for HTML (`</script`, `<!--`) is left to whoever composes the final inline
|
|
66
|
-
* script — the same discipline `consentBootstrapScript` follows, and `googleTagHeadScript` already
|
|
67
|
-
* applies to the whole script it stamps.
|
|
68
|
-
*/
|
|
69
|
-
export declare const consentGateScript: (loaderExpr: string, opts?: ConsentOptions & {
|
|
70
|
-
categories?: ConsentCategory[];
|
|
71
|
-
}) => string;
|
|
72
7
|
//# sourceMappingURL=gtm.d.ts.map
|
package/build/gtm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gtm.d.ts","sourceRoot":"","sources":["../src/gtm.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"gtm.d.ts","sourceRoot":"","sources":["../src/gtm.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAmB,cAAc,EAAiB,MAAM,YAAY,CAAA;AAEhF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAEvD,eAAO,MAAM,uBAAuB,QAAO,iBA2J1C,CAAA;AAED,eAAO,MAAM,iBAAiB,mBAA4B,CAAA;AAE1D,8FAA8F;AAC9F,eAAO,MAAM,sBAAsB,UAAW,cAAc,KAAG,MAAwD,CAAA"}
|
package/build/gtm.js
CHANGED
|
@@ -1,182 +1,132 @@
|
|
|
1
1
|
import { CONSENT_EVENT, CONSENT_KEY, CONSENT_SETUP_FLAG, CONSENT_SIGNAL_DEFAULTS, DEFAULT_CONSENT_CATEGORIES, } from './consts.js';
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*/
|
|
11
|
-
export function gtagConsent(..._args) {
|
|
12
|
-
const win = global();
|
|
13
|
-
if (win == null) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
win.dataLayer = win.dataLayer ?? [];
|
|
17
|
-
// `arguments`, not `_args`. The rest parameter is only here to type the call sites; what goes on
|
|
18
|
-
// the queue must be the arguments object itself.
|
|
19
|
-
// eslint-disable-next-line prefer-rest-params
|
|
20
|
-
win.dataLayer.push(arguments);
|
|
21
|
-
}
|
|
22
|
-
const categoriesOf = (opts) => opts?.categories ?? DEFAULT_CONSENT_CATEGORIES;
|
|
23
|
-
/** Every signal the configured categories drive, at its pre-consent value. */
|
|
24
|
-
export const consentDefaults = (categories) => {
|
|
25
|
-
const used = new Set((categories ?? DEFAULT_CONSENT_CATEGORIES)
|
|
26
|
-
.flatMap(category => category.signals ?? []));
|
|
27
|
-
return Object.fromEntries(Object.entries(CONSENT_SIGNAL_DEFAULTS)
|
|
28
|
-
.filter(([signal]) => used.has(signal)));
|
|
29
|
-
};
|
|
30
|
-
/** Every signal, at the value this record implies. */
|
|
31
|
-
export const consentUpdate = (record, categories) => {
|
|
32
|
-
const update = {};
|
|
33
|
-
for (const category of categories ?? DEFAULT_CONSENT_CATEGORIES) {
|
|
34
|
-
const granted = category.required === true || record[category.key] === true;
|
|
35
|
-
for (const signal of category.signals ?? []) {
|
|
36
|
-
// A signal named by two categories is granted only when every one of them is.
|
|
37
|
-
update[signal] = granted && update[signal] !== 'denied' ? 'granted' : 'denied';
|
|
2
|
+
import { consentLinkHelper } from './linker.js';
|
|
3
|
+
export const createConsentModeHelper = () => {
|
|
4
|
+
const global = () => typeof window !== 'undefined' ? window : null;
|
|
5
|
+
// A `function`, not an arrow: what goes on the queue is its own `arguments` object.
|
|
6
|
+
function gtagConsent(..._args) {
|
|
7
|
+
const win = global();
|
|
8
|
+
if (win == null) {
|
|
9
|
+
return;
|
|
38
10
|
}
|
|
11
|
+
win.dataLayer = win.dataLayer ?? [];
|
|
12
|
+
// `arguments`, not `_args`. The rest parameter is only here to type the call sites; what goes on
|
|
13
|
+
// the queue must be the arguments object itself.
|
|
14
|
+
// eslint-disable-next-line prefer-rest-params
|
|
15
|
+
win.dataLayer.push(arguments);
|
|
39
16
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
win[CONSENT_SETUP_FLAG] = true;
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Apply a decision: globals first, then the signal update, then any per-category events.
|
|
59
|
-
*
|
|
60
|
-
* The order is load-bearing. A tag that fires on the update event reads the globals in the same
|
|
61
|
-
* turn, so writing them afterwards would let the first firing see the previous answer.
|
|
62
|
-
*/
|
|
63
|
-
export const applyConsent = (record, opts) => {
|
|
64
|
-
const win = global();
|
|
65
|
-
if (win == null || opts?.silent === true) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
const categories = categoriesOf(opts);
|
|
69
|
-
for (const category of categories) {
|
|
70
|
-
if (category.globalVar != null) {
|
|
71
|
-
win[category.globalVar] = category.required === true || record[category.key] === true;
|
|
17
|
+
const categoriesOf = (opts) => opts?.categories ?? DEFAULT_CONSENT_CATEGORIES;
|
|
18
|
+
const consentDefaults = (categories) => {
|
|
19
|
+
const used = new Set((categories ?? DEFAULT_CONSENT_CATEGORIES)
|
|
20
|
+
.flatMap(category => category.signals ?? []));
|
|
21
|
+
return Object.fromEntries(Object.entries(CONSENT_SIGNAL_DEFAULTS)
|
|
22
|
+
.filter(([signal]) => used.has(signal)));
|
|
23
|
+
};
|
|
24
|
+
const consentUpdate = (record, categories) => {
|
|
25
|
+
const update = {};
|
|
26
|
+
for (const category of categories ?? DEFAULT_CONSENT_CATEGORIES) {
|
|
27
|
+
const granted = category.required === true || record[category.key] === true;
|
|
28
|
+
for (const signal of category.signals ?? []) {
|
|
29
|
+
// A signal named by two categories is granted only when every one of them is.
|
|
30
|
+
update[signal] = granted && update[signal] !== 'denied' ? 'granted' : 'denied';
|
|
31
|
+
}
|
|
72
32
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
33
|
+
return update;
|
|
34
|
+
};
|
|
35
|
+
const pushConsentDefaults = (opts) => {
|
|
36
|
+
const win = global();
|
|
37
|
+
if (win == null || opts?.silent === true || win[CONSENT_SETUP_FLAG] === true) {
|
|
38
|
+
return;
|
|
79
39
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
`
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
`function ok(r){if(!r)return false;var cs=${gate};` +
|
|
169
|
-
`for(var i=0;i<cs.length;i++){var c=cs[i];` +
|
|
170
|
-
`if(!c.required&&c.hasSignal&&r[c.key]===true)return true}return false}` +
|
|
171
|
-
`function load(){${loaderExpr}}` +
|
|
172
|
-
`var raw=null;try{raw=w.localStorage.getItem(${storageKey})}catch(e){}` +
|
|
173
|
-
`if(!raw){var p=('; '+d.cookie).split('; '+${storageKey}+'=');` +
|
|
174
|
-
`if(p.length===2){raw=p.pop().split(';').shift()}}` +
|
|
175
|
-
`var r=null;if(raw){try{r=JSON.parse(raw)}catch(e){r=null}}` +
|
|
176
|
-
`if(ok(r)){load();return}` +
|
|
177
|
-
`function h(ev){if(ok(ev&&ev.detail&&ev.detail.record)){` +
|
|
178
|
-
`w.removeEventListener(${event},h);load()}}` +
|
|
179
|
-
`w.addEventListener(${event},h)` +
|
|
180
|
-
`})(window,document)`;
|
|
40
|
+
gtagConsent('consent', 'default', consentDefaults(categoriesOf(opts)));
|
|
41
|
+
win[CONSENT_SETUP_FLAG] = true;
|
|
42
|
+
};
|
|
43
|
+
const applyConsent = (record, opts) => {
|
|
44
|
+
const win = global();
|
|
45
|
+
if (win == null || opts?.silent === true) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const categories = categoriesOf(opts);
|
|
49
|
+
for (const category of categories) {
|
|
50
|
+
if (category.globalVar != null) {
|
|
51
|
+
win[category.globalVar] = category.required === true || record[category.key] === true;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
gtagConsent('consent', 'update', consentUpdate(record, categories));
|
|
55
|
+
for (const category of categories) {
|
|
56
|
+
if (category.event != null && (category.required === true || record[category.key] === true)) {
|
|
57
|
+
win.dataLayer = win.dataLayer ?? [];
|
|
58
|
+
win.dataLayer.push({ event: category.event });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// A gate script (`consentGateScript`) that already decided NOT to load, because nothing was
|
|
62
|
+
// granted at the time it ran, has no other way to hear this. Consent Mode itself speaks only on
|
|
63
|
+
// `dataLayer`, which a tag that never loaded is not listening to.
|
|
64
|
+
if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function'
|
|
65
|
+
&& typeof CustomEvent === 'function') {
|
|
66
|
+
window.dispatchEvent(new CustomEvent(CONSENT_EVENT, { detail: { record } }));
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const trackingGranted = (record, categories = DEFAULT_CONSENT_CATEGORIES) => record != null && categories.some(category => !category.required && (category.signals?.length ?? 0) > 0 && record[category.key] === true);
|
|
70
|
+
const consentBootstrapScript = (opts) => {
|
|
71
|
+
const defaults = JSON.stringify(consentDefaults(categoriesOf(opts)));
|
|
72
|
+
const categories = JSON.stringify(categoriesOf(opts).map(category => ({
|
|
73
|
+
key: category.key,
|
|
74
|
+
required: category.required === true,
|
|
75
|
+
signals: category.signals ?? [],
|
|
76
|
+
globalVar: category.globalVar ?? null,
|
|
77
|
+
})));
|
|
78
|
+
const storageKey = JSON.stringify(opts?.storageKey ?? CONSENT_KEY);
|
|
79
|
+
const flag = JSON.stringify(CONSENT_SETUP_FLAG);
|
|
80
|
+
// Right after the default is pushed and before EITHER storage read below (this one, and the
|
|
81
|
+
// `consentGateScript` that is concatenated after this whole IIFE) — an adopted decision must
|
|
82
|
+
// already be in storage by the time anything reads it, so `gtm.js`'s own `page_view` never sees
|
|
83
|
+
// the parameter and a granted decision loads the tag on arrival. A page with no `opts.linker`
|
|
84
|
+
// gets an empty string here, unchanged from before this existed.
|
|
85
|
+
const linker = opts?.linker != null ? `${consentLinkHelper.consentLinkerScript(opts)};` : '';
|
|
86
|
+
return `(function(w,d){` +
|
|
87
|
+
`w.dataLayer=w.dataLayer||[];function g(){w.dataLayer.push(arguments)}` +
|
|
88
|
+
`if(w[${flag}])return;g('consent','default',${defaults});w[${flag}]=true;` +
|
|
89
|
+
linker +
|
|
90
|
+
`var raw=null;try{raw=w.localStorage.getItem(${storageKey})}catch(e){}` +
|
|
91
|
+
`if(!raw){var p=('; '+d.cookie).split('; '+${storageKey}+'=');` +
|
|
92
|
+
`if(p.length===2){raw=p.pop().split(';').shift()}}` +
|
|
93
|
+
`if(!raw)return;var r;try{r=JSON.parse(raw)}catch(e){return}` +
|
|
94
|
+
`var cs=${categories},u={};` +
|
|
95
|
+
`for(var i=0;i<cs.length;i++){var c=cs[i];var ok=c.required||r[c.key]===true;` +
|
|
96
|
+
`if(c.globalVar){w[c.globalVar]=ok}` +
|
|
97
|
+
`for(var j=0;j<c.signals.length;j++){var s=c.signals[j];` +
|
|
98
|
+
`u[s]=ok&&u[s]!=='denied'?'granted':'denied'}}` +
|
|
99
|
+
`g('consent','update',u)})(window,document)`;
|
|
100
|
+
};
|
|
101
|
+
const consentGateScript = (loaderExpr, opts) => {
|
|
102
|
+
const gate = JSON.stringify(categoriesOf(opts).map(category => ({
|
|
103
|
+
key: category.key,
|
|
104
|
+
required: category.required === true,
|
|
105
|
+
hasSignal: (category.signals ?? []).length > 0,
|
|
106
|
+
})));
|
|
107
|
+
const storageKey = JSON.stringify(opts?.storageKey ?? CONSENT_KEY);
|
|
108
|
+
const event = JSON.stringify(CONSENT_EVENT);
|
|
109
|
+
return `(function(w,d){` +
|
|
110
|
+
`function ok(r){if(!r)return false;var cs=${gate};` +
|
|
111
|
+
`for(var i=0;i<cs.length;i++){var c=cs[i];` +
|
|
112
|
+
`if(!c.required&&c.hasSignal&&r[c.key]===true)return true}return false}` +
|
|
113
|
+
`function load(){${loaderExpr}}` +
|
|
114
|
+
`var raw=null;try{raw=w.localStorage.getItem(${storageKey})}catch(e){}` +
|
|
115
|
+
`if(!raw){var p=('; '+d.cookie).split('; '+${storageKey}+'=');` +
|
|
116
|
+
`if(p.length===2){raw=p.pop().split(';').shift()}}` +
|
|
117
|
+
`var r=null;if(raw){try{r=JSON.parse(raw)}catch(e){r=null}}` +
|
|
118
|
+
`if(ok(r)){load();return}` +
|
|
119
|
+
`function h(ev){if(ok(ev&&ev.detail&&ev.detail.record)){` +
|
|
120
|
+
`w.removeEventListener(${event},h);load()}}` +
|
|
121
|
+
`w.addEventListener(${event},h)` +
|
|
122
|
+
`})(window,document)`;
|
|
123
|
+
};
|
|
124
|
+
return {
|
|
125
|
+
gtagConsent, consentDefaults, consentUpdate, pushConsentDefaults, applyConsent, trackingGranted,
|
|
126
|
+
consentBootstrapScript, consentGateScript,
|
|
127
|
+
};
|
|
181
128
|
};
|
|
129
|
+
export const consentModeHelper = createConsentModeHelper();
|
|
130
|
+
/** @deprecated compat:factory-refactor — use `consentModeHelper.consentBootstrapScript(…)` */
|
|
131
|
+
export const consentBootstrapScript = (opts) => consentModeHelper.consentBootstrapScript(opts);
|
|
182
132
|
//# sourceMappingURL=gtm.js.map
|
package/build/gtm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gtm.js","sourceRoot":"","sources":["../src/gtm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAAE,WAAW,EAAE,kBAAkB,EAAE,uBAAuB,EACvE,0BAA0B,GAC3B,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"gtm.js","sourceRoot":"","sources":["../src/gtm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAAE,WAAW,EAAE,kBAAkB,EAAE,uBAAuB,EACvE,0BAA0B,GAC3B,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,iBAAi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Locale } 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
|