@agg-build/ui 2.7.3 → 2.8.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.
Files changed (42) hide show
  1. package/dist/{chunk-MZBYIXYA.mjs → chunk-2QCNDFNC.mjs} +193 -103
  2. package/dist/{chunk-EDQ64EKO.mjs → chunk-AKLGQ6AB.mjs} +254 -53
  3. package/dist/{chunk-FMYYPNZZ.mjs → chunk-KO6VTRV6.mjs} +101 -27
  4. package/dist/{chunk-AHQA3B7D.mjs → chunk-KX3TQ7WC.mjs} +1 -1
  5. package/dist/{chunk-7DM45TMO.mjs → chunk-MKU5Q6PN.mjs} +21 -13
  6. package/dist/{chunk-O27JUYCF.mjs → chunk-R5S2QOYL.mjs} +495 -289
  7. package/dist/{chunk-JQKJDSTW.mjs → chunk-VR5ZRDQT.mjs} +3 -2
  8. package/dist/events.js +168 -91
  9. package/dist/events.mjs +3 -3
  10. package/dist/index.js +1315 -746
  11. package/dist/index.mjs +7 -7
  12. package/dist/modals.js +941 -418
  13. package/dist/modals.mjs +3 -3
  14. package/dist/pages.js +978 -609
  15. package/dist/pages.mjs +6 -6
  16. package/dist/primitives.js +94 -26
  17. package/dist/primitives.mjs +1 -1
  18. package/dist/styles.css +1 -1
  19. package/dist/tailwind.css +1 -1
  20. package/dist/trading.js +1403 -902
  21. package/dist/trading.mjs +4 -4
  22. package/dist/types/events/orderbook/orderbook.utils.d.mts +1 -1
  23. package/dist/types/events/orderbook/orderbook.utils.d.ts +1 -1
  24. package/dist/types/pages/user-profile/components/open-order-row.d.mts +1 -0
  25. package/dist/types/pages/user-profile/components/open-order-row.d.ts +1 -0
  26. package/dist/types/pages/user-profile/position-view-model.d.mts +15 -4
  27. package/dist/types/pages/user-profile/position-view-model.d.ts +15 -4
  28. package/dist/types/primitives/select/index.d.mts +1 -1
  29. package/dist/types/primitives/select/index.d.ts +1 -1
  30. package/dist/types/primitives/select/select.types.d.mts +8 -0
  31. package/dist/types/primitives/select/select.types.d.ts +8 -0
  32. package/dist/types/profile/profile-modal.constants.d.mts +2 -1
  33. package/dist/types/profile/profile-modal.constants.d.ts +2 -1
  34. package/dist/types/profile/tabs/balance-management-tab.d.mts +3 -0
  35. package/dist/types/profile/tabs/balance-management-tab.d.ts +3 -0
  36. package/dist/types/trading/place-order/index.place-order.constants.d.mts +2 -1
  37. package/dist/types/trading/place-order/index.place-order.constants.d.ts +2 -1
  38. package/dist/types/trading/place-order/index.place-order.types.d.mts +6 -0
  39. package/dist/types/trading/place-order/index.place-order.types.d.ts +6 -0
  40. package/dist/types/trading/place-order/index.place-order.utils.d.mts +10 -2
  41. package/dist/types/trading/place-order/index.place-order.utils.d.ts +10 -2
  42. package/package.json +3 -3
@@ -10,7 +10,7 @@ import {
10
10
  isErrorWithStatus,
11
11
  useEventListTabs,
12
12
  useEventListTabsHeaderOverflow
13
- } from "./chunk-7DM45TMO.mjs";
13
+ } from "./chunk-MKU5Q6PN.mjs";
14
14
  import {
15
15
  DEPOSIT_MODAL_OPEN_EVENT,
16
16
  PlaceOrder,
@@ -18,10 +18,12 @@ import {
18
18
  WITHDRAW_MODAL_OPEN_EVENT,
19
19
  useClaimWinnings,
20
20
  useResolvedMarketClaim
21
- } from "./chunk-O27JUYCF.mjs";
21
+ } from "./chunk-R5S2QOYL.mjs";
22
22
  import {
23
- getDisplayOutcomePrice
24
- } from "./chunk-JQKJDSTW.mjs";
23
+ getDisplayOutcomePrice,
24
+ resolveHeaderOutcomeItems,
25
+ resolveMarketFromVenueMarkets
26
+ } from "./chunk-VR5ZRDQT.mjs";
25
27
  import {
26
28
  AggErrorBoundary,
27
29
  Button,
@@ -54,7 +56,7 @@ import {
54
56
  skeletonViews,
55
57
  sortCategoriesForNavigation,
56
58
  useOptionalToast
57
- } from "./chunk-FMYYPNZZ.mjs";
59
+ } from "./chunk-KO6VTRV6.mjs";
58
60
 
