@huma-finance/widgets 0.0.48-beta.186 → 0.0.48-beta.187

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.
@@ -30,6 +30,8 @@ var TableCell = require('@mui/material/TableCell');
30
30
  var TableContainer = require('@mui/material/TableContainer');
31
31
  var TableHead = require('@mui/material/TableHead');
32
32
  var TableRow = require('@mui/material/TableRow');
33
+ var requestClient_js = require('@requestnetwork/request-client.js');
34
+ var paymentProcessor = require('@requestnetwork/payment-processor');
33
35
 
34
36
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
35
37
 
@@ -2346,7 +2348,7 @@ function TxDoneModal(_ref) {
2346
2348
  });
2347
2349
  }
2348
2350
 
2349
- function Success$7(_ref) {
2351
+ function Success$8(_ref) {
2350
2352
  var poolInfo = _ref.poolInfo,
2351
2353
  handleAction = _ref.handleAction;
2352
2354
  var _poolInfo$poolUnderly = poolInfo.poolUnderlyingToken,
@@ -2410,7 +2412,7 @@ function CreditLineApprove(_ref) {
2410
2412
  children: [step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$5, {
2411
2413
  poolInfo: poolInfo,
2412
2414
  amount: amount
2413
- }), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$7, {
2415
+ }), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$8, {
2414
2416
  poolInfo: poolInfo,
2415
2417
  handleAction: handleClose
2416
2418
  }), step === WIDGET_STEP.Error && jsxRuntime.jsx(ErrorModal, {
@@ -2514,7 +2516,7 @@ function SignIn() {
2514
2516
  }
2515
2517
 
2516
2518
  var _templateObject$b, _templateObject2$9, _templateObject3$7, _templateObject4$6, _templateObject5$3, _templateObject6$2, _templateObject7$2;
2517
- function Evaluation$3(_ref) {
2519
+ function Evaluation$4(_ref) {
2518
2520
  var poolInfo = _ref.poolInfo,
2519
2521
  handleApprove = _ref.handleApprove;
2520
2522
  var theme = material.useTheme();
@@ -2813,7 +2815,7 @@ function ChooseAmountModal(_ref) {
2813
2815
  });
2814
2816
  }
2815
2817
 
2816
- function ChooseAmount$6(_ref) {
2818
+ function ChooseAmount$7(_ref) {
2817
2819
  var poolInfo = _ref.poolInfo,
2818
2820
  accountStats = _ref.accountStats;
2819
2821
  var dispatch = useAppDispatch();
@@ -2920,7 +2922,7 @@ function TxSendModal(_ref) {
2920
2922
  });
2921
2923
  }
2922
2924
 
2923
- function Transfer$6(_ref) {
2925
+ function Transfer$7(_ref) {
2924
2926
  var poolInfo = _ref.poolInfo;
2925
2927
  var dispatch = useAppDispatch();
2926
2928
  var reset = utils.useResetAtom(shared.txAtom);
@@ -2940,7 +2942,7 @@ function Transfer$6(_ref) {
2940
2942
  });
2941
2943
  }
2942
2944
 
2943
- function Success$6(_ref) {
2945
+ function Success$7(_ref) {
2944
2946
  var poolInfo = _ref.poolInfo,
2945
2947
  creditRecord = _ref.creditRecord,
2946
2948
  handleAction = _ref.handleAction,
@@ -3413,17 +3415,17 @@ function CreditLineBorrow(_ref) {
3413
3415
  loadingTitle: "Borrow",
3414
3416
  handleClose: handleClose,
3415
3417
  handleSuccess: handleSuccess,
3416
- children: [step === WIDGET_STEP.Evaluation && jsxRuntime.jsx(Evaluation$3, {
3418
+ children: [step === WIDGET_STEP.Evaluation && jsxRuntime.jsx(Evaluation$4, {
3417
3419
  poolInfo: poolInfo,
3418
3420
  handleApprove: approveCallback
3419
- }), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$6, {
3421
+ }), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$7, {
3420
3422
  poolInfo: poolInfo,
3421
3423
  accountStats: accountStats
3422
3424
  }), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$4, {
3423
3425
  poolInfo: poolInfo
3424
- }), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$6, {
3426
+ }), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$7, {
3425
3427
  poolInfo: poolInfo
3426
- }), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$6, {
3428
+ }), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$7, {
3427
3429
  poolInfo: poolInfo,
3428
3430
  handleAction: setupNotificationsOrClose,
3429
3431
  creditRecord: creditRecord,
@@ -3438,7 +3440,7 @@ function CreditLineBorrow(_ref) {
3438
3440
  });
3439
3441
  }
3440
3442
 
3441
- function ChooseAmount$5(_ref) {
3443
+ function ChooseAmount$6(_ref) {
3442
3444
  var payoffAmount = _ref.payoffAmount,
3443
3445
  totalDueAmount = _ref.totalDueAmount,
3444
3446
  poolInfo = _ref.poolInfo;
@@ -3497,7 +3499,7 @@ function ApproveAllowance$3(_ref) {
3497
3499
  });
3498
3500
  }
3499
3501
 
3500
- function Transfer$5(_ref) {
3502
+ function Transfer$6(_ref) {
3501
3503
  var poolInfo = _ref.poolInfo;
3502
3504
  var dispatch = useAppDispatch();
3503
3505
  var _useWeb3React = core.useWeb3React(),
@@ -3517,7 +3519,7 @@ function Transfer$5(_ref) {
3517
3519
  });
3518
3520
  }
3519
3521
 
3520
- function Success$5(_ref) {
3522
+ function Success$6(_ref) {
3521
3523
  var poolInfo = _ref.poolInfo,
3522
3524
  handleAction = _ref.handleAction;
3523
3525
  var _poolInfo$poolUnderly = poolInfo.poolUnderlyingToken,
@@ -3580,15 +3582,15 @@ function CreditLinePayment(_ref) {
3580
3582
  loadingTitle: "Make Payment",
3581
3583
  handleClose: handleClose,
3582
3584
  handleSuccess: handleSuccess,
3583
- children: [step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$5, {
3585
+ children: [step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$6, {
3584
3586
  poolInfo: poolInfo,
3585
3587
  payoffAmount: payoffAmount,
3586
3588
  totalDueAmount: totalDueAmount
3587
3589
  }), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$3, {
3588
3590
  poolInfo: poolInfo
3589
- }), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$5, {
3591
+ }), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$6, {
3590
3592
  poolInfo: poolInfo
3591
- }), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$5, {
3593
+ }), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$6, {
3592
3594
  poolInfo: poolInfo,
3593
3595
  handleAction: handleClose
3594
3596
  }), step === WIDGET_STEP.Error && jsxRuntime.jsx(ErrorModal, {
@@ -3599,7 +3601,7 @@ function CreditLinePayment(_ref) {
3599
3601
  });
3600
3602
  }
3601
3603
 
3602
- function Evaluation$2(_ref) {
3604
+ function Evaluation$3(_ref) {
3603
3605
  var poolInfo = _ref.poolInfo,
3604
3606
  tokenId = _ref.tokenId;
3605
3607
  var _useEA = useEA(),
@@ -3632,7 +3634,7 @@ function Evaluation$2(_ref) {
3632
3634
  });
3633
3635
  }
3634
3636
 
3635
- function ChooseAmount$4(_ref) {
3637
+ function ChooseAmount$5(_ref) {
3636
3638
  var _receivable;
3637
3639
  var poolInfo = _ref.poolInfo,
3638
3640
  accountStats = _ref.accountStats;
@@ -3768,7 +3770,7 @@ function ConfirmTransferModal(_ref) {
3768
3770
  });
3769
3771
  }
3770
3772
 
3771
- function ConfirmTransfer$1() {
3773
+ function ConfirmTransfer$2() {
3772
3774
  var dispatch = useAppDispatch();
3773
3775
  var _useAppSelector = useAppSelector(selectWidgetState),
3774
3776
  borrowAmountNet = _useAppSelector.borrowAmountNet,
@@ -3794,7 +3796,7 @@ function ConfirmTransfer$1() {
3794
3796
  });
3795
3797
  }
3796
3798
 
3797
- function ApproveNFT(_ref) {
3799
+ function ApproveNFT$1(_ref) {
3798
3800
  var poolInfo = _ref.poolInfo,
3799
3801
  tokenId = _ref.tokenId;
3800
3802
  var dispatch = useAppDispatch();
@@ -3831,7 +3833,7 @@ function ApproveNFT(_ref) {
3831
3833
  });
3832
3834
  }
3833
3835
 
3834
- function Transfer$4(_ref) {
3836
+ function Transfer$5(_ref) {
3835
3837
  var poolInfo = _ref.poolInfo,
3836
3838
  tokenId = _ref.tokenId;
3837
3839
  var dispatch = useAppDispatch();
@@ -3851,7 +3853,7 @@ function Transfer$4(_ref) {
3851
3853
  });
3852
3854
  }
3853
3855
 
3854
- function Success$4(_ref) {
3856
+ function Success$5(_ref) {
3855
3857
  var handleAction = _ref.handleAction;
3856
3858
  var _useAppSelector = useAppSelector(selectWidgetState),
3857
3859
  borrowAmountNet = _useAppSelector.borrowAmountNet,
@@ -3892,19 +3894,19 @@ function InvoiceFactoringBorrow(_ref) {
3892
3894
  isOpen: true,
3893
3895
  handleClose: handleClose,
3894
3896
  handleSuccess: handleSuccess,
3895
- children: [step === WIDGET_STEP.Evaluation && jsxRuntime.jsx(Evaluation$2, {
3897
+ children: [step === WIDGET_STEP.Evaluation && jsxRuntime.jsx(Evaluation$3, {
3896
3898
  poolInfo: poolInfo,
3897
3899
  tokenId: tokenId.toString()
3898
- }), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$4, {
3900
+ }), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$5, {
3899
3901
  poolInfo: poolInfo,
3900
3902
  accountStats: accountStats
3901
- }), step === WIDGET_STEP.ConfirmTransfer && jsxRuntime.jsx(ConfirmTransfer$1, {}), step === WIDGET_STEP.ApproveNFT && jsxRuntime.jsx(ApproveNFT, {
3903
+ }), step === WIDGET_STEP.ConfirmTransfer && jsxRuntime.jsx(ConfirmTransfer$2, {}), step === WIDGET_STEP.ApproveNFT && jsxRuntime.jsx(ApproveNFT$1, {
3902
3904
  poolInfo: poolInfo,
3903
3905
  tokenId: tokenId.toString()
3904
- }), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$4, {
3906
+ }), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$5, {
3905
3907
  poolInfo: poolInfo,
3906
3908
  tokenId: tokenId.toString()
3907
- }), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$4, {
3909
+ }), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$5, {
3908
3910
  handleAction: handleClose
3909
3911
  }), step === WIDGET_STEP.Error && jsxRuntime.jsx(ErrorModal, {
3910
3912
  title: "Invoice Factoring",
@@ -3914,7 +3916,7 @@ function InvoiceFactoringBorrow(_ref) {
3914
3916
  });
3915
3917
  }
3916
3918
 
3917
- function ChooseAmount$3(_ref) {
3919
+ function ChooseAmount$4(_ref) {
3918
3920
  var creditRecord = _ref.creditRecord,
3919
3921
  poolInfo = _ref.poolInfo;
3920
3922
  var dispatch = useAppDispatch();
@@ -3976,7 +3978,7 @@ function ApproveAllowance$2(_ref) {
3976
3978
  });
3977
3979
  }
3978
3980
 
3979
- function Transfer$3(_ref) {
3981
+ function Transfer$4(_ref) {
3980
3982
  var poolInfo = _ref.poolInfo;
3981
3983
  var dispatch = useAppDispatch();
3982
3984
  var _useWeb3React = core.useWeb3React(),
@@ -3996,7 +3998,7 @@ function Transfer$3(_ref) {
3996
3998
  });
3997
3999
  }
3998
4000
 
3999
- function Success$3(_ref) {
4001
+ function Success$4(_ref) {
4000
4002
  var poolInfo = _ref.poolInfo,
4001
4003
  handleAction = _ref.handleAction;
4002
4004
  var symbol = poolInfo.poolUnderlyingToken.symbol;
@@ -4039,14 +4041,14 @@ function InvoiceFactoringPayment(_ref) {
4039
4041
  loadingTitle: "Make Payment",
4040
4042
  handleClose: handleClose,
4041
4043
  handleSuccess: handleSuccess,
4042
- children: [step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$3, {
4044
+ children: [step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$4, {
4043
4045
  creditRecord: creditRecord,
4044
4046
  poolInfo: poolInfo
4045
4047
  }), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$2, {
4046
4048
  poolInfo: poolInfo
4047
- }), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$3, {
4049
+ }), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$4, {
4048
4050
  poolInfo: poolInfo
4049
- }), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$3, {
4051
+ }), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$4, {
4050
4052
  poolInfo: poolInfo,
4051
4053
  handleAction: handleClose
4052
4054
  }), step === WIDGET_STEP.Error && jsxRuntime.jsx(ErrorModal, {
@@ -4530,7 +4532,7 @@ function EvaluationKYC(_ref) {
4530
4532
  });
4531
4533
  }
4532
4534
 
4533
- function Evaluation$1(_ref) {
4535
+ function Evaluation$2(_ref) {
4534
4536
  var _poolInfo$extra;
4535
4537
  var poolInfo = _ref.poolInfo,
4536
4538
  handleClose = _ref.handleClose,
@@ -4549,7 +4551,7 @@ function Evaluation$1(_ref) {
4549
4551
  });
4550
4552
  }
4551
4553
 
4552
- function ChooseAmount$2(_ref) {
4554
+ function ChooseAmount$3(_ref) {
4553
4555
  var allowance = _ref.allowance,
4554
4556
  withdrawlLockoutSeconds = _ref.withdrawlLockoutSeconds,
4555
4557
  underlyingTokenBalance = _ref.underlyingTokenBalance,
@@ -4601,7 +4603,7 @@ function ApproveAllowance$1(_ref) {
4601
4603
  });
4602
4604
  }
4603
4605
 
4604
- function Transfer$2(_ref) {
4606
+ function Transfer$3(_ref) {
4605
4607
  var poolInfo = _ref.poolInfo;
4606
4608
  var dispatch = useAppDispatch();
4607
4609
  var _useAppSelector = useAppSelector(selectWidgetState),
@@ -4619,7 +4621,7 @@ function Transfer$2(_ref) {
4619
4621
  });
4620
4622
  }
4621
4623
 
4622
- function Success$2(_ref) {
4624
+ function Success$3(_ref) {
4623
4625
  var poolInfo = _ref.poolInfo,
4624
4626
  handleAction = _ref.handleAction,
4625
4627
  hasNextStep = _ref.hasNextStep;
@@ -4731,20 +4733,20 @@ function LendSupply(_ref) {
4731
4733
  loadingTitle: "Supply ".concat(poolInfo.poolUnderlyingToken.symbol),
4732
4734
  handleClose: handleClose,
4733
4735
  handleSuccess: handleSupplySuccess,
4734
- children: [step === WIDGET_STEP.Evaluation && jsxRuntime.jsx(Evaluation$1, {
4736
+ children: [step === WIDGET_STEP.Evaluation && jsxRuntime.jsx(Evaluation$2, {
4735
4737
  poolInfo: poolInfo,
4736
4738
  handleClose: handleClose,
4737
4739
  handleApproveSuccess: handleApproveSuccess
4738
- }), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$2, {
4740
+ }), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$3, {
4739
4741
  poolInfo: poolInfo,
4740
4742
  allowance: allowance,
4741
4743
  underlyingTokenBalance: balanceWithoutDecimals,
4742
4744
  withdrawlLockoutSeconds: withdrawlLockoutSeconds
4743
4745
  }), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$1, {
4744
4746
  poolInfo: poolInfo
4745
- }), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$2, {
4747
+ }), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$3, {
4746
4748
  poolInfo: poolInfo
4747
- }), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$2, {
4749
+ }), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$3, {
4748
4750
  poolInfo: poolInfo,
4749
4751
  handleAction: setupNotificationsOrClose,
4750
4752
  hasNextStep: isFirstTimeNotifiUser
@@ -4797,7 +4799,7 @@ function CheckWithdrawable(_ref) {
4797
4799
  });
4798
4800
  }
4799
4801
 
4800
- function ChooseAmount$1(_ref) {
4802
+ function ChooseAmount$2(_ref) {
4801
4803
  var lenderPosition = _ref.lenderPosition,
4802
4804
  poolInfo = _ref.poolInfo;
4803
4805
  var dispatch = useAppDispatch();
@@ -4829,7 +4831,7 @@ function ChooseAmount$1(_ref) {
4829
4831
  });
4830
4832
  }
4831
4833
 
4832
- function Transfer$1(_ref) {
4834
+ function Transfer$2(_ref) {
4833
4835
  var poolInfo = _ref.poolInfo;
4834
4836
  var dispatch = useAppDispatch();
4835
4837
  var decimals = poolInfo.poolUnderlyingToken.decimals;
@@ -4847,7 +4849,7 @@ function Transfer$1(_ref) {
4847
4849
  });
4848
4850
  }
4849
4851
 
4850
- function Success$1(_ref) {
4852
+ function Success$2(_ref) {
4851
4853
  var poolInfo = _ref.poolInfo,
4852
4854
  handleAction = _ref.handleAction;
4853
4855
  var _useWeb3React = core.useWeb3React(),
@@ -4925,12 +4927,12 @@ function LendWithdraw(_ref) {
4925
4927
  children: [(!step || step === WIDGET_STEP.CheckWithdrawable) && jsxRuntime.jsx(CheckWithdrawable, {
4926
4928
  poolInfo: poolInfo,
4927
4929
  handleClose: handleClose
4928
- }), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$1, {
4930
+ }), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$2, {
4929
4931
  poolInfo: poolInfo,
4930
4932
  lenderPosition: lenderPosition
4931
- }), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$1, {
4933
+ }), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$2, {
4932
4934
  poolInfo: poolInfo
4933
- }), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$1, {
4935
+ }), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$2, {
4934
4936
  poolInfo: poolInfo,
4935
4937
  handleAction: handleClose
4936
4938
  }), step === WIDGET_STEP.Error && jsxRuntime.jsx(ErrorModal, {
@@ -5223,7 +5225,7 @@ function ApolloWrapper(_ref) {
5223
5225
  });
5224
5226
  }
5225
5227
 
5226
- function Evaluation(_ref) {
5228
+ function Evaluation$1(_ref) {
5227
5229
  var poolInfo = _ref.poolInfo,
5228
5230
  payerAddress = _ref.payerAddress,
5229
5231
  superToken = _ref.superToken;
@@ -5257,7 +5259,7 @@ function Evaluation(_ref) {
5257
5259
  });
5258
5260
  }
5259
5261
 
5260
- function ChooseAmount(_ref) {
5262
+ function ChooseAmount$1(_ref) {
5261
5263
  var poolInfo = _ref.poolInfo,
5262
5264
  currentFlowRate = _ref.currentFlowRate;
5263
5265
  var dispatch = useAppDispatch();
@@ -5338,7 +5340,7 @@ function ChooseAmount(_ref) {
5338
5340
  });
5339
5341
  }
5340
5342
 
5341
- function ConfirmTransfer() {
5343
+ function ConfirmTransfer$1() {
5342
5344
  var dispatch = useAppDispatch();
5343
5345
  var _useWeb3React = core.useWeb3React(),
5344
5346
  chainId = _useWeb3React.chainId;
@@ -5500,7 +5502,7 @@ function Permit(_ref) {
5500
5502
  });
5501
5503
  }
5502
5504
 
5503
- function Transfer(_ref) {
5505
+ function Transfer$1(_ref) {
5504
5506
  var poolInfo = _ref.poolInfo;
5505
5507
  var dispatch = useAppDispatch();
5506
5508
  var multiSendContract = shared.useMultiSendContract();
@@ -5522,7 +5524,7 @@ function Transfer(_ref) {
5522
5524
  });
5523
5525
  }
5524
5526
 
5525
- function Success(_ref) {
5527
+ function Success$1(_ref) {
5526
5528
  var handleAction = _ref.handleAction;
5527
5529
  var _useAppSelector = useAppSelector(selectWidgetState),
5528
5530
  borrowAmount = _useAppSelector.borrowAmount,
@@ -5561,14 +5563,14 @@ function StreamFactoringBorrow(_ref) {
5561
5563
  isOpen: isOpen,
5562
5564
  handleClose: handleClose,
5563
5565
  handleSuccess: handleSuccess,
5564
- children: [step === WIDGET_STEP.Evaluation && jsxRuntime.jsx(Evaluation, {
5566
+ children: [step === WIDGET_STEP.Evaluation && jsxRuntime.jsx(Evaluation$1, {
5565
5567
  poolInfo: poolInfo,
5566
5568
  payerAddress: payerAddress,
5567
5569
  superToken: superToken
5568
- }), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount, {
5570
+ }), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$1, {
5569
5571
  poolInfo: poolInfo,
5570
5572
  currentFlowRate: currentFlowRate
5571
- }), step === WIDGET_STEP.ConfirmTransfer && jsxRuntime.jsx(ConfirmTransfer, {}), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance, {
5573
+ }), step === WIDGET_STEP.ConfirmTransfer && jsxRuntime.jsx(ConfirmTransfer$1, {}), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance, {
5572
5574
  poolInfo: poolInfo
5573
5575
  }), step === WIDGET_STEP.Permit && account && chainId && jsxRuntime.jsx(Permit, {
5574
5576
  poolInfo: poolInfo,
@@ -5576,9 +5578,9 @@ function StreamFactoringBorrow(_ref) {
5576
5578
  chainId: chainId,
5577
5579
  borrower: account,
5578
5580
  superToken: superToken
5579
- }), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer, {
5581
+ }), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$1, {
5580
5582
  poolInfo: poolInfo
5581
- }), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success, {
5583
+ }), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$1, {
5582
5584
  handleAction: handleClose
5583
5585
  }), step === WIDGET_STEP.Error && jsxRuntime.jsx(ErrorModal, {
5584
5586
  title: "Stream Borrowing",
@@ -6378,6 +6380,315 @@ var themeHuma = material.createTheme(themeBase, {
6378
6380
  components: components(themeBase)
6379
6381
  });
6380
6382
 
6383
+ function Evaluation(_ref) {
6384
+ var poolInfo = _ref.poolInfo,
6385
+ tokenId = _ref.tokenId;
6386
+ var _useEA = useEA(),
6387
+ checkingEA = _useEA.checkingEA,
6388
+ isWalletOwnershipVerificationRequired = _useEA.isWalletOwnershipVerificationRequired,
6389
+ isWalletOwnershipVerified = _useEA.isWalletOwnershipVerified;
6390
+ var _useWeb3React = core.useWeb3React(),
6391
+ account = _useWeb3React.account,
6392
+ chainId = _useWeb3React.chainId;
6393
+ React.useEffect(function () {
6394
+ if (account && chainId) {
6395
+ checkingEA({
6396
+ poolAddress: poolInfo.pool,
6397
+ borrowerWalletAddress: account,
6398
+ context: {
6399
+ receivable: {
6400
+ address: poolInfo.assetAddress,
6401
+ param: shared.toBigNumber(tokenId).toHexString()
6402
+ }
6403
+ }
6404
+ }, WIDGET_STEP.ChooseAmount);
6405
+ }
6406
+ }, [account, chainId, checkingEA, poolInfo.assetAddress, poolInfo.pool, tokenId, isWalletOwnershipVerified]);
6407
+ if (isWalletOwnershipVerificationRequired) {
6408
+ return jsxRuntime.jsx(SignIn, {});
6409
+ }
6410
+ return jsxRuntime.jsx(LoadingModal, {
6411
+ title: "Checking Invoice",
6412
+ description: "Checking if the invoice qualifies for factoring..."
6413
+ });
6414
+ }
6415
+
6416
+ function ChooseAmount(_ref) {
6417
+ var _receivable;
6418
+ var poolInfo = _ref.poolInfo,
6419
+ accountStats = _ref.accountStats;
6420
+ var dispatch = useAppDispatch();
6421
+ var creditRecord = accountStats.creditRecord;
6422
+ var _useState = React.useState(0),
6423
+ _useState2 = _slicedToArray(_useState, 2),
6424
+ chargedFees = _useState2[0],
6425
+ setChargedFees = _useState2[1];
6426
+ var _useState3 = React.useState(0),
6427
+ _useState4 = _slicedToArray(_useState3, 2),
6428
+ currentAmount = _useState4[0],
6429
+ setCurrentAmount = _useState4[1];
6430
+ var _useAppSelector = useAppSelector(selectWidgetState),
6431
+ approval = _useAppSelector.approval;
6432
+ var _useFeeManager = shared.useFeeManager(poolInfo.poolName, poolInfo.poolType),
6433
+ getFeesCharged = _useFeeManager.getFeesCharged;
6434
+ var _useState5 = React.useState((_receivable = approval.receivable) === null || _receivable === void 0 ? void 0 : _receivable.amountFormatted),
6435
+ _useState6 = _slicedToArray(_useState5, 2),
6436
+ remainder = _useState6[0],
6437
+ setRemainder = _useState6[1];
6438
+ var getAvailableCreditLimit = function getAvailableCreditLimit() {
6439
+ if (approval && creditRecord) {
6440
+ var principal = creditRecord.unbilledPrincipal.add(creditRecord.totalDue).sub(creditRecord.feesAndInterestDue).toNumber();
6441
+ return Number(approval.terms.creditLimitFormatted) - principal;
6442
+ }
6443
+ return 0;
6444
+ };
6445
+ var handleChangeAmount = React.useCallback(function (newAmount) {
6446
+ if (approval) {
6447
+ setCurrentAmount(newAmount);
6448
+ setChargedFees(getFeesCharged(newAmount));
6449
+ setRemainder(Number(approval.receivable.amountFormatted) - newAmount);
6450
+ }
6451
+ }, [approval, getFeesCharged]);
6452
+ var handleAction = React.useCallback(function () {
6453
+ dispatch(setBorrowInfo({
6454
+ borrowAmount: currentAmount,
6455
+ borrowAmountBN: shared.upScale(currentAmount, approval === null || approval === void 0 ? void 0 : approval.token.decimal),
6456
+ chargedFees: chargedFees,
6457
+ remainder: Number(remainder),
6458
+ nextStep: WIDGET_STEP.ConfirmTransfer
6459
+ }));
6460
+ }, [approval === null || approval === void 0 ? void 0 : approval.token.decimal, chargedFees, currentAmount, dispatch, remainder]);
6461
+ if (!approval) {
6462
+ return null;
6463
+ }
6464
+ return jsxRuntime.jsx(ChooseAmountModal, {
6465
+ title: "Choose Amount",
6466
+ description1: "Access up to 80% of your invoice value",
6467
+ description2: "The remainder will be sent to your wallet when the invoice is paid",
6468
+ sliderMax: getAvailableCreditLimit(),
6469
+ currentAmount: currentAmount,
6470
+ tokenSymbol: approval.token.symbol,
6471
+ topLeft: "Fees",
6472
+ topRight: "".concat(chargedFees, " ").concat(approval.token.symbol),
6473
+ downLeft: "Remainder",
6474
+ downRight: "".concat(remainder, " ").concat(approval.token.symbol),
6475
+ handleChangeAmount: handleChangeAmount,
6476
+ handleAction: handleAction
6477
+ });
6478
+ }
6479
+
6480
+ function ConfirmTransfer() {
6481
+ var dispatch = useAppDispatch();
6482
+ var _useAppSelector = useAppSelector(selectWidgetState),
6483
+ borrowAmountNet = _useAppSelector.borrowAmountNet,
6484
+ approval = _useAppSelector.approval;
6485
+ var handleAction = function handleAction() {
6486
+ dispatch(setStep(WIDGET_STEP.ApproveNFT));
6487
+ };
6488
+ if (shared.isEmpty(borrowAmountNet) || shared.isEmpty(approval)) {
6489
+ return null;
6490
+ }
6491
+ return jsxRuntime.jsx(ConfirmTransferModal, {
6492
+ title: "Confirm transaction details",
6493
+ description: "Huma keeps your Invoice NFT as collateral until it's fully paid.",
6494
+ items: [{
6495
+ leftText: 'Invoice NFT',
6496
+ rightText: 'Huma'
6497
+ }, {
6498
+ leftText: "".concat(borrowAmountNet, " ").concat(approval === null || approval === void 0 ? void 0 : approval.token.symbol),
6499
+ rightText: 'You'
6500
+ }],
6501
+ actionText: "APPROVE TRANSFER",
6502
+ handleAction: handleAction
6503
+ });
6504
+ }
6505
+
6506
+ function ApproveNFT(_ref) {
6507
+ var poolInfo = _ref.poolInfo,
6508
+ tokenId = _ref.tokenId;
6509
+ var dispatch = useAppDispatch();
6510
+ var _useWeb3React = core.useWeb3React(),
6511
+ provider = _useWeb3React.provider;
6512
+ var _useAtom = jotai.useAtom(shared.sendTxAtom),
6513
+ _useAtom2 = _slicedToArray(_useAtom, 2),
6514
+ _useAtom2$ = _useAtom2[0],
6515
+ state = _useAtom2$.state,
6516
+ txHash = _useAtom2$.txHash,
6517
+ send = _useAtom2[1];
6518
+ var reset = utils.useResetAtom(shared.txAtom);
6519
+ var invoiceNFTContract = shared.useInvoiceNFTContract(poolInfo.poolName);
6520
+ React.useEffect(function () {
6521
+ if (state === shared.TxStateType.Success) {
6522
+ reset();
6523
+ dispatch(setStep(WIDGET_STEP.Transfer));
6524
+ }
6525
+ }, [dispatch, reset, state]);
6526
+ React.useEffect(function () {
6527
+ send({
6528
+ contract: invoiceNFTContract,
6529
+ method: 'approve',
6530
+ params: [poolInfo.pool, tokenId],
6531
+ provider: provider
6532
+ });
6533
+ }, [invoiceNFTContract, poolInfo.pool, provider, send, tokenId]);
6534
+ return jsxRuntime.jsx(LoadingModal, {
6535
+ title: "Approve Invoice Transfer",
6536
+ description: "Waiting for approval confirmation...",
6537
+ children: jsxRuntime.jsx(ViewOnExplorer, {
6538
+ txHash: txHash
6539
+ })
6540
+ });
6541
+ }
6542
+
6543
+ function Transfer(_ref) {
6544
+ var poolInfo = _ref.poolInfo,
6545
+ tokenId = _ref.tokenId;
6546
+ var dispatch = useAppDispatch();
6547
+ var decimals = poolInfo.poolUnderlyingToken.decimals;
6548
+ var _useAppSelector = useAppSelector(selectWidgetState),
6549
+ borrowAmount = _useAppSelector.borrowAmount;
6550
+ var requestLoanBigNumber = shared.toBigNumber(shared.upScale(borrowAmount, decimals));
6551
+ var handleSuccess = React.useCallback(function () {
6552
+ dispatch(setStep(WIDGET_STEP.Done));
6553
+ }, [dispatch]);
6554
+ return jsxRuntime.jsx(TxSendModal, {
6555
+ poolInfo: poolInfo,
6556
+ title: "Transfer Invoice and Money",
6557
+ method: "drawdownWithReceivable",
6558
+ params: [requestLoanBigNumber, poolInfo.assetAddress, tokenId],
6559
+ handleSuccess: handleSuccess
6560
+ });
6561
+ }
6562
+
6563
+ function Success(_ref) {
6564
+ var handleAction = _ref.handleAction;
6565
+ var _useAppSelector = useAppSelector(selectWidgetState),
6566
+ borrowAmountNet = _useAppSelector.borrowAmountNet,
6567
+ remainder = _useAppSelector.remainder,
6568
+ approval = _useAppSelector.approval;
6569
+ var content = ["".concat(borrowAmountNet, " ").concat(approval === null || approval === void 0 ? void 0 : approval.token.symbol, " is now in your wallet."), "The remaining ".concat(remainder, " ").concat(approval === null || approval === void 0 ? void 0 : approval.token.symbol, " will be sent to your wallet when the invoice is paid.")];
6570
+ return jsxRuntime.jsx(TxDoneModal, {
6571
+ handleAction: handleAction,
6572
+ content: content
6573
+ });
6574
+ }
6575
+
6576
+ function RequestNetworkInvoiceFactoringBorrow(_ref) {
6577
+ var poolNameStr = _ref.poolName,
6578
+ poolTypeStr = _ref.poolType,
6579
+ requestId = _ref.requestId,
6580
+ handleClose = _ref.handleClose,
6581
+ handleSuccess = _ref.handleSuccess;
6582
+ var dispatch = reactRedux.useDispatch();
6583
+ var _useWeb3React = core.useWeb3React(),
6584
+ account = _useWeb3React.account,
6585
+ provider = _useWeb3React.provider;
6586
+ var poolName = shared.POOL_NAME[poolNameStr];
6587
+ var poolType = shared.POOL_TYPE[poolTypeStr];
6588
+ var poolInfo = shared.usePoolInfo(poolName, poolType);
6589
+ var _useAppSelector = useAppSelector(selectWidgetState),
6590
+ step = _useAppSelector.step,
6591
+ errorMessage = _useAppSelector.errorMessage;
6592
+ var _useAccountStats = shared.useAccountStats(poolName, poolType, account),
6593
+ _useAccountStats2 = _slicedToArray(_useAccountStats, 1),
6594
+ accountStats = _useAccountStats2[0];
6595
+ var _useState = React.useState(),
6596
+ _useState2 = _slicedToArray(_useState, 2),
6597
+ tokenId = _useState2[0],
6598
+ setTokenId = _useState2[1];
6599
+ var _useState3 = React.useState(true),
6600
+ _useState4 = _slicedToArray(_useState3, 2),
6601
+ isLoading = _useState4[0],
6602
+ setIsLoading = _useState4[1];
6603
+ React.useEffect(function () {
6604
+ dispatch(setStep(WIDGET_STEP.Evaluation));
6605
+ }, [dispatch]);
6606
+ React.useEffect(function () {
6607
+ if (provider == null) {
6608
+ return function () {}; // Return empty func to satisty consistent return lint rule
6609
+ }
6610
+
6611
+ // Refetch every 5 seconds until requestData is non-null
6612
+ var interval = setInterval(function () {
6613
+ function getInvoice() {
6614
+ return _getInvoice.apply(this, arguments);
6615
+ }
6616
+ function _getInvoice() {
6617
+ _getInvoice = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
6618
+ var requestNetwork, request, requestData, tokenId;
6619
+ return regenerator.wrap(function _callee$(_context) {
6620
+ while (1) switch (_context.prev = _context.next) {
6621
+ case 0:
6622
+ if (!(provider == null)) {
6623
+ _context.next = 2;
6624
+ break;
6625
+ }
6626
+ return _context.abrupt("return");
6627
+ case 2:
6628
+ requestNetwork = new requestClient_js.RequestNetwork({
6629
+ nodeConnectionConfig: {
6630
+ baseURL: "https://xdai.gateway.request.network/"
6631
+ }
6632
+ });
6633
+ _context.next = 5;
6634
+ return requestNetwork.fromRequestId(requestId);
6635
+ case 5:
6636
+ request = _context.sent;
6637
+ requestData = request.getData();
6638
+ _context.next = 9;
6639
+ return paymentProcessor.getReceivableTokenIdForRequest(requestData, provider);
6640
+ case 9:
6641
+ tokenId = _context.sent;
6642
+ // Check if token ID exists yet for this request
6643
+ if (tokenId) {
6644
+ setTokenId(tokenId);
6645
+ setIsLoading(false);
6646
+ clearInterval(interval);
6647
+ }
6648
+ case 11:
6649
+ case "end":
6650
+ return _context.stop();
6651
+ }
6652
+ }, _callee);
6653
+ }));
6654
+ return _getInvoice.apply(this, arguments);
6655
+ }
6656
+ getInvoice();
6657
+ }, 5000);
6658
+ return function () {
6659
+ return clearInterval(interval);
6660
+ };
6661
+ }, [provider, requestId]);
6662
+ if (!poolInfo) {
6663
+ return null;
6664
+ }
6665
+ return jsxRuntime.jsxs(WidgetWrapper, {
6666
+ isOpen: true,
6667
+ isLoading: isLoading,
6668
+ handleClose: handleClose,
6669
+ handleSuccess: handleSuccess,
6670
+ children: [step === WIDGET_STEP.Evaluation && jsxRuntime.jsx(Evaluation, {
6671
+ poolInfo: poolInfo,
6672
+ tokenId: tokenId.toString()
6673
+ }), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount, {
6674
+ poolInfo: poolInfo,
6675
+ accountStats: accountStats
6676
+ }), step === WIDGET_STEP.ConfirmTransfer && jsxRuntime.jsx(ConfirmTransfer, {}), step === WIDGET_STEP.ApproveNFT && jsxRuntime.jsx(ApproveNFT, {
6677
+ poolInfo: poolInfo,
6678
+ tokenId: tokenId.toString()
6679
+ }), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer, {
6680
+ poolInfo: poolInfo,
6681
+ tokenId: tokenId.toString()
6682
+ }), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success, {
6683
+ handleAction: handleClose
6684
+ }), step === WIDGET_STEP.Error && jsxRuntime.jsx(ErrorModal, {
6685
+ title: "Invoice Factoring",
6686
+ errorMessage: errorMessage,
6687
+ handleOk: handleClose
6688
+ })]
6689
+ });
6690
+ }
6691
+
6381
6692
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6382
6693
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6383
6694
  function Widget(props) {
@@ -6403,6 +6714,25 @@ function Widget(props) {
6403
6714
  });
