@scayle/storefront-nuxt 7.79.0 → 7.80.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 7.80.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Do not set session cookie for cached pages
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated to `nuxt@3.12.2`
12
+ - Fix the the type off `publicShopData` in the config. This restores it to `(keyof ShopConfig)[]` instead of `string[]`, allowing its elements to be used to index a `ShopConfig`
13
+
14
+ ## 7.79.1
15
+
16
+ ### Patch Changes
17
+
18
+ - Import `useNitroApp` from `#imports`
19
+
3
20
  ## 7.79.0
4
21
 
5
22
  ### Minor Changes
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, M as ModuleBaseOptions, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.2c3f3a8a.mjs';
1
+ export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, M as ModuleBaseOptions, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.282cc1d9.mjs';
2
2
  export { rpcCall } from './rpc.mjs';
3
3
  export * from '@scayle/storefront-core';
4
4
  export { LogLevel } from '@scayle/storefront-core';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, M as ModuleBaseOptions, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.2c3f3a8a.js';
1
+ export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, M as ModuleBaseOptions, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.282cc1d9.js';
2
2
  export { rpcCall } from './rpc.js';
3
3
  export * from '@scayle/storefront-core';
4
4
  export { LogLevel } from '@scayle/storefront-core';
package/dist/module.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import { M as ModuleBaseOptions } from './shared/storefront-nuxt.2c3f3a8a.mjs';
3
- export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.2c3f3a8a.mjs';
2
+ import { M as ModuleBaseOptions } from './shared/storefront-nuxt.282cc1d9.mjs';
3
+ export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.282cc1d9.mjs';
4
4
  export { LogLevel } from '@scayle/storefront-core';
5
5
  import '@scayle/unstorage-compression-driver';
6
6
  import 'unstorage';
package/dist/module.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import { M as ModuleBaseOptions } from './shared/storefront-nuxt.2c3f3a8a.js';
3
- export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.2c3f3a8a.js';
2
+ import { M as ModuleBaseOptions } from './shared/storefront-nuxt.282cc1d9.js';
3
+ export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.282cc1d9.js';
4
4
  export { LogLevel } from '@scayle/storefront-core';
5
5
  import '@scayle/unstorage-compression-driver';
6
6
  import 'unstorage';
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
- "version": "7.78.1",
3
+ "version": "7.79.1",
4
4
  "configKey": "storefront",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.9.0"
