@redacto.io/consent-sdk-react-native 5.0.0-beta.6 → 5.0.0-beta.7

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.
@@ -9863,6 +9863,36 @@ function useSafeInsets() {
9863
9863
  // src/RedactoPrivacyCenter/context/BaseUrlContext.tsx
9864
9864
  var import_react2 = require("react");
9865
9865
 
9866
+ // src/shared/sandbox.ts
9867
+ var SANDBOX_TOKEN_HEADER = "X-Consent-Token";
9868
+
9869
+ // src/RedactoPrivacyCenter/lib/sandbox.ts
9870
+ var sandboxConfig = null;
9871
+ var setSandboxConfig = (config) => {
9872
+ sandboxConfig = config;
9873
+ };
9874
+ var getSandboxConfig = () => sandboxConfig;
9875
+ var isSandboxMode = () => sandboxConfig !== null;
9876
+ var sandboxAuthHeaders = () => {
9877
+ if (!sandboxConfig) {
9878
+ return null;
9879
+ }
9880
+ return {
9881
+ [SANDBOX_TOKEN_HEADER]: sandboxConfig.token
9882
+ };
9883
+ };
9884
+ var sandboxBodyIdentity = () => {
9885
+ if (!sandboxConfig) {
9886
+ return null;
9887
+ }
9888
+ if (sandboxConfig.ucic) {
9889
+ return { org_user_id: sandboxConfig.ucic };
9890
+ }
9891
+ return sandboxConfig.subject.includes("@") ? { primary_email: sandboxConfig.subject } : { primary_mobile: sandboxConfig.subject };
9892
+ };
9893
+ var sandboxQueryIdentity = () => sandboxBodyIdentity();
9894
+ var sandboxContact = () => sandboxConfig ? sandboxConfig.ucic || sandboxConfig.subject : null;
9895
+
9866
9896
  // src/RedactoPrivacyCenter/api/fetcher.ts
9867
9897
  async function apiFetch(url, options = {}) {
9868
9898
  const { getAuthToken, headers = {}, ...fetchOptions } = options;
@@ -9888,11 +9918,18 @@ async function apiFetch(url, options = {}) {
9888
9918
  }
9889
9919
  }
9890
9920
  if (getAuthToken) {
9891
- const token = await getAuthToken();
9892
- if (token) {
9893
- const trimmedToken = token.trim();
9894
- requestHeaders.set("X-Auth-Token", trimmedToken);
9895
- requestHeaders.set("x-auth-token", trimmedToken);
9921
+ const sandboxHeaders = sandboxAuthHeaders();
9922
+ if (sandboxHeaders) {
9923
+ Object.entries(sandboxHeaders).forEach(([key, value]) => {
9924
+ requestHeaders.set(key, value);
9925
+ });
9926
+ } else {
9927
+ const token = await getAuthToken();
9928
+ if (token) {
9929
+ const trimmedToken = token.trim();
9930
+ requestHeaders.set("X-Auth-Token", trimmedToken);
9931
+ requestHeaders.set("x-auth-token", trimmedToken);
9932
+ }
9896
9933
  }
9897
9934
  }
9898
9935
  const fetchOptionsFinal = {
@@ -9983,14 +10020,29 @@ function arrayBufferToBase64(buffer) {
9983
10020
  return result;
9984
10021
  }
9985
10022
  function createConsentClient(baseUrl, ledgerBaseUrl) {
9986
- const useLedger = Boolean(ledgerBaseUrl);
10023
+ const ledgerConfigured = Boolean(ledgerBaseUrl);
10024
+ const useLedger = () => ledgerConfigured && !isSandboxMode();
9987
10025
  const ledgerBase = (ledgerBaseUrl != null ? ledgerBaseUrl : "").replace(/\/$/, "");
9988
10026
  function ledgerUrl(baseRequest, path) {
9989
- if (!useLedger) {
10027
+ if (!useLedger()) {
9990
10028
  throw new Error("ledgerUrl called without a configured ledgerBaseUrl");
9991
10029
  }
9992
10030
  return `${ledgerBase}/public/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}${path}`;
9993
10031
  }
10032
+ function appendSandboxIdentity(queryParams) {
10033
+ const identity = sandboxQueryIdentity();
10034
+ if (identity) {
10035
+ Object.entries(identity).forEach(([key, value]) => {
10036
+ queryParams.append(key, value);
10037
+ });
10038
+ }
10039
+ }
10040
+ function sandboxIdentitySuffix() {
10041
+ const queryParams = new URLSearchParams();
10042
+ appendSandboxIdentity(queryParams);
10043
+ const queryString = queryParams.toString();
10044
+ return queryString ? `?${queryString}` : "";
10045
+ }
9994
10046
  async function privacyCenterApiFetch(url, options) {
9995
10047
  const { authToken, getAuthToken, headers = {}, ...fetchOptions } = options;
9996
10048
  const requestHeaders = new Headers();
@@ -10014,11 +10066,18 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10014
10066
  );
10015
10067
  }
10016
10068
  }
10017
- const token = authToken || (getAuthToken ? await getAuthToken() : null);
10018
- if (token) {
10019
- const trimmedToken = token.trim();
10020
- const bearerToken = trimmedToken.startsWith("Bearer ") ? trimmedToken : `Bearer ${trimmedToken}`;
10021
- requestHeaders.set("Authorization", bearerToken);
10069
+ const sandboxHeaders = sandboxAuthHeaders();
10070
+ if (sandboxHeaders) {
10071
+ Object.entries(sandboxHeaders).forEach(([key, value]) => {
10072
+ requestHeaders.set(key, value);
10073
+ });
10074
+ } else {
10075
+ const token = authToken || (getAuthToken ? await getAuthToken() : null);
10076
+ if (token) {
10077
+ const trimmedToken = token.trim();
10078
+ const bearerToken = trimmedToken.startsWith("Bearer ") ? trimmedToken : `Bearer ${trimmedToken}`;
10079
+ requestHeaders.set("Authorization", bearerToken);
10080
+ }
10022
10081
  }
10023
10082
  const fetchOptionsFinal = {
10024
10083
  ...fetchOptions,
@@ -10099,18 +10158,20 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10099
10158
  async createCaseRequest(baseRequest, payload, authToken, options) {
10100
10159
  const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/case`;
10101
10160
  const { useSessionAuth = false, getAuthToken, ...fetchOptions } = options || {};
10161
+ const contact = sandboxContact();
10162
+ const requestPayload = contact && payload && typeof payload === "object" ? { ...payload, contact } : payload;
10102
10163
  if (useSessionAuth) {
10103
10164
  return apiFetch(url, {
10104
10165
  ...fetchOptions,
10105
10166
  method: "POST",
10106
- body: JSON.stringify(payload),
10167
+ body: JSON.stringify(requestPayload),
10107
10168
  getAuthToken
10108
10169
  });
10109
10170
  }
10110
10171
  return privacyCenterApiFetch(url, {
10111
10172
  ...fetchOptions,
10112
10173
  method: "POST",
10113
- body: JSON.stringify(payload),
10174
+ body: JSON.stringify(requestPayload),
10114
10175
  authToken: authToken || baseRequest.authToken
10115
10176
  });
10116
10177
  },
@@ -10191,9 +10252,10 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10191
10252
  if (params.status) queryParams.append("status", params.status);
10192
10253
  if (params.product_uuid) queryParams.append("product_uuid", params.product_uuid);
10193
10254
  if (params.language) queryParams.append("language", params.language);
10255
+ appendSandboxIdentity(queryParams);
10194
10256
  const queryString = queryParams.toString();
10195
10257
  const consentsSuffix = `/user-consents${queryString ? `?${queryString}` : ""}`;
10196
- const url = useLedger ? ledgerUrl(baseRequest, consentsSuffix) : `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center${consentsSuffix}`;
10258
+ const url = useLedger() ? ledgerUrl(baseRequest, consentsSuffix) : `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center${consentsSuffix}`;
10197
10259
  return privacyCenterApiFetch(url, {
10198
10260
  ...options,
10199
10261
  method: "GET",
@@ -10212,9 +10274,10 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10212
10274
  if (params.search) queryParams.append("search", params.search);
10213
10275
  if (params.language) queryParams.append("language", params.language);
10214
10276
  if (params.nominator_uuid) queryParams.append("nominator_uuid", params.nominator_uuid);
10277
+ appendSandboxIdentity(queryParams);
10215
10278
  const queryString = queryParams.toString();
10216
10279
  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}`;
10280
+ const url = useLedger() ? ledgerUrl(baseRequest, purposesSuffix) : `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center${purposesSuffix}`;
10218
10281
  return privacyCenterApiFetch(url, {
10219
10282
  ...options,
10220
10283
  method: "GET",
@@ -10236,9 +10299,13 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10236
10299
  * used with its `{ purpose_uuid, contact, ... }` payload.
10237
10300
  */
10238
10301
  async manageConsent(baseRequest, purposeId, contact, status, authToken, options, nominatorContact, dataElementUuids, noticeUuid, dataElements, language) {
10239
- if (!useLedger) {
10302
+ if (!useLedger()) {
10240
10303
  const url2 = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/manage-consent?status=${status}`;
10241
- const body2 = { purpose_uuid: purposeId, contact };
10304
+ const sandboxSingleContact = sandboxContact();
10305
+ const body2 = {
10306
+ purpose_uuid: purposeId,
10307
+ contact: sandboxSingleContact != null ? sandboxSingleContact : contact
10308
+ };
10242
10309
  if (nominatorContact) {
10243
10310
  body2.nominator_contact = nominatorContact;
10244
10311
  }
@@ -10301,6 +10368,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10301
10368
  if (offset !== void 0) queryParams.append("offset", offset.toString());
10302
10369
  if (limit !== void 0) queryParams.append("limit", limit.toString());
10303
10370
  if (language) queryParams.append("language", language);
10371
+ appendSandboxIdentity(queryParams);
10304
10372
  const queryString = queryParams.toString();
10305
10373
  const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/activities${queryString ? `?${queryString}` : ""}`;
10306
10374
  return privacyCenterApiFetch(url, {
@@ -10321,9 +10389,10 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10321
10389
  if (params.created_before) queryParams.append("created_before", params.created_before);
10322
10390
  if (params.notice_uuid) queryParams.append("notice_uuid", params.notice_uuid);
10323
10391
  if (params.language) queryParams.append("language", params.language);
10392
+ appendSandboxIdentity(queryParams);
10324
10393
  const queryString = queryParams.toString();
10325
10394
  const receiptsSuffix = `/receipts${queryString ? `?${queryString}` : ""}`;
10326
- const url = useLedger ? ledgerUrl(baseRequest, receiptsSuffix) : `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center${receiptsSuffix}`;
10395
+ const url = useLedger() ? ledgerUrl(baseRequest, receiptsSuffix) : `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center${receiptsSuffix}`;
10327
10396
  return privacyCenterApiFetch(url, {
10328
10397
  ...options,
10329
10398
  method: "GET",
@@ -10337,11 +10406,16 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10337
10406
  * the RN UI writes to a temp file to open/share. 404 => not found.
10338
10407
  */
10339
10408
  async getReceiptPdf(baseRequest, receiptUuid, authToken) {
10340
- const url = useLedger ? ledgerUrl(baseRequest, `/receipts/${receiptUuid}/download`) : `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/receipts/${receiptUuid}/pdf`;
10409
+ const url = useLedger() ? ledgerUrl(baseRequest, `/receipts/${receiptUuid}/download`) : `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/receipts/${receiptUuid}/pdf`;
10341
10410
  const token = authToken || baseRequest.authToken;
10342
10411
  const requestHeaders = new Headers();
10343
10412
  requestHeaders.set("Accept", "application/pdf");
10344
- if (token) {
10413
+ const sandboxHeaders = sandboxAuthHeaders();
10414
+ if (sandboxHeaders) {
10415
+ Object.entries(sandboxHeaders).forEach(([key, value]) => {
10416
+ requestHeaders.set(key, value);
10417
+ });
10418
+ } else if (token) {
10345
10419
  const trimmedToken = token.trim();
10346
10420
  const bearerToken = trimmedToken.startsWith("Bearer ") ? trimmedToken : `Bearer ${trimmedToken}`;
10347
10421
  requestHeaders.set("Authorization", bearerToken);
@@ -10367,6 +10441,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10367
10441
  if (offset !== void 0) queryParams.append("offset", offset.toString());
10368
10442
  if (limit !== void 0) queryParams.append("limit", limit.toString());
10369
10443
  if (language) queryParams.append("language", language);
10444
+ appendSandboxIdentity(queryParams);
10370
10445
  const queryString = queryParams.toString();
10371
10446
  const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/cases?${queryString}`;
10372
10447
  return privacyCenterApiFetch(url, {
@@ -10378,7 +10453,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10378
10453
  * Get case messages (privacy center)
10379
10454
  */
10380
10455
  async getCaseMessages(baseRequest, caseUuid, authToken, options) {
10381
- const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/cases/${caseUuid}/messages`;
10456
+ const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/cases/${caseUuid}/messages${sandboxIdentitySuffix()}`;
10382
10457
  return privacyCenterApiFetch(url, {
10383
10458
  ...options,
10384
10459
  authToken: authToken || baseRequest.authToken
@@ -10388,7 +10463,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10388
10463
  * Send a message in a case (privacy center)
10389
10464
  */
10390
10465
  async sendCaseMessage(baseRequest, caseUuid, body, documentUuids, authToken, options) {
10391
- const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/cases/${caseUuid}/messages`;
10466
+ const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/cases/${caseUuid}/messages${sandboxIdentitySuffix()}`;
10392
10467
  return privacyCenterApiFetch(url, {
10393
10468
  ...options,
10394
10469
  method: "POST",
@@ -10400,7 +10475,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10400
10475
  * Upload a document for a case (privacy center)
10401
10476
  */
10402
10477
  async uploadCaseDocument(baseRequest, caseUuid, formData, authToken, options) {
10403
- const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/cases/${caseUuid}/upload-document`;
10478
+ const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/cases/${caseUuid}/upload-document${sandboxIdentitySuffix()}`;
10404
10479
  return privacyCenterApiFetch(url, {
10405
10480
  ...options,
10406
10481
  method: "POST",
@@ -10433,6 +10508,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10433
10508
  if ((params == null ? void 0 : params.limit) !== void 0) queryParams.append("limit", params.limit.toString());
10434
10509
  if (params == null ? void 0 : params.include_summary) queryParams.append("include_summary", "true");
10435
10510
  if (params == null ? void 0 : params.language) queryParams.append("language", params.language);
10511
+ appendSandboxIdentity(queryParams);
10436
10512
  const queryString = queryParams.toString();
10437
10513
  const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/notifications/${queryString ? `?${queryString}` : ""}`;
10438
10514
  return privacyCenterApiFetch(url, {
@@ -10444,7 +10520,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10444
10520
  * Get notification summary (aggregated counts only)
10445
10521
  */
10446
10522
  async getNotificationSummary(baseRequest, authToken) {
10447
- const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/notifications/summary`;
10523
+ const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/notifications/summary${sandboxIdentitySuffix()}`;
10448
10524
  return privacyCenterApiFetch(url, {
10449
10525
  method: "GET",
10450
10526
  authToken: authToken || baseRequest.authToken
@@ -10454,7 +10530,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10454
10530
  * Get unread notification count (lightweight, for the header badge)
10455
10531
  */
10456
10532
  async getUnreadCount(baseRequest, authToken) {
10457
- const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/notifications/unread-count`;
10533
+ const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/notifications/unread-count${sandboxIdentitySuffix()}`;
10458
10534
  return privacyCenterApiFetch(url, {
10459
10535
  method: "GET",
10460
10536
  authToken: authToken || baseRequest.authToken
@@ -10464,7 +10540,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10464
10540
  * Mark a single notification as read
10465
10541
  */
10466
10542
  async markNotificationRead(baseRequest, notificationUuid, authToken) {
10467
- const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/notifications/${notificationUuid}/read`;
10543
+ const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/notifications/${notificationUuid}/read${sandboxIdentitySuffix()}`;
10468
10544
  return privacyCenterApiFetch(url, {
10469
10545
  method: "PATCH",
10470
10546
  authToken: authToken || baseRequest.authToken
@@ -10474,7 +10550,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10474
10550
  * Mark all notifications as read
10475
10551
  */
10476
10552
  async markAllNotificationsRead(baseRequest, authToken) {
10477
- const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/notifications/mark-all-read`;
10553
+ const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/notifications/mark-all-read${sandboxIdentitySuffix()}`;
10478
10554
  return privacyCenterApiFetch(url, {
10479
10555
  method: "POST",
10480
10556
  authToken: authToken || baseRequest.authToken
@@ -10484,7 +10560,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10484
10560
  * Acknowledge a notification (sets is_read and is_acknowledged to true)
10485
10561
  */
10486
10562
  async acknowledgeNotification(baseRequest, notificationUuid, authToken) {
10487
- const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/notifications/${notificationUuid}/acknowledge`;
10563
+ const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/notifications/${notificationUuid}/acknowledge${sandboxIdentitySuffix()}`;
10488
10564
  return privacyCenterApiFetch(url, {
10489
10565
  method: "POST",
10490
10566
  authToken: authToken || baseRequest.authToken
@@ -11677,6 +11753,10 @@ var compareEmails = (email1, email2) => {
11677
11753
  return decodeURIComponent(email1.trim()).toLowerCase() === email2.trim().toLowerCase();
11678
11754
  };
11679
11755
  var ensureValidToken = async (organizationId, workspaceId, _slug, authContext, consentClient) => {
11756
+ const sandbox = getSandboxConfig();
11757
+ if (sandbox) {
11758
+ return sandbox.token;
11759
+ }
11680
11760
  const accessToken = (authContext == null ? void 0 : authContext.accessToken) || getStoredValue("access_token");
11681
11761
  if (accessToken && typeof accessToken === "string" && accessToken.trim() !== "" && !isJwtExpired(accessToken, TOKEN_EXPIRY_BUFFER_SECONDS)) {
11682
11762
  return accessToken;
@@ -11814,15 +11894,73 @@ function syncJwtDataToStore(token) {
11814
11894
  if (authData.workspaceId) setStoredValue("pc_workspace_id", authData.workspaceId);
11815
11895
  return authData;
11816
11896
  }
11817
- function AuthProvider({ children, accessToken: initialAccessToken, refreshToken: initialRefreshToken, onError }) {
11818
- const initialAuth = extractJwtAuthData(initialAccessToken);
11897
+ function configureSandbox(props) {
11898
+ var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
11899
+ const token = (_a3 = props.token) == null ? void 0 : _a3.trim();
11900
+ if (!token) {
11901
+ setSandboxConfig(null);
11902
+ return null;
11903
+ }
11904
+ const organisationUuid = (_c = (_b = props.organisationUuid) == null ? void 0 : _b.trim()) != null ? _c : "";
11905
+ const workspaceUuid = (_e = (_d = props.workspaceUuid) == null ? void 0 : _d.trim()) != null ? _e : "";
11906
+ const ucic = (_g = (_f = props.sandboxUcic) == null ? void 0 : _f.trim()) != null ? _g : "";
11907
+ const subject = (_i = (_h = props.sandboxSubject) == null ? void 0 : _h.trim()) != null ? _i : "";
11908
+ const slug = (_k = (_j = props.slug) == null ? void 0 : _j.trim()) != null ? _k : "";
11909
+ if (!organisationUuid || !workspaceUuid) {
11910
+ throw new Error("Sandbox mode requires organisationUuid and workspaceUuid props");
11911
+ }
11912
+ if (!ucic && !subject) {
11913
+ throw new Error("Sandbox mode requires a UCIC, email, or mobile");
11914
+ }
11915
+ setSandboxConfig({
11916
+ token,
11917
+ ucic: ucic || void 0,
11918
+ subject,
11919
+ organisationUuid,
11920
+ workspaceUuid,
11921
+ slug
11922
+ });
11923
+ const contact = ucic || subject;
11924
+ setStoredValue("access_token", token);
11925
+ if (organisationUuid) setStoredValue("pc_org_id", organisationUuid);
11926
+ if (workspaceUuid) setStoredValue("pc_workspace_id", workspaceUuid);
11927
+ if (contact) setStoredValue("email", contact);
11928
+ return {
11929
+ email: contact || null,
11930
+ organizationId: organisationUuid || null,
11931
+ workspaceId: workspaceUuid || null,
11932
+ organizationName: null
11933
+ };
11934
+ }
11935
+ function AuthProvider(props) {
11936
+ const {
11937
+ children,
11938
+ accessToken: initialAccessToken,
11939
+ refreshToken: initialRefreshToken,
11940
+ token: sandboxToken,
11941
+ sandboxUcic,
11942
+ sandboxSubject,
11943
+ organisationUuid,
11944
+ workspaceUuid,
11945
+ slug,
11946
+ onError
11947
+ } = props;
11948
+ const [sandboxAuth] = (0, import_react3.useState)(() => configureSandbox(props));
11949
+ const sandboxActive = sandboxAuth !== null;
11950
+ const initialAuth = sandboxAuth != null ? sandboxAuth : extractJwtAuthData(initialAccessToken);
11819
11951
  const [accessToken, setAccessToken] = (0, import_react3.useState)(() => {
11952
+ if (sandboxActive) {
11953
+ return sandboxToken != null ? sandboxToken : "";
11954
+ }
11820
11955
  if (initialAccessToken && initialAccessToken.trim() !== "") {
11821
11956
  syncJwtDataToStore(initialAccessToken);
11822
11957
  }
11823
11958
  return initialAccessToken;
11824
11959
  });
11825
11960
  const [refreshToken, setRefreshToken] = (0, import_react3.useState)(() => {
11961
+ if (sandboxActive) {
11962
+ return "";
11963
+ }
11826
11964
  if (initialRefreshToken && initialRefreshToken.trim() !== "") {
11827
11965
  setStoredValue("refresh_token", initialRefreshToken);
11828
11966
  }
@@ -11833,6 +11971,20 @@ function AuthProvider({ children, accessToken: initialAccessToken, refreshToken:
11833
11971
  const [workspaceId, setWorkspaceId] = (0, import_react3.useState)(initialAuth.workspaceId);
11834
11972
  const [organizationName, setOrganizationName] = (0, import_react3.useState)(initialAuth.organizationName);
11835
11973
  (0, import_react3.useEffect)(() => {
11974
+ if (!sandboxActive) {
11975
+ return;
11976
+ }
11977
+ const seeded = configureSandbox(props);
11978
+ if (seeded) {
11979
+ setEmail(seeded.email);
11980
+ setOrganizationId(seeded.organizationId);
11981
+ setWorkspaceId(seeded.workspaceId);
11982
+ setOrganizationName(seeded.organizationName);
11983
+ }
11984
+ return () => setSandboxConfig(null);
11985
+ }, [sandboxActive, sandboxToken, sandboxUcic, sandboxSubject, organisationUuid, workspaceUuid, slug]);
11986
+ (0, import_react3.useEffect)(() => {
11987
+ if (sandboxActive) return;
11836
11988
  if (accessToken) {
11837
11989
  const authData = syncJwtDataToStore(accessToken);
11838
11990
  setEmail(authData.email);
@@ -11840,11 +11992,13 @@ function AuthProvider({ children, accessToken: initialAccessToken, refreshToken:
11840
11992
  setWorkspaceId(authData.workspaceId);
11841
11993
  setOrganizationName(authData.organizationName);
11842
11994
  }
11843
- }, [accessToken]);
11995
+ }, [accessToken, sandboxActive]);
11844
11996
  (0, import_react3.useEffect)(() => {
11997
+ if (sandboxActive) return;
11845
11998
  if (refreshToken) setStoredValue("refresh_token", refreshToken);
11846
- }, [refreshToken]);
11999
+ }, [refreshToken, sandboxActive]);
11847
12000
  (0, import_react3.useEffect)(() => {
12001
+ if (sandboxActive) return;
11848
12002
  setAccessToken(initialAccessToken);
11849
12003
  if (initialAccessToken && initialAccessToken.trim() !== "") {
11850
12004
  const authData = syncJwtDataToStore(initialAccessToken);
@@ -11853,10 +12007,11 @@ function AuthProvider({ children, accessToken: initialAccessToken, refreshToken:
11853
12007
  setWorkspaceId(authData.workspaceId);
11854
12008
  setOrganizationName(authData.organizationName);
11855
12009
  }
11856
- }, [initialAccessToken]);
12010
+ }, [initialAccessToken, sandboxActive]);
11857
12011
  (0, import_react3.useEffect)(() => {
12012
+ if (sandboxActive) return;
11858
12013
  setRefreshToken(initialRefreshToken);
11859
- }, [initialRefreshToken]);
12014
+ }, [initialRefreshToken, sandboxActive]);
11860
12015
  const updateTokens = (0, import_react3.useCallback)((newAccessToken, newRefreshToken) => {
11861
12016
  setAccessToken(newAccessToken);
11862
12017
  if (newRefreshToken) setRefreshToken(newRefreshToken);
@@ -14128,7 +14283,7 @@ var import_react_i18next11 = require("react-i18next");
14128
14283
 
14129
14284
  // src/RedactoPrivacyCenter/lib/consentManagerUtils.ts
14130
14285
  function purposeItemToUserConsent(purpose, group) {
14131
- var _a3, _b, _c, _d;
14286
+ var _a3, _b, _c, _d, _e;
14132
14287
  return {
14133
14288
  purpose_uuid: purpose.purpose_uuid,
14134
14289
  purpose: purpose.name,
@@ -14142,6 +14297,7 @@ function purposeItemToUserConsent(purpose, group) {
14142
14297
  product_name: group.product_name,
14143
14298
  product_description: group.product_description,
14144
14299
  nominator_info: (_d = group.nominator) != null ? _d : void 0,
14300
+ revoke_warning_message: (_e = purpose.revoke_warning_message) != null ? _e : null,
14145
14301
  notice_uuid: purpose.notice_uuid
14146
14302
  };
14147
14303
  }
@@ -14439,7 +14595,7 @@ var ModifyConsentModal = ({
14439
14595
  action: "revoke",
14440
14596
  buttonLabel: t("revokeConsent"),
14441
14597
  buttonColor: colors.error,
14442
- warningMessage: t("revokeConsentWarning"),
14598
+ warningMessage: selectedRecord.revoke_warning_message || t("revokeConsentWarning"),
14443
14599
  description: nominatorLabel ? t("aboutToModifyConsentOnBehalf", { nominator: nominatorLabel }) : t("aboutToModifyConsent")
14444
14600
  };
14445
14601
  }
@@ -20652,6 +20808,12 @@ function RedactoPrivacyCenter({
20652
20808
  theme: _theme,
20653
20809
  accessToken,
20654
20810
  refreshToken,
20811
+ token,
20812
+ email,
20813
+ mobile,
20814
+ ucic,
20815
+ organisationUuid,
20816
+ workspaceUuid,
20655
20817
  onError,
20656
20818
  initialPage = "home",
20657
20819
  initialCaseUuid,
@@ -20660,8 +20822,14 @@ function RedactoPrivacyCenter({
20660
20822
  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)(
20661
20823
  AuthProvider,
20662
20824
  {
20663
- accessToken,
20664
- refreshToken,
20825
+ accessToken: accessToken != null ? accessToken : "",
20826
+ refreshToken: refreshToken != null ? refreshToken : "",
20827
+ token,
20828
+ sandboxUcic: ucic,
20829
+ sandboxSubject: email || mobile,
20830
+ organisationUuid,
20831
+ workspaceUuid,
20832
+ slug,
20665
20833
  onError,
20666
20834
  children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(NavigationProvider, { initialPage, initialPendingCaseUuid: initialCaseUuid != null ? initialCaseUuid : null, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DataAvailabilityProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(PageStatusProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(PrivacyCenterContent, { onBack }) }) }) })
20667
20835
  }