@orderly.network/ui-orders 2.8.3 → 2.8.4

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
@@ -52,6 +52,7 @@ declare const useOrderListScript: (props: useOrderListScriptOptions) => {
52
52
  };
53
53
  filterDays: 1 | 30 | 7 | 90 | null;
54
54
  updateFilterDays: (days: 1 | 7 | 30 | 90) => void;
55
+ symbol: string | undefined;
55
56
  };
56
57
  type OrdersBuilderState$1 = ReturnType<typeof useOrderListScript>;
57
58
 
package/dist/index.d.ts CHANGED
@@ -52,6 +52,7 @@ declare const useOrderListScript: (props: useOrderListScriptOptions) => {
52
52
  };
53
53
  filterDays: 1 | 30 | 7 | 90 | null;
54
54
  updateFilterDays: (days: 1 | 7 | 30 | 90) => void;
55
+ symbol: string | undefined;
55
56
  };
56
57
  type OrdersBuilderState$1 = ReturnType<typeof useOrderListScript>;
57
58
 
package/dist/index.js CHANGED
@@ -5326,6 +5326,8 @@ var init_orderList_ui = __esm({
5326
5326
  };
5327
5327
  CancelAll = (props) => {
5328
5328
  const { t } = i18n.useTranslation();
5329
+ const { symbol } = props;
5330
+ const formattedSymbol = symbol ? utils.formatSymbol(symbol, "base") : symbol;
5329
5331
  return /* @__PURE__ */ jsxRuntime.jsx(
5330
5332
  ui.Button,
5331
5333
  {
@@ -5336,7 +5338,7 @@ var init_orderList_ui = __esm({
5336
5338
  className: "disabled:oui-bg-transport",
5337
5339
  onClick: (e) => props.onCancelAll(),
5338
5340
  "data-testid": `oui-testid-dataList-${props.type.toLowerCase()}-cancelAll-button`,
5339
- children: t("orders.cancelAll")
5341
+ children: symbol ? t("orders.cancelAll.ofSymbol", { symbol: formattedSymbol }) : t("orders.cancelAll")
5340
5342
  }
5341
5343
  );
5342
5344
  };
@@ -5393,7 +5395,7 @@ function offsetEndOfDay(date) {
5393
5395
  newDate.setHours(23, 59, 59, 999);
5394
5396
  return newDate;
5395
5397
  }
5396
- exports.useOrderListScript = void 0; var useFilter, formatDatePickerRange;
5398
+ exports.useOrderListScript = void 0; var useFilter, formatDatePickerRange, getDialogInfo;
5397
5399
  var init_orderList_script = __esm({
5398
5400
  "src/components/orderList/orderList.script.tsx"() {
5399
5401
  init_util();
@@ -5462,7 +5464,7 @@ var init_orderList_script = __esm({
5462
5464
  updateOrder,
5463
5465
  cancelAlgoOrder,
5464
5466
  updateAlgoOrder,
5465
- cancelAllOrders,
5467
+ cancelAllPendingOrders,
5466
5468
  cancelAllTPSLOrders,
5467
5469
  meta,
5468
5470
  refresh
@@ -5490,8 +5492,7 @@ var init_orderList_script = __esm({
5490
5492
  }
5491
5493
  }, [pageSize, typePageSize]);
5492
5494
  const onCancelAll = React2.useCallback(() => {
5493
- const title = props.type === "pending" /* pending */ ? t("orders.pending.cancelAll") : props.type === "tp_sl" /* tp_sl */ ? t("orders.tpsl.cancelAll") : "";
5494
- const content = t("orders.pending.cancelAll.description") ;
5495
+ const { title, content } = getDialogInfo(type, t, props.symbol);
5495
5496
  ui.modal.confirm({
5496
5497
  title,
5497
5498
  content: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "sm", children: content }),
@@ -5500,9 +5501,9 @@ var init_orderList_script = __esm({
5500
5501
  onOk: async () => {
5501
5502
  try {
5502
5503
  if (type === "tp_sl" /* tp_sl */) {
5503
- await cancelAllTPSLOrders();
5504
+ await cancelAllTPSLOrders(props.symbol);
5504
5505
  } else {
5505
- await cancelAllOrders();
5506
+ await cancelAllPendingOrders(props.symbol);
5506
5507
  }
5507
5508
  refresh();
5508
5509
  return Promise.resolve(true);
@@ -5516,7 +5517,7 @@ var init_orderList_script = __esm({
5516
5517
  }
5517
5518
  }
5518
5519
  });
5519
- }, [type, t]);
5520
+ }, [type, t, props.symbol]);
5520
5521
  const formattedData = useFormatOrderHistory(data ?? []);
5521
5522
  const dataSource = reactApp.useDataTap(type !== "tp_sl" /* tp_sl */ ? formattedData : data, {
5522
5523
  fallbackData: []
@@ -5548,7 +5549,8 @@ var init_orderList_script = __esm({
5548
5549
  tableInstance,
5549
5550
  symbolsInfo,
5550
5551
  filterDays,
5551
- updateFilterDays
5552
+ updateFilterDays,
5553
+ symbol: props.symbol
5552
5554
  };
5553
5555
  };
5554
5556
  useFilter = (type, option) => {
@@ -5702,6 +5704,46 @@ var init_orderList_script = __esm({
5702
5704
  from: offsetStartOfDay(option.from),
5703
5705
  to: offsetEndOfDay(option.to ?? option.from)
5704
5706
  });
5707
+ getDialogInfo = (type, t, symbol) => {
5708
+ const formattedSymbol = symbol ? utils.formatSymbol(symbol, "base") : symbol;
5709
+ switch (type) {
5710
+ case "pending" /* pending */:
5711
+ if (symbol !== void 0) {
5712
+ return {
5713
+ title: t("orders.pending.cancelAll.forSymbol", {
5714
+ symbol: formattedSymbol
5715
+ }),
5716
+ content: t("orders.pending.cancelAll.forSymbol.description", {
5717
+ symbol: formattedSymbol
5718
+ })
5719
+ };
5720
+ }
5721
+ return {
5722
+ title: t("orders.pending.cancelAll"),
5723
+ content: t("orders.pending.cancelAll.description")
5724
+ };
5725
+ case "tp_sl" /* tp_sl */:
5726
+ if (symbol !== void 0) {
5727
+ return {
5728
+ title: t("orders.tpsl.cancelAll.forSymbol", {
5729
+ symbol: formattedSymbol
5730
+ }),
5731
+ content: t("orders.tpsl.cancelAll.forSymbol.description", {
5732
+ symbol: formattedSymbol
5733
+ })
5734
+ };
5735
+ }
5736
+ return {
5737
+ title: t("orders.tpsl.cancelAll"),
5738
+ content: t("orders.tpsl.cancelAll.description")
5739
+ };
5740
+ default:
5741
+ return {
5742
+ title: "",
5743
+ content: ""
5744
+ };
5745
+ }
5746
+ };
5705
5747
  }
5706
5748
  });
5707
5749
  exports.DesktopOrderListWidget = void 0; exports.MobileOrderListWidget = void 0;