@redacto.io/consent-sdk-react-native 5.0.0 → 5.0.1-beta.1

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.
@@ -395,6 +395,8 @@ type ManageConsentParams = {
395
395
  dataElementUuids?: string[];
396
396
  };
397
397
  type Activity = {
398
+ /** Stable per-activity id (source event/case uuid) for list keys and de-duplication. */
399
+ id?: string;
398
400
  activity_type: string;
399
401
  activity_type_display?: string;
400
402
  timestamp: string;
@@ -691,8 +693,15 @@ declare function createConsentClient(baseUrl: string, ledgerBaseUrl?: string): {
691
693
  createOtp(organisationId: string, workspaceId: string, email: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
692
694
  /**
693
695
  * Verify OTP (public)
696
+ *
697
+ * Defaults to `purpose: "login"` — the branch the backend uses to mint an
698
+ * `auth`-scoped token (and to resolve shared-contact principals via the
699
+ * ledger). `purpose: "consent"` is reserved for consent flows. A login that
700
+ * omits the purpose falls back server-side to `purpose: "consent"`, which
701
+ * mints a scope-less notice token — every `/dsar/privacy-center/*` endpoint
702
+ * then rejects it with 403 "Token scope is not permitted".
694
703
  */
695
- verifyOtp(organisationId: string, workspaceId: string, otpId: string, otp: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
704
+ verifyOtp(organisationId: string, workspaceId: string, otpId: string, otp: string, options?: Omit<ApiFetchOptions, "getAuthToken">, purpose?: "login" | "consent"): Promise<unknown>;
696
705
  /**
697
706
  * Exchange one-time token for JWT tokens (public)
698
707
  */
@@ -943,10 +952,12 @@ interface AuthProviderProps {
943
952
  * payload, and never calls `/otp/refresh`.
944
953
  */
945
954
  token?: string;
946
- /** Sandbox UCIC — the client's own user id (`org_user_id`); takes precedence over the subject. */
955
+ /** Sandbox UCIC — the client's own user id (`org_user_id`); takes precedence for the principal. */
947
956
  sandboxUcic?: string;
948
- /** Sandbox subject (email or mobile) — carried in the request payload. */
949
- sandboxSubject?: string;
957
+ /** Sandbox email — carried on every request, like a live JWT's `user_data.primary_email`. */
958
+ sandboxEmail?: string;
959
+ /** Sandbox mobile — carried on every request, like a live JWT's `user_data.primary_mobile`. */
960
+ sandboxMobile?: string;
950
961
  /** Sandbox org UUID (replaces the JWT-decoded org). */
951
962
  organisationUuid?: string;
952
963
  /** Sandbox workspace UUID (replaces the JWT-decoded workspace). */
@@ -395,6 +395,8 @@ type ManageConsentParams = {
395
395
  dataElementUuids?: string[];
396
396
  };
397
397
  type Activity = {
398
+ /** Stable per-activity id (source event/case uuid) for list keys and de-duplication. */
399
+ id?: string;
398
400
  activity_type: string;
399
401
  activity_type_display?: string;
400
402
  timestamp: string;
@@ -691,8 +693,15 @@ declare function createConsentClient(baseUrl: string, ledgerBaseUrl?: string): {
691
693
  createOtp(organisationId: string, workspaceId: string, email: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
692
694
  /**
693
695
  * Verify OTP (public)
696
+ *
697
+ * Defaults to `purpose: "login"` — the branch the backend uses to mint an
698
+ * `auth`-scoped token (and to resolve shared-contact principals via the
699
+ * ledger). `purpose: "consent"` is reserved for consent flows. A login that
700
+ * omits the purpose falls back server-side to `purpose: "consent"`, which
701
+ * mints a scope-less notice token — every `/dsar/privacy-center/*` endpoint
702
+ * then rejects it with 403 "Token scope is not permitted".
694
703
  */
695
- verifyOtp(organisationId: string, workspaceId: string, otpId: string, otp: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
704
+ verifyOtp(organisationId: string, workspaceId: string, otpId: string, otp: string, options?: Omit<ApiFetchOptions, "getAuthToken">, purpose?: "login" | "consent"): Promise<unknown>;
696
705
  /**
697
706
  * Exchange one-time token for JWT tokens (public)
698
707
  */
@@ -943,10 +952,12 @@ interface AuthProviderProps {
943
952
  * payload, and never calls `/otp/refresh`.
944
953
  */
945
954
  token?: string;
946
- /** Sandbox UCIC — the client's own user id (`org_user_id`); takes precedence over the subject. */
955
+ /** Sandbox UCIC — the client's own user id (`org_user_id`); takes precedence for the principal. */
947
956
  sandboxUcic?: string;
948
- /** Sandbox subject (email or mobile) — carried in the request payload. */
949
- sandboxSubject?: string;
957
+ /** Sandbox email — carried on every request, like a live JWT's `user_data.primary_email`. */
958
+ sandboxEmail?: string;
959
+ /** Sandbox mobile — carried on every request, like a live JWT's `user_data.primary_mobile`. */
960
+ sandboxMobile?: string;
950
961
  /** Sandbox org UUID (replaces the JWT-decoded org). */
951
962
  organisationUuid?: string;
952
963
  /** Sandbox workspace UUID (replaces the JWT-decoded workspace). */
@@ -10046,13 +10046,20 @@ var sandboxBodyIdentity = () => {
10046
10046
  if (!sandboxConfig) {
10047
10047
  return null;
10048
10048
  }
10049
+ const payload = {};
10049
10050
  if (sandboxConfig.ucic) {
10050
- return { org_user_id: sandboxConfig.ucic };
10051
+ payload.org_user_id = sandboxConfig.ucic;
10051
10052
  }
10052
- return sandboxConfig.subject.includes("@") ? { primary_email: sandboxConfig.subject } : { primary_mobile: sandboxConfig.subject };
10053
+ if (sandboxConfig.email) {
10054
+ payload.primary_email = sandboxConfig.email;
10055
+ }
10056
+ if (sandboxConfig.mobile) {
10057
+ payload.primary_mobile = sandboxConfig.mobile;
10058
+ }
10059
+ return payload;
10053
10060
  };
10054
10061
  var sandboxQueryIdentity = () => sandboxBodyIdentity();
10055
- var sandboxContact = () => sandboxConfig ? sandboxConfig.ucic || sandboxConfig.subject : null;
10062
+ var sandboxContact = () => sandboxConfig ? sandboxConfig.ucic || sandboxConfig.email || sandboxConfig.mobile || null : null;
10056
10063
 
10057
10064
  // src/RedactoPrivacyCenter/api/fetcher.ts
10058
10065
  var ApiError = class _ApiError extends Error {
@@ -10214,7 +10221,9 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10214
10221
  const identity = sandboxQueryIdentity();
10215
10222
  if (identity) {
10216
10223
  Object.entries(identity).forEach(([key, value]) => {
10217
- queryParams.append(key, value);
10224
+ if (value) {
10225
+ queryParams.append(key, value);
10226
+ }
10218
10227
  });
10219
10228
  }
10220
10229
  }
@@ -10369,13 +10378,20 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10369
10378
  },
10370
10379
  /**
10371
10380
  * Verify OTP (public)
10381
+ *
10382
+ * Defaults to `purpose: "login"` — the branch the backend uses to mint an
10383
+ * `auth`-scoped token (and to resolve shared-contact principals via the
10384
+ * ledger). `purpose: "consent"` is reserved for consent flows. A login that
10385
+ * omits the purpose falls back server-side to `purpose: "consent"`, which
10386
+ * mints a scope-less notice token — every `/dsar/privacy-center/*` endpoint
10387
+ * then rejects it with 403 "Token scope is not permitted".
10372
10388
  */
10373
- async verifyOtp(organisationId, workspaceId, otpId, otp, options) {
10389
+ async verifyOtp(organisationId, workspaceId, otpId, otp, options, purpose = "login") {
10374
10390
  const url = `${baseUrl}/public/organisations/${organisationId}/workspaces/${workspaceId}/otp/verify`;
10375
10391
  return apiFetch(url, {
10376
10392
  ...options,
10377
10393
  method: "POST",
10378
- body: JSON.stringify({ uuid: otpId, otp })
10394
+ body: JSON.stringify({ uuid: otpId, otp, purpose })
10379
10395
  });
10380
10396
  },
10381
10397
  /**
@@ -10613,7 +10629,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10613
10629
  * the RN UI writes to a temp file to open/share. 404 => not found.
10614
10630
  */
10615
10631
  async getReceiptPdf(baseRequest, receiptUuid, authToken) {
10616
- const url = useLedger() ? ledgerUrl(baseRequest, `/receipts/${receiptUuid}/download`) : `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/receipts/${receiptUuid}/pdf`;
10632
+ const url = useLedger() ? ledgerUrl(baseRequest, `/receipts/${receiptUuid}/download`) : `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/receipts/${receiptUuid}/pdf${sandboxIdentitySuffix()}`;
10617
10633
  const token = authToken || baseRequest.authToken;
10618
10634
  const requestHeaders = new Headers();
10619
10635
  requestHeaders.set("Accept", "application/pdf");
@@ -10694,7 +10710,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10694
10710
  * Submit a document for a document request (privacy center)
10695
10711
  */
10696
10712
  async submitDocumentForRequest(baseRequest, caseUuid, requestEventUuid, documentUuid, body, authToken, options) {
10697
- const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/cases/${caseUuid}/document-requests/${requestEventUuid}/submit`;
10713
+ const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/cases/${caseUuid}/document-requests/${requestEventUuid}/submit${sandboxIdentitySuffix()}`;
10698
10714
  return privacyCenterApiFetch(url, {
10699
10715
  ...options,
10700
10716
  method: "POST",
@@ -12178,7 +12194,7 @@ function syncJwtDataToStore(token) {
12178
12194
  return authData;
12179
12195
  }
12180
12196
  function configureSandbox(props) {
12181
- var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
12197
+ var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
12182
12198
  const token = (_a3 = props.token) == null ? void 0 : _a3.trim();
12183
12199
  if (!token) {
12184
12200
  setSandboxConfig(null);
@@ -12187,23 +12203,25 @@ function configureSandbox(props) {
12187
12203
  const organisationUuid = (_c = (_b = props.organisationUuid) == null ? void 0 : _b.trim()) != null ? _c : "";
12188
12204
  const workspaceUuid = (_e = (_d = props.workspaceUuid) == null ? void 0 : _d.trim()) != null ? _e : "";
12189
12205
  const ucic = (_g = (_f = props.sandboxUcic) == null ? void 0 : _f.trim()) != null ? _g : "";
12190
- const subject = (_i = (_h = props.sandboxSubject) == null ? void 0 : _h.trim()) != null ? _i : "";
12191
- const slug = (_k = (_j = props.slug) == null ? void 0 : _j.trim()) != null ? _k : "";
12206
+ const email = (_i = (_h = props.sandboxEmail) == null ? void 0 : _h.trim()) != null ? _i : "";
12207
+ const mobile = (_k = (_j = props.sandboxMobile) == null ? void 0 : _j.trim()) != null ? _k : "";
12208
+ const slug = (_m = (_l = props.slug) == null ? void 0 : _l.trim()) != null ? _m : "";
12192
12209
  if (!organisationUuid || !workspaceUuid) {
12193
12210
  throw new Error("Sandbox mode requires organisationUuid and workspaceUuid props");
12194
12211
  }
12195
- if (!ucic && !subject) {
12212
+ if (!ucic && !email && !mobile) {
12196
12213
  throw new Error("Sandbox mode requires a UCIC, email, or mobile");
12197
12214
  }
12198
12215
  setSandboxConfig({
12199
12216
  token,
12200
12217
  ucic: ucic || void 0,
12201
- subject,
12218
+ email: email || void 0,
12219
+ mobile: mobile || void 0,
12202
12220
  organisationUuid,
12203
12221
  workspaceUuid,
12204
12222
  slug
12205
12223
  });
12206
- const contact = ucic || subject;
12224
+ const contact = ucic || email || mobile;
12207
12225
  setStoredValue("access_token", token);
12208
12226
  if (organisationUuid) setStoredValue("pc_org_id", organisationUuid);
12209
12227
  if (workspaceUuid) setStoredValue("pc_workspace_id", workspaceUuid);
@@ -12222,7 +12240,8 @@ function AuthProvider(props) {
12222
12240
  refreshToken: initialRefreshToken,
12223
12241
  token: sandboxToken,
12224
12242
  sandboxUcic,
12225
- sandboxSubject,
12243
+ sandboxEmail,
12244
+ sandboxMobile,
12226
12245
  organisationUuid,
12227
12246
  workspaceUuid,
12228
12247
  slug,
@@ -12265,7 +12284,7 @@ function AuthProvider(props) {
12265
12284
  setOrganizationName(seeded.organizationName);
12266
12285
  }
12267
12286
  return () => setSandboxConfig(null);
12268
- }, [sandboxActive, sandboxToken, sandboxUcic, sandboxSubject, organisationUuid, workspaceUuid, slug]);
12287
+ }, [sandboxActive, sandboxToken, sandboxUcic, sandboxEmail, sandboxMobile, organisationUuid, workspaceUuid, slug]);
12269
12288
  (0, import_react3.useEffect)(() => {
12270
12289
  if (sandboxActive) return;
12271
12290
  if (accessToken) {
@@ -16014,7 +16033,7 @@ function ActivitiesList() {
16014
16033
  {
16015
16034
  data: activities,
16016
16035
  style: { backgroundColor: colors.canvasSubtle },
16017
- keyExtractor: (item, idx) => `${item.case_id || item.timestamp}-${idx}`,
16036
+ keyExtractor: (item, idx) => item.id || `${item.case_id || item.timestamp}-${idx}`,
16018
16037
  onEndReached: handleLoadMore,
16019
16038
  onEndReachedThreshold: 0.3,
16020
16039
  contentContainerStyle: [styles30.content, { flexGrow: 1, paddingBottom: listBottom }],
@@ -16560,27 +16579,38 @@ var uploadFileWithS2S = async ({
16560
16579
  authToken,
16561
16580
  baseUrl
16562
16581
  }) => {
16582
+ var _a3;
16563
16583
  try {
16564
- if (!authToken) {
16565
- throw new Error("Auth token is required for document upload");
16566
- }
16567
16584
  if (!baseUrl) {
16568
16585
  throw new Error("Base URL is required for document upload");
16569
16586
  }
16570
- const decodedToken = decodeJwtToken(authToken);
16571
- if (!decodedToken) {
16572
- throw new Error("Invalid access token");
16573
- }
16574
- const { organisation_uuid, workspace_uuid } = decodedToken;
16575
- if (!organisation_uuid || !workspace_uuid) {
16576
- throw new Error("Invalid token: missing organization or workspace UUID");
16587
+ const sandbox = getSandboxConfig();
16588
+ let organisation_uuid;
16589
+ let workspace_uuid;
16590
+ let authHeaders;
16591
+ if (sandbox) {
16592
+ organisation_uuid = sandbox.organisationUuid;
16593
+ workspace_uuid = sandbox.workspaceUuid;
16594
+ authHeaders = (_a3 = sandboxAuthHeaders()) != null ? _a3 : {};
16595
+ } else {
16596
+ if (!authToken) {
16597
+ throw new Error("Auth token is required for document upload");
16598
+ }
16599
+ const decodedToken = decodeJwtToken(authToken);
16600
+ if (!decodedToken) {
16601
+ throw new Error("Invalid access token");
16602
+ }
16603
+ if (!decodedToken.organisation_uuid || !decodedToken.workspace_uuid) {
16604
+ throw new Error("Invalid token: missing organization or workspace UUID");
16605
+ }
16606
+ organisation_uuid = decodedToken.organisation_uuid;
16607
+ workspace_uuid = decodedToken.workspace_uuid;
16608
+ authHeaders = { Authorization: `Bearer ${authToken}` };
16577
16609
  }
16578
16610
  const url = `${baseUrl}/organisations/${organisation_uuid}/workspaces/${workspace_uuid}/dsar/privacy-center/upload-document`;
16579
16611
  const response = await fetch(url, {
16580
16612
  method: "POST",
16581
- headers: {
16582
- "Authorization": `Bearer ${authToken}`
16583
- },
16613
+ headers: authHeaders,
16584
16614
  body: formData
16585
16615
  });
16586
16616
  if (!response.ok) {
@@ -21413,7 +21443,8 @@ function RedactoPrivacyCenter({
21413
21443
  refreshToken: refreshToken != null ? refreshToken : "",
21414
21444
  token,
21415
21445
  sandboxUcic: ucic,
21416
- sandboxSubject: email || mobile,
21446
+ sandboxEmail: email,
21447
+ sandboxMobile: mobile,
21417
21448
  organisationUuid,
21418
21449
  workspaceUuid,
21419
21450
  slug,
@@ -9931,13 +9931,20 @@ var sandboxBodyIdentity = () => {
9931
9931
  if (!sandboxConfig) {
9932
9932
  return null;
9933
9933
  }
9934
+ const payload = {};
9934
9935
  if (sandboxConfig.ucic) {
9935
- return { org_user_id: sandboxConfig.ucic };
9936
+ payload.org_user_id = sandboxConfig.ucic;
9936
9937
  }
9937
- return sandboxConfig.subject.includes("@") ? { primary_email: sandboxConfig.subject } : { primary_mobile: sandboxConfig.subject };
9938
+ if (sandboxConfig.email) {
9939
+ payload.primary_email = sandboxConfig.email;
9940
+ }
9941
+ if (sandboxConfig.mobile) {
9942
+ payload.primary_mobile = sandboxConfig.mobile;
9943
+ }
9944
+ return payload;
9938
9945
  };
9939
9946
  var sandboxQueryIdentity = () => sandboxBodyIdentity();
9940
- var sandboxContact = () => sandboxConfig ? sandboxConfig.ucic || sandboxConfig.subject : null;
9947
+ var sandboxContact = () => sandboxConfig ? sandboxConfig.ucic || sandboxConfig.email || sandboxConfig.mobile || null : null;
9941
9948
 
9942
9949
  // src/RedactoPrivacyCenter/api/fetcher.ts
9943
9950
  var ApiError = class _ApiError extends Error {
@@ -10099,7 +10106,9 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10099
10106
  const identity = sandboxQueryIdentity();
10100
10107
  if (identity) {
10101
10108
  Object.entries(identity).forEach(([key, value]) => {
10102
- queryParams.append(key, value);
10109
+ if (value) {
10110
+ queryParams.append(key, value);
10111
+ }
10103
10112
  });
10104
10113
  }
10105
10114
  }
@@ -10254,13 +10263,20 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10254
10263
  },
10255
10264
  /**
10256
10265
  * Verify OTP (public)
10266
+ *
10267
+ * Defaults to `purpose: "login"` — the branch the backend uses to mint an
10268
+ * `auth`-scoped token (and to resolve shared-contact principals via the
10269
+ * ledger). `purpose: "consent"` is reserved for consent flows. A login that
10270
+ * omits the purpose falls back server-side to `purpose: "consent"`, which
10271
+ * mints a scope-less notice token — every `/dsar/privacy-center/*` endpoint
10272
+ * then rejects it with 403 "Token scope is not permitted".
10257
10273
  */
10258
- async verifyOtp(organisationId, workspaceId, otpId, otp, options) {
10274
+ async verifyOtp(organisationId, workspaceId, otpId, otp, options, purpose = "login") {
10259
10275
  const url = `${baseUrl}/public/organisations/${organisationId}/workspaces/${workspaceId}/otp/verify`;
10260
10276
  return apiFetch(url, {
10261
10277
  ...options,
10262
10278
  method: "POST",
10263
- body: JSON.stringify({ uuid: otpId, otp })
10279
+ body: JSON.stringify({ uuid: otpId, otp, purpose })
10264
10280
  });
10265
10281
  },
10266
10282
  /**
@@ -10498,7 +10514,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10498
10514
  * the RN UI writes to a temp file to open/share. 404 => not found.
10499
10515
  */
10500
10516
  async getReceiptPdf(baseRequest, receiptUuid, authToken) {
10501
- const url = useLedger() ? ledgerUrl(baseRequest, `/receipts/${receiptUuid}/download`) : `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/receipts/${receiptUuid}/pdf`;
10517
+ const url = useLedger() ? ledgerUrl(baseRequest, `/receipts/${receiptUuid}/download`) : `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/receipts/${receiptUuid}/pdf${sandboxIdentitySuffix()}`;
10502
10518
  const token = authToken || baseRequest.authToken;
10503
10519
  const requestHeaders = new Headers();
10504
10520
  requestHeaders.set("Accept", "application/pdf");
@@ -10579,7 +10595,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10579
10595
  * Submit a document for a document request (privacy center)
10580
10596
  */
10581
10597
  async submitDocumentForRequest(baseRequest, caseUuid, requestEventUuid, documentUuid, body, authToken, options) {
10582
- const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/cases/${caseUuid}/document-requests/${requestEventUuid}/submit`;
10598
+ const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/cases/${caseUuid}/document-requests/${requestEventUuid}/submit${sandboxIdentitySuffix()}`;
10583
10599
  return privacyCenterApiFetch(url, {
10584
10600
  ...options,
10585
10601
  method: "POST",
@@ -12063,7 +12079,7 @@ function syncJwtDataToStore(token) {
12063
12079
  return authData;
12064
12080
  }
12065
12081
  function configureSandbox(props) {
12066
- var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
12082
+ var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
12067
12083
  const token = (_a3 = props.token) == null ? void 0 : _a3.trim();
12068
12084
  if (!token) {
12069
12085
  setSandboxConfig(null);
@@ -12072,23 +12088,25 @@ function configureSandbox(props) {
12072
12088
  const organisationUuid = (_c = (_b = props.organisationUuid) == null ? void 0 : _b.trim()) != null ? _c : "";
12073
12089
  const workspaceUuid = (_e = (_d = props.workspaceUuid) == null ? void 0 : _d.trim()) != null ? _e : "";
12074
12090
  const ucic = (_g = (_f = props.sandboxUcic) == null ? void 0 : _f.trim()) != null ? _g : "";
12075
- const subject = (_i = (_h = props.sandboxSubject) == null ? void 0 : _h.trim()) != null ? _i : "";
12076
- const slug = (_k = (_j = props.slug) == null ? void 0 : _j.trim()) != null ? _k : "";
12091
+ const email = (_i = (_h = props.sandboxEmail) == null ? void 0 : _h.trim()) != null ? _i : "";
12092
+ const mobile = (_k = (_j = props.sandboxMobile) == null ? void 0 : _j.trim()) != null ? _k : "";
12093
+ const slug = (_m = (_l = props.slug) == null ? void 0 : _l.trim()) != null ? _m : "";
12077
12094
  if (!organisationUuid || !workspaceUuid) {
12078
12095
  throw new Error("Sandbox mode requires organisationUuid and workspaceUuid props");
12079
12096
  }
12080
- if (!ucic && !subject) {
12097
+ if (!ucic && !email && !mobile) {
12081
12098
  throw new Error("Sandbox mode requires a UCIC, email, or mobile");
12082
12099
  }
12083
12100
  setSandboxConfig({
12084
12101
  token,
12085
12102
  ucic: ucic || void 0,
12086
- subject,
12103
+ email: email || void 0,
12104
+ mobile: mobile || void 0,
12087
12105
  organisationUuid,
12088
12106
  workspaceUuid,
12089
12107
  slug
12090
12108
  });
12091
- const contact = ucic || subject;
12109
+ const contact = ucic || email || mobile;
12092
12110
  setStoredValue("access_token", token);
12093
12111
  if (organisationUuid) setStoredValue("pc_org_id", organisationUuid);
12094
12112
  if (workspaceUuid) setStoredValue("pc_workspace_id", workspaceUuid);
@@ -12107,7 +12125,8 @@ function AuthProvider(props) {
12107
12125
  refreshToken: initialRefreshToken,
12108
12126
  token: sandboxToken,
12109
12127
  sandboxUcic,
12110
- sandboxSubject,
12128
+ sandboxEmail,
12129
+ sandboxMobile,
12111
12130
  organisationUuid,
12112
12131
  workspaceUuid,
12113
12132
  slug,
@@ -12150,7 +12169,7 @@ function AuthProvider(props) {
12150
12169
  setOrganizationName(seeded.organizationName);
12151
12170
  }
12152
12171
  return () => setSandboxConfig(null);
12153
- }, [sandboxActive, sandboxToken, sandboxUcic, sandboxSubject, organisationUuid, workspaceUuid, slug]);
12172
+ }, [sandboxActive, sandboxToken, sandboxUcic, sandboxEmail, sandboxMobile, organisationUuid, workspaceUuid, slug]);
12154
12173
  useEffect(() => {
12155
12174
  if (sandboxActive) return;
12156
12175
  if (accessToken) {
@@ -15992,7 +16011,7 @@ function ActivitiesList() {
15992
16011
  {
15993
16012
  data: activities,
15994
16013
  style: { backgroundColor: colors.canvasSubtle },
15995
- keyExtractor: (item, idx) => `${item.case_id || item.timestamp}-${idx}`,
16014
+ keyExtractor: (item, idx) => item.id || `${item.case_id || item.timestamp}-${idx}`,
15996
16015
  onEndReached: handleLoadMore,
15997
16016
  onEndReachedThreshold: 0.3,
15998
16017
  contentContainerStyle: [styles30.content, { flexGrow: 1, paddingBottom: listBottom }],
@@ -16555,27 +16574,38 @@ var uploadFileWithS2S = async ({
16555
16574
  authToken,
16556
16575
  baseUrl
16557
16576
  }) => {
16577
+ var _a3;
16558
16578
  try {
16559
- if (!authToken) {
16560
- throw new Error("Auth token is required for document upload");
16561
- }
16562
16579
  if (!baseUrl) {
16563
16580
  throw new Error("Base URL is required for document upload");
16564
16581
  }
16565
- const decodedToken = decodeJwtToken(authToken);
16566
- if (!decodedToken) {
16567
- throw new Error("Invalid access token");
16568
- }
16569
- const { organisation_uuid, workspace_uuid } = decodedToken;
16570
- if (!organisation_uuid || !workspace_uuid) {
16571
- throw new Error("Invalid token: missing organization or workspace UUID");
16582
+ const sandbox = getSandboxConfig();
16583
+ let organisation_uuid;
16584
+ let workspace_uuid;
16585
+ let authHeaders;
16586
+ if (sandbox) {
16587
+ organisation_uuid = sandbox.organisationUuid;
16588
+ workspace_uuid = sandbox.workspaceUuid;
16589
+ authHeaders = (_a3 = sandboxAuthHeaders()) != null ? _a3 : {};
16590
+ } else {
16591
+ if (!authToken) {
16592
+ throw new Error("Auth token is required for document upload");
16593
+ }
16594
+ const decodedToken = decodeJwtToken(authToken);
16595
+ if (!decodedToken) {
16596
+ throw new Error("Invalid access token");
16597
+ }
16598
+ if (!decodedToken.organisation_uuid || !decodedToken.workspace_uuid) {
16599
+ throw new Error("Invalid token: missing organization or workspace UUID");
16600
+ }
16601
+ organisation_uuid = decodedToken.organisation_uuid;
16602
+ workspace_uuid = decodedToken.workspace_uuid;
16603
+ authHeaders = { Authorization: `Bearer ${authToken}` };
16572
16604
  }
16573
16605
  const url = `${baseUrl}/organisations/${organisation_uuid}/workspaces/${workspace_uuid}/dsar/privacy-center/upload-document`;
16574
16606
  const response = await fetch(url, {
16575
16607
  method: "POST",
16576
- headers: {
16577
- "Authorization": `Bearer ${authToken}`
16578
- },
16608
+ headers: authHeaders,
16579
16609
  body: formData
16580
16610
  });
16581
16611
  if (!response.ok) {
@@ -21417,7 +21447,8 @@ function RedactoPrivacyCenter({
21417
21447
  refreshToken: refreshToken != null ? refreshToken : "",
21418
21448
  token,
21419
21449
  sandboxUcic: ucic,
21420
- sandboxSubject: email || mobile,
21450
+ sandboxEmail: email,
21451
+ sandboxMobile: mobile,
21421
21452
  organisationUuid,
21422
21453
  workspaceUuid,
21423
21454
  slug,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redacto.io/consent-sdk-react-native",
3
- "version": "5.0.0",
3
+ "version": "5.0.1-beta.1",
4
4
  "description": "React Native SDK for integrating Redacto consent notices and privacy center in mobile apps.",
5
5
  "keywords": [
6
6
  "consent",