@owlmeans/consent 0.1.18-rc.9 → 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 +78 -3
- package/build/consts.d.ts.map +1 -1
- package/build/consts.js +104 -0
- 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 +8 -1
- package/build/i18n/de.json +8 -1
- package/build/i18n/en.json +8 -1
- package/build/i18n/es.json +8 -1
- package/build/i18n/fr.json +8 -1
- package/build/i18n/pl.json +8 -1
- package/build/i18n/ru.json +8 -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/uk.json +8 -1
- 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 -5
- package/build/index.d.ts.map +1 -1
- package/build/index.js +5 -3
- 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 -74
- package/build/linker.d.ts.map +1 -1
- package/build/linker.js +290 -324
- 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 -68
- package/build/plugins.d.ts.map +1 -1
- package/build/plugins.js +73 -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 +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 +115 -31
- package/build/store.js.map +1 -1
- package/build/types.d.ts +141 -5
- 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 +120 -3
- 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 +8 -1
- package/src/i18n/de.json +8 -1
- package/src/i18n/en.json +8 -1
- package/src/i18n/es.json +8 -1
- package/src/i18n/fr.json +8 -1
- package/src/i18n/pl.json +8 -1
- package/src/i18n/ru.json +8 -1
- package/src/i18n/types.ts +11 -0
- package/src/i18n/uk.json +8 -1
- package/src/i18n.ts +20 -32
- package/src/index.ts +13 -12
- package/src/linker/types.ts +59 -0
- package/src/linker.ts +301 -349
- package/src/plugins/types.ts +42 -0
- package/src/plugins.ts +82 -105
- package/src/storage/types.ts +31 -0
- package/src/storage.ts +75 -77
- package/src/store.ts +125 -31
- package/src/types.local.ts +9 -0
- package/src/types.ts +148 -5
- package/tests/consent.spec.ts +26 -28
- package/tests/geo.spec.ts +474 -0
- package/tests/linker.spec.ts +68 -74
- package/tests/tracking.spec.ts +14 -14
- 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/gtm.ts +0 -220
package/build/linker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linker.js","sourceRoot":"","sources":["../src/linker.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAAE,WAAW,EAAE,oBAAoB,EAAE,sBAAsB,EAC9E,0BAA0B,GAC3B,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAG1C,sFAAsF;AACtF,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAA;AACzC,wGAAwG;AACxG,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAA;AACvC,oGAAoG;AACpG,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAA;AAEnC,MAAM,oBAAoB,GAAG,CAAC,CAAA;AAiB9B,wGAAwG;AACxG,MAAM,YAAY,GAAG,yCAAyC,CAAA;AAE9D,MAAM,YAAY,GAAG,CAAC,IAAqB,EAAqB,EAAE,CAChE,IAAI,EAAE,UAAU,IAAI,0BAA0B,CAAA;AAEhD,MAAM,UAAU,GAAG,CAAC,IAAqB,EAAqB,EAAE,CAC9D,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAA;AAEnE,MAAM,WAAW,GAAG,CAAC,IAAY,EAAU,EAAE,CAC3C,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE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9D,YAAY,OAAO,yBAAyB;YAC5C,yDAAyD,UAAU,cAAc;YACjF,mDAAmD,UAAU,QAAQ;YACnE,wDAAwD;YAC1D,2FAA2F;YAC3F,0EAA0E;YAC1E,iDAAiD;YAC/C,YAAY,YAAY,WAAW;YACnC,wFAAwF;YACxF,SAAS;YACP,YAAY,aAAa,WAAW,OAAO,IAAI;YAC/C,qFAAqF;YACrF,8BAA8B;YAC9B,8BAA8B,UAAU,kBAAkB;YAC1D,+BAA+B,UAAU,2BAA2B;YACpE,YAAY,UAAU,iDAAiD;YACzE,GAAG;YACL,GAAG;YACH,QAAQ;YACV,aAAa;YACf,qBAAqB,CAAA;IACvB,CAAC,CAAA;IAED,OAAO;QACL,iBAAiB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,aAAa,EAAE,qBAAqB;QAChG,mBAAmB;KACpB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,uBAAuB,EAAE,CAAA;AAE1D,yFAAyF;AACzF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAA4B,EAAE,IAAqB,EAAU,EAAE,CAC/F,iBAAiB,CAAC,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;AAEnD,2FAA2F;AAC3F,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAoB,EAAU,EAAE,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ConsentGeoLocation, ConsentOptions, ConsentPlugin, ConsentRecord } from '../types.js';
|
|
2
|
+
/** The document's consent-plugin registry and the hooks run over every registered plugin. */
|
|
3
|
+
export interface ConsentPluginHelper {
|
|
4
|
+
/** Register a plugin. Replace-by-alias; sorted by priority (higher first) on every read. */
|
|
5
|
+
registerConsentPlugin: (plugin: ConsentPlugin) => void;
|
|
6
|
+
/** Remove a plugin by alias — for a test, or an application tearing a locator down. */
|
|
7
|
+
unregisterConsentPlugin: (alias: string) => void;
|
|
8
|
+
/** Every registered plugin, priority-sorted (higher first, ties keep insertion order). */
|
|
9
|
+
consentPlugins: () => ConsentPlugin[];
|
|
10
|
+
/**
|
|
11
|
+
* Ask every registered plugin to decorate `url` with this document's decision, in priority order,
|
|
12
|
+
* stopping at the first one that actually changes it. A plugin whose own rules refuse (a foreign
|
|
13
|
+
* host, a `noreferrer` link, no local decision yet) returns `null` and is skipped, not an error.
|
|
14
|
+
*/
|
|
15
|
+
decorateConsentUrl: (url: string | URL, record: ConsentRecord | null, opts: ConsentOptions) => URL;
|
|
16
|
+
/**
|
|
17
|
+
* Every domain this document's decision is disclosed to, current host first, deduplicated — what a
|
|
18
|
+
* dialog or a policy page lists. A plugin that runs on this host but names no domains of its own
|
|
19
|
+
* (nothing registered, or `domains` not implemented) leaves the list at just the current host,
|
|
20
|
+
* which is always correct to show even with no plugin at all.
|
|
21
|
+
*/
|
|
22
|
+
consentDomains: (opts: ConsentOptions) => string[];
|
|
23
|
+
/** Try every registered plugin's `adopt`, in priority order, and use the first decision offered. */
|
|
24
|
+
adoptConsent: (opts: ConsentOptions) => ConsentRecord | null;
|
|
25
|
+
/**
|
|
26
|
+
* Try every registered plugin's `adoptLanguage`, in priority order, and use the first language
|
|
27
|
+
* offered. The caller persists it (`writeConsentLanguage`) — and has to do that BEFORE its i18n
|
|
28
|
+
* layer reads storage, which is why the inline `<head>` fragment (`consentLinkerScript`) is the
|
|
29
|
+
* one that normally does.
|
|
30
|
+
*/
|
|
31
|
+
adoptConsentLanguage: (opts: ConsentOptions) => string | null;
|
|
32
|
+
/** Run every registered plugin's `start`, in priority order. `consentStore.init` calls this once. */
|
|
33
|
+
startConsentPlugins: (opts: ConsentOptions) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Ask every registered plugin's `locate`, in priority order, for the visitor's country: the first
|
|
36
|
+
* usable ISO alpha-2 code wins (upper-cased). A throw, or a code that names no country
|
|
37
|
+
* (`CONSENT_GEO_UNKNOWN`, anything malformed), hands over to the next locator; with none left it
|
|
38
|
+
* rejects with the last failure. Timeouts are the caller's (`consentGeoHelper.decide`).
|
|
39
|
+
*/
|
|
40
|
+
locateConsent: (opts: ConsentOptions) => Promise<ConsentGeoLocation>;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/plugins/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEnG,6FAA6F;AAC7F,MAAM,WAAW,mBAAmB;IAClC,4FAA4F;IAC5F,qBAAqB,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAA;IACtD,uFAAuF;IACvF,uBAAuB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAChD,0FAA0F;IAC1F,cAAc,EAAE,MAAM,aAAa,EAAE,CAAA;IACrC;;;;OAIG;IACH,kBAAkB,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,EAAE,IAAI,EAAE,cAAc,KAAK,GAAG,CAAA;IAClG;;;;;OAKG;IACH,cAAc,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,MAAM,EAAE,CAAA;IAClD,oGAAoG;IACpG,YAAY,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,aAAa,GAAG,IAAI,CAAA;IAC5D;;;;;OAKG;IACH,oBAAoB,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,MAAM,GAAG,IAAI,CAAA;IAC7D,qGAAqG;IACrG,mBAAmB,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAA;IACnD;;;;;OAKG;IACH,aAAa,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAA;CACrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/plugins/types.ts"],"names":[],"mappings":""}
|
package/build/plugins.d.ts
CHANGED
|
@@ -1,71 +1,7 @@
|
|
|
1
1
|
import type { ConsentOptions, ConsentRecord } from './types.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
* `consentLinker` (`./linker.js`) is the one built-in plugin — cross-domain consent through
|
|
8
|
-
* decorated links — but nothing here is specific to it. A registry rather than a fixed option on
|
|
9
|
-
* `ConsentOptions` because the store has zero dependencies today and stays that way: a plugin is
|
|
10
|
-
* opt-in code an application imports for its own reason, never a bundled feature this package
|
|
11
|
-
* pulls in whether or not anything uses it.
|
|
12
|
-
*/
|
|
13
|
-
export interface ConsentPlugin {
|
|
14
|
-
/** Stable identity. Registering the same alias again REPLACES the earlier plugin. */
|
|
15
|
-
alias: string;
|
|
16
|
-
/** Run order when more than one plugin implements the same hook. Higher first. Defaults to 0. */
|
|
17
|
-
priority?: number;
|
|
18
|
-
/** Installed once, the first time `consentStore.init` runs with this plugin registered. */
|
|
19
|
-
start?: (opts: ConsentOptions) => void;
|
|
20
|
-
/**
|
|
21
|
-
* Offer a decision from outside this document's own storage — e.g. one carried on the URL that
|
|
22
|
-
* led here. Returns a full record to adopt, or `null` to defer to the next plugin / the ordinary
|
|
23
|
-
* "ask" path. Never called once a stored record already exists.
|
|
24
|
-
*/
|
|
25
|
-
adopt?: (opts: ConsentOptions) => ConsentRecord | null;
|
|
26
|
-
/**
|
|
27
|
-
* Offer an interface language from outside this document's own storage — e.g. the one the page
|
|
28
|
-
* that led here was read in. Returns a language the application supports, or `null` to keep
|
|
29
|
-
* choosing its own. Only a CANDIDATE: it says what the link carried, and `writeConsentLanguage`
|
|
30
|
-
* stores it — unconditionally, since the interface language is strictly necessary storage.
|
|
31
|
-
*/
|
|
32
|
-
adoptLanguage?: (opts: ConsentOptions) => string | null;
|
|
33
|
-
/**
|
|
34
|
-
* Rewrite an outgoing URL to carry this document's current decision — and its language — or
|
|
35
|
-
* `null` to leave it untouched (a foreign host, a link that opts out, nothing to carry yet).
|
|
36
|
-
* `record` is `null` while the visitor has not decided: a plugin that also carries something
|
|
37
|
-
* else (the language) still has a reason to decorate then.
|
|
38
|
-
*/
|
|
39
|
-
decorate?: (url: URL, record: ConsentRecord | null, opts: ConsentOptions) => URL | null;
|
|
40
|
-
/** Extra domains this decision is understood to apply to, for disclosure — never deduplicated here. */
|
|
41
|
-
domains?: (opts: ConsentOptions) => string[];
|
|
42
|
-
}
|
|
43
|
-
/** Register a plugin. Replace-by-alias; sorted by priority (higher first) on every read. */
|
|
44
|
-
export declare const registerConsentPlugin: (plugin: ConsentPlugin) => void;
|
|
45
|
-
/** Every registered plugin, priority-sorted (higher first, ties keep insertion order). */
|
|
46
|
-
export declare const consentPlugins: () => ConsentPlugin[];
|
|
47
|
-
/**
|
|
48
|
-
* Ask every registered plugin to decorate `url` with this document's decision, in priority order,
|
|
49
|
-
* stopping at the first one that actually changes it. A plugin whose own rules refuse (a foreign
|
|
50
|
-
* host, a `noreferrer` link, no local decision yet) returns `null` and is skipped, not an error.
|
|
51
|
-
*/
|
|
2
|
+
import type { ConsentPluginHelper } from './plugins/types.js';
|
|
3
|
+
export declare const createConsentPluginHelper: () => ConsentPluginHelper;
|
|
4
|
+
export declare const consentPluginHelper: ConsentPluginHelper;
|
|
5
|
+
/** @deprecated compat:factory-refactor — use `consentPluginHelper.decorateConsentUrl(…)` */
|
|
52
6
|
export declare const decorateConsentUrl: (url: string | URL, record: ConsentRecord | null, opts: ConsentOptions) => URL;
|
|
53
|
-
/**
|
|
54
|
-
* Every domain this document's decision is disclosed to, current host first, deduplicated — what a
|
|
55
|
-
* dialog or a policy page lists. A plugin that runs on this host but names no domains of its own
|
|
56
|
-
* (nothing registered, or `domains` not implemented) leaves the list at just the current host,
|
|
57
|
-
* which is always correct to show even with no plugin at all.
|
|
58
|
-
*/
|
|
59
|
-
export declare const consentDomains: (opts: ConsentOptions) => string[];
|
|
60
|
-
/** Try every registered plugin's `adopt`, in priority order, and use the first decision offered. */
|
|
61
|
-
export declare const adoptConsent: (opts: ConsentOptions) => ConsentRecord | null;
|
|
62
|
-
/**
|
|
63
|
-
* Try every registered plugin's `adoptLanguage`, in priority order, and use the first language
|
|
64
|
-
* offered. The caller persists it (`writeConsentLanguage`) — and has to do that BEFORE its i18n
|
|
65
|
-
* layer reads storage, which is why the inline `<head>` fragment (`consentLinkerScript`) is the
|
|
66
|
-
* one that normally does.
|
|
67
|
-
*/
|
|
68
|
-
export declare const adoptConsentLanguage: (opts: ConsentOptions) => string | null;
|
|
69
|
-
/** Run every registered plugin's `start`, in priority order. `consentStore.init` calls this once. */
|
|
70
|
-
export declare const startConsentPlugins: (opts: ConsentOptions) => void;
|
|
71
7
|
//# sourceMappingURL=plugins.d.ts.map
|
package/build/plugins.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../src/plugins.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../src/plugins.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAsB,cAAc,EAAE,aAAa,EAAiB,MAAM,YAAY,CAAA;AAClG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAS7D,eAAO,MAAM,yBAAyB,QAAO,mBAwF5C,CAAA;AAED,eAAO,MAAM,mBAAmB,qBAA8B,CAAA;AAE9D,4FAA4F;AAC5F,eAAO,MAAM,kBAAkB,QAAS,MAAM,GAAG,GAAG,UAAU,aAAa,GAAG,IAAI,QAAQ,cAAc,KAAG,GAChD,CAAA"}
|
package/build/plugins.js
CHANGED
|
@@ -1,73 +1,85 @@
|
|
|
1
|
+
import { CONSENT_GEO_UNKNOWN } from './consts.js';
|
|
2
|
+
import { COUNTRY_CODE } from './consts.local.js';
|
|
1
3
|
/**
|
|
2
4
|
* Module-global by design, like `@owlmeans/client-auth/login`'s method/step registries: consent is
|
|
3
5
|
* one thing per document, not per component tree, and a plugin is installed once at bundle scope
|
|
4
6
|
* (an Astro island, a script tag, a React app) regardless of how many components read the store.
|
|
5
7
|
*/
|
|
6
8
|
const plugins = new Map();
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
9
|
+
export const createConsentPluginHelper = () => {
|
|
10
|
+
const registerConsentPlugin = (plugin) => {
|
|
11
|
+
plugins.set(plugin.alias, plugin);
|
|
12
|
+
};
|
|
13
|
+
const unregisterConsentPlugin = (alias) => {
|
|
14
|
+
plugins.delete(alias);
|
|
15
|
+
};
|
|
16
|
+
const consentPlugins = () => [...plugins.values()].sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
17
|
+
const decorateConsentUrl = (url, record, opts) => {
|
|
18
|
+
let result = url instanceof URL ? url : new URL(url);
|
|
19
|
+
for (const plugin of consentPlugins()) {
|
|
20
|
+
if (plugin.decorate == null) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
const decorated = plugin.decorate(result, record, opts);
|
|
24
|
+
if (decorated != null) {
|
|
25
|
+
result = decorated;
|
|
26
|
+
}
|
|
23
27
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
return result;
|
|
29
|
+
};
|
|
30
|
+
const consentDomains = (opts) => {
|
|
31
|
+
const host = typeof location !== 'undefined' ? location.hostname : '';
|
|
32
|
+
const named = consentPlugins().flatMap(plugin => plugin.domains?.(opts) ?? []);
|
|
33
|
+
return [...new Set([host, ...named].filter(domain => domain !== ''))];
|
|
34
|
+
};
|
|
35
|
+
const adoptConsent = (opts) => {
|
|
36
|
+
for (const plugin of consentPlugins()) {
|
|
37
|
+
const adopted = plugin.adopt?.(opts);
|
|
38
|
+
if (adopted != null) {
|
|
39
|
+
return adopted;
|
|
40
|
+
}
|
|
27
41
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
*/
|
|
37
|
-
export const consentDomains = (opts) => {
|
|
38
|
-
const host = typeof location !== 'undefined' ? location.hostname : '';
|
|
39
|
-
const named = consentPlugins().flatMap(plugin => plugin.domains?.(opts) ?? []);
|
|
40
|
-
return [...new Set([host, ...named].filter(domain => domain !== ''))];
|
|
41
|
-
};
|
|
42
|
-
/** Try every registered plugin's `adopt`, in priority order, and use the first decision offered. */
|
|
43
|
-
export const adoptConsent = (opts) => {
|
|
44
|
-
for (const plugin of consentPlugins()) {
|
|
45
|
-
const adopted = plugin.adopt?.(opts);
|
|
46
|
-
if (adopted != null) {
|
|
47
|
-
return adopted;
|
|
42
|
+
return null;
|
|
43
|
+
};
|
|
44
|
+
const adoptConsentLanguage = (opts) => {
|
|
45
|
+
for (const plugin of consentPlugins()) {
|
|
46
|
+
const adopted = plugin.adoptLanguage?.(opts);
|
|
47
|
+
if (adopted != null) {
|
|
48
|
+
return adopted;
|
|
49
|
+
}
|
|
48
50
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
* offered. The caller persists it (`writeConsentLanguage`) — and has to do that BEFORE its i18n
|
|
55
|
-
* layer reads storage, which is why the inline `<head>` fragment (`consentLinkerScript`) is the
|
|
56
|
-
* one that normally does.
|
|
57
|
-
*/
|
|
58
|
-
export const adoptConsentLanguage = (opts) => {
|
|
59
|
-
for (const plugin of consentPlugins()) {
|
|
60
|
-
const adopted = plugin.adoptLanguage?.(opts);
|
|
61
|
-
if (adopted != null) {
|
|
62
|
-
return adopted;
|
|
51
|
+
return null;
|
|
52
|
+
};
|
|
53
|
+
const startConsentPlugins = (opts) => {
|
|
54
|
+
for (const plugin of consentPlugins()) {
|
|
55
|
+
plugin.start?.(opts);
|
|
63
56
|
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
57
|
+
};
|
|
58
|
+
const locateConsent = async (opts) => {
|
|
59
|
+
let failure = new Error('consent:geo:no-locator');
|
|
60
|
+
for (const plugin of consentPlugins()) {
|
|
61
|
+
if (plugin.locate == null) {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
const country = (await plugin.locate(opts))?.country?.trim().toUpperCase() ?? '';
|
|
66
|
+
if (COUNTRY_CODE.test(country) && !CONSENT_GEO_UNKNOWN.includes(country)) {
|
|
67
|
+
return { country };
|
|
68
|
+
}
|
|
69
|
+
failure = new Error(`consent:geo:unusable-country:${plugin.alias}`);
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
failure = error;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
throw failure;
|
|
76
|
+
};
|
|
77
|
+
return {
|
|
78
|
+
registerConsentPlugin, unregisterConsentPlugin, consentPlugins, decorateConsentUrl,
|
|
79
|
+
consentDomains, adoptConsent, adoptConsentLanguage, startConsentPlugins, locateConsent,
|
|
80
|
+
};
|
|
72
81
|
};
|
|
82
|
+
export const consentPluginHelper = createConsentPluginHelper();
|
|
83
|
+
/** @deprecated compat:factory-refactor — use `consentPluginHelper.decorateConsentUrl(…)` */
|
|
84
|
+
export const decorateConsentUrl = (url, record, opts) => consentPluginHelper.decorateConsentUrl(url, record, opts);
|
|
73
85
|
//# sourceMappingURL=plugins.js.map
|
package/build/plugins.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../src/plugins.ts"],"names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F;AAC5F,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,GAAiB,EAAE,MAA4B,EAAE,IAAoB,EAAO,EAAE,CAC/G,mBAAmB,CAAC,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ConsentOptions, ConsentRecord } from '../types.js';
|
|
2
|
+
/** Where a visitor's choice is kept: localStorage first, the cookie second. */
|
|
3
|
+
export interface ConsentStorageHelper {
|
|
4
|
+
/**
|
|
5
|
+
* Bring a stored record up to the current shape.
|
|
6
|
+
*
|
|
7
|
+
* A record with no `v` was written before the essential category existed, when it was implicitly
|
|
8
|
+
* always granted. The visitor DID choose; upgrading in place honours that choice, where treating
|
|
9
|
+
* the record as unusable would re-prompt everyone who has ever visited.
|
|
10
|
+
*/
|
|
11
|
+
migrateConsent: (raw: ConsentRecord | null) => ConsentRecord | null;
|
|
12
|
+
/**
|
|
13
|
+
* What this browser has already chosen, or null.
|
|
14
|
+
*
|
|
15
|
+
* localStorage first and the cookie second, because that is the order the widget this generalises
|
|
16
|
+
* used and the two can disagree: a visitor who cleared site data but kept cookies still has an
|
|
17
|
+
* answer, and asking them again would be wrong.
|
|
18
|
+
*/
|
|
19
|
+
readConsent: (opts?: ConsentOptions) => ConsentRecord | null;
|
|
20
|
+
/**
|
|
21
|
+
* Record the choice in both places.
|
|
22
|
+
*
|
|
23
|
+
* Two stores rather than one because neither is reliable alone: localStorage is cleared by "clear
|
|
24
|
+
* site data" while the cookie survives it, and the cookie is refused where third-party storage is
|
|
25
|
+
* blocked while localStorage may not be.
|
|
26
|
+
*/
|
|
27
|
+
writeConsent: (record: ConsentRecord, opts?: ConsentOptions) => void;
|
|
28
|
+
/** Forget the choice in both places. */
|
|
29
|
+
clearConsent: (opts?: ConsentOptions) => void;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/storage/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhE,+EAA+E;AAC/E,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,cAAc,EAAE,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,KAAK,aAAa,GAAG,IAAI,CAAA;IACnE;;;;;;OAMG;IACH,WAAW,EAAE,CAAC,IAAI,CAAC,EAAE,cAAc,KAAK,aAAa,GAAG,IAAI,CAAA;IAC5D;;;;;;OAMG;IACH,YAAY,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,cAAc,KAAK,IAAI,CAAA;IACpE,wCAAwC;IACxC,YAAY,EAAE,CAAC,IAAI,CAAC,EAAE,cAAc,KAAK,IAAI,CAAA;CAC9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/storage/types.ts"],"names":[],"mappings":""}
|
package/build/storage.d.ts
CHANGED
|
@@ -1,27 +1,11 @@
|
|
|
1
1
|
import type { ConsentOptions, ConsentRecord } from './types.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* always granted. The visitor DID choose; upgrading in place honours that choice, where treating
|
|
7
|
-
* the record as unusable would re-prompt everyone who has ever visited.
|
|
8
|
-
*/
|
|
9
|
-
export declare const migrateConsent: (raw: ConsentRecord | null) => ConsentRecord | null;
|
|
10
|
-
/**
|
|
11
|
-
* What this browser has already chosen, or null.
|
|
12
|
-
*
|
|
13
|
-
* localStorage first and the cookie second, because that is the order the widget this generalises
|
|
14
|
-
* used and the two can disagree: a visitor who cleared site data but kept cookies still has an
|
|
15
|
-
* answer, and asking them again would be wrong.
|
|
16
|
-
*/
|
|
2
|
+
import type { ConsentStorageHelper } from './storage/types.js';
|
|
3
|
+
export declare const createConsentStorageHelper: () => ConsentStorageHelper;
|
|
4
|
+
export declare const consentStorageHelper: ConsentStorageHelper;
|
|
5
|
+
/** @deprecated compat:factory-refactor — use `consentStorageHelper.readConsent(…)` */
|
|
17
6
|
export declare const readConsent: (opts?: ConsentOptions) => ConsentRecord | null;
|
|
18
|
-
/**
|
|
19
|
-
* Record the choice in both places.
|
|
20
|
-
*
|
|
21
|
-
* Two stores rather than one because neither is reliable alone: localStorage is cleared by "clear
|
|
22
|
-
* site data" while the cookie survives it, and the cookie is refused where third-party storage is
|
|
23
|
-
* blocked while localStorage may not be.
|
|
24
|
-
*/
|
|
7
|
+
/** @deprecated compat:factory-refactor — use `consentStorageHelper.writeConsent(…)` */
|
|
25
8
|
export declare const writeConsent: (record: ConsentRecord, opts?: ConsentOptions) => void;
|
|
9
|
+
/** @deprecated compat:factory-refactor — use `consentStorageHelper.clearConsent(…)` */
|
|
26
10
|
export declare const clearConsent: (opts?: ConsentOptions) => void;
|
|
27
11
|
//# sourceMappingURL=storage.d.ts.map
|
package/build/storage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAE9D,eAAO,MAAM,0BAA0B,QAAO,oBA2E7C,CAAA;AAED,eAAO,MAAM,oBAAoB,sBAA+B,CAAA;AAEhE,sFAAsF;AACtF,eAAO,MAAM,WAAW,UAAW,cAAc,KAAG,aAAa,GAAG,IAA8C,CAAA;AAElH,uFAAuF;AACvF,eAAO,MAAM,YAAY,WAAY,aAAa,SAAS,cAAc,KAAG,IAC3B,CAAA;AAEjD,uFAAuF;AACvF,eAAO,MAAM,YAAY,UAAW,cAAc,KAAG,IAA+C,CAAA"}
|
package/build/storage.js
CHANGED
|
@@ -1,86 +1,77 @@
|
|
|
1
1
|
import { CONSENT_COOKIE_DAYS, CONSENT_ESSENTIAL, CONSENT_KEY, CONSENT_SCHEMA_VERSION, } from './consts.js';
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
try {
|
|
8
|
-
const value = JSON.parse(raw);
|
|
9
|
-
return value != null && typeof value === 'object' ? value : null;
|
|
10
|
-
}
|
|
11
|
-
catch {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Bring a stored record up to the current shape.
|
|
17
|
-
*
|
|
18
|
-
* A record with no `v` was written before the essential category existed, when it was implicitly
|
|
19
|
-
* always granted. The visitor DID choose; upgrading in place honours that choice, where treating
|
|
20
|
-
* the record as unusable would re-prompt everyone who has ever visited.
|
|
21
|
-
*/
|
|
22
|
-
export const migrateConsent = (raw) => raw == null ? null
|
|
23
|
-
: raw.v === CONSENT_SCHEMA_VERSION ? raw
|
|
24
|
-
: { ...raw, [CONSENT_ESSENTIAL]: true, v: CONSENT_SCHEMA_VERSION };
|
|
25
|
-
const fromCookie = (name) => {
|
|
26
|
-
if (typeof document === 'undefined') {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
const parts = `; ${document.cookie}`.split(`; ${name}=`);
|
|
30
|
-
return parts.length === 2 ? parts.pop()?.split(';').shift() ?? null : null;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* What this browser has already chosen, or null.
|
|
34
|
-
*
|
|
35
|
-
* localStorage first and the cookie second, because that is the order the widget this generalises
|
|
36
|
-
* used and the two can disagree: a visitor who cleared site data but kept cookies still has an
|
|
37
|
-
* answer, and asking them again would be wrong.
|
|
38
|
-
*/
|
|
39
|
-
export const readConsent = (opts) => {
|
|
40
|
-
const name = key(opts);
|
|
41
|
-
let raw = null;
|
|
42
|
-
try {
|
|
43
|
-
raw = typeof localStorage !== 'undefined' ? localStorage.getItem(name) : null;
|
|
44
|
-
}
|
|
45
|
-
catch { /* private modes and blocked storage both throw; the cookie may still answer */ }
|
|
46
|
-
return migrateConsent(parse(raw) ?? parse(fromCookie(name)));
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Record the choice in both places.
|
|
50
|
-
*
|
|
51
|
-
* Two stores rather than one because neither is reliable alone: localStorage is cleared by "clear
|
|
52
|
-
* site data" while the cookie survives it, and the cookie is refused where third-party storage is
|
|
53
|
-
* blocked while localStorage may not be.
|
|
54
|
-
*/
|
|
55
|
-
export const writeConsent = (record, opts) => {
|
|
56
|
-
const name = key(opts);
|
|
57
|
-
const value = JSON.stringify({ ...record, v: CONSENT_SCHEMA_VERSION });
|
|
58
|
-
try {
|
|
59
|
-
if (typeof localStorage !== 'undefined') {
|
|
60
|
-
localStorage.setItem(name, value);
|
|
2
|
+
export const createConsentStorageHelper = () => {
|
|
3
|
+
const key = (opts) => opts?.storageKey ?? CONSENT_KEY;
|
|
4
|
+
const parse = (raw) => {
|
|
5
|
+
if (raw == null || raw === '') {
|
|
6
|
+
return null;
|
|
61
7
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
8
|
+
try {
|
|
9
|
+
const value = JSON.parse(raw);
|
|
10
|
+
return value != null && typeof value === 'object' ? value : null;
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const migrateConsent = (raw) => raw == null ? null
|
|
17
|
+
: raw.v === CONSENT_SCHEMA_VERSION ? raw
|
|
18
|
+
: { ...raw, [CONSENT_ESSENTIAL]: true, v: CONSENT_SCHEMA_VERSION };
|
|
19
|
+
const fromCookie = (name) => {
|
|
20
|
+
if (typeof document === 'undefined') {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const parts = `; ${document.cookie}`.split(`; ${name}=`);
|
|
24
|
+
return parts.length === 2 ? parts.pop()?.split(';').shift() ?? null : null;
|
|
25
|
+
};
|
|
26
|
+
const readConsent = (opts) => {
|
|
27
|
+
const name = key(opts);
|
|
28
|
+
let raw = null;
|
|
29
|
+
try {
|
|
30
|
+
raw = typeof localStorage !== 'undefined' ? localStorage.getItem(name) : null;
|
|
31
|
+
}
|
|
32
|
+
catch { /* private modes and blocked storage both throw; the cookie may still answer */ }
|
|
33
|
+
return migrateConsent(parse(raw) ?? parse(fromCookie(name)));
|
|
34
|
+
};
|
|
35
|
+
const writeConsent = (record, opts) => {
|
|
36
|
+
const name = key(opts);
|
|
37
|
+
const value = JSON.stringify({ ...record, v: CONSENT_SCHEMA_VERSION });
|
|
38
|
+
try {
|
|
39
|
+
if (typeof localStorage !== 'undefined') {
|
|
40
|
+
localStorage.setItem(name, value);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch { /* the cookie below is the fallback */ }
|
|
44
|
+
if (typeof document === 'undefined') {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const days = opts?.cookieDays ?? CONSENT_COOKIE_DAYS;
|
|
48
|
+
const expires = new Date(Date.now() + days * 24 * 60 * 60 * 1000).toUTCString();
|
|
49
|
+
const domain = opts?.cookieDomain != null ? `;domain=${opts.cookieDomain}` : '';
|
|
50
|
+
// `SameSite=Lax` is stated rather than left to the browser default, which differs between them.
|
|
51
|
+
// This cookie is never sent cross-site on purpose — it records a preference, not a session.
|
|
52
|
+
document.cookie = `${name}=${value};expires=${expires};path=/;SameSite=Lax${domain}`;
|
|
53
|
+
};
|
|
54
|
+
const clearConsent = (opts) => {
|
|
55
|
+
const name = key(opts);
|
|
56
|
+
try {
|
|
57
|
+
if (typeof localStorage !== 'undefined') {
|
|
58
|
+
localStorage.removeItem(name);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch { /* nothing to remove if storage was never available */ }
|
|
62
|
+
if (typeof document !== 'undefined') {
|
|
63
|
+
// The same `domain` the write used — a cookie is only replaced by one that names its domain.
|
|
64
|
+
const domain = opts?.cookieDomain != null ? `;domain=${opts.cookieDomain}` : '';
|
|
65
|
+
document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/${domain}`;
|
|
79
66
|
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (typeof document !== 'undefined') {
|
|
83
|
-
document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`;
|
|
84
|
-
}
|
|
67
|
+
};
|
|
68
|
+
return { migrateConsent, readConsent, writeConsent, clearConsent };
|
|
85
69
|
};
|
|
70
|
+
export const consentStorageHelper = createConsentStorageHelper();
|
|
71
|
+
/** @deprecated compat:factory-refactor — use `consentStorageHelper.readConsent(…)` */
|
|
72
|
+
export const readConsent = (opts) => consentStorageHelper.readConsent(opts);
|
|
73
|
+
/** @deprecated compat:factory-refactor — use `consentStorageHelper.writeConsent(…)` */
|
|
74
|
+
export const writeConsent = (record, opts) => consentStorageHelper.writeConsent(record, opts);
|
|
75
|
+
/** @deprecated compat:factory-refactor — use `consentStorageHelper.clearConsent(…)` */
|
|
76
|
+
export const clearConsent = (opts) => consentStorageHelper.clearConsent(opts);
|
|
86
77
|
//# sourceMappingURL=storage.js.map
|