@happychef/reservation-sidebar 2.1.3 → 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 CHANGED
@@ -5508,8 +5508,8 @@ var FormField = ({
5508
5508
  halfWidth,
5509
5509
  options = [],
5510
5510
  selectPlaceholder,
5511
- rightIcon: rightIcon2,
5512
- onRightIconClick: onRightIconClick2,
5511
+ rightIcon,
5512
+ onRightIconClick,
5513
5513
  tooltipContent
5514
5514
  }) => {
5515
5515
  const t = getSection(translations_default2, "formField");
@@ -5517,7 +5517,7 @@ var FormField = ({
5517
5517
  const [showTooltip, setShowTooltip] = React9.useState(false);
5518
5518
  const tooltipRef = React9.useRef(null);
5519
5519
  const timerRef = React9.useRef(null);
5520
- const RightIconComponent = rightIcon2;
5520
+ const RightIconComponent = rightIcon;
5521
5521
  const Icon = icon;
5522
5522
  React9.useEffect(() => {
5523
5523
  const handleClickOutside = (e) => {
@@ -5555,7 +5555,7 @@ var FormField = ({
5555
5555
  "div",
5556
5556
  {
5557
5557
  className: "magic-wand-container",
5558
- onClick: onRightIconClick2,
5558
+ onClick: onRightIconClick,
5559
5559
  onMouseEnter: () => {
5560
5560
  if (timerRef.current) clearTimeout(timerRef.current);
5561
5561
  setShowTooltip(true);
@@ -5806,6 +5806,12 @@ var ReservationStepTwo = ({
5806
5806
  const [hasAutofilled, setHasAutofilled] = React9.useState(false);
5807
5807
  const [pendingAutofill, setPendingAutofill] = React9.useState(null);
5808
5808
  const api = useApi_default();
5809
+ const rightIcon = fa.FaMagic;
5810
+ const onRightIconClick = () => {
5811
+ if (pendingAutofill) {
5812
+ applyAutofill();
5813
+ }
5814
+ };
5809
5815
  React9.useEffect(() => {
5810
5816
  moment2__default.default.locale(lang);
5811
5817
  if (!formData.date || !formData.time || !menuData.length) return setAvailableMenus([]);
@@ -5855,15 +5861,23 @@ var ReservationStepTwo = ({
5855
5861
  React9.useEffect(() => {
5856
5862
  tryAutofill();
5857
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
+ };
5858
5876
  const magicProps = React9.useMemo(() => {
5859
- if (!pendingAutofill)
5860
- return { email: {}, phone: {} };
5877
+ if (!pendingAutofill) return { email: {}, phone: {} };
5861
5878
  const emailActive = pendingAutofill.sources.includes("email") && (formData.email || "").trim().toLowerCase() === pendingAutofill.email.trim().toLowerCase();
5862
5879
  const phoneActive = pendingAutofill.sources.includes("phone") && (formData.phone || "").trim() === pendingAutofill.phone.trim();
5863
- const common = {
5864
- rightIcon,
5865
- onRightIconClick
5866
- };
5880
+ const common = { rightIcon, onRightIconClick };
5867
5881
  return {
5868
5882
  email: emailActive ? {
5869
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;
@@ -5499,8 +5499,8 @@ var FormField = ({
5499
5499
  halfWidth,
5500
5500
  options = [],
5501
5501
  selectPlaceholder,
5502
- rightIcon: rightIcon2,
5503
- onRightIconClick: onRightIconClick2,
5502
+ rightIcon,
5503
+ onRightIconClick,
5504
5504
  tooltipContent
5505
5505
  }) => {
5506
5506
  const t = getSection(translations_default2, "formField");
@@ -5508,7 +5508,7 @@ var FormField = ({
5508
5508
  const [showTooltip, setShowTooltip] = useState(false);
5509
5509
  const tooltipRef = useRef(null);
5510
5510
  const timerRef = useRef(null);
5511
- const RightIconComponent = rightIcon2;
5511
+ const RightIconComponent = rightIcon;
5512
5512
  const Icon = icon;
5513
5513
  useEffect(() => {
5514
5514
  const handleClickOutside = (e) => {
@@ -5546,7 +5546,7 @@ var FormField = ({
5546
5546
  "div",
5547
5547
  {
5548
5548
  className: "magic-wand-container",
5549
- onClick: onRightIconClick2,
5549
+ onClick: onRightIconClick,
5550
5550
  onMouseEnter: () => {
5551
5551
  if (timerRef.current) clearTimeout(timerRef.current);
5552
5552
  setShowTooltip(true);
@@ -5797,6 +5797,12 @@ var ReservationStepTwo = ({
5797
5797
  const [hasAutofilled, setHasAutofilled] = useState(false);
5798
5798
  const [pendingAutofill, setPendingAutofill] = useState(null);
5799
5799
  const api = useApi_default();
5800
+ const rightIcon = FaMagic;
5801
+ const onRightIconClick = () => {
5802
+ if (pendingAutofill) {
5803
+ applyAutofill();
5804
+ }
5805
+ };
5800
5806
  useEffect(() => {
5801
5807
  moment2.locale(lang);
5802
5808
  if (!formData.date || !formData.time || !menuData.length) return setAvailableMenus([]);
@@ -5846,15 +5852,23 @@ var ReservationStepTwo = ({
5846
5852
  useEffect(() => {
5847
5853
  tryAutofill();
5848
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
+ };
5849
5867
  const magicProps = useMemo(() => {
5850
- if (!pendingAutofill)
5851
- return { email: {}, phone: {} };
5868
+ if (!pendingAutofill) return { email: {}, phone: {} };
5852
5869
  const emailActive = pendingAutofill.sources.includes("email") && (formData.email || "").trim().toLowerCase() === pendingAutofill.email.trim().toLowerCase();
5853
5870
  const phoneActive = pendingAutofill.sources.includes("phone") && (formData.phone || "").trim() === pendingAutofill.phone.trim();
5854
- const common = {
5855
- rightIcon,
5856
- onRightIconClick
5857
- };
5871
+ const common = { rightIcon, onRightIconClick };
5858
5872
  return {
5859
5873
  email: emailActive ? {
5860
5874
  ...common,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happychef/reservation-sidebar",
3
- "version": "2.1.3",
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",