@iqworksai/consentiq-react 0.1.5 → 0.1.6

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/dist/index.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
1
2
  import React$1 from 'react';
2
3
 
3
4
  /**
@@ -198,7 +199,7 @@ interface ConsentIQContextValue {
198
199
  interface ConsentIQProviderProps extends ConsentIQConfig {
199
200
  children: React$1.ReactNode;
200
201
  }
201
- declare function ConsentIQProvider({ children, propertyKey, apiUrl, subjectId: providedSubjectId, autoGenerateSubjectId, onConsentChange, onOpen, onClose, autoShow, language: preferredLanguage, locale, debug, }: ConsentIQProviderProps): React$1.JSX.Element;
202
+ declare function ConsentIQProvider({ children, propertyKey, apiUrl, subjectId: providedSubjectId, autoGenerateSubjectId, onConsentChange, onOpen, onClose, autoShow, language: preferredLanguage, locale, debug, }: ConsentIQProviderProps): react_jsx_runtime.JSX.Element;
202
203
  /**
203
204
  * Hook to access ConsentIQ context
204
205
  */
@@ -225,7 +226,7 @@ interface CookieBannerProps {
225
226
  /** Custom styles */
226
227
  style?: React$1.CSSProperties;
227
228
  }
228
- declare function CookieBanner({ className, position, theme, style }: CookieBannerProps): React$1.JSX.Element | null;
229
+ declare function CookieBanner({ className, position, theme, style }: CookieBannerProps): react_jsx_runtime.JSX.Element | null;
229
230
 
