@scayle/storefront-nuxt 7.95.3 → 8.0.0

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 (95) hide show
  1. package/CHANGELOG.md +484 -0
  2. package/dist/index.d.mts +1 -1
  3. package/dist/index.d.ts +1 -1
  4. package/dist/module.d.mts +2 -2
  5. package/dist/module.d.ts +2 -2
  6. package/dist/module.json +1 -1
  7. package/dist/module.mjs +6 -6
  8. package/dist/runtime/api/rpcHandler.d.ts +4 -6
  9. package/dist/runtime/campaignKey.d.ts +1 -2
  10. package/dist/runtime/campaignKey.js +3 -9
  11. package/dist/runtime/composables/core/useIDP.d.ts +2 -4
  12. package/dist/runtime/composables/core/useIDP.js +1 -8
  13. package/dist/runtime/composables/core/useRpc.d.ts +4 -17
  14. package/dist/runtime/composables/core/useRpc.js +11 -20
  15. package/dist/runtime/composables/core/useSession.d.ts +1 -1
  16. package/dist/runtime/composables/core/useUser.d.ts +2 -4
  17. package/dist/runtime/composables/core/useUser.js +3 -12
  18. package/dist/runtime/composables/index.d.ts +0 -3
  19. package/dist/runtime/composables/index.js +0 -3
  20. package/dist/runtime/composables/storefront/useBasket.d.ts +6 -4
  21. package/dist/runtime/composables/storefront/useBasket.js +68 -38
  22. package/dist/runtime/composables/storefront/useBrand.d.ts +2 -4
  23. package/dist/runtime/composables/storefront/useBrand.js +3 -4
  24. package/dist/runtime/composables/storefront/useBrands.d.ts +2 -4
  25. package/dist/runtime/composables/storefront/useBrands.js +3 -4
  26. package/dist/runtime/composables/storefront/useCategories.d.ts +3 -5
  27. package/dist/runtime/composables/storefront/useCategories.js +3 -8
  28. package/dist/runtime/composables/storefront/useCategoryById.d.ts +2 -4
  29. package/dist/runtime/composables/storefront/useCategoryById.js +3 -4
  30. package/dist/runtime/composables/storefront/useCategoryByPath.d.ts +2 -4
  31. package/dist/runtime/composables/storefront/useCategoryByPath.js +3 -4
  32. package/dist/runtime/composables/storefront/useCurrentPromotions.d.ts +2 -4
  33. package/dist/runtime/composables/storefront/useCurrentPromotions.js +3 -4
  34. package/dist/runtime/composables/storefront/useFilters.d.ts +2 -4
  35. package/dist/runtime/composables/storefront/useFilters.js +3 -4
  36. package/dist/runtime/composables/storefront/useNavigationTree.d.ts +3 -11
  37. package/dist/runtime/composables/storefront/useNavigationTree.js +6 -9
  38. package/dist/runtime/composables/storefront/useNavigationTrees.d.ts +2 -4
  39. package/dist/runtime/composables/storefront/useNavigationTrees.js +3 -4
  40. package/dist/runtime/composables/storefront/useOrder.d.ts +3 -5
  41. package/dist/runtime/composables/storefront/useOrder.js +3 -5
  42. package/dist/runtime/composables/storefront/useOrderConfirmation.d.ts +3 -5
  43. package/dist/runtime/composables/storefront/useOrderConfirmation.js +2 -2
  44. package/dist/runtime/composables/storefront/useProduct.d.ts +2 -4
  45. package/dist/runtime/composables/storefront/useProduct.js +3 -4
  46. package/dist/runtime/composables/storefront/useProducts.d.ts +2 -4
  47. package/dist/runtime/composables/storefront/useProducts.js +3 -4
  48. package/dist/runtime/composables/storefront/useProductsByIds.d.ts +2 -4
  49. package/dist/runtime/composables/storefront/useProductsByIds.js +3 -4
  50. package/dist/runtime/composables/storefront/useProductsByReferenceKeys.d.ts +2 -4
  51. package/dist/runtime/composables/storefront/useProductsByReferenceKeys.js +3 -4
  52. package/dist/runtime/composables/storefront/useProductsCount.d.ts +2 -4
  53. package/dist/runtime/composables/storefront/useProductsCount.js +3 -4
  54. package/dist/runtime/composables/storefront/usePromotions.d.ts +2 -4
  55. package/dist/runtime/composables/storefront/usePromotions.js +3 -4
  56. package/dist/runtime/composables/storefront/usePromotionsByIds.d.ts +2 -4
  57. package/dist/runtime/composables/storefront/usePromotionsByIds.js +3 -4
  58. package/dist/runtime/composables/storefront/useShopConfiguration.d.ts +1 -3
  59. package/dist/runtime/composables/storefront/useShopConfiguration.js +3 -4
  60. package/dist/runtime/composables/storefront/useStorefrontSearch.d.ts +5 -3
  61. package/dist/runtime/composables/storefront/useStorefrontSearch.js +3 -5
  62. package/dist/runtime/composables/storefront/useUserAddresses.d.ts +1 -3
  63. package/dist/runtime/composables/storefront/useUserAddresses.js +3 -4
  64. package/dist/runtime/composables/storefront/useVariant.d.ts +2 -4
  65. package/dist/runtime/composables/storefront/useVariant.js +3 -4
  66. package/dist/runtime/composables/storefront/useWishlist.d.ts +2 -3
  67. package/dist/runtime/composables/storefront/useWishlist.js +12 -21
  68. package/dist/runtime/context.js +1 -5
  69. package/dist/runtime/createLog.d.ts +1 -1
  70. package/dist/runtime/error/handler.d.ts +1 -1
  71. package/dist/runtime/error/handler.js +1 -28
  72. package/dist/runtime/nitro/plugins/nitroRuntimeStorageConfig.js +5 -93
  73. package/dist/runtime/plugin/shop.d.ts +4 -4
  74. package/dist/runtime/rpc/rpcCall.d.ts +1 -1
  75. package/dist/runtime/server/middleware/bootstrap-utils.d.ts +1 -5
  76. package/dist/runtime/server/middleware/bootstrap-utils.js +2 -4
  77. package/dist/runtime/server/middleware/bootstrap.js +3 -5
  78. package/dist/runtime/server/utils/cacheStorage.d.ts +1 -1
  79. package/dist/runtime/server/utils/cacheStorage.js +2 -2
  80. package/dist/runtime/utils/zodSchema.d.ts +467 -1840
  81. package/dist/runtime/utils/zodSchema.js +34 -83
  82. package/dist/shared/{storefront-nuxt.80aa5060.d.ts → storefront-nuxt.a816664e.d.mts} +4 -25
  83. package/dist/shared/{storefront-nuxt.80aa5060.d.mts → storefront-nuxt.a816664e.d.ts} +4 -25
  84. package/dist/test/factories.d.mts +1 -1
  85. package/dist/test/factories.d.ts +1 -1
  86. package/dist/test/factories.mjs +0 -2
  87. package/dist/types.d.mts +1 -1
  88. package/dist/types.d.ts +1 -1
  89. package/package.json +9 -9
  90. package/dist/runtime/composables/storefront/useFacet.d.ts +0 -100
  91. package/dist/runtime/composables/storefront/useFacet.js +0 -210
  92. package/dist/runtime/composables/storefront/useQueryFilterState.d.ts +0 -13
  93. package/dist/runtime/composables/storefront/useQueryFilterState.js +0 -78
  94. package/dist/runtime/composables/storefront/useSearch.d.ts +0 -14
  95. package/dist/runtime/composables/storefront/useSearch.js +0 -44
