@scayle/storefront-nuxt 7.74.0 → 7.75.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 (72) hide show
  1. package/CHANGELOG.md +50 -1
  2. package/dist/index.d.mts +12 -2
  3. package/dist/index.d.ts +12 -2
  4. package/dist/index.mjs +15 -0
  5. package/dist/module.d.mts +2 -2
  6. package/dist/module.d.ts +2 -2
  7. package/dist/module.json +1 -1
  8. package/dist/module.mjs +32 -1
  9. package/dist/rpc.d.mts +1 -1
  10. package/dist/rpc.d.ts +1 -1
  11. package/dist/runtime/composables/core/useIDP.d.ts +5 -5
  12. package/dist/runtime/composables/core/useIDP.mjs +2 -2
  13. package/dist/runtime/composables/core/useRpc.d.ts +38 -9
  14. package/dist/runtime/composables/core/useRpc.mjs +29 -49
  15. package/dist/runtime/composables/core/useUser.d.ts +21 -6
  16. package/dist/runtime/composables/core/useUser.mjs +26 -10
  17. package/dist/runtime/composables/storefront/useBasket.d.ts +69 -8
  18. package/dist/runtime/composables/storefront/useBasket.mjs +16 -18
  19. package/dist/runtime/composables/storefront/useBrand.d.ts +4 -9
  20. package/dist/runtime/composables/storefront/useBrand.mjs +5 -12
  21. package/dist/runtime/composables/storefront/useBrands.d.ts +4 -9
  22. package/dist/runtime/composables/storefront/useBrands.mjs +5 -12
  23. package/dist/runtime/composables/storefront/useCategories.d.ts +23 -13
  24. package/dist/runtime/composables/storefront/useCategories.mjs +8 -12
  25. package/dist/runtime/composables/storefront/useCategoryById.d.ts +4 -9
  26. package/dist/runtime/composables/storefront/useCategoryById.mjs +5 -12
  27. package/dist/runtime/composables/storefront/useCategoryByPath.d.ts +4 -9
  28. package/dist/runtime/composables/storefront/useCategoryByPath.mjs +5 -12
  29. package/dist/runtime/composables/storefront/useCurrentPromotions.d.ts +4 -9
  30. package/dist/runtime/composables/storefront/useCurrentPromotions.mjs +5 -12
  31. package/dist/runtime/composables/storefront/useFacet.d.ts +60 -15
  32. package/dist/runtime/composables/storefront/useFacet.mjs +117 -110
  33. package/dist/runtime/composables/storefront/useFilters.d.ts +4 -12
  34. package/dist/runtime/composables/storefront/useFilters.mjs +5 -12
  35. package/dist/runtime/composables/storefront/useNavigationTree.d.ts +4 -9
  36. package/dist/runtime/composables/storefront/useNavigationTree.mjs +5 -12
  37. package/dist/runtime/composables/storefront/useNavigationTrees.d.ts +4 -9
  38. package/dist/runtime/composables/storefront/useNavigationTrees.mjs +5 -12
  39. package/dist/runtime/composables/storefront/useOrder.d.ts +6 -5
  40. package/dist/runtime/composables/storefront/useOrder.mjs +2 -2
  41. package/dist/runtime/composables/storefront/useOrderConfirmation.d.ts +6 -5
  42. package/dist/runtime/composables/storefront/useOrderConfirmation.mjs +2 -2
  43. package/dist/runtime/composables/storefront/useProduct.d.ts +4 -9
  44. package/dist/runtime/composables/storefront/useProduct.mjs +5 -12
  45. package/dist/runtime/composables/storefront/useProducts.d.ts +4 -21
  46. package/dist/runtime/composables/storefront/useProducts.mjs +5 -12
  47. package/dist/runtime/composables/storefront/useProductsByIds.d.ts +4 -9
  48. package/dist/runtime/composables/storefront/useProductsByIds.mjs +5 -12
  49. package/dist/runtime/composables/storefront/useProductsByReferenceKeys.d.ts +4 -9
  50. package/dist/runtime/composables/storefront/useProductsByReferenceKeys.mjs +5 -12
  51. package/dist/runtime/composables/storefront/useProductsCount.d.ts +4 -11
  52. package/dist/runtime/composables/storefront/useProductsCount.mjs +5 -12
  53. package/dist/runtime/composables/storefront/usePromotions.d.ts +4 -9
  54. package/dist/runtime/composables/storefront/usePromotions.mjs +5 -12
  55. package/dist/runtime/composables/storefront/usePromotionsByIds.d.ts +4 -9
  56. package/dist/runtime/composables/storefront/usePromotionsByIds.mjs +5 -12
  57. package/dist/runtime/composables/storefront/useShopConfiguration.d.ts +4 -9
  58. package/dist/runtime/composables/storefront/useShopConfiguration.mjs +5 -12
  59. package/dist/runtime/composables/storefront/useUserAddresses.d.ts +4 -9
  60. package/dist/runtime/composables/storefront/useUserAddresses.mjs +5 -12
  61. package/dist/runtime/composables/storefront/useVariant.d.ts +4 -9
  62. package/dist/runtime/composables/storefront/useVariant.mjs +5 -12
  63. package/dist/runtime/composables/storefront/useWishlist.d.ts +42 -4
  64. package/dist/runtime/composables/storefront/useWishlist.mjs +17 -14
  65. package/dist/runtime/log.mjs +1 -1
  66. package/dist/runtime/utils/promise.d.ts +9 -0
  67. package/dist/runtime/utils/promise.mjs +12 -0
  68. package/dist/runtime/utils/zodSchema.d.ts +22 -22
  69. package/dist/runtime/utils/zodSchema.mjs +4 -4
  70. package/dist/shared/{storefront-nuxt.db7a2f93.d.mts → storefront-nuxt.257df9a6.d.mts} +8 -8
  71. package/dist/shared/{storefront-nuxt.db7a2f93.d.ts → storefront-nuxt.257df9a6.d.ts} +8 -8
  72. package/package.json +2 -2
