@orderly.network/ui-tpsl 2.9.1 → 2.10.0-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.mjs CHANGED
@@ -300,12 +300,16 @@ var usePNLInputBuilder = (props) => {
300
300
  value2 = `${value2}`;
301
301
  if (value2 === "" || value2 === "-") return "";
302
302
  if (mode === "Offset%" /* PERCENTAGE */) {
303
- return `${new Decimal(
304
- value2.replace(
305
- new RegExp(percentageSuffix.current.replace(".", "\\.") + "$"),
306
- ""
307
- )
308
- ).mul(100).todp(2, 4).toString()}${percentageSuffix.current}`;
303
+ try {
304
+ return `${new Decimal(
305
+ value2.replace(
306
+ new RegExp(percentageSuffix.current.replace(".", "\\.") + "$"),
307
+ ""
308
+ )
309
+ ).mul(100).todp(2, 4).toString()}${percentageSuffix.current}`;
310
+ } catch {
311
+ return "";
312
+ }
309
313
  } else if (mode === "Offset" /* OFFSET */) {
310
314
  value2 = todpIfNeed(value2, dp);
311
315
  } else ;
@@ -324,7 +328,11 @@ var usePNLInputBuilder = (props) => {
324
328
  } else {
325
329
  percentageSuffix.current = "";
326
330
  }
327
- value2 = new Decimal(value2).div(100).toString();
331
+ try {
332
+ value2 = new Decimal(value2).div(100).toString();
333
+ } catch {
334
+ value2 = "";
335
+ }
328
336
  value2 = `${value2}${percentageSuffix.current}`;
329
337
  }
330
338
  } else if (mode === "PnL" /* PnL */ && type === "SL" && focus) {