@huma-finance/widgets 0.0.61-beta.557 → 0.0.61-beta.560

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/index.js CHANGED
@@ -4955,7 +4955,7 @@ const JiaPoolCopies = {
4955
4955
  buttonText: 'THANK YOU'
4956
4956
  }
4957
4957
  };
4958
- const LoadingCopiesByType$2 = {
4958
+ const LoadingCopiesByType$1 = {
4959
4959
  verificationStatus: {
4960
4960
  description: "Checking your verification status..."
4961
4961
  },
@@ -5180,7 +5180,7 @@ function EvaluationKYC(_ref) {
5180
5180
  }
5181
5181
  return jsx(LoadingModal, {
5182
5182
  title: "Lender Approval",
5183
- description: LoadingCopiesByType$2[loadingType].description
5183
+ description: LoadingCopiesByType$1[loadingType].description
5184
5184
  });
5185
5185
  }
5186
5186
 
@@ -5494,17 +5494,6 @@ function ChooseTranche(_ref) {
5494
5494
  }
5495
5495
 
5496
5496
  var _templateObject$a, _templateObject2$8, _templateObject3$7;
5497
- const LoadingCopiesByType$1 = {
5498
- verificationStatus: {
5499
- description: "Checking your verification status..."
5500
- },
5501
- startKYC: {
5502
- description: "Starting KYC/KYB..."
5503
- },
5504
- approveLender: {
5505
- description: "Approving as lender..."
5506
- }
5507
- };
5508
5497
  function PersonaEvaluation(_ref) {
5509
5498
  let {
5510
5499
  poolInfo,
@@ -5534,6 +5523,7 @@ function PersonaEvaluation(_ref) {
5534
5523
  const [sessionToken, setSessionToken] = useState();
5535
5524
  const [verificationStatus, setVerificationStatus] = useState();
5536
5525
  const [showPersonaClient, setShowPersonaClient] = useState(false);
5526
+ const [KYCAutoStarted, setKYCAutoStarted] = useState(false);
5537
5527
  const isKYCCompletedRef = useRef(false);
5538
5528
  const isActionOngoingRef = useRef(false);
5539
5529
  const isKYCResumedRef = useRef(false);
@@ -5719,6 +5709,7 @@ function PersonaEvaluation(_ref) {
5719
5709
  isActionOngoingRef.current = false;
5720
5710
  setShowPersonaClient(false);
5721
5711
  setLoadingType(undefined);
5712
+ handleClose();
5722
5713
  },
5723
5714
  onError: () => {
5724
5715
  isActionOngoingRef.current = false;
@@ -5726,21 +5717,27 @@ function PersonaEvaluation(_ref) {
5726
5717
  setLoadingType(undefined);
5727
5718
  }
5728
5719
  });
5729
- }, [checkVerificationStatus, inquiryId, sessionToken]);
5720
+ }, [checkVerificationStatus, handleClose, inquiryId, sessionToken]);
5730
5721
 
5731
- // Start KYC flow directly
5722
+ // Start KYC flow directly for the first time
5732
5723
  useEffect(() => {
5733
- if (verificationStatus) {
5724
+ if (isActionOngoingRef.current || isKYCResumedRef.current) {
5725
+ return;
5726
+ }
5727
+ if (verificationStatus && !KYCAutoStarted) {
5734
5728
  switch (verificationStatus.status) {
5735
5729
  case IdentityVerificationStatusV2.ACCREDITED:
5736
5730
  case IdentityVerificationStatusV2.CREATED:
5737
5731
  case IdentityVerificationStatusV2.PENDING:
5738
5732
  case IdentityVerificationStatusV2.EXPIRED:
5739
- startKYC();
5740
- break;
5733
+ {
5734
+ startKYC();
5735
+ setKYCAutoStarted(true);
5736
+ break;
5737
+ }
5741
5738
  }
5742
5739
  }
5743
- }, [startKYC, verificationStatus]);
5740
+ }, [KYCAutoStarted, startKYC, verificationStatus]);
5744
5741
  const handleAction = () => {
5745
5742
  if (verificationStatus) {
5746
5743
  switch (verificationStatus.status) {
@@ -5792,7 +5789,7 @@ function PersonaEvaluation(_ref) {
5792
5789
  }
5793
5790
  return jsx(LoadingModal, {
5794
5791
  title: "Lender Approval",
5795
- description: LoadingCopiesByType$1[loadingType].description
5792
+ description: "Checking your verification status..."
5796
5793
  });
5797
5794
  }
5798
5795