mozrest-sdk-react-dev 0.2.74 → 0.2.76

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/mozrest-sdk.es.js CHANGED
@@ -47552,9 +47552,7 @@ const Input$2 = ({
47552
47552
  required: required4,
47553
47553
  disabled: disabled2,
47554
47554
  ...props
47555
- }), disabled2 && /* @__PURE__ */ React__default.createElement("div", {
47556
- style: { position: "absolute", top: "1rem", right: "1rem" }
47557
- }, /* @__PURE__ */ React__default.createElement(LockTooltip, null, disabledTooltip))));
47555
+ })));
47558
47556
  };
47559
47557
  const TextInputField$1 = (props) => {
47560
47558
  const [field2, meta] = useField(props.id);
@@ -92649,7 +92647,7 @@ const formatChannelsData = (data2) => {
92649
92647
  return [{ id: null, label: "All" }, ...reservationPortals.map((p2) => ({ id: p2.id, label: p2.name }))];
92650
92648
  };
92651
92649
  const formatSmartChannelsData = (data2) => {
92652
- return data2.map((p2) => ({ value: p2.id, label: p2.name }));
92650
+ return data2.map((p2) => ({ value: p2.id, label: p2.name, code: p2.code }));
92653
92651
  };
92654
92652
  const formatHoursData = (data2) => {
92655
92653
  if (!data2 || typeof data2 !== "object") {
@@ -102518,34 +102516,34 @@ const ReservationsAnalytics = ({ userEmail, userFullName }) => {
102518
102516
  totalDays
102519
102517
  }));
102520
102518
  };
102521
- const mainConatiner$1 = "_mainConatiner_ek91m_48";
102522
- const mainTableContainer = "_mainTableContainer_ek91m_58";
102523
- const mainSidebarContainer = "_mainSidebarContainer_ek91m_65";
102524
- const headerContainer = "_headerContainer_ek91m_74";
102525
- const buttonList = "_buttonList_ek91m_79";
102526
- const tableTopHeader = "_tableTopHeader_ek91m_85";
102527
- const tableTopHeaderContent = "_tableTopHeaderContent_ek91m_93";
102528
- const tableRowContainer = "_tableRowContainer_ek91m_101";
102529
- const tableRowCard = "_tableRowCard_ek91m_107";
102530
- const noData = "_noData_ek91m_112";
102531
- const tableRowHour = "_tableRowHour_ek91m_119";
102532
- const hours = "_hours_ek91m_130";
102533
- const tableRowContent = "_tableRowContent_ek91m_136";
102534
- const rowImage = "_rowImage_ek91m_145";
102535
- const rowContactContainer = "_rowContactContainer_ek91m_151";
102536
- const rowContactText = "_rowContactText_ek91m_157";
102537
- const rowContactPhone = "_rowContactPhone_ek91m_163";
102538
- const rowSectionContainer = "_rowSectionContainer_ek91m_170";
102539
- const rowSectionText = "_rowSectionText_ek91m_176";
102540
- const rowSectionSecText = "_rowSectionSecText_ek91m_182";
102541
- const rowActionButton = "_rowActionButton_ek91m_189";
102542
- const bookingInfoContainer = "_bookingInfoContainer_ek91m_195";
102543
- const bookingInfoCardRow = "_bookingInfoCardRow_ek91m_199";
102544
- const bookingInfoCardContainer = "_bookingInfoCardContainer_ek91m_207";
102545
- const bookingInfoCard = "_bookingInfoCard_ek91m_199";
102546
- const bookingInfoCardContent = "_bookingInfoCardContent_ek91m_219";
102547
- const bookingInfoCardTitle = "_bookingInfoCardTitle_ek91m_225";
102548
- const bookingInfoCardText = "_bookingInfoCardText_ek91m_228";
102519
+ const mainConatiner$1 = "_mainConatiner_lnm3d_48";
102520
+ const mainTableContainer = "_mainTableContainer_lnm3d_58";
102521
+ const mainSidebarContainer = "_mainSidebarContainer_lnm3d_65";
102522
+ const headerContainer = "_headerContainer_lnm3d_74";
102523
+ const buttonList = "_buttonList_lnm3d_79";
102524
+ const tableTopHeader = "_tableTopHeader_lnm3d_85";
102525
+ const tableTopHeaderContent = "_tableTopHeaderContent_lnm3d_93";
102526
+ const tableRowContainer = "_tableRowContainer_lnm3d_101";
102527
+ const tableRowCard = "_tableRowCard_lnm3d_107";
102528
+ const noData = "_noData_lnm3d_112";
102529
+ const tableRowHour = "_tableRowHour_lnm3d_119";
102530
+ const hours = "_hours_lnm3d_130";
102531
+ const tableRowContent = "_tableRowContent_lnm3d_136";
102532
+ const rowImage = "_rowImage_lnm3d_145";
102533
+ const rowContactContainer = "_rowContactContainer_lnm3d_151";
102534
+ const rowContactText = "_rowContactText_lnm3d_158";
102535
+ const rowContactPhone = "_rowContactPhone_lnm3d_164";
102536
+ const rowSectionContainer = "_rowSectionContainer_lnm3d_171";
102537
+ const rowSectionText = "_rowSectionText_lnm3d_177";
102538
+ const rowSectionSecText = "_rowSectionSecText_lnm3d_183";
102539
+ const rowActionButton = "_rowActionButton_lnm3d_190";
102540
+ const bookingInfoContainer = "_bookingInfoContainer_lnm3d_196";
102541
+ const bookingInfoCardRow = "_bookingInfoCardRow_lnm3d_200";
102542
+ const bookingInfoCardContainer = "_bookingInfoCardContainer_lnm3d_208";
102543
+ const bookingInfoCard = "_bookingInfoCard_lnm3d_200";
102544
+ const bookingInfoCardContent = "_bookingInfoCardContent_lnm3d_220";
102545
+ const bookingInfoCardTitle = "_bookingInfoCardTitle_lnm3d_226";
102546
+ const bookingInfoCardText = "_bookingInfoCardText_lnm3d_229";
102549
102547
  var styles$f = {
102550
102548
  mainConatiner: mainConatiner$1,
102551
102549
  mainTableContainer,
@@ -106060,22 +106058,22 @@ const Label = ({
106060
106058
  }, tooltip2));
