@agg-build/ui 2.2.3 → 2.2.4
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-QM3WWPCV.mjs → chunk-3R2CQTNM.mjs} +71 -37
- package/dist/{chunk-ZRYHWHTD.mjs → chunk-44GSDH2Y.mjs} +2 -2
- package/dist/{chunk-UTXQUOU3.mjs → chunk-6Z5GQ3KL.mjs} +60 -14
- package/dist/{chunk-4QGZ3FWI.mjs → chunk-7OVSGWI7.mjs} +1 -1
- package/dist/{chunk-JOZPXDNZ.mjs → chunk-MXM5PM4A.mjs} +3 -3
- package/dist/{chunk-LPIAEKSZ.mjs → chunk-SG573ODC.mjs} +1 -1
- package/dist/{chunk-TDLI6F55.mjs → chunk-XJTNK3DS.mjs} +127 -17
- package/dist/events.js +125 -45
- package/dist/events.mjs +3 -3
- package/dist/index.js +250 -60
- package/dist/index.mjs +7 -7
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +250 -60
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +59 -13
- package/dist/primitives.mjs +1 -1
- package/dist/trading.mjs +4 -4
- package/dist/types/events/shared/format-event-title.d.mts +21 -6
- package/dist/types/events/shared/format-event-title.d.ts +21 -6
- package/dist/types/pages/event-market/sports-event-market.utils.d.mts +19 -1
- package/dist/types/pages/event-market/sports-event-market.utils.d.ts +19 -1
- package/package.json +3 -3
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
resolveUnifiedOrderBookEntries,
|
|
24
24
|
sortOutcomeSelectorOutcomes,
|
|
25
25
|
useEventTradingContext
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-SG573ODC.mjs";
|
|
27
27
|
import {
|
|
28
28
|
AutocompleteSelect,
|
|
29
29
|
Badge,
|
|
@@ -53,7 +53,6 @@ import {
|
|
|
53
53
|
dedupeVenueMarketsById,
|
|
54
54
|
detailsBaseCardClassName,
|
|
55
55
|
filterEventsByTabValue,
|
|
56
|
-
formatEventTitleWithDateSuffix,
|
|
57
56
|
formatMarketProbabilityPercent,
|
|
58
57
|
formatPriceGapPercent,
|
|
59
58
|
getMarketDetailsTabs,
|
|
@@ -66,6 +65,7 @@ import {
|
|
|
66
65
|
orderBookRowLimitDefault,
|
|
67
66
|
resolveCategoryIdsFromPath,
|
|
68
67
|
resolveDisplayVolume,
|
|
68
|
+
resolveEventHeading,
|
|
69
69
|
resolveEventListItemEvent,
|
|
70
70
|
resolveOutcomeTitle,
|
|
71
71
|
resolveResolvedOutcomeLabel,
|
|
@@ -75,7 +75,7 @@ import {
|
|
|
75
75
|
sortCategoriesForNavigation,
|
|
76
76
|
sortOutcomes,
|
|
77
77
|
splitEventsByLifecycle
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-6Z5GQ3KL.mjs";
|
|
79
79
|
|
|
80
80
|
// src/events/item/index.tsx
|
|
81
81
|
import {
|
|
@@ -376,13 +376,16 @@ var EventListItemContent = ({
|
|
|
376
376
|
const config = useSdkUiConfig();
|
|
377
377
|
const labels = useLabels();
|
|
378
378
|
const allVenueMarkets = useMemo(() => event.venueMarkets, [event.venueMarkets]);
|
|
379
|
-
const
|
|
379
|
+
const eventHeading = resolveEventHeading({
|
|
380
380
|
title: event.title,
|
|
381
381
|
categories: event.categories,
|
|
382
382
|
structureType: event.structureType,
|
|
383
383
|
gameStartTime: event.gameStartTime,
|
|
384
|
-
endDate: event.endDate
|
|
384
|
+
endDate: event.endDate,
|
|
385
|
+
venueMarkets: event.venueMarkets
|
|
385
386
|
});
|
|
387
|
+
const resolvedTitle = eventHeading.title;
|
|
388
|
+
const resolvedTimestamp = eventHeading.timestampLabel;
|
|
386
389
|
const resolvedImage = event.image;
|
|
387
390
|
const visibleVenueLogos = useMemo(() => {
|
|
388
391
|
var _a2;
|
|
@@ -688,10 +691,10 @@ var EventListItemContent = ({
|
|
|
688
691
|
href,
|
|
689
692
|
onClick: handleClick,
|
|
690
693
|
onKeyDown: handleKeyDown,
|
|
691
|
-
"aria-label": ariaLabel != null ? ariaLabel : resolvedTitle,
|
|
694
|
+
"aria-label": ariaLabel != null ? ariaLabel : [resolvedTitle, resolvedTimestamp].filter(Boolean).join(" "),
|
|
692
695
|
withGradient: true,
|
|
693
696
|
children: [
|
|
694
|
-
/* @__PURE__ */ jsxs("div", { className: cn("agg-event-card-header flex
|
|
697
|
+
/* @__PURE__ */ jsxs("div", { className: cn("agg-event-card-header flex items-center gap-4", classNames == null ? void 0 : classNames.header), children: [
|
|
695
698
|
/* @__PURE__ */ jsx(
|
|
696
699
|
RemoteImage,
|
|
697
700
|
{
|
|
@@ -703,19 +706,32 @@ var EventListItemContent = ({
|
|
|
703
706
|
}
|
|
704
707
|
}
|
|
705
708
|
),
|
|
706
|
-
/* @__PURE__ */ jsx(
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
709
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1 self-stretch", children: /* @__PURE__ */ jsxs("div", { className: "flex h-12 min-w-0 flex-col justify-center", children: [
|
|
710
|
+
/* @__PURE__ */ jsx(
|
|
711
|
+
Typography,
|
|
712
|
+
{
|
|
713
|
+
variant: "body-strong",
|
|
714
|
+
className: cn(
|
|
715
|
+
"agg-event-title",
|
|
716
|
+
"min-w-0 text-agg-base font-agg-bold leading-agg-6",
|
|
717
|
+
resolvedTimestamp ? "truncate whitespace-nowrap" : "text-wrap wrap-break-word line-clamp-2",
|
|
718
|
+
classNames == null ? void 0 : classNames.title
|
|
719
|
+
),
|
|
720
|
+
children: resolvedTitle
|
|
721
|
+
}
|
|
722
|
+
),
|
|
723
|
+
resolvedTimestamp ? /* @__PURE__ */ jsx("div", { className: "agg-event-timestamp-row mt-0.5 h-5 min-w-0", children: /* @__PURE__ */ jsx(
|
|
724
|
+
Typography,
|
|
725
|
+
{
|
|
726
|
+
variant: "body",
|
|
727
|
+
className: cn(
|
|
728
|
+
"agg-event-timestamp min-w-0 truncate",
|
|
729
|
+
"text-agg-sm leading-agg-5 text-agg-muted-foreground"
|
|
730
|
+
),
|
|
731
|
+
children: resolvedTimestamp
|
|
732
|
+
}
|
|
733
|
+
) }) : null
|
|
734
|
+
] }) })
|
|
719
735
|
] }),
|
|
720
736
|
/* @__PURE__ */ jsxs(
|
|
721
737
|
"div",
|
|
@@ -2561,19 +2577,27 @@ var EventListItemDetailsContent = ({
|
|
|
2561
2577
|
return `${config.formatting.formatCompactCurrency(resolvedVolume)} ${labels.eventItemDetails.volumeSuffix}`;
|
|
2562
2578
|
}, [config, event.volume, labels.eventItemDetails.volumeSuffix, venueMarkets]);
|
|
2563
2579
|
const resolvedTitle = useMemo5(() => {
|
|
2564
|
-
return
|
|
2580
|
+
return resolveEventHeading({
|
|
2565
2581
|
title: event.title,
|
|
2566
2582
|
categories: event.categories,
|
|
2567
2583
|
structureType: event.structureType,
|
|
2568
2584
|
gameStartTime: event.gameStartTime,
|
|
2569
|
-
endDate: event.endDate
|
|
2585
|
+
endDate: event.endDate,
|
|
2586
|
+
venueMarkets: event.venueMarkets
|
|
2570
2587
|
});
|
|
2571
|
-
}, [
|
|
2588
|
+
}, [
|
|
2589
|
+
event.categories,
|
|
2590
|
+
event.endDate,
|
|
2591
|
+
event.gameStartTime,
|
|
2592
|
+
event.structureType,
|
|
2593
|
+
event.title,
|
|
2594
|
+
event.venueMarkets
|
|
2595
|
+
]);
|
|
2572
2596
|
return /* @__PURE__ */ jsxs4(
|
|
2573
2597
|
Card,
|
|
2574
2598
|
{
|
|
2575
2599
|
className: cn("group/agg-event-details", detailsBaseCardClassName, classNames == null ? void 0 : classNames.root),
|
|
2576
|
-
"aria-label": ariaLabel != null ? ariaLabel : resolvedTitle,
|
|
2600
|
+
"aria-label": ariaLabel != null ? ariaLabel : [resolvedTitle.title, resolvedTitle.timestampLabel].filter(Boolean).join(" "),
|
|
2577
2601
|
onClick: () => {
|
|
2578
2602
|
onClick == null ? void 0 : onClick(event);
|
|
2579
2603
|
},
|
|
@@ -2598,19 +2622,29 @@ var EventListItemDetailsContent = ({
|
|
|
2598
2622
|
}
|
|
2599
2623
|
),
|
|
2600
2624
|
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [
|
|
2601
|
-
/* @__PURE__ */
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2625
|
+
/* @__PURE__ */ jsxs4("div", { className: "min-w-0", children: [
|
|
2626
|
+
/* @__PURE__ */ jsx5(
|
|
2627
|
+
Typography,
|
|
2628
|
+
{
|
|
2629
|
+
variant: "body-strong",
|
|
2630
|
+
className: cn(
|
|
2631
|
+
"agg-event-title",
|
|
2632
|
+
"min-w-0 text-agg-base font-agg-bold! leading-agg-6 md:text-agg-2xl md:leading-agg-8",
|
|
2633
|
+
resolvedTitle.timestampLabel ? "truncate whitespace-nowrap" : "truncate text-wrap wrap-break-word line-clamp-2",
|
|
2634
|
+
classNames == null ? void 0 : classNames.title
|
|
2635
|
+
),
|
|
2636
|
+
children: resolvedTitle.title
|
|
2637
|
+
}
|
|
2638
|
+
),
|
|
2639
|
+
resolvedTitle.timestampLabel ? /* @__PURE__ */ jsx5(
|
|
2640
|
+
Typography,
|
|
2641
|
+
{
|
|
2642
|
+
variant: "body",
|
|
2643
|
+
className: "agg-event-timestamp mt-0.5 min-w-0 truncate text-agg-sm leading-agg-5 text-agg-muted-foreground",
|
|
2644
|
+
children: resolvedTitle.timestampLabel
|
|
2645
|
+
}
|
|
2646
|
+
) : null
|
|
2647
|
+
] }),
|
|
2614
2648
|
venueMarkets.length > 1 ? /* @__PURE__ */ jsx5(
|
|
2615
2649
|
EventListItemDetailsMarketSelector,
|
|
2616
2650
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
dispatchAggDepositNotification
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7OVSGWI7.mjs";
|
|
5
5
|
import {
|
|
6
6
|
BestPricesIcon,
|
|
7
7
|
BoltIcon,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
shortenAddress,
|
|
42
42
|
useOptionalToast,
|
|
43
43
|
venueLogoLabels
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-6Z5GQ3KL.mjs";
|
|
45
45
|
|
|
46
46
|
// src/deposit/index.tsx
|
|
47
47
|
import { useAggAuthState, useAggUiConfig, useDepositAddresses, useLabels as useLabels11 } from "@agg-build/hooks";
|
|
@@ -6728,23 +6728,69 @@ var isSportEvent = (categories, structureType) => {
|
|
|
6728
6728
|
return isSportCategoryToken(categoryEntry.id) || isSportCategoryToken((_a2 = categoryEntry.category) == null ? void 0 : _a2.id) || isSportCategoryToken((_b = categoryEntry.category) == null ? void 0 : _b.name) || isSportCategoryToken((_c = categoryEntry.category) == null ? void 0 : _c.displayName) || isSportCategoryToken((_d = categoryEntry.category) == null ? void 0 : _d.parentId);
|
|
6729
6729
|
})) != null ? _a : false;
|
|
6730
6730
|
};
|
|
6731
|
-
var
|
|
6732
|
-
|
|
6731
|
+
var hasFixtureMarketMetadata = (venueMarkets) => {
|
|
6732
|
+
var _a;
|
|
6733
|
+
return (_a = venueMarkets == null ? void 0 : venueMarkets.some((venueMarket) => {
|
|
6734
|
+
var _a2, _b, _c, _d;
|
|
6735
|
+
return Boolean(
|
|
6736
|
+
((_a2 = venueMarket.sportsMarketType) == null ? void 0 : _a2.trim()) || ((_b = venueMarket.marketCategory) == null ? void 0 : _b.trim()) || ((_c = venueMarket.marketSubtype) == null ? void 0 : _c.trim()) || ((_d = venueMarket.period) == null ? void 0 : _d.trim()) || venueMarket.lineValue != null
|
|
6737
|
+
);
|
|
6738
|
+
})) != null ? _a : false;
|
|
6739
|
+
};
|
|
6740
|
+
var shouldDisplaySportsEventTimestamp = ({
|
|
6733
6741
|
categories,
|
|
6734
6742
|
structureType,
|
|
6743
|
+
venueMarkets
|
|
6744
|
+
}) => {
|
|
6745
|
+
if (!isSportEvent(categories, structureType)) return false;
|
|
6746
|
+
if (structureType === "sport") {
|
|
6747
|
+
return true;
|
|
6748
|
+
}
|
|
6749
|
+
if (typeof structureType === "string" && structureType.trim()) {
|
|
6750
|
+
return false;
|
|
6751
|
+
}
|
|
6752
|
+
return hasFixtureMarketMetadata(venueMarkets);
|
|
6753
|
+
};
|
|
6754
|
+
var resolveSportsEventTimestamp = ({
|
|
6735
6755
|
gameStartTime,
|
|
6736
6756
|
endDate
|
|
6757
|
+
}) => {
|
|
6758
|
+
return (gameStartTime == null ? void 0 : gameStartTime.trim()) || (endDate == null ? void 0 : endDate.trim()) || null;
|
|
6759
|
+
};
|
|
6760
|
+
var resolveEventTimestampLabel = ({
|
|
6761
|
+
categories,
|
|
6762
|
+
structureType,
|
|
6763
|
+
gameStartTime,
|
|
6764
|
+
endDate,
|
|
6765
|
+
venueMarkets
|
|
6766
|
+
}) => {
|
|
6767
|
+
if (!shouldDisplaySportsEventTimestamp({ categories, structureType, venueMarkets })) {
|
|
6768
|
+
return null;
|
|
6769
|
+
}
|
|
6770
|
+
const timestamp = resolveSportsEventTimestamp({ gameStartTime, endDate });
|
|
6771
|
+
if (!timestamp) return null;
|
|
6772
|
+
return formatSportsEventTimeEt(timestamp);
|
|
6773
|
+
};
|
|
6774
|
+
var resolveEventHeading = ({
|
|
6775
|
+
title: title2,
|
|
6776
|
+
categories,
|
|
6777
|
+
structureType,
|
|
6778
|
+
gameStartTime,
|
|
6779
|
+
endDate,
|
|
6780
|
+
venueMarkets
|
|
6737
6781
|
}) => {
|
|
6738
6782
|
const resolvedTitle = title2.trim();
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6783
|
+
return {
|
|
6784
|
+
title: resolvedTitle,
|
|
6785
|
+
timestampLabel: resolveEventTimestampLabel({
|
|
6786
|
+
title: resolvedTitle,
|
|
6787
|
+
categories,
|
|
6788
|
+
structureType,
|
|
6789
|
+
gameStartTime,
|
|
6790
|
+
endDate,
|
|
6791
|
+
venueMarkets
|
|
6792
|
+
})
|
|
6793
|
+
};
|
|
6748
6794
|
};
|
|
6749
6795
|
|
|
6750
6796
|
// src/events/item/event-list-item.utils.ts
|
|
@@ -7085,13 +7131,13 @@ var mapVenueEventToSearchResult = (event, labels, formatPercent, formatCompactCu
|
|
|
7085
7131
|
const probability = normalizeProbability(
|
|
7086
7132
|
(_a = options == null ? void 0 : options.priceByOutcomeId) == null ? void 0 : _a.get(visibleOutcome.outcome.id)
|
|
7087
7133
|
);
|
|
7088
|
-
const resolvedTitle =
|
|
7134
|
+
const resolvedTitle = resolveEventHeading({
|
|
7089
7135
|
title: (_b = event == null ? void 0 : event.title) != null ? _b : "",
|
|
7090
7136
|
categories: event.categories,
|
|
7091
7137
|
structureType: event.structureType,
|
|
7092
7138
|
gameStartTime: event.gameStartTime,
|
|
7093
7139
|
endDate: event.endDate
|
|
7094
|
-
});
|
|
7140
|
+
}).title;
|
|
7095
7141
|
if (!resolvedTitle) return null;
|
|
7096
7142
|
const { marketCount, venueCount } = getVenueSummary(event.venueMarkets);
|
|
7097
7143
|
const marketSummaryLabel = [
|
|
@@ -9839,7 +9885,7 @@ export {
|
|
|
9839
9885
|
fallbackLineColors,
|
|
9840
9886
|
VenueLogo,
|
|
9841
9887
|
formatSportsEventTimeEt,
|
|
9842
|
-
|
|
9888
|
+
resolveEventHeading,
|
|
9843
9889
|
normalizeVenueMarketCluster,
|
|
9844
9890
|
resolveEventListItemEvent,
|
|
9845
9891
|
normalizeProbability,
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
getTradingValueLabel,
|
|
9
9
|
getTradingVenueLabel,
|
|
10
10
|
resolveOrderEligibilityMessage
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-SG573ODC.mjs";
|
|
12
12
|
import {
|
|
13
13
|
GeoBlockBanner,
|
|
14
14
|
subscribeAggDepositNotification
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-7OVSGWI7.mjs";
|
|
16
16
|
import {
|
|
17
17
|
AGG_TERMS_OF_SERVICE_URL,
|
|
18
18
|
Button,
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
resolveResolvedOutcomeLabel,
|
|
45
45
|
skeletonViews,
|
|
46
46
|
useOptionalToast
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-6Z5GQ3KL.mjs";
|
|
48
48
|
|
|
49
49
|
// src/trading/types.ts
|
|
50
50
|
import { Venue, enumGuard, isFiniteNonNeg, safeParse } from "@agg-build/sdk";
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
isErrorWithStatus,
|
|
11
11
|
useEventListTabs,
|
|
12
12
|
useEventListTabsHeaderOverflow
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-3R2CQTNM.mjs";
|
|
14
14
|
import {
|
|
15
15
|
DEPOSIT_MODAL_OPEN_EVENT,
|
|
16
16
|
PlaceOrder,
|
|
@@ -18,10 +18,10 @@ import {
|
|
|
18
18
|
WITHDRAW_MODAL_OPEN_EVENT,
|
|
19
19
|
useClaimWinnings,
|
|
20
20
|
useResolvedMarketClaim
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-MXM5PM4A.mjs";
|
|
22
22
|
import {
|
|
23
23
|
getDisplayOutcomePrice
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-SG573ODC.mjs";
|
|
25
25
|
import {
|
|
26
26
|
AggErrorBoundary,
|
|
27
27
|
Button,
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
resolveTabVenus,
|
|
53
53
|
shortenAddress,
|
|
54
54
|
sortCategoriesForNavigation
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-6Z5GQ3KL.mjs";
|
|
56
56
|
|
|
57
57
|
// src/pages/home/index.tsx
|
|
58
58
|
import {
|
|
@@ -485,7 +485,12 @@ var SPORTS_SECTION_TAB_DEFINITIONS = [
|
|
|
485
485
|
{ key: "shots", marketCategory: "shots" },
|
|
486
486
|
{
|
|
487
487
|
key: "other",
|
|
488
|
-
|
|
488
|
+
// `player_props` is deliberately NOT fetched here: goals/assists/shots/corners
|
|
489
|
+
// props already have dedicated tabs (resolveMarketSectionTabKey routes them
|
|
490
|
+
// there by category), so including the group would re-fetch hundreds of props
|
|
491
|
+
// already shown elsewhere. The handful with no stat category (e.g. "saves")
|
|
492
|
+
// are back-filled from the game-wide set in resolveSportsSectionMarkets.
|
|
493
|
+
marketGroup: ["other", "team_props", "specials", "completion"]
|
|
489
494
|
}
|
|
490
495
|
];
|
|
491
496
|
var SPORTS_NON_STANDARD_VISIBLE_TAB_KEYS = ["game_lines", "other"];
|
|
@@ -654,6 +659,13 @@ var resolveSportsSectionMarkets = ({
|
|
|
654
659
|
const filteredSectionMarkets = effectiveSectionMarkets.filter(
|
|
655
660
|
(market) => resolveMarketSectionTabKey(market) === tabKey
|
|
656
661
|
);
|
|
662
|
+
if (tabKey === "other") {
|
|
663
|
+
const seenIds = new Set(filteredSectionMarkets.map((market) => market.id));
|
|
664
|
+
const strayOtherMarkets = eventMarkets.filter(
|
|
665
|
+
(market) => !seenIds.has(market.id) && resolveMarketSectionTabKey(market) === "other"
|
|
666
|
+
);
|
|
667
|
+
return [...filteredSectionMarkets, ...strayOtherMarkets];
|
|
668
|
+
}
|
|
657
669
|
if (tabKey !== "game_lines") return filteredSectionMarkets;
|
|
658
670
|
const eventMoneylineMarkets = (() => {
|
|
659
671
|
const dedupedMarkets = [];
|
|
@@ -709,6 +721,48 @@ var resolveSportsLineFamilyKey = (market) => {
|
|
|
709
721
|
const aggKey = resolveSportsMarketAggKey(market);
|
|
710
722
|
return aggKey ? aggKey.replace(AGGKEY_LINE_TOKEN_PATTERN, "") : "";
|
|
711
723
|
};
|
|
724
|
+
var resolveSpreadFamilyKey = (market) => {
|
|
725
|
+
const aggKey = resolveSportsMarketAggKey(market);
|
|
726
|
+
return aggKey ? aggKey.replace(/_sp_.+$/i, "_sp") : "";
|
|
727
|
+
};
|
|
728
|
+
var resolveSpreadFavoredToken = (market) => {
|
|
729
|
+
var _a, _b, _c;
|
|
730
|
+
const aggKey = resolveSportsMarketAggKey(market);
|
|
731
|
+
return (_c = (_b = (_a = aggKey.match(/_sp_([a-z0-9]+?)_\d+p\d+/i)) == null ? void 0 : _a[1]) == null ? void 0 : _b.toLowerCase()) != null ? _c : null;
|
|
732
|
+
};
|
|
733
|
+
var resolveSpreadHomeToken = (markets) => {
|
|
734
|
+
var _a;
|
|
735
|
+
const tokens = /* @__PURE__ */ new Set();
|
|
736
|
+
let prefix = "";
|
|
737
|
+
for (const market of markets) {
|
|
738
|
+
const token = resolveSpreadFavoredToken(market);
|
|
739
|
+
if (token) tokens.add(token);
|
|
740
|
+
if (!prefix) prefix = (_a = resolveSportsMarketAggKey(market).split("_sp_")[0]) != null ? _a : "";
|
|
741
|
+
}
|
|
742
|
+
if (tokens.size === 0 || !prefix) return null;
|
|
743
|
+
return Array.from(tokens).sort((left, right) => prefix.indexOf(left) - prefix.indexOf(right))[0];
|
|
744
|
+
};
|
|
745
|
+
var SPREAD_NON_TEAM_TITLE_PATTERN = /\b(?:yes|no|over|under|wins?\s+by|reg\.?\s*time|goal\s*diff|more\s+than|less\s+than|halftime|1st\s+half|2nd\s+half|goals?)\b/i;
|
|
746
|
+
var isSpreadTeamTitle = (title) => {
|
|
747
|
+
const trimmed = toTrimmedString(title);
|
|
748
|
+
if (!trimmed || trimmed.length > 24) return false;
|
|
749
|
+
const normalized = trimmed.toLowerCase();
|
|
750
|
+
if (normalized === "yes" || normalized === "no") return false;
|
|
751
|
+
return !SPREAD_NON_TEAM_TITLE_PATTERN.test(trimmed);
|
|
752
|
+
};
|
|
753
|
+
var resolveSpreadOutcomeTeamNames = (activeMarket, groupMarkets) => {
|
|
754
|
+
const aggKey = resolveSportsMarketAggKey(activeMarket);
|
|
755
|
+
const twins = aggKey ? groupMarkets.filter((market) => resolveSportsMarketAggKey(market) === aggKey) : [activeMarket];
|
|
756
|
+
const pickName = (index) => {
|
|
757
|
+
const cleanTitles = twins.map((market) => {
|
|
758
|
+
var _a, _b;
|
|
759
|
+
return toTrimmedString((_b = (_a = market.venueMarketOutcomes) == null ? void 0 : _a[index]) == null ? void 0 : _b.title);
|
|
760
|
+
}).filter((title) => isSpreadTeamTitle(title));
|
|
761
|
+
if (cleanTitles.length === 0) return null;
|
|
762
|
+
return cleanTitles.reduce((longest, title) => title.length > longest.length ? title : longest);
|
|
763
|
+
};
|
|
764
|
+
return { favored: pickName(0), dog: pickName(1) };
|
|
765
|
+
};
|
|
712
766
|
var resolveDisplayGroupFamilyKey = (market) => {
|
|
713
767
|
var _a, _b, _c;
|
|
714
768
|
const normalizedQuestion = sanitizeFamilyValue(toTrimmedString(market.question));
|
|
@@ -723,7 +777,8 @@ var resolveDisplayGroupFamilyKey = (market) => {
|
|
|
723
777
|
}
|
|
724
778
|
const lineFamily = resolveSportsLineFamilyKey(market);
|
|
725
779
|
if (sportsMarketType === "spread") {
|
|
726
|
-
|
|
780
|
+
const spreadFamily = resolveSpreadFamilyKey(market);
|
|
781
|
+
return spreadFamily ? `${period}|spread|${spreadFamily}` : `${period}|spread|${marketCategory}`;
|
|
727
782
|
}
|
|
728
783
|
if (market.lineValue != null || LINE_MARKET_TYPES.has(sportsMarketType)) {
|
|
729
784
|
return lineFamily ? `${period}|${sportsMarketType}|${lineFamily}` : `${period}|${sportsMarketType}|${marketCategory}|${normalizedQuestion}|${outcomeKey}`;
|
|
@@ -883,17 +938,33 @@ var resolveSlideKind = (group) => {
|
|
|
883
938
|
if (group.sportsMarketType === "total") return "total";
|
|
884
939
|
return "other";
|
|
885
940
|
};
|
|
886
|
-
var aggregateSportsLineStops = (markets) => {
|
|
941
|
+
var aggregateSportsLineStops = (markets, isSpread = false) => {
|
|
887
942
|
var _a;
|
|
888
|
-
const
|
|
943
|
+
const homeToken = isSpread ? resolveSpreadHomeToken(markets) : null;
|
|
944
|
+
const axisOf = (market) => {
|
|
945
|
+
var _a2, _b;
|
|
946
|
+
if (homeToken) {
|
|
947
|
+
const favored = resolveSpreadFavoredToken(market);
|
|
948
|
+
if (favored) {
|
|
949
|
+
const magnitude = Math.abs((_a2 = market.lineValue) != null ? _a2 : 0);
|
|
950
|
+
return favored === homeToken ? -magnitude : magnitude;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
return (_b = market.lineValue) != null ? _b : Number.NEGATIVE_INFINITY;
|
|
954
|
+
};
|
|
955
|
+
const displayOf = (market) => {
|
|
956
|
+
var _a2;
|
|
957
|
+
return homeToken ? resolveSelectedSportsLineValue(Math.abs((_a2 = market.lineValue) != null ? _a2 : 0)) : resolveSelectedSportsLineValue(market.lineValue);
|
|
958
|
+
};
|
|
959
|
+
const marketsByAxis = /* @__PURE__ */ new Map();
|
|
889
960
|
for (const market of markets) {
|
|
890
|
-
const
|
|
891
|
-
const lineMarkets = (_a =
|
|
961
|
+
const axis = axisOf(market);
|
|
962
|
+
const lineMarkets = (_a = marketsByAxis.get(axis)) != null ? _a : [];
|
|
892
963
|
lineMarkets.push(market);
|
|
893
|
-
|
|
964
|
+
marketsByAxis.set(axis, lineMarkets);
|
|
894
965
|
}
|
|
895
|
-
return Array.from(
|
|
896
|
-
var _a2
|
|
966
|
+
return Array.from(marketsByAxis.entries()).map(([axis, lineMarkets]) => {
|
|
967
|
+
var _a2;
|
|
897
968
|
const representative = (_a2 = lineMarkets[resolveHighestVolumeIndex(lineMarkets)]) != null ? _a2 : lineMarkets[0];
|
|
898
969
|
const venues = /* @__PURE__ */ new Set();
|
|
899
970
|
for (const lineMarket of lineMarkets) {
|
|
@@ -902,18 +973,18 @@ var aggregateSportsLineStops = (markets) => {
|
|
|
902
973
|
}
|
|
903
974
|
}
|
|
904
975
|
return {
|
|
905
|
-
value,
|
|
976
|
+
value: displayOf(representative),
|
|
906
977
|
representative,
|
|
907
978
|
venues: Array.from(venues),
|
|
908
979
|
volume: resolveTotalGroupVolume(lineMarkets),
|
|
909
|
-
lineValue:
|
|
980
|
+
lineValue: axis
|
|
910
981
|
};
|
|
911
982
|
}).sort(
|
|
912
983
|
(left, right) => left.lineValue !== right.lineValue ? left.lineValue - right.lineValue : left.value.localeCompare(right.value)
|
|
913
984
|
);
|
|
914
985
|
};
|
|
915
986
|
var buildSportsSlideFromGroup = (group) => {
|
|
916
|
-
const lineStops = group.hasLineVariants ? aggregateSportsLineStops(group.markets) : [];
|
|
987
|
+
const lineStops = group.hasLineVariants ? aggregateSportsLineStops(group.markets, group.sportsMarketType === "spread") : [];
|
|
917
988
|
const hasLadder = lineStops.length > 1;
|
|
918
989
|
const stops = hasLadder ? lineStops.map((lineStop) => ({
|
|
919
990
|
value: lineStop.value,
|
|
@@ -1358,6 +1429,45 @@ var SportsMarketCard = ({
|
|
|
1358
1429
|
];
|
|
1359
1430
|
});
|
|
1360
1431
|
}, [combinedMoneylineMarkets, isCombinedMoneylineGroup, midpointsResult]);
|
|
1432
|
+
const spreadHeaderOutcomeItems = useMemo(() => {
|
|
1433
|
+
var _a2;
|
|
1434
|
+
if (slide.kind !== "spread" || !activeMarket) return void 0;
|
|
1435
|
+
const outcomes = (_a2 = activeMarket.venueMarketOutcomes) != null ? _a2 : [];
|
|
1436
|
+
const lineValue = activeMarket.lineValue;
|
|
1437
|
+
if (outcomes.length < 2 || lineValue == null) return void 0;
|
|
1438
|
+
const { favored, dog } = resolveSpreadOutcomeTeamNames(activeMarket, group.markets);
|
|
1439
|
+
if (!favored && !dog) return void 0;
|
|
1440
|
+
const magnitude = Math.abs(lineValue);
|
|
1441
|
+
const formatLine = (value) => `${value > 0 ? "+" : "\u2212"}${Number.isInteger(magnitude) ? String(magnitude) : magnitude.toFixed(1)}`;
|
|
1442
|
+
return [
|
|
1443
|
+
{ index: 0, name: favored, signedLine: -magnitude },
|
|
1444
|
+
{ index: 1, name: dog, signedLine: magnitude }
|
|
1445
|
+
].flatMap(({ index, name, signedLine }) => {
|
|
1446
|
+
var _a3;
|
|
1447
|
+
const outcome = outcomes[index];
|
|
1448
|
+
if (!outcome) return [];
|
|
1449
|
+
const label = name != null ? name : outcome.label.trim();
|
|
1450
|
+
const probability = midpointsResult == null ? void 0 : getDisplayOutcomePrice({
|
|
1451
|
+
outcomeId: outcome.id,
|
|
1452
|
+
outcomeLabel: outcome.label,
|
|
1453
|
+
bestMidpointsByOutcomeId: (_a3 = midpointsResult.bestMidpointsByOutcomeId) != null ? _a3 : midpointsResult.prices
|
|
1454
|
+
});
|
|
1455
|
+
return [
|
|
1456
|
+
{
|
|
1457
|
+
id: outcome.id,
|
|
1458
|
+
label,
|
|
1459
|
+
title: label,
|
|
1460
|
+
lineLabel: formatLine(signedLine),
|
|
1461
|
+
probability,
|
|
1462
|
+
isPriceLoading: (midpointsResult == null ? void 0 : midpointsResult.isLoading) === true && probability == null,
|
|
1463
|
+
tone: index === 0 ? "positive" : "negative",
|
|
1464
|
+
variant: "line",
|
|
1465
|
+
venue: activeMarket.venue
|
|
1466
|
+
}
|
|
1467
|
+
];
|
|
1468
|
+
});
|
|
1469
|
+
}, [slide.kind, activeMarket, group.markets, midpointsResult]);
|
|
1470
|
+
const headerOutcomeItemsOverride = combinedMoneylineHeaderOutcomeItems != null ? combinedMoneylineHeaderOutcomeItems : spreadHeaderOutcomeItems;
|
|
1361
1471
|
const headerOutcomeVariant = isCombinedMoneylineGroup ? "outcome" : resolveSportsMarketCardVariant(activeMarket);
|
|
1362
1472
|
const handleLineSelect = (index) => {
|
|
1363
1473
|
var _a2, _b2;
|
|
@@ -1388,7 +1498,7 @@ var SportsMarketCard = ({
|
|
|
1388
1498
|
compactHeader: true,
|
|
1389
1499
|
subtitleOverride: compactSubtitle,
|
|
1390
1500
|
headerOutcomeVariant,
|
|
1391
|
-
headerOutcomeItemsOverride
|
|
1501
|
+
headerOutcomeItemsOverride,
|
|
1392
1502
|
isOpened: isExpanded,
|
|
1393
1503
|
suppressOutcomeFallbackSelection: activeMarket.id !== (tradingContext == null ? void 0 : tradingContext.selectedMarketId),
|
|
1394
1504
|
onOpenChange: () => onToggle(group.id, activeMarket),
|