@scayle/storefront-nuxt 7.61.2 → 7.61.4

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,19 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 7.61.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix the type of unitialized data in `useBasket` and `useWishlist`
8
+
9
+ When the request for the basket/wishlist has not completed or has failed, the `data` property is `undefined`. In the previous release this was inadvertently changed to `null`. Now it is once again `undefined`.
10
+
11
+ ## 7.61.3
12
+
13
+ ### Patch Changes
14
+
15
+ - Fix types of useBasket and useWishlist
16
+
3
17
  ## 7.61.2
4
18
 
5
19
  ### Patch Changes
@@ -13,7 +27,7 @@
13
27
 
14
28
  ### Patch Changes
15
29
 
16
- - `useBasket` and `useWishlist` should no longer trigger duplicate requests when used in multiple components
30
+ - `useBasket` and `useWishlist` should no longer trigger duplicate requests when used in multiple components. Note: As part of this change, the `options` parameter has been removed from both functions.
17
31
 
18
32
  ## 7.61.0
19
33
 
package/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.9.0"
6
6
  },
7
- "version": "7.61.1"
7
+ "version": "7.61.3"
8
8
  }
@@ -1,4 +1,4 @@
1
- import type { AddOrUpdateItemType, RpcMethodParameters } from '@scayle/storefront-core';
1
+ import type { AddOrUpdateItemType, RpcMethodParameters, BasketResponseData } from '@scayle/storefront-core';
2
2
  import { ExistingItemHandling } from '@scayle/storefront-core';
3
3
  import { type MaybeRefOrGetter } from '#imports';
4
4
  type UseBasketOptions = Partial<{
@@ -6,17 +6,17 @@ type UseBasketOptions = Partial<{
6
6
  key: string;
7
7
  }>;
8
8
  export declare function useBasket({ params, key, }?: UseBasketOptions): Promise<{
9
- data: any;
10
- items: import("vue").ComputedRef<any>;
11
- cost: import("vue").ComputedRef<any>;
12
- key: import("vue").ComputedRef<any>;
13
- packages: import("vue").ComputedRef<any>;
9
+ data: import("vue").Ref<BasketResponseData<import("@scayle/storefront-core").Product, import("@scayle/storefront-core").Variant> | undefined>;
10
+ items: import("vue").ComputedRef<import("@scayle/storefront-core").BasketItem<import("@scayle/storefront-core").Product, import("@scayle/storefront-core").Variant>[] | undefined>;
11
+ cost: import("vue").ComputedRef<import("@scayle/storefront-core").BasketTotalPrice | undefined>;
12
+ key: import("vue").ComputedRef<import("@aboutyou/backbone").BasketKey | undefined>;
13
+ packages: import("vue").ComputedRef<import("@aboutyou/backbone").BasketPackageInformation[] | undefined>;
14
14
  shippingDates: import("vue").ComputedRef<(string | null)[] | undefined>;
15
15
  isEmpty: import("vue").ComputedRef<boolean>;
16
- fetching: any;
17
- fetch: any;
18
- count: import("vue").ComputedRef<any>;
19
- countWithoutSoldOutItems: import("vue").ComputedRef<any>;
16
+ fetching: import("vue").Ref<boolean>;
17
+ fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions | undefined) => Promise<void>;
18
+ count: import("vue").ComputedRef<number | undefined>;
19
+ countWithoutSoldOutItems: import("vue").ComputedRef<number | undefined>;
20
20
  addItem: ({ variantId, promotionId, quantity, existingItemHandling, displayData, customData, itemGroup, }: AddOrUpdateItemType & {
21
21
  existingItemHandling?: 0 | 1 | 2 | 3 | undefined;
22
22
  }) => Promise<void>;
@@ -30,12 +30,12 @@ export declare function useBasket({ params, key, }?: UseBasketOptions): Promise<
30
30
  } | {
31
31
  productId: number;
32
32
  }) => boolean;
33
- products: import("vue").ComputedRef<any>;
33
+ products: import("vue").ComputedRef<import("@scayle/storefront-core").Product[]>;
34
34
  findItem: (item: {
35
35
  variantId: number;
36
36
  } | {
37
37
  productId: number;
38
- }) => any;
38
+ }) => import("@scayle/storefront-core").BasketItem<import("@scayle/storefront-core").Product, import("@scayle/storefront-core").Variant> | undefined;
39
39
  generateBasketKey: ({ keyTemplate, hashAlgorithm, shopId, userId, log, }: {
40
40
  keyTemplate: string;
41
41
  hashAlgorithm: import("@scayle/storefront-core").HashAlgorithm;
@@ -47,7 +47,7 @@ export declare function useBasket({ params, key, }?: UseBasketOptions): Promise<
47
47
  fromBasketKey: string;
48
48
  toBasketKey: string;
49
49
  }) => Promise<any>;
50
- error: any;
51
- status: any;
50
+ error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
51
+ status: import("vue").Ref<import("nuxt/dist/app/composables/asyncData").AsyncDataRequestStatus>;
52
52
  }>;
53
53
  export {};
@@ -6,12 +6,12 @@ import {
6
6
  HttpStatusCode,
7
7
  HttpStatusMessage
8
8
  } from "@scayle/storefront-core";
9
- import { useNuxtApp } from "nuxt/app";
9
+ import { useNuxtApp, useAsyncData } from "nuxt/app";
10
10
  import { computed } from "vue";