@@ -1,12 +1,11 @@
1
1
  import { useRpc } from "../core/useRpc.js";
2
2
  export function useFilters({
3
3
  params,
4
- options,
5
- key: _key
6
- } = {}, key) {
4
+ options
5
+ } = {}, key = "useFilters") {
7
6
  return useRpc(
8
7
  "getFilters",
9
- _key ?? key ?? "useFilters",
8
+ key,
10
9
  params,
11
10
  options
12
11
  );
@@ -1,19 +1,11 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
2
  import type { UseRpcOptions, UseRpcReturn, NormalizedRpcResponse, KeysOf } from '../core/useRpc.js';
3
- import type { MaybeRefOrGetter } from '#imports';
4
- export declare function useNavigationTreeById<DataT = NormalizedRpcResponse<'fetchNavigationTreeById'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
3
+ import type { MaybeRefOrGetter } from 'vue';
4
+ export declare function useNavigationTreeById<DataT = NormalizedRpcResponse<'fetchNavigationTreeById'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'fetchNavigationTreeById'>>;
6
6
  options: UseRpcOptions<'fetchNavigationTreeById', DataT, PickKeys, DefaultT>;
7
- /** @deprecated use the second argument of the composable to define the key */
8
- key: string;
9
7
  }>, key?: string): UseRpcReturn<'fetchNavigationTreeById', DataT, PickKeys, DefaultT>;
