@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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huma-finance/widgets",
3
- "version": "0.0.61-beta.559+f495b75",
3
+ "version": "0.0.61-beta.561+c7ff7e3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -30,8 +30,8 @@
30
30
  "@ethersproject/experimental": "^5.7.0",
31
31
  "@ethersproject/providers": "^5.6.0",
32
32
  "@ethersproject/units": "^5.6.0",
33
- "@huma-finance/sdk": "^0.0.61-beta.559+f495b75",
34
- "@huma-finance/shared": "^0.0.61-beta.559+f495b75",
33
+ "@huma-finance/sdk": "^0.0.61-beta.561+c7ff7e3",
34
+ "@huma-finance/shared": "^0.0.61-beta.561+c7ff7e3",
35
35
  "@huma-finance/web-shared": "^0.0.60",
36
36
  "@mui/icons-material": "^5.3.0",
37
37
  "@mui/material": "^5.0.6",
@@ -195,5 +195,5 @@
195
195
  "optionalDependencies": {
196
196
  "encoding": "^0.1.13"
197
197
  },
198
- "gitHead": "f495b753bb8967b19def293c0907206055b9ceb4"
198
+ "gitHead": "c7ff7e3e21c8ff5dd04661fffe36afb0154f4c95"
199
199
  }
@@ -26,22 +26,6 @@ import { WrapperModal } from '../../../WrapperModal'
26
26
 
27
27
  type LoadingType = 'verificationStatus' | 'startKYC' | 'approveLender'
28
28
 
29
- const LoadingCopiesByType: {
30
- [key: string]: {
31
- description: string
32
- }
33
- } = {
34
- verificationStatus: {
35
- description: `Checking your verification status...`,
36
- },
37
- startKYC: {
38
- description: `Starting KYC/KYB...`,
39
- },
40
- approveLender: {
41
- description: `Approving as lender...`,
42
- },
43
- }
44
-
45
29
  type Props = {
46
30
  poolInfo: PoolInfoV2
47
31
  isUniTranche: boolean
@@ -77,6 +61,7 @@ export function PersonaEvaluation({
77
61
  const [verificationStatus, setVerificationStatus] =
78
62
  useState<VerificationStatusResultV2>()
79
63
  const [showPersonaClient, setShowPersonaClient] = useState<boolean>(false)
64
+ const [KYCAutoStarted, setKYCAutoStarted] = useState<boolean>(false)
80
65
  const isKYCCompletedRef = useRef<boolean>(false)
81
66
  const isActionOngoingRef = useRef<boolean>(false)
82
67
  const isKYCResumedRef = useRef<boolean>(false)
@@ -336,6 +321,7 @@ export function PersonaEvaluation({
336
321
  isActionOngoingRef.current = false
337
322
  setShowPersonaClient(false)
338
323
  setLoadingType(undefined)
324
+ handleClose()
339
325
  },
340
326
  onError: () => {
341
327
  isActionOngoingRef.current = false
@@ -343,24 +329,29 @@ export function PersonaEvaluation({
343
329
  setLoadingType(undefined)
344
330
  },
345
331
  })
346
- }, [checkVerificationStatus, inquiryId, sessionToken])
332
+ }, [checkVerificationStatus, handleClose, inquiryId, sessionToken])
347
333
 
348
- // Start KYC flow directly
334
+ // Start KYC flow directly for the first time
349
335
  useEffect(() => {
350
- if (verificationStatus) {
336
+ if (isActionOngoingRef.current || isKYCResumedRef.current) {
337
+ return
338
+ }
339
+ if (verificationStatus && !KYCAutoStarted) {
351
340
  switch (verificationStatus.status) {
352
341
  case IdentityVerificationStatusV2.ACCREDITED:
353
342
  case IdentityVerificationStatusV2.CREATED:
354
343
  case IdentityVerificationStatusV2.PENDING:
355
- case IdentityVerificationStatusV2.EXPIRED:
344
+ case IdentityVerificationStatusV2.EXPIRED: {
356
345
  startKYC()
346
+ setKYCAutoStarted(true)
357
347
  break
348
+ }
358
349
 
359
350
  default:
360
351
  break
361
352
  }
362
353
  }
363
- }, [startKYC, verificationStatus])
354
+ }, [KYCAutoStarted, startKYC, verificationStatus])
364
355
 
365
356
  const handleAction = () => {
366
357
  if (verificationStatus) {
@@ -438,7 +429,7 @@ export function PersonaEvaluation({
438
429
  return (
439
430
  <LoadingModal
440
431
  title='Lender Approval'
441
- description={LoadingCopiesByType[loadingType].description}
432
+ description='Checking your verification status...'
442
433
  />
443
434
  )
444
435
  }