@redacto.io/consent-sdk-react 11.1.0-beta.1 → 11.1.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.
@@ -101,7 +101,6 @@ var loadNoticeWebfont = async (value, signal) => {
101
101
  };
102
102
 
103
103
  // src/shared/idempotency.ts
104
- var HEADER = "Idempotency-Key";
105
104
  var pending = /* @__PURE__ */ new Map();
106
105
  var MAX_PENDING = 16;
107
106
  var mintKey = () => {
@@ -149,7 +148,7 @@ ${body}`;
149
148
  if (entry.inFlight === 0 && !entry.keep) pending.delete(signature);
150
149
  };
151
150
  try {
152
- const result = await send({ [HEADER]: entry.key });
151
+ const result = await send(entry.key);
153
152
  settle(settledOnResolve(result));
154
153
  return result;
155
154
  } catch (error) {
package/dist/index.js CHANGED
@@ -226,7 +226,6 @@ var sandboxBodyIdentity = (sandbox) => {
226
226
  var sandboxQueryIdentity = (sandbox) => sandboxBodyIdentity(sandbox);
227
227
 
228
228
  // src/shared/idempotency.ts
229
- var HEADER = "Idempotency-Key";
230
229
  var pending = /* @__PURE__ */ new Map();
231
230
  var MAX_PENDING = 16;
232
231
  var mintKey = () => {
@@ -274,7 +273,7 @@ ${body}`;
274
273
  if (entry.inFlight === 0 && !entry.keep) pending.delete(signature);
275
274
  };
