@orderly.network/ui-order-entry 3.1.2 → 3.1.3-alpha.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.mjs CHANGED
@@ -2100,16 +2100,11 @@ var OrderTypeSelect = (props) => {
2100
2100
  }
2101
2101
  ];
2102
2102
  }, [t]);
2103
- const displayLabelMap = useMemo(() => {
2104
- return {
2105
- [OrderType.LIMIT]: t("orderEntry.orderType.limit"),
2106
- [OrderType.MARKET]: t("common.marketPrice"),
2107
- [OrderType.STOP_LIMIT]: t("orderEntry.orderType.stopLimit"),
2108
- [OrderType.STOP_MARKET]: t("orderEntry.orderType.stopMarket"),
2109
- [OrderType.SCALED]: t("orderEntry.orderType.scaledOrder"),
2110
- [OrderType.TRAILING_STOP]: t("orderEntry.orderType.trailingStop")
2111
- };
2112
- }, [t]);
2103
+ const builtInOrderEntryTypes = useMemo(
2104
+ () => new Set(allOptions.map((o) => o.value)),
2105
+ [allOptions]
2106
+ );
2107
+ const isBuiltInOrderEntryType = (value) => builtInOrderEntryTypes.has(value);
2113
2108
  const mobileOptions = useMemo(() => allOptions, [allOptions]);
