@licklist/design 0.68.2 → 0.68.5-dev.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 (115) hide show
  1. package/dist/affiliate/form/AffiliateForm.d.ts.map +1 -1
  2. package/dist/auth/Login/LoginComponent.js +2 -1
  3. package/dist/calendar/components/CalendarButtons/CalendarButtons.d.ts.map +1 -1
  4. package/dist/calendar/components/CalendarButtons/CalendarButtons.js +35 -40
  5. package/dist/events/edit-event-modal/IntervalInput.d.ts.map +1 -1
  6. package/dist/events/edit-event-modal/IntervalInput.js +7 -1
  7. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts.map +1 -1
  8. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +0 -1
  9. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts.map +1 -1
  10. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.js +24 -23
  11. package/dist/events/edit-event-modal/utils/getDefaultProductSet.d.ts.map +1 -1
  12. package/dist/events/edit-event-modal/utils/getDefaultProductSet.js +0 -1
  13. package/dist/iframe/event/event-card/IframeEventCard.d.ts.map +1 -1
  14. package/dist/iframe/event/event-card/IframeEventCard.js +2 -2
  15. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -1
  16. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.js +2 -0
  17. package/dist/iframe/page/components/PageBody/hooks/useResizePageBody.d.ts.map +1 -1
  18. package/dist/iframe/page/components/PageBody/hooks/useResizePageBody.js +0 -1
  19. package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts.map +1 -1
  20. package/dist/index.js +1 -0
  21. package/dist/layout/DropDown.d.ts +2 -1
  22. package/dist/layout/DropDown.d.ts.map +1 -1
  23. package/dist/modals/confirmation/ConfirmModal.d.ts +3 -1
  24. package/dist/modals/confirmation/ConfirmModal.d.ts.map +1 -1
  25. package/dist/modals/confirmation/ConfirmModal.js +172 -8
  26. package/dist/product-set/card/ProductSetCard.d.ts +6 -2
  27. package/dist/product-set/card/ProductSetCard.d.ts.map +1 -1
  28. package/dist/product-set/card/ProductSetCard.js +30 -11
  29. package/dist/product-set/control/DateInput.d.ts.map +1 -1
  30. package/dist/product-set/control/DateInput.js +2 -2
  31. package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
  32. package/dist/product-set/form/ProductCategoriesControl.js +48 -2
  33. package/dist/product-set/form/ProductSetForm.d.ts +4 -1
  34. package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
  35. package/dist/product-set/form/ProductSetForm.js +59 -1
  36. package/dist/product-set/form/ProductSetNameControl.d.ts +6 -0
  37. package/dist/product-set/form/ProductSetNameControl.d.ts.map +1 -0
  38. package/dist/product-set/form/ProductSetNameControl.js +35 -0
  39. package/dist/product-set/form/ProductZonesControl.d.ts.map +1 -1
  40. package/dist/product-set/form/ProductZonesControl.js +0 -2
  41. package/dist/product-set/form/SelectCategoryModal.d.ts +12 -0
  42. package/dist/product-set/form/SelectCategoryModal.d.ts.map +1 -1
  43. package/dist/product-set/form/SelectCategoryModal.js +1 -1
  44. package/dist/product-set/form/SubProductsControl.d.ts.map +1 -1
  45. package/dist/product-set/form/SubProductsControl.js +0 -3
  46. package/dist/product-set/form/VenueMapsControl.d.ts.map +1 -1
  47. package/dist/product-set/form/VenueMapsControl.js +0 -3
  48. package/dist/product-set/form/index.d.ts +1 -0
  49. package/dist/product-set/form/index.d.ts.map +1 -1
  50. package/dist/product-set/product/ProductControl.d.ts.map +1 -1
  51. package/dist/product-set/utils/index.d.ts +7 -0
  52. package/dist/product-set/utils/index.d.ts.map +1 -1
  53. package/dist/product-set/utils/index.js +10 -1
  54. package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
  55. package/dist/sales/booking/results/components/ResultCard.js +0 -2
  56. package/dist/snippet/snippet-template/preview/Preview.d.ts.map +1 -1
  57. package/dist/snippet/snippet-template/preview/Preview.js +6 -0
  58. package/dist/sortable-tree/SortableTreeItem.d.ts +2 -1
  59. package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
  60. package/dist/sortable-tree/SortableTreeItem.js +10 -4
  61. package/dist/styles/iframe-events/Calendar.scss +0 -1
  62. package/dist/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
  63. package/dist/styles/iframe-page/PageBody.scss +1 -1
  64. package/dist/styles/product-set/ProductSetForm.scss +22 -0
  65. package/dist/styles/sales/BookingResults.scss +1 -1
  66. package/dist/tiptap-editor/TipTapMenu/extensions/constants.d.ts +2 -0
  67. package/dist/tiptap-editor/TipTapMenu/extensions/constants.d.ts.map +1 -0
  68. package/dist/tiptap-editor/TipTapMenu/extensions/constants.js +3 -0
  69. package/dist/tiptap-editor/TipTapMenu/extensions/utils.d.ts +1 -1
  70. package/dist/tiptap-editor/TipTapMenu/extensions/utils.d.ts.map +1 -1
  71. package/dist/tiptap-editor/TipTapMenu/extensions/utils.js +3 -1
  72. package/dist/typeahead/Typeahead.d.ts +5 -1
  73. package/dist/typeahead/Typeahead.d.ts.map +1 -1
  74. package/dist/typeahead/Typeahead.js +9 -2
  75. package/package.json +8 -6
  76. package/src/affiliate/form/AffiliateForm.tsx +1 -0
  77. package/src/auth/Login/LoginComponent.tsx +1 -1
  78. package/src/calendar/components/CalendarButtons/CalendarButtons.tsx +29 -28
  79. package/src/events/edit-event-modal/IntervalInput.tsx +8 -1
  80. package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx +0 -1
  81. package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx +82 -85
  82. package/src/events/edit-event-modal/utils/getDefaultProductSet.ts +0 -1
  83. package/src/iframe/event/event-card/IframeEventCard.tsx +30 -29
  84. package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +1 -0
  85. package/src/iframe/page/components/PageBody/hooks/useResizePageBody.ts +0 -1
  86. package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +1 -0
  87. package/src/layout/DropDown.tsx +2 -1
  88. package/src/modals/confirmation/ConfirmModal.tsx +19 -3
  89. package/src/product-set/card/ProductSetCard.tsx +47 -8
  90. package/src/product-set/control/DateInput.tsx +2 -1
  91. package/src/product-set/form/ProductCategoriesControl.tsx +37 -1
  92. package/src/product-set/form/ProductSetForm.tsx +17 -2
  93. package/src/product-set/form/ProductSetNameControl.tsx +27 -0
  94. package/src/product-set/form/ProductZonesControl.tsx +1 -4
  95. package/src/product-set/form/SelectCategoryModal.tsx +2 -2
  96. package/src/product-set/form/SubProductsControl.tsx +0 -3
  97. package/src/product-set/form/VenueMapsControl.tsx +0 -3
  98. package/src/product-set/form/index.ts +1 -0
  99. package/src/product-set/product/ProductControl.tsx +0 -1
  100. package/src/product-set/product/advanced-options/AdvancedOptions.tsx +1 -1
  101. package/src/product-set/product-zone/ProductZoneControl.tsx +1 -1
  102. package/src/product-set/utils/index.ts +11 -0
  103. package/src/sales/booking/results/components/ResultCard.tsx +0 -2
  104. package/src/snippet/snippet-template/preview/Preview.tsx +6 -0
  105. package/src/sortable-tree/SortableTreeItem.tsx +6 -0
  106. package/src/styles/iframe-events/Calendar.scss +0 -1
  107. package/src/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
  108. package/src/styles/iframe-page/PageBody.scss +1 -1
  109. package/src/styles/product-set/ProductSetForm.scss +22 -0
  110. package/src/styles/sales/BookingResults.scss +1 -1
  111. package/src/tiptap-editor/TipTapMenu/extensions/constants.ts +1 -0
  112. package/src/tiptap-editor/TipTapMenu/extensions/utils.ts +4 -1
  113. package/src/typeahead/Typeahead.tsx +15 -1
  114. package/yarn.lock +59 -33
  115. package/dist/assets/iframe/selectArrow.svg.js +0 -17
