@lendi/navbar 7.21.2 → 7.22.1

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.
@@ -0,0 +1,4 @@
1
+ declare const ChatBubble: ({ onClick }: {
2
+ onClick: () => void;
3
+ }) => JSX.Element;
4
+ export default ChatBubble;
@@ -0,0 +1,6 @@
1
+ export declare const StyledWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
2
+ isContracted: boolean;
3
+ }, never>;
4
+ export declare const BubbleBody: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
5
+ export declare const Label: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
6
+ export declare const Dot: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
@@ -710,7 +710,7 @@ var RenderMobileAction = _ref => {
710
710
  isTransparent
711
711
  } = NavbarBase.useNavbarBaseContext();
712
712
  var needToContinue = () => isAuthenticated && showContinueAction;
713
- var needToSignIn = () => !isAuthenticated;
713
+ var needToSignIn = () => !isAuthenticated && showContinueAction;
714
714
  var brand = lalaUtils.getBrandFromHostname();
715
715
  var env = getEnvFromHostname((_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname);
716
716
  var signInURL = getSignInURL(brand, env, (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$location = _window2.location) === null || _window2$location === void 0 ? void 0 : _window2$location.href);
@@ -1544,6 +1544,66 @@ var SlideoutMenuBase = _ref3 => {
1544
1544
  });
1545
1545
  };
1546
1546
 
1547
+ var StyledWrapper = styled__default["default"].div.withConfig({
1548
+ displayName: "style__StyledWrapper",
1549
+ componentId: "lui__sc-1hl3v3a-0"
1550
+ })(["position:fixed;right:52px;bottom:30px;padding:14px;align-items:center;gap:10px;border-radius:40px;color:#fff;background-color:", ";cursor:pointer;box-shadow:0px 0px 2px 0px rgba(0,0,0,0.12),0px 2px 2px 0px rgba(0,0,0,0.12),0px 1px 3px 0px rgba(0,0,0,0.14);transition:width 600ms ease-in-out;width:", ";&:hover{width:143px;}"], getColour.getColour('interaction', 'main'), _ref => {
1551
+ var {
1552
+ isContracted
1553
+ } = _ref;
1554
+ return isContracted ? '50px' : '143px';
1555
+ });
1556
+ var BubbleBody = styled__default["default"].div.withConfig({
1557
+ displayName: "style__BubbleBody",
1558
+ componentId: "lui__sc-1hl3v3a-1"
1559
+ })(["display:flex;flex-direction:row;gap:10px;align-items:center;position:relative;"]);
1560
+ var Label$1 = styled__default["default"].span.withConfig({
1561
+ displayName: "style__Label",
1562
+ componentId: "lui__sc-1hl3v3a-2"
1563
+ })(["color:#fff;text-align:center;font-size:14px;font-style:normal;font-weight:700;line-height:20px;&.hidden{display:none;}"]);
1564
+ var Dot = styled__default["default"].span.withConfig({
1565
+ displayName: "style__Dot",
1566
+ componentId: "lui__sc-1hl3v3a-3"
1567
+ })(["width:24px;height:24px;border-radius:40px;background-color:#e52c64;position:absolute;top:-21px;right:-19px;"]);
1568
+
1569
+ var ChatBubble = _ref => {
1570
+ var {
1571
+ onClick
1572
+ } = _ref;
1573
+ var [isContracted, setContracted] = React.useState(false);
1574
+ var [showLabel, setShowLabel] = React.useState(true);
1575
+ React.useEffect(() => {
1576
+ var timeout = setTimeout(() => {
1577
+ setContracted(true);
1578
+ setShowLabel(false);
1579
+ }, 2000);
1580
+ return () => clearTimeout(timeout);
1581
+ }, []);
1582
+ return /*#__PURE__*/jsxRuntime.jsx(StyledWrapper, {
1583
+ isContracted: isContracted,
1584
+ onClick: onClick,
1585
+ onMouseEnter: () => {
1586
+ setContracted(false);
1587
+ setTimeout(() => {
1588
+ setShowLabel(true);
1589
+ }, 650);
1590
+ },
1591
+ onMouseLeave: () => {
1592
+ setContracted(true);
1593
+ setShowLabel(false);
1594
+ },
1595
+ children: /*#__PURE__*/jsxRuntime.jsxs(BubbleBody, {
1596
+ children: [/*#__PURE__*/jsxRuntime.jsx(Chat__default["default"], {
1597
+ width: "24px",
1598
+ height: "24px"
1599
+ }), showLabel && /*#__PURE__*/jsxRuntime.jsx(Label$1, {
1600
+ children: "Chat online"
1601
+ }), /*#__PURE__*/jsxRuntime.jsx(Dot, {})]
1602
+ })
1603
+ });
1604
+ };
1605
+ var ChatBubble$1 = ChatBubble;
1606
+
1547
1607
  var _templateObject$7;
