@agg-build/ui 2.7.2 → 2.8.0
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-7R2SMMAG.mjs → chunk-2QCNDFNC.mjs} +193 -103
- package/dist/{chunk-EDQ64EKO.mjs → chunk-AKLGQ6AB.mjs} +254 -53
- package/dist/{chunk-FMYYPNZZ.mjs → chunk-KO6VTRV6.mjs} +101 -27
- package/dist/{chunk-AHQA3B7D.mjs → chunk-KX3TQ7WC.mjs} +1 -1
- package/dist/{chunk-EKUH3265.mjs → chunk-MKU5Q6PN.mjs} +51 -13
- package/dist/{chunk-O27JUYCF.mjs → chunk-R5S2QOYL.mjs} +495 -289
- package/dist/{chunk-JQKJDSTW.mjs → chunk-VR5ZRDQT.mjs} +3 -2
- package/dist/events.js +198 -91
- package/dist/events.mjs +3 -3
- package/dist/index.js +1350 -751
- package/dist/index.mjs +7 -7
- package/dist/modals.js +941 -418
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +1008 -609
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +94 -26
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +1403 -902
- package/dist/trading.mjs +4 -4
- package/dist/types/events/orderbook/orderbook.utils.d.mts +1 -1
- package/dist/types/events/orderbook/orderbook.utils.d.ts +1 -1
- package/dist/types/pages/user-profile/components/open-order-row.d.mts +1 -0
- package/dist/types/pages/user-profile/components/open-order-row.d.ts +1 -0
- package/dist/types/pages/user-profile/position-view-model.d.mts +15 -4
- package/dist/types/pages/user-profile/position-view-model.d.ts +15 -4
- package/dist/types/primitives/select/index.d.mts +1 -1
- package/dist/types/primitives/select/index.d.ts +1 -1
- package/dist/types/primitives/select/select.types.d.mts +8 -0
- package/dist/types/primitives/select/select.types.d.ts +8 -0
- package/dist/types/profile/profile-modal.constants.d.mts +2 -1
- package/dist/types/profile/profile-modal.constants.d.ts +2 -1
- package/dist/types/profile/tabs/balance-management-tab.d.mts +3 -0
- package/dist/types/profile/tabs/balance-management-tab.d.ts +3 -0
- package/dist/types/trading/place-order/index.place-order.constants.d.mts +2 -1
- package/dist/types/trading/place-order/index.place-order.constants.d.ts +2 -1
- package/dist/types/trading/place-order/index.place-order.types.d.mts +6 -0
- package/dist/types/trading/place-order/index.place-order.types.d.ts +6 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +10 -2
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +10 -2
- package/package.json +2 -2
|
@@ -9,12 +9,12 @@ import {
|
|
|
9
9
|
getTradingVenueLabel,
|
|
10
10
|
prepareSettlementDifferences,
|
|
11
11
|
resolveOrderEligibilityMessage
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-VR5ZRDQT.mjs";
|
|
13
13
|
import {
|
|
14
14
|
ConnectKalshiModal,
|
|
15
15
|
GeoBlockBanner,
|
|
16
16
|
subscribeAggDepositNotification
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-KX3TQ7WC.mjs";
|
|
18
18
|
import {
|
|
19
19
|
AGG_TERMS_OF_SERVICE_URL,
|
|
20
20
|
Button,
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
Modal,
|
|
29
29
|
PlaceOrderRouteCardSkeleton,
|
|
30
30
|
RemoteImage,
|
|
31
|
+
Select,
|
|
31
32
|
Skeleton,
|
|
32
33
|
Tooltip,
|
|
33
34
|
Typography,
|
|
@@ -46,7 +47,7 @@ import {
|
|
|
46
47
|
resolveResolvedOutcomeLabel,
|
|
47
48
|
skeletonViews,
|
|
48
49
|
useOptionalToast
|
|
49
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-KO6VTRV6.mjs";
|
|
50
51
|
|
|
51
52
|
// src/trading/types.ts
|
|
52
53
|
import { Venue, enumGuard, isFiniteNonNeg, safeParse } from "@agg-build/sdk";
|
|
@@ -149,6 +150,7 @@ import {
|
|
|
149
150
|
useLabels as useLabels2,
|
|
150
151
|
useLiveBestPrices,
|
|
151
152
|
useLiveOutcomePrices,
|
|
153
|
+
useLimitOrderVenueQuotes,
|
|
152
154
|
useManagedBalances,
|
|
153
155
|
useMidpoints,
|
|
154
156
|
usePlaceLimitOrder,
|
|
@@ -160,7 +162,6 @@ import {
|
|
|
160
162
|
} from "@agg-build/hooks";
|
|
161
163
|
import { Venue as Venue4 } from "@agg-build/sdk";
|
|
162
164
|
import NumberFlow from "@number-flow/react";
|
|
163
|
-
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
|
|
164
165
|
import * as Popover from "@radix-ui/react-popover";
|
|
165
166
|
import dayjs from "dayjs";
|
|
166
167
|
import timezone from "dayjs/plugin/timezone";
|
|
@@ -612,11 +613,12 @@ var MIN_SELL_ORDER_SHARES = 1;
|
|
|
612
613
|
var DEFAULT_SLIPPAGE_VALUE = "0.5";
|
|
613
614
|
var HIGH_SLIPPAGE_THRESHOLD = 10;
|
|
614
615
|
var PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT = 3;
|
|
616
|
+
var PLACE_ORDER_NUMERIC_INPUT_CLASS_NAME = "bg-transparent text-right text-agg-3xl font-agg-bold leading-agg-9 tracking-agg-normal text-agg-foreground outline-none";
|
|
615
617
|
var PLACE_ORDER_CONTAINER_CLASS_NAME = "w-full overflow-hidden rounded-agg-xl border border-agg-separator bg-agg-secondary shadow-none hover:shadow-none";
|
|
616
618
|
var PLACE_ORDER_OUTCOME_BUTTON_CLASS_NAMES = {
|
|
617
619
|
activeNegative: "border-agg-error/50 bg-agg-error/15 font-agg-bold text-agg-error",
|
|
618
620
|
activePositive: "border-agg-success/50 bg-agg-success/15 font-agg-bold text-agg-success",
|
|
619
|
-
base: "flex h-
|
|
621
|
+
base: "flex h-11 flex-1 items-center justify-center rounded-agg-full border px-6 text-agg-base leading-agg-6",
|
|
620
622
|
inactive: "border-transparent bg-agg-secondary-hover font-agg-normal text-agg-foreground hover:bg-agg-tertiary"
|
|
621
623
|
};
|
|
622
624
|
|
|
@@ -1085,6 +1087,93 @@ var routePriceLabelFormatter = new Intl.NumberFormat("en-US", {
|
|
|
1085
1087
|
maximumFractionDigits: 1
|
|
1086
1088
|
});
|
|
1087
1089
|
var GEO_BLOCK_WARNING_PREFIX = "Venue not available in your region";
|
|
1090
|
+
var normalizeOutcomeName = (value) => {
|
|
1091
|
+
var _a;
|
|
1092
|
+
return (_a = value == null ? void 0 : value.trim().toLowerCase()) != null ? _a : "";
|
|
1093
|
+
};
|
|
1094
|
+
var findMatchingVenueOutcome = (market, selectedOutcome) => {
|
|
1095
|
+
var _a, _b;
|
|
1096
|
+
const selectedNames = new Set(
|
|
1097
|
+
[selectedOutcome.label, selectedOutcome.title].map(normalizeOutcomeName).filter(Boolean)
|
|
1098
|
+
);
|
|
1099
|
+
return (_b = (_a = market.venueMarketOutcomes) == null ? void 0 : _a.find((outcome) => {
|
|
1100
|
+
const normalizedLabel = normalizeOutcomeName(outcome.label);
|
|
1101
|
+
return normalizedLabel !== "" && selectedNames.has(normalizedLabel);
|
|
1102
|
+
})) != null ? _b : null;
|
|
1103
|
+
};
|
|
1104
|
+
var buildLimitOrderVenueOptions = ({
|
|
1105
|
+
currentPrices,
|
|
1106
|
+
livePrices,
|
|
1107
|
+
market,
|
|
1108
|
+
selectedOutcomeId
|
|
1109
|
+
}) => {
|
|
1110
|
+
var _a, _b, _c, _d;
|
|
1111
|
+
if (!market || !selectedOutcomeId) return [];
|
|
1112
|
+
const selectedOutcome = market.venueMarketOutcomes.find(
|
|
1113
|
+
(outcome) => outcome.id === selectedOutcomeId
|
|
1114
|
+
);
|
|
1115
|
+
if (!selectedOutcome) return [];
|
|
1116
|
+
const options = /* @__PURE__ */ new Map();
|
|
1117
|
+
const addOption = ({
|
|
1118
|
+
outcomeId,
|
|
1119
|
+
venue,
|
|
1120
|
+
venueMarketId
|
|
1121
|
+
}) => {
|
|
1122
|
+
var _a2;
|
|
1123
|
+
const parsedVenue = parseVenue(venue);
|
|
1124
|
+
if (!parsedVenue.success || options.has(parsedVenue.data)) return;
|
|
1125
|
+
options.set(parsedVenue.data, {
|
|
1126
|
+
currentPrice: (_a2 = livePrices == null ? void 0 : livePrices.get(outcomeId)) != null ? _a2 : currentPrices.get(outcomeId),
|
|
1127
|
+
venue: parsedVenue.data,
|
|
1128
|
+
venueMarketId,
|
|
1129
|
+
venueMarketOutcomeId: outcomeId
|
|
1130
|
+
});
|
|
1131
|
+
};
|
|
1132
|
+
addOption({
|
|
1133
|
+
outcomeId: selectedOutcome.id,
|
|
1134
|
+
venue: market.venue,
|
|
1135
|
+
venueMarketId: market.id
|
|
1136
|
+
});
|
|
1137
|
+
const matchedMarketsById = new Map(
|
|
1138
|
+
((_a = market.matchedVenueMarkets) != null ? _a : []).map((matchedMarket) => [matchedMarket.id, matchedMarket])
|
|
1139
|
+
);
|
|
1140
|
+
const matchedOutcomeRefs = (_b = selectedOutcome.matchedVenueMarketOutcomes) != null ? _b : [];
|
|
1141
|
+
for (const ref of matchedOutcomeRefs) {
|
|
1142
|
+
const matchedMarket = matchedMarketsById.get(ref.venueMarketId);
|
|
1143
|
+
const matchedOutcome = (_c = matchedMarket == null ? void 0 : matchedMarket.venueMarketOutcomes) == null ? void 0 : _c.find(
|
|
1144
|
+
(outcome) => outcome.id === ref.venueMarketOutcomeId
|
|
1145
|
+
);
|
|
1146
|
+
if (!matchedMarket || !matchedOutcome) continue;
|
|
1147
|
+
addOption({
|
|
1148
|
+
outcomeId: matchedOutcome.id,
|
|
1149
|
+
venue: matchedMarket.venue,
|
|
1150
|
+
venueMarketId: matchedMarket.id
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
if (matchedOutcomeRefs.length === 0) {
|
|
1154
|
+
for (const matchedMarket of (_d = market.matchedVenueMarkets) != null ? _d : []) {
|
|
1155
|
+
const matchedOutcome = findMatchingVenueOutcome(matchedMarket, selectedOutcome);
|
|
1156
|
+
if (!matchedOutcome) continue;
|
|
1157
|
+
addOption({
|
|
1158
|
+
outcomeId: matchedOutcome.id,
|
|
1159
|
+
venue: matchedMarket.venue,
|
|
1160
|
+
venueMarketId: matchedMarket.id
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
return [...options.values()];
|
|
1165
|
+
};
|
|
1166
|
+
var resolveAutomaticLimitOrderVenueOption = (options, side) => {
|
|
1167
|
+
if (options.length === 0) return null;
|
|
1168
|
+
return [...options].sort((left, right) => {
|
|
1169
|
+
if (left.currentPrice == null && right.currentPrice == null) {
|
|
1170
|
+
return left.venue.localeCompare(right.venue);
|
|
1171
|
+
}
|
|
1172
|
+
if (left.currentPrice == null) return 1;
|
|
1173
|
+
if (right.currentPrice == null) return -1;
|
|
1174
|
+
return side === "buy" ? left.currentPrice - right.currentPrice : right.currentPrice - left.currentPrice;
|
|
1175
|
+
})[0];
|
|
1176
|
+
};
|
|
1088
1177
|
var isGeoBlockWarningReason = (reason) => reason.startsWith(GEO_BLOCK_WARNING_PREFIX);
|
|
1089
1178
|
var extractGeoBlockedVenues = (warnings) => {
|
|
1090
1179
|
if (!(warnings == null ? void 0 : warnings.length)) return /* @__PURE__ */ new Set();
|
|
@@ -1092,6 +1181,12 @@ var extractGeoBlockedVenues = (warnings) => {
|
|
|
1092
1181
|
warnings.filter((w) => w.venue && isGeoBlockWarningReason(w.reason)).map((w) => w.venue)
|
|
1093
1182
|
);
|
|
1094
1183
|
};
|
|
1184
|
+
var getSmartRouteTotalFees = (feeBreakdown) => {
|
|
1185
|
+
if (!feeBreakdown) return null;
|
|
1186
|
+
const feeParts = [feeBreakdown.venueFees, feeBreakdown.bridgeFees, feeBreakdown.executionGas];
|
|
1187
|
+
if (!feeParts.every(Number.isFinite)) return null;
|
|
1188
|
+
return feeParts.reduce((total, fee) => total + fee, 0);
|
|
1189
|
+
};
|
|
1095
1190
|
var hasLowLiquidityWarning = (warnings) => {
|
|
1096
1191
|
if (!(warnings == null ? void 0 : warnings.length)) return false;
|
|
1097
1192
|
return warnings.some((warning) => (warning == null ? void 0 : warning.reason) === "low_liquidity");
|
|
@@ -3380,10 +3475,11 @@ var PlaceOrder = ({
|
|
|
3380
3475
|
resolvedClaim,
|
|
3381
3476
|
midpointsResult
|
|
3382
3477
|
}) => {
|
|
3383
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y
|
|
3478
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$;
|
|
3384
3479
|
const {
|
|
3385
3480
|
enableDebug: isExecutionDebugEnabled,
|
|
3386
3481
|
features: { enableAnimations, showFeesBreakdown, showLimitOrders },
|
|
3482
|
+
formatting: { formatPrice },
|
|
3387
3483
|
general: { locale },
|
|
3388
3484
|
trading: { executionMode: configuredExecutionMode = "live" } = { executionMode: "live" }
|
|
3389
3485
|
} = useSdkUiConfig();
|
|
@@ -3503,7 +3599,7 @@ var PlaceOrder = ({
|
|
|
3503
3599
|
);
|
|
3504
3600
|
const [internalTab, setInternalTab] = useState2("buy");
|
|
3505
3601
|
const [executionType, setExecutionType] = useState2("market");
|
|
3506
|
-
const [
|
|
3602
|
+
const [selectedLimitVenue, setSelectedLimitVenue] = useState2(null);
|
|
3507
3603
|
const [limitPrice, setLimitPrice] = useState2(0.5);
|
|
3508
3604
|
const [limitPriceInputValue, setLimitPriceInputValue] = useState2(formatLimitPriceInputValue(0.5));
|
|
3509
3605
|
const [limitPriceInputError, setLimitPriceInputError] = useState2(null);
|
|
@@ -3553,7 +3649,6 @@ var PlaceOrder = ({
|
|
|
3553
3649
|
]);
|
|
3554
3650
|
const buyTabRef = useRef2(null);
|
|
3555
3651
|
const sellTabRef = useRef2(null);
|
|
3556
|
-
const executionTypeTriggerRef = useRef2(null);
|
|
3557
3652
|
const expirationTriggerRef = useRef2(null);
|
|
3558
3653
|
const limitPriceInitializedForOutcomeRef = useRef2(void 0);
|
|
3559
3654
|
const expirationOptionRefs = useRef2([]);
|
|
@@ -3593,6 +3688,27 @@ var PlaceOrder = ({
|
|
|
3593
3688
|
const isQuoteInputEditing = internalAmount !== debouncedAmount;
|
|
3594
3689
|
const isLimitOrder = showLimitOrders && executionType === "limit";
|
|
3595
3690
|
const isSell = useMemo(() => internalTab === "sell", [internalTab]);
|
|
3691
|
+
const limitVenueOptions = useMemo(
|
|
3692
|
+
() => {
|
|
3693
|
+
var _a2;
|
|
3694
|
+
return buildLimitOrderVenueOptions({
|
|
3695
|
+
currentPrices: (_a2 = clusterMidpointResult.currentMidpointsByOutcomeId) != null ? _a2 : clusterMidpointResult.prices,
|
|
3696
|
+
livePrices,
|
|
3697
|
+
market: scopedSelectedMarket,
|
|
3698
|
+
selectedOutcomeId: scopedSelectedOutcomeId
|
|
3699
|
+
});
|
|
3700
|
+
},
|
|
3701
|
+
[clusterMidpointResult, livePrices, scopedSelectedMarket, scopedSelectedOutcomeId]
|
|
3702
|
+
);
|
|
3703
|
+
const visibleLimitVenueOptions = useMemo(() => {
|
|
3704
|
+
return limitVenueOptions.filter((option) => {
|
|
3705
|
+
return getVenueAvailabilityState({
|
|
3706
|
+
venueId: option.venue,
|
|
3707
|
+
disabledVenues,
|
|
3708
|
+
isConfigLoading: isAppConfigLoading
|
|
3709
|
+
}) !== "hidden";
|
|
3710
|
+
});
|
|
3711
|
+
}, [disabledVenues, isAppConfigLoading, limitVenueOptions]);
|
|
3596
3712
|
const {
|
|
3597
3713
|
positions: executionPositions,
|
|
3598
3714
|
dataUpdatedAt: executionPositionsUpdatedAt,
|
|
@@ -3613,8 +3729,69 @@ var PlaceOrder = ({
|
|
|
3613
3729
|
isEditing: isQuoteInputEditing,
|
|
3614
3730
|
isMarketOpen: resolvedTradingState.kind === "open" && !isEndedWithoutKnownWinner,
|
|
3615
3731
|
isPanelActive: isQuotePanelActive,
|
|
3616
|
-
isSubmitting: submissionProgressState != null || isBeforeActionPending || executeManaged.isPending
|
|
3732
|
+
isSubmitting: submissionProgressState != null || isBeforeActionPending || executeManaged.isPending || placeLimitOrder.isPending
|
|
3617
3733
|
};
|
|
3734
|
+
const limitVenueQuoteRequests = useMemo(
|
|
3735
|
+
() => visibleLimitVenueOptions.map((option) => ({
|
|
3736
|
+
venue: option.venue,
|
|
3737
|
+
venueMarketOutcomeId: option.venueMarketOutcomeId
|
|
3738
|
+
})),
|
|
3739
|
+
[visibleLimitVenueOptions]
|
|
3740
|
+
);
|
|
3741
|
+
const hasValidLimitVenueQuoteAmount = debouncedAmount > 0;
|
|
3742
|
+
const isLimitVenueQuoteEnabled = isLimitOrder && isQuotePanelActive && !isEndedWithoutKnownWinner && !submissionProgressState && !isBeforeActionPending && !placeLimitOrder.isPending && hasValidLimitVenueQuoteAmount && orderEligibility.canPlaceOrder && (!isSell || sellFilledForOutcomeId === scopedSelectedOutcomeId && !isQuoteInputEditing);
|
|
3743
|
+
const limitVenueQuotes = useLimitOrderVenueQuotes({
|
|
3744
|
+
requests: limitVenueQuoteRequests,
|
|
3745
|
+
tradeSide: internalTab,
|
|
3746
|
+
amount: debouncedAmount,
|
|
3747
|
+
marketId: scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id,
|
|
3748
|
+
accountId: (_k = user == null ? void 0 : user.id) != null ? _k : null,
|
|
3749
|
+
chainBalances: chainBalancesOverride,
|
|
3750
|
+
mode: isPaperMode ? "paper" : void 0,
|
|
3751
|
+
slipCapBps: 1e6,
|
|
3752
|
+
enabled: isLimitVenueQuoteEnabled,
|
|
3753
|
+
refreshContext: smartRouteRefreshContext
|
|
3754
|
+
});
|
|
3755
|
+
const limitVenueQuoteByVenue = useMemo(
|
|
3756
|
+
() => new Map(limitVenueQuotes.quotes.map((quote) => [quote.request.venue, quote])),
|
|
3757
|
+
[limitVenueQuotes.quotes]
|
|
3758
|
+
);
|
|
3759
|
+
const geoBlockedLimitVenues = useMemo(() => {
|
|
3760
|
+
var _a2;
|
|
3761
|
+
const venues = /* @__PURE__ */ new Set();
|
|
3762
|
+
for (const quote of limitVenueQuotes.quotes) {
|
|
3763
|
+
if (extractGeoBlockedVenues((_a2 = quote.data) == null ? void 0 : _a2.warnings).has(quote.request.venue)) {
|
|
3764
|
+
venues.add(quote.request.venue);
|
|
3765
|
+
}
|
|
3766
|
+
}
|
|
3767
|
+
return venues;
|
|
3768
|
+
}, [limitVenueQuotes.quotes]);
|
|
3769
|
+
const availableLimitVenueOptions = useMemo(() => {
|
|
3770
|
+
return visibleLimitVenueOptions.filter((option) => {
|
|
3771
|
+
return !geoBlockedLimitVenues.has(option.venue) && getVenueAvailabilityState({
|
|
3772
|
+
venueId: option.venue,
|
|
3773
|
+
disabledVenues,
|
|
3774
|
+
isConfigLoading: isAppConfigLoading
|
|
3775
|
+
}) === "available";
|
|
3776
|
+
});
|
|
3777
|
+
}, [disabledVenues, geoBlockedLimitVenues, isAppConfigLoading, visibleLimitVenueOptions]);
|
|
3778
|
+
const automaticLimitVenueOption = useMemo(
|
|
3779
|
+
() => resolveAutomaticLimitOrderVenueOption(availableLimitVenueOptions, internalTab),
|
|
3780
|
+
[availableLimitVenueOptions, internalTab]
|
|
3781
|
+
);
|
|
3782
|
+
const selectedLimitVenueOption = useMemo(() => {
|
|
3783
|
+
if (selectedLimitVenue) {
|
|
3784
|
+
const selectedOption = availableLimitVenueOptions.find(
|
|
3785
|
+
(option) => option.venue === selectedLimitVenue
|
|
3786
|
+
);
|
|
3787
|
+
if (selectedOption) return selectedOption;
|
|
3788
|
+
}
|
|
3789
|
+
return automaticLimitVenueOption;
|
|
3790
|
+
}, [automaticLimitVenueOption, availableLimitVenueOptions, selectedLimitVenue]);
|
|
3791
|
+
useEffect2(() => {
|
|
3792
|
+
if (!selectedLimitVenue || !geoBlockedLimitVenues.has(selectedLimitVenue)) return;
|
|
3793
|
+
setSelectedLimitVenue(null);
|
|
3794
|
+
}, [geoBlockedLimitVenues, selectedLimitVenue]);
|
|
3618
3795
|
const smartRoute = useSmartRoute(__spreadProps(__spreadValues({
|
|
3619
3796
|
venueMarketOutcomeId: scopedSelectedOutcomeId,
|
|
3620
3797
|
maxSpend: isSell ? void 0 : debouncedAmount,
|
|
@@ -3630,7 +3807,7 @@ var PlaceOrder = ({
|
|
|
3630
3807
|
enabled: isSmartRouteEnabled
|
|
3631
3808
|
}, isSell ? {
|
|
3632
3809
|
sellCacheScope: {
|
|
3633
|
-
accountId: (
|
|
3810
|
+
accountId: (_l = user == null ? void 0 : user.id) != null ? _l : null,
|
|
3634
3811
|
positionVersion: executionPositionsUpdatedAt
|
|
3635
3812
|
}
|
|
3636
3813
|
} : {}), {
|
|
@@ -3686,12 +3863,12 @@ var PlaceOrder = ({
|
|
|
3686
3863
|
);
|
|
3687
3864
|
const venueSellQuotes = useVenueSellQuotes({
|
|
3688
3865
|
venueMarketOutcomeId: scopedSelectedOutcomeId,
|
|
3689
|
-
accountId: (
|
|
3866
|
+
accountId: (_m = user == null ? void 0 : user.id) != null ? _m : null,
|
|
3690
3867
|
positionVersion: executionPositionsUpdatedAt,
|
|
3691
3868
|
requests: venueSellQuoteRequests,
|
|
3692
3869
|
mode: isPaperMode ? "paper" : void 0,
|
|
3693
3870
|
slipCapBps: 1e6,
|
|
3694
|
-
enabled: isSell && isSmartRouteEnabled && !smartRoute.isLoading && ((
|
|
3871
|
+
enabled: isSell && isSmartRouteEnabled && !smartRoute.isLoading && ((_n = smartRoute.data) == null ? void 0 : _n.venueMarketOutcomeId) === scopedSelectedOutcomeId,
|
|
3695
3872
|
refreshContext: smartRouteRefreshContext
|
|
3696
3873
|
});
|
|
3697
3874
|
const currentSellableShares = useMemo(() => {
|
|
@@ -3726,13 +3903,13 @@ var PlaceOrder = ({
|
|
|
3726
3903
|
isSell,
|
|
3727
3904
|
scopedSelectedMarket,
|
|
3728
3905
|
scopedSelectedOutcome,
|
|
3729
|
-
(
|
|
3906
|
+
(_p = (_o = smartRoute.data) == null ? void 0 : _o.positionAvailability) == null ? void 0 : _p.totalSellableShares
|
|
3730
3907
|
]);
|
|
3731
3908
|
const maxSellableShares = useMemo(
|
|
3732
3909
|
() => floorToDecimals(currentSellableShares, SELL_SHARE_INPUT_DECIMALS),
|
|
3733
3910
|
[currentSellableShares]
|
|
3734
3911
|
);
|
|
3735
|
-
const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((
|
|
3912
|
+
const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((_r = (_q = smartRoute.data) == null ? void 0 : _q.positionAvailability) == null ? void 0 : _r.totalSellableShares) === "number") && (isExecutionPositionsLoading || isExecutionPositionsFetching);
|
|
3736
3913
|
const displayedCurrentSellableShares = useMemo(() => {
|
|
3737
3914
|
if (!Number.isFinite(currentSellableShares) || currentSellableShares <= 0) return 0;
|
|
3738
3915
|
return floorToDecimals(currentSellableShares, SELL_SHARE_DISPLAY_DECIMALS);
|
|
@@ -3742,7 +3919,7 @@ var PlaceOrder = ({
|
|
|
3742
3919
|
[maxSellableShares]
|
|
3743
3920
|
);
|
|
3744
3921
|
const isAtMaxSellableShares = isSell && maxSellableShares > 0 && Math.abs(internalAmount - maxSellableShares) < 1e-9;
|
|
3745
|
-
const isSellAmountAboveAvailability = isSell && ((
|
|
3922
|
+
const isSellAmountAboveAvailability = isSell && ((_s = smartRoute.data) == null ? void 0 : _s.venueMarketOutcomeId) === scopedSelectedOutcomeId && typeof ((_t = smartRoute.data.positionAvailability) == null ? void 0 : _t.totalSellableShares) === "number" && internalAmount > maxSellableShares;
|
|
3746
3923
|
useEffect2(() => {
|
|
3747
3924
|
if (submissionProgressState != null) return;
|
|
3748
3925
|
if (!isSell || isCurrentSellableSharesLoading) return;
|
|
@@ -3778,8 +3955,8 @@ var PlaceOrder = ({
|
|
|
3778
3955
|
isSell,
|
|
3779
3956
|
onAmountChange,
|
|
3780
3957
|
scopedSelectedOutcomeId,
|
|
3781
|
-
(
|
|
3782
|
-
(
|
|
3958
|
+
(_v = (_u = smartRoute.data) == null ? void 0 : _u.positionAvailability) == null ? void 0 : _v.totalSellableShares,
|
|
3959
|
+
(_w = smartRoute.data) == null ? void 0 : _w.venueMarketOutcomeId,
|
|
3783
3960
|
submissionProgressState
|
|
3784
3961
|
]);
|
|
3785
3962
|
const routeCards = useMemo(() => {
|
|
@@ -3817,7 +3994,7 @@ var PlaceOrder = ({
|
|
|
3817
3994
|
return selectedRouteCardId;
|
|
3818
3995
|
}
|
|
3819
3996
|
return resolveDefaultRouteCardId(routeCards, isSell ? void 0 : (_a2 = smartRoute.data) == null ? void 0 : _a2.status);
|
|
3820
|
-
}, [routeCards, selectedRouteCardId, isSell, (
|
|
3997
|
+
}, [routeCards, selectedRouteCardId, isSell, (_x = smartRoute.data) == null ? void 0 : _x.status]);
|
|
3821
3998
|
useEffect2(() => {
|
|
3822
3999
|
if (routeCards.length === 0) {
|
|
3823
4000
|
setSelectedRouteCardId(null);
|
|
@@ -3840,7 +4017,6 @@ var PlaceOrder = ({
|
|
|
3840
4017
|
useEffect2(() => {
|
|
3841
4018
|
if (showLimitOrders || executionType !== "limit") return;
|
|
3842
4019
|
setExecutionType("market");
|
|
3843
|
-
setIsExecutionTypeMenuOpen(false);
|
|
3844
4020
|
setIsLimitExpirationPickerOpen(false);
|
|
3845
4021
|
}, [executionType, showLimitOrders]);
|
|
3846
4022
|
useEffect2(() => {
|
|
@@ -3856,15 +4032,19 @@ var PlaceOrder = ({
|
|
|
3856
4032
|
setLimitPriceInputValue(formatLimitPriceInputValue(nextLimitPrice));
|
|
3857
4033
|
setLimitPriceInputError(null);
|
|
3858
4034
|
}, [executionType, scopedSelectedOutcomeId, selectedOutcomeDisplayPrice]);
|
|
4035
|
+
useEffect2(() => {
|
|
4036
|
+
setSelectedLimitVenue(null);
|
|
4037
|
+
}, [scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id, scopedSelectedOutcomeId]);
|
|
3859
4038
|
const orderedRouteCards = routeCards;
|
|
3860
|
-
const selectedRouteCard = (
|
|
4039
|
+
const selectedRouteCard = (_z = (_y = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _y : orderedRouteCards[0]) != null ? _z : null;
|
|
3861
4040
|
const isKalshiRoute = useMemo(() => {
|
|
4041
|
+
if (isLimitOrder) return (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) === Venue4.kalshi;
|
|
3862
4042
|
if (selectedRouteCard) {
|
|
3863
4043
|
return selectedRouteCard.venue === "kalshi" || selectedRouteCard.quoteData.fills.some((f) => f.venue === "kalshi");
|
|
3864
4044
|
}
|
|
3865
4045
|
return (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === "kalshi";
|
|
3866
|
-
}, [selectedRouteCard, scopedSelectedMarket]);
|
|
3867
|
-
const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (
|
|
4046
|
+
}, [isLimitOrder, selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue, selectedRouteCard, scopedSelectedMarket]);
|
|
4047
|
+
const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (_A = liveBalanceState.kalshiBalance) != null ? _A : 0 : liveAvailableBalance;
|
|
3868
4048
|
const legacyKalshiAccount = useMemo(
|
|
3869
4049
|
() => {
|
|
3870
4050
|
var _a2;
|
|
@@ -3872,8 +4052,8 @@ var PlaceOrder = ({
|
|
|
3872
4052
|
},
|
|
3873
4053
|
[user == null ? void 0 : user.venueAccounts]
|
|
3874
4054
|
);
|
|
3875
|
-
const isKalshiAccountActive = (
|
|
3876
|
-
const isKalshiVerified = ((
|
|
4055
|
+
const isKalshiAccountActive = (_B = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.connected) != null ? _B : (legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.status) === "active";
|
|
4056
|
+
const isKalshiVerified = ((_C = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.kycStatus) != null ? _C : legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.kycStatus) === "verified";
|
|
3877
4057
|
const hasKalshiConnectionState = kalshiKeyStatus !== void 0 || (user == null ? void 0 : user.venueAccounts) != null;
|
|
3878
4058
|
const isKalshiAvailable = getVenueAvailabilityState({
|
|
3879
4059
|
venueId: "kalshi",
|
|
@@ -3900,7 +4080,7 @@ var PlaceOrder = ({
|
|
|
3900
4080
|
[aggClient, onConnectKalshi, refetchKalshiKeyStatus]
|
|
3901
4081
|
);
|
|
3902
4082
|
const needsKycVerification = isAuthenticated && hasKalshiConnectionState && isKalshiRoute && isKalshiAccountActive && !isKalshiVerified;
|
|
3903
|
-
const verifyKalshiConnectionLabel = (
|
|
4083
|
+
const verifyKalshiConnectionLabel = (_G = (_F = (_E = (_D = labels.onboarding) == null ? void 0 : _D.connectKalshiModal) == null ? void 0 : _E.actions) == null ? void 0 : _F.verifyConnection) != null ? _G : tradingLabels.kycRequired;
|
|
3904
4084
|
const handleRouteCardSelect = useCallback2(
|
|
3905
4085
|
(cardId) => {
|
|
3906
4086
|
if (cardId === resolvedSelectedRouteCardId) {
|
|
@@ -3915,15 +4095,15 @@ var PlaceOrder = ({
|
|
|
3915
4095
|
[resolvedSelectedRouteCardId, routeCards]
|
|
3916
4096
|
);
|
|
3917
4097
|
const executionProgress = useExecutionProgress({
|
|
3918
|
-
orderIds: (
|
|
3919
|
-
quoteId: (
|
|
4098
|
+
orderIds: (_H = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) != null ? _H : null,
|
|
4099
|
+
quoteId: (_I = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _I : null,
|
|
3920
4100
|
mode: isPaperMode ? "paper" : void 0,
|
|
3921
|
-
enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((
|
|
4101
|
+
enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((_J = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _J.length)
|
|
3922
4102
|
});
|
|
3923
|
-
const selectedOutcomeLabel = (
|
|
3924
|
-
const headerImage = (
|
|
3925
|
-
const headerTitle = (
|
|
3926
|
-
const headerSubtitle = (
|
|
4103
|
+
const selectedOutcomeLabel = (_M = (_L = (_K = outcomes.find((outcome) => outcome.id === scopedSelectedOutcomeId)) == null ? void 0 : _K.label) != null ? _L : scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.label) != null ? _M : "";
|
|
4104
|
+
const headerImage = (_O = (_N = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.image) != null ? _N : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.image) != null ? _O : null;
|
|
4105
|
+
const headerTitle = (_Q = (_P = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _P : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _Q : "";
|
|
4106
|
+
const headerSubtitle = (_R = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _R : "";
|
|
3927
4107
|
const buildExecutionSummary = useCallback2(
|
|
3928
4108
|
(quoteData, executionVenue, orderId, partialFillSummary) => {
|
|
3929
4109
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
@@ -4221,19 +4401,19 @@ var PlaceOrder = ({
|
|
|
4221
4401
|
queryClient,
|
|
4222
4402
|
submissionProgressState
|
|
4223
4403
|
]);
|
|
4224
|
-
const activeQuoteData = (
|
|
4225
|
-
const
|
|
4404
|
+
const activeQuoteData = isLimitOrder ? null : (_T = (_S = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _S : smartRoute.data) != null ? _T : null;
|
|
4405
|
+
const visibleMarketRouteCards = orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT && !isRoutesExpanded ? orderedRouteCards.slice(0, PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT) : orderedRouteCards;
|
|
4226
4406
|
const hasEnteredAmount = internalAmount > 0;
|
|
4227
4407
|
const isQuoteLoading = !isLimitOrder && hasEnteredAmount && (smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
|
|
4228
4408
|
const routeLoadingMessage = isQuoteLoading ? smartRoute.loadingReason === "updating-route" ? tradingLabels.updatingRoute : smartRoute.loadingReason === "refreshing-quotes" ? tradingLabels.refreshingQuotes : tradingLabels.findingBestOdds : null;
|
|
4229
|
-
const selectedRouteFills = (
|
|
4409
|
+
const selectedRouteFills = (_U = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills) != null ? _U : [];
|
|
4230
4410
|
const isKalshiOnlyRoute = isKalshiRoute && ((selectedRouteCard == null ? void 0 : selectedRouteCard.venue) === Venue4.kalshi || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue === Venue4.kalshi));
|
|
4231
4411
|
const isOnchainOnlyRoute = !isKalshiRoute || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue !== Venue4.kalshi);
|
|
4232
4412
|
const kalshiRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue === Venue4.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
|
|
4233
4413
|
const onchainRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue !== Venue4.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
|
|
4234
4414
|
const resolvedKalshiRequiredAmount = isKalshiOnlyRoute || isKalshiRoute && selectedRouteFills.length === 0 ? internalAmount : kalshiRequiredAmount;
|
|
4235
4415
|
const resolvedOnchainRequiredAmount = isOnchainOnlyRoute || !isKalshiRoute && selectedRouteFills.length === 0 ? internalAmount : onchainRequiredAmount;
|
|
4236
|
-
const isKalshiBalanceInsufficient = !isPaperMode && isKalshiRoute && resolvedKalshiRequiredAmount > ((
|
|
4416
|
+
const isKalshiBalanceInsufficient = !isPaperMode && isKalshiRoute && resolvedKalshiRequiredAmount > ((_V = liveBalanceState.kalshiBalance) != null ? _V : 0);
|
|
4237
4417
|
const isOnchainBalanceInsufficient = resolvedOnchainRequiredAmount > liveAvailableBalance;
|
|
4238
4418
|
const isInsufficientBalance = !isSell && isAuthenticated && hasEnteredAmount && !isBalanceLoading && (isLimitOrder ? internalAmount > totalBalance : isPaperMode ? internalAmount > paperTotalBalance : isKalshiBalanceInsufficient || isOnchainBalanceInsufficient);
|
|
4239
4419
|
const isQuoteInsufficientBalance = !isLimitOrder && (activeQuoteData == null ? void 0 : activeQuoteData.status) === "insufficient_balance";
|
|
@@ -4327,9 +4507,9 @@ var PlaceOrder = ({
|
|
|
4327
4507
|
}
|
|
4328
4508
|
return (_d2 = selectedRouteCard.hint) != null ? _d2 : "";
|
|
4329
4509
|
}, [selectedRouteCard, tradingLabels]);
|
|
4330
|
-
const displayedToWinValue = (
|
|
4510
|
+
const displayedToWinValue = (_W = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _W : 0;
|
|
4331
4511
|
const limitOrderPayload = useMemo(() => {
|
|
4332
|
-
if (!
|
|
4512
|
+
if (!selectedLimitVenueOption || internalAmount <= 0) return null;
|
|
4333
4513
|
if (limitPriceInputError) return null;
|
|
4334
4514
|
const expirationDate = resolveLimitExpirationDate({
|
|
4335
4515
|
expirationType: limitExpirationType,
|
|
@@ -4345,8 +4525,8 @@ var PlaceOrder = ({
|
|
|
4345
4525
|
});
|
|
4346
4526
|
const expiresAt = expirationDate ? serializeLimitOrderExpiration(expirationDate) : void 0;
|
|
4347
4527
|
return __spreadValues({
|
|
4348
|
-
venue:
|
|
4349
|
-
venueMarketOutcomeId:
|
|
4528
|
+
venue: selectedLimitVenueOption.venue,
|
|
4529
|
+
venueMarketOutcomeId: selectedLimitVenueOption.venueMarketOutcomeId,
|
|
4350
4530
|
side: internalTab,
|
|
4351
4531
|
limitPriceRaw,
|
|
4352
4532
|
sizeRaw,
|
|
@@ -4360,8 +4540,7 @@ var PlaceOrder = ({
|
|
|
4360
4540
|
limitExpirationType,
|
|
4361
4541
|
limitPrice,
|
|
4362
4542
|
limitPriceInputError,
|
|
4363
|
-
|
|
4364
|
-
scopedSelectedOutcomeId
|
|
4543
|
+
selectedLimitVenueOption
|
|
4365
4544
|
]);
|
|
4366
4545
|
const resolvedLimitExpirationDraftDate = useMemo(() => {
|
|
4367
4546
|
return resolveLimitExpirationDate({
|
|
@@ -4404,11 +4583,70 @@ var PlaceOrder = ({
|
|
|
4404
4583
|
)
|
|
4405
4584
|
) / Number(LIMIT_ORDER_RAW_SCALE);
|
|
4406
4585
|
}, [internalTab, limitOrderPayload]);
|
|
4586
|
+
const limitRouteCards = useMemo(() => {
|
|
4587
|
+
return visibleLimitVenueOptions.map((option) => {
|
|
4588
|
+
var _a2, _b2;
|
|
4589
|
+
const availabilityState = getVenueAvailabilityState({
|
|
4590
|
+
venueId: option.venue,
|
|
4591
|
+
disabledVenues,
|
|
4592
|
+
isConfigLoading: isAppConfigLoading
|
|
4593
|
+
});
|
|
4594
|
+
const isGeoBlocked = geoBlockedLimitVenues.has(option.venue);
|
|
4595
|
+
const isUnavailable = isTradingBlocked || isGeoBlocked || availabilityState !== "available";
|
|
4596
|
+
const currentPriceLabel = option.currentPrice == null ? "\u2014" : formatProbabilityCents(option.currentPrice, formatPrice);
|
|
4597
|
+
const totalFees = getSmartRouteTotalFees(
|
|
4598
|
+
(_b2 = (_a2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _a2.data) == null ? void 0 : _b2.feeBreakdown
|
|
4599
|
+
);
|
|
4600
|
+
const feeLabel = totalFees == null ? void 0 : formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
4601
|
+
return {
|
|
4602
|
+
id: `limit-venue-${option.venue}-${option.venueMarketOutcomeId}`,
|
|
4603
|
+
hint: isGeoBlocked ? tradingLabels.venueUnavailableInRegion : tradingLabels.limitRoutingCurrentPrice(currentPriceLabel, feeLabel),
|
|
4604
|
+
isUnavailable,
|
|
4605
|
+
kind: "venue",
|
|
4606
|
+
label: getTradingVenueLabel(option.venue),
|
|
4607
|
+
numericValue: displayedLimitToWinValue,
|
|
4608
|
+
value: formatUsd(displayedLimitToWinValue, {
|
|
4609
|
+
maximumFractionDigits: 2,
|
|
4610
|
+
minimumFractionDigits: 2
|
|
4611
|
+
}),
|
|
4612
|
+
venue: option.venue
|
|
4613
|
+
};
|
|
4614
|
+
});
|
|
4615
|
+
}, [
|
|
4616
|
+
disabledVenues,
|
|
4617
|
+
displayedLimitToWinValue,
|
|
4618
|
+
formatPrice,
|
|
4619
|
+
geoBlockedLimitVenues,
|
|
4620
|
+
isAppConfigLoading,
|
|
4621
|
+
isTradingBlocked,
|
|
4622
|
+
limitVenueQuoteByVenue,
|
|
4623
|
+
tradingLabels,
|
|
4624
|
+
visibleLimitVenueOptions
|
|
4625
|
+
]);
|
|
4626
|
+
const limitVenueOptionByCardId = useMemo(() => {
|
|
4627
|
+
return new Map(
|
|
4628
|
+
visibleLimitVenueOptions.map((option) => [
|
|
4629
|
+
`limit-venue-${option.venue}-${option.venueMarketOutcomeId}`,
|
|
4630
|
+
option
|
|
4631
|
+
])
|
|
4632
|
+
);
|
|
4633
|
+
}, [visibleLimitVenueOptions]);
|
|
4634
|
+
const activeRouteCards = isLimitOrder ? limitRouteCards : visibleMarketRouteCards;
|
|
4635
|
+
const activeRouteCardCount = isLimitOrder ? limitRouteCards.length : orderedRouteCards.length;
|
|
4636
|
+
const handleActiveRouteCardSelect = (cardId) => {
|
|
4637
|
+
if (!isLimitOrder) {
|
|
4638
|
+
handleRouteCardSelect(cardId);
|
|
4639
|
+
return;
|
|
4640
|
+
}
|
|
4641
|
+
const option = limitVenueOptionByCardId.get(cardId);
|
|
4642
|
+
if (!option) return;
|
|
4643
|
+
setSelectedLimitVenue(option.venue);
|
|
4644
|
+
};
|
|
4407
4645
|
const displayedLimitToWinHint = formatLimitPriceLabel(limitPrice);
|
|
4408
4646
|
const activeFeeBreakdown = activeQuoteData == null ? void 0 : activeQuoteData.feeBreakdown;
|
|
4409
4647
|
const estimatedFeesValue = useMemo(() => {
|
|
4410
|
-
|
|
4411
|
-
|
|
4648
|
+
const totalFees = getSmartRouteTotalFees(activeFeeBreakdown);
|
|
4649
|
+
if (totalFees == null) return null;
|
|
4412
4650
|
return formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
4413
4651
|
}, [activeFeeBreakdown]);
|
|
4414
4652
|
const feeBreakdownRows = useMemo(() => {
|
|
@@ -4446,13 +4684,15 @@ var PlaceOrder = ({
|
|
|
4446
4684
|
];
|
|
4447
4685
|
}, [activeFeeBreakdown, tradingLabels]);
|
|
4448
4686
|
const isActionLoading = isPrimaryActionLoading || executeManaged.isPending || placeLimitOrder.isPending || isBeforeActionPending;
|
|
4449
|
-
const
|
|
4687
|
+
const selectedLimitRouteCardId = selectedLimitVenueOption ? `limit-venue-${selectedLimitVenueOption.venue}-${selectedLimitVenueOption.venueMarketOutcomeId}` : null;
|
|
4688
|
+
const selectedLimitRouteCard = selectedLimitRouteCardId ? (_X = limitRouteCards.find((card) => card.id === selectedLimitRouteCardId)) != null ? _X : null : null;
|
|
4689
|
+
const selectedRouteGeoBlocked = isLimitOrder ? (_Y = selectedLimitRouteCard == null ? void 0 : selectedLimitRouteCard.isUnavailable) != null ? _Y : false : (_Z = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _Z : false;
|
|
4450
4690
|
const geoBlockedVenuesFromWarnings = useMemo(
|
|
4451
4691
|
() => {
|
|
4452
4692
|
var _a2;
|
|
4453
4693
|
return extractGeoBlockedVenues((_a2 = smartRoute.data) == null ? void 0 : _a2.warnings);
|
|
4454
4694
|
},
|
|
4455
|
-
[(
|
|
4695
|
+
[(__ = smartRoute.data) == null ? void 0 : __.warnings]
|
|
4456
4696
|
);
|
|
4457
4697
|
const isPrimaryVenueGeoBlocked = useMemo(() => {
|
|
4458
4698
|
var _a2, _b2;
|
|
@@ -4460,12 +4700,12 @@ var PlaceOrder = ({
|
|
|
4460
4700
|
const fills = (_b2 = (_a2 = selectedRouteCard.quoteData) == null ? void 0 : _a2.fills) != null ? _b2 : [];
|
|
4461
4701
|
return fills.length > 0 && fills.every((f) => geoBlockedVenuesFromWarnings.has(f.venue));
|
|
4462
4702
|
}, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
|
|
4463
|
-
const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked;
|
|
4703
|
+
const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked || isLimitOrder && limitRouteCards.length > 0 && limitRouteCards.every((card) => card.isUnavailable);
|
|
4464
4704
|
const shouldShowLowLiquidityWarning = !isQuoteInputEditing && !isQuoteLoading && (activeQuoteData == null ? void 0 : activeQuoteData.venueMarketOutcomeId) === scopedSelectedOutcomeId && hasLowLiquidityWarning(activeQuoteData.warnings);
|
|
4465
4705
|
const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
|
|
4466
4706
|
const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isQuoteInsufficientBalance || isSell && isQuoteInputEditing || isSellAmountAboveAvailability || isBelowMinimum || !isLimitOrder && isQuoteLoading || (isLimitOrder ? !limitOrderPayload : !selectedRouteCard || !selectedRouteCard.quoteData.quoteId) || selectedRouteGeoBlocked || !isAuthenticated || !isLimitOrder && quoteStatus !== void 0;
|
|
4467
|
-
const shouldShowSmartRouting =
|
|
4468
|
-
const shouldShowRouteToggle = !isQuoteLoading && orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
|
|
4707
|
+
const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (isLimitOrder ? limitRouteCards.length > 0 : orderedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
|
|
4708
|
+
const shouldShowRouteToggle = !isLimitOrder && !isQuoteLoading && orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
|
|
4469
4709
|
const handleReturnToOrderForm = useCallback2(() => {
|
|
4470
4710
|
const submittedSelection = submittedSelectionRef.current;
|
|
4471
4711
|
submittedSelectionRef.current = null;
|
|
@@ -5110,7 +5350,7 @@ var PlaceOrder = ({
|
|
|
5110
5350
|
PlaceOrderResolvedView,
|
|
5111
5351
|
{
|
|
5112
5352
|
tradingState: resolvedReadOnlyTradingState,
|
|
5113
|
-
resolutionTimestamp: (
|
|
5353
|
+
resolutionTimestamp: (_$ = resolvedEventTradingState.resolvesAt) != null ? _$ : resolvedReadOnlyTradingState.resolvesAt,
|
|
5114
5354
|
resolvedClaim,
|
|
5115
5355
|
classNames,
|
|
5116
5356
|
className,
|
|
@@ -5193,261 +5433,228 @@ var PlaceOrder = ({
|
|
|
5193
5433
|
tabItem.value
|
|
5194
5434
|
);
|
|
5195
5435
|
}) }),
|
|
5196
|
-
showLimitOrders ? /* @__PURE__ */
|
|
5197
|
-
|
|
5436
|
+
showLimitOrders ? /* @__PURE__ */ jsx6(
|
|
5437
|
+
Select,
|
|
5198
5438
|
{
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
children: [
|
|
5213
|
-
/* @__PURE__ */ jsx6("span", { children: isLimitOrder ? tradingLabels.orderTypeLimit : tradingLabels.orderTypeMarket }),
|
|
5214
|
-
/* @__PURE__ */ jsx6(Icon, { name: "chevron-down", size: "small", className: "h-4 w-4", "aria-hidden": true })
|
|
5215
|
-
]
|
|
5216
|
-
}
|
|
5217
|
-
) }),
|
|
5218
|
-
/* @__PURE__ */ jsx6(
|
|
5219
|
-
DropdownMenu.Portal,
|
|
5220
|
-
{
|
|
5221
|
-
container: resolvePlaceOrderPortalContainer(executionTypeTriggerRef.current),
|
|
5222
|
-
children: /* @__PURE__ */ jsx6(
|
|
5223
|
-
DropdownMenu.Content,
|
|
5224
|
-
{
|
|
5225
|
-
align: "end",
|
|
5226
|
-
sideOffset: 8,
|
|
5227
|
-
className: "z-50 min-w-[140px] rounded-agg-lg border border-agg-separator bg-agg-secondary p-1 shadow-[0_8px_16px_rgba(0,0,0,0.12)]",
|
|
5228
|
-
children: [
|
|
5229
|
-
{ value: "market", label: tradingLabels.orderTypeMarket },
|
|
5230
|
-
{ value: "limit", label: tradingLabels.orderTypeLimit }
|
|
5231
|
-
].map((item) => /* @__PURE__ */ jsx6(
|
|
5232
|
-
DropdownMenu.Item,
|
|
5233
|
-
{
|
|
5234
|
-
className: cn(
|
|
5235
|
-
"cursor-pointer rounded-agg-sm px-3 py-2 text-agg-sm leading-agg-5 text-agg-foreground outline-none hover:bg-agg-secondary-hover focus:bg-agg-secondary-hover",
|
|
5236
|
-
executionType === item.value && "font-agg-bold text-agg-primary"
|
|
5237
|
-
),
|
|
5238
|
-
onSelect: () => handleExecutionTypeChange(item.value),
|
|
5239
|
-
children: item.label
|
|
5240
|
-
},
|
|
5241
|
-
item.value
|
|
5242
|
-
))
|
|
5243
|
-
}
|
|
5244
|
-
)
|
|
5245
|
-
}
|
|
5246
|
-
)
|
|
5247
|
-
]
|
|
5439
|
+
ariaLabel: tradingLabels.orderTypeAria,
|
|
5440
|
+
className: "mb-2",
|
|
5441
|
+
triggerClassName: "agg-order-type-trigger",
|
|
5442
|
+
items: [
|
|
5443
|
+
{ value: "market", label: tradingLabels.orderTypeMarket },
|
|
5444
|
+
{ value: "limit", label: tradingLabels.orderTypeLimit }
|
|
5445
|
+
],
|
|
5446
|
+
value: executionType,
|
|
5447
|
+
onChange: handleExecutionTypeChange,
|
|
5448
|
+
variant: "inline",
|
|
5449
|
+
openOnHover: true,
|
|
5450
|
+
contentAlign: "end",
|
|
5451
|
+
contentSideOffset: 4
|
|
5248
5452
|
}
|
|
5249
5453
|
) : null
|
|
5250
5454
|
]
|
|
5251
5455
|
}
|
|
5252
5456
|
),
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5457
|
+
/* @__PURE__ */ jsxs5("div", { className: "agg-order-entry-section flex flex-col gap-4", children: [
|
|
5458
|
+
outcomes.length >= 2 ? /* @__PURE__ */ jsx6("div", { className: "agg-outcomes flex w-full max-w-full gap-2", children: outcomes.map((outcome, index) => {
|
|
5459
|
+
var _a2, _b2, _c2;
|
|
5460
|
+
const price = getDisplayOutcomePrice({
|
|
5461
|
+
outcomeId: outcome.id,
|
|
5462
|
+
outcomeLabel: outcome.label,
|
|
5463
|
+
selection: (_a2 = tradingContext == null ? void 0 : tradingContext.tradeSide) != null ? _a2 : isSell ? "sell" : "buy",
|
|
5464
|
+
bestPrices: clusterBestPrices,
|
|
5465
|
+
bestMidpoint: clusterBestMidpoint,
|
|
5466
|
+
bestMidpointsByOutcomeId: clusterBestMidpointsByOutcomeId,
|
|
5467
|
+
livePrices
|
|
5468
|
+
});
|
|
5469
|
+
const isActive = outcome.id === scopedSelectedOutcomeId;
|
|
5470
|
+
const isPositive = resolveIsPositiveOutcome(outcome, index);
|
|
5471
|
+
const isPriceLoading = clusterMidpointResult.isLoading && price == null;
|
|
5472
|
+
return /* @__PURE__ */ jsxs5(
|
|
5473
|
+
"button",
|
|
5474
|
+
{
|
|
5475
|
+
"data-id": outcome.id,
|
|
5476
|
+
type: "button",
|
|
5477
|
+
className: cn(
|
|
5478
|
+
"agg-outcome-button",
|
|
5479
|
+
getOutcomeButtonClassName({
|
|
5480
|
+
enableAnimations,
|
|
5481
|
+
isActive,
|
|
5482
|
+
isPositive
|
|
5483
|
+
}),
|
|
5484
|
+
"disabled:cursor-not-allowed disabled:opacity-60",
|
|
5485
|
+
"leading-agg-5! flex-1 min-w-0 gap-1 md:gap-2"
|
|
5486
|
+
),
|
|
5487
|
+
"aria-pressed": isActive,
|
|
5488
|
+
"aria-label": `${(_b2 = outcome.title) != null ? _b2 : outcome.label} ${formatProbabilityCents(price, formatPrice)}`,
|
|
5489
|
+
disabled: !orderEligibility.canPlaceOrder || isResolvedOutcomeCtaLocked,
|
|
5490
|
+
onClick: () => handleOutcomeChange(outcome.id),
|
|
5491
|
+
children: [
|
|
5492
|
+
/* @__PURE__ */ jsx6(
|
|
5493
|
+
Typography,
|
|
5494
|
+
{
|
|
5495
|
+
as: "span",
|
|
5496
|
+
variant: isActive ? "body-strong" : "body",
|
|
5497
|
+
className: cn("whitespace-nowrap truncate"),
|
|
5498
|
+
children: (_c2 = outcome.title) != null ? _c2 : outcome.label
|
|
5499
|
+
}
|
|
5500
|
+
),
|
|
5501
|
+
isPriceLoading ? /* @__PURE__ */ jsx6(
|
|
5502
|
+
"span",
|
|
5503
|
+
{
|
|
5504
|
+
"aria-hidden": "true",
|
|
5505
|
+
className: cn(
|
|
5506
|
+
"agg-place-order-outcome-price-loading",
|
|
5507
|
+
"h-4 w-10 shrink-0 rounded-agg-sm bg-agg-separator animate-pulse"
|
|
5508
|
+
)
|
|
5509
|
+
}
|
|
5510
|
+
) : /* @__PURE__ */ jsx6(Typography, { as: "span", variant: isActive ? "body-strong" : "body", children: formatProbabilityCents(price, formatPrice) })
|
|
5511
|
+
]
|
|
5512
|
+
},
|
|
5513
|
+
outcome.id
|
|
5514
|
+
);
|
|
5515
|
+
}) }) : null,
|
|
5516
|
+
isLimitOrder ? /* @__PURE__ */ jsxs5("div", { className: "agg-limit-price-section flex items-center justify-between gap-4", children: [
|
|
5517
|
+
/* @__PURE__ */ jsx6("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.limitPrice }),
|
|
5518
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex min-w-0 flex-col items-end gap-1", children: [
|
|
5519
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2", children: [
|
|
5520
|
+
/* @__PURE__ */ jsxs5("label", { className: "relative flex items-center", children: [
|
|
5521
|
+
/* @__PURE__ */ jsx6(
|
|
5522
|
+
"input",
|
|
5523
|
+
{
|
|
5524
|
+
type: "text",
|
|
5525
|
+
inputMode: "decimal",
|
|
5526
|
+
"aria-label": tradingLabels.limitPriceInputAria,
|
|
5527
|
+
"aria-invalid": Boolean(limitPriceInputError),
|
|
5528
|
+
value: limitPriceInputValue,
|
|
5529
|
+
onChange: handleLimitPriceInputChange,
|
|
5530
|
+
onBlur: handleLimitPriceInputBlur,
|
|
5531
|
+
className: cn(
|
|
5532
|
+
PLACE_ORDER_NUMERIC_INPUT_CLASS_NAME,
|
|
5533
|
+
"h-9 w-[108px] pr-5",
|
|
5534
|
+
limitPriceInputError && "text-agg-error focus-visible:text-agg-error"
|
|
5535
|
+
)
|
|
5536
|
+
}
|
|
5537
|
+
),
|
|
5538
|
+
/* @__PURE__ */ jsx6("span", { className: "pointer-events-none absolute right-1 text-agg-3xl font-agg-bold leading-agg-9 text-agg-foreground", children: "\xA2" })
|
|
5539
|
+
] }),
|
|
5287
5540
|
/* @__PURE__ */ jsx6(
|
|
5288
|
-
|
|
5541
|
+
"button",
|
|
5289
5542
|
{
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5543
|
+
type: "button",
|
|
5544
|
+
className: "flex size-8 cursor-pointer items-center justify-center rounded-agg-lg bg-agg-secondary-hover text-agg-foreground hover:bg-agg-tertiary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
|
|
5545
|
+
"aria-label": tradingLabels.limitPriceDecreaseAria,
|
|
5546
|
+
onClick: () => handleLimitPriceStep("decrease"),
|
|
5547
|
+
children: /* @__PURE__ */ jsx6(Icon, { name: "minus", size: "small", className: "h-4 w-4", "aria-hidden": true })
|
|
5294
5548
|
}
|
|
5295
5549
|
),
|
|
5296
|
-
|
|
5297
|
-
"
|
|
5550
|
+
/* @__PURE__ */ jsx6(
|
|
5551
|
+
"button",
|
|
5298
5552
|
{
|
|
5299
|
-
|
|
5300
|
-
className:
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
)
|
|
5553
|
+
type: "button",
|
|
5554
|
+
className: "flex size-8 cursor-pointer items-center justify-center rounded-agg-lg bg-agg-secondary-hover text-agg-foreground hover:bg-agg-tertiary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
|
|
5555
|
+
"aria-label": tradingLabels.limitPriceIncreaseAria,
|
|
5556
|
+
onClick: () => handleLimitPriceStep("increase"),
|
|
5557
|
+
children: /* @__PURE__ */ jsx6(Icon, { name: "plus", size: "small", className: "h-4 w-4", "aria-hidden": true })
|
|
5304
5558
|
}
|
|
5305
|
-
)
|
|
5306
|
-
]
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
)
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
"input",
|
|
5559
|
+
)
|
|
5560
|
+
] }),
|
|
5561
|
+
limitPriceInputError ? /* @__PURE__ */ jsx6("p", { className: "max-w-[220px] text-right text-agg-xs leading-agg-4 text-agg-error", children: limitPriceInputError }) : null
|
|
5562
|
+
] })
|
|
5563
|
+
] }) : null,
|
|
5564
|
+
/* @__PURE__ */ jsxs5("div", { className: "agg-order-amount-section flex items-start justify-between gap-4", children: [
|
|
5565
|
+
/* @__PURE__ */ jsxs5("div", { className: "agg-order-amount-meta flex flex-col", children: [
|
|
5566
|
+
/* @__PURE__ */ jsx6("p", { className: "agg-order-amount-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground whitespace-nowrap", children: tradingLabels.amount(internalTab) }),
|
|
5567
|
+
isAuthenticated ? isSell ? /* @__PURE__ */ jsx6("div", { className: "agg-balance-value flex items-baseline gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isCurrentSellableSharesLoading ? /* @__PURE__ */ jsx6(LoadingIcon, { size: "small" }) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
5568
|
+
/* @__PURE__ */ jsx6("span", { className: "whitespace-pre", children: displayedCurrentSellableSharesLabel }),
|
|
5569
|
+
displayedCurrentSellableShares > 0 ? /* @__PURE__ */ jsx6(
|
|
5570
|
+
"button",
|
|
5318
5571
|
{
|
|
5319
|
-
type: "
|
|
5320
|
-
inputMode: "decimal",
|
|
5321
|
-
"aria-label": tradingLabels.limitPriceInputAria,
|
|
5322
|
-
"aria-invalid": Boolean(limitPriceInputError),
|
|
5323
|
-
value: limitPriceInputValue,
|
|
5324
|
-
onChange: handleLimitPriceInputChange,
|
|
5325
|
-
onBlur: handleLimitPriceInputBlur,
|
|
5572
|
+
type: "button",
|
|
5326
5573
|
className: cn(
|
|
5327
|
-
"
|
|
5328
|
-
"
|
|
5329
|
-
|
|
5330
|
-
|
|
5574
|
+
"agg-max-shares-button",
|
|
5575
|
+
"cursor-pointer disabled:cursor-not-allowed",
|
|
5576
|
+
"bg-transparent p-0 text-agg-sm font-agg-bold leading-agg-5 text-agg-primary disabled:text-agg-muted-foreground",
|
|
5577
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
|
|
5578
|
+
),
|
|
5579
|
+
"aria-label": tradingLabels.maxShares,
|
|
5580
|
+
disabled: !orderEligibility.canPlaceOrder || isAtMaxSellableShares,
|
|
5581
|
+
onClick: handleFillSellableShares,
|
|
5582
|
+
children: tradingLabels.maxShares
|
|
5331
5583
|
}
|
|
5332
|
-
)
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5584
|
+
) : null
|
|
5585
|
+
] }) }) : /* @__PURE__ */ jsx6("p", { className: "agg-balance-value flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isBalanceLoading ? /* @__PURE__ */ jsx6(LoadingIcon, { size: "small" }) : tradingLabels.balance(formatUsd(displayedBalance)) }) : null
|
|
5586
|
+
] }),
|
|
5587
|
+
/* @__PURE__ */ jsx6(
|
|
5588
|
+
CurrencyInput,
|
|
5589
|
+
{
|
|
5590
|
+
value: internalAmount,
|
|
5591
|
+
onChange: handleAmountChange,
|
|
5592
|
+
ariaLabel: tradingLabels.amount(internalTab),
|
|
5593
|
+
max: isLimitOrder && !isSell && isAuthenticated && !isBalanceLoading ? totalBalance : void 0,
|
|
5594
|
+
isInvalid: isInsufficientBalance || isBelowMinimum,
|
|
5595
|
+
disabled: !orderEligibility.canPlaceOrder,
|
|
5596
|
+
prefix: internalTab === "buy" ? "$" : "",
|
|
5597
|
+
decimalPlaces: isSell ? SELL_SHARE_INPUT_DECIMALS : 2,
|
|
5598
|
+
classNames: {
|
|
5599
|
+
input: cn(
|
|
5600
|
+
"agg-order-amount-input",
|
|
5601
|
+
PLACE_ORDER_NUMERIC_INPUT_CLASS_NAME,
|
|
5602
|
+
"w-full max-w-[168px]",
|
|
5603
|
+
hasEnteredAmount ? "text-agg-foreground" : "text-agg-separator caret-agg-foreground"
|
|
5604
|
+
)
|
|
5343
5605
|
}
|
|
5344
|
-
|
|
5606
|
+
}
|
|
5607
|
+
)
|
|
5608
|
+
] }),
|
|
5609
|
+
showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */ jsxs5("div", { className: "agg-order-fees-section flex items-center justify-between gap-4", children: [
|
|
5610
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-1.5", children: [
|
|
5345
5611
|
/* @__PURE__ */ jsx6(
|
|
5346
|
-
|
|
5612
|
+
Typography,
|
|
5347
5613
|
{
|
|
5348
|
-
|
|
5349
|
-
className: "
|
|
5350
|
-
|
|
5351
|
-
onClick: () => handleLimitPriceStep("increase"),
|
|
5352
|
-
children: /* @__PURE__ */ jsx6(Icon, { name: "plus", size: "small", className: "h-4 w-4", "aria-hidden": true })
|
|
5614
|
+
variant: "text-sm",
|
|
5615
|
+
className: "text-agg-sm leading-agg-5 text-agg-muted-foreground",
|
|
5616
|
+
children: tradingLabels.estimatedFees
|
|
5353
5617
|
}
|
|
5354
|
-
)
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
] })
|
|
5358
|
-
] }) : null,
|
|
5359
|
-
/* @__PURE__ */ jsxs5("div", { className: "agg-order-amount-section flex items-start justify-between gap-4", children: [
|
|
5360
|
-
/* @__PURE__ */ jsxs5("div", { className: "agg-order-amount-meta flex flex-col", children: [
|
|
5361
|
-
/* @__PURE__ */ jsx6("p", { className: "agg-order-amount-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground whitespace-nowrap", children: tradingLabels.amount(internalTab) }),
|
|
5362
|
-
isAuthenticated ? isSell ? /* @__PURE__ */ jsx6("div", { className: "agg-balance-value flex items-baseline gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isCurrentSellableSharesLoading ? /* @__PURE__ */ jsx6(LoadingIcon, { size: "small" }) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
5363
|
-
/* @__PURE__ */ jsx6("span", { className: "whitespace-pre", children: displayedCurrentSellableSharesLabel }),
|
|
5364
|
-
displayedCurrentSellableShares > 0 ? /* @__PURE__ */ jsx6(
|
|
5365
|
-
"button",
|
|
5618
|
+
),
|
|
5619
|
+
feeBreakdownRows.length > 0 ? /* @__PURE__ */ jsx6(
|
|
5620
|
+
Tooltip,
|
|
5366
5621
|
{
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5622
|
+
"aria-label": tradingLabels.estimatedFeesTooltipAria,
|
|
5623
|
+
classNames: {
|
|
5624
|
+
content: cn(
|
|
5625
|
+
"min-w-[220px] max-w-[320px] rounded-[10px] px-5 py-4",
|
|
5626
|
+
"shadow-[0_12px_12px_rgba(0,0,0,0.10)]"
|
|
5627
|
+
),
|
|
5628
|
+
icon: "h-3 w-3 text-agg-muted-foreground",
|
|
5629
|
+
trigger: "h-3 w-3 text-agg-muted-foreground"
|
|
5630
|
+
},
|
|
5631
|
+
content: /* @__PURE__ */ jsx6("div", { className: "flex w-full flex-col gap-2", children: feeBreakdownRows.map((row) => /* @__PURE__ */ jsxs5(
|
|
5632
|
+
"div",
|
|
5633
|
+
{
|
|
5634
|
+
className: "flex items-center justify-between gap-3 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground",
|
|
5635
|
+
children: [
|
|
5636
|
+
/* @__PURE__ */ jsx6("span", { children: row.label }),
|
|
5637
|
+
row.kind === "badge" ? /* @__PURE__ */ jsx6(
|
|
5638
|
+
"span",
|
|
5639
|
+
{
|
|
5640
|
+
className: cn(
|
|
5641
|
+
"agg-fee-badge inline-flex items-center justify-center rounded-agg-sm border border-agg-primary/50",
|
|
5642
|
+
"bg-linear-to-b from-agg-primary/8 to-agg-primary/15 px-1.5 py-1",
|
|
5643
|
+
"text-agg-xs font-agg-bold leading-agg-4 text-agg-primary uppercase whitespace-nowrap"
|
|
5644
|
+
),
|
|
5645
|
+
children: row.badgeLabel
|
|
5646
|
+
}
|
|
5647
|
+
) : /* @__PURE__ */ jsx6("span", { className: "text-right", children: row.value })
|
|
5648
|
+
]
|
|
5649
|
+
},
|
|
5650
|
+
row.label
|
|
5651
|
+
)) })
|
|
5378
5652
|
}
|
|
5379
5653
|
) : null
|
|
5380
|
-
] })
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
CurrencyInput,
|
|
5384
|
-
{
|
|
5385
|
-
value: internalAmount,
|
|
5386
|
-
onChange: handleAmountChange,
|
|
5387
|
-
ariaLabel: tradingLabels.amount(internalTab),
|
|
5388
|
-
max: isLimitOrder && !isSell && isAuthenticated && !isBalanceLoading ? totalBalance : void 0,
|
|
5389
|
-
isInvalid: isInsufficientBalance || isBelowMinimum,
|
|
5390
|
-
disabled: !orderEligibility.canPlaceOrder,
|
|
5391
|
-
prefix: internalTab === "buy" ? "$" : "",
|
|
5392
|
-
decimalPlaces: isSell ? SELL_SHARE_INPUT_DECIMALS : 2,
|
|
5393
|
-
classNames: {
|
|
5394
|
-
input: cn(
|
|
5395
|
-
"agg-order-amount-input",
|
|
5396
|
-
"w-full max-w-[168px] text-right text-agg-3xl font-agg-bold leading-agg-9 tracking-agg-normal",
|
|
5397
|
-
hasEnteredAmount ? "text-agg-foreground" : "text-agg-separator caret-agg-foreground"
|
|
5398
|
-
)
|
|
5399
|
-
}
|
|
5400
|
-
}
|
|
5401
|
-
)
|
|
5654
|
+
] }),
|
|
5655
|
+
/* @__PURE__ */ jsx6("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: estimatedFeesValue })
|
|
5656
|
+
] }) : null
|
|
5402
5657
|
] }),
|
|
5403
|
-
showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */ jsxs5("div", { className: "agg-order-fees-section flex items-center justify-between gap-4", children: [
|
|
5404
|
-
/* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-1.5", children: [
|
|
5405
|
-
/* @__PURE__ */ jsx6(
|
|
5406
|
-
Typography,
|
|
5407
|
-
{
|
|
5408
|
-
variant: "text-sm",
|
|
5409
|
-
className: "text-agg-sm leading-agg-5 text-agg-muted-foreground",
|
|
5410
|
-
children: tradingLabels.estimatedFees
|
|
5411
|
-
}
|
|
5412
|
-
),
|
|
5413
|
-
feeBreakdownRows.length > 0 ? /* @__PURE__ */ jsx6(
|
|
5414
|
-
Tooltip,
|
|
5415
|
-
{
|
|
5416
|
-
"aria-label": tradingLabels.estimatedFeesTooltipAria,
|
|
5417
|
-
classNames: {
|
|
5418
|
-
content: cn(
|
|
5419
|
-
"min-w-[220px] max-w-[320px] rounded-[10px] px-5 py-4",
|
|
5420
|
-
"shadow-[0_12px_12px_rgba(0,0,0,0.10)]"
|
|
5421
|
-
),
|
|
5422
|
-
icon: "h-3 w-3 text-agg-muted-foreground",
|
|
5423
|
-
trigger: "h-3 w-3 text-agg-muted-foreground"
|
|
5424
|
-
},
|
|
5425
|
-
content: /* @__PURE__ */ jsx6("div", { className: "flex w-full flex-col gap-2", children: feeBreakdownRows.map((row) => /* @__PURE__ */ jsxs5(
|
|
5426
|
-
"div",
|
|
5427
|
-
{
|
|
5428
|
-
className: "flex items-center justify-between gap-3 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground",
|
|
5429
|
-
children: [
|
|
5430
|
-
/* @__PURE__ */ jsx6("span", { children: row.label }),
|
|
5431
|
-
row.kind === "badge" ? /* @__PURE__ */ jsx6(
|
|
5432
|
-
"span",
|
|
5433
|
-
{
|
|
5434
|
-
className: cn(
|
|
5435
|
-
"agg-fee-badge inline-flex items-center justify-center rounded-agg-sm border border-agg-primary/50",
|
|
5436
|
-
"bg-linear-to-b from-agg-primary/8 to-agg-primary/15 px-1.5 py-1",
|
|
5437
|
-
"text-agg-xs font-agg-bold leading-agg-4 text-agg-primary uppercase whitespace-nowrap"
|
|
5438
|
-
),
|
|
5439
|
-
children: row.badgeLabel
|
|
5440
|
-
}
|
|
5441
|
-
) : /* @__PURE__ */ jsx6("span", { className: "text-right", children: row.value })
|
|
5442
|
-
]
|
|
5443
|
-
},
|
|
5444
|
-
row.label
|
|
5445
|
-
)) })
|
|
5446
|
-
}
|
|
5447
|
-
) : null
|
|
5448
|
-
] }),
|
|
5449
|
-
/* @__PURE__ */ jsx6("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: estimatedFeesValue })
|
|
5450
|
-
] }) : null,
|
|
5451
5658
|
shouldShowSmartRouting ? /* @__PURE__ */ jsxs5("div", { className: "agg-route-panel flex flex-col gap-3", children: [
|
|
5452
5659
|
/* @__PURE__ */ jsxs5("div", { className: "agg-route-panel-header flex items-center justify-between gap-4", children: [
|
|
5453
5660
|
/* @__PURE__ */ jsx6("p", { className: "agg-route-panel-title text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.smartRouting }),
|
|
@@ -5456,10 +5663,10 @@ var PlaceOrder = ({
|
|
|
5456
5663
|
{
|
|
5457
5664
|
type: "button",
|
|
5458
5665
|
className: "agg-route-toggle flex cursor-pointer items-center gap-1.5 text-agg-sm leading-agg-5 text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary",
|
|
5459
|
-
"aria-label": tradingLabels.viewAllRoutes(
|
|
5666
|
+
"aria-label": tradingLabels.viewAllRoutes(activeRouteCardCount),
|
|
5460
5667
|
onClick: () => setIsRoutesExpanded((currentValue) => !currentValue),
|
|
5461
5668
|
children: [
|
|
5462
|
-
/* @__PURE__ */ jsx6("span", { children: tradingLabels.viewAllRoutes(
|
|
5669
|
+
/* @__PURE__ */ jsx6("span", { children: tradingLabels.viewAllRoutes(activeRouteCardCount) }),
|
|
5463
5670
|
/* @__PURE__ */ jsx6(
|
|
5464
5671
|
Icon,
|
|
5465
5672
|
{
|
|
@@ -5473,16 +5680,16 @@ var PlaceOrder = ({
|
|
|
5473
5680
|
}
|
|
5474
5681
|
) : null
|
|
5475
5682
|
] }),
|
|
5476
|
-
/* @__PURE__ */ jsx6("div", { className: "agg-route-list flex flex-col gap-2", children: isQuoteLoading ? /* @__PURE__ */ jsxs5("div", { className: "agg-route-loading flex flex-col gap-2", "aria-hidden": "true", children: [
|
|
5683
|
+
/* @__PURE__ */ jsx6("div", { className: "agg-route-list flex flex-col gap-2", children: !isLimitOrder && isQuoteLoading ? /* @__PURE__ */ jsxs5("div", { className: "agg-route-loading flex flex-col gap-2", "aria-hidden": "true", children: [
|
|
5477
5684
|
/* @__PURE__ */ jsx6(PlaceOrderRouteCardSkeleton, {}),
|
|
5478
5685
|
/* @__PURE__ */ jsx6(PlaceOrderRouteCardSkeleton, {})
|
|
5479
|
-
] }) :
|
|
5686
|
+
] }) : activeRouteCards.length > 0 ? activeRouteCards.map((card) => {
|
|
5480
5687
|
return /* @__PURE__ */ jsx6(Fragment2, { children: renderRouteCard({
|
|
5481
5688
|
card,
|
|
5482
5689
|
enableAnimations,
|
|
5483
5690
|
isExpanded: card.kind === "split" ? isSplitDetailOpen : isRoutesExpanded,
|
|
5484
|
-
isSelected: !card.isUnavailable && card.id === resolvedSelectedRouteCardId,
|
|
5485
|
-
onSelect:
|
|
5691
|
+
isSelected: !card.isUnavailable && card.id === (isLimitOrder ? selectedLimitRouteCardId : resolvedSelectedRouteCardId),
|
|
5692
|
+
onSelect: handleActiveRouteCardSelect,
|
|
5486
5693
|
tradingLabels
|
|
5487
5694
|
}) }, card.id);
|
|
5488
5695
|
}) : null })
|
|
@@ -5503,7 +5710,6 @@ var PlaceOrder = ({
|
|
|
5503
5710
|
className: "flex min-w-0 cursor-pointer items-center justify-end gap-2 text-right text-agg-base leading-agg-6 text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
|
|
5504
5711
|
"aria-label": tradingLabels.expirationMenuAria,
|
|
5505
5712
|
children: [
|
|
5506
|
-
/* @__PURE__ */ jsx6(Icon, { name: "calendar", size: "small", className: "h-4 w-4 shrink-0", "aria-hidden": true }),
|
|
5507
5713
|
/* @__PURE__ */ jsx6("span", { className: "min-w-0 truncate", children: limitExpirationType === "GTC" ? tradingLabels.expirationGoodTilCanceled : limitExpirationType === "FIVE_MINUTES" ? tradingLabels.expirationFiveMinutes : limitExpirationType === "ONE_HOUR" ? tradingLabels.expirationOneHour : limitExpirationType === "END_OF_DAY" ? tradingLabels.expirationEndOfDay : resolvedCustomExpirationDate ? dayjs(resolvedCustomExpirationDate).format(
|
|
5508
5714
|
"MMM D, YYYY [at] HH:mm"
|
|
5509
5715
|
) : tradingLabels.expirationCustom }),
|