c15t 1.6.0 → 1.7.0
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/CHANGELOG.md +30 -0
- package/dist/index.cjs +658 -98
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +632 -93
- package/dist/libs/fetch-consent-banner.d.ts +2 -0
- package/dist/libs/fetch-consent-banner.d.ts.map +1 -1
- package/dist/libs/gtm.d.ts +7 -0
- package/dist/libs/gtm.d.ts.map +1 -1
- package/dist/libs/has.d.ts +9 -0
- package/dist/libs/has.d.ts.map +1 -1
- package/dist/libs/iframe-blocker/core.d.ts +90 -0
- package/dist/libs/iframe-blocker/core.d.ts.map +1 -0
- package/dist/libs/iframe-blocker/index.d.ts +3 -0
- package/dist/libs/iframe-blocker/index.d.ts.map +1 -0
- package/dist/libs/iframe-blocker/store.d.ts +35 -0
- package/dist/libs/iframe-blocker/store.d.ts.map +1 -0
- package/dist/libs/iframe-blocker/types.d.ts +26 -0
- package/dist/libs/iframe-blocker/types.d.ts.map +1 -0
- package/dist/libs/save-consents.d.ts +3 -0
- package/dist/libs/save-consents.d.ts.map +1 -1
- package/dist/libs/script-loader/core.d.ts +117 -0
- package/dist/libs/script-loader/core.d.ts.map +1 -0
- package/dist/libs/script-loader/index.d.ts +10 -0
- package/dist/libs/script-loader/index.d.ts.map +1 -0
- package/dist/libs/script-loader/store.d.ts +58 -0
- package/dist/libs/script-loader/store.d.ts.map +1 -0
- package/dist/libs/script-loader/types.d.ts +160 -0
- package/dist/libs/script-loader/types.d.ts.map +1 -0
- package/dist/libs/script-loader/utils.d.ts +56 -0
- package/dist/libs/script-loader/utils.d.ts.map +1 -0
- package/dist/libs/tracking-blocker.d.ts +53 -4
- package/dist/libs/tracking-blocker.d.ts.map +1 -1
- package/dist/store.d.ts +38 -3
- package/dist/store.d.ts.map +1 -1
- package/dist/store.initial-state.d.ts +1 -8
- package/dist/store.initial-state.d.ts.map +1 -1
- package/dist/store.type.d.ts +52 -0
- package/dist/store.type.d.ts.map +1 -1
- package/dist/types/callbacks.d.ts +21 -0
- package/dist/types/callbacks.d.ts.map +1 -1
- package/dist/types/compliance.d.ts +2 -0
- package/dist/types/compliance.d.ts.map +1 -1
- package/dist/types/gdpr.d.ts +23 -0
- package/dist/types/gdpr.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -29
- package/dist/types/index.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a random ID for script elements.
|
|
3
|
+
*
|
|
4
|
+
* @returns A random string that can be used as a script ID
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare function generateRandomScriptId(): string;
|
|
8
|
+
/**
|
|
9
|
+
* Creates a DOM element ID for a script based on its ID and anonymization settings.
|
|
10
|
+
*
|
|
11
|
+
* @param scriptId - The original script ID
|
|
12
|
+
* @param anonymizeId - Whether to use an anonymized ID
|
|
13
|
+
* @param scriptIdMap - Map of script IDs to anonymized IDs
|
|
14
|
+
* @returns The element ID to use for the script
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare function getScriptElementId(scriptId: string, anonymizeId: boolean, scriptIdMap: Record<string, string>): string;
|
|
18
|
+
/**
|
|
19
|
+
* Check if a script with the given ID has been loaded
|
|
20
|
+
* @param src - The script source URL
|
|
21
|
+
* @returns True if the script has been loaded
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export declare function hasLoadedScript(src: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Get a loaded script element by its source URL
|
|
27
|
+
* @param src - The script source URL
|
|
28
|
+
* @returns The script element or null if not found
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export declare function getLoadedScript(src: string): HTMLScriptElement | null | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Set a loaded script element in the registry
|
|
34
|
+
* @param src - The script source URL
|
|
35
|
+
* @param element - The script element or null
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
export declare function setLoadedScript(src: string, element: HTMLScriptElement | null): void;
|
|
39
|
+
/**
|
|
40
|
+
* Remove a script from the loaded scripts registry
|
|
41
|
+
* @param src - The script source URL
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
export declare function deleteLoadedScript(src: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* Clear all loaded scripts from the registry
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
export declare function clearLoadedScripts(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Get a readonly snapshot of all loaded scripts
|
|
52
|
+
* @returns A readonly map of loaded scripts
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
export declare function getLoadedScriptsSnapshot(): ReadonlyMap<string, HTMLScriptElement | null>;
|
|
56
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/libs/script-loader/utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAqB/C;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CACjC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,OAAO,EACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACjC,MAAM,CAcR;AAUD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC9B,GAAG,EAAE,MAAM,GACT,iBAAiB,GAAG,IAAI,GAAG,SAAS,CAEtC;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC9B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,iBAAiB,GAAG,IAAI,GAC/B,IAAI,CAEN;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEpD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,WAAW,CACtD,MAAM,EACN,iBAAiB,GAAG,IAAI,CACxB,CAEA"}
|
|
@@ -8,22 +8,71 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { AllConsentNames, ConsentState } from '../types';
|
|
10
10
|
/**
|
|
11
|
-
* Configuration options for the tracking blocker
|
|
11
|
+
* Configuration options for the tracking blocker system.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* This interface controls how the tracking blocker intercepts and manages
|
|
15
|
+
* network requests based on user consent. The blocker overrides global
|
|
16
|
+
* `fetch` and `XMLHttpRequest` APIs to enforce consent requirements.
|
|
17
|
+
*
|
|
18
|
+
* @deprecated This interface is deprecated and will be removed in v2.0.
|
|
19
|
+
* The default domain map will be empty in v2.0, requiring users to explicitly
|
|
20
|
+
* specify domains to block. Recommended to use the Script Loader to load scripts based on consent.
|
|
21
|
+
* instead for more granular control over script loading based on consent.
|
|
12
22
|
*/
|
|
13
23
|
export interface TrackingBlockerConfig {
|
|
14
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Whether to disable automatic blocking of network requests.
|
|
26
|
+
*
|
|
27
|
+
* @default false
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* When `true`, the tracking blocker will not automatically intercept
|
|
31
|
+
* and block network requests. This is useful for testing or when
|
|
32
|
+
* implementing custom blocking logic.
|
|
33
|
+
*/
|
|
15
34
|
disableAutomaticBlocking?: boolean;
|
|
16
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Whether to completely override the default domain consent map.
|
|
37
|
+
*
|
|
38
|
+
* @default false
|
|
39
|
+
*
|
|
40
|
+
* @remarks
|
|
41
|
+
* When `true`, only the domains specified in `domainConsentMap` will be
|
|
42
|
+
* considered for blocking. When `false`, the provided domains will be
|
|
43
|
+
* merged with the default domain map.
|
|
44
|
+
*/
|
|
17
45
|
overrideDomainConsentMap?: boolean;
|
|
18
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Map of domains to their required consent types.
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* Each domain should be mapped to the consent type required to allow
|
|
51
|
+
* requests to that domain. Domains are normalized (lowercase, no www,
|
|
52
|
+
* no port) before matching.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* {
|
|
57
|
+
* 'google-analytics.com': 'measurement',
|
|
58
|
+
* 'facebook.com': 'marketing',
|
|
59
|
+
* 'hotjar.com': 'experience'
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
19
63
|
domainConsentMap?: Record<string, AllConsentNames>;
|
|
20
64
|
}
|
|
21
65
|
interface TrackingBlocker {
|
|
66
|
+
/**
|
|
67
|
+
* Updates the consents
|
|
68
|
+
* @deprecated This method is deprecated and will be removed in the next major version. Use [ScriptLoader](https://c15t.com/docs/react/script-loader) instead.
|
|
69
|
+
*/
|
|
22
70
|
updateConsents: (newConsents: Partial<ConsentState>) => void;
|
|
23
71
|
destroy: () => void;
|
|
24
72
|
}
|
|
25
73
|
/**
|
|
26
74
|
* Creates a tracking blocker instance that handles blocking of tracking scripts and network requests
|
|
75
|
+
* @deprecated This function is deprecated and will be removed in the next major version. Use [ScriptLoader](https://c15t.com/docs/react/script-loader) instead.
|
|
27
76
|
*/
|
|
28
77
|
export declare function createTrackingBlocker(config?: TrackingBlockerConfig, initialConsents?: ConsentState): TrackingBlocker;
|
|
29
78
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracking-blocker.d.ts","sourceRoot":"","sources":["../../src/libs/tracking-blocker.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG9D
|
|
1
|
+
{"version":3,"file":"tracking-blocker.d.ts","sourceRoot":"","sources":["../../src/libs/tracking-blocker.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG9D;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,qBAAqB;IACrC;;;;;;;;;OASG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAEnC;;;;;;;;;OASG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAEnC;;;;;;;;;;;;;;;;OAgBG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CACnD;AAeD,UAAU,eAAe;IACxB;;;OAGG;IACH,cAAc,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IAC7D,OAAO,EAAE,MAAM,IAAI,CAAC;CACpB;AAYD;;;GAGG;AACH,wBAAgB,qBAAqB,CACpC,MAAM,GAAE,qBAA0B,EAClC,eAAe,CAAC,EAAE,YAAY,GAC5B,eAAe,CAuJjB"}
|
package/dist/store.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ import type { ContractsOutputs } from '@c15t/backend/contracts';
|
|
|
7
7
|
import type { TranslationConfig } from '@c15t/translations';
|
|
8
8
|
import type { ConsentManagerInterface } from './client/client-factory';
|
|
9
9
|
import { type GTMConfiguration } from './libs/gtm';
|
|
10
|
+
import type { IframeBlockerConfig } from './libs/iframe-blocker';
|
|
11
|
+
import { type Script } from './libs/script-loader';
|
|
10
12
|
import type { TrackingBlockerConfig } from './libs/tracking-blocker';
|
|
11
13
|
import type { PrivacyConsentState } from './store.type';
|
|
12
14
|
import type { Callbacks } from './types/callbacks';
|
|
@@ -40,19 +42,44 @@ export interface StoreOptions {
|
|
|
40
42
|
initialGdprTypes?: AllConsentNames[];
|
|
41
43
|
/**
|
|
42
44
|
* Initial compliance settings for different regions.
|
|
45
|
+
* @deprecated will be removed in v2.0 due to unused functionality
|
|
43
46
|
*/
|
|
44
47
|
initialComplianceSettings?: Record<string, Partial<ComplianceSettings>>;
|
|
45
48
|
/**
|
|
46
|
-
* Configuration for the tracking blocker.
|
|
49
|
+
* Configuration options for the tracking blocker system.
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* **Important:** The tracking blocker is automatically disabled when using the Script Loader
|
|
53
|
+
* to prevent conflicts between the two systems. If you provide `scripts` in the store options,
|
|
54
|
+
* or if you dynamically add scripts using `setScripts()`, the tracking blocker will be
|
|
55
|
+
* destroyed to ensure proper script loading behavior.
|
|
56
|
+
*
|
|
57
|
+
* This interface controls how the tracking blocker intercepts and manages
|
|
58
|
+
* network requests based on user consent. The blocker overrides global
|
|
59
|
+
* `fetch` and `XMLHttpRequest` APIs to enforce consent requirements.
|
|
60
|
+
*
|
|
61
|
+
* @deprecated This interface is deprecated and will be removed in v2.0.
|
|
62
|
+
* The default domain map will be empty in v2.0, requiring users to explicitly
|
|
63
|
+
* specify domains to block. Use the new Script Loader
|
|
64
|
+
* instead for more granular control over script loading based on consent.
|
|
65
|
+
*
|
|
66
|
+
* @see https://c15t.com/docs/frameworks/javascript/script-loader
|
|
47
67
|
*/
|
|
48
68
|
trackingBlockerConfig?: TrackingBlockerConfig;
|
|
69
|
+
/**
|
|
70
|
+
* Configuration for the iframe blocker.
|
|
71
|
+
* Controls how iframes are blocked based on consent settings.
|
|
72
|
+
*/
|
|
73
|
+
iframeBlockerConfig?: IframeBlockerConfig;
|
|
49
74
|
/**
|
|
50
75
|
* Flag indicating if the consent manager is using the c15t.dev domain.
|
|
51
76
|
* @default false
|
|
77
|
+
* @deprecated will be removed in a future version
|
|
52
78
|
*/
|
|
53
79
|
isConsentDomain?: boolean;
|
|
54
80
|
/**
|
|
55
81
|
* Google Tag Manager configuration.
|
|
82
|
+
* @deprecated use {@link https://c15t.com/docs/integrations/google-tag-manager} instead
|
|
56
83
|
*/
|
|
57
84
|
unstable_googleTagManager?: GTMConfiguration;
|
|
58
85
|
/**
|
|
@@ -69,14 +96,22 @@ export interface StoreOptions {
|
|
|
69
96
|
*/
|
|
70
97
|
translationConfig?: TranslationConfig;
|
|
71
98
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
99
|
+
* If showConsentBanner is fetched prior to the store being created, you can pass the initial data here.
|
|
100
|
+
*
|
|
101
|
+
* This is useful for server-side rendering (SSR) such as in @c15t/nextjs.
|
|
74
102
|
*/
|
|
75
103
|
_initialData?: Promise<ContractsOutputs['consent']['showBanner'] | undefined>;
|
|
76
104
|
/**
|
|
77
105
|
* Callbacks for the consent manager.
|
|
78
106
|
*/
|
|
79
107
|
callbacks?: Callbacks;
|
|
108
|
+
/**
|
|
109
|
+
* Dynamically load scripts based on consent state.
|
|
110
|
+
* For scripts such as Google Tag Manager, Meta Pixel, etc.
|
|
111
|
+
*
|
|
112
|
+
* @see https://c15t.com/docs/frameworks/javascript/script-loader
|
|
113
|
+
*/
|
|
114
|
+
scripts?: Script[];
|
|
80
115
|
}
|
|
81
116
|
export interface StoreConfig extends Pick<StoreOptions, 'trackingBlockerConfig'> {
|
|
82
117
|
}
|
package/dist/store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAOvE,OAAO,EAAE,KAAK,gBAAgB,EAAY,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"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,CAAC,EAAE,mBAAmB,CAAC;IAE1C;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,yBAAyB,CAAC,EAAE,gBAAgB,CAAC;IAE7C;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAEtD;;OAEG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IAEtC;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,CAAC;IAE9E;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAGD,MAAM,WAAW,WAChB,SAAQ,IAAI,CAAC,YAAY,EAAE,uBAAuB,CAAC;CAAG;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,yBAAyB,GACrC,SAAS,uBAAuB,EAChC,UAAS,YAAiB,oDAgc1B,CAAC"}
|
|
@@ -11,13 +11,6 @@ export declare const STORAGE_KEY = "privacy-consent-storage";
|
|
|
11
11
|
* This configuration establishes the baseline state for the consent manager,
|
|
12
12
|
* including default consent values, compliance settings, and privacy preferences.
|
|
13
13
|
*
|
|
14
|
-
* Notable defaults include:
|
|
15
|
-
* - All consents start with their type-specific default values
|
|
16
|
-
* - GDPR compliance is globally enabled
|
|
17
|
-
* - CCPA compliance is enabled for US users only
|
|
18
|
-
* - Do Not Track is respected by default
|
|
19
|
-
* - Only necessary and marketing consents are included in gdprTypes
|
|
20
|
-
*
|
|
21
14
|
* @example
|
|
22
15
|
* Using the initial state:
|
|
23
16
|
* ```typescript
|
|
@@ -34,5 +27,5 @@ export declare const STORAGE_KEY = "privacy-consent-storage";
|
|
|
34
27
|
*
|
|
35
28
|
* @public
|
|
36
29
|
*/
|
|
37
|
-
export declare const initialState: Omit<PrivacyConsentState, 'has' | 'fetchConsentBannerInfo' | 'getEffectiveConsents' | 'hasConsentFor' | 'setSelectedConsent'>;
|
|
30
|
+
export declare const initialState: Omit<PrivacyConsentState, 'has' | 'fetchConsentBannerInfo' | 'getEffectiveConsents' | 'hasConsentFor' | 'setSelectedConsent' | 'updateScripts' | 'isScriptLoaded' | 'getLoadedScriptIds' | 'addScript' | 'addScripts' | 'removeScript' | 'setScripts' | 'initializeIframeBlocker' | 'updateIframeConsents' | 'destroyIframeBlocker' | 'updateConsentCategories'>;
|
|
38
31
|
//# sourceMappingURL=store.initial-state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.initial-state.d.ts","sourceRoot":"","sources":["../src/store.initial-state.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAKxD,eAAO,MAAM,WAAW,4BAA4B,CAAC;AAErD
|
|
1
|
+
{"version":3,"file":"store.initial-state.d.ts","sourceRoot":"","sources":["../src/store.initial-state.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAKxD,eAAO,MAAM,WAAW,4BAA4B,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,YAAY,EAAE,IAAI,CAC9B,mBAAmB,EACjB,KAAK,GACL,wBAAwB,GACxB,sBAAsB,GACtB,eAAe,GACf,oBAAoB,GACpB,eAAe,GACf,gBAAgB,GAChB,oBAAoB,GACpB,WAAW,GACX,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,yBAAyB,GACzB,sBAAsB,GACtB,sBAAsB,GACtB,yBAAyB,CAoJ3B,CAAC"}
|
package/dist/store.type.d.ts
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { ContractsOutputs } from '@c15t/backend/contracts';
|
|
6
6
|
import type { HasCondition } from './libs/has';
|
|
7
|
+
import type { IframeBlockerConfig } from './libs/iframe-blocker';
|
|
8
|
+
import type { Script } from './libs/script-loader';
|
|
7
9
|
import type { AllConsentNames, Callbacks, ComplianceRegion, ComplianceSettings, ConsentBannerResponse, ConsentState, ConsentType, consentTypes, JurisdictionInfo, LocationInfo, PrivacySettings, TranslationConfig } from './types';
|
|
8
10
|
/**
|
|
9
11
|
* Core state and methods interface for the privacy consent management store.
|
|
@@ -82,6 +84,8 @@ export interface PrivacyConsentState {
|
|
|
82
84
|
includeNonDisplayedConsents: boolean;
|
|
83
85
|
/** Available consent type configurations */
|
|
84
86
|
consentTypes: ConsentType[];
|
|
87
|
+
/** Configuration for the iframe blocker */
|
|
88
|
+
iframeBlockerConfig: IframeBlockerConfig;
|
|
85
89
|
setSelectedConsent: (name: AllConsentNames, value: boolean) => void;
|
|
86
90
|
/**
|
|
87
91
|
* Saves the user's consent preferences.
|
|
@@ -177,5 +181,53 @@ export interface PrivacyConsentState {
|
|
|
177
181
|
* @deprecated will be removed in a future version due to unused functionality
|
|
178
182
|
*/
|
|
179
183
|
setComplianceSetting: (region: ComplianceRegion, settings: Partial<ComplianceSettings>) => void;
|
|
184
|
+
/**
|
|
185
|
+
* Script management section
|
|
186
|
+
*/
|
|
187
|
+
/** Array of script configurations to manage */
|
|
188
|
+
scripts: Script[];
|
|
189
|
+
/** Map of currently loaded script IDs to a boolean loaded-state */
|
|
190
|
+
loadedScripts: Record<string, boolean>;
|
|
191
|
+
/** Map of anonymized script IDs to their original IDs */
|
|
192
|
+
scriptIdMap: Record<string, string>;
|
|
193
|
+
/**
|
|
194
|
+
* Sets multiple script configurations to the store.
|
|
195
|
+
* @param scripts - Array of script configurations to add
|
|
196
|
+
*/
|
|
197
|
+
setScripts: (scripts: Script[]) => void;
|
|
198
|
+
/**
|
|
199
|
+
* Removes a script configuration from the store.
|
|
200
|
+
* @param scriptId - ID of the script to remove
|
|
201
|
+
*/
|
|
202
|
+
removeScript: (scriptId: string) => void;
|
|
203
|
+
/**
|
|
204
|
+
* Updates scripts based on current consent state.
|
|
205
|
+
* Loads scripts that have consent and aren't loaded yet.
|
|
206
|
+
* Unloads scripts that no longer have consent.
|
|
207
|
+
* @returns Object containing arrays of loaded and unloaded script IDs
|
|
208
|
+
*/
|
|
209
|
+
updateScripts: () => {
|
|
210
|
+
loaded: string[];
|
|
211
|
+
unloaded: string[];
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* Checks if a script is currently loaded.
|
|
215
|
+
* @param scriptId - ID of the script to check
|
|
216
|
+
* @returns True if the script is loaded, false otherwise
|
|
217
|
+
*/
|
|
218
|
+
isScriptLoaded: (scriptId: string) => boolean;
|
|
219
|
+
/**
|
|
220
|
+
* Gets all currently loaded script IDs.
|
|
221
|
+
* @returns Array of loaded script IDs
|
|
222
|
+
*/
|
|
223
|
+
getLoadedScriptIds: () => string[];
|
|
224
|
+
/** Initializes the iframe blocker instance. */
|
|
225
|
+
initializeIframeBlocker: () => void;
|
|
226
|
+
/** Updates consents for the iframe blocker. */
|
|
227
|
+
updateIframeConsents: () => void;
|
|
228
|
+
/** Destroys the iframe blocker instance. */
|
|
229
|
+
destroyIframeBlocker: () => void;
|
|
230
|
+
/** Updates the active GDPR consent types. */
|
|
231
|
+
updateConsentCategories: (newCategories: AllConsentNames[]) => void;
|
|
180
232
|
}
|
|
181
233
|
//# sourceMappingURL=store.type.d.ts.map
|
package/dist/store.type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.type.d.ts","sourceRoot":"","sources":["../src/store.type.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO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face Callbacks {
|
|
43
|
+
/**
|
|
44
|
+
* Called when the consent banner is fetched.
|
|
45
|
+
*
|
|
46
|
+
* @param payload - The payload containing the consent banner information
|
|
47
|
+
*/
|
|
43
48
|
onBannerFetched?: Callback<OnBannerFetchedPayload>;
|
|
49
|
+
/**
|
|
50
|
+
* Called when the consent is set.
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
* Consent may be set automatically in certain cases, such as
|
|
54
|
+
* when no jurisdiction is detected or when the store is initialized
|
|
55
|
+
* with default consents. If you use setCallbacks() to set this
|
|
56
|
+
* callback, it will be called immediately with the store's consent state.
|
|
57
|
+
*
|
|
58
|
+
* @param payload - The payload containing the consent state
|
|
59
|
+
*/
|
|
44
60
|
onConsentSet?: Callback<OnConsentSetPayload>;
|
|
61
|
+
/**
|
|
62
|
+
* Called when an error occurs.
|
|
63
|
+
*
|
|
64
|
+
* @param payload - The payload containing the error information
|
|
65
|
+
*/
|
|
45
66
|
onError?: Callback<OnErrorPayload>;
|
|
46
67
|
}
|
|
47
68
|
//# sourceMappingURL=callbacks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callbacks.d.ts","sourceRoot":"","sources":["../../src/types/callbacks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,EACZ,MAAM,UAAU,CAAC;AAElB;;;;GAIG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACpC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,YAAY,EAAE,gBAAgB,CAAC;IAC/B,QAAQ,EAAE;QACT,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;KAC1B,CAAC;IACF,YAAY,EAAE;QACb,QAAQ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d,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,SAAS;IACzB;;;;OAIG;IACH,eAAe,CAAC,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC;IACnD;;;;;;;;;;OAUG;IACH,YAAY,CAAC,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAC;IAC7C;;;;OAIG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;CACnC"}
|
|
@@ -49,6 +49,7 @@ export type ConsentState = Record<AllConsentNames, boolean>;
|
|
|
49
49
|
* ```
|
|
50
50
|
*
|
|
51
51
|
* @public
|
|
52
|
+
* @deprecated Will be removed in v2.0 along with ComplianceRegion.
|
|
52
53
|
*/
|
|
53
54
|
export type ComplianceRegion = 'gdpr' | 'ccpa' | 'lgpd' | 'usStatePrivacy';
|
|
54
55
|
/**
|
|
@@ -76,6 +77,7 @@ export type ComplianceRegion = 'gdpr' | 'ccpa' | 'lgpd' | 'usStatePrivacy';
|
|
|
76
77
|
* ```
|
|
77
78
|
*
|
|
78
79
|
* @see {@link ComplianceRegion} for available regions
|
|
80
|
+
* @deprecated will be removed in a future version due to unused functionality
|
|
79
81
|
* @public
|
|
80
82
|
*/
|
|
81
83
|
export type ComplianceSettings = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compliance.d.ts","sourceRoot":"","sources":["../../src/types/compliance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAC9C;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;AAE5D
|
|
1
|
+
{"version":3,"file":"compliance.d.ts","sourceRoot":"","sources":["../../src/types/compliance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,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AAG,IAAI,CAAC;IAE1B,sCAAsC;IACtC,YAAY,EACT,gBAAgB,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,GACjE,IAAI,CAAC;IAER,4FAA4F;IAC5F,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC9B,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IAEb,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,qBAAqB,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC"}
|
package/dist/types/gdpr.d.ts
CHANGED
|
@@ -160,4 +160,27 @@ export type ConsentType = {
|
|
|
160
160
|
* @public
|
|
161
161
|
*/
|
|
162
162
|
export declare const consentTypes: ConsentType[];
|
|
163
|
+
/**
|
|
164
|
+
* Runtime array of all valid consent names.
|
|
165
|
+
*
|
|
166
|
+
* @remarks
|
|
167
|
+
* This array is automatically derived from {@link consentTypes} to ensure
|
|
168
|
+
* runtime validation stays in sync with the {@link AllConsentNames} type definition.
|
|
169
|
+
* Use this for validation logic where you need to check if a string is a valid consent name.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```typescript
|
|
173
|
+
* function validateConsentName(name: string): AllConsentNames {
|
|
174
|
+
* if (!allConsentNames.includes(name as AllConsentNames)) {
|
|
175
|
+
* throw new Error(`Invalid consent name: ${name}`);
|
|
176
|
+
* }
|
|
177
|
+
* return name as AllConsentNames;
|
|
178
|
+
* }
|
|
179
|
+
* ```
|
|
180
|
+
*
|
|
181
|
+
* @see {@link AllConsentNames} for the type definition
|
|
182
|
+
* @see {@link consentTypes} for the full consent configurations
|
|
183
|
+
* @public
|
|
184
|
+
*/
|
|
185
|
+
export declare const allConsentNames: AllConsentNames[];
|
|
163
186
|
//# sourceMappingURL=gdpr.d.ts.map
|
package/dist/types/gdpr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gdpr.d.ts","sourceRoot":"","sources":["../../src/types/gdpr.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,MAAM,eAAe,GACxB,YAAY,GACZ,eAAe,GACf,WAAW,GACX,aAAa,GACb,WAAW,CAAC;AAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,MAAM,MAAM,WAAW,GAAG;IACzB,4CAA4C;IAC5C,YAAY,EAAE,OAAO,CAAC;IAEtB,gEAAgE;IAChE,WAAW,EAAE,MAAM,CAAC;IAEpB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,oDAAoD;IACpD,OAAO,EAAE,OAAO,CAAC;IAEjB,qCAAqC;IACrC,QAAQ,EAAE,MAAM,CAAC;IAEjB,gCAAgC;IAChC,IAAI,EAAE,eAAe,CAAC;CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,eAAO,MAAM,YAAY,EAAE,WAAW,EA0CrC,CAAC"}
|
|
1
|
+
{"version":3,"file":"gdpr.d.ts","sourceRoot":"","sources":["../../src/types/gdpr.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,MAAM,eAAe,GACxB,YAAY,GACZ,eAAe,GACf,WAAW,GACX,aAAa,GACb,WAAW,CAAC;AAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,MAAM,MAAM,WAAW,GAAG;IACzB,4CAA4C;IAC5C,YAAY,EAAE,OAAO,CAAC;IAEtB,gEAAgE;IAChE,WAAW,EAAE,MAAM,CAAC;IAEpB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,oDAAoD;IACpD,OAAO,EAAE,OAAO,CAAC;IAEjB,qCAAqC;IACrC,QAAQ,EAAE,MAAM,CAAC;IAEjB,gCAAgC;IAChC,IAAI,EAAE,eAAe,CAAC;CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,eAAO,MAAM,YAAY,EAAE,WAAW,EA0CrC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,eAAe,EAEvB,eAAe,EAAE,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5,34 +5,6 @@
|
|
|
5
5
|
* GDPR-compliant consent management.
|
|
6
6
|
*/
|
|
7
7
|
export type { Callback, Callbacks } from './callbacks';
|
|
8
|
-
/**
|
|
9
|
-
* @module
|
|
10
|
-
* Compliance and Privacy Types
|
|
11
|
-
*
|
|
12
|
-
* @remarks
|
|
13
|
-
* Exports types related to privacy compliance and consent management:
|
|
14
|
-
* - Region-specific compliance settings
|
|
15
|
-
* - Consent state tracking
|
|
16
|
-
* - Privacy preferences
|
|
17
|
-
* - Namespace configuration
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* Import compliance-related types:
|
|
21
|
-
* ```typescript
|
|
22
|
-
* import type {
|
|
23
|
-
* ComplianceRegion,
|
|
24
|
-
* ComplianceSettings,
|
|
25
|
-
* } from 'c15t/types';
|
|
26
|
-
*
|
|
27
|
-
* const euSettings: ComplianceSettings = {
|
|
28
|
-
* enabled: true,
|
|
29
|
-
* appliesGlobally: false,
|
|
30
|
-
* applies: true
|
|
31
|
-
* };
|
|
32
|
-
*
|
|
33
|
-
* const region: ComplianceRegion = 'gdpr';
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
8
|
export type { ComplianceRegion, ComplianceSettings, ConsentBannerResponse, ConsentState, HasConsentedProps, JurisdictionInfo, LocationInfo, NamespaceProps, PrivacySettings, } from './compliance';
|
|
37
9
|
/**
|
|
38
10
|
* @module
|
|
@@ -59,7 +31,7 @@ export type { ComplianceRegion, ComplianceSettings, ConsentBannerResponse, Conse
|
|
|
59
31
|
* }
|
|
60
32
|
* ```
|
|
61
33
|
*/
|
|
62
|
-
export { type AllConsentNames, type ConsentType, consentTypes } from './gdpr';
|
|
34
|
+
export { type AllConsentNames, allConsentNames, type ConsentType, consentTypes, } from './gdpr';
|
|
63
35
|
/**
|
|
64
36
|
* @module
|
|
65
37
|
* Translation Types
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEvD,YAAY,EACX,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,eAAe,GACf,MAAM,cAAc,CAAC;AACtB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EACN,KAAK,eAAe,EACpB,eAAe,EACf,KAAK,WAAW,EAChB,YAAY,GACZ,MAAM,QAAQ,CAAC;AAEhB;;;;;;;;;;;GAWG;AAEH,YAAY,EACX,kBAAkB,EAClB,gCAAgC,EAChC,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,iBAAiB,EACjB,YAAY,GACZ,MAAM,oBAAoB,CAAC;AAE5B,cAAc,cAAc,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "1.
|
|
1
|
+
export declare const version = "1.7.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "c15t",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Developer-first CMP for JavaScript: cookie banner, consent manager, preferences centre. GDPR ready with minimal setup and rich customization",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nextjs",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"@orpc/client": "1.8.1",
|
|
48
48
|
"@orpc/server": "1.8.1",
|
|
49
49
|
"zustand": "^5.0.3",
|
|
50
|
-
"@c15t/
|
|
51
|
-
"@c15t/
|
|
50
|
+
"@c15t/translations": "1.7.0",
|
|
51
|
+
"@c15t/backend": "1.7.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"genversion": "^3.2.0",
|