@iqworksai/consentiq-react 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -10
- package/dist/index.d.mts +128 -18
- package/dist/index.d.ts +128 -18
- package/dist/index.js +557 -125
- package/dist/index.mjs +549 -121
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
# @consentiq
|
|
1
|
+
# @iqworksai/consentiq-react
|
|
2
2
|
|
|
3
3
|
React SDK for ConsentIQ consent management platform.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @consentiq
|
|
8
|
+
npm install @iqworksai/consentiq-react
|
|
9
9
|
# or
|
|
10
|
-
yarn add @consentiq
|
|
10
|
+
yarn add @iqworksai/consentiq-react
|
|
11
11
|
# or
|
|
12
|
-
pnpm add @consentiq
|
|
12
|
+
pnpm add @iqworksai/consentiq-react
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Quick Start
|
|
16
16
|
|
|
17
17
|
```tsx
|
|
18
|
-
import { ConsentIQProvider, CookieBanner, PreferenceCenter } from '@consentiq
|
|
18
|
+
import { ConsentIQProvider, CookieBanner, PreferenceCenter } from '@iqworksai/consentiq-react';
|
|
19
19
|
|
|
20
20
|
function App() {
|
|
21
21
|
return (
|
|
@@ -35,7 +35,7 @@ function App() {
|
|
|
35
35
|
```tsx
|
|
36
36
|
<ConsentIQProvider
|
|
37
37
|
propertyKey="YOUR_PROPERTY_KEY"
|
|
38
|
-
apiUrl="https://
|
|
38
|
+
apiUrl="https://consent.iqworks.ai" // Optional: custom API URL
|
|
39
39
|
autoShow={true} // Optional: show banner automatically
|
|
40
40
|
language="en" // Optional: override detected language
|
|
41
41
|
debug={false} // Optional: enable debug logging
|
|
@@ -50,7 +50,7 @@ function App() {
|
|
|
50
50
|
### Using the Consent Hook
|
|
51
51
|
|
|
52
52
|
```tsx
|
|
53
|
-
import { useConsentIQ } from '@consentiq
|
|
53
|
+
import { useConsentIQ } from '@iqworksai/consentiq-react';
|
|
54
54
|
|
|
55
55
|
function Analytics() {
|
|
56
56
|
const { hasConsent } = useConsentIQ();
|
|
@@ -66,7 +66,7 @@ function Analytics() {
|
|
|
66
66
|
### Simplified Consent Check
|
|
67
67
|
|
|
68
68
|
```tsx
|
|
69
|
-
import { useConsent } from '@consentiq
|
|
69
|
+
import { useConsent } from '@iqworksai/consentiq-react';
|
|
70
70
|
|
|
71
71
|
function MarketingScript() {
|
|
72
72
|
const hasMarketing = useConsent('marketing');
|
|
@@ -80,7 +80,7 @@ function MarketingScript() {
|
|
|
80
80
|
### Consent Gate Component
|
|
81
81
|
|
|
82
82
|
```tsx
|
|
83
|
-
import { ConsentGate } from '@consentiq
|
|
83
|
+
import { ConsentGate } from '@iqworksai/consentiq-react';
|
|
84
84
|
|
|
85
85
|
function App() {
|
|
86
86
|
return (
|
|
@@ -97,7 +97,7 @@ function App() {
|
|
|
97
97
|
### Manual Control
|
|
98
98
|
|
|
99
99
|
```tsx
|
|
100
|
-
import { useConsentIQ } from '@consentiq
|
|
100
|
+
import { useConsentIQ } from '@iqworksai/consentiq-react';
|
|
101
101
|
|
|
102
102
|
function SettingsPage() {
|
|
103
103
|
const { showPreferenceCenter, resetConsent } = useConsentIQ();
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import React$1 from 'react';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* ConsentIQ React SDK Types
|
|
6
5
|
*/
|
|
7
6
|
type ConsentCategory = 'necessary' | 'analytics' | 'marketing' | 'preferences' | 'social';
|
|
8
|
-
type ConsentMethod = 'banner' | 'preference_center' | 'api' | 'sdk';
|
|
7
|
+
type ConsentMethod = 'banner' | 'preference_center' | 'api' | 'sdk' | 'form' | 'import' | 'offline';
|
|
9
8
|
type BannerPosition = 'bottom' | 'bottom-left' | 'bottom-right' | 'top' | 'center';
|
|
10
9
|
type BannerLayout = 'banner' | 'floating' | 'modal';
|
|
11
10
|
type BannerTheme = 'light' | 'dark' | 'auto';
|
|
@@ -43,14 +42,26 @@ interface ConsentIQConfig {
|
|
|
43
42
|
autoShow?: boolean;
|
|
44
43
|
/** Custom language code (overrides auto-detection) */
|
|
45
44
|
language?: string;
|
|
45
|
+
/** Alias for `language` — locale/language code to use as the default (e.g. site locale) */
|
|
46
|
+
locale?: string;
|
|
46
47
|
/** Debug mode for development */
|
|
47
48
|
debug?: boolean;
|
|
48
49
|
}
|
|
50
|
+
interface FormConsentSource {
|
|
51
|
+
selector: string | null;
|
|
52
|
+
isAutoResolved: boolean;
|
|
53
|
+
privacyNotice: {
|
|
54
|
+
id: string;
|
|
55
|
+
name: string;
|
|
56
|
+
type: string;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
49
59
|
interface PropertyConfig {
|
|
50
60
|
property: {
|
|
51
61
|
id: string;
|
|
52
62
|
name: string;
|
|
53
|
-
|
|
63
|
+
identifier: string;
|
|
64
|
+
platform: 'web' | 'ios' | 'android';
|
|
54
65
|
defaultLanguage: string;
|
|
55
66
|
supportedLanguages: string[];
|
|
56
67
|
};
|
|
@@ -65,6 +76,8 @@ interface PropertyConfig {
|
|
|
65
76
|
categories: CategoryInfo[];
|
|
66
77
|
marketingChannels: MarketingChannelInfo[];
|
|
67
78
|
geoRules: GeoRule[];
|
|
79
|
+
formConsentSources: FormConsentSource[];
|
|
80
|
+
privacyNoticeUrl: string | null;
|
|
68
81
|
translations: Record<string, TranslationSet>;
|
|
69
82
|
}
|
|
70
83
|
interface CategoryInfo {
|
|
@@ -107,6 +120,36 @@ interface SavedConsent {
|
|
|
107
120
|
regulationApplied: string;
|
|
108
121
|
consentVersion?: string;
|
|
109
122
|
}
|
|
123
|
+
interface FormConsentProps {
|
|
124
|
+
propertyKey?: string;
|
|
125
|
+
apiUrl?: string;
|
|
126
|
+
subjectId: string;
|
|
127
|
+
subjectType?: 'visitor' | 'user' | 'subscriber';
|
|
128
|
+
mode?: 'granular' | 'simple';
|
|
129
|
+
simpleLabel?: string;
|
|
130
|
+
channels?: string[];
|
|
131
|
+
onConsentSubmitted?: (result: {
|
|
132
|
+
consentId: string;
|
|
133
|
+
proofHash: string;
|
|
134
|
+
consents: MarketingConsentState;
|
|
135
|
+
}) => void;
|
|
136
|
+
onConsentChange?: (consents: MarketingConsentState) => void;
|
|
137
|
+
autoSubmit?: boolean;
|
|
138
|
+
className?: string;
|
|
139
|
+
style?: React.CSSProperties;
|
|
140
|
+
showDescriptions?: boolean;
|
|
141
|
+
showPrivacyLink?: boolean;
|
|
142
|
+
privacyLinkText?: string;
|
|
143
|
+
privacyUrl?: string;
|
|
144
|
+
}
|
|
145
|
+
interface FormConsentRef {
|
|
146
|
+
submit: () => Promise<{
|
|
147
|
+
consentId: string;
|
|
148
|
+
proofHash: string;
|
|
149
|
+
} | null>;
|
|
150
|
+
getConsents: () => MarketingConsentState;
|
|
151
|
+
reset: () => void;
|
|
152
|
+
}
|
|
110
153
|
interface ConsentIQContextValue {
|
|
111
154
|
/** Current consent state */
|
|
112
155
|
consent: ConsentState;
|
|
@@ -122,6 +165,10 @@ interface ConsentIQContextValue {
|
|
|
122
165
|
isPreferenceCenterVisible: boolean;
|
|
123
166
|
/** Current language */
|
|
124
167
|
language: string;
|
|
168
|
+
/** Change the active display language (must be one of the property's supportedLanguages) */
|
|
169
|
+
changeLanguage: (language: string) => void;
|
|
170
|
+
/** Text direction derived from the active language ('rtl' for ar/he/fa/ur/…, else 'ltr') */
|
|
171
|
+
dir: 'ltr' | 'rtl';
|
|
125
172
|
/** Detected regulation */
|
|
126
173
|
regulation: string | null;
|
|
127
174
|
/** Check if a specific category has consent */
|
|
@@ -149,9 +196,9 @@ interface ConsentIQContextValue {
|
|
|
149
196
|
}
|
|
150
197
|
|
|
151
198
|
interface ConsentIQProviderProps extends ConsentIQConfig {
|
|
152
|
-
children: React.ReactNode;
|
|
199
|
+
children: React$1.ReactNode;
|
|
153
200
|
}
|
|
154
|
-
declare function ConsentIQProvider({ children, propertyKey, apiUrl, subjectId: providedSubjectId, autoGenerateSubjectId, onConsentChange, onOpen, onClose, autoShow, language: preferredLanguage, debug, }: ConsentIQProviderProps):
|
|
201
|
+
declare function ConsentIQProvider({ children, propertyKey, apiUrl, subjectId: providedSubjectId, autoGenerateSubjectId, onConsentChange, onOpen, onClose, autoShow, language: preferredLanguage, locale, debug, }: ConsentIQProviderProps): React$1.JSX.Element;
|
|
155
202
|
/**
|
|
156
203
|
* Hook to access ConsentIQ context
|
|
157
204
|
*/
|
|
@@ -176,9 +223,43 @@ interface CookieBannerProps {
|
|
|
176
223
|
/** Override banner theme */
|
|
177
224
|
theme?: 'light' | 'dark' | 'auto';
|
|
178
225
|
/** Custom styles */
|
|
179
|
-
style?: React.CSSProperties;
|
|
226
|
+
style?: React$1.CSSProperties;
|
|
227
|
+
}
|
|
228
|
+
declare function CookieBanner({ className, position, theme, style }: CookieBannerProps): React$1.JSX.Element | null;
|
|
229
|
+
|
|
230
|
+
interface ConsentTriggerProps {
|
|
231
|
+
/** Custom class name for the trigger button */
|
|
232
|
+
className?: string;
|
|
233
|
+
/** Corner to anchor the trigger to */
|
|
234
|
+
position?: 'bottom-left' | 'bottom-right';
|
|
235
|
+
/** Override trigger theme */
|
|
236
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
237
|
+
/** Custom styles merged onto the button */
|
|
238
|
+
style?: React$1.CSSProperties;
|
|
239
|
+
/** Accessible label / tooltip text */
|
|
240
|
+
label?: string;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Persistent re-entry point for consent preferences.
|
|
244
|
+
*
|
|
245
|
+
* Renders a small fixed badge that reopens the Preference Center, giving users
|
|
246
|
+
* a way to change or withdraw consent after the banner is dismissed (required
|
|
247
|
+
* by GDPR/DPDPA). Hidden while the banner or Preference Center is open, so it
|
|
248
|
+
* only appears once a consent decision has been recorded.
|
|
249
|
+
*/
|
|
250
|
+
declare function ConsentTrigger({ className, position, theme, style, label, }: ConsentTriggerProps): React$1.JSX.Element | null;
|
|
251
|
+
|
|
252
|
+
interface LanguageSelectorProps {
|
|
253
|
+
/** Custom class name */
|
|
254
|
+
className?: string;
|
|
255
|
+
/** Custom styles merged onto the select */
|
|
256
|
+
style?: React$1.CSSProperties;
|
|
180
257
|
}
|
|
181
|
-
|
|
258
|
+
/**
|
|
259
|
+
* Language switcher for the consent UI. Renders nothing when the property
|
|
260
|
+
* supports a single language, so callers can drop it in unconditionally.
|
|
261
|
+
*/
|
|
262
|
+
declare function LanguageSelector({ className, style }: LanguageSelectorProps): React$1.JSX.Element | null;
|
|
182
263
|
|
|
183
264
|
interface PreferenceCenterProps {
|
|
184
265
|
/** Custom class name */
|
|
@@ -186,19 +267,19 @@ interface PreferenceCenterProps {
|
|
|
186
267
|
/** Override theme */
|
|
187
268
|
theme?: 'light' | 'dark' | 'auto';
|
|
188
269
|
/** Custom styles */
|
|
189
|
-
style?: React.CSSProperties;
|
|
270
|
+
style?: React$1.CSSProperties;
|
|
190
271
|
}
|
|
191
|
-
declare function PreferenceCenter({ className, theme, style }: PreferenceCenterProps):
|
|
272
|
+
declare function PreferenceCenter({ className, theme, style }: PreferenceCenterProps): React$1.JSX.Element | null;
|
|
192
273
|
|
|
193
274
|
interface ConsentGateProps {
|
|
194
275
|
/** The consent category required to show children */
|
|
195
276
|
category: ConsentCategory | string;
|
|
196
277
|
/** Content to show when consent is granted */
|
|
197
|
-
children: React.ReactNode;
|
|
278
|
+
children: React$1.ReactNode;
|
|
198
279
|
/** Content to show when consent is not granted (optional) */
|
|
199
|
-
fallback?: React.ReactNode;
|
|
280
|
+
fallback?: React$1.ReactNode;
|
|
200
281
|
/** Content to show while loading (optional) */
|
|
201
|
-
loading?: React.ReactNode;
|
|
282
|
+
loading?: React$1.ReactNode;
|
|
202
283
|
}
|
|
203
284
|
/**
|
|
204
285
|
* ConsentGate - Conditionally render content based on consent status
|
|
@@ -217,7 +298,7 @@ interface ConsentGateProps {
|
|
|
217
298
|
* </ConsentGate>
|
|
218
299
|
* ```
|
|
219
300
|
*/
|
|
220
|
-
declare function ConsentGate({ category, children, fallback, loading, }: ConsentGateProps):
|
|
301
|
+
declare function ConsentGate({ category, children, fallback, loading, }: ConsentGateProps): React$1.JSX.Element;
|
|
221
302
|
/**
|
|
222
303
|
* Higher-order component version of ConsentGate
|
|
223
304
|
*
|
|
@@ -226,7 +307,36 @@ declare function ConsentGate({ category, children, fallback, loading, }: Consent
|
|
|
226
307
|
* const ProtectedAnalytics = withConsentGate(GoogleAnalytics, 'analytics');
|
|
227
308
|
* ```
|
|
228
309
|
*/
|
|
229
|
-
declare function withConsentGate<P extends object>(Component: React.ComponentType<P>, category: ConsentCategory | string, FallbackComponent?: React.ComponentType<P>): (props: P) =>
|
|
310
|
+
declare function withConsentGate<P extends object>(Component: React$1.ComponentType<P>, category: ConsentCategory | string, FallbackComponent?: React$1.ComponentType<P>): (props: P) => React$1.JSX.Element | null;
|
|
311
|
+
|
|
312
|
+
declare const MarketingConsentForm: React$1.ForwardRefExoticComponent<FormConsentProps & React$1.RefAttributes<FormConsentRef>>;
|
|
313
|
+
|
|
314
|
+
interface UseFormConsentOptions {
|
|
315
|
+
propertyKey: string;
|
|
316
|
+
apiUrl?: string;
|
|
317
|
+
subjectId: string;
|
|
318
|
+
subjectType?: 'visitor' | 'user' | 'subscriber';
|
|
319
|
+
debug?: boolean;
|
|
320
|
+
}
|
|
321
|
+
interface UseFormConsentReturn {
|
|
322
|
+
channels: MarketingChannelInfo[];
|
|
323
|
+
consents: MarketingConsentState;
|
|
324
|
+
privacyNoticeUrl: string | null;
|
|
325
|
+
lastSubmission: {
|
|
326
|
+
consentId: string;
|
|
327
|
+
proofHash: string;
|
|
328
|
+
} | null;
|
|
329
|
+
setConsent: (channel: string, value: boolean) => void;
|
|
330
|
+
setAllConsents: (value: boolean) => void;
|
|
331
|
+
submit: () => Promise<{
|
|
332
|
+
consentId: string;
|
|
333
|
+
proofHash: string;
|
|
334
|
+
} | null>;
|
|
335
|
+
isLoading: boolean;
|
|
336
|
+
isSubmitting: boolean;
|
|
337
|
+
error: string | null;
|
|
338
|
+
}
|
|
339
|
+
declare function useFormConsent(options: UseFormConsentOptions): UseFormConsentReturn;
|
|
230
340
|
|
|
231
341
|
/**
|
|
232
342
|
* ConsentIQ API Client
|
|
@@ -254,12 +364,12 @@ declare class ConsentIQApiClient {
|
|
|
254
364
|
submitConsent(data: {
|
|
255
365
|
subjectId: string;
|
|
256
366
|
subjectType?: 'visitor' | 'user' | 'subscriber';
|
|
257
|
-
cookieConsents
|
|
367
|
+
cookieConsents?: ConsentState;
|
|
258
368
|
marketingConsents?: MarketingConsentState;
|
|
259
369
|
geoCountry?: string;
|
|
260
370
|
geoRegion?: string;
|
|
261
371
|
geoSource?: 'ip' | 'user_override' | 'browser';
|
|
262
|
-
consentMethod?:
|
|
372
|
+
consentMethod?: ConsentMethod;
|
|
263
373
|
consentVersion?: string;
|
|
264
374
|
}): Promise<{
|
|
265
375
|
success: boolean;
|
|
@@ -295,4 +405,4 @@ declare function detectCountry(): string | undefined;
|
|
|
295
405
|
*/
|
|
296
406
|
declare function detectLanguage(supportedLanguages: string[]): string;
|
|
297
407
|
|
|
298
|
-
export { type BannerLayout, type BannerPosition, type BannerTheme, type CategoryInfo, type ConsentCategory, ConsentGate, type ConsentGateProps, ConsentIQApiClient, type ConsentIQConfig, type ConsentIQContextValue, ConsentIQProvider, type ConsentMethod, type ConsentState, CookieBanner, type CookieBannerProps, type GeoRule, type MarketingChannelInfo, type MarketingConsentState, PreferenceCenter, type PreferenceCenterProps, type PropertyConfig, type SavedConsent, type TranslationSet, detectCountry, detectLanguage, generateSubjectId, getOrCreateSubjectId, useConsent, useConsentGate, useConsentIQ, withConsentGate };
|
|
408
|
+
export { type BannerLayout, type BannerPosition, type BannerTheme, type CategoryInfo, type ConsentCategory, ConsentGate, type ConsentGateProps, ConsentIQApiClient, type ConsentIQConfig, type ConsentIQContextValue, ConsentIQProvider, type ConsentMethod, type ConsentState, ConsentTrigger, type ConsentTriggerProps, CookieBanner, type CookieBannerProps, type FormConsentProps, type FormConsentRef, type FormConsentSource, type GeoRule, LanguageSelector, type LanguageSelectorProps, type MarketingChannelInfo, MarketingConsentForm, type MarketingConsentState, PreferenceCenter, type PreferenceCenterProps, type PropertyConfig, type SavedConsent, type TranslationSet, detectCountry, detectLanguage, generateSubjectId, getOrCreateSubjectId, useConsent, useConsentGate, useConsentIQ, useFormConsent, withConsentGate };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import React$1 from 'react';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* ConsentIQ React SDK Types
|
|
6
5
|
*/
|
|
7
6
|
type ConsentCategory = 'necessary' | 'analytics' | 'marketing' | 'preferences' | 'social';
|
|
8
|
-
type ConsentMethod = 'banner' | 'preference_center' | 'api' | 'sdk';
|
|
7
|
+
type ConsentMethod = 'banner' | 'preference_center' | 'api' | 'sdk' | 'form' | 'import' | 'offline';
|
|
9
8
|
type BannerPosition = 'bottom' | 'bottom-left' | 'bottom-right' | 'top' | 'center';
|
|
10
9
|
type BannerLayout = 'banner' | 'floating' | 'modal';
|
|
11
10
|
type BannerTheme = 'light' | 'dark' | 'auto';
|
|
@@ -43,14 +42,26 @@ interface ConsentIQConfig {
|
|
|
43
42
|
autoShow?: boolean;
|
|
44
43
|
/** Custom language code (overrides auto-detection) */
|
|
45
44
|
language?: string;
|
|
45
|
+
/** Alias for `language` — locale/language code to use as the default (e.g. site locale) */
|
|
46
|
+
locale?: string;
|
|
46
47
|
/** Debug mode for development */
|
|
47
48
|
debug?: boolean;
|
|
48
49
|
}
|
|
50
|
+
interface FormConsentSource {
|
|
51
|
+
selector: string | null;
|
|
52
|
+
isAutoResolved: boolean;
|
|
53
|
+
privacyNotice: {
|
|
54
|
+
id: string;
|
|
55
|
+
name: string;
|
|
56
|
+
type: string;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
49
59
|
interface PropertyConfig {
|
|
50
60
|
property: {
|
|
51
61
|
id: string;
|
|
52
62
|
name: string;
|
|
53
|
-
|
|
63
|
+
identifier: string;
|
|
64
|
+
platform: 'web' | 'ios' | 'android';
|
|
54
65
|
defaultLanguage: string;
|
|
55
66
|
supportedLanguages: string[];
|
|
56
67
|
};
|
|
@@ -65,6 +76,8 @@ interface PropertyConfig {
|
|
|
65
76
|
categories: CategoryInfo[];
|
|
66
77
|
marketingChannels: MarketingChannelInfo[];
|
|
67
78
|
geoRules: GeoRule[];
|
|
79
|
+
formConsentSources: FormConsentSource[];
|
|
80
|
+
privacyNoticeUrl: string | null;
|
|
68
81
|
translations: Record<string, TranslationSet>;
|
|
69
82
|
}
|
|
70
83
|
interface CategoryInfo {
|
|
@@ -107,6 +120,36 @@ interface SavedConsent {
|
|
|
107
120
|
regulationApplied: string;
|
|
108
121
|
consentVersion?: string;
|
|
109
122
|
}
|
|
123
|
+
interface FormConsentProps {
|
|
124
|
+
propertyKey?: string;
|
|
125
|
+
apiUrl?: string;
|
|
126
|
+
subjectId: string;
|
|
127
|
+
subjectType?: 'visitor' | 'user' | 'subscriber';
|
|
128
|
+
mode?: 'granular' | 'simple';
|
|
129
|
+
simpleLabel?: string;
|
|
130
|
+
channels?: string[];
|
|
131
|
+
onConsentSubmitted?: (result: {
|
|
132
|
+
consentId: string;
|
|
133
|
+
proofHash: string;
|
|
134
|
+
consents: MarketingConsentState;
|
|
135
|
+
}) => void;
|
|
136
|
+
onConsentChange?: (consents: MarketingConsentState) => void;
|
|
137
|
+
autoSubmit?: boolean;
|
|
138
|
+
className?: string;
|
|
139
|
+
style?: React.CSSProperties;
|
|
140
|
+
showDescriptions?: boolean;
|
|
141
|
+
showPrivacyLink?: boolean;
|
|
142
|
+
privacyLinkText?: string;
|
|
143
|
+
privacyUrl?: string;
|
|
144
|
+
}
|
|
145
|
+
interface FormConsentRef {
|
|
146
|
+
submit: () => Promise<{
|
|
147
|
+
consentId: string;
|
|
148
|
+
proofHash: string;
|
|
149
|
+
} | null>;
|
|
150
|
+
getConsents: () => MarketingConsentState;
|
|
151
|
+
reset: () => void;
|
|
152
|
+
}
|
|
110
153
|
interface ConsentIQContextValue {
|
|
111
154
|
/** Current consent state */
|
|
112
155
|
consent: ConsentState;
|
|
@@ -122,6 +165,10 @@ interface ConsentIQContextValue {
|
|
|
122
165
|
isPreferenceCenterVisible: boolean;
|
|
123
166
|
/** Current language */
|
|
124
167
|
language: string;
|
|
168
|
+
/** Change the active display language (must be one of the property's supportedLanguages) */
|
|
169
|
+
changeLanguage: (language: string) => void;
|
|
170
|
+
/** Text direction derived from the active language ('rtl' for ar/he/fa/ur/…, else 'ltr') */
|
|
171
|
+
dir: 'ltr' | 'rtl';
|
|
125
172
|
/** Detected regulation */
|
|
126
173
|
regulation: string | null;
|
|
127
174
|
/** Check if a specific category has consent */
|
|
@@ -149,9 +196,9 @@ interface ConsentIQContextValue {
|
|
|
149
196
|
}
|
|
150
197
|
|
|
151
198
|
interface ConsentIQProviderProps extends ConsentIQConfig {
|
|
152
|
-
children: React.ReactNode;
|
|
199
|
+
children: React$1.ReactNode;
|
|
153
200
|
}
|
|
154
|
-
declare function ConsentIQProvider({ children, propertyKey, apiUrl, subjectId: providedSubjectId, autoGenerateSubjectId, onConsentChange, onOpen, onClose, autoShow, language: preferredLanguage, debug, }: ConsentIQProviderProps):
|
|
201
|
+
declare function ConsentIQProvider({ children, propertyKey, apiUrl, subjectId: providedSubjectId, autoGenerateSubjectId, onConsentChange, onOpen, onClose, autoShow, language: preferredLanguage, locale, debug, }: ConsentIQProviderProps): React$1.JSX.Element;
|
|
155
202
|
/**
|
|
156
203
|
* Hook to access ConsentIQ context
|
|
157
204
|
*/
|
|
@@ -176,9 +223,43 @@ interface CookieBannerProps {
|
|
|
176
223
|
/** Override banner theme */
|
|
177
224
|
theme?: 'light' | 'dark' | 'auto';
|
|
178
225
|
/** Custom styles */
|
|
179
|
-
style?: React.CSSProperties;
|
|
226
|
+
style?: React$1.CSSProperties;
|
|
227
|
+
}
|
|
228
|
+
declare function CookieBanner({ className, position, theme, style }: CookieBannerProps): React$1.JSX.Element | null;
|
|
229
|
+
|
|
230
|
+
interface ConsentTriggerProps {
|
|
231
|
+
/** Custom class name for the trigger button */
|
|
232
|
+
className?: string;
|
|
233
|
+
/** Corner to anchor the trigger to */
|
|
234
|
+
position?: 'bottom-left' | 'bottom-right';
|
|
235
|
+
/** Override trigger theme */
|
|
236
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
237
|
+
/** Custom styles merged onto the button */
|
|
238
|
+
style?: React$1.CSSProperties;
|
|
239
|
+
/** Accessible label / tooltip text */
|
|
240
|
+
label?: string;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Persistent re-entry point for consent preferences.
|
|
244
|
+
*
|
|
245
|
+
* Renders a small fixed badge that reopens the Preference Center, giving users
|
|
246
|
+
* a way to change or withdraw consent after the banner is dismissed (required
|
|
247
|
+
* by GDPR/DPDPA). Hidden while the banner or Preference Center is open, so it
|
|
248
|
+
* only appears once a consent decision has been recorded.
|
|
249
|
+
*/
|
|
250
|
+
declare function ConsentTrigger({ className, position, theme, style, label, }: ConsentTriggerProps): React$1.JSX.Element | null;
|
|
251
|
+
|
|
252
|
+
interface LanguageSelectorProps {
|
|
253
|
+
/** Custom class name */
|
|
254
|
+
className?: string;
|
|
255
|
+
/** Custom styles merged onto the select */
|
|
256
|
+
style?: React$1.CSSProperties;
|
|
180
257
|
}
|
|
181
|
-
|
|
258
|
+
/**
|
|
259
|
+
* Language switcher for the consent UI. Renders nothing when the property
|
|
260
|
+
* supports a single language, so callers can drop it in unconditionally.
|
|
261
|
+
*/
|
|
262
|
+
declare function LanguageSelector({ className, style }: LanguageSelectorProps): React$1.JSX.Element | null;
|
|
182
263
|
|
|
183
264
|
interface PreferenceCenterProps {
|
|
184
265
|
/** Custom class name */
|
|
@@ -186,19 +267,19 @@ interface PreferenceCenterProps {
|
|
|
186
267
|
/** Override theme */
|
|
187
268
|
theme?: 'light' | 'dark' | 'auto';
|
|
188
269
|
/** Custom styles */
|
|
189
|
-
style?: React.CSSProperties;
|
|
270
|
+
style?: React$1.CSSProperties;
|
|
190
271
|
}
|
|
191
|
-
declare function PreferenceCenter({ className, theme, style }: PreferenceCenterProps):
|
|
272
|
+
declare function PreferenceCenter({ className, theme, style }: PreferenceCenterProps): React$1.JSX.Element | null;
|
|
192
273
|
|
|
193
274
|
interface ConsentGateProps {
|
|
194
275
|
/** The consent category required to show children */
|
|
195
276
|
category: ConsentCategory | string;
|
|
196
277
|
/** Content to show when consent is granted */
|
|
197
|
-
children: React.ReactNode;
|
|
278
|
+
children: React$1.ReactNode;
|
|
198
279
|
/** Content to show when consent is not granted (optional) */
|
|
199
|
-
fallback?: React.ReactNode;
|
|
280
|
+
fallback?: React$1.ReactNode;
|
|
200
281
|
/** Content to show while loading (optional) */
|
|
201
|
-
loading?: React.ReactNode;
|
|
282
|
+
loading?: React$1.ReactNode;
|
|
202
283
|
}
|
|
203
284
|
/**
|
|
204
285
|
* ConsentGate - Conditionally render content based on consent status
|
|
@@ -217,7 +298,7 @@ interface ConsentGateProps {
|
|
|
217
298
|
* </ConsentGate>
|
|
218
299
|
* ```
|
|
219
300
|
*/
|
|
220
|
-
declare function ConsentGate({ category, children, fallback, loading, }: ConsentGateProps):
|
|
301
|
+
declare function ConsentGate({ category, children, fallback, loading, }: ConsentGateProps): React$1.JSX.Element;
|
|
221
302
|
/**
|
|
222
303
|
* Higher-order component version of ConsentGate
|
|
223
304
|
*
|
|
@@ -226,7 +307,36 @@ declare function ConsentGate({ category, children, fallback, loading, }: Consent
|
|
|
226
307
|
* const ProtectedAnalytics = withConsentGate(GoogleAnalytics, 'analytics');
|
|
227
308
|
* ```
|
|
228
309
|
*/
|
|
229
|
-
declare function withConsentGate<P extends object>(Component: React.ComponentType<P>, category: ConsentCategory | string, FallbackComponent?: React.ComponentType<P>): (props: P) =>
|
|
310
|
+
declare function withConsentGate<P extends object>(Component: React$1.ComponentType<P>, category: ConsentCategory | string, FallbackComponent?: React$1.ComponentType<P>): (props: P) => React$1.JSX.Element | null;
|
|
311
|
+
|
|
312
|
+
declare const MarketingConsentForm: React$1.ForwardRefExoticComponent<FormConsentProps & React$1.RefAttributes<FormConsentRef>>;
|
|
313
|
+
|
|
314
|
+
interface UseFormConsentOptions {
|
|
315
|
+
propertyKey: string;
|
|
316
|
+
apiUrl?: string;
|
|
317
|
+
subjectId: string;
|
|
318
|
+
subjectType?: 'visitor' | 'user' | 'subscriber';
|
|
319
|
+
debug?: boolean;
|
|
320
|
+
}
|
|
321
|
+
interface UseFormConsentReturn {
|
|
322
|
+
channels: MarketingChannelInfo[];
|
|
323
|
+
consents: MarketingConsentState;
|
|
324
|
+
privacyNoticeUrl: string | null;
|
|
325
|
+
lastSubmission: {
|
|
326
|
+
consentId: string;
|
|
327
|
+
proofHash: string;
|
|
328
|
+
} | null;
|
|
329
|
+
setConsent: (channel: string, value: boolean) => void;
|
|
330
|
+
setAllConsents: (value: boolean) => void;
|
|
331
|
+
submit: () => Promise<{
|
|
332
|
+
consentId: string;
|
|
333
|
+
proofHash: string;
|
|
334
|
+
} | null>;
|
|
335
|
+
isLoading: boolean;
|
|
336
|
+
isSubmitting: boolean;
|
|
337
|
+
error: string | null;
|
|
338
|
+
}
|
|
339
|
+
declare function useFormConsent(options: UseFormConsentOptions): UseFormConsentReturn;
|
|
230
340
|
|
|
231
341
|
/**
|
|
232
342
|
* ConsentIQ API Client
|
|
@@ -254,12 +364,12 @@ declare class ConsentIQApiClient {
|
|
|
254
364
|
submitConsent(data: {
|
|
255
365
|
subjectId: string;
|
|
256
366
|
subjectType?: 'visitor' | 'user' | 'subscriber';
|
|
257
|
-
cookieConsents
|
|
367
|
+
cookieConsents?: ConsentState;
|
|
258
368
|
marketingConsents?: MarketingConsentState;
|
|
259
369
|
geoCountry?: string;
|
|
260
370
|
geoRegion?: string;
|
|
261
371
|
geoSource?: 'ip' | 'user_override' | 'browser';
|
|
262
|
-
consentMethod?:
|
|
372
|
+
consentMethod?: ConsentMethod;
|
|
263
373
|
consentVersion?: string;
|
|
264
374
|
}): Promise<{
|
|
265
375
|
success: boolean;
|
|
@@ -295,4 +405,4 @@ declare function detectCountry(): string | undefined;
|
|
|
295
405
|
*/
|
|
296
406
|
declare function detectLanguage(supportedLanguages: string[]): string;
|
|
297
407
|
|
|
298
|
-
export { type BannerLayout, type BannerPosition, type BannerTheme, type CategoryInfo, type ConsentCategory, ConsentGate, type ConsentGateProps, ConsentIQApiClient, type ConsentIQConfig, type ConsentIQContextValue, ConsentIQProvider, type ConsentMethod, type ConsentState, CookieBanner, type CookieBannerProps, type GeoRule, type MarketingChannelInfo, type MarketingConsentState, PreferenceCenter, type PreferenceCenterProps, type PropertyConfig, type SavedConsent, type TranslationSet, detectCountry, detectLanguage, generateSubjectId, getOrCreateSubjectId, useConsent, useConsentGate, useConsentIQ, withConsentGate };
|
|
408
|
+
export { type BannerLayout, type BannerPosition, type BannerTheme, type CategoryInfo, type ConsentCategory, ConsentGate, type ConsentGateProps, ConsentIQApiClient, type ConsentIQConfig, type ConsentIQContextValue, ConsentIQProvider, type ConsentMethod, type ConsentState, ConsentTrigger, type ConsentTriggerProps, CookieBanner, type CookieBannerProps, type FormConsentProps, type FormConsentRef, type FormConsentSource, type GeoRule, LanguageSelector, type LanguageSelectorProps, type MarketingChannelInfo, MarketingConsentForm, type MarketingConsentState, PreferenceCenter, type PreferenceCenterProps, type PropertyConfig, type SavedConsent, type TranslationSet, detectCountry, detectLanguage, generateSubjectId, getOrCreateSubjectId, useConsent, useConsentGate, useConsentIQ, useFormConsent, withConsentGate };
|