@ape.swap/bonds-sdk 3.0.30-test.0 → 3.0.31-test

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.
@@ -35,4 +35,5 @@ export declare const QUERY_KEYS: {
35
35
  POP_UPS: string;
36
36
  GEO_FENCING: string;
37
37
  TIER_PROOF_SIG: string;
38
+ ACTIVE_VIEW: string;
38
39
  };
package/dist/main.js CHANGED
@@ -18829,6 +18829,7 @@ const QUERY_KEYS = {
18829
18829
  POP_UPS: 'ApeBond-SDK-popUps',
18830
18830
  GEO_FENCING: 'ApeBond-SDK-geoFencing',
18831
18831
  TIER_PROOF_SIG: 'ApeBond-SDK-tierProofSig',
18832
+ ACTIVE_VIEW: 'ApeBond-SDK-activeView',
18832
18833
  };
18833
18834
 
18834
18835
  function useCookie(key, defaultValue) {
@@ -77129,9 +77130,10 @@ function useHotBondContracts() {
77129
77130
  return useQuery({
77130
77131
  queryKey: [QUERY_KEYS.HOT_BONDS_CONTRACTS],
77131
77132
  queryFn: getHotBondsContracts,
77133
+ staleTime: Infinity,
77132
77134
  refetchOnWindowFocus: false,
77135
+ refetchOnMount: false,
77133
77136
  retry: 1,
77134
- initialData: [],
77135
77137
  });
77136
77138
  }
77137
77139
  function useHotBonds() {
@@ -77141,13 +77143,14 @@ function useHotBonds() {
77141
77143
  queryKey: [QUERY_KEYS.HOT_BONDS, bondsData === null || bondsData === void 0 ? void 0 : bondsData.length, hotBondContracts === null || hotBondContracts === void 0 ? void 0 : hotBondContracts.length],
77142
77144
  queryFn: () => getHotBonds(bondsData, hotBondContracts),
77143
77145
  refetchOnWindowFocus: false,
77144
- retry: 1,
77145
- initialData: [],
77146
- enabled: !!bondsData && !!hotBondContracts,
77146
+ refetchInterval: 30000,
77147
+ enabled: !!bondsData && bondsData.length > 0 && !!hotBondContracts && hotBondContracts.length > 0,
77148
+ retry: 0,
77147
77149
  });
77148
77150
  }
77149
77151
  const getHotBondsContracts = () => __awaiter$9(void 0, void 0, void 0, function* () {
77150
77152
  try {
77153
+ console.log('call!');
77151
77154
  const response = yield axios.get(`${STRAPI_URL}/hot-bonds`);
77152
77155
  return response.data.map((bond) => bond.BondAddress.toLowerCase());
77153
77156
  }
@@ -77506,32 +77509,47 @@ const Bonds = () => {
77506
77509
  }, children: [jsx$2(Svg, { icon: "StarFilled", width: 75, height: 75 }), jsx$2(Flex$1, { sx: { mt: '10px' }, children: `You don't have any Favorite Bonds yet!` }), jsx$2(Flex$1, { sx: { fontSize: '12px', fontWeight: 400, color: 'textDisabledButton', mt: '10px' }, children: `Click on the 'star' or 'fire' icon to add Bonds to the list.` })] })) : (jsx$2(Flex$1, { className: "bonds-spinner", children: jsx$2(Spinner, { size: 100 }) })), SDKConfig.useHotBonds && jsx$2(RecommendationCards$1, {}), jsx$2(Flex$1, { sx: { width: '100%', justifyContent: 'center', my: '15px' }, children: jsx$2("img", { src: "https://res.cloudinary.com/dswmrqgwy/image/upload/v1741643990/poweredbyapebondsdk_cxiouj.png", alt: "powered-by-apebond", style: { width: '200px', height: 'auto' } }) })] }));
77507
77510
  };
77508
77511
 
