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

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
  }
@@ -6312,8 +6291,8 @@ var STATE = /*#__PURE__*/function (STATE) {
6312
6291
  STATE["SignIn"] = "SignIn";
6313
6292
  STATE["Congrats"] = "Congrats";
6314
6293
  return STATE;
6315
- }(STATE || {});
6316
- const ERROR_MESSAGE = 'Failed to update wallet points. Be assured that your points will be added later.';
6294
+ }(STATE || {}); // const ERROR_MESSAGE =
6295
+ // 'Failed to update wallet points. Be assured that your points will be added later.'
6317
6296
  function PointsEarned(_ref) {
6318
6297
  let {
6319
6298
  transactionHash,
@@ -6329,70 +6308,87 @@ 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
- const {
6335
- errorType,
6336
- setError: setAuthError,
6337
- isWalletOwnershipVerified,
6338
- isWalletOwnershipVerificationRequired
6339
- } = webShared.useAuthErrorHandling(isDev);
6340
- const [walletOwnership, setWalletOwnership] = React.useState();
6314
+
6315
+ // const {
6316
+ // errorType,
6317
+ // setError: setAuthError,
6318
+ // isWalletOwnershipVerified,
6319
+ // isWalletOwnershipVerificationRequired,
6320
+ // } = useAuthErrorHandling(isDev)
6321
+ // const [walletOwnership, setWalletOwnership] = useState<boolean | undefined>()
6341
6322
  const [state, setState] = React.useState(STATE.Loading);
6342
- React.useEffect(() => {
6343
- if (isWalletOwnershipVerificationRequired) {
6344
- setState(STATE.Loading);
6345
- }
6346
- }, [isWalletOwnershipVerificationRequired]);
6347
- React.useEffect(() => {
6348
- if (isWalletOwnershipVerified) {
6349
- setWalletOwnership(true);
6350
- }
6351
- }, [isWalletOwnershipVerified]);
6352
- React.useEffect(() => {
6353
- const checkWalletOwnership = async () => {
6354
- const ownership = await shared.CampaignService.checkWalletOwnership(account, isDev, pointsTestnetExperience);
6355
- setWalletOwnership(ownership);
6356
- if (!ownership) {
6357
- setAuthError('WalletNotSignInException');
6358
- }
6359
- };
6360
- checkWalletOwnership();
6361
- }, [account, isDev, pointsTestnetExperience, setAuthError]);
6362
- React.useEffect(() => {
6363
- if (errorType === 'NotSignedIn') {
6364
- setState(STATE.SignIn);
6365
- } else if (errorType === 'UserRejected') {
6366
- dispatch(setError({
6367
- errorMessage: 'User has rejected the transaction.'
6368
- }));
6369
- } else if (errorType === 'Other') {
6370
- dispatch(setError({
6371
- errorMessage: ERROR_MESSAGE
6372
- }));
6373
- }
6374
- }, [dispatch, errorType]);
6323
+
6324
+ // useEffect(() => {
6325
+ // if (isWalletOwnershipVerificationRequired) {
6326
+ // setState(STATE.Loading)
6327
+ // }
6328
+ // }, [isWalletOwnershipVerificationRequired])
6329
+
6330
+ // useEffect(() => {
6331
+ // if (isWalletOwnershipVerified) {
6332
+ // setWalletOwnership(true)
6333
+ // }
6334
+ // }, [isWalletOwnershipVerified])
6335
+
6336
+ // useEffect(() => {
6337
+ // const checkWalletOwnership = async () => {
6338
+ // const ownership = await CampaignService.checkWalletOwnership(
6339
+ // account!,
6340
+ // isDev,
6341
+ // pointsTestnetExperience,
6342
+ // )
6343
+ // setWalletOwnership(ownership)
6344
+ // if (!ownership) {
6345
+ // setAuthError('WalletNotSignInException')
6346
+ // }
6347
+ // }
6348
+ // checkWalletOwnership()
6349
+ // }, [account, isDev, pointsTestnetExperience, setAuthError])
6350
+
6351
+ // useEffect(() => {
6352
+ // if (errorType === 'NotSignedIn') {
6353
+ // setState(STATE.SignIn)
6354
+ // } else if (errorType === 'UserRejected') {
6355
+ // dispatch(
6356
+ // setError({
6357
+ // errorMessage: 'User has rejected the transaction.',
6358
+ // }),
6359
+ // )
6360
+ // } else if (errorType === 'Other') {
6361
+ // dispatch(
6362
+ // setError({
6363
+ // errorMessage: ERROR_MESSAGE,
6364
+ // }),
6365
+ // )
6366
+ // }
6367
+ // }, [dispatch, errorType])
6368
+
6375
6369
  React.useEffect(() => {
6376
6370
  const updateWalletPoints = async () => {
6377
- if (walletOwnership) {
6378
- try {
6379
- 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
- setPointsAccumulated(result.pointsAccumulated);
6386
- setState(STATE.Congrats);
6387
- } catch (error) {
6388
- dispatch(setError({
6389
- errorMessage: ERROR_MESSAGE
6390
- }));
6391
- }
6371
+ // if (walletOwnership) {
6372
+ try {
6373
+ // const result = await CampaignService.updateWalletPoints(
6374
+ // account!,
6375
+ // transactionHash,
6376
+ // chainId!,
6377
+ // isDev,
6378
+ // pointsTestnetExperience,
6379
+ // )
6380
+ // setPointsAccumulated(result.pointsAccumulated)
6381
+ setPointsAccumulated(5000);
6382
+ setState(STATE.Congrats);
6383
+ } catch (error) {
6384
+ console.error('Failed to update wallet points', error);
6392
6385
  }
6386
+ // }
6393
6387
  };
6394
6388
  updateWalletPoints();
6395
- }, [account, chainId, dispatch, isDev, pointsTestnetExperience, transactionHash, walletOwnership]);
6389
+ }, [account, chainId, dispatch, isDev, pointsTestnetExperience, transactionHash
6390
+ // walletOwnership,
6391
+ ]);
6396
6392
  const styles = {
6397
6393
  wrapper: material.css(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteral(["\n height: 518px;\n position: relative;\n "]))),
6398
6394
  congrats: material.css(_templateObject2$6 || (_templateObject2$6 = _taggedTemplateLiteral(["\n margin: ", ";\n "])), theme.spacing(-4, -4.5, 0, -4.5)),
@@ -6417,17 +6413,21 @@ function PointsEarned(_ref) {
6417
6413
  css: styles.ribbon,
6418
6414
  children: [jsxRuntime.jsx(RibbonIcon, {}), jsxRuntime.jsxs(material.Box, {
6419
6415
  css: styles.ribbonContent,
6420
- children: [jsxRuntime.jsx(HumaPointsIcon, {}), jsxRuntime.jsxs(material.Box, {
6421
- children: [shared.formatNumber(pointsAccumulated), " Points"]
6416
+ children: [jsxRuntime.jsx(HumaPointsIcon, {}), jsxRuntime.jsx(material.Box, {
6417
+ children: hasPointsAccumulated ? "".concat(shared.formatNumber(pointsAccumulated), " Points") : 'Points earned'
6422
6418
  })]
6423
6419
  })]
6424
- }), jsxRuntime.jsxs(material.Box, {
6420
+ }), jsxRuntime.jsx(material.Box, {
6425
6421
  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
- })]
6422
+ children: hasPointsAccumulated ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
6423
+ children: [jsxRuntime.jsx(material.Box, {
6424
+ children: "Congratulations,"
6425
+ }), jsxRuntime.jsxs(material.Box, {
6426
+ children: ["you've earned ", pointsAccumulated, " points"]
6427
+ })]
6428
+ }) : jsxRuntime.jsx(material.Box, {
6429
+ children: "Congratulations on joining the Huma Protocol!"
6430
+ })
6431
6431
  }), jsxRuntime.jsxs(material.Box, {
6432
6432
  css: styles.entirePointsDetails,
6433
6433
  children: ["You'll earn points ", jsxRuntime.jsx("span", {
@@ -6469,7 +6469,6 @@ function LendSupplyV2(_ref) {
6469
6469
  const [selectedTranche, setSelectedTranche] = React.useState();
6470
6470
  const [transactionHash, setTransactionHash] = React.useState();
6471
6471
  const poolUnderlyingToken = webShared.usePoolUnderlyingTokenInfoV2(poolName, provider);
6472
- const poolSettings = webShared.usePoolSettingsV2(poolName, provider);
6473
6472
  const lpConfig = webShared.useLPConfigV2(poolName, provider);
6474
6473
  const isUniTranche = (lpConfig === null || lpConfig === void 0 ? void 0 : lpConfig.maxSeniorJuniorRatio) === 0;
6475
6474
  const [lenderApprovedSenior] = webShared.useLenderApprovedV2(poolName, 'senior', account, provider);
@@ -6510,7 +6509,7 @@ function LendSupplyV2(_ref) {
6510
6509
  }
6511
6510
  }
6512
6511
  }, [dispatch, handleClose, isUniTranche, lenderApproveStatusFetched, lenderApprovedJunior, lenderApprovedSenior, lpConfig, poolInfo, campaign, step]);
6513
- if (!poolInfo || !poolUnderlyingToken || !lenderApproveStatusFetched || !lpConfig || !poolSettings) {
6512
+ if (!poolInfo || !poolUnderlyingToken || !lenderApproveStatusFetched || !lpConfig) {
6514
6513
  return jsxRuntime.jsx(WidgetWrapper, {
6515
6514
  isOpen: true,
6516
6515
  isLoading: true,
@@ -6534,8 +6533,7 @@ function LendSupplyV2(_ref) {
6534
6533
  isUniTranche: isUniTranche,
6535
6534
  changeTranche: setSelectedTranche,
6536
6535
  pointsTestnetExperience: pointsTestnetExperience,
6537
- campaign: campaign,
6538
- minDepositAmount: poolSettings.minDepositAmount
6536
+ campaign: campaign
6539
6537
  }), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$4, {
6540
6538
  poolInfo: poolInfo,
6541
6539
  poolUnderlyingToken: poolUnderlyingToken,