@scayle/storefront-nuxt 7.83.0 → 7.84.1

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/index.d.mts +1 -1
  3. package/dist/index.d.ts +1 -1
  4. package/dist/module.d.mts +2 -2
  5. package/dist/module.d.ts +2 -2
  6. package/dist/module.json +1 -1
  7. package/dist/module.mjs +10 -10
  8. package/dist/rpc.d.mts +1 -1
  9. package/dist/rpc.d.ts +1 -1
  10. package/dist/runtime/api/cacheAuth.mjs +1 -0
  11. package/dist/runtime/composables/core/useIDP.mjs +2 -11
  12. package/dist/runtime/composables/core/useRpc.mjs +3 -1
  13. package/dist/runtime/composables/core/useSession.mjs +10 -17
  14. package/dist/runtime/composables/core/useUser.mjs +7 -14
  15. package/dist/runtime/composables/storefront/useBasket.mjs +11 -24
  16. package/dist/runtime/composables/storefront/useCategories.mjs +2 -10
  17. package/dist/runtime/composables/storefront/useCurrentPromotions.mjs +7 -1
  18. package/dist/runtime/composables/storefront/useSearch.mjs +3 -10
  19. package/dist/runtime/composables/storefront/useStorefrontSearch.mjs +5 -15
  20. package/dist/runtime/composables/storefront/useWishlist.mjs +9 -24
  21. package/dist/runtime/nitro/plugins/configValidation.d.ts +4 -0
  22. package/dist/runtime/nitro/plugins/configValidation.mjs +2 -2
  23. package/dist/runtime/nitro/plugins/nitroRuntimeStorageConfig.mjs +2 -1
  24. package/dist/runtime/server/middleware/bootstrap.d.ts +11 -1
  25. package/dist/runtime/server/middleware/bootstrap.mjs +3 -1
  26. package/dist/runtime/server/middleware/bootstrap.utils.d.ts +2 -2
  27. package/dist/runtime/server/middleware/bootstrap.utils.mjs +9 -7
  28. package/dist/runtime/utils/zodSchema.d.ts +987 -148
  29. package/dist/runtime/utils/zodSchema.mjs +34 -10
  30. package/dist/shared/{storefront-nuxt.87331293.d.mts → storefront-nuxt.d852fe87.d.mts} +21 -7
  31. package/dist/shared/{storefront-nuxt.87331293.d.ts → storefront-nuxt.d852fe87.d.ts} +21 -7
  32. package/package.json +11 -11
@@ -112,7 +112,9 @@ async function bootstrap(event, $shopConfig, $storefrontConfig, apiBasePath, con
112
112
  apiBasePath,
113
113
  $storefrontConfig.publicShopData
114
114
  );
115
- event.context.$availableShops = convertShopsToList($storefrontConfig.stores).filter((store) => store.isEnabled !== false).map(
115
+ event.context.$availableShops = convertShopsToList(
116
+ "shops" in $storefrontConfig ? $storefrontConfig.shops : $storefrontConfig.stores
117
+ ).filter((store) => store.isEnabled !== false).map(
116
118
  (config2) => getPublicShopData(
117
119
  config2,
118
120
  $shopConfig.shopId,
@@ -7,9 +7,9 @@ type BootstrapPath = {
7
7
  };
8
8
  export declare function getBootstrapPath(event: H3Event): BootstrapPath;
9
9
  export declare const getShopByPath: (event: H3Event, shops: ShopConfig[], appBasePath: string) => ShopConfig | undefined;
10
- export declare const convertShopsToList: (stores: ShopConfig[] | ShopConfigIndexed) => ShopConfig[];
10
+ export declare const convertShopsToList: (shops: ShopConfig[] | ShopConfigIndexed) => ShopConfig[];
11
11
  export declare function getApiBasePath(storefrontConfig: ModuleBaseOptions, shop: ShopConfig, baseUrl: string): string;
12
- export declare function getCurrentShopConfigForRequest(event: H3Event, config: Pick<ModuleBaseOptions, 'stores' | 'shopSelector'>, runtimeConfig: NitroRuntimeConfig): ShopConfig | undefined;
12
+ export declare function getCurrentShopConfigForRequest(event: H3Event, storefrontConfig: ModuleBaseOptions, runtimeConfig: NitroRuntimeConfig): ShopConfig | undefined;
13
13
  export declare function getPublicShopData(data: ShopConfig, currentShopId: number, apiBasePath: string, publicShopData?: (keyof ShopConfig)[]): PublicShopConfig & {
14
14
  isActive: boolean;
15
15
  };
@@ -25,11 +25,11 @@ const getShopByPathOrDefault = (event, shops, appBasePath) => {
25
25
  const otherShops = shops.filter((shop) => !shop.isDefault);
26
26
  return getShopByPath(event, otherShops, appBasePath) ?? defaultShop;
27
27
  };
28
- export const convertShopsToList = (stores) => {
29
- if (Array.isArray(stores)) {
30
- return stores;
28
+ export const convertShopsToList = (shops) => {
29
+ if (Array.isArray(shops)) {
30
+ return shops;
31
31
  }
32
- return Object.values(stores);
32
+ return Object.values(shops);
33
33
  };
34
34
  export function getApiBasePath(storefrontConfig, shop, baseUrl) {
35
35
  const path = Array.isArray(shop.path) ? shop.path[0] : shop.path;
@@ -46,10 +46,12 @@ export function getApiBasePath(storefrontConfig, shop, baseUrl) {
46
46
  }
47
47
  return joinURL(baseUrl, apiPath);
48
48
  }
49
- export function getCurrentShopConfigForRequest(event, config, runtimeConfig) {
49
+ export function getCurrentShopConfigForRequest(event, storefrontConfig, runtimeConfig) {
50
50
  let $shopConfig;
51
- const { shopSelector, stores } = config;
52
- const shopsList = convertShopsToList(stores);
51
+ const { shopSelector } = storefrontConfig;
52
+ const shopsList = convertShopsToList(
53
+ "shops" in storefrontConfig ? storefrontConfig.shops : storefrontConfig.stores
54
+ );
53
55
  const headers = getRequestHeaders(event);
54
56
  const shopId = headers["x-shop-id"];
55
57
  if (shopId) {