@orderly.network/hooks 1.0.28-alpha.14 → 1.0.28-alpha.16

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/index.d.mts CHANGED
@@ -24,7 +24,7 @@ declare global {
24
24
  };
25
25
  }
26
26
  }
27
- declare const _default: "1.0.28-alpha.14";
27
+ declare const _default: "1.0.28-alpha.16";
28
28
 
29
29
  type useQueryOptions<T> = SWRConfiguration & {
30
30
  formatter?: (data: any) => T;
@@ -240,6 +240,8 @@ declare const useMarkets: (type: MarketsType) => readonly [_orderly_network_type
240
240
  }) => void;
241
241
  readonly updateSymbolFavoriteState: (symbol: API.MarketInfoExt, tab: FavoriteTab | FavoriteTab[], del?: boolean) => void;
242
242
  readonly pinToTop: (symbol: API.MarketInfoExt) => void;
243
+ readonly getLastSelFavTab: () => FavoriteTab;
244
+ readonly updateSelectedFavoriteTab: (tab: FavoriteTab) => void;
243
245
  }];
244
246
 
245
247
  declare const useMarkPricesStream: () => swr_subscription.SWRSubscriptionResponse<any, any>;
package/dist/index.d.ts CHANGED
@@ -24,7 +24,7 @@ declare global {
24
24
  };
25
25
  }
26
26
  }
27
- declare const _default: "1.0.28-alpha.14";
27
+ declare const _default: "1.0.28-alpha.16";
28
28
 
29
29
  type useQueryOptions<T> = SWRConfiguration & {
30
30
  formatter?: (data: any) => T;
@@ -240,6 +240,8 @@ declare const useMarkets: (type: MarketsType) => readonly [_orderly_network_type
240
240
  }) => void;
241
241
  readonly updateSymbolFavoriteState: (symbol: API.MarketInfoExt, tab: FavoriteTab | FavoriteTab[], del?: boolean) => void;
242
242
  readonly pinToTop: (symbol: API.MarketInfoExt) => void;
243
+ readonly getLastSelFavTab: () => FavoriteTab;
244
+ readonly updateSelectedFavoriteTab: (tab: FavoriteTab) => void;
243
245
  }];
244
246
 
245
247
  declare const useMarkPricesStream: () => swr_subscription.SWRSubscriptionResponse<any, any>;
package/dist/index.js CHANGED
@@ -28,9 +28,9 @@ var useSWRSubscription__default = /*#__PURE__*/_interopDefault(useSWRSubscriptio
28
28
  // src/version.ts
29
29
  if (typeof window !== "undefined") {
30
30
  window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
31
- window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.0.28-alpha.14";
31
+ window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.0.28-alpha.16";
32
32
  }
33
- var version_default = "1.0.28-alpha.14";
33
+ var version_default = "1.0.28-alpha.16";
34
34
  var fetcher = (url, init = {}, queryOptions) => net.get(url, init, queryOptions?.formatter);
35
35
  var OrderlyContext = React.createContext({
36
36
  // configStore: new MemoryConfigStore(),
@@ -1996,7 +1996,8 @@ var useMarkets = (type) => {
1996
1996
  { name: "PERP_ETH_USDC", tabs: [{ ...defaultTab }] },
1997
1997
  { name: "PERP_BTC_USDC", tabs: [{ ...defaultTab }] }
1998
1998
  ],
1999
- favoriteTabs: [{ ...defaultTab }]
1999
+ favoriteTabs: [{ ...defaultTab }],
2000
+ lastSelectFavoriteTab: { ...defaultTab }
2000
2001
  });
2001
2002
  }
2002
2003
  }
@@ -2153,6 +2154,16 @@ var useMarkets = (type) => {
2153
2154
  const tabs = React.useMemo(() => {
2154
2155
  return favoriteTabs;
2155
2156
  }, [favoriteTabs]);
2157
+ const getLastSelFavTab = () => {
2158
+ const curData = configStore.get(marketsKey)["lastSelectedFavoriteTab"];
2159
+ return curData || { name: "Popular", id: 1 };
2160
+ };
2161
+ const updateSelectedFavoriteTab = (tab) => {
2162
+ configStore.set(marketsKey, {
2163
+ ...configStore.getOr(marketsKey, {}),
2164
+ lastSelectedFavoriteTab: tab
2165
+ });
2166
+ };
2156
2167
  return [
2157
2168
  markets || [],
2158
2169
  {
@@ -2163,7 +2174,9 @@ var useMarkets = (type) => {
2163
2174
  // updateFavoriteTabs("tab", operator: {add/update/delete})
2164
2175
  updateFavoriteTabs,
2165
2176
  updateSymbolFavoriteState,
2166
- pinToTop
2177
+ pinToTop,
2178
+ getLastSelFavTab,
2179
+ updateSelectedFavoriteTab
2167
2180
  }
2168
2181
  ];
2169
2182
  };