@scayle/storefront-nuxt 7.36.3

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 (135) hide show
  1. package/CHANGELOG.md +598 -0
  2. package/LICENSE +21 -0
  3. package/README.md +67 -0
  4. package/dist/index.d.mts +13 -0
  5. package/dist/index.d.ts +13 -0
  6. package/dist/index.mjs +2 -0
  7. package/dist/module.cjs +5 -0
  8. package/dist/module.d.mts +8 -0
  9. package/dist/module.d.ts +8 -0
  10. package/dist/module.json +8 -0
  11. package/dist/module.mjs +173 -0
  12. package/dist/rpc.d.mts +12 -0
  13. package/dist/rpc.d.ts +12 -0
  14. package/dist/rpc.mjs +18 -0
  15. package/dist/runtime/api/cacheAuth.d.ts +12 -0
  16. package/dist/runtime/api/cacheAuth.mjs +40 -0
  17. package/dist/runtime/api/purgeAll.d.ts +2 -0
  18. package/dist/runtime/api/purgeAll.mjs +14 -0
  19. package/dist/runtime/api/purgeTags.d.ts +2 -0
  20. package/dist/runtime/api/purgeTags.mjs +19 -0
  21. package/dist/runtime/api/rpcHandler.d.ts +2 -0
  22. package/dist/runtime/api/rpcHandler.mjs +15 -0
  23. package/dist/runtime/api/up.d.ts +4 -0
  24. package/dist/runtime/api/up.mjs +4 -0
  25. package/dist/runtime/composables/core/useAvailableShops.d.ts +2 -0
  26. package/dist/runtime/composables/core/useAvailableShops.mjs +4 -0
  27. package/dist/runtime/composables/core/useCurrentShop.d.ts +3 -0
  28. package/dist/runtime/composables/core/useCurrentShop.mjs +8 -0
  29. package/dist/runtime/composables/core/useEventListener.d.ts +2 -0
  30. package/dist/runtime/composables/core/useEventListener.mjs +2 -0
  31. package/dist/runtime/composables/core/useLog.d.ts +1 -0
  32. package/dist/runtime/composables/core/useLog.mjs +8 -0
  33. package/dist/runtime/composables/core/useRpc.d.ts +17 -0
  34. package/dist/runtime/composables/core/useRpc.mjs +56 -0
  35. package/dist/runtime/composables/core/useSession.d.ts +21 -0
  36. package/dist/runtime/composables/core/useSession.mjs +21 -0
  37. package/dist/runtime/composables/core/useUser.d.ts +16 -0
  38. package/dist/runtime/composables/core/useUser.mjs +68 -0
  39. package/dist/runtime/composables/storefront/useBasket.d.ts +54 -0
  40. package/dist/runtime/composables/storefront/useBasket.mjs +165 -0
  41. package/dist/runtime/composables/storefront/useBrand.d.ts +16 -0
  42. package/dist/runtime/composables/storefront/useBrand.mjs +20 -0
  43. package/dist/runtime/composables/storefront/useBrands.d.ts +16 -0
  44. package/dist/runtime/composables/storefront/useBrands.mjs +20 -0
  45. package/dist/runtime/composables/storefront/useCategories.d.ts +20 -0
  46. package/dist/runtime/composables/storefront/useCategories.mjs +30 -0
  47. package/dist/runtime/composables/storefront/useCurrentPromotions.d.ts +16 -0
  48. package/dist/runtime/composables/storefront/useCurrentPromotions.mjs +20 -0
  49. package/dist/runtime/composables/storefront/useFacet.d.ts +48 -0
  50. package/dist/runtime/composables/storefront/useFacet.mjs +193 -0
  51. package/dist/runtime/composables/storefront/useFilters.d.ts +16 -0
  52. package/dist/runtime/composables/storefront/useFilters.mjs +20 -0
  53. package/dist/runtime/composables/storefront/useNavigationTree.d.ts +16 -0
  54. package/dist/runtime/composables/storefront/useNavigationTree.mjs +20 -0
  55. package/dist/runtime/composables/storefront/useNavigationTrees.d.ts +16 -0
  56. package/dist/runtime/composables/storefront/useNavigationTrees.mjs +20 -0
  57. package/dist/runtime/composables/storefront/useOrder.d.ts +89 -0
  58. package/dist/runtime/composables/storefront/useOrder.mjs +17 -0
  59. package/dist/runtime/composables/storefront/useOrderConfirmation.d.ts +89 -0
  60. package/dist/runtime/composables/storefront/useOrderConfirmation.mjs +17 -0
  61. package/dist/runtime/composables/storefront/useProduct.d.ts +16 -0
  62. package/dist/runtime/composables/storefront/useProduct.mjs +20 -0
  63. package/dist/runtime/composables/storefront/useProducts.d.ts +20 -0
  64. package/dist/runtime/composables/storefront/useProducts.mjs +20 -0
  65. package/dist/runtime/composables/storefront/useProductsByIds.d.ts +16 -0
  66. package/dist/runtime/composables/storefront/useProductsByIds.mjs +20 -0
  67. package/dist/runtime/composables/storefront/useProductsCount.d.ts +16 -0
  68. package/dist/runtime/composables/storefront/useProductsCount.mjs +20 -0
  69. package/dist/runtime/composables/storefront/usePromotions.d.ts +16 -0
  70. package/dist/runtime/composables/storefront/usePromotions.mjs +20 -0
  71. package/dist/runtime/composables/storefront/usePromotionsByIds.d.ts +16 -0
  72. package/dist/runtime/composables/storefront/usePromotionsByIds.mjs +20 -0
  73. package/dist/runtime/composables/storefront/useQueryFilterState.d.ts +12 -0
  74. package/dist/runtime/composables/storefront/useQueryFilterState.mjs +66 -0
  75. package/dist/runtime/composables/storefront/useSearch.d.ts +13 -0
  76. package/dist/runtime/composables/storefront/useSearch.mjs +49 -0
  77. package/dist/runtime/composables/storefront/useShopConfiguration.d.ts +13 -0
  78. package/dist/runtime/composables/storefront/useShopConfiguration.mjs +19 -0
  79. package/dist/runtime/composables/storefront/useUserAddresses.d.ts +13 -0
  80. package/dist/runtime/composables/storefront/useUserAddresses.mjs +19 -0
  81. package/dist/runtime/composables/storefront/useVariant.d.ts +16 -0
  82. package/dist/runtime/composables/storefront/useVariant.mjs +20 -0
  83. package/dist/runtime/composables/storefront/useWishlist.d.ts +48 -0
  84. package/dist/runtime/composables/storefront/useWishlist.mjs +119 -0
  85. package/dist/runtime/composables/useCoreLog.d.ts +1 -0
  86. package/dist/runtime/composables/useCoreLog.mjs +4 -0
  87. package/dist/runtime/context.d.ts +12 -0
  88. package/dist/runtime/context.mjs +98 -0
  89. package/dist/runtime/createLog.d.ts +3 -0
  90. package/dist/runtime/createLog.mjs +39 -0
  91. package/dist/runtime/error/handler.d.ts +14 -0
  92. package/dist/runtime/error/handler.mjs +53 -0
  93. package/dist/runtime/handler.d.ts +8 -0
  94. package/dist/runtime/handler.mjs +26 -0
  95. package/dist/runtime/log.d.ts +38 -0
  96. package/dist/runtime/log.mjs +68 -0
  97. package/dist/runtime/plugin/log.client.d.ts +8 -0
  98. package/dist/runtime/plugin/log.client.mjs +24 -0
  99. package/dist/runtime/plugin/log.server.d.ts +2 -0
  100. package/dist/runtime/plugin/log.server.mjs +11 -0
  101. package/dist/runtime/plugin/shop.d.ts +8 -0
  102. package/dist/runtime/plugin/shop.mjs +17 -0
  103. package/dist/runtime/rpc/rpcCall.d.ts +9 -0
  104. package/dist/runtime/rpc/rpcCall.mjs +16 -0
  105. package/dist/runtime/server/middleware/bootstrap.d.ts +12 -0
  106. package/dist/runtime/server/middleware/bootstrap.mjs +188 -0
  107. package/dist/runtime/server/middleware/bootstrap.test.d.ts +6 -0
  108. package/dist/runtime/server/middleware/bootstrap.test.mjs +277 -0
  109. package/dist/runtime/server/middleware/bootstrap.utils.d.ts +7 -0
  110. package/dist/runtime/server/middleware/bootstrap.utils.mjs +59 -0
  111. package/dist/runtime/server/middleware/cache.d.ts +12 -0
  112. package/dist/runtime/server/middleware/cache.mjs +44 -0
  113. package/dist/runtime/server/middleware/oauth.d.ts +3 -0
  114. package/dist/runtime/server/middleware/oauth.mjs +123 -0
  115. package/dist/runtime/server/middleware/redirects.d.ts +2 -0
  116. package/dist/runtime/server/middleware/redirects.mjs +86 -0
  117. package/dist/runtime/server/middleware/redirects.test.d.ts +1 -0
  118. package/dist/runtime/server/middleware/redirects.test.mjs +66 -0
  119. package/dist/runtime/server/middleware/redirects.utils.d.ts +18 -0
  120. package/dist/runtime/server/middleware/redirects.utils.mjs +28 -0
  121. package/dist/runtime/utils/error.d.ts +5 -0
  122. package/dist/runtime/utils/error.mjs +7 -0
  123. package/dist/runtime/utils/price.d.ts +11 -0
  124. package/dist/runtime/utils/price.mjs +32 -0
  125. package/dist/runtime/utils/price.test.d.ts +1 -0
  126. package/dist/runtime/utils/price.test.mjs +83 -0
  127. package/dist/runtime/utils/route.d.ts +2 -0
  128. package/dist/runtime/utils/route.mjs +3 -0
  129. package/dist/runtime/utils/route.test.d.ts +1 -0
  130. package/dist/runtime/utils/route.test.mjs +15 -0
  131. package/dist/shared/storefront-nuxt.9548700f.d.mts +161 -0
  132. package/dist/shared/storefront-nuxt.9548700f.d.ts +161 -0
  133. package/dist/types.d.mts +15 -0
  134. package/dist/types.d.ts +15 -0
  135. package/package.json +103 -0
