@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.
- package/dist/affiliate/form/AffiliateForm.d.ts.map +1 -1
- package/dist/auth/Login/LoginComponent.js +2 -1
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts +2 -1
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +3 -2
- package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts +2 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.js +53 -24
- package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +1 -0
- package/dist/events/edit-event-modal/utils/getDefaultProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/utils/getDefaultProductSet.js +3 -2
- package/dist/iframe/activity-card/ActivityCard.d.ts +5 -4
- package/dist/iframe/activity-card/ActivityCard.d.ts.map +1 -1
- package/dist/iframe/activity-card/ActivityCard.js +52 -40
- package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.js +13 -0
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.js +2 -0
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts.map +1 -1
- package/dist/iframe/ryft/RyftPaymentForm.d.ts +2 -2
- package/dist/iframe/ryft/RyftPaymentForm.d.ts.map +1 -1
- package/dist/iframe/ryft/RyftPaymentForm.js +8 -2
- package/dist/iframe/ryft/utils/ryft-form.d.ts +2 -1
- package/dist/iframe/ryft/utils/ryft-form.d.ts.map +1 -1
- package/dist/iframe/ryft/utils/ryft-form.js +20 -1
- package/dist/index.js +1 -0
- package/dist/layout/DropDown.d.ts +2 -1
- package/dist/layout/DropDown.d.ts.map +1 -1
- package/dist/modals/confirmation/ConfirmModal.d.ts +3 -1
- package/dist/modals/confirmation/ConfirmModal.d.ts.map +1 -1
- package/dist/modals/confirmation/ConfirmModal.js +172 -8
- package/dist/notification/email-template/control/EmailTemplateControl.d.ts.map +1 -1
- package/dist/notification/email-template/control/EmailTemplateControl.js +3 -0
- package/dist/product-set/card/ProductSetCard.d.ts +6 -2
- package/dist/product-set/card/ProductSetCard.d.ts.map +1 -1
- package/dist/product-set/card/ProductSetCard.js +30 -11
- package/dist/product-set/control/DateInput.d.ts.map +1 -1
- package/dist/product-set/control/DateInput.js +2 -2
- package/dist/product-set/control/ProductSetControl.d.ts +4 -0
- package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
- package/dist/product-set/control/ProductSetControl.js +24 -3
- package/dist/product-set/control/ProductSetImageControl.d.ts +2 -0
- package/dist/product-set/control/ProductSetImageControl.d.ts.map +1 -0
- package/dist/product-set/control/ProductSetImageControl.js +279 -0
- package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductCategoriesControl.js +48 -2
- package/dist/product-set/form/ProductSetForm.d.ts +4 -1
- package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
- package/dist/product-set/form/ProductSetForm.js +64 -1
- package/dist/product-set/form/ProductSetNameControl.d.ts +6 -0
- package/dist/product-set/form/ProductSetNameControl.d.ts.map +1 -0
- package/dist/product-set/form/ProductSetNameControl.js +35 -0
- package/dist/product-set/form/ProductZonesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductZonesControl.js +0 -2
- package/dist/product-set/form/ProductsControl.js +1 -0
- package/dist/product-set/form/SelectCategoryModal.d.ts +12 -0
- package/dist/product-set/form/SelectCategoryModal.d.ts.map +1 -1
- package/dist/product-set/form/SelectCategoryModal.js +1 -1
- package/dist/product-set/form/SubProductsControl.d.ts.map +1 -1
- package/dist/product-set/form/SubProductsControl.js +0 -3
- package/dist/product-set/form/VenueMapsControl.d.ts.map +1 -1
- package/dist/product-set/form/VenueMapsControl.js +0 -3
- package/dist/product-set/form/index.d.ts +1 -0
- package/dist/product-set/form/index.d.ts.map +1 -1
- package/dist/product-set/product/ProductControl.d.ts.map +1 -1
- package/dist/product-set/product/booking-management/ProductBookingManagementControl.d.ts.map +1 -1
- package/dist/product-set/product/booking-management/ProductBookingManagementControl.js +6 -0
- package/dist/product-set/product/deposit/ProductDepositControl.d.ts.map +1 -1
- package/dist/product-set/product/deposit/ProductDepositControl.js +3 -0
- package/dist/product-set/product/duration/ProductDurationControl.d.ts.map +1 -1
- package/dist/product-set/product/duration/ProductDurationControl.js +6 -0
- package/dist/product-set/product/price/ProductPriceControl.d.ts.map +1 -1
- package/dist/product-set/product/price/ProductPriceControl.js +3 -0
- package/dist/product-set/product/quantity/ProductQuantityConstantControl.d.ts.map +1 -1
- package/dist/product-set/product/quantity/ProductQuantityConstantControl.js +6 -0
- package/dist/product-set/product/quantity/ProductQuantityControl.d.ts.map +1 -1
- package/dist/product-set/product/quantity/ProductQuantityControl.js +6 -0
- package/dist/product-set/product/quantity/ProductQuantityRechargingControl.d.ts.map +1 -1
- package/dist/product-set/product/quantity/ProductQuantityRechargingControl.js +4 -1
- package/dist/product-set/product-category/ProductCategoryControl.d.ts.map +1 -1
- package/dist/product-set/product-category/ProductCategoryControl.js +12 -0
- package/dist/product-set/utils/index.d.ts +7 -0
- package/dist/product-set/utils/index.d.ts.map +1 -1
- package/dist/product-set/utils/index.js +10 -1
- package/dist/recurrence-input/RecurrenceEndInput.d.ts.map +1 -1
- package/dist/recurrence-input/RecurrenceEndInput.js +3 -0
- package/dist/recurring-date-picker-input/RecurrenceEndInput.d.ts.map +1 -1
- package/dist/resource/form/components/CapacityControl.d.ts.map +1 -1
- package/dist/resource/form/components/CapacityControl.js +3 -0
- package/dist/resource/form/components/SortControl.d.ts.map +1 -1
- package/dist/resource/form/components/SortControl.js +3 -0
- package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
- package/dist/sales/booking/results/components/ResultCard.js +0 -2
- package/dist/sales/coupon/control/CouponFormControl.d.ts.map +1 -1
- package/dist/sales/coupon/control/CouponFormControl.js +21 -0
- package/dist/setting/admin/PaymentFeeForm.d.ts.map +1 -1
- package/dist/setting/admin/PaymentFeeForm.js +16 -1
- package/dist/setting/dashboard/DashboardSettingForm.d.ts.map +1 -1
- package/dist/setting/dashboard/DashboardSettingForm.js +4 -1
- package/dist/snippet/snippet-template/preview/Preview.d.ts.map +1 -1
- package/dist/snippet/snippet-template/preview/Preview.js +6 -0
- package/dist/sortable-tree/SortableTreeItem.d.ts +2 -1
- package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
- package/dist/sortable-tree/SortableTreeItem.js +10 -4
- package/dist/static/CurrencyNumberInput.d.ts.map +1 -1
- package/dist/static/CurrencyNumberInput.js +3 -0
- package/dist/static/form-number-input/FormNumberInput.d.ts.map +1 -1
- package/dist/static/form-number-input/FormNumberInput.js +3 -0
- package/dist/static/number-input/NumberInput.d.ts.map +1 -1
- package/dist/static/number-input/NumberInput.js +3 -0
- package/dist/styles/activity-card/{GridActivitiesCard.scss → ActivitiesCard.scss} +19 -5
- package/dist/styles/activity-card/ListActivitiesCard.scss +12 -42
- package/dist/styles/activity-card/_index.scss +1 -1
- package/dist/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
- package/dist/styles/product-set/ProductSetForm.scss +22 -0
- package/dist/styles/ryft-payment-form/RyftPaymentForm.scss +28 -1
- package/dist/styles/sales/BookingResults.scss +1 -1
- package/dist/typeahead/Typeahead.d.ts +5 -1
- package/dist/typeahead/Typeahead.d.ts.map +1 -1
- package/dist/typeahead/Typeahead.js +9 -2
- package/dist/zone/form/components/GameDurationControl.d.ts.map +1 -1
- package/dist/zone/form/components/GameDurationControl.js +3 -0
- package/dist/zone/form/components/SortControl.d.ts.map +1 -1
- package/dist/zone/form/components/SortControl.js +3 -0
- package/package.json +8 -6
- package/src/affiliate/form/AffiliateForm.tsx +1 -0
- package/src/auth/Login/LoginComponent.tsx +1 -1
- package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx +3 -2
- package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx +91 -86
- package/src/events/edit-event-modal/utils/getDefaultProductSet.ts +2 -1
- package/src/iframe/activity-card/ActivityCard.tsx +35 -24
- package/src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx +9 -0
- package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +1 -0
- package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +1 -0
- package/src/iframe/ryft/RyftPaymentForm.tsx +13 -5
- package/src/iframe/ryft/utils/ryft-form.ts +26 -2
- package/src/layout/DropDown.tsx +1 -1
- package/src/modals/confirmation/ConfirmModal.tsx +19 -3
- package/src/notification/email-template/control/EmailTemplateControl.tsx +1 -0
- package/src/product-set/card/ProductSetCard.tsx +47 -8
- package/src/product-set/control/DateInput.tsx +2 -1
- package/src/product-set/control/ProductSetControl.tsx +46 -52
- package/src/product-set/control/ProductSetImageControl.tsx +97 -0
- package/src/product-set/form/ProductCategoriesControl.tsx +37 -1
- package/src/product-set/form/ProductSetForm.tsx +24 -2
- package/src/product-set/form/ProductSetNameControl.tsx +27 -0
- package/src/product-set/form/ProductZonesControl.tsx +1 -4
- package/src/product-set/form/SelectCategoryModal.tsx +2 -2
- package/src/product-set/form/SubProductsControl.tsx +0 -3
- package/src/product-set/form/VenueMapsControl.tsx +0 -3
- package/src/product-set/form/index.ts +1 -0
- package/src/product-set/product/ProductControl.tsx +0 -1
- package/src/product-set/product/advanced-options/AdvancedOptions.tsx +1 -1
- package/src/product-set/product/booking-management/ProductBookingManagementControl.tsx +2 -0
- package/src/product-set/product/deposit/ProductDepositControl.tsx +1 -0
- package/src/product-set/product/duration/ProductDurationControl.tsx +2 -0
- package/src/product-set/product/price/ProductPriceControl.tsx +1 -0
- package/src/product-set/product/quantity/ProductQuantityConstantControl.tsx +2 -0
- package/src/product-set/product/quantity/ProductQuantityControl.tsx +2 -0
- package/src/product-set/product/quantity/ProductQuantityRechargingControl.tsx +1 -0
- package/src/product-set/product-category/ProductCategoryControl.tsx +4 -0
- package/src/product-set/product-zone/ProductZoneControl.tsx +1 -1
- package/src/product-set/utils/index.ts +11 -0
- package/src/recurrence-input/RecurrenceEndInput.tsx +1 -0
- package/src/recurring-date-picker-input/RecurrenceEndInput.tsx +1 -0
- package/src/resource/form/components/CapacityControl.tsx +1 -0
- package/src/resource/form/components/SortControl.tsx +1 -0
- package/src/sales/booking/results/components/ResultCard.tsx +0 -2
- package/src/sales/coupon/control/CouponFormControl.tsx +7 -0
- package/src/setting/admin/PaymentFeeForm.tsx +5 -0
- package/src/setting/dashboard/DashboardSettingForm.tsx +1 -0
- package/src/snippet/snippet-template/preview/Preview.tsx +6 -0
- package/src/sortable-tree/SortableTreeItem.tsx +6 -0
- package/src/static/CurrencyNumberInput.tsx +1 -0
- package/src/static/form-number-input/FormNumberInput.tsx +1 -0
- package/src/static/number-input/NumberInput.tsx +1 -0
- package/src/styles/activity-card/{GridActivitiesCard.scss → ActivitiesCard.scss} +19 -5
- package/src/styles/activity-card/ListActivitiesCard.scss +12 -42
- package/src/styles/activity-card/_index.scss +1 -1
- package/src/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
- package/src/styles/product-set/ProductSetForm.scss +22 -0
- package/src/styles/ryft-payment-form/RyftPaymentForm.scss +28 -1
- package/src/styles/sales/BookingResults.scss +1 -1
- package/src/typeahead/Typeahead.tsx +15 -1
- package/src/zone/form/components/GameDurationControl.tsx +1 -0
- package/src/zone/form/components/SortControl.tsx +1 -0
- package/yarn.lock +61 -35
package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx
CHANGED
|
@@ -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={(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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
|
-
|
|
195
|
-
|
|
196
|
-
|
|
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?:
|
|
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
|
-
|
|
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
|
|
35
|
+
className={clsx('activity-card', { active: isSelected })}
|
|
34
36
|
onClick={onSelect}
|
|
35
37
|
>
|
|
36
|
-
|
|
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
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
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
|
-
</
|
|
77
|
+
</button>
|
|
67
78
|
)
|
|
68
79
|
}
|
package/src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx
CHANGED
|
@@ -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
|
}`}
|
|
@@ -38,7 +38,7 @@ export interface RyftPaymentFormProps {
|
|
|
38
38
|
isCreateLoading: boolean
|
|
39
39
|
isAppUsingInIframe?: boolean
|
|
40
40
|
onApplePayButtonClick?: () => void
|
|
41
|
-
|
|
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
|
-
[
|
|
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
|
|
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'
|
package/src/layout/DropDown.tsx
CHANGED
|
@@ -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 || ''}
|