@licklist/design 0.44.486-dev.1 → 0.44.486-dev.10

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 (66) hide show
  1. package/dist/collapsible-input-group/CollapsibleInputGroup.js +1 -1
  2. package/dist/date-time-button/DateTimeButton.js +1 -1
  3. package/dist/iframe/event/event-calendar/EventCalendar.d.ts +5 -3
  4. package/dist/iframe/event/event-calendar/EventCalendar.d.ts.map +1 -1
  5. package/dist/iframe/event/event-calendar/EventCalendar.js +1 -1
  6. package/dist/iframe/event/event-calendar/components/CalendarDate/CalendarDate.d.ts +3 -2
  7. package/dist/iframe/event/event-calendar/components/CalendarDate/CalendarDate.d.ts.map +1 -1
  8. package/dist/iframe/event/event-calendar/components/CalendarDate/CalendarDate.js +1 -1
  9. package/dist/iframe/event/event-calendar/components/CalendarDates/CalendarDates.d.ts +5 -3
  10. package/dist/iframe/event/event-calendar/components/CalendarDates/CalendarDates.d.ts.map +1 -1
  11. package/dist/iframe/event/event-calendar/components/CalendarDates/CalendarDates.js +1 -1
  12. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts +1 -1
  13. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts.map +1 -1
  14. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.js +1 -1
  15. package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts +1 -0
  16. package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts.map +1 -1
  17. package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.d.ts +1 -1
  18. package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.d.ts.map +1 -1
  19. package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.js +1 -1
  20. package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts +3 -2
  21. package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts.map +1 -1
  22. package/dist/iframe/order-process/components/utils/useCategoryVerification.js +1 -1
  23. package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts.map +1 -1
  24. package/dist/iframe/payment/order-items-table/hooks/useTableData.js +1 -1
  25. package/dist/iframe/payment/order-items-table/types/index.d.ts +7 -1
  26. package/dist/iframe/payment/order-items-table/types/index.d.ts.map +1 -1
  27. package/dist/iframe/payment/order-items-table/types/index.js +1 -0
  28. package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts +3 -0
  29. package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts.map +1 -0
  30. package/dist/iframe/payment/order-items-table/utils/paymentSummary.js +1 -0
  31. package/dist/provider/working-hours-input/WorkingHoursInputDescription.d.ts.map +1 -1
  32. package/dist/provider/working-hours-input/WorkingHoursInputDescription.js +1 -1
  33. package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.d.ts.map +1 -1
  34. package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.js +1 -1
  35. package/dist/static/CountryCodeSelect.d.ts.map +1 -1
  36. package/dist/static/CountryCodeSelect.js +1 -1
  37. package/dist/styles/iframe-events/Calendar.scss +14 -14
  38. package/dist/styles/iframe-page/PageBody.scss +3 -2
  39. package/dist/zone/form/components/AvailableTimesControl.d.ts.map +1 -1
  40. package/dist/zone/form/components/AvailableTimesControl.js +1 -1
  41. package/dist/zone/form/components/ZoneRecurrencesControl.d.ts.map +1 -1
  42. package/dist/zone/form/components/ZoneRecurrencesControl.js +1 -1
  43. package/dist/zone/form/utils/dates.d.ts.map +1 -1
  44. package/dist/zone/form/utils/dates.js +1 -1
  45. package/package.json +1 -1
  46. package/src/collapsible-input-group/CollapsibleInputGroup.tsx +1 -1
  47. package/src/date-time-button/DateTimeButton.tsx +1 -1
  48. package/src/iframe/event/event-calendar/EventCalendar.stories.tsx +20 -21
  49. package/src/iframe/event/event-calendar/EventCalendar.tsx +10 -3
  50. package/src/iframe/event/event-calendar/components/CalendarDate/CalendarDate.tsx +10 -2
  51. package/src/iframe/event/event-calendar/components/CalendarDates/CalendarDates.tsx +6 -2
  52. package/src/iframe/order-process/components/BookingSummary/BookingSummary.tsx +2 -0
  53. package/src/iframe/order-process/components/BookingSummary/types/index.ts +1 -0
  54. package/src/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.tsx +2 -2
  55. package/src/iframe/order-process/components/utils/useCategoryVerification.ts +28 -29
  56. package/src/iframe/payment/order-items-table/hooks/useTableData.tsx +11 -99
  57. package/src/iframe/payment/order-items-table/types/index.ts +18 -1
  58. package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +118 -0
  59. package/src/provider/working-hours-input/WorkingHoursInputDescription.tsx +10 -8
  60. package/src/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.tsx +13 -9
  61. package/src/static/CountryCodeSelect.tsx +3 -5
  62. package/src/styles/iframe-events/Calendar.scss +14 -14
  63. package/src/styles/iframe-page/PageBody.scss +3 -2
  64. package/src/zone/form/components/AvailableTimesControl.tsx +4 -9
  65. package/src/zone/form/components/ZoneRecurrencesControl.tsx +25 -32
  66. package/src/zone/form/utils/dates.ts +29 -36
