@agg-build/ui 1.0.2 → 1.2.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 (45) hide show
  1. package/README.md +1 -1
  2. package/dist/{chunk-TLGQ4LID.mjs → chunk-34L7ZKJW.mjs} +836 -771
  3. package/dist/{chunk-YSCHNVBZ.mjs → chunk-5FXMHTVR.mjs} +2 -2
  4. package/dist/{chunk-3IY2GA2D.mjs → chunk-CDQZJPHQ.mjs} +604 -353
  5. package/dist/{chunk-4ILR2YH3.mjs → chunk-EGCVA2AQ.mjs} +23 -8
  6. package/dist/{chunk-XDZLCWUZ.mjs → chunk-FDTLV74F.mjs} +130 -28
  7. package/dist/{chunk-WFS772A3.mjs → chunk-Q2BRDVBU.mjs} +1 -1
  8. package/dist/{chunk-PEVG67XU.mjs → chunk-TBKDLNOE.mjs} +27 -16
  9. package/dist/events.js +987 -901
  10. package/dist/events.mjs +3 -3
  11. package/dist/index.js +3021 -2576
  12. package/dist/index.mjs +19 -15
  13. package/dist/modals.js +848 -788
  14. package/dist/modals.mjs +3 -3
  15. package/dist/pages.js +2298 -1857
  16. package/dist/pages.mjs +6 -6
  17. package/dist/primitives.js +832 -768
  18. package/dist/primitives.mjs +5 -1
  19. package/dist/styles.css +1 -1
  20. package/dist/tailwind.css +1 -1
  21. package/dist/trading.js +937 -654
  22. package/dist/trading.mjs +4 -4
  23. package/dist/types/events/market-details/index.d.mts +1 -1
  24. package/dist/types/events/market-details/index.d.ts +1 -1
  25. package/dist/types/events/market-details/market-details.types.d.mts +11 -0
  26. package/dist/types/events/market-details/market-details.types.d.ts +11 -0
  27. package/dist/types/pages/user-profile/components/available-balance-card.d.mts +0 -1
  28. package/dist/types/pages/user-profile/components/available-balance-card.d.ts +0 -1
  29. package/dist/types/pages/user-profile/position-view-model.d.mts +54 -0
  30. package/dist/types/pages/user-profile/position-view-model.d.ts +54 -0
  31. package/dist/types/pages/user-profile/user-profile.types.d.mts +22 -0
  32. package/dist/types/pages/user-profile/user-profile.types.d.ts +22 -0
  33. package/dist/types/primitives/icon/icon.types.d.mts +1 -2
  34. package/dist/types/primitives/icon/icon.types.d.ts +1 -2
  35. package/dist/types/primitives/icon/index.d.mts +3 -1
  36. package/dist/types/primitives/icon/index.d.ts +3 -1
  37. package/dist/types/primitives/icon/registry.d.mts +8 -0
  38. package/dist/types/primitives/icon/registry.d.ts +8 -0
  39. package/dist/types/primitives/icon/svg/hourglass-start.d.mts +5 -0
  40. package/dist/types/primitives/icon/svg/hourglass-start.d.ts +5 -0
  41. package/dist/types/primitives/icon/svg/lock.d.mts +5 -0
  42. package/dist/types/primitives/icon/svg/lock.d.ts +5 -0
  43. package/dist/types/shared/utils.d.mts +5 -1
  44. package/dist/types/shared/utils.d.ts +5 -1
  45. package/package.json +3 -3
@@ -21,7 +21,7 @@ import {
21
21
  resolveUnifiedOrderBookEntries,
22
22
  sortOutcomeSelectorOutcomes,
23
23
  useEventTradingContext
24
- } from "./chunk-PEVG67XU.mjs";
24
+ } from "./chunk-TBKDLNOE.mjs";
25
25
  import {
26
26
  AutocompleteSelect,
27
27
  Badge,
@@ -73,7 +73,7 @@ import {
73
73
  sortMarketsByYesOddsDesc,
74
74
  sortOutcomes,
75
75
  splitEventsByLifecycle
76
- } from "./chunk-TLGQ4LID.mjs";
76
+ } from "./chunk-34L7ZKJW.mjs";
77
77
 
