@agg-market/ui 0.0.3 → 0.0.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/badge.d.mts +2 -2
- package/dist/badge.d.ts +2 -2
- package/dist/badge.mjs +2 -2
- package/dist/button.d.mts +2 -2
- package/dist/button.d.ts +2 -2
- package/dist/button.js +1 -0
- package/dist/button.mjs +3 -3
- package/dist/card.mjs +2 -2
- package/dist/chart.mjs +3 -3
- package/dist/{chunk-YUIZZ6XE.mjs → chunk-3O4U3E5I.mjs} +1 -1
- package/dist/{chunk-JLLMIPIX.mjs → chunk-4VUDTWH7.mjs} +1 -1
- package/dist/{chunk-MG243DSX.mjs → chunk-AEMAY3MR.mjs} +1 -1
- package/dist/{chunk-FYV3MDIL.mjs → chunk-BJNHDIDW.mjs} +4 -4
- package/dist/{chunk-LY6474C4.mjs → chunk-BLSHXIAH.mjs} +36 -71
- package/dist/{chunk-DQ6XFBYJ.mjs → chunk-DYEWXEEY.mjs} +1 -1
- package/dist/{chunk-OUOIDPGX.mjs → chunk-EXF4SESB.mjs} +1 -1
- package/dist/chunk-F236MLT6.mjs +1337 -0
- package/dist/{chunk-PAQ542ER.mjs → chunk-GHB3GOCW.mjs} +4 -2
- package/dist/{chunk-GC3QIIH7.mjs → chunk-GJ4U5NCE.mjs} +23 -1
- package/dist/chunk-HM3CGN32.mjs +669 -0
- package/dist/chunk-I4YUYVJJ.mjs +472 -0
- package/dist/{chunk-NFYS557L.mjs → chunk-JH5VMNDL.mjs} +3 -3
- package/dist/{chunk-TTOR7JCT.mjs → chunk-JRS2M5GY.mjs} +1 -1
- package/dist/{chunk-QXFDXXDB.mjs → chunk-LWTQD345.mjs} +3 -3
- package/dist/{chunk-QE46DVJG.mjs → chunk-MNSHWA6M.mjs} +3 -3
- package/dist/{chunk-JQ4FUHXE.mjs → chunk-MXBPDNMC.mjs} +7 -7
- package/dist/{chunk-VYNVBJK6.mjs → chunk-NDG43KGL.mjs} +1 -1
- package/dist/chunk-O2XH4A3G.mjs +654 -0
- package/dist/{chunk-KDBYDMYV.mjs → chunk-OBCHURW5.mjs} +1 -1
- package/dist/{chunk-FZTAHWOS.mjs → chunk-OGI343OV.mjs} +2 -2
- package/dist/{chunk-XDAEEJYR.mjs → chunk-P23GR7NX.mjs} +2 -2
- package/dist/{chunk-J6L5BLKX.mjs → chunk-PGSPYQOW.mjs} +2 -2
- package/dist/{chunk-J7OETCZ7.mjs → chunk-QFQHD2V6.mjs} +19 -20
- package/dist/chunk-RGZQHSNJ.mjs +845 -0
- package/dist/{chunk-7XRKA6XF.mjs → chunk-RXACBTON.mjs} +5 -5
- package/dist/{chunk-A4QJAOZW.mjs → chunk-USLTNDJA.mjs} +7 -7
- package/dist/{chunk-FACIYUNK.mjs → chunk-VC7LTPQD.mjs} +2 -2
- package/dist/{chunk-CKTAVEW2.mjs → chunk-VIP7HSOU.mjs} +2 -2
- package/dist/{chunk-5MN6ZNFA.mjs → chunk-VUDJ3PYM.mjs} +9 -9
- package/dist/{chunk-2NCBX6XI.mjs → chunk-W2DMBW4E.mjs} +8 -8
- package/dist/{chunk-764YUN2J.mjs → chunk-XELWY7SO.mjs} +150 -49
- package/dist/chunk-ZDF7QP4G.mjs +160 -0
- package/dist/{chunk-4NK2FNAG.mjs → chunk-ZHKMDK5M.mjs} +244 -112
- package/dist/{chunk-C4OI72SM.mjs → chunk-ZVBVGWSP.mjs} +1 -0
- package/dist/chunk-ZYREURXK.mjs +470 -0
- package/dist/connect-button.js +767 -292
- package/dist/connect-button.mjs +8 -8
- package/dist/deposit-modal.d.mts +34 -0
- package/dist/deposit-modal.d.ts +34 -0
- package/dist/deposit-modal.js +2787 -0
- package/dist/deposit-modal.mjs +15 -0
- package/dist/event-list-item-details.js +271 -173
- package/dist/event-list-item-details.mjs +13 -13
- package/dist/event-list-item.js +903 -426
- package/dist/event-list-item.mjs +11 -11
- package/dist/event-list.js +1104 -517
- package/dist/event-list.mjs +14 -14
- package/dist/event-market-page.d.mts +1 -1
- package/dist/event-market-page.d.ts +1 -1
- package/dist/event-market-page.js +1505 -681
- package/dist/event-market-page.mjs +23 -23
- package/dist/hello-world.mjs +3 -3
- package/dist/home-page.d.mts +1 -1
- package/dist/home-page.d.ts +1 -1
- package/dist/home-page.js +1120 -533
- package/dist/home-page.mjs +15 -15
- package/dist/icon.d.mts +74 -4
- package/dist/icon.d.ts +74 -4
- package/dist/icon.js +668 -123
- package/dist/icon.mjs +32 -4
- package/dist/index.d.mts +15 -7
- package/dist/index.d.ts +15 -7
- package/dist/index.js +5301 -2147
- package/dist/index.mjs +80 -32
- package/dist/loading-icon.d.mts +1 -1
- package/dist/loading-icon.d.ts +1 -1
- package/dist/loading-icon.js +1 -0
- package/dist/loading-icon.mjs +3 -3
- package/dist/market-details.d.mts +2 -2
- package/dist/market-details.d.ts +2 -2
- package/dist/market-details.js +1097 -411
- package/dist/market-details.mjs +16 -16
- package/dist/modal.mjs +3 -3
- package/dist/number-value.mjs +2 -2
- package/dist/onboarding-modal.js +1249 -672
- package/dist/onboarding-modal.mjs +8 -8
- package/dist/place-order.d.mts +1 -1
- package/dist/place-order.d.ts +1 -1
- package/dist/place-order.js +1091 -506
- package/dist/place-order.mjs +12 -12
- package/dist/profile-modal.d.mts +66 -0
- package/dist/profile-modal.d.ts +66 -0
- package/dist/profile-modal.js +2429 -0
- package/dist/profile-modal.mjs +14 -0
- package/dist/{registry-CVn79H3I.d.mts → registry-DfSCFAdC.d.mts} +72 -0
- package/dist/{registry-CVn79H3I.d.ts → registry-DfSCFAdC.d.ts} +72 -0
- package/dist/search.d.mts +2 -2
- package/dist/search.d.ts +2 -2
- package/dist/search.js +740 -265
- package/dist/search.mjs +6 -6
- package/dist/select.d.mts +2 -0
- package/dist/select.d.ts +2 -0
- package/dist/select.js +814 -187
- package/dist/select.mjs +5 -5
- package/dist/settlement.d.mts +1 -1
- package/dist/settlement.d.ts +1 -1
- package/dist/settlement.js +891 -417
- package/dist/settlement.mjs +9 -9
- package/dist/skeleton.js +1 -1
- package/dist/skeleton.mjs +3 -3
- package/dist/styles.css +1 -1
- package/dist/switch-button.mjs +2 -2
- package/dist/tabs.js +854 -227
- package/dist/tabs.mjs +6 -6
- package/dist/tailwind.css +1 -1
- package/dist/types-Bed6Q0EK.d.mts +3 -0
- package/dist/types-Bed6Q0EK.d.ts +3 -0
- package/dist/typography.mjs +2 -2
- package/dist/user-profile-page.d.mts +133 -0
- package/dist/user-profile-page.d.ts +133 -0
- package/dist/user-profile-page.js +3335 -0
- package/dist/user-profile-page.mjs +15 -0
- package/dist/venue-logo.d.mts +2 -2
- package/dist/venue-logo.d.ts +2 -2
- package/dist/venue-logo.js +28 -70
- package/dist/venue-logo.mjs +2 -2
- package/dist/{venue-logo.types-Bg8eXtGp.d.ts → venue-logo.types-BSAuY84j.d.ts} +1 -1
- package/dist/{venue-logo.types-B1iPJgiD.d.mts → venue-logo.types-DACqcTvY.d.mts} +1 -1
- package/dist/withdraw-modal.d.mts +36 -0
- package/dist/withdraw-modal.d.ts +36 -0
- package/dist/withdraw-modal.js +2442 -0
- package/dist/withdraw-modal.mjs +14 -0
- package/package.json +43 -3
- package/dist/chunk-DA6KZWSK.mjs +0 -807
- package/dist/chunk-IY2AA3OL.mjs +0 -50
- package/dist/chunk-R3DRVI4J.mjs +0 -741
- package/dist/types-CayJ8tWA.d.mts +0 -3
- package/dist/types-CayJ8tWA.d.ts +0 -3
- package/dist/{types-C5JigCSX.d.mts → types-DkGlbmXq.d.mts} +2 -2
- package/dist/{types-C5JigCSX.d.ts → types-DkGlbmXq.d.ts} +2 -2
|
@@ -8,46 +8,47 @@ import {
|
|
|
8
8
|
resolveOutcomeLabels,
|
|
9
9
|
resolveOutcomesByVenue,
|
|
10
10
|
resolveSeriesColor
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-P23GR7NX.mjs";
|
|
12
12
|
import {
|
|
13
13
|
normalizeProbability,
|
|
14
14
|
resolveEventListItemEvent,
|
|
15
15
|
resolveTileImage,
|
|
16
16
|
resolveTileTitle,
|
|
17
|
+
resolveVenueLabel,
|
|
17
18
|
selectPrimaryVenueMarket
|
|
18
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-GHB3GOCW.mjs";
|
|
19
20
|
import {
|
|
20
21
|
Badge
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-AEMAY3MR.mjs";
|
|
22
23
|
import {
|
|
23
24
|
Skeleton,
|
|
24
25
|
detailsBaseCardClassName,
|
|
25
26
|
eventListItemDetailsTimeRanges
|
|
26
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-JH5VMNDL.mjs";
|
|
27
28
|
import {
|
|
28
29
|
VenueLogo
|
|
29
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-BLSHXIAH.mjs";
|
|
30
31
|
import {
|
|
31
32
|
Button
|
|
32
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-PGSPYQOW.mjs";
|
|
33
34
|
import {
|
|
34
35
|
Typography
|
|
35
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-DYEWXEEY.mjs";
|
|
36
37
|
import {
|
|
37
38
|
Card
|
|
38
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-3O4U3E5I.mjs";
|
|
39
40
|
import {
|
|
40
41
|
LineChart
|
|
41
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-VC7LTPQD.mjs";
|
|
42
43
|
import {
|
|
43
44
|
SwitchButton
|
|
44
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-JRS2M5GY.mjs";
|
|
45
46
|
import {
|
|
46
47
|
__objRest,
|
|
47
48
|
__spreadProps,
|
|
48
49
|
__spreadValues,
|
|
49
50
|
cn
|
|
50
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-GJ4U5NCE.mjs";
|
|
51
52
|
|
|
52
53
|
// src/events/item-details/index.tsx
|
|
53
54
|
import { useEffect, useMemo, useState } from "react";
|
|
@@ -85,12 +86,30 @@ var EventListItemDetailsUnavailableState = ({
|
|
|
85
86
|
}
|
|
86
87
|
);
|
|
87
88
|
};
|
|
89
|
+
var probabilityModeOrder = ["yes", "no"];
|
|
90
|
+
var clampProbability = (value) => {
|
|
91
|
+
if (value < 0)
|
|
92
|
+
return 0;
|
|
93
|
+
if (value > 1)
|
|
94
|
+
return 1;
|
|
95
|
+
return value;
|
|
96
|
+
};
|
|
97
|
+
var resolveAverageProbability = (values) => {
|
|
98
|
+
const validValues = values.filter((value) => value != null);
|
|
99
|
+
if (validValues.length === 0)
|
|
100
|
+
return void 0;
|
|
101
|
+
return validValues.reduce((sum, value) => sum + value, 0) / validValues.length;
|
|
102
|
+
};
|
|
103
|
+
var resolveOutcomeCandidateIds = (market, outcome) => {
|
|
104
|
+
var _a;
|
|
105
|
+
return [outcome.id, (_a = outcome.externalIdentifier) != null ? _a : void 0, market.externalIdentifier].filter(
|
|
106
|
+
(value) => typeof value === "string" && value.trim().length > 0
|
|
107
|
+
);
|
|
108
|
+
};
|
|
88
109
|
var EventListItemDetailsGraphSection = ({
|
|
89
110
|
venueMarkets,
|
|
90
|
-
outcomeLabels,
|
|
91
111
|
selectedOutcomeLabel,
|
|
92
112
|
onSelectedOutcomeLabelChange,
|
|
93
|
-
probabilityByLabel,
|
|
94
113
|
switchLabels,
|
|
95
114
|
isDateOutcomeMarket,
|
|
96
115
|
classNames,
|
|
@@ -100,65 +119,89 @@ var EventListItemDetailsGraphSection = ({
|
|
|
100
119
|
selectedTimeRange
|
|
101
120
|
}) => {
|
|
102
121
|
const labels = useLabels();
|
|
103
|
-
const
|
|
104
|
-
const [
|
|
105
|
-
const
|
|
106
|
-
useEffect(() => {
|
|
107
|
-
setInternalSelectedOutcomeLabel(selectedOutcomeLabel);
|
|
108
|
-
}, [selectedOutcomeLabel]);
|
|
109
|
-
const resolvedSelectedOutcomeLabel = isLocalOutcomeSelection ? internalSelectedOutcomeLabel : selectedOutcomeLabel;
|
|
110
|
-
const selectedOutcomesByVenue = useMemo(() => {
|
|
111
|
-
return resolveOutcomesByVenue(venueMarkets, resolvedSelectedOutcomeLabel);
|
|
112
|
-
}, [resolvedSelectedOutcomeLabel, venueMarkets]);
|
|
113
|
-
const segmentedDisplayItems = useMemo(() => {
|
|
114
|
-
var _a;
|
|
122
|
+
const [selectedVenue, setSelectedVenue] = useState(null);
|
|
123
|
+
const [activeProbabilityMode, setActiveProbabilityMode] = useState("yes");
|
|
124
|
+
const probabilityModeConfigs = useMemo(() => {
|
|
115
125
|
if (isDateOutcomeMarket) {
|
|
116
|
-
const selectedOutcomeAverageProbability = (_a = probabilityByLabel.get(resolvedSelectedOutcomeLabel)) != null ? _a : 0;
|
|
117
|
-
const noProbability = Math.max(0, 1 - selectedOutcomeAverageProbability);
|
|
118
|
-
return [
|
|
119
|
-
{
|
|
120
|
-
label: labels.eventItemDetails.yes,
|
|
121
|
-
display: `${labels.eventItemDetails.yes} ${formatPercent(selectedOutcomeAverageProbability)}`,
|
|
122
|
-
isActive: selectedBinaryOutcome === "Yes",
|
|
123
|
-
onSelect: () => setSelectedBinaryOutcome("Yes")
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
label: labels.eventItemDetails.no,
|
|
127
|
-
display: `${labels.eventItemDetails.no} ${formatPercent(noProbability)}`,
|
|
128
|
-
isActive: selectedBinaryOutcome === "No",
|
|
129
|
-
onSelect: () => setSelectedBinaryOutcome("No")
|
|
130
|
-
}
|
|
131
|
-
];
|
|
132
|
-
}
|
|
133
|
-
return switchLabels.map((label) => {
|
|
134
|
-
const probability = probabilityByLabel.get(label);
|
|
135
|
-
const probabilitySuffix = probability == null ? "" : ` ${formatPercent(probability)}`;
|
|
136
126
|
return {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
127
|
+
yes: {
|
|
128
|
+
switchLabel: switchLabels[0],
|
|
129
|
+
sourceOutcomeLabel: selectedOutcomeLabel,
|
|
130
|
+
transformProbability: (value) => value
|
|
131
|
+
},
|
|
132
|
+
no: {
|
|
133
|
+
switchLabel: switchLabels[1],
|
|
134
|
+
sourceOutcomeLabel: selectedOutcomeLabel,
|
|
135
|
+
transformProbability: (value) => 1 - value
|
|
146
136
|
}
|
|
147
137
|
};
|
|
148
|
-
}
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
yes: {
|
|
141
|
+
switchLabel: switchLabels[0],
|
|
142
|
+
sourceOutcomeLabel: switchLabels[0],
|
|
143
|
+
transformProbability: (value) => value
|
|
144
|
+
},
|
|
145
|
+
no: {
|
|
146
|
+
switchLabel: switchLabels[1],
|
|
147
|
+
sourceOutcomeLabel: switchLabels[1],
|
|
148
|
+
transformProbability: (value) => value
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
}, [isDateOutcomeMarket, selectedOutcomeLabel, switchLabels]);
|
|
152
|
+
const selectedOutcomesByMode = useMemo(() => {
|
|
153
|
+
return {
|
|
154
|
+
yes: resolveOutcomesByVenue(venueMarkets, probabilityModeConfigs.yes.sourceOutcomeLabel),
|
|
155
|
+
no: resolveOutcomesByVenue(venueMarkets, probabilityModeConfigs.no.sourceOutcomeLabel)
|
|
156
|
+
};
|
|
149
157
|
}, [
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
onSelectedOutcomeLabelChange,
|
|
154
|
-
probabilityByLabel,
|
|
155
|
-
resolvedSelectedOutcomeLabel,
|
|
156
|
-
selectedBinaryOutcome,
|
|
157
|
-
switchLabels
|
|
158
|
+
probabilityModeConfigs.no.sourceOutcomeLabel,
|
|
159
|
+
probabilityModeConfigs.yes.sourceOutcomeLabel,
|
|
160
|
+
venueMarkets
|
|
158
161
|
]);
|
|
162
|
+
useEffect(() => {
|
|
163
|
+
if (isDateOutcomeMarket) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const nextMode = selectedOutcomeLabel === probabilityModeConfigs.no.sourceOutcomeLabel ? "no" : "yes";
|
|
167
|
+
setActiveProbabilityMode(nextMode);
|
|
168
|
+
}, [isDateOutcomeMarket, probabilityModeConfigs.no.sourceOutcomeLabel, selectedOutcomeLabel]);
|
|
169
|
+
const normalizedVenueDataByMode = useMemo(() => {
|
|
170
|
+
const buildModeData = (mode) => {
|
|
171
|
+
const modeConfig = probabilityModeConfigs[mode];
|
|
172
|
+
return selectedOutcomesByMode[mode].map((outcomeByVenue, index) => {
|
|
173
|
+
const rawProbability = normalizeProbability(outcomeByVenue.outcome.price);
|
|
174
|
+
const transformedProbability = rawProbability == null ? void 0 : clampProbability(modeConfig.transformProbability(rawProbability));
|
|
175
|
+
return {
|
|
176
|
+
venue: outcomeByVenue.venue,
|
|
177
|
+
venueLabel: resolveVenueLabel(outcomeByVenue.venue, venueInfo, labels),
|
|
178
|
+
market: outcomeByVenue.market,
|
|
179
|
+
outcome: outcomeByVenue.outcome,
|
|
180
|
+
probability: transformedProbability,
|
|
181
|
+
color: resolveSeriesColor(outcomeByVenue.venue, index)
|
|
182
|
+
};
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
return {
|
|
186
|
+
yes: buildModeData("yes"),
|
|
187
|
+
no: buildModeData("no")
|
|
188
|
+
};
|
|
189
|
+
}, [labels, probabilityModeConfigs, selectedOutcomesByMode, venueInfo]);
|
|
190
|
+
const allOutcomesForHistory = useMemo(() => {
|
|
191
|
+
const outcomeByModeAndId = /* @__PURE__ */ new Map();
|
|
192
|
+
probabilityModeOrder.forEach((mode) => {
|
|
193
|
+
selectedOutcomesByMode[mode].forEach((outcomeByVenue) => {
|
|
194
|
+
outcomeByModeAndId.set(
|
|
195
|
+
`${outcomeByVenue.venue}:${outcomeByVenue.outcome.id}`,
|
|
196
|
+
outcomeByVenue
|
|
197
|
+
);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
return [...outcomeByModeAndId.values()];
|
|
201
|
+
}, [selectedOutcomesByMode]);
|
|
159
202
|
const priceHistoryGroups = useMemo(() => {
|
|
160
|
-
return buildPriceHistoryGroups(
|
|
161
|
-
}, [
|
|
203
|
+
return buildPriceHistoryGroups(allOutcomesForHistory);
|
|
204
|
+
}, [allOutcomesForHistory]);
|
|
162
205
|
const timeWindow = useMemo(() => {
|
|
163
206
|
return getTimeWindowByRange(selectedTimeRange);
|
|
164
207
|
}, [selectedTimeRange]);
|
|
@@ -167,35 +210,114 @@ var EventListItemDetailsGraphSection = ({
|
|
|
167
210
|
}, timeWindow), {
|
|
168
211
|
enabled: priceHistoryGroups.length > 0
|
|
169
212
|
}));
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
213
|
+
const priceHistoryByVenue = useMemo(() => {
|
|
214
|
+
const historyByVenue = /* @__PURE__ */ new Map();
|
|
215
|
+
if (!(priceHistoryData == null ? void 0 : priceHistoryData.length)) {
|
|
216
|
+
return historyByVenue;
|
|
217
|
+
}
|
|
218
|
+
priceHistoryData.forEach((historyItem) => {
|
|
219
|
+
const venue = historyItem.venue;
|
|
220
|
+
const venueHistory = historyByVenue.get(venue);
|
|
221
|
+
if (venueHistory) {
|
|
222
|
+
venueHistory.push(historyItem);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
historyByVenue.set(venue, [historyItem]);
|
|
226
|
+
});
|
|
227
|
+
return historyByVenue;
|
|
228
|
+
}, [priceHistoryData]);
|
|
229
|
+
const chartSeriesByMode = useMemo(() => {
|
|
230
|
+
const buildSeries = (mode) => {
|
|
231
|
+
const modeConfig = probabilityModeConfigs[mode];
|
|
232
|
+
const chartSeries = [];
|
|
233
|
+
normalizedVenueDataByMode[mode].forEach((venueData) => {
|
|
234
|
+
var _a;
|
|
235
|
+
const venueHistory = priceHistoryByVenue.get(venueData.venue);
|
|
236
|
+
if (!(venueHistory == null ? void 0 : venueHistory.length))
|
|
237
|
+
return;
|
|
238
|
+
const candidateIds = resolveOutcomeCandidateIds(venueData.market, venueData.outcome);
|
|
239
|
+
const matchingHistory = (_a = venueHistory.find((historyItem) => candidateIds.includes(historyItem.marketId))) != null ? _a : venueHistory.length === 1 ? venueHistory[0] : void 0;
|
|
240
|
+
if (!matchingHistory)
|
|
241
|
+
return;
|
|
242
|
+
const points = matchingHistory.points.map((point) => {
|
|
243
|
+
const probability = normalizeProbability(point.price);
|
|
244
|
+
if (probability == null || !Number.isFinite(point.timestamp))
|
|
245
|
+
return null;
|
|
246
|
+
return {
|
|
247
|
+
time: point.timestamp,
|
|
248
|
+
value: clampProbability(modeConfig.transformProbability(probability)) * 100
|
|
249
|
+
};
|
|
250
|
+
}).filter((point) => point != null);
|
|
251
|
+
if (points.length === 0)
|
|
252
|
+
return;
|
|
253
|
+
chartSeries.push({
|
|
254
|
+
id: `${mode}-${venueData.venue}-${matchingHistory.marketId}`,
|
|
255
|
+
venue: venueData.venue,
|
|
256
|
+
color: venueData.color,
|
|
257
|
+
points,
|
|
258
|
+
lineWidth: 2,
|
|
259
|
+
lineStyle: "solid"
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
return chartSeries;
|
|
263
|
+
};
|
|
264
|
+
return {
|
|
265
|
+
yes: buildSeries("yes"),
|
|
266
|
+
no: buildSeries("no")
|
|
267
|
+
};
|
|
268
|
+
}, [normalizedVenueDataByMode, priceHistoryByVenue, probabilityModeConfigs]);
|
|
269
|
+
const visibleChartSeries = useMemo(() => {
|
|
270
|
+
const modeSeries = chartSeriesByMode[activeProbabilityMode];
|
|
271
|
+
if (!selectedVenue)
|
|
272
|
+
return modeSeries;
|
|
273
|
+
return modeSeries.filter((seriesItem) => seriesItem.venue === selectedVenue);
|
|
274
|
+
}, [activeProbabilityMode, chartSeriesByMode, selectedVenue]);
|
|
275
|
+
const segmentedDisplayItems = useMemo(() => {
|
|
276
|
+
return probabilityModeOrder.map((mode) => {
|
|
277
|
+
const averageProbability = resolveAverageProbability(
|
|
278
|
+
normalizedVenueDataByMode[mode].map((venueData) => venueData.probability)
|
|
279
|
+
);
|
|
280
|
+
const suffix = averageProbability == null ? "" : ` ${formatPercent(averageProbability)}`;
|
|
281
|
+
const switchLabel = probabilityModeConfigs[mode].switchLabel;
|
|
179
282
|
return {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
points: history.points.map((point) => ({
|
|
183
|
-
time: point.timestamp,
|
|
184
|
-
value: point.price * 100
|
|
185
|
-
}))
|
|
283
|
+
mode,
|
|
284
|
+
display: `${switchLabel}${suffix}`
|
|
186
285
|
};
|
|
187
|
-
})
|
|
188
|
-
}, [
|
|
286
|
+
});
|
|
287
|
+
}, [formatPercent, normalizedVenueDataByMode, probabilityModeConfigs]);
|
|
288
|
+
const activeModeVenueData = normalizedVenueDataByMode[activeProbabilityMode];
|
|
289
|
+
useEffect(() => {
|
|
290
|
+
if (!selectedVenue) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
if (activeModeVenueData.some((item) => item.venue === selectedVenue)) {
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
setSelectedVenue(null);
|
|
297
|
+
}, [activeModeVenueData, selectedVenue]);
|
|
298
|
+
const handleProbabilityModeChange = (nextMode) => {
|
|
299
|
+
setActiveProbabilityMode(nextMode);
|
|
300
|
+
if (isDateOutcomeMarket) {
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
onSelectedOutcomeLabelChange(probabilityModeConfigs[nextMode].sourceOutcomeLabel);
|
|
304
|
+
};
|
|
305
|
+
const handleVenueToggle = (venue) => {
|
|
306
|
+
setSelectedVenue((currentSelectedVenue) => {
|
|
307
|
+
if (currentSelectedVenue === venue)
|
|
308
|
+
return null;
|
|
309
|
+
return venue;
|
|
310
|
+
});
|
|
311
|
+
};
|
|
189
312
|
return /* @__PURE__ */ jsx(
|
|
190
313
|
LineChart,
|
|
191
314
|
{
|
|
192
315
|
classNames: { root: classNames == null ? void 0 : classNames.chart },
|
|
193
|
-
series:
|
|
316
|
+
series: visibleChartSeries,
|
|
194
317
|
height: 300,
|
|
195
318
|
isLoading: isPriceHistoryLoading,
|
|
196
|
-
showSeriesControls:
|
|
319
|
+
showSeriesControls: activeModeVenueData.length > 0 || segmentedDisplayItems.length > 0,
|
|
197
320
|
renderSeriesControls: () => {
|
|
198
|
-
var _a, _b, _c, _d;
|
|
199
321
|
return /* @__PURE__ */ jsxs(
|
|
200
322
|
"div",
|
|
201
323
|
{
|
|
@@ -208,28 +330,43 @@ var EventListItemDetailsGraphSection = ({
|
|
|
208
330
|
"flex min-w-0 gap-2 overflow-x-auto pb-1 md:flex-wrap md:overflow-visible md:pb-0",
|
|
209
331
|
classNames == null ? void 0 : classNames.outcomeBadges
|
|
210
332
|
),
|
|
211
|
-
children:
|
|
212
|
-
var
|
|
213
|
-
const
|
|
214
|
-
const
|
|
333
|
+
children: activeModeVenueData.map((venueData) => {
|
|
334
|
+
var _a;
|
|
335
|
+
const text = venueData.probability == null ? "-" : formatPercent(venueData.probability);
|
|
336
|
+
const isActiveVenue = selectedVenue === venueData.venue;
|
|
215
337
|
return /* @__PURE__ */ jsx(
|
|
216
|
-
|
|
338
|
+
"button",
|
|
217
339
|
{
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
340
|
+
type: "button",
|
|
341
|
+
"aria-label": `${venueData.venueLabel} ${text}`,
|
|
342
|
+
"aria-pressed": isActiveVenue,
|
|
343
|
+
className: cn(
|
|
344
|
+
"rounded-agg-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-2 focus-visible:ring-offset-agg-secondary-hover"
|
|
345
|
+
),
|
|
346
|
+
onClick: () => handleVenueToggle(venueData.venue),
|
|
347
|
+
children: /* @__PURE__ */ jsx(
|
|
348
|
+
Badge,
|
|
222
349
|
{
|
|
223
|
-
|
|
224
|
-
size: "
|
|
225
|
-
|
|
350
|
+
text,
|
|
351
|
+
size: "l",
|
|
352
|
+
prefix: showVenueLogo ? /* @__PURE__ */ jsx(
|
|
353
|
+
VenueLogo,
|
|
354
|
+
{
|
|
355
|
+
venue: venueData.venue,
|
|
356
|
+
size: "s",
|
|
357
|
+
title: (_a = venueInfo == null ? void 0 : venueInfo[venueData.venue]) == null ? void 0 : _a.label
|
|
358
|
+
}
|
|
359
|
+
) : void 0,
|
|
360
|
+
classNames: {
|
|
361
|
+
root: cn(
|
|
362
|
+
"h-9 shrink-0 border-2 px-4 text-agg-base leading-agg-6",
|
|
363
|
+
isActiveVenue ? "border-agg-primary bg-agg-secondary font-agg-bold" : "border-transparent bg-agg-secondary-hover font-agg-normal"
|
|
364
|
+
)
|
|
365
|
+
}
|
|
226
366
|
}
|
|
227
|
-
)
|
|
228
|
-
classNames: {
|
|
229
|
-
root: "h-9 shrink-0 bg-agg-secondary-hover px-4 text-agg-base leading-agg-6"
|
|
230
|
-
}
|
|
367
|
+
)
|
|
231
368
|
},
|
|
232
|
-
`${
|
|
369
|
+
`${activeProbabilityMode}-${venueData.market.id}-${venueData.outcome.id}`
|
|
233
370
|
);
|
|
234
371
|
})
|
|
235
372
|
}
|
|
@@ -239,13 +376,10 @@ var EventListItemDetailsGraphSection = ({
|
|
|
239
376
|
{
|
|
240
377
|
ariaLabel: labels.eventItemDetails.outcomeSelectorAria,
|
|
241
378
|
className: cn("w-full md:w-fit", classNames == null ? void 0 : classNames.segmentedControl),
|
|
242
|
-
value:
|
|
243
|
-
onValueChange:
|
|
244
|
-
var _a2;
|
|
245
|
-
(_a2 = segmentedDisplayItems.find((item) => item.label === nextValue)) == null ? void 0 : _a2.onSelect();
|
|
246
|
-
},
|
|
379
|
+
value: activeProbabilityMode,
|
|
380
|
+
onValueChange: handleProbabilityModeChange,
|
|
247
381
|
options: segmentedDisplayItems.map((segmentedItem) => ({
|
|
248
|
-
value: segmentedItem.
|
|
382
|
+
value: segmentedItem.mode,
|
|
249
383
|
label: segmentedItem.display,
|
|
250
384
|
ariaLabel: segmentedItem.display
|
|
251
385
|
}))
|
|
@@ -365,7 +499,7 @@ var EventListItemDetailsContent = ({
|
|
|
365
499
|
className: cn(detailsBaseCardClassName, classNames == null ? void 0 : classNames.root),
|
|
366
500
|
"aria-label": ariaLabel != null ? ariaLabel : resolvedTitle,
|
|
367
501
|
children: [
|
|
368
|
-
/* @__PURE__ */ jsxs("div", { className: cn("flex items-start gap-3 md:gap-4", classNames == null ? void 0 : classNames.header), children: [
|
|
502
|
+
/* @__PURE__ */ jsxs("div", { className: cn("flex items-start gap-3 md:gap-4 ", classNames == null ? void 0 : classNames.header), children: [
|
|
369
503
|
resolvedImage ? /* @__PURE__ */ jsx(
|
|
370
504
|
"img",
|
|
371
505
|
{
|
|
@@ -380,7 +514,7 @@ var EventListItemDetailsContent = ({
|
|
|
380
514
|
{
|
|
381
515
|
variant: "value",
|
|
382
516
|
className: cn(
|
|
383
|
-
"min-w-0 text-agg-base font-agg-bold leading-agg-6 whitespace-normal [display:-webkit-box] [-webkit-box-orient:vertical] [-webkit-line-clamp:2] md:text-agg-2xl md:leading-agg-8 md:
|
|
517
|
+
"min-w-0 text-agg-base font-agg-bold! leading-agg-6 whitespace-normal [display:-webkit-box] [-webkit-box-orient:vertical] [-webkit-line-clamp:2] md:text-agg-2xl md:leading-agg-8 md:block md:truncate md:whitespace-nowrap",
|
|
384
518
|
classNames == null ? void 0 : classNames.title
|
|
385
519
|
),
|
|
386
520
|
children: resolvedTitle
|
|
@@ -452,10 +586,8 @@ var EventListItemDetailsContent = ({
|
|
|
452
586
|
EventListItemDetailsGraphSection,
|
|
453
587
|
{
|
|
454
588
|
venueMarkets,
|
|
455
|
-
outcomeLabels,
|
|
456
589
|
selectedOutcomeLabel,
|
|
457
590
|
onSelectedOutcomeLabelChange: setSelectedOutcomeLabel,
|
|
458
|
-
probabilityByLabel,
|
|
459
591
|
switchLabels,
|
|
460
592
|
isDateOutcomeMarket,
|
|
461
593
|
classNames,
|