@agg-build/ui 4.2.0 → 4.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -16
- package/dist/{chunk-DNPDXL2D.mjs → chunk-3RQCBGIK.mjs} +341 -105
- package/dist/{chunk-GNEFI4SO.mjs → chunk-C4GFVJ62.mjs} +725 -400
- package/dist/{chunk-UDBHAZJJ.mjs → chunk-EOLR7DHL.mjs} +568 -145
- package/dist/{chunk-6X6Y4INU.mjs → chunk-LXQ3U4X2.mjs} +2 -2
- package/dist/{chunk-QW7VFURU.mjs → chunk-RDBMHBR2.mjs} +67 -3
- package/dist/{chunk-WDCH4RRS.mjs → chunk-WYCSTAN7.mjs} +1 -1
- package/dist/{chunk-FTL25XKE.mjs → chunk-XN2NB2NP.mjs} +1 -1
- package/dist/events.js +1149 -661
- package/dist/events.mjs +6 -4
- package/dist/index.js +3320 -2291
- package/dist/index.mjs +12 -8
- package/dist/modals.js +9 -2
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +2789 -1762
- package/dist/pages.mjs +8 -6
- package/dist/primitives.js +30 -3
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +338 -102
- package/dist/trading.mjs +4 -4
- package/dist/types/events/index.d.mts +1 -0
- package/dist/types/events/index.d.ts +1 -0
- package/dist/types/events/item-details/event-list-item-details-market-selector.d.mts +4 -1
- package/dist/types/events/item-details/event-list-item-details-market-selector.d.ts +4 -1
- package/dist/types/events/item-details/event-list-item-details.types.d.mts +25 -1
- package/dist/types/events/item-details/event-list-item-details.types.d.ts +25 -1
- package/dist/types/events/item-details/index.d.mts +1 -1
- package/dist/types/events/item-details/index.d.ts +1 -1
- package/dist/types/events/list/event-list.constants.d.mts +3 -1
- package/dist/types/events/list/event-list.constants.d.ts +3 -1
- package/dist/types/events/list/event-list.types.d.mts +17 -0
- package/dist/types/events/list/event-list.types.d.ts +17 -0
- package/dist/types/events/list/event-list.utils.d.mts +4 -0
- package/dist/types/events/list/event-list.utils.d.ts +4 -0
- package/dist/types/events/list/index.d.mts +2 -2
- package/dist/types/events/list/index.d.ts +2 -2
- package/dist/types/events/market-details/index.d.mts +1 -1
- package/dist/types/events/market-details/index.d.ts +1 -1
- package/dist/types/events/market-details/market-details.types.d.mts +4 -0
- package/dist/types/events/market-details/market-details.types.d.ts +4 -0
- package/dist/types/events/shared/format-event-title.d.mts +9 -1
- package/dist/types/events/shared/format-event-title.d.ts +9 -1
- package/dist/types/events/shared/format-sports-event-time.d.mts +2 -0
- package/dist/types/events/shared/format-sports-event-time.d.ts +2 -0
- package/dist/types/events/shared/sports-live-score.d.mts +10 -0
- package/dist/types/events/shared/sports-live-score.d.ts +10 -0
- package/dist/types/pages/event-market/event-market.types.d.mts +4 -0
- package/dist/types/pages/event-market/event-market.types.d.ts +4 -0
- package/dist/types/pages/event-market/index.d.mts +1 -0
- package/dist/types/pages/event-market/index.d.ts +1 -0
- package/dist/types/pages/home/event-discovery-url-state.d.mts +35 -0
- package/dist/types/pages/home/event-discovery-url-state.d.ts +35 -0
- package/dist/types/pages/user-profile/components/available-balance-card.d.mts +5 -0
- package/dist/types/pages/user-profile/components/available-balance-card.d.ts +5 -0
- package/dist/types/pages/user-profile/components/open-order-row.d.mts +1 -0
- package/dist/types/pages/user-profile/components/open-order-row.d.ts +1 -0
- package/dist/types/pages/user-profile/components/positions-activity.d.mts +1 -1
- package/dist/types/pages/user-profile/components/positions-activity.d.ts +1 -1
- package/dist/types/pages/user-profile/user-profile.types.d.mts +1 -1
- package/dist/types/pages/user-profile/user-profile.types.d.ts +1 -1
- package/dist/types/trading/place-order/index.d.mts +1 -1
- package/dist/types/trading/place-order/index.d.ts +1 -1
- package/dist/types/trading/place-order/index.place-order.execution-steps.d.mts +13 -1
- package/dist/types/trading/place-order/index.place-order.execution-steps.d.ts +13 -1
- package/dist/types/trading/place-order/index.place-order.execution-view.d.mts +2 -1
- package/dist/types/trading/place-order/index.place-order.execution-view.d.ts +2 -1
- package/dist/types/trading/place-order/index.place-order.types.d.mts +9 -0
- package/dist/types/trading/place-order/index.place-order.types.d.ts +9 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +6 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +6 -0
- package/package.json +3 -3
- /package/dist/{chunk-KHHFHXXD.mjs → chunk-JH4B3ZHQ.mjs} +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
DEFAULT_EVENTS_LIMIT,
|
|
4
|
+
DEFAULT_EVENT_LIST_SORT,
|
|
5
|
+
EVENT_LIST_SORT_VALUES,
|
|
4
6
|
EventList,
|
|
5
7
|
EventListItem,
|
|
6
8
|
EventListItemDetails,
|
|
@@ -10,7 +12,7 @@ import {
|
|
|
10
12
|
isErrorWithStatus,
|
|
11
13
|
useEventListTabs,
|
|
12
14
|
useEventListTabsHeaderOverflow
|
|
13
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-C4GFVJ62.mjs";
|
|
14
16
|
import {
|
|
15
17
|
DEPOSIT_MODAL_OPEN_EVENT,
|
|
16
18
|
PlaceOrder,
|
|
@@ -19,12 +21,12 @@ import {
|
|
|
19
21
|
formatChainIdLabel,
|
|
20
22
|
useClaimWinnings,
|
|
21
23
|
useResolvedMarketClaim
|
|
22
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-3RQCBGIK.mjs";
|
|
23
25
|
import {
|
|
24
26
|
getDisplayOutcomePrice,
|
|
25
27
|
resolveHeaderOutcomeItems,
|
|
26
28
|
resolveMarketFromVenueMarkets
|
|
27
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-WYCSTAN7.mjs";
|
|
28
30
|
import {
|
|
29
31
|
AggErrorBoundary,
|
|
30
32
|
Button,
|
|
@@ -51,6 +53,8 @@ import {
|
|
|
51
53
|
__spreadValues,
|
|
52
54
|
cn,
|
|
53
55
|
filterOpenEvents,
|
|
56
|
+
formatRecurringMarketPillTimeEt,
|
|
57
|
+
formatRecurringMarketWindowTimeEt,
|
|
54
58
|
formatUsd,
|
|
55
59
|
normalizeVenueMarketCluster,
|
|
56
60
|
resolveTabVenus,
|
|
@@ -58,7 +62,7 @@ import {
|
|
|
58
62
|
skeletonViews,
|
|
59
63
|
sortCategoriesForNavigation,
|
|
60
64
|
useOptionalToast
|
|
61
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-RDBMHBR2.mjs";
|
|
62
66
|
|
|
63
67
|
// src/pages/home/index.tsx
|
|
64
68
|
import {
|
|
@@ -66,24 +70,27 @@ import {
|
|
|
66
70
|
useAppConfig,
|
|
67
71
|
useCategories,
|
|
68
72
|
useEventListState,
|
|
69
|
-
useLabels as
|
|
73
|
+
useLabels as useLabels5,
|
|
70
74
|
useSdkUiConfig as useSdkUiConfig4,
|
|
71
75
|
useSearch,
|
|
72
76
|
useVenueMarketMidpoints
|
|
73
77
|
} from "@agg-build/hooks";
|
|
74
78
|
import { VENUES } from "@agg-build/sdk";
|
|
75
|
-
import { useCallback as
|
|
79
|
+
import { useCallback as useCallback5, useEffect as useEffect8, useMemo as useMemo5, useRef as useRef7, useState as useState9 } from "react";
|
|
76
80
|
|
|
77
81
|
// src/pages/event-market/index.tsx
|
|
78
82
|
import {
|
|
83
|
+
resolveRecurringCryptoTimeline,
|
|
79
84
|
resolveEventTradingState as resolveEventTradingState3,
|
|
80
85
|
TradeSide as TradeSide2,
|
|
81
86
|
useEnrichedVenueEvent,
|
|
82
87
|
useEventTradingContext as useEventTradingContext4,
|
|
88
|
+
useLabels as useLabels4,
|
|
83
89
|
useMidpoints as useMidpoints2,
|
|
90
|
+
useRecurringCryptoMarkets,
|
|
84
91
|
useSdkUiConfig as useSdkUiConfig3
|
|
85
92
|
} from "@agg-build/hooks";
|
|
86
|
-
import { useEffect as useEffect6, useMemo as useMemo4, useRef as useRef5, useState as useState6 } from "react";
|
|
93
|
+
import { useCallback as useCallback3, useEffect as useEffect6, useMemo as useMemo4, useRef as useRef5, useState as useState6 } from "react";
|
|
87
94
|
|
|
88
95
|
// src/pages/event-market/event-market.utils.ts
|
|
89
96
|
var EVENT_MARKET_PAGE_STICKY_HEADER_OFFSET_PX = 48;
|
|
@@ -382,7 +389,8 @@ import {
|
|
|
382
389
|
TradeSide,
|
|
383
390
|
useEventTradingContext as useEventTradingContext3,
|
|
384
391
|
useMidpoints,
|
|
385
|
-
useSdkUiConfig as useSdkUiConfig2
|
|
392
|
+
useSdkUiConfig as useSdkUiConfig2,
|
|
393
|
+
useSportsLive
|
|
386
394
|
} from "@agg-build/hooks";
|
|
387
395
|
import { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo3, useRef as useRef4, useState as useState5 } from "react";
|
|
388
396
|
|
|
@@ -1650,27 +1658,6 @@ var SportsMarketCard = ({
|
|
|
1650
1658
|
tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(activeMarket.id, firstOutcome.id);
|
|
1651
1659
|
}
|
|
1652
1660
|
}, [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
1661
|
const combinedMoneylineHeaderOutcomeItems = useMemo(() => {
|
|
1675
1662
|
if (!isCombinedMoneylineGroup) return void 0;
|
|
1676
1663
|
return combinedMoneylineMarkets.flatMap((market, index) => {
|
|
@@ -1708,6 +1695,27 @@ var SportsMarketCard = ({
|
|
|
1708
1695
|
midpointsResult
|
|
1709
1696
|
});
|
|
1710
1697
|
}, [slide.kind, activeMarket, group.markets, midpointsResult]);
|
|
1698
|
+
if (!activeMarket) return null;
|
|
1699
|
+
const activeOutcome = (_g = activeMarket.venueMarketOutcomes.find(
|
|
1700
|
+
(outcome) => outcome.id === (tradingContext == null ? void 0 : tradingContext.selectedOutcomeId)
|
|
1701
|
+
)) != null ? _g : activeDefaultOutcome;
|
|
1702
|
+
const activeOutcomeVenueCount = (() => {
|
|
1703
|
+
var _a2, _b2;
|
|
1704
|
+
if (!activeOutcome) return collectVenueNames(activeMarket).length;
|
|
1705
|
+
const venueNames = /* @__PURE__ */ new Set([activeMarket.venue]);
|
|
1706
|
+
for (const matchedOutcome of (_a2 = activeOutcome.matchedVenueMarketOutcomes) != null ? _a2 : []) {
|
|
1707
|
+
const matchedVenueMarket = (_b2 = activeMarket.matchedVenueMarkets) == null ? void 0 : _b2.find(
|
|
1708
|
+
(market) => market.id === matchedOutcome.venueMarketId
|
|
1709
|
+
);
|
|
1710
|
+
if (matchedVenueMarket == null ? void 0 : matchedVenueMarket.venue) {
|
|
1711
|
+
venueNames.add(matchedVenueMarket.venue);
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
return venueNames.size > 0 ? venueNames.size : collectVenueNames(activeMarket).length;
|
|
1715
|
+
})();
|
|
1716
|
+
const activeMarketVolume = resolveSportsExpandedMarketsVolume([activeMarket]);
|
|
1717
|
+
const totalGroupVolume = resolveSportsExpandedMarketsVolume(group.markets);
|
|
1718
|
+
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
1719
|
const headerOutcomeItemsOverride = combinedMoneylineHeaderOutcomeItems != null ? combinedMoneylineHeaderOutcomeItems : spreadHeaderOutcomeItems;
|
|
1712
1720
|
const headerOutcomeVariant = isCombinedMoneylineGroup ? "outcome" : resolveSportsMarketCardVariant(activeMarket);
|
|
1713
1721
|
const handleLineSelect = (index) => {
|
|
@@ -2145,6 +2153,7 @@ var SportsEventMarketPage = ({
|
|
|
2145
2153
|
const [isMobileTradeOpen, setIsMobileTradeOpen] = useState5(false);
|
|
2146
2154
|
const isMobileViewport = useIsMobileEventMarketViewport(SPORTS_EVENT_MARKET_MEDIA_QUERY);
|
|
2147
2155
|
const tradingContext = useEventTradingContext3();
|
|
2156
|
+
const { stateByEventId: sportsLiveStateByEventId } = useSportsLive([event.id]);
|
|
2148
2157
|
const midpointsResult = useMidpoints(composedEvent.venueMarkets);
|
|
2149
2158
|
const internalResolvedClaim = useResolvedMarketClaim({
|
|
2150
2159
|
market: eventTradingState.primaryMarket,
|
|
@@ -2216,6 +2225,7 @@ var SportsEventMarketPage = ({
|
|
|
2216
2225
|
defaultOutcomeId,
|
|
2217
2226
|
eventTradingState,
|
|
2218
2227
|
midpointsResult,
|
|
2228
|
+
sportsLiveState: sportsLiveStateByEventId.get(event.id),
|
|
2219
2229
|
classNames: {
|
|
2220
2230
|
root: cn("agg-event-hero", classNames == null ? void 0 : classNames.hero),
|
|
2221
2231
|
// The sports tabs + market cards own market navigation, so hide the
|
|
@@ -2317,6 +2327,36 @@ SportsEventMarketPage.displayName = "SportsEventMarketPage";
|
|
|
2317
2327
|
|
|
2318
2328
|
// src/pages/event-market/index.tsx
|
|
2319
2329
|
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2330
|
+
var CLOCK_INTERVAL_MS = 1e3;
|
|
2331
|
+
var formatRecurringCountdown = (remainingMs) => {
|
|
2332
|
+
if (!Number.isFinite(remainingMs) || remainingMs <= 0) return null;
|
|
2333
|
+
const totalSeconds = Math.ceil(remainingMs / 1e3);
|
|
2334
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
2335
|
+
const minutes = Math.floor(totalSeconds % 3600 / 60);
|
|
2336
|
+
const seconds = totalSeconds % 60;
|
|
2337
|
+
const minuteSecondLabel = `${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`;
|
|
2338
|
+
return hours > 0 ? `${hours}:${minuteSecondLabel}` : minuteSecondLabel;
|
|
2339
|
+
};
|
|
2340
|
+
var useCurrentTimestamp = (enabled) => {
|
|
2341
|
+
const [currentTimestamp, setCurrentTimestamp] = useState6(null);
|
|
2342
|
+
useEffect6(() => {
|
|
2343
|
+
if (!enabled) {
|
|
2344
|
+
setCurrentTimestamp(null);
|
|
2345
|
+
return;
|
|
2346
|
+
}
|
|
2347
|
+
const updateCurrentTimestamp = () => {
|
|
2348
|
+
setCurrentTimestamp(Date.now());
|
|
2349
|
+
};
|
|
2350
|
+
updateCurrentTimestamp();
|
|
2351
|
+
const intervalId = window.setInterval(updateCurrentTimestamp, CLOCK_INTERVAL_MS);
|
|
2352
|
+
document.addEventListener("visibilitychange", updateCurrentTimestamp);
|
|
2353
|
+
return () => {
|
|
2354
|
+
window.clearInterval(intervalId);
|
|
2355
|
+
document.removeEventListener("visibilitychange", updateCurrentTimestamp);
|
|
2356
|
+
};
|
|
2357
|
+
}, [enabled]);
|
|
2358
|
+
return currentTimestamp;
|
|
2359
|
+
};
|
|
2320
2360
|
var EventMarketPageContent = ({
|
|
2321
2361
|
event,
|
|
2322
2362
|
defaultMarketId,
|
|
@@ -2327,8 +2367,10 @@ var EventMarketPageContent = ({
|
|
|
2327
2367
|
executionMode,
|
|
2328
2368
|
stickyOrderPanel,
|
|
2329
2369
|
resolvedClaim,
|
|
2330
|
-
onBeforePrimaryAction
|
|
2370
|
+
onBeforePrimaryAction,
|
|
2371
|
+
onRecurringMarketNavigate
|
|
2331
2372
|
}) => {
|
|
2373
|
+
var _a;
|
|
2332
2374
|
const eventTradingState = useMemo4(() => resolveEventTradingState3(event), [event]);
|
|
2333
2375
|
const stickyOrderPanelState = resolveEventMarketPageStickyState({
|
|
2334
2376
|
stickyOrderPanel
|
|
@@ -2340,11 +2382,93 @@ var EventMarketPageContent = ({
|
|
|
2340
2382
|
const [isMobileTradeOpen, setIsMobileTradeOpen] = useState6(false);
|
|
2341
2383
|
const isMobileViewport = useIsMobileEventMarketViewport();
|
|
2342
2384
|
const tradingContext = useEventTradingContext4();
|
|
2385
|
+
const labels = useLabels4();
|
|
2386
|
+
const recurringQuery = useRecurringCryptoMarkets({ event });
|
|
2387
|
+
const currentTimestamp = useCurrentTimestamp(recurringQuery.isRecurringCryptoMarket);
|
|
2388
|
+
const recurringTimeline = useMemo4(
|
|
2389
|
+
() => currentTimestamp == null ? null : resolveRecurringCryptoTimeline(recurringQuery.windows, event, currentTimestamp),
|
|
2390
|
+
[currentTimestamp, event, recurringQuery.windows]
|
|
2391
|
+
);
|
|
2392
|
+
const isRecurringCryptoMarket = (recurringTimeline == null ? void 0 : recurringTimeline.viewed) != null;
|
|
2393
|
+
const recurringViewedEndTimestamp = (recurringTimeline == null ? void 0 : recurringTimeline.viewed) ? Date.parse(recurringTimeline.viewed.windowEnd) : Number.NaN;
|
|
2394
|
+
const hasViewedMarketEnded = currentTimestamp != null && Number.isFinite(recurringViewedEndTimestamp) && currentTimestamp >= recurringViewedEndTimestamp;
|
|
2395
|
+
const isRecurringResolvingMarket = recurringQuery.isRecurringCryptoMarket && eventTradingState.kind === "closed";
|
|
2396
|
+
const lastBoundaryRefetchRef = useRef5(null);
|
|
2397
|
+
useEffect6(() => {
|
|
2398
|
+
lastBoundaryRefetchRef.current = null;
|
|
2399
|
+
}, [event.id]);
|
|
2400
|
+
useEffect6(() => {
|
|
2401
|
+
if (!isRecurringCryptoMarket || !hasViewedMarketEnded || !(recurringTimeline == null ? void 0 : recurringTimeline.viewed)) return;
|
|
2402
|
+
const refetchKey = `${event.id}:${recurringTimeline.viewed.windowEnd}`;
|
|
2403
|
+
if (lastBoundaryRefetchRef.current === refetchKey) return;
|
|
2404
|
+
lastBoundaryRefetchRef.current = refetchKey;
|
|
2405
|
+
void recurringQuery.refetch();
|
|
2406
|
+
}, [
|
|
2407
|
+
event.id,
|
|
2408
|
+
hasViewedMarketEnded,
|
|
2409
|
+
isRecurringCryptoMarket,
|
|
2410
|
+
recurringQuery,
|
|
2411
|
+
recurringTimeline == null ? void 0 : recurringTimeline.viewed
|
|
2412
|
+
]);
|
|
2413
|
+
const handleRecurringMarketSelect = useCallback3(
|
|
2414
|
+
(eventId) => {
|
|
2415
|
+
if (!onRecurringMarketNavigate || eventId === event.id) return;
|
|
2416
|
+
onRecurringMarketNavigate(eventId, { replace: false });
|
|
2417
|
+
},
|
|
2418
|
+
[event.id, onRecurringMarketNavigate]
|
|
2419
|
+
);
|
|
2420
|
+
const handleGoToLive = useCallback3(() => {
|
|
2421
|
+
var _a2;
|
|
2422
|
+
const liveEventId = (_a2 = recurringTimeline == null ? void 0 : recurringTimeline.live) == null ? void 0 : _a2.venueEventId;
|
|
2423
|
+
if (!onRecurringMarketNavigate || !liveEventId || liveEventId === event.id) return;
|
|
2424
|
+
onRecurringMarketNavigate(liveEventId, { replace: false });
|
|
2425
|
+
}, [event.id, onRecurringMarketNavigate, (_a = recurringTimeline == null ? void 0 : recurringTimeline.live) == null ? void 0 : _a.venueEventId]);
|
|
2426
|
+
const recurringMarketsPresentation = useMemo4(() => {
|
|
2427
|
+
var _a2, _b;
|
|
2428
|
+
if (!isRecurringCryptoMarket || !(recurringTimeline == null ? void 0 : recurringTimeline.viewed)) return void 0;
|
|
2429
|
+
const toOption = (market) => {
|
|
2430
|
+
var _a3;
|
|
2431
|
+
return {
|
|
2432
|
+
value: market.venueEventId,
|
|
2433
|
+
label: (_a3 = formatRecurringMarketPillTimeEt(market.windowStart)) != null ? _a3 : market.windowStart
|
|
2434
|
+
};
|
|
2435
|
+
};
|
|
2436
|
+
const countdownLabel = ((_a2 = recurringTimeline.live) == null ? void 0 : _a2.venueEventId) === event.id ? formatRecurringCountdown(recurringViewedEndTimestamp - currentTimestamp) : null;
|
|
2437
|
+
return {
|
|
2438
|
+
visibleOptions: recurringTimeline.visible.map(toOption),
|
|
2439
|
+
browseOptions: recurringTimeline.all.map(toOption),
|
|
2440
|
+
selectedValue: event.id,
|
|
2441
|
+
liveValue: (_b = recurringTimeline.live) == null ? void 0 : _b.venueEventId,
|
|
2442
|
+
duration: recurringTimeline.viewed.duration,
|
|
2443
|
+
windowLabel: formatRecurringMarketWindowTimeEt(
|
|
2444
|
+
recurringTimeline.viewed.windowStart,
|
|
2445
|
+
recurringTimeline.viewed.windowEnd
|
|
2446
|
+
),
|
|
2447
|
+
countdownLabel,
|
|
2448
|
+
countdownAriaLabel: countdownLabel ? labels.eventMarketPage.recurringCountdownAria(countdownLabel) : null,
|
|
2449
|
+
isResolving: hasViewedMarketEnded,
|
|
2450
|
+
canGoToLive: recurringTimeline.live != null && recurringTimeline.live.venueEventId !== event.id,
|
|
2451
|
+
onSelect: handleRecurringMarketSelect,
|
|
2452
|
+
onGoToLive: handleGoToLive
|
|
2453
|
+
};
|
|
2454
|
+
}, [
|
|
2455
|
+
currentTimestamp,
|
|
2456
|
+
event.id,
|
|
2457
|
+
handleGoToLive,
|
|
2458
|
+
handleRecurringMarketSelect,
|
|
2459
|
+
hasViewedMarketEnded,
|
|
2460
|
+
isRecurringCryptoMarket,
|
|
2461
|
+
labels.eventMarketPage,
|
|
2462
|
+
recurringTimeline,
|
|
2463
|
+
recurringViewedEndTimestamp
|
|
2464
|
+
]);
|
|
2343
2465
|
const eventDetailVenueMarkets = useMemo4(
|
|
2344
2466
|
() => normalizeVenueMarketCluster(event.venueMarkets),
|
|
2345
2467
|
[event.venueMarkets]
|
|
2346
2468
|
);
|
|
2347
|
-
const midpointsResult = useMidpoints2(
|
|
2469
|
+
const midpointsResult = useMidpoints2(
|
|
2470
|
+
recurringQuery.isRecurringCryptoMarket && eventTradingState.kind !== "open" ? [] : eventDetailVenueMarkets
|
|
2471
|
+
);
|
|
2348
2472
|
const internalResolvedClaim = useResolvedMarketClaim({
|
|
2349
2473
|
market: eventTradingState.primaryMarket,
|
|
2350
2474
|
enabled: eventTradingState.kind === "resolved",
|
|
@@ -2355,8 +2479,8 @@ var EventMarketPageContent = ({
|
|
|
2355
2479
|
setTradeSideRef.current = tradingContext == null ? void 0 : tradingContext.setTradeSide;
|
|
2356
2480
|
useEffect6(() => {
|
|
2357
2481
|
return () => {
|
|
2358
|
-
var
|
|
2359
|
-
(
|
|
2482
|
+
var _a2;
|
|
2483
|
+
(_a2 = setTradeSideRef.current) == null ? void 0 : _a2.call(setTradeSideRef, TradeSide2.Buy);
|
|
2360
2484
|
};
|
|
2361
2485
|
}, []);
|
|
2362
2486
|
if (!event.venueMarkets.length) {
|
|
@@ -2400,6 +2524,7 @@ var EventMarketPageContent = ({
|
|
|
2400
2524
|
defaultOutcomeId,
|
|
2401
2525
|
eventTradingState,
|
|
2402
2526
|
midpointsResult,
|
|
2527
|
+
recurringMarkets: recurringMarketsPresentation,
|
|
2403
2528
|
classNames: {
|
|
2404
2529
|
root: cn("agg-event-hero", classNames == null ? void 0 : classNames.hero)
|
|
2405
2530
|
}
|
|
@@ -2412,6 +2537,7 @@ var EventMarketPageContent = ({
|
|
|
2412
2537
|
markets: eventTradingState.displayMarkets,
|
|
2413
2538
|
eventTradingState,
|
|
2414
2539
|
live: true,
|
|
2540
|
+
showResolvingState: isRecurringResolvingMarket,
|
|
2415
2541
|
expandSelectedMarketOnChange: !isMobileViewport,
|
|
2416
2542
|
autoExpandFallbackMarket: !isMobileViewport,
|
|
2417
2543
|
autoSelectFallbackMarket: !isMobileViewport,
|
|
@@ -2430,6 +2556,7 @@ var EventMarketPageContent = ({
|
|
|
2430
2556
|
executionMode: resolvedExecutionMode,
|
|
2431
2557
|
isQuotePanelActive: isMobileViewport,
|
|
2432
2558
|
resolvedClaim: effectiveResolvedClaim,
|
|
2559
|
+
showResolvingState: isRecurringResolvingMarket,
|
|
2433
2560
|
midpointsResult,
|
|
2434
2561
|
onBeforePrimaryAction,
|
|
2435
2562
|
className: cn(
|
|
@@ -2458,6 +2585,7 @@ var EventMarketPageContent = ({
|
|
|
2458
2585
|
executionMode: resolvedExecutionMode,
|
|
2459
2586
|
isQuotePanelActive: !isMobileViewport,
|
|
2460
2587
|
resolvedClaim: effectiveResolvedClaim,
|
|
2588
|
+
showResolvingState: isRecurringResolvingMarket,
|
|
2461
2589
|
midpointsResult,
|
|
2462
2590
|
onBeforePrimaryAction,
|
|
2463
2591
|
className: cn(stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.placeOrder, classNames == null ? void 0 : classNames.trade),
|
|
@@ -2606,6 +2734,85 @@ var resolveInitialTabValue = (tabs, defaultActiveTab) => {
|
|
|
2606
2734
|
return (_b = (_a = tabs[0]) == null ? void 0 : _a.value) != null ? _b : ALL_CATEGORIES_TAB_VALUE;
|
|
2607
2735
|
};
|
|
2608
2736
|
|
|
2737
|
+
// src/pages/home/event-discovery-url-state.ts
|
|
2738
|
+
import { z } from "zod";
|
|
2739
|
+
var nonEmptyParamSchema = z.string().trim().min(1);
|
|
2740
|
+
var sortParamSchema = z.enum(EVENT_LIST_SORT_VALUES);
|
|
2741
|
+
var readScalarParam = (searchParams, name, schema) => {
|
|
2742
|
+
const values = searchParams.getAll(name);
|
|
2743
|
+
if (values.length === 0) return { invalid: false };
|
|
2744
|
+
if (values.length !== 1) return { invalid: true };
|
|
2745
|
+
const parsedValue = schema.safeParse(values[0]);
|
|
2746
|
+
if (!parsedValue.success) return { invalid: true };
|
|
2747
|
+
return { value: parsedValue.data, invalid: false };
|
|
2748
|
+
};
|
|
2749
|
+
var readEventDiscoveryUrlState = (searchParams) => {
|
|
2750
|
+
const category = readScalarParam(searchParams, "category", nonEmptyParamSchema);
|
|
2751
|
+
const venue = readScalarParam(searchParams, "venue", nonEmptyParamSchema);
|
|
2752
|
+
const sort = readScalarParam(searchParams, "sort", sortParamSchema);
|
|
2753
|
+
const subcategoryPath = [];
|
|
2754
|
+
let hasInvalidSubcategory = false;
|
|
2755
|
+
for (const value of searchParams.getAll("subcategory")) {
|
|
2756
|
+
const parsedValue = nonEmptyParamSchema.safeParse(value);
|
|
2757
|
+
if (!parsedValue.success) {
|
|
2758
|
+
hasInvalidSubcategory = true;
|
|
2759
|
+
break;
|
|
2760
|
+
}
|
|
2761
|
+
subcategoryPath.push(parsedValue.data);
|
|
2762
|
+
}
|
|
2763
|
+
return {
|
|
2764
|
+
category: category.value,
|
|
2765
|
+
subcategoryPath,
|
|
2766
|
+
venue: venue.value,
|
|
2767
|
+
sort: sort.value,
|
|
2768
|
+
categoryIsInvalid: category.invalid,
|
|
2769
|
+
shouldCanonicalize: category.invalid || venue.invalid || sort.invalid || hasInvalidSubcategory
|
|
2770
|
+
};
|
|
2771
|
+
};
|
|
2772
|
+
var resolveEventDiscoveryUrlState = ({
|
|
2773
|
+
parsedState,
|
|
2774
|
+
categoryValues,
|
|
2775
|
+
venueValues,
|
|
2776
|
+
defaultCategory,
|
|
2777
|
+
defaultVenue
|
|
2778
|
+
}) => {
|
|
2779
|
+
var _a, _b, _c;
|
|
2780
|
+
const categoryIsValid = parsedState.category == null || categoryValues.includes(parsedState.category);
|
|
2781
|
+
const venueIsValid = parsedState.venue == null || venueValues.includes(parsedState.venue);
|
|
2782
|
+
const category = categoryIsValid ? (_a = parsedState.category) != null ? _a : defaultCategory : defaultCategory;
|
|
2783
|
+
const venue = venueIsValid ? (_b = parsedState.venue) != null ? _b : defaultVenue : defaultVenue;
|
|
2784
|
+
const sort = (_c = parsedState.sort) != null ? _c : DEFAULT_EVENT_LIST_SORT;
|
|
2785
|
+
return {
|
|
2786
|
+
state: {
|
|
2787
|
+
category,
|
|
2788
|
+
subcategoryPath: categoryIsValid && !parsedState.categoryIsInvalid ? parsedState.subcategoryPath : [],
|
|
2789
|
+
venue,
|
|
2790
|
+
sort
|
|
2791
|
+
},
|
|
2792
|
+
shouldCanonicalize: parsedState.shouldCanonicalize || !categoryIsValid || !venueIsValid || parsedState.category === defaultCategory || parsedState.venue === defaultVenue || parsedState.sort === DEFAULT_EVENT_LIST_SORT
|
|
2793
|
+
};
|
|
2794
|
+
};
|
|
2795
|
+
var buildEventDiscoveryUrl = ({
|
|
2796
|
+
currentUrl,
|
|
2797
|
+
state,
|
|
2798
|
+
defaultCategory,
|
|
2799
|
+
defaultVenue
|
|
2800
|
+
}) => {
|
|
2801
|
+
const nextUrl = new URL(currentUrl.toString());
|
|
2802
|
+
nextUrl.searchParams.delete("category");
|
|
2803
|
+
nextUrl.searchParams.delete("subcategory");
|
|
2804
|
+
nextUrl.searchParams.delete("venue");
|
|
2805
|
+
nextUrl.searchParams.delete("sort");
|
|
2806
|
+
if (state.category !== defaultCategory) nextUrl.searchParams.set("category", state.category);
|
|
2807
|
+
for (const subcategory of state.subcategoryPath) {
|
|
2808
|
+
nextUrl.searchParams.append("subcategory", subcategory);
|
|
2809
|
+
}
|
|
2810
|
+
if (state.venue !== defaultVenue) nextUrl.searchParams.set("venue", state.venue);
|
|
2811
|
+
if (state.sort !== DEFAULT_EVENT_LIST_SORT) nextUrl.searchParams.set("sort", state.sort);
|
|
2812
|
+
const search = nextUrl.searchParams.toString();
|
|
2813
|
+
return `${nextUrl.pathname}${search ? `?${search}` : ""}${nextUrl.hash}`;
|
|
2814
|
+
};
|
|
2815
|
+
|
|
2609
2816
|
// src/pages/home/use-scroll-restoration.ts
|
|
2610
2817
|
import { useLayoutEffect as useLayoutEffect2, useRef as useRef6, useState as useState7 } from "react";
|
|
2611
2818
|
function useScrollRestoration({
|
|
@@ -2628,14 +2835,14 @@ function useScrollRestoration({
|
|
|
2628
2835
|
}
|
|
2629
2836
|
|
|
2630
2837
|
// src/pages/home/use-home-page-modals.ts
|
|
2631
|
-
import { useCallback as
|
|
2838
|
+
import { useCallback as useCallback4, useEffect as useEffect7, useState as useState8 } from "react";
|
|
2632
2839
|
var useHomePageModals = () => {
|
|
2633
2840
|
const [profileOpen, setProfileOpen] = useState8(false);
|
|
2634
2841
|
const [depositOpen, setDepositOpen] = useState8(false);
|
|
2635
2842
|
const [withdrawOpen, setWithdrawOpen] = useState8(false);
|
|
2636
|
-
const onProfileClick =
|
|
2637
|
-
const onDepositClick =
|
|
2638
|
-
const onWithdrawClick =
|
|
2843
|
+
const onProfileClick = useCallback4(() => setProfileOpen(true), []);
|
|
2844
|
+
const onDepositClick = useCallback4(() => setDepositOpen(true), []);
|
|
2845
|
+
const onWithdrawClick = useCallback4(() => setWithdrawOpen(true), []);
|
|
2639
2846
|
useEffect7(() => {
|
|
2640
2847
|
if (typeof window === "undefined") return;
|
|
2641
2848
|
window.addEventListener(DEPOSIT_MODAL_OPEN_EVENT, onDepositClick);
|
|
@@ -2684,7 +2891,7 @@ var HomeSearchResults = ({
|
|
|
2684
2891
|
onEventClick,
|
|
2685
2892
|
onMarketClick
|
|
2686
2893
|
}) => {
|
|
2687
|
-
const labels =
|
|
2894
|
+
const labels = useLabels5();
|
|
2688
2895
|
const { search: searchConfig } = useSdkUiConfig4();
|
|
2689
2896
|
const { disabledVenues } = useAppConfig();
|
|
2690
2897
|
const [activeVenueTabValue, setActiveVenueTabValue] = useState9("all");
|
|
@@ -2885,8 +3092,8 @@ var HomePage = ({
|
|
|
2885
3092
|
onError,
|
|
2886
3093
|
stickyOrderPanel
|
|
2887
3094
|
}) => {
|
|
2888
|
-
var _a, _b, _c, _d;
|
|
2889
|
-
const labels =
|
|
3095
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
3096
|
+
const labels = useLabels5();
|
|
2890
3097
|
const {
|
|
2891
3098
|
search: {
|
|
2892
3099
|
value: searchValue,
|
|
@@ -2895,12 +3102,15 @@ var HomePage = ({
|
|
|
2895
3102
|
onChange: onSearchChange,
|
|
2896
3103
|
onSelect: onSelectEventInternal
|
|
2897
3104
|
},
|
|
2898
|
-
trading: { executionMode }
|
|
3105
|
+
trading: { executionMode },
|
|
3106
|
+
features: { enableEventDiscoveryUrlPersistence }
|
|
2899
3107
|
} = useSdkUiConfig4();
|
|
3108
|
+
const { isLoading: isAppConfigLoading } = useAppConfig();
|
|
3109
|
+
const primaryEventListTabs = useEventListTabs();
|
|
2900
3110
|
const { capture, consume } = useEventListState();
|
|
2901
3111
|
const [snapshot] = useState9(() => consume());
|
|
2902
3112
|
const eventListStateRef = useRef7(null);
|
|
2903
|
-
const handleSelectEvent =
|
|
3113
|
+
const handleSelectEvent = useCallback5(
|
|
2904
3114
|
(event) => {
|
|
2905
3115
|
var _a2, _b2, _c2, _d2;
|
|
2906
3116
|
capture({
|
|
@@ -2967,7 +3177,7 @@ var HomePage = ({
|
|
|
2967
3177
|
}, [isShowingAllResults, normalizedSearchValue, selectedEvent]);
|
|
2968
3178
|
const resolvedSelectedEvent = selectedEvent != null ? selectedEvent : stickySelectedEvent;
|
|
2969
3179
|
const resolvedAllCategoryTabLabel = allCategoryTabLabel === DEFAULT_ALL_CATEGORY_TAB_LABEL ? labels.home.trending : allCategoryTabLabel;
|
|
2970
|
-
const { categories } = useCategories({
|
|
3180
|
+
const { categories, isLoading: isCategoriesLoading } = useCategories({
|
|
2971
3181
|
limit: categoriesLimit,
|
|
2972
3182
|
enabled: !hasCustomTabs
|
|
2973
3183
|
});
|
|
@@ -2978,22 +3188,180 @@ var HomePage = ({
|
|
|
2978
3188
|
if (hasCustomTabs && tabs) return tabs;
|
|
2979
3189
|
return categoryTabs;
|
|
2980
3190
|
}, [categoryTabs, hasCustomTabs, tabs]);
|
|
3191
|
+
const availableCategoryValues = useMemo5(
|
|
3192
|
+
() => resolvedTabs.filter((tab) => !tab.disabled).map((tab) => tab.value),
|
|
3193
|
+
[resolvedTabs]
|
|
3194
|
+
);
|
|
3195
|
+
const resolvedDefaultCategory = resolveInitialTabValue(resolvedTabs, defaultActiveTab);
|
|
3196
|
+
const defaultCategory = availableCategoryValues.includes(resolvedDefaultCategory) ? resolvedDefaultCategory : (_a = availableCategoryValues[0]) != null ? _a : resolvedDefaultCategory;
|
|
3197
|
+
const availableVenueTabs = useMemo5(
|
|
3198
|
+
() => primaryEventListTabs.filter((tab) => !tab.disabled && !tab.isComingSoon),
|
|
3199
|
+
[primaryEventListTabs]
|
|
3200
|
+
);
|
|
3201
|
+
const availableVenueValues = useMemo5(
|
|
3202
|
+
() => availableVenueTabs.map((tab) => tab.value),
|
|
3203
|
+
[availableVenueTabs]
|
|
3204
|
+
);
|
|
3205
|
+
const defaultVenue = (_c = (_b = availableVenueTabs[0]) == null ? void 0 : _b.value) != null ? _c : "matched";
|
|
2981
3206
|
const resolvedEventSectionItems = eventSectionItems && eventSectionItems.length > 0 ? eventSectionItems : getDefaultEventSectionItems(labels);
|
|
2982
|
-
const [
|
|
2983
|
-
|
|
2984
|
-
|
|
3207
|
+
const [discoveryFilterState, setDiscoveryFilterState] = useState9(
|
|
3208
|
+
() => {
|
|
3209
|
+
var _a2, _b2;
|
|
3210
|
+
return {
|
|
3211
|
+
category: (_a2 = snapshot == null ? void 0 : snapshot.categoryTab) != null ? _a2 : defaultCategory,
|
|
3212
|
+
venue: (_b2 = snapshot == null ? void 0 : snapshot.venueTab) != null ? _b2 : defaultVenue,
|
|
3213
|
+
sort: DEFAULT_EVENT_LIST_SORT,
|
|
3214
|
+
subcategoryPath: []
|
|
3215
|
+
};
|
|
2985
3216
|
}
|
|
2986
|
-
|
|
2987
|
-
|
|
3217
|
+
);
|
|
3218
|
+
const discoveryFilterStateRef = useRef7(discoveryFilterState);
|
|
3219
|
+
discoveryFilterStateRef.current = discoveryFilterState;
|
|
3220
|
+
const [isUrlStateReady, setIsUrlStateReady] = useState9(!enableEventDiscoveryUrlPersistence);
|
|
3221
|
+
const hasInitializedUrlStateRef = useRef7(false);
|
|
3222
|
+
const activeTabValue = discoveryFilterState.category;
|
|
3223
|
+
const resolveCurrentUrlState = useCallback5(() => {
|
|
3224
|
+
if (typeof window === "undefined") return null;
|
|
3225
|
+
const parsedState = readEventDiscoveryUrlState(new URL(window.location.href).searchParams);
|
|
3226
|
+
const resolvedState = resolveEventDiscoveryUrlState({
|
|
3227
|
+
parsedState,
|
|
3228
|
+
categoryValues: availableCategoryValues,
|
|
3229
|
+
venueValues: availableVenueValues,
|
|
3230
|
+
defaultCategory,
|
|
3231
|
+
defaultVenue
|
|
3232
|
+
});
|
|
3233
|
+
return {
|
|
3234
|
+
state: {
|
|
3235
|
+
category: resolvedState.state.category,
|
|
3236
|
+
venue: resolvedState.state.venue,
|
|
3237
|
+
sort: resolvedState.state.sort,
|
|
3238
|
+
subcategoryPath: resolvedState.state.subcategoryPath.map((id) => ({
|
|
3239
|
+
id,
|
|
3240
|
+
label: id,
|
|
3241
|
+
eventCount: 0
|
|
3242
|
+
}))
|
|
3243
|
+
},
|
|
3244
|
+
shouldCanonicalize: resolvedState.shouldCanonicalize
|
|
3245
|
+
};
|
|
3246
|
+
}, [availableCategoryValues, availableVenueValues, defaultCategory, defaultVenue]);
|
|
3247
|
+
const writeFilterStateToHistory = useCallback5(
|
|
3248
|
+
(state, historyMode) => {
|
|
3249
|
+
if (!enableEventDiscoveryUrlPersistence || typeof window === "undefined") return;
|
|
3250
|
+
const currentUrl = new URL(window.location.href);
|
|
3251
|
+
const nextUrl = buildEventDiscoveryUrl({
|
|
3252
|
+
currentUrl,
|
|
3253
|
+
state: {
|
|
3254
|
+
category: state.category,
|
|
3255
|
+
venue: state.venue,
|
|
3256
|
+
sort: state.sort,
|
|
3257
|
+
subcategoryPath: state.subcategoryPath.map((entry) => entry.id)
|
|
3258
|
+
},
|
|
3259
|
+
defaultCategory,
|
|
3260
|
+
defaultVenue
|
|
3261
|
+
});
|
|
3262
|
+
const currentRelativeUrl = `${currentUrl.pathname}${currentUrl.search}${currentUrl.hash}`;
|
|
3263
|
+
if (nextUrl === currentRelativeUrl) return;
|
|
3264
|
+
const method = historyMode === "push" ? "pushState" : "replaceState";
|
|
3265
|
+
window.history[method](window.history.state, "", nextUrl);
|
|
3266
|
+
},
|
|
3267
|
+
[defaultCategory, defaultVenue, enableEventDiscoveryUrlPersistence]
|
|
3268
|
+
);
|
|
3269
|
+
const commitDiscoveryFilterState = useCallback5(
|
|
3270
|
+
(state, historyMode) => {
|
|
3271
|
+
discoveryFilterStateRef.current = state;
|
|
3272
|
+
setDiscoveryFilterState(state);
|
|
3273
|
+
if (isUrlStateReady) writeFilterStateToHistory(state, historyMode);
|
|
3274
|
+
},
|
|
3275
|
+
[isUrlStateReady, writeFilterStateToHistory]
|
|
3276
|
+
);
|
|
3277
|
+
useEffect8(() => {
|
|
3278
|
+
if (!enableEventDiscoveryUrlPersistence) {
|
|
3279
|
+
hasInitializedUrlStateRef.current = false;
|
|
3280
|
+
setIsUrlStateReady(true);
|
|
3281
|
+
return;
|
|
3282
|
+
}
|
|
3283
|
+
if (hasInitializedUrlStateRef.current) return;
|
|
3284
|
+
if (!hasCustomTabs && isCategoriesLoading || isAppConfigLoading) return;
|
|
3285
|
+
const resolvedUrlState = resolveCurrentUrlState();
|
|
3286
|
+
if (!resolvedUrlState) return;
|
|
3287
|
+
hasInitializedUrlStateRef.current = true;
|
|
3288
|
+
discoveryFilterStateRef.current = resolvedUrlState.state;
|
|
3289
|
+
setDiscoveryFilterState(resolvedUrlState.state);
|
|
3290
|
+
setIsUrlStateReady(true);
|
|
3291
|
+
const currentUrl = new URL(window.location.href);
|
|
3292
|
+
const canonicalUrl = buildEventDiscoveryUrl({
|
|
3293
|
+
currentUrl,
|
|
3294
|
+
state: {
|
|
3295
|
+
category: resolvedUrlState.state.category,
|
|
3296
|
+
venue: resolvedUrlState.state.venue,
|
|
3297
|
+
sort: resolvedUrlState.state.sort,
|
|
3298
|
+
subcategoryPath: resolvedUrlState.state.subcategoryPath.map((entry) => entry.id)
|
|
3299
|
+
},
|
|
3300
|
+
defaultCategory,
|
|
3301
|
+
defaultVenue
|
|
3302
|
+
});
|
|
3303
|
+
const currentRelativeUrl = `${currentUrl.pathname}${currentUrl.search}${currentUrl.hash}`;
|
|
3304
|
+
if (resolvedUrlState.shouldCanonicalize || canonicalUrl !== currentRelativeUrl) {
|
|
3305
|
+
window.history.replaceState(window.history.state, "", canonicalUrl);
|
|
3306
|
+
}
|
|
3307
|
+
}, [
|
|
3308
|
+
defaultCategory,
|
|
3309
|
+
defaultVenue,
|
|
3310
|
+
enableEventDiscoveryUrlPersistence,
|
|
3311
|
+
hasCustomTabs,
|
|
3312
|
+
isAppConfigLoading,
|
|
3313
|
+
isCategoriesLoading,
|
|
3314
|
+
resolveCurrentUrlState
|
|
3315
|
+
]);
|
|
3316
|
+
useEffect8(() => {
|
|
3317
|
+
if (!enableEventDiscoveryUrlPersistence || !isUrlStateReady) return;
|
|
3318
|
+
const handlePopState = () => {
|
|
3319
|
+
const resolvedUrlState = resolveCurrentUrlState();
|
|
3320
|
+
if (!resolvedUrlState) return;
|
|
3321
|
+
discoveryFilterStateRef.current = resolvedUrlState.state;
|
|
3322
|
+
setDiscoveryFilterState(resolvedUrlState.state);
|
|
3323
|
+
if (resolvedUrlState.shouldCanonicalize) {
|
|
3324
|
+
writeFilterStateToHistory(resolvedUrlState.state, "replace");
|
|
3325
|
+
}
|
|
3326
|
+
};
|
|
3327
|
+
window.addEventListener("popstate", handlePopState);
|
|
3328
|
+
return () => {
|
|
3329
|
+
window.removeEventListener("popstate", handlePopState);
|
|
3330
|
+
};
|
|
3331
|
+
}, [
|
|
3332
|
+
enableEventDiscoveryUrlPersistence,
|
|
3333
|
+
isUrlStateReady,
|
|
3334
|
+
resolveCurrentUrlState,
|
|
3335
|
+
writeFilterStateToHistory
|
|
3336
|
+
]);
|
|
2988
3337
|
const activeTabValueRef = useRef7(activeTabValue);
|
|
2989
3338
|
activeTabValueRef.current = activeTabValue;
|
|
2990
3339
|
useEffect8(() => {
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
3340
|
+
if (enableEventDiscoveryUrlPersistence && !isUrlStateReady) return;
|
|
3341
|
+
const currentState = discoveryFilterStateRef.current;
|
|
3342
|
+
const categoryIsAvailable = availableCategoryValues.includes(currentState.category);
|
|
3343
|
+
const venueIsAvailable = availableVenueValues.includes(currentState.venue);
|
|
3344
|
+
if (categoryIsAvailable && (!enableEventDiscoveryUrlPersistence || venueIsAvailable)) return;
|
|
3345
|
+
const nextState = __spreadProps(__spreadValues({}, currentState), {
|
|
3346
|
+
category: categoryIsAvailable ? currentState.category : defaultCategory,
|
|
3347
|
+
venue: venueIsAvailable ? currentState.venue : defaultVenue,
|
|
3348
|
+
subcategoryPath: categoryIsAvailable ? currentState.subcategoryPath : []
|
|
2995
3349
|
});
|
|
2996
|
-
|
|
3350
|
+
if (enableEventDiscoveryUrlPersistence) {
|
|
3351
|
+
commitDiscoveryFilterState(nextState, "replace");
|
|
3352
|
+
return;
|
|
3353
|
+
}
|
|
3354
|
+
discoveryFilterStateRef.current = nextState;
|
|
3355
|
+
setDiscoveryFilterState(nextState);
|
|
3356
|
+
}, [
|
|
3357
|
+
availableCategoryValues,
|
|
3358
|
+
availableVenueValues,
|
|
3359
|
+
commitDiscoveryFilterState,
|
|
3360
|
+
defaultCategory,
|
|
3361
|
+
defaultVenue,
|
|
3362
|
+
enableEventDiscoveryUrlPersistence,
|
|
3363
|
+
isUrlStateReady
|
|
3364
|
+
]);
|
|
2997
3365
|
const tabsItems = useMemo5(() => {
|
|
2998
3366
|
return resolvedTabs.map((tab) => {
|
|
2999
3367
|
const isActive = tab.value === activeTabValue;
|
|
@@ -3034,7 +3402,13 @@ var HomePage = ({
|
|
|
3034
3402
|
];
|
|
3035
3403
|
}, [activeTab, activeTabValue, resolvedEventSectionItems]);
|
|
3036
3404
|
const handleTabChange = (value) => {
|
|
3037
|
-
|
|
3405
|
+
commitDiscoveryFilterState(
|
|
3406
|
+
__spreadProps(__spreadValues({}, discoveryFilterStateRef.current), {
|
|
3407
|
+
category: value,
|
|
3408
|
+
subcategoryPath: []
|
|
3409
|
+
}),
|
|
3410
|
+
"push"
|
|
3411
|
+
);
|
|
3038
3412
|
_onTabChange == null ? void 0 : _onTabChange(value);
|
|
3039
3413
|
};
|
|
3040
3414
|
const handleCategoryRootChange = (categoryId) => {
|
|
@@ -3056,10 +3430,10 @@ var HomePage = ({
|
|
|
3056
3430
|
handleSelectEvent(event);
|
|
3057
3431
|
};
|
|
3058
3432
|
const shouldRenderMobileSearch = isMobileSearchViewport && !resolvedSelectedEvent;
|
|
3059
|
-
const isScrollRestorationReady = !!snapshot && !isShowingAllResults && !resolvedSelectedEvent && ((
|
|
3433
|
+
const isScrollRestorationReady = !!snapshot && !isShowingAllResults && !resolvedSelectedEvent && ((_e = (_d = eventListStateRef.current) == null ? void 0 : _d.loadedPageCount) != null ? _e : 0) >= ((_f = snapshot.loadedPageCount) != null ? _f : 1);
|
|
3060
3434
|
useScrollRestoration({
|
|
3061
3435
|
enabled: !!snapshot && snapshot.scrollY > 0,
|
|
3062
|
-
scrollY: (
|
|
3436
|
+
scrollY: (_g = snapshot == null ? void 0 : snapshot.scrollY) != null ? _g : 0,
|
|
3063
3437
|
isReady: isScrollRestorationReady
|
|
3064
3438
|
});
|
|
3065
3439
|
return /* @__PURE__ */ jsx7(AggErrorBoundary, { onError, children: /* @__PURE__ */ jsxs6("section", { className: cn("agg-home-page flex w-full flex-col", classNames == null ? void 0 : classNames.root), children: [
|
|
@@ -3141,7 +3515,13 @@ var HomePage = ({
|
|
|
3141
3515
|
"div",
|
|
3142
3516
|
{
|
|
3143
3517
|
className: "agg-home-section",
|
|
3144
|
-
children: /* @__PURE__ */ jsx7(
|
|
3518
|
+
children: sectionIndex === 0 && !isUrlStateReady ? /* @__PURE__ */ jsx7(
|
|
3519
|
+
Skeleton,
|
|
3520
|
+
{
|
|
3521
|
+
view: "event-list",
|
|
3522
|
+
ariaLabel: labels.eventList.loading(eventSectionItem.title)
|
|
3523
|
+
}
|
|
3524
|
+
) : /* @__PURE__ */ jsx7(
|
|
3145
3525
|
EventList,
|
|
3146
3526
|
__spreadValues({
|
|
3147
3527
|
title: eventSectionItem.title,
|
|
@@ -3157,11 +3537,33 @@ var HomePage = ({
|
|
|
3157
3537
|
handleSelectEvent(event);
|
|
3158
3538
|
},
|
|
3159
3539
|
onMarketClick: onMarketClickProp
|
|
3160
|
-
}, sectionIndex === 0 ? {
|
|
3540
|
+
}, sectionIndex === 0 ? __spreadValues({
|
|
3161
3541
|
stateRef: eventListStateRef,
|
|
3162
|
-
initialVenueTab: (_d2 = snapshot == null ? void 0 : snapshot.venueTab) != null ? _d2 : void 0,
|
|
3542
|
+
initialVenueTab: enableEventDiscoveryUrlPersistence ? void 0 : (_d2 = snapshot == null ? void 0 : snapshot.venueTab) != null ? _d2 : void 0,
|
|
3163
3543
|
initialLoadedPageCount: snapshot == null ? void 0 : snapshot.loadedPageCount
|
|
3164
|
-
}
|
|
3544
|
+
}, enableEventDiscoveryUrlPersistence ? {
|
|
3545
|
+
activeVenueTab: discoveryFilterState.venue,
|
|
3546
|
+
onActiveVenueTabChange: (venue) => {
|
|
3547
|
+
commitDiscoveryFilterState(
|
|
3548
|
+
__spreadProps(__spreadValues({}, discoveryFilterStateRef.current), { venue }),
|
|
3549
|
+
"push"
|
|
3550
|
+
);
|
|
3551
|
+
},
|
|
3552
|
+
selectedSort: discoveryFilterState.sort,
|
|
3553
|
+
onSelectedSortChange: (sort) => {
|
|
3554
|
+
commitDiscoveryFilterState(
|
|
3555
|
+
__spreadProps(__spreadValues({}, discoveryFilterStateRef.current), { sort }),
|
|
3556
|
+
"push"
|
|
3557
|
+
);
|
|
3558
|
+
},
|
|
3559
|
+
categoryPath: discoveryFilterState.subcategoryPath,
|
|
3560
|
+
onCategoryPathChange: (subcategoryPath, options) => {
|
|
3561
|
+
commitDiscoveryFilterState(
|
|
3562
|
+
__spreadProps(__spreadValues({}, discoveryFilterStateRef.current), { subcategoryPath }),
|
|
3563
|
+
options.history
|
|
3564
|
+
);
|
|
3565
|
+
}
|
|
3566
|
+
} : void 0) : void 0)
|
|
3165
3567
|
)
|
|
3166
3568
|
},
|
|
3167
3569
|
`${(_a2 = eventSectionItem.id) != null ? _a2 : eventSectionItem.title}-${sectionIndex}`
|
|
@@ -3189,16 +3591,17 @@ import {
|
|
|
3189
3591
|
useExecutionOrders,
|
|
3190
3592
|
useExecutionPositions,
|
|
3191
3593
|
useGeoBlock,
|
|
3192
|
-
useLabels as
|
|
3594
|
+
useLabels as useLabels13,
|
|
3193
3595
|
useSdkUiConfig as useSdkUiConfig5,
|
|
3194
3596
|
useUserActivity
|
|
3195
3597
|
} from "@agg-build/hooks";
|
|
3196
3598
|
import { Venue as Venue3 } from "@agg-build/sdk";
|
|
3197
3599
|
import dayjs from "dayjs";
|
|
3198
|
-
import { useCallback as
|
|
3600
|
+
import { useCallback as useCallback7, useEffect as useEffect11, useMemo as useMemo8, useRef as useRef10, useState as useState12 } from "react";
|
|
3199
3601
|
|
|
3200
3602
|
// src/pages/user-profile/components/available-balance-card.tsx
|
|
3201
|
-
import { useLabels as
|
|
3603
|
+
import { useLabels as useLabels6 } from "@agg-build/hooks";
|
|
3604
|
+
import { ACTIVE_VENUES, VENUE_CHAIN_IDS } from "@agg-build/sdk";
|
|
3202
3605
|
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3203
3606
|
var BASE_URL = "https://assets.snagsolutions.io";
|
|
3204
3607
|
var CHAIN_ID_TO_ICON_URL = {
|
|
@@ -3217,16 +3620,8 @@ var CHAIN_ID_TO_ICON_URL = {
|
|
|
3217
3620
|
"2741": `${BASE_URL}/public/prediction-markets/logos/Abstract.svg`,
|
|
3218
3621
|
"792703809": `${BASE_URL}/public/prediction-markets/logos/Solana.svg`
|
|
3219
3622
|
};
|
|
3220
|
-
var
|
|
3221
|
-
|
|
3222
|
-
// Polygon
|
|
3223
|
-
"792703809": ["kalshi"],
|
|
3224
|
-
// Solana
|
|
3225
|
-
"56": ["limitless", "opinion"],
|
|
3226
|
-
// BNB
|
|
3227
|
-
"1337": ["hyperliquid"]
|
|
3228
|
-
// HyperCore
|
|
3229
|
-
};
|
|
3623
|
+
var venueLogosForChain = (chainId) => ACTIVE_VENUES.filter((venue) => VENUE_CHAIN_IDS[venue] === Number(chainId));
|
|
3624
|
+
var isVenueBalanceChain = (chainId) => Object.values(VENUE_CHAIN_IDS).includes(Number(chainId));
|
|
3230
3625
|
var isPaperChain = (row) => {
|
|
3231
3626
|
return row.key === "0" || row.label.trim().toLowerCase() === "paper";
|
|
3232
3627
|
};
|
|
@@ -3256,7 +3651,7 @@ var AvailableBalanceCard = ({
|
|
|
3256
3651
|
onManage,
|
|
3257
3652
|
manageButtonRef
|
|
3258
3653
|
}) => {
|
|
3259
|
-
const labels =
|
|
3654
|
+
const labels = useLabels6();
|
|
3260
3655
|
const balanceLabels = labels.userProfile.balance;
|
|
3261
3656
|
const resolvedLabel = label != null ? label : balanceLabels.availableBalance;
|
|
3262
3657
|
const hasPaperBalance = chains.some(isPaperChain);
|
|
@@ -3297,7 +3692,6 @@ var AvailableBalanceCard = ({
|
|
|
3297
3692
|
content: /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-4 items-start justify-start", children: [
|
|
3298
3693
|
/* @__PURE__ */ jsx8("div", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: balanceLabels.balanceByNetwork }),
|
|
3299
3694
|
/* @__PURE__ */ jsx8("div", { role: "list", className: "agg-balance-list flex flex-col gap-3 w-full", children: chains.map((row) => {
|
|
3300
|
-
var _a;
|
|
3301
3695
|
const iconUrl = chainIconUrl(row.label, row.key);
|
|
3302
3696
|
const isPaper = isPaperChain(row);
|
|
3303
3697
|
const rowLabel = isPaper ? balanceLabels.paperModeNetwork : row.label;
|
|
@@ -3325,7 +3719,7 @@ var AvailableBalanceCard = ({
|
|
|
3325
3719
|
minimumFractionDigits: Number.isInteger(row.balance) ? 0 : 1,
|
|
3326
3720
|
maximumFractionDigits: 2
|
|
3327
3721
|
}) }),
|
|
3328
|
-
/* @__PURE__ */ jsx8("div", { className: "flex w-12 shrink-0 items-center justify-end gap-1", children: (
|
|
3722
|
+
/* @__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
3723
|
VenueLogo,
|
|
3330
3724
|
{
|
|
3331
3725
|
venue,
|
|
@@ -3411,7 +3805,7 @@ var AvailableBalanceCard = ({
|
|
|
3411
3805
|
AvailableBalanceCard.displayName = "AvailableBalanceCard";
|
|
3412
3806
|
|
|
3413
3807
|
// src/pages/user-profile/components/claim-activity-breakdown-modal.tsx
|
|
3414
|
-
import { useLabels as
|
|
3808
|
+
import { useLabels as useLabels7 } from "@agg-build/hooks";
|
|
3415
3809
|
import { Venue } from "@agg-build/sdk";
|
|
3416
3810
|
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3417
3811
|
var CLAIM_VENUE_LABELS = {
|
|
@@ -3431,7 +3825,7 @@ var ClaimActivityBreakdownModal = ({
|
|
|
3431
3825
|
onTransactionSelect
|
|
3432
3826
|
}) => {
|
|
3433
3827
|
var _a;
|
|
3434
|
-
const labels =
|
|
3828
|
+
const labels = useLabels7();
|
|
3435
3829
|
return /* @__PURE__ */ jsx9(
|
|
3436
3830
|
Modal,
|
|
3437
3831
|
{
|
|
@@ -3544,24 +3938,29 @@ import {
|
|
|
3544
3938
|
useAggBalance,
|
|
3545
3939
|
useBalanceRefillPolicies,
|
|
3546
3940
|
useDepositAddresses,
|
|
3547
|
-
useLabels as
|
|
3941
|
+
useLabels as useLabels8
|
|
3548
3942
|
} from "@agg-build/hooks";
|
|
3549
|
-
import {
|
|
3943
|
+
import {
|
|
3944
|
+
DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW,
|
|
3945
|
+
DEFAULT_BALANCE_REFILL_MAX_FEE_RAW,
|
|
3946
|
+
getBalanceRefillMaximumRaw,
|
|
3947
|
+
Venue as Venue2
|
|
3948
|
+
} from "@agg-build/sdk";
|
|
3550
3949
|
import * as Dialog2 from "@radix-ui/react-dialog";
|
|
3551
|
-
import { useCallback as
|
|
3552
|
-
import { z } from "zod";
|
|
3950
|
+
import { useCallback as useCallback6, useEffect as useEffect9, useId, useMemo as useMemo6, useRef as useRef8, useState as useState10 } from "react";
|
|
3951
|
+
import { z as z2 } from "zod";
|
|
3553
3952
|
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3554
3953
|
var USDC_DECIMALS = 6;
|
|
3555
3954
|
var EDITABLE_AMOUNT_PATTERN = /^\d*(?:\.\d{0,6})?$/;
|
|
3556
3955
|
var FINAL_AMOUNT_PATTERN = /^\d+(?:\.\d{1,6})?$/;
|
|
3557
|
-
var
|
|
3558
|
-
137:
|
|
3559
|
-
56:
|
|
3560
|
-
792703809:
|
|
3561
|
-
1337:
|
|
3562
|
-
42161:
|
|
3563
|
-
8453:
|
|
3564
|
-
1:
|
|
3956
|
+
var NETWORK_ORDER = {
|
|
3957
|
+
137: 0,
|
|
3958
|
+
56: 1,
|
|
3959
|
+
792703809: 2,
|
|
3960
|
+
1337: 3,
|
|
3961
|
+
42161: 4,
|
|
3962
|
+
8453: 5,
|
|
3963
|
+
1: 6
|
|
3565
3964
|
};
|
|
3566
3965
|
var VENUE_LABELS = {
|
|
3567
3966
|
[Venue2.kalshi]: "Kalshi",
|
|
@@ -3574,7 +3973,7 @@ var VENUE_LABELS = {
|
|
|
3574
3973
|
[Venue2.hyperliquid]: "Hyperliquid",
|
|
3575
3974
|
[Venue2.novig]: "Novig"
|
|
3576
3975
|
};
|
|
3577
|
-
var amountSchema =
|
|
3976
|
+
var amountSchema = z2.string().min(1).regex(FINAL_AMOUNT_PATTERN);
|
|
3578
3977
|
var decimalToRaw = (value, decimals = USDC_DECIMALS) => {
|
|
3579
3978
|
const parsed = amountSchema.safeParse(value.trim());
|
|
3580
3979
|
if (!parsed.success) return null;
|
|
@@ -3605,11 +4004,11 @@ var areDraftsEqual = (current, initial) => {
|
|
|
3605
4004
|
return currentMinimumRaw !== null && currentRefillToRaw !== null && currentMinimumRaw === initialMinimumRaw && currentRefillToRaw === initialRefillToRaw;
|
|
3606
4005
|
};
|
|
3607
4006
|
var getPolicyMaximumRaw = (policy) => {
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
4007
|
+
var _a, _b;
|
|
4008
|
+
return getBalanceRefillMaximumRaw(
|
|
4009
|
+
(_a = policy == null ? void 0 : policy.dailyCapRaw) != null ? _a : DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW,
|
|
4010
|
+
(_b = policy == null ? void 0 : policy.maxFeeRaw) != null ? _b : DEFAULT_BALANCE_REFILL_MAX_FEE_RAW
|
|
4011
|
+
);
|
|
3613
4012
|
};
|
|
3614
4013
|
var getApiFieldErrors = (error) => {
|
|
3615
4014
|
var _a;
|
|
@@ -3624,7 +4023,7 @@ var ManageBalancesModal = ({
|
|
|
3624
4023
|
open,
|
|
3625
4024
|
onOpenChange
|
|
3626
4025
|
}) => {
|
|
3627
|
-
const labels =
|
|
4026
|
+
const labels = useLabels8();
|
|
3628
4027
|
const refillLabels = labels.balanceRefill;
|
|
3629
4028
|
const balanceState = useAggBalance();
|
|
3630
4029
|
const depositAddressesQuery = useDepositAddresses({ enabled: open });
|
|
@@ -3644,28 +4043,27 @@ var ManageBalancesModal = ({
|
|
|
3644
4043
|
const supportedChains = (_a = depositAddressesQuery.supportedChains) != null ? _a : [];
|
|
3645
4044
|
const availableBalanceBreakdown = (_c = (_b = balanceState.availableBalanceBreakdown) != null ? _b : balanceState.balanceBreakdown) != null ? _c : [];
|
|
3646
4045
|
return supportedChains.flatMap((chain) => {
|
|
3647
|
-
var _a2, _b2;
|
|
3648
4046
|
const usdcToken = chain.tokens.find((token) => token.symbol.toUpperCase() === "USDC");
|
|
3649
4047
|
if (!usdcToken) return [];
|
|
3650
|
-
const presentation = NETWORK_PRESENTATION[chain.chainId];
|
|
3651
4048
|
const chainBalance = availableBalanceBreakdown.find(
|
|
3652
4049
|
(balance) => balance.key === String(chain.chainId)
|
|
3653
4050
|
);
|
|
3654
4051
|
return [
|
|
3655
4052
|
{
|
|
3656
4053
|
chainId: chain.chainId,
|
|
3657
|
-
name:
|
|
4054
|
+
name: chain.name,
|
|
3658
4055
|
balance: chainBalance == null ? void 0 : chainBalance.balance,
|
|
3659
4056
|
policy: policiesQuery.policies.find(
|
|
3660
4057
|
(policy) => policy.targetChainId === chain.chainId && policy.targetTokenSymbol.toUpperCase() === "USDC"
|
|
3661
4058
|
),
|
|
3662
|
-
|
|
4059
|
+
canManageBalance: isVenueBalanceChain(chain.chainId),
|
|
4060
|
+
venues: venueLogosForChain(chain.chainId)
|
|
3663
4061
|
}
|
|
3664
4062
|
];
|
|
3665
4063
|
}).sort((left, right) => {
|
|
3666
|
-
var _a2, _b2
|
|
3667
|
-
const leftOrder = (
|
|
3668
|
-
const rightOrder = (
|
|
4064
|
+
var _a2, _b2;
|
|
4065
|
+
const leftOrder = (_a2 = NETWORK_ORDER[left.chainId]) != null ? _a2 : Number.MAX_SAFE_INTEGER;
|
|
4066
|
+
const rightOrder = (_b2 = NETWORK_ORDER[right.chainId]) != null ? _b2 : Number.MAX_SAFE_INTEGER;
|
|
3669
4067
|
if (leftOrder !== rightOrder) return leftOrder - rightOrder;
|
|
3670
4068
|
return left.name.localeCompare(right.name);
|
|
3671
4069
|
});
|
|
@@ -3700,7 +4098,7 @@ var ManageBalancesModal = ({
|
|
|
3700
4098
|
setInitialDrafts(nextDrafts);
|
|
3701
4099
|
setIsInitialized(true);
|
|
3702
4100
|
}, [hasLoadError, isInitialized, isLoading, networks, open]);
|
|
3703
|
-
const validateDraft =
|
|
4101
|
+
const validateDraft = useCallback6(
|
|
3704
4102
|
(network, draft) => {
|
|
3705
4103
|
const errors = {};
|
|
3706
4104
|
const minimum = draft.minimum.trim();
|
|
@@ -3723,14 +4121,12 @@ var ManageBalancesModal = ({
|
|
|
3723
4121
|
errors.refillTo = refillLabels.relationshipError;
|
|
3724
4122
|
}
|
|
3725
4123
|
const maximumRaw = getPolicyMaximumRaw(network.policy);
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
errors.refillTo = refillLabels.maximumError(maximumLabel);
|
|
3733
|
-
}
|
|
4124
|
+
const maximumLabel = rawToDecimal(maximumRaw);
|
|
4125
|
+
if (minimumRaw !== null && BigInt(minimumRaw) > BigInt(maximumRaw)) {
|
|
4126
|
+
errors.minimum = refillLabels.maximumError(maximumLabel);
|
|
4127
|
+
}
|
|
4128
|
+
if (refillToRaw !== null && BigInt(refillToRaw) > BigInt(maximumRaw)) {
|
|
4129
|
+
errors.refillTo = refillLabels.maximumError(maximumLabel);
|
|
3734
4130
|
}
|
|
3735
4131
|
return errors;
|
|
3736
4132
|
},
|
|
@@ -3738,7 +4134,7 @@ var ManageBalancesModal = ({
|
|
|
3738
4134
|
);
|
|
3739
4135
|
const dirtyNetworks = useMemo6(
|
|
3740
4136
|
() => networks.filter((network) => {
|
|
3741
|
-
if (network.
|
|
4137
|
+
if (!network.canManageBalance) return false;
|
|
3742
4138
|
if (resetChainIds.has(network.chainId)) return true;
|
|
3743
4139
|
const draft = drafts[network.chainId];
|
|
3744
4140
|
const initialDraft = initialDrafts[network.chainId];
|
|
@@ -3763,14 +4159,14 @@ var ManageBalancesModal = ({
|
|
|
3763
4159
|
(errors) => errors.minimum || errors.refillTo || errors.general
|
|
3764
4160
|
);
|
|
3765
4161
|
const isSaveDisabled = dirtyNetworks.length === 0 || hasValidationErrors || isSaving;
|
|
3766
|
-
const handleOpenChange =
|
|
4162
|
+
const handleOpenChange = useCallback6(
|
|
3767
4163
|
(nextOpen) => {
|
|
3768
4164
|
if (isSaving && !nextOpen) return;
|
|
3769
4165
|
onOpenChange(nextOpen);
|
|
3770
4166
|
},
|
|
3771
4167
|
[isSaving, onOpenChange]
|
|
3772
4168
|
);
|
|
3773
|
-
const handleToggleNetwork =
|
|
4169
|
+
const handleToggleNetwork = useCallback6((chainId, canManageBalance) => {
|
|
3774
4170
|
if (!canManageBalance) return;
|
|
3775
4171
|
setExpandedChainIds((current) => {
|
|
3776
4172
|
const next = new Set(current);
|
|
@@ -3779,7 +4175,7 @@ var ManageBalancesModal = ({
|
|
|
3779
4175
|
return next;
|
|
3780
4176
|
});
|
|
3781
4177
|
}, []);
|
|
3782
|
-
const handleDraftChange =
|
|
4178
|
+
const handleDraftChange = useCallback6(
|
|
3783
4179
|
(chainId, field, value) => {
|
|
3784
4180
|
if (!EDITABLE_AMOUNT_PATTERN.test(value)) return;
|
|
3785
4181
|
setDrafts((current) => {
|
|
@@ -3808,7 +4204,7 @@ var ManageBalancesModal = ({
|
|
|
3808
4204
|
},
|
|
3809
4205
|
[]
|
|
3810
4206
|
);
|
|
3811
|
-
const handleResetNetwork =
|
|
4207
|
+
const handleResetNetwork = useCallback6((network) => {
|
|
3812
4208
|
setDrafts((current) => __spreadProps(__spreadValues({}, current), {
|
|
3813
4209
|
[network.chainId]: { minimum: "0", refillTo: "0" }
|
|
3814
4210
|
}));
|
|
@@ -3824,7 +4220,7 @@ var ManageBalancesModal = ({
|
|
|
3824
4220
|
return __spreadProps(__spreadValues({}, current), { [network.chainId]: {} });
|
|
3825
4221
|
});
|
|
3826
4222
|
}, []);
|
|
3827
|
-
const handleAmountBlur =
|
|
4223
|
+
const handleAmountBlur = useCallback6((chainId, field) => {
|
|
3828
4224
|
setDrafts((current) => {
|
|
3829
4225
|
const currentDraft = current[chainId];
|
|
3830
4226
|
if (!currentDraft) return current;
|
|
@@ -3835,12 +4231,12 @@ var ManageBalancesModal = ({
|
|
|
3835
4231
|
});
|
|
3836
4232
|
});
|
|
3837
4233
|
}, []);
|
|
3838
|
-
const handleRetry =
|
|
4234
|
+
const handleRetry = useCallback6(() => {
|
|
3839
4235
|
void depositAddressesQuery.refetch();
|
|
3840
4236
|
void policiesQuery.refetch();
|
|
3841
4237
|
balanceState.refetch();
|
|
3842
4238
|
}, [balanceState, depositAddressesQuery, policiesQuery]);
|
|
3843
|
-
const handleSave =
|
|
4239
|
+
const handleSave = useCallback6(() => __async(null, null, function* () {
|
|
3844
4240
|
if (savingRef.current || isSaveDisabled) return;
|
|
3845
4241
|
savingRef.current = true;
|
|
3846
4242
|
setIsSaving(true);
|
|
@@ -3976,7 +4372,7 @@ var ManageBalancesModal = ({
|
|
|
3976
4372
|
}
|
|
3977
4373
|
) : /* @__PURE__ */ jsx10("div", { className: "flex flex-col", role: "list", children: networks.map((network, networkIndex) => {
|
|
3978
4374
|
var _a, _b, _c, _d, _e;
|
|
3979
|
-
const canManageBalance = network.
|
|
4375
|
+
const canManageBalance = network.canManageBalance;
|
|
3980
4376
|
const isExpanded = canManageBalance && expandedChainIds.has(network.chainId);
|
|
3981
4377
|
const isLastNetwork = networkIndex === networks.length - 1;
|
|
3982
4378
|
const isPendingReset = resetChainIds.has(network.chainId);
|
|
@@ -4252,7 +4648,7 @@ var ManageBalancesModal = ({
|
|
|
4252
4648
|
ManageBalancesModal.displayName = "ManageBalancesModal";
|
|
4253
4649
|
|
|
4254
4650
|
// src/pages/user-profile/components/positions-activity.tsx
|
|
4255
|
-
import { optimizedImageUrl as optimizedImageUrl3, useAggUiConfig as useAggUiConfig2, useLabels as
|
|
4651
|
+
import { optimizedImageUrl as optimizedImageUrl3, useAggUiConfig as useAggUiConfig2, useLabels as useLabels11 } from "@agg-build/hooks";
|
|
4256
4652
|
import { Fragment as Fragment4, useEffect as useEffect10, useMemo as useMemo7, useRef as useRef9, useState as useState11 } from "react";
|
|
4257
4653
|
|
|
4258
4654
|
// src/pages/user-profile/user-profile.constants.ts
|
|
@@ -5043,7 +5439,7 @@ var EmptyState = ({ title, description, className }) => {
|
|
|
5043
5439
|
EmptyState.displayName = "EmptyState";
|
|
5044
5440
|
|
|
5045
5441
|
// src/pages/user-profile/components/open-order-row.tsx
|
|
5046
|
-
import { optimizedImageUrl, useLabels as
|
|
5442
|
+
import { optimizedImageUrl, useLabels as useLabels9 } from "@agg-build/hooks";
|
|
5047
5443
|
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5048
5444
|
var shouldUseNativeLinkNavigation2 = (event) => {
|
|
5049
5445
|
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
|
|
@@ -5056,11 +5452,21 @@ var CANCELLABLE_LIMIT_ORDER_STATUSES = /* @__PURE__ */ new Set([
|
|
|
5056
5452
|
]);
|
|
5057
5453
|
var canCancelOpenOrder = (order) => {
|
|
5058
5454
|
const status = order.status.trim().toLowerCase();
|
|
5059
|
-
if (status === "pending" && !order.dagRunId) return true;
|
|
5060
5455
|
const isLimitOrder = order.orderType === "limit" || order.limitPriceLabel != null;
|
|
5061
5456
|
if (!isLimitOrder) return false;
|
|
5457
|
+
if (status === "pending" && !order.dagRunId) return true;
|
|
5062
5458
|
return CANCELLABLE_LIMIT_ORDER_STATUSES.has(status);
|
|
5063
5459
|
};
|
|
5460
|
+
var PENDING_LIMIT_ORDER_STATUSES = /* @__PURE__ */ new Set([
|
|
5461
|
+
"pending",
|
|
5462
|
+
"signing",
|
|
5463
|
+
"pending_bridge",
|
|
5464
|
+
"submitting"
|
|
5465
|
+
]);
|
|
5466
|
+
var isPendingOpenOrder = (order) => {
|
|
5467
|
+
const isLimitOrder = order.orderType === "limit" || order.limitPriceLabel != null;
|
|
5468
|
+
return isLimitOrder && PENDING_LIMIT_ORDER_STATUSES.has(order.status.trim().toLowerCase()) && !canCancelOpenOrder(order);
|
|
5469
|
+
};
|
|
5064
5470
|
var OpenOrderRow = ({
|
|
5065
5471
|
order,
|
|
5066
5472
|
href,
|
|
@@ -5075,7 +5481,7 @@ var OpenOrderRow = ({
|
|
|
5075
5481
|
expirationHeader
|
|
5076
5482
|
}) => {
|
|
5077
5483
|
var _a, _b, _c, _d;
|
|
5078
|
-
const labels =
|
|
5484
|
+
const labels = useLabels9().userProfile.openOrders;
|
|
5079
5485
|
const resolvedCancelLabel = cancelLabel != null ? cancelLabel : labels.cancel;
|
|
5080
5486
|
const resolvedCancelAriaLabel = cancelAriaLabel != null ? cancelAriaLabel : labels.cancelOrderAria(order.id);
|
|
5081
5487
|
const resolvedLimitPriceHeader = limitPriceHeader != null ? limitPriceHeader : labels.limitPriceHeader;
|
|
@@ -5097,6 +5503,7 @@ var OpenOrderRow = ({
|
|
|
5097
5503
|
onCancel == null ? void 0 : onCancel(order);
|
|
5098
5504
|
};
|
|
5099
5505
|
const canCancel = canCancelOpenOrder(order);
|
|
5506
|
+
const isPending = isPendingOpenOrder(order);
|
|
5100
5507
|
const Wrapper = href ? "a" : "div";
|
|
5101
5508
|
const wrapperProps = href ? {
|
|
5102
5509
|
href,
|
|
@@ -5159,7 +5566,7 @@ var OpenOrderRow = ({
|
|
|
5159
5566
|
{
|
|
5160
5567
|
className: cn(
|
|
5161
5568
|
"shrink-0 justify-end",
|
|
5162
|
-
canCancel ? "flex w-full lg:w-[80px]" : "hidden lg:flex lg:w-[80px]"
|
|
5569
|
+
canCancel || isPending ? "flex w-full lg:w-[80px]" : "hidden lg:flex lg:w-[80px]"
|
|
5163
5570
|
),
|
|
5164
5571
|
children: canCancel ? /* @__PURE__ */ jsx13(
|
|
5165
5572
|
Button,
|
|
@@ -5173,7 +5580,10 @@ var OpenOrderRow = ({
|
|
|
5173
5580
|
className: "w-full lg:w-auto !text-agg-error font-agg-bold",
|
|
5174
5581
|
children: resolvedCancelLabel
|
|
5175
5582
|
}
|
|
5176
|
-
) :
|
|
5583
|
+
) : isPending ? /* @__PURE__ */ jsxs12("div", { className: "flex w-full items-center justify-center gap-2 agg-type-label text-agg-foreground", children: [
|
|
5584
|
+
/* @__PURE__ */ jsx13(LoadingIcon, { size: "small", ariaLabel: labels.pending, className: "text-agg-primary" }),
|
|
5585
|
+
/* @__PURE__ */ jsx13("span", { children: labels.pending })
|
|
5586
|
+
] }) : null
|
|
5177
5587
|
}
|
|
5178
5588
|
)
|
|
5179
5589
|
] })
|
|
@@ -5183,7 +5593,7 @@ var OpenOrderRow = ({
|
|
|
5183
5593
|
OpenOrderRow.displayName = "OpenOrderRow";
|
|
5184
5594
|
|
|
5185
5595
|
// src/pages/user-profile/components/position-row.tsx
|
|
5186
|
-
import { optimizedImageUrl as optimizedImageUrl2, useAggUiConfig, useLabels as
|
|
5596
|
+
import { optimizedImageUrl as optimizedImageUrl2, useAggUiConfig, useLabels as useLabels10 } from "@agg-build/hooks";
|
|
5187
5597
|
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5188
5598
|
var shouldUseNativeLinkNavigation3 = (event) => {
|
|
5189
5599
|
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
|
|
@@ -5321,7 +5731,7 @@ var PositionRow = ({
|
|
|
5321
5731
|
onClaim,
|
|
5322
5732
|
isClaiming = false
|
|
5323
5733
|
}) => {
|
|
5324
|
-
const labels =
|
|
5734
|
+
const labels = useLabels10().userProfile.positions;
|
|
5325
5735
|
const { formatCurrency: formatCurrency2, formatPrice } = useAggUiConfig().formatting;
|
|
5326
5736
|
const model = toPositionRowViewModel(
|
|
5327
5737
|
position,
|
|
@@ -5549,7 +5959,7 @@ var PositionsActivity = ({
|
|
|
5549
5959
|
initialPositionFilter = "active",
|
|
5550
5960
|
className
|
|
5551
5961
|
}) => {
|
|
5552
|
-
const userProfileLabels =
|
|
5962
|
+
const userProfileLabels = useLabels11().userProfile;
|
|
5553
5963
|
const positionsLabels = userProfileLabels.positions;
|
|
5554
5964
|
const openOrdersLabels = userProfileLabels.openOrders;
|
|
5555
5965
|
const { formatCurrency: formatCurrency2, formatPrice } = useAggUiConfig2().formatting;
|
|
@@ -6141,7 +6551,7 @@ var buildAggTxExplorerHref = (chainId, txHash) => {
|
|
|
6141
6551
|
};
|
|
6142
6552
|
|
|
6143
6553
|
// src/pages/user-profile/components/user-info-card.tsx
|
|
6144
|
-
import { optimizedImageUrl as optimizedImageUrl4, useLabels as
|
|
6554
|
+
import { optimizedImageUrl as optimizedImageUrl4, useLabels as useLabels12 } from "@agg-build/hooks";
|
|
6145
6555
|
|
|
6146
6556
|
// src/primitives/conditional-wrapper.tsx
|
|
6147
6557
|
var ConditionalWrapper = ({
|
|
@@ -6208,7 +6618,7 @@ var UserInfoCard = ({
|
|
|
6208
6618
|
className
|
|
6209
6619
|
}) => {
|
|
6210
6620
|
var _a;
|
|
6211
|
-
const labels =
|
|
6621
|
+
const labels = useLabels12();
|
|
6212
6622
|
const wallets = (_a = user.connectedWallets) != null ? _a : [];
|
|
6213
6623
|
const hasWallets = wallets.length > 0;
|
|
6214
6624
|
return /* @__PURE__ */ jsxs17(
|
|
@@ -6583,6 +6993,8 @@ var OPEN_ORDER_QUERY_STATUSES = [
|
|
|
6583
6993
|
var SHOW_SOLD_POSITIONS = false;
|
|
6584
6994
|
var SOLD_POSITION_SHARES_THRESHOLD = 0.1;
|
|
6585
6995
|
var isOpenOrderStatus = (status) => OPEN_ORDER_STATUSES.has(status.toLowerCase());
|
|
6996
|
+
var isExecutionLimitOrder = (order) => order.orderType === "limit" || order.orderType == null && order.limitSizeRaw != null;
|
|
6997
|
+
var isUserProfileLimitOrder = (order) => order.orderType === "limit" || order.orderType == null && order.limitPriceLabel != null;
|
|
6586
6998
|
var shouldIncludeByShares = (position) => {
|
|
6587
6999
|
if (SHOW_SOLD_POSITIONS) return true;
|
|
6588
7000
|
if (typeof position.totalShares !== "number") return true;
|
|
@@ -6848,7 +7260,7 @@ var UserProfilePage = ({
|
|
|
6848
7260
|
const { user: currentUser, isAuthenticated } = useAggAuthState();
|
|
6849
7261
|
const { isDepositBlocked } = useGeoBlock();
|
|
6850
7262
|
const balanceState = useAggBalance2();
|
|
6851
|
-
const labels =
|
|
7263
|
+
const labels = useLabels13();
|
|
6852
7264
|
const {
|
|
6853
7265
|
features: { showLimitOrders },
|
|
6854
7266
|
trading: { executionMode: configuredExecutionMode }
|
|
@@ -6877,7 +7289,7 @@ var UserProfilePage = ({
|
|
|
6877
7289
|
const manageBalancesButtonRef = useRef10(null);
|
|
6878
7290
|
const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
|
|
6879
7291
|
const queryExecutionMode = resolvedExecutionMode === "paper" ? "paper" : void 0;
|
|
6880
|
-
const handleManageBalancesOpenChange =
|
|
7292
|
+
const handleManageBalancesOpenChange = useCallback7((open) => {
|
|
6881
7293
|
setIsManageBalancesOpen(open);
|
|
6882
7294
|
if (open) return;
|
|
6883
7295
|
requestAnimationFrame(() => {
|
|
@@ -6897,7 +7309,7 @@ var UserProfilePage = ({
|
|
|
6897
7309
|
limit: 25,
|
|
6898
7310
|
mode: queryExecutionMode
|
|
6899
7311
|
});
|
|
6900
|
-
const handlePositionFilterChange =
|
|
7312
|
+
const handlePositionFilterChange = useCallback7(
|
|
6901
7313
|
(filter) => {
|
|
6902
7314
|
setPositionFilter(filter);
|
|
6903
7315
|
onPositionFilterChangeProp == null ? void 0 : onPositionFilterChangeProp(filter);
|
|
@@ -6916,48 +7328,56 @@ var UserProfilePage = ({
|
|
|
6916
7328
|
const pendingOpenOrdersQuery = useExecutionOrders({
|
|
6917
7329
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
6918
7330
|
status: OPEN_ORDER_QUERY_STATUSES[0],
|
|
7331
|
+
orderType: "limit",
|
|
6919
7332
|
limit: 25,
|
|
6920
7333
|
mode: queryExecutionMode
|
|
6921
7334
|
});
|
|
6922
7335
|
const signingOpenOrdersQuery = useExecutionOrders({
|
|
6923
7336
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
6924
7337
|
status: OPEN_ORDER_QUERY_STATUSES[1],
|
|
7338
|
+
orderType: "limit",
|
|
6925
7339
|
limit: 25,
|
|
6926
7340
|
mode: queryExecutionMode
|
|
6927
7341
|
});
|
|
6928
7342
|
const pendingBridgeOpenOrdersQuery = useExecutionOrders({
|
|
6929
7343
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
6930
7344
|
status: OPEN_ORDER_QUERY_STATUSES[2],
|
|
7345
|
+
orderType: "limit",
|
|
6931
7346
|
limit: 25,
|
|
6932
7347
|
mode: queryExecutionMode
|
|
6933
7348
|
});
|
|
6934
7349
|
const submittingOpenOrdersQuery = useExecutionOrders({
|
|
6935
7350
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
6936
7351
|
status: OPEN_ORDER_QUERY_STATUSES[3],
|
|
7352
|
+
orderType: "limit",
|
|
6937
7353
|
limit: 25,
|
|
6938
7354
|
mode: queryExecutionMode
|
|
6939
7355
|
});
|
|
6940
7356
|
const submittedOpenOrdersQuery = useExecutionOrders({
|
|
6941
7357
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
6942
7358
|
status: OPEN_ORDER_QUERY_STATUSES[4],
|
|
7359
|
+
orderType: "limit",
|
|
6943
7360
|
limit: 25,
|
|
6944
7361
|
mode: queryExecutionMode
|
|
6945
7362
|
});
|
|
6946
7363
|
const openOpenOrdersQuery = useExecutionOrders({
|
|
6947
7364
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
6948
7365
|
status: OPEN_ORDER_QUERY_STATUSES[5],
|
|
7366
|
+
orderType: "limit",
|
|
6949
7367
|
limit: 25,
|
|
6950
7368
|
mode: queryExecutionMode
|
|
6951
7369
|
});
|
|
6952
7370
|
const partiallyFilledOpenOrdersQuery = useExecutionOrders({
|
|
6953
7371
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
6954
7372
|
status: OPEN_ORDER_QUERY_STATUSES[6],
|
|
7373
|
+
orderType: "limit",
|
|
6955
7374
|
limit: 25,
|
|
6956
7375
|
mode: queryExecutionMode
|
|
6957
7376
|
});
|
|
6958
7377
|
const cancelPendingOpenOrdersQuery = useExecutionOrders({
|
|
6959
7378
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
6960
7379
|
status: OPEN_ORDER_QUERY_STATUSES[7],
|
|
7380
|
+
orderType: "limit",
|
|
6961
7381
|
limit: 25,
|
|
6962
7382
|
mode: queryExecutionMode
|
|
6963
7383
|
});
|
|
@@ -6987,7 +7407,7 @@ var UserProfilePage = ({
|
|
|
6987
7407
|
enabled: shouldUseHookData && isAuthenticated,
|
|
6988
7408
|
limit: 25
|
|
6989
7409
|
});
|
|
6990
|
-
const handleCancelOrder =
|
|
7410
|
+
const handleCancelOrder = useCallback7(
|
|
6991
7411
|
(order) => __async(null, null, function* () {
|
|
6992
7412
|
if (onCancelOrder) {
|
|
6993
7413
|
onCancelOrder(order);
|
|
@@ -7020,7 +7440,7 @@ var UserProfilePage = ({
|
|
|
7020
7440
|
}),
|
|
7021
7441
|
[cancelOrderMutation, labels.notifications.order, onCancelOrder, toastContext]
|
|
7022
7442
|
);
|
|
7023
|
-
const handleClaimPosition =
|
|
7443
|
+
const handleClaimPosition = useCallback7(
|
|
7024
7444
|
(position) => {
|
|
7025
7445
|
var _a2, _b2;
|
|
7026
7446
|
return startClaim({
|
|
@@ -7031,7 +7451,7 @@ var UserProfilePage = ({
|
|
|
7031
7451
|
},
|
|
7032
7452
|
[startClaim]
|
|
7033
7453
|
);
|
|
7034
|
-
const handleActivityRowClick =
|
|
7454
|
+
const handleActivityRowClick = useCallback7(
|
|
7035
7455
|
(activity) => {
|
|
7036
7456
|
if (activity.kind === "redeem") {
|
|
7037
7457
|
setSelectedClaimActivity(activity);
|
|
@@ -7041,7 +7461,7 @@ var UserProfilePage = ({
|
|
|
7041
7461
|
},
|
|
7042
7462
|
[onActivityClick]
|
|
7043
7463
|
);
|
|
7044
|
-
const handleClaimTransactionSelect =
|
|
7464
|
+
const handleClaimTransactionSelect = useCallback7((transaction) => {
|
|
7045
7465
|
const href = buildAggTxExplorerHref(transaction.chainId, transaction.txHash);
|
|
7046
7466
|
setSelectedClaimActivity(null);
|
|
7047
7467
|
if (!href || typeof window === "undefined") return;
|
|
@@ -7277,18 +7697,20 @@ var UserProfilePage = ({
|
|
|
7277
7697
|
});
|
|
7278
7698
|
}, [activities, activityQuery.activities, isHydrated, labels, ordersQuery.orders]);
|
|
7279
7699
|
const resolvedOpenOrders = useMemo8(() => {
|
|
7280
|
-
if (openOrders) return openOrders;
|
|
7700
|
+
if (openOrders) return openOrders.filter(isUserProfileLimitOrder);
|
|
7281
7701
|
const orderRowsById = /* @__PURE__ */ new Map();
|
|
7282
7702
|
for (const query of openOrderQueries) {
|
|
7283
7703
|
for (const order of query.orders) {
|
|
7284
7704
|
orderRowsById.set(order.id, order);
|
|
7285
7705
|
}
|
|
7286
7706
|
}
|
|
7287
|
-
return Array.from(orderRowsById.values()).filter(
|
|
7707
|
+
return Array.from(orderRowsById.values()).filter(
|
|
7708
|
+
(order) => isOpenOrderStatus(order.status) && isExecutionLimitOrder(order)
|
|
7709
|
+
).sort(
|
|
7288
7710
|
(a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
|
|
7289
7711
|
).map((order) => {
|
|
7290
7712
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
7291
|
-
const isLimitOrder = order
|
|
7713
|
+
const isLimitOrder = isExecutionLimitOrder(order);
|
|
7292
7714
|
const filledRaw = isLimitOrder ? order.filledSizeRaw : order.filledAmountRaw;
|
|
7293
7715
|
const totalRaw = isLimitOrder ? order.limitSizeRaw : order.amountRaw;
|
|
7294
7716
|
const totalCostRaw = isLimitOrder ? (_a2 = order.reservedCostRaw) != null ? _a2 : order.amountRaw : order.amountRaw;
|
|
@@ -7333,14 +7755,14 @@ var UserProfilePage = ({
|
|
|
7333
7755
|
() => openOrderQueries.some((query) => query.isFetchingNextPage),
|
|
7334
7756
|
[openOrderQueries]
|
|
7335
7757
|
);
|
|
7336
|
-
const handleLoadMoreOpenOrders =
|
|
7758
|
+
const handleLoadMoreOpenOrders = useCallback7(() => {
|
|
7337
7759
|
for (const query of openOrderQueries) {
|
|
7338
7760
|
if (query.hasNextPage) {
|
|
7339
7761
|
void query.fetchNextPage();
|
|
7340
7762
|
}
|
|
7341
7763
|
}
|
|
7342
7764
|
}, [openOrderQueries]);
|
|
7343
|
-
const adaptPositionGroups =
|
|
7765
|
+
const adaptPositionGroups = useCallback7(
|
|
7344
7766
|
(groups) => {
|
|
7345
7767
|
return groups.flatMap((group) => {
|
|
7346
7768
|
var _a2, _b2, _c, _d;
|
|
@@ -7594,6 +8016,7 @@ UserProfilePage.displayName = "UserProfilePage";
|
|
|
7594
8016
|
export {
|
|
7595
8017
|
DefaultAvatar,
|
|
7596
8018
|
ConditionalWrapper,
|
|
8019
|
+
formatRecurringCountdown,
|
|
7597
8020
|
EventMarketPage,
|
|
7598
8021
|
useHomePageModals,
|
|
7599
8022
|
HomePage,
|