@agg-build/ui 2.4.2 → 2.4.3

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.
@@ -3,7 +3,7 @@ import {
3
3
  AGG_TERMS_OF_SERVICE_URL,
4
4
  Icon,
5
5
  cn
6
- } from "./chunk-2ET5CXOU.mjs";
6
+ } from "./chunk-WZ55ERDO.mjs";
7
7
 
8
8
  // src/geo-block-banner/index.tsx
9
9
  import { useLabels } from "@agg-build/hooks";
@@ -10,7 +10,7 @@ import {
10
10
  isErrorWithStatus,
11
11
  useEventListTabs,
12
12
  useEventListTabsHeaderOverflow
13
- } from "./chunk-MDO3NMXP.mjs";
13
+ } from "./chunk-PHRYWSNV.mjs";
14
14
  import {
15
15
  DEPOSIT_MODAL_OPEN_EVENT,
16
16
  PlaceOrder,
@@ -18,10 +18,10 @@ import {
18
18
  WITHDRAW_MODAL_OPEN_EVENT,
19
19
  useClaimWinnings,
20
20
  useResolvedMarketClaim
21
- } from "./chunk-3FLLEJFM.mjs";
21
+ } from "./chunk-PHAEFHBM.mjs";
22
22
  import {
23
23
  getDisplayOutcomePrice
24
- } from "./chunk-G5Y45GIA.mjs";
24
+ } from "./chunk-STL4ZHLP.mjs";
25
25
  import {
26
26
  AggErrorBoundary,
27
27
  Button,
@@ -51,8 +51,9 @@ import {
51
51
  normalizeVenueMarketCluster,
52
52
  resolveTabVenus,
53
53
  shortenAddress,
54
+ skeletonViews,
54
55
  sortCategoriesForNavigation
55
- } from "./chunk-2ET5CXOU.mjs";
56
+ } from "./chunk-WZ55ERDO.mjs";
56
57
 
57
58
  // src/pages/home/index.tsx
58
59
  import {
@@ -333,7 +334,14 @@ var EventMarketPageLoadingState = ({
333
334
  /* @__PURE__ */ jsx(MarketDetails, { isLoading: true, isOpened: true, classNames: { root: "w-full" } }),
334
335
  /* @__PURE__ */ jsx(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } }),
335
336
  /* @__PURE__ */ jsx(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } })
336
- ] })
337
+ ] }),
338
+ /* @__PURE__ */ jsx(
339
+ Skeleton,
340
+ {
341
+ view: skeletonViews.settlement,
342
+ className: cn("agg-settlement-list-item", classNames == null ? void 0 : classNames.settlement)
343
+ }
344
+ )
337
345
  ]
338
346
  }
339
347
  ),
@@ -8,11 +8,11 @@ import {
8
8
  getTradingValueLabel,
9
9
  getTradingVenueLabel,
10
10
  resolveOrderEligibilityMessage
11
- } from "./chunk-G5Y45GIA.mjs";
11
+ } from "./chunk-STL4ZHLP.mjs";
12
12
  import {
13
13
  GeoBlockBanner,
14
14
  subscribeAggDepositNotification
15
- } from "./chunk-G5BXCT5Y.mjs";
15
+ } from "./chunk-3PSIO77N.mjs";
16
16
  import {
17
17
  AGG_TERMS_OF_SERVICE_URL,
18
18
  Button,
@@ -44,7 +44,7 @@ import {
44
44
  resolveResolvedOutcomeLabel,
45
45
  skeletonViews,
46
46
  useOptionalToast
47
- } from "./chunk-2ET5CXOU.mjs";
47
+ } from "./chunk-WZ55ERDO.mjs";
48
48
 
49
49
  // src/trading/types.ts
50
50
  import { Venue, enumGuard, isFiniteNonNeg, safeParse } from "@agg-build/sdk";
@@ -59,7 +59,7 @@ var hasContent = (value) => {
59
59
  return typeof value === "string" && value.trim().length > 0;
60
60
  };
