@agg-build/ui 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/{chunk-75IGOQ4N.mjs → chunk-3IY2GA2D.mjs} +69 -45
  2. package/dist/{chunk-I2WBGEWK.mjs → chunk-4ILR2YH3.mjs} +319 -344
  3. package/dist/{chunk-C7T56TJR.mjs → chunk-PEVG67XU.mjs} +369 -19
  4. package/dist/{chunk-6NS7D73S.mjs → chunk-TLGQ4LID.mjs} +1556 -1204
  5. package/dist/{chunk-DMKKNK76.mjs → chunk-WFS772A3.mjs} +800 -592
  6. package/dist/{chunk-CGNDMLQL.mjs → chunk-XDZLCWUZ.mjs} +511 -899
  7. package/dist/{chunk-2QJXRRYP.mjs → chunk-YSCHNVBZ.mjs} +3 -2
  8. package/dist/events.js +2081 -1673
  9. package/dist/events.mjs +3 -3
  10. package/dist/index.js +4890 -4318
  11. package/dist/index.mjs +195 -118
  12. package/dist/modals.js +1568 -1242
  13. package/dist/modals.mjs +3 -3
  14. package/dist/pages.js +3007 -2904
  15. package/dist/pages.mjs +6 -6
  16. package/dist/primitives.js +1507 -1207
  17. package/dist/primitives.mjs +13 -1
  18. package/dist/styles.css +1 -1
  19. package/dist/tailwind.css +1 -1
  20. package/dist/trading.js +3920 -3734
  21. package/dist/trading.mjs +10 -12
  22. package/dist/types/deposit/steps/card-payment-pending.d.mts +3 -1
  23. package/dist/types/deposit/steps/card-payment-pending.d.ts +3 -1
  24. package/dist/types/deposit/steps/crypto-transfer.d.mts +1 -1
  25. package/dist/types/deposit/steps/crypto-transfer.d.ts +1 -1
  26. package/dist/types/events/item/event-list-item.utils.d.mts +57 -0
  27. package/dist/types/events/item/event-list-item.utils.d.ts +57 -0
  28. package/dist/types/events/item-details/event-list-item-details.types.d.mts +16 -1
  29. package/dist/types/events/item-details/event-list-item-details.types.d.ts +16 -1
  30. package/dist/types/events/item-details/settlement-summary.d.mts +6 -2
  31. package/dist/types/events/item-details/settlement-summary.d.ts +6 -2
  32. package/dist/types/events/list/event-list.types.d.mts +1 -1
  33. package/dist/types/events/list/event-list.types.d.ts +1 -1
  34. package/dist/types/events/list/event-list.utils.d.mts +1 -1
  35. package/dist/types/events/list/event-list.utils.d.ts +1 -1
  36. package/dist/types/events/market-details/market-details.types.d.mts +8 -0
  37. package/dist/types/events/market-details/market-details.types.d.ts +8 -0
  38. package/dist/types/pages/event-market/event-market.types.d.mts +1 -3
  39. package/dist/types/pages/event-market/event-market.types.d.ts +1 -3
  40. package/dist/types/primitives/copy-button/index.d.mts +25 -0
  41. package/dist/types/primitives/copy-button/index.d.ts +25 -0
  42. package/dist/types/primitives/icon/index.d.mts +3 -1
  43. package/dist/types/primitives/icon/index.d.ts +3 -1
  44. package/dist/types/primitives/icon/registry.d.mts +8 -0
  45. package/dist/types/primitives/icon/registry.d.ts +8 -0
  46. package/dist/types/primitives/icon/svg/apps.d.mts +5 -0
  47. package/dist/types/primitives/icon/svg/apps.d.ts +5 -0
  48. package/dist/types/primitives/icon/svg/circle-overlap.d.mts +5 -0
  49. package/dist/types/primitives/icon/svg/circle-overlap.d.ts +5 -0
  50. package/dist/types/primitives/index.d.mts +2 -0
  51. package/dist/types/primitives/index.d.ts +2 -0
  52. package/dist/types/primitives/select/index.d.mts +1 -1
  53. package/dist/types/primitives/select/index.d.ts +1 -1
  54. package/dist/types/primitives/select/select.types.d.mts +1 -1
  55. package/dist/types/primitives/select/select.types.d.ts +1 -1
  56. package/dist/types/primitives/select/select.utils.d.mts +0 -1
  57. package/dist/types/primitives/select/select.utils.d.ts +0 -1
  58. package/dist/types/primitives/skeleton/index.d.mts +2 -1
  59. package/dist/types/primitives/skeleton/index.d.ts +2 -1
  60. package/dist/types/primitives/skeleton/views/place-order-skeleton-view.d.mts +4 -0
  61. package/dist/types/primitives/skeleton/views/place-order-skeleton-view.d.ts +4 -0
  62. package/dist/types/primitives/toast/index.d.mts +4 -0
  63. package/dist/types/primitives/toast/index.d.ts +4 -0
  64. package/dist/types/primitives/toast/toast.types.d.mts +31 -0
  65. package/dist/types/primitives/toast/toast.types.d.ts +31 -0
  66. package/dist/types/primitives/typography/index.d.mts +1 -1
  67. package/dist/types/primitives/typography/index.d.ts +1 -1
  68. package/dist/types/primitives/typography/typography.types.d.mts +3 -1
  69. package/dist/types/primitives/typography/typography.types.d.ts +3 -1
  70. package/dist/types/shared/utils.d.mts +3 -1
  71. package/dist/types/shared/utils.d.ts +3 -1
  72. package/dist/types/trading/index.d.mts +0 -1
  73. package/dist/types/trading/index.d.ts +0 -1
  74. package/dist/types/trading/place-order/index.place-order.constants.d.mts +8 -0
  75. package/dist/types/trading/place-order/index.place-order.constants.d.ts +8 -0
  76. package/dist/types/trading/place-order/index.place-order.types.d.mts +6 -1
  77. package/dist/types/trading/place-order/index.place-order.types.d.ts +6 -1
  78. package/dist/types/trading/place-order/index.place-order.utils.d.mts +4 -11
  79. package/dist/types/trading/place-order/index.place-order.utils.d.ts +4 -11
  80. package/dist/types/trading/settlement/index.d.mts +9 -6
  81. package/dist/types/trading/settlement/index.d.ts +9 -6
  82. package/dist/types/trading/settlement/settlement-text-renderer.d.mts +8 -0
  83. package/dist/types/trading/settlement/settlement-text-renderer.d.ts +8 -0
  84. package/dist/types/trading/settlement/settlement-text.utils.d.mts +36 -0
  85. package/dist/types/trading/settlement/settlement-text.utils.d.ts +36 -0
  86. package/dist/types/trading/types.d.mts +0 -19
  87. package/dist/types/trading/types.d.ts +0 -19
  88. package/dist/types/trading/utils.d.mts +0 -1
  89. package/dist/types/trading/utils.d.ts +0 -1
  90. package/dist/types/withdraw/index.d.mts +2 -2
  91. package/dist/types/withdraw/index.d.ts +2 -2
  92. package/dist/types/withdraw/steps/withdraw-amount.d.mts +6 -3
  93. package/dist/types/withdraw/steps/withdraw-amount.d.ts +6 -3
  94. package/dist/types/withdraw/steps/withdraw-success.d.mts +8 -1
  95. package/dist/types/withdraw/steps/withdraw-success.d.ts +8 -1
  96. package/dist/types/withdraw/steps/withdraw-success.utils.d.mts +36 -0
  97. package/dist/types/withdraw/steps/withdraw-success.utils.d.ts +36 -0
  98. package/dist/types/withdraw/withdraw-modal.types.d.mts +25 -15
  99. package/dist/types/withdraw/withdraw-modal.types.d.ts +25 -15
  100. package/package.json +6 -5
  101. package/dist/types/primitives/card/card.constants.d.mts +0 -4
  102. package/dist/types/primitives/card/card.constants.d.ts +0 -4
  103. package/dist/types/trading/settlement/settlement-details.utils.d.mts +0 -7
  104. package/dist/types/trading/settlement/settlement-details.utils.d.ts +0 -7
