@voyantjs/pricing-ui 0.16.0 → 0.18.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/LICENSE +201 -109
  2. package/README.md +11 -0
  3. package/dist/components/cancellation-policy-combobox.d.ts +1 -1
  4. package/dist/components/cancellation-policy-combobox.d.ts.map +1 -1
  5. package/dist/components/cancellation-policy-combobox.js +6 -4
  6. package/dist/components/cancellation-policy-rule-dialog.d.ts.map +1 -1
  7. package/dist/components/cancellation-policy-rule-dialog.js +23 -15
  8. package/dist/components/dropoff-price-rule-dialog.d.ts.map +1 -1
  9. package/dist/components/dropoff-price-rule-dialog.js +32 -15
  10. package/dist/components/extra-price-rule-dialog.d.ts.map +1 -1
  11. package/dist/components/extra-price-rule-dialog.js +28 -14
  12. package/dist/components/option-price-rule-combobox.d.ts +1 -1
  13. package/dist/components/option-price-rule-combobox.d.ts.map +1 -1
  14. package/dist/components/option-price-rule-combobox.js +6 -4
  15. package/dist/components/option-price-rule-dialog.d.ts.map +1 -1
  16. package/dist/components/option-price-rule-dialog.js +35 -23
  17. package/dist/components/option-start-time-rule-dialog.d.ts.map +1 -1
  18. package/dist/components/option-start-time-rule-dialog.js +33 -14
  19. package/dist/components/option-unit-price-rule-dialog.d.ts.map +1 -1
  20. package/dist/components/option-unit-price-rule-dialog.js +30 -16
  21. package/dist/components/option-unit-tier-dialog.d.ts.map +1 -1
  22. package/dist/components/option-unit-tier-dialog.js +24 -10
  23. package/dist/components/pickup-price-rule-dialog.d.ts.map +1 -1
  24. package/dist/components/pickup-price-rule-dialog.js +29 -13
  25. package/dist/components/price-catalog-combobox.d.ts +1 -1
  26. package/dist/components/price-catalog-combobox.d.ts.map +1 -1
  27. package/dist/components/price-catalog-combobox.js +6 -2
  28. package/dist/components/price-schedule-combobox.d.ts.map +1 -1
  29. package/dist/components/price-schedule-combobox.js +6 -4
  30. package/dist/components/price-schedule-dialog.d.ts.map +1 -1
  31. package/dist/components/price-schedule-dialog.js +26 -15
  32. package/dist/components/pricing-category-combobox.d.ts.map +1 -1
  33. package/dist/components/pricing-category-combobox.js +4 -2
  34. package/dist/components/pricing-category-dependency-dialog.d.ts.map +1 -1
  35. package/dist/components/pricing-category-dependency-dialog.js +5 -1
  36. package/dist/components/pricing-category-dependency-form.d.ts.map +1 -1
  37. package/dist/components/pricing-category-dependency-form.js +17 -8
  38. package/dist/components/pricing-category-dialog.d.ts.map +1 -1
  39. package/dist/components/pricing-category-dialog.js +7 -3
  40. package/dist/components/pricing-category-form.d.ts.map +1 -1
  41. package/dist/components/pricing-category-form.js +20 -13
  42. package/dist/components/pricing-category-list.d.ts.map +1 -1
  43. package/dist/components/pricing-category-list.js +10 -6
  44. package/dist/components/product-combobox.d.ts +1 -1
  45. package/dist/components/product-combobox.d.ts.map +1 -1
  46. package/dist/components/product-combobox.js +6 -2
  47. package/dist/components/product-option-combobox.d.ts.map +1 -1
  48. package/dist/components/product-option-combobox.js +7 -5
  49. package/dist/i18n/en.d.ts +426 -0
  50. package/dist/i18n/en.d.ts.map +1 -0
  51. package/dist/i18n/en.js +425 -0
  52. package/dist/i18n/index.d.ts +5 -0
  53. package/dist/i18n/index.d.ts.map +1 -0
  54. package/dist/i18n/index.js +3 -0
  55. package/dist/i18n/messages.d.ts +391 -0
  56. package/dist/i18n/messages.d.ts.map +1 -0
  57. package/dist/i18n/messages.js +17 -0
  58. package/dist/i18n/provider.d.ts +874 -0
  59. package/dist/i18n/provider.d.ts.map +1 -0
  60. package/dist/i18n/provider.js +44 -0
  61. package/dist/i18n/ro.d.ts +426 -0
  62. package/dist/i18n/ro.d.ts.map +1 -0
  63. package/dist/i18n/ro.js +425 -0
  64. package/dist/index.d.ts +2 -0
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +1 -0
  67. package/package.json +33 -12
