@licklist/design 0.71.18-dev.3 → 0.71.18-dev.5

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 (101) hide show
  1. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +1 -0
  2. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.d.ts +18 -0
  3. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.d.ts.map +1 -0
  4. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.js +281 -0
  5. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.d.ts +15 -0
  6. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.d.ts.map +1 -0
  7. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.js +89 -0
  8. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.d.ts +14 -0
  9. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.d.ts.map +1 -0
  10. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.js +399 -0
  11. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.d.ts +10 -0
  12. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.d.ts.map +1 -0
  13. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.js +87 -0
  14. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/index.d.ts +2 -0
  15. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/index.d.ts.map +1 -0
  16. package/dist/iframe/ProductWithModifierModal/index.d.ts +2 -0
  17. package/dist/iframe/ProductWithModifierModal/index.d.ts.map +1 -0
  18. package/dist/iframe/ProductWithModifierModal/utils.d.ts +5 -0
  19. package/dist/iframe/ProductWithModifierModal/utils.d.ts.map +1 -0
  20. package/dist/iframe/ProductWithModifierModal/utils.js +19 -0
  21. package/dist/iframe/event/ticket-description/TicketDescription.d.ts +2 -1
  22. package/dist/iframe/event/ticket-description/TicketDescription.d.ts.map +1 -1
  23. package/dist/iframe/event/ticket-description/TicketDescription.js +4 -3
  24. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts.map +1 -1
  25. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.js +29 -2
  26. package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts +4 -0
  27. package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts.map +1 -1
  28. package/dist/iframe/order-process/components/BookingSummary/utils/index.js +27 -2
  29. package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts.map +1 -1
  30. package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.js +106 -2
  31. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts +3 -1
  32. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -1
  33. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.js +95 -1
  34. package/dist/iframe/order-process/components/CategoryProduct/components/ProductWithModifier/ProductWithModifier.d.ts +22 -0
  35. package/dist/iframe/order-process/components/CategoryProduct/components/ProductWithModifier/ProductWithModifier.d.ts.map +1 -0
  36. package/dist/iframe/order-process/components/CategoryProduct/components/ProductWithModifier/ProductWithModifier.js +62 -0
  37. package/dist/iframe/order-process/components/CategoryProduct/constants.d.ts +2 -0
  38. package/dist/iframe/order-process/components/CategoryProduct/constants.d.ts.map +1 -0
  39. package/dist/iframe/order-process/components/CategoryProduct/constants.js +4 -0
  40. package/dist/iframe/order-process/components/utils/useOnWindowUnmount.d.ts +6 -0
  41. package/dist/iframe/order-process/components/utils/useOnWindowUnmount.d.ts.map +1 -0
  42. package/dist/iframe/order-process/components/utils/useOnWindowUnmount.js +18 -0
  43. package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts.map +1 -1
  44. package/dist/iframe/payment/order-items-table/hooks/useTableData.js +83 -10
  45. package/dist/iframe/payment/order-items-table/utils/index.d.ts.map +1 -1
  46. package/dist/iframe/payment/order-items-table/utils/index.js +15 -0
  47. package/dist/iframe/payment/order-items-table/utils/paymentSummary.js +2 -2
  48. package/dist/product-set/form/ProductSetForm.d.ts +3 -1
  49. package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
  50. package/dist/product-set/form/ProductSetForm.js +6 -4
  51. package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
  52. package/dist/product-set/form/ProductsControl.js +17 -5
  53. package/dist/product-set/form/context.d.ts +3 -1
  54. package/dist/product-set/form/context.d.ts.map +1 -1
  55. package/dist/product-set/form/context.js +2 -1
  56. package/dist/product-set/product/ProductControl.d.ts +8 -0
  57. package/dist/product-set/product/ProductControl.d.ts.map +1 -1
  58. package/dist/product-set/product/ProductControl.js +25 -1
  59. package/dist/product-set/utils/index.d.ts +88 -0
  60. package/dist/product-set/utils/index.d.ts.map +1 -1
  61. package/dist/product-set/utils/index.js +19 -1
  62. package/dist/sales/coupon/utils/index.d.ts +2 -1
  63. package/dist/sales/coupon/utils/index.d.ts.map +1 -1
  64. package/dist/styles/iframe-page/Page.scss +16 -0
  65. package/dist/styles/iframe-page/PageBody.scss +4 -0
  66. package/dist/styles/modals/Modals.scss +16 -0
  67. package/dist/styles/product-set/ProductSetForm.scss +10 -0
  68. package/dist/styles/sales/ManualBooking.scss +6 -0
  69. package/dist/styles/themes/bookedit/index.scss +19 -0
  70. package/package.json +6 -6
  71. package/src/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.tsx +205 -0
  72. package/src/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.tsx +75 -0
  73. package/src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.tsx +387 -0
  74. package/src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.tsx +96 -0
  75. package/src/iframe/ProductWithModifierModal/ModifierSetModal/index.ts +1 -0
  76. package/src/iframe/ProductWithModifierModal/index.ts +1 -0
  77. package/src/iframe/ProductWithModifierModal/utils.ts +28 -0
  78. package/src/iframe/event/ticket-description/TicketDescription.tsx +5 -3
  79. package/src/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.tsx +32 -1
  80. package/src/iframe/order-process/components/BookingSummary/utils/index.ts +45 -1
  81. package/src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx +155 -75
  82. package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +58 -1
  83. package/src/iframe/order-process/components/CategoryProduct/components/ProductWithModifier/ProductWithModifier.tsx +84 -0
  84. package/src/iframe/order-process/components/CategoryProduct/constants.ts +1 -0
  85. package/src/iframe/order-process/components/utils/useOnWindowUnmount.ts +25 -0
  86. package/src/iframe/payment/order-items-table/hooks/useTableData.tsx +84 -14
  87. package/src/iframe/payment/order-items-table/utils/index.ts +23 -0
  88. package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +2 -2
  89. package/src/product-set/form/ProductSetForm.tsx +11 -3
  90. package/src/product-set/form/ProductsControl.tsx +24 -15
  91. package/src/product-set/form/context.tsx +5 -0
  92. package/src/product-set/product/ProductControl.tsx +37 -1
  93. package/src/product-set/utils/index.ts +19 -0
  94. package/src/sales/coupon/utils/index.ts +5 -3
  95. package/src/styles/iframe-page/Page.scss +16 -0
  96. package/src/styles/iframe-page/PageBody.scss +4 -0
  97. package/src/styles/modals/Modals.scss +16 -0
  98. package/src/styles/product-set/ProductSetForm.scss +10 -0
  99. package/src/styles/sales/ManualBooking.scss +6 -0
  100. package/src/styles/themes/bookedit/index.scss +19 -0
  101. package/yarn.lock +177 -205