59
61
  // src/pages/home/index.tsx
60
62
  import {
@@ -1294,7 +1296,7 @@ function SportsLineRail({
1294
1296
  const didInit = React.useRef(false);
1295
1297
  const programmatic = React.useRef(false);
1296
1298
  const progTimer = React.useRef(void 0);
1297
- const skipCenterOnPropSync = React.useRef(false);
1299
+ const skipCenterForIndex = React.useRef(null);
1298
1300
  const pendingScrollIndex = React.useRef(null);
1299
1301
  const scrollSettleTimer = React.useRef(void 0);
1300
1302
  const stopCount = stops.length;
@@ -1334,9 +1336,15 @@ function SportsLineRail({
1334
1336
  if (!w) return;
1335
1337
  const firstW = (_b = (_a = itemRefs.current[0]) == null ? void 0 : _a.offsetWidth) != null ? _b : 0;
1336
1338
  const lastW = (_d = (_c = itemRefs.current[stopCount - 1]) == null ? void 0 : _c.offsetWidth) != null ? _d : 0;
1337
- setPad({
1339
+ const nextPad = {
1338
1340
  left: Math.max(0, w / 2 - firstW / 2),
1339
1341
  right: Math.max(0, w / 2 - lastW / 2)
1342
+ };
1343
+ setPad((currentPad) => {
1344
+ if (currentPad.left === nextPad.left && currentPad.right === nextPad.right) {
1345
+ return currentPad;
1346
+ }
1347
+ return nextPad;
1340
1348
  });
1341
1349
  updateMask();
1342
1350
  };
@@ -1349,7 +1357,7 @@ function SportsLineRail({
1349
1357
  scrollSettleTimer.current = setTimeout(() => {
1350
1358
  const nextIndex = pendingScrollIndex.current;
1351
1359
  if (nextIndex == null || nextIndex === selectedIndex) return;
1352
- skipCenterOnPropSync.current = true;
1360
+ skipCenterForIndex.current = nextIndex;
1353
1361
  onSelect(nextIndex);
1354
1362
  }, 120);
1355
1363
  }
@@ -1373,11 +1381,12 @@ function SportsLineRail({
1373
1381
  const c = scrollRef.current;
1374
1382
  const el = itemRefs.current[selectedIndex];
1375
1383
  if (!c || !el || !c.clientWidth) return;
1376
- if (skipCenterOnPropSync.current) {
1377
- skipCenterOnPropSync.current = false;
1384
+ if (skipCenterForIndex.current === selectedIndex) {
1385
+ skipCenterForIndex.current = null;
1378
1386
  updateMask();
1379
1387
  return;
1380
1388
  }
1389
+ skipCenterForIndex.current = null;
1381
1390
  const max = c.scrollWidth - c.clientWidth;
1382
1391
  const target = el.offsetLeft - c.clientWidth / 2 + el.clientWidth / 2;
1383
1392
  programmatic.current = true;
@@ -1392,11 +1401,18 @@ function SportsLineRail({
1392
1401
  }, 500);
1393
1402
  updateMask();
1394
1403
  }, [selectedIndex, stopCount, pad, updateMask]);
1395
- const select = (index) => {
1396
- const next = Math.min(stops.length - 1, Math.max(0, index));
1404
+ const clampStopIndex = (index) => Math.min(stops.length - 1, Math.max(0, index));
1405
+ const handleStopClick = (index) => {
1406
+ const next = clampStopIndex(index);
1407
+ if (next !== selectedIndex) {
1408
+ skipCenterForIndex.current = next;
1409
+ }
1410
+ onSelect(next);
1411
+ };
1412
+ const handleStep = (delta) => {
1413
+ const next = clampStopIndex(selectedIndex + delta);
1397
1414
  if (next !== selectedIndex) onSelect(next);
1398
1415
  };
1399
- const step = (delta) => select(selectedIndex + delta);
1400
1416
  if (stopCount === 0) return null;
1401
1417
  return /* @__PURE__ */ jsxs2(
1402
1418
  "div",
@@ -1408,7 +1424,7 @@ function SportsLineRail({
1408
1424
  "button",
1409
1425
  {
1410
1426
  type: "button",
1411
- onClick: () => step(-1),
1427
+ onClick: () => handleStep(-1),
1412
1428
  disabled: selectedIndex === 0,
1413
1429
  "aria-label": previousAriaLabel != null ? previousAriaLabel : "Previous line",
1414
1430
  className: "flex size-5! shrink-0 cursor-pointer items-center justify-center text-agg-muted-foreground transition-colors hover:text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary disabled:cursor-not-allowed disabled:opacity-30",
@@ -1431,7 +1447,7 @@ function SportsLineRail({
1431
1447
  ref: (el) => {
1432
1448
  itemRefs.current[index] = el;
1433
1449
  },
1434
- onClick: () => select(index),
1450
+ onClick: () => handleStopClick(index),
1435
1451
  disabled: stop.disabled,
1436
1452
  "aria-pressed": active,
1437
1453
  className: "flex shrink-0 cursor-pointer flex-col items-center gap-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40",
@@ -1477,7 +1493,7 @@ function SportsLineRail({
1477
1493
  "button",
1478
1494
  {
1479
1495
  type: "button",
1480
- onClick: () => step(1),
1496
+ onClick: () => handleStep(1),
1481
1497
  disabled: selectedIndex === stopCount - 1,
1482
1498
  "aria-label": nextAriaLabel != null ? nextAriaLabel : "Next line",
1483
1499
  className: "flex size-5! shrink-0 cursor-pointer items-center justify-center text-agg-muted-foreground transition-colors hover:text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary disabled:cursor-not-allowed disabled:opacity-30",
@@ -1491,15 +1507,81 @@ function SportsLineRail({
1491
1507
 
1492
1508
  // src/pages/event-market/sports-market-card.tsx
1493
1509
  import { jsx as jsx3 } from "react/jsx-runtime";
1494
- var resolveSportsLineOutcomeSide = (outcome) => {
1510
+ var resolveSpreadHeaderOutcomeItems = ({
1511
+ market,
1512
+ groupMarkets,
1513
+ midpointsResult
1514
+ }) => {
1495
1515
  var _a;
1496
- for (const candidate of [outcome.label, outcome.title]) {
1497
- if (typeof candidate !== "string") continue;
1498
- const matchedSide = (_a = candidate.trim().toLowerCase().match(/(?:^|\s)(over|under)(?=\s|$)/)) == null ? void 0 : _a[1];
1499
- if (matchedSide === "over" || matchedSide === "under") return matchedSide;
1500
- }
1516
+ const outcomes = (_a = market.venueMarketOutcomes) != null ? _a : [];
1517
+ const lineValue = market.lineValue;
1518
+ if (outcomes.length < 2 || lineValue == null) return void 0;
1519
+ const { favored, dog } = resolveSpreadOutcomeTeamNames(market, groupMarkets);
1520
+ if (!favored && !dog) return void 0;
1521
+ const magnitude = Math.abs(lineValue);
1522
+ const formatLine = (value) => `${value > 0 ? "+" : "\u2212"}${Number.isInteger(magnitude) ? String(magnitude) : magnitude.toFixed(1)}`;
1523
+ return [
1524
+ { index: 0, name: favored, signedLine: -magnitude },
1525
+ { index: 1, name: dog, signedLine: magnitude }
1526
+ ].flatMap(({ index, name, signedLine }) => {
1527
+ var _a2;
1528
+ const outcome = outcomes[index];
1529
+ if (!outcome) return [];
1530
+ const label = name != null ? name : outcome.label.trim();
1531
+ const probability = midpointsResult == null ? void 0 : getDisplayOutcomePrice({
1532
+ outcomeId: outcome.id,
1533
+ outcomeLabel: outcome.label,
1534
+ bestMidpointsByOutcomeId: (_a2 = midpointsResult.bestMidpointsByOutcomeId) != null ? _a2 : midpointsResult.prices
1535
+ });
1536
+ return [
1537
+ {
1538
+ id: outcome.id,
1539
+ label,
1540
+ title: label,
1541
+ lineLabel: formatLine(signedLine),
1542
+ probability,
1543
+ isPriceLoading: (midpointsResult == null ? void 0 : midpointsResult.isLoading) === true && probability == null,
1544
+ tone: index === 0 ? "positive" : "negative",
1545
+ variant: "line",
1546
+ venue: market.venue
1547
+ }
1548
+ ];
1549
+ });
1550
+ };
1551
+ var resolveDisplayedOutcomes = ({
1552
+ market,
1553
+ venueMarkets,
1554
+ groupMarkets,
1555
+ useSpreadOverride
1556
+ }) => {
1557
+ var _a;
1558
+ const spreadHeaderOutcomeItems = useSpreadOverride ? resolveSpreadHeaderOutcomeItems({ market, groupMarkets }) : void 0;
1559
+ const resolvedMarket = resolveMarketFromVenueMarkets(venueMarkets, market.id);
1560
+ const headerOutcomeItems = spreadHeaderOutcomeItems != null ? spreadHeaderOutcomeItems : resolveHeaderOutcomeItems(
1561
+ (_a = resolvedMarket == null ? void 0 : resolvedMarket.venueMarkets) != null ? _a : [market],
1562
+ market,
1563
+ resolveSportsMarketCardVariant(market)
1564
+ );
1565
+ return headerOutcomeItems.flatMap((item) => {
1566
+ const outcome = market.venueMarketOutcomes.find((candidate) => candidate.id === item.id);
1567
+ return outcome ? [outcome] : [];
1568
+ });
1569
+ };
1570
+ var resolveSelectedOutcomeSide = ({
1571
+ displayedOutcomes,
1572
+ selectedOutcomeId
1573
+ }) => {
1574
+ const selectedOutcomeIndex = displayedOutcomes.findIndex(
1575
+ (outcome) => outcome.id === selectedOutcomeId
1576
+ );
1577
+ if (selectedOutcomeIndex === 0) return "left";
1578
+ if (selectedOutcomeIndex === 1) return "right";
1501
1579
  return null;
1502
1580
  };
1581
+ var resolveOutcomeBySide = (displayedOutcomes, side) => {
1582
+ var _a;
1583
+ return (_a = displayedOutcomes[side === "right" ? 1 : 0]) != null ? _a : displayedOutcomes[0];
1584
+ };
1503
1585
  var SportsMarketCard = ({
1504
1586
  group,
1505
1587
  venueMarkets,
@@ -1617,69 +1699,46 @@ var SportsMarketCard = ({
1617
1699
  });
1618
1700
  }, [combinedMoneylineMarkets, isCombinedMoneylineGroup, midpointsResult]);
1619
1701
  const spreadHeaderOutcomeItems = useMemo(() => {
1620
- var _a2;
1621
1702
  if (slide.kind !== "spread" || !activeMarket) return void 0;
1622
- const outcomes = (_a2 = activeMarket.venueMarketOutcomes) != null ? _a2 : [];
1623
- const lineValue = activeMarket.lineValue;
1624
- if (outcomes.length < 2 || lineValue == null) return void 0;
1625
- const { favored, dog } = resolveSpreadOutcomeTeamNames(activeMarket, group.markets);
1626
- if (!favored && !dog) return void 0;
1627
- const magnitude = Math.abs(lineValue);
1628
- const formatLine = (value) => `${value > 0 ? "+" : "\u2212"}${Number.isInteger(magnitude) ? String(magnitude) : magnitude.toFixed(1)}`;
1629
- return [
1630
- { index: 0, name: favored, signedLine: -magnitude },
1631
- { index: 1, name: dog, signedLine: magnitude }
1632
- ].flatMap(({ index, name, signedLine }) => {
1633
- var _a3;
1634
- const outcome = outcomes[index];
1635
- if (!outcome) return [];
1636
- const label = name != null ? name : outcome.label.trim();
1637
- const probability = midpointsResult == null ? void 0 : getDisplayOutcomePrice({
1638
- outcomeId: outcome.id,
1639
- outcomeLabel: outcome.label,
1640
- bestMidpointsByOutcomeId: (_a3 = midpointsResult.bestMidpointsByOutcomeId) != null ? _a3 : midpointsResult.prices
1641
- });
1642
- return [
1643
- {
1644
- id: outcome.id,
1645
- label,
1646
- title: label,
1647
- lineLabel: formatLine(signedLine),
1648
- probability,
1649
- isPriceLoading: (midpointsResult == null ? void 0 : midpointsResult.isLoading) === true && probability == null,
1650
- tone: index === 0 ? "positive" : "negative",
1651
- variant: "line",
1652
- venue: activeMarket.venue
1653
- }
1654
- ];
1703
+ return resolveSpreadHeaderOutcomeItems({
1704
+ market: activeMarket,
1705
+ groupMarkets: group.markets,
1706
+ midpointsResult
1655
1707
  });
1656
1708
  }, [slide.kind, activeMarket, group.markets, midpointsResult]);
1657
1709
  const headerOutcomeItemsOverride = combinedMoneylineHeaderOutcomeItems != null ? combinedMoneylineHeaderOutcomeItems : spreadHeaderOutcomeItems;
1658
1710
  const headerOutcomeVariant = isCombinedMoneylineGroup ? "outcome" : resolveSportsMarketCardVariant(activeMarket);
1659
1711
  const handleLineSelect = (index) => {
1660
- var _a2, _b2;
1661
- const previousMarket = activeMarket;
1712
+ var _a2, _b2, _c2;
1713
+ const targetMarket = (_a2 = slide.stops[index]) == null ? void 0 : _a2.market;
1714
+ if (!targetMarket) return;
1715
+ const selectedMarket = (_c2 = (_b2 = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b2 : venueMarkets.find((market) => market.id === (tradingContext == null ? void 0 : tradingContext.selectedMarketId))) != null ? _c2 : null;
1716
+ const selectedMarketIsInGroup = selectedMarket != null && group.markets.some((market) => market.id === selectedMarket.id);
1717
+ const selectedSide = selectedMarket ? resolveSelectedOutcomeSide({
1718
+ displayedOutcomes: resolveDisplayedOutcomes({
1719
+ market: selectedMarket,
1720
+ venueMarkets,
1721
+ groupMarkets: group.markets,
1722
+ useSpreadOverride: slide.kind === "spread" && selectedMarketIsInGroup
1723
+ }),
1724
+ selectedOutcomeId: tradingContext == null ? void 0 : tradingContext.selectedOutcomeId
1725
+ }) : null;
1726
+ const targetDisplayedOutcomes = resolveDisplayedOutcomes({
1727
+ market: targetMarket,
1728
+ venueMarkets,
1729
+ groupMarkets: group.markets,
1730
+ useSpreadOverride: slide.kind === "spread"
1731
+ });
1732
+ const nextOutcome = resolveOutcomeBySide(targetDisplayedOutcomes, selectedSide != null ? selectedSide : "left");
1662
1733
  setSelectedLineIndex(index);
1663
- const market = (_a2 = slide.stops[index]) == null ? void 0 : _a2.market;
1664
- if (!market) return;
1665
- const previousOutcomeIndex = previousMarket ? previousMarket.venueMarketOutcomes.findIndex(
1666
- (outcome) => outcome.id === (tradingContext == null ? void 0 : tradingContext.selectedOutcomeId)
1667
- ) : -1;
1668
- const previousOutcome = previousOutcomeIndex >= 0 ? previousMarket == null ? void 0 : previousMarket.venueMarketOutcomes[previousOutcomeIndex] : void 0;
1669
- const previousOutcomeSide = previousOutcome ? resolveSportsLineOutcomeSide(previousOutcome) : null;
1670
- const matchingSideOutcomes = previousOutcomeSide ? market.venueMarketOutcomes.filter(
1671
- (outcome) => resolveSportsLineOutcomeSide(outcome) === previousOutcomeSide
1672
- ) : [];
1673
- const matchingSideOutcome = matchingSideOutcomes.length === 1 ? matchingSideOutcomes[0] : void 0;
1674
- const nextOutcome = (_b2 = matchingSideOutcome != null ? matchingSideOutcome : previousOutcomeIndex >= 0 ? market.venueMarketOutcomes[previousOutcomeIndex] : void 0) != null ? _b2 : market.venueMarketOutcomes[0];
1675
1734
  if (nextOutcome) {
1676
- tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(market.id, nextOutcome.id);
1735
+ tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(targetMarket.id, nextOutcome.id);
1677
1736
  onOutcomeSelect == null ? void 0 : onOutcomeSelect(group.id, {
1678
- marketId: market.id,
1737
+ marketId: targetMarket.id,
1679
1738
  outcomeId: nextOutcome.id
1680
1739
  });
1681
1740
  } else {
1682
- tradingContext == null ? void 0 : tradingContext.selectMarket(market.id, market);
1741
+ tradingContext == null ? void 0 : tradingContext.selectMarket(targetMarket.id, targetMarket);
1683
1742
  }
1684
1743
  };
1685
1744
  return /* @__PURE__ */ jsx3(
@@ -3501,7 +3560,7 @@ var ClaimActivityBreakdownModal = ({
3501
3560
  };
3502
3561
 
3503
3562
  // src/pages/user-profile/components/positions-activity.tsx
3504
- import { optimizedImageUrl as optimizedImageUrl3, useLabels as useLabels9 } from "@agg-build/hooks";
3563
+ import { optimizedImageUrl as optimizedImageUrl3, useAggUiConfig as useAggUiConfig2, useLabels as useLabels9 } from "@agg-build/hooks";
3505
3564
  import { Fragment as Fragment4, useEffect as useEffect9, useMemo as useMemo6, useRef as useRef8, useState as useState10 } from "react";
3506
3565
 
3507
3566
  // src/pages/user-profile/user-profile.constants.ts
@@ -3551,17 +3610,19 @@ var parsePercentLabel = (label) => {
3551
3610
  const parsed = Number(match[1].replace(/,/g, ""));
3552
3611
  return Number.isFinite(parsed) ? parsed : null;
3553
3612
  };
3554
- var formatCurrency = (value) => {
3613
+ var formatCurrency = (value, formatCurrencyOverride) => {
3555
3614
  if (!isFiniteNumber(value)) return missingLabel;
3615
+ if (formatCurrencyOverride) return formatCurrencyOverride(value);
3556
3616
  return usdFormatter.format(value);
3557
3617
  };
3558
- var formatSignedCurrency = (value) => {
3618
+ var formatSignedCurrency = (value, formatCurrencyOverride) => {
3559
3619
  if (!isFiniteNumber(value)) return missingLabel;
3560
- if (value === 0) return usdFormatter.format(0);
3561
- return `${value > 0 ? "+" : "-"}${usdFormatter.format(Math.abs(value))}`;
3620
+ if (value === 0) return formatCurrency(0, formatCurrencyOverride);
3621
+ return `${value > 0 ? "+" : "-"}${formatCurrency(Math.abs(value), formatCurrencyOverride)}`;
3562
3622
  };
3563
- var formatPriceCents = (value) => {
3623
+ var formatPriceCents = (value, formatPrice) => {
3564
3624
  if (!isFiniteNumber(value)) return missingLabel;
3625
+ if (formatPrice) return formatPrice(value);
3565
3626
  return `${Math.round(value * 100)}\xA2`;
3566
3627
  };
3567
3628
  var formatSignedPercent = (value) => {
@@ -3656,7 +3717,8 @@ var getPositionTone = (value) => {
3656
3717
  if (!isFiniteNumber(value) || value === 0) return "neutral";
3657
3718
  return value > 0 ? "positive" : "negative";
3658
3719
  };
3659
- var toPositionRowViewModel = (position, labels = defaultLabels) => {
3720
+ var toPositionRowViewModel = (position, labels = defaultLabels, formatters = {}) => {
3721
+ const { formatCurrency: currency, formatPrice: price } = formatters;
3660
3722
  const positionStatus = resolvePositionStatus(position);
3661
3723
  const currentValue = getCurrentValue(position);
3662
3724
  const currentPnl = getPnlValue(position, currentValue);
@@ -3674,20 +3736,20 @@ var toPositionRowViewModel = (position, labels = defaultLabels) => {
3674
3736
  resolutionLabel: position.resolutionLabel || position.outcomeLabel || missingLabel,
3675
3737
  venueShareBreakdown: position.venueShareBreakdown,
3676
3738
  totalTraded: {
3677
- primaryLabel: formatCurrency(getTotalTradedValue(position)),
3678
- averageLabel: `${labels.avgPrefix} ${formatPriceCents(getAveragePrice(position))}`
3739
+ primaryLabel: formatCurrency(getTotalTradedValue(position), currency),
3740
+ averageLabel: `${labels.avgPrefix} ${formatPriceCents(getAveragePrice(position), price)}`
3679
3741
  },
3680
3742
  currentValue: {
3681
- primaryLabel: formatCurrency(currentValue),
3682
- deltaLabel: formatSignedCurrency(currentPnl),
3683
- priceLabel: `${labels.nowPrefix} ${formatPriceCents(getCurrentPrice(position))}`,
3743
+ primaryLabel: formatCurrency(currentValue, currency),
3744
+ deltaLabel: formatSignedCurrency(currentPnl, currency),
3745
+ priceLabel: `${labels.nowPrefix} ${formatPriceCents(getCurrentPrice(position), price)}`,
3684
3746
  percentLabel: formatSignedPercent(currentPercent),
3685
3747
  tone: getPositionTone(currentPnl)
3686
3748
  },
3687
3749
  payout: {
3688
- primaryLabel: formatCurrency(finalPayout),
3689
- deltaLabel: formatSignedCurrency(payoutPnl),
3690
- priceLabel: `${labels.finalPrefix} ${formatPriceCents(getFinalPrice(position))}`,
3750
+ primaryLabel: formatCurrency(finalPayout, currency),
3751
+ deltaLabel: formatSignedCurrency(payoutPnl, currency),
3752
+ priceLabel: `${labels.finalPrefix} ${formatPriceCents(getFinalPrice(position), price)}`,
3691
3753
  percentLabel: formatSignedPercent(payoutPercent),
3692
3754
  tone: getPositionTone(payoutPnl)
3693
3755
  },
@@ -4294,6 +4356,19 @@ import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
4294
4356
  var shouldUseNativeLinkNavigation2 = (event) => {
4295
4357
  return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
4296
4358
  };
4359
+ var CANCELLABLE_LIMIT_ORDER_STATUSES = /* @__PURE__ */ new Set([
4360
+ "submitted",
4361
+ "open",
4362
+ "partially_filled_open",
4363
+ "cancel_pending"
4364
+ ]);
4365
+ var canCancelOpenOrder = (order) => {
4366
+ const status = order.status.trim().toLowerCase();
4367
+ if (status === "pending" && !order.dagRunId) return true;
4368
+ const isLimitOrder = order.orderType === "limit" || order.limitPriceLabel != null;
4369
+ if (!isLimitOrder) return false;
4370
+ return CANCELLABLE_LIMIT_ORDER_STATUSES.has(status);
4371
+ };
4297
4372
  var OpenOrderRow = ({
4298
4373
  order,
4299
4374
  href,
@@ -4329,9 +4404,7 @@ var OpenOrderRow = ({
4329
4404
  event.stopPropagation();
4330
4405
  onCancel == null ? void 0 : onCancel(order);
4331
4406
  };
4332
- const status = order.status.toLowerCase();
4333
- const isLimitOrder = order.orderType === "limit";
4334
- const canCancel = status === "open" || status === "partially_filled_open" || status === "cancel_pending" || status === "submitted" && isLimitOrder || status === "pending" && !order.dagRunId;
4407
+ const canCancel = canCancelOpenOrder(order);
4335
4408
  const Wrapper = href ? "a" : "div";
4336
4409
  const wrapperProps = href ? {
4337
4410
  href,
@@ -4418,7 +4491,7 @@ var OpenOrderRow = ({
4418
4491
  OpenOrderRow.displayName = "OpenOrderRow";
4419
4492
 
4420
4493
  // src/pages/user-profile/components/position-row.tsx
4421
- import { optimizedImageUrl as optimizedImageUrl2, useLabels as useLabels8 } from "@agg-build/hooks";
4494
+ import { optimizedImageUrl as optimizedImageUrl2, useAggUiConfig, useLabels as useLabels8 } from "@agg-build/hooks";
4422
4495
  import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
4423
4496
  var shouldUseNativeLinkNavigation3 = (event) => {
4424
4497
  return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
@@ -4557,11 +4630,16 @@ var PositionRow = ({
4557
4630
  isClaiming = false
4558
4631
  }) => {
4559
4632
  const labels = useLabels8().userProfile.positions;
4560
- const model = toPositionRowViewModel(position, {
4561
- avgPrefix: labels.avgPrefix,
4562
- nowPrefix: labels.nowPrefix,
4563
- finalPrefix: labels.finalPrefix
4564
- });
4633
+ const { formatCurrency: formatCurrency2, formatPrice } = useAggUiConfig().formatting;
4634
+ const model = toPositionRowViewModel(
4635
+ position,
4636
+ {
4637
+ avgPrefix: labels.avgPrefix,
4638
+ nowPrefix: labels.nowPrefix,
4639
+ finalPrefix: labels.finalPrefix
4640
+ },
4641
+ { formatCurrency: formatCurrency2, formatPrice }
4642
+ );
4565
4643
  const isClosed = (variant != null ? variant : model.bucket) === "closed";
4566
4644
  const handleClaim = (event) => {
4567
4645
  event.preventDefault();
@@ -4782,6 +4860,7 @@ var PositionsActivity = ({
4782
4860
  const userProfileLabels = useLabels9().userProfile;
4783
4861
  const positionsLabels = userProfileLabels.positions;
4784
4862
  const openOrdersLabels = userProfileLabels.openOrders;
4863
+ const { formatCurrency: formatCurrency2, formatPrice } = useAggUiConfig2().formatting;
4785
4864
  const tabItems = useMemo6(
4786
4865
  () => getTabItems(userProfileLabels.tabs, showOpenOrders),
4787
4866
  [showOpenOrders, userProfileLabels.tabs]
@@ -4860,14 +4939,25 @@ var PositionsActivity = ({
4860
4939
  title: position.title,
4861
4940
  thumbnailSrc: position.thumbnailSrc,
4862
4941
  metaPrimary: position.outcomeLabel,
4863
- metaSecondary: toPositionRowViewModel(position, {
4864
- avgPrefix: positionsLabels.avgPrefix,
4865
- nowPrefix: positionsLabels.nowPrefix,
4866
- finalPrefix: positionsLabels.finalPrefix
4867
- }).currentValue.primaryLabel,
4942
+ metaSecondary: toPositionRowViewModel(
4943
+ position,
4944
+ {
4945
+ avgPrefix: positionsLabels.avgPrefix,
4946
+ nowPrefix: positionsLabels.nowPrefix,
4947
+ finalPrefix: positionsLabels.finalPrefix
4948
+ },
4949
+ { formatCurrency: formatCurrency2, formatPrice }
4950
+ ).currentValue.primaryLabel,
4868
4951
  raw: position
4869
4952
  }));
4870
- }, [filteredPositions, isPositionsTab, positionsLabels, searchValue]);
4953
+ }, [
4954
+ filteredPositions,
4955
+ formatCurrency2,
4956
+ formatPrice,
4957
+ isPositionsTab,
4958
+ positionsLabels,
4959
+ searchValue
4960
+ ]);
4871
4961
  const handleSearchChange = (event) => {
4872
4962
  setSearchValue(event.target.value);
4873
4963
  };