@redacto.io/consent-sdk-react-native 5.0.0 → 5.0.1-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.
@@ -10694,7 +10694,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10694
10694
  * Submit a document for a document request (privacy center)
10695
10695
  */
10696
10696
  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`;
10697
+ const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/cases/${caseUuid}/document-requests/${requestEventUuid}/submit${sandboxIdentitySuffix()}`;
10698
10698
  return privacyCenterApiFetch(url, {
10699
10699
  ...options,
10700
10700
  method: "POST",
@@ -16560,27 +16560,38 @@ var uploadFileWithS2S = async ({
16560
16560
  authToken,
16561
16561
  baseUrl
16562
16562
  }) => {
16563
+ var _a3;
16563
16564
  try {
16564
- if (!authToken) {
16565
- throw new Error("Auth token is required for document upload");
16566
- }
16567
16565
  if (!baseUrl) {
16568
16566
  throw new Error("Base URL is required for document upload");
16569
16567
  }
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");
16568
+ const sandbox = getSandboxConfig();
16569
+ let organisation_uuid;
16570
+ let workspace_uuid;
16571
+ let authHeaders;
16572
+ if (sandbox) {
16573
+ organisation_uuid = sandbox.organisationUuid;
16574
+ workspace_uuid = sandbox.workspaceUuid;
16575
+ authHeaders = (_a3 = sandboxAuthHeaders()) != null ? _a3 : {};
16576
+ } else {
16577
+ if (!authToken) {
16578
+ throw new Error("Auth token is required for document upload");
16579
+ }
16580
+ const decodedToken = decodeJwtToken(authToken);
16581
+ if (!decodedToken) {
16582
+ throw new Error("Invalid access token");
16583
+ }
16584
+ if (!decodedToken.organisation_uuid || !decodedToken.workspace_uuid) {
16585
+ throw new Error("Invalid token: missing organization or workspace UUID");
16586
+ }
16587
+ organisation_uuid = decodedToken.organisation_uuid;
16588
+ workspace_uuid = decodedToken.workspace_uuid;
16589
+ authHeaders = { Authorization: `Bearer ${authToken}` };
16577
16590
  }
16578
16591
  const url = `${baseUrl}/organisations/${organisation_uuid}/workspaces/${workspace_uuid}/dsar/privacy-center/upload-document`;
16579
16592
  const response = await fetch(url, {
16580
16593
  method: "POST",
16581
- headers: {
16582
- "Authorization": `Bearer ${authToken}`
16583
- },
16594
+ headers: authHeaders,
16584
16595
  body: formData
16585
16596
  });
16586
16597
  if (!response.ok) {
@@ -10579,7 +10579,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10579
10579
  * Submit a document for a document request (privacy center)
10580
10580
  */
10581
10581
  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`;
10582
+ const url = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/cases/${caseUuid}/document-requests/${requestEventUuid}/submit${sandboxIdentitySuffix()}`;
10583
10583
  return privacyCenterApiFetch(url, {
10584
10584
  ...options,
10585
10585
  method: "POST",
@@ -16555,27 +16555,38 @@ var uploadFileWithS2S = async ({
16555
16555
  authToken,
16556
16556
  baseUrl
16557
16557
  }) => {
16558
+ var _a3;
16558
16559
  try {
16559
- if (!authToken) {
16560
- throw new Error("Auth token is required for document upload");
16561
- }
16562
16560
  if (!baseUrl) {
16563
16561
  throw new Error("Base URL is required for document upload");
16564
16562
  }
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");
16563
+ const sandbox = getSandboxConfig();
16564
+ let organisation_uuid;
16565
+ let workspace_uuid;
16566
+ let authHeaders;
16567
+ if (sandbox) {
16568
+ organisation_uuid = sandbox.organisationUuid;
16569
+ workspace_uuid = sandbox.workspaceUuid;
16570
+ authHeaders = (_a3 = sandboxAuthHeaders()) != null ? _a3 : {};
16571
+ } else {
16572
+ if (!authToken) {
16573
+ throw new Error("Auth token is required for document upload");
16574
+ }
16575
+ const decodedToken = decodeJwtToken(authToken);
16576
+ if (!decodedToken) {
16577
+ throw new Error("Invalid access token");
16578
+ }
16579
+ if (!decodedToken.organisation_uuid || !decodedToken.workspace_uuid) {
16580
+ throw new Error("Invalid token: missing organization or workspace UUID");
16581
+ }
16582
+ organisation_uuid = decodedToken.organisation_uuid;
16583
+ workspace_uuid = decodedToken.workspace_uuid;
16584
+ authHeaders = { Authorization: `Bearer ${authToken}` };
16572
16585
  }
16573
16586
  const url = `${baseUrl}/organisations/${organisation_uuid}/workspaces/${workspace_uuid}/dsar/privacy-center/upload-document`;
16574
16587
  const response = await fetch(url, {
16575
16588
  method: "POST",
16576
- headers: {
16577
- "Authorization": `Bearer ${authToken}`
16578
- },
16589
+ headers: authHeaders,
16579
16590
  body: formData
16580
16591
  });
16581
16592
  if (!response.ok) {
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.0",
4
4
  "description": "React Native SDK for integrating Redacto consent notices and privacy center in mobile apps.",
5
5
  "keywords": [
6
6
  "consent",