2114
2109
  if (!isMobile) {
2115
2110
  const baseButtonClassName = "oui-flex oui-flex-1 oui-items-center oui-justify-center oui-gap-x-1 oui-rounded oui-px-3 oui-py-0.5 oui-text-xs oui-font-semibold oui-h-8";
@@ -2122,8 +2117,22 @@ var OrderTypeSelect = (props) => {
2122
2117
  "oui-bg-base-7 oui-text-base-contrast-36"
2123
2118
  );
2124
2119
  const handleChange = (type) => {
2120
+ props.onExtraSelect?.(null);
2125
2121
  props.onChange(type);
2126
2122
  };
2123
+ const advancedItems = advancedOptions.map((o) => ({
2124
+ value: o.value,
2125
+ label: o.label
2126
+ }));
2127
+ const advancedValue = props.selectedExtraId ?? props.type;
2128
+ const routeAdvancedChange = (value) => {
2129
+ if (isBuiltInOrderEntryType(value)) {
2130
+ props.onExtraSelect?.(null);
2131
+ props.onChange(value);
2132
+ } else {
2133
+ props.onExtraSelect?.(value);
2134
+ }
2135
+ };
2127
2136
  return /* @__PURE__ */ jsxs(
2128
2137
  "div",
2129
2138
  {
@@ -2134,8 +2143,8 @@ var OrderTypeSelect = (props) => {
2134
2143
  "button",
2135
2144
  {
2136
2145
  type: "button",
2137
- className: props.type === OrderType.LIMIT ? selectedButtonClassName : unselectedButtonClassName,
2138
- "aria-pressed": props.type === OrderType.LIMIT,
2146
+ className: !props.selectedExtraId && props.type === OrderType.LIMIT ? selectedButtonClassName : unselectedButtonClassName,
2147
+ "aria-pressed": !props.selectedExtraId && props.type === OrderType.LIMIT,
2139
2148
  onClick: () => handleChange(OrderType.LIMIT),
2140
2149
  disabled: !props.canTrade,
2141
2150
  "data-testid": "oui-testid-orderEntry-orderType-limit",
@@ -2163,8 +2172,8 @@ var OrderTypeSelect = (props) => {
2163
2172
  "button",
2164
2173
  {
2165
2174
  type: "button",
2166
- className: props.type === OrderType.MARKET ? selectedButtonClassName : unselectedButtonClassName,
2167
- "aria-pressed": props.type === OrderType.MARKET,
2175
+ className: !props.selectedExtraId && props.type === OrderType.MARKET ? selectedButtonClassName : unselectedButtonClassName,
2176
+ "aria-pressed": !props.selectedExtraId && props.type === OrderType.MARKET,
2168
2177
  onClick: () => handleChange(OrderType.MARKET),
2169
2178
  disabled: !props.canTrade,
2170
2179
  "data-testid": "oui-testid-orderEntry-orderType-market",
@@ -2177,30 +2186,13 @@ var OrderTypeSelect = (props) => {
2177
2186
  className: "oui-flex-1",
2178
2187
  "data-testid": "oui-testid-orderEntry-orderType-advanced",
2179
2188
  children: /* @__PURE__ */ jsx(
2180
- Select.options,
2189
+ OrderTypeAdvancedSelectInjectabled,
2181
2190
  {
2182
- testid: "oui-testid-orderEntry-orderType-advanced-select",
2183
- currentValue: props.type,
2184
- value: props.type,
2185
- options: advancedOptions,
2186
- onValueChange: props.onChange,
2191
+ items: advancedItems,
2192
+ value: advancedValue,
2187
2193
  placeholder: t("trading.layout.advanced"),
2188
2194
  disabled: !props.canTrade,
2189
- contentProps: {
2190
- className: "oui-bg-base-8"
2191
- },
2192
- classNames: {
2193
- trigger: "oui-bg-base-7 oui-border-none oui-h-8 oui-rounded-md"
2194
- },
2195
- valueFormatter: (value, option) => {
2196
- const isAdvanced = value === OrderType.STOP_LIMIT || value === OrderType.STOP_MARKET || value === OrderType.SCALED || value === OrderType.TRAILING_STOP;
2197
- if (!isAdvanced) {
2198
- return /* @__PURE__ */ jsx(Text, { size: "xs", className: "oui-text-base-contrast-80", children: option.placeholder });
2199
- }
2200
- const label = displayLabelMap[value];
2201
- return /* @__PURE__ */ jsx(Text, { size: "xs", className: "oui-text-base-contrast-80", children: label });
2202
- },
2203
- size: "md"
2195
+ onValueChange: routeAdvancedChange
2204
2196
  }
2205
2197
  )
2206
2198
  }
@@ -2209,7 +2201,16 @@ var OrderTypeSelect = (props) => {
2209
2201
  }
2210
2202
  );
2211
2203
  }
2212
- const handleMobileValueChange = (value) => {
2204
+ const mobileItems = mobileOptions.map((o) => ({
2205
+ value: o.value,
2206
+ label: o.label
2207
+ }));
2208
+ const mobileValue = props.selectedExtraId ?? props.type;
2209
+ const routeMobileChange = (value) => {
2210
+ if (!isBuiltInOrderEntryType(value)) {
2211
+ props.onExtraSelect?.(value);
2212
+ return;
2213
+ }
2213
2214
  if (marketOrderDisabled && value === OrderType.MARKET && marketOrderDisabledTooltip) {
2214
2215
  modal.alert({
2215
2216
  title: t("common.tips"),
@@ -2217,37 +2218,16 @@ var OrderTypeSelect = (props) => {
2217
2218
  });
2218
2219
  return;
2219
2220
  }
2221
+ props.onExtraSelect?.(null);
2220
2222
  props.onChange(value);
2221
2223
  };
2222
2224
  return /* @__PURE__ */ jsx(
2223
- Select.options,
2225
+ OrderTypeMobileSelectInjectabled,
2224
2226
  {
2225
- testid: "oui-testid-orderEntry-orderType-button",
2226
- currentValue: props.type,
2227
- value: props.type,
2228
- options: mobileOptions,
2229
- onValueChange: handleMobileValueChange,
2230
- contentProps: {
2231
- className: cn(
2232
- "oui-orderEntry-orderTypeSelect-content",
2233
- "oui-bg-base-8"
2234
- )
2235
- },
2236
- classNames: {
2237
- trigger: cn(
2238
- "oui-orderEntry-orderTypeSelect-btn",
2239
- "oui-bg-base-7 oui-border-line-12 oui-h-8 oui-rounded-md"
2240
- )
2241
- },
2242
- valueFormatter: (value, option) => {
2243
- const item = allOptions.find((o) => o.value === value);
2244
- if (!item) {
2245
- return /* @__PURE__ */ jsx(Text, { size: "xs", children: option.placeholder });
2246
- }
2247
- const label = displayLabelMap[value];
2248
- return /* @__PURE__ */ jsx(Text, { size: "xs", className: "oui-text-base-contrast-80", children: label });
2249
- },
2250
- size: "md"
2227
+ items: mobileItems,
2228
+ value: mobileValue,
2229
+ disabled: !props.canTrade,
2230
+ onValueChange: routeMobileChange
2251
2231
  }
2252
2232
  );
2253
2233
  };
@@ -2380,6 +2360,64 @@ var QuantitySlider = memo((props) => {
2380
2360
  ] });
2381
2361
  });
2382
2362
  QuantitySlider.displayName = "QuantitySlider";
2363
+ var OrderTypeAdvancedSelect = (props) => /* @__PURE__ */ jsx(
2364
+ Select.options,
2365
+ {
2366
+ testid: "oui-testid-orderEntry-orderType-advanced-select",
2367
+ currentValue: props.value,
2368
+ value: props.value,
2369
+ options: props.items,
2370
+ onValueChange: (v) => props.onValueChange(v),
2371
+ placeholder: props.placeholder,
2372
+ disabled: props.disabled,
2373
+ contentProps: { className: "oui-bg-base-8" },
2374
+ classNames: {
2375
+ trigger: "oui-bg-base-7 oui-border-none oui-h-8 oui-rounded-md"
2376
+ },
2377
+ valueFormatter: (value, option) => {
2378
+ const item = props.items.find((i) => i.value === value);
2379
+ return /* @__PURE__ */ jsx(Text, { size: "xs", className: "oui-text-base-contrast-80", children: item ? item.label : option.placeholder });
2380
+ },
2381
+ size: "md"
2382
+ }
2383
+ );
2384
+ var OrderTypeAdvancedSelectInjectabled = injectable(
2385
+ OrderTypeAdvancedSelect,
2386
+ "Trading.OrderEntry.AdvancedSelect"
2387
+ );
2388
+ var MobileTypeSelect = (props) => /* @__PURE__ */ jsx(
2389
+ Select.options,
2390
+ {
2391
+ testid: "oui-testid-orderEntry-orderType-button",
2392
+ currentValue: props.value,
2393
+ value: props.value,
2394
+ options: props.items,
2395
+ onValueChange: (v) => props.onValueChange(v),
2396
+ disabled: props.disabled,
2397
+ contentProps: {
2398
+ className: cn("oui-orderEntry-orderTypeSelect-content", "oui-bg-base-8")
2399
+ },
2400
+ classNames: {
2401
+ trigger: cn(
2402
+ "oui-orderEntry-orderTypeSelect-btn",
2403
+ "oui-bg-base-7 oui-border-line-12 oui-h-8 oui-rounded-md"
2404
+ )
2405
+ },
2406
+ valueFormatter: (value, option) => {
2407
+ const item = props.items.find((i) => i.value === value);
2408
+ return /* @__PURE__ */ jsx(Text, { size: "xs", className: "oui-text-base-contrast-80", children: item ? item.label : option.placeholder });
2409
+ },
2410
+ size: "md"
2411
+ }
2412
+ );
2413
+ var OrderTypeMobileSelectInjectabled = injectable(
2414
+ MobileTypeSelect,
2415
+ "Trading.OrderEntry.MobileTypeSelect"
2416
+ );
2417
+ var OrderEntryBodyInjectabled = injectable(
2418
+ (props) => /* @__PURE__ */ jsx(Fragment, { children: props.children }),
2419
+ "Trading.OrderEntry.Body"
2420
+ );
2383
2421
  var OrderEntryTypeTabsInjectabled = injectable((props) => {
2384
2422
  return /* @__PURE__ */ jsx("div", { className: "oui-w-full", children: /* @__PURE__ */ jsx(
2385
2423
  OrderTypeSelect,
@@ -2389,7 +2427,9 @@ var OrderEntryTypeTabsInjectabled = injectable((props) => {
2389
2427
  canTrade: props.canTrade,
2390
2428
  onChange: props.onChange,
2391
2429
  marketOrderDisabled: props.marketOrderDisabled,
2392
- marketOrderDisabledTooltip: props.marketOrderDisabledTooltip
2430
+ marketOrderDisabledTooltip: props.marketOrderDisabledTooltip,
2431
+ selectedExtraId: props.selectedExtraId,
2432
+ onExtraSelect: props.onExtraSelect
2393
2433
  }
2394
2434
  ) });
2395
2435
  }, "Trading.OrderEntry.TypeTabs");
@@ -3419,7 +3459,9 @@ function OrderEntryHeader(props) {
3419
3459
  setOrderValue("order_type", type);
3420
3460
  },
3421
3461
  marketOrderDisabled: props.marketOrderDisabled,
3422
- marketOrderDisabledTooltip: props.marketOrderDisabledTooltip
3462
+ marketOrderDisabledTooltip: props.marketOrderDisabledTooltip,
3463
+ selectedExtraId: props.selectedExtraId,
3464
+ onExtraSelect: props.onExtraSelect
3423
3465
  }
3424
3466
  ),
3425
3467
  /* @__PURE__ */ jsx(
@@ -3429,7 +3471,8 @@ function OrderEntryHeader(props) {
3429
3471
  canTrade,
3430
3472
  onSideChange: (nextSide) => {
3431
3473
  props.setOrderValue("side", nextSide);
3432
- }
3474
+ },
3475
+ selectedCustomTypeId: props.selectedExtraId
3433
3476
  }
3434
3477
  )
3435
3478
  ] });