230
231
  interface ConsentTriggerProps {
231
232
  /** Custom class name for the trigger button */
@@ -247,7 +248,51 @@ interface ConsentTriggerProps {
247
248
  * by GDPR/DPDPA). Hidden while the banner or Preference Center is open, so it
248
249
  * only appears once a consent decision has been recorded.
249
250
  */
250
- declare function ConsentTrigger({ className, position, theme, style, label, }: ConsentTriggerProps): React$1.JSX.Element | null;
251
+ declare function ConsentTrigger({ className, position, theme, style, label, }: ConsentTriggerProps): react_jsx_runtime.JSX.Element | null;
252
+
253
+ interface ConsentPageTriggerProps {
254
+ /** ConsentIQ origin, e.g. https://consent.iqworks.ai */
255
+ apiUrl: string;
256
+ /** The consent page's public token */
257
+ token: string;
258
+ /** popup = open in a modal iframe (default); redirect = navigate to the hosted page */
259
+ mode?: 'popup' | 'redirect';
260
+ /** redirect mode only: an allowlisted return URL */
261
+ redirect?: string;
262
+ onComplete?: (result: {
263
+ consentId?: string;
264
+ proofHash?: string;
265
+ email?: string;
266
+ }) => void;
267
+ onClose?: () => void;
268
+ className?: string;
269
+ style?: React$1.CSSProperties;
270
+ children?: React$1.ReactNode;
271
+ }
272
+ /**
273
+ * Opens a property's hosted consent page as a modal iframe popup (or a redirect),
274
+ * and reports completion. Standalone — does not require the cookie ConsentIQProvider.
275
+ */
276
+ declare function ConsentPageTrigger({ apiUrl, token, mode, redirect, onComplete, onClose, className, style, children, }: ConsentPageTriggerProps): react_jsx_runtime.JSX.Element;
277
+
278
+ interface ConsentFormProps {
279
+ /** ConsentIQ origin, e.g. https://consent.iqworks.ai */
280
+ apiUrl: string;
281
+ /** The consent page's public token (binding must have embed enabled) */
282
+ token: string;
283
+ /** If the host already knows the person's email, pass it to skip the email field */
284
+ email?: string;
285
+ onRecorded?: (result: {
286
+ consentId: string;
287
+ proofHash: string;
288
+ }) => void;
289
+ className?: string;
290
+ }
291
+ /**
292
+ * Renders a consent page's purposes as inline checkboxes on the host's own form and records
293
+ * consent via the embed API. Drop in on the specific forms that need inline consent — Stage 2.
294
+ */
295
+ declare function ConsentForm({ apiUrl, token, email: initialEmail, onRecorded, className }: ConsentFormProps): react_jsx_runtime.JSX.Element;
251
296
 
252
297
  interface LanguageSelectorProps {
253
298
  /** Custom class name */
@@ -259,7 +304,7 @@ interface LanguageSelectorProps {
259
304
  * Language switcher for the consent UI. Renders nothing when the property
260
305
  * supports a single language, so callers can drop it in unconditionally.
261
306
  */
262
- declare function LanguageSelector({ className, style }: LanguageSelectorProps): React$1.JSX.Element | null;
307
+ declare function LanguageSelector({ className, style }: LanguageSelectorProps): react_jsx_runtime.JSX.Element | null;
263
308
 
264
309
  interface PreferenceCenterProps {
265
310
  /** Custom class name */
@@ -269,7 +314,7 @@ interface PreferenceCenterProps {
269
314
  /** Custom styles */
270
315
  style?: React$1.CSSProperties;
271
316
  }
272
- declare function PreferenceCenter({ className, theme, style }: PreferenceCenterProps): React$1.JSX.Element | null;
317
+ declare function PreferenceCenter({ className, theme, style }: PreferenceCenterProps): react_jsx_runtime.JSX.Element | null;
273
318
 
274
319
  interface ConsentGateProps {
275
320
  /** The consent category required to show children */
@@ -298,7 +343,7 @@ interface ConsentGateProps {
298
343
  * </ConsentGate>
299
344
  * ```
300
345
  */
301
- declare function ConsentGate({ category, children, fallback, loading, }: ConsentGateProps): React$1.JSX.Element;
346
+ declare function ConsentGate({ category, children, fallback, loading, }: ConsentGateProps): react_jsx_runtime.JSX.Element;
302
347
  /**
303
348
  * Higher-order component version of ConsentGate
304
349
  *
@@ -307,7 +352,7 @@ declare function ConsentGate({ category, children, fallback, loading, }: Consent
307
352
  * const ProtectedAnalytics = withConsentGate(GoogleAnalytics, 'analytics');
308
353
  * ```
309
354
  */
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;
355
+ declare function withConsentGate<P extends object>(Component: React$1.ComponentType<P>, category: ConsentCategory | string, FallbackComponent?: React$1.ComponentType<P>): (props: P) => react_jsx_runtime.JSX.Element | null;
311
356
 
312
357
  declare const MarketingConsentForm: React$1.ForwardRefExoticComponent<FormConsentProps & React$1.RefAttributes<FormConsentRef>>;
313
358
 
@@ -338,6 +383,29 @@ interface UseFormConsentReturn {
338
383
  }
339
384
  declare function useFormConsent(options: UseFormConsentOptions): UseFormConsentReturn;
340
385
 
386
+ interface ConsentPurpose {
387
+ purpose_id: string;
388
+ label: string | null;
389
+ description: string | null;
390
+ data_items: string[] | null;
391
+ is_required: boolean;
392
+ }
393
+ interface RecordedConsent {
394
+ success: boolean;
395
+ consentId: string;
396
+ proofHash: string;
397
+ }
398
+ /**
399
+ * Fetches a consent page's purposes (for the host to render its own checkboxes) and records
400
+ * consent inline via the embed API — Stage 2 of the integration journey.
401
+ */
402
+ declare function useConsentPurposes(apiUrl: string, token: string): {
403
+ purposes: ConsentPurpose[];
404
+ loading: boolean;
405
+ error: string | null;
406
+ record: (email: string, purposeConsents: Record<string, boolean>) => Promise<RecordedConsent>;
407
+ };
408
+
341
409
  /**
342
410
  * ConsentIQ API Client
343
411
  * Handles all communication with the ConsentIQ backend
@@ -405,4 +473,4 @@ declare function detectCountry(): string | undefined;
405
473
  */
406
474
  declare function detectLanguage(supportedLanguages: string[]): string;
407
475
 
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 };
476
+ export { type BannerLayout, type BannerPosition, type BannerTheme, type CategoryInfo, type ConsentCategory, ConsentForm, type ConsentFormProps, ConsentGate, type ConsentGateProps, ConsentIQApiClient, type ConsentIQConfig, type ConsentIQContextValue, ConsentIQProvider, type ConsentMethod, ConsentPageTrigger, type ConsentPageTriggerProps, type ConsentPurpose, 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 RecordedConsent, type SavedConsent, type TranslationSet, detectCountry, detectLanguage, generateSubjectId, getOrCreateSubjectId, useConsent, useConsentGate, useConsentIQ, useConsentPurposes, useFormConsent, withConsentGate };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
1
2
  import React$1 from 'react';
2
3
 
3
4
  /**
@@ -198,7 +199,7 @@ interface ConsentIQContextValue {
198
199
  interface ConsentIQProviderProps extends ConsentIQConfig {
199
200
  children: React$1.ReactNode;
200
201
  }
201
- declare function ConsentIQProvider({ children, propertyKey, apiUrl, subjectId: providedSubjectId, autoGenerateSubjectId, onConsentChange, onOpen, onClose, autoShow, language: preferredLanguage, locale, debug, }: ConsentIQProviderProps): React$1.JSX.Element;
202
+ declare function ConsentIQProvider({ children, propertyKey, apiUrl, subjectId: providedSubjectId, autoGenerateSubjectId, onConsentChange, onOpen, onClose, autoShow, language: preferredLanguage, locale, debug, }: ConsentIQProviderProps): react_jsx_runtime.JSX.Element;
202
203
  /**
203
204
  * Hook to access ConsentIQ context
204
205
  */
@@ -225,7 +226,7 @@ interface CookieBannerProps {
225
226
  /** Custom styles */
226
227
  style?: React$1.CSSProperties;
227
228
  }
228
- declare function CookieBanner({ className, position, theme, style }: CookieBannerProps): React$1.JSX.Element | null;
229
+ declare function CookieBanner({ className, position, theme, style }: CookieBannerProps): react_jsx_runtime.JSX.Element | null;
229
230
 
230
231
  interface ConsentTriggerProps {
231
232
  /** Custom class name for the trigger button */
@@ -247,7 +248,51 @@ interface ConsentTriggerProps {
247
248
  * by GDPR/DPDPA). Hidden while the banner or Preference Center is open, so it
248
249
  * only appears once a consent decision has been recorded.
249
250
  */
250
- declare function ConsentTrigger({ className, position, theme, style, label, }: ConsentTriggerProps): React$1.JSX.Element | null;
251
+ declare function ConsentTrigger({ className, position, theme, style, label, }: ConsentTriggerProps): react_jsx_runtime.JSX.Element | null;
252
+
253
+ interface ConsentPageTriggerProps {
254
+ /** ConsentIQ origin, e.g. https://consent.iqworks.ai */
255
+ apiUrl: string;
256
+ /** The consent page's public token */
257
+ token: string;
258
+ /** popup = open in a modal iframe (default); redirect = navigate to the hosted page */
259
+ mode?: 'popup' | 'redirect';
260
+ /** redirect mode only: an allowlisted return URL */
261
+ redirect?: string;
262
+ onComplete?: (result: {
263
+ consentId?: string;
264
+ proofHash?: string;
265
+ email?: string;
266
+ }) => void;
267
+ onClose?: () => void;
268
+ className?: string;
269
+ style?: React$1.CSSProperties;
270
+ children?: React$1.ReactNode;
271
+ }
272
+ /**
273
+ * Opens a property's hosted consent page as a modal iframe popup (or a redirect),
274
+ * and reports completion. Standalone — does not require the cookie ConsentIQProvider.
275
+ */
276
+ declare function ConsentPageTrigger({ apiUrl, token, mode, redirect, onComplete, onClose, className, style, children, }: ConsentPageTriggerProps): react_jsx_runtime.JSX.Element;
277
+
278
+ interface ConsentFormProps {
279
+ /** ConsentIQ origin, e.g. https://consent.iqworks.ai */
280
+ apiUrl: string;
281
+ /** The consent page's public token (binding must have embed enabled) */
282
+ token: string;
283
+ /** If the host already knows the person's email, pass it to skip the email field */
284
+ email?: string;
285
+ onRecorded?: (result: {
286
+ consentId: string;
287
+ proofHash: string;
288
+ }) => void;
289
+ className?: string;
290
+ }
291
+ /**
292
+ * Renders a consent page's purposes as inline checkboxes on the host's own form and records
293
+ * consent via the embed API. Drop in on the specific forms that need inline consent — Stage 2.
294
+ */
295
+ declare function ConsentForm({ apiUrl, token, email: initialEmail, onRecorded, className }: ConsentFormProps): react_jsx_runtime.JSX.Element;
251
296
 
252
297
  interface LanguageSelectorProps {
253
298
  /** Custom class name */
@@ -259,7 +304,7 @@ interface LanguageSelectorProps {
259
304
  * Language switcher for the consent UI. Renders nothing when the property
260
305
  * supports a single language, so callers can drop it in unconditionally.
261
306
  */
262
- declare function LanguageSelector({ className, style }: LanguageSelectorProps): React$1.JSX.Element | null;
307
+ declare function LanguageSelector({ className, style }: LanguageSelectorProps): react_jsx_runtime.JSX.Element | null;
263
308
 
264
309
  interface PreferenceCenterProps {
265
310
  /** Custom class name */
@@ -269,7 +314,7 @@ interface PreferenceCenterProps {
269
314
  /** Custom styles */
270
315
  style?: React$1.CSSProperties;
271
316
  }
272
- declare function PreferenceCenter({ className, theme, style }: PreferenceCenterProps): React$1.JSX.Element | null;
317
+ declare function PreferenceCenter({ className, theme, style }: PreferenceCenterProps): react_jsx_runtime.JSX.Element | null;
273
318
 
274
319
  interface ConsentGateProps {
275
320
  /** The consent category required to show children */
@@ -298,7 +343,7 @@ interface ConsentGateProps {
298
343
  * </ConsentGate>
299
344
  * ```
300
345
  */
301
- declare function ConsentGate({ category, children, fallback, loading, }: ConsentGateProps): React$1.JSX.Element;
346
+ declare function ConsentGate({ category, children, fallback, loading, }: ConsentGateProps): react_jsx_runtime.JSX.Element;
302
347
  /**
303
348
  * Higher-order component version of ConsentGate
304
349
  *
@@ -307,7 +352,7 @@ declare function ConsentGate({ category, children, fallback, loading, }: Consent
307
352
  * const ProtectedAnalytics = withConsentGate(GoogleAnalytics, 'analytics');
308
353
  * ```
309
354
  */
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;
355
+ declare function withConsentGate<P extends object>(Component: React$1.ComponentType<P>, category: ConsentCategory | string, FallbackComponent?: React$1.ComponentType<P>): (props: P) => react_jsx_runtime.JSX.Element | null;
311
356
 
312
357
  declare const MarketingConsentForm: React$1.ForwardRefExoticComponent<FormConsentProps & React$1.RefAttributes<FormConsentRef>>;
313
358
 
@@ -338,6 +383,29 @@ interface UseFormConsentReturn {
338
383
  }
339
384
  declare function useFormConsent(options: UseFormConsentOptions): UseFormConsentReturn;
340
385
 
386
+ interface ConsentPurpose {
387
+ purpose_id: string;
388
+ label: string | null;
389
+ description: string | null;
390
+ data_items: string[] | null;
391
+ is_required: boolean;
392
+ }
393
+ interface RecordedConsent {
394
+ success: boolean;
395
+ consentId: string;
396
+ proofHash: string;
397
+ }
398
+ /**
399
+ * Fetches a consent page's purposes (for the host to render its own checkboxes) and records
400
+ * consent inline via the embed API — Stage 2 of the integration journey.
401
+ */
402
+ declare function useConsentPurposes(apiUrl: string, token: string): {
403
+ purposes: ConsentPurpose[];
404
+ loading: boolean;
405
+ error: string | null;
406
+ record: (email: string, purposeConsents: Record<string, boolean>) => Promise<RecordedConsent>;
407
+ };
408
+
341
409
  /**
342
410
  * ConsentIQ API Client
343
411
  * Handles all communication with the ConsentIQ backend
@@ -405,4 +473,4 @@ declare function detectCountry(): string | undefined;
405
473
  */
406
474
  declare function detectLanguage(supportedLanguages: string[]): string;
407
475
 
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 };
476
+ export { type BannerLayout, type BannerPosition, type BannerTheme, type CategoryInfo, type ConsentCategory, ConsentForm, type ConsentFormProps, ConsentGate, type ConsentGateProps, ConsentIQApiClient, type ConsentIQConfig, type ConsentIQContextValue, ConsentIQProvider, type ConsentMethod, ConsentPageTrigger, type ConsentPageTriggerProps, type ConsentPurpose, 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 RecordedConsent, type SavedConsent, type TranslationSet, detectCountry, detectLanguage, generateSubjectId, getOrCreateSubjectId, useConsent, useConsentGate, useConsentIQ, useConsentPurposes, useFormConsent, withConsentGate };