@licklist/design 0.78.5-dev.19 → 0.78.5-dev.2

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 (155) hide show
  1. package/dist/auth/Layout/UserNavDropDownToggle.js +0 -3
  2. package/dist/auth/Login/LoginComponent.js +2 -1
  3. package/dist/events/edit-event-modal/IntervalInput.d.ts.map +1 -1
  4. package/dist/events/edit-event-modal/IntervalInput.js +5 -1
  5. package/dist/events/edit-event-modal/component/SaleDeadline/SaleDeadline.d.ts +2 -1
  6. package/dist/events/edit-event-modal/component/SaleDeadline/SaleDeadline.d.ts.map +1 -1
  7. package/dist/events/edit-event-modal/component/SaleDeadline/SaleDeadline.js +3 -2
  8. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +2 -1
  9. package/dist/events/edit-event-modal/utils/getDefaultProductSet.d.ts.map +1 -1
  10. package/dist/events/edit-event-modal/utils/getDefaultProductSet.js +0 -1
  11. package/dist/events/edit-recurrent-event-modal/EditRecurrentEventModal.d.ts.map +1 -1
  12. package/dist/events/event-card/EventCard.d.ts +1 -1
  13. package/dist/events/event-card/EventCard.d.ts.map +1 -1
  14. package/dist/events/event-card/EventCard.js +1 -1
  15. package/dist/events/event-statistic-modal/EventStatisticModal.d.ts +2 -1
  16. package/dist/events/event-statistic-modal/EventStatisticModal.d.ts.map +1 -1
  17. package/dist/events/event-statistic-modal/EventStatisticModal.js +2 -2
  18. package/dist/events/event-statistic-modal/hooks/useTableData.d.ts +1 -1
  19. package/dist/events/event-statistic-modal/hooks/useTableData.d.ts.map +1 -1
  20. package/dist/events/event-statistic-modal/hooks/useTableData.js +2 -1
  21. package/dist/events/event-statistic-modal/utils/index.js +3 -3
  22. package/dist/events/event-venue-map/EventVenueMap.d.ts.map +1 -1
  23. package/dist/events/event-venue-map/EventVenueMap.js +1 -0
  24. package/dist/events/event-venue-map/hooks/useCanvasSize.d.ts.map +1 -1
  25. package/dist/events/event-venue-map/hooks/useCanvasSize.js +11 -4
  26. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.d.ts.map +1 -1
  27. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.js +4 -11
  28. package/dist/iframe/order-process/components/BookingSummary/utils/index.js +1 -1
  29. package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.d.ts.map +1 -1
  30. package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.js +13 -0
  31. package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts.map +1 -1
  32. package/dist/iframe/payment/order-items-table/hooks/useTableData.js +80 -81
  33. package/dist/iframe/payment/payment-page/PaymentPage.js +8 -4
  34. package/dist/iframe/ryft/RyftPaymentForm.d.ts.map +1 -1
  35. package/dist/iframe/ryft/RyftPaymentForm.js +19 -45
  36. package/dist/iframe/ryft/utils/ryft-form.d.ts.map +1 -1
  37. package/dist/iframe/ryft/utils/ryft-form.js +4 -5
  38. package/dist/modals/dialog/Dialog.d.ts.map +1 -1
  39. package/dist/modals/dialog/Dialog.js +41 -39
  40. package/dist/notification/email-template/card/EmailTemplateCard.d.ts.map +1 -1
  41. package/dist/notification/email-template/control/EmailTemplateControl.d.ts +0 -1
  42. package/dist/notification/email-template/control/EmailTemplateControl.d.ts.map +1 -1
  43. package/dist/notification/email-template/control/EmailTemplateControl.js +8 -5
  44. package/dist/notification/email-template/form/EmailTemplateForm.d.ts +1 -2
  45. package/dist/notification/email-template/form/EmailTemplateForm.d.ts.map +1 -1
  46. package/dist/notification/email-template/form/EmailTemplateForm.js +1 -2
  47. package/dist/product-set/control/ProductSetControl.js +2 -1
  48. package/dist/product-set/form/ProductSetForm.d.ts +4 -1
  49. package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
  50. package/dist/product-set/form/ProductSetForm.js +1 -1
  51. package/dist/product-set/form/ProductsControl.js +1 -0
  52. package/dist/product-set/product/advanced-options/AdvancedOptions.js +1 -1
  53. package/dist/product-set/product/booking-management/ProductBookingManagementControl.d.ts.map +1 -1
  54. package/dist/product-set/product/booking-management/ProductBookingManagementControl.js +6 -0
  55. package/dist/product-set/product/deposit/ProductDepositControl.d.ts.map +1 -1
  56. package/dist/product-set/product/deposit/ProductDepositControl.js +3 -0
  57. package/dist/product-set/product/duration/ProductDurationControl.d.ts.map +1 -1
  58. package/dist/product-set/product/duration/ProductDurationControl.js +6 -0
  59. package/dist/product-set/product/price/ProductPriceControl.d.ts.map +1 -1
  60. package/dist/product-set/product/price/ProductPriceControl.js +3 -0
  61. package/dist/product-set/product/quantity/ProductQuantityConstantControl.d.ts.map +1 -1
  62. package/dist/product-set/product/quantity/ProductQuantityConstantControl.js +6 -0
  63. package/dist/product-set/product/quantity/ProductQuantityControl.d.ts.map +1 -1
  64. package/dist/product-set/product/quantity/ProductQuantityControl.js +6 -0
  65. package/dist/product-set/product/quantity/ProductQuantityRechargingControl.d.ts.map +1 -1
  66. package/dist/product-set/product/quantity/ProductQuantityRechargingControl.js +4 -1
  67. package/dist/product-set/product-category/ProductCategoryControl.d.ts.map +1 -1
  68. package/dist/product-set/product-category/ProductCategoryControl.js +12 -0
  69. package/dist/product-set/utils/index.d.ts +1 -1
  70. package/dist/recurrence-input/RecurrenceEndInput.d.ts.map +1 -1
  71. package/dist/recurrence-input/RecurrenceEndInput.js +3 -0
  72. package/dist/recurrence-input/RecurrenceInput.d.ts.map +1 -1
  73. package/dist/recurrence-input/RecurrenceInput.js +1 -1
  74. package/dist/recurring-date-picker-input/RecurrenceEndInput.d.ts.map +1 -1
  75. package/dist/resource/form/components/CapacityControl.d.ts.map +1 -1
  76. package/dist/resource/form/components/CapacityControl.js +3 -0
  77. package/dist/resource/form/components/SortControl.d.ts.map +1 -1
  78. package/dist/resource/form/components/SortControl.js +3 -0
  79. package/dist/sales/coupon/control/CouponFormControl.d.ts.map +1 -1
  80. package/dist/sales/coupon/control/CouponFormControl.js +21 -0
  81. package/dist/setting/dashboard/DashboardSettingForm.d.ts.map +1 -1
  82. package/dist/setting/dashboard/DashboardSettingForm.js +4 -1
  83. package/dist/setting/dashboard/payments/payments-modal/PaymentsModal.d.ts.map +1 -1
  84. package/dist/snippet/snippet-template/preview/Preview.d.ts.map +1 -1
  85. package/dist/snippet/snippet-template/preview/Preview.js +20 -14
  86. package/dist/static/CurrencyNumberInput.d.ts.map +1 -1
  87. package/dist/static/CurrencyNumberInput.js +3 -0
  88. package/dist/static/form-number-input/FormNumberInput.d.ts.map +1 -1
  89. package/dist/static/form-number-input/FormNumberInput.js +3 -0
  90. package/dist/static/number-input/NumberInput.d.ts.map +1 -1
  91. package/dist/static/number-input/NumberInput.js +3 -0
  92. package/dist/styles/iframe-events/Calendar.scss +1 -1
  93. package/dist/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
  94. package/dist/styles/ryft-payment-form/RyftPaymentForm.scss +1 -3
  95. package/dist/styles/sales/BookingResults.scss +1 -1
  96. package/dist/zone/form/components/GameDurationControl.d.ts.map +1 -1
  97. package/dist/zone/form/components/GameDurationControl.js +3 -0
  98. package/dist/zone/form/components/SortControl.d.ts.map +1 -1
  99. package/dist/zone/form/components/SortControl.js +3 -0
  100. package/package.json +8 -8
  101. package/src/auth/Layout/UserNavDropDownToggle.tsx +1 -1
  102. package/src/auth/Login/LoginComponent.tsx +1 -1
  103. package/src/events/edit-event-modal/IntervalInput.tsx +4 -0
  104. package/src/events/edit-event-modal/component/SaleDeadline/SaleDeadline.tsx +12 -4
  105. package/src/events/edit-event-modal/utils/getDefaultProductSet.ts +0 -1
  106. package/src/events/edit-recurrent-event-modal/EditRecurrentEventModal.tsx +0 -1
  107. package/src/events/event-card/EventCard.tsx +10 -8
  108. package/src/events/event-statistic-modal/EventStatisticModal.tsx +3 -2
  109. package/src/events/event-statistic-modal/hooks/useTableData.tsx +2 -1
  110. package/src/events/event-statistic-modal/utils/index.ts +4 -4
  111. package/src/events/event-venue-map/EventVenueMap.tsx +1 -0
  112. package/src/events/event-venue-map/hooks/useCanvasSize.ts +5 -1
  113. package/src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.tsx +1 -5
  114. package/src/iframe/order-process/components/BookingSummary/utils/index.ts +2 -2
  115. package/src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx +9 -0
  116. package/src/iframe/payment/order-items-table/hooks/useTableData.tsx +109 -103
  117. package/src/iframe/payment/payment-page/PaymentPage.tsx +6 -6
  118. package/src/iframe/ryft/RyftPaymentForm.tsx +25 -58
  119. package/src/iframe/ryft/utils/ryft-form.ts +6 -5
  120. package/src/modals/dialog/Dialog.tsx +36 -35
  121. package/src/notification/email-template/card/EmailTemplateCard.tsx +2 -0
  122. package/src/notification/email-template/control/EmailTemplateControl.tsx +9 -10
  123. package/src/notification/email-template/form/EmailTemplateForm.tsx +0 -3
  124. package/src/product-set/control/ProductSetControl.tsx +1 -1
  125. package/src/product-set/form/ProductSetForm.tsx +6 -2
  126. package/src/product-set/product/booking-management/ProductBookingManagementControl.tsx +2 -0
  127. package/src/product-set/product/deposit/ProductDepositControl.tsx +1 -0
  128. package/src/product-set/product/duration/ProductDurationControl.tsx +2 -0
  129. package/src/product-set/product/price/ProductPriceControl.tsx +1 -0
  130. package/src/product-set/product/quantity/ProductQuantityConstantControl.tsx +2 -0
  131. package/src/product-set/product/quantity/ProductQuantityControl.tsx +2 -0
  132. package/src/product-set/product/quantity/ProductQuantityRechargingControl.tsx +1 -0
  133. package/src/product-set/product-category/ProductCategoryControl.tsx +4 -0
  134. package/src/recurrence-input/RecurrenceEndInput.tsx +1 -0
  135. package/src/recurrence-input/RecurrenceInput.tsx +3 -4
  136. package/src/recurring-date-picker-input/RecurrenceEndInput.tsx +1 -0
  137. package/src/resource/form/components/CapacityControl.tsx +1 -0
  138. package/src/resource/form/components/SortControl.tsx +1 -0
  139. package/src/sales/coupon/control/CouponFormControl.tsx +7 -0
  140. package/src/setting/dashboard/DashboardSettingForm.tsx +1 -0
  141. package/src/setting/dashboard/payments/payments-modal/PaymentsModal.tsx +0 -1
  142. package/src/snippet/snippet-template/preview/Preview.tsx +9 -6
  143. package/src/static/CurrencyNumberInput.tsx +1 -0
  144. package/src/static/form-number-input/FormNumberInput.tsx +1 -0
  145. package/src/static/number-input/NumberInput.tsx +1 -0
  146. package/src/styles/iframe-events/Calendar.scss +1 -1
  147. package/src/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
  148. package/src/styles/ryft-payment-form/RyftPaymentForm.scss +1 -3
  149. package/src/styles/sales/BookingResults.scss +1 -1
  150. package/src/zone/form/components/GameDurationControl.tsx +1 -0
  151. package/src/zone/form/components/SortControl.tsx +1 -0
  152. package/yarn.lock +575 -528
  153. package/dist/CustomDatePicker/CustomDatePicker.d.ts +0 -10
  154. package/dist/CustomDatePicker/CustomDatePicker.d.ts.map +0 -1
  155. package/src/CustomDatePicker/CustomDatePicker.tsx +0 -252