@@ -17,6 +17,35 @@ function _array_like_to_array(arr, len) {
17
17
  function _array_with_holes(arr) {
18
18
  if (Array.isArray(arr)) return arr;
19
19
  }
20
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
21
+ try {
22
+ var info = gen[key](arg);
23
+ var value = info.value;
24
+ } catch (error) {
25
+ reject(error);
26
+ return;
27
+ }
28
+ if (info.done) {
29
+ resolve(value);
30
+ } else {
31
+ Promise.resolve(value).then(_next, _throw);
32
+ }
33
+ }
34
+ function _async_to_generator(fn) {
35
+ return function() {
36
+ var self = this, args = arguments;
37
+ return new Promise(function(resolve, reject) {
38
+ var gen = fn.apply(self, args);
39
+ function _next(value) {
40
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
41
+ }
42
+ function _throw(err) {
43
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
44
+ }
45
+ _next(undefined);
46
+ });
47
+ };
48
+ }
20
49
  function _iterable_to_array_limit(arr, i) {
21
50
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
22
51
  if (_i == null) return;
@@ -55,6 +84,101 @@ function _unsupported_iterable_to_array(o, minLen) {
55
84
  if (n === "Map" || n === "Set") return Array.from(n);
56
85
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
57
86
  }
87
+ function _ts_generator(thisArg, body) {
88
+ var f, y, t, g, _ = {
89
+ label: 0,
90
+ sent: function() {
91
+ if (t[0] & 1) throw t[1];
92
+ return t[1];
93
+ },
94
+ trys: [],
95
+ ops: []
96
+ };
97
+ return g = {
98
+ next: verb(0),
99
+ "throw": verb(1),
100
+ "return": verb(2)
101
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
102
+ return this;
103
+ }), g;
104
+ function verb(n) {
105
+ return function(v) {
106
+ return step([
107
+ n,
108
+ v
109
+ ]);
110
+ };
111
+ }
112
+ function step(op) {
113
+ if (f) throw new TypeError("Generator is already executing.");
114
+ while(_)try {
115
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
116
+ if (y = 0, t) op = [
117
+ op[0] & 2,
118
+ t.value
119
+ ];
120
+ switch(op[0]){
121
+ case 0:
122
+ case 1:
123
+ t = op;
124
+ break;
125
+ case 4:
126
+ _.label++;
127
+ return {
128
+ value: op[1],
129
+ done: false
130
+ };
131
+ case 5:
132
+ _.label++;
133
+ y = op[1];
134
+ op = [
135
+ 0
136
+ ];
137
+ continue;
138
+ case 7:
139
+ op = _.ops.pop();
140
+ _.trys.pop();
141
+ continue;
142
+ default:
143
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
144
+ _ = 0;
145
+ continue;
146
+ }
147
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
148
+ _.label = op[1];
149
+ break;
150
+ }
151
+ if (op[0] === 6 && _.label < t[1]) {
152
+ _.label = t[1];
153
+ t = op;
154
+ break;
155
+ }
156
+ if (t && _.label < t[2]) {
157
+ _.label = t[2];
158
+ _.ops.push(op);
159
+ break;
160
+ }
161
+ if (t[2]) _.ops.pop();
162
+ _.trys.pop();
163
+ continue;
164
+ }
165
+ op = body.call(thisArg, _);
166
+ } catch (e) {
167
+ op = [
168
+ 6,
169
+ e
170
+ ];
171
+ y = 0;
172
+ } finally{
173
+ f = t = 0;
174
+ }
175
+ if (op[0] & 5) throw op[1];
176
+ return {
177
+ value: op[0] ? op[1] : void 0,
178
+ done: true
179
+ };
180
+ }
181
+ }
58
182
  var ConfirmModalType = {
59
183
  remove: 'remove',
60
184
  default: 'default'
@@ -66,7 +190,7 @@ var CONFIRM_MODAL_ACTIONS = [
66
190
  CONFIRM_MODAL_ACTION_CONFIRM
67
191
  ];
68
192
  function ConfirmModal(param) {
69
- var _param_type = param.type, type = _param_type === void 0 ? 'default' : _param_type, children = param.children, onClose = param.onClose, title = param.title, content = param.content, _param_hideButtons = param.hideButtons, hideButtons = _param_hideButtons === void 0 ? false : _param_hideButtons;
193
+ var _param_type = param.type, type = _param_type === void 0 ? 'default' : _param_type, children = param.children, onClose = param.onClose, confirmationHandler = param.confirmationHandler, title = param.title, disabledButtons = param.disabledButtons, content = param.content, _param_hideButtons = param.hideButtons, hideButtons = _param_hideButtons === void 0 ? false : _param_hideButtons;
70
194
  var t = useTranslation('Design').t;
71
195
  var actionRef = useRef();
72
196
  var _useState = _sliced_to_array(useState(false), 2), isOpen = _useState[0], setIsOpen = _useState[1];
@@ -76,14 +200,49 @@ function ConfirmModal(param) {
76
200
  return true;
77
201
  });
78
202
  };
