@redacto.io/consent-sdk-react-native 4.0.1-beta.0 → 5.0.0-beta.0
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/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +186 -10
- package/dist/index.mjs +186 -10
- package/dist/privacy-center.d.mts +38 -7
- package/dist/privacy-center.d.ts +38 -7
- package/dist/privacy-center.js +109 -25
- package/dist/privacy-center.mjs +109 -25
- package/package.json +5 -3
|
@@ -244,6 +244,7 @@ type UserConsent = {
|
|
|
244
244
|
product_name?: string;
|
|
245
245
|
product_description?: string | null;
|
|
246
246
|
nominator_info?: NominatorInfo;
|
|
247
|
+
notice_uuid?: string | null;
|
|
247
248
|
};
|
|
248
249
|
type NominatorInfo = {
|
|
249
250
|
org_user_id: string;
|
|
@@ -269,6 +270,7 @@ type PurposeItem = {
|
|
|
269
270
|
method: string;
|
|
270
271
|
data_elements: ConsentDataElement[];
|
|
271
272
|
link_reason: string | null;
|
|
273
|
+
notice_uuid?: string | null;
|
|
272
274
|
};
|
|
273
275
|
type ConsentGroup = {
|
|
274
276
|
product_uuid: string;
|
|
@@ -439,6 +441,8 @@ declare function useInternalNavigation(): NavigationContextType;
|
|
|
439
441
|
|
|
440
442
|
interface RedactoPrivacyCenterProps {
|
|
441
443
|
baseUrl: string;
|
|
444
|
+
/** Go ledger base URL — serves user-consents; omit to use the legacy Python privacy-center consent endpoints. */
|
|
445
|
+
ledgerBaseUrl?: string;
|
|
442
446
|
slug: string;
|
|
443
447
|
/**
|
|
444
448
|
* @deprecated The Privacy Center now themes itself from per-org branding.
|
|
@@ -453,7 +457,7 @@ interface RedactoPrivacyCenterProps {
|
|
|
453
457
|
initialCaseUuid?: string;
|
|
454
458
|
onBack?: 'back' | 'signout';
|
|
455
459
|
}
|
|
456
|
-
declare function RedactoPrivacyCenter({ baseUrl, slug, theme: _theme, accessToken, refreshToken, onError, initialPage, initialCaseUuid, onBack, }: RedactoPrivacyCenterProps): React.JSX.Element;
|
|
460
|
+
declare function RedactoPrivacyCenter({ baseUrl, ledgerBaseUrl, slug, theme: _theme, accessToken, refreshToken, onError, initialPage, initialCaseUuid, onBack, }: RedactoPrivacyCenterProps): React.JSX.Element;
|
|
457
461
|
|
|
458
462
|
declare function ConsentManager(): React__default.JSX.Element;
|
|
459
463
|
|
|
@@ -550,9 +554,14 @@ type BaseRequest = {
|
|
|
550
554
|
/**
|
|
551
555
|
* Consent service client factory.
|
|
552
556
|
* Creates a client instance with a specific base URL.
|
|
553
|
-
* @param baseUrl - Consent server base URL
|
|
557
|
+
* @param baseUrl - Consent server base URL (Python service, e.g. http://host/consent)
|
|
558
|
+
* @param ledgerBaseUrl - Go ledger base URL (e.g. http://host:8090/consent-ledger).
|
|
559
|
+
* Used for user-consents reads/writes served from the ledger's `/public/...` paths.
|
|
560
|
+
* When omitted, those calls fall back to the legacy Python
|
|
561
|
+
* `/dsar/privacy-center` endpoints and payloads (pre-ledger behavior), so
|
|
562
|
+
* integrations without a deployed ledger keep working.
|
|
554
563
|
*/
|
|
555
|
-
declare function createConsentClient(baseUrl: string): {
|
|
564
|
+
declare function createConsentClient(baseUrl: string, ledgerBaseUrl?: string): {
|
|
556
565
|
/**
|
|
557
566
|
* Get form data (privacy center)
|
|
558
567
|
*/
|
|
@@ -611,9 +620,23 @@ declare function createConsentClient(baseUrl: string): {
|
|
|
611
620
|
nominator_uuid?: string;
|
|
612
621
|
}, authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
|
|
613
622
|
/**
|
|
614
|
-
* Manage consent (privacy center) - revoke, regrant, or renew
|
|
623
|
+
* Manage consent (privacy center) - revoke, regrant, or renew.
|
|
624
|
+
*
|
|
625
|
+
* The Go ledger has no manage-consent route, so with a ledger configured
|
|
626
|
+
* this is expressed as a `partial` submit-consent on the ledger — mirroring
|
|
627
|
+
* the Python dual-write relay: the affected purpose is re-submitted with
|
|
628
|
+
* `selected: false` to revoke or `selected: true` to regrant/renew, and
|
|
629
|
+
* `partial: true` so the rest of the notice's purposes are left untouched.
|
|
630
|
+
* The principal is resolved from the JWT, so no `contact`/identifiers are
|
|
631
|
+
* sent in the body.
|
|
632
|
+
*
|
|
633
|
+
* Without a ledger, the legacy Python `/manage-consent?status=` endpoint is
|
|
634
|
+
* used with its `{ purpose_uuid, contact, ... }` payload.
|
|
615
635
|
*/
|
|
616
|
-
manageConsent(baseRequest: BaseRequest, purposeId: string, contact: string, status: "revoke" | "regrant" | "renew", authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">, nominatorContact?: string, dataElementUuids?: string[]
|
|
636
|
+
manageConsent(baseRequest: BaseRequest, purposeId: string, contact: string, status: "revoke" | "regrant" | "renew", authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">, nominatorContact?: string, dataElementUuids?: string[], noticeUuid?: string, dataElements?: Array<{
|
|
637
|
+
uuid: string;
|
|
638
|
+
selected: boolean;
|
|
639
|
+
}>): Promise<unknown>;
|
|
617
640
|
/**
|
|
618
641
|
* Get activities (privacy center)
|
|
619
642
|
*/
|
|
@@ -686,11 +709,14 @@ declare function createConsentClient(baseUrl: string): {
|
|
|
686
709
|
|
|
687
710
|
interface BaseUrlContextValue {
|
|
688
711
|
baseUrl: string;
|
|
712
|
+
/** Go ledger base URL — serves user-consents; omit to use the legacy Python privacy-center consent endpoints. */
|
|
713
|
+
ledgerBaseUrl?: string;
|
|
689
714
|
consentClient: ReturnType<typeof createConsentClient>;
|
|
690
715
|
}
|
|
691
|
-
declare function BaseUrlProvider({ children, baseUrl }: {
|
|
716
|
+
declare function BaseUrlProvider({ children, baseUrl, ledgerBaseUrl, }: {
|
|
692
717
|
children: ReactNode;
|
|
693
718
|
baseUrl: string;
|
|
719
|
+
ledgerBaseUrl?: string;
|
|
694
720
|
}): React.JSX.Element;
|
|
695
721
|
declare function useBaseUrl(): BaseUrlContextValue;
|
|
696
722
|
|
|
@@ -746,7 +772,7 @@ type FetchUserConsentsParams = {
|
|
|
746
772
|
consentClient?: BaseUrlContextValue['consentClient'];
|
|
747
773
|
};
|
|
748
774
|
declare const fetchUserConsents: (params: FetchUserConsentsParams) => Promise<UserConsentDetail | null>;
|
|
749
|
-
declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact, action, authContext, consentClient, nominatorContact, dataElementUuids, }: {
|
|
775
|
+
declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact, action, authContext, consentClient, nominatorContact, dataElementUuids, noticeUuid, dataElements, }: {
|
|
750
776
|
organizationId: string;
|
|
751
777
|
workspaceId: string;
|
|
752
778
|
purposeId: string;
|
|
@@ -756,6 +782,11 @@ declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact,
|
|
|
756
782
|
consentClient?: BaseUrlContextValue["consentClient"];
|
|
757
783
|
nominatorContact?: string;
|
|
758
784
|
dataElementUuids?: string[];
|
|
785
|
+
noticeUuid?: string;
|
|
786
|
+
dataElements?: Array<{
|
|
787
|
+
uuid: string;
|
|
788
|
+
selected: boolean;
|
|
789
|
+
}>;
|
|
759
790
|
}) => Promise<boolean | null>;
|
|
760
791
|
declare const fetchActivities: (organizationId: string, workspaceId: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<ActivityDetail | null>;
|
|
761
792
|
declare const fetchCaseHistory: (organizationId: string, workspaceId: string, contact: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<CaseHistoryDetail | null>;
|
package/dist/privacy-center.d.ts
CHANGED
|
@@ -244,6 +244,7 @@ type UserConsent = {
|
|
|
244
244
|
product_name?: string;
|
|
245
245
|
product_description?: string | null;
|
|
246
246
|
nominator_info?: NominatorInfo;
|
|
247
|
+
notice_uuid?: string | null;
|
|
247
248
|
};
|
|
248
249
|
type NominatorInfo = {
|
|
249
250
|
org_user_id: string;
|
|
@@ -269,6 +270,7 @@ type PurposeItem = {
|
|
|
269
270
|
method: string;
|
|
270
271
|
data_elements: ConsentDataElement[];
|
|
271
272
|
link_reason: string | null;
|
|
273
|
+
notice_uuid?: string | null;
|
|
272
274
|
};
|
|
273
275
|
type ConsentGroup = {
|
|
274
276
|
product_uuid: string;
|
|
@@ -439,6 +441,8 @@ declare function useInternalNavigation(): NavigationContextType;
|
|
|
439
441
|
|
|
440
442
|
interface RedactoPrivacyCenterProps {
|
|
441
443
|
baseUrl: string;
|
|
444
|
+
/** Go ledger base URL — serves user-consents; omit to use the legacy Python privacy-center consent endpoints. */
|
|
445
|
+
ledgerBaseUrl?: string;
|
|
442
446
|
slug: string;
|
|
443
447
|
/**
|
|
444
448
|
* @deprecated The Privacy Center now themes itself from per-org branding.
|
|
@@ -453,7 +457,7 @@ interface RedactoPrivacyCenterProps {
|
|
|
453
457
|
initialCaseUuid?: string;
|
|
454
458
|
onBack?: 'back' | 'signout';
|
|
455
459
|
}
|
|
456
|
-
declare function RedactoPrivacyCenter({ baseUrl, slug, theme: _theme, accessToken, refreshToken, onError, initialPage, initialCaseUuid, onBack, }: RedactoPrivacyCenterProps): React.JSX.Element;
|
|
460
|
+
declare function RedactoPrivacyCenter({ baseUrl, ledgerBaseUrl, slug, theme: _theme, accessToken, refreshToken, onError, initialPage, initialCaseUuid, onBack, }: RedactoPrivacyCenterProps): React.JSX.Element;
|
|
457
461
|
|
|
458
462
|
declare function ConsentManager(): React__default.JSX.Element;
|
|
459
463
|
|
|
@@ -550,9 +554,14 @@ type BaseRequest = {
|
|
|
550
554
|
/**
|
|
551
555
|
* Consent service client factory.
|
|
552
556
|
* Creates a client instance with a specific base URL.
|
|
553
|
-
* @param baseUrl - Consent server base URL
|
|
557
|
+
* @param baseUrl - Consent server base URL (Python service, e.g. http://host/consent)
|
|
558
|
+
* @param ledgerBaseUrl - Go ledger base URL (e.g. http://host:8090/consent-ledger).
|
|
559
|
+
* Used for user-consents reads/writes served from the ledger's `/public/...` paths.
|
|
560
|
+
* When omitted, those calls fall back to the legacy Python
|
|
561
|
+
* `/dsar/privacy-center` endpoints and payloads (pre-ledger behavior), so
|
|
562
|
+
* integrations without a deployed ledger keep working.
|
|
554
563
|
*/
|
|
555
|
-
declare function createConsentClient(baseUrl: string): {
|
|
564
|
+
declare function createConsentClient(baseUrl: string, ledgerBaseUrl?: string): {
|
|
556
565
|
/**
|
|
557
566
|
* Get form data (privacy center)
|
|
558
567
|
*/
|
|
@@ -611,9 +620,23 @@ declare function createConsentClient(baseUrl: string): {
|
|
|
611
620
|
nominator_uuid?: string;
|
|
612
621
|
}, authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
|
|
613
622
|
/**
|
|
614
|
-
* Manage consent (privacy center) - revoke, regrant, or renew
|
|
623
|
+
* Manage consent (privacy center) - revoke, regrant, or renew.
|
|
624
|
+
*
|
|
625
|
+
* The Go ledger has no manage-consent route, so with a ledger configured
|
|
626
|
+
* this is expressed as a `partial` submit-consent on the ledger — mirroring
|
|
627
|
+
* the Python dual-write relay: the affected purpose is re-submitted with
|
|
628
|
+
* `selected: false` to revoke or `selected: true` to regrant/renew, and
|
|
629
|
+
* `partial: true` so the rest of the notice's purposes are left untouched.
|
|
630
|
+
* The principal is resolved from the JWT, so no `contact`/identifiers are
|
|
631
|
+
* sent in the body.
|
|
632
|
+
*
|
|
633
|
+
* Without a ledger, the legacy Python `/manage-consent?status=` endpoint is
|
|
634
|
+
* used with its `{ purpose_uuid, contact, ... }` payload.
|
|
615
635
|
*/
|
|
616
|
-
manageConsent(baseRequest: BaseRequest, purposeId: string, contact: string, status: "revoke" | "regrant" | "renew", authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">, nominatorContact?: string, dataElementUuids?: string[]
|
|
636
|
+
manageConsent(baseRequest: BaseRequest, purposeId: string, contact: string, status: "revoke" | "regrant" | "renew", authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">, nominatorContact?: string, dataElementUuids?: string[], noticeUuid?: string, dataElements?: Array<{
|
|
637
|
+
uuid: string;
|
|
638
|
+
selected: boolean;
|
|
639
|
+
}>): Promise<unknown>;
|
|
617
640
|
/**
|
|
618
641
|
* Get activities (privacy center)
|
|
619
642
|
*/
|
|
@@ -686,11 +709,14 @@ declare function createConsentClient(baseUrl: string): {
|
|
|
686
709
|
|
|
687
710
|
interface BaseUrlContextValue {
|
|
688
711
|
baseUrl: string;
|
|
712
|
+
/** Go ledger base URL — serves user-consents; omit to use the legacy Python privacy-center consent endpoints. */
|
|
713
|
+
ledgerBaseUrl?: string;
|
|
689
714
|
consentClient: ReturnType<typeof createConsentClient>;
|
|
690
715
|
}
|
|
691
|
-
declare function BaseUrlProvider({ children, baseUrl }: {
|
|
716
|
+
declare function BaseUrlProvider({ children, baseUrl, ledgerBaseUrl, }: {
|
|
692
717
|
children: ReactNode;
|
|
693
718
|
baseUrl: string;
|
|
719
|
+
ledgerBaseUrl?: string;
|
|
694
720
|
}): React.JSX.Element;
|
|
695
721
|
declare function useBaseUrl(): BaseUrlContextValue;
|
|
696
722
|
|
|
@@ -746,7 +772,7 @@ type FetchUserConsentsParams = {
|
|
|
746
772
|
consentClient?: BaseUrlContextValue['consentClient'];
|
|
747
773
|
};
|
|
748
774
|
declare const fetchUserConsents: (params: FetchUserConsentsParams) => Promise<UserConsentDetail | null>;
|
|
749
|
-
declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact, action, authContext, consentClient, nominatorContact, dataElementUuids, }: {
|
|
775
|
+
declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact, action, authContext, consentClient, nominatorContact, dataElementUuids, noticeUuid, dataElements, }: {
|
|
750
776
|
organizationId: string;
|
|
751
777
|
workspaceId: string;
|
|
752
778
|
purposeId: string;
|
|
@@ -756,6 +782,11 @@ declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact,
|
|
|
756
782
|
consentClient?: BaseUrlContextValue["consentClient"];
|
|
757
783
|
nominatorContact?: string;
|
|
758
784
|
dataElementUuids?: string[];
|
|
785
|
+
noticeUuid?: string;
|
|
786
|
+
dataElements?: Array<{
|
|
787
|
+
uuid: string;
|
|
788
|
+
selected: boolean;
|
|
789
|
+
}>;
|
|
759
790
|
}) => Promise<boolean | null>;
|
|
760
791
|
declare const fetchActivities: (organizationId: string, workspaceId: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<ActivityDetail | null>;
|
|
761
792
|
declare const fetchCaseHistory: (organizationId: string, workspaceId: string, contact: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<CaseHistoryDetail | null>;
|
package/dist/privacy-center.js
CHANGED
|
@@ -9982,7 +9982,15 @@ function arrayBufferToBase64(buffer) {
|
|
|
9982
9982
|
}
|
|
9983
9983
|
return result;
|
|
9984
9984
|
}
|
|
9985
|
-
function createConsentClient(baseUrl) {
|
|
9985
|
+
function createConsentClient(baseUrl, ledgerBaseUrl) {
|
|
9986
|
+
const useLedger = Boolean(ledgerBaseUrl);
|
|
9987
|
+
const ledgerBase = (ledgerBaseUrl != null ? ledgerBaseUrl : "").replace(/\/$/, "");
|
|
9988
|
+
function ledgerUrl(baseRequest, path) {
|
|
9989
|
+
if (!useLedger) {
|
|
9990
|
+
throw new Error("ledgerUrl called without a configured ledgerBaseUrl");
|
|
9991
|
+
}
|
|
9992
|
+
return `${ledgerBase}/public/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}${path}`;
|
|
9993
|
+
}
|
|
9986
9994
|
async function privacyCenterApiFetch(url, options) {
|
|
9987
9995
|
const { authToken, getAuthToken, headers = {}, ...fetchOptions } = options;
|
|
9988
9996
|
const requestHeaders = new Headers();
|
|
@@ -10184,7 +10192,8 @@ function createConsentClient(baseUrl) {
|
|
|
10184
10192
|
if (params.product_uuid) queryParams.append("product_uuid", params.product_uuid);
|
|
10185
10193
|
if (params.language) queryParams.append("language", params.language);
|
|
10186
10194
|
const queryString = queryParams.toString();
|
|
10187
|
-
const
|
|
10195
|
+
const consentsSuffix = `/user-consents${queryString ? `?${queryString}` : ""}`;
|
|
10196
|
+
const url = useLedger ? ledgerUrl(baseRequest, consentsSuffix) : `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center${consentsSuffix}`;
|
|
10188
10197
|
return privacyCenterApiFetch(url, {
|
|
10189
10198
|
...options,
|
|
10190
10199
|
method: "GET",
|
|
@@ -10204,7 +10213,8 @@ function createConsentClient(baseUrl) {
|
|
|
10204
10213
|
if (params.language) queryParams.append("language", params.language);
|
|
10205
10214
|
if (params.nominator_uuid) queryParams.append("nominator_uuid", params.nominator_uuid);
|
|
10206
10215
|
const queryString = queryParams.toString();
|
|
10207
|
-
const
|
|
10216
|
+
const purposesSuffix = `/user-consents/${productUuid}/purposes${queryString ? `?${queryString}` : ""}`;
|
|
10217
|
+
const url = useLedger ? ledgerUrl(baseRequest, purposesSuffix) : `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center${purposesSuffix}`;
|
|
10208
10218
|
return privacyCenterApiFetch(url, {
|
|
10209
10219
|
...options,
|
|
10210
10220
|
method: "GET",
|
|
@@ -10212,17 +10222,66 @@ function createConsentClient(baseUrl) {
|
|
|
10212
10222
|
});
|
|
10213
10223
|
},
|
|
10214
10224
|
/**
|
|
10215
|
-
* Manage consent (privacy center) - revoke, regrant, or renew
|
|
10225
|
+
* Manage consent (privacy center) - revoke, regrant, or renew.
|
|
10226
|
+
*
|
|
10227
|
+
* The Go ledger has no manage-consent route, so with a ledger configured
|
|
10228
|
+
* this is expressed as a `partial` submit-consent on the ledger — mirroring
|
|
10229
|
+
* the Python dual-write relay: the affected purpose is re-submitted with
|
|
10230
|
+
* `selected: false` to revoke or `selected: true` to regrant/renew, and
|
|
10231
|
+
* `partial: true` so the rest of the notice's purposes are left untouched.
|
|
10232
|
+
* The principal is resolved from the JWT, so no `contact`/identifiers are
|
|
10233
|
+
* sent in the body.
|
|
10234
|
+
*
|
|
10235
|
+
* Without a ledger, the legacy Python `/manage-consent?status=` endpoint is
|
|
10236
|
+
* used with its `{ purpose_uuid, contact, ... }` payload.
|
|
10216
10237
|
*/
|
|
10217
|
-
async manageConsent(baseRequest, purposeId, contact, status, authToken, options, nominatorContact, dataElementUuids) {
|
|
10218
|
-
|
|
10219
|
-
|
|
10220
|
-
|
|
10221
|
-
|
|
10238
|
+
async manageConsent(baseRequest, purposeId, contact, status, authToken, options, nominatorContact, dataElementUuids, noticeUuid, dataElements) {
|
|
10239
|
+
if (!useLedger) {
|
|
10240
|
+
const url2 = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/manage-consent?status=${status}`;
|
|
10241
|
+
const body2 = { purpose_uuid: purposeId, contact };
|
|
10242
|
+
if (nominatorContact) {
|
|
10243
|
+
body2.nominator_contact = nominatorContact;
|
|
10244
|
+
}
|
|
10245
|
+
if (Array.isArray(dataElementUuids) && dataElementUuids.length > 0) {
|
|
10246
|
+
body2.data_element_uuids = dataElementUuids;
|
|
10247
|
+
}
|
|
10248
|
+
return privacyCenterApiFetch(url2, {
|
|
10249
|
+
...options,
|
|
10250
|
+
method: "POST",
|
|
10251
|
+
body: JSON.stringify(body2),
|
|
10252
|
+
authToken: authToken || baseRequest.authToken
|
|
10253
|
+
});
|
|
10222
10254
|
}
|
|
10223
|
-
if (
|
|
10224
|
-
|
|
10255
|
+
if (!noticeUuid) {
|
|
10256
|
+
throw new Error("notice_uuid is required to manage consent via the ledger");
|
|
10225
10257
|
}
|
|
10258
|
+
const purposeSelected = status !== "revoke";
|
|
10259
|
+
const elements = (dataElements != null ? dataElements : []).map((de) => {
|
|
10260
|
+
let selected;
|
|
10261
|
+
if (status === "revoke") {
|
|
10262
|
+
selected = false;
|
|
10263
|
+
} else if (status === "regrant") {
|
|
10264
|
+
selected = Array.isArray(dataElementUuids) ? dataElementUuids.includes(de.uuid) : de.selected;
|
|
10265
|
+
} else {
|
|
10266
|
+
selected = de.selected;
|
|
10267
|
+
}
|
|
10268
|
+
return { uuid: de.uuid, selected };
|
|
10269
|
+
});
|
|
10270
|
+
const body = {
|
|
10271
|
+
notice_uuid: noticeUuid,
|
|
10272
|
+
partial: true,
|
|
10273
|
+
declined: false,
|
|
10274
|
+
select_all_mandatory: false,
|
|
10275
|
+
self_declared_adult: false,
|
|
10276
|
+
purposes: [
|
|
10277
|
+
{
|
|
10278
|
+
purpose_uuid: purposeId,
|
|
10279
|
+
selected: purposeSelected,
|
|
10280
|
+
data_elements: elements
|
|
10281
|
+
}
|
|
10282
|
+
]
|
|
10283
|
+
};
|
|
10284
|
+
const url = ledgerUrl(baseRequest, "/submit-consent");
|
|
10226
10285
|
return privacyCenterApiFetch(url, {
|
|
10227
10286
|
...options,
|
|
10228
10287
|
method: "POST",
|
|
@@ -10259,7 +10318,8 @@ function createConsentClient(baseUrl) {
|
|
|
10259
10318
|
if (params.notice_uuid) queryParams.append("notice_uuid", params.notice_uuid);
|
|
10260
10319
|
if (params.language) queryParams.append("language", params.language);
|
|
10261
10320
|
const queryString = queryParams.toString();
|
|
10262
|
-
const
|
|
10321
|
+
const receiptsSuffix = `/receipts${queryString ? `?${queryString}` : ""}`;
|
|
10322
|
+
const url = useLedger ? ledgerUrl(baseRequest, receiptsSuffix) : `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center${receiptsSuffix}`;
|
|
10263
10323
|
return privacyCenterApiFetch(url, {
|
|
10264
10324
|
...options,
|
|
10265
10325
|
method: "GET",
|
|
@@ -10273,7 +10333,7 @@ function createConsentClient(baseUrl) {
|
|
|
10273
10333
|
* the RN UI writes to a temp file to open/share. 404 => not found.
|
|
10274
10334
|
*/
|
|
10275
10335
|
async getReceiptPdf(baseRequest, receiptUuid, authToken) {
|
|
10276
|
-
const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/receipts/${receiptUuid}/pdf`;
|
|
10336
|
+
const url = useLedger ? ledgerUrl(baseRequest, `/receipts/${receiptUuid}/download`) : `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/receipts/${receiptUuid}/pdf`;
|
|
10277
10337
|
const token = authToken || baseRequest.authToken;
|
|
10278
10338
|
const requestHeaders = new Headers();
|
|
10279
10339
|
requestHeaders.set("Accept", "application/pdf");
|
|
@@ -10432,11 +10492,16 @@ function createConsentClient(baseUrl) {
|
|
|
10432
10492
|
// src/RedactoPrivacyCenter/context/BaseUrlContext.tsx
|
|
10433
10493
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
10434
10494
|
var BaseUrlContext = (0, import_react2.createContext)(null);
|
|
10435
|
-
function BaseUrlProvider({
|
|
10495
|
+
function BaseUrlProvider({
|
|
10496
|
+
children,
|
|
10497
|
+
baseUrl,
|
|
10498
|
+
ledgerBaseUrl
|
|
10499
|
+
}) {
|
|
10436
10500
|
const value = (0, import_react2.useMemo)(() => ({
|
|
10437
10501
|
baseUrl,
|
|
10438
|
-
|
|
10439
|
-
|
|
10502
|
+
ledgerBaseUrl,
|
|
10503
|
+
consentClient: createConsentClient(baseUrl, ledgerBaseUrl)
|
|
10504
|
+
}), [baseUrl, ledgerBaseUrl]);
|
|
10440
10505
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(BaseUrlContext.Provider, { value, children });
|
|
10441
10506
|
}
|
|
10442
10507
|
function useBaseUrl() {
|
|
@@ -10635,7 +10700,6 @@ async function fetchUserConsentsServer(params) {
|
|
|
10635
10700
|
}
|
|
10636
10701
|
}
|
|
10637
10702
|
async function manageConsentServer(params) {
|
|
10638
|
-
var _a3;
|
|
10639
10703
|
try {
|
|
10640
10704
|
if (!params.consentClient) {
|
|
10641
10705
|
throw new Error("Consent client is required");
|
|
@@ -10653,9 +10717,14 @@ async function manageConsentServer(params) {
|
|
|
10653
10717
|
params.authToken,
|
|
10654
10718
|
void 0,
|
|
10655
10719
|
params.nominatorContact,
|
|
10656
|
-
params.dataElementUuids
|
|
10720
|
+
params.dataElementUuids,
|
|
10721
|
+
params.noticeUuid,
|
|
10722
|
+
params.dataElements
|
|
10657
10723
|
);
|
|
10658
|
-
|
|
10724
|
+
if (result && typeof result === "object" && "success" in result) {
|
|
10725
|
+
return Boolean(result.success);
|
|
10726
|
+
}
|
|
10727
|
+
return true;
|
|
10659
10728
|
} catch (error) {
|
|
10660
10729
|
if (isAuthError(error)) {
|
|
10661
10730
|
throw error;
|
|
@@ -11139,7 +11208,9 @@ var manageConsent = async ({
|
|
|
11139
11208
|
authContext,
|
|
11140
11209
|
consentClient,
|
|
11141
11210
|
nominatorContact,
|
|
11142
|
-
dataElementUuids
|
|
11211
|
+
dataElementUuids,
|
|
11212
|
+
noticeUuid,
|
|
11213
|
+
dataElements
|
|
11143
11214
|
}) => {
|
|
11144
11215
|
try {
|
|
11145
11216
|
const accessToken = await ensureValidToken(organizationId, workspaceId, void 0, authContext, consentClient);
|
|
@@ -11155,7 +11226,9 @@ var manageConsent = async ({
|
|
|
11155
11226
|
authToken: accessToken,
|
|
11156
11227
|
consentClient,
|
|
11157
11228
|
nominatorContact,
|
|
11158
|
-
dataElementUuids
|
|
11229
|
+
dataElementUuids,
|
|
11230
|
+
noticeUuid,
|
|
11231
|
+
dataElements
|
|
11159
11232
|
});
|
|
11160
11233
|
return result;
|
|
11161
11234
|
} catch (error) {
|
|
@@ -11174,7 +11247,9 @@ var manageConsent = async ({
|
|
|
11174
11247
|
authToken: newAccessToken || void 0,
|
|
11175
11248
|
consentClient,
|
|
11176
11249
|
nominatorContact,
|
|
11177
|
-
dataElementUuids
|
|
11250
|
+
dataElementUuids,
|
|
11251
|
+
noticeUuid,
|
|
11252
|
+
dataElements
|
|
11178
11253
|
});
|
|
11179
11254
|
}
|
|
11180
11255
|
console.error(`Error ${action} consent:`, error);
|
|
@@ -14993,6 +15068,7 @@ function ConsentManager() {
|
|
|
14993
15068
|
}, [fetchData]);
|
|
14994
15069
|
const handleManageConsent = (0, import_react25.useCallback)(
|
|
14995
15070
|
async (purposeId, action, nominatorContact, dataElementUuids) => {
|
|
15071
|
+
var _a3, _b;
|
|
14996
15072
|
if (!organizationId || !workspaceId || !email) return;
|
|
14997
15073
|
setIsManageLoading(true);
|
|
14998
15074
|
try {
|
|
@@ -15005,7 +15081,14 @@ function ConsentManager() {
|
|
|
15005
15081
|
authContext,
|
|
15006
15082
|
consentClient,
|
|
15007
15083
|
nominatorContact,
|
|
15008
|
-
dataElementUuids
|
|
15084
|
+
dataElementUuids,
|
|
15085
|
+
// Ledger mode: the partial submit-consent needs the notice and the
|
|
15086
|
+
// purpose's data elements; both ride on the selected (ledger-served) row.
|
|
15087
|
+
noticeUuid: (_a3 = selectedRecord == null ? void 0 : selectedRecord.notice_uuid) != null ? _a3 : void 0,
|
|
15088
|
+
dataElements: (_b = selectedRecord == null ? void 0 : selectedRecord.data_elements) == null ? void 0 : _b.map((de) => ({
|
|
15089
|
+
uuid: de.uuid,
|
|
15090
|
+
selected: de.selected
|
|
15091
|
+
}))
|
|
15009
15092
|
});
|
|
15010
15093
|
setIsModalOpen(false);
|
|
15011
15094
|
setSelectedRecord(null);
|
|
@@ -15017,7 +15100,7 @@ function ConsentManager() {
|
|
|
15017
15100
|
setIsManageLoading(false);
|
|
15018
15101
|
}
|
|
15019
15102
|
},
|
|
15020
|
-
[organizationId, workspaceId, email, authContext, consentClient, fetchData, t]
|
|
15103
|
+
[organizationId, workspaceId, email, authContext, consentClient, selectedRecord, fetchData, t]
|
|
15021
15104
|
);
|
|
15022
15105
|
const handleExport = (0, import_react25.useCallback)(async () => {
|
|
15023
15106
|
if (!consentData.length) return;
|
|
@@ -20407,6 +20490,7 @@ function PrivacyCenterContent({ onBack }) {
|
|
|
20407
20490
|
}
|
|
20408
20491
|
function RedactoPrivacyCenter({
|
|
20409
20492
|
baseUrl,
|
|
20493
|
+
ledgerBaseUrl,
|
|
20410
20494
|
slug,
|
|
20411
20495
|
// `theme` is accepted for backwards compatibility but no longer used — the
|
|
20412
20496
|
// Privacy Center themes itself from per-org branding.
|
|
@@ -20418,7 +20502,7 @@ function RedactoPrivacyCenter({
|
|
|
20418
20502
|
initialCaseUuid,
|
|
20419
20503
|
onBack
|
|
20420
20504
|
}) {
|
|
20421
|
-
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(SafeAreaBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(KeyboardProviderCompat, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react_query2.QueryClientProvider, { client: privacyCenterQueryClient, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react_i18next29.I18nextProvider, { i18n: i18n_default, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ThemeProvider, { slug, baseUrl, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(BaseUrlProvider, { baseUrl, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
20505
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(SafeAreaBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(KeyboardProviderCompat, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react_query2.QueryClientProvider, { client: privacyCenterQueryClient, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react_i18next29.I18nextProvider, { i18n: i18n_default, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ThemeProvider, { slug, baseUrl, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(BaseUrlProvider, { baseUrl, ledgerBaseUrl, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
20422
20506
|
AuthProvider,
|
|
20423
20507
|
{
|
|
20424
20508
|
accessToken,
|