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

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.
@@ -1814,8 +1814,8 @@ function ViewOnExplorer(_ref) {
1814
1814
  if (!link) {
1815
1815
  return null;
1816
1816
  }
1817
- return jsxRuntime.jsx(material.Button, {
1818
- variant: "outlined",
1817
+ return jsxRuntime.jsx(BottomButton, {
1818
+ variant: "contained",
1819
1819
  onClick: () => shared.openInNewTab(link),
1820
1820
  children: jsxRuntime.jsx(material.Box, {
1821
1821
  component: "span",
@@ -3646,10 +3646,6 @@ function ChooseAmount$9(_ref) {
3646
3646
  } = webShared.usePoolSafeAllowanceV2(poolInfo.poolName, account, provider);
3647
3647
  const totalDueAmount = Number(ethers.ethers.utils.formatUnits(totalDueAmountBN, decimals));
3648
3648
  const payoffAmount = Number(ethers.ethers.utils.formatUnits(payoffAmountBN, decimals));
3649
- console.log('totalDueAmountBN', totalDueAmountBN.toString());
3650
- console.log('payoffAmountBN', payoffAmountBN.toString());
3651
- console.log('payoffAmount', payoffAmount);
3652
- console.log('currentAmount', currentAmount);
3653
3649
  React.useEffect(() => {
3654
3650
  setCurrentAmount(totalDueAmount);
3655
3651
  }, [totalDueAmount]);
@@ -5534,7 +5530,7 @@ const LoadingCopiesByType$1 = {
5534
5530
  description: "Checking your verification status..."
5535
5531
  },
5536
5532
  startKYC: {
5537
- description: "Starting KYC..."
5533
+ description: "Starting KYC/KYB..."
5538
5534
  },
5539
5535
  approveLender: {
5540
5536
  description: "Approving as lender..."
@@ -6291,8 +6287,8 @@ var STATE = /*#__PURE__*/function (STATE) {
6291
6287
  STATE["SignIn"] = "SignIn";
6292
6288
  STATE["Congrats"] = "Congrats";
6293
6289
  return STATE;
6294
- }(STATE || {}); // const ERROR_MESSAGE =
6295
- // 'Failed to update wallet points. Be assured that your points will be added later.'
6290
+ }(STATE || {});
6291
+ const ERROR_MESSAGE = 'Failed to update wallet points. Be assured that your points will be added later.';
6296
6292
  function PointsEarned(_ref) {
6297
6293
  let {
6298
6294
  transactionHash,
@@ -6303,6 +6299,7 @@ function PointsEarned(_ref) {
6303
6299
  const theme = material.useTheme();
6304
6300
  const isDev = shared.checkIsDev();
6305
6301
  const dispatch = reactRedux.useDispatch();
6302
+ const reset = utils.useResetAtom(webShared.txAtom);
6306
6303
  const {
6307
6304
  account,
6308
6305
  chainId
@@ -6311,84 +6308,66 @@ function PointsEarned(_ref) {
6311
6308
  const hasPointsAccumulated = !shared.isEmpty(pointsAccumulated) && pointsAccumulated > 0;
6312
6309
  const lockupMonths = Math.round(lpConfig.withdrawalLockoutPeriodInDays / 30);
6313
6310
  const monthText = lockupMonths > 1 ? "".concat(lockupMonths, " months") : "".concat(lockupMonths, " month");
6314
-
6315
- // const {
6316
- // errorType,
6317
- // setError: setAuthError,
6318
- // isWalletOwnershipVerified,
6319
- // isWalletOwnershipVerificationRequired,
6320
- // } = useAuthErrorHandling(isDev)
6321
- // const [walletOwnership, setWalletOwnership] = useState<boolean | undefined>()
6311
+ const {
6312
+ errorType,
6313
+ setError: setAuthError,
6314
+ isWalletOwnershipVerified,
6315
+ isWalletOwnershipVerificationRequired
6316
+ } = webShared.useAuthErrorHandling(isDev);
6317
+ const [walletOwnership, setWalletOwnership] = React.useState();
6322
6318
  const [state, setState] = React.useState(STATE.Loading);
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
-
6319
+ React.useEffect(() => {
6320
+ if (isWalletOwnershipVerificationRequired) {
6321
+ setState(STATE.Loading);
6322
+ }
6323
+ }, [isWalletOwnershipVerificationRequired]);
6324
+ React.useEffect(() => {
6325
+ if (isWalletOwnershipVerified) {
6326
+ setWalletOwnership(true);
6327
+ }
6328
+ }, [isWalletOwnershipVerified]);
6329
+ React.useEffect(() => {
6330
+ const checkWalletOwnership = async () => {
6331
+ const ownership = await shared.CampaignService.checkWalletOwnership(account, isDev, pointsTestnetExperience);
6332
+ setWalletOwnership(ownership);
6333
+ if (!ownership) {
6334
+ setAuthError('WalletNotSignInException');
6335
+ }
6336
+ };
6337
+ checkWalletOwnership();
6338
+ }, [account, isDev, pointsTestnetExperience, setAuthError]);
6339
+ React.useEffect(() => {
6340
+ if (errorType === 'NotSignedIn') {
6341
+ setState(STATE.SignIn);
6342
+ } else if (errorType === 'UserRejected') {
6343
+ dispatch(setError({
6344
+ errorMessage: 'User has rejected the transaction.'
6345
+ }));
6346
+ } else if (errorType === 'Other') {
6347
+ dispatch(setError({
6348
+ errorMessage: ERROR_MESSAGE
6349
+ }));
6350
+ }
6351
+ }, [dispatch, errorType]);
6369
6352
  React.useEffect(() => {
6370
6353
  const updateWalletPoints = async () => {
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);
6354
+ if (walletOwnership) {
6355
+ try {
6356
+ const result = await shared.CampaignService.updateWalletPoints(account, transactionHash, chainId, isDev, pointsTestnetExperience);
6357
+ setPointsAccumulated(result.pointsAccumulated);
6358
+ setState(STATE.Congrats);
6359
+ } catch (error) {
6360
+ console.error('Failed to update wallet points', error);
6361
+ }
6385
6362
  }
6386
- // }
6387
6363
  };
6388
6364
  updateWalletPoints();
6389
- }, [account, chainId, dispatch, isDev, pointsTestnetExperience, transactionHash
6390
- // walletOwnership,
6391
- ]);
6365
+ }, [account, chainId, dispatch, isDev, pointsTestnetExperience, transactionHash, walletOwnership]);
6366
+ const handleCloseModal = React.useCallback(() => {
6367
+ reset();
6368
+ dispatch(resetState());
6369
+ handleAction();
6370
+ }, [dispatch, handleAction, reset]);
6392
6371
  const styles = {
6393
6372
  wrapper: material.css(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteral(["\n height: 518px;\n position: relative;\n "]))),
6394
6373
  congrats: material.css(_templateObject2$6 || (_templateObject2$6 = _taggedTemplateLiteral(["\n margin: ", ";\n "])), theme.spacing(-4, -4.5, 0, -4.5)),
@@ -6436,7 +6415,7 @@ function PointsEarned(_ref) {
6436
6415
  }), " for", ' ', monthText, " straight. Plus, If you keep your investment till after", ' ', monthText, ", you\u2019ll gain extra points daily."]
6437
6416
  }), jsxRuntime.jsx(BottomButton, {
6438
6417
  variant: "contained",
6439
- onClick: handleAction,
6418
+ onClick: handleCloseModal,
6440
6419
  children: "GREAT"
6441
6420
  })]
6442
6421
  });