@@ -1,6 +1,5 @@
1
1
  import type { TradingVenue } from "./types";
2
2
  export declare const defaultSettlementSectionLabel: string;
3
- export declare const defaultSettlementDifferencesTitle: string;
4
3
  export declare const defaultTradingDisclaimer: string;
5
4
  export declare const getTradingDateLabel: (value: string | Date) => string;
6
5
  export declare const getTradingVenueLabel: (venue: TradingVenue | undefined, label?: string) => string;
@@ -1,6 +1,6 @@
1
1
  import type { WithdrawModalProps } from "./withdraw-modal.types";
2
- export type { WithdrawMethod, WithdrawModalProps, WithdrawFlowData } from "./withdraw-modal.types";
2
+ export type { WithdrawMethod, WithdrawModalControlledProps, WithdrawModalProps, WithdrawModalSelfDrivenProps, WithdrawFlowData, WithdrawSummary, } from "./withdraw-modal.types";
3
3
  export declare const WithdrawModal: {
4
- ({ open, onOpenChange, withdrawFlow, onSelectWithdrawMethod, onWithdrawAmountChange, onWithdrawCurrencyChange, onWithdrawTokenChange, onWithdrawNetworkChange, onGetWithdrawQuotes, onSelectWithdrawProvider, onDoneWithdraw, }: WithdrawModalProps): JSX.Element;
4
+ (props: WithdrawModalProps): JSX.Element;
5
5
  displayName: string;
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import type { WithdrawModalProps } from "./withdraw-modal.types";
2
- export type { WithdrawMethod, WithdrawModalProps, WithdrawFlowData } from "./withdraw-modal.types";
2
+ export type { WithdrawMethod, WithdrawModalControlledProps, WithdrawModalProps, WithdrawModalSelfDrivenProps, WithdrawFlowData, WithdrawSummary, } from "./withdraw-modal.types";
3
3
  export declare const WithdrawModal: {
4
- ({ open, onOpenChange, withdrawFlow, onSelectWithdrawMethod, onWithdrawAmountChange, onWithdrawCurrencyChange, onWithdrawTokenChange, onWithdrawNetworkChange, onGetWithdrawQuotes, onSelectWithdrawProvider, onDoneWithdraw, }: WithdrawModalProps): JSX.Element;
4
+ (props: WithdrawModalProps): JSX.Element;
5
5
  displayName: string;
6
6
  };
@@ -1,17 +1,20 @@
1
1
  import type { WithdrawSelectOption } from "../withdraw-modal.types";
2
2
  export interface WithdrawAmountStepProps {
3
3
  amount: string;
4
- currency: string;
5
4
  destinationWallet: string;
5
+ balanceDisplay: string;
6
6
  tokenOptions: WithdrawSelectOption[];
7
7
  networkOptions: WithdrawSelectOption[];
8
8
  selectedToken: string;
9
9
  selectedNetwork: string;
10
+ isConfirming?: boolean;
11
+ error?: string | null;
10
12
  onBack: () => void;
11
13
  onAmountChange: (amount: string) => void;
12
- onCurrencyChange: (currency: string) => void;
14
+ onDestinationChange: (address: string) => void;
13
15
  onTokenChange: (token: string) => void;
14
16
  onNetworkChange: (network: string) => void;
17
+ onMaxClick?: () => void;
15
18
  onContinue: () => void;
16
19
  }
17
- export declare const WithdrawAmountStep: ({ amount, currency, destinationWallet, tokenOptions, networkOptions, selectedToken, selectedNetwork, onBack, onAmountChange, onCurrencyChange, onTokenChange, onNetworkChange, onContinue, }: WithdrawAmountStepProps) => JSX.Element;
20
+ export declare const WithdrawAmountStep: ({ amount, destinationWallet, balanceDisplay, tokenOptions, networkOptions, selectedToken, selectedNetwork, isConfirming, error, onBack, onAmountChange, onDestinationChange, onTokenChange, onNetworkChange, onMaxClick, onContinue, }: WithdrawAmountStepProps) => JSX.Element;
@@ -1,17 +1,20 @@
1
1
  import type { WithdrawSelectOption } from "../withdraw-modal.types";
2
2
  export interface WithdrawAmountStepProps {
3
3
  amount: string;
4
- currency: string;
5
4
  destinationWallet: string;
5
+ balanceDisplay: string;
6
6
  tokenOptions: WithdrawSelectOption[];
7
7
  networkOptions: WithdrawSelectOption[];
8
8
  selectedToken: string;
9
9
  selectedNetwork: string;
10
+ isConfirming?: boolean;
11
+ error?: string | null;
10
12
  onBack: () => void;
11
13
  onAmountChange: (amount: string) => void;
12
- onCurrencyChange: (currency: string) => void;
14
+ onDestinationChange: (address: string) => void;
13
15
  onTokenChange: (token: string) => void;
14
16
  onNetworkChange: (network: string) => void;
17
+ onMaxClick?: () => void;
15
18
  onContinue: () => void;
16
19
  }
17
- export declare const WithdrawAmountStep: ({ amount, currency, destinationWallet, tokenOptions, networkOptions, selectedToken, selectedNetwork, onBack, onAmountChange, onCurrencyChange, onTokenChange, onNetworkChange, onContinue, }: WithdrawAmountStepProps) => JSX.Element;
20
+ export declare const WithdrawAmountStep: ({ amount, destinationWallet, balanceDisplay, tokenOptions, networkOptions, selectedToken, selectedNetwork, isConfirming, error, onBack, onAmountChange, onDestinationChange, onTokenChange, onNetworkChange, onMaxClick, onContinue, }: WithdrawAmountStepProps) => JSX.Element;
@@ -1,7 +1,14 @@
1
1
  import type { WithdrawSummary } from "../withdraw-modal.types";
2
2
  export interface WithdrawSuccessStepProps {
3
3
  summary: WithdrawSummary;
4
+ tokenSymbol: string;
5
+ /**
6
+ * The submitted withdrawal id. When non-null the success step subscribes to
7
+ * `withdrawal_lifecycle` WS events and renders live progress; when null it
8
+ * falls back to the static "submitted" copy.
9
+ */
10
+ withdrawalId: string | null;
4
11
  onDone: () => void;
5
12
  onClose: () => void;
6
13
  }
7
- export declare const WithdrawSuccessStep: ({ summary, onDone, onClose, }: WithdrawSuccessStepProps) => JSX.Element;
14
+ export declare const WithdrawSuccessStep: ({ summary, tokenSymbol, withdrawalId, onDone, onClose, }: WithdrawSuccessStepProps) => JSX.Element;
@@ -1,7 +1,14 @@
1
1
  import type { WithdrawSummary } from "../withdraw-modal.types";
2
2
  export interface WithdrawSuccessStepProps {
3
3
  summary: WithdrawSummary;
4
+ tokenSymbol: string;
5
+ /**
6
+ * The submitted withdrawal id. When non-null the success step subscribes to
7
+ * `withdrawal_lifecycle` WS events and renders live progress; when null it
8
+ * falls back to the static "submitted" copy.
9
+ */
10
+ withdrawalId: string | null;
4
11
  onDone: () => void;
5
12
  onClose: () => void;
6
13
  }
7
- export declare const WithdrawSuccessStep: ({ summary, onDone, onClose, }: WithdrawSuccessStepProps) => JSX.Element;
14
+ export declare const WithdrawSuccessStep: ({ summary, tokenSymbol, withdrawalId, onDone, onClose, }: WithdrawSuccessStepProps) => JSX.Element;
@@ -0,0 +1,36 @@
1
+ import type { WsWithdrawalLifecycleLeg, WsWithdrawalLifecycleStatus } from "@agg-build/sdk";
2
+ import type { AggUiLabels } from "@agg-build/hooks";
3
+ /**
4
+ * Visual tone for a single lifecycle step row. Mirrors the place-order
5
+ * success/in-flight timeline so the two flows feel identical to users.
6
+ */
7
+ export type WithdrawalLifecycleStepStatus = "pending" | "complete" | "warning" | "error";
8
+ export interface WithdrawalLifecycleStep {
9
+ id: string;
10
+ label: string;
11
+ status: WithdrawalLifecycleStepStatus;
12
+ }
13
+ export type WithdrawalLifecycleStepGroup = WithdrawalLifecycleStep[];
14
+ export declare const resolveChainLabel: (chainId: number) => string;
15
+ export interface BuildLifecycleStepsParams {
16
+ pending: boolean;
17
+ status: WsWithdrawalLifecycleStatus | null;
18
+ legs: WsWithdrawalLifecycleLeg[];
19
+ walletFlowLabels: AggUiLabels["withdraw"]["walletFlow"];
20
+ }
21
+ export interface BuildLifecycleStepsResult {
22
+ groups: WithdrawalLifecycleStepGroup[];
23
+ finalStep: WithdrawalLifecycleStep;
24
+ hasDetails: boolean;
25
+ }
26
+ /**
27
+ * Builds the timeline groups + final summary row consumed by the success
28
+ * step's collapsible execution timeline. Returns the same shape the
29
+ * place-order flow produces, so the two share visual structure verbatim.
30
+ *
31
+ * - Each leg becomes one row in the first (and only) group.
32
+ * - The final row (always rendered, optionally collapsing the group above)
33
+ * reflects the *top-level* lifecycle status — "Bridging funds across
34
+ * chains…", "Withdrawal complete.", etc.
35
+ */
36
+ export declare const buildWithdrawalLifecycleSteps: ({ pending, status, legs, walletFlowLabels, }: BuildLifecycleStepsParams) => BuildLifecycleStepsResult;
@@ -0,0 +1,36 @@
1
+ import type { WsWithdrawalLifecycleLeg, WsWithdrawalLifecycleStatus } from "@agg-build/sdk";
2
+ import type { AggUiLabels } from "@agg-build/hooks";
3
+ /**
4
+ * Visual tone for a single lifecycle step row. Mirrors the place-order
5
+ * success/in-flight timeline so the two flows feel identical to users.
6
+ */
7
+ export type WithdrawalLifecycleStepStatus = "pending" | "complete" | "warning" | "error";
8
+ export interface WithdrawalLifecycleStep {
9
+ id: string;
10
+ label: string;
11
+ status: WithdrawalLifecycleStepStatus;
12
+ }
13
+ export type WithdrawalLifecycleStepGroup = WithdrawalLifecycleStep[];
14
+ export declare const resolveChainLabel: (chainId: number) => string;
15
+ export interface BuildLifecycleStepsParams {
16
+ pending: boolean;
17
+ status: WsWithdrawalLifecycleStatus | null;
18
+ legs: WsWithdrawalLifecycleLeg[];
19
+ walletFlowLabels: AggUiLabels["withdraw"]["walletFlow"];
20
+ }
21
+ export interface BuildLifecycleStepsResult {
22
+ groups: WithdrawalLifecycleStepGroup[];
23
+ finalStep: WithdrawalLifecycleStep;
24
+ hasDetails: boolean;
25
+ }
26
+ /**
27
+ * Builds the timeline groups + final summary row consumed by the success
28
+ * step's collapsible execution timeline. Returns the same shape the
29
+ * place-order flow produces, so the two share visual structure verbatim.
30
+ *
31
+ * - Each leg becomes one row in the first (and only) group.
32
+ * - The final row (always rendered, optionally collapsing the group above)
33
+ * reflects the *top-level* lifecycle status — "Bridging funds across
34
+ * chains…", "Withdrawal complete.", etc.
35
+ */
36
+ export declare const buildWithdrawalLifecycleSteps: ({ pending, status, legs, walletFlowLabels, }: BuildLifecycleStepsParams) => BuildLifecycleStepsResult;
@@ -20,45 +20,55 @@ export interface WithdrawProviderOption {
20
20
  export interface WithdrawSummary {
21
21
  amountReceived: string;
22
22
  network: string;
23
- provider: string;
24
23
  toWallet: string;
25
24
  fees: string;
26
25
  }
27
26
  export interface WithdrawFlowData {
28
- /** Top-level balance shown in the entry step. */
27
+ /** Top-level balance shown in the entry step (numeric, e.g. 179.9). */
29
28
  balance: number;
29
+ /** Display string for the balance shown in the amount step, e.g. "179.9 USDC". */
30
+ balanceDisplay: string;
30
31
  amount: string;
31
- currency: string;
32
32
  destinationWallet: string;
33
33
  tokenOptions: WithdrawSelectOption[];
34
34
  networkOptions: WithdrawSelectOption[];
35
35
  selectedToken: string;
36
36
  selectedNetwork: string;
37
- providers: WithdrawProviderOption[];
38
37
  purchaseSummary: WithdrawSummary;
38
+ /**
39
+ * The submitted withdrawal id, populated once the API call succeeds.
40
+ * `null` until then. Used by the success step to subscribe to
41
+ * `withdrawal_lifecycle` WS events.
42
+ */
43
+ withdrawalId: string | null;
39
44
  }
40
- export type WithdrawMethod = "card";
41
- export interface WithdrawModalProps {
45
+ export type WithdrawMethod = "wallet";
46
+ export interface WithdrawModalControlledProps {
42
47
  /** Whether the withdraw modal is currently open. */
43
48
  open: boolean;
44
49
  /** Called whenever the withdraw modal open state changes. */
45
50
  onOpenChange: (open: boolean) => void;
46
51
  /** Controlled state for the withdraw flow. */
47
52
  withdrawFlow: WithdrawFlowData;
48
- /** Called when the user selects a withdraw method. */
49
- onSelectWithdrawMethod?: (method: WithdrawMethod) => void;
53
+ /** Called when the recipient address input changes. */
54
+ onWithdrawDestinationChange: (address: string) => void;
50
55
  /** Called when the withdraw amount changes. */
51
56
  onWithdrawAmountChange: (amount: string) => void;
52
- /** Called when the withdraw currency changes. */
53
- onWithdrawCurrencyChange: (currency: string) => void;
54
57
  /** Called when the withdraw token changes. */
55
58
  onWithdrawTokenChange: (token: string) => void;
56
59
  /** Called when the withdraw network changes. */
57
60
  onWithdrawNetworkChange: (network: string) => void;
58
- /** Called when provider quotes should be fetched. */
59
- onGetWithdrawQuotes?: () => void;
60
- /** Called when the user selects a withdraw provider. */
61
- onSelectWithdrawProvider: (providerId: string) => void;
62
- /** Called after the withdraw flow completes. */
61
+ /** Called when the user clicks Max to fill the maximum withdrawable amount. */
62
+ onMaxClick?: () => void;
63
+ /** Called when the user confirms the withdrawal (triggers API call). Must return a promise so the modal can lock duplicate submissions and surface request errors. */
64
+ onSelectWithdrawProvider: (providerId: string) => Promise<void>;
65
+ /** Called after the withdraw flow completes and the user clicks Done. */
63
66
  onDoneWithdraw: () => void;
64
67
  }
68
+ export interface WithdrawModalSelfDrivenProps {
69
+ /** Whether the withdraw modal is currently open. */
70
+ open: boolean;
71
+ /** Called whenever the withdraw modal open state changes. */
72
+ onOpenChange: (open: boolean) => void;
73
+ }
74
+ export type WithdrawModalProps = WithdrawModalControlledProps | WithdrawModalSelfDrivenProps;
@@ -20,45 +20,55 @@ export interface WithdrawProviderOption {
20
20
  export interface WithdrawSummary {
21
21
  amountReceived: string;
22
22
  network: string;
23
- provider: string;
24
23
  toWallet: string;
25
24
  fees: string;
26
25
  }
27
26
  export interface WithdrawFlowData {
28
- /** Top-level balance shown in the entry step. */
27
+ /** Top-level balance shown in the entry step (numeric, e.g. 179.9). */
29
28
  balance: number;
29
+ /** Display string for the balance shown in the amount step, e.g. "179.9 USDC". */
30
+ balanceDisplay: string;
30
31
  amount: string;
31
- currency: string;
32
32
  destinationWallet: string;
33
33
  tokenOptions: WithdrawSelectOption[];
34
34
  networkOptions: WithdrawSelectOption[];
35
35
  selectedToken: string;
36
36
  selectedNetwork: string;
37
- providers: WithdrawProviderOption[];
38
37
  purchaseSummary: WithdrawSummary;
38
+ /**
39
+ * The submitted withdrawal id, populated once the API call succeeds.
40
+ * `null` until then. Used by the success step to subscribe to
41
+ * `withdrawal_lifecycle` WS events.
42
+ */
43
+ withdrawalId: string | null;
39
44
  }
40
- export type WithdrawMethod = "card";
41
- export interface WithdrawModalProps {
45
+ export type WithdrawMethod = "wallet";
46
+ export interface WithdrawModalControlledProps {
42
47
  /** Whether the withdraw modal is currently open. */
43
48
  open: boolean;
44
49
  /** Called whenever the withdraw modal open state changes. */
45
50
  onOpenChange: (open: boolean) => void;
46
51
  /** Controlled state for the withdraw flow. */
47
52
  withdrawFlow: WithdrawFlowData;
48
- /** Called when the user selects a withdraw method. */
49
- onSelectWithdrawMethod?: (method: WithdrawMethod) => void;
53
+ /** Called when the recipient address input changes. */
54
+ onWithdrawDestinationChange: (address: string) => void;
50
55
  /** Called when the withdraw amount changes. */
51
56
  onWithdrawAmountChange: (amount: string) => void;
52
- /** Called when the withdraw currency changes. */
53
- onWithdrawCurrencyChange: (currency: string) => void;
54
57
  /** Called when the withdraw token changes. */
55
58
  onWithdrawTokenChange: (token: string) => void;
56
59
  /** Called when the withdraw network changes. */
57
60
  onWithdrawNetworkChange: (network: string) => void;
58
- /** Called when provider quotes should be fetched. */
59
- onGetWithdrawQuotes?: () => void;
60
- /** Called when the user selects a withdraw provider. */
61
- onSelectWithdrawProvider: (providerId: string) => void;
62
- /** Called after the withdraw flow completes. */
61
+ /** Called when the user clicks Max to fill the maximum withdrawable amount. */
62
+ onMaxClick?: () => void;
63
+ /** Called when the user confirms the withdrawal (triggers API call). Must return a promise so the modal can lock duplicate submissions and surface request errors. */
64
+ onSelectWithdrawProvider: (providerId: string) => Promise<void>;
65
+ /** Called after the withdraw flow completes and the user clicks Done. */
63
66
  onDoneWithdraw: () => void;
64
67
  }
68
+ export interface WithdrawModalSelfDrivenProps {
69
+ /** Whether the withdraw modal is currently open. */
70
+ open: boolean;
71
+ /** Called whenever the withdraw modal open state changes. */
72
+ onOpenChange: (open: boolean) => void;
73
+ }
74
+ export type WithdrawModalProps = WithdrawModalControlledProps | WithdrawModalSelfDrivenProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agg-build/ui",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Pre-built React component library for the AGG prediction market aggregator. Tailwind-based, themeable, with primitives, event surfaces, trading flows, full pages, and modals.",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -100,17 +100,18 @@
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.0.0",
104
- "@agg-build/sdk": "^1.0.0"
103
+ "@agg-build/hooks": "^1.0.2",
104
+ "@agg-build/sdk": "^1.0.1"
105
105
  },
106
106
  "dependencies": {
107
107
  "@number-flow/react": "^0.6.0",
108
108
  "@radix-ui/react-dialog": "^1.1.15",
109
109
  "@radix-ui/react-dropdown-menu": "^2.1.4",
110
+ "@radix-ui/react-toast": "^1.2.15",
110
111
  "@radix-ui/react-tooltip": "^1.0.7",
111
112
  "dayjs": "^1.11.19",
112
- "qrcode.react": "^3.1.0",
113
- "liveline": "^0.0.7"
113
+ "liveline": "^0.0.7",
114
+ "qrcode.react": "^3.1.0"
114
115
  },
115
116
  "publishConfig": {
116
117
  "access": "public"
@@ -1,4 +0,0 @@
1
- export declare const CARD_BASE_CLASS_NAME = "group/agg-card relative flex w-full flex-col font-agg-sans rounded-[calc(var(--agg-radius-xl)-1px)] bg-agg-secondary text-agg-foreground shadow-agg-card";
2
- export declare const CARD_HOVER_TRANSITION_CLASS_NAME = "transition-shadow hover:shadow-agg-card-hover duration-300 ease-in-out";
3
- export declare const CARD_GRADIENT_WRAPPER_CLASS_NAME = "group/agg-card-gradient rounded-agg-xl p-[1px] relative bg-agg-separator";
4
- export declare const CARD_GRADIENT_OVERLAY_CLASS_NAME = "absolute inset-0 rounded-agg-xl bg-gradient-to-b from-agg-separator to-agg-primary opacity-0 group-hover/agg-card-gradient:opacity-100 transition-opacity duration-200 ease-in-out pointer-events-none";
@@ -1,4 +0,0 @@
1
- export declare const CARD_BASE_CLASS_NAME = "group/agg-card relative flex w-full flex-col font-agg-sans rounded-[calc(var(--agg-radius-xl)-1px)] bg-agg-secondary text-agg-foreground shadow-agg-card";
2
- export declare const CARD_HOVER_TRANSITION_CLASS_NAME = "transition-shadow hover:shadow-agg-card-hover duration-300 ease-in-out";
3
- export declare const CARD_GRADIENT_WRAPPER_CLASS_NAME = "group/agg-card-gradient rounded-agg-xl p-[1px] relative bg-agg-separator";
4
- export declare const CARD_GRADIENT_OVERLAY_CLASS_NAME = "absolute inset-0 rounded-agg-xl bg-gradient-to-b from-agg-separator to-agg-primary opacity-0 group-hover/agg-card-gradient:opacity-100 transition-opacity duration-200 ease-in-out pointer-events-none";
@@ -1,7 +0,0 @@
1
- import type { AggUiLabels, VenueMarket } from "@agg-build/hooks";
2
- import type { SettlementSection } from "../types";
3
- /**
4
- * Maps venue markets to settlement sections, filtering out sections
5
- * where no venue has meaningful content for that field.
6
- */
7
- export declare function mapVenueMarketsToSettlementSections(venueMarkets: VenueMarket[], labels: AggUiLabels, selectedMarketId?: string): SettlementSection[];
@@ -1,7 +0,0 @@
1
- import type { AggUiLabels, VenueMarket } from "@agg-build/hooks";
2
- import type { SettlementSection } from "../types";
3
- /**
4
- * Maps venue markets to settlement sections, filtering out sections
5
- * where no venue has meaningful content for that field.
6
- */
7
- export declare function mapVenueMarketsToSettlementSections(venueMarkets: VenueMarket[], labels: AggUiLabels, selectedMarketId?: string): SettlementSection[];