@voyantjs/suppliers-react 0.1.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.
- package/README.md +35 -0
- package/dist/client.d.ts +14 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +59 -0
- package/dist/constants.d.ts +69 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +34 -0
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +10 -0
- package/dist/hooks/use-supplier-mutation.d.ts +67 -0
- package/dist/hooks/use-supplier-mutation.d.ts.map +1 -0
- package/dist/hooks/use-supplier-mutation.js +41 -0
- package/dist/hooks/use-supplier-note-mutation.d.ts +13 -0
- package/dist/hooks/use-supplier-note-mutation.d.ts.map +1 -0
- package/dist/hooks/use-supplier-note-mutation.js +20 -0
- package/dist/hooks/use-supplier-notes.d.ts +13 -0
- package/dist/hooks/use-supplier-notes.d.ts.map +1 -0
- package/dist/hooks/use-supplier-notes.js +12 -0
- package/dist/hooks/use-supplier-rate-mutation.d.ts +56 -0
- package/dist/hooks/use-supplier-rate-mutation.d.ts.map +1 -0
- package/dist/hooks/use-supplier-rate-mutation.js +41 -0
- package/dist/hooks/use-supplier-service-mutation.d.ts +45 -0
- package/dist/hooks/use-supplier-service-mutation.d.ts.map +1 -0
- package/dist/hooks/use-supplier-service-mutation.js +44 -0
- package/dist/hooks/use-supplier-service-rates.d.ts +20 -0
- package/dist/hooks/use-supplier-service-rates.d.ts.map +1 -0
- package/dist/hooks/use-supplier-service-rates.js +12 -0
- package/dist/hooks/use-supplier-services.d.ts +19 -0
- package/dist/hooks/use-supplier-services.d.ts.map +1 -0
- package/dist/hooks/use-supplier-services.js +12 -0
- package/dist/hooks/use-supplier.d.ts +26 -0
- package/dist/hooks/use-supplier.d.ts.map +1 -0
- package/dist/hooks/use-supplier.js +9 -0
- package/dist/hooks/use-suppliers.d.ts +30 -0
- package/dist/hooks/use-suppliers.d.ts.map +1 -0
- package/dist/hooks/use-suppliers.js +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/provider.d.ts +2 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +1 -0
- package/dist/query-keys.d.ts +20 -0
- package/dist/query-keys.d.ts.map +1 -0
- package/dist/query-keys.js +12 -0
- package/dist/query-options.d.ts +371 -0
- package/dist/query-options.d.ts.map +1 -0
- package/dist/query-options.js +49 -0
- package/dist/schemas.d.ts +300 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +95 -0
- package/dist/utils.d.ts +4 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +10 -0
- package/package.json +79 -0
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const paginatedEnvelope: <T extends z.ZodTypeAny>(item: T) => z.ZodObject<{
|
|
3
|
+
data: z.ZodArray<T>;
|
|
4
|
+
total: z.ZodNumber;
|
|
5
|
+
limit: z.ZodNumber;
|
|
6
|
+
offset: z.ZodNumber;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export declare const supplierTypeSchema: z.ZodEnum<{
|
|
9
|
+
hotel: "hotel";
|
|
10
|
+
transfer: "transfer";
|
|
11
|
+
guide: "guide";
|
|
12
|
+
experience: "experience";
|
|
13
|
+
airline: "airline";
|
|
14
|
+
restaurant: "restaurant";
|
|
15
|
+
other: "other";
|
|
16
|
+
}>;
|
|
17
|
+
export declare const supplierStatusSchema: z.ZodEnum<{
|
|
18
|
+
active: "active";
|
|
19
|
+
inactive: "inactive";
|
|
20
|
+
pending: "pending";
|
|
21
|
+
}>;
|
|
22
|
+
export declare const serviceTypeSchema: z.ZodEnum<{
|
|
23
|
+
transfer: "transfer";
|
|
24
|
+
guide: "guide";
|
|
25
|
+
experience: "experience";
|
|
26
|
+
other: "other";
|
|
27
|
+
accommodation: "accommodation";
|
|
28
|
+
meal: "meal";
|
|
29
|
+
}>;
|
|
30
|
+
export declare const rateUnitSchema: z.ZodEnum<{
|
|
31
|
+
per_person: "per_person";
|
|
32
|
+
per_group: "per_group";
|
|
33
|
+
per_night: "per_night";
|
|
34
|
+
per_vehicle: "per_vehicle";
|
|
35
|
+
flat: "flat";
|
|
36
|
+
}>;
|
|
37
|
+
export declare const supplierSchema: z.ZodObject<{
|
|
38
|
+
id: z.ZodString;
|
|
39
|
+
name: z.ZodString;
|
|
40
|
+
type: z.ZodEnum<{
|
|
41
|
+
hotel: "hotel";
|
|
42
|
+
transfer: "transfer";
|
|
43
|
+
guide: "guide";
|
|
44
|
+
experience: "experience";
|
|
45
|
+
airline: "airline";
|
|
46
|
+
restaurant: "restaurant";
|
|
47
|
+
other: "other";
|
|
48
|
+
}>;
|
|
49
|
+
status: z.ZodEnum<{
|
|
50
|
+
active: "active";
|
|
51
|
+
inactive: "inactive";
|
|
52
|
+
pending: "pending";
|
|
53
|
+
}>;
|
|
54
|
+
description: z.ZodNullable<z.ZodString>;
|
|
55
|
+
email: z.ZodNullable<z.ZodString>;
|
|
56
|
+
phone: z.ZodNullable<z.ZodString>;
|
|
57
|
+
website: z.ZodNullable<z.ZodString>;
|
|
58
|
+
address: z.ZodNullable<z.ZodString>;
|
|
59
|
+
city: z.ZodNullable<z.ZodString>;
|
|
60
|
+
country: z.ZodNullable<z.ZodString>;
|
|
61
|
+
defaultCurrency: z.ZodNullable<z.ZodString>;
|
|
62
|
+
contactName: z.ZodNullable<z.ZodString>;
|
|
63
|
+
contactEmail: z.ZodNullable<z.ZodString>;
|
|
64
|
+
contactPhone: z.ZodNullable<z.ZodString>;
|
|
65
|
+
tags: z.ZodArray<z.ZodString>;
|
|
66
|
+
createdAt: z.ZodString;
|
|
67
|
+
updatedAt: z.ZodString;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
export type Supplier = z.infer<typeof supplierSchema>;
|
|
70
|
+
export declare const supplierServiceSchema: z.ZodObject<{
|
|
71
|
+
id: z.ZodString;
|
|
72
|
+
supplierId: z.ZodString;
|
|
73
|
+
serviceType: z.ZodEnum<{
|
|
74
|
+
transfer: "transfer";
|
|
75
|
+
guide: "guide";
|
|
76
|
+
experience: "experience";
|
|
77
|
+
other: "other";
|
|
78
|
+
accommodation: "accommodation";
|
|
79
|
+
meal: "meal";
|
|
80
|
+
}>;
|
|
81
|
+
name: z.ZodString;
|
|
82
|
+
description: z.ZodNullable<z.ZodString>;
|
|
83
|
+
duration: z.ZodNullable<z.ZodString>;
|
|
84
|
+
capacity: z.ZodNullable<z.ZodNumber>;
|
|
85
|
+
active: z.ZodBoolean;
|
|
86
|
+
tags: z.ZodArray<z.ZodString>;
|
|
87
|
+
createdAt: z.ZodString;
|
|
88
|
+
updatedAt: z.ZodString;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
export type SupplierService = z.infer<typeof supplierServiceSchema>;
|
|
91
|
+
export declare const supplierRateSchema: z.ZodObject<{
|
|
92
|
+
id: z.ZodString;
|
|
93
|
+
serviceId: z.ZodString;
|
|
94
|
+
name: z.ZodString;
|
|
95
|
+
currency: z.ZodString;
|
|
96
|
+
amountCents: z.ZodNumber;
|
|
97
|
+
unit: z.ZodEnum<{
|
|
98
|
+
per_person: "per_person";
|
|
99
|
+
per_group: "per_group";
|
|
100
|
+
per_night: "per_night";
|
|
101
|
+
per_vehicle: "per_vehicle";
|
|
102
|
+
flat: "flat";
|
|
103
|
+
}>;
|
|
104
|
+
validFrom: z.ZodNullable<z.ZodString>;
|
|
105
|
+
validTo: z.ZodNullable<z.ZodString>;
|
|
106
|
+
minPax: z.ZodNullable<z.ZodNumber>;
|
|
107
|
+
maxPax: z.ZodNullable<z.ZodNumber>;
|
|
108
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
109
|
+
createdAt: z.ZodString;
|
|
110
|
+
}, z.core.$strip>;
|
|
111
|
+
export type SupplierRate = z.infer<typeof supplierRateSchema>;
|
|
112
|
+
export declare const supplierNoteSchema: z.ZodObject<{
|
|
113
|
+
id: z.ZodString;
|
|
114
|
+
supplierId: z.ZodString;
|
|
115
|
+
authorId: z.ZodString;
|
|
116
|
+
content: z.ZodString;
|
|
117
|
+
createdAt: z.ZodString;
|
|
118
|
+
}, z.core.$strip>;
|
|
119
|
+
export type SupplierNote = z.infer<typeof supplierNoteSchema>;
|
|
120
|
+
export declare const supplierListResponse: z.ZodObject<{
|
|
121
|
+
data: z.ZodArray<z.ZodObject<{
|
|
122
|
+
id: z.ZodString;
|
|
123
|
+
name: z.ZodString;
|
|
124
|
+
type: z.ZodEnum<{
|
|
125
|
+
hotel: "hotel";
|
|
126
|
+
transfer: "transfer";
|
|
127
|
+
guide: "guide";
|
|
128
|
+
experience: "experience";
|
|
129
|
+
airline: "airline";
|
|
130
|
+
restaurant: "restaurant";
|
|
131
|
+
other: "other";
|
|
132
|
+
}>;
|
|
133
|
+
status: z.ZodEnum<{
|
|
134
|
+
active: "active";
|
|
135
|
+
inactive: "inactive";
|
|
136
|
+
pending: "pending";
|
|
137
|
+
}>;
|
|
138
|
+
description: z.ZodNullable<z.ZodString>;
|
|
139
|
+
email: z.ZodNullable<z.ZodString>;
|
|
140
|
+
phone: z.ZodNullable<z.ZodString>;
|
|
141
|
+
website: z.ZodNullable<z.ZodString>;
|
|
142
|
+
address: z.ZodNullable<z.ZodString>;
|
|
143
|
+
city: z.ZodNullable<z.ZodString>;
|
|
144
|
+
country: z.ZodNullable<z.ZodString>;
|
|
145
|
+
defaultCurrency: z.ZodNullable<z.ZodString>;
|
|
146
|
+
contactName: z.ZodNullable<z.ZodString>;
|
|
147
|
+
contactEmail: z.ZodNullable<z.ZodString>;
|
|
148
|
+
contactPhone: z.ZodNullable<z.ZodString>;
|
|
149
|
+
tags: z.ZodArray<z.ZodString>;
|
|
150
|
+
createdAt: z.ZodString;
|
|
151
|
+
updatedAt: z.ZodString;
|
|
152
|
+
}, z.core.$strip>>;
|
|
153
|
+
total: z.ZodNumber;
|
|
154
|
+
limit: z.ZodNumber;
|
|
155
|
+
offset: z.ZodNumber;
|
|
156
|
+
}, z.core.$strip>;
|
|
157
|
+
export declare const supplierDetailResponse: z.ZodObject<{
|
|
158
|
+
data: z.ZodObject<{
|
|
159
|
+
id: z.ZodString;
|
|
160
|
+
name: z.ZodString;
|
|
161
|
+
type: z.ZodEnum<{
|
|
162
|
+
hotel: "hotel";
|
|
163
|
+
transfer: "transfer";
|
|
164
|
+
guide: "guide";
|
|
165
|
+
experience: "experience";
|
|
166
|
+
airline: "airline";
|
|
167
|
+
restaurant: "restaurant";
|
|
168
|
+
other: "other";
|
|
169
|
+
}>;
|
|
170
|
+
status: z.ZodEnum<{
|
|
171
|
+
active: "active";
|
|
172
|
+
inactive: "inactive";
|
|
173
|
+
pending: "pending";
|
|
174
|
+
}>;
|
|
175
|
+
description: z.ZodNullable<z.ZodString>;
|
|
176
|
+
email: z.ZodNullable<z.ZodString>;
|
|
177
|
+
phone: z.ZodNullable<z.ZodString>;
|
|
178
|
+
website: z.ZodNullable<z.ZodString>;
|
|
179
|
+
address: z.ZodNullable<z.ZodString>;
|
|
180
|
+
city: z.ZodNullable<z.ZodString>;
|
|
181
|
+
country: z.ZodNullable<z.ZodString>;
|
|
182
|
+
defaultCurrency: z.ZodNullable<z.ZodString>;
|
|
183
|
+
contactName: z.ZodNullable<z.ZodString>;
|
|
184
|
+
contactEmail: z.ZodNullable<z.ZodString>;
|
|
185
|
+
contactPhone: z.ZodNullable<z.ZodString>;
|
|
186
|
+
tags: z.ZodArray<z.ZodString>;
|
|
187
|
+
createdAt: z.ZodString;
|
|
188
|
+
updatedAt: z.ZodString;
|
|
189
|
+
}, z.core.$strip>;
|
|
190
|
+
}, z.core.$strip>;
|
|
191
|
+
export declare const supplierServiceResponse: z.ZodObject<{
|
|
192
|
+
data: z.ZodObject<{
|
|
193
|
+
id: z.ZodString;
|
|
194
|
+
supplierId: z.ZodString;
|
|
195
|
+
serviceType: z.ZodEnum<{
|
|
196
|
+
transfer: "transfer";
|
|
197
|
+
guide: "guide";
|
|
198
|
+
experience: "experience";
|
|
199
|
+
other: "other";
|
|
200
|
+
accommodation: "accommodation";
|
|
201
|
+
meal: "meal";
|
|
202
|
+
}>;
|
|
203
|
+
name: z.ZodString;
|
|
204
|
+
description: z.ZodNullable<z.ZodString>;
|
|
205
|
+
duration: z.ZodNullable<z.ZodString>;
|
|
206
|
+
capacity: z.ZodNullable<z.ZodNumber>;
|
|
207
|
+
active: z.ZodBoolean;
|
|
208
|
+
tags: z.ZodArray<z.ZodString>;
|
|
209
|
+
createdAt: z.ZodString;
|
|
210
|
+
updatedAt: z.ZodString;
|
|
211
|
+
}, z.core.$strip>;
|
|
212
|
+
}, z.core.$strip>;
|
|
213
|
+
export declare const supplierServicesResponse: z.ZodObject<{
|
|
214
|
+
data: z.ZodArray<z.ZodObject<{
|
|
215
|
+
id: z.ZodString;
|
|
216
|
+
supplierId: z.ZodString;
|
|
217
|
+
serviceType: z.ZodEnum<{
|
|
218
|
+
transfer: "transfer";
|
|
219
|
+
guide: "guide";
|
|
220
|
+
experience: "experience";
|
|
221
|
+
other: "other";
|
|
222
|
+
accommodation: "accommodation";
|
|
223
|
+
meal: "meal";
|
|
224
|
+
}>;
|
|
225
|
+
name: z.ZodString;
|
|
226
|
+
description: z.ZodNullable<z.ZodString>;
|
|
227
|
+
duration: z.ZodNullable<z.ZodString>;
|
|
228
|
+
capacity: z.ZodNullable<z.ZodNumber>;
|
|
229
|
+
active: z.ZodBoolean;
|
|
230
|
+
tags: z.ZodArray<z.ZodString>;
|
|
231
|
+
createdAt: z.ZodString;
|
|
232
|
+
updatedAt: z.ZodString;
|
|
233
|
+
}, z.core.$strip>>;
|
|
234
|
+
}, z.core.$strip>;
|
|
235
|
+
export declare const supplierNoteResponse: z.ZodObject<{
|
|
236
|
+
data: z.ZodObject<{
|
|
237
|
+
id: z.ZodString;
|
|
238
|
+
supplierId: z.ZodString;
|
|
239
|
+
authorId: z.ZodString;
|
|
240
|
+
content: z.ZodString;
|
|
241
|
+
createdAt: z.ZodString;
|
|
242
|
+
}, z.core.$strip>;
|
|
243
|
+
}, z.core.$strip>;
|
|
244
|
+
export declare const supplierNotesResponse: z.ZodObject<{
|
|
245
|
+
data: z.ZodArray<z.ZodObject<{
|
|
246
|
+
id: z.ZodString;
|
|
247
|
+
supplierId: z.ZodString;
|
|
248
|
+
authorId: z.ZodString;
|
|
249
|
+
content: z.ZodString;
|
|
250
|
+
createdAt: z.ZodString;
|
|
251
|
+
}, z.core.$strip>>;
|
|
252
|
+
}, z.core.$strip>;
|
|
253
|
+
export declare const supplierRateResponse: z.ZodObject<{
|
|
254
|
+
data: z.ZodObject<{
|
|
255
|
+
id: z.ZodString;
|
|
256
|
+
serviceId: z.ZodString;
|
|
257
|
+
name: z.ZodString;
|
|
258
|
+
currency: z.ZodString;
|
|
259
|
+
amountCents: z.ZodNumber;
|
|
260
|
+
unit: z.ZodEnum<{
|
|
261
|
+
per_person: "per_person";
|
|
262
|
+
per_group: "per_group";
|
|
263
|
+
per_night: "per_night";
|
|
264
|
+
per_vehicle: "per_vehicle";
|
|
265
|
+
flat: "flat";
|
|
266
|
+
}>;
|
|
267
|
+
validFrom: z.ZodNullable<z.ZodString>;
|
|
268
|
+
validTo: z.ZodNullable<z.ZodString>;
|
|
269
|
+
minPax: z.ZodNullable<z.ZodNumber>;
|
|
270
|
+
maxPax: z.ZodNullable<z.ZodNumber>;
|
|
271
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
272
|
+
createdAt: z.ZodString;
|
|
273
|
+
}, z.core.$strip>;
|
|
274
|
+
}, z.core.$strip>;
|
|
275
|
+
export declare const supplierRatesResponse: z.ZodObject<{
|
|
276
|
+
data: z.ZodArray<z.ZodObject<{
|
|
277
|
+
id: z.ZodString;
|
|
278
|
+
serviceId: z.ZodString;
|
|
279
|
+
name: z.ZodString;
|
|
280
|
+
currency: z.ZodString;
|
|
281
|
+
amountCents: z.ZodNumber;
|
|
282
|
+
unit: z.ZodEnum<{
|
|
283
|
+
per_person: "per_person";
|
|
284
|
+
per_group: "per_group";
|
|
285
|
+
per_night: "per_night";
|
|
286
|
+
per_vehicle: "per_vehicle";
|
|
287
|
+
flat: "flat";
|
|
288
|
+
}>;
|
|
289
|
+
validFrom: z.ZodNullable<z.ZodString>;
|
|
290
|
+
validTo: z.ZodNullable<z.ZodString>;
|
|
291
|
+
minPax: z.ZodNullable<z.ZodNumber>;
|
|
292
|
+
maxPax: z.ZodNullable<z.ZodNumber>;
|
|
293
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
294
|
+
createdAt: z.ZodString;
|
|
295
|
+
}, z.core.$strip>>;
|
|
296
|
+
}, z.core.$strip>;
|
|
297
|
+
export declare const deleteSuccessResponse: z.ZodObject<{
|
|
298
|
+
success: z.ZodBoolean;
|
|
299
|
+
}, z.core.$strip>;
|
|
300
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +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,kBAAkB;;;;;;;;EAQ7B,CAAA;AAEF,eAAO,MAAM,oBAAoB;;;;EAA4C,CAAA;AAE7E,eAAO,MAAM,iBAAiB;;;;;;;EAO5B,CAAA;AAEF,eAAO,MAAM,cAAc;;;;;;EAMzB,CAAA;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmBzB,CAAA;AAEF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAErD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;iBAYhC,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEnE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;iBAa7B,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAE7D,eAAO,MAAM,kBAAkB;;;;;;iBAM7B,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAE7D,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAoC,CAAA;AACrE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAqC,CAAA;AACxE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;iBAA4C,CAAA;AAChF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;iBAAqD,CAAA;AAC1F,eAAO,MAAM,oBAAoB;;;;;;;;iBAAyC,CAAA;AAC1E,eAAO,MAAM,qBAAqB;;;;;;;;iBAAkD,CAAA;AACpF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;iBAAyC,CAAA;AAC1E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;iBAAkD,CAAA;AACpF,eAAO,MAAM,qBAAqB;;iBAAqC,CAAA"}
|
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const paginatedEnvelope = (item) => z.object({
|
|
3
|
+
data: z.array(item),
|
|
4
|
+
total: z.number().int(),
|
|
5
|
+
limit: z.number().int(),
|
|
6
|
+
offset: z.number().int(),
|
|
7
|
+
});
|
|
8
|
+
export const supplierTypeSchema = z.enum([
|
|
9
|
+
"hotel",
|
|
10
|
+
"transfer",
|
|
11
|
+
"guide",
|
|
12
|
+
"experience",
|
|
13
|
+
"airline",
|
|
14
|
+
"restaurant",
|
|
15
|
+
"other",
|
|
16
|
+
]);
|
|
17
|
+
export const supplierStatusSchema = z.enum(["active", "inactive", "pending"]);
|
|
18
|
+
export const serviceTypeSchema = z.enum([
|
|
19
|
+
"accommodation",
|
|
20
|
+
"transfer",
|
|
21
|
+
"experience",
|
|
22
|
+
"guide",
|
|
23
|
+
"meal",
|
|
24
|
+
"other",
|
|
25
|
+
]);
|
|
26
|
+
export const rateUnitSchema = z.enum([
|
|
27
|
+
"per_person",
|
|
28
|
+
"per_group",
|
|
29
|
+
"per_night",
|
|
30
|
+
"per_vehicle",
|
|
31
|
+
"flat",
|
|
32
|
+
]);
|
|
33
|
+
export const supplierSchema = z.object({
|
|
34
|
+
id: z.string(),
|
|
35
|
+
name: z.string(),
|
|
36
|
+
type: supplierTypeSchema,
|
|
37
|
+
status: supplierStatusSchema,
|
|
38
|
+
description: z.string().nullable(),
|
|
39
|
+
email: z.string().nullable(),
|
|
40
|
+
phone: z.string().nullable(),
|
|
41
|
+
website: z.string().nullable(),
|
|
42
|
+
address: z.string().nullable(),
|
|
43
|
+
city: z.string().nullable(),
|
|
44
|
+
country: z.string().nullable(),
|
|
45
|
+
defaultCurrency: z.string().nullable(),
|
|
46
|
+
contactName: z.string().nullable(),
|
|
47
|
+
contactEmail: z.string().nullable(),
|
|
48
|
+
contactPhone: z.string().nullable(),
|
|
49
|
+
tags: z.array(z.string()),
|
|
50
|
+
createdAt: z.string(),
|
|
51
|
+
updatedAt: z.string(),
|
|
52
|
+
});
|
|
53
|
+
export const supplierServiceSchema = z.object({
|
|
54
|
+
id: z.string(),
|
|
55
|
+
supplierId: z.string(),
|
|
56
|
+
serviceType: serviceTypeSchema,
|
|
57
|
+
name: z.string(),
|
|
58
|
+
description: z.string().nullable(),
|
|
59
|
+
duration: z.string().nullable(),
|
|
60
|
+
capacity: z.number().int().nullable(),
|
|
61
|
+
active: z.boolean(),
|
|
62
|
+
tags: z.array(z.string()),
|
|
63
|
+
createdAt: z.string(),
|
|
64
|
+
updatedAt: z.string(),
|
|
65
|
+
});
|
|
66
|
+
export const supplierRateSchema = z.object({
|
|
67
|
+
id: z.string(),
|
|
68
|
+
serviceId: z.string(),
|
|
69
|
+
name: z.string(),
|
|
70
|
+
currency: z.string(),
|
|
71
|
+
amountCents: z.number().int(),
|
|
72
|
+
unit: rateUnitSchema,
|
|
73
|
+
validFrom: z.string().nullable(),
|
|
74
|
+
validTo: z.string().nullable(),
|
|
75
|
+
minPax: z.number().int().nullable(),
|
|
76
|
+
maxPax: z.number().int().nullable(),
|
|
77
|
+
notes: z.string().nullable(),
|
|
78
|
+
createdAt: z.string(),
|
|
79
|
+
});
|
|
80
|
+
export const supplierNoteSchema = z.object({
|
|
81
|
+
id: z.string(),
|
|
82
|
+
supplierId: z.string(),
|
|
83
|
+
authorId: z.string(),
|
|
84
|
+
content: z.string(),
|
|
85
|
+
createdAt: z.string(),
|
|
86
|
+
});
|
|
87
|
+
export const supplierListResponse = paginatedEnvelope(supplierSchema);
|
|
88
|
+
export const supplierDetailResponse = z.object({ data: supplierSchema });
|
|
89
|
+
export const supplierServiceResponse = z.object({ data: supplierServiceSchema });
|
|
90
|
+
export const supplierServicesResponse = z.object({ data: z.array(supplierServiceSchema) });
|
|
91
|
+
export const supplierNoteResponse = z.object({ data: supplierNoteSchema });
|
|
92
|
+
export const supplierNotesResponse = z.object({ data: z.array(supplierNoteSchema) });
|
|
93
|
+
export const supplierRateResponse = z.object({ data: supplierRateSchema });
|
|
94
|
+
export const supplierRatesResponse = z.object({ data: z.array(supplierRateSchema) });
|
|
95
|
+
export const deleteSuccessResponse = z.object({ success: z.boolean() });
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,iBAGzD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function maybeNull(value) {
|
|
2
|
+
const trimmed = value?.trim() ?? "";
|
|
3
|
+
return trimmed ? trimmed : null;
|
|
4
|
+
}
|
|
5
|
+
export function formatAmount(cents, currency) {
|
|
6
|
+
return `${(cents / 100).toFixed(2)} ${currency}`;
|
|
7
|
+
}
|
|
8
|
+
export function formatUnit(unit) {
|
|
9
|
+
return unit.replace(/_/g, " ");
|
|
10
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@voyantjs/suppliers-react",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "FSL-1.1-Apache-2.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/voyantjs/voyant.git",
|
|
8
|
+
"directory": "packages/suppliers-react"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": "./src/index.ts",
|
|
13
|
+
"./provider": "./src/provider.tsx",
|
|
14
|
+
"./hooks": "./src/hooks/index.ts",
|
|
15
|
+
"./client": "./src/client.ts",
|
|
16
|
+
"./query-keys": "./src/query-keys.ts"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc -p tsconfig.json",
|
|
20
|
+
"clean": "rm -rf dist",
|
|
21
|
+
"prepack": "pnpm run build",
|
|
22
|
+
"typecheck": "tsc --noEmit",
|
|
23
|
+
"lint": "biome check src/",
|
|
24
|
+
"test": "vitest run --passWithNoTests"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"@voyantjs/suppliers": "workspace:*",
|
|
28
|
+
"@tanstack/react-query": "^5.0.0",
|
|
29
|
+
"react": "^19.0.0",
|
|
30
|
+
"react-dom": "^19.0.0",
|
|
31
|
+
"zod": "^4.0.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@voyantjs/suppliers": "workspace:*",
|
|
35
|
+
"@voyantjs/react": "workspace:*",
|
|
36
|
+
"@voyantjs/voyant-typescript-config": "workspace:*",
|
|
37
|
+
"@tanstack/react-query": "^5.96.2",
|
|
38
|
+
"@types/react": "^19.2.14",
|
|
39
|
+
"@types/react-dom": "^19.2.3",
|
|
40
|
+
"react": "^19.2.4",
|
|
41
|
+
"react-dom": "^19.2.4",
|
|
42
|
+
"typescript": "^6.0.2",
|
|
43
|
+
"vitest": "^4.1.2",
|
|
44
|
+
"zod": "^4.3.6"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@voyantjs/react": "workspace:*"
|
|
48
|
+
},
|
|
49
|
+
"files": [
|
|
50
|
+
"dist"
|
|
51
|
+
],
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public",
|
|
54
|
+
"exports": {
|
|
55
|
+
".": {
|
|
56
|
+
"types": "./dist/index.d.ts",
|
|
57
|
+
"import": "./dist/index.js"
|
|
58
|
+
},
|
|
59
|
+
"./provider": {
|
|
60
|
+
"types": "./dist/provider.d.ts",
|
|
61
|
+
"import": "./dist/provider.js"
|
|
62
|
+
},
|
|
63
|
+
"./hooks": {
|
|
64
|
+
"types": "./dist/hooks/index.d.ts",
|
|
65
|
+
"import": "./dist/hooks/index.js"
|
|
66
|
+
},
|
|
67
|
+
"./client": {
|
|
68
|
+
"types": "./dist/client.d.ts",
|
|
69
|
+
"import": "./dist/client.js"
|
|
70
|
+
},
|
|
71
|
+
"./query-keys": {
|
|
72
|
+
"types": "./dist/query-keys.d.ts",
|
|
73
|
+
"import": "./dist/query-keys.js"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"main": "./dist/index.js",
|
|
77
|
+
"types": "./dist/index.d.ts"
|
|
78
|
+
}
|
|
79
|
+
}
|