@@ -2,8 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useProduct, useProducts } from "@voyantjs/products-react";
3
3
  import { Combobox, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList, } from "@voyantjs/ui/components/combobox";
4
4
  import * as React from "react";
5
+ import { usePricingUiMessagesOrDefault } from "../i18n/provider";
5
6
  const PAGE_SIZE = 25;
6
- export function ProductCombobox({ value, onChange, placeholder = "Search products…", disabled, }) {
7
+ export function ProductCombobox({ value, onChange, placeholder, disabled }) {
8
+ const messages = usePricingUiMessagesOrDefault();
7
9
  const [search, setSearch] = React.useState("");
8
10
  const listQuery = useProducts({ search: search || undefined, limit: PAGE_SIZE });
9
11
  const selectedQuery = useProduct(value ?? undefined, { enabled: !!value });
@@ -32,7 +34,9 @@ export function ProductCombobox({ value, onChange, placeholder = "Search product
32
34
  const id = next ?? null;
33
35
  onChange(id);
34
36
  setInputValue(id ? (itemMap.get(id)?.name ?? "") : "");
35
- }, children: [_jsx(ComboboxInput, { placeholder: placeholder, showClear: !!value }), _jsxs(ComboboxContent, { children: [_jsx(ComboboxEmpty, { children: listQuery.isPending || selectedQuery.isPending ? "Loading…" : "No products found." }), _jsx(ComboboxList, { children: _jsx(ComboboxCollection, { children: (id) => {
37
+ }, children: [_jsx(ComboboxInput, { placeholder: placeholder ?? messages.comboboxes.product.placeholder, showClear: !!value }), _jsxs(ComboboxContent, { children: [_jsx(ComboboxEmpty, { children: listQuery.isPending || selectedQuery.isPending
38
+ ? messages.common.loading
39
+ : messages.comboboxes.product.empty }), _jsx(ComboboxList, { children: _jsx(ComboboxCollection, { children: (id) => {
36
40
  const item = itemMap.get(id);
37
41
  if (!item)
38
42
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"product-option-combobox.d.ts","sourceRoot":"","sources":["../../src/components/product-option-combobox.tsx"],"names":[],"mappings":"AAgBA,KAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IACxC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAID,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,KAAK,EACL,QAAQ,EACR,WAAsC,EACtC,QAAQ,GACT,EAAE,KAAK,2CA4EP"}
1
+ {"version":3,"file":"product-option-combobox.d.ts","sourceRoot":"","sources":["../../src/components/product-option-combobox.tsx"],"names":[],"mappings":"AAkBA,KAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IACxC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAID,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,KAAK,EACL,QAAQ,EACR,WAAW,EACX,QAAQ,GACT,EAAE,KAAK,2CAgFP"}
@@ -2,8 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useProductOption, useProductOptions, } from "@voyantjs/products-react";
3
3
  import { Combobox, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList, } from "@voyantjs/ui/components/combobox";
4
4
  import * as React from "react";
5
+ import { usePricingUiMessagesOrDefault } from "../i18n/provider";
5
6
  const PAGE_SIZE = 100;
6
- export function ProductOptionCombobox({ productId, value, onChange, placeholder = "Select product option…", disabled, }) {
7
+ export function ProductOptionCombobox({ productId, value, onChange, placeholder, disabled, }) {
8
+ const messages = usePricingUiMessagesOrDefault();
7
9
  const [search, setSearch] = React.useState("");
8
10
  const listQuery = useProductOptions({
9
11
  productId: productId || undefined,
@@ -38,11 +40,11 @@ export function ProductOptionCombobox({ productId, value, onChange, placeholder
38
40
  const id = next ?? null;
39
41
  onChange(id);
40
42
  setInputValue(id ? (itemMap.get(id)?.name ?? "") : "");
41
- }, children: [_jsx(ComboboxInput, { placeholder: placeholder, showClear: !!value }), _jsxs(ComboboxContent, { children: [_jsx(ComboboxEmpty, { children: listQuery.isPending || selectedQuery.isPending
42
- ? "Loading…"
43
+ }, children: [_jsx(ComboboxInput, { placeholder: placeholder ?? messages.comboboxes.productOption.placeholder, showClear: !!value }), _jsxs(ComboboxContent, { children: [_jsx(ComboboxEmpty, { children: listQuery.isPending || selectedQuery.isPending
44
+ ? messages.common.loading
43
45
  : productId
44
- ? "No product options found."
45
- : "Select a product first." }), _jsx(ComboboxList, { children: _jsx(ComboboxCollection, { children: (id) => {
46
+ ? messages.comboboxes.productOption.empty
47
+ : messages.comboboxes.productOption.missingParent }), _jsx(ComboboxList, { children: _jsx(ComboboxCollection, { children: (id) => {
46
48
  const item = itemMap.get(id);
47
49
  if (!item)
48
50
  return null;
@@ -0,0 +1,426 @@
1
+ export declare const pricingUiEn: {
2
+ common: {
3
+ cancel: string;
4
+ saveChanges: string;
5
+ create: string;
6
+ add: string;
7
+ loading: string;
8
+ none: string;
9
+ previous: string;
10
+ next: string;
11
+ page: string;
12
+ active: string;
13
+ inactive: string;
14
+ categoryTypeLabels: {
15
+ adult: string;
16
+ child: string;
17
+ infant: string;
18
+ senior: string;
19
+ group: string;
20
+ room: string;
21
+ vehicle: string;
22
+ service: string;
23
+ other: string;
24
+ };
25
+ dependencyTypeLabels: {
26
+ requires: string;
27
+ limits_per_master: string;
28
+ limits_sum: string;
29
+ excludes: string;
30
+ };
31
+ chargeTypeLabels: {
32
+ none: string;
33
+ amount: string;
34
+ percentage: string;
35
+ };
36
+ addonPricingModeLabels: {
37
+ included: string;
38
+ per_person: string;
39
+ per_booking: string;
40
+ on_request: string;
41
+ unavailable: string;
42
+ };
43
+ optionPriceRulePricingModeLabels: {
44
+ per_person: string;
45
+ per_booking: string;
46
+ starting_from: string;
47
+ free: string;
48
+ on_request: string;
49
+ };
50
+ startTimeRuleModeLabels: {
51
+ included: string;
52
+ excluded: string;
53
+ override: string;
54
+ adjustment: string;
55
+ };
56
+ adjustmentTypeLabels: {
57
+ fixed: string;
58
+ percentage: string;
59
+ };
60
+ unitPricingModeLabels: {
61
+ per_unit: string;
62
+ per_person: string;
63
+ per_booking: string;
64
+ included: string;
65
+ free: string;
66
+ on_request: string;
67
+ };
68
+ };
69
+ comboboxes: {
70
+ pricingCategory: {
71
+ placeholder: string;
72
+ empty: string;
73
+ };
74
+ priceCatalog: {
75
+ placeholder: string;
76
+ empty: string;
77
+ };
78
+ priceSchedule: {
79
+ placeholder: string;
80
+ empty: string;
81
+ };
82
+ cancellationPolicy: {
83
+ placeholder: string;
84
+ empty: string;
85
+ };
86
+ optionPriceRule: {
87
+ placeholder: string;
88
+ empty: string;
89
+ };
90
+ product: {
91
+ placeholder: string;
92
+ empty: string;
93
+ };
94
+ productOption: {
95
+ placeholder: string;
96
+ empty: string;
97
+ missingParent: string;
98
+ };
99
+ };
100
+ pricingCategoryDialog: {
101
+ titles: {
102
+ create: string;
103
+ edit: string;
104
+ };
105
+ descriptions: {
106
+ create: string;
107
+ edit: string;
108
+ };
109
+ };
110
+ pricingCategoryForm: {
111
+ fields: {
112
+ name: string;
113
+ code: string;
114
+ type: string;
115
+ seatOccupancy: string;
116
+ ageQualified: string;
117
+ minAge: string;
118
+ maxAge: string;
119
+ sortOrder: string;
120
+ active: string;
121
+ };
122
+ placeholders: {
123
+ name: string;
124
+ code: string;
125
+ };
126
+ validation: {
127
+ nameRequired: string;
128
+ saveFailed: string;
129
+ };
130
+ actions: {
131
+ create: string;
132
+ };
133
+ };
134
+ pricingCategoryList: {
135
+ searchPlaceholder: string;
136
+ add: string;
137
+ columns: {
138
+ name: string;
139
+ code: string;
140
+ type: string;
141
+ age: string;
142
+ seat: string;
143
+ sort: string;
144
+ status: string;
145
+ actions: string;
146
+ };
147
+ loadingError: string;
148
+ empty: string;
149
+ edit: string;
150
+ delete: string;
151
+ deleteConfirm: string;
152
+ showingSummary: string;
153
+ };
154
+ pricingCategoryDependencyDialog: {
155
+ titles: {
156
+ create: string;
157
+ edit: string;
158
+ };
159
+ description: string;
160
+ };
161
+ pricingCategoryDependencyForm: {
162
+ fields: {
163
+ masterCategory: string;
164
+ dependentCategory: string;
165
+ dependencyType: string;
166
+ maxPerMaster: string;
167
+ maxDependentSum: string;
168
+ active: string;
169
+ notes: string;
170
+ };
171
+ placeholders: {
172
+ categorySearch: string;
173
+ };
174
+ validation: {
175
+ categoriesRequired: string;
176
+ saveFailed: string;
177
+ };
178
+ actions: {
179
+ create: string;
180
+ };
181
+ };
182
+ priceScheduleDialog: {
183
+ titles: {
184
+ create: string;
185
+ edit: string;
186
+ };
187
+ fields: {
188
+ catalog: string;
189
+ name: string;
190
+ code: string;
191
+ recurrenceRule: string;
192
+ validFrom: string;
193
+ validTo: string;
194
+ timezone: string;
195
+ priority: string;
196
+ active: string;
197
+ notes: string;
198
+ };
199
+ placeholders: {
200
+ catalog: string;
201
+ name: string;
202
+ code: string;
203
+ recurrenceRule: string;
204
+ validFrom: string;
205
+ validTo: string;
206
+ timezone: string;
207
+ };
208
+ validation: {
209
+ catalogRequired: string;
210
+ nameRequired: string;
211
+ recurrenceRuleRequired: string;
212
+ };
213
+ helpText: {
214
+ recurrenceRuleExample: string;
215
+ };
216
+ actions: {
217
+ create: string;
218
+ };
219
+ };
220
+ cancellationPolicyRuleDialog: {
221
+ titles: {
222
+ create: string;
223
+ edit: string;
224
+ };
225
+ fields: {
226
+ cutoffMinutesBefore: string;
227
+ sortOrder: string;
228
+ chargeType: string;
229
+ chargeAmount: string;
230
+ chargePercent: string;
231
+ active: string;
232
+ notes: string;
233
+ };
234
+ placeholders: {
235
+ cutoffMinutesBefore: string;
236
+ chargePercent: string;
237
+ };
238
+ helpText: {
239
+ cutoffMinutesBefore: string;
240
+ };
241
+ actions: {
242
+ create: string;
243
+ };
244
+ };
245
+ optionPriceRuleDialog: {
246
+ titles: {
247
+ create: string;
248
+ edit: string;
249
+ };
250
+ fields: {
251
+ product: string;
252
+ option: string;
253
+ name: string;
254
+ code: string;
255
+ catalog: string;
256
+ schedule: string;
257
+ cancellationPolicy: string;
258
+ pricingMode: string;
259
+ baseSell: string;
260
+ baseCost: string;
261
+ minPerBooking: string;
262
+ maxPerBooking: string;
263
+ description: string;
264
+ allPricingCategories: string;
265
+ defaultRule: string;
266
+ active: string;
267
+ notes: string;
268
+ };
269
+ validation: {
270
+ productRequired: string;
271
+ optionRequired: string;
272
+ catalogRequired: string;
273
+ nameRequired: string;
274
+ };
275
+ actions: {
276
+ create: string;
277
+ };
278
+ };
279
+ locationPriceRuleDialog: {
280
+ fields: {
281
+ optionPriceRule: string;
282
+ optionId: string;
283
+ facilityId: string;
284
+ pickupPointId: string;
285
+ dropoffName: string;
286
+ dropoffCode: string;
287
+ pricingMode: string;
288
+ sellAmount: string;
289
+ costAmount: string;
290
+ sortOrder: string;
291
+ active: string;
292
+ notes: string;
293
+ };
294
+ placeholders: {
295
+ optionId: string;
296
+ facilityId: string;
297
+ pickupPointId: string;
298
+ };
299
+ validation: {
300
+ optionPriceRuleRequired: string;
301
+ optionIdRequired: string;
302
+ pickupPointIdRequired: string;
303
+ dropoffNameRequired: string;
304
+ };
305
+ actions: {
306
+ createRule: string;
307
+ saveRule: string;
308
+ };
309
+ pickup: {
310
+ titles: {
311
+ create: string;
312
+ edit: string;
313
+ };
314
+ };
315
+ dropoff: {
316
+ titles: {
317
+ create: string;
318
+ edit: string;
319
+ };
320
+ };
321
+ extra: {
322
+ titles: {
323
+ create: string;
324
+ edit: string;
325
+ };
326
+ fields: {
327
+ productExtraId: string;
328
+ optionExtraConfigId: string;
329
+ };
330
+ placeholders: {
331
+ productExtraId: string;
332
+ optionExtraConfigId: string;
333
+ };
334
+ };
335
+ };
336
+ optionStartTimeRuleDialog: {
337
+ titles: {
338
+ create: string;
339
+ edit: string;
340
+ };
341
+ fields: {
342
+ optionPriceRule: string;
343
+ optionId: string;
344
+ startTimeId: string;
345
+ ruleMode: string;
346
+ adjustmentType: string;
347
+ sellAdjustment: string;
348
+ costAdjustment: string;
349
+ adjustmentPercent: string;
350
+ active: string;
351
+ notes: string;
352
+ };
353
+ placeholders: {
354
+ optionId: string;
355
+ startTimeId: string;
356
+ select: string;
357
+ };
358
+ validation: {
359
+ optionPriceRuleRequired: string;
360
+ optionIdRequired: string;
361
+ startTimeIdRequired: string;
362
+ };
363
+ actions: {
364
+ create: string;
365
+ };
366
+ };
367
+ optionUnitPriceRuleDialog: {
368
+ titles: {
369
+ create: string;
370
+ edit: string;
371
+ };
372
+ fields: {
373
+ optionPriceRule: string;
374
+ optionId: string;
375
+ unitId: string;
376
+ pricingCategory: string;
377
+ pricingMode: string;
378
+ sellAmount: string;
379
+ costAmount: string;
380
+ minQuantity: string;
381
+ maxQuantity: string;
382
+ sortOrder: string;
383
+ active: string;
384
+ notes: string;
385
+ };
386
+ placeholders: {
387
+ optionId: string;
388
+ unitId: string;
389
+ pricingCategory: string;
390
+ };
391
+ validation: {
392
+ optionPriceRuleRequired: string;
393
+ optionIdRequired: string;
394
+ unitIdRequired: string;
395
+ };
396
+ actions: {
397
+ create: string;
398
+ };
399
+ };
400
+ optionUnitTierDialog: {
401
+ titles: {
402
+ create: string;
403
+ edit: string;
404
+ };
405
+ fields: {
406
+ optionUnitPriceRuleId: string;
407
+ minQuantity: string;
408
+ maxQuantity: string;
409
+ sellAmount: string;
410
+ costAmount: string;
411
+ sortOrder: string;
412
+ active: string;
413
+ };
414
+ placeholders: {
415
+ optionUnitPriceRuleId: string;
416
+ };
417
+ validation: {
418
+ optionUnitPriceRuleIdRequired: string;
419
+ minQuantityMin: string;
420
+ };
421
+ actions: {
422
+ create: string;
423
+ };
424
+ };
425
+ };
426
+ //# sourceMappingURL=en.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/i18n/en.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyaK,CAAA"}