@licklist/design 0.70.7 → 0.70.8-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 (181) hide show
  1. package/dist/affiliate/form/AffiliateForm.d.ts.map +1 -1
  2. package/dist/assets/iframe/available.svg +4 -4
  3. package/dist/assets/iframe/available.svg.js +16 -18
  4. package/dist/auth/Login/LoginComponent.js +2 -1
  5. package/dist/availability-indicator/AvailabilityIndicator.d.ts +4 -2
  6. package/dist/availability-indicator/AvailabilityIndicator.d.ts.map +1 -1
  7. package/dist/availability-indicator/AvailabilityIndicator.js +112 -18
  8. package/dist/calendar/Calendar.d.ts +2 -0
  9. package/dist/calendar/Calendar.d.ts.map +1 -1
  10. package/dist/calendar/components/CalendarDates/CalendarDates.d.ts +2 -2
  11. package/dist/calendar/components/CalendarDates/CalendarDates.d.ts.map +1 -1
  12. package/dist/calendar/components/CalendarDates/CalendarDates.js +3 -2
  13. package/dist/calendar/utils/index.d.ts +8 -2
  14. package/dist/calendar/utils/index.d.ts.map +1 -1
  15. package/dist/calendar/utils/index.js +9 -21
  16. package/dist/date-time-button/DateContent.d.ts.map +1 -1
  17. package/dist/date-time-button/DateContent.js +3 -3
  18. package/dist/date-time-button/DateTimeButton.d.ts +3 -1
  19. package/dist/date-time-button/DateTimeButton.d.ts.map +1 -1
  20. package/dist/date-time-button/DateTimeButton.js +5 -3
  21. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +3 -1
  22. package/dist/events/edit-event-modal/utils/getDefaultProductSet.d.ts.map +1 -1
  23. package/dist/events/edit-event-modal/utils/getDefaultProductSet.js +0 -1
  24. package/dist/events/event-venue-map/EventVenueMap.d.ts.map +1 -1
  25. package/dist/events/event-venue-map/EventVenueMap.js +1 -0
  26. package/dist/events/event-venue-map/hooks/useCanvasSize.d.ts.map +1 -1
  27. package/dist/events/event-venue-map/hooks/useCanvasSize.js +11 -4
  28. package/dist/iframe/activity-card/ActivityCard.d.ts +3 -1
  29. package/dist/iframe/activity-card/ActivityCard.d.ts.map +1 -1
  30. package/dist/iframe/activity-card/ActivityCard.js +5 -3
  31. package/dist/iframe/event/ticket-description/TicketDescription.d.ts.map +1 -1
  32. package/dist/iframe/event/ticket-description/TicketDescription.js +43 -32
  33. package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.d.ts.map +1 -1
  34. package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.js +13 -0
  35. package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts.map +1 -1
  36. package/dist/iframe/ryft/RyftPaymentForm.d.ts.map +1 -1
  37. package/dist/iframe/ryft/RyftPaymentForm.js +25 -12
  38. package/dist/iframe/ryft/utils/ryft-form.d.ts.map +1 -1
  39. package/dist/iframe/ryft/utils/ryft-form.js +4 -5
  40. package/dist/layout/DropDown.d.ts +2 -1
  41. package/dist/layout/DropDown.d.ts.map +1 -1
  42. package/dist/notification/email-template/control/EmailTemplateControl.d.ts.map +1 -1
  43. package/dist/notification/email-template/control/EmailTemplateControl.js +3 -0
  44. package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
  45. package/dist/product-set/form/ProductCategoriesControl.js +48 -2
  46. package/dist/product-set/form/ProductSetForm.d.ts +4 -1
  47. package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
  48. package/dist/product-set/form/ProductSetForm.js +1 -1
  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 +1 -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/VenueMapSetModal.d.ts.map +1 -1
  58. package/dist/product-set/form/VenueMapSetModal.js +7 -7
  59. package/dist/product-set/form/VenueMapsControl.d.ts.map +1 -1
  60. package/dist/product-set/form/VenueMapsControl.js +0 -3
  61. package/dist/product-set/product/ProductControl.d.ts.map +1 -1
  62. package/dist/product-set/product/advanced-options/AdvancedOptions.js +1 -0
  63. package/dist/product-set/product/booking-management/ProductBookingManagementControl.d.ts.map +1 -1
  64. package/dist/product-set/product/booking-management/ProductBookingManagementControl.js +6 -0
  65. package/dist/product-set/product/deposit/ProductDepositControl.d.ts.map +1 -1
  66. package/dist/product-set/product/deposit/ProductDepositControl.js +3 -0
  67. package/dist/product-set/product/duration/ProductDurationControl.d.ts.map +1 -1
  68. package/dist/product-set/product/duration/ProductDurationControl.js +6 -0
  69. package/dist/product-set/product/price/ProductPriceControl.d.ts.map +1 -1
  70. package/dist/product-set/product/price/ProductPriceControl.js +3 -0
  71. package/dist/product-set/product/quantity/ProductQuantityConstantControl.d.ts.map +1 -1
  72. package/dist/product-set/product/quantity/ProductQuantityConstantControl.js +6 -0
  73. package/dist/product-set/product/quantity/ProductQuantityControl.d.ts.map +1 -1
  74. package/dist/product-set/product/quantity/ProductQuantityControl.js +6 -0
  75. package/dist/product-set/product/quantity/ProductQuantityRechargingControl.d.ts.map +1 -1
  76. package/dist/product-set/product/quantity/ProductQuantityRechargingControl.js +4 -1
  77. package/dist/product-set/product-category/ProductCategoryControl.d.ts.map +1 -1
  78. package/dist/product-set/product-category/ProductCategoryControl.js +12 -0
  79. package/dist/recurrence-input/RecurrenceEndInput.d.ts.map +1 -1
  80. package/dist/recurrence-input/RecurrenceEndInput.js +3 -0
  81. package/dist/recurring-date-picker-input/RecurrenceEndInput.d.ts.map +1 -1
  82. package/dist/resource/form/components/CapacityControl.d.ts.map +1 -1
  83. package/dist/resource/form/components/CapacityControl.js +3 -0
  84. package/dist/resource/form/components/SortControl.d.ts.map +1 -1
  85. package/dist/resource/form/components/SortControl.js +3 -0
  86. package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
  87. package/dist/sales/booking/results/components/ResultCard.js +0 -2
  88. package/dist/sales/coupon/control/CouponFormControl.d.ts.map +1 -1
  89. package/dist/sales/coupon/control/CouponFormControl.js +21 -0
  90. package/dist/setting/admin/PaymentFeeForm.d.ts.map +1 -1
  91. package/dist/setting/admin/PaymentFeeForm.js +16 -1
  92. package/dist/setting/dashboard/DashboardSettingForm.d.ts.map +1 -1
  93. package/dist/setting/dashboard/DashboardSettingForm.js +4 -1
  94. package/dist/snippet/snippet-template/preview/Preview.d.ts.map +1 -1
  95. package/dist/snippet/snippet-template/preview/Preview.js +8 -0
  96. package/dist/sortable-tree/SortableTreeItem.d.ts +2 -1
  97. package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
  98. package/dist/sortable-tree/SortableTreeItem.js +10 -4
  99. package/dist/static/CurrencyNumberInput.d.ts.map +1 -1
  100. package/dist/static/CurrencyNumberInput.js +3 -0
  101. package/dist/static/form-number-input/FormNumberInput.d.ts.map +1 -1
  102. package/dist/static/form-number-input/FormNumberInput.js +3 -0
  103. package/dist/static/number-input/NumberInput.d.ts.map +1 -1
  104. package/dist/static/number-input/NumberInput.js +3 -0
  105. package/dist/styles/availability-indicator/AvailabilityIndicator.scss +9 -0
  106. package/dist/styles/date-time-button/DateTimeButton.scss +2 -1
  107. package/dist/styles/iframe-events/TicketDescription.scss +1 -1
  108. package/dist/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
  109. package/dist/styles/product-set/ProductSetForm.scss +22 -0
  110. package/dist/styles/ryft-payment-form/RyftPaymentForm.scss +1 -3
  111. package/dist/styles/sales/BookingResults.scss +1 -1
  112. package/dist/tiptap-editor/TipTapEditor.d.ts +2 -1
  113. package/dist/tiptap-editor/TipTapEditor.d.ts.map +1 -1
  114. package/dist/tiptap-editor/TipTapEditor.js +32 -2
  115. package/dist/zone/form/components/GameDurationControl.d.ts.map +1 -1
  116. package/dist/zone/form/components/GameDurationControl.js +3 -0
  117. package/dist/zone/form/components/SortControl.d.ts.map +1 -1
  118. package/dist/zone/form/components/SortControl.js +3 -0
  119. package/package.json +8 -6
  120. package/src/affiliate/form/AffiliateForm.tsx +1 -0
  121. package/src/assets/iframe/available.svg +4 -4
  122. package/src/auth/Login/LoginComponent.tsx +1 -1
  123. package/src/availability-indicator/AvailabilityIndicator.tsx +92 -17
  124. package/src/calendar/Calendar.tsx +2 -0
  125. package/src/calendar/components/CalendarDates/CalendarDates.tsx +3 -0
  126. package/src/calendar/utils/index.ts +17 -26
  127. package/src/date-time-button/DateContent.tsx +3 -3
  128. package/src/date-time-button/DateTimeButton.tsx +7 -3
  129. package/src/events/edit-event-modal/utils/getDefaultProductSet.ts +0 -1
  130. package/src/events/event-venue-map/EventVenueMap.tsx +1 -0
  131. package/src/events/event-venue-map/hooks/useCanvasSize.ts +5 -1
  132. package/src/iframe/activity-card/ActivityCard.tsx +15 -2
  133. package/src/iframe/event/ticket-description/TicketDescription.tsx +35 -22
  134. package/src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx +9 -0
  135. package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +1 -0
  136. package/src/iframe/ryft/RyftPaymentForm.tsx +14 -3
  137. package/src/iframe/ryft/utils/ryft-form.ts +6 -5
  138. package/src/layout/DropDown.tsx +1 -1
  139. package/src/notification/email-template/control/EmailTemplateControl.tsx +1 -0
  140. package/src/product-set/form/ProductCategoriesControl.tsx +37 -1
  141. package/src/product-set/form/ProductSetForm.tsx +6 -2
  142. package/src/product-set/form/ProductZonesControl.tsx +1 -4
  143. package/src/product-set/form/SelectCategoryModal.tsx +2 -2
  144. package/src/product-set/form/SubProductsControl.tsx +0 -3
  145. package/src/product-set/form/VenueMapSetModal.tsx +8 -9
  146. package/src/product-set/form/VenueMapsControl.tsx +0 -3
  147. package/src/product-set/product/ProductControl.tsx +0 -1
  148. package/src/product-set/product/advanced-options/AdvancedOptions.tsx +1 -1
  149. package/src/product-set/product/booking-management/ProductBookingManagementControl.tsx +2 -0
  150. package/src/product-set/product/deposit/ProductDepositControl.tsx +1 -0
  151. package/src/product-set/product/duration/ProductDurationControl.tsx +2 -0
  152. package/src/product-set/product/price/ProductPriceControl.tsx +1 -0
  153. package/src/product-set/product/quantity/ProductQuantityConstantControl.tsx +2 -0
  154. package/src/product-set/product/quantity/ProductQuantityControl.tsx +2 -0
  155. package/src/product-set/product/quantity/ProductQuantityRechargingControl.tsx +1 -0
  156. package/src/product-set/product-category/ProductCategoryControl.tsx +4 -0
  157. package/src/product-set/product-zone/ProductZoneControl.tsx +1 -1
  158. package/src/recurrence-input/RecurrenceEndInput.tsx +1 -0
  159. package/src/recurring-date-picker-input/RecurrenceEndInput.tsx +1 -0
  160. package/src/resource/form/components/CapacityControl.tsx +1 -0
  161. package/src/resource/form/components/SortControl.tsx +1 -0
  162. package/src/sales/booking/results/components/ResultCard.tsx +0 -2
  163. package/src/sales/coupon/control/CouponFormControl.tsx +7 -0
  164. package/src/setting/admin/PaymentFeeForm.tsx +5 -0
  165. package/src/setting/dashboard/DashboardSettingForm.tsx +1 -0
  166. package/src/snippet/snippet-template/preview/Preview.tsx +6 -0
  167. package/src/sortable-tree/SortableTreeItem.tsx +6 -0
  168. package/src/static/CurrencyNumberInput.tsx +1 -0
  169. package/src/static/form-number-input/FormNumberInput.tsx +1 -0
  170. package/src/static/number-input/NumberInput.tsx +1 -0
  171. package/src/styles/availability-indicator/AvailabilityIndicator.scss +9 -0
  172. package/src/styles/date-time-button/DateTimeButton.scss +2 -1
  173. package/src/styles/iframe-events/TicketDescription.scss +1 -1
  174. package/src/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
  175. package/src/styles/product-set/ProductSetForm.scss +22 -0
  176. package/src/styles/ryft-payment-form/RyftPaymentForm.scss +1 -3
  177. package/src/styles/sales/BookingResults.scss +1 -1
  178. package/src/tiptap-editor/TipTapEditor.tsx +8 -1
  179. package/src/zone/form/components/GameDurationControl.tsx +1 -0
  180. package/src/zone/form/components/SortControl.tsx +1 -0
  181. package/yarn.lock +29 -27
