@agg-build/ui 2.4.3 → 2.4.6
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-GLVLCXIM.mjs → chunk-CXSIXL7M.mjs} +29 -35
- package/dist/{chunk-PHAEFHBM.mjs → chunk-GWRFSQQK.mjs} +70 -17
- package/dist/{chunk-PHRYWSNV.mjs → chunk-I4X5UNCT.mjs} +307 -240
- package/dist/{chunk-3PSIO77N.mjs → chunk-JVRTJQPZ.mjs} +1 -1
- package/dist/{chunk-WZ55ERDO.mjs → chunk-PTNFXXOV.mjs} +50 -11
- package/dist/{chunk-QDNG5UKJ.mjs → chunk-TEBAR55W.mjs} +292 -291
- package/dist/{chunk-STL4ZHLP.mjs → chunk-UH3DUTMG.mjs} +140 -115
- package/dist/events.js +440 -305
- package/dist/events.mjs +3 -3
- package/dist/index.js +844 -666
- package/dist/index.mjs +7 -7
- package/dist/modals.js +337 -297
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +558 -381
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +50 -11
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +2597 -2384
- package/dist/trading.mjs +4 -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 +1 -1
- package/dist/types/events/item-details/settlement-summary.d.ts +1 -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 +1 -1
- package/dist/types/trading/settlement/index.d.ts +1 -1
- package/package.json +3 -3
|
@@ -5,8 +5,6 @@ import {
|
|
|
5
5
|
formatProbabilityCents,
|
|
6
6
|
formatProbabilityPercent,
|
|
7
7
|
getDisplayOutcomePrice,
|
|
8
|
-
getFirstSettlementParagraph,
|
|
9
|
-
getSettlementDifferenceId,
|
|
10
8
|
prepareSettlementDifferences,
|
|
11
9
|
resolveDifferenceIconClassName,
|
|
12
10
|
resolveHeaderOutcomeItems,
|
|
@@ -26,7 +24,7 @@ import {
|
|
|
26
24
|
resolveUnifiedOrderBookEntries,
|
|
27
25
|
sortOutcomeSelectorOutcomes,
|
|
28
26
|
useEventTradingContext
|
|
29
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-UH3DUTMG.mjs";
|
|
30
28
|
import {
|
|
31
29
|
AutocompleteSelect,
|
|
32
30
|
Badge,
|
|
@@ -78,7 +76,7 @@ import {
|
|
|
78
76
|
sortCategoriesForNavigation,
|
|
79
77
|
sortOutcomes,
|
|
80
78
|
splitEventsByLifecycle
|
|
81
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-PTNFXXOV.mjs";
|
|
82
80
|
|
|
83
81
|
// src/events/item/index.tsx
|
|
84
82
|
import {
|
|
@@ -91,7 +89,7 @@ import {
|
|
|
91
89
|
useVenueMarketMidpoints,
|
|
92
90
|
useVenueMarkets
|
|
93
91
|
} from "@agg-build/hooks";
|
|
94
|
-
import { useCallback, useMemo, useState } from "react";
|
|
92
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
95
93
|
|
|
96
94
|
// src/shared/query-error.ts
|
|
97
95
|
var getErrorStatus = (error) => {
|
|
@@ -310,8 +308,85 @@ var EventListItemNotFoundState = ({
|
|
|
310
308
|
);
|
|
311
309
|
};
|
|
312
310
|
var OUTCOMES_SCROLL_LOAD_THRESHOLD_PX = 16;
|
|
311
|
+
var OUTCOMES_SCROLL_STATE_EPSILON_PX = 1;
|
|
312
|
+
var OUTCOMES_SCROLL_MASK_HEIGHT_PX = 24;
|
|
313
313
|
var MARKET_ID_QUERY_PARAM = "marketId";
|
|
314
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
|
+
};
|
|
315
390
|
var buildOutcomeMidpointsByOutcomeId = (midpointRows) => {
|
|
316
391
|
const outcomeMidpointsByOutcomeId = /* @__PURE__ */ new Map();
|
|
317
392
|
const addOutcomeMidpoints = (value) => {
|
|
@@ -478,6 +553,31 @@ var EventListItemContent = ({
|
|
|
478
553
|
const matchedCountLabel = labels.eventItem.matchedCount(
|
|
479
554
|
Math.max(resolvedVenueCount, visibleFooterVenues.length)
|
|
480
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
|
+
});
|
|
481
581
|
const shouldUseNativeLinkNavigation = (eventToHandle) => {
|
|
482
582
|
return eventToHandle.metaKey || eventToHandle.ctrlKey || eventToHandle.shiftKey || eventToHandle.altKey || eventToHandle.button === 1;
|
|
483
583
|
};
|
|
@@ -529,29 +629,9 @@ var EventListItemContent = ({
|
|
|
529
629
|
onEventClick == null ? void 0 : onEventClick(event);
|
|
530
630
|
}
|
|
531
631
|
};
|
|
532
|
-
|
|
533
|
-
(
|
|
534
|
-
|
|
535
|
-
const element = eventToHandle.currentTarget;
|
|
536
|
-
const distanceToBottom = element.scrollHeight - element.scrollTop - element.clientHeight;
|
|
537
|
-
if (distanceToBottom > OUTCOMES_SCROLL_LOAD_THRESHOLD_PX) return;
|
|
538
|
-
if (!isLazyMarketsQueryEnabled) {
|
|
539
|
-
setIsLazyMarketsQueryEnabled(true);
|
|
540
|
-
return;
|
|
541
|
-
}
|
|
542
|
-
if (!hasNextLazyMarketsPage) return;
|
|
543
|
-
if (isLoadingLazyMarkets || isFetchingNextLazyMarketsPage) return;
|
|
544
|
-
void fetchNextLazyMarketsPage();
|
|
545
|
-
},
|
|
546
|
-
[
|
|
547
|
-
fetchNextLazyMarketsPage,
|
|
548
|
-
hasNextLazyMarketsPage,
|
|
549
|
-
isFetchingNextLazyMarketsPage,
|
|
550
|
-
isLazyMarketsQueryEnabled,
|
|
551
|
-
isLoadingLazyMarkets,
|
|
552
|
-
shouldEnableLazyMarketLoading
|
|
553
|
-
]
|
|
554
|
-
);
|
|
632
|
+
useEffect(() => {
|
|
633
|
+
updateScrollState();
|
|
634
|
+
}, [comparison.rows.length, shouldRenderLoadingOutcomeRow, updateScrollState]);
|
|
555
635
|
const renderArbitrage = (value) => {
|
|
556
636
|
if (value == null) return null;
|
|
557
637
|
if (Math.abs(value) < config.market.arbitrageThreshold) return null;
|
|
@@ -736,69 +816,94 @@ var EventListItemContent = ({
|
|
|
736
816
|
) }) : null
|
|
737
817
|
] }) })
|
|
738
818
|
] }),
|
|
739
|
-
/* @__PURE__ */ jsxs(
|
|
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
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
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
|
+
] }),
|
|
802
907
|
/* @__PURE__ */ jsxs(
|
|
803
908
|
"div",
|
|
804
909
|
{
|
|
@@ -816,6 +921,14 @@ var EventListItemContent = ({
|
|
|
816
921
|
"agg-event-meta flex min-w-0 flex-1 items-center gap-2 text-agg-sm leading-agg-5 truncate"
|
|
817
922
|
),
|
|
818
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,
|
|
819
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,
|
|
820
933
|
singleFooterVenue ? /* @__PURE__ */ jsxs("span", { className: "agg-event-single-venue flex min-w-0 items-center gap-1 overflow-hidden", children: [
|
|
821
934
|
/* @__PURE__ */ jsx(
|
|
@@ -1275,18 +1388,16 @@ import { useLabels as useLabels2 } from "@agg-build/hooks";
|
|
|
1275
1388
|
import { useMemo as useMemo2 } from "react";
|
|
1276
1389
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1277
1390
|
var SettlementSummary = ({
|
|
1278
|
-
content,
|
|
1279
1391
|
settlementDiff,
|
|
1280
1392
|
settlementSectionId = SETTLEMENT_SECTION_ID,
|
|
1281
1393
|
className
|
|
1282
1394
|
}) => {
|
|
1283
1395
|
const labels = useLabels2();
|
|
1284
|
-
const firstParagraph = useMemo2(() => getFirstSettlementParagraph(content), [content]);
|
|
1285
1396
|
const settlementDifferences = useMemo2(
|
|
1286
1397
|
() => prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences),
|
|
1287
1398
|
[settlementDiff == null ? void 0 : settlementDiff.differences]
|
|
1288
1399
|
);
|
|
1289
|
-
if (
|
|
1400
|
+
if (settlementDifferences.length === 0) return null;
|
|
1290
1401
|
const handleReadFullDetails = (event) => {
|
|
1291
1402
|
event.preventDefault();
|
|
1292
1403
|
event.stopPropagation();
|
|
@@ -1295,20 +1406,6 @@ var SettlementSummary = ({
|
|
|
1295
1406
|
if (!target) return;
|
|
1296
1407
|
target.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
1297
1408
|
};
|
|
1298
|
-
const handleDifferencePillClick = (event, canonicalKey) => {
|
|
1299
|
-
event.preventDefault();
|
|
1300
|
-
event.stopPropagation();
|
|
1301
|
-
if (typeof document === "undefined") return;
|
|
1302
|
-
const target = document.getElementById(
|
|
1303
|
-
getSettlementDifferenceId(settlementSectionId, canonicalKey)
|
|
1304
|
-
);
|
|
1305
|
-
if (!target) return;
|
|
1306
|
-
const trigger = target.querySelector("button[aria-expanded]");
|
|
1307
|
-
if ((trigger == null ? void 0 : trigger.getAttribute("aria-expanded")) === "false") {
|
|
1308
|
-
trigger.click();
|
|
1309
|
-
}
|
|
1310
|
-
target.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
1311
|
-
};
|
|
1312
1409
|
const actionButton = /* @__PURE__ */ jsxs2(
|
|
1313
1410
|
"button",
|
|
1314
1411
|
{
|
|
@@ -1323,85 +1420,59 @@ var SettlementSummary = ({
|
|
|
1323
1420
|
onClick: handleReadFullDetails,
|
|
1324
1421
|
children: [
|
|
1325
1422
|
/* @__PURE__ */ jsx2("span", { children: labels.settlementSummary.readFullDetails }),
|
|
1326
|
-
/* @__PURE__ */ jsx2(
|
|
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
|
+
)
|
|
1327
1431
|
]
|
|
1328
1432
|
}
|
|
1329
1433
|
);
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
const hiddenDifferenceCount = settlementDifferences.length - visibleDifferences.length;
|
|
1333
|
-
return /* @__PURE__ */ jsxs2(
|
|
1334
|
-
"div",
|
|
1335
|
-
{
|
|
1336
|
-
className: cn(
|
|
1337
|
-
"agg-settlement-summary flex w-full flex-wrap items-start justify-between gap-x-4 gap-y-2",
|
|
1338
|
-
className
|
|
1339
|
-
),
|
|
1340
|
-
children: [
|
|
1341
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex min-w-[240px] flex-1 flex-wrap items-center gap-x-5 gap-y-3", children: [
|
|
1342
|
-
/* @__PURE__ */ jsxs2("div", { className: "agg-settlement-summary-heading flex shrink-0 items-center gap-2", children: [
|
|
1343
|
-
/* @__PURE__ */ jsx2("p", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground", children: labels.settlementSummary.title }),
|
|
1344
|
-
/* @__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 })
|
|
1345
|
-
] }),
|
|
1346
|
-
/* @__PURE__ */ jsxs2("div", { className: "agg-settlement-summary-pills flex min-w-[240px] flex-1 flex-wrap items-center gap-2", children: [
|
|
1347
|
-
visibleDifferences.map((difference) => /* @__PURE__ */ jsxs2(
|
|
1348
|
-
"button",
|
|
1349
|
-
{
|
|
1350
|
-
type: "button",
|
|
1351
|
-
className: cn(
|
|
1352
|
-
"flex h-6 max-w-full shrink-0 cursor-pointer 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]",
|
|
1353
|
-
"hover:opacity-80",
|
|
1354
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
|
|
1355
|
-
),
|
|
1356
|
-
onClick: (event) => handleDifferencePillClick(event, difference.canonicalKey),
|
|
1357
|
-
children: [
|
|
1358
|
-
/* @__PURE__ */ jsx2(
|
|
1359
|
-
"i",
|
|
1360
|
-
{
|
|
1361
|
-
className: cn(
|
|
1362
|
-
"fi",
|
|
1363
|
-
resolveDifferenceIconClassName(difference.canonicalKey),
|
|
1364
|
-
"inline-flex size-3 shrink-0 items-center justify-center text-[12px] leading-none text-agg-muted-foreground"
|
|
1365
|
-
),
|
|
1366
|
-
"aria-hidden": "true"
|
|
1367
|
-
}
|
|
1368
|
-
),
|
|
1369
|
-
/* @__PURE__ */ jsx2("span", { className: "min-w-0 truncate", children: difference.title })
|
|
1370
|
-
]
|
|
1371
|
-
},
|
|
1372
|
-
difference.canonicalKey
|
|
1373
|
-
)),
|
|
1374
|
-
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: [
|
|
1375
|
-
"+",
|
|
1376
|
-
hiddenDifferenceCount
|
|
1377
|
-
] }) : null
|
|
1378
|
-
] })
|
|
1379
|
-
] }),
|
|
1380
|
-
actionButton
|
|
1381
|
-
]
|
|
1382
|
-
}
|
|
1383
|
-
);
|
|
1384
|
-
}
|
|
1434
|
+
const visibleDifferences = settlementDifferences.slice(0, 2);
|
|
1435
|
+
const hiddenDifferenceCount = settlementDifferences.length - visibleDifferences.length;
|
|
1385
1436
|
return /* @__PURE__ */ jsxs2(
|
|
1386
1437
|
"div",
|
|
1387
1438
|
{
|
|
1388
1439
|
className: cn(
|
|
1389
|
-
"agg-settlement-summary flex w-full items-
|
|
1440
|
+
"agg-settlement-summary flex w-full flex-wrap items-start justify-between gap-x-4 gap-y-2",
|
|
1390
1441
|
className
|
|
1391
1442
|
),
|
|
1392
1443
|
children: [
|
|
1393
|
-
/* @__PURE__ */ jsxs2("div", { className: "
|
|
1394
|
-
/* @__PURE__ */
|
|
1395
|
-
|
|
1396
|
-
"
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
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
|
+
] })
|
|
1405
1476
|
] }),
|
|
1406
1477
|
actionButton
|
|
1407
1478
|
]
|
|
@@ -1426,7 +1497,7 @@ import {
|
|
|
1426
1497
|
useSdkUiConfig as useSdkUiConfig2,
|
|
1427
1498
|
useVenueEvent as useVenueEvent2
|
|
1428
1499
|
} from "@agg-build/hooks";
|
|
1429
|
-
import { useEffect as
|
|
1500
|
+
import { useEffect as useEffect3, useMemo as useMemo5, useRef as useRef3, useState as useState3 } from "react";
|
|
1430
1501
|
|
|
1431
1502
|
// src/primitives/chart/chart-type-switch.tsx
|
|
1432
1503
|
import { useLabels as useLabels3 } from "@agg-build/hooks";
|
|
@@ -1602,7 +1673,7 @@ var filterChartVenueOutcomesByRenderableVenues = ({
|
|
|
1602
1673
|
|
|
1603
1674
|
// src/events/item-details/event-list-item-details-market-selector.tsx
|
|
1604
1675
|
import { useLabels as useLabels4 } from "@agg-build/hooks";
|
|
1605
|
-
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";
|
|
1606
1677
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1607
1678
|
var MARKET_PILL_MAX_ROWS = 2;
|
|
1608
1679
|
var MARKET_PILL_FALLBACK_CONTAINER_WIDTH = 640;
|
|
@@ -1699,12 +1770,12 @@ var EventListItemDetailsMarketSelector = ({
|
|
|
1699
1770
|
}) => {
|
|
1700
1771
|
var _a;
|
|
1701
1772
|
const labels = useLabels4();
|
|
1702
|
-
const containerRef =
|
|
1703
|
-
const measurementContainerRef =
|
|
1704
|
-
const moreButtonRef =
|
|
1705
|
-
const dropdownInputRef =
|
|
1706
|
-
const moreButtonMeasureRef =
|
|
1707
|
-
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({});
|
|
1708
1779
|
const [layout, setLayout] = useState2(() => ({
|
|
1709
1780
|
visibleItems: options,
|
|
1710
1781
|
hiddenItems: []
|
|
@@ -1728,8 +1799,8 @@ var EventListItemDetailsMarketSelector = ({
|
|
|
1728
1799
|
if (!normalizedSearchValue) return options;
|
|
1729
1800
|
return options.filter((option) => option.label.toLowerCase().includes(normalizedSearchValue));
|
|
1730
1801
|
}, [options, searchValue]);
|
|
1731
|
-
const lastMeasuredKeyRef =
|
|
1732
|
-
const measureFrameRef =
|
|
1802
|
+
const lastMeasuredKeyRef = useRef2(null);
|
|
1803
|
+
const measureFrameRef = useRef2(null);
|
|
1733
1804
|
useLayoutEffect(() => {
|
|
1734
1805
|
const measureLayout = () => {
|
|
1735
1806
|
var _a2, _b, _c, _d, _e;
|
|
@@ -1811,7 +1882,7 @@ var EventListItemDetailsMarketSelector = ({
|
|
|
1811
1882
|
}
|
|
1812
1883
|
};
|
|
1813
1884
|
}, [moreButtonLabel, options]);
|
|
1814
|
-
|
|
1885
|
+
useEffect2(() => {
|
|
1815
1886
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
1816
1887
|
const mediaQueryList = window.matchMedia(MOBILE_TABS_MEDIA_QUERY);
|
|
1817
1888
|
const handleMediaQueryChange = (event) => {
|
|
@@ -1829,7 +1900,7 @@ var EventListItemDetailsMarketSelector = ({
|
|
|
1829
1900
|
mediaQueryList.removeListener(handleMediaQueryChange);
|
|
1830
1901
|
};
|
|
1831
1902
|
}, []);
|
|
1832
|
-
|
|
1903
|
+
useEffect2(() => {
|
|
1833
1904
|
if (!isDropdownOpen) {
|
|
1834
1905
|
setSearchValue("");
|
|
1835
1906
|
return;
|
|
@@ -1878,7 +1949,7 @@ var EventListItemDetailsMarketSelector = ({
|
|
|
1878
1949
|
resizeObserver.disconnect();
|
|
1879
1950
|
};
|
|
1880
1951
|
}, [isDropdownOpen, isMobileViewport, moreButtonLabel]);
|
|
1881
|
-
|
|
1952
|
+
useEffect2(() => {
|
|
1882
1953
|
if (!isDropdownOpen) return;
|
|
1883
1954
|
const handlePointerDown = (event) => {
|
|
1884
1955
|
var _a2;
|
|
@@ -2238,7 +2309,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
2238
2309
|
const [chartOutcomeLabel, setChartOutcomeLabel] = useState3(
|
|
2239
2310
|
(_c = (_b = (_a = tradingContext == null ? void 0 : tradingContext.selectedOutcome) == null ? void 0 : _a.label) == null ? void 0 : _b.trim()) != null ? _c : null
|
|
2240
2311
|
);
|
|
2241
|
-
|
|
2312
|
+
useEffect3(() => {
|
|
2242
2313
|
var _a2, _b2, _c2;
|
|
2243
2314
|
if (chartOutcomeLabel != null) return;
|
|
2244
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;
|
|
@@ -2297,11 +2368,11 @@ var EventListItemDetailsGraphSection = ({
|
|
|
2297
2368
|
// of refetching every time the bucket boundary advances.
|
|
2298
2369
|
rangeKey: rollingWindow.range
|
|
2299
2370
|
});
|
|
2300
|
-
const hasAutoFallenBackRangeRef =
|
|
2301
|
-
|
|
2371
|
+
const hasAutoFallenBackRangeRef = useRef3(false);
|
|
2372
|
+
useEffect3(() => {
|
|
2302
2373
|
hasAutoFallenBackRangeRef.current = false;
|
|
2303
2374
|
}, [chartPrimaryOutcomeId]);
|
|
2304
|
-
|
|
2375
|
+
useEffect3(() => {
|
|
2305
2376
|
if (!shouldAutoFallbackToAllRange({
|
|
2306
2377
|
chartData: scopedMarketChartData,
|
|
2307
2378
|
isLoading: isScopedMarketChartLoading,
|
|
@@ -2388,7 +2459,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
2388
2459
|
transformProbability: (v) => v
|
|
2389
2460
|
});
|
|
2390
2461
|
}, [activeGraphVenue, scopedMarketChartData]);
|
|
2391
|
-
|
|
2462
|
+
useEffect3(() => {
|
|
2392
2463
|
if (!selectedGraphVenue) return;
|
|
2393
2464
|
const hasSelectedGraphVenue = chartAvailableVenueOutcomes.some(
|
|
2394
2465
|
(item) => item.venue === selectedGraphVenue
|
|
@@ -2551,8 +2622,8 @@ var EventListItemDetailsContent = ({
|
|
|
2551
2622
|
}) => {
|
|
2552
2623
|
var _a, _b, _c, _d;
|
|
2553
2624
|
const [selectedChartType, setSelectedChartType] = useState3("line");
|
|
2554
|
-
const lastAppliedEventSyncKeyRef =
|
|
2555
|
-
const lastAppliedDefaultRef =
|
|
2625
|
+
const lastAppliedEventSyncKeyRef = useRef3(null);
|
|
2626
|
+
const lastAppliedDefaultRef = useRef3(null);
|
|
2556
2627
|
const [chartRangeOverride, setChartRangeOverride] = useState3(null);
|
|
2557
2628
|
const config = useSdkUiConfig2();
|
|
2558
2629
|
const labels = useLabels5();
|
|
@@ -2607,10 +2678,10 @@ var EventListItemDetailsContent = ({
|
|
|
2607
2678
|
fallbackRange: defaultTimeRange != null ? defaultTimeRange : config.chart.selectedChartTimeRange
|
|
2608
2679
|
});
|
|
2609
2680
|
}, [config.chart.selectedChartTimeRange, defaultTimeRange, event, scopedSelectedMarket]);
|
|
2610
|
-
|
|
2681
|
+
useEffect3(() => {
|
|
2611
2682
|
setChartRangeOverride(initialChartTimeRange);
|
|
2612
2683
|
}, [event.id, initialChartTimeRange, scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id]);
|
|
2613
|
-
|
|
2684
|
+
useEffect3(() => {
|
|
2614
2685
|
if (!tradingContext) return;
|
|
2615
2686
|
if (lastAppliedEventSyncKeyRef.current === eventSyncKey) return;
|
|
2616
2687
|
if ((tradingContext == null ? void 0 : tradingContext.selectedEventId) !== event.id) {
|
|
@@ -2620,7 +2691,7 @@ var EventListItemDetailsContent = ({
|
|
|
2620
2691
|
}
|
|
2621
2692
|
lastAppliedEventSyncKeyRef.current = eventSyncKey;
|
|
2622
2693
|
}, [event, eventSyncKey, tradingContext]);
|
|
2623
|
-
|
|
2694
|
+
useEffect3(() => {
|
|
2624
2695
|
if (!tradingContext) return;
|
|
2625
2696
|
if (!defaultMarketId) return;
|
|
2626
2697
|
if (tradingContext.selectedEventId !== event.id) return;
|
|
@@ -2964,7 +3035,7 @@ var orderbookDefaultLabels = {
|
|
|
2964
3035
|
};
|
|
2965
3036
|
|
|
2966
3037
|
// src/events/orderbook/use-center-orderbook-spread.ts
|
|
2967
|
-
import { useCallback as useCallback2, useLayoutEffect as useLayoutEffect2, useRef as
|
|
3038
|
+
import { useCallback as useCallback2, useLayoutEffect as useLayoutEffect2, useRef as useRef4 } from "react";
|
|
2968
3039
|
var maxAutoCenterAttempts = 12;
|
|
2969
3040
|
var userScrollKeys = /* @__PURE__ */ new Set(["ArrowDown", "ArrowUp", "PageDown", "PageUp", "Home", "End", " "]);
|
|
2970
3041
|
var useCenterOrderbookSpread = ({
|
|
@@ -2975,9 +3046,9 @@ var useCenterOrderbookSpread = ({
|
|
|
2975
3046
|
rowCount,
|
|
2976
3047
|
enabled = true
|
|
2977
3048
|
}) => {
|
|
2978
|
-
const hasUserScrolledRef =
|
|
2979
|
-
const animationFrameRef =
|
|
2980
|
-
const retryCountRef =
|
|
3049
|
+
const hasUserScrolledRef = useRef4(false);
|
|
3050
|
+
const animationFrameRef = useRef4(null);
|
|
3051
|
+
const retryCountRef = useRef4(0);
|
|
2981
3052
|
const resetKey = marketId != null ? marketId : "";
|
|
2982
3053
|
const cancelPendingFrame = useCallback2(() => {
|
|
2983
3054
|
if (animationFrameRef.current === null) return;
|
|
@@ -3107,7 +3178,7 @@ var useCenterOrderbookSpread = ({
|
|
|
3107
3178
|
|
|
3108
3179
|
// src/events/orderbook/index.tsx
|
|
3109
3180
|
import { sortVenues as sortVenues3, useAggUiConfig } from "@agg-build/hooks";
|
|
3110
|
-
import { useEffect as
|
|
3181
|
+
import { useEffect as useEffect4, useRef as useRef5 } from "react";
|
|
3111
3182
|
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3112
3183
|
var OrderbookVenueLogos = ({ venues }) => {
|
|
3113
3184
|
const visible = sortVenues3(venues).slice(0, orderbookMaxVisibleVenues);
|
|
@@ -3216,8 +3287,8 @@ var Orderbook = ({
|
|
|
3216
3287
|
var _a, _b, _c, _d, _e;
|
|
3217
3288
|
const { enableWebsocketsLogs } = useAggUiConfig();
|
|
3218
3289
|
const labels = __spreadValues(__spreadValues({}, orderbookDefaultLabels), labelsProp);
|
|
3219
|
-
const scrollContainerRef =
|
|
3220
|
-
const spreadRowRef =
|
|
3290
|
+
const scrollContainerRef = useRef5(null);
|
|
3291
|
+
const spreadRowRef = useRef5(null);
|
|
3221
3292
|
const autoCenterMarketId = (_a = marketId != null ? marketId : outcomeId) != null ? _a : null;
|
|
3222
3293
|
const maxVisibleRows = Math.max(1, visibleRows);
|
|
3223
3294
|
const totalVisibleRows = maxVisibleRows * 2 + 1;
|
|
@@ -3234,7 +3305,7 @@ var Orderbook = ({
|
|
|
3234
3305
|
const spreadEntry = entries.find(
|
|
3235
3306
|
(e) => e.kind === "spread"
|
|
3236
3307
|
);
|
|
3237
|
-
|
|
3308
|
+
useEffect4(() => {
|
|
3238
3309
|
var _a2, _b2;
|
|
3239
3310
|
if (!enableWebsocketsLogs) return;
|
|
3240
3311
|
console.debug("[AggUI][orderbook] component_rendered", {
|
|
@@ -3435,7 +3506,7 @@ import {
|
|
|
3435
3506
|
useVenueMarkets as useVenueMarkets2,
|
|
3436
3507
|
useViewportMidpoints
|
|
3437
3508
|
} from "@agg-build/hooks";
|
|
3438
|
-
import { useEffect as
|
|
3509
|
+
import { useEffect as useEffect6, useId, useMemo as useMemo7, useState as useState5 } from "react";
|
|
3439
3510
|
|
|
3440
3511
|
// src/events/shared/select-best-outcome.ts
|
|
3441
3512
|
var normalizeOutcomeLabel2 = (label) => {
|
|
@@ -3667,7 +3738,7 @@ import {
|
|
|
3667
3738
|
useRollingChartWindow as useRollingChartWindow2,
|
|
3668
3739
|
useSdkUiConfig as useSdkUiConfig3
|
|
3669
3740
|
} from "@agg-build/hooks";
|
|
3670
|
-
import { useEffect as
|
|
3741
|
+
import { useEffect as useEffect5, useMemo as useMemo6, useRef as useRef6, useState as useState4 } from "react";
|
|
3671
3742
|
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3672
3743
|
var MarketDetailsGraphPanel = ({
|
|
3673
3744
|
venueMarkets,
|
|
@@ -3734,12 +3805,12 @@ var MarketDetailsGraphPanel = ({
|
|
|
3734
3805
|
// instead of refetching on every bucket-boundary rollover.
|
|
3735
3806
|
rangeKey: rollingWindow.range
|
|
3736
3807
|
});
|
|
3737
|
-
const hasAutoFallenBackRangeRef =
|
|
3738
|
-
|
|
3808
|
+
const hasAutoFallenBackRangeRef = useRef6(false);
|
|
3809
|
+
useEffect5(() => {
|
|
3739
3810
|
hasAutoFallenBackRangeRef.current = false;
|
|
3740
3811
|
setChartRangeOverride(null);
|
|
3741
3812
|
}, [chartPrimaryOutcomeId]);
|
|
3742
|
-
|
|
3813
|
+
useEffect5(() => {
|
|
3743
3814
|
if (!shouldAutoFallbackToAllRange({
|
|
3744
3815
|
chartData: marketChartData,
|
|
3745
3816
|
isLoading: isMarketChartLoading,
|
|
@@ -3805,7 +3876,7 @@ var MarketDetailsGraphPanel = ({
|
|
|
3805
3876
|
});
|
|
3806
3877
|
}, [marketChartData, selectedGraphVenue]);
|
|
3807
3878
|
const hasChartError = !!marketChartError;
|
|
3808
|
-
|
|
3879
|
+
useEffect5(() => {
|
|
3809
3880
|
if (!selectedGraphVenue) {
|
|
3810
3881
|
return;
|
|
3811
3882
|
}
|
|
@@ -4140,10 +4211,10 @@ var MarketDetailsContent = ({
|
|
|
4140
4211
|
() => resolveInitialTab(defaultTab)
|
|
4141
4212
|
);
|
|
4142
4213
|
const [isOpened, setIsOpened] = useState5(controlledIsOpened);
|
|
4143
|
-
|
|
4214
|
+
useEffect6(() => {
|
|
4144
4215
|
setSelectedTab(resolveInitialTab(defaultTab));
|
|
4145
4216
|
}, [defaultTab]);
|
|
4146
|
-
|
|
4217
|
+
useEffect6(() => {
|
|
4147
4218
|
setIsOpened(controlledIsOpened);
|
|
4148
4219
|
}, [controlledIsOpened]);
|
|
4149
4220
|
const effectiveSelectedTab = isResolvedMarket ? "graph" : selectedTab;
|
|
@@ -4169,7 +4240,7 @@ var MarketDetailsContent = ({
|
|
|
4169
4240
|
const selectedOutcomeId = scopedSelectedOutcomeState.outcomeId;
|
|
4170
4241
|
const selectedOutcomeLabel = (_d = scopedSelectedOutcomeState.outcomeLabel) != null ? _d : null;
|
|
4171
4242
|
const selectOutcome = tradingContext == null ? void 0 : tradingContext.selectOutcome;
|
|
4172
|
-
|
|
4243
|
+
useEffect6(() => {
|
|
4173
4244
|
var _a2;
|
|
4174
4245
|
if (!isOpened || !model) return;
|
|
4175
4246
|
if (isOutcomeSelectionLocked) return;
|
|
@@ -4671,7 +4742,7 @@ var MarketDetailsContent = ({
|
|
|
4671
4742
|
value: selectedTab === "other" ? "order-book" : selectedTab,
|
|
4672
4743
|
onChange: (nextValue) => setSelectedTab(nextValue),
|
|
4673
4744
|
variant: "underline",
|
|
4674
|
-
className: "agg-market-tabs w-full px-5"
|
|
4745
|
+
className: "agg-market-tabs flex! w-full px-5"
|
|
4675
4746
|
}
|
|
4676
4747
|
) }),
|
|
4677
4748
|
/* @__PURE__ */ jsx10("div", { className: "h-px w-full bg-agg-separator" })
|
|
@@ -4907,7 +4978,7 @@ var MarketDetailsList = ({
|
|
|
4907
4978
|
);
|
|
4908
4979
|
}, [displayedMarkets]);
|
|
4909
4980
|
const { prices: midpointsFallback, venueByOutcomeId: midpointsFallbackVenues } = useViewportMidpoints(midpointEligibleMarkets);
|
|
4910
|
-
|
|
4981
|
+
useEffect6(() => {
|
|
4911
4982
|
if (isResolvedEvent) {
|
|
4912
4983
|
setAreResolvedMarketsVisible(false);
|
|
4913
4984
|
return;
|
|
@@ -4916,7 +4987,7 @@ var MarketDetailsList = ({
|
|
|
4916
4987
|
setAreResolvedMarketsVisible(false);
|
|
4917
4988
|
}
|
|
4918
4989
|
}, [groupedMarkets.resolved.length, isResolvedEvent]);
|
|
4919
|
-
|
|
4990
|
+
useEffect6(() => {
|
|
4920
4991
|
if (displayedMarkets.length === 0) return;
|
|
4921
4992
|
if (selectedMarketId && displayedMarkets.some((market) => market.id === selectedMarketId)) {
|
|
4922
4993
|
return;
|
|
@@ -4933,7 +5004,7 @@ var MarketDetailsList = ({
|
|
|
4933
5004
|
if (!autoSelectFallbackMarket) return;
|
|
4934
5005
|
tradingContext == null ? void 0 : tradingContext.selectMarket(fallbackSelectableMarket.id, fallbackSelectableMarket);
|
|
4935
5006
|
}, [autoSelectFallbackMarket, displayedMarkets, selectedMarketId, sourceMarkets, tradingContext]);
|
|
4936
|
-
|
|
5007
|
+
useEffect6(() => {
|
|
4937
5008
|
if (!expandedMarketId) return;
|
|
4938
5009
|
if (displayedMarkets.some((market) => market.id === expandedMarketId)) return;
|
|
4939
5010
|
setExpandedMarketId(null);
|
|
@@ -5053,7 +5124,7 @@ import {
|
|
|
5053
5124
|
} from "@agg-build/hooks";
|
|
5054
5125
|
import { VENUES } from "@agg-build/sdk";
|
|
5055
5126
|
import * as Dialog from "@radix-ui/react-dialog";
|
|
5056
|
-
import { useEffect as
|
|
5127
|
+
import { useEffect as useEffect8, useMemo as useMemo10, useRef as useRef8, useState as useState7 } from "react";
|
|
5057
5128
|
|
|
5058
5129
|
// src/events/list/category-sidebar.tsx
|
|
5059
5130
|
import { useMemo as useMemo8 } from "react";
|
|
@@ -5174,7 +5245,8 @@ CategorySidebar.displayName = "CategorySidebar";
|
|
|
5174
5245
|
|
|
5175
5246
|
// src/events/list/event-list-tabs.tsx
|
|
5176
5247
|
import { getVenueAvailabilityState, useAppConfig, useGeoBlock, useLabels as useLabels8 } from "@agg-build/hooks";
|
|
5177
|
-
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";
|
|
5178
5250
|
|
|
5179
5251
|
// src/events/list/event-list.constants.ts
|
|
5180
5252
|
import { MatchStatus, Venue as Venue2 } from "@agg-build/sdk";
|
|
@@ -5198,12 +5270,6 @@ var getDefaultEventListTabs = (labels) => {
|
|
|
5198
5270
|
venueLogo: Venue2.polymarket,
|
|
5199
5271
|
venues: [Venue2.polymarket]
|
|
5200
5272
|
},
|
|
5201
|
-
{
|
|
5202
|
-
value: Venue2.kalshi,
|
|
5203
|
-
label: labels.venues.kalshi,
|
|
5204
|
-
venueLogo: Venue2.kalshi,
|
|
5205
|
-
venues: [Venue2.kalshi]
|
|
5206
|
-
},
|
|
5207
5273
|
{
|
|
5208
5274
|
value: Venue2.limitless,
|
|
5209
5275
|
label: labels.venues.limitless,
|
|
@@ -5267,6 +5333,7 @@ var useEventListTabs = (tabs) => {
|
|
|
5267
5333
|
const baseTabs = tabs != null ? tabs : getDefaultEventListTabs(labels);
|
|
5268
5334
|
return baseTabs.flatMap((tab) => {
|
|
5269
5335
|
if (!tab.venueLogo) return [tab];
|
|
5336
|
+
if (!isVenueActive(tab.venueLogo)) return [];
|
|
5270
5337
|
const availabilityState = getVenueAvailabilityState({
|
|
5271
5338
|
venueId: tab.venueLogo,
|
|
5272
5339
|
disabledVenues,
|
|
@@ -5292,7 +5359,7 @@ var EventListTabs = ({
|
|
|
5292
5359
|
overflowBehavior
|
|
5293
5360
|
}) => {
|
|
5294
5361
|
const resolvedTabs = useEventListTabs(tabs);
|
|
5295
|
-
|
|
5362
|
+
useEffect7(() => {
|
|
5296
5363
|
const fallbackTab = resolvedTabs.find((tab) => !tab.disabled);
|
|
5297
5364
|
if (!fallbackTab) return;
|
|
5298
5365
|
if (resolvedTabs.some((tab) => tab.value === activeTab && !tab.disabled)) return;
|
|
@@ -5324,9 +5391,9 @@ var EventListTabs = ({
|
|
|
5324
5391
|
};
|
|
5325
5392
|
EventListTabs.displayName = "EventListTabs";
|
|
5326
5393
|
var useEventListTabsHeaderOverflow = (recomputeOn, options) => {
|
|
5327
|
-
const headerRef =
|
|
5328
|
-
const titleRef =
|
|
5329
|
-
const requiredTabsWidthRef =
|
|
5394
|
+
const headerRef = useRef7(null);
|
|
5395
|
+
const titleRef = useRef7(null);
|
|
5396
|
+
const requiredTabsWidthRef = useRef7(0);
|
|
5330
5397
|
const [shouldUseSelectOverflow, setShouldUseSelectOverflow] = useState6(false);
|
|
5331
5398
|
const updateTabsOverflowBehavior = useCallback3(() => {
|
|
5332
5399
|
var _a;
|
|
@@ -5365,10 +5432,10 @@ var useEventListTabsHeaderOverflow = (recomputeOn, options) => {
|
|
|
5365
5432
|
if (requiredTabsWidthRef.current <= 0) return;
|
|
5366
5433
|
setShouldUseSelectOverflow(requiredTabsWidthRef.current > availableTabsWidth);
|
|
5367
5434
|
}, [options == null ? void 0 : options.minTabsInlineWidthForSelect, options == null ? void 0 : options.preferSelectOnOverflow]);
|
|
5368
|
-
|
|
5435
|
+
useEffect7(() => {
|
|
5369
5436
|
updateTabsOverflowBehavior();
|
|
5370
5437
|
}, [recomputeOn, updateTabsOverflowBehavior]);
|
|
5371
|
-
|
|
5438
|
+
useEffect7(() => {
|
|
5372
5439
|
if (typeof window === "undefined") return;
|
|
5373
5440
|
const handleResize = () => {
|
|
5374
5441
|
updateTabsOverflowBehavior();
|
|
@@ -5378,7 +5445,7 @@ var useEventListTabsHeaderOverflow = (recomputeOn, options) => {
|
|
|
5378
5445
|
window.removeEventListener("resize", handleResize);
|
|
5379
5446
|
};
|
|
5380
5447
|
}, [updateTabsOverflowBehavior]);
|
|
5381
|
-
|
|
5448
|
+
useEffect7(() => {
|
|
5382
5449
|
if (typeof ResizeObserver === "undefined") return;
|
|
5383
5450
|
const headerElement = headerRef.current;
|
|
5384
5451
|
const titleElement = titleRef.current;
|
|
@@ -5499,7 +5566,7 @@ var EventList = ({
|
|
|
5499
5566
|
labels.eventList.sortByTotalVolume
|
|
5500
5567
|
]);
|
|
5501
5568
|
const baseCategoryId = (_c = categoryIds == null ? void 0 : categoryIds[0]) != null ? _c : null;
|
|
5502
|
-
|
|
5569
|
+
useEffect8(() => {
|
|
5503
5570
|
if (!isDiscoveryFiltersEnabled) return;
|
|
5504
5571
|
setCategoryPath([]);
|
|
5505
5572
|
setCollapsedCategoryIds(/* @__PURE__ */ new Set());
|
|
@@ -5630,7 +5697,7 @@ var EventList = ({
|
|
|
5630
5697
|
grouped: showSportsMarkets,
|
|
5631
5698
|
initialPages: initialLoadedPageCount
|
|
5632
5699
|
});
|
|
5633
|
-
|
|
5700
|
+
useEffect8(() => {
|
|
5634
5701
|
if (stateRef) {
|
|
5635
5702
|
stateRef.current = { venueTab: activeTabValue, loadedPageCount };
|
|
5636
5703
|
}
|
|
@@ -5662,8 +5729,8 @@ var EventList = ({
|
|
|
5662
5729
|
const shouldRenderLoadingState = isLoading && !isPlaceholderData && tileEvents.length === 0;
|
|
5663
5730
|
const shouldRenderEmptyState = !isLoading && !isError && tileEvents.length === 0;
|
|
5664
5731
|
const shouldRenderPaginationLoadingItems = shouldPaginate && hasNextPage;
|
|
5665
|
-
const loadMoreRef =
|
|
5666
|
-
|
|
5732
|
+
const loadMoreRef = useRef8(null);
|
|
5733
|
+
useEffect8(() => {
|
|
5667
5734
|
if (!shouldPaginate) return;
|
|
5668
5735
|
if (!hasNextPage) return;
|
|
5669
5736
|
if (typeof IntersectionObserver === "undefined") return;
|