@agg-build/ui 4.17.2 → 4.18.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.
Files changed (105) hide show
  1. package/dist/{chunk-7E4UXCEX.mjs → chunk-2OBJ7DYT.mjs} +1227 -534
  2. package/dist/{chunk-RZLM3M5R.mjs → chunk-2UPO6G3S.mjs} +1251 -2578
  3. package/dist/{chunk-3Y2GCNVL.mjs → chunk-FTWJRLJQ.mjs} +753 -3835
  4. package/dist/chunk-HFL3CEWG.mjs +3482 -0
  5. package/dist/{chunk-TK62UB5F.mjs → chunk-JJ3VVCEP.mjs} +6 -13
  6. package/dist/{chunk-B5ALKYD5.mjs → chunk-NRPS2D3Q.mjs} +176 -17
  7. package/dist/{chunk-BBDFSTIA.mjs → chunk-WIGSRHUG.mjs} +1532 -741
  8. package/dist/chunk-WSZYDOZN.mjs +2040 -0
  9. package/dist/{chunk-JI5KV4QI.mjs → chunk-ZNOAKSPT.mjs} +8 -10
  10. package/dist/event-market-GX24AP2H.mjs +21 -0
  11. package/dist/events.js +2960 -1523
  12. package/dist/events.mjs +6 -4
  13. package/dist/index.js +36423 -31013
  14. package/dist/index.mjs +34 -22
  15. package/dist/modals.js +1763 -1456
  16. package/dist/modals.mjs +5 -3
  17. package/dist/pages.js +34153 -28313
  18. package/dist/pages.mjs +17 -8
  19. package/dist/primitives.js +1552 -786
  20. package/dist/primitives.mjs +1 -1
  21. package/dist/styles.css +1 -1
  22. package/dist/tailwind.css +1 -1
  23. package/dist/trading.js +2559 -1499
  24. package/dist/trading.mjs +4 -4
  25. package/dist/types/events/item-details/event-chart-window.d.mts +9 -0
  26. package/dist/types/events/item-details/event-chart-window.d.ts +9 -0
  27. package/dist/types/events/item-details/event-list-item-details.types.d.mts +7 -0
  28. package/dist/types/events/item-details/event-list-item-details.types.d.ts +7 -0
  29. package/dist/types/events/item-details/event-markets-chart.d.mts +12 -0
  30. package/dist/types/events/item-details/event-markets-chart.d.ts +12 -0
  31. package/dist/types/events/item-details/event-markets-chart.utils.d.mts +23 -0
  32. package/dist/types/events/item-details/event-markets-chart.utils.d.ts +23 -0
  33. package/dist/types/events/list/event-list.constants.d.mts +2 -0
  34. package/dist/types/events/list/event-list.constants.d.ts +2 -0
  35. package/dist/types/events/market-details/use-visible-market-streams.d.mts +7 -0
  36. package/dist/types/events/market-details/use-visible-market-streams.d.ts +7 -0
  37. package/dist/types/events/shared/chart-source-caption.d.mts +4 -0
  38. package/dist/types/events/shared/chart-source-caption.d.ts +4 -0
  39. package/dist/types/events/shared/chart-venue-selection.d.mts +11 -0
  40. package/dist/types/events/shared/chart-venue-selection.d.ts +11 -0
  41. package/dist/types/events/shared/use-chart-orderbook.d.mts +23 -0
  42. package/dist/types/events/shared/use-chart-orderbook.d.ts +23 -0
  43. package/dist/types/onboarding/index.d.mts +1 -0
  44. package/dist/types/onboarding/index.d.ts +1 -0
  45. package/dist/types/onboarding/steps/connect-prophetx-modal.d.mts +12 -0
  46. package/dist/types/onboarding/steps/connect-prophetx-modal.d.ts +12 -0
  47. package/dist/types/pages/event-market/event-market.types.d.mts +5 -0
  48. package/dist/types/pages/event-market/event-market.types.d.ts +5 -0
  49. package/dist/types/pages/event-market/event-open-orders.d.mts +50 -0
  50. package/dist/types/pages/event-market/event-open-orders.d.ts +50 -0
  51. package/dist/types/pages/event-market/index.d.mts +3 -0
  52. package/dist/types/pages/event-market/index.d.ts +3 -0
  53. package/dist/types/pages/event-market/sports-event-market-page.d.mts +1 -1
  54. package/dist/types/pages/event-market/sports-event-market-page.d.ts +1 -1
  55. package/dist/types/pages/event-market/use-event-open-orders.d.mts +27 -0
  56. package/dist/types/pages/event-market/use-event-open-orders.d.ts +27 -0
  57. package/dist/types/pages/user-profile/components/available-balance-card.d.mts +2 -0
  58. package/dist/types/pages/user-profile/components/available-balance-card.d.ts +2 -0
  59. package/dist/types/pages/user-profile/components/betdex-account-activity.d.mts +4 -0
  60. package/dist/types/pages/user-profile/components/betdex-account-activity.d.ts +4 -0
  61. package/dist/types/pages/user-profile/components/betdex-account-card.d.mts +2 -0
  62. package/dist/types/pages/user-profile/components/betdex-account-card.d.ts +2 -0
  63. package/dist/types/pages/user-profile/components/betdex-account-transfers.d.mts +7 -0
  64. package/dist/types/pages/user-profile/components/betdex-account-transfers.d.ts +7 -0
  65. package/dist/types/pages/user-profile/components/open-order-row.d.mts +8 -1
  66. package/dist/types/pages/user-profile/components/open-order-row.d.ts +8 -1
  67. package/dist/types/pages/user-profile/cost-basis-display.d.mts +29 -0
  68. package/dist/types/pages/user-profile/cost-basis-display.d.ts +29 -0
  69. package/dist/types/pages/user-profile/user-profile.types.d.mts +5 -0
  70. package/dist/types/pages/user-profile/user-profile.types.d.ts +5 -0
  71. package/dist/types/primitives/chart/chart.constants.d.mts +7 -0
  72. package/dist/types/primitives/chart/chart.constants.d.ts +7 -0
  73. package/dist/types/primitives/chart/chart.types.d.mts +24 -2
  74. package/dist/types/primitives/chart/chart.types.d.ts +24 -2
  75. package/dist/types/primitives/chart/index.d.mts +2 -2
  76. package/dist/types/primitives/chart/index.d.ts +2 -2
  77. package/dist/types/primitives/chart/probability-chart.d.mts +22 -0
  78. package/dist/types/primitives/chart/probability-chart.d.ts +22 -0
  79. package/dist/types/primitives/chart/probability-chart.utils.d.mts +12 -0
  80. package/dist/types/primitives/chart/probability-chart.utils.d.ts +12 -0
  81. package/dist/types/primitives/chart/probability-live-tail.d.mts +16 -0
  82. package/dist/types/primitives/chart/probability-live-tail.d.ts +16 -0
  83. package/dist/types/primitives/remote-image/index.d.mts +1 -1
  84. package/dist/types/primitives/remote-image/index.d.ts +1 -1
  85. package/dist/types/primitives/remote-image/remote-image.types.d.mts +6 -0
  86. package/dist/types/primitives/remote-image/remote-image.types.d.ts +6 -0
  87. package/dist/types/primitives/skeleton/views/event-list-item-skeleton-view.d.mts +6 -0
  88. package/dist/types/primitives/skeleton/views/event-list-item-skeleton-view.d.ts +6 -0
  89. package/dist/types/primitives/venue-logo/svg/logo-betdex.d.mts +12 -0
  90. package/dist/types/primitives/venue-logo/svg/logo-betdex.d.ts +12 -0
  91. package/dist/types/primitives/venue-logo/svg/logo-tiprun.d.mts +7 -0
  92. package/dist/types/primitives/venue-logo/svg/logo-tiprun.d.ts +7 -0
  93. package/dist/types/shared/open-orders.d.mts +63 -0
  94. package/dist/types/shared/open-orders.d.ts +63 -0
  95. package/dist/types/shared/use-open-order-cancellation.d.mts +18 -0
  96. package/dist/types/shared/use-open-order-cancellation.d.ts +18 -0
  97. package/dist/types/trading/manage-betdex-account-modal.d.mts +5 -0
  98. package/dist/types/trading/manage-betdex-account-modal.d.ts +5 -0
  99. package/dist/types/trading/place-order/index.place-order.execution-steps.d.mts +2 -0
  100. package/dist/types/trading/place-order/index.place-order.execution-steps.d.ts +2 -0
  101. package/dist/types/trading/place-order/index.place-order.types.d.mts +5 -0
  102. package/dist/types/trading/place-order/index.place-order.types.d.ts +5 -0
  103. package/dist/types/trading/place-order/index.place-order.utils.d.mts +6 -1
  104. package/dist/types/trading/place-order/index.place-order.utils.d.ts +6 -1
  105. package/package.json +3 -3
