@agg-build/ui 4.7.3 → 4.9.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 (80) hide show
  1. package/dist/{chunk-2347CDTT.mjs → chunk-GG57TRNE.mjs} +393 -155
  2. package/dist/{chunk-SQ4BA3CC.mjs → chunk-GKYBQEBC.mjs} +465 -172
  3. package/dist/{chunk-3X5ICUUC.mjs → chunk-GVIS3YXU.mjs} +2 -2
  4. package/dist/{chunk-XR6C3MZX.mjs → chunk-H7L4HDXS.mjs} +266 -162
  5. package/dist/{chunk-UQ7XJIAZ.mjs → chunk-NYL6A6AD.mjs} +953 -785
  6. package/dist/{chunk-MAQ52KM5.mjs → chunk-TNNLRRHC.mjs} +1 -1
  7. package/dist/{chunk-G5PNGOTL.mjs → chunk-XQLLZTEW.mjs} +296 -166
  8. package/dist/events.js +1195 -1041
  9. package/dist/events.mjs +3 -3
  10. package/dist/index.js +4729 -3773
  11. package/dist/index.mjs +58 -19
  12. package/dist/modals.js +1886 -1181
  13. package/dist/modals.mjs +12 -4
  14. package/dist/pages.js +3554 -2873
  15. package/dist/pages.mjs +6 -6
  16. package/dist/primitives.js +953 -785
  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 +2258 -1711
  21. package/dist/trading.mjs +10 -6
  22. package/dist/types/index.d.mts +1 -0
  23. package/dist/types/index.d.ts +1 -0
  24. package/dist/types/kyc/index.d.mts +3 -0
  25. package/dist/types/kyc/index.d.ts +3 -0
  26. package/dist/types/kyc/shared-kyc-modal.d.mts +12 -0
  27. package/dist/types/kyc/shared-kyc-modal.d.ts +12 -0
  28. package/dist/types/kyc/shared-kyc.d.mts +31 -0
  29. package/dist/types/kyc/shared-kyc.d.ts +31 -0
  30. package/dist/types/kyc/use-shared-kyc-flow.d.mts +19 -0
  31. package/dist/types/kyc/use-shared-kyc-flow.d.ts +19 -0
  32. package/dist/types/modals/index.d.mts +2 -0
  33. package/dist/types/modals/index.d.ts +2 -0
  34. package/dist/types/pages/event-market/event-market.shared.d.mts +2 -1
  35. package/dist/types/pages/event-market/event-market.shared.d.ts +2 -1
  36. package/dist/types/pages/event-market/event-market.types.d.mts +2 -0
  37. package/dist/types/pages/event-market/event-market.types.d.ts +2 -0
  38. package/dist/types/pages/event-market/sports-event-market-page.d.mts +1 -1
  39. package/dist/types/pages/event-market/sports-event-market-page.d.ts +1 -1
  40. package/dist/types/pages/user-profile/components/positions-value-card.d.mts +17 -1
  41. package/dist/types/pages/user-profile/components/positions-value-card.d.ts +17 -1
  42. package/dist/types/pages/user-profile/components/user-info-card.d.mts +11 -1
  43. package/dist/types/pages/user-profile/components/user-info-card.d.ts +11 -1
  44. package/dist/types/paper-trading/index.d.mts +6 -0
  45. package/dist/types/paper-trading/index.d.ts +6 -0
  46. package/dist/types/paper-trading/paper-onboarding-modal.d.mts +15 -0
  47. package/dist/types/paper-trading/paper-onboarding-modal.d.ts +15 -0
  48. package/dist/types/paper-trading/paper-onboarding-modal.types.d.mts +33 -0
  49. package/dist/types/paper-trading/paper-onboarding-modal.types.d.ts +33 -0
  50. package/dist/types/paper-trading/paper-trading-badge.d.mts +50 -0
  51. package/dist/types/paper-trading/paper-trading-badge.d.ts +50 -0
  52. package/dist/types/paper-trading/paper-trading-onboarding.d.mts +16 -0
  53. package/dist/types/paper-trading/paper-trading-onboarding.d.ts +16 -0
  54. package/dist/types/primitives/header/header.types.d.mts +16 -0
  55. package/dist/types/primitives/header/header.types.d.ts +16 -0
  56. package/dist/types/primitives/header/index.d.mts +1 -1
  57. package/dist/types/primitives/header/index.d.ts +1 -1
  58. package/dist/types/primitives/icon/registry.d.mts +20 -0
  59. package/dist/types/primitives/icon/registry.d.ts +20 -0
  60. package/dist/types/primitives/icon/svg/paper-buying-power.d.mts +11 -0
  61. package/dist/types/primitives/icon/svg/paper-buying-power.d.ts +11 -0
  62. package/dist/types/primitives/icon/svg/paper-earnings.d.mts +11 -0
  63. package/dist/types/primitives/icon/svg/paper-earnings.d.ts +11 -0
  64. package/dist/types/primitives/icon/svg/paper-onboarding-funds.d.mts +12 -0
  65. package/dist/types/primitives/icon/svg/paper-onboarding-funds.d.ts +12 -0
  66. package/dist/types/primitives/icon/svg/paper-onboarding-markets.d.mts +12 -0
  67. package/dist/types/primitives/icon/svg/paper-onboarding-markets.d.ts +12 -0
  68. package/dist/types/primitives/icon/svg/paper-onboarding-performance.d.mts +12 -0
  69. package/dist/types/primitives/icon/svg/paper-onboarding-performance.d.ts +12 -0
  70. package/dist/types/primitives/modal/modal.types.d.mts +6 -0
  71. package/dist/types/primitives/modal/modal.types.d.ts +6 -0
  72. package/dist/types/trading/index.d.mts +1 -0
  73. package/dist/types/trading/index.d.ts +1 -0
  74. package/dist/types/trading/place-order/index.d.mts +1 -1
  75. package/dist/types/trading/place-order/index.d.ts +1 -1
  76. package/dist/types/trading/place-order/index.place-order.types.d.mts +8 -0
  77. package/dist/types/trading/place-order/index.place-order.types.d.ts +8 -0
  78. package/dist/types/trading/types.d.mts +2 -0
  79. package/dist/types/trading/types.d.ts +2 -0
  80. package/package.json +3 -3
