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.
Files changed (86) hide show
  1. package/.turbo/turbo-build.log +54 -0
  2. package/.turbo/turbo-fmt.log +6 -0
  3. package/.turbo/turbo-lint.log +288 -0
  4. package/.turbo/turbo-test.log +33 -0
  5. package/CHANGELOG.md +20 -0
  6. package/LICENSE.md +595 -0
  7. package/README.md +28 -0
  8. package/dist/index.cjs +118 -0
  9. package/dist/index.d.ts +27 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +19 -0
  12. package/dist/libs/__tests__/tracking-blocker.test.cjs +269 -0
  13. package/dist/libs/__tests__/tracking-blocker.test.d.ts +2 -0
  14. package/dist/libs/__tests__/tracking-blocker.test.d.ts.map +1 -0
  15. package/dist/libs/__tests__/tracking-blocker.test.js +267 -0
  16. package/dist/libs/consent-utils.cjs +68 -0
  17. package/dist/libs/consent-utils.d.ts +49 -0
  18. package/dist/libs/consent-utils.d.ts.map +1 -0
  19. package/dist/libs/consent-utils.js +23 -0
  20. package/dist/libs/tracking-blocker.cjs +167 -0
  21. package/dist/libs/tracking-blocker.d.ts +33 -0
  22. package/dist/libs/tracking-blocker.d.ts.map +1 -0
  23. package/dist/libs/tracking-blocker.js +108 -0
  24. package/dist/libs/tracking-domains.cjs +188 -0
  25. package/dist/libs/tracking-domains.d.ts +7 -0
  26. package/dist/libs/tracking-domains.d.ts.map +1 -0
  27. package/dist/libs/tracking-domains.js +146 -0
  28. package/dist/store.cjs +248 -0
  29. package/dist/store.d.ts +58 -0
  30. package/dist/store.d.ts.map +1 -0
  31. package/dist/store.initial-state.cjs +105 -0
  32. package/dist/store.initial-state.d.ts +43 -0
  33. package/dist/store.initial-state.d.ts.map +1 -0
  34. package/dist/store.initial-state.js +66 -0
  35. package/dist/store.js +219 -0
  36. package/dist/store.type.cjs +22 -0
  37. package/dist/store.type.d.ts +159 -0
  38. package/dist/store.type.d.ts.map +1 -0
  39. package/dist/store.type.js +0 -0
  40. package/dist/translations/en.cjs +96 -0
  41. package/dist/translations/en.d.ts +3 -0
  42. package/dist/translations/en.d.ts.map +1 -0
  43. package/dist/translations/en.js +54 -0
  44. package/dist/translations/index.cjs +51 -0
  45. package/dist/translations/index.d.ts +3 -0
  46. package/dist/translations/index.d.ts.map +1 -0
  47. package/dist/translations/index.js +9 -0
  48. package/dist/types/callbacks.cjs +22 -0
  49. package/dist/types/callbacks.d.ts +146 -0
  50. package/dist/types/callbacks.d.ts.map +1 -0
  51. package/dist/types/callbacks.js +0 -0
  52. package/dist/types/compliance.cjs +22 -0
  53. package/dist/types/compliance.d.ts +196 -0
  54. package/dist/types/compliance.d.ts.map +1 -0
  55. package/dist/types/compliance.js +0 -0
  56. package/dist/types/gdpr.cjs +86 -0
  57. package/dist/types/gdpr.d.ts +168 -0
  58. package/dist/types/gdpr.d.ts.map +1 -0
  59. package/dist/types/gdpr.js +44 -0
  60. package/dist/types/index.cjs +44 -0
  61. package/dist/types/index.d.ts +141 -0
  62. package/dist/types/index.d.ts.map +1 -0
  63. package/dist/types/index.js +4 -0
  64. package/dist/types/translations.cjs +22 -0
  65. package/dist/types/translations.d.ts +52 -0
  66. package/dist/types/translations.d.ts.map +1 -0
  67. package/dist/types/translations.js +0 -0
  68. package/package.json +33 -0
  69. package/rslib.config.ts +28 -0
  70. package/src/index.ts +31 -0
  71. package/src/libs/__tests__/tracking-blocker.test.ts +271 -0
  72. package/src/libs/consent-utils.ts +70 -0
  73. package/src/libs/tracking-blocker.ts +202 -0
  74. package/src/libs/tracking-domains.ts +158 -0
  75. package/src/store.initial-state.ts +123 -0
  76. package/src/store.ts +450 -0
  77. package/src/store.type.ts +187 -0
  78. package/src/translations/en.ts +55 -0
  79. package/src/translations/index.ts +10 -0
  80. package/src/types/callbacks.ts +152 -0
  81. package/src/types/compliance.ts +205 -0
  82. package/src/types/gdpr.ts +217 -0
  83. package/src/types/index.ts +148 -0
  84. package/src/types/translations.ts +60 -0
  85. package/tsconfig.json +12 -0
  86. package/vitest.config.ts +15 -0