6404
6715
  }
6405
6716
 
6717
+ /**
6718
+ * Invoice factoring pool borrow widget props
6719
+ * @typedef {Object} RequestNetworkInvoiceFactoringBorrowWidgetProps
6720
+ * @property {RequestNetworkInvoiceFactoringBorrowProps} RequestNetworkInvoiceFactoringBorrowProps - Invoice factoring pool borrow props.
6721
+ * @property {WidgetProps} WidgetProps - Widget general props.
6722
+ */
6723
+
6724
+ /**
6725
+ * Invoice factoring borrow widget
6726
+ *
6727
+ * @param {RequestNetworkInvoiceFactoringBorrowWidgetProps} props - The invoice factoring pool borrow widget props.
6728
+ * @returns Invoice factoring pool borrow widget component
6729
+ */
6730
+ function RequestNetworkInvoiceFactoringBorrowWidget(props) {
6731
+ return jsxRuntime.jsx(Widget, _objectSpread(_objectSpread({}, props), {}, {
6732
+ children: jsxRuntime.jsx(RequestNetworkInvoiceFactoringBorrow, _objectSpread({}, props))
6733
+ }));
6734
+ }
6735
+
6406
6736
  /**
6407
6737
  * Invoice factoring pool borrow widget props
6408
6738
  * @typedef {Object} InvoiceFactoringBorrowWidgetProps
@@ -6556,5 +6886,6 @@ exports.InvoiceFactoringBorrowWidget = InvoiceFactoringBorrowWidget;
6556
6886
  exports.InvoiceFactoringPaymentWidget = InvoiceFactoringPaymentWidget;
6557
6887
  exports.LendSupplyWidget = LendSupplyWidget;
6558
6888
  exports.LendWithdrawWidget = LendWithdrawWidget;
6889
+ exports.RequestNetworkInvoiceFactoringBorrowWidget = RequestNetworkInvoiceFactoringBorrowWidget;
6559
6890
  exports.SuperfluidFactoringWidget = SuperfluidFactoringWidget;
6560
6891
  //# sourceMappingURL=index.cjs.map