@@ -12,7 +12,7 @@ import {
12
12
  isErrorWithStatus,
13
13
  useEventListTabs,
14
14
  useEventListTabsHeaderOverflow
15
- } from "./chunk-3X5ICUUC.mjs";
15
+ } from "./chunk-GVIS3YXU.mjs";
16
16
  import {
17
17
  DEPOSIT_MODAL_OPEN_EVENT,
18
18
  PlaceOrder,
@@ -21,12 +21,12 @@ import {
21
21
  formatChainIdLabel,
22
22
  useClaimWinnings,
23
23
  useResolvedMarketClaim
24
- } from "./chunk-SQ4BA3CC.mjs";
24
+ } from "./chunk-GKYBQEBC.mjs";
25
25
  import {
26
26
  getDisplayOutcomePrice,
27
27
  resolveHeaderOutcomeItems,
28
28
  resolveMarketFromVenueMarkets
29
- } from "./chunk-MAQ52KM5.mjs";
29
+ } from "./chunk-TNNLRRHC.mjs";
30
30
  import {
31
31
  AggErrorBoundary,
32
32
  Button,
@@ -62,7 +62,7 @@ import {
62
62
  skeletonViews,
63
63
  sortCategoriesForNavigation,
64
64
  useOptionalToast
65
- } from "./chunk-UQ7XJIAZ.mjs";
65
+ } from "./chunk-NYL6A6AD.mjs";
66
66
 
67
67
  // src/pages/home/index.tsx
