@teamnovu/kit-shopware-composables 0.0.1 → 0.0.2
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/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 +190 -0
- package/dist/index.mjs +247 -0
- package/dist/inject.d.ts +5 -0
- package/dist/keys.d.ts +24 -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 +48 -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
|
@@ -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,190 @@
|
|
|
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 } 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
|
+
}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
var M = Object.defineProperty;
|
|
2
|
+
var b = (t, e, n) => e in t ? M(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var y = (t, e, n) => b(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { queryOptions as h, useMutation as V } from "@tanstack/vue-query";
|
|
5
|
+
import { inject as $, unref as a, computed as o, reactive as z, watch as K, toRef as L } from "vue";
|
|
6
|
+
const I = Symbol("shopwareClient");
|
|
7
|
+
function v() {
|
|
8
|
+
const t = $(I);
|
|
9
|
+
if (!t)
|
|
10
|
+
throw new Error("Shopware client not provided!");
|
|
11
|
+
return t;
|
|
12
|
+
}
|
|
13
|
+
const R = {
|
|
14
|
+
all: () => ["context"]
|
|
15
|
+
}, F = {
|
|
16
|
+
all: () => ["category"],
|
|
17
|
+
lists: () => [...F.all(), "list"],
|
|
18
|
+
list: (t) => [
|
|
19
|
+
...F.all(),
|
|
20
|
+
"list",
|
|
21
|
+
{
|
|
22
|
+
body: t
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}, m = {
|
|
26
|
+
all: () => ["product"],
|
|
27
|
+
lists: () => [...m.all(), "list"],
|
|
28
|
+
list: (t, e) => [
|
|
29
|
+
...m.all(),
|
|
30
|
+
"list",
|
|
31
|
+
{
|
|
32
|
+
url: t,
|
|
33
|
+
body: e
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
details: () => [...m.all(), "detail"],
|
|
37
|
+
detail: (t, e) => [
|
|
38
|
+
...m.all(),
|
|
39
|
+
"detail",
|
|
40
|
+
{
|
|
41
|
+
url: t,
|
|
42
|
+
body: e
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}, j = "readContext get /context";
|
|
46
|
+
function E() {
|
|
47
|
+
const t = v();
|
|
48
|
+
return h({
|
|
49
|
+
queryKey: R.all(),
|
|
50
|
+
queryFn: () => t.query(j)
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
const T = "updateContext patch /context";
|
|
54
|
+
function W() {
|
|
55
|
+
const t = v();
|
|
56
|
+
return V({
|
|
57
|
+
mutationFn: async () => t.query(T)
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const k = "readCategoryList post /category";
|
|
61
|
+
function A(t) {
|
|
62
|
+
const e = v(), n = F.list(t);
|
|
63
|
+
return h({
|
|
64
|
+
queryKey: n,
|
|
65
|
+
queryFn: async () => e.query(k, {
|
|
66
|
+
body: a(t)
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
const S = (t) => {
|
|
71
|
+
const e = t.replace(/\/?$/, "");
|
|
72
|
+
return e.startsWith("/") ? e.slice(1) : e;
|
|
73
|
+
}, D = (t) => `/${S(t)}`, B = "readCompactProductListing post /novu/headless/product-listing/{seoUrl}";
|
|
74
|
+
function G(t, e) {
|
|
75
|
+
const n = v(), c = m.list(t, e);
|
|
76
|
+
return h({
|
|
77
|
+
queryKey: c,
|
|
78
|
+
queryFn: async () => n.query(B, {
|
|
79
|
+
params: { seoUrl: S(a(t)) },
|
|
80
|
+
body: a(e)
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
const H = "readCustomProductDetail post /novu/headless/product/{seoUrl}";
|
|
85
|
+
function J(t, e) {
|
|
86
|
+
const n = v(), c = m.detail(t, e);
|
|
87
|
+
return h({
|
|
88
|
+
queryKey: c,
|
|
89
|
+
queryFn: async () => n.query(H, {
|
|
90
|
+
params: { seoUrl: S(a(t)) },
|
|
91
|
+
body: a(e)
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function N(t, e) {
|
|
96
|
+
var c;
|
|
97
|
+
const n = (c = t.extensions) == null ? void 0 : c.variants;
|
|
98
|
+
return e.length === 0 ? (n == null ? void 0 : n.find((r) => {
|
|
99
|
+
var l;
|
|
100
|
+
return ((l = r.optionIds) == null ? void 0 : l.length) === 0;
|
|
101
|
+
})) ?? (n == null ? void 0 : n[0]) : n == null ? void 0 : n.find((r) => {
|
|
102
|
+
var l;
|
|
103
|
+
return (l = r.optionIds) == null ? void 0 : l.every((d) => e.includes(d));
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function X(t, e) {
|
|
107
|
+
return o(() => N(a(t), a(e)));
|
|
108
|
+
}
|
|
109
|
+
const Y = (t, e) => {
|
|
110
|
+
var c;
|
|
111
|
+
const n = (c = t.extensions) == null ? void 0 : c.novuSeoUrls;
|
|
112
|
+
return (n == null ? void 0 : n[e]) ?? "";
|
|
113
|
+
}, tt = (t, e) => o(() => Y(a(t), a(e)));
|
|
114
|
+
function Q(t) {
|
|
115
|
+
var n;
|
|
116
|
+
if (!t || !((n = t.calculatedPrices) != null && n.length))
|
|
117
|
+
return [];
|
|
118
|
+
const e = t.calculatedPrices.length;
|
|
119
|
+
return t.calculatedPrices.map(({ unitPrice: c, quantity: r }, l) => ({
|
|
120
|
+
label: l === e - 1 ? `from ${r}` : `to ${r}`,
|
|
121
|
+
quantity: r,
|
|
122
|
+
unitPrice: c
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
function et(t) {
|
|
126
|
+
const e = o(() => {
|
|
127
|
+
var i;
|
|
128
|
+
return (i = t.value) == null ? void 0 : i.calculatedCheapestPrice;
|
|
129
|
+
}), n = o(
|
|
130
|
+
() => {
|
|
131
|
+
var i, s, p, P, f;
|
|
132
|
+
return (((s = (i = t.value) == null ? void 0 : i.calculatedPrices) == null ? void 0 : s.length) ?? 0) > 0 ? (P = (p = t.value) == null ? void 0 : p.calculatedPrices) == null ? void 0 : P[0] : (f = t.value) == null ? void 0 : f.calculatedPrice;
|
|
133
|
+
}
|
|
134
|
+
), c = o(() => {
|
|
135
|
+
var i;
|
|
136
|
+
return (i = n == null ? void 0 : n.value) == null ? void 0 : i.referencePrice;
|
|
137
|
+
}), r = o(() => {
|
|
138
|
+
var i, s;
|
|
139
|
+
return (((s = (i = t.value) == null ? void 0 : i.calculatedPrices) == null ? void 0 : s.length) ?? 0) > 1;
|
|
140
|
+
}), l = o(
|
|
141
|
+
() => {
|
|
142
|
+
var i, s, p, P, f, U;
|
|
143
|
+
return !!((i = t.value) != null && i.parentId) && ((p = (s = t.value) == null ? void 0 : s.calculatedCheapestPrice) == null ? void 0 : p.hasRange) && ((P = n == null ? void 0 : n.value) == null ? void 0 : P.unitPrice) !== ((f = e == null ? void 0 : e.value) == null ? void 0 : f.unitPrice) && ((U = e == null ? void 0 : e.value) == null ? void 0 : U.unitPrice);
|
|
144
|
+
}
|
|
145
|
+
), d = o(
|
|
146
|
+
() => {
|
|
147
|
+
var i, s;
|
|
148
|
+
return r.value && Q(t.value).length > 1 ? (s = (i = t.value) == null ? void 0 : i.calculatedPrices) == null ? void 0 : s.reduce((p, P) => P.unitPrice < p.unitPrice ? P : p) : n.value;
|
|
149
|
+
}
|
|
150
|
+
), C = o(
|
|
151
|
+
() => {
|
|
152
|
+
var i;
|
|
153
|
+
return (i = d.value) == null ? void 0 : i.unitPrice;
|
|
154
|
+
}
|
|
155
|
+
), O = o(
|
|
156
|
+
() => {
|
|
157
|
+
var i;
|
|
158
|
+
return (i = d.value) == null ? void 0 : i.totalPrice;
|
|
159
|
+
}
|
|
160
|
+
), x = o(
|
|
161
|
+
() => d.value
|
|
162
|
+
), q = o(() => {
|
|
163
|
+
var i, s;
|
|
164
|
+
return !!((s = (i = d.value) == null ? void 0 : i.listPrice) != null && s.percentage);
|
|
165
|
+
}), g = o(
|
|
166
|
+
() => {
|
|
167
|
+
var i, s, p;
|
|
168
|
+
return (p = (s = (i = t.value) == null ? void 0 : i.calculatedPrice) == null ? void 0 : s.regulationPrice) == null ? void 0 : p.price;
|
|
169
|
+
}
|
|
170
|
+
), u = o(() => Q(t.value));
|
|
171
|
+
return {
|
|
172
|
+
price: x,
|
|
173
|
+
totalPrice: O,
|
|
174
|
+
unitPrice: C,
|
|
175
|
+
displayFromVariants: l,
|
|
176
|
+
displayFrom: r,
|
|
177
|
+
tierPrices: u,
|
|
178
|
+
referencePrice: c,
|
|
179
|
+
isListPrice: q,
|
|
180
|
+
regulationPrice: g
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
function nt(t) {
|
|
184
|
+
const { total: e, limit: n, page: c } = t ?? {}, r = z({
|
|
185
|
+
page: c ?? 1,
|
|
186
|
+
total: e ?? 0,
|
|
187
|
+
limit: n
|
|
188
|
+
}), l = o(() => r.limit === void 0 ? 1 : Math.max(1, Math.ceil(r.total / r.limit))), d = o({
|
|
189
|
+
get() {
|
|
190
|
+
return r.page;
|
|
191
|
+
},
|
|
192
|
+
set(g) {
|
|
193
|
+
r.page = Math.max(1, Math.min(a(l), g));
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
K(
|
|
197
|
+
[() => a(l), () => r],
|
|
198
|
+
([g, u]) => {
|
|
199
|
+
r.page = Math.min(g, r.page), r.total = u.total ?? 0, r.limit = u.limit;
|
|
200
|
+
}
|
|
201
|
+
);
|
|
202
|
+
const C = o(() => r.page === a(l)), O = o(() => r.page === 1), x = o(() => ({
|
|
203
|
+
p: r.page,
|
|
204
|
+
limit: r.limit
|
|
205
|
+
})), q = (g) => {
|
|
206
|
+
K(() => a(g), (u) => {
|
|
207
|
+
r.total = (u == null ? void 0 : u.total) ?? 0, r.limit = (u == null ? void 0 : u.limit) ?? 0;
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
return {
|
|
211
|
+
page: a(d),
|
|
212
|
+
total: L(r, "total"),
|
|
213
|
+
limit: L(r, "limit"),
|
|
214
|
+
pageCount: l,
|
|
215
|
+
isLastPage: C,
|
|
216
|
+
isFirstPage: O,
|
|
217
|
+
usePaginationSync: q,
|
|
218
|
+
// This can be used to pass the pagination options directly to the query options
|
|
219
|
+
queryOptions: x
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
class rt {
|
|
223
|
+
constructor() {
|
|
224
|
+
y(this, "useProductListingQueryOptions", G);
|
|
225
|
+
y(this, "useCategoryQueryOptions", A);
|
|
226
|
+
y(this, "useContextOptions", E);
|
|
227
|
+
y(this, "useContextUpdate", W);
|
|
228
|
+
y(this, "useProductQueryOptions", J);
|
|
229
|
+
y(this, "useProductVariantForOptions", X);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
export {
|
|
233
|
+
D as absolutizeSeoUrl,
|
|
234
|
+
F as categoryKeys,
|
|
235
|
+
R as contextKeys,
|
|
236
|
+
rt as default,
|
|
237
|
+
N as getProductVariantForOptions,
|
|
238
|
+
Y as getSeoUrl,
|
|
239
|
+
m as productKeys,
|
|
240
|
+
S as relativizeSeoUrl,
|
|
241
|
+
I as shopwareClientKey,
|
|
242
|
+
nt as usePagination,
|
|
243
|
+
et as useProductPrice,
|
|
244
|
+
X as useProductVariantForOptions,
|
|
245
|
+
tt as useSeoUrl,
|
|
246
|
+
v as useShopwareQueryClient
|
|
247
|
+
};
|
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>;
|
package/dist/keys.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { MaybeRef } from 'vue';
|
|
2
|
+
export declare const contextKeys: {
|
|
3
|
+
all: () => readonly ["context"];
|
|
4
|
+
};
|
|
5
|
+
export declare const categoryKeys: {
|
|
6
|
+
all: () => readonly ["category"];
|
|
7
|
+
lists: () => readonly ["category", "list"];
|
|
8
|
+
list: (body: MaybeRef<unknown>) => readonly ["category", "list", {
|
|
9
|
+
readonly body: unknown;
|
|
10
|
+
}];
|
|
11
|
+
};
|
|
12
|
+
export declare const productKeys: {
|
|
13
|
+
all: () => readonly ["product"];
|
|
14
|
+
lists: () => readonly ["product", "list"];
|
|
15
|
+
list: (url: MaybeRef<string>, body: MaybeRef<unknown>) => readonly ["product", "list", {
|
|
16
|
+
readonly url: MaybeRef<string>;
|
|
17
|
+
readonly body: unknown;
|
|
18
|
+
}];
|
|
19
|
+
details: () => readonly ["product", "detail"];
|
|
20
|
+
detail: (url: MaybeRef<string>, body: MaybeRef<unknown>) => readonly ["product", "detail", {
|
|
21
|
+
readonly url: MaybeRef<string>;
|
|
22
|
+
readonly body: unknown;
|
|
23
|
+
}];
|
|
24
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { operations } from '../../api-types/storeApiTypes.d.ts';
|
|
2
|
+
import { MaybeRef } from 'vue';
|
|
3
|
+
import { OperationBody } from '../types/query';
|
|
4
|
+
import { UndefinedInitialQueryOptions } from '@tanstack/vue-query';
|
|
5
|
+
import { OperationProp } from '@teamnovu/kit-shopware-api-client';
|
|
6
|
+
declare const readCategoryListOperation = "readCategoryList post /category";
|
|
7
|
+
export declare function useCategoryQueryOptions<Operations extends operations>(body?: MaybeRef<OperationBody<Operations, typeof readCategoryListOperation>>): UndefinedInitialQueryOptions<OperationProp<operations & Operations, "readCategoryList post /category", "response">, Error, OperationProp<operations & Operations, "readCategoryList post /category", "response">, readonly ["category", "list", {
|
|
8
|
+
readonly body: unknown;
|
|
9
|
+
}]> & {
|
|
10
|
+
queryKey: readonly ["category", "list", {
|
|
11
|
+
readonly body: unknown;
|
|
12
|
+
}] & {
|
|
13
|
+
[dataTagSymbol]: OperationProp<operations & Operations, "readCategoryList post /category", "response">;
|
|
14
|
+
[dataTagErrorSymbol]: Error;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { operations } from '../../api-types/storeApiTypes.d.ts';
|
|
2
|
+
import { MaybeRef } from 'vue';
|
|
3
|
+
import { OperationBody } from '../types/query';
|
|
4
|
+
import { UndefinedInitialQueryOptions } from '@tanstack/vue-query';
|
|
5
|
+
import { OperationProp } from '@teamnovu/kit-shopware-api-client';
|
|
6
|
+
declare const readListingOperation = "readCompactProductListing post /novu/headless/product-listing/{seoUrl}";
|
|
7
|
+
export declare function useProductListingQueryOptions<Operations extends operations>(seoUrl: MaybeRef<string>, body?: MaybeRef<OperationBody<Operations, typeof readListingOperation>>): 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", {
|
|
8
|
+
readonly url: MaybeRef<string>;
|
|
9
|
+
readonly body: unknown;
|
|
10
|
+
}]> & {
|
|
11
|
+
queryKey: readonly ["product", "list", {
|
|
12
|
+
readonly url: MaybeRef<string>;
|
|
13
|
+
readonly body: unknown;
|
|
14
|
+
}] & {
|
|
15
|
+
[dataTagSymbol]: OperationProp<operations & Operations, "readCompactProductListing post /novu/headless/product-listing/{seoUrl}", "response">;
|
|
16
|
+
[dataTagErrorSymbol]: Error;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Schemas } from '../../api-types/storeApiTypes.d.ts';
|
|
2
|
+
import { TierPrice } from '@shopware/helpers';
|
|
3
|
+
import { ComputedRef, Ref } from 'vue';
|
|
4
|
+
export type UseProductPriceReturn = {
|
|
5
|
+
/**
|
|
6
|
+
* Whole calculated price object
|
|
7
|
+
*/
|
|
8
|
+
price: ComputedRef<Schemas['CalculatedPrice'] | undefined>;
|
|
9
|
+
/**
|
|
10
|
+
* Calculated price value for one selling unit
|
|
11
|
+
*/
|
|
12
|
+
totalPrice: ComputedRef<number | undefined>;
|
|
13
|
+
/**
|
|
14
|
+
* Current unit price value
|
|
15
|
+
*/
|
|
16
|
+
unitPrice: ComputedRef<number | undefined>;
|
|
17
|
+
/**
|
|
18
|
+
* Can be used if isListPrice is set to true
|
|
19
|
+
*/
|
|
20
|
+
referencePrice: ComputedRef<Schemas['CalculatedPrice']['referencePrice'] | undefined>;
|
|
21
|
+
/**
|
|
22
|
+
* determines if `price` contains the minimum tier price
|
|
23
|
+
*/
|
|
24
|
+
displayFrom: ComputedRef<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* cheapest price value for a variant if exists
|
|
27
|
+
*/
|
|
28
|
+
displayFromVariants: ComputedRef<number | false | undefined>;
|
|
29
|
+
/**
|
|
30
|
+
* array of TierPrice object
|
|
31
|
+
*/
|
|
32
|
+
tierPrices: ComputedRef<TierPrice[]>;
|
|
33
|
+
/**
|
|
34
|
+
* determines whether a discount price is set
|
|
35
|
+
*/
|
|
36
|
+
isListPrice: ComputedRef<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* price for products with regulation price
|
|
39
|
+
*/
|
|
40
|
+
regulationPrice: ComputedRef<number | undefined>;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* The purpose of the `useProductPrice` function is to abstract the logic to expose most useful helpers for price displaying.
|
|
44
|
+
*
|
|
45
|
+
* @public
|
|
46
|
+
* @category Product
|
|
47
|
+
*/
|
|
48
|
+
export declare function useProductPrice(product: Ref<Schemas['Product'] | undefined>): UseProductPriceReturn;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { operations } from '../../api-types/storeApiTypes.d.ts';
|
|
2
|
+
import { MaybeRef } from 'vue';
|
|
3
|
+
import { OperationBody } from '../types/query';
|
|
4
|
+
import { UndefinedInitialQueryOptions } from '@tanstack/vue-query';
|
|
5
|
+
import { OperationProp } from '@teamnovu/kit-shopware-api-client';
|
|
6
|
+
declare const readCustomProductDetailOperation = "readCustomProductDetail post /novu/headless/product/{seoUrl}";
|
|
7
|
+
export declare function useProductQueryOptions<Operations extends operations>(seoUrl: MaybeRef<string>, body?: MaybeRef<OperationBody<Operations, typeof readCustomProductDetailOperation>>): 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", {
|
|
8
|
+
readonly url: MaybeRef<string>;
|
|
9
|
+
readonly body: unknown;
|
|
10
|
+
}]> & {
|
|
11
|
+
queryKey: readonly ["product", "detail", {
|
|
12
|
+
readonly url: MaybeRef<string>;
|
|
13
|
+
readonly body: unknown;
|
|
14
|
+
}] & {
|
|
15
|
+
[dataTagSymbol]: OperationProp<operations & Operations, "readCustomProductDetail post /novu/headless/product/{seoUrl}", "response">;
|
|
16
|
+
[dataTagErrorSymbol]: Error;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { Schemas, components, GenericRecord } from '../../api-types/storeApiTypes.d.ts';
|
|
2
|
+
import { MaybeRef, ComputedRef } from 'vue';
|
|
3
|
+
type DetailProduct<S extends Schemas> = S['CustomProductDetailResponse']['product'];
|
|
4
|
+
export declare function getProductVariantForOptions<S extends Schemas>(product: DetailProduct<S>, optionIds: string[]): {
|
|
5
|
+
active?: boolean;
|
|
6
|
+
apiAlias: "product";
|
|
7
|
+
readonly available?: boolean;
|
|
8
|
+
readonly availableStock?: number;
|
|
9
|
+
calculatedCheapestPrice?: {
|
|
10
|
+
apiAlias?: "calculated_cheapest_price";
|
|
11
|
+
hasRange?: boolean;
|
|
12
|
+
listPrice?: components["schemas"]["ListPrice"] | null;
|
|
13
|
+
quantity?: number;
|
|
14
|
+
referencePrice?: components["schemas"]["ReferencePrice"] | null;
|
|
15
|
+
regulationPrice?: {
|
|
16
|
+
price: number;
|
|
17
|
+
} | null;
|
|
18
|
+
totalPrice?: number;
|
|
19
|
+
unitPrice?: number;
|
|
20
|
+
variantId?: string | null;
|
|
21
|
+
};
|
|
22
|
+
calculatedMaxPurchase?: number;
|
|
23
|
+
calculatedPrice: components["schemas"]["CalculatedPrice"];
|
|
24
|
+
calculatedPrices: components["schemas"]["CalculatedPrice"][];
|
|
25
|
+
canonicalProduct?: components["schemas"]["Product"];
|
|
26
|
+
canonicalProductId?: string;
|
|
27
|
+
canonicalProductVersionId?: string;
|
|
28
|
+
categories?: components["schemas"]["Category"][];
|
|
29
|
+
categoriesRo?: components["schemas"]["Category"][];
|
|
30
|
+
readonly categoryIds?: string[];
|
|
31
|
+
readonly categoryTree?: string[];
|
|
32
|
+
readonly childCount?: number;
|
|
33
|
+
children?: components["schemas"]["Product"][];
|
|
34
|
+
cmsPage?: components["schemas"]["CmsPage"];
|
|
35
|
+
cmsPageId?: string;
|
|
36
|
+
cmsPageVersionId?: string;
|
|
37
|
+
configuratorSettings?: components["schemas"]["ProductConfiguratorSetting"][];
|
|
38
|
+
cover?: components["schemas"]["ProductMedia"];
|
|
39
|
+
coverId?: string;
|
|
40
|
+
readonly createdAt?: string;
|
|
41
|
+
crossSellings?: components["schemas"]["ProductCrossSelling"][];
|
|
42
|
+
customFields?: GenericRecord;
|
|
43
|
+
deliveryTime?: components["schemas"]["DeliveryTime"];
|
|
44
|
+
deliveryTimeId?: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
readonly displayGroup?: string;
|
|
47
|
+
downloads?: components["schemas"]["ProductDownload"][];
|
|
48
|
+
ean?: string;
|
|
49
|
+
extensions?: {
|
|
50
|
+
novuSeoUrls?: GenericRecord;
|
|
51
|
+
variants?: GenericRecord;
|
|
52
|
+
};
|
|
53
|
+
height?: number;
|
|
54
|
+
id: string;
|
|
55
|
+
isCloseout?: boolean;
|
|
56
|
+
isNew?: boolean;
|
|
57
|
+
keywords?: string;
|
|
58
|
+
length?: number;
|
|
59
|
+
mainCategories?: components["schemas"]["MainCategory"][];
|
|
60
|
+
manufacturer?: components["schemas"]["ProductManufacturer"];
|
|
61
|
+
manufacturerId?: string;
|
|
62
|
+
manufacturerNumber?: string;
|
|
63
|
+
markAsTopseller?: boolean;
|
|
64
|
+
maxPurchase?: number;
|
|
65
|
+
media?: components["schemas"]["ProductMedia"][];
|
|
66
|
+
metaDescription?: string;
|
|
67
|
+
metaTitle?: string;
|
|
68
|
+
minPurchase?: number;
|
|
69
|
+
name: string;
|
|
70
|
+
readonly optionIds?: string[];
|
|
71
|
+
options?: components["schemas"]["PropertyGroupOption"][];
|
|
72
|
+
packUnit?: string;
|
|
73
|
+
packUnitPlural?: string;
|
|
74
|
+
parent?: components["schemas"]["Product"];
|
|
75
|
+
parentId?: string;
|
|
76
|
+
parentVersionId?: string;
|
|
77
|
+
productManufacturerVersionId?: string;
|
|
78
|
+
productMediaVersionId?: string;
|
|
79
|
+
productNumber: string;
|
|
80
|
+
productReviews?: components["schemas"]["ProductReview"][];
|
|
81
|
+
properties?: components["schemas"]["PropertyGroupOption"][];
|
|
82
|
+
readonly propertyIds?: string[];
|
|
83
|
+
purchaseSteps?: number;
|
|
84
|
+
purchaseUnit?: number;
|
|
85
|
+
readonly ratingAverage?: number;
|
|
86
|
+
referenceUnit?: number;
|
|
87
|
+
releaseDate?: string;
|
|
88
|
+
restockTime?: number;
|
|
89
|
+
readonly sales?: number;
|
|
90
|
+
seoCategory: components["schemas"]["Category"];
|
|
91
|
+
seoUrls?: components["schemas"]["SeoUrl"][];
|
|
92
|
+
shippingFree?: boolean;
|
|
93
|
+
sortedProperties?: GenericRecord;
|
|
94
|
+
readonly states?: string[];
|
|
95
|
+
stock: number;
|
|
96
|
+
readonly streamIds?: string[];
|
|
97
|
+
streams?: components["schemas"]["ProductStream"][];
|
|
98
|
+
readonly tagIds?: string[];
|
|
99
|
+
tags?: components["schemas"]["Tag"][];
|
|
100
|
+
tax?: components["schemas"]["Tax"];
|
|
101
|
+
taxId: string;
|
|
102
|
+
translated: {
|
|
103
|
+
canonicalProductId: string;
|
|
104
|
+
canonicalProductVersionId: string;
|
|
105
|
+
cmsPageId: string;
|
|
106
|
+
cmsPageVersionId: string;
|
|
107
|
+
coverId: string;
|
|
108
|
+
deliveryTimeId: string;
|
|
109
|
+
description: string;
|
|
110
|
+
displayGroup: string;
|
|
111
|
+
ean: string;
|
|
112
|
+
keywords: string;
|
|
113
|
+
manufacturerId: string;
|
|
114
|
+
manufacturerNumber: string;
|
|
115
|
+
metaDescription: string;
|
|
116
|
+
metaTitle: string;
|
|
117
|
+
name: string;
|
|
118
|
+
packUnit: string;
|
|
119
|
+
packUnitPlural: string;
|
|
120
|
+
parentId: string;
|
|
121
|
+
parentVersionId: string;
|
|
122
|
+
productManufacturerVersionId: string;
|
|
123
|
+
productMediaVersionId: string;
|
|
124
|
+
productNumber: string;
|
|
125
|
+
releaseDate: string;
|
|
126
|
+
taxId: string;
|
|
127
|
+
unitId: string;
|
|
128
|
+
versionId: string;
|
|
129
|
+
};
|
|
130
|
+
unit?: components["schemas"]["Unit"];
|
|
131
|
+
unitId?: string;
|
|
132
|
+
readonly updatedAt?: string;
|
|
133
|
+
variantListingConfig?: {
|
|
134
|
+
displayParent?: boolean;
|
|
135
|
+
} | null;
|
|
136
|
+
versionId?: string;
|
|
137
|
+
weight?: number;
|
|
138
|
+
width?: number;
|
|
139
|
+
} | undefined;
|
|
140
|
+
export declare function useProductVariantForOptions<S extends Schemas>(product: MaybeRef<DetailProduct<S>>, optionIds: MaybeRef<string[]>): ComputedRef<{
|
|
141
|
+
active?: boolean;
|
|
142
|
+
apiAlias: "product";
|
|
143
|
+
readonly available?: boolean;
|
|
144
|
+
readonly availableStock?: number;
|
|
145
|
+
calculatedCheapestPrice?: {
|
|
146
|
+
apiAlias?: "calculated_cheapest_price";
|
|
147
|
+
hasRange?: boolean;
|
|
148
|
+
listPrice?: components["schemas"]["ListPrice"] | null;
|
|
149
|
+
quantity?: number;
|
|
150
|
+
referencePrice?: components["schemas"]["ReferencePrice"] | null;
|
|
151
|
+
regulationPrice?: {
|
|
152
|
+
price: number;
|
|
153
|
+
} | null;
|
|
154
|
+
totalPrice?: number;
|
|
155
|
+
unitPrice?: number;
|
|
156
|
+
variantId?: string | null;
|
|
157
|
+
};
|
|
158
|
+
calculatedMaxPurchase?: number;
|
|
159
|
+
calculatedPrice: components["schemas"]["CalculatedPrice"];
|
|
160
|
+
calculatedPrices: components["schemas"]["CalculatedPrice"][];
|
|
161
|
+
canonicalProduct?: components["schemas"]["Product"];
|
|
162
|
+
canonicalProductId?: string;
|
|
163
|
+
canonicalProductVersionId?: string;
|
|
164
|
+
categories?: components["schemas"]["Category"][];
|
|
165
|
+
categoriesRo?: components["schemas"]["Category"][];
|
|
166
|
+
readonly categoryIds?: string[];
|
|
167
|
+
readonly categoryTree?: string[];
|
|
168
|
+
readonly childCount?: number;
|
|
169
|
+
children?: components["schemas"]["Product"][];
|
|
170
|
+
cmsPage?: components["schemas"]["CmsPage"];
|
|
171
|
+
cmsPageId?: string;
|
|
172
|
+
cmsPageVersionId?: string;
|
|
173
|
+
configuratorSettings?: components["schemas"]["ProductConfiguratorSetting"][];
|
|
174
|
+
cover?: components["schemas"]["ProductMedia"];
|
|
175
|
+
coverId?: string;
|
|
176
|
+
readonly createdAt?: string;
|
|
177
|
+
crossSellings?: components["schemas"]["ProductCrossSelling"][];
|
|
178
|
+
customFields?: GenericRecord;
|
|
179
|
+
deliveryTime?: components["schemas"]["DeliveryTime"];
|
|
180
|
+
deliveryTimeId?: string;
|
|
181
|
+
description?: string;
|
|
182
|
+
readonly displayGroup?: string;
|
|
183
|
+
downloads?: components["schemas"]["ProductDownload"][];
|
|
184
|
+
ean?: string;
|
|
185
|
+
extensions?: {
|
|
186
|
+
novuSeoUrls?: GenericRecord;
|
|
187
|
+
variants?: GenericRecord;
|
|
188
|
+
};
|
|
189
|
+
height?: number;
|
|
190
|
+
id: string;
|
|
191
|
+
isCloseout?: boolean;
|
|
192
|
+
isNew?: boolean;
|
|
193
|
+
keywords?: string;
|
|
194
|
+
length?: number;
|
|
195
|
+
mainCategories?: components["schemas"]["MainCategory"][];
|
|
196
|
+
manufacturer?: components["schemas"]["ProductManufacturer"];
|
|
197
|
+
manufacturerId?: string;
|
|
198
|
+
manufacturerNumber?: string;
|
|
199
|
+
markAsTopseller?: boolean;
|
|
200
|
+
maxPurchase?: number;
|
|
201
|
+
media?: components["schemas"]["ProductMedia"][];
|
|
202
|
+
metaDescription?: string;
|
|
203
|
+
metaTitle?: string;
|
|
204
|
+
minPurchase?: number;
|
|
205
|
+
name: string;
|
|
206
|
+
readonly optionIds?: string[];
|
|
207
|
+
options?: components["schemas"]["PropertyGroupOption"][];
|
|
208
|
+
packUnit?: string;
|
|
209
|
+
packUnitPlural?: string;
|
|
210
|
+
parent?: components["schemas"]["Product"];
|
|
211
|
+
parentId?: string;
|
|
212
|
+
parentVersionId?: string;
|
|
213
|
+
productManufacturerVersionId?: string;
|
|
214
|
+
productMediaVersionId?: string;
|
|
215
|
+
productNumber: string;
|
|
216
|
+
productReviews?: components["schemas"]["ProductReview"][];
|
|
217
|
+
properties?: components["schemas"]["PropertyGroupOption"][];
|
|
218
|
+
readonly propertyIds?: string[];
|
|
219
|
+
purchaseSteps?: number;
|
|
220
|
+
purchaseUnit?: number;
|
|
221
|
+
readonly ratingAverage?: number;
|
|
222
|
+
referenceUnit?: number;
|
|
223
|
+
releaseDate?: string;
|
|
224
|
+
restockTime?: number;
|
|
225
|
+
readonly sales?: number;
|
|
226
|
+
seoCategory: components["schemas"]["Category"];
|
|
227
|
+
seoUrls?: components["schemas"]["SeoUrl"][];
|
|
228
|
+
shippingFree?: boolean;
|
|
229
|
+
sortedProperties?: GenericRecord;
|
|
230
|
+
readonly states?: string[];
|
|
231
|
+
stock: number;
|
|
232
|
+
readonly streamIds?: string[];
|
|
233
|
+
streams?: components["schemas"]["ProductStream"][];
|
|
234
|
+
readonly tagIds?: string[];
|
|
235
|
+
tags?: components["schemas"]["Tag"][];
|
|
236
|
+
tax?: components["schemas"]["Tax"];
|
|
237
|
+
taxId: string;
|
|
238
|
+
translated: {
|
|
239
|
+
canonicalProductId: string;
|
|
240
|
+
canonicalProductVersionId: string;
|
|
241
|
+
cmsPageId: string;
|
|
242
|
+
cmsPageVersionId: string;
|
|
243
|
+
coverId: string;
|
|
244
|
+
deliveryTimeId: string;
|
|
245
|
+
description: string;
|
|
246
|
+
displayGroup: string;
|
|
247
|
+
ean: string;
|
|
248
|
+
keywords: string;
|
|
249
|
+
manufacturerId: string;
|
|
250
|
+
manufacturerNumber: string;
|
|
251
|
+
metaDescription: string;
|
|
252
|
+
metaTitle: string;
|
|
253
|
+
name: string;
|
|
254
|
+
packUnit: string;
|
|
255
|
+
packUnitPlural: string;
|
|
256
|
+
parentId: string;
|
|
257
|
+
parentVersionId: string;
|
|
258
|
+
productManufacturerVersionId: string;
|
|
259
|
+
productMediaVersionId: string;
|
|
260
|
+
productNumber: string;
|
|
261
|
+
releaseDate: string;
|
|
262
|
+
taxId: string;
|
|
263
|
+
unitId: string;
|
|
264
|
+
versionId: string;
|
|
265
|
+
};
|
|
266
|
+
unit?: components["schemas"]["Unit"];
|
|
267
|
+
unitId?: string;
|
|
268
|
+
readonly updatedAt?: string;
|
|
269
|
+
variantListingConfig?: {
|
|
270
|
+
displayParent?: boolean;
|
|
271
|
+
} | null;
|
|
272
|
+
versionId?: string;
|
|
273
|
+
weight?: number;
|
|
274
|
+
width?: number;
|
|
275
|
+
} | undefined>;
|
|
276
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { operations } from '../../api-types/storeApiTypes.d.ts';
|
|
2
|
+
import { QueryKey, UseQueryOptions } from '@tanstack/vue-query';
|
|
3
|
+
import { OperationProp } from '@teamnovu/kit-shopware-api-client';
|
|
4
|
+
export type OperationKey = keyof operations;
|
|
5
|
+
export type OperationBody<Operations extends operations, K extends OperationKey> = OperationProp<Operations, K, 'body'>;
|
|
6
|
+
export type OperationResponse<Operations extends operations, K extends OperationKey> = OperationProp<Operations, K, 'response'>;
|
|
7
|
+
export type Options<Operations extends operations, K extends OperationKey, QK extends QueryKey = QueryKey> = UseQueryOptions<OperationResponse<Operations, K>, Error, OperationResponse<Operations, K>, OperationResponse<Operations, K>, QK>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Schemas } from '../api-types/storeApiTypes.d.ts';
|
|
2
|
+
import { MaybeRef, Ref, ComputedRef } from 'vue';
|
|
3
|
+
interface PaginationOptions {
|
|
4
|
+
page?: MaybeRef<number>;
|
|
5
|
+
total?: MaybeRef<number>;
|
|
6
|
+
limit?: MaybeRef<number>;
|
|
7
|
+
}
|
|
8
|
+
export declare function usePagination(opts?: PaginationOptions): {
|
|
9
|
+
page: number;
|
|
10
|
+
total: Ref<number, number>;
|
|
11
|
+
limit: Ref<number | undefined, number | undefined>;
|
|
12
|
+
pageCount: ComputedRef<number>;
|
|
13
|
+
isLastPage: ComputedRef<boolean>;
|
|
14
|
+
isFirstPage: ComputedRef<boolean>;
|
|
15
|
+
usePaginationSync: (data: MaybeRef<Schemas["EntitySearchResult"]>) => void;
|
|
16
|
+
queryOptions: ComputedRef<{
|
|
17
|
+
p: number;
|
|
18
|
+
limit: number | undefined;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
package/docker/boot_end.sh
CHANGED
|
File without changes
|
package/docker/types.sh
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamnovu/kit-shopware-composables",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "A collection of composables for the Shopware API",
|
|
5
5
|
"main": "dist/index.mjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -13,14 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
15
|
"@tanstack/vue-query": "^5.0.0",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"build": "vite build",
|
|
21
|
-
"watch": "NODE_ENV=development vite build --watch",
|
|
22
|
-
"gen-types": "bash ./docker/types.sh",
|
|
23
|
-
"lint": "eslint --fix --ignore-pattern 'dist/**' ."
|
|
16
|
+
"vue": "^3.0.0",
|
|
17
|
+
"@teamnovu/kit-shopware-api-client": "0.0.2"
|
|
24
18
|
},
|
|
25
19
|
"repository": {
|
|
26
20
|
"type": "git",
|
|
@@ -45,5 +39,11 @@
|
|
|
45
39
|
"eslint-plugin-import": "^2.31.0",
|
|
46
40
|
"typescript-eslint": "^8.30.1",
|
|
47
41
|
"vitest": "^3.1.2"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "vite build",
|
|
45
|
+
"watch": "NODE_ENV=development vite build --watch",
|
|
46
|
+
"gen-types": "bash ./docker/types.sh",
|
|
47
|
+
"lint": "eslint --fix --ignore-pattern 'dist/**' ."
|
|
48
48
|
}
|
|
49
49
|
}
|