@licklist/design 0.69.4 → 0.69.6-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 (192) 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/utils/index.d.ts +8 -2
  4. package/dist/calendar/utils/index.d.ts.map +1 -1
  5. package/dist/calendar/utils/index.js +9 -21
  6. package/dist/date-time-button/DateContent.d.ts.map +1 -1
  7. package/dist/date-time-button/DateContent.js +3 -3
  8. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts +2 -1
  9. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts.map +1 -1
  10. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +3 -2
  11. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts +2 -1
  12. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts.map +1 -1
  13. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.js +31 -28
  14. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts +2 -1
  15. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts.map +1 -1
  16. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +14 -2
  17. package/dist/events/edit-event-modal/utils/getDefaultProductSet.d.ts.map +1 -1
  18. package/dist/events/edit-event-modal/utils/getDefaultProductSet.js +0 -1
  19. package/dist/events/event-card/utils.d.ts +1 -0
  20. package/dist/events/event-card/utils.d.ts.map +1 -1
  21. package/dist/events/event-card/utils.js +6 -2
  22. package/dist/iframe/activity-card/ActivityCard.d.ts +3 -1
  23. package/dist/iframe/activity-card/ActivityCard.d.ts.map +1 -1
  24. package/dist/iframe/activity-card/ActivityCard.js +8 -1
  25. package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.d.ts.map +1 -1
  26. package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.js +13 -0
  27. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -1
  28. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.js +2 -0
  29. package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts.map +1 -1
  30. package/dist/iframe/ryft/RyftPaymentForm.d.ts +2 -2
  31. package/dist/iframe/ryft/RyftPaymentForm.d.ts.map +1 -1
  32. package/dist/iframe/ryft/RyftPaymentForm.js +8 -2
  33. package/dist/iframe/ryft/utils/ryft-form.d.ts +2 -1
  34. package/dist/iframe/ryft/utils/ryft-form.d.ts.map +1 -1
  35. package/dist/iframe/ryft/utils/ryft-form.js +20 -1
  36. package/dist/index.js +1 -0
  37. package/dist/layout/DropDown.d.ts +2 -1
  38. package/dist/layout/DropDown.d.ts.map +1 -1
  39. package/dist/modals/confirmation/ConfirmModal.d.ts +3 -1
  40. package/dist/modals/confirmation/ConfirmModal.d.ts.map +1 -1
  41. package/dist/modals/confirmation/ConfirmModal.js +172 -8
  42. package/dist/notification/email-template/control/EmailTemplateControl.d.ts.map +1 -1
  43. package/dist/notification/email-template/control/EmailTemplateControl.js +3 -0
  44. package/dist/product-set/card/ProductSetCard.d.ts +6 -2
  45. package/dist/product-set/card/ProductSetCard.d.ts.map +1 -1
  46. package/dist/product-set/card/ProductSetCard.js +20 -11
  47. package/dist/product-set/control/DateAndRecurrenceInput.d.ts.map +1 -1
  48. package/dist/product-set/control/DateAndRecurrenceInput.js +4 -3
  49. package/dist/product-set/control/DateInput.d.ts.map +1 -1
  50. package/dist/product-set/control/DateInput.js +2 -2
  51. package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
  52. package/dist/product-set/form/ProductCategoriesControl.js +48 -2
  53. package/dist/product-set/form/ProductSetForm.d.ts +4 -1
  54. package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
  55. package/dist/product-set/form/ProductSetForm.js +64 -1
  56. package/dist/product-set/form/ProductSetNameControl.d.ts +6 -0
  57. package/dist/product-set/form/ProductSetNameControl.d.ts.map +1 -0
  58. package/dist/product-set/form/ProductSetNameControl.js +35 -0
  59. package/dist/product-set/form/ProductZonesControl.d.ts.map +1 -1
  60. package/dist/product-set/form/ProductZonesControl.js +0 -2
  61. package/dist/product-set/form/ProductsControl.js +1 -0
  62. package/dist/product-set/form/SelectCategoryModal.d.ts +12 -0
  63. package/dist/product-set/form/SelectCategoryModal.d.ts.map +1 -1
  64. package/dist/product-set/form/SelectCategoryModal.js +1 -1
  65. package/dist/product-set/form/SubProductsControl.d.ts.map +1 -1
  66. package/dist/product-set/form/SubProductsControl.js +0 -3
  67. package/dist/product-set/form/VenueMapsControl.d.ts.map +1 -1
  68. package/dist/product-set/form/VenueMapsControl.js +0 -3
  69. package/dist/product-set/form/index.d.ts +1 -0
  70. package/dist/product-set/form/index.d.ts.map +1 -1
  71. package/dist/product-set/product/ProductControl.d.ts.map +1 -1
  72. package/dist/product-set/product/booking-management/ProductBookingManagementControl.d.ts.map +1 -1
  73. package/dist/product-set/product/booking-management/ProductBookingManagementControl.js +6 -0
  74. package/dist/product-set/product/deposit/ProductDepositControl.d.ts.map +1 -1
  75. package/dist/product-set/product/deposit/ProductDepositControl.js +3 -0
  76. package/dist/product-set/product/duration/ProductDurationControl.d.ts.map +1 -1
  77. package/dist/product-set/product/duration/ProductDurationControl.js +6 -0
  78. package/dist/product-set/product/price/ProductPriceControl.d.ts.map +1 -1
  79. package/dist/product-set/product/price/ProductPriceControl.js +3 -0
  80. package/dist/product-set/product/quantity/ProductQuantityConstantControl.d.ts.map +1 -1
  81. package/dist/product-set/product/quantity/ProductQuantityConstantControl.js +6 -0
  82. package/dist/product-set/product/quantity/ProductQuantityControl.d.ts.map +1 -1
  83. package/dist/product-set/product/quantity/ProductQuantityControl.js +6 -0
  84. package/dist/product-set/product/quantity/ProductQuantityRechargingControl.d.ts.map +1 -1
  85. package/dist/product-set/product/quantity/ProductQuantityRechargingControl.js +4 -1
  86. package/dist/product-set/product-category/ProductCategoryControl.d.ts.map +1 -1
  87. package/dist/product-set/product-category/ProductCategoryControl.js +12 -0
  88. package/dist/product-set/utils/index.d.ts +7 -0
  89. package/dist/product-set/utils/index.d.ts.map +1 -1
  90. package/dist/product-set/utils/index.js +10 -1
  91. package/dist/recurrence-input/RecurrenceEndInput.d.ts.map +1 -1
  92. package/dist/recurrence-input/RecurrenceEndInput.js +3 -0
  93. package/dist/recurring-date-picker-input/RecurrenceEndInput.d.ts.map +1 -1
  94. package/dist/resource/form/components/CapacityControl.d.ts.map +1 -1
  95. package/dist/resource/form/components/CapacityControl.js +3 -0
  96. package/dist/resource/form/components/SortControl.d.ts.map +1 -1
  97. package/dist/resource/form/components/SortControl.js +3 -0
  98. package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
  99. package/dist/sales/booking/results/components/ResultCard.js +0 -2
  100. package/dist/sales/coupon/control/CouponFormControl.d.ts.map +1 -1
  101. package/dist/sales/coupon/control/CouponFormControl.js +21 -0
  102. package/dist/setting/admin/PaymentFeeForm.d.ts.map +1 -1
  103. package/dist/setting/admin/PaymentFeeForm.js +16 -1
  104. package/dist/setting/dashboard/DashboardSettingForm.d.ts.map +1 -1
  105. package/dist/setting/dashboard/DashboardSettingForm.js +4 -1
  106. package/dist/snippet/snippet-template/preview/Preview.d.ts.map +1 -1
  107. package/dist/snippet/snippet-template/preview/Preview.js +6 -0
  108. package/dist/sortable-tree/SortableTreeItem.d.ts +2 -1
  109. package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
  110. package/dist/sortable-tree/SortableTreeItem.js +10 -4
  111. package/dist/static/CurrencyNumberInput.d.ts.map +1 -1
  112. package/dist/static/CurrencyNumberInput.js +3 -0
  113. package/dist/static/form-number-input/FormNumberInput.d.ts.map +1 -1
  114. package/dist/static/form-number-input/FormNumberInput.js +3 -0
  115. package/dist/static/number-input/NumberInput.d.ts.map +1 -1
  116. package/dist/static/number-input/NumberInput.js +3 -0
  117. package/dist/styles/availability-indicator/AvailabilityIndicator.scss +9 -0
  118. package/dist/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
  119. package/dist/styles/product-set/ProductSetForm.scss +22 -0
  120. package/dist/styles/ryft-payment-form/RyftPaymentForm.scss +25 -0
  121. package/dist/styles/sales/BookingResults.scss +1 -1
  122. package/dist/typeahead/Typeahead.d.ts +5 -1
  123. package/dist/typeahead/Typeahead.d.ts.map +1 -1
  124. package/dist/typeahead/Typeahead.js +9 -2
  125. package/dist/zone/form/components/GameDurationControl.d.ts.map +1 -1
  126. package/dist/zone/form/components/GameDurationControl.js +3 -0
  127. package/dist/zone/form/components/SortControl.d.ts.map +1 -1
  128. package/dist/zone/form/components/SortControl.js +3 -0
  129. package/package.json +8 -7
  130. package/src/affiliate/form/AffiliateForm.tsx +1 -0
  131. package/src/auth/Login/LoginComponent.tsx +1 -1
  132. package/src/calendar/utils/index.ts +17 -26
  133. package/src/date-time-button/DateContent.tsx +3 -3
  134. package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx +3 -0
  135. package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx +88 -85
  136. package/src/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.tsx +11 -1
  137. package/src/events/edit-event-modal/utils/getDefaultProductSet.ts +0 -1
  138. package/src/events/event-card/utils.ts +5 -1
  139. package/src/iframe/activity-card/ActivityCard.tsx +6 -0
  140. package/src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx +9 -0
  141. package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +1 -0
  142. package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +1 -0
  143. package/src/iframe/ryft/RyftPaymentForm.tsx +9 -4
  144. package/src/iframe/ryft/utils/ryft-form.ts +28 -2
  145. package/src/layout/DropDown.tsx +1 -1
  146. package/src/modals/confirmation/ConfirmModal.tsx +19 -3
  147. package/src/notification/email-template/control/EmailTemplateControl.tsx +1 -0
  148. package/src/product-set/card/ProductSetCard.tsx +32 -6
  149. package/src/product-set/control/DateAndRecurrenceInput.tsx +3 -1
  150. package/src/product-set/control/DateInput.tsx +2 -1
  151. package/src/product-set/form/ProductCategoriesControl.tsx +37 -1
  152. package/src/product-set/form/ProductSetForm.tsx +24 -2
  153. package/src/product-set/form/ProductSetNameControl.tsx +27 -0
  154. package/src/product-set/form/ProductZonesControl.tsx +1 -4
  155. package/src/product-set/form/SelectCategoryModal.tsx +2 -2
  156. package/src/product-set/form/SubProductsControl.tsx +0 -3
  157. package/src/product-set/form/VenueMapsControl.tsx +0 -3
  158. package/src/product-set/form/index.ts +1 -0
  159. package/src/product-set/product/ProductControl.tsx +0 -1
  160. package/src/product-set/product/advanced-options/AdvancedOptions.tsx +1 -1
  161. package/src/product-set/product/booking-management/ProductBookingManagementControl.tsx +2 -0
  162. package/src/product-set/product/deposit/ProductDepositControl.tsx +1 -0
  163. package/src/product-set/product/duration/ProductDurationControl.tsx +2 -0
  164. package/src/product-set/product/price/ProductPriceControl.tsx +1 -0
  165. package/src/product-set/product/quantity/ProductQuantityConstantControl.tsx +2 -0
  166. package/src/product-set/product/quantity/ProductQuantityControl.tsx +2 -0
  167. package/src/product-set/product/quantity/ProductQuantityRechargingControl.tsx +1 -0
  168. package/src/product-set/product-category/ProductCategoryControl.tsx +4 -0
  169. package/src/product-set/product-zone/ProductZoneControl.tsx +1 -1
  170. package/src/product-set/utils/index.ts +11 -0
  171. package/src/recurrence-input/RecurrenceEndInput.tsx +1 -0
  172. package/src/recurring-date-picker-input/RecurrenceEndInput.tsx +1 -0
  173. package/src/resource/form/components/CapacityControl.tsx +1 -0
  174. package/src/resource/form/components/SortControl.tsx +1 -0
  175. package/src/sales/booking/results/components/ResultCard.tsx +0 -2
  176. package/src/sales/coupon/control/CouponFormControl.tsx +7 -0
  177. package/src/setting/admin/PaymentFeeForm.tsx +5 -0
  178. package/src/setting/dashboard/DashboardSettingForm.tsx +1 -0
  179. package/src/snippet/snippet-template/preview/Preview.tsx +6 -0
  180. package/src/sortable-tree/SortableTreeItem.tsx +6 -0
  181. package/src/static/CurrencyNumberInput.tsx +1 -0
  182. package/src/static/form-number-input/FormNumberInput.tsx +1 -0
  183. package/src/static/number-input/NumberInput.tsx +1 -0
  184. package/src/styles/availability-indicator/AvailabilityIndicator.scss +9 -0
  185. package/src/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
  186. package/src/styles/product-set/ProductSetForm.scss +22 -0
  187. package/src/styles/ryft-payment-form/RyftPaymentForm.scss +25 -0
  188. package/src/styles/sales/BookingResults.scss +1 -1
  189. package/src/typeahead/Typeahead.tsx +15 -1
  190. package/src/zone/form/components/GameDurationControl.tsx +1 -0
  191. package/src/zone/form/components/SortControl.tsx +1 -0
  192. package/yarn.lock +20 -62