@@ -1,22 +1,24 @@
1
1
  import { useMemo } from 'react'
2
- import { uniqueId, flatMap, flatten } from 'lodash'
2
+ import { uniqueId, flatMap, flatten, map } 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'
8
7
  import {
9
8
  PAYMENT_TYPE_VAT,
10
9
  PAYMENT_TYPE_FEE,
11
10
  PAYMENT_TYPE_NET_PROFIT,
12
11
  } from '@licklist/core/dist/DataMapper/Order/PaymentDataMapper'
13
12
  import { StaticTableData } from '../../../../table'
14
- import { getTotalSumByCategory } from '../utils'
13
+ import { getProductQuantityAndPrice, getTotalSumByCategory } from '../utils'
15
14
  import { OrderItemsTableProps, SummaryItem } from '../types'
16
15
  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'
17
20
 
18
21
  const CURRENCY_DEFAULT = 'GBP'
19
-
20
22
  export const PAYMENT_TYPE_TRANSLATE_KEYS = {
21
23
  [PAYMENT_TYPE_NET_PROFIT]: 'netAmount',
22
24
  [PAYMENT_TYPE_FEE]: 'bookeditFee',
@@ -39,62 +41,43 @@ export const useTableData = ({
39
41
  })
40
42
 
41
43
  const wrapLabelContent = (string: string) => (
42
- <div className="label">{string}</div>
44
+ <div className='label'>{string}</div>
43
45
  )
44
46
 
45
47
  const renderCategoryItem = (products: Product[]) => ({
46
48
  key: uniqueId('category-id-'),
47
- name: wrapLabelContent(products[0]?.productCategory?.name ?? ''),
49
+ name: wrapLabelContent(products[0].productCategory?.name ?? ''),
48
50
  quantity: '',
49
51
  price: wrapLabelContent(
50
52
  `${t('total')}: ${formatPrice(
51
- getTotalSumByCategory(order.orderProducts ?? [], products),
53
+ getTotalSumByCategory(order.orderProducts, products),
52
54
  )}`,
53
55
  ),
54
56
  })
55
57
 
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
- }
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
+ : []
98
81
 
