@agg-build/ui 4.0.0 → 4.4.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 (70) hide show
  1. package/README.md +21 -16
  2. package/dist/{chunk-XIDQ2A6W.mjs → chunk-64BBTXFE.mjs} +1639 -909
  3. package/dist/{chunk-VR5ZRDQT.mjs → chunk-6STRIKUA.mjs} +1 -1
  4. package/dist/{chunk-KX3TQ7WC.mjs → chunk-734VTGCV.mjs} +1 -1
  5. package/dist/{chunk-KO6VTRV6.mjs → chunk-N7UPPT5J.mjs} +336 -232
  6. package/dist/{chunk-JTSLZARU.mjs → chunk-UCU2XCV5.mjs} +2 -2
  7. package/dist/{chunk-MKU5Q6PN.mjs → chunk-V5CRUO6S.mjs} +653 -379
  8. package/dist/{chunk-R362GNI2.mjs → chunk-WW5QKNIM.mjs} +278 -146
  9. package/dist/events.js +1241 -754
  10. package/dist/events.mjs +6 -4
  11. package/dist/index.js +4919 -3694
  12. package/dist/index.mjs +20 -8
  13. package/dist/modals.js +1321 -1260
  14. package/dist/modals.mjs +3 -3
  15. package/dist/pages.js +4271 -3054
  16. package/dist/pages.mjs +10 -6
  17. package/dist/primitives.js +346 -265
  18. package/dist/primitives.mjs +1 -1
  19. package/dist/styles.css +1 -1
  20. package/dist/tailwind.css +1 -1
  21. package/dist/trading.js +2281 -1499
  22. package/dist/trading.mjs +10 -4
  23. package/dist/types/events/index.d.mts +1 -0
  24. package/dist/types/events/index.d.ts +1 -0
  25. package/dist/types/events/item-details/event-list-item-details-market-selector.d.mts +4 -1
  26. package/dist/types/events/item-details/event-list-item-details-market-selector.d.ts +4 -1
  27. package/dist/types/events/item-details/event-list-item-details.types.d.mts +25 -1
  28. package/dist/types/events/item-details/event-list-item-details.types.d.ts +25 -1
  29. package/dist/types/events/item-details/index.d.mts +1 -1
  30. package/dist/types/events/item-details/index.d.ts +1 -1
  31. package/dist/types/events/market-details/index.d.mts +1 -1
  32. package/dist/types/events/market-details/index.d.ts +1 -1
  33. package/dist/types/events/market-details/market-details.types.d.mts +4 -0
  34. package/dist/types/events/market-details/market-details.types.d.ts +4 -0
  35. package/dist/types/events/shared/format-event-title.d.mts +9 -1
  36. package/dist/types/events/shared/format-event-title.d.ts +9 -1
  37. package/dist/types/events/shared/format-sports-event-time.d.mts +2 -0
  38. package/dist/types/events/shared/format-sports-event-time.d.ts +2 -0
  39. package/dist/types/events/shared/sports-live-score.d.mts +10 -0
  40. package/dist/types/events/shared/sports-live-score.d.ts +10 -0
  41. package/dist/types/pages/event-market/event-market.types.d.mts +4 -0
  42. package/dist/types/pages/event-market/event-market.types.d.ts +4 -0
  43. package/dist/types/pages/event-market/index.d.mts +1 -0
  44. package/dist/types/pages/event-market/index.d.ts +1 -0
  45. package/dist/types/pages/user-profile/components/available-balance-card.d.mts +5 -0
  46. package/dist/types/pages/user-profile/components/available-balance-card.d.ts +5 -0
  47. package/dist/types/pages/user-profile/components/open-order-row.d.mts +1 -0
  48. package/dist/types/pages/user-profile/components/open-order-row.d.ts +1 -0
  49. package/dist/types/pages/user-profile/components/positions-activity.d.mts +1 -1
  50. package/dist/types/pages/user-profile/components/positions-activity.d.ts +1 -1
  51. package/dist/types/pages/user-profile/index.d.mts +1 -0
  52. package/dist/types/pages/user-profile/index.d.ts +1 -0
  53. package/dist/types/pages/user-profile/user-profile.types.d.mts +1 -1
  54. package/dist/types/pages/user-profile/user-profile.types.d.ts +1 -1
  55. package/dist/types/primitives/venue-logo/svg/logo-novig.d.mts +24 -0
  56. package/dist/types/primitives/venue-logo/svg/logo-novig.d.ts +24 -0
  57. package/dist/types/primitives/venue-logo/venue-logo.constants.d.mts +1 -1
  58. package/dist/types/primitives/venue-logo/venue-logo.constants.d.ts +1 -1
  59. package/dist/types/trading/place-order/index.d.mts +4 -1
  60. package/dist/types/trading/place-order/index.d.ts +4 -1
  61. package/dist/types/trading/place-order/index.place-order.execution-steps.d.mts +38 -73
  62. package/dist/types/trading/place-order/index.place-order.execution-steps.d.ts +38 -73
  63. package/dist/types/trading/place-order/index.place-order.execution-view.d.mts +26 -0
  64. package/dist/types/trading/place-order/index.place-order.execution-view.d.ts +26 -0
  65. package/dist/types/trading/place-order/index.place-order.types.d.mts +15 -0
  66. package/dist/types/trading/place-order/index.place-order.types.d.ts +15 -0
  67. package/dist/types/trading/place-order/index.place-order.utils.d.mts +14 -1
  68. package/dist/types/trading/place-order/index.place-order.utils.d.ts +14 -1
  69. package/package.json +3 -3
  70. /package/dist/{chunk-KHHFHXXD.mjs → chunk-JH4B3ZHQ.mjs} +0 -0