1548
1608
  var CommPanelWrapper = styled__default["default"](SlideoutMenuBase).withConfig({
1549
1609
  displayName: "CommPanelProvider__CommPanelWrapper",
@@ -1572,19 +1632,33 @@ props => {
1572
1632
  var {
1573
1633
  onException
1574
1634
  } = useError();
1635
+ var {
1636
+ chatBubble
1637
+ } = launchdarkly.useFlags();
1575
1638
  var {
1576
1639
  isCommPanelOpen,
1577
1640
  openCommPanel,
1578
1641
  closeCommPanel,
1579
1642
  channelId,
1580
- customerOwner
1643
+ customerOwner,
1644
+ openChat
1581
1645
  } = chat.useBootstrappedChatState();
1582
1646
  var [hasUnread, setHasUnread] = React__default["default"].useState(false);
1583
1647
  var [isOtherUserOnline, setIsOtherUserOnline] = React__default["default"].useState(false);
1584
1648
  var [breakpoint$1, setBreakpoint] = React__default["default"].useState();
1649
+ var [renderChatBubble, setRenderChatBubble] = React.useState(false);
1585
1650
  breakpoint.useBreakpoint(setBreakpoint);
1586
1651
  var theme = utils$1.getThemeName();
1587
1652
  var shouldFullScreen = theme === 'aussie' || breakpoint$1 === 'mobile';
1653
+ React.useEffect(() => {
1654
+ var timeout;
1655
+ if (chatBubble) {
1656
+ timeout = setTimeout(() => {
1657
+ setRenderChatBubble(true);
1658
+ }, 1000);
1659
+ }
1660
+ return () => clearTimeout(timeout);
1661
+ }, [chatBubble]);
1588
1662
  return /*#__PURE__*/jsxRuntime.jsxs(chat.ChatDataExposureContext.Provider, {
1589
1663
  value: {
1590
1664
  setHasUnReadMessage: hasUnreadMessages => setHasUnread(hasUnreadMessages),
@@ -1608,7 +1682,9 @@ props => {
1608
1682
  isOtherUserOnline: isOtherUserOnline,
1609
1683
  onException: onException
1610
1684
  })
1611
- }))]
1685
+ })), renderChatBubble && /*#__PURE__*/jsxRuntime.jsx(ChatBubble$1, {
1686
+ onClick: openChat
1687
+ })]
1612
1688
  });
1613
1689
  };
1614
1690
  var withCommPanel = Component => chat.withCustomerChatProvider(withCommPanelWrapper(Component));
@@ -451,7 +451,7 @@ var _templateObject$c, _templateObject$b, _templateObject$a, _templateObject$9,
451
451
  }) : jsxRuntime.jsx(jsxRuntime.Fragment, {
452
452
  children: primaryLabel
453
453
  })
454
- }), !isAuthenticated && jsxRuntime.jsx(SecondaryActionMobile, {
454
+ }), !isAuthenticated && showContinueAction && jsxRuntime.jsx(SecondaryActionMobile, {
455
455
  size: "sm",
456
456
  variant: isAuthenticated ? "emphasis" : "primary",
457
457
  href: signInURL,
@@ -984,7 +984,49 @@ var _templateObject$8, _templateObject2$3, _templateObject$7, _templateObject$6,
984
984
  children: children
985
985
  })) ]
986
986
  });