@@ -5654,6 +5697,7 @@ var OrderEntry = (props) => {
5654
5697
  symbol
5655
5698
  } = props;
5656
5699
  const [maxQtyConfirmOpen, setMaxQtyConfirmOpen] = useState(false);
5700
+ const [selectedExtraId, setSelectedExtraId] = useState(null);
5657
5701
  const [permissionlessAcknowledgedKeys, setPermissionlessAcknowledgedKeys] = useLocalStorage("orderly-permissionless-market-notice", []);
5658
5702
  const { t } = useTranslation();
5659
5703
  const { isMobile } = useScreen();
@@ -5880,6 +5924,7 @@ var OrderEntry = (props) => {
5880
5924
  };
5881
5925
  useEffect(() => {
5882
5926
  setHasAdvancedTPSLResult(false);
5927
+ setSelectedExtraId(null);
5883
5928
  }, [props.symbol]);
5884
5929
  const showReduceOnlySection = isMobile && formattedOrder.order_type !== OrderType.LIMIT && formattedOrder.order_type !== OrderType.MARKET || !isMobile;
5885
5930
  const showSoundSection = (Boolean(notification?.orderFilled?.media) || Boolean(notification?.orderFilled?.soundOptions?.length)) && (notification?.orderFilled?.displayInOrderEntry ?? true);
