@shopsbuilder/auth-sdk 1.2.7 → 1.2.8
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/SaleorAccessTokenStorageHandler.d.mts +1 -0
- package/dist/SaleorAccessTokenStorageHandler.d.ts +1 -0
- package/dist/SaleorAccessTokenStorageHandler.js +7 -0
- package/dist/SaleorAccessTokenStorageHandler.mjs +1 -1
- package/dist/SaleorAuthClient.js +7 -0
- package/dist/SaleorAuthClient.mjs +2 -2
- package/dist/{chunk-BZFBMGPG.mjs → chunk-B326YIV6.mjs} +7 -0
- package/dist/{chunk-UHR2J6FG.mjs → chunk-X3MKOESH.mjs} +1 -1
- package/dist/index.js +7 -0
- package/dist/index.mjs +2 -2
- package/dist/react/SaleorAuthProvider.mjs +2 -2
- package/dist/react/context.mjs +2 -2
- package/dist/react/index.mjs +2 -2
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ declare const getAccessTokenKey: (prefix?: string) => string;
|
|
|
4
4
|
declare class SaleorAccessTokenStorageHandler {
|
|
5
5
|
private storage;
|
|
6
6
|
private prefix?;
|
|
7
|
+
private cachedToken;
|
|
7
8
|
constructor(storage: StorageRepository, prefix?: string | undefined);
|
|
8
9
|
getAccessToken: () => string | null;
|
|
9
10
|
setAccessToken: (token: string) => void;
|
|
@@ -4,6 +4,7 @@ declare const getAccessTokenKey: (prefix?: string) => string;
|
|
|
4
4
|
declare class SaleorAccessTokenStorageHandler {
|
|
5
5
|
private storage;
|
|
6
6
|
private prefix?;
|
|
7
|
+
private cachedToken;
|
|
7
8
|
constructor(storage: StorageRepository, prefix?: string | undefined);
|
|
8
9
|
getAccessToken: () => string | null;
|
|
9
10
|
setAccessToken: (token: string) => void;
|
|
@@ -30,15 +30,22 @@ var SaleorAccessTokenStorageHandler = class {
|
|
|
30
30
|
this.storage = storage;
|
|
31
31
|
this.prefix = prefix;
|
|
32
32
|
}
|
|
33
|
+
// In-memory cache so the token is available even when the storage
|
|
34
|
+
// backend is read-only (e.g. Next.js cookies during render).
|
|
35
|
+
cachedToken = null;
|
|
33
36
|
getAccessToken = () => {
|
|
37
|
+
if (this.cachedToken)
|
|
38
|
+
return this.cachedToken;
|
|
34
39
|
const key = getAccessTokenKey(this.prefix);
|
|
35
40
|
return this.storage.getItem(key);
|
|
36
41
|
};
|
|
37
42
|
setAccessToken = (token) => {
|
|
43
|
+
this.cachedToken = token;
|
|
38
44
|
const key = getAccessTokenKey(this.prefix);
|
|
39
45
|
return this.storage.setItem(key, token);
|
|
40
46
|
};
|
|
41
47
|
clearAuthStorage = () => {
|
|
48
|
+
this.cachedToken = null;
|
|
42
49
|
const key = getAccessTokenKey(this.prefix);
|
|
43
50
|
return this.storage.removeItem(key);
|
|
44
51
|
};
|
package/dist/SaleorAuthClient.js
CHANGED
|
@@ -239,15 +239,22 @@ var SaleorAccessTokenStorageHandler = class {
|
|
|
239
239
|
this.storage = storage;
|
|
240
240
|
this.prefix = prefix;
|
|
241
241
|
}
|
|
242
|
+
// In-memory cache so the token is available even when the storage
|
|
243
|
+
// backend is read-only (e.g. Next.js cookies during render).
|
|
244
|
+
cachedToken = null;
|
|
242
245
|
getAccessToken = () => {
|
|
246
|
+
if (this.cachedToken)
|
|
247
|
+
return this.cachedToken;
|
|
243
248
|
const key = getAccessTokenKey(this.prefix);
|
|
244
249
|
return this.storage.getItem(key);
|
|
245
250
|
};
|
|
246
251
|
setAccessToken = (token) => {
|
|
252
|
+
this.cachedToken = token;
|
|
247
253
|
const key = getAccessTokenKey(this.prefix);
|
|
248
254
|
return this.storage.setItem(key, token);
|
|
249
255
|
};
|
|
250
256
|
clearAuthStorage = () => {
|
|
257
|
+
this.cachedToken = null;
|
|
251
258
|
const key = getAccessTokenKey(this.prefix);
|
|
252
259
|
return this.storage.removeItem(key);
|
|
253
260
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SaleorAuthClient,
|
|
3
3
|
createSaleorAuthClient
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-X3MKOESH.mjs";
|
|
5
|
+
import "./chunk-B326YIV6.mjs";
|
|
6
6
|
import "./chunk-263DHBMK.mjs";
|
|
7
7
|
import "./chunk-UDLCOX6B.mjs";
|
|
8
8
|
import "./chunk-7JTFMRQS.mjs";
|
|
@@ -5,15 +5,22 @@ var SaleorAccessTokenStorageHandler = class {
|
|
|
5
5
|
this.storage = storage;
|
|
6
6
|
this.prefix = prefix;
|
|
7
7
|
}
|
|
8
|
+
// In-memory cache so the token is available even when the storage
|
|
9
|
+
// backend is read-only (e.g. Next.js cookies during render).
|
|
10
|
+
cachedToken = null;
|
|
8
11
|
getAccessToken = () => {
|
|
12
|
+
if (this.cachedToken)
|
|
13
|
+
return this.cachedToken;
|
|
9
14
|
const key = getAccessTokenKey(this.prefix);
|
|
10
15
|
return this.storage.getItem(key);
|
|
11
16
|
};
|
|
12
17
|
setAccessToken = (token) => {
|
|
18
|
+
this.cachedToken = token;
|
|
13
19
|
const key = getAccessTokenKey(this.prefix);
|
|
14
20
|
return this.storage.setItem(key, token);
|
|
15
21
|
};
|
|
16
22
|
clearAuthStorage = () => {
|
|
23
|
+
this.cachedToken = null;
|
|
17
24
|
const key = getAccessTokenKey(this.prefix);
|
|
18
25
|
return this.storage.removeItem(key);
|
|
19
26
|
};
|
package/dist/index.js
CHANGED
|
@@ -242,15 +242,22 @@ var SaleorAccessTokenStorageHandler = class {
|
|
|
242
242
|
this.storage = storage;
|
|
243
243
|
this.prefix = prefix;
|
|
244
244
|
}
|
|
245
|
+
// In-memory cache so the token is available even when the storage
|
|
246
|
+
// backend is read-only (e.g. Next.js cookies during render).
|
|
247
|
+
cachedToken = null;
|
|
245
248
|
getAccessToken = () => {
|
|
249
|
+
if (this.cachedToken)
|
|
250
|
+
return this.cachedToken;
|
|
246
251
|
const key = getAccessTokenKey(this.prefix);
|
|
247
252
|
return this.storage.getItem(key);
|
|
248
253
|
};
|
|
249
254
|
setAccessToken = (token) => {
|
|
255
|
+
this.cachedToken = token;
|
|
250
256
|
const key = getAccessTokenKey(this.prefix);
|
|
251
257
|
return this.storage.setItem(key, token);
|
|
252
258
|
};
|
|
253
259
|
clearAuthStorage = () => {
|
|
260
|
+
this.cachedToken = null;
|
|
254
261
|
const key = getAccessTokenKey(this.prefix);
|
|
255
262
|
return this.storage.removeItem(key);
|
|
256
263
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
SaleorAuthProvider
|
|
3
3
|
} from "../chunk-74GMXOK4.mjs";
|
|
4
4
|
import "../chunk-NAQNA6DI.mjs";
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-X3MKOESH.mjs";
|
|
6
|
+
import "../chunk-B326YIV6.mjs";
|
|
7
7
|
import "../chunk-263DHBMK.mjs";
|
|
8
8
|
import "../chunk-UDLCOX6B.mjs";
|
|
9
9
|
import "../chunk-7JTFMRQS.mjs";
|
package/dist/react/context.mjs
CHANGED
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
createSafeContext,
|
|
4
4
|
useSaleorAuthContext
|
|
5
5
|
} from "../chunk-NAQNA6DI.mjs";
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-X3MKOESH.mjs";
|
|
7
|
+
import "../chunk-B326YIV6.mjs";
|
|
8
8
|
import "../chunk-263DHBMK.mjs";
|
|
9
9
|
import "../chunk-UDLCOX6B.mjs";
|
|
10
10
|
import "../chunk-7JTFMRQS.mjs";
|
package/dist/react/index.mjs
CHANGED
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
useSaleorExternalAuth
|
|
14
14
|
} from "../chunk-Q3UFWDCC.mjs";
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-X3MKOESH.mjs";
|
|
16
|
+
import "../chunk-B326YIV6.mjs";
|
|
17
17
|
import "../chunk-263DHBMK.mjs";
|
|
18
18
|
import "../chunk-T35JF4IS.mjs";
|
|
19
19
|
import "../chunk-KLIEZ4V4.mjs";
|