@agg-build/ui 4.2.0 → 4.4.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 (64) hide show
  1. package/README.md +21 -16
  2. package/dist/{chunk-DNPDXL2D.mjs → chunk-64BBTXFE.mjs} +333 -102
  3. package/dist/{chunk-WDCH4RRS.mjs → chunk-6STRIKUA.mjs} +1 -1
  4. package/dist/{chunk-FTL25XKE.mjs → chunk-734VTGCV.mjs} +1 -1
  5. package/dist/{chunk-QW7VFURU.mjs → chunk-N7UPPT5J.mjs} +53 -3
  6. package/dist/{chunk-6X6Y4INU.mjs → chunk-UCU2XCV5.mjs} +2 -2
  7. package/dist/{chunk-GNEFI4SO.mjs → chunk-V5CRUO6S.mjs} +637 -380
  8. package/dist/{chunk-UDBHAZJJ.mjs → chunk-WW5QKNIM.mjs} +270 -123
  9. package/dist/events.js +1061 -645
  10. package/dist/events.mjs +6 -4
  11. package/dist/index.js +2923 -2251
  12. package/dist/index.mjs +12 -8
  13. package/dist/modals.js +9 -2
  14. package/dist/modals.mjs +3 -3
  15. package/dist/pages.js +2391 -1721
  16. package/dist/pages.mjs +8 -6
  17. package/dist/primitives.js +30 -3
  18. package/dist/primitives.mjs +1 -1
  19. package/dist/styles.css +1 -1
  20. package/dist/tailwind.css +1 -1
  21. package/dist/trading.js +330 -99
  22. package/dist/trading.mjs +4 -4
  23. package/dist/types/events/index.d.mts +1 -0
  24. package/dist/types/events/index.d.ts +1 -0
  25. package/dist/types/events/item-details/event-list-item-details-market-selector.d.mts +4 -1
  26. package/dist/types/events/item-details/event-list-item-details-market-selector.d.ts +4 -1
  27. package/dist/types/events/item-details/event-list-item-details.types.d.mts +25 -1
  28. package/dist/types/events/item-details/event-list-item-details.types.d.ts +25 -1
  29. package/dist/types/events/item-details/index.d.mts +1 -1
  30. package/dist/types/events/item-details/index.d.ts +1 -1
  31. package/dist/types/events/market-details/index.d.mts +1 -1
  32. package/dist/types/events/market-details/index.d.ts +1 -1
  33. package/dist/types/events/market-details/market-details.types.d.mts +4 -0
  34. package/dist/types/events/market-details/market-details.types.d.ts +4 -0
  35. package/dist/types/events/shared/format-event-title.d.mts +9 -1
  36. package/dist/types/events/shared/format-event-title.d.ts +9 -1
  37. package/dist/types/events/shared/format-sports-event-time.d.mts +2 -0
  38. package/dist/types/events/shared/format-sports-event-time.d.ts +2 -0
  39. package/dist/types/events/shared/sports-live-score.d.mts +10 -0
  40. package/dist/types/events/shared/sports-live-score.d.ts +10 -0
  41. package/dist/types/pages/event-market/event-market.types.d.mts +4 -0
  42. package/dist/types/pages/event-market/event-market.types.d.ts +4 -0
  43. package/dist/types/pages/event-market/index.d.mts +1 -0
  44. package/dist/types/pages/event-market/index.d.ts +1 -0
  45. package/dist/types/pages/user-profile/components/available-balance-card.d.mts +5 -0
  46. package/dist/types/pages/user-profile/components/available-balance-card.d.ts +5 -0
  47. package/dist/types/pages/user-profile/components/open-order-row.d.mts +1 -0
  48. package/dist/types/pages/user-profile/components/open-order-row.d.ts +1 -0
  49. package/dist/types/pages/user-profile/components/positions-activity.d.mts +1 -1
  50. package/dist/types/pages/user-profile/components/positions-activity.d.ts +1 -1
  51. package/dist/types/pages/user-profile/user-profile.types.d.mts +1 -1
  52. package/dist/types/pages/user-profile/user-profile.types.d.ts +1 -1
  53. package/dist/types/trading/place-order/index.d.mts +1 -1
  54. package/dist/types/trading/place-order/index.d.ts +1 -1
  55. package/dist/types/trading/place-order/index.place-order.execution-steps.d.mts +13 -1
  56. package/dist/types/trading/place-order/index.place-order.execution-steps.d.ts +13 -1
  57. package/dist/types/trading/place-order/index.place-order.execution-view.d.mts +2 -1
  58. package/dist/types/trading/place-order/index.place-order.execution-view.d.ts +2 -1
  59. package/dist/types/trading/place-order/index.place-order.types.d.mts +9 -0
  60. package/dist/types/trading/place-order/index.place-order.types.d.ts +9 -0
  61. package/dist/types/trading/place-order/index.place-order.utils.d.mts +6 -0
  62. package/dist/types/trading/place-order/index.place-order.utils.d.ts +6 -0
  63. package/package.json +3 -3
  64. /package/dist/{chunk-KHHFHXXD.mjs → chunk-JH4B3ZHQ.mjs} +0 -0
