@liberfi.io/ui-predict 0.1.146 → 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.
- package/README.md +18 -0
- package/dist/index.d.mts +105 -15
- package/dist/index.d.ts +105 -15
- package/dist/index.js +13 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
package/README.md
CHANGED
|
@@ -67,6 +67,24 @@ These props enable framework-agnostic route link rendering and prefetching:
|
|
|
67
67
|
| `EventDetailUI` | `event`, `series`, `candlesticks`, `chartRange`, ... | Pure presentation for event detail. |
|
|
68
68
|
| `EventDetailSkeleton` | `marketCount?` | Loading skeleton for the detail page. |
|
|
69
69
|
|
|
70
|
+
### Components — Matches (cross-platform pairs, v1.1)
|
|
71
|
+
|
|
72
|
+
| Component | Key Props | Description |
|
|
73
|
+
| ----------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
74
|
+
| `MatchesPage` | `onSelectMatch`, `getMatchHref`, `onHover`, `LinkComponent`, `bgImageSrc` | Full Matches page (hero + filter bar + virtualized card list). v1.1 cards have **no Buy CTA**. |
|
|
75
|
+
| `MatchesWidget` | `sortBy`, `sortAsc`, `minVolume`, `signal`, `onSelectMatch`, `getMatchHref` | Container that wires `useInfiniteMatchMarkets` to the card list and surfaces the new `signal` filter param. |
|
|
76
|
+
| `MatchMarketCard` | `match: MatchMarketFlat`, `onSelectMatch`, `getMatchHref` | Single pair card. Body click → internal pair detail. Each leg renders a small external link icon to the original platform via `leg.external_url`. |
|
|
77
|
+
|
|
78
|
+
> v1.1 deprecates the old `onSelect` / `getMarketHref` props (they took a `(match, source)` pair and routed straight to the source platform). The new `onSelectMatch(match)` is the primary action; per-leg external links are intrinsic to the card and use `leg.external_url`.
|
|
79
|
+
|
|
80
|
+
#### v1.1 visual changes
|
|
81
|
+
|
|
82
|
+
- **GAP** label replaces "Spread" — represents `|A.best_price − B.best_price|` with no fee adjustment.
|
|
83
|
+
- **SignalBadge** (`liquid_gap` / `active_gap` / `stale_gap` / `stale_data`) replaces the old confidence tier dot.
|
|
84
|
+
- **Per-leg freshness dots** (`fresh` / `aging` / `stale`) appear next to each platform name based on `leg.age_seconds`.
|
|
85
|
+
- **Compact relative age** is shown in the card footer.
|
|
86
|
+
- **External link icon** per leg opens the source-platform URL in a new tab; no Buy CTA is rendered.
|
|
87
|
+
|
|
70
88
|
### Components — Trading
|
|
71
89
|
|
|
72
90
|
| Component | Description |
|
package/dist/index.d.mts
CHANGED
|
@@ -13,7 +13,7 @@ declare global {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
declare const _default: "0.1
|
|
16
|
+
declare const _default: "1.0.1";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* A single category entry in the static navigation model.
|
|
@@ -132,8 +132,14 @@ interface EventsPageProps {
|
|
|
132
132
|
onHover?: (event: PredictEvent) => void;
|
|
133
133
|
/** Optional background image for the Hero area. */
|
|
134
134
|
bgImageSrc?: string;
|
|
135
|
+
/**
|
|
136
|
+
* Forwarded to the underlying trade modal: invoked when the user attempts
|
|
137
|
+
* to buy with an amount exceeding the available USDC balance for the
|
|
138
|
+
* market's source. Use this to open a Fund Wallet / deposit flow.
|
|
139
|
+
*/
|
|
140
|
+
onInsufficientBalance?: (source: ProviderSource) => void;
|
|
135
141
|
}
|
|
136
|
-
declare function EventsPage({ onSelect, onSelectOutcome, getEventHref, LinkComponent, onHover, bgImageSrc: _bgImageSrc, }: EventsPageProps): react_jsx_runtime.JSX.Element;
|
|
142
|
+
declare function EventsPage({ onSelect, onSelectOutcome, getEventHref, LinkComponent, onHover, bgImageSrc: _bgImageSrc, onInsufficientBalance, }: EventsPageProps): react_jsx_runtime.JSX.Element;
|
|
137
143
|
|
|
138
144
|
interface EventsWidgetProps {
|
|
139
145
|
/** Category / tag selection from the categories widget. */
|
|
@@ -258,8 +264,15 @@ interface EventDetailPageProps {
|
|
|
258
264
|
event: PredictEvent;
|
|
259
265
|
walletAddress?: string;
|
|
260
266
|
}) => React.ReactNode;
|
|
267
|
+
/**
|
|
268
|
+
* Forwarded to the inline TradeFormWidget and the mobile trade modal:
|
|
269
|
+
* invoked when the user attempts to buy with an amount exceeding the
|
|
270
|
+
* available USDC balance for the market's source. Use this to open a Fund
|
|
271
|
+
* Wallet / deposit flow.
|
|
272
|
+
*/
|
|
273
|
+
onInsufficientBalance?: (source: ProviderSource) => void;
|
|
261
274
|
}
|
|
262
|
-
declare function EventDetailPage({ eventSlug, source, chain, walletAddress, onSimilarEventClick, onSimilarEventHover, onBack, renderActivitySection, }: EventDetailPageProps): react_jsx_runtime.JSX.Element;
|
|
275
|
+
declare function EventDetailPage({ eventSlug, source, chain, walletAddress, onSimilarEventClick, onSimilarEventHover, onBack, renderActivitySection, onInsufficientBalance, }: EventDetailPageProps): react_jsx_runtime.JSX.Element;
|
|
263
276
|
|
|
264
277
|
type TradeOutcome = "yes" | "no";
|
|
265
278
|
type TradeSide = "buy" | "sell";
|
|
@@ -301,6 +314,14 @@ interface UseTradeFormParams {
|
|
|
301
314
|
market: PredictMarket;
|
|
302
315
|
chain?: string;
|
|
303
316
|
initialOutcome?: TradeOutcome;
|
|
317
|
+
/**
|
|
318
|
+
* Callback fired when the user attempts to submit a buy with an amount
|
|
319
|
+
* larger than the available USDC balance for the market's source. The
|
|
320
|
+
* consumer typically uses this to open a "Fund wallet" / Deposit flow.
|
|
321
|
+
* The callback is invoked BEFORE the inline validation errors are shown,
|
|
322
|
+
* giving the consumer a chance to redirect the user to a top-up flow.
|
|
323
|
+
*/
|
|
324
|
+
onInsufficientBalance?: (source: ProviderSource) => void;
|
|
304
325
|
}
|
|
305
326
|
interface UseTradeFormResult {
|
|
306
327
|
outcome: TradeOutcome;
|
|
@@ -316,6 +337,10 @@ interface UseTradeFormResult {
|
|
|
316
337
|
isMarketDataLoading: boolean;
|
|
317
338
|
isSubmitting: boolean;
|
|
318
339
|
validation: TradeFormValidation;
|
|
340
|
+
/** True when the user has entered an amount that exceeds the available USDC balance. */
|
|
341
|
+
isInsufficientBalance: boolean;
|
|
342
|
+
/** The provider source for this market, useful to map to the right wallet. */
|
|
343
|
+
source: ProviderSource;
|
|
319
344
|
supportsLimitOrder: boolean;
|
|
320
345
|
kycRequired: boolean;
|
|
321
346
|
kycUrl: string | null;
|
|
@@ -332,8 +357,14 @@ interface UseTradeFormResult {
|
|
|
332
357
|
setCustomDuration: (v: number) => void;
|
|
333
358
|
setCustomDurationUnit: (u: DurationUnit) => void;
|
|
334
359
|
submit: () => void;
|
|
360
|
+
/**
|
|
361
|
+
* Notify the consumer about an insufficient-balance attempt. The hook
|
|
362
|
+
* forwards the configured `onInsufficientBalance` callback (if any) so the
|
|
363
|
+
* UI layer can call it without re-threading the option from the consumer.
|
|
364
|
+
*/
|
|
365
|
+
notifyInsufficientBalance: () => void;
|
|
335
366
|
}
|
|
336
|
-
declare function useTradeForm({ market, initialOutcome, }: UseTradeFormParams): UseTradeFormResult;
|
|
367
|
+
declare function useTradeForm({ market, initialOutcome, onInsufficientBalance, }: UseTradeFormParams): UseTradeFormResult;
|
|
337
368
|
|
|
338
369
|
interface EventDetailUIProps {
|
|
339
370
|
event: PredictEvent;
|
|
@@ -455,6 +486,11 @@ type PredictTradeModalParams = {
|
|
|
455
486
|
market: PredictMarket;
|
|
456
487
|
initialOutcome?: TradeOutcome;
|
|
457
488
|
chain?: string;
|
|
489
|
+
/**
|
|
490
|
+
* Called when the user presses Buy with insufficient USDC balance for the
|
|
491
|
+
* market's source. Allows the consumer to open a Fund Wallet flow.
|
|
492
|
+
*/
|
|
493
|
+
onInsufficientBalance?: (source: ProviderSource) => void;
|
|
458
494
|
};
|
|
459
495
|
type PredictTradeModalResult = void;
|
|
460
496
|
declare const PREDICT_TRADE_MODAL_ID = "predict-trade";
|
|
@@ -498,6 +534,10 @@ interface TradeFormUIProps {
|
|
|
498
534
|
isBalanceLoading: boolean;
|
|
499
535
|
isValid: boolean;
|
|
500
536
|
validationErrors: string[];
|
|
537
|
+
/** When true, pressing submit triggers the insufficient-balance handler (e.g. open Fund Wallet) instead of showing inline errors. */
|
|
538
|
+
isInsufficientBalance: boolean;
|
|
539
|
+
/** Invoked when the user presses submit while balance is insufficient. */
|
|
540
|
+
onInsufficientBalance?: () => void;
|
|
501
541
|
supportsLimitOrder: boolean;
|
|
502
542
|
kycRequired: boolean;
|
|
503
543
|
kycUrl: string | null;
|
|
@@ -515,7 +555,7 @@ interface TradeFormUIProps {
|
|
|
515
555
|
onCustomDurationUnitChange: (u: DurationUnit) => void;
|
|
516
556
|
onSubmit: () => void;
|
|
517
557
|
}
|
|
518
|
-
declare function TradeFormUI({ event, market, variant, outcome, orderType, quantity, limitPrice, shares, potentialProfit, potentialPayout, estimatedCost, usdcBalance, isBalanceLoading, isMarketDataLoading, isSubmitting, isValid, validationErrors, supportsLimitOrder, kycRequired, kycUrl, expirationEnabled, expirationPreset, customDuration, customDurationUnit, onOutcomeChange, onOrderTypeChange, onQuantityChange, onLimitPriceChange, onExpirationEnabledChange, onExpirationPresetChange, onCustomDurationChange, onCustomDurationUnitChange, onSubmit, }: TradeFormUIProps): react_jsx_runtime.JSX.Element;
|
|
558
|
+
declare function TradeFormUI({ event, market, variant, outcome, orderType, quantity, limitPrice, shares, potentialProfit, potentialPayout, estimatedCost, usdcBalance, isBalanceLoading, isMarketDataLoading, isSubmitting, isValid, validationErrors, isInsufficientBalance, onInsufficientBalance, supportsLimitOrder, kycRequired, kycUrl, expirationEnabled, expirationPreset, customDuration, customDurationUnit, onOutcomeChange, onOrderTypeChange, onQuantityChange, onLimitPriceChange, onExpirationEnabledChange, onExpirationPresetChange, onCustomDurationChange, onCustomDurationUnitChange, onSubmit, }: TradeFormUIProps): react_jsx_runtime.JSX.Element;
|
|
519
559
|
|
|
520
560
|
interface TradeFormWidgetProps {
|
|
521
561
|
event?: PredictEvent;
|
|
@@ -523,8 +563,14 @@ interface TradeFormWidgetProps {
|
|
|
523
563
|
variant?: "bordered" | "flat";
|
|
524
564
|
initialOutcome?: TradeOutcome;
|
|
525
565
|
chain?: string;
|
|
566
|
+
/**
|
|
567
|
+
* Called when the user presses Buy with an amount larger than the available
|
|
568
|
+
* USDC balance for the market's source. Use this to show a top-up flow
|
|
569
|
+
* (e.g. open a Fund Wallet modal pre-selected for the right chain).
|
|
570
|
+
*/
|
|
571
|
+
onInsufficientBalance?: (source: ProviderSource) => void;
|
|
526
572
|
}
|
|
527
|
-
declare function TradeFormWidget({ event, market, variant, initialOutcome, chain, }: TradeFormWidgetProps): react_jsx_runtime.JSX.Element;
|
|
573
|
+
declare function TradeFormWidget({ event, market, variant, initialOutcome, chain, onInsufficientBalance, }: TradeFormWidgetProps): react_jsx_runtime.JSX.Element;
|
|
528
574
|
|
|
529
575
|
type PredictSellModalParams = {
|
|
530
576
|
event: PredictEvent;
|
|
@@ -831,18 +877,24 @@ type SearchWidgetProps = {
|
|
|
831
877
|
declare function SearchWidget({ onKeywordChange, onSelectEvent, getEventHref, LinkComponent, onHover, onEscape, source, }: SearchWidgetProps): react_jsx_runtime.JSX.Element;
|
|
832
878
|
|
|
833
879
|
interface MatchesPageProps {
|
|
834
|
-
|
|
880
|
+
/** v1.1: invoked when the user clicks the card body (internal pair detail). */
|
|
881
|
+
onSelectMatch?: (match: MatchMarketFlat) => void;
|
|
882
|
+
/** v1.1: returns the internal pair detail href for the card link. */
|
|
883
|
+
getMatchHref?: (match: MatchMarketFlat) => string | undefined;
|
|
835
884
|
onHover?: (match: MatchMarketFlat) => void;
|
|
885
|
+
/** @deprecated v1.1 — use `onSelectMatch`. */
|
|
886
|
+
onSelect?: (match: MatchMarketFlat, source: ProviderSource) => void;
|
|
887
|
+
/** @deprecated v1.1 — fallback only; per-leg `external_url` is preferred. */
|
|
836
888
|
getMarketHref?: (match: MatchMarketFlat, source: ProviderSource) => string | undefined;
|
|
837
889
|
LinkComponent?: LinkComponentType;
|
|
838
890
|
/** Path to the hero background image (e.g. "/matches-bg.webp") */
|
|
839
891
|
bgImageSrc?: string;
|
|
840
|
-
/** @deprecated Use
|
|
892
|
+
/** @deprecated Use onSelectMatch instead */
|
|
841
893
|
onSelectEntry?: (event: never) => void;
|
|
842
|
-
/** @deprecated Use
|
|
894
|
+
/** @deprecated Use getMatchHref instead */
|
|
843
895
|
getEventHref?: (event: never) => string;
|
|
844
896
|
}
|
|
845
|
-
declare function MatchesPage({
|
|
897
|
+
declare function MatchesPage({ onSelectMatch, getMatchHref, onHover, onSelect, getMarketHref, LinkComponent, bgImageSrc, }: MatchesPageProps): react_jsx_runtime.JSX.Element;
|
|
846
898
|
|
|
847
899
|
interface MatchesHeroStats {
|
|
848
900
|
activePairs: number;
|
|
@@ -862,14 +914,25 @@ interface MatchesWidgetProps {
|
|
|
862
914
|
sortBy: MatchSortField;
|
|
863
915
|
sortAsc: boolean;
|
|
864
916
|
minVolume?: number;
|
|
865
|
-
|
|
917
|
+
/**
|
|
918
|
+
* v1.1: comma-separated `signal_tag` filter (e.g. `"liquid_gap,active_gap"`).
|
|
919
|
+
* Pass `"any"` or omit to disable signal filtering.
|
|
920
|
+
*/
|
|
921
|
+
signal?: string;
|
|
922
|
+
/** v1.1: card-body click → internal pair detail. */
|
|
923
|
+
onSelectMatch?: (match: MatchMarketFlat) => void;
|
|
924
|
+
/** v1.1: returns internal pair detail href. */
|
|
925
|
+
getMatchHref?: (match: MatchMarketFlat) => string | undefined;
|
|
866
926
|
onHover?: (match: MatchMarketFlat) => void;
|
|
927
|
+
/** @deprecated v1.1 — use `onSelectMatch`. */
|
|
928
|
+
onSelect?: (match: MatchMarketFlat, source: ProviderSource) => void;
|
|
929
|
+
/** @deprecated v1.1 — fallback only when `leg.external_url` is missing. */
|
|
867
930
|
getMarketHref?: (match: MatchMarketFlat, source: ProviderSource) => string | undefined;
|
|
868
931
|
LinkComponent?: LinkComponentType;
|
|
869
932
|
onStatsChange?: (stats: MatchesHeroStats) => void;
|
|
870
|
-
/** @deprecated Use
|
|
933
|
+
/** @deprecated Use onSelectMatch instead */
|
|
871
934
|
onSelectEntry?: (event: never) => void;
|
|
872
|
-
/** @deprecated Use
|
|
935
|
+
/** @deprecated Use getMatchHref instead */
|
|
873
936
|
getEventHref?: (event: never) => string;
|
|
874
937
|
}
|
|
875
938
|
declare const MatchesWidget: react.ForwardRefExoticComponent<MatchesWidgetProps & react.RefAttributes<MatchesWidgetRef>>;
|
|
@@ -882,14 +945,41 @@ interface MatchGroupCardProps {
|
|
|
882
945
|
}
|
|
883
946
|
declare function MatchGroupCard({ group, onSelectEntry, getEventHref, LinkComponent, }: MatchGroupCardProps): react_jsx_runtime.JSX.Element;
|
|
884
947
|
|
|
948
|
+
/**
|
|
949
|
+
* Props for the v1.1 match card.
|
|
950
|
+
*
|
|
951
|
+
* v1.1 changes (PRD §5):
|
|
952
|
+
* - Card click now navigates to the internal pair detail page
|
|
953
|
+
* (`getMatchHref` / `onSelectMatch`); the legacy "Buy on Platform"
|
|
954
|
+
* CTA was removed because it implied execution which the platform
|
|
955
|
+
* does not perform.
|
|
956
|
+
* - Each leg renders a small external-link icon that deep-links to the
|
|
957
|
+
* original provider's market page (`leg.external_url`, with
|
|
958
|
+
* `getMarketHref(match, source)` as backward-compat fallback).
|
|
959
|
+
* - `SignalBadge` replaces the confidence-tier dot and is sourced from
|
|
960
|
+
* `match.signal_tag`.
|
|
961
|
+
*/
|
|
885
962
|
interface MatchMarketCardProps {
|
|
886
963
|
match: MatchMarketFlat;
|
|
887
|
-
|
|
964
|
+
/** v1.1: invoked when the user clicks the card body (internal detail). */
|
|
965
|
+
onSelectMatch?: (match: MatchMarketFlat) => void;
|
|
966
|
+
/** v1.1: returns the internal pair detail href; renders card as a link. */
|
|
967
|
+
getMatchHref?: (match: MatchMarketFlat) => string | undefined;
|
|
888
968
|
onHover?: (match: MatchMarketFlat) => void;
|
|
969
|
+
/**
|
|
970
|
+
* @deprecated v1.1 — kept for source compatibility. Used as a fallback
|
|
971
|
+
* when `match.legs[*].external_url` is missing.
|
|
972
|
+
*/
|
|
889
973
|
getMarketHref?: (match: MatchMarketFlat, source: ProviderSource) => string | undefined;
|
|
974
|
+
/**
|
|
975
|
+
* @deprecated v1.1 — the "buy on cheaper platform" affordance was
|
|
976
|
+
* removed (PRD §5.4). Per-leg clicks now open the provider page in a
|
|
977
|
+
* new tab via the external-link icon, no callback required.
|
|
978
|
+
*/
|
|
979
|
+
onSelect?: (match: MatchMarketFlat, source: ProviderSource) => void;
|
|
890
980
|
LinkComponent?: LinkComponentType;
|
|
891
981
|
}
|
|
892
|
-
declare function MatchMarketCard({ match,
|
|
982
|
+
declare function MatchMarketCard({ match, onSelectMatch, getMatchHref, onHover, getMarketHref, LinkComponent, }: MatchMarketCardProps): react_jsx_runtime.JSX.Element | null;
|
|
893
983
|
|
|
894
984
|
interface MatchesStatsBarProps {
|
|
895
985
|
matches: MatchGroup[];
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ declare global {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
declare const _default: "0.1
|
|
16
|
+
declare const _default: "1.0.1";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* A single category entry in the static navigation model.
|
|
@@ -132,8 +132,14 @@ interface EventsPageProps {
|
|
|
132
132
|
onHover?: (event: PredictEvent) => void;
|
|
133
133
|
/** Optional background image for the Hero area. */
|
|
134
134
|
bgImageSrc?: string;
|
|
135
|
+
/**
|
|
136
|
+
* Forwarded to the underlying trade modal: invoked when the user attempts
|
|
137
|
+
* to buy with an amount exceeding the available USDC balance for the
|
|
138
|
+
* market's source. Use this to open a Fund Wallet / deposit flow.
|
|
139
|
+
*/
|
|
140
|
+
onInsufficientBalance?: (source: ProviderSource) => void;
|
|
135
141
|
}
|
|
136
|
-
declare function EventsPage({ onSelect, onSelectOutcome, getEventHref, LinkComponent, onHover, bgImageSrc: _bgImageSrc, }: EventsPageProps): react_jsx_runtime.JSX.Element;
|
|
142
|
+
declare function EventsPage({ onSelect, onSelectOutcome, getEventHref, LinkComponent, onHover, bgImageSrc: _bgImageSrc, onInsufficientBalance, }: EventsPageProps): react_jsx_runtime.JSX.Element;
|
|
137
143
|
|
|
138
144
|
interface EventsWidgetProps {
|
|
139
145
|
/** Category / tag selection from the categories widget. */
|
|
@@ -258,8 +264,15 @@ interface EventDetailPageProps {
|
|
|
258
264
|
event: PredictEvent;
|
|
259
265
|
walletAddress?: string;
|
|
260
266
|
}) => React.ReactNode;
|
|
267
|
+
/**
|
|
268
|
+
* Forwarded to the inline TradeFormWidget and the mobile trade modal:
|
|
269
|
+
* invoked when the user attempts to buy with an amount exceeding the
|
|
270
|
+
* available USDC balance for the market's source. Use this to open a Fund
|
|
271
|
+
* Wallet / deposit flow.
|
|
272
|
+
*/
|
|
273
|
+
onInsufficientBalance?: (source: ProviderSource) => void;
|
|
261
274
|
}
|
|
262
|
-
declare function EventDetailPage({ eventSlug, source, chain, walletAddress, onSimilarEventClick, onSimilarEventHover, onBack, renderActivitySection, }: EventDetailPageProps): react_jsx_runtime.JSX.Element;
|
|
275
|
+
declare function EventDetailPage({ eventSlug, source, chain, walletAddress, onSimilarEventClick, onSimilarEventHover, onBack, renderActivitySection, onInsufficientBalance, }: EventDetailPageProps): react_jsx_runtime.JSX.Element;
|
|
263
276
|
|
|
264
277
|
type TradeOutcome = "yes" | "no";
|
|
265
278
|
type TradeSide = "buy" | "sell";
|
|
@@ -301,6 +314,14 @@ interface UseTradeFormParams {
|
|
|
301
314
|
market: PredictMarket;
|
|
302
315
|
chain?: string;
|
|
303
316
|
initialOutcome?: TradeOutcome;
|
|
317
|
+
/**
|
|
318
|
+
* Callback fired when the user attempts to submit a buy with an amount
|
|
319
|
+
* larger than the available USDC balance for the market's source. The
|
|
320
|
+
* consumer typically uses this to open a "Fund wallet" / Deposit flow.
|
|
321
|
+
* The callback is invoked BEFORE the inline validation errors are shown,
|
|
322
|
+
* giving the consumer a chance to redirect the user to a top-up flow.
|
|
323
|
+
*/
|
|
324
|
+
onInsufficientBalance?: (source: ProviderSource) => void;
|
|
304
325
|
}
|
|
305
326
|
interface UseTradeFormResult {
|
|
306
327
|
outcome: TradeOutcome;
|
|
@@ -316,6 +337,10 @@ interface UseTradeFormResult {
|
|
|
316
337
|
isMarketDataLoading: boolean;
|
|
317
338
|
isSubmitting: boolean;
|
|
318
339
|
validation: TradeFormValidation;
|
|
340
|
+
/** True when the user has entered an amount that exceeds the available USDC balance. */
|
|
341
|
+
isInsufficientBalance: boolean;
|
|
342
|
+
/** The provider source for this market, useful to map to the right wallet. */
|
|
343
|
+
source: ProviderSource;
|
|
319
344
|
supportsLimitOrder: boolean;
|
|
320
345
|
kycRequired: boolean;
|
|
321
346
|
kycUrl: string | null;
|
|
@@ -332,8 +357,14 @@ interface UseTradeFormResult {
|
|
|
332
357
|
setCustomDuration: (v: number) => void;
|
|
333
358
|
setCustomDurationUnit: (u: DurationUnit) => void;
|
|
334
359
|
submit: () => void;
|
|
360
|
+
/**
|
|
361
|
+
* Notify the consumer about an insufficient-balance attempt. The hook
|
|
362
|
+
* forwards the configured `onInsufficientBalance` callback (if any) so the
|
|
363
|
+
* UI layer can call it without re-threading the option from the consumer.
|
|
364
|
+
*/
|
|
365
|
+
notifyInsufficientBalance: () => void;
|
|
335
366
|
}
|
|
336
|
-
declare function useTradeForm({ market, initialOutcome, }: UseTradeFormParams): UseTradeFormResult;
|
|
367
|
+
declare function useTradeForm({ market, initialOutcome, onInsufficientBalance, }: UseTradeFormParams): UseTradeFormResult;
|
|
337
368
|
|
|
338
369
|
interface EventDetailUIProps {
|
|
339
370
|
event: PredictEvent;
|
|
@@ -455,6 +486,11 @@ type PredictTradeModalParams = {
|
|
|
455
486
|
market: PredictMarket;
|
|
456
487
|
initialOutcome?: TradeOutcome;
|
|
457
488
|
chain?: string;
|
|
489
|
+
/**
|
|
490
|
+
* Called when the user presses Buy with insufficient USDC balance for the
|
|
491
|
+
* market's source. Allows the consumer to open a Fund Wallet flow.
|
|
492
|
+
*/
|
|
493
|
+
onInsufficientBalance?: (source: ProviderSource) => void;
|
|
458
494
|
};
|
|
459
495
|
type PredictTradeModalResult = void;
|
|
460
496
|
declare const PREDICT_TRADE_MODAL_ID = "predict-trade";
|
|
@@ -498,6 +534,10 @@ interface TradeFormUIProps {
|
|
|
498
534
|
isBalanceLoading: boolean;
|
|
499
535
|
isValid: boolean;
|
|
500
536
|
validationErrors: string[];
|
|
537
|
+
/** When true, pressing submit triggers the insufficient-balance handler (e.g. open Fund Wallet) instead of showing inline errors. */
|
|
538
|
+
isInsufficientBalance: boolean;
|
|
539
|
+
/** Invoked when the user presses submit while balance is insufficient. */
|
|
540
|
+
onInsufficientBalance?: () => void;
|
|
501
541
|
supportsLimitOrder: boolean;
|
|
502
542
|
kycRequired: boolean;
|
|
503
543
|
kycUrl: string | null;
|
|
@@ -515,7 +555,7 @@ interface TradeFormUIProps {
|
|
|
515
555
|
onCustomDurationUnitChange: (u: DurationUnit) => void;
|
|
516
556
|
onSubmit: () => void;
|
|
517
557
|
}
|
|
518
|
-
declare function TradeFormUI({ event, market, variant, outcome, orderType, quantity, limitPrice, shares, potentialProfit, potentialPayout, estimatedCost, usdcBalance, isBalanceLoading, isMarketDataLoading, isSubmitting, isValid, validationErrors, supportsLimitOrder, kycRequired, kycUrl, expirationEnabled, expirationPreset, customDuration, customDurationUnit, onOutcomeChange, onOrderTypeChange, onQuantityChange, onLimitPriceChange, onExpirationEnabledChange, onExpirationPresetChange, onCustomDurationChange, onCustomDurationUnitChange, onSubmit, }: TradeFormUIProps): react_jsx_runtime.JSX.Element;
|
|
558
|
+
declare function TradeFormUI({ event, market, variant, outcome, orderType, quantity, limitPrice, shares, potentialProfit, potentialPayout, estimatedCost, usdcBalance, isBalanceLoading, isMarketDataLoading, isSubmitting, isValid, validationErrors, isInsufficientBalance, onInsufficientBalance, supportsLimitOrder, kycRequired, kycUrl, expirationEnabled, expirationPreset, customDuration, customDurationUnit, onOutcomeChange, onOrderTypeChange, onQuantityChange, onLimitPriceChange, onExpirationEnabledChange, onExpirationPresetChange, onCustomDurationChange, onCustomDurationUnitChange, onSubmit, }: TradeFormUIProps): react_jsx_runtime.JSX.Element;
|
|
519
559
|
|
|
520
560
|
interface TradeFormWidgetProps {
|
|
521
561
|
event?: PredictEvent;
|
|
@@ -523,8 +563,14 @@ interface TradeFormWidgetProps {
|
|
|
523
563
|
variant?: "bordered" | "flat";
|
|
524
564
|
initialOutcome?: TradeOutcome;
|
|
525
565
|
chain?: string;
|
|
566
|
+
/**
|
|
567
|
+
* Called when the user presses Buy with an amount larger than the available
|
|
568
|
+
* USDC balance for the market's source. Use this to show a top-up flow
|
|
569
|
+
* (e.g. open a Fund Wallet modal pre-selected for the right chain).
|
|
570
|
+
*/
|
|
571
|
+
onInsufficientBalance?: (source: ProviderSource) => void;
|
|
526
572
|
}
|
|
527
|
-
declare function TradeFormWidget({ event, market, variant, initialOutcome, chain, }: TradeFormWidgetProps): react_jsx_runtime.JSX.Element;
|
|
573
|
+
declare function TradeFormWidget({ event, market, variant, initialOutcome, chain, onInsufficientBalance, }: TradeFormWidgetProps): react_jsx_runtime.JSX.Element;
|
|
528
574
|
|
|
529
575
|
type PredictSellModalParams = {
|
|
530
576
|
event: PredictEvent;
|
|
@@ -831,18 +877,24 @@ type SearchWidgetProps = {
|
|
|
831
877
|
declare function SearchWidget({ onKeywordChange, onSelectEvent, getEventHref, LinkComponent, onHover, onEscape, source, }: SearchWidgetProps): react_jsx_runtime.JSX.Element;
|
|
832
878
|
|
|
833
879
|
interface MatchesPageProps {
|
|
834
|
-
|
|
880
|
+
/** v1.1: invoked when the user clicks the card body (internal pair detail). */
|
|
881
|
+
onSelectMatch?: (match: MatchMarketFlat) => void;
|
|
882
|
+
/** v1.1: returns the internal pair detail href for the card link. */
|
|
883
|
+
getMatchHref?: (match: MatchMarketFlat) => string | undefined;
|
|
835
884
|
onHover?: (match: MatchMarketFlat) => void;
|
|
885
|
+
/** @deprecated v1.1 — use `onSelectMatch`. */
|
|
886
|
+
onSelect?: (match: MatchMarketFlat, source: ProviderSource) => void;
|
|
887
|
+
/** @deprecated v1.1 — fallback only; per-leg `external_url` is preferred. */
|
|
836
888
|
getMarketHref?: (match: MatchMarketFlat, source: ProviderSource) => string | undefined;
|
|
837
889
|
LinkComponent?: LinkComponentType;
|
|
838
890
|
/** Path to the hero background image (e.g. "/matches-bg.webp") */
|
|
839
891
|
bgImageSrc?: string;
|
|
840
|
-
/** @deprecated Use
|
|
892
|
+
/** @deprecated Use onSelectMatch instead */
|
|
841
893
|
onSelectEntry?: (event: never) => void;
|
|
842
|
-
/** @deprecated Use
|
|
894
|
+
/** @deprecated Use getMatchHref instead */
|
|
843
895
|
getEventHref?: (event: never) => string;
|
|
844
896
|
}
|
|
845
|
-
declare function MatchesPage({
|
|
897
|
+
declare function MatchesPage({ onSelectMatch, getMatchHref, onHover, onSelect, getMarketHref, LinkComponent, bgImageSrc, }: MatchesPageProps): react_jsx_runtime.JSX.Element;
|
|
846
898
|
|
|
847
899
|
interface MatchesHeroStats {
|
|
848
900
|
activePairs: number;
|
|
@@ -862,14 +914,25 @@ interface MatchesWidgetProps {
|
|
|
862
914
|
sortBy: MatchSortField;
|
|
863
915
|
sortAsc: boolean;
|
|
864
916
|
minVolume?: number;
|
|
865
|
-
|
|
917
|
+
/**
|
|
918
|
+
* v1.1: comma-separated `signal_tag` filter (e.g. `"liquid_gap,active_gap"`).
|
|
919
|
+
* Pass `"any"` or omit to disable signal filtering.
|
|
920
|
+
*/
|
|
921
|
+
signal?: string;
|
|
922
|
+
/** v1.1: card-body click → internal pair detail. */
|
|
923
|
+
onSelectMatch?: (match: MatchMarketFlat) => void;
|
|
924
|
+
/** v1.1: returns internal pair detail href. */
|
|
925
|
+
getMatchHref?: (match: MatchMarketFlat) => string | undefined;
|
|
866
926
|
onHover?: (match: MatchMarketFlat) => void;
|
|
927
|
+
/** @deprecated v1.1 — use `onSelectMatch`. */
|
|
928
|
+
onSelect?: (match: MatchMarketFlat, source: ProviderSource) => void;
|
|
929
|
+
/** @deprecated v1.1 — fallback only when `leg.external_url` is missing. */
|
|
867
930
|
getMarketHref?: (match: MatchMarketFlat, source: ProviderSource) => string | undefined;
|
|
868
931
|
LinkComponent?: LinkComponentType;
|
|
869
932
|
onStatsChange?: (stats: MatchesHeroStats) => void;
|
|
870
|
-
/** @deprecated Use
|
|
933
|
+
/** @deprecated Use onSelectMatch instead */
|
|
871
934
|
onSelectEntry?: (event: never) => void;
|
|
872
|
-
/** @deprecated Use
|
|
935
|
+
/** @deprecated Use getMatchHref instead */
|
|
873
936
|
getEventHref?: (event: never) => string;
|
|
874
937
|
}
|
|
875
938
|
declare const MatchesWidget: react.ForwardRefExoticComponent<MatchesWidgetProps & react.RefAttributes<MatchesWidgetRef>>;
|
|
@@ -882,14 +945,41 @@ interface MatchGroupCardProps {
|
|
|
882
945
|
}
|
|
883
946
|
declare function MatchGroupCard({ group, onSelectEntry, getEventHref, LinkComponent, }: MatchGroupCardProps): react_jsx_runtime.JSX.Element;
|
|
884
947
|
|
|
948
|
+
/**
|
|
949
|
+
* Props for the v1.1 match card.
|
|
950
|
+
*
|
|
951
|
+
* v1.1 changes (PRD §5):
|
|
952
|
+
* - Card click now navigates to the internal pair detail page
|
|
953
|
+
* (`getMatchHref` / `onSelectMatch`); the legacy "Buy on Platform"
|
|
954
|
+
* CTA was removed because it implied execution which the platform
|
|
955
|
+
* does not perform.
|
|
956
|
+
* - Each leg renders a small external-link icon that deep-links to the
|
|
957
|
+
* original provider's market page (`leg.external_url`, with
|
|
958
|
+
* `getMarketHref(match, source)` as backward-compat fallback).
|
|
959
|
+
* - `SignalBadge` replaces the confidence-tier dot and is sourced from
|
|
960
|
+
* `match.signal_tag`.
|
|
961
|
+
*/
|
|
885
962
|
interface MatchMarketCardProps {
|
|
886
963
|
match: MatchMarketFlat;
|
|
887
|
-
|
|
964
|
+
/** v1.1: invoked when the user clicks the card body (internal detail). */
|
|
965
|
+
onSelectMatch?: (match: MatchMarketFlat) => void;
|
|
966
|
+
/** v1.1: returns the internal pair detail href; renders card as a link. */
|
|
967
|
+
getMatchHref?: (match: MatchMarketFlat) => string | undefined;
|
|
888
968
|
onHover?: (match: MatchMarketFlat) => void;
|
|
969
|
+
/**
|
|
970
|
+
* @deprecated v1.1 — kept for source compatibility. Used as a fallback
|
|
971
|
+
* when `match.legs[*].external_url` is missing.
|
|
972
|
+
*/
|
|
889
973
|
getMarketHref?: (match: MatchMarketFlat, source: ProviderSource) => string | undefined;
|
|
974
|
+
/**
|
|
975
|
+
* @deprecated v1.1 — the "buy on cheaper platform" affordance was
|
|
976
|
+
* removed (PRD §5.4). Per-leg clicks now open the provider page in a
|
|
977
|
+
* new tab via the external-link icon, no callback required.
|
|
978
|
+
*/
|
|
979
|
+
onSelect?: (match: MatchMarketFlat, source: ProviderSource) => void;
|
|
890
980
|
LinkComponent?: LinkComponentType;
|
|
891
981
|
}
|
|
892
|
-
declare function MatchMarketCard({ match,
|
|
982
|
+
declare function MatchMarketCard({ match, onSelectMatch, getMatchHref, onHover, getMarketHref, LinkComponent, }: MatchMarketCardProps): react_jsx_runtime.JSX.Element | null;
|
|
893
983
|
|
|
894
984
|
interface MatchesStatsBarProps {
|
|
895
985
|
matches: MatchGroup[];
|