@@ -0,0 +1,20 @@
1
+ import { useRpc } from "../core/useRpc.mjs";
2
+ export async function useNavigationTree({
3
+ params,
4
+ options,
5
+ key = "useNavigationTree"
6
+ } = {}) {
7
+ const { data, fetching, fetch, error, status } = await useRpc(
8
+ "fetchNavigationTreeById",
9
+ key,
10
+ params,
11
+ options
12
+ );
13
+ return {
14
+ data,
15
+ fetching,
16
+ fetch,
17
+ error,
18
+ status
19
+ };
20
+ }
@@ -0,0 +1,16 @@
1
+ import { RpcMethodParameters } from '@scayle/storefront-core';
2
+ import { RpcOptions } from '../core/useRpc';
3
+ import type { MaybeRefOrGetter } from '#imports';
4
+ type Options = Partial<{
5
+ params: MaybeRefOrGetter<RpcMethodParameters<'fetchAllNavigationTrees'>>;
6
+ options: RpcOptions;
7
+ key: string;
8
+ }>;
9
+ export declare function useNavigationTrees({ params, options, key, }?: Options): Promise<{
10
+ data: import("vue").Ref<import("@aboutyou/backbone").NavigationAllEndpointResponseData>;
11
+ fetching: import("vue").Ref<boolean>;
12
+ fetch: () => Promise<void>;
13
+ error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
14
+ status: import("vue").Ref<import("../core/useRpc").Status>;
15
+ }>;
16
+ export {};
@@ -0,0 +1,20 @@
1
+ import { useRpc } from "../core/useRpc.mjs";
2
+ export async function useNavigationTrees({
3
+ params = {},
4
+ options,
5
+ key = "useNavigationTrees"
6
+ } = {}) {
7
+ const { data, fetching, fetch, error, status } = await useRpc(
8
+ "fetchAllNavigationTrees",
9
+ key,
10
+ params,
11
+ options
12
+ );
13
+ return {
14
+ data,
15
+ fetching,
16
+ fetch,
17
+ error,
18
+ status
19
+ };
20
+ }
@@ -0,0 +1,89 @@
1
+ import { RpcMethodParameters, Order } from '@scayle/storefront-core';
2
+ import { RpcOptions } from '../core/useRpc';
3
+ import type { MaybeRefOrGetter } from '#imports';
4
+ type Options = Partial<{
5
+ params: MaybeRefOrGetter<RpcMethodParameters<'getOrderById'>>;
6
+ options: RpcOptions;
7
+ key: string;
8
+ }>;
9
+ export declare function useOrder<P = {
10
+ [k: string]: unknown;
11
+ }, V = {
12
+ [k: string]: unknown;
13
+ }>({ params, options, key }?: Options): Promise<{
14
+ data: Ref<Order & {
15
+ items?: ({
16
+ id?: number | undefined;
17
+ availableQuantity?: number | undefined;
18
+ currency?: string | undefined;
19
+ customData?: {
20
+ [k: string]: unknown;
21
+ } | undefined;
22
+ deliveryForecast?: import("@scayle/storefront-core").DeliveryForecastFromWarehouse | undefined;
23
+ isManuallyReturnedByCci?: boolean | undefined;
24
+ itemGroup?: {
25
+ id: string;
26
+ isMainItem: boolean;
27
+ isRequired: boolean;
28
+ } | null | undefined;
29
+ key: string;
30
+ lowestPriorPrice?: {
31
+ relativeDifferenceToPrice: number;
32
+ withTax: number;
33
+ } | null | undefined;
34
+ merchant?: {
35
+ [k: string]: unknown;
36
+ id: number;
37
+ } | undefined;
38
+ packageId: number;
39
+ price: {
40
+ appliedReductions?: {
41
+ amount: {
42
+ absoluteWithTax: number;
43
+ relative: number;
44
+ };
45
+ category: "sale" | "campaign" | "voucher";
46
+ code?: string | undefined;
47
+ type: "relative" | "absolute";
48
+ }[] | undefined;
49
+ overrideWithoutTax?: number | undefined;
50
+ overrideWithTax?: number | undefined;
51
+ reference?: {
52
+ size?: string | undefined;
53
+ unit?: string | undefined;
54
+ withTax?: number | undefined;
55
+ } | undefined;
56
+ tax: {
57
+ [k: string]: {
58
+ amount: number;
59
+ rate: number;
60
+ };
61
+ };
62
+ undiscountedWithOutTax?: number | undefined;
63
+ undiscountedWithTax?: number | undefined;
64
+ withoutTax: number;
65
+ withTax: number;
66
+ };
67
+ product: {
68
+ [k: string]: unknown;
69
+ };
70
+ reservationKey?: string | undefined;
71
+ status: "available" | "cancelled" | "delivered" | "returned" | "unavailable";
72
+ variant: {
73
+ [k: string]: unknown;
74
+ };
75
+ warehouseId?: import("@scayle/storefront-core").PickingWarehouseId | undefined;
76
+ warehousePackageGroupId?: import("@scayle/storefront-core").WarehousePackageReference | undefined;
77
+ createdAt: string;
78
+ updatedAt: string;
79
+ } & {
80
+ product: P;
81
+ variant: V;
82
+ })[] | undefined;
83
+ }>;
84
+ fetching: import("vue").Ref<boolean>;
85
+ fetch: () => Promise<void>;
86
+ error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
87
+ status: import("vue").Ref<import("../core/useRpc").Status>;
88
+ }>;
89
+ export {};
@@ -0,0 +1,17 @@
1
+ import { useRpc } from "../core/useRpc.mjs";
2
+ export async function useOrder({ params, options, key = "useOrder" } = {}) {
3
+ const { data, fetching, fetch, error, status } = await useRpc(
4
+ "getOrderById",
5
+ key,
6
+ params,
7
+ options
8
+ );
9
+ const _data = data;
10
+ return {
11
+ data: _data,
12
+ fetching,
13
+ fetch,
14
+ error,
15
+ status
16
+ };
17
+ }
@@ -0,0 +1,89 @@
1
+ import { RpcMethodParameters, Order } from '@scayle/storefront-core';
2
+ import { RpcOptions } from '../core/useRpc';
3
+ import type { MaybeRefOrGetter } from '#imports';
4
+ type Options = Partial<{
5
+ params: MaybeRefOrGetter<RpcMethodParameters<'getOrderDataByCbd'>>;
6
+ options: RpcOptions;
7
+ key: string;
8
+ }>;
9
+ export declare function useOrderConfirmation<P = {
10
+ [k: string]: unknown;
11
+ }, V = {
12
+ [k: string]: unknown;
13
+ }>({ params, options, key }?: Options): Promise<{
14
+ data: Ref<Order & {
15
+ items?: ({
16
+ id?: number | undefined;
17
+ availableQuantity?: number | undefined;
18
+ currency?: string | undefined;
19
+ customData?: {
20
+ [k: string]: unknown;
21
+ } | undefined;
22
+ deliveryForecast?: import("@scayle/storefront-core").DeliveryForecastFromWarehouse | undefined;
23
+ isManuallyReturnedByCci?: boolean | undefined;
24
+ itemGroup?: {
25
+ id: string;
26
+ isMainItem: boolean;
27
+ isRequired: boolean;
28
+ } | null | undefined;
29
+ key: string;
30
+ lowestPriorPrice?: {
31
+ relativeDifferenceToPrice: number;
32
+ withTax: number;
33
+ } | null | undefined;
34
+ merchant?: {
35
+ [k: string]: unknown;
36
+ id: number;
37
+ } | undefined;
38
+ packageId: number;
39
+ price: {
40
+ appliedReductions?: {
41
+ amount: {
42
+ absoluteWithTax: number;
43
+ relative: number;
44
+ };
45
+ category: "sale" | "campaign" | "voucher";
46
+ code?: string | undefined;
47
+ type: "relative" | "absolute";
48
+ }[] | undefined;
49
+ overrideWithoutTax?: number | undefined;
50
+ overrideWithTax?: number | undefined;
51
+ reference?: {
52
+ size?: string | undefined;
53
+ unit?: string | undefined;
54
+ withTax?: number | undefined;
55
+ } | undefined;
56
+ tax: {
57
+ [k: string]: {
58
+ amount: number;
59
+ rate: number;
60
+ };
61
+ };
62
+ undiscountedWithOutTax?: number | undefined;
63
+ undiscountedWithTax?: number | undefined;
64
+ withoutTax: number;
65
+ withTax: number;
66
+ };
67
+ product: {
68
+ [k: string]: unknown;
69
+ };
70
+ reservationKey?: string | undefined;
71
+ status: "available" | "cancelled" | "delivered" | "returned" | "unavailable";
72
+ variant: {
73
+ [k: string]: unknown;
74
+ };
75
+ warehouseId?: import("@scayle/storefront-core").PickingWarehouseId | undefined;
76
+ warehousePackageGroupId?: import("@scayle/storefront-core").WarehousePackageReference | undefined;
77
+ createdAt: string;
78
+ updatedAt: string;
79
+ } & {
80
+ product: P;
81
+ variant: V;
82
+ })[] | undefined;
83
+ }>;
84
+ fetching: import("vue").Ref<boolean>;
85
+ fetch: () => Promise<void>;
86
+ error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
87
+ status: import("vue").Ref<import("../core/useRpc").Status>;
88
+ }>;
89
+ export {};
@@ -0,0 +1,17 @@
1
+ import { useRpc } from "../core/useRpc.mjs";
2
+ export async function useOrderConfirmation({ params, options, key = "useOrderConfirmation" } = {}) {
3
+ const { data, fetching, fetch, error, status } = await useRpc(
4
+ "getOrderDataByCbd",
5
+ key,
6
+ params,
7
+ options
8
+ );
9
+ const _data = data;
10
+ return {
11
+ data: _data,
12
+ fetching,
13
+ fetch,
14
+ error,
15
+ status
16
+ };
17
+ }
@@ -0,0 +1,16 @@
1
+ import { type RpcMethodParameters } from '@scayle/storefront-core';
2
+ import { type RpcOptions } from '../core/useRpc';
3
+ import { type MaybeRefOrGetter } from '#imports';
4
+ type Options = Partial<{
5
+ params: MaybeRefOrGetter<RpcMethodParameters<'getProductById'>>;
6
+ options: RpcOptions;
7
+ key: string;
8
+ }>;
9
+ export declare function useProduct({ params, options, key, }?: Options): Promise<{
10
+ data: import("vue").Ref<import("@scayle/storefront-core").Product>;
11
+ fetching: import("vue").Ref<boolean>;
12
+ fetch: () => Promise<void>;
13
+ error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
14
+ status: import("vue").Ref<import("../core/useRpc").Status>;
15
+ }>;
16
+ export {};
@@ -0,0 +1,20 @@
1
+ import { useRpc } from "../core/useRpc.mjs";
2
+ export async function useProduct({
3
+ params,
4
+ options,
5
+ key = "useProduct"
6
+ } = {}) {
7
+ const { data, fetching, fetch, error, status } = await useRpc(
8
+ "getProductById",
9
+ key,
10
+ params,
11
+ options
12
+ );
13
+ return {
14
+ data,
15
+ fetching,
16
+ fetch,
17
+ error,
18
+ status
19
+ };
20
+ }
@@ -0,0 +1,20 @@
1
+ import { type RpcMethodParameters } from '@scayle/storefront-core';
2
+ import { type RpcOptions } from '../core/useRpc';
3
+ import { type MaybeRefOrGetter } from '#imports';
4
+ type Options = Partial<{
5
+ params: MaybeRefOrGetter<RpcMethodParameters<'getProductsByCategory'>>;
6
+ options: RpcOptions;
7
+ key: string;
8
+ }>;
9
+ export declare function useProducts({ params, options, key, }?: Options): Promise<{
10
+ data: import("vue").Ref<import("@scayle/storefront-core").ProductsResponse | ({
11
+ pagination: import("@scayle/storefront-core").Pagination;
12
+ } & {
13
+ products: import("@scayle/storefront-core").Product[];
14
+ })>;
15
+ fetching: import("vue").Ref<boolean>;
16
+ fetch: () => Promise<void>;
17
+ error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
18
+ status: import("vue").Ref<import("../core/useRpc").Status>;
19
+ }>;
20
+ export {};
@@ -0,0 +1,20 @@
1
+ import { useRpc } from "../core/useRpc.mjs";
2
+ export async function useProducts({
3
+ params,
4
+ options,
5
+ key = "useProducts"
6
+ } = {}) {
7
+ const { data, fetching, fetch, error, status } = await useRpc(
8
+ "getProductsByCategory",
9
+ key,
10
+ params,
11
+ options
12
+ );
13
+ return {
14
+ data,
15
+ fetching,
16
+ fetch,
17
+ error,
18
+ status
19
+ };
20
+ }
@@ -0,0 +1,16 @@
1
+ import { type RpcMethodParameters } from '@scayle/storefront-core';
2
+ import { type RpcOptions } from '../core/useRpc';
3
+ import { type MaybeRefOrGetter } from '#imports';
4
+ type Options = Partial<{
5
+ params: MaybeRefOrGetter<RpcMethodParameters<'getProductsByIds'>>;
6
+ options: RpcOptions;
7
+ key: string;
8
+ }>;
9
+ export declare function useProductsByIds({ params, options, key, }?: Options): Promise<{
10
+ data: import("vue").Ref<import("@scayle/storefront-core").Product[]>;
11
+ fetching: import("vue").Ref<boolean>;
12
+ fetch: () => Promise<void>;
13
+ error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
14
+ status: import("vue").Ref<import("../core/useRpc").Status>;
15
+ }>;
16
+ export {};
@@ -0,0 +1,20 @@
1
+ import { useRpc } from "../core/useRpc.mjs";
2
+ export async function useProductsByIds({
3
+ params,
4
+ options,
5
+ key = "useProductsByIds"
6
+ } = {}) {
7
+ const { data, fetching, fetch, error, status } = await useRpc(
8
+ "getProductsByIds",
9
+ key,
10
+ params,
11
+ options
12
+ );
13
+ return {
14
+ data,
15
+ fetching,
16
+ fetch,
17
+ error,
18
+ status
19
+ };
20
+ }
@@ -0,0 +1,16 @@
1
+ import { RpcMethodParameters } from '@scayle/storefront-core';
2
+ import { RpcOptions } from '../core/useRpc';
3
+ import type { MaybeRefOrGetter } from '#imports';
4
+ type Options = Partial<{
5
+ params: MaybeRefOrGetter<RpcMethodParameters<'getProductsCount'>>;
6
+ options: RpcOptions;
7
+ key: string;
8
+ }>;
9
+ export declare function useProductsCount({ params, options, key, }?: Options): Promise<{
10
+ data: import("vue").Ref<import("@scayle/storefront-core").FetchProductsCountResponse>;
11
+ fetching: import("vue").Ref<boolean>;
12
+ fetch: () => Promise<void>;
13
+ error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
14
+ status: import("vue").Ref<import("../core/useRpc").Status>;
15
+ }>;
16
+ export {};
@@ -0,0 +1,20 @@
1
+ import { useRpc } from "../core/useRpc.mjs";
2
+ export async function useProductsCount({
3
+ params,
4
+ options,
5
+ key = "useProductsCount"
6
+ } = {}) {
7
+ const { data, fetching, fetch, error, status } = await useRpc(
8
+ "getProductsCount",
9
+ key,
10
+ params,
11
+ options
12
+ );
13
+ return {
14
+ data,
15
+ fetching,
16
+ fetch,
17
+ error,
18
+ status
19
+ };
20
+ }
@@ -0,0 +1,16 @@
1
+ import { type RpcMethodParameters } from '@scayle/storefront-core';
2
+ import { type RpcOptions } from '../core/useRpc';
3
+ import { type MaybeRefOrGetter } from '#imports';
4
+ type Options = Partial<{
5
+ params: MaybeRefOrGetter<RpcMethodParameters<'getPromotions'>>;
6
+ options: RpcOptions;
7
+ key: string;
8
+ }>;
9
+ export declare function usePromotions({ params, options, key, }?: Options): Promise<{
10
+ data: import("vue").Ref<import("@scayle/storefront-core").PromotionsResponseData>;
11
+ fetching: import("vue").Ref<boolean>;
12
+ fetch: () => Promise<void>;
13
+ error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
14
+ status: import("vue").Ref<import("../core/useRpc").Status>;
15
+ }>;
16
+ export {};
@@ -0,0 +1,20 @@
1
+ import { useRpc } from "../core/useRpc.mjs";
2
+ export async function usePromotions({
3
+ params,
4
+ options,
5
+ key = "usePromotions"
6
+ } = {}) {
7
+ const { data, fetching, fetch, error, status } = await useRpc(
8
+ "getPromotions",
9
+ key,
10
+ params,
11
+ options
12
+ );
13
+ return {
14
+ data,
15
+ fetching,
16
+ fetch,
17
+ error,
18
+ status
19
+ };
20
+ }
@@ -0,0 +1,16 @@
1
+ import { type RpcMethodParameters } from '@scayle/storefront-core';
2
+ import { type RpcOptions } from '../core/useRpc';
3
+ import { type MaybeRefOrGetter } from '#imports';
4
+ type Options = Partial<{
5
+ params: MaybeRefOrGetter<RpcMethodParameters<'getPromotionsByIds'>>;
6
+ options: RpcOptions;
7
+ key: string;
8
+ }>;
9
+ export declare function usePromotionsByIds({ params, options, key, }?: Options): Promise<{
10
+ data: import("vue").Ref<import("@scayle/storefront-core").PromotionsResponseData>;
11
+ fetching: import("vue").Ref<boolean>;
12
+ fetch: () => Promise<void>;
13
+ error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
14
+ status: import("vue").Ref<import("../core/useRpc").Status>;
15
+ }>;
16
+ export {};
@@ -0,0 +1,20 @@
1
+ import { useRpc } from "../core/useRpc.mjs";
2
+ export async function usePromotionsByIds({
3
+ params,
4
+ options,
5
+ key = "usePromotionsByIds"
6
+ } = {}) {
7
+ const { data, fetching, fetch, error, status } = await useRpc(
8
+ "getPromotionsByIds",
9
+ key,
10
+ params,
11
+ options
12
+ );
13
+ return {
14
+ data,
15
+ fetching,
16
+ fetch,
17
+ error,
18
+ status
19
+ };
20
+ }
@@ -0,0 +1,12 @@
1
+ import { FilterParams, SortingValueKey, TransformedFilter, Filter } from '@scayle/storefront-core';
2
+ type Options = {
3
+ defaultSort?: SortingValueKey;
4
+ };
5
+ declare const _default: (options?: Options) => {
6
+ activeFilters: import("vue").ComputedRef<Filter>;
7
+ applyFilters: (filter?: Filter, scrollToTop?: boolean) => Promise<void>;
8
+ isActiveFilter: (filter?: TransformedFilter) => any;
9
+ resetFilterUrl: () => Promise<void>;
10
+ productConditions: import("vue").ComputedRef<FilterParams>;
11
+ };
12
+ export default _default;
@@ -0,0 +1,66 @@
1
+ import { isEmpty, isEqual } from "radash";
2
+ import {
3
+ getSortByValue,
4
+ isFilterActive,
5
+ transformToWhereCondition,
6
+ serializeFilters,
7
+ deserializeFilters
8
+ } from "@scayle/storefront-core";
9
+ import { computed } from "vue";
10
+ import { getCurrentPage } from "../../utils/route.mjs";
11
+ import { useRoute, useRouter } from "#imports";
12
+ const DEFAULT_QUERY_KEYS = ["page", "sort", "term"];
13
+ export default (options = {}) => {
14
+ const router = useRouter();
15
+ const route = useRoute();
16
+ const activeFilters = computed(() => {
17
+ const allowedFilters = Object.fromEntries(
18
+ Object.entries(route.query).filter(
19
+ ([key]) => !DEFAULT_QUERY_KEYS.includes(key)
20
+ )
21
+ );
22
+ return deserializeFilters(allowedFilters);
23
+ });
24
+ const isActiveFilter = (filter) => {
25
+ if (!filter) {
26
+ return isEmpty(activeFilters.value);
27
+ }
28
+ return isFilterActive(activeFilters.value, filter);
29
+ };
30
+ const applyFilters = async (filter, scrollToTop = true) => {
31
+ const newQuery = {
32
+ sort: route.query.sort,
33
+ term: route.query.term,
34
+ ...filter ? serializeFilters(filter) : {}
35
+ };
36
+ if (isEqual(route.query, newQuery)) {
37
+ return;
38
+ }
39
+ await router.push({
40
+ query: { ...newQuery }
41
+ });
42
+ if (scrollToTop) {
43
+ window.scroll({
44
+ behavior: "smooth",
45
+ top: 0
46
+ });
47
+ }
48
+ };
49
+ const resetFilterUrl = async () => {
50
+ await router.replace({ query: { term: route.query.term } });
51
+ };
52
+ const generateFilterParams = () => {
53
+ return {
54
+ where: { ...transformToWhereCondition(activeFilters.value) },
55
+ page: getCurrentPage(route.query),
56
+ sort: getSortByValue(route.query?.sort || "", options?.defaultSort)
57
+ };
58
+ };
59
+ return {
60
+ activeFilters,
61
+ applyFilters,
62
+ isActiveFilter,
63
+ resetFilterUrl,
64
+ productConditions: computed(() => generateFilterParams())
65
+ };
66
+ };
@@ -0,0 +1,13 @@
1
+ import { type SearchInput, type SearchOptions } from '@scayle/storefront-core';
2
+ type Options = Partial<{
3
+ params: SearchOptions;
4
+ key: string;
5
+ }>;
6
+ export declare const useSearch: ({ params, key }?: Options) => {
7
+ data: any;
8
+ pending: any;
9
+ searchQuery: any;
10
+ resetSearch: () => void;
11
+ search: ({ term, slug, productLimit }: SearchInput) => Promise<void>;
12
+ };
13
+ export {};
@@ -0,0 +1,49 @@
1
+ import { rpcCall } from "../../rpc/rpcCall.mjs";
2
+ import { useCurrentShop } from "../core/useCurrentShop.mjs";
3
+ import { useState, useNuxtApp, toValue } from "#imports";
4
+ export const useSearch = ({ params, key = "search" } = {}) => {
5
+ const data = useState(
6
+ `${key}-data`,
7
+ () => void 0
8
+ );
9
+ const searchQuery = useState(`${key}-searchQuery`, () => "");
10
+ const pending = useState(`${key}-pending`, () => false);
11
+ const error = useState(`${key}-error`, () => void 0);
12
+ const status = useState(`${key}-error`, () => "idle");
13
+ const shop = useCurrentShop();
14
+ const search = async ({ term, slug, productLimit }) => {
15
+ pending.value = true;
16
+ status.value = "pending";
17
+ if (!term) {
18
+ return;
19
+ }
20
+ try {
21
+ data.value = await rpcCall(
22
+ useNuxtApp(),
23
+ "searchProducts",
24
+ toValue(shop)
25
+ )({
26
+ term: String(term),
27
+ slug,
28
+ with: params?.with,
29
+ productLimit
30
+ });
31
+ } catch (e) {
32
+ error.value = e;
33
+ } finally {
34
+ pending.value = false;
35
+ status.value = error.value ? "error" : "success";
36
+ }
37
+ };
38
+ const resetSearch = () => {
39
+ searchQuery.value = "";
40
+ data.value = { suggestions: [] };
41
+ };
42
+ return {
43
+ data,
44
+ pending,
45
+ searchQuery,
46
+ resetSearch,
47
+ search
48
+ };
49
+ };
@@ -0,0 +1,13 @@
1
+ import { RpcOptions } from '../core/useRpc';
2
+ type Options = Partial<{
3
+ options: RpcOptions;
4
+ key: string;
5
+ }>;
6
+ export declare function useShopConfiguration({ options, key, }?: Options): Promise<{
7
+ data: import("vue").Ref<import("@aboutyou/backbone/endpoints/shopconfiguration/shopconfiguration").ShopConfigurationResponseData>;
8
+ fetching: import("vue").Ref<boolean>;
9
+ fetch: () => Promise<void>;
10
+ error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
11
+ status: import("vue").Ref<import("../core/useRpc").Status>;
12
+ }>;
13
+ export {};