@huma-finance/widgets 0.0.61-beta.559 → 0.0.61-beta.561

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.
@@ -4995,7 +4995,7 @@ const JiaPoolCopies = {
4995
4995
  buttonText: 'THANK YOU'
4996
4996
  }
4997
4997
  };
4998
- const LoadingCopiesByType$2 = {
4998
+ const LoadingCopiesByType$1 = {
4999
4999
  verificationStatus: {
5000
5000
  description: "Checking your verification status..."
5001
5001
  },
@@ -5220,7 +5220,7 @@ function EvaluationKYC(_ref) {
5220
5220
  }
5221
5221
  return jsxRuntime.jsx(LoadingModal, {
5222
5222
  title: "Lender Approval",
5223
- description: LoadingCopiesByType$2[loadingType].description
5223
+ description: LoadingCopiesByType$1[loadingType].description
5224
5224
  });
5225
5225
  }
5226
5226
 
@@ -5534,17 +5534,6 @@ function ChooseTranche(_ref) {
5534
5534
  }
5535
5535
 
5536
5536
  var _templateObject$a, _templateObject2$8, _templateObject3$7;
5537
- const LoadingCopiesByType$1 = {
5538
- verificationStatus: {
5539
- description: "Checking your verification status..."
5540
- },
5541
- startKYC: {
5542
- description: "Starting KYC/KYB..."
5543
- },
5544
- approveLender: {
5545
- description: "Approving as lender..."
5546
- }
5547
- };
5548
5537
  function PersonaEvaluation(_ref) {
5549
5538
  let {
5550
5539
  poolInfo,
@@ -5574,6 +5563,7 @@ function PersonaEvaluation(_ref) {
5574
5563
  const [sessionToken, setSessionToken] = React.useState();
5575
5564
  const [verificationStatus, setVerificationStatus] = React.useState();
5576
5565
  const [showPersonaClient, setShowPersonaClient] = React.useState(false);
5566
+ const [KYCAutoStarted, setKYCAutoStarted] = React.useState(false);
5577
5567
  const isKYCCompletedRef = React.useRef(false);
5578
5568
  const isActionOngoingRef = React.useRef(false);
5579
5569
  const isKYCResumedRef = React.useRef(false);
@@ -5759,6 +5749,7 @@ function PersonaEvaluation(_ref) {
5759
5749
  isActionOngoingRef.current = false;
5760
5750
  setShowPersonaClient(false);
5761
5751
  setLoadingType(undefined);
5752
+ handleClose();
5762
5753
  },
5763
5754
  onError: () => {
5764
5755
  isActionOngoingRef.current = false;
@@ -5766,21 +5757,27 @@ function PersonaEvaluation(_ref) {
5766
5757
  setLoadingType(undefined);
5767
5758
  }
5768
5759
  });
5769
- }, [checkVerificationStatus, inquiryId, sessionToken]);
5760
+ }, [checkVerificationStatus, handleClose, inquiryId, sessionToken]);
5770
5761
 
5771
- // Start KYC flow directly
5762
+ // Start KYC flow directly for the first time
5772
5763
  React.useEffect(() => {
5773
- if (verificationStatus) {
5764
+ if (isActionOngoingRef.current || isKYCResumedRef.current) {
5765
+ return;
5766
+ }
5767
+ if (verificationStatus && !KYCAutoStarted) {
5774
5768
  switch (verificationStatus.status) {
5775
5769
  case shared.IdentityVerificationStatusV2.ACCREDITED:
5776
5770
  case shared.IdentityVerificationStatusV2.CREATED:
5777
5771
  case shared.IdentityVerificationStatusV2.PENDING:
5778
5772
  case shared.IdentityVerificationStatusV2.EXPIRED:
5779
- startKYC();
5780
- break;
5773
+ {
5774
+ startKYC();
5775
+ setKYCAutoStarted(true);
5776
+ break;
5777
+ }
5781
5778
  }
5782
5779
  }
5783
- }, [startKYC, verificationStatus]);
5780
+ }, [KYCAutoStarted, startKYC, verificationStatus]);
5784
5781
  const handleAction = () => {
5785
5782
  if (verificationStatus) {
5786
5783
  switch (verificationStatus.status) {
@@ -5832,7 +5829,7 @@ function PersonaEvaluation(_ref) {
5832
5829
  }
5833
5830
  return jsxRuntime.jsx(LoadingModal, {
5834
5831
  title: "Lender Approval",
5835
- description: LoadingCopiesByType$1[loadingType].description
5832
+ description: "Checking your verification status..."
5836
5833
  });
5837
5834
  }
5838
5835