@omniumretail/component-library 1.2.52 → 1.2.53

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.
@@ -23,4 +23,5 @@ export interface HeaderProps {
23
23
  onNotificationClick?: (id: string, url: string) => void;
24
24
  handleMarkAllAsRead?: () => void;
25
25
  notifications?: BellNotification[];
26
+ shouldConfirmNavigation?: boolean;
26
27
  }
@@ -3,5 +3,5 @@ import { HeaderProps } from './Header.types';
3
3
  * Header component to display navigation bar with dropdown menus and action button.
4
4
  * @param {HeaderProps} props - Properties passed to the component.
5
5
  */
6
- export declare const Header: ({ menuList, actionButton, logout, homeUrl, profileUrl, onLeavingPage, userName, pageTitle, onFilterChange, notifications, onNotificationClick, handleMarkAllAsRead }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const Header: ({ menuList, actionButton, logout, homeUrl, profileUrl, onLeavingPage, userName, pageTitle, onFilterChange, notifications, onNotificationClick, handleMarkAllAsRead, shouldConfirmNavigation }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
7
7
  export default Header;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/component-library",
3
- "version": "1.2.52",
3
+ "version": "1.2.53",
4
4
  "private": false,
5
5
  "main": "dist/bundle.js",
6
6
  "typings": "./dist/types/index",
@@ -26,4 +26,5 @@ export interface HeaderProps {
26
26
  onNotificationClick?: (id: string, url: string) => void;
27
27
  handleMarkAllAsRead?: () => void;
28
28
  notifications?: BellNotification[];
29
+ shouldConfirmNavigation?: boolean;
29
30
  }
@@ -24,7 +24,8 @@ export const Header = ({
24
24
  onFilterChange,
25
25
  notifications,
26
26
  onNotificationClick,
27
- handleMarkAllAsRead
27
+ handleMarkAllAsRead,
28
+ shouldConfirmNavigation
28
29
  }: HeaderProps) => {
29
30
 
30
31
  const [isMenuOpen, setIsMenuOpen] = useState(false);
@@ -36,7 +37,9 @@ export const Header = ({
36
37
  * Handle the logout action. If no logout function is provided, redirect to home as discussed in a meet
37
38
  */
38
39
  const onLogout = () => {
39
- if (logout) {
40
+ if (shouldConfirmNavigation) {
41
+ onLeavingPage!('/logout');
42
+ } else if (logout) {
40
43
  logout();
41
44
  } else {
42
45
  onHome();
@@ -47,14 +50,22 @@ export const Header = ({
47
50
  * Navigate to the profile URL.
48
51
  */
49
52
  const onProfile = () => {
50
- window.location.href = profileUrl;
53
+ if (shouldConfirmNavigation) {
54
+ onLeavingPage!('/profile');
55
+ } else {
56
+ window.location.href = profileUrl;
57
+ }
51
58
  };
52
59
 
53
60
  /**
54
61
  * Navigate to the home URL.
55
62
  */
56
63
  const onHome = () => {
57
- window.location.href = homeUrl;
64
+ if (shouldConfirmNavigation) {
65
+ onLeavingPage!('/home');
66
+ } else {
67
+ window.location.href = homeUrl;
68
+ }
58
69
  };
59
70
 
60
71
  const menuTopList = getMenuTopList(