@agg-build/ui 2.4.1 → 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.
- package/dist/{chunk-G5BXCT5Y.mjs → chunk-3PSIO77N.mjs} +1 -1
- package/dist/{chunk-FIN55CXA.mjs → chunk-GLVLCXIM.mjs} +30 -10
- package/dist/{chunk-3FLLEJFM.mjs → chunk-PHAEFHBM.mjs} +19 -6
- package/dist/{chunk-MDO3NMXP.mjs → chunk-PHRYWSNV.mjs} +121 -38
- package/dist/{chunk-GUYFQP7L.mjs → chunk-QDNG5UKJ.mjs} +2 -2
- package/dist/{chunk-G5Y45GIA.mjs → chunk-STL4ZHLP.mjs} +290 -6
- package/dist/{chunk-2ET5CXOU.mjs → chunk-WZ55ERDO.mjs} +3 -10
- package/dist/events.js +398 -48
- package/dist/events.mjs +3 -3
- package/dist/index.js +445 -57
- package/dist/index.mjs +13 -7
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +439 -57
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +3 -10
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +3418 -3131
- package/dist/trading.mjs +10 -4
- package/dist/types/events/item-details/settlement-summary.d.mts +3 -1
- package/dist/types/events/item-details/settlement-summary.d.ts +3 -1
- package/dist/types/pages/event-market/sports-event-market.utils.d.mts +11 -0
- package/dist/types/pages/event-market/sports-event-market.utils.d.ts +11 -0
- package/dist/types/trading/settlement/index.d.mts +19 -1
- package/dist/types/trading/settlement/index.d.ts +19 -1
- package/package.json +1 -1
package/dist/events.js
CHANGED
|
@@ -4782,17 +4782,10 @@ var SettlementSkeletonView = ({
|
|
|
4782
4782
|
children: [
|
|
4783
4783
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex w-full items-center justify-between gap-4", children: [
|
|
4784
4784
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(SkeletonBlock, { className: "h-4 w-[81px] rounded-agg-sm" }),
|
|
4785
|
-
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(SkeletonBlock, { className: "h-5 w-
|
|
4785
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(SkeletonBlock, { className: "h-5 w-[240px] max-w-[60%] rounded-agg-sm" })
|
|
4786
4786
|
] }),
|
|
4787
|
-
/* @__PURE__ */ (0, import_jsx_runtime99.
|
|
4788
|
-
|
|
4789
|
-
/* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
4790
|
-
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(SkeletonBlock, { className: "h-4 w-full max-w-[320px] rounded-agg-sm" }),
|
|
4791
|
-
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(SkeletonBlock, { className: "h-4 w-full max-w-[280px] rounded-agg-sm" })
|
|
4792
|
-
] })
|
|
4793
|
-
] }),
|
|
4794
|
-
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
|
|
4795
|
-
/* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex w-full flex-col gap-3", children: [
|
|
4787
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(SkeletonBlock, { className: "h-5 w-[200px] rounded-agg-sm" }),
|
|
4788
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex w-full flex-col gap-4", children: [
|
|
4796
4789
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4797
4790
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(SkeletonBlock, { className: "size-4 rounded-agg-sm" }),
|
|
4798
4791
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(SkeletonBlock, { className: "h-5 w-[100px] rounded-agg-sm" })
|
|
@@ -10221,6 +10214,137 @@ SettlementTextRenderer.displayName = "SettlementTextRenderer";
|
|
|
10221
10214
|
// src/trading/settlement/index.tsx
|
|
10222
10215
|
var import_jsx_runtime123 = require("react/jsx-runtime");
|
|
10223
10216
|
var SETTLEMENT_SECTION_ID = "agg-settlement-section";
|
|
10217
|
+
var getSettlementDifferenceId = (sectionId, canonicalKey) => {
|
|
10218
|
+
return `${sectionId}-difference-${canonicalKey}`;
|
|
10219
|
+
};
|
|
10220
|
+
var dateOnlyRegex = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
10221
|
+
var isoTimestampWithTimezoneRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:?\d{2})$/i;
|
|
10222
|
+
var normalizeDifferenceText = (value) => {
|
|
10223
|
+
return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
10224
|
+
};
|
|
10225
|
+
var resolveCanonicalDifferenceKey = (difference) => {
|
|
10226
|
+
const normalizedType = normalizeDifferenceText(difference.type);
|
|
10227
|
+
const combined = normalizeDifferenceText(`${difference.type} ${difference.title}`);
|
|
10228
|
+
if (combined.includes("start_date") || combined.includes("open_date")) return "start_date";
|
|
10229
|
+
if (combined.includes("end_date") || combined.includes("close_date") || combined.includes("closing_date") || combined.includes("expiration_date") || combined.includes("expiry_date")) {
|
|
10230
|
+
return "end_date";
|
|
10231
|
+
}
|
|
10232
|
+
if (combined.includes("resolution_timing") || combined.includes("resolution_date") || combined.includes("resolution_deadline") || combined.includes("settlement_date") || combined.includes("settlement_deadline") || combined.includes("settlement_timing")) {
|
|
10233
|
+
return "resolution_timing";
|
|
10234
|
+
}
|
|
10235
|
+
return normalizedType || "other";
|
|
10236
|
+
};
|
|
10237
|
+
var parseSettlementDateMs = (value) => {
|
|
10238
|
+
const trimmed = value.trim();
|
|
10239
|
+
const dateOnlyMatch = dateOnlyRegex.exec(trimmed);
|
|
10240
|
+
if (dateOnlyMatch) {
|
|
10241
|
+
const [, year, month, day] = dateOnlyMatch;
|
|
10242
|
+
return Date.UTC(Number(year), Number(month) - 1, Number(day));
|
|
10243
|
+
}
|
|
10244
|
+
if (!isoTimestampWithTimezoneRegex.test(trimmed)) return null;
|
|
10245
|
+
const ms = Date.parse(trimmed);
|
|
10246
|
+
return Number.isNaN(ms) ? null : ms;
|
|
10247
|
+
};
|
|
10248
|
+
var isDateLikeDifference = (canonicalKey) => {
|
|
10249
|
+
return canonicalKey === "resolution_timing" || canonicalKey === "start_date" || canonicalKey === "end_date";
|
|
10250
|
+
};
|
|
10251
|
+
var hasEqualNormalizedDateValues = (difference, canonicalKey) => {
|
|
10252
|
+
if (!isDateLikeDifference(canonicalKey)) return false;
|
|
10253
|
+
const values = Object.values(difference.perVenue);
|
|
10254
|
+
if (values.length < 2) return false;
|
|
10255
|
+
const timestamps = values.map(parseSettlementDateMs);
|
|
10256
|
+
if (timestamps.some((timestamp) => timestamp === null)) return false;
|
|
10257
|
+
return new Set(timestamps).size === 1;
|
|
10258
|
+
};
|
|
10259
|
+
var resolveDifferenceSeverity = (difference, canonicalKey) => {
|
|
10260
|
+
var _a;
|
|
10261
|
+
const combined = normalizeDifferenceText(
|
|
10262
|
+
`${difference.type} ${difference.title} ${(_a = difference.summary) != null ? _a : ""}`
|
|
10263
|
+
);
|
|
10264
|
+
if (isDateLikeDifference(canonicalKey)) return "critical";
|
|
10265
|
+
if (canonicalKey === "scope" || canonicalKey === "threshold" || canonicalKey === "edge_cases") {
|
|
10266
|
+
return "critical";
|
|
10267
|
+
}
|
|
10268
|
+
if (combined.includes("conflict") || combined.includes("void") || combined.includes("cancel") || combined.includes("postpone") || combined.includes("recount") || combined.includes("overtime") || combined.includes("extra_time")) {
|
|
10269
|
+
return "critical";
|
|
10270
|
+
}
|
|
10271
|
+
return "informational";
|
|
10272
|
+
};
|
|
10273
|
+
var mergePerVenueValues = (current, next) => {
|
|
10274
|
+
return Object.entries(next).reduce(
|
|
10275
|
+
(merged, [venue, value]) => {
|
|
10276
|
+
if (merged[venue] === void 0) merged[venue] = value;
|
|
10277
|
+
return merged;
|
|
10278
|
+
},
|
|
10279
|
+
__spreadValues({}, current)
|
|
10280
|
+
);
|
|
10281
|
+
};
|
|
10282
|
+
var prepareSettlementDifferences = (differences) => {
|
|
10283
|
+
const byCanonicalKey = /* @__PURE__ */ new Map();
|
|
10284
|
+
for (const [originalIndex, difference] of (differences != null ? differences : []).entries()) {
|
|
10285
|
+
const canonicalKey = resolveCanonicalDifferenceKey(difference);
|
|
10286
|
+
if (hasEqualNormalizedDateValues(difference, canonicalKey)) continue;
|
|
10287
|
+
const existing = byCanonicalKey.get(canonicalKey);
|
|
10288
|
+
if (existing) {
|
|
10289
|
+
byCanonicalKey.set(canonicalKey, __spreadProps(__spreadValues({}, existing), {
|
|
10290
|
+
perVenue: mergePerVenueValues(existing.perVenue, difference.perVenue)
|
|
10291
|
+
}));
|
|
10292
|
+
continue;
|
|
10293
|
+
}
|
|
10294
|
+
byCanonicalKey.set(canonicalKey, __spreadProps(__spreadValues({}, difference), {
|
|
10295
|
+
canonicalKey,
|
|
10296
|
+
severity: resolveDifferenceSeverity(difference, canonicalKey),
|
|
10297
|
+
originalIndex
|
|
10298
|
+
}));
|
|
10299
|
+
}
|
|
10300
|
+
return Array.from(byCanonicalKey.values()).sort((left, right) => {
|
|
10301
|
+
const severityDelta = Number(right.severity === "critical") - Number(left.severity === "critical");
|
|
10302
|
+
if (severityDelta !== 0) return severityDelta;
|
|
10303
|
+
return left.originalIndex - right.originalIndex;
|
|
10304
|
+
});
|
|
10305
|
+
};
|
|
10306
|
+
var formatVenueFallbackLabel = (venue) => {
|
|
10307
|
+
return venue.split(/[-_\s]+/).filter(Boolean).map((part) => `${part.slice(0, 1).toUpperCase()}${part.slice(1)}`).join(" ");
|
|
10308
|
+
};
|
|
10309
|
+
var resolveSettlementVenueLabel = (venue, labels) => {
|
|
10310
|
+
var _a;
|
|
10311
|
+
return (_a = labels.venues[venue]) != null ? _a : formatVenueFallbackLabel(venue);
|
|
10312
|
+
};
|
|
10313
|
+
var resolveDifferenceVenueKeys = (difference, settlementVenues) => {
|
|
10314
|
+
const explicitVenues = Object.keys(difference.perVenue);
|
|
10315
|
+
if (!isDateLikeDifference(difference.canonicalKey)) return explicitVenues;
|
|
10316
|
+
const allVenues = [...settlementVenues != null ? settlementVenues : [], ...explicitVenues];
|
|
10317
|
+
return Array.from(new Set(allVenues.filter((venue) => venue.trim().length > 0)));
|
|
10318
|
+
};
|
|
10319
|
+
var resolveDifferenceIconClassName = (canonicalKey) => {
|
|
10320
|
+
if (canonicalKey.includes("source") || canonicalKey.includes("url")) return "fi-rr-world";
|
|
10321
|
+
if (canonicalKey === "resolution_timing" || canonicalKey.includes("timing")) {
|
|
10322
|
+
return "fi-rr-clock";
|
|
10323
|
+
}
|
|
10324
|
+
if (canonicalKey === "start_date" || canonicalKey.includes("start"))
|
|
10325
|
+
return "fi-rr-calendar-clock";
|
|
10326
|
+
if (canonicalKey === "end_date" || canonicalKey.includes("end")) return "fi-rr-calendar-clock";
|
|
10327
|
+
if (canonicalKey.includes("cancel") || canonicalKey.includes("void") || canonicalKey.includes("postpone")) {
|
|
10328
|
+
return "fi-rr-ban";
|
|
10329
|
+
}
|
|
10330
|
+
if (canonicalKey === "edge_cases" || canonicalKey.includes("edge")) {
|
|
10331
|
+
return "fi-rr-triangle-warning";
|
|
10332
|
+
}
|
|
10333
|
+
if (canonicalKey === "scope") return "fi-rr-layers";
|
|
10334
|
+
if (canonicalKey === "threshold") return "fi-rr-tachometer-alt-fastest";
|
|
10335
|
+
if (canonicalKey.includes("wording")) return "fi-rr-document";
|
|
10336
|
+
return "fi-rr-info";
|
|
10337
|
+
};
|
|
10338
|
+
var buildSettlementVenueRules = ({
|
|
10339
|
+
eventBlock,
|
|
10340
|
+
marketBlock,
|
|
10341
|
+
primaryRulesBlock,
|
|
10342
|
+
settlementVenueRules
|
|
10343
|
+
}) => {
|
|
10344
|
+
if (settlementVenueRules) return settlementVenueRules;
|
|
10345
|
+
const content = [marketBlock == null ? void 0 : marketBlock.content, primaryRulesBlock == null ? void 0 : primaryRulesBlock.content, eventBlock == null ? void 0 : eventBlock.content].filter((value) => typeof value === "string" && value.trim().length > 0).join("\n\n");
|
|
10346
|
+
return content ? [{ venue: "polymarket", content }] : [];
|
|
10347
|
+
};
|
|
10224
10348
|
var getSettlementHeaderClassName = () => {
|
|
10225
10349
|
return "flex items-center justify-between gap-4";
|
|
10226
10350
|
};
|
|
@@ -10232,9 +10356,12 @@ var Settlement = ({
|
|
|
10232
10356
|
eventDescription,
|
|
10233
10357
|
marketDescription,
|
|
10234
10358
|
primaryRules,
|
|
10359
|
+
settlementDiff,
|
|
10360
|
+
settlementVenues,
|
|
10361
|
+
settlementVenueRules,
|
|
10235
10362
|
isLoading = false
|
|
10236
10363
|
}) => {
|
|
10237
|
-
var _a, _b, _c;
|
|
10364
|
+
var _a, _b, _c, _d, _e;
|
|
10238
10365
|
const labels = (0, import_hooks38.useLabels)();
|
|
10239
10366
|
const blocks = (0, import_react14.useMemo)(
|
|
10240
10367
|
() => dedupeSettlementSources({
|
|
@@ -10244,9 +10371,34 @@ var Settlement = ({
|
|
|
10244
10371
|
}),
|
|
10245
10372
|
[eventDescription, marketDescription, primaryRules]
|
|
10246
10373
|
);
|
|
10374
|
+
const settlementDifferences = (0, import_react14.useMemo)(
|
|
10375
|
+
() => prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences),
|
|
10376
|
+
[settlementDiff == null ? void 0 : settlementDiff.differences]
|
|
10377
|
+
);
|
|
10247
10378
|
const eventBlock = (_a = blocks.find((block) => block.key === "eventDescription")) != null ? _a : null;
|
|
10248
10379
|
const marketBlock = (_b = blocks.find((block) => block.key === "marketDescription")) != null ? _b : null;
|
|
10249
10380
|
const primaryRulesBlock = (_c = blocks.find((block) => block.key === "primaryRules")) != null ? _c : null;
|
|
10381
|
+
const venueRuleBlocks = (0, import_react14.useMemo)(
|
|
10382
|
+
() => buildSettlementVenueRules({
|
|
10383
|
+
eventBlock,
|
|
10384
|
+
marketBlock,
|
|
10385
|
+
primaryRulesBlock,
|
|
10386
|
+
settlementVenueRules
|
|
10387
|
+
}),
|
|
10388
|
+
[eventBlock, marketBlock, primaryRulesBlock, settlementVenueRules]
|
|
10389
|
+
);
|
|
10390
|
+
const defaultOpenDifferenceKey = (_e = (_d = settlementDifferences[0]) == null ? void 0 : _d.canonicalKey) != null ? _e : null;
|
|
10391
|
+
const [openDifferenceKeys, setOpenDifferenceKeys] = (0, import_react14.useState)(
|
|
10392
|
+
() => defaultOpenDifferenceKey ? [defaultOpenDifferenceKey] : []
|
|
10393
|
+
);
|
|
10394
|
+
(0, import_react14.useEffect)(() => {
|
|
10395
|
+
setOpenDifferenceKeys(defaultOpenDifferenceKey ? [defaultOpenDifferenceKey] : []);
|
|
10396
|
+
}, [defaultOpenDifferenceKey]);
|
|
10397
|
+
const handleToggleDifference = (canonicalKey) => {
|
|
10398
|
+
setOpenDifferenceKeys(
|
|
10399
|
+
(currentKeys) => currentKeys.includes(canonicalKey) ? currentKeys.filter((currentKey) => currentKey !== canonicalKey) : [...currentKeys, canonicalKey]
|
|
10400
|
+
);
|
|
10401
|
+
};
|
|
10250
10402
|
if (isLoading) {
|
|
10251
10403
|
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
10252
10404
|
Skeleton,
|
|
@@ -10258,6 +10410,124 @@ var Settlement = ({
|
|
|
10258
10410
|
);
|
|
10259
10411
|
}
|
|
10260
10412
|
const resolvedSectionLabel = sectionLabel === defaultSettlementSectionLabel ? labels.trading.settlementSection : sectionLabel;
|
|
10413
|
+
if (settlementDifferences.length > 0) {
|
|
10414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
10415
|
+
Card,
|
|
10416
|
+
{
|
|
10417
|
+
id,
|
|
10418
|
+
className: cn(
|
|
10419
|
+
"group/agg-settlement-card",
|
|
10420
|
+
"flex w-full flex-col items-start gap-4 rounded-agg-xl border border-agg-separator bg-agg-secondary p-5 shadow-none hover:shadow-none sm:gap-5",
|
|
10421
|
+
className
|
|
10422
|
+
),
|
|
10423
|
+
children: [
|
|
10424
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-settlement-header flex w-full flex-col items-start gap-1 text-agg-muted-foreground sm:flex-row sm:items-center sm:justify-between sm:gap-4", children: [
|
|
10425
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "shrink-0 text-agg-xs font-agg-bold leading-agg-4 uppercase", children: resolvedSectionLabel }),
|
|
10426
|
+
question ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "agg-settlement-question min-w-0 text-agg-sm font-agg-normal leading-agg-5 sm:max-w-[314px] sm:truncate", children: question }) : null
|
|
10427
|
+
] }),
|
|
10428
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-settlement-differences flex w-full flex-col items-start gap-5", children: [
|
|
10429
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
10430
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: "Key differences" }),
|
|
10431
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("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 })
|
|
10432
|
+
] }),
|
|
10433
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "flex w-full flex-col items-start gap-5", children: settlementDifferences.map((difference) => {
|
|
10434
|
+
const venueKeys = resolveDifferenceVenueKeys(difference, settlementVenues);
|
|
10435
|
+
const isExpanded = openDifferenceKeys.includes(difference.canonicalKey) && venueKeys.length > 0;
|
|
10436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
10437
|
+
"div",
|
|
10438
|
+
{
|
|
10439
|
+
id: getSettlementDifferenceId(id, difference.canonicalKey),
|
|
10440
|
+
className: "agg-settlement-difference flex w-full flex-col items-start gap-2 rounded-agg-lg",
|
|
10441
|
+
children: [
|
|
10442
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
10443
|
+
"button",
|
|
10444
|
+
{
|
|
10445
|
+
type: "button",
|
|
10446
|
+
className: "flex w-full cursor-pointer items-start gap-2 text-left",
|
|
10447
|
+
"aria-expanded": isExpanded,
|
|
10448
|
+
onClick: () => handleToggleDifference(difference.canonicalKey),
|
|
10449
|
+
children: [
|
|
10450
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
10451
|
+
"i",
|
|
10452
|
+
{
|
|
10453
|
+
className: cn(
|
|
10454
|
+
"fi",
|
|
10455
|
+
resolveDifferenceIconClassName(difference.canonicalKey),
|
|
10456
|
+
"inline-flex size-4! shrink-0 items-center justify-center text-[16px] leading-none text-agg-muted-foreground"
|
|
10457
|
+
),
|
|
10458
|
+
"aria-hidden": "true"
|
|
10459
|
+
}
|
|
10460
|
+
),
|
|
10461
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "min-w-0 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground break-words [overflow-wrap:anywhere]", children: difference.title }),
|
|
10462
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
10463
|
+
Icon,
|
|
10464
|
+
{
|
|
10465
|
+
name: isExpanded ? "chevron-up" : "chevron-down",
|
|
10466
|
+
className: "size-4! mt-0.5 shrink-0 text-agg-foreground",
|
|
10467
|
+
"aria-hidden": "true"
|
|
10468
|
+
}
|
|
10469
|
+
)
|
|
10470
|
+
]
|
|
10471
|
+
}
|
|
10472
|
+
),
|
|
10473
|
+
isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("dl", { className: "flex w-full flex-col items-start gap-1 px-6", children: venueKeys.map((venue) => {
|
|
10474
|
+
var _a2;
|
|
10475
|
+
const venueValue = (_a2 = difference.perVenue[venue]) != null ? _a2 : labels.trading.settlementValueUnavailable;
|
|
10476
|
+
const venueLabel = resolveSettlementVenueLabel(venue, labels);
|
|
10477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex w-full items-start gap-2", children: [
|
|
10478
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
10479
|
+
VenueLogo,
|
|
10480
|
+
{
|
|
10481
|
+
venue,
|
|
10482
|
+
size: "small",
|
|
10483
|
+
className: "mt-0.5 size-4",
|
|
10484
|
+
ariaLabel: venueLabel
|
|
10485
|
+
}
|
|
10486
|
+
),
|
|
10487
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("dt", { className: "w-[88px] shrink-0 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground", children: venueLabel }),
|
|
10488
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("dd", { className: "min-w-0 flex-1 text-agg-sm font-agg-normal leading-agg-5 text-agg-muted-foreground break-words [overflow-wrap:anywhere]", children: venueValue })
|
|
10489
|
+
] }, venue);
|
|
10490
|
+
}) }) : null
|
|
10491
|
+
]
|
|
10492
|
+
},
|
|
10493
|
+
difference.canonicalKey
|
|
10494
|
+
);
|
|
10495
|
+
}) }),
|
|
10496
|
+
venueRuleBlocks.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(import_jsx_runtime123.Fragment, { children: [
|
|
10497
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
|
|
10498
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: "Full rules by venue" }),
|
|
10499
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "flex w-full flex-col items-start gap-4", children: venueRuleBlocks.map((rule) => {
|
|
10500
|
+
const venueLabel = resolveSettlementVenueLabel(rule.venue, labels);
|
|
10501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("details", { className: "group/agg-settlement-rule w-full", children: [
|
|
10502
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("summary", { className: "flex cursor-pointer list-none items-center gap-2 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground marker:hidden", children: [
|
|
10503
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
10504
|
+
VenueLogo,
|
|
10505
|
+
{
|
|
10506
|
+
venue: rule.venue,
|
|
10507
|
+
size: "small",
|
|
10508
|
+
className: "size-4",
|
|
10509
|
+
ariaLabel: venueLabel
|
|
10510
|
+
}
|
|
10511
|
+
),
|
|
10512
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { children: venueLabel }),
|
|
10513
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
10514
|
+
Icon,
|
|
10515
|
+
{
|
|
10516
|
+
name: "chevron-down",
|
|
10517
|
+
className: "size-4! shrink-0 text-agg-foreground transition-transform group-open/agg-settlement-rule:rotate-180",
|
|
10518
|
+
"aria-hidden": "true"
|
|
10519
|
+
}
|
|
10520
|
+
)
|
|
10521
|
+
] }),
|
|
10522
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "mt-3 pl-6", children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(SettlementTextRenderer, { content: rule.content }) })
|
|
10523
|
+
] }, rule.venue);
|
|
10524
|
+
}) })
|
|
10525
|
+
] }) : null
|
|
10526
|
+
] })
|
|
10527
|
+
]
|
|
10528
|
+
}
|
|
10529
|
+
);
|
|
10530
|
+
}
|
|
10261
10531
|
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
10262
10532
|
Card,
|
|
10263
10533
|
{
|
|
@@ -10272,7 +10542,7 @@ var Settlement = ({
|
|
|
10272
10542
|
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "text-agg-xs font-agg-bold leading-agg-4 uppercase text-agg-muted-foreground", children: resolvedSectionLabel }),
|
|
10273
10543
|
question ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "agg-settlement-question text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: question }) : null
|
|
10274
10544
|
] }),
|
|
10275
|
-
blocks.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "agg-settlement-empty text-agg-sm leading-agg-5 text-agg-muted-foreground", children: labels.trading.settlementEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-settlement-sections flex flex-col gap-4", children: [
|
|
10545
|
+
blocks.length === 0 && settlementDifferences.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "agg-settlement-empty text-agg-sm leading-agg-5 text-agg-muted-foreground", children: labels.trading.settlementEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-settlement-sections flex flex-col gap-4", children: [
|
|
10276
10546
|
eventBlock || marketBlock ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
10277
10547
|
"div",
|
|
10278
10548
|
{
|
|
@@ -10307,12 +10577,17 @@ Settlement.displayName = "Settlement";
|
|
|
10307
10577
|
var import_jsx_runtime124 = require("react/jsx-runtime");
|
|
10308
10578
|
var SettlementSummary = ({
|
|
10309
10579
|
content,
|
|
10580
|
+
settlementDiff,
|
|
10310
10581
|
settlementSectionId = SETTLEMENT_SECTION_ID,
|
|
10311
10582
|
className
|
|
10312
10583
|
}) => {
|
|
10313
10584
|
const labels = (0, import_hooks39.useLabels)();
|
|
10314
10585
|
const firstParagraph = (0, import_react15.useMemo)(() => getFirstSettlementParagraph(content), [content]);
|
|
10315
|
-
|
|
10586
|
+
const settlementDifferences = (0, import_react15.useMemo)(
|
|
10587
|
+
() => prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences),
|
|
10588
|
+
[settlementDiff == null ? void 0 : settlementDiff.differences]
|
|
10589
|
+
);
|
|
10590
|
+
if (!firstParagraph && settlementDifferences.length === 0) return null;
|
|
10316
10591
|
const handleReadFullDetails = (event) => {
|
|
10317
10592
|
event.preventDefault();
|
|
10318
10593
|
event.stopPropagation();
|
|
@@ -10321,43 +10596,118 @@ var SettlementSummary = ({
|
|
|
10321
10596
|
if (!target) return;
|
|
10322
10597
|
target.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
10323
10598
|
};
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10599
|
+
const handleDifferencePillClick = (event, canonicalKey) => {
|
|
10600
|
+
event.preventDefault();
|
|
10601
|
+
event.stopPropagation();
|
|
10602
|
+
if (typeof document === "undefined") return;
|
|
10603
|
+
const target = document.getElementById(
|
|
10604
|
+
getSettlementDifferenceId(settlementSectionId, canonicalKey)
|
|
10605
|
+
);
|
|
10606
|
+
if (!target) return;
|
|
10607
|
+
const trigger = target.querySelector("button[aria-expanded]");
|
|
10608
|
+
if ((trigger == null ? void 0 : trigger.getAttribute("aria-expanded")) === "false") {
|
|
10609
|
+
trigger.click();
|
|
10610
|
+
}
|
|
10611
|
+
target.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
10612
|
+
};
|
|
10613
|
+
const actionButton = /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
|
|
10614
|
+
"button",
|
|
10615
|
+
{
|
|
10616
|
+
type: "button",
|
|
10617
|
+
className: cn(
|
|
10618
|
+
"agg-settlement-summary-toggle",
|
|
10619
|
+
"inline-flex shrink-0 cursor-pointer items-center gap-1 whitespace-nowrap text-agg-sm font-agg-bold leading-agg-5 text-agg-primary",
|
|
10620
|
+
"hover:opacity-80",
|
|
10621
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
|
|
10622
|
+
),
|
|
10623
|
+
"aria-controls": settlementSectionId,
|
|
10624
|
+
onClick: handleReadFullDetails,
|
|
10625
|
+
children: [
|
|
10626
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { children: labels.settlementSummary.readFullDetails }),
|
|
10627
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Icon, { name: "chevron-down", className: "size-[14px]", "aria-hidden": "true" })
|
|
10628
|
+
]
|
|
10629
|
+
}
|
|
10630
|
+
);
|
|
10631
|
+
if (settlementDifferences.length > 0) {
|
|
10632
|
+
const visibleDifferences = settlementDifferences.slice(0, 2);
|
|
10633
|
+
const hiddenDifferenceCount = settlementDifferences.length - visibleDifferences.length;
|
|
10634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
|
|
10635
|
+
"div",
|
|
10327
10636
|
{
|
|
10328
|
-
|
|
10329
|
-
|
|
10330
|
-
|
|
10637
|
+
className: cn(
|
|
10638
|
+
"agg-settlement-summary flex w-full flex-wrap items-start justify-between gap-x-4 gap-y-2",
|
|
10639
|
+
className
|
|
10640
|
+
),
|
|
10641
|
+
children: [
|
|
10642
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex min-w-[240px] flex-1 flex-wrap items-center gap-x-5 gap-y-3", children: [
|
|
10643
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "agg-settlement-summary-heading flex shrink-0 items-center gap-2", children: [
|
|
10644
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)("p", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground", children: labels.settlementSummary.title }),
|
|
10645
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)("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 })
|
|
10646
|
+
] }),
|
|
10647
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "agg-settlement-summary-pills flex min-w-[240px] flex-1 flex-wrap items-center gap-2", children: [
|
|
10648
|
+
visibleDifferences.map((difference) => /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
|
|
10649
|
+
"button",
|
|
10650
|
+
{
|
|
10651
|
+
type: "button",
|
|
10652
|
+
className: cn(
|
|
10653
|
+
"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]",
|
|
10654
|
+
"hover:opacity-80",
|
|
10655
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
|
|
10656
|
+
),
|
|
10657
|
+
onClick: (event) => handleDifferencePillClick(event, difference.canonicalKey),
|
|
10658
|
+
children: [
|
|
10659
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
10660
|
+
"i",
|
|
10661
|
+
{
|
|
10662
|
+
className: cn(
|
|
10663
|
+
"fi",
|
|
10664
|
+
resolveDifferenceIconClassName(difference.canonicalKey),
|
|
10665
|
+
"inline-flex size-3 shrink-0 items-center justify-center text-[12px] leading-none text-agg-muted-foreground"
|
|
10666
|
+
),
|
|
10667
|
+
"aria-hidden": "true"
|
|
10668
|
+
}
|
|
10669
|
+
),
|
|
10670
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "min-w-0 truncate", children: difference.title })
|
|
10671
|
+
]
|
|
10672
|
+
},
|
|
10673
|
+
difference.canonicalKey
|
|
10674
|
+
)),
|
|
10675
|
+
hiddenDifferenceCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("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: [
|
|
10676
|
+
"+",
|
|
10677
|
+
hiddenDifferenceCount
|
|
10678
|
+
] }) : null
|
|
10679
|
+
] })
|
|
10680
|
+
] }),
|
|
10681
|
+
actionButton
|
|
10682
|
+
]
|
|
10331
10683
|
}
|
|
10332
|
-
)
|
|
10333
|
-
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
),
|
|
10341
|
-
children: firstParagraph
|
|
10342
|
-
}
|
|
10684
|
+
);
|
|
10685
|
+
}
|
|
10686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
|
|
10687
|
+
"div",
|
|
10688
|
+
{
|
|
10689
|
+
className: cn(
|
|
10690
|
+
"agg-settlement-summary flex w-full items-center justify-between gap-4",
|
|
10691
|
+
className
|
|
10343
10692
|
),
|
|
10344
|
-
|
|
10345
|
-
"
|
|
10346
|
-
|
|
10347
|
-
|
|
10348
|
-
|
|
10349
|
-
|
|
10350
|
-
|
|
10351
|
-
|
|
10352
|
-
|
|
10353
|
-
|
|
10354
|
-
|
|
10355
|
-
|
|
10356
|
-
|
|
10357
|
-
}
|
|
10358
|
-
|
|
10359
|
-
|
|
10360
|
-
|
|
10693
|
+
children: [
|
|
10694
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "agg-settlement-summary-row flex min-w-0 flex-1 items-center gap-5", children: [
|
|
10695
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)("div", { className: "agg-settlement-summary-heading flex shrink-0 items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("p", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground", children: labels.settlementSummary.title }) }),
|
|
10696
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
10697
|
+
"p",
|
|
10698
|
+
{
|
|
10699
|
+
className: cn(
|
|
10700
|
+
"agg-settlement-summary-text",
|
|
10701
|
+
"min-w-0 flex-1 truncate text-agg-sm leading-agg-5 text-agg-foreground"
|
|
10702
|
+
),
|
|
10703
|
+
children: firstParagraph
|
|
10704
|
+
}
|
|
10705
|
+
)
|
|
10706
|
+
] }),
|
|
10707
|
+
actionButton
|
|
10708
|
+
]
|
|
10709
|
+
}
|
|
10710
|
+
);
|
|
10361
10711
|
};
|
|
10362
10712
|
SettlementSummary.displayName = "SettlementSummary";
|
|
10363
10713
|
|
|
@@ -11092,7 +11442,7 @@ var EventListItemDetailsContent = ({
|
|
|
11092
11442
|
}
|
|
11093
11443
|
)
|
|
11094
11444
|
] }),
|
|
11095
|
-
event.description ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(SettlementSummary, { content: event.description }) : null
|
|
11445
|
+
event.description || event.settlementDiff ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(SettlementSummary, { content: event.description, settlementDiff: event.settlementDiff }) : null
|
|
11096
11446
|
]
|
|
11097
11447
|
}
|
|
11098
11448
|
);
|
package/dist/events.mjs
CHANGED
|
@@ -16,13 +16,13 @@ import {
|
|
|
16
16
|
orderbookRowLimitDefault,
|
|
17
17
|
resolveEventDetailsSyncKey,
|
|
18
18
|
useCenterOrderbookSpread
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-PHRYWSNV.mjs";
|
|
20
20
|
import {
|
|
21
21
|
formatProbabilityCents,
|
|
22
22
|
resolveOrderBookRows,
|
|
23
23
|
resolveUnifiedOrderBookEntries
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-
|
|
24
|
+
} from "./chunk-STL4ZHLP.mjs";
|
|
25
|
+
import "./chunk-WZ55ERDO.mjs";
|
|
26
26
|
export {
|
|
27
27
|
EventList,
|
|
28
28
|
EventListItem,
|