@stack-spot/auth-react 2.7.1 → 2.8.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/CHANGELOG.md +14 -0
- package/out/index.d.ts +26 -25
- package/out/index.js +164 -94
- package/out/index.js.map +1 -1
- package/out/index.mjs +165 -95
- package/out/index.mjs.map +1 -1
- package/package.json +1 -1
- package/rollup.config.mjs +1 -1
- package/src/Authenticated.tsx +2 -1
- package/src/IDPLogin.tsx +79 -0
- package/src/Login.tsx +48 -140
- package/src/SSOLogin.tsx +50 -0
- package/src/dictionary.ts +40 -0
- package/src/hooks.ts +8 -3
- package/src/index.ts +0 -1
- package/src/last-login-type.ts +20 -0
- package/src/types.ts +28 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.8.1](https://github.com/stack-spot/portal-auth-js/compare/auth-react@v2.8.0...auth-react@v2.8.1) (2025-04-28)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* some fixes to the previous two-step login PR ([#102](https://github.com/stack-spot/portal-auth-js/issues/102)) ([31db00b](https://github.com/stack-spot/portal-auth-js/commit/31db00b9f4f7592cca6005f7f0957477f1ec0318))
|
|
9
|
+
|
|
10
|
+
## [2.8.0](https://github.com/stack-spot/portal-auth-js/compare/auth-react@v2.7.1...auth-react@v2.8.0) (2025-04-28)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* two step login idp sso ([#98](https://github.com/stack-spot/portal-auth-js/issues/98)) ([1c6bd24](https://github.com/stack-spot/portal-auth-js/commit/1c6bd2429fd17bf869f834b8d813a1b5c4f332a2))
|
|
16
|
+
|
|
3
17
|
## [2.7.1](https://github.com/stack-spot/portal-auth-js/compare/auth-react@v2.7.0...auth-react@v2.7.1) (2025-04-25)
|
|
4
18
|
|
|
5
19
|
|
package/out/index.d.ts
CHANGED
|
@@ -1,31 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { Session, ThirdPartyLoginParams, AuthConfig, ThirdPartyAuthType } from '@stack-spot/auth';
|
|
3
3
|
|
|
4
|
-
type LoginType = 'sso' | 'idp';
|
|
5
|
-
interface BaseData {
|
|
6
|
-
type: LoginType;
|
|
7
|
-
}
|
|
8
|
-
interface SSOData extends BaseData {
|
|
9
|
-
type: 'sso';
|
|
10
|
-
email: string;
|
|
11
|
-
}
|
|
12
|
-
interface IDPData extends BaseData {
|
|
13
|
-
type: 'idp';
|
|
14
|
-
provider: 'external-idp:github' | 'external-idp:google' | 'external-idp:microsoft';
|
|
15
|
-
}
|
|
16
|
-
type LoginData = SSOData | IDPData;
|
|
17
|
-
type LoginProps = {
|
|
18
|
-
initialValue?: string;
|
|
19
|
-
onSubmit: (data: LoginData) => Promise<void>;
|
|
20
|
-
welcomeText?: string;
|
|
21
|
-
removeLoadingOnSuccess?: boolean;
|
|
22
|
-
className?: string;
|
|
23
|
-
style?: React.CSSProperties;
|
|
24
|
-
banner?: React.ReactNode;
|
|
25
|
-
loginTypes?: LoginType[];
|
|
26
|
-
};
|
|
27
|
-
declare const Login: ({ onSubmit, initialValue, welcomeText, removeLoadingOnSuccess, className, style, banner, loginTypes }: LoginProps) => react_jsx_runtime.JSX.Element;
|
|
28
|
-
|
|
29
4
|
interface SessionManagerConfig extends Pick<AuthConfig, 'accountUrl' | 'authUrl' | 'clientId' | 'defaultTenant' | 'retry' | 'retryDelay'> {
|
|
30
5
|
/**
|
|
31
6
|
* The URL to redirect to when the user logs out.
|
|
@@ -84,6 +59,30 @@ declare class SessionManager {
|
|
|
84
59
|
getTrialEnabledProviders(): Promise<string[]>;
|
|
85
60
|
}
|
|
86
61
|
|
|
62
|
+
type LoginType = 'sso' | 'idp';
|
|
63
|
+
interface BaseData {
|
|
64
|
+
type: LoginType;
|
|
65
|
+
}
|
|
66
|
+
interface SSOData extends BaseData {
|
|
67
|
+
type: 'sso';
|
|
68
|
+
email: string;
|
|
69
|
+
}
|
|
70
|
+
interface IDPData extends BaseData {
|
|
71
|
+
type: 'idp';
|
|
72
|
+
provider: 'external-idp:github' | 'external-idp:google' | 'external-idp:microsoft';
|
|
73
|
+
}
|
|
74
|
+
type LoginData = SSOData | IDPData;
|
|
75
|
+
type LoginProps = {
|
|
76
|
+
initialValue?: string;
|
|
77
|
+
onSubmit: (data: LoginData) => Promise<void>;
|
|
78
|
+
welcomeText?: string;
|
|
79
|
+
removeLoadingOnSuccess?: boolean;
|
|
80
|
+
className?: string;
|
|
81
|
+
style?: React.CSSProperties;
|
|
82
|
+
banner?: React.ReactNode;
|
|
83
|
+
loginTypes?: LoginType[];
|
|
84
|
+
};
|
|
85
|
+
|
|
87
86
|
type AuthStatus = 'unknown' | 'authenticated' | 'unauthenticated';
|
|
88
87
|
interface Props {
|
|
89
88
|
children: React.ReactElement;
|
|
@@ -97,4 +96,6 @@ declare const Authenticated: ({ children, onLogin, onSession, customLoginProps,
|
|
|
97
96
|
|
|
98
97
|
declare function useSession(): Session | undefined;
|
|
99
98
|
|
|
99
|
+
declare const Login: ({ onSubmit, initialValue, welcomeText, removeLoadingOnSuccess, className, style, banner, loginTypes }: LoginProps) => react_jsx_runtime.JSX.Element;
|
|
100
|
+
|
|
100
101
|
export { Authenticated, Login, SessionManager, useSession };
|
package/out/index.js
CHANGED
|
@@ -8,9 +8,49 @@ require('@stack-spot/portal-theme/dist/theme.css');
|
|
|
8
8
|
var portalTranslate = require('@stack-spot/portal-translate');
|
|
9
9
|
var react = require('react');
|
|
10
10
|
var ui = require('@citric/ui');
|
|
11
|
+
var auth = require('@stack-spot/auth');
|
|
11
12
|
var svg = require('@stack-spot/portal-components/svg');
|
|
12
13
|
var styledComponents = require('styled-components');
|
|
13
|
-
var
|
|
14
|
+
var lodash = require('lodash');
|
|
15
|
+
require('@citric/icons');
|
|
16
|
+
|
|
17
|
+
const dictionary = {
|
|
18
|
+
en: {
|
|
19
|
+
welcome: "Welcome to StackSpot AI",
|
|
20
|
+
loginWithEmail: "Log in with your email.",
|
|
21
|
+
loginWithSocialAccount: "Sign up or access your free trial with a social account",
|
|
22
|
+
label: "Corporate email",
|
|
23
|
+
placeholder: "email@company.com",
|
|
24
|
+
continue: "Continue",
|
|
25
|
+
or: "Or",
|
|
26
|
+
loginWith: "Sign in with $0",
|
|
27
|
+
emailNotAllowedTitle: "Your email is linked to an Enterprise account.",
|
|
28
|
+
emailNotAllowedSubtitle: "Please log in with your corporate email.",
|
|
29
|
+
socialLogin: "Login or register with a social account",
|
|
30
|
+
corporateLoginTitle: "Already have a StackSpot enterprise account?",
|
|
31
|
+
corporateLoginButton: "Login with enterprise account",
|
|
32
|
+
socialLoginTitle: "Do you want to access another way?",
|
|
33
|
+
emailNotFoundError: "We couldn't find an account for this email"
|
|
34
|
+
},
|
|
35
|
+
pt: {
|
|
36
|
+
welcome: "Boas vindas \xE0 StackSpot AI",
|
|
37
|
+
loginWithEmail: "Fa\xE7a login com seu e-mail.",
|
|
38
|
+
loginWithSocialAccount: "Cadastre-se ou acesse seu teste gratuito com uma conta social",
|
|
39
|
+
label: "Email corporativo",
|
|
40
|
+
placeholder: "email@empresa.com",
|
|
41
|
+
continue: "Continuar",
|
|
42
|
+
or: "Ou",
|
|
43
|
+
loginWith: "Entrar com $0",
|
|
44
|
+
emailNotAllowedTitle: '"Este e-mail est\xE1 vinculado a uma conta Enterprise.',
|
|
45
|
+
emailNotAllowedSubtitle: "Fa\xE7a login com seu email corporativo.",
|
|
46
|
+
socialLogin: "Entre ou cadastre-se com uma conta social",
|
|
47
|
+
corporateLoginTitle: "J\xE1 possui uma conta StackSpot Enterprise?",
|
|
48
|
+
corporateLoginButton: "Entrar na conta Enterprise",
|
|
49
|
+
socialLoginTitle: "Voc\xEA quer entrar de outro jeito?",
|
|
50
|
+
emailNotFoundError: "N\xE3o encontramos uma conta para este e-mail."
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const useTranslation = () => portalTranslate.useTranslate(dictionary);
|
|
14
54
|
|
|
15
55
|
const sessionKey$1 = `stk-session${portalComponents.getCookieDomain()}`;
|
|
16
56
|
const sessionCookie = Object.freeze({
|
|
@@ -291,9 +331,14 @@ const useTrialProviders = ({ enabled = true }) => {
|
|
|
291
331
|
(async () => {
|
|
292
332
|
if (!SessionManager.instance || !enabled)
|
|
293
333
|
return;
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
334
|
+
try {
|
|
335
|
+
const providers = await SessionManager.instance.getTrialEnabledProviders();
|
|
336
|
+
setTrialProviders(providers);
|
|
337
|
+
setIsLoadingTrialProviders(false);
|
|
338
|
+
} catch (error) {
|
|
339
|
+
console.error(error);
|
|
340
|
+
setIsLoadingTrialProviders(false);
|
|
341
|
+
}
|
|
297
342
|
})();
|
|
298
343
|
}, [SessionManager.instance]);
|
|
299
344
|
return [trialProviders, isLoadingTrialProviders];
|
|
@@ -387,6 +432,80 @@ const Microsoft = react.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.js
|
|
|
387
432
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12.8477 12.3994H19.8042V19.3559H12.8477V12.3994Z", fill: "#FFBA08" })
|
|
388
433
|
] })));
|
|
389
434
|
|
|
435
|
+
const providerIcons = {
|
|
436
|
+
github: /* @__PURE__ */ jsxRuntime.jsx(Github, {}),
|
|
437
|
+
google: /* @__PURE__ */ jsxRuntime.jsx(Google, {}),
|
|
438
|
+
microsoft: /* @__PURE__ */ jsxRuntime.jsx(Microsoft, {})
|
|
439
|
+
};
|
|
440
|
+
const ButtonProvider = ({ provider, login, loading, disabled }) => {
|
|
441
|
+
const t = useTranslation();
|
|
442
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
443
|
+
core.Button,
|
|
444
|
+
{
|
|
445
|
+
colorScheme: "light",
|
|
446
|
+
type: "button",
|
|
447
|
+
size: "md",
|
|
448
|
+
sx: { width: "100%" },
|
|
449
|
+
onClick: () => login("idp", provider),
|
|
450
|
+
disabled: loading || disabled,
|
|
451
|
+
children: loading ? /* @__PURE__ */ jsxRuntime.jsx(ui.LoadingCircular, {}) : /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { alignItems: "center", style: { gap: "4px" }, children: [
|
|
452
|
+
providerIcons[provider],
|
|
453
|
+
portalTranslate.interpolate(t.loginWith, lodash.capitalize(provider))
|
|
454
|
+
] })
|
|
455
|
+
}
|
|
456
|
+
) });
|
|
457
|
+
};
|
|
458
|
+
const IDPLogin = ({ trialProviders, loading, loginProvider, onSubmit, onChangeMode }) => {
|
|
459
|
+
const t = useTranslation();
|
|
460
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
461
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Flex, { flexDirection: "column", gap: true, children: trialProviders == null ? void 0 : trialProviders.map((provider) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
462
|
+
ButtonProvider,
|
|
463
|
+
{
|
|
464
|
+
provider,
|
|
465
|
+
login: onSubmit,
|
|
466
|
+
loading: loading && loginProvider === provider,
|
|
467
|
+
disabled: loading
|
|
468
|
+
},
|
|
469
|
+
provider
|
|
470
|
+
)) }),
|
|
471
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "separator", children: /* @__PURE__ */ jsxRuntime.jsx(core.Text, { appearance: "microtext1", colorScheme: "light.700", children: t.or }) }),
|
|
472
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { colorScheme: "light.700", align: "center", children: t.corporateLoginTitle }),
|
|
473
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Button, { size: "md", disabled: loading, colorScheme: "light", onClick: () => onChangeMode("sso"), children: t.corporateLoginButton })
|
|
474
|
+
] });
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
const lastLoginTypeKey = "lastLoginType";
|
|
478
|
+
const fallbackKeys = ["guided-tour", "@stack-spot/opa:user", "CHAT_AGENTS", "RATED_US_IN"];
|
|
479
|
+
function getLastLoginType() {
|
|
480
|
+
const type = localStorage.getItem(lastLoginTypeKey);
|
|
481
|
+
if (type === "idp" || type === "sso")
|
|
482
|
+
return type;
|
|
483
|
+
if (portalComponents.getCookie("stk-session.stackspot.com"))
|
|
484
|
+
return "sso";
|
|
485
|
+
for (const key of fallbackKeys) {
|
|
486
|
+
if (localStorage.getItem(key))
|
|
487
|
+
return "sso";
|
|
488
|
+
}
|
|
489
|
+
return "idp";
|
|
490
|
+
}
|
|
491
|
+
function setLastLoginType(type) {
|
|
492
|
+
localStorage.setItem(lastLoginTypeKey, type);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
const SSOLogin = ({ value, onChange, loading, disabled, hasProvider, onChangeMode }) => {
|
|
496
|
+
const t = useTranslation();
|
|
497
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
498
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { flexDirection: "column", style: { gap: "4px", marginTop: "4px" }, children: [
|
|
499
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Label, { htmlFor: "email", children: t.label }),
|
|
500
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Input, { id: "email", type: "email", name: "email", value, onChange: (e) => onChange(e.target.value), placeholder: t.placeholder }),
|
|
501
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Button, { colorScheme: "primary", size: "md", style: { marginTop: "12px" }, disabled: disabled || loading, children: loading && !hasProvider ? /* @__PURE__ */ jsxRuntime.jsx(ui.LoadingCircular, {}) : /* @__PURE__ */ jsxRuntime.jsx(core.Text, { children: t.continue }) })
|
|
502
|
+
] }),
|
|
503
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "separator", children: /* @__PURE__ */ jsxRuntime.jsx(core.Text, { appearance: "microtext1", colorScheme: "light.700", children: t.or }) }),
|
|
504
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { colorScheme: "light.700", align: "center", children: t.socialLoginTitle }),
|
|
505
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Button, { size: "md", disabled: loading, colorScheme: "light", onClick: () => onChangeMode("idp"), children: t.socialLogin })
|
|
506
|
+
] });
|
|
507
|
+
};
|
|
508
|
+
|
|
390
509
|
const LoginBox = styledComponents.styled.form`
|
|
391
510
|
display: flex;
|
|
392
511
|
flex-direction: column;
|
|
@@ -422,39 +541,15 @@ const LoginBox = styledComponents.styled.form`
|
|
|
422
541
|
line-height: 1.5rem;
|
|
423
542
|
}
|
|
424
543
|
`;
|
|
425
|
-
const providerIcons = {
|
|
426
|
-
github: /* @__PURE__ */ jsxRuntime.jsx(Github, {}),
|
|
427
|
-
google: /* @__PURE__ */ jsxRuntime.jsx(Google, {}),
|
|
428
|
-
microsoft: /* @__PURE__ */ jsxRuntime.jsx(Microsoft, {})
|
|
429
|
-
};
|
|
430
|
-
function capitalize(str) {
|
|
431
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
432
|
-
}
|
|
433
|
-
const ButtonProvider = ({ provider, login, loading }) => {
|
|
434
|
-
const t = portalTranslate.useTranslate(dictionary);
|
|
435
|
-
return /* @__PURE__ */ jsxRuntime.jsx(core.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(core.Button, { colorScheme: "light", type: "button", size: "md", sx: { width: "100%" }, onClick: () => login("idp", provider), disabled: loading, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(ui.LoadingCircular, {}) : /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { alignItems: "center", style: { gap: "4px" }, children: [
|
|
436
|
-
providerIcons[provider],
|
|
437
|
-
portalTranslate.interpolate(t.loginWith, capitalize(provider))
|
|
438
|
-
] }) }) });
|
|
439
|
-
};
|
|
440
544
|
const EmailNotAllowed = () => {
|
|
441
|
-
const t =
|
|
545
|
+
const t = useTranslation();
|
|
442
546
|
return /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { justifyContent: "center", children: [
|
|
443
547
|
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { appearance: "body2", children: t.emailNotAllowedTitle }),
|
|
444
548
|
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { appearance: "body2", colorScheme: "light.700", children: t.emailNotAllowedSubtitle })
|
|
445
549
|
] }) });
|
|
446
550
|
};
|
|
447
|
-
const Login = ({
|
|
448
|
-
|
|
449
|
-
initialValue = "",
|
|
450
|
-
welcomeText,
|
|
451
|
-
removeLoadingOnSuccess,
|
|
452
|
-
className,
|
|
453
|
-
style,
|
|
454
|
-
banner,
|
|
455
|
-
loginTypes = ["idp", "sso"]
|
|
456
|
-
}) => {
|
|
457
|
-
const t = portalTranslate.useTranslate(dictionary);
|
|
551
|
+
const Login = ({ onSubmit, initialValue = "", welcomeText, removeLoadingOnSuccess, className, style, banner, loginTypes = ["idp", "sso"] }) => {
|
|
552
|
+
const t = useTranslation();
|
|
458
553
|
const [trialProviders, isLoadingTrialProviders] = useTrialProviders({ enabled: loginTypes.includes("idp") });
|
|
459
554
|
const searchParams = new URLSearchParams(location.search);
|
|
460
555
|
const [error, setError] = react.useState(searchParams.get("error_description") || searchParams.get("error") || "");
|
|
@@ -465,7 +560,10 @@ const Login = ({
|
|
|
465
560
|
const [email, setEmail] = react.useState(initialValue || searchParams.get("email") || "");
|
|
466
561
|
const disabled = !email.match(/\w+@\w+/);
|
|
467
562
|
const idpLoginEnabled = loginTypes.includes("idp") && !!(trialProviders == null ? void 0 : trialProviders.length);
|
|
468
|
-
const
|
|
563
|
+
const [mode, setMode] = react.useState();
|
|
564
|
+
react.useEffect(() => {
|
|
565
|
+
setMode(idpLoginEnabled ? getLastLoginType() : "sso");
|
|
566
|
+
}, [idpLoginEnabled]);
|
|
469
567
|
react.useEffect(() => {
|
|
470
568
|
if (!providerQueryParam)
|
|
471
569
|
return;
|
|
@@ -480,13 +578,18 @@ const Login = ({
|
|
|
480
578
|
provider !== loginProvider && setLoginProvider(provider);
|
|
481
579
|
try {
|
|
482
580
|
const data = type === "idp" && !!provider ? { type: "idp", provider: `external-idp:${provider}` } : { type: "sso", email };
|
|
581
|
+
setLastLoginType(data.type);
|
|
483
582
|
await onSubmit(data);
|
|
484
583
|
if (removeLoadingOnSuccess)
|
|
485
584
|
setLoading(false);
|
|
486
585
|
} catch (error2) {
|
|
487
586
|
setLoading(false);
|
|
488
587
|
setLoginProvider(void 0);
|
|
489
|
-
|
|
588
|
+
if (error2 instanceof auth.AuthMethodUnavailable) {
|
|
589
|
+
setError(t.emailNotFoundError);
|
|
590
|
+
} else {
|
|
591
|
+
setError(error2.message || error2.toString());
|
|
592
|
+
}
|
|
490
593
|
}
|
|
491
594
|
}
|
|
492
595
|
function submitForm(e) {
|
|
@@ -495,80 +598,47 @@ const Login = ({
|
|
|
495
598
|
return;
|
|
496
599
|
login("sso");
|
|
497
600
|
}
|
|
601
|
+
if (isLoadingTrialProviders || !mode) {
|
|
602
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { alignContent: "center", justifyContent: "center", my: 5, children: [
|
|
603
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.LoadingCircular, {}),
|
|
604
|
+
" "
|
|
605
|
+
] });
|
|
606
|
+
}
|
|
498
607
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
499
608
|
/* @__PURE__ */ jsxRuntime.jsxs(LoginBox, { onSubmit: submitForm, className, style, children: [
|
|
500
609
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { children: [
|
|
501
610
|
/* @__PURE__ */ jsxRuntime.jsx(svg.MiniLogo, {}),
|
|
502
611
|
/* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { flexDirection: "column", alignItems: "center", children: [
|
|
503
612
|
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { appearance: "body1", weight: "medium", children: welcomeText || t.welcome }),
|
|
504
|
-
/* @__PURE__ */ jsxRuntime.
|
|
505
|
-
" ",
|
|
506
|
-
t.loginWithEmail
|
|
507
|
-
] })
|
|
613
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { appearance: "body2", colorScheme: "light.700", children: mode === "idp" ? t.loginWithSocialAccount : t.loginWithEmail })
|
|
508
614
|
] })
|
|
509
615
|
] }),
|
|
510
616
|
errorCode && errorCode === "EMAIL_IS_NOT_ALLOWED" && /* @__PURE__ */ jsxRuntime.jsx(EmailNotAllowed, {}),
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
))
|
|
533
|
-
] })
|
|
534
|
-
] }),
|
|
535
|
-
error && /* @__PURE__ */ jsxRuntime.jsxs(core.Text, { className: "error", children: [
|
|
536
|
-
t.error,
|
|
537
|
-
": ",
|
|
538
|
-
error
|
|
539
|
-
] })
|
|
617
|
+
mode === "sso" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
618
|
+
SSOLogin,
|
|
619
|
+
{
|
|
620
|
+
disabled,
|
|
621
|
+
loading,
|
|
622
|
+
hasProvider: !loginProvider,
|
|
623
|
+
value: email,
|
|
624
|
+
onChange: setEmail,
|
|
625
|
+
onChangeMode: setMode
|
|
626
|
+
}
|
|
627
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
628
|
+
IDPLogin,
|
|
629
|
+
{
|
|
630
|
+
loading,
|
|
631
|
+
loginProvider,
|
|
632
|
+
onSubmit: login,
|
|
633
|
+
trialProviders,
|
|
634
|
+
onChangeMode: setMode
|
|
635
|
+
}
|
|
636
|
+
),
|
|
637
|
+
error && /* @__PURE__ */ jsxRuntime.jsx(core.Text, { className: "error", align: "center", children: error })
|
|
540
638
|
] }),
|
|
541
639
|
banner ? /* @__PURE__ */ jsxRuntime.jsx(portalComponents.BannerWarning, { children: banner }) : null
|
|
542
640
|
] });
|
|
543
641
|
};
|
|
544
|
-
const dictionary = {
|
|
545
|
-
en: {
|
|
546
|
-
welcome: "Welcome to StackSpot",
|
|
547
|
-
loginWithEmail: "Log in with your email.",
|
|
548
|
-
label: "Corporate email",
|
|
549
|
-
placeholder: "email@company.com",
|
|
550
|
-
continue: "Continue",
|
|
551
|
-
or: "Or",
|
|
552
|
-
loginWith: "Sign in with $0",
|
|
553
|
-
error: "Error while attempting to login",
|
|
554
|
-
emailNotAllowedTitle: "Your email is linked to an Enterprise account.",
|
|
555
|
-
emailNotAllowedSubtitle: "Please log in with your corporate email.",
|
|
556
|
-
trial: "Access your trial account"
|
|
557
|
-
},
|
|
558
|
-
pt: {
|
|
559
|
-
welcome: "Bem vindo \xE0 StackSpot",
|
|
560
|
-
loginWithEmail: "Fa\xE7a login com seu e-mail.",
|
|
561
|
-
label: "Email corporativo",
|
|
562
|
-
placeholder: "email@empresa.com",
|
|
563
|
-
continue: "Continuar",
|
|
564
|
-
or: "Ou",
|
|
565
|
-
loginWith: "Entrar com $0",
|
|
566
|
-
error: "Erro ao fazer login",
|
|
567
|
-
emailNotAllowedTitle: '"Este e-mail est\xE1 vinculado a uma conta Enterprise.',
|
|
568
|
-
emailNotAllowedSubtitle: "Fa\xE7a login com seu email corporativo.",
|
|
569
|
-
trial: "Acesse sua conta de teste"
|
|
570
|
-
}
|
|
571
|
-
};
|
|
572
642
|
|
|
573
643
|
var __defProp = Object.defineProperty;
|
|
574
644
|
var __defProps = Object.defineProperties;
|