@scayle/storefront-nuxt 7.79.1 → 7.81.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,37 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 7.81.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Support enabling or disabling optional server-side plugins
8
+
9
+ Plugins with optional behavior can now be disabled at build time through `env` variables.
10
+
11
+ - `SFC_PLUGIN_CONFIG_VALIDATION_ENABLED` This plugin executes during app startup and validates the runtime config, exiting with an error if a problem is found. It is enabled by default and can be disabled by setting this variable to `false`.
12
+ - `SFC_PLUGIN_POWERED_BY_ENABLED` This plugin sets the `X-Powered-By-Header` on every HTTP response to incude SCAYLE. It is enabled by default and can be disabled by setting this variable to `false`.
13
+ - `SFC_PLUGIN_RUNTIME_PERFORMANCE_ENABLED` This plugin improves performance by computing the runtime configuration at startup rather than for every request. It is enabled by default and can be disabled by setting this variable to `false`.
14
+
15
+ - Add a plugin to cache the runtime config
16
+
17
+ This change adds a Nitro plugin to calculate the runtime config at startup, rather than for every requests. It offers significant performance improvements for large runtime configs.
18
+
19
+ ### Patch Changes
20
+
21
+ - Add import for runtimeConfig plugin
22
+ - Revert type of `publicShopData` to `string[]`
23
+
24
+ ## 7.80.0
25
+
26
+ ### Minor Changes
27
+
28
+ - Do not set session cookie for cached pages
29
+
30
+ ### Patch Changes
31
+
32
+ - Updated to `nuxt@3.12.2`
33
+ - 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`
34
+
3
35
  ## 7.79.1
4
36
 
5
37
  ### Patch 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.ed010583.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.ed010583.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.ed010583.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.ed010583.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.ed010583.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.ed010583.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.79.0",
3
+ "version": "7.80.0",
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.79.0";
68
+ const PACKAGE_VERSION = "7.80.0";
69
69
  const logger = createConsola({
70
70
  fancy: true,
71
71
  formatOptions: {
@@ -241,8 +241,20 @@ Missing RPC Overrides: ${Array.from(overridenRPCMethodNames).map((name) => `'${n
241
241
  addServerPlugin(
242
242
  resolve("./runtime/nitro/plugins/nitroRuntimeStorageConfig")
243
243
  );
