@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 CHANGED
@@ -7536,7 +7536,7 @@ var normalizeFlowResponse = (response, t) => {
7536
7536
  // src/components/presentation/SignIn/component-driven/SignIn.tsx
7537
7537
  var import_jsx_runtime57 = require("react/jsx-runtime");
7538
7538
  var SignIn = ({ className, size = "medium", onSuccess, onError, variant, children }) => {
7539
- const { applicationId, afterSignInUrl, signIn, isInitialized, isLoading, baseUrl } = useAsgardeo_default();
7539
+ const { applicationId, afterSignInUrl, signIn, isInitialized, isLoading } = useAsgardeo_default();
7540
7540
  const { t } = useTranslation_default();
7541
7541
  const [components, setComponents] = (0, import_react60.useState)([]);
7542
7542
  const [currentFlowId, setCurrentFlowId] = (0, import_react60.useState)(null);
@@ -7551,10 +7551,13 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
7551
7551
  }
7552
7552
  }, [isInitialized, isLoading, isFlowInitialized]);
7553
7553
  const initializeFlow = async () => {
7554
- const applicationIdFromUrl = new URL(window.location.href).searchParams.get("applicationId");
7555
- if (!applicationIdFromUrl && !applicationId) {
7554
+ const urlParams = new URL(window.location.href).searchParams;
7555
+ const flowIdFromUrl = urlParams.get("flowId");
7556
+ const applicationIdFromUrl = urlParams.get("applicationId");
7557
+ const effectiveApplicationId = applicationId || applicationIdFromUrl;
7558
+ if (!flowIdFromUrl && !effectiveApplicationId) {
7556
7559
  const error = new import_browser49.AsgardeoRuntimeError(
7557
- `Application ID is required for authentication`,
7560
+ "Either flowId or applicationId is required for authentication",
7558
7561
  "SignIn-initializeFlow-RuntimeError-001",
7559
7562
  "react",
7560
7563
  "Something went wrong while trying to sign in. Please try again later."
@@ -7564,10 +7567,17 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
7564
7567
  }
7565
7568
  try {
7566
7569
  setFlowError(null);
7567
- const response = await signIn({
7568
- applicationId: applicationId || applicationIdFromUrl,
7569
- flowType: import_browser49.EmbeddedFlowType.Authentication
7570
- });
7570
+ let response;
7571
+ if (flowIdFromUrl) {
7572
+ response = await signIn({
7573
+ flowId: flowIdFromUrl
7574
+ });
7575
+ } else {
7576
+ response = await signIn({
7577
+ applicationId: effectiveApplicationId,
7578
+ flowType: import_browser49.EmbeddedFlowType.Authentication
7579
+ });
7580
+ }
7571
7581
  const { flowId, components: components2 } = normalizeFlowResponse(response, t);
7572
7582
  if (flowId && components2) {
7573
7583
  setCurrentFlowId(flowId);