@agg-build/ui 4.11.1 → 4.13.2

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.
@@ -30,6 +30,11 @@ export type SportsSectionTab = {
30
30
  export type SportsMarketCardVariant = "outcome" | "line" | "yes_no";
31
31
  export type SportsMarketDisplayGroup = {
32
32
  id: string;
33
+ /**
34
+ * Wording for the whole group, derived from `markets[0]`. On a line ladder that
35
+ * is the LOWEST rung, so any line it names is the lowest one — the card swaps
36
+ * in the selected rung's number via {@link resolveSportsLadderTitle}.
37
+ */
33
38
  title: string;
34
39
  questionKey: string;
35
40
  sportsMarketType: SportsMarketTypeKey | null;
@@ -184,6 +189,28 @@ export type SportsCombinedLeg = {
184
189
  * ponytail: O(n) map build over one group's markets (a handful of rows).
185
190
  */
186
191
  export declare const resolveSportsCombinedLegs: (group: Pick<SportsMarketDisplayGroup, "markets" | "sportsMarketType">) => SportsCombinedLeg[] | null;
192
+ /**
193
+ * The group's wording with the SELECTED rung's number in it.
194
+ *
195
+ * `group.title` is derived once, from `markets[0]` — the lowest rung — while the
196
+ * card renders whichever rung the rail has selected (by default the
197
+ * highest-volume one). Where a venue spells the line into its question and our
198
+ * cleaner can't strip it (kalshi's "Kentucky over 2.5 points scored" keeps its
199
+ * line because the strip is anchored to the END of the string), the heading
200
+ * quoted a line the card was not showing — contradicting its own chip, its
201
+ * Yes/No pills and the trade panel.
202
+ *
203
+ * Only the digits move. Re-deriving the title from the selected market instead
204
+ * would reword the card rung to rung, because the ladder is stocked from
205
+ * whichever venue lists each line and they phrase the same bet differently
206
+ * ("Kentucky O/U 23.5" strips down to a bare "Kentucky Totals", and prophetx
207
+ * would put "ALA: Team Points Fixed" in the header). One wording, one number.
208
+ *
209
+ * A title with no line in it — "Spreads", "Total Points", or a ladder whose
210
+ * lowest rung came from a venue we DO strip cleanly — has nothing to swap and is
211
+ * returned untouched.
212
+ */
213
+ export declare const resolveSportsLadderTitle: (group: SportsMarketDisplayGroup, selectedLineDisplay: string) => string;
187
214
  export declare const buildSportsSlideFromGroup: (group: SportsMarketDisplayGroup) => SportsGameLineSlide;
188
215
  /**
189
216
  * Derive the Moneyline / Spreads / Total game-line slides (in that order) from a
@@ -30,6 +30,11 @@ export type SportsSectionTab = {
30
30
  export type SportsMarketCardVariant = "outcome" | "line" | "yes_no";
31
31
  export type SportsMarketDisplayGroup = {
32
32
  id: string;
33
+ /**
34
+ * Wording for the whole group, derived from `markets[0]`. On a line ladder that
35
+ * is the LOWEST rung, so any line it names is the lowest one — the card swaps
36
+ * in the selected rung's number via {@link resolveSportsLadderTitle}.
37
+ */
33
38
  title: string;
34
39
  questionKey: string;
35
40
  sportsMarketType: SportsMarketTypeKey | null;
@@ -184,6 +189,28 @@ export type SportsCombinedLeg = {
184
189
  * ponytail: O(n) map build over one group's markets (a handful of rows).
185
190
  */
186
191
  export declare const resolveSportsCombinedLegs: (group: Pick<SportsMarketDisplayGroup, "markets" | "sportsMarketType">) => SportsCombinedLeg[] | null;
192
+ /**
193
+ * The group's wording with the SELECTED rung's number in it.
194
+ *
195
+ * `group.title` is derived once, from `markets[0]` — the lowest rung — while the
196
+ * card renders whichever rung the rail has selected (by default the
197
+ * highest-volume one). Where a venue spells the line into its question and our
198
+ * cleaner can't strip it (kalshi's "Kentucky over 2.5 points scored" keeps its
199
+ * line because the strip is anchored to the END of the string), the heading
200
+ * quoted a line the card was not showing — contradicting its own chip, its
201
+ * Yes/No pills and the trade panel.
202
+ *
203
+ * Only the digits move. Re-deriving the title from the selected market instead
204
+ * would reword the card rung to rung, because the ladder is stocked from
205
+ * whichever venue lists each line and they phrase the same bet differently
206
+ * ("Kentucky O/U 23.5" strips down to a bare "Kentucky Totals", and prophetx
207
+ * would put "ALA: Team Points Fixed" in the header). One wording, one number.
208
+ *
209
+ * A title with no line in it — "Spreads", "Total Points", or a ladder whose
210
+ * lowest rung came from a venue we DO strip cleanly — has nothing to swap and is
211
+ * returned untouched.
212
+ */
213
+ export declare const resolveSportsLadderTitle: (group: SportsMarketDisplayGroup, selectedLineDisplay: string) => string;
187
214
  export declare const buildSportsSlideFromGroup: (group: SportsMarketDisplayGroup) => SportsGameLineSlide;
188
215
  /**
189
216
  * Derive the Moneyline / Spreads / Total game-line slides (in that order) from a
@@ -73,6 +73,34 @@ export type PlaceOrderAggregateOrderStatus = "pending" | "full_success" | "parti
73
73
  * corresponding terminal event so the UI never transitions prematurely.
74
74
  */
75
75
  export declare const deriveAggregateOrderStatus: (orderIds: string[], terminalEvents: PlaceOrderTerminalOrderEvent[]) => PlaceOrderAggregateOrderStatus;
76
+ /**
77
+ * Dollars a BUY quote pays if the outcome wins. One dollar per share, less what
78
+ * the venue takes from that payout (Hyperliquid HIP-4's close fee), which the
79
+ * API reports as `estimatedPayout`. Older responses omit it — fall back to
80
+ * shares, which is exactly right for every venue that charges nothing at win.
81
+ */
82
+ export declare const getPlaceOrderBuyPayout: (quoteData: Pick<SmartRouteResponse, "estimatedPayout" | "totalFilled">) => number;
83
+ /**
84
+ * Dollars a SELL quote returns after the fees charged at fill. `rawExecCost` is
85
+ * gross proceeds on a sell (redeem legs at $1 plus router revenue), so subtract
86
+ * each fill's venue and builder fee. Sell fills carry no execution reserve.
87
+ */
88
+ export declare const getPlaceOrderSellProceeds: (quoteData: Pick<SmartRouteResponse, "rawExecCost" | "fills">) => number;
89
+ /** The dollar figure a route card shows and is ranked by. */
90
+ export declare const getPlaceOrderQuoteValue: (quoteData: SmartRouteResponse, tradeSide: PlaceOrderTab) => number;
91
+ /**
92
+ * The same net figure for realized fills: scale the actual shares (buy) or
93
+ * actual gross proceeds (sell) by each executed leg's quoted net-to-gross
94
+ * ratio. Without execution events, use the overall quote ratio.
95
+ */
96
+ export declare const resolvePlaceOrderNetResult: ({ quoteData, tradeSide, shares, usd, terminalOrderEvents, submittedOrders, }: {
97
+ quoteData: SmartRouteResponse | null | undefined;
98
+ tradeSide: PlaceOrderTab;
99
+ shares: number;
100
+ usd: number;
101
+ terminalOrderEvents?: PlaceOrderTerminalOrderEvent[];
102
+ submittedOrders?: WsOrderSubmitted[];
103
+ }) => number;
76
104
  export declare const resolvePlaceOrderQuoteResult: ({ labels, quoteData, tradeSide, }: ResolvePlaceOrderQuoteResultParams) => PlaceOrderQuoteResult | null;
77
105
  export declare const sanitizePlaceOrderAmount: (value: number) => number;
78
106
  export declare const getTradingRoutePriceLabel: (value: number) => string;
@@ -73,6 +73,34 @@ export type PlaceOrderAggregateOrderStatus = "pending" | "full_success" | "parti
73
73
  * corresponding terminal event so the UI never transitions prematurely.
74
74
  */
75
75
  export declare const deriveAggregateOrderStatus: (orderIds: string[], terminalEvents: PlaceOrderTerminalOrderEvent[]) => PlaceOrderAggregateOrderStatus;
76
+ /**
77
+ * Dollars a BUY quote pays if the outcome wins. One dollar per share, less what
78
+ * the venue takes from that payout (Hyperliquid HIP-4's close fee), which the
79
+ * API reports as `estimatedPayout`. Older responses omit it — fall back to
80
+ * shares, which is exactly right for every venue that charges nothing at win.
81
+ */
82
+ export declare const getPlaceOrderBuyPayout: (quoteData: Pick<SmartRouteResponse, "estimatedPayout" | "totalFilled">) => number;
83
+ /**
84
+ * Dollars a SELL quote returns after the fees charged at fill. `rawExecCost` is
85
+ * gross proceeds on a sell (redeem legs at $1 plus router revenue), so subtract
86
+ * each fill's venue and builder fee. Sell fills carry no execution reserve.
87
+ */
88
+ export declare const getPlaceOrderSellProceeds: (quoteData: Pick<SmartRouteResponse, "rawExecCost" | "fills">) => number;
89
+ /** The dollar figure a route card shows and is ranked by. */
90
+ export declare const getPlaceOrderQuoteValue: (quoteData: SmartRouteResponse, tradeSide: PlaceOrderTab) => number;
91
+ /**
92
+ * The same net figure for realized fills: scale the actual shares (buy) or
93
+ * actual gross proceeds (sell) by each executed leg's quoted net-to-gross
94
+ * ratio. Without execution events, use the overall quote ratio.
95
+ */
96
+ export declare const resolvePlaceOrderNetResult: ({ quoteData, tradeSide, shares, usd, terminalOrderEvents, submittedOrders, }: {
97
+ quoteData: SmartRouteResponse | null | undefined;
98
+ tradeSide: PlaceOrderTab;
99
+ shares: number;
100
+ usd: number;
101
+ terminalOrderEvents?: PlaceOrderTerminalOrderEvent[];
102
+ submittedOrders?: WsOrderSubmitted[];
103
+ }) => number;
76
104
  export declare const resolvePlaceOrderQuoteResult: ({ labels, quoteData, tradeSide, }: ResolvePlaceOrderQuoteResultParams) => PlaceOrderQuoteResult | null;
77
105
  export declare const sanitizePlaceOrderAmount: (value: number) => number;
78
106
  export declare const getTradingRoutePriceLabel: (value: number) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agg-build/ui",
3
- "version": "4.11.1",
3
+ "version": "4.13.2",
4
4
  "description": "Pre-built React component library for the AGG prediction market aggregator. Tailwind-based, themeable, with primitives, event surfaces, trading flows, full pages, and modals.",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -101,7 +101,7 @@
101
101
  "react": "^18.0.0 || ^19.0.0",
102
102
  "react-dom": "^18.0.0 || ^19.0.0",
103
103
  "@agg-build/hooks": "^4.11.0",
104
- "@agg-build/sdk": "^4.11.0"
104
+ "@agg-build/sdk": "^4.13.1"
105
105
  },
106
106
  "dependencies": {
107
107
  "@number-flow/react": "^0.6.0",