@licklist/design 0.68.2 → 0.68.5-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/affiliate/form/AffiliateForm.d.ts.map +1 -1
  2. package/dist/auth/Login/LoginComponent.js +2 -1
  3. package/dist/calendar/components/CalendarButtons/CalendarButtons.d.ts.map +1 -1
  4. package/dist/calendar/components/CalendarButtons/CalendarButtons.js +35 -40
  5. package/dist/events/edit-event-modal/IntervalInput.d.ts.map +1 -1
  6. package/dist/events/edit-event-modal/IntervalInput.js +7 -1
  7. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts.map +1 -1
  8. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +0 -1
  9. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts.map +1 -1
  10. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.js +24 -23
  11. package/dist/events/edit-event-modal/utils/getDefaultProductSet.d.ts.map +1 -1
  12. package/dist/events/edit-event-modal/utils/getDefaultProductSet.js +0 -1
  13. package/dist/iframe/event/event-card/IframeEventCard.d.ts.map +1 -1
  14. package/dist/iframe/event/event-card/IframeEventCard.js +2 -2
  15. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -1
  16. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.js +2 -0
  17. package/dist/iframe/page/components/PageBody/hooks/useResizePageBody.d.ts.map +1 -1
  18. package/dist/iframe/page/components/PageBody/hooks/useResizePageBody.js +0 -1
  19. package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts.map +1 -1
  20. package/dist/index.js +1 -0
  21. package/dist/layout/DropDown.d.ts +2 -1
  22. package/dist/layout/DropDown.d.ts.map +1 -1
  23. package/dist/modals/confirmation/ConfirmModal.d.ts +3 -1
  24. package/dist/modals/confirmation/ConfirmModal.d.ts.map +1 -1
  25. package/dist/modals/confirmation/ConfirmModal.js +172 -8
  26. package/dist/product-set/card/ProductSetCard.d.ts +6 -2
  27. package/dist/product-set/card/ProductSetCard.d.ts.map +1 -1
  28. package/dist/product-set/card/ProductSetCard.js +30 -11
  29. package/dist/product-set/control/DateInput.d.ts.map +1 -1
  30. package/dist/product-set/control/DateInput.js +2 -2
  31. package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
  32. package/dist/product-set/form/ProductCategoriesControl.js +48 -2
  33. package/dist/product-set/form/ProductSetForm.d.ts +4 -1
  34. package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
  35. package/dist/product-set/form/ProductSetForm.js +59 -1
  36. package/dist/product-set/form/ProductSetNameControl.d.ts +6 -0
  37. package/dist/product-set/form/ProductSetNameControl.d.ts.map +1 -0
  38. package/dist/product-set/form/ProductSetNameControl.js +35 -0
  39. package/dist/product-set/form/ProductZonesControl.d.ts.map +1 -1
  40. package/dist/product-set/form/ProductZonesControl.js +0 -2
  41. package/dist/product-set/form/SelectCategoryModal.d.ts +12 -0
  42. package/dist/product-set/form/SelectCategoryModal.d.ts.map +1 -1
  43. package/dist/product-set/form/SelectCategoryModal.js +1 -1
  44. package/dist/product-set/form/SubProductsControl.d.ts.map +1 -1
  45. package/dist/product-set/form/SubProductsControl.js +0 -3
  46. package/dist/product-set/form/VenueMapsControl.d.ts.map +1 -1
  47. package/dist/product-set/form/VenueMapsControl.js +0 -3
  48. package/dist/product-set/form/index.d.ts +1 -0
  49. package/dist/product-set/form/index.d.ts.map +1 -1
  50. package/dist/product-set/product/ProductControl.d.ts.map +1 -1
  51. package/dist/product-set/utils/index.d.ts +7 -0
  52. package/dist/product-set/utils/index.d.ts.map +1 -1
  53. package/dist/product-set/utils/index.js +10 -1
  54. package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
  55. package/dist/sales/booking/results/components/ResultCard.js +0 -2
  56. package/dist/snippet/snippet-template/preview/Preview.d.ts.map +1 -1
  57. package/dist/snippet/snippet-template/preview/Preview.js +6 -0
  58. package/dist/sortable-tree/SortableTreeItem.d.ts +2 -1
  59. package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
  60. package/dist/sortable-tree/SortableTreeItem.js +10 -4
  61. package/dist/styles/iframe-events/Calendar.scss +0 -1
  62. package/dist/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
  63. package/dist/styles/iframe-page/PageBody.scss +1 -1
  64. package/dist/styles/product-set/ProductSetForm.scss +22 -0
  65. package/dist/styles/sales/BookingResults.scss +1 -1
  66. package/dist/tiptap-editor/TipTapMenu/extensions/constants.d.ts +2 -0
  67. package/dist/tiptap-editor/TipTapMenu/extensions/constants.d.ts.map +1 -0
  68. package/dist/tiptap-editor/TipTapMenu/extensions/constants.js +3 -0
  69. package/dist/tiptap-editor/TipTapMenu/extensions/utils.d.ts +1 -1
  70. package/dist/tiptap-editor/TipTapMenu/extensions/utils.d.ts.map +1 -1
  71. package/dist/tiptap-editor/TipTapMenu/extensions/utils.js +3 -1
  72. package/dist/typeahead/Typeahead.d.ts +5 -1
  73. package/dist/typeahead/Typeahead.d.ts.map +1 -1
  74. package/dist/typeahead/Typeahead.js +9 -2
  75. package/package.json +8 -6
  76. package/src/affiliate/form/AffiliateForm.tsx +1 -0
  77. package/src/auth/Login/LoginComponent.tsx +1 -1
  78. package/src/calendar/components/CalendarButtons/CalendarButtons.tsx +29 -28
  79. package/src/events/edit-event-modal/IntervalInput.tsx +8 -1
  80. package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx +0 -1
  81. package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx +82 -85
  82. package/src/events/edit-event-modal/utils/getDefaultProductSet.ts +0 -1
  83. package/src/iframe/event/event-card/IframeEventCard.tsx +30 -29
  84. package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +1 -0
  85. package/src/iframe/page/components/PageBody/hooks/useResizePageBody.ts +0 -1
  86. package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +1 -0
  87. package/src/layout/DropDown.tsx +2 -1
  88. package/src/modals/confirmation/ConfirmModal.tsx +19 -3
  89. package/src/product-set/card/ProductSetCard.tsx +47 -8
  90. package/src/product-set/control/DateInput.tsx +2 -1
  91. package/src/product-set/form/ProductCategoriesControl.tsx +37 -1
  92. package/src/product-set/form/ProductSetForm.tsx +17 -2
  93. package/src/product-set/form/ProductSetNameControl.tsx +27 -0
  94. package/src/product-set/form/ProductZonesControl.tsx +1 -4
  95. package/src/product-set/form/SelectCategoryModal.tsx +2 -2
  96. package/src/product-set/form/SubProductsControl.tsx +0 -3
  97. package/src/product-set/form/VenueMapsControl.tsx +0 -3
  98. package/src/product-set/form/index.ts +1 -0
  99. package/src/product-set/product/ProductControl.tsx +0 -1
  100. package/src/product-set/product/advanced-options/AdvancedOptions.tsx +1 -1
  101. package/src/product-set/product-zone/ProductZoneControl.tsx +1 -1
  102. package/src/product-set/utils/index.ts +11 -0
  103. package/src/sales/booking/results/components/ResultCard.tsx +0 -2
  104. package/src/snippet/snippet-template/preview/Preview.tsx +6 -0
  105. package/src/sortable-tree/SortableTreeItem.tsx +6 -0
  106. package/src/styles/iframe-events/Calendar.scss +0 -1
  107. package/src/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
  108. package/src/styles/iframe-page/PageBody.scss +1 -1
  109. package/src/styles/product-set/ProductSetForm.scss +22 -0
  110. package/src/styles/sales/BookingResults.scss +1 -1
  111. package/src/tiptap-editor/TipTapMenu/extensions/constants.ts +1 -0
  112. package/src/tiptap-editor/TipTapMenu/extensions/utils.ts +4 -1
  113. package/src/typeahead/Typeahead.tsx +15 -1
  114. package/yarn.lock +59 -33
  115. package/dist/assets/iframe/selectArrow.svg.js +0 -17