77509
- var BondsViewOptions;
77512
+ var BondsViewOptions$1;
77510
77513
  (function (BondsViewOptions) {
77511
77514
  BondsViewOptions["BONDSMARKET"] = "Bonds Market";
77512
77515
  BondsViewOptions["YOURBONDS"] = "Your Bonds";
77513
- })(BondsViewOptions || (BondsViewOptions = {}));
77514
- const FullBondsView = () => {
77515
- const [activeView, setActiveView] = useState(BondsViewOptions.BONDSMARKET);
77516
- const handleToogle = () => {
77517
- const newOption = activeView === BondsViewOptions.YOURBONDS ? BondsViewOptions.BONDSMARKET : BondsViewOptions.YOURBONDS;
77516
+ })(BondsViewOptions$1 || (BondsViewOptions$1 = {}));
77517
+ const useActiveView = () => {
77518
+ // Query to fetch the activeView's current state
77519
+ const { data: activeView = BondsViewOptions$1.BONDSMARKET } = useQuery({
77520
+ queryKey: [QUERY_KEYS.ACTIVE_VIEW],
77521
+ queryFn: () => {
77522
+ // Initialize from the URL if on first load
77523
+ if (typeof window !== 'undefined') {
77524
+ const isYourBonds = window.location.search === '?yourBonds';
77525
+ return isYourBonds ? BondsViewOptions$1.YOURBONDS : BondsViewOptions$1.BONDSMARKET;
77526
+ }
77527
+ return BondsViewOptions$1.BONDSMARKET;
77528
+ },
77529
+ });
77530
+ const queryClient = useQueryClient();
77531
+ const handleToogle = (newView) => {
77532
+ queryClient.setQueryData([QUERY_KEYS.ACTIVE_VIEW], newView); // Update cache
77518
77533
  if (typeof window !== 'undefined') {
77519
77534
  const currentPath = window.location.pathname;
77520
- if (newOption === BondsViewOptions.YOURBONDS) {
77521
- // window.location.pathname = '/yourBonds'
77535
+ if (newView === BondsViewOptions$1.YOURBONDS) {
77522
77536
  window.history.pushState({}, '', `${currentPath}?yourBonds`);
77523
77537
  }
77524
77538
  else {
77525
77539
  window.history.pushState({}, '', `${currentPath}`);
77526
77540
  }
77527
77541
  }
77528
- setActiveView(newOption);
77529
77542
  };
77530
- useEffect(() => {
77531
- if (window.location.search === '?yourBonds') {
77532
- setActiveView(BondsViewOptions.YOURBONDS);
77533
- }
77534
- }, []);
77543
+ return { activeView, handleToogle };
77544
+ };
77545
+
77546
+ var BondsViewOptions;
77547
+ (function (BondsViewOptions) {
77548
+ BondsViewOptions["BONDSMARKET"] = "Bonds Market";
77549
+ BondsViewOptions["YOURBONDS"] = "Your Bonds";
77550
+ })(BondsViewOptions || (BondsViewOptions = {}));
77551
+ const FullBondsView = () => {
77552
+ const { activeView, handleToogle } = useActiveView();
77535
77553
  return (jsxs("div", { className: "full-bonds-view-container", children: [jsx$2("div", { className: "toggle-container", children: jsx$2(Toggle, { options: [BondsViewOptions.BONDSMARKET, BondsViewOptions.YOURBONDS], activeOption: activeView, handleToggle: handleToogle }) }), jsx$2(Flex, { sx: { width: '100%' }, children: activeView === BondsViewOptions.BONDSMARKET ? jsx$2(Bonds, {}) : jsx$2(YourBonds, {}) })] }));
77536
77554
  };
77537
77555
 
@@ -0,0 +1,9 @@
1
+ export declare enum BondsViewOptions {
2
+ BONDSMARKET = "Bonds Market",
3
+ YOURBONDS = "Your Bonds"
4
+ }
5
+ declare const useActiveView: () => {
6
+ activeView: BondsViewOptions;
7
+ handleToogle: (newView: string) => void;
8
+ };
9
+ export default useActiveView;
@@ -1,6 +1,6 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { BondsData } from '../../types/bonds';
3
- export declare function useHotBondContracts(): import("@tanstack/react-query").DefinedUseQueryResult<string[], Error>;
3
+ export declare function useHotBondContracts(): UseQueryResult<string[], Error>;
4
4
  export default function useHotBonds(): UseQueryResult<BondsData[]>;
5
5
  export declare const getHotBondsContracts: () => Promise<string[]>;
6
6
  export declare const getHotBonds: (bondData: BondsData[], hotBondContracts: string[]) => Promise<BondsData[]>;
package/dist/styles.css CHANGED
@@ -1028,7 +1028,7 @@ span.flex-inline {
1028
1028
  }
1029
1029
  @media screen and (min-width: 1000px) {
1030
1030
  .your-bonds .token-info-container {
1031
- width: 40%;
1031
+ width: 45%;
1032
1032
  }
1033
1033
  }
1034
1034
  .your-bonds .token-info-container .tooltip-column {
@@ -1051,7 +1051,7 @@ span.flex-inline {
1051
1051
  }
1052
1052
  @media screen and (min-width: 1000px) {
1053
1053
  .your-bonds .your-bonds-columns-container {
1054
- width: 60%;
1054
+ width: 55%;
1055
1055
  justify-content: space-between;
1056
1056
  flex-direction: row;
1057
1057
  padding-right: 20px;
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": "3.0.30-test.0",
6
+ "version": "3.0.31-test",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",