package/dist/module.mjs CHANGED
@@ -65,7 +65,7 @@ export default {
65
65
  }`;
66
66
  }
67
67
  const PACKAGE_NAME = "@scayle/storefront-nuxt";
68
- const PACKAGE_VERSION = "7.78.1";
68
+ const PACKAGE_VERSION = "7.79.1";
69
69
  const logger = createConsola({
70
70
  fancy: true,
71
71
  formatOptions: {
package/dist/rpc.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { RpcMethodName, RpcMethodParameters, RpcMethodReturnType, RpcContext } from '@scayle/storefront-core';
2
2
  import { NuxtApp } from 'nuxt/app';
3
- import { P as PublicShopConfig } from './shared/storefront-nuxt.2c3f3a8a.mjs';
3
+ import { P as PublicShopConfig } from './shared/storefront-nuxt.282cc1d9.mjs';
4
4
  import '@scayle/unstorage-compression-driver';
5
5
  import 'unstorage';
6
6
  import 'zod';
package/dist/rpc.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { RpcMethodName, RpcMethodParameters, RpcMethodReturnType, RpcContext } from '@scayle/storefront-core';
2
2
  import { NuxtApp } from 'nuxt/app';
3
- import { P as PublicShopConfig } from './shared/storefront-nuxt.2c3f3a8a.js';
3
+ import { P as PublicShopConfig } from './shared/storefront-nuxt.282cc1d9.js';
4
4
  import '@scayle/unstorage-compression-driver';
5
5
  import 'unstorage';
6
6
  import 'zod';
@@ -3,7 +3,7 @@ import { purifySensitiveData } from "@scayle/storefront-core";
3
3
  import { trace, SpanStatusCode } from "@opentelemetry/api";
4
4
  import { handler } from "../handler.mjs";
5
5
  import { resolveError } from "../error/handler.mjs";
6
- import { useNitroApp } from "nitropack/runtime/app";
6
+ import { useNitroApp } from "#imports";
7
7
  const tracer = trace.getTracer(
8
8
  "storefront-nuxt",
9
9
  "__sfc_version"
@@ -2,7 +2,7 @@ import { type MaybeRefOrGetter } from 'vue';
2
2
  import type { RpcMethodParameters } from '@scayle/storefront-core';
3
3
  export declare function useIDP(params?: MaybeRefOrGetter<RpcMethodParameters<'getExternalIdpRedirect'>>, key?: string): import("nuxt/dist/app/composables/asyncData")._AsyncData<{
4
4
  [k: string]: string;
5
- }, import("nuxt/app").NuxtError<unknown> | null> & {
5
+ }, any> & {
6
6
  fetching: import("vue").Ref<boolean>;
7
7
  fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
8
8
  } & {
@@ -13,7 +13,7 @@ export declare function useIDP(params?: MaybeRefOrGetter<RpcMethodParameters<'ge
13
13
  }>;
14
14
  } & Promise<import("nuxt/dist/app/composables/asyncData")._AsyncData<{
15
15
  [k: string]: string;
16
- }, import("nuxt/app").NuxtError<unknown> | null> & {
16
+ }, any> & {
17
17
  fetching: import("vue").Ref<boolean>;
18
18
  fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
19
19
  } & {
@@ -15,7 +15,7 @@ export declare function useUser(options?: ExtendedUseUserParams): {
15
15
  forceRefresh: () => Promise<void>;
16
16
  updateUser: (payload: Partial<ShopUser>) => Promise<void>;
17
17
  updatePassword: (payload: UpdatePasswordParams) => Promise<void>;
18
- error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
18
+ error: import("vue").Ref<any>;
19
19
  status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
20
20
  } & Promise<{
21
21
  user: import("vue").ComputedRef<ShopUser | undefined>;
@@ -26,6 +26,6 @@ export declare function useUser(options?: ExtendedUseUserParams): {
26
26
  forceRefresh: () => Promise<void>;
27
27
  updateUser: (payload: Partial<ShopUser>) => Promise<void>;
28
28
  updatePassword: (payload: UpdatePasswordParams) => Promise<void>;
29
- error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
29
+ error: import("vue").Ref<any>;
30
30
  status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
31
31
  }>;
@@ -5,7 +5,7 @@ type UseBasketOptions = Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getBasket'>>;
6
6
  key: string;
7
7
  }>;
8
- export declare function useBasket({ params, key, }?: UseBasketOptions): import("nuxt/dist/app/composables/asyncData")._AsyncData<BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>, import("nuxt/app").NuxtError<unknown> | null> & {
8
+ export declare function useBasket({ params, key, }?: UseBasketOptions): import("nuxt/dist/app/composables/asyncData")._AsyncData<BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>, any> & {
9
9
  fetching: import("vue").Ref<boolean>;
10
10
  fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
11
11
  } & {
@@ -61,9 +61,9 @@ export declare function useBasket({ params, key, }?: UseBasketOptions): import("
61
61
  readonly basket: BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>;
62
62
  readonly errors: import("@scayle/storefront-api").AddOrUpdateItemError[];
63
63
  } | undefined>;
64
- error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
64
+ error: import("vue").Ref<any>;
65
65
  status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
66
- } & Promise<import("nuxt/dist/app/composables/asyncData")._AsyncData<BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>, import("nuxt/app").NuxtError<unknown> | null> & {
66
+ } & Promise<import("nuxt/dist/app/composables/asyncData")._AsyncData<BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>, any> & {
67
67
  fetching: import("vue").Ref<boolean>;
68
68
  fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
69
69
  } & {
@@ -119,7 +119,7 @@ export declare function useBasket({ params, key, }?: UseBasketOptions): import("
119
119
  readonly basket: BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>;
120
120
  readonly errors: import("@scayle/storefront-api").AddOrUpdateItemError[];
121
121
  } | undefined>;
122
- error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
122
+ error: import("vue").Ref<any>;
123
123
  status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
124
124
  }>;
125
125
  export {};
@@ -13,7 +13,7 @@ export declare function useCategories({ params, options, key: _key, }?: Options,
13
13
  } | {
14
14
  categories: import("@scayle/storefront-api").Category;
15
15
  activeNode: import("@scayle/storefront-api").Category;
16
- }, import("nuxt/app").NuxtError<unknown> | null> & {
16
+ }, any> & {
17
17
  fetching: import("vue").Ref<boolean>;
18
18
  fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
19
19
  } & {
@@ -24,7 +24,7 @@ export declare function useCategories({ params, options, key: _key, }?: Options,
24
24
  } | {
25
25
  categories: import("@scayle/storefront-api").Category;
26
26
  activeNode: import("@scayle/storefront-api").Category;
27
- }, import("nuxt/app").NuxtError<unknown> | null> & {
27
+ }, any> & {
28
28
  fetching: import("vue").Ref<boolean>;
29
29
  fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
30
30
  } & {
@@ -19,13 +19,13 @@ export declare function useFacet({ key: optionsKey, params, }?: Options, _key?:
19
19
  filtersFetching: import("vue").Ref<boolean>;
20
20
  unfilteredCount: import("vue").ComputedRef<number>;
21
21
  filterStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
22
- filterError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
22
+ filterError: import("vue").Ref<any>;
23
23
  productCountData: import("vue").Ref<{
24
24
  count: number;
25
25
  }>;
26
26
  refreshProductCount: ({ where, }?: FilterParams) => Promise<void>;
27
27
  productCountFetching: import("vue").Ref<boolean>;
28
- productCountError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
28
+ productCountError: import("vue").Ref<any>;
29
29
  productCountStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
30
30
  products: import("vue").ComputedRef<import("@scayle/storefront-api").Product[]>;
31
31
  pagination: import("vue").ComputedRef<{
@@ -40,12 +40,12 @@ export declare function useFacet({ key: optionsKey, params, }?: Options, _key?:
40
40
  }>;
41
41
  productsFetching: import("vue").Ref<boolean>;
42
42
  filterProducts: ({ where, page, sort, orFiltersOperator, }: FilterParams) => Promise<void>;
43
- productError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
43
+ productError: import("vue").Ref<any>;
44
44
  productStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
45
45
  categories: import("vue").ComputedRef<import("@scayle/storefront-api").Category | import("@scayle/storefront-api").Category[]>;
46
46
  selectedCategory: import("vue").ComputedRef<import("@scayle/storefront-api").Category | undefined>;
47
47
  categoriesFetching: import("vue").Ref<boolean>;
48
- categoriesError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
48
+ categoriesError: import("vue").Ref<any>;
49
49
  categoriesStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
50
50
  fetchProducts: ({ path, page, perPage, where, sort, pricePromotionKey, cache, orFiltersOperator, }: FilterParams & {
51
51
  path: string;
@@ -58,13 +58,13 @@ export declare function useFacet({ key: optionsKey, params, }?: Options, _key?:
58
58
  filtersFetching: import("vue").Ref<boolean>;
59
59
  unfilteredCount: import("vue").ComputedRef<number>;
60
60
  filterStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
61
- filterError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
61
+ filterError: import("vue").Ref<any>;
62
62
  productCountData: import("vue").Ref<{
63
63
  count: number;
64
64
  }>;
65
65
  refreshProductCount: ({ where, }?: FilterParams) => Promise<void>;
66
66
  productCountFetching: import("vue").Ref<boolean>;
67
- productCountError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
67
+ productCountError: import("vue").Ref<any>;
68
68
  productCountStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
69
69
  products: import("vue").ComputedRef<import("@scayle/storefront-api").Product[]>;
70
70
  pagination: import("vue").ComputedRef<{
@@ -79,12 +79,12 @@ export declare function useFacet({ key: optionsKey, params, }?: Options, _key?:
79
79
  }>;
80
80
  productsFetching: import("vue").Ref<boolean>;
81
81
  filterProducts: ({ where, page, sort, orFiltersOperator, }: FilterParams) => Promise<void>;
82
- productError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
82
+ productError: import("vue").Ref<any>;
83
83
  productStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
84
84
  categories: import("vue").ComputedRef<import("@scayle/storefront-api").Category | import("@scayle/storefront-api").Category[]>;
85
85
  selectedCategory: import("vue").ComputedRef<import("@scayle/storefront-api").Category | undefined>;
86
86
  categoriesFetching: import("vue").Ref<boolean>;
87
- categoriesError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
87
+ categoriesError: import("vue").Ref<any>;
88
88
  categoriesStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
89
89
  fetchProducts: ({ path, page, perPage, where, sort, pricePromotionKey, cache, orFiltersOperator, }: FilterParams & {
90
90
  path: string;
@@ -11,7 +11,7 @@ export declare function useOrder<P = {
11
11
  [k: string]: unknown;
12
12
  }, V = {
13
13
  [k: string]: unknown;
14
- }>({ params, options, key: _key }?: Options, key?: string): import("nuxt/dist/app/composables/asyncData")._AsyncData<Order, import("nuxt/app").NuxtError<unknown> | null> & {
14
+ }>({ params, options, key: _key }?: Options, key?: string): import("nuxt/dist/app/composables/asyncData")._AsyncData<Order, any> & {
15
15
  fetching: import("vue").Ref<boolean>;
16
16
  fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
17
17
  } & {
@@ -85,7 +85,7 @@ export declare function useOrder<P = {
85
85
  variant: V;
86
86
  })[];
87
87
  }>;
88
- } & Promise<import("nuxt/dist/app/composables/asyncData")._AsyncData<Order, import("nuxt/app").NuxtError<unknown> | null> & {
88
+ } & Promise<import("nuxt/dist/app/composables/asyncData")._AsyncData<Order, any> & {
89
89
  fetching: import("vue").Ref<boolean>;
90
90
  fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
91
91
  } & {
@@ -11,7 +11,7 @@ export declare function useOrderConfirmation<P = {
11
11
  [k: string]: unknown;
12
12
  }, V = {
13
13
  [k: string]: unknown;
14
- }>({ params, options, key: _key }?: Options, key?: string): import("nuxt/dist/app/composables/asyncData")._AsyncData<Order | undefined, import("nuxt/app").NuxtError<unknown> | null> & {
14
+ }>({ params, options, key: _key }?: Options, key?: string): import("nuxt/dist/app/composables/asyncData")._AsyncData<Order | undefined, any> & {
15
15
  fetching: import("vue").Ref<boolean>;
16
16
  fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
17
17
  } & {
@@ -85,7 +85,7 @@ export declare function useOrderConfirmation<P = {
85
85
  variant: V;
86
86
  })[];
87
87
  }>;
88
- } & Promise<import("nuxt/dist/app/composables/asyncData")._AsyncData<Order | undefined, import("nuxt/app").NuxtError<unknown> | null> & {
88
+ } & Promise<import("nuxt/dist/app/composables/asyncData")._AsyncData<Order | undefined, any> & {
89
89
  fetching: import("vue").Ref<boolean>;
90
90
  fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
91
91
  } & {
@@ -40,7 +40,7 @@ export declare function useWishlist({ params, key, }?: Options): {
40
40
  } | {
41
41
  productId: number;
42
42
  }) => boolean;
43
- error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
43
+ error: import("vue").Ref<any>;
44
44
  status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
45
45
  } & Promise<{
46
46
  data: import("vue").Ref<WishlistResponseData>;
@@ -78,7 +78,7 @@ export declare function useWishlist({ params, key, }?: Options): {
78
78
  } | {
79
79
  productId: number;
80
80
  }) => boolean;
81
- error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
81
+ error: import("vue").Ref<any>;
82
82
  status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
83
83
  }>;
84
84
  export {};
@@ -58,42 +58,53 @@ async function bootstrap(event, $shopConfig, $storefrontConfig, apiBasePath, con
58
58
  $shopConfig.shopId,
59
59
  log
60
60
  );
61
- bootstrapLog.debug("Attaching session to request");
62
- try {
63
- const cookieName = sessionConfig?.cookieName ?? "$session";
64
- const secret = sessionConfig?.secret ?? "current-secret";
65
- const oldSessionData = await getOldSessionData(
66
- event,
67
- cookieName,
68
- sessionStorage,
69
- secret
70
- );
71
- await useSession(event, {
72
- ...sessionConfig,
73
- store: sessionStorage,
74
- genid: generateSessionId,
75
- saveUninitialized: true,
76
- cookie: {
77
- maxAge: sessionConfig?.maxAge,
78
- // secure: sessionConfig.isHttps, TODO
79
- sameSite: sessionConfig.sameSite,
80
- domain: sessionConfig?.domain
81
- },
82
- name: `${cookieName}-${$shopConfig.shopId}`,
83
- secret
84
- });
85
- if (oldSessionData) {
86
- event.context.session.data = oldSessionData;
87
- event.context.session.save();
88
- }
89
- const oldSessionCookie = getCookie(event, cookieName);
90
- if (oldSessionCookie) {
91
- deleteCookie(event, cookieName, {
92
- path: $storefrontConfig.shopSelector === "path" && $shopConfig.path ? `/${$shopConfig.path}` : void 0
61
+ const routeRules = event.context._nitro.routeRules;
62
+ const cacheableRoute = routeRules.cache || routeRules.isr || routeRules.swr;
63
+ bootstrapLog.debug({
64
+ rules: event.context._nitro.routeRules,
65
+ cacheableRoute,
66
+ path: event.path
67
+ });
68
+ if (!cacheableRoute) {
69
+ bootstrapLog.debug("Attaching session to request");
70
+ try {
71
+ const cookieName = sessionConfig?.cookieName ?? "$session";
72
+ const secret = sessionConfig?.secret ?? "current-secret";
73
+ const oldSessionData = await getOldSessionData(
74
+ event,
75
+ cookieName,
76
+ sessionStorage,
77
+ secret
78
+ );
79
+ await useSession(event, {
80
+ ...sessionConfig,
81
+ store: sessionStorage,
82
+ genid: generateSessionId,
83
+ saveUninitialized: true,
84
+ cookie: {
85
+ maxAge: sessionConfig?.maxAge,
86
+ // secure: sessionConfig.isHttps, TODO
87
+ sameSite: sessionConfig.sameSite,
88
+ domain: sessionConfig?.domain
89
+ },
90
+ name: `${cookieName}-${$shopConfig.shopId}`,
91
+ secret
93
92
  });
93
+ if (oldSessionData) {
94
+ event.context.session.data = oldSessionData;
95
+ event.context.session.save();
96
+ }
97
+ const oldSessionCookie = getCookie(event, cookieName);
98
+ if (oldSessionCookie) {
99
+ deleteCookie(event, cookieName, {
100
+ path: $storefrontConfig.shopSelector === "path" && $shopConfig.path ? `/${$shopConfig.path}` : void 0
101
+ });
102
+ }
103
+ } catch (e) {
104
+ bootstrapLog.error("Error attaching session: ", e);
94
105
  }
95
- } catch (e) {
96
- bootstrapLog.error("Error attaching session: ", e);
106
+ } else {
107
+ bootstrapLog.debug("Skipping session for cached request");
97
108
  }
98
109
  event.context.$currentShop = getPublicShopData(
99
110
  $shopConfig,
@@ -111,10 +122,6 @@ async function bootstrap(event, $shopConfig, $storefrontConfig, apiBasePath, con
111
122
  );
112
123
  event.context.$cache = $cache;
113
124
  bootstrapLog.debug("Building context for request");
114
- const cacheableRoute = !!event.context._nitro.routeRules.cache;
115
- if (cacheableRoute) {
116
- bootstrapLog.debug("Skipping session for cached request");
117
- }
118
125
  event.context.$rpcContext = await buildContext({
119
126
  $cache,
120
127
  $shopConfig,
@@ -591,6 +591,7 @@ declare const ShopConfigSchema: z.ZodObject<{
591
591
  isDefault?: string | boolean | undefined;
592
592
  }>;
593
593
  declare const ShopSelectorSchema: z.ZodEnum<["path", "domain", "path_or_default"]>;
594
+ type ShopConfigType = z.infer<typeof ShopConfigSchema>;
594
595
  declare const StorefrontConfigSchema: z.ZodObject<{
595
596
  session: z.ZodOptional<z.ZodObject<{
596
597
  /**
@@ -809,7 +810,7 @@ declare const StorefrontConfigSchema: z.ZodObject<{
809
810
  };
810
811
  enabled?: boolean | undefined;
811
812
  }>>;
812
- publicShopData: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
813
+ publicShopData: z.ZodOptional<z.ZodArray<z.ZodType<("locale" | "checkout" | "shopId" | "auth" | "currency") | ("domain" | "storeCampaignKeyword" | "idp" | "path" | "redis" | "apiBasePath" | "appKeys" | "currencyFractionDigits" | "isEnabled" | "sessionConfig" | "bapi" | "storage" | "isDefault") | "paymentProviders", z.ZodTypeDef, ("locale" | "checkout" | "shopId" | "auth" | "currency") | ("domain" | "storeCampaignKeyword" | "idp" | "path" | "redis" | "apiBasePath" | "appKeys" | "currencyFractionDigits" | "isEnabled" | "sessionConfig" | "bapi" | "storage" | "isDefault") | "paymentProviders">, "many">>;
813
814
  idp: z.ZodOptional<z.ZodObject<{
814
815
  enabled: z.ZodBoolean;
815
816
  idpKeys: z.ZodArray<z.ZodString, "many">;
@@ -935,7 +936,7 @@ declare const StorefrontConfigSchema: z.ZodObject<{
935
936
  tls?: boolean | undefined;
936
937
  } | undefined;
937
938
  } | undefined;
938
- publicShopData?: string[] | undefined;
939
+ publicShopData?: (("locale" | "checkout" | "shopId" | "auth" | "currency") | ("domain" | "storeCampaignKeyword" | "idp" | "path" | "redis" | "apiBasePath" | "appKeys" | "currencyFractionDigits" | "isEnabled" | "sessionConfig" | "bapi" | "storage" | "isDefault") | "paymentProviders")[] | undefined;
939
940
  }, {
940
941
  oauth: {
941
942
  apiHost: string;
@@ -1010,7 +1011,7 @@ declare const StorefrontConfigSchema: z.ZodObject<{
1010
1011
  tls?: boolean | undefined;
1011
1012
  } | undefined;
1012
1013
  } | undefined;
1013
- publicShopData?: string[] | undefined;
1014
+ publicShopData?: (("locale" | "checkout" | "shopId" | "auth" | "currency") | ("domain" | "storeCampaignKeyword" | "idp" | "path" | "redis" | "apiBasePath" | "appKeys" | "currencyFractionDigits" | "isEnabled" | "sessionConfig" | "bapi" | "storage" | "isDefault") | "paymentProviders")[] | undefined;
1014
1015
  }>;
1015
1016
  declare const PublicRuntimeConfigSchema: z.ZodObject<{
1016
1017
  log: z.ZodObject<{
@@ -1253,7 +1254,7 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
1253
1254
  };
1254
1255
  enabled?: boolean | undefined;
1255
1256
  }>>;
1256
- publicShopData: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1257
+ publicShopData: z.ZodOptional<z.ZodArray<z.ZodType<("locale" | "checkout" | "shopId" | "auth" | "currency") | ("domain" | "storeCampaignKeyword" | "idp" | "path" | "redis" | "apiBasePath" | "appKeys" | "currencyFractionDigits" | "isEnabled" | "sessionConfig" | "bapi" | "storage" | "isDefault") | "paymentProviders", z.ZodTypeDef, ("locale" | "checkout" | "shopId" | "auth" | "currency") | ("domain" | "storeCampaignKeyword" | "idp" | "path" | "redis" | "apiBasePath" | "appKeys" | "currencyFractionDigits" | "isEnabled" | "sessionConfig" | "bapi" | "storage" | "isDefault") | "paymentProviders">, "many">>;
1257
1258
  idp: z.ZodOptional<z.ZodObject<{
1258
1259
  enabled: z.ZodBoolean;
1259
1260
  idpKeys: z.ZodArray<z.ZodString, "many">;
@@ -1379,7 +1380,7 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
1379
1380
  tls?: boolean | undefined;
1380
1381
  } | undefined;
1381
1382
  } | undefined;
1382
- publicShopData?: string[] | undefined;
1383
+ publicShopData?: (("locale" | "checkout" | "shopId" | "auth" | "currency") | ("domain" | "storeCampaignKeyword" | "idp" | "path" | "redis" | "apiBasePath" | "appKeys" | "currencyFractionDigits" | "isEnabled" | "sessionConfig" | "bapi" | "storage" | "isDefault") | "paymentProviders")[] | undefined;
1383
1384
  }, {
1384
1385
  oauth: {
1385
1386
  apiHost: string;
@@ -1454,7 +1455,7 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
1454
1455
  tls?: boolean | undefined;
1455
1456
  } | undefined;
1456
1457
  } | undefined;
1457
- publicShopData?: string[] | undefined;
1458
+ publicShopData?: (("locale" | "checkout" | "shopId" | "auth" | "currency") | ("domain" | "storeCampaignKeyword" | "idp" | "path" | "redis" | "apiBasePath" | "appKeys" | "currencyFractionDigits" | "isEnabled" | "sessionConfig" | "bapi" | "storage" | "isDefault") | "paymentProviders")[] | undefined;
1458
1459
  }>, z.ZodObject<{
1459
1460
  shopSelector: z.ZodEnum<["path", "domain", "path_or_default"]>;
1460
1461
  stores: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -2186,7 +2187,7 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
2186
2187
  tls?: boolean | undefined;
2187
2188
  } | undefined;
2188
2189
  } | undefined;
2189
- publicShopData?: string[] | undefined;
2190
+ publicShopData?: (("locale" | "checkout" | "shopId" | "auth" | "currency") | ("domain" | "storeCampaignKeyword" | "idp" | "path" | "redis" | "apiBasePath" | "appKeys" | "currencyFractionDigits" | "isEnabled" | "sessionConfig" | "bapi" | "storage" | "isDefault") | "paymentProviders")[] | undefined;
2190
2191
  } | {
2191
2192
  shopSelector: "domain" | "path" | "path_or_default";
2192
2193
  stores: Record<string, {
@@ -2359,7 +2360,7 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
2359
2360
  tls?: boolean | undefined;
2360
2361
  } | undefined;
2361
2362
  } | undefined;
2362
- publicShopData?: string[] | undefined;
2363
+ publicShopData?: (("locale" | "checkout" | "shopId" | "auth" | "currency") | ("domain" | "storeCampaignKeyword" | "idp" | "path" | "redis" | "apiBasePath" | "appKeys" | "currencyFractionDigits" | "isEnabled" | "sessionConfig" | "bapi" | "storage" | "isDefault") | "paymentProviders")[] | undefined;
2363
2364
  } | {
2364
2365
  shopSelector: "domain" | "path" | "path_or_default";
2365
2366
  stores: Record<string, {
@@ -2462,7 +2463,6 @@ type CheckoutShopConfigType = z.infer<typeof CheckoutShopConfigSchema>;
2462
2463
  type SessionType = z.infer<typeof SessionSchema>;
2463
2464
  type StorageType = z.infer<typeof StorageSchema>;
2464
2465
  type BapiConfigType = z.infer<typeof BapiSchema>;
2465
- type ShopConfigType = z.infer<typeof ShopConfigSchema>;
2466
2466
  type StorefrontConfigType = z.infer<typeof StorefrontConfigSchema>;
2467
2467
  type ShopSelectorType = z.infer<typeof ShopSelectorSchema>;
2468
2468
  type RedirectType = z.infer<typeof RedirectsSchema>;
@@ -131,7 +131,9 @@ const StorefrontConfigSchema = z.object({
131
131
  appKeys: AppKeysSchema,
132
132
  apiBasePath: z.string().optional(),
133
133
  cache: CacheSchema.optional(),
134
- publicShopData: z.array(z.string()).optional(),
134
+ publicShopData: z.array(
135
+ z.custom()
136
+ ).optional(),
135
137
  idp: IdpSchema.optional(),
136
138
  /** @deprecated Global storefront.redis config is being removed in favor of `storefront.storage` config */
137
139
  redis: RedisConfigSchema.optional()