@asgardeo/react 0.1.1 → 0.2.0
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/cjs/index.js +68 -21
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/SignIn/fragments/IdentifierFirst.d.ts +35 -0
- package/dist/cjs/types/models/auth-context.d.ts +3 -1
- package/dist/cjs/types/models/use-authentication.d.ts +2 -1
- package/dist/esm/index.js +68 -21
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/SignIn/fragments/IdentifierFirst.d.ts +35 -0
- package/dist/esm/types/models/auth-context.d.ts +3 -1
- package/dist/esm/types/models/use-authentication.d.ts +2 -1
- package/dist/index.d.ts +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { ReactElement } from 'react';
|
|
19
|
+
import BasicAuthProps from '../../../models/basic-auth-props';
|
|
20
|
+
import './basic-auth.scss';
|
|
21
|
+
/**
|
|
22
|
+
* This component renders the IdentifierFirst authentication form.
|
|
23
|
+
*
|
|
24
|
+
* @param {IdentifierFirstProps} props - Props injected to the IdentifierFirst authentication component.
|
|
25
|
+
* @param {BrandingProps} props.brandingProps - Branding props.
|
|
26
|
+
* @param {Function} props.handleAuthenticate - Callback to handle authentication.
|
|
27
|
+
* @param {Authenticator} props.authenticator - Authenticator.
|
|
28
|
+
* @param {AlertType} props.alert - Alert type.
|
|
29
|
+
* @param {ReactElement[]} props.renderLoginOptions - Login options.
|
|
30
|
+
* @param {boolean} props.showSelfSignUp - Show self sign up.
|
|
31
|
+
*
|
|
32
|
+
* @return {ReactElement}
|
|
33
|
+
*/
|
|
34
|
+
declare const IdentifierFirst: ({ handleAuthenticate, authenticator, alert, brandingProps, showSelfSignUp, renderLoginOptions, }: BasicAuthProps) => ReactElement;
|
|
35
|
+
export default IdentifierFirst;
|
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
/// <reference types="react" />
|
|
19
|
-
import { UIAuthConfig, MeAPIResponse } from '@asgardeo/js';
|
|
19
|
+
import { UIAuthConfig, MeAPIResponse, AuthApiResponse } from '@asgardeo/js';
|
|
20
20
|
interface AuthContext {
|
|
21
21
|
accessToken: string;
|
|
22
|
+
authResponse: AuthApiResponse;
|
|
22
23
|
config: UIAuthConfig;
|
|
23
24
|
isAuthLoading: boolean;
|
|
24
25
|
isAuthenticated: boolean | undefined;
|
|
@@ -26,6 +27,7 @@ interface AuthContext {
|
|
|
26
27
|
isGlobalLoading: boolean;
|
|
27
28
|
isTextLoading: boolean;
|
|
28
29
|
onSignOutRef: React.MutableRefObject<Function>;
|
|
30
|
+
setAuthResponse: (response: AuthApiResponse) => void;
|
|
29
31
|
setAuthentication: () => void;
|
|
30
32
|
setIsAuthLoading: (value: boolean) => void;
|
|
31
33
|
setIsBrandingLoading: (value: boolean) => void;
|
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { MeAPIResponse } from '@asgardeo/js';
|
|
18
|
+
import { AuthApiResponse, MeAPIResponse } from '@asgardeo/js';
|
|
19
19
|
interface UseAuthentication {
|
|
20
20
|
accessToken: string;
|
|
21
|
+
authResponse: AuthApiResponse;
|
|
21
22
|
isAuthenticated: Promise<boolean> | boolean;
|
|
22
23
|
signOut: () => void;
|
|
23
24
|
user: MeAPIResponse;
|
package/dist/esm/index.js
CHANGED
|
@@ -40380,7 +40380,7 @@ const BrandingPreferenceContext = createContext(undefined);
|
|
|
40380
40380
|
*/
|
|
40381
40381
|
const useAuthentication = () => {
|
|
40382
40382
|
const contextValue = useContext(AsgardeoContext);
|
|
40383
|
-
const { user, isAuthenticated, accessToken } = contextValue;
|
|
40383
|
+
const { user, isAuthenticated, accessToken, authResponse } = contextValue;
|
|
40384
40384
|
const signOut$1 = () => {
|
|
40385
40385
|
signOut().then(() => {
|
|
40386
40386
|
sessionStorage.clear();
|
|
@@ -40389,7 +40389,13 @@ const useAuthentication = () => {
|
|
|
40389
40389
|
}
|
|
40390
40390
|
});
|
|
40391
40391
|
};
|
|
40392
|
-
return {
|
|
40392
|
+
return {
|
|
40393
|
+
accessToken,
|
|
40394
|
+
authResponse,
|
|
40395
|
+
isAuthenticated,
|
|
40396
|
+
signOut: signOut$1,
|
|
40397
|
+
user,
|
|
40398
|
+
};
|
|
40393
40399
|
};
|
|
40394
40400
|
|
|
40395
40401
|
/**
|
|
@@ -44268,6 +44274,39 @@ class SPACryptoUtils {
|
|
|
44268
44274
|
var css$1 = "/**\n * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n.Box-asgardeoSignIn {\n min-width: 350px;\n min-height: 75vh;\n}\n.Box-asgardeoSignIn .email-otp-resend-button {\n margin-top: 0;\n}\n.Box-asgardeoSignIn .multiple-otions-title {\n margin: 16px 0 34px;\n}\n.Box-asgardeoSignIn .asgardeo-multiple-options-paper {\n padding-bottom: 64px;\n}\n.Box-asgardeoSignIn .asgardeo-multiple-options-paper .asgardeo-sign-in-alert {\n margin-bottom: 24px;\n}\n\n.Box-circularProgressHolder {\n display: flex;\n justify-content: center;\n align-items: center;\n min-height: 75vh;\n}\n.Box-circularProgressHolder .circular-progress {\n color: rgb(214, 211, 211) !important;\n}\n\n.asgardeo-sign-in-footer,\n.asgardeo-sign-in-logo {\n opacity: 0.5;\n animation: fade-in 0.7s ease-in-out forwards;\n}\n\n@keyframes fade-in {\n to {\n opacity: 1;\n }\n}\n.circular-progress-holder-authn {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-grow: 1;\n}\n.circular-progress-holder-authn .sign-in-button-progress {\n color: var(--oxygen-palette-primary-main);\n margin: 0 auto !important;\n max-height: 25px;\n max-width: 25px;\n margin-left: 12px;\n}";
|
|
44269
44275
|
n(css$1,{});
|
|
44270
44276
|
|
|
44277
|
+
/**
|
|
44278
|
+
* This component renders the IdentifierFirst authentication form.
|
|
44279
|
+
*
|
|
44280
|
+
* @param {IdentifierFirstProps} props - Props injected to the IdentifierFirst authentication component.
|
|
44281
|
+
* @param {BrandingProps} props.brandingProps - Branding props.
|
|
44282
|
+
* @param {Function} props.handleAuthenticate - Callback to handle authentication.
|
|
44283
|
+
* @param {Authenticator} props.authenticator - Authenticator.
|
|
44284
|
+
* @param {AlertType} props.alert - Alert type.
|
|
44285
|
+
* @param {ReactElement[]} props.renderLoginOptions - Login options.
|
|
44286
|
+
* @param {boolean} props.showSelfSignUp - Show self sign up.
|
|
44287
|
+
*
|
|
44288
|
+
* @return {ReactElement}
|
|
44289
|
+
*/
|
|
44290
|
+
const IdentifierFirst = ({ handleAuthenticate, authenticator, alert, brandingProps, showSelfSignUp, renderLoginOptions, }) => {
|
|
44291
|
+
var _a;
|
|
44292
|
+
const [username, setUsername] = useState('');
|
|
44293
|
+
const { isAuthLoading } = useContext(AsgardeoContext);
|
|
44294
|
+
const { t, isLoading } = useTranslations({
|
|
44295
|
+
componentLocaleOverride: brandingProps === null || brandingProps === void 0 ? void 0 : brandingProps.locale,
|
|
44296
|
+
componentTextOverrides: (_a = brandingProps === null || brandingProps === void 0 ? void 0 : brandingProps.preference) === null || _a === void 0 ? void 0 : _a.text,
|
|
44297
|
+
screen: ScreenType.Login,
|
|
44298
|
+
});
|
|
44299
|
+
if (isLoading) {
|
|
44300
|
+
return (jsxRuntimeExports.jsxs(SignIn$1.Paper, { className: "asgardeo-basic-auth-skeleton", children: [jsxRuntimeExports.jsx(Pi, { className: "skeleton-title", variant: "text", width: 100, height: 55 }), jsxRuntimeExports.jsx(Pi, { className: "skeleton-text-field-label", variant: "text", width: 70 }), jsxRuntimeExports.jsx(Pi, { variant: "rectangular", width: 300, height: 40 }), jsxRuntimeExports.jsx(Pi, { className: "skeleton-text-field-label", variant: "text", width: 70 }), jsxRuntimeExports.jsx(Pi, { variant: "rectangular", width: 300, height: 40 }), jsxRuntimeExports.jsx(Pi, { className: "skeleton-submit-button", variant: "rectangular", width: 270, height: 40 })] }));
|
|
44301
|
+
}
|
|
44302
|
+
return (jsxRuntimeExports.jsxs(SignIn$1.Paper, { className: "Paper-basicAuth", children: [jsxRuntimeExports.jsx(SignIn$1.Typography, { title: true, className: "Typography-basicAuthTitle", children: t(keys.login.login.heading) }), alert && (jsxRuntimeExports.jsx(SignIn$1.Alert, Object.assign({ className: "asgardeo-basic-auth-alert" }, alert === null || alert === void 0 ? void 0 : alert.alertType, { children: t(alert.key) }))), jsxRuntimeExports.jsx(SignIn$1.TextField, { fullWidth: true, autoComplete: "off", label: t(keys.login.username), name: "text", value: username, placeholder: t(keys.login.enter.your.username), onChange: (e) => setUsername(e.target.value) }), jsxRuntimeExports.jsx(SignIn$1.Button, { color: "primary", variant: "contained", type: "submit", fullWidth: true, disabled: isAuthLoading, onClick: () => {
|
|
44303
|
+
handleAuthenticate(authenticator.authenticatorId, {
|
|
44304
|
+
username,
|
|
44305
|
+
});
|
|
44306
|
+
setUsername('');
|
|
44307
|
+
}, children: t(keys.login.button) }), isAuthLoading && (jsxRuntimeExports.jsx("div", { className: "circular-progress-holder-authn", children: jsxRuntimeExports.jsx(ae, { className: "sign-in-button-progress" }) })), showSelfSignUp && (jsxRuntimeExports.jsxs(je, { container: true, children: [jsxRuntimeExports.jsx(SignIn$1.Typography, { children: t(keys.common.prefix.register) }), jsxRuntimeExports.jsx(SignIn$1.Link, { href: "./register", className: "asgardeo-register-link", children: t(keys.common.register) })] })), renderLoginOptions.length !== 0 && jsxRuntimeExports.jsxs(SignIn$1.Divider, { children: [" ", t(keys.common.or), " "] }), renderLoginOptions] }));
|
|
44308
|
+
};
|
|
44309
|
+
|
|
44271
44310
|
/**
|
|
44272
44311
|
* This component provides the sign-in functionality.
|
|
44273
44312
|
*
|
|
@@ -44278,9 +44317,8 @@ n(css$1,{});
|
|
|
44278
44317
|
* @returns {ReactElement} - React element.
|
|
44279
44318
|
*/
|
|
44280
44319
|
const SignIn = (props) => {
|
|
44281
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
44320
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
44282
44321
|
const { brandingProps, showFooter = true, showLogo = true, showSignUp } = props;
|
|
44283
|
-
const [authResponse, setAuthResponse] = useState();
|
|
44284
44322
|
const [isComponentLoading, setIsComponentLoading] = useState(true);
|
|
44285
44323
|
const [alert, setAlert] = useState();
|
|
44286
44324
|
const [showSelfSignUp, setShowSelfSignUp] = useState(showSignUp);
|
|
@@ -44305,7 +44343,7 @@ const SignIn = (props) => {
|
|
|
44305
44343
|
*/
|
|
44306
44344
|
authorize()
|
|
44307
44345
|
.then((response) => {
|
|
44308
|
-
setAuthResponse(response);
|
|
44346
|
+
authContext === null || authContext === void 0 ? void 0 : authContext.setAuthResponse(response);
|
|
44309
44347
|
setIsComponentLoading(false);
|
|
44310
44348
|
})
|
|
44311
44349
|
.catch((error) => {
|
|
@@ -44320,14 +44358,14 @@ const SignIn = (props) => {
|
|
|
44320
44358
|
* @param {object} [authParams] - Authentication parameters.
|
|
44321
44359
|
*/
|
|
44322
44360
|
const handleAuthenticate = (authenticatorId, authParams) => __awaiter$1(void 0, void 0, void 0, function* () {
|
|
44323
|
-
var
|
|
44361
|
+
var _k, _l, _m;
|
|
44324
44362
|
setAlert(undefined);
|
|
44325
|
-
if (authResponse === undefined) {
|
|
44363
|
+
if ((authContext === null || authContext === void 0 ? void 0 : authContext.authResponse) === undefined) {
|
|
44326
44364
|
throw new AsgardeoUIException('REACT_UI-SIGN_IN-HA-IV02', 'Auth response is undefined.');
|
|
44327
44365
|
}
|
|
44328
44366
|
authContext.setIsAuthLoading(true);
|
|
44329
44367
|
const resp = yield authenticate({
|
|
44330
|
-
flowId: authResponse.flowId,
|
|
44368
|
+
flowId: authContext === null || authContext === void 0 ? void 0 : authContext.authResponse.flowId,
|
|
44331
44369
|
selectedAuthenticator: {
|
|
44332
44370
|
authenticatorId,
|
|
44333
44371
|
params: authParams,
|
|
@@ -44338,12 +44376,12 @@ const SignIn = (props) => {
|
|
|
44338
44376
|
throw new AsgardeoUIException('REACT_UI-SIGN_IN-HA-SE03', 'Authentication failed.', authnError.stack);
|
|
44339
44377
|
});
|
|
44340
44378
|
if (!authParams) {
|
|
44341
|
-
const metaData = (
|
|
44379
|
+
const metaData = (_l = (_k = resp.nextStep) === null || _k === void 0 ? void 0 : _k.authenticators[0]) === null || _l === void 0 ? void 0 : _l.metadata;
|
|
44342
44380
|
if (metaData.promptType === PromptType.RedirectionPromt) {
|
|
44343
44381
|
/**
|
|
44344
44382
|
* Open a popup window to handle redirection prompts
|
|
44345
44383
|
*/
|
|
44346
|
-
window.open((
|
|
44384
|
+
window.open((_m = metaData.additionalData) === null || _m === void 0 ? void 0 : _m.redirectUrl, resp.nextStep.authenticators[0].authenticator, 'width=500,height=600');
|
|
44347
44385
|
/**
|
|
44348
44386
|
* Add an event listener to the window to capture the message from the popup
|
|
44349
44387
|
*/
|
|
@@ -44365,25 +44403,25 @@ const SignIn = (props) => {
|
|
|
44365
44403
|
});
|
|
44366
44404
|
}
|
|
44367
44405
|
else if (metaData.promptType === PromptType.UserPrompt) {
|
|
44368
|
-
setAuthResponse(resp);
|
|
44406
|
+
authContext === null || authContext === void 0 ? void 0 : authContext.setAuthResponse(resp);
|
|
44369
44407
|
}
|
|
44370
44408
|
}
|
|
44371
44409
|
else if (resp.flowStatus === FlowStatus.SuccessCompleted && resp.authData) {
|
|
44372
44410
|
/**
|
|
44373
44411
|
* when the authentication is successful, generate the token
|
|
44374
44412
|
*/
|
|
44375
|
-
setAuthResponse(resp);
|
|
44413
|
+
authContext === null || authContext === void 0 ? void 0 : authContext.setAuthResponse(resp);
|
|
44376
44414
|
const authInstance = AuthClient.getInstance();
|
|
44377
44415
|
const state = (yield authInstance.getDataLayer().getTemporaryDataParameter('state')).toString();
|
|
44378
44416
|
yield authInstance.requestAccessToken(resp.authData.code, resp.authData.session_state, state);
|
|
44379
44417
|
authContext.setAuthentication();
|
|
44380
44418
|
}
|
|
44381
44419
|
else if (resp.flowStatus === FlowStatus.FailIncomplete) {
|
|
44382
|
-
setAuthResponse(Object.assign(Object.assign({}, resp), { nextStep: authResponse.nextStep }));
|
|
44420
|
+
authContext === null || authContext === void 0 ? void 0 : authContext.setAuthResponse(Object.assign(Object.assign({}, resp), { nextStep: authContext === null || authContext === void 0 ? void 0 : authContext.authResponse.nextStep }));
|
|
44383
44421
|
setAlert({ alertType: { error: true }, key: keys.common.error });
|
|
44384
44422
|
}
|
|
44385
44423
|
else {
|
|
44386
|
-
setAuthResponse(resp);
|
|
44424
|
+
authContext === null || authContext === void 0 ? void 0 : authContext.setAuthResponse(resp);
|
|
44387
44425
|
setShowSelfSignUp(false);
|
|
44388
44426
|
}
|
|
44389
44427
|
authContext.setIsAuthLoading(false);
|
|
@@ -44397,13 +44435,17 @@ const SignIn = (props) => {
|
|
|
44397
44435
|
return LoginOptions;
|
|
44398
44436
|
};
|
|
44399
44437
|
const renderSignIn = () => {
|
|
44400
|
-
var _a;
|
|
44401
|
-
const authenticators = (_a =
|
|
44438
|
+
var _a, _b;
|
|
44439
|
+
const authenticators = (_b = (_a = authContext === null || authContext === void 0 ? void 0 : authContext.authResponse) === null || _a === void 0 ? void 0 : _a.nextStep) === null || _b === void 0 ? void 0 : _b.authenticators;
|
|
44402
44440
|
if (authenticators) {
|
|
44403
44441
|
const usernamePasswordAuthenticator = authenticators.find((authenticator) => authenticator.authenticator === 'Username & Password');
|
|
44404
44442
|
if (usernamePasswordAuthenticator) {
|
|
44405
44443
|
return (jsxRuntimeExports.jsx(BasicAuth, { brandingProps: brandingProps, authenticator: usernamePasswordAuthenticator, handleAuthenticate: handleAuthenticate, showSelfSignUp: showSelfSignUp, alert: alert, renderLoginOptions: renderLoginOptions(authenticators.filter((auth) => auth.authenticatorId !== usernamePasswordAuthenticator.authenticatorId)) }));
|
|
44406
44444
|
}
|
|
44445
|
+
const identifierFirstAuthenticator = authenticators.find((authenticator) => authenticator.authenticator === 'Identifier First');
|
|
44446
|
+
if (identifierFirstAuthenticator) {
|
|
44447
|
+
return (jsxRuntimeExports.jsx(IdentifierFirst, { brandingProps: brandingProps, authenticator: identifierFirstAuthenticator, handleAuthenticate: handleAuthenticate, showSelfSignUp: showSelfSignUp, alert: alert, renderLoginOptions: renderLoginOptions(authenticators.filter((auth) => auth.authenticatorId !== identifierFirstAuthenticator.authenticatorId)) }));
|
|
44448
|
+
}
|
|
44407
44449
|
if (authenticators.length === 1) {
|
|
44408
44450
|
if (authenticators[0].authenticator === 'TOTP') {
|
|
44409
44451
|
return (jsxRuntimeExports.jsx(Totp, { brandingProps: brandingProps, authenticator: authenticators[0], alert: alert, handleAuthenticate: handleAuthenticate }));
|
|
@@ -44411,14 +44453,14 @@ const SignIn = (props) => {
|
|
|
44411
44453
|
if (
|
|
44412
44454
|
// TODO: change after api based auth gets fixed
|
|
44413
44455
|
new SPACryptoUtils()
|
|
44414
|
-
.base64URLDecode(authResponse.nextStep.authenticators[0].authenticatorId)
|
|
44456
|
+
.base64URLDecode(authContext === null || authContext === void 0 ? void 0 : authContext.authResponse.nextStep.authenticators[0].authenticatorId)
|
|
44415
44457
|
.split(':')[0] === 'email-otp-authenticator') {
|
|
44416
44458
|
return (jsxRuntimeExports.jsx(EmailOtp, { alert: alert, brandingProps: brandingProps, authenticator: authenticators[0], handleAuthenticate: handleAuthenticate }));
|
|
44417
44459
|
}
|
|
44418
44460
|
if (
|
|
44419
44461
|
// TODO: change after api based auth gets fixed
|
|
44420
44462
|
new SPACryptoUtils()
|
|
44421
|
-
.base64URLDecode(authResponse.nextStep.authenticators[0].authenticatorId)
|
|
44463
|
+
.base64URLDecode(authContext === null || authContext === void 0 ? void 0 : authContext.authResponse.nextStep.authenticators[0].authenticatorId)
|
|
44422
44464
|
.split(':')[0] === 'sms-otp-authenticator') {
|
|
44423
44465
|
return (jsxRuntimeExports.jsx(SmsOtp, { alert: alert, brandingProps: brandingProps, authenticator: authenticators[0], handleAuthenticate: handleAuthenticate }));
|
|
44424
44466
|
}
|
|
@@ -44444,15 +44486,15 @@ const SignIn = (props) => {
|
|
|
44444
44486
|
if (showFooter && copyrightText.includes('{{currentYear}}')) {
|
|
44445
44487
|
copyrightText = copyrightText.replace('{{currentYear}}', new Date().getFullYear().toString());
|
|
44446
44488
|
}
|
|
44447
|
-
return (jsxRuntimeExports.jsx(eo, { theme: generateThemeSignIn(componentBranding === null || componentBranding === void 0 ? void 0 : componentBranding.preference.theme), children: jsxRuntimeExports.jsxs(SignIn$1, { className: "Box-asgardeoSignIn", children: [showLogo && !(isLoading || isComponentLoading) && (jsxRuntimeExports.jsx(SignIn$1.Image, { className: "asgardeo-sign-in-logo", src: imgUrl })), (
|
|
44489
|
+
return (jsxRuntimeExports.jsx(eo, { theme: generateThemeSignIn(componentBranding === null || componentBranding === void 0 ? void 0 : componentBranding.preference.theme), children: jsxRuntimeExports.jsxs(SignIn$1, { className: "Box-asgardeoSignIn", children: [showLogo && !(isLoading || isComponentLoading) && (jsxRuntimeExports.jsx(SignIn$1.Image, { className: "asgardeo-sign-in-logo", src: imgUrl })), ((_g = authContext === null || authContext === void 0 ? void 0 : authContext.authResponse) === null || _g === void 0 ? void 0 : _g.flowStatus) !== FlowStatus.SuccessCompleted && !isAuthenticated && (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [renderSignIn(), showFooter && !(isLoading || isComponentLoading) && (jsxRuntimeExports.jsx(SignIn$1.Footer, { className: "asgardeo-sign-in-footer", copyrights: { children: copyrightText }, items: [
|
|
44448
44490
|
{
|
|
44449
44491
|
children: (jsxRuntimeExports.jsx(SignIn$1.Link, { href: componentBranding.preference.urls.privacyPolicyURL, children: t(keys.common.privacy.policy) })),
|
|
44450
44492
|
},
|
|
44451
44493
|
{
|
|
44452
44494
|
children: (jsxRuntimeExports.jsx(SignIn$1.Link, { href: componentBranding.preference.urls.termsOfUseURL, children: t(keys.common.terms.of.service) })),
|
|
44453
44495
|
},
|
|
44454
|
-
{ children: jsxRuntimeExports.jsx(SignIn$1.Typography, { children: (
|
|
44455
|
-
] }))] })), ((
|
|
44496
|
+
{ children: jsxRuntimeExports.jsx(SignIn$1.Typography, { children: (_h = componentBranding === null || componentBranding === void 0 ? void 0 : componentBranding.locale) !== null && _h !== void 0 ? _h : DEFAULT_LOCALE }) },
|
|
44497
|
+
] }))] })), (((_j = authContext === null || authContext === void 0 ? void 0 : authContext.authResponse) === null || _j === void 0 ? void 0 : _j.flowStatus) === FlowStatus.SuccessCompleted || isAuthenticated) && (jsxRuntimeExports.jsx("div", { style: { backgroundColor: 'white', padding: '1rem' }, children: "Successfully Authenticated" }))] }) }));
|
|
44456
44498
|
};
|
|
44457
44499
|
|
|
44458
44500
|
/**
|
|
@@ -44863,6 +44905,7 @@ const AsgardeoProvider = (props) => {
|
|
|
44863
44905
|
const [isBrandingLoading, setIsBrandingLoading] = useState(true);
|
|
44864
44906
|
const [isTextLoading, setIsTextLoading] = useState(true);
|
|
44865
44907
|
const [isAuthLoading, setIsAuthLoading] = useState(false);
|
|
44908
|
+
const [authResponse, setAuthResponse] = useState();
|
|
44866
44909
|
const onSignInRef = useRef();
|
|
44867
44910
|
const onSignOutRef = useRef();
|
|
44868
44911
|
const setOnSignIn = useCallback((newOnSignIn) => {
|
|
@@ -44913,6 +44956,7 @@ const AsgardeoProvider = (props) => {
|
|
|
44913
44956
|
}, [config.signInRedirectURL, setAuthentication]);
|
|
44914
44957
|
const value = useMemo(() => ({
|
|
44915
44958
|
accessToken,
|
|
44959
|
+
authResponse,
|
|
44916
44960
|
config,
|
|
44917
44961
|
isAuthLoading,
|
|
44918
44962
|
isAuthenticated,
|
|
@@ -44920,6 +44964,7 @@ const AsgardeoProvider = (props) => {
|
|
|
44920
44964
|
isGlobalLoading: isBrandingLoading || isTextLoading || isAuthLoading,
|
|
44921
44965
|
isTextLoading,
|
|
44922
44966
|
onSignOutRef,
|
|
44967
|
+
setAuthResponse,
|
|
44923
44968
|
setAuthentication,
|
|
44924
44969
|
setIsAuthLoading,
|
|
44925
44970
|
setIsBrandingLoading,
|
|
@@ -44929,11 +44974,13 @@ const AsgardeoProvider = (props) => {
|
|
|
44929
44974
|
user,
|
|
44930
44975
|
}), [
|
|
44931
44976
|
accessToken,
|
|
44977
|
+
authResponse,
|
|
44932
44978
|
config,
|
|
44933
44979
|
isAuthLoading,
|
|
44934
44980
|
isAuthenticated,
|
|
44935
44981
|
isBrandingLoading,
|
|
44936
44982
|
isTextLoading,
|
|
44983
|
+
setAuthResponse,
|
|
44937
44984
|
setAuthentication,
|
|
44938
44985
|
setOnSignIn,
|
|
44939
44986
|
setOnSignOut,
|