@stokr/components-library 3.0.77 → 3.1.0-alpha.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.
- package/dist/components/Input/InputPassword.js +3 -5
- package/dist/components/Input/OtpInput.js +1 -3
- package/dist/components/MenuNav/MenuNav.styles.js +1 -2
- package/dist/components/Modal/Modal.styles.js +2 -3
- package/dist/components/Newsletter/Newsletter.js +1 -3
- package/dist/components/NotificationCounter/NotificationCounter.styles.js +1 -2
- package/dist/components/SmartLink/SmartLink.js +0 -2
- package/dist/components/StepController/StepController.js +3 -5
- package/dist/components/StepController/StepController.styles.js +102 -1
- package/dist/components/StepController/StepControllerProgress.js +1 -1
- package/dist/components/Switch/Switch.js +1 -3
- package/dist/components/ToDoList/ToDoListTask.js +15 -3
- package/dist/components/taxId/register-taxid.js +7 -5
- package/dist/index.js +67 -141
- package/dist/runtime-config.js +4 -70
- package/dist/styles/global.js +1 -2
- package/dist/utils/check-todo-status.js +1 -2
- package/package.json +8 -14
- package/dist/api/authenticationApi.js +0 -13
- package/dist/auth/index.js +0 -34
- package/dist/components/2FA/Connect2FA.js +0 -58
- package/dist/components/2FA/EnterCode.js +0 -74
- package/dist/components/2FA/InstallAuthApp.js +0 -68
- package/dist/components/2FA/ResetCode.js +0 -34
- package/dist/components/2FA/Sucess2FA.js +0 -63
- package/dist/components/2FA/disable-2fa-flow.js +0 -104
- package/dist/components/2FA/enable-2fa-flow.js +0 -167
- package/dist/components/2FA/login-with-otp-flow.js +0 -262
- package/dist/components/2FA/main-flow.js +0 -273
- package/dist/components/Footer/Footer.js +0 -69
- package/dist/components/Footer/Footer.styles.js +0 -277
- package/dist/components/Footer/FooterLayout.js +0 -150
- package/dist/components/Footer/FooterMenu.js +0 -107
- package/dist/components/Footer/FooterMenu.styles.js +0 -334
- package/dist/components/ForgotPasswordModal/ForgotPasswordModal.js +0 -121
- package/dist/components/Header/Header.js +0 -441
- package/dist/components/Header/Header.styles.js +0 -568
- package/dist/components/Layout/Layout.js +0 -76
- package/dist/components/LoginModal/LoginModal.js +0 -165
- package/dist/components/MainMenu/DynamicMainMenu.js +0 -38
- package/dist/components/MainMenu/MainMenu.js +0 -220
- package/dist/components/MainMenu/MainMenu.styles.js +0 -362
- package/dist/components/Modal/NewVentureModal/NewVentureModal.js +0 -273
- package/dist/components/RegisterConfirmModal/RegisterConfirmModal.js +0 -74
- package/dist/components/RegisterConfirmModal/RegisterConfirmModal.styles.js +0 -20
- package/dist/components/RegisterModal/RegisterModal.js +0 -278
- package/dist/components/ResetConfirmModal/ResetConfirmModal.js +0 -40
- package/dist/components/ResetConfirmModal/ResetConfirmModal.styles.js +0 -41
- package/dist/components/ResetPasswordModal/ResetPasswordModal.js +0 -145
- package/dist/components/StepsProgress/StepIndicator.js +0 -40
- package/dist/components/StepsProgress/StepIndicator.styles.js +0 -69
- package/dist/components/StepsProgress/StepsProgress.js +0 -67
- package/dist/components/StepsProgress/StepsProgress.styles.js +0 -105
- package/dist/components/TermsModal/TermsModal.js +0 -145
- package/dist/components/TermsModal/_styles.js +0 -313
- package/dist/components/VerifyEmailModal/VerifyEmailModal.js +0 -122
- package/dist/components/headerHo/HeaderHo.js +0 -707
- package/dist/config.js +0 -33
- package/dist/context/Auth.js +0 -423
- package/dist/context/AuthContext.js +0 -1016
- package/dist/firebase-config.js +0 -56
- package/dist/hooks/useNewVentureForm.js +0 -235
- package/dist/static/images/background3.png.js +0 -4
- package/dist/static/images/google_auth.png.js +0 -4
- package/dist/static/images/iso27001-black.svg.js +0 -4
- package/dist/static/images/mangopay.svg.js +0 -4
- package/dist/static/images/social/Facebook_Logo.png.js +0 -4
- package/dist/static/images/social/LI-In-Bug.png.js +0 -4
- package/dist/static/images/social/Telegram-Logo.png.js +0 -4
- package/dist/static/images/social/X-logo-black.png.js +0 -4
- package/dist/static/images/social/youtube_social_circle_red.png.js +0 -4
- package/dist/utils/show-account-locked-modal.js +0 -23
- package/dist/utils/user-identity.js +0 -10
- package/dist/utils/withRouter.js +0 -26
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import stdin_default$2 from "./EnterCode.js";
|
|
4
|
-
import stdin_default$3 from "./ResetCode.js";
|
|
5
|
-
import { Layout } from "../Layout/Layout.js";
|
|
6
|
-
import { useNavigate } from "react-router-dom";
|
|
7
|
-
import stdin_default$1 from "../LoginModal/LoginModal.js";
|
|
8
|
-
import { AuthContext } from "../../context/AuthContext.js";
|
|
9
|
-
import background from "../../static/images/background3.png.js";
|
|
10
|
-
import { hasLoggedInSession } from "../../utils/user-identity.js";
|
|
11
|
-
import { authenticationApi } from "../../api/authenticationApi.js";
|
|
12
|
-
import { getConfig, getPlatformURL } from "../../runtime-config.js";
|
|
13
|
-
import { useContext, useRef, useState, useEffect } from "react";
|
|
14
|
-
import stdin_default$4 from "../ForgotPasswordModal/ForgotPasswordModal.js";
|
|
15
|
-
import { isAccountLockedError, showAccountLockedModal } from "../../utils/show-account-locked-modal.js";
|
|
16
|
-
import { navigateToHref } from "../../routing/navigate-app.js";
|
|
17
|
-
const closedModalsState = {
|
|
18
|
-
login: false,
|
|
19
|
-
enter2fa: false,
|
|
20
|
-
forgot: false,
|
|
21
|
-
resetCode: false
|
|
22
|
-
};
|
|
23
|
-
const LoginWithOTP = ({ withBackground, useRelativePathForMenu = false, onLoginSuccess }) => {
|
|
24
|
-
const navigate = useNavigate();
|
|
25
|
-
const { user, loginUser, getUser, waitingFor2fa, firebaseError, loginUserWithTotp, reset2faFlow, logoutUser } = useContext(AuthContext);
|
|
26
|
-
const loginSuccessHandledRef = useRef(false);
|
|
27
|
-
const [isModalOpen, setIsModalOpen] = useState({
|
|
28
|
-
login: true,
|
|
29
|
-
enter2fa: false,
|
|
30
|
-
forgot: false,
|
|
31
|
-
resetCode: false
|
|
32
|
-
});
|
|
33
|
-
const [isActionLoading, setIsActionLoading] = useState();
|
|
34
|
-
const [popupError, setPopupError] = useState({
|
|
35
|
-
popup: void 0,
|
|
36
|
-
message: void 0
|
|
37
|
-
});
|
|
38
|
-
const [popupSuccess, setPopupSuccess] = useState({
|
|
39
|
-
popup: void 0,
|
|
40
|
-
message: void 0
|
|
41
|
-
});
|
|
42
|
-
const switchOpenModal = (prevModalId, nextModalId) => {
|
|
43
|
-
setIsModalOpen((prev) => ({
|
|
44
|
-
...prev,
|
|
45
|
-
[prevModalId]: false,
|
|
46
|
-
[nextModalId]: true
|
|
47
|
-
}));
|
|
48
|
-
};
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
if (waitingFor2fa) {
|
|
51
|
-
setIsModalOpen((prev) => ({
|
|
52
|
-
...prev,
|
|
53
|
-
login: false,
|
|
54
|
-
enter2fa: true
|
|
55
|
-
}));
|
|
56
|
-
}
|
|
57
|
-
}, [waitingFor2fa]);
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
if (!hasLoggedInSession(user) || waitingFor2fa) {
|
|
60
|
-
loginSuccessHandledRef.current = false;
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
setIsModalOpen(closedModalsState);
|
|
64
|
-
if (onLoginSuccess && !loginSuccessHandledRef.current) {
|
|
65
|
-
loginSuccessHandledRef.current = true;
|
|
66
|
-
onLoginSuccess(user);
|
|
67
|
-
}
|
|
68
|
-
}, [user, waitingFor2fa, onLoginSuccess]);
|
|
69
|
-
const handleSetPopupSuccess = (popup, message) => {
|
|
70
|
-
setPopupSuccess({ popup, message });
|
|
71
|
-
};
|
|
72
|
-
const clearPopupSuccess = () => {
|
|
73
|
-
setPopupSuccess({
|
|
74
|
-
popup: void 0,
|
|
75
|
-
message: void 0
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
const handleSetPopupError = (popup, message) => {
|
|
79
|
-
setPopupError({ popup, message });
|
|
80
|
-
};
|
|
81
|
-
const clearPopupError = () => {
|
|
82
|
-
setPopupError({
|
|
83
|
-
popup: void 0,
|
|
84
|
-
message: void 0
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
const backgroundProp = `url(${background}) left top no-repeat`;
|
|
88
|
-
return /* @__PURE__ */ jsxs(Layout, { noHeader: true, noFooter: true, useRelativePathForMenu, children: [
|
|
89
|
-
/* @__PURE__ */ jsx(
|
|
90
|
-
stdin_default$1,
|
|
91
|
-
{
|
|
92
|
-
isActionLoading,
|
|
93
|
-
popupError,
|
|
94
|
-
background: withBackground && backgroundProp,
|
|
95
|
-
isModalOpen: isModalOpen.login,
|
|
96
|
-
onModalClose: () => {
|
|
97
|
-
navigateToHref(navigate, getPlatformURL());
|
|
98
|
-
},
|
|
99
|
-
onModalSwitch: () => {
|
|
100
|
-
navigateToHref(navigate, getConfig("registerUrl"));
|
|
101
|
-
},
|
|
102
|
-
onForgotPassword: () => {
|
|
103
|
-
switchOpenModal("login", "forgot");
|
|
104
|
-
clearPopupError();
|
|
105
|
-
setIsActionLoading(void 0);
|
|
106
|
-
},
|
|
107
|
-
logoutUser,
|
|
108
|
-
onFormSend: async ({ email, password }) => {
|
|
109
|
-
clearPopupError();
|
|
110
|
-
setIsActionLoading("login");
|
|
111
|
-
try {
|
|
112
|
-
if (password.length > 128) {
|
|
113
|
-
handleSetPopupError("login", "Your password cannot exceed 128 characters");
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
await loginUser(email, password);
|
|
117
|
-
await getUser();
|
|
118
|
-
clearPopupError();
|
|
119
|
-
} catch (error) {
|
|
120
|
-
const errorMessage = error?.message;
|
|
121
|
-
if (error?.code === "auth/multi-factor-auth-required") {
|
|
122
|
-
clearPopupError();
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
if (isAccountLockedError(error)) {
|
|
126
|
-
clearPopupError();
|
|
127
|
-
setIsModalOpen((prev) => ({
|
|
128
|
-
...prev,
|
|
129
|
-
login: false
|
|
130
|
-
}));
|
|
131
|
-
await showAccountLockedModal({
|
|
132
|
-
background: withBackground ? backgroundProp : void 0
|
|
133
|
-
});
|
|
134
|
-
setIsModalOpen((prev) => ({
|
|
135
|
-
...prev,
|
|
136
|
-
login: true
|
|
137
|
-
}));
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
if (errorMessage) {
|
|
141
|
-
handleSetPopupError("login", errorMessage);
|
|
142
|
-
} else {
|
|
143
|
-
handleSetPopupError("login", "Oops. Something's not right there. Try again?");
|
|
144
|
-
}
|
|
145
|
-
} finally {
|
|
146
|
-
setIsActionLoading(void 0);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
),
|
|
151
|
-
/* @__PURE__ */ jsx(
|
|
152
|
-
stdin_default$2,
|
|
153
|
-
{
|
|
154
|
-
isModal: true,
|
|
155
|
-
isActionLoading,
|
|
156
|
-
popupError,
|
|
157
|
-
isModalOpen: isModalOpen.enter2fa,
|
|
158
|
-
background: withBackground && backgroundProp,
|
|
159
|
-
onModalClose: () => {
|
|
160
|
-
reset2faFlow();
|
|
161
|
-
switchOpenModal("enter2fa", "login");
|
|
162
|
-
clearPopupError();
|
|
163
|
-
setIsActionLoading(void 0);
|
|
164
|
-
},
|
|
165
|
-
onModalSwitch: () => {
|
|
166
|
-
switchOpenModal("enter2fa", "resetCode");
|
|
167
|
-
clearPopupError();
|
|
168
|
-
setIsActionLoading(void 0);
|
|
169
|
-
},
|
|
170
|
-
onFormSend: async ({ otpInput }) => {
|
|
171
|
-
setIsActionLoading("enter2fa");
|
|
172
|
-
try {
|
|
173
|
-
await loginUserWithTotp(otpInput, firebaseError);
|
|
174
|
-
await getUser();
|
|
175
|
-
clearPopupError();
|
|
176
|
-
setIsModalOpen(closedModalsState);
|
|
177
|
-
} catch (error) {
|
|
178
|
-
if (error?.code === "auth/invalid-verification-code") {
|
|
179
|
-
handleSetPopupError("enter2fa", "The verification code is not correct. Try again?");
|
|
180
|
-
} else if (error?.code === "auth/code-expired") {
|
|
181
|
-
handleSetPopupError("enter2fa", "Time out. Please restart the flow and log in again");
|
|
182
|
-
} else {
|
|
183
|
-
handleSetPopupError("enter2fa", error?.message);
|
|
184
|
-
}
|
|
185
|
-
} finally {
|
|
186
|
-
setIsActionLoading(void 0);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
),
|
|
191
|
-
/* @__PURE__ */ jsx(
|
|
192
|
-
stdin_default$3,
|
|
193
|
-
{
|
|
194
|
-
isModalOpen: isModalOpen.resetCode,
|
|
195
|
-
background: withBackground && backgroundProp,
|
|
196
|
-
onModalClose: () => {
|
|
197
|
-
switchOpenModal("resetCode", "login");
|
|
198
|
-
clearPopupError();
|
|
199
|
-
setIsActionLoading(void 0);
|
|
200
|
-
},
|
|
201
|
-
onModalSwitch: () => {
|
|
202
|
-
switchOpenModal("resetCode", "enter2fa");
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
),
|
|
206
|
-
/* @__PURE__ */ jsx(
|
|
207
|
-
stdin_default$4,
|
|
208
|
-
{
|
|
209
|
-
isActionLoading,
|
|
210
|
-
popupError,
|
|
211
|
-
background: withBackground && backgroundProp,
|
|
212
|
-
popupSuccess,
|
|
213
|
-
isModalOpen: isModalOpen.forgot,
|
|
214
|
-
onModalClose: () => {
|
|
215
|
-
switchOpenModal("forgot", "login");
|
|
216
|
-
clearPopupError();
|
|
217
|
-
clearPopupSuccess();
|
|
218
|
-
setIsActionLoading(void 0);
|
|
219
|
-
},
|
|
220
|
-
onModalSwitch: () => {
|
|
221
|
-
switchOpenModal("forgot", "login");
|
|
222
|
-
clearPopupError();
|
|
223
|
-
clearPopupSuccess();
|
|
224
|
-
setIsActionLoading(void 0);
|
|
225
|
-
},
|
|
226
|
-
onFormSend: async ({ email }) => {
|
|
227
|
-
clearPopupError();
|
|
228
|
-
setIsActionLoading("forgot");
|
|
229
|
-
try {
|
|
230
|
-
await authenticationApi.post("forgotPass", {
|
|
231
|
-
email
|
|
232
|
-
});
|
|
233
|
-
handleSetPopupSuccess(
|
|
234
|
-
"forgot",
|
|
235
|
-
`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.`
|
|
236
|
-
);
|
|
237
|
-
setIsActionLoading(void 0);
|
|
238
|
-
} catch (error) {
|
|
239
|
-
let errorMessage = `Too many requests. Please try again later.`;
|
|
240
|
-
console.log(error?.response);
|
|
241
|
-
if (error?.response?.status === 429) {
|
|
242
|
-
errorMessage = error.response.data?.message;
|
|
243
|
-
}
|
|
244
|
-
handleSetPopupError("forgot", errorMessage);
|
|
245
|
-
setIsActionLoading(void 0);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
)
|
|
250
|
-
] });
|
|
251
|
-
};
|
|
252
|
-
LoginWithOTP.propTypes = {
|
|
253
|
-
withBackground: PropTypes.bool,
|
|
254
|
-
useRelativePathForMenu: PropTypes.bool,
|
|
255
|
-
/** Called once when login (and optional 2FA) completes and the user session is ready. */
|
|
256
|
-
onLoginSuccess: PropTypes.func
|
|
257
|
-
};
|
|
258
|
-
var stdin_default = LoginWithOTP;
|
|
259
|
-
export {
|
|
260
|
-
LoginWithOTP,
|
|
261
|
-
stdin_default as default
|
|
262
|
-
};
|
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import React__default, { useContext, useState, useRef, useEffect } from "react";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
import { AuthContext } from "../../context/AuthContext.js";
|
|
5
|
-
import { ComponentWrapper } from "../ComponentWrapper/ComponentWrapper.styles.js";
|
|
6
|
-
import stdin_default$1 from "../Switch/Switch.js";
|
|
7
|
-
import { Text } from "../Text/Text.styles.js";
|
|
8
|
-
import stdin_default$5 from "./login-with-otp-flow.js";
|
|
9
|
-
import stdin_default$2 from "./enable-2fa-flow.js";
|
|
10
|
-
import stdin_default$3 from "./disable-2fa-flow.js";
|
|
11
|
-
import { colors } from "../../styles/colors.js";
|
|
12
|
-
import { InfoIcon } from "../InfoIcon/InfoIcon.js";
|
|
13
|
-
import { Modal } from "../Modal/Modal.js";
|
|
14
|
-
import stdin_default$4 from "./Sucess2FA.js";
|
|
15
|
-
import { ModalInner } from "../Modal/Modal.styles.js";
|
|
16
|
-
import { showProgress } from "../Modal/SuccessModal/SuccessModal.js";
|
|
17
|
-
const SUPPORT_URL = "https://support.stokr.io/";
|
|
18
|
-
const Main2FAFlow = ({
|
|
19
|
-
onRequiresRecentLoginError,
|
|
20
|
-
open2faflow,
|
|
21
|
-
onLoginAgainClick,
|
|
22
|
-
openDisable2faflow,
|
|
23
|
-
allowDisable2FA = false,
|
|
24
|
-
title = "SET UP YOUR LOG IN TWO FACTOR AUTHENTICATION",
|
|
25
|
-
subtitle = "Protect your account with an additional layer of security to log in",
|
|
26
|
-
showSwitch = true,
|
|
27
|
-
customComponent,
|
|
28
|
-
onFlowClose,
|
|
29
|
-
recentLoginTitle = "LOG IN AGAIN",
|
|
30
|
-
recentLoginSubtitle = "To continue please log in again and set up your two factor authentication",
|
|
31
|
-
recentLoginCTA = "Log in again",
|
|
32
|
-
showInlineLoginOnLogout = true
|
|
33
|
-
}) => {
|
|
34
|
-
const { user, checkMfaEnrollment, userMfaEnrollment, generateTotpSecret, logoutUser } = useContext(AuthContext);
|
|
35
|
-
const [isFlowopen, setIsFlowOpen] = useState({
|
|
36
|
-
enable2fa: open2faflow || false,
|
|
37
|
-
disable2fa: allowDisable2FA && (openDisable2faflow || false),
|
|
38
|
-
requiresRecentLogin: false
|
|
39
|
-
});
|
|
40
|
-
const [is2FAEnabled, setis2FAEnabled] = useState(false);
|
|
41
|
-
const [successMessage, setsuccessMessage] = useState();
|
|
42
|
-
const [isLoginRequired, setisLoginRequired] = useState(false);
|
|
43
|
-
const [totpData, settotpData] = useState();
|
|
44
|
-
const [awaitingReauthFor2fa, setAwaitingReauthFor2fa] = useState(false);
|
|
45
|
-
const enable2faCompletedRef = useRef(false);
|
|
46
|
-
const disable2faCompletedRef = useRef(false);
|
|
47
|
-
const onRequiresRecentLoginErrorHandler = () => {
|
|
48
|
-
setIsFlowOpen({
|
|
49
|
-
requiresRecentLogin: true,
|
|
50
|
-
enable2fa: false,
|
|
51
|
-
disable2fa: false
|
|
52
|
-
});
|
|
53
|
-
onRequiresRecentLoginError?.();
|
|
54
|
-
};
|
|
55
|
-
const generateTotp = async () => {
|
|
56
|
-
try {
|
|
57
|
-
const response = await generateTotpSecret();
|
|
58
|
-
settotpData(response);
|
|
59
|
-
} catch (error) {
|
|
60
|
-
if (error.code === "auth/requires-recent-login" || error.code === "auth/unsupported-first-factor") {
|
|
61
|
-
setisLoginRequired(true);
|
|
62
|
-
if (isFlowopen.enable2fa && !isFlowopen.requiresRecentLogin) {
|
|
63
|
-
onRequiresRecentLoginErrorHandler();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
useEffect(() => {
|
|
69
|
-
if (userMfaEnrollment?.length > 0) {
|
|
70
|
-
setis2FAEnabled(true);
|
|
71
|
-
} else if (user && !awaitingReauthFor2fa) {
|
|
72
|
-
checkMfaEnrollment();
|
|
73
|
-
generateTotp();
|
|
74
|
-
}
|
|
75
|
-
}, [user, userMfaEnrollment, awaitingReauthFor2fa]);
|
|
76
|
-
useEffect(() => {
|
|
77
|
-
if (!user || !awaitingReauthFor2fa) return;
|
|
78
|
-
setAwaitingReauthFor2fa(false);
|
|
79
|
-
setisLoginRequired(false);
|
|
80
|
-
setIsFlowOpen((prev) => ({
|
|
81
|
-
...prev,
|
|
82
|
-
requiresRecentLogin: false,
|
|
83
|
-
enable2fa: true
|
|
84
|
-
}));
|
|
85
|
-
checkMfaEnrollment();
|
|
86
|
-
generateTotp();
|
|
87
|
-
}, [user, awaitingReauthFor2fa]);
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
let timeoutId;
|
|
90
|
-
if (successMessage) {
|
|
91
|
-
timeoutId = setTimeout(setsuccessMessage, 400);
|
|
92
|
-
}
|
|
93
|
-
return () => {
|
|
94
|
-
if (timeoutId != null) clearTimeout(timeoutId);
|
|
95
|
-
};
|
|
96
|
-
}, [successMessage]);
|
|
97
|
-
const switchOpenFlow = (prevFlowId, nextFlowId) => {
|
|
98
|
-
setIsFlowOpen((prev) => ({
|
|
99
|
-
...prev,
|
|
100
|
-
[prevFlowId]: false,
|
|
101
|
-
[nextFlowId]: true
|
|
102
|
-
}));
|
|
103
|
-
};
|
|
104
|
-
const showDisable2faBlockedModal = () => showProgress({
|
|
105
|
-
title: "TWO-FACTOR AUTHENTICATION REQUIRED",
|
|
106
|
-
subtitle: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
107
|
-
"Under our security policy, two-factor authentication is required on all accounts and cannot be turned off. To reset your method, contact our",
|
|
108
|
-
" ",
|
|
109
|
-
/* @__PURE__ */ jsx("a", { href: SUPPORT_URL, target: "_blank", rel: "noreferrer", style: { textDecoration: "underline" }, children: /* @__PURE__ */ jsx("u", { children: "support team" }) }),
|
|
110
|
-
"."
|
|
111
|
-
] }),
|
|
112
|
-
maxWidth: "820px"
|
|
113
|
-
});
|
|
114
|
-
const handleFlowClose = (flowId, completed = false) => {
|
|
115
|
-
setIsFlowOpen((prev) => ({ ...prev, [flowId]: false }));
|
|
116
|
-
if (onFlowClose) onFlowClose({ flow: flowId, completed });
|
|
117
|
-
};
|
|
118
|
-
const onEnable2FASuccess = async () => {
|
|
119
|
-
enable2faCompletedRef.current = true;
|
|
120
|
-
setis2FAEnabled(true);
|
|
121
|
-
checkMfaEnrollment();
|
|
122
|
-
setsuccessMessage("Your log in 2FA authentication is now set");
|
|
123
|
-
};
|
|
124
|
-
const onDisable2FASuccess = async () => {
|
|
125
|
-
disable2faCompletedRef.current = true;
|
|
126
|
-
setis2FAEnabled(false);
|
|
127
|
-
checkMfaEnrollment();
|
|
128
|
-
setsuccessMessage("Your log in 2FA authentication is removed");
|
|
129
|
-
};
|
|
130
|
-
const handleLoginAgain = async () => {
|
|
131
|
-
setIsFlowOpen((prev) => ({
|
|
132
|
-
...prev,
|
|
133
|
-
requiresRecentLogin: false,
|
|
134
|
-
enable2fa: false,
|
|
135
|
-
disable2fa: false
|
|
136
|
-
}));
|
|
137
|
-
await logoutUser();
|
|
138
|
-
setAwaitingReauthFor2fa(true);
|
|
139
|
-
onLoginAgainClick?.();
|
|
140
|
-
};
|
|
141
|
-
const flowActions = {
|
|
142
|
-
openEnable2FA: () => switchOpenFlow("disable2fa", "enable2fa"),
|
|
143
|
-
openDisable2FA: () => {
|
|
144
|
-
if (!is2FAEnabled) return;
|
|
145
|
-
if (!allowDisable2FA) {
|
|
146
|
-
void showDisable2faBlockedModal();
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
switchOpenFlow("enable2fa", "disable2fa");
|
|
150
|
-
},
|
|
151
|
-
closeFlows: () => {
|
|
152
|
-
const wasOpen = Object.keys(isFlowopen).find((key) => isFlowopen[key]);
|
|
153
|
-
setIsFlowOpen({
|
|
154
|
-
enable2fa: false,
|
|
155
|
-
disable2fa: false,
|
|
156
|
-
requiresRecentLogin: false
|
|
157
|
-
});
|
|
158
|
-
if (wasOpen) {
|
|
159
|
-
onFlowClose?.(wasOpen);
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
is2FAEnabled,
|
|
163
|
-
isFlowOpen: isFlowopen
|
|
164
|
-
};
|
|
165
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
166
|
-
/* @__PURE__ */ jsx(ComponentWrapper, { alignVertically: true, noPaddingHorizontal: true, children: /* @__PURE__ */ jsx(Text, { children: /* @__PURE__ */ jsx("h5", { children: title }) }) }),
|
|
167
|
-
/* @__PURE__ */ jsx(Text, { children: /* @__PURE__ */ jsx("p", { children: subtitle }) }),
|
|
168
|
-
showSwitch && /* @__PURE__ */ jsxs(ComponentWrapper, { noPaddingHorizontal: true, children: [
|
|
169
|
-
/* @__PURE__ */ jsx(
|
|
170
|
-
InfoIcon,
|
|
171
|
-
{
|
|
172
|
-
position: "top",
|
|
173
|
-
html: is2FAEnabled ? "Enabled" : "Disabled",
|
|
174
|
-
noIcon: true,
|
|
175
|
-
noMarginLeft: true,
|
|
176
|
-
disabled: isFlowopen.enable2fa || isFlowopen.disable2fa,
|
|
177
|
-
children: /* @__PURE__ */ jsx(
|
|
178
|
-
stdin_default$1,
|
|
179
|
-
{
|
|
180
|
-
dataCy: "2fa-settings-toggle",
|
|
181
|
-
value1: "disabled",
|
|
182
|
-
value2: "enabled",
|
|
183
|
-
value1Color: colors.orangishRed,
|
|
184
|
-
value2Color: colors.freshGreen,
|
|
185
|
-
value: is2FAEnabled ? "enabled" : "disabled",
|
|
186
|
-
revertToPrevious: true,
|
|
187
|
-
hideValues: true,
|
|
188
|
-
indicatorStyle: { margin: 0 },
|
|
189
|
-
handleChange: (value) => {
|
|
190
|
-
if (isLoginRequired && value === "enabled") {
|
|
191
|
-
setIsFlowOpen({
|
|
192
|
-
requiresRecentLogin: true,
|
|
193
|
-
enable2fa: false,
|
|
194
|
-
disable2fa: false
|
|
195
|
-
});
|
|
196
|
-
} else if (value === "enabled") {
|
|
197
|
-
switchOpenFlow("disable2fa", "enable2fa");
|
|
198
|
-
} else if (value === "disabled") {
|
|
199
|
-
if (!allowDisable2FA) {
|
|
200
|
-
void showDisable2faBlockedModal();
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
switchOpenFlow("enable2fa", "disable2fa");
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
)
|
|
208
|
-
}
|
|
209
|
-
),
|
|
210
|
-
successMessage && /* @__PURE__ */ jsx(Text, { small: true, success: true, style: { position: "absolute", bottom: 0, left: 0 }, children: /* @__PURE__ */ jsx("p", { children: successMessage }) })
|
|
211
|
-
] }),
|
|
212
|
-
customComponent && (typeof customComponent === "function" ? customComponent(flowActions) : React__default.isValidElement(customComponent) ? React__default.createElement(customComponent.type, {
|
|
213
|
-
...customComponent.props,
|
|
214
|
-
flowActions
|
|
215
|
-
}) : customComponent),
|
|
216
|
-
isFlowopen.enable2fa && /* @__PURE__ */ jsx(
|
|
217
|
-
stdin_default$2,
|
|
218
|
-
{
|
|
219
|
-
showFlow: isFlowopen.enable2fa,
|
|
220
|
-
setShowFlow: (value) => {
|
|
221
|
-
if (!value) {
|
|
222
|
-
handleFlowClose("enable2fa", enable2faCompletedRef.current);
|
|
223
|
-
} else {
|
|
224
|
-
setIsFlowOpen({ ...isFlowopen, enable2fa: value });
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
totpData,
|
|
228
|
-
onRequiresRecentLoginError: onRequiresRecentLoginErrorHandler,
|
|
229
|
-
onSuccess: onEnable2FASuccess
|
|
230
|
-
}
|
|
231
|
-
),
|
|
232
|
-
allowDisable2FA && isFlowopen.disable2fa && /* @__PURE__ */ jsx(
|
|
233
|
-
stdin_default$3,
|
|
234
|
-
{
|
|
235
|
-
showFlow: isFlowopen.disable2fa,
|
|
236
|
-
setShowFlow: (value) => {
|
|
237
|
-
if (!value) {
|
|
238
|
-
handleFlowClose("disable2fa", disable2faCompletedRef.current);
|
|
239
|
-
} else {
|
|
240
|
-
setIsFlowOpen({ ...isFlowopen, disable2fa: value });
|
|
241
|
-
}
|
|
242
|
-
},
|
|
243
|
-
onRequiresRecentLoginError: onRequiresRecentLoginErrorHandler,
|
|
244
|
-
onSuccess: onDisable2FASuccess
|
|
245
|
-
}
|
|
246
|
-
),
|
|
247
|
-
isFlowopen.requiresRecentLogin && /* @__PURE__ */ jsx(Modal, { isOpen: isFlowopen.requiresRecentLogin, onClose: () => handleFlowClose("requiresRecentLogin"), children: /* @__PURE__ */ jsx(ModalInner, { noPadding: true, children: /* @__PURE__ */ jsx(
|
|
248
|
-
stdin_default$4,
|
|
249
|
-
{
|
|
250
|
-
continueButtonId: "2fa-requires-recent-login-btn",
|
|
251
|
-
continueButtonDataCy: "2fa-requires-recent-login-submit",
|
|
252
|
-
onClick: () => {
|
|
253
|
-
void handleLoginAgain();
|
|
254
|
-
},
|
|
255
|
-
titleText: recentLoginTitle,
|
|
256
|
-
subTitleLeft: recentLoginSubtitle,
|
|
257
|
-
buttonText: recentLoginCTA
|
|
258
|
-
}
|
|
259
|
-
) }) }),
|
|
260
|
-
!showInlineLoginOnLogout ? null : !user && /* @__PURE__ */ jsx(stdin_default$5, {})
|
|
261
|
-
] });
|
|
262
|
-
};
|
|
263
|
-
Main2FAFlow.propTypes = {
|
|
264
|
-
onRequiresRecentLoginError: PropTypes.func,
|
|
265
|
-
allowDisable2FA: PropTypes.bool,
|
|
266
|
-
/** Called when any flow/modal is closed. Receives the flowId: 'enable2fa' | 'disable2fa' | 'requiresRecentLogin' */
|
|
267
|
-
onFlowClose: PropTypes.func
|
|
268
|
-
};
|
|
269
|
-
var stdin_default = Main2FAFlow;
|
|
270
|
-
export {
|
|
271
|
-
Main2FAFlow,
|
|
272
|
-
stdin_default as default
|
|
273
|
-
};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import "react";
|
|
4
|
-
import { Wrapper } from "../Grid/Grid.styles.js";
|
|
5
|
-
import { StyledFooter, FooterInner, PartnerWrap, Partner, PartnerLine, PartnerLineBreak, LogoWrap, PoweredWrap, Copyright } from "./Footer.styles.js";
|
|
6
|
-
import MangoPayLogo from "../../static/images/mangopay.svg.js";
|
|
7
|
-
const Footer = ({ color = "primary", hasSidebar = false, isSidebarExpanded }) => /* @__PURE__ */ jsx(StyledFooter, { color, isSidebarExpanded, hasSidebar, children: /* @__PURE__ */ jsx(Wrapper, { children: /* @__PURE__ */ jsxs(FooterInner, { hasSidebar, children: [
|
|
8
|
-
/* @__PURE__ */ jsx(PartnerWrap, { children: /* @__PURE__ */ jsxs(Partner, { children: [
|
|
9
|
-
/* @__PURE__ */ jsxs(PartnerLine, { children: [
|
|
10
|
-
"STOKR is a crypto asset service provider (",
|
|
11
|
-
/* @__PURE__ */ jsx(
|
|
12
|
-
"a",
|
|
13
|
-
{
|
|
14
|
-
href: "https://edesk.apps.cssf.lu/search-entities/entite/details/7079114?lng=en&q=&st=advanced&entType=CASP&entDate=2020-08-01",
|
|
15
|
-
title: "CASP",
|
|
16
|
-
target: "_blank",
|
|
17
|
-
rel: "noopener noreferrer",
|
|
18
|
-
style: { textDecoration: "underline", color: "white" },
|
|
19
|
-
children: "CASP"
|
|
20
|
-
}
|
|
21
|
-
),
|
|
22
|
-
") ",
|
|
23
|
-
/* @__PURE__ */ jsx(PartnerLineBreak, {}),
|
|
24
|
-
"and payment institution (",
|
|
25
|
-
/* @__PURE__ */ jsx(
|
|
26
|
-
"a",
|
|
27
|
-
{
|
|
28
|
-
href: "https://edesk.apps.cssf.lu/search-entities/entite/details/7079119?lng=en&q=&st=advanced&entType=PI&entDate=2020-08-01",
|
|
29
|
-
title: "PI",
|
|
30
|
-
target: "_blank",
|
|
31
|
-
rel: "noopener noreferrer",
|
|
32
|
-
style: { textDecoration: "underline", color: "white" },
|
|
33
|
-
children: "PI"
|
|
34
|
-
}
|
|
35
|
-
),
|
|
36
|
-
"),"
|
|
37
|
-
] }),
|
|
38
|
-
/* @__PURE__ */ jsx(PartnerLine, { children: "registered with the Luxembourg regulator CSSF." })
|
|
39
|
-
] }) }),
|
|
40
|
-
/* @__PURE__ */ jsx(LogoWrap, { children: /* @__PURE__ */ jsx(
|
|
41
|
-
"img",
|
|
42
|
-
{
|
|
43
|
-
style: {
|
|
44
|
-
verticalAlign: "middle",
|
|
45
|
-
minWidth: 44,
|
|
46
|
-
maxWidth: 120
|
|
47
|
-
},
|
|
48
|
-
loading: "lazy",
|
|
49
|
-
src: MangoPayLogo,
|
|
50
|
-
alt: "Mangopay logo"
|
|
51
|
-
}
|
|
52
|
-
) }),
|
|
53
|
-
/* @__PURE__ */ jsx(PoweredWrap, { children: /* @__PURE__ */ jsxs(Copyright, { children: [
|
|
54
|
-
"Copyright ",
|
|
55
|
-
(/* @__PURE__ */ new Date()).getFullYear(),
|
|
56
|
-
" STOKR. All rights reserved."
|
|
57
|
-
] }) })
|
|
58
|
-
] }) }) });
|
|
59
|
-
Footer.propTypes = {
|
|
60
|
-
color: PropTypes.oneOf(["primary", "red"]),
|
|
61
|
-
lemonwayLogo: PropTypes.string,
|
|
62
|
-
hasSidebar: PropTypes.bool,
|
|
63
|
-
isSidebarExpanded: PropTypes.bool
|
|
64
|
-
};
|
|
65
|
-
var stdin_default = Footer;
|
|
66
|
-
export {
|
|
67
|
-
Footer,
|
|
68
|
-
stdin_default as default
|
|
69
|
-
};
|