987
- }, CommPanelWrapper = styled__default.default(SlideoutMenuBase).withConfig({
987
+ }, StyledWrapper = styled__default.default.div.withConfig({
988
+ displayName: "style__StyledWrapper",
989
+ componentId: "lui__sc-1hl3v3a-0"
990
+ })([ "position:fixed;right:52px;bottom:30px;padding:14px;align-items:center;gap:10px;border-radius:40px;color:#fff;background-color:", ";cursor:pointer;box-shadow:0px 0px 2px 0px rgba(0,0,0,0.12),0px 2px 2px 0px rgba(0,0,0,0.12),0px 1px 3px 0px rgba(0,0,0,0.14);transition:width 600ms ease-in-out;width:", ";&:hover{width:143px;}" ], getColour.getColour("interaction", "main"), (_ref => {
991
+ var {isContracted: isContracted} = _ref;
992
+ return isContracted ? "50px" : "143px";
993
+ })), BubbleBody = styled__default.default.div.withConfig({
994
+ displayName: "style__BubbleBody",
995
+ componentId: "lui__sc-1hl3v3a-1"
996
+ })([ "display:flex;flex-direction:row;gap:10px;align-items:center;position:relative;" ]), Label$1 = styled__default.default.span.withConfig({
997
+ displayName: "style__Label",
998
+ componentId: "lui__sc-1hl3v3a-2"
999
+ })([ "color:#fff;text-align:center;font-size:14px;font-style:normal;font-weight:700;line-height:20px;&.hidden{display:none;}" ]), Dot = styled__default.default.span.withConfig({
1000
+ displayName: "style__Dot",
1001
+ componentId: "lui__sc-1hl3v3a-3"
1002
+ })([ "width:24px;height:24px;border-radius:40px;background-color:#e52c64;position:absolute;top:-21px;right:-19px;" ]), ChatBubble = _ref => {
1003
+ var {onClick: onClick} = _ref, [isContracted, setContracted] = React.useState(!1), [showLabel, setShowLabel] = React.useState(!0);
1004
+ return React.useEffect((() => {
1005
+ var timeout = setTimeout((() => {
1006
+ setContracted(!0), setShowLabel(!1);
1007
+ }), 2e3);
1008
+ return () => clearTimeout(timeout);
1009
+ }), []), jsxRuntime.jsx(StyledWrapper, {
1010
+ isContracted: isContracted,
1011
+ onClick: onClick,
1012
+ onMouseEnter: () => {
1013
+ setContracted(!1), setTimeout((() => {
1014
+ setShowLabel(!0);
1015
+ }), 650);
1016
+ },
1017
+ onMouseLeave: () => {
1018
+ setContracted(!0), setShowLabel(!1);
1019
+ },
1020
+ children: jsxRuntime.jsxs(BubbleBody, {
1021
+ children: [ jsxRuntime.jsx(Chat__default.default, {
1022
+ width: "24px",
1023
+ height: "24px"
1024
+ }), showLabel && jsxRuntime.jsx(Label$1, {
1025
+ children: "Chat online"
1026
+ }), jsxRuntime.jsx(Dot, {}) ]
1027
+ })
1028
+ });
1029
+ }, ChatBubble$1 = ChatBubble, CommPanelWrapper = styled__default.default(SlideoutMenuBase).withConfig({
988
1030
  displayName: "CommPanelProvider__CommPanelWrapper",
989
1031
  componentId: "lui__sc-jqofne-0"
990
1032
  })([ "max-width:", ";background-color:", ";box-shadow:0px 4px 4px 0px ", ";", " ", ";" ], utils$1.pxToRem(375), getColour__default.default("shade", 0), getColour__default.default("shade", 200), (_ref => {
@@ -994,10 +1036,15 @@ var _templateObject$8, _templateObject2$3, _templateObject$7, _templateObject$6,
994
1036
  var {toTheTop: toTheTop} = _ref2;
995
1037
  return toTheTop && styled.css([ "top:0;z-index:999;" ]);
996
1038
  })), withCommPanelWrapper = Component => props => {
997
- var {onException: onException} = useError(), {isCommPanelOpen: isCommPanelOpen, openCommPanel: openCommPanel, closeCommPanel: closeCommPanel, channelId: channelId, customerOwner: customerOwner} = chat.useBootstrappedChatState(), [hasUnread, setHasUnread] = React__default.default.useState(!1), [isOtherUserOnline, setIsOtherUserOnline] = React__default.default.useState(!1), [breakpoint$1, setBreakpoint] = React__default.default.useState();
1039
+ var {onException: onException} = useError(), {chatBubble: chatBubble} = launchdarkly.useFlags(), {isCommPanelOpen: isCommPanelOpen, openCommPanel: openCommPanel, closeCommPanel: closeCommPanel, channelId: channelId, customerOwner: customerOwner, openChat: openChat} = chat.useBootstrappedChatState(), [hasUnread, setHasUnread] = React__default.default.useState(!1), [isOtherUserOnline, setIsOtherUserOnline] = React__default.default.useState(!1), [breakpoint$1, setBreakpoint] = React__default.default.useState(), [renderChatBubble, setRenderChatBubble] = React.useState(!1);
998
1040
  breakpoint.useBreakpoint(setBreakpoint);
999
1041
  var shouldFullScreen = "aussie" === utils$1.getThemeName() || "mobile" === breakpoint$1;
1000
- return jsxRuntime.jsxs(chat.ChatDataExposureContext.Provider, {
1042
+ return React.useEffect((() => {
1043
+ var timeout;
1044
+ return chatBubble && (timeout = setTimeout((() => {
1045
+ setRenderChatBubble(!0);
1046
+ }), 1e3)), () => clearTimeout(timeout);
1047
+ }), [ chatBubble ]), jsxRuntime.jsxs(chat.ChatDataExposureContext.Provider, {
1001
1048
  value: {
1002
1049
  setHasUnReadMessage: hasUnreadMessages => setHasUnread(hasUnreadMessages),
1003
1050
  setStatus: status => setIsOtherUserOnline(status)
@@ -1020,7 +1067,9 @@ var _templateObject$8, _templateObject2$3, _templateObject$7, _templateObject$6,
1020
1067
  isOtherUserOnline: isOtherUserOnline,
1021
1068
  onException: onException
1022
1069
  })
1023
- })) ]
1070
+ })), renderChatBubble && jsxRuntime.jsx(ChatBubble$1, {
1071
+ onClick: openChat
1072
+ }) ]
1024
1073
  });