10
- /**
11
- * @deprecated This composable was renamed to {@link useNavigationTreeById}.
12
- */
13
- export declare const useNavigationTree: typeof useNavigationTreeById;
14
- export declare function useNavigationTreeByName<DataT = NormalizedRpcResponse<'fetchNavigationTreeById'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
8
+ export declare function useNavigationTreeByName<DataT = NormalizedRpcResponse<'fetchNavigationTreeById'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, }?: Partial<{
15
9
  params: MaybeRefOrGetter<RpcMethodParameters<'fetchNavigationTreeByName'>>;
16
10
  options: UseRpcOptions<'fetchNavigationTreeById', DataT, PickKeys, DefaultT>;
17
- /** @deprecated use the second argument of the composable to define the key */
18
- key: string;
19
11
  }>, key?: string): UseRpcReturn<'fetchNavigationTreeByName', DataT, PickKeys, DefaultT>;
@@ -1,25 +1,22 @@
1
1
  import { useRpc } from "../core/useRpc.js";
2
2
  export function useNavigationTreeById({
3
3
  params,
4
- options,
5
- key: _key
6
- } = {}, key) {
4
+ options
5
+ } = {}, key = "useNavigationTreeById") {
7
6
  return useRpc(
8
7
  "fetchNavigationTreeById",
9
- _key ?? key ?? "useNavigationTreeById",
8
+ key,
10
9
  params,
11
10
  options
12
11
  );
13
12
  }
14
- export const useNavigationTree = useNavigationTreeById;
15
13
  export function useNavigationTreeByName({
16
14
  params,
17
- options,
18
- key: _key
19
- } = {}, key) {
15
+ options
16
+ } = {}, key = "useNavigationTreeByName") {
20
17
  return useRpc(
21
18
  "fetchNavigationTreeByName",
22
- _key ?? key ?? "useNavigationTreeByName",
19
+ key,
23
20
  params,
24
21
  options
25
22
  );
@@ -1,9 +1,7 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
2
  import type { UseRpcReturn, UseRpcOptions, NormalizedRpcResponse, KeysOf } from '../core/useRpc.js';
3
- import type { MaybeRefOrGetter } from '#imports';
4
- export declare function useNavigationTrees<DataT = NormalizedRpcResponse<'fetchAllNavigationTrees'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
3
+ import type { MaybeRefOrGetter } from 'vue';
4
+ export declare function useNavigationTrees<DataT = NormalizedRpcResponse<'fetchAllNavigationTrees'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'fetchAllNavigationTrees'>>;
6
6
  options: UseRpcOptions<'fetchAllNavigationTrees', DataT, PickKeys, DefaultT>;
7
- /** @deprecated use the second argument of the composable to define the key */
8
- key: string;
9
7
  }>, key?: string): UseRpcReturn<'fetchAllNavigationTrees', DataT, PickKeys, DefaultT>;
@@ -1,12 +1,11 @@
1
1
  import { useRpc } from "../core/useRpc.js";
2
2
  export function useNavigationTrees({
3
3
  params = {},
4
- options,
5
- key: _key
6
- } = {}, key) {
4
+ options
5
+ } = {}, key = "useNavigationTrees") {
7
6
  return useRpc(
8
7
  "fetchAllNavigationTrees",
9
- _key ?? key ?? "useNavigationTrees",
8
+ key,
10
9
  params,
11
10
  options
12
11
  );
@@ -1,6 +1,6 @@
1
1
  import type { RpcMethodParameters, Order } from '@scayle/storefront-core';
2
2
  import type { AsyncDataOptions } from 'nuxt/app';
3
- import { type RpcOptions, type KeysOf, type ExtendedAsyncData } from '../core/useRpc.js';
3
+ import { type KeysOf, type ExtendedAsyncData } from '../core/useRpc.js';
4
4
  import type { MaybeRefOrGetter } from 'vue';
5
5
  type ItemsType = Exclude<Order['items'], undefined>;
6
6
  type NewItemsType<P, V> = Exclude<ItemsType[number], 'product' | 'variant'> & {
@@ -13,13 +13,11 @@ export declare function useOrder<P = {
13
13
  [k: string]: unknown;
14
14
  }, DataT = Order & {
15
15
  items?: NewItemsType<P, V>[];
16
- }, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key }?: {
16
+ }, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options }?: {
17
17
  params?: MaybeRefOrGetter<RpcMethodParameters<'getOrderById'>>;
18
- options?: RpcOptions & AsyncDataOptions<Order & {
18
+ options?: AsyncDataOptions<Order & {
19
19
  items?: NewItemsType<P, V>[];
20
20
  }, DataT, PickKeys, DefaultT>;
21
- /** @deprecated use the second argument of the composable to define the key */
22
- key?: string;
23
21
  }, key?: string): ExtendedAsyncData<Order & {
24
22
  items?: NewItemsType<P, V>[];
25
23
  }, unknown, DataT, PickKeys, DefaultT>;
