@licklist/design 0.59.0-dev.8 → 0.59.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 (197) hide show
  1. package/bitbucket-pipelines.yml +8 -0
  2. package/dist/calendar/Calendar.d.ts +1 -1
  3. package/dist/calendar/Calendar.d.ts.map +1 -1
  4. package/dist/calendar/Calendar.js +1 -1
  5. package/dist/calendar/components/CalendarDates/CalendarDates.d.ts +2 -2
  6. package/dist/calendar/components/CalendarDates/CalendarDates.d.ts.map +1 -1
  7. package/dist/calendar/components/CalendarDates/CalendarDates.js +1 -1
  8. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts +1 -3
  9. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts.map +1 -1
  10. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +1 -1
  11. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts +1 -3
  12. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts.map +1 -1
  13. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.js +1 -1
  14. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts +1 -3
  15. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts.map +1 -1
  16. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +1 -1
  17. package/dist/iframe/activity-card/ActivityCard.d.ts +1 -2
  18. package/dist/iframe/activity-card/ActivityCard.d.ts.map +1 -1
  19. package/dist/iframe/activity-card/ActivityCard.js +1 -1
  20. package/dist/iframe/event/event-card/IframeEventCard.d.ts +1 -2
  21. package/dist/iframe/event/event-card/IframeEventCard.d.ts.map +1 -1
  22. package/dist/iframe/event/event-card/IframeEventCard.js +1 -1
  23. package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.js +1 -1
  24. package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.d.ts.map +1 -1
  25. package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.js +1 -1
  26. package/dist/iframe/page/components/PageBody/constants.d.ts +1 -1
  27. package/dist/iframe/page/components/PageBody/constants.d.ts.map +1 -1
  28. package/dist/iframe/page/components/PageBody/constants.js +1 -1
  29. package/dist/iframe/page/components/PageBody/hooks/useResizePageBody.js +1 -1
  30. package/dist/iframe/payment/order-items-table/utils/paymentSummary.js +1 -1
  31. package/dist/iframe/payment/payment-page/PaymentPage.js +1 -1
  32. package/dist/iframe/ryft/RyftPaymentForm.d.ts +1 -3
  33. package/dist/iframe/ryft/RyftPaymentForm.d.ts.map +1 -1
  34. package/dist/iframe/ryft/RyftPaymentForm.js +1 -1
  35. package/dist/iframe/ryft/utils/ryft-form.d.ts +1 -2
  36. package/dist/iframe/ryft/utils/ryft-form.d.ts.map +1 -1
  37. package/dist/iframe/ryft/utils/ryft-form.js +1 -1
  38. package/dist/product-set/control/DateAndRecurrenceInput.d.ts +1 -1
  39. package/dist/product-set/control/DateAndRecurrenceInput.d.ts.map +1 -1
  40. package/dist/product-set/control/DateAndRecurrenceInput.js +1 -1
  41. package/dist/product-set/control/DateInput.d.ts.map +1 -1
  42. package/dist/product-set/control/DateInput.js +1 -1
  43. package/dist/product-set/control/ProductSetControl.d.ts +1 -1
  44. package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
  45. package/dist/product-set/form/ProductSetForm.d.ts +1 -4
  46. package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
  47. package/dist/product-set/hooks/useSortableTreeFunctions.d.ts.map +1 -1
  48. package/dist/product-set/product/ProductControl.d.ts.map +1 -1
  49. package/dist/product-set/product/ProductControl.js +1 -1
  50. package/dist/product-set/product/fixed-duration-fields/FixedDurationOptions.d.ts.map +1 -1
  51. package/dist/product-set/product-category/ProductCategoryControl.d.ts +0 -1
  52. package/dist/product-set/product-category/ProductCategoryControl.d.ts.map +1 -1
  53. package/dist/product-set/product-category/ProductCategoryControl.js +1 -1
  54. package/dist/provider/working-hours-input/WorkingHoursInputDescription.d.ts.map +1 -1
  55. package/dist/provider/working-hours-input/WorkingHoursInputDescription.js +1 -1
  56. package/dist/recurring-date-picker-input/RecurrenceAndFrequencyInput.d.ts.map +1 -1
  57. package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts +1 -3
  58. package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts.map +1 -1
  59. package/dist/recurring-date-picker-input/RecurringDatePickerInput.js +1 -1
  60. package/dist/recurring-date-picker-input/utils.d.ts +0 -12
  61. package/dist/recurring-date-picker-input/utils.d.ts.map +1 -1
  62. package/dist/recurring-date-picker-input/utils.js +1 -1
  63. package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
  64. package/dist/sales/booking/results/components/ResultCard.js +1 -1
  65. package/dist/sales/coupon/control/CouponFormControl.d.ts +1 -2
  66. package/dist/sales/coupon/control/CouponFormControl.d.ts.map +1 -1
  67. package/dist/sales/coupon/control/CouponFormControl.js +1 -1
  68. package/dist/sales/coupon/form/CouponFrom.d.ts +2 -2
  69. package/dist/sales/coupon/form/CouponFrom.d.ts.map +1 -1
  70. package/dist/setting/admin/AdminSettingForm.d.ts +2 -2
  71. package/dist/setting/admin/AdminSettingForm.d.ts.map +1 -1
  72. package/dist/static/manual-date-picker/ManualDatePicker.js +1 -1
  73. package/dist/static/manual-date-picker/constants/index.d.ts +1 -4
  74. package/dist/static/manual-date-picker/constants/index.d.ts.map +1 -1
  75. package/dist/static/manual-date-picker/constants/index.js +1 -1
  76. package/dist/static/manual-date-picker/utils/index.d.ts +0 -4
  77. package/dist/static/manual-date-picker/utils/index.d.ts.map +1 -1
  78. package/dist/static/manual-date-picker/utils/index.js +1 -1
  79. package/dist/styles/activity-card/ListActivitiesCard.scss +1 -1
  80. package/dist/styles/iframe-events/Card.scss +8 -24
  81. package/dist/styles/iframe-events/PoweredBy.scss +2 -2
  82. package/dist/styles/iframe-external-modal/IframeExternalModal.scss +2 -5
  83. package/dist/styles/iframe-order-process/IframeOrderProcess.scss +2 -0
  84. package/dist/styles/iframe-page/Page.scss +0 -1
  85. package/dist/styles/iframe-page/PageBody.scss +9 -32
  86. package/dist/styles/iframe-page/PageHeader.scss +39 -41
  87. package/dist/styles/ryft-payment-form/RyftPaymentForm.scss +113 -99
  88. package/dist/styles/sales/BookingResults.scss +1 -1
  89. package/dist/typeahead/Typeahead.d.ts +1 -2
  90. package/dist/typeahead/Typeahead.d.ts.map +1 -1
  91. package/dist/typeahead/Typeahead.js +1 -1
  92. package/dist/zone/form/ZoneForm.d.ts +2 -2
  93. package/dist/zone/form/ZoneForm.d.ts.map +1 -1
  94. package/dist/zone/form/ZoneForm.js +1 -1
  95. package/dist/zone/form/components/ZoneControl.d.ts +2 -2
  96. package/dist/zone/form/components/ZoneControl.d.ts.map +1 -1
  97. package/dist/zone/form/components/ZoneControl.js +1 -1
  98. package/dist/zone/form/components/ZoneRecurrencesControl.d.ts +4 -4
  99. package/dist/zone/form/components/ZoneRecurrencesControl.d.ts.map +1 -1
  100. package/dist/zone/form/components/ZoneRecurrencesControl.js +1 -1
  101. package/dist/zone/form/utils/dates.d.ts.map +1 -1
  102. package/jest.config.js +29 -0
  103. package/package.json +35 -10
  104. package/src/calendar/Calendar.stories.tsx +0 -23
  105. package/src/calendar/Calendar.tsx +5 -5
  106. package/src/calendar/components/CalendarDates/CalendarDates.tsx +5 -0
  107. package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx +0 -4
  108. package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx +8 -10
  109. package/src/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.tsx +0 -4
  110. package/src/iframe/activity-card/ActivityCard.tsx +2 -4
  111. package/src/iframe/event/event-card/IframeEventCard.stories.tsx +0 -1
  112. package/src/iframe/event/event-card/IframeEventCard.tsx +8 -7
  113. package/src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx +1 -1
  114. package/src/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.tsx +1 -3
  115. package/src/iframe/page/components/PageBody/constants.ts +1 -1
  116. package/src/iframe/page/components/PageBody/hooks/useResizePageBody.ts +3 -3
  117. package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +6 -6
  118. package/src/iframe/payment/payment-page/PaymentPage.tsx +2 -2
  119. package/src/iframe/ryft/RyftPaymentForm.tsx +3 -20
  120. package/src/iframe/ryft/utils/ryft-form.ts +5 -11
  121. package/src/product-set/control/DateAndRecurrenceInput.tsx +2 -3
  122. package/src/product-set/control/DateInput.tsx +5 -4
  123. package/src/product-set/control/ProductSetControl.tsx +1 -1
  124. package/src/product-set/form/ProductCategoriesControl.tsx +1 -1
  125. package/src/product-set/form/ProductSetForm.tsx +1 -5
  126. package/src/product-set/hooks/useSortableTreeFunctions.ts +0 -2
  127. package/src/product-set/product/ProductControl.tsx +38 -38
  128. package/src/product-set/product/fixed-duration-fields/FixedDurationOptions.tsx +2 -0
  129. package/src/product-set/product-category/ProductCategoryControl.tsx +27 -89
  130. package/src/provider/working-hours-input/WorkingHoursInputDescription.tsx +18 -4
  131. package/src/recurring-date-picker-input/RecurrenceAndFrequencyInput.tsx +1 -0
  132. package/src/recurring-date-picker-input/RecurringDatePickerInput.tsx +1 -11
  133. package/src/recurring-date-picker-input/utils.ts +0 -77
  134. package/src/sales/booking/results/BookingResults.stories.tsx +2 -3
  135. package/src/sales/booking/results/components/ResultCard.tsx +5 -2
  136. package/src/sales/coupon/control/CouponFormControl.tsx +50 -29
  137. package/src/sales/coupon/form/CouponFrom.tsx +15 -5
  138. package/src/setting/admin/AdminSettingForm.tsx +2 -2
  139. package/src/sortable-tree/SortableTreeItem.tsx +1 -1
  140. package/src/static/manual-date-picker/ManualDatePicker.tsx +3 -3
  141. package/src/static/manual-date-picker/constants/index.ts +2 -6
  142. package/src/static/manual-date-picker/utils/index.ts +0 -11
  143. package/src/static/switch/BooleanSwitch.tsx +1 -1
  144. package/src/styles/activity-card/ListActivitiesCard.scss +1 -1
  145. package/src/styles/iframe-events/Card.scss +8 -24
  146. package/src/styles/iframe-events/PoweredBy.scss +2 -2
  147. package/src/styles/iframe-external-modal/IframeExternalModal.scss +2 -5
  148. package/src/styles/iframe-order-process/IframeOrderProcess.scss +2 -0
  149. package/src/styles/iframe-page/Page.scss +0 -1
  150. package/src/styles/iframe-page/PageBody.scss +9 -32
  151. package/src/styles/iframe-page/PageHeader.scss +39 -41
  152. package/src/styles/ryft-payment-form/RyftPaymentForm.scss +113 -99
  153. package/src/styles/sales/BookingResults.scss +1 -1
  154. package/src/typeahead/Typeahead.tsx +3 -16
  155. package/src/zone/form/ZoneForm.tsx +2 -3
  156. package/src/zone/form/components/ZoneControl.tsx +3 -3
  157. package/src/zone/form/components/ZoneRecurrencesControl.tsx +5 -7
  158. package/src/zone/form/utils/dates.ts +10 -9
  159. package/tests/Auth/Authorizer.test.tsx +194 -0
  160. package/tests/Auth/Layout/UserNavDropDown.test.tsx +43 -0
  161. package/tests/Auth/Layout/UserNavDropDownToggle.test.tsx +33 -0
  162. package/tests/Auth/Login/LoginComponent.test.tsx +246 -0
  163. package/tests/Auth/Login/LoginFormComponent.test.tsx +182 -0
  164. package/tests/Auth/Register/RegisterComponent.test.tsx +285 -0
  165. package/tests/Auth/Register/RegisterFormComponent.test.tsx +170 -0
  166. package/tests/Auth/Settings/Dashboard/IpInput.test.tsx +130 -0
  167. package/tests/Auth/Social/SocialCallbackComponent.test.tsx +133 -0
  168. package/tests/Auth/Social/SocialFormComponent.test.tsx +118 -0
  169. package/tests/FileUpload/FileUpload.test.tsx +42 -0
  170. package/tests/Notification/EmailTemplate.test.tsx +82 -0
  171. package/tests/ProductSet/ProductSetPopover.test.tsx +40 -0
  172. package/tests/Report/Report.test.tsx +48 -0
  173. package/tests/Sales/Coupon.test.tsx +51 -0
  174. package/tests/Sales/SalesAndVIews.test.tsx +63 -0
  175. package/tests/SnippetTemplates/SnippetTemplates.test.tsx +56 -0
  176. package/tests/Table/FilterHelperComponent.test.tsx +88 -0
  177. package/tests/Table/PaginationHelperComponent.test.tsx +109 -0
  178. package/tests/Table/PerPageHelperComponent.test.tsx +34 -0
  179. package/tests/Table/TableHelperComponent.test.tsx +295 -0
  180. package/tests/TipTapEditor/TipTapEditor.test.tsx +28 -0
  181. package/tests/__mock__/hooks/useAuthApi.ts +13 -0
  182. package/tests/__mock__/hooks/useAuthMock.ts +13 -0
  183. package/tests/__mock__/hooks/useFormMock.ts +27 -0
  184. package/tests/__mock__/hooks/useNotificationMock.ts +13 -0
  185. package/tests/__mock__/hooks/useQueryMock.ts +16 -0
  186. package/tests/__mock__/hooks/useSocialApiMock.ts +20 -0
  187. package/tests/__mock__/hooks/useTranslationMock.ts +17 -0
  188. package/tests/__mock__/hooks/useUserApiMock.ts +18 -0
  189. package/tests/__mock__/hooks/useUserMock.ts +13 -0
  190. package/tests/__mock__/styleMock.js +1 -0
  191. package/tests/__mock__/windowMock.ts +5 -0
  192. package/tests/packages/react-query.tsx +28 -0
  193. package/tests/setupTests.ts +10 -0
  194. package/dist/sales/coupon/utils/index.d.ts +0 -7
  195. package/dist/sales/coupon/utils/index.d.ts.map +0 -1
  196. package/dist/sales/coupon/utils/index.js +0 -1
  197. package/src/sales/coupon/utils/index.ts +0 -13