68
68
  import {
@@ -71,9 +71,10 @@ import {
71
71
  useCategories,
72
72
  useEventListState,
73
73
  useLabels as useLabels5,
74
- useSdkUiConfig as useSdkUiConfig4,
74
+ useSdkUiConfig as useSdkUiConfig3,
75
75
  useSearch,
76
- useVenueMarketMidpoints
76
+ useVenueMarketMidpoints,
77
+ useResolvedExecutionMode as useResolvedExecutionMode3
77
78
  } from "@agg-build/hooks";
78
79
  import { VENUES } from "@agg-build/sdk";
79
80
  import { useCallback as useCallback5, useEffect as useEffect8, useMemo as useMemo5, useRef as useRef7, useState as useState9 } from "react";
@@ -88,7 +89,8 @@ import {
88
89
  useLabels as useLabels4,
89
90
  useMidpoints as useMidpoints2,
90
91
  useRecurringCryptoMarkets,
91
- useSdkUiConfig as useSdkUiConfig3
92
+ useSdkUiConfig as useSdkUiConfig2,
93
+ useResolvedExecutionMode as useResolvedExecutionMode2
92
94
  } from "@agg-build/hooks";
93
95
  import { useCallback as useCallback3, useEffect as useEffect6, useMemo as useMemo4, useRef as useRef5, useState as useState6 } from "react";
94
96
 
@@ -214,7 +216,8 @@ var EventMarketPageMobileTrade = ({
214
216
  isOpen,
215
217
  onOpenChange,
216
218
  midpointsResult,
217
- onBeforePrimaryAction
219
+ onBeforePrimaryAction,
220
+ sharedKyc
218
221
  }) => {
219
222
  const labels = useLabels();
220
223
  if (!showPlaceOrder) return null;
@@ -256,6 +259,7 @@ var EventMarketPageMobileTrade = ({
256
259
  isQuotePanelActive: isOpen,
257
260
  midpointsResult,
258
261
  onBeforePrimaryAction,
262
+ sharedKyc,
259
263
  className: cn(
260
264
  "agg-mobile-trade-panel w-full overflow-hidden rounded-t-agg-2xl sm:rounded-agg-xl",
261
265
  classNames == null ? void 0 : classNames.mobileTrade
@@ -389,7 +393,7 @@ import {
389
393
  TradeSide,
390
394
  useEventTradingContext as useEventTradingContext3,
391
395
  useMidpoints,
392
- useSdkUiConfig as useSdkUiConfig2,
396
+ useResolvedExecutionMode,
393
397
  useSportsLive
394
398
  } from "@agg-build/hooks";
395
399
  import { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo3, useRef as useRef4, useState as useState5 } from "react";
@@ -2311,7 +2315,8 @@ var SportsEventMarketPage = ({
2311
2315
  executionMode,
2312
2316
  stickyOrderPanel,
2313
2317
  resolvedClaim,
2314
- onBeforePrimaryAction
2318
+ onBeforePrimaryAction,
2319
+ sharedKyc
2315
2320
  }) => {
2316
2321
  const [sectionMarketsByKey, setSectionMarketsByKey] = useState5({});
2317
2322
  const composedEvent = useMemo3(() => {
@@ -2328,10 +2333,7 @@ var SportsEventMarketPage = ({
2328
2333
  const stickyOrderPanelState = resolveEventMarketPageStickyState({
2329
2334
  stickyOrderPanel
2330
2335
  });
2331
- const {
2332
- trading: { executionMode: configuredExecutionMode }
2333
- } = useSdkUiConfig2();
2334
- const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
2336
+ const { executionMode: resolvedExecutionMode } = useResolvedExecutionMode(executionMode);
2335
2337
  const [isMobileTradeOpen, setIsMobileTradeOpen] = useState5(false);
2336
2338
  const isMobileViewport = useIsMobileEventMarketViewport(SPORTS_EVENT_MARKET_MEDIA_QUERY);
2337
2339
  const tradingContext = useEventTradingContext3();
@@ -2452,6 +2454,7 @@ var SportsEventMarketPage = ({
2452
2454
  resolvedClaim: effectiveResolvedClaim,
2453
2455
  midpointsResult,
2454
2456
  onBeforePrimaryAction,
2457
+ sharedKyc,
2455
2458
  className: cn(
2456
2459
  "agg-mobile-trade-panel w-full overflow-hidden",
2457
2460
  classNames == null ? void 0 : classNames.mobileTrade
@@ -2479,6 +2482,7 @@ var SportsEventMarketPage = ({
2479
2482
  resolvedClaim: effectiveResolvedClaim,
2480
2483
  midpointsResult,
2481
2484
  onBeforePrimaryAction,
2485
+ sharedKyc,
2482
2486
  className: cn(stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.placeOrder, classNames == null ? void 0 : classNames.trade),
2483
2487
  classNames: resolveDesktopTradePlaceOrderClassNames(classNames)
2484
2488
  }
@@ -2498,7 +2502,8 @@ var SportsEventMarketPage = ({
2498
2502
  isOpen: isMobileTradeOpen,
2499
2503
  onOpenChange: setIsMobileTradeOpen,
2500
2504
  midpointsResult,
2501
- onBeforePrimaryAction
2505
+ onBeforePrimaryAction,
2506
+ sharedKyc
2502
2507
  }
2503
2508
  ) : null
2504
2509
  ]
@@ -2550,6 +2555,7 @@ var EventMarketPageContent = ({
2550
2555
  stickyOrderPanel,
2551
2556
  resolvedClaim,
2552
2557
  onBeforePrimaryAction,
2558
+ sharedKyc,
2553
2559
  onRecurringMarketNavigate
2554
2560
  }) => {
2555
2561
  var _a;
@@ -2557,10 +2563,7 @@ var EventMarketPageContent = ({
2557
2563
  const stickyOrderPanelState = resolveEventMarketPageStickyState({
2558
2564
  stickyOrderPanel
2559
2565
  });
2560
- const {
2561
- trading: { executionMode: configuredExecutionMode }
2562
- } = useSdkUiConfig3();
2563
- const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
2566
+ const { executionMode: resolvedExecutionMode } = useResolvedExecutionMode2(executionMode);
2564
2567
  const [isMobileTradeOpen, setIsMobileTradeOpen] = useState6(false);
2565
2568
  const isMobileViewport = useIsMobileEventMarketViewport();
2566
2569
  const tradingContext = useEventTradingContext4();
@@ -2741,6 +2744,7 @@ var EventMarketPageContent = ({
2741
2744
  showResolvingState: isRecurringResolvingMarket,
2742
2745
  midpointsResult,
2743
2746
  onBeforePrimaryAction,
2747
+ sharedKyc,
2744
2748
  className: cn(
2745
2749
  "agg-mobile-trade-panel w-full overflow-hidden",
2746
2750
  classNames == null ? void 0 : classNames.mobileTrade
@@ -2770,6 +2774,7 @@ var EventMarketPageContent = ({
2770
2774
  showResolvingState: isRecurringResolvingMarket,
2771
2775
  midpointsResult,
2772
2776
  onBeforePrimaryAction,
2777
+ sharedKyc,
2773
2778
  className: cn(stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.placeOrder, classNames == null ? void 0 : classNames.trade),
2774
2779
  classNames: resolveDesktopTradePlaceOrderClassNames(classNames)
2775
2780
  }
@@ -2789,7 +2794,8 @@ var EventMarketPageContent = ({
2789
2794
  isOpen: isMobileTradeOpen,
2790
2795
  onOpenChange: setIsMobileTradeOpen,
2791
2796
  midpointsResult,
2792
- onBeforePrimaryAction
2797
+ onBeforePrimaryAction,
2798
+ sharedKyc
2793
2799
  }
2794
2800
  ) : null
2795
2801
  ]
@@ -2800,7 +2806,7 @@ var EventMarketPage = (props) => {
2800
2806
  var _a;
2801
2807
  const {
2802
2808
  features: { showSportsMarkets }
2803
- } = useSdkUiConfig3();
2809
+ } = useSdkUiConfig2();
2804
2810
  const hasEventProp = "event" in props && !!props.event;
2805
2811
  const {
2806
2812
  event: fetchedEvent,
@@ -3074,7 +3080,7 @@ var HomeSearchResults = ({
3074
3080
  onMarketClick
3075
3081
  }) => {
3076
3082
  const labels = useLabels5();
3077
- const { search: searchConfig } = useSdkUiConfig4();
3083
+ const { search: searchConfig } = useSdkUiConfig3();
3078
3084
  const { disabledVenues } = useAppConfig();
3079
3085
  const [activeVenueTabValue, setActiveVenueTabValue] = useState9("all");
3080
3086
  const eventListTabs = useEventListTabs();
@@ -3284,9 +3290,9 @@ var HomePage = ({
3284
3290
  onChange: onSearchChange,
3285
3291
  onSelect: onSelectEventInternal
3286
3292
  },
3287
- trading: { executionMode },
3288
3293
  features: { enableEventDiscoveryUrlPersistence }
3289
- } = useSdkUiConfig4();
3294
+ } = useSdkUiConfig3();
3295
+ const { executionMode } = useResolvedExecutionMode3();
3290
3296
  const { isLoading: isAppConfigLoading } = useAppConfig();
3291
3297
  const primaryEventListTabs = useEventListTabs();
3292
3298
  const { capture, consume } = useEventListState();
@@ -3774,8 +3780,9 @@ import {
3774
3780
  useExecutionPositions,
3775
3781
  useGeoBlock,
3776
3782
  useLabels as useLabels13,
3777
- useSdkUiConfig as useSdkUiConfig5,
3778
- useUserActivity
3783
+ useSdkUiConfig as useSdkUiConfig4,
3784
+ useUserActivity,
3785
+ useResolvedExecutionMode as useResolvedExecutionMode4
3779
3786
  } from "@agg-build/hooks";
3780
3787
  import { Venue as Venue3 } from "@agg-build/sdk";
3781
3788
  import dayjs from "dayjs";
@@ -6674,18 +6681,27 @@ var PositionsValueCard = ({
6674
6681
  valueLabel,
6675
6682
  isLoading = false,
6676
6683
  className,
6677
- icon
6684
+ icon,
6685
+ caption,
6686
+ compact = false
6678
6687
  }) => {
6688
+ const value = /* @__PURE__ */ jsx16("div", { className: "agg-portfolio-value font-agg-sans text-agg-2xl leading-8 font-agg-bold text-agg-foreground", children: isLoading ? /* @__PURE__ */ jsx16("div", { role: "status", "aria-label": "Loading positions value", children: /* @__PURE__ */ jsx16(SkeletonBlock, { className: "h-8 w-24 rounded-agg-sm" }) }) : valueLabel });
6679
6689
  return /* @__PURE__ */ jsxs15(
6680
6690
  "div",
6681
6691
  {
6682
6692
  className: cn(
6683
6693
  "group/agg-portfolio-summary",
6684
- "flex flex-col gap-3 rounded-agg-xl border border-agg-separator bg-agg-secondary p-5",
6694
+ "flex flex-col gap-3 rounded-agg-xl border border-agg-separator bg-agg-secondary",
6695
+ // Compact is 16 on mobile and 20 from md up. That alone produces the
6696
+ // paper frames' card heights — content is 68px (24 label + 12 gap +
6697
+ // 32 value), so 100 mobile / 108 desktop. No explicit height needed,
6698
+ // and none should be set: a fixed height would break the moment a
6699
+ // label wraps.
6700
+ compact ? "p-4 md:p-5" : "p-5",
6685
6701
  className
6686
6702
  ),
6687
6703
  children: [
6688
- /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2", children: [
6704
+ /* @__PURE__ */ jsxs15("div", { className: cn("flex items-center gap-2", compact && "[&>:first-child]:shrink-0"), children: [
6689
6705
  icon != null ? icon : /* @__PURE__ */ jsx16(
6690
6706
  "svg",
6691
6707
  {
@@ -6704,9 +6720,42 @@ var PositionsValueCard = ({
6704
6720
  )
6705
6721
  }
6706
6722
  ),
6707
- /* @__PURE__ */ jsx16("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground", children: label })
6723
+ /* @__PURE__ */ jsx16(
6724
+ "span",
6725
+ {
6726
+ className: cn(
6727
+ "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground",
6728
+ // Figma keeps every paper card label on one line (node
6729
+ // 4772:31126); without this "Paper Buying Power" wraps and the
6730
+ // card grows. Compact-only — forcing it everywhere would make a
6731
+ // long or localized live label overflow rather than wrap.
6732
+ compact && "whitespace-nowrap"
6733
+ ),
6734
+ children: label
6735
+ }
6736
+ )
6708
6737
  ] }),
6709
- /* @__PURE__ */ jsx16("div", { className: "agg-portfolio-value font-agg-sans text-agg-2xl leading-8 font-agg-bold text-agg-foreground", children: isLoading ? /* @__PURE__ */ jsx16("div", { role: "status", "aria-label": "Loading positions value", children: /* @__PURE__ */ jsx16(SkeletonBlock, { className: "h-8 w-24 rounded-agg-sm" }) }) : valueLabel })
6738
+ caption ? (
6739
+ // Figma 4772:31139 lays the value and its caption on one
6740
+ // baseline-aligned row, pushed apart. Only cards that actually carry
6741
+ // a caption get this wrapper — a captionless card keeps the value as
6742
+ // a direct child, exactly as it has always rendered.
6743
+ /* @__PURE__ */ jsxs15("div", { className: "flex w-full items-baseline justify-between gap-2", children: [
6744
+ value,
6745
+ /* @__PURE__ */ jsx16(
6746
+ "span",
6747
+ {
6748
+ className: cn(
6749
+ "font-agg-sans text-agg-2xs leading-agg-14 font-agg-bold uppercase",
6750
+ "text-agg-muted-foreground",
6751
+ // Never let the caption squeeze the figure it annotates.
6752
+ "shrink-0 text-right"
6753
+ ),
6754
+ children: caption
6755
+ }
6756
+ )
6757
+ ] })
6758
+ ) : value
6710
6759
  ]
6711
6760
  }
6712
6761
  );
@@ -6799,6 +6848,7 @@ var UserInfoCard = ({
6799
6848
  onDeposit,
6800
6849
  onWithdraw,
6801
6850
  isDepositBlocked = false,
6851
+ showEditOnlyActions = false,
6802
6852
  className
6803
6853
  }) => {
6804
6854
  var _a;
@@ -6879,56 +6929,65 @@ var UserInfoCard = ({
6879
6929
  ] }) : null
6880
6930
  ] })
6881
6931
  ] }),
6882
- (onDeposit || onWithdraw) && /* @__PURE__ */ jsxs17("div", { className: "agg-profile-actions flex w-full flex-1 items-center gap-3 py-5", children: [
6883
- onDeposit ? /* @__PURE__ */ jsx18(
6884
- ConditionalWrapper,
6885
- {
6886
- condition: isDepositBlocked,
6887
- wrapper: (children) => /* @__PURE__ */ jsx18(
6888
- Tooltip,
6932
+ (onDeposit || onWithdraw || showEditOnlyActions && onEditProfile) && /* @__PURE__ */ jsxs17(
6933
+ "div",
6934
+ {
6935
+ className: cn(
6936
+ "agg-profile-actions flex w-full flex-1 items-center gap-3 py-5",
6937
+ !onDeposit && !onWithdraw && "justify-center sm:hidden"
6938
+ ),
6939
+ children: [
6940
+ onDeposit ? /* @__PURE__ */ jsx18(
6941
+ ConditionalWrapper,
6889
6942
  {
6890
- content: /* @__PURE__ */ jsx18("p", { className: "text-center", children: labels.auth.depositGeoBlocked }),
6891
- size: "small",
6892
- side: "bottom",
6893
- sideOffset: 4,
6894
- children
6943
+ condition: isDepositBlocked,
6944
+ wrapper: (children) => /* @__PURE__ */ jsx18(
6945
+ Tooltip,
6946
+ {
6947
+ content: /* @__PURE__ */ jsx18("p", { className: "text-center", children: labels.auth.depositGeoBlocked }),
6948
+ size: "small",
6949
+ side: "bottom",
6950
+ sideOffset: 4,
6951
+ children
6952
+ }
6953
+ ),
6954
+ children: /* @__PURE__ */ jsx18(
6955
+ Button,
6956
+ __spreadProps(__spreadValues({
6957
+ variant: "primary",
6958
+ size: "medium"
6959
+ }, isDepositBlocked ? { disabled: true } : { onClick: onDeposit }), {
6960
+ className: "min-w-0 flex-1 min-h-10",
6961
+ children: labels.auth.deposit
6962
+ })
6963
+ )
6895
6964
  }
6896
- ),
6897
- children: /* @__PURE__ */ jsx18(
6965
+ ) : null,
6966
+ onWithdraw ? /* @__PURE__ */ jsx18(
6898
6967
  Button,
6899
- __spreadProps(__spreadValues({
6900
- variant: "primary",
6901
- size: "medium"
6902
- }, isDepositBlocked ? { disabled: true } : { onClick: onDeposit }), {
6968
+ {
6969
+ variant: "secondary",
6970
+ size: "medium",
6971
+ onClick: onWithdraw,
6903
6972
  className: "min-w-0 flex-1 min-h-10",
6904
- children: labels.auth.deposit
6905
- })
6906
- )
6907
- }
6908
- ) : null,
6909
- onWithdraw ? /* @__PURE__ */ jsx18(
6910
- Button,
6911
- {
6912
- variant: "secondary",
6913
- size: "medium",
6914
- onClick: onWithdraw,
6915
- className: "min-w-0 flex-1 min-h-10",
6916
- children: labels.auth.withdraw
6917
- }
6918
- ) : null,
6919
- onEditProfile ? /* @__PURE__ */ jsxs17(
6920
- "button",
6921
- {
6922
- type: "button",
6923
- onClick: onEditProfile,
6924
- className: "flex sm:hidden shrink-0 cursor-pointer items-center gap-1.5 bg-transparent px-2 py-2 text-agg-primary hover:opacity-80",
6925
- children: [
6926
- /* @__PURE__ */ jsx18(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
6927
- /* @__PURE__ */ jsx18("span", { className: "text-agg-sm font-agg-bold leading-5", children: "Edit" })
6928
- ]
6929
- }
6930
- ) : null
6931
- ] })
6973
+ children: labels.auth.withdraw
6974
+ }
6975
+ ) : null,
6976
+ onEditProfile ? /* @__PURE__ */ jsxs17(
6977
+ "button",
6978
+ {
6979
+ type: "button",
6980
+ onClick: onEditProfile,
6981
+ className: "flex sm:hidden shrink-0 cursor-pointer items-center gap-1.5 bg-transparent px-2 py-2 text-agg-primary hover:opacity-80",
6982
+ children: [
6983
+ /* @__PURE__ */ jsx18(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
6984
+ /* @__PURE__ */ jsx18("span", { className: "text-agg-sm font-agg-bold leading-5", children: "Edit" })
6985
+ ]
6986
+ }
6987
+ ) : null
6988
+ ]
6989
+ }
6990
+ )
6932
6991
  ]
6933
6992
  }
6934
6993
  );
@@ -7436,7 +7495,7 @@ var UserProfilePage = ({
7436
7495
  classNames,
7437
7496
  onError
7438
7497
  }) => {
7439
- var _a, _b;
7498
+ var _a, _b, _c;
7440
7499
  const [isHydrated, setIsHydrated] = useState12(false);
7441
7500
  useEffect11(() => {
7442
7501
  setIsHydrated(true);
@@ -7446,9 +7505,8 @@ var UserProfilePage = ({
7446
7505
  const balanceState = useAggBalance2();
7447
7506
  const labels = useLabels13();
7448
7507
  const {
7449
- features: { showLimitOrders },
7450
- trading: { executionMode: configuredExecutionMode }
7451
- } = useSdkUiConfig5();
7508
+ features: { showLimitOrders }
7509
+ } = useSdkUiConfig4();
7452
7510
  const client = useAggClient();
7453
7511
  const cancelOrderMutation = useCancelManagedOrder();
7454
7512
  const toastContext = useOptionalToast();
@@ -7471,7 +7529,7 @@ var UserProfilePage = ({
7471
7529
  const [selectedClaimActivity, setSelectedClaimActivity] = useState12(null);
7472
7530
  const [isManageBalancesOpen, setIsManageBalancesOpen] = useState12(false);
7473
7531
  const manageBalancesButtonRef = useRef10(null);
7474
- const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
7532
+ const { executionMode: resolvedExecutionMode, isPaperMode } = useResolvedExecutionMode4(executionMode);
7475
7533
  const queryExecutionMode = resolvedExecutionMode === "paper" ? "paper" : void 0;
7476
7534
  const handleManageBalancesOpenChange = useCallback7((open) => {
7477
7535
  setIsManageBalancesOpen(open);
@@ -7671,7 +7729,7 @@ var UserProfilePage = ({
7671
7729
  };
7672
7730
  }, [client, currentUser, isAuthenticated, shouldUseHookData]);
7673
7731
  const resolvedUser = useMemo8(() => {
7674
- var _a2, _b2, _c, _d, _e, _f;
7732
+ var _a2, _b2, _c2, _d, _e, _f;
7675
7733
  if (user) return user;
7676
7734
  const fullUser = profileUser != null ? profileUser : currentUser;
7677
7735
  const walletAddress = getWalletAddressFromUserProfile(fullUser);
@@ -7680,7 +7738,7 @@ var UserProfilePage = ({
7680
7738
  (account) => String(account.provider).toLowerCase() === "twitter"
7681
7739
  );
7682
7740
  const normalizedTwitterHandle = (_b2 = twitterAccount == null ? void 0 : twitterAccount.providerAccountId) == null ? void 0 : _b2.replace(/^@/, "");
7683
- const walletAccounts = (_d = (_c = fullUser == null ? void 0 : fullUser.accounts) == null ? void 0 : _c.filter((a) => a.provider === "wallet" || a.provider === "solana_wallet")) != null ? _d : [];
7741
+ const walletAccounts = (_d = (_c2 = fullUser == null ? void 0 : fullUser.accounts) == null ? void 0 : _c2.filter((a) => a.provider === "wallet" || a.provider === "solana_wallet")) != null ? _d : [];
7684
7742
  const connectedWallets = walletAccounts.map((a) => {
7685
7743
  var _a3;
7686
7744
  const chain = a.provider === "solana_wallet" ? "solana" : "evm";
@@ -7721,6 +7779,21 @@ var UserProfilePage = ({
7721
7779
  var _a2, _b2;
7722
7780
  return formatUsd2((_b2 = (_a2 = balanceState.availableBalance) != null ? _a2 : balanceState.totalBalance) != null ? _b2 : 0);
7723
7781
  }, [balanceState.availableBalance, balanceState.totalBalance]);
7782
+ const paperSummary = (_a = balanceState.managedBalances) == null ? void 0 : _a.paper;
7783
+ const paperBuyingPowerLabel = useMemo8(
7784
+ () => {
7785
+ var _a2;
7786
+ return formatUsd2((_a2 = paperSummary == null ? void 0 : paperSummary.cashBalance) != null ? _a2 : 0);
7787
+ },
7788
+ [paperSummary == null ? void 0 : paperSummary.cashBalance]
7789
+ );
7790
+ const paperEarningsLabel = useMemo8(
7791
+ () => {
7792
+ var _a2;
7793
+ return formatUsd2((_a2 = paperSummary == null ? void 0 : paperSummary.earnings) != null ? _a2 : 0);
7794
+ },
7795
+ [paperSummary == null ? void 0 : paperSummary.earnings]
7796
+ );
7724
7797
  const { disabledVenues, isLoading: isAppConfigLoading } = useAppConfig2();
7725
7798
  const isKalshiAvailable = getVenueAvailabilityState({
7726
7799
  venueId: Venue3.kalshi,
@@ -7733,7 +7806,7 @@ var UserProfilePage = ({
7733
7806
  if (activities) return activities.filter(isVisibleUserProfileActivity);
7734
7807
  const formatTime = isHydrated ? toRelativeTimeLabel : toAbsoluteTimeLabel;
7735
7808
  return activityQuery.activities.filter(isVisibleActivityItem).map((item, index) => {
7736
- var _a2, _b2, _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, _F, _G;
7809
+ var _a2, _b2, _c2, _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, _F, _G;
7737
7810
  const timeLabel = formatTime(getRuntimeActivityCreatedAt(item));
7738
7811
  if (item.type === "trade") {
7739
7812
  const tradeItem = item;
@@ -7743,7 +7816,7 @@ var UserProfilePage = ({
7743
7816
  const isFailed = tradeItem.status.toLowerCase() === "failed";
7744
7817
  const hasError = hasActivityError(tradeItem);
7745
7818
  const eventId = (_b2 = (_a2 = tradeItem.venueMarket) == null ? void 0 : _a2.venueEventId) != null ? _b2 : void 0;
7746
- const marketId = (_d = (_c = tradeItem.venueMarket) == null ? void 0 : _c.id) != null ? _d : void 0;
7819
+ const marketId = (_d = (_c2 = tradeItem.venueMarket) == null ? void 0 : _c2.id) != null ? _d : void 0;
7747
7820
  const marketQuestion = (_g = (_f = (_e = tradeItem.venueMarket) == null ? void 0 : _e.question) != null ? _f : tradeItem.marketQuestion) != null ? _g : "Market";
7748
7821
  const outcomeLabel = (_l = (_k = (_j = (_h = tradeItem.venueMarketOutcome) == null ? void 0 : _h.title) != null ? _j : (_i = tradeItem.venueMarketOutcome) == null ? void 0 : _i.label) != null ? _k : tradeItem.outcomeLabel) != null ? _l : "";
7749
7822
  return {
@@ -7893,7 +7966,7 @@ var UserProfilePage = ({
7893
7966
  ).sort(
7894
7967
  (a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
7895
7968
  ).map((order) => {
7896
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
7969
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k;
7897
7970
  const isLimitOrder = isExecutionLimitOrder(order);
7898
7971
  const filledRaw = isLimitOrder ? order.filledSizeRaw : order.filledAmountRaw;
7899
7972
  const totalRaw = isLimitOrder ? order.limitSizeRaw : order.amountRaw;
@@ -7907,7 +7980,7 @@ var UserProfilePage = ({
7907
7980
  });
7908
7981
  return __spreadProps(__spreadValues(__spreadProps(__spreadValues({
7909
7982
  id: order.id,
7910
- eventId: (_c = (_b2 = order.venueMarket) == null ? void 0 : _b2.venueEventId) != null ? _c : void 0,
7983
+ eventId: (_c2 = (_b2 = order.venueMarket) == null ? void 0 : _b2.venueEventId) != null ? _c2 : void 0,
7911
7984
  marketId: (_e = (_d = order.venueMarket) == null ? void 0 : _d.id) != null ? _e : void 0,
7912
7985
  thumbnailSrc: (_g = (_f = order.venueMarket) == null ? void 0 : _f.image) != null ? _g : fallbackThumbnailSrc,
7913
7986
  title: ((_h = order.venueMarket) == null ? void 0 : _h.question) || "Market",
@@ -7949,17 +8022,17 @@ var UserProfilePage = ({
7949
8022
  const adaptPositionGroups = useCallback7(
7950
8023
  (groups) => {
7951
8024
  return groups.flatMap((group) => {
7952
- var _a2, _b2, _c, _d;
8025
+ var _a2, _b2, _c2, _d;
7953
8026
  const closedTotals = computeClosedPositionTotals(group);
7954
8027
  const winningOutcome = group.venueMarket.venueMarketOutcomes.find(
7955
8028
  (outcome) => outcome.winner === true
7956
8029
  );
7957
8030
  const winningOutcomeLabel = (_b2 = (_a2 = winningOutcome == null ? void 0 : winningOutcome.title) != null ? _a2 : winningOutcome == null ? void 0 : winningOutcome.label) != null ? _b2 : null;
7958
- const venueEventId = (_c = group.venueMarket.venueEventId) != null ? _c : void 0;
8031
+ const venueEventId = (_c2 = group.venueMarket.venueEventId) != null ? _c2 : void 0;
7959
8032
  const eventId = (_d = group.eventId) != null ? _d : venueEventId;
7960
8033
  const marketId = group.targetMarketId;
7961
8034
  return group.venueMarket.venueMarketOutcomes.map((outcome) => {
7962
- var _a3, _b3, _c2, _d2;
8035
+ var _a3, _b3, _c3, _d2;
7963
8036
  const isResolved = group.venueMarket.status === "resolved";
7964
8037
  const isUnpriced = outcome.priceSource === "entry";
7965
8038
  const averagePriceCents = Math.round(outcome.avgEntryPrice * 100);
@@ -7982,7 +8055,7 @@ var UserProfilePage = ({
7982
8055
  marketId,
7983
8056
  thumbnailSrc: (_b3 = group.venueMarket.image) != null ? _b3 : fallbackThumbnailSrc,
7984
8057
  title: group.venueMarket.question,
7985
- outcomeLabel: ((_c2 = outcome.title) == null ? void 0 : _c2.trim()) || outcome.label,
8058
+ outcomeLabel: ((_c3 = outcome.title) == null ? void 0 : _c3.trim()) || outcome.label,
7986
8059
  resolutionLabel: winningOutcomeLabel,
7987
8060
  venueShareBreakdown: buildVenueShareBreakdown(outcome),
7988
8061
  totalShares: outcome.totalSize,
@@ -8042,89 +8115,146 @@ var UserProfilePage = ({
8042
8115
  classNames == null ? void 0 : classNames.topRow
8043
8116
  ),
8044
8117
  children: [
8045
- /* @__PURE__ */ jsxs18("div", { className: "agg-profile-summary grid grid-cols-1 gap-6 lg:grid-cols-[1fr_minmax(300px,420px)] lg:items-stretch lg:gap-8", children: [
8046
- /* @__PURE__ */ jsx19(
8047
- "div",
8048
- {
8049
- className: cn(
8050
- "agg-profile-main",
8051
- "flex min-w-0 flex-1 flex-col gap-4 sm:gap-6 h-full",
8052
- classNames == null ? void 0 : classNames.leftColumn
8053
- ),
8054
- children: /* @__PURE__ */ jsx19(
8055
- UserInfoCard,
8118
+ /* @__PURE__ */ jsxs18(
8119
+ "div",
8120
+ {
8121
+ className: cn(
8122
+ "agg-profile-summary grid grid-cols-1 gap-6 lg:items-stretch",
8123
+ isPaperMode ? "lg:grid-cols-[minmax(0,1fr)_minmax(0,626px)] lg:gap-7" : "lg:grid-cols-[1fr_minmax(300px,420px)] lg:gap-8"
8124
+ ),
8125
+ children: [
8126
+ /* @__PURE__ */ jsx19(
8127
+ "div",
8056
8128
  {
8057
- user: resolvedUser,
8058
- onEditProfile,
8059
- onDeposit,
8060
- onWithdraw,
8061
- isDepositBlocked,
8062
- className: cn("h-full", classNames == null ? void 0 : classNames.userInfoCard)
8129
+ className: cn(
8130
+ "agg-profile-main",
8131
+ "flex min-w-0 flex-1 flex-col gap-4 sm:gap-6 h-full",
8132
+ classNames == null ? void 0 : classNames.leftColumn
8133
+ ),
8134
+ children: /* @__PURE__ */ jsx19(
8135
+ UserInfoCard,
8136
+ {
8137
+ user: resolvedUser,
8138
+ onEditProfile,
8139
+ onDeposit: isPaperMode ? void 0 : onDeposit,
8140
+ onWithdraw: isPaperMode ? void 0 : onWithdraw,
8141
+ showEditOnlyActions: isPaperMode,
8142
+ isDepositBlocked,
8143
+ className: cn("h-full", classNames == null ? void 0 : classNames.userInfoCard)
8144
+ }
8145
+ )
8063
8146
  }
8064
- )
8065
- }
8066
- ),
8067
- /* @__PURE__ */ jsxs18(
8068
- "div",
8069
- {
8070
- className: cn(
8071
- "agg-profile-side-panels flex flex-col-reverse md:flex-col gap-4",
8072
- classNames == null ? void 0 : classNames.rightColumn
8073
8147
  ),
8074
- children: [
8075
- /* @__PURE__ */ jsxs18(
8076
- "div",
8077
- {
8078
- className: cn(
8079
- "grid gap-4",
8080
- isKalshiAvailable ? "grid-cols-1 sm:grid-cols-2" : "grid-cols-1"
8148
+ /* @__PURE__ */ jsxs18(
8149
+ "div",
8150
+ {
8151
+ className: cn(
8152
+ "agg-profile-side-panels flex flex-col gap-4",
8153
+ // Live mobile puts the withdrawable balance above positions so
8154
+ // Deposit is reachable without scrolling. A paper app has no
8155
+ // deposit, and Figma 4772:33625 orders it Positions Value →
8156
+ // Buying Power → Earnings, matching desktop.
8157
+ isPaperMode ? null : "flex-col-reverse md:flex-col",
8158
+ classNames == null ? void 0 : classNames.rightColumn
8159
+ ),
8160
+ children: [
8161
+ /* @__PURE__ */ jsxs18(
8162
+ "div",
8163
+ {
8164
+ className: cn(
8165
+ "grid gap-4",
8166
+ isKalshiAvailable && !isPaperMode ? "grid-cols-1 sm:grid-cols-2" : "grid-cols-1"
8167
+ ),
8168
+ children: [
8169
+ /* @__PURE__ */ jsx19(
8170
+ PositionsValueCard,
8171
+ {
8172
+ label: labels.userProfile.balance.positionsValue,
8173
+ valueLabel: positionsValueLabel,
8174
+ isLoading: isPositionsValueLoading,
8175
+ compact: isPaperMode
8176
+ }
8177
+ ),
8178
+ isKalshiAvailable && !isPaperMode ? /* @__PURE__ */ jsx19(
8179
+ PositionsValueCard,
8180
+ {
8181
+ label: labels.userProfile.balance.kalshiBalance,
8182
+ valueLabel: formatUsd2((_b = balanceState.kalshiBalance) != null ? _b : 0),
8183
+ icon: /* @__PURE__ */ jsx19(VenueLogo, { venue: Venue3.kalshi, size: "small", className: "size-4" })
8184
+ }
8185
+ ) : null
8186
+ ]
8187
+ }
8081
8188
  ),
8082
- children: [
8083
- /* @__PURE__ */ jsx19(
8084
- PositionsValueCard,
8085
- {
8086
- label: labels.userProfile.balance.positionsValue,
8087
- valueLabel: positionsValueLabel,
8088
- isLoading: isPositionsValueLoading
8089
- }
8090
- ),
8091
- isKalshiAvailable ? /* @__PURE__ */ jsx19(
8092
- PositionsValueCard,
8093
- {
8094
- label: labels.userProfile.balance.kalshiBalance,
8095
- valueLabel: formatUsd2((_a = balanceState.kalshiBalance) != null ? _a : 0),
8096
- icon: /* @__PURE__ */ jsx19(VenueLogo, { venue: Venue3.kalshi, size: "small", className: "size-4" })
8097
- }
8098
- ) : null
8099
- ]
8100
- }
8101
- ),
8102
- /* @__PURE__ */ jsx19(
8103
- AvailableBalanceCard,
8104
- {
8105
- valueLabel: availableBalanceLabel,
8106
- isLoading: isAvailableBalanceLoading,
8107
- chains: ((_b = balanceChainsOverride != null ? balanceChainsOverride : balanceState.availableBalanceBreakdown) != null ? _b : balanceState.balanceBreakdown).map((b) => ({
8108
- key: b.key,
8109
- label: b.label,
8110
- balance: b.balance,
8111
- accountCount: b.accountCount,
8112
- venues: b.venues
8113
- })),
8114
- manageButtonRef: manageBalancesButtonRef,
8115
- onManage: () => handleManageBalancesOpenChange(true)
8116
- }
8117
- )
8118
- ]
8119
- }
8120
- )
8121
- ] }),
8189
+ isPaperMode ? (
8190
+ // Paper apps have no withdrawable balance and no network
8191
+ // breakdown — simulated cash lives nowhere. Swap the whole
8192
+ // card for the two paper figures.
8193
+ /* @__PURE__ */ jsxs18("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2", children: [
8194
+ /* @__PURE__ */ jsx19(
8195
+ PositionsValueCard,
8196
+ {
8197
+ label: labels.paperTrading.profile.buyingPower,
8198
+ valueLabel: paperBuyingPowerLabel,
8199
+ isLoading: isAvailableBalanceLoading,
8200
+ compact: true,
8201
+ icon: /* @__PURE__ */ jsx19(
8202
+ Icon,
8203
+ {
8204
+ name: "paper-buying-power",
8205
+ className: "!h-4 !w-4 text-agg-muted-foreground",
8206
+ "aria-hidden": "true"
8207
+ }
8208
+ )
8209
+ }
8210
+ ),
8211
+ /* @__PURE__ */ jsx19(
8212
+ PositionsValueCard,
8213
+ {
8214
+ label: labels.paperTrading.profile.earnings,
8215
+ valueLabel: paperEarningsLabel,
8216
+ caption: labels.paperTrading.profile.earningsCaption,
8217
+ isLoading: isAvailableBalanceLoading,
8218
+ compact: true,
8219
+ icon: /* @__PURE__ */ jsx19(
8220
+ Icon,
8221
+ {
8222
+ name: "paper-earnings",
8223
+ className: "!h-4 !w-4 text-agg-muted-foreground",
8224
+ "aria-hidden": "true"
8225
+ }
8226
+ )
8227
+ }
8228
+ )
8229
+ ] })
8230
+ ) : /* @__PURE__ */ jsx19(
8231
+ AvailableBalanceCard,
8232
+ {
8233
+ valueLabel: availableBalanceLabel,
8234
+ isLoading: isAvailableBalanceLoading,
8235
+ chains: ((_c = balanceChainsOverride != null ? balanceChainsOverride : balanceState.availableBalanceBreakdown) != null ? _c : balanceState.balanceBreakdown).map((b) => ({
8236
+ key: b.key,
8237
+ label: b.label,
8238
+ balance: b.balance,
8239
+ accountCount: b.accountCount,
8240
+ venues: b.venues
8241
+ })),
8242
+ manageButtonRef: manageBalancesButtonRef,
8243
+ onManage: () => handleManageBalancesOpenChange(true)
8244
+ }
8245
+ )
8246
+ ]
8247
+ }
8248
+ )
8249
+ ]
8250
+ }
8251
+ ),
8122
8252
  /* @__PURE__ */ jsx19(
8123
8253
  PositionsActivity,
8124
8254
  {
8125
8255
  tab,
8126
8256
  onTabChange,
8127
- showOpenOrders: showLimitOrders,
8257
+ showOpenOrders: showLimitOrders && !isPaperMode,
8128
8258
  activePositions: resolvedActivePositions,
8129
8259
  closedPositions: resolvedClosedPositions,
8130
8260
  activities: resolvedActivities,