@asgardeo/react 0.5.32 → 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 +18 -8
- package/dist/cjs/index.js.map +2 -2
- package/dist/index.js +18 -8
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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);
|