arky-sdk 0.7.106 → 0.7.107
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/admin.cjs +11 -1
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.js +11 -1
- package/dist/admin.js.map +1 -1
- package/dist/index.cjs +23 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +23 -3
- package/dist/index.js.map +1 -1
- package/dist/storefront.cjs +11 -1
- package/dist/storefront.cjs.map +1 -1
- package/dist/storefront.js +11 -1
- package/dist/storefront.js.map +1 -1
- package/package.json +1 -1
package/dist/admin.cjs
CHANGED
|
@@ -2174,12 +2174,19 @@ function createAdmin(config) {
|
|
|
2174
2174
|
}
|
|
2175
2175
|
}
|
|
2176
2176
|
const updateSession = (updater) => {
|
|
2177
|
+
if (config.apiToken) return;
|
|
2177
2178
|
const prev = readAdminSession();
|
|
2178
2179
|
const next = updater(prev);
|
|
2179
2180
|
writeAdminSession(next);
|
|
2180
2181
|
emit();
|
|
2181
2182
|
};
|
|
2182
|
-
const authStorage = {
|
|
2183
|
+
const authStorage = config.apiToken ? {
|
|
2184
|
+
getTokens: () => ({ access_token: config.apiToken }),
|
|
2185
|
+
onTokensRefreshed: () => {
|
|
2186
|
+
},
|
|
2187
|
+
onForcedLogout: () => {
|
|
2188
|
+
}
|
|
2189
|
+
} : {
|
|
2183
2190
|
getTokens() {
|
|
2184
2191
|
const s = readAdminSession();
|
|
2185
2192
|
if (!s) return null;
|
|
@@ -2396,9 +2403,11 @@ function createAdmin(config) {
|
|
|
2396
2403
|
},
|
|
2397
2404
|
getLocale: () => apiConfig.locale,
|
|
2398
2405
|
get currentSession() {
|
|
2406
|
+
if (config.apiToken) return null;
|
|
2399
2407
|
return toPublic(readAdminSession());
|
|
2400
2408
|
},
|
|
2401
2409
|
get isAuthenticated() {
|
|
2410
|
+
if (config.apiToken) return true;
|
|
2402
2411
|
return readAdminSession() !== null;
|
|
2403
2412
|
},
|
|
2404
2413
|
onAuthStateChanged(listener) {
|
|
@@ -2413,6 +2422,7 @@ function createAdmin(config) {
|
|
|
2413
2422
|
};
|
|
2414
2423
|
},
|
|
2415
2424
|
async logout() {
|
|
2425
|
+
if (config.apiToken) return;
|
|
2416
2426
|
updateSession(() => null);
|
|
2417
2427
|
},
|
|
2418
2428
|
extractBlockValues,
|