@agg-market/ui 8.0.0 → 9.0.0
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-WKY3IN52.mjs → chunk-3G7C6WEC.mjs} +10 -3
- package/dist/{chunk-JE4MV5RL.mjs → chunk-3U4VHAP6.mjs} +1 -1
- package/dist/{chunk-TLFRGJ5B.mjs → chunk-6CRY27SQ.mjs} +75 -45
- package/dist/{chunk-KRCRD4AJ.mjs → chunk-HJ4UPYM7.mjs} +14 -12
- package/dist/{chunk-SBLIHCN2.mjs → chunk-N7U7QCSB.mjs} +1 -1
- package/dist/events.js +78 -41
- package/dist/events.mjs +2 -2
- package/dist/index.js +88 -49
- package/dist/index.mjs +5 -5
- package/dist/modals.mjs +2 -2
- package/dist/pages.js +88 -49
- package/dist/pages.mjs +4 -4
- package/dist/primitives.js +10 -3
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.mjs +2 -2
- package/dist/types/events/item/event-list-item.types.d.mts +5 -2
- package/dist/types/events/item/event-list-item.types.d.ts +5 -2
- package/dist/types/events/item/event-list-item.utils.d.mts +5 -5
- package/dist/types/events/item/event-list-item.utils.d.ts +5 -5
- package/dist/types/events/item/index.d.mts +1 -1
- package/dist/types/events/item/index.d.ts +1 -1
- package/dist/types/events/item-details/event-list-item-details.types.d.mts +4 -3
- package/dist/types/events/item-details/event-list-item-details.types.d.ts +4 -3
- package/dist/types/events/list/event-list.types.d.mts +4 -4
- package/dist/types/events/list/event-list.types.d.ts +4 -4
- package/dist/types/events/list/event-list.utils.d.mts +5 -5
- package/dist/types/events/list/event-list.utils.d.ts +5 -5
- package/dist/types/events/market-details/market-details.types.d.mts +5 -3
- package/dist/types/events/market-details/market-details.types.d.ts +5 -3
- package/dist/types/events/market-details/market-details.utils.d.mts +16 -5
- package/dist/types/events/market-details/market-details.utils.d.ts +16 -5
- package/dist/types/onramp/index.d.mts +6 -0
- package/dist/types/onramp/index.d.ts +6 -0
- package/dist/types/onramp/onramp-modal.constants.d.mts +9 -0
- package/dist/types/onramp/onramp-modal.constants.d.ts +9 -0
- package/dist/types/onramp/onramp-modal.types.d.mts +64 -0
- package/dist/types/onramp/onramp-modal.types.d.ts +64 -0
- package/dist/types/onramp/steps/quote-card.d.mts +8 -0
- package/dist/types/onramp/steps/quote-card.d.ts +8 -0
- package/dist/types/onramp/steps/quote-form.d.mts +12 -0
- package/dist/types/onramp/steps/quote-form.d.ts +12 -0
- package/dist/types/onramp/steps/quote-selection.d.mts +14 -0
- package/dist/types/onramp/steps/quote-selection.d.ts +14 -0
- package/dist/types/onramp/steps/widget.d.mts +7 -0
- package/dist/types/onramp/steps/widget.d.ts +7 -0
- package/dist/types/pages/event-market/event-market.types.d.mts +2 -2
- package/dist/types/pages/event-market/event-market.types.d.ts +2 -2
- package/dist/types/primitives/chart/index.d.mts +10 -1
- package/dist/types/primitives/chart/index.d.ts +10 -1
- package/dist/types/trading/types.d.mts +2 -2
- package/dist/types/trading/types.d.ts +2 -2
- package/package.json +1 -1
package/dist/events.js
CHANGED
|
@@ -3265,7 +3265,11 @@ var LineChart = ({
|
|
|
3265
3265
|
isLoading = false,
|
|
3266
3266
|
chartType = "line",
|
|
3267
3267
|
showSeriesControls = true,
|
|
3268
|
-
renderSeriesControls
|
|
3268
|
+
renderSeriesControls,
|
|
3269
|
+
liveCandle: liveForming,
|
|
3270
|
+
lineData,
|
|
3271
|
+
lineValue,
|
|
3272
|
+
live = false
|
|
3269
3273
|
}) => {
|
|
3270
3274
|
var _a, _b;
|
|
3271
3275
|
const labels = (0, import_hooks12.useLabels)();
|
|
@@ -3360,12 +3364,15 @@ var LineChart = ({
|
|
|
3360
3364
|
color: (_b = primarySeries == null ? void 0 : primarySeries.color) != null ? _b : "var(--agg-color-primary)",
|
|
3361
3365
|
theme: livelineTheme,
|
|
3362
3366
|
grid: true,
|
|
3363
|
-
momentum:
|
|
3364
|
-
pulse:
|
|
3367
|
+
momentum: live,
|
|
3368
|
+
pulse: live,
|
|
3365
3369
|
window: windowSeconds,
|
|
3366
3370
|
mode: chartType === "candlestick" ? "candle" : "line",
|
|
3367
3371
|
candles: chartType === "candlestick" ? primaryCandles : void 0,
|
|
3368
3372
|
candleWidth: chartType === "candlestick" ? candleWidth : void 0,
|
|
3373
|
+
liveCandle: chartType === "candlestick" ? liveForming : void 0,
|
|
3374
|
+
lineData,
|
|
3375
|
+
lineValue,
|
|
3369
3376
|
formatValue: defaultValueFormatter,
|
|
3370
3377
|
formatTime: timeFormatter,
|
|
3371
3378
|
padding: {
|
|
@@ -4066,10 +4073,7 @@ Tabs.displayName = "Tabs";
|
|
|
4066
4073
|
var resolveEventListItemEvent = (fetchedEvent) => {
|
|
4067
4074
|
if (!fetchedEvent)
|
|
4068
4075
|
return void 0;
|
|
4069
|
-
|
|
4070
|
-
(market) => market.venueMarkets
|
|
4071
|
-
);
|
|
4072
|
-
if (mergedVenueMarkets.length === 0)
|
|
4076
|
+
if (!fetchedEvent.venueMarkets || fetchedEvent.venueMarkets.length === 0)
|
|
4073
4077
|
return void 0;
|
|
4074
4078
|
return fetchedEvent;
|
|
4075
4079
|
};
|
|
@@ -4266,8 +4270,8 @@ var EventListItemContent = ({
|
|
|
4266
4270
|
const config = (0, import_hooks15.useSdkUiConfig)();
|
|
4267
4271
|
const labels = (0, import_hooks15.useLabels)();
|
|
4268
4272
|
const allVenueMarkets = (0, import_react6.useMemo)(() => {
|
|
4269
|
-
return event.
|
|
4270
|
-
}, [event.
|
|
4273
|
+
return event.venueMarkets;
|
|
4274
|
+
}, [event.venueMarkets]);
|
|
4271
4275
|
const primaryVenueMarket = (0, import_react6.useMemo)(() => {
|
|
4272
4276
|
return selectPrimaryVenueMarket(allVenueMarkets);
|
|
4273
4277
|
}, [allVenueMarkets]);
|
|
@@ -4449,7 +4453,8 @@ var EventListItemByEventId = (_a) => {
|
|
|
4449
4453
|
error,
|
|
4450
4454
|
isError,
|
|
4451
4455
|
isLoading
|
|
4452
|
-
} = (0, import_hooks15.
|
|
4456
|
+
} = (0, import_hooks15.useVenueEvent)({
|
|
4457
|
+
eventId: eventId != null ? eventId : "",
|
|
4453
4458
|
enabled: !!eventId
|
|
4454
4459
|
});
|
|
4455
4460
|
const resolvedEvent = (0, import_react6.useMemo)(() => {
|
|
@@ -5108,13 +5113,12 @@ var EventListItemDetailsContent = ({
|
|
|
5108
5113
|
ariaLabel,
|
|
5109
5114
|
defaultTimeRange
|
|
5110
5115
|
}) => {
|
|
5111
|
-
var _a, _b;
|
|
5112
5116
|
const config = (0, import_hooks17.useSdkUiConfig)();
|
|
5113
5117
|
const labels = (0, import_hooks17.useLabels)();
|
|
5114
5118
|
const venueMarkets = (0, import_react8.useMemo)(() => {
|
|
5115
|
-
var
|
|
5116
|
-
return (
|
|
5117
|
-
}, [event.
|
|
5119
|
+
var _a;
|
|
5120
|
+
return (_a = event.venueMarkets) != null ? _a : [];
|
|
5121
|
+
}, [event.venueMarkets]);
|
|
5118
5122
|
const primaryVenueMarket = (0, import_react8.useMemo)(() => {
|
|
5119
5123
|
return selectPrimaryVenueMarket(venueMarkets);
|
|
5120
5124
|
}, [venueMarkets]);
|
|
@@ -5152,9 +5156,9 @@ var EventListItemDetailsContent = ({
|
|
|
5152
5156
|
if (outcomeLabels.length === 0)
|
|
5153
5157
|
return void 0;
|
|
5154
5158
|
return [...outcomeLabels].sort((left, right) => {
|
|
5155
|
-
var
|
|
5156
|
-
const leftProbability = (
|
|
5157
|
-
const rightProbability = (
|
|
5159
|
+
var _a, _b;
|
|
5160
|
+
const leftProbability = (_a = probabilityByLabel.get(left)) != null ? _a : -1;
|
|
5161
|
+
const rightProbability = (_b = probabilityByLabel.get(right)) != null ? _b : -1;
|
|
5158
5162
|
return rightProbability - leftProbability;
|
|
5159
5163
|
})[0];
|
|
5160
5164
|
}, [outcomeLabels, probabilityByLabel]);
|
|
@@ -5170,18 +5174,18 @@ var EventListItemDetailsContent = ({
|
|
|
5170
5174
|
setSelectedOutcomeLabel(fallbackOutcomeLabel);
|
|
5171
5175
|
}, [isDateOutcomeMarket, mainOutcomeLabel, outcomeLabels, selectedOutcomeLabel]);
|
|
5172
5176
|
const switchLabels = (0, import_react8.useMemo)(() => {
|
|
5173
|
-
var
|
|
5177
|
+
var _a, _b;
|
|
5174
5178
|
if (isDateOutcomeMarket) {
|
|
5175
5179
|
return [labels.eventItemDetails.yes, labels.eventItemDetails.no];
|
|
5176
5180
|
}
|
|
5177
5181
|
const sortedOutcomeLabels = [...outcomeLabels].sort((left, right) => {
|
|
5178
|
-
var
|
|
5179
|
-
const leftProbability = (
|
|
5180
|
-
const rightProbability = (
|
|
5182
|
+
var _a2, _b2;
|
|
5183
|
+
const leftProbability = (_a2 = probabilityByLabel.get(left)) != null ? _a2 : -1;
|
|
5184
|
+
const rightProbability = (_b2 = probabilityByLabel.get(right)) != null ? _b2 : -1;
|
|
5181
5185
|
return rightProbability - leftProbability;
|
|
5182
5186
|
});
|
|
5183
|
-
const firstLabel = (
|
|
5184
|
-
const secondLabel = (
|
|
5187
|
+
const firstLabel = (_a = sortedOutcomeLabels[0]) != null ? _a : labels.eventItemDetails.yes;
|
|
5188
|
+
const secondLabel = (_b = sortedOutcomeLabels.find((label) => label !== firstLabel)) != null ? _b : firstLabel;
|
|
5185
5189
|
return [firstLabel, secondLabel];
|
|
5186
5190
|
}, [
|
|
5187
5191
|
isDateOutcomeMarket,
|
|
@@ -5191,8 +5195,8 @@ var EventListItemDetailsContent = ({
|
|
|
5191
5195
|
probabilityByLabel
|
|
5192
5196
|
]);
|
|
5193
5197
|
const volumeLabel = (0, import_react8.useMemo)(() => {
|
|
5194
|
-
var
|
|
5195
|
-
const resolvedVolume = typeof event.volume === "number" ? event.volume : (
|
|
5198
|
+
var _a;
|
|
5199
|
+
const resolvedVolume = typeof event.volume === "number" ? event.volume : (_a = primaryVenueMarket == null ? void 0 : primaryVenueMarket.volume) != null ? _a : void 0;
|
|
5196
5200
|
if (typeof resolvedVolume !== "number")
|
|
5197
5201
|
return "";
|
|
5198
5202
|
return `${config.formatCompactCurrency(resolvedVolume)} ${labels.eventItemDetails.volumeSuffix}`;
|
|
@@ -5290,7 +5294,7 @@ var EventListItemDetailsContent = ({
|
|
|
5290
5294
|
EventListItemDetailsGraphSection,
|
|
5291
5295
|
{
|
|
5292
5296
|
venueMarkets,
|
|
5293
|
-
canonicalMarketId:
|
|
5297
|
+
canonicalMarketId: event.id,
|
|
5294
5298
|
selectedOutcomeLabel,
|
|
5295
5299
|
onSelectedOutcomeLabelChange: setSelectedOutcomeLabel,
|
|
5296
5300
|
switchLabels,
|
|
@@ -5345,7 +5349,8 @@ var EventListItemDetailsByEventId = (_a) => {
|
|
|
5345
5349
|
error,
|
|
5346
5350
|
isError,
|
|
5347
5351
|
isLoading
|
|
5348
|
-
} = (0, import_hooks17.
|
|
5352
|
+
} = (0, import_hooks17.useVenueEvent)({
|
|
5353
|
+
eventId: eventId != null ? eventId : "",
|
|
5349
5354
|
enabled: !!eventId
|
|
5350
5355
|
});
|
|
5351
5356
|
const resolvedEvent = (0, import_react8.useMemo)(() => {
|
|
@@ -5457,11 +5462,41 @@ var resolveInitialTab = (defaultTab) => {
|
|
|
5457
5462
|
return "order-book";
|
|
5458
5463
|
};
|
|
5459
5464
|
var resolveMarket = (event, marketId) => {
|
|
5460
|
-
|
|
5465
|
+
var _a, _b, _c, _d, _e;
|
|
5466
|
+
if (!event.venueMarkets || event.venueMarkets.length === 0)
|
|
5467
|
+
return void 0;
|
|
5468
|
+
if (!marketId) {
|
|
5469
|
+
return {
|
|
5470
|
+
id: event.id,
|
|
5471
|
+
venueMarkets: event.venueMarkets,
|
|
5472
|
+
volume: event.volume,
|
|
5473
|
+
status: event.status,
|
|
5474
|
+
startDate: event.startDate,
|
|
5475
|
+
endDate: event.endDate,
|
|
5476
|
+
creationDate: event.creationDate,
|
|
5477
|
+
question: event.title
|
|
5478
|
+
};
|
|
5479
|
+
}
|
|
5480
|
+
const venueMarkets = event.venueMarkets;
|
|
5481
|
+
const matchedVenueMarket = venueMarkets.find((vm) => vm.id === marketId);
|
|
5482
|
+
if (!matchedVenueMarket)
|
|
5461
5483
|
return void 0;
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5484
|
+
const siblingVenueMarkets = venueMarkets.filter(
|
|
5485
|
+
(vm) => vm.question === matchedVenueMarket.question
|
|
5486
|
+
);
|
|
5487
|
+
const totalVolume = siblingVenueMarkets.reduce((sum, vm) => {
|
|
5488
|
+
return sum + (typeof vm.volume === "number" ? vm.volume : 0);
|
|
5489
|
+
}, 0);
|
|
5490
|
+
return {
|
|
5491
|
+
id: matchedVenueMarket.id,
|
|
5492
|
+
venueMarkets: siblingVenueMarkets,
|
|
5493
|
+
volume: totalVolume || matchedVenueMarket.volume,
|
|
5494
|
+
status: (_a = matchedVenueMarket.status) != null ? _a : event.status,
|
|
5495
|
+
startDate: (_b = matchedVenueMarket.startDate) != null ? _b : event.startDate,
|
|
5496
|
+
endDate: (_c = matchedVenueMarket.endDate) != null ? _c : event.endDate,
|
|
5497
|
+
creationDate: (_d = matchedVenueMarket.creationDate) != null ? _d : event.creationDate,
|
|
5498
|
+
question: (_e = matchedVenueMarket.question) != null ? _e : event.title
|
|
5499
|
+
};
|
|
5465
5500
|
};
|
|
5466
5501
|
var resolveDisplayOutcomeLabels = (labels) => {
|
|
5467
5502
|
if (!hasBinaryLabels(labels))
|
|
@@ -5794,7 +5829,8 @@ var MarketDetailsContent = ({
|
|
|
5794
5829
|
orderBookDepth = orderBookRowLimitDefault,
|
|
5795
5830
|
ariaLabel,
|
|
5796
5831
|
classNames,
|
|
5797
|
-
otherContent
|
|
5832
|
+
otherContent,
|
|
5833
|
+
liveUpdate = false
|
|
5798
5834
|
}) => {
|
|
5799
5835
|
const config = (0, import_hooks18.useSdkUiConfig)();
|
|
5800
5836
|
const labels = (0, import_hooks18.useLabels)();
|
|
@@ -5897,9 +5933,9 @@ var MarketDetailsContent = ({
|
|
|
5897
5933
|
return selectedOutcomesByVenue.map(({ market, outcome }) => ({
|
|
5898
5934
|
market,
|
|
5899
5935
|
outcome,
|
|
5900
|
-
liveUpdate
|
|
5936
|
+
liveUpdate
|
|
5901
5937
|
}));
|
|
5902
|
-
}, [selectedOutcomesByVenue]);
|
|
5938
|
+
}, [selectedOutcomesByVenue, liveUpdate]);
|
|
5903
5939
|
const {
|
|
5904
5940
|
data: orderBookData,
|
|
5905
5941
|
isLoading: isOrderBookLoading,
|
|
@@ -5907,7 +5943,8 @@ var MarketDetailsContent = ({
|
|
|
5907
5943
|
results: orderBookResults
|
|
5908
5944
|
} = (0, import_hooks18.useOrderBook)({
|
|
5909
5945
|
orderbooks: orderBookInputs,
|
|
5910
|
-
enabled: isOpened && selectedTab === "order-book" && orderBookInputs.length > 0
|
|
5946
|
+
enabled: isOpened && selectedTab === "order-book" && orderBookInputs.length > 0,
|
|
5947
|
+
canonicalMarketId: liveUpdate ? canonicalMarketIdForHistory : void 0
|
|
5911
5948
|
});
|
|
5912
5949
|
const askRows = (0, import_react9.useMemo)(() => {
|
|
5913
5950
|
return resolveOrderBookRows({
|
|
@@ -5998,7 +6035,7 @@ var MarketDetailsContent = ({
|
|
|
5998
6035
|
return [];
|
|
5999
6036
|
return resolveOtherTabRows(model.market, labels);
|
|
6000
6037
|
}, [labels, model]);
|
|
6001
|
-
const isOrderBookNotFound =
|
|
6038
|
+
const isOrderBookNotFound = orderBookError && typeof orderBookError === "object" && "status" in orderBookError && orderBookError.status === 404;
|
|
6002
6039
|
const hasOrderBookError = !!orderBookError && !isOrderBookNotFound;
|
|
6003
6040
|
const hasNoOrderBook = isOrderBookNotFound || !isOrderBookLoading && !hasOrderBookError && (orderBookInputs.length === 0 || askRows.length === 0 && bidRows.length === 0);
|
|
6004
6041
|
const handleOutcomeKeyDown = (eventToHandle) => {
|
|
@@ -6362,7 +6399,7 @@ var MarketDetailsContent = ({
|
|
|
6362
6399
|
);
|
|
6363
6400
|
};
|
|
6364
6401
|
var MarketDetails = (props) => {
|
|
6365
|
-
var _a;
|
|
6402
|
+
var _a, _b;
|
|
6366
6403
|
const [uncontrolledIsOpened, setUncontrolledIsOpened] = (0, import_react9.useState)(
|
|
6367
6404
|
(_a = props.defaultIsOpened) != null ? _a : marketDetailsDefaultIsOpened
|
|
6368
6405
|
);
|
|
@@ -6384,7 +6421,8 @@ var MarketDetails = (props) => {
|
|
|
6384
6421
|
event: fetchedEvent,
|
|
6385
6422
|
error: eventError,
|
|
6386
6423
|
isLoading: isFetchingEvent
|
|
6387
|
-
} = (0, import_hooks18.
|
|
6424
|
+
} = (0, import_hooks18.useVenueEvent)({
|
|
6425
|
+
eventId: hasEventProp ? "" : (_b = props.eventId) != null ? _b : "",
|
|
6388
6426
|
enabled: !props.isLoading && !hasEventProp && !!props.eventId
|
|
6389
6427
|
});
|
|
6390
6428
|
if (props.isLoading) {
|
|
@@ -6467,8 +6505,7 @@ var getDefaultEventListTabs = (labels) => {
|
|
|
6467
6505
|
|
|
6468
6506
|
// src/events/list/event-list.utils.ts
|
|
6469
6507
|
var mapEventToEventListItemEvent = (event) => {
|
|
6470
|
-
|
|
6471
|
-
if (mergedVenueMarkets.length === 0)
|
|
6508
|
+
if (!event.venueMarkets || event.venueMarkets.length === 0)
|
|
6472
6509
|
return null;
|
|
6473
6510
|
return event;
|
|
6474
6511
|
};
|
|
@@ -6560,7 +6597,7 @@ var EventList = ({
|
|
|
6560
6597
|
}, [maxVisibleItems]);
|
|
6561
6598
|
const requestLimit = resolvedMaxVisibleItems != null ? resolvedMaxVisibleItems : limit;
|
|
6562
6599
|
const shouldPaginate = resolvedMaxVisibleItems == null;
|
|
6563
|
-
const { events, isLoading, isError, fetchNextPage, hasNextPage, isFetchingNextPage } = (0, import_hooks19.
|
|
6600
|
+
const { events, isLoading, isError, fetchNextPage, hasNextPage, isFetchingNextPage } = (0, import_hooks19.useVenueEvents)({
|
|
6564
6601
|
venues,
|
|
6565
6602
|
search,
|
|
6566
6603
|
categoryIds,
|
package/dist/events.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -1232,7 +1232,11 @@ var LineChart = ({
|
|
|
1232
1232
|
isLoading = false,
|
|
1233
1233
|
chartType = "line",
|
|
1234
1234
|
showSeriesControls = true,
|
|
1235
|
-
renderSeriesControls
|
|
1235
|
+
renderSeriesControls,
|
|
1236
|
+
liveCandle: liveForming,
|
|
1237
|
+
lineData,
|
|
1238
|
+
lineValue,
|
|
1239
|
+
live = false
|
|
1236
1240
|
}) => {
|
|
1237
1241
|
var _a, _b;
|
|
1238
1242
|
const labels = (0, import_hooks11.useLabels)();
|
|
@@ -1327,12 +1331,15 @@ var LineChart = ({
|
|
|
1327
1331
|
color: (_b = primarySeries == null ? void 0 : primarySeries.color) != null ? _b : "var(--agg-color-primary)",
|
|
1328
1332
|
theme: livelineTheme,
|
|
1329
1333
|
grid: true,
|
|
1330
|
-
momentum:
|
|
1331
|
-
pulse:
|
|
1334
|
+
momentum: live,
|
|
1335
|
+
pulse: live,
|
|
1332
1336
|
window: windowSeconds,
|
|
1333
1337
|
mode: chartType === "candlestick" ? "candle" : "line",
|
|
1334
1338
|
candles: chartType === "candlestick" ? primaryCandles : void 0,
|
|
1335
1339
|
candleWidth: chartType === "candlestick" ? candleWidth : void 0,
|
|
1340
|
+
liveCandle: chartType === "candlestick" ? liveForming : void 0,
|
|
1341
|
+
lineData,
|
|
1342
|
+
lineValue,
|
|
1336
1343
|
formatValue: defaultValueFormatter,
|
|
1337
1344
|
formatTime: timeFormatter,
|
|
1338
1345
|
padding: {
|
|
@@ -5551,10 +5558,7 @@ var isErrorWithStatus = (error, status) => {
|
|
|
5551
5558
|
var resolveEventListItemEvent = (fetchedEvent) => {
|
|
5552
5559
|
if (!fetchedEvent)
|
|
5553
5560
|
return void 0;
|
|
5554
|
-
|
|
5555
|
-
(market) => market.venueMarkets
|
|
5556
|
-
);
|
|
5557
|
-
if (mergedVenueMarkets.length === 0)
|
|
5561
|
+
if (!fetchedEvent.venueMarkets || fetchedEvent.venueMarkets.length === 0)
|
|
5558
5562
|
return void 0;
|
|
5559
5563
|
return fetchedEvent;
|
|
5560
5564
|
};
|
|
@@ -5751,8 +5755,8 @@ var EventListItemContent = ({
|
|
|
5751
5755
|
const config = (0, import_hooks21.useSdkUiConfig)();
|
|
5752
5756
|
const labels = (0, import_hooks21.useLabels)();
|
|
5753
5757
|
const allVenueMarkets = (0, import_react8.useMemo)(() => {
|
|
5754
|
-
return event.
|
|
5755
|
-
}, [event.
|
|
5758
|
+
return event.venueMarkets;
|
|
5759
|
+
}, [event.venueMarkets]);
|
|
5756
5760
|
const primaryVenueMarket = (0, import_react8.useMemo)(() => {
|
|
5757
5761
|
return selectPrimaryVenueMarket(allVenueMarkets);
|
|
5758
5762
|
}, [allVenueMarkets]);
|
|
@@ -5934,7 +5938,8 @@ var EventListItemByEventId = (_a) => {
|
|
|
5934
5938
|
error,
|
|
5935
5939
|
isError,
|
|
5936
5940
|
isLoading
|
|
5937
|
-
} = (0, import_hooks21.
|
|
5941
|
+
} = (0, import_hooks21.useVenueEvent)({
|
|
5942
|
+
eventId: eventId != null ? eventId : "",
|
|
5938
5943
|
enabled: !!eventId
|
|
5939
5944
|
});
|
|
5940
5945
|
const resolvedEvent = (0, import_react8.useMemo)(() => {
|
|
@@ -6593,13 +6598,12 @@ var EventListItemDetailsContent = ({
|
|
|
6593
6598
|
ariaLabel,
|
|
6594
6599
|
defaultTimeRange
|
|
6595
6600
|
}) => {
|
|
6596
|
-
var _a, _b;
|
|
6597
6601
|
const config = (0, import_hooks23.useSdkUiConfig)();
|
|
6598
6602
|
const labels = (0, import_hooks23.useLabels)();
|
|
6599
6603
|
const venueMarkets = (0, import_react10.useMemo)(() => {
|
|
6600
|
-
var
|
|
6601
|
-
return (
|
|
6602
|
-
}, [event.
|
|
6604
|
+
var _a;
|
|
6605
|
+
return (_a = event.venueMarkets) != null ? _a : [];
|
|
6606
|
+
}, [event.venueMarkets]);
|
|
6603
6607
|
const primaryVenueMarket = (0, import_react10.useMemo)(() => {
|
|
6604
6608
|
return selectPrimaryVenueMarket(venueMarkets);
|
|
6605
6609
|
}, [venueMarkets]);
|
|
@@ -6637,9 +6641,9 @@ var EventListItemDetailsContent = ({
|
|
|
6637
6641
|
if (outcomeLabels.length === 0)
|
|
6638
6642
|
return void 0;
|
|
6639
6643
|
return [...outcomeLabels].sort((left, right) => {
|
|
6640
|
-
var
|
|
6641
|
-
const leftProbability = (
|
|
6642
|
-
const rightProbability = (
|
|
6644
|
+
var _a, _b;
|
|
6645
|
+
const leftProbability = (_a = probabilityByLabel.get(left)) != null ? _a : -1;
|
|
6646
|
+
const rightProbability = (_b = probabilityByLabel.get(right)) != null ? _b : -1;
|
|
6643
6647
|
return rightProbability - leftProbability;
|
|
6644
6648
|
})[0];
|
|
6645
6649
|
}, [outcomeLabels, probabilityByLabel]);
|
|
@@ -6655,18 +6659,18 @@ var EventListItemDetailsContent = ({
|
|
|
6655
6659
|
setSelectedOutcomeLabel(fallbackOutcomeLabel);
|
|
6656
6660
|
}, [isDateOutcomeMarket, mainOutcomeLabel, outcomeLabels, selectedOutcomeLabel]);
|
|
6657
6661
|
const switchLabels = (0, import_react10.useMemo)(() => {
|
|
6658
|
-
var
|
|
6662
|
+
var _a, _b;
|
|
6659
6663
|
if (isDateOutcomeMarket) {
|
|
6660
6664
|
return [labels.eventItemDetails.yes, labels.eventItemDetails.no];
|
|
6661
6665
|
}
|
|
6662
6666
|
const sortedOutcomeLabels = [...outcomeLabels].sort((left, right) => {
|
|
6663
|
-
var
|
|
6664
|
-
const leftProbability = (
|
|
6665
|
-
const rightProbability = (
|
|
6667
|
+
var _a2, _b2;
|
|
6668
|
+
const leftProbability = (_a2 = probabilityByLabel.get(left)) != null ? _a2 : -1;
|
|
6669
|
+
const rightProbability = (_b2 = probabilityByLabel.get(right)) != null ? _b2 : -1;
|
|
6666
6670
|
return rightProbability - leftProbability;
|
|
6667
6671
|
});
|
|
6668
|
-
const firstLabel = (
|
|
6669
|
-
const secondLabel = (
|
|
6672
|
+
const firstLabel = (_a = sortedOutcomeLabels[0]) != null ? _a : labels.eventItemDetails.yes;
|
|
6673
|
+
const secondLabel = (_b = sortedOutcomeLabels.find((label) => label !== firstLabel)) != null ? _b : firstLabel;
|
|
6670
6674
|
return [firstLabel, secondLabel];
|
|
6671
6675
|
}, [
|
|
6672
6676
|
isDateOutcomeMarket,
|
|
@@ -6676,8 +6680,8 @@ var EventListItemDetailsContent = ({
|
|
|
6676
6680
|
probabilityByLabel
|
|
6677
6681
|
]);
|
|
6678
6682
|
const volumeLabel = (0, import_react10.useMemo)(() => {
|
|
6679
|
-
var
|
|
6680
|
-
const resolvedVolume = typeof event.volume === "number" ? event.volume : (
|
|
6683
|
+
var _a;
|
|
6684
|
+
const resolvedVolume = typeof event.volume === "number" ? event.volume : (_a = primaryVenueMarket == null ? void 0 : primaryVenueMarket.volume) != null ? _a : void 0;
|
|
6681
6685
|
if (typeof resolvedVolume !== "number")
|
|
6682
6686
|
return "";
|
|
6683
6687
|
return `${config.formatCompactCurrency(resolvedVolume)} ${labels.eventItemDetails.volumeSuffix}`;
|
|
@@ -6775,7 +6779,7 @@ var EventListItemDetailsContent = ({
|
|
|
6775
6779
|
EventListItemDetailsGraphSection,
|
|
6776
6780
|
{
|
|
6777
6781
|
venueMarkets,
|
|
6778
|
-
canonicalMarketId:
|
|
6782
|
+
canonicalMarketId: event.id,
|
|
6779
6783
|
selectedOutcomeLabel,
|
|
6780
6784
|
onSelectedOutcomeLabelChange: setSelectedOutcomeLabel,
|
|
6781
6785
|
switchLabels,
|
|
@@ -6830,7 +6834,8 @@ var EventListItemDetailsByEventId = (_a) => {
|
|
|
6830
6834
|
error,
|
|
6831
6835
|
isError,
|
|
6832
6836
|
isLoading
|
|
6833
|
-
} = (0, import_hooks23.
|
|
6837
|
+
} = (0, import_hooks23.useVenueEvent)({
|
|
6838
|
+
eventId: eventId != null ? eventId : "",
|
|
6834
6839
|
enabled: !!eventId
|
|
6835
6840
|
});
|
|
6836
6841
|
const resolvedEvent = (0, import_react10.useMemo)(() => {
|
|
@@ -6942,11 +6947,41 @@ var resolveInitialTab = (defaultTab) => {
|
|
|
6942
6947
|
return "order-book";
|
|
6943
6948
|
};
|
|
6944
6949
|
var resolveMarket = (event, marketId) => {
|
|
6945
|
-
|
|
6950
|
+
var _a, _b, _c, _d, _e;
|
|
6951
|
+
if (!event.venueMarkets || event.venueMarkets.length === 0)
|
|
6946
6952
|
return void 0;
|
|
6947
|
-
if (!marketId)
|
|
6948
|
-
return
|
|
6949
|
-
|
|
6953
|
+
if (!marketId) {
|
|
6954
|
+
return {
|
|
6955
|
+
id: event.id,
|
|
6956
|
+
venueMarkets: event.venueMarkets,
|
|
6957
|
+
volume: event.volume,
|
|
6958
|
+
status: event.status,
|
|
6959
|
+
startDate: event.startDate,
|
|
6960
|
+
endDate: event.endDate,
|
|
6961
|
+
creationDate: event.creationDate,
|
|
6962
|
+
question: event.title
|
|
6963
|
+
};
|
|
6964
|
+
}
|
|
6965
|
+
const venueMarkets = event.venueMarkets;
|
|
6966
|
+
const matchedVenueMarket = venueMarkets.find((vm) => vm.id === marketId);
|
|
6967
|
+
if (!matchedVenueMarket)
|
|
6968
|
+
return void 0;
|
|
6969
|
+
const siblingVenueMarkets = venueMarkets.filter(
|
|
6970
|
+
(vm) => vm.question === matchedVenueMarket.question
|
|
6971
|
+
);
|
|
6972
|
+
const totalVolume = siblingVenueMarkets.reduce((sum, vm) => {
|
|
6973
|
+
return sum + (typeof vm.volume === "number" ? vm.volume : 0);
|
|
6974
|
+
}, 0);
|
|
6975
|
+
return {
|
|
6976
|
+
id: matchedVenueMarket.id,
|
|
6977
|
+
venueMarkets: siblingVenueMarkets,
|
|
6978
|
+
volume: totalVolume || matchedVenueMarket.volume,
|
|
6979
|
+
status: (_a = matchedVenueMarket.status) != null ? _a : event.status,
|
|
6980
|
+
startDate: (_b = matchedVenueMarket.startDate) != null ? _b : event.startDate,
|
|
6981
|
+
endDate: (_c = matchedVenueMarket.endDate) != null ? _c : event.endDate,
|
|
6982
|
+
creationDate: (_d = matchedVenueMarket.creationDate) != null ? _d : event.creationDate,
|
|
6983
|
+
question: (_e = matchedVenueMarket.question) != null ? _e : event.title
|
|
6984
|
+
};
|
|
6950
6985
|
};
|
|
6951
6986
|
var resolveDisplayOutcomeLabels = (labels) => {
|
|
6952
6987
|
if (!hasBinaryLabels(labels))
|
|
@@ -7279,7 +7314,8 @@ var MarketDetailsContent = ({
|
|
|
7279
7314
|
orderBookDepth = orderBookRowLimitDefault,
|
|
7280
7315
|
ariaLabel,
|
|
7281
7316
|
classNames,
|
|
7282
|
-
otherContent
|
|
7317
|
+
otherContent,
|
|
7318
|
+
liveUpdate = false
|
|
7283
7319
|
}) => {
|
|
7284
7320
|
const config = (0, import_hooks24.useSdkUiConfig)();
|
|
7285
7321
|
const labels = (0, import_hooks24.useLabels)();
|
|
@@ -7382,9 +7418,9 @@ var MarketDetailsContent = ({
|
|
|
7382
7418
|
return selectedOutcomesByVenue.map(({ market, outcome }) => ({
|
|
7383
7419
|
market,
|
|
7384
7420
|
outcome,
|
|
7385
|
-
liveUpdate
|
|
7421
|
+
liveUpdate
|
|
7386
7422
|
}));
|
|
7387
|
-
}, [selectedOutcomesByVenue]);
|
|
7423
|
+
}, [selectedOutcomesByVenue, liveUpdate]);
|
|
7388
7424
|
const {
|
|
7389
7425
|
data: orderBookData,
|
|
7390
7426
|
isLoading: isOrderBookLoading,
|
|
@@ -7392,7 +7428,8 @@ var MarketDetailsContent = ({
|
|
|
7392
7428
|
results: orderBookResults
|
|
7393
7429
|
} = (0, import_hooks24.useOrderBook)({
|
|
7394
7430
|
orderbooks: orderBookInputs,
|
|
7395
|
-
enabled: isOpened && selectedTab === "order-book" && orderBookInputs.length > 0
|
|
7431
|
+
enabled: isOpened && selectedTab === "order-book" && orderBookInputs.length > 0,
|
|
7432
|
+
canonicalMarketId: liveUpdate ? canonicalMarketIdForHistory : void 0
|
|
7396
7433
|
});
|
|
7397
7434
|
const askRows = (0, import_react11.useMemo)(() => {
|
|
7398
7435
|
return resolveOrderBookRows({
|
|
@@ -7483,7 +7520,7 @@ var MarketDetailsContent = ({
|
|
|
7483
7520
|
return [];
|
|
7484
7521
|
return resolveOtherTabRows(model.market, labels);
|
|
7485
7522
|
}, [labels, model]);
|
|
7486
|
-
const isOrderBookNotFound =
|
|
7523
|
+
const isOrderBookNotFound = orderBookError && typeof orderBookError === "object" && "status" in orderBookError && orderBookError.status === 404;
|
|
7487
7524
|
const hasOrderBookError = !!orderBookError && !isOrderBookNotFound;
|
|
7488
7525
|
const hasNoOrderBook = isOrderBookNotFound || !isOrderBookLoading && !hasOrderBookError && (orderBookInputs.length === 0 || askRows.length === 0 && bidRows.length === 0);
|
|
7489
7526
|
const handleOutcomeKeyDown = (eventToHandle) => {
|
|
@@ -7847,7 +7884,7 @@ var MarketDetailsContent = ({
|
|
|
7847
7884
|
);
|
|
7848
7885
|
};
|
|
7849
7886
|
var MarketDetails = (props) => {
|
|
7850
|
-
var _a;
|
|
7887
|
+
var _a, _b;
|
|
7851
7888
|
const [uncontrolledIsOpened, setUncontrolledIsOpened] = (0, import_react11.useState)(
|
|
7852
7889
|
(_a = props.defaultIsOpened) != null ? _a : marketDetailsDefaultIsOpened
|
|
7853
7890
|
);
|
|
@@ -7869,7 +7906,8 @@ var MarketDetails = (props) => {
|
|
|
7869
7906
|
event: fetchedEvent,
|
|
7870
7907
|
error: eventError,
|
|
7871
7908
|
isLoading: isFetchingEvent
|
|
7872
|
-
} = (0, import_hooks24.
|
|
7909
|
+
} = (0, import_hooks24.useVenueEvent)({
|
|
7910
|
+
eventId: hasEventProp ? "" : (_b = props.eventId) != null ? _b : "",
|
|
7873
7911
|
enabled: !props.isLoading && !hasEventProp && !!props.eventId
|
|
7874
7912
|
});
|
|
7875
7913
|
if (props.isLoading) {
|
|
@@ -7952,8 +7990,7 @@ var getDefaultEventListTabs = (labels) => {
|
|
|
7952
7990
|
|
|
7953
7991
|
// src/events/list/event-list.utils.ts
|
|
7954
7992
|
var mapEventToEventListItemEvent = (event) => {
|
|
7955
|
-
|
|
7956
|
-
if (mergedVenueMarkets.length === 0)
|
|
7993
|
+
if (!event.venueMarkets || event.venueMarkets.length === 0)
|
|
7957
7994
|
return null;
|
|
7958
7995
|
return event;
|
|
7959
7996
|
};
|
|
@@ -8045,7 +8082,7 @@ var EventList = ({
|
|
|
8045
8082
|
}, [maxVisibleItems]);
|
|
8046
8083
|
const requestLimit = resolvedMaxVisibleItems != null ? resolvedMaxVisibleItems : limit;
|
|
8047
8084
|
const shouldPaginate = resolvedMaxVisibleItems == null;
|
|
8048
|
-
const { events, isLoading, isError, fetchNextPage, hasNextPage, isFetchingNextPage } = (0, import_hooks25.
|
|
8085
|
+
const { events, isLoading, isError, fetchNextPage, hasNextPage, isFetchingNextPage } = (0, import_hooks25.useVenueEvents)({
|
|
8049
8086
|
venues,
|
|
8050
8087
|
search,
|
|
8051
8088
|
categoryIds,
|
|
@@ -9197,29 +9234,29 @@ var getMarketDateValue = (market, fallbackIndex) => {
|
|
|
9197
9234
|
};
|
|
9198
9235
|
var resolveHeroMarketId = (event, heroMarketId) => {
|
|
9199
9236
|
var _a, _b;
|
|
9200
|
-
if (!((_a = event == null ? void 0 : event.
|
|
9237
|
+
if (!((_a = event == null ? void 0 : event.venueMarkets) == null ? void 0 : _a.length))
|
|
9201
9238
|
return void 0;
|
|
9202
9239
|
if (heroMarketId) {
|
|
9203
|
-
const matchingHeroMarket = event.
|
|
9240
|
+
const matchingHeroMarket = event.venueMarkets.find(
|
|
9204
9241
|
(market) => market.id === heroMarketId
|
|
9205
9242
|
);
|
|
9206
9243
|
if (matchingHeroMarket)
|
|
9207
9244
|
return matchingHeroMarket.id;
|
|
9208
9245
|
}
|
|
9209
|
-
return (_b = event.
|
|
9246
|
+
return (_b = event.venueMarkets[0]) == null ? void 0 : _b.id;
|
|
9210
9247
|
};
|
|
9211
9248
|
var buildHeroEvent = (event, heroMarketId) => {
|
|
9212
9249
|
if (!heroMarketId)
|
|
9213
9250
|
return void 0;
|
|
9214
|
-
const heroMarket = event.
|
|
9251
|
+
const heroMarket = event.venueMarkets.find((market) => market.id === heroMarketId);
|
|
9215
9252
|
if (!heroMarket)
|
|
9216
9253
|
return void 0;
|
|
9217
9254
|
return __spreadProps(__spreadValues({}, event), {
|
|
9218
|
-
|
|
9255
|
+
venueMarkets: [heroMarket]
|
|
9219
9256
|
});
|
|
9220
9257
|
};
|
|
9221
9258
|
var resolveDetailedMarkets = (event, heroMarketId) => {
|
|
9222
|
-
return event.
|
|
9259
|
+
return event.venueMarkets.filter((market) => market.id !== heroMarketId).map((market, index) => ({
|
|
9223
9260
|
market,
|
|
9224
9261
|
index
|
|
9225
9262
|
})).sort(
|
|
@@ -9377,7 +9414,7 @@ var EventMarketPageContent = ({
|
|
|
9377
9414
|
}
|
|
9378
9415
|
onExpandedMarketChange == null ? void 0 : onExpandedMarketChange(nextExpandedMarketId);
|
|
9379
9416
|
};
|
|
9380
|
-
if (!heroEvent || !event.
|
|
9417
|
+
if (!heroEvent || !event.venueMarkets.length) {
|
|
9381
9418
|
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(EventMarketPageUnavailableState, { ariaLabel });
|
|
9382
9419
|
}
|
|
9383
9420
|
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("section", { className: cn("w-full", classNames == null ? void 0 : classNames.root), "aria-label": ariaLabel != null ? ariaLabel : event.title, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
@@ -9425,12 +9462,14 @@ var EventMarketPageContent = ({
|
|
|
9425
9462
|
) });
|
|
9426
9463
|
};
|
|
9427
9464
|
var EventMarketPage = (props) => {
|
|
9465
|
+
var _a;
|
|
9428
9466
|
const hasEventProp = "event" in props && !!props.event;
|
|
9429
9467
|
const {
|
|
9430
9468
|
event: fetchedEvent,
|
|
9431
9469
|
error: eventError,
|
|
9432
9470
|
isLoading: isFetchingEvent
|
|
9433
|
-
} = (0, import_hooks30.
|
|
9471
|
+
} = (0, import_hooks30.useVenueEvent)({
|
|
9472
|
+
eventId: hasEventProp ? "" : (_a = props.eventId) != null ? _a : "",
|
|
9434
9473
|
enabled: !props.isLoading && !hasEventProp && !!props.eventId
|
|
9435
9474
|
});
|
|
9436
9475
|
if (props.isLoading) {
|
package/dist/index.mjs
CHANGED
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
EventMarketPage,
|
|
4
4
|
HomePage,
|
|
5
5
|
UserProfilePage
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HJ4UPYM7.mjs";
|
|
7
7
|
import {
|
|
8
8
|
EventList,
|
|
9
9
|
EventListItem,
|
|
10
10
|
EventListItemDetails,
|
|
11
11
|
MarketDetails
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6CRY27SQ.mjs";
|
|
13
13
|
import {
|
|
14
14
|
ConnectAccountsStep,
|
|
15
15
|
ConnectKalshiModal,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
ProfileModal,
|
|
21
21
|
ProfileSetupStep,
|
|
22
22
|
WithdrawModal
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-N7U7QCSB.mjs";
|
|
24
24
|
import {
|
|
25
25
|
placeOrderMetricSchema,
|
|
26
26
|
placeOrderOutcomeSchema,
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
getTradingSlippageLabel,
|
|
53
53
|
getTradingValueLabel,
|
|
54
54
|
getTradingVenueLabel
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-3U4VHAP6.mjs";
|
|
56
56
|
import {
|
|
57
57
|
AGG_ROOT_CLASS_NAME,
|
|
58
58
|
AppleIcon,
|
|
@@ -135,7 +135,7 @@ import {
|
|
|
135
135
|
toDate,
|
|
136
136
|
typographyVariants,
|
|
137
137
|
venueLogoNames
|
|
138
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-3G7C6WEC.mjs";
|
|
139
139
|
|
|
140
140
|
// src/auth/connect-button-view/index.tsx
|
|
141
141
|
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
|
package/dist/modals.mjs
CHANGED