@scayle/storefront-nuxt 7.84.6 → 7.85.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 (30) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +1 -1
  4. package/dist/runtime/composables/core/useIDP.mjs +1 -1
  5. package/dist/runtime/composables/core/useRpc.d.ts +20 -13
  6. package/dist/runtime/composables/storefront/useBasket.d.ts +6 -6
  7. package/dist/runtime/composables/storefront/useBasket.mjs +2 -2
  8. package/dist/runtime/composables/storefront/useBrand.d.ts +4 -6
  9. package/dist/runtime/composables/storefront/useBrands.d.ts +4 -6
  10. package/dist/runtime/composables/storefront/useCategories.d.ts +7 -8
  11. package/dist/runtime/composables/storefront/useCategoryById.d.ts +4 -6
  12. package/dist/runtime/composables/storefront/useCategoryByPath.d.ts +4 -6
  13. package/dist/runtime/composables/storefront/useCurrentPromotions.d.ts +4 -6
  14. package/dist/runtime/composables/storefront/useFacet.d.ts +12 -12
  15. package/dist/runtime/composables/storefront/useFilters.d.ts +4 -6
  16. package/dist/runtime/composables/storefront/useNavigationTree.d.ts +4 -6
  17. package/dist/runtime/composables/storefront/useNavigationTrees.d.ts +4 -6
  18. package/dist/runtime/composables/storefront/useProduct.d.ts +4 -6
  19. package/dist/runtime/composables/storefront/useProducts.d.ts +4 -6
  20. package/dist/runtime/composables/storefront/useProductsByIds.d.ts +4 -6
  21. package/dist/runtime/composables/storefront/useProductsByReferenceKeys.d.ts +4 -6
  22. package/dist/runtime/composables/storefront/useProductsCount.d.ts +4 -6
  23. package/dist/runtime/composables/storefront/usePromotions.d.ts +4 -6
  24. package/dist/runtime/composables/storefront/usePromotionsByIds.d.ts +4 -6
  25. package/dist/runtime/composables/storefront/useShopConfiguration.d.ts +4 -6
  26. package/dist/runtime/composables/storefront/useUserAddresses.d.ts +4 -6
  27. package/dist/runtime/composables/storefront/useVariant.d.ts +4 -6
  28. package/dist/runtime/composables/storefront/useWishlist.d.ts +2 -2
  29. package/dist/runtime/composables/storefront/useWishlist.mjs +1 -1
  30. package/package.json +9 -9