1025
1074
  }, withCommPanel = Component => chat.withCustomerChatProvider(withCommPanelWrapper(Component)), SimpleNavbarComponent = _ref => {
1026
1075
  var {useTransparent: useTransparent = !1, showBookanAppointmentCta: showBookanAppointmentCta = !0, showTalkToExpertCta: showTalkToExpertCta = !0, homeURL: homeURL, params: params = "", continueURL: continueURL = "/", onLogout: onLogout, showContinueAction: showContinueAction = !1, hideDashboardItem: hideDashboardItem, hideManageApplicationsItem: hideManageApplicationsItem, isCommPanelOpen: isCommPanelOpen, hasUnread: hasUnread, closeCommPanel: closeCommPanel, openCommPanel: _openCommPanel, customerOwner: customerOwner} = _ref, isAuthenticated = lalaReact.useSession().status === lalaReact.Status.Authenticated;
@@ -677,7 +677,7 @@ var RenderMobileAction = _ref => {
677
677
  isTransparent
678
678
  } = useNavbarBaseContext();
679
679
  var needToContinue = () => isAuthenticated && showContinueAction;
680
- var needToSignIn = () => !isAuthenticated;
680
+ var needToSignIn = () => !isAuthenticated && showContinueAction;
681
681
  var brand = getBrandFromHostname();
682
682
  var env = getEnvFromHostname((_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname);
683
683
  var signInURL = getSignInURL(brand, env, (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$location = _window2.location) === null || _window2$location === void 0 ? void 0 : _window2$location.href);
@@ -1511,6 +1511,66 @@ var SlideoutMenuBase = _ref3 => {
1511
1511
  });
1512
1512
  };
1513
1513
 
1514
+ var StyledWrapper = styled.div.withConfig({
1515
+ displayName: "style__StyledWrapper",
1516
+ componentId: "lui__sc-1hl3v3a-0"
1517
+ })(["position:fixed;right:52px;bottom:30px;padding:14px;align-items:center;gap:10px;border-radius:40px;color:#fff;background-color:", ";cursor:pointer;box-shadow:0px 0px 2px 0px rgba(0,0,0,0.12),0px 2px 2px 0px rgba(0,0,0,0.12),0px 1px 3px 0px rgba(0,0,0,0.14);transition:width 600ms ease-in-out;width:", ";&:hover{width:143px;}"], getColour$1('interaction', 'main'), _ref => {
1518
+ var {
1519
+ isContracted
1520
+ } = _ref;
1521
+ return isContracted ? '50px' : '143px';
1522
+ });
1523
+ var BubbleBody = styled.div.withConfig({
1524
+ displayName: "style__BubbleBody",
1525
+ componentId: "lui__sc-1hl3v3a-1"
1526
+ })(["display:flex;flex-direction:row;gap:10px;align-items:center;position:relative;"]);
1527
+ var Label$1 = styled.span.withConfig({
1528
+ displayName: "style__Label",
1529
+ componentId: "lui__sc-1hl3v3a-2"
1530
+ })(["color:#fff;text-align:center;font-size:14px;font-style:normal;font-weight:700;line-height:20px;&.hidden{display:none;}"]);
1531
+ var Dot = styled.span.withConfig({
1532
+ displayName: "style__Dot",
1533
+ componentId: "lui__sc-1hl3v3a-3"
1534
+ })(["width:24px;height:24px;border-radius:40px;background-color:#e52c64;position:absolute;top:-21px;right:-19px;"]);
1535
+
1536
+ var ChatBubble = _ref => {
1537
+ var {
1538
+ onClick
1539
+ } = _ref;
1540
+ var [isContracted, setContracted] = useState(false);
1541
+ var [showLabel, setShowLabel] = useState(true);
1542
+ useEffect(() => {
1543
+ var timeout = setTimeout(() => {
1544
+ setContracted(true);
1545
+ setShowLabel(false);
1546
+ }, 2000);
1547
+ return () => clearTimeout(timeout);
1548
+ }, []);
1549
+ return /*#__PURE__*/jsx(StyledWrapper, {
1550
+ isContracted: isContracted,
1551
+ onClick: onClick,
1552
+ onMouseEnter: () => {
1553
+ setContracted(false);
1554
+ setTimeout(() => {
1555
+ setShowLabel(true);
1556
+ }, 650);
1557
+ },
1558
+ onMouseLeave: () => {
1559
+ setContracted(true);
1560
+ setShowLabel(false);
1561
+ },
1562
+ children: /*#__PURE__*/jsxs(BubbleBody, {
1563
+ children: [/*#__PURE__*/jsx(Chat, {
1564
+ width: "24px",
1565
+ height: "24px"
1566
+ }), showLabel && /*#__PURE__*/jsx(Label$1, {
1567
+ children: "Chat online"
1568
+ }), /*#__PURE__*/jsx(Dot, {})]
1569
+ })
1570
+ });
1571
+ };
1572
+ var ChatBubble$1 = ChatBubble;
1573
+
1514
1574
  var _templateObject$7;
