@stokr/components-library 3.0.21 → 3.0.23

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.
Files changed (42) hide show
  1. package/README.md +217 -11
  2. package/dist/analytics/index.js +5 -1
  3. package/dist/api/authenticationApi.js +13 -0
  4. package/dist/auth/index.js +4 -2
  5. package/dist/components/2FA/login-with-otp-flow.js +9 -4
  6. package/dist/components/Footer/FooterLayout.js +98 -95
  7. package/dist/components/Footer/FooterMenu.js +1 -1
  8. package/dist/components/Header/Header.js +102 -54
  9. package/dist/components/MainMenu/MainMenu.js +14 -4
  10. package/dist/components/Modal/NewVentureModal/NewVentureModal.js +6 -2
  11. package/dist/components/Modal/SuccessModal/SuccessModal.js +7 -1
  12. package/dist/components/Payment/PaymentDetailsCard.js +1 -1
  13. package/dist/components/StatusDot/StatusDot.js +68 -0
  14. package/dist/components/StatusDot/StatusDot.styles.js +45 -0
  15. package/dist/components/VerifyEmailModal/VerifyEmailModal.js +2 -1
  16. package/dist/components/headerHo/HeaderHo.js +8 -5
  17. package/dist/config.js +5 -21
  18. package/dist/constants/globalVariables.js +6 -4
  19. package/dist/context/Auth.js +5 -2
  20. package/dist/context/AuthContext.js +22 -8
  21. package/dist/firebase-config.js +4 -18
  22. package/dist/index.js +38 -5
  23. package/dist/model/axios.js +3 -1
  24. package/dist/model/axiosPublic.js +2 -2
  25. package/dist/routing/RouterWrapper.js +17 -0
  26. package/dist/routing/app-routes.js +22 -0
  27. package/dist/routing/navigate-app.js +36 -0
  28. package/dist/routing/resolve-app-href.js +149 -0
  29. package/dist/runtime-config.js +94 -0
  30. package/dist/static/animations/upload.lottie +0 -0
  31. package/dist/static/animations/upload.lottie.js +4 -0
  32. package/dist/static/images/upload.svg +5 -1
  33. package/dist/utils/app-urls-analytics-backoffice.js +30 -0
  34. package/dist/utils/app-urls.js +28 -0
  35. package/dist/utils/checklistGenerator.js +6 -5
  36. package/dist/utils/customHooks.js +1 -1
  37. package/dist/utils/formatCurrencyValue.js +2 -1
  38. package/dist/utils/get-cookie-domain.js +4 -1
  39. package/dist/utils/set-redirect-cookie.js +4 -1
  40. package/dist/utils/withRouter.js +5 -3
  41. package/package.json +1 -1
  42. package/dist/api/auth.js +0 -15
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { useState, useEffect } from "react";
2
+ import { useMemo, useState, useEffect } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { Button } from "../Button/Button.styles.js";
5
5
  import stdin_default$1 from "../SvgIcons/LogoSvg.js";
@@ -18,46 +18,14 @@ import { checkTodoStatus } from "../../utils/check-todo-status.js";
18
18
  import { Breakdown } from "../breakdown/Breakdown.js";
19
19
  import { socialSvg } from "../Footer/FooterMenu.js";
20
20
  import { Wrapper, FlexContainer } from "../Grid/Grid.styles.js";
21
- import { footerGroups } from "../Footer/FooterLayout.js";
22
- import { platformURL, platformDomain } from "../../constants/globalVariables.js";
21
+ import { getFooterGroups } from "../Footer/FooterLayout.js";
22
+ import { getPlatformURL } from "../../constants/globalVariables.js";
23
+ import { getDashboardBaseUrl, getAdminAppUrl } from "../../utils/app-urls.js";
24
+ import { withRouter } from "../../utils/withRouter.js";
23
25
  import { sizes } from "../../styles/rwd.js";
24
26
  import { track } from "../../analytics/index.js";
