@huma-finance/widgets 0.0.59-beta.487 → 0.0.59-beta.488
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/API.md +1 -0
- package/dist/cjs/index.cjs +1093 -323
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1094 -325
- package/dist/index.js.map +1 -1
- package/package.json +6 -4
- package/src/components/Activity.tsx +1 -2
- package/src/components/ApproveAllowanceModal.tsx +1 -1
- package/src/components/ApproveAllowanceModalV2.tsx +1 -1
- package/src/components/ChooseAmountModal.tsx +10 -8
- package/src/components/ConfirmTransferModal.tsx +3 -3
- package/src/components/CreditLine/borrow/1-Evaluation.tsx +2 -2
- package/src/components/ErrorModal.tsx +3 -10
- package/src/components/InputAmountModal.tsx +7 -5
- package/src/components/Lend/supply/1-Evaluation/EvaluationEA.tsx +1 -1
- package/src/components/Lend/supply/1-Evaluation/EvaluationKYC.tsx +1 -1
- package/src/components/Lend/supplyV2/2-Evaluation.tsx +28 -329
- package/src/components/Lend/supplyV2/3-ChooseAmount.tsx +52 -9
- package/src/components/Lend/supplyV2/6-Success.tsx +49 -6
- package/src/components/Lend/supplyV2/7-Notifications.tsx +22 -3
- package/src/components/Lend/supplyV2/8-PointsEarned.tsx +219 -0
- package/src/components/Lend/supplyV2/components/PersonaEvaluation.tsx +427 -0
- package/src/components/Lend/supplyV2/components/SecuritizeEvaluation.tsx +345 -0
- package/src/components/Lend/supplyV2/index.tsx +61 -5
- package/src/components/Lend/withdrawV2/1-ConfirmTransfer.tsx +1 -1
- package/src/components/Notifi/NotifiSubscriptionModal.tsx +1 -1
- package/src/components/SignIn.tsx +8 -3
- package/src/components/TxDoneModal.tsx +22 -3
- package/src/components/WrapperModal.tsx +1 -1
- package/src/components/humaModal/HumaModal.tsx +4 -3
- package/src/components/humaModal/HumaModalHeader.tsx +1 -0
- package/src/components/icons/congratulations.svg +54 -0
- package/src/components/icons/huma-points.svg +15 -0
- package/src/components/icons/index.tsx +15 -0
- package/src/components/icons/ribbon.svg +9 -0
- package/src/store/widgets.reducers.ts +0 -1
- package/src/store/widgets.store.ts +1 -0
- package/src/theme/components.ts +2 -1
- package/src/theme/palette.ts +7 -7
- package/src/theme/typography.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huma-finance/widgets",
|
|
3
|
-
"version": "0.0.59-beta.
|
|
3
|
+
"version": "0.0.59-beta.488+0dea268",
|
|
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.59-beta.
|
|
34
|
-
"@huma-finance/shared": "^0.0.59-beta.
|
|
33
|
+
"@huma-finance/sdk": "^0.0.59-beta.488+0dea268",
|
|
34
|
+
"@huma-finance/shared": "^0.0.59-beta.488+0dea268",
|
|
35
35
|
"@mui/icons-material": "^5.3.0",
|
|
36
36
|
"@mui/material": "^5.0.6",
|
|
37
37
|
"@mui/styles": "^5.0.2",
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
"history": "^5.3.0",
|
|
64
64
|
"jotai": "^1.13.1",
|
|
65
65
|
"moment": "^2.29.4",
|
|
66
|
+
"persona": "^5.1.0",
|
|
66
67
|
"qrcode": "^1.5.1",
|
|
67
68
|
"query-string": "^7.1.1",
|
|
68
69
|
"react": "^18.2.0",
|
|
@@ -137,6 +138,7 @@
|
|
|
137
138
|
"@typechain/ethers-v5": "^10.1.0",
|
|
138
139
|
"@types/jest": "^27.5.2",
|
|
139
140
|
"@types/node": "^17.0.45",
|
|
141
|
+
"@types/persona": "^0.0.32",
|
|
140
142
|
"@types/qrcode": "^1.5.0",
|
|
141
143
|
"@types/react": "^18.0.21",
|
|
142
144
|
"@types/react-dom": "^18.0.6",
|
|
@@ -193,5 +195,5 @@
|
|
|
193
195
|
"optionalDependencies": {
|
|
194
196
|
"encoding": "^0.1.13"
|
|
195
197
|
},
|
|
196
|
-
"gitHead": "
|
|
198
|
+
"gitHead": "0dea268b16395e79b5c9cbd96cfa66f781360935"
|
|
197
199
|
}
|
|
@@ -107,11 +107,10 @@ export function Activity({
|
|
|
107
107
|
title: css`
|
|
108
108
|
font-weight: 800;
|
|
109
109
|
font-size: 24px;
|
|
110
|
-
color:
|
|
110
|
+
color: ${theme.palette.text.primary};
|
|
111
111
|
margin-bottom: ${theme.spacing(2)};
|
|
112
112
|
`,
|
|
113
113
|
tableWrapper: css`
|
|
114
|
-
background: #ffffff;
|
|
115
114
|
box-shadow: 0px 4px 40px 8px rgba(0, 0, 0, 0.04);
|
|
116
115
|
border-radius: 24px;
|
|
117
116
|
padding: ${getPadding()};
|
|
@@ -66,7 +66,7 @@ export function ChooseAmountModal({
|
|
|
66
66
|
${theme.cssMixins.rowCentered};
|
|
67
67
|
font-weight: 400;
|
|
68
68
|
font-size: 16px;
|
|
69
|
-
color:
|
|
69
|
+
color: ${theme.palette.text.secondary};
|
|
70
70
|
margin-top: ${theme.spacing(2)};
|
|
71
71
|
`,
|
|
72
72
|
chosenAmountWrapper: css`
|
|
@@ -134,7 +134,7 @@ export function ChooseAmountModal({
|
|
|
134
134
|
margin-bottom: ${theme.spacing(7)};
|
|
135
135
|
&.MuiSlider-root {
|
|
136
136
|
height: 8px !important;
|
|
137
|
-
color:
|
|
137
|
+
color: ${theme.palette.text.primary};
|
|
138
138
|
}
|
|
139
139
|
& .MuiSlider-track {
|
|
140
140
|
height: 8px !important;
|
|
@@ -154,12 +154,11 @@ export function ChooseAmountModal({
|
|
|
154
154
|
font-weight: 400;
|
|
155
155
|
${theme.cssMixins.rowSpaceBetweened};
|
|
156
156
|
font-size: 16px;
|
|
157
|
-
color:
|
|
157
|
+
color: ${theme.palette.text.secondary};
|
|
158
158
|
`,
|
|
159
159
|
divider: css`
|
|
160
160
|
margin: ${theme.spacing(2, 0)};
|
|
161
|
-
|
|
162
|
-
border-color: #e9e3f1;
|
|
161
|
+
border-color: ${theme.palette.divider};
|
|
163
162
|
`,
|
|
164
163
|
okButton: css`
|
|
165
164
|
font-weight: 700;
|
|
@@ -171,7 +170,7 @@ export function ChooseAmountModal({
|
|
|
171
170
|
${theme.cssMixins.rowHCentered};
|
|
172
171
|
font-weight: 400;
|
|
173
172
|
font-size: 12px;
|
|
174
|
-
color:
|
|
173
|
+
color: ${theme.palette.text.secondary};
|
|
175
174
|
margin-top: ${theme.spacing(1)};
|
|
176
175
|
letter-spacing: 0px;
|
|
177
176
|
width: 100%;
|
|
@@ -188,8 +187,11 @@ export function ChooseAmountModal({
|
|
|
188
187
|
event: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>,
|
|
189
188
|
) => {
|
|
190
189
|
setInputTouched(true)
|
|
191
|
-
|
|
192
|
-
|
|
190
|
+
if (!event.target.value) {
|
|
191
|
+
handleChangeAmount(0)
|
|
192
|
+
} else {
|
|
193
|
+
handleChangeAmount(Number(event.target.value))
|
|
194
|
+
}
|
|
193
195
|
}
|
|
194
196
|
|
|
195
197
|
const handleSetMax = () => {
|
|
@@ -38,7 +38,7 @@ export function ConfirmTransferModal({
|
|
|
38
38
|
description: css`
|
|
39
39
|
font-weight: 400;
|
|
40
40
|
font-size: 16px;
|
|
41
|
-
color:
|
|
41
|
+
color: ${theme.palette.text.secondary};
|
|
42
42
|
margin-top: ${theme.spacing(4)};
|
|
43
43
|
text-align: center;
|
|
44
44
|
`,
|
|
@@ -53,7 +53,7 @@ export function ConfirmTransferModal({
|
|
|
53
53
|
background: #f9f8fa;
|
|
54
54
|
border-radius: 4px;
|
|
55
55
|
font-size: 16px;
|
|
56
|
-
color:
|
|
56
|
+
color: ${theme.palette.text.secondary};
|
|
57
57
|
padding: ${theme.spacing(3, 2)};
|
|
58
58
|
margin-bottom: ${theme.spacing(1)};
|
|
59
59
|
position: relative;
|
|
@@ -86,7 +86,7 @@ export function ConfirmTransferModal({
|
|
|
86
86
|
animation-iteration-count: infinite;
|
|
87
87
|
animation-timing-function: linear;
|
|
88
88
|
|
|
89
|
-
color:
|
|
89
|
+
color: ${theme.palette.primary.main};
|
|
90
90
|
position: absolute;
|
|
91
91
|
margin: auto;
|
|
92
92
|
top: 0;
|
|
@@ -70,7 +70,7 @@ export function Evaluation({
|
|
|
70
70
|
font-weight: 400;
|
|
71
71
|
font-size: 16px;
|
|
72
72
|
line-height: 24px;
|
|
73
|
-
color:
|
|
73
|
+
color: ${theme.palette.text.secondary};
|
|
74
74
|
margin-bottom: ${theme.spacing(8)};
|
|
75
75
|
`,
|
|
76
76
|
checkWrapper: css`
|
|
@@ -81,7 +81,7 @@ export function Evaluation({
|
|
|
81
81
|
border-radius: 4px;
|
|
82
82
|
font-weight: 400;
|
|
83
83
|
font-size: 16px;
|
|
84
|
-
color:
|
|
84
|
+
color: ${theme.palette.text.secondary};
|
|
85
85
|
`,
|
|
86
86
|
checkIcon: css`
|
|
87
87
|
${theme.cssMixins.rowCentered}
|
|
@@ -55,13 +55,6 @@ export function ErrorModal({
|
|
|
55
55
|
width: 100%;
|
|
56
56
|
display: inline-table;
|
|
57
57
|
padding: ${theme.spacing(2, 0)};
|
|
58
|
-
background: linear-gradient(
|
|
59
|
-
0deg,
|
|
60
|
-
rgba(255, 255, 255, 0.9),
|
|
61
|
-
rgba(255, 255, 255, 0.9)
|
|
62
|
-
),
|
|
63
|
-
#d32f2f;
|
|
64
|
-
border-radius: 4px;
|
|
65
58
|
position: relative;
|
|
66
59
|
margin-top: ${theme.spacing(9)};
|
|
67
60
|
height: 79px;
|
|
@@ -69,11 +62,11 @@ export function ErrorModal({
|
|
|
69
62
|
errorIcon: css`
|
|
70
63
|
position: absolute;
|
|
71
64
|
font-size: 20px;
|
|
72
|
-
color:
|
|
65
|
+
color: ${theme.palette.error.main};
|
|
73
66
|
margin: ${theme.spacing(0, 2)};
|
|
74
67
|
`,
|
|
75
68
|
messageWrapper: css`
|
|
76
|
-
color:
|
|
69
|
+
color: ${theme.palette.text.primary};
|
|
77
70
|
font-weight: 400;
|
|
78
71
|
font-size: 16px;
|
|
79
72
|
padding-left: ${theme.spacing(6)};
|
|
@@ -82,7 +75,7 @@ export function ErrorModal({
|
|
|
82
75
|
margin-top: ${theme.spacing(0.5)};
|
|
83
76
|
font-size: 14px;
|
|
84
77
|
font-weight: 400;
|
|
85
|
-
color:
|
|
78
|
+
color: ${theme.palette.text.primary};
|
|
86
79
|
cursor: pointer;
|
|
87
80
|
display: -webkit-box;
|
|
88
81
|
line-height: 16px;
|
|
@@ -77,10 +77,8 @@ export function InputAmountModal({
|
|
|
77
77
|
justify-content: center;
|
|
78
78
|
align-items: center;
|
|
79
79
|
border-radius: 32px;
|
|
80
|
-
background: #f7f1ff;
|
|
81
80
|
padding: 4px 10px;
|
|
82
81
|
gap: 8px;
|
|
83
|
-
color: #b246ff;
|
|
84
82
|
font-weight: 700;
|
|
85
83
|
font-size: 13px;
|
|
86
84
|
line-height: 22px;
|
|
@@ -88,8 +86,8 @@ export function InputAmountModal({
|
|
|
88
86
|
`,
|
|
89
87
|
info: css`
|
|
90
88
|
color: ${theme.palette.text.primary};
|
|
91
|
-
font-weight:
|
|
92
|
-
font-size:
|
|
89
|
+
font-weight: 400;
|
|
90
|
+
font-size: 16px;
|
|
93
91
|
line-height: 160%;
|
|
94
92
|
letter-spacing: 0.15px;
|
|
95
93
|
`,
|
|
@@ -133,7 +131,11 @@ export function InputAmountModal({
|
|
|
133
131
|
</Button>
|
|
134
132
|
</Box>
|
|
135
133
|
) : (
|
|
136
|
-
<Button
|
|
134
|
+
<Button
|
|
135
|
+
variant='contained'
|
|
136
|
+
css={styles.max}
|
|
137
|
+
onClick={setMaxAmount}
|
|
138
|
+
>
|
|
137
139
|
{maxAmountText}
|
|
138
140
|
</Button>
|
|
139
141
|
),
|
|
@@ -1,346 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
configUtil,
|
|
5
|
-
DocSignatureStatus,
|
|
6
|
-
IdentityService,
|
|
7
|
-
KYCCopy,
|
|
8
|
-
PoolInfoV2,
|
|
9
|
-
timeUtil,
|
|
10
|
-
useAuthErrorHandling,
|
|
11
|
-
useParamsSearch,
|
|
12
|
-
VerificationStatusResult,
|
|
13
|
-
} from '@huma-finance/shared'
|
|
14
|
-
import { Box, css, useTheme } from '@mui/material'
|
|
15
|
-
import { useWeb3React } from '@web3-react/core'
|
|
16
|
-
import React, { useCallback, useEffect, useMemo, useState } from 'react'
|
|
1
|
+
import { PoolInfoV2, TrancheType } from '@huma-finance/shared'
|
|
2
|
+
import { BigNumber } from 'ethers'
|
|
3
|
+
import React from 'react'
|
|
17
4
|
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import { HumaSnackBar } from '../../HumaSnackBar'
|
|
22
|
-
import { ApproveLenderImg } from '../../images'
|
|
23
|
-
import { LoadingModal } from '../../LoadingModal'
|
|
24
|
-
import { WrapperModal } from '../../WrapperModal'
|
|
25
|
-
|
|
26
|
-
const LoadingCopiesByType: {
|
|
27
|
-
[key: string]: {
|
|
28
|
-
description: string
|
|
29
|
-
}
|
|
30
|
-
} = {
|
|
31
|
-
verificationStatus: {
|
|
32
|
-
description: `Checking your verification status...`,
|
|
33
|
-
},
|
|
34
|
-
sendDocSignatureLink: {
|
|
35
|
-
description: `Sending signature link...`,
|
|
36
|
-
},
|
|
37
|
-
}
|
|
5
|
+
import { Campaign } from '.'
|
|
6
|
+
import { PersonaEvaluation } from './components/PersonaEvaluation'
|
|
7
|
+
import { SecuritizeEvaluation } from './components/SecuritizeEvaluation'
|
|
38
8
|
|
|
39
9
|
type Props = {
|
|
40
10
|
poolInfo: PoolInfoV2
|
|
11
|
+
isUniTranche: boolean
|
|
12
|
+
minDepositAmount: BigNumber
|
|
13
|
+
campaign?: Campaign
|
|
14
|
+
changeTranche: (tranche: TrancheType) => void
|
|
41
15
|
handleClose: () => void
|
|
42
16
|
}
|
|
43
17
|
|
|
44
18
|
export function Evaluation({
|
|
45
19
|
poolInfo,
|
|
20
|
+
isUniTranche,
|
|
21
|
+
minDepositAmount,
|
|
22
|
+
campaign,
|
|
23
|
+
changeTranche,
|
|
46
24
|
handleClose,
|
|
47
25
|
}: Props): React.ReactElement | null {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const { kycProvider, code, kycPool } = useParamsSearch()
|
|
53
|
-
const {
|
|
54
|
-
isWalletOwnershipVerified,
|
|
55
|
-
setError: setAuthError,
|
|
56
|
-
error: authError,
|
|
57
|
-
} = useAuthErrorHandling(isDev)
|
|
58
|
-
const [loadingType, setLoadingType] = useState<
|
|
59
|
-
'verificationStatus' | 'sendDocSignatureLink'
|
|
60
|
-
>()
|
|
61
|
-
const KYCCopies = poolInfo.KYC!
|
|
62
|
-
const [kycCopy, setKYCCopy] = useState<KYCCopy>(KYCCopies.verifyIdentity)
|
|
63
|
-
const [KYCVerifyStatus, setKYCVerifyStatus] =
|
|
64
|
-
useState<VerificationStatusResult>()
|
|
65
|
-
const [docSignatureStatus, setDocSignatureStatus] =
|
|
66
|
-
useState<DocSignatureStatus['status']>()
|
|
67
|
-
const docSignatureCompleted = docSignatureStatus === 'completed'
|
|
68
|
-
const [openSnackBar, setOpenSnackBar] = useState<boolean>(false)
|
|
69
|
-
|
|
70
|
-
const styles = {
|
|
71
|
-
iconWrapper: css`
|
|
72
|
-
${theme.cssMixins.rowCentered};
|
|
73
|
-
margin-top: ${theme.spacing(8)};
|
|
74
|
-
& > img {
|
|
75
|
-
width: 144px;
|
|
76
|
-
}
|
|
77
|
-
`,
|
|
78
|
-
description: css`
|
|
79
|
-
${theme.cssMixins.rowCentered};
|
|
80
|
-
margin-top: ${theme.spacing(10)};
|
|
81
|
-
padding: ${theme.spacing(0, 2)};
|
|
82
|
-
font-weight: 400;
|
|
83
|
-
font-size: 16px;
|
|
84
|
-
color: #a8a1b2;
|
|
85
|
-
`,
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const { envelopeKey, envelopeLastQueryTimeKey, envelopeDocuSignStatusKey } =
|
|
89
|
-
useMemo(() => {
|
|
90
|
-
const envelopeKey = `${poolInfo.pool.toLowerCase()}-${account?.toLowerCase()}`
|
|
91
|
-
const envelopeLastQueryTimeKey = `${envelopeKey}-last-query-time`
|
|
92
|
-
const envelopeDocuSignStatusKey = `${envelopeKey}-docuSign-status`
|
|
93
|
-
return {
|
|
94
|
-
envelopeKey,
|
|
95
|
-
envelopeLastQueryTimeKey,
|
|
96
|
-
envelopeDocuSignStatusKey,
|
|
97
|
-
}
|
|
98
|
-
}, [account, poolInfo.pool])
|
|
99
|
-
|
|
100
|
-
// DocuSign GET requests to any specific URL can be called not more often than once every 15 minutes.
|
|
101
|
-
// https://developers.docusign.com/platform/api-guidelines/#:~:text=Polling,not%20once%20every%2010%20minutes
|
|
102
|
-
const checkGetDocSignatureStatusIsAvailable = useCallback(() => {
|
|
103
|
-
const lastQueryTime = localStorage.getItem(envelopeLastQueryTimeKey)
|
|
104
|
-
if (!lastQueryTime) {
|
|
105
|
-
return true
|
|
106
|
-
}
|
|
107
|
-
const lastQueryTimeNumber = Number(lastQueryTime)
|
|
108
|
-
const now = timeUtil.getUnixTimestamp()
|
|
109
|
-
const diff = now - lastQueryTimeNumber
|
|
110
|
-
const fifteenMinutes = 15 * 60
|
|
111
|
-
return diff > fifteenMinutes
|
|
112
|
-
}, [envelopeLastQueryTimeKey])
|
|
113
|
-
|
|
114
|
-
useEffect(() => {
|
|
115
|
-
setKYCCopy(KYCCopies.verifyIdentity)
|
|
116
|
-
const docuSignStatus = localStorage.getItem(envelopeDocuSignStatusKey)
|
|
117
|
-
setDocSignatureStatus(docuSignStatus as DocSignatureStatus['status'])
|
|
118
|
-
if (docuSignStatus === 'completed') {
|
|
119
|
-
setKYCCopy(KYCCopies.docUnderReview)
|
|
120
|
-
return
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const fetchData = async () => {
|
|
124
|
-
try {
|
|
125
|
-
if (kycProvider && kycPool && account && chainId) {
|
|
126
|
-
setLoadingType('verificationStatus')
|
|
127
|
-
await IdentityService.onboard(
|
|
128
|
-
account,
|
|
129
|
-
code as string,
|
|
130
|
-
kycPool as string,
|
|
131
|
-
chainId,
|
|
132
|
-
isDev,
|
|
133
|
-
)
|
|
134
|
-
}
|
|
135
|
-
} catch (e) {
|
|
136
|
-
try {
|
|
137
|
-
setAuthError(e)
|
|
138
|
-
setKYCCopy(KYCCopies.signInRequired)
|
|
139
|
-
} catch (e) {
|
|
140
|
-
// The repeated call will throw an error of 401, so we can ignore it.
|
|
141
|
-
console.log(e)
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
try {
|
|
146
|
-
if (account && chainId) {
|
|
147
|
-
setLoadingType('verificationStatus')
|
|
148
|
-
const verificationStatus =
|
|
149
|
-
await IdentityService.getVerificationStatus(
|
|
150
|
-
account,
|
|
151
|
-
poolInfo.pool,
|
|
152
|
-
chainId,
|
|
153
|
-
isDev,
|
|
154
|
-
)
|
|
155
|
-
setKYCVerifyStatus(verificationStatus)
|
|
156
|
-
if (verificationStatus.isVerified) {
|
|
157
|
-
const envelopeId = localStorage.getItem(envelopeKey)
|
|
158
|
-
if (!envelopeId) {
|
|
159
|
-
setKYCCopy(KYCCopies.emailSignatureLink)
|
|
160
|
-
} else if (!checkGetDocSignatureStatusIsAvailable()) {
|
|
161
|
-
setKYCCopy(KYCCopies.resendSignatureLink)
|
|
162
|
-
} else {
|
|
163
|
-
const { status } = await IdentityService.getDocSignatureStatus(
|
|
164
|
-
envelopeId,
|
|
165
|
-
chainId,
|
|
166
|
-
isDev,
|
|
167
|
-
)
|
|
168
|
-
localStorage.setItem(
|
|
169
|
-
envelopeLastQueryTimeKey,
|
|
170
|
-
String(timeUtil.getUnixTimestamp()),
|
|
171
|
-
)
|
|
172
|
-
localStorage.setItem(envelopeDocuSignStatusKey, status)
|
|
173
|
-
setDocSignatureStatus(status)
|
|
174
|
-
if (status === 'completed') {
|
|
175
|
-
setKYCCopy(KYCCopies.docUnderReview)
|
|
176
|
-
// For voided and declined status, we need to send a new link
|
|
177
|
-
} else if (['voided', 'declined'].includes(status)) {
|
|
178
|
-
localStorage.removeItem(envelopeKey)
|
|
179
|
-
localStorage.removeItem(envelopeLastQueryTimeKey)
|
|
180
|
-
setKYCCopy(KYCCopies.emailSignatureLink)
|
|
181
|
-
} else {
|
|
182
|
-
setKYCCopy(KYCCopies.resendSignatureLink)
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
} else {
|
|
186
|
-
setKYCCopy(KYCCopies.verifyIdentity)
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
} catch (e: unknown) {
|
|
190
|
-
try {
|
|
191
|
-
setAuthError(e)
|
|
192
|
-
setKYCCopy(KYCCopies.signInRequired)
|
|
193
|
-
} catch (e) {
|
|
194
|
-
console.error(e)
|
|
195
|
-
dispatch(
|
|
196
|
-
setError({
|
|
197
|
-
errorMessage: 'Something went wrong, please try again later.',
|
|
198
|
-
}),
|
|
199
|
-
)
|
|
200
|
-
}
|
|
201
|
-
} finally {
|
|
202
|
-
setLoadingType(undefined)
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
fetchData()
|
|
206
|
-
}, [
|
|
207
|
-
KYCCopies.docUnderReview,
|
|
208
|
-
KYCCopies.emailSignatureLink,
|
|
209
|
-
KYCCopies.resendSignatureLink,
|
|
210
|
-
KYCCopies.signInRequired,
|
|
211
|
-
KYCCopies.verifyIdentity,
|
|
212
|
-
account,
|
|
213
|
-
chainId,
|
|
214
|
-
checkGetDocSignatureStatusIsAvailable,
|
|
215
|
-
code,
|
|
216
|
-
dispatch,
|
|
217
|
-
envelopeDocuSignStatusKey,
|
|
218
|
-
envelopeKey,
|
|
219
|
-
envelopeLastQueryTimeKey,
|
|
220
|
-
isDev,
|
|
221
|
-
kycPool,
|
|
222
|
-
kycProvider,
|
|
223
|
-
poolInfo.pool,
|
|
224
|
-
setAuthError,
|
|
225
|
-
isWalletOwnershipVerified,
|
|
226
|
-
])
|
|
227
|
-
|
|
228
|
-
useEffect(() => {
|
|
229
|
-
if (
|
|
230
|
-
authError &&
|
|
231
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
232
|
-
[4001, 'ACTION_REJECTED'].includes((authError as any).code)
|
|
233
|
-
) {
|
|
234
|
-
dispatch(
|
|
235
|
-
setError({
|
|
236
|
-
errorMessage: 'User has rejected the transaction.',
|
|
237
|
-
}),
|
|
238
|
-
)
|
|
239
|
-
}
|
|
240
|
-
}, [authError, dispatch])
|
|
241
|
-
|
|
242
|
-
const approveLender = async () => {
|
|
243
|
-
if (docSignatureCompleted) {
|
|
244
|
-
handleClose()
|
|
245
|
-
return
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
const { isNotOnboarded, isVerified } = KYCVerifyStatus || {}
|
|
249
|
-
|
|
250
|
-
if (!isVerified) {
|
|
251
|
-
const issuerId = CHAINS[chainId!].isTestnet
|
|
252
|
-
? '53a66b32-583e-40e7-ba90-baf516d2cadd'
|
|
253
|
-
: '5557baf5-d3c2-4c80-b522-c05a11c6e586'
|
|
254
|
-
const baseUrl = configUtil.getKYCProviderBaseUrl(
|
|
255
|
-
poolInfo.KYC!.provider,
|
|
256
|
-
chainId!,
|
|
257
|
-
)
|
|
258
|
-
const originUrl = window.location.href.split('?')[0]
|
|
259
|
-
const redirectUrl = `${originUrl}?poolName=${
|
|
260
|
-
poolInfo.poolName
|
|
261
|
-
}&kycProvider=${poolInfo.KYC!.provider}&kycPool=${poolInfo.pool}`
|
|
262
|
-
const providerAuthorizeUrl = `${baseUrl}/#/authorize?issuerId=${issuerId}&scope=details&details=verification&redirectUrl=${redirectUrl}`
|
|
263
|
-
window.location.href = isNotOnboarded ? providerAuthorizeUrl : baseUrl
|
|
264
|
-
} else {
|
|
265
|
-
const envelopeId = localStorage.getItem(envelopeKey)
|
|
266
|
-
try {
|
|
267
|
-
setLoadingType('sendDocSignatureLink')
|
|
268
|
-
if (!envelopeId) {
|
|
269
|
-
const { envelopeId } = await IdentityService.requestDocSignature(
|
|
270
|
-
account!,
|
|
271
|
-
chainId!,
|
|
272
|
-
isDev,
|
|
273
|
-
)
|
|
274
|
-
localStorage.setItem(envelopeKey, envelopeId)
|
|
275
|
-
localStorage.setItem(
|
|
276
|
-
envelopeLastQueryTimeKey,
|
|
277
|
-
String(timeUtil.getUnixTimestamp()),
|
|
278
|
-
)
|
|
279
|
-
setOpenSnackBar(true)
|
|
280
|
-
setKYCCopy(KYCCopies.resendSignatureLink)
|
|
281
|
-
} else {
|
|
282
|
-
await IdentityService.resendDocSignatureLink(
|
|
283
|
-
envelopeId,
|
|
284
|
-
chainId!,
|
|
285
|
-
isDev,
|
|
286
|
-
)
|
|
287
|
-
setOpenSnackBar(true)
|
|
288
|
-
}
|
|
289
|
-
} catch (e: unknown) {
|
|
290
|
-
try {
|
|
291
|
-
const { envelopeId } = await IdentityService.requestDocSignature(
|
|
292
|
-
account!,
|
|
293
|
-
chainId!,
|
|
294
|
-
isDev,
|
|
295
|
-
)
|
|
296
|
-
localStorage.setItem(envelopeKey, envelopeId)
|
|
297
|
-
localStorage.setItem(
|
|
298
|
-
envelopeLastQueryTimeKey,
|
|
299
|
-
String(timeUtil.getUnixTimestamp()),
|
|
300
|
-
)
|
|
301
|
-
setOpenSnackBar(true)
|
|
302
|
-
setKYCCopy(KYCCopies.resendSignatureLink)
|
|
303
|
-
} catch (e) {
|
|
304
|
-
setAuthError(e)
|
|
305
|
-
setKYCCopy(KYCCopies.signInRequired)
|
|
306
|
-
}
|
|
307
|
-
} finally {
|
|
308
|
-
setLoadingType(undefined)
|
|
309
|
-
}
|
|
310
|
-
}
|
|
26
|
+
if (poolInfo.KYC?.Securitize) {
|
|
27
|
+
return (
|
|
28
|
+
<SecuritizeEvaluation poolInfo={poolInfo} handleClose={handleClose} />
|
|
29
|
+
)
|
|
311
30
|
}
|
|
312
|
-
|
|
313
|
-
const getEmailLinkSentSnackbar = () => (
|
|
314
|
-
<HumaSnackBar
|
|
315
|
-
open={openSnackBar}
|
|
316
|
-
title='Signature Link Sent'
|
|
317
|
-
message='The secure signature session link has been sent to you via email.'
|
|
318
|
-
severity='success'
|
|
319
|
-
onClose={() => setOpenSnackBar(false)}
|
|
320
|
-
/>
|
|
321
|
-
)
|
|
322
|
-
|
|
323
|
-
if (!loadingType) {
|
|
31
|
+
if (poolInfo.KYC?.Persona) {
|
|
324
32
|
return (
|
|
325
|
-
<
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
{
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
</BottomButton>
|
|
334
|
-
)}
|
|
335
|
-
{getEmailLinkSentSnackbar()}
|
|
336
|
-
</WrapperModal>
|
|
33
|
+
<PersonaEvaluation
|
|
34
|
+
poolInfo={poolInfo}
|
|
35
|
+
handleClose={handleClose}
|
|
36
|
+
isUniTranche={isUniTranche}
|
|
37
|
+
campaign={campaign}
|
|
38
|
+
minDepositAmount={minDepositAmount}
|
|
39
|
+
changeTranche={changeTranche}
|
|
40
|
+
/>
|
|
337
41
|
)
|
|
338
42
|
}
|
|
339
43
|
|
|
340
|
-
return
|
|
341
|
-
<LoadingModal
|
|
342
|
-
title='Lender Approval'
|
|
343
|
-
description={LoadingCopiesByType[loadingType].description}
|
|
344
|
-
/>
|
|
345
|
-
)
|
|
44
|
+
return null
|
|
346
45
|
}
|