@agg-build/ui 2.2.0 → 2.2.2
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-5MRFY5ZQ.mjs → chunk-4QGZ3FWI.mjs} +1 -1
- package/dist/{chunk-DTOI4V6P.mjs → chunk-JGBEQ4IV.mjs} +1151 -953
- package/dist/{chunk-73MO7MYG.mjs → chunk-JOZPXDNZ.mjs} +30 -7
- package/dist/{chunk-TR7HUVY7.mjs → chunk-LPIAEKSZ.mjs} +82 -2
- package/dist/{chunk-BTRFSEPC.mjs → chunk-QM3WWPCV.mjs} +107 -29
- package/dist/{chunk-MIAAL7BL.mjs → chunk-UTXQUOU3.mjs} +98 -4
- package/dist/{chunk-HNLA44SY.mjs → chunk-ZRYHWHTD.mjs} +2 -2
- package/dist/events.js +277 -31
- package/dist/events.mjs +3 -3
- package/dist/index.js +1999 -1533
- package/dist/index.mjs +9 -7
- package/dist/modals.js +2 -2
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +1371 -907
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +4 -3
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +114 -6
- package/dist/trading.mjs +4 -4
- package/dist/types/events/item/event-list-item.types.d.mts +4 -0
- package/dist/types/events/item/event-list-item.types.d.ts +4 -0
- package/dist/types/events/item/event-list-item.utils.d.mts +1 -1
- package/dist/types/events/item/event-list-item.utils.d.ts +1 -1
- package/dist/types/events/item-details/event-list-item-details.types.d.mts +0 -5
- package/dist/types/events/item-details/event-list-item-details.types.d.ts +0 -5
- package/dist/types/events/item-details/event-list-item-details.utils.d.mts +9 -0
- package/dist/types/events/item-details/event-list-item-details.utils.d.ts +9 -0
- package/dist/types/events/shared/event-trading-state.utils.d.mts +4 -2
- package/dist/types/events/shared/event-trading-state.utils.d.ts +4 -2
- package/dist/types/pages/event-market/sports-event-market.utils.d.mts +1 -1
- package/dist/types/pages/event-market/sports-event-market.utils.d.ts +1 -1
- package/dist/types/pages/user-profile/components/claim-activity-breakdown-modal.d.mts +8 -0
- package/dist/types/pages/user-profile/components/claim-activity-breakdown-modal.d.ts +8 -0
- package/dist/types/pages/user-profile/index.d.mts +1 -1
- package/dist/types/pages/user-profile/index.d.ts +1 -1
- package/dist/types/pages/user-profile/user-profile.types.d.mts +14 -0
- package/dist/types/pages/user-profile/user-profile.types.d.ts +14 -0
- package/dist/types/shared/utils.d.mts +16 -0
- package/dist/types/shared/utils.d.ts +16 -0
- package/package.json +3 -3
package/dist/events.js
CHANGED
|
@@ -104,6 +104,92 @@ var toDate = (value) => {
|
|
|
104
104
|
if (Number.isNaN(parsed.getTime())) return null;
|
|
105
105
|
return parsed;
|
|
106
106
|
};
|
|
107
|
+
var GENERIC_BINARY_OUTCOME_LABELS = /* @__PURE__ */ new Set(["yes", "no"]);
|
|
108
|
+
var TOTAL_OUTCOME_LABELS = /* @__PURE__ */ new Set(["over", "under"]);
|
|
109
|
+
var DIRECTIONAL_OUTCOME_LABELS = /* @__PURE__ */ new Set(["up", "down"]);
|
|
110
|
+
var NUMERIC_TOKEN_RE = /[-+]?\d+(?:\.\d+)?/;
|
|
111
|
+
var UP_OR_DOWN_QUESTION_RE = /\bup or down\b/i;
|
|
112
|
+
var normalizeResolvedOutcomeLabel = (value) => {
|
|
113
|
+
const trimmedValue = value == null ? void 0 : value.trim();
|
|
114
|
+
return trimmedValue ? trimmedValue : null;
|
|
115
|
+
};
|
|
116
|
+
var readOutcomeMetadataLabel = (outcome) => {
|
|
117
|
+
const outcomeRecord = outcome;
|
|
118
|
+
for (const key of ["displayName", "name", "title"]) {
|
|
119
|
+
const value = outcomeRecord[key];
|
|
120
|
+
if (typeof value !== "string") continue;
|
|
121
|
+
const normalizedValue = normalizeResolvedOutcomeLabel(value);
|
|
122
|
+
if (normalizedValue) return normalizedValue;
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
};
|
|
126
|
+
var formatLineValue = (value) => {
|
|
127
|
+
return Number.isInteger(value) ? String(value) : String(value);
|
|
128
|
+
};
|
|
129
|
+
var readMarketLabel = (market) => {
|
|
130
|
+
var _a;
|
|
131
|
+
const rawLabel = (_a = normalizeResolvedOutcomeLabel(market == null ? void 0 : market.shortTitle)) != null ? _a : normalizeResolvedOutcomeLabel(market == null ? void 0 : market.question);
|
|
132
|
+
if (!rawLabel) return null;
|
|
133
|
+
if (/^draw\s*\(/i.test(rawLabel)) return "Draw";
|
|
134
|
+
return rawLabel;
|
|
135
|
+
};
|
|
136
|
+
var deriveTotalOutcomeLabel = (outcome, metadataLabel) => {
|
|
137
|
+
const normalizedMetadataLabel = metadataLabel == null ? void 0 : metadataLabel.trim().toLowerCase();
|
|
138
|
+
if (normalizedMetadataLabel && TOTAL_OUTCOME_LABELS.has(normalizedMetadataLabel)) {
|
|
139
|
+
return metadataLabel;
|
|
140
|
+
}
|
|
141
|
+
const normalizedRawLabel = outcome.label.trim().toLowerCase();
|
|
142
|
+
if (normalizedRawLabel === "yes") return "Over";
|
|
143
|
+
if (normalizedRawLabel === "no") return "Under";
|
|
144
|
+
return metadataLabel;
|
|
145
|
+
};
|
|
146
|
+
var resolveResolvedOutcomeLabel = ({
|
|
147
|
+
market,
|
|
148
|
+
outcome,
|
|
149
|
+
allowSportsMoneylineMarketFallback = true
|
|
150
|
+
}) => {
|
|
151
|
+
var _a;
|
|
152
|
+
if (!outcome) return null;
|
|
153
|
+
const rawLabel = normalizeResolvedOutcomeLabel(outcome.label);
|
|
154
|
+
const metadataLabel = readOutcomeMetadataLabel(outcome);
|
|
155
|
+
const normalizedRawLabel = (_a = rawLabel == null ? void 0 : rawLabel.toLowerCase()) != null ? _a : "";
|
|
156
|
+
const isGenericBinary = GENERIC_BINARY_OUTCOME_LABELS.has(normalizedRawLabel);
|
|
157
|
+
const isSportsMarket = Boolean(
|
|
158
|
+
(market == null ? void 0 : market.sportsMarketType) || (market == null ? void 0 : market.marketGroup) || (market == null ? void 0 : market.lineValue) != null
|
|
159
|
+
);
|
|
160
|
+
if (!isSportsMarket) {
|
|
161
|
+
const isDirectionalBinaryMarket = Boolean((market == null ? void 0 : market.question) && UP_OR_DOWN_QUESTION_RE.test(market.question)) && Boolean(metadataLabel && DIRECTIONAL_OUTCOME_LABELS.has(metadataLabel.trim().toLowerCase()));
|
|
162
|
+
if (isDirectionalBinaryMarket) return metadataLabel;
|
|
163
|
+
if (isGenericBinary) return rawLabel;
|
|
164
|
+
return metadataLabel != null ? metadataLabel : rawLabel;
|
|
165
|
+
}
|
|
166
|
+
const lineValue = typeof (market == null ? void 0 : market.lineValue) === "number" ? market.lineValue : null;
|
|
167
|
+
const isMoneylineMarket = (market == null ? void 0 : market.sportsMarketType) === "moneyline" || (market == null ? void 0 : market.marketGroup) === "game_lines";
|
|
168
|
+
const isTotalMarket = (market == null ? void 0 : market.sportsMarketType) === "total" || (market == null ? void 0 : market.marketGroup) === "totals";
|
|
169
|
+
if (isMoneylineMarket && metadataLabel) return metadataLabel;
|
|
170
|
+
if (allowSportsMoneylineMarketFallback && isMoneylineMarket && isGenericBinary) {
|
|
171
|
+
const marketLabel = readMarketLabel(market);
|
|
172
|
+
if (marketLabel) return marketLabel;
|
|
173
|
+
}
|
|
174
|
+
if (isTotalMarket) {
|
|
175
|
+
const totalLabel = deriveTotalOutcomeLabel(outcome, metadataLabel);
|
|
176
|
+
if (totalLabel && lineValue != null && !NUMERIC_TOKEN_RE.test(totalLabel)) {
|
|
177
|
+
return `${totalLabel} ${formatLineValue(Math.abs(lineValue))}`;
|
|
178
|
+
}
|
|
179
|
+
if (totalLabel) return totalLabel;
|
|
180
|
+
}
|
|
181
|
+
const isSpreadMarket = (market == null ? void 0 : market.sportsMarketType) === "spread" || (market == null ? void 0 : market.marketGroup) === "spreads";
|
|
182
|
+
if (isSpreadMarket && metadataLabel) {
|
|
183
|
+
if (lineValue != null && !NUMERIC_TOKEN_RE.test(metadataLabel)) {
|
|
184
|
+
const resolvedLineValue = normalizedRawLabel === "no" ? Math.abs(lineValue) : lineValue;
|
|
185
|
+
const formattedLineValue = resolvedLineValue > 0 ? `+${formatLineValue(resolvedLineValue)}` : formatLineValue(resolvedLineValue);
|
|
186
|
+
return `${metadataLabel} ${formattedLineValue}`;
|
|
187
|
+
}
|
|
188
|
+
return metadataLabel;
|
|
189
|
+
}
|
|
190
|
+
if (metadataLabel) return metadataLabel;
|
|
191
|
+
return rawLabel;
|
|
192
|
+
};
|
|
107
193
|
|
|
108
194
|
// src/primitives/icon/types.ts
|
|
109
195
|
var getIconA11yProps = (title2) => ({
|
|
@@ -3688,7 +3774,8 @@ var normalizeSeries = (series) => {
|
|
|
3688
3774
|
}).filter((seriesItem) => seriesItem.points.length > 0);
|
|
3689
3775
|
};
|
|
3690
3776
|
var formatDefaultChartValue = (value) => {
|
|
3691
|
-
|
|
3777
|
+
const roundedValue = Number(value.toFixed(1));
|
|
3778
|
+
return `${Number.isInteger(roundedValue) ? String(roundedValue) : roundedValue.toFixed(1)}%`;
|
|
3692
3779
|
};
|
|
3693
3780
|
var resolveChartTimeFormatter = (windowSeconds) => {
|
|
3694
3781
|
return (timestamp) => {
|
|
@@ -5383,7 +5470,7 @@ var sizeClasses2 = {
|
|
|
5383
5470
|
var lineColorByVenue = {
|
|
5384
5471
|
light: {
|
|
5385
5472
|
[import_sdk10.Venue.kalshi]: "#00D295",
|
|
5386
|
-
[import_sdk10.Venue.limitless]: "#
|
|
5473
|
+
[import_sdk10.Venue.limitless]: "#C4FF00",
|
|
5387
5474
|
[import_sdk10.Venue.opinion]: "#000000",
|
|
5388
5475
|
[import_sdk10.Venue.polymarket]: "#2E5CFF",
|
|
5389
5476
|
[import_sdk10.Venue.predict]: "#6D57F8",
|
|
@@ -5393,7 +5480,7 @@ var lineColorByVenue = {
|
|
|
5393
5480
|
},
|
|
5394
5481
|
dark: {
|
|
5395
5482
|
[import_sdk10.Venue.kalshi]: "#00D295",
|
|
5396
|
-
[import_sdk10.Venue.limitless]: "#
|
|
5483
|
+
[import_sdk10.Venue.limitless]: "#C4FF00",
|
|
5397
5484
|
[import_sdk10.Venue.opinion]: "#FFFFFF",
|
|
5398
5485
|
[import_sdk10.Venue.polymarket]: "#2E5CFF",
|
|
5399
5486
|
[import_sdk10.Venue.predict]: "#6D57F8",
|
|
@@ -5712,8 +5799,14 @@ var formatMarketProbabilityPercent = (value, formatPercent = formatWholePercent)
|
|
|
5712
5799
|
}
|
|
5713
5800
|
return formattedValue;
|
|
5714
5801
|
};
|
|
5715
|
-
var formatPriceGapPercent = (value) => {
|
|
5802
|
+
var formatPriceGapPercent = (value, mode = "percent") => {
|
|
5716
5803
|
if (typeof value !== "number" || !Number.isFinite(value)) return void 0;
|
|
5804
|
+
if (value <= 0) return void 0;
|
|
5805
|
+
if (mode === "fraction") {
|
|
5806
|
+
const percentageValue = value * 100;
|
|
5807
|
+
if (percentageValue < import_hooks25.MIN_PRICE_GAP_PCT) return void 0;
|
|
5808
|
+
return `${Math.round(percentageValue)}%`;
|
|
5809
|
+
}
|
|
5717
5810
|
if (value < import_hooks25.MIN_PRICE_GAP_PCT) return void 0;
|
|
5718
5811
|
if (value > import_hooks25.MAX_PRICE_GAP_PCT) return void 0;
|
|
5719
5812
|
return `${Math.round(value)}%`;
|
|
@@ -7405,6 +7498,24 @@ var buildOutcomeMidpointsByOutcomeId = (midpointRows) => {
|
|
|
7405
7498
|
}
|
|
7406
7499
|
return outcomeMidpointsByOutcomeId;
|
|
7407
7500
|
};
|
|
7501
|
+
var buildArbReturnByVenueMarketId = (midpointRows) => {
|
|
7502
|
+
const arbReturnByVenueMarketId = /* @__PURE__ */ new Map();
|
|
7503
|
+
const addArbReturn = (value) => {
|
|
7504
|
+
var _a, _b;
|
|
7505
|
+
if (!value || typeof value !== "object") return;
|
|
7506
|
+
const row = value;
|
|
7507
|
+
if (row.venueMarketId && !arbReturnByVenueMarketId.has(row.venueMarketId)) {
|
|
7508
|
+
arbReturnByVenueMarketId.set(row.venueMarketId, (_a = row.arbReturn) != null ? _a : null);
|
|
7509
|
+
}
|
|
7510
|
+
for (const matchedRow of (_b = row.matched) != null ? _b : []) {
|
|
7511
|
+
addArbReturn(matchedRow);
|
|
7512
|
+
}
|
|
7513
|
+
};
|
|
7514
|
+
for (const row of midpointRows) {
|
|
7515
|
+
addArbReturn(row);
|
|
7516
|
+
}
|
|
7517
|
+
return arbReturnByVenueMarketId;
|
|
7518
|
+
};
|
|
7408
7519
|
var resolveMarketHrefFromEventHref = (eventHref, marketId, outcomeId) => {
|
|
7409
7520
|
if (!eventHref) return void 0;
|
|
7410
7521
|
if (typeof window === "undefined") return void 0;
|
|
@@ -7421,6 +7532,9 @@ var EventListItemContent = ({
|
|
|
7421
7532
|
event,
|
|
7422
7533
|
classNames,
|
|
7423
7534
|
arbitrageByOutcomeId,
|
|
7535
|
+
midpointPrices,
|
|
7536
|
+
midpointRows: sharedMidpointRows,
|
|
7537
|
+
midpointsLoading,
|
|
7424
7538
|
onEventClick,
|
|
7425
7539
|
onMarketClick,
|
|
7426
7540
|
getMarketHref,
|
|
@@ -7474,6 +7588,8 @@ var EventListItemContent = ({
|
|
|
7474
7588
|
if (!isLazyMarketsQueryEnabled || lazyLoadedMarkets.length === 0) return allVenueMarkets;
|
|
7475
7589
|
return dedupeVenueMarketsById([...allVenueMarkets, ...lazyLoadedMarkets]);
|
|
7476
7590
|
}, [allVenueMarkets, isLazyMarketsQueryEnabled, lazyLoadedMarkets]);
|
|
7591
|
+
const hasExpandedMarkets = isLazyMarketsQueryEnabled && lazyLoadedMarkets.length > 0;
|
|
7592
|
+
const shouldUseSharedMidpoints = !hasExpandedMarkets && (midpointPrices !== void 0 || sharedMidpointRows !== void 0 || midpointsLoading !== void 0);
|
|
7477
7593
|
const midpointVenueMarketIds = (0, import_react10.useMemo)(() => {
|
|
7478
7594
|
var _a2;
|
|
7479
7595
|
const ids = [];
|
|
@@ -7485,19 +7601,21 @@ var EventListItemContent = ({
|
|
|
7485
7601
|
}
|
|
7486
7602
|
return [...new Set(ids)];
|
|
7487
7603
|
}, [resolvedOutcomeMarkets]);
|
|
7488
|
-
const { midpointRows, isLoading: isVenueMarketMidpointsLoading } = (0, import_hooks31.useVenueMarketMidpoints)({
|
|
7489
|
-
venueMarketIds: midpointVenueMarketIds,
|
|
7490
|
-
enabled: midpointVenueMarketIds.length > 0
|
|
7604
|
+
const { midpointRows: fetchedMidpointRows, isLoading: isVenueMarketMidpointsLoading } = (0, import_hooks31.useVenueMarketMidpoints)({
|
|
7605
|
+
venueMarketIds: shouldUseSharedMidpoints ? [] : midpointVenueMarketIds,
|
|
7606
|
+
enabled: !shouldUseSharedMidpoints && midpointVenueMarketIds.length > 0
|
|
7491
7607
|
});
|
|
7492
|
-
const { prices: displayMidpointsByOutcomeId, isLoading: isOutcomeMidpointsLoading } = (0, import_hooks31.useMidpoints)(resolvedOutcomeMarkets);
|
|
7493
|
-
const
|
|
7608
|
+
const { prices: displayMidpointsByOutcomeId, isLoading: isOutcomeMidpointsLoading } = (0, import_hooks31.useMidpoints)(shouldUseSharedMidpoints ? [] : resolvedOutcomeMarkets);
|
|
7609
|
+
const resolvedMidpointRows = shouldUseSharedMidpoints ? sharedMidpointRows != null ? sharedMidpointRows : [] : fetchedMidpointRows;
|
|
7610
|
+
const resolvedDisplayMidpointsByOutcomeId = shouldUseSharedMidpoints ? midpointPrices != null ? midpointPrices : /* @__PURE__ */ new Map() : displayMidpointsByOutcomeId;
|
|
7611
|
+
const isAwaitingMidpoints = midpointsLoading != null ? midpointsLoading : isOutcomeMidpointsLoading || midpointVenueMarketIds.length > 0 && isVenueMarketMidpointsLoading;
|
|
7494
7612
|
const displayPriceByOutcomeId = (0, import_react10.useMemo)(() => {
|
|
7495
|
-
const priceByOutcomeId = new Map(
|
|
7496
|
-
for (const [outcomeId, price] of buildOutcomeMidpointsByOutcomeId(
|
|
7613
|
+
const priceByOutcomeId = new Map(resolvedDisplayMidpointsByOutcomeId);
|
|
7614
|
+
for (const [outcomeId, price] of buildOutcomeMidpointsByOutcomeId(resolvedMidpointRows)) {
|
|
7497
7615
|
priceByOutcomeId.set(outcomeId, price);
|
|
7498
7616
|
}
|
|
7499
7617
|
return priceByOutcomeId;
|
|
7500
|
-
}, [
|
|
7618
|
+
}, [resolvedDisplayMidpointsByOutcomeId, resolvedMidpointRows]);
|
|
7501
7619
|
const comparison = (0, import_react10.useMemo)(() => {
|
|
7502
7620
|
return normalizeEventListItemV2Comparison({
|
|
7503
7621
|
venueMarkets: resolvedOutcomeMarkets,
|
|
@@ -7508,6 +7626,9 @@ var EventListItemContent = ({
|
|
|
7508
7626
|
const gapsByVenueMarketId = (0, import_react10.useMemo)(() => {
|
|
7509
7627
|
return computePriceGapsFromComparisonRows(comparison.rows);
|
|
7510
7628
|
}, [comparison.rows]);
|
|
7629
|
+
const arbReturnByVenueMarketId = (0, import_react10.useMemo)(() => {
|
|
7630
|
+
return buildArbReturnByVenueMarketId(resolvedMidpointRows);
|
|
7631
|
+
}, [resolvedMidpointRows]);
|
|
7511
7632
|
const shouldRenderLoadingOutcomeRow = shouldEnableLazyMarketLoading && (!isLazyMarketsQueryEnabled || isLoadingLazyMarkets || isFetchingNextLazyMarketsPage || hasNextLazyMarketsPage);
|
|
7512
7633
|
const resolvedVolume = (_a = resolveDisplayVolume(event.volume, allVenueMarkets)) != null ? _a : 0;
|
|
7513
7634
|
const volumeLabel = `${config.formatting.formatCompactCurrency(resolvedVolume)} ${labels.eventItem.volumeSuffix}`;
|
|
@@ -7639,10 +7760,10 @@ var EventListItemContent = ({
|
|
|
7639
7760
|
)
|
|
7640
7761
|
] });
|
|
7641
7762
|
};
|
|
7642
|
-
const renderPriceGapPill = (value) => {
|
|
7763
|
+
const renderPriceGapPill = (value, source = "percent") => {
|
|
7643
7764
|
if (!config.features.enablePriceGap) return null;
|
|
7644
7765
|
if (isAwaitingMidpoints) return null;
|
|
7645
|
-
const formattedPriceGap = formatPriceGapPercent(value);
|
|
7766
|
+
const formattedPriceGap = formatPriceGapPercent(value, source);
|
|
7646
7767
|
if (!formattedPriceGap) return null;
|
|
7647
7768
|
return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(
|
|
7648
7769
|
"span",
|
|
@@ -7778,7 +7899,9 @@ var EventListItemContent = ({
|
|
|
7778
7899
|
comparison.rows.map((row) => {
|
|
7779
7900
|
var _a2;
|
|
7780
7901
|
const arbitragePercent = (_a2 = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.outcome.id]) != null ? _a2 : arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.market.id];
|
|
7781
|
-
const
|
|
7902
|
+
const arbReturn = arbReturnByVenueMarketId.get(row.market.id);
|
|
7903
|
+
const priceGapPercent = arbReturn == null ? gapsByVenueMarketId.get(row.market.id) : arbReturn;
|
|
7904
|
+
const priceGapSource = arbReturn == null ? "percent" : "fraction";
|
|
7782
7905
|
return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(
|
|
7783
7906
|
"div",
|
|
7784
7907
|
{
|
|
@@ -7798,7 +7921,7 @@ var EventListItemContent = ({
|
|
|
7798
7921
|
) }),
|
|
7799
7922
|
/* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "agg-outcome-meta flex shrink-0 flex-row items-center justify-end gap-2", children: [
|
|
7800
7923
|
renderArbitrage(arbitragePercent),
|
|
7801
|
-
renderPriceGapPill(priceGapPercent),
|
|
7924
|
+
renderPriceGapPill(priceGapPercent, priceGapSource),
|
|
7802
7925
|
/* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { className: "agg-outcome-price-strip relative flex shrink-0 items-center justify-end", children: isAwaitingMidpoints ? renderPriceStripSkeleton(row.prices.length) : row.prices.map(
|
|
7803
7926
|
(price, priceIndex) => renderComparisonPriceBadge(row, price, priceIndex)
|
|
7804
7927
|
) })
|
|
@@ -8113,6 +8236,79 @@ var isDateLikeLabel = (value) => {
|
|
|
8113
8236
|
if (!value.trim()) return false;
|
|
8114
8237
|
return (0, import_dayjs3.default)(value).isValid();
|
|
8115
8238
|
};
|
|
8239
|
+
var CHART_RANGE_PRIORITY = ["1H", "6H", "1D", "1W", "1M", "ALL"];
|
|
8240
|
+
var RANGE_SECONDS_BY_TIME_RANGE = {
|
|
8241
|
+
"1H": 60 * 60,
|
|
8242
|
+
"6H": 6 * 60 * 60,
|
|
8243
|
+
"1D": 24 * 60 * 60,
|
|
8244
|
+
"1W": 7 * 24 * 60 * 60,
|
|
8245
|
+
"1M": 30 * 24 * 60 * 60,
|
|
8246
|
+
ALL: 6 * 30 * 24 * 60 * 60
|
|
8247
|
+
};
|
|
8248
|
+
var toUnixTimestamp = (value) => {
|
|
8249
|
+
if (!value) return null;
|
|
8250
|
+
const parsedValue = (0, import_dayjs3.default)(value);
|
|
8251
|
+
if (!parsedValue.isValid()) return null;
|
|
8252
|
+
return parsedValue.unix();
|
|
8253
|
+
};
|
|
8254
|
+
var isResolvedMarketStatus = (status) => {
|
|
8255
|
+
if (!status) return false;
|
|
8256
|
+
const normalizedStatus = status.trim().toLowerCase();
|
|
8257
|
+
return normalizedStatus.includes("resolved") || normalizedStatus.includes("closed") || normalizedStatus.includes("settled") || normalizedStatus.includes("final");
|
|
8258
|
+
};
|
|
8259
|
+
var resolveInitialEventDetailsChartRange = ({
|
|
8260
|
+
chartData,
|
|
8261
|
+
event,
|
|
8262
|
+
fallbackRange,
|
|
8263
|
+
nowSec = (0, import_dayjs3.default)().unix(),
|
|
8264
|
+
selectedMarket
|
|
8265
|
+
}) => {
|
|
8266
|
+
var _a, _b;
|
|
8267
|
+
const scopedMarkets = selectedMarket ? [selectedMarket] : event.venueMarkets;
|
|
8268
|
+
const preferredEventStart = (_a = toUnixTimestamp(event.startDate)) != null ? _a : toUnixTimestamp(event.creationDate);
|
|
8269
|
+
const marketStartCandidates = scopedMarkets.map((market) => {
|
|
8270
|
+
var _a2;
|
|
8271
|
+
return (_a2 = toUnixTimestamp(market.startDate)) != null ? _a2 : toUnixTimestamp(market.creationDate);
|
|
8272
|
+
}).filter((value) => value != null);
|
|
8273
|
+
const metadataStarts = [preferredEventStart, ...marketStartCandidates].filter(
|
|
8274
|
+
(value) => value != null
|
|
8275
|
+
);
|
|
8276
|
+
const metadataEnds = [
|
|
8277
|
+
toUnixTimestamp(event.endDate),
|
|
8278
|
+
...scopedMarkets.flatMap((market) => [
|
|
8279
|
+
toUnixTimestamp(market.endDate),
|
|
8280
|
+
toUnixTimestamp(market.resolutionDate)
|
|
8281
|
+
])
|
|
8282
|
+
].filter((value) => value != null);
|
|
8283
|
+
const historyTimestamps = chartData == null ? [] : Object.values(chartData.venues).flatMap((venueData) => [
|
|
8284
|
+
...venueData.candles.map((candle) => candle.time),
|
|
8285
|
+
...venueData.liveCandle ? [venueData.liveCandle.time] : []
|
|
8286
|
+
]);
|
|
8287
|
+
const startCandidates = [...metadataStarts, ...historyTimestamps];
|
|
8288
|
+
if (startCandidates.length === 0) {
|
|
8289
|
+
return fallbackRange != null ? fallbackRange : null;
|
|
8290
|
+
}
|
|
8291
|
+
const marketResolved = [event.status, ...scopedMarkets.map((market) => market.status)].some(
|
|
8292
|
+
isResolvedMarketStatus
|
|
8293
|
+
);
|
|
8294
|
+
const isUsingSharedOverlapStart = scopedMarkets.length > 1 && marketStartCandidates.length === scopedMarkets.length;
|
|
8295
|
+
const startTs = isUsingSharedOverlapStart ? Math.max(...marketStartCandidates) : Math.min(...startCandidates);
|
|
8296
|
+
const endTs = Math.max(
|
|
8297
|
+
...marketResolved && metadataEnds.length > 0 ? [nowSec, ...metadataEnds, ...historyTimestamps] : [nowSec, ...historyTimestamps]
|
|
8298
|
+
);
|
|
8299
|
+
const spanSeconds = Math.max(0, endTs - startTs);
|
|
8300
|
+
if (spanSeconds <= 0) {
|
|
8301
|
+
return fallbackRange != null ? fallbackRange : null;
|
|
8302
|
+
}
|
|
8303
|
+
if (!marketResolved && spanSeconds > RANGE_SECONDS_BY_TIME_RANGE["1M"]) {
|
|
8304
|
+
return "1M";
|
|
8305
|
+
}
|
|
8306
|
+
const requiredSeconds = spanSeconds * (isUsingSharedOverlapStart ? 1 : marketResolved ? 1.05 : 1.2);
|
|
8307
|
+
const matchingRange = CHART_RANGE_PRIORITY.find((range) => {
|
|
8308
|
+
return RANGE_SECONDS_BY_TIME_RANGE[range] >= requiredSeconds;
|
|
8309
|
+
});
|
|
8310
|
+
return (_b = matchingRange != null ? matchingRange : fallbackRange) != null ? _b : "ALL";
|
|
8311
|
+
};
|
|
8116
8312
|
var matchOutcomeByLabel = (outcome, selectedOutcomeLabel) => {
|
|
8117
8313
|
const normalizedSelectedLabel = normalizeLabel(selectedOutcomeLabel);
|
|
8118
8314
|
const semanticSelectedLabel = toSemanticLabel(selectedOutcomeLabel);
|
|
@@ -10204,7 +10400,6 @@ var EventListItemDetailsGraphSection = ({
|
|
|
10204
10400
|
venueMarkets,
|
|
10205
10401
|
selectedMarketId,
|
|
10206
10402
|
livePrices,
|
|
10207
|
-
wsLivePrices,
|
|
10208
10403
|
restMidpoints,
|
|
10209
10404
|
bestMidpoint,
|
|
10210
10405
|
bestPrices,
|
|
@@ -10398,7 +10593,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
10398
10593
|
{
|
|
10399
10594
|
classNames: { root: cn("agg-chart-region", classNames == null ? void 0 : classNames.chart) },
|
|
10400
10595
|
series: visibleChartSeries,
|
|
10401
|
-
height:
|
|
10596
|
+
height: 200,
|
|
10402
10597
|
isLoading: isScopedMarketChartLoading,
|
|
10403
10598
|
chartType: selectedChartType,
|
|
10404
10599
|
liveCandle: selectedChartType === "candlestick" ? (_m = chartLiveState.liveCandle) != null ? _m : void 0 : void 0,
|
|
@@ -10427,7 +10622,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
10427
10622
|
),
|
|
10428
10623
|
children: chartAvailableVenueOutcomes.map((item) => {
|
|
10429
10624
|
var _a3, _b3;
|
|
10430
|
-
const percentage = (_b3 = (_a3 = resolvedOutcomePriceByMarketId.get(item.market.id)) == null ? void 0 : _a3.get(item.outcome.id)) != null ? _b3 :
|
|
10625
|
+
const percentage = (_b3 = (_a3 = resolvedOutcomePriceByMarketId.get(item.market.id)) == null ? void 0 : _a3.get(item.outcome.id)) != null ? _b3 : livePrices.get(item.outcome.id);
|
|
10431
10626
|
const text = formatMarketProbabilityPercent(percentage, formatPercent);
|
|
10432
10627
|
const seriesId = `${item.venue}-chart`;
|
|
10433
10628
|
const isActiveVenue = activeGraphVenue === item.venue;
|
|
@@ -10435,6 +10630,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
10435
10630
|
"button",
|
|
10436
10631
|
{
|
|
10437
10632
|
type: "button",
|
|
10633
|
+
"data-id": item.outcome.id,
|
|
10438
10634
|
"aria-label": `${item.venue} ${text}`,
|
|
10439
10635
|
"aria-pressed": isActiveVenue,
|
|
10440
10636
|
className: cn(
|
|
@@ -10525,6 +10721,7 @@ var EventListItemDetailsContent = ({
|
|
|
10525
10721
|
detailsStats,
|
|
10526
10722
|
eventTradingState,
|
|
10527
10723
|
ariaLabel,
|
|
10724
|
+
defaultTimeRange,
|
|
10528
10725
|
onClick,
|
|
10529
10726
|
midpointsResult
|
|
10530
10727
|
}) => {
|
|
@@ -10533,9 +10730,6 @@ var EventListItemDetailsContent = ({
|
|
|
10533
10730
|
const lastAppliedEventSyncKeyRef = (0, import_react16.useRef)(null);
|
|
10534
10731
|
const lastAppliedDefaultRef = (0, import_react16.useRef)(null);
|
|
10535
10732
|
const [chartRangeOverride, setChartRangeOverride] = (0, import_react16.useState)(null);
|
|
10536
|
-
(0, import_react16.useEffect)(() => {
|
|
10537
|
-
setChartRangeOverride(null);
|
|
10538
|
-
}, [event.id]);
|
|
10539
10733
|
const config = (0, import_hooks40.useSdkUiConfig)();
|
|
10540
10734
|
const labels = (0, import_hooks40.useLabels)();
|
|
10541
10735
|
const tradingContext = (0, import_hooks33.useEventTradingContext)();
|
|
@@ -10544,13 +10738,20 @@ var EventListItemDetailsContent = ({
|
|
|
10544
10738
|
return eventTradingState != null ? eventTradingState : (0, import_hooks40.resolveEventTradingState)(event);
|
|
10545
10739
|
}, [event, eventTradingState]);
|
|
10546
10740
|
const scopedSelectedMarket = (tradingContext == null ? void 0 : tradingContext.selectedEventId) === event.id ? (_a = tradingContext.selectedMarket) != null ? _a : resolvedEventTradingState.primaryMarket : resolvedEventTradingState.primaryMarket;
|
|
10741
|
+
const venueMarkets = (0, import_react16.useMemo)(
|
|
10742
|
+
() => resolvedEventTradingState.displayMarkets,
|
|
10743
|
+
[resolvedEventTradingState.displayMarkets]
|
|
10744
|
+
);
|
|
10745
|
+
const eventDetailVenueMarkets = (0, import_react16.useMemo)(() => {
|
|
10746
|
+
return normalizeVenueMarketCluster(venueMarkets);
|
|
10747
|
+
}, [venueMarkets]);
|
|
10547
10748
|
const scopedSelectedMarketId = (tradingContext == null ? void 0 : tradingContext.selectedEventId) === event.id ? tradingContext.selectedMarketId : null;
|
|
10548
10749
|
(0, import_hooks40.useEventOrderbookData)(
|
|
10549
10750
|
resolvedEventTradingState.isTradingDisabled ? [] : resolvedEventTradingState.displayMarkets,
|
|
10550
10751
|
scopedSelectedMarketId
|
|
10551
10752
|
);
|
|
10552
|
-
const wsLivePrices = (0, import_hooks40.useLiveOutcomePrices)(
|
|
10553
|
-
const wsBestPrices = (0, import_hooks40.useLiveBestPrices)(
|
|
10753
|
+
const wsLivePrices = (0, import_hooks40.useLiveOutcomePrices)(eventDetailVenueMarkets);
|
|
10754
|
+
const wsBestPrices = (0, import_hooks40.useLiveBestPrices)(eventDetailVenueMarkets);
|
|
10554
10755
|
const resolvedMidpointsResult = midpointsResult != null ? midpointsResult : {
|
|
10555
10756
|
prices: /* @__PURE__ */ new Map(),
|
|
10556
10757
|
bestMidpointsByOutcomeId: /* @__PURE__ */ new Map(),
|
|
@@ -10575,6 +10776,16 @@ var EventListItemDetailsContent = ({
|
|
|
10575
10776
|
for (const [k, v] of wsLivePrices) merged.set(k, v);
|
|
10576
10777
|
return merged;
|
|
10577
10778
|
}, [restMidpoints, wsLivePrices]);
|
|
10779
|
+
const initialChartTimeRange = (0, import_react16.useMemo)(() => {
|
|
10780
|
+
return resolveInitialEventDetailsChartRange({
|
|
10781
|
+
event,
|
|
10782
|
+
selectedMarket: scopedSelectedMarket,
|
|
10783
|
+
fallbackRange: defaultTimeRange != null ? defaultTimeRange : config.chart.selectedChartTimeRange
|
|
10784
|
+
});
|
|
10785
|
+
}, [config.chart.selectedChartTimeRange, defaultTimeRange, event, scopedSelectedMarket]);
|
|
10786
|
+
(0, import_react16.useEffect)(() => {
|
|
10787
|
+
setChartRangeOverride(initialChartTimeRange);
|
|
10788
|
+
}, [event.id, initialChartTimeRange, scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id]);
|
|
10578
10789
|
(0, import_react16.useEffect)(() => {
|
|
10579
10790
|
if (!tradingContext) return;
|
|
10580
10791
|
if (lastAppliedEventSyncKeyRef.current === eventSyncKey) return;
|
|
@@ -10612,10 +10823,6 @@ var EventListItemDetailsContent = ({
|
|
|
10612
10823
|
tradingContext,
|
|
10613
10824
|
tradingContext == null ? void 0 : tradingContext.selectedEventId
|
|
10614
10825
|
]);
|
|
10615
|
-
const venueMarkets = (0, import_react16.useMemo)(
|
|
10616
|
-
() => resolvedEventTradingState.displayMarkets,
|
|
10617
|
-
[resolvedEventTradingState.displayMarkets]
|
|
10618
|
-
);
|
|
10619
10826
|
const marketOptions = (0, import_react16.useMemo)(
|
|
10620
10827
|
() => venueMarkets.map((vm) => ({
|
|
10621
10828
|
value: vm.id,
|
|
@@ -10737,7 +10944,6 @@ var EventListItemDetailsContent = ({
|
|
|
10737
10944
|
venueMarkets,
|
|
10738
10945
|
selectedMarketId: (_d = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id) != null ? _d : null,
|
|
10739
10946
|
livePrices,
|
|
10740
|
-
wsLivePrices,
|
|
10741
10947
|
restMidpoints,
|
|
10742
10948
|
bestMidpoint,
|
|
10743
10949
|
bestPrices,
|
|
@@ -11453,8 +11659,13 @@ var resolveTradingStateTimestampLabel = (labels, state) => {
|
|
|
11453
11659
|
return null;
|
|
11454
11660
|
};
|
|
11455
11661
|
var resolveTradingStatePresentation = (labels, state) => {
|
|
11662
|
+
var _a;
|
|
11456
11663
|
const timestampLabel = resolveTradingStateTimestampLabel(labels, state);
|
|
11457
|
-
const
|
|
11664
|
+
const resolvedOutcomeLabel = resolveResolvedOutcomeLabel({
|
|
11665
|
+
market: (_a = state.market) != null ? _a : null,
|
|
11666
|
+
outcome: state.winningOutcome
|
|
11667
|
+
});
|
|
11668
|
+
const winningOutcomeLabel = resolvedOutcomeLabel ? labels.eventMarketPage.winningOutcome(resolvedOutcomeLabel) : null;
|
|
11458
11669
|
if (state.kind === "resolved") {
|
|
11459
11670
|
return {
|
|
11460
11671
|
badgeLabel: labels.eventMarketPage.tradingResolvedBadge,
|
|
@@ -12146,6 +12357,10 @@ var MarketDetailsContent = ({
|
|
|
12146
12357
|
const isOutcomeSelectionLocked = marketTradingState.isTradingDisabled;
|
|
12147
12358
|
const isUpcomingMarket = marketTradingState.kind === "unopened";
|
|
12148
12359
|
const marketStatePresentation = resolveTradingStatePresentation(labels, marketTradingState);
|
|
12360
|
+
const resolvedWinningOutcomeLabel = resolveResolvedOutcomeLabel({
|
|
12361
|
+
market: scopedMarketForCard,
|
|
12362
|
+
outcome: marketTradingState.winningOutcome
|
|
12363
|
+
});
|
|
12149
12364
|
const marketDetailsTabs = (0, import_react20.useMemo)(() => {
|
|
12150
12365
|
return getMarketDetailsTabs(labels);
|
|
12151
12366
|
}, [labels]);
|
|
@@ -12582,7 +12797,9 @@ var MarketDetailsContent = ({
|
|
|
12582
12797
|
)
|
|
12583
12798
|
}
|
|
12584
12799
|
),
|
|
12585
|
-
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Typography, { variant: "body", children: labels.eventMarketPage.resolvedOutcome(
|
|
12800
|
+
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Typography, { variant: "body", children: labels.eventMarketPage.resolvedOutcome(
|
|
12801
|
+
resolvedWinningOutcomeLabel != null ? resolvedWinningOutcomeLabel : marketTradingState.winningOutcome.label
|
|
12802
|
+
) })
|
|
12586
12803
|
]
|
|
12587
12804
|
}
|
|
12588
12805
|
) }) : isUpcomingMarket ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { className: "agg-outcomes flex w-full items-center justify-end md:w-auto md:shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
|
|
@@ -13348,6 +13565,23 @@ var resolveSortQueryParams = (value) => {
|
|
|
13348
13565
|
}
|
|
13349
13566
|
return { sortBy: "volume24hr", sortDir: "desc" };
|
|
13350
13567
|
};
|
|
13568
|
+
var collectEventListVenueMarkets = (events) => {
|
|
13569
|
+
return events.flatMap((event) => {
|
|
13570
|
+
var _a;
|
|
13571
|
+
return (_a = event.venueMarkets) != null ? _a : [];
|
|
13572
|
+
});
|
|
13573
|
+
};
|
|
13574
|
+
var collectMidpointVenueMarketIds = (venueMarkets) => {
|
|
13575
|
+
var _a;
|
|
13576
|
+
const ids = [];
|
|
13577
|
+
for (const market of venueMarkets) {
|
|
13578
|
+
ids.push(market.id);
|
|
13579
|
+
for (const sibling of (_a = market.matchedVenueMarkets) != null ? _a : []) {
|
|
13580
|
+
ids.push(sibling.id);
|
|
13581
|
+
}
|
|
13582
|
+
}
|
|
13583
|
+
return [...new Set(ids)];
|
|
13584
|
+
};
|
|
13351
13585
|
var EventList = ({
|
|
13352
13586
|
title: title2,
|
|
13353
13587
|
limit = DEFAULT_EVENTS_LIMIT,
|
|
@@ -13562,6 +13796,16 @@ var EventList = ({
|
|
|
13562
13796
|
if (resolvedMaxVisibleItems == null) return normalizedEvents;
|
|
13563
13797
|
return normalizedEvents.slice(0, resolvedMaxVisibleItems);
|
|
13564
13798
|
}, [orderedEvents, resolvedMaxVisibleItems]);
|
|
13799
|
+
const visibleVenueMarkets = (0, import_react23.useMemo)(() => {
|
|
13800
|
+
return collectEventListVenueMarkets(tileEvents);
|
|
13801
|
+
}, [tileEvents]);
|
|
13802
|
+
const visibleMidpointVenueMarketIds = (0, import_react23.useMemo)(() => {
|
|
13803
|
+
return collectMidpointVenueMarketIds(visibleVenueMarkets);
|
|
13804
|
+
}, [visibleVenueMarkets]);
|
|
13805
|
+
const { midpointRows: sharedMidpointRows, isLoading: isSharedMidpointsLoading } = (0, import_hooks45.useVenueMarketMidpoints)({
|
|
13806
|
+
venueMarketIds: visibleMidpointVenueMarketIds,
|
|
13807
|
+
enabled: visibleMidpointVenueMarketIds.length > 0
|
|
13808
|
+
});
|
|
13565
13809
|
const shouldRenderLoadingState = isLoading && !isPlaceholderData && tileEvents.length === 0;
|
|
13566
13810
|
const shouldRenderEmptyState = !isLoading && !isError && tileEvents.length === 0;
|
|
13567
13811
|
const shouldRenderPaginationLoadingItems = shouldPaginate && hasNextPage;
|
|
@@ -13730,6 +13974,8 @@ var EventList = ({
|
|
|
13730
13974
|
EventListItem,
|
|
13731
13975
|
{
|
|
13732
13976
|
event,
|
|
13977
|
+
midpointRows: sharedMidpointRows,
|
|
13978
|
+
midpointsLoading: isSharedMidpointsLoading,
|
|
13733
13979
|
classNames: {
|
|
13734
13980
|
root: "agg-event-list-item w-full min-w-0! max-w-none justify-between!"
|
|
13735
13981
|
},
|
package/dist/events.mjs
CHANGED
|
@@ -16,13 +16,13 @@ import {
|
|
|
16
16
|
orderbookRowLimitDefault,
|
|
17
17
|
resolveEventDetailsSyncKey,
|
|
18
18
|
useCenterOrderbookSpread
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-QM3WWPCV.mjs";
|
|
20
20
|
import {
|
|
21
21
|
formatProbabilityCents,
|
|
22
22
|
resolveOrderBookRows,
|
|
23
23
|
resolveUnifiedOrderBookEntries
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-
|
|
24
|
+
} from "./chunk-LPIAEKSZ.mjs";
|
|
25
|
+
import "./chunk-UTXQUOU3.mjs";
|
|
26
26
|
export {
|
|
27
27
|
EventList,
|
|
28
28
|
EventListItem,
|