@agg-build/ui 4.0.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.
- package/README.md +21 -16
- package/dist/{chunk-XIDQ2A6W.mjs → chunk-64BBTXFE.mjs} +1639 -909
- package/dist/{chunk-VR5ZRDQT.mjs → chunk-6STRIKUA.mjs} +1 -1
- package/dist/{chunk-KX3TQ7WC.mjs → chunk-734VTGCV.mjs} +1 -1
- package/dist/{chunk-KO6VTRV6.mjs → chunk-N7UPPT5J.mjs} +336 -232
- package/dist/{chunk-JTSLZARU.mjs → chunk-UCU2XCV5.mjs} +2 -2
- package/dist/{chunk-MKU5Q6PN.mjs → chunk-V5CRUO6S.mjs} +653 -379
- package/dist/{chunk-R362GNI2.mjs → chunk-WW5QKNIM.mjs} +278 -146
- package/dist/events.js +1241 -754
- package/dist/events.mjs +6 -4
- package/dist/index.js +4919 -3694
- package/dist/index.mjs +20 -8
- package/dist/modals.js +1321 -1260
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +4271 -3054
- package/dist/pages.mjs +10 -6
- package/dist/primitives.js +346 -265
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +2281 -1499
- package/dist/trading.mjs +10 -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/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/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/index.d.mts +1 -0
- package/dist/types/pages/user-profile/index.d.ts +1 -0
- 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/primitives/venue-logo/svg/logo-novig.d.mts +24 -0
- package/dist/types/primitives/venue-logo/svg/logo-novig.d.ts +24 -0
- package/dist/types/primitives/venue-logo/venue-logo.constants.d.mts +1 -1
- package/dist/types/primitives/venue-logo/venue-logo.constants.d.ts +1 -1
- package/dist/types/trading/place-order/index.d.mts +4 -1
- package/dist/types/trading/place-order/index.d.ts +4 -1
- package/dist/types/trading/place-order/index.place-order.execution-steps.d.mts +38 -73
- package/dist/types/trading/place-order/index.place-order.execution-steps.d.ts +38 -73
- package/dist/types/trading/place-order/index.place-order.execution-view.d.mts +26 -0
- package/dist/types/trading/place-order/index.place-order.execution-view.d.ts +26 -0
- package/dist/types/trading/place-order/index.place-order.types.d.mts +15 -0
- package/dist/types/trading/place-order/index.place-order.types.d.ts +15 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +14 -1
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +14 -1
- package/package.json +3 -3
- /package/dist/{chunk-KHHFHXXD.mjs → chunk-JH4B3ZHQ.mjs} +0 -0
|
@@ -10,20 +10,21 @@ import {
|
|
|
10
10
|
isErrorWithStatus,
|
|
11
11
|
useEventListTabs,
|
|
12
12
|
useEventListTabsHeaderOverflow
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-V5CRUO6S.mjs";
|
|
14
14
|
import {
|
|
15
15
|
DEPOSIT_MODAL_OPEN_EVENT,
|
|
16
16
|
PlaceOrder,
|
|
17
17
|
SettlementDetails,
|
|
18
18
|
WITHDRAW_MODAL_OPEN_EVENT,
|
|
19
|
+
formatChainIdLabel,
|
|
19
20
|
useClaimWinnings,
|
|
20
21
|
useResolvedMarketClaim
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-64BBTXFE.mjs";
|
|
22
23
|
import {
|
|
23
24
|
getDisplayOutcomePrice,
|
|
24
25
|
resolveHeaderOutcomeItems,
|
|
25
26
|
resolveMarketFromVenueMarkets
|
|
26
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-6STRIKUA.mjs";
|
|
27
28
|
import {
|
|
28
29
|
AggErrorBoundary,
|
|
29
30
|
Button,
|
|
@@ -50,6 +51,8 @@ import {
|
|
|
50
51
|
__spreadValues,
|
|
51
52
|
cn,
|
|
52
53
|
filterOpenEvents,
|
|
54
|
+
formatRecurringMarketPillTimeEt,
|
|
55
|
+
formatRecurringMarketWindowTimeEt,
|
|
53
56
|
formatUsd,
|
|
54
57
|
normalizeVenueMarketCluster,
|
|
55
58
|
resolveTabVenus,
|
|
@@ -57,7 +60,7 @@ import {
|
|
|
57
60
|
skeletonViews,
|
|
58
61
|
sortCategoriesForNavigation,
|
|
59
62
|
useOptionalToast
|
|
60
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-N7UPPT5J.mjs";
|
|
61
64
|
|
|
62
65
|
// src/pages/home/index.tsx
|
|
63
66
|
import {
|
|
@@ -65,24 +68,27 @@ import {
|
|
|
65
68
|
useAppConfig,
|
|
66
69
|
useCategories,
|
|
67
70
|
useEventListState,
|
|
68
|
-
useLabels as
|
|
71
|
+
useLabels as useLabels5,
|
|
69
72
|
useSdkUiConfig as useSdkUiConfig4,
|
|
70
73
|
useSearch,
|
|
71
74
|
useVenueMarketMidpoints
|
|
72
75
|
} from "@agg-build/hooks";
|
|
73
76
|
import { VENUES } from "@agg-build/sdk";
|
|
74
|
-
import { useCallback as
|
|
77
|
+
import { useCallback as useCallback5, useEffect as useEffect8, useMemo as useMemo5, useRef as useRef7, useState as useState9 } from "react";
|
|
75
78
|
|
|
76
79
|
// src/pages/event-market/index.tsx
|
|
77
80
|
import {
|
|
81
|
+
resolveRecurringCryptoTimeline,
|
|
78
82
|
resolveEventTradingState as resolveEventTradingState3,
|
|
79
83
|
TradeSide as TradeSide2,
|
|
80
84
|
useEnrichedVenueEvent,
|
|
81
85
|
useEventTradingContext as useEventTradingContext4,
|
|
86
|
+
useLabels as useLabels4,
|
|
82
87
|
useMidpoints as useMidpoints2,
|
|
88
|
+
useRecurringCryptoMarkets,
|
|
83
89
|
useSdkUiConfig as useSdkUiConfig3
|
|
84
90
|
} from "@agg-build/hooks";
|
|
85
|
-
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";
|
|
86
92
|
|
|
87
93
|
// src/pages/event-market/event-market.utils.ts
|
|
88
94
|
var EVENT_MARKET_PAGE_STICKY_HEADER_OFFSET_PX = 48;
|
|
@@ -381,7 +387,8 @@ import {
|
|
|
381
387
|
TradeSide,
|
|
382
388
|
useEventTradingContext as useEventTradingContext3,
|
|
383
389
|
useMidpoints,
|
|
384
|
-
useSdkUiConfig as useSdkUiConfig2
|
|
390
|
+
useSdkUiConfig as useSdkUiConfig2,
|
|
391
|
+
useSportsLive
|
|
385
392
|
} from "@agg-build/hooks";
|
|
386
393
|
import { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo3, useRef as useRef4, useState as useState5 } from "react";
|
|
387
394
|
|
|
@@ -1649,27 +1656,6 @@ var SportsMarketCard = ({
|
|
|
1649
1656
|
tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(activeMarket.id, firstOutcome.id);
|
|
1650
1657
|
}
|
|
1651
1658
|
}, [activeDefaultOutcome, isExpanded, activeMarket, tradingContext]);
|
|
1652
|
-
if (!activeMarket) return null;
|
|
1653
|
-
const activeOutcome = (_g = activeMarket.venueMarketOutcomes.find(
|
|
1654
|
-
(outcome) => outcome.id === (tradingContext == null ? void 0 : tradingContext.selectedOutcomeId)
|
|
1655
|
-
)) != null ? _g : activeDefaultOutcome;
|
|
1656
|
-
const activeOutcomeVenueCount = (() => {
|
|
1657
|
-
var _a2, _b2;
|
|
1658
|
-
if (!activeOutcome) return collectVenueNames(activeMarket).length;
|
|
1659
|
-
const venueNames = /* @__PURE__ */ new Set([activeMarket.venue]);
|
|
1660
|
-
for (const matchedOutcome of (_a2 = activeOutcome.matchedVenueMarketOutcomes) != null ? _a2 : []) {
|
|
1661
|
-
const matchedVenueMarket = (_b2 = activeMarket.matchedVenueMarkets) == null ? void 0 : _b2.find(
|
|
1662
|
-
(market) => market.id === matchedOutcome.venueMarketId
|
|
1663
|
-
);
|
|
1664
|
-
if (matchedVenueMarket == null ? void 0 : matchedVenueMarket.venue) {
|
|
1665
|
-
venueNames.add(matchedVenueMarket.venue);
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
return venueNames.size > 0 ? venueNames.size : collectVenueNames(activeMarket).length;
|
|
1669
|
-
})();
|
|
1670
|
-
const activeMarketVolume = resolveSportsExpandedMarketsVolume([activeMarket]);
|
|
1671
|
-
const totalGroupVolume = resolveSportsExpandedMarketsVolume(group.markets);
|
|
1672
|
-
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}`;
|
|
1673
1659
|
const combinedMoneylineHeaderOutcomeItems = useMemo(() => {
|
|
1674
1660
|
if (!isCombinedMoneylineGroup) return void 0;
|
|
1675
1661
|
return combinedMoneylineMarkets.flatMap((market, index) => {
|
|
@@ -1707,6 +1693,27 @@ var SportsMarketCard = ({
|
|
|
1707
1693
|
midpointsResult
|
|
1708
1694
|
});
|
|
1709
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}`;
|
|
1710
1717
|
const headerOutcomeItemsOverride = combinedMoneylineHeaderOutcomeItems != null ? combinedMoneylineHeaderOutcomeItems : spreadHeaderOutcomeItems;
|
|
1711
1718
|
const headerOutcomeVariant = isCombinedMoneylineGroup ? "outcome" : resolveSportsMarketCardVariant(activeMarket);
|
|
1712
1719
|
const handleLineSelect = (index) => {
|
|
@@ -2144,6 +2151,7 @@ var SportsEventMarketPage = ({
|
|
|
2144
2151
|
const [isMobileTradeOpen, setIsMobileTradeOpen] = useState5(false);
|
|
2145
2152
|
const isMobileViewport = useIsMobileEventMarketViewport(SPORTS_EVENT_MARKET_MEDIA_QUERY);
|
|
2146
2153
|
const tradingContext = useEventTradingContext3();
|
|
2154
|
+
const { stateByEventId: sportsLiveStateByEventId } = useSportsLive([event.id]);
|
|
2147
2155
|
const midpointsResult = useMidpoints(composedEvent.venueMarkets);
|
|
2148
2156
|
const internalResolvedClaim = useResolvedMarketClaim({
|
|
2149
2157
|
market: eventTradingState.primaryMarket,
|
|
@@ -2215,6 +2223,7 @@ var SportsEventMarketPage = ({
|
|
|
2215
2223
|
defaultOutcomeId,
|
|
2216
2224
|
eventTradingState,
|
|
2217
2225
|
midpointsResult,
|
|
2226
|
+
sportsLiveState: sportsLiveStateByEventId.get(event.id),
|
|
2218
2227
|
classNames: {
|
|
2219
2228
|
root: cn("agg-event-hero", classNames == null ? void 0 : classNames.hero),
|
|
2220
2229
|
// The sports tabs + market cards own market navigation, so hide the
|
|
@@ -2316,6 +2325,36 @@ SportsEventMarketPage.displayName = "SportsEventMarketPage";
|
|
|
2316
2325
|
|
|
2317
2326
|
// src/pages/event-market/index.tsx
|
|
2318
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
|
+
};
|
|
2319
2358
|
var EventMarketPageContent = ({
|
|
2320
2359
|
event,
|
|
2321
2360
|
defaultMarketId,
|
|
@@ -2326,8 +2365,10 @@ var EventMarketPageContent = ({
|
|
|
2326
2365
|
executionMode,
|
|
2327
2366
|
stickyOrderPanel,
|
|
2328
2367
|
resolvedClaim,
|
|
2329
|
-
onBeforePrimaryAction
|
|
2368
|
+
onBeforePrimaryAction,
|
|
2369
|
+
onRecurringMarketNavigate
|
|
2330
2370
|
}) => {
|
|
2371
|
+
var _a;
|
|
2331
2372
|
const eventTradingState = useMemo4(() => resolveEventTradingState3(event), [event]);
|
|
2332
2373
|
const stickyOrderPanelState = resolveEventMarketPageStickyState({
|
|
2333
2374
|
stickyOrderPanel
|
|
@@ -2339,11 +2380,93 @@ var EventMarketPageContent = ({
|
|
|
2339
2380
|
const [isMobileTradeOpen, setIsMobileTradeOpen] = useState6(false);
|
|
2340
2381
|
const isMobileViewport = useIsMobileEventMarketViewport();
|
|
2341
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
|
+
]);
|
|
2342
2463
|
const eventDetailVenueMarkets = useMemo4(
|
|
2343
2464
|
() => normalizeVenueMarketCluster(event.venueMarkets),
|
|
2344
2465
|
[event.venueMarkets]
|
|
2345
2466
|
);
|
|
2346
|
-
const midpointsResult = useMidpoints2(
|
|
2467
|
+
const midpointsResult = useMidpoints2(
|
|
2468
|
+
recurringQuery.isRecurringCryptoMarket && eventTradingState.kind !== "open" ? [] : eventDetailVenueMarkets
|
|
2469
|
+
);
|
|
2347
2470
|
const internalResolvedClaim = useResolvedMarketClaim({
|
|
2348
2471
|
market: eventTradingState.primaryMarket,
|
|
2349
2472
|
enabled: eventTradingState.kind === "resolved",
|
|
@@ -2354,8 +2477,8 @@ var EventMarketPageContent = ({
|
|
|
2354
2477
|
setTradeSideRef.current = tradingContext == null ? void 0 : tradingContext.setTradeSide;
|
|
2355
2478
|
useEffect6(() => {
|
|
2356
2479
|
return () => {
|
|
2357
|
-
var
|
|
2358
|
-
(
|
|
2480
|
+
var _a2;
|
|
2481
|
+
(_a2 = setTradeSideRef.current) == null ? void 0 : _a2.call(setTradeSideRef, TradeSide2.Buy);
|
|
2359
2482
|
};
|
|
2360
2483
|
}, []);
|
|
2361
2484
|
if (!event.venueMarkets.length) {
|
|
@@ -2399,6 +2522,7 @@ var EventMarketPageContent = ({
|
|
|
2399
2522
|
defaultOutcomeId,
|
|
2400
2523
|
eventTradingState,
|
|
2401
2524
|
midpointsResult,
|
|
2525
|
+
recurringMarkets: recurringMarketsPresentation,
|
|
2402
2526
|
classNames: {
|
|
2403
2527
|
root: cn("agg-event-hero", classNames == null ? void 0 : classNames.hero)
|
|
2404
2528
|
}
|
|
@@ -2411,6 +2535,7 @@ var EventMarketPageContent = ({
|
|
|
2411
2535
|
markets: eventTradingState.displayMarkets,
|
|
2412
2536
|
eventTradingState,
|
|
2413
2537
|
live: true,
|
|
2538
|
+
showResolvingState: isRecurringResolvingMarket,
|
|
2414
2539
|
expandSelectedMarketOnChange: !isMobileViewport,
|
|
2415
2540
|
autoExpandFallbackMarket: !isMobileViewport,
|
|
2416
2541
|
autoSelectFallbackMarket: !isMobileViewport,
|
|
@@ -2429,6 +2554,7 @@ var EventMarketPageContent = ({
|
|
|
2429
2554
|
executionMode: resolvedExecutionMode,
|
|
2430
2555
|
isQuotePanelActive: isMobileViewport,
|
|
2431
2556
|
resolvedClaim: effectiveResolvedClaim,
|
|
2557
|
+
showResolvingState: isRecurringResolvingMarket,
|
|
2432
2558
|
midpointsResult,
|
|
2433
2559
|
onBeforePrimaryAction,
|
|
2434
2560
|
className: cn(
|
|
@@ -2457,6 +2583,7 @@ var EventMarketPageContent = ({
|
|
|
2457
2583
|
executionMode: resolvedExecutionMode,
|
|
2458
2584
|
isQuotePanelActive: !isMobileViewport,
|
|
2459
2585
|
resolvedClaim: effectiveResolvedClaim,
|
|
2586
|
+
showResolvingState: isRecurringResolvingMarket,
|
|
2460
2587
|
midpointsResult,
|
|
2461
2588
|
onBeforePrimaryAction,
|
|
2462
2589
|
className: cn(stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.placeOrder, classNames == null ? void 0 : classNames.trade),
|
|
@@ -2627,14 +2754,14 @@ function useScrollRestoration({
|
|
|
2627
2754
|
}
|
|
2628
2755
|
|
|
2629
2756
|
// src/pages/home/use-home-page-modals.ts
|
|
2630
|
-
import { useCallback as
|
|
2757
|
+
import { useCallback as useCallback4, useEffect as useEffect7, useState as useState8 } from "react";
|
|
2631
2758
|
var useHomePageModals = () => {
|
|
2632
2759
|
const [profileOpen, setProfileOpen] = useState8(false);
|
|
2633
2760
|
const [depositOpen, setDepositOpen] = useState8(false);
|
|
2634
2761
|
const [withdrawOpen, setWithdrawOpen] = useState8(false);
|
|
2635
|
-
const onProfileClick =
|
|
2636
|
-
const onDepositClick =
|
|
2637
|
-
const onWithdrawClick =
|
|
2762
|
+
const onProfileClick = useCallback4(() => setProfileOpen(true), []);
|
|
2763
|
+
const onDepositClick = useCallback4(() => setDepositOpen(true), []);
|
|
2764
|
+
const onWithdrawClick = useCallback4(() => setWithdrawOpen(true), []);
|
|
2638
2765
|
useEffect7(() => {
|
|
2639
2766
|
if (typeof window === "undefined") return;
|
|
2640
2767
|
window.addEventListener(DEPOSIT_MODAL_OPEN_EVENT, onDepositClick);
|
|
@@ -2683,7 +2810,7 @@ var HomeSearchResults = ({
|
|
|
2683
2810
|
onEventClick,
|
|
2684
2811
|
onMarketClick
|
|
2685
2812
|
}) => {
|
|
2686
|
-
const labels =
|
|
2813
|
+
const labels = useLabels5();
|
|
2687
2814
|
const { search: searchConfig } = useSdkUiConfig4();
|
|
2688
2815
|
const { disabledVenues } = useAppConfig();
|
|
2689
2816
|
const [activeVenueTabValue, setActiveVenueTabValue] = useState9("all");
|
|
@@ -2885,7 +3012,7 @@ var HomePage = ({
|
|
|
2885
3012
|
stickyOrderPanel
|
|
2886
3013
|
}) => {
|
|
2887
3014
|
var _a, _b, _c, _d;
|
|
2888
|
-
const labels =
|
|
3015
|
+
const labels = useLabels5();
|
|
2889
3016
|
const {
|
|
2890
3017
|
search: {
|
|
2891
3018
|
value: searchValue,
|
|
@@ -2899,7 +3026,7 @@ var HomePage = ({
|
|
|
2899
3026
|
const { capture, consume } = useEventListState();
|
|
2900
3027
|
const [snapshot] = useState9(() => consume());
|
|
2901
3028
|
const eventListStateRef = useRef7(null);
|
|
2902
|
-
const handleSelectEvent =
|
|
3029
|
+
const handleSelectEvent = useCallback5(
|
|
2903
3030
|
(event) => {
|
|
2904
3031
|
var _a2, _b2, _c2, _d2;
|
|
2905
3032
|
capture({
|
|
@@ -3188,36 +3315,17 @@ import {
|
|
|
3188
3315
|
useExecutionOrders,
|
|
3189
3316
|
useExecutionPositions,
|
|
3190
3317
|
useGeoBlock,
|
|
3191
|
-
useLabels as
|
|
3318
|
+
useLabels as useLabels13,
|
|
3192
3319
|
useSdkUiConfig as useSdkUiConfig5,
|
|
3193
3320
|
useUserActivity
|
|
3194
3321
|
} from "@agg-build/hooks";
|
|
3195
3322
|
import { Venue as Venue3 } from "@agg-build/sdk";
|
|
3196
3323
|
import dayjs from "dayjs";
|
|
3197
|
-
import { useCallback as
|
|
3198
|
-
|
|
3199
|
-
// src/pages/user-profile/chain-display.ts
|
|
3200
|
-
var CHAIN_ID_TO_LABEL = {
|
|
3201
|
-
"1": "Ethereum",
|
|
3202
|
-
"10": "Optimism",
|
|
3203
|
-
"56": "BNB Chain",
|
|
3204
|
-
"137": "Polygon",
|
|
3205
|
-
"324": "zkSync Era",
|
|
3206
|
-
"1337": "Hyperliquid",
|
|
3207
|
-
"8453": "Base",
|
|
3208
|
-
"42161": "Arbitrum",
|
|
3209
|
-
"792703809": "Solana"
|
|
3210
|
-
};
|
|
3211
|
-
var formatChainIdLabel = (chainId) => {
|
|
3212
|
-
var _a;
|
|
3213
|
-
if (chainId === null || chainId === void 0) return "";
|
|
3214
|
-
const key = String(chainId).trim();
|
|
3215
|
-
if (!key) return "";
|
|
3216
|
-
return (_a = CHAIN_ID_TO_LABEL[key]) != null ? _a : `Chain ${key}`;
|
|
3217
|
-
};
|
|
3324
|
+
import { useCallback as useCallback7, useEffect as useEffect11, useMemo as useMemo8, useRef as useRef10, useState as useState12 } from "react";
|
|
3218
3325
|
|
|
3219
3326
|
// src/pages/user-profile/components/available-balance-card.tsx
|
|
3220
|
-
import { useLabels as
|
|
3327
|
+
import { useLabels as useLabels6 } from "@agg-build/hooks";
|
|
3328
|
+
import { ACTIVE_VENUES, VENUE_CHAIN_IDS } from "@agg-build/sdk";
|
|
3221
3329
|
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3222
3330
|
var BASE_URL = "https://assets.snagsolutions.io";
|
|
3223
3331
|
var CHAIN_ID_TO_ICON_URL = {
|
|
@@ -3236,16 +3344,8 @@ var CHAIN_ID_TO_ICON_URL = {
|
|
|
3236
3344
|
"2741": `${BASE_URL}/public/prediction-markets/logos/Abstract.svg`,
|
|
3237
3345
|
"792703809": `${BASE_URL}/public/prediction-markets/logos/Solana.svg`
|
|
3238
3346
|
};
|
|
3239
|
-
var
|
|
3240
|
-
|
|
3241
|
-
// Polygon
|
|
3242
|
-
"792703809": ["kalshi"],
|
|
3243
|
-
// Solana
|
|
3244
|
-
"56": ["limitless", "opinion"],
|
|
3245
|
-
// BNB
|
|
3246
|
-
"1337": ["hyperliquid"]
|
|
3247
|
-
// HyperCore
|
|
3248
|
-
};
|
|
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));
|
|
3249
3349
|
var isPaperChain = (row) => {
|
|
3250
3350
|
return row.key === "0" || row.label.trim().toLowerCase() === "paper";
|
|
3251
3351
|
};
|
|
@@ -3275,7 +3375,7 @@ var AvailableBalanceCard = ({
|
|
|
3275
3375
|
onManage,
|
|
3276
3376
|
manageButtonRef
|
|
3277
3377
|
}) => {
|
|
3278
|
-
const labels =
|
|
3378
|
+
const labels = useLabels6();
|
|
3279
3379
|
const balanceLabels = labels.userProfile.balance;
|
|
3280
3380
|
const resolvedLabel = label != null ? label : balanceLabels.availableBalance;
|
|
3281
3381
|
const hasPaperBalance = chains.some(isPaperChain);
|
|
@@ -3316,7 +3416,6 @@ var AvailableBalanceCard = ({
|
|
|
3316
3416
|
content: /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-4 items-start justify-start", children: [
|
|
3317
3417
|
/* @__PURE__ */ jsx8("div", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: balanceLabels.balanceByNetwork }),
|
|
3318
3418
|
/* @__PURE__ */ jsx8("div", { role: "list", className: "agg-balance-list flex flex-col gap-3 w-full", children: chains.map((row) => {
|
|
3319
|
-
var _a;
|
|
3320
3419
|
const iconUrl = chainIconUrl(row.label, row.key);
|
|
3321
3420
|
const isPaper = isPaperChain(row);
|
|
3322
3421
|
const rowLabel = isPaper ? balanceLabels.paperModeNetwork : row.label;
|
|
@@ -3344,7 +3443,7 @@ var AvailableBalanceCard = ({
|
|
|
3344
3443
|
minimumFractionDigits: Number.isInteger(row.balance) ? 0 : 1,
|
|
3345
3444
|
maximumFractionDigits: 2
|
|
3346
3445
|
}) }),
|
|
3347
|
-
/* @__PURE__ */ jsx8("div", { className: "flex w-12 shrink-0 items-center justify-end gap-1", children: (
|
|
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(
|
|
3348
3447
|
VenueLogo,
|
|
3349
3448
|
{
|
|
3350
3449
|
venue,
|
|
@@ -3430,7 +3529,7 @@ var AvailableBalanceCard = ({
|
|
|
3430
3529
|
AvailableBalanceCard.displayName = "AvailableBalanceCard";
|
|
3431
3530
|
|
|
3432
3531
|
// src/pages/user-profile/components/claim-activity-breakdown-modal.tsx
|
|
3433
|
-
import { useLabels as
|
|
3532
|
+
import { useLabels as useLabels7 } from "@agg-build/hooks";
|
|
3434
3533
|
import { Venue } from "@agg-build/sdk";
|
|
3435
3534
|
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3436
3535
|
var CLAIM_VENUE_LABELS = {
|
|
@@ -3441,7 +3540,8 @@ var CLAIM_VENUE_LABELS = {
|
|
|
3441
3540
|
[Venue.predict]: "Predict",
|
|
3442
3541
|
[Venue.probable]: "Probable",
|
|
3443
3542
|
[Venue.myriad]: "Myriad",
|
|
3444
|
-
[Venue.hyperliquid]: "Hyperliquid"
|
|
3543
|
+
[Venue.hyperliquid]: "Hyperliquid",
|
|
3544
|
+
[Venue.novig]: "Novig"
|
|
3445
3545
|
};
|
|
3446
3546
|
var ClaimActivityBreakdownModal = ({
|
|
3447
3547
|
activity,
|
|
@@ -3449,7 +3549,7 @@ var ClaimActivityBreakdownModal = ({
|
|
|
3449
3549
|
onTransactionSelect
|
|
3450
3550
|
}) => {
|
|
3451
3551
|
var _a;
|
|
3452
|
-
const labels =
|
|
3552
|
+
const labels = useLabels7();
|
|
3453
3553
|
return /* @__PURE__ */ jsx9(
|
|
3454
3554
|
Modal,
|
|
3455
3555
|
{
|
|
@@ -3562,24 +3662,29 @@ import {
|
|
|
3562
3662
|
useAggBalance,
|
|
3563
3663
|
useBalanceRefillPolicies,
|
|
3564
3664
|
useDepositAddresses,
|
|
3565
|
-
useLabels as
|
|
3665
|
+
useLabels as useLabels8
|
|
3566
3666
|
} from "@agg-build/hooks";
|
|
3567
|
-
import {
|
|
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";
|
|
3568
3673
|
import * as Dialog2 from "@radix-ui/react-dialog";
|
|
3569
|
-
import { useCallback as
|
|
3674
|
+
import { useCallback as useCallback6, useEffect as useEffect9, useId, useMemo as useMemo6, useRef as useRef8, useState as useState10 } from "react";
|
|
3570
3675
|
import { z } from "zod";
|
|
3571
3676
|
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3572
3677
|
var USDC_DECIMALS = 6;
|
|
3573
3678
|
var EDITABLE_AMOUNT_PATTERN = /^\d*(?:\.\d{0,6})?$/;
|
|
3574
3679
|
var FINAL_AMOUNT_PATTERN = /^\d+(?:\.\d{1,6})?$/;
|
|
3575
|
-
var
|
|
3576
|
-
137:
|
|
3577
|
-
56:
|
|
3578
|
-
792703809:
|
|
3579
|
-
1337:
|
|
3580
|
-
42161:
|
|
3581
|
-
8453:
|
|
3582
|
-
1:
|
|
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
|
|
3583
3688
|
};
|
|
3584
3689
|
var VENUE_LABELS = {
|
|
3585
3690
|
[Venue2.kalshi]: "Kalshi",
|
|
@@ -3589,7 +3694,8 @@ var VENUE_LABELS = {
|
|
|
3589
3694
|
[Venue2.predict]: "Predict",
|
|
3590
3695
|
[Venue2.probable]: "Probable",
|
|
3591
3696
|
[Venue2.myriad]: "Myriad",
|
|
3592
|
-
[Venue2.hyperliquid]: "Hyperliquid"
|
|
3697
|
+
[Venue2.hyperliquid]: "Hyperliquid",
|
|
3698
|
+
[Venue2.novig]: "Novig"
|
|
3593
3699
|
};
|
|
3594
3700
|
var amountSchema = z.string().min(1).regex(FINAL_AMOUNT_PATTERN);
|
|
3595
3701
|
var decimalToRaw = (value, decimals = USDC_DECIMALS) => {
|
|
@@ -3622,11 +3728,11 @@ var areDraftsEqual = (current, initial) => {
|
|
|
3622
3728
|
return currentMinimumRaw !== null && currentRefillToRaw !== null && currentMinimumRaw === initialMinimumRaw && currentRefillToRaw === initialRefillToRaw;
|
|
3623
3729
|
};
|
|
3624
3730
|
var getPolicyMaximumRaw = (policy) => {
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
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
|
+
);
|
|
3630
3736
|
};
|
|
3631
3737
|
var getApiFieldErrors = (error) => {
|
|
3632
3738
|
var _a;
|
|
@@ -3641,7 +3747,7 @@ var ManageBalancesModal = ({
|
|
|
3641
3747
|
open,
|
|
3642
3748
|
onOpenChange
|
|
3643
3749
|
}) => {
|
|
3644
|
-
const labels =
|
|
3750
|
+
const labels = useLabels8();
|
|
3645
3751
|
const refillLabels = labels.balanceRefill;
|
|
3646
3752
|
const balanceState = useAggBalance();
|
|
3647
3753
|
const depositAddressesQuery = useDepositAddresses({ enabled: open });
|
|
@@ -3661,28 +3767,27 @@ var ManageBalancesModal = ({
|
|
|
3661
3767
|
const supportedChains = (_a = depositAddressesQuery.supportedChains) != null ? _a : [];
|
|
3662
3768
|
const availableBalanceBreakdown = (_c = (_b = balanceState.availableBalanceBreakdown) != null ? _b : balanceState.balanceBreakdown) != null ? _c : [];
|
|
3663
3769
|
return supportedChains.flatMap((chain) => {
|
|
3664
|
-
var _a2, _b2;
|
|
3665
3770
|
const usdcToken = chain.tokens.find((token) => token.symbol.toUpperCase() === "USDC");
|
|
3666
3771
|
if (!usdcToken) return [];
|
|
3667
|
-
const presentation = NETWORK_PRESENTATION[chain.chainId];
|
|
3668
3772
|
const chainBalance = availableBalanceBreakdown.find(
|
|
3669
3773
|
(balance) => balance.key === String(chain.chainId)
|
|
3670
3774
|
);
|
|
3671
3775
|
return [
|
|
3672
3776
|
{
|
|
3673
3777
|
chainId: chain.chainId,
|
|
3674
|
-
name:
|
|
3778
|
+
name: chain.name,
|
|
3675
3779
|
balance: chainBalance == null ? void 0 : chainBalance.balance,
|
|
3676
3780
|
policy: policiesQuery.policies.find(
|
|
3677
3781
|
(policy) => policy.targetChainId === chain.chainId && policy.targetTokenSymbol.toUpperCase() === "USDC"
|
|
3678
3782
|
),
|
|
3679
|
-
|
|
3783
|
+
canManageBalance: isVenueBalanceChain(chain.chainId),
|
|
3784
|
+
venues: venueLogosForChain(chain.chainId)
|
|
3680
3785
|
}
|
|
3681
3786
|
];
|
|
3682
3787
|
}).sort((left, right) => {
|
|
3683
|
-
var _a2, _b2
|
|
3684
|
-
const leftOrder = (
|
|
3685
|
-
const rightOrder = (
|
|
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;
|
|
3686
3791
|
if (leftOrder !== rightOrder) return leftOrder - rightOrder;
|
|
3687
3792
|
return left.name.localeCompare(right.name);
|
|
3688
3793
|
});
|
|
@@ -3717,7 +3822,7 @@ var ManageBalancesModal = ({
|
|
|
3717
3822
|
setInitialDrafts(nextDrafts);
|
|
3718
3823
|
setIsInitialized(true);
|
|
3719
3824
|
}, [hasLoadError, isInitialized, isLoading, networks, open]);
|
|
3720
|
-
const validateDraft =
|
|
3825
|
+
const validateDraft = useCallback6(
|
|
3721
3826
|
(network, draft) => {
|
|
3722
3827
|
const errors = {};
|
|
3723
3828
|
const minimum = draft.minimum.trim();
|
|
@@ -3740,14 +3845,12 @@ var ManageBalancesModal = ({
|
|
|
3740
3845
|
errors.refillTo = refillLabels.relationshipError;
|
|
3741
3846
|
}
|
|
3742
3847
|
const maximumRaw = getPolicyMaximumRaw(network.policy);
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
errors.refillTo = refillLabels.maximumError(maximumLabel);
|
|
3750
|
-
}
|
|
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);
|
|
3751
3854
|
}
|
|
3752
3855
|
return errors;
|
|
3753
3856
|
},
|
|
@@ -3755,7 +3858,7 @@ var ManageBalancesModal = ({
|
|
|
3755
3858
|
);
|
|
3756
3859
|
const dirtyNetworks = useMemo6(
|
|
3757
3860
|
() => networks.filter((network) => {
|
|
3758
|
-
if (network.
|
|
3861
|
+
if (!network.canManageBalance) return false;
|
|
3759
3862
|
if (resetChainIds.has(network.chainId)) return true;
|
|
3760
3863
|
const draft = drafts[network.chainId];
|
|
3761
3864
|
const initialDraft = initialDrafts[network.chainId];
|
|
@@ -3780,14 +3883,14 @@ var ManageBalancesModal = ({
|
|
|
3780
3883
|
(errors) => errors.minimum || errors.refillTo || errors.general
|
|
3781
3884
|
);
|
|
3782
3885
|
const isSaveDisabled = dirtyNetworks.length === 0 || hasValidationErrors || isSaving;
|
|
3783
|
-
const handleOpenChange =
|
|
3886
|
+
const handleOpenChange = useCallback6(
|
|
3784
3887
|
(nextOpen) => {
|
|
3785
3888
|
if (isSaving && !nextOpen) return;
|
|
3786
3889
|
onOpenChange(nextOpen);
|
|
3787
3890
|
},
|
|
3788
3891
|
[isSaving, onOpenChange]
|
|
3789
3892
|
);
|
|
3790
|
-
const handleToggleNetwork =
|
|
3893
|
+
const handleToggleNetwork = useCallback6((chainId, canManageBalance) => {
|
|
3791
3894
|
if (!canManageBalance) return;
|
|
3792
3895
|
setExpandedChainIds((current) => {
|
|
3793
3896
|
const next = new Set(current);
|
|
@@ -3796,7 +3899,7 @@ var ManageBalancesModal = ({
|
|
|
3796
3899
|
return next;
|
|
3797
3900
|
});
|
|
3798
3901
|
}, []);
|
|
3799
|
-
const handleDraftChange =
|
|
3902
|
+
const handleDraftChange = useCallback6(
|
|
3800
3903
|
(chainId, field, value) => {
|
|
3801
3904
|
if (!EDITABLE_AMOUNT_PATTERN.test(value)) return;
|
|
3802
3905
|
setDrafts((current) => {
|
|
@@ -3825,7 +3928,7 @@ var ManageBalancesModal = ({
|
|
|
3825
3928
|
},
|
|
3826
3929
|
[]
|
|
3827
3930
|
);
|
|
3828
|
-
const handleResetNetwork =
|
|
3931
|
+
const handleResetNetwork = useCallback6((network) => {
|
|
3829
3932
|
setDrafts((current) => __spreadProps(__spreadValues({}, current), {
|
|
3830
3933
|
[network.chainId]: { minimum: "0", refillTo: "0" }
|
|
3831
3934
|
}));
|
|
@@ -3841,7 +3944,7 @@ var ManageBalancesModal = ({
|
|
|
3841
3944
|
return __spreadProps(__spreadValues({}, current), { [network.chainId]: {} });
|
|
3842
3945
|
});
|
|
3843
3946
|
}, []);
|
|
3844
|
-
const handleAmountBlur =
|
|
3947
|
+
const handleAmountBlur = useCallback6((chainId, field) => {
|
|
3845
3948
|
setDrafts((current) => {
|
|
3846
3949
|
const currentDraft = current[chainId];
|
|
3847
3950
|
if (!currentDraft) return current;
|
|
@@ -3852,12 +3955,12 @@ var ManageBalancesModal = ({
|
|
|
3852
3955
|
});
|
|
3853
3956
|
});
|
|
3854
3957
|
}, []);
|
|
3855
|
-
const handleRetry =
|
|
3958
|
+
const handleRetry = useCallback6(() => {
|
|
3856
3959
|
void depositAddressesQuery.refetch();
|
|
3857
3960
|
void policiesQuery.refetch();
|
|
3858
3961
|
balanceState.refetch();
|
|
3859
3962
|
}, [balanceState, depositAddressesQuery, policiesQuery]);
|
|
3860
|
-
const handleSave =
|
|
3963
|
+
const handleSave = useCallback6(() => __async(null, null, function* () {
|
|
3861
3964
|
if (savingRef.current || isSaveDisabled) return;
|
|
3862
3965
|
savingRef.current = true;
|
|
3863
3966
|
setIsSaving(true);
|
|
@@ -3993,7 +4096,7 @@ var ManageBalancesModal = ({
|
|
|
3993
4096
|
}
|
|
3994
4097
|
) : /* @__PURE__ */ jsx10("div", { className: "flex flex-col", role: "list", children: networks.map((network, networkIndex) => {
|
|
3995
4098
|
var _a, _b, _c, _d, _e;
|
|
3996
|
-
const canManageBalance = network.
|
|
4099
|
+
const canManageBalance = network.canManageBalance;
|
|
3997
4100
|
const isExpanded = canManageBalance && expandedChainIds.has(network.chainId);
|
|
3998
4101
|
const isLastNetwork = networkIndex === networks.length - 1;
|
|
3999
4102
|
const isPendingReset = resetChainIds.has(network.chainId);
|
|
@@ -4269,7 +4372,7 @@ var ManageBalancesModal = ({
|
|
|
4269
4372
|
ManageBalancesModal.displayName = "ManageBalancesModal";
|
|
4270
4373
|
|
|
4271
4374
|
// src/pages/user-profile/components/positions-activity.tsx
|
|
4272
|
-
import { optimizedImageUrl as optimizedImageUrl3, useAggUiConfig as useAggUiConfig2, useLabels as
|
|
4375
|
+
import { optimizedImageUrl as optimizedImageUrl3, useAggUiConfig as useAggUiConfig2, useLabels as useLabels11 } from "@agg-build/hooks";
|
|
4273
4376
|
import { Fragment as Fragment4, useEffect as useEffect10, useMemo as useMemo7, useRef as useRef9, useState as useState11 } from "react";
|
|
4274
4377
|
|
|
4275
4378
|
// src/pages/user-profile/user-profile.constants.ts
|
|
@@ -5060,7 +5163,7 @@ var EmptyState = ({ title, description, className }) => {
|
|
|
5060
5163
|
EmptyState.displayName = "EmptyState";
|
|
5061
5164
|
|
|
5062
5165
|
// src/pages/user-profile/components/open-order-row.tsx
|
|
5063
|
-
import { optimizedImageUrl, useLabels as
|
|
5166
|
+
import { optimizedImageUrl, useLabels as useLabels9 } from "@agg-build/hooks";
|
|
5064
5167
|
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5065
5168
|
var shouldUseNativeLinkNavigation2 = (event) => {
|
|
5066
5169
|
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
|
|
@@ -5073,11 +5176,21 @@ var CANCELLABLE_LIMIT_ORDER_STATUSES = /* @__PURE__ */ new Set([
|
|
|
5073
5176
|
]);
|
|
5074
5177
|
var canCancelOpenOrder = (order) => {
|
|
5075
5178
|
const status = order.status.trim().toLowerCase();
|
|
5076
|
-
if (status === "pending" && !order.dagRunId) return true;
|
|
5077
5179
|
const isLimitOrder = order.orderType === "limit" || order.limitPriceLabel != null;
|
|
5078
5180
|
if (!isLimitOrder) return false;
|
|
5181
|
+
if (status === "pending" && !order.dagRunId) return true;
|
|
5079
5182
|
return CANCELLABLE_LIMIT_ORDER_STATUSES.has(status);
|
|
5080
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
|
+
};
|
|
5081
5194
|
var OpenOrderRow = ({
|
|
5082
5195
|
order,
|
|
5083
5196
|
href,
|
|
@@ -5092,7 +5205,7 @@ var OpenOrderRow = ({
|
|
|
5092
5205
|
expirationHeader
|
|
5093
5206
|
}) => {
|
|
5094
5207
|
var _a, _b, _c, _d;
|
|
5095
|
-
const labels =
|
|
5208
|
+
const labels = useLabels9().userProfile.openOrders;
|
|
5096
5209
|
const resolvedCancelLabel = cancelLabel != null ? cancelLabel : labels.cancel;
|
|
5097
5210
|
const resolvedCancelAriaLabel = cancelAriaLabel != null ? cancelAriaLabel : labels.cancelOrderAria(order.id);
|
|
5098
5211
|
const resolvedLimitPriceHeader = limitPriceHeader != null ? limitPriceHeader : labels.limitPriceHeader;
|
|
@@ -5114,6 +5227,7 @@ var OpenOrderRow = ({
|
|
|
5114
5227
|
onCancel == null ? void 0 : onCancel(order);
|
|
5115
5228
|
};
|
|
5116
5229
|
const canCancel = canCancelOpenOrder(order);
|
|
5230
|
+
const isPending = isPendingOpenOrder(order);
|
|
5117
5231
|
const Wrapper = href ? "a" : "div";
|
|
5118
5232
|
const wrapperProps = href ? {
|
|
5119
5233
|
href,
|
|
@@ -5176,7 +5290,7 @@ var OpenOrderRow = ({
|
|
|
5176
5290
|
{
|
|
5177
5291
|
className: cn(
|
|
5178
5292
|
"shrink-0 justify-end",
|
|
5179
|
-
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]"
|
|
5180
5294
|
),
|
|
5181
5295
|
children: canCancel ? /* @__PURE__ */ jsx13(
|
|
5182
5296
|
Button,
|
|
@@ -5190,7 +5304,10 @@ var OpenOrderRow = ({
|
|
|
5190
5304
|
className: "w-full lg:w-auto !text-agg-error font-agg-bold",
|
|
5191
5305
|
children: resolvedCancelLabel
|
|
5192
5306
|
}
|
|
5193
|
-
) :
|
|
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
|
|
5194
5311
|
}
|
|
5195
5312
|
)
|
|
5196
5313
|
] })
|
|
@@ -5200,7 +5317,7 @@ var OpenOrderRow = ({
|
|
|
5200
5317
|
OpenOrderRow.displayName = "OpenOrderRow";
|
|
5201
5318
|
|
|
5202
5319
|
// src/pages/user-profile/components/position-row.tsx
|
|
5203
|
-
import { optimizedImageUrl as optimizedImageUrl2, useAggUiConfig, useLabels as
|
|
5320
|
+
import { optimizedImageUrl as optimizedImageUrl2, useAggUiConfig, useLabels as useLabels10 } from "@agg-build/hooks";
|
|
5204
5321
|
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5205
5322
|
var shouldUseNativeLinkNavigation3 = (event) => {
|
|
5206
5323
|
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
|
|
@@ -5338,7 +5455,7 @@ var PositionRow = ({
|
|
|
5338
5455
|
onClaim,
|
|
5339
5456
|
isClaiming = false
|
|
5340
5457
|
}) => {
|
|
5341
|
-
const labels =
|
|
5458
|
+
const labels = useLabels10().userProfile.positions;
|
|
5342
5459
|
const { formatCurrency: formatCurrency2, formatPrice } = useAggUiConfig().formatting;
|
|
5343
5460
|
const model = toPositionRowViewModel(
|
|
5344
5461
|
position,
|
|
@@ -5566,7 +5683,7 @@ var PositionsActivity = ({
|
|
|
5566
5683
|
initialPositionFilter = "active",
|
|
5567
5684
|
className
|
|
5568
5685
|
}) => {
|
|
5569
|
-
const userProfileLabels =
|
|
5686
|
+
const userProfileLabels = useLabels11().userProfile;
|
|
5570
5687
|
const positionsLabels = userProfileLabels.positions;
|
|
5571
5688
|
const openOrdersLabels = userProfileLabels.openOrders;
|
|
5572
5689
|
const { formatCurrency: formatCurrency2, formatPrice } = useAggUiConfig2().formatting;
|
|
@@ -6158,7 +6275,7 @@ var buildAggTxExplorerHref = (chainId, txHash) => {
|
|
|
6158
6275
|
};
|
|
6159
6276
|
|
|
6160
6277
|
// src/pages/user-profile/components/user-info-card.tsx
|
|
6161
|
-
import { optimizedImageUrl as optimizedImageUrl4, useLabels as
|
|
6278
|
+
import { optimizedImageUrl as optimizedImageUrl4, useLabels as useLabels12 } from "@agg-build/hooks";
|
|
6162
6279
|
|
|
6163
6280
|
// src/primitives/conditional-wrapper.tsx
|
|
6164
6281
|
var ConditionalWrapper = ({
|
|
@@ -6225,7 +6342,7 @@ var UserInfoCard = ({
|
|
|
6225
6342
|
className
|
|
6226
6343
|
}) => {
|
|
6227
6344
|
var _a;
|
|
6228
|
-
const labels =
|
|
6345
|
+
const labels = useLabels12();
|
|
6229
6346
|
const wallets = (_a = user.connectedWallets) != null ? _a : [];
|
|
6230
6347
|
const hasWallets = wallets.length > 0;
|
|
6231
6348
|
return /* @__PURE__ */ jsxs17(
|
|
@@ -6377,6 +6494,7 @@ var twoDecimalNumberFormatter = new Intl.NumberFormat("en-US", {
|
|
|
6377
6494
|
minimumFractionDigits: 2,
|
|
6378
6495
|
maximumFractionDigits: 2
|
|
6379
6496
|
});
|
|
6497
|
+
var formatShareAmount = (value) => value > 0 && value < 0.01 ? "<0.01" : twoDecimalNumberFormatter.format(value);
|
|
6380
6498
|
var twoDecimalUsdFormatter = new Intl.NumberFormat("en-US", {
|
|
6381
6499
|
style: "currency",
|
|
6382
6500
|
currency: "USD",
|
|
@@ -6599,6 +6717,8 @@ var OPEN_ORDER_QUERY_STATUSES = [
|
|
|
6599
6717
|
var SHOW_SOLD_POSITIONS = false;
|
|
6600
6718
|
var SOLD_POSITION_SHARES_THRESHOLD = 0.1;
|
|
6601
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;
|
|
6602
6722
|
var shouldIncludeByShares = (position) => {
|
|
6603
6723
|
if (SHOW_SOLD_POSITIONS) return true;
|
|
6604
6724
|
if (typeof position.totalShares !== "number") return true;
|
|
@@ -6803,7 +6923,7 @@ function buildVenueShareBreakdown(outcome) {
|
|
|
6803
6923
|
);
|
|
6804
6924
|
return sorted.map((row) => ({
|
|
6805
6925
|
venue: toVenueLogoName(row.venue),
|
|
6806
|
-
sharesLabel: `${
|
|
6926
|
+
sharesLabel: `${formatShareAmount(row.size)} shares`
|
|
6807
6927
|
}));
|
|
6808
6928
|
}
|
|
6809
6929
|
var UserProfilePage = ({
|
|
@@ -6864,7 +6984,7 @@ var UserProfilePage = ({
|
|
|
6864
6984
|
const { user: currentUser, isAuthenticated } = useAggAuthState();
|
|
6865
6985
|
const { isDepositBlocked } = useGeoBlock();
|
|
6866
6986
|
const balanceState = useAggBalance2();
|
|
6867
|
-
const labels =
|
|
6987
|
+
const labels = useLabels13();
|
|
6868
6988
|
const {
|
|
6869
6989
|
features: { showLimitOrders },
|
|
6870
6990
|
trading: { executionMode: configuredExecutionMode }
|
|
@@ -6893,7 +7013,7 @@ var UserProfilePage = ({
|
|
|
6893
7013
|
const manageBalancesButtonRef = useRef10(null);
|
|
6894
7014
|
const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
|
|
6895
7015
|
const queryExecutionMode = resolvedExecutionMode === "paper" ? "paper" : void 0;
|
|
6896
|
-
const handleManageBalancesOpenChange =
|
|
7016
|
+
const handleManageBalancesOpenChange = useCallback7((open) => {
|
|
6897
7017
|
setIsManageBalancesOpen(open);
|
|
6898
7018
|
if (open) return;
|
|
6899
7019
|
requestAnimationFrame(() => {
|
|
@@ -6913,7 +7033,7 @@ var UserProfilePage = ({
|
|
|
6913
7033
|
limit: 25,
|
|
6914
7034
|
mode: queryExecutionMode
|
|
6915
7035
|
});
|
|
6916
|
-
const handlePositionFilterChange =
|
|
7036
|
+
const handlePositionFilterChange = useCallback7(
|
|
6917
7037
|
(filter) => {
|
|
6918
7038
|
setPositionFilter(filter);
|
|
6919
7039
|
onPositionFilterChangeProp == null ? void 0 : onPositionFilterChangeProp(filter);
|
|
@@ -6932,48 +7052,56 @@ var UserProfilePage = ({
|
|
|
6932
7052
|
const pendingOpenOrdersQuery = useExecutionOrders({
|
|
6933
7053
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
6934
7054
|
status: OPEN_ORDER_QUERY_STATUSES[0],
|
|
7055
|
+
orderType: "limit",
|
|
6935
7056
|
limit: 25,
|
|
6936
7057
|
mode: queryExecutionMode
|
|
6937
7058
|
});
|
|
6938
7059
|
const signingOpenOrdersQuery = useExecutionOrders({
|
|
6939
7060
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
6940
7061
|
status: OPEN_ORDER_QUERY_STATUSES[1],
|
|
7062
|
+
orderType: "limit",
|
|
6941
7063
|
limit: 25,
|
|
6942
7064
|
mode: queryExecutionMode
|
|
6943
7065
|
});
|
|
6944
7066
|
const pendingBridgeOpenOrdersQuery = useExecutionOrders({
|
|
6945
7067
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
6946
7068
|
status: OPEN_ORDER_QUERY_STATUSES[2],
|
|
7069
|
+
orderType: "limit",
|
|
6947
7070
|
limit: 25,
|
|
6948
7071
|
mode: queryExecutionMode
|
|
6949
7072
|
});
|
|
6950
7073
|
const submittingOpenOrdersQuery = useExecutionOrders({
|
|
6951
7074
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
6952
7075
|
status: OPEN_ORDER_QUERY_STATUSES[3],
|
|
7076
|
+
orderType: "limit",
|
|
6953
7077
|
limit: 25,
|
|
6954
7078
|
mode: queryExecutionMode
|
|
6955
7079
|
});
|
|
6956
7080
|
const submittedOpenOrdersQuery = useExecutionOrders({
|
|
6957
7081
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
6958
7082
|
status: OPEN_ORDER_QUERY_STATUSES[4],
|
|
7083
|
+
orderType: "limit",
|
|
6959
7084
|
limit: 25,
|
|
6960
7085
|
mode: queryExecutionMode
|
|
6961
7086
|
});
|
|
6962
7087
|
const openOpenOrdersQuery = useExecutionOrders({
|
|
6963
7088
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
6964
7089
|
status: OPEN_ORDER_QUERY_STATUSES[5],
|
|
7090
|
+
orderType: "limit",
|
|
6965
7091
|
limit: 25,
|
|
6966
7092
|
mode: queryExecutionMode
|
|
6967
7093
|
});
|
|
6968
7094
|
const partiallyFilledOpenOrdersQuery = useExecutionOrders({
|
|
6969
7095
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
6970
7096
|
status: OPEN_ORDER_QUERY_STATUSES[6],
|
|
7097
|
+
orderType: "limit",
|
|
6971
7098
|
limit: 25,
|
|
6972
7099
|
mode: queryExecutionMode
|
|
6973
7100
|
});
|
|
6974
7101
|
const cancelPendingOpenOrdersQuery = useExecutionOrders({
|
|
6975
7102
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
6976
7103
|
status: OPEN_ORDER_QUERY_STATUSES[7],
|
|
7104
|
+
orderType: "limit",
|
|
6977
7105
|
limit: 25,
|
|
6978
7106
|
mode: queryExecutionMode
|
|
6979
7107
|
});
|
|
@@ -7003,7 +7131,7 @@ var UserProfilePage = ({
|
|
|
7003
7131
|
enabled: shouldUseHookData && isAuthenticated,
|
|
7004
7132
|
limit: 25
|
|
7005
7133
|
});
|
|
7006
|
-
const handleCancelOrder =
|
|
7134
|
+
const handleCancelOrder = useCallback7(
|
|
7007
7135
|
(order) => __async(null, null, function* () {
|
|
7008
7136
|
if (onCancelOrder) {
|
|
7009
7137
|
onCancelOrder(order);
|
|
@@ -7036,7 +7164,7 @@ var UserProfilePage = ({
|
|
|
7036
7164
|
}),
|
|
7037
7165
|
[cancelOrderMutation, labels.notifications.order, onCancelOrder, toastContext]
|
|
7038
7166
|
);
|
|
7039
|
-
const handleClaimPosition =
|
|
7167
|
+
const handleClaimPosition = useCallback7(
|
|
7040
7168
|
(position) => {
|
|
7041
7169
|
var _a2, _b2;
|
|
7042
7170
|
return startClaim({
|
|
@@ -7047,7 +7175,7 @@ var UserProfilePage = ({
|
|
|
7047
7175
|
},
|
|
7048
7176
|
[startClaim]
|
|
7049
7177
|
);
|
|
7050
|
-
const handleActivityRowClick =
|
|
7178
|
+
const handleActivityRowClick = useCallback7(
|
|
7051
7179
|
(activity) => {
|
|
7052
7180
|
if (activity.kind === "redeem") {
|
|
7053
7181
|
setSelectedClaimActivity(activity);
|
|
@@ -7057,7 +7185,7 @@ var UserProfilePage = ({
|
|
|
7057
7185
|
},
|
|
7058
7186
|
[onActivityClick]
|
|
7059
7187
|
);
|
|
7060
|
-
const handleClaimTransactionSelect =
|
|
7188
|
+
const handleClaimTransactionSelect = useCallback7((transaction) => {
|
|
7061
7189
|
const href = buildAggTxExplorerHref(transaction.chainId, transaction.txHash);
|
|
7062
7190
|
setSelectedClaimActivity(null);
|
|
7063
7191
|
if (!href || typeof window === "undefined") return;
|
|
@@ -7293,18 +7421,20 @@ var UserProfilePage = ({
|
|
|
7293
7421
|
});
|
|
7294
7422
|
}, [activities, activityQuery.activities, isHydrated, labels, ordersQuery.orders]);
|
|
7295
7423
|
const resolvedOpenOrders = useMemo8(() => {
|
|
7296
|
-
if (openOrders) return openOrders;
|
|
7424
|
+
if (openOrders) return openOrders.filter(isUserProfileLimitOrder);
|
|
7297
7425
|
const orderRowsById = /* @__PURE__ */ new Map();
|
|
7298
7426
|
for (const query of openOrderQueries) {
|
|
7299
7427
|
for (const order of query.orders) {
|
|
7300
7428
|
orderRowsById.set(order.id, order);
|
|
7301
7429
|
}
|
|
7302
7430
|
}
|
|
7303
|
-
return Array.from(orderRowsById.values()).filter(
|
|
7431
|
+
return Array.from(orderRowsById.values()).filter(
|
|
7432
|
+
(order) => isOpenOrderStatus(order.status) && isExecutionLimitOrder(order)
|
|
7433
|
+
).sort(
|
|
7304
7434
|
(a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
|
|
7305
7435
|
).map((order) => {
|
|
7306
7436
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
7307
|
-
const isLimitOrder = order
|
|
7437
|
+
const isLimitOrder = isExecutionLimitOrder(order);
|
|
7308
7438
|
const filledRaw = isLimitOrder ? order.filledSizeRaw : order.filledAmountRaw;
|
|
7309
7439
|
const totalRaw = isLimitOrder ? order.limitSizeRaw : order.amountRaw;
|
|
7310
7440
|
const totalCostRaw = isLimitOrder ? (_a2 = order.reservedCostRaw) != null ? _a2 : order.amountRaw : order.amountRaw;
|
|
@@ -7349,14 +7479,14 @@ var UserProfilePage = ({
|
|
|
7349
7479
|
() => openOrderQueries.some((query) => query.isFetchingNextPage),
|
|
7350
7480
|
[openOrderQueries]
|
|
7351
7481
|
);
|
|
7352
|
-
const handleLoadMoreOpenOrders =
|
|
7482
|
+
const handleLoadMoreOpenOrders = useCallback7(() => {
|
|
7353
7483
|
for (const query of openOrderQueries) {
|
|
7354
7484
|
if (query.hasNextPage) {
|
|
7355
7485
|
void query.fetchNextPage();
|
|
7356
7486
|
}
|
|
7357
7487
|
}
|
|
7358
7488
|
}, [openOrderQueries]);
|
|
7359
|
-
const adaptPositionGroups =
|
|
7489
|
+
const adaptPositionGroups = useCallback7(
|
|
7360
7490
|
(groups) => {
|
|
7361
7491
|
return groups.flatMap((group) => {
|
|
7362
7492
|
var _a2, _b2, _c, _d;
|
|
@@ -7610,6 +7740,7 @@ UserProfilePage.displayName = "UserProfilePage";
|
|
|
7610
7740
|
export {
|
|
7611
7741
|
DefaultAvatar,
|
|
7612
7742
|
ConditionalWrapper,
|
|
7743
|
+
formatRecurringCountdown,
|
|
7613
7744
|
EventMarketPage,
|
|
7614
7745
|
useHomePageModals,
|
|
7615
7746
|
HomePage,
|
|
@@ -7618,5 +7749,6 @@ export {
|
|
|
7618
7749
|
USER_PROFILE_TAB_OPEN_ORDERS,
|
|
7619
7750
|
USER_PROFILE_TAB_ACTIVITY,
|
|
7620
7751
|
buildAggTxExplorerHref,
|
|
7752
|
+
formatShareAmount,
|
|
7621
7753
|
UserProfilePage
|
|
7622
7754
|
};
|