@ape.swap/bonds-sdk 2.5.2-test1 → 2.5.2-test3

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/main.js CHANGED
@@ -74218,6 +74218,15 @@ const RestrictedRegionModal = ({ onDismiss }) => {
74218
74218
  return (jsxs(Modal, { className: "modal", title: "Notice", sx: { maxWidth: '200px' }, children: [jsxs(Flex, { sx: { my: '20px' }, children: ["Unfortunately, this bond is restricted for your region: ", geoData === null || geoData === void 0 ? void 0 : geoData.countryCode, "."] }), jsx$2(Button, { fullWidth: true, onClick: onDismiss, children: "Close" })] }));
74219
74219
  };
74220
74220
 
74221
+ const NoBonusModal = ({ onAcknowledge }) => {
74222
+ const [isOpen, setIsOpen] = useState(true);
74223
+ const handleAcknowledge = () => {
74224
+ onAcknowledge();
74225
+ setIsOpen(false);
74226
+ };
74227
+ return (isOpen && (jsxs(Modal, { className: "nobonus-modal", title: "Warning", onClose: handleAcknowledge, children: [jsx$2("p", { children: "You will not receive any bonus tokens when buying this Bond." }), jsx$2("p", { children: "Please acknowledge to proceed." }), jsx$2(Button, { onClick: handleAcknowledge, className: "nobonus-button", sx: { width: '100%', justifyContent: 'center' }, children: "Acknowledge" })] })));
74228
+ };
74229
+
74221
74230
  const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) => {
74222
74231
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
74223
74232
  const SDKConfig = useSDKConfig();
@@ -74411,6 +74420,16 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
74411
74420
  }
74412
74421
  }
74413
74422
  };
74423
+ const [openNoBonusModal] = useModal(jsx$2(NoBonusModal, { onAcknowledge: handleBothPurchases }), true, true);
74424
+ const handleOpenModal = () => {
74425
+ var _a;
74426
+ if ((_a = bondData === null || bondData === void 0 ? void 0 : bondData.bonus) !== null && _a !== void 0 ? _a : 0 < 0) {
74427
+ openNoBonusModal();
74428
+ }
74429
+ else {
74430
+ handleBothPurchases();
74431
+ }
74432
+ };
74414
74433
  const openExternal = () => {
74415
74434
  if ((bondData === null || bondData === void 0 ? void 0 : bondData.chainId) === types.ChainId.LIGHTLINK) {
74416
74435
  window.open('https://bridge.lightlink.io/bridge?from=ETHEREUM&to=LIGHTLINK&token=ETH', '_blank');
@@ -74441,7 +74460,7 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
74441
74460
  !inputValue ||
74442
74461
  parseFloat(inputValue) === 0 ||
74443
74462
  fetchingZapQuote ||
74444
- zapError, onClick: handleBothPurchases, children: zapError ? 'something went wrong' : `buy` })) : (jsx$2(Button, { className: "action-button", load: approvalState === ApprovalState.PENDING, disabled: approvalState === ApprovalState.PENDING ||
74463
+ zapError, onClick: handleOpenModal, children: zapError ? 'something went wrong' : `buy` })) : (jsx$2(Button, { className: "action-button", load: approvalState === ApprovalState.PENDING, disabled: approvalState === ApprovalState.PENDING ||
74445
74464
  (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
74446
74465
  !account ||
74447
74466
  !inputValue ||
@@ -74660,15 +74679,6 @@ const ProgressBarWrapper = ({ title, value, style, showTooltip, toolTipPlacement
74660
74679
  };
74661
74680
  var ProgressBarWrapper$1 = React__default.memo(ProgressBarWrapper);
74662
74681
 
74663
- const WarningModal = ({ onAcknowledge }) => {
74664
- const [isOpen, setIsOpen] = useState(true);
74665
- const handleAcknowledge = () => {
74666
- onAcknowledge();
74667
- setIsOpen(false);
74668
- };
74669
- return (isOpen && (jsxs(Modal, { className: "nobonus-modal", title: "Warning", onClose: handleAcknowledge, children: [jsx$2("p", { children: "You will not receive any bonus tokens when buying this Bond." }), jsx$2("p", { children: "Please acknowledge to proceed." }), jsx$2(Button$1, { onClick: handleAcknowledge, children: "Acknowledge" })] })));
74670
- };
74671
-
74672
74682
  const BondRow = ({ bond }) => {
74673
74683
  var _a, _b, _c, _d, _e, _f, _g;
74674
74684
  const billAddress = 'billAddress' in bond
@@ -74679,7 +74689,7 @@ const BondRow = ({ bond }) => {
74679
74689
  const bonus = 'bonus' in bond ? bond.bonus : undefined;
74680
74690
  // Modal
74681
74691
  const [openBuyModal] = useModal(jsx$2(ModalHandler, { bondAddress: billAddress, bondChain: bond.chainId }), true, true, `buyBondModal-${billAddress}-${bond.chainId}`);
74682
- const handleOpenBuyModal = () => {
74692
+ const handleOpenModal = () => {
74683
74693
  openBuyModal();
74684
74694
  if (typeof window !== 'undefined') {
74685
74695
  window.history.pushState({}, '', `bonds?bondAddress=${billAddress}&bondChain=${bond.chainId}`);
@@ -74694,15 +74704,6 @@ const BondRow = ({ bond }) => {
74694
74704
  },
74695
74705
  });
74696
74706
  };
74697
- const [openWarningModal] = useModal(jsx$2(WarningModal, { onAcknowledge: handleOpenBuyModal }), true, true);
74698
- const handleOpenModal = () => {
74699
- if (bonus < 0) {
74700
- openWarningModal();
74701
- }
74702
- else {
74703
- handleOpenBuyModal();
74704
- }
74705
- };
74706
74707
  const remainingPercentage = (bond) => {
74707
74708
  var _a, _b, _c;
74708
74709
  const maxTotalPayout = 'maxTotalPayout' in bond ? bond.maxTotalPayout : undefined;
package/dist/styles.css CHANGED
@@ -753,12 +753,12 @@ span.flex-inline {
753
753
  }
754
754
 
755
755
  .discount-positive {
756
- color: #38A611;
756
+ color: #38a611;
757
757
  width: 20%;
758
758
  }
759
759
 
760
760
  .discount-negative {
761
- color: #DF4141;
761
+ color: #ffffff;
762
762
  width: 20%;
763
763
  }
764
764
 
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface NoBonusModalProps {
3
+ onAcknowledge: () => void;
4
+ }
5
+ declare const NoBonusModal: React.FC<NoBonusModalProps>;
6
+ export default NoBonusModal;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Ape Bond SDK",
4
4
  "author": "Ape Bond",
5
5
  "license": "MIT",
6
- "version": "2.5.2-test1",
6
+ "version": "2.5.2-test3",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- interface WarningModalProps {
3
- onAcknowledge: () => void;
4
- }
5
- declare const WarningModal: React.FC<WarningModalProps>;
6
- export default WarningModal;