@stokr/components-library 3.0.20 → 3.0.22
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.
- package/README.md +217 -11
- package/dist/analytics/index.js +8 -1
- package/dist/api/authenticationApi.js +13 -0
- package/dist/auth/index.js +4 -2
- package/dist/components/2FA/login-with-otp-flow.js +9 -4
- package/dist/components/Footer/FooterLayout.js +98 -95
- package/dist/components/Footer/FooterMenu.js +1 -1
- package/dist/components/Header/Header.js +102 -54
- package/dist/components/MainMenu/MainMenu.js +14 -4
- package/dist/components/Modal/NewVentureModal/NewVentureModal.js +6 -2
- package/dist/components/Payment/PaymentDetailsCard.js +1 -1
- package/dist/components/VerifyEmailModal/VerifyEmailModal.js +2 -1
- package/dist/components/headerHo/HeaderHo.js +8 -5
- package/dist/config.js +5 -21
- package/dist/constants/globalVariables.js +6 -4
- package/dist/context/Auth.js +5 -2
- package/dist/context/AuthContext.js +22 -8
- package/dist/firebase-config.js +3 -17
- package/dist/index.js +36 -5
- package/dist/model/axios.js +4 -3
- package/dist/model/axiosPublic.js +2 -2
- package/dist/routing/RouterWrapper.js +17 -0
- package/dist/routing/app-routes.js +22 -0
- package/dist/routing/navigate-app.js +36 -0
- package/dist/routing/resolve-app-href.js +149 -0
- package/dist/runtime-config.js +94 -0
- package/dist/utils/app-urls-analytics-backoffice.js +30 -0
- package/dist/utils/app-urls.js +28 -0
- package/dist/utils/checklistGenerator.js +6 -5
- package/dist/utils/customHooks.js +1 -1
- package/dist/utils/formatCurrencyValue.js +2 -1
- package/dist/utils/get-cookie-domain.js +4 -1
- package/dist/utils/set-redirect-cookie.js +4 -1
- package/dist/utils/withRouter.js +5 -3
- package/package.json +1 -1
- 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 {
|
|
22
|
-
import {
|
|
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
|
-
|
|
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 = ({
|
|
87
|
-
|
|
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:
|
|
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
|
-
|
|
97
|
-
|
|
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
|
|
168
|
-
const
|
|
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:
|
|
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 ?
|
|
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(
|
|
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(
|
|
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
|
|
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 {
|
|
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
|
|
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
|
-
|
|
102
|
+
navigateApp(navigate, AppSurface.DASHBOARD, AppRoute.CHECKLIST);
|
|
99
103
|
} else {
|
|
100
|
-
|
|
104
|
+
navigate(`/signup?email=${encodeURIComponent(email)}`);
|
|
101
105
|
}
|
|
102
106
|
}
|
|
103
107
|
},
|
|
@@ -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, {
|
|
261
|
+
/* @__PURE__ */ jsx(AmountLabel, { children: label }),
|
|
262
262
|
/* @__PURE__ */ jsxs(AmountDisplay, { children: [
|
|
263
263
|
/* @__PURE__ */ jsxs(AmountLeft, { children: [
|
|
264
264
|
renderCurrencyLogo(),
|
|
@@ -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 {
|
|
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
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
5
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2
|
-
|
|
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
|
-
|
|
84
|
-
platformURL,
|
|
86
|
+
getPlatformURL,
|
|
85
87
|
transactionTypeDisplayNames,
|
|
86
88
|
walletTypes
|
|
87
89
|
};
|
package/dist/context/Auth.js
CHANGED
|
@@ -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 {
|
|
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(
|
|
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);
|
|
@@ -5,7 +5,11 @@ import React__default, { Component } from "react";
|
|
|
5
5
|
import fetchData from "../api/fetchData.js";
|
|
6
6
|
import { identify, reset } from "../analytics/index.js";
|
|
7
7
|
import { withRouter } from "../utils/withRouter.js";
|
|
8
|
-
import { configure
|
|
8
|
+
import { configure } from "../config.js";
|
|
9
|
+
import { AppSurface, AppRoute } from "../routing/app-routes.js";
|
|
10
|
+
import { resolveAppHref, isAlreadyOnOnboardingFlow } from "../routing/resolve-app-href.js";
|
|
11
|
+
import { navigateToHref, navigateApp } from "../routing/navigate-app.js";
|
|
12
|
+
import { getConfig } from "../runtime-config.js";
|
|
9
13
|
import { Text } from "../components/Text/Text.styles.js";
|
|
10
14
|
import { getFirebaseAuth } from "../firebase-config.js";
|
|
11
15
|
import { Auth } from "./Auth.js";
|
|
@@ -304,7 +308,8 @@ class AuthProviderClass extends Component {
|
|
|
304
308
|
loggedOutDueToCookieExpiry: options.dueToCookieExpiry === true
|
|
305
309
|
});
|
|
306
310
|
if (redirect) {
|
|
307
|
-
|
|
311
|
+
const home = resolveAppHref(AppSurface.INVESTOR_ROOT, "") || `https://${getConfig("websiteDomain")}`;
|
|
312
|
+
navigateToHref(this.props.navigate, home);
|
|
308
313
|
}
|
|
309
314
|
};
|
|
310
315
|
clearLoggedOutDueToInactivity = () => {
|
|
@@ -405,11 +410,11 @@ class AuthProviderClass extends Component {
|
|
|
405
410
|
checkUserIsValid = (user) => {
|
|
406
411
|
if (!user) {
|
|
407
412
|
throw new Error("User is not defined");
|
|
408
|
-
} else if (!user?.emailVerified && !
|
|
409
|
-
|
|
413
|
+
} else if (!user?.emailVerified && !isAlreadyOnOnboardingFlow()) {
|
|
414
|
+
navigateApp(this.props.navigate, AppSurface.ONBOARDING, AppRoute.RESEND_ACTIVATION);
|
|
410
415
|
return false;
|
|
411
|
-
} else if (!user?.country && user?.user_type === "investor" && !
|
|
412
|
-
|
|
416
|
+
} else if (!user?.country && user?.user_type === "investor" && !isAlreadyOnOnboardingFlow()) {
|
|
417
|
+
navigateApp(this.props.navigate, AppSurface.ONBOARDING, AppRoute.WELCOME);
|
|
413
418
|
return false;
|
|
414
419
|
}
|
|
415
420
|
return true;
|
|
@@ -447,7 +452,6 @@ class AuthProviderClass extends Component {
|
|
|
447
452
|
};
|
|
448
453
|
replaceLocationPathName = () => {
|
|
449
454
|
const pathname = this.props.location?.pathname ?? "";
|
|
450
|
-
console.log("🚀 ~ file: AuthContext.js:511 ~ replaceLocationPathName ~ pathname:", pathname);
|
|
451
455
|
if (pathname === "/login" || pathname === "/signup") {
|
|
452
456
|
this.props.navigate("/");
|
|
453
457
|
}
|
|
@@ -740,7 +744,7 @@ class AuthProviderClass extends Component {
|
|
|
740
744
|
AuthProviderClass.propTypes = {
|
|
741
745
|
children: PropTypes.node.isRequired,
|
|
742
746
|
/** Runtime config for the library. Sets API URLs, Firebase config, cookie domain, etc.
|
|
743
|
-
* When omitted, the library falls back to
|
|
747
|
+
* When omitted, the library falls back to Vite env via getConfig() (Storybook / dev).
|
|
744
748
|
* When consumed as an npm package, pass this prop so values are available at runtime. */
|
|
745
749
|
config: PropTypes.shape({
|
|
746
750
|
apiUrl: PropTypes.string,
|
|
@@ -748,6 +752,16 @@ AuthProviderClass.propTypes = {
|
|
|
748
752
|
cookieDomain: PropTypes.string,
|
|
749
753
|
websiteDomain: PropTypes.string,
|
|
750
754
|
photoApiUrl: PropTypes.string,
|
|
755
|
+
/** Set to `'path'` for single-origin URLs (`/dashboard`, `/admin`, …). Omit for legacy `*.websiteDomain` subdomains. */
|
|
756
|
+
routingMode: PropTypes.oneOf(["path"]),
|
|
757
|
+
/** Path mode only: override first path segments (e.g. `{ onboarding: '/signup', dashboard: '/app/dashboard' }`). */
|
|
758
|
+
appUrlPaths: PropTypes.object,
|
|
759
|
+
/**
|
|
760
|
+
* Optional per-surface URL style for incremental cutover. Keys: `onboarding`, `dashboard`, `admin`, `registerEntry`, `investorRoot`.
|
|
761
|
+
* Each value: `'path'` (same-origin prefix from `appUrlPaths`) or `'subdomain'` (legacy `https://{sub}.{websiteDomain}`).
|
|
762
|
+
* Omitted keys follow global `routingMode` (`path` vs default subdomain).
|
|
763
|
+
*/
|
|
764
|
+
surfaceRoutingMode: PropTypes.object,
|
|
751
765
|
firebase: PropTypes.shape({
|
|
752
766
|
apiKey: PropTypes.string,
|
|
753
767
|
authDomain: PropTypes.string,
|
package/dist/firebase-config.js
CHANGED
|
@@ -1,23 +1,9 @@
|
|
|
1
1
|
import { getApps, getApp, initializeApp } from "firebase/app";
|
|
2
2
|
import { initializeAuth, inMemoryPersistence, getAuth } from "firebase/auth";
|
|
3
|
+
import { getConfig } from "./runtime-config.js";
|
|
3
4
|
const __vite_import_meta_env__ = {};
|
|
4
5
|
let app = null;
|
|
5
6
|
let auth = null;
|
|
6
|
-
function getEnvFirebaseConfig() {
|
|
7
|
-
try {
|
|
8
|
-
return {
|
|
9
|
-
apiKey: "AIzaSyBBp_3Romnfv--YpUuV0mJgDymvSp3oq0c",
|
|
10
|
-
authDomain: "stokr-development-env.firebaseapp.com",
|
|
11
|
-
projectId: "stokr-development-env",
|
|
12
|
-
storageBucket: "stokr-development-env.appspot.com",
|
|
13
|
-
messagingSenderId: "568229412804",
|
|
14
|
-
appId: "1:568229412804:web:2391857e3e2a0b02346e91",
|
|
15
|
-
measurementId: "G-CP53SZVSMN"
|
|
16
|
-
};
|
|
17
|
-
} catch {
|
|
18
|
-
return {};
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
7
|
function isValidConfig(config) {
|
|
22
8
|
return config?.apiKey != null && String(config.apiKey).trim() !== "";
|
|
23
9
|
}
|
|
@@ -25,7 +11,7 @@ function getFirebaseAuth() {
|
|
|
25
11
|
return auth;
|
|
26
12
|
}
|
|
27
13
|
function initFirebase(configOverride) {
|
|
28
|
-
const firebaseConfig = configOverride
|
|
14
|
+
const firebaseConfig = configOverride != null ? configOverride : getConfig("firebase");
|
|
29
15
|
if (!isValidConfig(firebaseConfig)) {
|
|
30
16
|
if (configOverride && typeof console !== "undefined" && console.warn) {
|
|
31
17
|
console.warn(
|
|
@@ -63,7 +49,7 @@ function initFirebase(configOverride) {
|
|
|
63
49
|
}
|
|
64
50
|
}
|
|
65
51
|
}
|
|
66
|
-
if (typeof __vite_import_meta_env__ !== "undefined" && isValidConfig(
|
|
52
|
+
if (typeof __vite_import_meta_env__ !== "undefined" && isValidConfig(getConfig("firebase"))) {
|
|
67
53
|
initFirebase();
|
|
68
54
|
}
|
|
69
55
|
export {
|