@@ -1,10 +1,8 @@
1
- import {
2
- useRpc
3
- } from "../core/useRpc.js";
4
- export function useOrder({ params, options, key: _key } = {}, key) {
1
+ import { useRpc } from "../core/useRpc.js";
2
+ export function useOrder({ params, options } = {}, key = "useOrder") {
5
3
  return useRpc(
6
4
  "getOrderById",
7
- _key ?? key ?? "useOrder",
5
+ key,
8
6
  params,
9
7
  options
10
8
  );
@@ -1,6 +1,6 @@
1
1
  import type { RpcMethodParameters, Order } from '@scayle/storefront-core';
2
2
  import type { AsyncDataOptions } from 'nuxt/app';
3
- import type { RpcOptions, ExtendedAsyncData, KeysOf } from '../core/useRpc.js';
3
+ import type { ExtendedAsyncData, KeysOf } from '../core/useRpc.js';
4
4
  import type { MaybeRefOrGetter } from 'vue';
5
5
  type ItemsType = Exclude<Order['items'], undefined>;
6
6
  type NewItemsType<P, V> = Exclude<ItemsType[number], 'product' | 'variant'> & {
@@ -13,13 +13,11 @@ export declare function useOrderConfirmation<P = {
13
13
  [k: string]: unknown;
14
14
  }, DataT = Order & {
15
15
  items?: NewItemsType<P, V>[];
16
- }, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key }?: {
16
+ }, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options }?: {
17
17
  params?: MaybeRefOrGetter<RpcMethodParameters<'getOrderDataByCbd'>>;
18
- options?: RpcOptions & AsyncDataOptions<Order & {
18
+ options?: AsyncDataOptions<Order & {
19
19
  items?: NewItemsType<P, V>[];
20
20
  }, DataT, PickKeys, DefaultT>;
21
- /** @deprecated use the second argument of the composable to define the key */
22
- key?: string;
23
21
  }, key?: string): ExtendedAsyncData<Order & {
24
22
  items?: NewItemsType<P, V>[];
25
23
  }, unknown, DataT, PickKeys, DefaultT>;
@@ -1,8 +1,8 @@
1
1
  import { useRpc } from "../core/useRpc.js";
2
- export function useOrderConfirmation({ params, options, key: _key } = {}, key) {
2
+ export function useOrderConfirmation({ params, options } = {}, key = "useOrderConfirmation") {
3
3
  return useRpc(
4
4
  "getOrderDataByCbd",
5
- _key ?? key ?? "useOrderConfirmation",
5
+ key,
6
6
  params,
7
7
  options
8
8
  );
@@ -1,9 +1,7 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
2
  import type { KeysOf, UseRpcOptions, UseRpcReturn, NormalizedRpcResponse } from '../core/useRpc.js';
3
- import type { MaybeRefOrGetter } from '#imports';
4
- export declare function useProduct<DataT = NormalizedRpcResponse<'getProductById'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
3
+ import type { MaybeRefOrGetter } from 'vue';
4
+ export declare function useProduct<DataT = NormalizedRpcResponse<'getProductById'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getProductById'>>;
6
6
  options: UseRpcOptions<'getProductById', DataT, PickKeys, DefaultT>;
7
- /** @deprecated use the second argument of the composable to define the key */
8
- key: string;
9
7
  }>, key?: string): UseRpcReturn<'getProductById', DataT, PickKeys, DefaultT>;
@@ -1,12 +1,11 @@
1
1
  import { useRpc } from "../core/useRpc.js";
2
2
  export function useProduct({
3
3
  params,
4
- options,
5
- key: _key
6
- } = {}, key) {
4
+ options
5
+ } = {}, key = "useProduct") {
7
6
  return useRpc(
8
7
  "getProductById",
9
- _key ?? key ?? "useProduct",
8
+ key,
10
9
  params,
11
10
  options
12
11
  );
@@ -1,9 +1,7 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
2
  import type { KeysOf, UseRpcOptions, UseRpcReturn, NormalizedRpcResponse } from '../core/useRpc.js';
3
- import type { MaybeRefOrGetter } from '#imports';
4
- export declare function useProducts<DataT = NormalizedRpcResponse<'getProductsByCategory'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
3
+ import type { MaybeRefOrGetter } from 'vue';
4
+ export declare function useProducts<DataT = NormalizedRpcResponse<'getProductsByCategory'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getProductsByCategory'>>;
6
6
  options: UseRpcOptions<'getProductsByCategory', DataT, PickKeys, DefaultT>;
7
- /** @deprecated use the second argument of the composable to define the key */
8
- key: string;
9
7
  }>, key?: string): UseRpcReturn<'getProductsByCategory', DataT, PickKeys, DefaultT>;