@@ -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, .calendar-dates {
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: #F2F2F2;
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, .start-time-wrapper {
190
+ .calendar,
191
+ .start-time-wrapper {
193
192
  min-width: 20.75rem;
194
193
 
195
194
  .calendar-dates-wrapper {
196
- .calendar-weekdays, .calendar-dates {
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 $snippet-elements-button-background-color;
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;
@@ -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 timeWithOffset = calculateTimeWithOffset(option);
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 !== timeWithOffset)
69
+ availableTimes.filter((value) => value !== option)
73
70
  );
74
71
 
75
72
  return;
76
73
  }
77
74
 
78
- setValue("availableTimes", [...availableTimes, timeWithOffset]);
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
  />
@@ -13,10 +13,7 @@ import { DndContext } from "@dnd-kit/core";
13
13
  import { WorkHour } from "@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper";
14
14
  import { DateTime } from "luxon";
15
15
  import { TIME_FORMAT } from "@licklist/core/dist/Config";
16
- import {
17
- calculateTimeWithOffset,
18
- DIRECTION_TO_LOCAL,
19
- } from "@licklist/plugins/dist/utils/time";
16
+
20
17
  import { CONFIRM_MODAL_ACTIONS } from "../../../modals/confirmation/ConfirmModal";
21
18
  import { Icon } from "../../../static";
22
19
  import {
@@ -67,7 +64,6 @@ export const ZoneRecurrencesControl = ({
67
64
  });
68
65
  const clearEditState = () => setEditState({ index: null, values: null });
69
66
  const [availableTimes, setAvailableTimes] = useState<string[]>([]);
70
-
71
67
  const popoverRef = useRef<HTMLDivElement>();
72
68
  const availableTimesFormRef = useRef<AvailableTimesControlRef>();
73
69
 
@@ -97,29 +93,29 @@ export const ZoneRecurrencesControl = ({
97
93
  if (!isAvailableTimesFormValid) {
98
94
  return;
99
95
  }
100
- const startTime = DateTime.fromFormat(next.startTime, TIME_FORMAT);
101
- const endTime = DateTime.fromFormat(next.endTime, TIME_FORMAT);
102
- const { availableTimes } = availableTimesFormRef.current.getValues();
103
- const validAvalilableTimes = availableTimes.every((time) => {
104
- const currentAvailableTime = DateTime.fromFormat(
105
- calculateTimeWithOffset(time, DIRECTION_TO_LOCAL),
106
- TIME_FORMAT
107
- );
108
- return (
109
- currentAvailableTime.diff(startTime, "minutes").minutes >= 0 &&
110
- currentAvailableTime.diff(endTime, "minutes").minutes <= 0
111
- );
112
- });
113
- if (!validAvalilableTimes) {
114
- availableTimesFormRef.current.setError("availableTimes", {
115
- message: t("Validation:fieldTimeBetween", {
116
- attribute: t("Design:startTimesSmall"),
117
- min: next?.startTime,
118
- max: next?.endTime,
119
- }),
96
+ if (next?.startTime && next?.endTime) {
97
+ const startTime = DateTime.fromISO(next.startTime);
98
+ const endTime = DateTime.fromISO(next.endTime);
99
+ const { availableTimes } = availableTimesFormRef.current.getValues();
100
+ const validAvalilableTimes = availableTimes.every((time) => {
101
+ const currentAvailableTime = DateTime.fromFormat(time, TIME_FORMAT);
102
+
103
+ return (
104
+ currentAvailableTime.diff(startTime, "minutes").minutes >= 0 &&
105
+ currentAvailableTime.diff(endTime, "minutes").minutes <= 0
106
+ );
120
107
  });
108
+ if (!validAvalilableTimes) {
109
+ availableTimesFormRef.current.setError("availableTimes", {
110
+ message: t("Validation:fieldTimeBetween", {
111
+ attribute: t("Design:startTimesSmall"),
112
+ min: startTime.toFormat(TIME_FORMAT),
113
+ max: endTime.toFormat(TIME_FORMAT),
114
+ }),
115
+ });
121
116
 
122
- return;
117
+ return;
118
+ }
123
119
  }
124
120
  const values = {
125
121
  rrule: next.rrule,
@@ -147,12 +143,9 @@ export const ZoneRecurrencesControl = ({
147
143
  const handleOnEdit = (next: Partial<ZoneRecurrence>, index) => {
148
144
  clearEditState();
149
145
 
150
- // Hotfix for an issue with Popover close & open actions
151
- setTimeout(() => {
152
- setEditState({ index, values: next });
153
- setAvailableTimes(next.availableTimes || []);
154
- setIsDatePopoverVisible(() => true);
155
- }, 100);
146
+ setEditState({ index, values: next });
147
+ setAvailableTimes(next.availableTimes || []);
148
+ setIsDatePopoverVisible(() => true);
156
149
  };
157
150
 
158
151
  const handleOnAdd = () => {
@@ -1,5 +1,7 @@
1
- import { datetime, TIME_SEPARATOR } from "@licklist/core/dist/Services/Date";
1
+ import { TIME_SEPARATOR } from "@licklist/core/dist/Services/Date";
2
2
  import { WorkHour } from "@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper";
3
+ import { DateTime } from "luxon";
4
+ import { TIME_FORMAT } from "@licklist/core/dist/Config";
3
5
 
4
6
  const DEFAULT_START_DAY_TIME = "00:00";
5
7
  const DEFAULT_END_DAY_TIME = "23:59";
@@ -13,46 +15,37 @@ export const getTimeCheckboxRanges = (
13
15
  const [startHour, startMinutes] = startTime.split(TIME_SEPARATOR);
14
16
  const [endHour, endMinutes] = endTime.split(TIME_SEPARATOR);
15
17
 
16
- let startDate = datetime(
17
- today.getFullYear(),
18
- today.getMonth() + 1,
19
- today.getDate(),
20
- Number(startHour),
21
- Number(startMinutes)
22
- );
23
-
24
- const endDate = datetime(
25
- today.getFullYear(),
26
- today.getMonth() + 1,
27
- today.getDate(),
28
- Number(endHour),
29
- Number(endMinutes)
30
- );
31
-
32
- const dateSlices: { [key: string]: Date } = {
33
- 0: startDate,
34
- };
18
+ let startDate = DateTime.now()
19
+ .setZone("UTC")
20
+ .set({
21
+ year: today.getFullYear(),
22
+ month: today.getMonth() + 1,
23
+ day: today.getDate(),
24
+ hour: Number(startHour),
25
+ minute: Number(startMinutes),
26
+ second: 0,
27
+ });
28
+
29
+ const endDate = DateTime.now()
30
+ .setZone("UTC")
31
+ .set({
32
+ year: today.getFullYear(),
33
+ month: today.getMonth() + 1,
34
+ day: today.getDate(),
35
+ hour: Number(endHour),
36
+ minute: Number(endMinutes),
37
+ second: 0,
38
+ });
39
+
40
+ const checkboxes: string[] = [startDate.toFormat(TIME_FORMAT)];
35
41
  let count = 0;
36
42
 
37
- while (endDate >= startDate) {
38
- startDate = new Date(startDate.getTime() + range * 60 * 1000);
43
+ while (endDate.diff(startDate, ["minutes"]).minutes >= range) {
44
+ startDate = startDate.plus({ minutes: range });
39
45
  count += 1;
40
- dateSlices[count] = startDate;
46
+ checkboxes[count] = startDate.toFormat(TIME_FORMAT);
41
47
  }
42
48
 
43
- const checkboxes = Object.keys(dateSlices)
44
- .map((key) => {
45
- const date = dateSlices[key];
46
- if (date < endDate) {
47
- const [, time] = date.toISOString().split("T");
48
- const [selectedHours, selectedMinutes] = time.split(TIME_SEPARATOR);
49
-
50
- return [selectedHours, selectedMinutes].join(TIME_SEPARATOR);
51
- }
52
- return null;
53
- })
54
- .filter(Boolean);
55
-
56
49
  return checkboxes;
57
50
  };
58
51