@redacto.io/consent-sdk-react 10.4.0-beta.1 → 11.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -30
- package/dist/{chunk-DGMUTOWJ.mjs → chunk-W45JQYDG.mjs} +65 -1
- package/dist/index.d.mts +39 -5
- package/dist/index.d.ts +39 -5
- package/dist/index.js +418 -293
- package/dist/index.mjs +77 -14
- package/dist/privacy-center.d.mts +67 -22
- package/dist/privacy-center.d.ts +67 -22
- package/dist/privacy-center.js +726 -701
- package/dist/privacy-center.mjs +175 -211
- package/dist/{types-Bwtzvz4W.d.mts → types-B8qroG0j.d.mts} +2 -0
- package/dist/{types-Bwtzvz4W.d.ts → types-B8qroG0j.d.ts} +2 -0
- package/package.json +1 -1
package/dist/privacy-center.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { P as PrivacyCenterTheme } from './types-
|
|
3
|
+
import { P as PrivacyCenterTheme } from './types-B8qroG0j.js';
|
|
4
4
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -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
|
/**
|
|
@@ -244,12 +250,15 @@ type PrivacyCenterFooterLink = Readonly<{
|
|
|
244
250
|
label: string;
|
|
245
251
|
url: string;
|
|
246
252
|
}>;
|
|
253
|
+
type PrivacyCenterLogoAlign = 'auto' | 'left' | 'center' | 'right';
|
|
247
254
|
type PrivacyCenterBrandingSettings = Readonly<{
|
|
248
255
|
inherit_identity: boolean;
|
|
249
256
|
display_name: string | null;
|
|
250
257
|
logo_url: string | null;
|
|
251
258
|
/** 28–96 px; `null` keeps the built-in size. */
|
|
252
259
|
logo_height: number | null;
|
|
260
|
+
/** `"auto"` keeps the logo on the leading edge of the top bar. */
|
|
261
|
+
logo_align: PrivacyCenterLogoAlign;
|
|
253
262
|
inherit_colors: boolean;
|
|
254
263
|
primary_color: string | null;
|
|
255
264
|
accent_color: string | null;
|
|
@@ -887,9 +896,25 @@ type PrivacyCenterEventHandlers = Readonly<{
|
|
|
887
896
|
onSignOut?: (event: PrivacyCenterSignOutEvent) => void;
|
|
888
897
|
}>;
|
|
889
898
|
type RedactoPrivacyCenterProps = Readonly<{
|
|
899
|
+
/**
|
|
900
|
+
* API host, e.g. https://api.redacto.io (recommended). The consent server
|
|
901
|
+
* URL (…/consent) still works but is deprecated.
|
|
902
|
+
*/
|
|
890
903
|
baseUrl: string;
|
|
904
|
+
/**
|
|
905
|
+
* @deprecated Read only when `baseUrl` is the consent server URL
|
|
906
|
+
* (`…/consent`) or omitted, as in earlier releases. Ignored when `baseUrl`
|
|
907
|
+
* is the API host. With the consent server URL, it is the ledger that serves
|
|
908
|
+
* user-consents; omit it there to use the legacy Python privacy-center
|
|
909
|
+
* consent endpoints.
|
|
910
|
+
*/
|
|
891
911
|
ledgerBaseUrl?: string;
|
|
892
|
-
|
|
912
|
+
/**
|
|
913
|
+
* @deprecated Ignored; will be removed in a future major release. Passing it
|
|
914
|
+
* logs a one-time warning. The organisation comes from the access token, or
|
|
915
|
+
* from `organisationUuid` and `workspaceUuid`.
|
|
916
|
+
*/
|
|
917
|
+
slug?: string;
|
|
893
918
|
/** JWT access token. Optional so sandbox mode (see `token`) can omit it. */
|
|
894
919
|
accessToken?: string;
|
|
895
920
|
/** JWT refresh token. Optional; used by the OTP-refresh loop in the JWT flow. */
|
|
@@ -913,13 +938,13 @@ type RedactoPrivacyCenterProps = Readonly<{
|
|
|
913
938
|
ucic?: string;
|
|
914
939
|
/**
|
|
915
940
|
* Organisation UUID. Replaces the JWT-decoded org in sandbox mode; without a
|
|
916
|
-
* token it also addresses the built-in sign-in
|
|
917
|
-
*
|
|
941
|
+
* token it also addresses the built-in sign-in, the published settings and
|
|
942
|
+
* the branding.
|
|
918
943
|
*/
|
|
919
944
|
organisationUuid?: string;
|
|
920
945
|
/**
|
|
921
946
|
* Workspace UUID. Replaces the JWT-decoded workspace in sandbox mode; without
|
|
922
|
-
* a token it addresses the built-in sign-in
|
|
947
|
+
* a token it addresses the built-in sign-in, which needs it with `organisationUuid`.
|
|
923
948
|
*/
|
|
924
949
|
workspaceUuid?: string;
|
|
925
950
|
onError: (error: Error) => boolean;
|
|
@@ -947,7 +972,11 @@ type RedactoPrivacyCenterProps = Readonly<{
|
|
|
947
972
|
}>;
|
|
948
973
|
type PrivacyCenterLayoutProps = Readonly<{
|
|
949
974
|
children: ReactNode;
|
|
950
|
-
|
|
975
|
+
/**
|
|
976
|
+
* @deprecated Ignored; will be removed in a future major release. Passing it
|
|
977
|
+
* logs a one-time warning. The organisation comes from the access token.
|
|
978
|
+
*/
|
|
979
|
+
slug?: string;
|
|
951
980
|
onBack?: 'back' | 'signout';
|
|
952
981
|
/**
|
|
953
982
|
* For custom compositions that render this layout directly. Omit it to
|
|
@@ -993,7 +1022,7 @@ type AuthProviderProps = Readonly<{
|
|
|
993
1022
|
organisationUuid?: string;
|
|
994
1023
|
/** Sandbox workspace UUID (replaces the JWT-decoded workspace). */
|
|
995
1024
|
workspaceUuid?: string;
|
|
996
|
-
/**
|
|
1025
|
+
/** @deprecated Ignored; will be removed in a future major release. */
|
|
997
1026
|
slug?: string;
|
|
998
1027
|
onError: (error: Error) => boolean;
|
|
999
1028
|
}>;
|
|
@@ -1009,20 +1038,34 @@ type AuthContextValue = Readonly<{
|
|
|
1009
1038
|
restartSignIn: () => void;
|
|
1010
1039
|
}>;
|
|
1011
1040
|
type BaseUrlContextValue = Readonly<{
|
|
1041
|
+
/** The consent server URL: `{apiHost}/consent` when given the API host, else `baseUrl` as passed. */
|
|
1012
1042
|
baseUrl: string;
|
|
1043
|
+
/** The ledger URL: `{apiHost}/consent-ledger` when given the API host, else `ledgerBaseUrl` as passed. */
|
|
1013
1044
|
ledgerBaseUrl?: string;
|
|
1014
1045
|
consentClient: ReturnType<typeof createConsentClient>;
|
|
1046
|
+
/** The API host, when `baseUrl` was passed as one; undefined for the deprecated consent server URL. */
|
|
1047
|
+
apiHost?: string;
|
|
1015
1048
|
}>;
|
|
1016
1049
|
|
|
1017
1050
|
declare const BaseUrlProvider: ({ children, baseUrl, ledgerBaseUrl, }: {
|
|
1018
1051
|
children: ReactNode;
|
|
1052
|
+
/**
|
|
1053
|
+
* API host, e.g. https://api.redacto.io (recommended). The consent server
|
|
1054
|
+
* URL (…/consent) still works but is deprecated.
|
|
1055
|
+
*/
|
|
1019
1056
|
baseUrl: string;
|
|
1057
|
+
/**
|
|
1058
|
+
* @deprecated Read only when `baseUrl` is the consent server URL
|
|
1059
|
+
* (`…/consent`) or omitted, as in earlier releases. Ignored when `baseUrl`
|
|
1060
|
+
* is the API host.
|
|
1061
|
+
*/
|
|
1020
1062
|
ledgerBaseUrl?: string;
|
|
1021
1063
|
}) => React.JSX.Element;
|
|
1022
1064
|
declare const useBaseUrl: () => Readonly<{
|
|
1023
1065
|
baseUrl: string;
|
|
1024
1066
|
ledgerBaseUrl?: string;
|
|
1025
1067
|
consentClient: ReturnType<typeof createConsentClient>;
|
|
1068
|
+
apiHost?: string;
|
|
1026
1069
|
}>;
|
|
1027
1070
|
|
|
1028
1071
|
declare function createOtpServer(email: string, organizationId: string, workspaceId: string, consentClient?: ReturnType<typeof createConsentClient>): Promise<OtpResponse>;
|
|
@@ -1059,25 +1102,26 @@ declare const isJwtExpired: (token: string, bufferSeconds?: number) => boolean;
|
|
|
1059
1102
|
/**
|
|
1060
1103
|
* Check if user is authenticated in privacy center
|
|
1061
1104
|
* User is considered authenticated if both access_token and email exist in sessionStorage
|
|
1105
|
+
* @deprecated The slug is ignored; the parameter will be removed in a future major release.
|
|
1062
1106
|
*/
|
|
1063
|
-
declare const isUserAuthenticated: (
|
|
1107
|
+
declare const isUserAuthenticated: (_expectedSlug?: string) => boolean;
|
|
1064
1108
|
/**
|
|
1065
1109
|
* Get initial state for sign-in form visibility
|
|
1066
1110
|
* Returns true if window is undefined (SSR) or user is not authenticated
|
|
1067
|
-
* @param slug - The organization slug to check authentication against
|
|
1068
1111
|
* @returns true if sign-in form should be shown, false otherwise
|
|
1112
|
+
* @deprecated The slug is ignored; the parameter will be removed in a future major release.
|
|
1069
1113
|
*/
|
|
1070
|
-
declare const getInitialState: (
|
|
1114
|
+
declare const getInitialState: (_slug?: string) => boolean;
|
|
1071
1115
|
/**
|
|
1072
1116
|
* Check authentication status and attempt token refresh if needed
|
|
1073
1117
|
* This function checks if the user is authenticated, validates JWT expiration,
|
|
1074
1118
|
* and attempts to refresh using the refresh token cookie if the token is expired or missing.
|
|
1075
|
-
* @param
|
|
1119
|
+
* @param _expectedSlug - Deprecated and ignored: the session is scoped by `organizationId`.
|
|
1076
1120
|
* @param organizationId - Optional organization ID (will be read from sessionStorage if not provided)
|
|
1077
1121
|
* @param workspaceId - Optional workspace ID (will be read from sessionStorage if not provided)
|
|
1078
1122
|
* @returns Promise<boolean> - true if authenticated with valid non-expired token, false otherwise
|
|
1079
1123
|
*/
|
|
1080
|
-
declare const checkAndRefreshAuth: (
|
|
1124
|
+
declare const checkAndRefreshAuth: (_expectedSlug: string, organizationId?: string, workspaceId?: string, consentClient?: BaseUrlContextValue["consentClient"]) => Promise<boolean>;
|
|
1081
1125
|
/**
|
|
1082
1126
|
* Compare two email addresses (case-insensitive, handles URL encoding)
|
|
1083
1127
|
* @param email1 - First email (can be URL-encoded)
|
|
@@ -1098,11 +1142,11 @@ declare const signOutPrivacyCenter: () => void;
|
|
|
1098
1142
|
*
|
|
1099
1143
|
* @param organizationId - The organization UUID
|
|
1100
1144
|
* @param workspaceId - The workspace UUID
|
|
1101
|
-
* @param
|
|
1145
|
+
* @param _slug - Ignored; kept for call-site compatibility
|
|
1102
1146
|
* @param authContext - Optional auth context values (accessToken, refreshToken, onError, updateTokens)
|
|
1103
1147
|
* @returns Promise<string | null> - Valid access token or null if auth failed
|
|
1104
1148
|
*/
|
|
1105
|
-
declare const ensureValidToken: (organizationId?: string, workspaceId?: string,
|
|
1149
|
+
declare const ensureValidToken: (organizationId?: string, workspaceId?: string, _slug?: string, authContext?: {
|
|
1106
1150
|
accessToken?: string;
|
|
1107
1151
|
refreshToken?: string;
|
|
1108
1152
|
onError?: (error: Error) => boolean;
|
|
@@ -1247,7 +1291,8 @@ declare const usePrivacyCenterSettings: () => ResolvedPrivacyCenterSettings;
|
|
|
1247
1291
|
type PrivacyCenterSettingsProviderProps = Readonly<{
|
|
1248
1292
|
children: ReactNode;
|
|
1249
1293
|
baseUrl: string;
|
|
1250
|
-
|
|
1294
|
+
/** @deprecated Ignored; will be removed in a future major release. */
|
|
1295
|
+
slug?: string;
|
|
1251
1296
|
accessToken?: string;
|
|
1252
1297
|
organisationUuid?: string;
|
|
1253
1298
|
workspaceUuid?: string;
|
|
@@ -1260,6 +1305,6 @@ type PrivacyCenterSettingsProviderProps = Readonly<{
|
|
|
1260
1305
|
* defaults (which reproduce the Privacy Center as it was before settings)
|
|
1261
1306
|
* until the published copy arrives, and keep them when the fetch fails.
|
|
1262
1307
|
*/
|
|
1263
|
-
declare const PrivacyCenterSettingsProvider: ({ children, baseUrl,
|
|
1308
|
+
declare const PrivacyCenterSettingsProvider: ({ children, baseUrl, accessToken, organisationUuid, workspaceUuid, overrides, builtInSignIn, }: PrivacyCenterSettingsProviderProps) => React.JSX.Element;
|
|
1264
1309
|
|
|
1265
1310
|
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 };
|