@orderly.network/ui-share 2.11.3-rc.0 → 2.12.0-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.d.mts CHANGED
@@ -34,6 +34,7 @@ type SharePnLParams = {
34
34
  refCode?: string;
35
35
  refSlogan?: string;
36
36
  refLink?: string;
37
+ brokerName?: string;
37
38
  };
38
39
  type SharePnLOptions = {
39
40
  /**
@@ -94,6 +95,7 @@ declare const useSharePnLScript: (props: {
94
95
  quoteDp: number | undefined;
95
96
  referralInfo: ReferralType | undefined;
96
97
  shareOptions: SharePnLOptions;
98
+ brokerName: string | undefined;
97
99
  hide: (() => void) | undefined;
98
100
  };
99
101
 
package/dist/index.d.ts CHANGED
@@ -34,6 +34,7 @@ type SharePnLParams = {
34
34
  refCode?: string;
35
35
  refSlogan?: string;
36
36
  refLink?: string;
37
+ brokerName?: string;
37
38
  };
38
39
  type SharePnLOptions = {
39
40
  /**
@@ -94,6 +95,7 @@ declare const useSharePnLScript: (props: {
94
95
  quoteDp: number | undefined;
95
96
  referralInfo: ReferralType | undefined;
96
97
  shareOptions: SharePnLOptions;
98
+ brokerName: string | undefined;
97
99
  hide: (() => void) | undefined;
98
100
  };
99
101
 
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ var React__default = /*#__PURE__*/_interopDefault(React);
16
16
  var useSharePnLScript = (props) => {
17
17
  const { pnl, hide } = props;
18
18
  const entity = pnl?.entity;
19
+ const brokerName = pnl?.brokerName;
19
20
  const symbolInfo = hooks.useSymbolsInfo();
20
21
  const { getFirstRefCode } = hooks.useReferralInfo();
21
22
  const referralInfo = React.useMemo(() => {
@@ -41,6 +42,7 @@ var useSharePnLScript = (props) => {
41
42
  quoteDp: quote_dp,
42
43
  referralInfo,
43
44
  shareOptions: pnl,
45
+ brokerName,
44
46
  hide
45
47
  };
46
48
  };
@@ -66,7 +68,7 @@ var Poster = React.forwardRef((props, parentRef) => {
66
68
  }
67
69
  );
68
70
  });
69
- function getPnLPosterData(position, message, domain, pnlType, options, baseDp, quoteDp, referral) {
71
+ function getPnLPosterData(position, message, domain, pnlType, options, baseDp, quoteDp, referral, brokerName) {
70
72
  const { t } = i18n.useTranslation();
71
73
  const { symbol, currency } = processSymbol(position.symbol);
72
74
  const positionData = {
@@ -75,6 +77,10 @@ function getPnLPosterData(position, message, domain, pnlType, options, baseDp, q
75
77
  side: position.side,
76
78
  marginMode: position.marginMode
77
79
  };
80
+ const normalizedBrokerName = brokerName?.trim();
81
+ if (normalizedBrokerName) {
82
+ positionData["brokerName"] = normalizedBrokerName;
83
+ }
78
84
  switch (pnlType) {
79
85
  case "pnl": {
80
86
  if (position.pnl != null) {
@@ -188,17 +194,16 @@ function getPnLPosterData(position, message, domain, pnlType, options, baseDp, q
188
194
  }
189
195
  function processSymbol(symbol) {
190
196
  const tokens = symbol.split("_");
191
- if (tokens.length !== 3) {
197
+ if (tokens.length < 3) {
192
198
  return {
193
199
  symbol,
194
200
  currency: "USDC"
195
201
  };
196
202
  }
197
- const [symbol1, symbol2, symbol3] = tokens;
198
- const formattedString = `${symbol2}-${symbol1}`;
203
+ const [, base, quote] = tokens;
199
204
  return {
200
- symbol: formattedString,
201
- currency: symbol3 || "USDC"
205
+ symbol: base,
206
+ currency: quote || "USDC"
202
207
  };
203
208
  }
204
209
  function formatShareTime(input) {
@@ -808,7 +813,8 @@ var DesktopSharePnLContent = (props) => {
808
813
  shareOption,
809
814
  props.baseDp,
810
815
  props.quoteDp,
811
- props.referral
816
+ props.referral,
817
+ props.brokerName
812
818
  );
813
819
  const onCopy = () => {
814
820
  posterRef.current?.copy().then(() => {
@@ -1211,7 +1217,8 @@ var MobileSharePnLContent = (props) => {
1211
1217
  shareOption,
1212
1218
  props.baseDp,
1213
1219
  props.quoteDp,
1214
- props.referral
1220
+ props.referral,
1221
+ props.brokerName
1215
1222
  );
1216
1223
  const carouselRef = React.useRef();
1217
1224
  const aspectRatio = 552 / 310;
@@ -1504,7 +1511,15 @@ var ChoicesFillIcon = () => {
1504
1511
  );
1505
1512
  };
1506
1513
  var DesktopSharePnL = (props) => {
1507
- const { entity, baseDp, quoteDp, referralInfo, shareOptions, hide } = props;
1514
+ const {
1515
+ entity,
1516
+ baseDp,
1517
+ quoteDp,
1518
+ referralInfo,
1519
+ shareOptions,
1520
+ hide,
1521
+ brokerName
1522
+ } = props;
1508
1523
  if (!shareOptions || !entity) {
1509
1524
  return null;
1510
1525
  }
@@ -1516,12 +1531,21 @@ var DesktopSharePnL = (props) => {
1516
1531
  baseDp,
1517
1532
  quoteDp,
1518
1533
  referral: referralInfo,
1519
- shareOptions
1534
+ shareOptions,
1535
+ brokerName
1520
1536
  }
1521
1537
  );
1522
1538
  };
1523
1539
  var MobileSharePnL = (props) => {
1524
- const { entity, baseDp, quoteDp, referralInfo, shareOptions, hide } = props;
1540
+ const {
1541
+ entity,
1542
+ baseDp,
1543
+ quoteDp,
1544
+ referralInfo,
1545
+ shareOptions,
1546
+ hide,
1547
+ brokerName
1548
+ } = props;
1525
1549
  if (!shareOptions || !entity) {
1526
1550
  return null;
1527
1551
  }
@@ -1533,7 +1557,8 @@ var MobileSharePnL = (props) => {
1533
1557
  baseDp,
1534
1558
  quoteDp,
1535
1559
  referral: referralInfo,
1536
- shareOptions
1560
+ shareOptions,
1561
+ brokerName
1537
1562
  }
1538
1563
  );
1539
1564
  };