@agg-build/ui 1.2.9 → 1.2.11
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/dist/{chunk-PFOSEY46.mjs → chunk-3ZSNHGAB.mjs} +835 -401
- package/dist/{chunk-5PSAIGOT.mjs → chunk-54PCEK6G.mjs} +137 -61
- package/dist/{chunk-7JKGAWU5.mjs → chunk-ENAGASVU.mjs} +1538 -1369
- package/dist/{chunk-K23CJ5UP.mjs → chunk-J7K2U44E.mjs} +481 -258
- package/dist/{chunk-5MDFM2MX.mjs → chunk-NWJHFGBZ.mjs} +1 -1
- package/dist/{chunk-QFW5NDJ6.mjs → chunk-SJLHOAKK.mjs} +1001 -1015
- package/dist/{chunk-PYKD4W4T.mjs → chunk-YP75TIY6.mjs} +601 -326
- package/dist/events.js +2038 -1559
- package/dist/events.mjs +3 -3
- package/dist/index.js +5417 -4261
- package/dist/index.mjs +56 -50
- package/dist/modals.js +3262 -2384
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +3677 -2709
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +992 -918
- package/dist/primitives.mjs +5 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +1360 -1129
- package/dist/trading.mjs +4 -4
- package/dist/types/deposit/deposit-modal.types.d.mts +10 -1
- package/dist/types/deposit/deposit-modal.types.d.ts +10 -1
- package/dist/types/deposit/index.d.mts +1 -1
- package/dist/types/deposit/index.d.ts +1 -1
- package/dist/types/deposit/steps/crypto-transfer.d.mts +1 -2
- package/dist/types/deposit/steps/crypto-transfer.d.ts +1 -2
- package/dist/types/deposit/steps/deposit-method.d.mts +2 -1
- package/dist/types/deposit/steps/deposit-method.d.ts +2 -1
- package/dist/types/events/item/event-list-item.types.d.mts +3 -1
- package/dist/types/events/item/event-list-item.types.d.ts +3 -1
- package/dist/types/events/item/event-list-item.utils.d.mts +26 -2
- package/dist/types/events/item/event-list-item.utils.d.ts +26 -2
- package/dist/types/events/item-details/event-list-item-details.types.d.mts +30 -1
- package/dist/types/events/item-details/event-list-item-details.types.d.ts +30 -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 +27 -2
- package/dist/types/events/market-details/market-details.types.d.ts +27 -2
- package/dist/types/events/market-details/market-details.utils.d.mts +18 -4
- package/dist/types/events/market-details/market-details.utils.d.ts +18 -4
- package/dist/types/events/market-details/orderbook-aggregation.d.mts +38 -2
- package/dist/types/events/market-details/orderbook-aggregation.d.ts +38 -2
- package/dist/types/events/shared/chart-auto-fallback.d.mts +43 -0
- package/dist/types/events/shared/chart-auto-fallback.d.ts +43 -0
- package/dist/types/events/shared/display-outcome-price.d.mts +14 -0
- package/dist/types/events/shared/display-outcome-price.d.ts +14 -0
- package/dist/types/events/shared/display-outcome-venue.d.mts +30 -0
- package/dist/types/events/shared/display-outcome-venue.d.ts +30 -0
- package/dist/types/events/shared/display-reference-price.d.mts +4 -0
- package/dist/types/events/shared/display-reference-price.d.ts +4 -0
- package/dist/types/events/shared/select-outcome-price.d.mts +21 -0
- package/dist/types/events/shared/select-outcome-price.d.ts +21 -0
- package/dist/types/pages/user-profile/components/available-balance-card.d.mts +2 -1
- package/dist/types/pages/user-profile/components/available-balance-card.d.ts +2 -1
- package/dist/types/pages/user-profile/components/positions-value-card.d.mts +2 -1
- package/dist/types/pages/user-profile/components/positions-value-card.d.ts +2 -1
- package/dist/types/pages/user-profile/index.d.mts +2 -2
- package/dist/types/pages/user-profile/index.d.ts +2 -2
- package/dist/types/pages/user-profile/user-profile.types.d.mts +54 -1
- package/dist/types/pages/user-profile/user-profile.types.d.ts +54 -1
- package/dist/types/primitives/chart/chart.utils.d.mts +9 -10
- package/dist/types/primitives/chart/chart.utils.d.ts +9 -10
- package/dist/types/primitives/icon/index.d.mts +2 -1
- package/dist/types/primitives/icon/index.d.ts +2 -1
- package/dist/types/primitives/icon/registry.d.mts +8 -0
- package/dist/types/primitives/icon/registry.d.ts +8 -0
- package/dist/types/primitives/icon/svg/circle-xmark.d.mts +5 -0
- package/dist/types/primitives/icon/svg/circle-xmark.d.ts +5 -0
- package/dist/types/primitives/icon/svg/spinner.d.mts +5 -0
- package/dist/types/primitives/icon/svg/spinner.d.ts +5 -0
- package/dist/types/primitives/toast/index.d.mts +2 -0
- package/dist/types/primitives/toast/index.d.ts +2 -0
- package/dist/types/primitives/tooltip/tooltip.types.d.mts +1 -0
- package/dist/types/primitives/tooltip/tooltip.types.d.ts +1 -0
- package/dist/types/primitives/typography/index.d.mts +1 -1
- package/dist/types/primitives/typography/index.d.ts +1 -1
- package/dist/types/primitives/typography/typography.types.d.mts +2 -0
- package/dist/types/primitives/typography/typography.types.d.ts +2 -0
- package/dist/types/shared/transfer-fee-summary.d.mts +10 -0
- package/dist/types/shared/transfer-fee-summary.d.ts +10 -0
- package/dist/types/shared/utils.d.mts +3 -0
- package/dist/types/shared/utils.d.ts +3 -0
- 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 +9 -0
- package/dist/types/trading/place-order/index.place-order.execution-steps.d.ts +9 -0
- package/dist/types/trading/place-order/index.place-order.types.d.mts +15 -2
- package/dist/types/trading/place-order/index.place-order.types.d.ts +15 -2
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +49 -6
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +49 -6
- package/dist/types/withdraw/index.d.mts +1 -1
- package/dist/types/withdraw/index.d.ts +1 -1
- package/dist/types/withdraw/steps/withdraw-success.d.mts +13 -7
- package/dist/types/withdraw/steps/withdraw-success.d.ts +13 -7
- package/dist/types/withdraw/steps/withdraw-success.utils.d.mts +2 -0
- package/dist/types/withdraw/steps/withdraw-success.utils.d.ts +2 -0
- package/dist/types/withdraw/withdraw-modal.types.d.mts +5 -0
- package/dist/types/withdraw/withdraw-modal.types.d.ts +5 -0
- package/package.json +3 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
+
DEFAULT_EVENTS_LIMIT,
|
|
3
4
|
EventList,
|
|
4
5
|
EventListItem,
|
|
5
6
|
EventListItemDetails,
|
|
@@ -9,18 +10,17 @@ import {
|
|
|
9
10
|
isErrorWithStatus,
|
|
10
11
|
useEventListTabs,
|
|
11
12
|
useEventListTabsHeaderOverflow
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-3ZSNHGAB.mjs";
|
|
13
14
|
import {
|
|
14
15
|
DEPOSIT_MODAL_OPEN_EVENT,
|
|
15
16
|
PlaceOrder,
|
|
16
17
|
SettlementDetails,
|
|
17
18
|
WITHDRAW_MODAL_OPEN_EVENT
|
|
18
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-J7K2U44E.mjs";
|
|
19
20
|
import {
|
|
20
21
|
AggErrorBoundary,
|
|
21
22
|
Button,
|
|
22
23
|
CloseIcon,
|
|
23
|
-
DEFAULT_EVENTS_LIMIT,
|
|
24
24
|
Header,
|
|
25
25
|
Icon,
|
|
26
26
|
LoadingIcon,
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
Search,
|
|
30
30
|
SearchEmptyIcon,
|
|
31
31
|
Skeleton,
|
|
32
|
+
SkeletonBlock,
|
|
32
33
|
StateMessage,
|
|
33
34
|
Tabs,
|
|
34
35
|
Tooltip,
|
|
@@ -44,7 +45,7 @@ import {
|
|
|
44
45
|
filterOpenEvents,
|
|
45
46
|
resolveTabVenus,
|
|
46
47
|
shortenAddress
|
|
47
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-SJLHOAKK.mjs";
|
|
48
49
|
|
|
49
50
|
// src/pages/home/index.tsx
|
|
50
51
|
import {
|
|
@@ -56,18 +57,19 @@ import {
|
|
|
56
57
|
useSearch
|
|
57
58
|
} from "@agg-build/hooks";
|
|
58
59
|
import { VENUES } from "@agg-build/sdk";
|
|
59
|
-
import { useCallback as useCallback2, useEffect as
|
|
60
|
+
import { useCallback as useCallback2, useEffect as useEffect3, useMemo, useRef as useRef3, useState as useState4 } from "react";
|
|
60
61
|
|
|
61
62
|
// src/pages/event-market/index.tsx
|
|
62
63
|
import {
|
|
63
64
|
resolveEventTradingState,
|
|
64
|
-
|
|
65
|
+
TradeSide,
|
|
65
66
|
useEnrichedVenueEvent,
|
|
66
67
|
useEventTradingContext,
|
|
67
|
-
useLabels
|
|
68
|
+
useLabels,
|
|
69
|
+
useMidpoints
|
|
68
70
|
} from "@agg-build/hooks";
|
|
69
71
|
import * as Dialog from "@radix-ui/react-dialog";
|
|
70
|
-
import { useState } from "react";
|
|
72
|
+
import { useEffect, useRef, useState } from "react";
|
|
71
73
|
|
|
72
74
|
// src/pages/event-market/event-market.utils.ts
|
|
73
75
|
var EVENT_MARKET_PAGE_STICKY_HEADER_OFFSET_PX = 48;
|
|
@@ -95,21 +97,21 @@ var resolveEventMarketPageStickyState = ({
|
|
|
95
97
|
if (!isEnabled) {
|
|
96
98
|
return {
|
|
97
99
|
contentClassName: cn(),
|
|
98
|
-
sidebarClassName: cn("
|
|
99
|
-
placeOrder: "",
|
|
100
|
-
mainClassName: cn("
|
|
100
|
+
sidebarClassName: cn("pt-4 sm:pt-6 md:pt-8 pb-10"),
|
|
101
|
+
placeOrder: cn("mb-10"),
|
|
102
|
+
mainClassName: cn("pt-4 sm:pt-6 md:pt-8"),
|
|
101
103
|
style: {}
|
|
102
104
|
};
|
|
103
105
|
}
|
|
104
106
|
return {
|
|
105
107
|
contentClassName: cn("lg:items-stretch!"),
|
|
106
108
|
sidebarClassName: cn(
|
|
107
|
-
"
|
|
109
|
+
"pt-4 sm:pt-6 md:pt-8 pb-10",
|
|
108
110
|
"lg:self-start lg:sticky lg:top-[var(--agg-event-market-sidebar-top)] lg:max-h-[calc(100vh-var(--agg-event-market-sidebar-top))] lg:overflow-y-auto lg:overscroll-contain",
|
|
109
111
|
stickyOrderPanel == null ? void 0 : stickyOrderPanel.className
|
|
110
112
|
),
|
|
111
|
-
placeOrder: "",
|
|
112
|
-
mainClassName: cn("
|
|
113
|
+
placeOrder: cn("mb-10"),
|
|
114
|
+
mainClassName: cn("pt-4 sm:pt-6 md:pt-8"),
|
|
113
115
|
style: {
|
|
114
116
|
[EVENT_MARKET_PAGE_STICKY_TOP_CSS_VAR]: toCssLength(
|
|
115
117
|
stickyOrderPanel == null ? void 0 : stickyOrderPanel.top,
|
|
@@ -125,6 +127,29 @@ var resolveEventMarketPageStickyState = ({
|
|
|
125
127
|
|
|
126
128
|
// src/pages/event-market/index.tsx
|
|
127
129
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
130
|
+
var MOBILE_EVENT_MARKET_MEDIA_QUERY = "(max-width: 1023px)";
|
|
131
|
+
var getIsMobileEventMarketViewport = () => {
|
|
132
|
+
if (typeof window === "undefined") return false;
|
|
133
|
+
if (typeof window.matchMedia !== "function") return false;
|
|
134
|
+
return window.matchMedia(MOBILE_EVENT_MARKET_MEDIA_QUERY).matches;
|
|
135
|
+
};
|
|
136
|
+
var useIsMobileEventMarketViewport = () => {
|
|
137
|
+
const [isMobileViewport, setIsMobileViewport] = useState(getIsMobileEventMarketViewport);
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
if (typeof window === "undefined") return;
|
|
140
|
+
if (typeof window.matchMedia !== "function") return;
|
|
141
|
+
const mediaQueryList = window.matchMedia(MOBILE_EVENT_MARKET_MEDIA_QUERY);
|
|
142
|
+
const handleChange = () => {
|
|
143
|
+
setIsMobileViewport(mediaQueryList.matches);
|
|
144
|
+
};
|
|
145
|
+
handleChange();
|
|
146
|
+
mediaQueryList.addEventListener("change", handleChange);
|
|
147
|
+
return () => {
|
|
148
|
+
mediaQueryList.removeEventListener("change", handleChange);
|
|
149
|
+
};
|
|
150
|
+
}, []);
|
|
151
|
+
return isMobileViewport;
|
|
152
|
+
};
|
|
128
153
|
var resolveDesktopTradePlaceOrderClassNames = (classNames) => {
|
|
129
154
|
const resolvedClassNames = {
|
|
130
155
|
body: classNames == null ? void 0 : classNames.tradeBody,
|
|
@@ -158,28 +183,12 @@ var EventMarketPageMobileTrade = ({
|
|
|
158
183
|
classNames,
|
|
159
184
|
eventTradingState,
|
|
160
185
|
showPlaceOrder = true,
|
|
161
|
-
resolvedClaim,
|
|
162
186
|
isOpen,
|
|
163
|
-
onOpenChange
|
|
187
|
+
onOpenChange,
|
|
188
|
+
midpointsResult
|
|
164
189
|
}) => {
|
|
165
|
-
var _a;
|
|
166
190
|
const labels = useLabels();
|
|
167
|
-
|
|
168
|
-
const selectedMarketState = resolveMarketTradingState((_a = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _a : null);
|
|
169
|
-
if (!showPlaceOrder) {
|
|
170
|
-
return /* @__PURE__ */ jsx(Fragment, {});
|
|
171
|
-
}
|
|
172
|
-
if (eventTradingState.isTradingDisabled || selectedMarketState.isTradingDisabled) {
|
|
173
|
-
return /* @__PURE__ */ jsx("div", { className: "agg-mobile-trade-readonly lg:hidden", children: /* @__PURE__ */ jsx(
|
|
174
|
-
PlaceOrder,
|
|
175
|
-
{
|
|
176
|
-
eventTradingState,
|
|
177
|
-
resolvedClaim,
|
|
178
|
-
className: cn("agg-mobile-trade-panel w-full overflow-hidden", classNames == null ? void 0 : classNames.mobileTrade),
|
|
179
|
-
classNames: resolveMobileTradePlaceOrderClassNames(classNames)
|
|
180
|
-
}
|
|
181
|
-
) });
|
|
182
|
-
}
|
|
191
|
+
if (!showPlaceOrder) return null;
|
|
183
192
|
const handleOpenChange = (nextOpen) => {
|
|
184
193
|
onOpenChange(nextOpen);
|
|
185
194
|
};
|
|
@@ -214,6 +223,7 @@ var EventMarketPageMobileTrade = ({
|
|
|
214
223
|
PlaceOrder,
|
|
215
224
|
{
|
|
216
225
|
eventTradingState,
|
|
226
|
+
midpointsResult,
|
|
217
227
|
className: cn(
|
|
218
228
|
"agg-mobile-trade-panel w-full overflow-hidden rounded-t-agg-2xl sm:rounded-agg-xl",
|
|
219
229
|
classNames == null ? void 0 : classNames.mobileTrade
|
|
@@ -286,7 +296,7 @@ var EventMarketPageLoadingState = ({
|
|
|
286
296
|
"div",
|
|
287
297
|
{
|
|
288
298
|
className: cn(
|
|
289
|
-
"agg-page-main flex min-w-0 flex-1 flex-col gap-6
|
|
299
|
+
"agg-page-main flex min-w-0 flex-1 flex-col gap-6 mb-10",
|
|
290
300
|
stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.mainClassName,
|
|
291
301
|
classNames == null ? void 0 : classNames.main
|
|
292
302
|
),
|
|
@@ -348,6 +358,17 @@ var EventMarketPageContent = ({
|
|
|
348
358
|
stickyOrderPanel
|
|
349
359
|
});
|
|
350
360
|
const [isMobileTradeOpen, setIsMobileTradeOpen] = useState(false);
|
|
361
|
+
const isMobileViewport = useIsMobileEventMarketViewport();
|
|
362
|
+
const tradingContext = useEventTradingContext();
|
|
363
|
+
const midpointsResult = useMidpoints(event.venueMarkets);
|
|
364
|
+
const setTradeSideRef = useRef(tradingContext == null ? void 0 : tradingContext.setTradeSide);
|
|
365
|
+
setTradeSideRef.current = tradingContext == null ? void 0 : tradingContext.setTradeSide;
|
|
366
|
+
useEffect(() => {
|
|
367
|
+
return () => {
|
|
368
|
+
var _a;
|
|
369
|
+
(_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, TradeSide.Buy);
|
|
370
|
+
};
|
|
371
|
+
}, []);
|
|
351
372
|
if (!event || !event.venueMarkets.length) {
|
|
352
373
|
return /* @__PURE__ */ jsx(EventMarketPageUnavailableState, { ariaLabel });
|
|
353
374
|
}
|
|
@@ -376,7 +397,7 @@ var EventMarketPageContent = ({
|
|
|
376
397
|
"div",
|
|
377
398
|
{
|
|
378
399
|
className: cn(
|
|
379
|
-
"agg-page-main flex min-w-0 flex-1 flex-col gap-6
|
|
400
|
+
"agg-page-main flex min-w-0 flex-1 flex-col gap-6 mb-10",
|
|
380
401
|
stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.mainClassName,
|
|
381
402
|
classNames == null ? void 0 : classNames.main
|
|
382
403
|
),
|
|
@@ -388,6 +409,7 @@ var EventMarketPageContent = ({
|
|
|
388
409
|
defaultMarketId,
|
|
389
410
|
defaultOutcomeId,
|
|
390
411
|
eventTradingState,
|
|
412
|
+
midpointsResult,
|
|
391
413
|
classNames: {
|
|
392
414
|
root: cn("agg-event-hero", classNames == null ? void 0 : classNames.hero)
|
|
393
415
|
}
|
|
@@ -400,13 +422,15 @@ var EventMarketPageContent = ({
|
|
|
400
422
|
markets: eventTradingState.displayMarkets,
|
|
401
423
|
eventTradingState,
|
|
402
424
|
live: true,
|
|
425
|
+
expandSelectedMarketOnChange: !isMobileViewport,
|
|
426
|
+
autoExpandFallbackMarket: !isMobileViewport,
|
|
427
|
+
autoSelectFallbackMarket: !isMobileViewport,
|
|
403
428
|
onOutcomeSelect: () => {
|
|
404
|
-
if (
|
|
405
|
-
if (typeof window.matchMedia !== "function") return;
|
|
406
|
-
if (!window.matchMedia("(max-width: 1023px)").matches) return;
|
|
429
|
+
if (!isMobileViewport) return;
|
|
407
430
|
setIsMobileTradeOpen(true);
|
|
408
431
|
},
|
|
409
|
-
classNames: { root: "agg-market-list", item: "agg-market-list-item" }
|
|
432
|
+
classNames: { root: "agg-market-list", item: "agg-market-list-item" },
|
|
433
|
+
midpointsResult
|
|
410
434
|
}
|
|
411
435
|
),
|
|
412
436
|
showPlaceOrder !== false && eventTradingState.isTradingDisabled ? /* @__PURE__ */ jsx("div", { className: "lg:hidden", children: /* @__PURE__ */ jsx(
|
|
@@ -414,6 +438,7 @@ var EventMarketPageContent = ({
|
|
|
414
438
|
{
|
|
415
439
|
eventTradingState,
|
|
416
440
|
resolvedClaim,
|
|
441
|
+
midpointsResult,
|
|
417
442
|
className: cn(
|
|
418
443
|
"agg-mobile-trade-panel w-full overflow-hidden",
|
|
419
444
|
classNames == null ? void 0 : classNames.mobileTrade
|
|
@@ -438,6 +463,7 @@ var EventMarketPageContent = ({
|
|
|
438
463
|
{
|
|
439
464
|
eventTradingState,
|
|
440
465
|
resolvedClaim,
|
|
466
|
+
midpointsResult,
|
|
441
467
|
className: cn(stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.placeOrder, classNames == null ? void 0 : classNames.trade),
|
|
442
468
|
classNames: resolveDesktopTradePlaceOrderClassNames(classNames)
|
|
443
469
|
}
|
|
@@ -453,9 +479,9 @@ var EventMarketPageContent = ({
|
|
|
453
479
|
classNames,
|
|
454
480
|
eventTradingState,
|
|
455
481
|
showPlaceOrder,
|
|
456
|
-
resolvedClaim,
|
|
457
482
|
isOpen: isMobileTradeOpen,
|
|
458
|
-
onOpenChange: setIsMobileTradeOpen
|
|
483
|
+
onOpenChange: setIsMobileTradeOpen,
|
|
484
|
+
midpointsResult
|
|
459
485
|
}
|
|
460
486
|
) : null
|
|
461
487
|
]
|
|
@@ -558,13 +584,13 @@ var resolveInitialTabValue = (tabs, defaultActiveTab) => {
|
|
|
558
584
|
};
|
|
559
585
|
|
|
560
586
|
// src/pages/home/use-scroll-restoration.ts
|
|
561
|
-
import { useLayoutEffect, useRef, useState as useState2 } from "react";
|
|
587
|
+
import { useLayoutEffect, useRef as useRef2, useState as useState2 } from "react";
|
|
562
588
|
function useScrollRestoration({
|
|
563
589
|
enabled,
|
|
564
590
|
scrollY,
|
|
565
591
|
isReady
|
|
566
592
|
}) {
|
|
567
|
-
const restoredRef =
|
|
593
|
+
const restoredRef = useRef2(false);
|
|
568
594
|
const [isRestoring, setIsRestoring] = useState2(enabled && scrollY > 0);
|
|
569
595
|
useLayoutEffect(() => {
|
|
570
596
|
if (!enabled || restoredRef.current) return;
|
|
@@ -579,7 +605,7 @@ function useScrollRestoration({
|
|
|
579
605
|
}
|
|
580
606
|
|
|
581
607
|
// src/pages/home/use-home-page-modals.ts
|
|
582
|
-
import { useCallback, useEffect, useState as useState3 } from "react";
|
|
608
|
+
import { useCallback, useEffect as useEffect2, useState as useState3 } from "react";
|
|
583
609
|
var useHomePageModals = () => {
|
|
584
610
|
const [profileOpen, setProfileOpen] = useState3(false);
|
|
585
611
|
const [depositOpen, setDepositOpen] = useState3(false);
|
|
@@ -587,7 +613,7 @@ var useHomePageModals = () => {
|
|
|
587
613
|
const onProfileClick = useCallback(() => setProfileOpen(true), []);
|
|
588
614
|
const onDepositClick = useCallback(() => setDepositOpen(true), []);
|
|
589
615
|
const onWithdrawClick = useCallback(() => setWithdrawOpen(true), []);
|
|
590
|
-
|
|
616
|
+
useEffect2(() => {
|
|
591
617
|
if (typeof window === "undefined") return;
|
|
592
618
|
window.addEventListener(DEPOSIT_MODAL_OPEN_EVENT, onDepositClick);
|
|
593
619
|
window.addEventListener(WITHDRAW_MODAL_OPEN_EVENT, onWithdrawClick);
|
|
@@ -655,7 +681,13 @@ var HomeSearchResults = ({
|
|
|
655
681
|
q: query,
|
|
656
682
|
type: "events",
|
|
657
683
|
categoryIds: activeTabValue === ALL_CATEGORIES_TAB_VALUE ? void 0 : activeCategoryTab == null ? void 0 : activeCategoryTab.categoryIds,
|
|
658
|
-
limit: SEARCH_RESULTS_LIMIT
|
|
684
|
+
limit: SEARCH_RESULTS_LIMIT,
|
|
685
|
+
// Full-results page — user has committed to this query (clicked "See all"
|
|
686
|
+
// or navigated here from the typeahead). Opt into the Bedrock reranker
|
|
687
|
+
// for higher-quality top results. The typeahead primitive at
|
|
688
|
+
// packages/ui/src/primitives/search/index.tsx stays light intentionally
|
|
689
|
+
// so debounced keystrokes don't pay reranker latency.
|
|
690
|
+
deep: true
|
|
659
691
|
});
|
|
660
692
|
const openEvents = useMemo(() => {
|
|
661
693
|
let filtered = filterOpenEvents(searchResults);
|
|
@@ -664,8 +696,8 @@ var HomeSearchResults = ({
|
|
|
664
696
|
}
|
|
665
697
|
return filtered;
|
|
666
698
|
}, [searchResults, activeVenues]);
|
|
667
|
-
const loadMoreRef =
|
|
668
|
-
|
|
699
|
+
const loadMoreRef = useRef3(null);
|
|
700
|
+
useEffect3(() => {
|
|
669
701
|
if (!hasNextPage) return;
|
|
670
702
|
const target = loadMoreRef.current;
|
|
671
703
|
if (!target) return;
|
|
@@ -817,7 +849,7 @@ var HomePage = ({
|
|
|
817
849
|
} = useSdkUiConfig();
|
|
818
850
|
const { capture, consume } = useEventListState();
|
|
819
851
|
const [snapshot] = useState4(() => consume());
|
|
820
|
-
const eventListStateRef =
|
|
852
|
+
const eventListStateRef = useRef3(null);
|
|
821
853
|
const handleSelectEvent = useCallback2(
|
|
822
854
|
(event) => {
|
|
823
855
|
var _a2, _b2, _c2, _d2;
|
|
@@ -844,7 +876,7 @@ var HomePage = ({
|
|
|
844
876
|
return normalizedSearchValue.length >= MIN_SEARCH_LENGTH ? normalizedSearchValue : "";
|
|
845
877
|
});
|
|
846
878
|
const [isMobileSearchViewport, setIsMobileSearchViewport] = useState4(false);
|
|
847
|
-
|
|
879
|
+
useEffect3(() => {
|
|
848
880
|
if (typeof window === "undefined") return;
|
|
849
881
|
const mediaQueryList = window.matchMedia(MOBILE_HOME_SEARCH_MEDIA_QUERY);
|
|
850
882
|
const handleMediaQueryChange = (event) => {
|
|
@@ -862,7 +894,7 @@ var HomePage = ({
|
|
|
862
894
|
mediaQueryList.removeListener(handleMediaQueryChange);
|
|
863
895
|
};
|
|
864
896
|
}, []);
|
|
865
|
-
|
|
897
|
+
useEffect3(() => {
|
|
866
898
|
if (normalizedSearchValue.length < MIN_SEARCH_LENGTH) {
|
|
867
899
|
setDebouncedSearchValue("");
|
|
868
900
|
return;
|
|
@@ -874,7 +906,7 @@ var HomePage = ({
|
|
|
874
906
|
window.clearTimeout(timeoutId);
|
|
875
907
|
};
|
|
876
908
|
}, [normalizedSearchValue]);
|
|
877
|
-
|
|
909
|
+
useEffect3(() => {
|
|
878
910
|
if (selectedEvent) {
|
|
879
911
|
setStickySelectedEvent(selectedEvent);
|
|
880
912
|
return;
|
|
@@ -903,9 +935,9 @@ var HomePage = ({
|
|
|
903
935
|
}
|
|
904
936
|
return resolveInitialTabValue(resolvedTabs, defaultActiveTab);
|
|
905
937
|
});
|
|
906
|
-
const activeTabValueRef =
|
|
938
|
+
const activeTabValueRef = useRef3(activeTabValue);
|
|
907
939
|
activeTabValueRef.current = activeTabValue;
|
|
908
|
-
|
|
940
|
+
useEffect3(() => {
|
|
909
941
|
setActiveTabValue((currentValue) => {
|
|
910
942
|
const hasCurrentValue = resolvedTabs.some((tab) => tab.value === currentValue);
|
|
911
943
|
if (hasCurrentValue) return currentValue;
|
|
@@ -919,11 +951,13 @@ var HomePage = ({
|
|
|
919
951
|
value: tab.value,
|
|
920
952
|
label: tab.label,
|
|
921
953
|
icon: tab.iconName ? /* @__PURE__ */ jsx2(
|
|
922
|
-
|
|
954
|
+
"span",
|
|
923
955
|
{
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
956
|
+
className: cn(
|
|
957
|
+
"transition-colors duration-300 ease-in-out",
|
|
958
|
+
isActive ? "text-agg-primary" : "text-agg-foreground group-hover/agg-tab:text-agg-muted-foreground"
|
|
959
|
+
),
|
|
960
|
+
children: /* @__PURE__ */ jsx2(Icon, { name: tab.iconName, size: "small", color: "currentColor" })
|
|
927
961
|
}
|
|
928
962
|
) : void 0,
|
|
929
963
|
disabled: tab.disabled
|
|
@@ -1066,6 +1100,7 @@ HomePage.displayName = "HomePage";
|
|
|
1066
1100
|
// src/pages/user-profile/index.tsx
|
|
1067
1101
|
import {
|
|
1068
1102
|
computeClosedPositionTotals,
|
|
1103
|
+
executionKeys,
|
|
1069
1104
|
getWalletAddressFromUserProfile,
|
|
1070
1105
|
useAggAuthState,
|
|
1071
1106
|
useAggBalance,
|
|
@@ -1077,10 +1112,11 @@ import {
|
|
|
1077
1112
|
useLabels as useLabels6,
|
|
1078
1113
|
useQueryClient,
|
|
1079
1114
|
useRedeem,
|
|
1115
|
+
useRedeemLifecycles,
|
|
1080
1116
|
useUserActivity
|
|
1081
1117
|
} from "@agg-build/hooks";
|
|
1082
1118
|
import { Venue } from "@agg-build/sdk";
|
|
1083
|
-
import { useCallback as useCallback3, useEffect as
|
|
1119
|
+
import { useCallback as useCallback3, useEffect as useEffect5, useMemo as useMemo3, useRef as useRef5, useState as useState6 } from "react";
|
|
1084
1120
|
|
|
1085
1121
|
// src/pages/user-profile/chain-display.ts
|
|
1086
1122
|
var CHAIN_ID_TO_LABEL = {
|
|
@@ -1089,6 +1125,7 @@ var CHAIN_ID_TO_LABEL = {
|
|
|
1089
1125
|
"56": "BNB Chain",
|
|
1090
1126
|
"137": "Polygon",
|
|
1091
1127
|
"324": "zkSync Era",
|
|
1128
|
+
"1337": "Hyperliquid",
|
|
1092
1129
|
"8453": "Base",
|
|
1093
1130
|
"42161": "Arbitrum",
|
|
1094
1131
|
"792703809": "Solana"
|
|
@@ -1113,6 +1150,8 @@ var CHAIN_ID_TO_ICON_URL = {
|
|
|
1113
1150
|
"324": `${BASE_URL}/public/web/icons/chains/zksync/colored.svg`,
|
|
1114
1151
|
// zkSync (no new logo)
|
|
1115
1152
|
"747": `${BASE_URL}/public/prediction-markets/logos/Flow.svg`,
|
|
1153
|
+
"1337": `${BASE_URL}/public/prediction-markets/logos/hyperliquid.png`,
|
|
1154
|
+
// HyperCore
|
|
1116
1155
|
"8453": `${BASE_URL}/public/prediction-markets/logos/Base.svg`,
|
|
1117
1156
|
"42161": `${BASE_URL}/public/prediction-markets/logos/Arbitrum.svg`,
|
|
1118
1157
|
"2741": `${BASE_URL}/public/prediction-markets/logos/Abstract.svg`,
|
|
@@ -1123,8 +1162,10 @@ var CHAIN_VENUE_MAP = {
|
|
|
1123
1162
|
// Polygon
|
|
1124
1163
|
"792703809": ["kalshi"],
|
|
1125
1164
|
// Solana
|
|
1126
|
-
"56": ["limitless", "opinion"]
|
|
1165
|
+
"56": ["limitless", "opinion"],
|
|
1127
1166
|
// BNB
|
|
1167
|
+
"1337": ["hyperliquid"]
|
|
1168
|
+
// HyperCore
|
|
1128
1169
|
};
|
|
1129
1170
|
var chainIconUrl = (label, key) => {
|
|
1130
1171
|
if (key && CHAIN_ID_TO_ICON_URL[key]) return CHAIN_ID_TO_ICON_URL[key];
|
|
@@ -1138,6 +1179,7 @@ var chainIconUrl = (label, key) => {
|
|
|
1138
1179
|
if (k.includes("abstract")) return CHAIN_ID_TO_ICON_URL["2741"];
|
|
1139
1180
|
if (k.includes("optimism")) return CHAIN_ID_TO_ICON_URL["10"];
|
|
1140
1181
|
if (k.includes("zksync")) return CHAIN_ID_TO_ICON_URL["324"];
|
|
1182
|
+
if (k.includes("hyperliquid") || k.includes("hypercore")) return CHAIN_ID_TO_ICON_URL["1337"];
|
|
1141
1183
|
if (k.includes("ethereum") || k.includes("eth")) return CHAIN_ID_TO_ICON_URL["1"];
|
|
1142
1184
|
return void 0;
|
|
1143
1185
|
};
|
|
@@ -1145,6 +1187,7 @@ var AvailableBalanceCard = ({
|
|
|
1145
1187
|
label = "Available Balance",
|
|
1146
1188
|
valueLabel,
|
|
1147
1189
|
chains,
|
|
1190
|
+
isLoading = false,
|
|
1148
1191
|
className
|
|
1149
1192
|
}) => {
|
|
1150
1193
|
return /* @__PURE__ */ jsxs3(
|
|
@@ -1179,7 +1222,7 @@ var AvailableBalanceCard = ({
|
|
|
1179
1222
|
/* @__PURE__ */ jsx3("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground", children: label })
|
|
1180
1223
|
] }) }),
|
|
1181
1224
|
/* @__PURE__ */ jsxs3("div", { className: "agg-balance-summary flex items-center justify-between gap-3", children: [
|
|
1182
|
-
/* @__PURE__ */ jsx3("div", { className: "agg-balance-value font-agg-sans text-agg-2xl leading-8 font-agg-bold text-agg-foreground", children: valueLabel }),
|
|
1225
|
+
/* @__PURE__ */ jsx3("div", { className: "agg-balance-value font-agg-sans text-agg-2xl leading-8 font-agg-bold text-agg-foreground", children: isLoading ? /* @__PURE__ */ jsx3("div", { role: "status", "aria-label": "Loading available balance", children: /* @__PURE__ */ jsx3(SkeletonBlock, { className: "h-8 w-24 rounded-agg-sm" }) }) : valueLabel }),
|
|
1183
1226
|
/* @__PURE__ */ jsx3(
|
|
1184
1227
|
Tooltip,
|
|
1185
1228
|
{
|
|
@@ -1274,7 +1317,7 @@ AvailableBalanceCard.displayName = "AvailableBalanceCard";
|
|
|
1274
1317
|
|
|
1275
1318
|
// src/pages/user-profile/components/positions-activity.tsx
|
|
1276
1319
|
import { optimizedImageUrl as optimizedImageUrl2, useLabels as useLabels4 } from "@agg-build/hooks";
|
|
1277
|
-
import { Fragment as Fragment4, useEffect as
|
|
1320
|
+
import { Fragment as Fragment4, useEffect as useEffect4, useMemo as useMemo2, useRef as useRef4, useState as useState5 } from "react";
|
|
1278
1321
|
|
|
1279
1322
|
// src/pages/user-profile/user-profile.constants.ts
|
|
1280
1323
|
var USER_PROFILE_TAB_POSITIONS = "positions";
|
|
@@ -1443,7 +1486,7 @@ var toPositionRowViewModel = (position, labels = defaultLabels) => {
|
|
|
1443
1486
|
title: position.title || missingLabel,
|
|
1444
1487
|
thumbnailSrc: position.thumbnailSrc,
|
|
1445
1488
|
selectedOutcomeLabel: position.outcomeLabel || missingLabel,
|
|
1446
|
-
resolutionLabel: position.outcomeLabel || missingLabel,
|
|
1489
|
+
resolutionLabel: position.resolutionLabel || position.outcomeLabel || missingLabel,
|
|
1447
1490
|
venueShareBreakdown: position.venueShareBreakdown,
|
|
1448
1491
|
totalTraded: {
|
|
1449
1492
|
primaryLabel: formatCurrency(getTotalTradedValue(position)),
|
|
@@ -1467,6 +1510,14 @@ var toPositionRowViewModel = (position, labels = defaultLabels) => {
|
|
|
1467
1510
|
};
|
|
1468
1511
|
};
|
|
1469
1512
|
|
|
1513
|
+
// src/primitives/conditional-wrapper.tsx
|
|
1514
|
+
var ConditionalWrapper = ({
|
|
1515
|
+
condition,
|
|
1516
|
+
wrapper,
|
|
1517
|
+
children
|
|
1518
|
+
}) => condition ? wrapper(children) : children;
|
|
1519
|
+
ConditionalWrapper.displayName = "ConditionalWrapper";
|
|
1520
|
+
|
|
1470
1521
|
// src/pages/user-profile/components/activity-row.tsx
|
|
1471
1522
|
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1472
1523
|
var shouldUseNativeLinkNavigation = (event) => {
|
|
@@ -1496,19 +1547,22 @@ var TRANSFER_ICON = {
|
|
|
1496
1547
|
bridge: "arrows-to-dot",
|
|
1497
1548
|
user_op: "wallet"
|
|
1498
1549
|
};
|
|
1499
|
-
var
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1550
|
+
var TRANSFER_STATUS_VISUAL = {
|
|
1551
|
+
completed: { icon: "badge-check-thin", iconClassName: "text-agg-muted-foreground" },
|
|
1552
|
+
pending: { icon: "spinner", iconClassName: "text-agg-primary", spin: true },
|
|
1553
|
+
failed: { icon: "circle-xmark", iconClassName: "text-agg-error!" },
|
|
1554
|
+
canceled: { icon: "circle-xmark", iconClassName: "text-agg-error!" }
|
|
1555
|
+
};
|
|
1556
|
+
var resolveActivityStatus = (activity) => {
|
|
1557
|
+
if (activity.isFailed || activity.hasError) return "failed";
|
|
1558
|
+
if (activity.status) return activity.status;
|
|
1559
|
+
return "completed";
|
|
1560
|
+
};
|
|
1561
|
+
var resolveToneClasses = (_activity) => {
|
|
1508
1562
|
return {
|
|
1509
|
-
primary: "text-agg-
|
|
1510
|
-
amount: "text-agg-
|
|
1511
|
-
meta: "text-agg-
|
|
1563
|
+
primary: "text-agg-foreground",
|
|
1564
|
+
amount: "text-agg-foreground",
|
|
1565
|
+
meta: "text-agg-foreground"
|
|
1512
1566
|
};
|
|
1513
1567
|
};
|
|
1514
1568
|
var AmountTimeStack = ({
|
|
@@ -1539,7 +1593,7 @@ var AmountTimeStack = ({
|
|
|
1539
1593
|
"p",
|
|
1540
1594
|
{
|
|
1541
1595
|
className: cn(
|
|
1542
|
-
"agg-activity-time font-agg-sans font-agg-normal",
|
|
1596
|
+
"agg-activity-time font-agg-sans font-agg-normal text-agg-muted-foreground",
|
|
1543
1597
|
mobile ? "text-agg-2xs leading-agg-14" : "text-agg-base leading-agg-6",
|
|
1544
1598
|
tone.meta
|
|
1545
1599
|
),
|
|
@@ -1559,7 +1613,8 @@ var TradeTypeCell = ({
|
|
|
1559
1613
|
{
|
|
1560
1614
|
className: cn(
|
|
1561
1615
|
"agg-activity-type w-20 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
|
|
1562
|
-
tone.primary
|
|
1616
|
+
tone.primary,
|
|
1617
|
+
activity.hasError || activity.errorMessage ? "text-agg-error!" : ""
|
|
1563
1618
|
),
|
|
1564
1619
|
children: activity.type
|
|
1565
1620
|
}
|
|
@@ -1574,7 +1629,10 @@ var TransferTypeCell = ({
|
|
|
1574
1629
|
{
|
|
1575
1630
|
name: TRANSFER_ICON[activity.kind],
|
|
1576
1631
|
size: "small",
|
|
1577
|
-
className:
|
|
1632
|
+
className: cn(
|
|
1633
|
+
"shrink-0 text-agg-foreground",
|
|
1634
|
+
activity.hasError || activity.errorMessage ? "text-agg-error!" : ""
|
|
1635
|
+
)
|
|
1578
1636
|
}
|
|
1579
1637
|
),
|
|
1580
1638
|
/* @__PURE__ */ jsx4(
|
|
@@ -1582,7 +1640,8 @@ var TransferTypeCell = ({
|
|
|
1582
1640
|
{
|
|
1583
1641
|
className: cn(
|
|
1584
1642
|
"agg-activity-type w-20 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
|
|
1585
|
-
tone.primary
|
|
1643
|
+
tone.primary,
|
|
1644
|
+
activity.hasError || activity.errorMessage ? "text-agg-error!" : ""
|
|
1586
1645
|
),
|
|
1587
1646
|
children: activity.type
|
|
1588
1647
|
}
|
|
@@ -1620,75 +1679,94 @@ var TradeRow = ({
|
|
|
1620
1679
|
onClick
|
|
1621
1680
|
}) => {
|
|
1622
1681
|
const tone = resolveToneClasses(activity);
|
|
1623
|
-
return /* @__PURE__ */ jsx4(RowWrapper, { className: cn(className), href, onClick, children: /* @__PURE__ */
|
|
1624
|
-
|
|
1682
|
+
return /* @__PURE__ */ jsx4(RowWrapper, { className: cn(className), href, onClick, children: /* @__PURE__ */ jsx4(
|
|
1683
|
+
ConditionalWrapper,
|
|
1625
1684
|
{
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1685
|
+
condition: !!activity.errorMessage,
|
|
1686
|
+
wrapper: (children) => /* @__PURE__ */ jsx4(
|
|
1687
|
+
Tooltip,
|
|
1688
|
+
{
|
|
1689
|
+
size: "medium",
|
|
1690
|
+
content: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-4", children: [
|
|
1691
|
+
/* @__PURE__ */ jsx4(Icon, { name: "info", size: "small", className: "shrink-0 text-agg-error" }),
|
|
1692
|
+
/* @__PURE__ */ jsx4("p", { className: "font-agg-sans text-agg-sm font-agg-normal text-left", children: activity.errorMessage })
|
|
1693
|
+
] }),
|
|
1694
|
+
sideOffset: 4,
|
|
1695
|
+
children
|
|
1696
|
+
}
|
|
1629
1697
|
),
|
|
1630
|
-
children:
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1698
|
+
children: /* @__PURE__ */ jsxs4(
|
|
1699
|
+
"div",
|
|
1700
|
+
{
|
|
1701
|
+
className: cn(
|
|
1702
|
+
"flex w-full flex-col gap-3 text-left transition-colors sm:min-h-16 sm:flex-row sm:items-center",
|
|
1703
|
+
"relative z-10"
|
|
1704
|
+
),
|
|
1705
|
+
children: [
|
|
1706
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex w-full items-center justify-between sm:hidden", children: [
|
|
1707
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
1708
|
+
/* @__PURE__ */ jsx4(VenueLogo, { venue: activity.venue, size: "small", className: "size-5 shrink-0" }),
|
|
1709
|
+
/* @__PURE__ */ jsx4(
|
|
1710
|
+
"p",
|
|
1711
|
+
{
|
|
1712
|
+
className: cn(
|
|
1713
|
+
"agg-activity-type font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
|
|
1714
|
+
tone.primary,
|
|
1715
|
+
activity.hasError || activity.errorMessage ? "text-agg-error!" : ""
|
|
1716
|
+
),
|
|
1717
|
+
children: activity.type
|
|
1718
|
+
}
|
|
1719
|
+
)
|
|
1720
|
+
] }),
|
|
1721
|
+
/* @__PURE__ */ jsx4("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsx4(TradeOutcomeShares, { activity, tone }) })
|
|
1722
|
+
] }),
|
|
1723
|
+
/* @__PURE__ */ jsx4(TradeTypeCell, { activity, tone }),
|
|
1724
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex w-full items-center justify-between sm:contents", children: [
|
|
1725
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
|
|
1726
|
+
/* @__PURE__ */ jsx4("div", { className: "agg-activity-image flex h-10 w-10 shrink-0 items-center justify-center sm:h-15 sm:w-15", children: /* @__PURE__ */ jsx4(
|
|
1727
|
+
RemoteImage,
|
|
1728
|
+
{
|
|
1729
|
+
src: activity.thumbnailSrc,
|
|
1730
|
+
alt: "",
|
|
1731
|
+
className: "h-full w-full rounded-agg-sm object-cover sm:rounded-agg-lg",
|
|
1732
|
+
classNames: { placeholder: "rounded-agg-sm sm:rounded-agg-lg" }
|
|
1733
|
+
}
|
|
1734
|
+
) }),
|
|
1735
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
|
|
1736
|
+
/* @__PURE__ */ jsx4(
|
|
1737
|
+
"p",
|
|
1738
|
+
{
|
|
1739
|
+
className: cn(
|
|
1740
|
+
"agg-activity-market min-w-0 overflow-hidden font-agg-sans text-agg-sm leading-agg-5 font-agg-bold [display:-webkit-box] [-webkit-line-clamp:2] [-webkit-box-orient:vertical] sm:text-agg-base sm:leading-agg-6 sm:whitespace-nowrap sm:text-ellipsis sm:[-webkit-line-clamp:1] sm:[display:block]",
|
|
1741
|
+
tone.primary
|
|
1742
|
+
),
|
|
1743
|
+
children: activity.title
|
|
1744
|
+
}
|
|
1745
|
+
),
|
|
1746
|
+
/* @__PURE__ */ jsx4("div", { className: "hidden flex-wrap items-center gap-2 sm:flex sm:gap-3", children: /* @__PURE__ */ jsx4(TradeOutcomeShares, { activity, tone }) })
|
|
1747
|
+
] })
|
|
1748
|
+
] }),
|
|
1749
|
+
/* @__PURE__ */ jsx4(
|
|
1750
|
+
AmountTimeStack,
|
|
1751
|
+
{
|
|
1752
|
+
amountLabel: activity.amountLabel,
|
|
1753
|
+
timeLabel: activity.timeLabel,
|
|
1754
|
+
tone,
|
|
1755
|
+
mobile: true
|
|
1756
|
+
}
|
|
1757
|
+
)
|
|
1758
|
+
] }),
|
|
1634
1759
|
/* @__PURE__ */ jsx4(
|
|
1635
|
-
|
|
1760
|
+
AmountTimeStack,
|
|
1636
1761
|
{
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
),
|
|
1641
|
-
children: activity.type
|
|
1762
|
+
amountLabel: activity.amountLabel,
|
|
1763
|
+
timeLabel: activity.timeLabel,
|
|
1764
|
+
tone
|
|
1642
1765
|
}
|
|
1643
1766
|
)
|
|
1644
|
-
]
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
/* @__PURE__ */ jsx4(TradeTypeCell, { activity, tone }),
|
|
1648
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex w-full items-center justify-between sm:contents", children: [
|
|
1649
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
|
|
1650
|
-
/* @__PURE__ */ jsx4("div", { className: "agg-activity-image flex h-15 w-15 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsx4(
|
|
1651
|
-
RemoteImage,
|
|
1652
|
-
{
|
|
1653
|
-
src: activity.thumbnailSrc,
|
|
1654
|
-
alt: "",
|
|
1655
|
-
className: "h-full w-full rounded-agg-lg",
|
|
1656
|
-
classNames: { placeholder: "rounded-agg-lg" }
|
|
1657
|
-
}
|
|
1658
|
-
) }),
|
|
1659
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
|
|
1660
|
-
/* @__PURE__ */ jsx4(
|
|
1661
|
-
"p",
|
|
1662
|
-
{
|
|
1663
|
-
className: cn(
|
|
1664
|
-
"agg-activity-market min-w-0 overflow-hidden font-agg-sans text-agg-sm leading-agg-5 font-agg-bold [display:-webkit-box] [-webkit-line-clamp:2] [-webkit-box-orient:vertical] sm:text-agg-base sm:leading-agg-6 sm:whitespace-nowrap sm:text-ellipsis sm:[-webkit-line-clamp:1] sm:[display:block]",
|
|
1665
|
-
tone.primary
|
|
1666
|
-
),
|
|
1667
|
-
children: activity.title
|
|
1668
|
-
}
|
|
1669
|
-
),
|
|
1670
|
-
/* @__PURE__ */ jsx4("div", { className: "hidden flex-wrap items-center gap-2 sm:flex sm:gap-3", children: /* @__PURE__ */ jsx4(TradeOutcomeShares, { activity, tone }) })
|
|
1671
|
-
] })
|
|
1672
|
-
] }),
|
|
1673
|
-
/* @__PURE__ */ jsx4(
|
|
1674
|
-
AmountTimeStack,
|
|
1675
|
-
{
|
|
1676
|
-
amountLabel: activity.amountLabel,
|
|
1677
|
-
timeLabel: activity.timeLabel,
|
|
1678
|
-
tone,
|
|
1679
|
-
mobile: true
|
|
1680
|
-
}
|
|
1681
|
-
)
|
|
1682
|
-
] }),
|
|
1683
|
-
/* @__PURE__ */ jsx4(
|
|
1684
|
-
AmountTimeStack,
|
|
1685
|
-
{
|
|
1686
|
-
amountLabel: activity.amountLabel,
|
|
1687
|
-
timeLabel: activity.timeLabel,
|
|
1688
|
-
tone
|
|
1689
|
-
}
|
|
1690
|
-
)
|
|
1691
|
-
]
|
|
1767
|
+
]
|
|
1768
|
+
}
|
|
1769
|
+
)
|
|
1692
1770
|
}
|
|
1693
1771
|
) });
|
|
1694
1772
|
};
|
|
@@ -1699,73 +1777,118 @@ var TransferRow = ({
|
|
|
1699
1777
|
}) => {
|
|
1700
1778
|
const tone = resolveToneClasses(activity);
|
|
1701
1779
|
const transferIconName = TRANSFER_ICON[activity.kind];
|
|
1702
|
-
|
|
1703
|
-
|
|
1780
|
+
const transferStatus = resolveActivityStatus(activity);
|
|
1781
|
+
const statusVisual = TRANSFER_STATUS_VISUAL[transferStatus];
|
|
1782
|
+
return /* @__PURE__ */ jsx4("button", { type: "button", className, onClick, children: /* @__PURE__ */ jsx4(
|
|
1783
|
+
ConditionalWrapper,
|
|
1704
1784
|
{
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1785
|
+
condition: !!activity.errorMessage,
|
|
1786
|
+
wrapper: (children) => /* @__PURE__ */ jsx4(
|
|
1787
|
+
Tooltip,
|
|
1788
|
+
{
|
|
1789
|
+
size: "medium",
|
|
1790
|
+
content: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-4", children: [
|
|
1791
|
+
/* @__PURE__ */ jsx4(Icon, { name: "info", size: "small", className: "shrink-0 text-agg-error" }),
|
|
1792
|
+
/* @__PURE__ */ jsx4("p", { className: "font-agg-sans text-agg-sm font-agg-normal text-left", children: activity.errorMessage })
|
|
1793
|
+
] }),
|
|
1794
|
+
sideOffset: 4,
|
|
1795
|
+
children
|
|
1796
|
+
}
|
|
1708
1797
|
),
|
|
1709
|
-
children:
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
"
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
),
|
|
1720
|
-
children: activity.type
|
|
1721
|
-
}
|
|
1722
|
-
)
|
|
1723
|
-
] }) }),
|
|
1724
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex w-full items-center justify-between sm:contents", children: [
|
|
1725
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
|
|
1726
|
-
/* @__PURE__ */ jsx4("div", { className: "agg-activity-deposit-square hidden h-15 w-15 shrink-0 items-center justify-center rounded-agg-lg bg-agg-secondary-hover sm:flex", children: /* @__PURE__ */ jsx4(Icon, { name: "badge-check-thin", size: "medium", className: "text-agg-muted-foreground" }) }),
|
|
1727
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-1", children: [
|
|
1798
|
+
children: /* @__PURE__ */ jsxs4(
|
|
1799
|
+
"div",
|
|
1800
|
+
{
|
|
1801
|
+
className: cn(
|
|
1802
|
+
"flex w-full flex-col gap-3 text-left transition-colors sm:min-h-16 sm:flex-row sm:items-center",
|
|
1803
|
+
"relative z-10"
|
|
1804
|
+
),
|
|
1805
|
+
children: [
|
|
1806
|
+
/* @__PURE__ */ jsx4(TransferTypeCell, { activity, tone }),
|
|
1807
|
+
/* @__PURE__ */ jsx4("div", { className: "flex w-full items-center justify-between sm:hidden", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
1728
1808
|
/* @__PURE__ */ jsx4(
|
|
1729
|
-
|
|
1809
|
+
Icon,
|
|
1730
1810
|
{
|
|
1811
|
+
name: transferIconName,
|
|
1812
|
+
size: "small",
|
|
1731
1813
|
className: cn(
|
|
1732
|
-
"
|
|
1733
|
-
|
|
1734
|
-
)
|
|
1735
|
-
children: activity.title
|
|
1814
|
+
"shrink-0 text-agg-foreground",
|
|
1815
|
+
activity.hasError || activity.errorMessage ? "text-agg-error!" : ""
|
|
1816
|
+
)
|
|
1736
1817
|
}
|
|
1737
1818
|
),
|
|
1738
1819
|
/* @__PURE__ */ jsx4(
|
|
1739
1820
|
"p",
|
|
1740
1821
|
{
|
|
1741
1822
|
className: cn(
|
|
1742
|
-
"
|
|
1743
|
-
tone.
|
|
1823
|
+
"font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
|
|
1824
|
+
tone.primary,
|
|
1825
|
+
activity.hasError || activity.errorMessage ? "text-agg-error!" : ""
|
|
1744
1826
|
),
|
|
1745
|
-
children: activity.
|
|
1827
|
+
children: activity.type
|
|
1746
1828
|
}
|
|
1747
1829
|
)
|
|
1748
|
-
] })
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1830
|
+
] }) }),
|
|
1831
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex w-full items-center justify-between sm:contents", children: [
|
|
1832
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
|
|
1833
|
+
/* @__PURE__ */ jsx4(
|
|
1834
|
+
"div",
|
|
1835
|
+
{
|
|
1836
|
+
className: "agg-activity-deposit-square hidden h-15 w-15 shrink-0 items-center justify-center rounded-agg-lg bg-agg-secondary-hover sm:flex",
|
|
1837
|
+
"data-status": transferStatus,
|
|
1838
|
+
children: statusVisual.spin ? /* @__PURE__ */ jsx4(LoadingIcon, { size: "medium", className: cn(statusVisual.iconClassName) }) : /* @__PURE__ */ jsx4(
|
|
1839
|
+
Icon,
|
|
1840
|
+
{
|
|
1841
|
+
name: statusVisual.icon,
|
|
1842
|
+
size: "medium",
|
|
1843
|
+
className: cn(statusVisual.iconClassName)
|
|
1844
|
+
}
|
|
1845
|
+
)
|
|
1846
|
+
}
|
|
1847
|
+
),
|
|
1848
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-1", children: [
|
|
1849
|
+
/* @__PURE__ */ jsx4(
|
|
1850
|
+
"p",
|
|
1851
|
+
{
|
|
1852
|
+
className: cn(
|
|
1853
|
+
"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-bold sm:text-agg-base sm:leading-agg-6",
|
|
1854
|
+
tone.primary
|
|
1855
|
+
),
|
|
1856
|
+
children: activity.title
|
|
1857
|
+
}
|
|
1858
|
+
),
|
|
1859
|
+
/* @__PURE__ */ jsx4(
|
|
1860
|
+
"p",
|
|
1861
|
+
{
|
|
1862
|
+
className: cn(
|
|
1863
|
+
"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
|
|
1864
|
+
tone.meta
|
|
1865
|
+
),
|
|
1866
|
+
children: activity.subtitleLabel
|
|
1867
|
+
}
|
|
1868
|
+
)
|
|
1869
|
+
] })
|
|
1870
|
+
] }),
|
|
1871
|
+
/* @__PURE__ */ jsx4(
|
|
1872
|
+
AmountTimeStack,
|
|
1873
|
+
{
|
|
1874
|
+
amountLabel: activity.amountLabel,
|
|
1875
|
+
timeLabel: activity.timeLabel,
|
|
1876
|
+
tone,
|
|
1877
|
+
mobile: true
|
|
1878
|
+
}
|
|
1879
|
+
)
|
|
1880
|
+
] }),
|
|
1881
|
+
/* @__PURE__ */ jsx4(
|
|
1882
|
+
AmountTimeStack,
|
|
1883
|
+
{
|
|
1884
|
+
amountLabel: activity.amountLabel,
|
|
1885
|
+
timeLabel: activity.timeLabel,
|
|
1886
|
+
tone
|
|
1887
|
+
}
|
|
1888
|
+
)
|
|
1889
|
+
]
|
|
1890
|
+
}
|
|
1891
|
+
)
|
|
1769
1892
|
}
|
|
1770
1893
|
) });
|
|
1771
1894
|
};
|
|
@@ -1820,6 +1943,7 @@ var toneTextClassName = (tone) => {
|
|
|
1820
1943
|
return "text-agg-muted-foreground";
|
|
1821
1944
|
};
|
|
1822
1945
|
var OutcomePill = ({ label }) => /* @__PURE__ */ jsx6("span", { className: "agg-position-outcome max-w-[120px] inline-flex items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ jsx6("span", { className: "whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground truncate", children: label }) });
|
|
1946
|
+
var ResolutionPill = ({ label }) => /* @__PURE__ */ jsx6("span", { className: "agg-position-resolution-pill inline-flex w-full items-center justify-center overflow-hidden rounded-full bg-agg-secondary-hover px-4 py-[6px] md:w-auto", children: /* @__PURE__ */ jsx6("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: label }) });
|
|
1823
1947
|
var VenueShares = ({
|
|
1824
1948
|
model,
|
|
1825
1949
|
className,
|
|
@@ -1891,41 +2015,53 @@ var ResultBadge = ({
|
|
|
1891
2015
|
var TotalTradedCell = ({
|
|
1892
2016
|
model,
|
|
1893
2017
|
className
|
|
1894
|
-
}) => /* @__PURE__ */ jsxs6(
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
]
|
|
2018
|
+
}) => /* @__PURE__ */ jsxs6(
|
|
2019
|
+
"div",
|
|
2020
|
+
{
|
|
2021
|
+
className: cn("agg-position-total-traded flex flex-col gap-[2px] whitespace-nowrap", className),
|
|
2022
|
+
children: [
|
|
2023
|
+
/* @__PURE__ */ jsx6("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: model.totalTraded.primaryLabel }),
|
|
2024
|
+
/* @__PURE__ */ jsx6("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: model.totalTraded.averageLabel })
|
|
2025
|
+
]
|
|
2026
|
+
}
|
|
2027
|
+
);
|
|
1898
2028
|
var PositionValueCell = ({
|
|
1899
2029
|
value,
|
|
1900
2030
|
className
|
|
1901
|
-
}) => /* @__PURE__ */ jsxs6(
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
{
|
|
1907
|
-
className:
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
{
|
|
1920
|
-
className:
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
2031
|
+
}) => /* @__PURE__ */ jsxs6(
|
|
2032
|
+
"div",
|
|
2033
|
+
{
|
|
2034
|
+
className: cn("agg-position-value-cell flex flex-col gap-[2px] whitespace-nowrap", className),
|
|
2035
|
+
children: [
|
|
2036
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-baseline gap-1.5", children: [
|
|
2037
|
+
/* @__PURE__ */ jsx6("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: value.primaryLabel }),
|
|
2038
|
+
/* @__PURE__ */ jsx6(
|
|
2039
|
+
"p",
|
|
2040
|
+
{
|
|
2041
|
+
className: cn(
|
|
2042
|
+
"font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
|
|
2043
|
+
toneTextClassName(value.tone)
|
|
2044
|
+
),
|
|
2045
|
+
children: value.deltaLabel
|
|
2046
|
+
}
|
|
2047
|
+
)
|
|
2048
|
+
] }),
|
|
2049
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-baseline gap-1.5", children: [
|
|
2050
|
+
/* @__PURE__ */ jsx6("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: value.priceLabel }),
|
|
2051
|
+
/* @__PURE__ */ jsx6(
|
|
2052
|
+
"p",
|
|
2053
|
+
{
|
|
2054
|
+
className: cn(
|
|
2055
|
+
"font-agg-sans text-agg-xs leading-agg-4 font-agg-normal",
|
|
2056
|
+
toneTextClassName(value.tone)
|
|
2057
|
+
),
|
|
2058
|
+
children: value.percentLabel
|
|
2059
|
+
}
|
|
2060
|
+
)
|
|
2061
|
+
] })
|
|
2062
|
+
]
|
|
2063
|
+
}
|
|
2064
|
+
);
|
|
1929
2065
|
var PositionRow = ({
|
|
1930
2066
|
position,
|
|
1931
2067
|
variant,
|
|
@@ -2008,38 +2144,9 @@ var PositionRow = ({
|
|
|
2008
2144
|
] })
|
|
2009
2145
|
] })
|
|
2010
2146
|
] }),
|
|
2011
|
-
/* @__PURE__ */
|
|
2012
|
-
/* @__PURE__ */ jsx6("p", { className: "agg-position-value font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground", children: isClosed ? model.payout.primaryLabel : model.currentValue.primaryLabel }),
|
|
2013
|
-
/* @__PURE__ */ jsx6(
|
|
2014
|
-
"p",
|
|
2015
|
-
{
|
|
2016
|
-
className: cn(
|
|
2017
|
-
"agg-position-pnl font-agg-sans text-agg-xs leading-agg-4 font-agg-normal",
|
|
2018
|
-
toneTextClassName(isClosed ? model.payout.tone : model.currentValue.tone)
|
|
2019
|
-
),
|
|
2020
|
-
children: isClosed ? model.payout.deltaLabel : model.currentValue.deltaLabel
|
|
2021
|
-
}
|
|
2022
|
-
)
|
|
2023
|
-
] })
|
|
2024
|
-
] }),
|
|
2025
|
-
/* @__PURE__ */ jsxs6("div", { className: "flex w-full flex-wrap items-center gap-3 md:hidden", children: [
|
|
2026
|
-
/* @__PURE__ */ jsx6(OutcomePill, { label: model.selectedOutcomeLabel }),
|
|
2027
|
-
isClosed ? /* @__PURE__ */ jsx6(ResultBadge, { status: model.positionStatus, labels }) : /* @__PURE__ */ jsx6(StatusBadge, { status: model.positionStatus, labels }),
|
|
2028
|
-
!isClosed && model.canClaim ? /* @__PURE__ */ jsxs6(
|
|
2029
|
-
"button",
|
|
2030
|
-
{
|
|
2031
|
-
type: "button",
|
|
2032
|
-
className: "ml-auto inline-flex h-8 cursor-pointer items-center justify-center gap-1 rounded-agg-full px-2 font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-primary hover:text-agg-primary-hover disabled:cursor-not-allowed disabled:opacity-60",
|
|
2033
|
-
onClick: handleClaim,
|
|
2034
|
-
disabled: isClaiming,
|
|
2035
|
-
"aria-busy": isClaiming || void 0,
|
|
2036
|
-
children: [
|
|
2037
|
-
isClaiming ? /* @__PURE__ */ jsx6(LoadingIcon, { size: "small", className: "text-agg-primary" }) : null,
|
|
2038
|
-
labels.claim
|
|
2039
|
-
]
|
|
2040
|
-
}
|
|
2041
|
-
) : null
|
|
2147
|
+
/* @__PURE__ */ jsx6("div", { className: "flex shrink-0 items-center justify-end md:hidden", children: /* @__PURE__ */ jsx6(OutcomePill, { label: model.selectedOutcomeLabel }) })
|
|
2042
2148
|
] }),
|
|
2149
|
+
isClosed ? /* @__PURE__ */ jsx6("div", { className: "md:hidden", children: /* @__PURE__ */ jsx6(ResolutionPill, { label: `${labels.resolutionHeader}: ${model.resolutionLabel}` }) }) : null,
|
|
2043
2150
|
/* @__PURE__ */ jsx6(
|
|
2044
2151
|
VenueShares,
|
|
2045
2152
|
{
|
|
@@ -2048,18 +2155,59 @@ var PositionRow = ({
|
|
|
2048
2155
|
className: "agg-position-venues flex min-w-0 flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2 md:hidden"
|
|
2049
2156
|
}
|
|
2050
2157
|
),
|
|
2158
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex w-full items-center justify-between gap-3 md:hidden", children: [
|
|
2159
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex min-w-0 items-center gap-5", children: [
|
|
2160
|
+
/* @__PURE__ */ jsx6(TotalTradedCell, { model }),
|
|
2161
|
+
/* @__PURE__ */ jsx6(PositionValueCell, { value: isClosed ? model.payout : model.currentValue })
|
|
2162
|
+
] }),
|
|
2163
|
+
isClosed ? /* @__PURE__ */ jsx6(ResultBadge, { status: model.positionStatus, labels }) : /* @__PURE__ */ jsxs6("div", { className: "flex shrink-0 flex-col items-start justify-center gap-2", children: [
|
|
2164
|
+
/* @__PURE__ */ jsx6(StatusBadge, { status: model.positionStatus, labels }),
|
|
2165
|
+
model.canClaim ? /* @__PURE__ */ jsxs6(
|
|
2166
|
+
"button",
|
|
2167
|
+
{
|
|
2168
|
+
type: "button",
|
|
2169
|
+
className: "inline-flex h-5 cursor-pointer items-center justify-center gap-1 rounded-agg-full font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-primary hover:text-agg-primary-hover disabled:cursor-not-allowed disabled:opacity-60",
|
|
2170
|
+
onClick: handleClaim,
|
|
2171
|
+
disabled: isClaiming,
|
|
2172
|
+
"aria-busy": isClaiming || void 0,
|
|
2173
|
+
children: [
|
|
2174
|
+
isClaiming ? /* @__PURE__ */ jsx6(LoadingIcon, { size: "small", className: "text-agg-primary" }) : null,
|
|
2175
|
+
labels.claim
|
|
2176
|
+
]
|
|
2177
|
+
}
|
|
2178
|
+
) : null
|
|
2179
|
+
] })
|
|
2180
|
+
] }),
|
|
2051
2181
|
isClosed ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
2052
|
-
/* @__PURE__ */ jsx6("div", { className: "hidden w-[
|
|
2053
|
-
/* @__PURE__ */ jsx6(
|
|
2054
|
-
|
|
2182
|
+
/* @__PURE__ */ jsx6("div", { className: "hidden w-[90px] shrink-0 md:block lg:w-[120px]", children: /* @__PURE__ */ jsx6(ResolutionPill, { label: model.resolutionLabel }) }),
|
|
2183
|
+
/* @__PURE__ */ jsx6(
|
|
2184
|
+
TotalTradedCell,
|
|
2185
|
+
{
|
|
2186
|
+
model,
|
|
2187
|
+
className: "hidden w-[110px] shrink-0 md:flex lg:w-[130px]"
|
|
2188
|
+
}
|
|
2189
|
+
),
|
|
2190
|
+
/* @__PURE__ */ jsx6(
|
|
2191
|
+
PositionValueCell,
|
|
2192
|
+
{
|
|
2193
|
+
value: model.payout,
|
|
2194
|
+
className: "hidden w-[130px] shrink-0 md:flex lg:w-[160px]"
|
|
2195
|
+
}
|
|
2196
|
+
),
|
|
2055
2197
|
/* @__PURE__ */ jsx6("div", { className: "hidden w-[60px] shrink-0 items-center md:flex", children: /* @__PURE__ */ jsx6(ResultBadge, { status: model.positionStatus, labels }) })
|
|
2056
2198
|
] }) : /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
2057
|
-
/* @__PURE__ */ jsx6(
|
|
2199
|
+
/* @__PURE__ */ jsx6(
|
|
2200
|
+
TotalTradedCell,
|
|
2201
|
+
{
|
|
2202
|
+
model,
|
|
2203
|
+
className: "hidden w-[120px] shrink-0 md:flex lg:w-[140px]"
|
|
2204
|
+
}
|
|
2205
|
+
),
|
|
2058
2206
|
/* @__PURE__ */ jsx6(
|
|
2059
2207
|
PositionValueCell,
|
|
2060
2208
|
{
|
|
2061
2209
|
value: model.currentValue,
|
|
2062
|
-
className: "hidden w-[
|
|
2210
|
+
className: "hidden w-[130px] shrink-0 md:flex lg:w-[160px]"
|
|
2063
2211
|
}
|
|
2064
2212
|
),
|
|
2065
2213
|
/* @__PURE__ */ jsxs6("div", { className: "hidden w-[100px] shrink-0 items-center gap-3 md:flex", children: [
|
|
@@ -2151,9 +2299,9 @@ var PositionsActivity = ({
|
|
|
2151
2299
|
const [locallyClaimedPositionIds, setLocallyClaimedPositionIds] = useState5(
|
|
2152
2300
|
() => /* @__PURE__ */ new Set()
|
|
2153
2301
|
);
|
|
2154
|
-
const positionsLoadMoreRef =
|
|
2155
|
-
const activitiesLoadMoreRef =
|
|
2156
|
-
const rowsScrollRef =
|
|
2302
|
+
const positionsLoadMoreRef = useRef4(null);
|
|
2303
|
+
const activitiesLoadMoreRef = useRef4(null);
|
|
2304
|
+
const rowsScrollRef = useRef4(null);
|
|
2157
2305
|
const isPositionsTab = activeTab === USER_PROFILE_TAB_POSITIONS;
|
|
2158
2306
|
const isActivityTab = activeTab === USER_PROFILE_TAB_ACTIVITY;
|
|
2159
2307
|
const isClosedPositionsFilter = isPositionsTab && positionFilter === "closed";
|
|
@@ -2213,11 +2361,11 @@ var PositionsActivity = ({
|
|
|
2213
2361
|
const handleSearchChange = (event) => {
|
|
2214
2362
|
setSearchValue(event.target.value);
|
|
2215
2363
|
};
|
|
2216
|
-
|
|
2364
|
+
useEffect4(() => {
|
|
2217
2365
|
if (isPositionsTab) return;
|
|
2218
2366
|
setIsSearchFocused(false);
|
|
2219
2367
|
}, [isPositionsTab]);
|
|
2220
|
-
|
|
2368
|
+
useEffect4(() => {
|
|
2221
2369
|
if (!isPositionsTab || !hasMorePositions) return;
|
|
2222
2370
|
const target = positionsLoadMoreRef.current;
|
|
2223
2371
|
if (!target || !loadMorePositions) return;
|
|
@@ -2239,7 +2387,7 @@ var PositionsActivity = ({
|
|
|
2239
2387
|
isPositionsTab,
|
|
2240
2388
|
loadMorePositions
|
|
2241
2389
|
]);
|
|
2242
|
-
|
|
2390
|
+
useEffect4(() => {
|
|
2243
2391
|
if (!isActivityTab || !hasMoreActivities) return;
|
|
2244
2392
|
const target = activitiesLoadMoreRef.current;
|
|
2245
2393
|
if (!target || !onLoadMoreActivities) return;
|
|
@@ -2292,8 +2440,8 @@ var PositionsActivity = ({
|
|
|
2292
2440
|
isPositionsTab ? "pt-4 md:pt-6" : "pt-0 md:pt-6"
|
|
2293
2441
|
),
|
|
2294
2442
|
children: [
|
|
2295
|
-
isPositionsTab ? /* @__PURE__ */ jsxs7("div", { className: "agg-toolbar flex flex-
|
|
2296
|
-
/* @__PURE__ */ jsx7("div", { className: "agg-position-filters flex h-
|
|
2443
|
+
isPositionsTab ? /* @__PURE__ */ jsxs7("div", { className: "agg-toolbar flex flex-row items-start gap-3 px-4 sm:gap-5 sm:px-6", children: [
|
|
2444
|
+
/* @__PURE__ */ jsx7("div", { className: "agg-position-filters flex h-10 w-[45%] max-w-[169px] shrink-0 items-stretch overflow-clip rounded-agg-sm border border-agg-separator sm:w-auto sm:min-w-[200px] sm:max-w-[270px]", children: USER_PROFILE_POSITION_FILTERS.map((filter, idx) => {
|
|
2297
2445
|
const isActive = filter.value === positionFilter;
|
|
2298
2446
|
return /* @__PURE__ */ jsxs7("div", { className: "flex flex-1 items-stretch", children: [
|
|
2299
2447
|
idx > 0 ? /* @__PURE__ */ jsx7("div", { className: "w-px bg-agg-separator", "aria-hidden": true }) : null,
|
|
@@ -2304,7 +2452,7 @@ var PositionsActivity = ({
|
|
|
2304
2452
|
onClick: () => handlePositionFilterChange(filter.value),
|
|
2305
2453
|
className: cn(
|
|
2306
2454
|
"agg-position-filter-trigger",
|
|
2307
|
-
"flex flex-1 cursor-pointer items-center justify-center px-
|
|
2455
|
+
"flex flex-1 cursor-pointer items-center justify-center px-2 py-3 font-agg-sans text-agg-sm leading-agg-5 sm:px-4 sm:text-agg-base sm:leading-agg-6",
|
|
2308
2456
|
isActive ? "bg-agg-secondary-hover font-agg-bold text-agg-primary" : "bg-agg-secondary font-agg-normal text-agg-foreground hover:bg-agg-secondary-hover"
|
|
2309
2457
|
),
|
|
2310
2458
|
children: filter.value === "active" ? positionsLabels.activeFilter : positionsLabels.closedFilter
|
|
@@ -2427,15 +2575,15 @@ var PositionsActivity = ({
|
|
|
2427
2575
|
/* @__PURE__ */ jsxs7("div", { className: "w-full px-4 sm:px-6", children: [
|
|
2428
2576
|
isPositionsTab && filteredPositions.length > 0 ? isClosedPositionsFilter ? /* @__PURE__ */ jsxs7("div", { className: "hidden items-start gap-8 px-0 md:flex", children: [
|
|
2429
2577
|
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: positionsLabels.marketHeader }),
|
|
2430
|
-
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[
|
|
2431
|
-
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[
|
|
2432
|
-
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[
|
|
2578
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[90px] shrink-0 lg:w-[120px]", children: positionsLabels.resolutionHeader }),
|
|
2579
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[110px] shrink-0 lg:w-[130px]", children: positionsLabels.totalTradedHeader }),
|
|
2580
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[130px] shrink-0 lg:w-[160px]", children: positionsLabels.payoutHeader }),
|
|
2433
2581
|
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[60px] shrink-0", children: positionsLabels.resultHeader }),
|
|
2434
2582
|
/* @__PURE__ */ jsx7("span", { className: "hidden w-5 shrink-0 sm:block", "aria-hidden": true })
|
|
2435
2583
|
] }) : /* @__PURE__ */ jsxs7("div", { className: "hidden items-start gap-6 px-0 md:flex", children: [
|
|
2436
2584
|
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: positionsLabels.marketHeader }),
|
|
2437
|
-
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[
|
|
2438
|
-
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[
|
|
2585
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[120px] shrink-0 lg:w-[140px]", children: positionsLabels.totalTradedHeader }),
|
|
2586
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[130px] shrink-0 lg:w-[160px]", children: positionsLabels.currentValueHeader }),
|
|
2439
2587
|
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[100px] shrink-0", children: positionsLabels.statusHeader }),
|
|
2440
2588
|
/* @__PURE__ */ jsx7("span", { className: "hidden w-5 shrink-0 sm:block", "aria-hidden": true })
|
|
2441
2589
|
] }) : null,
|
|
@@ -2561,6 +2709,7 @@ import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
|
2561
2709
|
var PositionsValueCard = ({
|
|
2562
2710
|
label = "Positions Value",
|
|
2563
2711
|
valueLabel,
|
|
2712
|
+
isLoading = false,
|
|
2564
2713
|
className
|
|
2565
2714
|
}) => {
|
|
2566
2715
|
return /* @__PURE__ */ jsxs8(
|
|
@@ -2592,7 +2741,7 @@ var PositionsValueCard = ({
|
|
|
2592
2741
|
),
|
|
2593
2742
|
/* @__PURE__ */ jsx8("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground", children: label })
|
|
2594
2743
|
] }),
|
|
2595
|
-
/* @__PURE__ */ jsx8("div", { className: "agg-portfolio-value font-agg-sans text-agg-2xl leading-8 font-agg-bold text-agg-foreground", children: valueLabel })
|
|
2744
|
+
/* @__PURE__ */ jsx8("div", { className: "agg-portfolio-value font-agg-sans text-agg-2xl leading-8 font-agg-bold text-agg-foreground", children: isLoading ? /* @__PURE__ */ jsx8("div", { role: "status", "aria-label": "Loading positions value", children: /* @__PURE__ */ jsx8(SkeletonBlock, { className: "h-8 w-24 rounded-agg-sm" }) }) : valueLabel })
|
|
2596
2745
|
]
|
|
2597
2746
|
}
|
|
2598
2747
|
);
|
|
@@ -2602,14 +2751,6 @@ PositionsValueCard.displayName = "PositionsValueCard";
|
|
|
2602
2751
|
// src/pages/user-profile/components/user-info-card.tsx
|
|
2603
2752
|
import { optimizedImageUrl as optimizedImageUrl3, useLabels as useLabels5 } from "@agg-build/hooks";
|
|
2604
2753
|
|
|
2605
|
-
// src/primitives/conditional-wrapper.tsx
|
|
2606
|
-
var ConditionalWrapper = ({
|
|
2607
|
-
condition,
|
|
2608
|
-
wrapper,
|
|
2609
|
-
children
|
|
2610
|
-
}) => condition ? wrapper(children) : children;
|
|
2611
|
-
ConditionalWrapper.displayName = "ConditionalWrapper";
|
|
2612
|
-
|
|
2613
2754
|
// src/pages/user-profile/components/default-avatar.tsx
|
|
2614
2755
|
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2615
2756
|
var DefaultAvatar = ({ className }) => {
|
|
@@ -3007,6 +3148,41 @@ var hasActivityError = (item) => {
|
|
|
3007
3148
|
const errorMessage = getActivityErrorMessage(item);
|
|
3008
3149
|
return item.status.toLowerCase() === "failed" || !!(errorMessage == null ? void 0 : errorMessage.trim());
|
|
3009
3150
|
};
|
|
3151
|
+
var normalizeTradeStatus = (status) => {
|
|
3152
|
+
const normalized = status.toLowerCase();
|
|
3153
|
+
if (isOpenOrderStatus(normalized)) return "pending";
|
|
3154
|
+
if (normalized === "failed" || normalized === "error") return "failed";
|
|
3155
|
+
if (normalized === "canceled" || normalized === "cancelled") return "canceled";
|
|
3156
|
+
return "completed";
|
|
3157
|
+
};
|
|
3158
|
+
var WITHDRAWAL_PENDING_STATUSES = /* @__PURE__ */ new Set(["pending", "bridging", "transferring"]);
|
|
3159
|
+
var WITHDRAWAL_COMPLETED_STATUSES = /* @__PURE__ */ new Set(["completed"]);
|
|
3160
|
+
var TRANSFER_FAILED_STATUSES = /* @__PURE__ */ new Set(["failed", "error"]);
|
|
3161
|
+
var TRANSFER_CANCELED_STATUSES = /* @__PURE__ */ new Set(["canceled", "cancelled"]);
|
|
3162
|
+
var PENDING_TRANSFER_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
3163
|
+
var PENDING_TRANSFER_TIMEOUT_ERROR_MESSAGE = "This transfer took too long to execute.";
|
|
3164
|
+
var isPendingTransferTimedOut = (createdAt) => {
|
|
3165
|
+
const timestamp = createdAt instanceof Date ? createdAt.getTime() : Date.parse(createdAt);
|
|
3166
|
+
if (Number.isNaN(timestamp)) return false;
|
|
3167
|
+
return Date.now() - timestamp >= PENDING_TRANSFER_TIMEOUT_MS;
|
|
3168
|
+
};
|
|
3169
|
+
var normalizeWithdrawalStatus = (status) => {
|
|
3170
|
+
const normalized = status.toLowerCase();
|
|
3171
|
+
if (WITHDRAWAL_PENDING_STATUSES.has(normalized)) return "pending";
|
|
3172
|
+
if (WITHDRAWAL_COMPLETED_STATUSES.has(normalized)) return "completed";
|
|
3173
|
+
if (TRANSFER_FAILED_STATUSES.has(normalized)) return "failed";
|
|
3174
|
+
if (TRANSFER_CANCELED_STATUSES.has(normalized)) return "canceled";
|
|
3175
|
+
return "completed";
|
|
3176
|
+
};
|
|
3177
|
+
var normalizeDepositStatus = (status) => {
|
|
3178
|
+
const normalized = status.toLowerCase();
|
|
3179
|
+
if (normalized === "pending") return "pending";
|
|
3180
|
+
if (normalized === "confirmed" || normalized === "completed") return "completed";
|
|
3181
|
+
if (TRANSFER_FAILED_STATUSES.has(normalized)) return "failed";
|
|
3182
|
+
if (TRANSFER_CANCELED_STATUSES.has(normalized)) return "canceled";
|
|
3183
|
+
return "completed";
|
|
3184
|
+
};
|
|
3185
|
+
var ZERO_AMOUNT_LABEL = "$0";
|
|
3010
3186
|
var isVisibleActivityItem = (item) => {
|
|
3011
3187
|
var _a;
|
|
3012
3188
|
if (item.type === "user_op" || item.type === "bridge") return false;
|
|
@@ -3121,6 +3297,8 @@ var UserProfilePage = ({
|
|
|
3121
3297
|
getPositionHref,
|
|
3122
3298
|
onClaim,
|
|
3123
3299
|
claimingPositionKeys,
|
|
3300
|
+
onClaimResult,
|
|
3301
|
+
onClaimSubmitError,
|
|
3124
3302
|
onActivityClick,
|
|
3125
3303
|
getActivityHref,
|
|
3126
3304
|
onOpenOrderClick,
|
|
@@ -3149,7 +3327,7 @@ var UserProfilePage = ({
|
|
|
3149
3327
|
onError
|
|
3150
3328
|
}) => {
|
|
3151
3329
|
const [isHydrated, setIsHydrated] = useState6(false);
|
|
3152
|
-
|
|
3330
|
+
useEffect5(() => {
|
|
3153
3331
|
setIsHydrated(true);
|
|
3154
3332
|
}, []);
|
|
3155
3333
|
const { user: currentUser, isAuthenticated } = useAggAuthState();
|
|
@@ -3160,7 +3338,21 @@ var UserProfilePage = ({
|
|
|
3160
3338
|
const queryClient = useQueryClient();
|
|
3161
3339
|
const redeemMutation = useRedeem();
|
|
3162
3340
|
const [internalCancellingIds, setInternalCancellingIds] = useState6({});
|
|
3163
|
-
const [
|
|
3341
|
+
const [activeRedeems, setActiveRedeems] = useState6({});
|
|
3342
|
+
const [submittingClaimKeys, setSubmittingClaimKeys] = useState6({});
|
|
3343
|
+
const lifecycleInputs = useMemo3(
|
|
3344
|
+
() => Object.values(activeRedeems),
|
|
3345
|
+
[activeRedeems]
|
|
3346
|
+
);
|
|
3347
|
+
const lifecycleStates = useRedeemLifecycles(lifecycleInputs);
|
|
3348
|
+
const internalClaimingIds = useMemo3(() => {
|
|
3349
|
+
const out = __spreadValues({}, submittingClaimKeys);
|
|
3350
|
+
for (const [claimKey, active] of Object.entries(activeRedeems)) {
|
|
3351
|
+
const state = lifecycleStates[active.redeemId];
|
|
3352
|
+
if (!state || !state.terminal) out[claimKey] = true;
|
|
3353
|
+
}
|
|
3354
|
+
return out;
|
|
3355
|
+
}, [activeRedeems, lifecycleStates, submittingClaimKeys]);
|
|
3164
3356
|
const [profileUser, setProfileUser] = useState6(void 0);
|
|
3165
3357
|
const shouldUseHookData = !user;
|
|
3166
3358
|
const connectedVenues = useMemo3(() => {
|
|
@@ -3187,7 +3379,7 @@ var UserProfilePage = ({
|
|
|
3187
3379
|
},
|
|
3188
3380
|
[onPositionFilterChangeProp]
|
|
3189
3381
|
);
|
|
3190
|
-
|
|
3382
|
+
useEffect5(() => {
|
|
3191
3383
|
setPositionFilter(initialPositionFilter);
|
|
3192
3384
|
}, [initialPositionFilter]);
|
|
3193
3385
|
const ordersQuery = useExecutionOrders({
|
|
@@ -3232,22 +3424,72 @@ var UserProfilePage = ({
|
|
|
3232
3424
|
const venueMarketOutcomeIds = (_a = position.winningOutcomeIds) != null ? _a : [];
|
|
3233
3425
|
if (venueMarketOutcomeIds.length === 0) return;
|
|
3234
3426
|
const claimKey = (_b = position.marketId) != null ? _b : position.id;
|
|
3235
|
-
|
|
3427
|
+
setSubmittingClaimKeys((prev) => __spreadProps(__spreadValues({}, prev), { [claimKey]: true }));
|
|
3236
3428
|
try {
|
|
3237
|
-
yield redeemMutation.mutateAsync({ venueMarketOutcomeIds });
|
|
3429
|
+
const response = yield redeemMutation.mutateAsync({ venueMarketOutcomeIds });
|
|
3430
|
+
const expectedOutcomeIds = [];
|
|
3431
|
+
const preFailedOutcomeIds = [];
|
|
3432
|
+
const preFailedReasons = {};
|
|
3433
|
+
const preConfirmedOutcomeIds = [];
|
|
3434
|
+
const preConfirmedTxHashes = {};
|
|
3435
|
+
for (const result of response.results) {
|
|
3436
|
+
if (result.status === "submitted") {
|
|
3437
|
+
expectedOutcomeIds.push(result.venueMarketOutcomeId);
|
|
3438
|
+
} else if (result.status === "confirmed") {
|
|
3439
|
+
preConfirmedOutcomeIds.push(result.venueMarketOutcomeId);
|
|
3440
|
+
preConfirmedTxHashes[result.venueMarketOutcomeId] = result.txHash;
|
|
3441
|
+
} else if (result.status === "ineligible" || result.status === "rejected") {
|
|
3442
|
+
preFailedOutcomeIds.push(result.venueMarketOutcomeId);
|
|
3443
|
+
preFailedReasons[result.venueMarketOutcomeId] = result.reason;
|
|
3444
|
+
}
|
|
3445
|
+
}
|
|
3446
|
+
setActiveRedeems((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3447
|
+
[claimKey]: {
|
|
3448
|
+
redeemId: response.redeemId,
|
|
3449
|
+
expectedOutcomeIds,
|
|
3450
|
+
preFailedOutcomeIds,
|
|
3451
|
+
preFailedReasons,
|
|
3452
|
+
preConfirmedOutcomeIds,
|
|
3453
|
+
preConfirmedTxHashes
|
|
3454
|
+
}
|
|
3455
|
+
}));
|
|
3238
3456
|
yield queryClient.invalidateQueries({ queryKey: ["current-user"] });
|
|
3239
3457
|
} catch (err) {
|
|
3240
3458
|
console.error("[UserProfilePage] redeem failed", err);
|
|
3459
|
+
onClaimSubmitError == null ? void 0 : onClaimSubmitError(claimKey, err instanceof Error ? err : new Error(String(err)));
|
|
3241
3460
|
} finally {
|
|
3242
|
-
|
|
3461
|
+
setSubmittingClaimKeys((prev) => {
|
|
3243
3462
|
const _a2 = prev, { [claimKey]: _removed } = _a2, rest = __objRest(_a2, [__restKey(claimKey)]);
|
|
3244
3463
|
return rest;
|
|
3245
3464
|
});
|
|
3246
3465
|
}
|
|
3247
3466
|
}),
|
|
3248
|
-
[onClaim, queryClient, redeemMutation]
|
|
3467
|
+
[onClaim, onClaimSubmitError, queryClient, redeemMutation]
|
|
3249
3468
|
);
|
|
3250
|
-
|
|
3469
|
+
const firedTerminalRef = useRef5({});
|
|
3470
|
+
useEffect5(() => {
|
|
3471
|
+
for (const [claimKey, active] of Object.entries(activeRedeems)) {
|
|
3472
|
+
const state = lifecycleStates[active.redeemId];
|
|
3473
|
+
if (!state || !state.terminal) continue;
|
|
3474
|
+
if (firedTerminalRef.current[active.redeemId]) continue;
|
|
3475
|
+
firedTerminalRef.current[active.redeemId] = true;
|
|
3476
|
+
onClaimResult == null ? void 0 : onClaimResult(claimKey, {
|
|
3477
|
+
allConfirmed: state.allConfirmed,
|
|
3478
|
+
anyFailed: state.anyFailed,
|
|
3479
|
+
errorMessage: state.errorMessage
|
|
3480
|
+
});
|
|
3481
|
+
void queryClient.invalidateQueries({ queryKey: executionKeys.positionsPrefix() });
|
|
3482
|
+
void queryClient.invalidateQueries({
|
|
3483
|
+
queryKey: executionKeys.claimableClosedPositionsCount()
|
|
3484
|
+
});
|
|
3485
|
+
delete firedTerminalRef.current[active.redeemId];
|
|
3486
|
+
setActiveRedeems((prev) => {
|
|
3487
|
+
const _a = prev, { [claimKey]: _removed } = _a, rest = __objRest(_a, [__restKey(claimKey)]);
|
|
3488
|
+
return rest;
|
|
3489
|
+
});
|
|
3490
|
+
}
|
|
3491
|
+
}, [activeRedeems, lifecycleStates, onClaimResult, queryClient]);
|
|
3492
|
+
useEffect5(() => {
|
|
3251
3493
|
if (!shouldUseHookData || !isAuthenticated) {
|
|
3252
3494
|
setProfileUser(void 0);
|
|
3253
3495
|
return;
|
|
@@ -3320,18 +3562,21 @@ var UserProfilePage = ({
|
|
|
3320
3562
|
var _a;
|
|
3321
3563
|
return formatUsd((_a = balanceState.totalBalance) != null ? _a : 0);
|
|
3322
3564
|
}, [balanceState.totalBalance]);
|
|
3565
|
+
const isPositionsValueLoading = !(balance == null ? void 0 : balance.totalLabel) && balanceState.isLoading;
|
|
3566
|
+
const isAvailableBalanceLoading = balanceState.isLoading;
|
|
3323
3567
|
const resolvedActivities = useMemo3(() => {
|
|
3324
3568
|
if (activities) return activities.filter(isVisibleUserProfileActivity);
|
|
3325
3569
|
const formatTime = isHydrated ? toRelativeTimeLabel : toAbsoluteTimeLabel;
|
|
3326
3570
|
const fullUser = profileUser != null ? profileUser : currentUser;
|
|
3327
3571
|
const connectedWalletAddresses = getConnectedWalletAccountAddresses(fullUser);
|
|
3328
3572
|
return activityQuery.activities.filter(isVisibleActivityItem).map((item) => {
|
|
3329
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
3573
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
3330
3574
|
const timeLabel = formatTime(item.createdAt);
|
|
3331
3575
|
if (item.type === "trade") {
|
|
3332
3576
|
const tradeItem = item;
|
|
3333
3577
|
const sideLower = item.side.toLowerCase();
|
|
3334
3578
|
const type = sideLower === "sell" ? "Sell" : "Buy";
|
|
3579
|
+
const status = normalizeTradeStatus(item.status);
|
|
3335
3580
|
const isFailed = item.status.toLowerCase() === "failed";
|
|
3336
3581
|
const hasError = hasActivityError(item);
|
|
3337
3582
|
const eventId = (_b = (_a = tradeItem.venueMarket) == null ? void 0 : _a.venueEventId) != null ? _b : void 0;
|
|
@@ -3345,6 +3590,8 @@ var UserProfilePage = ({
|
|
|
3345
3590
|
marketId,
|
|
3346
3591
|
isFailed,
|
|
3347
3592
|
hasError,
|
|
3593
|
+
errorMessage: (_m = item.errorMessage) != null ? _m : void 0,
|
|
3594
|
+
status,
|
|
3348
3595
|
type,
|
|
3349
3596
|
thumbnailSrc: toTradeThumbnailSrc(tradeItem, ordersQuery.orders),
|
|
3350
3597
|
title: marketQuestion,
|
|
@@ -3360,53 +3607,69 @@ var UserProfilePage = ({
|
|
|
3360
3607
|
};
|
|
3361
3608
|
}
|
|
3362
3609
|
if (item.type === "withdrawal") {
|
|
3363
|
-
const
|
|
3364
|
-
const
|
|
3610
|
+
const normalizedStatus = normalizeWithdrawalStatus(item.status);
|
|
3611
|
+
const timedOut = normalizedStatus === "pending" && isPendingTransferTimedOut(item.createdAt);
|
|
3612
|
+
const status = timedOut ? "failed" : normalizedStatus;
|
|
3613
|
+
const errorMessage = timedOut ? PENDING_TRANSFER_TIMEOUT_ERROR_MESSAGE : (_n = item.errorMessage) != null ? _n : void 0;
|
|
3614
|
+
const isFailed = status === "failed";
|
|
3615
|
+
const hasError = timedOut || hasActivityError(item);
|
|
3616
|
+
const titleByStatus = labels.userProfile.activity.withdrawalStatusTitles;
|
|
3617
|
+
const settledWithdrawalAmountRaw = status === "completed" ? (_o = item.completedAmountRaw) != null ? _o : item.amountRaw : item.amountRaw;
|
|
3618
|
+
const amountLabel = status === "failed" || status === "canceled" ? ZERO_AMOUNT_LABEL : toTokenAmountLabel({
|
|
3619
|
+
amountRaw: settledWithdrawalAmountRaw,
|
|
3620
|
+
chainId: item.destinationChainId,
|
|
3621
|
+
tokenSymbol: item.tokenSymbol,
|
|
3622
|
+
sign: "-"
|
|
3623
|
+
});
|
|
3365
3624
|
return {
|
|
3366
3625
|
kind: "withdrawal",
|
|
3367
3626
|
id: item.id,
|
|
3368
3627
|
isFailed,
|
|
3369
3628
|
hasError,
|
|
3629
|
+
errorMessage,
|
|
3630
|
+
status,
|
|
3370
3631
|
type: labels.userProfile.activity.withdrawalType,
|
|
3371
|
-
title:
|
|
3372
|
-
subtitleLabel: `to ${(
|
|
3373
|
-
amountLabel
|
|
3374
|
-
amountRaw: item.amountRaw,
|
|
3375
|
-
chainId: item.destinationChainId,
|
|
3376
|
-
tokenSymbol: item.tokenSymbol,
|
|
3377
|
-
sign: "-"
|
|
3378
|
-
}),
|
|
3632
|
+
title: titleByStatus[status],
|
|
3633
|
+
subtitleLabel: `to ${(_p = shortenAddress(item.destinationAddress)) != null ? _p : item.destinationAddress} \xB7 ${formatChainIdLabel(item.destinationChainId)}`,
|
|
3634
|
+
amountLabel,
|
|
3379
3635
|
timeLabel
|
|
3380
3636
|
};
|
|
3381
3637
|
}
|
|
3382
3638
|
if (item.type === "deposit") {
|
|
3383
|
-
const
|
|
3384
|
-
const
|
|
3639
|
+
const normalizedStatus = normalizeDepositStatus(item.status);
|
|
3640
|
+
const timedOut = normalizedStatus === "pending" && isPendingTransferTimedOut(item.createdAt);
|
|
3641
|
+
const status = timedOut ? "failed" : normalizedStatus;
|
|
3642
|
+
const errorMessage = timedOut ? PENDING_TRANSFER_TIMEOUT_ERROR_MESSAGE : (_q = getActivityErrorMessage(item)) != null ? _q : void 0;
|
|
3643
|
+
const isFailed = status === "failed";
|
|
3644
|
+
const hasError = timedOut || hasActivityError(item);
|
|
3385
3645
|
const depositSource = resolveDepositActivitySource({
|
|
3386
3646
|
fromAddress: item.fromAddress,
|
|
3387
3647
|
chainId: item.chainId,
|
|
3388
3648
|
connectedWalletAddresses,
|
|
3389
3649
|
depositAddress: depositAddressesQuery.getAddress(toNumericChainId(item.chainId))
|
|
3390
3650
|
});
|
|
3391
|
-
const
|
|
3392
|
-
wallet: labels.userProfile.activity.
|
|
3393
|
-
crypto: labels.userProfile.activity.
|
|
3394
|
-
card: labels.userProfile.activity.
|
|
3651
|
+
const depositTitlesBySource = {
|
|
3652
|
+
wallet: labels.userProfile.activity.depositStatusTitles.connectedWallet,
|
|
3653
|
+
crypto: labels.userProfile.activity.depositStatusTitles.externalWallet,
|
|
3654
|
+
card: labels.userProfile.activity.depositStatusTitles.card
|
|
3395
3655
|
};
|
|
3656
|
+
const amountLabel = status === "failed" || status === "canceled" ? ZERO_AMOUNT_LABEL : toTokenAmountLabel({
|
|
3657
|
+
amountRaw: item.amountRaw,
|
|
3658
|
+
chainId: item.chainId,
|
|
3659
|
+
tokenSymbol: item.tokenSymbol,
|
|
3660
|
+
sign: "+"
|
|
3661
|
+
});
|
|
3396
3662
|
return {
|
|
3397
3663
|
kind: "deposit",
|
|
3398
3664
|
id: item.id,
|
|
3399
3665
|
isFailed,
|
|
3400
3666
|
hasError,
|
|
3667
|
+
errorMessage,
|
|
3668
|
+
status,
|
|
3401
3669
|
type: labels.userProfile.activity.depositType,
|
|
3402
|
-
title:
|
|
3403
|
-
subtitleLabel: `from ${(
|
|
3404
|
-
amountLabel
|
|
3405
|
-
amountRaw: item.amountRaw,
|
|
3406
|
-
chainId: item.chainId,
|
|
3407
|
-
tokenSymbol: item.tokenSymbol,
|
|
3408
|
-
sign: "+"
|
|
3409
|
-
}),
|
|
3670
|
+
title: depositTitlesBySource[depositSource][status],
|
|
3671
|
+
subtitleLabel: `from ${(_r = shortenAddress(item.fromAddress)) != null ? _r : item.fromAddress} \xB7 ${formatChainIdLabel(item.chainId)}`,
|
|
3672
|
+
amountLabel,
|
|
3410
3673
|
timeLabel,
|
|
3411
3674
|
depositSource,
|
|
3412
3675
|
chainId: item.chainId
|
|
@@ -3445,13 +3708,17 @@ var UserProfilePage = ({
|
|
|
3445
3708
|
const adaptPositionGroups = useCallback3(
|
|
3446
3709
|
(groups) => {
|
|
3447
3710
|
return groups.flatMap((group) => {
|
|
3448
|
-
var _a, _b;
|
|
3711
|
+
var _a, _b, _c, _d;
|
|
3449
3712
|
const closedTotals = computeClosedPositionTotals(group);
|
|
3450
|
-
const
|
|
3451
|
-
|
|
3713
|
+
const winningOutcome = group.venueMarket.venueMarketOutcomes.find(
|
|
3714
|
+
(outcome) => outcome.winner === true
|
|
3715
|
+
);
|
|
3716
|
+
const winningOutcomeLabel = (_b = (_a = winningOutcome == null ? void 0 : winningOutcome.title) != null ? _a : winningOutcome == null ? void 0 : winningOutcome.label) != null ? _b : null;
|
|
3717
|
+
const venueEventId = (_c = group.venueMarket.venueEventId) != null ? _c : void 0;
|
|
3718
|
+
const eventId = (_d = group.eventId) != null ? _d : venueEventId;
|
|
3452
3719
|
const marketId = group.targetMarketId;
|
|
3453
3720
|
return group.venueMarket.venueMarketOutcomes.map((outcome) => {
|
|
3454
|
-
var _a2, _b2,
|
|
3721
|
+
var _a2, _b2, _c2, _d2;
|
|
3455
3722
|
const isResolved = group.venueMarket.status === "resolved";
|
|
3456
3723
|
const isUnpriced = outcome.priceSource === "entry";
|
|
3457
3724
|
const averagePriceCents = Math.round(outcome.avgEntryPrice * 100);
|
|
@@ -3474,7 +3741,8 @@ var UserProfilePage = ({
|
|
|
3474
3741
|
marketId,
|
|
3475
3742
|
thumbnailSrc: (_b2 = group.venueMarket.image) != null ? _b2 : fallbackThumbnailSrc,
|
|
3476
3743
|
title: group.venueMarket.question,
|
|
3477
|
-
outcomeLabel: ((
|
|
3744
|
+
outcomeLabel: ((_c2 = outcome.title) == null ? void 0 : _c2.trim()) || outcome.label,
|
|
3745
|
+
resolutionLabel: winningOutcomeLabel,
|
|
3478
3746
|
venueShareBreakdown: buildVenueShareBreakdown(outcome),
|
|
3479
3747
|
totalShares: outcome.totalSize,
|
|
3480
3748
|
averageLabel: `${averagePriceCents}\xA2`,
|
|
@@ -3489,7 +3757,7 @@ var UserProfilePage = ({
|
|
|
3489
3757
|
isPnlPositive: displayPnlValue != null && displayPnlValue >= 0,
|
|
3490
3758
|
status: group.status,
|
|
3491
3759
|
marketStatus: group.venueMarket.status,
|
|
3492
|
-
winner: (
|
|
3760
|
+
winner: (_d2 = outcome.winner) != null ? _d2 : null,
|
|
3493
3761
|
resolutionDate: group.resolutionDate,
|
|
3494
3762
|
closedTotalTradedLabel: formatUsd(totalTradedValue),
|
|
3495
3763
|
totalTradedValue,
|
|
@@ -3625,11 +3893,18 @@ var UserProfilePage = ({
|
|
|
3625
3893
|
classNames == null ? void 0 : classNames.rightColumn
|
|
3626
3894
|
),
|
|
3627
3895
|
children: [
|
|
3628
|
-
/* @__PURE__ */ jsx11(
|
|
3896
|
+
/* @__PURE__ */ jsx11(
|
|
3897
|
+
PositionsValueCard,
|
|
3898
|
+
{
|
|
3899
|
+
valueLabel: positionsValueLabel,
|
|
3900
|
+
isLoading: isPositionsValueLoading
|
|
3901
|
+
}
|
|
3902
|
+
),
|
|
3629
3903
|
/* @__PURE__ */ jsx11(
|
|
3630
3904
|
AvailableBalanceCard,
|
|
3631
3905
|
{
|
|
3632
3906
|
valueLabel: availableBalanceLabel,
|
|
3907
|
+
isLoading: isAvailableBalanceLoading,
|
|
3633
3908
|
chains: (balanceChainsOverride != null ? balanceChainsOverride : balanceState.balanceBreakdown).map((b) => ({
|
|
3634
3909
|
key: b.key,
|
|
3635
3910
|
label: b.label,
|