@licklist/design 0.69.2 → 0.69.3-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 (187) 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/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts +2 -1
  4. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts.map +1 -1
  5. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +3 -2
  6. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts +2 -1
  7. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts.map +1 -1
  8. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.js +53 -24
  9. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +1 -0
  10. package/dist/events/edit-event-modal/utils/getDefaultProductSet.d.ts.map +1 -1
  11. package/dist/events/edit-event-modal/utils/getDefaultProductSet.js +3 -2
  12. package/dist/iframe/activity-card/ActivityCard.d.ts +5 -4
  13. package/dist/iframe/activity-card/ActivityCard.d.ts.map +1 -1
  14. package/dist/iframe/activity-card/ActivityCard.js +52 -40
  15. package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.d.ts.map +1 -1
  16. package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.js +13 -0
  17. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -1
  18. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.js +2 -0
  19. package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts.map +1 -1
  20. package/dist/iframe/ryft/RyftPaymentForm.d.ts +2 -2
  21. package/dist/iframe/ryft/RyftPaymentForm.d.ts.map +1 -1
  22. package/dist/iframe/ryft/RyftPaymentForm.js +8 -2
  23. package/dist/iframe/ryft/utils/ryft-form.d.ts +2 -1
  24. package/dist/iframe/ryft/utils/ryft-form.d.ts.map +1 -1
  25. package/dist/iframe/ryft/utils/ryft-form.js +20 -1
  26. package/dist/index.js +1 -0
  27. package/dist/layout/DropDown.d.ts +2 -1
  28. package/dist/layout/DropDown.d.ts.map +1 -1
  29. package/dist/modals/confirmation/ConfirmModal.d.ts +3 -1
  30. package/dist/modals/confirmation/ConfirmModal.d.ts.map +1 -1
  31. package/dist/modals/confirmation/ConfirmModal.js +172 -8
  32. package/dist/notification/email-template/control/EmailTemplateControl.d.ts.map +1 -1
  33. package/dist/notification/email-template/control/EmailTemplateControl.js +3 -0
  34. package/dist/product-set/card/ProductSetCard.d.ts +6 -2
  35. package/dist/product-set/card/ProductSetCard.d.ts.map +1 -1
  36. package/dist/product-set/card/ProductSetCard.js +30 -11
  37. package/dist/product-set/control/DateInput.d.ts.map +1 -1
  38. package/dist/product-set/control/DateInput.js +2 -2
  39. package/dist/product-set/control/ProductSetControl.d.ts +4 -0
  40. package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
  41. package/dist/product-set/control/ProductSetControl.js +24 -3
  42. package/dist/product-set/control/ProductSetImageControl.d.ts +2 -0
  43. package/dist/product-set/control/ProductSetImageControl.d.ts.map +1 -0
  44. package/dist/product-set/control/ProductSetImageControl.js +279 -0
  45. package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
  46. package/dist/product-set/form/ProductCategoriesControl.js +48 -2
  47. package/dist/product-set/form/ProductSetForm.d.ts +4 -1
  48. package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
  49. package/dist/product-set/form/ProductSetForm.js +64 -1
  50. package/dist/product-set/form/ProductSetNameControl.d.ts +6 -0
  51. package/dist/product-set/form/ProductSetNameControl.d.ts.map +1 -0
  52. package/dist/product-set/form/ProductSetNameControl.js +35 -0
  53. package/dist/product-set/form/ProductZonesControl.d.ts.map +1 -1
  54. package/dist/product-set/form/ProductZonesControl.js +0 -2
  55. package/dist/product-set/form/ProductsControl.js +1 -0
  56. package/dist/product-set/form/SelectCategoryModal.d.ts +12 -0
  57. package/dist/product-set/form/SelectCategoryModal.d.ts.map +1 -1
  58. package/dist/product-set/form/SelectCategoryModal.js +1 -1
  59. package/dist/product-set/form/SubProductsControl.d.ts.map +1 -1
  60. package/dist/product-set/form/SubProductsControl.js +0 -3
  61. package/dist/product-set/form/VenueMapsControl.d.ts.map +1 -1
  62. package/dist/product-set/form/VenueMapsControl.js +0 -3
  63. package/dist/product-set/form/index.d.ts +1 -0
  64. package/dist/product-set/form/index.d.ts.map +1 -1
  65. package/dist/product-set/product/ProductControl.d.ts.map +1 -1
  66. package/dist/product-set/product/booking-management/ProductBookingManagementControl.d.ts.map +1 -1
  67. package/dist/product-set/product/booking-management/ProductBookingManagementControl.js +6 -0
  68. package/dist/product-set/product/deposit/ProductDepositControl.d.ts.map +1 -1
  69. package/dist/product-set/product/deposit/ProductDepositControl.js +3 -0
  70. package/dist/product-set/product/duration/ProductDurationControl.d.ts.map +1 -1
  71. package/dist/product-set/product/duration/ProductDurationControl.js +6 -0
  72. package/dist/product-set/product/price/ProductPriceControl.d.ts.map +1 -1
  73. package/dist/product-set/product/price/ProductPriceControl.js +3 -0
  74. package/dist/product-set/product/quantity/ProductQuantityConstantControl.d.ts.map +1 -1
  75. package/dist/product-set/product/quantity/ProductQuantityConstantControl.js +6 -0
  76. package/dist/product-set/product/quantity/ProductQuantityControl.d.ts.map +1 -1
  77. package/dist/product-set/product/quantity/ProductQuantityControl.js +6 -0
  78. package/dist/product-set/product/quantity/ProductQuantityRechargingControl.d.ts.map +1 -1
  79. package/dist/product-set/product/quantity/ProductQuantityRechargingControl.js +4 -1
  80. package/dist/product-set/product-category/ProductCategoryControl.d.ts.map +1 -1
  81. package/dist/product-set/product-category/ProductCategoryControl.js +12 -0
  82. package/dist/product-set/utils/index.d.ts +7 -0
  83. package/dist/product-set/utils/index.d.ts.map +1 -1
  84. package/dist/product-set/utils/index.js +10 -1
  85. package/dist/recurrence-input/RecurrenceEndInput.d.ts.map +1 -1
  86. package/dist/recurrence-input/RecurrenceEndInput.js +3 -0
  87. package/dist/recurring-date-picker-input/RecurrenceEndInput.d.ts.map +1 -1
  88. package/dist/resource/form/components/CapacityControl.d.ts.map +1 -1
  89. package/dist/resource/form/components/CapacityControl.js +3 -0
  90. package/dist/resource/form/components/SortControl.d.ts.map +1 -1
  91. package/dist/resource/form/components/SortControl.js +3 -0
  92. package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
  93. package/dist/sales/booking/results/components/ResultCard.js +0 -2
  94. package/dist/sales/coupon/control/CouponFormControl.d.ts.map +1 -1
  95. package/dist/sales/coupon/control/CouponFormControl.js +21 -0
  96. package/dist/setting/admin/PaymentFeeForm.d.ts.map +1 -1
  97. package/dist/setting/admin/PaymentFeeForm.js +16 -1
  98. package/dist/setting/dashboard/DashboardSettingForm.d.ts.map +1 -1
  99. package/dist/setting/dashboard/DashboardSettingForm.js +4 -1
  100. package/dist/snippet/snippet-template/preview/Preview.d.ts.map +1 -1
  101. package/dist/snippet/snippet-template/preview/Preview.js +6 -0
  102. package/dist/sortable-tree/SortableTreeItem.d.ts +2 -1
  103. package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
  104. package/dist/sortable-tree/SortableTreeItem.js +10 -4
  105. package/dist/static/CurrencyNumberInput.d.ts.map +1 -1
  106. package/dist/static/CurrencyNumberInput.js +3 -0
  107. package/dist/static/form-number-input/FormNumberInput.d.ts.map +1 -1
  108. package/dist/static/form-number-input/FormNumberInput.js +3 -0
  109. package/dist/static/number-input/NumberInput.d.ts.map +1 -1
  110. package/dist/static/number-input/NumberInput.js +3 -0
  111. package/dist/styles/activity-card/{GridActivitiesCard.scss → ActivitiesCard.scss} +19 -5
  112. package/dist/styles/activity-card/ListActivitiesCard.scss +12 -42
  113. package/dist/styles/activity-card/_index.scss +1 -1
  114. package/dist/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
  115. package/dist/styles/product-set/ProductSetForm.scss +22 -0
  116. package/dist/styles/ryft-payment-form/RyftPaymentForm.scss +28 -1
  117. package/dist/styles/sales/BookingResults.scss +1 -1
  118. package/dist/typeahead/Typeahead.d.ts +5 -1
  119. package/dist/typeahead/Typeahead.d.ts.map +1 -1
  120. package/dist/typeahead/Typeahead.js +9 -2
  121. package/dist/zone/form/components/GameDurationControl.d.ts.map +1 -1
  122. package/dist/zone/form/components/GameDurationControl.js +3 -0
  123. package/dist/zone/form/components/SortControl.d.ts.map +1 -1
  124. package/dist/zone/form/components/SortControl.js +3 -0
  125. package/package.json +8 -6
  126. package/src/affiliate/form/AffiliateForm.tsx +1 -0
  127. package/src/auth/Login/LoginComponent.tsx +1 -1
  128. package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx +3 -2
  129. package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx +91 -86
  130. package/src/events/edit-event-modal/utils/getDefaultProductSet.ts +2 -1
  131. package/src/iframe/activity-card/ActivityCard.tsx +35 -24
  132. package/src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx +9 -0
  133. package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +1 -0
  134. package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +1 -0
  135. package/src/iframe/ryft/RyftPaymentForm.tsx +13 -5
  136. package/src/iframe/ryft/utils/ryft-form.ts +26 -2
  137. package/src/layout/DropDown.tsx +1 -1
  138. package/src/modals/confirmation/ConfirmModal.tsx +19 -3
  139. package/src/notification/email-template/control/EmailTemplateControl.tsx +1 -0
  140. package/src/product-set/card/ProductSetCard.tsx +47 -8
  141. package/src/product-set/control/DateInput.tsx +2 -1
  142. package/src/product-set/control/ProductSetControl.tsx +46 -52
  143. package/src/product-set/control/ProductSetImageControl.tsx +97 -0
  144. package/src/product-set/form/ProductCategoriesControl.tsx +37 -1
  145. package/src/product-set/form/ProductSetForm.tsx +24 -2
  146. package/src/product-set/form/ProductSetNameControl.tsx +27 -0
  147. package/src/product-set/form/ProductZonesControl.tsx +1 -4
  148. package/src/product-set/form/SelectCategoryModal.tsx +2 -2
  149. package/src/product-set/form/SubProductsControl.tsx +0 -3
  150. package/src/product-set/form/VenueMapsControl.tsx +0 -3
  151. package/src/product-set/form/index.ts +1 -0
  152. package/src/product-set/product/ProductControl.tsx +0 -1
  153. package/src/product-set/product/advanced-options/AdvancedOptions.tsx +1 -1
  154. package/src/product-set/product/booking-management/ProductBookingManagementControl.tsx +2 -0
  155. package/src/product-set/product/deposit/ProductDepositControl.tsx +1 -0
  156. package/src/product-set/product/duration/ProductDurationControl.tsx +2 -0
  157. package/src/product-set/product/price/ProductPriceControl.tsx +1 -0
  158. package/src/product-set/product/quantity/ProductQuantityConstantControl.tsx +2 -0
  159. package/src/product-set/product/quantity/ProductQuantityControl.tsx +2 -0
  160. package/src/product-set/product/quantity/ProductQuantityRechargingControl.tsx +1 -0
  161. package/src/product-set/product-category/ProductCategoryControl.tsx +4 -0
  162. package/src/product-set/product-zone/ProductZoneControl.tsx +1 -1
  163. package/src/product-set/utils/index.ts +11 -0
  164. package/src/recurrence-input/RecurrenceEndInput.tsx +1 -0
  165. package/src/recurring-date-picker-input/RecurrenceEndInput.tsx +1 -0
  166. package/src/resource/form/components/CapacityControl.tsx +1 -0
  167. package/src/resource/form/components/SortControl.tsx +1 -0
  168. package/src/sales/booking/results/components/ResultCard.tsx +0 -2
  169. package/src/sales/coupon/control/CouponFormControl.tsx +7 -0
  170. package/src/setting/admin/PaymentFeeForm.tsx +5 -0
  171. package/src/setting/dashboard/DashboardSettingForm.tsx +1 -0
  172. package/src/snippet/snippet-template/preview/Preview.tsx +6 -0
  173. package/src/sortable-tree/SortableTreeItem.tsx +6 -0
  174. package/src/static/CurrencyNumberInput.tsx +1 -0
  175. package/src/static/form-number-input/FormNumberInput.tsx +1 -0
  176. package/src/static/number-input/NumberInput.tsx +1 -0
  177. package/src/styles/activity-card/{GridActivitiesCard.scss → ActivitiesCard.scss} +19 -5
  178. package/src/styles/activity-card/ListActivitiesCard.scss +12 -42
  179. package/src/styles/activity-card/_index.scss +1 -1
  180. package/src/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
  181. package/src/styles/product-set/ProductSetForm.scss +22 -0
  182. package/src/styles/ryft-payment-form/RyftPaymentForm.scss +28 -1
  183. package/src/styles/sales/BookingResults.scss +1 -1
  184. package/src/typeahead/Typeahead.tsx +15 -1
  185. package/src/zone/form/components/GameDurationControl.tsx +1 -0
  186. package/src/zone/form/components/SortControl.tsx +1 -0
  187. package/yarn.lock +61 -35
