@licklist/design 0.74.0-dev.0 → 0.74.0-dev.1
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/assets/dashboard/chartBar.svg.js +2 -2
- 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 +3 -2
- package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts +2 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +4 -3
- package/dist/product-set/control/ProductSetControl.d.ts +2 -1
- package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
- package/dist/product-set/control/ProductSetControl.js +3 -2
- package/dist/product-set/form/ProductCategoriesControl.d.ts +2 -1
- package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductCategoriesControl.js +3 -2
- package/dist/product-set/form/ProductSetForm.d.ts +2 -1
- package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
- package/dist/product-set/form/ProductSetForm.js +4 -2
- package/dist/product-set/form/ProductsControl.d.ts +2 -1
- package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductsControl.js +4 -3
- package/dist/product-set/form/StepsControl.d.ts +2 -1
- package/dist/product-set/form/StepsControl.d.ts.map +1 -1
- package/dist/product-set/form/StepsControl.js +5 -3
- package/dist/product-set/form/SubProductsControl.d.ts.map +1 -1
- package/dist/product-set/form/SubProductsControl.js +1 -0
- package/dist/product-set/product/ProductControl.d.ts +4 -2
- package/dist/product-set/product/ProductControl.d.ts.map +1 -1
- package/dist/product-set/product/ProductControl.js +29 -1
- package/dist/product-set/utils/index.d.ts +1 -0
- package/dist/product-set/utils/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx +15 -7
- package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx +3 -0
- package/src/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.tsx +3 -0
- package/src/product-set/control/ProductSetControl.tsx +14 -8
- package/src/product-set/form/ProductCategoriesControl.tsx +3 -0
- package/src/product-set/form/ProductSetForm.tsx +3 -0
- package/src/product-set/form/ProductsControl.tsx +4 -7
- package/src/product-set/form/StepsControl.tsx +4 -3
- package/src/product-set/form/SubProductsControl.tsx +1 -0
- package/src/product-set/product/ProductControl.tsx +39 -5
- package/yarn.lock +685 -705
package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx
CHANGED
|
@@ -21,6 +21,7 @@ interface SelectEventProductSetProps extends HasPermissionProp {
|
|
|
21
21
|
timeZone: string
|
|
22
22
|
eventProductSet?: ProductSet
|
|
23
23
|
overrideNameError?: string
|
|
24
|
+
isWaiverEnabled: boolean
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export const SelectEventProductSet = ({
|
|
@@ -32,6 +33,7 @@ export const SelectEventProductSet = ({
|
|
|
32
33
|
timeZone,
|
|
33
34
|
eventProductSet,
|
|
34
35
|
overrideNameError,
|
|
36
|
+
isWaiverEnabled,
|
|
35
37
|
}: SelectEventProductSetProps) => {
|
|
36
38
|
const productSets = eventProductSet
|
|
37
39
|
? [..._productSets, eventProductSet]
|
|
@@ -216,6 +218,7 @@ export const SelectEventProductSet = ({
|
|
|
216
218
|
}
|
|
217
219
|
timeZone={timeZone}
|
|
218
220
|
overrideNameError={overrideNameError}
|
|
221
|
+
isWaiverEnabled={isWaiverEnabled}
|
|
219
222
|
/>
|
|
220
223
|
)}
|
|
221
224
|
</>
|
|
@@ -24,6 +24,7 @@ interface EditEventProductSetProps {
|
|
|
24
24
|
defaultValues?: EditEventFormValues['editedProductSet']
|
|
25
25
|
timeZone: string
|
|
26
26
|
overrideNameError?: string
|
|
27
|
+
isWaiverEnabled: boolean
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export const EditEventProductSet = ({
|
|
@@ -31,6 +32,7 @@ export const EditEventProductSet = ({
|
|
|
31
32
|
defaultValues,
|
|
32
33
|
timeZone,
|
|
33
34
|
overrideNameError,
|
|
35
|
+
isWaiverEnabled,
|
|
34
36
|
}: EditEventProductSetProps) => {
|
|
35
37
|
const { companyId } = useParams<{
|
|
36
38
|
companyId: string
|
|
@@ -139,6 +141,7 @@ export const EditEventProductSet = ({
|
|
|
139
141
|
isOverrides
|
|
140
142
|
workHours={undefined}
|
|
141
143
|
timeZone={timeZone}
|
|
144
|
+
isWaiverEnabled={isWaiverEnabled}
|
|
142
145
|
/>
|
|
143
146
|
<Button
|
|
144
147
|
disabled={isLoading}
|
|
@@ -100,6 +100,7 @@ export interface ProductSetControlProps {
|
|
|
100
100
|
hasGeneralTicket?: boolean
|
|
101
101
|
isCreateNewOverrides?: boolean
|
|
102
102
|
timeZone: string
|
|
103
|
+
isWaiverEnabled: boolean
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
export function ProductSetControl({
|
|
@@ -118,6 +119,7 @@ export function ProductSetControl({
|
|
|
118
119
|
isOverrides = false,
|
|
119
120
|
isCreateNewOverrides = false,
|
|
120
121
|
timeZone,
|
|
122
|
+
isWaiverEnabled,
|
|
121
123
|
}: ProductSetControlProps) {
|
|
122
124
|
const { t } = useTranslation(['Design', 'Validation', 'Notification'])
|
|
123
125
|
const {
|
|
@@ -238,6 +240,7 @@ export function ProductSetControl({
|
|
|
238
240
|
isEventEditProductSet={isEventEditProductSet}
|
|
239
241
|
isOverrides={isOverrides}
|
|
240
242
|
isCreateNewOverrides={isCreateNewOverrides}
|
|
243
|
+
isWaiverEnabled={isWaiverEnabled}
|
|
241
244
|
/>
|
|
242
245
|
</Col>
|
|
243
246
|
<Col md={6} sm={12}>
|
|
@@ -309,14 +312,17 @@ export function ProductSetControl({
|
|
|
309
312
|
</Form.Control.Feedback>
|
|
310
313
|
</Form.Group>
|
|
311
314
|
|
|
312
|
-
<Form.Group
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
315
|
+
<Form.Group
|
|
316
|
+
controlId='hasGeneralTicket'
|
|
317
|
+
className='checkbox-second-column mt-4'
|
|
318
|
+
>
|
|
319
|
+
<Form.Check
|
|
320
|
+
data-testid='save-as-template-checkbox'
|
|
321
|
+
label={t('Design:hasGeneralTicket')}
|
|
322
|
+
{...register('hasGeneralTicket')}
|
|
323
|
+
custom
|
|
324
|
+
/>
|
|
325
|
+
</Form.Group>
|
|
320
326
|
|
|
321
327
|
<Form.Group controlId={termsAndConditionsId}>
|
|
322
328
|
<Form.Label>{t('Design:termsAndConditions')}</Form.Label>
|
|
@@ -66,6 +66,7 @@ interface ProductCategoriesControlProps extends WithIsLoading {
|
|
|
66
66
|
isOverrides?: boolean
|
|
67
67
|
isEventEditProductSet?: boolean
|
|
68
68
|
isCreateNewOverrides?: boolean
|
|
69
|
+
isWaiverEnabled: boolean
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
const getCategoryDefaultValue = (
|
|
@@ -99,6 +100,7 @@ export function ProductCategoriesControl({
|
|
|
99
100
|
isOverrides,
|
|
100
101
|
isEventEditProductSet,
|
|
101
102
|
isCreateNewOverrides,
|
|
103
|
+
isWaiverEnabled,
|
|
102
104
|
}: ProductCategoriesControlProps) {
|
|
103
105
|
const { t } = useTranslation('Design')
|
|
104
106
|
const {
|
|
@@ -347,6 +349,7 @@ export function ProductCategoriesControl({
|
|
|
347
349
|
isOverrides={isOverrides}
|
|
348
350
|
isEventEditProductSet={isEventEditProductSet}
|
|
349
351
|
isCreateNewOverrides={isCreateNewOverrides}
|
|
352
|
+
isWaiverEnabled={isWaiverEnabled}
|
|
350
353
|
/>
|
|
351
354
|
</SortableTree.Item>
|
|
352
355
|
)}
|
|
@@ -57,6 +57,7 @@ export interface ProductSetFormProps
|
|
|
57
57
|
providerHasMap?: boolean
|
|
58
58
|
venueMapSets?: VenueMapSet[]
|
|
59
59
|
providerHasBookingManagement?: boolean
|
|
60
|
+
isWaiverEnabled: boolean
|
|
60
61
|
zones?: Zone[] | null
|
|
61
62
|
isCreateAction?: boolean
|
|
62
63
|
isOverrides?: boolean
|
|
@@ -79,6 +80,7 @@ export function ProductSetForm({
|
|
|
79
80
|
providerHasMap = false,
|
|
80
81
|
venueMapSets = [],
|
|
81
82
|
providerHasBookingManagement,
|
|
83
|
+
isWaiverEnabled,
|
|
82
84
|
zones,
|
|
83
85
|
isCreateAction,
|
|
84
86
|
workHours,
|
|
@@ -210,6 +212,7 @@ export function ProductSetForm({
|
|
|
210
212
|
isOverrides={isOverrides}
|
|
211
213
|
isCreateNewOverrides={isCreateNewOverrides}
|
|
212
214
|
timeZone={timeZone}
|
|
215
|
+
isWaiverEnabled={isWaiverEnabled}
|
|
213
216
|
/>
|
|
214
217
|
<Row>
|
|
215
218
|
<Col md={6} sm={12} />
|
|
@@ -12,15 +12,12 @@ import { useTranslation } from 'react-i18next'
|
|
|
12
12
|
import { DEFAULT_PRODUCT_TYPE } from '@licklist/core/dist/DataMapper/Product/ProductDataMapper'
|
|
13
13
|
import { generateUuid } from '@licklist/core/dist/Services'
|
|
14
14
|
import HookFormService from '@licklist/plugins/dist/services/Form/HookFormService'
|
|
15
|
-
|
|
16
15
|
import { CategoryType } from '@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper'
|
|
17
16
|
import { ProductControl, ProductControlProps, ProductSetFormValues } from '..'
|
|
18
17
|
import { SortableTree } from '../../sortable-tree'
|
|
19
18
|
import { CreateProductSetItem } from '../item/CreateProductSetItem'
|
|
20
19
|
import { Product } from '../types'
|
|
21
20
|
import { WithIsLoading } from './ProductSetForm'
|
|
22
|
-
// @TODO not for first release
|
|
23
|
-
// import Popover from "./ProductSetFormPopover";
|
|
24
21
|
import { useSortableTreeFunctions } from '../hooks/useSortableTreeFunctions'
|
|
25
22
|
import { SubProductsControl } from './SubProductsControl'
|
|
26
23
|
import { ProductSetModalClasses } from '../../sortable-tree/SortableTreeItem'
|
|
@@ -35,6 +32,7 @@ interface ProductsControlProps extends WithIsLoading {
|
|
|
35
32
|
isOverrides?: boolean
|
|
36
33
|
isEventEditProductSet?: boolean
|
|
37
34
|
isCreateNewOverrides?: boolean
|
|
35
|
+
isWaiverEnabled: boolean
|
|
38
36
|
}
|
|
39
37
|
|
|
40
38
|
const getDefaultProductValue = (sort: number): Product => ({
|
|
@@ -78,6 +76,7 @@ export function ProductsControl({
|
|
|
78
76
|
isOverrides,
|
|
79
77
|
isEventEditProductSet,
|
|
80
78
|
isCreateNewOverrides,
|
|
79
|
+
isWaiverEnabled,
|
|
81
80
|
}: ProductsControlProps) {
|
|
82
81
|
const { t } = useTranslation('Design')
|
|
83
82
|
const form = useFormContext<ProductSetFormValues>()
|
|
@@ -282,6 +281,7 @@ export function ProductsControl({
|
|
|
282
281
|
isOverrides={
|
|
283
282
|
isNewProductOverrides || isOverridesProductSet
|
|
284
283
|
}
|
|
284
|
+
isWaiverEnabled={isWaiverEnabled}
|
|
285
285
|
/>
|
|
286
286
|
}
|
|
287
287
|
onDelete={() => onProductRemove(index)}
|
|
@@ -289,7 +289,6 @@ export function ProductsControl({
|
|
|
289
289
|
trigger(`${productControlFieldName}.${index}`)
|
|
290
290
|
}
|
|
291
291
|
saveValidField={saveValidField}
|
|
292
|
-
// preItem={<Popover className="d-none d-sm-block" />}
|
|
293
292
|
>
|
|
294
293
|
<SubProductsControl
|
|
295
294
|
isLoading={isLoading}
|
|
@@ -315,9 +314,7 @@ export function ProductsControl({
|
|
|
315
314
|
}
|
|
316
315
|
}}
|
|
317
316
|
/>
|
|
318
|
-
<div className='manual-form-error'>
|
|
319
|
-
{categoryProductErrors && categoryProductErrors.message}
|
|
320
|
-
</div>
|
|
317
|
+
<div className='manual-form-error'>{categoryProductErrors?.message}</div>
|
|
321
318
|
</>
|
|
322
319
|
)
|
|
323
320
|
}
|
|
@@ -21,6 +21,7 @@ interface StepsControlProps {
|
|
|
21
21
|
isOverrides?: boolean
|
|
22
22
|
isEventEditProductSet?: boolean
|
|
23
23
|
isCreateNewOverrides?: boolean
|
|
24
|
+
isWaiverEnabled: boolean
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export function StepsControl({
|
|
@@ -28,6 +29,7 @@ export function StepsControl({
|
|
|
28
29
|
isOverrides,
|
|
29
30
|
isEventEditProductSet,
|
|
30
31
|
isCreateNewOverrides,
|
|
32
|
+
isWaiverEnabled,
|
|
31
33
|
}: StepsControlProps) {
|
|
32
34
|
const form = useFormContext<ProductSetFormValues>()
|
|
33
35
|
const { t } = useTranslation('Design')
|
|
@@ -150,6 +152,7 @@ export function StepsControl({
|
|
|
150
152
|
isOverrides={isOverrides}
|
|
151
153
|
isCreateNewOverrides={isCreateNewOverrides}
|
|
152
154
|
isEventEditProductSet={isEventEditProductSet}
|
|
155
|
+
isWaiverEnabled={isWaiverEnabled}
|
|
153
156
|
/>
|
|
154
157
|
</SortableTree.Item>
|
|
155
158
|
)}
|
|
@@ -167,9 +170,7 @@ export function StepsControl({
|
|
|
167
170
|
}
|
|
168
171
|
}}
|
|
169
172
|
/>
|
|
170
|
-
<div className='manual-form-error'>
|
|
171
|
-
{errors.steps && errors.steps.message}
|
|
172
|
-
</div>
|
|
173
|
+
<div className='manual-form-error'>{errors.steps?.message}</div>
|
|
173
174
|
</>
|
|
174
175
|
)
|
|
175
176
|
}
|
|
@@ -56,6 +56,7 @@ export function SubProductsControl({
|
|
|
56
56
|
quantityType={quantityType}
|
|
57
57
|
allowDeposits={false}
|
|
58
58
|
hasBookingManagement={false}
|
|
59
|
+
isWaiverEnabled={false}
|
|
59
60
|
fieldNamePrefix={
|
|
60
61
|
// eslint-disable-next-line max-len
|
|
61
62
|
`steps.${stepIndex}.productCategories.${productCategoryIndex}.products.${productIndex}.subProducts.${index}` as const
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CategoryType,
|
|
3
3
|
QuantityType,
|
|
4
|
-
QUANTITY_TYPE_CONSTANT,
|
|
5
|
-
QUANTITY_TYPE_LIST_DTO,
|
|
6
|
-
QUANTITY_TYPE_RECHARGING,
|
|
7
4
|
} from '@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper'
|
|
8
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
PRODUCT_WAIVER_TYPE_ADULT,
|
|
7
|
+
PRODUCT_WAIVER_TYPE_CHILD,
|
|
8
|
+
ProductType,
|
|
9
|
+
ProductWaiverType,
|
|
10
|
+
} from '@licklist/core/dist/DataMapper/Product/ProductDataMapper'
|
|
9
11
|
import HookFormService from '@licklist/plugins/dist/services/Form/HookFormService'
|
|
10
12
|
import clsx from 'clsx'
|
|
11
13
|
import {
|
|
@@ -28,7 +30,6 @@ import {
|
|
|
28
30
|
Controller,
|
|
29
31
|
Path,
|
|
30
32
|
useFormContext,
|
|
31
|
-
useWatch,
|
|
32
33
|
UnpackNestedValue,
|
|
33
34
|
PathValue,
|
|
34
35
|
} from 'react-hook-form'
|
|
@@ -107,6 +108,7 @@ export interface ProductControlValues
|
|
|
107
108
|
sort: number | null
|
|
108
109
|
color?: string
|
|
109
110
|
productZones?: ProductZoneControlValues[]
|
|
111
|
+
waiverType?: ProductWaiverType | null
|
|
110
112
|
}
|
|
111
113
|
|
|
112
114
|
export interface ProductControlProps<T>
|
|
@@ -123,6 +125,7 @@ export interface ProductControlProps<T>
|
|
|
123
125
|
hasTicket?: boolean
|
|
124
126
|
categoryType?: CategoryType
|
|
125
127
|
isOverrides?: boolean
|
|
128
|
+
isWaiverEnabled: boolean
|
|
126
129
|
}
|
|
127
130
|
|
|
128
131
|
export function ProductControl<T extends FormValues>({
|
|
@@ -136,6 +139,7 @@ export function ProductControl<T extends FormValues>({
|
|
|
136
139
|
productName,
|
|
137
140
|
categoryType,
|
|
138
141
|
isOverrides = false,
|
|
142
|
+
isWaiverEnabled,
|
|
139
143
|
}: ProductControlProps<T>) {
|
|
140
144
|
const {
|
|
141
145
|
register,
|
|
@@ -416,6 +420,36 @@ export function ProductControl<T extends FormValues>({
|
|
|
416
420
|
name={`${fieldNamePrefix}.isSoldOut` as Path<T>}
|
|
417
421
|
/>
|
|
418
422
|
</Form.Group>
|
|
423
|
+
|
|
424
|
+
{isWaiverEnabled && (
|
|
425
|
+
<Form.Group>
|
|
426
|
+
<Form.Label>{t('Design:waiverType')}</Form.Label>
|
|
427
|
+
<Form.Control
|
|
428
|
+
{...register(`${fieldNamePrefix}.waiverType` as Path<T>)}
|
|
429
|
+
as='select'
|
|
430
|
+
defaultValue={PRODUCT_WAIVER_TYPE_ADULT}
|
|
431
|
+
disabled={isOverrides}
|
|
432
|
+
isInvalid={HookFormService.isInvalid(
|
|
433
|
+
`${fieldNamePrefix}.waiverType` as Path<T>,
|
|
434
|
+
errors,
|
|
435
|
+
)}
|
|
436
|
+
>
|
|
437
|
+
<option value={PRODUCT_WAIVER_TYPE_ADULT}>
|
|
438
|
+
{t('Design:adult')}
|
|
439
|
+
</option>
|
|
440
|
+
<option value={PRODUCT_WAIVER_TYPE_CHILD}>
|
|
441
|
+
{t('Design:child')}
|
|
442
|
+
</option>
|
|
443
|
+
</Form.Control>
|
|
444
|
+
<Form.Control.Feedback type='invalid'>
|
|
445
|
+
{HookFormService.getErrors(
|
|
446
|
+
`${fieldNamePrefix}.waiverType` as Path<T>,
|
|
447
|
+
errors,
|
|
448
|
+
)}
|
|
449
|
+
</Form.Control.Feedback>
|
|
450
|
+
</Form.Group>
|
|
451
|
+
)}
|
|
452
|
+
|
|
419
453
|
<Form.Group controlId={advancedId} className='custom-checkbox'>
|
|
420
454
|
<Form.Check
|
|
421
455
|
custom
|