@agg-build/ui 4.17.0 → 4.17.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 (36) hide show
  1. package/dist/{chunk-M6U2RKBD.mjs → chunk-3Y2GCNVL.mjs} +100 -52
  2. package/dist/{chunk-D2BTU7QI.mjs → chunk-7E4UXCEX.mjs} +223 -169
  3. package/dist/{chunk-QGONLJLE.mjs → chunk-B5ALKYD5.mjs} +210 -184
  4. package/dist/{chunk-RR44PSKH.mjs → chunk-BBDFSTIA.mjs} +3 -1
  5. package/dist/{chunk-5SCDQSNA.mjs → chunk-JI5KV4QI.mjs} +2 -2
  6. package/dist/{chunk-NIRCF54M.mjs → chunk-RZLM3M5R.mjs} +2 -2
  7. package/dist/{chunk-HFMKCV4L.mjs → chunk-TK62UB5F.mjs} +27 -16
  8. package/dist/events.js +29 -16
  9. package/dist/events.mjs +3 -3
  10. package/dist/index.js +1033 -920
  11. package/dist/index.mjs +9 -38
  12. package/dist/modals.js +212 -184
  13. package/dist/modals.mjs +3 -3
  14. package/dist/pages.js +814 -674
  15. package/dist/pages.mjs +6 -6
  16. package/dist/primitives.js +3 -1
  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 +535 -442
  21. package/dist/trading.mjs +4 -4
  22. package/dist/types/auth/connect-button-view/connect-button-view.types.d.mts +0 -2
  23. package/dist/types/auth/connect-button-view/connect-button-view.types.d.ts +0 -2
  24. package/dist/types/auth/connect-button-view/index.d.mts +1 -1
  25. package/dist/types/auth/connect-button-view/index.d.ts +1 -1
  26. package/dist/types/pages/user-profile/components/available-balance-card.d.mts +3 -1
  27. package/dist/types/pages/user-profile/components/available-balance-card.d.ts +3 -1
  28. package/dist/types/pages/user-profile/user-profile.types.d.mts +8 -0
  29. package/dist/types/pages/user-profile/user-profile.types.d.ts +8 -0
  30. package/dist/types/primitives/modal/index.d.mts +1 -1
  31. package/dist/types/primitives/modal/index.d.ts +1 -1
  32. package/dist/types/primitives/modal/modal.types.d.mts +6 -0
  33. package/dist/types/primitives/modal/modal.types.d.ts +6 -0
  34. package/dist/types/trading/place-order/index.place-order.utils.d.mts +12 -1
  35. package/dist/types/trading/place-order/index.place-order.utils.d.ts +12 -1
  36. package/package.json +3 -3
package/dist/trading.mjs CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  useClaimWinnings,
15
15
  useResolvedMarketClaim,
16
16
  venueRequiresSharedKyc
