@redacto.io/consent-sdk-react 10.0.0-beta.0 → 10.0.0-beta.11
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/.turbo/turbo-build.log +22 -25
- package/CHANGELOG.md +123 -0
- package/README.md +78 -0
- package/dist/{chunk-6A665OPR.mjs → chunk-OGL6OC3A.mjs} +4 -0
- package/dist/index.d.mts +43 -8
- package/dist/index.d.ts +43 -8
- package/dist/index.js +345 -237
- package/dist/index.mjs +344 -238
- package/dist/privacy-center.d.mts +113 -37
- package/dist/privacy-center.d.ts +113 -37
- package/dist/privacy-center.js +2317 -1910
- package/dist/privacy-center.mjs +2245 -1835
- package/package.json +1 -1
- package/src/RedactoNoticeAssisted/RedactoNoticeAssisted.test.tsx +87 -0
- package/src/RedactoNoticeAssisted/RedactoNoticeAssisted.tsx +27 -0
- package/src/RedactoNoticeAssisted/api/index.ts +7 -1
- package/src/RedactoNoticeAssisted/api/types.ts +2 -0
- package/src/RedactoNoticeAssisted/i18n.ts +0 -55
- package/src/RedactoNoticeAssisted/types.ts +2 -0
- package/src/RedactoNoticeConsent/RedactoNoticeConsent.test.tsx +42 -8
- package/src/RedactoNoticeConsent/RedactoNoticeConsent.tsx +75 -33
- package/src/RedactoNoticeConsent/api/index.ts +90 -177
- package/src/RedactoNoticeConsent/api/sandbox.ts +150 -0
- package/src/RedactoNoticeConsent/api/types.ts +60 -44
- package/src/RedactoNoticeConsent/language-codes.ts +0 -2
- package/src/RedactoNoticeConsent/types.ts +29 -3
- package/src/RedactoNoticeConsentInline/RedactoNoticeConsentInline.tsx +86 -5
- package/src/RedactoNoticeConsentInline/api/index.ts +14 -5
- package/src/RedactoNoticeConsentInline/api/notice-read-routing.test.ts +72 -0
- package/src/RedactoNoticeConsentInline/api/types.ts +4 -1
- package/src/RedactoNoticeConsentInline/types.ts +1 -1
- package/src/RedactoPrivacyCenter/PrivacyCenterLayout.tsx +8 -5
- package/src/RedactoPrivacyCenter/RedactoPrivacyCenter.tsx +38 -3
- package/src/RedactoPrivacyCenter/api/actions.ts +13 -5
- package/src/RedactoPrivacyCenter/api/client.ts +216 -39
- package/src/RedactoPrivacyCenter/api/fetcher.ts +24 -9
- package/src/RedactoPrivacyCenter/components/AppShell/AppShell.tsx +28 -0
- package/src/RedactoPrivacyCenter/components/AppShell/UserMenu.tsx +107 -76
- package/src/RedactoPrivacyCenter/components/ConsentManager.tsx +2 -1
- package/src/RedactoPrivacyCenter/components/Form.tsx +53 -24
- package/src/RedactoPrivacyCenter/components/ModifyConsentModal.tsx +1 -1
- package/src/RedactoPrivacyCenter/components/SelectUser.tsx +95 -0
- package/src/RedactoPrivacyCenter/components/SelectUserGate.tsx +195 -0
- package/src/RedactoPrivacyCenter/components/constant.ts +11 -0
- package/src/RedactoPrivacyCenter/components/groupHelpers.ts +42 -6
- package/src/RedactoPrivacyCenter/context/AuthContext.tsx +131 -39
- package/src/RedactoPrivacyCenter/context/BaseUrlContext.tsx +1 -1
- package/src/RedactoPrivacyCenter/context/ProfileSwitchContext.tsx +15 -0
- package/src/RedactoPrivacyCenter/context/types.ts +39 -1
- package/src/RedactoPrivacyCenter/lib/api.ts +3 -0
- package/src/RedactoPrivacyCenter/lib/constants.ts +12 -6
- package/src/RedactoPrivacyCenter/lib/locales.ts +0 -3
- package/src/RedactoPrivacyCenter/lib/sandbox.ts +104 -0
- package/src/RedactoPrivacyCenter/lib/types.ts +78 -2
- package/src/RedactoPrivacyCenter/lib/utils.ts +15 -0
- package/src/RedactoPrivacyCenter/locales/as/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/bn/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/brx/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/doi/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/en/translation.json +8 -1
- package/src/RedactoPrivacyCenter/locales/gom/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/gu/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/hi/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/kn/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/ks/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/mai/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/ml/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/mni-Mtei/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/mr/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/ne/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/or/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/pa/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/sa/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/sat/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/sd/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/ta/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/te/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/ur/translation.json +7 -1
- package/src/RedactoPrivacyCenter/styles/injectStyles.ts +112 -2
- package/src/RedactoPrivacyCenter/styles/pcStyles.ts +17 -0
- package/src/RedactoPrivacyCenter/ui/PCAvatar.test.tsx +83 -0
- package/src/RedactoPrivacyCenter/ui/PCAvatar.tsx +33 -9
- package/src/shared/notice-consent-status.ts +190 -0
- package/src/shared/sandbox.ts +6 -0
- package/tests/Form.test.tsx +190 -7
- package/tests/RevokeWarningMessage.test.tsx +151 -0
- package/tests/consentClient.test.ts +217 -0
- package/tests/manageConsentServer.test.ts +38 -0
- package/src/RedactoPrivacyCenter/locales/bho/translation.json +0 -334
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
4
4
|
|
|
@@ -33,9 +33,12 @@ type BaseRequest = {
|
|
|
33
33
|
* Creates a client instance with a specific base URL.
|
|
34
34
|
* @param baseUrl - Consent server base URL (Python service, e.g. http://host/consent)
|
|
35
35
|
* @param ledgerBaseUrl - Go ledger base URL (e.g. http://host:8090/consent-ledger).
|
|
36
|
-
* Used for user-consents reads
|
|
36
|
+
* Used for user-consents reads/writes served from the ledger's `/public/...` paths.
|
|
37
|
+
* When omitted, those calls fall back to the legacy Python
|
|
38
|
+
* `/dsar/privacy-center` endpoints and payloads (pre-ledger behavior), so
|
|
39
|
+
* integrations without a deployed ledger keep working.
|
|
37
40
|
*/
|
|
38
|
-
declare function createConsentClient(baseUrl: string, ledgerBaseUrl
|
|
41
|
+
declare function createConsentClient(baseUrl: string, ledgerBaseUrl?: string): {
|
|
39
42
|
/**
|
|
40
43
|
* Get form data (privacy center)
|
|
41
44
|
*/
|
|
@@ -96,23 +99,38 @@ declare function createConsentClient(baseUrl: string, ledgerBaseUrl: string): {
|
|
|
96
99
|
/**
|
|
97
100
|
* Manage consent (privacy center) - revoke, regrant, or renew.
|
|
98
101
|
*
|
|
99
|
-
* The Go ledger has no manage-consent route, so
|
|
100
|
-
* `partial` submit-consent on the ledger — mirroring
|
|
101
|
-
* relay (`build_consent_management_payload`): the
|
|
102
|
-
* re-submitted with `selected: false` to revoke or
|
|
103
|
-
* regrant/renew, and `partial: true` so the rest of the
|
|
104
|
-
* are left untouched. The principal is resolved from the
|
|
105
|
-
* `contact`/identifiers are sent in the body, and
|
|
106
|
-
* omitted so the ledger mints a fresh event.
|
|
102
|
+
* The Go ledger has no manage-consent route, so with a ledger configured
|
|
103
|
+
* this is expressed as a `partial` submit-consent on the ledger — mirroring
|
|
104
|
+
* the Python dual-write relay (`build_consent_management_payload`): the
|
|
105
|
+
* affected purpose is re-submitted with `selected: false` to revoke or
|
|
106
|
+
* `selected: true` to regrant/renew, and `partial: true` so the rest of the
|
|
107
|
+
* notice's purposes are left untouched. The principal is resolved from the
|
|
108
|
+
* JWT, so no `contact`/identifiers are sent in the body, and
|
|
109
|
+
* `consent_event_uuid` is omitted so the ledger mints a fresh event.
|
|
110
|
+
*
|
|
111
|
+
* Without a ledger, the legacy Python `/manage-consent?status=` endpoint is
|
|
112
|
+
* used with its `{ purpose_uuid, contact, ... }` payload.
|
|
107
113
|
*/
|
|
108
114
|
manageConsent(baseRequest: BaseRequest, purposeId: string, contact: string, status: "revoke" | "regrant" | "renew", authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">, nominatorContact?: string, dataElementUuids?: string[], productUuid?: string, noticeUuid?: string, dataElements?: Array<{
|
|
109
115
|
uuid: string;
|
|
110
116
|
selected: boolean;
|
|
111
|
-
}
|
|
117
|
+
}>, language?: string): Promise<unknown>;
|
|
112
118
|
/**
|
|
113
119
|
* Get activities (privacy center)
|
|
114
120
|
*/
|
|
115
121
|
getActivities(baseRequest: BaseRequest, offset?: number, limit?: number, language?: string, authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
|
|
122
|
+
/**
|
|
123
|
+
* List all data principals that share this session's contact
|
|
124
|
+
* (shared-contact profile picker). Identity is derived server-side from the
|
|
125
|
+
* JWT — the caller sends nothing but its bearer token.
|
|
126
|
+
*/
|
|
127
|
+
listIdentities(baseRequest: BaseRequest, authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<IdentityListResponse>;
|
|
128
|
+
/**
|
|
129
|
+
* Re-scope the session to a chosen principal uuid (must be one of the
|
|
130
|
+
* principals sharing this session's contact). Returns fresh access/refresh
|
|
131
|
+
* tokens scoped to that principal.
|
|
132
|
+
*/
|
|
133
|
+
selectPrincipal(baseRequest: BaseRequest, principalUuid: string, authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<SelectPrincipalResponse>;
|
|
116
134
|
/**
|
|
117
135
|
* Get receipts (privacy center) — consent receipts for the authenticated user
|
|
118
136
|
*/
|
|
@@ -364,6 +382,7 @@ type NominatorInfo = {
|
|
|
364
382
|
};
|
|
365
383
|
type PurposeItem = {
|
|
366
384
|
purpose_uuid: string;
|
|
385
|
+
uuid?: string;
|
|
367
386
|
name: string;
|
|
368
387
|
description: string | null;
|
|
369
388
|
status: ConsentStatusEnum | string;
|
|
@@ -372,6 +391,7 @@ type PurposeItem = {
|
|
|
372
391
|
method: string;
|
|
373
392
|
data_elements: ConsentDataElement[];
|
|
374
393
|
link_reason: string | null;
|
|
394
|
+
revoke_warning_message?: string | null;
|
|
375
395
|
notice_uuid: string | null;
|
|
376
396
|
};
|
|
377
397
|
type ConsentGroup = {
|
|
@@ -607,6 +627,21 @@ type NotificationQueryParams = {
|
|
|
607
627
|
include_summary?: boolean;
|
|
608
628
|
language?: string;
|
|
609
629
|
};
|
|
630
|
+
type IdentityCandidate = Readonly<{
|
|
631
|
+
uuid: string;
|
|
632
|
+
org_user_id?: string | null;
|
|
633
|
+
primary_email?: string | null;
|
|
634
|
+
primary_mobile?: string | null;
|
|
635
|
+
created_at?: string | null;
|
|
636
|
+
}>;
|
|
637
|
+
type IdentityListResponse = Readonly<{
|
|
638
|
+
identities: IdentityCandidate[];
|
|
639
|
+
}>;
|
|
640
|
+
type SelectPrincipalResponse = Readonly<{
|
|
641
|
+
token: string;
|
|
642
|
+
refresh_token: string;
|
|
643
|
+
expires_at?: string;
|
|
644
|
+
}>;
|
|
610
645
|
|
|
611
646
|
type InternalPage = 'consent-manager' | 'form' | 'activity' | 'case-details' | 'notifications' | 'receipts';
|
|
612
647
|
interface NavigationContextType {
|
|
@@ -619,40 +654,86 @@ interface NavigationContextType {
|
|
|
619
654
|
declare const NavigationProvider: ({ children, initialPage }: {
|
|
620
655
|
children: ReactNode;
|
|
621
656
|
initialPage?: InternalPage;
|
|
622
|
-
}) =>
|
|
657
|
+
}) => react.JSX.Element;
|
|
623
658
|
declare const useInternalNavigation: () => NavigationContextType;
|
|
624
659
|
|
|
625
660
|
interface RedactoPrivacyCenterProps {
|
|
626
661
|
baseUrl: string;
|
|
627
|
-
ledgerBaseUrl
|
|
662
|
+
ledgerBaseUrl?: string;
|
|
628
663
|
slug: string;
|
|
629
|
-
|
|
630
|
-
|
|
664
|
+
/** JWT access token. Optional so sandbox mode (see `token`) can omit it. */
|
|
665
|
+
accessToken?: string;
|
|
666
|
+
/** JWT refresh token. Optional; used by the OTP-refresh loop in the JWT flow. */
|
|
667
|
+
refreshToken?: string;
|
|
668
|
+
/**
|
|
669
|
+
* Sandbox PoC: a pasted static token. When set, the Privacy Center runs
|
|
670
|
+
* against the sandbox with no JWT — it sends the single `X-Consent-Token`
|
|
671
|
+
* header, carries the acting identity (`email` || `mobile`) in each request's
|
|
672
|
+
* own payload, takes org/workspace from `organisationUuid`/`workspaceUuid`,
|
|
673
|
+
* and never calls `/otp/refresh`.
|
|
674
|
+
*/
|
|
675
|
+
token?: string;
|
|
676
|
+
/** Sandbox test subject email (carried in the request payload when set). */
|
|
677
|
+
email?: string;
|
|
678
|
+
/** Sandbox test subject mobile (fallback subject when `email` is absent). */
|
|
679
|
+
mobile?: string;
|
|
680
|
+
/**
|
|
681
|
+
* Sandbox UCIC: the client's own user id / org_user_id, e.g. a UUID or
|
|
682
|
+
* customer code; optional third identifier alongside email/mobile.
|
|
683
|
+
*/
|
|
684
|
+
ucic?: string;
|
|
685
|
+
/** Sandbox org UUID (replaces the JWT-decoded org in sandbox mode). */
|
|
686
|
+
organisationUuid?: string;
|
|
687
|
+
/** Sandbox workspace UUID (replaces the JWT-decoded workspace in sandbox mode). */
|
|
688
|
+
workspaceUuid?: string;
|
|
631
689
|
onError: (error: Error) => boolean;
|
|
632
690
|
initialPage?: InternalPage;
|
|
633
691
|
onBack?: 'back' | 'signout';
|
|
634
692
|
}
|
|
635
|
-
declare function RedactoPrivacyCenter({ baseUrl, ledgerBaseUrl, slug, accessToken, refreshToken, onError, initialPage, onBack, }: RedactoPrivacyCenterProps):
|
|
693
|
+
declare function RedactoPrivacyCenter({ baseUrl, ledgerBaseUrl, slug, accessToken, refreshToken, token, email, mobile, ucic, organisationUuid, workspaceUuid, onError, initialPage, onBack, }: RedactoPrivacyCenterProps): react.JSX.Element;
|
|
636
694
|
|
|
637
695
|
interface PrivacyCenterLayoutProps {
|
|
638
696
|
children: ReactNode;
|
|
639
697
|
slug: string;
|
|
640
698
|
onBack?: 'back' | 'signout';
|
|
641
699
|
}
|
|
642
|
-
declare function PrivacyCenterLayout({ children, slug, onBack }: PrivacyCenterLayoutProps):
|
|
700
|
+
declare function PrivacyCenterLayout({ children, slug, onBack }: PrivacyCenterLayoutProps): react.JSX.Element;
|
|
643
701
|
|
|
644
|
-
declare function PrivacyCenterHomePage():
|
|
702
|
+
declare function PrivacyCenterHomePage(): react.JSX.Element;
|
|
645
703
|
|
|
646
|
-
declare function PrivacyCenterConsentManagerPage():
|
|
704
|
+
declare function PrivacyCenterConsentManagerPage(): react.JSX.Element;
|
|
647
705
|
|
|
648
|
-
declare function PrivacyCenterFormPage():
|
|
706
|
+
declare function PrivacyCenterFormPage(): react.JSX.Element;
|
|
649
707
|
|
|
650
|
-
declare function PrivacyCenterActivityPage():
|
|
708
|
+
declare function PrivacyCenterActivityPage(): react.JSX.Element;
|
|
651
709
|
|
|
652
|
-
declare const PrivacyCenterCaseDetailsPage: () =>
|
|
710
|
+
declare const PrivacyCenterCaseDetailsPage: () => react.JSX.Element | null;
|
|
653
711
|
|
|
654
|
-
declare const NotificationsPage: () =>
|
|
712
|
+
declare const NotificationsPage: () => react.JSX.Element;
|
|
655
713
|
|
|
714
|
+
type AuthProviderProps = Readonly<{
|
|
715
|
+
children: ReactNode;
|
|
716
|
+
accessToken?: string;
|
|
717
|
+
refreshToken?: string;
|
|
718
|
+
/**
|
|
719
|
+
* Sandbox PoC: when set, the Privacy Center skips the JWT entirely — it seeds
|
|
720
|
+
* org/workspace/subject from the props below, sends the single
|
|
721
|
+
* `X-Consent-Token` header, carries the acting identity in each request's own
|
|
722
|
+
* payload, and never calls `/otp/refresh`.
|
|
723
|
+
*/
|
|
724
|
+
token?: string;
|
|
725
|
+
/** Sandbox UCIC — the client's own user id (`org_user_id`); takes precedence over the subject. */
|
|
726
|
+
sandboxUcic?: string;
|
|
727
|
+
/** Sandbox subject (email or mobile) — carried in the request payload. */
|
|
728
|
+
sandboxSubject?: string;
|
|
729
|
+
/** Sandbox org UUID (replaces the JWT-decoded org). */
|
|
730
|
+
organisationUuid?: string;
|
|
731
|
+
/** Sandbox workspace UUID (replaces the JWT-decoded workspace). */
|
|
732
|
+
workspaceUuid?: string;
|
|
733
|
+
/** Organisation slug — used to seed sandbox sessionStorage. */
|
|
734
|
+
slug?: string;
|
|
735
|
+
onError: (error: Error) => boolean;
|
|
736
|
+
}>;
|
|
656
737
|
type AuthContextValue = Readonly<{
|
|
657
738
|
accessToken: string;
|
|
658
739
|
refreshToken: string;
|
|
@@ -662,18 +743,18 @@ type AuthContextValue = Readonly<{
|
|
|
662
743
|
}>;
|
|
663
744
|
type BaseUrlContextValue = Readonly<{
|
|
664
745
|
baseUrl: string;
|
|
665
|
-
ledgerBaseUrl
|
|
746
|
+
ledgerBaseUrl?: string;
|
|
666
747
|
consentClient: ReturnType<typeof createConsentClient>;
|
|
667
748
|
}>;
|
|
668
749
|
|
|
669
750
|
declare const BaseUrlProvider: ({ children, baseUrl, ledgerBaseUrl, }: {
|
|
670
751
|
children: ReactNode;
|
|
671
752
|
baseUrl: string;
|
|
672
|
-
ledgerBaseUrl
|
|
673
|
-
}) =>
|
|
753
|
+
ledgerBaseUrl?: string;
|
|
754
|
+
}) => react.JSX.Element;
|
|
674
755
|
declare const useBaseUrl: () => Readonly<{
|
|
675
756
|
baseUrl: string;
|
|
676
|
-
ledgerBaseUrl
|
|
757
|
+
ledgerBaseUrl?: string;
|
|
677
758
|
consentClient: ReturnType<typeof createConsentClient>;
|
|
678
759
|
}>;
|
|
679
760
|
|
|
@@ -820,7 +901,7 @@ type FetchGroupPurposesParams = {
|
|
|
820
901
|
consentClient?: BaseUrlContextValue['consentClient'];
|
|
821
902
|
};
|
|
822
903
|
declare const fetchGroupPurposes: (params: FetchGroupPurposesParams) => Promise<GroupPurposesOut | null>;
|
|
823
|
-
declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact, action, authContext, consentClient, nominatorContact, dataElementUuids, productUuid, noticeUuid, dataElements, }: {
|
|
904
|
+
declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact, action, authContext, consentClient, nominatorContact, dataElementUuids, productUuid, noticeUuid, dataElements, language, }: {
|
|
824
905
|
organizationId: string;
|
|
825
906
|
workspaceId: string;
|
|
826
907
|
purposeId: string;
|
|
@@ -836,19 +917,14 @@ declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact,
|
|
|
836
917
|
uuid: string;
|
|
837
918
|
selected: boolean;
|
|
838
919
|
}>;
|
|
920
|
+
language?: string;
|
|
839
921
|
}) => Promise<boolean | null>;
|
|
840
922
|
declare const fetchActivities: (organizationId: string, workspaceId: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<ActivityDetail | null>;
|
|
841
923
|
declare const fetchCaseHistory: (organizationId: string, workspaceId: string, contact: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<CaseHistoryDetail | null>;
|
|
842
924
|
|
|
843
|
-
declare const useCaseHistory: (organizationId: string | undefined, workspaceId: string | undefined, contact: string | undefined, authContext?: AuthContext) => _tanstack_react_query.UseQueryResult<CaseRequest[]
|
|
925
|
+
declare const useCaseHistory: (organizationId: string | undefined, workspaceId: string | undefined, contact: string | undefined, authContext?: AuthContext) => _tanstack_react_query.UseQueryResult<NoInfer<CaseRequest[]>, Error>;
|
|
844
926
|
|
|
845
|
-
|
|
846
|
-
children: ReactNode;
|
|
847
|
-
accessToken: string;
|
|
848
|
-
refreshToken: string;
|
|
849
|
-
onError: (error: Error) => boolean;
|
|
850
|
-
}
|
|
851
|
-
declare const AuthProvider: ({ children, accessToken: initialAccessToken, refreshToken: initialRefreshToken, onError, }: AuthProviderProps) => react_jsx_runtime.JSX.Element;
|
|
927
|
+
declare const AuthProvider: (props: AuthProviderProps) => react.JSX.Element;
|
|
852
928
|
declare const useAuth: () => AuthContextValue;
|
|
853
929
|
|
|
854
930
|
/**
|
package/dist/privacy-center.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
4
4
|
|
|
@@ -33,9 +33,12 @@ type BaseRequest = {
|
|
|
33
33
|
* Creates a client instance with a specific base URL.
|
|
34
34
|
* @param baseUrl - Consent server base URL (Python service, e.g. http://host/consent)
|
|
35
35
|
* @param ledgerBaseUrl - Go ledger base URL (e.g. http://host:8090/consent-ledger).
|
|
36
|
-
* Used for user-consents reads
|
|
36
|
+
* Used for user-consents reads/writes served from the ledger's `/public/...` paths.
|
|
37
|
+
* When omitted, those calls fall back to the legacy Python
|
|
38
|
+
* `/dsar/privacy-center` endpoints and payloads (pre-ledger behavior), so
|
|
39
|
+
* integrations without a deployed ledger keep working.
|
|
37
40
|
*/
|
|
38
|
-
declare function createConsentClient(baseUrl: string, ledgerBaseUrl
|
|
41
|
+
declare function createConsentClient(baseUrl: string, ledgerBaseUrl?: string): {
|
|
39
42
|
/**
|
|
40
43
|
* Get form data (privacy center)
|
|
41
44
|
*/
|
|
@@ -96,23 +99,38 @@ declare function createConsentClient(baseUrl: string, ledgerBaseUrl: string): {
|
|
|
96
99
|
/**
|
|
97
100
|
* Manage consent (privacy center) - revoke, regrant, or renew.
|
|
98
101
|
*
|
|
99
|
-
* The Go ledger has no manage-consent route, so
|
|
100
|
-
* `partial` submit-consent on the ledger — mirroring
|
|
101
|
-
* relay (`build_consent_management_payload`): the
|
|
102
|
-
* re-submitted with `selected: false` to revoke or
|
|
103
|
-
* regrant/renew, and `partial: true` so the rest of the
|
|
104
|
-
* are left untouched. The principal is resolved from the
|
|
105
|
-
* `contact`/identifiers are sent in the body, and
|
|
106
|
-
* omitted so the ledger mints a fresh event.
|
|
102
|
+
* The Go ledger has no manage-consent route, so with a ledger configured
|
|
103
|
+
* this is expressed as a `partial` submit-consent on the ledger — mirroring
|
|
104
|
+
* the Python dual-write relay (`build_consent_management_payload`): the
|
|
105
|
+
* affected purpose is re-submitted with `selected: false` to revoke or
|
|
106
|
+
* `selected: true` to regrant/renew, and `partial: true` so the rest of the
|
|
107
|
+
* notice's purposes are left untouched. The principal is resolved from the
|
|
108
|
+
* JWT, so no `contact`/identifiers are sent in the body, and
|
|
109
|
+
* `consent_event_uuid` is omitted so the ledger mints a fresh event.
|
|
110
|
+
*
|
|
111
|
+
* Without a ledger, the legacy Python `/manage-consent?status=` endpoint is
|
|
112
|
+
* used with its `{ purpose_uuid, contact, ... }` payload.
|
|
107
113
|
*/
|
|
108
114
|
manageConsent(baseRequest: BaseRequest, purposeId: string, contact: string, status: "revoke" | "regrant" | "renew", authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">, nominatorContact?: string, dataElementUuids?: string[], productUuid?: string, noticeUuid?: string, dataElements?: Array<{
|
|
109
115
|
uuid: string;
|
|
110
116
|
selected: boolean;
|
|
111
|
-
}
|
|
117
|
+
}>, language?: string): Promise<unknown>;
|
|
112
118
|
/**
|
|
113
119
|
* Get activities (privacy center)
|
|
114
120
|
*/
|
|
115
121
|
getActivities(baseRequest: BaseRequest, offset?: number, limit?: number, language?: string, authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
|
|
122
|
+
/**
|
|
123
|
+
* List all data principals that share this session's contact
|
|
124
|
+
* (shared-contact profile picker). Identity is derived server-side from the
|
|
125
|
+
* JWT — the caller sends nothing but its bearer token.
|
|
126
|
+
*/
|
|
127
|
+
listIdentities(baseRequest: BaseRequest, authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<IdentityListResponse>;
|
|
128
|
+
/**
|
|
129
|
+
* Re-scope the session to a chosen principal uuid (must be one of the
|
|
130
|
+
* principals sharing this session's contact). Returns fresh access/refresh
|
|
131
|
+
* tokens scoped to that principal.
|
|
132
|
+
*/
|
|
133
|
+
selectPrincipal(baseRequest: BaseRequest, principalUuid: string, authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<SelectPrincipalResponse>;
|
|
116
134
|
/**
|
|
117
135
|
* Get receipts (privacy center) — consent receipts for the authenticated user
|
|
118
136
|
*/
|
|
@@ -364,6 +382,7 @@ type NominatorInfo = {
|
|
|
364
382
|
};
|
|
365
383
|
type PurposeItem = {
|
|
366
384
|
purpose_uuid: string;
|
|
385
|
+
uuid?: string;
|
|
367
386
|
name: string;
|
|
368
387
|
description: string | null;
|
|
369
388
|
status: ConsentStatusEnum | string;
|
|
@@ -372,6 +391,7 @@ type PurposeItem = {
|
|
|
372
391
|
method: string;
|
|
373
392
|
data_elements: ConsentDataElement[];
|
|
374
393
|
link_reason: string | null;
|
|
394
|
+
revoke_warning_message?: string | null;
|
|
375
395
|
notice_uuid: string | null;
|
|
376
396
|
};
|
|
377
397
|
type ConsentGroup = {
|
|
@@ -607,6 +627,21 @@ type NotificationQueryParams = {
|
|
|
607
627
|
include_summary?: boolean;
|
|
608
628
|
language?: string;
|
|
609
629
|
};
|
|
630
|
+
type IdentityCandidate = Readonly<{
|
|
631
|
+
uuid: string;
|
|
632
|
+
org_user_id?: string | null;
|
|
633
|
+
primary_email?: string | null;
|
|
634
|
+
primary_mobile?: string | null;
|
|
635
|
+
created_at?: string | null;
|
|
636
|
+
}>;
|
|
637
|
+
type IdentityListResponse = Readonly<{
|
|
638
|
+
identities: IdentityCandidate[];
|
|
639
|
+
}>;
|
|
640
|
+
type SelectPrincipalResponse = Readonly<{
|
|
641
|
+
token: string;
|
|
642
|
+
refresh_token: string;
|
|
643
|
+
expires_at?: string;
|
|
644
|
+
}>;
|
|
610
645
|
|
|
611
646
|
type InternalPage = 'consent-manager' | 'form' | 'activity' | 'case-details' | 'notifications' | 'receipts';
|
|
612
647
|
interface NavigationContextType {
|
|
@@ -619,40 +654,86 @@ interface NavigationContextType {
|
|
|
619
654
|
declare const NavigationProvider: ({ children, initialPage }: {
|
|
620
655
|
children: ReactNode;
|
|
621
656
|
initialPage?: InternalPage;
|
|
622
|
-
}) =>
|
|
657
|
+
}) => react.JSX.Element;
|
|
623
658
|
declare const useInternalNavigation: () => NavigationContextType;
|
|
624
659
|
|
|
625
660
|
interface RedactoPrivacyCenterProps {
|
|
626
661
|
baseUrl: string;
|
|
627
|
-
ledgerBaseUrl
|
|
662
|
+
ledgerBaseUrl?: string;
|
|
628
663
|
slug: string;
|
|
629
|
-
|
|
630
|
-
|
|
664
|
+
/** JWT access token. Optional so sandbox mode (see `token`) can omit it. */
|
|
665
|
+
accessToken?: string;
|
|
666
|
+
/** JWT refresh token. Optional; used by the OTP-refresh loop in the JWT flow. */
|
|
667
|
+
refreshToken?: string;
|
|
668
|
+
/**
|
|
669
|
+
* Sandbox PoC: a pasted static token. When set, the Privacy Center runs
|
|
670
|
+
* against the sandbox with no JWT — it sends the single `X-Consent-Token`
|
|
671
|
+
* header, carries the acting identity (`email` || `mobile`) in each request's
|
|
672
|
+
* own payload, takes org/workspace from `organisationUuid`/`workspaceUuid`,
|
|
673
|
+
* and never calls `/otp/refresh`.
|
|
674
|
+
*/
|
|
675
|
+
token?: string;
|
|
676
|
+
/** Sandbox test subject email (carried in the request payload when set). */
|
|
677
|
+
email?: string;
|
|
678
|
+
/** Sandbox test subject mobile (fallback subject when `email` is absent). */
|
|
679
|
+
mobile?: string;
|
|
680
|
+
/**
|
|
681
|
+
* Sandbox UCIC: the client's own user id / org_user_id, e.g. a UUID or
|
|
682
|
+
* customer code; optional third identifier alongside email/mobile.
|
|
683
|
+
*/
|
|
684
|
+
ucic?: string;
|
|
685
|
+
/** Sandbox org UUID (replaces the JWT-decoded org in sandbox mode). */
|
|
686
|
+
organisationUuid?: string;
|
|
687
|
+
/** Sandbox workspace UUID (replaces the JWT-decoded workspace in sandbox mode). */
|
|
688
|
+
workspaceUuid?: string;
|
|
631
689
|
onError: (error: Error) => boolean;
|
|
632
690
|
initialPage?: InternalPage;
|
|
633
691
|
onBack?: 'back' | 'signout';
|
|
634
692
|
}
|
|
635
|
-
declare function RedactoPrivacyCenter({ baseUrl, ledgerBaseUrl, slug, accessToken, refreshToken, onError, initialPage, onBack, }: RedactoPrivacyCenterProps):
|
|
693
|
+
declare function RedactoPrivacyCenter({ baseUrl, ledgerBaseUrl, slug, accessToken, refreshToken, token, email, mobile, ucic, organisationUuid, workspaceUuid, onError, initialPage, onBack, }: RedactoPrivacyCenterProps): react.JSX.Element;
|
|
636
694
|
|
|
637
695
|
interface PrivacyCenterLayoutProps {
|
|
638
696
|
children: ReactNode;
|
|
639
697
|
slug: string;
|
|
640
698
|
onBack?: 'back' | 'signout';
|
|
641
699
|
}
|
|
642
|
-
declare function PrivacyCenterLayout({ children, slug, onBack }: PrivacyCenterLayoutProps):
|
|
700
|
+
declare function PrivacyCenterLayout({ children, slug, onBack }: PrivacyCenterLayoutProps): react.JSX.Element;
|
|
643
701
|
|
|
644
|
-
declare function PrivacyCenterHomePage():
|
|
702
|
+
declare function PrivacyCenterHomePage(): react.JSX.Element;
|
|
645
703
|
|
|
646
|
-
declare function PrivacyCenterConsentManagerPage():
|
|
704
|
+
declare function PrivacyCenterConsentManagerPage(): react.JSX.Element;
|
|
647
705
|
|
|
648
|
-
declare function PrivacyCenterFormPage():
|
|
706
|
+
declare function PrivacyCenterFormPage(): react.JSX.Element;
|
|
649
707
|
|
|
650
|
-
declare function PrivacyCenterActivityPage():
|
|
708
|
+
declare function PrivacyCenterActivityPage(): react.JSX.Element;
|
|
651
709
|
|
|
652
|
-
declare const PrivacyCenterCaseDetailsPage: () =>
|
|
710
|
+
declare const PrivacyCenterCaseDetailsPage: () => react.JSX.Element | null;
|
|
653
711
|
|
|
654
|
-
declare const NotificationsPage: () =>
|
|
712
|
+
declare const NotificationsPage: () => react.JSX.Element;
|
|
655
713
|
|
|
714
|
+
type AuthProviderProps = Readonly<{
|
|
715
|
+
children: ReactNode;
|
|
716
|
+
accessToken?: string;
|
|
717
|
+
refreshToken?: string;
|
|
718
|
+
/**
|
|
719
|
+
* Sandbox PoC: when set, the Privacy Center skips the JWT entirely — it seeds
|
|
720
|
+
* org/workspace/subject from the props below, sends the single
|
|
721
|
+
* `X-Consent-Token` header, carries the acting identity in each request's own
|
|
722
|
+
* payload, and never calls `/otp/refresh`.
|
|
723
|
+
*/
|
|
724
|
+
token?: string;
|
|
725
|
+
/** Sandbox UCIC — the client's own user id (`org_user_id`); takes precedence over the subject. */
|
|
726
|
+
sandboxUcic?: string;
|
|
727
|
+
/** Sandbox subject (email or mobile) — carried in the request payload. */
|
|
728
|
+
sandboxSubject?: string;
|
|
729
|
+
/** Sandbox org UUID (replaces the JWT-decoded org). */
|
|
730
|
+
organisationUuid?: string;
|
|
731
|
+
/** Sandbox workspace UUID (replaces the JWT-decoded workspace). */
|
|
732
|
+
workspaceUuid?: string;
|
|
733
|
+
/** Organisation slug — used to seed sandbox sessionStorage. */
|
|
734
|
+
slug?: string;
|
|
735
|
+
onError: (error: Error) => boolean;
|
|
736
|
+
}>;
|
|
656
737
|
type AuthContextValue = Readonly<{
|
|
657
738
|
accessToken: string;
|
|
658
739
|
refreshToken: string;
|
|
@@ -662,18 +743,18 @@ type AuthContextValue = Readonly<{
|
|
|
662
743
|
}>;
|
|
663
744
|
type BaseUrlContextValue = Readonly<{
|
|
664
745
|
baseUrl: string;
|
|
665
|
-
ledgerBaseUrl
|
|
746
|
+
ledgerBaseUrl?: string;
|
|
666
747
|
consentClient: ReturnType<typeof createConsentClient>;
|
|
667
748
|
}>;
|
|
668
749
|
|
|
669
750
|
declare const BaseUrlProvider: ({ children, baseUrl, ledgerBaseUrl, }: {
|
|
670
751
|
children: ReactNode;
|
|
671
752
|
baseUrl: string;
|
|
672
|
-
ledgerBaseUrl
|
|
673
|
-
}) =>
|
|
753
|
+
ledgerBaseUrl?: string;
|
|
754
|
+
}) => react.JSX.Element;
|
|
674
755
|
declare const useBaseUrl: () => Readonly<{
|
|
675
756
|
baseUrl: string;
|
|
676
|
-
ledgerBaseUrl
|
|
757
|
+
ledgerBaseUrl?: string;
|
|
677
758
|
consentClient: ReturnType<typeof createConsentClient>;
|
|
678
759
|
}>;
|
|
679
760
|
|
|
@@ -820,7 +901,7 @@ type FetchGroupPurposesParams = {
|
|
|
820
901
|
consentClient?: BaseUrlContextValue['consentClient'];
|
|
821
902
|
};
|
|
822
903
|
declare const fetchGroupPurposes: (params: FetchGroupPurposesParams) => Promise<GroupPurposesOut | null>;
|
|
823
|
-
declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact, action, authContext, consentClient, nominatorContact, dataElementUuids, productUuid, noticeUuid, dataElements, }: {
|
|
904
|
+
declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact, action, authContext, consentClient, nominatorContact, dataElementUuids, productUuid, noticeUuid, dataElements, language, }: {
|
|
824
905
|
organizationId: string;
|
|
825
906
|
workspaceId: string;
|
|
826
907
|
purposeId: string;
|
|
@@ -836,19 +917,14 @@ declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact,
|
|
|
836
917
|
uuid: string;
|
|
837
918
|
selected: boolean;
|
|
838
919
|
}>;
|
|
920
|
+
language?: string;
|
|
839
921
|
}) => Promise<boolean | null>;
|
|
840
922
|
declare const fetchActivities: (organizationId: string, workspaceId: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<ActivityDetail | null>;
|
|
841
923
|
declare const fetchCaseHistory: (organizationId: string, workspaceId: string, contact: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<CaseHistoryDetail | null>;
|
|
842
924
|
|
|
843
|
-
declare const useCaseHistory: (organizationId: string | undefined, workspaceId: string | undefined, contact: string | undefined, authContext?: AuthContext) => _tanstack_react_query.UseQueryResult<CaseRequest[]
|
|
925
|
+
declare const useCaseHistory: (organizationId: string | undefined, workspaceId: string | undefined, contact: string | undefined, authContext?: AuthContext) => _tanstack_react_query.UseQueryResult<NoInfer<CaseRequest[]>, Error>;
|
|
844
926
|
|
|
845
|
-
|
|
846
|
-
children: ReactNode;
|
|
847
|
-
accessToken: string;
|
|
848
|
-
refreshToken: string;
|
|
849
|
-
onError: (error: Error) => boolean;
|
|
850
|
-
}
|
|
851
|
-
declare const AuthProvider: ({ children, accessToken: initialAccessToken, refreshToken: initialRefreshToken, onError, }: AuthProviderProps) => react_jsx_runtime.JSX.Element;
|
|
927
|
+
declare const AuthProvider: (props: AuthProviderProps) => react.JSX.Element;
|
|
852
928
|
declare const useAuth: () => AuthContextValue;
|
|
853
929
|
|
|
854
930
|
/**
|