@@ -5947,194 +5992,205 @@ var OrderEntry = (props) => {
5947
5992
  marketOrderDisabled: props.isSymbolPostOnly,
5948
5993
  marketOrderDisabledTooltip: t(
5949
5994
  "orderEntry.orderType.symbolPostOnly.tooltip"
5950
- )
5951
- }
5952
- ),
5953
- /* @__PURE__ */ jsx(
5954
- OrderEntryAvailableInjectabled,
5955
- {
5956
- currentLtv,
5957
- canTrade: props.canTrade,
5958
- quote: symbolInfo?.quote,
5959
- freeCollateral,
5960
- marginMode: props.marginMode
5961
- }
5962
- ),
5963
- /* @__PURE__ */ jsx(
5964
- OrderInput,
5965
- {
5966
- values: formattedOrder,
5967
- priceInputContainerWidth: props.priceInputContainerWidth,
5968
- fillMiddleValue,
5969
- bbo: {
5970
- bboStatus,
5971
- bboType,
5972
- onBBOChange,
5973
- toggleBBO
5974
- }
5975
- }
5976
- ),
5977
- /* @__PURE__ */ jsx(
5978
- OrderEntryQuantitySliderInjectabled,
5979
- {
5980
- canTrade: props.canTrade,
5981
- side: props.side,
5982
- order_quantity: formattedOrder.order_quantity,
5983
- maxQty
5995
+ ),
5996
+ selectedExtraId,
5997
+ onExtraSelect: setSelectedExtraId
5984
5998
  }
