@redacto.io/consent-sdk-react-native 6.0.0 → 6.0.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.
@@ -6,7 +6,6 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
6
6
  });
7
7
 
8
8
  // src/shared/idempotency.ts
9
- var HEADER = "Idempotency-Key";
10
9
  var MAX_PENDING = 16;
11
10
  var pending = /* @__PURE__ */ new Map();
12
11
  var toHex = (bytes) => Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
@@ -59,7 +58,7 @@ ${body}`;
59
58
  if (held.inFlight === 0 && !held.keep) pending.delete(signature);
60
59
  };
61
60
  try {
62
- const result = await send({ [HEADER]: held.key });
61
+ const result = await send(held.key);
63
62
  settle(settledOnResolve(result));
64
63
  return result;
65
64
  } catch (error) {
package/dist/index.js CHANGED
@@ -179,7 +179,6 @@ var parseApiError = async (response, fallbackMessage) => {
179
179
  };
180
180
 
181
181
  // src/shared/idempotency.ts
182
- var HEADER = "Idempotency-Key";
183
182
  var MAX_PENDING = 16;
184
183
  var pending = /* @__PURE__ */ new Map();
185
184
  var toHex = (bytes) => Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
@@ -232,7 +231,7 @@ ${body}`;
232
231
  if (held.inFlight === 0 && !held.keep) pending.delete(signature);
233
232
  };
