@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
@@ -2,7 +2,7 @@ import { useCallback, useMemo } from 'react'
2
2
  import { Button } from 'react-bootstrap'
3
3
  import { useTranslation } from 'react-i18next'
4
4
  import { range } from 'lodash'
5
- import { ReactComponent as SelectArrow } from '../../../assets/iframe/selectArrow.svg'
5
+ import { DateTime } from 'luxon'
6
6
  import { CalendarSelect } from '../CalendarSelect'
7
7
  import { CalendarProps } from '../../Calendar'
8
8
 
@@ -26,15 +26,21 @@ export const CalendarButtons = ({
26
26
  }: CalendarButtonsProps) => {
27
27
  const { t } = useTranslation('Design')
28
28
 
29
- const onSelectNextMonth = useCallback(() => {
30
- setCurrentDate((prevDate) => prevDate.plus({ months: 1 }))
31
- // eslint-disable-next-line react-hooks/exhaustive-deps
32
- }, [])
29
+ const onSelectMonth = useCallback(
30
+ (value: string) => {
31
+ const selectedMonth = Number(value)
32
+ const nextDateTime = currentDate.set({ month: selectedMonth })
33
+
34
+ if (nextDateTime <= initialDate) {
35
+ setCurrentDate(initialDate)
36
+ return
37
+ }
33
38
 
34
- const onSelectPreviousMonth = useCallback(() => {
35
- setCurrentDate((prevDate) => prevDate.minus({ month: 1 }))
39
+ setCurrentDate(nextDateTime)
40
+ },
36
41
  // eslint-disable-next-line react-hooks/exhaustive-deps
37
- }, [])
42
+ [setCurrentDate, currentDate],
43
+ )
38
44
 
39
45
  const yearOptions = useMemo(
40
46
  () =>
@@ -45,10 +51,16 @@ export const CalendarButtons = ({
45
51
  [initialDate],
46
52
  )
47
53
 
48
- const canMoveBack = useMemo(
49
- () => currentDate > initialDate,
50
- [currentDate, initialDate],
51
- )
54
+ const monthOptions = useMemo(() => {
55
+ const initialMonth =
56
+ currentDate.year > initialDate.year ? 1 : initialDate.month
57
+ return range(initialMonth, 13).map((monthNumber) => ({
58
+ label: DateTime.fromObject({ month: monthNumber }).toLocaleString({
59
+ month: 'long',
60
+ }),
61
+ value: monthNumber,
62
+ }))
63
+ }, [initialDate, currentDate])
52
64
 
53
65
  const onSelectYear = (value: string) => {
54
66
  const selectedYear = Number(value)
@@ -110,22 +122,11 @@ export const CalendarButtons = ({
110
122
  <hr />
111
123
  <div className="calendar-buttons">
112
124
  <div className="buttons-wrapper">
113
- <Button
114
- className="calendar-button left-button"
115
- onClick={onSelectPreviousMonth}
116
- disabled={!canMoveBack}
117
- variant="link"
118
- >
119
- <SelectArrow />
120
- </Button>
121
- <div className="month-title">{currentDate.toFormat('MMMM')}</div>
122
- <Button
123
- className="calendar-button"
124
- onClick={onSelectNextMonth}
125
- variant="link"
126
- >
127
- <SelectArrow />
128
- </Button>
125
+ <CalendarSelect
126
+ options={monthOptions}
127
+ onChange={onSelectMonth}
128
+ value={currentDate.month}
129
+ />
129
130
  </div>
130
131
  <CalendarSelect
131
132
  options={yearOptions}
@@ -89,6 +89,13 @@ export function IntervalInput({
89
89
  trigger('end')
90
90
  }
91
91
 
92
+ const onChangeRecurrent = (checked: boolean) => {
93
+ setRecurrent(checked)
94
+ if (!checked) {
95
+ setValue('rrule', null)
96
+ }
97
+ }
98
+
92
99
  return (
93
100
  <>
94
101
  <Form.Row className="interval-container">
@@ -144,7 +151,7 @@ export function IntervalInput({
144
151
  custom
145
152
  checked={recurrent}
146
153
  onChange={({ target: { checked } }) => {
147
- setRecurrent(checked)
154
+ onChangeRecurrent(checked)
148
155
  }}
149
156
  disabled={disabled || Boolean(editedProductSet)}
150
157
  />
@@ -256,7 +256,6 @@ export const EditEventForm = ({
256
256
  <Controller
257
257
  render={({ field }) => (
258
258
  <TipTapEditor
259
- withEmoji={false}
260
259
  viewMode={false}
261
260
  onUpdate={field.onChange}
262
261
  content={field.value}
@@ -5,9 +5,11 @@ 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 { getTypeHeadItemsFromMenus } from '../../../../product-set/utils'
8
9
  import { ConfirmModal } from '../../../../modals/confirmation/ConfirmModal'
9
10
  import { EditEventFormValues } from '../EditEventForm/EditEventForm'
10
11
  import { EditEventProductSet } from './component/EditEventProductSet'
12
+ import { Typeahead } from '../../../../typeahead'
11
13
 
12
14
  interface SelectEventProductSetProps extends HasPermissionProp {
13
15
  productSets?: ProductSet[]
@@ -42,6 +44,21 @@ export const SelectEventProductSet = ({
42
44
  const productSetId = watch('productSetId')
43
45
  const editedProductSet = watch('editedProductSet')
44
46
 
47
+ const typeheadValues = getTypeHeadItemsFromMenus(
48
+ editedProductSet
49
+ ? productSets.map((productSet) => {
50
+ if (productSet.id === editedProductSet.id) {
51
+ return editedProductSet
52
+ }
53
+
54
+ return productSet
55
+ })
56
+ : productSets,
57
+ )
58
+ const selectedProductSetTypeheadValue = productSetId
59
+ ? typeheadValues?.find((typeheadValue) => typeheadValue.id === productSetId)
60
+ : undefined
61
+
45
62
  const onEditProductSet = useCallback(
46
63
  () => {
47
64
  setEditProductSetId(String(productSetId))
@@ -95,6 +112,7 @@ export const SelectEventProductSet = ({
95
112
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
96
113
  const onSubmit = (value: EditEventFormValues['editedProductSet']) => {
97
114
  setShowEditProductSet(false)
115
+ setValue('productSetId', value.id)
98
116
  setValue('editedProductSet', value)
99
117
  }
100
118
 
@@ -110,93 +128,72 @@ export const SelectEventProductSet = ({
110
128
  <Controller
111
129
  control={control}
112
130
  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>
131
+ render={() => (
132
+ <>
133
+ <div className="d-flex align-items-center flex-row w-100">
134
+ <ConfirmModal>
135
+ {(confirm) => (
136
+ <Typeahead
137
+ name="productSetId"
138
+ value={selectedProductSetTypeheadValue}
139
+ containerStyles={{ width: '100%' }}
140
+ onChangeValue={(typeheadValue) => {
141
+ onChangeProductSet(Number(typeheadValue.id), confirm)
142
+ }}
143
+ options={typeheadValues}
144
+ placeholder={t('Design:choose')}
145
+ noOptionsMessage={t('Design:noAvailableProductSets')}
146
+ />
147
+ )}
148
+ </ConfirmModal>
149
+
150
+ <div className="buttons-container">
151
+ {!showEditProductSet && !editedProductSet && (
152
+ <Button
153
+ variant=""
154
+ className="btn product-set-button mr-4"
155
+ onClick={handleCreateProductSet}
156
+ >
157
+ {t('addNewProductSet')}
158
+ </Button>
159
+ )}
160
+ {showOverrideProductSet && (
161
+ <Button
162
+ variant=""
163
+ className="btn product-set-button "
164
+ onClick={onEditProductSet}
165
+ >
166
+ {isOverrideProductSet
167
+ ? t('editOverrides')
168
+ : t('editProductSet')}
169
+ </Button>
170
+ )}
171
+ {showEditProductSet && (
172
+ <Button
173
+ variant=""
174
+ className="btn product-set-button"
175
+ onClick={revertEditProductSet}
176
+ >
177
+ {t('cancelAndRevert')}
178
+ </Button>
179
+ )}
180
+ {!showEditProductSet && editedProductSet && (
181
+ <Button
182
+ variant=""
183
+ className="btn product-set-button ml-4 text-danger"
184
+ onClick={revertEditProductSet}
185
+ >
186
+ {t('undoChanges')}
187
+ </Button>
188
+ )}
192
189
  </div>
190
+ </div>
193
191
 
194
- <Form.Control.Feedback type="invalid">
195
- {errors?.productSetId?.message}
196
- </Form.Control.Feedback>
197
- </>
198
- )
199
- }}
192
+ <Form.Control.Feedback type="invalid">
193
+ {errors?.productSetId?.message}
194
+ </Form.Control.Feedback>
195
+ </>
196
+ )}
200
197
  />
201
198
  </Form.Group>
202
199
  </div>
@@ -37,7 +37,6 @@ export const getDefaultValues = (
37
37
  ...product,
38
38
  subProducts: subProducts?.map(({ ...subProducts }) => ({
39
39
  ...subProducts,
40
- originalProductId: null,
41
40
  productCategoryId: undefined,
42
41
  })),
43
42
  productCategoryId: undefined,
@@ -71,56 +71,56 @@ export function IframeEventCard({
71
71
  className,
72
72
  )}
73
73
  onClick={
74
- goToDetails || !snippetSetting.displayBookingButtonOnEventList
74
+ goToDetails || !snippetSetting?.displayBookingButtonOnEventList
75
75
  ? onClick
76
76
  : undefined
77
77
  }
78
78
  >
79
- {showMoreInfo && <div className="iframe-event-card__info-icon">i</div>}
79
+ {showMoreInfo && <div className='iframe-event-card__info-icon'>i</div>}
80
80
  {imageSrc && (
81
81
  <Card.Img
82
82
  className={imageClassName ?? 'card-image'}
83
- variant="top"
84
- as="div"
83
+ variant='top'
84
+ as='div'
85
85
  style={{ backgroundImage: `url("${imageSrc}")` }}
86
86
  />
87
87
  )}
88
88
  <Card.Body
89
89
  className={clsx('d-flex', 'flex-column', !imageSrc && 'no-image')}
90
90
  >
91
- <Card.Title className="iframe-event-card__title" id={titleId}>
91
+ <Card.Title className='iframe-event-card__title' id={titleId}>
92
92
  {title}
93
93
  </Card.Title>
94
94
 
95
- <div className="flex-grow-1 iframe-event-card__description">
96
- <Card.Text as="div">
97
- <div className="d-flex align-items-center mb-3">
98
- <div className="icon-wrapper">
95
+ <div className='flex-grow-1 iframe-event-card__description'>
96
+ <Card.Text as='div'>
97
+ <div className='d-flex align-items-center mb-3'>
98
+ <div className='icon-wrapper'>
99
99
  <CalendarSvg />
100
100
  </div>
101
- <p className="m-0 list-view-hided">{date}</p>
102
- <p className="m-0 grid-view-hided">{shortDate}</p>
101
+ <p className='m-0 list-view-hided'>{date}</p>
102
+ <p className='m-0 grid-view-hided'>{shortDate}</p>
103
103
  </div>
104
104
  </Card.Text>
105
105
 
106
106
  {type && (
107
- <Card.Text as="div" className="list-view-hided">
108
- <div className="d-flex align-items-center mb-3">
109
- <div className="icon-wrapper">
107
+ <Card.Text as='div' className='list-view-hided'>
108
+ <div className='d-flex align-items-center mb-3'>
109
+ <div className='icon-wrapper'>
110
110
  <ClockSvg />
111
111
  </div>
112
- <p className="m-0">{type}</p>
112
+ <p className='m-0'>{type}</p>
113
113
  </div>
114
114
  </Card.Text>
115
115
  )}
116
116
 
117
117
  {typeof cost === 'number' && (
118
- <Card.Text as="div">
119
- <div className="d-flex align-items-center mb-3">
120
- <div className="icon-wrapper">
118
+ <Card.Text as='div'>
119
+ <div className='d-flex align-items-center mb-3'>
120
+ <div className='icon-wrapper'>
121
121
  <TicketSvg />
122
122
  </div>
123
- <p className="m-0">
123
+ <p className='m-0'>
124
124
  {t('from')}{' '}
125
125
  {formatNumber(cost, { style: 'currency', currency: 'GBP' })}
126
126
  </p>
@@ -129,7 +129,7 @@ export function IframeEventCard({
129
129
  )}
130
130
 
131
131
  {description && (
132
- <Card.Text as="div" className="list-view-hided">
132
+ <Card.Text as='div' className='list-view-hided'>
133
133
  <TipTapEditor
134
134
  viewMode
135
135
  disabled
@@ -138,15 +138,16 @@ export function IframeEventCard({
138
138
  />
139
139
  </Card.Text>
140
140
  )}
141
- {!!snippetSetting.displayBookingButtonOnEventList && showMoreInfo && (
142
- <Button
143
- className="step-save-btn w-25 mt-4"
144
- type="button"
145
- onClick={onClick}
146
- >
147
- {t('book')}
148
- </Button>
149
- )}
141
+ {!!snippetSetting?.displayBookingButtonOnEventList &&
142
+ showMoreInfo && (
143
+ <Button
144
+ className='step-save-btn w-25 mt-4'
145
+ type='button'
146
+ onClick={onClick}
147
+ >
148
+ {t('book')}
149
+ </Button>
150
+ )}
150
151
  </div>
151
152
  </Card.Body>
152
153
  </Card>
@@ -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
  })
@@ -72,7 +72,6 @@ export const useResizePageBody = () => {
72
72
  }, [
73
73
  height,
74
74
  width,
75
- rightBlockHeight,
76
75
  onExpandStarted,
77
76
  onExpanded,
78
77
  onCollapseStarted,
@@ -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,
@@ -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[]
@@ -24,4 +24,5 @@ const DropDown = forwardRef((props: Props, ref: any) => {
24
24
  })
25
25
 
26
26
  DropDown.displayName = 'DropDown'
27
+
27
28
  export default DropDown
@@ -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
  >