@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/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,
|
|
@@ -5531,6 +5537,7 @@ var NoticeConsentView = ({
|
|
|
5531
5537
|
setCachedAppearance(readCachedAppearance(noticeId));
|
|
5532
5538
|
}, [noticeId]);
|
|
5533
5539
|
const servedAppearance = content ? content.appearance : cachedAppearance;
|
|
5540
|
+
const showsProductSection = (servedAppearance == null ? void 0 : servedAppearance.show_product_section) !== false;
|
|
5534
5541
|
const noticeAppearance = useNoticeAppearance(
|
|
5535
5542
|
servedAppearance,
|
|
5536
5543
|
settings,
|
|
@@ -6530,6 +6537,9 @@ var NoticeConsentView = ({
|
|
|
6530
6537
|
if (!products || products.length !== 1) {
|
|
6531
6538
|
return rows;
|
|
6532
6539
|
}
|
|
6540
|
+
if (!showsProductSection) {
|
|
6541
|
+
return rows;
|
|
6542
|
+
}
|
|
6533
6543
|
const product = products[0];
|
|
6534
6544
|
const purposes = (_a2 = content == null ? void 0 : content.purposes) != null ? _a2 : [];
|
|
6535
6545
|
const boxPurposes = productBoxPurposes(purposes);
|
|
@@ -7479,7 +7489,7 @@ var NoticeConsentView = ({
|
|
|
7479
7489
|
const ttsAbortController = new AbortController();
|
|
7480
7490
|
fetchTTSAudioUrls({
|
|
7481
7491
|
accessToken,
|
|
7482
|
-
baseUrl,
|
|
7492
|
+
baseUrl: endpoints.mode === "host" ? ledgerBaseUrl : baseUrl,
|
|
7483
7493
|
ledgerBaseUrl,
|
|
7484
7494
|
noticeUuid: content.notice_uuid,
|
|
7485
7495
|
language: languageCode,
|
|
@@ -7504,6 +7514,7 @@ var NoticeConsentView = ({
|
|
|
7504
7514
|
sandboxParams,
|
|
7505
7515
|
baseUrl,
|
|
7506
7516
|
ledgerBaseUrl,
|
|
7517
|
+
endpoints.mode,
|
|
7507
7518
|
getLanguageCode
|
|
7508
7519
|
]);
|
|
7509
7520
|
const hostRadius = noticeSettings == null ? void 0 : noticeSettings.borderRadius;
|
|
@@ -9409,8 +9420,8 @@ var RedactoConsentInlineComponent = ({
|
|
|
9409
9420
|
workspace_uuid,
|
|
9410
9421
|
notice_uuid,
|
|
9411
9422
|
accessToken,
|
|
9412
|
-
baseUrl,
|
|
9413
|
-
ledgerBaseUrl,
|
|
9423
|
+
baseUrl: baseUrlProp,
|
|
9424
|
+
ledgerBaseUrl: ledgerBaseUrlProp,
|
|
9414
9425
|
language = "en",
|
|
9415
9426
|
onAccept,
|
|
9416
9427
|
onError,
|
|
@@ -9419,6 +9430,8 @@ var RedactoConsentInlineComponent = ({
|
|
|
9419
9430
|
applicationId
|
|
9420
9431
|
}) => {
|
|
9421
9432
|
var _a, _b, _c;
|
|
9433
|
+
const endpoints = useResolvedEndpoints(baseUrlProp, ledgerBaseUrlProp);
|
|
9434
|
+
const { baseUrl, ledgerBaseUrl } = endpoints;
|
|
9422
9435
|
const [content, setContent] = useState3(null);
|
|
9423
9436
|
const [isLoading, setIsLoading] = useState3(true);
|
|
9424
9437
|
const [isSubmitting, setIsSubmitting] = useState3(false);
|
|
@@ -9436,6 +9449,31 @@ var RedactoConsentInlineComponent = ({
|
|
|
9436
9449
|
const [awaitingConfirm, setAwaitingConfirm] = useState3(false);
|
|
9437
9450
|
const refusedSelectionRef = useRef4(null);
|
|
9438
9451
|
const confirmedSelectionRef = useRef4(null);
|
|
9452
|
+
const endpointsKey = JSON.stringify([endpoints.mode, baseUrl != null ? baseUrl : "", ledgerBaseUrl != null ? ledgerBaseUrl : ""]);
|
|
9453
|
+
const [loadedEndpointsKey, setLoadedEndpointsKey] = useState3(endpointsKey);
|
|
9454
|
+
if (loadedEndpointsKey !== endpointsKey) {
|
|
9455
|
+
setLoadedEndpointsKey(endpointsKey);
|
|
9456
|
+
setContent(null);
|
|
9457
|
+
setIsLoading(true);
|
|
9458
|
+
setFetchError(null);
|
|
9459
|
+
setErrorMessage(null);
|
|
9460
|
+
setHasAlreadyConsented(false);
|
|
9461
|
+
setIsCheckingConsent(Boolean(ledgerBaseUrl) && !applicationId);
|
|
9462
|
+
setIsSubmitting(false);
|
|
9463
|
+
setAwaitingConfirm(false);
|
|
9464
|
+
}
|
|
9465
|
+
const endpointsGenerationRef = useRef4(0);
|
|
9466
|
+
const committedEndpointsKeyRef = useRef4(endpointsKey);
|
|
9467
|
+
useIsomorphicLayoutEffect(() => {
|
|
9468
|
+
if (committedEndpointsKeyRef.current === endpointsKey) {
|
|
9469
|
+
return;
|
|
9470
|
+
}
|
|
9471
|
+
committedEndpointsKeyRef.current = endpointsKey;
|
|
9472
|
+
endpointsGenerationRef.current += 1;
|
|
9473
|
+
hasSubmittedRef.current = false;
|
|
9474
|
+
refusedSelectionRef.current = null;
|
|
9475
|
+
confirmedSelectionRef.current = null;
|
|
9476
|
+
}, [endpointsKey]);
|
|
9439
9477
|
useEffect7(() => {
|
|
9440
9478
|
injectSpinnerAnimation();
|
|
9441
9479
|
injectCheckboxStyles();
|
|
@@ -9555,12 +9593,13 @@ var RedactoConsentInlineComponent = ({
|
|
|
9555
9593
|
setFetchError(null);
|
|
9556
9594
|
setHasAlreadyConsented(false);
|
|
9557
9595
|
try {
|
|
9596
|
+
const noticeBaseUrl = endpoints.mode === "host" && accessToken && !applicationId ? ledgerBaseUrl : baseUrl;
|
|
9558
9597
|
const consentContentData = await fetchConsentContent2({
|
|
9559
9598
|
org_uuid,
|
|
9560
9599
|
workspace_uuid,
|
|
9561
9600
|
notice_uuid,
|
|
9562
9601
|
accessToken,
|
|
9563
|
-
baseUrl,
|
|
9602
|
+
baseUrl: noticeBaseUrl,
|
|
9564
9603
|
language,
|
|
9565
9604
|
specific_uuid: applicationId,
|
|
9566
9605
|
signal
|
|
@@ -9624,7 +9663,8 @@ var RedactoConsentInlineComponent = ({
|
|
|
9624
9663
|
notice_uuid,
|
|
9625
9664
|
language,
|
|
9626
9665
|
applicationId,
|
|
9627
|
-
accessToken
|
|
9666
|
+
accessToken,
|
|
9667
|
+
endpointsKey
|
|
9628
9668
|
]);
|
|
9629
9669
|
useEffect7(() => {
|
|
9630
9670
|
if (!ledgerBaseUrl || applicationId) {
|
|
@@ -9729,6 +9769,8 @@ var RedactoConsentInlineComponent = ({
|
|
|
9729
9769
|
setErrorMessage("Unable to submit consent. Please try again.");
|
|
9730
9770
|
throw new Error("Access token or content not available");
|
|
9731
9771
|
}
|
|
9772
|
+
const generation = endpointsGenerationRef.current;
|
|
9773
|
+
const isCurrent = () => endpointsGenerationRef.current === generation;
|
|
9732
9774
|
try {
|
|
9733
9775
|
setIsSubmitting(true);
|
|
9734
9776
|
setErrorMessage(null);
|
|
@@ -9764,16 +9806,24 @@ var RedactoConsentInlineComponent = ({
|
|
|
9764
9806
|
declined: false,
|
|
9765
9807
|
meta_data: applicationId ? { specific_uuid: applicationId } : void 0
|
|
9766
9808
|
});
|
|
9809
|
+
if (!isCurrent()) {
|
|
9810
|
+
return;
|
|
9811
|
+
}
|
|
9767
9812
|
onAccept == null ? void 0 : onAccept();
|
|
9768
9813
|
hasSubmittedRef.current = false;
|
|
9769
9814
|
} catch (error) {
|
|
9815
|
+
if (!isCurrent()) {
|
|
9816
|
+
return;
|
|
9817
|
+
}
|
|
9770
9818
|
const err = error;
|
|
9771
9819
|
const message = err.message || "Failed to submit consent. Please try again.";
|
|
9772
9820
|
setErrorMessage(message);
|
|
9773
9821
|
hasSubmittedRef.current = false;
|
|
9774
9822
|
throw error;
|
|
9775
9823
|
} finally {
|
|
9776
|
-
|
|
9824
|
+
if (isCurrent()) {
|
|
9825
|
+
setIsSubmitting(false);
|
|
9826
|
+
}
|
|
9777
9827
|
}
|
|
9778
9828
|
},
|
|
9779
9829
|
[
|
|
@@ -12716,13 +12766,17 @@ var RedactoNoticeAssisted = ({
|
|
|
12716
12766
|
organisationUuid,
|
|
12717
12767
|
workspaceUuid,
|
|
12718
12768
|
noticeUuid,
|
|
12719
|
-
baseUrl,
|
|
12720
|
-
ledgerBaseUrl,
|
|
12769
|
+
baseUrl: baseUrlProp,
|
|
12770
|
+
ledgerBaseUrl: ledgerBaseUrlProp,
|
|
12721
12771
|
onDecline,
|
|
12722
12772
|
onComplete,
|
|
12723
12773
|
settings
|
|
12724
12774
|
}) => {
|
|
12725
12775
|
var _a, _b, _c, _d;
|
|
12776
|
+
const { baseUrl, ledgerBaseUrl } = useResolvedEndpoints(
|
|
12777
|
+
baseUrlProp,
|
|
12778
|
+
ledgerBaseUrlProp
|
|
12779
|
+
);
|
|
12726
12780
|
const isMobile = useMediaQuery3("(max-width: 768px)");
|
|
12727
12781
|
const [content, setContent] = useState5(null);
|
|
12728
12782
|
const [isLoading, setIsLoading] = useState5(true);
|
|
@@ -14509,6 +14563,15 @@ var RedactoNoticePreview = ({
|
|
|
14509
14563
|
// src/RedactoNoticeConsent/components/DigiLockerCallback.tsx
|
|
14510
14564
|
import { useCallback as useCallback6, useEffect as useEffect10, useRef as useRef6, useState as useState6 } from "react";
|
|
14511
14565
|
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
14566
|
+
var sameOriginUrlOrRoot = (candidate) => {
|
|
14567
|
+
if (!candidate) return "/";
|
|
14568
|
+
try {
|
|
14569
|
+
const url = new URL(candidate, window.location.origin);
|
|
14570
|
+
return url.origin === window.location.origin ? url.href : "/";
|
|
14571
|
+
} catch {
|
|
14572
|
+
return "/";
|
|
14573
|
+
}
|
|
14574
|
+
};
|
|
14512
14575
|
var DigiLockerCallback = ({
|
|
14513
14576
|
accessToken: propAccessToken,
|
|
14514
14577
|
baseUrl,
|
|
@@ -14545,7 +14608,7 @@ var DigiLockerCallback = ({
|
|
|
14545
14608
|
flowState: verificationResult === "verified" ? "consent-form" : "error"
|
|
14546
14609
|
});
|
|
14547
14610
|
redirectTimeoutRef.current = setTimeout(() => {
|
|
14548
|
-
window.location.href = originalUrl;
|
|
14611
|
+
window.location.href = sameOriginUrlOrRoot(originalUrl);
|
|
14549
14612
|
}, 1500);
|
|
14550
14613
|
},
|
|
14551
14614
|
[]
|
|
@@ -14617,7 +14680,7 @@ var DigiLockerCallback = ({
|
|
|
14617
14680
|
return;
|
|
14618
14681
|
}
|
|
14619
14682
|
setMessage("Processing verification...");
|
|
14620
|
-
const apiBaseUrl = baseUrl || storedBaseUrl;
|
|
14683
|
+
const apiBaseUrl = resolveEndpoints(baseUrl || storedBaseUrl).baseUrl;
|
|
14621
14684
|
const response = await verifyGuardianStatus({
|
|
14622
14685
|
accessToken,
|
|
14623
14686
|
baseUrl: apiBaseUrl,
|
|
@@ -14778,7 +14841,7 @@ var DigiLockerCallback = ({
|
|
|
14778
14841
|
const persistedState = getConsentState();
|
|
14779
14842
|
if (persistedState == null ? void 0 : persistedState.originalUrl) {
|
|
14780
14843
|
clearConsentState();
|
|
14781
|
-
window.location.href = persistedState.originalUrl;
|
|
14844
|
+
window.location.href = sameOriginUrlOrRoot(persistedState.originalUrl);
|
|
14782
14845
|
} else {
|
|
14783
14846
|
window.location.href = "/";
|
|
14784
14847
|
}
|
|
@@ -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.mjs';
|
|
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 };
|