@scayle/storefront-nuxt 7.61.4 → 7.61.5

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 (28) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/module.json +1 -1
  3. package/dist/runtime/api/rpcHandler.d.ts +40 -1
  4. package/dist/runtime/composables/core/useIDP.d.ts +1 -1
  5. package/dist/runtime/composables/core/useRpc.d.ts +1 -1
  6. package/dist/runtime/composables/core/useRpc.mjs +11 -4
  7. package/dist/runtime/composables/core/useSession.d.ts +13 -7
  8. package/dist/runtime/composables/storefront/useBasket.d.ts +12 -1
  9. package/dist/runtime/composables/storefront/useBrand.d.ts +1 -1
  10. package/dist/runtime/composables/storefront/useBrands.d.ts +1 -1
  11. package/dist/runtime/composables/storefront/useCategories.d.ts +6 -3
  12. package/dist/runtime/composables/storefront/useCategoryByPath.d.ts +1 -5
  13. package/dist/runtime/composables/storefront/useCurrentPromotions.d.ts +1 -1
  14. package/dist/runtime/composables/storefront/useFacet.d.ts +8 -6
  15. package/dist/runtime/composables/storefront/useFilters.d.ts +4 -1
  16. package/dist/runtime/composables/storefront/useNavigationTree.d.ts +1 -1
  17. package/dist/runtime/composables/storefront/useNavigationTrees.d.ts +1 -1
  18. package/dist/runtime/composables/storefront/useProduct.d.ts +1 -1
  19. package/dist/runtime/composables/storefront/useProducts.d.ts +4 -1
  20. package/dist/runtime/composables/storefront/useProductsByIds.d.ts +1 -1
  21. package/dist/runtime/composables/storefront/useProductsCount.d.ts +3 -1
  22. package/dist/runtime/composables/storefront/usePromotions.d.ts +1 -1
  23. package/dist/runtime/composables/storefront/usePromotionsByIds.d.ts +1 -1
  24. package/dist/runtime/composables/storefront/useShopConfiguration.d.ts +1 -1
  25. package/dist/runtime/composables/storefront/useUserAddresses.d.ts +1 -1
  26. package/dist/runtime/composables/storefront/useVariant.d.ts +1 -1
  27. package/dist/runtime/server/middleware/bootstrap.mjs +28 -24
  28. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 7.61.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Log errors that occur when attaching the session in bootstrap
8
+ - Update the type of `data` returned by `useRpc` to indicate that it may be undefined. Note: This may cause new typechecking errors. These cases should be corrected to handle `undefined`. It was always possible for `data` to be `undefined`, but the types did not represent that.
9
+ - Updated dependencies
10
+ - @scayle/storefront-core@7.45.0
11
+
3
12
  ## 7.61.4
4
13
 
5
14
  ### Patch Changes
package/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.9.0"
6
6
  },
7
- "version": "7.61.3"
7
+ "version": "7.61.4"
8
8
  }