@@ -1,12 +1,11 @@
1
1
  import { useRpc } from "../core/useRpc.js";
2
2
  export function useProducts({
3
3
  params,
4
- options,
5
- key: _key
6
- } = {}, key) {
4
+ options
5
+ } = {}, key = "useProducts") {
7
6
  return useRpc(
8
7
  "getProductsByCategory",
9
- _key ?? key ?? "useProducts",
8
+ key,
10
9
  params,
11
10
  options
12
11
  );
@@ -1,9 +1,7 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
2
  import type { KeysOf, UseRpcOptions, UseRpcReturn, NormalizedRpcResponse } from '../core/useRpc.js';
3
- import type { MaybeRefOrGetter } from '#imports';
4
- export declare function useProductsByIds<DataT = NormalizedRpcResponse<'getProductsByIds'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
3
+ import type { MaybeRefOrGetter } from 'vue';
4
+ export declare function useProductsByIds<DataT = NormalizedRpcResponse<'getProductsByIds'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getProductsByIds'>>;
6
6
  options: UseRpcOptions<'getProductsByIds', DataT, PickKeys, DefaultT>;
7
- /** @deprecated use the second argument of the composable to define the key */
8
- key: string;
9
7
  }>, key?: string): UseRpcReturn<'getProductsByIds', DataT, PickKeys, DefaultT>;
@@ -1,12 +1,11 @@
1
1
  import { useRpc } from "../core/useRpc.js";
2
2
  export function useProductsByIds({
3
3
  params,
4
- options,
5
- key: _key
6
- } = {}, key) {
4
+ options
5
+ } = {}, key = "useProductsByIds") {
7
6
  return useRpc(
8
7
  "getProductsByIds",
9
- _key ?? key ?? "useProductsByIds",
8
+ key,
10
9
  params,
11
10
  options
12
11
  );
@@ -1,9 +1,7 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
2
  import type { KeysOf, UseRpcOptions, UseRpcReturn, NormalizedRpcResponse } from '../core/useRpc.js';
3
- import type { MaybeRefOrGetter } from '#imports';
4
- export declare function useProductsByReferenceKeys<DataT = NormalizedRpcResponse<'getProductsByReferenceKeys'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
3
+ import type { MaybeRefOrGetter } from 'vue';
4
+ export declare function useProductsByReferenceKeys<DataT = NormalizedRpcResponse<'getProductsByReferenceKeys'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getProductsByReferenceKeys'>>;
6
6
  options: UseRpcOptions<'getProductsByReferenceKeys', DataT, PickKeys, DefaultT>;
7
- /** @deprecated use the second argument of the composable to define the key */
8
- key: string;
9
7
  }>, key?: string): UseRpcReturn<'getProductsByReferenceKeys', DataT, PickKeys, DefaultT>;
@@ -1,12 +1,11 @@
1
1
  import { useRpc } from "../core/useRpc.js";
2
2
  export function useProductsByReferenceKeys({
3
3
  params,
4
- options,
5
- key: _key
6
- } = {}, key) {
4
+ options
5
+ } = {}, key = "useProductsByReferenceKeys") {
7
6
  return useRpc(
8
7
  "getProductsByReferenceKeys",
9
- _key ?? key ?? "useProductsByReferenceKeys",
8
+ key,
10
9
  params,
11
10
  options
12
11
  );
@@ -1,9 +1,7 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
2
  import type { UseRpcOptions, UseRpcReturn, NormalizedRpcResponse, KeysOf } from '../core/useRpc.js';
3
- import type { MaybeRefOrGetter } from '#imports';
4
- export declare function useProductsCount<DataT = NormalizedRpcResponse<'getProductsCount'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
3
+ import type { MaybeRefOrGetter } from 'vue';
4
+ export declare function useProductsCount<DataT = NormalizedRpcResponse<'getProductsCount'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getProductsCount'>>;
6
6
  options: UseRpcOptions<'getProductsCount', DataT, PickKeys, DefaultT>;
7
- /** @deprecated use the second argument of the composable to define the key */
8
- key: string;
9
7
  }>, key?: string): UseRpcReturn<'getProductsCount', DataT, PickKeys, DefaultT>;
@@ -1,12 +1,11 @@
1
1
  import { useRpc } from "../core/useRpc.js";