79
- var handleConfirmation = function(e) {
80
- e.stopPropagation();
81
- if (!actionRef.current) return;
82
- actionRef.current();
83
- setIsOpen(function() {
84
- return false;
203
+ var handleConfirmation = function() {
204
+ var _ref = _async_to_generator(function(e) {
205
+ var res;
206
+ return _ts_generator(this, function(_state) {
207
+ switch(_state.label){
208
+ case 0:
209
+ e.stopPropagation();
210
+ if (!actionRef.current && !confirmationHandler) return [
211
+ 2
212
+ ];
213
+ if (!confirmationHandler) return [
214
+ 3,
215
+ 2
216
+ ];
217
+ return [
218
+ 4,
219
+ confirmationHandler()
220
+ ];
221
+ case 1:
222
+ res = _state.sent();
223
+ if (res) {
224
+ setIsOpen(function() {
225
+ return false;
226
+ });
227
+ }
228
+ return [
229
+ 2
230
+ ];
231
+ case 2:
232
+ actionRef.current();
233
+ setIsOpen(function() {
234
+ return false;
235
+ });
236
+ return [
237
+ 2
238
+ ];
239
+ }
240
+ });
85
241
  });
86
- };
242
+ return function handleConfirmation(e) {
243
+ return _ref.apply(this, arguments);
244
+ };
245
+ }();
87
246
  var handleClose = function(e) {
88
247
  e.stopPropagation();
89
248
  setIsOpen(function() {
@@ -113,6 +272,7 @@ function ConfirmModal(param) {
113
272
  /*#__PURE__*/ jsx(Button, {
114
273
  variant: "danger",
115
274
  className: "btn-sm rounded",
275
+ disabled: disabledButtons,
116
276
  onClick: handleClose,
117
277
  "data-id": CONFIRM_MODAL_ACTION_DECLINE,
118
278
  children: /*#__PURE__*/ jsx(FaTimes, {
@@ -133,11 +293,13 @@ function ConfirmModal(param) {
133
293
  variant: "outline",
134
294
  className: "cancel-button",
135
295
  onClick: handleClose,
296
+ disabled: disabledButtons,
136
297
  "data-id": CONFIRM_MODAL_ACTION_DECLINE,
137
298
  children: t('cancel')
138
299
  }),
139
300
  /*#__PURE__*/ jsx(Button, {
140
301
  variant: "danger",
302
+ disabled: disabledButtons,
141
303
  onClick: handleConfirmation,
142
304
  "data-id": CONFIRM_MODAL_ACTION_CONFIRM,
143
305
  children: t('remove')
@@ -147,12 +309,14 @@ function ConfirmModal(param) {
147
309
  children: [
148
310
  /*#__PURE__*/ jsx(Button, {
149
311
  variant: "danger",
312
+ disabled: disabledButtons,
150
313
  onClick: handleClose,
151
314
  "data-id": CONFIRM_MODAL_ACTION_DECLINE,
152
315
  children: t('decline')
153
316
  }),
154
317
  /*#__PURE__*/ jsx(Button, {
155
318
  variant: "success",
319
+ disabled: disabledButtons,
156
320
  onClick: handleConfirmation,
157
321
  "data-id": CONFIRM_MODAL_ACTION_CONFIRM,
158
322
  children: t('confirm')
@@ -3,10 +3,14 @@ export interface ProductSetCardProps extends HasPermissionProp {
3
3
  name: string;
4
4
  rrule?: string;
5
5
  href: string;
6
- onCopy: () => void;
6
+ duplicateProductSetName: string;
7
+ onChangeDuplicateProductSetName: (value: string) => void;
8
+ onCopy: () => Promise<boolean | undefined>;
7
9
  onRemove: () => void;
10
+ isLoading?: boolean;
8
11
  className?: string;
9
12
  override?: number;
13
+ duplicateProductSetError?: string;
10
14
  }
11
- export declare function ProductSetCard({ name, rrule, href, onCopy, onRemove, className, hasPermission, override, }: ProductSetCardProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function ProductSetCard({ name, rrule, href, onCopy, onRemove, onChangeDuplicateProductSetName, duplicateProductSetName, duplicateProductSetError, isLoading, className, hasPermission, override, }: ProductSetCardProps): import("react/jsx-runtime").JSX.Element;
12
16
  //# sourceMappingURL=ProductSetCard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProductSetCard.d.ts","sourceRoot":"","sources":["../../../src/product-set/card/ProductSetCard.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA;AAMtF,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC5D,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,SAAc,EACd,aAAoB,EACpB,QAAY,GACb,EAAE,mBAAmB,2CAyGrB"}
1
+ {"version":3,"file":"ProductSetCard.d.ts","sourceRoot":"","sources":["../../../src/product-set/card/ProductSetCard.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA;AAOtF,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC5D,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,uBAAuB,EAAE,MAAM,CAAA;IAC/B,+BAA+B,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACxD,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAA;IAC1C,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,wBAAwB,CAAC,EAAE,MAAM,CAAA;CAClC;AAED,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,+BAA+B,EAC/B,uBAAuB,EACvB,wBAAwB,EACxB,SAAS,EACT,SAAc,EACd,aAAoB,EACpB,QAAY,GACb,EAAE,mBAAmB,2CAuIrB"}
@@ -9,6 +9,7 @@ import RouteService from '@licklist/plugins/dist/services/Route/RouteService';
9
9
  import { FaEye, FaTrashAlt, FaEllipsisH } from 'react-icons/fa';
10
10
  import { ConfirmModal } from '../../modals/confirmation/ConfirmModal.js';
11
11
  import { MenuButton } from '../../table/MenuButton.js';
12
+ import { ProductSetNameControl } from '../form/ProductSetNameControl.js';
12
13
 
13
14
  function _array_like_to_array(arr, len) {
14
15
  if (len == null || len > arr.length) len = arr.length;
@@ -57,21 +58,20 @@ function _unsupported_iterable_to_array(o, minLen) {
57
58
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
58
59
  }
59
60
  function ProductSetCard(param) {
60
- var name = param.name, rrule = param.rrule, href = param.href, onCopy = param.onCopy, onRemove = param.onRemove, _param_className = param.className, className = _param_className === void 0 ? '' : _param_className, _param_hasPermission = param.hasPermission, hasPermission = _param_hasPermission === void 0 ? true : _param_hasPermission, _param_override = param.override, override = _param_override === void 0 ? 0 : _param_override;
61
+ var name = param.name, rrule = param.rrule, href = param.href, onCopy = param.onCopy, onRemove = param.onRemove, onChangeDuplicateProductSetName = param.onChangeDuplicateProductSetName, duplicateProductSetName = param.duplicateProductSetName, duplicateProductSetError = param.duplicateProductSetError, isLoading = param.isLoading, _param_className = param.className, className = _param_className === void 0 ? '' : _param_className, _param_hasPermission = param.hasPermission, hasPermission = _param_hasPermission === void 0 ? true : _param_hasPermission, _param_override = param.override, override = _param_override === void 0 ? 0 : _param_override;
61
62
  var t = useTranslation('Design').t;
62
63
  var popoverId = useId();
63
64
  var productSetCardClasses = "product-set-card ".concat(className);
64
65
  var _useState = _sliced_to_array(useState(false), 2), isOverlayVisibile = _useState[0], setIsOverlayVisible = _useState[1];
65
- return /*#__PURE__*/ jsx("div", {
66
+ var onCardClick = function() {
67
+ RouteService.redirectTo(href);
68
+ };
69
+ return(// eslint-disable-next-line jsx-a11y/click-events-have-key-events
70
+ /*#__PURE__*/ jsx("div", {
66
71
  role: "button",
67
72
  tabIndex: 0,
68
73
  className: "border-0 product-set-card-wrapper w-100 pb-0",
69
- onClick: function() {
70
- return RouteService.redirectTo(href);
71
- },
72
- onKeyUp: function() {
73
- return RouteService.redirectTo(href);
74
- },
74
+ onClick: onCardClick,
75
75
  children: /*#__PURE__*/ jsxs("div", {
76
76
  className: productSetCardClasses,
77
77
  children: [
@@ -83,7 +83,6 @@ function ProductSetCard(param) {
83
83
  /*#__PURE__*/ jsxs("div", {
84
84
  children: [
85
85
  name,
86
- " ",
87
86
  rrule && "(".concat(RRule.fromString(rrule).toText(), ")")
88
87
  ]
89
88
  }),
@@ -120,12 +119,27 @@ function ProductSetCard(param) {
120
119
  /*#__PURE__*/ jsx(ListGroup.Item, {
121
120
  action: true,
122
121
  as: "div",
122
+ role: "button",
123
+ tabIndex: 0,
124
+ onClick: function(e) {
125
+ return e.stopPropagation();
126
+ },
123
127
  children: Boolean(onCopy) && /*#__PURE__*/ jsx(ConfirmModal, {
128
+ // confirm function memoize the callback function and it leads to bugs
129
+ confirmationHandler: onCopy,
130
+ disabledButtons: isLoading,
131
+ content: /*#__PURE__*/ jsx(ProductSetNameControl, {
132
+ value: duplicateProductSetName,
133
+ onChange: onChangeDuplicateProductSetName,
134
+ error: duplicateProductSetError
135
+ }),
124
136
  children: function(confirm) {
125
137
  return /*#__PURE__*/ jsx(MenuButton, {
126
138
  onClick: function() {
127
139
  setIsOverlayVisible(false);
128
- confirm(onCopy);
140
+ onChangeDuplicateProductSetName(name);
141
+ // confirm function memoize the callback function and it leads to bugs
142
+ confirm(function() {});
129
143
  },
130
144
  name: t('duplicate'),
131
145
  className: "product-set-card-menu-item-text"
@@ -137,6 +151,11 @@ function ProductSetCard(param) {
137
151
  action: true,
138
152
  className: "text-danger",
139
153
  as: "div",
154
+ role: "button",
155
+ tabIndex: 0,
156
+ onClick: function(e) {
157
+ return e.stopPropagation();
158
+ },
140
159
  children: Boolean(onRemove) && /*#__PURE__*/ jsx(ConfirmModal, {
141
160
  children: function(confirm) {
142
161
  return /*#__PURE__*/ jsx(MenuButton, {
@@ -172,7 +191,7 @@ function ProductSetCard(param) {
172
191
  })
173
192
  ]
174
193
  })
175
- });
194
+ }));
176
195
  }
177
196
 
178
197
  export { ProductSetCard };
@@ -1 +1 @@
1
- {"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../../src/product-set/control/DateInput.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAOzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uEAAuE,CAAA;AAG5G,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAA;AAiBrF,MAAM,WAAW,4BAA4B;IAC3C,eAAe,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,EAAE,CAAA;CAClD;AAED,UAAU,2BAA2B;IACnC,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAA;IACtB,4BAA4B,EAAE,OAAO,CAAA;IACrC,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,eAAO,MAAM,SAAS,mFAKnB,2BAA2B,4CAsP7B,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAC5C,WAAW,EACX,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsBxB,CAAA"}
1
+ {"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../../src/product-set/control/DateInput.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAOzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uEAAuE,CAAA;AAG5G,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAA;AAiBrF,MAAM,WAAW,4BAA4B;IAC3C,eAAe,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,EAAE,CAAA;CAClD;AAED,UAAU,2BAA2B;IACnC,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAA;IACtB,4BAA4B,EAAE,OAAO,CAAA;IACrC,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,eAAO,MAAM,SAAS,mFAKnB,2BAA2B,4CAuP7B,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAC5C,WAAW,EACX,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsBxB,CAAA"}
@@ -400,13 +400,13 @@ var DateInput = function(param) {
400
400
  className: "product-set-recurrences",
401
401
  children: [
402
402
  fields.map(function(menuRecurrence, index) {
403
- var _errors_menuRecurrences__availableTimes, _errors_menuRecurrences_, _errors_menuRecurrences;
403
+ var _errors_menuRecurrences__availableTimes, _errors_menuRecurrences_, _errors_menuRecurrences, _errors_menuRecurrences_1, _errors_menuRecurrences1;
404
404
  return /*#__PURE__*/ jsx(ProductSetRecurrenceOverridesControl, {
405
405
  menuRecurrence: menuRecurrence,
406
406
  onEdit: function() {
407
407
  return handleOnEdit(menuRecurrence, index);
408
408
  },
409
- errorMessage: errors === null || errors === void 0 ? void 0 : (_errors_menuRecurrences = errors.menuRecurrences) === null || _errors_menuRecurrences === void 0 ? void 0 : (_errors_menuRecurrences_ = _errors_menuRecurrences["".concat(index)]) === null || _errors_menuRecurrences_ === void 0 ? void 0 : (_errors_menuRecurrences__availableTimes = _errors_menuRecurrences_.availableTimes) === null || _errors_menuRecurrences__availableTimes === void 0 ? void 0 : _errors_menuRecurrences__availableTimes.message
409
+ errorMessage: (errors === null || errors === void 0 ? void 0 : (_errors_menuRecurrences = errors.menuRecurrences) === null || _errors_menuRecurrences === void 0 ? void 0 : (_errors_menuRecurrences_ = _errors_menuRecurrences["".concat(index)]) === null || _errors_menuRecurrences_ === void 0 ? void 0 : (_errors_menuRecurrences__availableTimes = _errors_menuRecurrences_.availableTimes) === null || _errors_menuRecurrences__availableTimes === void 0 ? void 0 : _errors_menuRecurrences__availableTimes.message) || (errors === null || errors === void 0 ? void 0 : (_errors_menuRecurrences1 = errors.menuRecurrences) === null || _errors_menuRecurrences1 === void 0 ? void 0 : (_errors_menuRecurrences_1 = _errors_menuRecurrences1["".concat(index)]) === null || _errors_menuRecurrences_1 === void 0 ? void 0 : _errors_menuRecurrences_1.message)
410
410
  }, menuRecurrence._id);
411
411
  }),
412
412
  fields.length < MAX_QUANTITY_RECURRENCE_DATE_IN_OVERRIDE && /*#__PURE__*/ jsxs("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"ProductCategoriesControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/ProductCategoriesControl.tsx"],"names":[],"mappings":"AAYA,OAAO,EAKL,YAAY,EACb,MAAM,kEAAkE,CAAA;AAQzE,OAAO,EAAwB,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAStE,UAAU,6BAA8B,SAAQ,aAAa;IAC3D,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B;AA0BD,wBAAgB,wBAAwB,CAAC,EACvC,SAAS,EACT,SAAS,EACT,WAAW,EACX,qBAAqB,EACrB,oBAAoB,GACrB,EAAE,6BAA6B,2CAoT/B;AAED,eAAO,MAAM,cAAc,iBACX,YAAY,SACnB,MAAM,KACZ;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,IAczC,CAAA"}
1
+ {"version":3,"file":"ProductCategoriesControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/ProductCategoriesControl.tsx"],"names":[],"mappings":"AAaA,OAAO,EAKL,YAAY,EACb,MAAM,kEAAkE,CAAA;AAQzE,OAAO,EAAwB,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAoCtE,UAAU,6BAA8B,SAAQ,aAAa;IAC3D,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B;AA0BD,wBAAgB,wBAAwB,CAAC,EACvC,SAAS,EACT,SAAS,EACT,WAAW,EACX,qBAAqB,EACrB,oBAAoB,GACrB,EAAE,6BAA6B,2CA4T/B;AAED,eAAO,MAAM,cAAc,iBACX,YAAY,SACnB,MAAM,KACZ;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,IAczC,CAAA"}
@@ -1,9 +1,10 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { useContext, useState, useEffect } from 'react';
3
3
  import HookFormService from '@licklist/plugins/dist/services/Form/HookFormService';
4
4
  import { uniqueId } from 'lodash';
5
5
  import { Badge } from 'react-bootstrap';
6
6
  import { useFormContext, useFieldArray, useWatch, Controller } from 'react-hook-form';
7
+ import { FaTicketAlt, FaCalendar, FaBars, FaBowlingBall } from 'react-icons/fa';
7
8
  import { useTranslation } from 'react-i18next';
8
9
  import { useSensor, MouseSensor } from '@dnd-kit/core';
9
10
  import { CATEGORY_TYPE_GAME, CATEGORY_TYPE_FIXED_DURATION, QUANTITY_TYPE_STANDARD, CATEGORY_TYPE_TICKETS } from '@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper';
@@ -13,7 +14,7 @@ import { ProductSetModalClasses } from '../../sortable-tree/SortableTreeItem.js'
13
14
  import { CreateProductSetItem } from '../item/CreateProductSetItem.js';
14
15
  import { ProductCategoryControl } from '../product-category/ProductCategoryControl.js';
15
16
  import { ProductsControl } from './ProductsControl.js';
16
- import { SelectCategoryModal } from './SelectCategoryModal.js';
17
+ import { CATEGORY_TYPES_NAMES, SelectCategoryModal } from './SelectCategoryModal.js';
17
18
  import { ProductSetLoadingContext } from './context.js';
18
19
  import { VenueMapSetModal } from './VenueMapSetModal.js';
19
20
  import { sortArrayByIndex, moveArrayElements } from '../utils/index.js';
@@ -117,6 +118,40 @@ function _unsupported_iterable_to_array(o, minLen) {
117
118
  if (n === "Map" || n === "Set") return Array.from(n);
118
119
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
119
120
  }
121
+ var _obj;
122
+ // @TODO not for first release
123
+ // import Popover from "./ProductSetFormPopover";
124
+ var CATEGORIES_TYPE = (_obj = {}, _define_property(_obj, CATEGORY_TYPES_NAMES.tickets, {
125
+ label: 'tickets',
126
+ icon: /*#__PURE__*/ jsx(FaTicketAlt, {
127
+ color: "#0e8ce2",
128
+ size: 10
129
+ })
130
+ }), _define_property(_obj, CATEGORY_TYPES_NAMES.bookings, {
131
+ label: 'bookings',
132
+ icon: /*#__PURE__*/ jsx(FaCalendar, {
133
+ color: "#0e8ce2",
134
+ size: 10
135
+ })
136
+ }), _define_property(_obj, CATEGORY_TYPES_NAMES.menuItems, {
137
+ label: 'menuItems',
138
+ icon: /*#__PURE__*/ jsx(FaBars, {
139
+ color: "#0e8ce2",
140
+ size: 10
141
+ })
142
+ }), _define_property(_obj, CATEGORY_TYPES_NAMES.game, {
143
+ label: 'game',
144
+ icon: /*#__PURE__*/ jsx(FaBowlingBall, {
145
+ color: "#0e8ce2",
146
+ size: 10
147
+ })
148
+ }), _define_property(_obj, CATEGORY_TYPES_NAMES.fixedDuration, {
149
+ label: 'fixedDuration',
150
+ icon: /*#__PURE__*/ jsx(FaCalendar, {
151
+ color: "#0e8ce2",
152
+ size: 10
153
+ })
154
+ }), _obj);
120
155
  var getCategoryDefaultValue = function(categoryType, sort) {
121
156
  return {
122
157
  id: null,
@@ -250,6 +285,7 @@ function ProductCategoriesControl(param) {
250
285
  var onSetIsExpanded = function() {
251
286
  setIsExpanded(productCategoryId);
252
287
  };
288
+ var categoryType = CATEGORIES_TYPE[productCategory.type];
253
289
  return /*#__PURE__*/ jsx(Controller, {
254
290
  name: "".concat(productCategoriesFieldName, ".").concat(index, ".name"),
255
291
  control: control,
@@ -299,6 +335,16 @@ function ProductCategoriesControl(param) {
299
335
  secondaryBadge: getBadgeConfig(productCategory.type, t(productCategory.type)),
300
336
  modalClass: ProductSetModalClasses.category,
301
337
  isNewAdded: showCategoryModal,
338
+ itemButton: /*#__PURE__*/ jsxs("div", {
339
+ className: "btn-outline-primary item-icon sm border border-primary rounded-sm",
340
+ children: [
341
+ categoryType.icon,
342
+ /*#__PURE__*/ jsx("span", {
343
+ className: "ml-2",
344
+ children: t(categoryType.label)
345
+ })
346
+ ]
347
+ }),
302
348
  body: /*#__PURE__*/ jsx(ProductCategoryControl, {
303
349
  isLoading: isLoading,
304
350
  onCategoryNameChange: onChange,
@@ -10,10 +10,13 @@ import { SelectItem } from '../../types/generic/SelectItem';
10
10
  export interface WithIsLoading {
11
11
  isLoading: boolean;
12
12
  }
13
+ export interface WithIdOptional {
14
+ id?: number;
15
+ }
13
16
  export interface WithId {
14
17
  id: number;
15
18
  }
16
- export interface ProductSetFormValues extends FormValues, WithId, ProductSetControlValues {
19
+ export interface ProductSetFormValues extends FormValues, WithIdOptional, ProductSetControlValues {
17
20
  steps: Step[];
18
21
  isOverrides?: boolean;
19
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ProductSetForm.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/ProductSetForm.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,8DAA8D,CAAA;AAIzF,OAAO,EAAE,WAAW,EAAE,MAAM,8DAA8D,CAAA;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAA;AAK3E,OAAO,EAAE,gCAAgC,EAAE,MAAM,oFAAoF,CAAA;AACrI,OAAO,EAAE,IAAI,EAAE,MAAM,wDAAwD,CAAA;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAA;AAErF,OAAO,EAEL,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;AAG3D,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,OAAO,CAAA;CACnB;AACD,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAA;CACX;AACD,MAAM,WAAW,oBACf,SAAQ,UAAU,EAChB,MAAM,EACN,uBAAuB;IACzB,KAAK,EAAE,IAAI,EAAE,CAAA;IACb,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,MAAM,WAAW,mBACf,SAAQ,aAAa,EACnB,uBAAuB;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,oBAAoB,CAAA;IACpC,mBAAmB,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAA;IAC3D,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAA;IAC3D,gBAAgB,CAAC,EAAE,UAAU,EAAE,CAAA;IAC/B,YAAY,CAAC,EAAE,WAAW,CAAA;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,YAAY,CAAC,EAAE,WAAW,EAAE,CAAA;IAC5B,4BAA4B,CAAC,EAAE,gCAAgC,CAAC,sBAAsB,CAAC,CAAA;IACvF,KAAK,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;IACrB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAA;IACtB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,cAAsB,EACtB,YAAiB,EACjB,4BAA4B,EAC5B,KAAK,EACL,cAAc,EACd,SAAS,EACT,WAAW,EACX,oBAAoB,EACpB,QAAQ,EACR,GAAG,MAAM,EACV,EAAE,mBAAmB,2CAiJrB"}
1
+ {"version":3,"file":"ProductSetForm.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/ProductSetForm.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,8DAA8D,CAAA;AAIzF,OAAO,EAAE,WAAW,EAAE,MAAM,8DAA8D,CAAA;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAA;AAK3E,OAAO,EAAE,gCAAgC,EAAE,MAAM,oFAAoF,CAAA;AACrI,OAAO,EAAE,IAAI,EAAE,MAAM,wDAAwD,CAAA;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAA;AAErF,OAAO,EAEL,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;AAI3D,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,OAAO,CAAA;CACnB;AACD,MAAM,WAAW,cAAc;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAA;CACX;AACD,MAAM,WAAW,oBACf,SAAQ,UAAU,EAChB,cAAc,EACd,uBAAuB;IACzB,KAAK,EAAE,IAAI,EAAE,CAAA;IACb,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,MAAM,WAAW,mBACf,SAAQ,aAAa,EACnB,uBAAuB;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,oBAAoB,CAAA;IACpC,mBAAmB,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAA;IAC3D,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAA;IAC3D,gBAAgB,CAAC,EAAE,UAAU,EAAE,CAAA;IAC/B,YAAY,CAAC,EAAE,WAAW,CAAA;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,YAAY,CAAC,EAAE,WAAW,EAAE,CAAA;IAC5B,4BAA4B,CAAC,EAAE,gCAAgC,CAAC,sBAAsB,CAAC,CAAA;IACvF,KAAK,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;IACrB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAA;IACtB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,cAAsB,EACtB,YAAiB,EACjB,4BAA4B,EAC5B,KAAK,EACL,cAAc,EACd,SAAS,EACT,WAAW,EACX,oBAAoB,EACpB,QAAQ,EACR,GAAG,MAAM,EACV,EAAE,mBAAmB,2CA2JrB"}
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
- import { useEffect } from 'react';
2
+ import { useState, useEffect } from 'react';
3
3
  import { Form, Row, Col, Button } from 'react-bootstrap';
4
4
  import { useForm, FormProvider } from 'react-hook-form';
5
5
  import { useTranslation } from 'react-i18next';
@@ -10,7 +10,16 @@ import { useDialogContext } from '../../modals/dialog/DialogContext.js';
10
10
  import { ProductSetControl } from '../control/ProductSetControl.js';
11
11
  import { ProductSetContextProvider, ProductSetLoadingContext } from './context.js';
12
12
  import { getFilteredTemplates, checkAvailableTimesErrors } from '../utils/index.js';
13
+ import { ErrorModal } from '../../iframe/order-process/components/ErrorModal/ErrorModal.js';
13
14
 
15
+ function _array_like_to_array(arr, len) {
16
+ if (len == null || len > arr.length) len = arr.length;
17
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
18
+ return arr2;
19
+ }
20
+ function _array_with_holes(arr) {
21
+ if (Array.isArray(arr)) return arr;
22
+ }
14
23
  function _define_property(obj, key, value) {
15
24
  if (key in obj) {
16
25
  Object.defineProperty(obj, key, {
@@ -24,6 +33,33 @@ function _define_property(obj, key, value) {
24
33
  }
25
34
  return obj;
26
35
  }
36
+ function _iterable_to_array_limit(arr, i) {
37
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
38
+ if (_i == null) return;
39
+ var _arr = [];
40
+ var _n = true;
41
+ var _d = false;
42
+ var _s, _e;
43
+ try {
44
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
45
+ _arr.push(_s.value);
46
+ if (i && _arr.length === i) break;
47
+ }
48
+ } catch (err) {
49
+ _d = true;
50
+ _e = err;
51
+ } finally{
52
+ try {
53
+ if (!_n && _i["return"] != null) _i["return"]();
54
+ } finally{
55
+ if (_d) throw _e;
56
+ }
57
+ }
58
+ return _arr;
59
+ }
60
+ function _non_iterable_rest() {
61
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
62
+ }
27
63
  function _object_spread(target) {
28
64
  for(var i = 1; i < arguments.length; i++){
29
65
  var source = arguments[i] != null ? arguments[i] : {};
@@ -90,6 +126,17 @@ function _object_without_properties_loose(source, excluded) {
90
126
  }
91
127
  return target;
92
128
  }
129
+ function _sliced_to_array(arr, i) {
130
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
131
+ }
132
+ function _unsupported_iterable_to_array(o, minLen) {
133
+ if (!o) return;
134
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
135
+ var n = Object.prototype.toString.call(o).slice(8, -1);
136
+ if (n === "Object" && o.constructor) n = o.constructor.name;
137
+ if (n === "Map" || n === "Set") return Array.from(n);
138
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
139
+ }
93
140
  function ProductSetForm(_param) {
94
141
  var companyName = _param.companyName, isLoading = _param.isLoading, defaultValues = _param.defaultValues, onSubmitAndRedirect = _param.onSubmitAndRedirect, onSubmitNoRedirect = _param.onSubmitNoRedirect, productGroupList = _param.productGroupList, serverErrors = _param.serverErrors, _param_providerHasMap = _param.providerHasMap, providerHasMap = _param_providerHasMap === void 0 ? false : _param_providerHasMap, _param_venueMapSets = _param.venueMapSets, venueMapSets = _param_venueMapSets === void 0 ? [] : _param_venueMapSets, providerHasBookingManagement = _param.providerHasBookingManagement, zones = _param.zones, isCreateAction = _param.isCreateAction, workHours = _param.workHours, isOverrides = _param.isOverrides, isCreateNewOverrides = _param.isCreateNewOverrides, timeZone = _param.timeZone, shared = _object_without_properties(_param, [
95
142
  "companyName",
@@ -111,6 +158,7 @@ function ProductSetForm(_param) {
111
158
  ]);
112
159
  var t = useTranslation('Design').t;
113
160
  var _useDialogContext = useDialogContext(), isShownDialog = _useDialogContext.isShownDialog, onBeforeUnload = _useDialogContext.onBeforeUnload, onPopState = _useDialogContext.onPopState, onApproveDialog = _useDialogContext.onApproveDialog, onDeclineDialog = _useDialogContext.onDeclineDialog;
161
+ var _useState = _sliced_to_array(useState(''), 2), errorMessage = _useState[0], setErrorMessage = _useState[1];
114
162
  var form = useForm({
115
163
  defaultValues: defaultValues,
116
164
  mode: 'onChange'
@@ -142,6 +190,9 @@ function ProductSetForm(_param) {
142
190
  if (!serverErrors) {
143
191
  return;
144
192
  }
193
+ if (Array.isArray(serverErrors) && serverErrors[0]) {
194
+ setErrorMessage(serverErrors[0]);
195
+ }
145
196
  FormErrorService.handleServerErrors(serverErrors, setError);
146
197
  }, [
147
198
  serverErrors,
@@ -171,6 +222,13 @@ function ProductSetForm(_param) {
171
222
  onApprove: onApproveDialog,
172
223
  onDecline: onDeclineDialog
173
224
  }),
225
+ /*#__PURE__*/ jsx(ErrorModal, {
226
+ message: errorMessage,
227
+ isOpen: !!errorMessage,
228
+ onClose: function() {
229
+ return setErrorMessage('');
230
+ }
231
+ }),
174
232
  /*#__PURE__*/ jsx(FormProvider, _object_spread_props(_object_spread({}, form), {
175
233
  children: /*#__PURE__*/ jsx(Form, {
176
234
  onSubmit: form.handleSubmit(submitHandler(onSubmitAndRedirect)),
@@ -0,0 +1,6 @@
1
+ export declare const ProductSetNameControl: ({ value, onChange, error, }: {
2
+ value: string;
3
+ onChange: (value: string) => void;
4
+ error?: string;
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ //# sourceMappingURL=ProductSetNameControl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProductSetNameControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/ProductSetNameControl.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB,gCAI/B;IACD,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,4CAeA,CAAA"}
@@ -0,0 +1,35 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { Form } from 'react-bootstrap';
3
+ import { useTranslation } from 'react-i18next';
4
+
5
+ var ProductSetNameControl = function(param) {
6
+ var value = param.value, onChange = param.onChange, error = param.error;
7
+ var t = useTranslation([
8
+ 'Design'
9
+ ]).t;
10
+ return /*#__PURE__*/ jsxs(Form.Group, {
11
+ children: [
12
+ /*#__PURE__*/ jsxs(Form.Label, {
13
+ children: [
14
+ t('Design:ProductSetName'),
15
+ "*"
16
+ ]
17
+ }),
18
+ /*#__PURE__*/ jsx(Form.Control, {
19
+ value: value,
20
+ maxLength: 255,
21
+ onChange: function(e) {
22
+ return onChange(e.target.value);
23
+ },
24
+ placeholder: t('Design:placeholderProductSetName'),
25
+ isInvalid: Boolean(error)
26
+ }),
27
+ /*#__PURE__*/ jsx(Form.Control.Feedback, {
28
+ type: "invalid",
29
+ children: error
30
+ })
31
+ ]
32
+ });
33
+ };
34
+
35
+ export { ProductSetNameControl };