234
233
  try {
235
- const result = await send({ [HEADER]: held.key });
234
+ const result = await send(held.key);
236
235
  settle(settledOnResolve(result));
237
236
  return result;
238
237
  } catch (error) {
@@ -433,14 +432,13 @@ var submitConsentEvent = async ({
433
432
  const response = await withIdempotencyKey(
434
433
  url,
435
434
  serialisedBody,
436
- (idempotencyHeaders) => fetch(url, {
435
+ (idempotencyKey) => fetch(url, {
437
436
  method: "POST",
438
437
  headers: {
439
438
  ...buildAuthHeaders(accessToken, sandbox),
440
- "Content-Type": "application/json",
441
- ...idempotencyHeaders
439
+ "Content-Type": "application/json"
442
440
  },
443
- body: serialisedBody,
441
+ body: JSON.stringify({ ...requestBody, idempotency_key: idempotencyKey }),
444
442
  signal
445
443
  })
446
444
  );
@@ -7208,14 +7206,13 @@ var submitConsentEvent2 = async ({
7208
7206
  const response = await withIdempotencyKey(
7209
7207
  url,
7210
7208
  serialisedBody,
7211
- (idempotencyHeaders) => fetch(url, {
7209
+ (idempotencyKey) => fetch(url, {
7212
7210
  method: "POST",
7213
7211
  headers: {
7214
7212
  Authorization: `Bearer ${accessToken}`,
7215
- "Content-Type": "application/json",
7216
- ...idempotencyHeaders
7213
+ "Content-Type": "application/json"
7217
7214
  },
7218
- body: serialisedBody
7215
+ body: JSON.stringify({ ...payload, idempotency_key: idempotencyKey })
7219
7216
  })
7220
7217
  );
7221
7218
  if (!response.ok) {
@@ -8282,20 +8279,18 @@ var submitAssistedConsent = async ({
8282
8279
  throw new Error(ASSISTED_REQUIRED_PARAMS.submit);
8283
8280
  }
8284
8281
  const url = `${publicScope(ledgerBaseUrl || baseUrl, organisationUuid, workspaceUuid)}/submit-consent`;
8285
- const serialisedBody = JSON.stringify(
8286
- buildAssistedConsentPayload({ noticeUuid, purposes, language })
8287
- );
8282
+ const payload = buildAssistedConsentPayload({ noticeUuid, purposes, language });
8283
+ const serialisedBody = JSON.stringify(payload);
8288
8284
  const response = await withIdempotencyKey(
8289
8285
  url,
8290
8286
  serialisedBody,
8291
- (idempotencyHeaders) => fetch(url, {
8287
+ (idempotencyKey) => fetch(url, {
8292
8288
  method: "POST",
8293
8289
  headers: {
8294
8290
  ...JSON_HEADERS,
8295
- Authorization: `Bearer ${accessToken}`,
8296
- ...idempotencyHeaders
8291
+ Authorization: `Bearer ${accessToken}`
8297
8292
  },
8298
- body: serialisedBody,
8293
+ body: JSON.stringify({ ...payload, idempotency_key: idempotencyKey }),
8299
8294
  signal
8300
8295
  })
8301
8296
  );
package/dist/index.mjs CHANGED
@@ -25,7 +25,7 @@ import {
25
25
  withAlpha,
26
26
  withColorScheme,
27
27
  withIdempotencyKey
28
- } from "./chunk-VM4GNLMU.mjs";
28
+ } from "./chunk-LBSCBW2Y.mjs";
29
29
 
30
30
  // src/RedactoNoticeConsent/RedactoNoticeConsent.tsx
31
31
  import React6, {
@@ -320,14 +320,13 @@ var submitConsentEvent = async ({
320
320
  const response = await withIdempotencyKey(
321
321
  url,
322
322
  serialisedBody,
323
- (idempotencyHeaders) => fetch(url, {
323
+ (idempotencyKey) => fetch(url, {
324
324
  method: "POST",
325
325
  headers: {
326
326
  ...buildAuthHeaders(accessToken, sandbox),
327
- "Content-Type": "application/json",
328
- ...idempotencyHeaders
327
+ "Content-Type": "application/json"
329
328
  },
330
- body: serialisedBody,
329
+ body: JSON.stringify({ ...requestBody, idempotency_key: idempotencyKey }),
331
330
  signal
332
331
  })
333
332
  );
@@ -6729,14 +6728,13 @@ var submitConsentEvent2 = async ({
6729
6728
  const response = await withIdempotencyKey(
6730
6729
  url,
6731
6730
  serialisedBody,
6732
- (idempotencyHeaders) => fetch(url, {
6731
+ (idempotencyKey) => fetch(url, {
6733
6732
  method: "POST",
6734
6733
  headers: {
6735
6734
  Authorization: `Bearer ${accessToken}`,
6736
- "Content-Type": "application/json",
6737
- ...idempotencyHeaders
6735
+ "Content-Type": "application/json"
6738
6736
  },
6739
- body: serialisedBody
6737
+ body: JSON.stringify({ ...payload, idempotency_key: idempotencyKey })
6740
6738
  })
6741
6739
  );
6742
6740
  if (!response.ok) {
@@ -7812,20 +7810,18 @@ var submitAssistedConsent = async ({
7812
7810
  throw new Error(ASSISTED_REQUIRED_PARAMS.submit);
7813
7811
  }
7814
7812
  const url = `${publicScope(ledgerBaseUrl || baseUrl, organisationUuid, workspaceUuid)}/submit-consent`;
7815
- const serialisedBody = JSON.stringify(
7816
- buildAssistedConsentPayload({ noticeUuid, purposes, language })
7817
- );
7813
+ const payload = buildAssistedConsentPayload({ noticeUuid, purposes, language });
7814
+ const serialisedBody = JSON.stringify(payload);
7818
7815
  const response = await withIdempotencyKey(
7819
7816
  url,
7820
7817
  serialisedBody,
7821
- (idempotencyHeaders) => fetch(url, {
7818
+ (idempotencyKey) => fetch(url, {
7822
7819
  method: "POST",
7823
7820
  headers: {
7824
7821
  ...JSON_HEADERS,
7825
- Authorization: `Bearer ${accessToken}`,
7826
- ...idempotencyHeaders
7822
+ Authorization: `Bearer ${accessToken}`
7827
7823
  },
7828
- body: serialisedBody,
7824
+ body: JSON.stringify({ ...payload, idempotency_key: idempotencyKey }),
7829
7825
  signal
7830
7826
  })
7831
7827
  );
@@ -11313,7 +11313,6 @@ async function apiFetch(url, options = {}) {
11313
11313
  }
11314
11314
 
11315
11315
  // src/shared/idempotency.ts
11316
- var HEADER = "Idempotency-Key";
11317
11316
  var MAX_PENDING = 16;
11318
11317
  var pending = /* @__PURE__ */ new Map();
11319
11318
  var toHex = (bytes) => Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
@@ -11366,7 +11365,7 @@ ${body}`;
11366
11365
  if (held.inFlight === 0 && !held.keep) pending.delete(signature);
11367
11366
  };
11368
11367
  try {
11369
- const result = await send({ [HEADER]: held.key });
11368
+ const result = await send(held.key);
11370
11369
  settle(settledOnResolve(result));
11371
11370
  return result;
11372
11371
  } catch (error) {
@@ -11802,19 +11801,16 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
11802
11801
  };
11803
11802
  const url = ledgerUrl(baseRequest, "/submit-consent");
11804
11803
  const serialisedBody = JSON.stringify(body);
11805
- return withIdempotencyKey(url, serialisedBody, (idempotencyHeaders) => {
11806
- const headers = new Headers(options == null ? void 0 : options.headers);
11807
- Object.entries(idempotencyHeaders).forEach(
11808
- ([name, value]) => headers.set(name, value)
11809
- );
11810
- return privacyCenterApiFetch(url, {
11804
+ return withIdempotencyKey(
11805
+ url,
11806
+ serialisedBody,
11807
+ (idempotencyKey) => privacyCenterApiFetch(url, {
11811
11808
  ...options,
11812
11809
  method: "POST",
11813
- body: serialisedBody,
11814
- headers,
11810
+ body: JSON.stringify({ ...body, idempotency_key: idempotencyKey }),
11815
11811
  authToken: authToken || baseRequest.authToken
11816
- });
11817
- });
11812
+ })
11813
+ );
11818
11814
  },
11819
11815
  /**
11820
11816
  * Get activities (privacy center)
@@ -12,7 +12,7 @@ import {
12
12
  warnDeprecatedBaseUrls,
13
13
  warnSlugDeprecated,
14
14
  withIdempotencyKey
15
- } from "./chunk-VM4GNLMU.mjs";
15
+ } from "./chunk-LBSCBW2Y.mjs";
16
16
 
17
17
  // src/RedactoPrivacyCenter/RedactoPrivacyCenter.tsx
18
18
  import { useEffect as useEffect25 } from "react";
@@ -11581,19 +11581,16 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
11581
11581
  };
11582
11582
  const url = ledgerUrl(baseRequest, "/submit-consent");
11583
11583
  const serialisedBody = JSON.stringify(body);
11584
- return withIdempotencyKey(url, serialisedBody, (idempotencyHeaders) => {
11585
- const headers = new Headers(options == null ? void 0 : options.headers);
11586
- Object.entries(idempotencyHeaders).forEach(
11587
- ([name, value]) => headers.set(name, value)
11588
- );
11589
- return privacyCenterApiFetch(url, {
11584
+ return withIdempotencyKey(
11585
+ url,
11586
+ serialisedBody,
11587
+ (idempotencyKey) => privacyCenterApiFetch(url, {
11590
11588
  ...options,
11591
11589
  method: "POST",
11592
- body: serialisedBody,
11593
- headers,
11590
+ body: JSON.stringify({ ...body, idempotency_key: idempotencyKey }),
11594
11591
  authToken: authToken || baseRequest.authToken
11595
- });
11596
- });
11592
+ })
11593
+ );
11597
11594
  },
11598
11595
  /**
11599
11596
  * Get activities (privacy center)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redacto.io/consent-sdk-react-native",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "description": "React Native SDK for integrating Redacto consent notices and privacy center in mobile apps.",
5
5
  "keywords": [
6
6
  "consent",