@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.
- package/CHANGELOG.md +598 -0
- package/LICENSE +21 -0
- package/README.md +67 -0
- package/dist/index.d.mts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.mjs +2 -0
- package/dist/module.cjs +5 -0
- package/dist/module.d.mts +8 -0
- package/dist/module.d.ts +8 -0
- package/dist/module.json +8 -0
- package/dist/module.mjs +173 -0
- package/dist/rpc.d.mts +12 -0
- package/dist/rpc.d.ts +12 -0
- package/dist/rpc.mjs +18 -0
- package/dist/runtime/api/cacheAuth.d.ts +12 -0
- package/dist/runtime/api/cacheAuth.mjs +40 -0
- package/dist/runtime/api/purgeAll.d.ts +2 -0
- package/dist/runtime/api/purgeAll.mjs +14 -0
- package/dist/runtime/api/purgeTags.d.ts +2 -0
- package/dist/runtime/api/purgeTags.mjs +19 -0
- package/dist/runtime/api/rpcHandler.d.ts +2 -0
- package/dist/runtime/api/rpcHandler.mjs +15 -0
- package/dist/runtime/api/up.d.ts +4 -0
- package/dist/runtime/api/up.mjs +4 -0
- package/dist/runtime/composables/core/useAvailableShops.d.ts +2 -0
- package/dist/runtime/composables/core/useAvailableShops.mjs +4 -0
- package/dist/runtime/composables/core/useCurrentShop.d.ts +3 -0
- package/dist/runtime/composables/core/useCurrentShop.mjs +8 -0
- package/dist/runtime/composables/core/useEventListener.d.ts +2 -0
- package/dist/runtime/composables/core/useEventListener.mjs +2 -0
- package/dist/runtime/composables/core/useLog.d.ts +1 -0
- package/dist/runtime/composables/core/useLog.mjs +8 -0
- package/dist/runtime/composables/core/useRpc.d.ts +17 -0
- package/dist/runtime/composables/core/useRpc.mjs +56 -0
- package/dist/runtime/composables/core/useSession.d.ts +21 -0
- package/dist/runtime/composables/core/useSession.mjs +21 -0
- package/dist/runtime/composables/core/useUser.d.ts +16 -0
- package/dist/runtime/composables/core/useUser.mjs +68 -0
- package/dist/runtime/composables/storefront/useBasket.d.ts +54 -0
- package/dist/runtime/composables/storefront/useBasket.mjs +165 -0
- package/dist/runtime/composables/storefront/useBrand.d.ts +16 -0
- package/dist/runtime/composables/storefront/useBrand.mjs +20 -0
- package/dist/runtime/composables/storefront/useBrands.d.ts +16 -0
- package/dist/runtime/composables/storefront/useBrands.mjs +20 -0
- package/dist/runtime/composables/storefront/useCategories.d.ts +20 -0
- package/dist/runtime/composables/storefront/useCategories.mjs +30 -0
- package/dist/runtime/composables/storefront/useCurrentPromotions.d.ts +16 -0
- package/dist/runtime/composables/storefront/useCurrentPromotions.mjs +20 -0
- package/dist/runtime/composables/storefront/useFacet.d.ts +48 -0
- package/dist/runtime/composables/storefront/useFacet.mjs +193 -0
- package/dist/runtime/composables/storefront/useFilters.d.ts +16 -0
- package/dist/runtime/composables/storefront/useFilters.mjs +20 -0
- package/dist/runtime/composables/storefront/useNavigationTree.d.ts +16 -0
- package/dist/runtime/composables/storefront/useNavigationTree.mjs +20 -0
- package/dist/runtime/composables/storefront/useNavigationTrees.d.ts +16 -0
- package/dist/runtime/composables/storefront/useNavigationTrees.mjs +20 -0
- package/dist/runtime/composables/storefront/useOrder.d.ts +89 -0
- package/dist/runtime/composables/storefront/useOrder.mjs +17 -0
- package/dist/runtime/composables/storefront/useOrderConfirmation.d.ts +89 -0
- package/dist/runtime/composables/storefront/useOrderConfirmation.mjs +17 -0
- package/dist/runtime/composables/storefront/useProduct.d.ts +16 -0
- package/dist/runtime/composables/storefront/useProduct.mjs +20 -0
- package/dist/runtime/composables/storefront/useProducts.d.ts +20 -0
- package/dist/runtime/composables/storefront/useProducts.mjs +20 -0
- package/dist/runtime/composables/storefront/useProductsByIds.d.ts +16 -0
- package/dist/runtime/composables/storefront/useProductsByIds.mjs +20 -0
- package/dist/runtime/composables/storefront/useProductsCount.d.ts +16 -0
- package/dist/runtime/composables/storefront/useProductsCount.mjs +20 -0
- package/dist/runtime/composables/storefront/usePromotions.d.ts +16 -0
- package/dist/runtime/composables/storefront/usePromotions.mjs +20 -0
- package/dist/runtime/composables/storefront/usePromotionsByIds.d.ts +16 -0
- package/dist/runtime/composables/storefront/usePromotionsByIds.mjs +20 -0
- package/dist/runtime/composables/storefront/useQueryFilterState.d.ts +12 -0
- package/dist/runtime/composables/storefront/useQueryFilterState.mjs +66 -0
- package/dist/runtime/composables/storefront/useSearch.d.ts +13 -0
- package/dist/runtime/composables/storefront/useSearch.mjs +49 -0
- package/dist/runtime/composables/storefront/useShopConfiguration.d.ts +13 -0
- package/dist/runtime/composables/storefront/useShopConfiguration.mjs +19 -0
- package/dist/runtime/composables/storefront/useUserAddresses.d.ts +13 -0
- package/dist/runtime/composables/storefront/useUserAddresses.mjs +19 -0
- package/dist/runtime/composables/storefront/useVariant.d.ts +16 -0
- package/dist/runtime/composables/storefront/useVariant.mjs +20 -0
- package/dist/runtime/composables/storefront/useWishlist.d.ts +48 -0
- package/dist/runtime/composables/storefront/useWishlist.mjs +119 -0
- package/dist/runtime/composables/useCoreLog.d.ts +1 -0
- package/dist/runtime/composables/useCoreLog.mjs +4 -0
- package/dist/runtime/context.d.ts +12 -0
- package/dist/runtime/context.mjs +98 -0
- package/dist/runtime/createLog.d.ts +3 -0
- package/dist/runtime/createLog.mjs +39 -0
- package/dist/runtime/error/handler.d.ts +14 -0
- package/dist/runtime/error/handler.mjs +53 -0
- package/dist/runtime/handler.d.ts +8 -0
- package/dist/runtime/handler.mjs +26 -0
- package/dist/runtime/log.d.ts +38 -0
- package/dist/runtime/log.mjs +68 -0
- package/dist/runtime/plugin/log.client.d.ts +8 -0
- package/dist/runtime/plugin/log.client.mjs +24 -0
- package/dist/runtime/plugin/log.server.d.ts +2 -0
- package/dist/runtime/plugin/log.server.mjs +11 -0
- package/dist/runtime/plugin/shop.d.ts +8 -0
- package/dist/runtime/plugin/shop.mjs +17 -0
- package/dist/runtime/rpc/rpcCall.d.ts +9 -0
- package/dist/runtime/rpc/rpcCall.mjs +16 -0
- package/dist/runtime/server/middleware/bootstrap.d.ts +12 -0
- package/dist/runtime/server/middleware/bootstrap.mjs +188 -0
- package/dist/runtime/server/middleware/bootstrap.test.d.ts +6 -0
- package/dist/runtime/server/middleware/bootstrap.test.mjs +277 -0
- package/dist/runtime/server/middleware/bootstrap.utils.d.ts +7 -0
- package/dist/runtime/server/middleware/bootstrap.utils.mjs +59 -0
- package/dist/runtime/server/middleware/cache.d.ts +12 -0
- package/dist/runtime/server/middleware/cache.mjs +44 -0
- package/dist/runtime/server/middleware/oauth.d.ts +3 -0
- package/dist/runtime/server/middleware/oauth.mjs +123 -0
- package/dist/runtime/server/middleware/redirects.d.ts +2 -0
- package/dist/runtime/server/middleware/redirects.mjs +86 -0
- package/dist/runtime/server/middleware/redirects.test.d.ts +1 -0
- package/dist/runtime/server/middleware/redirects.test.mjs +66 -0
- package/dist/runtime/server/middleware/redirects.utils.d.ts +18 -0
- package/dist/runtime/server/middleware/redirects.utils.mjs +28 -0
- package/dist/runtime/utils/error.d.ts +5 -0
- package/dist/runtime/utils/error.mjs +7 -0
- package/dist/runtime/utils/price.d.ts +11 -0
- package/dist/runtime/utils/price.mjs +32 -0
- package/dist/runtime/utils/price.test.d.ts +1 -0
- package/dist/runtime/utils/price.test.mjs +83 -0
- package/dist/runtime/utils/route.d.ts +2 -0
- package/dist/runtime/utils/route.mjs +3 -0
- package/dist/runtime/utils/route.test.d.ts +1 -0
- package/dist/runtime/utils/route.test.mjs +15 -0
- package/dist/shared/storefront-nuxt.9548700f.d.mts +161 -0
- package/dist/shared/storefront-nuxt.9548700f.d.ts +161 -0
- package/dist/types.d.mts +15 -0
- package/dist/types.d.ts +15 -0
- 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 {};
|