@licklist/design 0.78.5-dev.1 → 0.78.5-dev.13

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 (74) hide show
  1. package/dist/CustomDatePicker/CustomDatePicker.d.ts +10 -0
  2. package/dist/CustomDatePicker/CustomDatePicker.d.ts.map +1 -0
  3. package/dist/auth/Layout/UserNavDropDownToggle.js +3 -0
  4. package/dist/custom-fields/field-set/providers/CustomFieldSetsProvider.d.ts +2 -2
  5. package/dist/custom-fields/field-set/providers/CustomFieldSetsProvider.d.ts.map +1 -1
  6. package/dist/events/edit-recurrent-event-modal/EditRecurrentEventModal.d.ts.map +1 -1
  7. package/dist/events/event-statistic-modal/EventStatisticModal.d.ts.map +1 -1
  8. package/dist/events/event-venue-map/components/Dropdown/components/DropdownWrapper/DropdownWrapper.d.ts +2 -2
  9. package/dist/events/event-venue-map/components/Dropdown/components/DropdownWrapper/DropdownWrapper.d.ts.map +1 -1
  10. package/dist/file-upload/FileUpload.d.ts +1 -1
  11. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.d.ts +1 -2
  12. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.d.ts.map +1 -1
  13. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.js +2 -2
  14. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.d.ts.map +1 -1
  15. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.js +2 -2
  16. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.d.ts.map +1 -1
  17. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.d.ts.map +1 -1
  18. package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts.map +1 -1
  19. package/dist/iframe/order-process/components/PaymentCard/PaymentCard.d.ts +2 -2
  20. package/dist/iframe/order-process/components/PaymentCard/PaymentCard.d.ts.map +1 -1
  21. package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts +0 -5
  22. package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts.map +1 -1
  23. package/dist/iframe/payment/order-items-table/hooks/useTableData.js +81 -80
  24. package/dist/iframe/payment/payment-page/PaymentPage.d.ts +1 -1
  25. package/dist/iframe/payment/payment-page/PaymentPage.d.ts.map +1 -1
  26. package/dist/iframe/ryft/utils/ryft-form.d.ts +1 -1
  27. package/dist/iframe/ryft/utils/ryft-form.d.ts.map +1 -1
  28. package/dist/modals/dialog/Dialog.d.ts.map +1 -1
  29. package/dist/modals/dialog/Dialog.js +39 -41
  30. package/dist/modals/dialog/DialogContext.d.ts +2 -2
  31. package/dist/modals/dialog/DialogContext.d.ts.map +1 -1
  32. package/dist/notification/email-template/card/EmailTemplateCard.d.ts.map +1 -1
  33. package/dist/notification/email-template/control/EmailTemplateControl.d.ts +1 -0
  34. package/dist/notification/email-template/control/EmailTemplateControl.d.ts.map +1 -1
  35. package/dist/notification/email-template/control/EmailTemplateControl.js +4 -4
  36. package/dist/notification/email-template/form/EmailTemplateForm.d.ts +2 -1
  37. package/dist/notification/email-template/form/EmailTemplateForm.d.ts.map +1 -1
  38. package/dist/notification/email-template/form/EmailTemplateForm.js +2 -1
  39. package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
  40. package/dist/product-set/product/advanced-options/AdvancedOptions.js +1 -1
  41. package/dist/product-set/utils/index.d.ts +1 -1
  42. package/dist/product-set/utils/index.d.ts.map +1 -1
  43. package/dist/recurrence-input/RecurrenceInput.d.ts.map +1 -1
  44. package/dist/recurrence-input/RecurrenceInput.js +1 -1
  45. package/dist/setting/dashboard/payments/payments-modal/PaymentsModal.d.ts.map +1 -1
  46. package/dist/snippet/snippet-template/preview/Preview.d.ts.map +1 -1
  47. package/dist/snippet/snippet-template/preview/Preview.js +14 -20
  48. package/package.json +20 -18
  49. package/src/CustomDatePicker/CustomDatePicker.tsx +252 -0
  50. package/src/auth/Layout/UserNavDropDownToggle.tsx +1 -1
  51. package/src/custom-fields/field-set/providers/CustomFieldSetsProvider.tsx +2 -2
  52. package/src/events/edit-recurrent-event-modal/EditRecurrentEventModal.tsx +1 -0
  53. package/src/events/event-statistic-modal/EventStatisticModal.tsx +1 -0
  54. package/src/events/event-venue-map/components/Dropdown/components/DropdownWrapper/DropdownWrapper.tsx +2 -2
  55. package/src/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.tsx +13 -8
  56. package/src/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.tsx +12 -4
  57. package/src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.tsx +10 -6
  58. package/src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.tsx +18 -20
  59. package/src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx +3 -5
  60. package/src/iframe/order-process/components/PaymentCard/PaymentCard.tsx +3 -3
  61. package/src/iframe/payment/order-items-table/hooks/useTableData.tsx +103 -109
  62. package/src/iframe/payment/payment-page/PaymentPage.tsx +1 -1
  63. package/src/iframe/ryft/utils/ryft-form.ts +1 -1
  64. package/src/modals/dialog/Dialog.tsx +35 -36
  65. package/src/modals/dialog/DialogContext.tsx +8 -2
  66. package/src/notification/email-template/card/EmailTemplateCard.tsx +0 -2
  67. package/src/notification/email-template/control/EmailTemplateControl.tsx +7 -5
  68. package/src/notification/email-template/form/EmailTemplateForm.tsx +3 -0
  69. package/src/product-set/form/ProductSetForm.tsx +2 -1
  70. package/src/product-set/utils/index.ts +15 -14
  71. package/src/recurrence-input/RecurrenceInput.tsx +4 -3
  72. package/src/setting/dashboard/payments/payments-modal/PaymentsModal.tsx +1 -0
  73. package/src/snippet/snippet-template/preview/Preview.tsx +6 -9
  74. package/yarn.lock +694 -724
