@kodiak-finance/orderly-react-app 2.9.0 → 2.9.1-alpha.1

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
@@ -1,6 +1,6 @@
1
1
  import react, { ReactNode, ComponentType, PropsWithChildren, Component, ErrorInfo } from 'react';
2
2
  import { ExtensionPosition, OrderlyThemeProviderProps } from '@kodiak-finance/orderly-ui';
3
- import { ConfigProviderProps, ExclusiveConfigProviderProps, Chains, WalletState, RestrictedInfoReturns, RestrictedInfoOptions, OrderValidationResult } from '@kodiak-finance/orderly-hooks';
3
+ import { ConfigProviderProps, ExclusiveConfigProviderProps, Chains, WalletState, RestrictedInfoReturns, MarketCategoryConfig, RestrictedInfoOptions, OrderValidationResult } from '@kodiak-finance/orderly-hooks';
4
4
  import { Chain, NetworkId, AccountStatusEnum, API } from '@kodiak-finance/orderly-types';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
 
@@ -59,6 +59,11 @@ type WidgetConfigs = {
59
59
  */
60
60
  enableWithdrawToExternalWallet?: boolean;
61
61
  };
62
+ /**
63
+ * Custom market tab configuration.
64
+ * Function receives the default built-in tabs and context, returns the final tab sequence.
65
+ */
66
+ marketTabs?: MarketCategoryConfig;
62
67
  };
63
68
  type AppContextState = {
64
69
  connectWallet: ReturnType<typeof useWalletStateHandle>["connectWallet"];
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import react, { ReactNode, ComponentType, PropsWithChildren, Component, ErrorInfo } from 'react';
2
2
  import { ExtensionPosition, OrderlyThemeProviderProps } from '@kodiak-finance/orderly-ui';
3
- import { ConfigProviderProps, ExclusiveConfigProviderProps, Chains, WalletState, RestrictedInfoReturns, RestrictedInfoOptions, OrderValidationResult } from '@kodiak-finance/orderly-hooks';
3
+ import { ConfigProviderProps, ExclusiveConfigProviderProps, Chains, WalletState, RestrictedInfoReturns, MarketCategoryConfig, RestrictedInfoOptions, OrderValidationResult } from '@kodiak-finance/orderly-hooks';
4
4
  import { Chain, NetworkId, AccountStatusEnum, API } from '@kodiak-finance/orderly-types';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
 
@@ -59,6 +59,11 @@ type WidgetConfigs = {
59
59
  */
60
60
  enableWithdrawToExternalWallet?: boolean;
61
61
  };
62
+ /**
63
+ * Custom market tab configuration.
64
+ * Function receives the default built-in tabs and context, returns the final tab sequence.
65
+ */
66
+ marketTabs?: MarketCategoryConfig;
62
67
  };
63
68
  type AppContextState = {
64
69
  connectWallet: ReturnType<typeof useWalletStateHandle>["connectWallet"];
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ function getDisplaySide(side) {
27
27
  }
28
28
  return orderlyUtils.capitalizeString(side);
29
29
  }
30
- function getOrderExecutionReportMsg(data, symbolsInfo) {
30
+ function getOrderExecutionReportMsg(data, symbolsInfo, displaySymbol) {
31
31
  const { symbol, side, quantity, client_order_id, fieldChanges } = data;
32
32
  const total_executed_quantity = "total_executed_quantity" in data ? data.total_executed_quantity : 0;
33
33
  const status = "status" in data ? data.status : data.algo_status;
@@ -35,7 +35,6 @@ function getOrderExecutionReportMsg(data, symbolsInfo) {
35
35
  const base_dp = getSymbolInfo("base_dp");
36
36
  getSymbolInfo("quote_dp");
37
37
  const displaySide = getDisplaySide(side);
38
- const displaySymbol = orderlyUtils.transSymbolformString(symbol);
39
38
  const displayQuantity = "algo_type" in data && data.algo_type === orderlyTypes.AlgoOrderRootType.POSITIONAL_TP_SL ? orderlyI18n.i18n.t("tpsl.entirePosition") : base_dp === void 0 ? quantity : orderlyUi.parseNumber(quantity, { dp: base_dp });
40
39
  let title = "";
41
40
  let msg = "";
@@ -120,9 +119,14 @@ var useExecutionReport = () => {
120
119
  const symbolsInfo = orderlyHooks.useSymbolsInfo();
121
120
  const symbolsInfoRef = react.useRef({});
122
121
  const { notification } = orderlyHooks.useOrderlyContext();
122
+ const [brokers] = orderlyHooks.useAllBrokers();
123
+ const brokersRef = react.useRef(void 0);
123
124
  react.useEffect(() => {
124
125
  symbolsInfoRef.current = symbolsInfo;
125
126
  }, [symbolsInfo]);
127
+ react.useEffect(() => {
128
+ brokersRef.current = brokers;
129
+ }, [brokers]);
126
130
  const src = notification?.orderFilled?.media ?? "";
127
131
  const [soundAutoPlay] = orderlyHooks.useLocalStorage(
128
132
  ORDERLY_ORDER_SOUND_ALERT_KEY,
@@ -143,9 +147,15 @@ var useExecutionReport = () => {
143
147
  return;
144
148
  }
145
149
  const showToast = (data2) => {
150
+ const displaySymbol = orderlyHooks.formatSymbolWithBroker(
151
+ data2.symbol,
152
+ symbolsInfoRef.current,
153
+ brokersRef.current
154
+ );
146
155
  const { title, msg, status } = getOrderExecutionReportMsg(
147
156
  data2,
148
- symbolsInfoRef.current
157
+ symbolsInfoRef.current,
158
+ displaySymbol
149
159
  );
150
160
  const shouldPlaySound = getStoredBoolean(
151
161
  ORDERLY_ORDER_SOUND_ALERT_KEY,
@@ -731,7 +741,7 @@ var AppStateProvider = (props) => {
731
741
  initialized
732
742
  ]
733
743
  );
734
- return /* @__PURE__ */ jsxRuntime.jsx(AppStateContext.Provider, { value: memoizedValue, children: props.children });
744
+ return /* @__PURE__ */ jsxRuntime.jsx(AppStateContext.Provider, { value: memoizedValue, children: /* @__PURE__ */ jsxRuntime.jsx(orderlyHooks.MarketCategoriesConfigProvider, { value: props.widgetConfigs?.marketTabs, children: props.children }) });
735
745
  };
736
746
  var ORDERLY_THEME_STORAGE_KEY = "orderly_theme_id";
737
747
  var AppThemeProvider = (props) => {