@@ -10,7 +10,7 @@ import {
10
10
  isErrorWithStatus,
11
11
  useEventListTabs,
12
12
  useEventListTabsHeaderOverflow
13
- } from "./chunk-GNEFI4SO.mjs";
13
+ } from "./chunk-V5CRUO6S.mjs";
14
14
  import {
15
15
  DEPOSIT_MODAL_OPEN_EVENT,
16
16
  PlaceOrder,
@@ -19,12 +19,12 @@ import {
19
19
  formatChainIdLabel,
20
20
  useClaimWinnings,
21
21
  useResolvedMarketClaim
22
- } from "./chunk-DNPDXL2D.mjs";
22
+ } from "./chunk-64BBTXFE.mjs";
23
23
  import {
24
24
  getDisplayOutcomePrice,
25
25
  resolveHeaderOutcomeItems,
26
26
  resolveMarketFromVenueMarkets
27
- } from "./chunk-WDCH4RRS.mjs";
27
+ } from "./chunk-6STRIKUA.mjs";
28
28
  import {
29
29
  AggErrorBoundary,
30
30
  Button,
@@ -51,6 +51,8 @@ import {
51
51
  __spreadValues,
52
52
  cn,
53
53
  filterOpenEvents,
54
+ formatRecurringMarketPillTimeEt,
55
+ formatRecurringMarketWindowTimeEt,
54
56
  formatUsd,
55
57
  normalizeVenueMarketCluster,
56
58
  resolveTabVenus,
@@ -58,7 +60,7 @@ import {
58
60
  skeletonViews,
59
61
  sortCategoriesForNavigation,
60
62
  useOptionalToast
61
- } from "./chunk-QW7VFURU.mjs";
63
+ } from "./chunk-N7UPPT5J.mjs";
62
64
 
63
65
  // src/pages/home/index.tsx
64
66
  import {
@@ -66,24 +68,27 @@ import {
66
68
  useAppConfig,
67
69
  useCategories,
68
70
  useEventListState,
69
- useLabels as useLabels4,
71
+ useLabels as useLabels5,
70
72
  useSdkUiConfig as useSdkUiConfig4,
71
73
  useSearch,
72
74
  useVenueMarketMidpoints
73
75
  } from "@agg-build/hooks";
74
76
  import { VENUES } from "@agg-build/sdk";
75
- import { useCallback as useCallback4, useEffect as useEffect8, useMemo as useMemo5, useRef as useRef7, useState as useState9 } from "react";
77
+ import { useCallback as useCallback5, useEffect as useEffect8, useMemo as useMemo5, useRef as useRef7, useState as useState9 } from "react";
76
78
 
77
79
  // src/pages/event-market/index.tsx
78
80
  import {
81
+ resolveRecurringCryptoTimeline,
79
82
  resolveEventTradingState as resolveEventTradingState3,
80
83
  TradeSide as TradeSide2,
81
84
  useEnrichedVenueEvent,
82
85
  useEventTradingContext as useEventTradingContext4,
86
+ useLabels as useLabels4,
83
87
  useMidpoints as useMidpoints2,
88
+ useRecurringCryptoMarkets,
84
89
  useSdkUiConfig as useSdkUiConfig3
85
90
  } from "@agg-build/hooks";
86
- import { useEffect as useEffect6, useMemo as useMemo4, useRef as useRef5, useState as useState6 } from "react";
91
+ import { useCallback as useCallback3, useEffect as useEffect6, useMemo as useMemo4, useRef as useRef5, useState as useState6 } from "react";
87
92
 
88
93
  // src/pages/event-market/event-market.utils.ts
89
94
  var EVENT_MARKET_PAGE_STICKY_HEADER_OFFSET_PX = 48;
@@ -382,7 +387,8 @@ import {
382
387
  TradeSide,
383
388
  useEventTradingContext as useEventTradingContext3,
384
389
  useMidpoints,
385
- useSdkUiConfig as useSdkUiConfig2
390
+ useSdkUiConfig as useSdkUiConfig2,
391
+ useSportsLive
386
392
  } from "@agg-build/hooks";
387
393
  import { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo3, useRef as useRef4, useState as useState5 } from "react";
388
394
 
@@ -1650,27 +1656,6 @@ var SportsMarketCard = ({
1650
1656
  tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(activeMarket.id, firstOutcome.id);
1651
1657
  }
1652
1658
  }, [activeDefaultOutcome, isExpanded, activeMarket, tradingContext]);
1653
- if (!activeMarket) return null;
1654
- const activeOutcome = (_g = activeMarket.venueMarketOutcomes.find(
1655
- (outcome) => outcome.id === (tradingContext == null ? void 0 : tradingContext.selectedOutcomeId)
1656
- )) != null ? _g : activeDefaultOutcome;
1657
- const activeOutcomeVenueCount = (() => {
1658
- var _a2, _b2;
1659
- if (!activeOutcome) return collectVenueNames(activeMarket).length;
1660
- const venueNames = /* @__PURE__ */ new Set([activeMarket.venue]);
1661
- for (const matchedOutcome of (_a2 = activeOutcome.matchedVenueMarketOutcomes) != null ? _a2 : []) {
1662
- const matchedVenueMarket = (_b2 = activeMarket.matchedVenueMarkets) == null ? void 0 : _b2.find(
1663
- (market) => market.id === matchedOutcome.venueMarketId
1664
- );
1665
- if (matchedVenueMarket == null ? void 0 : matchedVenueMarket.venue) {
1666
- venueNames.add(matchedVenueMarket.venue);
1667
- }
1668
- }
1669
- return venueNames.size > 0 ? venueNames.size : collectVenueNames(activeMarket).length;
1670
- })();
1671
- const activeMarketVolume = resolveSportsExpandedMarketsVolume([activeMarket]);
1672
- const totalGroupVolume = resolveSportsExpandedMarketsVolume(group.markets);
1673
- const compactSubtitle = `${activeOutcomeVenueCount} ${activeOutcomeVenueCount === 1 ? labels.marketDetails.meta.venueSingular : labels.marketDetails.meta.venuePlural} \xB7 ${formatCompactCurrency(activeMarketVolume || resolveTotalGroupVolume([activeMarket]))} ${labels.eventMarketPage.sports.volumeShort} \xB7 ${formatCompactCurrency(totalGroupVolume || resolveTotalGroupVolume(group.markets))} ${labels.eventMarketPage.sports.totalVolumeShort}`;
1674
1659
  const combinedMoneylineHeaderOutcomeItems = useMemo(() => {
1675
1660
  if (!isCombinedMoneylineGroup) return void 0;
1676
1661
  return combinedMoneylineMarkets.flatMap((market, index) => {
@@ -1708,6 +1693,27 @@ var SportsMarketCard = ({
1708
1693
  midpointsResult
1709
1694
  });
1710
1695
  }, [slide.kind, activeMarket, group.markets, midpointsResult]);
1696
+ if (!activeMarket) return null;
1697
+ const activeOutcome = (_g = activeMarket.venueMarketOutcomes.find(
1698
+ (outcome) => outcome.id === (tradingContext == null ? void 0 : tradingContext.selectedOutcomeId)
1699
+ )) != null ? _g : activeDefaultOutcome;
1700
+ const activeOutcomeVenueCount = (() => {
1701
+ var _a2, _b2;
1702
+ if (!activeOutcome) return collectVenueNames(activeMarket).length;
1703
+ const venueNames = /* @__PURE__ */ new Set([activeMarket.venue]);
1704
+ for (const matchedOutcome of (_a2 = activeOutcome.matchedVenueMarketOutcomes) != null ? _a2 : []) {
1705
+ const matchedVenueMarket = (_b2 = activeMarket.matchedVenueMarkets) == null ? void 0 : _b2.find(
1706
+ (market) => market.id === matchedOutcome.venueMarketId
1707
+ );
1708
+ if (matchedVenueMarket == null ? void 0 : matchedVenueMarket.venue) {
1709
+ venueNames.add(matchedVenueMarket.venue);
1710
+ }
1711
+ }
1712
+ return venueNames.size > 0 ? venueNames.size : collectVenueNames(activeMarket).length;
1713
+ })();
1714
+ const activeMarketVolume = resolveSportsExpandedMarketsVolume([activeMarket]);
1715
+ const totalGroupVolume = resolveSportsExpandedMarketsVolume(group.markets);
1716
+ const compactSubtitle = `${activeOutcomeVenueCount} ${activeOutcomeVenueCount === 1 ? labels.marketDetails.meta.venueSingular : labels.marketDetails.meta.venuePlural} \xB7 ${formatCompactCurrency(activeMarketVolume || resolveTotalGroupVolume([activeMarket]))} ${labels.eventMarketPage.sports.volumeShort} \xB7 ${formatCompactCurrency(totalGroupVolume || resolveTotalGroupVolume(group.markets))} ${labels.eventMarketPage.sports.totalVolumeShort}`;
1711
1717
  const headerOutcomeItemsOverride = combinedMoneylineHeaderOutcomeItems != null ? combinedMoneylineHeaderOutcomeItems : spreadHeaderOutcomeItems;
1712
1718
  const headerOutcomeVariant = isCombinedMoneylineGroup ? "outcome" : resolveSportsMarketCardVariant(activeMarket);
1713
1719
  const handleLineSelect = (index) => {
@@ -2145,6 +2151,7 @@ var SportsEventMarketPage = ({
2145
2151
  const [isMobileTradeOpen, setIsMobileTradeOpen] = useState5(false);
2146
2152
  const isMobileViewport = useIsMobileEventMarketViewport(SPORTS_EVENT_MARKET_MEDIA_QUERY);
2147
2153
  const tradingContext = useEventTradingContext3();
2154
+ const { stateByEventId: sportsLiveStateByEventId } = useSportsLive([event.id]);
2148
2155
  const midpointsResult = useMidpoints(composedEvent.venueMarkets);
2149
2156
  const internalResolvedClaim = useResolvedMarketClaim({
2150
2157
  market: eventTradingState.primaryMarket,
@@ -2216,6 +2223,7 @@ var SportsEventMarketPage = ({
2216
2223
  defaultOutcomeId,
2217
2224
  eventTradingState,
2218
2225
  midpointsResult,
2226
+ sportsLiveState: sportsLiveStateByEventId.get(event.id),
2219
2227
  classNames: {
2220
2228
  root: cn("agg-event-hero", classNames == null ? void 0 : classNames.hero),
2221
2229
  // The sports tabs + market cards own market navigation, so hide the
@@ -2317,6 +2325,36 @@ SportsEventMarketPage.displayName = "SportsEventMarketPage";
2317
2325
 
2318
2326
  // src/pages/event-market/index.tsx
2319
2327
  import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
2328
+ var CLOCK_INTERVAL_MS = 1e3;
2329
+ var formatRecurringCountdown = (remainingMs) => {
2330
+ if (!Number.isFinite(remainingMs) || remainingMs <= 0) return null;
2331
+ const totalSeconds = Math.ceil(remainingMs / 1e3);
2332
+ const hours = Math.floor(totalSeconds / 3600);
2333
+ const minutes = Math.floor(totalSeconds % 3600 / 60);
2334
+ const seconds = totalSeconds % 60;
2335
+ const minuteSecondLabel = `${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`;
2336
+ return hours > 0 ? `${hours}:${minuteSecondLabel}` : minuteSecondLabel;
2337
+ };
2338
+ var useCurrentTimestamp = (enabled) => {
2339
+ const [currentTimestamp, setCurrentTimestamp] = useState6(null);
2340
+ useEffect6(() => {
2341
+ if (!enabled) {
2342
+ setCurrentTimestamp(null);
2343
+ return;
2344
+ }
2345
+ const updateCurrentTimestamp = () => {
2346
+ setCurrentTimestamp(Date.now());
2347
+ };
2348
+ updateCurrentTimestamp();
2349
+ const intervalId = window.setInterval(updateCurrentTimestamp, CLOCK_INTERVAL_MS);
2350
+ document.addEventListener("visibilitychange", updateCurrentTimestamp);
2351
+ return () => {
2352
+ window.clearInterval(intervalId);
2353
+ document.removeEventListener("visibilitychange", updateCurrentTimestamp);
2354
+ };
2355
+ }, [enabled]);
2356
+ return currentTimestamp;
2357
+ };
2320
2358
  var EventMarketPageContent = ({
2321
2359
  event,
2322
2360
  defaultMarketId,
@@ -2327,8 +2365,10 @@ var EventMarketPageContent = ({
2327
2365
  executionMode,
2328
2366
  stickyOrderPanel,
2329
2367
  resolvedClaim,
2330
- onBeforePrimaryAction
2368
+ onBeforePrimaryAction,
2369
+ onRecurringMarketNavigate
2331
2370
  }) => {
2371
+ var _a;
2332
2372
  const eventTradingState = useMemo4(() => resolveEventTradingState3(event), [event]);
2333
2373
  const stickyOrderPanelState = resolveEventMarketPageStickyState({
2334
2374
  stickyOrderPanel
@@ -2340,11 +2380,93 @@ var EventMarketPageContent = ({
2340
2380
  const [isMobileTradeOpen, setIsMobileTradeOpen] = useState6(false);
2341
2381
  const isMobileViewport = useIsMobileEventMarketViewport();
2342
2382
  const tradingContext = useEventTradingContext4();
2383
+ const labels = useLabels4();
2384
+ const recurringQuery = useRecurringCryptoMarkets({ event });
2385
+ const currentTimestamp = useCurrentTimestamp(recurringQuery.isRecurringCryptoMarket);
2386
+ const recurringTimeline = useMemo4(
2387
+ () => currentTimestamp == null ? null : resolveRecurringCryptoTimeline(recurringQuery.windows, event, currentTimestamp),
2388
+ [currentTimestamp, event, recurringQuery.windows]
2389
+ );
2390
+ const isRecurringCryptoMarket = (recurringTimeline == null ? void 0 : recurringTimeline.viewed) != null;
2391
+ const recurringViewedEndTimestamp = (recurringTimeline == null ? void 0 : recurringTimeline.viewed) ? Date.parse(recurringTimeline.viewed.windowEnd) : Number.NaN;
2392
+ const hasViewedMarketEnded = currentTimestamp != null && Number.isFinite(recurringViewedEndTimestamp) && currentTimestamp >= recurringViewedEndTimestamp;
2393
+ const isRecurringResolvingMarket = recurringQuery.isRecurringCryptoMarket && eventTradingState.kind === "closed";
2394
+ const lastBoundaryRefetchRef = useRef5(null);
2395
+ useEffect6(() => {
2396
+ lastBoundaryRefetchRef.current = null;
2397
+ }, [event.id]);
2398
+ useEffect6(() => {
2399
+ if (!isRecurringCryptoMarket || !hasViewedMarketEnded || !(recurringTimeline == null ? void 0 : recurringTimeline.viewed)) return;
2400
+ const refetchKey = `${event.id}:${recurringTimeline.viewed.windowEnd}`;
2401
+ if (lastBoundaryRefetchRef.current === refetchKey) return;
2402
+ lastBoundaryRefetchRef.current = refetchKey;
2403
+ void recurringQuery.refetch();
2404
+ }, [
2405
+ event.id,
2406
+ hasViewedMarketEnded,
2407
+ isRecurringCryptoMarket,
2408
+ recurringQuery,
2409
+ recurringTimeline == null ? void 0 : recurringTimeline.viewed
2410
+ ]);
2411
+ const handleRecurringMarketSelect = useCallback3(
2412
+ (eventId) => {
2413
+ if (!onRecurringMarketNavigate || eventId === event.id) return;
2414
+ onRecurringMarketNavigate(eventId, { replace: false });
2415
+ },
2416
+ [event.id, onRecurringMarketNavigate]
2417
+ );
2418
+ const handleGoToLive = useCallback3(() => {
2419
+ var _a2;
2420
+ const liveEventId = (_a2 = recurringTimeline == null ? void 0 : recurringTimeline.live) == null ? void 0 : _a2.venueEventId;
2421
+ if (!onRecurringMarketNavigate || !liveEventId || liveEventId === event.id) return;
2422
+ onRecurringMarketNavigate(liveEventId, { replace: false });
2423
+ }, [event.id, onRecurringMarketNavigate, (_a = recurringTimeline == null ? void 0 : recurringTimeline.live) == null ? void 0 : _a.venueEventId]);
2424
+ const recurringMarketsPresentation = useMemo4(() => {
2425
+ var _a2, _b;
2426
+ if (!isRecurringCryptoMarket || !(recurringTimeline == null ? void 0 : recurringTimeline.viewed)) return void 0;
2427
+ const toOption = (market) => {
2428
+ var _a3;
2429
+ return {
2430
+ value: market.venueEventId,
2431
+ label: (_a3 = formatRecurringMarketPillTimeEt(market.windowStart)) != null ? _a3 : market.windowStart
2432
+ };
2433
+ };
2434
+ const countdownLabel = ((_a2 = recurringTimeline.live) == null ? void 0 : _a2.venueEventId) === event.id ? formatRecurringCountdown(recurringViewedEndTimestamp - currentTimestamp) : null;
2435
+ return {
2436
+ visibleOptions: recurringTimeline.visible.map(toOption),
2437
+ browseOptions: recurringTimeline.all.map(toOption),
2438
+ selectedValue: event.id,
2439
+ liveValue: (_b = recurringTimeline.live) == null ? void 0 : _b.venueEventId,
2440
+ duration: recurringTimeline.viewed.duration,
2441
+ windowLabel: formatRecurringMarketWindowTimeEt(
2442
+ recurringTimeline.viewed.windowStart,
2443
+ recurringTimeline.viewed.windowEnd
2444
+ ),
2445
+ countdownLabel,
2446
+ countdownAriaLabel: countdownLabel ? labels.eventMarketPage.recurringCountdownAria(countdownLabel) : null,
2447
+ isResolving: hasViewedMarketEnded,
2448
+ canGoToLive: recurringTimeline.live != null && recurringTimeline.live.venueEventId !== event.id,
2449
+ onSelect: handleRecurringMarketSelect,
2450
+ onGoToLive: handleGoToLive
2451
+ };
2452
+ }, [
2453
+ currentTimestamp,
2454
+ event.id,
2455
+ handleGoToLive,
2456
+ handleRecurringMarketSelect,
2457
+ hasViewedMarketEnded,
2458
+ isRecurringCryptoMarket,
2459
+ labels.eventMarketPage,
2460
+ recurringTimeline,
2461
+ recurringViewedEndTimestamp
2462
+ ]);
2343
2463
  const eventDetailVenueMarkets = useMemo4(
2344
2464
  () => normalizeVenueMarketCluster(event.venueMarkets),
2345
2465
  [event.venueMarkets]
2346
2466
  );
2347
- const midpointsResult = useMidpoints2(eventDetailVenueMarkets);
2467
+ const midpointsResult = useMidpoints2(
2468
+ recurringQuery.isRecurringCryptoMarket && eventTradingState.kind !== "open" ? [] : eventDetailVenueMarkets
2469
+ );
2348
2470
  const internalResolvedClaim = useResolvedMarketClaim({
2349
2471
  market: eventTradingState.primaryMarket,
2350
2472
  enabled: eventTradingState.kind === "resolved",
@@ -2355,8 +2477,8 @@ var EventMarketPageContent = ({
2355
2477
  setTradeSideRef.current = tradingContext == null ? void 0 : tradingContext.setTradeSide;
2356
2478
  useEffect6(() => {
2357
2479
  return () => {
2358
- var _a;
2359
- (_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, TradeSide2.Buy);
2480
+ var _a2;
2481
+ (_a2 = setTradeSideRef.current) == null ? void 0 : _a2.call(setTradeSideRef, TradeSide2.Buy);
2360
2482
  };
2361
2483
  }, []);
2362
2484
  if (!event.venueMarkets.length) {
@@ -2400,6 +2522,7 @@ var EventMarketPageContent = ({
2400
2522
  defaultOutcomeId,
2401
2523
  eventTradingState,
2402
2524
  midpointsResult,
2525
+ recurringMarkets: recurringMarketsPresentation,
2403
2526
  classNames: {
2404
2527
  root: cn("agg-event-hero", classNames == null ? void 0 : classNames.hero)
2405
2528
  }
@@ -2412,6 +2535,7 @@ var EventMarketPageContent = ({
2412
2535
  markets: eventTradingState.displayMarkets,
2413
2536
  eventTradingState,
2414
2537
  live: true,
2538
+ showResolvingState: isRecurringResolvingMarket,
2415
2539
  expandSelectedMarketOnChange: !isMobileViewport,
2416
2540
  autoExpandFallbackMarket: !isMobileViewport,
2417
2541
  autoSelectFallbackMarket: !isMobileViewport,
@@ -2430,6 +2554,7 @@ var EventMarketPageContent = ({
2430
2554
  executionMode: resolvedExecutionMode,
2431
2555
  isQuotePanelActive: isMobileViewport,
2432
2556
  resolvedClaim: effectiveResolvedClaim,
2557
+ showResolvingState: isRecurringResolvingMarket,
2433
2558
  midpointsResult,
2434
2559
  onBeforePrimaryAction,
2435
2560
  className: cn(
@@ -2458,6 +2583,7 @@ var EventMarketPageContent = ({
2458
2583
  executionMode: resolvedExecutionMode,
2459
2584
  isQuotePanelActive: !isMobileViewport,
2460
2585
  resolvedClaim: effectiveResolvedClaim,
2586
+ showResolvingState: isRecurringResolvingMarket,
2461
2587
  midpointsResult,
2462
2588
  onBeforePrimaryAction,
2463
2589
  className: cn(stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.placeOrder, classNames == null ? void 0 : classNames.trade),
@@ -2628,14 +2754,14 @@ function useScrollRestoration({
2628
2754
  }
2629
2755
 
2630
2756
  // src/pages/home/use-home-page-modals.ts
2631
- import { useCallback as useCallback3, useEffect as useEffect7, useState as useState8 } from "react";
2757
+ import { useCallback as useCallback4, useEffect as useEffect7, useState as useState8 } from "react";
2632
2758
  var useHomePageModals = () => {
2633
2759
  const [profileOpen, setProfileOpen] = useState8(false);
2634
2760
  const [depositOpen, setDepositOpen] = useState8(false);
2635
2761
  const [withdrawOpen, setWithdrawOpen] = useState8(false);
2636
- const onProfileClick = useCallback3(() => setProfileOpen(true), []);
2637
- const onDepositClick = useCallback3(() => setDepositOpen(true), []);
2638
- const onWithdrawClick = useCallback3(() => setWithdrawOpen(true), []);
2762
+ const onProfileClick = useCallback4(() => setProfileOpen(true), []);
2763
+ const onDepositClick = useCallback4(() => setDepositOpen(true), []);
2764
+ const onWithdrawClick = useCallback4(() => setWithdrawOpen(true), []);
2639
2765
  useEffect7(() => {
2640
2766
  if (typeof window === "undefined") return;
2641
2767
  window.addEventListener(DEPOSIT_MODAL_OPEN_EVENT, onDepositClick);
@@ -2684,7 +2810,7 @@ var HomeSearchResults = ({
2684
2810
  onEventClick,
2685
2811
  onMarketClick
2686
2812
  }) => {
2687
- const labels = useLabels4();
2813
+ const labels = useLabels5();
2688
2814
  const { search: searchConfig } = useSdkUiConfig4();
2689
2815
  const { disabledVenues } = useAppConfig();
2690
2816
  const [activeVenueTabValue, setActiveVenueTabValue] = useState9("all");
@@ -2886,7 +3012,7 @@ var HomePage = ({
2886
3012
  stickyOrderPanel
2887
3013
  }) => {
2888
3014
  var _a, _b, _c, _d;
2889
- const labels = useLabels4();
3015
+ const labels = useLabels5();
2890
3016
  const {
2891
3017
  search: {
2892
3018
  value: searchValue,
@@ -2900,7 +3026,7 @@ var HomePage = ({
2900
3026
  const { capture, consume } = useEventListState();
2901
3027
  const [snapshot] = useState9(() => consume());
2902
3028
  const eventListStateRef = useRef7(null);
2903
- const handleSelectEvent = useCallback4(
3029
+ const handleSelectEvent = useCallback5(
2904
3030
  (event) => {
2905
3031
  var _a2, _b2, _c2, _d2;
2906
3032
  capture({
@@ -3189,16 +3315,17 @@ import {
3189
3315
  useExecutionOrders,
3190
3316
  useExecutionPositions,
3191
3317
  useGeoBlock,
3192
- useLabels as useLabels12,
3318
+ useLabels as useLabels13,
3193
3319
  useSdkUiConfig as useSdkUiConfig5,
3194
3320
  useUserActivity
3195
3321
  } from "@agg-build/hooks";
3196
3322
  import { Venue as Venue3 } from "@agg-build/sdk";
3197
3323
  import dayjs from "dayjs";
3198
- import { useCallback as useCallback6, useEffect as useEffect11, useMemo as useMemo8, useRef as useRef10, useState as useState12 } from "react";
3324
+ import { useCallback as useCallback7, useEffect as useEffect11, useMemo as useMemo8, useRef as useRef10, useState as useState12 } from "react";
3199
3325
 
3200
3326
  // src/pages/user-profile/components/available-balance-card.tsx
3201
- import { useLabels as useLabels5 } from "@agg-build/hooks";
3327
+ import { useLabels as useLabels6 } from "@agg-build/hooks";
3328
+ import { ACTIVE_VENUES, VENUE_CHAIN_IDS } from "@agg-build/sdk";
3202
3329
  import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
3203
3330
  var BASE_URL = "https://assets.snagsolutions.io";
3204
3331
  var CHAIN_ID_TO_ICON_URL = {
@@ -3217,16 +3344,8 @@ var CHAIN_ID_TO_ICON_URL = {
3217
3344
  "2741": `${BASE_URL}/public/prediction-markets/logos/Abstract.svg`,
3218
3345
  "792703809": `${BASE_URL}/public/prediction-markets/logos/Solana.svg`
3219
3346
  };
3220
- var CHAIN_VENUE_MAP = {
3221
- "137": ["polymarket"],
3222
- // Polygon
3223
- "792703809": ["kalshi"],
3224
- // Solana
3225
- "56": ["limitless", "opinion"],
3226
- // BNB
3227
- "1337": ["hyperliquid"]
3228
- // HyperCore
3229
- };
3347
+ var venueLogosForChain = (chainId) => ACTIVE_VENUES.filter((venue) => VENUE_CHAIN_IDS[venue] === Number(chainId));
3348
+ var isVenueBalanceChain = (chainId) => Object.values(VENUE_CHAIN_IDS).includes(Number(chainId));
3230
3349
  var isPaperChain = (row) => {
3231
3350
  return row.key === "0" || row.label.trim().toLowerCase() === "paper";
3232
3351
  };
@@ -3256,7 +3375,7 @@ var AvailableBalanceCard = ({
3256
3375
  onManage,
3257
3376
  manageButtonRef
3258
3377
  }) => {
3259
- const labels = useLabels5();
3378
+ const labels = useLabels6();
3260
3379
  const balanceLabels = labels.userProfile.balance;
3261
3380
  const resolvedLabel = label != null ? label : balanceLabels.availableBalance;
3262
3381
  const hasPaperBalance = chains.some(isPaperChain);
@@ -3297,7 +3416,6 @@ var AvailableBalanceCard = ({
3297
3416
  content: /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-4 items-start justify-start", children: [
3298
3417
  /* @__PURE__ */ jsx8("div", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: balanceLabels.balanceByNetwork }),
3299
3418
  /* @__PURE__ */ jsx8("div", { role: "list", className: "agg-balance-list flex flex-col gap-3 w-full", children: chains.map((row) => {
3300
- var _a;
3301
3419
  const iconUrl = chainIconUrl(row.label, row.key);
3302
3420
  const isPaper = isPaperChain(row);
3303
3421
  const rowLabel = isPaper ? balanceLabels.paperModeNetwork : row.label;
@@ -3325,7 +3443,7 @@ var AvailableBalanceCard = ({
3325
3443
  minimumFractionDigits: Number.isInteger(row.balance) ? 0 : 1,
3326
3444
  maximumFractionDigits: 2
3327
3445
  }) }),
3328
- /* @__PURE__ */ jsx8("div", { className: "flex w-12 shrink-0 items-center justify-end gap-1", children: ((_a = CHAIN_VENUE_MAP[row.key]) != null ? _a : []).slice(0, 2).map((venue, venueIndex) => /* @__PURE__ */ jsx8(
3446
+ /* @__PURE__ */ jsx8("div", { className: "flex w-12 shrink-0 items-center justify-end gap-1", children: venueLogosForChain(row.key).slice(0, 2).map((venue, venueIndex) => /* @__PURE__ */ jsx8(
3329
3447
  VenueLogo,
3330
3448
  {
3331
3449
  venue,
@@ -3411,7 +3529,7 @@ var AvailableBalanceCard = ({
3411
3529
  AvailableBalanceCard.displayName = "AvailableBalanceCard";
3412
3530
 
3413
3531
  // src/pages/user-profile/components/claim-activity-breakdown-modal.tsx
3414
- import { useLabels as useLabels6 } from "@agg-build/hooks";
3532
+ import { useLabels as useLabels7 } from "@agg-build/hooks";
3415
3533
  import { Venue } from "@agg-build/sdk";
3416
3534
  import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
3417
3535
  var CLAIM_VENUE_LABELS = {
@@ -3431,7 +3549,7 @@ var ClaimActivityBreakdownModal = ({
3431
3549
  onTransactionSelect
3432
3550
  }) => {
3433
3551
  var _a;
3434
- const labels = useLabels6();
3552
+ const labels = useLabels7();
3435
3553
  return /* @__PURE__ */ jsx9(
3436
3554
  Modal,
3437
3555
  {
@@ -3544,24 +3662,29 @@ import {
3544
3662
  useAggBalance,
3545
3663
  useBalanceRefillPolicies,
3546
3664
  useDepositAddresses,
3547
- useLabels as useLabels7
3665
+ useLabels as useLabels8
3548
3666
  } from "@agg-build/hooks";
3549
- import { Venue as Venue2 } from "@agg-build/sdk";
3667
+ import {
3668
+ DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW,
3669
+ DEFAULT_BALANCE_REFILL_MAX_FEE_RAW,
3670
+ getBalanceRefillMaximumRaw,
3671
+ Venue as Venue2
3672
+ } from "@agg-build/sdk";
3550
3673
  import * as Dialog2 from "@radix-ui/react-dialog";
3551
- import { useCallback as useCallback5, useEffect as useEffect9, useId, useMemo as useMemo6, useRef as useRef8, useState as useState10 } from "react";
3674
+ import { useCallback as useCallback6, useEffect as useEffect9, useId, useMemo as useMemo6, useRef as useRef8, useState as useState10 } from "react";
3552
3675
  import { z } from "zod";
3553
3676
  import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
3554
3677
  var USDC_DECIMALS = 6;
3555
3678
  var EDITABLE_AMOUNT_PATTERN = /^\d*(?:\.\d{0,6})?$/;
3556
3679
  var FINAL_AMOUNT_PATTERN = /^\d+(?:\.\d{1,6})?$/;
3557
- var NETWORK_PRESENTATION = {
3558
- 137: { name: "Polygon", order: 0, venues: [Venue2.polymarket] },
3559
- 56: { name: "BNB", order: 1, venues: [Venue2.limitless, Venue2.myriad] },
3560
- 792703809: { name: "Solana", order: 2, venues: [Venue2.kalshi] },
3561
- 1337: { name: "Hyperliquid", order: 3, venues: [Venue2.hyperliquid] },
3562
- 42161: { name: "Arbitrum", order: 4, venues: [] },
3563
- 8453: { name: "Base", order: 5, venues: [] },
3564
- 1: { name: "Ethereum", order: 6, venues: [] }
3680
+ var NETWORK_ORDER = {
3681
+ 137: 0,
3682
+ 56: 1,
3683
+ 792703809: 2,
3684
+ 1337: 3,
3685
+ 42161: 4,
3686
+ 8453: 5,
3687
+ 1: 6
3565
3688
  };
3566
3689
  var VENUE_LABELS = {
3567
3690
  [Venue2.kalshi]: "Kalshi",
@@ -3605,11 +3728,11 @@ var areDraftsEqual = (current, initial) => {
3605
3728
  return currentMinimumRaw !== null && currentRefillToRaw !== null && currentMinimumRaw === initialMinimumRaw && currentRefillToRaw === initialRefillToRaw;
3606
3729
  };
3607
3730
  var getPolicyMaximumRaw = (policy) => {
3608
- if (!(policy == null ? void 0 : policy.dailyCapRaw) || !policy.maxFeeRaw) return null;
3609
- const dailyCapRaw = BigInt(policy.dailyCapRaw);
3610
- const maximumFeeRaw = BigInt(policy.maxFeeRaw);
3611
- if (dailyCapRaw <= maximumFeeRaw) return "0";
3612
- return (dailyCapRaw - maximumFeeRaw).toString();
3731
+ var _a, _b;
3732
+ return getBalanceRefillMaximumRaw(
3733
+ (_a = policy == null ? void 0 : policy.dailyCapRaw) != null ? _a : DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW,
3734
+ (_b = policy == null ? void 0 : policy.maxFeeRaw) != null ? _b : DEFAULT_BALANCE_REFILL_MAX_FEE_RAW
3735
+ );
3613
3736
  };
3614
3737
  var getApiFieldErrors = (error) => {
3615
3738
  var _a;
@@ -3624,7 +3747,7 @@ var ManageBalancesModal = ({
3624
3747
  open,
3625
3748
  onOpenChange
3626
3749
  }) => {
3627
- const labels = useLabels7();
3750
+ const labels = useLabels8();
3628
3751
  const refillLabels = labels.balanceRefill;
3629
3752
  const balanceState = useAggBalance();
3630
3753
  const depositAddressesQuery = useDepositAddresses({ enabled: open });
@@ -3644,28 +3767,27 @@ var ManageBalancesModal = ({
3644
3767
  const supportedChains = (_a = depositAddressesQuery.supportedChains) != null ? _a : [];
3645
3768
  const availableBalanceBreakdown = (_c = (_b = balanceState.availableBalanceBreakdown) != null ? _b : balanceState.balanceBreakdown) != null ? _c : [];
3646
3769
  return supportedChains.flatMap((chain) => {
3647
- var _a2, _b2;
3648
3770
  const usdcToken = chain.tokens.find((token) => token.symbol.toUpperCase() === "USDC");
3649
3771
  if (!usdcToken) return [];
3650
- const presentation = NETWORK_PRESENTATION[chain.chainId];
3651
3772
  const chainBalance = availableBalanceBreakdown.find(
3652
3773
  (balance) => balance.key === String(chain.chainId)
3653
3774
  );
3654
3775
  return [
3655
3776
  {
3656
3777
  chainId: chain.chainId,
3657
- name: (_a2 = presentation == null ? void 0 : presentation.name) != null ? _a2 : chain.name,
3778
+ name: chain.name,
3658
3779
  balance: chainBalance == null ? void 0 : chainBalance.balance,
3659
3780
  policy: policiesQuery.policies.find(
3660
3781
  (policy) => policy.targetChainId === chain.chainId && policy.targetTokenSymbol.toUpperCase() === "USDC"
3661
3782
  ),
3662
- venues: (_b2 = presentation == null ? void 0 : presentation.venues) != null ? _b2 : []
3783
+ canManageBalance: isVenueBalanceChain(chain.chainId),
3784
+ venues: venueLogosForChain(chain.chainId)
3663
3785
  }
3664
3786
  ];
3665
3787
  }).sort((left, right) => {
3666
- var _a2, _b2, _c2, _d;
3667
- const leftOrder = (_b2 = (_a2 = NETWORK_PRESENTATION[left.chainId]) == null ? void 0 : _a2.order) != null ? _b2 : Number.MAX_SAFE_INTEGER;
3668
- const rightOrder = (_d = (_c2 = NETWORK_PRESENTATION[right.chainId]) == null ? void 0 : _c2.order) != null ? _d : Number.MAX_SAFE_INTEGER;
3788
+ var _a2, _b2;
3789
+ const leftOrder = (_a2 = NETWORK_ORDER[left.chainId]) != null ? _a2 : Number.MAX_SAFE_INTEGER;
3790
+ const rightOrder = (_b2 = NETWORK_ORDER[right.chainId]) != null ? _b2 : Number.MAX_SAFE_INTEGER;
3669
3791
  if (leftOrder !== rightOrder) return leftOrder - rightOrder;
3670
3792
  return left.name.localeCompare(right.name);
3671
3793
  });
@@ -3700,7 +3822,7 @@ var ManageBalancesModal = ({
3700
3822
  setInitialDrafts(nextDrafts);
3701
3823
  setIsInitialized(true);
3702
3824
  }, [hasLoadError, isInitialized, isLoading, networks, open]);
3703
- const validateDraft = useCallback5(
3825
+ const validateDraft = useCallback6(
3704
3826
  (network, draft) => {
3705
3827
  const errors = {};
3706
3828
  const minimum = draft.minimum.trim();
@@ -3723,14 +3845,12 @@ var ManageBalancesModal = ({
3723
3845
  errors.refillTo = refillLabels.relationshipError;
3724
3846
  }
3725
3847
  const maximumRaw = getPolicyMaximumRaw(network.policy);
3726
- if (maximumRaw !== null) {
3727
- const maximumLabel = rawToDecimal(maximumRaw);
3728
- if (minimumRaw !== null && BigInt(minimumRaw) > BigInt(maximumRaw)) {
3729
- errors.minimum = refillLabels.maximumError(maximumLabel);
3730
- }
3731
- if (refillToRaw !== null && BigInt(refillToRaw) > BigInt(maximumRaw)) {
3732
- errors.refillTo = refillLabels.maximumError(maximumLabel);
3733
- }
3848
+ const maximumLabel = rawToDecimal(maximumRaw);
3849
+ if (minimumRaw !== null && BigInt(minimumRaw) > BigInt(maximumRaw)) {
3850
+ errors.minimum = refillLabels.maximumError(maximumLabel);
3851
+ }
3852
+ if (refillToRaw !== null && BigInt(refillToRaw) > BigInt(maximumRaw)) {
3853
+ errors.refillTo = refillLabels.maximumError(maximumLabel);
3734
3854
  }
3735
3855
  return errors;
3736
3856
  },
@@ -3738,7 +3858,7 @@ var ManageBalancesModal = ({
3738
3858
  );
3739
3859
  const dirtyNetworks = useMemo6(
3740
3860
  () => networks.filter((network) => {
3741
- if (network.venues.length === 0) return false;
3861
+ if (!network.canManageBalance) return false;
3742
3862
  if (resetChainIds.has(network.chainId)) return true;
3743
3863
  const draft = drafts[network.chainId];
3744
3864
  const initialDraft = initialDrafts[network.chainId];
@@ -3763,14 +3883,14 @@ var ManageBalancesModal = ({
3763
3883
  (errors) => errors.minimum || errors.refillTo || errors.general
3764
3884
  );
3765
3885
  const isSaveDisabled = dirtyNetworks.length === 0 || hasValidationErrors || isSaving;
3766
- const handleOpenChange = useCallback5(
3886
+ const handleOpenChange = useCallback6(
3767
3887
  (nextOpen) => {
3768
3888
  if (isSaving && !nextOpen) return;
3769
3889
  onOpenChange(nextOpen);
3770
3890
  },
3771
3891
  [isSaving, onOpenChange]
3772
3892
  );
3773
- const handleToggleNetwork = useCallback5((chainId, canManageBalance) => {
3893
+ const handleToggleNetwork = useCallback6((chainId, canManageBalance) => {
3774
3894
  if (!canManageBalance) return;
3775
3895
  setExpandedChainIds((current) => {
3776
3896
  const next = new Set(current);
@@ -3779,7 +3899,7 @@ var ManageBalancesModal = ({
3779
3899
  return next;
3780
3900
  });
3781
3901
  }, []);
3782
- const handleDraftChange = useCallback5(
3902
+ const handleDraftChange = useCallback6(
3783
3903
  (chainId, field, value) => {
3784
3904
  if (!EDITABLE_AMOUNT_PATTERN.test(value)) return;
3785
3905
  setDrafts((current) => {
@@ -3808,7 +3928,7 @@ var ManageBalancesModal = ({
3808
3928
  },
3809
3929
  []
3810
3930
  );
3811
- const handleResetNetwork = useCallback5((network) => {
3931
+ const handleResetNetwork = useCallback6((network) => {
3812
3932
  setDrafts((current) => __spreadProps(__spreadValues({}, current), {
3813
3933
  [network.chainId]: { minimum: "0", refillTo: "0" }
3814
3934
  }));
@@ -3824,7 +3944,7 @@ var ManageBalancesModal = ({
3824
3944
  return __spreadProps(__spreadValues({}, current), { [network.chainId]: {} });
3825
3945
  });
3826
3946
  }, []);
3827
- const handleAmountBlur = useCallback5((chainId, field) => {
3947
+ const handleAmountBlur = useCallback6((chainId, field) => {
3828
3948
  setDrafts((current) => {
3829
3949
  const currentDraft = current[chainId];
3830
3950
  if (!currentDraft) return current;
@@ -3835,12 +3955,12 @@ var ManageBalancesModal = ({
3835
3955
  });
3836
3956
  });
3837
3957
  }, []);
3838
- const handleRetry = useCallback5(() => {
3958
+ const handleRetry = useCallback6(() => {
3839
3959
  void depositAddressesQuery.refetch();
3840
3960
  void policiesQuery.refetch();
3841
3961
  balanceState.refetch();
3842
3962
  }, [balanceState, depositAddressesQuery, policiesQuery]);
3843
- const handleSave = useCallback5(() => __async(null, null, function* () {
3963
+ const handleSave = useCallback6(() => __async(null, null, function* () {
3844
3964
  if (savingRef.current || isSaveDisabled) return;
3845
3965
  savingRef.current = true;
3846
3966
  setIsSaving(true);
@@ -3976,7 +4096,7 @@ var ManageBalancesModal = ({
3976
4096
  }
3977
4097
  ) : /* @__PURE__ */ jsx10("div", { className: "flex flex-col", role: "list", children: networks.map((network, networkIndex) => {
3978
4098
  var _a, _b, _c, _d, _e;
3979
- const canManageBalance = network.venues.length > 0;
4099
+ const canManageBalance = network.canManageBalance;
3980
4100
  const isExpanded = canManageBalance && expandedChainIds.has(network.chainId);
3981
4101
  const isLastNetwork = networkIndex === networks.length - 1;
3982
4102
  const isPendingReset = resetChainIds.has(network.chainId);
@@ -4252,7 +4372,7 @@ var ManageBalancesModal = ({
4252
4372
  ManageBalancesModal.displayName = "ManageBalancesModal";
4253
4373
 
4254
4374
  // src/pages/user-profile/components/positions-activity.tsx
4255
- import { optimizedImageUrl as optimizedImageUrl3, useAggUiConfig as useAggUiConfig2, useLabels as useLabels10 } from "@agg-build/hooks";
4375
+ import { optimizedImageUrl as optimizedImageUrl3, useAggUiConfig as useAggUiConfig2, useLabels as useLabels11 } from "@agg-build/hooks";
4256
4376
  import { Fragment as Fragment4, useEffect as useEffect10, useMemo as useMemo7, useRef as useRef9, useState as useState11 } from "react";
4257
4377
 
4258
4378
  // src/pages/user-profile/user-profile.constants.ts
@@ -5043,7 +5163,7 @@ var EmptyState = ({ title, description, className }) => {
5043
5163
  EmptyState.displayName = "EmptyState";
5044
5164
 
5045
5165
  // src/pages/user-profile/components/open-order-row.tsx
5046
- import { optimizedImageUrl, useLabels as useLabels8 } from "@agg-build/hooks";
5166
+ import { optimizedImageUrl, useLabels as useLabels9 } from "@agg-build/hooks";
5047
5167
  import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
5048
5168
  var shouldUseNativeLinkNavigation2 = (event) => {
5049
5169
  return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
@@ -5056,11 +5176,21 @@ var CANCELLABLE_LIMIT_ORDER_STATUSES = /* @__PURE__ */ new Set([
5056
5176
  ]);
5057
5177
  var canCancelOpenOrder = (order) => {
5058
5178
  const status = order.status.trim().toLowerCase();
5059
- if (status === "pending" && !order.dagRunId) return true;
5060
5179
  const isLimitOrder = order.orderType === "limit" || order.limitPriceLabel != null;
5061
5180
  if (!isLimitOrder) return false;
5181
+ if (status === "pending" && !order.dagRunId) return true;
5062
5182
  return CANCELLABLE_LIMIT_ORDER_STATUSES.has(status);
5063
5183
  };
5184
+ var PENDING_LIMIT_ORDER_STATUSES = /* @__PURE__ */ new Set([
5185
+ "pending",
5186
+ "signing",
5187
+ "pending_bridge",
5188
+ "submitting"
5189
+ ]);
5190
+ var isPendingOpenOrder = (order) => {
5191
+ const isLimitOrder = order.orderType === "limit" || order.limitPriceLabel != null;
5192
+ return isLimitOrder && PENDING_LIMIT_ORDER_STATUSES.has(order.status.trim().toLowerCase()) && !canCancelOpenOrder(order);
5193
+ };
5064
5194
  var OpenOrderRow = ({
5065
5195
  order,
5066
5196
  href,
@@ -5075,7 +5205,7 @@ var OpenOrderRow = ({
5075
5205
  expirationHeader
5076
5206
  }) => {
5077
5207
  var _a, _b, _c, _d;
5078
- const labels = useLabels8().userProfile.openOrders;
5208
+ const labels = useLabels9().userProfile.openOrders;
5079
5209
  const resolvedCancelLabel = cancelLabel != null ? cancelLabel : labels.cancel;
5080
5210
  const resolvedCancelAriaLabel = cancelAriaLabel != null ? cancelAriaLabel : labels.cancelOrderAria(order.id);
5081
5211
  const resolvedLimitPriceHeader = limitPriceHeader != null ? limitPriceHeader : labels.limitPriceHeader;
@@ -5097,6 +5227,7 @@ var OpenOrderRow = ({
5097
5227
  onCancel == null ? void 0 : onCancel(order);
5098
5228
  };
5099
5229
  const canCancel = canCancelOpenOrder(order);
5230
+ const isPending = isPendingOpenOrder(order);
5100
5231
  const Wrapper = href ? "a" : "div";
5101
5232
  const wrapperProps = href ? {
5102
5233
  href,
@@ -5159,7 +5290,7 @@ var OpenOrderRow = ({
5159
5290
  {
5160
5291
  className: cn(
5161
5292
  "shrink-0 justify-end",
5162
- canCancel ? "flex w-full lg:w-[80px]" : "hidden lg:flex lg:w-[80px]"
5293
+ canCancel || isPending ? "flex w-full lg:w-[80px]" : "hidden lg:flex lg:w-[80px]"
5163
5294
  ),
5164
5295
  children: canCancel ? /* @__PURE__ */ jsx13(
5165
5296
  Button,
@@ -5173,7 +5304,10 @@ var OpenOrderRow = ({
5173
5304
  className: "w-full lg:w-auto !text-agg-error font-agg-bold",
5174
5305
  children: resolvedCancelLabel
5175
5306
  }
5176
- ) : null
5307
+ ) : isPending ? /* @__PURE__ */ jsxs12("div", { className: "flex w-full items-center justify-center gap-2 agg-type-label text-agg-foreground", children: [
5308
+ /* @__PURE__ */ jsx13(LoadingIcon, { size: "small", ariaLabel: labels.pending, className: "text-agg-primary" }),
5309
+ /* @__PURE__ */ jsx13("span", { children: labels.pending })
5310
+ ] }) : null
5177
5311
  }
5178
5312
  )
5179
5313
  ] })
@@ -5183,7 +5317,7 @@ var OpenOrderRow = ({
5183
5317
  OpenOrderRow.displayName = "OpenOrderRow";
5184
5318
 
5185
5319
  // src/pages/user-profile/components/position-row.tsx
5186
- import { optimizedImageUrl as optimizedImageUrl2, useAggUiConfig, useLabels as useLabels9 } from "@agg-build/hooks";
5320
+ import { optimizedImageUrl as optimizedImageUrl2, useAggUiConfig, useLabels as useLabels10 } from "@agg-build/hooks";
5187
5321
  import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
5188
5322
  var shouldUseNativeLinkNavigation3 = (event) => {
5189
5323
  return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
@@ -5321,7 +5455,7 @@ var PositionRow = ({
5321
5455
  onClaim,
5322
5456
  isClaiming = false
5323
5457
  }) => {
5324
- const labels = useLabels9().userProfile.positions;
5458
+ const labels = useLabels10().userProfile.positions;
5325
5459
  const { formatCurrency: formatCurrency2, formatPrice } = useAggUiConfig().formatting;
5326
5460
  const model = toPositionRowViewModel(
5327
5461
  position,
@@ -5549,7 +5683,7 @@ var PositionsActivity = ({
5549
5683
  initialPositionFilter = "active",
5550
5684
  className
5551
5685
  }) => {
5552
- const userProfileLabels = useLabels10().userProfile;
5686
+ const userProfileLabels = useLabels11().userProfile;
5553
5687
  const positionsLabels = userProfileLabels.positions;
5554
5688
  const openOrdersLabels = userProfileLabels.openOrders;
5555
5689
  const { formatCurrency: formatCurrency2, formatPrice } = useAggUiConfig2().formatting;
@@ -6141,7 +6275,7 @@ var buildAggTxExplorerHref = (chainId, txHash) => {
6141
6275
  };
6142
6276
 
6143
6277
  // src/pages/user-profile/components/user-info-card.tsx
6144
- import { optimizedImageUrl as optimizedImageUrl4, useLabels as useLabels11 } from "@agg-build/hooks";
6278
+ import { optimizedImageUrl as optimizedImageUrl4, useLabels as useLabels12 } from "@agg-build/hooks";
6145
6279
 
6146
6280
  // src/primitives/conditional-wrapper.tsx
6147
6281
  var ConditionalWrapper = ({
@@ -6208,7 +6342,7 @@ var UserInfoCard = ({
6208
6342
  className
6209
6343
  }) => {
6210
6344
  var _a;
6211
- const labels = useLabels11();
6345
+ const labels = useLabels12();
6212
6346
  const wallets = (_a = user.connectedWallets) != null ? _a : [];
6213
6347
  const hasWallets = wallets.length > 0;
6214
6348
  return /* @__PURE__ */ jsxs17(
@@ -6583,6 +6717,8 @@ var OPEN_ORDER_QUERY_STATUSES = [
6583
6717
  var SHOW_SOLD_POSITIONS = false;
6584
6718
  var SOLD_POSITION_SHARES_THRESHOLD = 0.1;
6585
6719
  var isOpenOrderStatus = (status) => OPEN_ORDER_STATUSES.has(status.toLowerCase());
6720
+ var isExecutionLimitOrder = (order) => order.orderType === "limit" || order.orderType == null && order.limitSizeRaw != null;
6721
+ var isUserProfileLimitOrder = (order) => order.orderType === "limit" || order.orderType == null && order.limitPriceLabel != null;
6586
6722
  var shouldIncludeByShares = (position) => {
6587
6723
  if (SHOW_SOLD_POSITIONS) return true;
6588
6724
  if (typeof position.totalShares !== "number") return true;
@@ -6848,7 +6984,7 @@ var UserProfilePage = ({
6848
6984
  const { user: currentUser, isAuthenticated } = useAggAuthState();
6849
6985
  const { isDepositBlocked } = useGeoBlock();
6850
6986
  const balanceState = useAggBalance2();
6851
- const labels = useLabels12();
6987
+ const labels = useLabels13();
6852
6988
  const {
6853
6989
  features: { showLimitOrders },
6854
6990
  trading: { executionMode: configuredExecutionMode }
@@ -6877,7 +7013,7 @@ var UserProfilePage = ({
6877
7013
  const manageBalancesButtonRef = useRef10(null);
6878
7014
  const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
6879
7015
  const queryExecutionMode = resolvedExecutionMode === "paper" ? "paper" : void 0;
6880
- const handleManageBalancesOpenChange = useCallback6((open) => {
7016
+ const handleManageBalancesOpenChange = useCallback7((open) => {
6881
7017
  setIsManageBalancesOpen(open);
6882
7018
  if (open) return;
6883
7019
  requestAnimationFrame(() => {
@@ -6897,7 +7033,7 @@ var UserProfilePage = ({
6897
7033
  limit: 25,
6898
7034
  mode: queryExecutionMode
6899
7035
  });
6900
- const handlePositionFilterChange = useCallback6(
7036
+ const handlePositionFilterChange = useCallback7(
6901
7037
  (filter) => {
6902
7038
  setPositionFilter(filter);
6903
7039
  onPositionFilterChangeProp == null ? void 0 : onPositionFilterChangeProp(filter);
@@ -6916,48 +7052,56 @@ var UserProfilePage = ({
6916
7052
  const pendingOpenOrdersQuery = useExecutionOrders({
6917
7053
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
6918
7054
  status: OPEN_ORDER_QUERY_STATUSES[0],
7055
+ orderType: "limit",
6919
7056
  limit: 25,
6920
7057
  mode: queryExecutionMode
6921
7058
  });
6922
7059
  const signingOpenOrdersQuery = useExecutionOrders({
6923
7060
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
6924
7061
  status: OPEN_ORDER_QUERY_STATUSES[1],
7062
+ orderType: "limit",
6925
7063
  limit: 25,
6926
7064
  mode: queryExecutionMode
6927
7065
  });
6928
7066
  const pendingBridgeOpenOrdersQuery = useExecutionOrders({
6929
7067
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
6930
7068
  status: OPEN_ORDER_QUERY_STATUSES[2],
7069
+ orderType: "limit",
6931
7070
  limit: 25,
6932
7071
  mode: queryExecutionMode
6933
7072
  });
6934
7073
  const submittingOpenOrdersQuery = useExecutionOrders({
6935
7074
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
6936
7075
  status: OPEN_ORDER_QUERY_STATUSES[3],
7076
+ orderType: "limit",
6937
7077
  limit: 25,
6938
7078
  mode: queryExecutionMode
6939
7079
  });
6940
7080
  const submittedOpenOrdersQuery = useExecutionOrders({
6941
7081
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
6942
7082
  status: OPEN_ORDER_QUERY_STATUSES[4],
7083
+ orderType: "limit",
6943
7084
  limit: 25,
6944
7085
  mode: queryExecutionMode
6945
7086
  });
6946
7087
  const openOpenOrdersQuery = useExecutionOrders({
6947
7088
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
6948
7089
  status: OPEN_ORDER_QUERY_STATUSES[5],
7090
+ orderType: "limit",
6949
7091
  limit: 25,
6950
7092
  mode: queryExecutionMode
6951
7093
  });
6952
7094
  const partiallyFilledOpenOrdersQuery = useExecutionOrders({
6953
7095
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
6954
7096
  status: OPEN_ORDER_QUERY_STATUSES[6],
7097
+ orderType: "limit",
6955
7098
  limit: 25,
6956
7099
  mode: queryExecutionMode
6957
7100
  });
6958
7101
  const cancelPendingOpenOrdersQuery = useExecutionOrders({
6959
7102
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
6960
7103
  status: OPEN_ORDER_QUERY_STATUSES[7],
7104
+ orderType: "limit",
6961
7105
  limit: 25,
6962
7106
  mode: queryExecutionMode
6963
7107
  });
@@ -6987,7 +7131,7 @@ var UserProfilePage = ({
6987
7131
  enabled: shouldUseHookData && isAuthenticated,
6988
7132
  limit: 25
6989
7133
  });
6990
- const handleCancelOrder = useCallback6(
7134
+ const handleCancelOrder = useCallback7(
6991
7135
  (order) => __async(null, null, function* () {
6992
7136
  if (onCancelOrder) {
6993
7137
  onCancelOrder(order);
@@ -7020,7 +7164,7 @@ var UserProfilePage = ({
7020
7164
  }),
7021
7165
  [cancelOrderMutation, labels.notifications.order, onCancelOrder, toastContext]
7022
7166
  );
7023
- const handleClaimPosition = useCallback6(
7167
+ const handleClaimPosition = useCallback7(
7024
7168
  (position) => {
7025
7169
  var _a2, _b2;
7026
7170
  return startClaim({
@@ -7031,7 +7175,7 @@ var UserProfilePage = ({
7031
7175
  },
7032
7176
  [startClaim]
7033
7177
  );
7034
- const handleActivityRowClick = useCallback6(
7178
+ const handleActivityRowClick = useCallback7(
7035
7179
  (activity) => {
7036
7180
  if (activity.kind === "redeem") {
7037
7181
  setSelectedClaimActivity(activity);
@@ -7041,7 +7185,7 @@ var UserProfilePage = ({
7041
7185
  },
7042
7186
  [onActivityClick]
7043
7187
  );
7044
- const handleClaimTransactionSelect = useCallback6((transaction) => {
7188
+ const handleClaimTransactionSelect = useCallback7((transaction) => {
7045
7189
  const href = buildAggTxExplorerHref(transaction.chainId, transaction.txHash);
7046
7190
  setSelectedClaimActivity(null);
7047
7191
  if (!href || typeof window === "undefined") return;
@@ -7277,18 +7421,20 @@ var UserProfilePage = ({
7277
7421
  });
7278
7422
  }, [activities, activityQuery.activities, isHydrated, labels, ordersQuery.orders]);
7279
7423
  const resolvedOpenOrders = useMemo8(() => {
7280
- if (openOrders) return openOrders;
7424
+ if (openOrders) return openOrders.filter(isUserProfileLimitOrder);
7281
7425
  const orderRowsById = /* @__PURE__ */ new Map();
7282
7426
  for (const query of openOrderQueries) {
7283
7427
  for (const order of query.orders) {
7284
7428
  orderRowsById.set(order.id, order);
7285
7429
  }
7286
7430
  }
7287
- return Array.from(orderRowsById.values()).filter((order) => isOpenOrderStatus(order.status)).sort(
7431
+ return Array.from(orderRowsById.values()).filter(
7432
+ (order) => isOpenOrderStatus(order.status) && isExecutionLimitOrder(order)
7433
+ ).sort(
7288
7434
  (a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
7289
7435
  ).map((order) => {
7290
7436
  var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
7291
- const isLimitOrder = order.orderType === "limit" || order.limitSizeRaw != null;
7437
+ const isLimitOrder = isExecutionLimitOrder(order);
7292
7438
  const filledRaw = isLimitOrder ? order.filledSizeRaw : order.filledAmountRaw;
7293
7439
  const totalRaw = isLimitOrder ? order.limitSizeRaw : order.amountRaw;
7294
7440
  const totalCostRaw = isLimitOrder ? (_a2 = order.reservedCostRaw) != null ? _a2 : order.amountRaw : order.amountRaw;
@@ -7333,14 +7479,14 @@ var UserProfilePage = ({
7333
7479
  () => openOrderQueries.some((query) => query.isFetchingNextPage),
7334
7480
  [openOrderQueries]
7335
7481
  );
7336
- const handleLoadMoreOpenOrders = useCallback6(() => {
7482
+ const handleLoadMoreOpenOrders = useCallback7(() => {
7337
7483
  for (const query of openOrderQueries) {
7338
7484
  if (query.hasNextPage) {
7339
7485
  void query.fetchNextPage();
7340
7486
  }
7341
7487
  }
7342
7488
  }, [openOrderQueries]);
7343
- const adaptPositionGroups = useCallback6(
7489
+ const adaptPositionGroups = useCallback7(
7344
7490
  (groups) => {
7345
7491
  return groups.flatMap((group) => {
7346
7492
  var _a2, _b2, _c, _d;
@@ -7594,6 +7740,7 @@ UserProfilePage.displayName = "UserProfilePage";
7594
7740
  export {
7595
7741
  DefaultAvatar,
7596
7742
  ConditionalWrapper,
7743
+ formatRecurringCountdown,
7597
7744
  EventMarketPage,
7598
7745
  useHomePageModals,
7599
7746
  HomePage,