99
82
  const renderProductItem = ({
100
83
  product,
@@ -103,26 +86,43 @@ export const useTableData = ({
103
86
  product: OrderProduct
104
87
  productsForCategory: Product[]
105
88
  }) => {
106
- if (!product || product.quantity === 0) return null
107
-
89
+ if (product.quantity === 0) {
90
+ return null
91
+ }
92
+
108
93
  const name =
109
- productsForCategory.find((item) => item.id === product.productId)?.name ||
110
- ''
94
+ productsForCategory.find((item) => item.id === product.productId)?.name || ''
111
95
 
112
96
  return {
113
97
  key: product.id,
114
98
  name,
115
99
  quantity: (
116
- <div className="quantity">
117
- <div className="multiplier">x</div>
100
+ <div className='quantity'>
101
+ <div className='multiplier'>x</div>
118
102
  {product.quantity}
119
103
  </div>
120
104
  ),
121
- price: formatPrice(product.price ?? 0),
122
- modifier:
123
- (product?.orderProductModifiers?.map(renderModifierItem) ?? []).filter(
124
- Boolean,
125
- ),
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),
126
126
  }
127
127
  }
128
128
 
@@ -132,40 +132,41 @@ export const useTableData = ({
132
132
  ]
133
133
 
134
134
  return productCategories.reduce(
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
-
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
+ }
146
149
  const productsWithReworkedModifier = products.map((product) => {
147
- if (!product?.orderProductModifiers?.length) return product
150
+ if (!product.orderProductModifiers.length) return product
148
151
  return reworkProductStructure(product)
149
152
  })
150
153
 
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
161
-
162
- const productWithModifier = flatMap(filteredProducts, (row) => [
163
- row,
164
- ...(row.modifier ?? []),
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,
165
162
  ])
166
163
 
164
+ if (!filteredProducts.length) {
165
+ return previousValues
166
+ }
167
+
167
168
  return [
168
- ...acc,
169
+ ...previousValues,
169
170
  renderCategoryItem(productsForCategory),
170
171
  ...productWithModifier,
171
172
  ]
@@ -182,21 +183,26 @@ export const useTableData = ({
182
183
  price: wrapLabelContent(formatPrice(price)),
183
184
  }))
184
185
 
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
-
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
+ )
201
207
  return data
