@stokr/components-library 3.0.38 → 3.0.40
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/2FA/login-with-otp-flow.js +2 -1
- package/dist/components/Layout/Layout.js +7 -3
- package/dist/components/StepsProgress/StepsProgress.js +3 -3
- package/dist/context/Auth.js +8 -4
- package/dist/runtime-config.js +5 -1
- package/dist/utils/get-cookie-domain.js +13 -2
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ import { getConfig, getPlatformURL } from "../../runtime-config.js";
|
|
|
13
13
|
import { navigateToHref } from "../../routing/navigate-app.js";
|
|
14
14
|
const LoginWithOTP = ({ withBackground, useRelativePathForMenu = false }) => {
|
|
15
15
|
const navigate = useNavigate();
|
|
16
|
-
const { loginUser, waitingFor2fa, firebaseError, loginUserWithTotp, reset2faFlow } = useContext(AuthContext);
|
|
16
|
+
const { loginUser, waitingFor2fa, firebaseError, loginUserWithTotp, reset2faFlow, logoutUser } = useContext(AuthContext);
|
|
17
17
|
const [isModalOpen, setIsModalOpen] = useState({
|
|
18
18
|
login: true,
|
|
19
19
|
enter2fa: false,
|
|
@@ -79,6 +79,7 @@ const LoginWithOTP = ({ withBackground, useRelativePathForMenu = false }) => {
|
|
|
79
79
|
clearPopupError();
|
|
80
80
|
setIsActionLoading(void 0);
|
|
81
81
|
},
|
|
82
|
+
logoutUser,
|
|
82
83
|
onFormSend: async ({ email, password }) => {
|
|
83
84
|
clearPopupError();
|
|
84
85
|
setIsActionLoading("login");
|
|
@@ -27,7 +27,9 @@ class Layout extends React__default.PureComponent {
|
|
|
27
27
|
noFooter,
|
|
28
28
|
noHeader,
|
|
29
29
|
noLogout,
|
|
30
|
-
useRelativePathForMenu = false
|
|
30
|
+
useRelativePathForMenu = false,
|
|
31
|
+
logoutUser = () => {
|
|
32
|
+
}
|
|
31
33
|
} = this.props;
|
|
32
34
|
return /* @__PURE__ */ jsx(ThemeProvider, { theme: { ...theme }, children: /* @__PURE__ */ jsxs(PageWrapper, { children: [
|
|
33
35
|
/* @__PURE__ */ jsx(GlobalStyle, {}),
|
|
@@ -40,7 +42,8 @@ class Layout extends React__default.PureComponent {
|
|
|
40
42
|
signupHandler,
|
|
41
43
|
siteTitle: title,
|
|
42
44
|
noLogout,
|
|
43
|
-
useRelativePathForMenu
|
|
45
|
+
useRelativePathForMenu,
|
|
46
|
+
logoutUser
|
|
44
47
|
}
|
|
45
48
|
),
|
|
46
49
|
/* @__PURE__ */ jsx(
|
|
@@ -64,7 +67,8 @@ Layout.propTypes = {
|
|
|
64
67
|
progress: PropTypes.bool,
|
|
65
68
|
footerColor: PropTypes.string,
|
|
66
69
|
children: PropTypes.node.isRequired,
|
|
67
|
-
useRelativePathForMenu: PropTypes.bool
|
|
70
|
+
useRelativePathForMenu: PropTypes.bool,
|
|
71
|
+
logoutUser: PropTypes.func
|
|
68
72
|
};
|
|
69
73
|
ProgressStatusContext.Consumer;
|
|
70
74
|
export {
|
|
@@ -24,10 +24,10 @@ const StepsProgressSignup = (props) => {
|
|
|
24
24
|
isActive: isActiveStep("/verify-identity")
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
|
-
id: "
|
|
28
|
-
handleClick: () => navigate("/
|
|
27
|
+
id: "self-certification",
|
|
28
|
+
handleClick: () => navigate("/self-certification"),
|
|
29
29
|
isDone: !!taxId,
|
|
30
|
-
isActive: isActiveStep("/
|
|
30
|
+
isActive: isActiveStep("/self-certification")
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
id: "ampID",
|
package/dist/context/Auth.js
CHANGED
|
@@ -35,14 +35,14 @@ class Auth {
|
|
|
35
35
|
*/
|
|
36
36
|
static setAccessToken(token, options = {}) {
|
|
37
37
|
this.logout();
|
|
38
|
-
const
|
|
38
|
+
const cookieOptions = getCookieDomain();
|
|
39
39
|
const raw = options?.expiresInMs;
|
|
40
40
|
const expiresInMs = typeof raw === "number" && Number.isFinite(raw) && raw > 0 ? raw : Number(DEFAULT_TOKEN_EXPIRY_MS) || 60 * 60 * 1e3;
|
|
41
41
|
const expiresAtMs = Date.now() + expiresInMs;
|
|
42
42
|
const expiresInDays = expiresInMs / (24 * 60 * 60 * 1e3);
|
|
43
|
-
|
|
44
|
-
Cookies.set("STOKR_ACCESS_TOKEN", token,
|
|
45
|
-
Cookies.set("STOKR_ACCESS_TOKEN_EXPIRES", String(expiresAtMs),
|
|
43
|
+
const finalOptions = { ...cookieOptions, expires: expiresInDays };
|
|
44
|
+
Cookies.set("STOKR_ACCESS_TOKEN", token, finalOptions);
|
|
45
|
+
Cookies.set("STOKR_ACCESS_TOKEN_EXPIRES", String(expiresAtMs), finalOptions);
|
|
46
46
|
}
|
|
47
47
|
static getAccessToken() {
|
|
48
48
|
return Cookies.get("STOKR_ACCESS_TOKEN");
|
|
@@ -58,6 +58,10 @@ class Auth {
|
|
|
58
58
|
const cookieDomain = getCookieDomain();
|
|
59
59
|
Cookies.remove("STOKR_ACCESS_TOKEN", cookieDomain);
|
|
60
60
|
Cookies.remove("STOKR_ACCESS_TOKEN_EXPIRES", cookieDomain);
|
|
61
|
+
if (cookieDomain.domain) {
|
|
62
|
+
Cookies.remove("STOKR_ACCESS_TOKEN");
|
|
63
|
+
Cookies.remove("STOKR_ACCESS_TOKEN_EXPIRES");
|
|
64
|
+
}
|
|
61
65
|
}
|
|
62
66
|
static async login(email, password) {
|
|
63
67
|
const auth = getFirebaseAuth();
|
package/dist/runtime-config.js
CHANGED
|
@@ -55,7 +55,11 @@ function warnMissingRuntimeEnvOnce() {
|
|
|
55
55
|
);
|
|
56
56
|
}
|
|
57
57
|
function assignRuntimeConfig(config = {}) {
|
|
58
|
-
Object.
|
|
58
|
+
for (const [key, value] of Object.entries(config)) {
|
|
59
|
+
if (value !== void 0) {
|
|
60
|
+
_overrides[key] = value;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
59
63
|
warnMissingRuntimeEnvOnce();
|
|
60
64
|
}
|
|
61
65
|
function resetRuntimeConfig() {
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import { getConfig } from "../runtime-config.js";
|
|
2
2
|
const getCookieDomain = () => {
|
|
3
3
|
const domain = getConfig("cookieDomain");
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
if (domain && domain !== "localhost") {
|
|
5
|
+
return { domain };
|
|
6
|
+
}
|
|
7
|
+
if (typeof window !== "undefined") {
|
|
8
|
+
const hostname = window.location.hostname;
|
|
9
|
+
if (hostname && hostname !== "localhost" && hostname !== "127.0.0.1" && !/^\d+\.\d+\.\d+\.\d+$/.test(hostname)) {
|
|
10
|
+
const parts = hostname.split(".");
|
|
11
|
+
if (parts.length >= 2) {
|
|
12
|
+
return { domain: "." + parts.slice(-2).join(".") };
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return {};
|
|
6
17
|
};
|
|
7
18
|
export {
|
|
8
19
|
getCookieDomain as default,
|