2
2
  export function useProductsCount({
3
3
  params,
4
- options,
5
- key: _key
6
- } = {}, key) {
4
+ options
5
+ } = {}, key = "useProductsCount") {
7
6
  return useRpc(
8
7
  "getProductsCount",
9
- _key ?? key ?? "useProductsCount",
8
+ key,
10
9
  params,
11
10
  options
12
11
  );
@@ -1,9 +1,7 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
2
  import type { KeysOf, UseRpcOptions, UseRpcReturn, NormalizedRpcResponse } from '../core/useRpc.js';
3
- import type { MaybeRefOrGetter } from '#imports';
4
- export declare function usePromotions<DataT = NormalizedRpcResponse<'getPromotions'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
3
+ import type { MaybeRefOrGetter } from 'vue';
4
+ export declare function usePromotions<DataT = NormalizedRpcResponse<'getPromotions'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getPromotions'>>;
6
6
  options: UseRpcOptions<'getPromotions', DataT, PickKeys, DefaultT>;
7
- /** @deprecated use the second argument of the composable to define the key */
8
- key: string;
9
7
  }>, key?: string): UseRpcReturn<'getPromotions', DataT, PickKeys, DefaultT>;
@@ -1,12 +1,11 @@
1
1
  import { useRpc } from "../core/useRpc.js";
2
2
  export function usePromotions({
3
3
  params,
4
- options,
5
- key: _key
6
- } = {}, key) {
4
+ options
5
+ } = {}, key = "usePromotions") {
7
6
  return useRpc(
8
7
  "getPromotions",
9
- _key ?? key ?? "usePromotions",
8
+ key,
10
9
  params,
11
10
  options
12
11
  );
@@ -1,9 +1,7 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
2
  import type { KeysOf, UseRpcOptions, UseRpcReturn, NormalizedRpcResponse } from '../core/useRpc.js';
3
- import type { MaybeRefOrGetter } from '#imports';
4
- export declare function usePromotionsByIds<DataT = NormalizedRpcResponse<'getPromotionsByIds'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
3
+ import type { MaybeRefOrGetter } from 'vue';
4
+ export declare function usePromotionsByIds<DataT = NormalizedRpcResponse<'getPromotionsByIds'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getPromotionsByIds'>>;
6
6
  options: UseRpcOptions<'getPromotionsByIds', DataT, PickKeys, DefaultT>;
7
- /** @deprecated use the second argument of the composable to define the key */
8
- key: string;
9
7
  }>, key?: string): UseRpcReturn<'getPromotionsByIds', DataT, PickKeys, DefaultT>;
@@ -1,12 +1,11 @@
1
1
  import { useRpc } from "../core/useRpc.js";
2
2
  export function usePromotionsByIds({
3
3
  params,
4
- options,
5
- key: _key
6
- } = {}, key) {
4
+ options
5
+ } = {}, key = "usePromotionsByIds") {
7
6
  return useRpc(
8
7
  "getPromotionsByIds",
9
- _key ?? key ?? "usePromotionsByIds",
8
+ key,
10
9
  params,
11
10
  options
12
11
  );
@@ -1,6 +1,4 @@
1
1
  import type { UseRpcOptions, UseRpcReturn, NormalizedRpcResponse, KeysOf } from '../core/useRpc.js';
2
- export declare function useShopConfiguration<DataT = NormalizedRpcResponse<'getShopConfiguration'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ options, key: _key, }?: Partial<{
2
+ export declare function useShopConfiguration<DataT = NormalizedRpcResponse<'getShopConfiguration'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ options, }?: Partial<{
3
3
  options: UseRpcOptions<'getShopConfiguration', DataT, PickKeys, DefaultT>;
4
- /** @deprecated use the second argument of the composable to define the key */
5
- key: string;
6
4
  }>, key?: string): UseRpcReturn<'getShopConfiguration', DataT, PickKeys, DefaultT>;
@@ -1,11 +1,10 @@
1
1
  import { useRpc } from "../core/useRpc.js";
