@redacto.io/consent-sdk-react 10.4.0-beta.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 +98 -30
- package/dist/{chunk-DGMUTOWJ.mjs → chunk-W45JQYDG.mjs} +65 -1
- package/dist/index.d.mts +38 -4
- package/dist/index.d.ts +38 -4
- package/dist/index.js +414 -293
- package/dist/index.mjs +73 -14
- package/dist/privacy-center.d.mts +63 -21
- package/dist/privacy-center.d.ts +63 -21
- package/dist/privacy-center.js +654 -655
- package/dist/privacy-center.mjs +103 -165
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -27,14 +27,16 @@ import {
|
|
|
27
27
|
opaqueOver,
|
|
28
28
|
paintableColor,
|
|
29
29
|
prefersReducedMotion,
|
|
30
|
+
resolveEndpoints,
|
|
30
31
|
resolveNoticeAppearance,
|
|
31
32
|
resolveNoticeLayout,
|
|
32
33
|
useIsomorphicLayoutEffect,
|
|
33
34
|
useMediaQuery,
|
|
35
|
+
useResolvedEndpoints,
|
|
34
36
|
withAlpha,
|
|
35
37
|
withColorScheme,
|
|
36
38
|
withIdempotencyKey
|
|
37
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-W45JQYDG.mjs";
|
|
38
40
|
import {
|
|
39
41
|
NOTICE_FONT_ROOT_PROPS,
|
|
40
42
|
REQUIRED_MARKER_ARIA_LABEL,
|
|
@@ -5437,8 +5439,8 @@ var NoticeConsentView = ({
|
|
|
5437
5439
|
ucic,
|
|
5438
5440
|
organisationUuid,
|
|
5439
5441
|
workspaceUuid,
|
|
5440
|
-
baseUrl,
|
|
5441
|
-
ledgerBaseUrl,
|
|
5442
|
+
baseUrl: baseUrlProp,
|
|
5443
|
+
ledgerBaseUrl: ledgerBaseUrlProp,
|
|
5442
5444
|
language = "en",
|
|
5443
5445
|
blockUI = true,
|
|
5444
5446
|
onAccept,
|
|
@@ -5460,6 +5462,10 @@ var NoticeConsentView = ({
|
|
|
5460
5462
|
forceColorScheme
|
|
5461
5463
|
}) => {
|
|
5462
5464
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L;
|
|
5465
|
+
const endpoints = useResolvedEndpoints(baseUrlProp, ledgerBaseUrlProp, {
|
|
5466
|
+
warn: !previewContent
|
|
5467
|
+
});
|
|
5468
|
+
const { baseUrl, ledgerBaseUrl } = endpoints;
|
|
5463
5469
|
const sandboxParams = useMemo3(
|
|
5464
5470
|
() => ({
|
|
5465
5471
|
token,
|
|
@@ -7479,7 +7485,7 @@ var NoticeConsentView = ({
|
|
|
7479
7485
|
const ttsAbortController = new AbortController();
|
|
7480
7486
|
fetchTTSAudioUrls({
|
|
7481
7487
|
accessToken,
|
|
7482
|
-
baseUrl,
|
|
7488
|
+
baseUrl: endpoints.mode === "host" ? ledgerBaseUrl : baseUrl,
|
|
7483
7489
|
ledgerBaseUrl,
|
|
7484
7490
|
noticeUuid: content.notice_uuid,
|
|
7485
7491
|
language: languageCode,
|
|
@@ -7504,6 +7510,7 @@ var NoticeConsentView = ({
|
|
|
7504
7510
|
sandboxParams,
|
|
7505
7511
|
baseUrl,
|
|
7506
7512
|
ledgerBaseUrl,
|
|
7513
|
+
endpoints.mode,
|
|
7507
7514
|
getLanguageCode
|
|
7508
7515
|
]);
|
|
7509
7516
|
const hostRadius = noticeSettings == null ? void 0 : noticeSettings.borderRadius;
|
|
@@ -9409,8 +9416,8 @@ var RedactoConsentInlineComponent = ({
|
|
|
9409
9416
|
workspace_uuid,
|
|
9410
9417
|
notice_uuid,
|
|
9411
9418
|
accessToken,
|
|
9412
|
-
baseUrl,
|
|
9413
|
-
ledgerBaseUrl,
|
|
9419
|
+
baseUrl: baseUrlProp,
|
|
9420
|
+
ledgerBaseUrl: ledgerBaseUrlProp,
|
|
9414
9421
|
language = "en",
|
|
9415
9422
|
onAccept,
|
|
9416
9423
|
onError,
|
|
@@ -9419,6 +9426,8 @@ var RedactoConsentInlineComponent = ({
|
|
|
9419
9426
|
applicationId
|
|
9420
9427
|
}) => {
|
|
9421
9428
|
var _a, _b, _c;
|
|
9429
|
+
const endpoints = useResolvedEndpoints(baseUrlProp, ledgerBaseUrlProp);
|
|
9430
|
+
const { baseUrl, ledgerBaseUrl } = endpoints;
|
|
9422
9431
|
const [content, setContent] = useState3(null);
|
|
9423
9432
|
const [isLoading, setIsLoading] = useState3(true);
|
|
9424
9433
|
const [isSubmitting, setIsSubmitting] = useState3(false);
|
|
@@ -9436,6 +9445,31 @@ var RedactoConsentInlineComponent = ({
|
|
|
9436
9445
|
const [awaitingConfirm, setAwaitingConfirm] = useState3(false);
|
|
9437
9446
|
const refusedSelectionRef = useRef4(null);
|
|
9438
9447
|
const confirmedSelectionRef = useRef4(null);
|
|
9448
|
+
const endpointsKey = JSON.stringify([endpoints.mode, baseUrl != null ? baseUrl : "", ledgerBaseUrl != null ? ledgerBaseUrl : ""]);
|
|
9449
|
+
const [loadedEndpointsKey, setLoadedEndpointsKey] = useState3(endpointsKey);
|
|
9450
|
+
if (loadedEndpointsKey !== endpointsKey) {
|
|
9451
|
+
setLoadedEndpointsKey(endpointsKey);
|
|
9452
|
+
setContent(null);
|
|
9453
|
+
setIsLoading(true);
|
|
9454
|
+
setFetchError(null);
|
|
9455
|
+
setErrorMessage(null);
|
|
9456
|
+
setHasAlreadyConsented(false);
|
|
9457
|
+
setIsCheckingConsent(Boolean(ledgerBaseUrl) && !applicationId);
|
|
9458
|
+
setIsSubmitting(false);
|
|
9459
|
+
setAwaitingConfirm(false);
|
|
9460
|
+
}
|
|
9461
|
+
const endpointsGenerationRef = useRef4(0);
|
|
9462
|
+
const committedEndpointsKeyRef = useRef4(endpointsKey);
|
|
9463
|
+
useIsomorphicLayoutEffect(() => {
|
|
9464
|
+
if (committedEndpointsKeyRef.current === endpointsKey) {
|
|
9465
|
+
return;
|
|
9466
|
+
}
|
|
9467
|
+
committedEndpointsKeyRef.current = endpointsKey;
|
|
9468
|
+
endpointsGenerationRef.current += 1;
|
|
9469
|
+
hasSubmittedRef.current = false;
|
|
9470
|
+
refusedSelectionRef.current = null;
|
|
9471
|
+
confirmedSelectionRef.current = null;
|
|
9472
|
+
}, [endpointsKey]);
|
|
9439
9473
|
useEffect7(() => {
|
|
9440
9474
|
injectSpinnerAnimation();
|
|
9441
9475
|
injectCheckboxStyles();
|
|
@@ -9555,12 +9589,13 @@ var RedactoConsentInlineComponent = ({
|
|
|
9555
9589
|
setFetchError(null);
|
|
9556
9590
|
setHasAlreadyConsented(false);
|
|
9557
9591
|
try {
|
|
9592
|
+
const noticeBaseUrl = endpoints.mode === "host" && accessToken && !applicationId ? ledgerBaseUrl : baseUrl;
|
|
9558
9593
|
const consentContentData = await fetchConsentContent2({
|
|
9559
9594
|
org_uuid,
|
|
9560
9595
|
workspace_uuid,
|
|
9561
9596
|
notice_uuid,
|
|
9562
9597
|
accessToken,
|
|
9563
|
-
baseUrl,
|
|
9598
|
+
baseUrl: noticeBaseUrl,
|
|
9564
9599
|
language,
|
|
9565
9600
|
specific_uuid: applicationId,
|
|
9566
9601
|
signal
|
|
@@ -9624,7 +9659,8 @@ var RedactoConsentInlineComponent = ({
|
|
|
9624
9659
|
notice_uuid,
|
|
9625
9660
|
language,
|
|
9626
9661
|
applicationId,
|
|
9627
|
-
accessToken
|
|
9662
|
+
accessToken,
|
|
9663
|
+
endpointsKey
|
|
9628
9664
|
]);
|
|
9629
9665
|
useEffect7(() => {
|
|
9630
9666
|
if (!ledgerBaseUrl || applicationId) {
|
|
@@ -9729,6 +9765,8 @@ var RedactoConsentInlineComponent = ({
|
|
|
9729
9765
|
setErrorMessage("Unable to submit consent. Please try again.");
|
|
9730
9766
|
throw new Error("Access token or content not available");
|
|
9731
9767
|
}
|
|
9768
|
+
const generation = endpointsGenerationRef.current;
|
|
9769
|
+
const isCurrent = () => endpointsGenerationRef.current === generation;
|
|
9732
9770
|
try {
|
|
9733
9771
|
setIsSubmitting(true);
|
|
9734
9772
|
setErrorMessage(null);
|
|
@@ -9764,16 +9802,24 @@ var RedactoConsentInlineComponent = ({
|
|
|
9764
9802
|
declined: false,
|
|
9765
9803
|
meta_data: applicationId ? { specific_uuid: applicationId } : void 0
|
|
9766
9804
|
});
|
|
9805
|
+
if (!isCurrent()) {
|
|
9806
|
+
return;
|
|
9807
|
+
}
|
|
9767
9808
|
onAccept == null ? void 0 : onAccept();
|
|
9768
9809
|
hasSubmittedRef.current = false;
|
|
9769
9810
|
} catch (error) {
|
|
9811
|
+
if (!isCurrent()) {
|
|
9812
|
+
return;
|
|
9813
|
+
}
|
|
9770
9814
|
const err = error;
|
|
9771
9815
|
const message = err.message || "Failed to submit consent. Please try again.";
|
|
9772
9816
|
setErrorMessage(message);
|
|
9773
9817
|
hasSubmittedRef.current = false;
|
|
9774
9818
|
throw error;
|
|
9775
9819
|
} finally {
|
|
9776
|
-
|
|
9820
|
+
if (isCurrent()) {
|
|
9821
|
+
setIsSubmitting(false);
|
|
9822
|
+
}
|
|
9777
9823
|
}
|
|
9778
9824
|
},
|
|
9779
9825
|
[
|
|
@@ -12716,13 +12762,17 @@ var RedactoNoticeAssisted = ({
|
|
|
12716
12762
|
organisationUuid,
|
|
12717
12763
|
workspaceUuid,
|
|
12718
12764
|
noticeUuid,
|
|
12719
|
-
baseUrl,
|
|
12720
|
-
ledgerBaseUrl,
|
|
12765
|
+
baseUrl: baseUrlProp,
|
|
12766
|
+
ledgerBaseUrl: ledgerBaseUrlProp,
|
|
12721
12767
|
onDecline,
|
|
12722
12768
|
onComplete,
|
|
12723
12769
|
settings
|
|
12724
12770
|
}) => {
|
|
12725
12771
|
var _a, _b, _c, _d;
|
|
12772
|
+
const { baseUrl, ledgerBaseUrl } = useResolvedEndpoints(
|
|
12773
|
+
baseUrlProp,
|
|
12774
|
+
ledgerBaseUrlProp
|
|
12775
|
+
);
|
|
12726
12776
|
const isMobile = useMediaQuery3("(max-width: 768px)");
|
|
12727
12777
|
const [content, setContent] = useState5(null);
|
|
12728
12778
|
const [isLoading, setIsLoading] = useState5(true);
|
|
@@ -14509,6 +14559,15 @@ var RedactoNoticePreview = ({
|
|
|
14509
14559
|
// src/RedactoNoticeConsent/components/DigiLockerCallback.tsx
|
|
14510
14560
|
import { useCallback as useCallback6, useEffect as useEffect10, useRef as useRef6, useState as useState6 } from "react";
|
|
14511
14561
|
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
14562
|
+
var sameOriginUrlOrRoot = (candidate) => {
|
|
14563
|
+
if (!candidate) return "/";
|
|
14564
|
+
try {
|
|
14565
|
+
const url = new URL(candidate, window.location.origin);
|
|
14566
|
+
return url.origin === window.location.origin ? url.href : "/";
|
|
14567
|
+
} catch {
|
|
14568
|
+
return "/";
|
|
14569
|
+
}
|
|
14570
|
+
};
|
|
14512
14571
|
var DigiLockerCallback = ({
|
|
14513
14572
|
accessToken: propAccessToken,
|
|
14514
14573
|
baseUrl,
|
|
@@ -14545,7 +14604,7 @@ var DigiLockerCallback = ({
|
|
|
14545
14604
|
flowState: verificationResult === "verified" ? "consent-form" : "error"
|
|
14546
14605
|
});
|
|
14547
14606
|
redirectTimeoutRef.current = setTimeout(() => {
|
|
14548
|
-
window.location.href = originalUrl;
|
|
14607
|
+
window.location.href = sameOriginUrlOrRoot(originalUrl);
|
|
14549
14608
|
}, 1500);
|
|
14550
14609
|
},
|
|
14551
14610
|
[]
|
|
@@ -14617,7 +14676,7 @@ var DigiLockerCallback = ({
|
|
|
14617
14676
|
return;
|
|
14618
14677
|
}
|
|
14619
14678
|
setMessage("Processing verification...");
|
|
14620
|
-
const apiBaseUrl = baseUrl || storedBaseUrl;
|
|
14679
|
+
const apiBaseUrl = resolveEndpoints(baseUrl || storedBaseUrl).baseUrl;
|
|
14621
14680
|
const response = await verifyGuardianStatus({
|
|
14622
14681
|
accessToken,
|
|
14623
14682
|
baseUrl: apiBaseUrl,
|
|
@@ -14778,7 +14837,7 @@ var DigiLockerCallback = ({
|
|
|
14778
14837
|
const persistedState = getConsentState();
|
|
14779
14838
|
if (persistedState == null ? void 0 : persistedState.originalUrl) {
|
|
14780
14839
|
clearConsentState();
|
|
14781
|
-
window.location.href = persistedState.originalUrl;
|
|
14840
|
+
window.location.href = sameOriginUrlOrRoot(persistedState.originalUrl);
|
|
14782
14841
|
} else {
|
|
14783
14842
|
window.location.href = "/";
|
|
14784
14843
|
}
|
|
@@ -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
|
/**
|
|
@@ -887,9 +893,25 @@ type PrivacyCenterEventHandlers = Readonly<{
|
|
|
887
893
|
onSignOut?: (event: PrivacyCenterSignOutEvent) => void;
|
|
888
894
|
}>;
|
|
889
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
|
+
*/
|
|
890
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
|
+
*/
|
|
891
908
|
ledgerBaseUrl?: string;
|
|
892
|
-
|
|
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;
|
|
893
915
|
/** JWT access token. Optional so sandbox mode (see `token`) can omit it. */
|
|
894
916
|
accessToken?: string;
|
|
895
917
|
/** JWT refresh token. Optional; used by the OTP-refresh loop in the JWT flow. */
|
|
@@ -913,13 +935,13 @@ type RedactoPrivacyCenterProps = Readonly<{
|
|
|
913
935
|
ucic?: string;
|
|
914
936
|
/**
|
|
915
937
|
* Organisation UUID. Replaces the JWT-decoded org in sandbox mode; without a
|
|
916
|
-
* token it also addresses the built-in sign-in
|
|
917
|
-
*
|
|
938
|
+
* token it also addresses the built-in sign-in, the published settings and
|
|
939
|
+
* the branding.
|
|
918
940
|
*/
|
|
919
941
|
organisationUuid?: string;
|
|
920
942
|
/**
|
|
921
943
|
* Workspace UUID. Replaces the JWT-decoded workspace in sandbox mode; without
|
|
922
|
-
* a token it addresses the built-in sign-in
|
|
944
|
+
* a token it addresses the built-in sign-in, which needs it with `organisationUuid`.
|
|
923
945
|
*/
|
|
924
946
|
workspaceUuid?: string;
|
|
925
947
|
onError: (error: Error) => boolean;
|
|
@@ -947,7 +969,11 @@ type RedactoPrivacyCenterProps = Readonly<{
|
|
|
947
969
|
}>;
|
|
948
970
|
type PrivacyCenterLayoutProps = Readonly<{
|
|
949
971
|
children: ReactNode;
|
|
950
|
-
|
|
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;
|
|
951
977
|
onBack?: 'back' | 'signout';
|
|
952
978
|
/**
|
|
953
979
|
* For custom compositions that render this layout directly. Omit it to
|
|
@@ -993,7 +1019,7 @@ type AuthProviderProps = Readonly<{
|
|
|
993
1019
|
organisationUuid?: string;
|
|
994
1020
|
/** Sandbox workspace UUID (replaces the JWT-decoded workspace). */
|
|
995
1021
|
workspaceUuid?: string;
|
|
996
|
-
/**
|
|
1022
|
+
/** @deprecated Ignored; will be removed in a future major release. */
|
|
997
1023
|
slug?: string;
|
|
998
1024
|
onError: (error: Error) => boolean;
|
|
999
1025
|
}>;
|
|
@@ -1009,20 +1035,34 @@ type AuthContextValue = Readonly<{
|
|
|
1009
1035
|
restartSignIn: () => void;
|
|
1010
1036
|
}>;
|
|
1011
1037
|
type BaseUrlContextValue = Readonly<{
|
|
1038
|
+
/** The consent server URL: `{apiHost}/consent` when given the API host, else `baseUrl` as passed. */
|
|
1012
1039
|
baseUrl: string;
|
|
1040
|
+
/** The ledger URL: `{apiHost}/consent-ledger` when given the API host, else `ledgerBaseUrl` as passed. */
|
|
1013
1041
|
ledgerBaseUrl?: string;
|
|
1014
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;
|
|
1015
1045
|
}>;
|
|
1016
1046
|
|
|
1017
1047
|
declare const BaseUrlProvider: ({ children, baseUrl, ledgerBaseUrl, }: {
|
|
1018
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
|
+
*/
|
|
1019
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
|
+
*/
|
|
1020
1059
|
ledgerBaseUrl?: string;
|
|
1021
1060
|
}) => React.JSX.Element;
|
|
1022
1061
|
declare const useBaseUrl: () => Readonly<{
|
|
1023
1062
|
baseUrl: string;
|
|
1024
1063
|
ledgerBaseUrl?: string;
|
|
1025
1064
|
consentClient: ReturnType<typeof createConsentClient>;
|
|
1065
|
+
apiHost?: string;
|
|
1026
1066
|
}>;
|
|
1027
1067
|
|
|
1028
1068
|
declare function createOtpServer(email: string, organizationId: string, workspaceId: string, consentClient?: ReturnType<typeof createConsentClient>): Promise<OtpResponse>;
|
|
@@ -1059,25 +1099,26 @@ declare const isJwtExpired: (token: string, bufferSeconds?: number) => boolean;
|
|
|
1059
1099
|
/**
|
|
1060
1100
|
* Check if user is authenticated in privacy center
|
|
1061
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.
|
|
1062
1103
|
*/
|
|
1063
|
-
declare const isUserAuthenticated: (
|
|
1104
|
+
declare const isUserAuthenticated: (_expectedSlug?: string) => boolean;
|
|
1064
1105
|
/**
|
|
1065
1106
|
* Get initial state for sign-in form visibility
|
|
1066
1107
|
* Returns true if window is undefined (SSR) or user is not authenticated
|
|
1067
|
-
* @param slug - The organization slug to check authentication against
|
|
1068
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.
|
|
1069
1110
|
*/
|
|
1070
|
-
declare const getInitialState: (
|
|
1111
|
+
declare const getInitialState: (_slug?: string) => boolean;
|
|
1071
1112
|
/**
|
|
1072
1113
|
* Check authentication status and attempt token refresh if needed
|
|
1073
1114
|
* This function checks if the user is authenticated, validates JWT expiration,
|
|
1074
1115
|
* and attempts to refresh using the refresh token cookie if the token is expired or missing.
|
|
1075
|
-
* @param
|
|
1116
|
+
* @param _expectedSlug - Deprecated and ignored: the session is scoped by `organizationId`.
|
|
1076
1117
|
* @param organizationId - Optional organization ID (will be read from sessionStorage if not provided)
|
|
1077
1118
|
* @param workspaceId - Optional workspace ID (will be read from sessionStorage if not provided)
|
|
1078
1119
|
* @returns Promise<boolean> - true if authenticated with valid non-expired token, false otherwise
|
|
1079
1120
|
*/
|
|
1080
|
-
declare const checkAndRefreshAuth: (
|
|
1121
|
+
declare const checkAndRefreshAuth: (_expectedSlug: string, organizationId?: string, workspaceId?: string, consentClient?: BaseUrlContextValue["consentClient"]) => Promise<boolean>;
|
|
1081
1122
|
/**
|
|
1082
1123
|
* Compare two email addresses (case-insensitive, handles URL encoding)
|
|
1083
1124
|
* @param email1 - First email (can be URL-encoded)
|
|
@@ -1098,11 +1139,11 @@ declare const signOutPrivacyCenter: () => void;
|
|
|
1098
1139
|
*
|
|
1099
1140
|
* @param organizationId - The organization UUID
|
|
1100
1141
|
* @param workspaceId - The workspace UUID
|
|
1101
|
-
* @param
|
|
1142
|
+
* @param _slug - Ignored; kept for call-site compatibility
|
|
1102
1143
|
* @param authContext - Optional auth context values (accessToken, refreshToken, onError, updateTokens)
|
|
1103
1144
|
* @returns Promise<string | null> - Valid access token or null if auth failed
|
|
1104
1145
|
*/
|
|
1105
|
-
declare const ensureValidToken: (organizationId?: string, workspaceId?: string,
|
|
1146
|
+
declare const ensureValidToken: (organizationId?: string, workspaceId?: string, _slug?: string, authContext?: {
|
|
1106
1147
|
accessToken?: string;
|
|
1107
1148
|
refreshToken?: string;
|
|
1108
1149
|
onError?: (error: Error) => boolean;
|
|
@@ -1247,7 +1288,8 @@ declare const usePrivacyCenterSettings: () => ResolvedPrivacyCenterSettings;
|
|
|
1247
1288
|
type PrivacyCenterSettingsProviderProps = Readonly<{
|
|
1248
1289
|
children: ReactNode;
|
|
1249
1290
|
baseUrl: string;
|
|
1250
|
-
|
|
1291
|
+
/** @deprecated Ignored; will be removed in a future major release. */
|
|
1292
|
+
slug?: string;
|
|
1251
1293
|
accessToken?: string;
|
|
1252
1294
|
organisationUuid?: string;
|
|
1253
1295
|
workspaceUuid?: string;
|
|
@@ -1260,6 +1302,6 @@ type PrivacyCenterSettingsProviderProps = Readonly<{
|
|
|
1260
1302
|
* defaults (which reproduce the Privacy Center as it was before settings)
|
|
1261
1303
|
* until the published copy arrives, and keep them when the fetch fails.
|
|
1262
1304
|
*/
|
|
1263
|
-
declare const PrivacyCenterSettingsProvider: ({ children, baseUrl,
|
|
1305
|
+
declare const PrivacyCenterSettingsProvider: ({ children, baseUrl, accessToken, organisationUuid, workspaceUuid, overrides, builtInSignIn, }: PrivacyCenterSettingsProviderProps) => React.JSX.Element;
|
|
1264
1306
|
|
|
1265
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 };
|
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
|
/**
|
|
@@ -887,9 +893,25 @@ type PrivacyCenterEventHandlers = Readonly<{
|
|
|
887
893
|
onSignOut?: (event: PrivacyCenterSignOutEvent) => void;
|
|
888
894
|
}>;
|
|
889
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
|
+
*/
|
|
890
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
|
+
*/
|
|
891
908
|
ledgerBaseUrl?: string;
|
|
892
|
-
|
|
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;
|
|
893
915
|
/** JWT access token. Optional so sandbox mode (see `token`) can omit it. */
|
|
894
916
|
accessToken?: string;
|
|
895
917
|
/** JWT refresh token. Optional; used by the OTP-refresh loop in the JWT flow. */
|
|
@@ -913,13 +935,13 @@ type RedactoPrivacyCenterProps = Readonly<{
|
|
|
913
935
|
ucic?: string;
|
|
914
936
|
/**
|
|
915
937
|
* Organisation UUID. Replaces the JWT-decoded org in sandbox mode; without a
|
|
916
|
-
* token it also addresses the built-in sign-in
|
|
917
|
-
*
|
|
938
|
+
* token it also addresses the built-in sign-in, the published settings and
|
|
939
|
+
* the branding.
|
|
918
940
|
*/
|
|
919
941
|
organisationUuid?: string;
|
|
920
942
|
/**
|
|
921
943
|
* Workspace UUID. Replaces the JWT-decoded workspace in sandbox mode; without
|
|
922
|
-
* a token it addresses the built-in sign-in
|
|
944
|
+
* a token it addresses the built-in sign-in, which needs it with `organisationUuid`.
|
|
923
945
|
*/
|
|
924
946
|
workspaceUuid?: string;
|
|
925
947
|
onError: (error: Error) => boolean;
|
|
@@ -947,7 +969,11 @@ type RedactoPrivacyCenterProps = Readonly<{
|
|
|
947
969
|
}>;
|
|
948
970
|
type PrivacyCenterLayoutProps = Readonly<{
|
|
949
971
|
children: ReactNode;
|
|
950
|
-
|
|
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;
|
|
951
977
|
onBack?: 'back' | 'signout';
|
|
952
978
|
/**
|
|
953
979
|
* For custom compositions that render this layout directly. Omit it to
|
|
@@ -993,7 +1019,7 @@ type AuthProviderProps = Readonly<{
|
|
|
993
1019
|
organisationUuid?: string;
|
|
994
1020
|
/** Sandbox workspace UUID (replaces the JWT-decoded workspace). */
|
|
995
1021
|
workspaceUuid?: string;
|
|
996
|
-
/**
|
|
1022
|
+
/** @deprecated Ignored; will be removed in a future major release. */
|
|
997
1023
|
slug?: string;
|
|
998
1024
|
onError: (error: Error) => boolean;
|
|
999
1025
|
}>;
|
|
@@ -1009,20 +1035,34 @@ type AuthContextValue = Readonly<{
|
|
|
1009
1035
|
restartSignIn: () => void;
|
|
1010
1036
|
}>;
|
|
1011
1037
|
type BaseUrlContextValue = Readonly<{
|
|
1038
|
+
/** The consent server URL: `{apiHost}/consent` when given the API host, else `baseUrl` as passed. */
|
|
1012
1039
|
baseUrl: string;
|
|
1040
|
+
/** The ledger URL: `{apiHost}/consent-ledger` when given the API host, else `ledgerBaseUrl` as passed. */
|
|
1013
1041
|
ledgerBaseUrl?: string;
|
|
1014
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;
|
|
1015
1045
|
}>;
|
|
1016
1046
|
|
|
1017
1047
|
declare const BaseUrlProvider: ({ children, baseUrl, ledgerBaseUrl, }: {
|
|
1018
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
|
+
*/
|
|
1019
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
|
+
*/
|
|
1020
1059
|
ledgerBaseUrl?: string;
|
|
1021
1060
|
}) => React.JSX.Element;
|
|
1022
1061
|
declare const useBaseUrl: () => Readonly<{
|
|
1023
1062
|
baseUrl: string;
|
|
1024
1063
|
ledgerBaseUrl?: string;
|
|
1025
1064
|
consentClient: ReturnType<typeof createConsentClient>;
|
|
1065
|
+
apiHost?: string;
|
|
1026
1066
|
}>;
|
|
1027
1067
|
|
|
1028
1068
|
declare function createOtpServer(email: string, organizationId: string, workspaceId: string, consentClient?: ReturnType<typeof createConsentClient>): Promise<OtpResponse>;
|
|
@@ -1059,25 +1099,26 @@ declare const isJwtExpired: (token: string, bufferSeconds?: number) => boolean;
|
|
|
1059
1099
|
/**
|
|
1060
1100
|
* Check if user is authenticated in privacy center
|
|
1061
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.
|
|
1062
1103
|
*/
|
|
1063
|
-
declare const isUserAuthenticated: (
|
|
1104
|
+
declare const isUserAuthenticated: (_expectedSlug?: string) => boolean;
|
|
1064
1105
|
/**
|
|
1065
1106
|
* Get initial state for sign-in form visibility
|
|
1066
1107
|
* Returns true if window is undefined (SSR) or user is not authenticated
|
|
1067
|
-
* @param slug - The organization slug to check authentication against
|
|
1068
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.
|
|
1069
1110
|
*/
|
|
1070
|
-
declare const getInitialState: (
|
|
1111
|
+
declare const getInitialState: (_slug?: string) => boolean;
|
|
1071
1112
|
/**
|
|
1072
1113
|
* Check authentication status and attempt token refresh if needed
|
|
1073
1114
|
* This function checks if the user is authenticated, validates JWT expiration,
|
|
1074
1115
|
* and attempts to refresh using the refresh token cookie if the token is expired or missing.
|
|
1075
|
-
* @param
|
|
1116
|
+
* @param _expectedSlug - Deprecated and ignored: the session is scoped by `organizationId`.
|
|
1076
1117
|
* @param organizationId - Optional organization ID (will be read from sessionStorage if not provided)
|
|
1077
1118
|
* @param workspaceId - Optional workspace ID (will be read from sessionStorage if not provided)
|
|
1078
1119
|
* @returns Promise<boolean> - true if authenticated with valid non-expired token, false otherwise
|
|
1079
1120
|
*/
|
|
1080
|
-
declare const checkAndRefreshAuth: (
|
|
1121
|
+
declare const checkAndRefreshAuth: (_expectedSlug: string, organizationId?: string, workspaceId?: string, consentClient?: BaseUrlContextValue["consentClient"]) => Promise<boolean>;
|
|
1081
1122
|
/**
|
|
1082
1123
|
* Compare two email addresses (case-insensitive, handles URL encoding)
|
|
1083
1124
|
* @param email1 - First email (can be URL-encoded)
|
|
@@ -1098,11 +1139,11 @@ declare const signOutPrivacyCenter: () => void;
|
|
|
1098
1139
|
*
|
|
1099
1140
|
* @param organizationId - The organization UUID
|
|
1100
1141
|
* @param workspaceId - The workspace UUID
|
|
1101
|
-
* @param
|
|
1142
|
+
* @param _slug - Ignored; kept for call-site compatibility
|
|
1102
1143
|
* @param authContext - Optional auth context values (accessToken, refreshToken, onError, updateTokens)
|
|
1103
1144
|
* @returns Promise<string | null> - Valid access token or null if auth failed
|
|
1104
1145
|
*/
|
|
1105
|
-
declare const ensureValidToken: (organizationId?: string, workspaceId?: string,
|
|
1146
|
+
declare const ensureValidToken: (organizationId?: string, workspaceId?: string, _slug?: string, authContext?: {
|
|
1106
1147
|
accessToken?: string;
|
|
1107
1148
|
refreshToken?: string;
|
|
1108
1149
|
onError?: (error: Error) => boolean;
|
|
@@ -1247,7 +1288,8 @@ declare const usePrivacyCenterSettings: () => ResolvedPrivacyCenterSettings;
|
|
|
1247
1288
|
type PrivacyCenterSettingsProviderProps = Readonly<{
|
|
1248
1289
|
children: ReactNode;
|
|
1249
1290
|
baseUrl: string;
|
|
1250
|
-
|
|
1291
|
+
/** @deprecated Ignored; will be removed in a future major release. */
|
|
1292
|
+
slug?: string;
|
|
1251
1293
|
accessToken?: string;
|
|
1252
1294
|
organisationUuid?: string;
|
|
1253
1295
|
workspaceUuid?: string;
|
|
@@ -1260,6 +1302,6 @@ type PrivacyCenterSettingsProviderProps = Readonly<{
|
|
|
1260
1302
|
* defaults (which reproduce the Privacy Center as it was before settings)
|
|
1261
1303
|
* until the published copy arrives, and keep them when the fetch fails.
|
|
1262
1304
|
*/
|
|
1263
|
-
declare const PrivacyCenterSettingsProvider: ({ children, baseUrl,
|
|
1305
|
+
declare const PrivacyCenterSettingsProvider: ({ children, baseUrl, accessToken, organisationUuid, workspaceUuid, overrides, builtInSignIn, }: PrivacyCenterSettingsProviderProps) => React.JSX.Element;
|
|
1264
1306
|
|
|
1265
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 };
|