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