@licklist/design 0.67.3-dev.0 → 0.67.3-dev.1

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 (50) hide show
  1. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts +2 -1
  2. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts.map +1 -1
  3. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +3 -2
  4. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts +2 -1
  5. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts.map +1 -1
  6. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.js +3 -2
  7. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts +2 -1
  8. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts.map +1 -1
  9. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +3 -2
  10. package/dist/product-set/control/DateAndRecurrenceInput.d.ts +2 -1
  11. package/dist/product-set/control/DateAndRecurrenceInput.d.ts.map +1 -1
  12. package/dist/product-set/control/DateAndRecurrenceInput.js +2 -1
  13. package/dist/product-set/control/ProductSetControl.d.ts +2 -1
  14. package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
  15. package/dist/product-set/control/ProductSetControl.js +4 -2
  16. package/dist/product-set/form/ProductSetForm.d.ts +2 -1
  17. package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
  18. package/dist/product-set/form/ProductSetForm.js +5 -3
  19. package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.d.ts +2 -1
  20. package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.d.ts.map +1 -1
  21. package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.js +7 -13
  22. package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts +2 -1
  23. package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts.map +1 -1
  24. package/dist/recurring-date-picker-input/RecurringDatePickerInput.js +4 -3
  25. package/dist/recurring-date-picker-input/utils.d.ts +1 -1
  26. package/dist/recurring-date-picker-input/utils.d.ts.map +1 -1
  27. package/dist/recurring-date-picker-input/utils.js +7 -10
  28. package/dist/zone/form/ZoneForm.d.ts +2 -1
  29. package/dist/zone/form/ZoneForm.d.ts.map +1 -1
  30. package/dist/zone/form/ZoneForm.js +3 -2
  31. package/dist/zone/form/components/ZoneControl.d.ts +2 -1
  32. package/dist/zone/form/components/ZoneControl.d.ts.map +1 -1
  33. package/dist/zone/form/components/ZoneControl.js +3 -2
  34. package/dist/zone/form/components/ZoneRecurrencesControl.d.ts +2 -1
  35. package/dist/zone/form/components/ZoneRecurrencesControl.d.ts.map +1 -1
  36. package/dist/zone/form/components/ZoneRecurrencesControl.js +3 -2
  37. package/package.json +3 -3
  38. package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx +3 -0
  39. package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx +3 -0
  40. package/src/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.tsx +3 -0
  41. package/src/product-set/control/DateAndRecurrenceInput.tsx +3 -0
  42. package/src/product-set/control/ProductSetControl.tsx +4 -0
  43. package/src/product-set/form/ProductSetForm.tsx +3 -0
  44. package/src/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.tsx +8 -22
  45. package/src/recurring-date-picker-input/RecurringDatePickerInput.tsx +6 -3
  46. package/src/recurring-date-picker-input/utils.ts +7 -12
  47. package/src/zone/form/ZoneForm.tsx +7 -1
  48. package/src/zone/form/components/ZoneControl.tsx +7 -2
  49. package/src/zone/form/components/ZoneRecurrencesControl.tsx +3 -0
  50. package/yarn.lock +78 -51
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@licklist/design",
3
- "version": "0.67.3-dev.0",
3
+ "version": "0.67.3-dev.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
@@ -42,7 +42,7 @@
42
42
  ]
43
43
  },