25
- const productMenuItems = [
26
- {
27
- name: "End-to-End Tokenization",
28
- onClick: () => {
29
- track("header_link_clicked", { link: "end-to-end tokenization" });
30
- window.location.href = `${platformURL}/solutions/asset-tokenization`;
31
- },
32
- link: "/solutions/asset-tokenization"
33
- },
34
- {
35
- name: "Tokenization-as-a-Service",
36
- onClick: () => {
37
- track("header_link_clicked", { link: "tokenization-as-a-service" });
38
- window.location.href = `${platformURL}/solutions/tokenization-as-service`;
39
- },
40
- link: "/solutions/tokenization-as-service"
41
- }
42
- ];
43
- const mediaMenuItems = [
44
- {
45
- name: "Press Releases",
46
- onClick: () => {
47
- track("header_link_clicked", { link: "press releases" });
48
- window.location.href = `${platformURL}/press-releases`;
49
- },
50
- link: "/press-releases"
51
- },
52
- {
53
- name: "Stoke Post",
54
- onClick: () => {
55
- track("header_link_clicked", { link: "stoke post" });
56
- window.location.href = `${platformURL}/stoke-post`;
57
- },
58
- link: "/stoke-post"
59
- }
60
- ];
27
+ import { navigateToHref, navigateApp } from "../../routing/navigate-app.js";
28
+ import { AppSurface, AppRoute } from "../../routing/app-routes.js";
61
29
  const UserAvatarComponent = ({ avatar }) => {
62
30
  const [photo, setphoto] = useState(avatarPlaceholder);
63
31
  const prevAvatar = usePrevious(avatar);
@@ -83,18 +51,26 @@ const UserAvatarComponent = ({ avatar }) => {
83
51
  }, [avatar]);
84
52
  return /* @__PURE__ */ jsx(UserAvatar, { src: photo });
85
53
  };