package/CHANGELOG.md CHANGED
@@ -1,5 +1,90 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 7.85.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix `@vueuse/core` version to `11.0.3`
8
+
9
+ ## 7.85.0
10
+
11
+ ### Minor Changes
12
+
13
+ - Fix typing when using `transform`, `default` or `pick` in RPC composables
14
+
15
+ NOTE: This update corrects some broken typings and as a result may require some code changes.
16
+ Previously many composables asserted that the default value would match the response value even when relying on the fallback `default` factory function: `() => null`.
17
+ Due to this, the `data` property would be typed as `Ref<T>` even when it would be `Ref<null>` in case of error on a still pending request.
18
+ The types have now been corrected to respect the `default` factory function's return and accurately represent the behavior.
19
+ This means that you may have to add additional null checks in your code for typechecking to pass.
20
+
21
+ For example:
22
+
23
+ **In 7.84.6**
24
+
25
+ ```ts
26
+ useBrand({
27
+ params: { brandId: 1 },
28
+ }).data satisfies Ref<Brand>
29
+
30
+ useBrand({
31
+ params: { brandId: 1 },
32
+ options: {
33
+ pick: ['id', 'isActive'],
34
+ },
35
+ }).data satisfies Ref<Brand>
36
+
37
+ useBrand({
38
+ params: { brandId: 1 },
39
+ options: {
40
+ transform: (brand) => brand.slug,
41
+ },
42
+ }).data satisfies Ref<Brand>
43
+
44
+ useBrand({
45
+ params: { brandId: 1 },
46
+ options: {
47
+ default: () => 'Brand not found',
48
+ },
49
+ }).data satisfies Ref<Brand>
50
+ ```
51
+
52
+ **In 7.85.0**
53
+
54
+ ```ts
55
+ useBrand({
56
+ params: { brandId: 1 },
57
+ }).data satisfies Ref<Brand | null>
58
+
59
+ useBrand({
60
+ params: { brandId: 1 },
61
+ options: {
62
+ pick: ['id', 'isActive'],
63
+ },
64
+ }).data satisfies Ref<Pick<Brand, 'id' | 'isActive'> | null>
65
+
66
+ useBrand({
67
+ params: { brandId: 1 },
68
+ options: {
69
+ transform: (brand) => brand.slug,
70
+ },
71
+ }).data satisfies Ref<string | null>
72
+
73
+ useBrand({
74
+ params: { brandId: 1 },
75
+ options: {
76
+ default: () => 'Brand not found',
77
+ },
78
+ }).data satisfies Ref<Brand | string>
79
+ ```
80
+
81
+ For more details on `useAsyncData` usage check out the [Nuxt Docs](https://nuxt.com/docs/api/composables/use-async-data)
82
+
83
+ ### Patch Changes
84
+
85
+ - Updated dependencies
86
+ - @scayle/storefront-core@7.64.3
87
+
3
88
  ## 7.84.6
4
89
 
5
90
  ### Patch Changes
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
- "version": "7.84.6",
3
+ "version": "7.85.1",
4
4
  "configKey": "storefront",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.9.0"
package/dist/module.mjs CHANGED
@@ -66,7 +66,7 @@ export default {
66
66
  }`;
67
67
  }
68
68
  const PACKAGE_NAME = "@scayle/storefront-nuxt";
69
- const PACKAGE_VERSION = "7.84.6";
69
+ const PACKAGE_VERSION = "7.85.1";
70
70
  const logger = createConsola({
71
71
  fancy: true,
72
72
  formatOptions: {
@@ -23,7 +23,7 @@ export function useIDP(params = {}, key) {
23
23
  error,
24
24
  refresh,
25
25
  status,
26
- // TODO: Deprecate the property here and remove it with the next major release
26
+ // TODO: [Next Major Release] Deprecate the property here and remove it with the next major release
27
27
  handleIDPLoginCallback
28
28
  });
29
29
  }
@@ -2,23 +2,30 @@ import type { RpcContext, RpcMethodName, RpcMethodParameters, RpcMethodReturnTyp
2
2
  import type { AsyncDataOptions } from 'nuxt/app';
3
3
  import { useAsyncData } from 'nuxt/app';
4
4
  import type { MaybeRefOrGetter } from '#imports';
5
- type KeysOf<T> = Array<T extends T ? (keyof T extends string ? keyof T : never) : never>;
6
- export type RpcAsyncDataOptions<TResult> = AsyncDataOptions<TResult, TResult, KeysOf<TResult>, TResult>;
7
- export interface RpcOptions {
5
+ export type KeysOf<T> = Array<T extends T ? (keyof T extends string ? keyof T : never) : never>;
6
+ export type RpcOptions = {
8
7
  /** @deprecated use immediate instead */
9
8
  autoFetch?: boolean;
10
9
  lazy?: boolean;
11
- }
12
- export type UseRpcOptions<N extends RpcMethodName> = RpcOptions & RpcAsyncDataOptions<Exclude<Awaited<RpcMethodReturnType<N>>, Response>>;
13
- export type UseRpcReturn<N extends RpcMethodName> = ExtendedAsyncData<Exclude<Awaited<RpcMethodReturnType<N>>, Response>>;
10
+ };
11
+ /** The normalized return type of an RPC */
12
+ export type NormalizedRpcResponse<N extends RpcMethodName> = Exclude<Awaited<RpcMethodReturnType<N>>, Response>;
13
+ /**
14
+ * Extend AsyncDataOptions with autoFetch (deprecated) and lazy (unused)
15
+ */
16
+ export type UseRpcOptions<N extends RpcMethodName, DataT = NormalizedRpcResponse<N>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null> = RpcOptions & AsyncDataOptions<NormalizedRpcResponse<N>, DataT, PickKeys, DefaultT>;
17
+ /**
18
+ * The return type of a composable based on useRpc
19
+ */
20
+ export type UseRpcReturn<N extends RpcMethodName, DataT = NormalizedRpcResponse<N>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null> = ExtendedAsyncData<NormalizedRpcResponse<N>, unknown, DataT, PickKeys, DefaultT>;
14
21
  export type Status = 'idle' | 'pending' | 'success' | 'error';
15
- type AsyncData<T> = ReturnType<typeof useAsyncData<T>>;
16
- type AwaitedAsyncData<T> = Awaited<AsyncData<T>>;
17
- type _ExtendedAsyncData<T> = AwaitedAsyncData<T> & {
18
- fetching: AwaitedAsyncData<T>['pending'];
19
- fetch: AwaitedAsyncData<T>['refresh'];
22
+ type AsyncData<ResT, ErrorT = unknown, DataT = ResT, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null> = ReturnType<typeof useAsyncData<ResT, ErrorT, DataT, PickKeys, DefaultT>>;
23
+ type AwaitedAsyncData<ResT, ErrorT = unknown, DataT = ResT, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null> = Awaited<AsyncData<ResT, ErrorT, DataT, PickKeys, DefaultT>>;
24
+ type _ExtendedAsyncData<ResT, ErrorT = unknown, DataT = ResT, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null> = AwaitedAsyncData<ResT, ErrorT, DataT, PickKeys, DefaultT> & {
25
+ fetching: AwaitedAsyncData<ResT, ErrorT, DataT, PickKeys, DefaultT>['pending'];
26
+ fetch: AwaitedAsyncData<ResT, ErrorT, DataT, PickKeys, DefaultT>['refresh'];
20
27
  };
21
- export type ExtendedAsyncData<T> = _ExtendedAsyncData<T> & Promise<_ExtendedAsyncData<T>>;
28
+ export type ExtendedAsyncData<ResT, ErrorT = unknown, DataT = ResT, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null> = _ExtendedAsyncData<ResT, ErrorT, DataT, PickKeys, DefaultT> & Promise<_ExtendedAsyncData<ResT, ErrorT, DataT, PickKeys, DefaultT>>;
22
29
  /**
23
30
  * `useRpc` is a wrapper around `useAsyncData` for registered RPC methods
24
31
  *
@@ -43,5 +50,5 @@ export type ExtendedAsyncData<T> = _ExtendedAsyncData<T> & Promise<_ExtendedAsyn
43
50
  * But anything passed here will take precedence.
44
51
  * @see {@link https://nuxt.com/docs/api/composables/use-async-data#params}
45
52
  */
46
- export declare function 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?: MaybeRefOrGetter<TParams>, options?: RpcAsyncDataOptions<TResult> & RpcOptions): ExtendedAsyncData<TResult>;
53
+ export declare function useRpc<N extends RpcMethodName, DataT = NormalizedRpcResponse<N>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>(method: N, key: string, params?: MaybeRefOrGetter<RpcMethodParameters<N> extends RpcContext ? undefined : RpcMethodParameters<N>>, options?: UseRpcOptions<N, DataT, PickKeys, DefaultT>): ExtendedAsyncData<NormalizedRpcResponse<N>, unknown, DataT, PickKeys, DefaultT>;
47
54
  export {};
@@ -32,13 +32,13 @@ type UseBasketBaseReturn = Awaited<UseRpcReturn<'getBasket'>> & {
32
32
  removeItemByKey: (itemKey: string) => Promise<void>;
33
33
  clear: () => Promise<void>;
34
34
  products: ComputedRef<Product[]>;
35
- count: ComputedRef<number>;
36
- countWithoutSoldOutItems: ComputedRef<number>;
37
- items: ComputedRef<BasketItem[]>;
38
- cost: ComputedRef<BasketTotalPrice>;
39
- key: ComputedRef<BasketKey>;
35
+ count: ComputedRef<number | undefined>;
36
+ countWithoutSoldOutItems: ComputedRef<number | undefined>;
37
+ items: ComputedRef<BasketItem[] | undefined>;
38
+ cost: ComputedRef<BasketTotalPrice | undefined>;
39
+ key: ComputedRef<BasketKey | undefined>;
40
40
  isEmpty: ComputedRef<boolean>;
41
- packages: ComputedRef<BasketPackageInformation[]>;
41
+ packages: ComputedRef<BasketPackageInformation[] | undefined>;
42
42
  shippingDates: ComputedRef<(string | null)[] | undefined>;
43
43
  };
44
44
  export declare function useBasket({ params, key, }?: UseBasketOptions): UseBasketBaseReturn & Promise<UseBasketBaseReturn>;
@@ -27,7 +27,7 @@ export function useBasket({
27
27
  const removeItemFromBasketRpc = useRpcCall("removeItemFromBasket");
28
28
  const asyncData = useRpc("getBasket", key, params, {
29
29
  server: false,
30
- // TODO: In some cases it might be ok to fetch on server
30
+ // NOTE: In some cases it might be ok to fetch on server
31
31
  watch: [toRef(params)],
32
32
  dedupe: "defer",
33
33
  getCachedData: (key2) => {
@@ -125,7 +125,7 @@ export function useBasket({
125
125
  () => {
126
126
  const mainItemQuantities = /* @__PURE__ */ new Map();
127
127
  const soldOutItemGroups = /* @__PURE__ */ new Set();
128
- let count2 = data.value?.items?.reduce((prev, current) => {
128
+ let count2 = (data.value?.items ?? []).reduce((prev, current) => {
129
129
  if (current.itemGroup?.id) {
130
130
  if (current.itemGroup.isMainItem) {
131
131
  mainItemQuantities.set(current.itemGroup.id, current.quantity);
@@ -1,11 +1,9 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
- import type { UseRpcOptions, UseRpcReturn } from '../core/useRpc';
2
+ import type { UseRpcOptions, UseRpcReturn, NormalizedRpcResponse, KeysOf } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
- type Options = Partial<{
4
+ export declare function useBrand<DataT = NormalizedRpcResponse<'getBrandById'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getBrandById'>>;
6
- options: UseRpcOptions<'getBrandById'>;
6
+ options: UseRpcOptions<'getBrandById', DataT, PickKeys, DefaultT>;
7
7
  /** @deprecated use the second argument of the composable to define the key */
8
8
  key: string;
9
- }>;
10
- export declare function useBrand({ params, options, key: _key, }?: Options, key?: string): UseRpcReturn<'getBrandById'>;
11
- export {};
9
+ }>, key?: string): UseRpcReturn<'getBrandById', DataT, PickKeys, DefaultT>;
@@ -1,11 +1,9 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
- import type { UseRpcOptions, UseRpcReturn } from '../core/useRpc';
2
+ import type { UseRpcOptions, UseRpcReturn, NormalizedRpcResponse, KeysOf } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
- type Options = Partial<{
4
+ export declare function useBrands<DataT = NormalizedRpcResponse<'getBrands'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getBrands'>>;
6
- options: UseRpcOptions<'getBrands'>;
6
+ options: UseRpcOptions<'getBrands', DataT, PickKeys, DefaultT>;
7
7
  /** @deprecated use the second argument of the composable to define the key */
8
8
  key: string;
9
- }>;
10
- export declare function useBrands({ params, options, key: _key, }?: Options, key?: string): UseRpcReturn<'getBrands'>;
11
- export {};
9
+ }>, key?: string): UseRpcReturn<'getBrands', DataT, PickKeys, DefaultT>;
@@ -1,14 +1,13 @@
1
1
  import type { RpcMethodParameters, RpcMethodReturnType } from '@scayle/storefront-core';
2
- import { type UseRpcOptions, type UseRpcReturn } from '../core/useRpc';
2
+ import type { KeysOf, UseRpcOptions, UseRpcReturn, NormalizedRpcResponse } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
- type Options = Partial<{
4
+ type UseCategoriesBaseReturn<DataT, PickKeys extends KeysOf<DataT>, DefaultT> = Pick<Awaited<UseRpcReturn<'getCategoriesByPath', DataT, PickKeys, DefaultT>>, 'data' | 'error' | 'status' | 'fetch' | 'fetching' | 'refresh'> & {
5
+ getCategoryById: (id: number, includeHidden?: true) => RpcMethodReturnType<'getCategoryById'>;
6
+ };
7
+ export declare function useCategories<DataT = NormalizedRpcResponse<'getCategoriesByPath'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
5
8
  params: MaybeRefOrGetter<RpcMethodParameters<'getCategoriesByPath'>>;
6
- options: UseRpcOptions<'getCategoriesByPath'>;
9
+ options: UseRpcOptions<'getCategoriesByPath', DataT, PickKeys, DefaultT>;
7
10
  /** @deprecated use the second argument of the composable to define the key */
8
11
  key: string;
9
- }>;
10
- type UseCategoriesBaseReturn = Pick<Awaited<UseRpcReturn<'getCategoriesByPath'>>, 'data' | 'error' | 'status' | 'fetch' | 'fetching' | 'refresh'> & {
11
- getCategoryById: (id: number, includeHidden?: true) => RpcMethodReturnType<'getCategoryById'>;
12
- };
13
- export declare function useCategories({ params, options, key: _key, }?: Options, key?: string): UseCategoriesBaseReturn & Promise<UseCategoriesBaseReturn>;
12
+ }>, key?: string): UseCategoriesBaseReturn<DataT, PickKeys, DefaultT> & Promise<UseCategoriesBaseReturn<DataT, PickKeys, DefaultT>>;
14
13
  export {};
@@ -1,11 +1,9 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
- import type { UseRpcOptions, UseRpcReturn } from '../core/useRpc';
2
+ import type { UseRpcOptions, UseRpcReturn, NormalizedRpcResponse, KeysOf } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
- type Options = Partial<{
4
+ export declare function useCategoryById<DataT = NormalizedRpcResponse<'getCategoryById'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getCategoryById'>>;
6
- options: UseRpcOptions<'getCategoryById'>;
6
+ options: UseRpcOptions<'getCategoryById', DataT, PickKeys, DefaultT>;
7
7
  /** @deprecated use the second argument of the composable to define the key */
8
8
  key: string;
9
- }>;
10
- export declare function useCategoryById({ params, options, key: _key, }?: Options, key?: string): UseRpcReturn<'getCategoryById'>;
11
- export {};
9
+ }>, key?: string): UseRpcReturn<'getCategoryById', DataT, PickKeys, DefaultT>;
@@ -1,11 +1,9 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
- import type { UseRpcOptions, UseRpcReturn } from '../core/useRpc';
2
+ import type { UseRpcOptions, UseRpcReturn, NormalizedRpcResponse, KeysOf } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
- type Options = {
4
+ export declare function useCategoryByPath<DataT = NormalizedRpcResponse<'getCategoryByPath'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }: {
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getCategoryByPath'>>;
6
- options?: UseRpcOptions<'getCategoryByPath'>;
6
+ options?: UseRpcOptions<'getCategoryByPath', DataT, PickKeys, DefaultT>;
7
7
  /** @deprecated use the second argument of the composable to define the key */
8
8
  key: string;
9
- };
10
- export declare function useCategoryByPath({ params, options, key: _key, }: Options, key?: string): UseRpcReturn<'getCategoryByPath'>;
11
- export {};
9
+ }, key?: string): UseRpcReturn<'getCategoryByPath', DataT, PickKeys, DefaultT>;
@@ -1,11 +1,9 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
- import { type UseRpcOptions, type UseRpcReturn } from '../core/useRpc';
2
+ import type { KeysOf, UseRpcOptions, UseRpcReturn, NormalizedRpcResponse } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
- type Options = Partial<{
4
+ export declare function useCurrentPromotions<DataT = NormalizedRpcResponse<'getCurrentPromotions'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getCurrentPromotions'>>;
6
- options: UseRpcOptions<'getCurrentPromotions'>;
6
+ options: UseRpcOptions<'getCurrentPromotions', DataT, PickKeys, DefaultT>;
7
7
  /** @deprecated use the second argument of the composable to define the key */
8
8
  key: string;
9
- }>;
10
- export declare function useCurrentPromotions({ params, options, key: _key, }?: Options, key?: string): UseRpcReturn<'getCurrentPromotions'>;
11
- export {};
9
+ }>, key?: string): UseRpcReturn<'getCurrentPromotions', DataT, PickKeys, DefaultT>;
@@ -15,19 +15,19 @@ type Options = Partial<{
15
15
  key: string;
16
16
  }>;
17
17
  export declare function useFacet({ key: optionsKey, params, }?: Options, _key?: string): {
18
- filters: import("vue").ComputedRef<import("@scayle/storefront-api").FiltersEndpointResponseData>;
18
+ filters: import("vue").ComputedRef<import("@scayle/storefront-api").FiltersEndpointResponseData | undefined>;
19
19
  filtersFetching: import("vue").Ref<boolean>;
20
- unfilteredCount: import("vue").ComputedRef<number>;
20
+ unfilteredCount: import("vue").ComputedRef<number | undefined>;
21
21
  filterStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
22
22
  filterError: import("vue").Ref<any>;
23
23
  productCountData: import("vue").Ref<{
24
24
  count: number;
25
- }>;
25
+ } | null>;
26
26
  refreshProductCount: ({ where, }?: FilterParams) => Promise<void>;
27
27
  productCountFetching: import("vue").Ref<boolean>;
28
28
  productCountError: import("vue").Ref<any>;
29
29
  productCountStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
30
- products: import("vue").ComputedRef<import("@scayle/storefront-api").Product[]>;
30
+ products: import("vue").ComputedRef<import("@scayle/storefront-api").Product[] | undefined>;
31
31
  pagination: import("vue").ComputedRef<{
32
32
  current: number;
33
33
  total: number;
@@ -37,12 +37,12 @@ export declare function useFacet({ key: optionsKey, params, }?: Options, _key?:
37
37
  prev: number;
38
38
  next: number;
39
39
  last: number;
40
- }>;
40
+ } | undefined>;
41
41
  productsFetching: import("vue").Ref<boolean>;
42
42
  filterProducts: ({ where, page, sort, orFiltersOperator, }: FilterParams) => Promise<void>;
43
43
  productError: import("vue").Ref<any>;
44
44
  productStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
45
- categories: import("vue").ComputedRef<import("@scayle/storefront-api").Category | import("@scayle/storefront-api").Category[]>;
45
+ categories: import("vue").ComputedRef<import("@scayle/storefront-api").Category | import("@scayle/storefront-api").Category[] | undefined>;
46
46
  selectedCategory: import("vue").ComputedRef<import("@scayle/storefront-api").Category | undefined>;
47
47
  categoriesFetching: import("vue").Ref<boolean>;
48
48
  categoriesError: import("vue").Ref<any>;
@@ -54,19 +54,19 @@ export declare function useFacet({ key: optionsKey, params, }?: Options, _key?:
54
54
  }) => Promise<true | undefined>;
55
55
  fetchPage: (pageToFetch: number) => Promise<void>;
56
56
  } & Promise<{
57
- filters: import("vue").ComputedRef<import("@scayle/storefront-api").FiltersEndpointResponseData>;
57
+ filters: import("vue").ComputedRef<import("@scayle/storefront-api").FiltersEndpointResponseData | undefined>;
58
58
  filtersFetching: import("vue").Ref<boolean>;
59
- unfilteredCount: import("vue").ComputedRef<number>;
59
+ unfilteredCount: import("vue").ComputedRef<number | undefined>;
60
60
  filterStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
61
61
  filterError: import("vue").Ref<any>;
62
62
  productCountData: import("vue").Ref<{
63
63
  count: number;
64
- }>;
64
+ } | null>;
65
65
  refreshProductCount: ({ where, }?: FilterParams) => Promise<void>;
66
66
  productCountFetching: import("vue").Ref<boolean>;
67
67
  productCountError: import("vue").Ref<any>;
68
68
  productCountStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
69
- products: import("vue").ComputedRef<import("@scayle/storefront-api").Product[]>;
69
+ products: import("vue").ComputedRef<import("@scayle/storefront-api").Product[] | undefined>;
70
70
  pagination: import("vue").ComputedRef<{
71
71
  current: number;
72
72
  total: number;
@@ -76,12 +76,12 @@ export declare function useFacet({ key: optionsKey, params, }?: Options, _key?:
76
76
  prev: number;
77
77
  next: number;
78
78
  last: number;
79
- }>;
79
+ } | undefined>;
80
80
  productsFetching: import("vue").Ref<boolean>;
81
81
  filterProducts: ({ where, page, sort, orFiltersOperator, }: FilterParams) => Promise<void>;
82
82
  productError: import("vue").Ref<any>;
83
83
  productStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
84
- categories: import("vue").ComputedRef<import("@scayle/storefront-api").Category | import("@scayle/storefront-api").Category[]>;
84
+ categories: import("vue").ComputedRef<import("@scayle/storefront-api").Category | import("@scayle/storefront-api").Category[] | undefined>;
85
85
  selectedCategory: import("vue").ComputedRef<import("@scayle/storefront-api").Category | undefined>;
86
86
  categoriesFetching: import("vue").Ref<boolean>;
87
87
  categoriesError: import("vue").Ref<any>;
@@ -1,11 +1,9 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
- import type { UseRpcOptions, UseRpcReturn } from '../core/useRpc';
2
+ import type { UseRpcOptions, UseRpcReturn, NormalizedRpcResponse, KeysOf } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
- type Options = Partial<{
4
+ export declare function useFilters<DataT = NormalizedRpcResponse<'getFilters'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getFilters'>>;
6
- options: UseRpcOptions<'getFilters'>;
6
+ options: UseRpcOptions<'getFilters', DataT, PickKeys, DefaultT>;
7
7
  /** @deprecated use the second argument of the composable to define the key */
8
8
  key: string;
9
- }>;
10
- export declare function useFilters({ params, options, key: _key, }?: Options, key?: string): UseRpcReturn<'getFilters'>;
11
- export {};
9
+ }>, key?: string): UseRpcReturn<'getFilters', DataT, PickKeys, DefaultT>;
@@ -1,11 +1,9 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
- import type { UseRpcOptions, UseRpcReturn } from '../core/useRpc';
2
+ import type { UseRpcOptions, UseRpcReturn, NormalizedRpcResponse, KeysOf } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
- type Options = Partial<{
4
+ export declare function useNavigationTree<DataT = NormalizedRpcResponse<'fetchNavigationTreeById'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'fetchNavigationTreeById'>>;
6
- options: UseRpcOptions<'fetchNavigationTreeById'>;
6
+ options: UseRpcOptions<'fetchNavigationTreeById', DataT, PickKeys, DefaultT>;
7
7
  /** @deprecated use the second argument of the composable to define the key */
8
8
  key: string;
9
- }>;
10
- export declare function useNavigationTree({ params, options, key: _key, }?: Options, key?: string): UseRpcReturn<'fetchNavigationTreeById'>;
11
- export {};
9
+ }>, key?: string): UseRpcReturn<'fetchNavigationTreeById', DataT, PickKeys, DefaultT>;
@@ -1,11 +1,9 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
- import type { UseRpcReturn, UseRpcOptions } from '../core/useRpc';
2
+ import type { UseRpcReturn, UseRpcOptions, NormalizedRpcResponse, KeysOf } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
- type Options = Partial<{
4
+ export declare function useNavigationTrees<DataT = NormalizedRpcResponse<'fetchAllNavigationTrees'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'fetchAllNavigationTrees'>>;
6
- options: UseRpcOptions<'fetchAllNavigationTrees'>;
6
+ options: UseRpcOptions<'fetchAllNavigationTrees', DataT, PickKeys, DefaultT>;
7
7
  /** @deprecated use the second argument of the composable to define the key */
8
8
  key: string;
9
- }>;
10
- export declare function useNavigationTrees({ params, options, key: _key, }?: Options, key?: string): UseRpcReturn<'fetchAllNavigationTrees'>;
11
- export {};
9
+ }>, key?: string): UseRpcReturn<'fetchAllNavigationTrees', DataT, PickKeys, DefaultT>;
@@ -1,11 +1,9 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
- import { type UseRpcOptions, type UseRpcReturn } from '../core/useRpc';
2
+ import type { KeysOf, UseRpcOptions, UseRpcReturn, NormalizedRpcResponse } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
- type Options = Partial<{
4
+ export declare function useProduct<DataT = NormalizedRpcResponse<'getProductById'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getProductById'>>;
6
- options: UseRpcOptions<'getProductById'>;
6
+ options: UseRpcOptions<'getProductById', DataT, PickKeys, DefaultT>;
7
7
  /** @deprecated use the second argument of the composable to define the key */
8
8
  key: string;
9
- }>;
10
- export declare function useProduct({ params, options, key: _key, }?: Options, key?: string): UseRpcReturn<'getProductById'>;
11
- export {};
9
+ }>, key?: string): UseRpcReturn<'getProductById', DataT, PickKeys, DefaultT>;
@@ -1,11 +1,9 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
- import { type UseRpcOptions, type UseRpcReturn } from '../core/useRpc';
2
+ import type { KeysOf, UseRpcOptions, UseRpcReturn, NormalizedRpcResponse } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
- type Options = Partial<{
4
+ export declare function useProducts<DataT = NormalizedRpcResponse<'getProductsByCategory'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getProductsByCategory'>>;
6
- options: UseRpcOptions<'getProductsByCategory'>;
6
+ options: UseRpcOptions<'getProductsByCategory', DataT, PickKeys, DefaultT>;
7
7
  /** @deprecated use the second argument of the composable to define the key */
8
8
  key: string;
9
- }>;
10
- export declare function useProducts({ params, options, key: _key, }?: Options, key?: string): UseRpcReturn<'getProductsByCategory'>;
11
- export {};
9
+ }>, key?: string): UseRpcReturn<'getProductsByCategory', DataT, PickKeys, DefaultT>;
@@ -1,11 +1,9 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
- import { type UseRpcOptions, type UseRpcReturn } from '../core/useRpc';
2
+ import type { KeysOf, UseRpcOptions, UseRpcReturn, NormalizedRpcResponse } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
- type Options = Partial<{
4
+ export declare function useProductsByIds<DataT = NormalizedRpcResponse<'getProductsByIds'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getProductsByIds'>>;
6
- options: UseRpcOptions<'getProductsByIds'>;
6
+ options: UseRpcOptions<'getProductsByIds', DataT, PickKeys, DefaultT>;
7
7
  /** @deprecated use the second argument of the composable to define the key */
8
8
  key: string;
9
- }>;
10
- export declare function useProductsByIds({ params, options, key: _key, }?: Options, key?: string): UseRpcReturn<'getProductsByIds'>;
11
- export {};
9
+ }>, key?: string): UseRpcReturn<'getProductsByIds', DataT, PickKeys, DefaultT>;
@@ -1,11 +1,9 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
- import { type UseRpcOptions, type UseRpcReturn } from '../core/useRpc';
2
+ import type { KeysOf, UseRpcOptions, UseRpcReturn, NormalizedRpcResponse } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
- type Options = Partial<{
4
+ export declare function useProductsByReferenceKeys<DataT = NormalizedRpcResponse<'getProductsByReferenceKeys'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getProductsByReferenceKeys'>>;
6
- options: UseRpcOptions<'getProductsByReferenceKeys'>;
6
+ options: UseRpcOptions<'getProductsByReferenceKeys', DataT, PickKeys, DefaultT>;
7
7
  /** @deprecated use the second argument of the composable to define the key */
8
8
  key: string;
9
- }>;
10
- export declare function useProductsByReferenceKeys({ params, options, key: _key, }?: Options, key?: string): UseRpcReturn<'getProductsByReferenceKeys'>;
11
- export {};
9
+ }>, key?: string): UseRpcReturn<'getProductsByReferenceKeys', DataT, PickKeys, DefaultT>;
@@ -1,11 +1,9 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
- import type { UseRpcOptions, UseRpcReturn } from '../core/useRpc';
2
+ import type { UseRpcOptions, UseRpcReturn, NormalizedRpcResponse, KeysOf } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
- type Options = Partial<{
4
+ export declare function useProductsCount<DataT = NormalizedRpcResponse<'getProductsCount'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getProductsCount'>>;
6
- options: UseRpcOptions<'getProductsCount'>;
6
+ options: UseRpcOptions<'getProductsCount', DataT, PickKeys, DefaultT>;
7
7
  /** @deprecated use the second argument of the composable to define the key */
8
8
  key: string;
9
- }>;
10
- export declare function useProductsCount({ params, options, key: _key, }?: Options, key?: string): UseRpcReturn<'getProductsCount'>;
11
- export {};
9
+ }>, key?: string): UseRpcReturn<'getProductsCount', DataT, PickKeys, DefaultT>;
@@ -1,11 +1,9 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
- import { type UseRpcOptions, type UseRpcReturn } from '../core/useRpc';
2
+ import type { KeysOf, UseRpcOptions, UseRpcReturn, NormalizedRpcResponse } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
- type Options = Partial<{
4
+ export declare function usePromotions<DataT = NormalizedRpcResponse<'getPromotions'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getPromotions'>>;
6
- options: UseRpcOptions<'getPromotions'>;
6
+ options: UseRpcOptions<'getPromotions', DataT, PickKeys, DefaultT>;
7
7
  /** @deprecated use the second argument of the composable to define the key */
8
8
  key: string;
9
- }>;
10
- export declare function usePromotions({ params, options, key: _key, }?: Options, key?: string): UseRpcReturn<'getPromotions'>;
11
- export {};
9
+ }>, key?: string): UseRpcReturn<'getPromotions', DataT, PickKeys, DefaultT>;
@@ -1,11 +1,9 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
- import { type UseRpcOptions, type UseRpcReturn } from '../core/useRpc';
2
+ import type { KeysOf, UseRpcOptions, UseRpcReturn, NormalizedRpcResponse } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
- type Options = Partial<{
4
+ export declare function usePromotionsByIds<DataT = NormalizedRpcResponse<'getPromotionsByIds'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getPromotionsByIds'>>;
6
- options: UseRpcOptions<'getPromotionsByIds'>;
6
+ options: UseRpcOptions<'getPromotionsByIds', DataT, PickKeys, DefaultT>;
7
7
  /** @deprecated use the second argument of the composable to define the key */
8
8
  key: string;
9
- }>;
10
- export declare function usePromotionsByIds({ params, options, key: _key, }?: Options, key?: string): UseRpcReturn<'getPromotionsByIds'>;
11
- export {};
9
+ }>, key?: string): UseRpcReturn<'getPromotionsByIds', DataT, PickKeys, DefaultT>;
@@ -1,8 +1,6 @@
1
- import type { UseRpcOptions, UseRpcReturn } from '../core/useRpc';
2
- type Options = Partial<{
3
- options: UseRpcOptions<'getShopConfiguration'>;
1
+ import type { UseRpcOptions, UseRpcReturn, NormalizedRpcResponse, KeysOf } from '../core/useRpc';
2
+ export declare function useShopConfiguration<DataT = NormalizedRpcResponse<'getShopConfiguration'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ options, key: _key, }?: Partial<{
3
+ options: UseRpcOptions<'getShopConfiguration', DataT, PickKeys, DefaultT>;
4
4
  /** @deprecated use the second argument of the composable to define the key */
5
5
  key: string;
6
- }>;
7
- export declare function useShopConfiguration({ options, key: _key, }?: Options, key?: string): UseRpcReturn<'getShopConfiguration'>;
8
- export {};
6
+ }>, key?: string): UseRpcReturn<'getShopConfiguration', DataT, PickKeys, DefaultT>;
@@ -1,8 +1,6 @@
1
- import type { UseRpcOptions, UseRpcReturn } from '../core/useRpc';
2
- type Options = Partial<{
3
- options: UseRpcOptions<'getShopUserAddresses'>;
1
+ import type { UseRpcOptions, UseRpcReturn, NormalizedRpcResponse, KeysOf } from '../core/useRpc';
2
+ export declare function useUserAddresses<DataT = NormalizedRpcResponse<'getShopUserAddresses'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ options, key: _key, }?: Partial<{
3
+ options: UseRpcOptions<'getShopUserAddresses', DataT, PickKeys, DefaultT>;
4
4
  /** @deprecated use the second argument of the composable to define the key */
5
5
  key: string;
6
- }>;
7
- export declare function useUserAddresses({ options, key: _key, }?: Options, key?: string): UseRpcReturn<'getShopUserAddresses'>;
8
- export {};
6
+ }>, key?: string): UseRpcReturn<'getShopUserAddresses', DataT, PickKeys, DefaultT>;
@@ -1,11 +1,9 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
- import { type UseRpcOptions, type UseRpcReturn } from '../core/useRpc';
2
+ import type { KeysOf, UseRpcOptions, UseRpcReturn, NormalizedRpcResponse } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
- type Options = Partial<{
4
+ export declare function useVariant<DataT = NormalizedRpcResponse<'getVariantById'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getVariantById'>>;
6
- options: UseRpcOptions<'getVariantById'>;
6
+ options: UseRpcOptions<'getVariantById', DataT, PickKeys, DefaultT>;
7
7
  /** @deprecated use the second argument of the composable to define the key */
8
8
  key: string;
9
- }>;
10
- export declare function useVariant({ params, options, key: _key, }?: Options, key?: string): UseRpcReturn<'getVariantById'>;
11
- export {};
9
+ }>, key?: string): UseRpcReturn<'getVariantById', DataT, PickKeys, DefaultT>;
@@ -36,8 +36,8 @@ type UseWishlistBaseReturn = Awaited<UseRpcReturn<'getWishlist'>> & {
36
36
  variantId?: number;
37
37
  productId?: number;
38
38
  }) => Promise<void>;
39
- count: ComputedRef<number>;
40
- items: ComputedRef<WishlistItem[]>;
39
+ count: ComputedRef<number | undefined>;
40
+ items: ComputedRef<WishlistItem[] | undefined>;
41
41
  products: ComputedRef<Product[]>;
42
42
  };
43
43
  export declare function useWishlist({ params, key, }?: Options): UseWishlistBaseReturn & Promise<UseWishlistBaseReturn>;
@@ -23,7 +23,7 @@ export function useWishlist({
23
23
  params,
24
24
  {
25
25
  server: false,
26
- // TODO: In some cases it might be ok to fetch on server
26
+ // NOTE: In some cases it might be ok to fetch on server
27
27
  watch: [toRef(params)],
28
28
  dedupe: "defer",
29
29
  getCachedData: (key2) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "7.84.6",
4
+ "version": "7.85.1",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -60,9 +60,9 @@
60
60
  "@nuxt/kit": "^3.12.2",
61
61
  "@opentelemetry/api": "^1.9.0",
62
62
  "@scayle/h3-session": "^0.4.0",
63
- "@scayle/storefront-core": "7.64.2",
63
+ "@scayle/storefront-core": "7.64.3",
64
64
  "@scayle/unstorage-compression-driver": "^0.1.3",
65
- "@vueuse/core": "^10.11.0",
65
+ "@vueuse/core": "11.0.3",
66
66
  "consola": "^3.2.3",
67
67
  "core-js": "^3.37.1",
68
68
  "defu": "^6.1.4",
@@ -80,24 +80,24 @@
80
80
  "zod": "^3.23.8"
81
81
  },
82
82
  "devDependencies": {
83
- "@nuxt/eslint": "0.5.0",
83
+ "@nuxt/eslint": "0.5.4",
84
84
  "@nuxt/module-builder": "0.5.5",
85
85
  "@nuxt/schema": "3.12.4",
86
86
  "@nuxt/test-utils": "3.14.1",
87
87
  "@scayle/eslint-config-storefront": "4.3.0",
88
88
  "@scayle/eslint-plugin-vue-composable": "0.2.0",
89
- "@types/node": "20.14.15",
89
+ "@types/node": "20.16.2",
90
90
  "dprint": "0.47.2",
91
- "eslint": "9.9.0",
91
+ "eslint": "9.9.1",
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.1",
96
- "nuxi": "3.12.0",
96
+ "nuxi": "3.13.1",
97
97
  "nuxt": "3.12.4",
98
98
  "publint": "0.2.10",
99
99
  "vitest": "2.0.5",
100
- "vue-tsc": "2.0.29"
100
+ "vue-tsc": "2.1.2"
101
101
  },
102
102
  "peerDependencies": {
103
103
  "h3": "^1.10.0",
@@ -112,6 +112,6 @@
112
112
  "@nuxt/schema": "3.12.4"
113
113
  },
114
114
  "volta": {
115
- "node": "20.16.0"
115
+ "node": "20.17.0"
116
116
  }
117
117
  }