@@ -38,7 +38,7 @@ export interface RyftPaymentFormProps {
38
38
  isCreateLoading: boolean
39
39
  isAppUsingInIframe?: boolean
40
40
  onApplePayButtonClick?: () => void
41
- applePayButtonDisabled?: boolean
41
+ payButtonDisabled?: boolean
42
42
  initRyft: (
43
43
  onSuccess: () => void,
44
44
  onFailure: (error?: string) => void,
@@ -57,6 +57,7 @@ export const RyftPaymentForm = ({
57
57
  initRyft,
58
58
  resetReferrer,
59
59
  onSubmit,
60
+ payButtonDisabled,
60
61
  }: RyftPaymentFormProps) => {
61
62
  const { t } = useTranslation(['Design', 'Validation', 'Ryft'])
62
63
  const formRef = useRef<HTMLFormElement | null>(null)
@@ -89,7 +90,6 @@ export const RyftPaymentForm = ({
89
90
 
90
91
  const handleSubmit = async () => {
91
92
  setIsBtnDisabled(true)
92
-
93
93
  try {
94
94
  const paymentSession = await onSubmit()
95
95
 
@@ -142,17 +142,21 @@ export const RyftPaymentForm = ({
142
142
  t,
143
143
  isAppUsingInIframe,
144
144
  onApplePayButtonClick,
145
+ isDisableButton: !payButtonDisabled,
145
146
  additionalPaymentMethodsEnabled:
146
147
  providerPaymentSettings?.additionalPaymentMethodsEnabled,
147
148
  })
148
149
  },
149
150
  // eslint-disable-next-line react-hooks/exhaustive-deps
150
- [formRef.current?.childNodes?.length, showApplePayButton],
151
+ [
152
+ formRef.current?.childNodes?.length,
153
+ showApplePayButton,
154
+ payButtonDisabled,
155
+ ],
151
156
  )
152
157
 
153
158
  useEffect(() => {
154
159
  if (!accountId.data?.account_id || accountId.isError) return
155
-
156
160
  initRyft(
157
161
  () => {
158
162
  addEventHandler('cardValidationChanged', (e: MessageEvent['data']) => {
@@ -215,6 +219,7 @@ export const RyftPaymentForm = ({
215
219
  onSubmit={methods.handleSubmit(handleSubmit)}
216
220
  className='ryft-payment-form'
217
221
  >
222
+ <div className='form-disable-box' id='form-disable-box' />
218
223
  <div className='submit-button-wrapper mt-4 p-1'>
219
224
  <Button type='submit' disabled={isBtnDisabled || !isValid}>
220
225
  {isBtnDisabled && <ButtonLoader />}
@@ -7,6 +7,7 @@ interface InjectComponentsInRyftForm
7
7
  'onApplePayButtonClick' | 'isAppUsingInIframe'
8
8
  > {
9
9
  t: TFunction<string[]>
10
+ isDisableButton?: boolean
10
11
  additionalPaymentMethodsEnabled?: boolean
11
12
  }
12
13
 
@@ -14,16 +15,19 @@ export const injectComponentsInRyftForm = ({
14
15
  t,
15
16
  additionalPaymentMethodsEnabled,
16
17
  isAppUsingInIframe,
18
+ isDisableButton,
17
19
  onApplePayButtonClick,
18
20
  }: InjectComponentsInRyftForm) => {
19
21
  const cardContainer = document.getElementById('ryft-pay-iframe')
20
-
21
22
  if (!cardContainer) {
22
23
  return
23
24
  }
24
25
  // Removing of the old title container
25
26
  document.getElementById('card-title-container')?.remove()
26
27
 
28
+ cardContainer.style.opacity = isDisableButton ? '0.6' : '1'
29
+ cardContainer.ariaDisabled = isDisableButton?.toString()
30
+
27
31
  const cardTitle = document.createElement('div')
28
32
  const cardText = document.createElement('div')
29
33
  const cardTitleContainer = document.createElement('div')
@@ -35,7 +39,6 @@ export const injectComponentsInRyftForm = ({
35
39
  cardContainer?.before(cardTitleContainer)
36
40
 
37
41
  const payGrid = document.getElementById('ryft-pay-grid')
38
-
39
42
  if (!payGrid || !additionalPaymentMethodsEnabled) {
40
43
  return
41
44
  }
@@ -58,6 +61,29 @@ export const injectComponentsInRyftForm = ({
58
61
  divider.id = 'mobile-pay-divider'
59
62
  container.id = 'mobile-pay-divider-container'
60
63
  container.append(dividerText, divider)
64
+ const payIframe = document.getElementById('ryft-pay-iframe')
65
+ if (payIframe) {
66
+ const formBox = document.getElementById('form-disable-box')
67
+ if (formBox) {
68
+ formBox.style.display = isDisableButton ? 'block' : 'none'
69
+ }
70
+
71
+ const googleButton = document.getElementById(
72
+ 'gpay-button-online-api-id',
73
+ ) as HTMLButtonElement
74
+ const appleButton = document.getElementById(
75
+ 'ryft-pay-apple-pay-button',
76
+ ) as HTMLButtonElement
77
+ if (googleButton) {
78
+ googleButton.disabled = isDisableButton
79
+ googleButton.style.opacity = isDisableButton ? '1' : '0.6'
80
+ }
81
+ if (appleButton) {
82
+ appleButton.disabled = isDisableButton
83
+ appleButton.style.opacity = isDisableButton ? '1' : '0.6'
84
+ }
85
+ }
86
+
61
87
  if (isAppUsingInIframe) {
62
88
  const applePayButton = document.createElement('button')
63
89
  applePayButton.id = 'apple-pay'
@@ -1,4 +1,4 @@
1
- import { forwardRef } from 'react'
1
+ import React, { forwardRef } from 'react'
2
2
 
3
3
  interface Props {
4
4
  children?: React.ReactNode | React.ReactNode[]
@@ -20,6 +20,9 @@ export type ConfirmModalTypes =
20
20
  export interface ConfirmModalProps {
21
21
  type?: ConfirmModalTypes
22
22
  children?: (confirm: (action: ConfirmAction) => void) => ReactNode
23
+ // confirm function memoize the callback function. It's an alternative function
24
+ confirmationHandler?: () => Promise<boolean | undefined>
25
+ disabledButtons?: boolean
23
26
  title?: string
24
27
  content?: string | ReactNode
25
28
  onClose?: () => void
@@ -37,7 +40,9 @@ export function ConfirmModal({
37
40
  type = 'default',
38
41
  children,
39
42
  onClose,
43
+ confirmationHandler,
40
44
  title,
45
+ disabledButtons,
41
46
  content,
42
47
  hideButtons = false,
43
48
  }: ConfirmModalProps) {
@@ -52,10 +57,16 @@ export function ConfirmModal({
52
57
  setIsOpen(() => true)
53
58
  }
54
59
 
55
- const handleConfirmation = (e) => {
60
+ const handleConfirmation = async (e) => {
56
61
  e.stopPropagation()
57
- if (!actionRef.current) return
58
-
62
+ if (!actionRef.current && !confirmationHandler) return
63
+ if (confirmationHandler) {
64
+ const res = await confirmationHandler()
65
+ if (res) {
66
+ setIsOpen(() => false)
67
+ }
68
+ return
69
+ }
59
70
  actionRef.current()
60
71
  setIsOpen(() => false)
61
72
  }
@@ -88,6 +99,7 @@ export function ConfirmModal({
88
99
  <Button
89
100
  variant='danger'
90
101
  className='btn-sm rounded'
102
+ disabled={disabledButtons}
91
103
  onClick={handleClose}
92
104
  data-id={CONFIRM_MODAL_ACTION_DECLINE}
93
105
  >
@@ -105,12 +117,14 @@ export function ConfirmModal({
105
117
  variant='outline'
106
118
  className='cancel-button'
107
119
  onClick={handleClose}
120
+ disabled={disabledButtons}
108
121
  data-id={CONFIRM_MODAL_ACTION_DECLINE}
109
122
  >
110
123
  {t('cancel')}
111
124
  </Button>
112
125
  <Button
113
126
  variant='danger'
127
+ disabled={disabledButtons}
114
128
  onClick={handleConfirmation}
115
129
  data-id={CONFIRM_MODAL_ACTION_CONFIRM}
116
130
  >
@@ -121,6 +135,7 @@ export function ConfirmModal({
121
135
  <>
122
136
  <Button
123
137
  variant='danger'
138
+ disabled={disabledButtons}
124
139
  onClick={handleClose}
125
140
  data-id={CONFIRM_MODAL_ACTION_DECLINE}
126
141
  >
@@ -128,6 +143,7 @@ export function ConfirmModal({
128
143
  </Button>
129
144
  <Button
130
145
  variant='success'
146
+ disabled={disabledButtons}
131
147
  onClick={handleConfirmation}
132
148
  data-id={CONFIRM_MODAL_ACTION_CONFIRM}
133
149
  >
@@ -434,6 +434,7 @@ export const EmailTemplateControl = forwardRef(
434
434
  `templateOptionValues.${option?.id}.value`,
435
435
  )}
436
436
  type='number'
437
+ onWheel={(event) => event.currentTarget.blur()}
437
438
  placeholder={t(`Design:${option.name}`)}
438
439
  id={option.name + option.id}
439
440
  defaultValue={option.selectedValue || ''}
@@ -9,15 +9,20 @@ import RouteService from '@licklist/plugins/dist/services/Route/RouteService'
9
9
  import { FaEllipsisH, FaEye, FaTrashAlt } from 'react-icons/fa'
10
10
  import { ConfirmModal } from '../../modals'
11
11
  import { MenuButton } from '../../table/MenuButton'
12
+ import { ProductSetNameControl } from '../form/ProductSetNameControl'
12
13
 
13
14
  export interface ProductSetCardProps extends HasPermissionProp {
14
15
  name: string
15
16
  rrule?: string
16
17
  href: string
17
- onCopy: () => void
18
+ duplicateProductSetName: string
19
+ onChangeDuplicateProductSetName: (value: string) => void
20
+ onCopy: () => Promise<boolean | undefined>
18
21
  onRemove: () => void
22
+ isLoading?: boolean
19
23
  className?: string
20
24
  override?: number
25
+ duplicateProductSetError?: string
21
26
  }
22
27
 
23
28
  export function ProductSetCard({
@@ -26,6 +31,10 @@ export function ProductSetCard({
26
31
  href,
27
32
  onCopy,
28
33
  onRemove,
34
+ onChangeDuplicateProductSetName,
35
+ duplicateProductSetName,
36
+ duplicateProductSetError,
37
+ isLoading,
29
38
  className = '',
30
39
  hasPermission = true,
31
40
  override = 0,
@@ -35,19 +44,23 @@ export function ProductSetCard({
35
44
  const productSetCardClasses = `product-set-card ${className}`
36
45
  const [isOverlayVisibile, setIsOverlayVisible] = useState(false)
37
46
 
47
+ const onCardClick = () => {
48
+ RouteService.redirectTo(href)
49
+ }
38
50
  return (
51
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events
39
52
  <div
40
53
  role='button'
41
54
  tabIndex={0}
42
55
  className='border-0 product-set-card-wrapper w-100 pb-0'
43
- onClick={() => RouteService.redirectTo(href)}
44
- onKeyUp={() => RouteService.redirectTo(href)}
56
+ onClick={onCardClick}
45
57
  >
46
58
  <div className={productSetCardClasses}>
47
59
  <div className='product-set-card-link'>
48
60
  <div className='d-flex flex-column'>
49
61
  <div>
50
- {name} {rrule && `(${RRule.fromString(rrule).toText()})`}
62
+ {name}
63
+ {rrule && `(${RRule.fromString(rrule).toText()})`}
51
64
  </div>
52
65
  {!!override && (
53
66
  <div className='h6 bold ml-1'>
@@ -87,12 +100,25 @@ export function ProductSetCard({
87
100
  onClick={(e) => e.stopPropagation()}
88
101
  >
89
102
  {Boolean(onCopy) && (
90
- <ConfirmModal>
103
+ <ConfirmModal
104
+ // confirm function memoize the callback function and it leads to bugs
105
+ confirmationHandler={onCopy}
106
+ disabledButtons={isLoading}
107
+ content={
108
+ <ProductSetNameControl
109
+ value={duplicateProductSetName}
110
+ onChange={onChangeDuplicateProductSetName}
111
+ error={duplicateProductSetError}
112
+ />
113
+ }
114
+ >
91
115
  {(confirm) => (
92
116
  <MenuButton
93
117
  onClick={() => {
94
118
  setIsOverlayVisible(false)
95
- confirm(onCopy)
119
+ onChangeDuplicateProductSetName(name)
120
+ // confirm function memoize the callback function and it leads to bugs
121
+ confirm(() => {})
96
122
  }}
97
123
  name={t('duplicate')}
98
124
  className='product-set-card-menu-item-text'
@@ -198,6 +198,8 @@ export const DateAndRecurrenceInput = ({
198
198
  move(prevIndex, nextIndex)
199
199
  }
200
200
 
201
+ const errorMessage = errors.menuRecurrences?.message || errors.menuRecurrences?.root?.message
202
+
201
203
  useEffect(() => {
202
204
  if (fields.length) {
203
205
  clearErrors('menuRecurrences')
@@ -307,7 +309,7 @@ export const DateAndRecurrenceInput = ({
307
309
  />
308
310
 
309
311
  <div className='manual-form-error'>
310
- {errors.menuRecurrences?.message}
312
+ {errorMessage}
311
313
  </div>
312
314
  </div>
313
315
  </OverlayTrigger>
@@ -247,7 +247,8 @@ export const DateInput = ({
247
247
  menuRecurrence={menuRecurrence}
248
248
  onEdit={() => handleOnEdit(menuRecurrence, index)}
249
249
  errorMessage={
250
- errors?.menuRecurrences?.[`${index}`]?.availableTimes?.message
250
+ errors?.menuRecurrences?.[`${index}`]?.availableTimes
251
+ ?.message || errors?.menuRecurrences?.[`${index}`]?.message
251
252
  }
252
253
  />
253
254
  ))}
@@ -8,6 +8,7 @@ import {
8
8
  useFormContext,
9
9
  useWatch,
10
10
  } from 'react-hook-form'
11
+ import { FaBars, FaBowlingBall, FaCalendar, FaTicketAlt } from 'react-icons/fa'
11
12
  import { useTranslation } from 'react-i18next'
12
13
  import { useSensor, MouseSensor } from '@dnd-kit/core'
13
14
  import {
@@ -25,7 +26,11 @@ import { ProductCategoryControl } from '../product-category'
25
26
  import { ProductCategory } from '../types'
26
27
  import { ProductsControl } from './ProductsControl'
27
28
  import { ProductSetFormValues, WithIsLoading } from './ProductSetForm'
28
- import { SelectCategoryModal } from './SelectCategoryModal'
29
+ import {
30
+ SelectCategoryModal,
31
+ CATEGORY_TYPES_NAMES,
32
+ CategoryConfig,
33
+ } from './SelectCategoryModal'
29
34
  import { ProductSetLoadingContext } from './context'
30
35
  import { VenueMapSetModal } from './VenueMapSetModal'
31
36
  import { moveArrayElements, sortArrayByIndex } from '../utils'
@@ -33,6 +38,29 @@ import { useSortableTreeFunctions } from '../hooks/useSortableTreeFunctions'
33
38
  // @TODO not for first release
34
39
  // import Popover from "./ProductSetFormPopover";
35
40
 
41
+ const CATEGORIES_TYPE: Partial<Record<CategoryType, CategoryConfig>> = {
42
+ [CATEGORY_TYPES_NAMES.tickets]: {
43
+ label: 'tickets',
44
+ icon: <FaTicketAlt color='#0e8ce2' size={10} />,
45
+ },
46
+ [CATEGORY_TYPES_NAMES.bookings]: {
47
+ label: 'bookings',
48
+ icon: <FaCalendar color='#0e8ce2' size={10} />,
49
+ },
50
+ [CATEGORY_TYPES_NAMES.menuItems]: {
51
+ label: 'menuItems',
52
+ icon: <FaBars color='#0e8ce2' size={10} />,
53
+ },
54
+ [CATEGORY_TYPES_NAMES.game]: {
55
+ label: 'game',
56
+ icon: <FaBowlingBall color='#0e8ce2' size={10} />,
57
+ },
58
+ [CATEGORY_TYPES_NAMES.fixedDuration]: {
59
+ label: 'fixedDuration',
60
+ icon: <FaCalendar color='#0e8ce2' size={10} />,
61
+ },
62
+ }
63
+
36
64
  interface ProductCategoriesControlProps extends WithIsLoading {
37
65
  stepIndex: number
38
66
  isOverrides?: boolean
@@ -228,6 +256,8 @@ export function ProductCategoriesControl({
228
256
  setIsExpanded(productCategoryId)
229
257
  }
230
258
 
259
+ const categoryType = CATEGORIES_TYPE[productCategory.type]
260
+
231
261
  return (
232
262
  <Controller
233
263
  key={`product-category-${productCategory._id}`}
@@ -272,6 +302,12 @@ export function ProductCategoriesControl({
272
302
  )}
273
303
  modalClass={ProductSetModalClasses.category}
274
304
  isNewAdded={showCategoryModal}
305
+ itemButton={
306
+ <div className='btn-outline-primary item-icon sm border border-primary rounded-sm'>
307
+ {categoryType.icon}
308
+ <span className='ml-2'>{t(categoryType.label)}</span>
309
+ </div>
310
+ }
275
311
  body={
276
312
  <ProductCategoryControl
277
313
  isLoading={isLoading}
@@ -1,4 +1,4 @@
1
- import { useEffect } from 'react'
1
+ import { useEffect, useState } from 'react'
2
2
  import { FormValues } from '@licklist/plugins/dist/types/services/Form/hook-form-service'
3
3
  import { Button, Form, Col, Row } from 'react-bootstrap'
4
4
  import { FormProvider, useForm } from 'react-hook-form'
@@ -12,6 +12,7 @@ import { isEqual } from 'lodash'
12
12
  import { ProviderBookingManagementSetting } from '@licklist/core/dist/DataMapper/Provider/ProviderBookingManagementSettingDataMapper'
13
13
  import { Zone } from '@licklist/core/dist/DataMapper/Provider/ZoneDataMapper'
14
14
  import { WorkHour } from '@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper'
15
+ import { transformErrorToMessage } from '@licklist/plugins/dist/utils/error'
15
16
  import { Dialog, useDialogContext } from '../../modals/dialog'
16
17
  import {
17
18
  ProductSetControl,
@@ -22,16 +23,21 @@ import { Step } from '../types'
22
23
  import { ProductSetContextProvider, ProductSetLoadingContext } from './context'
23
24
  import { SelectItem } from '../../types/generic/SelectItem'
24
25
  import { checkAvailableTimesErrors, getFilteredTemplates } from '../utils'
26
+ import { ErrorModal } from '../../iframe/order-process/components/ErrorModal'
25
27
 
26
28
  export interface WithIsLoading {
27
29
  isLoading: boolean
28
30
  }
31
+ export interface WithIdOptional {
32
+ id?: number
33
+ }
34
+
29
35
  export interface WithId {
30
36
  id: number
31
37
  }
32
38
  export interface ProductSetFormValues
33
39
  extends FormValues,
34
- WithId,
40
+ WithIdOptional,
35
41
  ProductSetControlValues {
36
42
  steps: Step[]
37
43
  isOverrides?: boolean
@@ -84,6 +90,7 @@ export function ProductSetForm({
84
90
  onApproveDialog,
85
91
  onDeclineDialog,
86
92
  } = useDialogContext()
93
+ const [errorMessage, setErrorMessage] = useState('')
87
94
 
88
95
  const form = useForm<ProductSetFormValues>({
89
96
  defaultValues,
@@ -121,6 +128,15 @@ export function ProductSetForm({
121
128
  if (!serverErrors) {
122
129
  return
123
130
  }
131
+ if (!Array.isArray(serverErrors)) {
132
+ setErrorMessage(transformErrorToMessage(serverErrors))
133
+ return
134
+ }
135
+
136
+ if (Array.isArray(serverErrors) && serverErrors[0]) {
137
+ setErrorMessage(serverErrors[0])
138
+ }
139
+
124
140
  FormErrorService.handleServerErrors(serverErrors, setError)
125
141
  }, [serverErrors, setError])
126
142
 
@@ -156,6 +172,12 @@ export function ProductSetForm({
156
172
  onDecline={onDeclineDialog}
157
173
  />
158
174
 
175
+ <ErrorModal
176
+ message={errorMessage}
177
+ isOpen={!!errorMessage}
178
+ onClose={() => setErrorMessage('')}
179
+ />
180
+
159
181
  <FormProvider {...form}>
160
182
  <Form onSubmit={form.handleSubmit(submitHandler(onSubmitAndRedirect))}>
161
183
  <ProductSetLoadingContext.Consumer>
@@ -0,0 +1,27 @@
1
+ import { Form } from 'react-bootstrap'
2
+ import { useTranslation } from 'react-i18next'
3
+
4
+ export const ProductSetNameControl = ({
5
+ value,
6
+ onChange,
7
+ error,
8
+ }: {
9
+ value: string
10
+ onChange: (value: string) => void
11
+ error?: string
12
+ }) => {
13
+ const { t } = useTranslation(['Design'])
14
+ return (
15
+ <Form.Group>
16
+ <Form.Label>{t('Design:ProductSetName')}*</Form.Label>
17
+ <Form.Control
18
+ value={value}
19
+ maxLength={255}
20
+ onChange={(e) => onChange(e.target.value)}
21
+ placeholder={t('Design:placeholderProductSetName')}
22
+ isInvalid={Boolean(error)}
23
+ />
24
+ <Form.Control.Feedback type='invalid'>{error}</Form.Control.Feedback>
25
+ </Form.Group>
26
+ )
27
+ }
@@ -1,7 +1,4 @@
1
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2
- // @ts-nocheck
3
- import React, { useContext, useState } from 'react'
4
-
1
+ import { useContext, useState } from 'react'
5
2
  import {
6
3
  ArrayPath,
7
4
  Controller,
@@ -25,7 +25,7 @@ import {
25
25
  } from 'react-icons/fa'
26
26
  import { ProductSetLoadingContext } from './context'
27
27
 
28
- const CATEGORY_TYPES_NAMES = {
28
+ export const CATEGORY_TYPES_NAMES = {
29
29
  menuItems: CATEGORY_TYPE_MENU_ITEMS,
30
30
  tickets: CATEGORY_TYPE_TICKETS,
31
31
  bookings: CATEGORY_TYPE_BOOKINGS,
@@ -33,7 +33,7 @@ const CATEGORY_TYPES_NAMES = {
33
33
  fixedDuration: CATEGORY_TYPE_FIXED_DURATION,
34
34
  } as const
35
35
 
36
- type CategoryConfig = { label: string; icon: ReactElement }
36
+ export type CategoryConfig = { label: string; icon: ReactElement }
37
37
 
38
38
  const MAIN_CATEGORIES: Partial<Record<CategoryType, CategoryConfig>> = {
39
39
  [CATEGORY_TYPES_NAMES.tickets]: {
@@ -70,9 +70,6 @@ export function SubProductsControl({
70
70
  images: subProducts[index]?.images as Image[],
71
71
  }
72
72
  // @ts-expect-error TS2345
73
- // @TODO fix prod type error
74
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
75
- // @ts-ignore
76
73
  append(subProductCopy)
77
74
  }}
78
75
  />
@@ -46,9 +46,6 @@ export const VenueMapsControl = ({
46
46
  url={image.url}
47
47
  name={name}
48
48
  points={points}
49
- // @TODO fix prod type error
50
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
51
- // @ts-ignore
52
49
  products={products}
53
50
  pointProducts={pointProducts}
54
51
  onPointProductsChange={onPointProductsChange}
@@ -1 +1,2 @@
1
1
  export * from './ProductSetForm'
2
+ export * from './ProductSetNameControl'
@@ -34,7 +34,6 @@ import {
34
34
  } from 'react-hook-form'
35
35
  import { useTranslation } from 'react-i18next'
36
36
  import { useImages } from '@licklist/plugins/dist/hooks/Media/useImages'
37
-
38
37
  import {
39
38
  Image,
40
39
  IMAGE_TYPE_IMAGE,
@@ -1,4 +1,4 @@
1
- import React, { useContext } from 'react'
1
+ import { useContext } from 'react'
2
2
  import { Col, Form } from 'react-bootstrap'
3
3
  import { Controller, Path, useFormContext } from 'react-hook-form'
4
4
  import { HookFormService } from '@licklist/plugins'
@@ -86,6 +86,7 @@ export function ProductBookingManagementControl<T extends FormValues>(
86
86
  <Form.Control
87
87
  ref={ref}
88
88
  type='number'
89
+ onWheel={(event) => event.currentTarget.blur()}
89
90
  min={0}
90
91
  step={1}
91
92
  value={value as string}
@@ -129,6 +130,7 @@ export function ProductBookingManagementControl<T extends FormValues>(
129
130
  <Form.Control
130
131
  ref={ref}
131
132
  type='number'
133
+ onWheel={(event) => event.currentTarget.blur()}
132
134
  min='0'
133
135
  step='1'
134
136
  value={value as string}
@@ -50,6 +50,7 @@ export function ProductDepositControl<T extends FormValues>(
50
50
  <Form.Control
51
51
  ref={ref}
52
52
  type='number'
53
+ onWheel={(event) => event.currentTarget.blur()}
53
54
  min={0}
54
55
  max={Number(totalPrice)}
55
56
  step='0.01'
@@ -91,6 +91,7 @@ export const ProductDurationControl = <T,>({
91
91
  <Form.Control
92
92
  type='number'
93
93
  min={0}
94
+ onWheel={(event) => event.currentTarget.blur()}
94
95
  step={1}
95
96
  value={durationHours}
96
97
  disabled={disabled}
@@ -127,6 +128,7 @@ export const ProductDurationControl = <T,>({
127
128
  type='number'
128
129
  min={0}
129
130
  step={1}
131
+ onWheel={(event) => event.currentTarget.blur()}
130
132
  disabled={disabled}
131
133
  value={durationMinutes}
132
134
  isInvalid={isInvalid}
@@ -59,6 +59,7 @@ export function ProductPriceControl<T extends FormValues>({
59
59
  ref={ref}
60
60
  type='number'
61
61
  min={0}
62
+ onWheel={(event) => event.currentTarget.blur()}
62
63
  max={999999.99}
63
64
  step='0.01'
64
65
  value={value as string}
@@ -111,6 +111,7 @@ export function ProductQuantityConstantControl<T extends FormValues>(
111
111
  type='number'
112
112
  min={0}
113
113
  step={1}
114
+ onWheel={(event) => event.currentTarget.blur()}
114
115
  value={value as string}
115
116
  isInvalid={HookFormService.isInvalid<T>(
116
117
  `${fieldNamePrefix}.totalQuantity` as Path<T>,
@@ -165,6 +166,7 @@ export function ProductQuantityConstantControl<T extends FormValues>(
165
166
  type='number'
166
167
  min={0}
167
168
  step={1}
169
+ onWheel={(event) => event.currentTarget.blur()}
168
170
  value={value as string}
169
171
  onChange={onChange}
170
172
  onFocus={onFocus}
@@ -85,6 +85,7 @@ export function ProductQuantityControl<T extends FormValues>(
85
85
  type='number'
86
86
  min={0}
87
87
  step={1}
88
+ onWheel={(event) => event.currentTarget.blur()}
88
89
  value={value as string}
89
90
  onChange={onChange}
90
91
  onFocus={onFocus}
@@ -143,6 +144,7 @@ export function ProductQuantityControl<T extends FormValues>(
143
144
  type='number'
144
145
  min={0}
145
146
  step={1}
147
+ onWheel={(event) => event.currentTarget.blur()}
146
148
  value={value && (value as string)}
147
149
  onFocus={onFocus}
148
150
  onChange={onChange}
@@ -69,6 +69,7 @@ export function ProductQuantityRechargingControl<T extends FormValues>(
69
69
  type='number'
70
70
  min={0}
71
71
  step={1}
72
+ onWheel={(event) => event.currentTarget.blur()}
72
73
  {...register(`${fieldNamePrefix}.totalQuantity` as Path<T>, {
73
74
  validate: (value) => {
74
75
  if (unlimited) return true