@@ -6,9 +6,9 @@ import {
6
6
  } from '@licklist/core/dist/Config'
7
7
  import { getDayWithOrdinal } from '@licklist/plugins/dist/utils/formatDate'
8
8
  import clsx from 'clsx'
9
- import { isToday, isTomorrow } from 'date-fns'
10
9
  import { DateTime } from 'luxon'
11
10
  import { useTranslation } from 'react-i18next'
11
+ import { isToday, isTomorrow } from '@licklist/plugins/dist'
12
12
  import { DateTimeButtonProps, Variant } from './DateTimeButton'
13
13
 
14
14
  type DateContentProps = Pick<
@@ -55,9 +55,9 @@ export const DateContent = ({
55
55
  }
56
56
 
57
57
  const getDate = (date: DateTime): string => {
58
- if (isToday(date.toJSDate())) return 'today'
58
+ if (isToday(date)) return 'today'
59
59
 
60
- if (isTomorrow(date.toJSDate())) return 'tomorrow'
60
+ if (isTomorrow(date)) return 'tomorrow'
61
61
 
62
62
  return date.toFormat(DAY_OF_WEEK)
63
63
  }
@@ -2,6 +2,7 @@ import { ReactElement } from 'react'
2
2
  import clsx from 'clsx'
3
3
  import { DateTime } from 'luxon'
4
4
  import { ZoneResourcesAvailability } from '@licklist/core/dist/DataMapper/Order/ZoneResourcesAvailabilityDataMapper'
5
+ import { AvailabilityFormat } from '@licklist/core/dist/DataMapper/Provider/SnippetDataMapper'
5
6
  import { AvailabilityIndicator } from '../availability-indicator'
6
7
  import { DateContent } from './DateContent'
7
8
 
@@ -21,6 +22,7 @@ export type DateTimeButtonProps = {
21
22
  resources?: ZoneResourcesAvailability | null
22
23
  showResources?: boolean
23
24
  variant: Variant
25
+ availabilityFormat?: AvailabilityFormat | null
24
26
  }
25
27
 
26
28
  export const DateTimeButton = ({
@@ -33,6 +35,7 @@ export const DateTimeButton = ({
33
35
  resources,
34
36
  showResources,
35
37
  variant = Variant.week,
38
+ availabilityFormat,
36
39
  }: DateTimeButtonProps) => {
37
40
  const isSoldOut =
38
41
  _isSoldOut ||
@@ -43,7 +46,7 @@ export const DateTimeButton = ({
43
46
  const isPast = variant === Variant.time ? isPastTime(date) : isPastDate(date)
44
47
 
45
48
  const isDisabled = _isDisabled || isSoldOut || isPast
46
-
49
+ const isUnavailable = _isDisabled || isPast
47
50
  return (
48
51
  <button
49
52
  type='button'
@@ -67,10 +70,11 @@ export const DateTimeButton = ({
67
70
  variant={variant}
68
71
  />
69
72
  {price && !isDisabled && <div className='price'>{price}</div>}
70
- {showResources && resources && (
73
+ {showResources && (resources || isUnavailable) && (
71
74
  <AvailabilityIndicator
75
+ availabilityFormat={availabilityFormat}
72
76
  resources={resources}
73
- isUnavailable={_isDisabled || isPast}
77
+ isUnavailable={isUnavailable}
74
78
  isSoldOut={isSoldOut}
75
79
  />
76
80
  )}
@@ -39,7 +39,6 @@ export const getDefaultValues = (
39
39
  ...product,
40
40
  subProducts: subProducts?.map(({ ...subProducts }) => ({
41
41
  ...subProducts,
42
- originalProductId: null,
43
42
  productCategoryId: undefined,
44
43
  })),
45
44
  productCategoryId: undefined,
@@ -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
  }
@@ -2,6 +2,7 @@ import { ReactNode } from 'react'
2
2
  import clsx from 'clsx'
3
3
  import { Image } from '@licklist/core/dist/DataMapper/Media/ImageDataMapper'
4
4
  import { ZoneResourcesAvailability } from '@licklist/core/dist/DataMapper/Order/ZoneResourcesAvailabilityDataMapper'
5
+ import { AvailabilityFormat } from '@licklist/core/dist/DataMapper/Provider/SnippetDataMapper'
5
6
  import { AvailabilityIndicator } from '../../availability-indicator'
6
7
 
7
8
  export const LAYOUT_GRID = 'grid'
@@ -18,6 +19,7 @@ export type ActivityCardProps = {
18
19
  availableTimes?: string | null
19
20
  image?: Image | null
20
21
  resources?: ZoneResourcesAvailability
22
+ availabilityFormat?: AvailabilityFormat | null
21
23
  }
22
24
 
23
25
  export const ActivityCard = ({
@@ -30,6 +32,7 @@ export const ActivityCard = ({
30
32
  onSelect,
31
33
  isSelected,
32
34
  layout = LAYOUT_GRID,
35
+ availabilityFormat,
33
36
  resources,
34
37
  }: ActivityCardProps) => {
35
38
  if (layout === LAYOUT_GRID) {
@@ -50,7 +53,12 @@ export const ActivityCard = ({
50
53
  {description && (
51
54
  <div className='mt-2 activity-card-description'>{description}</div>
52
55
  )}
53
- {resources && <AvailabilityIndicator resources={resources} />}
56
+ {resources && (
57
+ <AvailabilityIndicator
58
+ resources={resources}
59
+ availabilityFormat={availabilityFormat}
60
+ />
61
+ )}
54
62
  </div>
55
63
  </button>
56
64
  )
@@ -76,7 +84,12 @@ export const ActivityCard = ({
76
84
  {description && (
77
85
  <div className='mt-2 activity-card-description'>{description}</div>
78
86
  )}
79
- {resources && <AvailabilityIndicator resources={resources} />}
87
+ {resources && (
88
+ <AvailabilityIndicator
89
+ resources={resources}
90
+ availabilityFormat={availabilityFormat}
91
+ />
92
+ )}
80
93
  </div>
81
94
 
82
95
  <hr className='list-activity-card-hr' />
@@ -30,7 +30,6 @@ export function TicketDescription({
30
30
  canExpand = true,
31
31
  }: TicketDescriptionProps) {
32
32
  const [isDescriptionExpanded, setIsDescriptionExpanded] = useState(false)
33
- const showDescription = !!description
34
33
 
35
34
  const wrapperClasses = clsx('ticket-description', className)
36
35
 
@@ -42,24 +41,6 @@ export function TicketDescription({
42
41
  '--description-wrapper-height': 'inherit',
43
42
  } as CSSProperties
44
43
 
45
- const renderDescription = () => (
46
- <div className='description-content'>
47
- <div className='d-flex flex-column'>
48
- <div className='product-title'>
49
- {title} {isRequired && <span>*</span>}
50
- </div>
51
- {showDescription && (
52
- <TipTapEditor
53
- viewMode
54
- disabled
55
- content={description}
56
- editorStyle={{ backgroundColor: 'transparent' }}
57
- />
58
- )}
59
- </div>
60
- </div>
61
- )
62
-
63
44
  return (
64
45
  <div className={wrapperClasses}>
65
46
  <div
@@ -78,14 +59,46 @@ export function TicketDescription({
78
59
  isExpanded={isDescriptionExpanded}
79
60
  setIsExpanded={setIsDescriptionExpanded}
80
61
  >
81
- {renderDescription()}
62
+ <Description
63
+ title={title}
64
+ isRequired={isRequired}
65
+ description={description}
66
+ />
82
67
  </TextExpand>
83
68
  ) : (
84
- renderDescription()
69
+ <Description
70
+ title={title}
71
+ isRequired={isRequired}
72
+ description={description}
73
+ />
85
74
  )}
86
75
  </div>
87
76
  </div>
88
- {price && <div className={clsx(showDescription && 'mt-5')}>{price}</div>}
77
+ {price && <div className={clsx({ 'mt-5': description })}>{price}</div>}
89
78
  </div>
90
79
  )
91
80
  }
81
+
82
+ const Description = ({
83
+ title,
84
+ isRequired,
85
+ description,
86
+ }: Pick<TicketDescriptionProps, 'title' | 'isRequired' | 'description'>) => (
87
+ <div className='description-content'>
88
+ <div className='d-flex flex-column'>
89
+ <div className='product-title'>
90
+ {title} {isRequired && <span>*</span>}
91
+ </div>
92
+
93
+ {!!description && (
94
+ <TipTapEditor
95
+ viewMode
96
+ disabled
97
+ content={description}
98
+ editorStyle={{ backgroundColor: 'transparent' }}
99
+ hideEmptyEditor
100
+ />
101
+ )}
102
+ </div>
103
+ </div>
104
+ )
@@ -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
  }`}
@@ -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,
@@ -33,6 +33,11 @@ export const ryftErrorMap: Record<string, string> = {
33
33
 
34
34
  export type RyftPaymentFormValues = Record<string, never>
35
35
 
36
+ interface GoogleAndApplePayResponse {
37
+ paymentSession: AttemptPaymentResponse
38
+ eventName: string
39
+ }
40
+
36
41
  export interface RyftPaymentFormProps {
37
42
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
43
  accountId: any
@@ -89,10 +94,10 @@ export const RyftPaymentForm = ({
89
94
  setReferrerBeforePayment()
90
95
  }
91
96
 
92
- const handleSubmit = async () => {
97
+ const handleSubmit = async (_paymentSession?: AttemptPaymentResponse) => {
93
98
  setIsBtnDisabled(true)
94
99
  try {
95
- const paymentSession = await onSubmit()
100
+ const paymentSession = _paymentSession || (await onSubmit())
96
101
 
97
102
  if (!paymentSession) {
98
103
  setRyftError('unknown_error')
@@ -164,6 +169,12 @@ export const RyftPaymentForm = ({
164
169
  addEventHandler('cardValidationChanged', (e: MessageEvent['data']) => {
165
170
  setIsValid(e.isValid)
166
171
  })
172
+ addEventHandler(
173
+ 'walletPaymentSessionResult',
174
+ (e: MessageEvent<GoogleAndApplePayResponse>['data']) => {
175
+ handleSubmit(e.paymentSession)
176
+ },
177
+ )
167
178
 
168
179
  setRyftInitFailure(false)
169
180
  },
@@ -218,7 +229,7 @@ export const RyftPaymentForm = ({
218
229
  ref={formRef}
219
230
  id='ryft-pay-form'
220
231
  noValidate
221
- onSubmit={methods.handleSubmit(handleSubmit)}
232
+ onSubmit={methods.handleSubmit(() => handleSubmit())}
222
233
  className='ryft-payment-form'
223
234
  >
224
235
  <div className='form-disable-box' id='form-disable-box' />
@@ -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 || ''}
@@ -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
@@ -228,6 +256,8 @@ export function ProductCategoriesControl({
228
256
  setIsExpanded(productCategoryId)
229
257
  }
230
258
 
259
+ const categoryType = CATEGORIES_TYPE[productCategory.type]
260
+
231
261
  return (
232
262
  <Controller
233
263
  key={`product-category-${productCategory._id}`}
@@ -272,6 +302,12 @@ export function ProductCategoriesControl({
272
302
  )}
273
303
  modalClass={ProductSetModalClasses.category}
274
304
  isNewAdded={showCategoryModal}
305
+ itemButton={
306
+ <div className='btn-outline-primary item-icon sm border border-primary rounded-sm'>
307
+ {categoryType.icon}
308
+ <span className='ml-2'>{t(categoryType.label)}</span>
309
+ </div>
310
+ }
275
311
  body={
276
312
  <ProductCategoryControl
277
313
  isLoading={isLoading}
@@ -12,7 +12,7 @@ import { isEqual } from 'lodash'
12
12
  import { ProviderBookingManagementSetting } from '@licklist/core/dist/DataMapper/Provider/ProviderBookingManagementSettingDataMapper'
13
13
  import { Zone } from '@licklist/core/dist/DataMapper/Provider/ZoneDataMapper'
14
14
  import { WorkHour } from '@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper'
15
- import { transformErrorToMessage } from '@licklist/plugins'
15
+ import { transformErrorToMessage } from '@licklist/plugins/dist/utils/error'
16
16
  import { Dialog, useDialogContext } from '../../modals/dialog'
17
17
  import {
18
18
  ProductSetControl,
@@ -28,12 +28,16 @@ import { ErrorModal } from '../../iframe/order-process/components/ErrorModal'
28
28
  export interface WithIsLoading {
29
29
  isLoading: boolean
30
30
  }
31
+ export interface WithIdOptional {
32
+ id?: number
33
+ }
34
+
31
35
  export interface WithId {
32
36
  id: number
33
37
  }
34
38
  export interface ProductSetFormValues
35
39
  extends FormValues,
36
- WithId,
40
+ WithIdOptional,
37
41
  ProductSetControlValues {
38
42
  steps: Step[]
39
43
  isOverrides?: boolean
@@ -1,7 +1,4 @@
1
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2
- // @ts-nocheck
3
- import React, { useContext, useState } from 'react'
4
-
1
+ import { useContext, useState } from 'react'
5
2
  import {
6
3
  ArrayPath,
7
4
  Controller,
@@ -25,7 +25,7 @@ import {
25
25
  } from 'react-icons/fa'
26
26
  import { ProductSetLoadingContext } from './context'
27
27
 
28
- const CATEGORY_TYPES_NAMES = {
28
+ export const CATEGORY_TYPES_NAMES = {
29
29
  menuItems: CATEGORY_TYPE_MENU_ITEMS,
30
30
  tickets: CATEGORY_TYPE_TICKETS,
31
31
  bookings: CATEGORY_TYPE_BOOKINGS,
@@ -33,7 +33,7 @@ const CATEGORY_TYPES_NAMES = {
33
33
  fixedDuration: CATEGORY_TYPE_FIXED_DURATION,
34
34
  } as const
35
35
 
36
- type CategoryConfig = { label: string; icon: ReactElement }
36
+ export type CategoryConfig = { label: string; icon: ReactElement }
37
37
 
38
38
  const MAIN_CATEGORIES: Partial<Record<CategoryType, CategoryConfig>> = {
39
39
  [CATEGORY_TYPES_NAMES.tickets]: {
@@ -70,9 +70,6 @@ export function SubProductsControl({
70
70
  images: subProducts[index]?.images as Image[],
71
71
  }
72
72
  // @ts-expect-error TS2345
73
- // @TODO fix prod type error
74
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
75
- // @ts-ignore
76
73
  append(subProductCopy)
77
74
  }}
78
75
  />
@@ -2,7 +2,7 @@ import { useCallback, useContext, useMemo } from 'react'
2
2
  import { Modal, Button, Form } from 'react-bootstrap'
3
3
  import clsx from 'clsx'
4
4
  import { useTranslation } from 'react-i18next'
5
- import { useFormContext } from 'react-hook-form'
5
+ import { useFormContext, useWatch } from 'react-hook-form'
6
6
  import HookFormService from '@licklist/plugins/dist/services/Form/HookFormService'
7
7
  import { PointProduct } from '@licklist/core/dist/DataMapper/Product/PointProductDataMapper'
8
8
  import { VenueMap } from '@licklist/core/dist/DataMapper/Product/VenueMapDataMapper'
@@ -11,7 +11,6 @@ import { WarningMessage } from '../../static'
11
11
  import { ProductSetLoadingContext } from './context'
12
12
  import { ProductSetFormValues } from './ProductSetForm'
13
13
  import { VenueMapsControl } from './VenueMapsControl'
14
- import { ProductCategory } from '../types'
15
14
 
16
15
  type VenueMapSetModalProps = {
17
16
  isVisible: boolean
@@ -34,6 +33,7 @@ export const VenueMapSetModal = ({
34
33
  watch,
35
34
  setValue,
36
35
  trigger,
36
+ control,
37
37
  } = useFormContext<ProductSetFormValues>()
38
38
 
39
39
  const key = `steps.${stepIndex}.venueMapSetId` as const
@@ -41,9 +41,10 @@ export const VenueMapSetModal = ({
41
41
 
42
42
  const venueMapSetId: number | null = watch(key) || null
43
43
 
44
- // eslint-disable-next-line react-hooks/exhaustive-deps
45
- const productCategories: ProductCategory[] =
46
- watch(`steps.${stepIndex}.productCategories` as const) || []
44
+ const productCategories = useWatch({
45
+ control,
46
+ name: `steps.${stepIndex}.productCategories`,
47
+ })
47
48
 
48
49
  const pointProducts: Partial<PointProduct>[] = watch(productPointsKey) || []
49
50
 
@@ -70,12 +71,10 @@ export const VenueMapSetModal = ({
70
71
  )
71
72
 
72
73
  const products = useMemo(() => {
73
- if (!productCategories || !productCategories.length) {
74
- return []
75
- }
74
+ if (!productCategories?.length) return []
76
75
 
77
76
  return productCategories.reduce(
78
- (prevProducts, currentCategory: ProductCategory) => [
77
+ (prevProducts, currentCategory) => [
79
78
  ...prevProducts,
80
79
  ...(currentCategory.products || []),
81
80
  ],
@@ -46,9 +46,6 @@ export const VenueMapsControl = ({
46
46
  url={image.url}
47
47
  name={name}
48
48
  points={points}
49
- // @TODO fix prod type error
50
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
51
- // @ts-ignore
52
49
  products={products}
53
50
  pointProducts={pointProducts}
54
51
  onPointProductsChange={onPointProductsChange}
@@ -34,7 +34,6 @@ import {
34
34
  } from 'react-hook-form'
35
35
  import { useTranslation } from 'react-i18next'
36
36
  import { useImages } from '@licklist/plugins/dist/hooks/Media/useImages'
37
-
38
37
  import {
39
38
  Image,
40
39
  IMAGE_TYPE_IMAGE,
@@ -1,4 +1,4 @@
1
- import React, { useContext } from 'react'
1
+ import { useContext } from 'react'
2
2
  import { Col, Form } from 'react-bootstrap'
3
3
  import { Controller, Path, useFormContext } from 'react-hook-form'
4
4
  import { HookFormService } from '@licklist/plugins'
@@ -86,6 +86,7 @@ export function ProductBookingManagementControl<T extends FormValues>(
86
86
  <Form.Control
87
87
  ref={ref}
88
88
  type='number'
89
+ onWheel={(event) => event.currentTarget.blur()}
89
90
  min={0}
90
91
  step={1}
91
92
  value={value as string}
@@ -129,6 +130,7 @@ export function ProductBookingManagementControl<T extends FormValues>(
129
130
  <Form.Control
130
131
  ref={ref}
131
132
  type='number'
133
+ onWheel={(event) => event.currentTarget.blur()}
132
134
  min='0'
133
135
  step='1'
134
136
  value={value as string}
@@ -50,6 +50,7 @@ export function ProductDepositControl<T extends FormValues>(
50
50
  <Form.Control
51
51
  ref={ref}
52
52
  type='number'
53
+ onWheel={(event) => event.currentTarget.blur()}
53
54
  min={0}
54
55
  max={Number(totalPrice)}
55
56
  step='0.01'
@@ -91,6 +91,7 @@ export const ProductDurationControl = <T,>({
91
91
  <Form.Control
92
92
  type='number'
93
93
  min={0}
94
+ onWheel={(event) => event.currentTarget.blur()}
94
95
  step={1}
95
96
  value={durationHours}
96
97
  disabled={disabled}
@@ -127,6 +128,7 @@ export const ProductDurationControl = <T,>({
127
128
  type='number'
128
129
  min={0}
129
130
  step={1}
131
+ onWheel={(event) => event.currentTarget.blur()}
130
132
  disabled={disabled}
131
133
  value={durationMinutes}
132
134
  isInvalid={isInvalid}
@@ -59,6 +59,7 @@ export function ProductPriceControl<T extends FormValues>({
59
59
  ref={ref}
60
60
  type='number'
61
61
  min={0}
62
+ onWheel={(event) => event.currentTarget.blur()}
62
63
  max={999999.99}
63
64
  step='0.01'
64
65
  value={value as string}
@@ -111,6 +111,7 @@ export function ProductQuantityConstantControl<T extends FormValues>(
111
111
  type='number'
112
112
  min={0}
113
113
  step={1}
114
+ onWheel={(event) => event.currentTarget.blur()}
114
115
  value={value as string}
115
116
  isInvalid={HookFormService.isInvalid<T>(
116
117
  `${fieldNamePrefix}.totalQuantity` as Path<T>,
@@ -165,6 +166,7 @@ export function ProductQuantityConstantControl<T extends FormValues>(
165
166
  type='number'
166
167
  min={0}
167
168
  step={1}
169
+ onWheel={(event) => event.currentTarget.blur()}
168
170
  value={value as string}
169
171
  onChange={onChange}
170
172
  onFocus={onFocus}