2
2
  export function useShopConfiguration({
3
- options,
4
- key: _key
5
- } = {}, key) {
3
+ options
4
+ } = {}, key = "useShopConfiguration") {
6
5
  return useRpc(
7
6
  "getShopConfiguration",
8
- _key ?? key ?? "useShopConfiguration",
7
+ key,
9
8
  void 0,
10
9
  options
11
10
  );
@@ -1,5 +1,6 @@
1
1
  import type { SearchV2SuggestionsEndpointResponseData, SearchV2With } from '@scayle/storefront-core';
2
- import type { Ref } from '#imports';
2
+ import type { Status } from '../core/useRpc.js';
3
+ import type { Ref } from 'vue';
3
4
  export type SearchOptions = Partial<{
4
5
  params: Partial<{
5
6
  categoryId: number;
@@ -7,9 +8,10 @@ export type SearchOptions = Partial<{
7
8
  }>;
8
9
  key: string;
9
10
  }>;
10
- export declare function useStorefrontSearch(searchQuery: Ref<string>, { params, key }?: SearchOptions): {
11
+ export declare function useStorefrontSearch(searchQuery: Ref<string>, { params }?: SearchOptions, key?: string): {
11
12
  data: Ref<SearchV2SuggestionsEndpointResponseData | undefined, SearchV2SuggestionsEndpointResponseData | undefined>;
12
- pending: Ref<boolean, boolean>;
13
+ status: Ref<Status, Status>;
14
+ error: Ref<unknown, unknown>;
13
15
  resetSearch: () => void;
14
16
  getSearchSuggestions: () => Promise<void>;
15
17
  resolveSearch: () => Promise<import("@scayle/storefront-api").SearchEntity | null | undefined>;
@@ -1,20 +1,18 @@
1
1
  import { useState } from "nuxt/app";
2
2
  import { useRpcCall } from "../core/useRpcCall.js";
3
- export function useStorefrontSearch(searchQuery, { params, key = "search" } = {}) {
3
+ export function useStorefrontSearch(searchQuery, { params } = {}, key = "search") {
4
4
  const data = useState(
5
5
  `${key}-data`,
6
6
  () => void 0
7
7
  );
8
8
  const getSearchSuggestionsRpc = useRpcCall("getSearchSuggestions");
9
9
  const resolveSearchRpc = useRpcCall("resolveSearch");
10
- const pending = useState(`${key}-pending`, () => false);
11
10
  const error = useState(
12
11
  `${key}-error`,
13
12
  () => void 0
14
13
  );
15
14
  const status = useState(`${key}-error`, () => "idle");
16
15
  const getSearchSuggestions = async () => {
17
- pending.value = true;
18
16
  status.value = "pending";
19
17
  if (!searchQuery.value) {
20
18
  return;
@@ -27,7 +25,6 @@ export function useStorefrontSearch(searchQuery, { params, key = "search" } = {}
27
25
  } catch (e) {
28
26
  error.value = e;
29
27
  } finally {
30
- pending.value = false;
31
28
  status.value = error.value ? "error" : "success";
32
29
  }
33
30
  };
@@ -46,7 +43,8 @@ export function useStorefrontSearch(searchQuery, { params, key = "search" } = {}
46
43
  };
47
44
  return {
48
45
  data,
49
- pending,
46
+ status,
47
+ error,
50
48
  resetSearch,
51
49
  getSearchSuggestions,
52
50
  resolveSearch
@@ -1,6 +1,4 @@
1
1
  import type { UseRpcOptions, UseRpcReturn, NormalizedRpcResponse, KeysOf } from '../core/useRpc.js';
2
- export declare function useUserAddresses<DataT = NormalizedRpcResponse<'getShopUserAddresses'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ options, key: _key, }?: Partial<{
2
+ export declare function useUserAddresses<DataT = NormalizedRpcResponse<'getShopUserAddresses'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ options, }?: Partial<{
3
3
  options: UseRpcOptions<'getShopUserAddresses', DataT, PickKeys, DefaultT>;
4
- /** @deprecated use the second argument of the composable to define the key */
5
- key: string;
6
4
  }>, key?: string): UseRpcReturn<'getShopUserAddresses', DataT, PickKeys, DefaultT>;
@@ -1,11 +1,10 @@
1
1
  import { useRpc } from "../core/useRpc.js";
2
2
  export function useUserAddresses({
3
- options,
4
- key: _key
5
- } = {}, key) {
3
+ options
4
+ } = {}, key = "useUserAddresses") {
6
5
  return useRpc(
7
6
  "getShopUserAddresses",
8
- _key ?? key ?? "useUserAddresses",
7
+ key,
9
8
  void 0,
10
9
  options
11
10
  );
@@ -1,9 +1,7 @@
1
1
  import type { RpcMethodParameters } from '@scayle/storefront-core';
2
2
  import type { KeysOf, UseRpcOptions, UseRpcReturn, NormalizedRpcResponse } from '../core/useRpc.js';
3
- import type { MaybeRefOrGetter } from '#imports';
4
- export declare function useVariant<DataT = NormalizedRpcResponse<'getVariantById'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key, }?: Partial<{
3
+ import type { MaybeRefOrGetter } from 'vue';
4
+ export declare function useVariant<DataT = NormalizedRpcResponse<'getVariantById'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, }?: Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getVariantById'>>;
6
6
  options: UseRpcOptions<'getVariantById', DataT, PickKeys, DefaultT>;
7
- /** @deprecated use the second argument of the composable to define the key */
8
- key: string;
9
7
  }>, key?: string): UseRpcReturn<'getVariantById', DataT, PickKeys, DefaultT>;
@@ -1,12 +1,11 @@
1
1
  import { useRpc } from "../core/useRpc.js";
2
2
  export function useVariant({
3
3
  params,
4
- options,
5
- key: _key
6
- } = {}, key) {
4
+ options
5
+ } = {}, key = "useVariant") {
7
6
  return useRpc(
8
7
  "getVariantById",
9
- _key ?? key ?? "useVariant",
8
+ key,
10
9
  params,
11
10
  options
12
11
  );
@@ -1,9 +1,8 @@
1
1
  import type { Product, WishlistItem, RpcMethodParameters } from '@scayle/storefront-core';
2
2
  import { type UseRpcReturn } from '../core/useRpc.js';
3
- import type { MaybeRefOrGetter, ComputedRef } from '#imports';
3
+ import { type MaybeRefOrGetter, type ComputedRef } from 'vue';
4
4
  type Options = Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getWishlist'>>;
6
- key: string;
7
6
  }>;
8
7
  type UseWishlistBaseReturn = Awaited<UseRpcReturn<'getWishlist'>> & {
9
8
  addItem: (item: {
@@ -40,5 +39,5 @@ type UseWishlistBaseReturn = Awaited<UseRpcReturn<'getWishlist'>> & {
40
39
  items: ComputedRef<WishlistItem[] | undefined>;
41
40
  products: ComputedRef<Product[]>;
42
41
  };
43
- export declare function useWishlist({ params, key, }?: Options): UseWishlistBaseReturn & Promise<UseWishlistBaseReturn>;
42
+ export declare function useWishlist({ params, }?: Options, key?: string): UseWishlistBaseReturn & Promise<UseWishlistBaseReturn>;
44
43
  export {};
@@ -1,18 +1,15 @@
1
- import {
2
- BaseError,
3
- HttpStatusMessage,
4
- HttpStatusCode
5
- } from "@scayle/storefront-core";
6
1
  import { useNuxtApp } from "nuxt/app";
7
- import { computed } from "vue";
8
2
  import { useRpc } from "../core/useRpc.js";
9
3
  import { extendPromise } from "../../utils/promise.js";
10
- import { toValue, toRef } from "#imports";
4
+ import {
5
+ computed,
6
+ toValue,
7
+ toRef
8
+ } from "vue";
11
9
  import { useRpcCall } from "../core/useRpcCall.js";
12
10
  export function useWishlist({
13
- params,
14
- key = "useWishlist"
15
- } = {}) {
11
+ params
12
+ } = {}, key = "useWishlist") {
16
13
  const nuxtApp = useNuxtApp();
17
14
  const addItemToWishlistRpc = useRpcCall("addItemToWishlist");
18
15
  const removeItemFromWishlistRpc = useRpcCall("removeItemFromWishlist");
@@ -33,10 +30,9 @@ export function useWishlist({
33
30
  );
34
31
  const {
35
32
  data,
36
- pending: fetching,
37
33
  error,
38
- refresh: fetch,
39
- status
34
+ status,
35
+ refresh
40
36
  } = asyncData;
41
37
  const addItem = async (item) => {
42
38
  data.value = await addItemToWishlistRpc({
@@ -47,9 +43,7 @@ export function useWishlist({
47
43
  const removeItem = async (item) => {
48
44
  const element = findItem(item);
49
45
  if (!element) {
50
- throw new BaseError(
51
- HttpStatusMessage.NOT_FOUND,
52
- HttpStatusCode.NOT_FOUND,
46
+ throw new Error(
53
47
  "Could not find wishlist item."
54
48
  );
55
49
  }
@@ -61,9 +55,7 @@ export function useWishlist({
61
55
  const replaceItem = async (item, newItem) => {
62
56
  const element = findItem(item);
63
57
  if (!element) {
64
- throw new BaseError(
65
- HttpStatusMessage.NOT_FOUND,
66
- HttpStatusCode.NOT_FOUND,
58
+ throw new Error(
67
59
  `Could not find wishlist item by: ${JSON.stringify(item)}`
68
60
  );
69
61
  }
@@ -108,8 +100,7 @@ export function useWishlist({
108
100
  removeItem,
109
101
  replaceItem,
110
102
  clear,
111
- fetching,
112
- fetch,
103
+ refresh,
113
104
  toggleItem,
114
105
  findItem,
115
106
  contains,