@agg-build/ui 4.0.0 → 4.2.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 (38) hide show
  1. package/dist/{chunk-JTSLZARU.mjs → chunk-6X6Y4INU.mjs} +2 -2
  2. package/dist/{chunk-XIDQ2A6W.mjs → chunk-DNPDXL2D.mjs} +1357 -858
  3. package/dist/{chunk-KX3TQ7WC.mjs → chunk-FTL25XKE.mjs} +1 -1
  4. package/dist/{chunk-MKU5Q6PN.mjs → chunk-GNEFI4SO.mjs} +25 -8
  5. package/dist/{chunk-KO6VTRV6.mjs → chunk-QW7VFURU.mjs} +283 -229
  6. package/dist/{chunk-R362GNI2.mjs → chunk-UDBHAZJJ.mjs} +12 -27
  7. package/dist/{chunk-VR5ZRDQT.mjs → chunk-WDCH4RRS.mjs} +1 -1
  8. package/dist/events.js +760 -689
  9. package/dist/events.mjs +3 -3
  10. package/dist/index.js +4032 -3479
  11. package/dist/index.mjs +15 -7
  12. package/dist/modals.js +1312 -1258
  13. package/dist/modals.mjs +3 -3
  14. package/dist/pages.js +3364 -2817
  15. package/dist/pages.mjs +8 -6
  16. package/dist/primitives.js +316 -262
  17. package/dist/primitives.mjs +1 -1
  18. package/dist/styles.css +1 -1
  19. package/dist/tailwind.css +1 -1
  20. package/dist/trading.js +1996 -1445
  21. package/dist/trading.mjs +10 -4
  22. package/dist/types/pages/user-profile/index.d.mts +1 -0
  23. package/dist/types/pages/user-profile/index.d.ts +1 -0
  24. package/dist/types/primitives/venue-logo/svg/logo-novig.d.mts +24 -0
  25. package/dist/types/primitives/venue-logo/svg/logo-novig.d.ts +24 -0
  26. package/dist/types/primitives/venue-logo/venue-logo.constants.d.mts +1 -1
  27. package/dist/types/primitives/venue-logo/venue-logo.constants.d.ts +1 -1
  28. package/dist/types/trading/place-order/index.d.mts +3 -0
  29. package/dist/types/trading/place-order/index.d.ts +3 -0
  30. package/dist/types/trading/place-order/index.place-order.execution-steps.d.mts +28 -75
  31. package/dist/types/trading/place-order/index.place-order.execution-steps.d.ts +28 -75
  32. package/dist/types/trading/place-order/index.place-order.execution-view.d.mts +25 -0
  33. package/dist/types/trading/place-order/index.place-order.execution-view.d.ts +25 -0
  34. package/dist/types/trading/place-order/index.place-order.types.d.mts +6 -0
  35. package/dist/types/trading/place-order/index.place-order.types.d.ts +6 -0
  36. package/dist/types/trading/place-order/index.place-order.utils.d.mts +8 -1
  37. package/dist/types/trading/place-order/index.place-order.utils.d.ts +8 -1
  38. package/package.json +3 -3
