@voyantjs/products-react 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/hooks/index.d.ts +14 -0
  2. package/dist/hooks/index.d.ts.map +1 -1
  3. package/dist/hooks/index.js +14 -0
  4. package/dist/hooks/use-option-unit-mutation.d.ts +60 -0
  5. package/dist/hooks/use-option-unit-mutation.d.ts.map +1 -0
  6. package/dist/hooks/use-option-unit-mutation.js +41 -0
  7. package/dist/hooks/use-option-unit.d.ts +21 -0
  8. package/dist/hooks/use-option-unit.d.ts.map +1 -0
  9. package/dist/hooks/use-option-unit.js +12 -0
  10. package/dist/hooks/use-option-units.d.ts +27 -0
  11. package/dist/hooks/use-option-units.d.ts.map +1 -0
  12. package/dist/hooks/use-option-units.js +12 -0
  13. package/dist/hooks/use-product-categories.d.ts +22 -0
  14. package/dist/hooks/use-product-categories.d.ts.map +1 -0
  15. package/dist/hooks/use-product-categories.js +29 -0
  16. package/dist/hooks/use-product-category-mutation.d.ts +43 -0
  17. package/dist/hooks/use-product-category-mutation.d.ts.map +1 -0
  18. package/dist/hooks/use-product-category-mutation.js +39 -0
  19. package/dist/hooks/use-product-category.d.ts +16 -0
  20. package/dist/hooks/use-product-category.d.ts.map +1 -0
  21. package/dist/hooks/use-product-category.js +18 -0
  22. package/dist/hooks/use-product-mutation.d.ts +2 -2
  23. package/dist/hooks/use-product-option-mutation.d.ts +49 -0
  24. package/dist/hooks/use-product-option-mutation.d.ts.map +1 -0
  25. package/dist/hooks/use-product-option-mutation.js +39 -0
  26. package/dist/hooks/use-product-option.d.ts +18 -0
  27. package/dist/hooks/use-product-option.d.ts.map +1 -0
  28. package/dist/hooks/use-product-option.js +12 -0
  29. package/dist/hooks/use-product-options.d.ts +24 -0
  30. package/dist/hooks/use-product-options.d.ts.map +1 -0
  31. package/dist/hooks/use-product-options.js +12 -0
  32. package/dist/hooks/use-product-tag-mutation.d.ts +25 -0
  33. package/dist/hooks/use-product-tag-mutation.d.ts.map +1 -0
  34. package/dist/hooks/use-product-tag-mutation.js +39 -0
  35. package/dist/hooks/use-product-tag.d.ts +10 -0
  36. package/dist/hooks/use-product-tag.d.ts.map +1 -0
  37. package/dist/hooks/use-product-tag.js +18 -0
  38. package/dist/hooks/use-product-tags.d.ts +16 -0
  39. package/dist/hooks/use-product-tags.d.ts.map +1 -0
  40. package/dist/hooks/use-product-tags.js +25 -0
  41. package/dist/hooks/use-product-type-mutation.d.ts +50 -0
  42. package/dist/hooks/use-product-type-mutation.d.ts.map +1 -0
  43. package/dist/hooks/use-product-type-mutation.js +47 -0
  44. package/dist/hooks/use-product-type.d.ts +15 -0
  45. package/dist/hooks/use-product-type.d.ts.map +1 -0
  46. package/dist/hooks/use-product-type.js +12 -0
  47. package/dist/hooks/use-product-types.d.ts +1 -1
  48. package/dist/hooks/use-product-types.d.ts.map +1 -1
  49. package/dist/hooks/use-product-types.js +4 -22
  50. package/dist/hooks/use-product.d.ts +1 -1
  51. package/dist/hooks/use-products.d.ts +1 -1
  52. package/dist/index.d.ts +1 -0
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +1 -0
  55. package/dist/provider.d.ts +1 -13
  56. package/dist/provider.d.ts.map +1 -1
  57. package/dist/provider.js +1 -16
  58. package/dist/query-keys.d.ts +36 -0
  59. package/dist/query-keys.d.ts.map +1 -1
  60. package/dist/query-keys.js +12 -0
  61. package/dist/query-options.d.ts +771 -0
  62. package/dist/query-options.d.ts.map +1 -0
  63. package/dist/query-options.js +174 -0
  64. package/dist/schemas.d.ts +215 -3
  65. package/dist/schemas.d.ts.map +1 -1
  66. package/dist/schemas.js +57 -0
  67. 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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stack/react-query";