61
61
  var SettlementDetails = ({ className }) => {
62
- var _a, _b, _c, _d, _e, _f;
62
+ var _a, _b, _c, _d, _e, _f, _g, _h;
63
63
  const tradingContext = useEventTradingContext();
64
64
  const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
65
65
  const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
@@ -68,16 +68,29 @@ var SettlementDetails = ({ className }) => {
68
68
  const eventDescription = (_c = selectedEvent.description) != null ? _c : null;
69
69
  const marketDescription = (_d = selectedMarket.description) != null ? _d : null;
70
70
  const primaryRules = (_e = selectedMarket.rulesPrimary) != null ? _e : null;
71
- if (!hasContent(eventDescription) && !hasContent(marketDescription) && !hasContent(primaryRules)) {
71
+ const settlementDiff = (_f = selectedEvent.settlementDiff) != null ? _f : null;
72
+ const settlementVenues = Array.from(
73
+ new Set(selectedEvent.venueMarkets.map((market) => market.venue))
74
+ );
75
+ const selectedMarketRuleContent = [
76
+ selectedMarket.description,
77
+ selectedMarket.rulesPrimary,
78
+ selectedMarket.rulesSecondary
79
+ ].filter(hasContent).join("\n\n");
80
+ const settlementVenueRules = selectedMarketRuleContent ? [{ venue: selectedMarket.venue, content: selectedMarketRuleContent }] : [];
81
+ if (!hasContent(eventDescription) && !hasContent(marketDescription) && !hasContent(primaryRules) && ((_g = settlementDiff == null ? void 0 : settlementDiff.differences.length) != null ? _g : 0) === 0) {
72
82
  return null;
73
83
  }
74
84
  return /* @__PURE__ */ jsx("div", { className: "agg-settlement-list flex flex-col gap-6", children: /* @__PURE__ */ jsx("div", { className: "agg-settlement-list-item", children: /* @__PURE__ */ jsx(
75
85
  Settlement,
76
86
  {
77
- question: (_f = selectedMarket.question) != null ? _f : selectedEvent.title,
87
+ question: (_h = selectedMarket.question) != null ? _h : selectedEvent.title,
78
88
  eventDescription,
79
89
  marketDescription,
80
90
  primaryRules,
91
+ settlementDiff,
92
+ settlementVenues,
93
+ settlementVenueRules,
81
94
  className
82
95
  }
83
96
  ) }) });
@@ -6,6 +6,9 @@ import {
6
6
  formatProbabilityPercent,
7
7
  getDisplayOutcomePrice,
8
8
  getFirstSettlementParagraph,
9
+ getSettlementDifferenceId,
10
+ prepareSettlementDifferences,
11
+ resolveDifferenceIconClassName,
9
12
  resolveHeaderOutcomeItems,
10
13
  resolveInitialEventDetailsChartRange,
11
14
  resolveInitialOutcomeLabel,
@@ -23,7 +26,7 @@ import {
23
26
  resolveUnifiedOrderBookEntries,
24
27
  sortOutcomeSelectorOutcomes,
25
28
  useEventTradingContext
26
- } from "./chunk-G5Y45GIA.mjs";
29
+ } from "./chunk-STL4ZHLP.mjs";
27
30
  import {
28
31
  AutocompleteSelect,
29
32
  Badge,
@@ -75,7 +78,7 @@ import {
75
78
  sortCategoriesForNavigation,
76
79
  sortOutcomes,
77
80
  splitEventsByLifecycle
78
- } from "./chunk-2ET5CXOU.mjs";
81
+ } from "./chunk-WZ55ERDO.mjs";
79
82
 
80
83
  // src/events/item/index.tsx
81
84
  import {
@@ -1273,12 +1276,17 @@ import { useMemo as useMemo2 } from "react";
1273
1276
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
1274
1277
  var SettlementSummary = ({
1275
1278
  content,
1279
+ settlementDiff,
1276
1280
  settlementSectionId = SETTLEMENT_SECTION_ID,
1277
1281
  className
1278
1282
  }) => {
1279
1283
  const labels = useLabels2();
1280
1284
  const firstParagraph = useMemo2(() => getFirstSettlementParagraph(content), [content]);
1281
- if (!firstParagraph) return null;
1285
+ const settlementDifferences = useMemo2(
1286
+ () => prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences),
1287
+ [settlementDiff == null ? void 0 : settlementDiff.differences]
1288
+ );
1289
+ if (!firstParagraph && settlementDifferences.length === 0) return null;
1282
1290
  const handleReadFullDetails = (event) => {
1283
1291
  event.preventDefault();
1284
1292
  event.stopPropagation();
@@ -1287,43 +1295,118 @@ var SettlementSummary = ({
1287
1295
  if (!target) return;
1288
1296
  target.scrollIntoView({ behavior: "smooth", block: "start" });
1289
1297
  };
1290
- return /* @__PURE__ */ jsxs2("div", { className: cn("agg-settlement-summary flex w-full flex-col gap-2", className), children: [
1291
- /* @__PURE__ */ jsx2(
1292
- Typography,
1298
+ const handleDifferencePillClick = (event, canonicalKey) => {
1299
+ event.preventDefault();
1300
+ event.stopPropagation();
1301
+ if (typeof document === "undefined") return;
1302
+ const target = document.getElementById(
1303
+ getSettlementDifferenceId(settlementSectionId, canonicalKey)
1304
+ );
1305
+ if (!target) return;
1306
+ const trigger = target.querySelector("button[aria-expanded]");
1307
+ if ((trigger == null ? void 0 : trigger.getAttribute("aria-expanded")) === "false") {
1308
+ trigger.click();
1309
+ }
1310
+ target.scrollIntoView({ behavior: "smooth", block: "start" });
1311
+ };
1312
+ const actionButton = /* @__PURE__ */ jsxs2(
1313
+ "button",
1314
+ {
1315
+ type: "button",
1316
+ className: cn(
1317
+ "agg-settlement-summary-toggle",
1318
+ "inline-flex shrink-0 cursor-pointer items-center gap-1 whitespace-nowrap text-agg-sm font-agg-bold leading-agg-5 text-agg-primary",
1319
+ "hover:opacity-80",
1320
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
1321
+ ),
1322
+ "aria-controls": settlementSectionId,
1323
+ onClick: handleReadFullDetails,
1324
+ children: [
1325
+ /* @__PURE__ */ jsx2("span", { children: labels.settlementSummary.readFullDetails }),
1326
+ /* @__PURE__ */ jsx2(Icon, { name: "chevron-down", className: "size-[14px]", "aria-hidden": "true" })
1327
+ ]
1328
+ }
1329
+ );
1330
+ if (settlementDifferences.length > 0) {
1331
+ const visibleDifferences = settlementDifferences.slice(0, 2);
1332
+ const hiddenDifferenceCount = settlementDifferences.length - visibleDifferences.length;
1333
+ return /* @__PURE__ */ jsxs2(
1334
+ "div",
1293
1335
  {
1294
- variant: "caption-caps",
1295
- className: "agg-settlement-summary-label text-agg-muted-foreground",
1296
- children: labels.settlementSummary.title
1336
+ className: cn(
1337
+ "agg-settlement-summary flex w-full flex-wrap items-start justify-between gap-x-4 gap-y-2",
1338
+ className
1339
+ ),
1340
+ children: [
1341
+ /* @__PURE__ */ jsxs2("div", { className: "flex min-w-[240px] flex-1 flex-wrap items-center gap-x-5 gap-y-3", children: [
1342
+ /* @__PURE__ */ jsxs2("div", { className: "agg-settlement-summary-heading flex shrink-0 items-center gap-2", children: [
1343
+ /* @__PURE__ */ jsx2("p", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground", children: labels.settlementSummary.title }),
1344
+ /* @__PURE__ */ jsx2("span", { className: "flex size-4 shrink-0 items-center justify-center rounded-agg-full bg-agg-primary text-[10px] font-agg-bold leading-[14px] text-agg-on-primary", children: settlementDifferences.length })
1345
+ ] }),
1346
+ /* @__PURE__ */ jsxs2("div", { className: "agg-settlement-summary-pills flex min-w-[240px] flex-1 flex-wrap items-center gap-2", children: [
1347
+ visibleDifferences.map((difference) => /* @__PURE__ */ jsxs2(
1348
+ "button",
1349
+ {
1350
+ type: "button",
1351
+ className: cn(
1352
+ "flex h-6 max-w-full shrink-0 cursor-pointer items-center gap-2 rounded-agg-full bg-agg-secondary-hover px-3 py-1 text-agg-xs font-agg-normal leading-agg-4 text-agg-foreground sm:max-w-[220px]",
1353
+ "hover:opacity-80",
1354
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
1355
+ ),
1356
+ onClick: (event) => handleDifferencePillClick(event, difference.canonicalKey),
1357
+ children: [
1358
+ /* @__PURE__ */ jsx2(
1359
+ "i",
1360
+ {
1361
+ className: cn(
1362
+ "fi",
1363
+ resolveDifferenceIconClassName(difference.canonicalKey),
1364
+ "inline-flex size-3 shrink-0 items-center justify-center text-[12px] leading-none text-agg-muted-foreground"
1365
+ ),
1366
+ "aria-hidden": "true"
1367
+ }
1368
+ ),
1369
+ /* @__PURE__ */ jsx2("span", { className: "min-w-0 truncate", children: difference.title })
1370
+ ]
1371
+ },
1372
+ difference.canonicalKey
1373
+ )),
1374
+ hiddenDifferenceCount > 0 ? /* @__PURE__ */ jsxs2("span", { className: "flex h-6 shrink-0 items-center rounded-agg-full bg-agg-secondary-hover px-3 py-1 text-agg-xs font-agg-normal leading-agg-4 text-agg-foreground", children: [
1375
+ "+",
1376
+ hiddenDifferenceCount
1377
+ ] }) : null
1378
+ ] })
1379
+ ] }),
1380
+ actionButton
1381
+ ]
1297
1382
  }
1298
- ),
1299
- /* @__PURE__ */ jsxs2("div", { className: "agg-settlement-summary-row flex w-full items-center gap-3", children: [
1300
- /* @__PURE__ */ jsx2(
1301
- "p",
1302
- {
1303
- className: cn(
1304
- "agg-settlement-summary-text",
1305
- "min-w-0 flex-1 truncate text-agg-sm leading-agg-5 text-agg-foreground"
1306
- ),
1307
- children: firstParagraph
1308
- }
1383
+ );
1384
+ }
1385
+ return /* @__PURE__ */ jsxs2(
1386
+ "div",
1387
+ {
1388
+ className: cn(
1389
+ "agg-settlement-summary flex w-full items-center justify-between gap-4",
1390
+ className
1309
1391
  ),
1310
- /* @__PURE__ */ jsx2(
1311
- "button",
1312
- {
1313
- type: "button",
1314
- className: cn(
1315
- "agg-settlement-summary-toggle",
1316
- "shrink-0 cursor-pointer whitespace-nowrap text-agg-sm font-agg-bold leading-agg-5 text-agg-primary",
1317
- "hover:opacity-80",
1318
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
1319
- ),
1320
- "aria-controls": settlementSectionId,
1321
- onClick: handleReadFullDetails,
1322
- children: labels.settlementSummary.readFullDetails
1323
- }
1324
- )
1325
- ] })
1326
- ] });
1392
+ children: [
1393
+ /* @__PURE__ */ jsxs2("div", { className: "agg-settlement-summary-row flex min-w-0 flex-1 items-center gap-5", children: [
1394
+ /* @__PURE__ */ jsx2("div", { className: "agg-settlement-summary-heading flex shrink-0 items-center gap-2", children: /* @__PURE__ */ jsx2("p", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground", children: labels.settlementSummary.title }) }),
1395
+ /* @__PURE__ */ jsx2(
1396
+ "p",
1397
+ {
1398
+ className: cn(
1399
+ "agg-settlement-summary-text",
1400
+ "min-w-0 flex-1 truncate text-agg-sm leading-agg-5 text-agg-foreground"
1401
+ ),
1402
+ children: firstParagraph
1403
+ }
1404
+ )
1405
+ ] }),
1406
+ actionButton
1407
+ ]
1408
+ }
1409
+ );
1327
1410
  };
1328
1411
  SettlementSummary.displayName = "SettlementSummary";
1329
1412
 
@@ -2771,7 +2854,7 @@ var EventListItemDetailsContent = ({
2771
2854
  }
2772
2855
  )
2773
2856
  ] }),
2774
- event.description ? /* @__PURE__ */ jsx5(SettlementSummary, { content: event.description }) : null
2857
+ event.description || event.settlementDiff ? /* @__PURE__ */ jsx5(SettlementSummary, { content: event.description, settlementDiff: event.settlementDiff }) : null
2775
2858
  ]
2776
2859
  }
2777
2860
  );
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  dispatchAggDepositNotification
4
- } from "./chunk-G5BXCT5Y.mjs";
4
+ } from "./chunk-3PSIO77N.mjs";
5
5
  import {
6
6
  BestPricesIcon,
7
7
  BoltIcon,
@@ -41,7 +41,7 @@ import {
41
41
  shortenAddress,
42
42
  useOptionalToast,
43
43
  venueLogoLabels
44
- } from "./chunk-2ET5CXOU.mjs";
44
+ } from "./chunk-WZ55ERDO.mjs";
45
45
 
46
46
  // src/deposit/index.tsx
47
47
  import { useAggAuthState, useAggUiConfig, useDepositAddresses, useLabels as useLabels11 } from "@agg-build/hooks";