@@ -5,13 +5,15 @@ import { isEmpty, uniqBy } from 'lodash'
5
5
  import { useTranslation } from 'react-i18next'
6
6
  import { useIntl } from 'react-intl'
7
7
  import { Currency } from '@licklist/core/dist/Config'
8
- import { MenuStep } from '@licklist/plugins/dist/types/context/sale/menuSteps'
8
+ import {
9
+ MenuStep,
10
+ Product,
11
+ } from '@licklist/plugins/dist/types/context/sale/menuSteps'
9
12
  import { OrderModifierByProduct } from '@licklist/core/dist/DataMapper/Order/OrderModifiierByProduct'
10
- import { Product } from '@licklist/plugins/dist/types/context/sale/menuSteps'
11
13
  import { OrderModifier } from '@licklist/core/dist/DataMapper/Order/OrderModifierDataMapper'
12
- import { NumberInputHorizontal } from 'src/sales'
13
14
  import clsx from 'clsx'
14
15
  import { ProductCategory } from 'dist/product-set/types'
16
+ import { NumberInputHorizontal } from '../../../sales'
15
17
  import { MAX_PRODUCT_NUMBER } from '../../order-process/components/CategoryProduct/constants'
16
18
  import { FormOrderItem } from '../../order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput'
17
19
  import { getOrderProductModifiersPrice } from '../../order-process/components/BookingSummary/utils'
