@licklist/design 0.71.5 → 0.71.6-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.
Files changed (173) 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/SaleDeadline/SaleDeadline.d.ts +7 -1
  4. package/dist/events/edit-event-modal/component/SaleDeadline/SaleDeadline.d.ts.map +1 -1
  5. package/dist/events/edit-event-modal/component/SaleDeadline/SaleDeadline.js +10 -7
  6. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +4 -1
  7. package/dist/events/edit-event-modal/hooks/useValidationOptions.d.ts +0 -1
  8. package/dist/events/edit-event-modal/hooks/useValidationOptions.d.ts.map +1 -1
  9. package/dist/events/edit-event-modal/hooks/useValidationOptions.js +1 -6
  10. package/dist/events/edit-event-modal/utils/getDefaultProductSet.js +1 -1
  11. package/dist/events/edit-recurrent-event-modal/EditRecurrentEventModal.d.ts.map +1 -1
  12. package/dist/events/edit-recurrent-event-modal/EditRecurrentEventModal.js +1 -0
  13. package/dist/events/event-statistic-modal/EventStatisticModal.d.ts +2 -1
  14. package/dist/events/event-statistic-modal/EventStatisticModal.d.ts.map +1 -1
  15. package/dist/events/event-statistic-modal/EventStatisticModal.js +2 -2
  16. package/dist/events/event-statistic-modal/hooks/useTableData.d.ts +1 -1
  17. package/dist/events/event-statistic-modal/hooks/useTableData.d.ts.map +1 -1
  18. package/dist/events/event-statistic-modal/hooks/useTableData.js +3 -2
  19. package/dist/events/event-statistic-modal/utils/index.d.ts.map +1 -1
  20. package/dist/events/event-statistic-modal/utils/index.js +24 -12
  21. package/dist/events/event-venue-map/EventVenueMap.d.ts.map +1 -1
  22. package/dist/events/event-venue-map/EventVenueMap.js +1 -0
  23. package/dist/events/event-venue-map/hooks/useCanvasSize.d.ts.map +1 -1
  24. package/dist/events/event-venue-map/hooks/useCanvasSize.js +11 -4
  25. package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.d.ts.map +1 -1
  26. package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.js +13 -0
  27. package/dist/iframe/page/components/PageBody/constants.d.ts +1 -0
  28. package/dist/iframe/page/components/PageBody/constants.d.ts.map +1 -1
  29. package/dist/iframe/page/components/PageBody/constants.js +2 -1
  30. package/dist/iframe/page/components/PageBody/hooks/useResizePageBody.d.ts.map +1 -1
  31. package/dist/iframe/page/components/PageBody/hooks/useResizePageBody.js +6 -1
  32. package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts.map +1 -1
  33. package/dist/iframe/ryft/RyftPaymentForm.d.ts.map +1 -1
  34. package/dist/iframe/ryft/RyftPaymentForm.js +4 -3
  35. package/dist/iframe/ryft/utils/ryft-form.d.ts.map +1 -1
  36. package/dist/iframe/ryft/utils/ryft-form.js +4 -5
  37. package/dist/layout/DropDown.d.ts +2 -1
  38. package/dist/layout/DropDown.d.ts.map +1 -1
  39. package/dist/notification/email-template/control/EmailTemplateControl.d.ts.map +1 -1
  40. package/dist/notification/email-template/control/EmailTemplateControl.js +3 -0
  41. package/dist/product-set/control/ProductSetControl.d.ts +2 -0
  42. package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
  43. package/dist/product-set/control/ProductSetControl.js +5 -0
  44. package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
  45. package/dist/product-set/form/ProductCategoriesControl.js +49 -2
  46. package/dist/product-set/form/ProductSetForm.d.ts +6 -2
  47. package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
  48. package/dist/product-set/form/ProductSetForm.js +3 -2
  49. package/dist/product-set/form/ProductZonesControl.d.ts.map +1 -1
  50. package/dist/product-set/form/ProductZonesControl.js +0 -2
  51. package/dist/product-set/form/ProductsControl.js +2 -0
  52. package/dist/product-set/form/SelectCategoryModal.d.ts +12 -0
  53. package/dist/product-set/form/SelectCategoryModal.d.ts.map +1 -1
  54. package/dist/product-set/form/SelectCategoryModal.js +1 -1
  55. package/dist/product-set/form/SubProductsControl.d.ts.map +1 -1
  56. package/dist/product-set/form/SubProductsControl.js +0 -3
  57. package/dist/product-set/form/VenueMapsControl.d.ts.map +1 -1
  58. package/dist/product-set/form/VenueMapsControl.js +0 -3
  59. package/dist/product-set/product/ProductControl.d.ts.map +1 -1
  60. package/dist/product-set/product/advanced-options/AdvancedOptions.js +1 -0
  61. package/dist/product-set/product/booking-management/ProductBookingManagementControl.d.ts.map +1 -1
  62. package/dist/product-set/product/booking-management/ProductBookingManagementControl.js +6 -0
  63. package/dist/product-set/product/deposit/ProductDepositControl.d.ts.map +1 -1
  64. package/dist/product-set/product/deposit/ProductDepositControl.js +3 -0
  65. package/dist/product-set/product/duration/ProductDurationControl.d.ts.map +1 -1
  66. package/dist/product-set/product/duration/ProductDurationControl.js +6 -0
  67. package/dist/product-set/product/price/ProductPriceControl.d.ts.map +1 -1
  68. package/dist/product-set/product/price/ProductPriceControl.js +3 -0
  69. package/dist/product-set/product/quantity/ProductQuantityConstantControl.d.ts.map +1 -1
  70. package/dist/product-set/product/quantity/ProductQuantityConstantControl.js +6 -0
  71. package/dist/product-set/product/quantity/ProductQuantityControl.d.ts.map +1 -1
  72. package/dist/product-set/product/quantity/ProductQuantityControl.js +6 -0
  73. package/dist/product-set/product/quantity/ProductQuantityRechargingControl.d.ts.map +1 -1
  74. package/dist/product-set/product/quantity/ProductQuantityRechargingControl.js +4 -1
  75. package/dist/product-set/product-category/ProductCategoryControl.d.ts +1 -0
  76. package/dist/product-set/product-category/ProductCategoryControl.d.ts.map +1 -1
  77. package/dist/product-set/product-category/ProductCategoryControl.js +19 -1
  78. package/dist/recurrence-input/RecurrenceEndInput.d.ts.map +1 -1
  79. package/dist/recurrence-input/RecurrenceEndInput.js +3 -0
  80. package/dist/recurring-date-picker-input/RecurrenceEndInput.d.ts.map +1 -1
  81. package/dist/resource/form/components/CapacityControl.d.ts.map +1 -1
  82. package/dist/resource/form/components/CapacityControl.js +3 -0
  83. package/dist/resource/form/components/SortControl.d.ts.map +1 -1
  84. package/dist/resource/form/components/SortControl.js +3 -0
  85. package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
  86. package/dist/sales/booking/results/components/ResultCard.js +0 -2
  87. package/dist/sales/coupon/control/CouponFormControl.d.ts.map +1 -1
  88. package/dist/sales/coupon/control/CouponFormControl.js +21 -0
  89. package/dist/setting/admin/PaymentFeeForm.d.ts.map +1 -1
  90. package/dist/setting/admin/PaymentFeeForm.js +16 -1
  91. package/dist/setting/dashboard/DashboardSettingForm.d.ts.map +1 -1
  92. package/dist/setting/dashboard/DashboardSettingForm.js +4 -1
  93. package/dist/snippet/snippet-template/preview/Preview.d.ts.map +1 -1
  94. package/dist/snippet/snippet-template/preview/Preview.js +7 -0
  95. package/dist/sortable-tree/SortableTreeItem.d.ts +2 -1
  96. package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
  97. package/dist/sortable-tree/SortableTreeItem.js +10 -4
  98. package/dist/static/CurrencyNumberInput.d.ts.map +1 -1
  99. package/dist/static/CurrencyNumberInput.js +3 -0
  100. package/dist/static/form-number-input/FormNumberInput.d.ts.map +1 -1
  101. package/dist/static/form-number-input/FormNumberInput.js +3 -0
  102. package/dist/static/number-input/NumberInput.d.ts.map +1 -1
  103. package/dist/static/number-input/NumberInput.js +3 -0
  104. package/dist/styles/availability-indicator/AvailabilityIndicator.scss +1 -1
  105. package/dist/styles/iframe-events/Calendar.scss +1 -1
  106. package/dist/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
  107. package/dist/styles/product-set/ProductSetForm.scss +22 -0
  108. package/dist/styles/ryft-payment-form/RyftPaymentForm.scss +1 -3
  109. package/dist/styles/sales/BookingResults.scss +1 -1
  110. package/dist/zone/form/components/GameDurationControl.d.ts.map +1 -1
  111. package/dist/zone/form/components/GameDurationControl.js +3 -0
  112. package/dist/zone/form/components/SortControl.d.ts.map +1 -1
  113. package/dist/zone/form/components/SortControl.js +3 -0
  114. package/package.json +9 -7
  115. package/src/affiliate/form/AffiliateForm.tsx +1 -0
  116. package/src/auth/Login/LoginComponent.tsx +1 -1
  117. package/src/events/edit-event-modal/component/SaleDeadline/SaleDeadline.tsx +42 -16
  118. package/src/events/edit-event-modal/hooks/useValidationOptions.tsx +0 -5
  119. package/src/events/edit-event-modal/utils/getDefaultProductSet.ts +1 -1
  120. package/src/events/edit-recurrent-event-modal/EditRecurrentEventModal.tsx +6 -1
  121. package/src/events/event-statistic-modal/EventStatisticModal.tsx +3 -1
  122. package/src/events/event-statistic-modal/hooks/useTableData.tsx +5 -3
  123. package/src/events/event-statistic-modal/utils/index.ts +54 -32
  124. package/src/events/event-venue-map/EventVenueMap.tsx +1 -0
  125. package/src/events/event-venue-map/hooks/useCanvasSize.ts +5 -1
  126. package/src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx +9 -0
  127. package/src/iframe/page/components/PageBody/constants.ts +1 -0
  128. package/src/iframe/page/components/PageBody/hooks/useResizePageBody.ts +11 -2
  129. package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +1 -0
  130. package/src/iframe/ryft/RyftPaymentForm.tsx +10 -8
  131. package/src/iframe/ryft/utils/ryft-form.ts +6 -5
  132. package/src/layout/DropDown.tsx +1 -1
  133. package/src/notification/email-template/control/EmailTemplateControl.tsx +1 -0
  134. package/src/product-set/control/ProductSetControl.tsx +5 -0
  135. package/src/product-set/form/ProductCategoriesControl.tsx +38 -1
  136. package/src/product-set/form/ProductSetForm.tsx +8 -2
  137. package/src/product-set/form/ProductZonesControl.tsx +1 -4
  138. package/src/product-set/form/SelectCategoryModal.tsx +2 -2
  139. package/src/product-set/form/SubProductsControl.tsx +0 -3
  140. package/src/product-set/form/VenueMapsControl.tsx +0 -3
  141. package/src/product-set/product/ProductControl.tsx +0 -1
  142. package/src/product-set/product/advanced-options/AdvancedOptions.tsx +1 -1
  143. package/src/product-set/product/booking-management/ProductBookingManagementControl.tsx +2 -0
  144. package/src/product-set/product/deposit/ProductDepositControl.tsx +1 -0
  145. package/src/product-set/product/duration/ProductDurationControl.tsx +2 -0
  146. package/src/product-set/product/price/ProductPriceControl.tsx +1 -0
  147. package/src/product-set/product/quantity/ProductQuantityConstantControl.tsx +2 -0
  148. package/src/product-set/product/quantity/ProductQuantityControl.tsx +2 -0
  149. package/src/product-set/product/quantity/ProductQuantityRechargingControl.tsx +1 -0
  150. package/src/product-set/product-category/ProductCategoryControl.tsx +17 -0
  151. package/src/product-set/product-zone/ProductZoneControl.tsx +1 -1
  152. package/src/recurrence-input/RecurrenceEndInput.tsx +1 -0
  153. package/src/recurring-date-picker-input/RecurrenceEndInput.tsx +1 -0
  154. package/src/resource/form/components/CapacityControl.tsx +1 -0
  155. package/src/resource/form/components/SortControl.tsx +1 -0
  156. package/src/sales/booking/results/components/ResultCard.tsx +0 -2
  157. package/src/sales/coupon/control/CouponFormControl.tsx +7 -0
  158. package/src/setting/admin/PaymentFeeForm.tsx +5 -0
  159. package/src/setting/dashboard/DashboardSettingForm.tsx +1 -0
  160. package/src/snippet/snippet-template/preview/Preview.tsx +6 -0
  161. package/src/sortable-tree/SortableTreeItem.tsx +6 -0
  162. package/src/static/CurrencyNumberInput.tsx +1 -0
  163. package/src/static/form-number-input/FormNumberInput.tsx +1 -0
  164. package/src/static/number-input/NumberInput.tsx +1 -0
  165. package/src/styles/availability-indicator/AvailabilityIndicator.scss +1 -1
  166. package/src/styles/iframe-events/Calendar.scss +1 -1
  167. package/src/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
  168. package/src/styles/product-set/ProductSetForm.scss +22 -0
  169. package/src/styles/ryft-payment-form/RyftPaymentForm.scss +1 -3
  170. package/src/styles/sales/BookingResults.scss +1 -1
  171. package/src/zone/form/components/GameDurationControl.tsx +1 -0
  172. package/src/zone/form/components/SortControl.tsx +1 -0
  173. package/yarn.lock +637 -515