@@ -9,15 +9,20 @@ import RouteService from '@licklist/plugins/dist/services/Route/RouteService'
9
9
  import { FaEllipsisH, FaEye, FaTrashAlt } from 'react-icons/fa'
10
10
  import { ConfirmModal } from '../../modals'
11
11
  import { MenuButton } from '../../table/MenuButton'
12
+ import { ProductSetNameControl } from '../form/ProductSetNameControl'
12
13
 
13
14
  export interface ProductSetCardProps extends HasPermissionProp {
14
15
  name: string
15
16
  rrule?: string
16
17
  href: string
17
- onCopy: () => void
18
+ duplicateProductSetName: string
19
+ onChangeDuplicateProductSetName: (value: string) => void
20
+ onCopy: () => Promise<boolean | undefined>
18
21
  onRemove: () => void
22
+ isLoading?: boolean
19
23
  className?: string
20
24
  override?: number
25
+ duplicateProductSetError?: string
21
26
  }
22
27
 
23
28
  export function ProductSetCard({
@@ -26,6 +31,10 @@ export function ProductSetCard({
26
31
  href,
27
32
  onCopy,
28
33
  onRemove,
34
+ onChangeDuplicateProductSetName,
35
+ duplicateProductSetName,
36
+ duplicateProductSetError,
37
+ isLoading,
29
38
  className = '',
30
39
  hasPermission = true,
31
40
  override = 0,
@@ -35,19 +44,23 @@ export function ProductSetCard({
35
44
  const productSetCardClasses = `product-set-card ${className}`
36
45
  const [isOverlayVisibile, setIsOverlayVisible] = useState(false)
37
46
 
47
+ const onCardClick = () => {
48
+ RouteService.redirectTo(href)
49
+ }
38
50
  return (
51
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events
39
52
  <div
40
53
  role="button"
41
54
  tabIndex={0}
42
55
  className="border-0 product-set-card-wrapper w-100 pb-0"
43
- onClick={() => RouteService.redirectTo(href)}
44
- onKeyUp={() => RouteService.redirectTo(href)}
56
+ onClick={onCardClick}
45
57
  >
46
58
  <div className={productSetCardClasses}>
47
59
  <div className="product-set-card-link">
48
60
  <div className="d-flex flex-column">
49
61
  <div>
50
- {name} {rrule && `(${RRule.fromString(rrule).toText()})`}
62
+ {name}
63
+ {rrule && `(${RRule.fromString(rrule).toText()})`}
51
64
  </div>
52
65
  {!!override && (
53
66
  <div className="h6 bold ml-1">
@@ -79,14 +92,33 @@ export function ProductSetCard({
79
92
  >
80
93
  {hasPermission && (
81
94
  <>
82
- <ListGroup.Item action as="div">
95
+ <ListGroup.Item
96
+ action
97
+ as="div"
98
+ role="button"
99
+ tabIndex={0}
100
+ onClick={(e) => e.stopPropagation()}
101
+ >
83
102
  {Boolean(onCopy) && (
84
- <ConfirmModal>
103
+ <ConfirmModal
104
+ // confirm function memoize the callback function and it leads to bugs
105
+ confirmationHandler={onCopy}
106
+ disabledButtons={isLoading}
107
+ content={
108
+ <ProductSetNameControl
109
+ value={duplicateProductSetName}
110
+ onChange={onChangeDuplicateProductSetName}
111
+ error={duplicateProductSetError}
112
+ />
113
+ }
114
+ >
85
115
  {(confirm) => (
86
116
  <MenuButton
87
117
  onClick={() => {
88
118
  setIsOverlayVisible(false)
89
- confirm(onCopy)
119
+ onChangeDuplicateProductSetName(name)
120
+ // confirm function memoize the callback function and it leads to bugs
121
+ confirm(() => {})
90
122
  }}
91
123
  name={t('duplicate')}
92
124
  className="product-set-card-menu-item-text"
@@ -95,7 +127,14 @@ export function ProductSetCard({
95
127
  </ConfirmModal>
96
128
  )}
97
129
  </ListGroup.Item>
98
- <ListGroup.Item action className="text-danger" as="div">
130
+ <ListGroup.Item
131
+ action
132
+ className="text-danger"
133
+ as="div"
134
+ role="button"
135
+ tabIndex={0}
136
+ onClick={(e) => e.stopPropagation()}
137
+ >
99
138
  {Boolean(onRemove) && (
100
139
  <ConfirmModal>
101
140
  {(confirm) => (
@@ -247,7 +247,8 @@ export const DateInput = ({
247
247
  menuRecurrence={menuRecurrence}
248
248
  onEdit={() => handleOnEdit(menuRecurrence, index)}
249
249
  errorMessage={
250
- errors?.menuRecurrences?.[`${index}`]?.availableTimes?.message
250
+ errors?.menuRecurrences?.[`${index}`]?.availableTimes
251
+ ?.message || errors?.menuRecurrences?.[`${index}`]?.message
251
252
  }
252
253
  />
253
254
  ))}
@@ -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}
@@ -1,4 +1,4 @@
1
- import { useEffect } from 'react'
1
+ import { useEffect, useState } from 'react'
2
2
  import { FormValues } from '@licklist/plugins/dist/types/services/Form/hook-form-service'
3
3
  import { Button, Form, Col, Row } from 'react-bootstrap'
4
4
  import { FormProvider, useForm } from 'react-hook-form'
@@ -22,16 +22,21 @@ import { Step } from '../types'
22
22
  import { ProductSetContextProvider, ProductSetLoadingContext } from './context'
23
23
  import { SelectItem } from '../../types/generic/SelectItem'
24
24
  import { checkAvailableTimesErrors, getFilteredTemplates } from '../utils'
25
+ import { ErrorModal } from '../../iframe/order-process/components/ErrorModal'
25
26
 
26
27
  export interface WithIsLoading {
27
28
  isLoading: boolean
28
29
  }
30
+ export interface WithIdOptional {
31
+ id?: number
32
+ }
33
+
29
34
  export interface WithId {
30
35
  id: number
31
36
  }
32
37
  export interface ProductSetFormValues
33
38
  extends FormValues,
34
- WithId,
39
+ WithIdOptional,
35
40
  ProductSetControlValues {
36
41
  steps: Step[]
37
42
  isOverrides?: boolean
@@ -84,6 +89,7 @@ export function ProductSetForm({
84
89
  onApproveDialog,
85
90
  onDeclineDialog,
86
91
  } = useDialogContext()
92
+ const [errorMessage, setErrorMessage] = useState('')
87
93
 
88
94
  const form = useForm<ProductSetFormValues>({
89
95
  defaultValues,
@@ -121,6 +127,9 @@ export function ProductSetForm({
121
127
  if (!serverErrors) {
122
128
  return
123
129
  }
130
+ if (Array.isArray(serverErrors) && serverErrors[0]) {
131
+ setErrorMessage(serverErrors[0])
132
+ }
124
133
  FormErrorService.handleServerErrors(serverErrors, setError)
125
134
  }, [serverErrors, setError])
126
135
 
@@ -156,6 +165,12 @@ export function ProductSetForm({
156
165
  onDecline={onDeclineDialog}
157
166
  />
158
167
 
168
+ <ErrorModal
169
+ message={errorMessage}
170
+ isOpen={!!errorMessage}
171
+ onClose={() => setErrorMessage('')}
172
+ />
173
+
159
174
  <FormProvider {...form}>
160
175
  <Form onSubmit={form.handleSubmit(submitHandler(onSubmitAndRedirect))}>
161
176
  <ProductSetLoadingContext.Consumer>
@@ -0,0 +1,27 @@
1
+ import { Form } from 'react-bootstrap'
2
+ import { useTranslation } from 'react-i18next'
3
+
4
+ export const ProductSetNameControl = ({
5
+ value,
6
+ onChange,
7
+ error,
8
+ }: {
9
+ value: string
10
+ onChange: (value: string) => void
11
+ error?: string
12
+ }) => {
13
+ const { t } = useTranslation(['Design'])
14
+ return (
15
+ <Form.Group>
16
+ <Form.Label>{t('Design:ProductSetName')}*</Form.Label>
17
+ <Form.Control
18
+ value={value}
19
+ maxLength={255}
20
+ onChange={(e) => onChange(e.target.value)}
21
+ placeholder={t('Design:placeholderProductSetName')}
22
+ isInvalid={Boolean(error)}
23
+ />
24
+ <Form.Control.Feedback type="invalid">{error}</Form.Control.Feedback>
25
+ </Form.Group>
26
+ )
27
+ }
@@ -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
  />
@@ -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}
@@ -1 +1,2 @@
1
1
  export * from './ProductSetForm'
2
+ export * from './ProductSetNameControl'
@@ -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'
@@ -1,4 +1,4 @@
1
- import React, { useContext, useEffect, useMemo } from 'react'
1
+ import { useContext, useEffect, useMemo } from 'react'
2
2
  import { Col, Form, Row } from 'react-bootstrap'
3
3
  import {
4
4
  ArrayPath,
@@ -3,6 +3,7 @@ import { SmsTemplate } from '@licklist/core/dist/DataMapper/Notification/SmsTemp
3
3
  import { TFunction } from 'react-i18next'
4
4
  import { UseFormSetError } from 'react-hook-form'
5
5
  import { checkIfZoneCategory } from '@licklist/plugins'
6
+ import { ProductSet } from '@licklist/core/dist/DataMapper/Product/ProductSetDataMapper'
6
7
  import { TemplateItem } from '../control/ProductSetControl'
7
8
  import { ProductSetFormValues } from '../form/ProductSetForm'
8
9
 
@@ -12,6 +13,11 @@ interface CheckAvailableTimesErrors {
12
13
  t: TFunction
13
14
  }
14
15
 
16
+ export interface MenuTypeheadItem {
17
+ id: number
18
+ label: string
19
+ value: number
20
+ }
15
21
  export const moveArrayElements = <T>(
16
22
  array: T[],
17
23
  prevIndex: number,
@@ -83,3 +89,8 @@ export const checkAvailableTimesErrors = ({
83
89
  })
84
90
  return hasError
85
91
  }
92
+
93
+ export const getTypeHeadItemsFromMenus = (
94
+ menus?: (ProductSet | ProductSetFormValues)[],
95
+ ): MenuTypeheadItem[] =>
96
+ menus?.map((menu) => ({ id: menu.id, value: menu.id, label: menu.name }))
@@ -20,8 +20,6 @@ export type ResultCardProps = {
20
20
  onCardClick?: (id: number) => void
21
21
  }
22
22
 
23
- // @TODO integrate when API will be available
24
- // activity and staff keys
25
23
  export const ResultCard = ({
26
24
  order,
27
25
  className,
@@ -307,6 +307,7 @@ export function Preview({
307
307
  productCategoryId: 57,
308
308
  productGroupId: null,
309
309
  availableQuantity: 980,
310
+ zoneId: null,
310
311
  name: 'Cofee',
311
312
  description: '',
312
313
  price: 15,
@@ -315,6 +316,8 @@ export function Preview({
315
316
  maxQuantity: 15,
316
317
  totalQuantity: 980,
317
318
  type: 'sale' as const,
319
+ capacity: 0,
320
+ duration: 0,
318
321
  weight: 0,
319
322
  isAvailable: true,
320
323
  isSoldOut: false,
@@ -333,6 +336,7 @@ export function Preview({
333
336
  productCategoryId: 57,
334
337
  productGroupId: null,
335
338
  availableQuantity: 980,
339
+ zoneId: null,
336
340
  name: 'Cofee 2',
337
341
  description: '',
338
342
  price: 15,
@@ -341,6 +345,8 @@ export function Preview({
341
345
  maxQuantity: 15,
342
346
  totalQuantity: 980,
343
347
  type: 'sale' as const,
348
+ capacity: 0,
349
+ duration: 0,
344
350
  weight: 0,
345
351
  isAvailable: true,
346
352
  isSoldOut: false,
@@ -33,6 +33,7 @@ export interface SortableTreeItemProps {
33
33
  body: ReactNode
34
34
  children?: ReactNode
35
35
  preItem?: ReactNode
36
+ itemButton?: ReactNode
36
37
  postItem?: ReactNode
37
38
  sortableItems?: string[]
38
39
  isExpanded?: boolean
@@ -82,6 +83,7 @@ export function SortableTreeItem({
82
83
  secondaryBadge,
83
84
  setIsExpanded,
84
85
  isOverride,
86
+ itemButton,
85
87
  }: SortableTreeItemProps) {
86
88
  const [expanded, setExpanded] = useState(isExpanded)
87
89
  const [isModalVisible, setIsModalVisible] = useState(isNewAdded)
@@ -287,9 +289,13 @@ export function SortableTreeItem({
287
289
  className={clsx(
288
290
  'sortable-tree-item-title',
289
291
  modalLabel && 'sortable-tree-product-set-element-title',
292
+ 'd-flex justify-content-between',
290
293
  )}
291
294
  >
292
295
  {title}
296
+ <div className="sortable-tree-item-subtitle">
297
+ {itemButton}
298
+ </div>
293
299
  </span>
294
300
  {!expanded && (
295
301
  <span className="sortable-tree-item-subtitle">
@@ -48,7 +48,6 @@
48
48
  height: 2.25rem;
49
49
  width: 14.125rem;
50
50
  justify-content: space-between;
51
- border: 1px solid $snippet-dropdown-border-color;
52
51
  border-radius: $iframe-border-radius;
53
52
  transition: $color-transition;
54
53
 
@@ -15,7 +15,7 @@ body[bkdt-scrollable='false'] .bkdt-mask {
15
15
  left: 0;
16
16
  width: 100%;
17
17
  height: 100%;
18
- z-index: 1000000;
18
+ z-index: 2147483646;
19
19
  background-color: rgba(0, 0, 0, 0.5);
20
20
  display: none;
21
21
  }
@@ -24,7 +24,7 @@ body[bkdt-scrollable='false'] .bkdt-mask {
24
24
  position: fixed;
25
25
  top: 0;
26
26
  left: 0;
27
- z-index: 1000001;
27
+ z-index: 2147483647;
28
28
  display: none;
29
29
  width: 100%;
30
30
  height: 100%;
@@ -258,7 +258,7 @@
258
258
  position: inherit;
259
259
  margin: 0 1rem 1rem;
260
260
  height: unset;
261
- min-height: 7rem;
261
+ min-height: 8rem;
262
262
  max-height: calc(calc(100svh - 8.25rem) * 0.75);
263
263
  }
264
264
  }
@@ -15,10 +15,12 @@
15
15
  height: 2.5rem;
16
16
  border-width: 2px;
17
17
  padding: 2px;
18
+
18
19
  label,
19
20
  .btn-switch-indicator {
20
21
  border-radius: 0.375rem !important;
21
22
  }
23
+
22
24
  label {
23
25
  height: 2rem;
24
26
  }
@@ -34,6 +36,7 @@
34
36
  margin-top: 1.5rem;
35
37
  margin-bottom: 1.5rem;
36
38
  }
39
+
37
40
  @include media-breakpoint-down(sm) {
38
41
  padding: 1.5rem 1rem;
39
42
  margin-top: 0.5rem;
@@ -59,10 +62,21 @@
59
62
  background-color: #ffdbdb;
60
63
  color: #d52902;
61
64
  }
65
+
62
66
  .category-badge {
63
67
  background-color: #e8f4f6;
64
68
  color: #1a93aa;
65
69
  }
70
+
71
+ .item-icon {
72
+ display: flex;
73
+ justify-items: center;
74
+ align-items: center;
75
+ font-size: 0.65rem;
76
+ padding: 0.2rem;
77
+ margin-right: 1rem;
78
+ }
79
+
66
80
  .product-badge {
67
81
  background-color: #e9f5ea;
68
82
  color: #269b36;
@@ -75,10 +89,12 @@
75
89
 
76
90
  .product-set-mobile-modal {
77
91
  margin: 0;
92
+
78
93
  .modal-content {
79
94
  border-radius: 1rem 1rem 0 0;
80
95
  border-width: 0;
81
96
  margin: 0;
97
+
82
98
  .modal-body {
83
99
  padding: 1rem 0;
84
100
  }
@@ -100,18 +116,22 @@
100
116
  font-weight: 600;
101
117
  font-size: 0.625rem;
102
118
  }
119
+
103
120
  .product-set-subtitle-dot {
104
121
  margin-right: 0.375rem;
105
122
  width: 0.375rem;
106
123
  height: 0.375rem;
107
124
  border-radius: 3px;
108
125
  }
126
+
109
127
  .product-set-subtitle-category-dot {
110
128
  background-color: #269b36;
111
129
  }
130
+
112
131
  .product-set-subtitle-step-dot {
113
132
  background-color: #1a93aa;
114
133
  }
134
+
115
135
  .product-set-subtitle-product-dot {
116
136
  background-color: #269b36;
117
137
  }
@@ -156,6 +176,7 @@
156
176
  justify-self: flex-end;
157
177
  align-items: flex-end;
158
178
  }
179
+
159
180
  .small-badge {
160
181
  font-size: 0.5rem;
161
182
  height: 1rem;
@@ -163,6 +184,7 @@
163
184
  padding: 0 0.2rem;
164
185
  margin-bottom: 0.2rem;
165
186
  }
187
+
166
188
  .product-set-save-btn-wrapper {
167
189
  padding-left: 0 !important;
168
190
  display: flex;
@@ -5,7 +5,7 @@
5
5
  flex-wrap: wrap;
6
6
 
7
7
  .result-card {
8
- height: 14.25rem;
8
+ height: 14rem;
9
9
  border: 1px solid $gray-400;
10
10
  max-width: calc(50% - 0.75rem);
11
11
  flex: 0 0 calc(50% - 0.75rem);
@@ -0,0 +1 @@
1
+ export const EMOJI_URL = "https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.7/assets/svg/";
@@ -1,10 +1,13 @@
1
1
  import { parse } from 'twemoji-parser'
2
+ import { EMOJI_URL } from './constants'
2
3
 
3
4
  function parseTwemoji(emoji: string) {
4
5
  const [twemoji] = parse(emoji)
5
6
 
7
+ const emojiPathUrl = EMOJI_URL.concat(twemoji.url.split("/").slice(-1));
8
+
6
9
  return {
7
- src: twemoji.url,
10
+ src: emojiPathUrl,
8
11
  alt: twemoji.text,
9
12
  class: 'emoji',
10
13
  draggable: 'false',
@@ -12,10 +12,13 @@ export interface TypeaheadProps {
12
12
  placeholder: string
13
13
  isRequired?: boolean
14
14
  name: string
15
+ value?: TypeaheadOptions
15
16
  isMultipleChoise?: boolean
16
17
  noOptionsMessage: string
17
18
  isInvalid?: boolean
18
19
  isCouponForm?: boolean
20
+ containerStyles?: CSSObjectWithLabel
21
+ onChangeValue?: (value: TypeaheadOptions) => void
19
22
  }
20
23
 
21
24
  function Typeahead({
@@ -24,6 +27,9 @@ function Typeahead({
24
27
  isRequired = false,
25
28
  isMultipleChoise,
26
29
  name = '',
30
+ value,
31
+ onChangeValue,
32
+ containerStyles,
27
33
  isCouponForm = false,
28
34
  noOptionsMessage = '',
29
35
  isInvalid,
@@ -53,15 +59,23 @@ function Typeahead({
53
59
  render={({ field }) => (
54
60
  <Select
55
61
  placeholder={placeholder}
56
- value={field.value}
62
+ value={value ?? field.value}
57
63
  isMulti={isMultipleChoise}
58
64
  styles={{
65
+ container: (base) => ({
66
+ ...base,
67
+ ...containerStyles,
68
+ }),
59
69
  control: (base) => ({
60
70
  ...base,
61
71
  ...getStyle(),
62
72
  }),
63
73
  }}
64
74
  onChange={(value) => {
75
+ if (onChangeValue) {
76
+ onChangeValue(value)
77
+ return
78
+ }
65
79
  field.onChange(value)
66
80
  }}
67
81
  options={options}