106061
106059
  return isHidden2 ? /* @__PURE__ */ React__default.createElement(SrOnly, null, label2) : label2;
106062
106060
  };
106063
- const inputWrapper = "_inputWrapper_zpxow_1";
106064
- const input$2 = "_input_zpxow_1";
106065
- const inputIcon = "_inputIcon_zpxow_74";
106061
+ const inputWrapper = "_inputWrapper_1v87g_1";
106062
+ const input$2 = "_input_1v87g_1";
106063
+ const inputIcon = "_inputIcon_1v87g_73";
106066
106064
  var styles$8 = {
106067
106065
  inputWrapper,
106068
106066
  input: input$2,
106069
- "input--r-md": "_input--r-md_zpxow_36",
106070
- "input--r-sm": "_input--r-sm_zpxow_41",
106071
- "input--with-icon-left": "_input--with-icon-left_zpxow_46",
106072
- "input--with-icon-right": "_input--with-icon-right_zpxow_49",
106073
- "input--filled": "_input--filled_zpxow_52",
106074
- "input--borderless": "_input--borderless_zpxow_55",
106075
- "input--rounded": "_input--rounded_zpxow_59",
106067
+ "input--r-md": "_input--r-md_1v87g_35",
106068
+ "input--r-sm": "_input--r-sm_1v87g_40",
106069
+ "input--with-icon-left": "_input--with-icon-left_1v87g_45",
106070
+ "input--with-icon-right": "_input--with-icon-right_1v87g_48",
106071
+ "input--filled": "_input--filled_1v87g_51",
106072
+ "input--borderless": "_input--borderless_1v87g_54",
106073
+ "input--rounded": "_input--rounded_1v87g_58",
106076
106074
  inputIcon,
106077
- "inputIcon--p-left": "_inputIcon--p-left_zpxow_83",
106078
- "inputIcon--p-right": "_inputIcon--p-right_zpxow_86"
106075
+ "inputIcon--p-left": "_inputIcon--p-left_1v87g_82",
106076
+ "inputIcon--p-right": "_inputIcon--p-right_1v87g_85"
106079
106077
  };
106080
106078
  const Input2 = ({
106081
106079
  id: id2,
@@ -106450,7 +106448,7 @@ const TableTopHeader = ({ date: date4, total }) => {
106450
106448
  const { t: t2 } = useTranslation();
106451
106449
  return /* @__PURE__ */ React__default.createElement("div", {
106452
106450
  className: styles$f.tableTopHeader
106453
- }, /* @__PURE__ */ React__default.createElement("h1", null, date4), /* @__PURE__ */ React__default.createElement("h1", null, total, " ", t2("RESERVATIONS")));
106451
+ }, /* @__PURE__ */ React__default.createElement("h1", null, hooks(date4).format("DD.MM.YYYY")), /* @__PURE__ */ React__default.createElement("h1", null, total, " ", t2("RESERVATIONS")));
106454
106452
  };