244
- addServerPlugin(resolve("./runtime/nitro/plugins/nitroSetXPoweredByHeader"));
245
- addServerPlugin(resolve("./runtime/nitro/plugins/configValidation"));
244
+ if (yn(process.env.SFC_PLUGIN_CONFIG_VALIDATION_ENABLED, { default: true })) {
245
+ logger.debug("Installing config validation plugin");
246
+ addServerPlugin(resolve("./runtime/nitro/plugins/configValidation"));
247
+ }
248
+ if (yn(process.env.SFC_PLUGIN_POWERED_BY_ENABLED, { default: true })) {
249
+ logger.debug("Installing X-Powered-By plugin");
250
+ addServerPlugin(
251
+ resolve("./runtime/nitro/plugins/nitroSetXPoweredByHeader")
252
+ );
253
+ }
254
+ if (yn(process.env.SFC_PLUGIN_RUNTIME_PERFORMANCE_ENABLED, { default: true })) {
255
+ logger.debug("Installing runtime performance plugin");
256
+ addServerPlugin(resolve("./runtime/nitro/plugins/cacheRuntimeConfig"));
257
+ }
246
258
  nuxt.hooks.hook("nitro:config", (nitroConfig) => {
247
259
  nitroConfig.externals = nitroConfig.externals || {};
248
260
  nitroConfig.externals.inline = nitroConfig.externals.inline || [];
@@ -261,6 +273,7 @@ Missing RPC Overrides: ${Array.from(overridenRPCMethodNames).map((name) => `'${n
261
273
  "server/middleware/cache",
262
274
  "server/utils/cacheStorage",
263
275
  "utils/zodSchema",
276
+ "nitro/plugins/cacheRuntimeConfig",
264
277
  "nitro/plugins/nitroLogger",
265
278
  "nitro/plugins/nitroRuntimeStorageConfig",
266
279
  "nitro/plugins/nitroSetXPoweredByHeader",
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.ed010583.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.ed010583.js';
4
4
  import '@scayle/unstorage-compression-driver';
5
5
  import 'unstorage';
6
6
  import 'zod';
@@ -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 {};
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import { defineNitroPlugin, useRuntimeConfig } from "#imports";
2
+ export default defineNitroPlugin((nitroApp) => {
3
+ const runtimeConfig = useRuntimeConfig();
4
+ nitroApp.hooks.hook("request", (event) => {
5
+ event.context.nitro = event.context.nitro ?? {};
6
+ event.context.nitro.runtimeConfig = runtimeConfig;
7
+ });
8
+ });
@@ -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
  /**
@@ -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>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "7.79.1",
4
+ "version": "7.81.0",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -57,7 +57,7 @@
57
57
  "test:watch": "vitest watch"
58
58
  },
59
59
  "dependencies": {
60
- "@nuxt/kit": "3.11.2",
60
+ "@nuxt/kit": "3.12.2",
61
61
  "@opentelemetry/api": "1.9.0",
62
62
  "@scayle/h3-session": "0.4.0",
63
63
  "@scayle/storefront-core": "7.59.0",
@@ -82,22 +82,22 @@
82
82
  "devDependencies": {
83
83
  "@nuxt/eslint": "0.3.13",
84
84
  "@nuxt/module-builder": "0.5.5",
85
- "@nuxt/schema": "3.11.2",
85
+ "@nuxt/schema": "3.12.2",
86
86
  "@nuxt/test-utils": "3.13.1",
87
87
  "@scayle/eslint-config-storefront": "4.2.0",
88
88
  "@scayle/eslint-plugin-vue-composable": "0.2.0",
89
- "@types/node": "20.14.9",
90
- "dprint": "0.47.0",
89
+ "@types/node": "20.14.10",
90
+ "dprint": "0.47.1",
91
91
  "eslint": "9.6.0",
92
92
  "eslint-formatter-gitlab": "5.1.0",
93
93
  "fishery": "2.2.2",
94
94
  "h3": "1.12.0",
95
95
  "node-mocks-http": "1.15.0",
96
96
  "nuxi": "3.12.0",
97
- "nuxt": "3.11.2",
97
+ "nuxt": "3.12.2",
98
98
  "publint": "0.2.8",
99
- "vitest": "1.6.0",
100
- "vue-tsc": "2.0.24"
99
+ "vitest": "2.0.0",
100
+ "vue-tsc": "2.0.26"
101
101
  },
102
102
  "peerDependencies": {
103
103
  "h3": "^1.10.0",
@@ -108,8 +108,8 @@
108
108
  "resolutions": {
109
109
  "h3": "1.12.0",
110
110
  "vue": "3.4.31",
111
- "@nuxt/kit": "3.11.2",
112
- "@nuxt/schema": "3.11.2"
111
+ "@nuxt/kit": "3.12.2",
112
+ "@nuxt/schema": "3.12.2"
113
113
  },
114
114
  "volta": {
115
115
  "node": "20.15.0"
@@ -595,6 +595,7 @@ declare const ShopConfigSchema: z.ZodObject<{
595
595
  isDefault?: string | boolean | undefined;
596
596
  }>;
597
597
  declare const ShopSelectorSchema: z.ZodEnum<["path", "domain", "path_or_default"]>;
598
+ type ShopConfigType = z.infer<typeof ShopConfigSchema>;
598
599
  declare const StorefrontConfigSchema: z.ZodObject<{
599
600
  session: z.ZodOptional<z.ZodObject<{
600
601
  /**
@@ -1042,7 +1043,6 @@ type CheckoutShopConfigType = z.infer<typeof CheckoutShopConfigSchema>;
1042
1043
  type SessionType = z.infer<typeof SessionSchema>;
1043
1044
  type StorageType = z.infer<typeof StorageSchema>;
1044
1045
  type BapiConfigType = z.infer<typeof BapiSchema>;
1045
- type ShopConfigType = z.infer<typeof ShopConfigSchema>;
1046
1046
  type StorefrontConfigType = z.infer<typeof StorefrontConfigSchema>;
1047
1047
  type ShopSelectorType = z.infer<typeof ShopSelectorSchema>;
1048
1048
  type RedirectType = z.infer<typeof RedirectsSchema>;
@@ -595,6 +595,7 @@ declare const ShopConfigSchema: z.ZodObject<{
595
595
  isDefault?: string | boolean | undefined;
596
596
  }>;
597
597
  declare const ShopSelectorSchema: z.ZodEnum<["path", "domain", "path_or_default"]>;
598
+ type ShopConfigType = z.infer<typeof ShopConfigSchema>;
598
599
  declare const StorefrontConfigSchema: z.ZodObject<{
599
600
  session: z.ZodOptional<z.ZodObject<{
600
601
  /**
@@ -1042,7 +1043,6 @@ type CheckoutShopConfigType = z.infer<typeof CheckoutShopConfigSchema>;
1042
1043
  type SessionType = z.infer<typeof SessionSchema>;
1043
1044
  type StorageType = z.infer<typeof StorageSchema>;
1044
1045
  type BapiConfigType = z.infer<typeof BapiSchema>;
1045
- type ShopConfigType = z.infer<typeof ShopConfigSchema>;
1046
1046
  type StorefrontConfigType = z.infer<typeof StorefrontConfigSchema>;
1047
1047
  type ShopSelectorType = z.infer<typeof ShopSelectorSchema>;
1048
1048
  type RedirectType = z.infer<typeof RedirectsSchema>;