@asgardeo/react 0.5.31 → 0.5.33
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 +23 -13
- package/dist/cjs/index.js.map +2 -2
- package/dist/contexts/Asgardeo/AsgardeoContext.d.ts +6 -3
- package/dist/index.js +23 -13
- package/dist/index.js.map +2 -2
- package/package.json +2 -2
|
@@ -43,7 +43,11 @@ export type AsgardeoContextProps = {
|
|
|
43
43
|
* @remark This is the programmatic version of the `SignInButton` component.
|
|
44
44
|
* TODO: Fix the types.
|
|
45
45
|
*/
|
|
46
|
-
signIn: any
|
|
46
|
+
signIn: (...args: any) => Promise<any>;
|
|
47
|
+
/**
|
|
48
|
+
* Silent sign-in function to re-authenticate the user without user interaction.
|
|
49
|
+
* @remark This is the programmatic version of the `SilentSignIn` component.
|
|
50
|
+
*/
|
|
47
51
|
signInSilently: AsgardeoReactClient['signInSilently'];
|
|
48
52
|
/**
|
|
49
53
|
* Sign-out function to terminate the authentication session.
|
|
@@ -54,9 +58,8 @@ export type AsgardeoContextProps = {
|
|
|
54
58
|
/**
|
|
55
59
|
* Sign-up function to initiate the registration process.
|
|
56
60
|
* @remark This is the programmatic version of the `SignUpButton` component.
|
|
57
|
-
* FIXME: Fix the types.
|
|
58
61
|
*/
|
|
59
|
-
signUp: any
|
|
62
|
+
signUp: (...args: any[]) => Promise<any>;
|
|
60
63
|
user: any;
|
|
61
64
|
organization: Organization;
|
|
62
65
|
/**
|
package/dist/index.js
CHANGED
|
@@ -28,10 +28,10 @@ var AsgardeoContext = createContext({
|
|
|
28
28
|
isLoading: true,
|
|
29
29
|
isSignedIn: false,
|
|
30
30
|
organization: null,
|
|
31
|
-
signIn:
|
|
32
|
-
signInSilently:
|
|
33
|
-
signOut:
|
|
34
|
-
signUp:
|
|
31
|
+
signIn: () => Promise.resolve({}),
|
|
32
|
+
signInSilently: () => Promise.resolve({}),
|
|
33
|
+
signOut: () => Promise.resolve({}),
|
|
34
|
+
signUp: () => Promise.resolve({}),
|
|
35
35
|
user: null,
|
|
36
36
|
http: {
|
|
37
37
|
request: () => null,
|
|
@@ -7456,7 +7456,7 @@ var normalizeFlowResponse = (response, t) => {
|
|
|
7456
7456
|
// src/components/presentation/SignIn/component-driven/SignIn.tsx
|
|
7457
7457
|
import { Fragment as Fragment12, jsx as jsx57 } from "react/jsx-runtime";
|
|
7458
7458
|
var SignIn = ({ className, size = "medium", onSuccess, onError, variant, children }) => {
|
|
7459
|
-
const { applicationId, afterSignInUrl, signIn, isInitialized, isLoading
|
|
7459
|
+
const { applicationId, afterSignInUrl, signIn, isInitialized, isLoading } = useAsgardeo_default();
|
|
7460
7460
|
const { t } = useTranslation_default();
|
|
7461
7461
|
const [components, setComponents] = useState16([]);
|
|
7462
7462
|
const [currentFlowId, setCurrentFlowId] = useState16(null);
|
|
@@ -7471,10 +7471,13 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7471
7471
|
}
|
|
7472
7472
|
}, [isInitialized, isLoading, isFlowInitialized]);
|
|
7473
7473
|
const initializeFlow = async () => {
|
|
7474
|
-
const
|
|
7475
|
-
|
|
7474
|
+
const urlParams = new URL(window.location.href).searchParams;
|
|
7475
|
+
const flowIdFromUrl = urlParams.get("flowId");
|
|
7476
|
+
const applicationIdFromUrl = urlParams.get("applicationId");
|
|
7477
|
+
const effectiveApplicationId = applicationId || applicationIdFromUrl;
|
|
7478
|
+
if (!flowIdFromUrl && !effectiveApplicationId) {
|
|
7476
7479
|
const error = new AsgardeoRuntimeError8(
|
|
7477
|
-
|
|
7480
|
+
"Either flowId or applicationId is required for authentication",
|
|
7478
7481
|
"SignIn-initializeFlow-RuntimeError-001",
|
|
7479
7482
|
"react",
|
|
7480
7483
|
"Something went wrong while trying to sign in. Please try again later."
|
|
@@ -7484,10 +7487,17 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7484
7487
|
}
|
|
7485
7488
|
try {
|
|
7486
7489
|
setFlowError(null);
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7490
|
+
let response;
|
|
7491
|
+
if (flowIdFromUrl) {
|
|
7492
|
+
response = await signIn({
|
|
7493
|
+
flowId: flowIdFromUrl
|
|
7494
|
+
});
|
|
7495
|
+
} else {
|
|
7496
|
+
response = await signIn({
|
|
7497
|
+
applicationId: effectiveApplicationId,
|
|
7498
|
+
flowType: EmbeddedFlowType.Authentication
|
|
7499
|
+
});
|
|
7500
|
+
}
|
|
7491
7501
|
const { flowId, components: components2 } = normalizeFlowResponse(response, t);
|
|
7492
7502
|
if (flowId && components2) {
|
|
7493
7503
|
setCurrentFlowId(flowId);
|
|
@@ -7651,7 +7661,7 @@ var CheckboxInput = ({
|
|
|
7651
7661
|
}) => {
|
|
7652
7662
|
const config = component.config || {};
|
|
7653
7663
|
const fieldName = config["identifier"] || config["name"] || component.id;
|
|
7654
|
-
const value = formValues[fieldName] ||
|
|
7664
|
+
const value = formValues[fieldName] || false;
|
|
7655
7665
|
const error = touchedFields[fieldName] ? formErrors[fieldName] : void 0;
|
|
7656
7666
|
return createField({
|
|
7657
7667
|
type: FieldType8.Checkbox,
|