@asgardeo/react 0.5.1 → 0.5.3

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
@@ -4885,7 +4885,7 @@ var BaseSignInContent = ({
4885
4885
  touchAllFields();
4886
4886
  };
4887
4887
  const handleRedirectionIfNeeded = (response) => {
4888
- if ("nextStep" in response && response.nextStep && response.nextStep.stepType === import_browser38.EmbeddedSignInFlowStepType.AuthenticatorPrompt && response.nextStep.authenticators && response.nextStep.authenticators.length === 1) {
4888
+ if (response && "nextStep" in response && response.nextStep && response.nextStep.stepType === import_browser38.EmbeddedSignInFlowStepType.AuthenticatorPrompt && response.nextStep.authenticators && response.nextStep.authenticators.length === 1) {
4889
4889
  const responseAuthenticator = response.nextStep.authenticators[0];
4890
4890
  if (responseAuthenticator.metadata?.promptType === import_browser38.EmbeddedSignInFlowAuthenticatorPromptType.RedirectionPrompt && responseAuthenticator.metadata?.additionalData?.redirectUrl) {
4891
4891
  const redirectUrl = responseAuthenticator.metadata?.additionalData?.redirectUrl;
@@ -4973,7 +4973,7 @@ var BaseSignInContent = ({
4973
4973
  });
4974
4974
  popup.close();
4975
4975
  onFlowChange?.(response2);
4976
- if (response2.flowStatus === import_browser38.EmbeddedSignInFlowStatus.SuccessCompleted) {
4976
+ if (response2?.flowStatus === import_browser38.EmbeddedSignInFlowStatus.SuccessCompleted) {
4977
4977
  onSuccess?.(response2.authData);
4978
4978
  }
4979
4979
  }
@@ -5014,18 +5014,18 @@ var BaseSignInContent = ({
5014
5014
  url: currentFlow?.links[0].href
5015
5015
  });
5016
5016
  onFlowChange?.(response);
5017
- if (response.flowStatus === import_browser38.EmbeddedSignInFlowStatus.SuccessCompleted) {
5017
+ if (response?.flowStatus === import_browser38.EmbeddedSignInFlowStatus.SuccessCompleted) {
5018
5018
  onSuccess?.(response.authData);
5019
5019
  return;
5020
5020
  }
5021
- if (response.flowStatus === import_browser38.EmbeddedSignInFlowStatus.FailCompleted || response.flowStatus === import_browser38.EmbeddedSignInFlowStatus.FailIncomplete) {
5021
+ if (response?.flowStatus === import_browser38.EmbeddedSignInFlowStatus.FailCompleted || response?.flowStatus === import_browser38.EmbeddedSignInFlowStatus.FailIncomplete) {
5022
5022
  setError(t("errors.sign.in.flow.completion.failure"));
5023
5023
  return;
5024
5024
  }
5025
5025
  if (handleRedirectionIfNeeded(response)) {
5026
5026
  return;
5027
5027
  }
5028
- if ("flowId" in response && "nextStep" in response) {
5028
+ if (response && "flowId" in response && "nextStep" in response) {
5029
5029
  const nextStepResponse = response;
5030
5030
  setCurrentFlow(nextStepResponse);
5031
5031
  if (nextStepResponse.nextStep?.authenticators?.length > 0) {
@@ -5086,15 +5086,15 @@ var BaseSignInContent = ({
5086
5086
  url: currentFlow?.links[0].href
5087
5087
  });
5088
5088
  onFlowChange?.(response);
5089
- if (response.flowStatus === import_browser38.EmbeddedSignInFlowStatus.SuccessCompleted) {
5089
+ if (response?.flowStatus === import_browser38.EmbeddedSignInFlowStatus.SuccessCompleted) {
5090
5090
  onSuccess?.(response.authData);
5091
5091
  return;
5092
5092
  }
5093
- if (response.flowStatus === import_browser38.EmbeddedSignInFlowStatus.FailCompleted || response.flowStatus === import_browser38.EmbeddedSignInFlowStatus.FailIncomplete) {
5093
+ if (response?.flowStatus === import_browser38.EmbeddedSignInFlowStatus.FailCompleted || response?.flowStatus === import_browser38.EmbeddedSignInFlowStatus.FailIncomplete) {
5094
5094
  setError(t("errors.sign.in.flow.passkeys.completion.failure"));
5095
5095
  return;
5096
5096
  }
5097
- if ("flowId" in response && "nextStep" in response) {
5097
+ if (response && "flowId" in response && "nextStep" in response) {
5098
5098
  const nextStepResponse = response;
5099
5099
  setCurrentFlow(nextStepResponse);
5100
5100
  if (nextStepResponse.nextStep?.authenticators?.length > 0) {
@@ -5140,7 +5140,7 @@ var BaseSignInContent = ({
5140
5140
  url: currentFlow?.links[0].href
5141
5141
  });
5142
5142
  onFlowChange?.(response);
5143
- if (response.flowStatus === import_browser38.EmbeddedSignInFlowStatus.SuccessCompleted) {
5143
+ if (response?.flowStatus === import_browser38.EmbeddedSignInFlowStatus.SuccessCompleted) {
5144
5144
  onSuccess?.(response.authData);
5145
5145
  return;
5146
5146
  }
@@ -5163,18 +5163,18 @@ var BaseSignInContent = ({
5163
5163
  url: currentFlow?.links[0].href
5164
5164
  });
5165
5165
  onFlowChange?.(response);
5166
- if (response.flowStatus === import_browser38.EmbeddedSignInFlowStatus.SuccessCompleted) {
5166
+ if (response?.flowStatus === import_browser38.EmbeddedSignInFlowStatus.SuccessCompleted) {
5167
5167
  onSuccess?.(response.authData);
5168
5168
  return;
5169
5169
  }
5170
- if (response.flowStatus === import_browser38.EmbeddedSignInFlowStatus.FailCompleted || response.flowStatus === import_browser38.EmbeddedSignInFlowStatus.FailIncomplete) {
5170
+ if (response?.flowStatus === import_browser38.EmbeddedSignInFlowStatus.FailCompleted || response?.flowStatus === import_browser38.EmbeddedSignInFlowStatus.FailIncomplete) {
5171
5171
  setError("Authentication failed. Please check your credentials and try again.");
5172
5172
  return;
5173
5173
  }
5174
5174
  if (handleRedirectionIfNeeded(response)) {
5175
5175
  return;
5176
5176
  }
5177
- if ("flowId" in response && "nextStep" in response) {
5177
+ if (response && "flowId" in response && "nextStep" in response) {
5178
5178
  const nextStepResponse = response;
5179
5179
  setCurrentFlow(nextStepResponse);
5180
5180
  if (nextStepResponse.nextStep?.authenticators?.length > 0) {
@@ -5214,18 +5214,18 @@ var BaseSignInContent = ({
5214
5214
  url: currentFlow?.links[0].href
5215
5215
  });
5216
5216
  onFlowChange?.(response);
5217
- if (response.flowStatus === import_browser38.EmbeddedSignInFlowStatus.SuccessCompleted) {
5217
+ if (response?.flowStatus === import_browser38.EmbeddedSignInFlowStatus.SuccessCompleted) {
5218
5218
  onSuccess?.(response.authData);
5219
5219
  return;
5220
5220
  }
5221
- if (response.flowStatus === import_browser38.EmbeddedSignInFlowStatus.FailCompleted || response.flowStatus === import_browser38.EmbeddedSignInFlowStatus.FailIncomplete) {
5221
+ if (response?.flowStatus === import_browser38.EmbeddedSignInFlowStatus.FailCompleted || response?.flowStatus === import_browser38.EmbeddedSignInFlowStatus.FailIncomplete) {
5222
5222
  setError("Authentication failed. Please try again.");
5223
5223
  return;
5224
5224
  }
5225
5225
  if (handleRedirectionIfNeeded(response)) {
5226
5226
  return;
5227
5227
  }
5228
- if ("flowId" in response && "nextStep" in response) {
5228
+ if (response && "flowId" in response && "nextStep" in response) {
5229
5229
  const nextStepResponse = response;
5230
5230
  setCurrentFlow(nextStepResponse);
5231
5231
  if (nextStepResponse.nextStep?.authenticators?.length > 0) {
@@ -5256,7 +5256,7 @@ var BaseSignInContent = ({
5256
5256
  }
5257
5257
  }
5258
5258
  } catch (err) {
5259
- const errorMessage = err instanceof import_browser38.AsgardeoAPIError ? err.message : "Authenticator selection failed";
5259
+ const errorMessage = err instanceof import_browser38.AsgardeoAPIError ? err?.message : "Authenticator selection failed";
5260
5260
  setError(errorMessage);
5261
5261
  onError?.(err);
5262
5262
  } finally {