@@ -16,7 +16,7 @@ import {
16
16
  PAGE_LEFT_BLOCK_CONTAINER_ID,
17
17
  PAGE_LEFT_BLOCK_MAP_DEFAULT_SIZE,
18
18
  PAGE_CALENDAR_SELECT_WRAPPER,
19
- PAGE_BODY_WITH_SCROLL,
19
+ PAYMENT_LINK_PAGE_BODY,
20
20
  } from "../constants";
21
21
  import { ChangeRightBlockHeightEvent } from "../types";
22
22
 
@@ -52,10 +52,10 @@ export const useResizePageBody = () => {
52
52
  ? calenderWrapper.clientHeight
53
53
  : 0;
54
54
 
55
- const paymentLinkPageBody = document.getElementById(PAGE_BODY_WITH_SCROLL);
55
+ const paymentLinkPageBody = document.getElementById(PAYMENT_LINK_PAGE_BODY);
56
56
  if (paymentLinkPageBody) {
57
57
  paymentLinkPageBody.scroll({
58
- top: -height,
58
+ top: -rightBlockHeight,
59
59
  behavior: "smooth",
60
60
  });
61
61
  }
@@ -63,7 +63,7 @@ const processedPaymentSummary = ({
63
63
  const total = calculateTotalPrice(order, externalPaymentDetail);
64
64
 
65
65
  const totalDiscount = calculateTotalDiscount(order.payments);
66
-
66
+ const totalWithDiscount = total - Number(totalDiscount);
67
67
  let summaryItems: SummaryItem[] = [
68
68
  {
69
69
  translateKey: AMOUNT_TOTAL,
@@ -74,7 +74,7 @@ const processedPaymentSummary = ({
74
74
  if (totalDiscount) {
75
75
  summaryItems.push({
76
76
  translateKey: AMOUNT_WITH_DISCOUNT,
77
- price: order.totalToPayAmount,
77
+ price: totalWithDiscount < 0 ? 0 : totalWithDiscount,
78
78
  });
79
79
  }
80
80
 
@@ -84,17 +84,17 @@ const processedPaymentSummary = ({
84
84
 
85
85
  summaryItems.push({
86
86
  translateKey: TOTAL_PAID,
87
- price: order.paidAmount,
87
+ price: totalWithDiscount <= 0 ? 0 : order.totalAmount,
88
88
  });
89
- if (order.totalToPayAmount <= 0) {
89
+ if (totalWithDiscount <= 0) {
90
90
  return summaryItems;
91
91
  }
92
92
  summaryItems = [...summaryItems, ...externalPaymentDetail];
93
93
 
94
- if (order.remainingToPay) {
94
+ if (totalWithDiscount > order.totalAmount) {
95
95
  summaryItems.push({
96
96
  translateKey: REMAINING_TO_PAY,
97
- price: order.remainingToPay,
97
+ price: totalWithDiscount - order.totalAmount,
98
98
  });
99
99
  }
100
100
  return summaryItems;
@@ -16,7 +16,7 @@ import { PaymentTimer } from "./PaymentTimer";
16
16
  import { Page, PageBody } from "../../page";
17
17
  import { BookingSummary } from "../../order-process";
18
18
  import { cartSumByOrderProducts } from "../../order-process/components/BookingSummary/utils";
19
- import { PAGE_BODY_WITH_SCROLL } from "../../page/components/PageBody/constants";
19
+ import { PAYMENT_LINK_PAGE_BODY } from "../../page/components/PageBody/constants";
20
20
 
21
21
  export interface PaymentMetadata {
22
22
  total: number;
@@ -126,7 +126,7 @@ export const PaymentPage = ({
126
126
  onCloseButtonClick={isIframePayment ? onGoBack : undefined}
127
127
  /> */}
128
128
  <PageBody
129
- id={PAGE_BODY_WITH_SCROLL}
129
+ id={PAYMENT_LINK_PAGE_BODY}
130
130
  leftBlock={
131
131
  <PageBody.LeftBlock>
132
132
  <div className="d-flex align-items-center mb-5">
@@ -12,8 +12,6 @@ import {
12
12
  RYFT_STATUS_PENDING_ACTION,
13
13
  AttemptPaymentResponse,
14
14
  } from "@licklist/plugins/dist/hooks/Ryft/useRyftPayment";
15
- import { ProviderPaymentSettings } from "@licklist/core/dist/DataMapper/Setting/ProviderPaymentSettingsDataMapper";
16
-
17
15
  import { BlockLoader, ButtonLoader } from "../../static";
18
16
  import { injectComponentsInRyftForm } from "./utils/ryft-form";
19
17
 
@@ -42,13 +40,11 @@ export interface RyftPaymentFormProps {
42
40
  ) => Promise<void>;
43
41
  onSubmit: () => Promise<AttemptPaymentResponse>;
44
42
  resetReferrer?: () => void;
45
- providerPaymentSettings?: ProviderPaymentSettings;
46
43
  }
47
44
 
48
45
  export const RyftPaymentForm = ({
49
46
  accountId,
50
47
  isCreateLoading,
51
- providerPaymentSettings,
52
48
  initRyft,
53
49
  resetReferrer,
54
50
  onSubmit,
@@ -123,26 +119,13 @@ export const RyftPaymentForm = ({
123
119
  };
124
120
 
125
121
  useEffect(
126
- () => {
127
- if (
128
- !formRef.current?.childNodes?.length ||
129
- formRef.current?.childNodes?.length < 3 ||
130
- !accountId.data?.account_id
131
- ) {
132
- return;
133
- }
134
- injectComponentsInRyftForm({
135
- t,
136
- additionalPaymentMethodsEnabled:
137
- providerPaymentSettings?.additionalPaymentMethodsEnabled,
138
- });
139
- },
122
+ () => injectComponentsInRyftForm({ t }),
140
123
  // eslint-disable-next-line react-hooks/exhaustive-deps
141
124
  [formRef.current?.childNodes?.length]
142
125
  );
143
126
 
144
127
  useEffect(() => {
145
- if (!accountId.data?.account_id || accountId.isError) return;
128
+ if (!accountId.data || accountId.isError) return;
146
129
 
147
130
  initRyft(
148
131
  () => {
@@ -156,7 +139,7 @@ export const RyftPaymentForm = ({
156
139
  );
157
140
 
158
141
  // eslint-disable-next-line react-hooks/exhaustive-deps
159
- }, [accountId.data?.account_id]);
142
+ }, [accountId.data]);
160
143
 
161
144
  if (accountId.isLoading || accountId.isFetching || isCreateLoading)
162
145
  return (
@@ -2,18 +2,17 @@ import { TFunction } from "react-i18next";
2
2
 
3
3
  export const injectComponentsInRyftForm = ({
4
4
  t,
5
- additionalPaymentMethodsEnabled,
6
5
  }: {
7
6
  t: TFunction<string[]>;
8
- additionalPaymentMethodsEnabled?: boolean;
9
7
  }) => {
10
8
  const cardContainer = document.getElementById("ryft-pay-iframe");
9
+ const oldCardDividerContainer = document.getElementById(
10
+ "card-title-container"
11
+ );
11
12
 
12
- if (!cardContainer) {
13
+ if (!cardContainer || oldCardDividerContainer) {
13
14
  return;
14
15
  }
15
- // Removing of the old title container
16
- document.getElementById("card-title-container")?.remove();
17
16
 
18
17
  const cardTitle = document.createElement("div");
19
18
  const cardText = document.createElement("div");
@@ -27,14 +26,10 @@ export const injectComponentsInRyftForm = ({
27
26
 
28
27
  const payGrid = document.getElementById("ryft-pay-grid");
29
28
 
30
- if (!payGrid || !additionalPaymentMethodsEnabled) {
29
+ if (!payGrid) {
31
30
  return;
32
31
  }
33
32
 
34
- // Removing of the old mobile title container and divider container
35
- document.getElementById("mobile-pay-title")?.remove();
36
- document.getElementById("mobile-pay-divider-container")?.remove();
37
-
38
33
  // Adding title and divider for apple and google pay button
39
34
  const mobilePayTitle = document.createElement("div");
40
35
  const dividerText = document.createElement("div");
@@ -42,7 +37,6 @@ export const injectComponentsInRyftForm = ({
42
37
  const container = document.createElement("div");
43
38
  mobilePayTitle.className = "mobile-pay-title";
44
39
  mobilePayTitle.innerText = t("Design:expressCheckoutWith");
45
- mobilePayTitle.id = "mobile-pay-title";
46
40
  dividerText.id = "mobile-pay-divider-text";
47
41
  dividerText.innerText = "or";
48
42
  divider.id = "mobile-pay-divider";
@@ -36,7 +36,7 @@ export interface DateAndRecurrenceInputValues {
36
36
 
37
37
  interface DateAndRecurrenceInputProps {
38
38
  isEventEditProductSet?: boolean;
39
- workHours: WorkHour[] | undefined;
39
+ workHours?: WorkHour[];
40
40
  providerHasBookingManagement: boolean;
41
41
  isLoading?: boolean;
42
42
  }
@@ -90,7 +90,7 @@ export const DateAndRecurrenceInput = ({
90
90
  clearEditState();
91
91
  });
92
92
 
93
- const popoverId = useId();
93
+ const popoverId = useId()!;
94
94
 
95
95
  const { t } = useTranslation("Design");
96
96
 
@@ -228,7 +228,6 @@ export const DateAndRecurrenceInput = ({
228
228
  defaultValues={editState.values}
229
229
  onChange={handleRecurringDateChange}
230
230
  onDelete={handleDelete}
231
- workHours={workHours}
232
231
  >
233
232
  {providerHasBookingManagement && (
234
233
  <AvailableTimesControl
@@ -5,8 +5,9 @@ import { Form, OverlayTrigger, Popover } from "react-bootstrap";
5
5
  import { useFieldArray, useFormContext } from "react-hook-form";
6
6
  import { useTranslation } from "react-i18next";
7
7
  import { useClickAway } from "react-use";
8
- import { TIMEZONE, TIME_FORMAT } from "@licklist/core/dist/Config/Date";
8
+ import { TIMEZONE } from "@licklist/core/dist/Config/Date";
9
9
  import { ProductSetRecurrence } from "@licklist/core/dist/DataMapper/Product/ProductSetRecurrenceDataMapper";
10
+ import { TIME_FORMAT } from "@licklist/core/dist/Config/Date";
10
11
  import { DateTime } from "luxon";
11
12
  import RRule, { Frequency } from "rrule";
12
13
  import { WorkHour } from "@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper";
@@ -26,6 +27,7 @@ import {
26
27
  import { ProductSetRecurrenceOverridesControl } from "./ProductSetRecurrenceOverridesControl";
27
28
  import { MAX_QUANTITY_RECURRENCE_DATE_IN_OVERRIDE } from "../product/constants";
28
29
 
30
+
29
31
  export interface DateAndRecurrenceInputValues {
30
32
  menuRecurrences?: Partial<ProductSetRecurrence>[];
31
33
  }
@@ -57,7 +59,7 @@ export const DateInput = ({
57
59
  control,
58
60
  keyName: "_id",
59
61
  });
60
- const [availableTimes, setAvailableTimes] = useState<string[]>([]);
62
+
61
63
  const [isDatePopoverVisible, setIsDatePopoverVisible] = useState(false);
62
64
  const availableTimesFormRef = useRef<AvailableTimesControlRef>();
63
65
  const [editState, setEditState] = useState<{
@@ -92,7 +94,6 @@ export const DateInput = ({
92
94
  // Hotfix for an issue with Popover close & open actions
93
95
  setTimeout(() => {
94
96
  setEditState({ index, values: next });
95
- setAvailableTimes(next.availableTimes || []);
96
97
  setIsDatePopoverVisible(() => true);
97
98
  }, 100);
98
99
  };
@@ -220,7 +221,7 @@ export const DateInput = ({
220
221
  workHours={workHours}
221
222
  isLoading={isLoading}
222
223
  ref={availableTimesFormRef}
223
- defaultValues={availableTimes}
224
+ defaultValues={[]}
224
225
  errorMessage={
225
226
  errors?.menuRecurrences?.[`${editState?.index}`]
226
227
  ?.availableTimes?.message
@@ -85,7 +85,7 @@ export interface ProductSetControlProps {
85
85
  fieldSets?: FieldSet[];
86
86
  showEmailTemplate?: boolean;
87
87
  showSmsTemplate?: boolean;
88
- workHours: WorkHour[] | undefined;
88
+ workHours?: WorkHour[];
89
89
  providerHasBookingManagement?: boolean;
90
90
  isOverrides?: boolean;
91
91
  }
@@ -307,7 +307,7 @@ export function ProductCategoriesControl({
307
307
  title={t("addCategory")}
308
308
  isOverride={isOverrides}
309
309
  onClick={() => {
310
- if (isOverrides) return;
310
+ if (isOverrides) return;
311
311
  setIsSelectCategoryVisible(true);
312
312
  }}
313
313
  />
@@ -26,16 +26,12 @@ import { checkAvailableTimesErrors, getFilteredTemplates } from "../utils";
26
26
  export interface WithIsLoading {
27
27
  isLoading: boolean;
28
28
  }
29
- export interface WithIdOptional {
30
- id?: number;
31
- }
32
-
33
29
  export interface WithId {
34
30
  id: number;
35
31
  }
36
32
  export interface ProductSetFormValues
37
33
  extends FormValues,
38
- WithIdOptional,
34
+ WithId,
39
35
  ProductSetControlValues {
40
36
  steps: Step[];
41
37
  isOverrides?: boolean;
@@ -24,10 +24,8 @@ export const useSortableTreeFunctions = ({
24
24
  const cancelChanges = (index: number) => {
25
25
  if (isOverrides) return;
26
26
  if (!previousValue) {
27
- // eslint-disable-next-line consistent-return
28
27
  return remove(index);
29
28
  }
30
- // eslint-disable-next-line consistent-return
31
29
  return setValue(`${fieldName}.${index}` as const, previousValue);
32
30
  };
33
31
 
@@ -7,17 +7,14 @@ import {
7
7
  QUANTITY_TYPE_LIST_DTO,
8
8
  QUANTITY_TYPE_RECHARGING,
9
9
  } from "@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper";
10
- import {
11
- ProductType,
12
- PRODUCT_DEfAULT_COLORS,
13
- } from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
10
+ import { ProductType } from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
14
11
  import HookFormService from "@licklist/plugins/dist/services/Form/HookFormService";
15
- import clsx from "clsx";
16
12
  import {
17
13
  FieldNamePrefixPath,
18
14
  FormValues,
19
15
  } from "@licklist/plugins/dist/types/services/Form/hook-form-service";
20
16
  import { useId } from "@react-aria/utils";
17
+ import clsx from "clsx";
21
18
  import React, {
22
19
  ChangeEvent,
23
20
  useCallback,
@@ -39,7 +36,7 @@ import {
39
36
  } from "react-hook-form";
40
37
  import { useTranslation } from "react-i18next";
41
38
  import { useImages } from "@licklist/plugins/dist/hooks/Media/useImages";
42
-
39
+ import { PRODUCT_DEfAULT_COLORS } from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
43
40
  import {
44
41
  Image,
45
42
  IMAGE_TYPE_IMAGE,
@@ -149,7 +146,7 @@ export function ProductControl<T extends FormValues>({
149
146
  clearErrors,
150
147
  } = useFormContext<T>();
151
148
 
152
- const { setLoading, productGroupList } = useContext(ProductSetLoadingContext);
149
+ const { setLoading } = useContext(ProductSetLoadingContext);
153
150
  const { t } = useTranslation(["Design", "Validation", "ProductSet"]);
154
151
  const [expanded, setExpanded] = useState(false);
155
152
  const [initialImages, setInitialImages] = useState<Image[] | null>(null);
@@ -162,8 +159,8 @@ export function ProductControl<T extends FormValues>({
162
159
 
163
160
  const advancedId = useId();
164
161
  const nameId = useId();
165
-
166
- const productGroupId = useId();
162
+ // @TODO: no need for v1 release
163
+ // const productGroupId = useId();
167
164
  const descriptionId = useId();
168
165
  const termsAndConditionsId = useId();
169
166
  const isAvailableId = useId();
@@ -403,35 +400,6 @@ export function ProductControl<T extends FormValues>({
403
400
  isRequired={false}
404
401
  defaultColors={PRODUCT_DEfAULT_COLORS}
405
402
  />
406
-
407
- <Form.Group controlId={productGroupId}>
408
- <Form.Label>{t("productGroup")}</Form.Label>
409
- <Form.Control
410
- as="select"
411
- {...register(`${fieldNamePrefix}.productGroupId` as Path<T>)}
412
- isInvalid={HookFormService.isInvalid<T>(
413
- `${fieldNamePrefix}.productGroupId` as Path<T>,
414
- errors
415
- )}
416
- disabled={isLoading}
417
- defaultValue=""
418
- >
419
- <option value="">{t("Design:selectProductGroup")}</option>
420
- {productGroupList.map((productGroup) => {
421
- return (
422
- <option value={productGroup.id} key={productGroup.id}>
423
- {productGroup.value}
424
- </option>
425
- );
426
- })}
427
- </Form.Control>
428
- <Form.Control.Feedback type="invalid">
429
- {HookFormService.getErrors<T>(
430
- `${fieldNamePrefix}.productGroupId` as Path<T>,
431
- errors
432
- )}
433
- </Form.Control.Feedback>
434
- </Form.Group>
435
403
  </Col>
436
404
  </Row>
437
405
 
@@ -704,6 +672,38 @@ export function ProductControl<T extends FormValues>({
704
672
  </Collapse>
705
673
 
706
674
  <Row>
675
+ {/* @TODO: no need for v1 release
676
+ <Col xs={12} sm={6}>
677
+ <Form.Group controlId={productGroupId}>
678
+ <Form.Label>{t("productGroup")}</Form.Label>
679
+ <Form.Control
680
+ as="select"
681
+ {...register(`${fieldNamePrefix}.productGroupId` as Path<T>)}
682
+ isInvalid={HookFormService.isInvalid<T>(
683
+ `${fieldNamePrefix}.productGroupId` as Path<T>,
684
+ errors
685
+ )}
686
+ disabled={isLoading}
687
+ defaultValue=""
688
+ >
689
+ <option value="">{t("Design:selectProductGroup")}</option>
690
+ {productGroupList.map((productGroup) => {
691
+ return (
692
+ <option value={productGroup.id} key={productGroup.id}>
693
+ {productGroup.value}
694
+ </option>
695
+ );
696
+ })}
697
+ </Form.Control>
698
+ <Form.Control.Feedback type="invalid">
699
+ {HookFormService.getErrors<T>(
700
+ `${fieldNamePrefix}.productGroupId` as Path<T>,
701
+ errors
702
+ )}
703
+ </Form.Control.Feedback>
704
+ </Form.Group>
705
+ </Col> */}
706
+
707
707
  <Col xs={12}>
708
708
  {hasBookingManagement && (
709
709
  <ProductBookingManagementControl<T>
@@ -5,6 +5,8 @@ import { FieldNamePrefixPath } from "@licklist/plugins/dist/types/services/Form/
5
5
  import { useWatch } from "react-hook-form";
6
6
  import { FormNumberInput } from "../../../static";
7
7
 
8
+
9
+
8
10
  interface FixedDurationOptionsProps<T> extends FieldNamePrefixPath<T> {
9
11
  isOverrides?: boolean;
10
12
  }
@@ -26,7 +26,6 @@ export interface ProductCategoryControlValues extends FormValues {
26
26
  name: string;
27
27
  minSubItems: number | null;
28
28
  maxSubItems: number | null;
29
- overallQuantity?: number | null;
30
29
  quantityType: QuantityType;
31
30
  type: CategoryType;
32
31
  isTimeRelated: boolean;
@@ -103,7 +102,6 @@ export function ProductCategoryControl({
103
102
  const collectUserInfoId = useId();
104
103
  const hasTicketId = useId();
105
104
  const zoneId = useId();
106
- const overallQuantityId = useId();
107
105
 
108
106
  const allowDepositsId = useId();
109
107
  const remainderExpireAfterId = useId();
@@ -129,7 +127,7 @@ export function ProductCategoryControl({
129
127
  // eslint-disable-next-line react-hooks/exhaustive-deps
130
128
  }, [maxSubItems, fieldNamePrefix]);
131
129
 
132
- const isZoneCategory =
130
+ const shouldShowZoneSelect =
133
131
  category.type === CATEGORY_TYPE_FIXED_DURATION ||
134
132
  category.type === CATEGORY_TYPE_GAME;
135
133
 
@@ -329,111 +327,51 @@ export function ProductCategoryControl({
329
327
  </Form.Group>
330
328
  </Col>
331
329
  </Row>
332
- <Row>
333
- <Col md={6} sm={6} xs={6}>
334
- <Form.Group controlId={overallQuantityId}>
335
- <Form.Label>{t("Design:overallQuantity")}</Form.Label>
336
- <InputGroup hasValidation>
337
- <InputGroup.Prepend
338
- className="arrow-up-btn"
339
- onClick={() => {
340
- const currentOverallCapacity = Number(
341
- getValues(`${fieldNamePrefix}.overallQuantity`) || 0
342
- );
343
- setValue(
344
- `${fieldNamePrefix}.overallQuantity`,
345
- currentOverallCapacity + 1,
346
- { shouldValidate: true }
347
- );
348
- }}
349
- >
350
- <InputGroup.Text className="py-0 px-3">
351
- <IncrementIcon />
352
- </InputGroup.Text>
353
- </InputGroup.Prepend>
330
+
331
+ {shouldShowZoneSelect && (
332
+ <Row>
333
+ <Col>
334
+ <Form.Group controlId={zoneId}>
335
+ <Form.Label>{t("Design:zone")}</Form.Label>
354
336
  <Controller
355
337
  control={control}
356
- name={`${fieldNamePrefix}.overallQuantity`}
338
+ name={`${fieldNamePrefix}.zoneId`}
357
339
  render={({ field }) => (
358
340
  <Form.Control
359
- min={0}
360
- step={1}
361
- type="number"
341
+ as="select"
362
342
  disabled={isOverride}
363
343
  isInvalid={HookFormService.isInvalid<ProductSetFormValues>(
364
- `${fieldNamePrefix}.overallQuantity`,
344
+ `${fieldNamePrefix}.zoneId`,
365
345
  errors
366
346
  )}
367
347
  {...field}
368
- />
348
+ >
349
+ <option value={null}>{t("Design:choose")}</option>
350
+ {zones.map((zone) => (
351
+ <option key={zone.id} value={zone.id}>
352
+ {zone.name}
353
+ </option>
354
+ ))}
355
+ </Form.Control>
369
356
  )}
370
357
  rules={{
371
- min: {
372
- value: 0,
373
- message: t("Validation:fieldMinNumber", {
374
- attribute: t("overallQuantity"),
375
- min: 0,
376
- }) as string,
358
+ required: {
359
+ value: providerHasBookingManagement,
360
+ message: t("Validation:fieldRequired", {
361
+ attribute: t("zone"),
362
+ }),
377
363
  },
378
364
  }}
379
365
  />
380
366
  <Form.Control.Feedback type="invalid">
381
367
  {HookFormService.getErrors<ProductSetFormValues>(
382
- `${fieldNamePrefix}.overallQuantity`,
368
+ `${fieldNamePrefix}.zoneId`,
383
369
  errors
384
370
  )}
385
371
  </Form.Control.Feedback>
386
- </InputGroup>
387
- </Form.Group>
388
- </Col>
389
- </Row>
390
-
391
- {isZoneCategory && (
392
- <>
393
- <Row>
394
- <Col>
395
- <Form.Group controlId={zoneId}>
396
- <Form.Label>{t("Design:zone")}</Form.Label>
397
- <Controller
398
- control={control}
399
- name={`${fieldNamePrefix}.zoneId`}
400
- render={({ field }) => (
401
- <Form.Control
402
- as="select"
403
- disabled={isOverride}
404
- isInvalid={HookFormService.isInvalid<ProductSetFormValues>(
405
- `${fieldNamePrefix}.zoneId`,
406
- errors
407
- )}
408
- {...field}
409
- >
410
- <option value={null}>{t("Design:choose")}</option>
411
- {zones.map((zone) => (
412
- <option key={zone.id} value={zone.id}>
413
- {zone.name}
414
- </option>
415
- ))}
416
- </Form.Control>
417
- )}
418
- rules={{
419
- required: {
420
- value: providerHasBookingManagement,
421
- message: t("Validation:fieldRequired", {
422
- attribute: t("zone"),
423
- }),
424
- },
425
- }}
426
- />
427
- <Form.Control.Feedback type="invalid">
428
- {HookFormService.getErrors<ProductSetFormValues>(
429
- `${fieldNamePrefix}.zoneId`,
430
- errors
431
- )}
432
- </Form.Control.Feedback>
433
- </Form.Group>
434
- </Col>
435
- </Row>
436
- </>
372
+ </Form.Group>
373
+ </Col>
374
+ </Row>
437
375
  )}
438
376
  </Col>
439
377
 
@@ -1,7 +1,9 @@
1
+ import { DateTime } from "luxon";
1
2
  import React from "react";
2
3
  import { Col, Row } from "react-bootstrap";
3
4
  import { useFormContext } from "react-hook-form";
4
5
  import { useTranslation } from "react-i18next";
6
+ import { TIME_FORMAT } from "@licklist/core/dist/Config";
5
7
  import { WorkingHoursInputValues } from ".";
6
8
  import { useWeekdays } from "./utils";
7
9
 
@@ -23,10 +25,22 @@ export function WorkingHoursInputDescription() {
23
25
  <Row key={i}>
24
26
  <Col xs="auto">{weekdays[i]}:</Col>
25
27
  <Col>
26
- {t("timeInterval", {
27
- start: weekday.start,
28
- end: weekday.end,
29
- })}
28
+ {weekday?.end
29
+ ? weekday.start
30
+ ? t("timeInterval", {
31
+ start: DateTime.fromISO(weekday.start).toFormat(
32
+ TIME_FORMAT
33
+ ),
34
+ end: DateTime.fromISO(weekday.start).toFormat(
35
+ TIME_FORMAT
36
+ ),
37
+ })
38
+ : t("timeFrom", {
39
+ start: DateTime.fromISO(weekday.start).toFormat(
40
+ TIME_FORMAT
41
+ ),
42
+ })
43
+ : null}
30
44
  </Col>
31
45
  </Row>
32
46
  );
@@ -72,6 +72,7 @@ function RecurrenceAndFrequencyInput({
72
72
  </Form.Control.Feedback>
73
73
  </Form.Group>
74
74
  </Col>
75
+
75
76
  </Row>
76
77
 
77
78
  <Row>