@huma-finance/widgets 0.0.41 → 0.0.42-beta.76
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/cjs/index.cjs +56 -26
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.js +57 -27
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/components/Lend/supply/1-Evaluation/EvaluationKYC.tsx +53 -20
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { txAtom, useMQ, sendTxAtom, isTxFailed, getExplorerUrl, openInNewTab, usePoolUnderlyingTokenContract, TxStateType, useMount, decodeLogs, ERC20_ABI, downScale, formatMoney, POOL_NAME, POOL_TYPE, usePoolInfo, useAccountStats, EARejectionError, EARejectMessage, EARejectReason, EAService, useCLFeeManager, useCLPoolAllowance, upScale, usePoolContract, timeUtil, getNotifiDappId, getBlockchainConfigFromChain, doesChainSupportNotifi, CreditState, toBigNumber, TRANSFER_ABI, useFeeManager, combineStyles, isEmpty, useInvoiceNFTContract, useRFPoolAllowance, useParamsSearch, IdentityService, CHAINS, configUtil, usePoolAllowance, useLenderApproved, useLenderPosition, useWithdrawlLockoutInSeconds, usePoolUnderlyingTokenBalance, useLastDepositTime, CreditEventText, useERC2612Permit, ERC2612_ABI, SuperfluidPoolProcessor_ABI, useMultiSendContract, usePoolUnderlyingToken, hasRFActiveLoan, timestampToLL, getWalletAddressAbbr, useFactoring, PoolMap, PoolSubgraphMap, CreditEvent, supportedChainId, Provider as Provider$1 } from '@huma-finance/shared';
|
|
1
|
+
import { txAtom, useMQ, sendTxAtom, isTxFailed, getExplorerUrl, openInNewTab, usePoolUnderlyingTokenContract, TxStateType, useMount, decodeLogs, ERC20_ABI, downScale, formatMoney, POOL_NAME, POOL_TYPE, usePoolInfo, useAccountStats, EARejectionError, EARejectMessage, EARejectReason, EAService, useCLFeeManager, useCLPoolAllowance, upScale, usePoolContract, timeUtil, getNotifiDappId, getBlockchainConfigFromChain, doesChainSupportNotifi, CreditState, toBigNumber, TRANSFER_ABI, useFeeManager, combineStyles, isEmpty, useInvoiceNFTContract, useRFPoolAllowance, useParamsSearch, useAuthErrorHandling, IdentityService, CHAINS, configUtil, usePoolAllowance, useLenderApproved, useLenderPosition, useWithdrawlLockoutInSeconds, usePoolUnderlyingTokenBalance, useLastDepositTime, CreditEventText, useERC2612Permit, ERC2612_ABI, SuperfluidPoolProcessor_ABI, useMultiSendContract, usePoolUnderlyingToken, hasRFActiveLoan, timestampToLL, getWalletAddressAbbr, useFactoring, PoolMap, PoolSubgraphMap, CreditEvent, supportedChainId, Provider as Provider$1 } from '@huma-finance/shared';
|
|
2
2
|
import { useTheme, css, Box, Typography, Tooltip, Button, Dialog, Slider, Input, Divider, InputAdornment, Snackbar, Alert, Skeleton, TablePagination, LinearProgress, createTheme, ThemeProvider } from '@mui/material';
|
|
3
3
|
import { useAtom, Provider as Provider$2 } from 'jotai';
|
|
4
4
|
import * as React from 'react';
|
|
@@ -4090,6 +4090,10 @@ var _templateObject$6, _templateObject2$4;
|
|
|
4090
4090
|
var KYCProvider = 'Securitize';
|
|
4091
4091
|
// TODO: Add copies for the other pools. Currently only the Jia pool is using the KYC process.
|
|
4092
4092
|
var JiaPoolCopies = {
|
|
4093
|
+
signInRequired: {
|
|
4094
|
+
title: 'Sign In',
|
|
4095
|
+
description: 'Please sign in to verify that you are the owner of the wallet.'
|
|
4096
|
+
},
|
|
4093
4097
|
verifyIdentity: {
|
|
4094
4098
|
title: 'Verify Identity',
|
|
4095
4099
|
description: "This pool is only available to accredited investors at the moment, with minimum investments of $10,000. Please complete identity verification and investor accreditation via ".concat(KYCProvider, "."),
|
|
@@ -4132,6 +4136,9 @@ function EvaluationKYC(_ref) {
|
|
|
4132
4136
|
kycProvider = _useParamsSearch.kycProvider,
|
|
4133
4137
|
code = _useParamsSearch.code,
|
|
4134
4138
|
kycPool = _useParamsSearch.kycPool;
|
|
4139
|
+
var _useAuthErrorHandling = useAuthErrorHandling(account, chainId, isDev),
|
|
4140
|
+
isWalletOwnershipVerified = _useAuthErrorHandling.isWalletOwnershipVerified,
|
|
4141
|
+
setAuthError = _useAuthErrorHandling.setError;
|
|
4135
4142
|
var _useState = useState(),
|
|
4136
4143
|
_useState2 = _slicedToArray(_useState, 2),
|
|
4137
4144
|
loadingType = _useState2[0],
|
|
@@ -4211,8 +4218,13 @@ function EvaluationKYC(_ref) {
|
|
|
4211
4218
|
case 7:
|
|
4212
4219
|
_context.prev = 7;
|
|
4213
4220
|
_context.t0 = _context["catch"](0);
|
|
4214
|
-
|
|
4215
|
-
|
|
4221
|
+
try {
|
|
4222
|
+
setAuthError(_context.t0);
|
|
4223
|
+
setKYCCopy(JiaPoolCopies.signInRequired);
|
|
4224
|
+
} catch (e) {
|
|
4225
|
+
// The repeated call will throw an error of 401, so we can ignore it.
|
|
4226
|
+
console.log(e);
|
|
4227
|
+
}
|
|
4216
4228
|
case 10:
|
|
4217
4229
|
_context.prev = 10;
|
|
4218
4230
|
if (!(account && chainId)) {
|
|
@@ -4265,34 +4277,39 @@ function EvaluationKYC(_ref) {
|
|
|
4265
4277
|
setKYCCopy(JiaPoolCopies.resendSignatureLink);
|
|
4266
4278
|
}
|
|
4267
4279
|
case 35:
|
|
4268
|
-
_context.next =
|
|
4280
|
+
_context.next = 40;
|
|
4269
4281
|
break;
|
|
4270
4282
|
case 37:
|
|
4271
4283
|
_context.prev = 37;
|
|
4272
4284
|
_context.t1 = _context["catch"](10);
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
})
|
|
4277
|
-
|
|
4278
|
-
|
|
4285
|
+
try {
|
|
4286
|
+
setAuthError(_context.t1);
|
|
4287
|
+
setKYCCopy(JiaPoolCopies.signInRequired);
|
|
4288
|
+
} catch (e) {
|
|
4289
|
+
console.error(e);
|
|
4290
|
+
dispatch(setError({
|
|
4291
|
+
errorMessage: 'Something went wrong, please try again later.'
|
|
4292
|
+
}));
|
|
4293
|
+
}
|
|
4294
|
+
case 40:
|
|
4295
|
+
_context.prev = 40;
|
|
4279
4296
|
setLoadingType(undefined);
|
|
4280
|
-
return _context.finish(
|
|
4281
|
-
case
|
|
4297
|
+
return _context.finish(40);
|
|
4298
|
+
case 43:
|
|
4282
4299
|
case "end":
|
|
4283
4300
|
return _context.stop();
|
|
4284
4301
|
}
|
|
4285
|
-
}, _callee, null, [[0, 7], [10, 37,
|
|
4302
|
+
}, _callee, null, [[0, 7], [10, 37, 40, 43]]);
|
|
4286
4303
|
}));
|
|
4287
4304
|
return function fetchData() {
|
|
4288
4305
|
return _ref2.apply(this, arguments);
|
|
4289
4306
|
};
|
|
4290
4307
|
}();
|
|
4291
4308
|
fetchData();
|
|
4292
|
-
}, [account, chainId, checkGetDocSignatureStatusIsAvailable, code, dispatch, envelopeDocuSignStatusKey, envelopeKey, envelopeLastQueryTimeKey, isDev, kycPool, kycProvider, poolInfo.pool]);
|
|
4309
|
+
}, [account, chainId, checkGetDocSignatureStatusIsAvailable, code, dispatch, envelopeDocuSignStatusKey, envelopeKey, envelopeLastQueryTimeKey, isDev, kycPool, kycProvider, poolInfo.pool, setAuthError, isWalletOwnershipVerified]);
|
|
4293
4310
|
var approveLender = /*#__PURE__*/function () {
|
|
4294
4311
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2() {
|
|
4295
|
-
var _ref4, isNotOnboarded, isVerified, issuerId, baseUrl, originUrl, redirectUrl, providerAuthorizeUrl, envelopeId, _yield$IdentityServic2, _envelopeId;
|
|
4312
|
+
var _ref4, isNotOnboarded, isVerified, issuerId, baseUrl, originUrl, redirectUrl, providerAuthorizeUrl, envelopeId, _yield$IdentityServic2, _envelopeId, _yield$IdentityServic3, _envelopeId2;
|
|
4296
4313
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
4297
4314
|
while (1) switch (_context2.prev = _context2.next) {
|
|
4298
4315
|
case 0:
|
|
@@ -4314,7 +4331,7 @@ function EvaluationKYC(_ref) {
|
|
|
4314
4331
|
redirectUrl = "".concat(originUrl, "?poolName=").concat(poolInfo.poolName, "&kycProvider=").concat(KYCProvider, "&kycPool=").concat(poolInfo.pool);
|
|
4315
4332
|
providerAuthorizeUrl = "".concat(baseUrl, "/#/authorize?issuerId=").concat(issuerId, "&scope=details&details=verification&redirectUrl=").concat(redirectUrl);
|
|
4316
4333
|
window.location.href = isNotOnboarded ? providerAuthorizeUrl : baseUrl;
|
|
4317
|
-
_context2.next =
|
|
4334
|
+
_context2.next = 52;
|
|
4318
4335
|
break;
|
|
4319
4336
|
case 13:
|
|
4320
4337
|
envelopeId = localStorage.getItem(envelopeKey);
|
|
@@ -4341,24 +4358,37 @@ function EvaluationKYC(_ref) {
|
|
|
4341
4358
|
case 29:
|
|
4342
4359
|
setOpenSnackBar(true);
|
|
4343
4360
|
case 30:
|
|
4344
|
-
_context2.next =
|
|
4361
|
+
_context2.next = 49;
|
|
4345
4362
|
break;
|
|
4346
4363
|
case 32:
|
|
4347
4364
|
_context2.prev = 32;
|
|
4348
4365
|
_context2.t0 = _context2["catch"](14);
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4366
|
+
_context2.prev = 34;
|
|
4367
|
+
_context2.next = 37;
|
|
4368
|
+
return IdentityService.requestDocSignature(account, chainId, isDev);
|
|
4369
|
+
case 37:
|
|
4370
|
+
_yield$IdentityServic3 = _context2.sent;
|
|
4371
|
+
_envelopeId2 = _yield$IdentityServic3.envelopeId;
|
|
4372
|
+
localStorage.setItem(envelopeKey, _envelopeId2);
|
|
4373
|
+
localStorage.setItem(envelopeLastQueryTimeKey, String(timeUtil.getUnixTimestamp()));
|
|
4374
|
+
setOpenSnackBar(true);
|
|
4375
|
+
setKYCCopy(JiaPoolCopies.resendSignatureLink);
|
|
4376
|
+
_context2.next = 49;
|
|
4377
|
+
break;
|
|
4378
|
+
case 45:
|
|
4379
|
+
_context2.prev = 45;
|
|
4380
|
+
_context2.t1 = _context2["catch"](34);
|
|
4381
|
+
setAuthError(_context2.t1);
|
|
4382
|
+
setKYCCopy(JiaPoolCopies.signInRequired);
|
|
4383
|
+
case 49:
|
|
4384
|
+
_context2.prev = 49;
|
|
4355
4385
|
setLoadingType(undefined);
|
|
4356
|
-
return _context2.finish(
|
|
4357
|
-
case
|
|
4386
|
+
return _context2.finish(49);
|
|
4387
|
+
case 52:
|
|
4358
4388
|
case "end":
|
|
4359
4389
|
return _context2.stop();
|
|
4360
4390
|
}
|
|
4361
|
-
}, _callee2, null, [[14, 32,
|
|
4391
|
+
}, _callee2, null, [[14, 32, 49, 52], [34, 45]]);
|
|
4362
4392
|
}));
|
|
4363
4393
|
return function approveLender() {
|
|
4364
4394
|
return _ref3.apply(this, arguments);
|
|
@@ -4387,7 +4417,7 @@ function EvaluationKYC(_ref) {
|
|
|
4387
4417
|
}), jsx(Box, {
|
|
4388
4418
|
css: styles.description,
|
|
4389
4419
|
children: kycCopy.description
|
|
4390
|
-
}), jsx(BottomButton, {
|
|
4420
|
+
}), Boolean(kycCopy.buttonText) && jsx(BottomButton, {
|
|
4391
4421
|
variant: "contained",
|
|
4392
4422
|
onClick: approveLender,
|
|
4393
4423
|
children: kycCopy.buttonText
|