@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/cjs/index.cjs
CHANGED
|
@@ -5620,8 +5620,9 @@ function PersonaEvaluation(_ref) {
|
|
|
5620
5620
|
case shared.IdentityVerificationStatusV2.NOT_STARTED:
|
|
5621
5621
|
{
|
|
5622
5622
|
const startVerificationResult = await shared.IdentityServiceV2.startVerification(account, chainId, isDev);
|
|
5623
|
+
const isVerificationBypassed = startVerificationResult.status === shared.IdentityVerificationStatusV2.BYPASSED;
|
|
5623
5624
|
setInquiryId(startVerificationResult.personaInquiryId);
|
|
5624
|
-
setKYCCopy(KYCCopies.verifyIdentity);
|
|
5625
|
+
setKYCCopy(isVerificationBypassed ? KYCCopies.verificationBypassed : KYCCopies.verifyIdentity);
|
|
5625
5626
|
setLoadingType(undefined);
|
|
5626
5627
|
break;
|
|
5627
5628
|
}
|
|
@@ -5727,7 +5728,7 @@ function PersonaEvaluation(_ref) {
|
|
|
5727
5728
|
modalElement.style.visibility = showPersonaClient ? 'hidden' : 'visible';
|
|
5728
5729
|
}
|
|
5729
5730
|
}, [showPersonaClient]);
|
|
5730
|
-
const startKYC = async () => {
|
|
5731
|
+
const startKYC = React.useCallback(async () => {
|
|
5731
5732
|
isActionOngoingRef.current = true;
|
|
5732
5733
|
isKYCResumedRef.current = false;
|
|
5733
5734
|
setLoadingType('startKYC');
|
|
@@ -5756,7 +5757,21 @@ function PersonaEvaluation(_ref) {
|
|
|
5756
5757
|
setLoadingType(undefined);
|
|
5757
5758
|
}
|
|
5758
5759
|
});
|
|
5759
|
-
};
|
|
5760
|
+
}, [checkVerificationStatus, inquiryId, sessionToken]);
|
|
5761
|
+
|
|
5762
|
+
// Start KYC flow directly
|
|
5763
|
+
React.useEffect(() => {
|
|
5764
|
+
if (verificationStatus) {
|
|
5765
|
+
switch (verificationStatus.status) {
|
|
5766
|
+
case shared.IdentityVerificationStatusV2.NOT_STARTED:
|
|
5767
|
+
case shared.IdentityVerificationStatusV2.CREATED:
|
|
5768
|
+
case shared.IdentityVerificationStatusV2.PENDING:
|
|
5769
|
+
case shared.IdentityVerificationStatusV2.EXPIRED:
|
|
5770
|
+
startKYC();
|
|
5771
|
+
break;
|
|
5772
|
+
}
|
|
5773
|
+
}
|
|
5774
|
+
}, [startKYC, verificationStatus]);
|
|
5760
5775
|
const handleAction = () => {
|
|
5761
5776
|
if (verificationStatus) {
|
|
5762
5777
|
switch (verificationStatus.status) {
|
|
@@ -5771,6 +5786,9 @@ function PersonaEvaluation(_ref) {
|
|
|
5771
5786
|
case shared.IdentityVerificationStatusV2.APPROVED:
|
|
5772
5787
|
handleClose(verificationStatus.status);
|
|
5773
5788
|
break;
|
|
5789
|
+
case shared.IdentityVerificationStatusV2.BYPASSED:
|
|
5790
|
+
handleClose(shared.IdentityVerificationStatusV2.APPROVED);
|
|
5791
|
+
break;
|
|
5774
5792
|
}
|
|
5775
5793
|
}
|
|
5776
5794
|
};
|
|
@@ -6121,14 +6139,24 @@ function ChooseAmount$4(_ref) {
|
|
|
6121
6139
|
const step = currentAmountBN.gt(allowance) ? WIDGET_STEP.ApproveAllowance : WIDGET_STEP.Transfer;
|
|
6122
6140
|
dispatch(setStep(step));
|
|
6123
6141
|
};
|
|
6124
|
-
const
|
|
6125
|
-
|
|
6142
|
+
const getTrancheCap = () => {
|
|
6143
|
+
if (selectedTranche === 'junior') {
|
|
6144
|
+
return juniorAvailableCapBN;
|
|
6145
|
+
}
|
|
6146
|
+
return seniorAvailableCapBN;
|
|
6147
|
+
};
|
|
6148
|
+
const getMaxAmount = () => {
|
|
6149
|
+
const trancheCap = getTrancheCap();
|
|
6126
6150
|
return balance.gt(trancheCap) ? trancheCap : balance;
|
|
6127
6151
|
};
|
|
6128
6152
|
const getInfos = () => {
|
|
6129
|
-
const
|
|
6130
|
-
const
|
|
6131
|
-
|
|
6153
|
+
const trancheCap = getTrancheCap();
|
|
6154
|
+
const currentAmountBN = ethers.ethers.utils.parseUnits(String(currentAmount), decimals);
|
|
6155
|
+
const remainingCap = trancheCap.sub(currentAmountBN);
|
|
6156
|
+
if (remainingCap.lt(0)) {
|
|
6157
|
+
return ['0 remaining capacity'];
|
|
6158
|
+
}
|
|
6159
|
+
return ["".concat(shared.formatNumber(ethers.ethers.utils.formatUnits(remainingCap, decimals)), " remaining capacity")];
|
|
6132
6160
|
};
|
|
6133
6161
|
return jsxRuntime.jsx(InputAmountModal, {
|
|
6134
6162
|
title: "Enter Amount",
|
|
@@ -6136,7 +6164,7 @@ function ChooseAmount$4(_ref) {
|
|
|
6136
6164
|
tokenSymbol: symbol,
|
|
6137
6165
|
currentAmount: currentAmount,
|
|
6138
6166
|
handleChangeAmount: handleChangeAmount,
|
|
6139
|
-
maxAmount: Number(ethers.ethers.utils.formatUnits(
|
|
6167
|
+
maxAmount: Number(ethers.ethers.utils.formatUnits(getMaxAmount(), decimals)),
|
|
6140
6168
|
maxAmountTitle: "".concat(shared.formatNumber(ethers.ethers.utils.formatUnits(balance, decimals)), " balance"),
|
|
6141
6169
|
infos: getInfos(),
|
|
6142
6170
|
handleAction: handleAction,
|