c15t 0.0.1-rc.3
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/.turbo/turbo-build.log +54 -0
- package/.turbo/turbo-fmt.log +6 -0
- package/.turbo/turbo-lint.log +288 -0
- package/.turbo/turbo-test.log +33 -0
- package/CHANGELOG.md +20 -0
- package/LICENSE.md +595 -0
- package/README.md +28 -0
- package/dist/index.cjs +118 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/libs/__tests__/tracking-blocker.test.cjs +269 -0
- package/dist/libs/__tests__/tracking-blocker.test.d.ts +2 -0
- package/dist/libs/__tests__/tracking-blocker.test.d.ts.map +1 -0
- package/dist/libs/__tests__/tracking-blocker.test.js +267 -0
- package/dist/libs/consent-utils.cjs +68 -0
- package/dist/libs/consent-utils.d.ts +49 -0
- package/dist/libs/consent-utils.d.ts.map +1 -0
- package/dist/libs/consent-utils.js +23 -0
- package/dist/libs/tracking-blocker.cjs +167 -0
- package/dist/libs/tracking-blocker.d.ts +33 -0
- package/dist/libs/tracking-blocker.d.ts.map +1 -0
- package/dist/libs/tracking-blocker.js +108 -0
- package/dist/libs/tracking-domains.cjs +188 -0
- package/dist/libs/tracking-domains.d.ts +7 -0
- package/dist/libs/tracking-domains.d.ts.map +1 -0
- package/dist/libs/tracking-domains.js +146 -0
- package/dist/store.cjs +248 -0
- package/dist/store.d.ts +58 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.initial-state.cjs +105 -0
- package/dist/store.initial-state.d.ts +43 -0
- package/dist/store.initial-state.d.ts.map +1 -0
- package/dist/store.initial-state.js +66 -0
- package/dist/store.js +219 -0
- package/dist/store.type.cjs +22 -0
- package/dist/store.type.d.ts +159 -0
- package/dist/store.type.d.ts.map +1 -0
- package/dist/store.type.js +0 -0
- package/dist/translations/en.cjs +96 -0
- package/dist/translations/en.d.ts +3 -0
- package/dist/translations/en.d.ts.map +1 -0
- package/dist/translations/en.js +54 -0
- package/dist/translations/index.cjs +51 -0
- package/dist/translations/index.d.ts +3 -0
- package/dist/translations/index.d.ts.map +1 -0
- package/dist/translations/index.js +9 -0
- package/dist/types/callbacks.cjs +22 -0
- package/dist/types/callbacks.d.ts +146 -0
- package/dist/types/callbacks.d.ts.map +1 -0
- package/dist/types/callbacks.js +0 -0
- package/dist/types/compliance.cjs +22 -0
- package/dist/types/compliance.d.ts +196 -0
- package/dist/types/compliance.d.ts.map +1 -0
- package/dist/types/compliance.js +0 -0
- package/dist/types/gdpr.cjs +86 -0
- package/dist/types/gdpr.d.ts +168 -0
- package/dist/types/gdpr.d.ts.map +1 -0
- package/dist/types/gdpr.js +44 -0
- package/dist/types/index.cjs +44 -0
- package/dist/types/index.d.ts +141 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/translations.cjs +22 -0
- package/dist/types/translations.d.ts +52 -0
- package/dist/types/translations.d.ts.map +1 -0
- package/dist/types/translations.js +0 -0
- package/package.json +33 -0
- package/rslib.config.ts +28 -0
- package/src/index.ts +31 -0
- package/src/libs/__tests__/tracking-blocker.test.ts +271 -0
- package/src/libs/consent-utils.ts +70 -0
- package/src/libs/tracking-blocker.ts +202 -0
- package/src/libs/tracking-domains.ts +158 -0
- package/src/store.initial-state.ts +123 -0
- package/src/store.ts +450 -0
- package/src/store.type.ts +187 -0
- package/src/translations/en.ts +55 -0
- package/src/translations/index.ts +10 -0
- package/src/types/callbacks.ts +152 -0
- package/src/types/compliance.ts +205 -0
- package/src/types/gdpr.ts +217 -0
- package/src/types/index.ts +148 -0
- package/src/types/translations.ts +60 -0
- package/tsconfig.json +12 -0
- package/vitest.config.ts +15 -0
package/dist/store.cjs
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(() => {
|
|
4
|
+
__webpack_require__.d = function (exports1, definition) {
|
|
5
|
+
for (var key in definition)
|
|
6
|
+
if (
|
|
7
|
+
__webpack_require__.o(definition, key) &&
|
|
8
|
+
!__webpack_require__.o(exports1, key)
|
|
9
|
+
)
|
|
10
|
+
Object.defineProperty(exports1, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: definition[key],
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
(() => {
|
|
17
|
+
__webpack_require__.o = function (obj, prop) {
|
|
18
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
19
|
+
};
|
|
20
|
+
})();
|
|
21
|
+
(() => {
|
|
22
|
+
__webpack_require__.r = function (exports1) {
|
|
23
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag)
|
|
24
|
+
Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
25
|
+
value: 'Module',
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
28
|
+
value: true,
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
})();
|
|
32
|
+
var __webpack_exports__ = {};
|
|
33
|
+
__webpack_require__.r(__webpack_exports__);
|
|
34
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
35
|
+
createConsentManagerStore: () => createConsentManagerStore,
|
|
36
|
+
default: () => store_rslib_entry_,
|
|
37
|
+
});
|
|
38
|
+
const vanilla_namespaceObject = require('zustand/vanilla');
|
|
39
|
+
const consent_utils_cjs_namespaceObject = require('./libs/consent-utils.cjs');
|
|
40
|
+
const tracking_blocker_cjs_namespaceObject = require('./libs/tracking-blocker.cjs');
|
|
41
|
+
const external_store_initial_state_cjs_namespaceObject = require('./store.initial-state.cjs');
|
|
42
|
+
const index_cjs_namespaceObject = require('./types/index.cjs');
|
|
43
|
+
const STORAGE_KEY = 'privacy-consent-storage';
|
|
44
|
+
const getStoredConsent = () => {
|
|
45
|
+
if ('undefined' == typeof window) return null;
|
|
46
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
47
|
+
if (!stored) return null;
|
|
48
|
+
try {
|
|
49
|
+
return JSON.parse(stored);
|
|
50
|
+
} catch (e) {
|
|
51
|
+
console.error('Failed to parse stored consent:', e);
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const createConsentManagerStore = (namespace = 'c15tStore', config) => {
|
|
56
|
+
const storedConsent = getStoredConsent();
|
|
57
|
+
const trackingBlocker =
|
|
58
|
+
'undefined' != typeof window
|
|
59
|
+
? (0, tracking_blocker_cjs_namespaceObject.createTrackingBlocker)(
|
|
60
|
+
config?.trackingBlockerConfig || {},
|
|
61
|
+
storedConsent?.consents ||
|
|
62
|
+
external_store_initial_state_cjs_namespaceObject.initialState
|
|
63
|
+
.consents
|
|
64
|
+
)
|
|
65
|
+
: null;
|
|
66
|
+
const store = (0, vanilla_namespaceObject.createStore)((set, get) => ({
|
|
67
|
+
...external_store_initial_state_cjs_namespaceObject.initialState,
|
|
68
|
+
...(storedConsent
|
|
69
|
+
? {
|
|
70
|
+
consents: storedConsent.consents,
|
|
71
|
+
consentInfo: storedConsent.consentInfo,
|
|
72
|
+
showPopup: false,
|
|
73
|
+
}
|
|
74
|
+
: {
|
|
75
|
+
showPopup: true,
|
|
76
|
+
}),
|
|
77
|
+
setConsent: (name, value) => {
|
|
78
|
+
set((state) => {
|
|
79
|
+
const consentType = state.consentTypes.find(
|
|
80
|
+
(type) => type.name === name
|
|
81
|
+
);
|
|
82
|
+
if (consentType?.disabled) return state;
|
|
83
|
+
const newConsents = {
|
|
84
|
+
...state.consents,
|
|
85
|
+
[name]: value,
|
|
86
|
+
};
|
|
87
|
+
trackingBlocker?.updateConsents(newConsents);
|
|
88
|
+
return {
|
|
89
|
+
consents: newConsents,
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
get().updateConsentMode();
|
|
93
|
+
},
|
|
94
|
+
setShowPopup: (show, force = false) => {
|
|
95
|
+
const state = get();
|
|
96
|
+
const storedConsent = getStoredConsent();
|
|
97
|
+
if (force || (!storedConsent && !state.consentInfo && show))
|
|
98
|
+
set({
|
|
99
|
+
showPopup: show,
|
|
100
|
+
});
|
|
101
|
+
},
|
|
102
|
+
setIsPrivacyDialogOpen: (isOpen) => {
|
|
103
|
+
set({
|
|
104
|
+
isPrivacyDialogOpen: isOpen,
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
saveConsents: (type) => {
|
|
108
|
+
const {
|
|
109
|
+
callbacks,
|
|
110
|
+
updateConsentMode,
|
|
111
|
+
consents,
|
|
112
|
+
consentTypes,
|
|
113
|
+
includeNonDisplayedConsents,
|
|
114
|
+
} = get();
|
|
115
|
+
const newConsents = {
|
|
116
|
+
...consents,
|
|
117
|
+
};
|
|
118
|
+
if ('all' === type)
|
|
119
|
+
for (const consent of consentTypes) newConsents[consent.name] = true;
|
|
120
|
+
else if ('necessary' === type)
|
|
121
|
+
for (const consent of consentTypes)
|
|
122
|
+
newConsents[consent.name] = 'necessary' === consent.name;
|
|
123
|
+
const consentInfo = {
|
|
124
|
+
time: Date.now(),
|
|
125
|
+
type: type,
|
|
126
|
+
};
|
|
127
|
+
localStorage.setItem(
|
|
128
|
+
STORAGE_KEY,
|
|
129
|
+
JSON.stringify({
|
|
130
|
+
consents: newConsents,
|
|
131
|
+
consentInfo,
|
|
132
|
+
})
|
|
133
|
+
);
|
|
134
|
+
trackingBlocker?.updateConsents(newConsents);
|
|
135
|
+
set({
|
|
136
|
+
consents: newConsents,
|
|
137
|
+
showPopup: false,
|
|
138
|
+
consentInfo,
|
|
139
|
+
});
|
|
140
|
+
updateConsentMode();
|
|
141
|
+
callbacks.onConsentGiven?.();
|
|
142
|
+
callbacks.onPreferenceExpressed?.();
|
|
143
|
+
},
|
|
144
|
+
resetConsents: () => {
|
|
145
|
+
set((state) => {
|
|
146
|
+
const resetState = {
|
|
147
|
+
consents: index_cjs_namespaceObject.consentTypes.reduce(
|
|
148
|
+
(acc, consent) => {
|
|
149
|
+
acc[consent.name] = consent.defaultValue;
|
|
150
|
+
return acc;
|
|
151
|
+
},
|
|
152
|
+
{}
|
|
153
|
+
),
|
|
154
|
+
consentInfo: null,
|
|
155
|
+
};
|
|
156
|
+
localStorage.removeItem(STORAGE_KEY);
|
|
157
|
+
return resetState;
|
|
158
|
+
});
|
|
159
|
+
},
|
|
160
|
+
setGdprTypes: (types) =>
|
|
161
|
+
set({
|
|
162
|
+
gdprTypes: types,
|
|
163
|
+
}),
|
|
164
|
+
setComplianceSetting: (region, settings) =>
|
|
165
|
+
set((state) => ({
|
|
166
|
+
complianceSettings: {
|
|
167
|
+
...state.complianceSettings,
|
|
168
|
+
[region]: {
|
|
169
|
+
...state.complianceSettings[region],
|
|
170
|
+
...settings,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
})),
|
|
174
|
+
resetComplianceSettings: () =>
|
|
175
|
+
set({
|
|
176
|
+
complianceSettings:
|
|
177
|
+
external_store_initial_state_cjs_namespaceObject.initialState
|
|
178
|
+
.complianceSettings,
|
|
179
|
+
}),
|
|
180
|
+
setCallback: (name, callback) =>
|
|
181
|
+
set((state) => ({
|
|
182
|
+
callbacks: {
|
|
183
|
+
...state.callbacks,
|
|
184
|
+
[name]: callback,
|
|
185
|
+
},
|
|
186
|
+
})),
|
|
187
|
+
setDetectedCountry: (country) =>
|
|
188
|
+
set({
|
|
189
|
+
detectedCountry: country,
|
|
190
|
+
}),
|
|
191
|
+
getDisplayedConsents: () => {
|
|
192
|
+
const { gdprTypes, consentTypes } = get();
|
|
193
|
+
return consentTypes.filter((consent) => gdprTypes.includes(consent.name));
|
|
194
|
+
},
|
|
195
|
+
hasConsented: () => {
|
|
196
|
+
const { consentInfo } = get();
|
|
197
|
+
return (0, consent_utils_cjs_namespaceObject.hasConsented)(consentInfo);
|
|
198
|
+
},
|
|
199
|
+
clearAllData: () => {
|
|
200
|
+
set(external_store_initial_state_cjs_namespaceObject.initialState);
|
|
201
|
+
localStorage.removeItem(STORAGE_KEY);
|
|
202
|
+
},
|
|
203
|
+
updateConsentMode: () => {
|
|
204
|
+
get().getEffectiveConsents();
|
|
205
|
+
},
|
|
206
|
+
setPrivacySettings: (settings) =>
|
|
207
|
+
set((state) => ({
|
|
208
|
+
privacySettings: {
|
|
209
|
+
...state.privacySettings,
|
|
210
|
+
...settings,
|
|
211
|
+
},
|
|
212
|
+
})),
|
|
213
|
+
getEffectiveConsents: () => {
|
|
214
|
+
const { consents, privacySettings } = get();
|
|
215
|
+
return (0, consent_utils_cjs_namespaceObject.getEffectiveConsents)(
|
|
216
|
+
consents,
|
|
217
|
+
privacySettings.honorDoNotTrack
|
|
218
|
+
);
|
|
219
|
+
},
|
|
220
|
+
hasConsentFor: (consentType) => {
|
|
221
|
+
const { consents, privacySettings } = get();
|
|
222
|
+
return (0, consent_utils_cjs_namespaceObject.hasConsentFor)(
|
|
223
|
+
consentType,
|
|
224
|
+
consents,
|
|
225
|
+
privacySettings.honorDoNotTrack
|
|
226
|
+
);
|
|
227
|
+
},
|
|
228
|
+
setIncludeNonDisplayedConsents: (include) =>
|
|
229
|
+
set({
|
|
230
|
+
includeNonDisplayedConsents: include,
|
|
231
|
+
}),
|
|
232
|
+
setTranslationConfig: (config) => {
|
|
233
|
+
set({
|
|
234
|
+
translationConfig: config,
|
|
235
|
+
});
|
|
236
|
+
},
|
|
237
|
+
}));
|
|
238
|
+
if ('undefined' != typeof window) window[namespace] = store;
|
|
239
|
+
return store;
|
|
240
|
+
};
|
|
241
|
+
const store_rslib_entry_ = createConsentManagerStore;
|
|
242
|
+
var __webpack_export_target__ = exports;
|
|
243
|
+
for (var __webpack_i__ in __webpack_exports__)
|
|
244
|
+
__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
245
|
+
if (__webpack_exports__.__esModule)
|
|
246
|
+
Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
247
|
+
value: true,
|
|
248
|
+
});
|
package/dist/store.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Implements the core consent management store using Zustand.
|
|
4
|
+
* This module provides the main store creation and management functionality.
|
|
5
|
+
*/
|
|
6
|
+
import type { TrackingBlockerConfig } from './libs/tracking-blocker';
|
|
7
|
+
import type { PrivacyConsentState } from './store.type';
|
|
8
|
+
interface StoreConfig {
|
|
9
|
+
trackingBlockerConfig?: TrackingBlockerConfig;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new consent manager store instance.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* This function initializes a new consent management store with:
|
|
16
|
+
* - Persistence through localStorage
|
|
17
|
+
* - Initial state handling
|
|
18
|
+
* - Consent management methods
|
|
19
|
+
* - Privacy settings
|
|
20
|
+
* - Compliance configuration
|
|
21
|
+
*
|
|
22
|
+
* The store is typically used through React hooks but can also be
|
|
23
|
+
* accessed directly for non-React applications.
|
|
24
|
+
*
|
|
25
|
+
* @param namespace - Optional namespace for the store instance
|
|
26
|
+
* @returns A Zustand store instance with consent management functionality
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* Basic usage:
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const store = createConsentManagerStore();
|
|
32
|
+
*
|
|
33
|
+
* // Subscribe to state changes
|
|
34
|
+
* const unsubscribe = store.subscribe(
|
|
35
|
+
* state => console.log('Consent updated:', state.consents)
|
|
36
|
+
* );
|
|
37
|
+
*
|
|
38
|
+
* // Update consent
|
|
39
|
+
* store.getState().setConsent('analytics', true);
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* Custom namespace:
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const store = createConsentManagerStore('MyApp');
|
|
46
|
+
*
|
|
47
|
+
* // Access from window
|
|
48
|
+
* const state = window.MyApp.getState();
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
export declare const createConsentManagerStore: (
|
|
54
|
+
namespace?: string | undefined,
|
|
55
|
+
config?: StoreConfig
|
|
56
|
+
) => import('zustand/vanilla').StoreApi<PrivacyConsentState>;
|
|
57
|
+
export default createConsentManagerStore;
|
|
58
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAoDxD,UAAU,WAAW;IACpB,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;CAC9C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,yBAAyB,eAC1B,MAAM,GAAG,SAAS,WACpB,WAAW,4DA4UpB,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(() => {
|
|
4
|
+
__webpack_require__.d = function (exports1, definition) {
|
|
5
|
+
for (var key in definition)
|
|
6
|
+
if (
|
|
7
|
+
__webpack_require__.o(definition, key) &&
|
|
8
|
+
!__webpack_require__.o(exports1, key)
|
|
9
|
+
)
|
|
10
|
+
Object.defineProperty(exports1, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: definition[key],
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
(() => {
|
|
17
|
+
__webpack_require__.o = function (obj, prop) {
|
|
18
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
19
|
+
};
|
|
20
|
+
})();
|
|
21
|
+
(() => {
|
|
22
|
+
__webpack_require__.r = function (exports1) {
|
|
23
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag)
|
|
24
|
+
Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
25
|
+
value: 'Module',
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
28
|
+
value: true,
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
})();
|
|
32
|
+
var __webpack_exports__ = {};
|
|
33
|
+
__webpack_require__.r(__webpack_exports__);
|
|
34
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
35
|
+
initialState: () => initialState,
|
|
36
|
+
});
|
|
37
|
+
const index_cjs_namespaceObject = require('./translations/index.cjs');
|
|
38
|
+
const external_types_index_cjs_namespaceObject = require('./types/index.cjs');
|
|
39
|
+
const initialState = {
|
|
40
|
+
consents: external_types_index_cjs_namespaceObject.consentTypes.reduce(
|
|
41
|
+
(acc, consent) => {
|
|
42
|
+
acc[consent.name] = consent.defaultValue;
|
|
43
|
+
return acc;
|
|
44
|
+
},
|
|
45
|
+
{}
|
|
46
|
+
),
|
|
47
|
+
consentInfo: null,
|
|
48
|
+
showPopup: true,
|
|
49
|
+
gdprTypes: ['necessary', 'marketing'],
|
|
50
|
+
isPrivacyDialogOpen: false,
|
|
51
|
+
complianceSettings: {
|
|
52
|
+
gdpr: {
|
|
53
|
+
enabled: true,
|
|
54
|
+
appliesGlobally: true,
|
|
55
|
+
applies: true,
|
|
56
|
+
},
|
|
57
|
+
ccpa: {
|
|
58
|
+
enabled: true,
|
|
59
|
+
appliesGlobally: false,
|
|
60
|
+
applies: void 0,
|
|
61
|
+
},
|
|
62
|
+
lgpd: {
|
|
63
|
+
enabled: false,
|
|
64
|
+
appliesGlobally: false,
|
|
65
|
+
applies: void 0,
|
|
66
|
+
},
|
|
67
|
+
usStatePrivacy: {
|
|
68
|
+
enabled: true,
|
|
69
|
+
appliesGlobally: false,
|
|
70
|
+
applies: void 0,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
callbacks: {},
|
|
74
|
+
detectedCountry: 'US',
|
|
75
|
+
privacySettings: {
|
|
76
|
+
honorDoNotTrack: true,
|
|
77
|
+
},
|
|
78
|
+
translationConfig: index_cjs_namespaceObject.defaultTranslationConfig,
|
|
79
|
+
includeNonDisplayedConsents: false,
|
|
80
|
+
consentTypes: external_types_index_cjs_namespaceObject.consentTypes,
|
|
81
|
+
setConsent: () => {},
|
|
82
|
+
setShowPopup: () => {},
|
|
83
|
+
setIsPrivacyDialogOpen: () => {},
|
|
84
|
+
saveConsents: () => {},
|
|
85
|
+
resetConsents: () => {},
|
|
86
|
+
setGdprTypes: () => {},
|
|
87
|
+
setComplianceSetting: () => {},
|
|
88
|
+
resetComplianceSettings: () => {},
|
|
89
|
+
setCallback: () => {},
|
|
90
|
+
setDetectedCountry: () => {},
|
|
91
|
+
getDisplayedConsents: () => [],
|
|
92
|
+
hasConsented: () => false,
|
|
93
|
+
setTranslationConfig: () => {},
|
|
94
|
+
clearAllData: () => {},
|
|
95
|
+
updateConsentMode: () => {},
|
|
96
|
+
setPrivacySettings: () => {},
|
|
97
|
+
setIncludeNonDisplayedConsents: () => {},
|
|
98
|
+
};
|
|
99
|
+
var __webpack_export_target__ = exports;
|
|
100
|
+
for (var __webpack_i__ in __webpack_exports__)
|
|
101
|
+
__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
102
|
+
if (__webpack_exports__.__esModule)
|
|
103
|
+
Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
104
|
+
value: true,
|
|
105
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Provides the default initial state configuration for the consent management store.
|
|
4
|
+
*/
|
|
5
|
+
import type { PrivacyConsentState } from './store.type';
|
|
6
|
+
/**
|
|
7
|
+
* Default initial state for the consent management store.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* This configuration establishes the baseline state for the consent manager,
|
|
11
|
+
* including default consent values, compliance settings, and privacy preferences.
|
|
12
|
+
*
|
|
13
|
+
* Notable defaults include:
|
|
14
|
+
* - All consents start with their type-specific default values
|
|
15
|
+
* - GDPR compliance is globally enabled
|
|
16
|
+
* - CCPA compliance is enabled for US users only
|
|
17
|
+
* - Do Not Track is respected by default
|
|
18
|
+
* - Only necessary and marketing consents are included in gdprTypes
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* Using the initial state:
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const store = createConsentManagerStore();
|
|
24
|
+
*
|
|
25
|
+
* // Reset to initial state
|
|
26
|
+
* store.setState(initialState);
|
|
27
|
+
*
|
|
28
|
+
* // Extend initial state
|
|
29
|
+
* const customState = {
|
|
30
|
+
* ...initialState,
|
|
31
|
+
* privacySettings: {
|
|
32
|
+
* honorDoNotTrack: false
|
|
33
|
+
* }
|
|
34
|
+
* };
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
export declare const initialState: Omit<
|
|
40
|
+
PrivacyConsentState,
|
|
41
|
+
'getEffectiveConsents' | 'hasConsentFor'
|
|
42
|
+
>;
|
|
43
|
+
//# sourceMappingURL=store.initial-state.d.ts.map
|
|
@@ -0,0 +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;AAIxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,YAAY,EAAE,IAAI,CAC9B,mBAAmB,EACnB,sBAAsB,GAAG,eAAe,CA8ExC,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__translations_index_js_8dbce45e__ from './translations/index.js';
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE__types_index_js_63ede62f__ from './types/index.js';
|
|
3
|
+
const initialState = {
|
|
4
|
+
consents:
|
|
5
|
+
__WEBPACK_EXTERNAL_MODULE__types_index_js_63ede62f__.consentTypes.reduce(
|
|
6
|
+
(acc, consent) => {
|
|
7
|
+
acc[consent.name] = consent.defaultValue;
|
|
8
|
+
return acc;
|
|
9
|
+
},
|
|
10
|
+
{}
|
|
11
|
+
),
|
|
12
|
+
consentInfo: null,
|
|
13
|
+
showPopup: true,
|
|
14
|
+
gdprTypes: ['necessary', 'marketing'],
|
|
15
|
+
isPrivacyDialogOpen: false,
|
|
16
|
+
complianceSettings: {
|
|
17
|
+
gdpr: {
|
|
18
|
+
enabled: true,
|
|
19
|
+
appliesGlobally: true,
|
|
20
|
+
applies: true,
|
|
21
|
+
},
|
|
22
|
+
ccpa: {
|
|
23
|
+
enabled: true,
|
|
24
|
+
appliesGlobally: false,
|
|
25
|
+
applies: void 0,
|
|
26
|
+
},
|
|
27
|
+
lgpd: {
|
|
28
|
+
enabled: false,
|
|
29
|
+
appliesGlobally: false,
|
|
30
|
+
applies: void 0,
|
|
31
|
+
},
|
|
32
|
+
usStatePrivacy: {
|
|
33
|
+
enabled: true,
|
|
34
|
+
appliesGlobally: false,
|
|
35
|
+
applies: void 0,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
callbacks: {},
|
|
39
|
+
detectedCountry: 'US',
|
|
40
|
+
privacySettings: {
|
|
41
|
+
honorDoNotTrack: true,
|
|
42
|
+
},
|
|
43
|
+
translationConfig:
|
|
44
|
+
__WEBPACK_EXTERNAL_MODULE__translations_index_js_8dbce45e__.defaultTranslationConfig,
|
|
45
|
+
includeNonDisplayedConsents: false,
|
|
46
|
+
consentTypes:
|
|
47
|
+
__WEBPACK_EXTERNAL_MODULE__types_index_js_63ede62f__.consentTypes,
|
|
48
|
+
setConsent: () => {},
|
|
49
|
+
setShowPopup: () => {},
|
|
50
|
+
setIsPrivacyDialogOpen: () => {},
|
|
51
|
+
saveConsents: () => {},
|
|
52
|
+
resetConsents: () => {},
|
|
53
|
+
setGdprTypes: () => {},
|
|
54
|
+
setComplianceSetting: () => {},
|
|
55
|
+
resetComplianceSettings: () => {},
|
|
56
|
+
setCallback: () => {},
|
|
57
|
+
setDetectedCountry: () => {},
|
|
58
|
+
getDisplayedConsents: () => [],
|
|
59
|
+
hasConsented: () => false,
|
|
60
|
+
setTranslationConfig: () => {},
|
|
61
|
+
clearAllData: () => {},
|
|
62
|
+
updateConsentMode: () => {},
|
|
63
|
+
setPrivacySettings: () => {},
|
|
64
|
+
setIncludeNonDisplayedConsents: () => {},
|
|
65
|
+
};
|
|
66
|
+
export { initialState };
|