@agg-build/ui 2.4.2 → 2.4.5
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-EOCHFD2U.mjs → chunk-CXSIXL7M.mjs} +38 -36
- package/dist/{chunk-3FLLEJFM.mjs → chunk-GWRFSQQK.mjs} +75 -9
- package/dist/{chunk-MDO3NMXP.mjs → chunk-I4X5UNCT.mjs} +343 -193
- package/dist/{chunk-G5BXCT5Y.mjs → chunk-JVRTJQPZ.mjs} +1 -1
- package/dist/{chunk-GUYFQP7L.mjs → chunk-P5CVJQPW.mjs} +288 -291
- package/dist/{chunk-2ET5CXOU.mjs → chunk-PTNFXXOV.mjs} +53 -21
- package/dist/{chunk-G5Y45GIA.mjs → chunk-UH3DUTMG.mjs} +352 -43
- package/dist/events.js +679 -194
- package/dist/events.mjs +3 -3
- package/dist/index.js +1097 -547
- package/dist/index.mjs +13 -7
- package/dist/modals.js +333 -297
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +809 -262
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +53 -21
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +3265 -2765
- package/dist/trading.mjs +10 -4
- package/dist/types/events/item-details/event-list-item-details.constants.d.mts +1 -1
- package/dist/types/events/item-details/event-list-item-details.constants.d.ts +1 -1
- package/dist/types/events/item-details/settlement-summary.d.mts +3 -1
- package/dist/types/events/item-details/settlement-summary.d.ts +3 -1
- package/dist/types/onboarding/index.d.mts +1 -1
- package/dist/types/onboarding/index.d.ts +1 -1
- package/dist/types/onboarding/steps/connect-accounts.d.mts +1 -1
- package/dist/types/onboarding/steps/connect-accounts.d.ts +1 -1
- package/dist/types/primitives/icon/icon.constants.d.mts +1 -0
- package/dist/types/primitives/icon/icon.constants.d.ts +1 -0
- package/dist/types/shared/use-horizontal-scroll-state.d.mts +3 -0
- package/dist/types/shared/use-horizontal-scroll-state.d.ts +3 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +1 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +1 -0
- package/dist/types/trading/settlement/index.d.mts +19 -1
- package/dist/types/trading/settlement/index.d.ts +19 -1
- package/package.json +2 -2
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
formatProbabilityCents,
|
|
6
6
|
formatProbabilityPercent,
|
|
7
7
|
getDisplayOutcomePrice,
|
|
8
|
-
|
|
8
|
+
prepareSettlementDifferences,
|
|
9
|
+
resolveDifferenceIconClassName,
|
|
9
10
|
resolveHeaderOutcomeItems,
|
|
10
11
|
resolveInitialEventDetailsChartRange,
|
|
11
12
|
resolveInitialOutcomeLabel,
|
|
@@ -23,7 +24,7 @@ import {
|
|
|
23
24
|
resolveUnifiedOrderBookEntries,
|
|
24
25
|
sortOutcomeSelectorOutcomes,
|
|
25
26
|
useEventTradingContext
|
|
26
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-UH3DUTMG.mjs";
|
|
27
28
|
import {
|
|
28
29
|
AutocompleteSelect,
|
|
29
30
|
Badge,
|
|
@@ -75,7 +76,7 @@ import {
|
|
|
75
76
|
sortCategoriesForNavigation,
|
|
76
77
|
sortOutcomes,
|
|
77
78
|
splitEventsByLifecycle
|
|
78
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-PTNFXXOV.mjs";
|
|
79
80
|
|
|
80
81
|
// src/events/item/index.tsx
|
|
81
82
|
import {
|
|
@@ -88,7 +89,7 @@ import {
|
|
|
88
89
|
useVenueMarketMidpoints,
|
|
89
90
|
useVenueMarkets
|
|
90
91
|
} from "@agg-build/hooks";
|
|
91
|
-
import { useCallback, useMemo, useState } from "react";
|
|
92
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
92
93
|
|
|
93
94
|
// src/shared/query-error.ts
|
|
94
95
|
var getErrorStatus = (error) => {
|
|
@@ -307,8 +308,85 @@ var EventListItemNotFoundState = ({
|
|
|
307
308
|
);
|
|
308
309
|
};
|
|
309
310
|
var OUTCOMES_SCROLL_LOAD_THRESHOLD_PX = 16;
|
|
311
|
+
var OUTCOMES_SCROLL_STATE_EPSILON_PX = 1;
|
|
312
|
+
var OUTCOMES_SCROLL_MASK_HEIGHT_PX = 24;
|
|
310
313
|
var MARKET_ID_QUERY_PARAM = "marketId";
|
|
311
314
|
var OUTCOME_ID_QUERY_PARAM = "outcomeId";
|
|
315
|
+
var OUTCOME_ROW_SELECTOR = ".agg-outcome-row";
|
|
316
|
+
var DEFAULT_OUTCOMES_SCROLL_STATE = {
|
|
317
|
+
hasOverflow: false,
|
|
318
|
+
isAtTop: true,
|
|
319
|
+
isAtBottom: true,
|
|
320
|
+
remainingMarkets: 0
|
|
321
|
+
};
|
|
322
|
+
var areOutcomesScrollStatesEqual = (left, right) => {
|
|
323
|
+
return left.hasOverflow === right.hasOverflow && left.isAtTop === right.isAtTop && left.isAtBottom === right.isAtBottom && left.remainingMarkets === right.remainingMarkets;
|
|
324
|
+
};
|
|
325
|
+
var useOutcomesScrollState = ({
|
|
326
|
+
totalMarketCount,
|
|
327
|
+
onReachScrollThreshold
|
|
328
|
+
}) => {
|
|
329
|
+
const containerRef = useRef(null);
|
|
330
|
+
const frameRef = useRef(null);
|
|
331
|
+
const scrollStateRef = useRef(DEFAULT_OUTCOMES_SCROLL_STATE);
|
|
332
|
+
const [scrollState, setScrollState] = useState(
|
|
333
|
+
DEFAULT_OUTCOMES_SCROLL_STATE
|
|
334
|
+
);
|
|
335
|
+
const measureScrollState = useCallback(() => {
|
|
336
|
+
frameRef.current = null;
|
|
337
|
+
const element = containerRef.current;
|
|
338
|
+
if (!element) return;
|
|
339
|
+
const { clientHeight, scrollHeight, scrollTop } = element;
|
|
340
|
+
const hasOverflow = scrollHeight > clientHeight + OUTCOMES_SCROLL_STATE_EPSILON_PX;
|
|
341
|
+
const isAtTop = scrollTop <= OUTCOMES_SCROLL_STATE_EPSILON_PX;
|
|
342
|
+
const isAtBottom = !hasOverflow || scrollTop + clientHeight >= scrollHeight - OUTCOMES_SCROLL_STATE_EPSILON_PX;
|
|
343
|
+
const loadedRows = Array.from(element.querySelectorAll(OUTCOME_ROW_SELECTOR));
|
|
344
|
+
const visibleMarketCount = loadedRows.reduce((count, row) => {
|
|
345
|
+
return count + (row.offsetTop < clientHeight - OUTCOMES_SCROLL_STATE_EPSILON_PX ? 1 : 0);
|
|
346
|
+
}, 0);
|
|
347
|
+
const remainingMarkets = hasOverflow ? Math.max(0, totalMarketCount - visibleMarketCount) : 0;
|
|
348
|
+
const nextScrollState = {
|
|
349
|
+
hasOverflow,
|
|
350
|
+
isAtTop,
|
|
351
|
+
isAtBottom,
|
|
352
|
+
remainingMarkets
|
|
353
|
+
};
|
|
354
|
+
if (!areOutcomesScrollStatesEqual(scrollStateRef.current, nextScrollState)) {
|
|
355
|
+
scrollStateRef.current = nextScrollState;
|
|
356
|
+
setScrollState(nextScrollState);
|
|
357
|
+
}
|
|
358
|
+
const distanceToBottom = scrollHeight - scrollTop - clientHeight;
|
|
359
|
+
if (distanceToBottom <= OUTCOMES_SCROLL_LOAD_THRESHOLD_PX) {
|
|
360
|
+
onReachScrollThreshold == null ? void 0 : onReachScrollThreshold();
|
|
361
|
+
}
|
|
362
|
+
}, [onReachScrollThreshold, totalMarketCount]);
|
|
363
|
+
const updateScrollState = useCallback(() => {
|
|
364
|
+
if (frameRef.current != null) return;
|
|
365
|
+
frameRef.current = window.requestAnimationFrame(measureScrollState);
|
|
366
|
+
}, [measureScrollState]);
|
|
367
|
+
useEffect(() => {
|
|
368
|
+
const element = containerRef.current;
|
|
369
|
+
if (!element) return;
|
|
370
|
+
element.addEventListener("scroll", updateScrollState, { passive: true });
|
|
371
|
+
let resizeObserver = null;
|
|
372
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
373
|
+
resizeObserver = new ResizeObserver(() => {
|
|
374
|
+
updateScrollState();
|
|
375
|
+
});
|
|
376
|
+
resizeObserver.observe(element);
|
|
377
|
+
}
|
|
378
|
+
updateScrollState();
|
|
379
|
+
return () => {
|
|
380
|
+
element.removeEventListener("scroll", updateScrollState);
|
|
381
|
+
resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
|
382
|
+
if (frameRef.current != null) {
|
|
383
|
+
window.cancelAnimationFrame(frameRef.current);
|
|
384
|
+
frameRef.current = null;
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
}, [updateScrollState]);
|
|
388
|
+
return { containerRef, scrollState, updateScrollState };
|
|
389
|
+
};
|
|
312
390
|
var buildOutcomeMidpointsByOutcomeId = (midpointRows) => {
|
|
313
391
|
const outcomeMidpointsByOutcomeId = /* @__PURE__ */ new Map();
|
|
314
392
|
const addOutcomeMidpoints = (value) => {
|
|
@@ -475,6 +553,31 @@ var EventListItemContent = ({
|
|
|
475
553
|
const matchedCountLabel = labels.eventItem.matchedCount(
|
|
476
554
|
Math.max(resolvedVenueCount, visibleFooterVenues.length)
|
|
477
555
|
);
|
|
556
|
+
const handleOutcomesScrollThreshold = useCallback(() => {
|
|
557
|
+
if (!shouldEnableLazyMarketLoading) return;
|
|
558
|
+
if (!isLazyMarketsQueryEnabled) {
|
|
559
|
+
setIsLazyMarketsQueryEnabled(true);
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
if (!hasNextLazyMarketsPage) return;
|
|
563
|
+
if (isLoadingLazyMarkets || isFetchingNextLazyMarketsPage) return;
|
|
564
|
+
void fetchNextLazyMarketsPage();
|
|
565
|
+
}, [
|
|
566
|
+
fetchNextLazyMarketsPage,
|
|
567
|
+
hasNextLazyMarketsPage,
|
|
568
|
+
isFetchingNextLazyMarketsPage,
|
|
569
|
+
isLazyMarketsQueryEnabled,
|
|
570
|
+
isLoadingLazyMarkets,
|
|
571
|
+
shouldEnableLazyMarketLoading
|
|
572
|
+
]);
|
|
573
|
+
const {
|
|
574
|
+
containerRef: outcomesContainerRef,
|
|
575
|
+
scrollState: outcomesScrollState,
|
|
576
|
+
updateScrollState
|
|
577
|
+
} = useOutcomesScrollState({
|
|
578
|
+
totalMarketCount: resolvedMarketCount,
|
|
579
|
+
onReachScrollThreshold: handleOutcomesScrollThreshold
|
|
580
|
+
});
|
|
478
581
|
const shouldUseNativeLinkNavigation = (eventToHandle) => {
|
|
479
582
|
return eventToHandle.metaKey || eventToHandle.ctrlKey || eventToHandle.shiftKey || eventToHandle.altKey || eventToHandle.button === 1;
|
|
480
583
|
};
|
|
@@ -526,29 +629,9 @@ var EventListItemContent = ({
|
|
|
526
629
|
onEventClick == null ? void 0 : onEventClick(event);
|
|
527
630
|
}
|
|
528
631
|
};
|
|
529
|
-
|
|
530
|
-
(
|
|
531
|
-
|
|
532
|
-
const element = eventToHandle.currentTarget;
|
|
533
|
-
const distanceToBottom = element.scrollHeight - element.scrollTop - element.clientHeight;
|
|
534
|
-
if (distanceToBottom > OUTCOMES_SCROLL_LOAD_THRESHOLD_PX) return;
|
|
535
|
-
if (!isLazyMarketsQueryEnabled) {
|
|
536
|
-
setIsLazyMarketsQueryEnabled(true);
|
|
537
|
-
return;
|
|
538
|
-
}
|
|
539
|
-
if (!hasNextLazyMarketsPage) return;
|
|
540
|
-
if (isLoadingLazyMarkets || isFetchingNextLazyMarketsPage) return;
|
|
541
|
-
void fetchNextLazyMarketsPage();
|
|
542
|
-
},
|
|
543
|
-
[
|
|
544
|
-
fetchNextLazyMarketsPage,
|
|
545
|
-
hasNextLazyMarketsPage,
|
|
546
|
-
isFetchingNextLazyMarketsPage,
|
|
547
|
-
isLazyMarketsQueryEnabled,
|
|
548
|
-
isLoadingLazyMarkets,
|
|
549
|
-
shouldEnableLazyMarketLoading
|
|
550
|
-
]
|
|
551
|
-
);
|
|
632
|
+
useEffect(() => {
|
|
633
|
+
updateScrollState();
|
|
634
|
+
}, [comparison.rows.length, shouldRenderLoadingOutcomeRow, updateScrollState]);
|
|
552
635
|
const renderArbitrage = (value) => {
|
|
553
636
|
if (value == null) return null;
|
|
554
637
|
if (Math.abs(value) < config.market.arbitrageThreshold) return null;
|
|
@@ -733,69 +816,94 @@ var EventListItemContent = ({
|
|
|
733
816
|
) }) : null
|
|
734
817
|
] }) })
|
|
735
818
|
] }),
|
|
736
|
-
/* @__PURE__ */ jsxs(
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
819
|
+
/* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
820
|
+
/* @__PURE__ */ jsxs(
|
|
821
|
+
"div",
|
|
822
|
+
{
|
|
823
|
+
ref: outcomesContainerRef,
|
|
824
|
+
className: cn(
|
|
825
|
+
"agg-outcomes flex max-h-[76px] flex-col gap-4 overflow-y-auto rounded-agg-md [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
826
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-2 focus-visible:ring-offset-agg-secondary",
|
|
827
|
+
classNames == null ? void 0 : classNames.outcomes
|
|
828
|
+
),
|
|
829
|
+
"aria-label": labels.marketDetails.marketOutcomesAria,
|
|
830
|
+
tabIndex: 0,
|
|
831
|
+
children: [
|
|
832
|
+
comparison.rows.map((row) => {
|
|
833
|
+
var _a2;
|
|
834
|
+
const arbitragePercent = (_a2 = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.outcome.id]) != null ? _a2 : arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.market.id];
|
|
835
|
+
const arbReturn = arbReturnByVenueMarketId.get(row.market.id);
|
|
836
|
+
const priceGapPercent = arbReturn == null ? gapsByVenueMarketId.get(row.market.id) : arbReturn;
|
|
837
|
+
const priceGapSource = arbReturn == null ? "percent" : "fraction";
|
|
838
|
+
return /* @__PURE__ */ jsxs(
|
|
839
|
+
"div",
|
|
840
|
+
{
|
|
841
|
+
className: cn(
|
|
842
|
+
"agg-outcome-row",
|
|
843
|
+
"flex h-10 w-full flex-row items-center justify-between gap-3",
|
|
844
|
+
classNames == null ? void 0 : classNames.outcomeRow
|
|
845
|
+
),
|
|
846
|
+
children: [
|
|
847
|
+
/* @__PURE__ */ jsx("div", { className: "agg-outcome-label-row flex min-w-0 flex-1 flex-row items-center justify-start gap-2", children: /* @__PURE__ */ jsx(
|
|
848
|
+
Typography,
|
|
849
|
+
{
|
|
850
|
+
variant: "body",
|
|
851
|
+
className: "agg-outcome-label min-w-0 truncate text-agg-xs leading-agg-5 md:text-agg-base md:leading-agg-6",
|
|
852
|
+
children: row.label
|
|
853
|
+
}
|
|
854
|
+
) }),
|
|
855
|
+
/* @__PURE__ */ jsxs("div", { className: "agg-outcome-meta flex shrink-0 flex-row items-center justify-end gap-2", children: [
|
|
856
|
+
renderArbitrage(arbitragePercent),
|
|
857
|
+
renderPriceGapPill(priceGapPercent, priceGapSource),
|
|
858
|
+
/* @__PURE__ */ jsx("div", { className: "agg-outcome-price-strip relative flex shrink-0 items-center justify-end", children: isAwaitingMidpoints ? renderPriceStripSkeleton(row.prices.length) : row.prices.map(
|
|
859
|
+
(price, priceIndex) => renderComparisonPriceBadge(row, price, priceIndex)
|
|
860
|
+
) })
|
|
861
|
+
] })
|
|
862
|
+
]
|
|
863
|
+
},
|
|
864
|
+
row.id
|
|
865
|
+
);
|
|
866
|
+
}),
|
|
867
|
+
shouldRenderLoadingOutcomeRow ? /* @__PURE__ */ jsxs("div", { className: "agg-outcome-row-loading flex w-full items-center justify-between gap-3", children: [
|
|
868
|
+
/* @__PURE__ */ jsx(
|
|
869
|
+
"div",
|
|
870
|
+
{
|
|
871
|
+
"aria-hidden": "true",
|
|
872
|
+
className: "bg-agg-separator animate-pulse h-5 rounded-agg-sm w-[200px]"
|
|
873
|
+
}
|
|
874
|
+
),
|
|
875
|
+
/* @__PURE__ */ jsx(
|
|
876
|
+
"div",
|
|
877
|
+
{
|
|
878
|
+
"aria-hidden": "true",
|
|
879
|
+
className: "bg-agg-separator animate-pulse h-9 w-[100px] rounded-agg-full"
|
|
880
|
+
}
|
|
881
|
+
)
|
|
882
|
+
] }) : null
|
|
883
|
+
]
|
|
884
|
+
}
|
|
885
|
+
),
|
|
886
|
+
/* @__PURE__ */ jsx(
|
|
887
|
+
"div",
|
|
888
|
+
{
|
|
889
|
+
className: cn(
|
|
890
|
+
"agg-outcomes-scroll-gradient-top pointer-events-none absolute inset-x-0 top-0 z-10 bg-gradient-to-b from-agg-secondary to-transparent transition-opacity duration-150",
|
|
891
|
+
outcomesScrollState.hasOverflow && !outcomesScrollState.isAtTop ? "opacity-100" : "opacity-0"
|
|
892
|
+
),
|
|
893
|
+
style: { height: OUTCOMES_SCROLL_MASK_HEIGHT_PX }
|
|
894
|
+
}
|
|
895
|
+
),
|
|
896
|
+
/* @__PURE__ */ jsx(
|
|
897
|
+
"div",
|
|
898
|
+
{
|
|
899
|
+
className: cn(
|
|
900
|
+
"agg-outcomes-scroll-gradient-bottom pointer-events-none absolute inset-x-0 bottom-0 z-10 bg-gradient-to-t from-agg-secondary to-transparent transition-opacity duration-150",
|
|
901
|
+
outcomesScrollState.hasOverflow && !outcomesScrollState.isAtBottom ? "opacity-100" : "opacity-0"
|
|
902
|
+
),
|
|
903
|
+
style: { height: OUTCOMES_SCROLL_MASK_HEIGHT_PX }
|
|
904
|
+
}
|
|
905
|
+
)
|
|
906
|
+
] }),
|
|
799
907
|
/* @__PURE__ */ jsxs(
|
|
800
908
|
"div",
|
|
801
909
|
{
|
|
@@ -813,6 +921,14 @@ var EventListItemContent = ({
|
|
|
813
921
|
"agg-event-meta flex min-w-0 flex-1 items-center gap-2 text-agg-sm leading-agg-5 truncate"
|
|
814
922
|
),
|
|
815
923
|
children: [
|
|
924
|
+
outcomesScrollState.remainingMarkets > 0 ? /* @__PURE__ */ jsx(
|
|
925
|
+
Typography,
|
|
926
|
+
{
|
|
927
|
+
variant: "body",
|
|
928
|
+
className: "agg-event-remaining-markets shrink-0 text-agg-sm leading-agg-5 text-agg-muted-foreground",
|
|
929
|
+
children: labels.eventItem.remainingMarkets(outcomesScrollState.remainingMarkets)
|
|
930
|
+
}
|
|
931
|
+
) : null,
|
|
816
932
|
shouldShowMatchedVenueSummary ? /* @__PURE__ */ jsx("span", { className: "agg-event-matched-badge rounded-agg-full bg-agg-primary/10 px-2 py-[3px] text-agg-2xs font-agg-bold uppercase leading-agg-14 text-agg-primary", children: matchedCountLabel }) : null,
|
|
817
933
|
singleFooterVenue ? /* @__PURE__ */ jsxs("span", { className: "agg-event-single-venue flex min-w-0 items-center gap-1 overflow-hidden", children: [
|
|
818
934
|
/* @__PURE__ */ jsx(
|
|
@@ -1272,13 +1388,16 @@ import { useLabels as useLabels2 } from "@agg-build/hooks";
|
|
|
1272
1388
|
import { useMemo as useMemo2 } from "react";
|
|
1273
1389
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1274
1390
|
var SettlementSummary = ({
|
|
1275
|
-
|
|
1391
|
+
settlementDiff,
|
|
1276
1392
|
settlementSectionId = SETTLEMENT_SECTION_ID,
|
|
1277
1393
|
className
|
|
1278
1394
|
}) => {
|
|
1279
1395
|
const labels = useLabels2();
|
|
1280
|
-
const
|
|
1281
|
-
|
|
1396
|
+
const settlementDifferences = useMemo2(
|
|
1397
|
+
() => prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences),
|
|
1398
|
+
[settlementDiff == null ? void 0 : settlementDiff.differences]
|
|
1399
|
+
);
|
|
1400
|
+
if (settlementDifferences.length === 0) return null;
|
|
1282
1401
|
const handleReadFullDetails = (event) => {
|
|
1283
1402
|
event.preventDefault();
|
|
1284
1403
|
event.stopPropagation();
|
|
@@ -1287,43 +1406,78 @@ var SettlementSummary = ({
|
|
|
1287
1406
|
if (!target) return;
|
|
1288
1407
|
target.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
1289
1408
|
};
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
/* @__PURE__ */ jsxs2("div", { className: "agg-settlement-summary-row flex w-full items-center gap-3", children: [
|
|
1300
|
-
/* @__PURE__ */ jsx2(
|
|
1301
|
-
"p",
|
|
1302
|
-
{
|
|
1303
|
-
className: cn(
|
|
1304
|
-
"agg-settlement-summary-text",
|
|
1305
|
-
"min-w-0 flex-1 truncate text-agg-sm leading-agg-5 text-agg-foreground"
|
|
1306
|
-
),
|
|
1307
|
-
children: firstParagraph
|
|
1308
|
-
}
|
|
1409
|
+
const actionButton = /* @__PURE__ */ jsxs2(
|
|
1410
|
+
"button",
|
|
1411
|
+
{
|
|
1412
|
+
type: "button",
|
|
1413
|
+
className: cn(
|
|
1414
|
+
"agg-settlement-summary-toggle",
|
|
1415
|
+
"inline-flex shrink-0 cursor-pointer items-center gap-1 whitespace-nowrap text-agg-sm font-agg-bold leading-agg-5 text-agg-primary",
|
|
1416
|
+
"hover:opacity-80",
|
|
1417
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
|
|
1309
1418
|
),
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
"
|
|
1318
|
-
"
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1419
|
+
"aria-controls": settlementSectionId,
|
|
1420
|
+
onClick: handleReadFullDetails,
|
|
1421
|
+
children: [
|
|
1422
|
+
/* @__PURE__ */ jsx2("span", { children: labels.settlementSummary.readFullDetails }),
|
|
1423
|
+
/* @__PURE__ */ jsx2(
|
|
1424
|
+
"i",
|
|
1425
|
+
{
|
|
1426
|
+
className: "fi fi-rr-arrow-small-down size-3.5!",
|
|
1427
|
+
"aria-hidden": "true",
|
|
1428
|
+
style: { fontSize: 14 }
|
|
1429
|
+
}
|
|
1430
|
+
)
|
|
1431
|
+
]
|
|
1432
|
+
}
|
|
1433
|
+
);
|
|
1434
|
+
const visibleDifferences = settlementDifferences.slice(0, 2);
|
|
1435
|
+
const hiddenDifferenceCount = settlementDifferences.length - visibleDifferences.length;
|
|
1436
|
+
return /* @__PURE__ */ jsxs2(
|
|
1437
|
+
"div",
|
|
1438
|
+
{
|
|
1439
|
+
className: cn(
|
|
1440
|
+
"agg-settlement-summary flex w-full flex-wrap items-start justify-between gap-x-4 gap-y-2",
|
|
1441
|
+
className
|
|
1442
|
+
),
|
|
1443
|
+
children: [
|
|
1444
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex min-w-[240px] flex-1 flex-wrap items-center gap-x-5 gap-y-3", children: [
|
|
1445
|
+
/* @__PURE__ */ jsxs2("div", { className: "agg-settlement-summary-heading flex shrink-0 items-center gap-2", children: [
|
|
1446
|
+
/* @__PURE__ */ jsx2("p", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground", children: labels.settlementSummary.title }),
|
|
1447
|
+
/* @__PURE__ */ jsx2("span", { className: "flex size-4 shrink-0 items-center justify-center rounded-agg-full bg-agg-primary text-[10px] font-agg-bold leading-[14px] text-agg-on-primary", children: settlementDifferences.length })
|
|
1448
|
+
] }),
|
|
1449
|
+
/* @__PURE__ */ jsxs2("div", { className: "agg-settlement-summary-pills flex min-w-[240px] flex-1 flex-wrap items-center gap-2", children: [
|
|
1450
|
+
visibleDifferences.map((difference) => /* @__PURE__ */ jsxs2(
|
|
1451
|
+
"span",
|
|
1452
|
+
{
|
|
1453
|
+
className: "flex h-6 max-w-full shrink-0 items-center gap-2 rounded-agg-full bg-agg-secondary-hover px-3 py-1 text-agg-xs font-agg-normal leading-agg-4 text-agg-foreground sm:max-w-[220px]",
|
|
1454
|
+
children: [
|
|
1455
|
+
/* @__PURE__ */ jsx2(
|
|
1456
|
+
"i",
|
|
1457
|
+
{
|
|
1458
|
+
className: cn(
|
|
1459
|
+
"fi",
|
|
1460
|
+
resolveDifferenceIconClassName(difference.canonicalKey),
|
|
1461
|
+
"inline-flex size-3 shrink-0 items-center justify-center text-[12px] leading-none text-agg-muted-foreground"
|
|
1462
|
+
),
|
|
1463
|
+
"aria-hidden": "true"
|
|
1464
|
+
}
|
|
1465
|
+
),
|
|
1466
|
+
/* @__PURE__ */ jsx2("span", { className: "min-w-0 truncate", children: difference.title })
|
|
1467
|
+
]
|
|
1468
|
+
},
|
|
1469
|
+
difference.canonicalKey
|
|
1470
|
+
)),
|
|
1471
|
+
hiddenDifferenceCount > 0 ? /* @__PURE__ */ jsxs2("span", { className: "flex h-6 shrink-0 items-center rounded-agg-full bg-agg-secondary-hover px-3 py-1 text-agg-xs font-agg-normal leading-agg-4 text-agg-foreground", children: [
|
|
1472
|
+
"+",
|
|
1473
|
+
hiddenDifferenceCount
|
|
1474
|
+
] }) : null
|
|
1475
|
+
] })
|
|
1476
|
+
] }),
|
|
1477
|
+
actionButton
|
|
1478
|
+
]
|
|
1479
|
+
}
|
|
1480
|
+
);
|
|
1327
1481
|
};
|
|
1328
1482
|
SettlementSummary.displayName = "SettlementSummary";
|
|
1329
1483
|
|
|
@@ -1343,7 +1497,7 @@ import {
|
|
|
1343
1497
|
useSdkUiConfig as useSdkUiConfig2,
|
|
1344
1498
|
useVenueEvent as useVenueEvent2
|
|
1345
1499
|
} from "@agg-build/hooks";
|
|
1346
|
-
import { useEffect as
|
|
1500
|
+
import { useEffect as useEffect3, useMemo as useMemo5, useRef as useRef3, useState as useState3 } from "react";
|
|
1347
1501
|
|
|
1348
1502
|
// src/primitives/chart/chart-type-switch.tsx
|
|
1349
1503
|
import { useLabels as useLabels3 } from "@agg-build/hooks";
|
|
@@ -1519,7 +1673,7 @@ var filterChartVenueOutcomesByRenderableVenues = ({
|
|
|
1519
1673
|
|
|
1520
1674
|
// src/events/item-details/event-list-item-details-market-selector.tsx
|
|
1521
1675
|
import { useLabels as useLabels4 } from "@agg-build/hooks";
|
|
1522
|
-
import { useEffect, useLayoutEffect, useMemo as useMemo4, useRef, useState as useState2 } from "react";
|
|
1676
|
+
import { useEffect as useEffect2, useLayoutEffect, useMemo as useMemo4, useRef as useRef2, useState as useState2 } from "react";
|
|
1523
1677
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1524
1678
|
var MARKET_PILL_MAX_ROWS = 2;
|
|
1525
1679
|
var MARKET_PILL_FALLBACK_CONTAINER_WIDTH = 640;
|
|
@@ -1616,12 +1770,12 @@ var EventListItemDetailsMarketSelector = ({
|
|
|
1616
1770
|
}) => {
|
|
1617
1771
|
var _a;
|
|
1618
1772
|
const labels = useLabels4();
|
|
1619
|
-
const containerRef =
|
|
1620
|
-
const measurementContainerRef =
|
|
1621
|
-
const moreButtonRef =
|
|
1622
|
-
const dropdownInputRef =
|
|
1623
|
-
const moreButtonMeasureRef =
|
|
1624
|
-
const optionMeasureRefs =
|
|
1773
|
+
const containerRef = useRef2(null);
|
|
1774
|
+
const measurementContainerRef = useRef2(null);
|
|
1775
|
+
const moreButtonRef = useRef2(null);
|
|
1776
|
+
const dropdownInputRef = useRef2(null);
|
|
1777
|
+
const moreButtonMeasureRef = useRef2(null);
|
|
1778
|
+
const optionMeasureRefs = useRef2({});
|
|
1625
1779
|
const [layout, setLayout] = useState2(() => ({
|
|
1626
1780
|
visibleItems: options,
|
|
1627
1781
|
hiddenItems: []
|
|
@@ -1645,8 +1799,8 @@ var EventListItemDetailsMarketSelector = ({
|
|
|
1645
1799
|
if (!normalizedSearchValue) return options;
|
|
1646
1800
|
return options.filter((option) => option.label.toLowerCase().includes(normalizedSearchValue));
|
|
1647
1801
|
}, [options, searchValue]);
|
|
1648
|
-
const lastMeasuredKeyRef =
|
|
1649
|
-
const measureFrameRef =
|
|
1802
|
+
const lastMeasuredKeyRef = useRef2(null);
|
|
1803
|
+
const measureFrameRef = useRef2(null);
|
|
1650
1804
|
useLayoutEffect(() => {
|
|
1651
1805
|
const measureLayout = () => {
|
|
1652
1806
|
var _a2, _b, _c, _d, _e;
|
|
@@ -1728,7 +1882,7 @@ var EventListItemDetailsMarketSelector = ({
|
|
|
1728
1882
|
}
|
|
1729
1883
|
};
|
|
1730
1884
|
}, [moreButtonLabel, options]);
|
|
1731
|
-
|
|
1885
|
+
useEffect2(() => {
|
|
1732
1886
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
1733
1887
|
const mediaQueryList = window.matchMedia(MOBILE_TABS_MEDIA_QUERY);
|
|
1734
1888
|
const handleMediaQueryChange = (event) => {
|
|
@@ -1746,7 +1900,7 @@ var EventListItemDetailsMarketSelector = ({
|
|
|
1746
1900
|
mediaQueryList.removeListener(handleMediaQueryChange);
|
|
1747
1901
|
};
|
|
1748
1902
|
}, []);
|
|
1749
|
-
|
|
1903
|
+
useEffect2(() => {
|
|
1750
1904
|
if (!isDropdownOpen) {
|
|
1751
1905
|
setSearchValue("");
|
|
1752
1906
|
return;
|
|
@@ -1795,7 +1949,7 @@ var EventListItemDetailsMarketSelector = ({
|
|
|
1795
1949
|
resizeObserver.disconnect();
|
|
1796
1950
|
};
|
|
1797
1951
|
}, [isDropdownOpen, isMobileViewport, moreButtonLabel]);
|
|
1798
|
-
|
|
1952
|
+
useEffect2(() => {
|
|
1799
1953
|
if (!isDropdownOpen) return;
|
|
1800
1954
|
const handlePointerDown = (event) => {
|
|
1801
1955
|
var _a2;
|
|
@@ -2155,7 +2309,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
2155
2309
|
const [chartOutcomeLabel, setChartOutcomeLabel] = useState3(
|
|
2156
2310
|
(_c = (_b = (_a = tradingContext == null ? void 0 : tradingContext.selectedOutcome) == null ? void 0 : _a.label) == null ? void 0 : _b.trim()) != null ? _c : null
|
|
2157
2311
|
);
|
|
2158
|
-
|
|
2312
|
+
useEffect3(() => {
|
|
2159
2313
|
var _a2, _b2, _c2;
|
|
2160
2314
|
if (chartOutcomeLabel != null) return;
|
|
2161
2315
|
const label = (_c2 = (_b2 = (_a2 = tradingContext == null ? void 0 : tradingContext.selectedOutcome) == null ? void 0 : _a2.label) == null ? void 0 : _b2.trim()) != null ? _c2 : null;
|
|
@@ -2214,11 +2368,11 @@ var EventListItemDetailsGraphSection = ({
|
|
|
2214
2368
|
// of refetching every time the bucket boundary advances.
|
|
2215
2369
|
rangeKey: rollingWindow.range
|
|
2216
2370
|
});
|
|
2217
|
-
const hasAutoFallenBackRangeRef =
|
|
2218
|
-
|
|
2371
|
+
const hasAutoFallenBackRangeRef = useRef3(false);
|
|
2372
|
+
useEffect3(() => {
|
|
2219
2373
|
hasAutoFallenBackRangeRef.current = false;
|
|
2220
2374
|
}, [chartPrimaryOutcomeId]);
|
|
2221
|
-
|
|
2375
|
+
useEffect3(() => {
|
|
2222
2376
|
if (!shouldAutoFallbackToAllRange({
|
|
2223
2377
|
chartData: scopedMarketChartData,
|
|
2224
2378
|
isLoading: isScopedMarketChartLoading,
|
|
@@ -2305,7 +2459,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
2305
2459
|
transformProbability: (v) => v
|
|
2306
2460
|
});
|
|
2307
2461
|
}, [activeGraphVenue, scopedMarketChartData]);
|
|
2308
|
-
|
|
2462
|
+
useEffect3(() => {
|
|
2309
2463
|
if (!selectedGraphVenue) return;
|
|
2310
2464
|
const hasSelectedGraphVenue = chartAvailableVenueOutcomes.some(
|
|
2311
2465
|
(item) => item.venue === selectedGraphVenue
|
|
@@ -2468,8 +2622,8 @@ var EventListItemDetailsContent = ({
|
|
|
2468
2622
|
}) => {
|
|
2469
2623
|
var _a, _b, _c, _d;
|
|
2470
2624
|
const [selectedChartType, setSelectedChartType] = useState3("line");
|
|
2471
|
-
const lastAppliedEventSyncKeyRef =
|
|
2472
|
-
const lastAppliedDefaultRef =
|
|
2625
|
+
const lastAppliedEventSyncKeyRef = useRef3(null);
|
|
2626
|
+
const lastAppliedDefaultRef = useRef3(null);
|
|
2473
2627
|
const [chartRangeOverride, setChartRangeOverride] = useState3(null);
|
|
2474
2628
|
const config = useSdkUiConfig2();
|
|
2475
2629
|
const labels = useLabels5();
|
|
@@ -2524,10 +2678,10 @@ var EventListItemDetailsContent = ({
|
|
|
2524
2678
|
fallbackRange: defaultTimeRange != null ? defaultTimeRange : config.chart.selectedChartTimeRange
|
|
2525
2679
|
});
|
|
2526
2680
|
}, [config.chart.selectedChartTimeRange, defaultTimeRange, event, scopedSelectedMarket]);
|
|
2527
|
-
|
|
2681
|
+
useEffect3(() => {
|
|
2528
2682
|
setChartRangeOverride(initialChartTimeRange);
|
|
2529
2683
|
}, [event.id, initialChartTimeRange, scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id]);
|
|
2530
|
-
|
|
2684
|
+
useEffect3(() => {
|
|
2531
2685
|
if (!tradingContext) return;
|
|
2532
2686
|
if (lastAppliedEventSyncKeyRef.current === eventSyncKey) return;
|
|
2533
2687
|
if ((tradingContext == null ? void 0 : tradingContext.selectedEventId) !== event.id) {
|
|
@@ -2537,7 +2691,7 @@ var EventListItemDetailsContent = ({
|
|
|
2537
2691
|
}
|
|
2538
2692
|
lastAppliedEventSyncKeyRef.current = eventSyncKey;
|
|
2539
2693
|
}, [event, eventSyncKey, tradingContext]);
|
|
2540
|
-
|
|
2694
|
+
useEffect3(() => {
|
|
2541
2695
|
if (!tradingContext) return;
|
|
2542
2696
|
if (!defaultMarketId) return;
|
|
2543
2697
|
if (tradingContext.selectedEventId !== event.id) return;
|
|
@@ -2771,7 +2925,7 @@ var EventListItemDetailsContent = ({
|
|
|
2771
2925
|
}
|
|
2772
2926
|
)
|
|
2773
2927
|
] }),
|
|
2774
|
-
event.description ? /* @__PURE__ */ jsx5(SettlementSummary, { content: event.description }) : null
|
|
2928
|
+
event.description || event.settlementDiff ? /* @__PURE__ */ jsx5(SettlementSummary, { content: event.description, settlementDiff: event.settlementDiff }) : null
|
|
2775
2929
|
]
|
|
2776
2930
|
}
|
|
2777
2931
|
);
|
|
@@ -2881,7 +3035,7 @@ var orderbookDefaultLabels = {
|
|
|
2881
3035
|
};
|
|
2882
3036
|
|
|
2883
3037
|
// src/events/orderbook/use-center-orderbook-spread.ts
|
|
2884
|
-
import { useCallback as useCallback2, useLayoutEffect as useLayoutEffect2, useRef as
|
|
3038
|
+
import { useCallback as useCallback2, useLayoutEffect as useLayoutEffect2, useRef as useRef4 } from "react";
|
|
2885
3039
|
var maxAutoCenterAttempts = 12;
|
|
2886
3040
|
var userScrollKeys = /* @__PURE__ */ new Set(["ArrowDown", "ArrowUp", "PageDown", "PageUp", "Home", "End", " "]);
|
|
2887
3041
|
var useCenterOrderbookSpread = ({
|
|
@@ -2892,9 +3046,9 @@ var useCenterOrderbookSpread = ({
|
|
|
2892
3046
|
rowCount,
|
|
2893
3047
|
enabled = true
|
|
2894
3048
|
}) => {
|
|
2895
|
-
const hasUserScrolledRef =
|
|
2896
|
-
const animationFrameRef =
|
|
2897
|
-
const retryCountRef =
|
|
3049
|
+
const hasUserScrolledRef = useRef4(false);
|
|
3050
|
+
const animationFrameRef = useRef4(null);
|
|
3051
|
+
const retryCountRef = useRef4(0);
|
|
2898
3052
|
const resetKey = marketId != null ? marketId : "";
|
|
2899
3053
|
const cancelPendingFrame = useCallback2(() => {
|
|
2900
3054
|
if (animationFrameRef.current === null) return;
|
|
@@ -3024,7 +3178,7 @@ var useCenterOrderbookSpread = ({
|
|
|
3024
3178
|
|
|
3025
3179
|
// src/events/orderbook/index.tsx
|
|
3026
3180
|
import { sortVenues as sortVenues3, useAggUiConfig } from "@agg-build/hooks";
|
|
3027
|
-
import { useEffect as
|
|
3181
|
+
import { useEffect as useEffect4, useRef as useRef5 } from "react";
|
|
3028
3182
|
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3029
3183
|
var OrderbookVenueLogos = ({ venues }) => {
|
|
3030
3184
|
const visible = sortVenues3(venues).slice(0, orderbookMaxVisibleVenues);
|
|
@@ -3133,8 +3287,8 @@ var Orderbook = ({
|
|
|
3133
3287
|
var _a, _b, _c, _d, _e;
|
|
3134
3288
|
const { enableWebsocketsLogs } = useAggUiConfig();
|
|
3135
3289
|
const labels = __spreadValues(__spreadValues({}, orderbookDefaultLabels), labelsProp);
|
|
3136
|
-
const scrollContainerRef =
|
|
3137
|
-
const spreadRowRef =
|
|
3290
|
+
const scrollContainerRef = useRef5(null);
|
|
3291
|
+
const spreadRowRef = useRef5(null);
|
|
3138
3292
|
const autoCenterMarketId = (_a = marketId != null ? marketId : outcomeId) != null ? _a : null;
|
|
3139
3293
|
const maxVisibleRows = Math.max(1, visibleRows);
|
|
3140
3294
|
const totalVisibleRows = maxVisibleRows * 2 + 1;
|
|
@@ -3151,7 +3305,7 @@ var Orderbook = ({
|
|
|
3151
3305
|
const spreadEntry = entries.find(
|
|
3152
3306
|
(e) => e.kind === "spread"
|
|
3153
3307
|
);
|
|
3154
|
-
|
|
3308
|
+
useEffect4(() => {
|
|
3155
3309
|
var _a2, _b2;
|
|
3156
3310
|
if (!enableWebsocketsLogs) return;
|
|
3157
3311
|
console.debug("[AggUI][orderbook] component_rendered", {
|
|
@@ -3352,7 +3506,7 @@ import {
|
|
|
3352
3506
|
useVenueMarkets as useVenueMarkets2,
|
|
3353
3507
|
useViewportMidpoints
|
|
3354
3508
|
} from "@agg-build/hooks";
|
|
3355
|
-
import { useEffect as
|
|
3509
|
+
import { useEffect as useEffect6, useId, useMemo as useMemo7, useState as useState5 } from "react";
|
|
3356
3510
|
|
|
3357
3511
|
// src/events/shared/select-best-outcome.ts
|
|
3358
3512
|
var normalizeOutcomeLabel2 = (label) => {
|
|
@@ -3584,7 +3738,7 @@ import {
|
|
|
3584
3738
|
useRollingChartWindow as useRollingChartWindow2,
|
|
3585
3739
|
useSdkUiConfig as useSdkUiConfig3
|
|
3586
3740
|
} from "@agg-build/hooks";
|
|
3587
|
-
import { useEffect as
|
|
3741
|
+
import { useEffect as useEffect5, useMemo as useMemo6, useRef as useRef6, useState as useState4 } from "react";
|
|
3588
3742
|
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3589
3743
|
var MarketDetailsGraphPanel = ({
|
|
3590
3744
|
venueMarkets,
|
|
@@ -3651,12 +3805,12 @@ var MarketDetailsGraphPanel = ({
|
|
|
3651
3805
|
// instead of refetching on every bucket-boundary rollover.
|
|
3652
3806
|
rangeKey: rollingWindow.range
|
|
3653
3807
|
});
|
|
3654
|
-
const hasAutoFallenBackRangeRef =
|
|
3655
|
-
|
|
3808
|
+
const hasAutoFallenBackRangeRef = useRef6(false);
|
|
3809
|
+
useEffect5(() => {
|
|
3656
3810
|
hasAutoFallenBackRangeRef.current = false;
|
|
3657
3811
|
setChartRangeOverride(null);
|
|
3658
3812
|
}, [chartPrimaryOutcomeId]);
|
|
3659
|
-
|
|
3813
|
+
useEffect5(() => {
|
|
3660
3814
|
if (!shouldAutoFallbackToAllRange({
|
|
3661
3815
|
chartData: marketChartData,
|
|
3662
3816
|
isLoading: isMarketChartLoading,
|
|
@@ -3722,7 +3876,7 @@ var MarketDetailsGraphPanel = ({
|
|
|
3722
3876
|
});
|
|
3723
3877
|
}, [marketChartData, selectedGraphVenue]);
|
|
3724
3878
|
const hasChartError = !!marketChartError;
|
|
3725
|
-
|
|
3879
|
+
useEffect5(() => {
|
|
3726
3880
|
if (!selectedGraphVenue) {
|
|
3727
3881
|
return;
|
|
3728
3882
|
}
|
|
@@ -4057,10 +4211,10 @@ var MarketDetailsContent = ({
|
|
|
4057
4211
|
() => resolveInitialTab(defaultTab)
|
|
4058
4212
|
);
|
|
4059
4213
|
const [isOpened, setIsOpened] = useState5(controlledIsOpened);
|
|
4060
|
-
|
|
4214
|
+
useEffect6(() => {
|
|
4061
4215
|
setSelectedTab(resolveInitialTab(defaultTab));
|
|
4062
4216
|
}, [defaultTab]);
|
|
4063
|
-
|
|
4217
|
+
useEffect6(() => {
|
|
4064
4218
|
setIsOpened(controlledIsOpened);
|
|
4065
4219
|
}, [controlledIsOpened]);
|
|
4066
4220
|
const effectiveSelectedTab = isResolvedMarket ? "graph" : selectedTab;
|
|
@@ -4086,7 +4240,7 @@ var MarketDetailsContent = ({
|
|
|
4086
4240
|
const selectedOutcomeId = scopedSelectedOutcomeState.outcomeId;
|
|
4087
4241
|
const selectedOutcomeLabel = (_d = scopedSelectedOutcomeState.outcomeLabel) != null ? _d : null;
|
|
4088
4242
|
const selectOutcome = tradingContext == null ? void 0 : tradingContext.selectOutcome;
|
|
4089
|
-
|
|
4243
|
+
useEffect6(() => {
|
|
4090
4244
|
var _a2;
|
|
4091
4245
|
if (!isOpened || !model) return;
|
|
4092
4246
|
if (isOutcomeSelectionLocked) return;
|
|
@@ -4588,7 +4742,7 @@ var MarketDetailsContent = ({
|
|
|
4588
4742
|
value: selectedTab === "other" ? "order-book" : selectedTab,
|
|
4589
4743
|
onChange: (nextValue) => setSelectedTab(nextValue),
|
|
4590
4744
|
variant: "underline",
|
|
4591
|
-
className: "agg-market-tabs w-full px-5"
|
|
4745
|
+
className: "agg-market-tabs flex! w-full px-5"
|
|
4592
4746
|
}
|
|
4593
4747
|
) }),
|
|
4594
4748
|
/* @__PURE__ */ jsx10("div", { className: "h-px w-full bg-agg-separator" })
|
|
@@ -4824,7 +4978,7 @@ var MarketDetailsList = ({
|
|
|
4824
4978
|
);
|
|
4825
4979
|
}, [displayedMarkets]);
|
|
4826
4980
|
const { prices: midpointsFallback, venueByOutcomeId: midpointsFallbackVenues } = useViewportMidpoints(midpointEligibleMarkets);
|
|
4827
|
-
|
|
4981
|
+
useEffect6(() => {
|
|
4828
4982
|
if (isResolvedEvent) {
|
|
4829
4983
|
setAreResolvedMarketsVisible(false);
|
|
4830
4984
|
return;
|
|
@@ -4833,7 +4987,7 @@ var MarketDetailsList = ({
|
|
|
4833
4987
|
setAreResolvedMarketsVisible(false);
|
|
4834
4988
|
}
|
|
4835
4989
|
}, [groupedMarkets.resolved.length, isResolvedEvent]);
|
|
4836
|
-
|
|
4990
|
+
useEffect6(() => {
|
|
4837
4991
|
if (displayedMarkets.length === 0) return;
|
|
4838
4992
|
if (selectedMarketId && displayedMarkets.some((market) => market.id === selectedMarketId)) {
|
|
4839
4993
|
return;
|
|
@@ -4850,7 +5004,7 @@ var MarketDetailsList = ({
|
|
|
4850
5004
|
if (!autoSelectFallbackMarket) return;
|
|
4851
5005
|
tradingContext == null ? void 0 : tradingContext.selectMarket(fallbackSelectableMarket.id, fallbackSelectableMarket);
|
|
4852
5006
|
}, [autoSelectFallbackMarket, displayedMarkets, selectedMarketId, sourceMarkets, tradingContext]);
|
|
4853
|
-
|
|
5007
|
+
useEffect6(() => {
|
|
4854
5008
|
if (!expandedMarketId) return;
|
|
4855
5009
|
if (displayedMarkets.some((market) => market.id === expandedMarketId)) return;
|
|
4856
5010
|
setExpandedMarketId(null);
|
|
@@ -4970,7 +5124,7 @@ import {
|
|
|
4970
5124
|
} from "@agg-build/hooks";
|
|
4971
5125
|
import { VENUES } from "@agg-build/sdk";
|
|
4972
5126
|
import * as Dialog from "@radix-ui/react-dialog";
|
|
4973
|
-
import { useEffect as
|
|
5127
|
+
import { useEffect as useEffect8, useMemo as useMemo10, useRef as useRef8, useState as useState7 } from "react";
|
|
4974
5128
|
|
|
4975
5129
|
// src/events/list/category-sidebar.tsx
|
|
4976
5130
|
import { useMemo as useMemo8 } from "react";
|
|
@@ -5091,7 +5245,8 @@ CategorySidebar.displayName = "CategorySidebar";
|
|
|
5091
5245
|
|
|
5092
5246
|
// src/events/list/event-list-tabs.tsx
|
|
5093
5247
|
import { getVenueAvailabilityState, useAppConfig, useGeoBlock, useLabels as useLabels8 } from "@agg-build/hooks";
|
|
5094
|
-
import {
|
|
5248
|
+
import { isVenueActive } from "@agg-build/sdk";
|
|
5249
|
+
import { useCallback as useCallback3, useEffect as useEffect7, useMemo as useMemo9, useRef as useRef7, useState as useState6 } from "react";
|
|
5095
5250
|
|
|
5096
5251
|
// src/events/list/event-list.constants.ts
|
|
5097
5252
|
import { MatchStatus, Venue as Venue2 } from "@agg-build/sdk";
|
|
@@ -5115,12 +5270,6 @@ var getDefaultEventListTabs = (labels) => {
|
|
|
5115
5270
|
venueLogo: Venue2.polymarket,
|
|
5116
5271
|
venues: [Venue2.polymarket]
|
|
5117
5272
|
},
|
|
5118
|
-
{
|
|
5119
|
-
value: Venue2.kalshi,
|
|
5120
|
-
label: labels.venues.kalshi,
|
|
5121
|
-
venueLogo: Venue2.kalshi,
|
|
5122
|
-
venues: [Venue2.kalshi]
|
|
5123
|
-
},
|
|
5124
5273
|
{
|
|
5125
5274
|
value: Venue2.limitless,
|
|
5126
5275
|
label: labels.venues.limitless,
|
|
@@ -5184,6 +5333,7 @@ var useEventListTabs = (tabs) => {
|
|
|
5184
5333
|
const baseTabs = tabs != null ? tabs : getDefaultEventListTabs(labels);
|
|
5185
5334
|
return baseTabs.flatMap((tab) => {
|
|
5186
5335
|
if (!tab.venueLogo) return [tab];
|
|
5336
|
+
if (!isVenueActive(tab.venueLogo)) return [];
|
|
5187
5337
|
const availabilityState = getVenueAvailabilityState({
|
|
5188
5338
|
venueId: tab.venueLogo,
|
|
5189
5339
|
disabledVenues,
|
|
@@ -5209,7 +5359,7 @@ var EventListTabs = ({
|
|
|
5209
5359
|
overflowBehavior
|
|
5210
5360
|
}) => {
|
|
5211
5361
|
const resolvedTabs = useEventListTabs(tabs);
|
|
5212
|
-
|
|
5362
|
+
useEffect7(() => {
|
|
5213
5363
|
const fallbackTab = resolvedTabs.find((tab) => !tab.disabled);
|
|
5214
5364
|
if (!fallbackTab) return;
|
|
5215
5365
|
if (resolvedTabs.some((tab) => tab.value === activeTab && !tab.disabled)) return;
|
|
@@ -5241,9 +5391,9 @@ var EventListTabs = ({
|
|
|
5241
5391
|
};
|
|
5242
5392
|
EventListTabs.displayName = "EventListTabs";
|
|
5243
5393
|
var useEventListTabsHeaderOverflow = (recomputeOn, options) => {
|
|
5244
|
-
const headerRef =
|
|
5245
|
-
const titleRef =
|
|
5246
|
-
const requiredTabsWidthRef =
|
|
5394
|
+
const headerRef = useRef7(null);
|
|
5395
|
+
const titleRef = useRef7(null);
|
|
5396
|
+
const requiredTabsWidthRef = useRef7(0);
|
|
5247
5397
|
const [shouldUseSelectOverflow, setShouldUseSelectOverflow] = useState6(false);
|
|
5248
5398
|
const updateTabsOverflowBehavior = useCallback3(() => {
|
|
5249
5399
|
var _a;
|
|
@@ -5282,10 +5432,10 @@ var useEventListTabsHeaderOverflow = (recomputeOn, options) => {
|
|
|
5282
5432
|
if (requiredTabsWidthRef.current <= 0) return;
|
|
5283
5433
|
setShouldUseSelectOverflow(requiredTabsWidthRef.current > availableTabsWidth);
|
|
5284
5434
|
}, [options == null ? void 0 : options.minTabsInlineWidthForSelect, options == null ? void 0 : options.preferSelectOnOverflow]);
|
|
5285
|
-
|
|
5435
|
+
useEffect7(() => {
|
|
5286
5436
|
updateTabsOverflowBehavior();
|
|
5287
5437
|
}, [recomputeOn, updateTabsOverflowBehavior]);
|
|
5288
|
-
|
|
5438
|
+
useEffect7(() => {
|
|
5289
5439
|
if (typeof window === "undefined") return;
|
|
5290
5440
|
const handleResize = () => {
|
|
5291
5441
|
updateTabsOverflowBehavior();
|
|
@@ -5295,7 +5445,7 @@ var useEventListTabsHeaderOverflow = (recomputeOn, options) => {
|
|
|
5295
5445
|
window.removeEventListener("resize", handleResize);
|
|
5296
5446
|
};
|
|
5297
5447
|
}, [updateTabsOverflowBehavior]);
|
|
5298
|
-
|
|
5448
|
+
useEffect7(() => {
|
|
5299
5449
|
if (typeof ResizeObserver === "undefined") return;
|
|
5300
5450
|
const headerElement = headerRef.current;
|
|
5301
5451
|
const titleElement = titleRef.current;
|
|
@@ -5416,7 +5566,7 @@ var EventList = ({
|
|
|
5416
5566
|
labels.eventList.sortByTotalVolume
|
|
5417
5567
|
]);
|
|
5418
5568
|
const baseCategoryId = (_c = categoryIds == null ? void 0 : categoryIds[0]) != null ? _c : null;
|
|
5419
|
-
|
|
5569
|
+
useEffect8(() => {
|
|
5420
5570
|
if (!isDiscoveryFiltersEnabled) return;
|
|
5421
5571
|
setCategoryPath([]);
|
|
5422
5572
|
setCollapsedCategoryIds(/* @__PURE__ */ new Set());
|
|
@@ -5547,7 +5697,7 @@ var EventList = ({
|
|
|
5547
5697
|
grouped: showSportsMarkets,
|
|
5548
5698
|
initialPages: initialLoadedPageCount
|
|
5549
5699
|
});
|
|
5550
|
-
|
|
5700
|
+
useEffect8(() => {
|
|
5551
5701
|
if (stateRef) {
|
|
5552
5702
|
stateRef.current = { venueTab: activeTabValue, loadedPageCount };
|
|
5553
5703
|
}
|
|
@@ -5579,8 +5729,8 @@ var EventList = ({
|
|
|
5579
5729
|
const shouldRenderLoadingState = isLoading && !isPlaceholderData && tileEvents.length === 0;
|
|
5580
5730
|
const shouldRenderEmptyState = !isLoading && !isError && tileEvents.length === 0;
|
|
5581
5731
|
const shouldRenderPaginationLoadingItems = shouldPaginate && hasNextPage;
|
|
5582
|
-
const loadMoreRef =
|
|
5583
|
-
|
|
5732
|
+
const loadMoreRef = useRef8(null);
|
|
5733
|
+
useEffect8(() => {
|
|
5584
5734
|
if (!shouldPaginate) return;
|
|
5585
5735
|
if (!hasNextPage) return;
|
|
5586
5736
|
if (typeof IntersectionObserver === "undefined") return;
|