@arbidocs/client 0.5.60 → 0.5.61
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/index.cjs +10 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +66 -30
- package/dist/index.d.ts +66 -30
- package/dist/index.js +10 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -166,12 +166,15 @@ function createSessionManager(options = {}) {
|
|
|
166
166
|
}
|
|
167
167
|
var ACCESS_TOKEN_STORAGE_KEY = "arbi_access_token";
|
|
168
168
|
var SESSION_STORAGE_KEY = "arbi_session";
|
|
169
|
-
function browserSessionStateStorage() {
|
|
169
|
+
function browserSessionStateStorage(namespace) {
|
|
170
|
+
const suffix = namespace ? `:${namespace}` : "";
|
|
171
|
+
const sessionKey = SESSION_STORAGE_KEY + suffix;
|
|
172
|
+
const accessTokenKey = ACCESS_TOKEN_STORAGE_KEY + suffix;
|
|
170
173
|
return {
|
|
171
174
|
load() {
|
|
172
175
|
try {
|
|
173
|
-
const rest = JSON.parse(window.localStorage.getItem(
|
|
174
|
-
const accessToken = window.sessionStorage.getItem(
|
|
176
|
+
const rest = JSON.parse(window.localStorage.getItem(sessionKey) ?? "null");
|
|
177
|
+
const accessToken = window.sessionStorage.getItem(accessTokenKey);
|
|
175
178
|
return { ...rest ?? {}, accessToken };
|
|
176
179
|
} catch {
|
|
177
180
|
return null;
|
|
@@ -179,11 +182,11 @@ function browserSessionStateStorage() {
|
|
|
179
182
|
},
|
|
180
183
|
save({ accessToken, ...rest }) {
|
|
181
184
|
try {
|
|
182
|
-
if (accessToken) window.sessionStorage.setItem(
|
|
183
|
-
else window.sessionStorage.removeItem(
|
|
185
|
+
if (accessToken) window.sessionStorage.setItem(accessTokenKey, accessToken);
|
|
186
|
+
else window.sessionStorage.removeItem(accessTokenKey);
|
|
184
187
|
if (rest.signedIn || rest.isSsoMode)
|
|
185
|
-
window.localStorage.setItem(
|
|
186
|
-
else window.localStorage.removeItem(
|
|
188
|
+
window.localStorage.setItem(sessionKey, JSON.stringify(rest));
|
|
189
|
+
else window.localStorage.removeItem(sessionKey);
|
|
187
190
|
} catch {
|
|
188
191
|
}
|
|
189
192
|
}
|