@@ -5,9 +5,12 @@ import { useId } from '@react-aria/utils'
5
5
  import { Controller, useFormContext } from 'react-hook-form'
6
6
  import { HasPermissionProp } from '@licklist/plugins/dist/types/permission/Permission'
7
7
  import { ProductSet } from '@licklist/core/dist/DataMapper/Product/ProductSetDataMapper'
8
+ import { uniqBy } from 'lodash'
9
+ import { getTypeHeadItemsFromMenus } from '../../../../product-set/utils'
8
10
  import { ConfirmModal } from '../../../../modals/confirmation/ConfirmModal'
9
11
  import { EditEventFormValues } from '../EditEventForm/EditEventForm'
10
12
  import { EditEventProductSet } from './component/EditEventProductSet'
13
+ import { Typeahead } from '../../../../typeahead'
11
14
 
12
15
  interface SelectEventProductSetProps extends HasPermissionProp {
13
16
  productSets?: ProductSet[]
@@ -16,16 +19,22 @@ interface SelectEventProductSetProps extends HasPermissionProp {
16
19
  createProductSet: (props: EditEventFormValues) => void
17
20
  setEditProductSetId: (value: string) => void
18
21
  timeZone: string
22
+ eventProductSet?: ProductSet
19
23
  }
20
24
 
21
25
  export const SelectEventProductSet = ({
22
- productSets,
26
+ productSets: _productSets,
23
27
  createProductSet,
24
28
  setEditProductSetId,
25
29
  showEditProductSet,
26
30
  setShowEditProductSet,
27
31
  timeZone,
32
+ eventProductSet,
28
33
  }: SelectEventProductSetProps) => {
34
+ const productSets = eventProductSet
35
+ ? [..._productSets, eventProductSet]
36
+ : _productSets
37
+
29
38
  const { t } = useTranslation(['Design'])
30
39
  const form = useFormContext<EditEventFormValues>()
31
40
 
@@ -42,6 +51,22 @@ export const SelectEventProductSet = ({
42
51
  const productSetId = watch('productSetId')
43
52
  const editedProductSet = watch('editedProductSet')
44
53
 
54
+ const typeheadValues = uniqBy(
55
+ getTypeHeadItemsFromMenus(
56
+ editedProductSet
57
+ ? productSets.map((productSet) =>
58
+ productSet.id === editedProductSet.id
59
+ ? editedProductSet
60
+ : productSet,
61
+ )
62
+ : productSets,
63
+ ),
64
+ (item) => item.id,
65
+ )
66
+ const selectedProductSetTypeheadValue = productSetId
67
+ ? typeheadValues?.find((typeheadValue) => typeheadValue.id === productSetId)
68
+ : undefined
69
+
45
70
  const onEditProductSet = useCallback(
46
71
  () => {
47
72
  setEditProductSetId(String(productSetId))
@@ -95,6 +120,7 @@ export const SelectEventProductSet = ({
95
120
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
96
121
  const onSubmit = (value: EditEventFormValues['editedProductSet']) => {
97
122
  setShowEditProductSet(false)
123
+ setValue('productSetId', value.id)
98
124
  setValue('editedProductSet', value)
99
125
  }
100
126
 
@@ -110,93 +136,72 @@ export const SelectEventProductSet = ({
110
136
  <Controller
111
137
  control={control}
112
138
  name='productSetId'
113
- render={({ field }) => {
114
- const fieldValue = String(field.value)
115
- return (
116
- <>
117
- <div className='d-flex align-items-center flex-row w-100'>
118
- <ConfirmModal>
119
- {(confirm) => (
120
- <Form.Control
121
- as='select'
122
- onChange={(e) =>
123
- onChangeProductSet(Number(e.target.value), confirm)
124
- }
125
- isInvalid={Boolean(errors.productSetId)}
126
- value={fieldValue}
127
- >
128
- <option value='' hidden>
129
- {t('Design:chooseProductSet')}
130
- </option>
131
- {productSets?.map((productSet) => {
132
- const isCurrentEditedProductSet =
133
- editedProductSet &&
134
- editedProductSet?.id === productSet?.id
135
- return (
136
- <option key={productSet.id} value={productSet.id}>
137
- {isCurrentEditedProductSet ||
138
- productSet.isOverride
139
- ? `[${t('edited')}] ${
140
- isCurrentEditedProductSet
141
- ? editedProductSet?.name
142
- : productSet.name
143
- }`
144
- : productSet.name}
145
- </option>
146
- )
147
- })}
148
- </Form.Control>
149
- )}
150
- </ConfirmModal>
151
-
152
- <div className='buttons-container'>
153
- {!showEditProductSet && !editedProductSet && (
154
- <Button
155
- variant=''
156
- className='btn product-set-button mr-4'
157
- onClick={handleCreateProductSet}
158
- >
159
- {t('addNewProductSet')}
160
- </Button>
161
- )}
162
- {showOverrideProductSet && (
163
- <Button
164
- variant=''
165
- className='btn product-set-button'
166
- onClick={onEditProductSet}
167
- >
168
- {isOverrideProductSet
169
- ? t('editOverrides')
170
- : t('editProductSet')}
171
- </Button>
172
- )}
173
- {showEditProductSet && (
174
- <Button
175
- variant=''
176
- className='btn product-set-button'
177
- onClick={revertEditProductSet}
178
- >
179
- {t('cancelAndRevert')}
180
- </Button>
181
- )}
182
- {!showEditProductSet && editedProductSet && (
183
- <Button
184
- variant=''
185
- className='btn product-set-button ml-4 text-danger'
186
- onClick={revertEditProductSet}
187
- >
188
- {t('undoChanges')}
189
- </Button>
190
- )}
191
- </div>
139
+ render={() => (
140
+ <>
141
+ <div className='d-flex align-items-center flex-row w-100'>
142
+ <ConfirmModal>
143
+ {(confirm) => (
144
+ <Typeahead
145
+ name='productSetId'
146
+ value={selectedProductSetTypeheadValue}
147
+ containerStyles={{ width: '100%' }}
148
+ onChangeValue={(typeheadValue) => {
149
+ onChangeProductSet(Number(typeheadValue.id), confirm)
150
+ }}
151
+ options={typeheadValues}
152
+ placeholder={t('Design:choose')}
153
+ noOptionsMessage={t('Design:noAvailableProductSets')}
154
+ />
155
+ )}
156
+ </ConfirmModal>
157
+
158
+ <div className='buttons-container'>
159
+ {!showEditProductSet && !editedProductSet && (
160
+ <Button
161
+ variant=''
162
+ className='btn product-set-button mr-4'
163
+ onClick={handleCreateProductSet}
164
+ >
165
+ {t('addNewProductSet')}
166
+ </Button>
167
+ )}
168
+ {showOverrideProductSet && (
169
+ <Button
170
+ variant=''
171
+ className='btn product-set-button'
172
+ onClick={onEditProductSet}
173
+ >
174
+ {isOverrideProductSet
175
+ ? t('editOverrides')
176
+ : t('editProductSet')}
177
+ </Button>
178
+ )}
179
+ {showEditProductSet && (
180
+ <Button
181
+ variant=''
182
+ className='btn product-set-button'
183
+ onClick={revertEditProductSet}
184
+ >
185
+ {t('cancelAndRevert')}
186
+ </Button>
187
+ )}
188
+ {!showEditProductSet && editedProductSet && (
189
+ <Button
190
+ variant=''
191
+ className='btn product-set-button ml-4 text-danger'
192
+ onClick={revertEditProductSet}
193
+ >
194
+ {t('undoChanges')}
195
+ </Button>
196
+ )}
192
197
  </div>
198
+ </div>
193
199
 
194
- <Form.Control.Feedback type='invalid'>
195
- {errors?.productSetId?.message}
196
- </Form.Control.Feedback>
197
- </>
198
- )
199
- }}
200
+ <Form.Control.Feedback type='invalid'>
201
+ {errors?.productSetId?.message}
202
+ </Form.Control.Feedback>
203
+ </>
204
+ )}
200
205
  />
201
206
  </Form.Group>
202
207
  </div>
@@ -12,6 +12,8 @@ export const getDefaultValues = (
12
12
  ): ProductSetFormValues => ({
13
13
  id: productSet?.id ?? 0,
14
14
  name: productSet?.name ?? '',
15
+ description: productSet?.description ?? '',
16
+ image: productSet?.image,
15
17
  type: productSet?.type ?? DEFAULT_PRODUCT_SET_TYPE,
16
18
  termsAndConditions: productSet?.termsAndConditions ?? '',
17
19
  operationalCost: productSet?.operationalCost ?? DEFAULT_OPERATIONAL_COST_TYPE,
@@ -37,7 +39,6 @@ export const getDefaultValues = (
37
39
  ...product,
38
40
  subProducts: subProducts?.map(({ ...subProducts }) => ({
39
41
  ...subProducts,
40
- originalProductId: null,
41
42
  productCategoryId: undefined,
42
43
  })),
43
44
  productCategoryId: undefined,
@@ -1,27 +1,29 @@
1
1
  import { ReactNode } from 'react'
2
2
  import clsx from 'clsx'
3
+ import { Image } from '@licklist/core/dist/DataMapper/Media/ImageDataMapper'
3
4
 
4
5
  export const LAYOUT_GRID = 'grid'
5
6
  export const LAYOUT_LIST = 'list'
6
7
 
7
- type Layout = typeof LAYOUT_GRID | typeof LAYOUT_LIST
8
-
9
8
  export type ActivityCardProps = {
10
9
  title: ReactNode
11
10
  duration: ReactNode
12
11
  price: ReactNode
12
+ description?: ReactNode
13
13
  onSelect: () => void
14
14
  isSelected: boolean
15
- layout?: Layout
15
+ layout?: typeof LAYOUT_GRID | typeof LAYOUT_LIST
16
16
  availableTimes?: string | null
17
+ image?: Image | null
17
18
  }
18
19
 
19
20
  export const ActivityCard = ({
20
21
  title,
21
22
  duration,
22
23
  price,
24
+ description,
23
25
  availableTimes,
24
- // image,
26
+ image,
25
27
  onSelect,
26
28
  isSelected,
27
29
  layout = LAYOUT_GRID,
@@ -30,39 +32,48 @@ export const ActivityCard = ({
30
32
  return (
31
33
  <button
32
34
  type='button'
33
- className={clsx('activity-card', isSelected && 'active')}
35
+ className={clsx('activity-card', { active: isSelected })}
34
36
  onClick={onSelect}
35
37
  >
36
- <div className={clsx('d-flex', 'flex-column')}>
38
+ {image && (
39
+ <img src={image.url} alt={typeof title === 'string' ? title : ''} />
40
+ )}
41
+
42
+ <div>
37
43
  <div className='activity-card-title'>{title}</div>
38
44
  {duration && <div>{duration}</div>}
39
-
40
45
  {price && <div>{price}</div>}
46
+ {description && (
47
+ <div className='mt-2 activity-card-description'>{description}</div>
48
+ )}
41
49
  </div>
42
50
  </button>
43
51
  )
44
52
  }
45
53
 
46
54
  return (
47
- <div role='button' onClick={onSelect} onKeyPress={onSelect} tabIndex={0}>
48
- <div
49
- className={clsx('list-activity-card', {
50
- active: isSelected,
51
- })}
52
- >
53
- <div className='description'>
54
- <div className='title mb-2'>{title}</div>
55
- {availableTimes && <div>{availableTimes}</div>}
56
- {duration && (
57
- <div>
58
- <p>{duration}</p>
59
- </div>
60
- )}
55
+ <button
56
+ type='button'
57
+ onClick={onSelect}
58
+ className={clsx('activity-card list-activity-card', {
59
+ active: isSelected,
60
+ })}
61
+ >
62
+ {image && (
63
+ <img src={image.url} alt={typeof title === 'string' ? title : ''} />
64
+ )}
61
65
 
62
- {price && <div>{price}</div>}
63
- </div>
66
+ <div className='activity-card-info'>
67
+ <div className='activity-card-title mb-2'>{title}</div>
68
+ {availableTimes && <div>{availableTimes}</div>}
69
+ {duration && <div>{duration}</div>}
70
+ {price && <div>{price}</div>}
71
+ {description && (
72
+ <div className='mt-2 activity-card-description'>{description}</div>
73
+ )}
64
74
  </div>
75
+
65
76
  <hr className='list-activity-card-hr' />
66
- </div>
77
+ </button>
67
78
  )
68
79
  }
@@ -89,6 +89,7 @@ export const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(
89
89
  <FormControl
90
90
  type='number'
91
91
  onChange={(e) => handleChangeValue(Number(e.target.value))}
92
+ onWheel={(event) => event.currentTarget.blur()}
92
93
  value={value}
93
94
  min={0}
94
95
  max={max}
@@ -101,6 +102,14 @@ export const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(
101
102
  <button
102
103
  type='button'
103
104
  onClick={handleArrowUpClick}
105
+ onWheel={(event) => event.currentTarget.blur()}
106
+ onFocus={(event) =>
107
+ event.target.addEventListener(
108
+ 'wheel',
109
+ (event) => event.preventDefault(),
110
+ { passive: false },
111
+ )
112
+ }
104
113
  className={`payment-number-input__btn-up ${
105
114
  plusButtonGreyedOut && 'disabled-number-input-button'
106
115
  }`}
@@ -51,6 +51,7 @@ export const ProductQuantityInput = ({
51
51
  hasDeposit: category.allowDeposits && product?.deposit < product.price,
52
52
  price: product.price,
53
53
  productCategoryId: category.id,
54
+ zoneId: category.zone?.id,
54
55
  quantity,
55
56
  capacity: product?.capacity,
56
57
  })
@@ -61,6 +61,7 @@ const processedPaymentSummary = ({
61
61
  const total = calculateTotalPrice(order, externalPaymentDetail)
62
62
 
63
63
  const totalDiscount = calculateTotalDiscount(order.payments)
64
+
64
65
  let summaryItems: SummaryItem[] = [
65
66
  {
66
67
  translateKey: AMOUNT_TOTAL,
@@ -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,8 +219,12 @@ 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
- <Button type='submit' disabled={isBtnDisabled || !isValid}>
224
+ <Button
225
+ type='submit'
226
+ disabled={isBtnDisabled || !isValid}
227
+ >
220
228
  {isBtnDisabled && <ButtonLoader />}
221
229
  {t('Design:buyNow')}
222
230
  </Button>
@@ -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,27 @@ 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("ryft-pay-apple-pay-button") as HTMLButtonElement
75
+ if (googleButton) {
76
+ googleButton.disabled = isDisableButton
77
+ googleButton.style.opacity = isDisableButton ? '1' : '0.6'
78
+ }
79
+ if (appleButton) {
80
+ appleButton.disabled = isDisableButton
81
+ appleButton.style.opacity = isDisableButton ? '1' : '0.6'
82
+ }
83
+ }
84
+
61
85
  if (isAppUsingInIframe) {
62
86
  const applePayButton = document.createElement('button')
63
87
  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 || ''}