@agg-build/ui 1.0.0 → 1.0.1

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 (56) hide show
  1. package/dist/{chunk-2QJXRRYP.mjs → chunk-43K4PFBC.mjs} +3 -2
  2. package/dist/{chunk-I2WBGEWK.mjs → chunk-5ES2VJHO.mjs} +159 -93
  3. package/dist/{chunk-DMKKNK76.mjs → chunk-BYMLPLEZ.mjs} +791 -583
  4. package/dist/{chunk-C7T56TJR.mjs → chunk-HD6HBTK2.mjs} +1 -1
  5. package/dist/{chunk-CGNDMLQL.mjs → chunk-LPNZOX3E.mjs} +123 -52
  6. package/dist/{chunk-75IGOQ4N.mjs → chunk-WLXYCBZV.mjs} +62 -32
  7. package/dist/{chunk-6NS7D73S.mjs → chunk-YZNO6IUD.mjs} +740 -521
  8. package/dist/events.js +196 -93
  9. package/dist/events.mjs +3 -3
  10. package/dist/index.js +3396 -2806
  11. package/dist/index.mjs +13 -7
  12. package/dist/modals.js +798 -535
  13. package/dist/modals.mjs +3 -3
  14. package/dist/pages.js +378 -176
  15. package/dist/pages.mjs +6 -6
  16. package/dist/primitives.js +713 -531
  17. package/dist/primitives.mjs +7 -1
  18. package/dist/styles.css +1 -1
  19. package/dist/tailwind.css +1 -1
  20. package/dist/trading.js +242 -54
  21. package/dist/trading.mjs +4 -4
  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/market-details/market-details.types.d.mts +8 -0
  31. package/dist/types/events/market-details/market-details.types.d.ts +8 -0
  32. package/dist/types/primitives/copy-button/index.d.mts +25 -0
  33. package/dist/types/primitives/copy-button/index.d.ts +25 -0
  34. package/dist/types/primitives/index.d.mts +2 -0
  35. package/dist/types/primitives/index.d.ts +2 -0
  36. package/dist/types/primitives/toast/index.d.mts +4 -0
  37. package/dist/types/primitives/toast/index.d.ts +4 -0
  38. package/dist/types/primitives/toast/toast.types.d.mts +31 -0
  39. package/dist/types/primitives/toast/toast.types.d.ts +31 -0
  40. package/dist/types/trading/place-order/index.place-order.constants.d.mts +8 -0
  41. package/dist/types/trading/place-order/index.place-order.constants.d.ts +8 -0
  42. package/dist/types/trading/place-order/index.place-order.types.d.mts +6 -0
  43. package/dist/types/trading/place-order/index.place-order.types.d.ts +6 -0
  44. package/dist/types/trading/place-order/index.place-order.utils.d.mts +4 -7
  45. package/dist/types/trading/place-order/index.place-order.utils.d.ts +4 -7
  46. package/dist/types/withdraw/index.d.mts +2 -2
  47. package/dist/types/withdraw/index.d.ts +2 -2
  48. package/dist/types/withdraw/steps/withdraw-amount.d.mts +6 -3
  49. package/dist/types/withdraw/steps/withdraw-amount.d.ts +6 -3
  50. package/dist/types/withdraw/steps/withdraw-success.d.mts +8 -1
  51. package/dist/types/withdraw/steps/withdraw-success.d.ts +8 -1
  52. package/dist/types/withdraw/steps/withdraw-success.utils.d.mts +36 -0
  53. package/dist/types/withdraw/steps/withdraw-success.utils.d.ts +36 -0
  54. package/dist/types/withdraw/withdraw-modal.types.d.mts +25 -15
  55. package/dist/types/withdraw/withdraw-modal.types.d.ts +25 -15
  56. package/package.json +6 -5
@@ -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.1",
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.1",
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"