@teamnovu/kit-shopware-composables 0.0.1 → 0.0.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/dist/cart/useCartAddItemMutation.d.ts +12 -0
- package/dist/cart/useCartQueryOptions.d.ts +9 -0
- package/dist/cart/useCartRemoveItemMutation.d.ts +7 -0
- package/dist/cart/useCartUpdateItemMutation.d.ts +12 -0
- package/dist/context/useContextOptions.d.ts +9 -0
- package/dist/context/useContextUpdate.d.ts +4 -0
- package/dist/general/useSeoUrl.d.ts +10 -0
- package/dist/index.d.ts +223 -0
- package/dist/index.mjs +304 -0
- package/dist/inject.d.ts +5 -0
- package/dist/keys.d.ts +27 -0
- package/dist/products/useCategoryQueryOptions.d.ts +17 -0
- package/dist/products/useProductListingQueryOptions.d.ts +19 -0
- package/dist/products/useProductListingQueryOptions.test.d.ts +1 -0
- package/dist/products/useProductPrice.d.ts +49 -0
- package/dist/products/useProductQueryOptions.d.ts +19 -0
- package/dist/products/useProductVariantForOptions.d.ts +276 -0
- package/dist/types/query.d.ts +7 -0
- package/dist/usePagination.d.ts +21 -0
- package/dist/util/url.d.ts +2 -0
- package/docker/boot_end.sh +0 -0
- package/docker/types.sh +0 -0
- package/package.json +9 -9
- package/src/cart/useCartAddItemMutation.ts +48 -0
- package/src/cart/useCartQueryOptions.ts +19 -0
- package/src/cart/useCartRemoveItemMutation.ts +32 -0
- package/src/cart/useCartUpdateItemMutation.ts +48 -0
- package/src/index.ts +8 -0
- package/src/keys.ts +4 -0
- package/src/products/useProductListingQueryOptions.ts +1 -0
- package/src/products/useProductPrice.ts +3 -2
- package/src/products/useProductQueryOptions.ts +1 -0
- package/src/products/useProductVariantForOptions.ts +8 -2
- package/eslint.config.mjs +0 -84
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { operations } from '../../api-types/storeApiTypes.d.ts';
|
|
2
|
+
import { MutationOptions, UseMutationReturnType, MutationObserverIdleResult, MutationObserverLoadingResult, MutationObserverErrorResult, MutationObserverSuccessResult } from '@tanstack/vue-query';
|
|
3
|
+
import { OperationBody, OperationResponse } from '../types/query';
|
|
4
|
+
import { OperationProp } from '@teamnovu/kit-shopware-api-client';
|
|
5
|
+
declare const addCartItemOperation = "addLineItem post /checkout/cart/line-item";
|
|
6
|
+
type LineItem<Operations extends operations> = OperationBody<Operations, typeof addCartItemOperation>['items'][number];
|
|
7
|
+
type LineItemPayload<Operations extends operations> = Partial<Omit<LineItem<Operations>, 'id' | 'quantity' | 'type'>> & Required<Pick<LineItem<Operations>, 'id' | 'quantity' | 'type'>>;
|
|
8
|
+
type Body<Operations extends operations> = Omit<OperationBody<Operations, typeof addCartItemOperation>, 'items'> & {
|
|
9
|
+
items: LineItemPayload<Operations>[];
|
|
10
|
+
};
|
|
11
|
+
export declare function useCartAddItemMutation<Operations extends operations>(mutationOptions: MutationOptions<OperationResponse<Operations, typeof addCartItemOperation>, unknown, Body<Operations>>): UseMutationReturnType<OperationProp<operations & Operations, "addLineItem post /checkout/cart/line-item", "response">, unknown, Body<Operations>, unknown, Omit< MutationObserverIdleResult<OperationProp<operations & Operations, "addLineItem post /checkout/cart/line-item", "response">, unknown, Body<Operations>, unknown>, "mutate" | "reset"> | Omit< MutationObserverLoadingResult<OperationProp<operations & Operations, "addLineItem post /checkout/cart/line-item", "response">, unknown, Body<Operations>, unknown>, "mutate" | "reset"> | Omit< MutationObserverErrorResult<OperationProp<operations & Operations, "addLineItem post /checkout/cart/line-item", "response">, unknown, Body<Operations>, unknown>, "mutate" | "reset"> | Omit< MutationObserverSuccessResult<OperationProp<operations & Operations, "addLineItem post /checkout/cart/line-item", "response">, unknown, Body<Operations>, unknown>, "mutate" | "reset">>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { operations } from '../../api-types/storeApiTypes.d.ts';
|
|
2
|
+
import { UndefinedInitialQueryOptions } from '@tanstack/vue-query';
|
|
3
|
+
import { OperationProp } from '@teamnovu/kit-shopware-api-client';
|
|
4
|
+
export declare function useCartQueryOptions<Operations extends operations>(): UndefinedInitialQueryOptions<OperationProp<operations & Operations, "readCart get /checkout/cart", "response">, Error, OperationProp<operations & Operations, "readCart get /checkout/cart", "response">, readonly ["cart"]> & {
|
|
5
|
+
queryKey: readonly ["cart"] & {
|
|
6
|
+
[dataTagSymbol]: OperationProp<operations & Operations, "readCart get /checkout/cart", "response">;
|
|
7
|
+
[dataTagErrorSymbol]: Error;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { operations } from '../../api-types/storeApiTypes.d.ts';
|
|
2
|
+
import { MutationOptions, UseMutationReturnType, MutationObserverIdleResult, MutationObserverLoadingResult, MutationObserverErrorResult, MutationObserverSuccessResult } from '@tanstack/vue-query';
|
|
3
|
+
import { OperationBody, OperationResponse } from '../types/query';
|
|
4
|
+
import { OperationProp } from '@teamnovu/kit-shopware-api-client';
|
|
5
|
+
declare const removeCartItemOperation = "removeLineItem post /checkout/cart/line-item/delete";
|
|
6
|
+
export declare function useCartRemoveItemMutation<Operations extends operations>(mutationOptions?: MutationOptions<OperationResponse<Operations, typeof removeCartItemOperation>, unknown, OperationBody<Operations, typeof removeCartItemOperation>>): UseMutationReturnType<OperationProp<operations & Operations, "removeLineItem post /checkout/cart/line-item/delete", "response">, unknown, OperationProp<Operations, "removeLineItem post /checkout/cart/line-item/delete", "body">, unknown, Omit< MutationObserverIdleResult<OperationProp<operations & Operations, "removeLineItem post /checkout/cart/line-item/delete", "response">, unknown, OperationProp<Operations, "removeLineItem post /checkout/cart/line-item/delete", "body">, unknown>, "mutate" | "reset"> | Omit< MutationObserverLoadingResult<OperationProp<operations & Operations, "removeLineItem post /checkout/cart/line-item/delete", "response">, unknown, OperationProp<Operations, "removeLineItem post /checkout/cart/line-item/delete", "body">, unknown>, "mutate" | "reset"> | Omit< MutationObserverErrorResult<OperationProp<operations & Operations, "removeLineItem post /checkout/cart/line-item/delete", "response">, unknown, OperationProp<Operations, "removeLineItem post /checkout/cart/line-item/delete", "body">, unknown>, "mutate" | "reset"> | Omit< MutationObserverSuccessResult<OperationProp<operations & Operations, "removeLineItem post /checkout/cart/line-item/delete", "response">, unknown, OperationProp<Operations, "removeLineItem post /checkout/cart/line-item/delete", "body">, unknown>, "mutate" | "reset">>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { operations } from '../../api-types/storeApiTypes.d.ts';
|
|
2
|
+
import { MutationOptions, UseMutationReturnType, MutationObserverIdleResult, MutationObserverLoadingResult, MutationObserverErrorResult, MutationObserverSuccessResult } from '@tanstack/vue-query';
|
|
3
|
+
import { OperationBody, OperationResponse } from '../types/query';
|
|
4
|
+
import { OperationProp } from '@teamnovu/kit-shopware-api-client';
|
|
5
|
+
declare const updateCartItemOperation = "updateLineItem patch /checkout/cart/line-item";
|
|
6
|
+
type LineItem<Operations extends operations> = OperationBody<Operations, typeof updateCartItemOperation>['items'][number];
|
|
7
|
+
type LineItemPayload<Operations extends operations> = Partial<Omit<LineItem<Operations>, 'id' | 'quantity' | 'type'>> & Required<Pick<LineItem<Operations>, 'id' | 'quantity' | 'type'>>;
|
|
8
|
+
type Body<Operations extends operations> = Omit<OperationBody<Operations, typeof updateCartItemOperation>, 'items'> & {
|
|
9
|
+
items: LineItemPayload<Operations>[];
|
|
10
|
+
};
|
|
11
|
+
export declare function useCartUpdateItemMutation<Operations extends operations>(mutationOptions?: MutationOptions<OperationResponse<Operations, typeof updateCartItemOperation>, unknown, Body<Operations>>): UseMutationReturnType<OperationProp<operations & Operations, "updateLineItem patch /checkout/cart/line-item", "response">, unknown, Body<Operations>, unknown, Omit< MutationObserverIdleResult<OperationProp<operations & Operations, "updateLineItem patch /checkout/cart/line-item", "response">, unknown, Body<Operations>, unknown>, "mutate" | "reset"> | Omit< MutationObserverLoadingResult<OperationProp<operations & Operations, "updateLineItem patch /checkout/cart/line-item", "response">, unknown, Body<Operations>, unknown>, "mutate" | "reset"> | Omit< MutationObserverErrorResult<OperationProp<operations & Operations, "updateLineItem patch /checkout/cart/line-item", "response">, unknown, Body<Operations>, unknown>, "mutate" | "reset"> | Omit< MutationObserverSuccessResult<OperationProp<operations & Operations, "updateLineItem patch /checkout/cart/line-item", "response">, unknown, Body<Operations>, unknown>, "mutate" | "reset">>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { operations } from '../../api-types/storeApiTypes.d.ts';
|
|
2
|
+
import { UndefinedInitialQueryOptions } from '@tanstack/vue-query';
|
|
3
|
+
import { OperationProp } from '@teamnovu/kit-shopware-api-client';
|
|
4
|
+
export declare function useContextOptions<Operations extends operations>(): UndefinedInitialQueryOptions<OperationProp<operations & Operations, "readContext get /context", "response">, Error, OperationProp<operations & Operations, "readContext get /context", "response">, readonly ["context"]> & {
|
|
5
|
+
queryKey: readonly ["context"] & {
|
|
6
|
+
[dataTagSymbol]: OperationProp<operations & Operations, "readContext get /context", "response">;
|
|
7
|
+
[dataTagErrorSymbol]: Error;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { operations } from '../../api-types/storeApiTypes.d.ts';
|
|
2
|
+
import { UseMutationReturnType, MutationObserverIdleResult, MutationObserverLoadingResult, MutationObserverErrorResult, MutationObserverSuccessResult } from '@tanstack/vue-query';
|
|
3
|
+
import { OperationProp } from '@teamnovu/kit-shopware-api-client';
|
|
4
|
+
export declare function useContextUpdate<Operations extends operations>(): UseMutationReturnType<OperationProp<operations & Operations, "updateContext patch /context", "response">, Error, void, unknown, Omit< MutationObserverIdleResult<OperationProp<operations & Operations, "updateContext patch /context", "response">, Error, void, unknown>, "mutate" | "reset"> | Omit< MutationObserverLoadingResult<OperationProp<operations & Operations, "updateContext patch /context", "response">, Error, void, unknown>, "mutate" | "reset"> | Omit< MutationObserverErrorResult<OperationProp<operations & Operations, "updateContext patch /context", "response">, Error, void, unknown>, "mutate" | "reset"> | Omit< MutationObserverSuccessResult<OperationProp<operations & Operations, "updateContext patch /context", "response">, Error, void, unknown>, "mutate" | "reset">>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GenericRecord } from '../../api-types/storeApiTypes.d.ts';
|
|
2
|
+
import { MaybeRef, ComputedRef } from 'vue';
|
|
3
|
+
interface SeoUrlEntity {
|
|
4
|
+
extensions?: {
|
|
5
|
+
novuSeoUrls?: GenericRecord;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export declare const getSeoUrl: <T extends SeoUrlEntity>(entity: T, languageId: string) => string;
|
|
9
|
+
export declare const useSeoUrl: <T extends SeoUrlEntity>(entity: MaybeRef<T>, languageId: MaybeRef<string>) => ComputedRef<string>;
|
|
10
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { Schemas as BaseSchemas, operations, components, GenericRecord } from '../api-types/storeApiTypes.d.ts';
|
|
2
|
+
import { MaybeRef, ComputedRef } from 'vue';
|
|
3
|
+
import { OperationProp } from '@teamnovu/kit-shopware-api-client';
|
|
4
|
+
import { UndefinedInitialQueryOptions, UseMutationReturnType, MutationObserverIdleResult, MutationObserverLoadingResult, MutationObserverErrorResult, MutationObserverSuccessResult, MutationOptions } from '@tanstack/vue-query';
|
|
5
|
+
export * from './general/useSeoUrl';
|
|
6
|
+
export * from './inject';
|
|
7
|
+
export * from './keys';
|
|
8
|
+
export * from './products/useProductPrice';
|
|
9
|
+
export * from './products/useProductVariantForOptions';
|
|
10
|
+
export * from './usePagination';
|
|
11
|
+
export * from './util/url';
|
|
12
|
+
export default class ShopwareComposables<Operations extends operations, Schemas extends BaseSchemas> {
|
|
13
|
+
useProductListingQueryOptions: (seoUrl: MaybeRef<string>, body?: MaybeRef<OperationProp<Operations, "readCompactProductListing post /novu/headless/product-listing/{seoUrl}", "body">> | undefined) => UndefinedInitialQueryOptions<OperationProp<operations & Operations, "readCompactProductListing post /novu/headless/product-listing/{seoUrl}", "response">, Error, OperationProp<operations & Operations, "readCompactProductListing post /novu/headless/product-listing/{seoUrl}", "response">, readonly ["product", "list", {
|
|
14
|
+
readonly url: MaybeRef<string>;
|
|
15
|
+
readonly body: unknown;
|
|
16
|
+
}]> & {
|
|
17
|
+
queryKey: readonly ["product", "list", {
|
|
18
|
+
readonly url: MaybeRef<string>;
|
|
19
|
+
readonly body: unknown;
|
|
20
|
+
}] & {
|
|
21
|
+
[dataTagSymbol]: OperationProp<operations & Operations, "readCompactProductListing post /novu/headless/product-listing/{seoUrl}", "response">;
|
|
22
|
+
[dataTagErrorSymbol]: Error;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
useCategoryQueryOptions: (body?: MaybeRef<OperationProp<Operations, "readCategoryList post /category", "body">> | undefined) => UndefinedInitialQueryOptions<OperationProp<operations & Operations, "readCategoryList post /category", "response">, Error, OperationProp<operations & Operations, "readCategoryList post /category", "response">, readonly ["category", "list", {
|
|
26
|
+
readonly body: unknown;
|
|
27
|
+
}]> & {
|
|
28
|
+
queryKey: readonly ["category", "list", {
|
|
29
|
+
readonly body: unknown;
|
|
30
|
+
}] & {
|
|
31
|
+
[dataTagSymbol]: OperationProp<operations & Operations, "readCategoryList post /category", "response">;
|
|
32
|
+
[dataTagErrorSymbol]: Error;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
useContextOptions: () => UndefinedInitialQueryOptions<OperationProp<operations & Operations, "readContext get /context", "response">, Error, OperationProp<operations & Operations, "readContext get /context", "response">, readonly ["context"]> & {
|
|
36
|
+
queryKey: readonly ["context"] & {
|
|
37
|
+
[dataTagSymbol]: OperationProp<operations & Operations, "readContext get /context", "response">;
|
|
38
|
+
[dataTagErrorSymbol]: Error;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
useContextUpdate: () => UseMutationReturnType<OperationProp<operations & Operations, "updateContext patch /context", "response">, Error, void, unknown, Omit< MutationObserverIdleResult<OperationProp<operations & Operations, "updateContext patch /context", "response">, Error, void, unknown>, "mutate" | "reset"> | Omit< MutationObserverLoadingResult<OperationProp<operations & Operations, "updateContext patch /context", "response">, Error, void, unknown>, "mutate" | "reset"> | Omit< MutationObserverErrorResult<OperationProp<operations & Operations, "updateContext patch /context", "response">, Error, void, unknown>, "mutate" | "reset"> | Omit< MutationObserverSuccessResult<OperationProp<operations & Operations, "updateContext patch /context", "response">, Error, void, unknown>, "mutate" | "reset">>;
|
|
42
|
+
useProductQueryOptions: (seoUrl: MaybeRef<string>, body?: MaybeRef<OperationProp<Operations, "readCustomProductDetail post /novu/headless/product/{seoUrl}", "body">> | undefined) => UndefinedInitialQueryOptions<OperationProp<operations & Operations, "readCustomProductDetail post /novu/headless/product/{seoUrl}", "response">, Error, OperationProp<operations & Operations, "readCustomProductDetail post /novu/headless/product/{seoUrl}", "response">, readonly ["product", "detail", {
|
|
43
|
+
readonly url: MaybeRef<string>;
|
|
44
|
+
readonly body: unknown;
|
|
45
|
+
}]> & {
|
|
46
|
+
queryKey: readonly ["product", "detail", {
|
|
47
|
+
readonly url: MaybeRef<string>;
|
|
48
|
+
readonly body: unknown;
|
|
49
|
+
}] & {
|
|
50
|
+
[dataTagSymbol]: OperationProp<operations & Operations, "readCustomProductDetail post /novu/headless/product/{seoUrl}", "response">;
|
|
51
|
+
[dataTagErrorSymbol]: Error;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
useProductVariantForOptions: (product: MaybeRef<Schemas["CustomProductDetailResponse"]["product"]>, optionIds: MaybeRef<string[]>) => ComputedRef<{
|
|
55
|
+
active?: boolean;
|
|
56
|
+
apiAlias: "product";
|
|
57
|
+
readonly available?: boolean;
|
|
58
|
+
readonly availableStock?: number;
|
|
59
|
+
calculatedCheapestPrice?: {
|
|
60
|
+
apiAlias?: "calculated_cheapest_price";
|
|
61
|
+
hasRange?: boolean;
|
|
62
|
+
listPrice?: components["schemas"]["ListPrice"] | null;
|
|
63
|
+
quantity?: number;
|
|
64
|
+
referencePrice?: components["schemas"]["ReferencePrice"] | null;
|
|
65
|
+
regulationPrice?: {
|
|
66
|
+
price: number;
|
|
67
|
+
} | null;
|
|
68
|
+
totalPrice?: number;
|
|
69
|
+
unitPrice?: number;
|
|
70
|
+
variantId?: string | null;
|
|
71
|
+
};
|
|
72
|
+
calculatedMaxPurchase?: number;
|
|
73
|
+
calculatedPrice: components["schemas"]["CalculatedPrice"];
|
|
74
|
+
calculatedPrices: components["schemas"]["CalculatedPrice"][];
|
|
75
|
+
canonicalProduct?: components["schemas"]["Product"];
|
|
76
|
+
canonicalProductId?: string;
|
|
77
|
+
canonicalProductVersionId?: string;
|
|
78
|
+
categories?: components["schemas"]["Category"][];
|
|
79
|
+
categoriesRo?: components["schemas"]["Category"][];
|
|
80
|
+
readonly categoryIds?: string[];
|
|
81
|
+
readonly categoryTree?: string[];
|
|
82
|
+
readonly childCount?: number;
|
|
83
|
+
children?: components["schemas"]["Product"][];
|
|
84
|
+
cmsPage?: components["schemas"]["CmsPage"];
|
|
85
|
+
cmsPageId?: string;
|
|
86
|
+
cmsPageVersionId?: string;
|
|
87
|
+
configuratorSettings?: components["schemas"]["ProductConfiguratorSetting"][];
|
|
88
|
+
cover?: components["schemas"]["ProductMedia"];
|
|
89
|
+
coverId?: string;
|
|
90
|
+
readonly createdAt?: string;
|
|
91
|
+
crossSellings?: components["schemas"]["ProductCrossSelling"][];
|
|
92
|
+
customFields?: GenericRecord;
|
|
93
|
+
deliveryTime?: components["schemas"]["DeliveryTime"];
|
|
94
|
+
deliveryTimeId?: string;
|
|
95
|
+
description?: string;
|
|
96
|
+
readonly displayGroup?: string;
|
|
97
|
+
downloads?: components["schemas"]["ProductDownload"][];
|
|
98
|
+
ean?: string;
|
|
99
|
+
extensions?: {
|
|
100
|
+
novuSeoUrls?: GenericRecord;
|
|
101
|
+
variants?: GenericRecord;
|
|
102
|
+
};
|
|
103
|
+
height?: number;
|
|
104
|
+
id: string;
|
|
105
|
+
isCloseout?: boolean;
|
|
106
|
+
isNew?: boolean;
|
|
107
|
+
keywords?: string;
|
|
108
|
+
length?: number;
|
|
109
|
+
mainCategories?: components["schemas"]["MainCategory"][];
|
|
110
|
+
manufacturer?: components["schemas"]["ProductManufacturer"];
|
|
111
|
+
manufacturerId?: string;
|
|
112
|
+
manufacturerNumber?: string;
|
|
113
|
+
markAsTopseller?: boolean;
|
|
114
|
+
maxPurchase?: number;
|
|
115
|
+
media?: components["schemas"]["ProductMedia"][];
|
|
116
|
+
metaDescription?: string;
|
|
117
|
+
metaTitle?: string;
|
|
118
|
+
minPurchase?: number;
|
|
119
|
+
name: string;
|
|
120
|
+
readonly optionIds?: string[];
|
|
121
|
+
options?: components["schemas"]["PropertyGroupOption"][];
|
|
122
|
+
packUnit?: string;
|
|
123
|
+
packUnitPlural?: string;
|
|
124
|
+
parent?: components["schemas"]["Product"];
|
|
125
|
+
parentId?: string;
|
|
126
|
+
parentVersionId?: string;
|
|
127
|
+
productManufacturerVersionId?: string;
|
|
128
|
+
productMediaVersionId?: string;
|
|
129
|
+
productNumber: string;
|
|
130
|
+
productReviews?: components["schemas"]["ProductReview"][];
|
|
131
|
+
properties?: components["schemas"]["PropertyGroupOption"][];
|
|
132
|
+
readonly propertyIds?: string[];
|
|
133
|
+
purchaseSteps?: number;
|
|
134
|
+
purchaseUnit?: number;
|
|
135
|
+
readonly ratingAverage?: number;
|
|
136
|
+
referenceUnit?: number;
|
|
137
|
+
releaseDate?: string;
|
|
138
|
+
restockTime?: number;
|
|
139
|
+
readonly sales?: number;
|
|
140
|
+
seoCategory: components["schemas"]["Category"];
|
|
141
|
+
seoUrls?: components["schemas"]["SeoUrl"][];
|
|
142
|
+
shippingFree?: boolean;
|
|
143
|
+
sortedProperties?: GenericRecord;
|
|
144
|
+
readonly states?: string[];
|
|
145
|
+
stock: number;
|
|
146
|
+
readonly streamIds?: string[];
|
|
147
|
+
streams?: components["schemas"]["ProductStream"][];
|
|
148
|
+
readonly tagIds?: string[];
|
|
149
|
+
tags?: components["schemas"]["Tag"][];
|
|
150
|
+
tax?: components["schemas"]["Tax"];
|
|
151
|
+
taxId: string;
|
|
152
|
+
translated: {
|
|
153
|
+
canonicalProductId: string;
|
|
154
|
+
canonicalProductVersionId: string;
|
|
155
|
+
cmsPageId: string;
|
|
156
|
+
cmsPageVersionId: string;
|
|
157
|
+
coverId: string;
|
|
158
|
+
deliveryTimeId: string;
|
|
159
|
+
description: string;
|
|
160
|
+
displayGroup: string;
|
|
161
|
+
ean: string;
|
|
162
|
+
keywords: string;
|
|
163
|
+
manufacturerId: string;
|
|
164
|
+
manufacturerNumber: string;
|
|
165
|
+
metaDescription: string;
|
|
166
|
+
metaTitle: string;
|
|
167
|
+
name: string;
|
|
168
|
+
packUnit: string;
|
|
169
|
+
packUnitPlural: string;
|
|
170
|
+
parentId: string;
|
|
171
|
+
parentVersionId: string;
|
|
172
|
+
productManufacturerVersionId: string;
|
|
173
|
+
productMediaVersionId: string;
|
|
174
|
+
productNumber: string;
|
|
175
|
+
releaseDate: string;
|
|
176
|
+
taxId: string;
|
|
177
|
+
unitId: string;
|
|
178
|
+
versionId: string;
|
|
179
|
+
};
|
|
180
|
+
unit?: components["schemas"]["Unit"];
|
|
181
|
+
unitId?: string;
|
|
182
|
+
readonly updatedAt?: string;
|
|
183
|
+
variantListingConfig?: {
|
|
184
|
+
displayParent?: boolean;
|
|
185
|
+
} | null;
|
|
186
|
+
versionId?: string;
|
|
187
|
+
weight?: number;
|
|
188
|
+
width?: number;
|
|
189
|
+
} | undefined>;
|
|
190
|
+
useCartQueryOptions: () => UndefinedInitialQueryOptions<OperationProp<operations & Operations, "readCart get /checkout/cart", "response">, Error, OperationProp<operations & Operations, "readCart get /checkout/cart", "response">, readonly ["cart"]> & {
|
|
191
|
+
queryKey: readonly ["cart"] & {
|
|
192
|
+
[dataTagSymbol]: OperationProp<operations & Operations, "readCart get /checkout/cart", "response">;
|
|
193
|
+
[dataTagErrorSymbol]: Error;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
useCartUpdateItemMutation: (mutationOptions?: MutationOptions<OperationProp<Operations, "updateLineItem patch /checkout/cart/line-item", "response">, unknown, Omit< OperationProp<Operations, "updateLineItem patch /checkout/cart/line-item", "body">, "items"> & {
|
|
197
|
+
items: (Partial<Omit< OperationProp<Operations, "updateLineItem patch /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">> & Required<Pick< OperationProp<Operations, "updateLineItem patch /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">>)[];
|
|
198
|
+
}, unknown> | undefined) => UseMutationReturnType<OperationProp<operations & Operations, "updateLineItem patch /checkout/cart/line-item", "response">, unknown, Omit< OperationProp<Operations, "updateLineItem patch /checkout/cart/line-item", "body">, "items"> & {
|
|
199
|
+
items: (Partial<Omit< OperationProp<Operations, "updateLineItem patch /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">> & Required<Pick< OperationProp<Operations, "updateLineItem patch /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">>)[];
|
|
200
|
+
}, unknown, Omit< MutationObserverIdleResult<OperationProp<operations & Operations, "updateLineItem patch /checkout/cart/line-item", "response">, unknown, Omit< OperationProp<Operations, "updateLineItem patch /checkout/cart/line-item", "body">, "items"> & {
|
|
201
|
+
items: (Partial<Omit< OperationProp<Operations, "updateLineItem patch /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">> & Required<Pick< OperationProp<Operations, "updateLineItem patch /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">>)[];
|
|
202
|
+
}, unknown>, "mutate" | "reset"> | Omit< MutationObserverLoadingResult<OperationProp<operations & Operations, "updateLineItem patch /checkout/cart/line-item", "response">, unknown, Omit< OperationProp<Operations, "updateLineItem patch /checkout/cart/line-item", "body">, "items"> & {
|
|
203
|
+
items: (Partial<Omit< OperationProp<Operations, "updateLineItem patch /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">> & Required<Pick< OperationProp<Operations, "updateLineItem patch /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">>)[];
|
|
204
|
+
}, unknown>, "mutate" | "reset"> | Omit< MutationObserverErrorResult<OperationProp<operations & Operations, "updateLineItem patch /checkout/cart/line-item", "response">, unknown, Omit< OperationProp<Operations, "updateLineItem patch /checkout/cart/line-item", "body">, "items"> & {
|
|
205
|
+
items: (Partial<Omit< OperationProp<Operations, "updateLineItem patch /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">> & Required<Pick< OperationProp<Operations, "updateLineItem patch /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">>)[];
|
|
206
|
+
}, unknown>, "mutate" | "reset"> | Omit< MutationObserverSuccessResult<OperationProp<operations & Operations, "updateLineItem patch /checkout/cart/line-item", "response">, unknown, Omit< OperationProp<Operations, "updateLineItem patch /checkout/cart/line-item", "body">, "items"> & {
|
|
207
|
+
items: (Partial<Omit< OperationProp<Operations, "updateLineItem patch /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">> & Required<Pick< OperationProp<Operations, "updateLineItem patch /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">>)[];
|
|
208
|
+
}, unknown>, "mutate" | "reset">>;
|
|
209
|
+
useCartRemoveItemMutation: (mutationOptions?: MutationOptions<OperationProp<Operations, "removeLineItem post /checkout/cart/line-item/delete", "response">, unknown, OperationProp<Operations, "removeLineItem post /checkout/cart/line-item/delete", "body">, unknown> | undefined) => UseMutationReturnType<OperationProp<operations & Operations, "removeLineItem post /checkout/cart/line-item/delete", "response">, unknown, OperationProp<Operations, "removeLineItem post /checkout/cart/line-item/delete", "body">, unknown, Omit< MutationObserverIdleResult<OperationProp<operations & Operations, "removeLineItem post /checkout/cart/line-item/delete", "response">, unknown, OperationProp<Operations, "removeLineItem post /checkout/cart/line-item/delete", "body">, unknown>, "mutate" | "reset"> | Omit< MutationObserverLoadingResult<OperationProp<operations & Operations, "removeLineItem post /checkout/cart/line-item/delete", "response">, unknown, OperationProp<Operations, "removeLineItem post /checkout/cart/line-item/delete", "body">, unknown>, "mutate" | "reset"> | Omit< MutationObserverErrorResult<OperationProp<operations & Operations, "removeLineItem post /checkout/cart/line-item/delete", "response">, unknown, OperationProp<Operations, "removeLineItem post /checkout/cart/line-item/delete", "body">, unknown>, "mutate" | "reset"> | Omit< MutationObserverSuccessResult<OperationProp<operations & Operations, "removeLineItem post /checkout/cart/line-item/delete", "response">, unknown, OperationProp<Operations, "removeLineItem post /checkout/cart/line-item/delete", "body">, unknown>, "mutate" | "reset">>;
|
|
210
|
+
useCartAddItemMutation: (mutationOptions: MutationOptions<OperationProp<Operations, "addLineItem post /checkout/cart/line-item", "response">, unknown, Omit< OperationProp<Operations, "addLineItem post /checkout/cart/line-item", "body">, "items"> & {
|
|
211
|
+
items: (Partial<Omit< OperationProp<Operations, "addLineItem post /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">> & Required<Pick< OperationProp<Operations, "addLineItem post /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">>)[];
|
|
212
|
+
}, unknown>) => UseMutationReturnType<OperationProp<operations & Operations, "addLineItem post /checkout/cart/line-item", "response">, unknown, Omit< OperationProp<Operations, "addLineItem post /checkout/cart/line-item", "body">, "items"> & {
|
|
213
|
+
items: (Partial<Omit< OperationProp<Operations, "addLineItem post /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">> & Required<Pick< OperationProp<Operations, "addLineItem post /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">>)[];
|
|
214
|
+
}, unknown, Omit< MutationObserverIdleResult<OperationProp<operations & Operations, "addLineItem post /checkout/cart/line-item", "response">, unknown, Omit< OperationProp<Operations, "addLineItem post /checkout/cart/line-item", "body">, "items"> & {
|
|
215
|
+
items: (Partial<Omit< OperationProp<Operations, "addLineItem post /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">> & Required<Pick< OperationProp<Operations, "addLineItem post /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">>)[];
|
|
216
|
+
}, unknown>, "mutate" | "reset"> | Omit< MutationObserverLoadingResult<OperationProp<operations & Operations, "addLineItem post /checkout/cart/line-item", "response">, unknown, Omit< OperationProp<Operations, "addLineItem post /checkout/cart/line-item", "body">, "items"> & {
|
|
217
|
+
items: (Partial<Omit< OperationProp<Operations, "addLineItem post /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">> & Required<Pick< OperationProp<Operations, "addLineItem post /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">>)[];
|
|
218
|
+
}, unknown>, "mutate" | "reset"> | Omit< MutationObserverErrorResult<OperationProp<operations & Operations, "addLineItem post /checkout/cart/line-item", "response">, unknown, Omit< OperationProp<Operations, "addLineItem post /checkout/cart/line-item", "body">, "items"> & {
|
|
219
|
+
items: (Partial<Omit< OperationProp<Operations, "addLineItem post /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">> & Required<Pick< OperationProp<Operations, "addLineItem post /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">>)[];
|
|
220
|
+
}, unknown>, "mutate" | "reset"> | Omit< MutationObserverSuccessResult<OperationProp<operations & Operations, "addLineItem post /checkout/cart/line-item", "response">, unknown, Omit< OperationProp<Operations, "addLineItem post /checkout/cart/line-item", "body">, "items"> & {
|
|
221
|
+
items: (Partial<Omit< OperationProp<Operations, "addLineItem post /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">> & Required<Pick< OperationProp<Operations, "addLineItem post /checkout/cart/line-item", "body">["items"][number], "id" | "quantity" | "type">>)[];
|
|
222
|
+
}, unknown>, "mutate" | "reset">>;
|
|
223
|
+
}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
var R = Object.defineProperty;
|
|
2
|
+
var V = (e, t, r) => t in e ? R(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var g = (e, t, r) => V(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { useQueryClient as M, useMutation as h, queryOptions as v } from "@tanstack/vue-query";
|
|
5
|
+
import { inject as $, unref as l, computed as o, reactive as z, watch as K, toRef as b } from "vue";
|
|
6
|
+
const A = Symbol("shopwareClient");
|
|
7
|
+
function P() {
|
|
8
|
+
const e = $(A);
|
|
9
|
+
if (!e)
|
|
10
|
+
throw new Error("Shopware client not provided!");
|
|
11
|
+
return e;
|
|
12
|
+
}
|
|
13
|
+
const j = {
|
|
14
|
+
all: () => ["context"]
|
|
15
|
+
}, Q = {
|
|
16
|
+
all: () => ["category"],
|
|
17
|
+
lists: () => [...Q.all(), "list"],
|
|
18
|
+
list: (e) => [
|
|
19
|
+
...Q.all(),
|
|
20
|
+
"list",
|
|
21
|
+
{
|
|
22
|
+
body: e
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}, m = {
|
|
26
|
+
all: () => ["product"],
|
|
27
|
+
lists: () => [...m.all(), "list"],
|
|
28
|
+
list: (e, t) => [
|
|
29
|
+
...m.all(),
|
|
30
|
+
"list",
|
|
31
|
+
{
|
|
32
|
+
url: e,
|
|
33
|
+
body: t
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
details: () => [...m.all(), "detail"],
|
|
37
|
+
detail: (e, t) => [
|
|
38
|
+
...m.all(),
|
|
39
|
+
"detail",
|
|
40
|
+
{
|
|
41
|
+
url: e,
|
|
42
|
+
body: t
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}, q = {
|
|
46
|
+
get: () => ["cart"]
|
|
47
|
+
}, E = "addLineItem post /checkout/cart/line-item";
|
|
48
|
+
function O(e) {
|
|
49
|
+
const t = P(), r = M();
|
|
50
|
+
return h({
|
|
51
|
+
...e,
|
|
52
|
+
mutationFn: async (c) => t.query(E, {
|
|
53
|
+
body: c
|
|
54
|
+
}),
|
|
55
|
+
onSuccess: (c, n, u) => {
|
|
56
|
+
var a;
|
|
57
|
+
r.setQueryData(q.get(), c), (a = e.onSuccess) == null || a.call(e, c, n, u);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
const T = "readCart get /checkout/cart";
|
|
62
|
+
function W() {
|
|
63
|
+
const e = P(), t = q.get();
|
|
64
|
+
return v({
|
|
65
|
+
queryKey: t,
|
|
66
|
+
queryFn: async () => e.query(T)
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const B = "removeLineItem post /checkout/cart/line-item/delete";
|
|
70
|
+
function G(e) {
|
|
71
|
+
const t = P(), r = M();
|
|
72
|
+
return h({
|
|
73
|
+
...e,
|
|
74
|
+
mutationFn: async (c) => t.query(B, {
|
|
75
|
+
body: c
|
|
76
|
+
}),
|
|
77
|
+
onSuccess: (c, n, u) => {
|
|
78
|
+
var a;
|
|
79
|
+
r.setQueryData(q.get(), c), (a = e == null ? void 0 : e.onSuccess) == null || a.call(e, c, n, u);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
const H = "updateLineItem patch /checkout/cart/line-item";
|
|
84
|
+
function J(e) {
|
|
85
|
+
const t = P(), r = M();
|
|
86
|
+
return h({
|
|
87
|
+
...e,
|
|
88
|
+
mutationFn: async (c) => t.query(H, {
|
|
89
|
+
body: c
|
|
90
|
+
}),
|
|
91
|
+
onSuccess: (c, n, u) => {
|
|
92
|
+
var a;
|
|
93
|
+
r.setQueryData(q.get(), c), (a = e == null ? void 0 : e.onSuccess) == null || a.call(e, c, n, u);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
const N = "readContext get /context";
|
|
98
|
+
function X() {
|
|
99
|
+
const e = P();
|
|
100
|
+
return v({
|
|
101
|
+
queryKey: j.all(),
|
|
102
|
+
queryFn: () => e.query(N)
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
const Y = "updateContext patch /context";
|
|
106
|
+
function Z() {
|
|
107
|
+
const e = P();
|
|
108
|
+
return h({
|
|
109
|
+
mutationFn: async () => e.query(Y)
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
const D = "readCategoryList post /category";
|
|
113
|
+
function w(e) {
|
|
114
|
+
const t = P(), r = Q.list(e);
|
|
115
|
+
return v({
|
|
116
|
+
queryKey: r,
|
|
117
|
+
queryFn: async () => t.query(D, {
|
|
118
|
+
body: l(e)
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
const L = (e) => {
|
|
123
|
+
const t = e.replace(/\/?$/, "");
|
|
124
|
+
return t.startsWith("/") ? t.slice(1) : t;
|
|
125
|
+
}, ie = (e) => `/${L(e)}`, _ = "readCompactProductListing post /novu/headless/product-listing/{seoUrl}";
|
|
126
|
+
function ee(e, t) {
|
|
127
|
+
const r = P(), c = m.list(e, t);
|
|
128
|
+
return v({
|
|
129
|
+
queryKey: c,
|
|
130
|
+
queryFn: async () => r.query(_, {
|
|
131
|
+
params: { seoUrl: L(l(e)) },
|
|
132
|
+
body: l(t)
|
|
133
|
+
})
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
const te = "readCustomProductDetail post /novu/headless/product/{seoUrl}";
|
|
137
|
+
function re(e, t) {
|
|
138
|
+
const r = P(), c = m.detail(e, t);
|
|
139
|
+
return v({
|
|
140
|
+
queryKey: c,
|
|
141
|
+
queryFn: async () => r.query(te, {
|
|
142
|
+
params: { seoUrl: L(l(e)) },
|
|
143
|
+
body: l(t)
|
|
144
|
+
})
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function ne(e, t) {
|
|
148
|
+
var c;
|
|
149
|
+
const r = (c = e.extensions) == null ? void 0 : c.variants;
|
|
150
|
+
return t.length === 0 ? (r == null ? void 0 : r.find((n) => {
|
|
151
|
+
var u;
|
|
152
|
+
return ((u = n.optionIds) == null ? void 0 : u.length) === 0;
|
|
153
|
+
})) ?? (r == null ? void 0 : r[0]) : r == null ? void 0 : r.find((n) => {
|
|
154
|
+
var u;
|
|
155
|
+
return (u = n.optionIds) == null ? void 0 : u.every((a) => t.includes(a));
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
function ce(e, t) {
|
|
159
|
+
return o(() => ne(l(e), l(t)));
|
|
160
|
+
}
|
|
161
|
+
const se = (e, t) => {
|
|
162
|
+
var c;
|
|
163
|
+
const r = (c = e.extensions) == null ? void 0 : c.novuSeoUrls;
|
|
164
|
+
return (r == null ? void 0 : r[t]) ?? "";
|
|
165
|
+
}, le = (e, t) => o(() => se(l(e), l(t)));
|
|
166
|
+
function k(e) {
|
|
167
|
+
var r;
|
|
168
|
+
if (!e || !((r = e.calculatedPrices) != null && r.length))
|
|
169
|
+
return [];
|
|
170
|
+
const t = e.calculatedPrices.length;
|
|
171
|
+
return e.calculatedPrices.map(({ unitPrice: c, quantity: n }, u) => ({
|
|
172
|
+
label: u === t - 1 ? `from ${n}` : `to ${n}`,
|
|
173
|
+
quantity: n,
|
|
174
|
+
unitPrice: c
|
|
175
|
+
}));
|
|
176
|
+
}
|
|
177
|
+
function ye(e) {
|
|
178
|
+
const t = o(() => {
|
|
179
|
+
var s;
|
|
180
|
+
return (s = e.value) == null ? void 0 : s.calculatedCheapestPrice;
|
|
181
|
+
}), r = o(
|
|
182
|
+
() => {
|
|
183
|
+
var s, i, d, p, f;
|
|
184
|
+
return (((i = (s = e.value) == null ? void 0 : s.calculatedPrices) == null ? void 0 : i.length) ?? 0) > 0 ? (p = (d = e.value) == null ? void 0 : d.calculatedPrices) == null ? void 0 : p[0] : (f = e.value) == null ? void 0 : f.calculatedPrice;
|
|
185
|
+
}
|
|
186
|
+
), c = o(() => {
|
|
187
|
+
var s;
|
|
188
|
+
return (s = r == null ? void 0 : r.value) == null ? void 0 : s.referencePrice;
|
|
189
|
+
}), n = o(() => {
|
|
190
|
+
var s, i;
|
|
191
|
+
return (((i = (s = e.value) == null ? void 0 : s.calculatedPrices) == null ? void 0 : i.length) ?? 0) > 1;
|
|
192
|
+
}), u = o(
|
|
193
|
+
() => {
|
|
194
|
+
var s, i, d, p, f, U;
|
|
195
|
+
return !!((s = e.value) != null && s.parentId) && ((d = (i = e.value) == null ? void 0 : i.calculatedCheapestPrice) == null ? void 0 : d.hasRange) && ((p = r == null ? void 0 : r.value) == null ? void 0 : p.unitPrice) !== ((f = t == null ? void 0 : t.value) == null ? void 0 : f.unitPrice) && ((U = t == null ? void 0 : t.value) == null ? void 0 : U.unitPrice);
|
|
196
|
+
}
|
|
197
|
+
), a = o(
|
|
198
|
+
() => {
|
|
199
|
+
var s, i;
|
|
200
|
+
return n.value && k(e.value).length > 1 ? (i = (s = e.value) == null ? void 0 : s.calculatedPrices) == null ? void 0 : i.reduce((d, p) => p.unitPrice < d.unitPrice ? p : d) : r.value;
|
|
201
|
+
}
|
|
202
|
+
), x = o(
|
|
203
|
+
() => {
|
|
204
|
+
var s;
|
|
205
|
+
return (s = a.value) == null ? void 0 : s.unitPrice;
|
|
206
|
+
}
|
|
207
|
+
), F = o(
|
|
208
|
+
() => {
|
|
209
|
+
var s;
|
|
210
|
+
return (s = a.value) == null ? void 0 : s.totalPrice;
|
|
211
|
+
}
|
|
212
|
+
), S = o(
|
|
213
|
+
() => a.value
|
|
214
|
+
), I = o(() => {
|
|
215
|
+
var s, i;
|
|
216
|
+
return !!((i = (s = a.value) == null ? void 0 : s.listPrice) != null && i.percentage);
|
|
217
|
+
}), C = o(
|
|
218
|
+
() => {
|
|
219
|
+
var s, i, d;
|
|
220
|
+
return (d = (i = (s = e.value) == null ? void 0 : s.calculatedPrice) == null ? void 0 : i.regulationPrice) == null ? void 0 : d.price;
|
|
221
|
+
}
|
|
222
|
+
), y = o(() => k(e.value));
|
|
223
|
+
return {
|
|
224
|
+
price: S,
|
|
225
|
+
totalPrice: F,
|
|
226
|
+
unitPrice: x,
|
|
227
|
+
displayFromVariants: u,
|
|
228
|
+
displayFrom: n,
|
|
229
|
+
tierPrices: y,
|
|
230
|
+
referencePrice: c,
|
|
231
|
+
isListPrice: I,
|
|
232
|
+
regulationPrice: C
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
function de(e) {
|
|
236
|
+
const { total: t, limit: r, page: c } = e ?? {}, n = z({
|
|
237
|
+
page: c ?? 1,
|
|
238
|
+
total: t ?? 0,
|
|
239
|
+
limit: r
|
|
240
|
+
}), u = o(() => n.limit === void 0 ? 1 : Math.max(1, Math.ceil(n.total / n.limit))), a = o({
|
|
241
|
+
get() {
|
|
242
|
+
return n.page;
|
|
243
|
+
},
|
|
244
|
+
set(C) {
|
|
245
|
+
n.page = Math.max(1, Math.min(l(u), C));
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
K(
|
|
249
|
+
[() => l(u), () => n],
|
|
250
|
+
([C, y]) => {
|
|
251
|
+
n.page = Math.min(C, n.page), n.total = y.total ?? 0, n.limit = y.limit;
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
const x = o(() => n.page === l(u)), F = o(() => n.page === 1), S = o(() => ({
|
|
255
|
+
p: n.page,
|
|
256
|
+
limit: n.limit
|
|
257
|
+
})), I = (C) => {
|
|
258
|
+
K(() => l(C), (y) => {
|
|
259
|
+
n.total = (y == null ? void 0 : y.total) ?? 0, n.limit = (y == null ? void 0 : y.limit) ?? 0;
|
|
260
|
+
});
|
|
261
|
+
};
|
|
262
|
+
return {
|
|
263
|
+
page: l(a),
|
|
264
|
+
total: b(n, "total"),
|
|
265
|
+
limit: b(n, "limit"),
|
|
266
|
+
pageCount: u,
|
|
267
|
+
isLastPage: x,
|
|
268
|
+
isFirstPage: F,
|
|
269
|
+
usePaginationSync: I,
|
|
270
|
+
// This can be used to pass the pagination options directly to the query options
|
|
271
|
+
queryOptions: S
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
class ge {
|
|
275
|
+
constructor() {
|
|
276
|
+
g(this, "useProductListingQueryOptions", ee);
|
|
277
|
+
g(this, "useCategoryQueryOptions", w);
|
|
278
|
+
g(this, "useContextOptions", X);
|
|
279
|
+
g(this, "useContextUpdate", Z);
|
|
280
|
+
g(this, "useProductQueryOptions", re);
|
|
281
|
+
g(this, "useProductVariantForOptions", ce);
|
|
282
|
+
g(this, "useCartQueryOptions", W);
|
|
283
|
+
g(this, "useCartUpdateItemMutation", J);
|
|
284
|
+
g(this, "useCartRemoveItemMutation", G);
|
|
285
|
+
g(this, "useCartAddItemMutation", O);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
export {
|
|
289
|
+
ie as absolutizeSeoUrl,
|
|
290
|
+
q as cartKeys,
|
|
291
|
+
Q as categoryKeys,
|
|
292
|
+
j as contextKeys,
|
|
293
|
+
ge as default,
|
|
294
|
+
ne as getProductVariantForOptions,
|
|
295
|
+
se as getSeoUrl,
|
|
296
|
+
m as productKeys,
|
|
297
|
+
L as relativizeSeoUrl,
|
|
298
|
+
A as shopwareClientKey,
|
|
299
|
+
de as usePagination,
|
|
300
|
+
ye as useProductPrice,
|
|
301
|
+
ce as useProductVariantForOptions,
|
|
302
|
+
le as useSeoUrl,
|
|
303
|
+
P as useShopwareQueryClient
|
|
304
|
+
};
|
package/dist/inject.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { operations } from '../api-types/storeApiTypes.d.ts';
|
|
2
|
+
import { ShopwareClient } from '@teamnovu/kit-shopware-api-client';
|
|
3
|
+
import { InjectionKey } from 'vue';
|
|
4
|
+
export declare const shopwareClientKey: InjectionKey<ShopwareClient<never>>;
|
|
5
|
+
export declare function useShopwareQueryClient<Operations>(): ShopwareClient<operations & Operations>;
|