@agg-build/ui 4.0.0 → 4.2.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-JTSLZARU.mjs → chunk-6X6Y4INU.mjs} +2 -2
- package/dist/{chunk-XIDQ2A6W.mjs → chunk-DNPDXL2D.mjs} +1357 -858
- package/dist/{chunk-KX3TQ7WC.mjs → chunk-FTL25XKE.mjs} +1 -1
- package/dist/{chunk-MKU5Q6PN.mjs → chunk-GNEFI4SO.mjs} +25 -8
- package/dist/{chunk-KO6VTRV6.mjs → chunk-QW7VFURU.mjs} +283 -229
- package/dist/{chunk-R362GNI2.mjs → chunk-UDBHAZJJ.mjs} +12 -27
- package/dist/{chunk-VR5ZRDQT.mjs → chunk-WDCH4RRS.mjs} +1 -1
- package/dist/events.js +760 -689
- package/dist/events.mjs +3 -3
- package/dist/index.js +4032 -3479
- package/dist/index.mjs +15 -7
- package/dist/modals.js +1312 -1258
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +3364 -2817
- package/dist/pages.mjs +8 -6
- package/dist/primitives.js +316 -262
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +1996 -1445
- package/dist/trading.mjs +10 -4
- package/dist/types/pages/user-profile/index.d.mts +1 -0
- package/dist/types/pages/user-profile/index.d.ts +1 -0
- package/dist/types/primitives/venue-logo/svg/logo-novig.d.mts +24 -0
- package/dist/types/primitives/venue-logo/svg/logo-novig.d.ts +24 -0
- package/dist/types/primitives/venue-logo/venue-logo.constants.d.mts +1 -1
- package/dist/types/primitives/venue-logo/venue-logo.constants.d.ts +1 -1
- package/dist/types/trading/place-order/index.d.mts +3 -0
- package/dist/types/trading/place-order/index.d.ts +3 -0
- package/dist/types/trading/place-order/index.place-order.execution-steps.d.mts +28 -75
- package/dist/types/trading/place-order/index.place-order.execution-steps.d.ts +28 -75
- package/dist/types/trading/place-order/index.place-order.execution-view.d.mts +25 -0
- package/dist/types/trading/place-order/index.place-order.execution-view.d.ts +25 -0
- 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 +8 -1
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +8 -1
- package/package.json +3 -3
|
@@ -9,12 +9,12 @@ import {
|
|
|
9
9
|
getTradingVenueLabel,
|
|
10
10
|
prepareSettlementDifferences,
|
|
11
11
|
resolveOrderEligibilityMessage
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WDCH4RRS.mjs";
|
|
13
13
|
import {
|
|
14
14
|
ConnectKalshiModal,
|
|
15
15
|
GeoBlockBanner,
|
|
16
16
|
subscribeAggDepositNotification
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-FTL25XKE.mjs";
|
|
18
18
|
import {
|
|
19
19
|
AGG_TERMS_OF_SERVICE_URL,
|
|
20
20
|
Button,
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
resolveResolvedOutcomeLabel,
|
|
48
48
|
skeletonViews,
|
|
49
49
|
useOptionalToast
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-QW7VFURU.mjs";
|
|
51
51
|
|
|
52
52
|
// src/trading/types.ts
|
|
53
53
|
import { Venue, enumGuard, isFiniteNonNeg, safeParse } from "@agg-build/sdk";
|
|
@@ -160,13 +160,17 @@ import {
|
|
|
160
160
|
useVenueKeyStatus,
|
|
161
161
|
useVenueSellQuotes
|
|
162
162
|
} from "@agg-build/hooks";
|
|
163
|
-
import {
|
|
163
|
+
import {
|
|
164
|
+
adjustLimitPriceRawToTick,
|
|
165
|
+
LIMIT_PRICE_RAW_SCALE as LIMIT_ORDER_RAW_SCALE,
|
|
166
|
+
Venue as Venue3
|
|
167
|
+
} from "@agg-build/sdk";
|
|
164
168
|
import NumberFlow from "@number-flow/react";
|
|
165
169
|
import * as Popover from "@radix-ui/react-popover";
|
|
166
170
|
import dayjs from "dayjs";
|
|
167
171
|
import timezone from "dayjs/plugin/timezone";
|
|
168
172
|
import utc from "dayjs/plugin/utc";
|
|
169
|
-
import { Fragment as Fragment2, useCallback as useCallback2, useEffect as useEffect2, useId, useMemo, useRef as useRef2, useState
|
|
173
|
+
import { Fragment as Fragment2, useCallback as useCallback2, useEffect as useEffect2, useId, useMemo, useRef as useRef2, useState } from "react";
|
|
170
174
|
|
|
171
175
|
// src/notifications/agg-notification-events-provider.tsx
|
|
172
176
|
import {
|
|
@@ -894,190 +898,24 @@ var enableExecutionDebugInBrowser = (initial) => {
|
|
|
894
898
|
return store;
|
|
895
899
|
};
|
|
896
900
|
|
|
897
|
-
// src/
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
"
|
|
902
|
-
"
|
|
903
|
-
"
|
|
904
|
-
"
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
var VENUE_NAME_MAP = {
|
|
909
|
-
kalshi: Venue3.kalshi,
|
|
910
|
-
polymarket: Venue3.polymarket,
|
|
911
|
-
limitless: Venue3.limitless,
|
|
912
|
-
opinion: Venue3.opinion,
|
|
913
|
-
predict: Venue3.predict,
|
|
914
|
-
probable: Venue3.probable,
|
|
915
|
-
myriad: Venue3.myriad,
|
|
916
|
-
hyperliquid: Venue3.hyperliquid
|
|
917
|
-
};
|
|
918
|
-
var parseVenueName = (raw) => VENUE_NAME_MAP[raw];
|
|
919
|
-
var NON_VENUE_FINALIZE_PREFIXES = /* @__PURE__ */ new Set(["bridge"]);
|
|
920
|
-
var classifyExecutionStepType = (stepType) => {
|
|
921
|
-
if (!stepType) return null;
|
|
922
|
-
if (WAIT_STEP_TYPES.has(stepType)) return null;
|
|
923
|
-
if (CHECKING_BALANCE_STEP_TYPES.has(stepType)) {
|
|
924
|
-
return { kind: "checking-balance" };
|
|
925
|
-
}
|
|
926
|
-
const buySellMatch = stepType.match(VENUE_BUY_SELL_REGEX);
|
|
927
|
-
if (buySellMatch) {
|
|
928
|
-
const venue = parseVenueName(buySellMatch[1]);
|
|
929
|
-
if (venue) return { kind: "executing-venue", venue };
|
|
930
|
-
}
|
|
931
|
-
const finalizeMatch = stepType.match(VENUE_FINALIZE_REGEX);
|
|
932
|
-
if (finalizeMatch && !NON_VENUE_FINALIZE_PREFIXES.has(finalizeMatch[1])) {
|
|
933
|
-
const venue = parseVenueName(finalizeMatch[1]);
|
|
934
|
-
if (venue) return { kind: "executing-venue", venue };
|
|
935
|
-
}
|
|
936
|
-
if (stepType === "submit-verify-order-status") {
|
|
937
|
-
return null;
|
|
938
|
-
}
|
|
939
|
-
return { kind: "submitting" };
|
|
940
|
-
};
|
|
941
|
-
var buildPhaseTimeline = (dag) => {
|
|
942
|
-
const timeline = [];
|
|
943
|
-
const completed = new Set(dag.completedSequences);
|
|
944
|
-
for (let seq = 1; seq <= dag.totalSteps; seq++) {
|
|
945
|
-
const stepType = dag.stepTypes[seq];
|
|
946
|
-
if (!stepType) continue;
|
|
947
|
-
const classified = classifyExecutionStepType(stepType);
|
|
948
|
-
if (!classified) continue;
|
|
949
|
-
const isCompleted = completed.has(seq);
|
|
950
|
-
const last = timeline[timeline.length - 1];
|
|
951
|
-
if (last && last.kind === classified.kind && last.venue === classified.venue) {
|
|
952
|
-
last.lastSeq = seq;
|
|
953
|
-
last.allCompleted = last.allCompleted && isCompleted;
|
|
954
|
-
continue;
|
|
955
|
-
}
|
|
956
|
-
timeline.push({
|
|
957
|
-
kind: classified.kind,
|
|
958
|
-
venue: classified.venue,
|
|
959
|
-
firstSeq: seq,
|
|
960
|
-
lastSeq: seq,
|
|
961
|
-
allCompleted: isCompleted
|
|
962
|
-
});
|
|
963
|
-
}
|
|
964
|
-
const blockHasProgress = (entry) => {
|
|
965
|
-
if (entry.allCompleted) return true;
|
|
966
|
-
for (let s = entry.firstSeq; s <= entry.lastSeq; s++) {
|
|
967
|
-
if (completed.has(s)) return true;
|
|
968
|
-
}
|
|
969
|
-
return false;
|
|
970
|
-
};
|
|
971
|
-
for (let i = timeline.length - 2; i >= 0; i--) {
|
|
972
|
-
if (timeline[i].allCompleted) continue;
|
|
973
|
-
for (let j = i + 1; j < timeline.length; j++) {
|
|
974
|
-
if (blockHasProgress(timeline[j])) {
|
|
975
|
-
timeline[i].allCompleted = true;
|
|
976
|
-
break;
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
return timeline;
|
|
981
|
-
};
|
|
982
|
-
var phaseRowId = (phase) => phase.venue ? `${phase.kind}:${phase.venue}` : phase.kind;
|
|
983
|
-
var phaseRowLabel = (phase, labels) => {
|
|
984
|
-
switch (phase.kind) {
|
|
985
|
-
case "finding-route":
|
|
986
|
-
return labels.findingBestRoute;
|
|
987
|
-
case "checking-balance":
|
|
988
|
-
return labels.checkingBalance;
|
|
989
|
-
case "submitting":
|
|
990
|
-
return labels.submittingOrderProgress;
|
|
991
|
-
case "wallet-confirm":
|
|
992
|
-
return labels.confirmTransactionInWallet;
|
|
993
|
-
case "executing-venue":
|
|
994
|
-
return labels.executingOnVenue(getTradingVenueLabel(phase.venue));
|
|
995
|
-
case "filled":
|
|
996
|
-
return labels.executionConfirmed;
|
|
997
|
-
case "failed":
|
|
998
|
-
return labels.orderFailureTitle;
|
|
999
|
-
}
|
|
901
|
+
// src/pages/user-profile/chain-display.ts
|
|
902
|
+
var CHAIN_ID_TO_LABEL = {
|
|
903
|
+
"1": "Ethereum",
|
|
904
|
+
"10": "Optimism",
|
|
905
|
+
"56": "BNB Chain",
|
|
906
|
+
"137": "Polygon",
|
|
907
|
+
"324": "zkSync Era",
|
|
908
|
+
"1337": "Hyperliquid",
|
|
909
|
+
"8453": "Base",
|
|
910
|
+
"42161": "Arbitrum",
|
|
911
|
+
"792703809": "Solana"
|
|
1000
912
|
};
|
|
1001
|
-
var
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
}) => {
|
|
1008
|
-
if (phase === "finding-route") {
|
|
1009
|
-
return [
|
|
1010
|
-
{
|
|
1011
|
-
id: "finding-route",
|
|
1012
|
-
label: labels.findingBestRoute,
|
|
1013
|
-
status: "pending"
|
|
1014
|
-
}
|
|
1015
|
-
];
|
|
1016
|
-
}
|
|
1017
|
-
const rows = [
|
|
1018
|
-
{
|
|
1019
|
-
id: "finding-route",
|
|
1020
|
-
label: labels.findingBestRoute,
|
|
1021
|
-
status: "complete"
|
|
1022
|
-
}
|
|
1023
|
-
];
|
|
1024
|
-
const pushPhase = (phaseEntry, status) => {
|
|
1025
|
-
const id = phaseRowId(phaseEntry);
|
|
1026
|
-
if (rows.some((row) => row.id === id)) return;
|
|
1027
|
-
rows.push({
|
|
1028
|
-
id,
|
|
1029
|
-
label: phaseRowLabel(phaseEntry, labels),
|
|
1030
|
-
status,
|
|
1031
|
-
venue: phaseEntry.venue
|
|
1032
|
-
});
|
|
1033
|
-
};
|
|
1034
|
-
if (dagProgress && dagProgress.totalSteps > 0) {
|
|
1035
|
-
const timeline = buildPhaseTimeline(dagProgress);
|
|
1036
|
-
let activeEmitted = false;
|
|
1037
|
-
for (const entry of timeline) {
|
|
1038
|
-
const id = phaseRowId(entry);
|
|
1039
|
-
const alreadyShown = rows.some((row) => row.id === id);
|
|
1040
|
-
if (entry.allCompleted) {
|
|
1041
|
-
if (alreadyShown) continue;
|
|
1042
|
-
pushPhase(entry, "complete");
|
|
1043
|
-
continue;
|
|
1044
|
-
}
|
|
1045
|
-
if (activeEmitted) break;
|
|
1046
|
-
if (alreadyShown) continue;
|
|
1047
|
-
if (isAwaitingWalletConfirmation && entry.kind === "submitting") {
|
|
1048
|
-
pushPhase({ kind: "wallet-confirm" }, "pending");
|
|
1049
|
-
} else {
|
|
1050
|
-
pushPhase(entry, "pending");
|
|
1051
|
-
}
|
|
1052
|
-
activeEmitted = true;
|
|
1053
|
-
}
|
|
1054
|
-
if (!activeEmitted) {
|
|
1055
|
-
const last = rows[rows.length - 1];
|
|
1056
|
-
if (last && last.id.startsWith("executing-venue")) {
|
|
1057
|
-
last.status = "pending";
|
|
1058
|
-
} else {
|
|
1059
|
-
const fallbackVenue = executionVenue;
|
|
1060
|
-
rows.push({
|
|
1061
|
-
id: fallbackVenue ? `executing-venue:${fallbackVenue}` : "executing-venue",
|
|
1062
|
-
label: phaseRowLabel({ kind: "executing-venue", venue: fallbackVenue }, labels),
|
|
1063
|
-
status: "pending",
|
|
1064
|
-
venue: fallbackVenue
|
|
1065
|
-
});
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
return rows;
|
|
1069
|
-
}
|
|
1070
|
-
if (isAwaitingWalletConfirmation) {
|
|
1071
|
-
pushPhase({ kind: "wallet-confirm" }, "pending");
|
|
1072
|
-
return rows;
|
|
1073
|
-
}
|
|
1074
|
-
if (phase === "submitting") {
|
|
1075
|
-
pushPhase({ kind: "submitting" }, "pending");
|
|
1076
|
-
return rows;
|
|
1077
|
-
}
|
|
1078
|
-
pushPhase({ kind: "submitting" }, "complete");
|
|
1079
|
-
pushPhase({ kind: "executing-venue", venue: executionVenue }, "pending");
|
|
1080
|
-
return rows;
|
|
913
|
+
var formatChainIdLabel = (chainId) => {
|
|
914
|
+
var _a;
|
|
915
|
+
if (chainId === null || chainId === void 0) return "";
|
|
916
|
+
const key = String(chainId).trim();
|
|
917
|
+
if (!key) return "";
|
|
918
|
+
return (_a = CHAIN_ID_TO_LABEL[key]) != null ? _a : `Chain ${key}`;
|
|
1081
919
|
};
|
|
1082
920
|
|
|
1083
921
|
// src/trading/place-order/index.place-order.utils.ts
|
|
@@ -1087,7 +925,37 @@ var routePriceLabelFormatter = new Intl.NumberFormat("en-US", {
|
|
|
1087
925
|
minimumFractionDigits: 0,
|
|
1088
926
|
maximumFractionDigits: 1
|
|
1089
927
|
});
|
|
928
|
+
var PLACE_ORDER_PRICE_DISPLAY_MULTIPLIER = 1e3;
|
|
1090
929
|
var GEO_BLOCK_WARNING_PREFIX = "Venue not available in your region";
|
|
930
|
+
var isFiniteNonNegativePrice = (value) => {
|
|
931
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
932
|
+
};
|
|
933
|
+
var isPredictionMarketPrice = (value) => {
|
|
934
|
+
return isFiniteNonNegativePrice(value) && value <= 1;
|
|
935
|
+
};
|
|
936
|
+
var getPlaceOrderAverageExecutionPrice = (quoteData) => {
|
|
937
|
+
var _a;
|
|
938
|
+
if (!quoteData || quoteData.totalFilled <= 0) return null;
|
|
939
|
+
if (isFiniteNonNegativePrice((_a = quoteData.slippage) == null ? void 0 : _a.vwap)) return quoteData.slippage.vwap;
|
|
940
|
+
const averageExecutionPrice = quoteData.rawExecCost / quoteData.totalFilled;
|
|
941
|
+
return isFiniteNonNegativePrice(averageExecutionPrice) ? averageExecutionPrice : null;
|
|
942
|
+
};
|
|
943
|
+
var isPlaceOrderAveragePriceWorse = ({
|
|
944
|
+
averageExecutionPrice,
|
|
945
|
+
displayedMarketPrice,
|
|
946
|
+
tradeSide
|
|
947
|
+
}) => {
|
|
948
|
+
if (!isPredictionMarketPrice(averageExecutionPrice) || !isPredictionMarketPrice(displayedMarketPrice)) {
|
|
949
|
+
return false;
|
|
950
|
+
}
|
|
951
|
+
const displayedAveragePrice = Math.round(
|
|
952
|
+
averageExecutionPrice * PLACE_ORDER_PRICE_DISPLAY_MULTIPLIER
|
|
953
|
+
);
|
|
954
|
+
const displayedReferencePrice = Math.round(
|
|
955
|
+
displayedMarketPrice * PLACE_ORDER_PRICE_DISPLAY_MULTIPLIER
|
|
956
|
+
);
|
|
957
|
+
return tradeSide === "buy" ? displayedAveragePrice > displayedReferencePrice : displayedAveragePrice < displayedReferencePrice;
|
|
958
|
+
};
|
|
1091
959
|
var floorToDecimals = (value, decimals) => {
|
|
1092
960
|
if (!Number.isFinite(value) || value <= 0) return 0;
|
|
1093
961
|
const [coefficient = "0", exponentText = "0"] = value.toString().toLowerCase().split("e");
|
|
@@ -1211,10 +1079,6 @@ var getSmartRouteTotalFees = (feeBreakdown) => {
|
|
|
1211
1079
|
if (!feeParts.every(Number.isFinite)) return null;
|
|
1212
1080
|
return feeParts.reduce((total, fee) => total + fee, 0);
|
|
1213
1081
|
};
|
|
1214
|
-
var hasLowLiquidityWarning = (warnings) => {
|
|
1215
|
-
if (!(warnings == null ? void 0 : warnings.length)) return false;
|
|
1216
|
-
return warnings.some((warning) => (warning == null ? void 0 : warning.reason) === "low_liquidity");
|
|
1217
|
-
};
|
|
1218
1082
|
var getPlaceOrderContainerClassName = () => {
|
|
1219
1083
|
return PLACE_ORDER_CONTAINER_CLASS_NAME;
|
|
1220
1084
|
};
|
|
@@ -1307,7 +1171,8 @@ var resolvePlaceOrderQuoteResult = ({
|
|
|
1307
1171
|
tradeSide
|
|
1308
1172
|
}) => {
|
|
1309
1173
|
if (!quoteData || quoteData.totalFilled <= 0) return null;
|
|
1310
|
-
const avgPrice = quoteData
|
|
1174
|
+
const avgPrice = getPlaceOrderAverageExecutionPrice(quoteData);
|
|
1175
|
+
if (avgPrice == null) return null;
|
|
1311
1176
|
const quoteValue = tradeSide === "sell" ? quoteData.rawExecCost : quoteData.totalFilled;
|
|
1312
1177
|
return {
|
|
1313
1178
|
hint: labels.averagePrice(avgPrice),
|
|
@@ -1423,7 +1288,7 @@ var buildLiveRouteCards = ({
|
|
|
1423
1288
|
eventVenues = [],
|
|
1424
1289
|
geoBlockedVenues: inheritedGeoBlockedVenues
|
|
1425
1290
|
}) => {
|
|
1426
|
-
var _a, _b, _c;
|
|
1291
|
+
var _a, _b, _c, _d;
|
|
1427
1292
|
const geoBlockedVenues = extractGeoBlockedVenues(quoteData.warnings);
|
|
1428
1293
|
for (const venue of inheritedGeoBlockedVenues != null ? inheritedGeoBlockedVenues : []) {
|
|
1429
1294
|
geoBlockedVenues.add(venue);
|
|
@@ -1433,6 +1298,7 @@ var buildLiveRouteCards = ({
|
|
|
1433
1298
|
const primaryVenue = (_a = quoteData.fills[0]) == null ? void 0 : _a.venue;
|
|
1434
1299
|
const parsedPrimaryVenue = parseVenue(primaryVenue);
|
|
1435
1300
|
const isSplit = quoteData.fills.length > 1;
|
|
1301
|
+
const averageExecutionPrice = (_b = getPlaceOrderAverageExecutionPrice(quoteData)) != null ? _b : void 0;
|
|
1436
1302
|
const primaryWinnerVenue = quoteData.fills.length === 1 ? primaryVenue : void 0;
|
|
1437
1303
|
const isPrimaryRouteGeoBlocked = quoteData.fills.length > 0 && quoteData.fills.some((f) => geoBlockedVenues.has(f.venue));
|
|
1438
1304
|
const primaryCard = primaryResult ? isPrimaryRouteGeoBlocked ? isSplit ? null : {
|
|
@@ -1442,6 +1308,7 @@ var buildLiveRouteCards = ({
|
|
|
1442
1308
|
label: getTradingVenueLabel(
|
|
1443
1309
|
parsedPrimaryVenue.success ? parsedPrimaryVenue.data : void 0
|
|
1444
1310
|
),
|
|
1311
|
+
executionPrice: averageExecutionPrice,
|
|
1445
1312
|
numericValue: tradeSide === "sell" ? quoteData.rawExecCost : quoteData.totalFilled,
|
|
1446
1313
|
quoteData,
|
|
1447
1314
|
value: primaryResult.value,
|
|
@@ -1459,9 +1326,10 @@ var buildLiveRouteCards = ({
|
|
|
1459
1326
|
rows: mapQuoteDataToRoutingRows(quoteData, tradeSide),
|
|
1460
1327
|
description: labels.splitOrderDescription,
|
|
1461
1328
|
value: primaryResult.value,
|
|
1462
|
-
venue: isSplit ? void 0 : parsedPrimaryVenue.success ? parsedPrimaryVenue.data : void 0
|
|
1329
|
+
venue: isSplit ? void 0 : parsedPrimaryVenue.success ? parsedPrimaryVenue.data : void 0,
|
|
1330
|
+
executionPrice: averageExecutionPrice
|
|
1463
1331
|
} : null;
|
|
1464
|
-
const soloCards = ((
|
|
1332
|
+
const soloCards = ((_c = quoteData.venueSoloQuotes) != null ? _c : []).filter(
|
|
1465
1333
|
(sq) => sq.status === "ok" && sq.avgPrice !== null && sq.filledQty > 0 && // No `sq.quoteId` requirement: a solo is preview-only whenever its own
|
|
1466
1334
|
// funding lane is short (API nulls the quoteId), which is NOT always the
|
|
1467
1335
|
// whole-quote `insufficient_balance` case — an off-chain winner (Kalshi
|
|
@@ -1511,6 +1379,7 @@ var buildLiveRouteCards = ({
|
|
|
1511
1379
|
hint: labels.averagePrice(avgPrice),
|
|
1512
1380
|
kind: "venue",
|
|
1513
1381
|
label: getTradingVenueLabel(venue),
|
|
1382
|
+
executionPrice: avgPrice,
|
|
1514
1383
|
numericValue: sq.filledQty,
|
|
1515
1384
|
quoteData: soloQuoteData,
|
|
1516
1385
|
value: getTradingValueLabel({
|
|
@@ -1521,7 +1390,7 @@ var buildLiveRouteCards = ({
|
|
|
1521
1390
|
venue
|
|
1522
1391
|
};
|
|
1523
1392
|
});
|
|
1524
|
-
const unavailableCards = ((
|
|
1393
|
+
const unavailableCards = ((_d = quoteData.venueSoloQuotes) != null ? _d : []).filter((sq) => sq.status === "unavailable").map((sq) => {
|
|
1525
1394
|
const parsedVenue = parseVenue(sq.venue);
|
|
1526
1395
|
const venue = parsedVenue.success ? parsedVenue.data : void 0;
|
|
1527
1396
|
return {
|
|
@@ -1562,15 +1431,21 @@ var buildLiveRouteCards = ({
|
|
|
1562
1431
|
return [...baseCards, ...unavailableCards, ...warningOnlyUnavailableCards];
|
|
1563
1432
|
};
|
|
1564
1433
|
var resolveDefaultRouteCardId = (routeCards, primaryStatus) => {
|
|
1565
|
-
var _a, _b, _c, _d;
|
|
1434
|
+
var _a, _b, _c, _d, _e;
|
|
1566
1435
|
if (routeCards.length === 0) return null;
|
|
1436
|
+
const firstExecutableCard = routeCards.find(
|
|
1437
|
+
(card) => !card.isUnavailable && card.quoteData.status === "ok" && card.quoteData.quoteId
|
|
1438
|
+
);
|
|
1567
1439
|
if (primaryStatus === "insufficient_balance") {
|
|
1568
|
-
|
|
1569
|
-
(card) => !card.isUnavailable && card.quoteData.status === "ok" && card.quoteData.quoteId
|
|
1570
|
-
);
|
|
1571
|
-
if (executableCard) return executableCard.id;
|
|
1440
|
+
if (firstExecutableCard) return firstExecutableCard.id;
|
|
1572
1441
|
}
|
|
1573
|
-
return (_d = (
|
|
1442
|
+
return (_e = (_d = (_b = firstExecutableCard == null ? void 0 : firstExecutableCard.id) != null ? _b : (_a = routeCards.find((card) => !card.isUnavailable)) == null ? void 0 : _a.id) != null ? _d : (_c = routeCards[0]) == null ? void 0 : _c.id) != null ? _e : null;
|
|
1443
|
+
};
|
|
1444
|
+
var getPlaceOrderRouteCardIdentity = (card) => {
|
|
1445
|
+
var _a;
|
|
1446
|
+
if (card.kind === "venue") return `venue:${(_a = card.venue) != null ? _a : card.id}`;
|
|
1447
|
+
const venues = [...new Set(card.quoteData.fills.map((fill) => fill.venue))].sort();
|
|
1448
|
+
return `split:${venues.join(",") || card.id}`;
|
|
1574
1449
|
};
|
|
1575
1450
|
var sellSharesToAtomicUnits = (shares) => {
|
|
1576
1451
|
if (!Number.isFinite(shares) || shares <= 0) return BigInt(0);
|
|
@@ -2379,7 +2254,8 @@ var buildPlaceOrderFailureSummary = ({
|
|
|
2379
2254
|
tone: "error"
|
|
2380
2255
|
} : null;
|
|
2381
2256
|
const primaryNonFilledEvent = (_a = sortedEvents.find((e) => e.event !== "filled")) != null ? _a : sortedEvents[0];
|
|
2382
|
-
|
|
2257
|
+
const parsedRetryVenue = primaryNonFilledEvent ? parseVenue(primaryNonFilledEvent.venue) : null;
|
|
2258
|
+
return __spreadProps(__spreadValues({
|
|
2383
2259
|
actionLabel,
|
|
2384
2260
|
actions: resolvePlaceOrderFailureActions({
|
|
2385
2261
|
canRetryRemaining,
|
|
@@ -2391,9 +2267,10 @@ var buildPlaceOrderFailureSummary = ({
|
|
|
2391
2267
|
eventImage,
|
|
2392
2268
|
eventSubtitle,
|
|
2393
2269
|
eventTitle,
|
|
2394
|
-
kind: overallFailureKind
|
|
2270
|
+
kind: overallFailureKind
|
|
2271
|
+
}, (parsedRetryVenue == null ? void 0 : parsedRetryVenue.success) ? { retryVenue: parsedRetryVenue.data } : {}), {
|
|
2395
2272
|
steps: [...baseSteps, ...venueSteps, ...fallbackFailureStep ? [fallbackFailureStep] : []]
|
|
2396
|
-
};
|
|
2273
|
+
});
|
|
2397
2274
|
};
|
|
2398
2275
|
var buildPlaceOrderShareText = ({
|
|
2399
2276
|
actionLabel,
|
|
@@ -2471,8 +2348,590 @@ var isPercentageBelowMinimum = (value, minimumValue) => {
|
|
|
2471
2348
|
return parsedValue < minimumValue;
|
|
2472
2349
|
};
|
|
2473
2350
|
|
|
2474
|
-
// src/trading/place-order/index.place-order.
|
|
2351
|
+
// src/trading/place-order/index.place-order.execution-steps.ts
|
|
2352
|
+
var COMPLETED_RAW_STATUSES = /* @__PURE__ */ new Set([
|
|
2353
|
+
"completed",
|
|
2354
|
+
"skipped"
|
|
2355
|
+
]);
|
|
2356
|
+
var normalizeIdentity = (value) => {
|
|
2357
|
+
var _a;
|
|
2358
|
+
return (_a = value == null ? void 0 : value.trim().toLowerCase()) != null ? _a : "";
|
|
2359
|
+
};
|
|
2360
|
+
var formatTokenAmount = (amount) => amount.toLocaleString("en-US", {
|
|
2361
|
+
maximumFractionDigits: 2,
|
|
2362
|
+
minimumFractionDigits: 0
|
|
2363
|
+
});
|
|
2364
|
+
var formatExecutionChainLabel = (chainId) => {
|
|
2365
|
+
const chainLabel = formatChainIdLabel(chainId);
|
|
2366
|
+
return chainLabel === "BNB Chain" ? "BNB" : chainLabel;
|
|
2367
|
+
};
|
|
2368
|
+
var parseRawUsd = (value) => {
|
|
2369
|
+
if (!value) return null;
|
|
2370
|
+
try {
|
|
2371
|
+
const parsed = Number(BigInt(value)) / 1e6;
|
|
2372
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
2373
|
+
} catch (e) {
|
|
2374
|
+
return null;
|
|
2375
|
+
}
|
|
2376
|
+
};
|
|
2377
|
+
var isRawStepStarted = (step) => step.status !== "pending";
|
|
2378
|
+
var areRawStepsComplete = (steps) => steps.length > 0 && steps.every((step) => COMPLETED_RAW_STATUSES.has(step.status));
|
|
2379
|
+
var resolveRawPhaseStatus = ({
|
|
2380
|
+
steps,
|
|
2381
|
+
nextPhaseStarted
|
|
2382
|
+
}) => {
|
|
2383
|
+
if (nextPhaseStarted || areRawStepsComplete(steps)) return "done";
|
|
2384
|
+
if (steps.some(isRawStepStarted)) return "loading";
|
|
2385
|
+
return "not-started";
|
|
2386
|
+
};
|
|
2387
|
+
var isBridgeRawStep = (step) => normalizeIdentity(step.stepType).startsWith("bridge-");
|
|
2388
|
+
var isVenueExecutionRawStep = (step, venueLabel) => {
|
|
2389
|
+
const stepType = normalizeIdentity(step.stepType);
|
|
2390
|
+
const venue = normalizeIdentity(venueLabel).replace(/\s/g, "");
|
|
2391
|
+
return stepType === `buy-${venue}` || stepType === `sell-${venue}` || stepType === `${venue}-finalize`;
|
|
2392
|
+
};
|
|
2393
|
+
var isSetupRawStep = (step, setupCost) => {
|
|
2394
|
+
const stepType = normalizeIdentity(step.stepType);
|
|
2395
|
+
const venue = normalizeIdentity(setupCost.venue).replace(/\s/g, "");
|
|
2396
|
+
if (setupCost.kind === "venueMarketAta") {
|
|
2397
|
+
return stepType.startsWith("ata-") || stepType.startsWith(`${venue}-setup-`);
|
|
2398
|
+
}
|
|
2399
|
+
return stepType.startsWith("approve-") || stepType.startsWith(`${venue}-setup-`);
|
|
2400
|
+
};
|
|
2401
|
+
var findDestinationChainId = ({
|
|
2402
|
+
allocation,
|
|
2403
|
+
bridgeSteps
|
|
2404
|
+
}) => {
|
|
2405
|
+
var _a, _b, _c;
|
|
2406
|
+
const matchingSourceSteps = bridgeSteps.filter(
|
|
2407
|
+
(step) => normalizeIdentity(step.sourceChainId) === normalizeIdentity(allocation.sourceChainId)
|
|
2408
|
+
);
|
|
2409
|
+
const amountMatch = matchingSourceSteps.find(
|
|
2410
|
+
(step) => Math.abs(step.amount - allocation.amount) < 1e-6
|
|
2411
|
+
);
|
|
2412
|
+
return (_c = (_b = amountMatch == null ? void 0 : amountMatch.destChainId) != null ? _b : (_a = matchingSourceSteps[0]) == null ? void 0 : _a.destChainId) != null ? _c : null;
|
|
2413
|
+
};
|
|
2414
|
+
var deriveBridgeDefinitions = ({
|
|
2415
|
+
quoteData,
|
|
2416
|
+
venue,
|
|
2417
|
+
fallbackDestinationChainId
|
|
2418
|
+
}) => {
|
|
2419
|
+
var _a, _b, _c;
|
|
2420
|
+
const bridgeSteps = (_a = quoteData.bridgeSteps) != null ? _a : [];
|
|
2421
|
+
const venueAllocations = ((_b = quoteData.allocations) != null ? _b : []).filter(
|
|
2422
|
+
(allocation) => normalizeIdentity(allocation.venue) === normalizeIdentity(venue)
|
|
2423
|
+
);
|
|
2424
|
+
const allocations = venueAllocations.length > 0 ? venueAllocations : quoteData.fills.length === 1 ? bridgeSteps.map((step) => ({
|
|
2425
|
+
sourceChainId: step.sourceChainId,
|
|
2426
|
+
venue,
|
|
2427
|
+
amount: step.amount
|
|
2428
|
+
})) : [];
|
|
2429
|
+
const definitions = allocations.flatMap((allocation) => {
|
|
2430
|
+
var _a2;
|
|
2431
|
+
const destinationChainId = (_a2 = findDestinationChainId({ allocation, bridgeSteps })) != null ? _a2 : fallbackDestinationChainId;
|
|
2432
|
+
if (!destinationChainId) return [];
|
|
2433
|
+
if (normalizeIdentity(destinationChainId) === normalizeIdentity(allocation.sourceChainId)) {
|
|
2434
|
+
return [];
|
|
2435
|
+
}
|
|
2436
|
+
return [
|
|
2437
|
+
{
|
|
2438
|
+
amount: allocation.amount,
|
|
2439
|
+
destinationChainId,
|
|
2440
|
+
sourceChainId: allocation.sourceChainId
|
|
2441
|
+
}
|
|
2442
|
+
];
|
|
2443
|
+
});
|
|
2444
|
+
const mergedByLane = /* @__PURE__ */ new Map();
|
|
2445
|
+
for (const definition of definitions) {
|
|
2446
|
+
const laneId = `${normalizeIdentity(definition.sourceChainId)}:${normalizeIdentity(definition.destinationChainId)}`;
|
|
2447
|
+
const existing = mergedByLane.get(laneId);
|
|
2448
|
+
mergedByLane.set(laneId, __spreadProps(__spreadValues({}, definition), {
|
|
2449
|
+
amount: definition.amount + ((_c = existing == null ? void 0 : existing.amount) != null ? _c : 0)
|
|
2450
|
+
}));
|
|
2451
|
+
}
|
|
2452
|
+
return Array.from(mergedByLane.values());
|
|
2453
|
+
};
|
|
2454
|
+
var resolveVenueTerminalEvents = ({
|
|
2455
|
+
allGroupCount,
|
|
2456
|
+
terminalOrderEvents,
|
|
2457
|
+
venue
|
|
2458
|
+
}) => {
|
|
2459
|
+
const matchingEvents = terminalOrderEvents.filter(
|
|
2460
|
+
(event) => normalizeIdentity(event.venue) === normalizeIdentity(venue)
|
|
2461
|
+
);
|
|
2462
|
+
if (matchingEvents.length > 0 || allGroupCount !== 1) return matchingEvents;
|
|
2463
|
+
return terminalOrderEvents.filter((event) => !event.venue.trim());
|
|
2464
|
+
};
|
|
2465
|
+
var resolveActualFillPresentation = ({
|
|
2466
|
+
fallbackAmount,
|
|
2467
|
+
fallbackPrice,
|
|
2468
|
+
terminalOrderEvents
|
|
2469
|
+
}) => {
|
|
2470
|
+
const filledEvents = terminalOrderEvents.filter(
|
|
2471
|
+
(event) => event.event === "filled" || event.event === "partial_fill"
|
|
2472
|
+
);
|
|
2473
|
+
if (filledEvents.length === 0) return { amount: fallbackAmount, price: fallbackPrice };
|
|
2474
|
+
const actualAmounts = filledEvents.map((event) => parseRawUsd(event.filledAmountRaw));
|
|
2475
|
+
if (actualAmounts.some((amount2) => amount2 === null)) {
|
|
2476
|
+
return { amount: fallbackAmount, price: fallbackPrice };
|
|
2477
|
+
}
|
|
2478
|
+
const amount = actualAmounts.reduce((total, value) => total + value, 0);
|
|
2479
|
+
const weightedPriceTotal = filledEvents.reduce((total, event, index) => {
|
|
2480
|
+
var _a;
|
|
2481
|
+
const executionPrice = Number(event.executionPriceRaw);
|
|
2482
|
+
const price = Number.isFinite(executionPrice) && executionPrice > 0 ? executionPrice : fallbackPrice;
|
|
2483
|
+
return total + price * ((_a = actualAmounts[index]) != null ? _a : 0);
|
|
2484
|
+
}, 0);
|
|
2485
|
+
return {
|
|
2486
|
+
amount,
|
|
2487
|
+
price: amount > 0 ? weightedPriceTotal / amount : fallbackPrice
|
|
2488
|
+
};
|
|
2489
|
+
};
|
|
2490
|
+
var resolveBackendStepStatus = (status) => {
|
|
2491
|
+
if (status === "completed" || status === "skipped") return "done";
|
|
2492
|
+
if (status === "in_progress" || status === "failed") return "loading";
|
|
2493
|
+
return "not-started";
|
|
2494
|
+
};
|
|
2495
|
+
var resolveOrderFallbackFill = (quoteData, order, orderIndex) => {
|
|
2496
|
+
var _a;
|
|
2497
|
+
return (_a = quoteData.fills[orderIndex]) != null ? _a : quoteData.fills.find((fill) => normalizeIdentity(fill.venue) === normalizeIdentity(order.venue));
|
|
2498
|
+
};
|
|
2499
|
+
var resolveOrderPresentation = ({
|
|
2500
|
+
labels,
|
|
2501
|
+
order,
|
|
2502
|
+
orderIndex,
|
|
2503
|
+
quoteData,
|
|
2504
|
+
tradeSide
|
|
2505
|
+
}) => {
|
|
2506
|
+
var _a, _b;
|
|
2507
|
+
const fallbackFill = resolveOrderFallbackFill(quoteData, order, orderIndex);
|
|
2508
|
+
const parsedVenue = parseVenue(order.venue);
|
|
2509
|
+
const venue = parsedVenue.success ? parsedVenue.data : void 0;
|
|
2510
|
+
const venueLabel = getTradingVenueLabel(venue, venue ? void 0 : order.venue);
|
|
2511
|
+
const quotedPrice = Number(order.quotedPriceRaw);
|
|
2512
|
+
const executionPrice = Number(order.executionPriceRaw);
|
|
2513
|
+
const price = Number.isFinite(executionPrice) && executionPrice > 0 ? executionPrice : Number.isFinite(quotedPrice) && quotedPrice > 0 ? quotedPrice : (_a = fallbackFill == null ? void 0 : fallbackFill.avgPrice) != null ? _a : 0;
|
|
2514
|
+
const quotedShares = parseRawUsd(order.quotedSharesRaw);
|
|
2515
|
+
const actualShares = parseRawUsd(order.actualSharesRaw);
|
|
2516
|
+
const filledAmount = parseRawUsd(order.filledAmountRaw);
|
|
2517
|
+
const fallbackAmount = fallbackFill ? tradeSide === "buy" ? fallbackFill.venueQty * fallbackFill.avgPrice : fallbackFill.venueQty : 0;
|
|
2518
|
+
const amount = tradeSide === "buy" ? filledAmount != null ? filledAmount : quotedShares != null && quotedPrice > 0 ? quotedShares * quotedPrice : fallbackAmount : (_b = actualShares != null ? actualShares : quotedShares) != null ? _b : fallbackAmount;
|
|
2519
|
+
return {
|
|
2520
|
+
venue,
|
|
2521
|
+
venueLabel,
|
|
2522
|
+
priceLabel: price > 0 ? getTradingRoutePriceLabel(price) : "\u2014",
|
|
2523
|
+
amountLabel: tradeSide === "buy" ? formatUsd(amount) : labels.executionShares(formatTokenAmount(amount))
|
|
2524
|
+
};
|
|
2525
|
+
};
|
|
2526
|
+
var resolveBackendStepFallbackLabels = ({
|
|
2527
|
+
amountLabel,
|
|
2528
|
+
labels,
|
|
2529
|
+
priceLabel,
|
|
2530
|
+
step,
|
|
2531
|
+
venueLabel
|
|
2532
|
+
}) => {
|
|
2533
|
+
if (step.kind === "submit") {
|
|
2534
|
+
return {
|
|
2535
|
+
pendingLabel: labels.submittingOrderProgress,
|
|
2536
|
+
completedLabel: labels.executionOrderSubmitted
|
|
2537
|
+
};
|
|
2538
|
+
}
|
|
2539
|
+
if (step.kind === "setup") {
|
|
2540
|
+
return {
|
|
2541
|
+
pendingLabel: labels.settingUpBridge,
|
|
2542
|
+
completedLabel: labels.bridgeSetupComplete
|
|
2543
|
+
};
|
|
2544
|
+
}
|
|
2545
|
+
if (step.kind === "bridge") {
|
|
2546
|
+
if (!step.bridge) {
|
|
2547
|
+
return {
|
|
2548
|
+
pendingLabel: labels.bridgingFundsProgress,
|
|
2549
|
+
completedLabel: labels.bridgeComplete
|
|
2550
|
+
};
|
|
2551
|
+
}
|
|
2552
|
+
const { amount, tokenSymbol, fromChain, toChain } = step.bridge;
|
|
2553
|
+
if (fromChain === toChain) {
|
|
2554
|
+
return {
|
|
2555
|
+
pendingLabel: labels.depositingFunds(amount, tokenSymbol, toChain),
|
|
2556
|
+
completedLabel: labels.fundsDeposited(amount, tokenSymbol, toChain)
|
|
2557
|
+
};
|
|
2558
|
+
}
|
|
2559
|
+
return {
|
|
2560
|
+
pendingLabel: labels.bridgingFunds(amount, fromChain, toChain, tokenSymbol),
|
|
2561
|
+
completedLabel: labels.fundsBridged(amount, fromChain, toChain, tokenSymbol)
|
|
2562
|
+
};
|
|
2563
|
+
}
|
|
2564
|
+
return {
|
|
2565
|
+
pendingLabel: labels.fillingOnVenue(venueLabel),
|
|
2566
|
+
completedLabel: labels.venueFilledAtPriceWithAmount(venueLabel, amountLabel, priceLabel)
|
|
2567
|
+
};
|
|
2568
|
+
};
|
|
2569
|
+
var deriveBackendExecutionOrderGroups = ({
|
|
2570
|
+
executionOrders,
|
|
2571
|
+
executionSteps,
|
|
2572
|
+
forceCompleted,
|
|
2573
|
+
labels,
|
|
2574
|
+
quoteData,
|
|
2575
|
+
tradeSide
|
|
2576
|
+
}) => {
|
|
2577
|
+
const visibleSteps = executionSteps.filter(
|
|
2578
|
+
(step) => step.kind !== "internal"
|
|
2579
|
+
);
|
|
2580
|
+
const realGroups = executionOrders.flatMap((order, orderIndex) => {
|
|
2581
|
+
const presentation = resolveOrderPresentation({
|
|
2582
|
+
labels,
|
|
2583
|
+
order,
|
|
2584
|
+
orderIndex,
|
|
2585
|
+
quoteData,
|
|
2586
|
+
tradeSide
|
|
2587
|
+
});
|
|
2588
|
+
const groupedSteps = /* @__PURE__ */ new Map();
|
|
2589
|
+
for (const step of visibleSteps) {
|
|
2590
|
+
if (!step.orderIds.includes(order.orderId) || groupedSteps.has(step.groupId)) continue;
|
|
2591
|
+
groupedSteps.set(step.groupId, step);
|
|
2592
|
+
}
|
|
2593
|
+
const steps = Array.from(groupedSteps.values()).map((step) => {
|
|
2594
|
+
const fallbackLabels = resolveBackendStepFallbackLabels({
|
|
2595
|
+
amountLabel: presentation.amountLabel,
|
|
2596
|
+
labels,
|
|
2597
|
+
priceLabel: presentation.priceLabel,
|
|
2598
|
+
step,
|
|
2599
|
+
venueLabel: presentation.venueLabel
|
|
2600
|
+
});
|
|
2601
|
+
const usesBackendPendingLabel = step.groupStatus === "pending" || step.groupStatus === "in_progress" || step.groupStatus === "failed";
|
|
2602
|
+
const usesBackendCompletedLabel = step.groupStatus === "completed" || step.groupStatus === "skipped";
|
|
2603
|
+
return {
|
|
2604
|
+
id: `${order.orderId}:${step.groupId}`,
|
|
2605
|
+
kind: step.kind,
|
|
2606
|
+
pendingLabel: usesBackendPendingLabel ? step.label : fallbackLabels.pendingLabel,
|
|
2607
|
+
completedLabel: usesBackendCompletedLabel ? step.label : fallbackLabels.completedLabel,
|
|
2608
|
+
realStatus: forceCompleted ? "done" : resolveBackendStepStatus(step.groupStatus)
|
|
2609
|
+
};
|
|
2610
|
+
});
|
|
2611
|
+
if (steps.length === 0) return [];
|
|
2612
|
+
return [__spreadProps(__spreadValues({ id: order.orderId }, presentation), { steps })];
|
|
2613
|
+
});
|
|
2614
|
+
return deriveSequentialDisplayGroups(realGroups);
|
|
2615
|
+
};
|
|
2616
|
+
var deriveSequentialDisplayGroups = (groups) => {
|
|
2617
|
+
let hasUnresolvedPredecessor = false;
|
|
2618
|
+
return groups.map((group) => __spreadProps(__spreadValues({}, group), {
|
|
2619
|
+
steps: group.steps.map((_a) => {
|
|
2620
|
+
var _b = _a, { realStatus } = _b, step = __objRest(_b, ["realStatus"]);
|
|
2621
|
+
if (hasUnresolvedPredecessor) {
|
|
2622
|
+
return __spreadProps(__spreadValues({}, step), { status: "not-started" });
|
|
2623
|
+
}
|
|
2624
|
+
if (realStatus === "done") {
|
|
2625
|
+
return __spreadProps(__spreadValues({}, step), { status: "done" });
|
|
2626
|
+
}
|
|
2627
|
+
hasUnresolvedPredecessor = true;
|
|
2628
|
+
return __spreadProps(__spreadValues({}, step), { status: realStatus });
|
|
2629
|
+
})
|
|
2630
|
+
}));
|
|
2631
|
+
};
|
|
2632
|
+
var deriveExecutionOrderGroups = ({
|
|
2633
|
+
quoteData,
|
|
2634
|
+
labels,
|
|
2635
|
+
tradeSide,
|
|
2636
|
+
hasSubmissionResponse,
|
|
2637
|
+
executionSteps = [],
|
|
2638
|
+
executionOrders = [],
|
|
2639
|
+
rawExecutionSteps = [],
|
|
2640
|
+
terminalOrderEvents = [],
|
|
2641
|
+
forceCompleted = false
|
|
2642
|
+
}) => {
|
|
2643
|
+
const hasAuthoritativeTopology = executionOrders.length > 0 && executionSteps.some(
|
|
2644
|
+
(step) => step.kind !== "internal" && step.kind !== "submit" && step.orderIds.length > 0
|
|
2645
|
+
);
|
|
2646
|
+
if (hasAuthoritativeTopology) {
|
|
2647
|
+
return deriveBackendExecutionOrderGroups({
|
|
2648
|
+
executionOrders,
|
|
2649
|
+
executionSteps,
|
|
2650
|
+
forceCompleted,
|
|
2651
|
+
labels,
|
|
2652
|
+
quoteData,
|
|
2653
|
+
tradeSide
|
|
2654
|
+
});
|
|
2655
|
+
}
|
|
2656
|
+
const bridgeRawSteps = rawExecutionSteps.filter(isBridgeRawStep);
|
|
2657
|
+
const hasBridgeProgress = bridgeRawSteps.some(isRawStepStarted);
|
|
2658
|
+
const realGroups = quoteData.fills.map((fill, fillIndex) => {
|
|
2659
|
+
var _a, _b;
|
|
2660
|
+
const parsedVenue = parseVenue(fill.venue);
|
|
2661
|
+
const venue = parsedVenue.success ? parsedVenue.data : void 0;
|
|
2662
|
+
const venueLabel = getTradingVenueLabel(venue, venue ? void 0 : fill.venue);
|
|
2663
|
+
const bridgeDefinitions = deriveBridgeDefinitions({
|
|
2664
|
+
quoteData,
|
|
2665
|
+
venue: fill.venue,
|
|
2666
|
+
fallbackDestinationChainId: fill.chain
|
|
2667
|
+
});
|
|
2668
|
+
const setupCosts = ((_b = (_a = quoteData.feeBreakdown) == null ? void 0 : _a.setupCosts) != null ? _b : []).filter(
|
|
2669
|
+
(setupCost) => !setupCost.alreadyPaid && normalizeIdentity(setupCost.venue) === normalizeIdentity(fill.venue)
|
|
2670
|
+
);
|
|
2671
|
+
const venueRawSteps = rawExecutionSteps.filter(
|
|
2672
|
+
(step) => isVenueExecutionRawStep(step, fill.venue)
|
|
2673
|
+
);
|
|
2674
|
+
const venueTerminalEvents = resolveVenueTerminalEvents({
|
|
2675
|
+
allGroupCount: quoteData.fills.length,
|
|
2676
|
+
terminalOrderEvents,
|
|
2677
|
+
venue: fill.venue
|
|
2678
|
+
});
|
|
2679
|
+
const hasSuccessfulTerminalEvent = venueTerminalEvents.some(
|
|
2680
|
+
(event) => event.event === "filled" || event.event === "partial_fill"
|
|
2681
|
+
);
|
|
2682
|
+
const hasVenueExecutionProgress = venueRawSteps.some(isRawStepStarted);
|
|
2683
|
+
const quotedAmount = fill.venueQty * fill.avgPrice;
|
|
2684
|
+
const actualFill = resolveActualFillPresentation({
|
|
2685
|
+
fallbackAmount: quotedAmount,
|
|
2686
|
+
fallbackPrice: fill.avgPrice,
|
|
2687
|
+
terminalOrderEvents: venueTerminalEvents
|
|
2688
|
+
});
|
|
2689
|
+
const completedAmountLabel = tradeSide === "buy" ? formatUsd(actualFill.amount) : labels.executionShares(formatTokenAmount(fill.venueQty));
|
|
2690
|
+
const completedPriceLabel = getTradingRoutePriceLabel(actualFill.price);
|
|
2691
|
+
const setupRawSteps = rawExecutionSteps.filter(
|
|
2692
|
+
(step) => setupCosts.some((setupCost) => isSetupRawStep(step, setupCost))
|
|
2693
|
+
);
|
|
2694
|
+
const setupStatus = forceCompleted ? "done" : resolveRawPhaseStatus({
|
|
2695
|
+
steps: setupRawSteps,
|
|
2696
|
+
nextPhaseStarted: hasBridgeProgress || hasVenueExecutionProgress
|
|
2697
|
+
});
|
|
2698
|
+
const bridgeStatus = forceCompleted ? "done" : resolveRawPhaseStatus({
|
|
2699
|
+
steps: bridgeRawSteps,
|
|
2700
|
+
nextPhaseStarted: hasVenueExecutionProgress || hasSuccessfulTerminalEvent
|
|
2701
|
+
});
|
|
2702
|
+
const executionStatus = forceCompleted || hasSuccessfulTerminalEvent ? "done" : resolveRawPhaseStatus({ steps: venueRawSteps });
|
|
2703
|
+
const groupId = `${normalizeIdentity(fill.venue) || "venue"}-${fillIndex}`;
|
|
2704
|
+
const steps = [
|
|
2705
|
+
{
|
|
2706
|
+
id: `${groupId}-submit`,
|
|
2707
|
+
kind: "submit",
|
|
2708
|
+
pendingLabel: labels.submittingOrderProgress,
|
|
2709
|
+
completedLabel: labels.executionOrderSubmitted,
|
|
2710
|
+
realStatus: forceCompleted || hasSubmissionResponse ? "done" : "loading"
|
|
2711
|
+
},
|
|
2712
|
+
...setupCosts.map((setupCost, setupIndex) => ({
|
|
2713
|
+
id: `${groupId}-setup-${setupIndex}`,
|
|
2714
|
+
kind: "setup",
|
|
2715
|
+
pendingLabel: labels.settingUpBridge,
|
|
2716
|
+
completedLabel: labels.bridgeSetupComplete,
|
|
2717
|
+
realStatus: setupStatus
|
|
2718
|
+
})),
|
|
2719
|
+
...bridgeDefinitions.map((bridge, bridgeIndex) => {
|
|
2720
|
+
const sourceChain = formatExecutionChainLabel(bridge.sourceChainId);
|
|
2721
|
+
const destinationChain = formatExecutionChainLabel(bridge.destinationChainId);
|
|
2722
|
+
const amount = formatTokenAmount(bridge.amount);
|
|
2723
|
+
return {
|
|
2724
|
+
id: `${groupId}-bridge-${bridgeIndex}`,
|
|
2725
|
+
kind: "bridge",
|
|
2726
|
+
pendingLabel: labels.bridgingFunds(amount, sourceChain, destinationChain),
|
|
2727
|
+
completedLabel: labels.fundsBridged(amount, sourceChain, destinationChain),
|
|
2728
|
+
realStatus: bridgeStatus
|
|
2729
|
+
};
|
|
2730
|
+
}),
|
|
2731
|
+
{
|
|
2732
|
+
id: `${groupId}-execute`,
|
|
2733
|
+
kind: "fill",
|
|
2734
|
+
pendingLabel: labels.fillingOnVenue(venueLabel),
|
|
2735
|
+
completedLabel: labels.venueFilledAtPriceWithAmount(
|
|
2736
|
+
venueLabel,
|
|
2737
|
+
completedAmountLabel,
|
|
2738
|
+
completedPriceLabel
|
|
2739
|
+
),
|
|
2740
|
+
realStatus: executionStatus
|
|
2741
|
+
}
|
|
2742
|
+
];
|
|
2743
|
+
return {
|
|
2744
|
+
id: groupId,
|
|
2745
|
+
venue,
|
|
2746
|
+
venueLabel,
|
|
2747
|
+
priceLabel: getTradingRoutePriceLabel(fill.avgPrice),
|
|
2748
|
+
amountLabel: tradeSide === "buy" ? formatUsd(quotedAmount) : labels.executionShares(formatTokenAmount(fill.venueQty)),
|
|
2749
|
+
steps
|
|
2750
|
+
};
|
|
2751
|
+
});
|
|
2752
|
+
return deriveSequentialDisplayGroups(realGroups);
|
|
2753
|
+
};
|
|
2754
|
+
|
|
2755
|
+
// src/trading/place-order/index.place-order.execution-view.tsx
|
|
2475
2756
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2757
|
+
var PlaceOrderExecutionHeader = ({
|
|
2758
|
+
className,
|
|
2759
|
+
eventDateLabel,
|
|
2760
|
+
eventImage,
|
|
2761
|
+
eventTitle
|
|
2762
|
+
}) => {
|
|
2763
|
+
return /* @__PURE__ */ jsxs3("div", { className: cn("agg-order-execution-header flex flex-col gap-2", className), children: [
|
|
2764
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3", children: [
|
|
2765
|
+
/* @__PURE__ */ jsx4(
|
|
2766
|
+
RemoteImage,
|
|
2767
|
+
{
|
|
2768
|
+
src: eventImage != null ? eventImage : null,
|
|
2769
|
+
alt: "",
|
|
2770
|
+
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
2771
|
+
}
|
|
2772
|
+
),
|
|
2773
|
+
/* @__PURE__ */ jsx4("p", { className: "min-w-0 flex-1 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground line-clamp-2", children: eventTitle })
|
|
2774
|
+
] }),
|
|
2775
|
+
eventDateLabel ? /* @__PURE__ */ jsx4("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: eventDateLabel }) : null
|
|
2776
|
+
] });
|
|
2777
|
+
};
|
|
2778
|
+
var ExecutionStepIndicator = ({
|
|
2779
|
+
enableAnimations,
|
|
2780
|
+
step
|
|
2781
|
+
}) => {
|
|
2782
|
+
if (step.status === "done") {
|
|
2783
|
+
return /* @__PURE__ */ jsx4(
|
|
2784
|
+
Icon,
|
|
2785
|
+
{
|
|
2786
|
+
name: "check-circle",
|
|
2787
|
+
size: "xs",
|
|
2788
|
+
className: "h-3 w-3 shrink-0 text-agg-primary",
|
|
2789
|
+
"aria-hidden": "true"
|
|
2790
|
+
}
|
|
2791
|
+
);
|
|
2792
|
+
}
|
|
2793
|
+
if (step.status === "loading") {
|
|
2794
|
+
return /* @__PURE__ */ jsx4("span", { className: "inline-flex h-3 w-3 shrink-0 items-center justify-center", "aria-hidden": "true", children: /* @__PURE__ */ jsx4(
|
|
2795
|
+
"span",
|
|
2796
|
+
{
|
|
2797
|
+
className: cn(
|
|
2798
|
+
"h-2.5 w-2.5 rounded-full border-[1.5px] border-agg-primary border-r-transparent",
|
|
2799
|
+
getMotionClassName(enableAnimations, "animate-spin")
|
|
2800
|
+
)
|
|
2801
|
+
}
|
|
2802
|
+
) });
|
|
2803
|
+
}
|
|
2804
|
+
return /* @__PURE__ */ jsx4(
|
|
2805
|
+
"span",
|
|
2806
|
+
{
|
|
2807
|
+
className: "h-3 w-3 shrink-0 rounded-full border border-dashed border-agg-separator",
|
|
2808
|
+
"aria-hidden": "true"
|
|
2809
|
+
}
|
|
2810
|
+
);
|
|
2811
|
+
};
|
|
2812
|
+
var PlaceOrderExecutionGroups = ({
|
|
2813
|
+
enableAnimations,
|
|
2814
|
+
groups,
|
|
2815
|
+
labels
|
|
2816
|
+
}) => {
|
|
2817
|
+
return /* @__PURE__ */ jsx4("div", { className: "agg-order-execution-groups flex flex-col gap-5", children: groups.map((group) => /* @__PURE__ */ jsxs3(
|
|
2818
|
+
"section",
|
|
2819
|
+
{
|
|
2820
|
+
className: "agg-order-execution-group flex flex-col gap-3",
|
|
2821
|
+
"aria-label": labels.venueOrder(group.venueLabel),
|
|
2822
|
+
children: [
|
|
2823
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex min-h-5 items-center justify-between gap-3 text-agg-sm leading-agg-5", children: [
|
|
2824
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 items-center gap-2 text-agg-foreground", children: [
|
|
2825
|
+
group.venue ? /* @__PURE__ */ jsx4(
|
|
2826
|
+
VenueLogo,
|
|
2827
|
+
{
|
|
2828
|
+
venue: group.venue,
|
|
2829
|
+
size: "small",
|
|
2830
|
+
ariaLabel: group.venueLabel,
|
|
2831
|
+
className: "h-3.5 w-3.5 shrink-0"
|
|
2832
|
+
}
|
|
2833
|
+
) : null,
|
|
2834
|
+
/* @__PURE__ */ jsx4("h3", { className: "truncate font-agg-normal", children: labels.venueOrder(group.venueLabel) })
|
|
2835
|
+
] }),
|
|
2836
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex shrink-0 items-center gap-2", children: [
|
|
2837
|
+
/* @__PURE__ */ jsx4("span", { className: "text-agg-muted-foreground", children: group.priceLabel }),
|
|
2838
|
+
/* @__PURE__ */ jsx4("span", { className: "text-agg-foreground", children: group.amountLabel })
|
|
2839
|
+
] })
|
|
2840
|
+
] }),
|
|
2841
|
+
/* @__PURE__ */ jsx4("div", { className: "flex flex-col gap-3 pl-[22px]", children: group.steps.map((step) => /* @__PURE__ */ jsxs3(
|
|
2842
|
+
"div",
|
|
2843
|
+
{
|
|
2844
|
+
className: "flex items-start gap-2 text-agg-xs leading-agg-4 text-agg-foreground",
|
|
2845
|
+
"data-kind": step.kind,
|
|
2846
|
+
"data-status": step.status,
|
|
2847
|
+
children: [
|
|
2848
|
+
/* @__PURE__ */ jsx4(ExecutionStepIndicator, { enableAnimations, step }),
|
|
2849
|
+
/* @__PURE__ */ jsx4("p", { className: "min-w-0 flex-1", children: step.status === "done" ? step.completedLabel : step.pendingLabel })
|
|
2850
|
+
]
|
|
2851
|
+
},
|
|
2852
|
+
step.id
|
|
2853
|
+
)) })
|
|
2854
|
+
]
|
|
2855
|
+
},
|
|
2856
|
+
group.id
|
|
2857
|
+
)) });
|
|
2858
|
+
};
|
|
2859
|
+
var PlaceOrderExecutionView = ({
|
|
2860
|
+
className,
|
|
2861
|
+
classNames,
|
|
2862
|
+
enableAnimations,
|
|
2863
|
+
eventDateLabel,
|
|
2864
|
+
eventImage,
|
|
2865
|
+
eventTitle,
|
|
2866
|
+
groups,
|
|
2867
|
+
labels
|
|
2868
|
+
}) => {
|
|
2869
|
+
const steps = groups.flatMap((group) => group.steps);
|
|
2870
|
+
const completedStepCount = steps.filter((step) => step.status === "done").length;
|
|
2871
|
+
return /* @__PURE__ */ jsx4(
|
|
2872
|
+
Card,
|
|
2873
|
+
{
|
|
2874
|
+
className: cn(
|
|
2875
|
+
"group/agg-order-panel",
|
|
2876
|
+
getPlaceOrderContainerClassName(),
|
|
2877
|
+
classNames == null ? void 0 : classNames.root,
|
|
2878
|
+
className
|
|
2879
|
+
),
|
|
2880
|
+
children: /* @__PURE__ */ jsxs3("div", { className: cn("flex flex-col gap-6 p-5", classNames == null ? void 0 : classNames.body), children: [
|
|
2881
|
+
/* @__PURE__ */ jsx4(
|
|
2882
|
+
PlaceOrderExecutionHeader,
|
|
2883
|
+
{
|
|
2884
|
+
className: classNames == null ? void 0 : classNames.header,
|
|
2885
|
+
eventDateLabel,
|
|
2886
|
+
eventImage,
|
|
2887
|
+
eventTitle
|
|
2888
|
+
}
|
|
2889
|
+
),
|
|
2890
|
+
/* @__PURE__ */ jsxs3("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.content), children: [
|
|
2891
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-2", children: [
|
|
2892
|
+
/* @__PURE__ */ jsx4("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: labels.executingOrder }),
|
|
2893
|
+
/* @__PURE__ */ jsx4(
|
|
2894
|
+
"div",
|
|
2895
|
+
{
|
|
2896
|
+
role: "progressbar",
|
|
2897
|
+
"aria-label": labels.executingOrder,
|
|
2898
|
+
"aria-valuemin": 0,
|
|
2899
|
+
"aria-valuemax": steps.length,
|
|
2900
|
+
"aria-valuenow": completedStepCount,
|
|
2901
|
+
className: "flex h-1 w-full gap-0.5",
|
|
2902
|
+
children: steps.map((step) => /* @__PURE__ */ jsx4(
|
|
2903
|
+
"span",
|
|
2904
|
+
{
|
|
2905
|
+
"data-testid": "execution-progress-segment",
|
|
2906
|
+
className: cn(
|
|
2907
|
+
"h-1 min-w-0 flex-1 rounded-agg-full",
|
|
2908
|
+
step.status === "done" ? "bg-agg-primary" : "bg-agg-separator"
|
|
2909
|
+
),
|
|
2910
|
+
"aria-hidden": "true",
|
|
2911
|
+
"data-status": step.status
|
|
2912
|
+
},
|
|
2913
|
+
step.id
|
|
2914
|
+
))
|
|
2915
|
+
}
|
|
2916
|
+
)
|
|
2917
|
+
] }),
|
|
2918
|
+
/* @__PURE__ */ jsx4(
|
|
2919
|
+
PlaceOrderExecutionGroups,
|
|
2920
|
+
{
|
|
2921
|
+
enableAnimations,
|
|
2922
|
+
groups,
|
|
2923
|
+
labels
|
|
2924
|
+
}
|
|
2925
|
+
)
|
|
2926
|
+
] })
|
|
2927
|
+
] })
|
|
2928
|
+
}
|
|
2929
|
+
);
|
|
2930
|
+
};
|
|
2931
|
+
PlaceOrderExecutionView.displayName = "PlaceOrderExecutionView";
|
|
2932
|
+
|
|
2933
|
+
// src/trading/place-order/index.place-order.failure.tsx
|
|
2934
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2476
2935
|
var resolveFailureActionHandler = ({
|
|
2477
2936
|
action,
|
|
2478
2937
|
onDone,
|
|
@@ -2485,12 +2944,12 @@ var resolveFailureActionHandler = ({
|
|
|
2485
2944
|
};
|
|
2486
2945
|
var renderPartialFailureStep = (step) => {
|
|
2487
2946
|
const isWarningStep = step.tone === "warning" || step.tone === "error";
|
|
2488
|
-
return /* @__PURE__ */
|
|
2947
|
+
return /* @__PURE__ */ jsxs4(
|
|
2489
2948
|
"div",
|
|
2490
2949
|
{
|
|
2491
2950
|
className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
2492
2951
|
children: [
|
|
2493
|
-
/* @__PURE__ */
|
|
2952
|
+
/* @__PURE__ */ jsx5(
|
|
2494
2953
|
Icon,
|
|
2495
2954
|
{
|
|
2496
2955
|
name: isWarningStep ? "warning-filled" : "check-circle",
|
|
@@ -2499,8 +2958,8 @@ var renderPartialFailureStep = (step) => {
|
|
|
2499
2958
|
"aria-hidden": "true"
|
|
2500
2959
|
}
|
|
2501
2960
|
),
|
|
2502
|
-
/* @__PURE__ */
|
|
2503
|
-
step.venue ? /* @__PURE__ */
|
|
2961
|
+
/* @__PURE__ */ jsx5("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
2962
|
+
step.venue ? /* @__PURE__ */ jsx5(VenueLogo, { venue: step.venue, size: "small", className: "h-4 w-4 shrink-0" }) : null
|
|
2504
2963
|
]
|
|
2505
2964
|
},
|
|
2506
2965
|
step.id
|
|
@@ -2519,10 +2978,10 @@ var PlaceOrderFailureView = ({
|
|
|
2519
2978
|
const shouldShowPartialFailureLayout = summary.kind === "partial_fill";
|
|
2520
2979
|
const failureStepGroups = shouldShowPartialFailureLayout ? groupPlaceOrderFailureSteps(summary.steps) : [];
|
|
2521
2980
|
if (shouldShowPartialFailureLayout) {
|
|
2522
|
-
return /* @__PURE__ */
|
|
2523
|
-
/* @__PURE__ */
|
|
2524
|
-
/* @__PURE__ */
|
|
2525
|
-
/* @__PURE__ */
|
|
2981
|
+
return /* @__PURE__ */ jsx5(Card, { className: cn("group/agg-order-panel", getPlaceOrderContainerClassName(), className), children: /* @__PURE__ */ jsxs4("div", { className: "agg-order-failure-body flex flex-col gap-6 p-5", children: [
|
|
2982
|
+
/* @__PURE__ */ jsxs4("div", { className: "agg-order-failure-header flex flex-col gap-2", children: [
|
|
2983
|
+
/* @__PURE__ */ jsxs4("div", { className: "agg-order-failure-market flex items-center gap-3", children: [
|
|
2984
|
+
/* @__PURE__ */ jsx5(
|
|
2526
2985
|
RemoteImage,
|
|
2527
2986
|
{
|
|
2528
2987
|
src: (_a = summary.eventImage) != null ? _a : null,
|
|
@@ -2530,12 +2989,12 @@ var PlaceOrderFailureView = ({
|
|
|
2530
2989
|
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
2531
2990
|
}
|
|
2532
2991
|
),
|
|
2533
|
-
/* @__PURE__ */
|
|
2992
|
+
/* @__PURE__ */ jsx5("p", { className: "min-w-0 flex-1 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground line-clamp-2", children: summary.eventTitle })
|
|
2534
2993
|
] }),
|
|
2535
|
-
summary.eventSubtitle ? /* @__PURE__ */
|
|
2994
|
+
summary.eventSubtitle ? /* @__PURE__ */ jsx5("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
|
|
2536
2995
|
] }),
|
|
2537
|
-
/* @__PURE__ */
|
|
2538
|
-
/* @__PURE__ */
|
|
2996
|
+
/* @__PURE__ */ jsx5("div", { className: "flex flex-col gap-4", children: failureStepGroups.map((group, groupIndex) => /* @__PURE__ */ jsx5("div", { className: "flex flex-col gap-2", children: group.map((step) => renderPartialFailureStep(step)) }, `failure-group-${groupIndex}`)) }),
|
|
2997
|
+
/* @__PURE__ */ jsx5("div", { className: "flex items-center gap-4", children: summary.actions.map((action) => /* @__PURE__ */ jsx5(
|
|
2539
2998
|
Button,
|
|
2540
2999
|
{
|
|
2541
3000
|
variant: "tertiary",
|
|
@@ -2549,10 +3008,10 @@ var PlaceOrderFailureView = ({
|
|
|
2549
3008
|
)) })
|
|
2550
3009
|
] }) });
|
|
2551
3010
|
}
|
|
2552
|
-
return /* @__PURE__ */
|
|
2553
|
-
/* @__PURE__ */
|
|
2554
|
-
/* @__PURE__ */
|
|
2555
|
-
/* @__PURE__ */
|
|
3011
|
+
return /* @__PURE__ */ jsx5(Card, { className: cn("group/agg-order-panel", getPlaceOrderContainerClassName(), className), children: /* @__PURE__ */ jsxs4("div", { className: "agg-order-failure-body flex flex-col gap-6 p-5", children: [
|
|
3012
|
+
/* @__PURE__ */ jsxs4("div", { className: "agg-order-failure-header flex flex-col gap-2", children: [
|
|
3013
|
+
/* @__PURE__ */ jsxs4("div", { className: "agg-order-failure-market flex items-center gap-3", children: [
|
|
3014
|
+
/* @__PURE__ */ jsx5(
|
|
2556
3015
|
RemoteImage,
|
|
2557
3016
|
{
|
|
2558
3017
|
src: (_b = summary.eventImage) != null ? _b : null,
|
|
@@ -2560,11 +3019,11 @@ var PlaceOrderFailureView = ({
|
|
|
2560
3019
|
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
2561
3020
|
}
|
|
2562
3021
|
),
|
|
2563
|
-
/* @__PURE__ */
|
|
3022
|
+
/* @__PURE__ */ jsx5("p", { className: "min-w-0 flex-1 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground line-clamp-2", children: summary.eventTitle })
|
|
2564
3023
|
] }),
|
|
2565
|
-
summary.eventSubtitle ? /* @__PURE__ */
|
|
3024
|
+
summary.eventSubtitle ? /* @__PURE__ */ jsx5("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
|
|
2566
3025
|
] }),
|
|
2567
|
-
/* @__PURE__ */
|
|
3026
|
+
/* @__PURE__ */ jsx5(
|
|
2568
3027
|
InlineAlert,
|
|
2569
3028
|
{
|
|
2570
3029
|
tone: "error",
|
|
@@ -2573,7 +3032,7 @@ var PlaceOrderFailureView = ({
|
|
|
2573
3032
|
message: tradingLabels.orderFailureDescription((_c = summary.errorMessage) != null ? _c : "")
|
|
2574
3033
|
}
|
|
2575
3034
|
),
|
|
2576
|
-
/* @__PURE__ */
|
|
3035
|
+
/* @__PURE__ */ jsx5("div", { className: "agg-order-failure-actions flex items-center gap-3", children: summary.actions.map((action) => /* @__PURE__ */ jsx5(
|
|
2577
3036
|
Button,
|
|
2578
3037
|
{
|
|
2579
3038
|
variant: action.variant === "retry" ? "primary" : "secondary",
|
|
@@ -2590,9 +3049,8 @@ var PlaceOrderFailureView = ({
|
|
|
2590
3049
|
PlaceOrderFailureView.displayName = "PlaceOrderFailureView";
|
|
2591
3050
|
|
|
2592
3051
|
// src/trading/place-order/index.place-order.success.tsx
|
|
2593
|
-
import {
|
|
2594
|
-
|
|
2595
|
-
var resolveBuyToWinLabel = (shares) => {
|
|
3052
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3053
|
+
var resolveBuyPayoutLabel = (shares) => {
|
|
2596
3054
|
if (!shares) return "$0";
|
|
2597
3055
|
return shares.startsWith("$") ? shares : `$${shares}`;
|
|
2598
3056
|
};
|
|
@@ -2603,170 +3061,98 @@ var PlaceOrderSuccessView = ({
|
|
|
2603
3061
|
onDone,
|
|
2604
3062
|
onShare: _onShare
|
|
2605
3063
|
}) => {
|
|
2606
|
-
var _a, _b, _c, _d, _e, _f
|
|
2607
|
-
const
|
|
2608
|
-
const
|
|
2609
|
-
const
|
|
2610
|
-
const potentialReturnLabel = summary.potentialReturnLabel
|
|
2611
|
-
const
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
};
|
|
2625
|
-
return /* @__PURE__ */ jsx5(Card, { className: cn("group/agg-order-panel", getPlaceOrderContainerClassName(), className), children: /* @__PURE__ */ jsxs4("div", { className: "agg-order-success-body flex flex-col gap-6 p-5", children: [
|
|
2626
|
-
summary.eventTitle ? /* @__PURE__ */ jsxs4("div", { className: "agg-order-success-header flex flex-col gap-2", children: [
|
|
2627
|
-
/* @__PURE__ */ jsxs4("div", { className: "agg-order-success-market flex items-center gap-3", children: [
|
|
2628
|
-
/* @__PURE__ */ jsx5(
|
|
2629
|
-
RemoteImage,
|
|
2630
|
-
{
|
|
2631
|
-
src: (_h = summary.eventImage) != null ? _h : null,
|
|
2632
|
-
alt: "",
|
|
2633
|
-
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
2634
|
-
}
|
|
2635
|
-
),
|
|
2636
|
-
/* @__PURE__ */ jsx5("p", { className: "min-w-0 flex-1 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground line-clamp-2", children: summary.eventTitle })
|
|
2637
|
-
] }),
|
|
2638
|
-
summary.eventDateLabel ? /* @__PURE__ */ jsx5("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventDateLabel }) : null
|
|
2639
|
-
] }) : null,
|
|
2640
|
-
executionStepGroups.length > 0 ? /* @__PURE__ */ jsxs4("div", { className: "agg-order-success-timeline flex flex-col gap-2", children: [
|
|
2641
|
-
/* @__PURE__ */ jsx5(
|
|
2642
|
-
"div",
|
|
2643
|
-
{
|
|
2644
|
-
"aria-hidden": !isExecutionDetailsExpanded,
|
|
2645
|
-
className: cn(
|
|
2646
|
-
"grid overflow-hidden",
|
|
2647
|
-
isExecutionDetailsExpanded ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0",
|
|
2648
|
-
!isExecutionDetailsExpanded && "pointer-events-none",
|
|
2649
|
-
getMotionClassName(
|
|
2650
|
-
true,
|
|
2651
|
-
"transition-[grid-template-rows,opacity] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
2652
|
-
)
|
|
2653
|
-
),
|
|
2654
|
-
children: /* @__PURE__ */ jsx5("div", { className: "min-h-0", children: /* @__PURE__ */ jsx5("div", { className: "flex flex-col gap-4 pb-2", children: detailedStepGroups.map((group, groupIndex) => /* @__PURE__ */ jsx5("div", { className: "flex flex-col gap-2", children: group.map((step) => /* @__PURE__ */ jsxs4(
|
|
2655
|
-
"div",
|
|
2656
|
-
{
|
|
2657
|
-
className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
2658
|
-
children: [
|
|
2659
|
-
/* @__PURE__ */ jsx5(
|
|
2660
|
-
Icon,
|
|
2661
|
-
{
|
|
2662
|
-
name: resolveStepIconName(step.tone),
|
|
2663
|
-
size: "small",
|
|
2664
|
-
className: cn("h-3 w-3 shrink-0", resolveStepIconClassName(step.tone)),
|
|
2665
|
-
"aria-hidden": "true"
|
|
2666
|
-
}
|
|
2667
|
-
),
|
|
2668
|
-
/* @__PURE__ */ jsx5("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
2669
|
-
step.venue ? /* @__PURE__ */ jsx5(
|
|
2670
|
-
VenueLogo,
|
|
2671
|
-
{
|
|
2672
|
-
venue: step.venue,
|
|
2673
|
-
size: "small",
|
|
2674
|
-
className: "h-4 w-4"
|
|
2675
|
-
}
|
|
2676
|
-
) : null
|
|
2677
|
-
]
|
|
2678
|
-
},
|
|
2679
|
-
step.id
|
|
2680
|
-
)) }, `execution-group-${groupIndex}`)) }) })
|
|
2681
|
-
}
|
|
2682
|
-
),
|
|
2683
|
-
finalStep ? hasExecutionDetails ? /* @__PURE__ */ jsxs4(
|
|
2684
|
-
"button",
|
|
2685
|
-
{
|
|
2686
|
-
type: "button",
|
|
2687
|
-
"aria-expanded": isExecutionDetailsExpanded,
|
|
2688
|
-
className: cn(
|
|
2689
|
-
"flex w-full items-center gap-2 text-left text-agg-sm leading-agg-5 text-agg-foreground",
|
|
2690
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary",
|
|
2691
|
-
"cursor-pointer"
|
|
2692
|
-
),
|
|
2693
|
-
onClick: () => setIsExecutionDetailsExpanded((currentValue) => !currentValue),
|
|
2694
|
-
children: [
|
|
2695
|
-
/* @__PURE__ */ jsx5(
|
|
2696
|
-
Icon,
|
|
2697
|
-
{
|
|
2698
|
-
name: resolveStepIconName(finalStep.tone),
|
|
2699
|
-
size: "small",
|
|
2700
|
-
className: cn("h-3 w-3 shrink-0", resolveStepIconClassName(finalStep.tone)),
|
|
2701
|
-
"aria-hidden": "true"
|
|
2702
|
-
}
|
|
2703
|
-
),
|
|
2704
|
-
/* @__PURE__ */ jsx5("p", { className: "min-w-0 flex-1", children: finalStep.label }),
|
|
2705
|
-
/* @__PURE__ */ jsx5(
|
|
2706
|
-
Icon,
|
|
2707
|
-
{
|
|
2708
|
-
name: isExecutionDetailsExpanded ? "chevron-up" : "chevron-down",
|
|
2709
|
-
size: "small",
|
|
2710
|
-
className: "h-4 w-4 shrink-0 text-agg-muted-foreground",
|
|
2711
|
-
"aria-hidden": "true"
|
|
2712
|
-
}
|
|
2713
|
-
)
|
|
2714
|
-
]
|
|
2715
|
-
}
|
|
2716
|
-
) : /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
2717
|
-
/* @__PURE__ */ jsx5(
|
|
2718
|
-
Icon,
|
|
3064
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3065
|
+
const resolvedTradeSide = (_a = summary.tradeSide) != null ? _a : "buy";
|
|
3066
|
+
const resolvedAmountLabel = (_b = summary.amountLabel) != null ? _b : resolvedTradeSide === "sell" ? summary.shares : summary.estimatedCost;
|
|
3067
|
+
const resolvedPayoutLabel = (_c = summary.toWinLabel) != null ? _c : resolvedTradeSide === "sell" ? summary.estimatedCost : resolveBuyPayoutLabel(summary.shares);
|
|
3068
|
+
const potentialReturnLabel = summary.potentialReturnLabel ? tradingLabels.potentialReturnBetter(summary.potentialReturnLabel) : null;
|
|
3069
|
+
const legacyExecutionSteps = ((_d = summary.executionStepGroups) != null ? _d : []).flat();
|
|
3070
|
+
return /* @__PURE__ */ jsx6(
|
|
3071
|
+
Card,
|
|
3072
|
+
{
|
|
3073
|
+
className: cn(
|
|
3074
|
+
"group/agg-order-panel",
|
|
3075
|
+
getPlaceOrderContainerClassName(),
|
|
3076
|
+
"border-0 ring-1 ring-inset ring-agg-separator",
|
|
3077
|
+
className
|
|
3078
|
+
),
|
|
3079
|
+
children: /* @__PURE__ */ jsxs5("div", { className: "agg-order-success-body flex flex-col gap-6 p-5", children: [
|
|
3080
|
+
summary.eventTitle ? /* @__PURE__ */ jsx6(
|
|
3081
|
+
PlaceOrderExecutionHeader,
|
|
2719
3082
|
{
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
"aria-hidden": "true"
|
|
3083
|
+
eventDateLabel: summary.eventDateLabel,
|
|
3084
|
+
eventImage: summary.eventImage,
|
|
3085
|
+
eventTitle: summary.eventTitle
|
|
2724
3086
|
}
|
|
2725
|
-
),
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
"
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
3087
|
+
) : null,
|
|
3088
|
+
((_e = summary.executionGroups) == null ? void 0 : _e.length) ? /* @__PURE__ */ jsx6(
|
|
3089
|
+
PlaceOrderExecutionGroups,
|
|
3090
|
+
{
|
|
3091
|
+
enableAnimations: false,
|
|
3092
|
+
groups: summary.executionGroups,
|
|
3093
|
+
labels: tradingLabels
|
|
3094
|
+
}
|
|
3095
|
+
) : legacyExecutionSteps.length > 0 ? /* @__PURE__ */ jsx6("div", { className: "flex flex-col gap-3 pl-[22px]", children: legacyExecutionSteps.map((step) => /* @__PURE__ */ jsxs5(
|
|
3096
|
+
"div",
|
|
3097
|
+
{
|
|
3098
|
+
className: "flex items-start gap-2 text-agg-xs leading-agg-4 text-agg-foreground",
|
|
3099
|
+
children: [
|
|
3100
|
+
/* @__PURE__ */ jsx6(
|
|
3101
|
+
Icon,
|
|
3102
|
+
{
|
|
3103
|
+
name: step.tone === "warning" || step.tone === "error" ? "warning-filled" : "check-circle",
|
|
3104
|
+
size: "xs",
|
|
3105
|
+
className: cn(
|
|
3106
|
+
"h-3 w-3 shrink-0",
|
|
3107
|
+
step.tone === "warning" || step.tone === "error" ? "text-agg-warning" : "text-agg-primary"
|
|
3108
|
+
),
|
|
3109
|
+
"aria-hidden": "true"
|
|
3110
|
+
}
|
|
3111
|
+
),
|
|
3112
|
+
/* @__PURE__ */ jsx6("p", { className: "min-w-0 flex-1", children: step.label })
|
|
3113
|
+
]
|
|
3114
|
+
},
|
|
3115
|
+
step.id
|
|
3116
|
+
)) }) : null,
|
|
3117
|
+
/* @__PURE__ */ jsxs5("div", { className: "agg-order-success-pill flex h-11 w-full items-center justify-center gap-2 rounded-agg-full bg-agg-success px-6 py-2.5 text-center text-agg-base font-agg-bold leading-agg-6 text-agg-on-primary", children: [
|
|
3118
|
+
/* @__PURE__ */ jsx6(Icon, { name: "success-check", size: "xs", className: "h-3 w-3 shrink-0 text-current" }),
|
|
3119
|
+
/* @__PURE__ */ jsx6("span", { children: (_f = summary.actionLabel) != null ? _f : tradingLabels.orderSuccessTitle })
|
|
3120
|
+
] }),
|
|
3121
|
+
/* @__PURE__ */ jsxs5("div", { className: "agg-order-success-summary flex flex-col gap-4", children: [
|
|
3122
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between gap-4", children: [
|
|
3123
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex min-w-0 flex-col", children: [
|
|
3124
|
+
/* @__PURE__ */ jsx6("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: summary.requestedAmountLabel ? resolvedTradeSide === "buy" ? tradingLabels.orderAmountFilled : tradingLabels.amount(resolvedTradeSide) : tradingLabels.amount(resolvedTradeSide) }),
|
|
3125
|
+
summary.requestedAmountLabel ? /* @__PURE__ */ jsx6("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: tradingLabels.orderAmountFilledOf(summary.requestedAmountLabel) }) : null
|
|
3126
|
+
] }),
|
|
3127
|
+
/* @__PURE__ */ jsx6("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-foreground", children: resolvedAmountLabel })
|
|
3128
|
+
] }),
|
|
3129
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between gap-4", children: [
|
|
3130
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex min-w-0 flex-col gap-0.5", children: [
|
|
3131
|
+
/* @__PURE__ */ jsx6("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.orderPayout }),
|
|
3132
|
+
potentialReturnLabel ? /* @__PURE__ */ jsx6("span", { className: "inline-flex h-5 items-center rounded-agg-sm border border-agg-primary/50 bg-gradient-to-b from-agg-primary/8 to-agg-primary/15 px-2 text-[10px] font-agg-bold uppercase leading-[14px] text-agg-primary", children: potentialReturnLabel }) : null
|
|
3133
|
+
] }),
|
|
3134
|
+
/* @__PURE__ */ jsx6("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-success", children: resolvedPayoutLabel })
|
|
3135
|
+
] })
|
|
3136
|
+
] }),
|
|
3137
|
+
/* @__PURE__ */ jsx6(
|
|
3138
|
+
Button,
|
|
3139
|
+
{
|
|
3140
|
+
variant: "secondary",
|
|
3141
|
+
size: "large",
|
|
3142
|
+
className: "w-full",
|
|
3143
|
+
"aria-label": tradingLabels.orderNewTrade,
|
|
3144
|
+
onClick: onDone,
|
|
3145
|
+
children: tradingLabels.orderNewTrade
|
|
3146
|
+
}
|
|
3147
|
+
)
|
|
3148
|
+
] })
|
|
3149
|
+
}
|
|
3150
|
+
);
|
|
2765
3151
|
};
|
|
2766
3152
|
PlaceOrderSuccessView.displayName = "PlaceOrderSuccessView";
|
|
2767
3153
|
|
|
2768
3154
|
// src/trading/place-order/index.tsx
|
|
2769
|
-
import { Fragment as Fragment3, jsx as
|
|
3155
|
+
import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2770
3156
|
var SELL_SHARE_INPUT_DECIMALS = 6;
|
|
2771
3157
|
var SELL_SHARE_DISPLAY_DECIMALS = 2;
|
|
2772
3158
|
var resolvePlaceOrderPortalContainer = (triggerElement) => {
|
|
@@ -2776,7 +3162,6 @@ var resolvePlaceOrderPortalContainer = (triggerElement) => {
|
|
|
2776
3162
|
var LIMIT_EXPIRATION_OPTION_COUNT = 5;
|
|
2777
3163
|
dayjs.extend(utc);
|
|
2778
3164
|
dayjs.extend(timezone);
|
|
2779
|
-
var LIMIT_ORDER_RAW_SCALE = BigInt(1e6);
|
|
2780
3165
|
var LIMIT_PRICE_STEP = 1e-3;
|
|
2781
3166
|
var LIMIT_PRICE_MIN = 1e-3;
|
|
2782
3167
|
var LIMIT_PRICE_MAX = 0.999;
|
|
@@ -2803,10 +3188,24 @@ var toLimitSizeRaw = ({
|
|
|
2803
3188
|
};
|
|
2804
3189
|
var formatLimitPriceLabel = (value) => {
|
|
2805
3190
|
return `${(value * 100).toLocaleString("en-US", {
|
|
2806
|
-
minimumFractionDigits:
|
|
2807
|
-
maximumFractionDigits:
|
|
3191
|
+
minimumFractionDigits: 0,
|
|
3192
|
+
maximumFractionDigits: 4
|
|
2808
3193
|
})}\xA2`;
|
|
2809
3194
|
};
|
|
3195
|
+
var formatLimitPriceRawLabel = (value) => {
|
|
3196
|
+
return formatLimitPriceLabel(Number(BigInt(value)) / Number(LIMIT_ORDER_RAW_SCALE));
|
|
3197
|
+
};
|
|
3198
|
+
var getLimitOrderToWinValue = ({
|
|
3199
|
+
amount,
|
|
3200
|
+
limitPriceRaw,
|
|
3201
|
+
side
|
|
3202
|
+
}) => {
|
|
3203
|
+
const priceRaw = BigInt(limitPriceRaw);
|
|
3204
|
+
if (priceRaw <= BigInt(0) || priceRaw >= LIMIT_ORDER_RAW_SCALE) return 0;
|
|
3205
|
+
const sizeRaw = BigInt(toLimitSizeRaw({ amount, limitPriceRaw, side }));
|
|
3206
|
+
if (side === "buy") return Number(sizeRaw) / Number(LIMIT_ORDER_RAW_SCALE);
|
|
3207
|
+
return Number(ceilDiv(priceRaw * sizeRaw, LIMIT_ORDER_RAW_SCALE)) / Number(LIMIT_ORDER_RAW_SCALE);
|
|
3208
|
+
};
|
|
2810
3209
|
var normalizeLimitPrice = (value) => {
|
|
2811
3210
|
if (!Number.isFinite(value)) return LIMIT_PRICE_MIN;
|
|
2812
3211
|
return Math.min(LIMIT_PRICE_MAX, Math.max(LIMIT_PRICE_MIN, Number(value.toFixed(3))));
|
|
@@ -2863,22 +3262,6 @@ var isFillRejection400 = (err) => {
|
|
|
2863
3262
|
const nested = (_a = err.response) == null ? void 0 : _a.status;
|
|
2864
3263
|
return nested === 400;
|
|
2865
3264
|
};
|
|
2866
|
-
var LoadingGlyph = ({
|
|
2867
|
-
className,
|
|
2868
|
-
enableAnimations
|
|
2869
|
-
}) => {
|
|
2870
|
-
return /* @__PURE__ */ jsx6(
|
|
2871
|
-
"span",
|
|
2872
|
-
{
|
|
2873
|
-
"aria-hidden": "true",
|
|
2874
|
-
className: cn(
|
|
2875
|
-
"inline-block rounded-full border-2 border-current border-r-transparent",
|
|
2876
|
-
getMotionClassName(enableAnimations, "animate-spin"),
|
|
2877
|
-
className
|
|
2878
|
-
)
|
|
2879
|
-
}
|
|
2880
|
-
);
|
|
2881
|
-
};
|
|
2882
3265
|
var PlaceOrderSlippageControl = ({
|
|
2883
3266
|
enableAnimations,
|
|
2884
3267
|
onChange,
|
|
@@ -2894,11 +3277,11 @@ var PlaceOrderSlippageControl = ({
|
|
|
2894
3277
|
const warningId = useId();
|
|
2895
3278
|
const defaultValue = finalizePercentageValue(slippageDefaultValue);
|
|
2896
3279
|
const committedValue = finalizePercentageValue(slippageValue) || defaultValue;
|
|
2897
|
-
const [draftValue, setDraftValue] =
|
|
2898
|
-
const [isEditing, setIsEditing] =
|
|
3280
|
+
const [draftValue, setDraftValue] = useState(committedValue);
|
|
3281
|
+
const [isEditing, setIsEditing] = useState(
|
|
2899
3282
|
() => isPercentageBelowMinimum(committedValue, slippageMinimumValue)
|
|
2900
3283
|
);
|
|
2901
|
-
const [shouldFocusInput, setShouldFocusInput] =
|
|
3284
|
+
const [shouldFocusInput, setShouldFocusInput] = useState(false);
|
|
2902
3285
|
useEffect2(() => {
|
|
2903
3286
|
setDraftValue(committedValue);
|
|
2904
3287
|
if (isPercentageBelowMinimum(committedValue, slippageMinimumValue)) {
|
|
@@ -2985,8 +3368,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
2985
3368
|
if (!isEditing) return;
|
|
2986
3369
|
handleCommitDraft(false);
|
|
2987
3370
|
};
|
|
2988
|
-
return /* @__PURE__ */
|
|
2989
|
-
/* @__PURE__ */
|
|
3371
|
+
return /* @__PURE__ */ jsxs6("div", { ref: containerRef, className: "agg-slippage-control w-full", onBlur: handleContainerBlur, children: [
|
|
3372
|
+
/* @__PURE__ */ jsxs6(
|
|
2990
3373
|
"button",
|
|
2991
3374
|
{
|
|
2992
3375
|
ref: triggerRef,
|
|
@@ -3004,8 +3387,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
3004
3387
|
),
|
|
3005
3388
|
onClick: handleToggleEditing,
|
|
3006
3389
|
children: [
|
|
3007
|
-
/* @__PURE__ */
|
|
3008
|
-
/* @__PURE__ */
|
|
3390
|
+
/* @__PURE__ */ jsx7("span", { className: "agg-slippage-label", children: collapsedLabel }),
|
|
3391
|
+
/* @__PURE__ */ jsx7(
|
|
3009
3392
|
Icon,
|
|
3010
3393
|
{
|
|
3011
3394
|
name: isEditing ? "chevron-up" : "pencil",
|
|
@@ -3017,7 +3400,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
3017
3400
|
]
|
|
3018
3401
|
}
|
|
3019
3402
|
),
|
|
3020
|
-
/* @__PURE__ */
|
|
3403
|
+
/* @__PURE__ */ jsx7(
|
|
3021
3404
|
"div",
|
|
3022
3405
|
{
|
|
3023
3406
|
"aria-hidden": !isEditing,
|
|
@@ -3031,10 +3414,10 @@ var PlaceOrderSlippageControl = ({
|
|
|
3031
3414
|
"transition-[grid-template-rows,opacity,margin-top] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
3032
3415
|
)
|
|
3033
3416
|
),
|
|
3034
|
-
children: /* @__PURE__ */
|
|
3035
|
-
/* @__PURE__ */
|
|
3036
|
-
/* @__PURE__ */
|
|
3037
|
-
/* @__PURE__ */
|
|
3417
|
+
children: /* @__PURE__ */ jsx7("div", { className: "min-h-0", children: /* @__PURE__ */ jsxs6("div", { className: "agg-slippage-editor-body flex flex-col gap-2", children: [
|
|
3418
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-slippage-input-row flex h-9 overflow-hidden rounded-agg-sm border border-agg-separator", children: [
|
|
3419
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-slippage-input-group flex min-w-0 flex-1 items-center gap-2 bg-agg-secondary px-3", children: [
|
|
3420
|
+
/* @__PURE__ */ jsx7(
|
|
3038
3421
|
"input",
|
|
3039
3422
|
{
|
|
3040
3423
|
ref: inputRef,
|
|
@@ -3049,7 +3432,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
3049
3432
|
onKeyDown: handleInputKeyDown
|
|
3050
3433
|
}
|
|
3051
3434
|
),
|
|
3052
|
-
/* @__PURE__ */
|
|
3435
|
+
/* @__PURE__ */ jsx7(
|
|
3053
3436
|
"button",
|
|
3054
3437
|
{
|
|
3055
3438
|
type: "button",
|
|
@@ -3067,8 +3450,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
3067
3450
|
}
|
|
3068
3451
|
)
|
|
3069
3452
|
] }),
|
|
3070
|
-
/* @__PURE__ */
|
|
3071
|
-
/* @__PURE__ */
|
|
3453
|
+
/* @__PURE__ */ jsx7("div", { className: "h-full w-px bg-agg-separator", "aria-hidden": "true" }),
|
|
3454
|
+
/* @__PURE__ */ jsx7(
|
|
3072
3455
|
"div",
|
|
3073
3456
|
{
|
|
3074
3457
|
className: "agg-slippage-suffix flex w-9 items-center justify-center bg-agg-secondary-hover text-agg-sm leading-agg-5 text-agg-muted-foreground",
|
|
@@ -3077,7 +3460,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
3077
3460
|
}
|
|
3078
3461
|
)
|
|
3079
3462
|
] }),
|
|
3080
|
-
/* @__PURE__ */
|
|
3463
|
+
/* @__PURE__ */ jsx7(
|
|
3081
3464
|
"div",
|
|
3082
3465
|
{
|
|
3083
3466
|
"aria-hidden": !resolvedWarningMessage,
|
|
@@ -3091,13 +3474,13 @@ var PlaceOrderSlippageControl = ({
|
|
|
3091
3474
|
"transition-[grid-template-rows,opacity] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
3092
3475
|
)
|
|
3093
3476
|
),
|
|
3094
|
-
children: /* @__PURE__ */
|
|
3477
|
+
children: /* @__PURE__ */ jsx7("div", { className: "min-h-0", children: /* @__PURE__ */ jsxs6(
|
|
3095
3478
|
"div",
|
|
3096
3479
|
{
|
|
3097
3480
|
id: warningId,
|
|
3098
3481
|
className: "agg-slippage-warning-message flex items-start gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
3099
3482
|
children: [
|
|
3100
|
-
/* @__PURE__ */
|
|
3483
|
+
/* @__PURE__ */ jsx7(
|
|
3101
3484
|
Icon,
|
|
3102
3485
|
{
|
|
3103
3486
|
name: "warning-filled",
|
|
@@ -3106,7 +3489,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
3106
3489
|
color: "currentColor"
|
|
3107
3490
|
}
|
|
3108
3491
|
),
|
|
3109
|
-
/* @__PURE__ */
|
|
3492
|
+
/* @__PURE__ */ jsx7("p", { children: resolvedWarningMessage != null ? resolvedWarningMessage : "" })
|
|
3110
3493
|
]
|
|
3111
3494
|
}
|
|
3112
3495
|
) })
|
|
@@ -3126,9 +3509,9 @@ var renderCardHeader = ({
|
|
|
3126
3509
|
onClose
|
|
3127
3510
|
}) => {
|
|
3128
3511
|
if (!headerTitle) return null;
|
|
3129
|
-
return /* @__PURE__ */
|
|
3130
|
-
/* @__PURE__ */
|
|
3131
|
-
/* @__PURE__ */
|
|
3512
|
+
return /* @__PURE__ */ jsxs6("div", { className: cn("agg-order-panel-header flex flex-col gap-2", className), children: [
|
|
3513
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-order-market-summary flex items-center gap-3", children: [
|
|
3514
|
+
/* @__PURE__ */ jsx7(
|
|
3132
3515
|
RemoteImage,
|
|
3133
3516
|
{
|
|
3134
3517
|
src: headerImage,
|
|
@@ -3136,19 +3519,19 @@ var renderCardHeader = ({
|
|
|
3136
3519
|
className: "agg-order-market-image h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
3137
3520
|
}
|
|
3138
3521
|
),
|
|
3139
|
-
/* @__PURE__ */
|
|
3140
|
-
onClose ? /* @__PURE__ */
|
|
3522
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-order-market-title min-w-0 flex-1 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground line-clamp-2", children: headerTitle }),
|
|
3523
|
+
onClose ? /* @__PURE__ */ jsx7(
|
|
3141
3524
|
"button",
|
|
3142
3525
|
{
|
|
3143
3526
|
type: "button",
|
|
3144
3527
|
className: "agg-order-close -mr-1 -mt-1 hidden shrink-0 cursor-pointer items-center justify-center p-1 text-agg-muted-foreground hover:text-agg-foreground sm:flex",
|
|
3145
3528
|
"aria-label": "Close",
|
|
3146
3529
|
onClick: onClose,
|
|
3147
|
-
children: /* @__PURE__ */
|
|
3530
|
+
children: /* @__PURE__ */ jsx7(CloseIcon, { className: "h-5 w-5" })
|
|
3148
3531
|
}
|
|
3149
3532
|
) : null
|
|
3150
3533
|
] }),
|
|
3151
|
-
headerSubtitle ? /* @__PURE__ */
|
|
3534
|
+
headerSubtitle ? /* @__PURE__ */ jsx7("p", { className: "agg-order-market-subtitle text-agg-base leading-agg-6 text-agg-foreground", children: headerSubtitle }) : null
|
|
3152
3535
|
] });
|
|
3153
3536
|
};
|
|
3154
3537
|
var PlaceOrderResolvedView = ({
|
|
@@ -3169,7 +3552,7 @@ var PlaceOrderResolvedView = ({
|
|
|
3169
3552
|
return endDateLabel ? `${tradingState.market.question} \xB7 ${endDateLabel}` : tradingState.market.question;
|
|
3170
3553
|
})() : "";
|
|
3171
3554
|
if (isResolvingMarket) {
|
|
3172
|
-
return /* @__PURE__ */
|
|
3555
|
+
return /* @__PURE__ */ jsx7(
|
|
3173
3556
|
Card,
|
|
3174
3557
|
{
|
|
3175
3558
|
className: cn(
|
|
@@ -3180,7 +3563,7 @@ var PlaceOrderResolvedView = ({
|
|
|
3180
3563
|
),
|
|
3181
3564
|
role: "status",
|
|
3182
3565
|
"aria-label": labels.marketDetails.resolvingTitle,
|
|
3183
|
-
children: /* @__PURE__ */
|
|
3566
|
+
children: /* @__PURE__ */ jsxs6(
|
|
3184
3567
|
"div",
|
|
3185
3568
|
{
|
|
3186
3569
|
className: cn(
|
|
@@ -3188,12 +3571,12 @@ var PlaceOrderResolvedView = ({
|
|
|
3188
3571
|
classNames == null ? void 0 : classNames.body
|
|
3189
3572
|
),
|
|
3190
3573
|
children: [
|
|
3191
|
-
/* @__PURE__ */
|
|
3192
|
-
/* @__PURE__ */
|
|
3193
|
-
/* @__PURE__ */
|
|
3194
|
-
resolvingSubtitle ? /* @__PURE__ */
|
|
3574
|
+
/* @__PURE__ */ jsx7("div", { className: "flex h-[60px] w-[60px] items-center justify-center rounded-full bg-agg-primary/10", children: /* @__PURE__ */ jsx7(LoadingIcon, { variant: "prominent" }) }),
|
|
3575
|
+
/* @__PURE__ */ jsxs6("div", { className: cn("flex w-full flex-col items-center gap-1", classNames == null ? void 0 : classNames.content), children: [
|
|
3576
|
+
/* @__PURE__ */ jsx7(Typography, { variant: "body-large-strong", children: labels.marketDetails.resolvingTitle }),
|
|
3577
|
+
resolvingSubtitle ? /* @__PURE__ */ jsx7(Typography, { variant: "body", className: "text-center", children: resolvingSubtitle }) : null
|
|
3195
3578
|
] }),
|
|
3196
|
-
/* @__PURE__ */
|
|
3579
|
+
/* @__PURE__ */ jsx7(
|
|
3197
3580
|
Typography,
|
|
3198
3581
|
{
|
|
3199
3582
|
variant: "label",
|
|
@@ -3207,7 +3590,7 @@ var PlaceOrderResolvedView = ({
|
|
|
3207
3590
|
}
|
|
3208
3591
|
);
|
|
3209
3592
|
}
|
|
3210
|
-
return /* @__PURE__ */
|
|
3593
|
+
return /* @__PURE__ */ jsx7(
|
|
3211
3594
|
Card,
|
|
3212
3595
|
{
|
|
3213
3596
|
className: cn(
|
|
@@ -3216,19 +3599,19 @@ var PlaceOrderResolvedView = ({
|
|
|
3216
3599
|
classNames == null ? void 0 : classNames.root,
|
|
3217
3600
|
className
|
|
3218
3601
|
),
|
|
3219
|
-
children: /* @__PURE__ */
|
|
3220
|
-
/* @__PURE__ */
|
|
3221
|
-
/* @__PURE__ */
|
|
3602
|
+
children: /* @__PURE__ */ jsxs6("div", { className: cn("agg-order-panel-body flex flex-col", classNames == null ? void 0 : classNames.body), children: [
|
|
3603
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col items-center gap-6 p-8", children: [
|
|
3604
|
+
/* @__PURE__ */ jsx7(
|
|
3222
3605
|
"div",
|
|
3223
3606
|
{
|
|
3224
3607
|
className: cn(
|
|
3225
3608
|
"flex h-15 w-15 items-center justify-center rounded-full",
|
|
3226
3609
|
"bg-agg-primary/15"
|
|
3227
3610
|
),
|
|
3228
|
-
children: /* @__PURE__ */
|
|
3611
|
+
children: /* @__PURE__ */ jsx7(Icon, { name: "success-check", className: cn("h-6 w-6", "text-agg-primary") })
|
|
3229
3612
|
}
|
|
3230
3613
|
),
|
|
3231
|
-
/* @__PURE__ */
|
|
3614
|
+
/* @__PURE__ */ jsxs6(
|
|
3232
3615
|
"div",
|
|
3233
3616
|
{
|
|
3234
3617
|
className: cn(
|
|
@@ -3236,8 +3619,8 @@ var PlaceOrderResolvedView = ({
|
|
|
3236
3619
|
classNames == null ? void 0 : classNames.content
|
|
3237
3620
|
),
|
|
3238
3621
|
children: [
|
|
3239
|
-
tradingState.market ? /* @__PURE__ */
|
|
3240
|
-
tradingState.winningOutcome ? /* @__PURE__ */
|
|
3622
|
+
tradingState.market ? /* @__PURE__ */ jsx7(Typography, { variant: "body", className: "text-center", children: tradingState.market.question }) : null,
|
|
3623
|
+
tradingState.winningOutcome ? /* @__PURE__ */ jsx7(Typography, { variant: "body-large-strong", children: tradingLabels.outcome(
|
|
3241
3624
|
shouldUseRawResolvedPlaceOrderOutcomeLabel(
|
|
3242
3625
|
tradingState.market,
|
|
3243
3626
|
tradingState.winningOutcome
|
|
@@ -3251,25 +3634,25 @@ var PlaceOrderResolvedView = ({
|
|
|
3251
3634
|
}
|
|
3252
3635
|
)
|
|
3253
3636
|
] }),
|
|
3254
|
-
resolvedClaim ? /* @__PURE__ */
|
|
3255
|
-
/* @__PURE__ */
|
|
3256
|
-
/* @__PURE__ */
|
|
3257
|
-
/* @__PURE__ */
|
|
3258
|
-
/* @__PURE__ */
|
|
3259
|
-
resolvedClaim.resolutionDateLabel ? /* @__PURE__ */
|
|
3260
|
-
/* @__PURE__ */
|
|
3261
|
-
/* @__PURE__ */
|
|
3637
|
+
resolvedClaim ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
3638
|
+
/* @__PURE__ */ jsx7("div", { className: "h-px w-full bg-agg-separator" }),
|
|
3639
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex w-full flex-col gap-5 p-6", children: [
|
|
3640
|
+
/* @__PURE__ */ jsx7(Typography, { variant: "body-strong", className: "text-center", children: tradingLabels.resolvedEarningsTitle }),
|
|
3641
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-3 text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
3642
|
+
resolvedClaim.resolutionDateLabel ? /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-4", children: [
|
|
3643
|
+
/* @__PURE__ */ jsx7("span", { children: tradingLabels.resolvedResolutionDateLabel }),
|
|
3644
|
+
/* @__PURE__ */ jsx7("span", { className: "font-agg-bold", children: resolvedClaim.resolutionDateLabel })
|
|
3262
3645
|
] }) : null,
|
|
3263
|
-
/* @__PURE__ */
|
|
3264
|
-
/* @__PURE__ */
|
|
3265
|
-
/* @__PURE__ */
|
|
3646
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-4", children: [
|
|
3647
|
+
/* @__PURE__ */ jsx7("span", { children: tradingLabels.resolvedSharesLabel }),
|
|
3648
|
+
/* @__PURE__ */ jsx7("span", { className: "font-agg-bold", children: resolvedClaim.sharesLabel })
|
|
3266
3649
|
] }),
|
|
3267
|
-
/* @__PURE__ */
|
|
3268
|
-
/* @__PURE__ */
|
|
3269
|
-
/* @__PURE__ */
|
|
3650
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-4", children: [
|
|
3651
|
+
/* @__PURE__ */ jsx7("span", { children: tradingLabels.resolvedTotalPayoutLabel }),
|
|
3652
|
+
/* @__PURE__ */ jsx7("span", { className: "font-agg-bold", children: resolvedClaim.totalPayoutLabel })
|
|
3270
3653
|
] })
|
|
3271
3654
|
] }),
|
|
3272
|
-
resolvedClaim.onClaim ? /* @__PURE__ */
|
|
3655
|
+
resolvedClaim.onClaim ? /* @__PURE__ */ jsx7(
|
|
3273
3656
|
Button,
|
|
3274
3657
|
{
|
|
3275
3658
|
size: "large",
|
|
@@ -3290,18 +3673,18 @@ var renderRouteBreakdownRow = (row) => {
|
|
|
3290
3673
|
var _a, _b;
|
|
3291
3674
|
const venueLabel = getTradingVenueLabel(row.venue);
|
|
3292
3675
|
const rowKey = `${row.venue}-${row.label}-${row.priceLabel}-${(_a = row.resultLabel) != null ? _a : ""}`;
|
|
3293
|
-
return /* @__PURE__ */
|
|
3676
|
+
return /* @__PURE__ */ jsxs6(
|
|
3294
3677
|
"div",
|
|
3295
3678
|
{
|
|
3296
3679
|
className: "agg-route-breakdown-row flex items-center justify-between gap-4 text-left",
|
|
3297
3680
|
children: [
|
|
3298
|
-
/* @__PURE__ */
|
|
3299
|
-
/* @__PURE__ */
|
|
3300
|
-
/* @__PURE__ */
|
|
3681
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-route-breakdown-market flex min-w-0 items-center gap-2", children: [
|
|
3682
|
+
/* @__PURE__ */ jsx7(VenueLogo, { venue: row.venue, className: "size-3!", ariaLabel: venueLabel }),
|
|
3683
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-route-breakdown-label truncate text-agg-sm leading-agg-5 text-agg-foreground", children: row.label })
|
|
3301
3684
|
] }),
|
|
3302
|
-
/* @__PURE__ */
|
|
3303
|
-
/* @__PURE__ */
|
|
3304
|
-
/* @__PURE__ */
|
|
3685
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-route-breakdown-value flex shrink-0 items-center gap-2 text-agg-sm leading-agg-5", children: [
|
|
3686
|
+
/* @__PURE__ */ jsx7("p", { className: "text-agg-muted-foreground", children: row.priceLabel }),
|
|
3687
|
+
/* @__PURE__ */ jsx7("p", { className: "text-agg-foreground", children: (_b = row.resultLabel) != null ? _b : "" })
|
|
3305
3688
|
] })
|
|
3306
3689
|
]
|
|
3307
3690
|
},
|
|
@@ -3329,7 +3712,7 @@ var renderRouteCard = ({
|
|
|
3329
3712
|
var _a, _b, _c;
|
|
3330
3713
|
const showSplitDetails = isSelected && isExpanded && card.kind === "split" && !!((_a = card.rows) == null ? void 0 : _a.length);
|
|
3331
3714
|
const ariaLabel = [card.label, card.hint, card.value].filter(Boolean).join(" ");
|
|
3332
|
-
return /* @__PURE__ */
|
|
3715
|
+
return /* @__PURE__ */ jsx7(
|
|
3333
3716
|
"button",
|
|
3334
3717
|
{
|
|
3335
3718
|
type: "button",
|
|
@@ -3348,10 +3731,10 @@ var renderRouteCard = ({
|
|
|
3348
3731
|
isSelected && !card.isUnavailable ? "border border-agg-trade-highlight-border bg-linear-to-b from-agg-trade-highlight-surface-from to-agg-trade-highlight-surface-to" : "border-transparent bg-agg-secondary-hover"
|
|
3349
3732
|
),
|
|
3350
3733
|
onClick: () => onSelect(card.id),
|
|
3351
|
-
children: /* @__PURE__ */
|
|
3352
|
-
/* @__PURE__ */
|
|
3353
|
-
/* @__PURE__ */
|
|
3354
|
-
card.kind === "split" ? /* @__PURE__ */
|
|
3734
|
+
children: /* @__PURE__ */ jsxs6("div", { className: "agg-route-card-content relative z-10 flex flex-col gap-3", children: [
|
|
3735
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-route-card-header flex items-center justify-between gap-4", children: [
|
|
3736
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-route-card-meta flex min-w-0 gap-3 items-center", children: [
|
|
3737
|
+
card.kind === "split" ? /* @__PURE__ */ jsx7(
|
|
3355
3738
|
Icon,
|
|
3356
3739
|
{
|
|
3357
3740
|
name: "sparkles-filled",
|
|
@@ -3362,7 +3745,7 @@ var renderRouteCard = ({
|
|
|
3362
3745
|
),
|
|
3363
3746
|
"aria-hidden": "true"
|
|
3364
3747
|
}
|
|
3365
|
-
) : card.venue ? /* @__PURE__ */
|
|
3748
|
+
) : card.venue ? /* @__PURE__ */ jsx7(
|
|
3366
3749
|
VenueLogo,
|
|
3367
3750
|
{
|
|
3368
3751
|
venue: card.venue,
|
|
@@ -3370,10 +3753,10 @@ var renderRouteCard = ({
|
|
|
3370
3753
|
ariaLabel: getTradingVenueLabel(card.venue)
|
|
3371
3754
|
}
|
|
3372
3755
|
) : null,
|
|
3373
|
-
/* @__PURE__ */
|
|
3374
|
-
/* @__PURE__ */
|
|
3375
|
-
/* @__PURE__ */
|
|
3376
|
-
card.isUnavailable ? /* @__PURE__ */
|
|
3756
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-1 min-w-0", children: [
|
|
3757
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1.5", children: [
|
|
3758
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-route-card-title truncate text-agg-sm leading-agg-5 text-agg-foreground", children: card.label }),
|
|
3759
|
+
card.isUnavailable ? /* @__PURE__ */ jsx7(
|
|
3377
3760
|
Icon,
|
|
3378
3761
|
{
|
|
3379
3762
|
name: "lock",
|
|
@@ -3381,7 +3764,7 @@ var renderRouteCard = ({
|
|
|
3381
3764
|
className: "shrink-0 text-agg-muted-foreground",
|
|
3382
3765
|
"aria-hidden": "true"
|
|
3383
3766
|
}
|
|
3384
|
-
) : card.insufficientInventory ? /* @__PURE__ */
|
|
3767
|
+
) : card.insufficientInventory ? /* @__PURE__ */ jsx7(
|
|
3385
3768
|
Icon,
|
|
3386
3769
|
{
|
|
3387
3770
|
name: "warning",
|
|
@@ -3389,7 +3772,7 @@ var renderRouteCard = ({
|
|
|
3389
3772
|
className: "shrink-0 text-agg-muted-foreground",
|
|
3390
3773
|
"aria-hidden": "true"
|
|
3391
3774
|
}
|
|
3392
|
-
) : card.kind === "split" && isSelected ? /* @__PURE__ */
|
|
3775
|
+
) : card.kind === "split" && isSelected ? /* @__PURE__ */ jsx7(
|
|
3393
3776
|
Icon,
|
|
3394
3777
|
{
|
|
3395
3778
|
name: showSplitDetails ? "chevron-up" : "chevron-down",
|
|
@@ -3399,10 +3782,10 @@ var renderRouteCard = ({
|
|
|
3399
3782
|
}
|
|
3400
3783
|
) : null
|
|
3401
3784
|
] }),
|
|
3402
|
-
card.hint ? /* @__PURE__ */
|
|
3785
|
+
card.hint ? /* @__PURE__ */ jsx7("p", { className: "agg-route-card-hint text-agg-xs leading-agg-4 text-agg-muted-foreground", children: card.hint }) : null
|
|
3403
3786
|
] })
|
|
3404
3787
|
] }),
|
|
3405
|
-
/* @__PURE__ */
|
|
3788
|
+
/* @__PURE__ */ jsx7(
|
|
3406
3789
|
"p",
|
|
3407
3790
|
{
|
|
3408
3791
|
className: cn(
|
|
@@ -3414,101 +3797,14 @@ var renderRouteCard = ({
|
|
|
3414
3797
|
}
|
|
3415
3798
|
)
|
|
3416
3799
|
] }),
|
|
3417
|
-
showSplitDetails ? /* @__PURE__ */
|
|
3418
|
-
/* @__PURE__ */
|
|
3419
|
-
/* @__PURE__ */
|
|
3800
|
+
showSplitDetails ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
3801
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-route-card-description text-agg-xs leading-agg-4 text-agg-foreground", children: (_b = card.description) != null ? _b : tradingLabels.splitOrderDescription }),
|
|
3802
|
+
/* @__PURE__ */ jsx7("div", { className: "agg-route-breakdown flex flex-col gap-3", children: (_c = card.rows) == null ? void 0 : _c.map((row) => renderRouteBreakdownRow(row)) })
|
|
3420
3803
|
] }) : null
|
|
3421
3804
|
] })
|
|
3422
3805
|
}
|
|
3423
3806
|
);
|
|
3424
3807
|
};
|
|
3425
|
-
var renderSubmissionSurface = ({
|
|
3426
|
-
actionLabel,
|
|
3427
|
-
className,
|
|
3428
|
-
classNames,
|
|
3429
|
-
enableAnimations,
|
|
3430
|
-
headerSubtitle,
|
|
3431
|
-
headerImage,
|
|
3432
|
-
headerTitle,
|
|
3433
|
-
progressState,
|
|
3434
|
-
tradingLabels
|
|
3435
|
-
}) => {
|
|
3436
|
-
const displayRows = buildSubmissionDisplayRows({
|
|
3437
|
-
phase: progressState.phase,
|
|
3438
|
-
dagProgress: progressState.dagProgress,
|
|
3439
|
-
executionVenue: progressState.executionVenue,
|
|
3440
|
-
labels: tradingLabels
|
|
3441
|
-
});
|
|
3442
|
-
return /* @__PURE__ */ jsx6(
|
|
3443
|
-
Card,
|
|
3444
|
-
{
|
|
3445
|
-
className: cn(
|
|
3446
|
-
"group/agg-order-panel",
|
|
3447
|
-
getPlaceOrderContainerClassName(),
|
|
3448
|
-
classNames == null ? void 0 : classNames.root,
|
|
3449
|
-
className
|
|
3450
|
-
),
|
|
3451
|
-
children: /* @__PURE__ */ jsxs5("div", { className: cn("agg-order-submission-body flex flex-col gap-6 p-5", classNames == null ? void 0 : classNames.body), children: [
|
|
3452
|
-
renderCardHeader({
|
|
3453
|
-
className: classNames == null ? void 0 : classNames.header,
|
|
3454
|
-
headerSubtitle,
|
|
3455
|
-
headerImage,
|
|
3456
|
-
headerTitle
|
|
3457
|
-
}),
|
|
3458
|
-
/* @__PURE__ */ jsxs5("div", { className: cn("agg-order-panel-content flex flex-col gap-6", classNames == null ? void 0 : classNames.content), children: [
|
|
3459
|
-
/* @__PURE__ */ jsxs5("div", { className: "agg-order-submission-status flex h-12 w-full items-center justify-center gap-3 rounded-agg-full bg-agg-primary-hover px-8 text-agg-base font-agg-bold leading-agg-6 text-agg-on-primary", children: [
|
|
3460
|
-
/* @__PURE__ */ jsx6(LoadingGlyph, { enableAnimations, className: "h-4 w-4 text-current" }),
|
|
3461
|
-
/* @__PURE__ */ jsx6("span", { children: actionLabel })
|
|
3462
|
-
] }),
|
|
3463
|
-
/* @__PURE__ */ jsx6(
|
|
3464
|
-
"div",
|
|
3465
|
-
{
|
|
3466
|
-
className: "agg-order-submission-steps agg-order-submission-group flex flex-col gap-2",
|
|
3467
|
-
"data-testid": "agg-order-submission-steps",
|
|
3468
|
-
children: displayRows.map((step) => {
|
|
3469
|
-
return /* @__PURE__ */ jsxs5(
|
|
3470
|
-
"div",
|
|
3471
|
-
{
|
|
3472
|
-
className: "agg-order-submission-step flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
3473
|
-
"data-status": step.status,
|
|
3474
|
-
children: [
|
|
3475
|
-
step.status === "complete" ? /* @__PURE__ */ jsx6(
|
|
3476
|
-
Icon,
|
|
3477
|
-
{
|
|
3478
|
-
name: "check-circle",
|
|
3479
|
-
size: "small",
|
|
3480
|
-
className: "h-3 w-3 shrink-0 text-agg-primary",
|
|
3481
|
-
"aria-hidden": "true"
|
|
3482
|
-
}
|
|
3483
|
-
) : /* @__PURE__ */ jsx6(
|
|
3484
|
-
LoadingGlyph,
|
|
3485
|
-
{
|
|
3486
|
-
enableAnimations,
|
|
3487
|
-
className: "h-3 w-3 shrink-0 text-agg-primary"
|
|
3488
|
-
}
|
|
3489
|
-
),
|
|
3490
|
-
/* @__PURE__ */ jsx6("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
3491
|
-
step.venue ? /* @__PURE__ */ jsx6(
|
|
3492
|
-
VenueLogo,
|
|
3493
|
-
{
|
|
3494
|
-
venue: step.venue,
|
|
3495
|
-
size: "small",
|
|
3496
|
-
ariaLabel: getTradingVenueLabel(step.venue),
|
|
3497
|
-
className: "h-4 w-4"
|
|
3498
|
-
}
|
|
3499
|
-
) : null
|
|
3500
|
-
]
|
|
3501
|
-
},
|
|
3502
|
-
step.id
|
|
3503
|
-
);
|
|
3504
|
-
})
|
|
3505
|
-
}
|
|
3506
|
-
)
|
|
3507
|
-
] })
|
|
3508
|
-
] })
|
|
3509
|
-
}
|
|
3510
|
-
);
|
|
3511
|
-
};
|
|
3512
3808
|
var PlaceOrder = ({
|
|
3513
3809
|
className,
|
|
3514
3810
|
classNames,
|
|
@@ -3532,7 +3828,7 @@ var PlaceOrder = ({
|
|
|
3532
3828
|
resolvedClaim,
|
|
3533
3829
|
midpointsResult
|
|
3534
3830
|
}) => {
|
|
3535
|
-
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, __, _
|
|
3831
|
+
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, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha;
|
|
3536
3832
|
const {
|
|
3537
3833
|
enableDebug: isExecutionDebugEnabled,
|
|
3538
3834
|
features: { enableAnimations, showFeesBreakdown, showLimitOrders },
|
|
@@ -3634,11 +3930,11 @@ var PlaceOrder = ({
|
|
|
3634
3930
|
const queryClient = useQueryClient();
|
|
3635
3931
|
const { disabledVenues, isLoading: isAppConfigLoading } = useAppConfig();
|
|
3636
3932
|
const { data: kalshiKeyStatus, refetch: refetchKalshiKeyStatus } = useVenueKeyStatus(
|
|
3637
|
-
|
|
3933
|
+
Venue3.kalshi,
|
|
3638
3934
|
isAuthenticated
|
|
3639
3935
|
);
|
|
3640
|
-
const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] =
|
|
3641
|
-
const [isFundKalshiModalOpen, setIsFundKalshiModalOpen] =
|
|
3936
|
+
const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = useState(false);
|
|
3937
|
+
const [isFundKalshiModalOpen, setIsFundKalshiModalOpen] = useState(false);
|
|
3642
3938
|
const livePrices = useLiveOutcomePrices(
|
|
3643
3939
|
scopedSelectedMarket ? [scopedSelectedMarket] : void 0
|
|
3644
3940
|
);
|
|
@@ -3654,29 +3950,32 @@ var PlaceOrder = ({
|
|
|
3654
3950
|
() => mergeBestPricesPreferringLive(clusterBestPricesRest, wsBestPrices),
|
|
3655
3951
|
[clusterBestPricesRest, wsBestPrices]
|
|
3656
3952
|
);
|
|
3657
|
-
const [internalTab, setInternalTab] =
|
|
3658
|
-
const [executionType, setExecutionType] =
|
|
3659
|
-
const [selectedLimitVenue, setSelectedLimitVenue] =
|
|
3660
|
-
const [limitPrice, setLimitPrice] =
|
|
3661
|
-
const [limitPriceInputValue, setLimitPriceInputValue] =
|
|
3662
|
-
const [limitPriceInputError, setLimitPriceInputError] =
|
|
3663
|
-
const [limitExpirationType, setLimitExpirationType] =
|
|
3664
|
-
const [limitExpirationDate, setLimitExpirationDate] =
|
|
3665
|
-
const [limitExpirationTime, setLimitExpirationTime] =
|
|
3666
|
-
const [limitExpirationDraftDate, setLimitExpirationDraftDate] =
|
|
3667
|
-
const [limitExpirationDraftTime, setLimitExpirationDraftTime] =
|
|
3668
|
-
const [limitExpirationPickerView, setLimitExpirationPickerView] =
|
|
3669
|
-
const [isLimitExpirationPickerOpen, setIsLimitExpirationPickerOpen] =
|
|
3670
|
-
const [internalAmount, setInternalAmount] =
|
|
3671
|
-
const [sellFilledForOutcomeId, setSellFilledForOutcomeId] =
|
|
3672
|
-
const [internalSlippage] =
|
|
3673
|
-
const [isRoutesExpanded, setIsRoutesExpanded] =
|
|
3674
|
-
const [selectedRouteCardId, setSelectedRouteCardId] =
|
|
3675
|
-
const [
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
const [
|
|
3679
|
-
const [
|
|
3953
|
+
const [internalTab, setInternalTab] = useState("buy");
|
|
3954
|
+
const [executionType, setExecutionType] = useState("market");
|
|
3955
|
+
const [selectedLimitVenue, setSelectedLimitVenue] = useState(null);
|
|
3956
|
+
const [limitPrice, setLimitPrice] = useState(0.5);
|
|
3957
|
+
const [limitPriceInputValue, setLimitPriceInputValue] = useState(formatLimitPriceInputValue(0.5));
|
|
3958
|
+
const [limitPriceInputError, setLimitPriceInputError] = useState(null);
|
|
3959
|
+
const [limitExpirationType, setLimitExpirationType] = useState("GTC");
|
|
3960
|
+
const [limitExpirationDate, setLimitExpirationDate] = useState(void 0);
|
|
3961
|
+
const [limitExpirationTime, setLimitExpirationTime] = useState("17:00");
|
|
3962
|
+
const [limitExpirationDraftDate, setLimitExpirationDraftDate] = useState();
|
|
3963
|
+
const [limitExpirationDraftTime, setLimitExpirationDraftTime] = useState("17:00");
|
|
3964
|
+
const [limitExpirationPickerView, setLimitExpirationPickerView] = useState("options");
|
|
3965
|
+
const [isLimitExpirationPickerOpen, setIsLimitExpirationPickerOpen] = useState(false);
|
|
3966
|
+
const [internalAmount, setInternalAmount] = useState(PLACE_ORDER_DEFAULT_AMOUNT);
|
|
3967
|
+
const [sellFilledForOutcomeId, setSellFilledForOutcomeId] = useState(null);
|
|
3968
|
+
const [internalSlippage] = useState(DEFAULT_SLIPPAGE_VALUE);
|
|
3969
|
+
const [isRoutesExpanded, setIsRoutesExpanded] = useState(false);
|
|
3970
|
+
const [selectedRouteCardId, setSelectedRouteCardId] = useState(null);
|
|
3971
|
+
const [manualRouteSelectionIdentity, setManualRouteSelectionIdentity] = useState(
|
|
3972
|
+
null
|
|
3973
|
+
);
|
|
3974
|
+
const [isSplitDetailOpen, setIsSplitDetailOpen] = useState(false);
|
|
3975
|
+
const [buyGeoBlockSnapshot, setBuyGeoBlockSnapshot] = useState(null);
|
|
3976
|
+
const [submissionFeedback, setSubmissionFeedback] = useState(null);
|
|
3977
|
+
const [submissionProgressState, setSubmissionProgressState] = useState(null);
|
|
3978
|
+
const [isBeforeActionPending, setIsBeforeActionPending] = useState(false);
|
|
3680
3979
|
const outcomes = useMemo(
|
|
3681
3980
|
() => mapVenueMarketOutcomesToPlaceOrderOutcomes(scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes),
|
|
3682
3981
|
[scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes]
|
|
@@ -3714,6 +4013,7 @@ var PlaceOrder = ({
|
|
|
3714
4013
|
const executionDebugStoreRef = useRef2(null);
|
|
3715
4014
|
const executionDebugAttemptIdRef = useRef2(null);
|
|
3716
4015
|
const submittedSelectionRef = useRef2(null);
|
|
4016
|
+
const lastValidRouteCardsRef = useRef2(null);
|
|
3717
4017
|
useEffect2(() => {
|
|
3718
4018
|
if (!isExecutionDebugEnabled) {
|
|
3719
4019
|
executionDebugStoreRef.current = null;
|
|
@@ -3861,10 +4161,14 @@ var PlaceOrder = ({
|
|
|
3861
4161
|
compareVenues: true,
|
|
3862
4162
|
tradeSide: isSell ? "sell" : "buy",
|
|
3863
4163
|
mode: isPaperMode ? "paper" : void 0,
|
|
4164
|
+
balanceCacheScope: {
|
|
4165
|
+
accountId: (_l = user == null ? void 0 : user.id) != null ? _l : null,
|
|
4166
|
+
balanceVersion: isPaperMode ? paperBalancesQuery.dataUpdatedAt : liveBalanceState.dataUpdatedAt
|
|
4167
|
+
},
|
|
3864
4168
|
enabled: isSmartRouteEnabled
|
|
3865
4169
|
}, isSell ? {
|
|
3866
4170
|
sellCacheScope: {
|
|
3867
|
-
accountId: (
|
|
4171
|
+
accountId: (_m = user == null ? void 0 : user.id) != null ? _m : null,
|
|
3868
4172
|
positionVersion: executionPositionsUpdatedAt
|
|
3869
4173
|
}
|
|
3870
4174
|
} : {}), {
|
|
@@ -3920,12 +4224,12 @@ var PlaceOrder = ({
|
|
|
3920
4224
|
);
|
|
3921
4225
|
const venueSellQuotes = useVenueSellQuotes({
|
|
3922
4226
|
venueMarketOutcomeId: scopedSelectedOutcomeId,
|
|
3923
|
-
accountId: (
|
|
4227
|
+
accountId: (_n = user == null ? void 0 : user.id) != null ? _n : null,
|
|
3924
4228
|
positionVersion: executionPositionsUpdatedAt,
|
|
3925
4229
|
requests: venueSellQuoteRequests,
|
|
3926
4230
|
mode: isPaperMode ? "paper" : void 0,
|
|
3927
4231
|
slipCapBps: 1e6,
|
|
3928
|
-
enabled: isSell && isSmartRouteEnabled && !smartRoute.isLoading && ((
|
|
4232
|
+
enabled: isSell && isSmartRouteEnabled && !smartRoute.isLoading && ((_o = smartRoute.data) == null ? void 0 : _o.venueMarketOutcomeId) === scopedSelectedOutcomeId,
|
|
3929
4233
|
refreshContext: smartRouteRefreshContext
|
|
3930
4234
|
});
|
|
3931
4235
|
const currentSellableShares = useMemo(() => {
|
|
@@ -3960,13 +4264,13 @@ var PlaceOrder = ({
|
|
|
3960
4264
|
isSell,
|
|
3961
4265
|
scopedSelectedMarket,
|
|
3962
4266
|
scopedSelectedOutcome,
|
|
3963
|
-
(
|
|
4267
|
+
(_q = (_p = smartRoute.data) == null ? void 0 : _p.positionAvailability) == null ? void 0 : _q.totalSellableShares
|
|
3964
4268
|
]);
|
|
3965
4269
|
const maxSellableShares = useMemo(
|
|
3966
4270
|
() => floorToDecimals(currentSellableShares, SELL_SHARE_INPUT_DECIMALS),
|
|
3967
4271
|
[currentSellableShares]
|
|
3968
4272
|
);
|
|
3969
|
-
const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((
|
|
4273
|
+
const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((_s = (_r = smartRoute.data) == null ? void 0 : _r.positionAvailability) == null ? void 0 : _s.totalSellableShares) === "number") && (isExecutionPositionsLoading || isExecutionPositionsFetching);
|
|
3970
4274
|
const displayedCurrentSellableShares = useMemo(() => {
|
|
3971
4275
|
if (!Number.isFinite(currentSellableShares) || currentSellableShares <= 0) return 0;
|
|
3972
4276
|
return floorToDecimals(currentSellableShares, SELL_SHARE_DISPLAY_DECIMALS);
|
|
@@ -3976,7 +4280,7 @@ var PlaceOrder = ({
|
|
|
3976
4280
|
[maxSellableShares]
|
|
3977
4281
|
);
|
|
3978
4282
|
const isAtMaxSellableShares = isSell && maxSellableShares > 0 && Math.abs(internalAmount - maxSellableShares) < 1e-9;
|
|
3979
|
-
const isSellAmountAboveAvailability = isSell && ((
|
|
4283
|
+
const isSellAmountAboveAvailability = isSell && ((_t = smartRoute.data) == null ? void 0 : _t.venueMarketOutcomeId) === scopedSelectedOutcomeId && typeof ((_u = smartRoute.data.positionAvailability) == null ? void 0 : _u.totalSellableShares) === "number" && internalAmount > maxSellableShares;
|
|
3980
4284
|
useEffect2(() => {
|
|
3981
4285
|
if (submissionProgressState != null) return;
|
|
3982
4286
|
if (!isSell || isCurrentSellableSharesLoading) return;
|
|
@@ -4012,10 +4316,11 @@ var PlaceOrder = ({
|
|
|
4012
4316
|
isSell,
|
|
4013
4317
|
onAmountChange,
|
|
4014
4318
|
scopedSelectedOutcomeId,
|
|
4015
|
-
(
|
|
4016
|
-
(
|
|
4319
|
+
(_w = (_v = smartRoute.data) == null ? void 0 : _v.positionAvailability) == null ? void 0 : _w.totalSellableShares,
|
|
4320
|
+
(_x = smartRoute.data) == null ? void 0 : _x.venueMarketOutcomeId,
|
|
4017
4321
|
submissionProgressState
|
|
4018
4322
|
]);
|
|
4323
|
+
const scopedSmartRouteData = ((_y = smartRoute.data) == null ? void 0 : _y.venueMarketOutcomeId) === scopedSelectedOutcomeId ? smartRoute.data : null;
|
|
4019
4324
|
const routeCards = useMemo(() => {
|
|
4020
4325
|
const eventVenues = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets.map((market) => market.venue);
|
|
4021
4326
|
if (isSell) {
|
|
@@ -4024,42 +4329,66 @@ var PlaceOrder = ({
|
|
|
4024
4329
|
geoBlockedVenues: inheritedBuyGeoBlockedVenues,
|
|
4025
4330
|
labels: tradingLabels,
|
|
4026
4331
|
requestedSellShares: debouncedAmount,
|
|
4027
|
-
smartQuoteData:
|
|
4332
|
+
smartQuoteData: scopedSmartRouteData,
|
|
4028
4333
|
venueQuotes: venueSellQuotes.quotes.map((venueQuote) => ({
|
|
4029
4334
|
request: venueQuote.request,
|
|
4030
4335
|
quoteData: venueQuote.data
|
|
4031
4336
|
}))
|
|
4032
4337
|
});
|
|
4033
4338
|
}
|
|
4034
|
-
return
|
|
4339
|
+
return scopedSmartRouteData ? buildLiveRouteCards({
|
|
4035
4340
|
eventVenues,
|
|
4036
4341
|
labels: tradingLabels,
|
|
4037
|
-
quoteData:
|
|
4342
|
+
quoteData: scopedSmartRouteData,
|
|
4038
4343
|
tradeSide: "buy"
|
|
4039
4344
|
}) : [];
|
|
4040
4345
|
}, [
|
|
4041
4346
|
debouncedAmount,
|
|
4042
|
-
|
|
4347
|
+
scopedSmartRouteData,
|
|
4043
4348
|
tradingLabels,
|
|
4044
4349
|
inheritedBuyGeoBlockedVenues,
|
|
4045
4350
|
isSell,
|
|
4046
4351
|
scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets,
|
|
4047
4352
|
venueSellQuotes.quotes
|
|
4048
4353
|
]);
|
|
4049
|
-
const
|
|
4354
|
+
const routeCardsScopeKey = [
|
|
4355
|
+
resolvedExecutionMode,
|
|
4356
|
+
(_z = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id) != null ? _z : "",
|
|
4357
|
+
scopedSelectedOutcomeId != null ? scopedSelectedOutcomeId : "",
|
|
4358
|
+
internalTab
|
|
4359
|
+
].join(":");
|
|
4360
|
+
const isRouteCardsTransient = isQuoteInputEditing || smartRoute.isLoading || smartRoute.isFetching || !scopedSmartRouteData && isSmartRouteEnabled && !smartRoute.error || isSell && (venueSellQuotes.isLoading || venueSellQuotes.isFetching);
|
|
4361
|
+
if (routeCards.length > 0) {
|
|
4362
|
+
lastValidRouteCardsRef.current = { cards: routeCards, scopeKey: routeCardsScopeKey };
|
|
4363
|
+
}
|
|
4364
|
+
const displayedRouteCards = routeCards.length > 0 ? routeCards : isRouteCardsTransient && ((_A = lastValidRouteCardsRef.current) == null ? void 0 : _A.scopeKey) === routeCardsScopeKey ? lastValidRouteCardsRef.current.cards : [];
|
|
4365
|
+
const selectedManualRouteCard = manualRouteSelectionIdentity ? routeCards.find(
|
|
4366
|
+
(card) => getPlaceOrderRouteCardIdentity(card) === manualRouteSelectionIdentity
|
|
4367
|
+
) : void 0;
|
|
4050
4368
|
const resolvedSelectedRouteCardId = useMemo(() => {
|
|
4051
4369
|
var _a2;
|
|
4052
|
-
if (
|
|
4370
|
+
if (selectedManualRouteCard && !selectedManualRouteCard.isUnavailable) {
|
|
4371
|
+
return selectedManualRouteCard.id;
|
|
4372
|
+
}
|
|
4373
|
+
if (manualRouteSelectionIdentity && selectedRouteCardId && isRouteCardsTransient) {
|
|
4053
4374
|
return selectedRouteCardId;
|
|
4054
4375
|
}
|
|
4055
|
-
if (selectedRouteCardId && isSellQuoteTransitioning) return selectedRouteCardId;
|
|
4056
4376
|
if (routeCards.length === 0) return null;
|
|
4057
4377
|
return resolveDefaultRouteCardId(routeCards, isSell ? void 0 : (_a2 = smartRoute.data) == null ? void 0 : _a2.status);
|
|
4058
|
-
}, [
|
|
4378
|
+
}, [
|
|
4379
|
+
isSell,
|
|
4380
|
+
isRouteCardsTransient,
|
|
4381
|
+
manualRouteSelectionIdentity,
|
|
4382
|
+
routeCards,
|
|
4383
|
+
selectedManualRouteCard,
|
|
4384
|
+
selectedRouteCardId,
|
|
4385
|
+
(_B = smartRoute.data) == null ? void 0 : _B.status
|
|
4386
|
+
]);
|
|
4059
4387
|
useEffect2(() => {
|
|
4060
4388
|
if (routeCards.length === 0) {
|
|
4061
|
-
if (
|
|
4389
|
+
if (isRouteCardsTransient) return;
|
|
4062
4390
|
setSelectedRouteCardId(null);
|
|
4391
|
+
setManualRouteSelectionIdentity(null);
|
|
4063
4392
|
setIsRoutesExpanded(false);
|
|
4064
4393
|
setIsSplitDetailOpen(false);
|
|
4065
4394
|
return;
|
|
@@ -4067,10 +4396,15 @@ var PlaceOrder = ({
|
|
|
4067
4396
|
if (resolvedSelectedRouteCardId !== selectedRouteCardId) {
|
|
4068
4397
|
setSelectedRouteCardId(resolvedSelectedRouteCardId);
|
|
4069
4398
|
}
|
|
4399
|
+
if (manualRouteSelectionIdentity && !selectedManualRouteCard && !isRouteCardsTransient) {
|
|
4400
|
+
setManualRouteSelectionIdentity(null);
|
|
4401
|
+
}
|
|
4070
4402
|
}, [
|
|
4071
|
-
|
|
4403
|
+
isRouteCardsTransient,
|
|
4404
|
+
manualRouteSelectionIdentity,
|
|
4072
4405
|
resolvedSelectedRouteCardId,
|
|
4073
4406
|
routeCards.length,
|
|
4407
|
+
selectedManualRouteCard,
|
|
4074
4408
|
selectedRouteCardId
|
|
4075
4409
|
]);
|
|
4076
4410
|
const isSubmissionLocked = submissionProgressState != null;
|
|
@@ -4104,19 +4438,20 @@ var PlaceOrder = ({
|
|
|
4104
4438
|
}, [scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id, scopedSelectedOutcomeId]);
|
|
4105
4439
|
useEffect2(() => {
|
|
4106
4440
|
setSelectedRouteCardId(null);
|
|
4441
|
+
setManualRouteSelectionIdentity(null);
|
|
4107
4442
|
setIsRoutesExpanded(false);
|
|
4108
4443
|
setIsSplitDetailOpen(false);
|
|
4109
4444
|
}, [executionType, internalTab, scopedSelectedOutcomeId]);
|
|
4110
4445
|
const orderedRouteCards = routeCards;
|
|
4111
|
-
const selectedRouteCard = (
|
|
4446
|
+
const selectedRouteCard = (_D = (_C = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _C : orderedRouteCards[0]) != null ? _D : null;
|
|
4112
4447
|
const isKalshiRoute = useMemo(() => {
|
|
4113
|
-
if (isLimitOrder) return (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) ===
|
|
4448
|
+
if (isLimitOrder) return (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) === Venue3.kalshi;
|
|
4114
4449
|
if (selectedRouteCard) {
|
|
4115
4450
|
return selectedRouteCard.venue === "kalshi" || selectedRouteCard.quoteData.fills.some((f) => f.venue === "kalshi");
|
|
4116
4451
|
}
|
|
4117
4452
|
return (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === "kalshi";
|
|
4118
4453
|
}, [isLimitOrder, selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue, selectedRouteCard, scopedSelectedMarket]);
|
|
4119
|
-
const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (
|
|
4454
|
+
const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (_E = liveBalanceState.kalshiBalance) != null ? _E : 0 : liveAvailableBalance;
|
|
4120
4455
|
const legacyKalshiAccount = useMemo(
|
|
4121
4456
|
() => {
|
|
4122
4457
|
var _a2;
|
|
@@ -4124,8 +4459,8 @@ var PlaceOrder = ({
|
|
|
4124
4459
|
},
|
|
4125
4460
|
[user == null ? void 0 : user.venueAccounts]
|
|
4126
4461
|
);
|
|
4127
|
-
const isKalshiAccountActive = (
|
|
4128
|
-
const isKalshiVerified = ((
|
|
4462
|
+
const isKalshiAccountActive = (_F = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.connected) != null ? _F : (legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.status) === "active";
|
|
4463
|
+
const isKalshiVerified = ((_G = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.kycStatus) != null ? _G : legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.kycStatus) === "verified";
|
|
4129
4464
|
const hasKalshiConnectionState = kalshiKeyStatus !== void 0 || (user == null ? void 0 : user.venueAccounts) != null;
|
|
4130
4465
|
const isKalshiAvailable = getVenueAvailabilityState({
|
|
4131
4466
|
venueId: "kalshi",
|
|
@@ -4139,7 +4474,7 @@ var PlaceOrder = ({
|
|
|
4139
4474
|
yield onConnectKalshi(credentials);
|
|
4140
4475
|
} else {
|
|
4141
4476
|
yield aggClient.upsertVenueKey({
|
|
4142
|
-
venue:
|
|
4477
|
+
venue: Venue3.kalshi,
|
|
4143
4478
|
credentials: {
|
|
4144
4479
|
keyId: credentials.apiKeyId,
|
|
4145
4480
|
privateKey: credentials.privateKey
|
|
@@ -4152,7 +4487,7 @@ var PlaceOrder = ({
|
|
|
4152
4487
|
[aggClient, onConnectKalshi, refetchKalshiKeyStatus]
|
|
4153
4488
|
);
|
|
4154
4489
|
const needsKycVerification = isAuthenticated && hasKalshiConnectionState && isKalshiRoute && isKalshiAccountActive && !isKalshiVerified;
|
|
4155
|
-
const verifyKalshiConnectionLabel = (
|
|
4490
|
+
const verifyKalshiConnectionLabel = (_K = (_J = (_I = (_H = labels.onboarding) == null ? void 0 : _H.connectKalshiModal) == null ? void 0 : _I.actions) == null ? void 0 : _J.verifyConnection) != null ? _K : tradingLabels.kycRequired;
|
|
4156
4491
|
const handleRouteCardSelect = useCallback2(
|
|
4157
4492
|
(cardId) => {
|
|
4158
4493
|
const card = routeCards.find((routeCard) => routeCard.id === cardId);
|
|
@@ -4164,6 +4499,7 @@ var PlaceOrder = ({
|
|
|
4164
4499
|
}
|
|
4165
4500
|
}
|
|
4166
4501
|
setSelectedRouteCardId(cardId);
|
|
4502
|
+
setManualRouteSelectionIdentity(getPlaceOrderRouteCardIdentity(card));
|
|
4167
4503
|
setIsSplitDetailOpen(false);
|
|
4168
4504
|
if (!isSell || card.kind !== "venue" || !card.insufficientInventory || card.availableShares == null) {
|
|
4169
4505
|
return;
|
|
@@ -4184,18 +4520,44 @@ var PlaceOrder = ({
|
|
|
4184
4520
|
]
|
|
4185
4521
|
);
|
|
4186
4522
|
const executionProgress = useExecutionProgress({
|
|
4187
|
-
orderIds: (
|
|
4188
|
-
quoteId: (
|
|
4523
|
+
orderIds: (_L = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) != null ? _L : null,
|
|
4524
|
+
quoteId: (_M = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _M : null,
|
|
4189
4525
|
mode: isPaperMode ? "paper" : void 0,
|
|
4190
|
-
enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((
|
|
4526
|
+
enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((_N = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _N.length)
|
|
4191
4527
|
});
|
|
4192
|
-
const selectedOutcomeLabel = (
|
|
4193
|
-
const headerImage = (
|
|
4194
|
-
const headerTitle = (
|
|
4195
|
-
const headerSubtitle = (
|
|
4528
|
+
const selectedOutcomeLabel = (_Q = (_P = (_O = outcomes.find((outcome) => outcome.id === scopedSelectedOutcomeId)) == null ? void 0 : _O.label) != null ? _P : scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.label) != null ? _Q : "";
|
|
4529
|
+
const headerImage = (_S = (_R = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.image) != null ? _R : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.image) != null ? _S : null;
|
|
4530
|
+
const headerTitle = (_U = (_T = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _T : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _U : "";
|
|
4531
|
+
const headerSubtitle = (_V = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _V : "";
|
|
4532
|
+
const executionDateSource = (_W = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate) != null ? _W : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.endDate;
|
|
4533
|
+
const executionDateLabel = executionDateSource ? getTradingDateLabel(executionDateSource) : "";
|
|
4534
|
+
const executionQuoteData = (_Y = (_X = submissionProgressState == null ? void 0 : submissionProgressState.quoteData) != null ? _X : selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _Y : null;
|
|
4535
|
+
const executionOrderGroups = useMemo(() => {
|
|
4536
|
+
var _a2, _b2, _c2;
|
|
4537
|
+
if (!executionQuoteData) return [];
|
|
4538
|
+
return deriveExecutionOrderGroups({
|
|
4539
|
+
quoteData: executionQuoteData,
|
|
4540
|
+
labels: tradingLabels,
|
|
4541
|
+
tradeSide: internalTab,
|
|
4542
|
+
hasSubmissionResponse: !!((_a2 = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _a2.length),
|
|
4543
|
+
executionSteps: executionProgress.executionSteps,
|
|
4544
|
+
executionOrders: (_b2 = executionProgress.executionOrders) != null ? _b2 : [],
|
|
4545
|
+
rawExecutionSteps: (_c2 = executionProgress.rawExecutionSteps) != null ? _c2 : [],
|
|
4546
|
+
terminalOrderEvents: executionProgress.terminalOrderEvents
|
|
4547
|
+
});
|
|
4548
|
+
}, [
|
|
4549
|
+
executionProgress.executionSteps,
|
|
4550
|
+
executionProgress.executionOrders,
|
|
4551
|
+
executionProgress.rawExecutionSteps,
|
|
4552
|
+
executionProgress.terminalOrderEvents,
|
|
4553
|
+
executionQuoteData,
|
|
4554
|
+
internalTab,
|
|
4555
|
+
(_Z = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _Z.length,
|
|
4556
|
+
tradingLabels
|
|
4557
|
+
]);
|
|
4196
4558
|
const buildExecutionSummary = useCallback2(
|
|
4197
4559
|
(quoteData, executionVenue, orderId, partialFillSummary) => {
|
|
4198
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
4560
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2;
|
|
4199
4561
|
if (!quoteData) return void 0;
|
|
4200
4562
|
const actualEconomics = resolveActualExecutionEconomics({
|
|
4201
4563
|
quoteData,
|
|
@@ -4207,7 +4569,7 @@ var PlaceOrder = ({
|
|
|
4207
4569
|
const sharesSide = actualEconomics.hasActualFillData ? actualEconomics.actualTotalFilled : quoteData.totalFilled;
|
|
4208
4570
|
const avgPriceValue = actualEconomics.hasActualFillData ? actualEconomics.avgExecutionPrice : quoteData.totalFilled > 0 ? quoteData.rawExecCost / quoteData.totalFilled : 0;
|
|
4209
4571
|
const avgPriceLabel = avgPriceValue > 0 ? getTradingRoutePriceLabel(avgPriceValue) : "\u2014";
|
|
4210
|
-
const actionPriceLabel = avgPriceValue > 0 ?
|
|
4572
|
+
const actionPriceLabel = avgPriceValue > 0 ? `avg. ${avgPriceLabel}` : avgPriceLabel;
|
|
4211
4573
|
const actionLabel2 = internalTab === "buy" ? (_b2 = (_a2 = tradingLabels.boughtOutcomeAtPrice) == null ? void 0 : _a2.call(tradingLabels, selectedOutcomeLabel, actionPriceLabel)) != null ? _b2 : `Bought ${selectedOutcomeLabel} at ${actionPriceLabel}` : (_d2 = (_c2 = tradingLabels.soldOutcomeAtPrice) == null ? void 0 : _c2.call(tradingLabels, selectedOutcomeLabel, actionPriceLabel)) != null ? _d2 : `Sold ${selectedOutcomeLabel} at ${actionPriceLabel}`;
|
|
4212
4574
|
const sharesLabel = sharesSide.toLocaleString("en-US", {
|
|
4213
4575
|
minimumFractionDigits: 2,
|
|
@@ -4216,7 +4578,7 @@ var PlaceOrder = ({
|
|
|
4216
4578
|
const payoutLabel = formatUsd(usdSide);
|
|
4217
4579
|
const amountLabel = internalTab === "sell" ? sharesLabel : payoutLabel;
|
|
4218
4580
|
const toWinLabel = internalTab === "sell" ? payoutLabel : formatUsd(sharesSide);
|
|
4219
|
-
const potentialReturnValue =
|
|
4581
|
+
const potentialReturnValue = getPlaceOrderPotentialReturn(quoteData);
|
|
4220
4582
|
const potentialReturnLabel = potentialReturnValue > 0 ? formatUsd(potentialReturnValue) : void 0;
|
|
4221
4583
|
const eventTitle = (_f2 = (_e2 = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _e2 : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _f2 : "";
|
|
4222
4584
|
const eventDateSource = (_g2 = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate) != null ? _g2 : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.endDate;
|
|
@@ -4233,6 +4595,20 @@ var PlaceOrder = ({
|
|
|
4233
4595
|
amountLabel,
|
|
4234
4596
|
toWinLabel,
|
|
4235
4597
|
potentialReturnLabel,
|
|
4598
|
+
requestedAmountLabel: internalTab === "buy" ? formatUsd(internalAmount) : tradingLabels.executionShares(
|
|
4599
|
+
internalAmount.toLocaleString("en-US", { maximumFractionDigits: 2 })
|
|
4600
|
+
),
|
|
4601
|
+
executionGroups: deriveExecutionOrderGroups({
|
|
4602
|
+
quoteData,
|
|
4603
|
+
labels: tradingLabels,
|
|
4604
|
+
tradeSide: internalTab,
|
|
4605
|
+
hasSubmissionResponse: true,
|
|
4606
|
+
executionSteps: executionProgress.executionSteps,
|
|
4607
|
+
executionOrders: (_h2 = executionProgress.executionOrders) != null ? _h2 : [],
|
|
4608
|
+
rawExecutionSteps: (_i2 = executionProgress.rawExecutionSteps) != null ? _i2 : [],
|
|
4609
|
+
terminalOrderEvents: executionProgress.terminalOrderEvents,
|
|
4610
|
+
forceCompleted: true
|
|
4611
|
+
}),
|
|
4236
4612
|
executionStepGroups: (partialFillSummary == null ? void 0 : partialFillSummary.kind) === "partial_fill" ? buildPlaceOrderExecutionStepGroupsFromFailureSummary({
|
|
4237
4613
|
labels: tradingLabels,
|
|
4238
4614
|
summary: partialFillSummary,
|
|
@@ -4241,7 +4617,7 @@ var PlaceOrder = ({
|
|
|
4241
4617
|
treatPartialAsComplete: true
|
|
4242
4618
|
}) : buildPlaceOrderExecutionStepGroups({
|
|
4243
4619
|
labels: tradingLabels,
|
|
4244
|
-
orderId: orderId != null ? orderId : (
|
|
4620
|
+
orderId: orderId != null ? orderId : (_j2 = executionProgress.submittedOrders[0]) == null ? void 0 : _j2.orderId,
|
|
4245
4621
|
quoteData,
|
|
4246
4622
|
submittedOrders: executionProgress.submittedOrders
|
|
4247
4623
|
}),
|
|
@@ -4258,9 +4634,13 @@ var PlaceOrder = ({
|
|
|
4258
4634
|
},
|
|
4259
4635
|
[
|
|
4260
4636
|
executionProgress.submittedOrders,
|
|
4637
|
+
executionProgress.executionSteps,
|
|
4638
|
+
executionProgress.executionOrders,
|
|
4639
|
+
executionProgress.rawExecutionSteps,
|
|
4261
4640
|
executionProgress.terminalOrderEvents,
|
|
4262
4641
|
headerImage,
|
|
4263
4642
|
internalTab,
|
|
4643
|
+
internalAmount,
|
|
4264
4644
|
scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate,
|
|
4265
4645
|
scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title,
|
|
4266
4646
|
scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.endDate,
|
|
@@ -4294,11 +4674,15 @@ var PlaceOrder = ({
|
|
|
4294
4674
|
label: "dag_progress",
|
|
4295
4675
|
data: dp
|
|
4296
4676
|
});
|
|
4297
|
-
const normalizedRows =
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4677
|
+
const normalizedRows = executionOrderGroups.flatMap(
|
|
4678
|
+
(group) => group.steps.map((step) => ({
|
|
4679
|
+
id: step.id,
|
|
4680
|
+
kind: step.kind,
|
|
4681
|
+
label: step.status === "done" ? step.completedLabel : step.pendingLabel,
|
|
4682
|
+
status: step.status,
|
|
4683
|
+
venue: group.venue
|
|
4684
|
+
}))
|
|
4685
|
+
);
|
|
4302
4686
|
debugStore.setNormalizedSteps(debugAttemptId, normalizedRows);
|
|
4303
4687
|
debugStore.appendEvent(debugAttemptId, {
|
|
4304
4688
|
kind: "normalized_steps",
|
|
@@ -4332,7 +4716,7 @@ var PlaceOrder = ({
|
|
|
4332
4716
|
}
|
|
4333
4717
|
return __spreadProps(__spreadValues({}, prev), { dagProgress: dp });
|
|
4334
4718
|
});
|
|
4335
|
-
}, [executionProgress.dagProgress, tradingLabels]);
|
|
4719
|
+
}, [executionOrderGroups, executionProgress.dagProgress, tradingLabels]);
|
|
4336
4720
|
useEffect2(() => {
|
|
4337
4721
|
const orderIds = submissionProgressState == null ? void 0 : submissionProgressState.orderIds;
|
|
4338
4722
|
if (!(orderIds == null ? void 0 : orderIds.length)) return;
|
|
@@ -4353,7 +4737,7 @@ var PlaceOrder = ({
|
|
|
4353
4737
|
}
|
|
4354
4738
|
if (aggregateStatus === "pending") return;
|
|
4355
4739
|
setSubmissionProgressState((prev) => {
|
|
4356
|
-
var _a2, _b2, _c2;
|
|
4740
|
+
var _a2, _b2, _c2, _d2;
|
|
4357
4741
|
if (!prev || prev.phase === "success" || prev.phase === "failed") return prev;
|
|
4358
4742
|
if (aggregateStatus === "full_success") {
|
|
4359
4743
|
const primaryFilledEvent = executionProgress.terminalOrderEvents.find(
|
|
@@ -4363,9 +4747,9 @@ var PlaceOrder = ({
|
|
|
4363
4747
|
phase: "success",
|
|
4364
4748
|
orderId: (_a2 = primaryFilledEvent == null ? void 0 : primaryFilledEvent.orderId) != null ? _a2 : prev.orderId,
|
|
4365
4749
|
summary: buildExecutionSummary(
|
|
4366
|
-
selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData,
|
|
4750
|
+
(_b2 = prev.quoteData) != null ? _b2 : selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData,
|
|
4367
4751
|
prev.executionVenue,
|
|
4368
|
-
(
|
|
4752
|
+
(_c2 = primaryFilledEvent == null ? void 0 : primaryFilledEvent.orderId) != null ? _c2 : prev.orderId
|
|
4369
4753
|
)
|
|
4370
4754
|
});
|
|
4371
4755
|
}
|
|
@@ -4380,7 +4764,7 @@ var PlaceOrder = ({
|
|
|
4380
4764
|
});
|
|
4381
4765
|
return __spreadProps(__spreadValues({}, prev), {
|
|
4382
4766
|
phase: "failed",
|
|
4383
|
-
orderId: (
|
|
4767
|
+
orderId: (_d2 = firstFailedEvent == null ? void 0 : firstFailedEvent.orderId) != null ? _d2 : prev.orderId,
|
|
4384
4768
|
errorMessage
|
|
4385
4769
|
});
|
|
4386
4770
|
}
|
|
@@ -4393,7 +4777,7 @@ var PlaceOrder = ({
|
|
|
4393
4777
|
submissionProgressState == null ? void 0 : submissionProgressState.orderIds,
|
|
4394
4778
|
tradingLabels
|
|
4395
4779
|
]);
|
|
4396
|
-
const estDurationMs =
|
|
4780
|
+
const estDurationMs = executionQuoteData && typeof executionQuoteData.estDurationMs === "number" ? executionQuoteData.estDurationMs : 6e4;
|
|
4397
4781
|
useEffect2(() => {
|
|
4398
4782
|
const phase = submissionProgressState == null ? void 0 : submissionProgressState.phase;
|
|
4399
4783
|
if (phase !== "submitting" && phase !== "executing") return;
|
|
@@ -4490,23 +4874,24 @@ var PlaceOrder = ({
|
|
|
4490
4874
|
queryClient,
|
|
4491
4875
|
submissionProgressState
|
|
4492
4876
|
]);
|
|
4493
|
-
const activeQuoteData = isLimitOrder ? null : (
|
|
4494
|
-
const visibleMarketRouteCards =
|
|
4877
|
+
const activeQuoteData = isLimitOrder ? null : (__ = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? __ : scopedSmartRouteData;
|
|
4878
|
+
const visibleMarketRouteCards = displayedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT && !isRoutesExpanded ? displayedRouteCards.slice(0, PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT) : displayedRouteCards;
|
|
4495
4879
|
const hasEnteredAmount = internalAmount > 0;
|
|
4496
4880
|
const isQuoteLoading = !isLimitOrder && hasEnteredAmount && (isSell && isQuoteInputEditing || smartRoute.isLoading || !isSell && smartRoute.isFetching || isSell && venueSellQuotes.isLoading);
|
|
4497
4881
|
const routeLoadingMessage = isQuoteLoading ? smartRoute.loadingReason === "updating-route" ? tradingLabels.updatingRoute : smartRoute.loadingReason === "refreshing-quotes" ? tradingLabels.refreshingQuotes : tradingLabels.findingBestOdds : null;
|
|
4498
|
-
const selectedRouteFills = (
|
|
4499
|
-
const isKalshiOnlyRoute = isKalshiRoute && ((selectedRouteCard == null ? void 0 : selectedRouteCard.venue) ===
|
|
4500
|
-
const isOnchainOnlyRoute = !isKalshiRoute || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue !==
|
|
4501
|
-
const kalshiRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue ===
|
|
4502
|
-
const onchainRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue !==
|
|
4882
|
+
const selectedRouteFills = (_$ = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills) != null ? _$ : [];
|
|
4883
|
+
const isKalshiOnlyRoute = isKalshiRoute && ((selectedRouteCard == null ? void 0 : selectedRouteCard.venue) === Venue3.kalshi || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue === Venue3.kalshi));
|
|
4884
|
+
const isOnchainOnlyRoute = !isKalshiRoute || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue !== Venue3.kalshi);
|
|
4885
|
+
const kalshiRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue === Venue3.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
|
|
4886
|
+
const onchainRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue !== Venue3.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
|
|
4503
4887
|
const resolvedKalshiRequiredAmount = isKalshiOnlyRoute || isKalshiRoute && selectedRouteFills.length === 0 ? internalAmount : kalshiRequiredAmount;
|
|
4504
4888
|
const resolvedOnchainRequiredAmount = isOnchainOnlyRoute || !isKalshiRoute && selectedRouteFills.length === 0 ? internalAmount : onchainRequiredAmount;
|
|
4505
|
-
const isKalshiBalanceInsufficient = !isPaperMode && isKalshiRoute && resolvedKalshiRequiredAmount > ((
|
|
4889
|
+
const isKalshiBalanceInsufficient = !isPaperMode && isKalshiRoute && resolvedKalshiRequiredAmount > ((_aa = liveBalanceState.kalshiBalance) != null ? _aa : 0);
|
|
4506
4890
|
const isOnchainBalanceInsufficient = resolvedOnchainRequiredAmount > liveAvailableBalance;
|
|
4507
4891
|
const isInsufficientBalance = !isSell && isAuthenticated && hasEnteredAmount && !isBalanceLoading && (isLimitOrder ? internalAmount > totalBalance : isPaperMode ? internalAmount > paperTotalBalance : isKalshiBalanceInsufficient || isOnchainBalanceInsufficient);
|
|
4508
4892
|
const isQuoteInsufficientBalance = !isLimitOrder && (activeQuoteData == null ? void 0 : activeQuoteData.status) === "insufficient_balance";
|
|
4509
4893
|
const shouldShowInsufficientBalanceAlert = isInsufficientBalance || isQuoteInsufficientBalance;
|
|
4894
|
+
const insufficientBalanceDetails = isQuoteInsufficientBalance && (activeQuoteData == null ? void 0 : activeQuoteData.error) && activeQuoteData.error !== tradingLabels.insufficientBalance ? activeQuoteData.error : null;
|
|
4510
4895
|
const isSelectedVenueInventoryInsufficient = isSell && (selectedRouteCard == null ? void 0 : selectedRouteCard.kind) === "venue" && selectedRouteCard.insufficientInventory === true;
|
|
4511
4896
|
const isBelowClientMinimum = !isSell && hasEnteredAmount && internalAmount < MIN_BUY_ORDER_AMOUNT;
|
|
4512
4897
|
const isBelowVenueMinimumFromQuote = isQuoteBelowVenueMinimum(activeQuoteData);
|
|
@@ -4589,22 +4974,70 @@ var PlaceOrder = ({
|
|
|
4589
4974
|
tradingLabels
|
|
4590
4975
|
]);
|
|
4591
4976
|
const displayedToWinHint = useMemo(() => {
|
|
4592
|
-
var _a2;
|
|
4593
4977
|
if (!selectedRouteCard) return "";
|
|
4594
|
-
const averagePrice = selectedRouteCard.
|
|
4978
|
+
const averagePrice = selectedRouteCard.executionPrice;
|
|
4595
4979
|
return averagePrice == null ? "" : tradingLabels.averagePrice(averagePrice);
|
|
4596
4980
|
}, [selectedRouteCard, tradingLabels]);
|
|
4597
|
-
const displayedToWinValue = (
|
|
4981
|
+
const displayedToWinValue = (_ba = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _ba : 0;
|
|
4982
|
+
const originalLimitPriceRaw = useMemo(() => toLimitPriceRaw(limitPrice), [limitPrice]);
|
|
4983
|
+
const limitPriceAdjustmentByVenue = useMemo(() => {
|
|
4984
|
+
var _a2;
|
|
4985
|
+
const adjustments = /* @__PURE__ */ new Map();
|
|
4986
|
+
for (const option of visibleLimitVenueOptions) {
|
|
4987
|
+
try {
|
|
4988
|
+
adjustments.set(
|
|
4989
|
+
option.venue,
|
|
4990
|
+
adjustLimitPriceRawToTick({
|
|
4991
|
+
limitPriceRaw: originalLimitPriceRaw,
|
|
4992
|
+
side: internalTab,
|
|
4993
|
+
tickSize: (_a2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _a2.tickSize
|
|
4994
|
+
})
|
|
4995
|
+
);
|
|
4996
|
+
} catch (e) {
|
|
4997
|
+
adjustments.set(
|
|
4998
|
+
option.venue,
|
|
4999
|
+
adjustLimitPriceRawToTick({
|
|
5000
|
+
limitPriceRaw: originalLimitPriceRaw,
|
|
5001
|
+
side: internalTab,
|
|
5002
|
+
tickSize: null
|
|
5003
|
+
})
|
|
5004
|
+
);
|
|
5005
|
+
}
|
|
5006
|
+
}
|
|
5007
|
+
return adjustments;
|
|
5008
|
+
}, [internalTab, limitVenueQuoteByVenue, originalLimitPriceRaw, visibleLimitVenueOptions]);
|
|
5009
|
+
const selectedLimitPriceAdjustment = selectedLimitVenueOption ? limitPriceAdjustmentByVenue.get(selectedLimitVenueOption.venue) : void 0;
|
|
5010
|
+
const selectedLimitPriceRaw = (_ca = selectedLimitPriceAdjustment == null ? void 0 : selectedLimitPriceAdjustment.adjustedPriceRaw) != null ? _ca : originalLimitPriceRaw;
|
|
5011
|
+
const limitPriceAdjustmentMessage = useMemo(() => {
|
|
5012
|
+
if (!selectedLimitVenueOption || !(selectedLimitPriceAdjustment == null ? void 0 : selectedLimitPriceAdjustment.adjusted) || !selectedLimitPriceAdjustment.tickSizeRaw) {
|
|
5013
|
+
return "";
|
|
5014
|
+
}
|
|
5015
|
+
return tradingLabels.limitPriceAdjusted(
|
|
5016
|
+
[getTradingVenueLabel(selectedLimitVenueOption.venue)],
|
|
5017
|
+
Number(BigInt(selectedLimitPriceAdjustment.tickSizeRaw)) / Number(LIMIT_ORDER_RAW_SCALE) * 100,
|
|
5018
|
+
formatLimitPriceRawLabel(originalLimitPriceRaw),
|
|
5019
|
+
internalTab,
|
|
5020
|
+
formatLimitPriceRawLabel(selectedLimitPriceAdjustment.adjustedPriceRaw)
|
|
5021
|
+
);
|
|
5022
|
+
}, [
|
|
5023
|
+
internalTab,
|
|
5024
|
+
originalLimitPriceRaw,
|
|
5025
|
+
selectedLimitPriceAdjustment,
|
|
5026
|
+
selectedLimitVenueOption,
|
|
5027
|
+
tradingLabels
|
|
5028
|
+
]);
|
|
4598
5029
|
const limitOrderPayload = useMemo(() => {
|
|
4599
5030
|
if (!selectedLimitVenueOption || internalAmount <= 0) return null;
|
|
4600
5031
|
if (limitPriceInputError) return null;
|
|
5032
|
+
const effectivePriceRaw = BigInt(selectedLimitPriceRaw);
|
|
5033
|
+
if (effectivePriceRaw <= BigInt(0) || effectivePriceRaw >= LIMIT_ORDER_RAW_SCALE) return null;
|
|
4601
5034
|
const expirationDate = resolveLimitExpirationDate({
|
|
4602
5035
|
expirationType: limitExpirationType,
|
|
4603
5036
|
customDate: limitExpirationDate,
|
|
4604
5037
|
customTime: limitExpirationTime
|
|
4605
5038
|
});
|
|
4606
5039
|
if (limitExpirationType !== "GTC" && !expirationDate) return null;
|
|
4607
|
-
const limitPriceRaw =
|
|
5040
|
+
const limitPriceRaw = selectedLimitPriceRaw;
|
|
4608
5041
|
const sizeRaw = toLimitSizeRaw({
|
|
4609
5042
|
amount: internalAmount,
|
|
4610
5043
|
limitPriceRaw,
|
|
@@ -4625,9 +5058,9 @@ var PlaceOrder = ({
|
|
|
4625
5058
|
limitExpirationDate,
|
|
4626
5059
|
limitExpirationTime,
|
|
4627
5060
|
limitExpirationType,
|
|
4628
|
-
limitPrice,
|
|
4629
5061
|
limitPriceInputError,
|
|
4630
|
-
selectedLimitVenueOption
|
|
5062
|
+
selectedLimitVenueOption,
|
|
5063
|
+
selectedLimitPriceRaw
|
|
4631
5064
|
]);
|
|
4632
5065
|
const resolvedLimitExpirationDraftDate = useMemo(() => {
|
|
4633
5066
|
return resolveLimitExpirationDate({
|
|
@@ -4672,7 +5105,13 @@ var PlaceOrder = ({
|
|
|
4672
5105
|
}, [internalTab, limitOrderPayload]);
|
|
4673
5106
|
const limitRouteCards = useMemo(() => {
|
|
4674
5107
|
return visibleLimitVenueOptions.map((option) => {
|
|
4675
|
-
var _a2, _b2;
|
|
5108
|
+
var _a2, _b2, _c2, _d2;
|
|
5109
|
+
const effectiveLimitPriceRaw = (_b2 = (_a2 = limitPriceAdjustmentByVenue.get(option.venue)) == null ? void 0 : _a2.adjustedPriceRaw) != null ? _b2 : originalLimitPriceRaw;
|
|
5110
|
+
const venueToWinValue = getLimitOrderToWinValue({
|
|
5111
|
+
amount: internalAmount,
|
|
5112
|
+
limitPriceRaw: effectiveLimitPriceRaw,
|
|
5113
|
+
side: internalTab
|
|
5114
|
+
});
|
|
4676
5115
|
const availabilityState = getVenueAvailabilityState({
|
|
4677
5116
|
venueId: option.venue,
|
|
4678
5117
|
disabledVenues,
|
|
@@ -4682,7 +5121,7 @@ var PlaceOrder = ({
|
|
|
4682
5121
|
const isUnavailable = isTradingBlocked || isGeoBlocked || availabilityState !== "available";
|
|
4683
5122
|
const currentPriceLabel = option.currentPrice == null ? "\u2014" : formatProbabilityCents(option.currentPrice, formatPrice);
|
|
4684
5123
|
const totalFees = getSmartRouteTotalFees(
|
|
4685
|
-
(
|
|
5124
|
+
(_d2 = (_c2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _c2.data) == null ? void 0 : _d2.feeBreakdown
|
|
4686
5125
|
);
|
|
4687
5126
|
const feeLabel = totalFees == null ? void 0 : formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
4688
5127
|
return {
|
|
@@ -4691,8 +5130,8 @@ var PlaceOrder = ({
|
|
|
4691
5130
|
isUnavailable,
|
|
4692
5131
|
kind: "venue",
|
|
4693
5132
|
label: getTradingVenueLabel(option.venue),
|
|
4694
|
-
numericValue:
|
|
4695
|
-
value: formatUsd(
|
|
5133
|
+
numericValue: venueToWinValue,
|
|
5134
|
+
value: formatUsd(venueToWinValue, {
|
|
4696
5135
|
maximumFractionDigits: 2,
|
|
4697
5136
|
minimumFractionDigits: 2
|
|
4698
5137
|
}),
|
|
@@ -4701,12 +5140,15 @@ var PlaceOrder = ({
|
|
|
4701
5140
|
});
|
|
4702
5141
|
}, [
|
|
4703
5142
|
disabledVenues,
|
|
4704
|
-
displayedLimitToWinValue,
|
|
4705
5143
|
formatPrice,
|
|
4706
5144
|
geoBlockedLimitVenues,
|
|
5145
|
+
internalAmount,
|
|
5146
|
+
internalTab,
|
|
4707
5147
|
isAppConfigLoading,
|
|
4708
5148
|
isTradingBlocked,
|
|
5149
|
+
limitPriceAdjustmentByVenue,
|
|
4709
5150
|
limitVenueQuoteByVenue,
|
|
5151
|
+
originalLimitPriceRaw,
|
|
4710
5152
|
tradingLabels,
|
|
4711
5153
|
visibleLimitVenueOptions
|
|
4712
5154
|
]);
|
|
@@ -4719,7 +5161,7 @@ var PlaceOrder = ({
|
|
|
4719
5161
|
);
|
|
4720
5162
|
}, [visibleLimitVenueOptions]);
|
|
4721
5163
|
const activeRouteCards = isLimitOrder ? limitRouteCards : visibleMarketRouteCards;
|
|
4722
|
-
const activeRouteCardCount = isLimitOrder ? limitRouteCards.length :
|
|
5164
|
+
const activeRouteCardCount = isLimitOrder ? limitRouteCards.length : displayedRouteCards.length;
|
|
4723
5165
|
const handleActiveRouteCardSelect = (cardId) => {
|
|
4724
5166
|
if (!isLimitOrder) {
|
|
4725
5167
|
handleRouteCardSelect(cardId);
|
|
@@ -4729,7 +5171,7 @@ var PlaceOrder = ({
|
|
|
4729
5171
|
if (!option) return;
|
|
4730
5172
|
setSelectedLimitVenue(option.venue);
|
|
4731
5173
|
};
|
|
4732
|
-
const displayedLimitToWinHint =
|
|
5174
|
+
const displayedLimitToWinHint = formatLimitPriceRawLabel(selectedLimitPriceRaw);
|
|
4733
5175
|
const activeFeeBreakdown = activeQuoteData == null ? void 0 : activeQuoteData.feeBreakdown;
|
|
4734
5176
|
const estimatedFeesValue = useMemo(() => {
|
|
4735
5177
|
const totalFees = getSmartRouteTotalFees(activeFeeBreakdown);
|
|
@@ -4772,14 +5214,14 @@ var PlaceOrder = ({
|
|
|
4772
5214
|
}, [activeFeeBreakdown, tradingLabels]);
|
|
4773
5215
|
const isActionLoading = isPrimaryActionLoading || executeManaged.isPending || placeLimitOrder.isPending || isBeforeActionPending;
|
|
4774
5216
|
const selectedLimitRouteCardId = selectedLimitVenueOption ? `limit-venue-${selectedLimitVenueOption.venue}-${selectedLimitVenueOption.venueMarketOutcomeId}` : null;
|
|
4775
|
-
const selectedLimitRouteCard = selectedLimitRouteCardId ? (
|
|
4776
|
-
const selectedRouteGeoBlocked = isLimitOrder ? (
|
|
5217
|
+
const selectedLimitRouteCard = selectedLimitRouteCardId ? (_da = limitRouteCards.find((card) => card.id === selectedLimitRouteCardId)) != null ? _da : null : null;
|
|
5218
|
+
const selectedRouteGeoBlocked = isLimitOrder ? (_ea = selectedLimitRouteCard == null ? void 0 : selectedLimitRouteCard.isUnavailable) != null ? _ea : false : (_fa = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _fa : false;
|
|
4777
5219
|
const geoBlockedVenuesFromWarnings = useMemo(
|
|
4778
5220
|
() => {
|
|
4779
5221
|
var _a2;
|
|
4780
5222
|
return extractGeoBlockedVenues((_a2 = smartRoute.data) == null ? void 0 : _a2.warnings);
|
|
4781
5223
|
},
|
|
4782
|
-
[(
|
|
5224
|
+
[(_ga = smartRoute.data) == null ? void 0 : _ga.warnings]
|
|
4783
5225
|
);
|
|
4784
5226
|
const isPrimaryVenueGeoBlocked = useMemo(() => {
|
|
4785
5227
|
var _a2, _b2;
|
|
@@ -4788,11 +5230,15 @@ var PlaceOrder = ({
|
|
|
4788
5230
|
return fills.length > 0 && fills.every((f) => geoBlockedVenuesFromWarnings.has(f.venue));
|
|
4789
5231
|
}, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
|
|
4790
5232
|
const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked || isLimitOrder && limitRouteCards.length > 0 && limitRouteCards.every((card) => card.isUnavailable);
|
|
4791
|
-
const shouldShowLowLiquidityWarning = !isQuoteInputEditing && !isQuoteLoading && (activeQuoteData == null ? void 0 : activeQuoteData.venueMarketOutcomeId) === scopedSelectedOutcomeId &&
|
|
5233
|
+
const shouldShowLowLiquidityWarning = !isQuoteInputEditing && !isQuoteLoading && (activeQuoteData == null ? void 0 : activeQuoteData.venueMarketOutcomeId) === scopedSelectedOutcomeId && isPlaceOrderAveragePriceWorse({
|
|
5234
|
+
averageExecutionPrice: selectedRouteCard == null ? void 0 : selectedRouteCard.executionPrice,
|
|
5235
|
+
displayedMarketPrice: selectedOutcomeDisplayPrice,
|
|
5236
|
+
tradeSide: internalTab
|
|
5237
|
+
});
|
|
4792
5238
|
const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
|
|
4793
5239
|
const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isQuoteInsufficientBalance || isSell && isQuoteInputEditing || isSellAmountAboveAvailability || isBelowMinimum || !isLimitOrder && isQuoteLoading || isSelectedVenueInventoryInsufficient || (isLimitOrder ? !limitOrderPayload : !selectedRouteCard || !selectedRouteCard.quoteData.quoteId) || selectedRouteGeoBlocked || !isAuthenticated || !isLimitOrder && quoteStatus !== void 0;
|
|
4794
|
-
const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (isLimitOrder ? limitRouteCards.length > 0 :
|
|
4795
|
-
const shouldShowRouteToggle = !isLimitOrder && !isQuoteLoading &&
|
|
5240
|
+
const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (isLimitOrder ? limitRouteCards.length > 0 : displayedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
|
|
5241
|
+
const shouldShowRouteToggle = !isLimitOrder && !isQuoteLoading && displayedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
|
|
4796
5242
|
const handleReturnToOrderForm = useCallback2(() => {
|
|
4797
5243
|
const submittedSelection = submittedSelectionRef.current;
|
|
4798
5244
|
submittedSelectionRef.current = null;
|
|
@@ -4800,6 +5246,7 @@ var PlaceOrder = ({
|
|
|
4800
5246
|
setSubmissionFeedback(null);
|
|
4801
5247
|
setIsRoutesExpanded(false);
|
|
4802
5248
|
setSelectedRouteCardId(null);
|
|
5249
|
+
setManualRouteSelectionIdentity(null);
|
|
4803
5250
|
if (submittedSelection && tradingContext) {
|
|
4804
5251
|
tradingContext.selectMarketAndOutcome(
|
|
4805
5252
|
submittedSelection.marketId,
|
|
@@ -4856,6 +5303,12 @@ var PlaceOrder = ({
|
|
|
4856
5303
|
return;
|
|
4857
5304
|
}
|
|
4858
5305
|
try {
|
|
5306
|
+
setSubmissionProgressState({
|
|
5307
|
+
executionVenue: resolveExecutionVenueFromQuote(quoteData),
|
|
5308
|
+
quoteData,
|
|
5309
|
+
quoteId,
|
|
5310
|
+
phase: "submitting"
|
|
5311
|
+
});
|
|
4859
5312
|
const response = yield executeManaged.mutateAsync(
|
|
4860
5313
|
isPaperMode ? { quoteId, mode: "paper" } : { quoteId }
|
|
4861
5314
|
);
|
|
@@ -4869,13 +5322,14 @@ var PlaceOrder = ({
|
|
|
4869
5322
|
orderIds: response.orderIds
|
|
4870
5323
|
});
|
|
4871
5324
|
}
|
|
4872
|
-
setSubmissionProgressState({
|
|
5325
|
+
setSubmissionProgressState((previous) => __spreadProps(__spreadValues({}, previous), {
|
|
4873
5326
|
executionVenue: resolveExecutionVenueFromQuote(quoteData),
|
|
4874
5327
|
orderId: response.orderIds[0],
|
|
4875
5328
|
orderIds: response.orderIds,
|
|
5329
|
+
quoteData,
|
|
4876
5330
|
quoteId: response.quoteId,
|
|
4877
5331
|
phase: "submitting"
|
|
4878
|
-
});
|
|
5332
|
+
}));
|
|
4879
5333
|
} catch (error) {
|
|
4880
5334
|
if (debugAttempt) {
|
|
4881
5335
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
@@ -4944,7 +5398,7 @@ var PlaceOrder = ({
|
|
|
4944
5398
|
});
|
|
4945
5399
|
}
|
|
4946
5400
|
const response = yield placeLimitOrder.mutateAsync(submissionLimitOrderPayload);
|
|
4947
|
-
const limitPriceLabel =
|
|
5401
|
+
const limitPriceLabel = formatLimitPriceRawLabel(response.limitPriceRaw);
|
|
4948
5402
|
const size = Number(BigInt(submissionLimitOrderPayload.sizeRaw)) / Number(LIMIT_ORDER_RAW_SCALE);
|
|
4949
5403
|
const sizeLabel = size.toLocaleString("en-US", {
|
|
4950
5404
|
minimumFractionDigits: 2,
|
|
@@ -4960,7 +5414,7 @@ var PlaceOrder = ({
|
|
|
4960
5414
|
) : sizeLabel;
|
|
4961
5415
|
const eventTitle = (_b2 = (_a2 = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _a2 : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _b2 : "";
|
|
4962
5416
|
const eventDateSource = (_c2 = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate) != null ? _c2 : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.endDate;
|
|
4963
|
-
const responseVenue =
|
|
5417
|
+
const responseVenue = Venue3[response.venue];
|
|
4964
5418
|
setSubmissionProgressState({
|
|
4965
5419
|
orderId: response.orderId,
|
|
4966
5420
|
orderIds: [response.orderId],
|
|
@@ -4996,7 +5450,6 @@ var PlaceOrder = ({
|
|
|
4996
5450
|
headerImage,
|
|
4997
5451
|
internalTab,
|
|
4998
5452
|
isPaperMode,
|
|
4999
|
-
limitPrice,
|
|
5000
5453
|
onPrimaryAction,
|
|
5001
5454
|
placeLimitOrder,
|
|
5002
5455
|
scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate,
|
|
@@ -5013,14 +5466,14 @@ var PlaceOrder = ({
|
|
|
5013
5466
|
(e) => e.event === "filled" || e.event === "partial_fill"
|
|
5014
5467
|
);
|
|
5015
5468
|
setSubmissionProgressState((prev) => {
|
|
5016
|
-
var _a2;
|
|
5469
|
+
var _a2, _b2;
|
|
5017
5470
|
if (!prev) return prev;
|
|
5018
5471
|
const orderId = (_a2 = primaryFilledEvent == null ? void 0 : primaryFilledEvent.orderId) != null ? _a2 : prev.orderId;
|
|
5019
5472
|
return __spreadProps(__spreadValues({}, prev), {
|
|
5020
5473
|
phase: "success",
|
|
5021
5474
|
orderId,
|
|
5022
5475
|
summary: buildExecutionSummary(
|
|
5023
|
-
selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData,
|
|
5476
|
+
(_b2 = prev.quoteData) != null ? _b2 : selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData,
|
|
5024
5477
|
prev.executionVenue,
|
|
5025
5478
|
orderId,
|
|
5026
5479
|
failureSummary
|
|
@@ -5046,7 +5499,7 @@ var PlaceOrder = ({
|
|
|
5046
5499
|
]);
|
|
5047
5500
|
const handleRetrySubmission = useCallback2(() => __async(null, null, function* () {
|
|
5048
5501
|
var _a2, _b2, _c2, _d2, _e2;
|
|
5049
|
-
if (!orderEligibility.canPlaceOrder ||
|
|
5502
|
+
if (!orderEligibility.canPlaceOrder || !failureSummary || failureSummary.kind === "generic") {
|
|
5050
5503
|
handleReturnToOrderForm();
|
|
5051
5504
|
return;
|
|
5052
5505
|
}
|
|
@@ -5117,7 +5570,8 @@ var PlaceOrder = ({
|
|
|
5117
5570
|
sellShares: isSell ? retryAmount : void 0,
|
|
5118
5571
|
chainBalances: chainBalancesOverride,
|
|
5119
5572
|
slipCapBps: 1e6,
|
|
5120
|
-
compareVenues:
|
|
5573
|
+
compareVenues: !failureSummary.retryVenue,
|
|
5574
|
+
allowedVenues: failureSummary.retryVenue ? [failureSummary.retryVenue] : void 0,
|
|
5121
5575
|
tradeSide: isSell ? "sell" : "buy",
|
|
5122
5576
|
mode: isPaperMode ? "paper" : void 0
|
|
5123
5577
|
});
|
|
@@ -5152,9 +5606,9 @@ var PlaceOrder = ({
|
|
|
5152
5606
|
quoteData: refetchedQuoteData,
|
|
5153
5607
|
tradeSide: internalTab
|
|
5154
5608
|
});
|
|
5155
|
-
const refreshedSelectedCard = selectedRouteCardId ? refreshedCards.find((card) => card.id === selectedRouteCardId) : void 0;
|
|
5156
|
-
const venueIdentityChanged = !!originalSelectedCard && !!refreshedSelectedCard && !routeCardsHaveSameVenueIdentity(originalSelectedCard, refreshedSelectedCard);
|
|
5157
|
-
if (selectedRouteCardId && (!refreshedSelectedCard || venueIdentityChanged)) {
|
|
5609
|
+
const refreshedSelectedCard = failureSummary.retryVenue ? refreshedCards.find((card) => card.venue === failureSummary.retryVenue) : selectedRouteCardId ? refreshedCards.find((card) => card.id === selectedRouteCardId) : void 0;
|
|
5610
|
+
const venueIdentityChanged = !failureSummary.retryVenue && !!originalSelectedCard && !!refreshedSelectedCard && !routeCardsHaveSameVenueIdentity(originalSelectedCard, refreshedSelectedCard);
|
|
5611
|
+
if ((selectedRouteCardId || failureSummary.retryVenue) && (!refreshedSelectedCard || venueIdentityChanged)) {
|
|
5158
5612
|
setSubmissionProgressState(null);
|
|
5159
5613
|
setSubmissionFeedback({
|
|
5160
5614
|
message: tradingLabels.selectedVenueUnavailable,
|
|
@@ -5197,7 +5651,7 @@ var PlaceOrder = ({
|
|
|
5197
5651
|
]);
|
|
5198
5652
|
const resolvedStatusClassName = cn(classNames == null ? void 0 : classNames.root, className);
|
|
5199
5653
|
if (isLoading) {
|
|
5200
|
-
return /* @__PURE__ */
|
|
5654
|
+
return /* @__PURE__ */ jsx7(
|
|
5201
5655
|
Skeleton,
|
|
5202
5656
|
{
|
|
5203
5657
|
ariaLabel: labels.common.loading,
|
|
@@ -5208,7 +5662,7 @@ var PlaceOrder = ({
|
|
|
5208
5662
|
}
|
|
5209
5663
|
if (submissionProgressState) {
|
|
5210
5664
|
if (submissionProgressState.phase === "success" && submissionProgressState.summary) {
|
|
5211
|
-
return /* @__PURE__ */
|
|
5665
|
+
return /* @__PURE__ */ jsx7(
|
|
5212
5666
|
PlaceOrderSuccessView,
|
|
5213
5667
|
{
|
|
5214
5668
|
className: resolvedStatusClassName,
|
|
@@ -5220,7 +5674,7 @@ var PlaceOrder = ({
|
|
|
5220
5674
|
);
|
|
5221
5675
|
}
|
|
5222
5676
|
if (submissionProgressState.phase === "failed") {
|
|
5223
|
-
return /* @__PURE__ */
|
|
5677
|
+
return /* @__PURE__ */ jsx7(
|
|
5224
5678
|
PlaceOrderFailureView,
|
|
5225
5679
|
{
|
|
5226
5680
|
className: resolvedStatusClassName,
|
|
@@ -5233,17 +5687,19 @@ var PlaceOrder = ({
|
|
|
5233
5687
|
}
|
|
5234
5688
|
);
|
|
5235
5689
|
}
|
|
5236
|
-
return
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5690
|
+
return /* @__PURE__ */ jsx7(
|
|
5691
|
+
PlaceOrderExecutionView,
|
|
5692
|
+
{
|
|
5693
|
+
className,
|
|
5694
|
+
classNames,
|
|
5695
|
+
enableAnimations,
|
|
5696
|
+
eventDateLabel: executionDateLabel,
|
|
5697
|
+
eventImage: headerImage,
|
|
5698
|
+
eventTitle: headerTitle,
|
|
5699
|
+
groups: executionOrderGroups,
|
|
5700
|
+
labels: tradingLabels
|
|
5701
|
+
}
|
|
5702
|
+
);
|
|
5247
5703
|
}
|
|
5248
5704
|
const handleTabChange = (nextTab) => {
|
|
5249
5705
|
if (!orderEligibility.canPlaceOrder) return;
|
|
@@ -5277,6 +5733,12 @@ var PlaceOrder = ({
|
|
|
5277
5733
|
if (!isSell) return;
|
|
5278
5734
|
if (maxSellableShares <= 0) return;
|
|
5279
5735
|
setSelectedRouteCardId(PLACE_ORDER_MAXIMIZE_PAYOUT_ROUTE_ID);
|
|
5736
|
+
const maximizePayoutCard = routeCards.find(
|
|
5737
|
+
(card) => card.id === PLACE_ORDER_MAXIMIZE_PAYOUT_ROUTE_ID
|
|
5738
|
+
);
|
|
5739
|
+
setManualRouteSelectionIdentity(
|
|
5740
|
+
maximizePayoutCard ? getPlaceOrderRouteCardIdentity(maximizePayoutCard) : null
|
|
5741
|
+
);
|
|
5280
5742
|
setIsSplitDetailOpen(false);
|
|
5281
5743
|
handleAmountChange(maxSellableShares);
|
|
5282
5744
|
};
|
|
@@ -5420,7 +5882,10 @@ var PlaceOrder = ({
|
|
|
5420
5882
|
};
|
|
5421
5883
|
}
|
|
5422
5884
|
try {
|
|
5423
|
-
setSubmissionProgressState({
|
|
5885
|
+
setSubmissionProgressState({
|
|
5886
|
+
phase: "finding-route",
|
|
5887
|
+
quoteData: isLimitOrder ? void 0 : selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData
|
|
5888
|
+
});
|
|
5424
5889
|
if (isLimitOrder) {
|
|
5425
5890
|
yield handlePlaceLimitOrder(submissionLimitOrderPayload);
|
|
5426
5891
|
return;
|
|
@@ -5439,11 +5904,11 @@ var PlaceOrder = ({
|
|
|
5439
5904
|
}
|
|
5440
5905
|
});
|
|
5441
5906
|
if (isEndedWithoutKnownWinner || !orderEligibility.canPlaceOrder && resolvedReadOnlyTradingState.kind !== "open") {
|
|
5442
|
-
return /* @__PURE__ */
|
|
5907
|
+
return /* @__PURE__ */ jsx7(
|
|
5443
5908
|
PlaceOrderResolvedView,
|
|
5444
5909
|
{
|
|
5445
5910
|
tradingState: resolvedReadOnlyTradingState,
|
|
5446
|
-
resolutionTimestamp: (
|
|
5911
|
+
resolutionTimestamp: (_ha = resolvedEventTradingState.resolvesAt) != null ? _ha : resolvedReadOnlyTradingState.resolvesAt,
|
|
5447
5912
|
resolvedClaim,
|
|
5448
5913
|
classNames,
|
|
5449
5914
|
className,
|
|
@@ -5451,8 +5916,8 @@ var PlaceOrder = ({
|
|
|
5451
5916
|
}
|
|
5452
5917
|
);
|
|
5453
5918
|
}
|
|
5454
|
-
return /* @__PURE__ */
|
|
5455
|
-
/* @__PURE__ */
|
|
5919
|
+
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
5920
|
+
/* @__PURE__ */ jsxs6(
|
|
5456
5921
|
Card,
|
|
5457
5922
|
{
|
|
5458
5923
|
className: cn(
|
|
@@ -5469,20 +5934,20 @@ var PlaceOrder = ({
|
|
|
5469
5934
|
headerTitle,
|
|
5470
5935
|
onClose
|
|
5471
5936
|
}),
|
|
5472
|
-
/* @__PURE__ */
|
|
5473
|
-
/* @__PURE__ */
|
|
5937
|
+
/* @__PURE__ */ jsxs6("div", { className: cn("agg-order-panel-content flex flex-col gap-6", classNames == null ? void 0 : classNames.content), children: [
|
|
5938
|
+
/* @__PURE__ */ jsxs6(
|
|
5474
5939
|
"div",
|
|
5475
5940
|
{
|
|
5476
5941
|
className: "agg-order-tabs flex items-end border-b border-agg-separator",
|
|
5477
5942
|
role: "tablist",
|
|
5478
5943
|
"aria-label": labels.common.tabsAria,
|
|
5479
5944
|
children: [
|
|
5480
|
-
/* @__PURE__ */
|
|
5945
|
+
/* @__PURE__ */ jsx7("div", { className: "flex min-w-0 flex-1 items-end", children: [
|
|
5481
5946
|
{ value: "buy", label: tradingLabels.buy, ref: buyTabRef },
|
|
5482
5947
|
{ value: "sell", label: tradingLabels.sell, ref: sellTabRef }
|
|
5483
5948
|
].map((tabItem) => {
|
|
5484
5949
|
const isActive = internalTab === tabItem.value;
|
|
5485
|
-
return /* @__PURE__ */
|
|
5950
|
+
return /* @__PURE__ */ jsxs6(
|
|
5486
5951
|
"button",
|
|
5487
5952
|
{
|
|
5488
5953
|
ref: tabItem.ref,
|
|
@@ -5506,7 +5971,7 @@ var PlaceOrder = ({
|
|
|
5506
5971
|
onKeyDown: (event) => handleTabKeyDown(event, tabItem.value),
|
|
5507
5972
|
children: [
|
|
5508
5973
|
tabItem.label,
|
|
5509
|
-
/* @__PURE__ */
|
|
5974
|
+
/* @__PURE__ */ jsx7(
|
|
5510
5975
|
"span",
|
|
5511
5976
|
{
|
|
5512
5977
|
"aria-hidden": "true",
|
|
@@ -5526,7 +5991,7 @@ var PlaceOrder = ({
|
|
|
5526
5991
|
tabItem.value
|
|
5527
5992
|
);
|
|
5528
5993
|
}) }),
|
|
5529
|
-
showLimitOrders ? /* @__PURE__ */
|
|
5994
|
+
showLimitOrders ? /* @__PURE__ */ jsx7(
|
|
5530
5995
|
Select,
|
|
5531
5996
|
{
|
|
5532
5997
|
ariaLabel: tradingLabels.orderTypeAria,
|
|
@@ -5547,8 +6012,8 @@ var PlaceOrder = ({
|
|
|
5547
6012
|
]
|
|
5548
6013
|
}
|
|
5549
6014
|
),
|
|
5550
|
-
/* @__PURE__ */
|
|
5551
|
-
outcomes.length >= 2 ? /* @__PURE__ */
|
|
6015
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-order-entry-section flex flex-col gap-4", children: [
|
|
6016
|
+
outcomes.length >= 2 ? /* @__PURE__ */ jsx7("div", { className: "agg-outcomes flex w-full max-w-full gap-2", children: outcomes.map((outcome, index) => {
|
|
5552
6017
|
var _a2, _b2, _c2;
|
|
5553
6018
|
const price = getDisplayOutcomePrice({
|
|
5554
6019
|
outcomeId: outcome.id,
|
|
@@ -5562,7 +6027,7 @@ var PlaceOrder = ({
|
|
|
5562
6027
|
const isActive = outcome.id === scopedSelectedOutcomeId;
|
|
5563
6028
|
const isPositive = resolveIsPositiveOutcome(outcome, index);
|
|
5564
6029
|
const isPriceLoading = clusterMidpointResult.isLoading && price == null;
|
|
5565
|
-
return /* @__PURE__ */
|
|
6030
|
+
return /* @__PURE__ */ jsxs6(
|
|
5566
6031
|
"button",
|
|
5567
6032
|
{
|
|
5568
6033
|
"data-id": outcome.id,
|
|
@@ -5582,7 +6047,7 @@ var PlaceOrder = ({
|
|
|
5582
6047
|
disabled: !orderEligibility.canPlaceOrder || isResolvedOutcomeCtaLocked,
|
|
5583
6048
|
onClick: () => handleOutcomeChange(outcome.id),
|
|
5584
6049
|
children: [
|
|
5585
|
-
/* @__PURE__ */
|
|
6050
|
+
/* @__PURE__ */ jsx7(
|
|
5586
6051
|
Typography,
|
|
5587
6052
|
{
|
|
5588
6053
|
as: "span",
|
|
@@ -5591,7 +6056,7 @@ var PlaceOrder = ({
|
|
|
5591
6056
|
children: (_c2 = outcome.title) != null ? _c2 : outcome.label
|
|
5592
6057
|
}
|
|
5593
6058
|
),
|
|
5594
|
-
isPriceLoading ? /* @__PURE__ */
|
|
6059
|
+
isPriceLoading ? /* @__PURE__ */ jsx7(
|
|
5595
6060
|
"span",
|
|
5596
6061
|
{
|
|
5597
6062
|
"aria-hidden": "true",
|
|
@@ -5600,18 +6065,18 @@ var PlaceOrder = ({
|
|
|
5600
6065
|
"h-4 w-10 shrink-0 rounded-agg-sm bg-agg-separator animate-pulse"
|
|
5601
6066
|
)
|
|
5602
6067
|
}
|
|
5603
|
-
) : /* @__PURE__ */
|
|
6068
|
+
) : /* @__PURE__ */ jsx7(Typography, { as: "span", variant: isActive ? "body-strong" : "body", children: formatProbabilityCents(price, formatPrice) })
|
|
5604
6069
|
]
|
|
5605
6070
|
},
|
|
5606
6071
|
outcome.id
|
|
5607
6072
|
);
|
|
5608
6073
|
}) }) : null,
|
|
5609
|
-
isLimitOrder ? /* @__PURE__ */
|
|
5610
|
-
/* @__PURE__ */
|
|
5611
|
-
/* @__PURE__ */
|
|
5612
|
-
/* @__PURE__ */
|
|
5613
|
-
/* @__PURE__ */
|
|
5614
|
-
/* @__PURE__ */
|
|
6074
|
+
isLimitOrder ? /* @__PURE__ */ jsxs6("div", { className: "agg-limit-price-section flex items-center justify-between gap-4", children: [
|
|
6075
|
+
/* @__PURE__ */ jsx7("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.limitPrice }),
|
|
6076
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex min-w-0 flex-col items-end gap-1", children: [
|
|
6077
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
|
|
6078
|
+
/* @__PURE__ */ jsxs6("label", { className: "relative flex items-center", children: [
|
|
6079
|
+
/* @__PURE__ */ jsx7(
|
|
5615
6080
|
"input",
|
|
5616
6081
|
{
|
|
5617
6082
|
type: "text",
|
|
@@ -5628,38 +6093,58 @@ var PlaceOrder = ({
|
|
|
5628
6093
|
)
|
|
5629
6094
|
}
|
|
5630
6095
|
),
|
|
5631
|
-
/* @__PURE__ */
|
|
6096
|
+
/* @__PURE__ */ jsx7("span", { className: "pointer-events-none absolute right-1 text-agg-3xl font-agg-bold leading-agg-9 text-agg-foreground", children: "\xA2" })
|
|
5632
6097
|
] }),
|
|
5633
|
-
/* @__PURE__ */
|
|
6098
|
+
/* @__PURE__ */ jsx7(
|
|
5634
6099
|
"button",
|
|
5635
6100
|
{
|
|
5636
6101
|
type: "button",
|
|
5637
6102
|
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",
|
|
5638
6103
|
"aria-label": tradingLabels.limitPriceDecreaseAria,
|
|
5639
6104
|
onClick: () => handleLimitPriceStep("decrease"),
|
|
5640
|
-
children: /* @__PURE__ */
|
|
6105
|
+
children: /* @__PURE__ */ jsx7(Icon, { name: "minus", size: "small", className: "h-4 w-4", "aria-hidden": true })
|
|
5641
6106
|
}
|
|
5642
6107
|
),
|
|
5643
|
-
/* @__PURE__ */
|
|
6108
|
+
/* @__PURE__ */ jsx7(
|
|
5644
6109
|
"button",
|
|
5645
6110
|
{
|
|
5646
6111
|
type: "button",
|
|
5647
6112
|
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",
|
|
5648
6113
|
"aria-label": tradingLabels.limitPriceIncreaseAria,
|
|
5649
6114
|
onClick: () => handleLimitPriceStep("increase"),
|
|
5650
|
-
children: /* @__PURE__ */
|
|
6115
|
+
children: /* @__PURE__ */ jsx7(Icon, { name: "plus", size: "small", className: "h-4 w-4", "aria-hidden": true })
|
|
5651
6116
|
}
|
|
5652
6117
|
)
|
|
5653
6118
|
] }),
|
|
5654
|
-
limitPriceInputError ? /* @__PURE__ */
|
|
6119
|
+
limitPriceInputError ? /* @__PURE__ */ jsx7("p", { className: "max-w-[220px] text-right text-agg-xs leading-agg-4 text-agg-error", children: limitPriceInputError }) : null
|
|
5655
6120
|
] })
|
|
5656
6121
|
] }) : null,
|
|
5657
|
-
/* @__PURE__ */
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
6122
|
+
isLimitOrder && limitPriceAdjustmentMessage ? /* @__PURE__ */ jsxs6(
|
|
6123
|
+
"div",
|
|
6124
|
+
{
|
|
6125
|
+
className: "agg-limit-price-adjustment flex w-full items-center gap-2 rounded-agg-lg bg-agg-warning/10 px-3 py-2",
|
|
6126
|
+
role: "status",
|
|
6127
|
+
"aria-live": "polite",
|
|
6128
|
+
children: [
|
|
6129
|
+
/* @__PURE__ */ jsx7(
|
|
6130
|
+
Icon,
|
|
6131
|
+
{
|
|
6132
|
+
name: "warning-filled",
|
|
6133
|
+
size: "small",
|
|
6134
|
+
className: "h-4! w-4! shrink-0 text-agg-warning",
|
|
6135
|
+
"aria-hidden": "true"
|
|
6136
|
+
}
|
|
6137
|
+
),
|
|
6138
|
+
/* @__PURE__ */ jsx7("p", { className: "min-w-0 flex-1 wrap-break-word text-agg-sm leading-agg-5 text-agg-foreground", children: limitPriceAdjustmentMessage })
|
|
6139
|
+
]
|
|
6140
|
+
}
|
|
6141
|
+
) : null,
|
|
6142
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-order-amount-section flex items-start justify-between gap-4", children: [
|
|
6143
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-order-amount-meta flex flex-col", children: [
|
|
6144
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-order-amount-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground whitespace-nowrap", children: tradingLabels.amount(internalTab) }),
|
|
6145
|
+
isAuthenticated ? isSell ? /* @__PURE__ */ jsx7("div", { className: "agg-balance-value flex items-baseline gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isCurrentSellableSharesLoading ? /* @__PURE__ */ jsx7(LoadingIcon, { size: "small" }) : /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
6146
|
+
/* @__PURE__ */ jsx7("span", { className: "whitespace-pre", children: displayedCurrentSellableSharesLabel }),
|
|
6147
|
+
displayedCurrentSellableShares > 0 ? /* @__PURE__ */ jsx7(
|
|
5663
6148
|
"button",
|
|
5664
6149
|
{
|
|
5665
6150
|
type: "button",
|
|
@@ -5675,9 +6160,9 @@ var PlaceOrder = ({
|
|
|
5675
6160
|
children: tradingLabels.maxShares
|
|
5676
6161
|
}
|
|
5677
6162
|
) : null
|
|
5678
|
-
] }) }) : /* @__PURE__ */
|
|
6163
|
+
] }) }) : /* @__PURE__ */ jsx7("p", { className: "agg-balance-value flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isBalanceLoading ? /* @__PURE__ */ jsx7(LoadingIcon, { size: "small" }) : tradingLabels.balance(formatUsd(displayedBalance)) }) : null
|
|
5679
6164
|
] }),
|
|
5680
|
-
/* @__PURE__ */
|
|
6165
|
+
/* @__PURE__ */ jsx7(
|
|
5681
6166
|
CurrencyInput,
|
|
5682
6167
|
{
|
|
5683
6168
|
value: internalAmount,
|
|
@@ -5699,9 +6184,9 @@ var PlaceOrder = ({
|
|
|
5699
6184
|
}
|
|
5700
6185
|
)
|
|
5701
6186
|
] }),
|
|
5702
|
-
showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */
|
|
5703
|
-
/* @__PURE__ */
|
|
5704
|
-
/* @__PURE__ */
|
|
6187
|
+
showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */ jsxs6("div", { className: "agg-order-fees-section flex items-center justify-between gap-4", children: [
|
|
6188
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1.5", children: [
|
|
6189
|
+
/* @__PURE__ */ jsx7(
|
|
5705
6190
|
Typography,
|
|
5706
6191
|
{
|
|
5707
6192
|
variant: "text-sm",
|
|
@@ -5709,7 +6194,7 @@ var PlaceOrder = ({
|
|
|
5709
6194
|
children: tradingLabels.estimatedFees
|
|
5710
6195
|
}
|
|
5711
6196
|
),
|
|
5712
|
-
feeBreakdownRows.length > 0 ? /* @__PURE__ */
|
|
6197
|
+
feeBreakdownRows.length > 0 ? /* @__PURE__ */ jsx7(
|
|
5713
6198
|
Tooltip,
|
|
5714
6199
|
{
|
|
5715
6200
|
"aria-label": tradingLabels.estimatedFeesTooltipAria,
|
|
@@ -5721,13 +6206,13 @@ var PlaceOrder = ({
|
|
|
5721
6206
|
icon: "h-3 w-3 text-agg-muted-foreground",
|
|
5722
6207
|
trigger: "h-3 w-3 text-agg-muted-foreground"
|
|
5723
6208
|
},
|
|
5724
|
-
content: /* @__PURE__ */
|
|
6209
|
+
content: /* @__PURE__ */ jsx7("div", { className: "flex w-full flex-col gap-2", children: feeBreakdownRows.map((row) => /* @__PURE__ */ jsxs6(
|
|
5725
6210
|
"div",
|
|
5726
6211
|
{
|
|
5727
6212
|
className: "flex items-center justify-between gap-3 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground",
|
|
5728
6213
|
children: [
|
|
5729
|
-
/* @__PURE__ */
|
|
5730
|
-
row.kind === "badge" ? /* @__PURE__ */
|
|
6214
|
+
/* @__PURE__ */ jsx7("span", { children: row.label }),
|
|
6215
|
+
row.kind === "badge" ? /* @__PURE__ */ jsx7(
|
|
5731
6216
|
"span",
|
|
5732
6217
|
{
|
|
5733
6218
|
className: cn(
|
|
@@ -5737,7 +6222,7 @@ var PlaceOrder = ({
|
|
|
5737
6222
|
),
|
|
5738
6223
|
children: row.badgeLabel
|
|
5739
6224
|
}
|
|
5740
|
-
) : /* @__PURE__ */
|
|
6225
|
+
) : /* @__PURE__ */ jsx7("span", { className: "text-right", children: row.value })
|
|
5741
6226
|
]
|
|
5742
6227
|
},
|
|
5743
6228
|
row.label
|
|
@@ -5745,57 +6230,64 @@ var PlaceOrder = ({
|
|
|
5745
6230
|
}
|
|
5746
6231
|
) : null
|
|
5747
6232
|
] }),
|
|
5748
|
-
/* @__PURE__ */
|
|
6233
|
+
/* @__PURE__ */ jsx7("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: estimatedFeesValue })
|
|
5749
6234
|
] }) : null
|
|
5750
6235
|
] }),
|
|
5751
|
-
shouldShowSmartRouting ? /* @__PURE__ */
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
className: "agg-route-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
6236
|
+
shouldShowSmartRouting ? /* @__PURE__ */ jsxs6(
|
|
6237
|
+
"div",
|
|
6238
|
+
{
|
|
6239
|
+
className: "agg-route-panel flex flex-col gap-3",
|
|
6240
|
+
"aria-busy": !isLimitOrder && isQuoteLoading,
|
|
6241
|
+
children: [
|
|
6242
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-route-panel-header flex items-center justify-between gap-4", children: [
|
|
6243
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-route-panel-title text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.smartRouting }),
|
|
6244
|
+
shouldShowRouteToggle && !isRoutesExpanded ? /* @__PURE__ */ jsxs6(
|
|
6245
|
+
"button",
|
|
6246
|
+
{
|
|
6247
|
+
type: "button",
|
|
6248
|
+
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",
|
|
6249
|
+
"aria-label": tradingLabels.viewAllRoutes(activeRouteCardCount),
|
|
6250
|
+
onClick: () => setIsRoutesExpanded((currentValue) => !currentValue),
|
|
6251
|
+
children: [
|
|
6252
|
+
/* @__PURE__ */ jsx7("span", { children: tradingLabels.viewAllRoutes(activeRouteCardCount) }),
|
|
6253
|
+
/* @__PURE__ */ jsx7(
|
|
6254
|
+
Icon,
|
|
6255
|
+
{
|
|
6256
|
+
name: "chevron-down",
|
|
6257
|
+
size: "small",
|
|
6258
|
+
className: "h-4 w-4 text-agg-foreground",
|
|
6259
|
+
"aria-hidden": "true"
|
|
6260
|
+
}
|
|
6261
|
+
)
|
|
6262
|
+
]
|
|
6263
|
+
}
|
|
6264
|
+
) : null
|
|
6265
|
+
] }),
|
|
6266
|
+
/* @__PURE__ */ jsx7("div", { className: "agg-route-list flex flex-col gap-2", children: !isLimitOrder && isQuoteLoading && activeRouteCards.length === 0 ? /* @__PURE__ */ jsxs6("div", { className: "agg-route-loading flex flex-col gap-2", "aria-hidden": "true", children: [
|
|
6267
|
+
/* @__PURE__ */ jsx7(PlaceOrderRouteCardSkeleton, {}),
|
|
6268
|
+
/* @__PURE__ */ jsx7(PlaceOrderRouteCardSkeleton, {})
|
|
6269
|
+
] }) : activeRouteCards.length > 0 ? activeRouteCards.map((card) => {
|
|
6270
|
+
return /* @__PURE__ */ jsx7(Fragment2, { children: renderRouteCard({
|
|
6271
|
+
card,
|
|
6272
|
+
enableAnimations,
|
|
6273
|
+
isExpanded: card.kind === "split" ? isSplitDetailOpen : isRoutesExpanded,
|
|
6274
|
+
isSelected: !card.isUnavailable && card.id === (isLimitOrder ? selectedLimitRouteCardId : resolvedSelectedRouteCardId),
|
|
6275
|
+
onSelect: handleActiveRouteCardSelect,
|
|
6276
|
+
tradingLabels
|
|
6277
|
+
}) }, card.id);
|
|
6278
|
+
}) : null })
|
|
6279
|
+
]
|
|
6280
|
+
}
|
|
6281
|
+
) : null,
|
|
6282
|
+
isLimitOrder ? /* @__PURE__ */ jsxs6("div", { className: "agg-limit-expiration-section flex items-center justify-between gap-4", children: [
|
|
6283
|
+
/* @__PURE__ */ jsx7("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.expiration }),
|
|
6284
|
+
/* @__PURE__ */ jsxs6(
|
|
5793
6285
|
Popover.Root,
|
|
5794
6286
|
{
|
|
5795
6287
|
open: isLimitExpirationPickerOpen,
|
|
5796
6288
|
onOpenChange: handleLimitExpirationPickerOpenChange,
|
|
5797
6289
|
children: [
|
|
5798
|
-
/* @__PURE__ */
|
|
6290
|
+
/* @__PURE__ */ jsx7(Popover.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs6(
|
|
5799
6291
|
"button",
|
|
5800
6292
|
{
|
|
5801
6293
|
ref: expirationTriggerRef,
|
|
@@ -5803,10 +6295,10 @@ var PlaceOrder = ({
|
|
|
5803
6295
|
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",
|
|
5804
6296
|
"aria-label": tradingLabels.expirationMenuAria,
|
|
5805
6297
|
children: [
|
|
5806
|
-
/* @__PURE__ */
|
|
6298
|
+
/* @__PURE__ */ jsx7("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(
|
|
5807
6299
|
"MMM D, YYYY [at] HH:mm"
|
|
5808
6300
|
) : tradingLabels.expirationCustom }),
|
|
5809
|
-
/* @__PURE__ */
|
|
6301
|
+
/* @__PURE__ */ jsx7(
|
|
5810
6302
|
Icon,
|
|
5811
6303
|
{
|
|
5812
6304
|
name: isLimitExpirationPickerOpen ? "chevron-up" : "chevron-down",
|
|
@@ -5818,11 +6310,11 @@ var PlaceOrder = ({
|
|
|
5818
6310
|
]
|
|
5819
6311
|
}
|
|
5820
6312
|
) }),
|
|
5821
|
-
/* @__PURE__ */
|
|
6313
|
+
/* @__PURE__ */ jsx7(
|
|
5822
6314
|
Popover.Portal,
|
|
5823
6315
|
{
|
|
5824
6316
|
container: resolvePlaceOrderPortalContainer(expirationTriggerRef.current),
|
|
5825
|
-
children: /* @__PURE__ */
|
|
6317
|
+
children: /* @__PURE__ */ jsx7(
|
|
5826
6318
|
Popover.Content,
|
|
5827
6319
|
{
|
|
5828
6320
|
align: "end",
|
|
@@ -5831,14 +6323,14 @@ var PlaceOrder = ({
|
|
|
5831
6323
|
role: "dialog",
|
|
5832
6324
|
"aria-label": tradingLabels.expirationMenuAria,
|
|
5833
6325
|
className: "z-50 max-h-[calc(100dvh-2rem)] w-[min(312px,calc(100vw-2rem))] overflow-y-auto rounded-agg-xl border border-agg-separator bg-agg-secondary p-0 shadow-[0_8px_16px_rgba(0,0,0,0.20)]",
|
|
5834
|
-
children: limitExpirationPickerView === "calendar" ? /* @__PURE__ */
|
|
5835
|
-
/* @__PURE__ */
|
|
6326
|
+
children: limitExpirationPickerView === "calendar" ? /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-3 p-4", children: [
|
|
6327
|
+
/* @__PURE__ */ jsx7(
|
|
5836
6328
|
Button,
|
|
5837
6329
|
{
|
|
5838
6330
|
variant: "tertiary",
|
|
5839
6331
|
size: "small",
|
|
5840
6332
|
className: "w-fit px-0",
|
|
5841
|
-
prefix: /* @__PURE__ */
|
|
6333
|
+
prefix: /* @__PURE__ */ jsx7(
|
|
5842
6334
|
Icon,
|
|
5843
6335
|
{
|
|
5844
6336
|
name: "chevron-left",
|
|
@@ -5851,7 +6343,7 @@ var PlaceOrder = ({
|
|
|
5851
6343
|
children: tradingLabels.expirationOptions
|
|
5852
6344
|
}
|
|
5853
6345
|
),
|
|
5854
|
-
/* @__PURE__ */
|
|
6346
|
+
/* @__PURE__ */ jsx7(
|
|
5855
6347
|
Calendar,
|
|
5856
6348
|
{
|
|
5857
6349
|
mode: "single",
|
|
@@ -5866,9 +6358,9 @@ var PlaceOrder = ({
|
|
|
5866
6358
|
}
|
|
5867
6359
|
}
|
|
5868
6360
|
),
|
|
5869
|
-
/* @__PURE__ */
|
|
5870
|
-
/* @__PURE__ */
|
|
5871
|
-
/* @__PURE__ */
|
|
6361
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-4", children: [
|
|
6362
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex shrink-0 flex-col gap-0.5", children: [
|
|
6363
|
+
/* @__PURE__ */ jsx7(
|
|
5872
6364
|
"label",
|
|
5873
6365
|
{
|
|
5874
6366
|
htmlFor: expirationTimeInputId,
|
|
@@ -5876,9 +6368,9 @@ var PlaceOrder = ({
|
|
|
5876
6368
|
children: tradingLabels.expirationStartTime
|
|
5877
6369
|
}
|
|
5878
6370
|
),
|
|
5879
|
-
/* @__PURE__ */
|
|
6371
|
+
/* @__PURE__ */ jsx7("span", { className: "text-agg-xs leading-agg-4 text-agg-foreground", children: tradingLabels.expirationStartTimeHint })
|
|
5880
6372
|
] }),
|
|
5881
|
-
/* @__PURE__ */
|
|
6373
|
+
/* @__PURE__ */ jsx7(
|
|
5882
6374
|
"input",
|
|
5883
6375
|
{
|
|
5884
6376
|
id: expirationTimeInputId,
|
|
@@ -5889,8 +6381,8 @@ var PlaceOrder = ({
|
|
|
5889
6381
|
}
|
|
5890
6382
|
)
|
|
5891
6383
|
] }),
|
|
5892
|
-
/* @__PURE__ */
|
|
5893
|
-
/* @__PURE__ */
|
|
6384
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex gap-2", children: [
|
|
6385
|
+
/* @__PURE__ */ jsx7(
|
|
5894
6386
|
Button,
|
|
5895
6387
|
{
|
|
5896
6388
|
variant: "secondary",
|
|
@@ -5900,13 +6392,13 @@ var PlaceOrder = ({
|
|
|
5900
6392
|
children: tradingLabels.expirationCancel
|
|
5901
6393
|
}
|
|
5902
6394
|
),
|
|
5903
|
-
/* @__PURE__ */
|
|
6395
|
+
/* @__PURE__ */ jsx7(
|
|
5904
6396
|
Button,
|
|
5905
6397
|
{
|
|
5906
6398
|
size: "small",
|
|
5907
6399
|
className: "min-w-0 flex-1",
|
|
5908
6400
|
disabled: !isLimitExpirationDraftValid,
|
|
5909
|
-
prefix: /* @__PURE__ */
|
|
6401
|
+
prefix: /* @__PURE__ */ jsx7(
|
|
5910
6402
|
Icon,
|
|
5911
6403
|
{
|
|
5912
6404
|
name: "success-check",
|
|
@@ -5920,7 +6412,7 @@ var PlaceOrder = ({
|
|
|
5920
6412
|
}
|
|
5921
6413
|
)
|
|
5922
6414
|
] })
|
|
5923
|
-
] }) : /* @__PURE__ */
|
|
6415
|
+
] }) : /* @__PURE__ */ jsx7(
|
|
5924
6416
|
"div",
|
|
5925
6417
|
{
|
|
5926
6418
|
role: "radiogroup",
|
|
@@ -5938,7 +6430,7 @@ var PlaceOrder = ({
|
|
|
5938
6430
|
{ value: "ONE_HOUR", label: tradingLabels.expirationOneHour },
|
|
5939
6431
|
{ value: "END_OF_DAY", label: tradingLabels.expirationEndOfDay },
|
|
5940
6432
|
{ value: "CUSTOM", label: tradingLabels.expirationCustom }
|
|
5941
|
-
].map((item, optionIndex) => /* @__PURE__ */
|
|
6433
|
+
].map((item, optionIndex) => /* @__PURE__ */ jsxs6(
|
|
5942
6434
|
"button",
|
|
5943
6435
|
{
|
|
5944
6436
|
ref: (element) => {
|
|
@@ -5955,14 +6447,14 @@ var PlaceOrder = ({
|
|
|
5955
6447
|
onClick: () => handleLimitExpirationTypeChange(item.value),
|
|
5956
6448
|
onKeyDown: (event) => handleLimitExpirationOptionKeyDown(event, optionIndex),
|
|
5957
6449
|
children: [
|
|
5958
|
-
limitExpirationType === item.value ? /* @__PURE__ */
|
|
6450
|
+
limitExpirationType === item.value ? /* @__PURE__ */ jsx7(
|
|
5959
6451
|
"span",
|
|
5960
6452
|
{
|
|
5961
6453
|
className: "absolute bottom-2 left-0 top-2 w-1 bg-agg-primary",
|
|
5962
6454
|
"aria-hidden": true
|
|
5963
6455
|
}
|
|
5964
6456
|
) : null,
|
|
5965
|
-
/* @__PURE__ */
|
|
6457
|
+
/* @__PURE__ */ jsx7("span", { className: "truncate", children: item.label })
|
|
5966
6458
|
]
|
|
5967
6459
|
},
|
|
5968
6460
|
item.value
|
|
@@ -5977,12 +6469,12 @@ var PlaceOrder = ({
|
|
|
5977
6469
|
}
|
|
5978
6470
|
)
|
|
5979
6471
|
] }) : null,
|
|
5980
|
-
hasEnteredAmount && (isLimitOrder ? limitOrderPayload : selectedRouteCard) && !isQuoteLoading && !isBelowMinimum && orderEligibility.canPlaceOrder ? /* @__PURE__ */
|
|
5981
|
-
/* @__PURE__ */
|
|
5982
|
-
/* @__PURE__ */
|
|
5983
|
-
/* @__PURE__ */
|
|
6472
|
+
hasEnteredAmount && (isLimitOrder ? limitOrderPayload : selectedRouteCard) && !isQuoteLoading && !isBelowMinimum && orderEligibility.canPlaceOrder ? /* @__PURE__ */ jsxs6("div", { className: "agg-order-summary flex items-start justify-between gap-4", children: [
|
|
6473
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-order-summary-meta flex flex-col", children: [
|
|
6474
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-order-summary-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.toWin(internalTab) }),
|
|
6475
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-order-summary-hint text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isLimitOrder ? displayedLimitToWinHint : displayedToWinHint })
|
|
5984
6476
|
] }),
|
|
5985
|
-
/* @__PURE__ */
|
|
6477
|
+
/* @__PURE__ */ jsx7(
|
|
5986
6478
|
NumberFlow,
|
|
5987
6479
|
{
|
|
5988
6480
|
value: isLimitOrder ? displayedLimitToWinValue : displayedToWinValue,
|
|
@@ -5997,7 +6489,7 @@ var PlaceOrder = ({
|
|
|
5997
6489
|
}
|
|
5998
6490
|
)
|
|
5999
6491
|
] }) : null,
|
|
6000
|
-
/* @__PURE__ */
|
|
6492
|
+
/* @__PURE__ */ jsxs6(
|
|
6001
6493
|
"div",
|
|
6002
6494
|
{
|
|
6003
6495
|
className: cn(
|
|
@@ -6005,17 +6497,17 @@ var PlaceOrder = ({
|
|
|
6005
6497
|
classNames == null ? void 0 : classNames.footer
|
|
6006
6498
|
),
|
|
6007
6499
|
children: [
|
|
6008
|
-
!shouldShowGeoBlockBanner ? /* @__PURE__ */
|
|
6009
|
-
submissionFeedback ? /* @__PURE__ */
|
|
6500
|
+
!shouldShowGeoBlockBanner ? /* @__PURE__ */ jsxs6("div", { className: "agg-order-alerts flex flex-col gap-3 empty:hidden mb-3", children: [
|
|
6501
|
+
submissionFeedback ? /* @__PURE__ */ jsx7(
|
|
6010
6502
|
InlineAlert,
|
|
6011
6503
|
{
|
|
6012
6504
|
tone: submissionFeedback.tone,
|
|
6013
6505
|
message: submissionFeedback.message
|
|
6014
6506
|
}
|
|
6015
6507
|
) : null,
|
|
6016
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && isBelowMinimum ? /* @__PURE__ */
|
|
6017
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && quoteStatus ? /* @__PURE__ */
|
|
6018
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && !quoteStatus && hasEnteredAmount && smartRouteErrorMessage ? /* @__PURE__ */
|
|
6508
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && isBelowMinimum ? /* @__PURE__ */ jsx7(InlineAlert, { tone: "error", message: belowMinimumMessage }) : null,
|
|
6509
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && quoteStatus ? /* @__PURE__ */ jsx7(InlineAlert, { tone: quoteStatus.tone, message: quoteStatus.message }) : null,
|
|
6510
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && !quoteStatus && hasEnteredAmount && smartRouteErrorMessage ? /* @__PURE__ */ jsx7(
|
|
6019
6511
|
InlineAlert,
|
|
6020
6512
|
{
|
|
6021
6513
|
tone: "error",
|
|
@@ -6027,14 +6519,14 @@ var PlaceOrder = ({
|
|
|
6027
6519
|
}
|
|
6028
6520
|
) : null
|
|
6029
6521
|
] }) : null,
|
|
6030
|
-
!submissionFeedback && !shouldShowGeoBlockBanner && orderEligibility.canPlaceOrder && !needsKalshiConnection && shouldShowInsufficientBalanceAlert ? /* @__PURE__ */
|
|
6522
|
+
!submissionFeedback && !shouldShowGeoBlockBanner && orderEligibility.canPlaceOrder && !needsKalshiConnection && shouldShowInsufficientBalanceAlert ? /* @__PURE__ */ jsxs6(
|
|
6031
6523
|
"div",
|
|
6032
6524
|
{
|
|
6033
6525
|
className: "agg-order-insufficient-balance-alert flex items-center justify-center gap-2",
|
|
6034
6526
|
role: "status",
|
|
6035
6527
|
"aria-live": "polite",
|
|
6036
6528
|
children: [
|
|
6037
|
-
/* @__PURE__ */
|
|
6529
|
+
/* @__PURE__ */ jsx7(
|
|
6038
6530
|
Icon,
|
|
6039
6531
|
{
|
|
6040
6532
|
name: "warning-filled",
|
|
@@ -6043,11 +6535,24 @@ var PlaceOrder = ({
|
|
|
6043
6535
|
"aria-hidden": "true"
|
|
6044
6536
|
}
|
|
6045
6537
|
),
|
|
6046
|
-
/* @__PURE__ */
|
|
6538
|
+
/* @__PURE__ */ jsx7("span", { className: "text-agg-sm text-agg-foreground", children: tradingLabels.insufficientBalance }),
|
|
6539
|
+
insufficientBalanceDetails ? /* @__PURE__ */ jsx7(
|
|
6540
|
+
Tooltip,
|
|
6541
|
+
{
|
|
6542
|
+
"aria-label": tradingLabels.insufficientBalanceDetails,
|
|
6543
|
+
content: insufficientBalanceDetails,
|
|
6544
|
+
side: "top",
|
|
6545
|
+
sideOffset: 4,
|
|
6546
|
+
classNames: {
|
|
6547
|
+
icon: "h-3 w-3 text-agg-muted-foreground",
|
|
6548
|
+
trigger: "h-4 w-4 shrink-0 text-agg-muted-foreground"
|
|
6549
|
+
}
|
|
6550
|
+
}
|
|
6551
|
+
) : null
|
|
6047
6552
|
]
|
|
6048
6553
|
}
|
|
6049
6554
|
) : null,
|
|
6050
|
-
!submissionFeedback && !shouldShowGeoBlockBanner && needsKalshiConnection ? /* @__PURE__ */
|
|
6555
|
+
!submissionFeedback && !shouldShowGeoBlockBanner && needsKalshiConnection ? /* @__PURE__ */ jsx7(
|
|
6051
6556
|
Button,
|
|
6052
6557
|
{
|
|
6053
6558
|
size: "large",
|
|
@@ -6057,7 +6562,7 @@ var PlaceOrder = ({
|
|
|
6057
6562
|
onClick: () => setIsConnectKalshiModalOpen(true),
|
|
6058
6563
|
children: tradingLabels.connectKalshi
|
|
6059
6564
|
}
|
|
6060
|
-
) : needsKycVerification && !submissionFeedback && !shouldShowGeoBlockBanner ? /* @__PURE__ */
|
|
6565
|
+
) : needsKycVerification && !submissionFeedback && !shouldShowGeoBlockBanner ? /* @__PURE__ */ jsx7(
|
|
6061
6566
|
Button,
|
|
6062
6567
|
{
|
|
6063
6568
|
size: "large",
|
|
@@ -6067,7 +6572,7 @@ var PlaceOrder = ({
|
|
|
6067
6572
|
onClick: () => setIsConnectKalshiModalOpen(true),
|
|
6068
6573
|
children: verifyKalshiConnectionLabel
|
|
6069
6574
|
}
|
|
6070
|
-
) : !submissionFeedback && !shouldShowGeoBlockBanner && isInsufficientBalance ? /* @__PURE__ */
|
|
6575
|
+
) : !submissionFeedback && !shouldShowGeoBlockBanner && isInsufficientBalance ? /* @__PURE__ */ jsx7(
|
|
6071
6576
|
Button,
|
|
6072
6577
|
{
|
|
6073
6578
|
size: "large",
|
|
@@ -6077,7 +6582,7 @@ var PlaceOrder = ({
|
|
|
6077
6582
|
onClick: handleDepositRequiredClick,
|
|
6078
6583
|
children: isKalshiBalanceInsufficient ? tradingLabels.addFundsToKalshi : tradingLabels.deposit
|
|
6079
6584
|
}
|
|
6080
|
-
) : isQuoteLoading && !isActionLoading ? /* @__PURE__ */
|
|
6585
|
+
) : isQuoteLoading && !isActionLoading ? /* @__PURE__ */ jsx7(
|
|
6081
6586
|
Button,
|
|
6082
6587
|
{
|
|
6083
6588
|
size: "large",
|
|
@@ -6086,7 +6591,7 @@ var PlaceOrder = ({
|
|
|
6086
6591
|
disabled: true,
|
|
6087
6592
|
"aria-live": "polite",
|
|
6088
6593
|
"aria-label": routeLoadingMessage != null ? routeLoadingMessage : labels.common.loading,
|
|
6089
|
-
prefix: /* @__PURE__ */
|
|
6594
|
+
prefix: /* @__PURE__ */ jsx7(
|
|
6090
6595
|
"span",
|
|
6091
6596
|
{
|
|
6092
6597
|
className: cn(
|
|
@@ -6098,7 +6603,7 @@ var PlaceOrder = ({
|
|
|
6098
6603
|
),
|
|
6099
6604
|
children: routeLoadingMessage
|
|
6100
6605
|
}
|
|
6101
|
-
) : !isAuthenticated ? /* @__PURE__ */
|
|
6606
|
+
) : !isAuthenticated ? /* @__PURE__ */ jsx7(
|
|
6102
6607
|
Button,
|
|
6103
6608
|
{
|
|
6104
6609
|
size: "large",
|
|
@@ -6109,7 +6614,7 @@ var PlaceOrder = ({
|
|
|
6109
6614
|
onClick: requestAggAuthChooserOpen,
|
|
6110
6615
|
children: tradingLabels.signInToTrade
|
|
6111
6616
|
}
|
|
6112
|
-
) : /* @__PURE__ */
|
|
6617
|
+
) : /* @__PURE__ */ jsx7(
|
|
6113
6618
|
Button,
|
|
6114
6619
|
{
|
|
6115
6620
|
size: "large",
|
|
@@ -6124,27 +6629,17 @@ var PlaceOrder = ({
|
|
|
6124
6629
|
children: actionLabel
|
|
6125
6630
|
}
|
|
6126
6631
|
),
|
|
6127
|
-
shouldShowLowLiquidityWarning ? /* @__PURE__ */
|
|
6128
|
-
|
|
6632
|
+
shouldShowLowLiquidityWarning ? /* @__PURE__ */ jsx7(
|
|
6633
|
+
InlineAlert,
|
|
6129
6634
|
{
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
Icon,
|
|
6135
|
-
{
|
|
6136
|
-
name: "warning-filled",
|
|
6137
|
-
size: "small",
|
|
6138
|
-
className: "h-4! w-4! shrink-0 text-agg-warning",
|
|
6139
|
-
"aria-hidden": "true"
|
|
6140
|
-
}
|
|
6141
|
-
),
|
|
6142
|
-
/* @__PURE__ */ jsx6("p", { className: "min-w-0 flex-1 wrap-break-word text-agg-sm leading-agg-5 text-agg-foreground", children: tradingLabels.lowLiquidityWarning })
|
|
6143
|
-
]
|
|
6635
|
+
tone: "warning",
|
|
6636
|
+
variant: "surface",
|
|
6637
|
+
className: "agg-order-low-liquidity-warning justify-start! border-0! bg-agg-warning/10! py-2!",
|
|
6638
|
+
message: internalTab === "buy" ? tradingLabels.lowLiquidityWarning : tradingLabels.lowLiquiditySellWarning
|
|
6144
6639
|
}
|
|
6145
6640
|
) : null,
|
|
6146
|
-
!shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown ? /* @__PURE__ */
|
|
6147
|
-
/* @__PURE__ */
|
|
6641
|
+
!shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown ? /* @__PURE__ */ jsxs6("div", { className: "agg-order-platform-fee mt-1 flex items-center justify-center gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
|
|
6642
|
+
/* @__PURE__ */ jsx7(
|
|
6148
6643
|
Icon,
|
|
6149
6644
|
{
|
|
6150
6645
|
name: "shield-trust",
|
|
@@ -6153,10 +6648,10 @@ var PlaceOrder = ({
|
|
|
6153
6648
|
"aria-hidden": "true"
|
|
6154
6649
|
}
|
|
6155
6650
|
),
|
|
6156
|
-
/* @__PURE__ */
|
|
6651
|
+
/* @__PURE__ */ jsx7(Typography, { variant: "text-xs-caps", className: "text-agg-primary", children: tradingLabels.platformFee })
|
|
6157
6652
|
] }) : null,
|
|
6158
|
-
shouldShowGeoBlockBanner ? /* @__PURE__ */
|
|
6159
|
-
!shouldShowGeoBlockBanner ? /* @__PURE__ */
|
|
6653
|
+
shouldShowGeoBlockBanner ? /* @__PURE__ */ jsx7(GeoBlockBanner, { termsUrl: AGG_TERMS_OF_SERVICE_URL }) : null,
|
|
6654
|
+
!shouldShowGeoBlockBanner ? /* @__PURE__ */ jsx7("p", { className: "agg-order-disclaimer text-center text-agg-xs leading-agg-4 text-agg-muted-foreground", children: tradingLabels.disclaimer }) : null
|
|
6160
6655
|
]
|
|
6161
6656
|
}
|
|
6162
6657
|
)
|
|
@@ -6164,7 +6659,7 @@ var PlaceOrder = ({
|
|
|
6164
6659
|
]
|
|
6165
6660
|
}
|
|
6166
6661
|
),
|
|
6167
|
-
/* @__PURE__ */
|
|
6662
|
+
/* @__PURE__ */ jsx7(
|
|
6168
6663
|
ConnectKalshiModal,
|
|
6169
6664
|
{
|
|
6170
6665
|
open: isConnectKalshiModalOpen,
|
|
@@ -6172,7 +6667,7 @@ var PlaceOrder = ({
|
|
|
6172
6667
|
onVerify: handleVerifyKalshi
|
|
6173
6668
|
}
|
|
6174
6669
|
),
|
|
6175
|
-
/* @__PURE__ */
|
|
6670
|
+
/* @__PURE__ */ jsx7(FundKalshiModal, { open: isFundKalshiModalOpen, onOpenChange: setIsFundKalshiModalOpen })
|
|
6176
6671
|
] });
|
|
6177
6672
|
};
|
|
6178
6673
|
PlaceOrder.displayName = "PlaceOrder";
|
|
@@ -6188,7 +6683,7 @@ import {
|
|
|
6188
6683
|
useRedeem,
|
|
6189
6684
|
useRedeemLifecycles
|
|
6190
6685
|
} from "@agg-build/hooks";
|
|
6191
|
-
import { useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo2, useRef as useRef3, useState as
|
|
6686
|
+
import { useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo2, useRef as useRef3, useState as useState2 } from "react";
|
|
6192
6687
|
var toClaimError = (err) => {
|
|
6193
6688
|
if (err instanceof Error) return err;
|
|
6194
6689
|
return new Error(String(err));
|
|
@@ -6200,11 +6695,11 @@ function useClaimWinnings(options = {}) {
|
|
|
6200
6695
|
const toastCtx = useOptionalToast();
|
|
6201
6696
|
const queryClient = useQueryClient2();
|
|
6202
6697
|
const redeemMutation = useRedeem();
|
|
6203
|
-
const [activeRedeems, setActiveRedeems] =
|
|
6698
|
+
const [activeRedeems, setActiveRedeems] = useState2({});
|
|
6204
6699
|
const activeClaimKeysRef = useRef3(/* @__PURE__ */ new Set());
|
|
6205
6700
|
const pendingClaimToastIdsRef = useRef3({});
|
|
6206
6701
|
const submittedClaimToastKeysRef = useRef3(/* @__PURE__ */ new Set());
|
|
6207
|
-
const [submittingClaimKeys, setSubmittingClaimKeys] =
|
|
6702
|
+
const [submittingClaimKeys, setSubmittingClaimKeys] = useState2({});
|
|
6208
6703
|
const lifecycleInputs = useMemo2(
|
|
6209
6704
|
() => Object.values(activeRedeems),
|
|
6210
6705
|
[activeRedeems]
|
|
@@ -6510,6 +7005,10 @@ export {
|
|
|
6510
7005
|
requestAggDepositModalOpen,
|
|
6511
7006
|
requestAggWithdrawModalOpen,
|
|
6512
7007
|
FundKalshiModal,
|
|
7008
|
+
formatChainIdLabel,
|
|
7009
|
+
PlaceOrderExecutionHeader,
|
|
7010
|
+
PlaceOrderExecutionGroups,
|
|
7011
|
+
PlaceOrderExecutionView,
|
|
6513
7012
|
PlaceOrderFailureView,
|
|
6514
7013
|
PlaceOrderSuccessView,
|
|
6515
7014
|
PlaceOrder,
|