@@ -1,81 +1,46 @@
1
- import type { DagStepProgress } from "@agg-build/hooks";
2
- import type { TradingVenue } from "../types";
3
- import type { PlaceOrderSubmissionProgressPhase, PlaceOrderTradingLabels } from "./index.place-order.types";
4
- /**
5
- * Stable, user-facing phases for the in-flight Place Order submission UI.
6
- *
7
- * The DAG executor emits many granular step types (`bridge-fetch-quote`,
8
- * `polymarket-setup-resolve-need`, `submit-verify-order-status`, etc.) that
9
- * are an implementation detail of how a route is fulfilled. Surfacing them
10
- * directly produces noisy, confusing progress and leaks internal architecture
11
- * to partners. We collapse every raw step into one of a small, fixed set of
12
- * normalized phases here, then drive rendering off the normalized model.
13
- *
14
- * Anything not in this list (bridge, ata, approve, swap, transfer, position,
15
- * polymarket-setup, hl-fund, wait sentinels) maps to either `checking-balance`
16
- * (read-only probes) or `submitting`.
17
- */
18
- export type NormalizedExecutionPhaseKind = "finding-route" | "checking-balance" | "submitting" | "wallet-confirm" | "executing-venue" | "filled" | "failed";
19
- export type NormalizedExecutionPhase = {
20
- kind: NormalizedExecutionPhaseKind;
21
- /** Set when the phase is venue-scoped — `executing-venue` and finalize legs. */
22
- venue?: TradingVenue;
1
+ import type { ExecutionRawStepProgress, ExecutionTerminalOrderEvent } from "@agg-build/hooks";
2
+ import type { ExecutionStatusOrder, ExecutionStatusStep, SmartRouteResponse } from "@agg-build/sdk";
3
+ import { type PlaceOrderTab, type TradingVenue } from "../types";
4
+ import type { PlaceOrderTradingLabels } from "./index.place-order.types";
5
+ export type ExecutionStepStatus = "not-started" | "loading" | "done" | "warning" | "failed";
6
+ export type ExecutionStepKind = "submit" | "setup" | "bridge" | "fill";
7
+ export type ExecutionStep = {
8
+ id: string;
9
+ kind: ExecutionStepKind;
10
+ pendingLabel: string;
11
+ completedLabel: string;
12
+ status: ExecutionStepStatus;
23
13
  };
24
- export type SubmissionDisplayRow = {
14
+ export type ExecutionOrderGroup = {
25
15
  id: string;
26
- label: string;
27
- status: "pending" | "complete";
28
16
  venue?: TradingVenue;
17
+ venueLabel: string;
18
+ priceLabel: string;
19
+ amountLabel: string;
20
+ steps: ExecutionStep[];
29
21
  };
30
- /**
31
- * Classify a raw DAG step type into the normalized phase it represents.
32
- *
33
- * Returns `null` for wait sentinels and unrecognized step types — the caller
34
- * should skip these so they don't introduce a fake "Wait" or `Step N of M`
35
- * row in the UI.
36
- */
37
- export declare const classifyExecutionStepType: (stepType: string) => NormalizedExecutionPhase | null;
38
- type PhaseTimelineEntry = NormalizedExecutionPhase & {
39
- firstSeq: number;
40
- lastSeq: number;
41
- allCompleted: boolean;
42
- };
43
- /**
44
- * Walk the DAG sequences in order, classify each, and merge consecutive
45
- * entries that share the same kind+venue. The result is the
46
- * presentation-layer timeline of high-level phases.
47
- *
48
- * A merged entry is `allCompleted` only when every underlying sequence has
49
- * finished — so a single in-flight `bridge-submit` keeps the merged
50
- * "submitting" row pending even if `bridge-fetch-quote` already completed.
51
- *
52
- * Post-pass: the DAG only emits `step_completed` for a subset of sequences
53
- * (record-state steps, position-reserve, etc.) — sub-steps like
54
- * `polymarket-deposit-wallet-submit` and `wait` never report completion
55
- * individually. That means a merged "submitting" block can stay
56
- * `allCompleted=false` forever even after the executor has moved on to a
57
- * later block. To preserve the "only the last visible row is pending"
58
- * invariant, force-complete any block that has any later block with at
59
- * least one completed sequence.
60
- */
61
- export declare const buildPhaseTimeline: (dag: DagStepProgress) => PhaseTimelineEntry[];
62
- export type BuildSubmissionDisplayRowsArgs = {
63
- phase: PlaceOrderSubmissionProgressPhase;
64
- dagProgress: DagStepProgress | null | undefined;
65
- executionVenue?: TradingVenue;
66
- /** Whether the active submitting beat is waiting on a wallet signature. */
67
- isAwaitingWalletConfirmation?: boolean;
22
+ export type DeriveExecutionOrderGroupsArgs = {
23
+ quoteData: SmartRouteResponse;
68
24
  labels: PlaceOrderTradingLabels;
25
+ tradeSide: PlaceOrderTab;
26
+ hasSubmissionResponse: boolean;
27
+ executionSteps?: ExecutionStatusStep[];
28
+ executionOrders?: ExecutionStatusOrder[];
29
+ rawExecutionSteps?: ExecutionRawStepProgress[];
30
+ terminalOrderEvents?: ExecutionTerminalOrderEvent[];
31
+ forceCompleted?: boolean;
32
+ };
33
+ export declare const deriveExecutionOrderGroups: ({ quoteData, labels, tradeSide, hasSubmissionResponse, executionSteps, executionOrders, rawExecutionSteps, terminalOrderEvents, forceCompleted, }: DeriveExecutionOrderGroupsArgs) => ExecutionOrderGroup[];
34
+ export declare const flattenExecutionSteps: (groups: ExecutionOrderGroup[]) => ExecutionStep[];
35
+ export type CalculateExecutionProgressArgs = {
36
+ orderIds: string[];
37
+ submittedOrderIds?: string[];
38
+ executionSteps?: ExecutionStatusStep[];
39
+ executionOrders?: ExecutionStatusOrder[];
40
+ minimumProgress?: number;
69
41
  };
70
42
  /**
71
- * Produce the rows the in-flight Place Order surface should render.
72
- *
73
- * Invariants:
74
- * - At most one row has status `pending`.
75
- * - Completed rows are kept only when they correspond to a meaningful
76
- * user-facing milestone (the normalized phases above).
77
- * - The same kind+venue never appears twice — repeated `step_started` /
78
- * `step_waiting` events on the same phase don't duplicate rows.
43
+ * Fixed-weight execution progress from canonical backend milestones.
44
+ * Display-only substeps can grow without changing the 20/20/20/40 denominator.
79
45
  */
80
- export declare const buildSubmissionDisplayRows: ({ phase, dagProgress, executionVenue, isAwaitingWalletConfirmation, labels, }: BuildSubmissionDisplayRowsArgs) => SubmissionDisplayRow[];
81
- export {};
46
+ export declare const calculateExecutionProgress: ({ orderIds, submittedOrderIds, executionSteps, executionOrders, minimumProgress, }: CalculateExecutionProgressArgs) => number;
@@ -1,81 +1,46 @@
1
- import type { DagStepProgress } from "@agg-build/hooks";
2
- import type { TradingVenue } from "../types";
3
- import type { PlaceOrderSubmissionProgressPhase, PlaceOrderTradingLabels } from "./index.place-order.types";
4
- /**
5
- * Stable, user-facing phases for the in-flight Place Order submission UI.
6
- *
7
- * The DAG executor emits many granular step types (`bridge-fetch-quote`,
8
- * `polymarket-setup-resolve-need`, `submit-verify-order-status`, etc.) that
9
- * are an implementation detail of how a route is fulfilled. Surfacing them
10
- * directly produces noisy, confusing progress and leaks internal architecture
11
- * to partners. We collapse every raw step into one of a small, fixed set of
12
- * normalized phases here, then drive rendering off the normalized model.
13
- *
14
- * Anything not in this list (bridge, ata, approve, swap, transfer, position,
15
- * polymarket-setup, hl-fund, wait sentinels) maps to either `checking-balance`
16
- * (read-only probes) or `submitting`.
17
- */
18
- export type NormalizedExecutionPhaseKind = "finding-route" | "checking-balance" | "submitting" | "wallet-confirm" | "executing-venue" | "filled" | "failed";
19
- export type NormalizedExecutionPhase = {
20
- kind: NormalizedExecutionPhaseKind;
21
- /** Set when the phase is venue-scoped — `executing-venue` and finalize legs. */
22
- venue?: TradingVenue;
1
+ import type { ExecutionRawStepProgress, ExecutionTerminalOrderEvent } from "@agg-build/hooks";
2
+ import type { ExecutionStatusOrder, ExecutionStatusStep, SmartRouteResponse } from "@agg-build/sdk";
3
+ import { type PlaceOrderTab, type TradingVenue } from "../types";
4
+ import type { PlaceOrderTradingLabels } from "./index.place-order.types";
5
+ export type ExecutionStepStatus = "not-started" | "loading" | "done" | "warning" | "failed";
6
+ export type ExecutionStepKind = "submit" | "setup" | "bridge" | "fill";
7
+ export type ExecutionStep = {
8
+ id: string;
9
+ kind: ExecutionStepKind;
10
+ pendingLabel: string;
11
+ completedLabel: string;
12
+ status: ExecutionStepStatus;
23
13
  };
24
- export type SubmissionDisplayRow = {
14
+ export type ExecutionOrderGroup = {
25
15
  id: string;
26
- label: string;
27
- status: "pending" | "complete";
28
16
  venue?: TradingVenue;
17
+ venueLabel: string;
18
+ priceLabel: string;
19
+ amountLabel: string;
20
+ steps: ExecutionStep[];
29
21
  };
30
- /**
31
- * Classify a raw DAG step type into the normalized phase it represents.
32
- *
33
- * Returns `null` for wait sentinels and unrecognized step types — the caller
34
- * should skip these so they don't introduce a fake "Wait" or `Step N of M`
35
- * row in the UI.
36
- */
37
- export declare const classifyExecutionStepType: (stepType: string) => NormalizedExecutionPhase | null;
38
- type PhaseTimelineEntry = NormalizedExecutionPhase & {
39
- firstSeq: number;
40
- lastSeq: number;
41
- allCompleted: boolean;
42
- };
43
- /**
44
- * Walk the DAG sequences in order, classify each, and merge consecutive
45
- * entries that share the same kind+venue. The result is the
46
- * presentation-layer timeline of high-level phases.
47
- *
48
- * A merged entry is `allCompleted` only when every underlying sequence has
49
- * finished — so a single in-flight `bridge-submit` keeps the merged
50
- * "submitting" row pending even if `bridge-fetch-quote` already completed.
51
- *
52
- * Post-pass: the DAG only emits `step_completed` for a subset of sequences
53
- * (record-state steps, position-reserve, etc.) — sub-steps like
54
- * `polymarket-deposit-wallet-submit` and `wait` never report completion
55
- * individually. That means a merged "submitting" block can stay
56
- * `allCompleted=false` forever even after the executor has moved on to a
57
- * later block. To preserve the "only the last visible row is pending"
58
- * invariant, force-complete any block that has any later block with at
59
- * least one completed sequence.
60
- */
61
- export declare const buildPhaseTimeline: (dag: DagStepProgress) => PhaseTimelineEntry[];
62
- export type BuildSubmissionDisplayRowsArgs = {
63
- phase: PlaceOrderSubmissionProgressPhase;
64
- dagProgress: DagStepProgress | null | undefined;
65
- executionVenue?: TradingVenue;
66
- /** Whether the active submitting beat is waiting on a wallet signature. */
67
- isAwaitingWalletConfirmation?: boolean;
22
+ export type DeriveExecutionOrderGroupsArgs = {
23
+ quoteData: SmartRouteResponse;
68
24
  labels: PlaceOrderTradingLabels;
25
+ tradeSide: PlaceOrderTab;
26
+ hasSubmissionResponse: boolean;
27
+ executionSteps?: ExecutionStatusStep[];
28
+ executionOrders?: ExecutionStatusOrder[];
29
+ rawExecutionSteps?: ExecutionRawStepProgress[];
30
+ terminalOrderEvents?: ExecutionTerminalOrderEvent[];
31
+ forceCompleted?: boolean;
32
+ };
33
+ export declare const deriveExecutionOrderGroups: ({ quoteData, labels, tradeSide, hasSubmissionResponse, executionSteps, executionOrders, rawExecutionSteps, terminalOrderEvents, forceCompleted, }: DeriveExecutionOrderGroupsArgs) => ExecutionOrderGroup[];
34
+ export declare const flattenExecutionSteps: (groups: ExecutionOrderGroup[]) => ExecutionStep[];
35
+ export type CalculateExecutionProgressArgs = {
36
+ orderIds: string[];
37
+ submittedOrderIds?: string[];
38
+ executionSteps?: ExecutionStatusStep[];
39
+ executionOrders?: ExecutionStatusOrder[];
40
+ minimumProgress?: number;
69
41
  };
70
42
  /**
71
- * Produce the rows the in-flight Place Order surface should render.
72
- *
73
- * Invariants:
74
- * - At most one row has status `pending`.
75
- * - Completed rows are kept only when they correspond to a meaningful
76
- * user-facing milestone (the normalized phases above).
77
- * - The same kind+venue never appears twice — repeated `step_started` /
78
- * `step_waiting` events on the same phase don't duplicate rows.
43
+ * Fixed-weight execution progress from canonical backend milestones.
44
+ * Display-only substeps can grow without changing the 20/20/20/40 denominator.
79
45
  */
80
- export declare const buildSubmissionDisplayRows: ({ phase, dagProgress, executionVenue, isAwaitingWalletConfirmation, labels, }: BuildSubmissionDisplayRowsArgs) => SubmissionDisplayRow[];
81
- export {};
46
+ export declare const calculateExecutionProgress: ({ orderIds, submittedOrderIds, executionSteps, executionOrders, minimumProgress, }: CalculateExecutionProgressArgs) => number;
@@ -0,0 +1,26 @@
1
+ import type { ExecutionOrderGroup } from "./index.place-order.execution-steps";
2
+ import type { PlaceOrderClassNames, PlaceOrderTradingLabels } from "./index.place-order.types";
3
+ export type PlaceOrderExecutionHeaderProps = {
4
+ className?: string;
5
+ eventDateLabel?: string | null;
6
+ eventImage?: string | null;
7
+ eventTitle: string;
8
+ };
9
+ export declare const PlaceOrderExecutionHeader: ({ className, eventDateLabel, eventImage, eventTitle, }: PlaceOrderExecutionHeaderProps) => JSX.Element;
10
+ export declare const PlaceOrderExecutionGroups: ({ enableAnimations, groups, labels, }: {
11
+ enableAnimations: boolean;
12
+ groups: ExecutionOrderGroup[];
13
+ labels: PlaceOrderTradingLabels;
14
+ }) => JSX.Element;
15
+ export type PlaceOrderExecutionViewProps = PlaceOrderExecutionHeaderProps & {
16
+ className?: string;
17
+ classNames?: PlaceOrderClassNames;
18
+ enableAnimations: boolean;
19
+ groups: ExecutionOrderGroup[];
20
+ labels: PlaceOrderTradingLabels;
21
+ progress: number;
22
+ };
23
+ export declare const PlaceOrderExecutionView: {
24
+ ({ className, classNames, enableAnimations, eventDateLabel, eventImage, eventTitle, groups, labels, progress, }: PlaceOrderExecutionViewProps): JSX.Element;
25
+ displayName: string;
26
+ };
@@ -0,0 +1,26 @@
1
+ import type { ExecutionOrderGroup } from "./index.place-order.execution-steps";
2
+ import type { PlaceOrderClassNames, PlaceOrderTradingLabels } from "./index.place-order.types";
3
+ export type PlaceOrderExecutionHeaderProps = {
4
+ className?: string;
5
+ eventDateLabel?: string | null;
6
+ eventImage?: string | null;
7
+ eventTitle: string;
8
+ };
9
+ export declare const PlaceOrderExecutionHeader: ({ className, eventDateLabel, eventImage, eventTitle, }: PlaceOrderExecutionHeaderProps) => JSX.Element;
10
+ export declare const PlaceOrderExecutionGroups: ({ enableAnimations, groups, labels, }: {
11
+ enableAnimations: boolean;
12
+ groups: ExecutionOrderGroup[];
13
+ labels: PlaceOrderTradingLabels;
14
+ }) => JSX.Element;
15
+ export type PlaceOrderExecutionViewProps = PlaceOrderExecutionHeaderProps & {
16
+ className?: string;
17
+ classNames?: PlaceOrderClassNames;
18
+ enableAnimations: boolean;
19
+ groups: ExecutionOrderGroup[];
20
+ labels: PlaceOrderTradingLabels;
21
+ progress: number;
22
+ };
23
+ export declare const PlaceOrderExecutionView: {
24
+ ({ className, classNames, enableAnimations, eventDateLabel, eventImage, eventTitle, groups, labels, progress, }: PlaceOrderExecutionViewProps): JSX.Element;
25
+ displayName: string;
26
+ };
@@ -2,6 +2,7 @@ import type { AggUiLabels, DagStepProgress, EventTradingState, UseMidpointsResul
2
2
  import type { ExecutionMode, PlaceLimitOrderParams, SmartRouteResponse } from "@agg-build/sdk";
3
3
  import type { KalshiCredentials } from "../../onboarding/onboarding-modal.types";
4
4
  import type { PlaceOrderRoutingRow, PlaceOrderStatus, PlaceOrderTab, TradingVenue } from "../types";
5
+ import type { ExecutionOrderGroup } from "./index.place-order.execution-steps";
5
6
  export type PlaceOrderProps = {
6
7
  /** Custom class name applied to the place-order root. */
7
8
  className?: string;
@@ -80,6 +81,8 @@ export type PlaceOrderProps = {
80
81
  onExecutionStateChange?: (state: PlaceOrderSubmissionProgressState) => void;
81
82
  /** Optional resolved-event claim summary shown in read-only state. */
82
83
  resolvedClaim?: PlaceOrderResolvedClaimSummary;
84
+ /** Render the settlement-pending state for a closed recurring market. */
85
+ showResolvingState?: boolean;
83
86
  /** Pre-fetched midpoint data (best price included) passed from parent. Optional for backward compatibility. */
84
87
  midpointsResult?: UseMidpointsResult;
85
88
  };
@@ -209,6 +212,14 @@ export type PlaceOrderFailureSummary = {
209
212
  eventSubtitle?: string;
210
213
  eventTitle: string;
211
214
  kind: PlaceOrderFailureKind;
215
+ /** Failed venue to pin when retrying the unfilled remainder of a split route. */
216
+ retryVenue?: TradingVenue;
217
+ executionGroups?: ExecutionOrderGroup[];
218
+ result?: {
219
+ averagePriceLabel: string;
220
+ filledAmountLabel: string;
221
+ payoutLabel: string;
222
+ };
212
223
  steps: PlaceOrderFailureStep[];
213
224
  };
214
225
  export type ResolvePlaceOrderQuoteResultParams = {
@@ -236,6 +247,7 @@ export type ResolvePlaceOrderTabKeyParams = {
236
247
  export type PlaceOrderQuoteStatus = PlaceOrderStatus | undefined;
237
248
  export type PlaceOrderSubmissionProgressPhase = "finding-route" | "submitting" | "executing" | "success" | "failed";
238
249
  export type PlaceOrderExecutionSummary = {
250
+ resultState?: "success" | "partial";
239
251
  tradeSide?: PlaceOrderTab;
240
252
  shares: string;
241
253
  avgPrice: string;
@@ -248,6 +260,8 @@ export type PlaceOrderExecutionSummary = {
248
260
  amountLabel?: string;
249
261
  toWinLabel?: string;
250
262
  potentialReturnLabel?: string;
263
+ requestedAmountLabel?: string;
264
+ executionGroups?: ExecutionOrderGroup[];
251
265
  executionStepGroups?: PlaceOrderExecutionStepGroup[];
252
266
  shareText?: string;
253
267
  };
@@ -258,6 +272,7 @@ export type PlaceOrderSubmissionProgressState = {
258
272
  orderId?: string;
259
273
  orderIds?: string[];
260
274
  quoteId?: string;
275
+ quoteData?: SmartRouteResponse;
261
276
  phase: PlaceOrderSubmissionProgressPhase;
262
277
  summary?: PlaceOrderExecutionSummary;
263
278
  dagProgress?: DagStepProgress | null;
@@ -2,6 +2,7 @@ import type { AggUiLabels, DagStepProgress, EventTradingState, UseMidpointsResul
2
2
  import type { ExecutionMode, PlaceLimitOrderParams, SmartRouteResponse } from "@agg-build/sdk";
3
3
  import type { KalshiCredentials } from "../../onboarding/onboarding-modal.types";
4
4
  import type { PlaceOrderRoutingRow, PlaceOrderStatus, PlaceOrderTab, TradingVenue } from "../types";
5
+ import type { ExecutionOrderGroup } from "./index.place-order.execution-steps";
5
6
  export type PlaceOrderProps = {
6
7
  /** Custom class name applied to the place-order root. */
7
8
  className?: string;
@@ -80,6 +81,8 @@ export type PlaceOrderProps = {
80
81
  onExecutionStateChange?: (state: PlaceOrderSubmissionProgressState) => void;
81
82
  /** Optional resolved-event claim summary shown in read-only state. */
82
83
  resolvedClaim?: PlaceOrderResolvedClaimSummary;
84
+ /** Render the settlement-pending state for a closed recurring market. */
85
+ showResolvingState?: boolean;
83
86
  /** Pre-fetched midpoint data (best price included) passed from parent. Optional for backward compatibility. */
84
87
  midpointsResult?: UseMidpointsResult;
85
88
  };
@@ -209,6 +212,14 @@ export type PlaceOrderFailureSummary = {
209
212
  eventSubtitle?: string;
210
213
  eventTitle: string;
211
214
  kind: PlaceOrderFailureKind;
215
+ /** Failed venue to pin when retrying the unfilled remainder of a split route. */
216
+ retryVenue?: TradingVenue;
217
+ executionGroups?: ExecutionOrderGroup[];
218
+ result?: {
219
+ averagePriceLabel: string;
220
+ filledAmountLabel: string;
221
+ payoutLabel: string;
222
+ };
212
223
  steps: PlaceOrderFailureStep[];
213
224
  };
214
225
  export type ResolvePlaceOrderQuoteResultParams = {
@@ -236,6 +247,7 @@ export type ResolvePlaceOrderTabKeyParams = {
236
247
  export type PlaceOrderQuoteStatus = PlaceOrderStatus | undefined;
237
248
  export type PlaceOrderSubmissionProgressPhase = "finding-route" | "submitting" | "executing" | "success" | "failed";
238
249
  export type PlaceOrderExecutionSummary = {
250
+ resultState?: "success" | "partial";
239
251
  tradeSide?: PlaceOrderTab;
240
252
  shares: string;
241
253
  avgPrice: string;
@@ -248,6 +260,8 @@ export type PlaceOrderExecutionSummary = {
248
260
  amountLabel?: string;
249
261
  toWinLabel?: string;
250
262
  potentialReturnLabel?: string;
263
+ requestedAmountLabel?: string;
264
+ executionGroups?: ExecutionOrderGroup[];
251
265
  executionStepGroups?: PlaceOrderExecutionStepGroup[];
252
266
  shareText?: string;
253
267
  };
@@ -258,6 +272,7 @@ export type PlaceOrderSubmissionProgressState = {
258
272
  orderId?: string;
259
273
  orderIds?: string[];
260
274
  quoteId?: string;
275
+ quoteData?: SmartRouteResponse;
261
276
  phase: PlaceOrderSubmissionProgressPhase;
262
277
  summary?: PlaceOrderExecutionSummary;
263
278
  dagProgress?: DagStepProgress | null;
@@ -2,6 +2,12 @@ import type { VenueMarket, VenueSellQuoteRequest } from "@agg-build/hooks";
2
2
  import type { 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
+ export declare const getPlaceOrderAverageExecutionPrice: (quoteData: SmartRouteResponse | null | undefined) => number | null;
6
+ export declare const isPlaceOrderAveragePriceWorse: ({ averageExecutionPrice, displayedMarketPrice, tradeSide, }: {
7
+ averageExecutionPrice: number | null | undefined;
8
+ displayedMarketPrice: number | null | undefined;
9
+ tradeSide: PlaceOrderTab;
10
+ }) => boolean;
5
11
  export declare const floorToDecimals: (value: number, decimals: number) => number;
6
12
  export declare const formatFlooredShareAmount: (value: number, decimals: number) => string;
7
13
  export declare const buildLimitOrderVenueOptions: ({ currentPrices, livePrices, market, selectedOutcomeId, }: {
@@ -13,7 +19,6 @@ export declare const buildLimitOrderVenueOptions: ({ currentPrices, livePrices,
13
19
  export declare const resolveAutomaticLimitOrderVenueOption: (options: PlaceOrderLimitVenueOption[], side: PlaceOrderTab) => PlaceOrderLimitVenueOption | null;
14
20
  export declare const extractGeoBlockedVenues: (warnings: SmartRouteResponse["warnings"]) => Set<string>;
15
21
  export declare const getSmartRouteTotalFees: (feeBreakdown: SmartRouteResponse["feeBreakdown"]) => number | null;
16
- export declare const hasLowLiquidityWarning: (warnings: SmartRouteResponse["warnings"]) => boolean;
17
22
  /** Pure helpers for PlaceOrder view-model shaping, formatting, and keyboard logic. */
18
23
  export declare const getPlaceOrderContainerClassName: () => string;
19
24
  export declare const getResultValueClassName: (tone: PlaceOrderResultTone) => string;
@@ -57,6 +62,8 @@ export declare const buildLiveRouteCards: ({ labels, quoteData, tradeSide, event
57
62
  * Kalshi-funded user with no on-chain balance lands on a submittable route.
58
63
  */
59
64
  export declare const resolveDefaultRouteCardId: (routeCards: PlaceOrderRouteCard[], primaryStatus?: SmartRouteResponse["status"]) => string | null;
65
+ /** Stable identity for preserving only an explicit venue choice across quote-ID refreshes. */
66
+ export declare const getPlaceOrderRouteCardIdentity: (card: PlaceOrderRouteCard) => string;
60
67
  export declare const clampSellSharesToAvailability: (requestedSellShares: number, availableShares: number) => number;
61
68
  export declare const hasInsufficientVenueInventory: (requestedSellShares: number, availableShares: number) => boolean;
62
69
  export declare const getRemainingVenueSellShares: (availableShares: number, filledShares: number) => number;
@@ -147,6 +154,12 @@ export declare const getPlaceOrderUnfilledRemaining: ({ originalAmount, tradeSid
147
154
  tradeSide: PlaceOrderTab;
148
155
  terminalOrderEvents?: PlaceOrderTerminalOrderEvent[];
149
156
  }) => number;
157
+ /** Returns null when successful legs omit the canonical units needed for a safe retry. */
158
+ export declare const getCanonicalPlaceOrderUnfilledRemaining: ({ originalAmount, tradeSide, terminalOrderEvents, }: {
159
+ originalAmount: number;
160
+ tradeSide: PlaceOrderTab;
161
+ terminalOrderEvents?: PlaceOrderTerminalOrderEvent[];
162
+ }) => number | null;
150
163
  export declare const buildPlaceOrderFailureSummary: ({ actionLabel, canRetryRemaining, errorMessage, eventImage, eventSubtitle, eventTitle, labels, orderId, quoteData, submittedOrders, terminalOrderEvents, }: {
151
164
  actionLabel: string;
152
165
  canRetryRemaining?: boolean;
@@ -2,6 +2,12 @@ import type { VenueMarket, VenueSellQuoteRequest } from "@agg-build/hooks";
2
2
  import type { 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
+ export declare const getPlaceOrderAverageExecutionPrice: (quoteData: SmartRouteResponse | null | undefined) => number | null;
6
+ export declare const isPlaceOrderAveragePriceWorse: ({ averageExecutionPrice, displayedMarketPrice, tradeSide, }: {
7
+ averageExecutionPrice: number | null | undefined;
8
+ displayedMarketPrice: number | null | undefined;
9
+ tradeSide: PlaceOrderTab;
10
+ }) => boolean;
5
11
  export declare const floorToDecimals: (value: number, decimals: number) => number;
6
12
  export declare const formatFlooredShareAmount: (value: number, decimals: number) => string;
7
13
  export declare const buildLimitOrderVenueOptions: ({ currentPrices, livePrices, market, selectedOutcomeId, }: {
@@ -13,7 +19,6 @@ export declare const buildLimitOrderVenueOptions: ({ currentPrices, livePrices,
13
19
  export declare const resolveAutomaticLimitOrderVenueOption: (options: PlaceOrderLimitVenueOption[], side: PlaceOrderTab) => PlaceOrderLimitVenueOption | null;
14
20
  export declare const extractGeoBlockedVenues: (warnings: SmartRouteResponse["warnings"]) => Set<string>;
15
21
  export declare const getSmartRouteTotalFees: (feeBreakdown: SmartRouteResponse["feeBreakdown"]) => number | null;
16
- export declare const hasLowLiquidityWarning: (warnings: SmartRouteResponse["warnings"]) => boolean;
17
22
  /** Pure helpers for PlaceOrder view-model shaping, formatting, and keyboard logic. */
18
23
  export declare const getPlaceOrderContainerClassName: () => string;
19
24
  export declare const getResultValueClassName: (tone: PlaceOrderResultTone) => string;
@@ -57,6 +62,8 @@ export declare const buildLiveRouteCards: ({ labels, quoteData, tradeSide, event
57
62
  * Kalshi-funded user with no on-chain balance lands on a submittable route.
58
63
  */
59
64
  export declare const resolveDefaultRouteCardId: (routeCards: PlaceOrderRouteCard[], primaryStatus?: SmartRouteResponse["status"]) => string | null;
65
+ /** Stable identity for preserving only an explicit venue choice across quote-ID refreshes. */
66
+ export declare const getPlaceOrderRouteCardIdentity: (card: PlaceOrderRouteCard) => string;
60
67
  export declare const clampSellSharesToAvailability: (requestedSellShares: number, availableShares: number) => number;
61
68
  export declare const hasInsufficientVenueInventory: (requestedSellShares: number, availableShares: number) => boolean;
62
69
  export declare const getRemainingVenueSellShares: (availableShares: number, filledShares: number) => number;
@@ -147,6 +154,12 @@ export declare const getPlaceOrderUnfilledRemaining: ({ originalAmount, tradeSid
147
154
  tradeSide: PlaceOrderTab;
148
155
  terminalOrderEvents?: PlaceOrderTerminalOrderEvent[];
149
156
  }) => number;
157
+ /** Returns null when successful legs omit the canonical units needed for a safe retry. */
158
+ export declare const getCanonicalPlaceOrderUnfilledRemaining: ({ originalAmount, tradeSide, terminalOrderEvents, }: {
159
+ originalAmount: number;
160
+ tradeSide: PlaceOrderTab;
161
+ terminalOrderEvents?: PlaceOrderTerminalOrderEvent[];
162
+ }) => number | null;
150
163
  export declare const buildPlaceOrderFailureSummary: ({ actionLabel, canRetryRemaining, errorMessage, eventImage, eventSubtitle, eventTitle, labels, orderId, quoteData, submittedOrders, terminalOrderEvents, }: {
151
164
  actionLabel: string;
152
165
  canRetryRemaining?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agg-build/ui",
3
- "version": "4.0.0",
3
+ "version": "4.4.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.0.0",
104
- "@agg-build/sdk": "^4.0.0"
103
+ "@agg-build/hooks": "^4.4.0",
104
+ "@agg-build/sdk": "^4.3.0"
105
105
  },
106
106
  "dependencies": {
107
107
  "@number-flow/react": "^0.6.0",
File without changes