@huma-finance/widgets 0.0.61-beta.551 → 0.0.61-beta.556
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
|
@@ -5580,8 +5580,9 @@ function PersonaEvaluation(_ref) {
|
|
|
5580
5580
|
case IdentityVerificationStatusV2.NOT_STARTED:
|
|
5581
5581
|
{
|
|
5582
5582
|
const startVerificationResult = await IdentityServiceV2.startVerification(account, chainId, isDev);
|
|
5583
|
+
const isVerificationBypassed = startVerificationResult.status === IdentityVerificationStatusV2.BYPASSED;
|
|
5583
5584
|
setInquiryId(startVerificationResult.personaInquiryId);
|
|
5584
|
-
setKYCCopy(KYCCopies.verifyIdentity);
|
|
5585
|
+
setKYCCopy(isVerificationBypassed ? KYCCopies.verificationBypassed : KYCCopies.verifyIdentity);
|
|
5585
5586
|
setLoadingType(undefined);
|
|
5586
5587
|
break;
|
|
5587
5588
|
}
|
|
@@ -5687,7 +5688,7 @@ function PersonaEvaluation(_ref) {
|
|
|
5687
5688
|
modalElement.style.visibility = showPersonaClient ? 'hidden' : 'visible';
|
|
5688
5689
|
}
|
|
5689
5690
|
}, [showPersonaClient]);
|
|
5690
|
-
const startKYC = async () => {
|
|
5691
|
+
const startKYC = useCallback(async () => {
|
|
5691
5692
|
isActionOngoingRef.current = true;
|
|
5692
5693
|
isKYCResumedRef.current = false;
|
|
5693
5694
|
setLoadingType('startKYC');
|
|
@@ -5716,7 +5717,21 @@ function PersonaEvaluation(_ref) {
|
|
|
5716
5717
|
setLoadingType(undefined);
|
|
5717
5718
|
}
|
|
5718
5719
|
});
|
|
5719
|
-
};
|
|
5720
|
+
}, [checkVerificationStatus, inquiryId, sessionToken]);
|
|
5721
|
+
|
|
5722
|
+
// Start KYC flow directly
|
|
5723
|
+
useEffect(() => {
|
|
5724
|
+
if (verificationStatus) {
|
|
5725
|
+
switch (verificationStatus.status) {
|
|
5726
|
+
case IdentityVerificationStatusV2.NOT_STARTED:
|
|
5727
|
+
case IdentityVerificationStatusV2.CREATED:
|
|
5728
|
+
case IdentityVerificationStatusV2.PENDING:
|
|
5729
|
+
case IdentityVerificationStatusV2.EXPIRED:
|
|
5730
|
+
startKYC();
|
|
5731
|
+
break;
|
|
5732
|
+
}
|
|
5733
|
+
}
|
|
5734
|
+
}, [startKYC, verificationStatus]);
|
|
5720
5735
|
const handleAction = () => {
|
|
5721
5736
|
if (verificationStatus) {
|
|
5722
5737
|
switch (verificationStatus.status) {
|
|
@@ -5731,6 +5746,9 @@ function PersonaEvaluation(_ref) {
|
|
|
5731
5746
|
case IdentityVerificationStatusV2.APPROVED:
|
|
5732
5747
|
handleClose(verificationStatus.status);
|
|
5733
5748
|
break;
|
|
5749
|
+
case IdentityVerificationStatusV2.BYPASSED:
|
|
5750
|
+
handleClose(IdentityVerificationStatusV2.APPROVED);
|
|
5751
|
+
break;
|
|
5734
5752
|
}
|
|
5735
5753
|
}
|
|
5736
5754
|
};
|
|
@@ -6081,14 +6099,24 @@ function ChooseAmount$4(_ref) {
|
|
|
6081
6099
|
const step = currentAmountBN.gt(allowance) ? WIDGET_STEP.ApproveAllowance : WIDGET_STEP.Transfer;
|
|
6082
6100
|
dispatch(setStep(step));
|
|
6083
6101
|
};
|
|
6084
|
-
const
|
|
6085
|
-
|
|
6102
|
+
const getTrancheCap = () => {
|
|
6103
|
+
if (selectedTranche === 'junior') {
|
|
6104
|
+
return juniorAvailableCapBN;
|
|
6105
|
+
}
|
|
6106
|
+
return seniorAvailableCapBN;
|
|
6107
|
+
};
|
|
6108
|
+
const getMaxAmount = () => {
|
|
6109
|
+
const trancheCap = getTrancheCap();
|
|
6086
6110
|
return balance.gt(trancheCap) ? trancheCap : balance;
|
|
6087
6111
|
};
|
|
6088
6112
|
const getInfos = () => {
|
|
6089
|
-
const
|
|
6090
|
-
const
|
|
6091
|
-
|
|
6113
|
+
const trancheCap = getTrancheCap();
|
|
6114
|
+
const currentAmountBN = ethers.utils.parseUnits(String(currentAmount), decimals);
|
|
6115
|
+
const remainingCap = trancheCap.sub(currentAmountBN);
|
|
6116
|
+
if (remainingCap.lt(0)) {
|
|
6117
|
+
return ['0 remaining capacity'];
|
|
6118
|
+
}
|
|
6119
|
+
return ["".concat(formatNumber(ethers.utils.formatUnits(remainingCap, decimals)), " remaining capacity")];
|
|
6092
6120
|
};
|
|
6093
6121
|
return jsx(InputAmountModal, {
|
|
6094
6122
|
title: "Enter Amount",
|
|
@@ -6096,7 +6124,7 @@ function ChooseAmount$4(_ref) {
|
|
|
6096
6124
|
tokenSymbol: symbol,
|
|
6097
6125
|
currentAmount: currentAmount,
|
|
6098
6126
|
handleChangeAmount: handleChangeAmount,
|
|
6099
|
-
maxAmount: Number(ethers.utils.formatUnits(
|
|
6127
|
+
maxAmount: Number(ethers.utils.formatUnits(getMaxAmount(), decimals)),
|
|
6100
6128
|
maxAmountTitle: "".concat(formatNumber(ethers.utils.formatUnits(balance, decimals)), " balance"),
|
|
6101
6129
|
infos: getInfos(),
|
|
6102
6130
|
handleAction: handleAction,
|