@@ -0,0 +1,152 @@
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
+ /**
28
+ * Defines the structure for callback functions that respond to consent-related events.
29
+ * These callbacks enable custom actions at different stages of the consent management process.
30
+ *
31
+ * @remarks
32
+ * All callbacks are optional and will be called at specific points in the consent management lifecycle:
33
+ *
34
+ * Initialization callbacks:
35
+ * - `onReady`: System initialization complete, ready to handle consent
36
+ * - `onError`: Error occurred during operation
37
+ *
38
+ * Banner interaction callbacks:
39
+ * - `onBannerShown`: Consent banner has been displayed
40
+ * - `onBannerClosed`: User has closed the consent banner
41
+ *
42
+ * Consent decision callbacks:
43
+ * - `onConsentGiven`: User has granted consent
44
+ * - `onConsentRejected`: User has rejected consent
45
+ * - `onPreferenceExpressed`: User has made their preferences known
46
+ *
47
+ * @example
48
+ * Basic usage with TypeScript:
49
+ * ```typescript
50
+ * const callbacks: Callbacks = {
51
+ * onReady: () => {
52
+ * console.log('Consent manager ready');
53
+ * },
54
+ * onError: (error) => {
55
+ * console.error('Consent manager error:', error);
56
+ * },
57
+ * onConsentGiven: () => {
58
+ * initializeAnalytics();
59
+ * }
60
+ * };
61
+ * ```
62
+ *
63
+ * @example
64
+ * Full implementation with all callbacks:
65
+ * ```typescript
66
+ * const consentCallbacks: Callbacks = {
67
+ * onReady: () => {
68
+ * console.log('Consent manager initialized');
69
+ * checkInitialConsent();
70
+ * },
71
+ *
72
+ * onBannerShown: () => {
73
+ * logBannerImpression();
74
+ * pauseBackgroundVideos();
75
+ * },
76
+ *
77
+ * onBannerClosed: () => {
78
+ * resumeBackgroundVideos();
79
+ * updateUIState('banner-closed');
80
+ * },
81
+ *
82
+ * onConsentGiven: () => {
83
+ * enableTracking();
84
+ * initializeServices();
85
+ * },
86
+ *
87
+ * onConsentRejected: () => {
88
+ * disableTracking();
89
+ * updatePrivacyMode('strict');
90
+ * },
91
+ *
92
+ * onPreferenceExpressed: () => {
93
+ * saveUserPreferences();
94
+ * updateUI();
95
+ * },
96
+ *
97
+ * onError: (errorMessage) => {
98
+ * console.error('Consent Error:', errorMessage);
99
+ * notifyAdministrator(errorMessage);
100
+ * }
101
+ * };
102
+ * ```
103
+ *
104
+ * @example
105
+ * Usage with React:
106
+ * ```tsx
107
+ * function ConsentManager() {
108
+ * const callbacks: Callbacks = useMemo(() => ({
109
+ * onReady: () => setIsReady(true),
110
+ * onBannerShown: () => trackEvent('banner-shown'),
111
+ * onConsentGiven: () => {
112
+ * initializeAnalytics();
113
+ * refreshAds();
114
+ * }
115
+ * }), []);
116
+ *
117
+ * return (
118
+ * <ConsentProvider callbacks={callbacks}>
119
+ * {children}
120
+ * </ConsentProvider>
121
+ * );
122
+ * }
123
+ * ```
124
+ *
125
+ * @see {@link CallbackFunction} For the type definition of individual callbacks
126
+ * @public
127
+ */
128
+ export interface Callbacks {
129
+ /** Called when the consent management system is fully initialized and ready */
130
+ onReady?: CallbackFunction;
131
+
132
+ /** Called when the consent banner becomes visible to the user */
133
+ onBannerShown?: CallbackFunction;
134
+
135
+ /** Called when the consent banner is dismissed or hidden */
136
+ onBannerClosed?: CallbackFunction;
137
+
138
+ /** Called when the user grants consent for one or more purposes */
139
+ onConsentGiven?: CallbackFunction;
140
+
141
+ /** Called when the user denies consent for one or more purposes */
142
+ onConsentRejected?: CallbackFunction;
143
+
144
+ /** Called when the user makes any change to their consent preferences */
145
+ onPreferenceExpressed?: CallbackFunction;
146
+
147
+ /**
148
+ * Called when an error occurs in the consent management system
149
+ * @param errorMessage - A description of the error that occurred
150
+ */
151
+ onError?: CallbackFunction<string>;
152
+ }
@@ -0,0 +1,205 @@
1
+ import type { AllConsentNames } from './gdpr';
2
+
3
+ /**
4
+ * @packageDocumentation
5
+ * Provides types and interfaces for managing privacy compliance and consent across different regulatory frameworks.
6
+ */
7
+
8
+ /**
9
+ * Represents the state of consents for different types of data processing.
10
+ *
11
+ * @remarks
12
+ * Maps each consent type to a boolean indicating whether consent has been granted.
13
+ * The consent types are defined by {@link AllConsentNames} and typically include
14
+ * categories like 'necessary', 'functional', 'analytics', etc.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const consentState: ConsentState = {
19
+ * necessary: true, // Required functionality
20
+ * functional: true, // Enhanced features
21
+ * analytics: false, // Usage tracking
22
+ * marketing: false // Marketing cookies
23
+ * };
24
+ * ```
25
+ *
26
+ * @public
27
+ */
28
+ export type ConsentState = Record<AllConsentNames, boolean>;
29
+
30
+ /**
31
+ * Defines supported privacy regulation frameworks and regions.
32
+ *
33
+ * @remarks
34
+ * Each region represents a different privacy regulation framework:
35
+ * - `gdpr`: European Union's General Data Protection Regulation
36
+ * - `ccpa`: California Consumer Privacy Act
37
+ * - `lgpd`: Brazil's Lei Geral de Proteção de Dados
38
+ * - `usStatePrivacy`: Other U.S. state privacy laws (e.g., VCDPA, CPA)
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * function isRegionCompliant(region: ComplianceRegion): boolean {
43
+ * switch (region) {
44
+ * case 'gdpr':
45
+ * return checkGDPRCompliance();
46
+ * case 'ccpa':
47
+ * return checkCCPACompliance();
48
+ * // ... handle other regions
49
+ * }
50
+ * }
51
+ * ```
52
+ *
53
+ * @public
54
+ */
55
+ export type ComplianceRegion = 'gdpr' | 'ccpa' | 'lgpd' | 'usStatePrivacy';
56
+
57
+ /**
58
+ * Configuration settings for privacy regulation compliance.
59
+ *
60
+ * @remarks
61
+ * These settings determine how privacy regulations are enforced:
62
+ * - `enabled`: Activates or deactivates the compliance framework
63
+ * - `appliesGlobally`: Whether to apply these rules worldwide
64
+ * - `applies`: Whether the regulation applies in the current context
65
+ *
66
+ * @example
67
+ * ```typescript
68
+ * const gdprSettings: ComplianceSettings = {
69
+ * enabled: true, // GDPR compliance is active
70
+ * appliesGlobally: false, // Only applies to EU users
71
+ * applies: isEUUser() // Dynamically check if user is in EU
72
+ * };
73
+ *
74
+ * const ccpaSettings: ComplianceSettings = {
75
+ * enabled: true,
76
+ * appliesGlobally: false,
77
+ * applies: isCaliforniaUser() // Check if user is in California
78
+ * };
79
+ * ```
80
+ *
81
+ * @see {@link ComplianceRegion} for available regions
82
+ * @public
83
+ */
84
+ export type ComplianceSettings = {
85
+ /** Whether the compliance framework is active */
86
+ enabled: boolean;
87
+
88
+ /** Whether to apply compliance rules globally */
89
+ appliesGlobally: boolean;
90
+
91
+ /** Whether the regulation applies in current context */
92
+ applies: boolean | undefined;
93
+ };
94
+
95
+ /**
96
+ * User privacy preference configuration.
97
+ *
98
+ * @remarks
99
+ * Contains settings that affect how user privacy preferences are handled:
100
+ * - `honorDoNotTrack`: Respects the browser's DNT (Do Not Track) setting
101
+ *
102
+ * When `honorDoNotTrack` is true and the user has enabled DNT in their browser:
103
+ * - All non-essential tracking will be disabled
104
+ * - Only necessary cookies will be allowed
105
+ * - Analytics and marketing features will be disabled
106
+ *
107
+ * @example
108
+ * ```typescript
109
+ * const privacySettings: PrivacySettings = {
110
+ * honorDoNotTrack: true // Respect browser's DNT setting
111
+ * };
112
+ *
113
+ * function shouldTrack(): boolean {
114
+ * return !(
115
+ * privacySettings.honorDoNotTrack &&
116
+ * navigator.doNotTrack === "1"
117
+ * );
118
+ * }
119
+ * ```
120
+ *
121
+ * @public
122
+ */
123
+ export type PrivacySettings = {
124
+ /** Whether to respect the browser's Do Not Track setting */
125
+ honorDoNotTrack: boolean;
126
+ };
127
+
128
+ /**
129
+ * Records information about a user's consent decision.
130
+ *
131
+ * @remarks
132
+ * This type tracks when and how consent was given:
133
+ * - `time`: Unix timestamp of when consent was given
134
+ * - `type`: The scope of consent granted
135
+ * - `'all'`: Accepted all consent types
136
+ * - `'custom'`: Selected specific consent types
137
+ * - `'necessary'`: Only accepted necessary cookies
138
+ *
139
+ * Can be `null` if no consent has been recorded yet.
140
+ *
141
+ * @example
142
+ * ```typescript
143
+ * // User accepted all cookies
144
+ * const fullConsent: HasConsentedProps = {
145
+ * time: Date.now(),
146
+ * type: 'all'
147
+ * };
148
+ *
149
+ * // User customized their consent
150
+ * const customConsent: HasConsentedProps = {
151
+ * time: Date.now(),
152
+ * type: 'custom'
153
+ * };
154
+ *
155
+ * // No consent recorded yet
156
+ * const noConsent: HasConsentedProps = null;
157
+ * ```
158
+ *
159
+ * @public
160
+ */
161
+ export type HasConsentedProps = {
162
+ /** Timestamp when consent was given */
163
+ time: number;
164
+
165
+ /** Type of consent granted */
166
+ type: 'all' | 'custom' | 'necessary';
167
+ } | null;
168
+
169
+ /**
170
+ * Configuration for the consent manager's namespace.
171
+ *
172
+ * @remarks
173
+ * The namespace is used to:
174
+ * - Isolate consent manager instances
175
+ * - Prevent conflicts with other global variables
176
+ * - Support multiple consent managers on the same page
177
+ * - Maintain state persistence across page loads
178
+ *
179
+ * @example
180
+ * ```typescript
181
+ * // Basic usage with default namespace
182
+ * const defaultConfig: NamespaceProps = {};
183
+ *
184
+ * // Custom namespace for multiple instances
185
+ * const customConfig: NamespaceProps = {
186
+ * namespace: 'MyAppConsent'
187
+ * };
188
+ *
189
+ * // Multiple consent managers
190
+ * const configs = {
191
+ * main: { namespace: 'MainAppConsent' },
192
+ * subsite: { namespace: 'SubsiteConsent' }
193
+ * };
194
+ * ```
195
+ *
196
+ * @public
197
+ */
198
+ export type NamespaceProps = {
199
+ /**
200
+ * Global namespace for the consent manager store.
201
+ *
202
+ * @defaultValue "c15tStore"
203
+ */
204
+ namespace?: string;
205
+ };
@@ -0,0 +1,217 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * Provides types and constants for managing GDPR-compliant consent categories and their configurations.
4
+ */
5
+
6
+ /**
7
+ * Defines all possible consent categories that can be managed within the application.
8
+ *
9
+ * @remarks
10
+ * Each consent type represents a specific category of data processing:
11
+ *
12
+ * - `necessary`: Essential cookies required for basic site functionality
13
+ * - `functionality`: Cookies that enable enhanced features and personalization
14
+ * - `marketing`: Cookies used for advertising and marketing purposes
15
+ * - `measurement`: Analytics and performance measurement cookies
16
+ * - `experience`: Cookies that improve user experience and interactions
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * function isConsentRequired(type: AllConsentNames): boolean {
21
+ * return type !== 'necessary';
22
+ * }
23
+ *
24
+ * function enableFeature(type: AllConsentNames, hasConsent: boolean) {
25
+ * switch (type) {
26
+ * case 'marketing':
27
+ * hasConsent ? enableAds() : disableAds();
28
+ * break;
29
+ * case 'measurement':
30
+ * hasConsent ? enableAnalytics() : disableAnalytics();
31
+ * break;
32
+ * // ... handle other types
33
+ * }
34
+ * }
35
+ * ```
36
+ *
37
+ * @public
38
+ */
39
+ export type AllConsentNames =
40
+ | 'experience'
41
+ | 'functionality'
42
+ | 'marketing'
43
+ | 'measurement'
44
+ | 'necessary';
45
+
46
+ /**
47
+ * Defines the configuration structure for each consent type.
48
+ *
49
+ * @remarks
50
+ * Each consent type has specific properties that determine its behavior:
51
+ *
52
+ * - `defaultValue`: Initial consent state
53
+ * - `true`: Consent is granted by default (typically only for 'necessary' cookies)
54
+ * - `false`: User must explicitly grant consent
55
+ *
56
+ * - `description`: User-friendly explanation of the consent category
57
+ * - Should be clear and concise
58
+ * - Must accurately describe data usage
59
+ * - Should help users make informed decisions
60
+ *
61
+ * - `disabled`: Whether users can modify this consent
62
+ * - `true`: Users cannot change the consent state (e.g., necessary cookies)
63
+ * - `false` or `undefined`: Users can toggle consent
64
+ *
65
+ * - `display`: Visibility in consent UI
66
+ * - `true`: Show this option to users
67
+ * - `false`: Hide from consent interface
68
+ *
69
+ * - `gdprType`: Numeric identifier for GDPR categorization
70
+ * - 1: Essential/Necessary
71
+ * - 2: Functional
72
+ * - 3: Experience/Preferences
73
+ * - 4: Analytics/Measurement
74
+ * - 5: Marketing/Advertising
75
+ *
76
+ * - `name`: Reference to the consent type
77
+ * - Must match one of {@link AllConsentNames}
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * const analyticsConsent: ConsentType = {
82
+ * name: 'measurement',
83
+ * gdprType: 4,
84
+ * defaultValue: false,
85
+ * description: 'Helps us understand how users interact with our site',
86
+ * display: true,
87
+ * disabled: false
88
+ * };
89
+ *
90
+ * const necessaryConsent: ConsentType = {
91
+ * name: 'necessary',
92
+ * gdprType: 1,
93
+ * defaultValue: true,
94
+ * description: 'Required for basic site functionality',
95
+ * display: true,
96
+ * disabled: true // Users cannot disable necessary cookies
97
+ * };
98
+ * ```
99
+ *
100
+ * @see {@link consentTypes} for the predefined consent configurations
101
+ * @public
102
+ */
103
+ export type ConsentType = {
104
+ /** Whether consent is granted by default */
105
+ defaultValue: boolean;
106
+
107
+ /** User-friendly description of what this consent enables */
108
+ description: string;
109
+
110
+ /** Whether users can modify this consent setting */
111
+ disabled?: boolean;
112
+
113
+ /** Whether to show this consent option in the UI */
114
+ display: boolean;
115
+
116
+ /** GDPR category identifier (1-5) */
117
+ gdprType: number;
118
+
119
+ /** The consent category name */
120
+ name: AllConsentNames;
121
+ };
122
+
123
+ /**
124
+ * Predefined consent type configurations that comply with GDPR requirements.
125
+ *
126
+ * @remarks
127
+ * This array defines the standard consent categories and their default configurations.
128
+ * Each entry represents a specific type of cookie or tracking technology:
129
+ *
130
+ * 1. Necessary (Type 1):
131
+ * - Required for basic site functionality
132
+ * - Cannot be disabled by users
133
+ * - Enabled by default
134
+ *
135
+ * 2. Functionality (Type 2):
136
+ * - Enables enhanced features
137
+ * - Optional for users
138
+ * - Disabled by default
139
+ *
140
+ * 3. Measurement (Type 4):
141
+ * - Analytics and performance tracking
142
+ * - Optional for users
143
+ * - Disabled by default
144
+ *
145
+ * 4. Experience (Type 3):
146
+ * - User experience improvements
147
+ * - Optional for users
148
+ * - Disabled by default
149
+ *
150
+ * 5. Marketing (Type 5):
151
+ * - Advertising and marketing
152
+ * - Optional for users
153
+ * - Disabled by default
154
+ *
155
+ * @example
156
+ * ```typescript
157
+ * function getConsentConfig(type: AllConsentNames): ConsentType {
158
+ * return consentTypes.find(consent => consent.name === type)!;
159
+ * }
160
+ *
161
+ * function isConsentRequired(type: AllConsentNames): boolean {
162
+ * const config = getConsentConfig(type);
163
+ * return !config.defaultValue && !config.disabled;
164
+ * }
165
+ *
166
+ * function getDisplayedConsents(): ConsentType[] {
167
+ * return consentTypes.filter(consent => consent.display);
168
+ * }
169
+ * ```
170
+ *
171
+ * @see {@link ConsentType} for the structure of each consent configuration
172
+ * @see {@link AllConsentNames} for available consent categories
173
+ * @public
174
+ */
175
+ export const consentTypes: ConsentType[] = [
176
+ {
177
+ defaultValue: true,
178
+ description:
179
+ '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.',
180
+ disabled: true,
181
+ display: true,
182
+ gdprType: 1,
183
+ name: 'necessary',
184
+ },
185
+ {
186
+ defaultValue: false,
187
+ description:
188
+ 'These trackers enable basic interactions and functionalities that allow you to access selected features of our service and facilitate your communication with us.',
189
+ display: false,
190
+ gdprType: 2,
191
+ name: 'functionality',
192
+ },
193
+ {
194
+ defaultValue: false,
195
+ description:
196
+ 'These trackers help us to measure traffic and analyze your behavior to improve our service.',
197
+ display: false,
198
+ gdprType: 4,
199
+ name: 'measurement',
200
+ },
201
+ {
202
+ defaultValue: false,
203
+ description:
204
+ 'These trackers help us to improve the quality of your user experience and enable interactions with external content, networks, and platforms.',
205
+ display: false,
206
+ gdprType: 3,
207
+ name: 'experience',
208
+ },
209
+ {
210
+ defaultValue: false,
211
+ description:
212
+ 'These trackers help us to deliver personalized ads or marketing content to you, and to measure their performance.',
213
+ display: false,
214
+ gdprType: 5,
215
+ name: 'marketing',
216
+ },
217
+ ];
@@ -0,0 +1,148 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * Central export point for all consent management types and interfaces.
4
+ * This module aggregates and re-exports all type definitions needed for implementing
5
+ * GDPR-compliant consent management.
6
+ */
7
+
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
+ * PrivacySettings
26
+ * } from 'c15t/types';
27
+ *
28
+ * const euSettings: ComplianceSettings = {
29
+ * enabled: true,
30
+ * appliesGlobally: false,
31
+ * applies: true
32
+ * };
33
+ *
34
+ * const region: ComplianceRegion = 'gdpr';
35
+ * ```
36
+ */
37
+ import type {
38
+ ComplianceRegion,
39
+ ComplianceSettings,
40
+ ConsentState,
41
+ HasConsentedProps,
42
+ NamespaceProps,
43
+ PrivacySettings,
44
+ } from './compliance';
45
+
46
+ export type {
47
+ ConsentState,
48
+ ComplianceRegion,
49
+ ComplianceSettings,
50
+ PrivacySettings,
51
+ HasConsentedProps,
52
+ NamespaceProps,
53
+ };
54
+
55
+ /**
56
+ * @module
57
+ * GDPR Consent Types
58
+ *
59
+ * @remarks
60
+ * Exports types and constants for GDPR-specific consent management:
61
+ * - Consent category definitions
62
+ * - Consent type configurations
63
+ * - Predefined consent settings
64
+ *
65
+ * @example
66
+ * Import and use GDPR-related types:
67
+ * ```typescript
68
+ * import {
69
+ * type AllConsentNames,
70
+ * type ConsentType,
71
+ * consentTypes
72
+ * } from 'c15t/types';
73
+ *
74
+ * function isOptionalConsent(type: AllConsentNames): boolean {
75
+ * const config = consentTypes.find(c => c.name === type);
76
+ * return config ? !config.disabled && !config.defaultValue : false;
77
+ * }
78
+ * ```
79
+ */
80
+ import { type AllConsentNames, type ConsentType, consentTypes } from './gdpr';
81
+
82
+ export { consentTypes };
83
+ export type { AllConsentNames, ConsentType };
84
+
85
+ /**
86
+ * @module
87
+ * Callback Types
88
+ *
89
+ * @remarks
90
+ * Exports types for consent management callbacks and event handlers:
91
+ * - Generic callback function type
92
+ * - Consent-specific callback configurations
93
+ *
94
+ * @example
95
+ * Import and use callback types:
96
+ * ```typescript
97
+ * import type {
98
+ * CallbackFunction,
99
+ * Callbacks
100
+ * } from 'c15t/types';
101
+ *
102
+ * const callbacks: Callbacks = {
103
+ * onConsentGiven: () => {
104
+ * console.log('Consent granted');
105
+ * initializeAnalytics();
106
+ * },
107
+ * onError: (error) => {
108
+ * console.error('Consent error:', error);
109
+ * }
110
+ * };
111
+ * ```
112
+ *
113
+ * @example
114
+ * Create typed callback functions:
115
+ * ```typescript
116
+ * const errorHandler: CallbackFunction<string> =
117
+ * (message) => console.error(message);
118
+ *
119
+ * const readyHandler: CallbackFunction =
120
+ * () => console.log('System ready');
121
+ * ```
122
+ */
123
+ import type { CallbackFunction, Callbacks } from './callbacks';
124
+
125
+ export type { CallbackFunction, Callbacks };
126
+
127
+ /**
128
+ * @module
129
+ * Translation Types
130
+ *
131
+ * @remarks
132
+ * Exports types for translation configuration and translations:
133
+ * - Translation configuration
134
+ * - Translation types
135
+ * - Cookie banner translations
136
+ * - Consent manager dialog translations
137
+ * - Consent manager widget translations
138
+ */
139
+
140
+ export type {
141
+ ConsentManagerDialogTranslations,
142
+ ConsentManagerWidgetTranslations,
143
+ ConsentTypeTranslations,
144
+ ConsentTypesTranslations,
145
+ CookieBannerTranslations,
146
+ TranslationConfig,
147
+ Translations,
148
+ } from './translations';