@@ -0,0 +1,63 @@
1
+ import type { useExecutionOrders } from "@agg-build/hooks";
2
+ import type { UserProfileOpenOrder } from "../pages/user-profile/user-profile.types";
3
+ /**
4
+ * Shared open-limit-order plumbing. The profile page and the event page render
5
+ * the same resting orders from the same `GET /orders` rows, so selection,
6
+ * pricing and the row mapping live here rather than in either page.
7
+ */
8
+ export type OpenOrderExecutionRow = ReturnType<typeof useExecutionOrders>["orders"][number];
9
+ /** Structural shape of the `useVenueMarketMidpoints` rows this module reads. */
10
+ export interface OpenOrderMidpointRow {
11
+ venueMarketId: string;
12
+ outcomes?: ReadonlyArray<{
13
+ label: string;
14
+ midpoint: number | null;
15
+ }> | null;
16
+ }
17
+ export declare const parseRawMicroValue: (value: string | null | undefined) => number | null;
18
+ export declare const formatScaledNumberTwoDecimals: (value: string | null | undefined) => string;
19
+ export declare const formatFilledUsdTwoDecimals: (filledAmountRaw: string | null | undefined) => string;
20
+ /** `0.216` → `"21.6¢"`. Shared by the limit price and the live mark beneath it
21
+ * so the two lines never disagree on rounding. */
22
+ export declare const formatPriceCentsLabel: (value: number) => string;
23
+ export declare const formatLimitPriceLabel: (value: string | null | undefined) => string | undefined;
24
+ export declare const formatOpenOrderExpirationLabel: ({ timeInForce, expiresAt, goodTilCanceledLabel, expiredLabel, }: {
25
+ timeInForce: string | null | undefined;
26
+ expiresAt: string | Date | null | undefined;
27
+ goodTilCanceledLabel: string;
28
+ expiredLabel: string;
29
+ }) => string | undefined;
30
+ /** `GET /orders` takes one status per call, so an open-orders view fans out. */
31
+ export declare const OPEN_ORDER_QUERY_STATUSES: ("open" | "pending_bridge" | "submitting" | "submitted" | "pending" | "partially_filled_open" | "cancel_pending" | "signing")[];
32
+ export declare const isOpenOrderStatus: (status: string) => boolean;
33
+ export declare const isExecutionLimitOrder: (order: OpenOrderExecutionRow) => boolean;
34
+ /**
35
+ * Flattens the per-status query results into the open limit orders to render:
36
+ * deduped by id (a status refetch can return the same order twice), filtered to
37
+ * resting limit orders, optionally narrowed to a set of markets, newest first.
38
+ *
39
+ * Narrow with `venueMarketIds`, not `venueEventId`, whenever the surface shows a
40
+ * matched cross-venue cluster: one screen's markets span several `VenueEvent`
41
+ * rows (each venue has its own), so an order placed against a sibling venue
42
+ * carries a different `venueEventId` and would be filtered out of the very page
43
+ * it was placed from. `venueEventId` stays for callers that really do mean one
44
+ * venue's event.
45
+ */
46
+ export declare const selectOpenLimitOrders: (orderLists: ReadonlyArray<ReadonlyArray<OpenOrderExecutionRow>>, options?: {
47
+ venueEventId?: string;
48
+ venueMarketIds?: ReadonlyArray<string>;
49
+ }) => OpenOrderExecutionRow[];
50
+ /**
51
+ * orderId → current price label. Matched at the outcome level: a market-level
52
+ * midpoint is the wrong number for anything but the primary side, so an order
53
+ * whose outcome we cannot match is left without a price rather than shown a
54
+ * misleading one.
55
+ */
56
+ export declare const buildOpenOrderCurrentPriceLabels: (orders: ReadonlyArray<OpenOrderExecutionRow>, midpointRows: ReadonlyArray<OpenOrderMidpointRow>) => Map<string, string>;
57
+ export declare const OPEN_ORDER_FALLBACK_THUMBNAIL_SRC = "data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"60\" height=\"60\"><rect width=\"100%\" height=\"100%\" fill=\"%23f4f4f7\"/></svg>";
58
+ export declare const mapExecutionOrderToOpenOrder: (order: OpenOrderExecutionRow, { goodTilCanceledLabel, expiredLabel, currentPriceLabel, fallbackThumbnailSrc, }: {
59
+ goodTilCanceledLabel: string;
60
+ expiredLabel: string;
61
+ currentPriceLabel?: string;
62
+ fallbackThumbnailSrc?: string;
63
+ }) => UserProfileOpenOrder;
@@ -0,0 +1,18 @@
1
+ import type { UserProfileOpenOrder } from "../pages/user-profile/user-profile.types";
2
+ export interface UseOpenOrderCancellationOptions {
3
+ /**
4
+ * Consumer-owned cancel flow. When supplied it fully replaces the built-in
5
+ * mutation — the caller is then responsible for its own pending state.
6
+ */
7
+ onCancelOrder?: (order: UserProfileOpenOrder) => void;
8
+ }
9
+ export interface UseOpenOrderCancellationResult {
10
+ /** Order ids with a cancel in flight. */
11
+ cancellingOrderIds: Record<string, boolean>;
12
+ cancelOrder: (order: UserProfileOpenOrder) => Promise<void>;
13
+ }
14
+ /**
15
+ * Cancels a resting limit order and reports the outcome as a toast. Shared by
16
+ * the profile table and the event page card so both surfaces behave the same.
17
+ */
18
+ export declare const useOpenOrderCancellation: ({ onCancelOrder, }?: UseOpenOrderCancellationOptions) => UseOpenOrderCancellationResult;
@@ -0,0 +1,18 @@
1
+ import type { UserProfileOpenOrder } from "../pages/user-profile/user-profile.types";
2
+ export interface UseOpenOrderCancellationOptions {
3
+ /**
4
+ * Consumer-owned cancel flow. When supplied it fully replaces the built-in
5
+ * mutation — the caller is then responsible for its own pending state.
6
+ */
7
+ onCancelOrder?: (order: UserProfileOpenOrder) => void;
8
+ }
9
+ export interface UseOpenOrderCancellationResult {
10
+ /** Order ids with a cancel in flight. */
11
+ cancellingOrderIds: Record<string, boolean>;
12
+ cancelOrder: (order: UserProfileOpenOrder) => Promise<void>;
13
+ }
14
+ /**
15
+ * Cancels a resting limit order and reports the outcome as a toast. Shared by
16
+ * the profile table and the event page card so both surfaces behave the same.
17
+ */
18
+ export declare const useOpenOrderCancellation: ({ onCancelOrder, }?: UseOpenOrderCancellationOptions) => UseOpenOrderCancellationResult;
@@ -0,0 +1,5 @@
1
+ /** Reuse the account controls without treating hosted cash as wallet cash. */
2
+ export declare function ManageBetdexAccountModal({ open, onOpenChange, }: {
3
+ open: boolean;
4
+ onOpenChange: (open: boolean) => void;
5
+ }): JSX.Element;
@@ -0,0 +1,5 @@
1
+ /** Reuse the account controls without treating hosted cash as wallet cash. */
2
+ export declare function ManageBetdexAccountModal({ open, onOpenChange, }: {
3
+ open: boolean;
4
+ onOpenChange: (open: boolean) => void;
5
+ }): JSX.Element;
@@ -15,6 +15,8 @@ export type ExecutionOrderGroup = {
15
15
  id: string;
16
16
  venue?: TradingVenue;
17
17
  venueLabel: string;
18
+ /** Replaces the default "<venue> order" heading. */
19
+ title?: string;
18
20
  priceLabel: string;
19
21
  amountLabel: string;
20
22
  steps: ExecutionStep[];
@@ -15,6 +15,8 @@ export type ExecutionOrderGroup = {
15
15
  id: string;
16
16
  venue?: TradingVenue;
17
17
  venueLabel: string;
18
+ /** Replaces the default "<venue> order" heading. */
19
+ title?: string;
18
20
  priceLabel: string;
19
21
  amountLabel: string;
20
22
  steps: ExecutionStep[];
@@ -264,6 +264,9 @@ export type PlaceOrderQuoteStatus = PlaceOrderStatus | undefined;
264
264
  export type PlaceOrderSubmissionProgressPhase = "finding-route" | "submitting" | "executing" | "success" | "failed";
265
265
  export type PlaceOrderExecutionSummary = {
266
266
  resultState?: "success" | "partial";
267
+ /** A limit order rests on the book, so success shows the order amount at its limit price instead of a fill. */
268
+ orderType?: "market" | "limit";
269
+ limitPriceLabel?: string;
267
270
  tradeSide?: PlaceOrderTab;
268
271
  shares: string;
269
272
  avgPrice: string;
@@ -292,4 +295,6 @@ export type PlaceOrderSubmissionProgressState = {
292
295
  phase: PlaceOrderSubmissionProgressPhase;
293
296
  summary?: PlaceOrderExecutionSummary;
294
297
  dagProgress?: DagStepProgress | null;
298
+ /** The single venue row shown while a limit order submits, and kept on failure. */
299
+ limitOrderGroup?: ExecutionOrderGroup;
295
300
  };
@@ -264,6 +264,9 @@ export type PlaceOrderQuoteStatus = PlaceOrderStatus | undefined;
264
264
  export type PlaceOrderSubmissionProgressPhase = "finding-route" | "submitting" | "executing" | "success" | "failed";
265
265
  export type PlaceOrderExecutionSummary = {
266
266
  resultState?: "success" | "partial";
267
+ /** A limit order rests on the book, so success shows the order amount at its limit price instead of a fill. */
268
+ orderType?: "market" | "limit";
269
+ limitPriceLabel?: string;
267
270
  tradeSide?: PlaceOrderTab;
268
271
  shares: string;
269
272
  avgPrice: string;
@@ -292,4 +295,6 @@ export type PlaceOrderSubmissionProgressState = {
292
295
  phase: PlaceOrderSubmissionProgressPhase;
293
296
  summary?: PlaceOrderExecutionSummary;
294
297
  dagProgress?: DagStepProgress | null;
298
+ /** The single venue row shown while a limit order submits, and kept on failure. */
299
+ limitOrderGroup?: ExecutionOrderGroup;
295
300
  };
@@ -1,7 +1,11 @@
1
1
  import type { VenueMarket, VenueSellQuoteRequest } from "@agg-build/hooks";
2
- import type { SmartRouteResponse, WsOrderSubmitted } from "@agg-build/sdk";
2
+ import type { AggClient, SmartRouteResponse, WsOrderSubmitted } from "@agg-build/sdk";
3
3
  import { type PlaceOrderOutcome, type PlaceOrderRoutingRow, type PlaceOrderTab, type TradingVenue } from "../types";
4
4
  import type { BuildLiveRouteCardsParams, PlaceOrderOutcomeClassNameParams, PlaceOrderExecutionStepGroup, PlaceOrderFailureStep, PlaceOrderFailureSummary, PlaceOrderOutcomeLabelValue, PlaceOrderLimitVenueOption, PlaceOrderQuoteResult, PlaceOrderQuoteStatus, PlaceOrderResultTone, PlaceOrderRouteCard, PlaceOrderTerminalOrderEvent, PlaceOrderTradingLabels, PlaceOrderVenueOutcome, ResolvePlaceOrderQuoteResultParams, ResolvePlaceOrderQuoteStatusParams, ResolvePlaceOrderTabKeyParams } from "./index.place-order.types";
5
+ /** Quote identity follows spendable funds and reservations, not the clock of an
6
+ * unchanged five-second balance poll. Keep full source identity and raw strings;
7
+ * stale availability changes still invalidate, and server admission remains fresh. */
8
+ export declare const getPlaceOrderBalanceCacheKey: (balances: Awaited<ReturnType<AggClient["getManagedBalances"]>>) => string;
5
9
  export declare const getPlaceOrderAverageExecutionPrice: (quoteData: SmartRouteResponse | null | undefined) => number | null;
6
10
  export declare const isPlaceOrderAveragePriceWorse: ({ averageExecutionPrice, displayedMarketPrice, tradeSide, }: {
7
11
  averageExecutionPrice: number | null | undefined;
@@ -20,6 +24,7 @@ export interface SellablePositionGroup {
20
24
  venue: string;
21
25
  venueMarketId: string;
22
26
  size: number;
27
+ executionBackend?: "clearinghouse" | "direct";
23
28
  }[];
24
29
  }[];
25
30
  };
@@ -1,7 +1,11 @@
1
1
  import type { VenueMarket, VenueSellQuoteRequest } from "@agg-build/hooks";
2
- import type { SmartRouteResponse, WsOrderSubmitted } from "@agg-build/sdk";
2
+ import type { AggClient, SmartRouteResponse, WsOrderSubmitted } from "@agg-build/sdk";
3
3
  import { type PlaceOrderOutcome, type PlaceOrderRoutingRow, type PlaceOrderTab, type TradingVenue } from "../types";
4
4
  import type { BuildLiveRouteCardsParams, PlaceOrderOutcomeClassNameParams, PlaceOrderExecutionStepGroup, PlaceOrderFailureStep, PlaceOrderFailureSummary, PlaceOrderOutcomeLabelValue, PlaceOrderLimitVenueOption, PlaceOrderQuoteResult, PlaceOrderQuoteStatus, PlaceOrderResultTone, PlaceOrderRouteCard, PlaceOrderTerminalOrderEvent, PlaceOrderTradingLabels, PlaceOrderVenueOutcome, ResolvePlaceOrderQuoteResultParams, ResolvePlaceOrderQuoteStatusParams, ResolvePlaceOrderTabKeyParams } from "./index.place-order.types";
5
+ /** Quote identity follows spendable funds and reservations, not the clock of an
6
+ * unchanged five-second balance poll. Keep full source identity and raw strings;
7
+ * stale availability changes still invalidate, and server admission remains fresh. */
8
+ export declare const getPlaceOrderBalanceCacheKey: (balances: Awaited<ReturnType<AggClient["getManagedBalances"]>>) => string;
5
9
  export declare const getPlaceOrderAverageExecutionPrice: (quoteData: SmartRouteResponse | null | undefined) => number | null;
6
10
  export declare const isPlaceOrderAveragePriceWorse: ({ averageExecutionPrice, displayedMarketPrice, tradeSide, }: {
7
11
  averageExecutionPrice: number | null | undefined;
@@ -20,6 +24,7 @@ export interface SellablePositionGroup {
20
24
  venue: string;
21
25
  venueMarketId: string;
22
26
  size: number;
27
+ executionBackend?: "clearinghouse" | "direct";
23
28
  }[];
24
29
  }[];
25
30
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agg-build/ui",
3
- "version": "4.17.2",
3
+ "version": "4.18.0",
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",
@@ -100,8 +100,8 @@
100
100
  "liveline": "^0.0.7",
101
101
  "react": "^18.0.0 || ^19.0.0",
102
102
  "react-dom": "^18.0.0 || ^19.0.0",
103
- "@agg-build/hooks": "^4.17.2",
104
- "@agg-build/sdk": "^4.17.1"
103
+ "@agg-build/hooks": "^4.18.0",
104
+ "@agg-build/sdk": "^4.18.0"
105
105
  },
106
106
  "dependencies": {
107
107
  "@number-flow/react": "^0.6.0",