@agg-build/ui 2.4.2 → 2.4.5
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-EOCHFD2U.mjs → chunk-CXSIXL7M.mjs} +38 -36
- package/dist/{chunk-3FLLEJFM.mjs → chunk-GWRFSQQK.mjs} +75 -9
- package/dist/{chunk-MDO3NMXP.mjs → chunk-I4X5UNCT.mjs} +343 -193
- package/dist/{chunk-G5BXCT5Y.mjs → chunk-JVRTJQPZ.mjs} +1 -1
- package/dist/{chunk-GUYFQP7L.mjs → chunk-P5CVJQPW.mjs} +288 -291
- package/dist/{chunk-2ET5CXOU.mjs → chunk-PTNFXXOV.mjs} +53 -21
- package/dist/{chunk-G5Y45GIA.mjs → chunk-UH3DUTMG.mjs} +352 -43
- package/dist/events.js +679 -194
- package/dist/events.mjs +3 -3
- package/dist/index.js +1097 -547
- package/dist/index.mjs +13 -7
- package/dist/modals.js +333 -297
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +809 -262
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +53 -21
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +3265 -2765
- package/dist/trading.mjs +10 -4
- package/dist/types/events/item-details/event-list-item-details.constants.d.mts +1 -1
- package/dist/types/events/item-details/event-list-item-details.constants.d.ts +1 -1
- 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/onboarding/index.d.mts +1 -1
- package/dist/types/onboarding/index.d.ts +1 -1
- package/dist/types/onboarding/steps/connect-accounts.d.mts +1 -1
- package/dist/types/onboarding/steps/connect-accounts.d.ts +1 -1
- package/dist/types/primitives/icon/icon.constants.d.mts +1 -0
- package/dist/types/primitives/icon/icon.constants.d.ts +1 -0
- package/dist/types/shared/use-horizontal-scroll-state.d.mts +3 -0
- package/dist/types/shared/use-horizontal-scroll-state.d.ts +3 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +1 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +1 -0
- package/dist/types/trading/settlement/index.d.mts +19 -1
- package/dist/types/trading/settlement/index.d.ts +19 -1
- package/package.json +2 -2
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
isErrorWithStatus,
|
|
11
11
|
useEventListTabs,
|
|
12
12
|
useEventListTabsHeaderOverflow
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-I4X5UNCT.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-
|
|
21
|
+
} from "./chunk-GWRFSQQK.mjs";
|
|
22
22
|
import {
|
|
23
23
|
getDisplayOutcomePrice
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-UH3DUTMG.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-
|
|
56
|
+
} from "./chunk-PTNFXXOV.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
|
),
|
|
@@ -4129,10 +4137,6 @@ EmptyState.displayName = "EmptyState";
|
|
|
4129
4137
|
// src/pages/user-profile/components/position-row.tsx
|
|
4130
4138
|
import { optimizedImageUrl, useLabels as useLabels7 } from "@agg-build/hooks";
|
|
4131
4139
|
import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4132
|
-
var floorToTwoDecimals = (value) => {
|
|
4133
|
-
if (!Number.isFinite(value) || value <= 0) return 0;
|
|
4134
|
-
return Math.trunc(value * 100) / 100;
|
|
4135
|
-
};
|
|
4136
4140
|
var shouldUseNativeLinkNavigation2 = (event) => {
|
|
4137
4141
|
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
|
|
4138
4142
|
};
|
|
@@ -4145,32 +4149,21 @@ var OutcomePill = ({ label }) => /* @__PURE__ */ jsx12("span", { className: "agg
|
|
|
4145
4149
|
var ResolutionPill = ({ label }) => /* @__PURE__ */ jsx12("span", { className: "agg-position-resolution-pill inline-flex w-full items-center justify-center overflow-hidden rounded-full bg-agg-secondary-hover px-4 py-[6px] md:w-auto", children: /* @__PURE__ */ jsx12("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: label }) });
|
|
4146
4150
|
var VenueShares = ({
|
|
4147
4151
|
model,
|
|
4148
|
-
totalSharesLabel,
|
|
4149
4152
|
className,
|
|
4150
4153
|
keyPrefix
|
|
4151
4154
|
}) => {
|
|
4152
|
-
if (
|
|
4153
|
-
return /* @__PURE__ */
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
className: "cursor-help rounded-agg-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary",
|
|
4165
|
-
"aria-label": `${row.venue} shares`,
|
|
4166
|
-
children: /* @__PURE__ */ jsx12(VenueLogo, { venue: row.venue, size: "small", className: "size-4 shrink-0" })
|
|
4167
|
-
}
|
|
4168
|
-
)
|
|
4169
|
-
},
|
|
4170
|
-
`${keyPrefix}-${row.venue}-${String(index)}`
|
|
4171
|
-
)) }) : null,
|
|
4172
|
-
totalSharesLabel ? /* @__PURE__ */ jsx12("span", { className: "whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: totalSharesLabel }) : null
|
|
4173
|
-
] });
|
|
4155
|
+
if (model.venueShareBreakdown.length === 0) return null;
|
|
4156
|
+
return /* @__PURE__ */ jsx12("div", { className: cn(className, "gap-x-3 gap-y-2"), children: model.venueShareBreakdown.map((row, index) => /* @__PURE__ */ jsxs11(
|
|
4157
|
+
"div",
|
|
4158
|
+
{
|
|
4159
|
+
className: "flex min-w-0 max-w-full items-center gap-1",
|
|
4160
|
+
children: [
|
|
4161
|
+
/* @__PURE__ */ jsx12(VenueLogo, { venue: row.venue, size: "small", className: "size-4 shrink-0" }),
|
|
4162
|
+
/* @__PURE__ */ jsx12("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: row.sharesLabel })
|
|
4163
|
+
]
|
|
4164
|
+
},
|
|
4165
|
+
`${keyPrefix}-${row.venue}-${row.sharesLabel}-${String(index)}`
|
|
4166
|
+
)) });
|
|
4174
4167
|
};
|
|
4175
4168
|
var StatusBadge = ({
|
|
4176
4169
|
status,
|
|
@@ -4287,7 +4280,6 @@ var PositionRow = ({
|
|
|
4287
4280
|
finalPrefix: labels.finalPrefix
|
|
4288
4281
|
});
|
|
4289
4282
|
const isClosed = (variant != null ? variant : model.bucket) === "closed";
|
|
4290
|
-
const totalSharesLabel = typeof position.totalShares === "number" && Number.isFinite(position.totalShares) ? `${String(floorToTwoDecimals(position.totalShares))} shares` : null;
|
|
4291
4283
|
const handleClaim = (event) => {
|
|
4292
4284
|
event.preventDefault();
|
|
4293
4285
|
event.stopPropagation();
|
|
@@ -4348,7 +4340,6 @@ var PositionRow = ({
|
|
|
4348
4340
|
VenueShares,
|
|
4349
4341
|
{
|
|
4350
4342
|
model,
|
|
4351
|
-
totalSharesLabel,
|
|
4352
4343
|
keyPrefix: "desktop",
|
|
4353
4344
|
className: "agg-position-venues flex flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2"
|
|
4354
4345
|
}
|
|
@@ -4363,7 +4354,6 @@ var PositionRow = ({
|
|
|
4363
4354
|
VenueShares,
|
|
4364
4355
|
{
|
|
4365
4356
|
model,
|
|
4366
|
-
totalSharesLabel,
|
|
4367
4357
|
keyPrefix: "mobile",
|
|
4368
4358
|
className: "agg-position-venues flex min-w-0 flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2 md:hidden"
|
|
4369
4359
|
}
|
|
@@ -5575,7 +5565,19 @@ function buildVenueShareBreakdown(outcome) {
|
|
|
5575
5565
|
if (breakdown.length === 0) {
|
|
5576
5566
|
return [];
|
|
5577
5567
|
}
|
|
5578
|
-
const
|
|
5568
|
+
const aggregatedByVenue = breakdown.reduce(
|
|
5569
|
+
(acc, row) => {
|
|
5570
|
+
const existing = acc.get(row.venue);
|
|
5571
|
+
if (existing) {
|
|
5572
|
+
existing.size += row.size;
|
|
5573
|
+
return acc;
|
|
5574
|
+
}
|
|
5575
|
+
acc.set(row.venue, { venue: row.venue, size: row.size });
|
|
5576
|
+
return acc;
|
|
5577
|
+
},
|
|
5578
|
+
/* @__PURE__ */ new Map()
|
|
5579
|
+
);
|
|
5580
|
+
const sorted = [...aggregatedByVenue.values()].sort(
|
|
5579
5581
|
(a, b) => venueBreakdownSortKey(a.venue) - venueBreakdownSortKey(b.venue)
|
|
5580
5582
|
);
|
|
5581
5583
|
return sorted.map((row) => ({
|
|
@@ -7,12 +7,13 @@ import {
|
|
|
7
7
|
getTradingPriceLabel,
|
|
8
8
|
getTradingValueLabel,
|
|
9
9
|
getTradingVenueLabel,
|
|
10
|
+
prepareSettlementDifferences,
|
|
10
11
|
resolveOrderEligibilityMessage
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-UH3DUTMG.mjs";
|
|
12
13
|
import {
|
|
13
14
|
GeoBlockBanner,
|
|
14
15
|
subscribeAggDepositNotification
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-JVRTJQPZ.mjs";
|
|
16
17
|
import {
|
|
17
18
|
AGG_TERMS_OF_SERVICE_URL,
|
|
18
19
|
Button,
|
|
@@ -41,10 +42,11 @@ import {
|
|
|
41
42
|
formatSportsEventTimeEt,
|
|
42
43
|
formatUsd,
|
|
43
44
|
getMotionClassName,
|
|
45
|
+
normalizeVenueMarketCluster,
|
|
44
46
|
resolveResolvedOutcomeLabel,
|
|
45
47
|
skeletonViews,
|
|
46
48
|
useOptionalToast
|
|
47
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-PTNFXXOV.mjs";
|
|
48
50
|
|
|
49
51
|
// src/trading/types.ts
|
|
50
52
|
import { Venue, enumGuard, isFiniteNonNeg, safeParse } from "@agg-build/sdk";
|
|
@@ -53,31 +55,71 @@ var parseVenue = (v) => safeParse(v, isVenue);
|
|
|
53
55
|
var parseAmount = (v) => safeParse(v, isFiniteNonNeg);
|
|
54
56
|
|
|
55
57
|
// src/trading/settlement/settlement-details.tsx
|
|
56
|
-
import {
|
|
58
|
+
import {
|
|
59
|
+
resolveDefaultTradingMarket,
|
|
60
|
+
useEventTradingContext
|
|
61
|
+
} from "@agg-build/hooks";
|
|
57
62
|
import { jsx } from "react/jsx-runtime";
|
|
58
63
|
var hasContent = (value) => {
|
|
59
64
|
return typeof value === "string" && value.trim().length > 0;
|
|
60
65
|
};
|
|
66
|
+
var buildVenueSettlementRules = (venueMarkets) => {
|
|
67
|
+
var _a;
|
|
68
|
+
const contentByVenue = /* @__PURE__ */ new Map();
|
|
69
|
+
for (const venueMarket of venueMarkets) {
|
|
70
|
+
const content = [venueMarket.description, venueMarket.rulesPrimary, venueMarket.rulesSecondary].filter(hasContent).map((value) => value.trim());
|
|
71
|
+
if (content.length === 0) continue;
|
|
72
|
+
const venueContent = (_a = contentByVenue.get(venueMarket.venue)) != null ? _a : [];
|
|
73
|
+
for (const value of content) {
|
|
74
|
+
if (!venueContent.includes(value)) venueContent.push(value);
|
|
75
|
+
}
|
|
76
|
+
contentByVenue.set(venueMarket.venue, venueContent);
|
|
77
|
+
}
|
|
78
|
+
return Array.from(contentByVenue, ([venue, content]) => ({
|
|
79
|
+
venue,
|
|
80
|
+
content: content.join("\n\n")
|
|
81
|
+
}));
|
|
82
|
+
};
|
|
61
83
|
var SettlementDetails = ({ className }) => {
|
|
62
84
|
var _a, _b, _c, _d, _e, _f;
|
|
63
85
|
const tradingContext = useEventTradingContext();
|
|
64
86
|
const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
|
|
65
87
|
const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
|
|
66
88
|
if (!selectedEvent) return null;
|
|
67
|
-
|
|
89
|
+
const activeMarket = selectedMarket != null ? selectedMarket : resolveDefaultTradingMarket(selectedEvent);
|
|
90
|
+
if (!activeMarket) return null;
|
|
91
|
+
const allVenueMarkets = normalizeVenueMarketCluster(selectedEvent.venueMarkets);
|
|
92
|
+
const activeMarketCluster = normalizeVenueMarketCluster(
|
|
93
|
+
selectedEvent.venueMarkets,
|
|
94
|
+
activeMarket.id
|
|
95
|
+
);
|
|
96
|
+
const activeMarketIds = new Set(activeMarketCluster.map((market) => market.id));
|
|
97
|
+
const orderedActiveMarketCluster = allVenueMarkets.filter(
|
|
98
|
+
(market) => activeMarketIds.has(market.id)
|
|
99
|
+
);
|
|
68
100
|
const eventDescription = (_c = selectedEvent.description) != null ? _c : null;
|
|
69
|
-
const marketDescription = (_d =
|
|
70
|
-
const primaryRules = (_e =
|
|
71
|
-
|
|
101
|
+
const marketDescription = (_d = activeMarket.description) != null ? _d : null;
|
|
102
|
+
const primaryRules = (_e = activeMarket.rulesPrimary) != null ? _e : null;
|
|
103
|
+
const settlementDiff = (_f = selectedEvent.settlementDiff) != null ? _f : null;
|
|
104
|
+
const settlementVenues = Array.from(
|
|
105
|
+
new Set(orderedActiveMarketCluster.map((market) => market.venue))
|
|
106
|
+
);
|
|
107
|
+
const settlementVenueRules = buildVenueSettlementRules(orderedActiveMarketCluster);
|
|
108
|
+
const hasSettlementDifferences = prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences).length > 0;
|
|
109
|
+
const hasVenueSettlementRules = settlementVenueRules.length > 0;
|
|
110
|
+
if (!hasContent(eventDescription) && !hasVenueSettlementRules && !hasSettlementDifferences) {
|
|
72
111
|
return null;
|
|
73
112
|
}
|
|
74
113
|
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
114
|
Settlement,
|
|
76
115
|
{
|
|
77
|
-
question:
|
|
116
|
+
question: selectedEvent.title,
|
|
78
117
|
eventDescription,
|
|
79
118
|
marketDescription,
|
|
80
119
|
primaryRules,
|
|
120
|
+
settlementDiff,
|
|
121
|
+
settlementVenues,
|
|
122
|
+
settlementVenueRules,
|
|
81
123
|
className
|
|
82
124
|
}
|
|
83
125
|
) }) });
|
|
@@ -1080,6 +1122,10 @@ var extractGeoBlockedVenues = (warnings) => {
|
|
|
1080
1122
|
warnings.filter((w) => w.venue && isGeoBlockWarningReason(w.reason)).map((w) => w.venue)
|
|
1081
1123
|
);
|
|
1082
1124
|
};
|
|
1125
|
+
var hasLowLiquidityWarning = (warnings) => {
|
|
1126
|
+
if (!(warnings == null ? void 0 : warnings.length)) return false;
|
|
1127
|
+
return warnings.some((warning) => (warning == null ? void 0 : warning.reason) === "low_liquidity");
|
|
1128
|
+
};
|
|
1083
1129
|
var getPlaceOrderContainerClassName = () => {
|
|
1084
1130
|
return PLACE_ORDER_CONTAINER_CLASS_NAME;
|
|
1085
1131
|
};
|
|
@@ -4046,6 +4092,7 @@ var PlaceOrder = ({
|
|
|
4046
4092
|
return fills.length > 0 && fills.every((f) => geoBlockedVenuesFromWarnings.has(f.venue));
|
|
4047
4093
|
}, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
|
|
4048
4094
|
const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked;
|
|
4095
|
+
const shouldShowLowLiquidityWarning = !isQuoteInputEditing && !isQuoteLoading && (activeQuoteData == null ? void 0 : activeQuoteData.venueMarketOutcomeId) === scopedSelectedOutcomeId && hasLowLiquidityWarning(activeQuoteData.warnings);
|
|
4049
4096
|
const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
|
|
4050
4097
|
const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isQuoteInsufficientBalance || isBelowMinimum || isQuoteLoading || !selectedRouteCard || !selectedRouteCard.quoteData.quoteId || selectedRouteGeoBlocked || !isAuthenticated || quoteStatus !== void 0;
|
|
4051
4098
|
const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (orderedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading);
|
|
@@ -4852,6 +4899,25 @@ var PlaceOrder = ({
|
|
|
4852
4899
|
children: actionLabel
|
|
4853
4900
|
}
|
|
4854
4901
|
),
|
|
4902
|
+
shouldShowLowLiquidityWarning ? /* @__PURE__ */ jsxs4(
|
|
4903
|
+
"div",
|
|
4904
|
+
{
|
|
4905
|
+
className: "agg-order-low-liquidity-warning flex w-full items-center gap-2 rounded-agg-lg bg-agg-warning/10 px-3 py-2",
|
|
4906
|
+
role: "status",
|
|
4907
|
+
children: [
|
|
4908
|
+
/* @__PURE__ */ jsx5(
|
|
4909
|
+
Icon,
|
|
4910
|
+
{
|
|
4911
|
+
name: "warning-filled",
|
|
4912
|
+
size: "small",
|
|
4913
|
+
className: "h-4! w-4! shrink-0 text-agg-warning",
|
|
4914
|
+
"aria-hidden": "true"
|
|
4915
|
+
}
|
|
4916
|
+
),
|
|
4917
|
+
/* @__PURE__ */ jsx5("p", { className: "min-w-0 flex-1 wrap-break-word text-agg-sm leading-agg-5 text-agg-foreground", children: tradingLabels.lowLiquidityWarning })
|
|
4918
|
+
]
|
|
4919
|
+
}
|
|
4920
|
+
) : null,
|
|
4855
4921
|
!shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown ? /* @__PURE__ */ jsxs4("div", { className: "agg-order-platform-fee mt-1 flex items-center justify-center gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
|
|
4856
4922
|
/* @__PURE__ */ jsx5(
|
|
4857
4923
|
Icon,
|