@voyantjs/products-react 0.2.0 → 0.3.1
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/hooks/index.d.ts +22 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +22 -0
- package/dist/hooks/use-option-unit-mutation.d.ts +60 -0
- package/dist/hooks/use-option-unit-mutation.d.ts.map +1 -0
- package/dist/hooks/use-option-unit-mutation.js +41 -0
- package/dist/hooks/use-option-unit.d.ts +21 -0
- package/dist/hooks/use-option-unit.d.ts.map +1 -0
- package/dist/hooks/use-option-unit.js +12 -0
- package/dist/hooks/use-option-units.d.ts +27 -0
- package/dist/hooks/use-option-units.d.ts.map +1 -0
- package/dist/hooks/use-option-units.js +12 -0
- package/dist/hooks/use-product-categories.d.ts +22 -0
- package/dist/hooks/use-product-categories.d.ts.map +1 -0
- package/dist/hooks/use-product-categories.js +29 -0
- package/dist/hooks/use-product-category-mutation.d.ts +43 -0
- package/dist/hooks/use-product-category-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-category-mutation.js +39 -0
- package/dist/hooks/use-product-category.d.ts +16 -0
- package/dist/hooks/use-product-category.d.ts.map +1 -0
- package/dist/hooks/use-product-category.js +18 -0
- package/dist/hooks/use-product-day-mutation.d.ts +41 -0
- package/dist/hooks/use-product-day-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-day-mutation.js +41 -0
- package/dist/hooks/use-product-day-service-mutation.d.ts +63 -0
- package/dist/hooks/use-product-day-service-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-day-service-mutation.js +41 -0
- package/dist/hooks/use-product-day-services.d.ts +20 -0
- package/dist/hooks/use-product-day-services.d.ts.map +1 -0
- package/dist/hooks/use-product-day-services.js +12 -0
- package/dist/hooks/use-product-days.d.ts +16 -0
- package/dist/hooks/use-product-days.d.ts.map +1 -0
- package/dist/hooks/use-product-days.js +12 -0
- package/dist/hooks/use-product-media-mutation.d.ts +98 -0
- package/dist/hooks/use-product-media-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-media-mutation.js +69 -0
- package/dist/hooks/use-product-media.d.ts +26 -0
- package/dist/hooks/use-product-media.d.ts.map +1 -0
- package/dist/hooks/use-product-media.js +12 -0
- package/dist/hooks/use-product-mutation.d.ts +2 -2
- package/dist/hooks/use-product-option-mutation.d.ts +49 -0
- package/dist/hooks/use-product-option-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-option-mutation.js +39 -0
- package/dist/hooks/use-product-option.d.ts +18 -0
- package/dist/hooks/use-product-option.d.ts.map +1 -0
- package/dist/hooks/use-product-option.js +12 -0
- package/dist/hooks/use-product-options.d.ts +24 -0
- package/dist/hooks/use-product-options.d.ts.map +1 -0
- package/dist/hooks/use-product-options.js +12 -0
- package/dist/hooks/use-product-tag-mutation.d.ts +25 -0
- package/dist/hooks/use-product-tag-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-tag-mutation.js +39 -0
- package/dist/hooks/use-product-tag.d.ts +10 -0
- package/dist/hooks/use-product-tag.d.ts.map +1 -0
- package/dist/hooks/use-product-tag.js +18 -0
- package/dist/hooks/use-product-tags.d.ts +16 -0
- package/dist/hooks/use-product-tags.d.ts.map +1 -0
- package/dist/hooks/use-product-tags.js +25 -0
- package/dist/hooks/use-product-type-mutation.d.ts +50 -0
- package/dist/hooks/use-product-type-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-type-mutation.js +47 -0
- package/dist/hooks/use-product-type.d.ts +15 -0
- package/dist/hooks/use-product-type.d.ts.map +1 -0
- package/dist/hooks/use-product-type.js +12 -0
- package/dist/hooks/use-product-types.d.ts +1 -1
- package/dist/hooks/use-product-types.d.ts.map +1 -1
- package/dist/hooks/use-product-types.js +4 -22
- package/dist/hooks/use-product-version-mutation.d.ts +16 -0
- package/dist/hooks/use-product-version-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-version-mutation.js +22 -0
- package/dist/hooks/use-product-versions.d.ts +15 -0
- package/dist/hooks/use-product-versions.d.ts.map +1 -0
- package/dist/hooks/use-product-versions.js +12 -0
- package/dist/hooks/use-product.d.ts +1 -1
- package/dist/hooks/use-products.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/provider.d.ts +1 -13
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +1 -16
- package/dist/query-keys.d.ts +48 -0
- package/dist/query-keys.d.ts.map +1 -1
- package/dist/query-keys.js +18 -0
- package/dist/query-options.d.ts +1031 -0
- package/dist/query-options.d.ts.map +1 -0
- package/dist/query-options.js +235 -0
- package/dist/schemas.d.ts +431 -3
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +117 -0
- package/package.json +7 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-options.d.ts","sourceRoot":"","sources":["../src/query-options.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,0BAA0B,EAAuB,MAAM,aAAa,CAAA;AAClF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAA;AACpF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAA;AACvF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AACxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAC1E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAA;AAC5E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAClF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkB3C;AAED,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,0BAA0B,EAClC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,OAAO,GAAE,yBAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBxC;AAED,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,0BAA0B,EAClC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,OAAO,GAAE,sBAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BrC"}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { queryOptions } from "@tanstack/react-query";
|
|
3
|
+
import { fetchWithValidation } from "./client.js";
|
|
4
|
+
import { productsQueryKeys } from "./query-keys.js";
|
|
5
|
+
import { optionUnitListResponse, optionUnitSingleResponse, productCategoryListResponse, productDayServicesResponse, productDaysResponse, productListResponse, productMediaListResponse, productOptionListResponse, productOptionSingleResponse, productSingleResponse, productTagListResponse, productTypeListResponse, productTypeSingleResponse, productVersionsResponse, } from "./schemas.js";
|
|
6
|
+
export function getProductsQueryOptions(client, options = {}) {
|
|
7
|
+
const { enabled: _enabled = true, ...filters } = options;
|
|
8
|
+
return queryOptions({
|
|
9
|
+
queryKey: productsQueryKeys.productsList(filters),
|
|
10
|
+
queryFn: () => {
|
|
11
|
+
const params = new URLSearchParams();
|
|
12
|
+
if (filters.status)
|
|
13
|
+
params.set("status", filters.status);
|
|
14
|
+
if (filters.bookingMode)
|
|
15
|
+
params.set("bookingMode", filters.bookingMode);
|
|
16
|
+
if (filters.visibility)
|
|
17
|
+
params.set("visibility", filters.visibility);
|
|
18
|
+
if (filters.activated !== undefined)
|
|
19
|
+
params.set("activated", String(filters.activated));
|
|
20
|
+
if (filters.facilityId)
|
|
21
|
+
params.set("facilityId", filters.facilityId);
|
|
22
|
+
if (filters.search)
|
|
23
|
+
params.set("search", filters.search);
|
|
24
|
+
if (filters.limit !== undefined)
|
|
25
|
+
params.set("limit", String(filters.limit));
|
|
26
|
+
if (filters.offset !== undefined)
|
|
27
|
+
params.set("offset", String(filters.offset));
|
|
28
|
+
const qs = params.toString();
|
|
29
|
+
return fetchWithValidation(`/v1/products${qs ? `?${qs}` : ""}`, productListResponse, client);
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export function getProductQueryOptions(client, id, options = {}) {
|
|
34
|
+
const { enabled: _enabled = true } = options;
|
|
35
|
+
return queryOptions({
|
|
36
|
+
queryKey: productsQueryKeys.product(id ?? ""),
|
|
37
|
+
queryFn: async () => {
|
|
38
|
+
if (!id)
|
|
39
|
+
throw new Error("getProductQueryOptions requires an id");
|
|
40
|
+
const { data } = await fetchWithValidation(`/v1/products/${id}`, productSingleResponse, client);
|
|
41
|
+
return data;
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export function getProductTypesQueryOptions(client, options = {}) {
|
|
46
|
+
const { enabled: _enabled = true, ...filters } = options;
|
|
47
|
+
return queryOptions({
|
|
48
|
+
queryKey: productsQueryKeys.productTypesList(filters),
|
|
49
|
+
queryFn: () => {
|
|
50
|
+
const params = new URLSearchParams();
|
|
51
|
+
if (filters.active !== undefined)
|
|
52
|
+
params.set("active", String(filters.active));
|
|
53
|
+
if (filters.search)
|
|
54
|
+
params.set("search", filters.search);
|
|
55
|
+
if (filters.limit !== undefined)
|
|
56
|
+
params.set("limit", String(filters.limit));
|
|
57
|
+
if (filters.offset !== undefined)
|
|
58
|
+
params.set("offset", String(filters.offset));
|
|
59
|
+
const qs = params.toString();
|
|
60
|
+
return fetchWithValidation(`/v1/products/product-types${qs ? `?${qs}` : ""}`, productTypeListResponse, client);
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
export function getProductTypeQueryOptions(client, id) {
|
|
65
|
+
return queryOptions({
|
|
66
|
+
queryKey: productsQueryKeys.productType(id ?? ""),
|
|
67
|
+
queryFn: async () => {
|
|
68
|
+
if (!id)
|
|
69
|
+
throw new Error("getProductTypeQueryOptions requires an id");
|
|
70
|
+
const { data } = await fetchWithValidation(`/v1/products/product-types/${id}`, productTypeSingleResponse, client);
|
|
71
|
+
return data;
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
export function getProductTagsQueryOptions(client, options = {}) {
|
|
76
|
+
const { enabled: _enabled = true, ...filters } = options;
|
|
77
|
+
return queryOptions({
|
|
78
|
+
queryKey: productsQueryKeys.productTagsList(filters),
|
|
79
|
+
queryFn: () => {
|
|
80
|
+
const params = new URLSearchParams();
|
|
81
|
+
if (filters.search)
|
|
82
|
+
params.set("search", filters.search);
|
|
83
|
+
if (filters.limit !== undefined)
|
|
84
|
+
params.set("limit", String(filters.limit));
|
|
85
|
+
if (filters.offset !== undefined)
|
|
86
|
+
params.set("offset", String(filters.offset));
|
|
87
|
+
const qs = params.toString();
|
|
88
|
+
return fetchWithValidation(`/v1/products/product-tags${qs ? `?${qs}` : ""}`, productTagListResponse, client);
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
export function getProductCategoriesQueryOptions(client, options = {}) {
|
|
93
|
+
const { enabled: _enabled = true, ...filters } = options;
|
|
94
|
+
return queryOptions({
|
|
95
|
+
queryKey: productsQueryKeys.productCategoriesList(filters),
|
|
96
|
+
queryFn: () => {
|
|
97
|
+
const params = new URLSearchParams();
|
|
98
|
+
if (filters.parentId)
|
|
99
|
+
params.set("parentId", filters.parentId);
|
|
100
|
+
if (filters.active !== undefined)
|
|
101
|
+
params.set("active", String(filters.active));
|
|
102
|
+
if (filters.search)
|
|
103
|
+
params.set("search", filters.search);
|
|
104
|
+
if (filters.limit !== undefined)
|
|
105
|
+
params.set("limit", String(filters.limit));
|
|
106
|
+
if (filters.offset !== undefined)
|
|
107
|
+
params.set("offset", String(filters.offset));
|
|
108
|
+
const qs = params.toString();
|
|
109
|
+
return fetchWithValidation(`/v1/products/product-categories${qs ? `?${qs}` : ""}`, productCategoryListResponse, client);
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
export function getProductOptionsQueryOptions(client, options = {}) {
|
|
114
|
+
const { enabled: _enabled = true, ...filters } = options;
|
|
115
|
+
return queryOptions({
|
|
116
|
+
queryKey: productsQueryKeys.productOptionsList(filters),
|
|
117
|
+
queryFn: () => {
|
|
118
|
+
const params = new URLSearchParams();
|
|
119
|
+
if (filters.productId)
|
|
120
|
+
params.set("productId", filters.productId);
|
|
121
|
+
if (filters.status)
|
|
122
|
+
params.set("status", filters.status);
|
|
123
|
+
if (filters.limit !== undefined)
|
|
124
|
+
params.set("limit", String(filters.limit));
|
|
125
|
+
if (filters.offset !== undefined)
|
|
126
|
+
params.set("offset", String(filters.offset));
|
|
127
|
+
const qs = params.toString();
|
|
128
|
+
return fetchWithValidation(`/v1/products/options${qs ? `?${qs}` : ""}`, productOptionListResponse, client);
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
export function getProductOptionQueryOptions(client, id, options = {}) {
|
|
133
|
+
const { enabled: _enabled = true } = options;
|
|
134
|
+
return queryOptions({
|
|
135
|
+
queryKey: productsQueryKeys.productOption(id ?? ""),
|
|
136
|
+
queryFn: async () => {
|
|
137
|
+
if (!id)
|
|
138
|
+
throw new Error("getProductOptionQueryOptions requires an id");
|
|
139
|
+
const { data } = await fetchWithValidation(`/v1/products/options/${id}`, productOptionSingleResponse, client);
|
|
140
|
+
return data;
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
export function getOptionUnitsQueryOptions(client, options = {}) {
|
|
145
|
+
const { enabled: _enabled = true, ...filters } = options;
|
|
146
|
+
return queryOptions({
|
|
147
|
+
queryKey: productsQueryKeys.optionUnitsList(filters),
|
|
148
|
+
queryFn: () => {
|
|
149
|
+
const params = new URLSearchParams();
|
|
150
|
+
if (filters.optionId)
|
|
151
|
+
params.set("optionId", filters.optionId);
|
|
152
|
+
if (filters.unitType)
|
|
153
|
+
params.set("unitType", filters.unitType);
|
|
154
|
+
if (filters.limit !== undefined)
|
|
155
|
+
params.set("limit", String(filters.limit));
|
|
156
|
+
if (filters.offset !== undefined)
|
|
157
|
+
params.set("offset", String(filters.offset));
|
|
158
|
+
const qs = params.toString();
|
|
159
|
+
return fetchWithValidation(`/v1/products/units${qs ? `?${qs}` : ""}`, optionUnitListResponse, client);
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
export function getOptionUnitQueryOptions(client, id, options = {}) {
|
|
164
|
+
const { enabled: _enabled = true } = options;
|
|
165
|
+
return queryOptions({
|
|
166
|
+
queryKey: productsQueryKeys.optionUnit(id ?? ""),
|
|
167
|
+
queryFn: async () => {
|
|
168
|
+
if (!id)
|
|
169
|
+
throw new Error("getOptionUnitQueryOptions requires an id");
|
|
170
|
+
const { data } = await fetchWithValidation(`/v1/products/units/${id}`, optionUnitSingleResponse, client);
|
|
171
|
+
return data;
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
export function getProductDaysQueryOptions(client, productId, options = {}) {
|
|
176
|
+
const { enabled: _enabled = true } = options;
|
|
177
|
+
return queryOptions({
|
|
178
|
+
queryKey: productsQueryKeys.productDays(productId ?? ""),
|
|
179
|
+
queryFn: async () => {
|
|
180
|
+
if (!productId)
|
|
181
|
+
throw new Error("getProductDaysQueryOptions requires a productId");
|
|
182
|
+
return fetchWithValidation(`/v1/products/${productId}/days`, productDaysResponse, client);
|
|
183
|
+
},
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
export function getProductDayServicesQueryOptions(client, productId, dayId, options = {}) {
|
|
187
|
+
const { enabled: _enabled = true } = options;
|
|
188
|
+
return queryOptions({
|
|
189
|
+
queryKey: productsQueryKeys.productDayServices(productId ?? "", dayId ?? ""),
|
|
190
|
+
queryFn: async () => {
|
|
191
|
+
if (!productId || !dayId) {
|
|
192
|
+
throw new Error("getProductDayServicesQueryOptions requires productId and dayId");
|
|
193
|
+
}
|
|
194
|
+
return fetchWithValidation(`/v1/products/${productId}/days/${dayId}/services`, productDayServicesResponse, client);
|
|
195
|
+
},
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
export function getProductVersionsQueryOptions(client, productId, options = {}) {
|
|
199
|
+
const { enabled: _enabled = true } = options;
|
|
200
|
+
return queryOptions({
|
|
201
|
+
queryKey: productsQueryKeys.productVersions(productId ?? ""),
|
|
202
|
+
queryFn: async () => {
|
|
203
|
+
if (!productId)
|
|
204
|
+
throw new Error("getProductVersionsQueryOptions requires a productId");
|
|
205
|
+
return fetchWithValidation(`/v1/products/${productId}/versions`, productVersionsResponse, client);
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
export function getProductMediaQueryOptions(client, productId, options = {}) {
|
|
210
|
+
const { enabled: _enabled = true, dayId, mediaType, limit, offset } = options;
|
|
211
|
+
return queryOptions({
|
|
212
|
+
queryKey: productsQueryKeys.productMediaList(productId ?? "", {
|
|
213
|
+
dayId,
|
|
214
|
+
mediaType,
|
|
215
|
+
limit,
|
|
216
|
+
offset,
|
|
217
|
+
}),
|
|
218
|
+
queryFn: async () => {
|
|
219
|
+
if (!productId)
|
|
220
|
+
throw new Error("getProductMediaQueryOptions requires a productId");
|
|
221
|
+
const params = new URLSearchParams();
|
|
222
|
+
if (mediaType)
|
|
223
|
+
params.set("mediaType", mediaType);
|
|
224
|
+
if (limit !== undefined)
|
|
225
|
+
params.set("limit", String(limit));
|
|
226
|
+
if (offset !== undefined)
|
|
227
|
+
params.set("offset", String(offset));
|
|
228
|
+
const qs = params.toString();
|
|
229
|
+
const basePath = dayId
|
|
230
|
+
? `/v1/products/${productId}/days/${dayId}/media`
|
|
231
|
+
: `/v1/products/${productId}/media`;
|
|
232
|
+
return fetchWithValidation(`${basePath}${qs ? `?${qs}` : ""}`, productMediaListResponse, client);
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
}
|