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
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A generic type for callback functions that can accept an argument of type T.
|
|
3
|
+
*
|
|
4
|
+
* @typeParam T - The type of the argument that the callback function accepts. Defaults to `void` if not specified.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This type is used throughout the consent management system to define callback functions
|
|
8
|
+
* with consistent typing. It ensures type safety when passing callbacks between components.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* // Callback with no arguments
|
|
13
|
+
* const readyCallback: CallbackFunction = () => {
|
|
14
|
+
* console.log('System ready');
|
|
15
|
+
* };
|
|
16
|
+
*
|
|
17
|
+
* // Callback with string argument
|
|
18
|
+
* const errorCallback: CallbackFunction<string> = (errorMessage) => {
|
|
19
|
+
* console.error('Error occurred:', errorMessage);
|
|
20
|
+
* };
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export type CallbackFunction<T = void> = (arg: T) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Defines the structure for callback functions that respond to consent-related events.
|
|
28
|
+
* These callbacks enable custom actions at different stages of the consent management process.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* All callbacks are optional and will be called at specific points in the consent management lifecycle:
|
|
32
|
+
*
|
|
33
|
+
* Initialization callbacks:
|
|
34
|
+
* - `onReady`: System initialization complete, ready to handle consent
|
|
35
|
+
* - `onError`: Error occurred during operation
|
|
36
|
+
*
|
|
37
|
+
* Banner interaction callbacks:
|
|
38
|
+
* - `onBannerShown`: Consent banner has been displayed
|
|
39
|
+
* - `onBannerClosed`: User has closed the consent banner
|
|
40
|
+
*
|
|
41
|
+
* Consent decision callbacks:
|
|
42
|
+
* - `onConsentGiven`: User has granted consent
|
|
43
|
+
* - `onConsentRejected`: User has rejected consent
|
|
44
|
+
* - `onPreferenceExpressed`: User has made their preferences known
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* Basic usage with TypeScript:
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const callbacks: Callbacks = {
|
|
50
|
+
* onReady: () => {
|
|
51
|
+
* console.log('Consent manager ready');
|
|
52
|
+
* },
|
|
53
|
+
* onError: (error) => {
|
|
54
|
+
* console.error('Consent manager error:', error);
|
|
55
|
+
* },
|
|
56
|
+
* onConsentGiven: () => {
|
|
57
|
+
* initializeAnalytics();
|
|
58
|
+
* }
|
|
59
|
+
* };
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* Full implementation with all callbacks:
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const consentCallbacks: Callbacks = {
|
|
66
|
+
* onReady: () => {
|
|
67
|
+
* console.log('Consent manager initialized');
|
|
68
|
+
* checkInitialConsent();
|
|
69
|
+
* },
|
|
70
|
+
*
|
|
71
|
+
* onBannerShown: () => {
|
|
72
|
+
* logBannerImpression();
|
|
73
|
+
* pauseBackgroundVideos();
|
|
74
|
+
* },
|
|
75
|
+
*
|
|
76
|
+
* onBannerClosed: () => {
|
|
77
|
+
* resumeBackgroundVideos();
|
|
78
|
+
* updateUIState('banner-closed');
|
|
79
|
+
* },
|
|
80
|
+
*
|
|
81
|
+
* onConsentGiven: () => {
|
|
82
|
+
* enableTracking();
|
|
83
|
+
* initializeServices();
|
|
84
|
+
* },
|
|
85
|
+
*
|
|
86
|
+
* onConsentRejected: () => {
|
|
87
|
+
* disableTracking();
|
|
88
|
+
* updatePrivacyMode('strict');
|
|
89
|
+
* },
|
|
90
|
+
*
|
|
91
|
+
* onPreferenceExpressed: () => {
|
|
92
|
+
* saveUserPreferences();
|
|
93
|
+
* updateUI();
|
|
94
|
+
* },
|
|
95
|
+
*
|
|
96
|
+
* onError: (errorMessage) => {
|
|
97
|
+
* console.error('Consent Error:', errorMessage);
|
|
98
|
+
* notifyAdministrator(errorMessage);
|
|
99
|
+
* }
|
|
100
|
+
* };
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* Usage with React:
|
|
105
|
+
* ```tsx
|
|
106
|
+
* function ConsentManager() {
|
|
107
|
+
* const callbacks: Callbacks = useMemo(() => ({
|
|
108
|
+
* onReady: () => setIsReady(true),
|
|
109
|
+
* onBannerShown: () => trackEvent('banner-shown'),
|
|
110
|
+
* onConsentGiven: () => {
|
|
111
|
+
* initializeAnalytics();
|
|
112
|
+
* refreshAds();
|
|
113
|
+
* }
|
|
114
|
+
* }), []);
|
|
115
|
+
*
|
|
116
|
+
* return (
|
|
117
|
+
* <ConsentProvider callbacks={callbacks}>
|
|
118
|
+
* {children}
|
|
119
|
+
* </ConsentProvider>
|
|
120
|
+
* );
|
|
121
|
+
* }
|
|
122
|
+
* ```
|
|
123
|
+
*
|
|
124
|
+
* @see {@link CallbackFunction} For the type definition of individual callbacks
|
|
125
|
+
* @public
|
|
126
|
+
*/
|
|
127
|
+
export interface Callbacks {
|
|
128
|
+
/** Called when the consent management system is fully initialized and ready */
|
|
129
|
+
onReady?: CallbackFunction;
|
|
130
|
+
/** Called when the consent banner becomes visible to the user */
|
|
131
|
+
onBannerShown?: CallbackFunction;
|
|
132
|
+
/** Called when the consent banner is dismissed or hidden */
|
|
133
|
+
onBannerClosed?: CallbackFunction;
|
|
134
|
+
/** Called when the user grants consent for one or more purposes */
|
|
135
|
+
onConsentGiven?: CallbackFunction;
|
|
136
|
+
/** Called when the user denies consent for one or more purposes */
|
|
137
|
+
onConsentRejected?: CallbackFunction;
|
|
138
|
+
/** Called when the user makes any change to their consent preferences */
|
|
139
|
+
onPreferenceExpressed?: CallbackFunction;
|
|
140
|
+
/**
|
|
141
|
+
* Called when an error occurs in the consent management system
|
|
142
|
+
* @param errorMessage - A description of the error that occurred
|
|
143
|
+
*/
|
|
144
|
+
onError?: CallbackFunction<string>;
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=callbacks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callbacks.d.ts","sourceRoot":"","sources":["../../src/types/callbacks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoGG;AACH,MAAM,WAAW,SAAS;IACzB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAE3B,iEAAiE;IACjE,aAAa,CAAC,EAAE,gBAAgB,CAAC;IAEjC,4DAA4D;IAC5D,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAElC,mEAAmE;IACnE,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAElC,mEAAmE;IACnE,iBAAiB,CAAC,EAAE,gBAAgB,CAAC;IAErC,yEAAyE;IACzE,qBAAqB,CAAC,EAAE,gBAAgB,CAAC;IAEzC;;;OAGG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;CACnC"}
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(() => {
|
|
4
|
+
__webpack_require__.r = function (exports1) {
|
|
5
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag)
|
|
6
|
+
Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
7
|
+
value: 'Module',
|
|
8
|
+
});
|
|
9
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
10
|
+
value: true,
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
})();
|
|
14
|
+
var __webpack_exports__ = {};
|
|
15
|
+
__webpack_require__.r(__webpack_exports__);
|
|
16
|
+
var __webpack_export_target__ = exports;
|
|
17
|
+
for (var __webpack_i__ in __webpack_exports__)
|
|
18
|
+
__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
19
|
+
if (__webpack_exports__.__esModule)
|
|
20
|
+
Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
21
|
+
value: true,
|
|
22
|
+
});
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import type { AllConsentNames } from './gdpr';
|
|
2
|
+
/**
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
* Provides types and interfaces for managing privacy compliance and consent across different regulatory frameworks.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Represents the state of consents for different types of data processing.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Maps each consent type to a boolean indicating whether consent has been granted.
|
|
11
|
+
* The consent types are defined by {@link AllConsentNames} and typically include
|
|
12
|
+
* categories like 'necessary', 'functional', 'analytics', etc.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const consentState: ConsentState = {
|
|
17
|
+
* necessary: true, // Required functionality
|
|
18
|
+
* functional: true, // Enhanced features
|
|
19
|
+
* analytics: false, // Usage tracking
|
|
20
|
+
* marketing: false // Marketing cookies
|
|
21
|
+
* };
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export type ConsentState = Record<AllConsentNames, boolean>;
|
|
27
|
+
/**
|
|
28
|
+
* Defines supported privacy regulation frameworks and regions.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* Each region represents a different privacy regulation framework:
|
|
32
|
+
* - `gdpr`: European Union's General Data Protection Regulation
|
|
33
|
+
* - `ccpa`: California Consumer Privacy Act
|
|
34
|
+
* - `lgpd`: Brazil's Lei Geral de Proteção de Dados
|
|
35
|
+
* - `usStatePrivacy`: Other U.S. state privacy laws (e.g., VCDPA, CPA)
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* function isRegionCompliant(region: ComplianceRegion): boolean {
|
|
40
|
+
* switch (region) {
|
|
41
|
+
* case 'gdpr':
|
|
42
|
+
* return checkGDPRCompliance();
|
|
43
|
+
* case 'ccpa':
|
|
44
|
+
* return checkCCPACompliance();
|
|
45
|
+
* // ... handle other regions
|
|
46
|
+
* }
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export type ComplianceRegion = 'gdpr' | 'ccpa' | 'lgpd' | 'usStatePrivacy';
|
|
53
|
+
/**
|
|
54
|
+
* Configuration settings for privacy regulation compliance.
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* These settings determine how privacy regulations are enforced:
|
|
58
|
+
* - `enabled`: Activates or deactivates the compliance framework
|
|
59
|
+
* - `appliesGlobally`: Whether to apply these rules worldwide
|
|
60
|
+
* - `applies`: Whether the regulation applies in the current context
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const gdprSettings: ComplianceSettings = {
|
|
65
|
+
* enabled: true, // GDPR compliance is active
|
|
66
|
+
* appliesGlobally: false, // Only applies to EU users
|
|
67
|
+
* applies: isEUUser() // Dynamically check if user is in EU
|
|
68
|
+
* };
|
|
69
|
+
*
|
|
70
|
+
* const ccpaSettings: ComplianceSettings = {
|
|
71
|
+
* enabled: true,
|
|
72
|
+
* appliesGlobally: false,
|
|
73
|
+
* applies: isCaliforniaUser() // Check if user is in California
|
|
74
|
+
* };
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @see {@link ComplianceRegion} for available regions
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
export type ComplianceSettings = {
|
|
81
|
+
/** Whether the compliance framework is active */
|
|
82
|
+
enabled: boolean;
|
|
83
|
+
/** Whether to apply compliance rules globally */
|
|
84
|
+
appliesGlobally: boolean;
|
|
85
|
+
/** Whether the regulation applies in current context */
|
|
86
|
+
applies: boolean | undefined;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* User privacy preference configuration.
|
|
90
|
+
*
|
|
91
|
+
* @remarks
|
|
92
|
+
* Contains settings that affect how user privacy preferences are handled:
|
|
93
|
+
* - `honorDoNotTrack`: Respects the browser's DNT (Do Not Track) setting
|
|
94
|
+
*
|
|
95
|
+
* When `honorDoNotTrack` is true and the user has enabled DNT in their browser:
|
|
96
|
+
* - All non-essential tracking will be disabled
|
|
97
|
+
* - Only necessary cookies will be allowed
|
|
98
|
+
* - Analytics and marketing features will be disabled
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* const privacySettings: PrivacySettings = {
|
|
103
|
+
* honorDoNotTrack: true // Respect browser's DNT setting
|
|
104
|
+
* };
|
|
105
|
+
*
|
|
106
|
+
* function shouldTrack(): boolean {
|
|
107
|
+
* return !(
|
|
108
|
+
* privacySettings.honorDoNotTrack &&
|
|
109
|
+
* navigator.doNotTrack === "1"
|
|
110
|
+
* );
|
|
111
|
+
* }
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* @public
|
|
115
|
+
*/
|
|
116
|
+
export type PrivacySettings = {
|
|
117
|
+
/** Whether to respect the browser's Do Not Track setting */
|
|
118
|
+
honorDoNotTrack: boolean;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Records information about a user's consent decision.
|
|
122
|
+
*
|
|
123
|
+
* @remarks
|
|
124
|
+
* This type tracks when and how consent was given:
|
|
125
|
+
* - `time`: Unix timestamp of when consent was given
|
|
126
|
+
* - `type`: The scope of consent granted
|
|
127
|
+
* - `'all'`: Accepted all consent types
|
|
128
|
+
* - `'custom'`: Selected specific consent types
|
|
129
|
+
* - `'necessary'`: Only accepted necessary cookies
|
|
130
|
+
*
|
|
131
|
+
* Can be `null` if no consent has been recorded yet.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* // User accepted all cookies
|
|
136
|
+
* const fullConsent: HasConsentedProps = {
|
|
137
|
+
* time: Date.now(),
|
|
138
|
+
* type: 'all'
|
|
139
|
+
* };
|
|
140
|
+
*
|
|
141
|
+
* // User customized their consent
|
|
142
|
+
* const customConsent: HasConsentedProps = {
|
|
143
|
+
* time: Date.now(),
|
|
144
|
+
* type: 'custom'
|
|
145
|
+
* };
|
|
146
|
+
*
|
|
147
|
+
* // No consent recorded yet
|
|
148
|
+
* const noConsent: HasConsentedProps = null;
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
* @public
|
|
152
|
+
*/
|
|
153
|
+
export type HasConsentedProps = {
|
|
154
|
+
/** Timestamp when consent was given */
|
|
155
|
+
time: number;
|
|
156
|
+
/** Type of consent granted */
|
|
157
|
+
type: 'all' | 'custom' | 'necessary';
|
|
158
|
+
} | null;
|
|
159
|
+
/**
|
|
160
|
+
* Configuration for the consent manager's namespace.
|
|
161
|
+
*
|
|
162
|
+
* @remarks
|
|
163
|
+
* The namespace is used to:
|
|
164
|
+
* - Isolate consent manager instances
|
|
165
|
+
* - Prevent conflicts with other global variables
|
|
166
|
+
* - Support multiple consent managers on the same page
|
|
167
|
+
* - Maintain state persistence across page loads
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* // Basic usage with default namespace
|
|
172
|
+
* const defaultConfig: NamespaceProps = {};
|
|
173
|
+
*
|
|
174
|
+
* // Custom namespace for multiple instances
|
|
175
|
+
* const customConfig: NamespaceProps = {
|
|
176
|
+
* namespace: 'MyAppConsent'
|
|
177
|
+
* };
|
|
178
|
+
*
|
|
179
|
+
* // Multiple consent managers
|
|
180
|
+
* const configs = {
|
|
181
|
+
* main: { namespace: 'MainAppConsent' },
|
|
182
|
+
* subsite: { namespace: 'SubsiteConsent' }
|
|
183
|
+
* };
|
|
184
|
+
* ```
|
|
185
|
+
*
|
|
186
|
+
* @public
|
|
187
|
+
*/
|
|
188
|
+
export type NamespaceProps = {
|
|
189
|
+
/**
|
|
190
|
+
* Global namespace for the consent manager store.
|
|
191
|
+
*
|
|
192
|
+
* @defaultValue "c15tStore"
|
|
193
|
+
*/
|
|
194
|
+
namespace?: string;
|
|
195
|
+
};
|
|
196
|
+
//# sourceMappingURL=compliance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compliance.d.ts","sourceRoot":"","sources":["../../src/types/compliance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9C;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,gBAAgB,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAChC,iDAAiD;IACjD,OAAO,EAAE,OAAO,CAAC;IAEjB,iDAAiD;IACjD,eAAe,EAAE,OAAO,CAAC;IAEzB,wDAAwD;IACxD,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,4DAA4D;IAC5D,eAAe,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC/B,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IAEb,8BAA8B;IAC9B,IAAI,EAAE,KAAK,GAAG,QAAQ,GAAG,WAAW,CAAC;CACrC,GAAG,IAAI,CAAC;AAET;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
|
File without changes
|
|
@@ -0,0 +1,86 @@
|
|
|
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
|
+
consentTypes: () => consentTypes,
|
|
36
|
+
});
|
|
37
|
+
const consentTypes = [
|
|
38
|
+
{
|
|
39
|
+
defaultValue: true,
|
|
40
|
+
description:
|
|
41
|
+
'These trackers are used for activities that are strictly necessary to operate or deliver the service you requested from us and, therefore, do not require you to consent.',
|
|
42
|
+
disabled: true,
|
|
43
|
+
display: true,
|
|
44
|
+
gdprType: 1,
|
|
45
|
+
name: 'necessary',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
defaultValue: false,
|
|
49
|
+
description:
|
|
50
|
+
'These trackers enable basic interactions and functionalities that allow you to access selected features of our service and facilitate your communication with us.',
|
|
51
|
+
display: false,
|
|
52
|
+
gdprType: 2,
|
|
53
|
+
name: 'functionality',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
defaultValue: false,
|
|
57
|
+
description:
|
|
58
|
+
'These trackers help us to measure traffic and analyze your behavior to improve our service.',
|
|
59
|
+
display: false,
|
|
60
|
+
gdprType: 4,
|
|
61
|
+
name: 'measurement',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
defaultValue: false,
|
|
65
|
+
description:
|
|
66
|
+
'These trackers help us to improve the quality of your user experience and enable interactions with external content, networks, and platforms.',
|
|
67
|
+
display: false,
|
|
68
|
+
gdprType: 3,
|
|
69
|
+
name: 'experience',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
defaultValue: false,
|
|
73
|
+
description:
|
|
74
|
+
'These trackers help us to deliver personalized ads or marketing content to you, and to measure their performance.',
|
|
75
|
+
display: false,
|
|
76
|
+
gdprType: 5,
|
|
77
|
+
name: 'marketing',
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
var __webpack_export_target__ = exports;
|
|
81
|
+
for (var __webpack_i__ in __webpack_exports__)
|
|
82
|
+
__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
83
|
+
if (__webpack_exports__.__esModule)
|
|
84
|
+
Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
85
|
+
value: true,
|
|
86
|
+
});
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Provides types and constants for managing GDPR-compliant consent categories and their configurations.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Defines all possible consent categories that can be managed within the application.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Each consent type represents a specific category of data processing:
|
|
10
|
+
*
|
|
11
|
+
* - `necessary`: Essential cookies required for basic site functionality
|
|
12
|
+
* - `functionality`: Cookies that enable enhanced features and personalization
|
|
13
|
+
* - `marketing`: Cookies used for advertising and marketing purposes
|
|
14
|
+
* - `measurement`: Analytics and performance measurement cookies
|
|
15
|
+
* - `experience`: Cookies that improve user experience and interactions
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* function isConsentRequired(type: AllConsentNames): boolean {
|
|
20
|
+
* return type !== 'necessary';
|
|
21
|
+
* }
|
|
22
|
+
*
|
|
23
|
+
* function enableFeature(type: AllConsentNames, hasConsent: boolean) {
|
|
24
|
+
* switch (type) {
|
|
25
|
+
* case 'marketing':
|
|
26
|
+
* hasConsent ? enableAds() : disableAds();
|
|
27
|
+
* break;
|
|
28
|
+
* case 'measurement':
|
|
29
|
+
* hasConsent ? enableAnalytics() : disableAnalytics();
|
|
30
|
+
* break;
|
|
31
|
+
* // ... handle other types
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
export type AllConsentNames =
|
|
39
|
+
| 'experience'
|
|
40
|
+
| 'functionality'
|
|
41
|
+
| 'marketing'
|
|
42
|
+
| 'measurement'
|
|
43
|
+
| 'necessary';
|
|
44
|
+
/**
|
|
45
|
+
* Defines the configuration structure for each consent type.
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* Each consent type has specific properties that determine its behavior:
|
|
49
|
+
*
|
|
50
|
+
* - `defaultValue`: Initial consent state
|
|
51
|
+
* - `true`: Consent is granted by default (typically only for 'necessary' cookies)
|
|
52
|
+
* - `false`: User must explicitly grant consent
|
|
53
|
+
*
|
|
54
|
+
* - `description`: User-friendly explanation of the consent category
|
|
55
|
+
* - Should be clear and concise
|
|
56
|
+
* - Must accurately describe data usage
|
|
57
|
+
* - Should help users make informed decisions
|
|
58
|
+
*
|
|
59
|
+
* - `disabled`: Whether users can modify this consent
|
|
60
|
+
* - `true`: Users cannot change the consent state (e.g., necessary cookies)
|
|
61
|
+
* - `false` or `undefined`: Users can toggle consent
|
|
62
|
+
*
|
|
63
|
+
* - `display`: Visibility in consent UI
|
|
64
|
+
* - `true`: Show this option to users
|
|
65
|
+
* - `false`: Hide from consent interface
|
|
66
|
+
*
|
|
67
|
+
* - `gdprType`: Numeric identifier for GDPR categorization
|
|
68
|
+
* - 1: Essential/Necessary
|
|
69
|
+
* - 2: Functional
|
|
70
|
+
* - 3: Experience/Preferences
|
|
71
|
+
* - 4: Analytics/Measurement
|
|
72
|
+
* - 5: Marketing/Advertising
|
|
73
|
+
*
|
|
74
|
+
* - `name`: Reference to the consent type
|
|
75
|
+
* - Must match one of {@link AllConsentNames}
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* const analyticsConsent: ConsentType = {
|
|
80
|
+
* name: 'measurement',
|
|
81
|
+
* gdprType: 4,
|
|
82
|
+
* defaultValue: false,
|
|
83
|
+
* description: 'Helps us understand how users interact with our site',
|
|
84
|
+
* display: true,
|
|
85
|
+
* disabled: false
|
|
86
|
+
* };
|
|
87
|
+
*
|
|
88
|
+
* const necessaryConsent: ConsentType = {
|
|
89
|
+
* name: 'necessary',
|
|
90
|
+
* gdprType: 1,
|
|
91
|
+
* defaultValue: true,
|
|
92
|
+
* description: 'Required for basic site functionality',
|
|
93
|
+
* display: true,
|
|
94
|
+
* disabled: true // Users cannot disable necessary cookies
|
|
95
|
+
* };
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @see {@link consentTypes} for the predefined consent configurations
|
|
99
|
+
* @public
|
|
100
|
+
*/
|
|
101
|
+
export type ConsentType = {
|
|
102
|
+
/** Whether consent is granted by default */
|
|
103
|
+
defaultValue: boolean;
|
|
104
|
+
/** User-friendly description of what this consent enables */
|
|
105
|
+
description: string;
|
|
106
|
+
/** Whether users can modify this consent setting */
|
|
107
|
+
disabled?: boolean;
|
|
108
|
+
/** Whether to show this consent option in the UI */
|
|
109
|
+
display: boolean;
|
|
110
|
+
/** GDPR category identifier (1-5) */
|
|
111
|
+
gdprType: number;
|
|
112
|
+
/** The consent category name */
|
|
113
|
+
name: AllConsentNames;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Predefined consent type configurations that comply with GDPR requirements.
|
|
117
|
+
*
|
|
118
|
+
* @remarks
|
|
119
|
+
* This array defines the standard consent categories and their default configurations.
|
|
120
|
+
* Each entry represents a specific type of cookie or tracking technology:
|
|
121
|
+
*
|
|
122
|
+
* 1. Necessary (Type 1):
|
|
123
|
+
* - Required for basic site functionality
|
|
124
|
+
* - Cannot be disabled by users
|
|
125
|
+
* - Enabled by default
|
|
126
|
+
*
|
|
127
|
+
* 2. Functionality (Type 2):
|
|
128
|
+
* - Enables enhanced features
|
|
129
|
+
* - Optional for users
|
|
130
|
+
* - Disabled by default
|
|
131
|
+
*
|
|
132
|
+
* 3. Measurement (Type 4):
|
|
133
|
+
* - Analytics and performance tracking
|
|
134
|
+
* - Optional for users
|
|
135
|
+
* - Disabled by default
|
|
136
|
+
*
|
|
137
|
+
* 4. Experience (Type 3):
|
|
138
|
+
* - User experience improvements
|
|
139
|
+
* - Optional for users
|
|
140
|
+
* - Disabled by default
|
|
141
|
+
*
|
|
142
|
+
* 5. Marketing (Type 5):
|
|
143
|
+
* - Advertising and marketing
|
|
144
|
+
* - Optional for users
|
|
145
|
+
* - Disabled by default
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* function getConsentConfig(type: AllConsentNames): ConsentType {
|
|
150
|
+
* return consentTypes.find(consent => consent.name === type)!;
|
|
151
|
+
* }
|
|
152
|
+
*
|
|
153
|
+
* function isConsentRequired(type: AllConsentNames): boolean {
|
|
154
|
+
* const config = getConsentConfig(type);
|
|
155
|
+
* return !config.defaultValue && !config.disabled;
|
|
156
|
+
* }
|
|
157
|
+
*
|
|
158
|
+
* function getDisplayedConsents(): ConsentType[] {
|
|
159
|
+
* return consentTypes.filter(consent => consent.display);
|
|
160
|
+
* }
|
|
161
|
+
* ```
|
|
162
|
+
*
|
|
163
|
+
* @see {@link ConsentType} for the structure of each consent configuration
|
|
164
|
+
* @see {@link AllConsentNames} for available consent categories
|
|
165
|
+
* @public
|
|
166
|
+
*/
|
|
167
|
+
export declare const consentTypes: ConsentType[];
|
|
168
|
+
//# sourceMappingURL=gdpr.d.ts.map
|
|
@@ -0,0 +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,6DAA6D;IAC7D,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"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const consentTypes = [
|
|
2
|
+
{
|
|
3
|
+
defaultValue: true,
|
|
4
|
+
description:
|
|
5
|
+
'These trackers are used for activities that are strictly necessary to operate or deliver the service you requested from us and, therefore, do not require you to consent.',
|
|
6
|
+
disabled: true,
|
|
7
|
+
display: true,
|
|
8
|
+
gdprType: 1,
|
|
9
|
+
name: 'necessary',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
defaultValue: false,
|
|
13
|
+
description:
|
|
14
|
+
'These trackers enable basic interactions and functionalities that allow you to access selected features of our service and facilitate your communication with us.',
|
|
15
|
+
display: false,
|
|
16
|
+
gdprType: 2,
|
|
17
|
+
name: 'functionality',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
defaultValue: false,
|
|
21
|
+
description:
|
|
22
|
+
'These trackers help us to measure traffic and analyze your behavior to improve our service.',
|
|
23
|
+
display: false,
|
|
24
|
+
gdprType: 4,
|
|
25
|
+
name: 'measurement',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
defaultValue: false,
|
|
29
|
+
description:
|
|
30
|
+
'These trackers help us to improve the quality of your user experience and enable interactions with external content, networks, and platforms.',
|
|
31
|
+
display: false,
|
|
32
|
+
gdprType: 3,
|
|
33
|
+
name: 'experience',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
defaultValue: false,
|
|
37
|
+
description:
|
|
38
|
+
'These trackers help us to deliver personalized ads or marketing content to you, and to measure their performance.',
|
|
39
|
+
display: false,
|
|
40
|
+
gdprType: 5,
|
|
41
|
+
name: 'marketing',
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
export { consentTypes };
|