@agg-market/ui 3.0.1 → 5.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/chart.js +18 -5
- package/dist/chart.mjs +2 -2
- package/dist/{chunk-422MCIXV.mjs → chunk-34IRJYSU.mjs} +15 -11
- package/dist/{chunk-KUWTY4EM.mjs → chunk-3W7NBJLU.mjs} +1 -1
- package/dist/chunk-4343LYSH.mjs +45 -0
- package/dist/{chunk-RKCVOKE3.mjs → chunk-CTYJVVHJ.mjs} +26 -3
- package/dist/{chunk-MVJNQN7P.mjs → chunk-DHBHKIJR.mjs} +153 -94
- package/dist/{chunk-KRQFVMJE.mjs → chunk-GFBF2J3Y.mjs} +18 -25
- package/dist/{chunk-ZJJA4I3I.mjs → chunk-KIYMVWL4.mjs} +1 -1
- package/dist/{chunk-CTVMT3VL.mjs → chunk-LCZKSITC.mjs} +2 -2
- package/dist/chunk-M4RJHRFT.mjs +445 -0
- package/dist/{chunk-KSCSYCEF.mjs → chunk-MJHKBCXQ.mjs} +1 -1
- package/dist/{chunk-GHB3GOCW.mjs → chunk-MKVGQ7AS.mjs} +17 -21
- package/dist/{chunk-BN5VVHNV.mjs → chunk-OJVTGNIF.mjs} +17 -4
- package/dist/{chunk-FF3QYU26.mjs → chunk-Q6DGDBPV.mjs} +87 -26
- package/dist/{chunk-DCORNTCY.mjs → chunk-QDMHLRDY.mjs} +31 -62
- package/dist/{chunk-RGHA4PZH.mjs → chunk-T7TATHPD.mjs} +34 -10
- package/dist/chunk-XUCS575S.mjs +65 -0
- package/dist/event-list-item-details.js +1836 -407
- package/dist/event-list-item-details.mjs +10 -6
- package/dist/event-list-item.js +448 -279
- package/dist/event-list-item.mjs +6 -3
- package/dist/event-list.js +787 -627
- package/dist/event-list.mjs +7 -4
- package/dist/event-market-page.d.mts +1 -1
- package/dist/event-market-page.d.ts +1 -1
- package/dist/event-market-page.js +2684 -2572
- package/dist/event-market-page.mjs +12 -11
- package/dist/home-page.js +804 -644
- package/dist/home-page.mjs +8 -5
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1344 -1177
- package/dist/index.mjs +23 -18
- package/dist/market-details.js +919 -757
- package/dist/market-details.mjs +9 -7
- package/dist/place-order.d.mts +1 -1
- package/dist/place-order.d.ts +1 -1
- package/dist/place-order.js +151 -189
- package/dist/place-order.mjs +2 -2
- package/dist/search.js +3 -0
- package/dist/search.mjs +2 -1
- package/dist/settlement.d.mts +1 -1
- package/dist/settlement.d.ts +1 -1
- package/dist/settlement.js +151 -189
- package/dist/settlement.mjs +2 -2
- package/dist/skeleton.js +151 -189
- package/dist/skeleton.mjs +1 -1
- package/dist/state-message.d.mts +16 -0
- package/dist/state-message.d.ts +16 -0
- package/dist/state-message.js +1629 -0
- package/dist/state-message.mjs +14 -0
- package/dist/styles.css +1 -1
- package/dist/switch-button.js +2 -2
- package/dist/switch-button.mjs +1 -1
- package/dist/tailwind.css +1 -1
- package/package.json +14 -2
- package/dist/chunk-V52WSZHQ.mjs +0 -482
- package/dist/{types-DkGlbmXq.d.mts → types-BImwqY4o.d.mts} +4 -4
- package/dist/{types-DkGlbmXq.d.ts → types-BImwqY4o.d.ts} +4 -4
|
@@ -8,15 +8,19 @@ import {
|
|
|
8
8
|
resolveOutcomeLabels,
|
|
9
9
|
resolveOutcomesByVenue,
|
|
10
10
|
resolveSeriesColor
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-34IRJYSU.mjs";
|
|
12
12
|
import {
|
|
13
|
+
isErrorWithStatus,
|
|
13
14
|
normalizeProbability,
|
|
14
15
|
resolveEventListItemEvent,
|
|
15
16
|
resolveTileImage,
|
|
16
17
|
resolveTileTitle,
|
|
17
18
|
resolveVenueLabel,
|
|
18
19
|
selectPrimaryVenueMarket
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-MKVGQ7AS.mjs";
|
|
21
|
+
import {
|
|
22
|
+
StateMessage
|
|
23
|
+
} from "./chunk-XUCS575S.mjs";
|
|
20
24
|
import {
|
|
21
25
|
Badge
|
|
22
26
|
} from "./chunk-K6IJ4WBM.mjs";
|
|
@@ -24,7 +28,7 @@ import {
|
|
|
24
28
|
Skeleton,
|
|
25
29
|
detailsBaseCardClassName,
|
|
26
30
|
eventListItemDetailsTimeRanges
|
|
27
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-M4RJHRFT.mjs";
|
|
28
32
|
import {
|
|
29
33
|
VenueLogo
|
|
30
34
|
} from "./chunk-PORVP72S.mjs";
|
|
@@ -39,10 +43,10 @@ import {
|
|
|
39
43
|
} from "./chunk-FO2QCB4Z.mjs";
|
|
40
44
|
import {
|
|
41
45
|
LineChart
|
|
42
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-OJVTGNIF.mjs";
|
|
43
47
|
import {
|
|
44
48
|
SwitchButton
|
|
45
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-LCZKSITC.mjs";
|
|
46
50
|
import {
|
|
47
51
|
__objRest,
|
|
48
52
|
__spreadProps,
|
|
@@ -86,6 +90,21 @@ var EventListItemDetailsUnavailableState = ({
|
|
|
86
90
|
}
|
|
87
91
|
);
|
|
88
92
|
};
|
|
93
|
+
var EventListItemDetailsNotFoundState = ({
|
|
94
|
+
classNames,
|
|
95
|
+
ariaLabel
|
|
96
|
+
}) => {
|
|
97
|
+
const labels = useLabels();
|
|
98
|
+
return /* @__PURE__ */ jsx(Card, { className: cn(detailsBaseCardClassName, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ jsx(
|
|
99
|
+
StateMessage,
|
|
100
|
+
{
|
|
101
|
+
ariaLabel: ariaLabel != null ? ariaLabel : labels.eventItemDetails.notFoundAria,
|
|
102
|
+
title: labels.eventItemDetails.notFoundTitle,
|
|
103
|
+
description: labels.eventItemDetails.notFoundDescription,
|
|
104
|
+
className: "min-h-[280px] md:min-h-[320px]"
|
|
105
|
+
}
|
|
106
|
+
) });
|
|
107
|
+
};
|
|
89
108
|
var probabilityModeOrder = ["yes", "no"];
|
|
90
109
|
var clampProbability = (value) => {
|
|
91
110
|
if (value < 0)
|
|
@@ -101,13 +120,18 @@ var resolveAverageProbability = (values) => {
|
|
|
101
120
|
return validValues.reduce((sum, value) => sum + value, 0) / validValues.length;
|
|
102
121
|
};
|
|
103
122
|
var resolveOutcomeCandidateIds = (market, outcome) => {
|
|
104
|
-
var _a;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
123
|
+
var _a, _b;
|
|
124
|
+
const marketWithCanonicalId = market;
|
|
125
|
+
return [
|
|
126
|
+
outcome.id,
|
|
127
|
+
(_a = outcome.externalIdentifier) != null ? _a : void 0,
|
|
128
|
+
market.externalIdentifier,
|
|
129
|
+
(_b = marketWithCanonicalId.marketId) != null ? _b : void 0
|
|
130
|
+
].filter((value) => typeof value === "string" && value.trim().length > 0);
|
|
108
131
|
};
|
|
109
132
|
var EventListItemDetailsGraphSection = ({
|
|
110
133
|
venueMarkets,
|
|
134
|
+
canonicalMarketId,
|
|
111
135
|
selectedOutcomeLabel,
|
|
112
136
|
onSelectedOutcomeLabelChange,
|
|
113
137
|
switchLabels,
|
|
@@ -200,12 +224,17 @@ var EventListItemDetailsGraphSection = ({
|
|
|
200
224
|
return [...outcomeByModeAndId.values()];
|
|
201
225
|
}, [selectedOutcomesByMode]);
|
|
202
226
|
const priceHistoryGroups = useMemo(() => {
|
|
203
|
-
return buildPriceHistoryGroups(allOutcomesForHistory);
|
|
204
|
-
}, [allOutcomesForHistory]);
|
|
227
|
+
return buildPriceHistoryGroups(allOutcomesForHistory, canonicalMarketId);
|
|
228
|
+
}, [allOutcomesForHistory, canonicalMarketId]);
|
|
205
229
|
const timeWindow = useMemo(() => {
|
|
206
230
|
return getTimeWindowByRange(selectedTimeRange);
|
|
207
231
|
}, [selectedTimeRange]);
|
|
208
|
-
const {
|
|
232
|
+
const {
|
|
233
|
+
data: priceHistoryData,
|
|
234
|
+
isLoading: isPriceHistoryLoading,
|
|
235
|
+
error: priceHistoryError,
|
|
236
|
+
results: priceHistoryResults
|
|
237
|
+
} = usePriceHistory(__spreadProps(__spreadValues({
|
|
209
238
|
groups: priceHistoryGroups
|
|
210
239
|
}, timeWindow), {
|
|
211
240
|
enabled: priceHistoryGroups.length > 0
|
|
@@ -309,6 +338,32 @@ var EventListItemDetailsGraphSection = ({
|
|
|
309
338
|
return venue;
|
|
310
339
|
});
|
|
311
340
|
};
|
|
341
|
+
const handleRetryPriceHistory = () => {
|
|
342
|
+
void Promise.all(priceHistoryResults.map((result) => result.refetch()));
|
|
343
|
+
};
|
|
344
|
+
if (priceHistoryError) {
|
|
345
|
+
return /* @__PURE__ */ jsx(
|
|
346
|
+
"div",
|
|
347
|
+
{
|
|
348
|
+
className: cn(
|
|
349
|
+
"w-full rounded-agg-xl border border-agg-separator bg-agg-secondary",
|
|
350
|
+
classNames == null ? void 0 : classNames.chart
|
|
351
|
+
),
|
|
352
|
+
children: /* @__PURE__ */ jsx(
|
|
353
|
+
StateMessage,
|
|
354
|
+
{
|
|
355
|
+
ariaLabel: labels.eventItemDetails.chartUnavailableAria,
|
|
356
|
+
tone: "warning",
|
|
357
|
+
title: labels.eventItemDetails.chartUnavailableTitle,
|
|
358
|
+
description: labels.eventItemDetails.chartUnavailableDescription,
|
|
359
|
+
actionLabel: labels.common.retry,
|
|
360
|
+
onAction: handleRetryPriceHistory,
|
|
361
|
+
className: "min-h-[300px] px-5 py-10 md:px-10"
|
|
362
|
+
}
|
|
363
|
+
)
|
|
364
|
+
}
|
|
365
|
+
);
|
|
366
|
+
}
|
|
312
367
|
return /* @__PURE__ */ jsx(
|
|
313
368
|
LineChart,
|
|
314
369
|
{
|
|
@@ -405,11 +460,12 @@ var EventListItemDetailsContent = ({
|
|
|
405
460
|
ariaLabel,
|
|
406
461
|
defaultTimeRange
|
|
407
462
|
}) => {
|
|
463
|
+
var _a, _b;
|
|
408
464
|
const config = useSdkUiConfig();
|
|
409
465
|
const labels = useLabels();
|
|
410
466
|
const venueMarkets = useMemo(() => {
|
|
411
|
-
var
|
|
412
|
-
return (_c = (
|
|
467
|
+
var _a2, _b2, _c;
|
|
468
|
+
return (_c = (_b2 = (_a2 = event.markets) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.venueMarkets) != null ? _c : [];
|
|
413
469
|
}, [event.markets]);
|
|
414
470
|
const primaryVenueMarket = useMemo(() => {
|
|
415
471
|
return selectPrimaryVenueMarket(venueMarkets);
|
|
@@ -447,9 +503,9 @@ var EventListItemDetailsContent = ({
|
|
|
447
503
|
if (outcomeLabels.length === 0)
|
|
448
504
|
return void 0;
|
|
449
505
|
return [...outcomeLabels].sort((left, right) => {
|
|
450
|
-
var
|
|
451
|
-
const leftProbability = (
|
|
452
|
-
const rightProbability = (
|
|
506
|
+
var _a2, _b2;
|
|
507
|
+
const leftProbability = (_a2 = probabilityByLabel.get(left)) != null ? _a2 : -1;
|
|
508
|
+
const rightProbability = (_b2 = probabilityByLabel.get(right)) != null ? _b2 : -1;
|
|
453
509
|
return rightProbability - leftProbability;
|
|
454
510
|
})[0];
|
|
455
511
|
}, [outcomeLabels, probabilityByLabel]);
|
|
@@ -465,18 +521,18 @@ var EventListItemDetailsContent = ({
|
|
|
465
521
|
setSelectedOutcomeLabel(fallbackOutcomeLabel);
|
|
466
522
|
}, [isDateOutcomeMarket, mainOutcomeLabel, outcomeLabels, selectedOutcomeLabel]);
|
|
467
523
|
const switchLabels = useMemo(() => {
|
|
468
|
-
var
|
|
524
|
+
var _a2, _b2;
|
|
469
525
|
if (isDateOutcomeMarket) {
|
|
470
526
|
return [labels.eventItemDetails.yes, labels.eventItemDetails.no];
|
|
471
527
|
}
|
|
472
528
|
const sortedOutcomeLabels = [...outcomeLabels].sort((left, right) => {
|
|
473
|
-
var
|
|
474
|
-
const leftProbability = (
|
|
475
|
-
const rightProbability = (
|
|
529
|
+
var _a3, _b3;
|
|
530
|
+
const leftProbability = (_a3 = probabilityByLabel.get(left)) != null ? _a3 : -1;
|
|
531
|
+
const rightProbability = (_b3 = probabilityByLabel.get(right)) != null ? _b3 : -1;
|
|
476
532
|
return rightProbability - leftProbability;
|
|
477
533
|
});
|
|
478
|
-
const firstLabel = (
|
|
479
|
-
const secondLabel = (
|
|
534
|
+
const firstLabel = (_a2 = sortedOutcomeLabels[0]) != null ? _a2 : labels.eventItemDetails.yes;
|
|
535
|
+
const secondLabel = (_b2 = sortedOutcomeLabels.find((label) => label !== firstLabel)) != null ? _b2 : firstLabel;
|
|
480
536
|
return [firstLabel, secondLabel];
|
|
481
537
|
}, [
|
|
482
538
|
isDateOutcomeMarket,
|
|
@@ -486,8 +542,8 @@ var EventListItemDetailsContent = ({
|
|
|
486
542
|
probabilityByLabel
|
|
487
543
|
]);
|
|
488
544
|
const volumeLabel = useMemo(() => {
|
|
489
|
-
var
|
|
490
|
-
const resolvedVolume = typeof event.volume === "number" ? event.volume : (
|
|
545
|
+
var _a2;
|
|
546
|
+
const resolvedVolume = typeof event.volume === "number" ? event.volume : (_a2 = primaryVenueMarket == null ? void 0 : primaryVenueMarket.volume) != null ? _a2 : void 0;
|
|
491
547
|
if (typeof resolvedVolume !== "number")
|
|
492
548
|
return "";
|
|
493
549
|
return `${config.formatCompactCurrency(resolvedVolume)} ${labels.eventItemDetails.volumeSuffix}`;
|
|
@@ -585,6 +641,7 @@ var EventListItemDetailsContent = ({
|
|
|
585
641
|
EventListItemDetailsGraphSection,
|
|
586
642
|
{
|
|
587
643
|
venueMarkets,
|
|
644
|
+
canonicalMarketId: (_b = (_a = event.markets) == null ? void 0 : _a[0]) == null ? void 0 : _b.id,
|
|
588
645
|
selectedOutcomeLabel,
|
|
589
646
|
onSelectedOutcomeLabelChange: setSelectedOutcomeLabel,
|
|
590
647
|
switchLabels,
|
|
@@ -631,6 +688,7 @@ var EventListItemDetailsByEventId = (_a) => {
|
|
|
631
688
|
]);
|
|
632
689
|
const {
|
|
633
690
|
event: fetchedEvent,
|
|
691
|
+
error,
|
|
634
692
|
isError,
|
|
635
693
|
isLoading
|
|
636
694
|
} = useEvent(eventId, {
|
|
@@ -651,7 +709,10 @@ var EventListItemDetailsByEventId = (_a) => {
|
|
|
651
709
|
if (isLoading) {
|
|
652
710
|
return /* @__PURE__ */ jsx(EventListItemDetailsLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
|
|
653
711
|
}
|
|
654
|
-
if (
|
|
712
|
+
if (isErrorWithStatus(error, 404)) {
|
|
713
|
+
return /* @__PURE__ */ jsx(EventListItemDetailsNotFoundState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
|
|
714
|
+
}
|
|
715
|
+
if (!fetchedEvent && !isError) {
|
|
655
716
|
return /* @__PURE__ */ jsx(EventListItemDetailsLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
|
|
656
717
|
}
|
|
657
718
|
if (!resolvedEvent) {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SearchEmptyIcon
|
|
3
|
+
} from "./chunk-4343LYSH.mjs";
|
|
1
4
|
import {
|
|
2
5
|
VenueLogo
|
|
3
6
|
} from "./chunk-PORVP72S.mjs";
|
|
@@ -5,10 +8,6 @@ import {
|
|
|
5
8
|
Icon
|
|
6
9
|
} from "./chunk-PZTHM6WG.mjs";
|
|
7
10
|
import {
|
|
8
|
-
getIconA11yProps
|
|
9
|
-
} from "./chunk-BNDFQPHF.mjs";
|
|
10
|
-
import {
|
|
11
|
-
__objRest,
|
|
12
11
|
__spreadProps,
|
|
13
12
|
__spreadValues,
|
|
14
13
|
cn,
|
|
@@ -19,39 +18,6 @@ import {
|
|
|
19
18
|
import { useMemo } from "react";
|
|
20
19
|
import { useLabels, useSdkUiConfig } from "@agg-market/hooks";
|
|
21
20
|
|
|
22
|
-
// src/primitives/search/search-empty-icon.tsx
|
|
23
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
24
|
-
var SearchEmptyIcon = (_a) => {
|
|
25
|
-
var _b = _a, { title, className } = _b, props = __objRest(_b, ["title", "className"]);
|
|
26
|
-
return /* @__PURE__ */ jsxs(
|
|
27
|
-
"svg",
|
|
28
|
-
__spreadProps(__spreadValues(__spreadValues({
|
|
29
|
-
viewBox: "0 0 40 40",
|
|
30
|
-
fill: "none",
|
|
31
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
32
|
-
className
|
|
33
|
-
}, getIconA11yProps(title)), props), {
|
|
34
|
-
children: [
|
|
35
|
-
title ? /* @__PURE__ */ jsx("title", { children: title }) : null,
|
|
36
|
-
/* @__PURE__ */ jsx("circle", { cx: "19.9987", cy: "20.0013", r: "9.2", stroke: "currentColor", strokeWidth: "1.6" }),
|
|
37
|
-
/* @__PURE__ */ jsx(
|
|
38
|
-
"ellipse",
|
|
39
|
-
{
|
|
40
|
-
cx: "19.9987",
|
|
41
|
-
cy: "20.0012",
|
|
42
|
-
rx: "17.2",
|
|
43
|
-
ry: "6.6",
|
|
44
|
-
transform: "rotate(-35 19.9987 20.0012)",
|
|
45
|
-
stroke: "currentColor",
|
|
46
|
-
strokeWidth: "1.6"
|
|
47
|
-
}
|
|
48
|
-
)
|
|
49
|
-
]
|
|
50
|
-
})
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
SearchEmptyIcon.displayName = "SearchEmptyIcon";
|
|
54
|
-
|
|
55
21
|
// src/primitives/search/search.types.ts
|
|
56
22
|
import { z } from "zod";
|
|
57
23
|
var searchResultVenues = ["kalshi", "polymarket", "opinion", "probable"];
|
|
@@ -76,7 +42,7 @@ var searchResultItemSchema = z.object({
|
|
|
76
42
|
var searchResultItemsSchema = z.array(searchResultItemSchema);
|
|
77
43
|
|
|
78
44
|
// src/primitives/search/index.tsx
|
|
79
|
-
import { jsx
|
|
45
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
80
46
|
var SearchResultRow = ({
|
|
81
47
|
item,
|
|
82
48
|
resultAria,
|
|
@@ -87,10 +53,12 @@ var SearchResultRow = ({
|
|
|
87
53
|
const handleResultClick = () => {
|
|
88
54
|
onSelect == null ? void 0 : onSelect(item);
|
|
89
55
|
};
|
|
90
|
-
return /* @__PURE__ */
|
|
56
|
+
return /* @__PURE__ */ jsxs(
|
|
91
57
|
"button",
|
|
92
58
|
{
|
|
93
59
|
type: "button",
|
|
60
|
+
role: "option",
|
|
61
|
+
"aria-selected": "false",
|
|
94
62
|
className: cn(
|
|
95
63
|
"group/agg-search-result",
|
|
96
64
|
"group flex w-full items-center gap-6 px-5 py-3 text-left",
|
|
@@ -101,8 +69,8 @@ var SearchResultRow = ({
|
|
|
101
69
|
onClick: handleResultClick,
|
|
102
70
|
"aria-label": resultAria(item.title),
|
|
103
71
|
children: [
|
|
104
|
-
/* @__PURE__ */
|
|
105
|
-
/* @__PURE__ */
|
|
72
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
|
|
73
|
+
/* @__PURE__ */ jsx(
|
|
106
74
|
"img",
|
|
107
75
|
{
|
|
108
76
|
src: item.thumbnailSrc,
|
|
@@ -113,7 +81,7 @@ var SearchResultRow = ({
|
|
|
113
81
|
)
|
|
114
82
|
}
|
|
115
83
|
),
|
|
116
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ jsx(
|
|
117
85
|
"p",
|
|
118
86
|
{
|
|
119
87
|
className: cn(
|
|
@@ -124,10 +92,10 @@ var SearchResultRow = ({
|
|
|
124
92
|
}
|
|
125
93
|
)
|
|
126
94
|
] }),
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
-
/* @__PURE__ */
|
|
130
|
-
/* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ jsxs("div", { className: cn("flex w-[200px] shrink-0 items-center gap-2", classNames == null ? void 0 : classNames.resultMeta), children: [
|
|
96
|
+
/* @__PURE__ */ jsx(VenueLogo, { venue: item.venue, size: "small" }),
|
|
97
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-baseline gap-2", children: [
|
|
98
|
+
/* @__PURE__ */ jsx(
|
|
131
99
|
"p",
|
|
132
100
|
{
|
|
133
101
|
className: cn(
|
|
@@ -137,7 +105,7 @@ var SearchResultRow = ({
|
|
|
137
105
|
children: item.valueLabel
|
|
138
106
|
}
|
|
139
107
|
),
|
|
140
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ jsx(
|
|
141
109
|
"p",
|
|
142
110
|
{
|
|
143
111
|
className: cn(
|
|
@@ -149,7 +117,7 @@ var SearchResultRow = ({
|
|
|
149
117
|
)
|
|
150
118
|
] })
|
|
151
119
|
] }),
|
|
152
|
-
/* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */ jsx(
|
|
153
121
|
Icon,
|
|
154
122
|
{
|
|
155
123
|
name: "chevron-right",
|
|
@@ -190,8 +158,8 @@ var Search = ({
|
|
|
190
158
|
const handleInputChange = (event) => {
|
|
191
159
|
onValueChange(event.target.value);
|
|
192
160
|
};
|
|
193
|
-
return /* @__PURE__ */
|
|
194
|
-
/* @__PURE__ */
|
|
161
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("group/agg-search", "flex w-full flex-col gap-1", classNames == null ? void 0 : classNames.root), children: [
|
|
162
|
+
/* @__PURE__ */ jsx("label", { className: "w-full", children: /* @__PURE__ */ jsxs(
|
|
195
163
|
"div",
|
|
196
164
|
{
|
|
197
165
|
className: cn(
|
|
@@ -205,7 +173,7 @@ var Search = ({
|
|
|
205
173
|
classNames == null ? void 0 : classNames.inputContainer
|
|
206
174
|
),
|
|
207
175
|
children: [
|
|
208
|
-
/* @__PURE__ */
|
|
176
|
+
/* @__PURE__ */ jsx(
|
|
209
177
|
Icon,
|
|
210
178
|
{
|
|
211
179
|
name: "search",
|
|
@@ -213,7 +181,7 @@ var Search = ({
|
|
|
213
181
|
className: cn("text-agg-muted-foreground", classNames == null ? void 0 : classNames.searchIcon)
|
|
214
182
|
}
|
|
215
183
|
),
|
|
216
|
-
/* @__PURE__ */
|
|
184
|
+
/* @__PURE__ */ jsx(
|
|
217
185
|
"input",
|
|
218
186
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
219
187
|
type: "text",
|
|
@@ -234,24 +202,25 @@ var Search = ({
|
|
|
234
202
|
]
|
|
235
203
|
}
|
|
236
204
|
) }),
|
|
237
|
-
shouldRenderResults ? /* @__PURE__ */
|
|
205
|
+
shouldRenderResults ? /* @__PURE__ */ jsx(
|
|
238
206
|
"div",
|
|
239
207
|
{
|
|
240
208
|
className: cn(
|
|
241
209
|
"w-full overflow-hidden rounded-agg-xl border border-agg-separator bg-agg-secondary py-2 shadow-[0px_8px_16px_0px_rgba(0,0,0,0.1)]",
|
|
242
210
|
classNames == null ? void 0 : classNames.dropdown
|
|
243
211
|
),
|
|
244
|
-
children: /* @__PURE__ */
|
|
212
|
+
children: /* @__PURE__ */ jsx(
|
|
245
213
|
"ul",
|
|
246
214
|
{
|
|
247
215
|
className: cn("m-0 flex list-none flex-col p-0", classNames == null ? void 0 : classNames.resultsList),
|
|
248
216
|
role: "listbox",
|
|
249
217
|
"aria-label": labels.search.resultsAria,
|
|
250
|
-
children: validatedResults.map((item, index) => /* @__PURE__ */
|
|
218
|
+
children: validatedResults.map((item, index) => /* @__PURE__ */ jsx(
|
|
251
219
|
"li",
|
|
252
220
|
{
|
|
221
|
+
role: "presentation",
|
|
253
222
|
className: cn(index > 0 && "border-t border-agg-separator", classNames == null ? void 0 : classNames.resultItem),
|
|
254
|
-
children: /* @__PURE__ */
|
|
223
|
+
children: /* @__PURE__ */ jsx(
|
|
255
224
|
SearchResultRow,
|
|
256
225
|
{
|
|
257
226
|
item,
|
|
@@ -267,29 +236,29 @@ var Search = ({
|
|
|
267
236
|
)
|
|
268
237
|
}
|
|
269
238
|
) : null,
|
|
270
|
-
shouldRenderNoResults ? /* @__PURE__ */
|
|
239
|
+
shouldRenderNoResults ? /* @__PURE__ */ jsx(
|
|
271
240
|
"div",
|
|
272
241
|
{
|
|
273
242
|
className: cn(
|
|
274
243
|
"w-full overflow-hidden rounded-agg-xl border border-agg-separator bg-agg-secondary py-10 shadow-[0px_8px_16px_0px_rgba(0,0,0,0.1)]",
|
|
275
244
|
classNames == null ? void 0 : classNames.emptyState
|
|
276
245
|
),
|
|
277
|
-
children: /* @__PURE__ */
|
|
246
|
+
children: /* @__PURE__ */ jsxs(
|
|
278
247
|
"div",
|
|
279
248
|
{
|
|
280
249
|
className: cn("flex flex-col items-center gap-5", classNames == null ? void 0 : classNames.emptyStateContent),
|
|
281
250
|
role: "status",
|
|
282
251
|
"aria-live": "polite",
|
|
283
252
|
children: [
|
|
284
|
-
/* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ jsx(
|
|
285
254
|
SearchEmptyIcon,
|
|
286
255
|
{
|
|
287
256
|
className: cn("h-10 w-10 text-agg-muted-foreground", classNames == null ? void 0 : classNames.emptyStateIcon),
|
|
288
257
|
"aria-hidden": true
|
|
289
258
|
}
|
|
290
259
|
),
|
|
291
|
-
/* @__PURE__ */
|
|
292
|
-
/* @__PURE__ */
|
|
260
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1 text-center", children: [
|
|
261
|
+
/* @__PURE__ */ jsx(
|
|
293
262
|
"p",
|
|
294
263
|
{
|
|
295
264
|
className: cn(
|
|
@@ -299,7 +268,7 @@ var Search = ({
|
|
|
299
268
|
children: labels.search.noResultsTitle
|
|
300
269
|
}
|
|
301
270
|
),
|
|
302
|
-
/* @__PURE__ */
|
|
271
|
+
/* @__PURE__ */ jsx(
|
|
303
272
|
"p",
|
|
304
273
|
{
|
|
305
274
|
className: cn(
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Settlement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3W7NBJLU.mjs";
|
|
4
4
|
import {
|
|
5
5
|
PlaceOrder
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-MJHKBCXQ.mjs";
|
|
7
7
|
import {
|
|
8
8
|
EventListItemDetails
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-Q6DGDBPV.mjs";
|
|
10
10
|
import {
|
|
11
11
|
MarketDetails
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-DHBHKIJR.mjs";
|
|
13
|
+
import {
|
|
14
|
+
isErrorWithStatus
|
|
15
|
+
} from "./chunk-MKVGQ7AS.mjs";
|
|
16
|
+
import {
|
|
17
|
+
StateMessage
|
|
18
|
+
} from "./chunk-XUCS575S.mjs";
|
|
13
19
|
import {
|
|
14
20
|
Typography
|
|
15
21
|
} from "./chunk-ERGNR6UQ.mjs";
|
|
@@ -99,6 +105,20 @@ var EventMarketPageUnavailableState = ({
|
|
|
99
105
|
}
|
|
100
106
|
);
|
|
101
107
|
};
|
|
108
|
+
var EventMarketPageNotFoundState = ({
|
|
109
|
+
ariaLabel
|
|
110
|
+
}) => {
|
|
111
|
+
const labels = useLabels();
|
|
112
|
+
return /* @__PURE__ */ jsx(Card, { className: "overflow-hidden rounded-agg-xl border border-agg-separator bg-agg-secondary p-0 shadow-none hover:shadow-none", children: /* @__PURE__ */ jsx(
|
|
113
|
+
StateMessage,
|
|
114
|
+
{
|
|
115
|
+
ariaLabel: ariaLabel != null ? ariaLabel : labels.eventItemDetails.notFoundAria,
|
|
116
|
+
title: labels.eventItemDetails.notFoundTitle,
|
|
117
|
+
description: labels.eventItemDetails.notFoundDescription,
|
|
118
|
+
className: "min-h-[320px] md:min-h-[360px]"
|
|
119
|
+
}
|
|
120
|
+
) });
|
|
121
|
+
};
|
|
102
122
|
var EventMarketPageLoadingState = ({
|
|
103
123
|
placeOrder,
|
|
104
124
|
settlement,
|
|
@@ -255,12 +275,13 @@ var EventMarketPageContent = ({
|
|
|
255
275
|
};
|
|
256
276
|
var EventMarketPage = (props) => {
|
|
257
277
|
const hasEventProp = "event" in props && !!props.event;
|
|
258
|
-
const {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
278
|
+
const {
|
|
279
|
+
event: fetchedEvent,
|
|
280
|
+
error: eventError,
|
|
281
|
+
isLoading: isFetchingEvent
|
|
282
|
+
} = useEvent(hasEventProp ? void 0 : props.eventId, {
|
|
283
|
+
enabled: !props.isLoading && !hasEventProp && !!props.eventId
|
|
284
|
+
});
|
|
264
285
|
if (props.isLoading) {
|
|
265
286
|
return /* @__PURE__ */ jsx(EventMarketPageLoadingState, { placeOrder: props.placeOrder, settlement: props.settlement });
|
|
266
287
|
}
|
|
@@ -278,6 +299,9 @@ var EventMarketPage = (props) => {
|
|
|
278
299
|
);
|
|
279
300
|
}
|
|
280
301
|
if (!fetchedEvent) {
|
|
302
|
+
if (isErrorWithStatus(eventError, 404)) {
|
|
303
|
+
return /* @__PURE__ */ jsx(EventMarketPageNotFoundState, { ariaLabel: props.ariaLabel });
|
|
304
|
+
}
|
|
281
305
|
return /* @__PURE__ */ jsx(EventMarketPageUnavailableState, { ariaLabel: props.ariaLabel });
|
|
282
306
|
}
|
|
283
307
|
return /* @__PURE__ */ jsx(EventMarketPageContent, __spreadProps(__spreadValues({}, props), { event: fetchedEvent }));
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SearchEmptyIcon
|
|
3
|
+
} from "./chunk-4343LYSH.mjs";
|
|
4
|
+
import {
|
|
5
|
+
WarningIcon
|
|
6
|
+
} from "./chunk-PZTHM6WG.mjs";
|
|
7
|
+
import {
|
|
8
|
+
Button
|
|
9
|
+
} from "./chunk-KAGYJ4XT.mjs";
|
|
10
|
+
import {
|
|
11
|
+
Typography
|
|
12
|
+
} from "./chunk-ERGNR6UQ.mjs";
|
|
13
|
+
import {
|
|
14
|
+
cn
|
|
15
|
+
} from "./chunk-GJ4U5NCE.mjs";
|
|
16
|
+
|
|
17
|
+
// src/primitives/state-message/index.tsx
|
|
18
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
+
var iconClassName = "h-9 w-9 text-agg-muted-foreground";
|
|
20
|
+
var StateMessage = ({
|
|
21
|
+
ariaLabel,
|
|
22
|
+
tone = "empty",
|
|
23
|
+
title,
|
|
24
|
+
description,
|
|
25
|
+
actionLabel,
|
|
26
|
+
onAction,
|
|
27
|
+
className
|
|
28
|
+
}) => {
|
|
29
|
+
const icon = tone === "warning" ? /* @__PURE__ */ jsx(WarningIcon, { className: iconClassName, "aria-hidden": true }) : /* @__PURE__ */ jsx(SearchEmptyIcon, { className: iconClassName, "aria-hidden": true });
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
className: cn(
|
|
34
|
+
"flex min-h-[240px] w-full flex-col items-center justify-center px-5 py-10 text-center md:px-10",
|
|
35
|
+
className
|
|
36
|
+
),
|
|
37
|
+
role: "status",
|
|
38
|
+
"aria-live": "polite",
|
|
39
|
+
"aria-label": ariaLabel,
|
|
40
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex max-w-[360px] flex-col items-center gap-6", children: [
|
|
41
|
+
icon,
|
|
42
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
|
|
43
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body-large-strong", children: title }),
|
|
44
|
+
description ? /* @__PURE__ */ jsx(Typography, { variant: "body", className: "whitespace-pre-line text-agg-muted-foreground", children: description }) : null
|
|
45
|
+
] }),
|
|
46
|
+
actionLabel && onAction ? /* @__PURE__ */ jsx(
|
|
47
|
+
Button,
|
|
48
|
+
{
|
|
49
|
+
variant: "tertiary",
|
|
50
|
+
size: "large",
|
|
51
|
+
className: "text-agg-base leading-agg-6",
|
|
52
|
+
"aria-label": actionLabel,
|
|
53
|
+
onClick: onAction,
|
|
54
|
+
children: actionLabel
|
|
55
|
+
}
|
|
56
|
+
) : null
|
|
57
|
+
] })
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
StateMessage.displayName = "StateMessage";
|
|
62
|
+
|
|
63
|
+
export {
|
|
64
|
+
StateMessage
|
|
65
|
+
};
|