@@ -0,0 +1,399 @@
1
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
+ import { Col, Form } from 'react-bootstrap';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { useMemo, useEffect } from 'react';
5
+ import { useId } from '@mantine/hooks';
6
+ import { useFormContext, Controller } from 'react-hook-form';
7
+ import { xor } from 'lodash';
8
+ import clsx from 'clsx';
9
+ import { Currency } from '@licklist/core/dist/Config';
10
+ import { useIntl } from 'react-intl';
11
+ import { MAX_PRODUCT_NUMBER } from '../../../order-process/components/CategoryProduct/constants.js';
12
+ import 'recharts';
13
+ import 'react-loader';
14
+ import '@licklist/plugins/dist/hooks/Media/useWindowDimensions';
15
+ import 'moment';
16
+ import '@react-aria/utils';
17
+ import 'react-date-range';
18
+ import 'react-use';
19
+ import 'react-icons/fa';
20
+ import 'luxon';
21
+ import 'react-date-range/dist/styles.css';
22
+ import 'react-date-range/dist/theme/default.css';
23
+ import '@licklist/core/dist/DataMapper/User/UserDetailDataMapper';
24
+ import 'react-bootstrap/Col';
25
+ import 'react-bootstrap/Row';
26
+ import '@licklist/plugins/dist/services/Media/MediaService';
27
+ import '@licklist/plugins/dist/services/Form/FormErrorService';
28
+ import '@licklist/core/dist/DataMapper/Product/CouponDataMapper';
29
+ import '@licklist/plugins/dist/validation/Rules/couponCodeRules';
30
+ import 'react-select';
31
+ import 'rrule';
32
+ import '@licklist/core/dist/Services';
33
+ import { NumberInputHorizontal } from '../../../../sales/manual-booking/number-input-horizontal/NumberInputHorizontal.js';
34
+ import '@licklist/core/dist/DataMapper/Product/ProductSetDataMapper';
35
+ import '@licklist/plugins/dist/utils/relyOnPeople';
36
+ import 'react-highlighter';
37
+ import '@licklist/plugins/dist';
38
+ import '@licklist/core/dist/Config/DefaultUser';
39
+ import '../../../../typeahead-helper/TypeaheadHelperComponent.js';
40
+ import 'react-bootstrap/ModalHeader';
41
+ import 'react-bootstrap/ModalTitle';
42
+ import '../../../../sales/constants.js';
43
+ import '../../../../static/CurrencyNumberInput.js';
44
+ import '@licklist/core/dist/DataMapper/Order/OrderPaymentDataMapper';
45
+ import '@licklist/plugins/dist/context/sale/SalePaymentFormContext';
46
+ import '@licklist/core/dist/Services/Date';
47
+ import 'react-router-dom';
48
+ import '../../../../static/index.js';
49
+ import '@licklist/core/dist/DataMapper/Order/OrderDataMapper';
50
+ import '@licklist/plugins/dist/utils/formatDate';
51
+ import '@licklist/plugins/dist/utils/sourceTitle';
52
+ import 'react-bootstrap/ModalBody';
53
+ import 'react-bootstrap/ModalFooter';
54
+ import 'react-bootstrap/Modal';
55
+ import 'react-bootstrap/PageItem';
56
+ import '@licklist/plugins/dist/services/Table/PaginationService';
57
+ import '@licklist/plugins/dist/services/Table/TableService';
58
+ import '@licklist/plugins/dist/hooks/Query/useQuery';
59
+ import '@licklist/plugins/dist/services/Route/RouteService';
60
+ import '../../../../table/utils/index.js';
61
+ import '@tanstack/react-table';
62
+
63
+ var ModifiersSetControl = function(param) {
64
+ var modifierSet = param.modifierSet, modifiers = param.modifiers, productId = param.productId, _param_isLoading = param.isLoading, isLoading = _param_isLoading === void 0 ? false : _param_isLoading, _param_isEditMode = param.isEditMode, isEditMode = _param_isEditMode === void 0 ? false : _param_isEditMode, orderProductModifierSets = param.orderProductModifierSets;
65
+ var _useFormContext = useFormContext(), control = _useFormContext.control, watch = _useFormContext.watch, setValue = _useFormContext.setValue, trigger = _useFormContext.trigger;
66
+ var t = useTranslation('App').t;
67
+ var orderModifiersSets = watch("".concat(productId, ".orderProductModifiers"));
68
+ var formatNumber = useIntl().formatNumber;
69
+ var formatToCurrency = function(value) {
70
+ return formatNumber(value, {
71
+ style: 'currency',
72
+ currency: Currency.GBP
73
+ });
74
+ };
75
+ var currentOrderModifiersSets = useMemo(function() {
76
+ return (orderProductModifierSets === null || orderProductModifierSets === void 0 ? void 0 : orderProductModifierSets.filter(function(modifier) {
77
+ return modifier.modifierSetId === modifierSet.id;
78
+ })) || [];
79
+ }, [
80
+ orderProductModifierSets,
81
+ modifierSet.id
82
+ ]);
83
+ var onChangeModifiers = function(e, type, quantity) {
84
+ var _orderModifiersSets_find;
85
+ if (!modifiers) return;
86
+ var selectedModifier = modifiers === null || modifiers === void 0 ? void 0 : modifiers.find(function(item) {
87
+ return item.id === Number(e.target.defaultValue || e.target.id);
88
+ });
89
+ var checkSelectedModifier = (orderModifiersSets === null || orderModifiersSets === void 0 ? void 0 : (_orderModifiersSets_find = orderModifiersSets.find(function(modifier) {
90
+ return (modifier === null || modifier === void 0 ? void 0 : modifier.modifierId) === (selectedModifier === null || selectedModifier === void 0 ? void 0 : selectedModifier.id);
91
+ })) === null || _orderModifiersSets_find === void 0 ? void 0 : _orderModifiersSets_find.quantity) === 1;
92
+ if (selectedModifier && type === 'radio') {
93
+ modifiers.forEach(function(modifier) {
94
+ var isSelected = modifier.id === selectedModifier.id;
95
+ var orderModifiers = {
96
+ modifierId: modifier.id,
97
+ price: modifier.price,
98
+ productId: productId,
99
+ name: modifier.name,
100
+ quantity: isSelected ? 1 : 0,
101
+ modifierSetId: modifierSet.id
102
+ };
103
+ setValue("".concat(productId, ".orderProductModifiers.").concat(modifierSet.id), orderModifiers);
104
+ });
105
+ }
106
+ if (selectedModifier && type === 'checkbox') {
107
+ var orderModifiers = {
108
+ modifierId: selectedModifier.id,
109
+ price: selectedModifier.price,
110
+ productId: productId,
111
+ name: selectedModifier.name,
112
+ quantity: checkSelectedModifier ? 0 : 1,
113
+ modifierSetId: modifierSet.id
114
+ };
115
+ setValue("".concat(productId, ".orderProductModifiers.").concat(modifierSet.id, ".").concat(selectedModifier.id), orderModifiers);
116
+ }
117
+ if (selectedModifier && type === 'selector' && quantity) {
118
+ var orderModifiers1 = {
119
+ modifierId: selectedModifier.id,
120
+ price: selectedModifier.price,
121
+ productId: productId,
122
+ quantity: quantity,
123
+ name: selectedModifier.name,
124
+ modifierSetId: modifierSet.id
125
+ };
126
+ setValue("".concat(productId, ".orderProductModifiers.").concat(modifierSet.id, ".").concat(selectedModifier.id), orderModifiers1);
127
+ }
128
+ trigger("".concat(productId, ".orderProductModifiers"));
129
+ };
130
+ useEffect(function() {
131
+ if (!(orderProductModifierSets === null || orderProductModifierSets === void 0 ? void 0 : orderProductModifierSets.length)) return;
132
+ orderProductModifierSets.forEach(function(orderModifier) {
133
+ return setValue("".concat(productId, ".orderProductModifiers.").concat(orderModifier.modifierSetId, ".").concat(orderModifier.modifierId), orderModifier);
134
+ });
135
+ }, [
136
+ isEditMode
137
+ ]);
138
+ return /*#__PURE__*/ jsx(Fragment, {
139
+ children: (modifierSet === null || modifierSet === void 0 ? void 0 : modifierSet.maxItems) === 1 && modifiers.every(function(modifier) {
140
+ return modifier.maxItems === 1;
141
+ }) && !(currentOrderModifiersSets === null || currentOrderModifiersSets === void 0 ? void 0 : currentOrderModifiersSets.find(function(modifier) {
142
+ return !!(modifier === null || modifier === void 0 ? void 0 : modifier.quantity);
143
+ })) ? /*#__PURE__*/ jsx(Fragment, {
144
+ children: /*#__PURE__*/ jsx(Controller, {
145
+ name: "".concat(productId, ".orderProductModifiers.").concat(modifierSet.id),
146
+ control: control,
147
+ rules: {
148
+ required: {
149
+ value: !!modifierSet.minItems,
150
+ message: t('Validation:fieldRequired')
151
+ }
152
+ },
153
+ render: function(param) {
154
+ var field = param.field, fieldState = param.fieldState;
155
+ var onChange = function(e) {
156
+ onChangeModifiers(e, 'radio');
157
+ field.onChange(e.target.id);
158
+ };
159
+ return /*#__PURE__*/ jsxs(Fragment, {
160
+ children: [
161
+ modifiers.map(function(modifier) {
162
+ var _currentOrderModifiersSets_find_modifierId, _currentOrderModifiersSets_find;
163
+ var selectedOrderModifierId = currentOrderModifiersSets === null || currentOrderModifiersSets === void 0 ? void 0 : (_currentOrderModifiersSets_find = currentOrderModifiersSets.find(function(orderModifier) {
164
+ return orderModifier.modifierId === modifier.id;
165
+ })) === null || _currentOrderModifiersSets_find === void 0 ? void 0 : (_currentOrderModifiersSets_find_modifierId = _currentOrderModifiersSets_find.modifierId) === null || _currentOrderModifiersSets_find_modifierId === void 0 ? void 0 : _currentOrderModifiersSets_find_modifierId.toString();
166
+ return /*#__PURE__*/ jsx(Col, {
167
+ children: /*#__PURE__*/ jsxs("div", {
168
+ className: "modifier-container d-flex flex-column p-2",
169
+ children: [
170
+ /*#__PURE__*/ jsx(Form.Check, {
171
+ className: "custom-radio p-2",
172
+ inline: true,
173
+ id: modifier.id.toString(),
174
+ defaultChecked: !!selectedOrderModifierId,
175
+ defaultValue: modifier.id.toString(),
176
+ checked: field.value === modifier.id.toString(),
177
+ onChange: onChange,
178
+ type: "radio",
179
+ label: modifier.name,
180
+ name: modifier.name
181
+ }),
182
+ /*#__PURE__*/ jsxs("div", {
183
+ className: "mt-3 w-100 pl-2",
184
+ children: [
185
+ /*#__PURE__*/ jsx("p", {
186
+ children: modifier.description
187
+ }),
188
+ /*#__PURE__*/ jsxs("div", {
189
+ className: "price",
190
+ children: [
191
+ "+ ",
192
+ formatToCurrency(modifier.price)
193
+ ]
194
+ })
195
+ ]
196
+ })
197
+ ]
198
+ })
199
+ }, modifier.id);
200
+ }),
201
+ fieldState.error && /*#__PURE__*/ jsx("div", {
202
+ className: "invalid-feedback d-block",
203
+ children: fieldState.error.message
204
+ })
205
+ ]
206
+ });
207
+ }
208
+ })
209
+ }) : /*#__PURE__*/ jsx(Fragment, {
210
+ children: modifiers === null || modifiers === void 0 ? void 0 : modifiers.map(function(modifier, index) {
211
+ var _currentOrderModifiersSets_find;
212
+ var selectedOrderModifier = currentOrderModifiersSets === null || currentOrderModifiersSets === void 0 ? void 0 : (_currentOrderModifiersSets_find = currentOrderModifiersSets.find(function(orderModifier) {
213
+ return orderModifier.modifierId === modifier.id;
214
+ })) === null || _currentOrderModifiersSets_find === void 0 ? void 0 : _currentOrderModifiersSets_find.quantity;
215
+ return /*#__PURE__*/ jsx(Fragment, {
216
+ children: modifier.maxItems === 1 ? /*#__PURE__*/ jsx(Fragment, {
217
+ children: /*#__PURE__*/ jsx(Controller, {
218
+ name: "".concat(productId, ".").concat(modifierSet.id, ".modifiers[").concat(index, "]"),
219
+ control: control,
220
+ rules: {
221
+ required: {
222
+ value: !!modifier.minItems,
223
+ message: t('Validation:fieldRequired')
224
+ },
225
+ validate: function(value) {
226
+ var maxItems = modifier.maxItems, minItems = modifier.minItems;
227
+ if ((value === null || value === void 0 ? void 0 : value.length) > maxItems) {
228
+ return t('Validation:quantityMaxNumberModifier', {
229
+ max: maxItems
230
+ });
231
+ }
232
+ if ((value === null || value === void 0 ? void 0 : value.length) < minItems) {
233
+ return t('Validation:quantityMinNumberModifier', {
234
+ min: minItems
235
+ });
236
+ }
237
+ return true;
238
+ }
239
+ },
240
+ render: function(param) {
241
+ var field = param.field, error = param.fieldState.error;
242
+ var onChange = function(e) {
243
+ onChangeModifiers(e, 'checkbox');
244
+ field.onChange(xor(field.value, [
245
+ Number(e.target.value)
246
+ ]));
247
+ };
248
+ return /*#__PURE__*/ jsxs(Col, {
249
+ className: "modifier-container pl-4",
250
+ children: [
251
+ /*#__PURE__*/ jsx("div", {
252
+ className: "d-flex justify-content-between pl-2 align-items-center",
253
+ children: /*#__PURE__*/ jsx(Checkbox, {
254
+ value: modifier.id,
255
+ onChange: onChange,
256
+ label: modifier.name,
257
+ defaultChecked: !!selectedOrderModifier
258
+ })
259
+ }),
260
+ /*#__PURE__*/ jsxs("div", {
261
+ className: "mt-3 w-100 pl-2",
262
+ children: [
263
+ /*#__PURE__*/ jsx("p", {
264
+ children: modifier.description
265
+ }),
266
+ /*#__PURE__*/ jsxs("div", {
267
+ className: "price",
268
+ children: [
269
+ "+ ",
270
+ formatToCurrency(modifier.price)
271
+ ]
272
+ })
273
+ ]
274
+ }),
275
+ (error === null || error === void 0 ? void 0 : error.message) && /*#__PURE__*/ jsx("div", {
276
+ className: "invalid-feedback d-flex",
277
+ children: error === null || error === void 0 ? void 0 : error.message
278
+ })
279
+ ]
280
+ }, modifier.id.toString());
281
+ }
282
+ })
283
+ }) : /*#__PURE__*/ jsxs(Fragment, {
284
+ children: [
285
+ /*#__PURE__*/ jsx("div", {
286
+ className: "modifier-header m-0",
287
+ children: /*#__PURE__*/ jsx("div", {
288
+ className: "title",
289
+ children: modifier.name
290
+ })
291
+ }),
292
+ /*#__PURE__*/ jsx(Controller, {
293
+ control: control,
294
+ name: "".concat(productId, ".").concat(modifierSet.id, ".modifiers[").concat(index, "].quantity"),
295
+ rules: {
296
+ required: {
297
+ value: !!modifier.minItems,
298
+ message: t('Validation:fieldRequired')
299
+ },
300
+ validate: function(value) {
301
+ var maxItems = modifier.maxItems, minItems = modifier.minItems;
302
+ if (value > maxItems) {
303
+ return t('Validation:quantityMaxNumberModifier', {
304
+ max: maxItems
305
+ });
306
+ }
307
+ if (value < minItems) {
308
+ return t('Validation:quantityMinNumberModifier', {
309
+ min: minItems
310
+ });
311
+ }
312
+ return true;
313
+ }
314
+ },
315
+ render: function(param) {
316
+ var _param_field = param.field, onChange = _param_field.onChange, value = _param_field.value, ref = _param_field.ref, _param_fieldState = param.fieldState, invalid = _param_fieldState.invalid, error = _param_fieldState.error;
317
+ var onChangeProductQuantity = function(val) {
318
+ var quantity = Math.min(MAX_PRODUCT_NUMBER, Math.max(0, Math.ceil(val)));
319
+ onChange(quantity);
320
+ trigger("".concat(productId, ".").concat(modifierSet.id, ".modifiers[").concat(index, "].quantity"));
321
+ onChangeModifiers({
322
+ target: {
323
+ id: modifier.id.toString()
324
+ }
325
+ }, 'selector', quantity);
326
+ };
327
+ var _ref;
328
+ return /*#__PURE__*/ jsxs("div", {
329
+ className: "modifier-container",
330
+ children: [
331
+ /*#__PURE__*/ jsx("div", {
332
+ className: "d-flex align-items-center column mb-8 pl-6 pt-2",
333
+ children: /*#__PURE__*/ jsx("div", {
334
+ className: "quantity-container mb-0",
335
+ children: /*#__PURE__*/ jsx(NumberInputHorizontal, {
336
+ ref: ref,
337
+ size: "big",
338
+ onChange: onChangeProductQuantity,
339
+ onMinusClick: onChangeProductQuantity,
340
+ onPlusClick: onChangeProductQuantity,
341
+ min: 0,
342
+ max: MAX_PRODUCT_NUMBER,
343
+ value: (_ref = value !== null && value !== void 0 ? value : selectedOrderModifier) !== null && _ref !== void 0 ? _ref : 0,
344
+ className: clsx(invalid && 'error'),
345
+ isLoading: isLoading
346
+ })
347
+ })
348
+ }),
349
+ /*#__PURE__*/ jsxs("div", {
350
+ className: "p-2 mt-3 w-100 pl-4",
351
+ children: [
352
+ /*#__PURE__*/ jsx("p", {
353
+ className: "pl-2",
354
+ children: modifier.description
355
+ }),
356
+ /*#__PURE__*/ jsxs("div", {
357
+ className: "pl-2 price",
358
+ children: [
359
+ "+ ",
360
+ formatToCurrency(modifier.price)
361
+ ]
362
+ }),
363
+ (error === null || error === void 0 ? void 0 : error.message) && /*#__PURE__*/ jsx("div", {
364
+ className: "d-flex mt-3 w-100",
365
+ children: /*#__PURE__*/ jsx("p", {
366
+ className: "iframe-event__message-error",
367
+ children: error.message
368
+ })
369
+ })
370
+ ]
371
+ })
372
+ ]
373
+ });
374
+ }
375
+ })
376
+ ]
377
+ })
378
+ });
379
+ })
380
+ })
381
+ });
382
+ };
383
+ var Checkbox = function(param) {
384
+ var onChange = param.onChange, value = param.value, label = param.label, defaultChecked = param.defaultChecked;
385
+ var checkboxId = useId();
386
+ return /*#__PURE__*/ jsx(Form.Group, {
387
+ controlId: checkboxId,
388
+ className: "custom-checkbox mt-0",
389
+ children: /*#__PURE__*/ jsx(Form.Check, {
390
+ label: label,
391
+ value: value,
392
+ defaultChecked: defaultChecked,
393
+ onChange: onChange,
394
+ type: "checkbox"
395
+ })
396
+ });
397
+ };
398
+
399
+ export { ModifiersSetControl };
@@ -0,0 +1,10 @@
1
+ import { OrderModifierByProduct } from '@licklist/core/dist/DataMapper/Order/OrderModifiierByProduct';
2
+ import { Product } from '@licklist/plugins/dist/types/context/sale/menuSteps';
3
+ interface ProductControlProps {
4
+ product: Product;
5
+ isLoading?: boolean;
6
+ editOrderModifier?: OrderModifierByProduct;
7
+ }
8
+ export declare const ProductControl: ({ product, isLoading, editOrderModifier, }: ProductControlProps) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
10
+ //# sourceMappingURL=ProductControll.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProductControll.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8DAA8D,CAAA;AACrG,OAAO,EAAE,OAAO,EAAE,MAAM,qDAAqD,CAAA;AAK7E,UAAU,mBAAmB;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,iBAAiB,CAAC,EAAE,sBAAsB,CAAA;CAC3C;AAED,eAAO,MAAM,cAAc,+CAIxB,mBAAmB,4CA6ErB,CAAA"}
@@ -0,0 +1,87 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { useEffect } from 'react';
3
+ import { useFormContext, Controller } from 'react-hook-form';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { ModifiersSetControl } from './ModifierSetControll.js';
6
+ import { orderProductModifiersQuantity } from '../../utils.js';
7
+
8
+ var ProductControl = function(param) {
9
+ var product = param.product, _param_isLoading = param.isLoading, isLoading = _param_isLoading === void 0 ? false : _param_isLoading, editOrderModifier = param.editOrderModifier;
10
+ var t = useTranslation() // Added translation hook
11
+ .t;
12
+ var _useFormContext = useFormContext(), control = _useFormContext.control, watch = _useFormContext.watch, isValid = _useFormContext.formState.isValid, clearErrors = _useFormContext.clearErrors;
13
+ var modifiersSet = (product === null || product === void 0 ? void 0 : product.modifiersSet) || [];
14
+ var orderModifiersSets = watch("".concat(product.id, ".orderProductModifiers"));
15
+ useEffect(function() {
16
+ if (!isValid) return;
17
+ clearErrors();
18
+ }, [
19
+ isValid,
20
+ clearErrors
21
+ ]);
22
+ return /*#__PURE__*/ jsx("div", {
23
+ className: "mb-8 pt-4",
24
+ children: /*#__PURE__*/ jsx("div", {
25
+ className: "d-flex flex-column",
26
+ children: modifiersSet.map(function(modifierSet) {
27
+ var orderProductModifiersMaxQuantity = orderProductModifiersQuantity(orderModifiersSets, modifierSet);
28
+ return /*#__PURE__*/ jsxs("div", {
29
+ className: "modifier-set-container",
30
+ children: [
31
+ /*#__PURE__*/ jsx("div", {
32
+ className: "modifier-header",
33
+ children: /*#__PURE__*/ jsx("div", {
34
+ className: "title",
35
+ children: modifierSet.name
36
+ })
37
+ }),
38
+ /*#__PURE__*/ jsx(Controller, {
39
+ control: control,
40
+ name: "".concat(product.id, ".").concat(modifierSet.id),
41
+ rules: {
42
+ validate: function() {
43
+ var maxItems = modifierSet.maxItems, minItems = modifierSet.minItems;
44
+ if (!!minItems && orderProductModifiersMaxQuantity < minItems) {
45
+ return t('Validation:quantityMinNumberModifier', {
46
+ min: minItems
47
+ });
48
+ }
49
+ if (orderProductModifiersMaxQuantity > maxItems) {
50
+ return t('Validation:quantityMaxNumberModifier', {
51
+ max: maxItems
52
+ });
53
+ }
54
+ return true;
55
+ }
56
+ },
57
+ render: function(param) {
58
+ var error = param.fieldState.error;
59
+ return /*#__PURE__*/ jsxs(Fragment, {
60
+ children: [
61
+ /*#__PURE__*/ jsx(ModifiersSetControl, {
62
+ modifierSet: modifierSet,
63
+ productId: product.id,
64
+ modifiers: modifierSet.modifiers,
65
+ isEditMode: !!(editOrderModifier === null || editOrderModifier === void 0 ? void 0 : editOrderModifier.modifiers),
66
+ orderProductModifierSets: editOrderModifier === null || editOrderModifier === void 0 ? void 0 : editOrderModifier.modifiers,
67
+ isLoading: isLoading
68
+ }),
69
+ (error === null || error === void 0 ? void 0 : error.message) && /*#__PURE__*/ jsxs("div", {
70
+ className: "invalid-feedback d-flex pl-4",
71
+ children: [
72
+ error === null || error === void 0 ? void 0 : error.message,
73
+ "!"
74
+ ]
75
+ })
76
+ ]
77
+ });
78
+ }
79
+ })
80
+ ]
81
+ }, modifierSet.id);
82
+ })
83
+ })
84
+ });
85
+ };
86
+
87
+ export { ProductControl };
@@ -0,0 +1,2 @@
1
+ import './ProductWithModifierSetModal.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/iframe/ProductWithModifierModal/ModifierSetModal/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { ProductWithModifierSetModal } from './ModifierSetModal/ProductWithModifierSetModal';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/iframe/ProductWithModifierModal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { OrderModifier } from "@licklist/core/dist/DataMapper/Order/OrderModifierDataMapper";
2
+ export type selectModifierType = 'radio' | 'checkbox' | 'selector';
3
+ export declare const filteredOrderModifierSets: (modifiersSet: OrderModifier[]) => OrderModifier[];
4
+ export declare const orderProductModifiersQuantity: (orderModifiersSets: OrderModifier[], modifierSet: any) => number;
5
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/iframe/ProductWithModifierModal/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAA;AAG5F,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAA;AAElE,eAAO,MAAM,yBAAyB,iBACpB,aAAa,EAAE,KAC5B,aAAa,EAUf,CAAA;AAED,eAAO,MAAM,6BAA6B,uBACpB,aAAa,EAAE,6BAOpC,CAAA"}
@@ -0,0 +1,19 @@
1
+ import { uniqBy } from 'lodash';
2
+
3
+ var filteredOrderModifierSets = function(modifiersSet) {
4
+ if (!modifiersSet) return [];
5
+ var orderModifier = modifiersSet.flat().filter(function(modifier) {
6
+ return !!(modifier === null || modifier === void 0 ? void 0 : modifier.quantity);
7
+ });
8
+ return uniqBy(orderModifier, function(item) {
9
+ return "".concat(item.modifierId, "-").concat(item.modifierSetId);
10
+ });
11
+ };
12
+ var orderProductModifiersQuantity = function(orderModifiersSets, modifierSet) {
13
+ var filteredOrderModifier = filteredOrderModifierSets(orderModifiersSets);
14
+ return filteredOrderModifier.filter(function(item) {
15
+ return (item === null || item === void 0 ? void 0 : item.modifierSetId) === modifierSet.id;
16
+ }).length;
17
+ };
18
+
19
+ export { filteredOrderModifierSets, orderProductModifiersQuantity };
@@ -4,11 +4,12 @@ interface TicketDescriptionProps {
4
4
  title: string;
5
5
  description: string;
6
6
  className?: string;
7
+ classNameProductModal?: string;
7
8
  images: Image[] | null;
8
9
  price?: ReactNode;
9
10
  isRequired?: boolean;
10
11
  canExpand?: boolean;
11
12
  }
