@happychef/reservation-sidebar 2.1.2 → 2.1.4
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/index.js +34 -27
- package/dist/index.mjs +35 -28
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4769,9 +4769,6 @@ var Calendar = ({
|
|
|
4769
4769
|
}))))))));
|
|
4770
4770
|
};
|
|
4771
4771
|
var Calendar_default = Calendar;
|
|
4772
|
-
|
|
4773
|
-
// src/components/ReservationStepOne/DateSelector.js
|
|
4774
|
-
var import_moment = __toESM(require_moment());
|
|
4775
4772
|
var DateSelector = ({
|
|
4776
4773
|
guests: guests2,
|
|
4777
4774
|
formData,
|
|
@@ -4784,12 +4781,12 @@ var DateSelector = ({
|
|
|
4784
4781
|
reservationMode
|
|
4785
4782
|
}) => {
|
|
4786
4783
|
const handleDateSelect = (date) => {
|
|
4787
|
-
const formatted =
|
|
4784
|
+
const formatted = moment2__default.default(date).format("YYYY-MM-DD");
|
|
4788
4785
|
console.log("Selected date:", formatted);
|
|
4789
4786
|
handleChange({ target: { name: "date", value: formatted } });
|
|
4790
4787
|
resetFormDataFields(["time"]);
|
|
4791
4788
|
};
|
|
4792
|
-
const monthStartDate = startDate ? startDate.clone().startOf("month") :
|
|
4789
|
+
const monthStartDate = startDate ? startDate.clone().startOf("month") : moment2__default.default().startOf("month");
|
|
4793
4790
|
return /* @__PURE__ */ React9__default.default.createElement("div", { className: "form-group date-selector-container" }, /* @__PURE__ */ React9__default.default.createElement(
|
|
4794
4791
|
Calendar_default,
|
|
4795
4792
|
{
|
|
@@ -5108,9 +5105,6 @@ var TableSelector_default = TableSelector;
|
|
|
5108
5105
|
|
|
5109
5106
|
// src/components/ReservationStepOne/css/reservationMode.css
|
|
5110
5107
|
styleInject(".new-reservation-page .form-row .field-label {\n display: block;\n margin-bottom: 6px;\n font-weight: 600;\n}\n.new-reservation-page .form-row .reservation-mode-buttons {\n margin-top: 0;\n}\n.new-reservation-page .reservation-mode-buttons {\n display: flex;\n gap: 10px;\n margin-top: 10px;\n}\n.new-reservation-page .reservation-mode-button {\n flex: 1;\n padding: 10px;\n border: 1px solid #ccc;\n border-radius: var(--border-radius);\n background-color: var(--color-white);\n cursor: pointer;\n font-size: 1rem;\n transition: background-color 0.3s ease, color 0.3s ease;\n}\n.new-reservation-page .reservation-mode-button.active,\n.new-reservation-page .reservation-mode-button:hover {\n background-color: var(--color-blue);\n color: var(--color-white);\n}\n.new-reservation-page .reservation-modes-container {\n display: flex;\n flex-wrap: wrap;\n margin: 0 -5px;\n width: 100%;\n}\n.new-reservation-page .reservation-mode-button {\n flex: 0 0 calc(50% - 10px);\n margin: 5px;\n padding: 10px;\n box-sizing: border-box;\n text-align: center;\n border: 1px solid #ccc;\n background: #f7f7f7;\n cursor: pointer;\n}\n.new-reservation-page .reservation-mode-button:nth-child(3) {\n flex: 0 0 100%;\n}\n.new-reservation-page .reservation-modes-container {\n display: flex;\n flex-wrap: wrap;\n margin: 0 -5px;\n width: 100%;\n}\n.new-reservation-page .reservation-mode-button {\n flex: 0 0 calc(50% - 10px);\n margin: 5px;\n padding: 10px;\n box-sizing: border-box;\n text-align: center;\n border: 1px solid #ccc;\n background: #f7f7f7;\n cursor: pointer;\n}\n.new-reservation-page .reservation-mode-button.active,\n.new-reservation-page .reservation-mode-button:hover {\n background-color: var(--color-blue);\n color: var(--color-white);\n}\n.new-reservation-page .unlimited-mode-warning {\n display: flex;\n align-items: flex-start;\n gap: 10px;\n margin: 15px 0;\n padding: 12px 15px;\n background-color: #fff3cd;\n border: 1px solid #ffeaa7;\n border-radius: var(--border-radius, 4px);\n border-left: 4px solid #e67e22;\n font-size: 0.9rem;\n line-height: 1.4;\n}\n.new-reservation-page .unlimited-mode-warning .warning-icon {\n color: #e67e22;\n font-size: 1.1rem;\n margin-top: 2px;\n flex-shrink: 0;\n}\n.new-reservation-page .unlimited-mode-warning .warning-text {\n color: #856404;\n margin: 0;\n}\n@media screen and (max-width: 480px) {\n .new-reservation-page .unlimited-mode-warning {\n margin: 10px 0;\n padding: 10px 12px;\n font-size: 0.85rem;\n }\n .new-reservation-page .unlimited-mode-warning .warning-icon {\n font-size: 1rem;\n }\n}\n.new-reservation-page .reservation-sidebar-component {\n position: fixed;\n top: 0;\n right: -400px;\n width: 400px;\n height: 100%;\n background-color: #fff;\n box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);\n z-index: var(--z-index-sidebar-reservation);\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n transition: right 0.3s ease-in-out;\n}\n.new-reservation-page .admin-title {\n text-align: center;\n margin-bottom: 30px;\n}\n.new-reservation-page .reservation-sidebar-component.open {\n right: 0;\n}\n.new-reservation-page .reservation-sidebar-content {\n padding: 20px;\n padding-top: 60px;\n}\n.new-reservation-page .close-sidebar-button {\n position: absolute;\n top: 10px;\n left: 10px;\n background-color: transparent;\n border: none;\n cursor: pointer;\n}\n.new-reservation-page .close-sidebar-button svg {\n color: #000;\n}\n.new-reservation-page .sidebar-section-one,\n.new-reservation-page .sidebar-section-two {\n margin-bottom: 20px;\n}\n.new-reservation-page .reservation-footer {\n margin-top: auto;\n}\n.new-reservation-page .store-reservation-button {\n width: 100%;\n padding: 12px;\n background-color: var(--color-blue);\n color: #fff;\n border: none;\n border-radius: 5px;\n cursor: pointer;\n font-size: 1.1rem;\n}\n.new-reservation-page .open-sidebar-button {\n position: fixed;\n bottom: 20px;\n right: 20px;\n background-color: var(--color-blue);\n color: #fff;\n border: none;\n border-radius: 50%;\n width: 50px;\n height: 50px;\n cursor: pointer;\n z-index: var(--z-index-modal) !important;\n transition: all 0.3s ease;\n}\n.new-reservation-page .open-sidebar-button:hover {\n background-color: var(--color-blue-hover-accent) !important;\n}\n.new-reservation-page .open-sidebar-button svg {\n position: relative;\n top: 2px;\n}\n@media screen and (max-width: 480px) {\n .new-reservation-page .reservation-sidebar-component {\n width: 100%;\n }\n}\n.new-reservation-page .sidebar-section-personeel {\n margin-bottom: 10px;\n}\n");
|
|
5111
|
-
|
|
5112
|
-
// src/components/ReservationStepOne/index.js
|
|
5113
|
-
var import_moment2 = __toESM(require_moment());
|
|
5114
5108
|
var useApi = () => {
|
|
5115
5109
|
const getJwtToken = React9.useCallback(() => {
|
|
5116
5110
|
return localStorage.getItem("accessToken");
|
|
@@ -5208,7 +5202,7 @@ var ReservationStepOne = ({
|
|
|
5208
5202
|
[setFormData]
|
|
5209
5203
|
);
|
|
5210
5204
|
React9.useEffect(() => {
|
|
5211
|
-
const today =
|
|
5205
|
+
const today = moment2__default.default().tz("Europe/Amsterdam").startOf("day");
|
|
5212
5206
|
let firstWeekStart = today.clone().startOf("isoWeek");
|
|
5213
5207
|
while (isWeekInPast(firstWeekStart)) {
|
|
5214
5208
|
firstWeekStart.add(1, "week");
|
|
@@ -5514,8 +5508,8 @@ var FormField = ({
|
|
|
5514
5508
|
halfWidth,
|
|
5515
5509
|
options = [],
|
|
5516
5510
|
selectPlaceholder,
|
|
5517
|
-
rightIcon
|
|
5518
|
-
onRightIconClick
|
|
5511
|
+
rightIcon,
|
|
5512
|
+
onRightIconClick,
|
|
5519
5513
|
tooltipContent
|
|
5520
5514
|
}) => {
|
|
5521
5515
|
const t = getSection(translations_default2, "formField");
|
|
@@ -5523,7 +5517,7 @@ var FormField = ({
|
|
|
5523
5517
|
const [showTooltip, setShowTooltip] = React9.useState(false);
|
|
5524
5518
|
const tooltipRef = React9.useRef(null);
|
|
5525
5519
|
const timerRef = React9.useRef(null);
|
|
5526
|
-
const RightIconComponent =
|
|
5520
|
+
const RightIconComponent = rightIcon;
|
|
5527
5521
|
const Icon = icon;
|
|
5528
5522
|
React9.useEffect(() => {
|
|
5529
5523
|
const handleClickOutside = (e) => {
|
|
@@ -5561,7 +5555,7 @@ var FormField = ({
|
|
|
5561
5555
|
"div",
|
|
5562
5556
|
{
|
|
5563
5557
|
className: "magic-wand-container",
|
|
5564
|
-
onClick:
|
|
5558
|
+
onClick: onRightIconClick,
|
|
5565
5559
|
onMouseEnter: () => {
|
|
5566
5560
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
5567
5561
|
setShowTooltip(true);
|
|
@@ -5669,7 +5663,6 @@ var FormField = ({
|
|
|
5669
5663
|
var FormField_default = FormField;
|
|
5670
5664
|
|
|
5671
5665
|
// src/components/ReservationStepTwo/ReservationStepTwo.js
|
|
5672
|
-
var import_moment3 = __toESM(require_moment());
|
|
5673
5666
|
__toESM(require_nl());
|
|
5674
5667
|
|
|
5675
5668
|
// src/components/ReservationStepTwo/translations.json
|
|
@@ -5813,20 +5806,26 @@ var ReservationStepTwo = ({
|
|
|
5813
5806
|
const [hasAutofilled, setHasAutofilled] = React9.useState(false);
|
|
5814
5807
|
const [pendingAutofill, setPendingAutofill] = React9.useState(null);
|
|
5815
5808
|
const api = useApi_default();
|
|
5809
|
+
const rightIcon = fa.FaMagic;
|
|
5810
|
+
const onRightIconClick = () => {
|
|
5811
|
+
if (pendingAutofill) {
|
|
5812
|
+
applyAutofill();
|
|
5813
|
+
}
|
|
5814
|
+
};
|
|
5816
5815
|
React9.useEffect(() => {
|
|
5817
|
-
|
|
5816
|
+
moment2__default.default.locale(lang);
|
|
5818
5817
|
if (!formData.date || !formData.time || !menuData.length) return setAvailableMenus([]);
|
|
5819
|
-
const sel =
|
|
5818
|
+
const sel = moment2__default.default(`${formData.date} ${formData.time}`, "YYYY-MM-DD HH:mm");
|
|
5820
5819
|
const filtered = menuData.filter((menu) => {
|
|
5821
5820
|
const inDate = sel.isBetween(
|
|
5822
|
-
|
|
5823
|
-
|
|
5821
|
+
moment2__default.default(menu.startDate, "YYYY-MM-DD"),
|
|
5822
|
+
moment2__default.default(menu.endDate, "YYYY-MM-DD"),
|
|
5824
5823
|
"day",
|
|
5825
5824
|
"[]"
|
|
5826
5825
|
);
|
|
5827
|
-
const inTime =
|
|
5828
|
-
|
|
5829
|
-
|
|
5826
|
+
const inTime = moment2__default.default(formData.time, "HH:mm").isBetween(
|
|
5827
|
+
moment2__default.default(menu.startHour, "HH:mm"),
|
|
5828
|
+
moment2__default.default(menu.endHour, "HH:mm"),
|
|
5830
5829
|
"minute",
|
|
5831
5830
|
"[]"
|
|
5832
5831
|
);
|
|
@@ -5862,15 +5861,23 @@ var ReservationStepTwo = ({
|
|
|
5862
5861
|
React9.useEffect(() => {
|
|
5863
5862
|
tryAutofill();
|
|
5864
5863
|
}, [formData.email, formData.phone]);
|
|
5864
|
+
const applyAutofill = () => {
|
|
5865
|
+
if (!pendingAutofill) return;
|
|
5866
|
+
setFormData((prev) => ({
|
|
5867
|
+
...prev,
|
|
5868
|
+
firstName: pendingAutofill.firstName,
|
|
5869
|
+
lastName: pendingAutofill.lastName,
|
|
5870
|
+
email: pendingAutofill.email,
|
|
5871
|
+
phone: pendingAutofill.phone
|
|
5872
|
+
}));
|
|
5873
|
+
setHasAutofilled(true);
|
|
5874
|
+
setPendingAutofill(null);
|
|
5875
|
+
};
|
|
5865
5876
|
const magicProps = React9.useMemo(() => {
|
|
5866
|
-
if (!pendingAutofill)
|
|
5867
|
-
return { email: {}, phone: {} };
|
|
5877
|
+
if (!pendingAutofill) return { email: {}, phone: {} };
|
|
5868
5878
|
const emailActive = pendingAutofill.sources.includes("email") && (formData.email || "").trim().toLowerCase() === pendingAutofill.email.trim().toLowerCase();
|
|
5869
5879
|
const phoneActive = pendingAutofill.sources.includes("phone") && (formData.phone || "").trim() === pendingAutofill.phone.trim();
|
|
5870
|
-
const common = {
|
|
5871
|
-
rightIcon,
|
|
5872
|
-
onRightIconClick
|
|
5873
|
-
};
|
|
5880
|
+
const common = { rightIcon, onRightIconClick };
|
|
5874
5881
|
return {
|
|
5875
5882
|
email: emailActive ? {
|
|
5876
5883
|
...common,
|
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { getAvailableTablesForTime, getAvailableTimeblocks, getAvailableTimebloc
|
|
|
5
5
|
import { DateTime } from 'luxon';
|
|
6
6
|
import axios from 'axios';
|
|
7
7
|
import Lottie from 'lottie-react';
|
|
8
|
-
import { FaUser, FaEnvelope, FaPhone, FaInfoCircle, FaTimes } from 'react-icons/fa';
|
|
8
|
+
import { FaMagic, FaUser, FaEnvelope, FaPhone, FaInfoCircle, FaTimes } from 'react-icons/fa';
|
|
9
9
|
|
|
10
10
|
var __create = Object.create;
|
|
11
11
|
var __defProp = Object.defineProperty;
|
|
@@ -4760,9 +4760,6 @@ var Calendar = ({
|
|
|
4760
4760
|
}))))))));
|
|
4761
4761
|
};
|
|
4762
4762
|
var Calendar_default = Calendar;
|
|
4763
|
-
|
|
4764
|
-
// src/components/ReservationStepOne/DateSelector.js
|
|
4765
|
-
var import_moment = __toESM(require_moment());
|
|
4766
4763
|
var DateSelector = ({
|
|
4767
4764
|
guests: guests2,
|
|
4768
4765
|
formData,
|
|
@@ -4775,12 +4772,12 @@ var DateSelector = ({
|
|
|
4775
4772
|
reservationMode
|
|
4776
4773
|
}) => {
|
|
4777
4774
|
const handleDateSelect = (date) => {
|
|
4778
|
-
const formatted = (
|
|
4775
|
+
const formatted = moment2(date).format("YYYY-MM-DD");
|
|
4779
4776
|
console.log("Selected date:", formatted);
|
|
4780
4777
|
handleChange({ target: { name: "date", value: formatted } });
|
|
4781
4778
|
resetFormDataFields(["time"]);
|
|
4782
4779
|
};
|
|
4783
|
-
const monthStartDate = startDate ? startDate.clone().startOf("month") : (
|
|
4780
|
+
const monthStartDate = startDate ? startDate.clone().startOf("month") : moment2().startOf("month");
|
|
4784
4781
|
return /* @__PURE__ */ React9.createElement("div", { className: "form-group date-selector-container" }, /* @__PURE__ */ React9.createElement(
|
|
4785
4782
|
Calendar_default,
|
|
4786
4783
|
{
|
|
@@ -5099,9 +5096,6 @@ var TableSelector_default = TableSelector;
|
|
|
5099
5096
|
|
|
5100
5097
|
// src/components/ReservationStepOne/css/reservationMode.css
|
|
5101
5098
|
styleInject(".new-reservation-page .form-row .field-label {\n display: block;\n margin-bottom: 6px;\n font-weight: 600;\n}\n.new-reservation-page .form-row .reservation-mode-buttons {\n margin-top: 0;\n}\n.new-reservation-page .reservation-mode-buttons {\n display: flex;\n gap: 10px;\n margin-top: 10px;\n}\n.new-reservation-page .reservation-mode-button {\n flex: 1;\n padding: 10px;\n border: 1px solid #ccc;\n border-radius: var(--border-radius);\n background-color: var(--color-white);\n cursor: pointer;\n font-size: 1rem;\n transition: background-color 0.3s ease, color 0.3s ease;\n}\n.new-reservation-page .reservation-mode-button.active,\n.new-reservation-page .reservation-mode-button:hover {\n background-color: var(--color-blue);\n color: var(--color-white);\n}\n.new-reservation-page .reservation-modes-container {\n display: flex;\n flex-wrap: wrap;\n margin: 0 -5px;\n width: 100%;\n}\n.new-reservation-page .reservation-mode-button {\n flex: 0 0 calc(50% - 10px);\n margin: 5px;\n padding: 10px;\n box-sizing: border-box;\n text-align: center;\n border: 1px solid #ccc;\n background: #f7f7f7;\n cursor: pointer;\n}\n.new-reservation-page .reservation-mode-button:nth-child(3) {\n flex: 0 0 100%;\n}\n.new-reservation-page .reservation-modes-container {\n display: flex;\n flex-wrap: wrap;\n margin: 0 -5px;\n width: 100%;\n}\n.new-reservation-page .reservation-mode-button {\n flex: 0 0 calc(50% - 10px);\n margin: 5px;\n padding: 10px;\n box-sizing: border-box;\n text-align: center;\n border: 1px solid #ccc;\n background: #f7f7f7;\n cursor: pointer;\n}\n.new-reservation-page .reservation-mode-button.active,\n.new-reservation-page .reservation-mode-button:hover {\n background-color: var(--color-blue);\n color: var(--color-white);\n}\n.new-reservation-page .unlimited-mode-warning {\n display: flex;\n align-items: flex-start;\n gap: 10px;\n margin: 15px 0;\n padding: 12px 15px;\n background-color: #fff3cd;\n border: 1px solid #ffeaa7;\n border-radius: var(--border-radius, 4px);\n border-left: 4px solid #e67e22;\n font-size: 0.9rem;\n line-height: 1.4;\n}\n.new-reservation-page .unlimited-mode-warning .warning-icon {\n color: #e67e22;\n font-size: 1.1rem;\n margin-top: 2px;\n flex-shrink: 0;\n}\n.new-reservation-page .unlimited-mode-warning .warning-text {\n color: #856404;\n margin: 0;\n}\n@media screen and (max-width: 480px) {\n .new-reservation-page .unlimited-mode-warning {\n margin: 10px 0;\n padding: 10px 12px;\n font-size: 0.85rem;\n }\n .new-reservation-page .unlimited-mode-warning .warning-icon {\n font-size: 1rem;\n }\n}\n.new-reservation-page .reservation-sidebar-component {\n position: fixed;\n top: 0;\n right: -400px;\n width: 400px;\n height: 100%;\n background-color: #fff;\n box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);\n z-index: var(--z-index-sidebar-reservation);\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n transition: right 0.3s ease-in-out;\n}\n.new-reservation-page .admin-title {\n text-align: center;\n margin-bottom: 30px;\n}\n.new-reservation-page .reservation-sidebar-component.open {\n right: 0;\n}\n.new-reservation-page .reservation-sidebar-content {\n padding: 20px;\n padding-top: 60px;\n}\n.new-reservation-page .close-sidebar-button {\n position: absolute;\n top: 10px;\n left: 10px;\n background-color: transparent;\n border: none;\n cursor: pointer;\n}\n.new-reservation-page .close-sidebar-button svg {\n color: #000;\n}\n.new-reservation-page .sidebar-section-one,\n.new-reservation-page .sidebar-section-two {\n margin-bottom: 20px;\n}\n.new-reservation-page .reservation-footer {\n margin-top: auto;\n}\n.new-reservation-page .store-reservation-button {\n width: 100%;\n padding: 12px;\n background-color: var(--color-blue);\n color: #fff;\n border: none;\n border-radius: 5px;\n cursor: pointer;\n font-size: 1.1rem;\n}\n.new-reservation-page .open-sidebar-button {\n position: fixed;\n bottom: 20px;\n right: 20px;\n background-color: var(--color-blue);\n color: #fff;\n border: none;\n border-radius: 50%;\n width: 50px;\n height: 50px;\n cursor: pointer;\n z-index: var(--z-index-modal) !important;\n transition: all 0.3s ease;\n}\n.new-reservation-page .open-sidebar-button:hover {\n background-color: var(--color-blue-hover-accent) !important;\n}\n.new-reservation-page .open-sidebar-button svg {\n position: relative;\n top: 2px;\n}\n@media screen and (max-width: 480px) {\n .new-reservation-page .reservation-sidebar-component {\n width: 100%;\n }\n}\n.new-reservation-page .sidebar-section-personeel {\n margin-bottom: 10px;\n}\n");
|
|
5102
|
-
|
|
5103
|
-
// src/components/ReservationStepOne/index.js
|
|
5104
|
-
var import_moment2 = __toESM(require_moment());
|
|
5105
5099
|
var useApi = () => {
|
|
5106
5100
|
const getJwtToken = useCallback(() => {
|
|
5107
5101
|
return localStorage.getItem("accessToken");
|
|
@@ -5199,7 +5193,7 @@ var ReservationStepOne = ({
|
|
|
5199
5193
|
[setFormData]
|
|
5200
5194
|
);
|
|
5201
5195
|
useEffect(() => {
|
|
5202
|
-
const today = (
|
|
5196
|
+
const today = moment2().tz("Europe/Amsterdam").startOf("day");
|
|
5203
5197
|
let firstWeekStart = today.clone().startOf("isoWeek");
|
|
5204
5198
|
while (isWeekInPast(firstWeekStart)) {
|
|
5205
5199
|
firstWeekStart.add(1, "week");
|
|
@@ -5505,8 +5499,8 @@ var FormField = ({
|
|
|
5505
5499
|
halfWidth,
|
|
5506
5500
|
options = [],
|
|
5507
5501
|
selectPlaceholder,
|
|
5508
|
-
rightIcon
|
|
5509
|
-
onRightIconClick
|
|
5502
|
+
rightIcon,
|
|
5503
|
+
onRightIconClick,
|
|
5510
5504
|
tooltipContent
|
|
5511
5505
|
}) => {
|
|
5512
5506
|
const t = getSection(translations_default2, "formField");
|
|
@@ -5514,7 +5508,7 @@ var FormField = ({
|
|
|
5514
5508
|
const [showTooltip, setShowTooltip] = useState(false);
|
|
5515
5509
|
const tooltipRef = useRef(null);
|
|
5516
5510
|
const timerRef = useRef(null);
|
|
5517
|
-
const RightIconComponent =
|
|
5511
|
+
const RightIconComponent = rightIcon;
|
|
5518
5512
|
const Icon = icon;
|
|
5519
5513
|
useEffect(() => {
|
|
5520
5514
|
const handleClickOutside = (e) => {
|
|
@@ -5552,7 +5546,7 @@ var FormField = ({
|
|
|
5552
5546
|
"div",
|
|
5553
5547
|
{
|
|
5554
5548
|
className: "magic-wand-container",
|
|
5555
|
-
onClick:
|
|
5549
|
+
onClick: onRightIconClick,
|
|
5556
5550
|
onMouseEnter: () => {
|
|
5557
5551
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
5558
5552
|
setShowTooltip(true);
|
|
@@ -5660,7 +5654,6 @@ var FormField = ({
|
|
|
5660
5654
|
var FormField_default = FormField;
|
|
5661
5655
|
|
|
5662
5656
|
// src/components/ReservationStepTwo/ReservationStepTwo.js
|
|
5663
|
-
var import_moment3 = __toESM(require_moment());
|
|
5664
5657
|
__toESM(require_nl());
|
|
5665
5658
|
|
|
5666
5659
|
// src/components/ReservationStepTwo/translations.json
|
|
@@ -5804,20 +5797,26 @@ var ReservationStepTwo = ({
|
|
|
5804
5797
|
const [hasAutofilled, setHasAutofilled] = useState(false);
|
|
5805
5798
|
const [pendingAutofill, setPendingAutofill] = useState(null);
|
|
5806
5799
|
const api = useApi_default();
|
|
5800
|
+
const rightIcon = FaMagic;
|
|
5801
|
+
const onRightIconClick = () => {
|
|
5802
|
+
if (pendingAutofill) {
|
|
5803
|
+
applyAutofill();
|
|
5804
|
+
}
|
|
5805
|
+
};
|
|
5807
5806
|
useEffect(() => {
|
|
5808
|
-
|
|
5807
|
+
moment2.locale(lang);
|
|
5809
5808
|
if (!formData.date || !formData.time || !menuData.length) return setAvailableMenus([]);
|
|
5810
|
-
const sel = (
|
|
5809
|
+
const sel = moment2(`${formData.date} ${formData.time}`, "YYYY-MM-DD HH:mm");
|
|
5811
5810
|
const filtered = menuData.filter((menu) => {
|
|
5812
5811
|
const inDate = sel.isBetween(
|
|
5813
|
-
(
|
|
5814
|
-
(
|
|
5812
|
+
moment2(menu.startDate, "YYYY-MM-DD"),
|
|
5813
|
+
moment2(menu.endDate, "YYYY-MM-DD"),
|
|
5815
5814
|
"day",
|
|
5816
5815
|
"[]"
|
|
5817
5816
|
);
|
|
5818
|
-
const inTime = (
|
|
5819
|
-
(
|
|
5820
|
-
(
|
|
5817
|
+
const inTime = moment2(formData.time, "HH:mm").isBetween(
|
|
5818
|
+
moment2(menu.startHour, "HH:mm"),
|
|
5819
|
+
moment2(menu.endHour, "HH:mm"),
|
|
5821
5820
|
"minute",
|
|
5822
5821
|
"[]"
|
|
5823
5822
|
);
|
|
@@ -5853,15 +5852,23 @@ var ReservationStepTwo = ({
|
|
|
5853
5852
|
useEffect(() => {
|
|
5854
5853
|
tryAutofill();
|
|
5855
5854
|
}, [formData.email, formData.phone]);
|
|
5855
|
+
const applyAutofill = () => {
|
|
5856
|
+
if (!pendingAutofill) return;
|
|
5857
|
+
setFormData((prev) => ({
|
|
5858
|
+
...prev,
|
|
5859
|
+
firstName: pendingAutofill.firstName,
|
|
5860
|
+
lastName: pendingAutofill.lastName,
|
|
5861
|
+
email: pendingAutofill.email,
|
|
5862
|
+
phone: pendingAutofill.phone
|
|
5863
|
+
}));
|
|
5864
|
+
setHasAutofilled(true);
|
|
5865
|
+
setPendingAutofill(null);
|
|
5866
|
+
};
|
|
5856
5867
|
const magicProps = useMemo(() => {
|
|
5857
|
-
if (!pendingAutofill)
|
|
5858
|
-
return { email: {}, phone: {} };
|
|
5868
|
+
if (!pendingAutofill) return { email: {}, phone: {} };
|
|
5859
5869
|
const emailActive = pendingAutofill.sources.includes("email") && (formData.email || "").trim().toLowerCase() === pendingAutofill.email.trim().toLowerCase();
|
|
5860
5870
|
const phoneActive = pendingAutofill.sources.includes("phone") && (formData.phone || "").trim() === pendingAutofill.phone.trim();
|
|
5861
|
-
const common = {
|
|
5862
|
-
rightIcon,
|
|
5863
|
-
onRightIconClick
|
|
5864
|
-
};
|
|
5871
|
+
const common = { rightIcon, onRightIconClick };
|
|
5865
5872
|
return {
|
|
5866
5873
|
email: emailActive ? {
|
|
5867
5874
|
...common,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happychef/reservation-sidebar",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "A compound component for managing restaurant reservations - JavaScript version with independent styles",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|