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

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 (97) 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 +16 -0
  9. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.d.ts.map +1 -0
  10. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.js +447 -0
  11. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.d.ts +12 -0
  12. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.d.ts.map +1 -0
  13. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.js +45 -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/event/ticket-description/TicketDescription.d.ts +2 -1
  19. package/dist/iframe/event/ticket-description/TicketDescription.d.ts.map +1 -1
  20. package/dist/iframe/event/ticket-description/TicketDescription.js +4 -3
  21. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts.map +1 -1
  22. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.js +29 -2
  23. package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts +4 -0
  24. package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts.map +1 -1
  25. package/dist/iframe/order-process/components/BookingSummary/utils/index.js +27 -2
  26. package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts.map +1 -1
  27. package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.js +106 -2
  28. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts +3 -1
  29. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -1
  30. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.js +95 -1
  31. package/dist/iframe/order-process/components/CategoryProduct/components/ProductWithModifier/ProductWithModifier.d.ts +22 -0
  32. package/dist/iframe/order-process/components/CategoryProduct/components/ProductWithModifier/ProductWithModifier.d.ts.map +1 -0
  33. package/dist/iframe/order-process/components/CategoryProduct/components/ProductWithModifier/ProductWithModifier.js +62 -0
  34. package/dist/iframe/order-process/components/CategoryProduct/constants.d.ts +2 -0
  35. package/dist/iframe/order-process/components/CategoryProduct/constants.d.ts.map +1 -0
  36. package/dist/iframe/order-process/components/CategoryProduct/constants.js +4 -0
  37. package/dist/iframe/order-process/components/utils/useOnWindowUnmount.d.ts +6 -0
  38. package/dist/iframe/order-process/components/utils/useOnWindowUnmount.d.ts.map +1 -0
  39. package/dist/iframe/order-process/components/utils/useOnWindowUnmount.js +18 -0
  40. package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts.map +1 -1
  41. package/dist/iframe/payment/order-items-table/hooks/useTableData.js +83 -10
  42. package/dist/iframe/payment/order-items-table/utils/index.d.ts.map +1 -1
  43. package/dist/iframe/payment/order-items-table/utils/index.js +15 -0
  44. package/dist/iframe/payment/order-items-table/utils/paymentSummary.js +2 -2
  45. package/dist/product-set/form/ProductSetForm.d.ts +3 -1
  46. package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
  47. package/dist/product-set/form/ProductSetForm.js +6 -4
  48. package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
  49. package/dist/product-set/form/ProductsControl.js +17 -5
  50. package/dist/product-set/form/context.d.ts +3 -1
  51. package/dist/product-set/form/context.d.ts.map +1 -1
  52. package/dist/product-set/form/context.js +2 -1
  53. package/dist/product-set/product/ProductControl.d.ts +8 -0
  54. package/dist/product-set/product/ProductControl.d.ts.map +1 -1
  55. package/dist/product-set/product/ProductControl.js +25 -1
  56. package/dist/product-set/utils/index.d.ts +88 -0
  57. package/dist/product-set/utils/index.d.ts.map +1 -1
  58. package/dist/product-set/utils/index.js +19 -1
  59. package/dist/sales/coupon/utils/index.d.ts +2 -1
  60. package/dist/sales/coupon/utils/index.d.ts.map +1 -1
  61. package/dist/styles/iframe-page/Page.scss +16 -0
  62. package/dist/styles/iframe-page/PageBody.scss +4 -0
  63. package/dist/styles/modals/Modals.scss +16 -0
  64. package/dist/styles/product-set/ProductSetForm.scss +10 -0
  65. package/dist/styles/sales/ManualBooking.scss +6 -0
  66. package/dist/styles/themes/bookedit/index.scss +14 -0
  67. package/package.json +6 -6
  68. package/src/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.tsx +205 -0
  69. package/src/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.tsx +75 -0
  70. package/src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.tsx +471 -0
  71. package/src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.tsx +55 -0
  72. package/src/iframe/ProductWithModifierModal/ModifierSetModal/index.ts +1 -0
  73. package/src/iframe/ProductWithModifierModal/index.ts +1 -0
  74. package/src/iframe/event/ticket-description/TicketDescription.tsx +5 -3
  75. package/src/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.tsx +32 -1
  76. package/src/iframe/order-process/components/BookingSummary/utils/index.ts +45 -1
  77. package/src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx +155 -75
  78. package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +58 -1
  79. package/src/iframe/order-process/components/CategoryProduct/components/ProductWithModifier/ProductWithModifier.tsx +84 -0
  80. package/src/iframe/order-process/components/CategoryProduct/constants.ts +1 -0
  81. package/src/iframe/order-process/components/utils/useOnWindowUnmount.ts +25 -0
  82. package/src/iframe/payment/order-items-table/hooks/useTableData.tsx +84 -14
  83. package/src/iframe/payment/order-items-table/utils/index.ts +23 -0
  84. package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +2 -2
  85. package/src/product-set/form/ProductSetForm.tsx +11 -3
  86. package/src/product-set/form/ProductsControl.tsx +24 -15
  87. package/src/product-set/form/context.tsx +5 -0
  88. package/src/product-set/product/ProductControl.tsx +37 -1
  89. package/src/product-set/utils/index.ts +19 -0
  90. package/src/sales/coupon/utils/index.ts +5 -3
  91. package/src/styles/iframe-page/Page.scss +16 -0
  92. package/src/styles/iframe-page/PageBody.scss +4 -0
  93. package/src/styles/modals/Modals.scss +16 -0
  94. package/src/styles/product-set/ProductSetForm.scss +10 -0
  95. package/src/styles/sales/ManualBooking.scss +6 -0
  96. package/src/styles/themes/bookedit/index.scss +14 -0
  97. package/yarn.lock +171 -199