44
44
  "peerDependencies": {
45
- "@licklist/core": "0.29.1-dev.2",
45
+ "@licklist/core": "0.29.1-dev.3",
46
46
  "@licklist/eslint-config": "0.5.5",
47
47
  "@licklist/plugins": "0.32.0-dev.3",
48
48
  "lodash": "4.17.21",
@@ -61,7 +61,7 @@
61
61
  "@dnd-kit/utilities": "2.0.0",
62
62
  "@fortawesome/fontawesome-svg-core": "1.2.34",
63
63
  "@fortawesome/free-solid-svg-icons": "5.15.2",
64
- "@licklist/core": "0.29.1-dev.2",
64
+ "@licklist/core": "0.29.1-dev.3",
65
65
  "@licklist/eslint-config": "0.5.5",
66
66
  "@licklist/plugins": "0.32.0-dev.3",
67
67
  "@mdx-js/react": "1.6.22",
@@ -64,6 +64,7 @@ export interface EditEventFormProps extends HasPermissionProp {
64
64
  createProductSet: (props: EditEventFormValues) => void;
65
65
  setEditProductSetId: (value: string) => void;
66
66
  isExternalPaymentLinkEnabled?: boolean;
67
+ timeZone: string;
67
68
  }
68
69
 
69
70
  const eventImageTypes = {
@@ -83,6 +84,7 @@ export const EditEventForm = ({
83
84
  createProductSet,
84
85
  setEditProductSetId,
85
86
  isExternalPaymentLinkEnabled,
87
+ timeZone,
86
88
  }: EditEventFormProps) => {
87
89
  const { t } = useTranslation(["Design", "Validation"]);
88
90
 
@@ -405,6 +407,7 @@ export const EditEventForm = ({
405
407
  setShowEditProductSet={setShowEditProductSet}
406
408
  showEditProductSet={showEditProductSet}
407
409
  occurrenceStartAtDate={occurrenceStartAtDate}
410
+ timeZone={timeZone}
408
411
  />
409
412
 
410
413
  {hasPermission && !showEditProductSet && (
@@ -16,6 +16,7 @@ interface SelectEventProductSetProps extends HasPermissionProp {
16
16
  createProductSet: (props: EditEventFormValues) => void;
17
17
  setEditProductSetId: (value: string) => void;
18
18
  occurrenceStartAtDate: string;
19
+ timeZone: string;
19
20
  }
20
21
 
21
22
  export const SelectEventProductSet = ({
@@ -25,6 +26,7 @@ export const SelectEventProductSet = ({
25
26
  showEditProductSet,
26
27
  setShowEditProductSet,
27
28
  occurrenceStartAtDate,
29
+ timeZone,
28
30
  }: SelectEventProductSetProps) => {
29
31
  const { t } = useTranslation(["Design"]);
30
32
  const form = useFormContext<EditEventFormValues>();
@@ -215,6 +217,7 @@ export const SelectEventProductSet = ({
215
217
  defaultValues={
216
218
  productSetId === editedProductSet?.id && editedProductSet
217
219
  }
220
+ timeZone={timeZone}
218
221
  />
219
222
  )}
220
223
  </>
@@ -23,12 +23,14 @@ interface EditEventProductSetProps {
23
23
  onSubmit: (value: EditEventFormValues["editedProductSet"]) => void;
24
24
  defaultValues?: EditEventFormValues["editedProductSet"];
25
25
  occurrenceStartAtDate: string;
26
+ timeZone: string;
26
27
  }
27
28
 
28
29
  export const EditEventProductSet = ({
29
30
  onSubmit,
30
31
  defaultValues,
31
32
  occurrenceStartAtDate,
33
+ timeZone,
32
34
  }: EditEventProductSetProps) => {
33
35
  const { companyId } = useParams<{
34
36
  companyId: string;
@@ -129,6 +131,7 @@ export const EditEventProductSet = ({
129
131
  isOverrides
130
132
  occurrenceStartAtDate={occurrenceStartAtDate}
131
133
  workHours={undefined}
134
+ timeZone={timeZone}
132
135
  />
133
136
  <Button
134
137
  disabled={isLoading}
@@ -37,6 +37,7 @@ interface DateAndRecurrenceInputProps {
37
37
  workHours: WorkHour[] | undefined;
38
38
  providerHasBookingManagement: boolean;
39
39
  isLoading?: boolean;
40
+ timeZone: string;
40
41
  }
41
42
 
42
43
  export const DateAndRecurrenceInput = ({
@@ -44,6 +45,7 @@ export const DateAndRecurrenceInput = ({
44
45
  providerHasBookingManagement,
45
46
  workHours,
46
47
  isLoading,
48
+ timeZone,
47
49
  }: DateAndRecurrenceInputProps) => {
48
50
  const {
49
51
  control,
@@ -227,6 +229,7 @@ export const DateAndRecurrenceInput = ({
227
229
  onChange={handleRecurringDateChange}
228
230
  onDelete={handleDelete}
229
231
  workHours={workHours}
232
+ timeZone={timeZone}
230
233
  >
231
234
  {providerHasBookingManagement && (
232
235
  <AvailableTimesControl
@@ -93,6 +93,7 @@ export interface ProductSetControlProps {
93
93
  isOverrides?: boolean;
94
94
  occurrenceStartAtDate?: string;
95
95
  isCreateNewOverrides?: boolean;
96
+ timeZone: string;
96
97
  }
97
98
 
98
99
  export function ProductSetControl({
@@ -111,6 +112,7 @@ export function ProductSetControl({
111
112
  isOverrides = false,
112
113
  occurrenceStartAtDate,
113
114
  isCreateNewOverrides = false,
115
+ timeZone,
114
116
  }: ProductSetControlProps) {
115
117
  const { t } = useTranslation(["Design", "Validation", "Notification"]);
116
118
  const {
@@ -143,6 +145,7 @@ export function ProductSetControl({
143
145
  const eventStartDate = DateTime.fromISO(occurrenceStartAtDate);
144
146
  const eventStart = eventStartDate.toFormat(DATE_MONTH_LOCALE_FORMAT);
145
147
  setValue("name", `${productSetName} (${eventStart})`);
148
+ // eslint-disable-next-line react-hooks/exhaustive-deps
146
149
  }, [setValue, occurrenceStartAtDate]);
147
150
 
148
151
  return (
@@ -200,6 +203,7 @@ export function ProductSetControl({
200
203
  workHours={isZoneAdded ? workHours : undefined}
201
204
  isLoading={isLoading}
202
205
  providerHasBookingManagement={providerHasBookingManagement}
206
+ timeZone={timeZone}
203
207
  />
204
208
  )}
205
209
  </>
@@ -59,6 +59,7 @@ export interface ProductSetFormProps
59
59
  isOverrides?: boolean;
60
60
  workHours?: WorkHour[];
61
61
  isCreateNewOverrides?: boolean;
62
+ timeZone: string;
62
63
  }
63
64
 
64
65
  export function ProductSetForm({
@@ -77,6 +78,7 @@ export function ProductSetForm({
77
78
  workHours,
78
79
  isOverrides,
79
80
  isCreateNewOverrides,
81
+ timeZone,
80
82
  ...shared
81
83
  }: ProductSetFormProps) {
82
84
  const { t } = useTranslation("Design");
@@ -194,6 +196,7 @@ export function ProductSetForm({
194
196
  providerHasBookingManagement={providerHasBookingManagement}
195
197
  isOverrides={isOverrides}
196
198
  isCreateNewOverrides={isCreateNewOverrides}
199
+ timeZone={timeZone}
197
200
  />
198
201
  <Row>
199
202
  <Col md={6} sm={12} />
@@ -8,12 +8,8 @@ import {
8
8
  useWatch,
9
9
  Validate,
10
10
  } from "react-hook-form";
11
- import {
12
- DATE_FORMAT,
13
- TIME_FORMAT,
14
- TIME_FULL_FORMAT,
15
- } from "@licklist/core/dist/Config";
16
- import { fromFormat } from "@licklist/plugins/dist/utils/dateTime";
11
+ import { TIME_FORMAT } from "@licklist/core/dist/Config";
12
+ import { fromIso } from "@licklist/core/dist/Services";
17
13
  import { RecurringDatePickerInputValues } from "./RecurringDatePickerInput";
18
14
 
19
15
  interface RecurrenceIntervalAndFrequencyInputProps {
@@ -31,17 +27,9 @@ interface RecurrenceIntervalAndFrequencyInputProps {
31
27
  RegisterOptions,
32
28
  "max" | "min" | "validate" | "required" | "pattern"
33
29
  >;
30
+ timeZone: string;
34
31
  }
35
32
 
36
- const fromTimeFormat = fromFormat(TIME_FORMAT);
37
- const fromTimeFullFormat = fromFormat(TIME_FULL_FORMAT);
38
-
39
- // default values and entered values are in different formats
40
- const fromTimeFormats = (time: string) =>
41
- fromTimeFormat(time).isValid
42
- ? fromTimeFormat(time)
43
- : fromTimeFullFormat(time);
44
-
45
33
  function RecurrenceIntervalAndFrequencyInput({
46
34
  disabled = false,
47
35
  minDate,
@@ -51,6 +39,7 @@ function RecurrenceIntervalAndFrequencyInput({
51
39
  endTimeLabel,
52
40
  startTimeRules,
53
41
  endTimeRules,
42
+ timeZone,
54
43
  }: RecurrenceIntervalAndFrequencyInputProps) {
55
44
  const { t } = useTranslation(["Design", "Notification", "App"]);
56
45
 
@@ -66,10 +55,10 @@ function RecurrenceIntervalAndFrequencyInput({
66
55
 
67
56
  const _startTime = useWatch({ control, name: "startTime" });
68
57
  const startTime =
69
- _startTime && fromTimeFormats(_startTime).toFormat(TIME_FORMAT);
58
+ _startTime && fromIso(_startTime, timeZone).toFormat(TIME_FORMAT);
70
59
 
71
60
  const _endTime = useWatch({ control, name: "endTime" });
72
- const endTime = _endTime && fromTimeFormats(_endTime).toFormat(TIME_FORMAT);
61
+ const endTime = _endTime && fromIso(_endTime, timeZone).toFormat(TIME_FORMAT);
73
62
 
74
63
  useEffect(() => {
75
64
  if (!startDate || !endDate) {
@@ -119,11 +108,8 @@ function RecurrenceIntervalAndFrequencyInput({
119
108
  if (!startDate || !date) {
120
109
  return true;
121
110
  }
122
- const currentStartDate = DateTime.fromFormat(
123
- startDate,
124
- DATE_FORMAT,
125
- );
126
- const currentEndDate = DateTime.fromFormat(date, DATE_FORMAT);
111
+ const currentStartDate = fromIso(startDate, timeZone);
112
+ const currentEndDate = fromIso(date, timeZone);
127
113
  return currentEndDate.diff(currentStartDate, ["days"]).days >=
128
114
  0
129
115
  ? true
@@ -2,7 +2,7 @@ import { useEffect, useMemo, PropsWithChildren } from "react";
2
2
  import RRule, { Frequency, Weekday } from "rrule";
3
3
  import { useTranslation } from "react-i18next";
4
4
  import Button from "react-bootstrap/Button";
5
- import { DateTime, Interval } from "luxon";
5
+ import { DateTime, Interval, WeekdayNumbers } from "luxon";
6
6
  import { useIntl } from "react-intl";
7
7
  import {
8
8
  DATE_TIME_FORMAT,
@@ -32,6 +32,7 @@ export interface RecurringDatePickerInputProps {
32
32
  setInitialStartDateAfterSelect?: boolean;
33
33
  minDate?: string;
34
34
  workHours: WorkHour[] | undefined;
35
+ timeZone: string;
35
36
  }
36
37
 
37
38
  export interface RecurringDatePickerInputValues {
@@ -58,6 +59,7 @@ export function RecurringDatePickerInput({
58
59
  children,
59
60
  minDate,
60
61
  workHours,
62
+ timeZone,
61
63
  }: PropsWithChildren<RecurringDatePickerInputProps>) {
62
64
  const { t } = useTranslation(["Design"]);
63
65
 
@@ -91,7 +93,7 @@ export function RecurringDatePickerInput({
91
93
  byWeekDay,
92
94
  });
93
95
 
94
- const validator = useWorkHoursValidation(byWeekDay, workHours);
96
+ const validator = useWorkHoursValidation(byWeekDay, workHours, timeZone);
95
97
 
96
98
  const onSubmit = (nextState: RecurringDatePickerInputValues) => {
97
99
  const end = getDateTimeObject(endDate, endTime || "23:59:59");
@@ -158,7 +160,7 @@ export function RecurringDatePickerInput({
158
160
  // Luxon use standard ISO calendar but in that case
159
161
  // first weekday from weekdays array start from 0 index.
160
162
  // We need to add 1 to it to show correct data
161
- const currentWeekDay = byWeekDay[0]?.weekday + 1;
163
+ const currentWeekDay = (byWeekDay[0]?.weekday + 1) as WeekdayNumbers;
162
164
 
163
165
  const currentDate = DateTime.local();
164
166
 
@@ -199,6 +201,7 @@ export function RecurringDatePickerInput({
199
201
  minDate={minDate}
200
202
  startTimeRules={validator}
201
203
  endTimeRules={validator}
204
+ timeZone={timeZone}
202
205
  />
203
206
 
204
207
  {children}
@@ -1,6 +1,5 @@
1
- import { TIME_FORMAT, TIME_FULL_FORMAT } from "@licklist/core/dist/Config";
2
1
  import { WorkHour } from "@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper";
3
- import { fromFormat } from "@licklist/plugins/dist/utils/dateTime";
2
+ import { fromIso } from "@licklist/core/dist/Services";
4
3
  import { DateTime, Interval } from "luxon";
5
4
  import { Validate } from "react-hook-form";
6
5
  import { useTranslation } from "react-i18next";
@@ -119,6 +118,7 @@ export const parseAndValidateRRule = ({
119
118
  export const useWorkHoursValidation = (
120
119
  byWeekDay: Weekday[] = [],
121
120
  workHours: WorkHour[] | undefined,
121
+ timeZone: string,
122
122
  ): {
123
123
  /* @ts-expect-error 2314 */
124
124
  validate?: Validate<string>;
@@ -126,15 +126,12 @@ export const useWorkHoursValidation = (
126
126
  const { t } = useTranslation("Validation");
127
127
  if (!workHours) return {};
128
128
 
129
- const fromTimeFormat = fromFormat(TIME_FORMAT);
130
- const fromTimeFullFormat = fromFormat(TIME_FULL_FORMAT);
131
-
132
129
  // map every day to array of intervals describing workhours for that day
133
130
  let intervalsByDay = workHours.map((workhour, index, self) => {
134
131
  const res: Interval[] = [];
135
132
 
136
- const startTime = fromTimeFormat(workhour.start);
137
- const endTime = fromTimeFormat(workhour.end);
133
+ const startTime = fromIso(workhour.start, timeZone);
134
+ const endTime = fromIso(workhour.end, timeZone);
138
135
 
139
136
  if (endTime > startTime) {
140
137
  res.push(Interval.fromDateTimes(startTime, endTime));
@@ -146,8 +143,8 @@ export const useWorkHoursValidation = (
146
143
 
147
144
  const prevIndex = index === 0 ? self.length - 1 : index - 1;
148
145
 
149
- const prevStartTime = fromTimeFormat(self[prevIndex].start);
150
- const prevEndTime = fromTimeFormat(self[prevIndex].end);
146
+ const prevStartTime = fromIso(self[prevIndex].start, timeZone);
147
+ const prevEndTime = fromIso(self[prevIndex].end, timeZone);
151
148
 
152
149
  // if prevStartTime > prevEndTime then it means that prevEndTime is on the current day
153
150
  // so we need to add interval from start of current day to prevEndTime
@@ -169,9 +166,7 @@ export const useWorkHoursValidation = (
169
166
  validate: (_time: string) => {
170
167
  // workaround for issue with form values
171
168
  // default values and entered values have different formats
172
- const time = fromTimeFormat(_time).isValid
173
- ? fromTimeFormat(_time)
174
- : fromTimeFullFormat(_time);
169
+ const time = fromIso(_time, timeZone);
175
170
 
176
171
  const notFittingIntervalsByDay = intervalsByDay.reduce<Interval[][]>(
177
172
  (acc, intervalsByDay) => {
@@ -14,6 +14,7 @@ export type ZoneFormProps = {
14
14
  serverErrors?: ServerError;
15
15
  isLoading?: boolean;
16
16
  workHours: WorkHour[] | undefined;
17
+ timeZone: string;
17
18
  };
18
19
 
19
20
  export type ZoneFormValues = Partial<Zone> & {
@@ -26,6 +27,7 @@ export const ZoneForm = ({
26
27
  serverErrors,
27
28
  isLoading = false,
28
29
  workHours,
30
+ timeZone,
29
31
  }: ZoneFormProps) => {
30
32
  const { t } = useTranslation("Design");
31
33
  const form = useForm<ZoneFormValues>({
@@ -55,7 +57,11 @@ export const ZoneForm = ({
55
57
  return (
56
58
  <FormProvider {...form}>
57
59
  <Form onSubmit={handleSubmit(onFormSubmit)}>
58
- <ZoneControl isLoading={isLoading} workHours={workHours} />
60
+ <ZoneControl
61
+ isLoading={isLoading}
62
+ workHours={workHours}
63
+ timeZone={timeZone}
64
+ />
59
65
  <Row>
60
66
  <Col md={6} sm={12} />
61
67
  <Col
@@ -11,14 +11,19 @@ import { GameDurationControl } from "./GameDurationControl";
11
11
  export type ZoneControlProps = {
12
12
  isLoading: boolean;
13
13
  workHours: WorkHour[] | undefined;
14
+ timeZone: string;
14
15
  };
15
16
 
16
- export const ZoneControl = ({ isLoading, workHours }: ZoneControlProps) => {
17
+ export const ZoneControl = ({
18
+ isLoading,
19
+ workHours,
20
+ timeZone,
21
+ }: ZoneControlProps) => {
17
22
  return (
18
23
  <Row>
19
24
  <Col md={6} sm={12} className="pr-5">
20
25
  <NameControl isLoading={isLoading} />
21
- <ZoneRecurrencesControl workHours={workHours} />
26
+ <ZoneRecurrencesControl workHours={workHours} timeZone={timeZone} />
22
27
  <hr />
23
28
  <Row>
24
29
  <Col md={6} sm={6}>
@@ -27,10 +27,12 @@ export interface DateAndRecurrenceInputValues {
27
27
 
28
28
  type ZoneRecurrenceControlProps = {
29
29
  workHours: WorkHour[] | undefined;
30
+ timeZone: string;
30
31
  };
31
32
 
32
33
  export const ZoneRecurrencesControl = ({
33
34
  workHours,
35
+ timeZone,
34
36
  }: ZoneRecurrenceControlProps) => {
35
37
  const {
36
38
  control,
@@ -168,6 +170,7 @@ export const ZoneRecurrencesControl = ({
168
170
  onDelete={handleDelete}
169
171
  setInitialStartDateAfterSelect
170
172
  workHours={workHours}
173
+ timeZone={timeZone}
171
174
  />
172
175
  </Popover.Content>
173
176
  </Popover>