106455
106453
  const TimeFormat = ({ dateTime, currentTimeZone }) => {
106456
106454
  const formattedTime = new Date(dateTime).toLocaleTimeString([], {
@@ -106593,20 +106591,22 @@ const TableBody = ({ data: data2, filtersData, venueId }) => {
106593
106591
  if (data2 && filtersData) {
106594
106592
  const groupedByHour = _23.groupBy(data2, (item2) => {
106595
106593
  const formattedTime = new Date(item2.date).toLocaleTimeString([], {
106596
- ...(filtersData == null ? void 0 : filtersData.timeZone) ? {
106597
- timeZone: filtersData == null ? void 0 : filtersData.timeZone
106598
- } : {},
106594
+ ...(filtersData == null ? void 0 : filtersData.timeZone) ? { timeZone: filtersData == null ? void 0 : filtersData.timeZone } : {},
106599
106595
  hour: "2-digit",
106600
106596
  minute: void 0,
106601
106597
  hour12: false
106602
106598
  });
106603
106599
  return `${formattedTime}:00`;
106604
106600
  });
106605
- const sortedGroupedByHour = _23(groupedByHour).toPairs().orderBy(
106601
+ const sortedGroupedByHour = _23(groupedByHour).toPairs().map(([hour2, reservations]) => [
106602
+ hour2,
106603
+ _23.orderBy(reservations, (r2) => new Date(r2.date), ["desc"])
106604
+ ]).orderBy(
106606
106605
  ([hour2]) => parseInt(hour2.split(":")[0], 10),
106607
106606
  ["asc"]
106608
106607
  ).fromPairs().value();
106609
106608
  setFormattedData(sortedGroupedByHour);
106609
+ console.log(sortedGroupedByHour, "sortedGroupedByHour");
106610
106610
  }
106611
106611
  }, [data2, filtersData]);
106612
106612
  return /* @__PURE__ */ React__default.createElement("div", null, _23.isEmpty(formattedData) ? /* @__PURE__ */ React__default.createElement("div", {
@@ -106653,7 +106653,7 @@ var styles$7 = {
106653
106653
  const customStyles = {
106654
106654
  control: (provided, state) => ({
106655
106655
  ...provided,
106656
- backgroundColor: "transparent",
106656
+ backgroundColor: state.isDisabled ? "#25293C" : "transparent",
106657
106657
  border: "none",
106658
106658
  borderBottom: `1px solid ${state.isFocused ? "gray" : "#bbb"}`,
106659
106659
  borderRadius: 0,
@@ -106715,9 +106715,7 @@ const Select = ({
106715
106715
  ...props,
106716
106716
  id: id2,
106717
106717
  isDisabled
106718
- }), isDisabled && /* @__PURE__ */ React__default.createElement("div", {
106719
- className: styles$7.tooltip
106720
- }, /* @__PURE__ */ React__default.createElement(LockTooltip, null, disabledTooltip))));
106718
+ })));
106721
106719
  };
106722
106720
  const SelectField = ({ control, name, ...props }) => {
106723
106721
  return /* @__PURE__ */ React__default.createElement(Controller, {
@@ -106781,9 +106779,7 @@ const TextArea = React__default.forwardRef(
106781
106779
  disabled: disabled2,
106782
106780
  ...props,
106783
106781
  ref
106784
- }), disabled2 && /* @__PURE__ */ React__default.createElement("div", {
106785
- style: { position: "absolute", top: "1rem", right: "1rem" }
106786
- }, /* @__PURE__ */ React__default.createElement(LockTooltip, null, disabledTooltip))));
106782
+ })));
106787
106783
  }
106788
106784
  );
106789
106785
  const TextAreaField = ({ control, name, ...props }) => {
@@ -107017,10 +107013,14 @@ const index$6 = ({ filtersData, venueId }) => {
107017
107013
  "Table is required",
107018
107014
  (value2) => value2 !== null && typeof value2 === "object" && !!value2.value
107019
107015
  ).required(),
107020
- firstName: create$2().required(t2("errors.required")),
107021
- lastName: create$2().required(t2("errors.required")),
107022
- email: create$2().email(t2("errors.email")).required(t2("errors.required")),
107023
- phone: create$2().required(t2("errors.required")).matches(new RegExp(/^\+?[1-9]\d{8,14}$/), t2("errors.phone")),
107016
+ firstName: create$2(),
107017
+ lastName: create$2(),
107018
+ email: create$2().email(t2("errors.email")),
107019
+ phone: create$2().nullable().notRequired().test(
107020
+ "is-valid-phone",
107021
+ t2("errors.phone"),
107022
+ (value2) => !value2 || new RegExp(/^\+?[1-9]\d{8,14}$/).test(value2)
107023
+ ),
107024
107024
  notes: create$2()
107025
107025
  });