86
- const RenderSubMenu = ({ title, isActive, subMenuItems = [], onClick = () => {
87
- }, _platformURL = "" }) => {
54
+ const RenderSubMenu = ({
55
+ title,
56
+ isActive,
57
+ subMenuItems = [],
58
+ onClick = () => {
59
+ },
60
+ _platformURL = "",
61
+ platformURL: platformURLProp = ""
62
+ }) => {
63
+ const basePlatformUrl = _platformURL || platformURLProp;
88
64
  return /* @__PURE__ */ jsxs(MobileMenuWrapper, { onClick, children: [
89
65
  /* @__PURE__ */ jsx(MobileMenuItem, { children: /* @__PURE__ */ jsxs(StyledSubMenu, { children: [
90
66
  /* @__PURE__ */ jsx("a", { children: title }),
91
67
  /* @__PURE__ */ jsx(ArrowDown, { displayAlways: true, isOpened: isActive, style: { right: "-2em", position: "absolute" } })
92
68
  ] }) }),
93
- /* @__PURE__ */ jsx(Collapse, { isOpened: isActive, children: subMenuItems.map((item) => /* @__PURE__ */ jsx(MobileMenuItem, { red: true, children: /* @__PURE__ */ jsx(MobileMenuLink, { href: _platformURL + item.link, children: item.name }) }, item.name)) })
69
+ /* @__PURE__ */ jsx(Collapse, { isOpened: isActive, children: subMenuItems.map((item) => /* @__PURE__ */ jsx(MobileMenuItem, { red: true, children: /* @__PURE__ */ jsx(MobileMenuLink, { href: basePlatformUrl + item.link, children: item.name }) }, item.name)) })
94
70
  ] });
95
71
  };
96
- const socialLinks = footerGroups?.filter((group) => group.social)[0].items || [];
97
- const Header = ({
72
+ function HeaderView({
73
+ navigate = null,
98
74
  activeMenu = null,
99
75
  activateMenu = () => {
100
76
  },
@@ -116,7 +92,49 @@ const Header = ({
116
92
  signupFlow = false,
117
93
  noFixedPosition = false,
118
94
  withoutLoginSignupButton = false
119
- }) => {
95
+ }) {
96
+ const productMenuItems = useMemo(
97
+ () => [
98
+ {
99
+ name: "End-to-End Tokenization",
100
+ onClick: () => {
101
+ track("header_link_clicked", { link: "end-to-end tokenization" });
102
+ navigateToHref(navigate, `${getPlatformURL()}/solutions/asset-tokenization`);
103
+ },
104
+ link: "/solutions/asset-tokenization"
105
+ },
106
+ {
107
+ name: "Tokenization-as-a-Service",
108
+ onClick: () => {
109
+ track("header_link_clicked", { link: "tokenization-as-a-service" });
110
+ navigateToHref(navigate, `${getPlatformURL()}/solutions/tokenization-as-service`);
111
+ },
112
+ link: "/solutions/tokenization-as-service"
113
+ }
114
+ ],
115
+ [navigate]
116
+ );
117
+ const mediaMenuItems = useMemo(
118
+ () => [
119
+ {
120
+ name: "Press Releases",
121
+ onClick: () => {
122
+ track("header_link_clicked", { link: "press releases" });
123
+ navigateToHref(navigate, `${getPlatformURL()}/press-releases`);
124
+ },
125
+ link: "/press-releases"
126
+ },
127
+ {
128
+ name: "Stoke Post",
129
+ onClick: () => {
130
+ track("header_link_clicked", { link: "stoke post" });
131
+ navigateToHref(navigate, `${getPlatformURL()}/stoke-post`);
132
+ },
133
+ link: "/stoke-post"
134
+ }
135
+ ],
136
+ [navigate]
137
+ );
120
138
  const [currentActiveMenu, setcurrentActiveMenu] = useState(null);
121
139
  const [currentActiveSubMenu, setcurrentActiveSubMenu] = useState(null);
122
140
  const prevActiveMenu = usePrevious(activeMenu);
@@ -164,13 +182,14 @@ const Header = ({
164
182
  const userType = user && user.user_type;
165
183
  const isAdmin = userType === "company_pa" || userType === "company_sa" || userType === "sa";
166
184
  const isVentureDashboard = withSidebar;
167
- const newPlatformUrl = useRelativePathForMenu ? "" : platformURL;
168
- const newPlatformUrlForUserMenu = useRelativePathForUserMenu ? "" : `https://dashboard.${platformDomain}`;
185
+ const socialLinks = getFooterGroups()?.filter((group) => group.social)[0]?.items || [];
186
+ const newPlatformUrl = useRelativePathForMenu ? "" : getPlatformURL();
187
+ const newPlatformUrlForUserMenu = useRelativePathForUserMenu ? "" : getDashboardBaseUrl();
169
188
  return /* @__PURE__ */ jsx(StyledHeader, { noFixedPosition, children: /* @__PURE__ */ jsxs(Wrapper, { flex: withSidebar, children: [
170
189
  withSidebar && /* @__PURE__ */ jsx(SidebarToggle, { isSidebarExpanded, onClick: sidebarHandler, children: /* @__PURE__ */ jsx(HamburgerIcon, {}) }),
171
190
  /* @__PURE__ */ jsxs(HeaderInner, { withSidebar, children: [
172
191
  /* @__PURE__ */ jsxs(MainNavWrap, { hasProgress: progress, children: [
173
- /* @__PURE__ */ jsx(Logo, { isHighlight: currentActiveMenu === "main", children: /* @__PURE__ */ jsx("a", { href: platformURL, "data-cy": "logo-nav-link", children: /* @__PURE__ */ jsx(stdin_default$1, {}) }) }),
192
+ /* @__PURE__ */ jsx(Logo, { isHighlight: currentActiveMenu === "main", children: /* @__PURE__ */ jsx("a", { href: getPlatformURL(), "data-cy": "logo-nav-link", children: /* @__PURE__ */ jsx(stdin_default$1, {}) }) }),
174
193
  !progress && /* @__PURE__ */ jsx(HeaderMainNav, { children: /* @__PURE__ */ jsx(MenuNav, { children: /* @__PURE__ */ jsxs("ul", { children: [
175
194
  /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
176
195
  "a",
@@ -242,7 +261,7 @@ const Header = ({
242
261
  LoginButton,
243
262
  {
244
263
  onClick: () => {
245
- isAdmin ? window.location.href = "https://admin." + platformDomain : window.location.href = `${newPlatformUrlForUserMenu}/overview`;
264
+ isAdmin ? navigateApp(navigate, AppSurface.ADMIN, "") : !newPlatformUrlForUserMenu ? navigate(AppRoute.OVERVIEW) : navigateApp(navigate, AppSurface.DASHBOARD, AppRoute.OVERVIEW);
246
265
  },
247
266
  "data-cy": "dashboard-nav-link",
248
267
  children: "Dashboard"
@@ -307,9 +326,35 @@ const Header = ({
307
326
  /* @__PURE__ */ jsx(MobileMenuItem, { children: /* @__PURE__ */ jsx(MobileMenuLink, { href: newPlatformUrl + "/team", children: "Team" }) })
308
327
  ] }) }) }) }),
309
328
  user?._id || user?.uid ? /* @__PURE__ */ jsxs(Fragment, { children: [
310
- !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("a", { href: "/settings", children: "Settings" }) }) : /* @__PURE__ */ jsx(MobileMenuItem, { children: /* @__PURE__ */ jsx("a", { href: "https://admin." + platformDomain, onClick: () => toggleMenu("main"), children: "Dashboard" }) }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
329
+ !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("a", { href: "/settings", children: "Settings" }) }) : /* @__PURE__ */ jsx(MobileMenuItem, { children: /* @__PURE__ */ jsx(
330
+ "a",
331
+ {
332
+ href: getAdminAppUrl(),
333
+ onClick: (e) => {
334
+ e.preventDefault();
335
+ navigateApp(navigate, AppSurface.ADMIN, "");
336
+ toggleMenu("main");
337
+ },
338
+ children: "Dashboard"
339
+ }
340
+ ) }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
311
341
  /* @__PURE__ */ jsxs(MobileMenuItem, { children: [
312
- /* @__PURE__ */ jsx("a", { href: `${newPlatformUrlForUserMenu}/overview`, onClick: () => toggleMenu("main"), children: "Dashboard" }),
342
+ /* @__PURE__ */ jsx(
343
+ "a",
344
+ {
345
+ href: newPlatformUrlForUserMenu ? `${newPlatformUrlForUserMenu}${AppRoute.OVERVIEW}` : AppRoute.OVERVIEW,
346
+ onClick: (e) => {
347
+ e.preventDefault();
348
+ if (newPlatformUrlForUserMenu) {
349
+ navigateApp(navigate, AppSurface.DASHBOARD, AppRoute.OVERVIEW);
350
+ } else {
351
+ navigate(AppRoute.OVERVIEW);
352
+ }
353
+ toggleMenu("main");
354
+ },
355
+ children: "Dashboard"
356
+ }
357
+ ),
313
358
  checkTodoStatus(user) > 0 && /* @__PURE__ */ jsx(NotificationCounter, { mobileMenu: true, children: checkTodoStatus(user) })
314
359
  ] }),
315
360
  /* @__PURE__ */ jsx(MobileMenuItem, { children: /* @__PURE__ */ jsx(
@@ -391,13 +436,16 @@ const Header = ({
391
436
  isAdmin,
392
437
  notifications: checkTodoStatus(user),
393
438
  isVentureDashboard,
394
- platformUrlForUserMenu: newPlatformUrlForUserMenu
439
+ platformUrlForUserMenu: newPlatformUrlForUserMenu,
440
+ navigate
395
441
  }
396
442
  )
397
443
  ] })
398
444
  ] }) });
399
- };
400
- Header.propTypes = {
445
+ }
446
+ const Header = withRouter(HeaderView);
447
+ HeaderView.propTypes = {
448
+ navigate: PropTypes.func,
401
449
  progress: PropTypes.shape({
402
450
  items: PropTypes.arrayOf(PropTypes.object).isRequired,
403
451
  doneIndex: PropTypes.number,
@@ -5,7 +5,9 @@ import { Collapse } from "react-collapse";
5
5
  import { StyledMainMenu, MainMenuContainer, MainMenuOptions, MainMenuOption, ExpandArrow, Settings, SettingsOptions, SettingsOption } from "./MainMenu.styles.js";
6
6
  import { Button } from "../Button/Button.styles.js";
7
7
  import { IoniconsStyles } from "../../styles/ioniconsStyles.js";
8
- import { platformDomain } from "../../constants/globalVariables.js";
8
+ import { AppSurface, AppRoute } from "../../routing/app-routes.js";
9
+ import "../../constants/globalVariables.js";
10
+ import { navigateApp } from "../../routing/navigate-app.js";
9
11
  import { withRouter } from "../../utils/withRouter.js";
10
12
  class MainMenuClass extends PureComponent {
11
13
  state = {
@@ -52,7 +54,8 @@ class MainMenuClass extends PureComponent {
52
54
  logoutUser,
53
55
  admin: isAdmin = false,
54
56
  platformUrlForUserMenu,
55
- isVentureDashboard
57
+ isVentureDashboard,
58
+ navigate
56
59
  } = this.props;
57
60
  const spanStyleForMenu = {
58
61
  letterSpacing: "1.5px",
@@ -80,7 +83,13 @@ class MainMenuClass extends PureComponent {
80
83
  isVenture: isAdmin,
81
84
  isDashboard: true,
82
85
  onClick: () => {
83
- isAdmin ? window.location.href = `https://admin.${platformDomain}` : window.location.href = `${platformUrlForUserMenu}/overview`;
86
+ if (isAdmin) {
87
+ navigateApp(navigate, AppSurface.ADMIN, "");
88
+ } else if (!platformUrlForUserMenu) {
89
+ navigate(AppRoute.OVERVIEW);
90
+ } else {
91
+ navigateApp(navigate, AppSurface.DASHBOARD, AppRoute.OVERVIEW);
92
+ }
84
93
  },
85
94
  children: /* @__PURE__ */ jsx("span", { style: spanStyleForMenu, children: "Dashboard" })
86
95
  }
@@ -199,7 +208,8 @@ class MainMenuClass extends PureComponent {
199
208
  }
200
209
  MainMenuClass.propTypes = {
201
210
  isMenuActive: PropTypes.bool.isRequired,
202
- admin: PropTypes.bool
211
+ admin: PropTypes.bool,
212
+ navigate: PropTypes.func
203
213
  };
204
214
  const MainMenu = withRouter(MainMenuClass);
205
215
  var stdin_default = MainMenu;
@@ -1,5 +1,6 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { useContext } from "react";
3
+ import { useNavigate } from "react-router-dom";
3
4
  import PropTypes from "prop-types";
4
5
  import { Formik } from "formik";
5
6
  import * as Yup from "yup";
@@ -14,6 +15,8 @@ import { Input } from "../../Input/Input.js";
14
15
  import stdin_default$1 from "../../Checkbox/Checkbox.js";
15
16
  import { Button } from "../../Button/Button.styles.js";
16
17
  import { useNewVentureForm } from "../../../hooks/useNewVentureForm.js";
18
+ import { AppRoute, AppSurface } from "../../../routing/app-routes.js";
19
+ import { navigateApp } from "../../../routing/navigate-app.js";
17
20
  import { ModalInner } from "../Modal.styles.js";
18
21
  import { FormField, FormError } from "../../Form/Form.styles.js";
19
22
  const defaultProject = {
@@ -24,6 +27,7 @@ const defaultProject = {
24
27
  description: ""
25
28
  };
26
29
  const NewVentureModal = (props) => {
30
+ const navigate = useNavigate();
27
31
  const { user } = useContext(AuthContext);
28
32
  const {
29
33
  title = "Register Your Interest",
@@ -95,9 +99,9 @@ const NewVentureModal = (props) => {
95
99
  onSuccessMessageBtnClick();
96
100
  } else {
97
101
  if (user?._id) {
98
- window.location.href = `https://dashboard.${void 0}/checklist`;
102
+ navigateApp(navigate, AppSurface.DASHBOARD, AppRoute.CHECKLIST);
99
103
  } else {
100
- window.location.href = `/signup?email=${email}`;
104
+ navigate(`/signup?email=${encodeURIComponent(email)}`);
101
105
  }
102
106
  }
103
107
  },
@@ -7,6 +7,7 @@ import { Modal } from "../Modal.js";
7
7
  import { SuccessModalContent, AnimationContainer, Title, Subtitle, ContentWrapper } from "./SuccessModal.styles.js";
8
8
  import successAnimation from "../../../static/animations/checked.lottie.js";
9
9
  import progressAnimation from "../../../static/animations/progress.lottie.js";
10
+ import uploadAnimation from "../../../static/animations/upload.lottie.js";
10
11
  const variantConfig = {
11
12
  success: {
12
13
  animation: successAnimation,
@@ -17,6 +18,11 @@ const variantConfig = {
17
18
  animation: progressAnimation,
18
19
  segment: null,
19
20
  loop: false
21
+ },
22
+ upload: {
23
+ animation: uploadAnimation,
24
+ segment: null,
25
+ loop: false
20
26
  }
21
27
  };
22
28
  const SuccessModalComponent = ({
@@ -79,7 +85,7 @@ const SuccessModalComponent = ({
79
85
  SuccessModalComponent.propTypes = {
80
86
  isOpen: PropTypes.bool.isRequired,
81
87
  onClose: PropTypes.func.isRequired,
82
- variant: PropTypes.oneOf(["success", "progress"]),
88
+ variant: PropTypes.oneOf(["success", "progress", "upload"]),
83
89
  title: PropTypes.node,
84
90
  subtitle: PropTypes.node,
85
91
  content: PropTypes.node,
@@ -258,7 +258,7 @@ const AmountBlock = ({ config }) => {
258
258
  return /* @__PURE__ */ jsx(CurrencyLogo, { color: logoColor });
259
259
  };
260
260
  return /* @__PURE__ */ jsxs(AmountSection, { children: [
261
- /* @__PURE__ */ jsx(AmountLabel, { hasSubtitle: !!subtitle, children: label }),
261
+ /* @__PURE__ */ jsx(AmountLabel, { children: label }),
262
262
  /* @__PURE__ */ jsxs(AmountDisplay, { children: [
263
263
  /* @__PURE__ */ jsxs(AmountLeft, { children: [
264
264
  renderCurrencyLogo(),
@@ -0,0 +1,68 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ import { colors } from "../../styles/colors.js";
4
+ import { Root, Dot, Label } from "./StatusDot.styles.js";
5
+ const VARIANT_PRESETS = {
6
+ pending: {
7
+ color: colors.grey2,
8
+ backgroundColor: "rgba(155, 155, 155, 0.14)"
9
+ },
10
+ initiated: {
11
+ color: colors.blue,
12
+ backgroundColor: "#0050CA0D"
13
+ },
14
+ paid: {
15
+ color: colors.fernGreen,
16
+ backgroundColor: "#4D97410D"
17
+ },
18
+ declined: {
19
+ color: colors.darkRed,
20
+ backgroundColor: "rgba(210, 32, 13, 0.08)"
21
+ }
22
+ };
23
+ const StatusDot = ({
24
+ children,
25
+ variant,
26
+ color,
27
+ backgroundColor,
28
+ surface = "transparent",
29
+ uppercase = false,
30
+ dotSize = 6,
31
+ className,
32
+ style,
33
+ labelStyle,
34
+ onClick,
35
+ ...rest
36
+ }) => {
37
+ const preset = variant && VARIANT_PRESETS[variant] ? VARIANT_PRESETS[variant] : null;
38
+ const resolvedColor = color ?? preset?.color ?? colors.black;
39
+ const isSubtle = surface === "subtle";
40
+ const resolvedBackground = isSubtle && (backgroundColor !== void 0 ? backgroundColor : preset?.backgroundColor);
41
+ return /* @__PURE__ */ jsxs(
42
+ Root,
43
+ {
44
+ $subtle: isSubtle,
45
+ $backgroundColor: resolvedBackground,
46
+ $hasClick: Boolean(onClick),
47
+ className,
48
+ style,
49
+ onClick,
50
+ role: onClick ? "button" : void 0,
51
+ tabIndex: onClick ? 0 : void 0,
52
+ onKeyDown: onClick ? (e) => {
53
+ if (e.key === "Enter" || e.key === " ") {
54
+ e.preventDefault();
55
+ onClick(e);
56
+ }
57
+ } : void 0,
58
+ ...rest,
59
+ children: [
60
+ /* @__PURE__ */ jsx(Dot, { $size: dotSize, $color: resolvedColor }),
61
+ /* @__PURE__ */ jsx(Label, { $color: resolvedColor, $uppercase: uppercase, style: labelStyle, children })
62
+ ]
63
+ }
64
+ );
65
+ };
66
+ export {
67
+ StatusDot
68
+ };
@@ -0,0 +1,45 @@
1
+ import styled from "styled-components";
2
+ const Root = styled.div.withConfig({
3
+ shouldForwardProp: (prop) => !["$subtle", "$backgroundColor", "$hasClick"].includes(prop)
4
+ })`
5
+ display: inline-flex;
6
+ align-items: center;
7
+ gap: 8px;
8
+ box-sizing: border-box;
9
+ padding: ${(p) => p.$subtle ? "2px 8px" : "0"};
10
+ background-color: ${(p) => p.$subtle && p.$backgroundColor ? p.$backgroundColor : "transparent"};
11
+ border-radius: ${(p) => p.$subtle ? "2px" : "0"};
12
+ cursor: ${(p) => p.$hasClick ? "pointer" : "default"};
13
+ white-space: nowrap;
14
+ transition: opacity 0.2s ease;
15
+
16
+ ${(p) => p.$hasClick && `
17
+ &:hover {
18
+ opacity: 0.85;
19
+ }
20
+ `}
21
+ `;
22
+ const Dot = styled.span.withConfig({
23
+ shouldForwardProp: (prop) => !["$size", "$color"].includes(prop)
24
+ })`
25
+ width: ${(p) => p.$size}px;
26
+ height: ${(p) => p.$size}px;
27
+ border-radius: 50%;
28
+ background-color: ${(p) => p.$color};
29
+ flex-shrink: 0;
30
+ `;
31
+ const Label = styled.span.withConfig({
32
+ shouldForwardProp: (prop) => !["$color", "$uppercase"].includes(prop)
33
+ })`
34
+ font-size: ${(p) => p.$uppercase ? "11px" : "12px"};
35
+ font-weight: ${(p) => p.$uppercase ? "700" : "400"};
36
+ line-height: 20px;
37
+ color: ${(p) => p.$color};
38
+ text-transform: ${(p) => p.$uppercase ? "uppercase" : "none"};
39
+ letter-spacing: ${(p) => p.$uppercase ? "2px" : "0.6px"};
40
+ `;
41
+ export {
42
+ Dot,
43
+ Label,
44
+ Root
45
+ };
@@ -26,8 +26,9 @@ import "../../model/axios.js";
26
26
  import "../Layout/Layout.js";
27
27
  import "../LoginModal/LoginModal.js";
28
28
  import "../ForgotPasswordModal/ForgotPasswordModal.js";
29
- import "../2FA/main-flow.js";
30
29
  import { emailRegex } from "../../constants/globalVariables.js";
30
+ import "react-router-dom";
31
+ import "../2FA/main-flow.js";
31
32
  const renderSuccessModal = (continueUrl) => /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
32
33
  stdin_default$1,
33
34
  {
@@ -30,12 +30,16 @@ import "js-cookie";
30
30
  import "../../model/axios.js";
31
31
  import "../Layout/Layout.js";
32
32
  import stdin_default$3 from "../2FA/ResetCode.js";
33
- import { authAPI } from "../../api/auth.js";
33
+ import { authenticationApi } from "../../api/authenticationApi.js";
34
+ import { buildOnboardingUrl } from "../../utils/app-urls.js";
35
+ import "react-router-dom";
34
36
  import "../2FA/main-flow.js";
35
37
  import fetchDataPublic from "../../api/fetchDataPublic.js";
36
38
  import { withRouter } from "../../utils/withRouter.js";
37
39
  import { checkActionCode } from "firebase/auth";
38
40
  import { auth } from "../../firebase-config.js";
41
+ import { navigateApp } from "../../routing/navigate-app.js";
42
+ import { AppSurface } from "../../routing/app-routes.js";
39
43
  const Outer = styled.div.withConfig({
40
44
  shouldForwardProp: (props) => !["fixed"].includes(props)
41
45
  })`
@@ -233,7 +237,6 @@ const _HeaderHoClass = class _HeaderHoClass extends Component {
233
237
  }
234
238
  if (verifyEmailError?.code === "auth/invalid-action-code" && !window.location.href.includes("login")) {
235
239
  this.props.navigate("/login");
236
- this.props.navigate(0);
237
240
  }
238
241
  if (!isFetchingUser) {
239
242
  this.checkForModals();
@@ -553,7 +556,7 @@ const _HeaderHoClass = class _HeaderHoClass extends Component {
553
556
  payload.ventureInvite = true;
554
557
  }
555
558
  try {
556
- await authAPI("forgotPass", payload);
559
+ await authenticationApi.post("forgotPass", payload);
557
560
  this.setPopupSuccess(
558
561
  "forgot",
559
562
  `We sent a message to ${email} (you might need to check your junk or spam folder) — tap the link inside to create a new password.`
@@ -651,7 +654,7 @@ const _HeaderHoClass = class _HeaderHoClass extends Component {
651
654
  const query = new URLSearchParams(location?.search);
652
655
  let userType = query.get("user_type");
653
656
  if (userType && userType === "sa") {
654
- window.open(`https://backoffice.${void 0}`);
657
+ navigateApp(this.props.navigate, AppSurface.BACKOFFICE, "");
655
658
  } else {
656
659
  this.switchOpenModal("confirmReset", "login");
657
660
  }
@@ -666,7 +669,7 @@ const _HeaderHoClass = class _HeaderHoClass extends Component {
666
669
  popupError: this.state.popupError,
667
670
  popupSuccess: this.state.popupSuccess,
668
671
  isModalOpen: isModalOpen.verifyEmail,
669
- continueUrl: `https://signup.${void 0}/welcome`,
672
+ continueUrl: buildOnboardingUrl("/welcome"),
670
673
  error: verifyEmailError,
671
674
  isSuccess: !verifyEmailError,
672
675
  onModalSwitch: () => {
package/dist/config.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { initFirebase } from "./firebase-config.js";
2
2
  import axiosInstance from "./model/axios.js";
3
3
  import axiosInstance$1 from "./model/axiosPublic.js";
4
- const __vite_import_meta_env__ = { "BASE_URL": "/", "DEV": false, "MODE": "production", "PROD": true, "SSR": false };
5
- const _overrides = {};
4
+ import { assignRuntimeConfig } from "./runtime-config.js";
5
+ import { getConfig, resetRuntimeConfig } from "./runtime-config.js";
6
6
  let _lastFirebaseConfig = null;
7
7
  function configure(config = {}) {
8
- Object.assign(_overrides, config);
8
+ assignRuntimeConfig(config);
9
9
  if (config.apiUrl != null) {
10
10
  axiosInstance.defaults.baseURL = config.apiUrl;
11
11
  }
@@ -20,25 +20,9 @@ function configure(config = {}) {
20
20
  function getLastFirebaseConfig() {
21
21
  return _lastFirebaseConfig;
22
22
  }
23
- function env(name) {
24
- try {
25
- return __vite_import_meta_env__?.[name];
26
- } catch {
27
- return void 0;
28
- }
29
- }
30
- function getConfig(key) {
31
- const envMap = {
32
- apiUrl: "VITE_API_URL",
33
- baseUrlPublic: "VITE_BASE_URL_PUBLIC",
34
- cookieDomain: "VITE_COOKIE_DOMAIN",
35
- websiteDomain: "VITE_WEBSITE_DOMAIN",
36
- photoApiUrl: "VITE_PHOTO_API_URL"
37
- };
38
- return _overrides[key] ?? env(envMap[key]);
39
- }
40
23
  export {
41
24
  configure,
42
25
  getConfig,
43
- getLastFirebaseConfig
26
+ getLastFirebaseConfig,
27
+ resetRuntimeConfig
44
28
  };
@@ -1,5 +1,8 @@
1
- const platformDomain = void 0;
2
- const platformURL = "https://" + platformDomain;
1
+ import { getConfig } from "../runtime-config.js";
2
+ function getPlatformURL() {
3
+ const domain = getConfig("websiteDomain");
4
+ return domain ? `https://${domain}` : "";
5
+ }
3
6
  const walletTypes = {
4
7
  LIQUID: "liquid"
5
8
  };
@@ -80,8 +83,7 @@ export {
80
83
  USInvestorAcreditationStatuses,
81
84
  UserTypes,
82
85
  emailRegex,
83
- platformDomain,
84
- platformURL,
86
+ getPlatformURL,
85
87
  transactionTypeDisplayNames,
86
88
  walletTypes
87
89
  };
@@ -2,9 +2,10 @@ import Cookies from "js-cookie";
2
2
  import axios from "axios";
3
3
  import axiosInstance from "../model/axios.js";
4
4
  import getCookieDomain from "../utils/get-cookie-domain.js";
5
- import { getConfig, getLastFirebaseConfig } from "../config.js";
5
+ import { getLastFirebaseConfig } from "../config.js";
6
6
  import { getFirebaseAuth, initFirebase } from "../firebase-config.js";
7
7
  import { signInWithEmailAndPassword, createUserWithEmailAndPassword, applyActionCode, verifyPasswordResetCode, confirmPasswordReset, onAuthStateChanged, signInWithCustomToken, updatePassword, updateProfile } from "firebase/auth";
8
+ import { getConfig } from "../runtime-config.js";
8
9
  function normalizeCustomToken(token) {
9
10
  if (token == null) return "";
10
11
  if (typeof token === "object" && token !== null) {
@@ -61,7 +62,9 @@ class Auth {
61
62
  static async login(email, password) {
62
63
  const auth = getFirebaseAuth();
63
64
  if (!auth) {
64
- throw new Error("Firebase is not configured. Set VITE_FIREBASE_API_KEY (and other env vars) for auth.");
65
+ throw new Error(
66
+ "Firebase is not configured. Pass config.firebase via configure() / AuthProvider, or set VITE_FIREBASE_* for dev."
67
+ );
65
68
  }
66
69
  try {
67
70
  const userCredential = await signInWithEmailAndPassword(auth, email, password);