12
- export declare function TicketDescription({ title, description, className, images, price, isRequired, canExpand, }: TicketDescriptionProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare function TicketDescription({ title, description, className, classNameProductModal, images, price, isRequired, canExpand, }: TicketDescriptionProps): import("react/jsx-runtime").JSX.Element;
13
14
  export {};
14
15
  //# sourceMappingURL=TicketDescription.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TicketDescription.d.ts","sourceRoot":"","sources":["../../../../src/iframe/event/ticket-description/TicketDescription.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAY,MAAM,OAAO,CAAA;AAE1D,OAAO,EACL,KAAK,EAEN,MAAM,sDAAsD,CAAA;AAK7D,UAAU,sBAAsB;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAA;IACtB,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAID,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,WAAW,EACX,SAAc,EACd,MAAM,EACN,KAAK,EACL,UAAkB,EAClB,SAAgB,GACjB,EAAE,sBAAsB,2CAiDxB"}
1
+ {"version":3,"file":"TicketDescription.d.ts","sourceRoot":"","sources":["../../../../src/iframe/event/ticket-description/TicketDescription.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAY,MAAM,OAAO,CAAA;AAE1D,OAAO,EACL,KAAK,EAEN,MAAM,sDAAsD,CAAA;AAK7D,UAAU,sBAAsB;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAA;IACtB,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAID,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,WAAW,EACX,SAAc,EACd,qBAA0B,EAC1B,MAAM,EACN,KAAK,EACL,UAAkB,EAClB,SAAgB,GACjB,EAAE,sBAAsB,2CAiDxB"}
@@ -54,7 +54,7 @@ function _unsupported_iterable_to_array(o, minLen) {
54
54
  }
55
55
  var DESCRIPTION_MAX_LENGTH = 120;
56
56
  function TicketDescription(param) {
57
- var title = param.title, description = param.description, _param_className = param.className, className = _param_className === void 0 ? '' : _param_className, images = param.images, price = param.price, _param_isRequired = param.isRequired, isRequired = _param_isRequired === void 0 ? false : _param_isRequired, _param_canExpand = param.canExpand, canExpand = _param_canExpand === void 0 ? true : _param_canExpand;
57
+ var title = param.title, description = param.description, _param_className = param.className, className = _param_className === void 0 ? '' : _param_className, _param_classNameProductModal = param.classNameProductModal, classNameProductModal = _param_classNameProductModal === void 0 ? '' : _param_classNameProductModal, images = param.images, price = param.price, _param_isRequired = param.isRequired, isRequired = _param_isRequired === void 0 ? false : _param_isRequired, _param_canExpand = param.canExpand, canExpand = _param_canExpand === void 0 ? true : _param_canExpand;
58
58
  var _useState = _sliced_to_array(useState(false), 2), isDescriptionExpanded = _useState[0], setIsDescriptionExpanded = _useState[1];
59
59
  var wrapperClasses = clsx('ticket-description', className);
60
60
  var imageSrc = images ? MediaService.getImageSrc(images, THUMBNAIL_IMAGE_SIZE) : null;
@@ -68,11 +68,12 @@ function TicketDescription(param) {
68
68
  className: "ticket-description__wrapper",
69
69
  style: descriptionWrapperStyle,
70
70
  children: /*#__PURE__*/ jsxs("div", {
71
- className: "ticket-description__wrapper-children",
71
+ className: clsx('ticket-description__wrapper-children', classNameProductModal),
72
72
  children: [
73
73
  imageSrc && /*#__PURE__*/ jsx("div", {
74
- className: "image-wrapper",
74
+ className: clsx('image-wrapper', classNameProductModal && 'w-100 h-25'),
75
75
  children: /*#__PURE__*/ jsx("img", {
76
+ className: clsx(classNameProductModal && 'w-100'),
76
77
  src: imageSrc,
77
78
  alt: title
78
79
  })
@@ -1 +1 @@
1
- {"version":3,"file":"ProductSummary.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,wDAAwD,CAAA;AAElF,KAAK,mBAAmB,GAAG;IACzB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,YAAY,EAAE,SAAS,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,cAAc,kDAIxB,mBAAmB,4CA2BrB,CAAA"}
1
+ {"version":3,"file":"ProductSummary.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,wDAAwD,CAAA;AAGlF,KAAK,mBAAmB,GAAG;IACzB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,YAAY,EAAE,SAAS,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,cAAc,kDAIxB,mBAAmB,4CAyDrB,CAAA"}