@orderly.network/ui-tpsl 2.11.3-rc.0 → 2.12.0

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.js CHANGED
@@ -12,6 +12,13 @@ var perp = require('@orderly.network/perp');
12
12
  var uiConnector = require('@orderly.network/ui-connector');
13
13
 
14
14
  // src/editorPopover.tsx
15
+ var SymbolBadge = (props) => {
16
+ const { brokerId, brokerName, brokerNameRaw } = hooks.useBadgeBySymbol(
17
+ props.symbol
18
+ );
19
+ const badge = brokerName ?? brokerId ?? void 0;
20
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.SymbolBadge, { badge, fullName: brokerNameRaw });
21
+ };
15
22
  var OrderInfo = (props) => {
16
23
  const { t } = i18n.useTranslation();
17
24
  const { order: order2, symbolLeverage } = props;
@@ -47,10 +54,11 @@ var OrderInfo = (props) => {
47
54
  {
48
55
  className: "oui-whitespace-nowrap oui-break-normal",
49
56
  rule: "symbol",
50
- formatString: "base-type",
57
+ formatString: "base",
51
58
  size: "sm",
52
59
  weight: "semibold",
53
60
  intensity: 98,
61
+ suffix: /* @__PURE__ */ jsxRuntime.jsx(SymbolBadge, { symbol: symbol ?? "" }),
54
62
  children: symbol
55
63
  }
56
64
  )
@@ -256,6 +264,7 @@ var useTPSLInputRowScript = (props) => {
256
264
  });
257
265
  return roi2 * 100;
258
266
  } catch (error) {
267
+ console.error("error", error);
259
268
  return null;
260
269
  }
261
270
  }, [values, leverage, rootOrderPrice, type, side]);
@@ -832,10 +841,10 @@ var TPSLQuantity = react.memo((props) => {
832
841
  tooltip: errorMsg,
833
842
  color: errorMsg ? "danger" : void 0,
834
843
  formatters: [
844
+ ui.inputFormatter.decimalPointFormatter,
835
845
  ui.inputFormatter.dpFormatter(props.base_dp),
836
846
  ui.inputFormatter.numberFormatter,
837
- ui.inputFormatter.currencyFormatter,
838
- ui.inputFormatter.decimalPointFormatter
847
+ ui.inputFormatter.currencyFormatter
839
848
  ],
840
849
  onValueChange: (value) => {
841
850
  props.onQuantityChange?.(value);
@@ -1107,6 +1116,7 @@ var TPSL = (props) => {
1107
1116
  props.close?.();
1108
1117
  onComplete?.();
1109
1118
  }).catch((err) => {
1119
+ console.log("--->>>cancel order", err);
1110
1120
  });
1111
1121
  },
1112
1122
  children: t("common.confirm")
@@ -1185,21 +1195,25 @@ var PositionTPSLConfirm = (props) => {
1185
1195
  );
1186
1196
  };
1187
1197
  const isPositionTPSL = _isPositionTPSL;
1198
+ const displaySymbol = hooks.useSymbolWithBroker(symbol);
1188
1199
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1189
- isEditing && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "div", size: "2xs", intensity: 80, className: "oui-mb-3", children: t("tpsl.agreement", { symbol: utils.transSymbolformString(symbol) }) }),
1200
+ isEditing && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "div", size: "2xs", intensity: 80, className: "oui-mb-3", children: t("tpsl.agreement", { symbol: displaySymbol }) }),
1190
1201
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { pb: 4, children: [
1191
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { grow: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1192
- ui.Text.formatted,
1193
- {
1194
- rule: "symbol",
1195
- formatString: "base-type",
1196
- size: "base",
1197
- showIcon: true,
1198
- as: "div",
1199
- intensity: 80,
1200
- children: symbol
1201
- }
1202
- ) }),
1202
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", itemAlign: "start", gap: 1, grow: true, children: [
1203
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { grow: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1204
+ ui.Text.formatted,
1205
+ {
1206
+ rule: "symbol",
1207
+ formatString: "base",
1208
+ size: "base",
1209
+ showIcon: true,
1210
+ as: "div",
1211
+ intensity: 80,
1212
+ children: symbol
1213
+ }
1214
+ ) }),
1215
+ /* @__PURE__ */ jsxRuntime.jsx(SymbolBadge, { symbol })
1216
+ ] }),
1203
1217
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 1, children: [
1204
1218
  isPositionTPSL && /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { size: "xs", color: "primary", children: t("common.position") }),
1205
1219
  /* @__PURE__ */ jsxRuntime.jsx(TPSLOrderType, { tpPrice, slPrice }),
@@ -1396,6 +1410,7 @@ var useTPSLBuilder = (options) => {
1396
1410
  });
1397
1411
  const isSlPriceWarning = slPriceError?.sl_trigger_price?.type === hooks.ERROR_MSG_CODES.SL_PRICE_WARNING;
1398
1412
  const setQuantity = (value) => {
1413
+ console.log("------>>>>>setQuantity", value);
1399
1414
  setValue("quantity", value);
1400
1415
  };
1401
1416
  const setOrderPrice = (name, value) => {
@@ -1954,6 +1969,8 @@ var useTPSLAdvanced = (props) => {
1954
1969
  helper.validate(isSlPriceError ? slPriceError : void 0).then(() => {
1955
1970
  props.onSubmit(formattedOrder);
1956
1971
  }).catch((err) => {
1972
+ console.log("metaState", metaState);
1973
+ console.log("err", err);
1957
1974
  });
1958
1975
  };
1959
1976
  return {
@@ -2619,6 +2636,7 @@ var TPSLDetailUI = (props) => {
2619
2636
  symbolInfo
2620
2637
  } = props;
2621
2638
  const { estLiqPrice } = useTPSLDetailContext();
2639
+ console.log("----- position", position);
2622
2640
  return /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.ScrollArea, { className: ui.cn(isMobile && "oui-h-[calc(100vh-100px)]"), children: [
2623
2641
  /* @__PURE__ */ jsxRuntime.jsx(
2624
2642
  OrderInfo,
@@ -3165,7 +3183,7 @@ var TPSLSimpleDialogUI = (props) => {
3165
3183
  TPSLQuantity,
3166
3184
  {
3167
3185
  maxQty: props.maxQty,
3168
- quantity: Number(props.orderQuantity ?? props.maxQty),
3186
+ quantity: props.orderQuantity ?? props.maxQty,
3169
3187
  baseTick: props.symbolInfo("base_tick"),
3170
3188
  base_dp: props.symbolInfo("base_dp"),
3171
3189
  base: props.symbolInfo("base"),
@@ -3227,6 +3245,7 @@ var TPSLSimpleDialogUI = (props) => {
3227
3245
  var TPSLSimpleDialogWidget = (props) => {
3228
3246
  const { close, onComplete, showAdvancedTPSLDialog } = props;
3229
3247
  const state = useTPSLSimpleDialog(props);
3248
+ console.log("------>>>>>TPSLSimpleDialogWidget", state);
3230
3249
  return /* @__PURE__ */ jsxRuntime.jsx(
3231
3250
  TPSLSimpleDialogUI,
3232
3251
  {
@@ -3634,6 +3653,7 @@ var EditBracketOrderUI = (props) => {
3634
3653
  props.onSubmit().then(() => {
3635
3654
  props.onClose?.();
3636
3655
  }).catch((err) => {
3656
+ console.log("--->>>cancel order", err);
3637
3657
  });
3638
3658
  },
3639
3659
  children: t("common.confirm")