@stokr/components-library 3.0.34 → 3.0.36

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.
@@ -67,7 +67,7 @@ const FooterMenu = ({
67
67
  /* @__PURE__ */ jsx(Title, { collapse: group.collapse, children: group.name }),
68
68
  isMobile && !group.social && /* @__PURE__ */ jsx(ArrowDown, { isOpened: activeGroups[groupKey] })
69
69
  ] }),
70
- /* @__PURE__ */ jsx(CollapseWrapper, { collapse: isMobile && group.collapse, isOpened: activeGroups[groupKey], children: /* @__PURE__ */ jsx(Items, { social: group.social, children: group.social ? /* @__PURE__ */ jsx(SocialLinksContainer, { children: group.items.map((item) => /* @__PURE__ */ jsx(Item, { social: true, children: /* @__PURE__ */ jsx(SocialLink, { href: item.url, alt: item.name, target: "_blank", rel: "noopener noreferrer", children: socialSvg[item.name] }) }, item.name)) }) : group.items.map((item) => /* @__PURE__ */ jsx(Item, { children: /* @__PURE__ */ jsxs(Link, { target: item.external ? "_blank" : "", href: item.url, rel: "noopener noreferrer", children: [
70
+ /* @__PURE__ */ jsx(CollapseWrapper, { collapse: isMobile && group.collapse, isOpened: activeGroups[groupKey], children: /* @__PURE__ */ jsx(Items, { social: group.social, children: group.social ? /* @__PURE__ */ jsx(SocialLinksContainer, { children: group.items.map((item) => /* @__PURE__ */ jsx(Item, { social: true, children: /* @__PURE__ */ jsx(SocialLink, { href: item.url, alt: item.name, target: "_blank", rel: "noopener noreferrer", children: socialSvg[item.name] }) }, item.name)) }) : group.items.map((item) => /* @__PURE__ */ jsx(Item, { children: /* @__PURE__ */ jsxs(Link, { target: item.external ? "_blank" : "", to: item.url, rel: "noopener noreferrer", children: [
71
71
  item.name,
72
72
  item.showNumber && jobOpeningsNumber > 0 && /* @__PURE__ */ jsx(HiringTotalNumber, { style: { marginLeft: "4px" }, children: jobOpeningsNumber })
73
73
  ] }) }, item.name)) }) })
@@ -1,7 +1,7 @@
1
1
  import styled from "styled-components";
2
2
  import { colors } from "../../styles/colors.js";
3
3
  import theme from "../../styles/theme.js";
4
- import { Link as Link$1 } from "react-router-dom";
4
+ import stdin_default from "../SmartLink/SmartLink.js";
5
5
  const Container = styled.div`
6
6
  z-index: 2;
7
7
  position: relative;
@@ -186,7 +186,7 @@ const Item = styled.li.withConfig({
186
186
  padding-right: 16px;
187
187
  }
188
188
  `;
189
- const Link = styled(Link$1)`
189
+ const Link = styled(stdin_default)`
190
190
  display: inline-block;
191
191
  font-family: 'Open Sans';
192
192
  font-weight: bold;
@@ -1,17 +1,17 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { useMemo, useState, useEffect } from "react";
3
3
  import PropTypes from "prop-types";
4
- import { Link } from "react-router-dom";
4
+ import stdin_default$1 from "../SmartLink/SmartLink.js";
5
5
  import { Button } from "../Button/Button.styles.js";
6
- import stdin_default$1 from "../SvgIcons/LogoSvg.js";
6
+ import stdin_default$2 from "../SvgIcons/LogoSvg.js";
7
7
  import "../SvgIcons/SocialInstagram.js";
8
8
  import { MenuNav } from "../MenuNav/MenuNav.styles.js";
9
- import stdin_default$3 from "../MainMenu/MainMenu.js";
9
+ import stdin_default$4 from "../MainMenu/MainMenu.js";
10
10
  import { StepsProgressSignup, StepsProgressHeader } from "../StepsProgress/StepsProgress.js";
11
11
  import { NotificationCounter } from "../NotificationCounter/NotificationCounter.styles.js";
12
12
  import avatarPlaceholder from "../../static/images/avatar-placeholder.png.js";
13
13
  import { StyledHeader, SidebarToggle, HamburgerIcon, HeaderInner, MainNavWrap, Logo, HeaderMainNav, ProgressWrap, QuickNavWrap, MobileMenuToggler, HeaderQuickNav, LoginButton, UserAccount, UserButton, SignupButton, MobileMenu, MobileMenuPart, MobileMenuItem, MobileMenuLink, CTAContainer, SocialLinksContainer, UserAvatar, MobileMenuWrapper, StyledSubMenu } from "./Header.styles.js";
14
- import stdin_default$2 from "../MainMenu/DynamicMainMenu.js";
14
+ import stdin_default$3 from "../MainMenu/DynamicMainMenu.js";
15
15
  import { SocialLink, ArrowDown } from "../Footer/FooterMenu.styles.js";
16
16
  import { Collapse } from "react-collapse";
17
17
  import { usePrevious, useMobileView } from "../../utils/customHooks.js";
@@ -190,10 +190,10 @@ function HeaderView({
190
190
  withSidebar && /* @__PURE__ */ jsx(SidebarToggle, { isSidebarExpanded, onClick: sidebarHandler, children: /* @__PURE__ */ jsx(HamburgerIcon, {}) }),
191
191
  /* @__PURE__ */ jsxs(HeaderInner, { withSidebar, children: [
192
192
  /* @__PURE__ */ jsxs(MainNavWrap, { hasProgress: progress, children: [
193
- /* @__PURE__ */ jsx(Logo, { isHighlight: currentActiveMenu === "main", children: useRelativePathForMenu ? /* @__PURE__ */ jsx(Link, { to: "/", "data-cy": "logo-nav-link", children: /* @__PURE__ */ jsx(stdin_default$1, {}) }) : /* @__PURE__ */ jsx("a", { href: platformURL, "data-cy": "logo-nav-link", children: /* @__PURE__ */ jsx(stdin_default$1, {}) }) }),
193
+ /* @__PURE__ */ jsx(Logo, { isHighlight: currentActiveMenu === "main", children: /* @__PURE__ */ jsx(stdin_default$1, { to: useRelativePathForMenu ? "/" : platformURL, "data-cy": "logo-nav-link", children: /* @__PURE__ */ jsx(stdin_default$2, {}) }) }),
194
194
  !progress && /* @__PURE__ */ jsx(HeaderMainNav, { children: /* @__PURE__ */ jsx(MenuNav, { children: /* @__PURE__ */ jsxs("ul", { children: [
195
195
  /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
196
- Link,
196
+ stdin_default$1,
197
197
  {
198
198
  to: newPlatformUrl + "/featured-assets",
199
199
  "data-cy": "invest-nav-link",
@@ -224,7 +224,7 @@ function HeaderView({
224
224
  }
225
225
  ) }),
226
226
  /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
227
- Link,
227
+ stdin_default$1,
228
228
  {
229
229
  to: newPlatformUrl + "/team",
230
230
  "data-cy": "team-nav-link",
@@ -327,33 +327,20 @@ function HeaderView({
327
327
  /* @__PURE__ */ jsx(MobileMenuItem, { children: /* @__PURE__ */ jsx(MobileMenuLink, { to: newPlatformUrl + "/team", children: "Team" }) })
328
328
  ] }) }) }) }),
329
329
  hasLoggedInSession(user) ? /* @__PURE__ */ jsxs(Fragment, { children: [
330
- !signupFlow && /* @__PURE__ */ jsx(MobileMenuPart, { withPadding: true, flexColumn: true, borderTop: true, children: /* @__PURE__ */ jsx(MenuNav, { mobile: true, children: /* @__PURE__ */ jsx("ul", { children: isAdmin ? /* @__PURE__ */ jsx(Fragment, { children: isVentureDashboard ? /* @__PURE__ */ jsx(MobileMenuItem, { children: /* @__PURE__ */ jsx(Link, { to: "/settings", children: "Settings" }) }) : /* @__PURE__ */ jsx(MobileMenuItem, { children: /* @__PURE__ */ jsx(
331
- Link,
332
- {
333
- to: getConfig("adminUrl"),
334
- onClick: (e) => {
335
- e.preventDefault();
336
- toggleMenu("main");
337
- },
338
- children: "Dashboard"
339
- }
340
- ) }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
330
+ !signupFlow && /* @__PURE__ */ jsx(MobileMenuPart, { withPadding: true, flexColumn: true, borderTop: true, children: /* @__PURE__ */ jsx(MenuNav, { mobile: true, children: /* @__PURE__ */ jsx("ul", { children: isAdmin ? /* @__PURE__ */ jsx(Fragment, { children: isVentureDashboard ? /* @__PURE__ */ jsx(MobileMenuItem, { children: /* @__PURE__ */ jsx(stdin_default$1, { to: "/settings", children: "Settings" }) }) : /* @__PURE__ */ jsx(MobileMenuItem, { children: /* @__PURE__ */ jsx(stdin_default$1, { to: getConfig("adminUrl"), onClick: () => toggleMenu("main"), children: "Dashboard" }) }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
341
331
  /* @__PURE__ */ jsxs(MobileMenuItem, { children: [
342
332
  /* @__PURE__ */ jsx(
343
- Link,
333
+ stdin_default$1,
344
334
  {
345
- to: newPlatformUrlForUserMenu ? `${newPlatformUrlForUserMenu}/overview` : "/overview",
346
- onClick: (e) => {
347
- e.preventDefault();
348
- toggleMenu("main");
349
- },
335
+ to: `${newPlatformUrlForUserMenu}/overview`,
336
+ onClick: () => toggleMenu("main"),
350
337
  children: "Dashboard"
351
338
  }
352
339
  ),
353
340
  checkTodoStatus(user) > 0 && /* @__PURE__ */ jsx(NotificationCounter, { mobileMenu: true, children: checkTodoStatus(user) })
354
341
  ] }),
355
342
  /* @__PURE__ */ jsx(MobileMenuItem, { children: /* @__PURE__ */ jsx(
356
- Link,
343
+ stdin_default$1,
357
344
  {
358
345
  to: `${newPlatformUrlForUserMenu}/settings/profile-and-privacy`,
359
346
  onClick: () => toggleMenu("main"),
@@ -361,7 +348,7 @@ function HeaderView({
361
348
  }
362
349
  ) }),
363
350
  /* @__PURE__ */ jsx(MobileMenuItem, { children: /* @__PURE__ */ jsx(
364
- Link,
351
+ stdin_default$1,
365
352
  {
366
353
  to: `${newPlatformUrlForUserMenu}/settings/liquid-address`,
367
354
  onClick: () => toggleMenu("main"),
@@ -369,7 +356,7 @@ function HeaderView({
369
356
  }
370
357
  ) }),
371
358
  /* @__PURE__ */ jsx(MobileMenuItem, { children: /* @__PURE__ */ jsx(
372
- Link,
359
+ stdin_default$1,
373
360
  {
374
361
  to: `${newPlatformUrlForUserMenu}/settings/investment-eligibility`,
375
362
  onClick: () => toggleMenu("main"),
@@ -420,10 +407,10 @@ function HeaderView({
420
407
  ] })
421
408
  ] })
422
409
  ] }),
423
- /* @__PURE__ */ jsx(stdin_default$2, { isMenuActive: currentActiveMenu === "products", options: productMenuItems }),
424
- /* @__PURE__ */ jsx(stdin_default$2, { isMenuActive: currentActiveMenu === "media", options: mediaMenuItems }),
410
+ /* @__PURE__ */ jsx(stdin_default$3, { isMenuActive: currentActiveMenu === "products", options: productMenuItems }),
411
+ /* @__PURE__ */ jsx(stdin_default$3, { isMenuActive: currentActiveMenu === "media", options: mediaMenuItems }),
425
412
  /* @__PURE__ */ jsx(
426
- stdin_default$3,
413
+ stdin_default$4,
427
414
  {
428
415
  isMenuActive: currentActiveMenu === "main",
429
416
  logoutUser,
@@ -1,5 +1,5 @@
1
1
  import styled from "styled-components";
2
- import { Link } from "react-router-dom";
2
+ import stdin_default from "../SmartLink/SmartLink.js";
3
3
  import rwd, { rwdMax } from "../../styles/rwd.js";
4
4
  import { colors } from "../../styles/colors.js";
5
5
  import spacing from "../../styles/spacing.js";
@@ -364,7 +364,7 @@ const MobileMenuItem = styled.li.withConfig({
364
364
  const MobileMenuWrapper = styled.div`
365
365
  cursor: pointer;
366
366
  `;
367
- const MobileMenuLink = styled(Link)`
367
+ const MobileMenuLink = styled(stdin_default)`
368
368
  width: 100%;
369
369
  `;
370
370
  const MobileMenuPart = styled.div.withConfig({
@@ -0,0 +1,24 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ import PropTypes from "prop-types";
4
+ import { Link } from "react-router-dom";
5
+ const isExternalUrl = (to) => {
6
+ if (typeof to !== "string" || to === "") return false;
7
+ return /^([a-z][a-z0-9+.-]*:|\/\/)/i.test(to);
8
+ };
9
+ const SmartLink = ({ to, children, ...rest }) => {
10
+ if (isExternalUrl(to)) {
11
+ return /* @__PURE__ */ jsx("a", { href: to, ...rest, children });
12
+ }
13
+ return /* @__PURE__ */ jsx(Link, { to, ...rest, children });
14
+ };
15
+ SmartLink.propTypes = {
16
+ to: PropTypes.string,
17
+ children: PropTypes.node
18
+ };
19
+ var stdin_default = SmartLink;
20
+ export {
21
+ SmartLink,
22
+ stdin_default as default,
23
+ isExternalUrl
24
+ };
@@ -8,11 +8,12 @@ import { identify, reset } from "../analytics/index.js";
8
8
  import { withRouter } from "../utils/withRouter.js";
9
9
  import { Text } from "../components/Text/Text.styles.js";
10
10
  import { Auth, DEFAULT_TOKEN_EXPIRY_MS } from "./Auth.js";
11
+ import { Button } from "../components/Button/Button.styles.js";
11
12
  import { hasLoggedInSession } from "../utils/user-identity.js";
13
+ import { SuccessModal as SuccessModalComponent } from "../components/Modal/SuccessModal/SuccessModal.js";
12
14
  import { getConfig, getPlatformURL } from "../runtime-config.js";
13
- import { ConfirmModal as ConfirmModalComponent } from "../components/ConfirmModal/ConfirmModal.js";
14
- import { getFirebaseAuth, isValidFirebaseConfig } from "../firebase-config.js";
15
15
  import avatarPlaceholder from "../static/images/avatar-placeholder.png.js";
16
+ import { getFirebaseAuth, isValidFirebaseConfig } from "../firebase-config.js";
16
17
  import { isAlreadyOnOnboardingFlow } from "../utils/app-urls.js";
17
18
  import { multiFactor, TotpMultiFactorGenerator, signOut, getMultiFactorResolver, PhoneMultiFactorGenerator } from "firebase/auth";
18
19
  import { navigateToHref } from "../routing/navigate-app.js";
@@ -788,7 +789,7 @@ class AuthProviderClass extends Component {
788
789
  }
789
790
  };
790
791
  render() {
791
- const { children } = this.props;
792
+ const { children, redirectToLogin = true } = this.props;
792
793
  return /* @__PURE__ */ jsxs(
793
794
  AuthContext.Provider,
794
795
  {
@@ -835,16 +836,26 @@ class AuthProviderClass extends Component {
835
836
  children: [
836
837
  children,
837
838
  (this.state.loggedOutDueToInactivity || this.state.loggedOutDueToCookieExpiry || this.state.sessionExpiryPendingReason) && !this.props.hideInactivityModal && /* @__PURE__ */ jsx(
838
- ConfirmModalComponent,
839
+ SuccessModalComponent,
839
840
  {
840
841
  isOpen: true,
841
- maxWidth: "600px",
842
- confirmText: "OK",
843
- onCancel: this.dismissSessionExpiryModal,
844
- onConfirm: this.dismissSessionExpiryModal,
845
- showRedBar: true,
842
+ onClose: this.dismissSessionExpiryModal,
843
+ variant: "progress",
846
844
  title: "Session expired",
847
- content: /* @__PURE__ */ jsx(Text, { children: /* @__PURE__ */ jsx("p", { style: { fontSize: 16 }, children: this.state.sessionExpiryPendingReason === "inactivity" || this.state.loggedOutDueToInactivity ? "You have been logged out due to inactivity." : "Your session has expired. Please log in again." }) })
845
+ content: /* @__PURE__ */ jsxs(Text, { children: [
846
+ /* @__PURE__ */ jsx("p", { style: { fontSize: 16 }, children: this.state.sessionExpiryPendingReason === "inactivity" || this.state.loggedOutDueToInactivity ? "You have been logged out due to inactivity." : "Your session has expired. Please log in again." }),
847
+ /* @__PURE__ */ jsx(
848
+ Button,
849
+ {
850
+ onClick: () => {
851
+ this.dismissSessionExpiryModal();
852
+ if (redirectToLogin) navigateToHref(this.props.navigate, getPlatformURL() + "/login");
853
+ },
854
+ children: "Log in"
855
+ }
856
+ )
857
+ ] }),
858
+ maxWidth: "600px"
848
859
  }
849
860
  )
850
861
  ]
@@ -886,7 +897,9 @@ AuthProviderClass.propTypes = {
886
897
  /** When true, the inactivity modal is not shown after auto-logout. Default false. */
887
898
  hideInactivityModal: PropTypes.bool,
888
899
  /** Override access token cookie lifetime in ms (e.g. for Storybook). Production uses 1 hour. */
889
- accessTokenExpiryMs: PropTypes.number
900
+ accessTokenExpiryMs: PropTypes.number,
901
+ /** When true, the user will be redirected to the login page after the session expires. Default false. */
902
+ redirectToLogin: PropTypes.bool
890
903
  };
891
904
  function resolveFirebaseConfigForGuard(props) {
892
905
  if (props.config?.firebase != null) return props.config.firebase;
package/dist/index.js CHANGED
@@ -88,6 +88,7 @@ import { StepController } from "./components/StepController/StepController.js";
88
88
  import { StepControllerConsumer, StepControllerContext, StepControllerProvider } from "./components/StepController/StepControllerContext.js";
89
89
  import { StepsProgressHeader, StepsProgressSignup } from "./components/StepsProgress/StepsProgress.js";
90
90
  import { Container, Item, Items, Wrap } from "./components/StepsProgress/StepsProgress.styles.js";
91
+ import { SmartLink, isExternalUrl } from "./components/SmartLink/SmartLink.js";
91
92
  import { Switch } from "./components/Switch/Switch.js";
92
93
  import { Tabs } from "./components/Tabs/Tabs.js";
93
94
  import { Breakdown } from "./components/breakdown/Breakdown.js";
@@ -492,6 +493,7 @@ export {
492
493
  SideLine,
493
494
  SideModal,
494
495
  Slider,
496
+ SmartLink,
495
497
  Snackbar,
496
498
  SnackbarContext,
497
499
  SnackbarProvider,
@@ -610,6 +612,7 @@ export {
610
612
  identify,
611
613
  initAnalytics,
612
614
  isAlreadyOnOnboardingFlow,
615
+ isExternalUrl,
613
616
  isUSInvestor,
614
617
  km_ify,
615
618
  learnMoreCategoryPropTypes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stokr/components-library",
3
- "version": "3.0.34",
3
+ "version": "3.0.36",
4
4
  "description": "STOKR - Components Library",
5
5
  "author": "Bilal Hodzic <bilal@stokr.io>",
6
6
  "license": "MIT",