@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
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CHAINS,
|
|
3
|
+
checkIsDev,
|
|
4
|
+
configUtil,
|
|
5
|
+
DocSignatureStatus,
|
|
6
|
+
IdentityService,
|
|
7
|
+
KYC_PROVIDER,
|
|
8
|
+
KYCCopy,
|
|
9
|
+
PoolInfoV2,
|
|
10
|
+
timeUtil,
|
|
11
|
+
useAuthErrorHandling,
|
|
12
|
+
useParamsSearch,
|
|
13
|
+
VerificationStatusResult,
|
|
14
|
+
} from '@huma-finance/shared'
|
|
15
|
+
import { Box, css, useTheme } from '@mui/material'
|
|
16
|
+
import { useWeb3React } from '@web3-react/core'
|
|
17
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react'
|
|
18
|
+
|
|
19
|
+
import { useAppDispatch } from '../../../../hooks/useRedux'
|
|
20
|
+
import { setError } from '../../../../store/widgets.reducers'
|
|
21
|
+
import { BottomButton } from '../../../BottomButton'
|
|
22
|
+
import { HumaSnackBar } from '../../../HumaSnackBar'
|
|
23
|
+
import { ApproveLenderImg } from '../../../images'
|
|
24
|
+
import { LoadingModal } from '../../../LoadingModal'
|
|
25
|
+
import { WrapperModal } from '../../../WrapperModal'
|
|
26
|
+
|
|
27
|
+
const LoadingCopiesByType: {
|
|
28
|
+
[key: string]: {
|
|
29
|
+
description: string
|
|
30
|
+
}
|
|
31
|
+
} = {
|
|
32
|
+
verificationStatus: {
|
|
33
|
+
description: `Checking your verification status...`,
|
|
34
|
+
},
|
|
35
|
+
sendDocSignatureLink: {
|
|
36
|
+
description: `Sending signature link...`,
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
type Props = {
|
|
41
|
+
poolInfo: PoolInfoV2
|
|
42
|
+
handleClose: () => void
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function SecuritizeEvaluation({
|
|
46
|
+
poolInfo,
|
|
47
|
+
handleClose,
|
|
48
|
+
}: Props): React.ReactElement | null {
|
|
49
|
+
const theme = useTheme()
|
|
50
|
+
const isDev = checkIsDev()
|
|
51
|
+
const dispatch = useAppDispatch()
|
|
52
|
+
const { account, chainId } = useWeb3React()
|
|
53
|
+
const { kycProvider, code, kycPool } = useParamsSearch()
|
|
54
|
+
const {
|
|
55
|
+
isWalletOwnershipVerified,
|
|
56
|
+
setError: setAuthError,
|
|
57
|
+
error: authError,
|
|
58
|
+
} = useAuthErrorHandling(isDev)
|
|
59
|
+
const [loadingType, setLoadingType] = useState<
|
|
60
|
+
'verificationStatus' | 'sendDocSignatureLink'
|
|
61
|
+
>()
|
|
62
|
+
const KYCCopies = poolInfo.KYC!.Securitize!
|
|
63
|
+
const [kycCopy, setKYCCopy] = useState<KYCCopy>(KYCCopies.verifyIdentity)
|
|
64
|
+
const [KYCVerifyStatus, setKYCVerifyStatus] =
|
|
65
|
+
useState<VerificationStatusResult>()
|
|
66
|
+
const [docSignatureStatus, setDocSignatureStatus] =
|
|
67
|
+
useState<DocSignatureStatus['status']>()
|
|
68
|
+
const docSignatureCompleted = docSignatureStatus === 'completed'
|
|
69
|
+
const [openSnackBar, setOpenSnackBar] = useState<boolean>(false)
|
|
70
|
+
|
|
71
|
+
const { envelopeKey, envelopeLastQueryTimeKey, envelopeDocuSignStatusKey } =
|
|
72
|
+
useMemo(() => {
|
|
73
|
+
const envelopeKey = `${poolInfo.pool.toLowerCase()}-${account?.toLowerCase()}`
|
|
74
|
+
const envelopeLastQueryTimeKey = `${envelopeKey}-last-query-time`
|
|
75
|
+
const envelopeDocuSignStatusKey = `${envelopeKey}-docuSign-status`
|
|
76
|
+
return {
|
|
77
|
+
envelopeKey,
|
|
78
|
+
envelopeLastQueryTimeKey,
|
|
79
|
+
envelopeDocuSignStatusKey,
|
|
80
|
+
}
|
|
81
|
+
}, [account, poolInfo.pool])
|
|
82
|
+
|
|
83
|
+
// DocuSign GET requests to any specific URL can be called not more often than once every 15 minutes.
|
|
84
|
+
// https://developers.docusign.com/platform/api-guidelines/#:~:text=Polling,not%20once%20every%2010%20minutes
|
|
85
|
+
const checkGetDocSignatureStatusIsAvailable = useCallback(() => {
|
|
86
|
+
const lastQueryTime = localStorage.getItem(envelopeLastQueryTimeKey)
|
|
87
|
+
if (!lastQueryTime) {
|
|
88
|
+
return true
|
|
89
|
+
}
|
|
90
|
+
const lastQueryTimeNumber = Number(lastQueryTime)
|
|
91
|
+
const now = timeUtil.getUnixTimestamp()
|
|
92
|
+
const diff = now - lastQueryTimeNumber
|
|
93
|
+
const fifteenMinutes = 15 * 60
|
|
94
|
+
return diff > fifteenMinutes
|
|
95
|
+
}, [envelopeLastQueryTimeKey])
|
|
96
|
+
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
setKYCCopy(KYCCopies.verifyIdentity)
|
|
99
|
+
const docuSignStatus = localStorage.getItem(envelopeDocuSignStatusKey)
|
|
100
|
+
setDocSignatureStatus(docuSignStatus as DocSignatureStatus['status'])
|
|
101
|
+
if (docuSignStatus === 'completed') {
|
|
102
|
+
setKYCCopy(KYCCopies.docUnderReview!)
|
|
103
|
+
return
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const fetchData = async () => {
|
|
107
|
+
try {
|
|
108
|
+
if (kycProvider && kycPool && account && chainId) {
|
|
109
|
+
setLoadingType('verificationStatus')
|
|
110
|
+
await IdentityService.onboard(
|
|
111
|
+
account,
|
|
112
|
+
code as string,
|
|
113
|
+
kycPool as string,
|
|
114
|
+
chainId,
|
|
115
|
+
isDev,
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
} catch (e) {
|
|
119
|
+
try {
|
|
120
|
+
setAuthError(e)
|
|
121
|
+
setKYCCopy(KYCCopies.signInRequired)
|
|
122
|
+
} catch (e) {
|
|
123
|
+
// The repeated call will throw an error of 401, so we can ignore it.
|
|
124
|
+
console.log(e)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
try {
|
|
129
|
+
if (account && chainId) {
|
|
130
|
+
setLoadingType('verificationStatus')
|
|
131
|
+
const verificationStatus =
|
|
132
|
+
await IdentityService.getVerificationStatus(
|
|
133
|
+
account,
|
|
134
|
+
poolInfo.pool,
|
|
135
|
+
chainId,
|
|
136
|
+
isDev,
|
|
137
|
+
)
|
|
138
|
+
setKYCVerifyStatus(verificationStatus)
|
|
139
|
+
if (verificationStatus.isVerified) {
|
|
140
|
+
const envelopeId = localStorage.getItem(envelopeKey)
|
|
141
|
+
if (!envelopeId) {
|
|
142
|
+
setKYCCopy(KYCCopies.emailSignatureLink!)
|
|
143
|
+
} else if (!checkGetDocSignatureStatusIsAvailable()) {
|
|
144
|
+
setKYCCopy(KYCCopies.resendSignatureLink!)
|
|
145
|
+
} else {
|
|
146
|
+
const { status } = await IdentityService.getDocSignatureStatus(
|
|
147
|
+
envelopeId,
|
|
148
|
+
chainId,
|
|
149
|
+
isDev,
|
|
150
|
+
)
|
|
151
|
+
localStorage.setItem(
|
|
152
|
+
envelopeLastQueryTimeKey,
|
|
153
|
+
String(timeUtil.getUnixTimestamp()),
|
|
154
|
+
)
|
|
155
|
+
localStorage.setItem(envelopeDocuSignStatusKey, status)
|
|
156
|
+
setDocSignatureStatus(status)
|
|
157
|
+
if (status === 'completed') {
|
|
158
|
+
setKYCCopy(KYCCopies.docUnderReview!)
|
|
159
|
+
// For voided and declined status, we need to send a new link
|
|
160
|
+
} else if (['voided', 'declined'].includes(status)) {
|
|
161
|
+
localStorage.removeItem(envelopeKey)
|
|
162
|
+
localStorage.removeItem(envelopeLastQueryTimeKey)
|
|
163
|
+
setKYCCopy(KYCCopies.emailSignatureLink!)
|
|
164
|
+
} else {
|
|
165
|
+
setKYCCopy(KYCCopies.resendSignatureLink!)
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
} else {
|
|
169
|
+
setKYCCopy(KYCCopies.verifyIdentity)
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
} catch (e: unknown) {
|
|
173
|
+
try {
|
|
174
|
+
setAuthError(e)
|
|
175
|
+
setKYCCopy(KYCCopies.signInRequired)
|
|
176
|
+
} catch (e) {
|
|
177
|
+
console.error(e)
|
|
178
|
+
dispatch(
|
|
179
|
+
setError({
|
|
180
|
+
errorMessage: 'Something went wrong, please try again later.',
|
|
181
|
+
}),
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
} finally {
|
|
185
|
+
setLoadingType(undefined)
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
fetchData()
|
|
189
|
+
}, [
|
|
190
|
+
KYCCopies.docUnderReview,
|
|
191
|
+
KYCCopies.emailSignatureLink,
|
|
192
|
+
KYCCopies.resendSignatureLink,
|
|
193
|
+
KYCCopies.signInRequired,
|
|
194
|
+
KYCCopies.verifyIdentity,
|
|
195
|
+
account,
|
|
196
|
+
chainId,
|
|
197
|
+
checkGetDocSignatureStatusIsAvailable,
|
|
198
|
+
code,
|
|
199
|
+
dispatch,
|
|
200
|
+
envelopeDocuSignStatusKey,
|
|
201
|
+
envelopeKey,
|
|
202
|
+
envelopeLastQueryTimeKey,
|
|
203
|
+
isDev,
|
|
204
|
+
kycPool,
|
|
205
|
+
kycProvider,
|
|
206
|
+
poolInfo.pool,
|
|
207
|
+
setAuthError,
|
|
208
|
+
isWalletOwnershipVerified,
|
|
209
|
+
])
|
|
210
|
+
|
|
211
|
+
useEffect(() => {
|
|
212
|
+
if (
|
|
213
|
+
authError &&
|
|
214
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
215
|
+
[4001, 'ACTION_REJECTED'].includes((authError as any).code)
|
|
216
|
+
) {
|
|
217
|
+
dispatch(
|
|
218
|
+
setError({
|
|
219
|
+
errorMessage: 'User has rejected the transaction.',
|
|
220
|
+
}),
|
|
221
|
+
)
|
|
222
|
+
}
|
|
223
|
+
}, [authError, dispatch])
|
|
224
|
+
|
|
225
|
+
const approveLender = async () => {
|
|
226
|
+
if (docSignatureCompleted) {
|
|
227
|
+
handleClose()
|
|
228
|
+
return
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const { isNotOnboarded, isVerified } = KYCVerifyStatus || {}
|
|
232
|
+
|
|
233
|
+
if (!isVerified) {
|
|
234
|
+
const issuerId = CHAINS[chainId!].isTestnet
|
|
235
|
+
? '53a66b32-583e-40e7-ba90-baf516d2cadd'
|
|
236
|
+
: '5557baf5-d3c2-4c80-b522-c05a11c6e586'
|
|
237
|
+
const baseUrl = configUtil.getKYCProviderBaseUrl(
|
|
238
|
+
KYC_PROVIDER.Securitize,
|
|
239
|
+
chainId!,
|
|
240
|
+
)
|
|
241
|
+
const originUrl = window.location.href.split('?')[0]
|
|
242
|
+
const redirectUrl = `${originUrl}?poolName=${poolInfo.poolName}&kycProvider=${KYC_PROVIDER.Securitize}&kycPool=${poolInfo.pool}`
|
|
243
|
+
const providerAuthorizeUrl = `${baseUrl}/#/authorize?issuerId=${issuerId}&scope=details&details=verification&redirectUrl=${redirectUrl}`
|
|
244
|
+
window.location.href = isNotOnboarded ? providerAuthorizeUrl : baseUrl
|
|
245
|
+
} else {
|
|
246
|
+
const envelopeId = localStorage.getItem(envelopeKey)
|
|
247
|
+
try {
|
|
248
|
+
setLoadingType('sendDocSignatureLink')
|
|
249
|
+
if (!envelopeId) {
|
|
250
|
+
const { envelopeId } = await IdentityService.requestDocSignature(
|
|
251
|
+
account!,
|
|
252
|
+
chainId!,
|
|
253
|
+
isDev,
|
|
254
|
+
)
|
|
255
|
+
localStorage.setItem(envelopeKey, envelopeId)
|
|
256
|
+
localStorage.setItem(
|
|
257
|
+
envelopeLastQueryTimeKey,
|
|
258
|
+
String(timeUtil.getUnixTimestamp()),
|
|
259
|
+
)
|
|
260
|
+
setOpenSnackBar(true)
|
|
261
|
+
setKYCCopy(KYCCopies.resendSignatureLink)
|
|
262
|
+
} else {
|
|
263
|
+
await IdentityService.resendDocSignatureLink(
|
|
264
|
+
envelopeId,
|
|
265
|
+
chainId!,
|
|
266
|
+
isDev,
|
|
267
|
+
)
|
|
268
|
+
setOpenSnackBar(true)
|
|
269
|
+
}
|
|
270
|
+
} catch (e: unknown) {
|
|
271
|
+
try {
|
|
272
|
+
const { envelopeId } = await IdentityService.requestDocSignature(
|
|
273
|
+
account!,
|
|
274
|
+
chainId!,
|
|
275
|
+
isDev,
|
|
276
|
+
)
|
|
277
|
+
localStorage.setItem(envelopeKey, envelopeId)
|
|
278
|
+
localStorage.setItem(
|
|
279
|
+
envelopeLastQueryTimeKey,
|
|
280
|
+
String(timeUtil.getUnixTimestamp()),
|
|
281
|
+
)
|
|
282
|
+
setOpenSnackBar(true)
|
|
283
|
+
setKYCCopy(KYCCopies.resendSignatureLink)
|
|
284
|
+
} catch (e) {
|
|
285
|
+
setAuthError(e)
|
|
286
|
+
setKYCCopy(KYCCopies.signInRequired)
|
|
287
|
+
}
|
|
288
|
+
} finally {
|
|
289
|
+
setLoadingType(undefined)
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const getEmailLinkSentSnackbar = () => (
|
|
295
|
+
<HumaSnackBar
|
|
296
|
+
open={openSnackBar}
|
|
297
|
+
title='Signature Link Sent'
|
|
298
|
+
message='The secure signature session link has been sent to you via email.'
|
|
299
|
+
severity='success'
|
|
300
|
+
onClose={() => setOpenSnackBar(false)}
|
|
301
|
+
/>
|
|
302
|
+
)
|
|
303
|
+
|
|
304
|
+
const styles = {
|
|
305
|
+
iconWrapper: css`
|
|
306
|
+
${theme.cssMixins.rowCentered};
|
|
307
|
+
margin-top: ${theme.spacing(8)};
|
|
308
|
+
& > img {
|
|
309
|
+
width: 144px;
|
|
310
|
+
}
|
|
311
|
+
`,
|
|
312
|
+
description: css`
|
|
313
|
+
${theme.cssMixins.rowCentered};
|
|
314
|
+
margin-top: ${theme.spacing(10)};
|
|
315
|
+
padding: ${theme.spacing(0, 2)};
|
|
316
|
+
font-weight: 400;
|
|
317
|
+
font-size: 16px;
|
|
318
|
+
color: ${theme.palette.text.primary};
|
|
319
|
+
`,
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (!loadingType) {
|
|
323
|
+
return (
|
|
324
|
+
<WrapperModal title={kycCopy.title}>
|
|
325
|
+
<Box css={styles.iconWrapper}>
|
|
326
|
+
<img src={ApproveLenderImg} alt='approve-lender' />
|
|
327
|
+
</Box>
|
|
328
|
+
<Box css={styles.description}>{kycCopy.description}</Box>
|
|
329
|
+
{Boolean(kycCopy.buttonText) && (
|
|
330
|
+
<BottomButton variant='contained' onClick={approveLender}>
|
|
331
|
+
{kycCopy.buttonText}
|
|
332
|
+
</BottomButton>
|
|
333
|
+
)}
|
|
334
|
+
{getEmailLinkSentSnackbar()}
|
|
335
|
+
</WrapperModal>
|
|
336
|
+
)
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return (
|
|
340
|
+
<LoadingModal
|
|
341
|
+
title='Lender Approval'
|
|
342
|
+
description={LoadingCopiesByType[loadingType].description}
|
|
343
|
+
/>
|
|
344
|
+
)
|
|
345
|
+
}
|
|
@@ -2,8 +2,10 @@ import {
|
|
|
2
2
|
POOL_NAME,
|
|
3
3
|
TrancheType,
|
|
4
4
|
openInNewTab,
|
|
5
|
+
useLPConfigV2,
|
|
5
6
|
useLenderApprovedV2,
|
|
6
7
|
usePoolInfoV2,
|
|
8
|
+
usePoolSettingsV2,
|
|
7
9
|
usePoolUnderlyingTokenInfoV2,
|
|
8
10
|
} from '@huma-finance/shared'
|
|
9
11
|
import { useWeb3React } from '@web3-react/core'
|
|
@@ -23,22 +25,31 @@ import { ApproveAllowance } from './4-ApproveAllowance'
|
|
|
23
25
|
import { Transfer } from './5-Transfer'
|
|
24
26
|
import { Success } from './6-Success'
|
|
25
27
|
import { Notifications } from './7-Notifications'
|
|
28
|
+
import { PointsEarned } from './8-PointsEarned'
|
|
29
|
+
|
|
30
|
+
export interface Campaign {
|
|
31
|
+
id: string
|
|
32
|
+
campaignGroupId: string
|
|
33
|
+
}
|
|
26
34
|
|
|
27
35
|
/**
|
|
28
36
|
* Lend pool supply props
|
|
29
37
|
* @typedef {Object} LendSupplyPropsV2
|
|
30
38
|
* @property {POOL_NAME} poolName The name of the pool.
|
|
39
|
+
* @property {Campaign} campaign The campaign info.
|
|
31
40
|
* @property {function():void} handleClose Function to notify to close the widget modal when user clicks the 'x' close button.
|
|
32
41
|
* @property {function((number|undefined)):void|undefined} handleSuccess Optional function to notify that the lending pool supply action is successful.
|
|
33
42
|
*/
|
|
34
43
|
export interface LendSupplyPropsV2 {
|
|
35
44
|
poolName: keyof typeof POOL_NAME
|
|
45
|
+
campaign?: Campaign
|
|
36
46
|
handleClose: () => void
|
|
37
47
|
handleSuccess?: (blockNumber?: number) => void
|
|
38
48
|
}
|
|
39
49
|
|
|
40
50
|
export function LendSupplyV2({
|
|
41
51
|
poolName: poolNameStr,
|
|
52
|
+
campaign,
|
|
42
53
|
handleClose,
|
|
43
54
|
handleSuccess,
|
|
44
55
|
}: LendSupplyPropsV2): React.ReactElement | null {
|
|
@@ -48,8 +59,11 @@ export function LendSupplyV2({
|
|
|
48
59
|
const poolInfo = usePoolInfoV2(poolName, chainId)
|
|
49
60
|
const { step, errorMessage } = useAppSelector(selectWidgetState)
|
|
50
61
|
const [selectedTranche, setSelectedTranche] = useState<TrancheType>()
|
|
62
|
+
const [transactionHash, setTransactionHash] = useState<string | undefined>()
|
|
51
63
|
const poolUnderlyingToken = usePoolUnderlyingTokenInfoV2(poolName, provider)
|
|
52
|
-
|
|
64
|
+
const poolSettings = usePoolSettingsV2(poolName, provider)
|
|
65
|
+
const lpConfig = useLPConfigV2(poolName, provider)
|
|
66
|
+
const isUniTranche = lpConfig?.maxSeniorJuniorRatio === 0
|
|
53
67
|
const [lenderApprovedSenior] = useLenderApprovedV2(
|
|
54
68
|
poolName,
|
|
55
69
|
'senior',
|
|
@@ -67,7 +81,21 @@ export function LendSupplyV2({
|
|
|
67
81
|
lenderApprovedSenior !== undefined && lenderApprovedJunior !== undefined
|
|
68
82
|
|
|
69
83
|
useEffect(() => {
|
|
70
|
-
if (!step && poolInfo && lenderApproveStatusFetched) {
|
|
84
|
+
if (!step && poolInfo && lenderApproveStatusFetched && lpConfig) {
|
|
85
|
+
if (
|
|
86
|
+
campaign &&
|
|
87
|
+
!isUniTranche &&
|
|
88
|
+
(!lenderApprovedJunior || !lenderApprovedSenior)
|
|
89
|
+
) {
|
|
90
|
+
if (poolInfo.KYC) {
|
|
91
|
+
dispatch(setStep(WIDGET_STEP.Evaluation))
|
|
92
|
+
} else if (poolInfo.supplyLink) {
|
|
93
|
+
openInNewTab(poolInfo.supplyLink)
|
|
94
|
+
handleClose()
|
|
95
|
+
}
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
|
|
71
99
|
if (lenderApprovedJunior && !lenderApprovedSenior) {
|
|
72
100
|
setSelectedTranche('junior')
|
|
73
101
|
dispatch(setStep(WIDGET_STEP.ChooseAmount))
|
|
@@ -98,14 +126,23 @@ export function LendSupplyV2({
|
|
|
98
126
|
}, [
|
|
99
127
|
dispatch,
|
|
100
128
|
handleClose,
|
|
129
|
+
isUniTranche,
|
|
101
130
|
lenderApproveStatusFetched,
|
|
102
131
|
lenderApprovedJunior,
|
|
103
132
|
lenderApprovedSenior,
|
|
133
|
+
lpConfig,
|
|
104
134
|
poolInfo,
|
|
135
|
+
campaign,
|
|
105
136
|
step,
|
|
106
137
|
])
|
|
107
138
|
|
|
108
|
-
if (
|
|
139
|
+
if (
|
|
140
|
+
!poolInfo ||
|
|
141
|
+
!poolUnderlyingToken ||
|
|
142
|
+
!lenderApproveStatusFetched ||
|
|
143
|
+
!lpConfig ||
|
|
144
|
+
!poolSettings
|
|
145
|
+
) {
|
|
109
146
|
return (
|
|
110
147
|
<WidgetWrapper
|
|
111
148
|
isOpen
|
|
@@ -132,13 +169,22 @@ export function LendSupplyV2({
|
|
|
132
169
|
/>
|
|
133
170
|
)}
|
|
134
171
|
{step === WIDGET_STEP.Evaluation && (
|
|
135
|
-
<Evaluation
|
|
172
|
+
<Evaluation
|
|
173
|
+
poolInfo={poolInfo}
|
|
174
|
+
handleClose={handleClose}
|
|
175
|
+
isUniTranche={isUniTranche}
|
|
176
|
+
changeTranche={setSelectedTranche}
|
|
177
|
+
campaign={campaign}
|
|
178
|
+
minDepositAmount={poolSettings.minDepositAmount}
|
|
179
|
+
/>
|
|
136
180
|
)}
|
|
137
181
|
{step === WIDGET_STEP.ChooseAmount && (
|
|
138
182
|
<ChooseAmount
|
|
139
183
|
poolInfo={poolInfo}
|
|
140
184
|
poolUnderlyingToken={poolUnderlyingToken}
|
|
141
185
|
selectedTranche={selectedTranche}
|
|
186
|
+
isUniTranche={isUniTranche}
|
|
187
|
+
campaign={campaign}
|
|
142
188
|
/>
|
|
143
189
|
)}
|
|
144
190
|
{step === WIDGET_STEP.ApproveAllowance && (
|
|
@@ -158,11 +204,21 @@ export function LendSupplyV2({
|
|
|
158
204
|
<Success
|
|
159
205
|
poolInfo={poolInfo}
|
|
160
206
|
poolUnderlyingToken={poolUnderlyingToken}
|
|
207
|
+
lpConfig={lpConfig}
|
|
208
|
+
campaign={campaign}
|
|
209
|
+
updateTransactionHash={setTransactionHash}
|
|
161
210
|
handleAction={handleClose}
|
|
162
211
|
/>
|
|
163
212
|
)}
|
|
164
213
|
{step === WIDGET_STEP.Notifications && (
|
|
165
|
-
<Notifications handleAction={handleClose} />
|
|
214
|
+
<Notifications campaign={campaign} handleAction={handleClose} />
|
|
215
|
+
)}
|
|
216
|
+
{step === WIDGET_STEP.PointsEarned && transactionHash && (
|
|
217
|
+
<PointsEarned
|
|
218
|
+
transactionHash={transactionHash}
|
|
219
|
+
lpConfig={lpConfig}
|
|
220
|
+
handleAction={handleClose}
|
|
221
|
+
/>
|
|
166
222
|
)}
|
|
167
223
|
{step === WIDGET_STEP.Error && (
|
|
168
224
|
<ErrorModal
|
|
@@ -2,7 +2,11 @@ import { Box, css, Typography, useTheme } from '@mui/material'
|
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import { ApproveLenderImg } from './images'
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
type Props = {
|
|
6
|
+
description?: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function SignIn({ description }: Props): React.ReactElement {
|
|
6
10
|
const theme = useTheme()
|
|
7
11
|
const styles = {
|
|
8
12
|
wrapper: css`
|
|
@@ -27,7 +31,7 @@ export function SignIn(): React.ReactElement {
|
|
|
27
31
|
font-weight: 400;
|
|
28
32
|
font-size: 16px;
|
|
29
33
|
line-height: 24px;
|
|
30
|
-
color:
|
|
34
|
+
color: ${theme.palette.text.secondary};
|
|
31
35
|
margin-bottom: ${theme.spacing(8)};
|
|
32
36
|
`,
|
|
33
37
|
}
|
|
@@ -41,7 +45,8 @@ export function SignIn(): React.ReactElement {
|
|
|
41
45
|
<img src={ApproveLenderImg} alt='approve-lender' />
|
|
42
46
|
</Box>
|
|
43
47
|
<Box css={styles.content}>
|
|
44
|
-
|
|
48
|
+
{description ??
|
|
49
|
+
'Please sign in to verify your ownership of the wallet.'}
|
|
45
50
|
</Box>
|
|
46
51
|
</Box>
|
|
47
52
|
)
|
|
@@ -9,12 +9,14 @@ import { CheckIcon } from './icons'
|
|
|
9
9
|
|
|
10
10
|
type Props = {
|
|
11
11
|
content: string[]
|
|
12
|
-
|
|
12
|
+
subContent?: string[]
|
|
13
13
|
buttonText?: string
|
|
14
|
+
handleAction: () => void
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export function TxDoneModal({
|
|
17
18
|
content,
|
|
19
|
+
subContent,
|
|
18
20
|
handleAction,
|
|
19
21
|
buttonText,
|
|
20
22
|
}: Props): React.ReactElement {
|
|
@@ -33,12 +35,20 @@ export function TxDoneModal({
|
|
|
33
35
|
`,
|
|
34
36
|
content: css`
|
|
35
37
|
${theme.cssMixins.colVCentered};
|
|
36
|
-
font-weight: 400;
|
|
38
|
+
font-weight: ${subContent ? 700 : 400};
|
|
37
39
|
font-size: 18px;
|
|
38
|
-
color:
|
|
40
|
+
color: ${theme.palette.text.secondary};
|
|
39
41
|
margin-top: ${theme.spacing(8)};
|
|
40
42
|
text-align: center;
|
|
41
43
|
`,
|
|
44
|
+
subContent: css`
|
|
45
|
+
${theme.cssMixins.colVCentered};
|
|
46
|
+
font-weight: 400;
|
|
47
|
+
font-size: 18px;
|
|
48
|
+
color: ${theme.palette.text.primary};
|
|
49
|
+
margin-top: ${theme.spacing(2)};
|
|
50
|
+
text-align: center;
|
|
51
|
+
`,
|
|
42
52
|
check: css`
|
|
43
53
|
width: 100%;
|
|
44
54
|
${theme.cssMixins.rowHCentered};
|
|
@@ -72,6 +82,15 @@ export function TxDoneModal({
|
|
|
72
82
|
</Box>
|
|
73
83
|
))}
|
|
74
84
|
</Box>
|
|
85
|
+
{subContent && (
|
|
86
|
+
<Box css={styles.subContent}>
|
|
87
|
+
{subContent.map((item) => (
|
|
88
|
+
<Box sx={{ marginTop: theme.spacing(1) }} key={item}>
|
|
89
|
+
{item}
|
|
90
|
+
</Box>
|
|
91
|
+
))}
|
|
92
|
+
</Box>
|
|
93
|
+
)}
|
|
75
94
|
<Button
|
|
76
95
|
className='transaction-done-modal-close-btn'
|
|
77
96
|
variant='contained'
|
|
@@ -3,8 +3,6 @@ import { Dialog } from '@mui/material'
|
|
|
3
3
|
import { useMQ } from '@huma-finance/shared'
|
|
4
4
|
import React from 'react'
|
|
5
5
|
|
|
6
|
-
import { white } from '../../theme/palette'
|
|
7
|
-
|
|
8
6
|
type HumaModalType = {
|
|
9
7
|
children?: React.ReactNode
|
|
10
8
|
isOpen: boolean
|
|
@@ -48,13 +46,16 @@ export function HumaModal({
|
|
|
48
46
|
|
|
49
47
|
return (
|
|
50
48
|
<Dialog
|
|
49
|
+
id='huma-modal'
|
|
51
50
|
disableScrollLock
|
|
52
51
|
maxWidth={false}
|
|
53
52
|
fullScreen={isXsSize}
|
|
54
53
|
open={isOpen}
|
|
55
54
|
PaperProps={{
|
|
56
55
|
style: {
|
|
57
|
-
|
|
56
|
+
border: '1px solid #202020',
|
|
57
|
+
background: 'rgba(255, 255, 255, 0.05)',
|
|
58
|
+
backdropFilter: 'blur(50px)',
|
|
58
59
|
borderRadius: '16px',
|
|
59
60
|
overflow: overflow || 'inherit',
|
|
60
61
|
overflowY: overflowY || 'inherit',
|