@redacto.io/consent-sdk-react 10.3.1 → 11.0.0-beta.2
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 +195 -34
- package/dist/{chunk-RG4PVVKF.mjs → chunk-W45JQYDG.mjs} +155 -58
- package/dist/index.d.mts +38 -4
- package/dist/index.d.ts +38 -4
- package/dist/index.js +523 -389
- package/dist/index.mjs +80 -39
- package/dist/privacy-center.d.mts +359 -31
- package/dist/privacy-center.d.ts +359 -31
- package/dist/privacy-center.js +4823 -2245
- package/dist/privacy-center.mjs +4605 -2200
- package/package.json +1 -1
package/dist/privacy-center.d.ts
CHANGED
|
@@ -32,12 +32,18 @@ type BaseRequest = {
|
|
|
32
32
|
/**
|
|
33
33
|
* Consent service client factory.
|
|
34
34
|
* Creates a client instance with a specific base URL.
|
|
35
|
-
* @param baseUrl -
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
35
|
+
* @param baseUrl - API host, e.g. https://api.redacto.io (recommended): the
|
|
36
|
+
* client reaches the consent server at `{baseUrl}/consent` and the ledger at
|
|
37
|
+
* `{baseUrl}/consent-ledger`. The consent server URL (`…/consent`) still
|
|
38
|
+
* works but is deprecated.
|
|
39
|
+
* @param ledgerBaseUrl - Deprecated. Go ledger base URL (e.g.
|
|
40
|
+
* http://host:8090/consent-ledger). Read only when `baseUrl` is the
|
|
41
|
+
* consent server URL, as in earlier releases; ignored when `baseUrl` is
|
|
42
|
+
* the API host. There it is the ledger used for user-consents reads/writes
|
|
43
|
+
* served from the ledger's `/public/...` paths; when omitted, those calls
|
|
44
|
+
* fall back to the legacy Python `/dsar/privacy-center` endpoints and
|
|
45
|
+
* payloads (pre-ledger behavior), so integrations without a deployed
|
|
46
|
+
* ledger keep working.
|
|
41
47
|
*/
|
|
42
48
|
declare function createConsentClient(baseUrl: string, ledgerBaseUrl?: string): {
|
|
43
49
|
/**
|
|
@@ -53,9 +59,10 @@ declare function createConsentClient(baseUrl: string, ledgerBaseUrl?: string): {
|
|
|
53
59
|
useSessionAuth?: boolean;
|
|
54
60
|
}): Promise<unknown>;
|
|
55
61
|
/**
|
|
56
|
-
* Create OTP (public)
|
|
62
|
+
* Create OTP (public). `to` is an email, or an E.164 number with
|
|
63
|
+
* `channel: "sms"`.
|
|
57
64
|
*/
|
|
58
|
-
createOtp(organisationId: string, workspaceId: string, email: string, options?: Omit<ApiFetchOptions, "getAuthToken"
|
|
65
|
+
createOtp(organisationId: string, workspaceId: string, email: string, options?: Omit<ApiFetchOptions, "getAuthToken">, channel?: "email" | "sms"): Promise<unknown>;
|
|
59
66
|
/**
|
|
60
67
|
* Verify OTP (public)
|
|
61
68
|
*
|
|
@@ -218,6 +225,175 @@ declare function createConsentClient(baseUrl: string, ledgerBaseUrl?: string): {
|
|
|
218
225
|
acknowledgeNotification(baseRequest: BaseRequest, notificationUuid: string, authToken?: string): Promise<NotificationActionResponse>;
|
|
219
226
|
};
|
|
220
227
|
|
|
228
|
+
/** Menu sections, keyed by the `InternalPage` each one opens. */
|
|
229
|
+
type PrivacyCenterSectionKey = 'consent-manager' | 'form' | 'activity' | 'receipts' | 'notifications';
|
|
230
|
+
/** Request types, keyed by the lower-case value a case is created with. */
|
|
231
|
+
type PrivacyCenterRequestTypeKey = 'access' | 'correction' | 'erasure' | 'nomination' | 'grievance';
|
|
232
|
+
type PrivacyCenterGrievanceCategory = 'consent_violation' | 'unlawful_processing' | 'data_breach';
|
|
233
|
+
type PrivacyCenterSignInLayout = 'card' | 'split' | 'minimal';
|
|
234
|
+
type PrivacyCenterSignInAlign = 'center' | 'left';
|
|
235
|
+
type PrivacyCenterSignInBackground = 'gradient' | 'solid' | 'image';
|
|
236
|
+
type PrivacyCenterSignInChannels = 'both' | 'email' | 'sms';
|
|
237
|
+
type PrivacyCenterSection = Readonly<{
|
|
238
|
+
key: PrivacyCenterSectionKey;
|
|
239
|
+
/** `null` uses the built-in, translated label. */
|
|
240
|
+
label: string | null;
|
|
241
|
+
enabled: boolean;
|
|
242
|
+
}>;
|
|
243
|
+
type PrivacyCenterRequestType = Readonly<{
|
|
244
|
+
key: PrivacyCenterRequestTypeKey;
|
|
245
|
+
/** `null` uses the built-in, translated label. */
|
|
246
|
+
label: string | null;
|
|
247
|
+
enabled: boolean;
|
|
248
|
+
}>;
|
|
249
|
+
type PrivacyCenterFooterLink = Readonly<{
|
|
250
|
+
label: string;
|
|
251
|
+
url: string;
|
|
252
|
+
}>;
|
|
253
|
+
type PrivacyCenterBrandingSettings = Readonly<{
|
|
254
|
+
inherit_identity: boolean;
|
|
255
|
+
display_name: string | null;
|
|
256
|
+
logo_url: string | null;
|
|
257
|
+
/** 28–96 px; `null` keeps the built-in size. */
|
|
258
|
+
logo_height: number | null;
|
|
259
|
+
inherit_colors: boolean;
|
|
260
|
+
primary_color: string | null;
|
|
261
|
+
accent_color: string | null;
|
|
262
|
+
inherit_font: boolean;
|
|
263
|
+
font_family: string | null;
|
|
264
|
+
style: PrivacyCenterTheme;
|
|
265
|
+
/** 0–24 px; `null` keeps the built-in radii. */
|
|
266
|
+
corner_radius: number | null;
|
|
267
|
+
}>;
|
|
268
|
+
type PrivacyCenterSignInSettings = Readonly<{
|
|
269
|
+
layout: PrivacyCenterSignInLayout;
|
|
270
|
+
align: PrivacyCenterSignInAlign;
|
|
271
|
+
background_type: PrivacyCenterSignInBackground;
|
|
272
|
+
background_from: string;
|
|
273
|
+
background_to: string;
|
|
274
|
+
background_color: string;
|
|
275
|
+
background_image_url: string | null;
|
|
276
|
+
highlights: readonly string[];
|
|
277
|
+
show_logo: boolean;
|
|
278
|
+
title: string;
|
|
279
|
+
tagline: string | null;
|
|
280
|
+
heading: string;
|
|
281
|
+
description: string | null;
|
|
282
|
+
channels: PrivacyCenterSignInChannels;
|
|
283
|
+
default_country_code: string;
|
|
284
|
+
field_label: string | null;
|
|
285
|
+
placeholder: string | null;
|
|
286
|
+
help_text: string | null;
|
|
287
|
+
button_text: string;
|
|
288
|
+
show_notice_line: boolean;
|
|
289
|
+
notice_line: string | null;
|
|
290
|
+
show_support_link: boolean;
|
|
291
|
+
support_text: string;
|
|
292
|
+
support_link_text: string;
|
|
293
|
+
otp_heading: string;
|
|
294
|
+
otp_description: string | null;
|
|
295
|
+
otp_button_text: string;
|
|
296
|
+
otp_resend_text: string;
|
|
297
|
+
}>;
|
|
298
|
+
type PrivacyCenterPortalSettings = Readonly<{
|
|
299
|
+
sections: readonly PrivacyCenterSection[];
|
|
300
|
+
welcome_enabled: boolean;
|
|
301
|
+
welcome_title: string;
|
|
302
|
+
welcome_message: string;
|
|
303
|
+
request_types: readonly PrivacyCenterRequestType[];
|
|
304
|
+
grievance_categories: readonly PrivacyCenterGrievanceCategory[];
|
|
305
|
+
/** `null` asks the data principal, as today. */
|
|
306
|
+
revoke_consents_on_erasure: boolean | null;
|
|
307
|
+
/** `null` uses the built-in warning; a purpose's own message still wins. */
|
|
308
|
+
withdraw_warning: string | null;
|
|
309
|
+
/** `null` never signs out for inactivity. */
|
|
310
|
+
session_timeout_minutes: number | null;
|
|
311
|
+
}>;
|
|
312
|
+
type PrivacyCenterLanguageSettings = Readonly<{
|
|
313
|
+
enabled: readonly string[];
|
|
314
|
+
default: string;
|
|
315
|
+
auto_detect: boolean;
|
|
316
|
+
show_switcher: boolean;
|
|
317
|
+
}>;
|
|
318
|
+
type PrivacyCenterFooterSettings = Readonly<{
|
|
319
|
+
links: readonly PrivacyCenterFooterLink[];
|
|
320
|
+
show_privacy_policy: boolean;
|
|
321
|
+
show_contact: boolean;
|
|
322
|
+
copyright: string | null;
|
|
323
|
+
show_powered_by: boolean;
|
|
324
|
+
}>;
|
|
325
|
+
type PrivacyCenterSeoSettings = Readonly<{
|
|
326
|
+
page_title: string;
|
|
327
|
+
noindex: boolean;
|
|
328
|
+
}>;
|
|
329
|
+
type PrivacyCenterEmbedSettings = Readonly<{
|
|
330
|
+
allowed_origins: readonly string[];
|
|
331
|
+
}>;
|
|
332
|
+
/**
|
|
333
|
+
* The full Privacy Center settings, as published from the Redacto console and
|
|
334
|
+
* served by the public settings endpoint, with every field filled in.
|
|
335
|
+
*/
|
|
336
|
+
type ResolvedPrivacyCenterSettings = Readonly<{
|
|
337
|
+
schema_version: number;
|
|
338
|
+
branding: PrivacyCenterBrandingSettings;
|
|
339
|
+
sign_in: PrivacyCenterSignInSettings;
|
|
340
|
+
portal: PrivacyCenterPortalSettings;
|
|
341
|
+
languages: PrivacyCenterLanguageSettings;
|
|
342
|
+
footer: PrivacyCenterFooterSettings;
|
|
343
|
+
seo: PrivacyCenterSeoSettings;
|
|
344
|
+
custom_css: string | null;
|
|
345
|
+
embed: PrivacyCenterEmbedSettings;
|
|
346
|
+
}>;
|
|
347
|
+
/**
|
|
348
|
+
* Host overrides for `RedactoPrivacyCenter`'s `settings` prop. Each group is
|
|
349
|
+
* merged field by field over the published settings, so a host can change one
|
|
350
|
+
* value and keep the rest of what the console published.
|
|
351
|
+
*/
|
|
352
|
+
type PrivacyCenterSettings = Readonly<{
|
|
353
|
+
/**
|
|
354
|
+
* Visual style, kept as an alias for `branding.style`. `"classic"` (the
|
|
355
|
+
* default) is the standard look; `"glass"` is a frosted, sheet-based style.
|
|
356
|
+
* An unrecognised value falls back to classic.
|
|
357
|
+
*/
|
|
358
|
+
theme?: PrivacyCenterTheme;
|
|
359
|
+
branding?: Partial<PrivacyCenterBrandingSettings>;
|
|
360
|
+
sign_in?: Partial<PrivacyCenterSignInSettings>;
|
|
361
|
+
portal?: Partial<PrivacyCenterPortalSettings>;
|
|
362
|
+
languages?: Partial<PrivacyCenterLanguageSettings>;
|
|
363
|
+
footer?: Partial<PrivacyCenterFooterSettings>;
|
|
364
|
+
seo?: Partial<PrivacyCenterSeoSettings>;
|
|
365
|
+
custom_css?: string | null;
|
|
366
|
+
}>;
|
|
367
|
+
/**
|
|
368
|
+
* Brand Identity details the public settings carry only when the published
|
|
369
|
+
* settings use them (a `{legal}` placeholder, the footer's privacy policy or
|
|
370
|
+
* contact lines). Each is null otherwise.
|
|
371
|
+
*/
|
|
372
|
+
type PrivacyCenterBrandContact = Readonly<{
|
|
373
|
+
legal_entity_name: string | null;
|
|
374
|
+
privacy_policy_url: string | null;
|
|
375
|
+
grievance_email: string | null;
|
|
376
|
+
grievance_url: string | null;
|
|
377
|
+
dp_board_url: string | null;
|
|
378
|
+
}>;
|
|
379
|
+
/** `detail` of `GET /public/organisations/{org}/privacy-center-settings/`. */
|
|
380
|
+
type PublicPrivacyCenterSettingsResponse = Readonly<{
|
|
381
|
+
settings: unknown;
|
|
382
|
+
version: number;
|
|
383
|
+
published_at: string | null;
|
|
384
|
+
language: string;
|
|
385
|
+
/** Absent on servers that predate it. */
|
|
386
|
+
brand_contact?: unknown;
|
|
387
|
+
}>;
|
|
388
|
+
/** Values the `{brand}`-style tokens in custom copy resolve to. */
|
|
389
|
+
type PlaceholderContext = Readonly<{
|
|
390
|
+
brand: string;
|
|
391
|
+
legal?: string | null;
|
|
392
|
+
year?: number;
|
|
393
|
+
contact?: string | null;
|
|
394
|
+
name?: string | null;
|
|
395
|
+
}>;
|
|
396
|
+
|
|
221
397
|
type InternalPage = 'consent-manager' | 'form' | 'activity' | 'case-details' | 'notifications' | 'receipts';
|
|
222
398
|
interface NavigationContextType {
|
|
223
399
|
currentPage: InternalPage;
|
|
@@ -310,6 +486,7 @@ type FormData = {
|
|
|
310
486
|
purposes: RawPurposeWrapper[];
|
|
311
487
|
direct_groups?: FormProductGroup[];
|
|
312
488
|
nominated_groups?: FormProductGroup[];
|
|
489
|
+
enabled_request_types?: string[] | null;
|
|
313
490
|
};
|
|
314
491
|
type FormDataResponse = {
|
|
315
492
|
code: number;
|
|
@@ -675,19 +852,66 @@ type SelectPrincipalResponse = Readonly<{
|
|
|
675
852
|
refresh_token: string;
|
|
676
853
|
expires_at?: string;
|
|
677
854
|
}>;
|
|
678
|
-
/**
|
|
679
|
-
type
|
|
680
|
-
/**
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
855
|
+
/** Passed to `onReady` once the first screen is on show. */
|
|
856
|
+
type PrivacyCenterReadyEvent = Readonly<{
|
|
857
|
+
/** False when the built-in sign-in screen is what the visitor sees. */
|
|
858
|
+
signedIn: boolean;
|
|
859
|
+
}>;
|
|
860
|
+
/** Passed to `onConsentChange` after a consent was changed successfully. */
|
|
861
|
+
type PrivacyCenterConsentChange = Readonly<{
|
|
862
|
+
/** `revoke` withdraws consent; `regrant` and `renew` give it again. */
|
|
863
|
+
action: ConsentAction;
|
|
864
|
+
purposeUuid: string;
|
|
865
|
+
productUuid: string | null;
|
|
866
|
+
/** The data elements the change covered; empty when it covered the whole purpose. */
|
|
867
|
+
dataElementUuids: readonly string[];
|
|
868
|
+
/** Set when the visitor acted on behalf of someone who nominated them. */
|
|
869
|
+
nominatorUuid: string | null;
|
|
870
|
+
}>;
|
|
871
|
+
/** Passed to `onRequestSubmit` after a data request (case) was created. */
|
|
872
|
+
type PrivacyCenterRequestSubmission = Readonly<{
|
|
873
|
+
/** The human-readable case id shown to the visitor. */
|
|
874
|
+
caseId: string;
|
|
875
|
+
caseUuid: string;
|
|
876
|
+
requestType: PrivacyCenterRequestTypeKey;
|
|
877
|
+
/** The product the request is about; null for nomination and grievance. */
|
|
878
|
+
productUuid: string | null;
|
|
879
|
+
}>;
|
|
880
|
+
/**
|
|
881
|
+
* Why the visitor was signed out: they chose to (`user`), they were idle for
|
|
882
|
+
* the configured session timeout (`timeout`), or their session could no longer
|
|
883
|
+
* be refreshed (`session-expired`).
|
|
884
|
+
*/
|
|
885
|
+
type PrivacyCenterSignOutReason = 'user' | 'timeout' | 'session-expired';
|
|
886
|
+
type PrivacyCenterSignOutEvent = Readonly<{
|
|
887
|
+
reason: PrivacyCenterSignOutReason;
|
|
888
|
+
}>;
|
|
889
|
+
type PrivacyCenterEventHandlers = Readonly<{
|
|
890
|
+
onReady?: (event: PrivacyCenterReadyEvent) => void;
|
|
891
|
+
onConsentChange?: (change: PrivacyCenterConsentChange) => void;
|
|
892
|
+
onRequestSubmit?: (request: PrivacyCenterRequestSubmission) => void;
|
|
893
|
+
onSignOut?: (event: PrivacyCenterSignOutEvent) => void;
|
|
686
894
|
}>;
|
|
687
895
|
type RedactoPrivacyCenterProps = Readonly<{
|
|
896
|
+
/**
|
|
897
|
+
* API host, e.g. https://api.redacto.io (recommended). The consent server
|
|
898
|
+
* URL (…/consent) still works but is deprecated.
|
|
899
|
+
*/
|
|
688
900
|
baseUrl: string;
|
|
901
|
+
/**
|
|
902
|
+
* @deprecated Read only when `baseUrl` is the consent server URL
|
|
903
|
+
* (`…/consent`) or omitted, as in earlier releases. Ignored when `baseUrl`
|
|
904
|
+
* is the API host. With the consent server URL, it is the ledger that serves
|
|
905
|
+
* user-consents; omit it there to use the legacy Python privacy-center
|
|
906
|
+
* consent endpoints.
|
|
907
|
+
*/
|
|
689
908
|
ledgerBaseUrl?: string;
|
|
690
|
-
|
|
909
|
+
/**
|
|
910
|
+
* @deprecated Ignored; will be removed in a future major release. Passing it
|
|
911
|
+
* logs a one-time warning. The organisation comes from the access token, or
|
|
912
|
+
* from `organisationUuid` and `workspaceUuid`.
|
|
913
|
+
*/
|
|
914
|
+
slug?: string;
|
|
691
915
|
/** JWT access token. Optional so sandbox mode (see `token`) can omit it. */
|
|
692
916
|
accessToken?: string;
|
|
693
917
|
/** JWT refresh token. Optional; used by the OTP-refresh loop in the JWT flow. */
|
|
@@ -709,19 +933,47 @@ type RedactoPrivacyCenterProps = Readonly<{
|
|
|
709
933
|
* customer code; optional third identifier alongside email/mobile.
|
|
710
934
|
*/
|
|
711
935
|
ucic?: string;
|
|
712
|
-
/**
|
|
936
|
+
/**
|
|
937
|
+
* Organisation UUID. Replaces the JWT-decoded org in sandbox mode; without a
|
|
938
|
+
* token it also addresses the built-in sign-in, the published settings and
|
|
939
|
+
* the branding.
|
|
940
|
+
*/
|
|
713
941
|
organisationUuid?: string;
|
|
714
|
-
/**
|
|
942
|
+
/**
|
|
943
|
+
* Workspace UUID. Replaces the JWT-decoded workspace in sandbox mode; without
|
|
944
|
+
* a token it addresses the built-in sign-in, which needs it with `organisationUuid`.
|
|
945
|
+
*/
|
|
715
946
|
workspaceUuid?: string;
|
|
716
947
|
onError: (error: Error) => boolean;
|
|
717
948
|
initialPage?: InternalPage;
|
|
718
949
|
onBack?: 'back' | 'signout';
|
|
719
|
-
/**
|
|
950
|
+
/**
|
|
951
|
+
* Overrides for the settings published from the Redacto console, merged
|
|
952
|
+
* field by field over them per group; see `PrivacyCenterSettings`.
|
|
953
|
+
*/
|
|
720
954
|
settings?: PrivacyCenterSettings;
|
|
955
|
+
/**
|
|
956
|
+
* With no token, show the built-in OTP sign-in screen. Off by default: with
|
|
957
|
+
* no token the Privacy Center keeps its loading state until the host passes
|
|
958
|
+
* one, so a token that arrives a moment late never flashes a sign-in.
|
|
959
|
+
*/
|
|
960
|
+
builtInSignIn?: boolean;
|
|
961
|
+
/** Called once, when the first screen (sign-in or the Privacy Center) is on show. */
|
|
962
|
+
onReady?: (event: PrivacyCenterReadyEvent) => void;
|
|
963
|
+
/** Called after the visitor withdrew, re-granted or renewed a consent. */
|
|
964
|
+
onConsentChange?: (change: PrivacyCenterConsentChange) => void;
|
|
965
|
+
/** Called after the visitor submitted a data request. */
|
|
966
|
+
onRequestSubmit?: (request: PrivacyCenterRequestSubmission) => void;
|
|
967
|
+
/** Called when the visitor is signed out, with the reason. */
|
|
968
|
+
onSignOut?: (event: PrivacyCenterSignOutEvent) => void;
|
|
721
969
|
}>;
|
|
722
970
|
type PrivacyCenterLayoutProps = Readonly<{
|
|
723
971
|
children: ReactNode;
|
|
724
|
-
|
|
972
|
+
/**
|
|
973
|
+
* @deprecated Ignored; will be removed in a future major release. Passing it
|
|
974
|
+
* logs a one-time warning. The organisation comes from the access token.
|
|
975
|
+
*/
|
|
976
|
+
slug?: string;
|
|
725
977
|
onBack?: 'back' | 'signout';
|
|
726
978
|
/**
|
|
727
979
|
* For custom compositions that render this layout directly. Omit it to
|
|
@@ -730,7 +982,7 @@ type PrivacyCenterLayoutProps = Readonly<{
|
|
|
730
982
|
settings?: PrivacyCenterSettings;
|
|
731
983
|
}>;
|
|
732
984
|
|
|
733
|
-
declare function RedactoPrivacyCenter({ baseUrl, ledgerBaseUrl, slug, accessToken, refreshToken, token, email, mobile, ucic, organisationUuid, workspaceUuid, onError, initialPage, onBack, settings, }: RedactoPrivacyCenterProps): React.JSX.Element;
|
|
985
|
+
declare function RedactoPrivacyCenter({ baseUrl, ledgerBaseUrl, slug, accessToken, refreshToken, token, email, mobile, ucic, organisationUuid, workspaceUuid, onError, initialPage, onBack, settings, builtInSignIn, onReady, onConsentChange, onRequestSubmit, onSignOut, }: RedactoPrivacyCenterProps): React.JSX.Element;
|
|
734
986
|
|
|
735
987
|
declare function PrivacyCenterLayout({ settings, ...props }: PrivacyCenterLayoutProps): React.JSX.Element;
|
|
736
988
|
|
|
@@ -767,7 +1019,7 @@ type AuthProviderProps = Readonly<{
|
|
|
767
1019
|
organisationUuid?: string;
|
|
768
1020
|
/** Sandbox workspace UUID (replaces the JWT-decoded workspace). */
|
|
769
1021
|
workspaceUuid?: string;
|
|
770
|
-
/**
|
|
1022
|
+
/** @deprecated Ignored; will be removed in a future major release. */
|
|
771
1023
|
slug?: string;
|
|
772
1024
|
onError: (error: Error) => boolean;
|
|
773
1025
|
}>;
|
|
@@ -777,22 +1029,40 @@ type AuthContextValue = Readonly<{
|
|
|
777
1029
|
onError: (error: Error) => boolean;
|
|
778
1030
|
updateTokens: (accessToken: string, refreshToken?: string) => void;
|
|
779
1031
|
sessionExpired: boolean;
|
|
1032
|
+
/** Signs the visitor out (e.g. after inactivity) and shows the session-expired screen. */
|
|
1033
|
+
expireSession: (reason: PrivacyCenterSignOutReason) => void;
|
|
1034
|
+
/** Drops the session so the built-in sign-in screen shows again. */
|
|
1035
|
+
restartSignIn: () => void;
|
|
780
1036
|
}>;
|
|
781
1037
|
type BaseUrlContextValue = Readonly<{
|
|
1038
|
+
/** The consent server URL: `{apiHost}/consent` when given the API host, else `baseUrl` as passed. */
|
|
782
1039
|
baseUrl: string;
|
|
1040
|
+
/** The ledger URL: `{apiHost}/consent-ledger` when given the API host, else `ledgerBaseUrl` as passed. */
|
|
783
1041
|
ledgerBaseUrl?: string;
|
|
784
1042
|
consentClient: ReturnType<typeof createConsentClient>;
|
|
1043
|
+
/** The API host, when `baseUrl` was passed as one; undefined for the deprecated consent server URL. */
|
|
1044
|
+
apiHost?: string;
|
|
785
1045
|
}>;
|
|
786
1046
|
|
|
787
1047
|
declare const BaseUrlProvider: ({ children, baseUrl, ledgerBaseUrl, }: {
|
|
788
1048
|
children: ReactNode;
|
|
1049
|
+
/**
|
|
1050
|
+
* API host, e.g. https://api.redacto.io (recommended). The consent server
|
|
1051
|
+
* URL (…/consent) still works but is deprecated.
|
|
1052
|
+
*/
|
|
789
1053
|
baseUrl: string;
|
|
1054
|
+
/**
|
|
1055
|
+
* @deprecated Read only when `baseUrl` is the consent server URL
|
|
1056
|
+
* (`…/consent`) or omitted, as in earlier releases. Ignored when `baseUrl`
|
|
1057
|
+
* is the API host.
|
|
1058
|
+
*/
|
|
790
1059
|
ledgerBaseUrl?: string;
|
|
791
1060
|
}) => React.JSX.Element;
|
|
792
1061
|
declare const useBaseUrl: () => Readonly<{
|
|
793
1062
|
baseUrl: string;
|
|
794
1063
|
ledgerBaseUrl?: string;
|
|
795
1064
|
consentClient: ReturnType<typeof createConsentClient>;
|
|
1065
|
+
apiHost?: string;
|
|
796
1066
|
}>;
|
|
797
1067
|
|
|
798
1068
|
declare function createOtpServer(email: string, organizationId: string, workspaceId: string, consentClient?: ReturnType<typeof createConsentClient>): Promise<OtpResponse>;
|
|
@@ -829,25 +1099,26 @@ declare const isJwtExpired: (token: string, bufferSeconds?: number) => boolean;
|
|
|
829
1099
|
/**
|
|
830
1100
|
* Check if user is authenticated in privacy center
|
|
831
1101
|
* User is considered authenticated if both access_token and email exist in sessionStorage
|
|
1102
|
+
* @deprecated The slug is ignored; the parameter will be removed in a future major release.
|
|
832
1103
|
*/
|
|
833
|
-
declare const isUserAuthenticated: (
|
|
1104
|
+
declare const isUserAuthenticated: (_expectedSlug?: string) => boolean;
|
|
834
1105
|
/**
|
|
835
1106
|
* Get initial state for sign-in form visibility
|
|
836
1107
|
* Returns true if window is undefined (SSR) or user is not authenticated
|
|
837
|
-
* @param slug - The organization slug to check authentication against
|
|
838
1108
|
* @returns true if sign-in form should be shown, false otherwise
|
|
1109
|
+
* @deprecated The slug is ignored; the parameter will be removed in a future major release.
|
|
839
1110
|
*/
|
|
840
|
-
declare const getInitialState: (
|
|
1111
|
+
declare const getInitialState: (_slug?: string) => boolean;
|
|
841
1112
|
/**
|
|
842
1113
|
* Check authentication status and attempt token refresh if needed
|
|
843
1114
|
* This function checks if the user is authenticated, validates JWT expiration,
|
|
844
1115
|
* and attempts to refresh using the refresh token cookie if the token is expired or missing.
|
|
845
|
-
* @param
|
|
1116
|
+
* @param _expectedSlug - Deprecated and ignored: the session is scoped by `organizationId`.
|
|
846
1117
|
* @param organizationId - Optional organization ID (will be read from sessionStorage if not provided)
|
|
847
1118
|
* @param workspaceId - Optional workspace ID (will be read from sessionStorage if not provided)
|
|
848
1119
|
* @returns Promise<boolean> - true if authenticated with valid non-expired token, false otherwise
|
|
849
1120
|
*/
|
|
850
|
-
declare const checkAndRefreshAuth: (
|
|
1121
|
+
declare const checkAndRefreshAuth: (_expectedSlug: string, organizationId?: string, workspaceId?: string, consentClient?: BaseUrlContextValue["consentClient"]) => Promise<boolean>;
|
|
851
1122
|
/**
|
|
852
1123
|
* Compare two email addresses (case-insensitive, handles URL encoding)
|
|
853
1124
|
* @param email1 - First email (can be URL-encoded)
|
|
@@ -868,11 +1139,11 @@ declare const signOutPrivacyCenter: () => void;
|
|
|
868
1139
|
*
|
|
869
1140
|
* @param organizationId - The organization UUID
|
|
870
1141
|
* @param workspaceId - The workspace UUID
|
|
871
|
-
* @param
|
|
1142
|
+
* @param _slug - Ignored; kept for call-site compatibility
|
|
872
1143
|
* @param authContext - Optional auth context values (accessToken, refreshToken, onError, updateTokens)
|
|
873
1144
|
* @returns Promise<string | null> - Valid access token or null if auth failed
|
|
874
1145
|
*/
|
|
875
|
-
declare const ensureValidToken: (organizationId?: string, workspaceId?: string,
|
|
1146
|
+
declare const ensureValidToken: (organizationId?: string, workspaceId?: string, _slug?: string, authContext?: {
|
|
876
1147
|
accessToken?: string;
|
|
877
1148
|
refreshToken?: string;
|
|
878
1149
|
onError?: (error: Error) => boolean;
|
|
@@ -976,4 +1247,61 @@ declare const useAuth: () => AuthContextValue;
|
|
|
976
1247
|
*/
|
|
977
1248
|
declare const injectPCStyles: () => void;
|
|
978
1249
|
|
|
979
|
-
|
|
1250
|
+
/**
|
|
1251
|
+
* Reproduces today's Privacy Center: with nothing published, every value here
|
|
1252
|
+
* renders exactly what the SDK rendered before settings existed.
|
|
1253
|
+
*/
|
|
1254
|
+
declare const DEFAULT_PRIVACY_CENTER_SETTINGS: ResolvedPrivacyCenterSettings;
|
|
1255
|
+
|
|
1256
|
+
/**
|
|
1257
|
+
* The settings the Privacy Center renders with: the published payload (or
|
|
1258
|
+
* nothing, when none was fetched) validated field by field, with the host's
|
|
1259
|
+
* `settings` prop merged over each group. Anything missing or malformed takes
|
|
1260
|
+
* the default, so a bad payload can never break the page or change it from
|
|
1261
|
+
* today's look by accident.
|
|
1262
|
+
*/
|
|
1263
|
+
declare const resolvePrivacyCenterSettings: (published: unknown, overrides?: PrivacyCenterSettings | null) => ResolvedPrivacyCenterSettings;
|
|
1264
|
+
|
|
1265
|
+
/**
|
|
1266
|
+
* Fills `{brand}`, `{legal}`, `{year}`, `{contact}` and `{name}` in custom
|
|
1267
|
+
* copy. `{legal}` falls back to the brand, and an empty value (no name known)
|
|
1268
|
+
* collapses cleanly: "Welcome back, {name}!" reads "Welcome back!".
|
|
1269
|
+
*/
|
|
1270
|
+
declare const resolvePlaceholders: (text: string | null | undefined, context: PlaceholderContext) => string;
|
|
1271
|
+
|
|
1272
|
+
/**
|
|
1273
|
+
* The organisation's published Privacy Center settings, localised to
|
|
1274
|
+
* `language`. Public and unauthenticated. Resolves to `null` on any failure
|
|
1275
|
+
* (network, 4xx/5xx, an unexpected body) so callers keep today's defaults;
|
|
1276
|
+
* never rejects. One request per organisation and language is shared for
|
|
1277
|
+
* `SETTINGS_CACHE_TTL_MS`, so a later mount or language switch picks up a new
|
|
1278
|
+
* publish; a failed one is forgotten so the next mount retries.
|
|
1279
|
+
*/
|
|
1280
|
+
declare const fetchPublicPrivacyCenterSettings: (baseUrl: string, organisationUuid: string, language: string) => Promise<PublicPrivacyCenterSettingsResponse | null>;
|
|
1281
|
+
|
|
1282
|
+
declare const PRIVACY_CENTER_PARTS: readonly ["topbar", "nav", "nav-item", "welcome", "consent-card", "request-form", "button-primary", "footer", "signin-card"];
|
|
1283
|
+
type PrivacyCenterPart = (typeof PRIVACY_CENTER_PARTS)[number];
|
|
1284
|
+
|
|
1285
|
+
/** The resolved settings; the defaults outside a `RedactoPrivacyCenter`. */
|
|
1286
|
+
declare const usePrivacyCenterSettings: () => ResolvedPrivacyCenterSettings;
|
|
1287
|
+
|
|
1288
|
+
type PrivacyCenterSettingsProviderProps = Readonly<{
|
|
1289
|
+
children: ReactNode;
|
|
1290
|
+
baseUrl: string;
|
|
1291
|
+
/** @deprecated Ignored; will be removed in a future major release. */
|
|
1292
|
+
slug?: string;
|
|
1293
|
+
accessToken?: string;
|
|
1294
|
+
organisationUuid?: string;
|
|
1295
|
+
workspaceUuid?: string;
|
|
1296
|
+
overrides?: PrivacyCenterSettings;
|
|
1297
|
+
builtInSignIn?: boolean;
|
|
1298
|
+
}>;
|
|
1299
|
+
/**
|
|
1300
|
+
* Fetches the organisation's published Privacy Center settings and refetches
|
|
1301
|
+
* them in the visitor's language. Rendering never waits: children get the
|
|
1302
|
+
* defaults (which reproduce the Privacy Center as it was before settings)
|
|
1303
|
+
* until the published copy arrives, and keep them when the fetch fails.
|
|
1304
|
+
*/
|
|
1305
|
+
declare const PrivacyCenterSettingsProvider: ({ children, baseUrl, accessToken, organisationUuid, workspaceUuid, overrides, builtInSignIn, }: PrivacyCenterSettingsProviderProps) => React.JSX.Element;
|
|
1306
|
+
|
|
1307
|
+
export { type Activity, type ActivityBadgeStatus$1 as ActivityBadgeStatus, type ActivityDetail, type ActivityResponse, type ApiFetchOptions, type ApiResponse, type AuthContext, AuthProvider, type BaseRequest, BaseUrlProvider, type CaseHistoryDetail, type CaseHistoryResponse, type CaseRequest, type ConsentAction, type ConsentDataElement, type ConsentGroup, type ConsentHistoryStatusSummary, type ConsentModalRecord, ConsentStatusEnum, type CreateCaseResponse, DEFAULT_PRIVACY_CENTER_SETTINGS, type DataElement, type DisplayPurposeRow, type FetchOrgParams, type FormData, type FormDataResponse, type GrievanceOptions, type GrievanceTypeElement, GrievanceTypeEnum, type GrievanceValue, type GroupPurposesOut, type InternalPage, type ManageConsentParams, type ManageConsentResponse, NavigationProvider, type NominationData, type NominatorInfo, NotificationsPage, type OrganizationDetail, type OrganizationResponse, type OtpResponse, type OtpVerificationResponse, PRIVACY_CENTER_PARTS, type Pagination, type PaginationMeta, type PlaceholderContext, PrivacyCenterActivityPage, type PrivacyCenterBrandContact, type PrivacyCenterBrandingSettings, PrivacyCenterCaseDetailsPage, type PrivacyCenterConsentChange, PrivacyCenterConsentManagerPage, type PrivacyCenterEmbedSettings, type PrivacyCenterEventHandlers, type PrivacyCenterFooterLink, type PrivacyCenterFooterSettings, PrivacyCenterFormPage, type PrivacyCenterGrievanceCategory, PrivacyCenterHomePage, type PrivacyCenterLanguageSettings, PrivacyCenterLayout, type PrivacyCenterPart, type PrivacyCenterPortalSettings, type PrivacyCenterReadyEvent, type PrivacyCenterRequestSubmission, type PrivacyCenterRequestType, type PrivacyCenterRequestTypeKey, type PrivacyCenterSection, type PrivacyCenterSectionKey, type PrivacyCenterSeoSettings, type PrivacyCenterSettings, PrivacyCenterSettingsProvider, type PrivacyCenterSignInChannels, type PrivacyCenterSignInLayout, type PrivacyCenterSignInSettings, type PrivacyCenterSignOutEvent, type PrivacyCenterSignOutReason, PrivacyCenterTheme, type PublicPrivacyCenterSettingsResponse, type Purpose, type PurposeItem, type RawPurposeWrapper, RedactoPrivacyCenter, type RedactoPrivacyCenterProps, RequestTypeEnum, type ResolvedPrivacyCenterSettings, type TokenExchangeResponse, type UpdateCorrectionDataItem, type UpdatePurpose, type UpdateRequestDetails, type UserConsentDetail, type UserConsentResponse, type UserDataRequest, type Workspace, checkAndRefreshAuth, compareEmails, createCaseRequest, createConsentClient, createOtpServer as createOtp, decodeJwtToken, ensureValidToken, exchangeTokenServer as exchangeToken, fetchActivities, fetchCaseHistory, fetchGroupPurposes, fetchProducts, fetchPublicPrivacyCenterSettings, fetchUserConsents, formatActivityType, getActivityTypeStatus, getCookieValue, getFormData, getInitialState, injectPCStyles, isJwtExpired, isUserAuthenticated, manageConsent, resolvePlaceholders, resolvePrivacyCenterSettings, setRefreshTokenCookie, signOutPrivacyCenter, useAuth, useBaseUrl, useCaseHistory, useInternalNavigation, usePrivacyCenterSettings, verifyOtpServer as verifyOtp };
|