@@ -1,2 +1,41 @@
1
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<boolean | string[] | import("@scayle/storefront-core").ShopUser | import("@scayle/storefront-core").Product | import("@scayle/storefront-core").BasketResponseData<import("@scayle/storefront-core").Product, import("@scayle/storefront-core").Variant> | {
2
+ type: "failure";
3
+ statusCode: number;
4
+ basket: import("@scayle/storefront-core").BasketResponseData<import("@scayle/storefront-core").Product, import("@scayle/storefront-core").Variant>;
5
+ } | {
6
+ readonly type: "success";
7
+ readonly basket: import("@scayle/storefront-core").BasketResponseData<import("@scayle/storefront-core").Product, import("@scayle/storefront-core").Variant>;
8
+ } | {
9
+ readonly type: "failure";
10
+ readonly basket: import("@scayle/storefront-core").BasketResponseData<import("@scayle/storefront-core").Product, import("@scayle/storefront-core").Variant>;
11
+ readonly errors: import("@aboutyou/backbone/helpers/BapiClient").AddOrUpdateItemError[];
12
+ } | import("@scayle/storefront-core").BrandsEndpointResponseData | import("@scayle/storefront-core").Brand | {
13
+ categories: import("@scayle/storefront-core").Category[];
14
+ activeNode: undefined;
15
+ } | import("@scayle/storefront-core").Category | {
16
+ categories: import("@scayle/storefront-core").Category;
17
+ activeNode: import("@scayle/storefront-core").Category;
18
+ } | import("@scayle/storefront-core").Order | import("@scayle/storefront-core").Product[] | {
19
+ products: import("@scayle/storefront-core").Product[];
20
+ pagination: import("@aboutyou/backbone/endpoints/products/productsByIds").Pagination;
21
+ } | {
22
+ filters: import("@aboutyou/backbone").FiltersEndpointResponseData;
23
+ unfilteredCount: number;
24
+ } | {
25
+ count: number;
26
+ } | import("@scayle/storefront-core").TypeaheadSuggestionsEndpointResponseData | import("@aboutyou/backbone/endpoints/shopconfiguration/shopconfiguration").ShopConfigurationResponseData | {
27
+ user: import("@scayle/storefront-core").ShopUser | undefined;
28
+ } | import("@scayle/storefront-core").WishlistResponseData | Response | import("@scayle/storefront-core").ShopUserAddress[] | import("@aboutyou/backbone/endpoints/variants/variantsByIds").VariantDetail[] | import("@aboutyou/backbone").NavigationAllEndpointResponseData | import("@scayle/storefront-core").NavigationTree | {
29
+ success: true;
30
+ } | {
31
+ success: false;
32
+ } | {
33
+ result: true;
34
+ } | {
35
+ result: false;
36
+ } | import("@scayle/storefront-core").PromotionsResponseData | {
37
+ [k: string]: string;
38
+ } | {
39
+ message: string;
40
+ } | undefined>>;
2
41
  export default _default;
@@ -1,7 +1,7 @@
1
1
  export declare const useIDP: () => Promise<{
2
2
  data: import("vue").Ref<{
3
3
  [k: string]: string;
4
- }>;
4
+ } | undefined>;
5
5
  fetching: import("vue").Ref<boolean>;
6
6
  fetch: () => Promise<void>;
7
7
  error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
@@ -8,7 +8,7 @@ export interface RpcOptions {
8
8
  }
9
9
  export type Status = 'idle' | 'pending' | 'success' | 'error';