@@ -0,0 +1,447 @@
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, uniqBy } 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, modifiersSetWithErrors = param.modifiersSetWithErrors, 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 filteredOrderModifierSets = function(modifiersSet) {
68
+ if (!modifiersSet) return [];
69
+ var orderModifier = modifiersSet.flat().filter(function(modifier) {
70
+ return !!(modifier === null || modifier === void 0 ? void 0 : modifier.quantity);
71
+ });
72
+ return uniqBy(orderModifier, function(item) {
73
+ return "".concat(item.modifierId, "-").concat(item.modifierSetId);
74
+ });
75
+ };
76
+ var orderModifiersSets = watch("".concat(productId, ".orderProductModifiers"));
77
+ var formatNumber = useIntl().formatNumber;
78
+ var formatToCurrency = function(value) {
79
+ return formatNumber(value, {
80
+ style: 'currency',
81
+ currency: Currency.GBP
82
+ });
83
+ };
84
+ var orderProductModifiersQuantity = function(orderModifiersSets) {
85
+ var filteredOrderModifier = filteredOrderModifierSets(orderModifiersSets);
86
+ return filteredOrderModifier.flat().filter(function(item) {
87
+ return item && item.modifierSetId === modifierSet.id;
88
+ }).length;
89
+ };
90
+ var orderProductModifiersMaxQuantity = orderProductModifiersQuantity(orderModifiersSets);
91
+ var currentOrderModifiersSets = useMemo(function() {
92
+ return (orderProductModifierSets === null || orderProductModifierSets === void 0 ? void 0 : orderProductModifierSets.filter(function(modifier) {
93
+ return modifier.modifierSetId === modifierSet.id;
94
+ })) || [];
95
+ }, [
96
+ orderProductModifierSets,
97
+ modifierSet.id
98
+ ]);
99
+ var onChangeModifiers = function(e, type, quantity) {
100
+ var _orderModifiersSets_find;
101
+ if (!modifiers) return;
102
+ var selectedModifier = modifiers === null || modifiers === void 0 ? void 0 : modifiers.find(function(item) {
103
+ return item.id === Number(e.target.defaultValue || e.target.id);
104
+ });
105
+ var checkSelectedModifier = (orderModifiersSets === null || orderModifiersSets === void 0 ? void 0 : (_orderModifiersSets_find = orderModifiersSets.find(function(modifier) {
106
+ return (modifier === null || modifier === void 0 ? void 0 : modifier.modifierId) === (selectedModifier === null || selectedModifier === void 0 ? void 0 : selectedModifier.id);
107
+ })) === null || _orderModifiersSets_find === void 0 ? void 0 : _orderModifiersSets_find.quantity) === 1;
108
+ if (selectedModifier && type === 'radio') {
109
+ modifiers.forEach(function(modifier) {
110
+ var isSelected = modifier.id === selectedModifier.id;
111
+ var orderModifiers = {
112
+ modifierId: modifier.id,
113
+ price: modifier.price,
114
+ productId: productId,
115
+ name: modifier.name,
116
+ quantity: isSelected ? 1 : 0,
117
+ modifierSetId: modifierSet.id
118
+ };
119
+ setValue("".concat(productId, ".orderProductModifiers.").concat(modifierSet.id), orderModifiers);
120
+ });
121
+ }
122
+ if (selectedModifier && type === 'checkbox') {
123
+ var orderModifiers = {
124
+ modifierId: selectedModifier.id,
125
+ price: selectedModifier.price,
126
+ productId: productId,
127
+ name: selectedModifier.name,
128
+ quantity: checkSelectedModifier ? 0 : 1,
129
+ modifierSetId: modifierSet.id
130
+ };
131
+ setValue("".concat(productId, ".orderProductModifiers.").concat(modifierSet.id, ".").concat(selectedModifier.id), orderModifiers);
132
+ }
133
+ if (selectedModifier && type === 'selector' && quantity) {
134
+ var orderModifiers1 = {
135
+ modifierId: selectedModifier.id,
136
+ price: selectedModifier.price,
137
+ productId: productId,
138
+ quantity: quantity,
139
+ name: selectedModifier.name,
140
+ modifierSetId: modifierSet.id
141
+ };
142
+ setValue("".concat(productId, ".orderProductModifiers.").concat(modifierSet.id, ".").concat(selectedModifier.id), orderModifiers1);
143
+ }
144
+ };
145
+ useEffect(function() {
146
+ if (!(orderProductModifierSets === null || orderProductModifierSets === void 0 ? void 0 : orderProductModifierSets.length)) return;
147
+ orderProductModifierSets.forEach(function(orderModifier) {
148
+ return setValue("".concat(productId, ".orderProductModifiers.").concat(orderModifier.modifierSetId, ".").concat(orderModifier.modifierId), orderModifier);
149
+ });
150
+ }, [
151
+ isEditMode
152
+ ]);
153
+ var modifiersErrors = modifiersSetWithErrors === null || modifiersSetWithErrors === void 0 ? void 0 : modifiersSetWithErrors.modifiers;
154
+ return /*#__PURE__*/ jsx(Fragment, {
155
+ children: (modifierSet === null || modifierSet === void 0 ? void 0 : modifierSet.maxItems) === 1 && modifiers.every(function(modifier) {
156
+ return modifier.maxItems === 1;
157
+ }) && !(currentOrderModifiersSets === null || currentOrderModifiersSets === void 0 ? void 0 : currentOrderModifiersSets.find(function(modifier) {
158
+ return !!(modifier === null || modifier === void 0 ? void 0 : modifier.quantity);
159
+ })) ? /*#__PURE__*/ jsxs(Fragment, {
160
+ children: [
161
+ /*#__PURE__*/ jsx(Controller, {
162
+ name: "".concat(modifierSet.id),
163
+ "data-testid": "modifierSet-values-select",
164
+ control: control,
165
+ rules: {
166
+ required: !!modifierSet.minItems
167
+ },
168
+ render: function(param) {
169
+ var field = param.field;
170
+ var onChange = function(e) {
171
+ onChangeModifiers(e, 'radio');
172
+ field.onChange(e.target.id);
173
+ };
174
+ return /*#__PURE__*/ jsx(Fragment, {
175
+ children: modifiers === null || modifiers === void 0 ? void 0 : modifiers.map(function(modifier) {
176
+ var _currentOrderModifiersSets_find_modifierId, _currentOrderModifiersSets_find;
177
+ var selectedOrderModifierId = currentOrderModifiersSets === null || currentOrderModifiersSets === void 0 ? void 0 : (_currentOrderModifiersSets_find = currentOrderModifiersSets.find(function(orderModifier) {
178
+ return orderModifier.modifierId === modifier.id;
179
+ })) === 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();
180
+ return /*#__PURE__*/ jsx(Col, {
181
+ children: /*#__PURE__*/ jsxs(Fragment, {
182
+ children: [
183
+ /*#__PURE__*/ jsx("div", {
184
+ className: "modifier-container d-flex justify-content-between align-items-center p-2",
185
+ children: /*#__PURE__*/ jsx(Form.Check, {
186
+ className: "custom-radio",
187
+ inline: true,
188
+ id: modifier.id.toString(),
189
+ defaultChecked: !!selectedOrderModifierId,
190
+ defaultValue: modifier.id.toString(),
191
+ checked: field.value === modifier.id.toString(),
192
+ onChange: onChange,
193
+ type: "radio",
194
+ label: modifier.name,
195
+ name: modifier.name
196
+ })
197
+ }),
198
+ /*#__PURE__*/ jsxs("div", {
199
+ className: "mt-3 w-100 pl-2",
200
+ children: [
201
+ /*#__PURE__*/ jsx("p", {
202
+ children: modifier.description
203
+ }),
204
+ /*#__PURE__*/ jsxs("div", {
205
+ className: "price",
206
+ children: [
207
+ "+ ",
208
+ formatToCurrency(modifier.price)
209
+ ]
210
+ })
211
+ ]
212
+ })
213
+ ]
214
+ })
215
+ }, modifier.id.toString());
216
+ })
217
+ });
218
+ }
219
+ }),
220
+ (modifiersErrors === null || modifiersErrors === void 0 ? void 0 : modifiersErrors.message) && /*#__PURE__*/ jsx(Col, {
221
+ children: /*#__PURE__*/ jsx("div", {
222
+ className: "invalid-feedback field-values-error",
223
+ children: modifiersSetWithErrors.message || 'test'
224
+ })
225
+ })
226
+ ]
227
+ }) : /*#__PURE__*/ jsx(Fragment, {
228
+ children: modifiers === null || modifiers === void 0 ? void 0 : modifiers.map(function(modifier, index) {
229
+ var _currentOrderModifiersSets_find, _modifiersErrors_find;
230
+ var selectedOrderModifier = currentOrderModifiersSets === null || currentOrderModifiersSets === void 0 ? void 0 : (_currentOrderModifiersSets_find = currentOrderModifiersSets.find(function(orderModifier) {
231
+ return orderModifier.modifierId === modifier.id;
232
+ })) === null || _currentOrderModifiersSets_find === void 0 ? void 0 : _currentOrderModifiersSets_find.quantity;
233
+ var requiredModifierSet = (modifierSet === null || modifierSet === void 0 ? void 0 : modifierSet.minItems) > currentOrderModifiersSets.length;
234
+ var errorMessage = modifiersErrors === null || modifiersErrors === void 0 ? void 0 : (_modifiersErrors_find = modifiersErrors.find(function(modifier) {
235
+ return modifier.ref && modifier.ref.name === "modifiers[".concat(index, "]");
236
+ })) === null || _modifiersErrors_find === void 0 ? void 0 : _modifiersErrors_find.message;
237
+ return /*#__PURE__*/ jsxs(Fragment, {
238
+ children: [
239
+ modifier.maxItems === 1 ? /*#__PURE__*/ jsx(Fragment, {
240
+ children: /*#__PURE__*/ jsx(Controller, {
241
+ name: "modifiers[".concat(index, "]"),
242
+ control: control,
243
+ rules: {
244
+ required: !!modifier.minItems || requiredModifierSet,
245
+ validate: function(value) {
246
+ if (!value) return true;
247
+ var maxModifierSet = modifierSet.maxItems, minModifierSet = modifierSet.minItems;
248
+ if (orderProductModifiersMaxQuantity < minModifierSet) {
249
+ return t('Validation:quantityMinNumberModifier', {
250
+ min: minModifierSet
251
+ });
252
+ }
253
+ if (orderProductModifiersMaxQuantity > maxModifierSet) {
254
+ return t('Validation:quantityMaxNumberModifier', {
255
+ max: maxModifierSet
256
+ });
257
+ }
258
+ var maxItems = modifier.maxItems, minItems = modifier.minItems;
259
+ if ((value === null || value === void 0 ? void 0 : value.length) > maxItems) {
260
+ return t('Validation:quantityMaxNumberModifier', {
261
+ max: maxItems
262
+ });
263
+ }
264
+ if ((value === null || value === void 0 ? void 0 : value.length) < minItems) {
265
+ return t('Validation:quantityMinNumberModifier', {
266
+ min: minItems
267
+ });
268
+ }
269
+ return true;
270
+ }
271
+ },
272
+ render: function(param) {
273
+ var field = param.field;
274
+ var onChange = function(e) {
275
+ onChangeModifiers(e, 'checkbox');
276
+ field.onChange(xor(field.value, [
277
+ Number(e.target.value)
278
+ ]));
279
+ };
280
+ return /*#__PURE__*/ jsxs(Col, {
281
+ className: "modifier-container pl-6",
282
+ children: [
283
+ /*#__PURE__*/ jsx("div", {
284
+ className: "d-flex justify-content-between align-items-center",
285
+ children: /*#__PURE__*/ jsx(Checkbox, {
286
+ value: modifier.id,
287
+ onChange: onChange,
288
+ label: modifier.name,
289
+ defaultChecked: !!selectedOrderModifier
290
+ })
291
+ }),
292
+ /*#__PURE__*/ jsxs("div", {
293
+ className: "mt-3 w-100 pl-2",
294
+ children: [
295
+ /*#__PURE__*/ jsx("p", {
296
+ children: modifier.description
297
+ }),
298
+ /*#__PURE__*/ jsxs("div", {
299
+ className: "price",
300
+ children: [
301
+ "+ ",
302
+ formatToCurrency(modifier.price)
303
+ ]
304
+ })
305
+ ]
306
+ }),
307
+ errorMessage && /*#__PURE__*/ jsx("div", {
308
+ className: "invalid-feedback d-flex",
309
+ children: errorMessage
310
+ })
311
+ ]
312
+ }, modifier.id.toString());
313
+ }
314
+ })
315
+ }) : /*#__PURE__*/ jsxs(Fragment, {
316
+ children: [
317
+ /*#__PURE__*/ jsx("div", {
318
+ className: "modifier-header m-0",
319
+ children: /*#__PURE__*/ jsx("div", {
320
+ className: "title",
321
+ children: modifier.name
322
+ })
323
+ }),
324
+ /*#__PURE__*/ jsx(Controller, {
325
+ control: control,
326
+ name: "".concat(productId, ".").concat(modifierSet.id, ".modifiers[").concat(index, "].quantity"),
327
+ rules: {
328
+ required: !!modifier.minItems || requiredModifierSet,
329
+ validate: function(value) {
330
+ // if (!value) return true
331
+ var maxModifierSet = modifierSet.maxItems, minModifierSet = modifierSet.minItems;
332
+ if (orderProductModifiersMaxQuantity < minModifierSet) {
333
+ return t('Validation:quantityMinNumberModifier', {
334
+ min: minModifierSet
335
+ });
336
+ }
337
+ if (orderProductModifiersMaxQuantity > maxModifierSet) {
338
+ return t('Validation:quantityMaxNumberModifier', {
339
+ max: maxModifierSet
340
+ });
341
+ }
342
+ var maxItems = modifier.maxItems, minItems = modifier.minItems;
343
+ if (value > maxItems) {
344
+ return t('Validation:quantityMaxNumberModifier', {
345
+ max: maxItems
346
+ });
347
+ }
348
+ if (value < minItems) {
349
+ return t('Validation:quantityMinNumberModifier', {
350
+ min: minItems
351
+ });
352
+ }
353
+ return true;
354
+ }
355
+ },
356
+ render: function(param) {
357
+ 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;
358
+ var onChangeProductQuantity = function(val) {
359
+ var quantity = Math.min(MAX_PRODUCT_NUMBER, Math.max(0, Math.ceil(val)));
360
+ onChange(quantity);
361
+ trigger("".concat(productId, ".").concat(modifierSet.id, ".modifiers[").concat(index, "].quantity"));
362
+ onChangeModifiers({
363
+ target: {
364
+ id: modifier.id.toString()
365
+ }
366
+ }, 'selector', quantity);
367
+ };
368
+ var _ref;
369
+ return /*#__PURE__*/ jsxs("div", {
370
+ className: "modifier-container",
371
+ children: [
372
+ /*#__PURE__*/ jsx("div", {
373
+ className: "d-flex align-items-center column mb-8 pl-6 pt-2",
374
+ children: /*#__PURE__*/ jsx("div", {
375
+ className: "quantity-container mb-0",
376
+ children: /*#__PURE__*/ jsx(NumberInputHorizontal, {
377
+ ref: ref,
378
+ size: "big",
379
+ onChange: onChangeProductQuantity,
380
+ onMinusClick: onChangeProductQuantity,
381
+ onPlusClick: onChangeProductQuantity,
382
+ min: 0,
383
+ max: MAX_PRODUCT_NUMBER,
384
+ value: (_ref = value !== null && value !== void 0 ? value : selectedOrderModifier) !== null && _ref !== void 0 ? _ref : 0,
385
+ className: clsx(invalid && 'error'),
386
+ isLoading: isLoading
387
+ })
388
+ })
389
+ }),
390
+ /*#__PURE__*/ jsxs("div", {
391
+ className: "p-2 mt-3 w-100 pl-4",
392
+ children: [
393
+ /*#__PURE__*/ jsx("p", {
394
+ className: "pl-2",
395
+ children: modifier.description
396
+ }),
397
+ /*#__PURE__*/ jsxs("div", {
398
+ className: "pl-2 price",
399
+ children: [
400
+ "+ ",
401
+ formatToCurrency(modifier.price)
402
+ ]
403
+ }),
404
+ (error === null || error === void 0 ? void 0 : error.message) && /*#__PURE__*/ jsx("div", {
405
+ className: "d-flex mt-3 w-100",
406
+ children: /*#__PURE__*/ jsx("p", {
407
+ className: "iframe-event__message-error",
408
+ children: error.message
409
+ })
410
+ })
411
+ ]
412
+ })
413
+ ]
414
+ });
415
+ }
416
+ })
417
+ ]
418
+ }),
419
+ (modifiersErrors === null || modifiersErrors === void 0 ? void 0 : modifiersErrors.message) && /*#__PURE__*/ jsx(Col, {
420
+ children: /*#__PURE__*/ jsx("div", {
421
+ className: "invalid-feedback field-values-error",
422
+ children: modifiersSetWithErrors.message || 'test'
423
+ })
424
+ })
425
+ ]
426
+ });
427
+ })
428
+ })
429
+ });
430
+ };
431
+ var Checkbox = function(param) {
432
+ var onChange = param.onChange, value = param.value, label = param.label, defaultChecked = param.defaultChecked;
433
+ var checkboxId = useId();
434
+ return /*#__PURE__*/ jsx(Form.Group, {
435
+ controlId: checkboxId,
436
+ className: "custom-checkbox mt-0",
437
+ children: /*#__PURE__*/ jsx(Form.Check, {
438
+ label: label,
439
+ value: value,
440
+ defaultChecked: defaultChecked,
441
+ onChange: onChange,
442
+ type: "checkbox"
443
+ })
444
+ });
445
+ };
446
+
447
+ export { ModifiersSetControl };
@@ -0,0 +1,12 @@
1
+ import { FieldErrors, FieldValues } from 'react-hook-form';
2
+ import { OrderModifierByProduct } from '@licklist/core/dist/DataMapper/Order/OrderModifiierByProduct';
3
+ import { Product } from '@licklist/plugins/dist/types/context/sale/menuSteps';
4
+ interface ProductControlProps {
5
+ product: Product;
6
+ isLoading?: boolean;
7
+ editOrderModifier?: OrderModifierByProduct;
8
+ errors?: FieldErrors<FieldValues>;
9
+ }
10
+ export declare const ProductControl: ({ product, isLoading, editOrderModifier, errors, }: ProductControlProps) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
12
+ //# 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":"AAAA,OAAO,EAGL,WAAW,EACX,WAAW,EACZ,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,8DAA8D,CAAA;AACrG,OAAO,EAAE,OAAO,EAAE,MAAM,qDAAqD,CAAA;AAG7E,UAAU,mBAAmB;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,iBAAiB,CAAC,EAAE,sBAAsB,CAAA;IAC1C,MAAM,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAA;CAClC;AAED,eAAO,MAAM,cAAc,uDAKxB,mBAAmB,4CAgCrB,CAAA"}
@@ -0,0 +1,45 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { useFormContext, Controller } from 'react-hook-form';
3
+ import { ModifiersSetControl } from './ModifierSetControll.js';
4
+
5
+ var ProductControl = function(param) {
6
+ var product = param.product, _param_isLoading = param.isLoading, isLoading = _param_isLoading === void 0 ? false : _param_isLoading, editOrderModifier = param.editOrderModifier, errors = param.errors;
7
+ var control = useFormContext().control;
8
+ var modifiersSet = (product === null || product === void 0 ? void 0 : product.modifiersSet) || [];
9
+ return /*#__PURE__*/ jsx(Controller, {
10
+ control: control,
11
+ name: "product",
12
+ render: function() {
13
+ return /*#__PURE__*/ jsx("div", {
14
+ className: "mb-8 pt-4",
15
+ children: /*#__PURE__*/ jsx("div", {
16
+ className: " d-flex flex-column",
17
+ children: modifiersSet.map(function(modifierSet) {
18
+ return /*#__PURE__*/ jsxs(Fragment, {
19
+ children: [
20
+ /*#__PURE__*/ jsx("div", {
21
+ className: "modifier-header",
22
+ children: /*#__PURE__*/ jsx("div", {
23
+ className: "title",
24
+ children: modifierSet.name
25
+ })
26
+ }),
27
+ /*#__PURE__*/ jsx(ModifiersSetControl, {
28
+ modifierSet: modifierSet,
29
+ productId: product.id,
30
+ modifiers: modifierSet.modifiers,
31
+ isEditMode: !!(editOrderModifier === null || editOrderModifier === void 0 ? void 0 : editOrderModifier.modifiers),
32
+ orderProductModifierSets: editOrderModifier === null || editOrderModifier === void 0 ? void 0 : editOrderModifier.modifiers,
33
+ modifiersSetWithErrors: errors,
34
+ isLoading: isLoading
35
+ })
36
+ ]
37
+ });
38
+ })
39
+ })
40
+ });
41
+ }
42
+ });
43
+ };
44
+
45
+ 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"}
@@ -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"}
@@ -1,17 +1,29 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
1
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import { useIntl } from 'react-intl';
4
4
  import * as Config from '@licklist/core/dist/Config';
