@redacto.io/consent-sdk-js 2.0.0 → 2.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.
package/dist/redacto.js CHANGED
@@ -419,7 +419,6 @@ var parseApiError = async (response, fallbackMessage) => {
419
419
  };
420
420
 
421
421
  // src/shared/idempotency.ts
422
- var HEADER = "Idempotency-Key";
423
422
  var MAX_PENDING = 16;
424
423
  var pending = /* @__PURE__ */ new Map();
425
424
  var toHex = (bytes) => Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
@@ -472,7 +471,7 @@ ${body}`;
472
471
  if (held.inFlight === 0 && !held.keep) pending.delete(signature);
473
472
  };
474
473
  try {
475
- const result = await send({ [HEADER]: held.key });
474
+ const result = await send(held.key);
476
475
  settle(settledOnResolve(result));
477
476
  return result;
478
477
  } catch (error) {
@@ -1242,14 +1241,13 @@ var submitConsentEvent = async ({
1242
1241
  const response = await withIdempotencyKey(
1243
1242
  url,
1244
1243
  serialisedBody,
1245
- (idempotencyHeaders) => fetch(url, {
1244
+ (idempotencyKey) => fetch(url, {
1246
1245
  method: "POST",
1247
1246
  headers: {
1248
1247
  ...buildAuthHeaders(accessToken, sandbox),
1249
- "Content-Type": "application/json",
1250
- ...idempotencyHeaders
1248
+ "Content-Type": "application/json"
1251
1249
  },
1252
- body: serialisedBody,
1250
+ body: JSON.stringify({ ...requestBody, idempotency_key: idempotencyKey }),
1253
1251
  signal
1254
1252
  })
1255
1253
  );
@@ -1285,14 +1283,13 @@ var submitConsentEventPublic = async ({
1285
1283
  const response = await withIdempotencyKey(
1286
1284
  url,
1287
1285
  serialisedBody,
1288
- (idempotencyHeaders) => fetch(url, {
1286
+ (idempotencyKey) => fetch(url, {
1289
1287
  method: "POST",
1290
1288
  headers: {
1291
1289
  Authorization: `Bearer ${accessToken}`,
1292
- "Content-Type": "application/json",
1293
- ...idempotencyHeaders
1290
+ "Content-Type": "application/json"
1294
1291
  },
1295
- body: serialisedBody
1292
+ body: JSON.stringify({ ...payload, idempotency_key: idempotencyKey })
1296
1293
  })
1297
1294
  );
1298
1295
  if (!response.ok) {
@@ -10770,15 +10767,14 @@ var submitAssistedConsent = async ({
10770
10767
  const response = await withIdempotencyKey(
10771
10768
  url,
10772
10769
  serialisedBody,
10773
- (idempotencyHeaders) => fetch(url, {
10770
+ (idempotencyKey) => fetch(url, {
10774
10771
  method: "POST",
10775
10772
  headers: {
10776
10773
  accept: "application/json",
10777
10774
  Authorization: `Bearer ${accessToken}`,
10778
- "Content-Type": "application/json",
10779
- ...idempotencyHeaders
10775
+ "Content-Type": "application/json"
10780
10776
  },
10781
- body: serialisedBody,
10777
+ body: JSON.stringify({ ...payload, idempotency_key: idempotencyKey }),
10782
10778
  signal
10783
10779
  })
10784
10780
  );
package/dist/redacto.mjs CHANGED
@@ -385,7 +385,6 @@ var parseApiError = async (response, fallbackMessage) => {
385
385
  };
386
386
 
387
387
  // src/shared/idempotency.ts
388
- var HEADER = "Idempotency-Key";
389
388
  var MAX_PENDING = 16;
390
389
  var pending = /* @__PURE__ */ new Map();
391
390
  var toHex = (bytes) => Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
@@ -438,7 +437,7 @@ ${body}`;
438
437
  if (held.inFlight === 0 && !held.keep) pending.delete(signature);
439
438
  };
440
439
  try {
441
- const result = await send({ [HEADER]: held.key });
440
+ const result = await send(held.key);
442
441
  settle(settledOnResolve(result));
443
442
  return result;
444
443
  } catch (error) {
@@ -1208,14 +1207,13 @@ var submitConsentEvent = async ({
1208
1207
  const response = await withIdempotencyKey(
1209
1208
  url,
1210
1209
  serialisedBody,
1211
- (idempotencyHeaders) => fetch(url, {
1210
+ (idempotencyKey) => fetch(url, {
1212
1211
  method: "POST",
1213
1212
  headers: {
1214
1213
  ...buildAuthHeaders(accessToken, sandbox),
1215
- "Content-Type": "application/json",
1216
- ...idempotencyHeaders
1214
+ "Content-Type": "application/json"
1217
1215
  },
1218
- body: serialisedBody,
1216
+ body: JSON.stringify({ ...requestBody, idempotency_key: idempotencyKey }),
1219
1217
  signal
1220
1218
  })
1221
1219
  );
@@ -1251,14 +1249,13 @@ var submitConsentEventPublic = async ({
1251
1249
  const response = await withIdempotencyKey(
1252
1250
  url,
1253
1251
  serialisedBody,
1254
- (idempotencyHeaders) => fetch(url, {
1252
+ (idempotencyKey) => fetch(url, {
1255
1253
  method: "POST",
1256
1254
  headers: {
1257
1255
  Authorization: `Bearer ${accessToken}`,
1258
- "Content-Type": "application/json",
1259
- ...idempotencyHeaders
1256
+ "Content-Type": "application/json"
1260
1257
  },
1261
- body: serialisedBody
1258
+ body: JSON.stringify({ ...payload, idempotency_key: idempotencyKey })
1262
1259
  })
1263
1260
  );
1264
1261
  if (!response.ok) {
@@ -10736,15 +10733,14 @@ var submitAssistedConsent = async ({
10736
10733
  const response = await withIdempotencyKey(
10737
10734
  url,
10738
10735
  serialisedBody,
10739
- (idempotencyHeaders) => fetch(url, {
10736
+ (idempotencyKey) => fetch(url, {
10740
10737
  method: "POST",
10741
10738
  headers: {
10742
10739
  accept: "application/json",
10743
10740
  Authorization: `Bearer ${accessToken}`,
10744
- "Content-Type": "application/json",
10745
- ...idempotencyHeaders
10741
+ "Content-Type": "application/json"
10746
10742
  },
10747
- body: serialisedBody,
10743
+ body: JSON.stringify({ ...payload, idempotency_key: idempotencyKey }),
10748
10744
  signal
10749
10745
  })
10750
10746
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redacto.io/consent-sdk-js",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "main": "dist/redacto.js",
5
5
  "module": "dist/redacto.mjs",
6
6
  "types": "dist/redacto.d.ts",