@huma-finance/widgets 0.0.61-beta.543 → 0.0.61-beta.544

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.
@@ -5544,7 +5544,6 @@ function PersonaEvaluation(_ref) {
5544
5544
  let {
5545
5545
  poolInfo,
5546
5546
  isUniTranche,
5547
- minDepositAmount: minDepositAmountBN,
5548
5547
  campaign,
5549
5548
  pointsTestnetExperience,
5550
5549
  changeTranche,
@@ -5570,7 +5569,6 @@ function PersonaEvaluation(_ref) {
5570
5569
  const [sessionToken, setSessionToken] = React.useState();
5571
5570
  const [verificationStatus, setVerificationStatus] = React.useState();
5572
5571
  const [showPersonaClient, setShowPersonaClient] = React.useState(false);
5573
- const [campaignBasePoints, setCampaignBasePoints] = React.useState(0);
5574
5572
  const isKYCCompletedRef = React.useRef(false);
5575
5573
  const isActionOngoingRef = React.useRef(false);
5576
5574
  const isKYCResumedRef = React.useRef(false);
@@ -5583,26 +5581,6 @@ function PersonaEvaluation(_ref) {
5583
5581
  };
5584
5582
  createNewWallet();
5585
5583
  }, [account, campaign, isDev, isWalletOwnershipVerified, pointsTestnetExperience]);
5586
- React.useEffect(() => {
5587
- const getBasePoints = async () => {
5588
- if (campaign) {
5589
- const estimatedPoints = await shared.CampaignService.getEstimatedPoints(campaign.campaignGroupId, minDepositAmountBN.toString(), isDev, pointsTestnetExperience);
5590
- const campaignPoints = estimatedPoints.find(item => item.campaignId === campaign.id);
5591
- if (campaignPoints) {
5592
- const {
5593
- juniorTranchePoints,
5594
- seniorTranchePoints
5595
- } = campaignPoints;
5596
- if (isUniTranche) {
5597
- setCampaignBasePoints(juniorTranchePoints !== null && juniorTranchePoints !== void 0 ? juniorTranchePoints : 0);
5598
- } else {
5599
- setCampaignBasePoints(juniorTranchePoints < seniorTranchePoints ? juniorTranchePoints : seniorTranchePoints);
5600
- }
5601
- }
5602
- }
5603
- };
5604
- getBasePoints();
5605
- }, [campaign, isDev, isUniTranche, minDepositAmountBN, pointsTestnetExperience]);
5606
5584
  const approveLender = React.useCallback(async () => {
5607
5585
  try {
5608
5586
  isActionOngoingRef.current = true;
@@ -5676,7 +5654,8 @@ function PersonaEvaluation(_ref) {
5676
5654
  }
5677
5655
  case shared.IdentityVerificationStatusV2.APPROVED:
5678
5656
  {
5679
- await approveLender();
5657
+ setKYCCopy(KYCCopies.verificationApproved);
5658
+ setLoadingType(undefined);
5680
5659
  break;
5681
5660
  }
5682
5661
  case shared.IdentityVerificationStatusV2.DECLINED:
@@ -5691,6 +5670,11 @@ function PersonaEvaluation(_ref) {
5691
5670
  setLoadingType(undefined);
5692
5671
  break;
5693
5672
  }
5673
+ case shared.IdentityVerificationStatusV2.CONSENTED_TO_SUBSCRIPTION:
5674
+ {
5675
+ await approveLender();
5676
+ break;
5677
+ }
5694
5678
  default:
5695
5679
  break;
5696
5680
  }
@@ -5745,6 +5729,7 @@ function PersonaEvaluation(_ref) {
5745
5729
  const client = new Persona__default["default"].Client({
5746
5730
  inquiryId,
5747
5731
  sessionToken,
5732
+ frameWidth: '480px',
5748
5733
  onReady: () => {
5749
5734
  client.open();
5750
5735
  setShowPersonaClient(true);
@@ -5778,7 +5763,8 @@ function PersonaEvaluation(_ref) {
5778
5763
  break;
5779
5764
  case shared.IdentityVerificationStatusV2.DECLINED:
5780
5765
  case shared.IdentityVerificationStatusV2.NEEDS_REVIEW:
5781
- handleClose();
5766
+ case shared.IdentityVerificationStatusV2.APPROVED:
5767
+ handleClose(verificationStatus.status);
5782
5768
  break;
5783
5769
  }
5784
5770
  }
@@ -5797,16 +5783,11 @@ function PersonaEvaluation(_ref) {
5797
5783
  src: ApproveLenderImg,
5798
5784
  alt: "approve-lender"
5799
5785
  })
5800
- }), campaign && kycCopy === KYCCopies.verifyIdentity ? jsxRuntime.jsxs(material.Box, {
5786
+ }), campaign && kycCopy === KYCCopies.verifyIdentity ? jsxRuntime.jsx(material.Box, {
5801
5787
  css: styles.description,
5802
- children: [jsxRuntime.jsx("span", {
5803
- children: "You'll be rewarded with a minimum of"
5804
- }), jsxRuntime.jsxs("span", {
5805
- css: styles.points,
5806
- children: [' ', shared.formatNumber(campaignBasePoints), " Huma points", ' ']
5807
- }), jsxRuntime.jsx("span", {
5808
- children: "after completing KYC and your first investment."
5809
- })]
5788
+ children: jsxRuntime.jsx("span", {
5789
+ children: "You'll be rewarded with Huma points after completing KYC/KYB and your first investment."
5790
+ })
5810
5791
  }) : jsxRuntime.jsx(material.Box, {
5811
5792
  css: styles.description,
5812
5793
  children: kycCopy.description
@@ -6061,7 +6042,6 @@ function Evaluation$1(_ref) {
6061
6042
  let {
6062
6043
  poolInfo,
6063
6044
  isUniTranche,
6064
- minDepositAmount,
6065
6045
  campaign,
6066
6046
  pointsTestnetExperience,
6067
6047
  changeTranche,
@@ -6080,7 +6060,6 @@ function Evaluation$1(_ref) {
6080
6060
  isUniTranche: isUniTranche,
6081
6061
  pointsTestnetExperience: pointsTestnetExperience,
6082
6062
  campaign: campaign,
6083
- minDepositAmount: minDepositAmount,
6084
6063
  changeTranche: changeTranche
6085
6064
  });
6086
6065
  }
@@ -6329,6 +6308,7 @@ function PointsEarned(_ref) {
6329
6308
  chainId
6330
6309
  } = core.useWeb3React();
6331
6310
  const [pointsAccumulated, setPointsAccumulated] = React.useState();
6311
+ const hasPointsAccumulated = !shared.isEmpty(pointsAccumulated) && pointsAccumulated > 0;
6332
6312
  const lockupMonths = Math.round(lpConfig.withdrawalLockoutPeriodInDays / 30);
6333
6313
  const monthText = lockupMonths > 1 ? "".concat(lockupMonths, " months") : "".concat(lockupMonths, " month");
6334
6314
  const {
@@ -6377,17 +6357,10 @@ function PointsEarned(_ref) {
6377
6357
  if (walletOwnership) {
6378
6358
  try {
6379
6359
  const result = await shared.CampaignService.updateWalletPoints(account, transactionHash, chainId, isDev, pointsTestnetExperience);
6380
- if (!result.pointsAccumulated) {
6381
- dispatch(setError({
6382
- errorMessage: ERROR_MESSAGE
6383
- }));
6384
- }
6385
6360
  setPointsAccumulated(result.pointsAccumulated);
6386
6361
  setState(STATE.Congrats);
6387
6362
  } catch (error) {
6388
- dispatch(setError({
6389
- errorMessage: ERROR_MESSAGE
6390
- }));
6363
+ console.error('Failed to update wallet points', error);
6391
6364
  }
6392
6365
  }
6393
6366
  };
@@ -6417,17 +6390,21 @@ function PointsEarned(_ref) {
6417
6390
  css: styles.ribbon,
6418
6391
  children: [jsxRuntime.jsx(RibbonIcon, {}), jsxRuntime.jsxs(material.Box, {
6419
6392
  css: styles.ribbonContent,
6420
- children: [jsxRuntime.jsx(HumaPointsIcon, {}), jsxRuntime.jsxs(material.Box, {
6421
- children: [shared.formatNumber(pointsAccumulated), " Points"]
6393
+ children: [jsxRuntime.jsx(HumaPointsIcon, {}), jsxRuntime.jsx(material.Box, {
6394
+ children: hasPointsAccumulated ? "".concat(shared.formatNumber(pointsAccumulated), " Points") : 'Points earned'
6422
6395
  })]
6423
6396
  })]
6424
- }), jsxRuntime.jsxs(material.Box, {
6397
+ }), jsxRuntime.jsx(material.Box, {
6425
6398
  css: styles.entirePoints,
6426
- children: [jsxRuntime.jsx(material.Box, {
6427
- children: "Congratulations,"
6428
- }), jsxRuntime.jsxs(material.Box, {
6429
- children: ["you've earned ", pointsAccumulated, " points"]
6430
- })]
6399
+ children: hasPointsAccumulated ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
6400
+ children: [jsxRuntime.jsx(material.Box, {
6401
+ children: "Congratulations,"
6402
+ }), jsxRuntime.jsxs(material.Box, {
6403
+ children: ["you've earned ", pointsAccumulated, " points"]
6404
+ })]
6405
+ }) : jsxRuntime.jsx(material.Box, {
6406
+ children: "Congratulations on joining the Huma Protocol!"
6407
+ })
6431
6408
  }), jsxRuntime.jsxs(material.Box, {
6432
6409
  css: styles.entirePointsDetails,
6433
6410
  children: ["You'll earn points ", jsxRuntime.jsx("span", {
@@ -6469,7 +6446,6 @@ function LendSupplyV2(_ref) {
6469
6446
  const [selectedTranche, setSelectedTranche] = React.useState();
6470
6447
  const [transactionHash, setTransactionHash] = React.useState();
6471
6448
  const poolUnderlyingToken = webShared.usePoolUnderlyingTokenInfoV2(poolName, provider);
6472
- const poolSettings = webShared.usePoolSettingsV2(poolName, provider);
6473
6449
  const lpConfig = webShared.useLPConfigV2(poolName, provider);
6474
6450
  const isUniTranche = (lpConfig === null || lpConfig === void 0 ? void 0 : lpConfig.maxSeniorJuniorRatio) === 0;
6475
6451
  const [lenderApprovedSenior] = webShared.useLenderApprovedV2(poolName, 'senior', account, provider);
@@ -6510,7 +6486,7 @@ function LendSupplyV2(_ref) {
6510
6486
  }
6511
6487
  }
6512
6488
  }, [dispatch, handleClose, isUniTranche, lenderApproveStatusFetched, lenderApprovedJunior, lenderApprovedSenior, lpConfig, poolInfo, campaign, step]);
6513
- if (!poolInfo || !poolUnderlyingToken || !lenderApproveStatusFetched || !lpConfig || !poolSettings) {
6489
+ if (!poolInfo || !poolUnderlyingToken || !lenderApproveStatusFetched || !lpConfig) {
6514
6490
  return jsxRuntime.jsx(WidgetWrapper, {
6515
6491
  isOpen: true,
6516
6492
  isLoading: true,
@@ -6534,8 +6510,7 @@ function LendSupplyV2(_ref) {
6534
6510
  isUniTranche: isUniTranche,
6535
6511
  changeTranche: setSelectedTranche,
6536
6512
  pointsTestnetExperience: pointsTestnetExperience,
6537
- campaign: campaign,
6538
- minDepositAmount: poolSettings.minDepositAmount
6513
+ campaign: campaign
6539
6514
  }), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$4, {
6540
6515
  poolInfo: poolInfo,
6541
6516
  poolUnderlyingToken: poolUnderlyingToken,