@blocklet/js-sdk 1.16.37-beta-20250104-120451-e4049aeb → 1.16.37-beta-20250107-235521-f1778ec0

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2018-2020 ArcBlock
1
+ Copyright 2018-2025 ArcBlock
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
package/dist/index.d.mts CHANGED
@@ -73,7 +73,7 @@ declare class AuthService {
73
73
  }
74
74
 
75
75
  declare class TokenService {
76
- getSessionToken(): string;
76
+ getSessionToken(config: any): string;
77
77
  setSessionToken(value: string): void;
78
78
  removeSessionToken(): void;
79
79
  getRefreshToken(): string;
package/dist/index.d.ts CHANGED
@@ -73,7 +73,7 @@ declare class AuthService {
73
73
  }
74
74
 
75
75
  declare class TokenService {
76
- getSessionToken(): string;
76
+ getSessionToken(config: any): string;
77
77
  setSessionToken(value: string): void;
78
78
  removeSessionToken(): void;
79
79
  getRefreshToken(): string;
package/dist/index.mjs CHANGED
@@ -85,8 +85,14 @@ class AuthService {
85
85
  }
86
86
 
87
87
  class TokenService {
88
- getSessionToken() {
89
- return Cookie.get(SESSION_TOKEN_STORAGE_KEY);
88
+ getSessionToken(config) {
89
+ if (Cookie.get(SESSION_TOKEN_STORAGE_KEY)) {
90
+ return Cookie.get(SESSION_TOKEN_STORAGE_KEY);
91
+ }
92
+ if (config.sessionTokenKey) {
93
+ return window.localStorage.getItem(config.sessionTokenKey);
94
+ }
95
+ return "";
90
96
  }
91
97
  setSessionToken(value) {
92
98
  Cookie.set(SESSION_TOKEN_STORAGE_KEY, value);
@@ -484,7 +490,7 @@ function createRequest$1({
484
490
  service.interceptors.request.use(
485
491
  async (config) => {
486
492
  if (!Cookie.get(SESSION_TOKEN_STORAGE_KEY)) {
487
- const token = getSessionToken();
493
+ const token = getSessionToken(config);
488
494
  if (token) {
489
495
  config.headers.authorization = getBearerToken(token);
490
496
  }
@@ -617,7 +623,7 @@ function createRequest({
617
623
  }
618
624
  }
619
625
  if (!Cookie.get(SESSION_TOKEN_STORAGE_KEY)) {
620
- const token = getSessionToken();
626
+ const token = getSessionToken(requestOptions);
621
627
  if (token) {
622
628
  authorization = getBearerToken(token);
623
629
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/js-sdk",
3
- "version": "1.16.37-beta-20250104-120451-e4049aeb",
3
+ "version": "1.16.37-beta-20250107-235521-f1778ec0",
4
4
  "main": "dist/index.mjs",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -38,10 +38,10 @@
38
38
  "watch": "nodemon -w src -e ts -x 'npm run build'"
39
39
  },
40
40
  "dependencies": {
41
- "@abtnode/constant": "1.16.37-beta-20250104-120451-e4049aeb",
42
- "@arcblock/did": "1.18.166",
43
- "@blocklet/meta": "1.16.37-beta-20250104-120451-e4049aeb",
44
- "@ocap/wallet": "1.18.166",
41
+ "@abtnode/constant": "1.16.37-beta-20250107-235521-f1778ec0",
42
+ "@arcblock/did": "1.19.1",
43
+ "@blocklet/meta": "1.16.37-beta-20250107-235521-f1778ec0",
44
+ "@ocap/wallet": "1.19.1",
45
45
  "axios": "^1.7.9",
46
46
  "is-url": "^1.2.4",
47
47
  "js-cookie": "^3.0.5",
@@ -65,5 +65,5 @@
65
65
  "unbuild": "^2.0.0",
66
66
  "vitest": "^2.0.5"
67
67
  },
68
- "gitHead": "b7b25187705d6a0ac07d3ff4ed3333bf7808120b"
68
+ "gitHead": "3a46e922782029700f45d7da9fd9535302d0594c"
69
69
  }