78
78
  // src/events/item/index.tsx
79
79
  import {
@@ -2960,7 +2960,7 @@ var MarketDetailsOutcomeButton = ({
2960
2960
  as: "span",
2961
2961
  variant: isSelected ? "body-strong" : "body",
2962
2962
  className: cn("whitespace-nowrap truncate", classNames.text),
2963
- children: item.label
2963
+ children: item.title
2964
2964
  }
2965
2965
  ),
2966
2966
  /* @__PURE__ */ jsx8(
@@ -3046,6 +3046,7 @@ var MarketDetailsContent = ({
3046
3046
  ariaLabel,
3047
3047
  classNames,
3048
3048
  otherContent,
3049
+ onOutcomeSelect,
3049
3050
  live,
3050
3051
  midpointsFallback,
3051
3052
  midpointsFallbackVenues
@@ -3329,10 +3330,16 @@ var MarketDetailsContent = ({
3329
3330
  const orderBookErrorDescription = isSnapshotUnavailableError ? labels.marketDetails.orderBookUnavailableDescription : typeof orderBookError === "object" && orderBookError != null && "message" in orderBookError && typeof orderBookError.message === "string" && orderBookError.message.trim().length > 0 ? orderBookError.message : labels.marketDetails.orderBookUnavailableDescription;
3330
3331
  const hasNoOrderBook = isOrderBookNotFound && !isMarketResolved || !isOrderBookLoading && !hasOrderBookError && (selectedOutcomesByVenue.length === 0 || aggregatedOrderbookRows.hasNoOrderBook);
3331
3332
  const hasChartError = !!marketChartError;
3332
- const selectHeaderOutcome = (item) => {
3333
+ const selectHeaderOutcome = ({
3334
+ item,
3335
+ shouldNotifyOutcomeSelect = false
3336
+ }) => {
3333
3337
  if (isOutcomeSelectionLocked) return;
3334
3338
  if (item == null ? void 0 : item.id) {
3335
3339
  tradingContext == null ? void 0 : tradingContext.selectOutcome(item.id);
3340
+ if (shouldNotifyOutcomeSelect && model) {
3341
+ onOutcomeSelect == null ? void 0 : onOutcomeSelect({ marketId: model.market.id, outcomeId: item.id });
3342
+ }
3336
3343
  }
3337
3344
  };
3338
3345
  const handleOutcomeKeyDown = (eventToHandle) => {
@@ -3346,16 +3353,19 @@ var MarketDetailsContent = ({
3346
3353
  return item.label === selectedOutcomeLabel;
3347
3354
  });
3348
3355
  if (eventToHandle.key === "Home") {
3349
- selectHeaderOutcome(headerOutcomeItems[0]);
3356
+ selectHeaderOutcome({ item: headerOutcomeItems[0], shouldNotifyOutcomeSelect: true });
3350
3357
  return;
3351
3358
  }
3352
3359
  if (eventToHandle.key === "End") {
3353
- selectHeaderOutcome(headerOutcomeItems[headerOutcomeItems.length - 1]);
3360
+ selectHeaderOutcome({
3361
+ item: headerOutcomeItems[headerOutcomeItems.length - 1],
3362
+ shouldNotifyOutcomeSelect: true
3363
+ });
3354
3364
  return;
3355
3365
  }
3356
3366
  const direction = eventToHandle.key === "ArrowRight" ? 1 : -1;
3357
3367
  const nextIndex = activeIndex < 0 ? 0 : (activeIndex + direction + headerOutcomeItems.length) % headerOutcomeItems.length;
3358
- selectHeaderOutcome(headerOutcomeItems[nextIndex]);
3368
+ selectHeaderOutcome({ item: headerOutcomeItems[nextIndex], shouldNotifyOutcomeSelect: true });
3359
3369
  };
3360
3370
  const handleToggleExpanded = () => {
3361
3371
  if (!marketId) return;
@@ -3585,7 +3595,10 @@ var MarketDetailsContent = ({
3585
3595
  const selectedOutcomeItem = headerOutcomeItems.find(
3586
3596
  (headerOutcomeItem) => headerOutcomeItem.label === label
3587
3597
  );
3588
- selectHeaderOutcome(selectedOutcomeItem);
3598
+ selectHeaderOutcome({
3599
+ item: selectedOutcomeItem,
3600
+ shouldNotifyOutcomeSelect: true
3601
+ });
3589
3602
  }
3590
3603
  },
3591
3604
  item.label
@@ -3899,6 +3912,7 @@ var MarketDetailsList = ({
3899
3912
  markets: providedMarkets,
3900
3913
  eventTradingState,
3901
3914
  onClick,
3915
+ onOutcomeSelect,
3902
3916
  onExpandedMarketChange,
3903
3917
  defaultTab,
3904
3918
  classNames,
@@ -4092,6 +4106,7 @@ var MarketDetailsList = ({
4092
4106
  onClick == null ? void 0 : onClick(market);
4093
4107
  handleToggle(marketId, market);
4094
4108
  },
4109
+ onOutcomeSelect,
4095
4110
  defaultTab,
4096
4111
  ariaLabel: market.question,
4097
4112
  classNames: { root: cn("agg-market-list-item", classNames == null ? void 0 : classNames.item) },
@@ -7,10 +7,10 @@ import {
7
7
  getTradingValueLabel,
8
8
  getTradingVenueLabel,
9
9
  resolveOrderEligibilityMessage
10
- } from "./chunk-PEVG67XU.mjs";
10
+ } from "./chunk-TBKDLNOE.mjs";
11
11
  import {
12
12
  GeoBlockBanner
13
- } from "./chunk-YSCHNVBZ.mjs";
13
+ } from "./chunk-5FXMHTVR.mjs";
14
14
  import {
15
15
  AGG_TERMS_OF_SERVICE_URL,
16
16
  Button,
@@ -25,6 +25,7 @@ import {
25
25
  RemoteImage,
26
26
  Skeleton,
27
27
  SuccessCheckIcon,
28
+ Tooltip,
28
29
  Typography,
29
30
  UserTrustIcon,
30
31
  VenueLogo,
@@ -36,7 +37,7 @@ import {
36
37
  getMotionClassName,
37
38
  normalizeVenueMarketCluster,
38
39
  skeletonViews
39
- } from "./chunk-TLGQ4LID.mjs";
40
+ } from "./chunk-34L7ZKJW.mjs";
40
41
 
41
42
  // src/trading/types.ts
42
43
  import { Venue, enumGuard, isFiniteNonNeg, safeParse } from "@agg-build/sdk";
@@ -456,14 +457,14 @@ var buildLiveRouteCards = ({
456
457
  const isPrimaryRouteGeoBlocked = quoteData.fills.length > 0 && quoteData.fills.every((f) => geoBlockedVenues.has(f.venue));
457
458
  const primaryCard = primaryResult ? isPrimaryRouteGeoBlocked ? {
458
459
  id: "live-route",
459
- hint: "",
460
+ hint: labels.venueUnavailableInRegion,
460
461
  kind: "venue",
461
462
  label: getTradingVenueLabel(
462
463
  parsedPrimaryVenue.success ? parsedPrimaryVenue.data : void 0
463
464
  ),
464
- numericValue: 0,
465
+ numericValue: tradeSide === "sell" ? quoteData.rawExecCost : quoteData.totalFilled,
465
466
  quoteData,
466
- value: "",
467
+ value: primaryResult.value,
467
468
  venue: parsedPrimaryVenue.success ? parsedPrimaryVenue.data : void 0,
468
469
  isUnavailable: true
469
470
  } : {
@@ -488,12 +489,16 @@ var buildLiveRouteCards = ({
488
489
  if (geoBlockedVenues.has(sq.venue)) {
489
490
  return {
490
491
  id: `live-unavailable-${sq.venue}`,
491
- hint: "",
492
+ hint: labels.venueUnavailableInRegion,
492
493
  kind: "venue",
493
494
  label: getTradingVenueLabel(venue),
494
- numericValue: 0,
495
+ numericValue: sq.filledQty,
495
496
  quoteData,
496
- value: "",
497
+ value: getTradingValueLabel({
498
+ amount: sq.filledQty,
499
+ minimumFractionDigits: 2,
500
+ maximumFractionDigits: 2
501
+ }),
497
502
  venue,
498
503
  isUnavailable: true
499
504
  };
@@ -533,7 +538,7 @@ var buildLiveRouteCards = ({
533
538
  const venue = parsedVenue.success ? parsedVenue.data : void 0;
534
539
  return {
535
540
  id: `live-unavailable-${sq.venue}`,
536
- hint: "",
541
+ hint: labels.venueUnavailableInRegion,
537
542
  kind: "venue",
538
543
  label: getTradingVenueLabel(venue),
539
544
  numericValue: 0,
@@ -543,7 +548,9 @@ var buildLiveRouteCards = ({
543
548
  isUnavailable: true
544
549
  };
545
550
  });
546
- const baseCards = primaryCard ? [primaryCard, ...soloCards] : soloCards;
551
+ const baseCards = (primaryCard ? [primaryCard, ...soloCards] : soloCards).sort(
552
+ (left, right) => right.numericValue - left.numericValue
553
+ );
547
554
  const coveredVenueStrings = new Set(
548
555
  [...baseCards, ...unavailableCards].flatMap((card) => card.venue ? [card.venue] : [])
549
556
  );
@@ -553,7 +560,7 @@ var buildLiveRouteCards = ({
553
560
  return [
554
561
  {
555
562
  id: "live-geo-blocked-kalshi",
556
- hint: "",
563
+ hint: labels.venueUnavailableInRegion,
557
564
  kind: "venue",
558
565
  label: getTradingVenueLabel(kalshiVenue),
559
566
  numericValue: 0,
@@ -1857,8 +1864,7 @@ var renderRouteCard = ({
1857
1864
  }) => {
1858
1865
  var _a, _b;
1859
1866
  const showSplitDetails = isSelected && isExpanded && card.kind === "split" && !!((_a = card.rows) == null ? void 0 : _a.length);
1860
- const valueLabel = card.isUnavailable ? tradingLabels.venueUnavailableInRegion : card.value;
1861
- const ariaLabel = [card.label, card.hint, valueLabel].filter(Boolean).join(" ");
1867
+ const ariaLabel = [card.label, card.hint, card.value].filter(Boolean).join(" ");
1862
1868
  return /* @__PURE__ */ jsxs3(
1863
1869
  "button",
1864
1870
  {
@@ -1868,14 +1874,14 @@ var renderRouteCard = ({
1868
1874
  disabled: card.isUnavailable,
1869
1875
  className: cn(
1870
1876
  "agg-route-card",
1871
- "relative w-full cursor-pointer overflow-hidden rounded-agg-lg p-3 text-left",
1877
+ "relative w-full overflow-hidden rounded-agg-lg p-3 text-left",
1872
1878
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary",
1873
1879
  getMotionClassName(
1874
1880
  enableAnimations,
1875
1881
  "transition-[background-color,border-color,color] duration-200 ease-in-out"
1876
1882
  ),
1877
- isSelected && !card.isUnavailable ? "border border-agg-trade-highlight-border bg-gradient-to-b from-agg-trade-highlight-surface-from to-agg-trade-highlight-surface-to" : "border-transparent bg-agg-secondary-hover",
1878
- card.isUnavailable && "cursor-not-allowed"
1883
+ card.isUnavailable ? "cursor-not-allowed" : "cursor-pointer",
1884
+ isSelected && !card.isUnavailable ? "border border-agg-trade-highlight-border bg-gradient-to-b from-agg-trade-highlight-surface-from to-agg-trade-highlight-surface-to" : "border-transparent bg-agg-secondary-hover"
1879
1885
  ),
1880
1886
  onClick: () => onSelect(card.id),
1881
1887
  children: [
@@ -1905,7 +1911,15 @@ var renderRouteCard = ({
1905
1911
  /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-1 min-w-0", children: [
1906
1912
  /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1.5", children: [
1907
1913
  /* @__PURE__ */ jsx4("p", { className: "agg-route-card-title truncate text-agg-sm leading-agg-5 text-agg-foreground", children: card.label }),
1908
- card.kind === "split" && isSelected ? /* @__PURE__ */ jsx4(
1914
+ card.isUnavailable ? /* @__PURE__ */ jsx4(
1915
+ Icon,
1916
+ {
1917
+ name: "lock",
1918
+ size: "xs",
1919
+ className: "shrink-0 text-agg-muted-foreground",
1920
+ "aria-hidden": "true"
1921
+ }
1922
+ ) : card.kind === "split" && isSelected ? /* @__PURE__ */ jsx4(
1909
1923
  Icon,
1910
1924
  {
1911
1925
  name: showSplitDetails ? "chevron-up" : "chevron-down",
@@ -1924,9 +1938,9 @@ var renderRouteCard = ({
1924
1938
  className: cn(
1925
1939
  "agg-route-card-value",
1926
1940
  "shrink-0 whitespace-nowrap",
1927
- card.isUnavailable ? "text-agg-xs leading-agg-4 text-agg-muted-foreground" : isSelected ? "text-agg-lg font-agg-bold leading-agg-7 text-agg-trade-highlight-accent" : "text-agg-base leading-agg-6 text-agg-foreground"
1941
+ isSelected && !card.isUnavailable ? "text-agg-lg font-agg-bold leading-agg-7 text-agg-trade-highlight-accent" : "text-agg-base leading-agg-6 text-agg-foreground"
1928
1942
  ),
1929
- children: valueLabel
1943
+ children: card.value
1930
1944
  }
1931
1945
  )
1932
1946
  ] }),
@@ -2225,9 +2239,9 @@ var PlaceOrder = ({
2225
2239
  onExecutionStateChange,
2226
2240
  resolvedClaim
2227
2241
  }) => {
2228
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E;
2242
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D;
2229
2243
  const {
2230
- features: { enableAnimations },
2244
+ features: { enableAnimations, showFeesBreakdown },
2231
2245
  general: { locale }
2232
2246
  } = useSdkUiConfig();
2233
2247
  const labels = useLabels();
@@ -2736,16 +2750,63 @@ var PlaceOrder = ({
2736
2750
  submissionProgressState,
2737
2751
  tradingLabels
2738
2752
  ]);
2739
- const displayedToWinHint = (_B = selectedRouteCard == null ? void 0 : selectedRouteCard.hint) != null ? _B : "";
2740
- const displayedToWinValue = (_C = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _C : 0;
2753
+ const displayedToWinHint = useMemo2(() => {
2754
+ var _a2, _b2, _c2, _d2;
2755
+ if (!selectedRouteCard) return "";
2756
+ if (selectedRouteCard.isUnavailable) {
2757
+ const avgPrice = (_c2 = (_b2 = (_a2 = selectedRouteCard.quoteData) == null ? void 0 : _a2.fills) == null ? void 0 : _b2[0]) == null ? void 0 : _c2.avgPrice;
2758
+ return avgPrice != null ? tradingLabels.averagePrice(avgPrice) : "";
2759
+ }
2760
+ return (_d2 = selectedRouteCard.hint) != null ? _d2 : "";
2761
+ }, [selectedRouteCard, tradingLabels]);
2762
+ const displayedToWinValue = (_B = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _B : 0;
2763
+ const activeFeeBreakdown = activeQuoteData == null ? void 0 : activeQuoteData.feeBreakdown;
2764
+ const estimatedFeesValue = useMemo2(() => {
2765
+ if (!activeFeeBreakdown) return null;
2766
+ const totalFees = activeFeeBreakdown.venueFees + activeFeeBreakdown.bridgeFees + activeFeeBreakdown.executionGas;
2767
+ return formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
2768
+ }, [activeFeeBreakdown]);
2769
+ const feeBreakdownRows = useMemo2(() => {
2770
+ if (!activeFeeBreakdown) return [];
2771
+ return [
2772
+ {
2773
+ label: tradingLabels.feeBreakdownVenueFees,
2774
+ value: formatUsd(activeFeeBreakdown.venueFees, {
2775
+ minimumFractionDigits: 2,
2776
+ maximumFractionDigits: 2
2777
+ })
2778
+ },
2779
+ {
2780
+ label: tradingLabels.feeBreakdownBridgeFees,
2781
+ value: formatUsd(activeFeeBreakdown.bridgeFees, {
2782
+ minimumFractionDigits: 2,
2783
+ maximumFractionDigits: 2
2784
+ })
2785
+ },
2786
+ {
2787
+ label: tradingLabels.feeBreakdownExecutionGas,
2788
+ value: formatUsd(activeFeeBreakdown.executionGas, {
2789
+ minimumFractionDigits: 2,
2790
+ maximumFractionDigits: 2
2791
+ })
2792
+ },
2793
+ {
2794
+ label: tradingLabels.feeBreakdownTotalFees,
2795
+ value: formatUsd(
2796
+ activeFeeBreakdown.venueFees + activeFeeBreakdown.bridgeFees + activeFeeBreakdown.executionGas,
2797
+ { minimumFractionDigits: 2, maximumFractionDigits: 2 }
2798
+ )
2799
+ }
2800
+ ];
2801
+ }, [activeFeeBreakdown, tradingLabels]);
2741
2802
  const isActionLoading = isPrimaryActionLoading || executeManaged.isPending;
2742
- const selectedRouteGeoBlocked = (_D = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _D : false;
2803
+ const selectedRouteGeoBlocked = (_C = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _C : false;
2743
2804
  const geoBlockedVenuesFromWarnings = useMemo2(
2744
2805
  () => {
2745
2806
  var _a2;
2746
2807
  return extractGeoBlockedVenues((_a2 = smartRoute.data) == null ? void 0 : _a2.warnings);
2747
2808
  },
2748
- [(_E = smartRoute.data) == null ? void 0 : _E.warnings]
2809
+ [(_D = smartRoute.data) == null ? void 0 : _D.warnings]
2749
2810
  );
2750
2811
  const isPrimaryVenueGeoBlocked = useMemo2(() => {
2751
2812
  var _a2, _b2;
@@ -2754,7 +2815,6 @@ var PlaceOrder = ({
2754
2815
  return fills.length > 0 && fills.every((f) => geoBlockedVenuesFromWarnings.has(f.venue));
2755
2816
  }, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
2756
2817
  const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked;
2757
- const geoBlockVenueLabel = isTradingBlocked ? void 0 : selectedRouteGeoBlocked ? selectedRouteCard == null ? void 0 : selectedRouteCard.label : isPrimaryVenueGeoBlocked && (selectedRouteCard == null ? void 0 : selectedRouteCard.venue) ? getTradingVenueLabel(selectedRouteCard.venue) : void 0;
2758
2818
  const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
2759
2819
  const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isBelowMinimum || !selectedRouteCard || !selectedRouteCard.quoteData.quoteId || selectedRouteGeoBlocked || !isAuthenticated || quoteStatus !== void 0;
2760
2820
  const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && (orderedRouteCards.length > 0 || smartRoute.isFetching);
@@ -3216,6 +3276,36 @@ var PlaceOrder = ({
3216
3276
  }
3217
3277
  )
3218
3278
  ] }),
3279
+ showFeesBreakdown && hasEnteredAmount && estimatedFeesValue ? /* @__PURE__ */ jsxs3("div", { className: "agg-order-fees-section flex items-center justify-between gap-4", children: [
3280
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1.5", children: [
3281
+ /* @__PURE__ */ jsx4(
3282
+ Typography,
3283
+ {
3284
+ variant: "text-sm",
3285
+ className: "text-agg-sm leading-agg-5 text-agg-muted-foreground",
3286
+ children: tradingLabels.estimatedFees
3287
+ }
3288
+ ),
3289
+ feeBreakdownRows.length > 0 ? /* @__PURE__ */ jsx4(
3290
+ Tooltip,
3291
+ {
3292
+ "aria-label": tradingLabels.estimatedFeesTooltipAria,
3293
+ content: /* @__PURE__ */ jsx4("div", { className: "flex min-w-[220px] flex-col gap-2", children: feeBreakdownRows.map((row) => /* @__PURE__ */ jsxs3(
3294
+ "div",
3295
+ {
3296
+ className: "flex items-center justify-between gap-3 text-agg-sm leading-agg-5",
3297
+ children: [
3298
+ /* @__PURE__ */ jsx4("span", { className: "text-agg-muted-foreground", children: row.label }),
3299
+ /* @__PURE__ */ jsx4("span", { className: "font-agg-bold text-agg-foreground", children: row.value })
3300
+ ]
3301
+ },
3302
+ row.label
3303
+ )) })
3304
+ }
3305
+ ) : null
3306
+ ] }),
3307
+ /* @__PURE__ */ jsx4("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: estimatedFeesValue })
3308
+ ] }) : null,
3219
3309
  shouldShowSmartRouting ? /* @__PURE__ */ jsxs3("div", { className: "agg-route-panel flex flex-col gap-3", children: [
3220
3310
  /* @__PURE__ */ jsxs3("div", { className: "agg-route-panel-header flex items-center justify-between gap-4", children: [
3221
3311
  /* @__PURE__ */ jsx4("p", { className: "agg-route-panel-title text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.smartRouting }),
@@ -3367,7 +3457,19 @@ var PlaceOrder = ({
3367
3457
  children: actionLabel
3368
3458
  }
3369
3459
  ),
3370
- shouldShowGeoBlockBanner ? /* @__PURE__ */ jsx4(GeoBlockBanner, { venue: geoBlockVenueLabel, termsUrl: AGG_TERMS_OF_SERVICE_URL }) : null,
3460
+ !shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown ? /* @__PURE__ */ jsxs3("div", { className: "agg-order-platform-fee mt-1 flex items-center justify-center gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
3461
+ /* @__PURE__ */ jsx4(
3462
+ Icon,
3463
+ {
3464
+ name: "shield-trust",
3465
+ size: "small",
3466
+ className: "h-3.5 w-3.5 text-agg-primary",
3467
+ "aria-hidden": "true"
3468
+ }
3469
+ ),
3470
+ /* @__PURE__ */ jsx4(Typography, { variant: "text-xs-caps", className: "text-agg-primary", children: tradingLabels.platformFee })
3471
+ ] }) : null,
3472
+ shouldShowGeoBlockBanner ? /* @__PURE__ */ jsx4(GeoBlockBanner, { termsUrl: AGG_TERMS_OF_SERVICE_URL }) : null,
3371
3473
  !shouldShowGeoBlockBanner ? /* @__PURE__ */ jsx4("p", { className: "agg-order-disclaimer text-center text-agg-xs leading-agg-4 text-agg-muted-foreground", children: tradingLabels.disclaimer }) : null
3372
3474
  ]
3373
3475
  }
@@ -40,7 +40,7 @@ import {
40
40
  getMotionClassName,
41
41
  shortenAddress,
42
42
  venueLogoLabels
43
- } from "./chunk-TLGQ4LID.mjs";
43
+ } from "./chunk-34L7ZKJW.mjs";
44
44
 
45
45
  // src/deposit/index.tsx
46
46
  import { useEffect as useEffect3, useMemo, useRef, useState as useState2 } from "react";
@@ -17,7 +17,7 @@ import {
17
17
  selectPrimaryVenueMarket,
18
18
  skeletonViews,
19
19
  sortOutcomes
20
- } from "./chunk-TLGQ4LID.mjs";
20
+ } from "./chunk-34L7ZKJW.mjs";
21
21
 
22
22
  // src/trading/trading-context/index.tsx
23
23
  import { useEventTradingContext } from "@agg-build/hooks";
@@ -805,16 +805,25 @@ var resolveDisplayOutcomeLabels = (labels) => {
805
805
  var resolveMarketDetailsOutcomeLabels = (venueMarkets) => {
806
806
  var _a;
807
807
  const primaryMarket = selectPrimaryVenueMarket(venueMarkets);
808
- const initialLabels = ((_a = primaryMarket == null ? void 0 : primaryMarket.venueMarketOutcomes) != null ? _a : []).map((outcome) => outcome.label.trim()).filter(Boolean);
809
- const labels = new Set(initialLabels);
810
- venueMarkets.forEach((market) => {
811
- sortOutcomes(market.venueMarketOutcomes).forEach((outcome) => {
812
- const label = outcome.label.trim();
813
- if (!label) return;
814
- labels.add(label);
815
- });
816
- });
817
- return [...labels];
808
+ const labels = /* @__PURE__ */ new Map();
809
+ const upsertOutcome = (outcome) => {
810
+ var _a2;
811
+ const label = outcome.label.trim();
812
+ if (!label) return;
813
+ const key = normalizeLabel2(label);
814
+ const title = ((_a2 = outcome.title) != null ? _a2 : "").trim() || label;
815
+ const existing = labels.get(key);
816
+ if (!existing) {
817
+ labels.set(key, { label, title });
818
+ return;
819
+ }
820
+ if (existing.title === existing.label && title !== label) {
821
+ labels.set(key, __spreadProps(__spreadValues({}, existing), { title }));
822
+ }
823
+ };
824
+ ((_a = primaryMarket == null ? void 0 : primaryMarket.venueMarketOutcomes) != null ? _a : []).forEach(upsertOutcome);
825
+ venueMarkets.forEach((market) => sortOutcomes(market.venueMarketOutcomes).forEach(upsertOutcome));
826
+ return [...labels.values()];
818
827
  };
819
828
  var resolveInitialOutcomeLabel = (labels, defaultOutcomeLabel) => {
820
829
  var _a;
@@ -857,13 +866,15 @@ var resolveOutcomeTone = (label, index) => {
857
866
  return index === 0 ? "positive" : "negative";
858
867
  };
859
868
  var resolveHeaderOutcomeItems = (venueMarkets) => {
860
- const labels = resolveDisplayOutcomeLabels(resolveMarketDetailsOutcomeLabels(venueMarkets));
869
+ const outcomes = resolveMarketDetailsOutcomeLabels(venueMarkets);
870
+ const labels = resolveDisplayOutcomeLabels(outcomes.map((outcome) => outcome.label));
861
871
  const probabilityByLabel = resolveAverageProbabilityByLabel(venueMarkets, labels);
862
872
  return labels.slice(0, 2).map((label, index) => {
863
- var _a, _b, _c, _d, _e, _f;
873
+ var _a, _b, _c, _d, _e, _f, _g, _h;
864
874
  return {
865
- id: (_b = (_a = resolveOutcomesByVenue(venueMarkets, label)[0]) == null ? void 0 : _a.outcome.id) != null ? _b : "",
866
- venue: (_f = (_e = (_c = resolveOutcomesByVenue(venueMarkets, label)[0]) == null ? void 0 : _c.venue) != null ? _e : (_d = venueMarkets[0]) == null ? void 0 : _d.venue) != null ? _f : "polymarket",
875
+ title: (_b = (_a = outcomes.find((outcome) => normalizeLabel2(outcome.label) === normalizeLabel2(label))) == null ? void 0 : _a.title) != null ? _b : label,
876
+ id: (_d = (_c = resolveOutcomesByVenue(venueMarkets, label)[0]) == null ? void 0 : _c.outcome.id) != null ? _d : "",
877
+ venue: (_h = (_g = (_e = resolveOutcomesByVenue(venueMarkets, label)[0]) == null ? void 0 : _e.venue) != null ? _g : (_f = venueMarkets[0]) == null ? void 0 : _f.venue) != null ? _h : "polymarket",
867
878
  label,
868
879
  probability: probabilityByLabel.get(label),
869
880
  tone: resolveOutcomeTone(label, index)
@@ -941,7 +952,7 @@ var buildMarketDetailsModel = ({
941
952
  labels
942
953
  });
943
954
  const outcomeLabels = resolveDisplayOutcomeLabels(
944
- resolveMarketDetailsOutcomeLabels(market.venueMarkets)
955
+ resolveMarketDetailsOutcomeLabels(market.venueMarkets).map((outcome) => outcome.label)
945
956
  );
946
957
  const probabilityByLabel = resolveAverageProbabilityByLabel(market.venueMarkets, outcomeLabels);
947
958
  return {