@agg-build/ui 1.2.9 → 1.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-PFOSEY46.mjs → chunk-3ZSNHGAB.mjs} +835 -401
- package/dist/{chunk-5PSAIGOT.mjs → chunk-54PCEK6G.mjs} +137 -61
- package/dist/{chunk-7JKGAWU5.mjs → chunk-ENAGASVU.mjs} +1538 -1369
- package/dist/{chunk-K23CJ5UP.mjs → chunk-J7K2U44E.mjs} +481 -258
- package/dist/{chunk-5MDFM2MX.mjs → chunk-NWJHFGBZ.mjs} +1 -1
- package/dist/{chunk-QFW5NDJ6.mjs → chunk-SJLHOAKK.mjs} +1001 -1015
- package/dist/{chunk-PYKD4W4T.mjs → chunk-YP75TIY6.mjs} +601 -326
- package/dist/events.js +2038 -1559
- package/dist/events.mjs +3 -3
- package/dist/index.js +5417 -4261
- package/dist/index.mjs +56 -50
- package/dist/modals.js +3262 -2384
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +3677 -2709
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +992 -918
- package/dist/primitives.mjs +5 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +1360 -1129
- package/dist/trading.mjs +4 -4
- package/dist/types/deposit/deposit-modal.types.d.mts +10 -1
- package/dist/types/deposit/deposit-modal.types.d.ts +10 -1
- package/dist/types/deposit/index.d.mts +1 -1
- package/dist/types/deposit/index.d.ts +1 -1
- package/dist/types/deposit/steps/crypto-transfer.d.mts +1 -2
- package/dist/types/deposit/steps/crypto-transfer.d.ts +1 -2
- package/dist/types/deposit/steps/deposit-method.d.mts +2 -1
- package/dist/types/deposit/steps/deposit-method.d.ts +2 -1
- package/dist/types/events/item/event-list-item.types.d.mts +3 -1
- package/dist/types/events/item/event-list-item.types.d.ts +3 -1
- package/dist/types/events/item/event-list-item.utils.d.mts +26 -2
- package/dist/types/events/item/event-list-item.utils.d.ts +26 -2
- package/dist/types/events/item-details/event-list-item-details.types.d.mts +30 -1
- package/dist/types/events/item-details/event-list-item-details.types.d.ts +30 -1
- package/dist/types/events/market-details/index.d.mts +1 -1
- package/dist/types/events/market-details/index.d.ts +1 -1
- package/dist/types/events/market-details/market-details.types.d.mts +27 -2
- package/dist/types/events/market-details/market-details.types.d.ts +27 -2
- package/dist/types/events/market-details/market-details.utils.d.mts +18 -4
- package/dist/types/events/market-details/market-details.utils.d.ts +18 -4
- package/dist/types/events/market-details/orderbook-aggregation.d.mts +38 -2
- package/dist/types/events/market-details/orderbook-aggregation.d.ts +38 -2
- package/dist/types/events/shared/chart-auto-fallback.d.mts +43 -0
- package/dist/types/events/shared/chart-auto-fallback.d.ts +43 -0
- package/dist/types/events/shared/display-outcome-price.d.mts +14 -0
- package/dist/types/events/shared/display-outcome-price.d.ts +14 -0
- package/dist/types/events/shared/display-outcome-venue.d.mts +30 -0
- package/dist/types/events/shared/display-outcome-venue.d.ts +30 -0
- package/dist/types/events/shared/display-reference-price.d.mts +4 -0
- package/dist/types/events/shared/display-reference-price.d.ts +4 -0
- package/dist/types/events/shared/select-outcome-price.d.mts +21 -0
- package/dist/types/events/shared/select-outcome-price.d.ts +21 -0
- package/dist/types/pages/user-profile/components/available-balance-card.d.mts +2 -1
- package/dist/types/pages/user-profile/components/available-balance-card.d.ts +2 -1
- package/dist/types/pages/user-profile/components/positions-value-card.d.mts +2 -1
- package/dist/types/pages/user-profile/components/positions-value-card.d.ts +2 -1
- package/dist/types/pages/user-profile/index.d.mts +2 -2
- package/dist/types/pages/user-profile/index.d.ts +2 -2
- package/dist/types/pages/user-profile/user-profile.types.d.mts +54 -1
- package/dist/types/pages/user-profile/user-profile.types.d.ts +54 -1
- package/dist/types/primitives/chart/chart.utils.d.mts +9 -10
- package/dist/types/primitives/chart/chart.utils.d.ts +9 -10
- package/dist/types/primitives/icon/index.d.mts +2 -1
- package/dist/types/primitives/icon/index.d.ts +2 -1
- package/dist/types/primitives/icon/registry.d.mts +8 -0
- package/dist/types/primitives/icon/registry.d.ts +8 -0
- package/dist/types/primitives/icon/svg/circle-xmark.d.mts +5 -0
- package/dist/types/primitives/icon/svg/circle-xmark.d.ts +5 -0
- package/dist/types/primitives/icon/svg/spinner.d.mts +5 -0
- package/dist/types/primitives/icon/svg/spinner.d.ts +5 -0
- package/dist/types/primitives/toast/index.d.mts +2 -0
- package/dist/types/primitives/toast/index.d.ts +2 -0
- package/dist/types/primitives/tooltip/tooltip.types.d.mts +1 -0
- package/dist/types/primitives/tooltip/tooltip.types.d.ts +1 -0
- package/dist/types/primitives/typography/index.d.mts +1 -1
- package/dist/types/primitives/typography/index.d.ts +1 -1
- package/dist/types/primitives/typography/typography.types.d.mts +2 -0
- package/dist/types/primitives/typography/typography.types.d.ts +2 -0
- package/dist/types/shared/transfer-fee-summary.d.mts +10 -0
- package/dist/types/shared/transfer-fee-summary.d.ts +10 -0
- package/dist/types/shared/utils.d.mts +3 -0
- package/dist/types/shared/utils.d.ts +3 -0
- package/dist/types/trading/place-order/index.d.mts +1 -1
- package/dist/types/trading/place-order/index.d.ts +1 -1
- package/dist/types/trading/place-order/index.place-order.execution-steps.d.mts +9 -0
- package/dist/types/trading/place-order/index.place-order.execution-steps.d.ts +9 -0
- package/dist/types/trading/place-order/index.place-order.types.d.mts +15 -2
- package/dist/types/trading/place-order/index.place-order.types.d.ts +15 -2
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +49 -6
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +49 -6
- package/dist/types/withdraw/index.d.mts +1 -1
- package/dist/types/withdraw/index.d.ts +1 -1
- package/dist/types/withdraw/steps/withdraw-success.d.mts +13 -7
- package/dist/types/withdraw/steps/withdraw-success.d.ts +13 -7
- package/dist/types/withdraw/steps/withdraw-success.utils.d.mts +2 -0
- package/dist/types/withdraw/steps/withdraw-success.utils.d.ts +2 -0
- package/dist/types/withdraw/withdraw-modal.types.d.mts +5 -0
- package/dist/types/withdraw/withdraw-modal.types.d.ts +5 -0
- package/package.json +3 -3
|
@@ -49,18 +49,61 @@ export declare const buildPlaceOrderExecutionStepGroupsFromFailureSummary: ({ la
|
|
|
49
49
|
summary: PlaceOrderFailureSummary;
|
|
50
50
|
treatPartialAsComplete?: boolean;
|
|
51
51
|
}) => PlaceOrderExecutionStepGroup[];
|
|
52
|
-
export declare const normalizePlaceOrderErrorMessage: ({ errorMessage, fallbackMessage, }: {
|
|
52
|
+
export declare const normalizePlaceOrderErrorMessage: ({ errorMessage, fallbackMessage, labels, }: {
|
|
53
53
|
errorMessage?: string | null;
|
|
54
54
|
fallbackMessage: string;
|
|
55
|
+
labels?: Pick<PlaceOrderTradingLabels, "quoteBalanceMismatch">;
|
|
55
56
|
}) => string;
|
|
56
57
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
58
|
+
* Resolves the actual execution economics from terminal WS events, overriding
|
|
59
|
+
* the stale quote estimate after a `partial_fill` (or `filled`) event arrives.
|
|
60
|
+
*
|
|
61
|
+
* Returns the same shape as the relevant fields on `SmartRouteResponse`
|
|
62
|
+
* (`rawExecCost` = USD side, `totalFilled` = shares side) so call sites can
|
|
63
|
+
* swap the quote estimate for actuals without restructuring.
|
|
64
|
+
*
|
|
65
|
+
* Per-side semantics (matches `polymarket-finalize` / `kalshi-finalize`):
|
|
66
|
+
* - BUY: `filledAmountRaw` is USD spent (6dp atomic). Shares received come
|
|
67
|
+
* from `actualSharesRaw` if present, else derived from filled ÷ price.
|
|
68
|
+
* - SELL: `actualSharesRaw` is the authoritative share count (always set by
|
|
69
|
+
* `OrderExecutionService`). USD payout is `actualSharesRaw ×
|
|
70
|
+
* executionPriceRaw`; `filledAmountRaw` is venue-specific (USD on
|
|
71
|
+
* Polymarket, shares on Kalshi) so we don't rely on it here.
|
|
72
|
+
* - `actualToWinRaw` mirrors `actualSharesRaw` (binary outcome: 1 share = $1
|
|
73
|
+
* if it resolves YES) — it's NOT the realized sell payout.
|
|
74
|
+
*
|
|
75
|
+
* Execution-price precedence: `executionPriceRaw` → submittedOrders.price →
|
|
76
|
+
* quote fill avgPrice for the same venue → quote-wide vwap.
|
|
77
|
+
*
|
|
78
|
+
* When no fill data is present (`hasActualFillData === false`), callers should
|
|
79
|
+
* fall back to the quote estimate.
|
|
80
|
+
*/
|
|
81
|
+
export type PlaceOrderActualEconomics = {
|
|
82
|
+
hasActualFillData: boolean;
|
|
83
|
+
actualRawExecCost: number;
|
|
84
|
+
actualTotalFilled: number;
|
|
85
|
+
avgExecutionPrice: number;
|
|
86
|
+
};
|
|
87
|
+
export declare const resolveActualExecutionEconomics: ({ quoteData, tradeSide, terminalOrderEvents, submittedOrders, }: {
|
|
88
|
+
quoteData: SmartRouteResponse | null | undefined;
|
|
89
|
+
tradeSide: PlaceOrderTab;
|
|
90
|
+
terminalOrderEvents?: PlaceOrderTerminalOrderEvent[];
|
|
91
|
+
submittedOrders?: WsOrderSubmitted[];
|
|
92
|
+
}) => PlaceOrderActualEconomics;
|
|
93
|
+
/**
|
|
94
|
+
* Compute the unfilled remainder of an order from terminal WS events.
|
|
95
|
+
*
|
|
96
|
+
* `originalAmount` is in the same units as the user's input field:
|
|
97
|
+
* - BUY: USD requested → subtract `filledAmountRaw` (USD) per event.
|
|
98
|
+
* - SELL: shares requested → subtract `actualSharesRaw` (shares) per event.
|
|
99
|
+
* For sells we never subtract `filledAmountRaw` because its unit is
|
|
100
|
+
* venue-specific (USD on Polymarket, shares on Kalshi) — mixing
|
|
101
|
+
* units corrupts the "Retry remaining" amount and the auto-skip
|
|
102
|
+
* threshold. `actualSharesRaw` is always shares.
|
|
61
103
|
*/
|
|
62
|
-
export declare const getPlaceOrderUnfilledRemaining: ({ originalAmount, terminalOrderEvents, }: {
|
|
104
|
+
export declare const getPlaceOrderUnfilledRemaining: ({ originalAmount, tradeSide, terminalOrderEvents, }: {
|
|
63
105
|
originalAmount: number;
|
|
106
|
+
tradeSide: PlaceOrderTab;
|
|
64
107
|
terminalOrderEvents?: PlaceOrderTerminalOrderEvent[];
|
|
65
108
|
}) => number;
|
|
66
109
|
export declare const buildPlaceOrderFailureSummary: ({ actionLabel, canRetryRemaining, errorMessage, eventImage, eventSubtitle, eventTitle, labels, orderId, quoteData, submittedOrders, terminalOrderEvents, }: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { WithdrawModalProps } from "./withdraw-modal.types";
|
|
2
|
-
export type { WithdrawMethod, WithdrawModalControlledProps, WithdrawModalProps, WithdrawModalSelfDrivenProps, WithdrawFlowData, WithdrawSummary, } from "./withdraw-modal.types";
|
|
2
|
+
export type { WithdrawMethod, WithdrawModalControlledProps, WithdrawModalProps, WithdrawModalSelfDrivenProps, WithdrawFlowData, WithdrawFeeEstimate, WithdrawSummary, } from "./withdraw-modal.types";
|
|
3
3
|
export declare const WithdrawModal: {
|
|
4
4
|
(props: WithdrawModalProps): JSX.Element;
|
|
5
5
|
displayName: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { WithdrawModalProps } from "./withdraw-modal.types";
|
|
2
|
-
export type { WithdrawMethod, WithdrawModalControlledProps, WithdrawModalProps, WithdrawModalSelfDrivenProps, WithdrawFlowData, WithdrawSummary, } from "./withdraw-modal.types";
|
|
2
|
+
export type { WithdrawMethod, WithdrawModalControlledProps, WithdrawModalProps, WithdrawModalSelfDrivenProps, WithdrawFlowData, WithdrawFeeEstimate, WithdrawSummary, } from "./withdraw-modal.types";
|
|
3
3
|
export declare const WithdrawModal: {
|
|
4
4
|
(props: WithdrawModalProps): JSX.Element;
|
|
5
5
|
displayName: string;
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
+
import type { WithdrawalLifecycleState } from "@agg-build/hooks/withdraw";
|
|
1
2
|
import type { WithdrawSummary } from "../withdraw-modal.types";
|
|
3
|
+
export type WithdrawResultStatus = "success" | "partial_success" | "failed";
|
|
4
|
+
interface WithdrawLoadingStepProps {
|
|
5
|
+
lifecycleState: WithdrawalLifecycleState;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
}
|
|
2
8
|
export interface WithdrawSuccessStepProps {
|
|
3
9
|
summary: WithdrawSummary;
|
|
4
10
|
tokenSymbol: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* falls back to the static "submitted" copy.
|
|
9
|
-
*/
|
|
10
|
-
withdrawalId: string | null;
|
|
11
|
+
requestedWithdrawal: string;
|
|
12
|
+
resultStatus: WithdrawResultStatus;
|
|
13
|
+
errorMessage?: string | null;
|
|
11
14
|
onDone: () => void;
|
|
15
|
+
onRetry: () => void;
|
|
12
16
|
onClose: () => void;
|
|
13
17
|
}
|
|
14
|
-
export declare const
|
|
18
|
+
export declare const WithdrawLoadingStep: ({ lifecycleState, onClose, }: WithdrawLoadingStepProps) => JSX.Element;
|
|
19
|
+
export declare const WithdrawSuccessStep: ({ summary, tokenSymbol, requestedWithdrawal, resultStatus, errorMessage, onDone, onRetry, onClose, }: WithdrawSuccessStepProps) => JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
+
import type { WithdrawalLifecycleState } from "@agg-build/hooks/withdraw";
|
|
1
2
|
import type { WithdrawSummary } from "../withdraw-modal.types";
|
|
3
|
+
export type WithdrawResultStatus = "success" | "partial_success" | "failed";
|
|
4
|
+
interface WithdrawLoadingStepProps {
|
|
5
|
+
lifecycleState: WithdrawalLifecycleState;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
}
|
|
2
8
|
export interface WithdrawSuccessStepProps {
|
|
3
9
|
summary: WithdrawSummary;
|
|
4
10
|
tokenSymbol: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* falls back to the static "submitted" copy.
|
|
9
|
-
*/
|
|
10
|
-
withdrawalId: string | null;
|
|
11
|
+
requestedWithdrawal: string;
|
|
12
|
+
resultStatus: WithdrawResultStatus;
|
|
13
|
+
errorMessage?: string | null;
|
|
11
14
|
onDone: () => void;
|
|
15
|
+
onRetry: () => void;
|
|
12
16
|
onClose: () => void;
|
|
13
17
|
}
|
|
14
|
-
export declare const
|
|
18
|
+
export declare const WithdrawLoadingStep: ({ lifecycleState, onClose, }: WithdrawLoadingStepProps) => JSX.Element;
|
|
19
|
+
export declare const WithdrawSuccessStep: ({ summary, tokenSymbol, requestedWithdrawal, resultStatus, errorMessage, onDone, onRetry, onClose, }: WithdrawSuccessStepProps) => JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -9,6 +9,8 @@ export interface WithdrawalLifecycleStep {
|
|
|
9
9
|
id: string;
|
|
10
10
|
label: string;
|
|
11
11
|
status: WithdrawalLifecycleStepStatus;
|
|
12
|
+
/** Failure reason propagated from `leg.errorMessage`. Only set when `status === "error"`. */
|
|
13
|
+
errorMessage?: string | null;
|
|
12
14
|
}
|
|
13
15
|
export type WithdrawalLifecycleStepGroup = WithdrawalLifecycleStep[];
|
|
14
16
|
export declare const resolveChainLabel: (chainId: number) => string;
|
|
@@ -9,6 +9,8 @@ export interface WithdrawalLifecycleStep {
|
|
|
9
9
|
id: string;
|
|
10
10
|
label: string;
|
|
11
11
|
status: WithdrawalLifecycleStepStatus;
|
|
12
|
+
/** Failure reason propagated from `leg.errorMessage`. Only set when `status === "error"`. */
|
|
13
|
+
errorMessage?: string | null;
|
|
12
14
|
}
|
|
13
15
|
export type WithdrawalLifecycleStepGroup = WithdrawalLifecycleStep[];
|
|
14
16
|
export declare const resolveChainLabel: (chainId: number) => string;
|
|
@@ -23,6 +23,11 @@ export interface WithdrawSummary {
|
|
|
23
23
|
toWallet: string;
|
|
24
24
|
fees: string;
|
|
25
25
|
}
|
|
26
|
+
export interface WithdrawFeeEstimate {
|
|
27
|
+
estimatedFees: string;
|
|
28
|
+
networkReserve: string;
|
|
29
|
+
youReceive: string;
|
|
30
|
+
}
|
|
26
31
|
export interface WithdrawFlowData {
|
|
27
32
|
/** Top-level balance shown in the entry step (numeric, e.g. 179.9). */
|
|
28
33
|
balance: number;
|
|
@@ -23,6 +23,11 @@ export interface WithdrawSummary {
|
|
|
23
23
|
toWallet: string;
|
|
24
24
|
fees: string;
|
|
25
25
|
}
|
|
26
|
+
export interface WithdrawFeeEstimate {
|
|
27
|
+
estimatedFees: string;
|
|
28
|
+
networkReserve: string;
|
|
29
|
+
youReceive: string;
|
|
30
|
+
}
|
|
26
31
|
export interface WithdrawFlowData {
|
|
27
32
|
/** Top-level balance shown in the entry step (numeric, e.g. 179.9). */
|
|
28
33
|
balance: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agg-build/ui",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.11",
|
|
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": "^1.2.
|
|
104
|
-
"@agg-build/sdk": "^1.2.
|
|
103
|
+
"@agg-build/hooks": "^1.2.11",
|
|
104
|
+
"@agg-build/sdk": "^1.2.11"
|
|
105
105
|
},
|
|
106
106
|
"dependencies": {
|
|
107
107
|
"@number-flow/react": "^0.6.0",
|