@licklist/design 0.58.11-dev.0 → 0.58.11

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 (172) hide show
  1. package/bitbucket-pipelines.yml +8 -0
  2. package/dist/assets/iframe/calendar.svg +2 -2
  3. package/dist/assets/iframe/calendar.svg.js +1 -1
  4. package/dist/assets/iframe/ticket.svg +2 -2
  5. package/dist/assets/iframe/ticket.svg.js +1 -1
  6. package/dist/calendar/Calendar.d.ts +1 -1
  7. package/dist/calendar/Calendar.d.ts.map +1 -1
  8. package/dist/calendar/Calendar.js +1 -1
  9. package/dist/calendar/components/CalendarDates/CalendarDates.d.ts +2 -2
  10. package/dist/calendar/components/CalendarDates/CalendarDates.d.ts.map +1 -1
  11. package/dist/calendar/components/CalendarDates/CalendarDates.js +1 -1
  12. package/dist/iframe/event/event-card/IframeEventCard.d.ts +1 -2
  13. package/dist/iframe/event/event-card/IframeEventCard.d.ts.map +1 -1
  14. package/dist/iframe/event/event-card/IframeEventCard.js +1 -1
  15. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts +2 -2
  16. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts.map +1 -1
  17. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.js +1 -1
  18. package/dist/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.d.ts +2 -4
  19. package/dist/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.d.ts.map +1 -1
  20. package/dist/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.js +1 -1
  21. package/dist/iframe/order-process/components/BookingSummary/components/SummaryTotal/components/SummaryTotalBlock.d.ts +1 -1
  22. package/dist/iframe/order-process/components/BookingSummary/components/SummaryTotal/components/SummaryTotalBlock.d.ts.map +1 -1
  23. package/dist/iframe/order-process/components/BookingSummary/components/SummaryTotal/components/SummaryTotalBlock.js +1 -1
  24. package/dist/iframe/order-process/components/BookingSummary/components/ToggleHeader/ToggleHeader.d.ts +2 -4
  25. package/dist/iframe/order-process/components/BookingSummary/components/ToggleHeader/ToggleHeader.d.ts.map +1 -1
  26. package/dist/iframe/order-process/components/BookingSummary/components/ToggleHeader/ToggleHeader.js +1 -1
  27. package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts +0 -4
  28. package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts.map +1 -1
  29. package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.js +1 -1
  30. package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.d.ts.map +1 -1
  31. package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.js +1 -1
  32. package/dist/iframe/page/components/PageBody/constants.d.ts +0 -1
  33. package/dist/iframe/page/components/PageBody/constants.d.ts.map +1 -1
  34. package/dist/iframe/page/components/PageBody/constants.js +1 -1
  35. package/dist/iframe/page/components/PageBody/hooks/useResizePageBody.d.ts.map +1 -1
  36. package/dist/iframe/page/components/PageBody/hooks/useResizePageBody.js +1 -1
  37. package/dist/iframe/payment/order-items-table/utils/paymentSummary.js +1 -1
  38. package/dist/iframe/payment/payment-page/PaymentPage.d.ts.map +1 -1
  39. package/dist/iframe/payment/payment-page/PaymentPage.js +1 -1
  40. package/dist/iframe/ryft/RyftPaymentForm.d.ts.map +1 -1
  41. package/dist/iframe/ryft/RyftPaymentForm.js +1 -1
  42. package/dist/product-set/control/DateAndRecurrenceInput.d.ts.map +1 -1
  43. package/dist/product-set/control/DateAndRecurrenceInput.js +1 -1
  44. package/dist/product-set/control/DateInput.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/fixed-duration-fields/FixedDurationOptions.d.ts.map +1 -1
  50. package/dist/product-set/product-category/ProductCategoryControl.d.ts +0 -1
  51. package/dist/product-set/product-category/ProductCategoryControl.d.ts.map +1 -1
  52. package/dist/product-set/product-category/ProductCategoryControl.js +1 -1
  53. package/dist/provider/working-hours-input/WorkingHoursInputDescription.d.ts.map +1 -1
  54. package/dist/provider/working-hours-input/WorkingHoursInputDescription.js +1 -1
  55. package/dist/recurring-date-picker-input/RecurrenceAndFrequencyInput.d.ts.map +1 -1
  56. package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts +1 -3
  57. package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts.map +1 -1
  58. package/dist/recurring-date-picker-input/RecurringDatePickerInput.js +1 -1
  59. package/dist/recurring-date-picker-input/utils.d.ts +0 -9
  60. package/dist/recurring-date-picker-input/utils.d.ts.map +1 -1
  61. package/dist/recurring-date-picker-input/utils.js +1 -1
  62. package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
  63. package/dist/sales/booking/results/components/ResultCard.js +1 -1
  64. package/dist/setting/admin/AdminSettingForm.d.ts +2 -2
  65. package/dist/setting/admin/AdminSettingForm.d.ts.map +1 -1
  66. package/dist/static/manual-date-picker/ManualDatePicker.js +1 -1
  67. package/dist/static/manual-date-picker/constants/index.d.ts +1 -4
  68. package/dist/static/manual-date-picker/constants/index.d.ts.map +1 -1
  69. package/dist/static/manual-date-picker/constants/index.js +1 -1
  70. package/dist/static/manual-date-picker/utils/index.d.ts +0 -4
  71. package/dist/static/manual-date-picker/utils/index.d.ts.map +1 -1
  72. package/dist/static/manual-date-picker/utils/index.js +1 -1
  73. package/dist/styles/iframe-events/Card.scss +8 -24
  74. package/dist/styles/iframe-events/PoweredBy.scss +2 -2
  75. package/dist/styles/iframe-order-process/IframeOrderProcess.scss +20 -57
  76. package/dist/styles/iframe-page/Page.scss +0 -1
  77. package/dist/styles/iframe-page/PageBody.scss +12 -34
  78. package/dist/styles/iframe-page/PageHeader.scss +39 -41
  79. package/dist/styles/ryft-payment-form/RyftPaymentForm.scss +2 -125
  80. package/dist/styles/sales/BookingResults.scss +1 -1
  81. package/dist/zone/form/utils/dates.d.ts.map +1 -1
  82. package/jest.config.js +29 -0
  83. package/package.json +35 -10
  84. package/src/assets/iframe/calendar.svg +2 -2
  85. package/src/assets/iframe/ticket.svg +2 -2
  86. package/src/calendar/Calendar.stories.tsx +0 -23
  87. package/src/calendar/Calendar.tsx +5 -5
  88. package/src/calendar/components/CalendarDates/CalendarDates.tsx +5 -0
  89. package/src/iframe/event/event-card/IframeEventCard.stories.tsx +0 -1
  90. package/src/iframe/event/event-card/IframeEventCard.tsx +8 -7
  91. package/src/iframe/order-process/components/BookingSummary/BookingSummary.stories.tsx +0 -9
  92. package/src/iframe/order-process/components/BookingSummary/BookingSummary.tsx +7 -58
  93. package/src/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.tsx +0 -8
  94. package/src/iframe/order-process/components/BookingSummary/components/SummaryTotal/components/SummaryTotalBlock.tsx +4 -4
  95. package/src/iframe/order-process/components/BookingSummary/components/ToggleHeader/ToggleHeader.tsx +10 -63
  96. package/src/iframe/order-process/components/BookingSummary/types/index.ts +0 -4
  97. package/src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx +1 -1
  98. package/src/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.tsx +1 -3
  99. package/src/iframe/page/components/PageBody/constants.ts +0 -2
  100. package/src/iframe/page/components/PageBody/hooks/useResizePageBody.ts +0 -10
  101. package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +6 -6
  102. package/src/iframe/payment/payment-page/PaymentPage.stories.tsx +6 -546
  103. package/src/iframe/payment/payment-page/PaymentPage.tsx +29 -38
  104. package/src/iframe/ryft/RyftPaymentForm.tsx +5 -11
  105. package/src/product-set/control/DateAndRecurrenceInput.tsx +1 -2
  106. package/src/product-set/control/DateInput.tsx +3 -1
  107. package/src/product-set/form/ProductCategoriesControl.tsx +1 -1
  108. package/src/product-set/form/ProductSetForm.tsx +1 -5
  109. package/src/product-set/hooks/useSortableTreeFunctions.ts +0 -2
  110. package/src/product-set/product/ProductControl.tsx +3 -6
  111. package/src/product-set/product/fixed-duration-fields/FixedDurationOptions.tsx +2 -0
  112. package/src/product-set/product-category/ProductCategoryControl.tsx +43 -105
  113. package/src/provider/working-hours-input/WorkingHoursInputDescription.tsx +18 -4
  114. package/src/recurring-date-picker-input/RecurrenceAndFrequencyInput.tsx +1 -0
  115. package/src/recurring-date-picker-input/RecurringDatePickerInput.tsx +1 -11
  116. package/src/recurring-date-picker-input/utils.ts +0 -75
  117. package/src/sales/booking/results/BookingResults.stories.tsx +2 -3
  118. package/src/sales/booking/results/components/ResultCard.tsx +5 -2
  119. package/src/setting/admin/AdminSettingForm.tsx +2 -2
  120. package/src/sortable-tree/SortableTreeItem.tsx +1 -1
  121. package/src/static/manual-date-picker/ManualDatePicker.tsx +3 -3
  122. package/src/static/manual-date-picker/constants/index.ts +2 -6
  123. package/src/static/manual-date-picker/utils/index.ts +0 -11
  124. package/src/static/switch/BooleanSwitch.tsx +1 -1
  125. package/src/styles/iframe-events/Card.scss +8 -24
  126. package/src/styles/iframe-events/PoweredBy.scss +2 -2
  127. package/src/styles/iframe-order-process/IframeOrderProcess.scss +20 -57
  128. package/src/styles/iframe-page/Page.scss +0 -1
  129. package/src/styles/iframe-page/PageBody.scss +12 -34
  130. package/src/styles/iframe-page/PageHeader.scss +39 -41
  131. package/src/styles/ryft-payment-form/RyftPaymentForm.scss +2 -125
  132. package/src/styles/sales/BookingResults.scss +1 -1
  133. package/src/zone/form/utils/dates.ts +10 -9
  134. package/tests/Auth/Authorizer.test.tsx +194 -0
  135. package/tests/Auth/Layout/UserNavDropDown.test.tsx +43 -0
  136. package/tests/Auth/Layout/UserNavDropDownToggle.test.tsx +33 -0
  137. package/tests/Auth/Login/LoginComponent.test.tsx +246 -0
  138. package/tests/Auth/Login/LoginFormComponent.test.tsx +182 -0
  139. package/tests/Auth/Register/RegisterComponent.test.tsx +285 -0
  140. package/tests/Auth/Register/RegisterFormComponent.test.tsx +170 -0
  141. package/tests/Auth/Settings/Dashboard/IpInput.test.tsx +130 -0
  142. package/tests/Auth/Social/SocialCallbackComponent.test.tsx +133 -0
  143. package/tests/Auth/Social/SocialFormComponent.test.tsx +118 -0
  144. package/tests/FileUpload/FileUpload.test.tsx +42 -0
  145. package/tests/Notification/EmailTemplate.test.tsx +82 -0
  146. package/tests/ProductSet/ProductSetPopover.test.tsx +40 -0
  147. package/tests/Report/Report.test.tsx +48 -0
  148. package/tests/Sales/Coupon.test.tsx +51 -0
  149. package/tests/Sales/SalesAndVIews.test.tsx +63 -0
  150. package/tests/SnippetTemplates/SnippetTemplates.test.tsx +56 -0
  151. package/tests/Table/FilterHelperComponent.test.tsx +88 -0
  152. package/tests/Table/PaginationHelperComponent.test.tsx +109 -0
  153. package/tests/Table/PerPageHelperComponent.test.tsx +34 -0
  154. package/tests/Table/TableHelperComponent.test.tsx +295 -0
  155. package/tests/TipTapEditor/TipTapEditor.test.tsx +28 -0
  156. package/tests/__mock__/hooks/useAuthApi.ts +13 -0
  157. package/tests/__mock__/hooks/useAuthMock.ts +13 -0
  158. package/tests/__mock__/hooks/useFormMock.ts +27 -0
  159. package/tests/__mock__/hooks/useNotificationMock.ts +13 -0
  160. package/tests/__mock__/hooks/useQueryMock.ts +16 -0
  161. package/tests/__mock__/hooks/useSocialApiMock.ts +20 -0
  162. package/tests/__mock__/hooks/useTranslationMock.ts +17 -0
  163. package/tests/__mock__/hooks/useUserApiMock.ts +18 -0
  164. package/tests/__mock__/hooks/useUserMock.ts +13 -0
  165. package/tests/__mock__/styleMock.js +1 -0
  166. package/tests/__mock__/windowMock.ts +5 -0
  167. package/tests/packages/react-query.tsx +28 -0
  168. package/tests/setupTests.ts +10 -0
  169. package/dist/iframe/ryft/utils/ryft-form.d.ts +0 -5
  170. package/dist/iframe/ryft/utils/ryft-form.d.ts.map +0 -1
  171. package/dist/iframe/ryft/utils/ryft-form.js +0 -1
  172. package/src/iframe/ryft/utils/ryft-form.ts +0 -47