202
208
  }
@@ -166,12 +166,12 @@ export const PaymentPage = ({
166
166
  headerComponent={<SummaryTotalBlock amount={totalBooked} />}
167
167
  footer={
168
168
  <div className='d-flex flex-column justify-content-between'>
169
- {paymentMetadata?.total ? (
169
+ {paymentMetadata ? (
170
170
  <>
171
- {/* <SummaryTotalBlock
171
+ <SummaryTotalBlock
172
172
  label={t('total')}
173
173
  amount={paymentMetadata.total || 0}
174
- /> */}
174
+ />
175
175
  <SummaryTotalBlock
176
176
  label={t('paidSum')}
177
177
  amount={paymentMetadata.paid || 0}
@@ -185,7 +185,7 @@ export const PaymentPage = ({
185
185
  </>
186
186
  ) : (
187
187
  <>
188
- {!!isCalculatedAmountGreaterThanOrderAmount && (
188
+ {isCalculatedAmountGreaterThanOrderAmount && (
189
189
  <SummaryTotalBlock
190
190
  label={t(hasRemaingToPay ? 'payNow' : 'total')}
191
191
  amount={
@@ -195,7 +195,7 @@ export const PaymentPage = ({
195
195
  />
196
196
  )}
197
197
 
198
- {!!hasRemaingToPay && (
198
+ {hasRemaingToPay && (
199
199
  <SummaryTotalBlock
200
200
  label={t('remaining')}
201
201
  amount={
@@ -205,7 +205,7 @@ export const PaymentPage = ({
205
205
  />
206
206
  )}
207
207
 
208
- {!!isPaymentLinkWithRemainingToPay && (
208
+ {isPaymentLinkWithRemainingToPay && (
209
209
  <SummaryTotalBlock
210
210
  label={t('remaningToPay')}
211
211
  amount={Number(data?.remaining_to_pay)}
@@ -134,42 +134,32 @@ export const RyftPaymentForm = ({
134
134
  setIsBtnDisabled(false)
135
135
  }
136
136
  }
137
- console.log(
138
- formRef.current?.childNodes?.length,
139
- 'formRef.current?.childNodes?.length ',
140
- )
141
-
142
- // useEffect(() => {
143
- // const formBox = document.getElementById('form-disable-box')
144
- // const cardContainer = document.getElementById('ryft-pay-iframe')
145
-
146
- // const googleButton = document.getElementById(
147
- // 'gpay-button-online-api-id',
148
- // ) as HTMLButtonElement | null
149
-
150
- // const appleButton = document.getElementById(
151
- // 'ryft-pay-apple-pay-button',
152
- // ) as HTMLButtonElement | null
153
-
154
- // if (cardContainer) {
155
- // cardContainer.style.opacity = payButtonDisabled ? '0.6' : '1'
156
- // cardContainer.setAttribute('aria-disabled', payButtonDisabled.toString())
157
- // }
158
-
159
- // if (googleButton) {
160
- // googleButton.disabled = payButtonDisabled
161
- // googleButton.style.opacity = payButtonDisabled ? '0.6' : '1'
162
- // }
163
137
 
164
- // if (appleButton) {
165
- // appleButton.disabled = payButtonDisabled
166
- // appleButton.style.opacity = payButtonDisabled ? '0.6' : '1'
167
- // }
168
-
169
- // if (formBox) {
170
- // formBox.style.display = payButtonDisabled ? 'block' : 'none'
171
- // }
172
- // }, [payButtonDisabled])
138
+ useEffect(
139
+ () => {
140
+ if (
141
+ !formRef.current?.childNodes?.length ||
142
+ formRef.current?.childNodes?.length < 3 ||
143
+ !accountId.data?.account_id
144
+ ) {
145
+ return
146
+ }
147
+ injectComponentsInRyftForm({
148
+ t,
149
+ isAppUsingInIframe,
150
+ onApplePayButtonClick,
151
+ isDisableButton: !payButtonDisabled,
152
+ additionalPaymentMethodsEnabled:
153
+ providerPaymentSettings?.additionalPaymentMethodsEnabled,
154
+ })
155
+ },
156
+ // eslint-disable-next-line react-hooks/exhaustive-deps
157
+ [
158
+ formRef.current?.childNodes?.length,
159
+ showApplePayButton,
160
+ payButtonDisabled,
161
+ ],
162
+ )
173
163
 
174
164
  useEffect(() => {
175
165
  if (!accountId.data?.account_id || accountId.isError) return
@@ -193,29 +183,6 @@ export const RyftPaymentForm = ({
193
183
  // eslint-disable-next-line react-hooks/exhaustive-deps
194
184
  }, [accountId.data?.account_id])
195
185
 
196
-
197
- useEffect(
198
- () => {
199
- if (
200
- !formRef.current?.childNodes?.length ||
201
- formRef.current?.childNodes?.length < 3 ||
202
- !accountId.data?.account_id
203
- ) {
204
- return
205
- }
206
- injectComponentsInRyftForm({
207
- t,
208
- isAppUsingInIframe,
209
- onApplePayButtonClick,
210
- isDisableButton: !payButtonDisabled,
211
- additionalPaymentMethodsEnabled:
212
- providerPaymentSettings?.additionalPaymentMethodsEnabled,
213
- })
214
- },
215
- // eslint-disable-next-line react-hooks/exhaustive-deps
216
- [formRef.current?.childNodes?.length, showApplePayButton, payButtonDisabled],
217
- )
218
-
219
186
  if (accountId.isLoading || accountId.isFetching || isCreateLoading)
220
187
  return (
221
188
  <div className='mt-5 pt-5'>
@@ -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
@@ -32,41 +32,42 @@ export const Dialog = ({
32
32
  }
33
33
 
34
34
  return (
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
- </>
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>
68
49
  )}
69
- </Modal.Footer>
70
- </Modal>
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
+ </>
71
72
  )
72
73
  }
@@ -35,6 +35,8 @@ 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 */}
38
40
  <Link to={href}>{name}</Link>
39
41
  {hasPermission && Boolean(onRemove) && (
40
42
  <ConfirmModal
@@ -27,7 +27,6 @@ export interface EmailTemplateControlProps {
27
27
  meta: string
28
28
  defaultAttachments?: Attachment[]
29
29
  notificationTypes?: NotificationType[]
30
- waiverType?: boolean
31
30
  getDefaultTemplateMetaByType?: (type?: NotificationType | null) => string
32
31
  }
33
32
 
@@ -39,7 +38,6 @@ export const EmailTemplateControl = forwardRef(
39
38
  options = [],
40
39
  defaultAttachments = [],
41
40
  notificationTypes = [],
42
- waiverType = false,
43
41
  getDefaultTemplateMetaByType,
44
42
  }: EmailTemplateControlProps,
45
43
  ref: any,
@@ -198,7 +196,7 @@ export const EmailTemplateControl = forwardRef(
198
196
  })
199
197
  })
200
198
  }
201
-
199
+
202
200
  return (
203
201
  <>
204
202
  <Row>
@@ -286,15 +284,15 @@ export const EmailTemplateControl = forwardRef(
286
284
  </Form.Group>
287
285
  </Row>
288
286
 
289
- <Row>
287
+ <Row>
290
288
  <Form.Group as={Col}>
291
- {!waiverType && (<Form.Check
289
+ <Form.Check
292
290
  {...register('isActive')}
293
291
  name='isActive'
294
292
  label={t('Design:active')}
295
293
  id='formGroupIsActive'
296
294
  custom
297
- />)}
295
+ />
298
296
  <Form.Check
299
297
  {...register('isDefault')}
300
298
  name='isDefault'
@@ -375,9 +373,9 @@ export const EmailTemplateControl = forwardRef(
375
373
  )
376
374
  }
377
375
  // should show dropdown only if user want to include PDF file
378
- if (option.type === OPTION_TYPE.files_selector && !waiverType) {
379
- const fileSelectors = option?.defaultValue ? JSON.parse(option.defaultValue) : ''
380
- const fileNames = Object.values(fileSelectors) : []
376
+ if (option.type === OPTION_TYPE.files_selector) {
377
+ const fileSelectors = JSON.parse(option.defaultValue)
378
+ const fileNames = Object.values(fileSelectors)
381
379
  const fileKeys = Object.keys(fileSelectors)
382
380
 
383
381
  return (
@@ -425,7 +423,7 @@ export const EmailTemplateControl = forwardRef(
425
423
  )
426
424
  }
427
425
 
428
- if (option.type === OPTION_TYPE.days_reminder || option.type === OPTION_TYPE.waiver_reminder ) {
426
+ if (option.type === OPTION_TYPE.days_reminder) {
429
427
  return (
430
428
  <>
431
429
  <Form.Label className='mt-4'>
@@ -436,6 +434,7 @@ export const EmailTemplateControl = forwardRef(
436
434
  `templateOptionValues.${option?.id}.value`,
437
435
  )}
438
436
  type='number'
437
+ onWheel={(event) => event.currentTarget.blur()}
439
438
  placeholder={t(`Design:${option.name}`)}
440
439
  id={option.name + option.id}
441
440
  defaultValue={option.selectedValue || ''}
@@ -41,7 +41,6 @@ export interface EmailTemplateProps extends HasPermissionProp {
41
41
  placeholders?: NotificationPlaceholder[]
42
42
  options?: TemplateOption[]
43
43
  serverErrors?: ServerError
44
- waiverType?: boolean
45
44
  notificationTypes?: NotificationType[]
46
45
  getDefaultTemplateMetaByType?: (type?: NotificationType | null) => string
47
46
  onTypeChange?: (type?: NotificationType | null) => void
@@ -55,7 +54,6 @@ export const EmailTemplateForm = ({
55
54
  placeholders = [],
56
55
  options = [],
57
56
  serverErrors,
58
- waiverType,
59
57
  notificationTypes = [],
60
58
  getDefaultTemplateMetaByType,
61
59
  onTypeChange,
@@ -95,7 +93,6 @@ export const EmailTemplateForm = ({
95
93
  >
96
94
  <EmailTemplateControl
97
95
  ref={emailEditorRef}
98
- waiverType={waiverType}
99
96
  setIsLoading={setIsLoading}
100
97
  meta={defaultValues?.meta || null}
101
98
  defaultAttachments={defaultValues?.attachments || []}
@@ -227,7 +227,7 @@ export function ProductSetControl({
227
227
  </>
228
228
  )}
229
229
 
230
- <SaleDeadline disabled={false} />
230
+ <SaleDeadline disabled={false} isProductSet />
231
231
 
232
232
  <div className='divider' />
233
233