@omniumretail/component-library 1.3.66 → 1.3.67
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.
|
@@ -26664,14 +26664,32 @@ const Header = ({
|
|
|
26664
26664
|
onHomeClick,
|
|
26665
26665
|
showSupport = false,
|
|
26666
26666
|
onSupportModalOpen,
|
|
26667
|
-
onMenuToggle
|
|
26667
|
+
onMenuToggle,
|
|
26668
|
+
supportModalOpen,
|
|
26669
|
+
onSupportModalOpenChange
|
|
26668
26670
|
}) => {
|
|
26669
26671
|
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
|
26670
26672
|
const [activeDropdown, setActiveDropdown] = useState(null);
|
|
26671
|
-
const [
|
|
26673
|
+
const [isSupportModalVisibleInternal, setIsSupportModalVisibleInternal] = useState(false);
|
|
26672
26674
|
const headerRef = useRef(null);
|
|
26673
26675
|
const overlayRef = useRef(null);
|
|
26674
26676
|
const companyLogos = getCompanyLogos(companyName);
|
|
26677
|
+
const isControlled = supportModalOpen !== void 0;
|
|
26678
|
+
const isSupportModalVisible = isControlled ? supportModalOpen : isSupportModalVisibleInternal;
|
|
26679
|
+
const setSupportModalVisible = (value) => {
|
|
26680
|
+
if (isControlled) {
|
|
26681
|
+
onSupportModalOpenChange?.(value);
|
|
26682
|
+
} else {
|
|
26683
|
+
setIsSupportModalVisibleInternal(value);
|
|
26684
|
+
}
|
|
26685
|
+
};
|
|
26686
|
+
const prevSupportModalOpen = useRef(supportModalOpen);
|
|
26687
|
+
useEffect(() => {
|
|
26688
|
+
if (isControlled && supportModalOpen && !prevSupportModalOpen.current && onSupportModalOpen) {
|
|
26689
|
+
onSupportModalOpen();
|
|
26690
|
+
}
|
|
26691
|
+
prevSupportModalOpen.current = supportModalOpen;
|
|
26692
|
+
}, [supportModalOpen, isControlled, onSupportModalOpen]);
|
|
26675
26693
|
const closeMenuAndExecute = (action2, delay = 150) => {
|
|
26676
26694
|
setIsMenuOpen(false);
|
|
26677
26695
|
setActiveDropdown(null);
|
|
@@ -26714,14 +26732,14 @@ const Header = ({
|
|
|
26714
26732
|
if (onSupportModalOpen) {
|
|
26715
26733
|
onSupportModalOpen();
|
|
26716
26734
|
}
|
|
26717
|
-
|
|
26735
|
+
setSupportModalVisible(true);
|
|
26718
26736
|
setIsMenuOpen(false);
|
|
26719
26737
|
};
|
|
26720
26738
|
const handleSupportSubmit = (data) => {
|
|
26721
26739
|
if (onSupportSubmit) {
|
|
26722
26740
|
onSupportSubmit(data);
|
|
26723
26741
|
}
|
|
26724
|
-
|
|
26742
|
+
setSupportModalVisible(false);
|
|
26725
26743
|
};
|
|
26726
26744
|
const menuTopList = getMenuTopList(
|
|
26727
26745
|
onHome
|
|
@@ -26816,7 +26834,7 @@ const Header = ({
|
|
|
26816
26834
|
SupportModal,
|
|
26817
26835
|
{
|
|
26818
26836
|
visible: isSupportModalVisible,
|
|
26819
|
-
onClose: () =>
|
|
26837
|
+
onClose: () => setSupportModalVisible(false),
|
|
26820
26838
|
onSubmit: handleSupportSubmit,
|
|
26821
26839
|
applicationOptions: applicationOptions || []
|
|
26822
26840
|
}
|