package/dist/trading.mjs CHANGED
@@ -2,6 +2,9 @@
2
2
  import {
3
3
  FundKalshiModal,
4
4
  PlaceOrder,
5
+ PlaceOrderExecutionGroups,
6
+ PlaceOrderExecutionHeader,
7
+ PlaceOrderExecutionView,
5
8
  PlaceOrderFailureView,
6
9
  PlaceOrderSuccessView,
7
10
  SettlementDetails,
@@ -9,7 +12,7 @@ import {
9
12
  parseVenue,
10
13
  useClaimWinnings,
11
14
  useResolvedMarketClaim
12
- } from "./chunk-XIDQ2A6W.mjs";
15
+ } from "./chunk-DNPDXL2D.mjs";
13
16
  import {
14
17
  SETTLEMENT_SECTION_ID,
15
18
  Settlement,
@@ -27,12 +30,15 @@ import {
27
30
  prepareSettlementDifferences,
28
31
  resolveDifferenceIconClassName,
29
32
  useEventTradingContext
30
- } from "./chunk-VR5ZRDQT.mjs";
31
- import "./chunk-KX3TQ7WC.mjs";
32
- import "./chunk-KO6VTRV6.mjs";
33
+ } from "./chunk-WDCH4RRS.mjs";
34
+ import "./chunk-FTL25XKE.mjs";
35
+ import "./chunk-QW7VFURU.mjs";
33
36
  export {
34
37
  FundKalshiModal,
35
38
  PlaceOrder,
39
+ PlaceOrderExecutionGroups,
40
+ PlaceOrderExecutionHeader,
41
+ PlaceOrderExecutionView,
36
42
  PlaceOrderFailureView,
37
43
  PlaceOrderSuccessView,
38
44
  SETTLEMENT_SECTION_ID,
@@ -4,6 +4,7 @@ export { USER_PROFILE_TAB_ACTIVITY, USER_PROFILE_TAB_OPEN_ORDERS, USER_PROFILE_T
4
4
  export type { UserProfileTabValue } from "./user-profile.constants";
5
5
  export { buildAggTxExplorerHref } from "./transaction-explorer";
6
6
  export { ManageBalancesModal } from "./components/manage-balances-modal";
7
+ export declare const formatShareAmount: (value: number) => string;
7
8
  export declare const UserProfilePage: {
8
9
  ({ user, balanceChainsOverride, venueBalances: _venueBalances, balance, activePositions, closedPositions, activities, executionMode, onEditProfile, onDeposit, onWithdraw, openOrders, initialPositionFilter, tab, onTabChange, onPositionClick, getPositionHref, onClaim, claimingPositionKeys, onClaimResult, onClaimSubmitError, onActivityClick, getActivityHref, onOpenOrderClick, getOpenOrderHref, onCancelOrder, cancellingOrderIds, isLoadingPositions, isLoadingActivities, isLoadingOpenOrders, positionsError, activitiesError, openOrdersError, hasMoreActivePositions, isLoadingMoreActivePositions, onLoadMoreActivePositions, hasMoreClosedPositions, isLoadingMoreClosedPositions, onLoadMoreClosedPositions, onPositionFilterChange: onPositionFilterChangeProp, hasMoreActivities, isLoadingMoreActivities, onLoadMoreActivities, hasMoreOpenOrders, isLoadingMoreOpenOrders, onLoadMoreOpenOrders, classNames, onError, }: UserProfilePageProps & {
9
10
  onError?: (error: Error) => void;
@@ -4,6 +4,7 @@ export { USER_PROFILE_TAB_ACTIVITY, USER_PROFILE_TAB_OPEN_ORDERS, USER_PROFILE_T
4
4
  export type { UserProfileTabValue } from "./user-profile.constants";
5
5
  export { buildAggTxExplorerHref } from "./transaction-explorer";
6
6
  export { ManageBalancesModal } from "./components/manage-balances-modal";
7
+ export declare const formatShareAmount: (value: number) => string;
7
8
  export declare const UserProfilePage: {
8
9
  ({ user, balanceChainsOverride, venueBalances: _venueBalances, balance, activePositions, closedPositions, activities, executionMode, onEditProfile, onDeposit, onWithdraw, openOrders, initialPositionFilter, tab, onTabChange, onPositionClick, getPositionHref, onClaim, claimingPositionKeys, onClaimResult, onClaimSubmitError, onActivityClick, getActivityHref, onOpenOrderClick, getOpenOrderHref, onCancelOrder, cancellingOrderIds, isLoadingPositions, isLoadingActivities, isLoadingOpenOrders, positionsError, activitiesError, openOrdersError, hasMoreActivePositions, isLoadingMoreActivePositions, onLoadMoreActivePositions, hasMoreClosedPositions, isLoadingMoreClosedPositions, onLoadMoreClosedPositions, onPositionFilterChange: onPositionFilterChangeProp, hasMoreActivities, isLoadingMoreActivities, onLoadMoreActivities, hasMoreOpenOrders, isLoadingMoreOpenOrders, onLoadMoreOpenOrders, classNames, onError, }: UserProfilePageProps & {
9
10
  onError?: (error: Error) => void;
@@ -0,0 +1,24 @@
1
+ import type { LogoIconProps } from "../logo-props";
2
+ /**
3
+ * Novig's mark: a stylised "N" whose left stem is replaced by a dot — a
4
+ * diagonal stroke running top-left to bottom-right, a vertical stem on the
5
+ * right, and a round dot at lower-left. All three share one stroke weight and
6
+ * round caps.
7
+ *
8
+ * Geometry is MEASURED, not eyeballed. Blob bounds off the official 1024px
9
+ * asset put the N at x245..757 / y256..769 and the dot at x231..429 /
10
+ * y574..769; the dot's diameter (198px) equals the stroke weight, which the
11
+ * 192px favicon independently confirms (dot r16, stroke 32). Scaled to this
12
+ * 100-unit viewBox that gives stroke 19.3, cap centres at 34.7 and 65.4, and
13
+ * the dot at (32.2, 65.5) r9.65.
14
+ *
15
+ * Rendered as strokes rather than filled outlines so the shape stays editable
16
+ * and stays exactly one colour — the registry contract here is monochrome
17
+ * (see `logo-probable.tsx`), with `primaryColor` driven by `isColor`/`color`.
18
+ * The two-tone version (cream on #050505) is the CDN PNG used by the
19
+ * `variant="logo"` image path, not this component.
20
+ */
21
+ export declare const LogoNovigIcon: {
22
+ ({ title, className, isColor, color, ...props }: LogoIconProps): JSX.Element;
23
+ displayName: string;
24
+ };
@@ -0,0 +1,24 @@
1
+ import type { LogoIconProps } from "../logo-props";
2
+ /**
3
+ * Novig's mark: a stylised "N" whose left stem is replaced by a dot — a
4
+ * diagonal stroke running top-left to bottom-right, a vertical stem on the
5
+ * right, and a round dot at lower-left. All three share one stroke weight and
6
+ * round caps.
7
+ *
8
+ * Geometry is MEASURED, not eyeballed. Blob bounds off the official 1024px
9
+ * asset put the N at x245..757 / y256..769 and the dot at x231..429 /
10
+ * y574..769; the dot's diameter (198px) equals the stroke weight, which the
11
+ * 192px favicon independently confirms (dot r16, stroke 32). Scaled to this
12
+ * 100-unit viewBox that gives stroke 19.3, cap centres at 34.7 and 65.4, and
13
+ * the dot at (32.2, 65.5) r9.65.
14
+ *
15
+ * Rendered as strokes rather than filled outlines so the shape stays editable
16
+ * and stays exactly one colour — the registry contract here is monochrome
17
+ * (see `logo-probable.tsx`), with `primaryColor` driven by `isColor`/`color`.
18
+ * The two-tone version (cream on #050505) is the CDN PNG used by the
19
+ * `variant="logo"` image path, not this component.
20
+ */
21
+ export declare const LogoNovigIcon: {
22
+ ({ title, className, isColor, color, ...props }: LogoIconProps): JSX.Element;
23
+ displayName: string;
24
+ };
@@ -4,10 +4,10 @@ import type { VenueLogoName, VenueLogoProps } from "./venue-logo.types";
4
4
  type VenueLogoComponent = (props: LogoIconProps) => JSX.Element;
5
5
  export declare const venueLogoRegistry: Record<VenueLogoName, VenueLogoComponent>;
6
6
  export { DefaultVenueIcon };
7
+ export declare const DEFAULT_VENUE_LOGO_URL = "https://assets.snagsolutions.io/public/prediction-markets/logos/default.png";
7
8
  export declare const venueLogoUrlRegistry: Record<VenueLogoName, string>;
8
9
  export declare const venueLogoLabels: Record<VenueLogoName, string>;
9
10
  export declare const DEFAULT_VENUE_LABEL = "Market";
10
- export declare const DEFAULT_VENUE_LOGO_URL = "https://assets.snagsolutions.io/public/prediction-markets/logos/default.png";
11
11
  export declare const venueLogoNames: VenueLogoName[];
12
12
  export declare const sizeClasses: Record<NonNullable<VenueLogoProps["size"]>, string>;
13
13
  type VenueLineColorTheme = "light" | "dark";
@@ -4,10 +4,10 @@ import type { VenueLogoName, VenueLogoProps } from "./venue-logo.types";
4
4
  type VenueLogoComponent = (props: LogoIconProps) => JSX.Element;
5
5
  export declare const venueLogoRegistry: Record<VenueLogoName, VenueLogoComponent>;
6
6
  export { DefaultVenueIcon };
7
+ export declare const DEFAULT_VENUE_LOGO_URL = "https://assets.snagsolutions.io/public/prediction-markets/logos/default.png";
7
8
  export declare const venueLogoUrlRegistry: Record<VenueLogoName, string>;
8
9
  export declare const venueLogoLabels: Record<VenueLogoName, string>;
9
10
  export declare const DEFAULT_VENUE_LABEL = "Market";
10
- export declare const DEFAULT_VENUE_LOGO_URL = "https://assets.snagsolutions.io/public/prediction-markets/logos/default.png";
11
11
  export declare const venueLogoNames: VenueLogoName[];
12
12
  export declare const sizeClasses: Record<NonNullable<VenueLogoProps["size"]>, string>;
13
13
  type VenueLineColorTheme = "light" | "dark";
@@ -3,6 +3,9 @@ export { PlaceOrderFailureView } from "./index.place-order.failure";
3
3
  export type { PlaceOrderFailureViewProps } from "./index.place-order.failure";
4
4
  export { PlaceOrderSuccessView } from "./index.place-order.success";
5
5
  export type { PlaceOrderSuccessViewProps } from "./index.place-order.success";
6
+ export { PlaceOrderExecutionGroups, PlaceOrderExecutionHeader, PlaceOrderExecutionView, } from "./index.place-order.execution-view";
7
+ export type { PlaceOrderExecutionViewProps } from "./index.place-order.execution-view";
8
+ export type { ExecutionOrderGroup, ExecutionStep, ExecutionStepKind, ExecutionStepStatus, } from "./index.place-order.execution-steps";
6
9
  export type { PlaceOrderClassNames, PlaceOrderExecutionSummary, PlaceOrderResolvedClaimSummary, PlaceOrderTradingLabels, } from "./index.place-order.types";
7
10
  export declare const PlaceOrder: {
8
11
  ({ className, classNames, eventTradingState, executionMode, isLoading, isPrimaryActionDisabled, isPrimaryActionLoading, isQuotePanelActive, chainBalancesOverride, onAmountChange, onClose, onConnectKalshi, onOutcomeChange, onPrimaryAction, onBeforePrimaryAction, onTabChange, onSuccess, onError, onExecutionStateChange, resolvedClaim, midpointsResult, }: PlaceOrderProps): JSX.Element;
@@ -3,6 +3,9 @@ export { PlaceOrderFailureView } from "./index.place-order.failure";
3
3
  export type { PlaceOrderFailureViewProps } from "./index.place-order.failure";
4
4
  export { PlaceOrderSuccessView } from "./index.place-order.success";
5
5
  export type { PlaceOrderSuccessViewProps } from "./index.place-order.success";
6
+ export { PlaceOrderExecutionGroups, PlaceOrderExecutionHeader, PlaceOrderExecutionView, } from "./index.place-order.execution-view";
7
+ export type { PlaceOrderExecutionViewProps } from "./index.place-order.execution-view";
8
+ export type { ExecutionOrderGroup, ExecutionStep, ExecutionStepKind, ExecutionStepStatus, } from "./index.place-order.execution-steps";
6
9
  export type { PlaceOrderClassNames, PlaceOrderExecutionSummary, PlaceOrderResolvedClaimSummary, PlaceOrderTradingLabels, } from "./index.place-order.types";
7
10
  export declare const PlaceOrder: {
8
11
  ({ className, classNames, eventTradingState, executionMode, isLoading, isPrimaryActionDisabled, isPrimaryActionLoading, isQuotePanelActive, chainBalancesOverride, onAmountChange, onClose, onConnectKalshi, onOutcomeChange, onPrimaryAction, onBeforePrimaryAction, onTabChange, onSuccess, onError, onExecutionStateChange, resolvedClaim, midpointsResult, }: PlaceOrderProps): JSX.Element;
@@ -1,81 +1,34 @@
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";
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;
69
32
  };
70
- /**
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.
79
- */
80
- export declare const buildSubmissionDisplayRows: ({ phase, dagProgress, executionVenue, isAwaitingWalletConfirmation, labels, }: BuildSubmissionDisplayRowsArgs) => SubmissionDisplayRow[];
81
- export {};
33
+ export declare const deriveExecutionOrderGroups: ({ quoteData, labels, tradeSide, hasSubmissionResponse, executionSteps, executionOrders, rawExecutionSteps, terminalOrderEvents, forceCompleted, }: DeriveExecutionOrderGroupsArgs) => ExecutionOrderGroup[];
34
+ export declare const flattenExecutionSteps: (groups: ExecutionOrderGroup[]) => ExecutionStep[];
@@ -1,81 +1,34 @@
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";
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;
69
32
  };
70
- /**
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.
79
- */
80
- export declare const buildSubmissionDisplayRows: ({ phase, dagProgress, executionVenue, isAwaitingWalletConfirmation, labels, }: BuildSubmissionDisplayRowsArgs) => SubmissionDisplayRow[];
81
- export {};
33
+ export declare const deriveExecutionOrderGroups: ({ quoteData, labels, tradeSide, hasSubmissionResponse, executionSteps, executionOrders, rawExecutionSteps, terminalOrderEvents, forceCompleted, }: DeriveExecutionOrderGroupsArgs) => ExecutionOrderGroup[];
34
+ export declare const flattenExecutionSteps: (groups: ExecutionOrderGroup[]) => ExecutionStep[];
@@ -0,0 +1,25 @@
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
+ };
22
+ export declare const PlaceOrderExecutionView: {
23
+ ({ className, classNames, enableAnimations, eventDateLabel, eventImage, eventTitle, groups, labels, }: PlaceOrderExecutionViewProps): JSX.Element;
24
+ displayName: string;
25
+ };
@@ -0,0 +1,25 @@
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
+ };
22
+ export declare const PlaceOrderExecutionView: {
23
+ ({ className, classNames, enableAnimations, eventDateLabel, eventImage, eventTitle, groups, labels, }: PlaceOrderExecutionViewProps): JSX.Element;
24
+ displayName: string;
25
+ };
@@ -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;
@@ -209,6 +210,8 @@ export type PlaceOrderFailureSummary = {
209
210
  eventSubtitle?: string;
210
211
  eventTitle: string;
211
212
  kind: PlaceOrderFailureKind;
213
+ /** Failed venue to pin when retrying the unfilled remainder of a split route. */
214
+ retryVenue?: TradingVenue;
212
215
  steps: PlaceOrderFailureStep[];
213
216
  };
214
217
  export type ResolvePlaceOrderQuoteResultParams = {
@@ -248,6 +251,8 @@ export type PlaceOrderExecutionSummary = {
248
251
  amountLabel?: string;
249
252
  toWinLabel?: string;
250
253
  potentialReturnLabel?: string;
254
+ requestedAmountLabel?: string;
255
+ executionGroups?: ExecutionOrderGroup[];
251
256
  executionStepGroups?: PlaceOrderExecutionStepGroup[];
252
257
  shareText?: string;
253
258
  };
@@ -258,6 +263,7 @@ export type PlaceOrderSubmissionProgressState = {
258
263
  orderId?: string;
259
264
  orderIds?: string[];
260
265
  quoteId?: string;
266
+ quoteData?: SmartRouteResponse;
261
267
  phase: PlaceOrderSubmissionProgressPhase;
262
268
  summary?: PlaceOrderExecutionSummary;
263
269
  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;
@@ -209,6 +210,8 @@ export type PlaceOrderFailureSummary = {
209
210
  eventSubtitle?: string;
210
211
  eventTitle: string;
211
212
  kind: PlaceOrderFailureKind;
213
+ /** Failed venue to pin when retrying the unfilled remainder of a split route. */
214
+ retryVenue?: TradingVenue;
212
215
  steps: PlaceOrderFailureStep[];
213
216
  };
214
217
  export type ResolvePlaceOrderQuoteResultParams = {
@@ -248,6 +251,8 @@ export type PlaceOrderExecutionSummary = {
248
251
  amountLabel?: string;
249
252
  toWinLabel?: string;
250
253
  potentialReturnLabel?: string;
254
+ requestedAmountLabel?: string;
255
+ executionGroups?: ExecutionOrderGroup[];
251
256
  executionStepGroups?: PlaceOrderExecutionStepGroup[];
252
257
  shareText?: string;
253
258
  };
@@ -258,6 +263,7 @@ export type PlaceOrderSubmissionProgressState = {
258
263
  orderId?: string;
259
264
  orderIds?: string[];
260
265
  quoteId?: string;
266
+ quoteData?: SmartRouteResponse;
261
267
  phase: PlaceOrderSubmissionProgressPhase;
262
268
  summary?: PlaceOrderExecutionSummary;
263
269
  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;
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agg-build/ui",
3
- "version": "4.0.0",
3
+ "version": "4.2.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/sdk": "^4.1.0",
104
+ "@agg-build/hooks": "^4.0.1"
105
105
  },
106
106
  "dependencies": {
107
107
  "@number-flow/react": "^0.6.0",