5
+ import { calculateTotalModifiersPrice } from '../../utils/index.js';
5
6
 
6
7
  var ProductSummary = function(param) {
7
8
  var name = param.name, productQuantityError = param.productQuantityError, orderProduct = param.orderProduct;
9
+ var _orderProduct_orderModifiersSets;
8
10
  var t = useTranslation('Design').t;
9
11
  var formatNumber = useIntl().formatNumber;
10
12
  var priceForOneProduct = orderProduct === null || orderProduct === void 0 ? void 0 : orderProduct.price;
13
+ var modifierSetsPrice = calculateTotalModifiersPrice(orderProduct === null || orderProduct === void 0 ? void 0 : orderProduct.orderModifiersSets);
11
14
  var fullPrice = formatNumber(priceForOneProduct * (orderProduct === null || orderProduct === void 0 ? void 0 : orderProduct.quantity), {
12
15
  style: 'currency',
13
16
  currency: Config.Currency.GBP
14
17
  });
18
+ var modifiersName = "".concat((_orderProduct_orderModifiersSets = orderProduct.orderModifiersSets) === null || _orderProduct_orderModifiersSets === void 0 ? void 0 : _orderProduct_orderModifiersSets.map(function(modifierProduct) {
19
+ return modifierProduct === null || modifierProduct === void 0 ? void 0 : modifierProduct.modifiers.map(function(item) {
20
+ return (item === null || item === void 0 ? void 0 : item.quantity) > 1 ? "".concat(item === null || item === void 0 ? void 0 : item.quantity, "x - ").concat(item === null || item === void 0 ? void 0 : item.name) : item === null || item === void 0 ? void 0 : item.name;
21
+ }).join(', ');
22
+ }).join(', '));
23
+ var fullModifiersPrice = formatNumber(modifierSetsPrice, {
24
+ style: 'currency',
25
+ currency: Config.Currency.GBP
26
+ });
15
27
  return /*#__PURE__*/ jsxs("div", {
16
28
  className: "product",
17
29
  children: [
@@ -30,12 +42,27 @@ var ProductSummary = function(param) {
30
42
  orderProduct === null || orderProduct === void 0 ? void 0 : orderProduct.quantity
31
43
  ]
32
44
  }),
33
- /*#__PURE__*/ jsx("p", {
45
+ modifierSetsPrice && /*#__PURE__*/ jsx("p", {
34
46
  className: "price",
35
47
  children: fullPrice
36
48
  })
37
49
  ]
38
50
  }),
51
+ fullModifiersPrice && /*#__PURE__*/ jsxs(Fragment, {
52
+ children: [
53
+ /*#__PURE__*/ jsx("p", {
54
+ className: "mt-2",
55
+ children: modifiersName
56
+ }),
57
+ /*#__PURE__*/ jsx("div", {
58
+ className: "d-flex justify-content-end",
59
+ children: /*#__PURE__*/ jsx("p", {
60
+ className: "price",
61
+ children: fullModifiersPrice
62
+ })
63
+ })
64
+ ]
65
+ }),
39
66
  productQuantityError && /*#__PURE__*/ jsx("p", {
40
67
  className: "iframe-event__message-error",
41
68
  children: productQuantityError