@flexbe/sdk 0.2.30 → 0.2.31
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.
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { UnauthorizedException } from '../types';
|
|
11
|
-
const TOKEN_STORAGE_KEY = '
|
|
11
|
+
const TOKEN_STORAGE_KEY = 'flexbe_jwt';
|
|
12
12
|
const TOKEN_REFRESH_THRESHOLD = 5 * 60 * 1000; // update token 5 minutes before expiration
|
|
13
13
|
export class TokenManager {
|
|
14
14
|
constructor() {
|
|
@@ -18,6 +18,12 @@ export class TokenManager {
|
|
|
18
18
|
if (!TokenManager.instance) {
|
|
19
19
|
TokenManager.instance = new TokenManager();
|
|
20
20
|
}
|
|
21
|
+
if (typeof window !== 'undefined') {
|
|
22
|
+
// Clean up old token storage place
|
|
23
|
+
// TODO remove this after June 1, 2025
|
|
24
|
+
localStorage.removeItem('flexbe_jwt_token');
|
|
25
|
+
;
|
|
26
|
+
}
|
|
21
27
|
return TokenManager.instance;
|
|
22
28
|
}
|
|
23
29
|
getToken() {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TokenManager = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
|
-
const TOKEN_STORAGE_KEY = '
|
|
5
|
+
const TOKEN_STORAGE_KEY = 'flexbe_jwt';
|
|
6
6
|
const TOKEN_REFRESH_THRESHOLD = 5 * 60 * 1000; // update token 5 minutes before expiration
|
|
7
7
|
class TokenManager {
|
|
8
8
|
constructor() {
|
|
@@ -12,6 +12,12 @@ class TokenManager {
|
|
|
12
12
|
if (!TokenManager.instance) {
|
|
13
13
|
TokenManager.instance = new TokenManager();
|
|
14
14
|
}
|
|
15
|
+
if (typeof window !== 'undefined') {
|
|
16
|
+
// Clean up old token storage place
|
|
17
|
+
// TODO remove this after June 1, 2025
|
|
18
|
+
localStorage.removeItem('flexbe_jwt_token');
|
|
19
|
+
;
|
|
20
|
+
}
|
|
15
21
|
return TokenManager.instance;
|
|
16
22
|
}
|
|
17
23
|
async getToken() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UnauthorizedException } from '../types';
|
|
2
|
-
const TOKEN_STORAGE_KEY = '
|
|
2
|
+
const TOKEN_STORAGE_KEY = 'flexbe_jwt';
|
|
3
3
|
const TOKEN_REFRESH_THRESHOLD = 5 * 60 * 1000; // update token 5 minutes before expiration
|
|
4
4
|
export class TokenManager {
|
|
5
5
|
constructor() {
|
|
@@ -9,6 +9,12 @@ export class TokenManager {
|
|
|
9
9
|
if (!TokenManager.instance) {
|
|
10
10
|
TokenManager.instance = new TokenManager();
|
|
11
11
|
}
|
|
12
|
+
if (typeof window !== 'undefined') {
|
|
13
|
+
// Clean up old token storage place
|
|
14
|
+
// TODO remove this after June 1, 2025
|
|
15
|
+
localStorage.removeItem('flexbe_jwt_token');
|
|
16
|
+
;
|
|
17
|
+
}
|
|
12
18
|
return TokenManager.instance;
|
|
13
19
|
}
|
|
14
20
|
async getToken() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flexbe/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.31",
|
|
4
4
|
"description": "TypeScript SDK for Flexbe API",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -23,8 +23,7 @@
|
|
|
23
23
|
"lint": "eslint src --ext .ts",
|
|
24
24
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
25
25
|
"prepare": "npm run build",
|
|
26
|
-
"prepublishOnly": "npm test && npm run lint"
|
|
27
|
-
"version": "npm version"
|
|
26
|
+
"prepublishOnly": "npm test && npm run lint"
|
|
28
27
|
},
|
|
29
28
|
"keywords": [
|
|
30
29
|
"flexbe",
|