10
10
  export declare const useRpc: <N extends RpcMethodName, P extends RpcMethodParameters<N>, TResult extends Exclude<Awaited<RpcMethodReturnType<N>>, Response>, TParams = P extends RpcContext ? undefined : P>(method: N, key: string, params?: any, options?: RpcOptions) => Promise<{
11
- data: import("vue").Ref<TResult>;
11
+ data: import("vue").Ref<TResult | undefined>;
12
12
  fetching: import("vue").Ref<boolean>;
13
13
  fetch: () => Promise<void>;
14
14
  error: import("vue").Ref<NuxtError<unknown> | undefined>;
@@ -21,13 +21,17 @@ export const useRpc = async (method, key, params, options = { autoFetch: true, l
21
21
  const nuxtApp = useNuxtApp();
22
22
  const isAutoFetchEnabled = options?.autoFetch ?? true;
23
23
  log.debug(`useRpc: ${method}`);
24
- const data = useState(`${method}-${key}-data`);
25
- const fetching = useState(`${method}-${key}-fetching`, () => false);
24
+ const keyPrefix = `${method}-${key}`;
25
+ const data = useState(
26
+ `${keyPrefix}-data`,
27
+ () => void 0
28
+ );
29
+ const fetching = useState(`${keyPrefix}-fetching`, () => false);
26
30
  const error = useState(
27
- `${method}-${key}-error`,
31
+ `${keyPrefix}-error`,
28
32
  () => void 0
29
33
  );
30
- const status = useState(`${method}-${key}-status`, () => "idle");
34
+ const status = useState(`${keyPrefix}-status`, () => "idle");
31
35
  const fetch = async () => {
32
36
  try {
33
37
  status.value = "pending";
@@ -62,6 +66,9 @@ export const useRpc = async (method, key, params, options = { autoFetch: true, l
62
66
  options.lazy ? fetch() : await fetch();
63
67
  }
64
68
  }
69
+ if (data.value === void 0 && error.value) {
70
+ throw createError(error.value);
71
+ }
65
72
  return {
66
73
  data,
67
74
  fetching,
@@ -1,19 +1,25 @@
1
1
  export declare function useSession(): {
2
- login: (params: import("utility-types").Optional<import("@scayle/storefront-core").LoginRequest, "shop_id">) => Promise<void | undefined>;
3
- register: (params: import("utility-types").Optional<import("@scayle/storefront-core").RegisterRequest, "shop_id">) => Promise<void | undefined>;
4
- guestLogin: (params: import("utility-types").Optional<import("@scayle/storefront-core").GuestRequest, "shop_id">) => Promise<void | undefined>;
2
+ login: (params: import("utility-types").Optional<import("@scayle/storefront-core").LoginRequest, "shop_id">) => Promise<never>;
3
+ register: (params: import("utility-types").Optional<import("@scayle/storefront-core").RegisterRequest, "shop_id">) => Promise<never>;
4
+ guestLogin: (params: import("utility-types").Optional<import("@scayle/storefront-core").GuestRequest, "shop_id">) => Promise<never>;
5
5
  refreshToken: () => Promise<{
6
- success: boolean;
6
+ success: true;
7
+ } | {
8
+ success: false;
7
9
  }>;
8
10
  revokeToken: () => Promise<{
9
- result: boolean;
11
+ result: true;
12
+ } | {
13
+ result: false;
10
14
  }>;
11
15
  forgetPassword: (params: {
12
16
  email: string;
13
17
  }) => Promise<{
14
- success: boolean;
18
+ success: true;
19
+ } | {
20
+ success: false;
15
21
  }>;
16
- resetPasswordByHash: (params: import("utility-types").Optional<import("@scayle/storefront-core").UpdatePasswordByHashRequest, "shop_id">) => Promise<void | undefined>;
22
+ resetPasswordByHash: (params: import("utility-types").Optional<import("@scayle/storefront-core").UpdatePasswordByHashRequest, "shop_id">) => Promise<never>;
17
23
  loginWithIDP: (params: {
18
24
  code: string;
19
25
  }) => Promise<{
@@ -46,7 +46,18 @@ export declare function useBasket({ params, key, }?: UseBasketOptions): Promise<
46
46
  mergeBaskets: (args: {
47
47
  fromBasketKey: string;
48
48
  toBasketKey: string;
49
- }) => Promise<any>;
49
+ }) => Promise<{
50
+ type: "failure";
51
+ statusCode: number;
52
+ basket: BasketResponseData<import("@scayle/storefront-core").Product, import("@scayle/storefront-core").Variant>;
53
+ } | {
54
+ readonly type: "success";
55
+ readonly basket: BasketResponseData<import("@scayle/storefront-core").Product, import("@scayle/storefront-core").Variant>;
56
+ } | {
57
+ readonly type: "failure";
58
+ readonly basket: BasketResponseData<import("@scayle/storefront-core").Product, import("@scayle/storefront-core").Variant>;
59
+ readonly errors: import("@aboutyou/backbone/helpers/BapiClient").AddOrUpdateItemError[];
60
+ } | undefined>;
50
61
  error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
51
62
  status: import("vue").Ref<import("nuxt/dist/app/composables/asyncData").AsyncDataRequestStatus>;
52
63
  }>;
@@ -7,7 +7,7 @@ type Options = Partial<{
7
7
  key: string;
8
8
  }>;
9
9
  export declare function useBrand({ params, options, key, }?: Options): Promise<{
10
- data: import("vue").Ref<import("@scayle/storefront-core").Brand>;
10
+ data: import("vue").Ref<import("@scayle/storefront-core").Brand | undefined>;
11
11
  fetching: import("vue").Ref<boolean>;
12
12
  fetch: () => Promise<void>;
13
13
  error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
@@ -7,7 +7,7 @@ type Options = Partial<{
7
7
  key: string;
8
8
  }>;
9
9
  export declare function useBrands({ params, options, key, }?: Options): Promise<{
10
- data: import("vue").Ref<import("@scayle/storefront-core").BrandsEndpointResponseData>;
10
+ data: import("vue").Ref<import("@scayle/storefront-core").BrandsEndpointResponseData | undefined>;
11
11
  fetching: import("vue").Ref<boolean>;
12
12
  fetch: () => Promise<void>;
13
13
  error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
@@ -8,9 +8,12 @@ type Options = Partial<{
8
8
  }>;
9
9
  export declare function useCategories({ params, options, key, }?: Options): Promise<{
10
10
  data: import("vue").Ref<{
11
- categories: import("@scayle/storefront-core").Category | import("@scayle/storefront-core").Category[];
12
- activeNode: import("@scayle/storefront-core").Category | undefined;
13
- }>;
11
+ categories: import("@scayle/storefront-core").Category[];
12
+ activeNode: undefined;
13
+ } | {
14
+ categories: import("@scayle/storefront-core").Category;
15
+ activeNode: import("@scayle/storefront-core").Category;
16
+ } | undefined>;
14
17
  fetching: import("vue").Ref<boolean>;
15
18
  fetch: () => Promise<void>;
16
19
  error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
@@ -7,11 +7,7 @@ type Options = {
7
7
  key: string;
8
8
  };
9
9
  export declare function useCategoryByPath({ params, options, key, }: Options): Promise<{
10
- data: import("vue").Ref<{
11
- path: string;
12
- children?: number | undefined;
13
- includeHidden?: true | undefined;
14
- } | import("@scayle/storefront-core").Category>;
10
+ data: import("vue").Ref<import("@scayle/storefront-core").Category | undefined>;
15
11
  fetching: import("vue").Ref<boolean>;
16
12
  fetch: () => Promise<void>;
17
13
  error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
@@ -7,7 +7,7 @@ type Options = Partial<{
7
7
  key: string;
8
8
  }>;
9
9
  export declare function useCurrentPromotions({ params, options, key, }?: Options): Promise<{
10
- data: import("vue").Ref<import("@scayle/storefront-core").PromotionsResponseData>;
10
+ data: import("vue").Ref<import("@scayle/storefront-core").PromotionsResponseData | undefined>;
11
11
  fetching: import("vue").Ref<boolean>;
12
12
  fetch: () => Promise<void>;
13
13
  error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
@@ -12,23 +12,25 @@ type Options = Partial<{
12
12
  key: string;
13
13
  }>;
14
14
  export declare function useFacet({ key, params, }?: Options): Promise<{
15
- filters: import("vue").ComputedRef<import("@aboutyou/backbone").FiltersEndpointResponseData>;
15
+ filters: import("vue").ComputedRef<import("@aboutyou/backbone").FiltersEndpointResponseData | undefined>;
16
16
  filtersFetching: import("vue").Ref<boolean>;
17
- unfilteredCount: import("vue").ComputedRef<number>;
17
+ unfilteredCount: import("vue").ComputedRef<number | undefined>;
18
18
  filterStatus: import("vue").Ref<import("../core/useRpc").Status>;
19
19
  filterError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
20
- productCountData: import("vue").Ref<import("@scayle/storefront-core").FetchProductsCountResponse>;
20
+ productCountData: import("vue").Ref<{
21
+ count: number;
22
+ } | undefined>;
21
23
  refreshProductCount: ({ where, }?: FilterParams) => Promise<void>;
22
24
  productCountFetching: import("vue").Ref<boolean>;
23
25
  productCountError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
24
26
  productCountStatus: import("vue").Ref<import("../core/useRpc").Status>;
25
- products: import("vue").ComputedRef<import("@scayle/storefront-core").Product[]>;
26
- pagination: import("vue").ComputedRef<import("@scayle/storefront-core").Pagination>;
27
+ products: import("vue").ComputedRef<import("@scayle/storefront-core").Product[] | undefined>;
28
+ pagination: import("vue").ComputedRef<import("@aboutyou/backbone/endpoints/products/productsByIds").Pagination | undefined>;
27
29
  productsFetching: import("vue").Ref<boolean>;
28
30
  filterProducts: ({ where, page, sort, orFiltersOperator, }: FilterParams) => Promise<void>;
29
31
  productError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
30
32
  productStatus: import("vue").Ref<import("../core/useRpc").Status>;
31
- categories: import("vue").ComputedRef<import("@scayle/storefront-core").Category | import("@scayle/storefront-core").Category[]>;
33
+ categories: import("vue").ComputedRef<import("@scayle/storefront-core").Category | import("@scayle/storefront-core").Category[] | undefined>;
32
34
  selectedCategory: import("vue").ComputedRef<import("@scayle/storefront-core").Category | undefined>;
33
35
  categoriesFetching: import("vue").Ref<boolean>;
34
36
  categoriesError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
@@ -7,7 +7,10 @@ type Options = Partial<{
7
7
  key: string;
8
8
  }>;
9
9
  export declare function useFilters({ params, options, key, }?: Options): Promise<{
10
- data: import("vue").Ref<import("@scayle/storefront-core").FetchFiltersResponse>;
10
+ data: import("vue").Ref<{
11
+ filters: import("@aboutyou/backbone").FiltersEndpointResponseData;
12
+ unfilteredCount: number;
13
+ } | undefined>;
11
14
  fetching: import("vue").Ref<boolean>;
12
15
  fetch: () => Promise<void>;
13
16
  error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
@@ -7,7 +7,7 @@ type Options = Partial<{
7
7
  key: string;
8
8
  }>;
9
9
  export declare function useNavigationTree({ params, options, key, }?: Options): Promise<{
10
- data: import("vue").Ref<import("@scayle/storefront-core").NavigationTree>;
10
+ data: import("vue").Ref<import("@scayle/storefront-core").NavigationTree | undefined>;
11
11
  fetching: import("vue").Ref<boolean>;
12
12
  fetch: () => Promise<void>;
13
13
  error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
@@ -7,7 +7,7 @@ type Options = Partial<{
7
7
  key: string;
8
8
  }>;
9
9
  export declare function useNavigationTrees({ params, options, key, }?: Options): Promise<{
10
- data: import("vue").Ref<import("@aboutyou/backbone").NavigationAllEndpointResponseData>;
10
+ data: import("vue").Ref<import("@aboutyou/backbone").NavigationAllEndpointResponseData | undefined>;
11
11
  fetching: import("vue").Ref<boolean>;
12
12
  fetch: () => Promise<void>;
13
13
  error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
@@ -7,7 +7,7 @@ type Options = Partial<{
7
7
  key: string;
8
8
  }>;
9
9
  export declare function useProduct({ params, options, key, }?: Options): Promise<{
10
- data: import("vue").Ref<import("@scayle/storefront-core").Product>;
10
+ data: import("vue").Ref<import("@scayle/storefront-core").Product | undefined>;
11
11
  fetching: import("vue").Ref<boolean>;
12
12
  fetch: () => Promise<void>;
13
13
  error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
@@ -7,7 +7,10 @@ type Options = Partial<{
7
7
  key: string;
8
8
  }>;
9
9
  export declare function useProducts({ params, options, key, }?: Options): Promise<{
10
- data: import("vue").Ref<import("@scayle/storefront-core").ProductsResponse>;
10
+ data: import("vue").Ref<{
11
+ products: import("@scayle/storefront-core").Product[];
12
+ pagination: import("@aboutyou/backbone/endpoints/products/productsByIds").Pagination;
13
+ } | undefined>;
11
14
  fetching: import("vue").Ref<boolean>;
12
15
  fetch: () => Promise<void>;
13
16
  error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
@@ -7,7 +7,7 @@ type Options = Partial<{
7
7
  key: string;
8
8
  }>;
9
9
  export declare function useProductsByIds({ params, options, key, }?: Options): Promise<{
10
- data: import("vue").Ref<import("@scayle/storefront-core").Product[]>;
10
+ data: import("vue").Ref<import("@scayle/storefront-core").Product[] | undefined>;
11
11
  fetching: import("vue").Ref<boolean>;
12
12
  fetch: () => Promise<void>;
13
13
  error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
@@ -7,7 +7,9 @@ type Options = Partial<{
7
7
  key: string;
8
8
  }>;
9
9
  export declare function useProductsCount({ params, options, key, }?: Options): Promise<{
10
- data: import("vue").Ref<import("@scayle/storefront-core").FetchProductsCountResponse>;
10
+ data: import("vue").Ref<{
11
+ count: number;
12
+ } | undefined>;
11
13
  fetching: import("vue").Ref<boolean>;
12
14
  fetch: () => Promise<void>;
13
15
  error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
@@ -7,7 +7,7 @@ type Options = Partial<{
7
7
  key: string;
8
8
  }>;
9
9
  export declare function usePromotions({ params, options, key, }?: Options): Promise<{
10
- data: import("vue").Ref<import("@scayle/storefront-core").PromotionsResponseData>;
10
+ data: import("vue").Ref<import("@scayle/storefront-core").PromotionsResponseData | undefined>;
11
11
  fetching: import("vue").Ref<boolean>;
12
12
  fetch: () => Promise<void>;
13
13
  error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
@@ -7,7 +7,7 @@ type Options = Partial<{
7
7
  key: string;
8
8
  }>;
9
9
  export declare function usePromotionsByIds({ params, options, key, }?: Options): Promise<{
10
- data: import("vue").Ref<import("@scayle/storefront-core").PromotionsResponseData>;
10
+ data: import("vue").Ref<import("@scayle/storefront-core").PromotionsResponseData | undefined>;
11
11
  fetching: import("vue").Ref<boolean>;
12
12
  fetch: () => Promise<void>;
13
13
  error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
@@ -4,7 +4,7 @@ type Options = Partial<{
4
4
  key: string;
5
5
  }>;
6
6
  export declare function useShopConfiguration({ options, key, }?: Options): Promise<{
7
- data: import("vue").Ref<import("@aboutyou/backbone/endpoints/shopconfiguration/shopconfiguration").ShopConfigurationResponseData>;
7
+ data: import("vue").Ref<import("@aboutyou/backbone/endpoints/shopconfiguration/shopconfiguration").ShopConfigurationResponseData | undefined>;
8
8
  fetching: import("vue").Ref<boolean>;
9
9
  fetch: () => Promise<void>;
10
10
  error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
@@ -4,7 +4,7 @@ type Options = Partial<{
4
4
  key: string;
5
5
  }>;
6
6
  export declare function useUserAddresses({ options, key, }?: Options): Promise<{
7
- data: import("vue").Ref<import("@scayle/storefront-core").ShopUserAddress[]>;
7
+ data: import("vue").Ref<import("@scayle/storefront-core").ShopUserAddress[] | undefined>;
8
8
  fetching: import("vue").Ref<boolean>;
9
9
  fetch: () => Promise<void>;
10
10
  error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
@@ -7,7 +7,7 @@ type Options = Partial<{
7
7
  key: string;
8
8
  }>;
9
9
  export declare function useVariant({ params, options, key, }?: Options): Promise<{
10
- data: import("vue").Ref<import("@aboutyou/backbone/endpoints/variants/variantsByIds").VariantDetail[]>;
10
+ data: import("vue").Ref<import("@aboutyou/backbone/endpoints/variants/variantsByIds").VariantDetail[] | undefined>;
11
11
  fetching: import("vue").Ref<boolean>;
12
12
  fetch: () => Promise<void>;
13
13
  error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
@@ -19,6 +19,14 @@ const getShopConfig = (event, config) => {
19
19
  );
20
20
  return $shopConfig;
21
21
  };
22
+ const generateSessionId = (event) => {
23
+ let userId;
24
+ if (event?.context.session?.data?.accessToken) {
25
+ const payload = decodeJwt(event?.context.session?.data?.accessToken);
26
+ userId = payload.customerId;
27
+ }
28
+ return userId ? `${userId}:${randomUUID()}` : randomUUID();
29
+ };
22
30
  async function bootstrap(event, url, $shopConfig, $storefrontConfig, apiBasePath, config) {
23
31
  const log = event.context.$log;
24
32
  const bootstrapLog = log.space("bootstrap");
@@ -44,31 +52,27 @@ async function bootstrap(event, url, $shopConfig, $storefrontConfig, apiBasePath
44
52
  $shopConfig.shopId,
45
53
  log
46
54
  );
47
- const generateSessionId = (event2) => {
48
- let userId;
49
- if (event2?.context.session?.data?.accessToken) {
50
- const payload = decodeJwt(event2?.context.session?.data?.accessToken);
51
- userId = payload.customerId;
52
- }
53
- return userId ? `${userId}:${randomUUID()}` : randomUUID();
54
- };
55
55
  bootstrapLog.debug("Attaching session to request");
56
- await useSession(event, {
57
- ...sessionConfig,
58
- store: sessionStorage,
59
- // @ts-ignore
60
- genid: generateSessionId,
61
- saveUninitialized: true,
62
- cookie: {
63
- maxAge: sessionConfig?.maxAge,
64
- // secure: sessionConfig.isHttps, TODO
65
- sameSite: sessionConfig.sameSite,
66
- domain: sessionConfig?.domain,
67
- path: $storefrontConfig.shopSelector === "path" && $shopConfig.path ? `/${$shopConfig.path}` : void 0
68
- },
69
- name: sessionConfig?.cookieName ?? "$session",
70
- secret: sessionConfig?.secret ?? "current-secret"
71
- });
56
+ try {
57
+ await useSession(event, {
58
+ ...sessionConfig,
59
+ store: sessionStorage,
60
+ // @ts-ignore
61
+ genid: generateSessionId,
62
+ saveUninitialized: true,
63
+ cookie: {
64
+ maxAge: sessionConfig?.maxAge,
65
+ // secure: sessionConfig.isHttps, TODO
66
+ sameSite: sessionConfig.sameSite,
67
+ domain: sessionConfig?.domain,
68
+ path: $storefrontConfig.shopSelector === "path" && $shopConfig.path ? `/${$shopConfig.path}` : void 0
69
+ },
70
+ name: sessionConfig?.cookieName ?? "$session",
71
+ secret: sessionConfig?.secret ?? "current-secret"
72
+ });
73
+ } catch (e) {
74
+ bootstrapLog.error("Error attaching session: ", e);
75
+ }
72
76
  event.context.$currentShop = getPublicShopData(
73
77
  $shopConfig,
74
78
  $shopConfig.shopId,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "7.61.4",
4
+ "version": "7.61.5",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -62,7 +62,7 @@
62
62
  "dependencies": {
63
63
  "@nuxt/kit": "3.10.3",
64
64
  "@scayle/h3-session": "0.3.5",
65
- "@scayle/storefront-core": "7.44.1",
65
+ "@scayle/storefront-core": "7.45.0",
66
66
  "@scayle/unstorage-compression-driver": "0.1.2",
67
67
  "@vueuse/core": "10.9.0",
68
68
  "consola": "3.2.3",
@@ -84,7 +84,7 @@
84
84
  "@nuxt/test-utils": "3.11.0",
85
85
  "@scayle/eslint-config-storefront": "3.2.6",
86
86
  "@scayle/prettier-config-storefront": "2.0.2",
87
- "@types/node": "20.11.26",
87
+ "@types/node": "20.11.28",
88
88
  "eslint": "8.57.0",
89
89
  "eslint-formatter-gitlab": "5.1.0",
90
90
  "h3": "1.11.1",