5985
5999
  ),
5986
- /* @__PURE__ */ jsx(
5987
- OrderEntrySubmitSectionInjectabled,
6000
+ /* @__PURE__ */ jsxs(
6001
+ OrderEntryBodyInjectabled,
5988
6002
  {
5989
- buttonLabel,
6003
+ symbol: props.symbol,
5990
6004
  side,
5991
- canTrade: props.canTrade,
5992
- isMutating: props.isMutating,
5993
- onSubmit: validateSubmit,
5994
- assetInfo: {
5995
- canTrade: props.canTrade,
5996
- quote: symbolInfo.quote,
5997
- estLiqPrice: props.estLiqPrice,
5998
- estLiqPriceDistance: props.estLiqPriceDistance,
5999
- estLeverage: props.estLeverage,
6000
- currentLeverage: props.currentLeverage,
6001
- slippage,
6002
- dp: symbolInfo.quote_dp,
6003
- setSlippage,
6004
- estSlippage: props.estSlippage,
6005
- orderType: formattedOrder.order_type,
6006
- disableFeatures,
6007
- symbol: props.symbol,
6008
- side
6009
- }
6010
- }
6011
- ),
6012
- /* @__PURE__ */ jsx(Divider, { className: "oui-w-full" }),
6013
- hasAdvancedTPSLResult ? /* @__PURE__ */ jsx(
6014
- AdvancedTPSLResult,
6015
- {
6016
- order: formattedOrder,
6017
- symbolInfo: props.symbolInfo,
6018
- errors: validated ? errors : null,
6019
- onEdit: () => {
6020
- setShowTPSLAdvanced(true);
6021
- },
6022
- onDelete: () => {
6023
- onDeleteAdvancedTPSL();
6024
- }
6025
- }
6026
- ) : /* @__PURE__ */ jsx(
6027
- OrderTPSL,
6028
- {
6029
- quote_dp: props.symbolInfo.quote_dp,
6030
- switchState: props.tpslSwitch,
6031
- onSwitchChanged: props.setTpslSwitch,
6032
- orderType: formattedOrder.order_type,
6033
- errors: validated || props.slPriceError !== void 0 ? { ...errors, ...props.slPriceError } : null,
6034
- setOrderValue: manualSetOrderValue,
6035
- reduceOnlyChecked: formattedOrder.reduce_only ?? false,
6036
- onReduceOnlyChange: (checked) => {
6037
- manualSetOrderValue("reduce_only", checked);
6038
- },
6039
- values: {
6040
- position_type: formattedOrder.position_type ?? PositionType.PARTIAL,
6041
- tp: {
6042
- trigger_price: formattedOrder.tp_trigger_price ?? "",
6043
- PnL: formattedOrder.tp_pnl ?? "",
6044
- Offset: formattedOrder.tp_offset ?? "",
6045
- "Offset%": formattedOrder.tp_offset_percentage ?? "",
6046
- OffsetFromMark: formattedOrder.tp_offset_from_mark ?? "",
6047
- PercentageFromMark: formattedOrder.tp_offset_percentage_from_mark ?? "",
6048
- ROI: formattedOrder.tp_ROI ?? ""
6049
- },
6050
- sl: {
6051
- trigger_price: formattedOrder.sl_trigger_price ?? "",
6052
- PnL: formattedOrder.sl_pnl ?? "",
6053
- Offset: formattedOrder.sl_offset ?? "",
6054
- "Offset%": formattedOrder.sl_offset_percentage ?? "",
6055
- OffsetFromMark: formattedOrder.sl_offset_from_mark ?? "",
6056
- PercentageFromMark: formattedOrder.sl_offset_percentage_from_mark ?? "",
6057
- ROI: formattedOrder.sl_ROI ?? ""
6058
- }
6059
- },
6060
- showTPSLAdvanced: onShowTPSLAdvanced,
6061
- onChange: (key, value) => {
6062
- setOrderValue(key, value);
6063
- }
6064
- }
6065
- ),
6066
- showReduceOnlySection && /* @__PURE__ */ jsxs(
6067
- Flex,
6068
- {
6069
- justify: "between",
6070
- itemAlign: "center",
6071
- className: cn("oui-reduceOnly-container", "oui-mt-2"),
6005
+ selectedCustomTypeId: selectedExtraId,
6072
6006
  children: [
6073
6007
  /* @__PURE__ */ jsx(
6074
- ReduceOnlySwitch,
6008
+ OrderEntryAvailableInjectabled,
6075
6009
  {
6076
- checked: formattedOrder.reduce_only ?? false,
6077
- onCheckedChange: (checked) => {
6078
- manualSetOrderValue("reduce_only", checked);
6010
+ currentLtv,
6011
+ canTrade: props.canTrade,
6012
+ quote: symbolInfo?.quote,
6013
+ freeCollateral,
6014
+ marginMode: props.marginMode
6015
+ }
6016
+ ),
6017
+ /* @__PURE__ */ jsx(
6018
+ OrderInput,
6019
+ {
6020
+ values: formattedOrder,
6021
+ priceInputContainerWidth: props.priceInputContainerWidth,
6022
+ fillMiddleValue,
6023
+ bbo: {
6024
+ bboStatus,
6025
+ bboType,
6026
+ onBBOChange,
6027
+ toggleBBO
6079
6028
  }
6080
6029
  }
6081
6030
  ),
6082
- !showSoundSection && extraButton
6083
- ]
6084
- }
6085
- ),
6086
- showSoundSection && /* @__PURE__ */ jsxs(
6087
- Flex,
6088
- {
6089
- justify: "between",
6090
- itemAlign: "center",
6091
- className: "oui-soundAlert-container",
6092
- children: [
6093
- /* @__PURE__ */ jsxs(Flex, { itemAlign: "center", gapX: 1, children: [
6094
- /* @__PURE__ */ jsx(
6095
- Switch,
6096
- {
6097
- className: cn("oui-soundAlert-switch", "oui-h-[14px]"),
6098
- id: soundAlertId,
6099
- checked: soundAlert,
6100
- onCheckedChange: (checked) => setSoundAlert(checked)
6031
+ /* @__PURE__ */ jsx(
6032
+ OrderEntryQuantitySliderInjectabled,
6033
+ {
6034
+ canTrade: props.canTrade,
6035
+ side: props.side,
6036
+ order_quantity: formattedOrder.order_quantity,
6037
+ maxQty
6038
+ }
6039
+ ),
6040
+ /* @__PURE__ */ jsx(
6041
+ OrderEntrySubmitSectionInjectabled,
6042
+ {
6043
+ buttonLabel,
6044
+ side,
6045
+ canTrade: props.canTrade,
6046
+ isMutating: props.isMutating,
6047
+ onSubmit: validateSubmit,
6048
+ assetInfo: {
6049
+ canTrade: props.canTrade,
6050
+ quote: symbolInfo.quote,
6051
+ estLiqPrice: props.estLiqPrice,
6052
+ estLiqPriceDistance: props.estLiqPriceDistance,
6053
+ estLeverage: props.estLeverage,
6054
+ currentLeverage: props.currentLeverage,
6055
+ slippage,
6056
+ dp: symbolInfo.quote_dp,
6057
+ setSlippage,
6058
+ estSlippage: props.estSlippage,
6059
+ orderType: formattedOrder.order_type,
6060
+ disableFeatures,
6061
+ symbol: props.symbol,
6062
+ side
6101
6063
  }
6102
- ),
6103
- /* @__PURE__ */ jsx(
6104
- "label",
6105
- {
6106
- htmlFor: soundAlertId,
6107
- className: cn("oui-soundAlert-label", "oui-text-xs"),
6108
- children: t("portfolio.setting.soundAlerts")
6064
+ }
6065
+ ),
6066
+ /* @__PURE__ */ jsx(Divider, { className: "oui-w-full" }),
6067
+ hasAdvancedTPSLResult ? /* @__PURE__ */ jsx(
6068
+ AdvancedTPSLResult,
6069
+ {
6070
+ order: formattedOrder,
6071
+ symbolInfo: props.symbolInfo,
6072
+ errors: validated ? errors : null,
6073
+ onEdit: () => {
6074
+ setShowTPSLAdvanced(true);
6075
+ },
6076
+ onDelete: () => {
6077
+ onDeleteAdvancedTPSL();
6109
6078
  }
6110
- )
6111
- ] }),
6112
- extraButton
6113
- ]
6114
- }
6115
- ),
6116
- !showSoundSection && isMobile && (formattedOrder.order_type == OrderType.LIMIT || formattedOrder.order_type == OrderType.MARKET) && !formattedOrder.reduce_only && !pinned && /* @__PURE__ */ jsx(Flex, { className: "oui-w-full", justify: "end", children: extraButton }),
6117
- pinned && /* @__PURE__ */ jsxs(
6118
- Box,
6119
- {
6120
- p: 2,
6121
- r: "md",
6122
- intensity: 700,
6123
- position: "relative",
6124
- className: "oui-additional-container",
6125
- children: [
6126
- /* @__PURE__ */ jsx(AdditionalInfo, { ...additionalInfoProps }),
6127
- /* @__PURE__ */ jsx(
6128
- PinButton,
6079
+ }
6080
+ ) : /* @__PURE__ */ jsx(
6081
+ OrderTPSL,
6129
6082
  {
6130
- onClick: () => {
6131
- setPinned(false);
6083
+ quote_dp: props.symbolInfo.quote_dp,
6084
+ switchState: props.tpslSwitch,
6085
+ onSwitchChanged: props.setTpslSwitch,
6086
+ orderType: formattedOrder.order_type,
6087
+ errors: validated || props.slPriceError !== void 0 ? { ...errors, ...props.slPriceError } : null,
6088
+ setOrderValue: manualSetOrderValue,
6089
+ reduceOnlyChecked: formattedOrder.reduce_only ?? false,
6090
+ onReduceOnlyChange: (checked) => {
6091
+ manualSetOrderValue("reduce_only", checked);
6132
6092
  },
6133
- className: cn(
6134
- "oui-additional-pin-btn",
6135
- "oui-group oui-absolute oui-end-2 oui-top-2"
6136
- ),
6137
- "data-testid": "oui-testid-orderEntry-pinned-button"
6093
+ values: {
6094
+ position_type: formattedOrder.position_type ?? PositionType.PARTIAL,
6095
+ tp: {
6096
+ trigger_price: formattedOrder.tp_trigger_price ?? "",
6097
+ PnL: formattedOrder.tp_pnl ?? "",
6098
+ Offset: formattedOrder.tp_offset ?? "",
6099
+ "Offset%": formattedOrder.tp_offset_percentage ?? "",
6100
+ OffsetFromMark: formattedOrder.tp_offset_from_mark ?? "",
6101
+ PercentageFromMark: formattedOrder.tp_offset_percentage_from_mark ?? "",
6102
+ ROI: formattedOrder.tp_ROI ?? ""
6103
+ },
6104
+ sl: {
6105
+ trigger_price: formattedOrder.sl_trigger_price ?? "",
6106
+ PnL: formattedOrder.sl_pnl ?? "",
6107
+ Offset: formattedOrder.sl_offset ?? "",
6108
+ "Offset%": formattedOrder.sl_offset_percentage ?? "",
6109
+ OffsetFromMark: formattedOrder.sl_offset_from_mark ?? "",
6110
+ PercentageFromMark: formattedOrder.sl_offset_percentage_from_mark ?? "",
6111
+ ROI: formattedOrder.sl_ROI ?? ""
6112
+ }
6113
+ },
6114
+ showTPSLAdvanced: onShowTPSLAdvanced,
6115
+ onChange: (key, value) => {
6116
+ setOrderValue(key, value);
6117
+ }
6118
+ }
6119
+ ),
6120
+ showReduceOnlySection && /* @__PURE__ */ jsxs(
6121
+ Flex,
6122
+ {
6123
+ justify: "between",
6124
+ itemAlign: "center",
6125
+ className: cn("oui-reduceOnly-container", "oui-mt-2"),
6126
+ children: [
6127
+ /* @__PURE__ */ jsx(
6128
+ ReduceOnlySwitch,
6129
+ {
6130
+ checked: formattedOrder.reduce_only ?? false,
6131
+ onCheckedChange: (checked) => {
6132
+ manualSetOrderValue("reduce_only", checked);
6133
+ }
6134
+ }
6135
+ ),
6136
+ !showSoundSection && extraButton
6137
+ ]
6138
+ }
6139
+ ),
6140
+ showSoundSection && /* @__PURE__ */ jsxs(
6141
+ Flex,
6142
+ {
6143
+ justify: "between",
6144
+ itemAlign: "center",
6145
+ className: "oui-soundAlert-container",
6146
+ children: [
6147
+ /* @__PURE__ */ jsxs(Flex, { itemAlign: "center", gapX: 1, children: [
6148
+ /* @__PURE__ */ jsx(
6149
+ Switch,
6150
+ {
6151
+ className: cn("oui-soundAlert-switch", "oui-h-[14px]"),
6152
+ id: soundAlertId,
6153
+ checked: soundAlert,
6154
+ onCheckedChange: (checked) => setSoundAlert(checked)
6155
+ }
6156
+ ),
6157
+ /* @__PURE__ */ jsx(
6158
+ "label",
6159
+ {
6160
+ htmlFor: soundAlertId,
6161
+ className: cn("oui-soundAlert-label", "oui-text-xs"),
6162
+ children: t("portfolio.setting.soundAlerts")
6163
+ }
6164
+ )
6165
+ ] }),
6166
+ extraButton
6167
+ ]
6168
+ }
6169
+ ),
6170
+ pinned && /* @__PURE__ */ jsxs(
6171
+ Box,
6172
+ {
6173
+ p: 2,
6174
+ r: "md",
6175
+ intensity: 700,
6176
+ position: "relative",
6177
+ className: "oui-additional-container",
6178
+ children: [
6179
+ /* @__PURE__ */ jsx(AdditionalInfo, { ...additionalInfoProps }),
6180
+ /* @__PURE__ */ jsx(
6181
+ PinButton,
6182
+ {
6183
+ onClick: () => {
6184
+ setPinned(false);
6185
+ },
6186
+ className: cn(
6187
+ "oui-additional-pin-btn",
6188
+ "oui-group oui-absolute oui-end-2 oui-top-2"
6189
+ ),
6190
+ "data-testid": "oui-testid-orderEntry-pinned-button"
6191
+ }
6192
+ )
6193
+ ]
6138
6194
  }
6139
6195
  )
6140
6196
  ]