17
- } from "./chunk-D2BTU7QI.mjs";
17
+ } from "./chunk-7E4UXCEX.mjs";
18
18
  import {
19
19
  SETTLEMENT_SECTION_ID,
20
20
  Settlement,
@@ -32,9 +32,9 @@ import {
32
32
  prepareSettlementDifferences,
33
33
  resolveDifferenceIconClassName,
34
34
  useEventTradingContext
35
- } from "./chunk-HFMKCV4L.mjs";
36
- import "./chunk-QGONLJLE.mjs";
37
- import "./chunk-RR44PSKH.mjs";
35
+ } from "./chunk-TK62UB5F.mjs";
36
+ import "./chunk-B5ALKYD5.mjs";
37
+ import "./chunk-BBDFSTIA.mjs";
38
38
  export {
39
39
  FundKalshiModal,
40
40
  PlaceOrder,
@@ -104,8 +104,6 @@ export type AuthConnectButtonViewProps = {
104
104
  totalBalance: number;
105
105
  /** Aggregated positions value shown in the connected state. */
106
106
  positionsBalance: number;
107
- /** Off-chain Kalshi cash balance in dollars. Null when no venue balance is available. */
108
- kalshiBalance?: number | null;
109
107
  /** Number of closed positions currently eligible to claim. */
110
108
  claimReadyCount?: number;
111
109
  /** Called when user clicks the claim-winnings action in the indicator tooltip. */
@@ -104,8 +104,6 @@ export type AuthConnectButtonViewProps = {
104
104
  totalBalance: number;
105
105
  /** Aggregated positions value shown in the connected state. */
106
106
  positionsBalance: number;
107
- /** Off-chain Kalshi cash balance in dollars. Null when no venue balance is available. */
108
- kalshiBalance?: number | null;
109
107
  /** Number of closed positions currently eligible to claim. */
110
108
  claimReadyCount?: number;
111
109
  /** Called when user clicks the claim-winnings action in the indicator tooltip. */
@@ -2,6 +2,6 @@ import type { JSX } from "react";
2
2
  import type { AuthConnectButtonViewProps } from "./connect-button-view.types";
3
3
  export type { AuthConnectButtonViewButtonProps, AuthConnectButtonViewClassNames, AuthConnectButtonViewMethod, AuthConnectButtonViewMethodInput, AuthConnectButtonViewProps, } from "./connect-button-view.types";
4
4
  export declare const AuthConnectButtonView: {
5
- ({ activeMethodId, addressLabel, buttonProps, challengeContent, classNames, disabled, emailMethod, emailError, emailValue, errorMessage, isAuthenticated, isBalanceLoading, isBusy, isChooserOpen, isProfileMenuOpen, notice, onChooserOpenChange, onDepositClick, onDisconnectClick, onEmailChange, onEmailSubmit, onMethodSelect, onProfileCardClick, onProfileClick, onProfileMenuOpenChange, socialMethods, onWithdrawClick, profileLabel, totalBalance, positionsBalance, kalshiBalance, claimReadyCount, onClaimWinningsClick, walletMethods, isDepositBlocked, }: AuthConnectButtonViewProps): JSX.Element;
5
+ ({ activeMethodId, addressLabel, buttonProps, challengeContent, classNames, disabled, emailMethod, emailError, emailValue, errorMessage, isAuthenticated, isBalanceLoading, isBusy, isChooserOpen, isProfileMenuOpen, notice, onChooserOpenChange, onDepositClick, onDisconnectClick, onEmailChange, onEmailSubmit, onMethodSelect, onProfileCardClick, onProfileClick, onProfileMenuOpenChange, socialMethods, onWithdrawClick, profileLabel, totalBalance, positionsBalance, claimReadyCount, onClaimWinningsClick, walletMethods, isDepositBlocked, }: AuthConnectButtonViewProps): JSX.Element;
6
6
  displayName: string;
7
7
  };
@@ -2,6 +2,6 @@ import type { JSX } from "react";
2
2
  import type { AuthConnectButtonViewProps } from "./connect-button-view.types";
3
3
  export type { AuthConnectButtonViewButtonProps, AuthConnectButtonViewClassNames, AuthConnectButtonViewMethod, AuthConnectButtonViewMethodInput, AuthConnectButtonViewProps, } from "./connect-button-view.types";
4
4
  export declare const AuthConnectButtonView: {
5
- ({ activeMethodId, addressLabel, buttonProps, challengeContent, classNames, disabled, emailMethod, emailError, emailValue, errorMessage, isAuthenticated, isBalanceLoading, isBusy, isChooserOpen, isProfileMenuOpen, notice, onChooserOpenChange, onDepositClick, onDisconnectClick, onEmailChange, onEmailSubmit, onMethodSelect, onProfileCardClick, onProfileClick, onProfileMenuOpenChange, socialMethods, onWithdrawClick, profileLabel, totalBalance, positionsBalance, kalshiBalance, claimReadyCount, onClaimWinningsClick, walletMethods, isDepositBlocked, }: AuthConnectButtonViewProps): JSX.Element;
5
+ ({ activeMethodId, addressLabel, buttonProps, challengeContent, classNames, disabled, emailMethod, emailError, emailValue, errorMessage, isAuthenticated, isBalanceLoading, isBusy, isChooserOpen, isProfileMenuOpen, notice, onChooserOpenChange, onDepositClick, onDisconnectClick, onEmailChange, onEmailSubmit, onMethodSelect, onProfileCardClick, onProfileClick, onProfileMenuOpenChange, socialMethods, onWithdrawClick, profileLabel, totalBalance, positionsBalance, claimReadyCount, onClaimWinningsClick, walletMethods, isDepositBlocked, }: AuthConnectButtonViewProps): JSX.Element;
6
6
  displayName: string;
7
7
  };
@@ -10,6 +10,8 @@ type AvailableBalanceCardProps = {
10
10
  label?: string;
11
11
  valueLabel: string;
12
12
  reservedValueLabel?: string;
13
+ /** Kalshi cash balance. Kalshi holds funds off-chain, so it gets its own row. */
14
+ kalshiValueLabel?: string;
13
15
  chains: ChainRow[];
14
16
  isLoading?: boolean;
15
17
  className?: string;
@@ -22,7 +24,7 @@ export declare const venueLogosForChain: (chainId: string | number) => VenueLogo
22
24
  export declare const isVenueBalanceChain: (chainId: string | number) => boolean;
23
25
  export declare const chainIconUrl: (label: string, key?: string) => string | undefined;
24
26
  export declare const AvailableBalanceCard: {
25
- ({ label, valueLabel, reservedValueLabel, chains, isLoading, className, onManage, manageButtonRef, }: AvailableBalanceCardProps): JSX.Element;
27
+ ({ label, valueLabel, reservedValueLabel, kalshiValueLabel, chains, isLoading, className, onManage, manageButtonRef, }: AvailableBalanceCardProps): JSX.Element;
26
28
  displayName: string;
27
29
  };
28
30
  export {};
@@ -10,6 +10,8 @@ type AvailableBalanceCardProps = {
10
10
  label?: string;
11
11
  valueLabel: string;
12
12
  reservedValueLabel?: string;
13
+ /** Kalshi cash balance. Kalshi holds funds off-chain, so it gets its own row. */
14
+ kalshiValueLabel?: string;
13
15
  chains: ChainRow[];
14
16
  isLoading?: boolean;
15
17
  className?: string;
@@ -22,7 +24,7 @@ export declare const venueLogosForChain: (chainId: string | number) => VenueLogo
22
24
  export declare const isVenueBalanceChain: (chainId: string | number) => boolean;
23
25
  export declare const chainIconUrl: (label: string, key?: string) => string | undefined;
24
26
  export declare const AvailableBalanceCard: {
25
- ({ label, valueLabel, reservedValueLabel, chains, isLoading, className, onManage, manageButtonRef, }: AvailableBalanceCardProps): JSX.Element;
27
+ ({ label, valueLabel, reservedValueLabel, kalshiValueLabel, chains, isLoading, className, onManage, manageButtonRef, }: AvailableBalanceCardProps): JSX.Element;
26
28
  displayName: string;
27
29
  };
28
30
  export {};
@@ -249,10 +249,18 @@ export interface UserProfileOpenOrder {
249
249
  title: string;
250
250
  /** Outcome name for the pill, e.g. "Yes" */
251
251
  outcomeLabel: string;
252
+ /** Order side. Renders as a "Buy"/"Sell" prefix on the outcome pill. */
253
+ side?: "buy" | "sell";
252
254
  /** Venue logo for the market */
253
255
  venue: VenueLogoName;
254
256
  /** Limit price label, e.g. "21.6¢" */
255
257
  limitPriceLabel?: string;
258
+ /**
259
+ * Current market price for this outcome, without the "now" prefix, e.g. "25¢".
260
+ * Omitted when no live price is available — the row then shows the limit price
261
+ * alone rather than a stale or guessed mark.
262
+ */
263
+ currentPriceLabel?: string;
256
264
  /** Filled-out-of-total label, e.g. "0/150" */
257
265
  filledLabel: string;
258
266
  /** Total notional label, e.g. "$25.86" */
@@ -249,10 +249,18 @@ export interface UserProfileOpenOrder {
249
249
  title: string;
250
250
  /** Outcome name for the pill, e.g. "Yes" */
251
251
  outcomeLabel: string;
252
+ /** Order side. Renders as a "Buy"/"Sell" prefix on the outcome pill. */
253
+ side?: "buy" | "sell";
252
254
  /** Venue logo for the market */
253
255
  venue: VenueLogoName;
254
256
  /** Limit price label, e.g. "21.6¢" */
255
257
  limitPriceLabel?: string;
258
+ /**
259
+ * Current market price for this outcome, without the "now" prefix, e.g. "25¢".
260
+ * Omitted when no live price is available — the row then shows the limit price
261
+ * alone rather than a stale or guessed mark.
262
+ */
263
+ currentPriceLabel?: string;
256
264
  /** Filled-out-of-total label, e.g. "0/150" */
257
265
  filledLabel: string;
258
266
  /** Total notional label, e.g. "$25.86" */
@@ -3,7 +3,7 @@ export type { ModalBodyClassNames, ModalBodyProps, ModalContainerClassNames, Mod
3
3
  /** Composes the modal root wrapper using Radix dialog primitives. */
4
4
  export declare const Modal: {
5
5
  ({ open, onOpenChange, children, "aria-label": _ariaLabel, "aria-labelledby": _ariaLabelledBy, }: ModalProps): JSX.Element;
6
- Container: ({ children, maxWidth, classNames, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, }: ModalContainerProps) => JSX.Element;
6
+ Container: ({ children, maxWidth, classNames, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, onOpenAutoFocus, }: ModalContainerProps) => JSX.Element;
7
7
  Header: ({ title, subtitle, leftElement, rightElement, hideClose, closeIcon, classNames, children, hideBorder, }: ModalHeaderProps) => JSX.Element;
8
8
  Body: ({ children, classNames }: ModalBodyProps) => JSX.Element;
9
9
  Footer: ({ children, classNames, hideBorder, }: ModalFooterProps) => JSX.Element;
@@ -3,7 +3,7 @@ export type { ModalBodyClassNames, ModalBodyProps, ModalContainerClassNames, Mod
3
3
  /** Composes the modal root wrapper using Radix dialog primitives. */
4
4
  export declare const Modal: {
5
5
  ({ open, onOpenChange, children, "aria-label": _ariaLabel, "aria-labelledby": _ariaLabelledBy, }: ModalProps): JSX.Element;
6
- Container: ({ children, maxWidth, classNames, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, }: ModalContainerProps) => JSX.Element;
6
+ Container: ({ children, maxWidth, classNames, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, onOpenAutoFocus, }: ModalContainerProps) => JSX.Element;
7
7
  Header: ({ title, subtitle, leftElement, rightElement, hideClose, closeIcon, classNames, children, hideBorder, }: ModalHeaderProps) => JSX.Element;
8
8
  Body: ({ children, classNames }: ModalBodyProps) => JSX.Element;
9
9
  Footer: ({ children, classNames, hideBorder, }: ModalFooterProps) => JSX.Element;
@@ -33,6 +33,12 @@ export interface ModalContainerProps {
33
33
  "aria-label"?: string;
34
34
  /** ID of the element that labels the dialog shell. */
35
35
  "aria-labelledby"?: string;
36
+ /**
37
+ * Runs when the dialog takes focus on open. Call `preventDefault()` to stop
38
+ * Radix focusing the first tabbable element and place focus yourself — without
39
+ * it the two compete and whichever lands last wins.
40
+ */
41
+ onOpenAutoFocus?: (event: Event) => void;
36
42
  }
37
43
  export interface ModalHeaderClassNames {
38
44
  root?: string;
@@ -33,6 +33,12 @@ export interface ModalContainerProps {
33
33
  "aria-label"?: string;
34
34
  /** ID of the element that labels the dialog shell. */
35
35
  "aria-labelledby"?: string;
36
+ /**
37
+ * Runs when the dialog takes focus on open. Call `preventDefault()` to stop
38
+ * Radix focusing the first tabbable element and place focus yourself — without
39
+ * it the two compete and whichever lands last wins.
40
+ */
41
+ onOpenAutoFocus?: (event: Event) => void;
36
42
  }
37
43
  export interface ModalHeaderClassNames {
38
44
  root?: string;
@@ -115,7 +115,18 @@ export declare const buildLiveRouteCards: ({ labels, quoteData, tradeSide, event
115
115
  * "ok" + real quoteId) sits in the same response — default to that solo so a
116
116
  * Kalshi-funded user with no on-chain balance lands on a submittable route.
117
117
  */
118
- export declare const resolveDefaultRouteCardId: (routeCards: PlaceOrderRouteCard[], primaryStatus?: SmartRouteResponse["status"]) => string | null;
118
+ /** Whether executing this route needs a Kalshi account, alone or as a split leg. */
119
+ export declare const routeCardRequiresKalshi: (card: PlaceOrderRouteCard) => boolean;
120
+ export declare const resolveDefaultRouteCardId: (routeCards: PlaceOrderRouteCard[], primaryStatus?: SmartRouteResponse["status"], options?: {
121
+ /**
122
+ * The user has no Kalshi account connected. Kalshi routes stay selectable,
123
+ * but the default skips to the best route that does not need Kalshi — even
124
+ * one that cannot execute yet (e.g. no balance), since a Kalshi route cannot
125
+ * execute either until the user connects. Kalshi is the default only when
126
+ * every route needs it.
127
+ */
128
+ isKalshiDisconnected?: boolean;
129
+ }) => string | null;
119
130
  /** Stable identity for preserving only an explicit venue choice across quote-ID refreshes. */
120
131
  export declare const getPlaceOrderRouteCardIdentity: (card: PlaceOrderRouteCard) => string;
121
132
  export declare const clampSellSharesToAvailability: (requestedSellShares: number, availableShares: number) => number;
@@ -115,7 +115,18 @@ export declare const buildLiveRouteCards: ({ labels, quoteData, tradeSide, event
115
115
  * "ok" + real quoteId) sits in the same response — default to that solo so a
116
116
  * Kalshi-funded user with no on-chain balance lands on a submittable route.
117
117
  */
118
- export declare const resolveDefaultRouteCardId: (routeCards: PlaceOrderRouteCard[], primaryStatus?: SmartRouteResponse["status"]) => string | null;
118
+ /** Whether executing this route needs a Kalshi account, alone or as a split leg. */
119
+ export declare const routeCardRequiresKalshi: (card: PlaceOrderRouteCard) => boolean;
120
+ export declare const resolveDefaultRouteCardId: (routeCards: PlaceOrderRouteCard[], primaryStatus?: SmartRouteResponse["status"], options?: {
121
+ /**
122
+ * The user has no Kalshi account connected. Kalshi routes stay selectable,
123
+ * but the default skips to the best route that does not need Kalshi — even
124
+ * one that cannot execute yet (e.g. no balance), since a Kalshi route cannot
125
+ * execute either until the user connects. Kalshi is the default only when
126
+ * every route needs it.
127
+ */
128
+ isKalshiDisconnected?: boolean;
129
+ }) => string | null;
119
130
  /** Stable identity for preserving only an explicit venue choice across quote-ID refreshes. */
120
131
  export declare const getPlaceOrderRouteCardIdentity: (card: PlaceOrderRouteCard) => string;
121
132
  export declare const clampSellSharesToAvailability: (requestedSellShares: number, availableShares: number) => number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agg-build/ui",
3
- "version": "4.17.0",
3
+ "version": "4.17.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,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.17.0",
104
- "@agg-build/sdk": "^4.17.0"
103
+ "@agg-build/hooks": "^4.17.2",
104
+ "@agg-build/sdk": "^4.17.1"
105
105
  },
106
106
  "dependencies": {
107
107
  "@number-flow/react": "^0.6.0",