@licklist/design 0.44.486-dev.2 → 0.44.486-dev.21
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.
- package/dist/assets/iframe/available.svg.js +1 -0
- package/dist/assets/iframe/limited.svg.js +1 -0
- package/dist/assets/iframe/soldOut.svg.js +1 -0
- package/dist/collapsible-input-group/CollapsibleInputGroup.js +1 -1
- package/dist/date-time-button/DateTimeButton.d.ts +5 -1
- package/dist/date-time-button/DateTimeButton.d.ts.map +1 -1
- package/dist/date-time-button/DateTimeButton.js +1 -1
- package/dist/events/edit-event-modal/IntervalInput.d.ts.map +1 -1
- package/dist/events/edit-event-modal/IntervalInput.js +1 -1
- package/dist/events/event-venue-map/hooks/useImage.d.ts.map +1 -1
- package/dist/events/event-venue-map/hooks/useImage.js +1 -1
- package/dist/iframe/activity-card/ActivityCard.d.ts +17 -0
- package/dist/iframe/activity-card/ActivityCard.d.ts.map +1 -0
- package/dist/iframe/activity-card/ActivityCard.js +1 -0
- package/dist/iframe/activity-card/index.d.ts +2 -0
- package/dist/iframe/activity-card/index.d.ts.map +1 -0
- package/dist/iframe/event/event-calendar/EventCalendar.d.ts +5 -3
- package/dist/iframe/event/event-calendar/EventCalendar.d.ts.map +1 -1
- package/dist/iframe/event/event-calendar/EventCalendar.js +1 -1
- package/dist/iframe/event/event-calendar/components/CalendarDate/CalendarDate.d.ts +3 -2
- package/dist/iframe/event/event-calendar/components/CalendarDate/CalendarDate.d.ts.map +1 -1
- package/dist/iframe/event/event-calendar/components/CalendarDate/CalendarDate.js +1 -1
- package/dist/iframe/event/event-calendar/components/CalendarDates/CalendarDates.d.ts +5 -3
- package/dist/iframe/event/event-calendar/components/CalendarDates/CalendarDates.d.ts.map +1 -1
- package/dist/iframe/event/event-calendar/components/CalendarDates/CalendarDates.js +1 -1
- package/dist/iframe/index.d.ts +1 -1
- package/dist/iframe/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts +1 -0
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/utils/index.js +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.d.ts +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.js +1 -1
- package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts +3 -2
- package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts.map +1 -1
- package/dist/iframe/order-process/components/utils/useCategoryVerification.js +1 -1
- package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.d.ts.map +1 -1
- package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.js +1 -1
- package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts.map +1 -1
- package/dist/iframe/payment/order-items-table/hooks/useTableData.js +1 -1
- package/dist/iframe/payment/order-items-table/types/index.d.ts +7 -1
- package/dist/iframe/payment/order-items-table/types/index.d.ts.map +1 -1
- package/dist/iframe/payment/order-items-table/types/index.js +1 -0
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts +3 -0
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts.map +1 -0
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.js +1 -0
- package/dist/index.js +1 -1
- package/dist/notification/email-template/control/EmailTemplateControl.d.ts.map +1 -1
- package/dist/notification/email-template/control/EmailTemplateControl.js +1 -1
- package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductCategoriesControl.js +1 -1
- package/dist/product-set/form/ProductsControl.d.ts +3 -1
- package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductsControl.js +1 -1
- package/dist/product-set/product/ProductControl.d.ts +2 -1
- package/dist/product-set/product/ProductControl.d.ts.map +1 -1
- package/dist/product-set/product/ProductControl.js +1 -1
- package/dist/product-set/product/duration/ProductDurationControl.js +1 -1
- package/dist/product-set/product-category/ProductCategoryControl.d.ts.map +1 -1
- package/dist/product-set/product-category/ProductCategoryControl.js +1 -1
- package/dist/provider/working-hours-input/WorkingHoursInputDescription.d.ts.map +1 -1
- package/dist/provider/working-hours-input/WorkingHoursInputDescription.js +1 -1
- package/dist/recurrence-input/RecurrenceEndInput.d.ts +2 -1
- package/dist/recurrence-input/RecurrenceEndInput.d.ts.map +1 -1
- package/dist/recurrence-input/RecurrenceEndInput.js +1 -1
- package/dist/recurrence-input/RecurrenceInput.d.ts +2 -1
- package/dist/recurrence-input/RecurrenceInput.d.ts.map +1 -1
- package/dist/recurrence-input/RecurrenceInput.js +1 -1
- package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.d.ts +4 -1
- package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.js +1 -1
- package/dist/report/form/ReportForm.d.ts.map +1 -1
- package/dist/snippet/snippet-template/preview/Preview.js +1 -1
- package/dist/static/CountryCodeSelect.d.ts.map +1 -1
- package/dist/static/CountryCodeSelect.js +1 -1
- package/dist/static/RestrictedAccess.d.ts.map +1 -1
- package/dist/static/form-number-input/FormNumberInput.d.ts +2 -1
- package/dist/static/form-number-input/FormNumberInput.d.ts.map +1 -1
- package/dist/static/form-number-input/FormNumberInput.js +1 -1
- package/dist/styles/{iframe-customers-journey/ActivitiesCard.scss → activity-card/GridActivitiesCard.scss} +1 -1
- package/dist/styles/{iframe-customers-journey/ActivitiesSelectedCard.scss → activity-card/ListActivitiesCard.scss} +2 -1
- package/dist/styles/activity-card/_index.scss +2 -0
- package/dist/styles/{iframe-customers-journey → date-time-button}/DateTimeButton.scss +3 -6
- package/dist/styles/date-time-button/_index.scss +1 -0
- package/dist/styles/iframe-events/Calendar.scss +14 -14
- package/dist/styles/iframe-page/PageBody.scss +3 -2
- package/dist/styles/notification/Notification.scss +4 -0
- package/dist/styles/packages.scss +2 -1
- package/dist/styles/resources-blocking/_index.scss +5 -0
- package/dist/styles/themes/bookedit/_index.scss +1 -0
- package/dist/zone/form/components/AvailableTimesControl.d.ts.map +1 -1
- package/dist/zone/form/components/AvailableTimesControl.js +1 -1
- package/dist/zone/form/components/GameDurationControl.d.ts +7 -0
- package/dist/zone/form/components/GameDurationControl.d.ts.map +1 -0
- package/dist/zone/form/components/GameDurationControl.js +1 -0
- package/dist/zone/form/components/ZoneControl.d.ts.map +1 -1
- package/dist/zone/form/components/ZoneControl.js +1 -1
- package/dist/zone/form/components/ZoneRecurrencesControl.d.ts.map +1 -1
- package/dist/zone/form/components/ZoneRecurrencesControl.js +1 -1
- package/dist/zone/form/utils/dates.d.ts.map +1 -1
- package/dist/zone/form/utils/dates.js +1 -1
- package/package.json +1 -1
- package/src/collapsible-input-group/CollapsibleInputGroup.tsx +1 -1
- package/src/date-time-button/DateTimeButton.stories.tsx +17 -0
- package/src/date-time-button/DateTimeButton.tsx +42 -20
- package/src/events/edit-event-modal/IntervalInput.tsx +3 -0
- package/src/events/event-venue-map/hooks/useImage.tsx +17 -8
- package/src/iframe/{activity-cards/activity-card → activity-card}/ActivityCard.stories.tsx +24 -1
- package/src/iframe/activity-card/ActivityCard.tsx +77 -0
- package/src/iframe/activity-card/index.ts +1 -0
- package/src/iframe/event/event-calendar/EventCalendar.stories.tsx +20 -21
- package/src/iframe/event/event-calendar/EventCalendar.tsx +10 -3
- package/src/iframe/event/event-calendar/components/CalendarDate/CalendarDate.tsx +10 -2
- package/src/iframe/event/event-calendar/components/CalendarDates/CalendarDates.tsx +6 -2
- package/src/iframe/index.ts +1 -1
- package/src/iframe/order-process/components/BookingSummary/BookingSummary.tsx +2 -0
- package/src/iframe/order-process/components/BookingSummary/types/index.ts +1 -0
- package/src/iframe/order-process/components/BookingSummary/utils/index.ts +2 -0
- package/src/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.tsx +2 -2
- package/src/iframe/order-process/components/utils/useCategoryVerification.ts +28 -29
- package/src/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.tsx +6 -1
- package/src/iframe/payment/order-items-table/hooks/useTableData.tsx +11 -99
- package/src/iframe/payment/order-items-table/types/index.ts +18 -1
- package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +118 -0
- package/src/iframe/payment/payment-page/PaymentPage.tsx +4 -4
- package/src/notification/email-template/control/EmailTemplateControl.tsx +26 -1
- package/src/product-set/form/ProductCategoriesControl.tsx +2 -0
- package/src/product-set/form/ProductSetForm.stories.tsx +1 -0
- package/src/product-set/form/ProductsControl.tsx +10 -0
- package/src/product-set/product/ProductControl.tsx +31 -8
- package/src/product-set/product/duration/ProductDurationControl.tsx +1 -1
- package/src/product-set/product-category/ProductCategoryControl.tsx +15 -5
- package/src/provider/location-input/LocationInputDescription.tsx +2 -2
- package/src/provider/working-hours-input/WorkingHoursInputDescription.tsx +10 -8
- package/src/recurrence-input/RecurrenceEndInput.tsx +27 -9
- package/src/recurrence-input/RecurrenceInput.tsx +3 -0
- package/src/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.tsx +24 -21
- package/src/report/form/ReportForm.tsx +1 -1
- package/src/static/CountryCodeSelect.tsx +3 -5
- package/src/static/RestrictedAccess.tsx +1 -1
- package/src/static/form-number-input/FormNumberInput.tsx +8 -1
- package/src/styles/{iframe-customers-journey/ActivitiesCard.scss → activity-card/GridActivitiesCard.scss} +1 -1
- package/src/styles/{iframe-customers-journey/ActivitiesSelectedCard.scss → activity-card/ListActivitiesCard.scss} +2 -1
- package/src/styles/activity-card/_index.scss +2 -0
- package/src/styles/{iframe-customers-journey → date-time-button}/DateTimeButton.scss +3 -6
- package/src/styles/date-time-button/_index.scss +1 -0
- package/src/styles/iframe-events/Calendar.scss +14 -14
- package/src/styles/iframe-page/PageBody.scss +3 -2
- package/src/styles/notification/Notification.scss +4 -0
- package/src/styles/packages.scss +2 -1
- package/src/styles/resources-blocking/_index.scss +5 -0
- package/src/styles/themes/bookedit/_index.scss +1 -0
- package/src/typings.d.ts +11 -0
- package/src/zone/form/components/AvailableTimesControl.tsx +4 -9
- package/src/zone/form/components/GameDurationControl.tsx +46 -0
- package/src/zone/form/components/ZoneControl.tsx +2 -0
- package/src/zone/form/components/ZoneRecurrencesControl.tsx +27 -35
- package/src/zone/form/utils/dates.ts +29 -36
- package/dist/iframe/activity-cards/activity-card/ActivityCard.d.ts +0 -12
- package/dist/iframe/activity-cards/activity-card/ActivityCard.d.ts.map +0 -1
- package/dist/iframe/activity-cards/activity-card/ActivityCard.js +0 -1
- package/dist/iframe/activity-cards/index.d.ts +0 -3
- package/dist/iframe/activity-cards/index.d.ts.map +0 -1
- package/dist/iframe/activity-cards/list-activity-card/ListActivityCard.d.ts +0 -12
- package/dist/iframe/activity-cards/list-activity-card/ListActivityCard.d.ts.map +0 -1
- package/dist/iframe/activity-cards/list-activity-card/ListActivityCard.js +0 -1
- package/dist/styles/iframe-customers-journey/_index.scss +0 -3
- package/src/iframe/activity-cards/activity-card/ActivityCard.tsx +0 -38
- package/src/iframe/activity-cards/index.ts +0 -2
- package/src/iframe/activity-cards/list-activity-card/ListActivityCard.stories.tsx +0 -52
- package/src/iframe/activity-cards/list-activity-card/ListActivityCard.tsx +0 -49
- package/src/styles/iframe-customers-journey/_index.scss +0 -3
- /package/dist/assets/iframe/{dateInfo/available.svg → available.svg} +0 -0
- /package/dist/assets/iframe/{dateInfo/limited.svg → limited.svg} +0 -0
- /package/dist/assets/iframe/{dateInfo/soldOut.svg → soldOut.svg} +0 -0
- /package/src/assets/iframe/{dateInfo/available.svg → available.svg} +0 -0
- /package/src/assets/iframe/{dateInfo/limited.svg → limited.svg} +0 -0
- /package/src/assets/iframe/{dateInfo/soldOut.svg → soldOut.svg} +0 -0
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import React, { useRef } from "react";
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
2
2
|
import { useId } from "@react-aria/utils";
|
|
3
3
|
import { DateTime, DurationUnit } from "luxon";
|
|
4
4
|
import { Col, Form, InputGroup, Row } from "react-bootstrap";
|
|
5
5
|
import RRule from "rrule";
|
|
6
|
-
|
|
6
|
+
import { DATE_FORMAT } from "@licklist/core/dist/Config";
|
|
7
|
+
import { useTranslation } from "react-i18next";
|
|
7
8
|
import { SupportedFrequency } from "./utils";
|
|
8
9
|
import HTMLInputDateElement from "../types/static/HTMLInputDateElement";
|
|
9
10
|
|
|
10
11
|
interface Props {
|
|
11
12
|
disabled?: boolean;
|
|
12
|
-
date: string;
|
|
13
|
+
date: string; // yyyy-mm-ddThh:mm
|
|
14
|
+
minDate?: string; // should be in yyyy-mm-dd format
|
|
13
15
|
frequency: SupportedFrequency;
|
|
14
|
-
until?: string;
|
|
16
|
+
until?: string; // yyyy-mm-dd
|
|
15
17
|
count?: number;
|
|
16
18
|
onChange: (values: { until?: string; count?: number }) => void;
|
|
17
19
|
}
|
|
@@ -23,16 +25,31 @@ function RecurrenceEndInput({
|
|
|
23
25
|
until,
|
|
24
26
|
count,
|
|
25
27
|
onChange,
|
|
28
|
+
minDate,
|
|
26
29
|
}: Props) {
|
|
30
|
+
const { t } = useTranslation("Design");
|
|
27
31
|
// unique ids for radios
|
|
28
32
|
const neverId = useId();
|
|
29
33
|
const onId = useId();
|
|
30
34
|
const afterId = useId();
|
|
31
35
|
const dateInput = useRef<HTMLInputDateElement | null>(null);
|
|
32
36
|
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
const untilDatetime = DateTime.fromFormat(
|
|
39
|
+
until ?? getUntil({ date, frequency }),
|
|
40
|
+
DATE_FORMAT
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const minDatetime = DateTime.fromFormat(minDate, DATE_FORMAT);
|
|
44
|
+
|
|
45
|
+
if (minDatetime > untilDatetime) {
|
|
46
|
+
onChange({ until: minDate });
|
|
47
|
+
}
|
|
48
|
+
}, [minDate, onChange, until, date, frequency]);
|
|
49
|
+
|
|
33
50
|
return (
|
|
34
51
|
<Form.Group>
|
|
35
|
-
<Form.Label>
|
|
52
|
+
<Form.Label>{t("ends")}</Form.Label>
|
|
36
53
|
|
|
37
54
|
<Form.Check type="radio" id={neverId} custom className="mt-3">
|
|
38
55
|
<Form.Check.Input
|
|
@@ -41,7 +58,7 @@ function RecurrenceEndInput({
|
|
|
41
58
|
onChange={() => onChange({ count: 500 })}
|
|
42
59
|
disabled={disabled}
|
|
43
60
|
/>
|
|
44
|
-
<Form.Check.Label>
|
|
61
|
+
<Form.Check.Label>{t("never")}</Form.Check.Label>
|
|
45
62
|
</Form.Check>
|
|
46
63
|
|
|
47
64
|
<Form.Check type="radio" id={onId} custom className="mt-3">
|
|
@@ -55,11 +72,12 @@ function RecurrenceEndInput({
|
|
|
55
72
|
}
|
|
56
73
|
disabled={disabled}
|
|
57
74
|
/>
|
|
58
|
-
<Form.Check.Label>
|
|
75
|
+
<Form.Check.Label>{t("on")}</Form.Check.Label>
|
|
59
76
|
</Col>
|
|
60
77
|
<Col>
|
|
61
78
|
<Form.Control
|
|
62
79
|
type="date"
|
|
80
|
+
min={minDate}
|
|
63
81
|
disabled={disabled || !until}
|
|
64
82
|
aria-label="Date on which the recurrence ends"
|
|
65
83
|
value={until ?? getUntil({ date, frequency })}
|
|
@@ -83,7 +101,7 @@ function RecurrenceEndInput({
|
|
|
83
101
|
}
|
|
84
102
|
disabled={disabled}
|
|
85
103
|
/>
|
|
86
|
-
<Form.Check.Label>
|
|
104
|
+
<Form.Check.Label>{t("after")}</Form.Check.Label>
|
|
87
105
|
</Col>
|
|
88
106
|
<Col>
|
|
89
107
|
<InputGroup>
|
|
@@ -99,7 +117,7 @@ function RecurrenceEndInput({
|
|
|
99
117
|
}
|
|
100
118
|
/>
|
|
101
119
|
<InputGroup.Append>
|
|
102
|
-
<InputGroup.Text>
|
|
120
|
+
<InputGroup.Text>{t("occurences")}</InputGroup.Text>
|
|
103
121
|
</InputGroup.Append>
|
|
104
122
|
</InputGroup>
|
|
105
123
|
</Col>
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
export interface RecurrenceInputProps {
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
date: string;
|
|
19
|
+
minDate?: string;
|
|
19
20
|
value?: string;
|
|
20
21
|
onChange: (value: string) => void;
|
|
21
22
|
initialFrequency?: Frequency;
|
|
@@ -24,6 +25,7 @@ export interface RecurrenceInputProps {
|
|
|
24
25
|
export function RecurrenceInput({
|
|
25
26
|
disabled = false,
|
|
26
27
|
date,
|
|
28
|
+
minDate,
|
|
27
29
|
value,
|
|
28
30
|
onChange,
|
|
29
31
|
initialFrequency = Frequency.WEEKLY,
|
|
@@ -82,6 +84,7 @@ export function RecurrenceInput({
|
|
|
82
84
|
)}
|
|
83
85
|
<RecurrenceEndInput
|
|
84
86
|
date={date}
|
|
87
|
+
minDate={minDate}
|
|
85
88
|
frequency={state.freq}
|
|
86
89
|
until={state.until && DateTime.fromJSDate(state.until).toISODate()}
|
|
87
90
|
count={state.count}
|
|
@@ -2,8 +2,8 @@ import React, { useEffect } from "react";
|
|
|
2
2
|
import { DateTime } from "luxon";
|
|
3
3
|
import { Col, Form, Row } from "react-bootstrap";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
|
-
import { useFormContext } from "react-hook-form";
|
|
6
|
-
import { DATE_FORMAT
|
|
5
|
+
import { RegisterOptions, useFormContext } from "react-hook-form";
|
|
6
|
+
import { DATE_FORMAT } from "@licklist/core/dist/Config";
|
|
7
7
|
import { RecurringDatePickerInputValues } from "./RecurringDatePickerInput";
|
|
8
8
|
|
|
9
9
|
interface RecurrenceIntervalAndFrequencyInputProps {
|
|
@@ -13,6 +13,14 @@ interface RecurrenceIntervalAndFrequencyInputProps {
|
|
|
13
13
|
startTimeLabel?: string;
|
|
14
14
|
endDateLabel?: string;
|
|
15
15
|
endTimeLabel?: string;
|
|
16
|
+
startTimeRules?: Pick<
|
|
17
|
+
RegisterOptions,
|
|
18
|
+
"max" | "min" | "validate" | "required" | "pattern"
|
|
19
|
+
>;
|
|
20
|
+
endTimeRules?: Pick<
|
|
21
|
+
RegisterOptions,
|
|
22
|
+
"max" | "min" | "validate" | "required" | "pattern"
|
|
23
|
+
>;
|
|
16
24
|
}
|
|
17
25
|
|
|
18
26
|
function RecurrenceIntervalAndFrequencyInput({
|
|
@@ -22,6 +30,8 @@ function RecurrenceIntervalAndFrequencyInput({
|
|
|
22
30
|
startTimeLabel,
|
|
23
31
|
endDateLabel,
|
|
24
32
|
endTimeLabel,
|
|
33
|
+
startTimeRules,
|
|
34
|
+
endTimeRules,
|
|
25
35
|
}: RecurrenceIntervalAndFrequencyInputProps) {
|
|
26
36
|
const { t } = useTranslation(["Design", "Notification", "App"]);
|
|
27
37
|
|
|
@@ -30,7 +40,6 @@ function RecurrenceIntervalAndFrequencyInput({
|
|
|
30
40
|
formState: { errors },
|
|
31
41
|
register,
|
|
32
42
|
trigger,
|
|
33
|
-
setValue,
|
|
34
43
|
} = useFormContext<RecurringDatePickerInputValues>();
|
|
35
44
|
|
|
36
45
|
const startDate = getValues("startDate");
|
|
@@ -47,6 +56,9 @@ function RecurrenceIntervalAndFrequencyInput({
|
|
|
47
56
|
}, [startDate]);
|
|
48
57
|
|
|
49
58
|
useEffect(() => {
|
|
59
|
+
if (!startTime || !endTime) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
50
62
|
trigger("endTime");
|
|
51
63
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
64
|
}, [startTime]);
|
|
@@ -118,15 +130,15 @@ function RecurrenceIntervalAndFrequencyInput({
|
|
|
118
130
|
</Form.Label>
|
|
119
131
|
<Form.Control
|
|
120
132
|
type="time"
|
|
121
|
-
{...register("startTime", { required: false })}
|
|
122
|
-
onChange={({ target: { value } }) => {
|
|
123
|
-
setValue("startTime", `${value}:00`);
|
|
124
|
-
}}
|
|
133
|
+
{...register("startTime", { required: false, ...startTimeRules })}
|
|
125
134
|
placeholder="hh:mm"
|
|
126
135
|
defaultValue={startTime}
|
|
127
136
|
disabled={disabled}
|
|
128
137
|
isInvalid={Boolean(errors.startTime)}
|
|
129
138
|
/>
|
|
139
|
+
<Form.Control.Feedback type="invalid">
|
|
140
|
+
{errors.startTime?.message}
|
|
141
|
+
</Form.Control.Feedback>
|
|
130
142
|
</Form.Group>
|
|
131
143
|
</Col>
|
|
132
144
|
|
|
@@ -141,28 +153,19 @@ function RecurrenceIntervalAndFrequencyInput({
|
|
|
141
153
|
if (!startTime || !time) {
|
|
142
154
|
return true;
|
|
143
155
|
}
|
|
144
|
-
const currentStartTime = DateTime.
|
|
145
|
-
|
|
146
|
-
TIME_FULL_FORMAT
|
|
147
|
-
);
|
|
148
|
-
|
|
149
|
-
const currentEndTime = DateTime.fromFormat(
|
|
150
|
-
time,
|
|
151
|
-
TIME_FULL_FORMAT
|
|
152
|
-
);
|
|
156
|
+
const currentStartTime = DateTime.fromISO(startTime);
|
|
157
|
+
const currentEndTime = DateTime.fromISO(time);
|
|
153
158
|
|
|
154
|
-
return currentEndTime?.diff(currentStartTime, ["
|
|
155
|
-
?.
|
|
159
|
+
return currentEndTime?.diff(currentStartTime, ["minutes"])
|
|
160
|
+
?.minutes >= 0
|
|
156
161
|
? true
|
|
157
162
|
: `${t(`Validation:fieldLaterDate`, {
|
|
158
163
|
attribute: t("Design:endTimeSmall"),
|
|
159
164
|
min: t("Design:startTimeSmall"),
|
|
160
165
|
})}`;
|
|
161
166
|
},
|
|
167
|
+
...endTimeRules,
|
|
162
168
|
})}
|
|
163
|
-
onChange={({ target: { value } }) => {
|
|
164
|
-
setValue("endTime", `${value}:59`, { shouldValidate: true });
|
|
165
|
-
}}
|
|
166
169
|
placeholder="hh:mm"
|
|
167
170
|
defaultValue={endTime}
|
|
168
171
|
disabled={disabled}
|
|
@@ -15,7 +15,7 @@ export function ReportForm({
|
|
|
15
15
|
onSubmit,
|
|
16
16
|
onHide,
|
|
17
17
|
hasPermission,
|
|
18
|
-
}: ReportFormProps)
|
|
18
|
+
}: ReportFormProps) {
|
|
19
19
|
const { t } = useTranslation(["App"]);
|
|
20
20
|
const fromDateInput = useRef<HTMLInputDateElement | null>(null);
|
|
21
21
|
const toDateInput = useRef<HTMLInputDateElement | null>(null);
|
|
@@ -52,11 +52,9 @@ function CountryCodeSelect({
|
|
|
52
52
|
{t("chooseCountry")}
|
|
53
53
|
</option>
|
|
54
54
|
{sortedCountries.map((key: keyof typeof en) => (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
</option>
|
|
59
|
-
</>
|
|
55
|
+
<option key={key as string} value={key as string}>
|
|
56
|
+
{en[key]}
|
|
57
|
+
</option>
|
|
60
58
|
))}
|
|
61
59
|
</Form.Control>
|
|
62
60
|
<Form.Control.Feedback type="invalid">{error}</Form.Control.Feedback>
|
|
@@ -4,7 +4,7 @@ import RouteService from "@licklist/plugins/dist/services/Route/RouteService";
|
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
5
|
import Icon from "./Icon";
|
|
6
6
|
|
|
7
|
-
function RestrictedAccess()
|
|
7
|
+
function RestrictedAccess() {
|
|
8
8
|
const { t } = useTranslation("Design");
|
|
9
9
|
|
|
10
10
|
return (
|
|
@@ -15,6 +15,7 @@ interface FormNumberInputProps {
|
|
|
15
15
|
label: string;
|
|
16
16
|
fieldName: string;
|
|
17
17
|
step?: number;
|
|
18
|
+
onChange?: (value: number) => void;
|
|
18
19
|
disabled?: boolean;
|
|
19
20
|
rules?: Pick<
|
|
20
21
|
RegisterOptions,
|
|
@@ -28,6 +29,7 @@ export const FormNumberInput = ({
|
|
|
28
29
|
step = 1,
|
|
29
30
|
rules,
|
|
30
31
|
disabled,
|
|
32
|
+
onChange,
|
|
31
33
|
}: FormNumberInputProps) => {
|
|
32
34
|
const controlId = useId();
|
|
33
35
|
const { t } = useTranslation("Validation");
|
|
@@ -76,7 +78,12 @@ export const FormNumberInput = ({
|
|
|
76
78
|
disabled={disabled}
|
|
77
79
|
isInvalid={HookFormService.isInvalid(fieldName, errors)}
|
|
78
80
|
{...field}
|
|
79
|
-
onChange={(event) =>
|
|
81
|
+
onChange={(event) => {
|
|
82
|
+
if (onChange) {
|
|
83
|
+
onChange(Number(event.target.value));
|
|
84
|
+
}
|
|
85
|
+
field.onChange(Number(event.target.value));
|
|
86
|
+
}}
|
|
80
87
|
onFocus={onFocus}
|
|
81
88
|
/>
|
|
82
89
|
)}
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
align-items: center;
|
|
7
7
|
cursor: pointer;
|
|
8
8
|
height: 5rem;
|
|
9
|
+
padding: 0.375rem;
|
|
9
10
|
border: 2px solid transparent;
|
|
10
|
-
border:
|
|
11
|
+
border-radius: 0.5rem;
|
|
11
12
|
background-color: $snippet-product-set-background-color;
|
|
12
13
|
color: $snippet-product-set-font-color;
|
|
13
14
|
transition: $color-transition;
|
|
@@ -100,14 +100,11 @@
|
|
|
100
100
|
color: $snippet-calendar-button-font-color;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
.
|
|
103
|
+
.resources {
|
|
104
104
|
display: flex;
|
|
105
105
|
justify-content: center;
|
|
106
|
+
align-items: center;
|
|
107
|
+
gap: 0.5rem;
|
|
106
108
|
font-weight: 300;
|
|
107
109
|
flex-direction: row;
|
|
108
|
-
|
|
109
|
-
.logo {
|
|
110
|
-
width: 0.5rem;
|
|
111
|
-
margin-right: 0.5rem;
|
|
112
|
-
}
|
|
113
110
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "./DateTimeButton.scss";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
.calendar-wrapper {
|
|
3
2
|
display: flex;
|
|
4
3
|
|
|
@@ -21,7 +20,7 @@
|
|
|
21
20
|
background-color: transparent;
|
|
22
21
|
}
|
|
23
22
|
|
|
24
|
-
&:focus{
|
|
23
|
+
&:focus {
|
|
25
24
|
box-shadow: none;
|
|
26
25
|
}
|
|
27
26
|
}
|
|
@@ -73,10 +72,9 @@
|
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
74
|
|
|
76
|
-
|
|
77
|
-
|
|
78
75
|
.calendar-dates-wrapper {
|
|
79
|
-
.calendar-weekdays,
|
|
76
|
+
.calendar-weekdays,
|
|
77
|
+
.calendar-dates {
|
|
80
78
|
display: grid;
|
|
81
79
|
grid-template-columns: repeat(7, auto);
|
|
82
80
|
grid-gap: 0.5rem 1rem;
|
|
@@ -98,17 +96,17 @@
|
|
|
98
96
|
margin-top: 0.75rem;
|
|
99
97
|
|
|
100
98
|
.calendar-date {
|
|
101
|
-
height: 2rem;
|
|
102
99
|
display: flex;
|
|
100
|
+
flex-direction: column;
|
|
103
101
|
align-items: center;
|
|
104
102
|
justify-content: center;
|
|
105
|
-
padding: 0;
|
|
103
|
+
padding: 0.25rem;
|
|
106
104
|
border-radius: 0.25rem;
|
|
107
105
|
background-color: $snippet-calendar-button-background-color;
|
|
108
106
|
color: $snippet-calendar-button-font-color;
|
|
109
107
|
font-size: 0.875rem;
|
|
110
108
|
line-height: 1.3125rem;
|
|
111
|
-
border: 1px solid $snippet-calendar-button-border-color
|
|
109
|
+
border: 1px solid $snippet-calendar-button-border-color;
|
|
112
110
|
|
|
113
111
|
&.selected-date {
|
|
114
112
|
background-color: $snippet-calendar-active-button-background-color;
|
|
@@ -138,7 +136,7 @@
|
|
|
138
136
|
&:hover {
|
|
139
137
|
border-color: $snippet-calendar-active-button-border-color;
|
|
140
138
|
}
|
|
141
|
-
|
|
139
|
+
|
|
142
140
|
&:focus {
|
|
143
141
|
box-shadow: none;
|
|
144
142
|
}
|
|
@@ -167,11 +165,11 @@
|
|
|
167
165
|
justify-content: center;
|
|
168
166
|
width: 3.75rem;
|
|
169
167
|
height: 2.5rem;
|
|
170
|
-
background-color: #
|
|
168
|
+
background-color: #f2f2f2;
|
|
171
169
|
color: $black;
|
|
172
170
|
font-size: 0.75rem;
|
|
173
171
|
border-radius: 0.25rem;
|
|
174
|
-
|
|
172
|
+
|
|
175
173
|
&.selected-time {
|
|
176
174
|
background-color: $blue;
|
|
177
175
|
color: $white;
|
|
@@ -189,14 +187,16 @@
|
|
|
189
187
|
flex-direction: column;
|
|
190
188
|
align-items: center;
|
|
191
189
|
|
|
192
|
-
.calendar,
|
|
190
|
+
.calendar,
|
|
191
|
+
.start-time-wrapper {
|
|
193
192
|
min-width: 20.75rem;
|
|
194
193
|
|
|
195
194
|
.calendar-dates-wrapper {
|
|
196
|
-
.calendar-weekdays,
|
|
195
|
+
.calendar-weekdays,
|
|
196
|
+
.calendar-dates {
|
|
197
197
|
grid-gap: 0.5rem;
|
|
198
198
|
}
|
|
199
|
-
|
|
199
|
+
|
|
200
200
|
.calendar-dates {
|
|
201
201
|
.calendar-date {
|
|
202
202
|
width: 2.5rem;
|
|
@@ -199,7 +199,8 @@
|
|
|
199
199
|
color: $snippet-elements-button-color;
|
|
200
200
|
border: none;
|
|
201
201
|
background-color: $snippet-elements-button-background-color;
|
|
202
|
-
box-shadow: 0 0 0 $input-btn-focus-width
|
|
202
|
+
box-shadow: 0 0 0 $input-btn-focus-width
|
|
203
|
+
$snippet-elements-button-background-color;
|
|
203
204
|
}
|
|
204
205
|
|
|
205
206
|
&:disabled {
|
|
@@ -234,7 +235,7 @@
|
|
|
234
235
|
font-weight: 500;
|
|
235
236
|
border-radius: 0.25rem;
|
|
236
237
|
font-size: 0.875rem;
|
|
237
|
-
height: 2.25rem;
|
|
238
|
+
min-height: 2.25rem;
|
|
238
239
|
|
|
239
240
|
&:focus {
|
|
240
241
|
box-shadow: unset;
|
package/src/styles/packages.scss
CHANGED
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
@import "./static";
|
|
14
14
|
@import "./table";
|
|
15
15
|
@import "./back-button";
|
|
16
|
-
@import "./iframe-customers-journey";
|
|
17
16
|
@import "./custom-fields";
|
|
18
17
|
@import "./file-upload";
|
|
19
18
|
@import "./iframe-events";
|
|
@@ -41,3 +40,5 @@
|
|
|
41
40
|
@import "./striped-static-table/";
|
|
42
41
|
@import "./image-radio-input/";
|
|
43
42
|
@import "./radio-card/";
|
|
43
|
+
@import "./activity-card/";
|
|
44
|
+
@import "./date-time-button/";
|
package/src/typings.d.ts
CHANGED
|
@@ -28,3 +28,14 @@ declare module "*.json" {
|
|
|
28
28
|
|
|
29
29
|
declare module "react-phone-number-input/input";
|
|
30
30
|
declare module "react-phone-number-input/commonjs/Flag";
|
|
31
|
+
|
|
32
|
+
// @TODO: this is a hofix for the following issue:
|
|
33
|
+
// licklist_workspace_frontend/packages/design/src/product-set/hooks/useSortableTreeFunctions.ts(17,34):
|
|
34
|
+
// semantic error TS2304: Cannot find name 'structuredClone'.
|
|
35
|
+
interface WindowOrWorkerGlobalScope {
|
|
36
|
+
structuredClone(value: any, options?: StructuredSerializeOptions): any;
|
|
37
|
+
}
|
|
38
|
+
declare function structuredClone(
|
|
39
|
+
value: any,
|
|
40
|
+
options?: StructuredSerializeOptions
|
|
41
|
+
): any;
|
|
@@ -9,7 +9,6 @@ import { Form } from "react-bootstrap";
|
|
|
9
9
|
import { UseFormSetError, useForm } from "react-hook-form";
|
|
10
10
|
import { useId } from "@react-aria/utils";
|
|
11
11
|
import { WorkHour } from "@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper";
|
|
12
|
-
import { calculateTimeWithOffset } from "@licklist/plugins/dist/utils/time";
|
|
13
12
|
import { getCheckboxesByWorkHours } from "../utils/dates";
|
|
14
13
|
|
|
15
14
|
export type AvailableTimesControlRef = {
|
|
@@ -62,20 +61,18 @@ export const AvailableTimesControl = forwardRef<
|
|
|
62
61
|
});
|
|
63
62
|
|
|
64
63
|
const onChange = (option: string) => {
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
const isAlreadyChecked = availableTimes.includes(timeWithOffset);
|
|
64
|
+
const isAlreadyChecked = availableTimes.includes(option);
|
|
68
65
|
|
|
69
66
|
if (isAlreadyChecked) {
|
|
70
67
|
setValue(
|
|
71
68
|
"availableTimes",
|
|
72
|
-
availableTimes.filter((value) => value !==
|
|
69
|
+
availableTimes.filter((value) => value !== option)
|
|
73
70
|
);
|
|
74
71
|
|
|
75
72
|
return;
|
|
76
73
|
}
|
|
77
74
|
|
|
78
|
-
setValue("availableTimes", [...availableTimes,
|
|
75
|
+
setValue("availableTimes", [...availableTimes, option]);
|
|
79
76
|
};
|
|
80
77
|
|
|
81
78
|
useEffect(() => {
|
|
@@ -95,9 +92,7 @@ export const AvailableTimesControl = forwardRef<
|
|
|
95
92
|
<Form.Check.Input
|
|
96
93
|
type="checkbox"
|
|
97
94
|
value={option}
|
|
98
|
-
checked={availableTimes.includes(
|
|
99
|
-
calculateTimeWithOffset(option)
|
|
100
|
-
)}
|
|
95
|
+
checked={availableTimes.includes(option)}
|
|
101
96
|
onChange={() => onChange(option)}
|
|
102
97
|
disabled={isLoading}
|
|
103
98
|
/>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
import { Form } from "react-bootstrap";
|
|
4
|
+
import { useFormContext } from "react-hook-form";
|
|
5
|
+
import { useId } from "@react-aria/utils";
|
|
6
|
+
import HookFormService from "@licklist/plugins/dist/services/Form/HookFormService";
|
|
7
|
+
import { Zone } from "@licklist/core/dist/DataMapper/Provider/ZoneDataMapper";
|
|
8
|
+
|
|
9
|
+
type GameDurationControlProps = {
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const GameDurationControl = ({
|
|
14
|
+
isLoading,
|
|
15
|
+
}: GameDurationControlProps) => {
|
|
16
|
+
const nameId = useId();
|
|
17
|
+
const { t } = useTranslation(["Design", "Validation"]);
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
register,
|
|
21
|
+
formState: { errors },
|
|
22
|
+
} = useFormContext<Pick<Zone, "defaultDuration">>();
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Form.Group controlId={nameId}>
|
|
26
|
+
<Form.Label>{t("Design:defaultGameDuration")}</Form.Label>
|
|
27
|
+
<Form.Control
|
|
28
|
+
type="number"
|
|
29
|
+
{...register("defaultDuration", {
|
|
30
|
+
required: false,
|
|
31
|
+
min: 1,
|
|
32
|
+
})}
|
|
33
|
+
placeholder={t("Design:duration")}
|
|
34
|
+
isInvalid={Boolean(errors.defaultDuration)}
|
|
35
|
+
disabled={isLoading}
|
|
36
|
+
/>
|
|
37
|
+
<Form.Control.Feedback type="invalid">
|
|
38
|
+
{HookFormService.hasError(errors.defaultDuration, "min") &&
|
|
39
|
+
t("Validation:fieldMinNumber", {
|
|
40
|
+
attribute: t("Design:defaultGameDuration").toLowerCase(),
|
|
41
|
+
min: 1,
|
|
42
|
+
})}
|
|
43
|
+
</Form.Control.Feedback>
|
|
44
|
+
</Form.Group>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -7,6 +7,7 @@ import { SortControl } from "./SortControl";
|
|
|
7
7
|
import { ZoneRecurrencesControl } from "./ZoneRecurrencesControl";
|
|
8
8
|
import { DescriptionControl } from "./DescriptionControl";
|
|
9
9
|
import { ZoneImageControl } from "./ZoneImageControl";
|
|
10
|
+
import { GameDurationControl } from "./GameDurationControl";
|
|
10
11
|
|
|
11
12
|
export type ZoneControlProps = {
|
|
12
13
|
isLoading: boolean;
|
|
@@ -27,6 +28,7 @@ export const ZoneControl = ({
|
|
|
27
28
|
<Col md={6} sm={6}>
|
|
28
29
|
<ZoneTypeControl isLoading={isLoading} />
|
|
29
30
|
<SortControl isLoading={isLoading} />
|
|
31
|
+
<GameDurationControl isLoading={isLoading} />
|
|
30
32
|
</Col>
|
|
31
33
|
<Col md={6} sm={6}>
|
|
32
34
|
<ZoneImageControl isLoading={isLoading} />
|