@@ -44,7 +44,7 @@ const LoginComponent = ({
44
44
  const handleError = (error: any) => {
45
45
  notification.danger({
46
46
  title: 'Error',
47
- message: error.message,
47
+ message: error?.response?.data?.message || error.message,
48
48
  })
49
49
  }
50
50
 
@@ -9,6 +9,9 @@ import { Switch, NumberInput } from '../../../../static'
9
9
  const SALE_DEADLINE_BEFORE_TYPE = 'before'
10
10
  const SALE_DEADLINE_AFTER_TYPE = 'after'
11
11
 
12
+ export const SALE_DEADLINE_NAME_CATEGORY = 'saleDeadlineCategory'
13
+ export const SALE_DEADLINE_NAME = 'saleDeadline'
14
+
12
15
  const SALE_DEADLINES_EVENT_START_TYPES = [
13
16
  { type: SALE_DEADLINE_BEFORE_TYPE },
14
17
  { type: SALE_DEADLINE_AFTER_TYPE },
@@ -18,11 +21,28 @@ type DeadlineType =
18
21
  | typeof SALE_DEADLINE_BEFORE_TYPE
19
22
  | typeof SALE_DEADLINE_AFTER_TYPE
20
23
 
24
+ export const DEADLINE_NAME = [
25
+ SALE_DEADLINE_NAME_CATEGORY,
26
+ SALE_DEADLINE_NAME,
27
+ ] as const
28
+
29
+ export type DeadLineNameType = (typeof DEADLINE_NAME)[number]
30
+
21
31
  type SaleDeadlineType = {
22
32
  saleDeadline: null | number
33
+ } | {
34
+ [key: string] : null | number
23
35
  }
24
36
 
25
- export const SaleDeadline = ({ disabled = false }: { disabled?: boolean }) => {
37
+ export const SaleDeadline = ({
38
+ disabled = false,
39
+ onlyBefore = false,
40
+ deadLineCategory,
41
+ }: {
42
+ disabled?: boolean
43
+ onlyBefore?: boolean
44
+ deadLineCategory?: string
45
+ }) => {
26
46
  const { t } = useTranslation(['Design'])
27
47
  const {
28
48
  control,
@@ -32,9 +52,11 @@ export const SaleDeadline = ({ disabled = false }: { disabled?: boolean }) => {
32
52
  const [deadlineType, setDeadlineType] = useState<DeadlineType>(
33
53
  SALE_DEADLINE_BEFORE_TYPE,
34
54
  )
35
- const saleDeadline = watch('saleDeadline')
55
+
56
+ const saleDeadline = watch(deadLineCategory || SALE_DEADLINE_NAME)
36
57
 
37
58
  useEffect(() => {
59
+ if (onlyBefore) return
38
60
  if (saleDeadline > 0) {
39
61
  setDeadlineType(SALE_DEADLINE_AFTER_TYPE)
40
62
  }
@@ -45,11 +67,11 @@ export const SaleDeadline = ({ disabled = false }: { disabled?: boolean }) => {
45
67
  <Form.Group className='sales-deadline'>
46
68
  <Form.Label>{t('Design:salesDeadline')}</Form.Label>
47
69
  <Form.Control.Feedback type='invalid'>
48
- {errors.saleDeadline?.message}
70
+ {errors.root?.message}
49
71
  </Form.Control.Feedback>
50
72
  <Controller
51
73
  control={control}
52
- name='saleDeadline'
74
+ name={deadLineCategory || SALE_DEADLINE_NAME}
53
75
  render={({
54
76
  field: { value, onChange },
55
77
  fieldState: { invalid, error },
@@ -111,18 +133,22 @@ export const SaleDeadline = ({ disabled = false }: { disabled?: boolean }) => {
111
133
 
112
134
  return (
113
135
  <>
114
- <Form.Group className='d-flex flex-column flex-grow-1 align-items-start'>
115
- <Switch
116
- name='sale-deadline'
117
- options={SALE_DEADLINES_EVENT_START_TYPES.map(({ type }) => ({
118
- id: type,
119
- value: t(`Design:${type}`),
120
- }))}
121
- value={deadlineType}
122
- onChange={changeValueByType}
123
- disabled={disabled}
124
- />
125
- </Form.Group>
136
+ {!onlyBefore && (
137
+ <Form.Group className='d-flex flex-column flex-grow-1 align-items-start'>
138
+ <Switch
139
+ name='sale-deadline'
140
+ options={SALE_DEADLINES_EVENT_START_TYPES.map(
141
+ ({ type }) => ({
142
+ id: type,
143
+ value: t(`Design:${type}`),
144
+ }),
145
+ )}
146
+ value={deadlineType}
147
+ onChange={changeValueByType}
148
+ disabled={disabled}
149
+ />
150
+ </Form.Group>
151
+ )}
126
152
  <div className='d-flex'>
127
153
  <Form.Group className='d-flex flex-column col-4 pl-0'>
128
154
  <Form.Label>{t('Design:saleDays')}</Form.Label>
@@ -12,11 +12,6 @@ export const useValidationOptions = () => {
12
12
  required: t('Validation:fieldRequired', {
13
13
  attribute: t('start'),
14
14
  }) as string,
15
- // TODO: uncomment when event splitting is implemented
16
- // and extract into plugins
17
- validate: (value) =>
18
- DateTime.fromISO(value).diffNow().toMillis() > 0 ||
19
- (t('Validation:fieldValidEventStart') as string),
20
15
  },
21
16
 
22
17
  end: {
@@ -20,6 +20,7 @@ export const getDefaultValues = (
20
20
  relyOnPeopleType: productSet?.relyOnPeopleType ?? null,
21
21
  thankYouPageUrl: productSet?.thankYouPageUrl ?? '',
22
22
  fieldSetId: productSet?.fieldSetId,
23
+ saleDeadline: productSet?.saleDeadline,
23
24
  emailTemplates:
24
25
  productSet?.mailTemplates && productSet?.mailTemplates?.length > 0
25
26
  ? getFilteredTemplates(productSet?.mailTemplates)
@@ -39,7 +40,6 @@ export const getDefaultValues = (
39
40
  ...product,
40
41
  subProducts: subProducts?.map(({ ...subProducts }) => ({
41
42
  ...subProducts,
42
- originalProductId: null,
43
43
  productCategoryId: undefined,
44
44
  })),
45
45
  productCategoryId: undefined,
@@ -61,7 +61,12 @@ export const EditRecurrentEventModal = ({
61
61
  <Form onSubmit={handleSubmit(onSubmit)} noValidate>
62
62
  <Modal.Header className='border-0'>
63
63
  <Modal.Title as='h6'>{title}</Modal.Title>
64
- <Button variant='danger' className='btn-sm rounded' onClick={onHide}>
64
+ <Button
65
+ variant='danger'
66
+ className='btn-sm rounded'
67
+ disabled={disabled}
68
+ onClick={onHide}
69
+ >
65
70
  <FaTimes size={16} />
66
71
  </Button>
67
72
  </Modal.Header>
@@ -12,6 +12,7 @@ export type EventStatisticModalProps = {
12
12
  date?: Event['startAt'] | null
13
13
  eventStatistic?: EventStatistic | null
14
14
  title?: string
15
+ eventId?: string
15
16
  }
16
17
 
17
18
  export const EventStatisticModal = ({
@@ -20,10 +21,11 @@ export const EventStatisticModal = ({
20
21
  date,
21
22
  eventStatistic,
22
23
  title,
24
+ eventId,
23
25
  }: EventStatisticModalProps) => {
24
26
  const { t } = useTranslation('Design')
25
27
 
26
- const data = useTableData(date, eventStatistic)
28
+ const data = useTableData(date, eventStatistic, eventId )
27
29
  const handleClose = () => {
28
30
  setIsOpen(false)
29
31
  }
@@ -11,6 +11,7 @@ import { StaticTableData } from '../../../table'
11
11
  export const useTableData = (
12
12
  date: Event['startAt'] | null,
13
13
  eventStatistic: EventStatistic | null,
14
+ eventId: string
14
15
  ) => {
15
16
  const { t } = useTranslation('Design')
16
17
  const { formatNumber } = useIntl()
@@ -33,6 +34,7 @@ export const useTableData = (
33
34
  const transformStatisticToTableRows = (
34
35
  date: Event['startAt'],
35
36
  statistic: EventStatistic | null,
37
+ eventId: string
36
38
  ) => {
37
39
  if (!statistic) {
38
40
  return []
@@ -40,7 +42,7 @@ export const useTableData = (
40
42
 
41
43
  const tableDataRows: StaticTableData[] = []
42
44
 
43
- convertEventStatisticToTableData(date, statistic).forEach(
45
+ convertEventStatisticToTableData(date, statistic, eventId).forEach(
44
46
  ({ name, quantity, total, isBold, isHeader, key }) => {
45
47
  const formattedTotal = !Object.keys(TRANSLATION_KEYS).includes(
46
48
  String(total),
@@ -82,9 +84,9 @@ export const useTableData = (
82
84
  }
83
85
 
84
86
  useEffect(() => {
85
- setTableRows(transformStatisticToTableRows(date, eventStatistic))
87
+ setTableRows(transformStatisticToTableRows(date, eventStatistic, eventId))
86
88
  // eslint-disable-next-line react-hooks/exhaustive-deps
87
- }, [date, eventStatistic])
89
+ }, [date, eventId, eventStatistic])
88
90
 
89
91
  return tableRows
90
92
  }
@@ -1,6 +1,7 @@
1
1
  import { EventStatistic } from '@licklist/core/dist/DataMapper/Provider/EventStatisticDataMapper'
2
2
  import { DateTime } from 'luxon'
3
3
  import { DATE_FORMAT, DATE_TIME_FULL_FORMAT } from '@licklist/core/dist/Config'
4
+ import { maxBy } from 'lodash'
4
5
 
5
6
  export const TRANSLATION_KEYS = {
6
7
  shortQuantity: 'shortQuantity',
@@ -57,11 +58,19 @@ export const convertEventStatisticToTableData = (
57
58
  : -1,
58
59
  )
59
60
  .forEach(
60
- ({ totalPerCategory, productsSummary = [], categoryName, eventId }) => {
61
+ (
62
+ { totalPerCategory, productsSummary = [], categoryName, eventId },
63
+ _,
64
+ // all category at summaryDays
65
+ selfCategory,
66
+ ) => {
61
67
  let quantity = 0
62
-
63
68
  totalAmount += totalPerCategory || 0
64
69
 
70
+ const allProductSummaryAtCategory = selfCategory
71
+ .filter((category) => category.categoryName === categoryName)
72
+ .flatMap((categorySummary) => categorySummary.productsSummary)
73
+
65
74
  if (!summaryMap.has(`${categoryName}`)) {
66
75
  summaryMap.set(`${categoryName}`, {
67
76
  name: categoryName,
@@ -73,36 +82,49 @@ export const convertEventStatisticToTableData = (
73
82
  })
74
83
  }
75
84
 
76
- productsSummary?.forEach(
77
- ({ productsSold, name, totalQuantity, total }) => {
78
- quantity += productsSold
79
-
80
- const existingProduct = summaryMap.get(
81
- `${categoryName}.${name}`,
82
- ) ?? {
83
- metadata: {
84
- _productsSold: 0,
85
- _total: 0,
86
- },
87
- }
88
-
89
- summaryMap.set(`${categoryName}.${name}`, {
90
- name,
91
- key: `${eventId}.${categoryName}.${name}`,
92
- quantity: totalQuantity
93
- ? `${
94
- existingProduct.metadata._productsSold + productsSold
95
- } / ${totalQuantity}`
96
- : String(existingProduct.metadata._productsSold + productsSold),
97
- total: String(existingProduct.metadata._total + total),
98
- metadata: {
99
- _productsSold:
100
- existingProduct.metadata._productsSold + productsSold,
101
- _total: existingProduct.metadata._total + total,
102
- },
103
- })
104
- },
105
- )
85
+ productsSummary?.forEach((productSummary, productIndex) => {
86
+ quantity += productSummary.productsSold
87
+
88
+ const existingProduct = summaryMap.get(
89
+ `${categoryName}.${productSummary.name}`,
90
+ ) ?? {
91
+ metadata: {
92
+ _productsSold: 0,
93
+ _total: 0,
94
+ },
95
+ }
96
+
97
+ const overrides = allProductSummaryAtCategory.filter(
98
+ (summary) => summary.originalProductId === productSummary.id,
99
+ )
100
+
101
+ const maxTotalQuantity = maxBy(overrides, 'id')?.totalQuantity
102
+
103
+ const totalQuantity = maxTotalQuantity || productSummary?.totalQuantity
104
+
105
+ summaryMap.set(`${categoryName}.${productSummary.name}`, {
106
+ name: productSummary.name,
107
+ key: `${eventId}.${categoryName}${productIndex}${productSummary.name}`,
108
+ quantity: totalQuantity
109
+ ? `${
110
+ existingProduct.metadata._productsSold +
111
+ productSummary.productsSold
112
+ } / ${totalQuantity}`
113
+ : String(
114
+ existingProduct.metadata._productsSold +
115
+ productSummary.productsSold,
116
+ ),
117
+ total: String(
118
+ existingProduct.metadata._total + productSummary.total,
119
+ ),
120
+ metadata: {
121
+ _productsSold:
122
+ existingProduct.metadata._productsSold +
123
+ productSummary.productsSold,
124
+ _total: existingProduct.metadata._total + productSummary.total,
125
+ },
126
+ })
127
+ })
106
128
 
107
129
  const prevTotalPerCategory = summaryMap.get(
108
130
  `${categoryName}.${TRANSLATION_KEYS.totalPerCategory}`,
@@ -49,6 +49,7 @@ export const EventVenueMap = forwardRef<VenueMapRef, EventVenueMapProps>(
49
49
  },
50
50
  ref,
51
51
  ) => {
52
+ // TODO fix often updating of canvasSizes, which leads to flashing poingts
52
53
  const canvasSizes = useCanvasSize({ width, height })
53
54
 
54
55
  return (
@@ -10,13 +10,17 @@ export const useCanvasSize = ({
10
10
  width: componentWidth,
11
11
  height: componentHeight,
12
12
  }: CanvasSizeProps) => {
13
+ // TODO Fix often updating of width and height
13
14
  const { width, height } = useWindowDimensions()
14
15
 
16
+ // eslint-disable-next-line react-hooks/exhaustive-deps
17
+ const memoizedDimensions = useMemo(() => ({ width, height }), [width])
18
+
15
19
  const memoedComponentParameters = useMemo(() => {
16
20
  if (!componentWidth && !componentHeight) return null
17
21
 
18
22
  return { width: componentWidth, height: componentHeight }
19
23
  }, [componentWidth, componentHeight])
20
24
 
21
- return memoedComponentParameters || { width, height }
25
+ return memoedComponentParameters || memoizedDimensions
22
26
  }
@@ -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
  }`}
@@ -1,4 +1,5 @@
1
1
  export const TAB_WIDTH = 768
2
+ export const MOBILE_WIDTH = 480
2
3
  export const RIGHT_BLOCK_RESIZED_EVENT = 'RIGHT_BLOCK_RESIZED_EVENT'
3
4
  // The sum of paddings in PageBody + header for first block
4
5
  export const STANDARD_BODY_PADDING = 48 + 49
@@ -2,6 +2,7 @@ import { useEffect, useMemo, useState, useRef } from 'react'
2
2
  import { useWindowDimensions } from '@licklist/plugins/dist/hooks/Media/useWindowDimensions'
3
3
  import {
4
4
  TAB_WIDTH,
5
+ MOBILE_WIDTH,
5
6
  STANDARD_BODY_PADDING,
6
7
  STANDARD_HEADER_FOOTER_SIZE,
7
8
  RIGHT_BLOCK_RESIZED_EVENT,
@@ -60,6 +61,16 @@ export const useResizePageBody = () => {
60
61
  })
61
62
  }
62
63
 
64
+ if (width <= MOBILE_WIDTH && Boolean(CALENDAR_WRAPPER_HEIGHT)) {
65
+ return {
66
+ maxHeight:
67
+ height -
68
+ STANDARD_BODY_PADDING -
69
+ rightBlockHeight -
70
+ CALENDAR_WRAPPER_HEIGHT,
71
+ }
72
+
73
+ }
63
74
  return {
64
75
  maxHeight:
65
76
  height -
@@ -87,7 +98,6 @@ export const useResizePageBody = () => {
87
98
 
88
99
  if (width >= TAB_WIDTH && !isContainerSizeApplied) {
89
100
  isContainerSizeApplied.current = true
90
-
91
101
  setLeftBlockContainerSizes({
92
102
  width: leftBlockContainer.clientWidth,
93
103
  height: leftBlockContainer.clientHeight,
@@ -117,7 +127,6 @@ export const useResizePageBody = () => {
117
127
  ) {
118
128
  minimalMapSize.current = calculatedMinimalMapSize
119
129
  }
120
-
121
130
  return {
122
131
  width: leftBlockContainer.clientWidth,
123
132
  height: minimalMapSize.current,
@@ -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,
@@ -5,12 +5,14 @@ import { useForm } from 'react-hook-form'
5
5
  import Button from 'react-bootstrap/Button'
6
6
  import { useHistory } from 'react-router-dom'
7
7
  import Alert from 'react-bootstrap/Alert'
8
+ import {
9
+ STATUS_APPROVED,
10
+ STATUS_CAPTURED,
11
+ STATUS_PENDING_ACTION,
12
+ STATUS_PENDING_PAYMENT,
13
+ } from '@licklist/core/dist/DataMapper/Order/PaymentSessionOrderDataMapper'
8
14
  import {
9
15
  useRyftPayment,
10
- RYFT_STATUS_APPROVED,
11
- RYFT_STATUS_CAPTURED,
12
- RYFT_STATUS_PENDING_ACTION,
13
- RYFT_STATUS_PENDING_PAYMENT,
14
16
  AttemptPaymentResponse,
15
17
  } from '@licklist/plugins/dist/hooks/Ryft/useRyftPayment'
16
18
  import { ProviderPaymentSettings } from '@licklist/core/dist/DataMapper/Setting/ProviderPaymentSettingsDataMapper'
@@ -105,7 +107,7 @@ export const RyftPaymentForm = ({
105
107
 
106
108
  if ('requiredAction' in paymentSession) {
107
109
  if (
108
- paymentSession.status !== RYFT_STATUS_PENDING_ACTION ||
110
+ paymentSession.status !== STATUS_PENDING_ACTION ||
109
111
  !paymentSession.requiredAction?.url
110
112
  ) {
111
113
  redirectOnFailAttempt(paymentSession)
@@ -117,9 +119,9 @@ export const RyftPaymentForm = ({
117
119
  }
118
120
 
119
121
  if (
120
- paymentSession.status === RYFT_STATUS_APPROVED ||
121
- paymentSession.status === RYFT_STATUS_CAPTURED ||
122
- paymentSession.status === RYFT_STATUS_PENDING_PAYMENT
122
+ paymentSession.status === STATUS_APPROVED ||
123
+ paymentSession.status === STATUS_CAPTURED ||
124
+ paymentSession.status === STATUS_PENDING_PAYMENT
123
125
  ) {
124
126
  redirectOnFailAttempt(paymentSession)
125
127
  return
@@ -61,20 +61,22 @@ export const injectComponentsInRyftForm = ({
61
61
  divider.id = 'mobile-pay-divider'
62
62
  container.id = 'mobile-pay-divider-container'
63
63
  container.append(dividerText, divider)
64
- const payIframe = document.getElementById("ryft-pay-iframe");
64
+ const payIframe = document.getElementById('ryft-pay-iframe')
65
65
  if (payIframe) {
66
66
  const formBox = document.getElementById('form-disable-box')
67
67
  if (formBox) {
68
- formBox.style.display = isDisableButton ? "block" : "none"
68
+ formBox.style.display = isDisableButton ? 'block' : 'none'
69
69
  }
70
70
 
71
71
  const googleButton = document.getElementById(
72
72
  'gpay-button-online-api-id',
73
73
  ) as HTMLButtonElement
74
- const appleButton =document.getElementById("ryft-pay-apple-pay-button") as HTMLButtonElement
74
+ const appleButton = document.getElementById(
75
+ 'ryft-pay-apple-pay-button',
76
+ ) as HTMLButtonElement
75
77
  if (googleButton) {
76
78
  googleButton.disabled = isDisableButton
77
- googleButton.style.opacity = isDisableButton ? '1' : '0.6'
79
+ googleButton.style.opacity = !isDisableButton ? '1' : '0.6'
78
80
  }
79
81
  if (appleButton) {
80
82
  appleButton.disabled = isDisableButton
@@ -86,7 +88,6 @@ export const injectComponentsInRyftForm = ({
86
88
  const applePayButton = document.createElement('button')
87
89
  applePayButton.id = 'apple-pay'
88
90
  applePayButton.type = 'button'
89
- applePayButton.style.opacity = !isDisableButton ? '1' : '0.6'
90
91
  applePayButton.className = 'bg-dark btn btn-primary apple-pay-button'
91
92
  applePayButton.textContent = t('Events:payWithApple')
92
93
  applePayButton.onclick = onApplePayButtonClick
@@ -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[]
@@ -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 || ''}
@@ -23,6 +23,7 @@ import { ruleForUrlWithProtocol } from '@licklist/plugins/dist/validation/Rules/
23
23
  import { WorkHour } from '@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper'
24
24
  import { checkIfZoneCategory } from '@licklist/plugins'
25
25
  import { Image } from '@licklist/core/dist/DataMapper/Media/ImageDataMapper'
26
+ import { SaleDeadline } from 'src/events/edit-event-modal/component/SaleDeadline'
26
27
  import { WarningMessage } from '../../static'
27
28
  import { SelectItem } from '../../types/generic/SelectItem'
28
29
  import {
@@ -66,6 +67,7 @@ export interface ProductSetControlValues extends DateAndRecurrenceInputValues {
66
67
  productGroups?: SelectItem[]
67
68
  relyOnPeopleType?: RelyOnPeopleType | null
68
69
  fieldSetId?: number
70
+ saleDeadline?: number
69
71
  steps: Step[]
70
72
  emailTemplates?: TemplateItem[]
71
73
  smsTemplates?: TemplateItem[]
@@ -93,6 +95,7 @@ export interface ProductSetControlProps {
93
95
  workHours: WorkHour[] | undefined
94
96
  providerHasBookingManagement?: boolean
95
97
  isOverrides?: boolean
98
+ saleDeadline?: number
96
99
  isCreateNewOverrides?: boolean
97
100
  timeZone: string
98
101
  }
@@ -222,6 +225,8 @@ export function ProductSetControl({
222
225
  </>
223
226
  )}
224
227
 
228
+ <SaleDeadline disabled={false} onlyBefore />
229
+
225
230
  <div className='divider' />
226
231
 
227
232
  <TutorialGifCard isOverrides={isOverrides} />
@@ -8,6 +8,7 @@ import {
8
8
  useFormContext,
9
9
  useWatch,
10
10
  } from 'react-hook-form'
11
+ import { FaBars, FaBowlingBall, FaCalendar, FaTicketAlt } from 'react-icons/fa'
11
12
  import { useTranslation } from 'react-i18next'
12
13
  import { useSensor, MouseSensor } from '@dnd-kit/core'
13
14
  import {
@@ -25,7 +26,11 @@ import { ProductCategoryControl } from '../product-category'
25
26
  import { ProductCategory } from '../types'
26
27
  import { ProductsControl } from './ProductsControl'
27
28
  import { ProductSetFormValues, WithIsLoading } from './ProductSetForm'
28
- import { SelectCategoryModal } from './SelectCategoryModal'
29
+ import {
30
+ SelectCategoryModal,
31
+ CATEGORY_TYPES_NAMES,
32
+ CategoryConfig,
33
+ } from './SelectCategoryModal'
29
34
  import { ProductSetLoadingContext } from './context'
30
35
  import { VenueMapSetModal } from './VenueMapSetModal'
31
36
  import { moveArrayElements, sortArrayByIndex } from '../utils'
@@ -33,6 +38,29 @@ import { useSortableTreeFunctions } from '../hooks/useSortableTreeFunctions'
33
38
  // @TODO not for first release
34
39
  // import Popover from "./ProductSetFormPopover";
35
40
 
41
+ const CATEGORIES_TYPE: Partial<Record<CategoryType, CategoryConfig>> = {
42
+ [CATEGORY_TYPES_NAMES.tickets]: {
43
+ label: 'tickets',
44
+ icon: <FaTicketAlt color='#0e8ce2' size={10} />,
45
+ },
46
+ [CATEGORY_TYPES_NAMES.bookings]: {
47
+ label: 'bookings',
48
+ icon: <FaCalendar color='#0e8ce2' size={10} />,
49
+ },
50
+ [CATEGORY_TYPES_NAMES.menuItems]: {
51
+ label: 'menuItems',
52
+ icon: <FaBars color='#0e8ce2' size={10} />,
53
+ },
54
+ [CATEGORY_TYPES_NAMES.game]: {
55
+ label: 'game',
56
+ icon: <FaBowlingBall color='#0e8ce2' size={10} />,
57
+ },
58
+ [CATEGORY_TYPES_NAMES.fixedDuration]: {
59
+ label: 'fixedDuration',
60
+ icon: <FaCalendar color='#0e8ce2' size={10} />,
61
+ },
62
+ }
63
+
36
64
  interface ProductCategoriesControlProps extends WithIsLoading {
37
65
  stepIndex: number
38
66
  isOverrides?: boolean
@@ -58,6 +86,7 @@ const getCategoryDefaultValue = (
58
86
  remainderExpireAfter: undefined,
59
87
  hasBookingManagement: false,
60
88
  weight: 0,
89
+ saleDeadlineCategory: 0,
61
90
  isReusable: false,
62
91
  hasSubEvents: false,
63
92
  products: [],
@@ -228,6 +257,8 @@ export function ProductCategoriesControl({
228
257
  setIsExpanded(productCategoryId)
229
258
  }
230
259
 
260
+ const categoryType = CATEGORIES_TYPE[productCategory.type]
261
+
231
262
  return (
232
263
  <Controller
233
264
  key={`product-category-${productCategory._id}`}
@@ -272,6 +303,12 @@ export function ProductCategoriesControl({
272
303
  )}
273
304
  modalClass={ProductSetModalClasses.category}
274
305
  isNewAdded={showCategoryModal}
306
+ itemButton={
307
+ <div className='btn-outline-primary item-icon sm border border-primary rounded-sm'>
308
+ {categoryType.icon}
309
+ <span className='ml-2'>{t(categoryType.label)}</span>
310
+ </div>
311
+ }
275
312
  body={
276
313
  <ProductCategoryControl
277
314
  isLoading={isLoading}