3
+ import { fetchWithValidation } from "./client.js";
4
+ import { productsQueryKeys } from "./query-keys.js";
5
+ import { optionUnitListResponse, optionUnitSingleResponse, productCategoryListResponse, productListResponse, productOptionListResponse, productOptionSingleResponse, productSingleResponse, productTagListResponse, productTypeListResponse, productTypeSingleResponse, } 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
+ }
package/dist/schemas.d.ts CHANGED
@@ -21,13 +21,13 @@ export declare const productRecordSchema: z.ZodObject<{
21
21
  }>;
22
22
  description: z.ZodNullable<z.ZodString>;
23
23
  bookingMode: z.ZodEnum<{
24
+ other: "other";
24
25
  date: "date";
25
26
  date_time: "date_time";
26
27
  open: "open";
27
28
  stay: "stay";
28
29
  transfer: "transfer";
29
30
  itinerary: "itinerary";
30
- other: "other";
31
31
  }>;
32
32
  capacityMode: z.ZodEnum<{
33
33
  free_sale: "free_sale";
@@ -68,6 +68,70 @@ export declare const productTypeRecordSchema: z.ZodObject<{
68
68
  updatedAt: z.ZodString;
69
69
  }, z.core.$strip>;
70
70
  export type ProductTypeRecord = z.infer<typeof productTypeRecordSchema>;
71
+ export declare const productCategoryRecordSchema: z.ZodObject<{
72
+ id: z.ZodString;
73
+ parentId: z.ZodNullable<z.ZodString>;
74
+ name: z.ZodString;
75
+ slug: z.ZodString;
76
+ description: z.ZodNullable<z.ZodString>;
77
+ sortOrder: z.ZodNumber;
78
+ active: z.ZodBoolean;
79
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
80
+ createdAt: z.ZodString;
81
+ updatedAt: z.ZodString;
82
+ }, z.core.$strip>;
83
+ export type ProductCategoryRecord = z.infer<typeof productCategoryRecordSchema>;
84
+ export declare const productTagRecordSchema: z.ZodObject<{
85
+ id: z.ZodString;
86
+ name: z.ZodString;
87
+ createdAt: z.ZodString;
88
+ updatedAt: z.ZodString;
89
+ }, z.core.$strip>;
90
+ export type ProductTagRecord = z.infer<typeof productTagRecordSchema>;
91
+ export declare const productOptionRecordSchema: z.ZodObject<{
92
+ id: z.ZodString;
93
+ productId: z.ZodString;
94
+ name: z.ZodString;
95
+ code: z.ZodNullable<z.ZodString>;
96
+ description: z.ZodNullable<z.ZodString>;
97
+ status: z.ZodEnum<{
98
+ draft: "draft";
99
+ active: "active";
100
+ archived: "archived";
101
+ }>;
102
+ isDefault: z.ZodBoolean;
103
+ sortOrder: z.ZodNumber;
104
+ availableFrom: z.ZodNullable<z.ZodString>;
105
+ availableTo: z.ZodNullable<z.ZodString>;
106
+ createdAt: z.ZodString;
107
+ updatedAt: z.ZodString;
108
+ }, z.core.$strip>;
109
+ export type ProductOptionRecord = z.infer<typeof productOptionRecordSchema>;
110
+ export declare const optionUnitRecordSchema: z.ZodObject<{
111
+ id: z.ZodString;
112
+ optionId: z.ZodString;
113
+ name: z.ZodString;
114
+ code: z.ZodNullable<z.ZodString>;
115
+ description: z.ZodNullable<z.ZodString>;
116
+ unitType: z.ZodEnum<{
117
+ person: "person";
118
+ group: "group";
119
+ room: "room";
120
+ vehicle: "vehicle";
121
+ service: "service";
122
+ other: "other";
123
+ }>;
124
+ minQuantity: z.ZodNullable<z.ZodNumber>;
125
+ maxQuantity: z.ZodNullable<z.ZodNumber>;
126
+ minAge: z.ZodNullable<z.ZodNumber>;
127
+ maxAge: z.ZodNullable<z.ZodNumber>;
128
+ occupancyMin: z.ZodNullable<z.ZodNumber>;
129
+ occupancyMax: z.ZodNullable<z.ZodNumber>;
130
+ isRequired: z.ZodBoolean;
131
+ isHidden: z.ZodBoolean;
132
+ sortOrder: z.ZodNumber;
133
+ }, z.core.$strip>;
134
+ export type OptionUnitRecord = z.infer<typeof optionUnitRecordSchema>;
71
135
  export declare const productListResponse: z.ZodObject<{
72
136
  data: z.ZodArray<z.ZodObject<{
73
137
  id: z.ZodString;
@@ -79,13 +143,13 @@ export declare const productListResponse: z.ZodObject<{
79
143
  }>;
80
144
  description: z.ZodNullable<z.ZodString>;
81
145
  bookingMode: z.ZodEnum<{
146
+ other: "other";
82
147
  date: "date";
83
148
  date_time: "date_time";
84
149
  open: "open";
85
150
  stay: "stay";
86
151
  transfer: "transfer";
87
152
  itinerary: "itinerary";
88
- other: "other";
89
153
  }>;
90
154
  capacityMode: z.ZodEnum<{
91
155
  free_sale: "free_sale";
@@ -128,13 +192,13 @@ export declare const productSingleResponse: z.ZodObject<{
128
192
  }>;
129
193
  description: z.ZodNullable<z.ZodString>;
130
194
  bookingMode: z.ZodEnum<{
195
+ other: "other";
131
196
  date: "date";
132
197
  date_time: "date_time";
133
198
  open: "open";
134
199
  stay: "stay";
135
200
  transfer: "transfer";
136
201
  itinerary: "itinerary";
137
- other: "other";
138
202
  }>;
139
203
  capacityMode: z.ZodEnum<{
140
204
  free_sale: "free_sale";
@@ -192,4 +256,152 @@ export declare const productTypeSingleResponse: z.ZodObject<{
192
256
  updatedAt: z.ZodString;
193
257
  }, z.core.$strip>;
194
258
  }, z.core.$strip>;
259
+ export declare const productCategoryListResponse: z.ZodObject<{
260
+ data: z.ZodArray<z.ZodObject<{
261
+ id: z.ZodString;
262
+ parentId: z.ZodNullable<z.ZodString>;
263
+ name: z.ZodString;
264
+ slug: z.ZodString;
265
+ description: z.ZodNullable<z.ZodString>;
266
+ sortOrder: z.ZodNumber;
267
+ active: z.ZodBoolean;
268
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
269
+ createdAt: z.ZodString;
270
+ updatedAt: z.ZodString;
271
+ }, z.core.$strip>>;
272
+ total: z.ZodNumber;
273
+ limit: z.ZodNumber;
274
+ offset: z.ZodNumber;
275
+ }, z.core.$strip>;
276
+ export declare const productCategorySingleResponse: z.ZodObject<{
277
+ data: z.ZodObject<{
278
+ id: z.ZodString;
279
+ parentId: z.ZodNullable<z.ZodString>;
280
+ name: z.ZodString;
281
+ slug: z.ZodString;
282
+ description: z.ZodNullable<z.ZodString>;
283
+ sortOrder: z.ZodNumber;
284
+ active: z.ZodBoolean;
285
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
286
+ createdAt: z.ZodString;
287
+ updatedAt: z.ZodString;
288
+ }, z.core.$strip>;
289
+ }, z.core.$strip>;
290
+ export declare const productTagListResponse: z.ZodObject<{
291
+ data: z.ZodArray<z.ZodObject<{
292
+ id: z.ZodString;
293
+ name: z.ZodString;
294
+ createdAt: z.ZodString;
295
+ updatedAt: z.ZodString;
296
+ }, z.core.$strip>>;
297
+ total: z.ZodNumber;
298
+ limit: z.ZodNumber;
299
+ offset: z.ZodNumber;
300
+ }, z.core.$strip>;
301
+ export declare const productTagSingleResponse: z.ZodObject<{
302
+ data: z.ZodObject<{
303
+ id: z.ZodString;
304
+ name: z.ZodString;
305
+ createdAt: z.ZodString;
306
+ updatedAt: z.ZodString;
307
+ }, z.core.$strip>;
308
+ }, z.core.$strip>;
309
+ export declare const productOptionListResponse: z.ZodObject<{
310
+ data: z.ZodArray<z.ZodObject<{
311
+ id: z.ZodString;
312
+ productId: z.ZodString;
313
+ name: z.ZodString;
314
+ code: z.ZodNullable<z.ZodString>;
315
+ description: z.ZodNullable<z.ZodString>;
316
+ status: z.ZodEnum<{
317
+ draft: "draft";
318
+ active: "active";
319
+ archived: "archived";
320
+ }>;
321
+ isDefault: z.ZodBoolean;
322
+ sortOrder: z.ZodNumber;
323
+ availableFrom: z.ZodNullable<z.ZodString>;
324
+ availableTo: z.ZodNullable<z.ZodString>;
325
+ createdAt: z.ZodString;
326
+ updatedAt: z.ZodString;
327
+ }, z.core.$strip>>;
328
+ total: z.ZodNumber;
329
+ limit: z.ZodNumber;
330
+ offset: z.ZodNumber;
331
+ }, z.core.$strip>;
332
+ export declare const productOptionSingleResponse: z.ZodObject<{
333
+ data: z.ZodObject<{
334
+ id: z.ZodString;
335
+ productId: z.ZodString;
336
+ name: z.ZodString;
337
+ code: z.ZodNullable<z.ZodString>;
338
+ description: z.ZodNullable<z.ZodString>;
339
+ status: z.ZodEnum<{
340
+ draft: "draft";
341
+ active: "active";
342
+ archived: "archived";
343
+ }>;
344
+ isDefault: z.ZodBoolean;
345
+ sortOrder: z.ZodNumber;
346
+ availableFrom: z.ZodNullable<z.ZodString>;
347
+ availableTo: z.ZodNullable<z.ZodString>;
348
+ createdAt: z.ZodString;
349
+ updatedAt: z.ZodString;
350
+ }, z.core.$strip>;
351
+ }, z.core.$strip>;
352
+ export declare const optionUnitListResponse: z.ZodObject<{
353
+ data: z.ZodArray<z.ZodObject<{
354
+ id: z.ZodString;
355
+ optionId: z.ZodString;
356
+ name: z.ZodString;
357
+ code: z.ZodNullable<z.ZodString>;
358
+ description: z.ZodNullable<z.ZodString>;
359
+ unitType: z.ZodEnum<{
360
+ person: "person";
361
+ group: "group";
362
+ room: "room";
363
+ vehicle: "vehicle";
364
+ service: "service";
365
+ other: "other";
366
+ }>;
367
+ minQuantity: z.ZodNullable<z.ZodNumber>;
368
+ maxQuantity: z.ZodNullable<z.ZodNumber>;
369
+ minAge: z.ZodNullable<z.ZodNumber>;
370
+ maxAge: z.ZodNullable<z.ZodNumber>;
371
+ occupancyMin: z.ZodNullable<z.ZodNumber>;
372
+ occupancyMax: z.ZodNullable<z.ZodNumber>;
373
+ isRequired: z.ZodBoolean;
374
+ isHidden: z.ZodBoolean;
375
+ sortOrder: z.ZodNumber;
376
+ }, z.core.$strip>>;
377
+ total: z.ZodNumber;
378
+ limit: z.ZodNumber;
379
+ offset: z.ZodNumber;
380
+ }, z.core.$strip>;
381
+ export declare const optionUnitSingleResponse: z.ZodObject<{
382
+ data: z.ZodObject<{
383
+ id: z.ZodString;
384
+ optionId: z.ZodString;
385
+ name: z.ZodString;
386
+ code: z.ZodNullable<z.ZodString>;
387
+ description: z.ZodNullable<z.ZodString>;
388
+ unitType: z.ZodEnum<{
389
+ person: "person";
390
+ group: "group";
391
+ room: "room";
392
+ vehicle: "vehicle";
393
+ service: "service";
394
+ other: "other";
395
+ }>;
396
+ minQuantity: z.ZodNullable<z.ZodNumber>;
397
+ maxQuantity: z.ZodNullable<z.ZodNumber>;
398
+ minAge: z.ZodNullable<z.ZodNumber>;
399
+ maxAge: z.ZodNullable<z.ZodNumber>;
400
+ occupancyMin: z.ZodNullable<z.ZodNumber>;
401
+ occupancyMax: z.ZodNullable<z.ZodNumber>;
402
+ isRequired: z.ZodBoolean;
403
+ isHidden: z.ZodBoolean;
404
+ sortOrder: z.ZodNumber;
405
+ }, z.core.$strip>;
406
+ }, z.core.$strip>;
195
407
  //# sourceMappingURL=schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC;;;;;iBAM7D,CAAA;AAEJ,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC;;iBAA6B,CAAA;AAE3F,eAAO,MAAM,eAAe;;iBAAqC,CAAA;AAEjE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuB9B,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE/D,eAAO,MAAM,uBAAuB;;;;;;;;;;iBAUlC,CAAA;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAEvE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAyC,CAAA;AACzE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAsC,CAAA;AACxE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;iBAA6C,CAAA;AACjF,eAAO,MAAM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K,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAErE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAyC,CAAA;AACzE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAsC,CAAA;AACxE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;iBAA6C,CAAA;AACjF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;iBAA0C,CAAA;AAChF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;iBAAiD,CAAA;AACzF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;iBAA8C,CAAA;AACxF,eAAO,MAAM,sBAAsB;;;;;;;;;;iBAA4C,CAAA;AAC/E,eAAO,MAAM,wBAAwB;;;;;;;iBAAyC,CAAA;AAC9E,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;iBAA+C,CAAA;AACrF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;iBAA4C,CAAA;AACpF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA4C,CAAA;AAC/E,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;iBAAyC,CAAA"}
package/dist/schemas.js CHANGED
@@ -42,7 +42,64 @@ export const productTypeRecordSchema = z.object({
42
42
  createdAt: z.string(),
43
43
  updatedAt: z.string(),
44
44
  });
45
+ export const productCategoryRecordSchema = z.object({
46
+ id: z.string(),
47
+ parentId: z.string().nullable(),
48
+ name: z.string(),
49
+ slug: z.string(),
50
+ description: z.string().nullable(),
51
+ sortOrder: z.number().int(),
52
+ active: z.boolean(),
53
+ metadata: z.record(z.string(), z.unknown()).nullable().optional(),
54
+ createdAt: z.string(),
55
+ updatedAt: z.string(),
56
+ });
57
+ export const productTagRecordSchema = z.object({
58
+ id: z.string(),
59
+ name: z.string(),
60
+ createdAt: z.string(),
61
+ updatedAt: z.string(),
62
+ });
63
+ export const productOptionRecordSchema = z.object({
64
+ id: z.string(),
65
+ productId: z.string(),
66
+ name: z.string(),
67
+ code: z.string().nullable(),
68
+ description: z.string().nullable(),
69
+ status: z.enum(["draft", "active", "archived"]),
70
+ isDefault: z.boolean(),
71
+ sortOrder: z.number().int(),
72
+ availableFrom: z.string().nullable(),
73
+ availableTo: z.string().nullable(),
74
+ createdAt: z.string(),
75
+ updatedAt: z.string(),
76
+ });
77
+ export const optionUnitRecordSchema = z.object({
78
+ id: z.string(),
79
+ optionId: z.string(),
80
+ name: z.string(),
81
+ code: z.string().nullable(),
82
+ description: z.string().nullable(),
83
+ unitType: z.enum(["person", "group", "room", "vehicle", "service", "other"]),
84
+ minQuantity: z.number().int().nullable(),
85
+ maxQuantity: z.number().int().nullable(),
86
+ minAge: z.number().int().nullable(),
87
+ maxAge: z.number().int().nullable(),
88
+ occupancyMin: z.number().int().nullable(),
89
+ occupancyMax: z.number().int().nullable(),
90
+ isRequired: z.boolean(),
91
+ isHidden: z.boolean(),
92
+ sortOrder: z.number().int(),
93
+ });
45
94
  export const productListResponse = paginatedEnvelope(productRecordSchema);
46
95
  export const productSingleResponse = singleEnvelope(productRecordSchema);
47
96
  export const productTypeListResponse = paginatedEnvelope(productTypeRecordSchema);
48
97
  export const productTypeSingleResponse = singleEnvelope(productTypeRecordSchema);
98
+ export const productCategoryListResponse = paginatedEnvelope(productCategoryRecordSchema);
99
+ export const productCategorySingleResponse = singleEnvelope(productCategoryRecordSchema);
100
+ export const productTagListResponse = paginatedEnvelope(productTagRecordSchema);
101
+ export const productTagSingleResponse = singleEnvelope(productTagRecordSchema);
102
+ export const productOptionListResponse = paginatedEnvelope(productOptionRecordSchema);
103
+ export const productOptionSingleResponse = singleEnvelope(productOptionRecordSchema);
104
+ export const optionUnitListResponse = paginatedEnvelope(optionUnitRecordSchema);
105
+ export const optionUnitSingleResponse = singleEnvelope(optionUnitRecordSchema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyantjs/products-react",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "license": "FSL-1.1-Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,7 +35,7 @@
35
35
  "react": "^19.0.0",
36
36
  "react-dom": "^19.0.0",
37
37
  "zod": "^4.0.0",
38
- "@voyantjs/products": "0.2.0"
38
+ "@voyantjs/products": "0.3.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@tanstack/react-query": "^5.96.2",
@@ -46,9 +46,13 @@
46
46
  "typescript": "^6.0.2",
47
47
  "vitest": "^4.1.2",
48
48
  "zod": "^4.3.6",
49
- "@voyantjs/products": "0.2.0",
49
+ "@voyantjs/products": "0.3.0",
50
+ "@voyantjs/react": "0.3.0",
50
51
  "@voyantjs/voyant-typescript-config": "0.1.0"
51
52
  },
53
+ "dependencies": {
54
+ "@voyantjs/react": "0.3.0"
55
+ },
52
56
  "files": [
53
57
  "dist"
54
58
  ],