1515
1575
  var CommPanelWrapper = styled(SlideoutMenuBase).withConfig({
1516
1576
  displayName: "CommPanelProvider__CommPanelWrapper",
@@ -1539,19 +1599,33 @@ props => {
1539
1599
  var {
1540
1600
  onException
1541
1601
  } = useError();
1602
+ var {
1603
+ chatBubble
1604
+ } = useFlags();
1542
1605
  var {
1543
1606
  isCommPanelOpen,
1544
1607
  openCommPanel,
1545
1608
  closeCommPanel,
1546
1609
  channelId,
1547
- customerOwner
1610
+ customerOwner,
1611
+ openChat
1548
1612
  } = useBootstrappedChatState();
1549
1613
  var [hasUnread, setHasUnread] = React.useState(false);
1550
1614
  var [isOtherUserOnline, setIsOtherUserOnline] = React.useState(false);
1551
1615
  var [breakpoint, setBreakpoint] = React.useState();
1616
+ var [renderChatBubble, setRenderChatBubble] = useState(false);
1552
1617
  useBreakpoint(setBreakpoint);
1553
1618
  var theme = getThemeName();
1554
1619
  var shouldFullScreen = theme === 'aussie' || breakpoint === 'mobile';
1620
+ useEffect(() => {
1621
+ var timeout;
1622
+ if (chatBubble) {
1623
+ timeout = setTimeout(() => {
1624
+ setRenderChatBubble(true);
1625
+ }, 1000);
1626
+ }
1627
+ return () => clearTimeout(timeout);
1628
+ }, [chatBubble]);
1555
1629
  return /*#__PURE__*/jsxs(ChatDataExposureContext.Provider, {
1556
1630
  value: {
1557
1631
  setHasUnReadMessage: hasUnreadMessages => setHasUnread(hasUnreadMessages),
@@ -1575,7 +1649,9 @@ props => {
1575
1649
  isOtherUserOnline: isOtherUserOnline,
1576
1650
  onException: onException
1577
1651
  })
1578
- }))]
1652
+ })), renderChatBubble && /*#__PURE__*/jsx(ChatBubble$1, {
1653
+ onClick: openChat
1654
+ })]
1579
1655
  });
1580
1656
  };
1581
1657
  var withCommPanel = Component => withCustomerChatProvider(withCommPanelWrapper(Component));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lendi/navbar",
3
3
  "access": "restricted",
4
- "version": "7.21.2",
4
+ "version": "7.22.1",
5
5
  "license": "ISC",
6
6
  "source": "src/index.tsx",
7
7
  "main": "dist/navbar.cjs.js",
@@ -40,7 +40,7 @@
40
40
  "@lendi-ui/typography": "^5.13.11-beta.0",
41
41
  "@lendi-ui/utils": "^6.0.2-beta.1",
42
42
  "@lendi/analytics": "^4.6.0",
43
- "@lendi/chat": "^1.7.0",
43
+ "@lendi/chat": "^1.7.3",
44
44
  "@lendi/lala-utils": "^11.2.0",
45
45
  "@lendi/launchdarkly": "^0.1.7",
46
46
  "@lendi/lendigroup-leads-library": "^3.2.1",