107026
107026
  const {
@@ -107028,6 +107028,7 @@ const index$6 = ({ filtersData, venueId }) => {
107028
107028
  reset,
107029
107029
  trigger,
107030
107030
  getValues,
107031
+ setValue: setValue2,
107031
107032
  handleSubmit
107032
107033
  } = useForm({
107033
107034
  mode: "onChange",
@@ -107065,7 +107066,7 @@ const index$6 = ({ filtersData, venueId }) => {
107065
107066
  }
107066
107067
  });
107067
107068
  const onSubmit = async () => {
107068
- var _a2, _b, _c, _d, _e2;
107069
+ var _a2, _b, _c, _d, _e2, _f, _g;
107069
107070
  const data22 = await getValues();
107070
107071
  const result = await trigger();
107071
107072
  if (!result) {
@@ -107093,7 +107094,12 @@ const index$6 = ({ filtersData, venueId }) => {
107093
107094
  });
107094
107095
  reloadMainTable();
107095
107096
  } else {
107096
- executeUpdate({ data: { table: (_e2 = data22 == null ? void 0 : data22.table) == null ? void 0 : _e2.value }, venueId, bookingId: selectedBooking.id });
107097
+ const toSend = {
107098
+ partySize: (_e2 = data22 == null ? void 0 : data22.partySize) == null ? void 0 : _e2.value,
107099
+ table: (_f = data22 == null ? void 0 : data22.table) == null ? void 0 : _f.value,
107100
+ date: data22.date ? moment$1.tz(`${data22.date} ${(_g = data22.time) == null ? void 0 : _g.value}`, currentTimeZone ? currentTimeZone : "").valueOf() / 1e3 : moment$1.tz(moment$1(), currentTimeZone ? currentTimeZone : "").valueOf() / 1e3
107101
+ };
107102
+ executeUpdate({ data: toSend, venueId, bookingId: selectedBooking.id });
107097
107103
  }
107098
107104
  };
107099
107105
  useEffect(() => {
@@ -107167,6 +107173,26 @@ const index$6 = ({ filtersData, venueId }) => {
107167
107173
  }
107168
107174
  }
107169
107175
  }, [date4]);
107176
+ useEffect(() => {
107177
+ if (source2 && source2.code === "WALK-IN") {
107178
+ const currentTime = moment$1();
107179
+ setValue2("date", currentTime.format("YYYY-MM-DD"));
107180
+ if (timeOptions.length > 0) {
107181
+ const validFutureTimes = timeOptions.filter((option) => option.value).map((option) => ({
107182
+ ...option,
107183
+ momentValue: moment$1(option.value, "HH:mm")
107184
+ })).filter((option) => option.momentValue.isSameOrAfter(currentTime));
107185
+ if (validFutureTimes.length > 0) {
107186
+ const closestTime = validFutureTimes.reduce((prev2, curr) => {
107187
+ const prevDiff = Math.abs(currentTime.diff(prev2.momentValue, "minutes"));
107188
+ const currDiff = Math.abs(currentTime.diff(curr.momentValue, "minutes"));
107189
+ return currDiff < prevDiff ? curr : prev2;
107190
+ });
107191
+ setValue2("time", closestTime);
107192
+ }
107193
+ }
107194
+ }
107195
+ }, [source2, timeOptions, setValue2]);
107170
107196
  return /* @__PURE__ */ React__default.createElement("div", {
107171
107197
  style: { display: "flex", flexDirection: "column", gap: 10 },
107172
107198
  onSubmit: handleSubmit(onSubmit)
@@ -107183,7 +107209,6 @@ const index$6 = ({ filtersData, venueId }) => {
107183
107209
  }, /* @__PURE__ */ React__default.createElement("div", {
107184
107210
  style: { width: "50%" }
107185
107211
  }, /* @__PURE__ */ React__default.createElement(TextInputField, {
107186
- disabled: selectedBooking,
107187
107212
  control,
107188
107213
  id: "date",
107189
107214
  name: "date",
@@ -107194,7 +107219,6 @@ const index$6 = ({ filtersData, venueId }) => {
107194
107219
  })), /* @__PURE__ */ React__default.createElement("div", {
107195
107220
  style: { width: "50%" }
107196
107221
  }, /* @__PURE__ */ React__default.createElement(SelectField, {
107197
- isDisabled: selectedBooking,
107198
107222
  control,
107199
107223
  isClearable: true,
107200
107224
  id: "time",
@@ -107206,7 +107230,6 @@ const index$6 = ({ filtersData, venueId }) => {
107206
107230
  }, /* @__PURE__ */ React__default.createElement("div", {
107207
107231
  style: { width: "50%" }
107208
107232
  }, /* @__PURE__ */ React__default.createElement(SelectField, {
107209
- isDisabled: selectedBooking,
107210
107233
  control,
107211
107234
  isClearable: true,
107212
107235
  id: "partySize",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mozrest-sdk-react-dev",
3
- "version": "0.2.74",
3
+ "version": "0.2.76",
4
4
  "main": "mozrest-sdk.es.js",
5
5
  "keywords": ["mozrest"],
6
6
  "author": {