@@ -63,20 +65,23 @@ export const ProductWithModifierSetForm = ({
63
65
  const defaultProductQuantity = editOrderModifier?.productQuantity ?? 0
64
66
 
65
67
  const valuesOrder = watch()
66
- const productQuantity = valuesOrder?.product?.quantity ?? defaultProductQuantity
68
+ const productQuantity =
69
+ valuesOrder?.product?.quantity ?? defaultProductQuantity
67
70
 
68
71
  const orderModifiersSets =
69
72
  valuesOrder[`${product.id}`]?.orderProductModifiers || []
70
73
 
71
74
  const filteredOrderModifiers = filteredOrderModifierSets(orderModifiersSets)
72
75
 
73
- const orderModifierSets: OrderModifierByProduct[] = useMemo(() => [
76
+ const orderModifierSets: OrderModifierByProduct[] = useMemo(
77
+ () => [
74
78
  {
75
79
  productQuantity: productQuantity ?? 1,
76
80
  modifiers: filteredOrderModifiers,
77
81
  },
78
- ]
79
- , [filteredOrderModifiers, productQuantity])
82
+ ],
83
+ [filteredOrderModifiers, productQuantity],
84
+ )
80
85
 
81
86
  const onSubmit = (event) => {
82
87
  event.preventDefault()
@@ -180,7 +185,7 @@ export const ProductWithModifierSetForm = ({
180
185
  isLoading={isSubmitting}
181
186
  />
182
187
  </div>
183
- <div className=' d-flex flex-column align-items-center justify-content-center'>
188
+ <div className='d-flex flex-column align-items-center justify-content-center'>
184
189
  <div className='modifier-price pb-4 pl-5'>
185
190
  {formatToCurrency(product.price)}
186
191
  </div>
@@ -1,10 +1,10 @@
1
- import { useDialogContext, DialogContextProvider } from 'src/modals'
2
1
  import { Modal } from 'react-bootstrap'
3
2
  import { OrderModifierByProduct } from '@licklist/core/dist/DataMapper/Order/OrderModifiierByProduct'
4
3
  import { Product } from '@licklist/plugins/dist/types/context/sale/menuSteps'
5
- import { TicketDescription } from 'src/iframe/event'
6
4
  import clsx from 'clsx'
7
5
  import { ProductCategory } from 'dist/product-set/types'
6
+ import { useDialogContext, DialogContextProvider } from '../../../modals'
7
+ import { TicketDescription } from '../../event'
8
8
  import { FormOrderItem } from '../../order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput'
9
9
  import { useOnWindowUnmount } from '../../order-process/components/utils/useOnWindowUnmount'
10
10
  import { ProductWithModifierSetForm } from './ProductWithModifierSetForm'
@@ -48,12 +48,20 @@ export const ProductWithModifierSetModal = ({
48
48
  </button>
49
49
  </div>
50
50
  <div className='right-block' id='select-event-container'>
51
- <div className={clsx('manual-booking-container', !product.images.length && 'tw-mt-8')}>
51
+ <div
52
+ className={clsx(
53
+ 'manual-booking-container',
54
+ !product.images.length && 'tw-mt-8',
55
+ )}
56
+ >
52
57
  <div className='manual-booking-header'>
53
58
  <TicketDescription
54
59
  title={product.name}
55
60
  description={product.description}
56
- className={clsx('iframe-event__product-description', !product.images.length && 'mt-6')}
61
+ className={clsx(
62
+ 'iframe-event__product-description',
63
+ !product.images.length && 'mt-6',
64
+ )}
57
65
  classNameProductModal='d-block'
58
66
  images={product.images}
59
67
  isRequired={product.isRequired}
@@ -10,8 +10,8 @@ import { xor } from 'lodash'
10
10
  import clsx from 'clsx'
11
11
  import { Currency } from '@licklist/core/dist/Config'
12
12
  import { useIntl } from 'react-intl'
13
- import { MAX_PRODUCT_NUMBER } from 'src/iframe/order-process/components/CategoryProduct/constants'
14
- import { NumberInputHorizontal } from 'src/sales'
13
+ import { MAX_PRODUCT_NUMBER } from '../../../order-process/components/CategoryProduct/constants'
14
+ import { NumberInputHorizontal } from '../../../../sales'
15
15
  import { selectModifierType } from '../../utils'
16
16
 
17
17
  interface ModifiersSetControllProps {
@@ -125,9 +125,11 @@ export const ModifiersSetControl = ({
125
125
  )
126
126
  }, [isEditMode])
127
127
 
128
- const radioButtonDefaultModifier = currentOrderModifiersSets.find((modifier) =>
129
- modifierSet.modifiers.some((rl) => rl.id === modifier.modifierId)
130
- )?.modifierId.toString();
128
+ const radioButtonDefaultModifier = currentOrderModifiersSets
129
+ .find((modifier) =>
130
+ modifierSet.modifiers.some((rl) => rl.id === modifier.modifierId),
131
+ )
132
+ ?.modifierId.toString()
131
133
 
132
134
  return (
133
135
  <>
@@ -167,7 +169,9 @@ export const ModifiersSetControl = ({
167
169
  inline
168
170
  id={modifier.id.toString()}
169
171
  defaultChecked={!!selectedOrderModifierId}
170
- defaultValue={selectedOrderModifierId || modifier.id.toString()}
172
+ defaultValue={
173
+ selectedOrderModifierId || modifier.id.toString()
174
+ }
171
175
  checked={field.value === modifier.id.toString()}
172
176
  onChange={onChange}
173
177
  type='radio'
@@ -2,7 +2,7 @@ import { useEffect } from 'react'
2
2
  import { useFormContext, Controller } from 'react-hook-form'
3
3
  import { OrderModifierByProduct } from '@licklist/core/dist/DataMapper/Order/OrderModifiierByProduct'
4
4
  import { Product } from '@licklist/plugins/dist/types/context/sale/menuSteps'
5
- import { useTranslation } from 'react-i18next' // Added translation hook
5
+ import { useTranslation } from 'react-i18next'
6
6
  import { ModifiersSetControl } from './ModifierSetControll'
7
7
  import { orderProductModifiersQuantity } from '../../utils'
8
8
 
@@ -69,25 +69,23 @@ export const ProductControl = ({
69
69
  return true
70
70
  },
71
71
  }}
72
- render={({ fieldState: { error } }) => {
73
- return(
74
- <>
75
- <ModifiersSetControl
76
- modifierSet={modifierSet}
77
- productId={product.id}
78
- modifiers={modifierSet.modifiers}
79
- isEditMode={!!editOrderModifier?.modifiers}
80
- orderProductModifierSets={editOrderModifier?.modifiers}
81
- isLoading={isLoading}
82
- />
83
- {error?.message && (
84
- <div className='invalid-feedback d-flex pl-4'>
85
- {error?.message}!
86
- </div>
87
- )}
88
- </>,
89
- )
90
- }}
72
+ render={({ fieldState: { error } }) => (
73
+ <>
74
+ <ModifiersSetControl
75
+ modifierSet={modifierSet}
76
+ productId={product.id}
77
+ modifiers={modifierSet.modifiers}
78
+ isEditMode={!!editOrderModifier?.modifiers}
79
+ orderProductModifierSets={editOrderModifier?.modifiers}
80
+ isLoading={isLoading}
81
+ />
82
+ {error?.message && (
83
+ <div className='invalid-feedback d-flex pl-4'>
84
+ {error?.message}!
85
+ </div>
86
+ )}
87
+ </>
88
+ )}
91
89
  />
92
90
  </div>
93
91
  )
@@ -10,10 +10,8 @@ import {
10
10
  Product,
11
11
  ProductCategory,
12
12
  } from '@licklist/plugins/dist/types/context/sale/menuSteps'
13
- import { Button } from 'react-bootstrap'
14
- import { FaTrashAlt } from 'react-icons/fa'
15
- import { ProductWithModifierSetModal } from 'src/iframe/ProductWithModifierModal'
16
13
  import { OrderModifierByProduct } from '@licklist/core/dist/DataMapper/Order/OrderModifiierByProduct'
14
+ import { ProductWithModifierSetModal } from '../../../ProductWithModifierModal'
17
15
  import { TicketDescription } from '../../../event/ticket-description'
18
16
  import { ProductQuantityInput } from './components/ProductQuantityInput'
19
17
  import { FormOrderItem } from './components/ProductQuantityInput/ProductQuantityInput'
@@ -160,8 +158,8 @@ export const CategoryProduct = ({
160
158
  ).orderModifiersSets
161
159
  ?.filter((_, index) => index !== modifierIndex)
162
160
  .concat(value.orderModifiersSets)
163
-
164
- onChange({
161
+
162
+ onChange({
165
163
  ...value,
166
164
  orderModifiersSets: editedOrderModifiersSets,
167
165
  quantity: editedOrderModifiersSets.reduce(
@@ -1,4 +1,4 @@
1
- import { FC, ReactNode } from 'react'
1
+ import { PropsWithChildren, ReactNode } from 'react'
2
2
  import { useTranslation } from 'react-i18next'
3
3
  import { useIntl } from 'react-intl'
4
4
  import * as Config from '@licklist/core/dist/Config'
@@ -15,14 +15,14 @@ export type PaymentCardProps = {
15
15
  isFreePayment?: boolean
16
16
  }
17
17
 
18
- export const PaymentCard: FC<PaymentCardProps> = ({
18
+ export const PaymentCard = ({
19
19
  order,
20
20
  totalWithDiscount,
21
21
  recalculatedFee,
22
22
  discountBlock,
23
23
  paymentDetail,
24
24
  isFreePayment,
25
- }) => {
25
+ }: PropsWithChildren<PaymentCardProps>) => {
26
26
  const { t } = useTranslation(['Design'])
27
27
  const { formatNumber } = useIntl()
28
28
 
@@ -1,24 +1,22 @@
1
1
  import { useMemo } from 'react'
2
- import { uniqueId, flatMap, flatten, map } from 'lodash'
2
+ import { uniqueId, flatMap, flatten } from 'lodash'
3
3
  import { useIntl } from 'react-intl'
4
4
  import { useTranslation } from 'react-i18next'
5
5
  import { Product } from '@licklist/core/dist/DataMapper/Product/ProductDataMapper'
6
6
  import { OrderModifier } from '@licklist/core/dist/DataMapper/Order/OrderModifierDataMapper'
7
+ import { OrderProduct } from '@licklist/core/dist/DataMapper/Order/OrderProductDataMapper'
7
8
  import {
8
9
  PAYMENT_TYPE_VAT,
9
10
  PAYMENT_TYPE_FEE,
10
11
  PAYMENT_TYPE_NET_PROFIT,
11
12
  } from '@licklist/core/dist/DataMapper/Order/PaymentDataMapper'
12
13
  import { StaticTableData } from '../../../../table'
13
- import { getProductQuantityAndPrice, getTotalSumByCategory } from '../utils'
14
+ import { getTotalSumByCategory } from '../utils'
14
15
  import { OrderItemsTableProps, SummaryItem } from '../types'
15
16
  import { getOrderSummaryItems } from '../utils/paymentSummary'
16
- import { Order } from '@licklist/core/dist/DataMapper'
17
- import { OrderPayment } from '@licklist/core/dist/DataMapper/Order/OrderPaymentDataMapper'
18
- import { OrderProduct } from '@licklist/core/dist/DataMapper/Order/OrderProductDataMapper'
19
- import { OrderModifierByProduct } from '@licklist/core/dist/DataMapper/Order/OrderModifiierByProduct'
20
17
 
21
18
  const CURRENCY_DEFAULT = 'GBP'
19
+
22
20
  export const PAYMENT_TYPE_TRANSLATE_KEYS = {
23
21
  [PAYMENT_TYPE_NET_PROFIT]: 'netAmount',
24
22
  [PAYMENT_TYPE_FEE]: 'bookeditFee',
@@ -41,43 +39,62 @@ export const useTableData = ({
41
39
  })
42
40
 
43
41
  const wrapLabelContent = (string: string) => (
44
- <div className='label'>{string}</div>
42
+ <div className="label">{string}</div>
45
43
  )
46
44
 
47
45
  const renderCategoryItem = (products: Product[]) => ({
48
46
  key: uniqueId('category-id-'),
49
- name: wrapLabelContent(products[0].productCategory?.name ?? ''),
47
+ name: wrapLabelContent(products[0]?.productCategory?.name ?? ''),
50
48
  quantity: '',
51
49
  price: wrapLabelContent(
52
50
  `${t('total')}: ${formatPrice(
53
- getTotalSumByCategory(order.orderProducts, products),
51
+ getTotalSumByCategory(order.orderProducts ?? [], products),
54
52
  )}`,
55
53
  ),
56
54
  })
57
55
 
58
- const reworkProductStructure = (order: OrderProduct) =>
59
- order
60
- ? flatMap(order, (item) => {
61
- if (!item || !Array.isArray(item)) return []
62
- return item.map((modGroup, idx) => ({
63
- deletedAt: order.deletedAt ?? null,
64
- id: `${order.id}-${idx + 1}`, // Ensuring uniqueness with string concatenation
65
- orderId: order.orderId ?? null,
66
- price: order.price ?? 0,
67
- productId: order.productId ?? '',
68
- quantity: modGroup.productQuantity ?? 1,
69
- deposit: order.deposit ?? 0,
70
- orderProductModifiers: modGroup.modifiers.map((mod) => ({
71
- modifierId: mod.modifierId ?? '',
72
- price: mod.price ?? 0,
73
- productId: mod.productId ?? '',
74
- quantity: mod.quantity ?? 1,
75
- modifierSetId: mod.modifierSetId ?? '',
76
- modifier: mod.modifier ?? null,
77
- })),
78
- }))
79
- })
80
- : []
56
+ const reworkProductStructure = (order: OrderProduct) => {
57
+ if (!order) return []
58
+
59
+ const groups: any[] = (order as any)?.orderProductModifiersGroups ?? []
60
+ if (!Array.isArray(groups) || !groups.length) return [order]
61
+
62
+ return groups.flatMap((modGroup, idx) => ({
63
+ deletedAt: order.deletedAt ?? null,
64
+ id: `${order.id}-${idx + 1}`,
65
+ orderId: order.orderId ?? null,
66
+ price: order.price ?? 0,
67
+ productId: order.productId ?? '',
68
+ quantity: modGroup?.productQuantity ?? 1,
69
+ deposit: order.deposit ?? 0,
70
+ orderProductModifiers:
71
+ (modGroup?.modifiers ?? []).map((mod: any) => ({
72
+ modifierId: mod?.modifierId ?? '',
73
+ price: mod?.price ?? 0,
74
+ productId: mod?.productId ?? '',
75
+ quantity: mod?.quantity ?? 1,
76
+ modifierSetId: mod?.modifierSetId ?? '',
77
+ modifier: mod?.modifier ?? null,
78
+ })) ?? [],
79
+ }))
80
+ }
81
+
82
+ const renderModifierItem = (orderModifier: OrderModifier) => {
83
+ if (!orderModifier || orderModifier.quantity === 0) return null
84
+ const { quantity, modifier, modifierId, price } = orderModifier
85
+
86
+ return {
87
+ key: modifierId,
88
+ name: ` - ${modifier?.name || ''}`,
89
+ quantity: (
90
+ <div className="quantity">
91
+ <div className="multiplier">x</div>
92
+ {quantity}
93
+ </div>
94
+ ),
95
+ price: formatPrice(price ?? 0),
96
+ }
97
+ }
81
98
 
82
99
  const renderProductItem = ({
83
100
  product,
@@ -86,43 +103,26 @@ export const useTableData = ({
86
103
  product: OrderProduct
87
104
  productsForCategory: Product[]
88
105
  }) => {
89
- if (product.quantity === 0) {
90
- return null
91
- }
92
-
106
+ if (!product || product.quantity === 0) return null
107
+
93
108
  const name =
94
- productsForCategory.find((item) => item.id === product.productId)?.name || ''
109
+ productsForCategory.find((item) => item.id === product.productId)?.name ||
110
+ ''
95
111
 
96
112
  return {
97
113
  key: product.id,
98
114
  name,
99
115
  quantity: (
100
- <div className='quantity'>
101
- <div className='multiplier'>x</div>
116
+ <div className="quantity">
117
+ <div className="multiplier">x</div>
102
118
  {product.quantity}
103
119
  </div>
104
120
  ),
105
- price: formatPrice(product.price),
106
- modifier: product?.orderProductModifiers?.map(renderModifierItem) || [],
107
- }
108
- }
109
-
110
- const renderModifierItem = (orderModifier: OrderModifier) => {
111
- const { quantity, modifier, modifierId, price } = orderModifier
112
- if (quantity === 0) {
113
- return null
114
- }
115
-
116
- return {
117
- key: modifierId,
118
- name: ` - ${modifier?.name || ''}`,
119
- quantity: (
120
- <div className='quantity'>
121
- <div className='multiplier'>x</div>
122
- {quantity}
123
- </div>
124
- ),
125
- price: formatPrice(price),
121
+ price: formatPrice(product.price ?? 0),
122
+ modifier:
123
+ (product?.orderProductModifiers?.map(renderModifierItem) ?? []).filter(
124
+ Boolean,
125
+ ),
126
126
  }
127
127
  }
128
128
 
@@ -132,41 +132,40 @@ export const useTableData = ({
132
132
  ]
133
133
 
134
134
  return productCategories.reduce(
135
- (previousValues: StaticTableData[], categoryId) => {
136
- const productsForCategory = order?.products.filter(
137
- (product) => product.productCategoryId === categoryId,
138
- )
139
-
140
- const products = order.orderProducts.filter((el) =>
141
- productsForCategory
142
- .map((product) => product.id)
143
- .includes(el.productId),
144
- )
145
-
146
- if (!products.length) {
147
- return previousValues
148
- }
135
+ (acc: StaticTableData[], categoryId) => {
136
+ const productsForCategory =
137
+ order?.products.filter((p) => p.productCategoryId === categoryId) ?? []
138
+
139
+ const products =
140
+ order?.orderProducts?.filter((el) =>
141
+ productsForCategory.map((p) => p.id).includes(el.productId),
142
+ ) ?? []
143
+
144
+ if (!products.length) return acc
145
+
149
146
  const productsWithReworkedModifier = products.map((product) => {
150
- if (!product.orderProductModifiers.length) return product
147
+ if (!product?.orderProductModifiers?.length) return product
151
148
  return reworkProductStructure(product)
152
149
  })
153
150
 
154
- const filteredProducts = flatten(productsWithReworkedModifier).map(
155
- (product) =>
156
- renderProductItem({ product , productsForCategory }),
157
- )
158
-
159
- const productWithModifier = flatMap(filteredProducts, (item) => [
160
- item,
161
- ...item.modifier,
162
- ])
151
+ const filteredProducts = flatten(productsWithReworkedModifier)
152
+ .map((p) =>
153
+ renderProductItem({
154
+ product: p as OrderProduct,
155
+ productsForCategory,
156
+ }),
157
+ )
158
+ .filter((row): row is NonNullable<typeof row> => Boolean(row))
159
+
160
+ if (!filteredProducts.length) return acc
163
161
 
164
- if (!filteredProducts.length) {
165
- return previousValues
166
- }
162
+ const productWithModifier = flatMap(filteredProducts, (row) => [
163
+ row,
164
+ ...(row.modifier ?? []),
165
+ ])
167
166
 
168
167
  return [
169
- ...previousValues,
168
+ ...acc,
170
169
  renderCategoryItem(productsForCategory),
171
170
  ...productWithModifier,
172
171
  ]
@@ -183,26 +182,21 @@ export const useTableData = ({
183
182
  price: wrapLabelContent(formatPrice(price)),
184
183
  }))
185
184
 
186
- const data = useMemo(
187
- () => {
188
- if (!order) {
189
- return []
190
- }
191
-
192
- return [
193
- ...renderProductsContent(),
194
- ...renderSummaryItems(
195
- getOrderSummaryItems({
196
- order,
197
- paymentDetail,
198
- isPaymentProcessed,
199
- externalDiscount,
200
- }),
201
- ),
202
- ]
203
- },
204
- // eslint-disable-next-line react-hooks/exhaustive-deps
205
- [order, externalDiscount, isPaymentProcessed],
206
- )
185
+ const data = useMemo(() => {
186
+ if (!order) return []
187
+
188
+ return [
189
+ ...renderProductsContent(),
190
+ ...renderSummaryItems(
191
+ getOrderSummaryItems({
192
+ order,
193
+ paymentDetail,
194
+ isPaymentProcessed,
195
+ externalDiscount,
196
+ }),
197
+ ),
198
+ ]
199
+ }, [order, externalDiscount, isPaymentProcessed, paymentDetail])
200
+
207
201
  return data
208
202
  }
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next'
4
4
  import { Button, Col } from 'react-bootstrap'
5
5
  import { PaymentSessionContext } from '@licklist/plugins/dist/context/payment/PaymentSessionContext'
6
6
  import { PaymentLinkResponse } from '@licklist/plugins/dist/hooks/Api/usePaymentApi'
7
- import { BookingSummaryProps } from 'src/iframe/order-process/components/BookingSummary/types'
7
+ import { BookingSummaryProps } from '../../order-process/components/BookingSummary/types'
8
8
  // eslint-disable-next-line max-len
9
9
  import { SummaryTotalBlock } from '../../order-process/components/BookingSummary/components/SummaryTotal/components/SummaryTotalBlock'
10
10
  import { LoaderIndicator } from '../../../static'
@@ -1,4 +1,4 @@
1
- import { TFunction } from 'react-i18next'
1
+ import { TFunction } from 'i18next'
2
2
  import { RyftPaymentFormProps } from '../RyftPaymentForm'
3
3
 
4
4
  interface InjectComponentsInRyftForm
@@ -32,42 +32,41 @@ export const Dialog = ({
32
32
  }
33
33
 
34
34
  return (
35
- <>
36
- <Modal
37
- show={isActive}
38
- onHide={onDecline}
39
- animation={false}
40
- size='sm'
41
- centered
42
- className='text-center justify-content-center rounded'
43
- >
44
- <Modal.Header className='justify-content-center border-0'>
45
- {title && <Modal.Title as='h6'>{title}</Modal.Title>}
46
- </Modal.Header>
47
- {content && (
48
- <Modal.Body className='justify-content-center'>{content}</Modal.Body>
35
+ <Modal
36
+ show={isActive}
37
+ onHide={onDecline}
38
+ animation={false}
39
+ size='sm'
40
+ centered
41
+ className='text-center justify-content-center rounded'
42
+ >
43
+ {/* @ts-ignore */}
44
+ <Modal.Header className='justify-content-center border-0'>
45
+ {title && <Modal.Title as='h6'>{title}</Modal.Title>}
46
+ </Modal.Header>
47
+ {content && (
48
+ <Modal.Body className='justify-content-center'>{content}</Modal.Body>
49
+ )}
50
+ <Modal.Footer className='border-0 justify-content-center'>
51
+ {customButtons || (
52
+ <>
53
+ <Button
54
+ variant='secondary'
55
+ className='modal-buttons'
56
+ onClick={declineHandler}
57
+ >
58
+ {t('cancel')}
59
+ </Button>
60
+ <Button
61
+ variant='primary'
62
+ className='modal-buttons'
63
+ onClick={approveHandler}
64
+ >
65
+ {t('Design:confirm')}
66
+ </Button>
67
+ </>
49
68
  )}
50
- <Modal.Footer className='border-0 justify-content-center'>
51
- {customButtons || (
52
- <>
53
- <Button
54
- variant='secondary'
55
- className='modal-buttons'
56
- onClick={declineHandler}
57
- >
58
- {t('cancel')}
59
- </Button>
60
- <Button
61
- variant='primary'
62
- className='modal-buttons'
63
- onClick={approveHandler}
64
- >
65
- {t('Design:confirm')}
66
- </Button>
67
- </>
68
- )}
69
- </Modal.Footer>
70
- </Modal>
71
- </>
69
+ </Modal.Footer>
70
+ </Modal>
72
71
  )
73
72
  }
@@ -1,4 +1,10 @@
1
- import { createContext, useContext, FC, useState, useCallback } from 'react'
1
+ import {
2
+ createContext,
3
+ useContext,
4
+ useState,
5
+ useCallback,
6
+ PropsWithChildren,
7
+ } from 'react'
2
8
 
3
9
  interface IDialogContext {
4
10
  isShownDialog: boolean
@@ -20,7 +26,7 @@ export const DialogContext = createContext<IDialogContext>({
20
26
  onApproveDialog: () => undefined,
21
27
  })
22
28
 
23
- export const DialogContextProvider: FC = ({ children }) => {
29
+ export const DialogContextProvider = ({ children }: PropsWithChildren) => {
24
30
  const [isShownDialog, setShownDialog] = useState(false)
25
31
 
26
32
  const showDialog = () => {
@@ -35,8 +35,6 @@ export function EmailTemplateCard({
35
35
  return (
36
36
  <div className='snippet-template-card'>
37
37
  <div className='snippet-template-card-header'>
38
- {/* TODO fix issue react router types
39
- @ts-expect-error */}
40
38
  <Link to={href}>{name}</Link>
41
39
  {hasPermission && Boolean(onRemove) && (
42
40
  <ConfirmModal