ba-js-common-header 0.0.21 → 0.0.24
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.
|
@@ -23673,6 +23673,14 @@ function World(props) {
|
|
|
23673
23673
|
});
|
|
23674
23674
|
});
|
|
23675
23675
|
})(commonThin);
|
|
23676
|
+
function useOutsideClickHandler(ref, handleOutsideClick) {
|
|
23677
|
+
useEffect(() => {
|
|
23678
|
+
document.addEventListener("click", handleOutsideClick);
|
|
23679
|
+
return () => {
|
|
23680
|
+
document.removeEventListener("click", handleOutsideClick);
|
|
23681
|
+
};
|
|
23682
|
+
}, [ref]);
|
|
23683
|
+
}
|
|
23676
23684
|
function isNotification(notifications) {
|
|
23677
23685
|
return Array.isArray(notifications) && notifications.length > 0;
|
|
23678
23686
|
}
|
|
@@ -23683,6 +23691,7 @@ function Notifications() {
|
|
|
23683
23691
|
const {
|
|
23684
23692
|
notifications: notificationsConfig
|
|
23685
23693
|
} = useSelector((state) => state.titleBar);
|
|
23694
|
+
const [showNotifications, setShowNotifications] = useState(false);
|
|
23686
23695
|
const notifications = useSelector((state) => state.notifications);
|
|
23687
23696
|
const userLanguage = useSelector((state) => state.userLanguage);
|
|
23688
23697
|
const {
|
|
@@ -23692,6 +23701,10 @@ function Notifications() {
|
|
|
23692
23701
|
const styles = useSpring({
|
|
23693
23702
|
opacity: isMobileOrTablet && isOpen ? 0 : 1
|
|
23694
23703
|
});
|
|
23704
|
+
const ref = useRef();
|
|
23705
|
+
useOutsideClickHandler(ref, () => {
|
|
23706
|
+
setShowNotifications(false);
|
|
23707
|
+
});
|
|
23695
23708
|
const dispatch = useDispatch();
|
|
23696
23709
|
useEffect(() => {
|
|
23697
23710
|
(async () => {
|
|
@@ -23720,12 +23733,16 @@ function Notifications() {
|
|
|
23720
23733
|
}) => acc + items.length, 0));
|
|
23721
23734
|
}
|
|
23722
23735
|
}, [userLanguage, notifications]);
|
|
23736
|
+
if (!notificationsLang)
|
|
23737
|
+
return null;
|
|
23723
23738
|
return /* @__PURE__ */ jsx(animated.div, {
|
|
23724
23739
|
className: cn("col-auto", "pe-lg-0", "order-lg-4", {
|
|
23725
23740
|
"hd-ringing": !notified
|
|
23726
23741
|
}),
|
|
23727
|
-
onClick: () => {
|
|
23742
|
+
onClick: (e2) => {
|
|
23743
|
+
e2.stopPropagation();
|
|
23728
23744
|
setNotified(true);
|
|
23745
|
+
setShowNotifications(!showNotifications);
|
|
23729
23746
|
},
|
|
23730
23747
|
id: "hd-notifications",
|
|
23731
23748
|
style: styles,
|
|
@@ -23739,8 +23756,6 @@ function Notifications() {
|
|
|
23739
23756
|
className: "btn px-0 py-2 dropdown-toggle",
|
|
23740
23757
|
type: "button",
|
|
23741
23758
|
id: "hd-dropdown-notifications",
|
|
23742
|
-
"aria-haspopup": "true",
|
|
23743
|
-
"aria-expanded": "false",
|
|
23744
23759
|
children: [/* @__PURE__ */ jsx(commonThin.Bell, {
|
|
23745
23760
|
className: "hd-icon hd-icon-bell"
|
|
23746
23761
|
}), notificationsCount > 0 && /* @__PURE__ */ jsxs(Fragment, {
|
|
@@ -23757,7 +23772,10 @@ function Notifications() {
|
|
|
23757
23772
|
})]
|
|
23758
23773
|
}), /* @__PURE__ */ jsx("ul", {
|
|
23759
23774
|
className: "dropdown-menu",
|
|
23760
|
-
|
|
23775
|
+
style: showNotifications ? {
|
|
23776
|
+
display: "block"
|
|
23777
|
+
} : {},
|
|
23778
|
+
ref,
|
|
23761
23779
|
children: notificationsLang.map((notification) => {
|
|
23762
23780
|
const {
|
|
23763
23781
|
title,
|
|
@@ -26388,9 +26406,11 @@ function UserLanguage(props) {
|
|
|
26388
26406
|
onClick: (e2) => {
|
|
26389
26407
|
e2.preventDefault();
|
|
26390
26408
|
e2.stopPropagation();
|
|
26391
|
-
|
|
26392
|
-
|
|
26393
|
-
handleLanguageChange
|
|
26409
|
+
if (code !== selectedLanguage) {
|
|
26410
|
+
dispatch(setUserLanguage(code));
|
|
26411
|
+
if (typeof handleLanguageChange === "function") {
|
|
26412
|
+
handleLanguageChange(code);
|
|
26413
|
+
}
|
|
26394
26414
|
}
|
|
26395
26415
|
dispatch(removeSubMenu(label));
|
|
26396
26416
|
},
|
|
@@ -26873,18 +26893,12 @@ function Header(props) {
|
|
|
26873
26893
|
if (userLanguage) {
|
|
26874
26894
|
dispatch(setUserLanguage(userLanguage));
|
|
26875
26895
|
}
|
|
26876
|
-
}, []);
|
|
26877
|
-
useEffect(() => {
|
|
26878
26896
|
if (hotelInfo) {
|
|
26879
26897
|
dispatch(setHotelInfo(hotelInfo));
|
|
26880
26898
|
}
|
|
26881
|
-
}, []);
|
|
26882
|
-
useEffect(() => {
|
|
26883
26899
|
if (userInfo) {
|
|
26884
26900
|
dispatch(setUserInfo(userInfo));
|
|
26885
26901
|
}
|
|
26886
|
-
}, []);
|
|
26887
|
-
useEffect(() => {
|
|
26888
26902
|
if (i18nFeed) {
|
|
26889
26903
|
dispatch(setI18nFeed(i18nFeed));
|
|
26890
26904
|
}
|
|
@@ -26920,7 +26934,7 @@ function Header(props) {
|
|
|
26920
26934
|
headerRef.current.scrollTop = 0;
|
|
26921
26935
|
}
|
|
26922
26936
|
}, [subMenus.length]);
|
|
26923
|
-
return /* @__PURE__ */ jsxs(
|
|
26937
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
26924
26938
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
26925
26939
|
ref: headerRef,
|
|
26926
26940
|
id: "hd-container",
|