276
275
  try {
277
- const result = await send({ [HEADER]: entry.key });
276
+ const result = await send(entry.key);
278
277
  settle(settledOnResolve(result));
279
278
  return result;
280
279
  } catch (error) {
@@ -511,14 +510,13 @@ var submitConsentEvent = async ({
511
510
  const response = await withIdempotencyKey(
512
511
  url,
513
512
  serialisedBody,
514
- (idempotencyHeaders) => fetch(url, {
513
+ (idempotencyKey) => fetch(url, {
515
514
  method: "POST",
516
515
  headers: {
517
516
  ...buildAuthHeaders(accessToken, sandbox),
518
- "Content-Type": "application/json",
519
- ...idempotencyHeaders
517
+ "Content-Type": "application/json"
520
518
  },
521
- body: serialisedBody,
519
+ body: JSON.stringify({ ...requestBody, idempotency_key: idempotencyKey }),
522
520
  signal
523
521
  })
524
522
  );
@@ -10009,14 +10007,13 @@ var submitConsentEvent2 = async ({
10009
10007
  const response = await withIdempotencyKey(
10010
10008
  url,
10011
10009
  serialisedBody,
10012
- (idempotencyHeaders) => fetch(url, {
10010
+ (idempotencyKey) => fetch(url, {
10013
10011
  method: "POST",
10014
10012
  headers: {
10015
10013
  Authorization: `Bearer ${accessToken}`,
10016
- "Content-Type": "application/json",
10017
- ...idempotencyHeaders
10014
+ "Content-Type": "application/json"
10018
10015
  },
10019
- body: serialisedBody
10016
+ body: JSON.stringify({ ...payload, idempotency_key: idempotencyKey })
10020
10017
  })
10021
10018
  );
10022
10019
  if (!response.ok) {
@@ -12364,15 +12361,14 @@ var submitAssistedConsent = async ({
12364
12361
  const response = await withIdempotencyKey(
12365
12362
  url,
12366
12363
  serialisedBody,
12367
- (idempotencyHeaders) => fetch(url, {
12364
+ (idempotencyKey) => fetch(url, {
12368
12365
  method: "POST",
12369
12366
  headers: {
12370
12367
  accept: "application/json",
12371
12368
  Authorization: `Bearer ${accessToken}`,
12372
- "Content-Type": "application/json",
12373
- ...idempotencyHeaders
12369
+ "Content-Type": "application/json"
12374
12370
  },
12375
- body: serialisedBody,
12371
+ body: JSON.stringify({ ...payload, idempotency_key: idempotencyKey }),
12376
12372
  signal
12377
12373
  })
12378
12374
  );
package/dist/index.mjs CHANGED
@@ -36,7 +36,7 @@ import {
36
36
  withAlpha,
37
37
  withColorScheme,
38
38
  withIdempotencyKey
39
- } from "./chunk-W45JQYDG.mjs";
39
+ } from "./chunk-GP2II2WM.mjs";
40
40
  import {
41
41
  NOTICE_FONT_ROOT_PROPS,
42
42
  REQUIRED_MARKER_ARIA_LABEL,
@@ -407,14 +407,13 @@ var submitConsentEvent = async ({
407
407
  const response = await withIdempotencyKey(
408
408
  url,
409
409
  serialisedBody,
410
- (idempotencyHeaders) => fetch(url, {
410
+ (idempotencyKey) => fetch(url, {
411
411
  method: "POST",
412
412
  headers: {
413
413
  ...buildAuthHeaders(accessToken, sandbox),
414
- "Content-Type": "application/json",
415
- ...idempotencyHeaders
414
+ "Content-Type": "application/json"
416
415
  },
417
- body: serialisedBody,
416
+ body: JSON.stringify({ ...requestBody, idempotency_key: idempotencyKey }),
418
417
  signal
419
418
  })
420
419
  );
@@ -9020,14 +9019,13 @@ var submitConsentEvent2 = async ({
9020
9019
  const response = await withIdempotencyKey(
9021
9020
  url,
9022
9021
  serialisedBody,
9023
- (idempotencyHeaders) => fetch(url, {
9022
+ (idempotencyKey) => fetch(url, {
9024
9023
  method: "POST",
9025
9024
  headers: {
9026
9025
  Authorization: `Bearer ${accessToken}`,
9027
- "Content-Type": "application/json",
9028
- ...idempotencyHeaders
9026
+ "Content-Type": "application/json"
9029
9027
  },
9030
- body: serialisedBody
9028
+ body: JSON.stringify({ ...payload, idempotency_key: idempotencyKey })
9031
9029
  })
9032
9030
  );
9033
9031
  if (!response.ok) {
@@ -11375,15 +11373,14 @@ var submitAssistedConsent = async ({
11375
11373
  const response = await withIdempotencyKey(
11376
11374
  url,
11377
11375
  serialisedBody,
11378
- (idempotencyHeaders) => fetch(url, {
11376
+ (idempotencyKey) => fetch(url, {
11379
11377
  method: "POST",
11380
11378
  headers: {
11381
11379
  accept: "application/json",
11382
11380
  Authorization: `Bearer ${accessToken}`,
11383
- "Content-Type": "application/json",
11384
- ...idempotencyHeaders
11381
+ "Content-Type": "application/json"
11385
11382
  },
11386
- body: serialisedBody,
11383
+ body: JSON.stringify({ ...payload, idempotency_key: idempotencyKey }),
11387
11384
  signal
11388
11385
  })
11389
11386
  );
@@ -10190,7 +10190,6 @@ var useAuth = () => {
10190
10190
  var import_react6 = require("react");
10191
10191
 
10192
10192
  // src/shared/idempotency.ts
10193
- var HEADER = "Idempotency-Key";
10194
10193
  var pending = /* @__PURE__ */ new Map();
10195
10194
  var MAX_PENDING = 16;
10196
10195
  var mintKey = () => {
@@ -10238,7 +10237,7 @@ ${body}`;
10238
10237
  if (entry.inFlight === 0 && !entry.keep) pending.delete(signature);
10239
10238
  };
10240
10239
  try {
10241
- const result = await send({ [HEADER]: entry.key });
10240
+ const result = await send(entry.key);
10242
10241
  settle(settledOnResolve(result));
10243
10242
  return result;
10244
10243
  } catch (error) {
@@ -10733,19 +10732,16 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10733
10732
  };
10734
10733
  const url = ledgerUrl(baseRequest, "/submit-consent");
10735
10734
  const serialisedBody = JSON.stringify(body);
10736
- return withIdempotencyKey(url, serialisedBody, (idempotencyHeaders) => {
10737
- const headers = new Headers(options == null ? void 0 : options.headers);
10738
- Object.entries(idempotencyHeaders).forEach(
10739
- ([name, value]) => headers.set(name, value)
10740
- );
10741
- return privacyCenterApiFetch(url, {
10735
+ return withIdempotencyKey(
10736
+ url,
10737
+ serialisedBody,
10738
+ (idempotencyKey) => privacyCenterApiFetch(url, {
10742
10739
  ...options,
10743
10740
  method: "POST",
10744
- body: serialisedBody,
10745
- headers,
10741
+ body: JSON.stringify({ ...body, idempotency_key: idempotencyKey }),
10746
10742
  authToken: resolveAuthToken(authToken, baseRequest)
10747
- });
10748
- });
10743
+ })
10744
+ );
10749
10745
  },
10750
10746
  /**
10751
10747
  * Get activities (privacy center)
@@ -22,7 +22,7 @@ import {
22
22
  warnEndpointUsage,
23
23
  warnSlugDeprecated,
24
24
  withIdempotencyKey
25
- } from "./chunk-W45JQYDG.mjs";
25
+ } from "./chunk-GP2II2WM.mjs";
26
26
  import {
27
27
  INHERIT_FONT_FAMILY,
28
28
  resolveNoticeFontFamily
@@ -10512,19 +10512,16 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10512
10512
  };
10513
10513
  const url = ledgerUrl(baseRequest, "/submit-consent");
10514
10514
  const serialisedBody = JSON.stringify(body);
10515
- return withIdempotencyKey(url, serialisedBody, (idempotencyHeaders) => {
10516
- const headers = new Headers(options == null ? void 0 : options.headers);
10517
- Object.entries(idempotencyHeaders).forEach(
10518
- ([name, value]) => headers.set(name, value)
10519
- );
10520
- return privacyCenterApiFetch(url, {
10515
+ return withIdempotencyKey(
10516
+ url,
10517
+ serialisedBody,
10518
+ (idempotencyKey) => privacyCenterApiFetch(url, {
10521
10519
  ...options,
10522
10520
  method: "POST",
10523
- body: serialisedBody,
10524
- headers,
10521
+ body: JSON.stringify({ ...body, idempotency_key: idempotencyKey }),
10525
10522
  authToken: resolveAuthToken(authToken, baseRequest)
10526
- });
10527
- });
10523
+ })
10524
+ );
10528
10525
  },
10529
10526
  /**
10530
10527
  * Get activities (privacy center)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redacto.io/consent-sdk-react",
3
- "version": "11.1.0-beta.1",
3
+ "version": "11.1.0",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",