@@ -1,6 +1,7 @@
1
- import React, { useEffect, useRef, useState } from "react";
1
+ import React, { useEffect, useState } from "react";
2
2
  import { useTranslation } from "react-i18next";
3
3
  import { useForm } from "react-hook-form";
4
+ import Form from "react-bootstrap/Form";
4
5
 
5
6
  import Button from "react-bootstrap/Button";
6
7
  import { useHistory } from "react-router-dom";
@@ -13,7 +14,6 @@ import {
13
14
  AttemptPaymentResponse,
14
15
  } from "@licklist/plugins/dist/hooks/Ryft/useRyftPayment";
15
16
  import { BlockLoader, ButtonLoader } from "../../static";
16
- import { injectComponentsInRyftForm } from "./utils/ryft-form";
17
17
 
18
18
  export const ryftErrorMap: Record<string, string> = {
19
19
  insufficient_funds: "insufficientFunds",
@@ -50,7 +50,6 @@ export const RyftPaymentForm = ({
50
50
  onSubmit,
51
51
  }: RyftPaymentFormProps) => {
52
52
  const { t } = useTranslation(["Design", "Validation", "Ryft"]);
53
- const formRef = useRef<HTMLFormElement | null>(null);
54
53
  const history = useHistory();
55
54
 
56
55
  const [isValid, setIsValid] = useState(false);
@@ -118,12 +117,6 @@ export const RyftPaymentForm = ({
118
117
  }
119
118
  };
120
119
 
121
- useEffect(
122
- () => injectComponentsInRyftForm({ t }),
123
- // eslint-disable-next-line react-hooks/exhaustive-deps
124
- [formRef.current?.childNodes?.length]
125
- );
126
-
127
120
  useEffect(() => {
128
121
  if (!accountId.data || accountId.isError) return;
129
122
 
@@ -182,14 +175,15 @@ export const RyftPaymentForm = ({
182
175
 
183
176
  return (
184
177
  <>
178
+ <Form.Label>{t("Design:paymentDetails")}</Form.Label>
179
+ {/* For unknown reasons ryft doesn't work with bootstrap form */}
185
180
  <form
186
- ref={formRef}
187
181
  id="ryft-pay-form"
188
182
  noValidate
189
183
  onSubmit={methods.handleSubmit(handleSubmit)}
190
184
  className="ryft-payment-form"
191
185
  >
192
- <div className="submit-button-wrapper mt-4 p-1">
186
+ <div className="submit-button-wrapper mt-3 p-1">
193
187
  <Button type="submit" disabled={isBtnDisabled || !isValid}>
194
188
  {isBtnDisabled && <ButtonLoader />}
195
189
  {t("Design:buyNow")}
@@ -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
  }
@@ -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,
@@ -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 overallCapacityId = 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
 
@@ -330,110 +328,50 @@ export function ProductCategoryControl({
330
328
  </Col>
331
329
  </Row>
332
330
 
333
- {isZoneCategory && (
334
- <>
335
- <Row>
336
- <Col md={6} sm={6} xs={6}>
337
- <Form.Group controlId={overallCapacityId}>
338
- <Form.Label>{t("Design:overallQuantity")}</Form.Label>
339
- <InputGroup hasValidation>
340
- <InputGroup.Prepend
341
- className="arrow-up-btn"
342
- onClick={() => {
343
- const currentOverallCapacity = Number(
344
- getValues(`${fieldNamePrefix}.overallQuantity`) || 0
345
- );
346
- setValue(
347
- `${fieldNamePrefix}.overallQuantity`,
348
- currentOverallCapacity + 1,
349
- { shouldValidate: true }
350
- );
351
- }}
352
- >
353
- <InputGroup.Text className="py-0 px-3">
354
- <IncrementIcon />
355
- </InputGroup.Text>
356
- </InputGroup.Prepend>
357
- <Controller
358
- control={control}
359
- name={`${fieldNamePrefix}.overallQuantity`}
360
- render={({ field }) => (
361
- <Form.Control
362
- min={0}
363
- step={1}
364
- type="number"
365
- disabled={isOverride}
366
- isInvalid={HookFormService.isInvalid<ProductSetFormValues>(
367
- `${fieldNamePrefix}.overallQuantity`,
368
- errors
369
- )}
370
- {...field}
371
- />
372
- )}
373
- rules={{
374
- min: {
375
- value: 0,
376
- message: t("Validation:fieldMinNumber", {
377
- attribute: t("overallQuantity"),
378
- min: 0,
379
- }) as string,
380
- },
381
- }}
382
- />
383
- <Form.Control.Feedback type="invalid">
384
- {HookFormService.getErrors<ProductSetFormValues>(
385
- `${fieldNamePrefix}.overallQuantity`,
331
+ {shouldShowZoneSelect && (
332
+ <Row>
333
+ <Col>
334
+ <Form.Group controlId={zoneId}>
335
+ <Form.Label>{t("Design:zone")}</Form.Label>
336
+ <Controller
337
+ control={control}
338
+ name={`${fieldNamePrefix}.zoneId`}
339
+ render={({ field }) => (
340
+ <Form.Control
341
+ as="select"
342
+ disabled={isOverride}
343
+ isInvalid={HookFormService.isInvalid<ProductSetFormValues>(
344
+ `${fieldNamePrefix}.zoneId`,
386
345
  errors
387
346
  )}
388
- </Form.Control.Feedback>
389
- </InputGroup>
390
- </Form.Group>
391
- </Col>
392
- </Row>
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
- </>
347
+ {...field}
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>
356
+ )}
357
+ rules={{
358
+ required: {
359
+ value: providerHasBookingManagement,
360
+ message: t("Validation:fieldRequired", {
361
+ attribute: t("zone"),
362
+ }),
363
+ },
364
+ }}
365
+ />
366
+ <Form.Control.Feedback type="invalid">
367
+ {HookFormService.getErrors<ProductSetFormValues>(
368
+ `${fieldNamePrefix}.zoneId`,
369
+ errors
370
+ )}
371
+ </Form.Control.Feedback>
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>
@@ -12,14 +12,9 @@ import {
12
12
  import { usePreviousValue } from "@licklist/plugins/dist/hooks/Value/usePreviousValue";
13
13
  import { FormProvider, useForm } from "react-hook-form";
14
14
  import { Form } from "react-bootstrap";
15
- import { WorkHour } from "@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper";
16
15
  import RecurrenceIntervalAndFrequencyInput from "./RecurrenceIntervalAndFrequencyInput";
17
16
  import RecurrenceWeekdaysInput from "./RecurrenceWeekdaysInput";
18
- import {
19
- parseAndValidateRRule,
20
- SupportedFrequency,
21
- useWorkHoursValidationRules,
22
- } from "./utils";
17
+ import { parseAndValidateRRule, SupportedFrequency } from "./utils";
23
18
  import { ConfirmModal } from "../modals";
24
19
  import { DeleteFieldButton } from "../product-set/elements";
25
20
 
@@ -31,7 +26,6 @@ export interface RecurringDatePickerInputProps {
31
26
  initialFrequency?: Frequency;
32
27
  setInitialStartDateAfterSelect?: boolean;
33
28
  minDate?: string;
34
- workHours?: WorkHour[];
35
29
  }
36
30
 
37
31
  export interface RecurringDatePickerInputValues {
@@ -57,7 +51,6 @@ export function RecurringDatePickerInput({
57
51
  setInitialStartDateAfterSelect = false,
58
52
  children,
59
53
  minDate,
60
- workHours,
61
54
  }: PropsWithChildren<RecurringDatePickerInputProps>) {
62
55
  const { t } = useTranslation(["Design"]);
63
56
 
@@ -91,8 +84,6 @@ export function RecurringDatePickerInput({
91
84
  byWeekDay,
92
85
  });
93
86
 
94
- const validationRules = useWorkHoursValidationRules(byWeekDay, workHours);
95
-
96
87
  const onSubmit = (nextState: RecurringDatePickerInputValues) => {
97
88
  const end = getDateTimeObject(endDate, endTime || "23:59:59");
98
89
 
@@ -197,7 +188,6 @@ export function RecurringDatePickerInput({
197
188
  <RecurrenceIntervalAndFrequencyInput
198
189
  disabled={disabled}
199
190
  minDate={minDate}
200
- {...validationRules}
201
191
  />
202
192
 
203
193
  {children}
@@ -1,8 +1,4 @@
1
- import { TIME_FORMAT } from "@licklist/core/dist/Config";
2
- import { WorkHour } from "@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper";
3
- import { dateTimesSortFn } from "@licklist/plugins/dist/utils/dateTime";
4
1
  import { DateTime } from "luxon";
5
- import { useTranslation } from "react-i18next";
6
2
  import RRule, { Frequency, Weekday } from "rrule";
7
3
 
8
4
  export const getWeekdayForFrequency = ({
@@ -15,7 +11,6 @@ export const getWeekdayForFrequency = ({
15
11
  const parsedDate = DateTime.fromISO(date);
16
12
  return new Weekday(
17
13
  parsedDate.weekday - 1,
18
- // eslint-disable-next-line no-nested-ternary
19
14
  frequency !== Frequency.MONTHLY
20
15
  ? undefined
21
16
  : parsedDate.day + 7 > parsedDate.daysInMonth
@@ -114,73 +109,3 @@ export const parseAndValidateRRule = ({
114
109
  until: options.until,
115
110
  } as ParsedRRuleOptions;
116
111
  };
117
-
118
- export const useWorkHoursValidationRules = (
119
- byWeekDay: Weekday[] = [],
120
- workHours: WorkHour[]
121
- ) => {
122
- const { t } = useTranslation("Validation");
123
- // workhours of selected days, all if no days selected
124
- const selectedWorkHours = byWeekDay.length
125
- ? byWeekDay.map(({ weekday }) =>
126
- workHours.find(({ day }) => day === weekday)
127
- )
128
- : workHours;
129
-
130
- /**
131
- * start time
132
- */
133
- const startTimes = selectedWorkHours
134
- .map((workhour) => DateTime.fromFormat(workhour.start, TIME_FORMAT))
135
- .sort(dateTimesSortFn("desc"));
136
-
137
- const latestStartTime = startTimes[0];
138
-
139
- const startTimeRules = {
140
- validate: (date: string) => {
141
- const selectedDate = DateTime.fromFormat(date, TIME_FORMAT);
142
- if (selectedDate >= latestStartTime) return true;
143
-
144
- return t("fieldTimeBefore", {
145
- attribute: t("Design:startTimeSmall"),
146
- time: latestStartTime.toFormat(TIME_FORMAT),
147
- });
148
- },
149
- };
150
-
151
- /**
152
- * end time
153
- */
154
- const endTimes = selectedWorkHours
155
- .map<string>(({ start, end }) => {
156
- const startDateTime = DateTime.fromFormat(start, TIME_FORMAT);
157
- const endDateTime = DateTime.fromFormat(end, TIME_FORMAT);
158
-
159
- if (startDateTime <= endDateTime) return end;
160
-
161
- // if end is before start, then it means that end is on the next day
162
- // so count only to the end of current day
163
- return "23:59";
164
- })
165
- .map((workhour) => DateTime.fromFormat(workhour, TIME_FORMAT))
166
- .sort(dateTimesSortFn("asc"));
167
-
168
- const earliestEndTime = endTimes[0];
169
-
170
- const endTimeRules = {
171
- validate: (date: string) => {
172
- const selectedDate = DateTime.fromFormat(date, TIME_FORMAT);
173
- if (selectedDate <= earliestEndTime) return true;
174
-
175
- return t("fieldTimeAfter", {
176
- attribute: t("Design:endTimeSmall"),
177
- time: earliestEndTime.toFormat(TIME_FORMAT),
178
- });
179
- },
180
- };
181
-
182
- return {
183
- startTimeRules,
184
- endTimeRules,
185
- };
186
- };
@@ -3,12 +3,11 @@ import { Meta } from "@storybook/react";
3
3
  import { Event } from "@licklist/core/dist/DataMapper/Provider/EventDataMapper";
4
4
  import { User } from "@licklist/core/dist/DataMapper/User/UserDataMapper";
5
5
  import { Product } from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
6
+ import { Order } from "@licklist/core/dist/DataMapper/Order/OrderDataMapper";
6
7
  import {
7
- Order,
8
8
  ORDER_SOURCE_IFRAME,
9
9
  ORDER_SOURCE_MANUAL,
10
- } from "@licklist/core/dist/DataMapper/Order/OrderDataMapper";
11
-
10
+ } from "@licklist/core/src/DataMapper/Order/OrderDataMapper";
12
11
  import { BookingResults } from "./BookingResults";
13
12
 
14
13
  export default {
@@ -12,6 +12,7 @@ import { TIME_FORMAT } from "@licklist/core/dist/Config";
12
12
  import * as Config from "@licklist/core/dist/Config";
13
13
  import { formatDateStringForEvent } from "@licklist/plugins/dist/utils/formatDate";
14
14
  import { getOrderSourceTitle } from "@licklist/plugins/dist/utils/sourceTitle";
15
+
15
16
  import Icon from "../../../../static/Icon";
16
17
 
17
18
  export type ResultCardProps = {
@@ -21,6 +22,8 @@ export type ResultCardProps = {
21
22
  onCardClick?: (id: number) => void;
22
23
  };
23
24
 
25
+ // @TODO integrate when API will be available
26
+ // activity and staff keys
24
27
  export const ResultCard = ({
25
28
  order,
26
29
  className,
@@ -38,10 +41,10 @@ export const ResultCard = ({
38
41
  startDate,
39
42
  products,
40
43
  source,
44
+ totalAmount,
41
45
  event,
42
46
  menu,
43
47
  remainingToPay,
44
- paidAmount,
45
48
  } = order;
46
49
 
47
50
  const productList = products.map((product) => product.name)?.join(", ") || "";
@@ -105,7 +108,7 @@ export const ResultCard = ({
105
108
  )}
106
109
  <p>
107
110
  {t("paidAmount")}:{" "}
108
- {formatNumber(paidAmount, {
111
+ {formatNumber(totalAmount, {
109
112
  style: "currency",
110
113
  currency: Config.Currency.GBP,
111
114
  })}
@@ -11,7 +11,7 @@ import Row from "react-bootstrap/Row";
11
11
  import Col from "react-bootstrap/Col";
12
12
  import { Link } from "react-router-dom";
13
13
  import HookFormService from "@licklist/plugins/dist/services/Form/HookFormService";
14
- import { ProvidableType } from "@licklist/core/dist/DataMapper/Provider/ProvidableDataMapper";
14
+ import { ProviderType } from "@licklist/core/dist/DataMapper/Provider/ProvidableDataMapper";
15
15
  import Icon from "../../static/Icon";
16
16
  import { PaymentFeeForm, PaymentFeeFormFieldValues } from "./PaymentFeeForm";
17
17
  import { Currency } from "../../types/currency";
@@ -33,7 +33,7 @@ export interface AdminSettingFormProps extends HasPermissionProp {
33
33
  providerMetadata: {
34
34
  country?: string;
35
35
  providableId?: number;
36
- providerType?: ProvidableType;
36
+ providerType?: ProviderType;
37
37
  };
38
38
  }
39
39
 
@@ -374,7 +374,7 @@ export function SortableTreeItem({
374
374
  items={sortableItems}
375
375
  strategy={verticalListSortingStrategy}
376
376
  >
377
- <Collapse in={expanded}>
377
+ <Collapse in={expanded}>
378
378
  <div className="ml-0">{children}</div>
379
379
  </Collapse>
380
380
  </SortableContext>
@@ -61,9 +61,9 @@ export const ManualDatePicker = ({
61
61
  disabled={isDisabled}
62
62
  >
63
63
  <option value="">{t("Design:monthShort")}</option>
64
- {MONTHS_ARRAY.map((object) => (
65
- <option key={object.key} value={object.value}>
66
- {object.key}
64
+ {MONTHS_ARRAY.map((key) => (
65
+ <option key={key} value={key}>
66
+ {key}
67
67
  </option>
68
68
  ))}
69
69
  </Form.Control>
@@ -1,9 +1,5 @@
1
- import {
2
- generateDatesArray,
3
- generateMonthsOptionsArray,
4
- generateYearsArray,
5
- } from "../utils";
1
+ import { generateDatesArray, generateYearsArray } from "../utils";
6
2
 
7
3
  export const DAYS_ARRAY = generateDatesArray(1, 31, 1);
8
- export const MONTHS_ARRAY = generateMonthsOptionsArray();
4
+ export const MONTHS_ARRAY = generateDatesArray(1, 12, 1);
9
5
  export const YEARS_ARRAY = generateYearsArray();
@@ -4,17 +4,6 @@ export const generateDatesArray = (start: number, end: number, step: number) =>
4
4
  (_, index) => 1 + index * step
5
5
  );
6
6
 
7
- export const generateMonthsOptionsArray = () =>
8
- Array.from({ length: 12 }, (_, index) => {
9
- const value = index + 1;
10
- let key = String(value);
11
- if (value < 10) {
12
- key = `0${key}`;
13
- }
14
-
15
- return { key, value };
16
- });
17
-
18
7
  export const generateYearsArray = () => {
19
8
  const currentYear = new Date().getFullYear();
20
9
  const ageBackYear = currentYear - 100;