@@ -4,10 +4,12 @@ import { useCategories } from "../storefront/useCategories.mjs";
4
4
  import { useFilters } from "../storefront/useFilters.mjs";
5
5
  import { useProducts } from "../storefront/useProducts.mjs";
6
6
  import { useProductsCount } from "../storefront/useProductsCount.mjs";
7
- export async function useFacet({
8
- key = "useFacet",
7
+ import { extendPromise } from "../../utils/promise.mjs";
8
+ export function useFacet({
9
+ key: optionsKey,
9
10
  params = { initialPath: "/" }
10
- } = {}) {
11
+ } = {}, _key) {
12
+ const key = optionsKey ?? _key ?? "useFacet";
11
13
  const currentPath = useState(
12
14
  `${key}-path`,
13
15
  () => params.initialPath ?? "/"
@@ -31,86 +33,83 @@ export async function useFacet({
31
33
  const productCountWhere = useState(
32
34
  `${key}-productCountWhereCondition`
33
35
  );
34
- const [
35
- {
36
- data: categoryData,
37
- fetch: refreshCategories,
38
- fetching: categoriesFetching,
39
- error: categoriesError,
40
- status: categoriesStatus
41
- },
42
- {
43
- data: productData,
44
- fetch: _refreshProducts,
45
- fetching: productsFetching,
46
- error: productError,
47
- status: productStatus
48
- },
49
- {
50
- data: productCountData,
51
- fetch: _refreshProductCount,
52
- fetching: productCountFetching,
53
- error: productCountError,
54
- status: productCountStatus
55
- },
56
- {
57
- data: filterData,
58
- fetch: refreshFilters,
59
- fetching: filtersFetching,
60
- error: filterError,
61
- status: filterStatus
62
- }
63
- ] = await Promise.all([
64
- useCategories({
65
- params: () => ({
66
- path: currentPath.value,
67
- includeHidden: params.with?.product?.categories?.includeHidden || void 0
68
- }),
69
- options: { autoFetch: false },
70
- key: `${key}-categories`
36
+ const categoriesPromise = useCategories({
37
+ params: () => ({
38
+ path: currentPath.value,
39
+ includeHidden: params.with?.product?.categories?.includeHidden || void 0
71
40
  }),
72
- useProducts({
73
- params: () => ({
74
- page: currentPage.value,
75
- perPage: currentPerPage.value,
76
- with: params.with?.product,
77
- category: currentPath.value,
78
- includeSoldOut: params.includeSoldOut,
79
- includeSellableForFree: params.includeSellableForFree,
80
- where: currentWhereCondition.value,
81
- sort: currentSorting.value,
82
- pricePromotionKey: currentPricePromotionKey.value,
83
- cache: currentCacheParams.value,
84
- orFiltersOperator: currentOrFiltersOperator.value
85
- }),
86
- options: { autoFetch: false },
87
- key: `${key}-products`
41
+ options: { immediate: false },
42
+ key: `${key}-categories`
43
+ });
44
+ const productsPromise = useProducts({
45
+ params: () => ({
46
+ page: currentPage.value,
47
+ perPage: currentPerPage.value,
48
+ with: params.with?.product,
49
+ category: currentPath.value,
50
+ includeSoldOut: params.includeSoldOut,
51
+ includeSellableForFree: params.includeSellableForFree,
52
+ where: currentWhereCondition.value,
53
+ sort: currentSorting.value,
54
+ pricePromotionKey: currentPricePromotionKey.value,
55
+ cache: currentCacheParams.value,
56
+ orFiltersOperator: currentOrFiltersOperator.value
88
57
  }),
89
- useProductsCount({
90
- params: () => ({
91
- category: currentPath.value,
92
- includedFilters: params.includedFilters,
93
- includeSoldOut: params.includeSoldOut,
94
- includeSellableForFree: params.includeSellableForFree,
95
- where: productCountWhere.value,
96
- orFiltersOperator: currentOrFiltersOperator.value
97
- }),
98
- options: { autoFetch: false },
99
- key: `${key}-productCount`
58
+ options: { immediate: false },
59
+ key: `${key}-products`
60
+ });
61
+ const productsCountPromise = useProductsCount({
62
+ params: () => ({
63
+ category: currentPath.value,
64
+ includedFilters: params.includedFilters,
65
+ includeSoldOut: params.includeSoldOut,
66
+ includeSellableForFree: params.includeSellableForFree,
67
+ where: productCountWhere.value,
68
+ orFiltersOperator: currentOrFiltersOperator.value
100
69
  }),
101
- useFilters({
102
- params: () => ({
103
- category: currentPath.value,
104
- includedFilters: params.includedFilters,
105
- includeSoldOut: params.includeSoldOut,
106
- includeSellableForFree: params.includeSellableForFree,
107
- where: currentWhereCondition.value,
108
- orFiltersOperator: currentOrFiltersOperator.value
109
- }),
110
- options: { autoFetch: false },
111
- key: `${key}-filters`
112
- })
113
- ]);
70
+ options: { immediate: false },
71
+ key: `${key}-productCount`
72
+ });
73
+ const filtersPromise = useFilters({
74
+ params: () => ({
75
+ category: currentPath.value,
76
+ includedFilters: params.includedFilters,
77
+ includeSoldOut: params.includeSoldOut,
78
+ includeSellableForFree: params.includeSellableForFree,
79
+ where: currentWhereCondition.value,
80
+ orFiltersOperator: currentOrFiltersOperator.value
81
+ }),
82
+ options: { immediate: false },
83
+ key: `${key}-filters`
84
+ });
85
+ const {
86
+ data: categoryData,
87
+ fetch: refreshCategories,
88
+ fetching: categoriesFetching,
89
+ error: categoriesError,
90
+ status: categoriesStatus
91
+ } = categoriesPromise;
92
+ const {
93
+ data: productData,
94
+ fetch: _refreshProducts,
95
+ fetching: productsFetching,
96
+ error: productError,
97
+ status: productStatus
98
+ } = productsPromise;
99
+ const {
100
+ data: productCountData,
101
+ fetch: _refreshProductCount,
102
+ fetching: productCountFetching,
103
+ error: productCountError,
104
+ status: productCountStatus
105
+ } = productsCountPromise;
106
+ const {
107
+ data: filterData,
108
+ fetch: refreshFilters,
109
+ fetching: filtersFetching,
110
+ error: filterError,
111
+ status: filterStatus
112
+ } = filtersPromise;
114
113
  const categories = computed(() => categoryData.value?.categories);
115
114
  const selectedCategory = computed(() => categoryData.value?.activeNode);
116
115
  const pagination = computed(() => productData.value?.pagination);
@@ -170,34 +169,42 @@ export async function useFacet({
170
169
  currentPage.value = pageToFetch;
171
170
  await _refreshProducts();
172
171
  };
173
- return {
174
- // filter data
175
- filters,
176
- filtersFetching,
177
- unfilteredCount,
178
- filterStatus,
179
- filterError,
180
- // filter preview
181
- productCountData,
182
- refreshProductCount,
183
- productCountFetching,
184
- productCountError,
185
- productCountStatus,
186
- // product data
187
- products,
188
- pagination,
189
- productsFetching,
190
- filterProducts,
191
- productError,
192
- productStatus,
193
- // category data
194
- categories,
195
- selectedCategory,
196
- categoriesFetching,
197
- categoriesError,
198
- categoriesStatus,
199
- // other
200
- fetchProducts,
201
- fetchPage
202
- };
172
+ return extendPromise(
173
+ Promise.all([
174
+ categoriesPromise,
175
+ productsPromise,
176
+ productsCountPromise,
177
+ filtersPromise
178
+ ]).then(() => ({})),
179
+ {
180
+ // filter data
181
+ filters,
182
+ filtersFetching,
183
+ unfilteredCount,
184
+ filterStatus,
185
+ filterError,
186
+ // filter preview
187
+ productCountData,
188
+ refreshProductCount,
189
+ productCountFetching,
190
+ productCountError,
191
+ productCountStatus,
192
+ // product data
193
+ products,
194
+ pagination,
195
+ productsFetching,
196
+ filterProducts,
197
+ productError,
198
+ productStatus,
199
+ // category data
200
+ categories,
201
+ selectedCategory,
202
+ categoriesFetching,
203
+ categoriesError,
204
+ categoriesStatus,
205
+ // other
206
+ fetchProducts,
207
+ fetchPage
208
+ }
209
+ );
203
210
  }
@@ -1,19 +1,11 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
- import type { RpcOptions } from '../core/useRpc';
2
+ import type { UseRpcOptions, UseRpcReturn } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
4
  type Options = Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getFilters'>>;
6
- options: RpcOptions;
6
+ options: UseRpcOptions<'getFilters'>;
7
+ /** @deprecated use the second argument of the composable to define the key */
7
8
  key: string;
8
9
  }>;
9
- export declare function useFilters({ params, options, key, }?: Options): Promise<{
10
- data: import("vue").Ref<{
11
- filters: import("@scayle/storefront-api").FiltersEndpointResponseData;
12
- unfilteredCount: number;
13
- } | undefined>;
14
- fetching: import("vue").Ref<boolean>;
15
- fetch: () => Promise<void>;
16
- error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
17
- status: import("vue").Ref<import("../core/useRpc").Status>;
18
- }>;
10
+ export declare function useFilters({ params, options, key: _key, }?: Options, key?: string): UseRpcReturn<'getFilters'>;
19
11
  export {};
@@ -1,20 +1,13 @@
1
1
  import { useRpc } from "../core/useRpc.mjs";
2
- export async function useFilters({
2
+ export function useFilters({
3
3
  params,
4
4
  options,
5
- key = "useFilters"
6
- } = {}) {
7
- const { data, fetching, fetch, error, status } = await useRpc(
5
+ key: _key
6
+ } = {}, key) {
7
+ return useRpc(
8
8
  "getFilters",
9
- key,
9
+ _key ?? key ?? "useFilters",
10
10
  params,
11
11
  options
12
12
  );
13
- return {
14
- data,
15
- fetching,
16
- fetch,
17
- error,
18
- status
19
- };
20
13
  }
@@ -1,16 +1,11 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
- import type { RpcOptions } from '../core/useRpc';
2
+ import type { UseRpcOptions, UseRpcReturn } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
4
  type Options = Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'fetchNavigationTreeById'>>;
6
- options: RpcOptions;
6
+ options: UseRpcOptions<'fetchNavigationTreeById'>;
7
+ /** @deprecated use the second argument of the composable to define the key */
7
8
  key: string;
8
9
  }>;
9
- export declare function useNavigationTree({ params, options, key, }?: Options): Promise<{
10
- data: import("vue").Ref<import("@scayle/storefront-api").NavigationTree | undefined>;
11
- fetching: import("vue").Ref<boolean>;
12
- fetch: () => Promise<void>;
13
- error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
14
- status: import("vue").Ref<import("../core/useRpc").Status>;
15
- }>;
10
+ export declare function useNavigationTree({ params, options, key: _key, }?: Options, key?: string): UseRpcReturn<'fetchNavigationTreeById'>;
16
11
  export {};
@@ -1,20 +1,13 @@
1
1
  import { useRpc } from "../core/useRpc.mjs";
2
- export async function useNavigationTree({
2
+ export function useNavigationTree({
3
3
  params,
4
4
  options,
5
- key = "useNavigationTree"
6
- } = {}) {
7
- const { data, fetching, fetch, error, status } = await useRpc(
5
+ key: _key
6
+ } = {}, key) {
7
+ return useRpc(
8
8
  "fetchNavigationTreeById",
9
- key,
9
+ _key ?? key ?? "useNavigationTree",
10
10
  params,
11
11
  options
12
12
  );
13
- return {
14
- data,
15
- fetching,
16
- fetch,
17
- error,
18
- status
19
- };
20
13
  }
@@ -1,16 +1,11 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
- import type { RpcOptions } from '../core/useRpc';
2
+ import type { UseRpcReturn, UseRpcOptions } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
4
  type Options = Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'fetchAllNavigationTrees'>>;
6
- options: RpcOptions;
6
+ options: UseRpcOptions<'fetchAllNavigationTrees'>;
7
+ /** @deprecated use the second argument of the composable to define the key */
7
8
  key: string;
8
9
  }>;
9
- export declare function useNavigationTrees({ params, options, key, }?: Options): Promise<{
10
- data: import("vue").Ref<import("@scayle/storefront-api").NavigationAllEndpointResponseData | undefined>;
11
- fetching: import("vue").Ref<boolean>;
12
- fetch: () => Promise<void>;
13
- error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
14
- status: import("vue").Ref<import("../core/useRpc").Status>;
15
- }>;
10
+ export declare function useNavigationTrees({ params, options, key: _key, }?: Options, key?: string): UseRpcReturn<'fetchAllNavigationTrees'>;
16
11
  export {};
@@ -1,20 +1,13 @@
1
1
  import { useRpc } from "../core/useRpc.mjs";
2
- export async function useNavigationTrees({
2
+ export function useNavigationTrees({
3
3
  params = {},
4
4
  options,
5
- key = "useNavigationTrees"
6
- } = {}) {
7
- const { data, fetching, fetch, error, status } = await useRpc(
5
+ key: _key
6
+ } = {}, key) {
7
+ return useRpc(
8
8
  "fetchAllNavigationTrees",
9
- key,
9
+ _key ?? key ?? "useNavigationTrees",
10
10
  params,
11
11
  options
12
12
  );
13
- return {
14
- data,
15
- fetching,
16
- fetch,
17
- error,
18
- status
19
- };
20
13
  }
@@ -4,13 +4,14 @@ import type { MaybeRefOrGetter } from '#imports';
4
4
  type Options = Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getOrderById'>>;
6
6
  options: RpcOptions;
7
+ /** @deprecated use the second argument of the composable to define the key */
7
8
  key: string;
8
9
  }>;
9
10
  export declare function useOrder<P = {
10
11
  [k: string]: unknown;
11
12
  }, V = {
12
13
  [k: string]: unknown;
13
- }>({ params, options, key }?: Options): Promise<{
14
+ }>({ params, options, key: _key }?: Options, key?: string): Promise<{
14
15
  data: Ref<Order & {
15
16
  items?: ({
16
17
  id?: number | undefined;
@@ -68,7 +69,7 @@ export declare function useOrder<P = {
68
69
  [k: string]: unknown;
69
70
  };
70
71
  reservationKey?: string | undefined;
71
- status: "available" | "cancelled" | "delivered" | "returned" | "unavailable";
72
+ status: "available" | "unavailable" | "cancelled" | "delivered" | "returned";
72
73
  variant: {
73
74
  [k: string]: unknown;
74
75
  };
@@ -82,8 +83,8 @@ export declare function useOrder<P = {
82
83
  })[] | undefined;
83
84
  }>;
84
85
  fetching: import("vue").Ref<boolean>;
85
- fetch: () => Promise<void>;
86
- error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
87
- status: import("vue").Ref<import("../core/useRpc").Status>;
86
+ fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions | undefined) => Promise<void>;
87
+ error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
88
+ status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
88
89
  }>;
89
90
  export {};
@@ -1,8 +1,8 @@
1
1
  import { useRpc } from "../core/useRpc.mjs";
2
- export async function useOrder({ params, options, key = "useOrder" } = {}) {
2
+ export async function useOrder({ params, options, key: _key } = {}, key) {
3
3
  const { data, fetching, fetch, error, status } = await useRpc(
4
4
  "getOrderById",
5
- key,
5
+ _key ?? key ?? "useOrder",
6
6
  params,
7
7
  options
8
8
  );
@@ -4,13 +4,14 @@ import type { MaybeRefOrGetter } from '#imports';
4
4
  type Options = Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getOrderDataByCbd'>>;
6
6
  options: RpcOptions;
7
+ /** @deprecated use the second argument of the composable to define the key */
7
8
  key: string;
8
9
  }>;
9
10
  export declare function useOrderConfirmation<P = {
10
11
  [k: string]: unknown;
11
12
  }, V = {
12
13
  [k: string]: unknown;
13
- }>({ params, options, key }?: Options): Promise<{
14
+ }>({ params, options, key: _key }?: Options, key?: string): Promise<{
14
15
  data: Ref<Order & {
15
16
  items?: ({
16
17
  id?: number | undefined;
@@ -68,7 +69,7 @@ export declare function useOrderConfirmation<P = {
68
69
  [k: string]: unknown;
69
70
  };
70
71
  reservationKey?: string | undefined;
71
- status: "available" | "cancelled" | "delivered" | "returned" | "unavailable";
72
+ status: "available" | "unavailable" | "cancelled" | "delivered" | "returned";
72
73
  variant: {
73
74
  [k: string]: unknown;
74
75
  };
@@ -82,8 +83,8 @@ export declare function useOrderConfirmation<P = {
82
83
  })[] | undefined;
83
84
  }>;
84
85
  fetching: import("vue").Ref<boolean>;
85
- fetch: () => Promise<void>;
86
- error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
87
- status: import("vue").Ref<import("../core/useRpc").Status>;
86
+ fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions | undefined) => Promise<void>;
87
+ error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
88
+ status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
88
89
  }>;
89
90
  export {};
@@ -1,8 +1,8 @@
1
1
  import { useRpc } from "../core/useRpc.mjs";
2
- export async function useOrderConfirmation({ params, options, key = "useOrderConfirmation" } = {}) {
2
+ export async function useOrderConfirmation({ params, options, key: _key } = {}, key) {
3
3
  const { data, fetching, fetch, error, status } = await useRpc(
4
4
  "getOrderDataByCbd",
5
- key,
5
+ _key ?? key ?? "useOrderConfirmation",
6
6
  params,
7
7
  options
8
8
  );
@@ -1,16 +1,11 @@
1
1
  import { type RpcMethodParameters } from '@scayle/storefront-core';
2
- import { type RpcOptions } from '../core/useRpc';
2
+ import { type UseRpcOptions, type UseRpcReturn } from '../core/useRpc';
3
3
  import { type MaybeRefOrGetter } from '#imports';
4
4
  type Options = Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getProductById'>>;
6
- options: RpcOptions;
6
+ options: UseRpcOptions<'getProductById'>;
7
+ /** @deprecated use the second argument of the composable to define the key */
7
8
  key: string;
8
9
  }>;
9
- export declare function useProduct({ params, options, key, }?: Options): Promise<{
10
- data: import("vue").Ref<import("@scayle/storefront-api").Product | undefined>;
11
- fetching: import("vue").Ref<boolean>;
12
- fetch: () => Promise<void>;
13
- error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
14
- status: import("vue").Ref<import("../core/useRpc").Status>;
15
- }>;
10
+ export declare function useProduct({ params, options, key: _key, }?: Options, key?: string): UseRpcReturn<'getProductById'>;
16
11
  export {};
@@ -1,20 +1,13 @@
1
1
  import { useRpc } from "../core/useRpc.mjs";
2
- export async function useProduct({
2
+ export function useProduct({
3
3
  params,
4
4
  options,
5
- key = "useProduct"
6
- } = {}) {
7
- const { data, fetching, fetch, error, status } = await useRpc(
5
+ key: _key
6
+ } = {}, key) {
7
+ return useRpc(
8
8
  "getProductById",
9
- key,
9
+ _key ?? key ?? "useProduct",
10
10
  params,
11
11
  options
12
12
  );
13
- return {
14
- data,
15
- fetching,
16
- fetch,
17
- error,
18
- status
19
- };
20
13
  }
@@ -1,28 +1,11 @@
1
1
  import { type RpcMethodParameters } from '@scayle/storefront-core';
2
- import { type RpcOptions } from '../core/useRpc';
2
+ import { type UseRpcOptions, type UseRpcReturn } from '../core/useRpc';
3
3
  import { type MaybeRefOrGetter } from '#imports';
4
4
  type Options = Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getProductsByCategory'>>;
6
- options: RpcOptions;
6
+ options: UseRpcOptions<'getProductsByCategory'>;
7
+ /** @deprecated use the second argument of the composable to define the key */
7
8
  key: string;
8
9
  }>;
9
- export declare function useProducts({ params, options, key, }?: Options): Promise<{
10
- data: import("vue").Ref<{
11
- products: import("@scayle/storefront-api").Product[];
12
- pagination: {
13
- current: number;
14
- total: number;
15
- perPage: number;
16
- page: number;
17
- first: number;
18
- prev: number;
19
- next: number;
20
- last: number;
21
- };
22
- } | undefined>;
23
- fetching: import("vue").Ref<boolean>;
24
- fetch: () => Promise<void>;
25
- error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
26
- status: import("vue").Ref<import("../core/useRpc").Status>;
27
- }>;
10
+ export declare function useProducts({ params, options, key: _key, }?: Options, key?: string): UseRpcReturn<'getProductsByCategory'>;
28
11
  export {};
@@ -1,20 +1,13 @@
1
1
  import { useRpc } from "../core/useRpc.mjs";
2
- export async function useProducts({
2
+ export function useProducts({
3
3
  params,
4
4
  options,
5
- key = "useProducts"
6
- } = {}) {
7
- const { data, fetching, fetch, error, status } = await useRpc(
5
+ key: _key
6
+ } = {}, key) {
7
+ return useRpc(
8
8
  "getProductsByCategory",
9
- key,
9
+ _key ?? key ?? "useProducts",
10
10
  params,
11
11
  options
12
12
  );
13
- return {
14
- data,
15
- fetching,
16
- fetch,
17
- error,
18
- status
19
- };
20
13
  }
@@ -1,16 +1,11 @@
1
1
  import { type RpcMethodParameters } from '@scayle/storefront-core';
2
- import { type RpcOptions } from '../core/useRpc';
2
+ import { type UseRpcOptions, type UseRpcReturn } from '../core/useRpc';
3
3
  import { type MaybeRefOrGetter } from '#imports';
4
4
  type Options = Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getProductsByIds'>>;
6
- options: RpcOptions;
6
+ options: UseRpcOptions<'getProductsByIds'>;
7
+ /** @deprecated use the second argument of the composable to define the key */
7
8
  key: string;
8
9
  }>;
9
- export declare function useProductsByIds({ params, options, key, }?: Options): Promise<{
10
- data: import("vue").Ref<import("@scayle/storefront-api").Product[] | undefined>;
11
- fetching: import("vue").Ref<boolean>;
12
- fetch: () => Promise<void>;
13
- error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
14
- status: import("vue").Ref<import("../core/useRpc").Status>;
15
- }>;
10
+ export declare function useProductsByIds({ params, options, key: _key, }?: Options, key?: string): UseRpcReturn<'getProductsByIds'>;
16
11
  export {};
@@ -1,20 +1,13 @@
1
1
  import { useRpc } from "../core/useRpc.mjs";
2
- export async function useProductsByIds({
2
+ export function useProductsByIds({
3
3
  params,
4
4
  options,
5
- key = "useProductsByIds"
6
- } = {}) {
7
- const { data, fetching, fetch, error, status } = await useRpc(
5
+ key: _key
6
+ } = {}, key) {
7
+ return useRpc(
8
8
  "getProductsByIds",
9
- key,
9
+ _key ?? key ?? "useProductsByIds",
10
10
  params,
11
11
  options
12
12
  );
13
- return {
14
- data,
15
- fetching,
16
- fetch,
17
- error,
18
- status
19
- };
20
13
  }