11
11
  import { useEventListener } from "@vueuse/core";
12
12
  import { rpcCall } from "../../rpc/rpcCall.mjs";
13
13
  import { useCurrentShop } from "../core/useCurrentShop.mjs";
14
- import { toValue, toRef, useAsyncData } from "#imports";
14
+ import { toValue, toRef } from "#imports";
15
15
  const onCheckoutUpdate = async (event, fetching, fetchCallback) => {
16
16
  if (fetching) {
17
17
  return;
@@ -44,8 +44,9 @@ export async function useBasket({
44
44
  watch: [toRef(params)],
45
45
  dedupe: "defer",
46
46
  getCachedData: (key2) => {
47
- return toValue(nuxtApp._asyncData[key2]?.data);
48
- }
47
+ return toValue(nuxtApp._asyncData[key2]?.data) ?? void 0;
48
+ },
49
+ default: () => void 0
49
50
  }
50
51
  );
51
52
  useEventListener(
@@ -1,14 +1,14 @@
1
- import type { RpcMethodParameters } from '@scayle/storefront-core';
1
+ import type { Product, WishlistItem, RpcMethodParameters, WishlistResponseData } from '@scayle/storefront-core';
2
2
  import type { MaybeRefOrGetter } from '#imports';
3
3
  type Options = Partial<{
4
4
  params: MaybeRefOrGetter<RpcMethodParameters<'getWishlist'>>;
5
5
  key: string;
6
6
  }>;
7
7
  export declare function useWishlist({ params, key, }?: Options): Promise<{
8
- data: any;
9
- count: import("vue").ComputedRef<any>;
10
- items: import("vue").ComputedRef<any>;
11
- products: import("vue").ComputedRef<any>;
8
+ data: import("vue").Ref<WishlistResponseData | undefined>;
9
+ count: import("vue").ComputedRef<number | undefined>;
10
+ items: import("vue").ComputedRef<WishlistItem[] | undefined>;
11
+ products: import("vue").ComputedRef<Product[]>;
12
12
  addItem: (item: {
13
13
  variantId?: number;
14
14
  productId?: number;
@@ -25,8 +25,8 @@ export declare function useWishlist({ params, key, }?: Options): Promise<{
25
25
  productId?: number;
26
26
  }) => Promise<void>;
27
27
  clear: () => Promise<void>;
28
- fetching: any;
29
- fetch: any;
28
+ fetching: import("vue").Ref<boolean>;
29
+ fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions | undefined) => Promise<void>;
30
30
  toggleItem: (item: {
31
31
  variantId?: number;
32
32
  productId?: number;
@@ -34,13 +34,13 @@ export declare function useWishlist({ params, key, }?: Options): Promise<{
34
34
  findItem: (item: {
35
35
  variantId?: number;
36
36
  productId?: number;
37
- }) => any;
37
+ }) => WishlistItem | undefined;
38
38
  contains: (item: {
39
39
  variantId: number;
40
40
  } | {
41
41
  productId: number;
42
42
  }) => boolean;
43
- error: any;
44
- status: any;
43
+ error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
44
+ status: import("vue").Ref<import("nuxt/dist/app/composables/asyncData").AsyncDataRequestStatus>;
45
45
  }>;
46
46
  export {};
@@ -3,11 +3,11 @@ import {
3
3
  HttpStatusMessage,
4
4
  HttpStatusCode
5
5
  } from "@scayle/storefront-core";
6
- import { useNuxtApp } from "nuxt/app";
6
+ import { useNuxtApp, useAsyncData } from "nuxt/app";
7
7
  import { computed } from "vue";
8
8
  import { rpcCall } from "../../rpc/rpcCall.mjs";
9
9
  import { useCurrentShop } from "../core/useCurrentShop.mjs";
10
- import { toValue, toRef, useAsyncData } from "#imports";
10
+ import { toValue, toRef } from "#imports";
11
11
  export async function useWishlist({
12
12
  params,
13
13
  key = "useWishlist"
@@ -29,8 +29,9 @@ export async function useWishlist({
29
29
  watch: [toRef(params)],
30
30
  dedupe: "defer",
31
31
  getCachedData: (key2) => {
32
- return toValue(nuxtApp._asyncData[key2]?.data);
33
- }
32
+ return toValue(nuxtApp._asyncData[key2]?.data) ?? void 0;
33
+ },
34
+ default: () => void 0
34
35
  }
35
36
  );
36
37
  const addItem = async (item) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "7.61.2",
4
+ "version": "7.61.4",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -70,9 +70,9 @@
70
70
  "defu": "6.1.4",
71
71
  "jose": "^5.2.0",
72
72
  "knitwork": "1.0.0",
73
- "nitropack": "2.9.1",
73
+ "nitropack": "2.9.3",
74
74
  "ofetch": "1.3.3",
75
- "radash": "12.0.0",
75
+ "radash": "12.1.0",
76
76
  "uncrypto": "0.1.3",
77
77
  "unstorage": "1.10.1",
78
78
  "vue-router": "4.3.0",
@@ -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.25",
87
+ "@types/node": "20.11.26",
88
88
  "eslint": "8.57.0",
89
89
  "eslint-formatter-gitlab": "5.1.0",
90
90
  "h3": "1.11.1",