@shopsbuilder/auth-sdk 1.2.11 → 1.2.12

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.
@@ -323,7 +323,7 @@ var SaleorAuthClient = class {
323
323
  if (!token) {
324
324
  return fetch(input, init);
325
325
  }
326
- const headers = init?.headers || {};
326
+ const headers = new Headers(init?.headers);
327
327
  const getURL = (input2) => {
328
328
  if (typeof input2 === "string") {
329
329
  return input2;
@@ -348,10 +348,10 @@ var SaleorAuthClient = class {
348
348
  );
349
349
  }
350
350
  }
351
- return fetch(input, {
352
- ...init,
353
- headers: shouldAddAuthorizationHeader ? { ...headers, Authorization: `Bearer ${token}` } : headers
354
- });
351
+ if (shouldAddAuthorizationHeader) {
352
+ headers.set("Authorization", `Bearer ${token}`);
353
+ }
354
+ return fetch(input, { ...init, headers });
355
355
  };
356
356
  handleRequestWithTokenRefresh = async (input, requestInit, additionalParams) => {
357
357
  const refreshToken = this.refreshTokenStorage?.getRefreshToken();
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SaleorAuthClient,
3
3
  createSaleorAuthClient
4
- } from "./chunk-CKQ223DC.mjs";
4
+ } from "./chunk-E4ERLV5W.mjs";
5
5
  import "./chunk-B326YIV6.mjs";
6
6
  import "./chunk-263DHBMK.mjs";
7
7
  import "./chunk-UDLCOX6B.mjs";
@@ -76,7 +76,7 @@ var SaleorAuthClient = class {
76
76
  if (!token) {
77
77
  return fetch(input, init);
78
78
  }
79
- const headers = init?.headers || {};
79
+ const headers = new Headers(init?.headers);
80
80
  const getURL = (input2) => {
81
81
  if (typeof input2 === "string") {
82
82
  return input2;
@@ -101,10 +101,10 @@ var SaleorAuthClient = class {
101
101
  );
102
102
  }
103
103
  }
104
- return fetch(input, {
105
- ...init,
106
- headers: shouldAddAuthorizationHeader ? { ...headers, Authorization: `Bearer ${token}` } : headers
107
- });
104
+ if (shouldAddAuthorizationHeader) {
105
+ headers.set("Authorization", `Bearer ${token}`);
106
+ }
107
+ return fetch(input, { ...init, headers });
108
108
  };
109
109
  handleRequestWithTokenRefresh = async (input, requestInit, additionalParams) => {
110
110
  const refreshToken = this.refreshTokenStorage?.getRefreshToken();
package/dist/index.js CHANGED
@@ -326,7 +326,7 @@ var SaleorAuthClient = class {
326
326
  if (!token) {
327
327
  return fetch(input, init);
328
328
  }
329
- const headers = init?.headers || {};
329
+ const headers = new Headers(init?.headers);
330
330
  const getURL = (input2) => {
331
331
  if (typeof input2 === "string") {
332
332
  return input2;
@@ -351,10 +351,10 @@ var SaleorAuthClient = class {
351
351
  );
352
352
  }
353
353
  }
354
- return fetch(input, {
355
- ...init,
356
- headers: shouldAddAuthorizationHeader ? { ...headers, Authorization: `Bearer ${token}` } : headers
357
- });
354
+ if (shouldAddAuthorizationHeader) {
355
+ headers.set("Authorization", `Bearer ${token}`);
356
+ }
357
+ return fetch(input, { ...init, headers });
358
358
  };
359
359
  handleRequestWithTokenRefresh = async (input, requestInit, additionalParams) => {
360
360
  const refreshToken = this.refreshTokenStorage?.getRefreshToken();
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SaleorAuthClient,
3
3
  createSaleorAuthClient
4
- } from "./chunk-CKQ223DC.mjs";
4
+ } from "./chunk-E4ERLV5W.mjs";
5
5
  import "./chunk-B326YIV6.mjs";
6
6
  import "./chunk-263DHBMK.mjs";
7
7
  import {
@@ -2,7 +2,7 @@ import {
2
2
  SaleorAuthProvider
3
3
  } from "../chunk-74GMXOK4.mjs";
4
4
  import "../chunk-NAQNA6DI.mjs";
5
- import "../chunk-CKQ223DC.mjs";
5
+ import "../chunk-E4ERLV5W.mjs";
6
6
  import "../chunk-B326YIV6.mjs";
7
7
  import "../chunk-263DHBMK.mjs";
8
8
  import "../chunk-UDLCOX6B.mjs";
@@ -3,7 +3,7 @@ import {
3
3
  createSafeContext,
4
4
  useSaleorAuthContext
5
5
  } from "../chunk-NAQNA6DI.mjs";
6
- import "../chunk-CKQ223DC.mjs";
6
+ import "../chunk-E4ERLV5W.mjs";
7
7
  import "../chunk-B326YIV6.mjs";
8
8
  import "../chunk-263DHBMK.mjs";
9
9
  import "../chunk-UDLCOX6B.mjs";
@@ -12,7 +12,7 @@ import {
12
12
  import {
13
13
  useSaleorExternalAuth
14
14
  } from "../chunk-Q3UFWDCC.mjs";
15
- import "../chunk-CKQ223DC.mjs";
15
+ import "../chunk-E4ERLV5W.mjs";
16
16
  import "../chunk-B326YIV6.mjs";
17
17
  import "../chunk-263DHBMK.mjs";
18
18
  import "../chunk-T35JF4IS.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopsbuilder/auth-sdk",
3
- "version": "1.2.11",
3
+ "version": "1.2.12",
4
4
  "description": "Auth SDK for Saleor",
5
5
  "sideEffects": false,
6
6
  "files": ["dist/", "README.md"],