@agg-build/ui 4.0.0 → 4.4.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/README.md +21 -16
- package/dist/{chunk-XIDQ2A6W.mjs → chunk-64BBTXFE.mjs} +1639 -909
- package/dist/{chunk-VR5ZRDQT.mjs → chunk-6STRIKUA.mjs} +1 -1
- package/dist/{chunk-KX3TQ7WC.mjs → chunk-734VTGCV.mjs} +1 -1
- package/dist/{chunk-KO6VTRV6.mjs → chunk-N7UPPT5J.mjs} +336 -232
- package/dist/{chunk-JTSLZARU.mjs → chunk-UCU2XCV5.mjs} +2 -2
- package/dist/{chunk-MKU5Q6PN.mjs → chunk-V5CRUO6S.mjs} +653 -379
- package/dist/{chunk-R362GNI2.mjs → chunk-WW5QKNIM.mjs} +278 -146
- package/dist/events.js +1241 -754
- package/dist/events.mjs +6 -4
- package/dist/index.js +4919 -3694
- package/dist/index.mjs +20 -8
- package/dist/modals.js +1321 -1260
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +4271 -3054
- package/dist/pages.mjs +10 -6
- package/dist/primitives.js +346 -265
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +2281 -1499
- package/dist/trading.mjs +10 -4
- package/dist/types/events/index.d.mts +1 -0
- package/dist/types/events/index.d.ts +1 -0
- package/dist/types/events/item-details/event-list-item-details-market-selector.d.mts +4 -1
- package/dist/types/events/item-details/event-list-item-details-market-selector.d.ts +4 -1
- package/dist/types/events/item-details/event-list-item-details.types.d.mts +25 -1
- package/dist/types/events/item-details/event-list-item-details.types.d.ts +25 -1
- package/dist/types/events/item-details/index.d.mts +1 -1
- package/dist/types/events/item-details/index.d.ts +1 -1
- package/dist/types/events/market-details/index.d.mts +1 -1
- package/dist/types/events/market-details/index.d.ts +1 -1
- package/dist/types/events/market-details/market-details.types.d.mts +4 -0
- package/dist/types/events/market-details/market-details.types.d.ts +4 -0
- package/dist/types/events/shared/format-event-title.d.mts +9 -1
- package/dist/types/events/shared/format-event-title.d.ts +9 -1
- package/dist/types/events/shared/format-sports-event-time.d.mts +2 -0
- package/dist/types/events/shared/format-sports-event-time.d.ts +2 -0
- package/dist/types/events/shared/sports-live-score.d.mts +10 -0
- package/dist/types/events/shared/sports-live-score.d.ts +10 -0
- package/dist/types/pages/event-market/event-market.types.d.mts +4 -0
- package/dist/types/pages/event-market/event-market.types.d.ts +4 -0
- package/dist/types/pages/event-market/index.d.mts +1 -0
- package/dist/types/pages/event-market/index.d.ts +1 -0
- package/dist/types/pages/user-profile/components/available-balance-card.d.mts +5 -0
- package/dist/types/pages/user-profile/components/available-balance-card.d.ts +5 -0
- package/dist/types/pages/user-profile/components/open-order-row.d.mts +1 -0
- package/dist/types/pages/user-profile/components/open-order-row.d.ts +1 -0
- package/dist/types/pages/user-profile/components/positions-activity.d.mts +1 -1
- package/dist/types/pages/user-profile/components/positions-activity.d.ts +1 -1
- 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/pages/user-profile/user-profile.types.d.mts +1 -1
- package/dist/types/pages/user-profile/user-profile.types.d.ts +1 -1
- 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 +4 -1
- package/dist/types/trading/place-order/index.d.ts +4 -1
- package/dist/types/trading/place-order/index.place-order.execution-steps.d.mts +38 -73
- package/dist/types/trading/place-order/index.place-order.execution-steps.d.ts +38 -73
- package/dist/types/trading/place-order/index.place-order.execution-view.d.mts +26 -0
- package/dist/types/trading/place-order/index.place-order.execution-view.d.ts +26 -0
- package/dist/types/trading/place-order/index.place-order.types.d.mts +15 -0
- package/dist/types/trading/place-order/index.place-order.types.d.ts +15 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +14 -1
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +14 -1
- package/package.json +3 -3
- /package/dist/{chunk-KHHFHXXD.mjs → chunk-JH4B3ZHQ.mjs} +0 -0
|
@@ -9,12 +9,12 @@ import {
|
|
|
9
9
|
getTradingVenueLabel,
|
|
10
10
|
prepareSettlementDifferences,
|
|
11
11
|
resolveOrderEligibilityMessage
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6STRIKUA.mjs";
|
|
13
13
|
import {
|
|
14
14
|
ConnectKalshiModal,
|
|
15
15
|
GeoBlockBanner,
|
|
16
16
|
subscribeAggDepositNotification
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-734VTGCV.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-N7UPPT5J.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);
|
|
@@ -2119,18 +1994,15 @@ var resolvePlaceOrderFailureActions = ({
|
|
|
2119
1994
|
canRetryRemaining = true,
|
|
2120
1995
|
kind,
|
|
2121
1996
|
labels,
|
|
2122
|
-
terminalEvent
|
|
1997
|
+
terminalEvent: _terminalEvent
|
|
2123
1998
|
}) => {
|
|
2124
|
-
const parsedVenue = parseVenue(terminalEvent == null ? void 0 : terminalEvent.venue);
|
|
2125
|
-
const venue = parsedVenue.success ? parsedVenue.data : void 0;
|
|
2126
|
-
const venueLabel = getTradingVenueLabel(venue);
|
|
2127
1999
|
if (kind === "partial_fill") {
|
|
2128
2000
|
if (!canRetryRemaining) {
|
|
2129
2001
|
return [
|
|
2130
2002
|
{
|
|
2131
|
-
id: "
|
|
2132
|
-
label: labels.
|
|
2133
|
-
variant: "
|
|
2003
|
+
id: "new-trade",
|
|
2004
|
+
label: labels.orderNewTrade,
|
|
2005
|
+
variant: "dismiss"
|
|
2134
2006
|
}
|
|
2135
2007
|
];
|
|
2136
2008
|
}
|
|
@@ -2141,9 +2013,9 @@ var resolvePlaceOrderFailureActions = ({
|
|
|
2141
2013
|
variant: "retry"
|
|
2142
2014
|
},
|
|
2143
2015
|
{
|
|
2144
|
-
id: "
|
|
2145
|
-
label: labels.
|
|
2146
|
-
variant: "
|
|
2016
|
+
id: "new-trade",
|
|
2017
|
+
label: labels.orderNewTrade,
|
|
2018
|
+
variant: "dismiss"
|
|
2147
2019
|
}
|
|
2148
2020
|
];
|
|
2149
2021
|
}
|
|
@@ -2151,12 +2023,12 @@ var resolvePlaceOrderFailureActions = ({
|
|
|
2151
2023
|
return [
|
|
2152
2024
|
{
|
|
2153
2025
|
id: "retry",
|
|
2154
|
-
label: labels.
|
|
2026
|
+
label: labels.orderRetry,
|
|
2155
2027
|
variant: "retry"
|
|
2156
2028
|
},
|
|
2157
2029
|
{
|
|
2158
|
-
id: "
|
|
2159
|
-
label: labels.
|
|
2030
|
+
id: "close",
|
|
2031
|
+
label: labels.orderClose,
|
|
2160
2032
|
variant: "dismiss"
|
|
2161
2033
|
}
|
|
2162
2034
|
];
|
|
@@ -2177,8 +2049,8 @@ var resolvePlaceOrderFailureActions = ({
|
|
|
2177
2049
|
variant: "retry"
|
|
2178
2050
|
},
|
|
2179
2051
|
{
|
|
2180
|
-
id: "
|
|
2181
|
-
label: labels.
|
|
2052
|
+
id: "close",
|
|
2053
|
+
label: labels.orderClose,
|
|
2182
2054
|
variant: "dismiss"
|
|
2183
2055
|
}
|
|
2184
2056
|
];
|
|
@@ -2264,6 +2136,21 @@ var getPlaceOrderUnfilledRemaining = ({
|
|
|
2264
2136
|
}, 0);
|
|
2265
2137
|
return Math.max(0, originalAmount - filled);
|
|
2266
2138
|
};
|
|
2139
|
+
var getCanonicalPlaceOrderUnfilledRemaining = ({
|
|
2140
|
+
originalAmount,
|
|
2141
|
+
tradeSide,
|
|
2142
|
+
terminalOrderEvents
|
|
2143
|
+
}) => {
|
|
2144
|
+
const fillEvents = (terminalOrderEvents != null ? terminalOrderEvents : []).filter(
|
|
2145
|
+
(event) => event.event === "filled" || event.event === "partial_fill"
|
|
2146
|
+
);
|
|
2147
|
+
if (fillEvents.length === 0) return null;
|
|
2148
|
+
const hasCanonicalFillUnits = fillEvents.every(
|
|
2149
|
+
(event) => tradeSide === "buy" ? event.filledAmountRaw != null : event.actualSharesRaw != null
|
|
2150
|
+
);
|
|
2151
|
+
if (!hasCanonicalFillUnits) return null;
|
|
2152
|
+
return getPlaceOrderUnfilledRemaining({ originalAmount, tradeSide, terminalOrderEvents });
|
|
2153
|
+
};
|
|
2267
2154
|
var buildPlaceOrderFailureSummary = ({
|
|
2268
2155
|
actionLabel,
|
|
2269
2156
|
canRetryRemaining,
|
|
@@ -2277,7 +2164,7 @@ var buildPlaceOrderFailureSummary = ({
|
|
|
2277
2164
|
submittedOrders,
|
|
2278
2165
|
terminalOrderEvents
|
|
2279
2166
|
}) => {
|
|
2280
|
-
var _a;
|
|
2167
|
+
var _a, _b;
|
|
2281
2168
|
const normalizedErrorMessage = normalizePlaceOrderErrorMessage({
|
|
2282
2169
|
errorMessage,
|
|
2283
2170
|
fallbackMessage: labels.orderFailed,
|
|
@@ -2323,7 +2210,7 @@ var buildPlaceOrderFailureSummary = ({
|
|
|
2323
2210
|
});
|
|
2324
2211
|
}
|
|
2325
2212
|
const venueSteps = sortedEvents.flatMap((terminalEvent, index) => {
|
|
2326
|
-
var _a2,
|
|
2213
|
+
var _a2, _b2, _c, _d, _e;
|
|
2327
2214
|
const parsedVenue = parseVenue(terminalEvent.venue);
|
|
2328
2215
|
const venue = parsedVenue.success ? parsedVenue.data : void 0;
|
|
2329
2216
|
const venueLabel = getTradingVenueLabel(venue);
|
|
@@ -2331,7 +2218,7 @@ var buildPlaceOrderFailureSummary = ({
|
|
|
2331
2218
|
(candidate) => candidate.orderId === terminalEvent.orderId
|
|
2332
2219
|
);
|
|
2333
2220
|
const fallbackPrice = (_a2 = quoteData == null ? void 0 : quoteData.fills[index]) == null ? void 0 : _a2.avgPrice;
|
|
2334
|
-
const priceLabel = getTradingRoutePriceLabel((_c = (
|
|
2221
|
+
const priceLabel = getTradingRoutePriceLabel((_c = (_b2 = submittedOrder == null ? void 0 : submittedOrder.price) != null ? _b2 : fallbackPrice) != null ? _c : 0);
|
|
2335
2222
|
const filledDollars = parseFilledAmountRawDollars(terminalEvent.filledAmountRaw);
|
|
2336
2223
|
const amountLabel = filledDollars != null ? formatUsd(filledDollars) : null;
|
|
2337
2224
|
const executingStep = {
|
|
@@ -2379,7 +2266,19 @@ var buildPlaceOrderFailureSummary = ({
|
|
|
2379
2266
|
tone: "error"
|
|
2380
2267
|
} : null;
|
|
2381
2268
|
const primaryNonFilledEvent = (_a = sortedEvents.find((e) => e.event !== "filled")) != null ? _a : sortedEvents[0];
|
|
2382
|
-
|
|
2269
|
+
const parsedRetryVenue = primaryNonFilledEvent ? parseVenue(primaryNonFilledEvent.venue) : null;
|
|
2270
|
+
const failedEventMessage = (_b = sortedEvents.find(
|
|
2271
|
+
(event) => {
|
|
2272
|
+
var _a2;
|
|
2273
|
+
return event.event === "failed" && ((_a2 = event.errorReason) == null ? void 0 : _a2.trim());
|
|
2274
|
+
}
|
|
2275
|
+
)) == null ? void 0 : _b.errorReason;
|
|
2276
|
+
const resolvedErrorMessage = failedEventMessage ? normalizePlaceOrderErrorMessage({
|
|
2277
|
+
errorMessage: failedEventMessage,
|
|
2278
|
+
fallbackMessage: labels.orderFailed,
|
|
2279
|
+
labels
|
|
2280
|
+
}) : overallFailureKind === "partial_fill" ? void 0 : normalizedErrorMessage;
|
|
2281
|
+
return __spreadProps(__spreadValues({
|
|
2383
2282
|
actionLabel,
|
|
2384
2283
|
actions: resolvePlaceOrderFailureActions({
|
|
2385
2284
|
canRetryRemaining,
|
|
@@ -2387,13 +2286,14 @@ var buildPlaceOrderFailureSummary = ({
|
|
|
2387
2286
|
labels,
|
|
2388
2287
|
terminalEvent: primaryNonFilledEvent
|
|
2389
2288
|
}),
|
|
2390
|
-
errorMessage:
|
|
2289
|
+
errorMessage: resolvedErrorMessage,
|
|
2391
2290
|
eventImage,
|
|
2392
2291
|
eventSubtitle,
|
|
2393
2292
|
eventTitle,
|
|
2394
|
-
kind: overallFailureKind
|
|
2293
|
+
kind: overallFailureKind
|
|
2294
|
+
}, (parsedRetryVenue == null ? void 0 : parsedRetryVenue.success) ? { retryVenue: parsedRetryVenue.data } : {}), {
|
|
2395
2295
|
steps: [...baseSteps, ...venueSteps, ...fallbackFailureStep ? [fallbackFailureStep] : []]
|
|
2396
|
-
};
|
|
2296
|
+
});
|
|
2397
2297
|
};
|
|
2398
2298
|
var buildPlaceOrderShareText = ({
|
|
2399
2299
|
actionLabel,
|
|
@@ -2471,8 +2371,708 @@ var isPercentageBelowMinimum = (value, minimumValue) => {
|
|
|
2471
2371
|
return parsedValue < minimumValue;
|
|
2472
2372
|
};
|
|
2473
2373
|
|
|
2474
|
-
// src/trading/place-order/index.place-order.
|
|
2374
|
+
// src/trading/place-order/index.place-order.execution-steps.ts
|
|
2375
|
+
var COMPLETED_RAW_STATUSES = /* @__PURE__ */ new Set([
|
|
2376
|
+
"completed",
|
|
2377
|
+
"skipped"
|
|
2378
|
+
]);
|
|
2379
|
+
var normalizeIdentity = (value) => {
|
|
2380
|
+
var _a;
|
|
2381
|
+
return (_a = value == null ? void 0 : value.trim().toLowerCase()) != null ? _a : "";
|
|
2382
|
+
};
|
|
2383
|
+
var formatTokenAmount = (amount) => amount.toLocaleString("en-US", {
|
|
2384
|
+
maximumFractionDigits: 2,
|
|
2385
|
+
minimumFractionDigits: 0
|
|
2386
|
+
});
|
|
2387
|
+
var formatExecutionChainLabel = (chainId) => {
|
|
2388
|
+
const chainLabel = formatChainIdLabel(chainId);
|
|
2389
|
+
return chainLabel === "BNB Chain" ? "BNB" : chainLabel;
|
|
2390
|
+
};
|
|
2391
|
+
var parseRawUsd = (value) => {
|
|
2392
|
+
if (!value) return null;
|
|
2393
|
+
try {
|
|
2394
|
+
const parsed = Number(BigInt(value)) / 1e6;
|
|
2395
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
2396
|
+
} catch (e) {
|
|
2397
|
+
return null;
|
|
2398
|
+
}
|
|
2399
|
+
};
|
|
2400
|
+
var isRawStepStarted = (step) => step.status !== "pending";
|
|
2401
|
+
var areRawStepsComplete = (steps) => steps.length > 0 && steps.every((step) => COMPLETED_RAW_STATUSES.has(step.status));
|
|
2402
|
+
var resolveRawPhaseStatus = ({
|
|
2403
|
+
steps,
|
|
2404
|
+
nextPhaseStarted
|
|
2405
|
+
}) => {
|
|
2406
|
+
if (nextPhaseStarted || areRawStepsComplete(steps)) return "done";
|
|
2407
|
+
if (steps.some(isRawStepStarted)) return "loading";
|
|
2408
|
+
return "not-started";
|
|
2409
|
+
};
|
|
2410
|
+
var isBridgeRawStep = (step) => normalizeIdentity(step.stepType).startsWith("bridge-");
|
|
2411
|
+
var isVenueExecutionRawStep = (step, venueLabel) => {
|
|
2412
|
+
const stepType = normalizeIdentity(step.stepType);
|
|
2413
|
+
const venue = normalizeIdentity(venueLabel).replace(/\s/g, "");
|
|
2414
|
+
return stepType === `buy-${venue}` || stepType === `sell-${venue}` || stepType === `${venue}-finalize`;
|
|
2415
|
+
};
|
|
2416
|
+
var isSetupRawStep = (step, setupCost) => {
|
|
2417
|
+
const stepType = normalizeIdentity(step.stepType);
|
|
2418
|
+
const venue = normalizeIdentity(setupCost.venue).replace(/\s/g, "");
|
|
2419
|
+
if (setupCost.kind === "venueMarketAta") {
|
|
2420
|
+
return stepType.startsWith("ata-") || stepType.startsWith(`${venue}-setup-`);
|
|
2421
|
+
}
|
|
2422
|
+
return stepType.startsWith("approve-") || stepType.startsWith(`${venue}-setup-`);
|
|
2423
|
+
};
|
|
2424
|
+
var findDestinationChainId = ({
|
|
2425
|
+
allocation,
|
|
2426
|
+
bridgeSteps
|
|
2427
|
+
}) => {
|
|
2428
|
+
var _a, _b, _c;
|
|
2429
|
+
const matchingSourceSteps = bridgeSteps.filter(
|
|
2430
|
+
(step) => normalizeIdentity(step.sourceChainId) === normalizeIdentity(allocation.sourceChainId)
|
|
2431
|
+
);
|
|
2432
|
+
const amountMatch = matchingSourceSteps.find(
|
|
2433
|
+
(step) => Math.abs(step.amount - allocation.amount) < 1e-6
|
|
2434
|
+
);
|
|
2435
|
+
return (_c = (_b = amountMatch == null ? void 0 : amountMatch.destChainId) != null ? _b : (_a = matchingSourceSteps[0]) == null ? void 0 : _a.destChainId) != null ? _c : null;
|
|
2436
|
+
};
|
|
2437
|
+
var deriveBridgeDefinitions = ({
|
|
2438
|
+
quoteData,
|
|
2439
|
+
venue,
|
|
2440
|
+
fallbackDestinationChainId
|
|
2441
|
+
}) => {
|
|
2442
|
+
var _a, _b, _c;
|
|
2443
|
+
const bridgeSteps = (_a = quoteData.bridgeSteps) != null ? _a : [];
|
|
2444
|
+
const venueAllocations = ((_b = quoteData.allocations) != null ? _b : []).filter(
|
|
2445
|
+
(allocation) => normalizeIdentity(allocation.venue) === normalizeIdentity(venue)
|
|
2446
|
+
);
|
|
2447
|
+
const allocations = venueAllocations.length > 0 ? venueAllocations : quoteData.fills.length === 1 ? bridgeSteps.map((step) => ({
|
|
2448
|
+
sourceChainId: step.sourceChainId,
|
|
2449
|
+
venue,
|
|
2450
|
+
amount: step.amount
|
|
2451
|
+
})) : [];
|
|
2452
|
+
const definitions = allocations.flatMap((allocation) => {
|
|
2453
|
+
var _a2;
|
|
2454
|
+
const destinationChainId = (_a2 = findDestinationChainId({ allocation, bridgeSteps })) != null ? _a2 : fallbackDestinationChainId;
|
|
2455
|
+
if (!destinationChainId) return [];
|
|
2456
|
+
if (normalizeIdentity(destinationChainId) === normalizeIdentity(allocation.sourceChainId)) {
|
|
2457
|
+
return [];
|
|
2458
|
+
}
|
|
2459
|
+
return [
|
|
2460
|
+
{
|
|
2461
|
+
amount: allocation.amount,
|
|
2462
|
+
destinationChainId,
|
|
2463
|
+
sourceChainId: allocation.sourceChainId
|
|
2464
|
+
}
|
|
2465
|
+
];
|
|
2466
|
+
});
|
|
2467
|
+
const mergedByLane = /* @__PURE__ */ new Map();
|
|
2468
|
+
for (const definition of definitions) {
|
|
2469
|
+
const laneId = `${normalizeIdentity(definition.sourceChainId)}:${normalizeIdentity(definition.destinationChainId)}`;
|
|
2470
|
+
const existing = mergedByLane.get(laneId);
|
|
2471
|
+
mergedByLane.set(laneId, __spreadProps(__spreadValues({}, definition), {
|
|
2472
|
+
amount: definition.amount + ((_c = existing == null ? void 0 : existing.amount) != null ? _c : 0)
|
|
2473
|
+
}));
|
|
2474
|
+
}
|
|
2475
|
+
return Array.from(mergedByLane.values());
|
|
2476
|
+
};
|
|
2477
|
+
var resolveVenueTerminalEvents = ({
|
|
2478
|
+
allGroupCount,
|
|
2479
|
+
terminalOrderEvents,
|
|
2480
|
+
venue
|
|
2481
|
+
}) => {
|
|
2482
|
+
const matchingEvents = terminalOrderEvents.filter(
|
|
2483
|
+
(event) => normalizeIdentity(event.venue) === normalizeIdentity(venue)
|
|
2484
|
+
);
|
|
2485
|
+
if (matchingEvents.length > 0 || allGroupCount !== 1) return matchingEvents;
|
|
2486
|
+
return terminalOrderEvents.filter((event) => !event.venue.trim());
|
|
2487
|
+
};
|
|
2488
|
+
var resolveActualFillPresentation = ({
|
|
2489
|
+
fallbackAmount,
|
|
2490
|
+
fallbackPrice,
|
|
2491
|
+
terminalOrderEvents
|
|
2492
|
+
}) => {
|
|
2493
|
+
const filledEvents = terminalOrderEvents.filter(
|
|
2494
|
+
(event) => event.event === "filled" || event.event === "partial_fill"
|
|
2495
|
+
);
|
|
2496
|
+
if (filledEvents.length === 0) return { amount: fallbackAmount, price: fallbackPrice };
|
|
2497
|
+
const actualAmounts = filledEvents.map((event) => parseRawUsd(event.filledAmountRaw));
|
|
2498
|
+
if (actualAmounts.some((amount2) => amount2 === null)) {
|
|
2499
|
+
return { amount: fallbackAmount, price: fallbackPrice };
|
|
2500
|
+
}
|
|
2501
|
+
const amount = actualAmounts.reduce((total, value) => total + value, 0);
|
|
2502
|
+
const weightedPriceTotal = filledEvents.reduce((total, event, index) => {
|
|
2503
|
+
var _a;
|
|
2504
|
+
const executionPrice = Number(event.executionPriceRaw);
|
|
2505
|
+
const price = Number.isFinite(executionPrice) && executionPrice > 0 ? executionPrice : fallbackPrice;
|
|
2506
|
+
return total + price * ((_a = actualAmounts[index]) != null ? _a : 0);
|
|
2507
|
+
}, 0);
|
|
2508
|
+
return {
|
|
2509
|
+
amount,
|
|
2510
|
+
price: amount > 0 ? weightedPriceTotal / amount : fallbackPrice
|
|
2511
|
+
};
|
|
2512
|
+
};
|
|
2513
|
+
var resolveBackendStepStatus = (status) => {
|
|
2514
|
+
if (status === "completed" || status === "skipped") return "done";
|
|
2515
|
+
if (status === "failed") return "failed";
|
|
2516
|
+
if (status === "in_progress") return "loading";
|
|
2517
|
+
return "not-started";
|
|
2518
|
+
};
|
|
2519
|
+
var resolveOrderFallbackFill = (quoteData, order, orderIndex) => {
|
|
2520
|
+
var _a;
|
|
2521
|
+
return (_a = quoteData.fills[orderIndex]) != null ? _a : quoteData.fills.find((fill) => normalizeIdentity(fill.venue) === normalizeIdentity(order.venue));
|
|
2522
|
+
};
|
|
2523
|
+
var resolveOrderPresentation = ({
|
|
2524
|
+
labels,
|
|
2525
|
+
order,
|
|
2526
|
+
orderIndex,
|
|
2527
|
+
quoteData,
|
|
2528
|
+
tradeSide
|
|
2529
|
+
}) => {
|
|
2530
|
+
var _a, _b;
|
|
2531
|
+
const fallbackFill = resolveOrderFallbackFill(quoteData, order, orderIndex);
|
|
2532
|
+
const parsedVenue = parseVenue(order.venue);
|
|
2533
|
+
const venue = parsedVenue.success ? parsedVenue.data : void 0;
|
|
2534
|
+
const venueLabel = getTradingVenueLabel(venue, venue ? void 0 : order.venue);
|
|
2535
|
+
const quotedPrice = Number(order.quotedPriceRaw);
|
|
2536
|
+
const executionPrice = Number(order.executionPriceRaw);
|
|
2537
|
+
const price = Number.isFinite(executionPrice) && executionPrice > 0 ? executionPrice : Number.isFinite(quotedPrice) && quotedPrice > 0 ? quotedPrice : (_a = fallbackFill == null ? void 0 : fallbackFill.avgPrice) != null ? _a : 0;
|
|
2538
|
+
const quotedShares = parseRawUsd(order.quotedSharesRaw);
|
|
2539
|
+
const actualShares = parseRawUsd(order.actualSharesRaw);
|
|
2540
|
+
const filledAmount = parseRawUsd(order.filledAmountRaw);
|
|
2541
|
+
const fallbackAmount = fallbackFill ? tradeSide === "buy" ? fallbackFill.venueQty * fallbackFill.avgPrice : fallbackFill.venueQty : 0;
|
|
2542
|
+
const amount = tradeSide === "buy" ? filledAmount != null ? filledAmount : quotedShares != null && quotedPrice > 0 ? quotedShares * quotedPrice : fallbackAmount : (_b = actualShares != null ? actualShares : quotedShares) != null ? _b : fallbackAmount;
|
|
2543
|
+
return {
|
|
2544
|
+
venue,
|
|
2545
|
+
venueLabel,
|
|
2546
|
+
priceLabel: price > 0 ? getTradingRoutePriceLabel(price) : "\u2014",
|
|
2547
|
+
amountLabel: tradeSide === "buy" ? formatUsd(amount) : labels.executionShares(formatTokenAmount(amount))
|
|
2548
|
+
};
|
|
2549
|
+
};
|
|
2550
|
+
var resolveBackendStepFallbackLabels = ({
|
|
2551
|
+
amountLabel,
|
|
2552
|
+
labels,
|
|
2553
|
+
priceLabel,
|
|
2554
|
+
step,
|
|
2555
|
+
venueLabel
|
|
2556
|
+
}) => {
|
|
2557
|
+
if (step.kind === "submit") {
|
|
2558
|
+
return {
|
|
2559
|
+
pendingLabel: labels.submittingOrderProgress,
|
|
2560
|
+
completedLabel: labels.executionOrderSubmitted
|
|
2561
|
+
};
|
|
2562
|
+
}
|
|
2563
|
+
if (step.kind === "setup") {
|
|
2564
|
+
return {
|
|
2565
|
+
pendingLabel: labels.settingUpBridge,
|
|
2566
|
+
completedLabel: labels.bridgeSetupComplete
|
|
2567
|
+
};
|
|
2568
|
+
}
|
|
2569
|
+
if (step.kind === "bridge") {
|
|
2570
|
+
if (!step.bridge) {
|
|
2571
|
+
return {
|
|
2572
|
+
pendingLabel: labels.bridgingFundsProgress,
|
|
2573
|
+
completedLabel: labels.bridgeComplete
|
|
2574
|
+
};
|
|
2575
|
+
}
|
|
2576
|
+
const { amount, tokenSymbol, fromChain, toChain } = step.bridge;
|
|
2577
|
+
if (fromChain === toChain) {
|
|
2578
|
+
return {
|
|
2579
|
+
pendingLabel: labels.depositingFunds(amount, tokenSymbol, toChain),
|
|
2580
|
+
completedLabel: labels.fundsDeposited(amount, tokenSymbol, toChain)
|
|
2581
|
+
};
|
|
2582
|
+
}
|
|
2583
|
+
return {
|
|
2584
|
+
pendingLabel: labels.bridgingFunds(amount, fromChain, toChain, tokenSymbol),
|
|
2585
|
+
completedLabel: labels.fundsBridged(amount, fromChain, toChain, tokenSymbol)
|
|
2586
|
+
};
|
|
2587
|
+
}
|
|
2588
|
+
return {
|
|
2589
|
+
pendingLabel: labels.fillingOnVenue(venueLabel),
|
|
2590
|
+
completedLabel: labels.venueFilledAtPriceWithAmount(venueLabel, amountLabel, priceLabel)
|
|
2591
|
+
};
|
|
2592
|
+
};
|
|
2593
|
+
var deriveBackendExecutionOrderGroups = ({
|
|
2594
|
+
executionOrders,
|
|
2595
|
+
executionSteps,
|
|
2596
|
+
forceCompleted,
|
|
2597
|
+
labels,
|
|
2598
|
+
quoteData,
|
|
2599
|
+
tradeSide
|
|
2600
|
+
}) => {
|
|
2601
|
+
const visibleSteps = executionSteps.filter(
|
|
2602
|
+
(step) => step.kind !== "internal"
|
|
2603
|
+
);
|
|
2604
|
+
const realGroups = executionOrders.flatMap((order, orderIndex) => {
|
|
2605
|
+
const presentation = resolveOrderPresentation({
|
|
2606
|
+
labels,
|
|
2607
|
+
order,
|
|
2608
|
+
orderIndex,
|
|
2609
|
+
quoteData,
|
|
2610
|
+
tradeSide
|
|
2611
|
+
});
|
|
2612
|
+
const groupedSteps = /* @__PURE__ */ new Map();
|
|
2613
|
+
for (const step of visibleSteps) {
|
|
2614
|
+
if (!step.orderIds.includes(order.orderId) || groupedSteps.has(step.groupId)) continue;
|
|
2615
|
+
groupedSteps.set(step.groupId, step);
|
|
2616
|
+
}
|
|
2617
|
+
const steps = Array.from(groupedSteps.values()).map((step) => {
|
|
2618
|
+
const fallbackLabels = resolveBackendStepFallbackLabels({
|
|
2619
|
+
amountLabel: presentation.amountLabel,
|
|
2620
|
+
labels,
|
|
2621
|
+
priceLabel: presentation.priceLabel,
|
|
2622
|
+
step,
|
|
2623
|
+
venueLabel: presentation.venueLabel
|
|
2624
|
+
});
|
|
2625
|
+
const usesBackendPendingLabel = step.groupStatus === "pending" || step.groupStatus === "in_progress" || step.groupStatus === "failed";
|
|
2626
|
+
const usesBackendCompletedLabel = step.groupStatus === "completed" || step.groupStatus === "skipped";
|
|
2627
|
+
const isPartialFillStep = step.kind === "fill" && order.event === "partial_fill";
|
|
2628
|
+
const partialFillLabel = labels.orderPartiallyFilledAtPriceWithAmount(
|
|
2629
|
+
presentation.venueLabel,
|
|
2630
|
+
presentation.priceLabel,
|
|
2631
|
+
presentation.amountLabel
|
|
2632
|
+
);
|
|
2633
|
+
return {
|
|
2634
|
+
id: `${order.orderId}:${step.groupId}`,
|
|
2635
|
+
kind: step.kind,
|
|
2636
|
+
pendingLabel: isPartialFillStep ? partialFillLabel : usesBackendPendingLabel ? step.label : fallbackLabels.pendingLabel,
|
|
2637
|
+
completedLabel: isPartialFillStep ? partialFillLabel : usesBackendCompletedLabel ? step.label : fallbackLabels.completedLabel,
|
|
2638
|
+
realStatus: isPartialFillStep ? "warning" : forceCompleted ? "done" : resolveBackendStepStatus(step.groupStatus)
|
|
2639
|
+
};
|
|
2640
|
+
});
|
|
2641
|
+
if (steps.length === 0) return [];
|
|
2642
|
+
return [__spreadProps(__spreadValues({ id: order.orderId }, presentation), { steps })];
|
|
2643
|
+
});
|
|
2644
|
+
const allOrdersTerminal = executionOrders.every((order) => order.event !== null);
|
|
2645
|
+
return deriveSequentialDisplayGroups(realGroups, allOrdersTerminal);
|
|
2646
|
+
};
|
|
2647
|
+
var deriveSequentialDisplayGroups = (groups, revealTerminalOutcomes = false) => {
|
|
2648
|
+
if (revealTerminalOutcomes) {
|
|
2649
|
+
return groups.map((group) => __spreadProps(__spreadValues({}, group), {
|
|
2650
|
+
steps: group.steps.map((_a) => {
|
|
2651
|
+
var _b = _a, { realStatus } = _b, step = __objRest(_b, ["realStatus"]);
|
|
2652
|
+
return __spreadProps(__spreadValues({}, step), { status: realStatus });
|
|
2653
|
+
})
|
|
2654
|
+
}));
|
|
2655
|
+
}
|
|
2656
|
+
let hasUnresolvedPredecessor = false;
|
|
2657
|
+
return groups.map((group) => __spreadProps(__spreadValues({}, group), {
|
|
2658
|
+
steps: group.steps.map((_a) => {
|
|
2659
|
+
var _b = _a, { realStatus } = _b, step = __objRest(_b, ["realStatus"]);
|
|
2660
|
+
if (hasUnresolvedPredecessor) {
|
|
2661
|
+
return __spreadProps(__spreadValues({}, step), { status: "not-started" });
|
|
2662
|
+
}
|
|
2663
|
+
if (realStatus === "done") {
|
|
2664
|
+
return __spreadProps(__spreadValues({}, step), { status: "done" });
|
|
2665
|
+
}
|
|
2666
|
+
hasUnresolvedPredecessor = true;
|
|
2667
|
+
return __spreadProps(__spreadValues({}, step), { status: realStatus });
|
|
2668
|
+
})
|
|
2669
|
+
}));
|
|
2670
|
+
};
|
|
2671
|
+
var deriveExecutionOrderGroups = ({
|
|
2672
|
+
quoteData,
|
|
2673
|
+
labels,
|
|
2674
|
+
tradeSide,
|
|
2675
|
+
hasSubmissionResponse,
|
|
2676
|
+
executionSteps = [],
|
|
2677
|
+
executionOrders = [],
|
|
2678
|
+
rawExecutionSteps = [],
|
|
2679
|
+
terminalOrderEvents = [],
|
|
2680
|
+
forceCompleted = false
|
|
2681
|
+
}) => {
|
|
2682
|
+
const hasAuthoritativeTopology = executionOrders.length > 0 && executionSteps.some(
|
|
2683
|
+
(step) => step.kind !== "internal" && step.kind !== "submit" && step.orderIds.length > 0
|
|
2684
|
+
);
|
|
2685
|
+
if (hasAuthoritativeTopology) {
|
|
2686
|
+
return deriveBackendExecutionOrderGroups({
|
|
2687
|
+
executionOrders,
|
|
2688
|
+
executionSteps,
|
|
2689
|
+
forceCompleted,
|
|
2690
|
+
labels,
|
|
2691
|
+
quoteData,
|
|
2692
|
+
tradeSide
|
|
2693
|
+
});
|
|
2694
|
+
}
|
|
2695
|
+
const bridgeRawSteps = rawExecutionSteps.filter(isBridgeRawStep);
|
|
2696
|
+
const hasBridgeProgress = bridgeRawSteps.some(isRawStepStarted);
|
|
2697
|
+
const realGroups = quoteData.fills.map((fill, fillIndex) => {
|
|
2698
|
+
var _a, _b;
|
|
2699
|
+
const parsedVenue = parseVenue(fill.venue);
|
|
2700
|
+
const venue = parsedVenue.success ? parsedVenue.data : void 0;
|
|
2701
|
+
const venueLabel = getTradingVenueLabel(venue, venue ? void 0 : fill.venue);
|
|
2702
|
+
const bridgeDefinitions = deriveBridgeDefinitions({
|
|
2703
|
+
quoteData,
|
|
2704
|
+
venue: fill.venue,
|
|
2705
|
+
fallbackDestinationChainId: fill.chain
|
|
2706
|
+
});
|
|
2707
|
+
const setupCosts = ((_b = (_a = quoteData.feeBreakdown) == null ? void 0 : _a.setupCosts) != null ? _b : []).filter(
|
|
2708
|
+
(setupCost) => !setupCost.alreadyPaid && normalizeIdentity(setupCost.venue) === normalizeIdentity(fill.venue)
|
|
2709
|
+
);
|
|
2710
|
+
const venueRawSteps = rawExecutionSteps.filter(
|
|
2711
|
+
(step) => isVenueExecutionRawStep(step, fill.venue)
|
|
2712
|
+
);
|
|
2713
|
+
const venueTerminalEvents = resolveVenueTerminalEvents({
|
|
2714
|
+
allGroupCount: quoteData.fills.length,
|
|
2715
|
+
terminalOrderEvents,
|
|
2716
|
+
venue: fill.venue
|
|
2717
|
+
});
|
|
2718
|
+
const hasSuccessfulTerminalEvent = venueTerminalEvents.some(
|
|
2719
|
+
(event) => event.event === "filled" || event.event === "partial_fill"
|
|
2720
|
+
);
|
|
2721
|
+
const hasPartialTerminalEvent = venueTerminalEvents.some(
|
|
2722
|
+
(event) => event.event === "partial_fill"
|
|
2723
|
+
);
|
|
2724
|
+
const hasVenueExecutionProgress = venueRawSteps.some(isRawStepStarted);
|
|
2725
|
+
const quotedAmount = fill.venueQty * fill.avgPrice;
|
|
2726
|
+
const actualFill = resolveActualFillPresentation({
|
|
2727
|
+
fallbackAmount: quotedAmount,
|
|
2728
|
+
fallbackPrice: fill.avgPrice,
|
|
2729
|
+
terminalOrderEvents: venueTerminalEvents
|
|
2730
|
+
});
|
|
2731
|
+
const completedAmountLabel = tradeSide === "buy" ? formatUsd(actualFill.amount) : labels.executionShares(formatTokenAmount(fill.venueQty));
|
|
2732
|
+
const completedPriceLabel = getTradingRoutePriceLabel(actualFill.price);
|
|
2733
|
+
const partialFillLabel = labels.orderPartiallyFilledAtPriceWithAmount(
|
|
2734
|
+
venueLabel,
|
|
2735
|
+
completedPriceLabel,
|
|
2736
|
+
completedAmountLabel
|
|
2737
|
+
);
|
|
2738
|
+
const setupRawSteps = rawExecutionSteps.filter(
|
|
2739
|
+
(step) => setupCosts.some((setupCost) => isSetupRawStep(step, setupCost))
|
|
2740
|
+
);
|
|
2741
|
+
const setupStatus = forceCompleted ? "done" : resolveRawPhaseStatus({
|
|
2742
|
+
steps: setupRawSteps,
|
|
2743
|
+
nextPhaseStarted: hasBridgeProgress || hasVenueExecutionProgress
|
|
2744
|
+
});
|
|
2745
|
+
const bridgeStatus = forceCompleted ? "done" : resolveRawPhaseStatus({
|
|
2746
|
+
steps: bridgeRawSteps,
|
|
2747
|
+
nextPhaseStarted: hasVenueExecutionProgress || hasSuccessfulTerminalEvent
|
|
2748
|
+
});
|
|
2749
|
+
const executionStatus = hasPartialTerminalEvent ? "warning" : forceCompleted || hasSuccessfulTerminalEvent ? "done" : resolveRawPhaseStatus({ steps: venueRawSteps });
|
|
2750
|
+
const groupId = `${normalizeIdentity(fill.venue) || "venue"}-${fillIndex}`;
|
|
2751
|
+
const steps = [
|
|
2752
|
+
{
|
|
2753
|
+
id: `${groupId}-submit`,
|
|
2754
|
+
kind: "submit",
|
|
2755
|
+
pendingLabel: labels.submittingOrderProgress,
|
|
2756
|
+
completedLabel: labels.executionOrderSubmitted,
|
|
2757
|
+
realStatus: forceCompleted || hasSubmissionResponse ? "done" : "loading"
|
|
2758
|
+
},
|
|
2759
|
+
...setupCosts.map((setupCost, setupIndex) => ({
|
|
2760
|
+
id: `${groupId}-setup-${setupIndex}`,
|
|
2761
|
+
kind: "setup",
|
|
2762
|
+
pendingLabel: labels.settingUpBridge,
|
|
2763
|
+
completedLabel: labels.bridgeSetupComplete,
|
|
2764
|
+
realStatus: setupStatus
|
|
2765
|
+
})),
|
|
2766
|
+
...bridgeDefinitions.map((bridge, bridgeIndex) => {
|
|
2767
|
+
const sourceChain = formatExecutionChainLabel(bridge.sourceChainId);
|
|
2768
|
+
const destinationChain = formatExecutionChainLabel(bridge.destinationChainId);
|
|
2769
|
+
const amount = formatTokenAmount(bridge.amount);
|
|
2770
|
+
return {
|
|
2771
|
+
id: `${groupId}-bridge-${bridgeIndex}`,
|
|
2772
|
+
kind: "bridge",
|
|
2773
|
+
pendingLabel: labels.bridgingFunds(amount, sourceChain, destinationChain),
|
|
2774
|
+
completedLabel: labels.fundsBridged(amount, sourceChain, destinationChain),
|
|
2775
|
+
realStatus: bridgeStatus
|
|
2776
|
+
};
|
|
2777
|
+
}),
|
|
2778
|
+
{
|
|
2779
|
+
id: `${groupId}-execute`,
|
|
2780
|
+
kind: "fill",
|
|
2781
|
+
pendingLabel: hasPartialTerminalEvent ? partialFillLabel : labels.fillingOnVenue(venueLabel),
|
|
2782
|
+
completedLabel: hasPartialTerminalEvent ? partialFillLabel : labels.venueFilledAtPriceWithAmount(
|
|
2783
|
+
venueLabel,
|
|
2784
|
+
completedAmountLabel,
|
|
2785
|
+
completedPriceLabel
|
|
2786
|
+
),
|
|
2787
|
+
realStatus: executionStatus
|
|
2788
|
+
}
|
|
2789
|
+
];
|
|
2790
|
+
return {
|
|
2791
|
+
id: groupId,
|
|
2792
|
+
venue,
|
|
2793
|
+
venueLabel,
|
|
2794
|
+
priceLabel: getTradingRoutePriceLabel(fill.avgPrice),
|
|
2795
|
+
amountLabel: tradeSide === "buy" ? formatUsd(quotedAmount) : labels.executionShares(formatTokenAmount(fill.venueQty)),
|
|
2796
|
+
steps
|
|
2797
|
+
};
|
|
2798
|
+
});
|
|
2799
|
+
return deriveSequentialDisplayGroups(
|
|
2800
|
+
realGroups,
|
|
2801
|
+
terminalOrderEvents.length >= quoteData.fills.length && quoteData.fills.length > 0
|
|
2802
|
+
);
|
|
2803
|
+
};
|
|
2804
|
+
var EXECUTION_MILESTONE_WEIGHTS = {
|
|
2805
|
+
submit: 20,
|
|
2806
|
+
setup: 20,
|
|
2807
|
+
bridge: 20,
|
|
2808
|
+
fill: 40
|
|
2809
|
+
};
|
|
2810
|
+
var COMPLETED_MILESTONE_GROUP_STATUSES = /* @__PURE__ */ new Set([
|
|
2811
|
+
"completed",
|
|
2812
|
+
"skipped"
|
|
2813
|
+
]);
|
|
2814
|
+
var TERMINAL_EXECUTION_GROUP_STATUSES = /* @__PURE__ */ new Set([
|
|
2815
|
+
"completed",
|
|
2816
|
+
"failed",
|
|
2817
|
+
"skipped"
|
|
2818
|
+
]);
|
|
2819
|
+
var uniqueGroupsForOrderAndKind = ({
|
|
2820
|
+
kind,
|
|
2821
|
+
orderId,
|
|
2822
|
+
steps
|
|
2823
|
+
}) => {
|
|
2824
|
+
var _a;
|
|
2825
|
+
const groups = /* @__PURE__ */ new Map();
|
|
2826
|
+
for (const step of steps) {
|
|
2827
|
+
if (step.kind !== kind || !((_a = step.orderIds) == null ? void 0 : _a.includes(orderId)) || groups.has(step.groupId))
|
|
2828
|
+
continue;
|
|
2829
|
+
groups.set(step.groupId, step);
|
|
2830
|
+
}
|
|
2831
|
+
return Array.from(groups.values());
|
|
2832
|
+
};
|
|
2833
|
+
var calculateExecutionProgress = ({
|
|
2834
|
+
orderIds,
|
|
2835
|
+
submittedOrderIds = [],
|
|
2836
|
+
executionSteps = [],
|
|
2837
|
+
executionOrders = [],
|
|
2838
|
+
minimumProgress = 0
|
|
2839
|
+
}) => {
|
|
2840
|
+
const resolvedOrderIds = orderIds.length > 0 ? orderIds : executionOrders.map((order) => order.orderId);
|
|
2841
|
+
if (resolvedOrderIds.length === 0) return 0;
|
|
2842
|
+
const submittedIds = new Set(submittedOrderIds);
|
|
2843
|
+
const orderById = new Map(executionOrders.map((order) => [order.orderId, order]));
|
|
2844
|
+
const hasAuthoritativeTopology = executionSteps.some(
|
|
2845
|
+
(step) => {
|
|
2846
|
+
var _a, _b;
|
|
2847
|
+
return step.kind !== "internal" && step.kind !== "submit" && ((_b = (_a = step.orderIds) == null ? void 0 : _a.length) != null ? _b : 0) > 0;
|
|
2848
|
+
}
|
|
2849
|
+
);
|
|
2850
|
+
let progress = 0;
|
|
2851
|
+
for (const orderId of resolvedOrderIds) {
|
|
2852
|
+
const order = orderById.get(orderId);
|
|
2853
|
+
const isOrderTerminal = (order == null ? void 0 : order.event) !== null && (order == null ? void 0 : order.event) !== void 0;
|
|
2854
|
+
const contributionScale = 1 / resolvedOrderIds.length;
|
|
2855
|
+
const submitGroups = uniqueGroupsForOrderAndKind({
|
|
2856
|
+
kind: "submit",
|
|
2857
|
+
orderId,
|
|
2858
|
+
steps: executionSteps
|
|
2859
|
+
});
|
|
2860
|
+
const setupGroups = uniqueGroupsForOrderAndKind({
|
|
2861
|
+
kind: "setup",
|
|
2862
|
+
orderId,
|
|
2863
|
+
steps: executionSteps
|
|
2864
|
+
});
|
|
2865
|
+
const bridgeGroups = uniqueGroupsForOrderAndKind({
|
|
2866
|
+
kind: "bridge",
|
|
2867
|
+
orderId,
|
|
2868
|
+
steps: executionSteps
|
|
2869
|
+
});
|
|
2870
|
+
const fillGroups = uniqueGroupsForOrderAndKind({
|
|
2871
|
+
kind: "fill",
|
|
2872
|
+
orderId,
|
|
2873
|
+
steps: executionSteps
|
|
2874
|
+
});
|
|
2875
|
+
const submissionComplete = isOrderTerminal || submittedIds.has(orderId) || submitGroups.some((step) => COMPLETED_MILESTONE_GROUP_STATUSES.has(step.groupStatus));
|
|
2876
|
+
const fundingComplete = isOrderTerminal || hasAuthoritativeTopology && (setupGroups.length === 0 || setupGroups.every((step) => COMPLETED_MILESTONE_GROUP_STATUSES.has(step.groupStatus)));
|
|
2877
|
+
const bridgingComplete = isOrderTerminal || hasAuthoritativeTopology && (bridgeGroups.length === 0 || bridgeGroups.every((step) => COMPLETED_MILESTONE_GROUP_STATUSES.has(step.groupStatus)));
|
|
2878
|
+
const executionComplete = isOrderTerminal || fillGroups.length > 0 && fillGroups.every((step) => TERMINAL_EXECUTION_GROUP_STATUSES.has(step.groupStatus));
|
|
2879
|
+
if (submissionComplete) progress += EXECUTION_MILESTONE_WEIGHTS.submit * contributionScale;
|
|
2880
|
+
if (fundingComplete) progress += EXECUTION_MILESTONE_WEIGHTS.setup * contributionScale;
|
|
2881
|
+
if (bridgingComplete) progress += EXECUTION_MILESTONE_WEIGHTS.bridge * contributionScale;
|
|
2882
|
+
if (executionComplete) progress += EXECUTION_MILESTONE_WEIGHTS.fill * contributionScale;
|
|
2883
|
+
}
|
|
2884
|
+
return Math.min(100, Math.max(0, minimumProgress, Math.round(progress)));
|
|
2885
|
+
};
|
|
2886
|
+
|
|
2887
|
+
// src/trading/place-order/index.place-order.execution-view.tsx
|
|
2475
2888
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2889
|
+
var PlaceOrderExecutionHeader = ({
|
|
2890
|
+
className,
|
|
2891
|
+
eventDateLabel,
|
|
2892
|
+
eventImage,
|
|
2893
|
+
eventTitle
|
|
2894
|
+
}) => {
|
|
2895
|
+
return /* @__PURE__ */ jsxs3("div", { className: cn("agg-order-execution-header flex flex-col gap-2", className), children: [
|
|
2896
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3", children: [
|
|
2897
|
+
/* @__PURE__ */ jsx4(
|
|
2898
|
+
RemoteImage,
|
|
2899
|
+
{
|
|
2900
|
+
src: eventImage != null ? eventImage : null,
|
|
2901
|
+
alt: "",
|
|
2902
|
+
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
2903
|
+
}
|
|
2904
|
+
),
|
|
2905
|
+
/* @__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 })
|
|
2906
|
+
] }),
|
|
2907
|
+
eventDateLabel ? /* @__PURE__ */ jsx4("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: eventDateLabel }) : null
|
|
2908
|
+
] });
|
|
2909
|
+
};
|
|
2910
|
+
var ExecutionStepIndicator = ({
|
|
2911
|
+
enableAnimations,
|
|
2912
|
+
step
|
|
2913
|
+
}) => {
|
|
2914
|
+
if (step.status === "done") {
|
|
2915
|
+
return /* @__PURE__ */ jsx4(
|
|
2916
|
+
Icon,
|
|
2917
|
+
{
|
|
2918
|
+
name: "check-circle",
|
|
2919
|
+
size: "xs",
|
|
2920
|
+
className: "h-3 w-3 shrink-0 text-agg-primary",
|
|
2921
|
+
"aria-hidden": "true"
|
|
2922
|
+
}
|
|
2923
|
+
);
|
|
2924
|
+
}
|
|
2925
|
+
if (step.status === "loading") {
|
|
2926
|
+
return /* @__PURE__ */ jsx4("span", { className: "inline-flex h-3 w-3 shrink-0 items-center justify-center", "aria-hidden": "true", children: /* @__PURE__ */ jsx4(
|
|
2927
|
+
"span",
|
|
2928
|
+
{
|
|
2929
|
+
className: cn(
|
|
2930
|
+
"h-2.5 w-2.5 rounded-full border-[1.5px] border-agg-primary border-r-transparent",
|
|
2931
|
+
getMotionClassName(enableAnimations, "animate-spin")
|
|
2932
|
+
)
|
|
2933
|
+
}
|
|
2934
|
+
) });
|
|
2935
|
+
}
|
|
2936
|
+
if (step.status === "failed") {
|
|
2937
|
+
return /* @__PURE__ */ jsx4(
|
|
2938
|
+
Icon,
|
|
2939
|
+
{
|
|
2940
|
+
name: "error-filled",
|
|
2941
|
+
size: "xs",
|
|
2942
|
+
className: "h-3 w-3 shrink-0 text-agg-error",
|
|
2943
|
+
"aria-hidden": "true"
|
|
2944
|
+
}
|
|
2945
|
+
);
|
|
2946
|
+
}
|
|
2947
|
+
if (step.status === "warning") {
|
|
2948
|
+
return /* @__PURE__ */ jsx4(
|
|
2949
|
+
Icon,
|
|
2950
|
+
{
|
|
2951
|
+
name: "warning-filled",
|
|
2952
|
+
size: "xs",
|
|
2953
|
+
className: "h-3 w-3 shrink-0 text-agg-warning",
|
|
2954
|
+
"aria-hidden": "true"
|
|
2955
|
+
}
|
|
2956
|
+
);
|
|
2957
|
+
}
|
|
2958
|
+
return /* @__PURE__ */ jsx4(
|
|
2959
|
+
"span",
|
|
2960
|
+
{
|
|
2961
|
+
className: "h-3 w-3 shrink-0 rounded-full border border-dashed border-agg-separator",
|
|
2962
|
+
"aria-hidden": "true"
|
|
2963
|
+
}
|
|
2964
|
+
);
|
|
2965
|
+
};
|
|
2966
|
+
var PlaceOrderExecutionGroups = ({
|
|
2967
|
+
enableAnimations,
|
|
2968
|
+
groups,
|
|
2969
|
+
labels
|
|
2970
|
+
}) => {
|
|
2971
|
+
return /* @__PURE__ */ jsx4("div", { className: "agg-order-execution-groups flex flex-col gap-5", children: groups.map((group) => /* @__PURE__ */ jsxs3(
|
|
2972
|
+
"section",
|
|
2973
|
+
{
|
|
2974
|
+
className: "agg-order-execution-group flex flex-col gap-3",
|
|
2975
|
+
"aria-label": labels.venueOrder(group.venueLabel),
|
|
2976
|
+
children: [
|
|
2977
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex min-h-5 items-center justify-between gap-3 text-agg-sm leading-agg-5", children: [
|
|
2978
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 items-center gap-2 text-agg-foreground", children: [
|
|
2979
|
+
group.venue ? /* @__PURE__ */ jsx4(
|
|
2980
|
+
VenueLogo,
|
|
2981
|
+
{
|
|
2982
|
+
venue: group.venue,
|
|
2983
|
+
size: "small",
|
|
2984
|
+
ariaLabel: group.venueLabel,
|
|
2985
|
+
className: "h-3.5 w-3.5 shrink-0"
|
|
2986
|
+
}
|
|
2987
|
+
) : null,
|
|
2988
|
+
/* @__PURE__ */ jsx4("h3", { className: "truncate font-agg-normal", children: labels.venueOrder(group.venueLabel) })
|
|
2989
|
+
] }),
|
|
2990
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex shrink-0 items-center gap-2", children: [
|
|
2991
|
+
/* @__PURE__ */ jsx4("span", { className: "text-agg-muted-foreground", children: group.priceLabel }),
|
|
2992
|
+
/* @__PURE__ */ jsx4("span", { className: "text-agg-foreground", children: group.amountLabel })
|
|
2993
|
+
] })
|
|
2994
|
+
] }),
|
|
2995
|
+
/* @__PURE__ */ jsx4("div", { className: "flex flex-col gap-3 pl-[22px]", children: group.steps.map((step) => /* @__PURE__ */ jsxs3(
|
|
2996
|
+
"div",
|
|
2997
|
+
{
|
|
2998
|
+
className: "flex items-start gap-2 text-agg-xs leading-agg-4 text-agg-foreground",
|
|
2999
|
+
"data-kind": step.kind,
|
|
3000
|
+
"data-status": step.status,
|
|
3001
|
+
children: [
|
|
3002
|
+
/* @__PURE__ */ jsx4(ExecutionStepIndicator, { enableAnimations, step }),
|
|
3003
|
+
/* @__PURE__ */ jsx4("p", { className: "min-w-0 flex-1", children: step.status === "done" ? step.completedLabel : step.pendingLabel })
|
|
3004
|
+
]
|
|
3005
|
+
},
|
|
3006
|
+
step.id
|
|
3007
|
+
)) })
|
|
3008
|
+
]
|
|
3009
|
+
},
|
|
3010
|
+
group.id
|
|
3011
|
+
)) });
|
|
3012
|
+
};
|
|
3013
|
+
var PlaceOrderExecutionView = ({
|
|
3014
|
+
className,
|
|
3015
|
+
classNames,
|
|
3016
|
+
enableAnimations,
|
|
3017
|
+
eventDateLabel,
|
|
3018
|
+
eventImage,
|
|
3019
|
+
eventTitle,
|
|
3020
|
+
groups,
|
|
3021
|
+
labels,
|
|
3022
|
+
progress
|
|
3023
|
+
}) => {
|
|
3024
|
+
return /* @__PURE__ */ jsx4(
|
|
3025
|
+
Card,
|
|
3026
|
+
{
|
|
3027
|
+
className: cn(
|
|
3028
|
+
"group/agg-order-panel",
|
|
3029
|
+
getPlaceOrderContainerClassName(),
|
|
3030
|
+
classNames == null ? void 0 : classNames.root,
|
|
3031
|
+
className
|
|
3032
|
+
),
|
|
3033
|
+
children: /* @__PURE__ */ jsxs3("div", { className: cn("flex flex-col gap-6 p-5", classNames == null ? void 0 : classNames.body), children: [
|
|
3034
|
+
/* @__PURE__ */ jsx4(
|
|
3035
|
+
PlaceOrderExecutionHeader,
|
|
3036
|
+
{
|
|
3037
|
+
className: classNames == null ? void 0 : classNames.header,
|
|
3038
|
+
eventDateLabel,
|
|
3039
|
+
eventImage,
|
|
3040
|
+
eventTitle
|
|
3041
|
+
}
|
|
3042
|
+
),
|
|
3043
|
+
/* @__PURE__ */ jsxs3("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.content), children: [
|
|
3044
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3", children: [
|
|
3045
|
+
/* @__PURE__ */ jsxs3("p", { className: "shrink-0 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
|
|
3046
|
+
progress,
|
|
3047
|
+
"%"
|
|
3048
|
+
] }),
|
|
3049
|
+
/* @__PURE__ */ jsx4(
|
|
3050
|
+
"progress",
|
|
3051
|
+
{
|
|
3052
|
+
"aria-label": labels.executingOrder,
|
|
3053
|
+
className: "h-1 min-w-0 flex-1 overflow-hidden rounded-agg-full bg-agg-separator text-agg-primary accent-agg-primary [&::-moz-progress-bar]:bg-agg-primary [&::-webkit-progress-bar]:bg-agg-separator [&::-webkit-progress-value]:bg-agg-primary",
|
|
3054
|
+
max: 100,
|
|
3055
|
+
value: progress
|
|
3056
|
+
}
|
|
3057
|
+
)
|
|
3058
|
+
] }),
|
|
3059
|
+
/* @__PURE__ */ jsx4(
|
|
3060
|
+
PlaceOrderExecutionGroups,
|
|
3061
|
+
{
|
|
3062
|
+
enableAnimations,
|
|
3063
|
+
groups,
|
|
3064
|
+
labels
|
|
3065
|
+
}
|
|
3066
|
+
)
|
|
3067
|
+
] })
|
|
3068
|
+
] })
|
|
3069
|
+
}
|
|
3070
|
+
);
|
|
3071
|
+
};
|
|
3072
|
+
PlaceOrderExecutionView.displayName = "PlaceOrderExecutionView";
|
|
3073
|
+
|
|
3074
|
+
// src/trading/place-order/index.place-order.failure.tsx
|
|
3075
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2476
3076
|
var resolveFailureActionHandler = ({
|
|
2477
3077
|
action,
|
|
2478
3078
|
onDone,
|
|
@@ -2485,12 +3085,12 @@ var resolveFailureActionHandler = ({
|
|
|
2485
3085
|
};
|
|
2486
3086
|
var renderPartialFailureStep = (step) => {
|
|
2487
3087
|
const isWarningStep = step.tone === "warning" || step.tone === "error";
|
|
2488
|
-
return /* @__PURE__ */
|
|
3088
|
+
return /* @__PURE__ */ jsxs4(
|
|
2489
3089
|
"div",
|
|
2490
3090
|
{
|
|
2491
3091
|
className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
2492
3092
|
children: [
|
|
2493
|
-
/* @__PURE__ */
|
|
3093
|
+
/* @__PURE__ */ jsx5(
|
|
2494
3094
|
Icon,
|
|
2495
3095
|
{
|
|
2496
3096
|
name: isWarningStep ? "warning-filled" : "check-circle",
|
|
@@ -2499,8 +3099,8 @@ var renderPartialFailureStep = (step) => {
|
|
|
2499
3099
|
"aria-hidden": "true"
|
|
2500
3100
|
}
|
|
2501
3101
|
),
|
|
2502
|
-
/* @__PURE__ */
|
|
2503
|
-
step.venue ? /* @__PURE__ */
|
|
3102
|
+
/* @__PURE__ */ jsx5("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
3103
|
+
step.venue ? /* @__PURE__ */ jsx5(VenueLogo, { venue: step.venue, size: "small", className: "h-4 w-4 shrink-0" }) : null
|
|
2504
3104
|
]
|
|
2505
3105
|
},
|
|
2506
3106
|
step.id
|
|
@@ -2515,14 +3115,14 @@ var PlaceOrderFailureView = ({
|
|
|
2515
3115
|
onDone,
|
|
2516
3116
|
onSkip
|
|
2517
3117
|
}) => {
|
|
2518
|
-
var _a, _b, _c;
|
|
3118
|
+
var _a, _b, _c, _d, _e;
|
|
2519
3119
|
const shouldShowPartialFailureLayout = summary.kind === "partial_fill";
|
|
2520
3120
|
const failureStepGroups = shouldShowPartialFailureLayout ? groupPlaceOrderFailureSteps(summary.steps) : [];
|
|
2521
3121
|
if (shouldShowPartialFailureLayout) {
|
|
2522
|
-
return /* @__PURE__ */
|
|
2523
|
-
/* @__PURE__ */
|
|
2524
|
-
/* @__PURE__ */
|
|
2525
|
-
/* @__PURE__ */
|
|
3122
|
+
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: [
|
|
3123
|
+
/* @__PURE__ */ jsxs4("div", { className: "agg-order-failure-header flex flex-col gap-2", children: [
|
|
3124
|
+
/* @__PURE__ */ jsxs4("div", { className: "agg-order-failure-market flex items-center gap-3", children: [
|
|
3125
|
+
/* @__PURE__ */ jsx5(
|
|
2526
3126
|
RemoteImage,
|
|
2527
3127
|
{
|
|
2528
3128
|
src: (_a = summary.eventImage) != null ? _a : null,
|
|
@@ -2530,18 +3130,46 @@ var PlaceOrderFailureView = ({
|
|
|
2530
3130
|
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
2531
3131
|
}
|
|
2532
3132
|
),
|
|
2533
|
-
/* @__PURE__ */
|
|
3133
|
+
/* @__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
3134
|
] }),
|
|
2535
|
-
summary.eventSubtitle ? /* @__PURE__ */
|
|
3135
|
+
summary.eventSubtitle ? /* @__PURE__ */ jsx5("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
|
|
2536
3136
|
] }),
|
|
2537
|
-
/* @__PURE__ */
|
|
2538
|
-
|
|
3137
|
+
/* @__PURE__ */ jsx5("div", { className: "flex flex-col gap-4", children: ((_b = summary.executionGroups) == null ? void 0 : _b.length) ? /* @__PURE__ */ jsx5(
|
|
3138
|
+
PlaceOrderExecutionGroups,
|
|
3139
|
+
{
|
|
3140
|
+
enableAnimations: false,
|
|
3141
|
+
groups: summary.executionGroups,
|
|
3142
|
+
labels: tradingLabels
|
|
3143
|
+
}
|
|
3144
|
+
) : failureStepGroups.map((group, groupIndex) => /* @__PURE__ */ jsx5("div", { className: "flex flex-col gap-2", children: group.map((step) => renderPartialFailureStep(step)) }, `failure-group-${groupIndex}`)) }),
|
|
3145
|
+
summary.errorMessage ? /* @__PURE__ */ jsx5(
|
|
3146
|
+
InlineAlert,
|
|
3147
|
+
{
|
|
3148
|
+
tone: "error",
|
|
3149
|
+
variant: "surface",
|
|
3150
|
+
message: tradingLabels.orderFailureDescription(summary.errorMessage)
|
|
3151
|
+
}
|
|
3152
|
+
) : null,
|
|
3153
|
+
summary.result ? /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-4", children: [
|
|
3154
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between gap-4", children: [
|
|
3155
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-col", children: [
|
|
3156
|
+
/* @__PURE__ */ jsx5("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.orderPartiallyFilled }),
|
|
3157
|
+
/* @__PURE__ */ jsx5("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: tradingLabels.orderAveragePrice(summary.result.averagePriceLabel) })
|
|
3158
|
+
] }),
|
|
3159
|
+
/* @__PURE__ */ jsx5("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-foreground", children: summary.result.filledAmountLabel })
|
|
3160
|
+
] }),
|
|
3161
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between gap-4", children: [
|
|
3162
|
+
/* @__PURE__ */ jsx5("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.orderPayout }),
|
|
3163
|
+
/* @__PURE__ */ jsx5("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-success", children: summary.result.payoutLabel })
|
|
3164
|
+
] })
|
|
3165
|
+
] }) : null,
|
|
3166
|
+
/* @__PURE__ */ jsx5("div", { className: "flex flex-col gap-4", children: summary.actions.map((action) => /* @__PURE__ */ jsx5(
|
|
2539
3167
|
Button,
|
|
2540
3168
|
{
|
|
2541
|
-
variant: "
|
|
3169
|
+
variant: action.variant === "retry" ? "primary" : "secondary",
|
|
2542
3170
|
size: "medium",
|
|
2543
3171
|
"aria-label": action.label,
|
|
2544
|
-
className: "
|
|
3172
|
+
className: "w-full",
|
|
2545
3173
|
onClick: resolveFailureActionHandler({ action, onDone, onRetry, onSkip }),
|
|
2546
3174
|
children: action.label
|
|
2547
3175
|
},
|
|
@@ -2549,36 +3177,44 @@ var PlaceOrderFailureView = ({
|
|
|
2549
3177
|
)) })
|
|
2550
3178
|
] }) });
|
|
2551
3179
|
}
|
|
2552
|
-
return /* @__PURE__ */
|
|
2553
|
-
/* @__PURE__ */
|
|
2554
|
-
/* @__PURE__ */
|
|
2555
|
-
/* @__PURE__ */
|
|
3180
|
+
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: [
|
|
3181
|
+
/* @__PURE__ */ jsxs4("div", { className: "agg-order-failure-header flex flex-col gap-2", children: [
|
|
3182
|
+
/* @__PURE__ */ jsxs4("div", { className: "agg-order-failure-market flex items-center gap-3", children: [
|
|
3183
|
+
/* @__PURE__ */ jsx5(
|
|
2556
3184
|
RemoteImage,
|
|
2557
3185
|
{
|
|
2558
|
-
src: (
|
|
3186
|
+
src: (_c = summary.eventImage) != null ? _c : null,
|
|
2559
3187
|
alt: "",
|
|
2560
3188
|
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
2561
3189
|
}
|
|
2562
3190
|
),
|
|
2563
|
-
/* @__PURE__ */
|
|
3191
|
+
/* @__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
3192
|
] }),
|
|
2565
|
-
summary.eventSubtitle ? /* @__PURE__ */
|
|
3193
|
+
summary.eventSubtitle ? /* @__PURE__ */ jsx5("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
|
|
2566
3194
|
] }),
|
|
2567
|
-
/* @__PURE__ */
|
|
3195
|
+
((_d = summary.executionGroups) == null ? void 0 : _d.length) ? /* @__PURE__ */ jsx5(
|
|
3196
|
+
PlaceOrderExecutionGroups,
|
|
3197
|
+
{
|
|
3198
|
+
enableAnimations: false,
|
|
3199
|
+
groups: summary.executionGroups,
|
|
3200
|
+
labels: tradingLabels
|
|
3201
|
+
}
|
|
3202
|
+
) : null,
|
|
3203
|
+
/* @__PURE__ */ jsx5(
|
|
2568
3204
|
InlineAlert,
|
|
2569
3205
|
{
|
|
2570
3206
|
tone: "error",
|
|
2571
3207
|
variant: "surface",
|
|
2572
3208
|
title: tradingLabels.orderFailureTitle,
|
|
2573
|
-
message: tradingLabels.orderFailureDescription((
|
|
3209
|
+
message: tradingLabels.orderFailureDescription((_e = summary.errorMessage) != null ? _e : "")
|
|
2574
3210
|
}
|
|
2575
3211
|
),
|
|
2576
|
-
/* @__PURE__ */
|
|
3212
|
+
/* @__PURE__ */ jsx5("div", { className: "agg-order-failure-actions flex flex-col gap-4", children: summary.actions.map((action) => /* @__PURE__ */ jsx5(
|
|
2577
3213
|
Button,
|
|
2578
3214
|
{
|
|
2579
3215
|
variant: action.variant === "retry" ? "primary" : "secondary",
|
|
2580
3216
|
size: "medium",
|
|
2581
|
-
className: "
|
|
3217
|
+
className: "w-full",
|
|
2582
3218
|
"aria-label": action.label,
|
|
2583
3219
|
onClick: resolveFailureActionHandler({ action, onDone, onRetry, onSkip }),
|
|
2584
3220
|
children: action.label
|
|
@@ -2590,9 +3226,8 @@ var PlaceOrderFailureView = ({
|
|
|
2590
3226
|
PlaceOrderFailureView.displayName = "PlaceOrderFailureView";
|
|
2591
3227
|
|
|
2592
3228
|
// src/trading/place-order/index.place-order.success.tsx
|
|
2593
|
-
import {
|
|
2594
|
-
|
|
2595
|
-
var resolveBuyToWinLabel = (shares) => {
|
|
3229
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3230
|
+
var resolveBuyPayoutLabel = (shares) => {
|
|
2596
3231
|
if (!shares) return "$0";
|
|
2597
3232
|
return shares.startsWith("$") ? shares : `$${shares}`;
|
|
2598
3233
|
};
|
|
@@ -2603,170 +3238,94 @@ var PlaceOrderSuccessView = ({
|
|
|
2603
3238
|
onDone,
|
|
2604
3239
|
onShare: _onShare
|
|
2605
3240
|
}) => {
|
|
2606
|
-
var _a, _b, _c, _d, _e
|
|
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,
|
|
3241
|
+
var _a, _b, _c, _d, _e;
|
|
3242
|
+
const resolvedTradeSide = (_a = summary.tradeSide) != null ? _a : "buy";
|
|
3243
|
+
const resolvedAmountLabel = (_b = summary.amountLabel) != null ? _b : resolvedTradeSide === "sell" ? summary.shares : summary.estimatedCost;
|
|
3244
|
+
const resolvedPayoutLabel = (_c = summary.toWinLabel) != null ? _c : resolvedTradeSide === "sell" ? summary.estimatedCost : resolveBuyPayoutLabel(summary.shares);
|
|
3245
|
+
const potentialReturnLabel = summary.potentialReturnLabel ? tradingLabels.potentialReturnBetter(summary.potentialReturnLabel) : null;
|
|
3246
|
+
const legacyExecutionSteps = ((_d = summary.executionStepGroups) != null ? _d : []).flat();
|
|
3247
|
+
return /* @__PURE__ */ jsx6(
|
|
3248
|
+
Card,
|
|
3249
|
+
{
|
|
3250
|
+
className: cn(
|
|
3251
|
+
"group/agg-order-panel",
|
|
3252
|
+
getPlaceOrderContainerClassName(),
|
|
3253
|
+
"border-0 ring-1 ring-inset ring-agg-separator",
|
|
3254
|
+
className
|
|
3255
|
+
),
|
|
3256
|
+
children: /* @__PURE__ */ jsxs5("div", { className: "agg-order-success-body flex flex-col gap-6 p-5", children: [
|
|
3257
|
+
summary.eventTitle ? /* @__PURE__ */ jsx6(
|
|
3258
|
+
PlaceOrderExecutionHeader,
|
|
2630
3259
|
{
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
3260
|
+
eventDateLabel: summary.eventDateLabel,
|
|
3261
|
+
eventImage: summary.eventImage,
|
|
3262
|
+
eventTitle: summary.eventTitle
|
|
2634
3263
|
}
|
|
2635
|
-
),
|
|
2636
|
-
|
|
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,
|
|
3264
|
+
) : null,
|
|
3265
|
+
((_e = summary.executionGroups) == null ? void 0 : _e.length) ? /* @__PURE__ */ jsx6(
|
|
3266
|
+
PlaceOrderExecutionGroups,
|
|
2719
3267
|
{
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
"aria-hidden": "true"
|
|
3268
|
+
enableAnimations: false,
|
|
3269
|
+
groups: summary.executionGroups,
|
|
3270
|
+
labels: tradingLabels
|
|
2724
3271
|
}
|
|
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
|
-
|
|
3272
|
+
) : legacyExecutionSteps.length > 0 ? /* @__PURE__ */ jsx6("div", { className: "flex flex-col gap-3 pl-[22px]", children: legacyExecutionSteps.map((step) => /* @__PURE__ */ jsxs5(
|
|
3273
|
+
"div",
|
|
3274
|
+
{
|
|
3275
|
+
className: "flex items-start gap-2 text-agg-xs leading-agg-4 text-agg-foreground",
|
|
3276
|
+
children: [
|
|
3277
|
+
/* @__PURE__ */ jsx6(
|
|
3278
|
+
Icon,
|
|
3279
|
+
{
|
|
3280
|
+
name: step.tone === "warning" || step.tone === "error" ? "warning-filled" : "check-circle",
|
|
3281
|
+
size: "xs",
|
|
3282
|
+
className: cn(
|
|
3283
|
+
"h-3 w-3 shrink-0",
|
|
3284
|
+
step.tone === "warning" || step.tone === "error" ? "text-agg-warning" : "text-agg-primary"
|
|
3285
|
+
),
|
|
3286
|
+
"aria-hidden": "true"
|
|
3287
|
+
}
|
|
3288
|
+
),
|
|
3289
|
+
/* @__PURE__ */ jsx6("p", { className: "min-w-0 flex-1", children: step.label })
|
|
3290
|
+
]
|
|
3291
|
+
},
|
|
3292
|
+
step.id
|
|
3293
|
+
)) }) : null,
|
|
3294
|
+
/* @__PURE__ */ jsxs5("div", { className: "agg-order-success-summary flex flex-col gap-4", children: [
|
|
3295
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between gap-4", children: [
|
|
3296
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex min-w-0 flex-col", children: [
|
|
3297
|
+
/* @__PURE__ */ jsx6("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: summary.resultState === "partial" ? tradingLabels.orderPartiallyFilled : tradingLabels.orderFullyFilled }),
|
|
3298
|
+
/* @__PURE__ */ jsx6("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: tradingLabels.orderAveragePrice(summary.avgPrice) })
|
|
3299
|
+
] }),
|
|
3300
|
+
/* @__PURE__ */ jsx6("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-foreground", children: resolvedAmountLabel })
|
|
3301
|
+
] }),
|
|
3302
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between gap-4", children: [
|
|
3303
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex min-w-0 flex-col gap-0.5", children: [
|
|
3304
|
+
/* @__PURE__ */ jsx6("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.orderPayout }),
|
|
3305
|
+
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
|
|
3306
|
+
] }),
|
|
3307
|
+
/* @__PURE__ */ jsx6("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-success", children: resolvedPayoutLabel })
|
|
3308
|
+
] })
|
|
3309
|
+
] }),
|
|
3310
|
+
/* @__PURE__ */ jsx6(
|
|
3311
|
+
Button,
|
|
3312
|
+
{
|
|
3313
|
+
variant: "secondary",
|
|
3314
|
+
size: "large",
|
|
3315
|
+
className: "w-full",
|
|
3316
|
+
"aria-label": tradingLabels.orderNewTrade,
|
|
3317
|
+
onClick: onDone,
|
|
3318
|
+
children: tradingLabels.orderNewTrade
|
|
3319
|
+
}
|
|
3320
|
+
)
|
|
3321
|
+
] })
|
|
3322
|
+
}
|
|
3323
|
+
);
|
|
2765
3324
|
};
|
|
2766
3325
|
PlaceOrderSuccessView.displayName = "PlaceOrderSuccessView";
|
|
2767
3326
|
|
|
2768
3327
|
// src/trading/place-order/index.tsx
|
|
2769
|
-
import { Fragment as Fragment3, jsx as
|
|
3328
|
+
import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2770
3329
|
var SELL_SHARE_INPUT_DECIMALS = 6;
|
|
2771
3330
|
var SELL_SHARE_DISPLAY_DECIMALS = 2;
|
|
2772
3331
|
var resolvePlaceOrderPortalContainer = (triggerElement) => {
|
|
@@ -2776,7 +3335,6 @@ var resolvePlaceOrderPortalContainer = (triggerElement) => {
|
|
|
2776
3335
|
var LIMIT_EXPIRATION_OPTION_COUNT = 5;
|
|
2777
3336
|
dayjs.extend(utc);
|
|
2778
3337
|
dayjs.extend(timezone);
|
|
2779
|
-
var LIMIT_ORDER_RAW_SCALE = BigInt(1e6);
|
|
2780
3338
|
var LIMIT_PRICE_STEP = 1e-3;
|
|
2781
3339
|
var LIMIT_PRICE_MIN = 1e-3;
|
|
2782
3340
|
var LIMIT_PRICE_MAX = 0.999;
|
|
@@ -2803,10 +3361,24 @@ var toLimitSizeRaw = ({
|
|
|
2803
3361
|
};
|
|
2804
3362
|
var formatLimitPriceLabel = (value) => {
|
|
2805
3363
|
return `${(value * 100).toLocaleString("en-US", {
|
|
2806
|
-
minimumFractionDigits:
|
|
2807
|
-
maximumFractionDigits:
|
|
3364
|
+
minimumFractionDigits: 0,
|
|
3365
|
+
maximumFractionDigits: 4
|
|
2808
3366
|
})}\xA2`;
|
|
2809
3367
|
};
|
|
3368
|
+
var formatLimitPriceRawLabel = (value) => {
|
|
3369
|
+
return formatLimitPriceLabel(Number(BigInt(value)) / Number(LIMIT_ORDER_RAW_SCALE));
|
|
3370
|
+
};
|
|
3371
|
+
var getLimitOrderToWinValue = ({
|
|
3372
|
+
amount,
|
|
3373
|
+
limitPriceRaw,
|
|
3374
|
+
side
|
|
3375
|
+
}) => {
|
|
3376
|
+
const priceRaw = BigInt(limitPriceRaw);
|
|
3377
|
+
if (priceRaw <= BigInt(0) || priceRaw >= LIMIT_ORDER_RAW_SCALE) return 0;
|
|
3378
|
+
const sizeRaw = BigInt(toLimitSizeRaw({ amount, limitPriceRaw, side }));
|
|
3379
|
+
if (side === "buy") return Number(sizeRaw) / Number(LIMIT_ORDER_RAW_SCALE);
|
|
3380
|
+
return Number(ceilDiv(priceRaw * sizeRaw, LIMIT_ORDER_RAW_SCALE)) / Number(LIMIT_ORDER_RAW_SCALE);
|
|
3381
|
+
};
|
|
2810
3382
|
var normalizeLimitPrice = (value) => {
|
|
2811
3383
|
if (!Number.isFinite(value)) return LIMIT_PRICE_MIN;
|
|
2812
3384
|
return Math.min(LIMIT_PRICE_MAX, Math.max(LIMIT_PRICE_MIN, Number(value.toFixed(3))));
|
|
@@ -2863,22 +3435,6 @@ var isFillRejection400 = (err) => {
|
|
|
2863
3435
|
const nested = (_a = err.response) == null ? void 0 : _a.status;
|
|
2864
3436
|
return nested === 400;
|
|
2865
3437
|
};
|
|
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
3438
|
var PlaceOrderSlippageControl = ({
|
|
2883
3439
|
enableAnimations,
|
|
2884
3440
|
onChange,
|
|
@@ -2894,11 +3450,11 @@ var PlaceOrderSlippageControl = ({
|
|
|
2894
3450
|
const warningId = useId();
|
|
2895
3451
|
const defaultValue = finalizePercentageValue(slippageDefaultValue);
|
|
2896
3452
|
const committedValue = finalizePercentageValue(slippageValue) || defaultValue;
|
|
2897
|
-
const [draftValue, setDraftValue] =
|
|
2898
|
-
const [isEditing, setIsEditing] =
|
|
3453
|
+
const [draftValue, setDraftValue] = useState(committedValue);
|
|
3454
|
+
const [isEditing, setIsEditing] = useState(
|
|
2899
3455
|
() => isPercentageBelowMinimum(committedValue, slippageMinimumValue)
|
|
2900
3456
|
);
|
|
2901
|
-
const [shouldFocusInput, setShouldFocusInput] =
|
|
3457
|
+
const [shouldFocusInput, setShouldFocusInput] = useState(false);
|
|
2902
3458
|
useEffect2(() => {
|
|
2903
3459
|
setDraftValue(committedValue);
|
|
2904
3460
|
if (isPercentageBelowMinimum(committedValue, slippageMinimumValue)) {
|
|
@@ -2985,8 +3541,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
2985
3541
|
if (!isEditing) return;
|
|
2986
3542
|
handleCommitDraft(false);
|
|
2987
3543
|
};
|
|
2988
|
-
return /* @__PURE__ */
|
|
2989
|
-
/* @__PURE__ */
|
|
3544
|
+
return /* @__PURE__ */ jsxs6("div", { ref: containerRef, className: "agg-slippage-control w-full", onBlur: handleContainerBlur, children: [
|
|
3545
|
+
/* @__PURE__ */ jsxs6(
|
|
2990
3546
|
"button",
|
|
2991
3547
|
{
|
|
2992
3548
|
ref: triggerRef,
|
|
@@ -3004,8 +3560,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
3004
3560
|
),
|
|
3005
3561
|
onClick: handleToggleEditing,
|
|
3006
3562
|
children: [
|
|
3007
|
-
/* @__PURE__ */
|
|
3008
|
-
/* @__PURE__ */
|
|
3563
|
+
/* @__PURE__ */ jsx7("span", { className: "agg-slippage-label", children: collapsedLabel }),
|
|
3564
|
+
/* @__PURE__ */ jsx7(
|
|
3009
3565
|
Icon,
|
|
3010
3566
|
{
|
|
3011
3567
|
name: isEditing ? "chevron-up" : "pencil",
|
|
@@ -3017,7 +3573,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
3017
3573
|
]
|
|
3018
3574
|
}
|
|
3019
3575
|
),
|
|
3020
|
-
/* @__PURE__ */
|
|
3576
|
+
/* @__PURE__ */ jsx7(
|
|
3021
3577
|
"div",
|
|
3022
3578
|
{
|
|
3023
3579
|
"aria-hidden": !isEditing,
|
|
@@ -3031,10 +3587,10 @@ var PlaceOrderSlippageControl = ({
|
|
|
3031
3587
|
"transition-[grid-template-rows,opacity,margin-top] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
3032
3588
|
)
|
|
3033
3589
|
),
|
|
3034
|
-
children: /* @__PURE__ */
|
|
3035
|
-
/* @__PURE__ */
|
|
3036
|
-
/* @__PURE__ */
|
|
3037
|
-
/* @__PURE__ */
|
|
3590
|
+
children: /* @__PURE__ */ jsx7("div", { className: "min-h-0", children: /* @__PURE__ */ jsxs6("div", { className: "agg-slippage-editor-body flex flex-col gap-2", children: [
|
|
3591
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-slippage-input-row flex h-9 overflow-hidden rounded-agg-sm border border-agg-separator", children: [
|
|
3592
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-slippage-input-group flex min-w-0 flex-1 items-center gap-2 bg-agg-secondary px-3", children: [
|
|
3593
|
+
/* @__PURE__ */ jsx7(
|
|
3038
3594
|
"input",
|
|
3039
3595
|
{
|
|
3040
3596
|
ref: inputRef,
|
|
@@ -3049,7 +3605,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
3049
3605
|
onKeyDown: handleInputKeyDown
|
|
3050
3606
|
}
|
|
3051
3607
|
),
|
|
3052
|
-
/* @__PURE__ */
|
|
3608
|
+
/* @__PURE__ */ jsx7(
|
|
3053
3609
|
"button",
|
|
3054
3610
|
{
|
|
3055
3611
|
type: "button",
|
|
@@ -3067,8 +3623,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
3067
3623
|
}
|
|
3068
3624
|
)
|
|
3069
3625
|
] }),
|
|
3070
|
-
/* @__PURE__ */
|
|
3071
|
-
/* @__PURE__ */
|
|
3626
|
+
/* @__PURE__ */ jsx7("div", { className: "h-full w-px bg-agg-separator", "aria-hidden": "true" }),
|
|
3627
|
+
/* @__PURE__ */ jsx7(
|
|
3072
3628
|
"div",
|
|
3073
3629
|
{
|
|
3074
3630
|
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 +3633,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
3077
3633
|
}
|
|
3078
3634
|
)
|
|
3079
3635
|
] }),
|
|
3080
|
-
/* @__PURE__ */
|
|
3636
|
+
/* @__PURE__ */ jsx7(
|
|
3081
3637
|
"div",
|
|
3082
3638
|
{
|
|
3083
3639
|
"aria-hidden": !resolvedWarningMessage,
|
|
@@ -3091,13 +3647,13 @@ var PlaceOrderSlippageControl = ({
|
|
|
3091
3647
|
"transition-[grid-template-rows,opacity] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
3092
3648
|
)
|
|
3093
3649
|
),
|
|
3094
|
-
children: /* @__PURE__ */
|
|
3650
|
+
children: /* @__PURE__ */ jsx7("div", { className: "min-h-0", children: /* @__PURE__ */ jsxs6(
|
|
3095
3651
|
"div",
|
|
3096
3652
|
{
|
|
3097
3653
|
id: warningId,
|
|
3098
3654
|
className: "agg-slippage-warning-message flex items-start gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
3099
3655
|
children: [
|
|
3100
|
-
/* @__PURE__ */
|
|
3656
|
+
/* @__PURE__ */ jsx7(
|
|
3101
3657
|
Icon,
|
|
3102
3658
|
{
|
|
3103
3659
|
name: "warning-filled",
|
|
@@ -3106,7 +3662,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
3106
3662
|
color: "currentColor"
|
|
3107
3663
|
}
|
|
3108
3664
|
),
|
|
3109
|
-
/* @__PURE__ */
|
|
3665
|
+
/* @__PURE__ */ jsx7("p", { children: resolvedWarningMessage != null ? resolvedWarningMessage : "" })
|
|
3110
3666
|
]
|
|
3111
3667
|
}
|
|
3112
3668
|
) })
|
|
@@ -3126,9 +3682,9 @@ var renderCardHeader = ({
|
|
|
3126
3682
|
onClose
|
|
3127
3683
|
}) => {
|
|
3128
3684
|
if (!headerTitle) return null;
|
|
3129
|
-
return /* @__PURE__ */
|
|
3130
|
-
/* @__PURE__ */
|
|
3131
|
-
/* @__PURE__ */
|
|
3685
|
+
return /* @__PURE__ */ jsxs6("div", { className: cn("agg-order-panel-header flex flex-col gap-2", className), children: [
|
|
3686
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-order-market-summary flex items-center gap-3", children: [
|
|
3687
|
+
/* @__PURE__ */ jsx7(
|
|
3132
3688
|
RemoteImage,
|
|
3133
3689
|
{
|
|
3134
3690
|
src: headerImage,
|
|
@@ -3136,19 +3692,19 @@ var renderCardHeader = ({
|
|
|
3136
3692
|
className: "agg-order-market-image h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
3137
3693
|
}
|
|
3138
3694
|
),
|
|
3139
|
-
/* @__PURE__ */
|
|
3140
|
-
onClose ? /* @__PURE__ */
|
|
3695
|
+
/* @__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 }),
|
|
3696
|
+
onClose ? /* @__PURE__ */ jsx7(
|
|
3141
3697
|
"button",
|
|
3142
3698
|
{
|
|
3143
3699
|
type: "button",
|
|
3144
3700
|
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
3701
|
"aria-label": "Close",
|
|
3146
3702
|
onClick: onClose,
|
|
3147
|
-
children: /* @__PURE__ */
|
|
3703
|
+
children: /* @__PURE__ */ jsx7(CloseIcon, { className: "h-5 w-5" })
|
|
3148
3704
|
}
|
|
3149
3705
|
) : null
|
|
3150
3706
|
] }),
|
|
3151
|
-
headerSubtitle ? /* @__PURE__ */
|
|
3707
|
+
headerSubtitle ? /* @__PURE__ */ jsx7("p", { className: "agg-order-market-subtitle text-agg-base leading-agg-6 text-agg-foreground", children: headerSubtitle }) : null
|
|
3152
3708
|
] });
|
|
3153
3709
|
};
|
|
3154
3710
|
var PlaceOrderResolvedView = ({
|
|
@@ -3157,19 +3713,20 @@ var PlaceOrderResolvedView = ({
|
|
|
3157
3713
|
resolutionTimestamp,
|
|
3158
3714
|
resolvedClaim,
|
|
3159
3715
|
className,
|
|
3160
|
-
isSportsEvent = false
|
|
3716
|
+
isSportsEvent = false,
|
|
3717
|
+
showResolvingState = false
|
|
3161
3718
|
}) => {
|
|
3162
3719
|
var _a, _b;
|
|
3163
3720
|
const labels = useLabels2();
|
|
3164
3721
|
const tradingLabels = labels.trading;
|
|
3165
3722
|
const resolvingTimestamp = (_a = resolutionTimestamp != null ? resolutionTimestamp : tradingState.resolvesAt) != null ? _a : tradingState.endsAt;
|
|
3166
|
-
const isResolvingMarket =
|
|
3723
|
+
const isResolvingMarket = showResolvingState && !tradingState.winningOutcome;
|
|
3167
3724
|
const resolvingSubtitle = tradingState.market ? (() => {
|
|
3168
3725
|
const endDateLabel = isSportsEvent ? formatSportsEventTimeEt(resolvingTimestamp != null ? resolvingTimestamp : "") : getTradingDateLabel(resolvingTimestamp != null ? resolvingTimestamp : "");
|
|
3169
3726
|
return endDateLabel ? `${tradingState.market.question} \xB7 ${endDateLabel}` : tradingState.market.question;
|
|
3170
3727
|
})() : "";
|
|
3171
3728
|
if (isResolvingMarket) {
|
|
3172
|
-
return /* @__PURE__ */
|
|
3729
|
+
return /* @__PURE__ */ jsx7(
|
|
3173
3730
|
Card,
|
|
3174
3731
|
{
|
|
3175
3732
|
className: cn(
|
|
@@ -3180,7 +3737,7 @@ var PlaceOrderResolvedView = ({
|
|
|
3180
3737
|
),
|
|
3181
3738
|
role: "status",
|
|
3182
3739
|
"aria-label": labels.marketDetails.resolvingTitle,
|
|
3183
|
-
children: /* @__PURE__ */
|
|
3740
|
+
children: /* @__PURE__ */ jsxs6(
|
|
3184
3741
|
"div",
|
|
3185
3742
|
{
|
|
3186
3743
|
className: cn(
|
|
@@ -3188,12 +3745,12 @@ var PlaceOrderResolvedView = ({
|
|
|
3188
3745
|
classNames == null ? void 0 : classNames.body
|
|
3189
3746
|
),
|
|
3190
3747
|
children: [
|
|
3191
|
-
/* @__PURE__ */
|
|
3192
|
-
/* @__PURE__ */
|
|
3193
|
-
/* @__PURE__ */
|
|
3194
|
-
resolvingSubtitle ? /* @__PURE__ */
|
|
3748
|
+
/* @__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" }) }),
|
|
3749
|
+
/* @__PURE__ */ jsxs6("div", { className: cn("flex w-full flex-col items-center gap-1", classNames == null ? void 0 : classNames.content), children: [
|
|
3750
|
+
/* @__PURE__ */ jsx7(Typography, { variant: "body-large-strong", children: labels.marketDetails.resolvingTitle }),
|
|
3751
|
+
resolvingSubtitle ? /* @__PURE__ */ jsx7(Typography, { variant: "body", className: "text-center", children: resolvingSubtitle }) : null
|
|
3195
3752
|
] }),
|
|
3196
|
-
/* @__PURE__ */
|
|
3753
|
+
/* @__PURE__ */ jsx7(
|
|
3197
3754
|
Typography,
|
|
3198
3755
|
{
|
|
3199
3756
|
variant: "label",
|
|
@@ -3207,7 +3764,7 @@ var PlaceOrderResolvedView = ({
|
|
|
3207
3764
|
}
|
|
3208
3765
|
);
|
|
3209
3766
|
}
|
|
3210
|
-
return /* @__PURE__ */
|
|
3767
|
+
return /* @__PURE__ */ jsx7(
|
|
3211
3768
|
Card,
|
|
3212
3769
|
{
|
|
3213
3770
|
className: cn(
|
|
@@ -3216,19 +3773,19 @@ var PlaceOrderResolvedView = ({
|
|
|
3216
3773
|
classNames == null ? void 0 : classNames.root,
|
|
3217
3774
|
className
|
|
3218
3775
|
),
|
|
3219
|
-
children: /* @__PURE__ */
|
|
3220
|
-
/* @__PURE__ */
|
|
3221
|
-
/* @__PURE__ */
|
|
3776
|
+
children: /* @__PURE__ */ jsxs6("div", { className: cn("agg-order-panel-body flex flex-col", classNames == null ? void 0 : classNames.body), children: [
|
|
3777
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col items-center gap-6 p-8", children: [
|
|
3778
|
+
/* @__PURE__ */ jsx7(
|
|
3222
3779
|
"div",
|
|
3223
3780
|
{
|
|
3224
3781
|
className: cn(
|
|
3225
3782
|
"flex h-15 w-15 items-center justify-center rounded-full",
|
|
3226
3783
|
"bg-agg-primary/15"
|
|
3227
3784
|
),
|
|
3228
|
-
children: /* @__PURE__ */
|
|
3785
|
+
children: /* @__PURE__ */ jsx7(Icon, { name: "success-check", className: cn("h-6 w-6", "text-agg-primary") })
|
|
3229
3786
|
}
|
|
3230
3787
|
),
|
|
3231
|
-
/* @__PURE__ */
|
|
3788
|
+
/* @__PURE__ */ jsxs6(
|
|
3232
3789
|
"div",
|
|
3233
3790
|
{
|
|
3234
3791
|
className: cn(
|
|
@@ -3236,8 +3793,8 @@ var PlaceOrderResolvedView = ({
|
|
|
3236
3793
|
classNames == null ? void 0 : classNames.content
|
|
3237
3794
|
),
|
|
3238
3795
|
children: [
|
|
3239
|
-
tradingState.market ? /* @__PURE__ */
|
|
3240
|
-
tradingState.winningOutcome ? /* @__PURE__ */
|
|
3796
|
+
tradingState.market ? /* @__PURE__ */ jsx7(Typography, { variant: "body", className: "text-center", children: tradingState.market.question }) : null,
|
|
3797
|
+
tradingState.winningOutcome ? /* @__PURE__ */ jsx7(Typography, { variant: "body-large-strong", children: tradingLabels.outcome(
|
|
3241
3798
|
shouldUseRawResolvedPlaceOrderOutcomeLabel(
|
|
3242
3799
|
tradingState.market,
|
|
3243
3800
|
tradingState.winningOutcome
|
|
@@ -3251,25 +3808,25 @@ var PlaceOrderResolvedView = ({
|
|
|
3251
3808
|
}
|
|
3252
3809
|
)
|
|
3253
3810
|
] }),
|
|
3254
|
-
resolvedClaim ? /* @__PURE__ */
|
|
3255
|
-
/* @__PURE__ */
|
|
3256
|
-
/* @__PURE__ */
|
|
3257
|
-
/* @__PURE__ */
|
|
3258
|
-
/* @__PURE__ */
|
|
3259
|
-
resolvedClaim.resolutionDateLabel ? /* @__PURE__ */
|
|
3260
|
-
/* @__PURE__ */
|
|
3261
|
-
/* @__PURE__ */
|
|
3811
|
+
resolvedClaim ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
3812
|
+
/* @__PURE__ */ jsx7("div", { className: "h-px w-full bg-agg-separator" }),
|
|
3813
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex w-full flex-col gap-5 p-6", children: [
|
|
3814
|
+
/* @__PURE__ */ jsx7(Typography, { variant: "body-strong", className: "text-center", children: tradingLabels.resolvedEarningsTitle }),
|
|
3815
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-3 text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
3816
|
+
resolvedClaim.resolutionDateLabel ? /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-4", children: [
|
|
3817
|
+
/* @__PURE__ */ jsx7("span", { children: tradingLabels.resolvedResolutionDateLabel }),
|
|
3818
|
+
/* @__PURE__ */ jsx7("span", { className: "font-agg-bold", children: resolvedClaim.resolutionDateLabel })
|
|
3262
3819
|
] }) : null,
|
|
3263
|
-
/* @__PURE__ */
|
|
3264
|
-
/* @__PURE__ */
|
|
3265
|
-
/* @__PURE__ */
|
|
3820
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-4", children: [
|
|
3821
|
+
/* @__PURE__ */ jsx7("span", { children: tradingLabels.resolvedSharesLabel }),
|
|
3822
|
+
/* @__PURE__ */ jsx7("span", { className: "font-agg-bold", children: resolvedClaim.sharesLabel })
|
|
3266
3823
|
] }),
|
|
3267
|
-
/* @__PURE__ */
|
|
3268
|
-
/* @__PURE__ */
|
|
3269
|
-
/* @__PURE__ */
|
|
3824
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-4", children: [
|
|
3825
|
+
/* @__PURE__ */ jsx7("span", { children: tradingLabels.resolvedTotalPayoutLabel }),
|
|
3826
|
+
/* @__PURE__ */ jsx7("span", { className: "font-agg-bold", children: resolvedClaim.totalPayoutLabel })
|
|
3270
3827
|
] })
|
|
3271
3828
|
] }),
|
|
3272
|
-
resolvedClaim.onClaim ? /* @__PURE__ */
|
|
3829
|
+
resolvedClaim.onClaim ? /* @__PURE__ */ jsx7(
|
|
3273
3830
|
Button,
|
|
3274
3831
|
{
|
|
3275
3832
|
size: "large",
|
|
@@ -3290,18 +3847,18 @@ var renderRouteBreakdownRow = (row) => {
|
|
|
3290
3847
|
var _a, _b;
|
|
3291
3848
|
const venueLabel = getTradingVenueLabel(row.venue);
|
|
3292
3849
|
const rowKey = `${row.venue}-${row.label}-${row.priceLabel}-${(_a = row.resultLabel) != null ? _a : ""}`;
|
|
3293
|
-
return /* @__PURE__ */
|
|
3850
|
+
return /* @__PURE__ */ jsxs6(
|
|
3294
3851
|
"div",
|
|
3295
3852
|
{
|
|
3296
3853
|
className: "agg-route-breakdown-row flex items-center justify-between gap-4 text-left",
|
|
3297
3854
|
children: [
|
|
3298
|
-
/* @__PURE__ */
|
|
3299
|
-
/* @__PURE__ */
|
|
3300
|
-
/* @__PURE__ */
|
|
3855
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-route-breakdown-market flex min-w-0 items-center gap-2", children: [
|
|
3856
|
+
/* @__PURE__ */ jsx7(VenueLogo, { venue: row.venue, className: "size-3!", ariaLabel: venueLabel }),
|
|
3857
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-route-breakdown-label truncate text-agg-sm leading-agg-5 text-agg-foreground", children: row.label })
|
|
3301
3858
|
] }),
|
|
3302
|
-
/* @__PURE__ */
|
|
3303
|
-
/* @__PURE__ */
|
|
3304
|
-
/* @__PURE__ */
|
|
3859
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-route-breakdown-value flex shrink-0 items-center gap-2 text-agg-sm leading-agg-5", children: [
|
|
3860
|
+
/* @__PURE__ */ jsx7("p", { className: "text-agg-muted-foreground", children: row.priceLabel }),
|
|
3861
|
+
/* @__PURE__ */ jsx7("p", { className: "text-agg-foreground", children: (_b = row.resultLabel) != null ? _b : "" })
|
|
3305
3862
|
] })
|
|
3306
3863
|
]
|
|
3307
3864
|
},
|
|
@@ -3329,7 +3886,7 @@ var renderRouteCard = ({
|
|
|
3329
3886
|
var _a, _b, _c;
|
|
3330
3887
|
const showSplitDetails = isSelected && isExpanded && card.kind === "split" && !!((_a = card.rows) == null ? void 0 : _a.length);
|
|
3331
3888
|
const ariaLabel = [card.label, card.hint, card.value].filter(Boolean).join(" ");
|
|
3332
|
-
return /* @__PURE__ */
|
|
3889
|
+
return /* @__PURE__ */ jsx7(
|
|
3333
3890
|
"button",
|
|
3334
3891
|
{
|
|
3335
3892
|
type: "button",
|
|
@@ -3348,10 +3905,10 @@ var renderRouteCard = ({
|
|
|
3348
3905
|
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
3906
|
),
|
|
3350
3907
|
onClick: () => onSelect(card.id),
|
|
3351
|
-
children: /* @__PURE__ */
|
|
3352
|
-
/* @__PURE__ */
|
|
3353
|
-
/* @__PURE__ */
|
|
3354
|
-
card.kind === "split" ? /* @__PURE__ */
|
|
3908
|
+
children: /* @__PURE__ */ jsxs6("div", { className: "agg-route-card-content relative z-10 flex flex-col gap-3", children: [
|
|
3909
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-route-card-header flex items-center justify-between gap-4", children: [
|
|
3910
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-route-card-meta flex min-w-0 gap-3 items-center", children: [
|
|
3911
|
+
card.kind === "split" ? /* @__PURE__ */ jsx7(
|
|
3355
3912
|
Icon,
|
|
3356
3913
|
{
|
|
3357
3914
|
name: "sparkles-filled",
|
|
@@ -3362,7 +3919,7 @@ var renderRouteCard = ({
|
|
|
3362
3919
|
),
|
|
3363
3920
|
"aria-hidden": "true"
|
|
3364
3921
|
}
|
|
3365
|
-
) : card.venue ? /* @__PURE__ */
|
|
3922
|
+
) : card.venue ? /* @__PURE__ */ jsx7(
|
|
3366
3923
|
VenueLogo,
|
|
3367
3924
|
{
|
|
3368
3925
|
venue: card.venue,
|
|
@@ -3370,10 +3927,10 @@ var renderRouteCard = ({
|
|
|
3370
3927
|
ariaLabel: getTradingVenueLabel(card.venue)
|
|
3371
3928
|
}
|
|
3372
3929
|
) : null,
|
|
3373
|
-
/* @__PURE__ */
|
|
3374
|
-
/* @__PURE__ */
|
|
3375
|
-
/* @__PURE__ */
|
|
3376
|
-
card.isUnavailable ? /* @__PURE__ */
|
|
3930
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-1 min-w-0", children: [
|
|
3931
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1.5", children: [
|
|
3932
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-route-card-title truncate text-agg-sm leading-agg-5 text-agg-foreground", children: card.label }),
|
|
3933
|
+
card.isUnavailable ? /* @__PURE__ */ jsx7(
|
|
3377
3934
|
Icon,
|
|
3378
3935
|
{
|
|
3379
3936
|
name: "lock",
|
|
@@ -3381,7 +3938,7 @@ var renderRouteCard = ({
|
|
|
3381
3938
|
className: "shrink-0 text-agg-muted-foreground",
|
|
3382
3939
|
"aria-hidden": "true"
|
|
3383
3940
|
}
|
|
3384
|
-
) : card.insufficientInventory ? /* @__PURE__ */
|
|
3941
|
+
) : card.insufficientInventory ? /* @__PURE__ */ jsx7(
|
|
3385
3942
|
Icon,
|
|
3386
3943
|
{
|
|
3387
3944
|
name: "warning",
|
|
@@ -3389,7 +3946,7 @@ var renderRouteCard = ({
|
|
|
3389
3946
|
className: "shrink-0 text-agg-muted-foreground",
|
|
3390
3947
|
"aria-hidden": "true"
|
|
3391
3948
|
}
|
|
3392
|
-
) : card.kind === "split" && isSelected ? /* @__PURE__ */
|
|
3949
|
+
) : card.kind === "split" && isSelected ? /* @__PURE__ */ jsx7(
|
|
3393
3950
|
Icon,
|
|
3394
3951
|
{
|
|
3395
3952
|
name: showSplitDetails ? "chevron-up" : "chevron-down",
|
|
@@ -3399,10 +3956,10 @@ var renderRouteCard = ({
|
|
|
3399
3956
|
}
|
|
3400
3957
|
) : null
|
|
3401
3958
|
] }),
|
|
3402
|
-
card.hint ? /* @__PURE__ */
|
|
3959
|
+
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
3960
|
] })
|
|
3404
3961
|
] }),
|
|
3405
|
-
/* @__PURE__ */
|
|
3962
|
+
/* @__PURE__ */ jsx7(
|
|
3406
3963
|
"p",
|
|
3407
3964
|
{
|
|
3408
3965
|
className: cn(
|
|
@@ -3414,101 +3971,14 @@ var renderRouteCard = ({
|
|
|
3414
3971
|
}
|
|
3415
3972
|
)
|
|
3416
3973
|
] }),
|
|
3417
|
-
showSplitDetails ? /* @__PURE__ */
|
|
3418
|
-
/* @__PURE__ */
|
|
3419
|
-
/* @__PURE__ */
|
|
3974
|
+
showSplitDetails ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
3975
|
+
/* @__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 }),
|
|
3976
|
+
/* @__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
3977
|
] }) : null
|
|
3421
3978
|
] })
|
|
3422
3979
|
}
|
|
3423
3980
|
);
|
|
3424
3981
|
};
|
|
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
3982
|
var PlaceOrder = ({
|
|
3513
3983
|
className,
|
|
3514
3984
|
classNames,
|
|
@@ -3530,9 +4000,10 @@ var PlaceOrder = ({
|
|
|
3530
4000
|
onError,
|
|
3531
4001
|
onExecutionStateChange,
|
|
3532
4002
|
resolvedClaim,
|
|
4003
|
+
showResolvingState = false,
|
|
3533
4004
|
midpointsResult
|
|
3534
4005
|
}) => {
|
|
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, __, _
|
|
4006
|
+
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
4007
|
const {
|
|
3537
4008
|
enableDebug: isExecutionDebugEnabled,
|
|
3538
4009
|
features: { enableAnimations, showFeesBreakdown, showLimitOrders },
|
|
@@ -3593,7 +4064,7 @@ var PlaceOrder = ({
|
|
|
3593
4064
|
const resolvedReadOnlyTradingState = useMemo(() => {
|
|
3594
4065
|
return resolveMarketTradingState(resolvedReadOnlyMarket);
|
|
3595
4066
|
}, [resolvedReadOnlyMarket]);
|
|
3596
|
-
const isEndedWithoutKnownWinner =
|
|
4067
|
+
const isEndedWithoutKnownWinner = showResolvingState && !resolvedEventTradingState.winningOutcome && !resolvedReadOnlyTradingState.winningOutcome;
|
|
3597
4068
|
const orderEligibility = useMemo(
|
|
3598
4069
|
() => resolveOrderEligibility({
|
|
3599
4070
|
event: scopedSelectedEvent,
|
|
@@ -3634,11 +4105,11 @@ var PlaceOrder = ({
|
|
|
3634
4105
|
const queryClient = useQueryClient();
|
|
3635
4106
|
const { disabledVenues, isLoading: isAppConfigLoading } = useAppConfig();
|
|
3636
4107
|
const { data: kalshiKeyStatus, refetch: refetchKalshiKeyStatus } = useVenueKeyStatus(
|
|
3637
|
-
|
|
4108
|
+
Venue3.kalshi,
|
|
3638
4109
|
isAuthenticated
|
|
3639
4110
|
);
|
|
3640
|
-
const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] =
|
|
3641
|
-
const [isFundKalshiModalOpen, setIsFundKalshiModalOpen] =
|
|
4111
|
+
const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = useState(false);
|
|
4112
|
+
const [isFundKalshiModalOpen, setIsFundKalshiModalOpen] = useState(false);
|
|
3642
4113
|
const livePrices = useLiveOutcomePrices(
|
|
3643
4114
|
scopedSelectedMarket ? [scopedSelectedMarket] : void 0
|
|
3644
4115
|
);
|
|
@@ -3654,29 +4125,32 @@ var PlaceOrder = ({
|
|
|
3654
4125
|
() => mergeBestPricesPreferringLive(clusterBestPricesRest, wsBestPrices),
|
|
3655
4126
|
[clusterBestPricesRest, wsBestPrices]
|
|
3656
4127
|
);
|
|
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 [
|
|
4128
|
+
const [internalTab, setInternalTab] = useState("buy");
|
|
4129
|
+
const [executionType, setExecutionType] = useState("market");
|
|
4130
|
+
const [selectedLimitVenue, setSelectedLimitVenue] = useState(null);
|
|
4131
|
+
const [limitPrice, setLimitPrice] = useState(0.5);
|
|
4132
|
+
const [limitPriceInputValue, setLimitPriceInputValue] = useState(formatLimitPriceInputValue(0.5));
|
|
4133
|
+
const [limitPriceInputError, setLimitPriceInputError] = useState(null);
|
|
4134
|
+
const [limitExpirationType, setLimitExpirationType] = useState("GTC");
|
|
4135
|
+
const [limitExpirationDate, setLimitExpirationDate] = useState(void 0);
|
|
4136
|
+
const [limitExpirationTime, setLimitExpirationTime] = useState("17:00");
|
|
4137
|
+
const [limitExpirationDraftDate, setLimitExpirationDraftDate] = useState();
|
|
4138
|
+
const [limitExpirationDraftTime, setLimitExpirationDraftTime] = useState("17:00");
|
|
4139
|
+
const [limitExpirationPickerView, setLimitExpirationPickerView] = useState("options");
|
|
4140
|
+
const [isLimitExpirationPickerOpen, setIsLimitExpirationPickerOpen] = useState(false);
|
|
4141
|
+
const [internalAmount, setInternalAmount] = useState(PLACE_ORDER_DEFAULT_AMOUNT);
|
|
4142
|
+
const [sellFilledForOutcomeId, setSellFilledForOutcomeId] = useState(null);
|
|
4143
|
+
const [internalSlippage] = useState(DEFAULT_SLIPPAGE_VALUE);
|
|
4144
|
+
const [isRoutesExpanded, setIsRoutesExpanded] = useState(false);
|
|
4145
|
+
const [selectedRouteCardId, setSelectedRouteCardId] = useState(null);
|
|
4146
|
+
const [manualRouteSelectionIdentity, setManualRouteSelectionIdentity] = useState(
|
|
4147
|
+
null
|
|
4148
|
+
);
|
|
4149
|
+
const [isSplitDetailOpen, setIsSplitDetailOpen] = useState(false);
|
|
4150
|
+
const [buyGeoBlockSnapshot, setBuyGeoBlockSnapshot] = useState(null);
|
|
4151
|
+
const [submissionFeedback, setSubmissionFeedback] = useState(null);
|
|
4152
|
+
const [submissionProgressState, setSubmissionProgressState] = useState(null);
|
|
4153
|
+
const [isBeforeActionPending, setIsBeforeActionPending] = useState(false);
|
|
3680
4154
|
const outcomes = useMemo(
|
|
3681
4155
|
() => mapVenueMarketOutcomesToPlaceOrderOutcomes(scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes),
|
|
3682
4156
|
[scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes]
|
|
@@ -3714,6 +4188,7 @@ var PlaceOrder = ({
|
|
|
3714
4188
|
const executionDebugStoreRef = useRef2(null);
|
|
3715
4189
|
const executionDebugAttemptIdRef = useRef2(null);
|
|
3716
4190
|
const submittedSelectionRef = useRef2(null);
|
|
4191
|
+
const lastValidRouteCardsRef = useRef2(null);
|
|
3717
4192
|
useEffect2(() => {
|
|
3718
4193
|
if (!isExecutionDebugEnabled) {
|
|
3719
4194
|
executionDebugStoreRef.current = null;
|
|
@@ -3861,10 +4336,14 @@ var PlaceOrder = ({
|
|
|
3861
4336
|
compareVenues: true,
|
|
3862
4337
|
tradeSide: isSell ? "sell" : "buy",
|
|
3863
4338
|
mode: isPaperMode ? "paper" : void 0,
|
|
4339
|
+
balanceCacheScope: {
|
|
4340
|
+
accountId: (_l = user == null ? void 0 : user.id) != null ? _l : null,
|
|
4341
|
+
balanceVersion: isPaperMode ? paperBalancesQuery.dataUpdatedAt : liveBalanceState.dataUpdatedAt
|
|
4342
|
+
},
|
|
3864
4343
|
enabled: isSmartRouteEnabled
|
|
3865
4344
|
}, isSell ? {
|
|
3866
4345
|
sellCacheScope: {
|
|
3867
|
-
accountId: (
|
|
4346
|
+
accountId: (_m = user == null ? void 0 : user.id) != null ? _m : null,
|
|
3868
4347
|
positionVersion: executionPositionsUpdatedAt
|
|
3869
4348
|
}
|
|
3870
4349
|
} : {}), {
|
|
@@ -3920,12 +4399,12 @@ var PlaceOrder = ({
|
|
|
3920
4399
|
);
|
|
3921
4400
|
const venueSellQuotes = useVenueSellQuotes({
|
|
3922
4401
|
venueMarketOutcomeId: scopedSelectedOutcomeId,
|
|
3923
|
-
accountId: (
|
|
4402
|
+
accountId: (_n = user == null ? void 0 : user.id) != null ? _n : null,
|
|
3924
4403
|
positionVersion: executionPositionsUpdatedAt,
|
|
3925
4404
|
requests: venueSellQuoteRequests,
|
|
3926
4405
|
mode: isPaperMode ? "paper" : void 0,
|
|
3927
4406
|
slipCapBps: 1e6,
|
|
3928
|
-
enabled: isSell && isSmartRouteEnabled && !smartRoute.isLoading && ((
|
|
4407
|
+
enabled: isSell && isSmartRouteEnabled && !smartRoute.isLoading && ((_o = smartRoute.data) == null ? void 0 : _o.venueMarketOutcomeId) === scopedSelectedOutcomeId,
|
|
3929
4408
|
refreshContext: smartRouteRefreshContext
|
|
3930
4409
|
});
|
|
3931
4410
|
const currentSellableShares = useMemo(() => {
|
|
@@ -3960,13 +4439,13 @@ var PlaceOrder = ({
|
|
|
3960
4439
|
isSell,
|
|
3961
4440
|
scopedSelectedMarket,
|
|
3962
4441
|
scopedSelectedOutcome,
|
|
3963
|
-
(
|
|
4442
|
+
(_q = (_p = smartRoute.data) == null ? void 0 : _p.positionAvailability) == null ? void 0 : _q.totalSellableShares
|
|
3964
4443
|
]);
|
|
3965
4444
|
const maxSellableShares = useMemo(
|
|
3966
4445
|
() => floorToDecimals(currentSellableShares, SELL_SHARE_INPUT_DECIMALS),
|
|
3967
4446
|
[currentSellableShares]
|
|
3968
4447
|
);
|
|
3969
|
-
const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((
|
|
4448
|
+
const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((_s = (_r = smartRoute.data) == null ? void 0 : _r.positionAvailability) == null ? void 0 : _s.totalSellableShares) === "number") && (isExecutionPositionsLoading || isExecutionPositionsFetching);
|
|
3970
4449
|
const displayedCurrentSellableShares = useMemo(() => {
|
|
3971
4450
|
if (!Number.isFinite(currentSellableShares) || currentSellableShares <= 0) return 0;
|
|
3972
4451
|
return floorToDecimals(currentSellableShares, SELL_SHARE_DISPLAY_DECIMALS);
|
|
@@ -3976,7 +4455,7 @@ var PlaceOrder = ({
|
|
|
3976
4455
|
[maxSellableShares]
|
|
3977
4456
|
);
|
|
3978
4457
|
const isAtMaxSellableShares = isSell && maxSellableShares > 0 && Math.abs(internalAmount - maxSellableShares) < 1e-9;
|
|
3979
|
-
const isSellAmountAboveAvailability = isSell && ((
|
|
4458
|
+
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
4459
|
useEffect2(() => {
|
|
3981
4460
|
if (submissionProgressState != null) return;
|
|
3982
4461
|
if (!isSell || isCurrentSellableSharesLoading) return;
|
|
@@ -4012,10 +4491,11 @@ var PlaceOrder = ({
|
|
|
4012
4491
|
isSell,
|
|
4013
4492
|
onAmountChange,
|
|
4014
4493
|
scopedSelectedOutcomeId,
|
|
4015
|
-
(
|
|
4016
|
-
(
|
|
4494
|
+
(_w = (_v = smartRoute.data) == null ? void 0 : _v.positionAvailability) == null ? void 0 : _w.totalSellableShares,
|
|
4495
|
+
(_x = smartRoute.data) == null ? void 0 : _x.venueMarketOutcomeId,
|
|
4017
4496
|
submissionProgressState
|
|
4018
4497
|
]);
|
|
4498
|
+
const scopedSmartRouteData = ((_y = smartRoute.data) == null ? void 0 : _y.venueMarketOutcomeId) === scopedSelectedOutcomeId ? smartRoute.data : null;
|
|
4019
4499
|
const routeCards = useMemo(() => {
|
|
4020
4500
|
const eventVenues = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets.map((market) => market.venue);
|
|
4021
4501
|
if (isSell) {
|
|
@@ -4024,42 +4504,66 @@ var PlaceOrder = ({
|
|
|
4024
4504
|
geoBlockedVenues: inheritedBuyGeoBlockedVenues,
|
|
4025
4505
|
labels: tradingLabels,
|
|
4026
4506
|
requestedSellShares: debouncedAmount,
|
|
4027
|
-
smartQuoteData:
|
|
4507
|
+
smartQuoteData: scopedSmartRouteData,
|
|
4028
4508
|
venueQuotes: venueSellQuotes.quotes.map((venueQuote) => ({
|
|
4029
4509
|
request: venueQuote.request,
|
|
4030
4510
|
quoteData: venueQuote.data
|
|
4031
4511
|
}))
|
|
4032
4512
|
});
|
|
4033
4513
|
}
|
|
4034
|
-
return
|
|
4514
|
+
return scopedSmartRouteData ? buildLiveRouteCards({
|
|
4035
4515
|
eventVenues,
|
|
4036
4516
|
labels: tradingLabels,
|
|
4037
|
-
quoteData:
|
|
4517
|
+
quoteData: scopedSmartRouteData,
|
|
4038
4518
|
tradeSide: "buy"
|
|
4039
4519
|
}) : [];
|
|
4040
4520
|
}, [
|
|
4041
4521
|
debouncedAmount,
|
|
4042
|
-
|
|
4522
|
+
scopedSmartRouteData,
|
|
4043
4523
|
tradingLabels,
|
|
4044
4524
|
inheritedBuyGeoBlockedVenues,
|
|
4045
4525
|
isSell,
|
|
4046
4526
|
scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets,
|
|
4047
4527
|
venueSellQuotes.quotes
|
|
4048
4528
|
]);
|
|
4049
|
-
const
|
|
4529
|
+
const routeCardsScopeKey = [
|
|
4530
|
+
resolvedExecutionMode,
|
|
4531
|
+
(_z = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id) != null ? _z : "",
|
|
4532
|
+
scopedSelectedOutcomeId != null ? scopedSelectedOutcomeId : "",
|
|
4533
|
+
internalTab
|
|
4534
|
+
].join(":");
|
|
4535
|
+
const isRouteCardsTransient = isQuoteInputEditing || smartRoute.isLoading || smartRoute.isFetching || !scopedSmartRouteData && isSmartRouteEnabled && !smartRoute.error || isSell && (venueSellQuotes.isLoading || venueSellQuotes.isFetching);
|
|
4536
|
+
if (routeCards.length > 0) {
|
|
4537
|
+
lastValidRouteCardsRef.current = { cards: routeCards, scopeKey: routeCardsScopeKey };
|
|
4538
|
+
}
|
|
4539
|
+
const displayedRouteCards = routeCards.length > 0 ? routeCards : isRouteCardsTransient && ((_A = lastValidRouteCardsRef.current) == null ? void 0 : _A.scopeKey) === routeCardsScopeKey ? lastValidRouteCardsRef.current.cards : [];
|
|
4540
|
+
const selectedManualRouteCard = manualRouteSelectionIdentity ? routeCards.find(
|
|
4541
|
+
(card) => getPlaceOrderRouteCardIdentity(card) === manualRouteSelectionIdentity
|
|
4542
|
+
) : void 0;
|
|
4050
4543
|
const resolvedSelectedRouteCardId = useMemo(() => {
|
|
4051
4544
|
var _a2;
|
|
4052
|
-
if (
|
|
4545
|
+
if (selectedManualRouteCard && !selectedManualRouteCard.isUnavailable) {
|
|
4546
|
+
return selectedManualRouteCard.id;
|
|
4547
|
+
}
|
|
4548
|
+
if (manualRouteSelectionIdentity && selectedRouteCardId && isRouteCardsTransient) {
|
|
4053
4549
|
return selectedRouteCardId;
|
|
4054
4550
|
}
|
|
4055
|
-
if (selectedRouteCardId && isSellQuoteTransitioning) return selectedRouteCardId;
|
|
4056
4551
|
if (routeCards.length === 0) return null;
|
|
4057
4552
|
return resolveDefaultRouteCardId(routeCards, isSell ? void 0 : (_a2 = smartRoute.data) == null ? void 0 : _a2.status);
|
|
4058
|
-
}, [
|
|
4553
|
+
}, [
|
|
4554
|
+
isSell,
|
|
4555
|
+
isRouteCardsTransient,
|
|
4556
|
+
manualRouteSelectionIdentity,
|
|
4557
|
+
routeCards,
|
|
4558
|
+
selectedManualRouteCard,
|
|
4559
|
+
selectedRouteCardId,
|
|
4560
|
+
(_B = smartRoute.data) == null ? void 0 : _B.status
|
|
4561
|
+
]);
|
|
4059
4562
|
useEffect2(() => {
|
|
4060
4563
|
if (routeCards.length === 0) {
|
|
4061
|
-
if (
|
|
4564
|
+
if (isRouteCardsTransient) return;
|
|
4062
4565
|
setSelectedRouteCardId(null);
|
|
4566
|
+
setManualRouteSelectionIdentity(null);
|
|
4063
4567
|
setIsRoutesExpanded(false);
|
|
4064
4568
|
setIsSplitDetailOpen(false);
|
|
4065
4569
|
return;
|
|
@@ -4067,10 +4571,15 @@ var PlaceOrder = ({
|
|
|
4067
4571
|
if (resolvedSelectedRouteCardId !== selectedRouteCardId) {
|
|
4068
4572
|
setSelectedRouteCardId(resolvedSelectedRouteCardId);
|
|
4069
4573
|
}
|
|
4574
|
+
if (manualRouteSelectionIdentity && !selectedManualRouteCard && !isRouteCardsTransient) {
|
|
4575
|
+
setManualRouteSelectionIdentity(null);
|
|
4576
|
+
}
|
|
4070
4577
|
}, [
|
|
4071
|
-
|
|
4578
|
+
isRouteCardsTransient,
|
|
4579
|
+
manualRouteSelectionIdentity,
|
|
4072
4580
|
resolvedSelectedRouteCardId,
|
|
4073
4581
|
routeCards.length,
|
|
4582
|
+
selectedManualRouteCard,
|
|
4074
4583
|
selectedRouteCardId
|
|
4075
4584
|
]);
|
|
4076
4585
|
const isSubmissionLocked = submissionProgressState != null;
|
|
@@ -4104,19 +4613,20 @@ var PlaceOrder = ({
|
|
|
4104
4613
|
}, [scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id, scopedSelectedOutcomeId]);
|
|
4105
4614
|
useEffect2(() => {
|
|
4106
4615
|
setSelectedRouteCardId(null);
|
|
4616
|
+
setManualRouteSelectionIdentity(null);
|
|
4107
4617
|
setIsRoutesExpanded(false);
|
|
4108
4618
|
setIsSplitDetailOpen(false);
|
|
4109
4619
|
}, [executionType, internalTab, scopedSelectedOutcomeId]);
|
|
4110
4620
|
const orderedRouteCards = routeCards;
|
|
4111
|
-
const selectedRouteCard = (
|
|
4621
|
+
const selectedRouteCard = (_D = (_C = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _C : orderedRouteCards[0]) != null ? _D : null;
|
|
4112
4622
|
const isKalshiRoute = useMemo(() => {
|
|
4113
|
-
if (isLimitOrder) return (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) ===
|
|
4623
|
+
if (isLimitOrder) return (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) === Venue3.kalshi;
|
|
4114
4624
|
if (selectedRouteCard) {
|
|
4115
4625
|
return selectedRouteCard.venue === "kalshi" || selectedRouteCard.quoteData.fills.some((f) => f.venue === "kalshi");
|
|
4116
4626
|
}
|
|
4117
4627
|
return (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === "kalshi";
|
|
4118
4628
|
}, [isLimitOrder, selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue, selectedRouteCard, scopedSelectedMarket]);
|
|
4119
|
-
const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (
|
|
4629
|
+
const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (_E = liveBalanceState.kalshiBalance) != null ? _E : 0 : liveAvailableBalance;
|
|
4120
4630
|
const legacyKalshiAccount = useMemo(
|
|
4121
4631
|
() => {
|
|
4122
4632
|
var _a2;
|
|
@@ -4124,8 +4634,8 @@ var PlaceOrder = ({
|
|
|
4124
4634
|
},
|
|
4125
4635
|
[user == null ? void 0 : user.venueAccounts]
|
|
4126
4636
|
);
|
|
4127
|
-
const isKalshiAccountActive = (
|
|
4128
|
-
const isKalshiVerified = ((
|
|
4637
|
+
const isKalshiAccountActive = (_F = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.connected) != null ? _F : (legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.status) === "active";
|
|
4638
|
+
const isKalshiVerified = ((_G = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.kycStatus) != null ? _G : legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.kycStatus) === "verified";
|
|
4129
4639
|
const hasKalshiConnectionState = kalshiKeyStatus !== void 0 || (user == null ? void 0 : user.venueAccounts) != null;
|
|
4130
4640
|
const isKalshiAvailable = getVenueAvailabilityState({
|
|
4131
4641
|
venueId: "kalshi",
|
|
@@ -4139,7 +4649,7 @@ var PlaceOrder = ({
|
|
|
4139
4649
|
yield onConnectKalshi(credentials);
|
|
4140
4650
|
} else {
|
|
4141
4651
|
yield aggClient.upsertVenueKey({
|
|
4142
|
-
venue:
|
|
4652
|
+
venue: Venue3.kalshi,
|
|
4143
4653
|
credentials: {
|
|
4144
4654
|
keyId: credentials.apiKeyId,
|
|
4145
4655
|
privateKey: credentials.privateKey
|
|
@@ -4152,7 +4662,7 @@ var PlaceOrder = ({
|
|
|
4152
4662
|
[aggClient, onConnectKalshi, refetchKalshiKeyStatus]
|
|
4153
4663
|
);
|
|
4154
4664
|
const needsKycVerification = isAuthenticated && hasKalshiConnectionState && isKalshiRoute && isKalshiAccountActive && !isKalshiVerified;
|
|
4155
|
-
const verifyKalshiConnectionLabel = (
|
|
4665
|
+
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
4666
|
const handleRouteCardSelect = useCallback2(
|
|
4157
4667
|
(cardId) => {
|
|
4158
4668
|
const card = routeCards.find((routeCard) => routeCard.id === cardId);
|
|
@@ -4164,6 +4674,7 @@ var PlaceOrder = ({
|
|
|
4164
4674
|
}
|
|
4165
4675
|
}
|
|
4166
4676
|
setSelectedRouteCardId(cardId);
|
|
4677
|
+
setManualRouteSelectionIdentity(getPlaceOrderRouteCardIdentity(card));
|
|
4167
4678
|
setIsSplitDetailOpen(false);
|
|
4168
4679
|
if (!isSell || card.kind !== "venue" || !card.insufficientInventory || card.availableShares == null) {
|
|
4169
4680
|
return;
|
|
@@ -4184,18 +4695,68 @@ var PlaceOrder = ({
|
|
|
4184
4695
|
]
|
|
4185
4696
|
);
|
|
4186
4697
|
const executionProgress = useExecutionProgress({
|
|
4187
|
-
orderIds: (
|
|
4188
|
-
quoteId: (
|
|
4698
|
+
orderIds: (_L = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) != null ? _L : null,
|
|
4699
|
+
quoteId: (_M = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _M : null,
|
|
4189
4700
|
mode: isPaperMode ? "paper" : void 0,
|
|
4190
|
-
enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((
|
|
4701
|
+
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)
|
|
4702
|
+
});
|
|
4703
|
+
const executionProgressFloorRef = useRef2({
|
|
4704
|
+
quoteId: null,
|
|
4705
|
+
value: 0
|
|
4191
4706
|
});
|
|
4192
|
-
const selectedOutcomeLabel = (
|
|
4193
|
-
const headerImage = (
|
|
4194
|
-
const headerTitle = (
|
|
4195
|
-
const headerSubtitle = (
|
|
4707
|
+
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 : "";
|
|
4708
|
+
const headerImage = (_S = (_R = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.image) != null ? _R : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.image) != null ? _S : null;
|
|
4709
|
+
const headerTitle = (_U = (_T = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _T : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _U : "";
|
|
4710
|
+
const headerSubtitle = (_V = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _V : "";
|
|
4711
|
+
const executionDateSource = (_W = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate) != null ? _W : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.endDate;
|
|
4712
|
+
const executionDateLabel = executionDateSource ? getTradingDateLabel(executionDateSource) : "";
|
|
4713
|
+
const executionQuoteData = (_Y = (_X = submissionProgressState == null ? void 0 : submissionProgressState.quoteData) != null ? _X : selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _Y : null;
|
|
4714
|
+
const executionOrderGroups = useMemo(() => {
|
|
4715
|
+
var _a2, _b2, _c2;
|
|
4716
|
+
if (!executionQuoteData) return [];
|
|
4717
|
+
return deriveExecutionOrderGroups({
|
|
4718
|
+
quoteData: executionQuoteData,
|
|
4719
|
+
labels: tradingLabels,
|
|
4720
|
+
tradeSide: internalTab,
|
|
4721
|
+
hasSubmissionResponse: !!((_a2 = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _a2.length),
|
|
4722
|
+
executionSteps: executionProgress.executionSteps,
|
|
4723
|
+
executionOrders: (_b2 = executionProgress.executionOrders) != null ? _b2 : [],
|
|
4724
|
+
rawExecutionSteps: (_c2 = executionProgress.rawExecutionSteps) != null ? _c2 : [],
|
|
4725
|
+
terminalOrderEvents: executionProgress.terminalOrderEvents
|
|
4726
|
+
});
|
|
4727
|
+
}, [
|
|
4728
|
+
executionProgress.executionSteps,
|
|
4729
|
+
executionProgress.executionOrders,
|
|
4730
|
+
executionProgress.rawExecutionSteps,
|
|
4731
|
+
executionProgress.terminalOrderEvents,
|
|
4732
|
+
executionQuoteData,
|
|
4733
|
+
internalTab,
|
|
4734
|
+
(_Z = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _Z.length,
|
|
4735
|
+
tradingLabels
|
|
4736
|
+
]);
|
|
4737
|
+
const executionProgressPercent = useMemo(() => {
|
|
4738
|
+
var _a2, _b2, _c2;
|
|
4739
|
+
const quoteId = (_a2 = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _a2 : null;
|
|
4740
|
+
const previousProgress = executionProgressFloorRef.current.quoteId === quoteId ? executionProgressFloorRef.current.value : 0;
|
|
4741
|
+
const nextProgress = calculateExecutionProgress({
|
|
4742
|
+
orderIds: (_b2 = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) != null ? _b2 : [],
|
|
4743
|
+
submittedOrderIds: executionProgress.submittedOrders.map((order) => order.orderId),
|
|
4744
|
+
executionSteps: executionProgress.executionSteps,
|
|
4745
|
+
executionOrders: (_c2 = executionProgress.executionOrders) != null ? _c2 : [],
|
|
4746
|
+
minimumProgress: previousProgress
|
|
4747
|
+
});
|
|
4748
|
+
executionProgressFloorRef.current = { quoteId, value: nextProgress };
|
|
4749
|
+
return nextProgress;
|
|
4750
|
+
}, [
|
|
4751
|
+
executionProgress.executionOrders,
|
|
4752
|
+
executionProgress.executionSteps,
|
|
4753
|
+
executionProgress.submittedOrders,
|
|
4754
|
+
submissionProgressState == null ? void 0 : submissionProgressState.orderIds,
|
|
4755
|
+
submissionProgressState == null ? void 0 : submissionProgressState.quoteId
|
|
4756
|
+
]);
|
|
4196
4757
|
const buildExecutionSummary = useCallback2(
|
|
4197
4758
|
(quoteData, executionVenue, orderId, partialFillSummary) => {
|
|
4198
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
4759
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2;
|
|
4199
4760
|
if (!quoteData) return void 0;
|
|
4200
4761
|
const actualEconomics = resolveActualExecutionEconomics({
|
|
4201
4762
|
quoteData,
|
|
@@ -4207,7 +4768,7 @@ var PlaceOrder = ({
|
|
|
4207
4768
|
const sharesSide = actualEconomics.hasActualFillData ? actualEconomics.actualTotalFilled : quoteData.totalFilled;
|
|
4208
4769
|
const avgPriceValue = actualEconomics.hasActualFillData ? actualEconomics.avgExecutionPrice : quoteData.totalFilled > 0 ? quoteData.rawExecCost / quoteData.totalFilled : 0;
|
|
4209
4770
|
const avgPriceLabel = avgPriceValue > 0 ? getTradingRoutePriceLabel(avgPriceValue) : "\u2014";
|
|
4210
|
-
const actionPriceLabel = avgPriceValue > 0 ?
|
|
4771
|
+
const actionPriceLabel = avgPriceValue > 0 ? `avg. ${avgPriceLabel}` : avgPriceLabel;
|
|
4211
4772
|
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
4773
|
const sharesLabel = sharesSide.toLocaleString("en-US", {
|
|
4213
4774
|
minimumFractionDigits: 2,
|
|
@@ -4216,11 +4777,12 @@ var PlaceOrder = ({
|
|
|
4216
4777
|
const payoutLabel = formatUsd(usdSide);
|
|
4217
4778
|
const amountLabel = internalTab === "sell" ? sharesLabel : payoutLabel;
|
|
4218
4779
|
const toWinLabel = internalTab === "sell" ? payoutLabel : formatUsd(sharesSide);
|
|
4219
|
-
const potentialReturnValue =
|
|
4780
|
+
const potentialReturnValue = getPlaceOrderPotentialReturn(quoteData);
|
|
4220
4781
|
const potentialReturnLabel = potentialReturnValue > 0 ? formatUsd(potentialReturnValue) : void 0;
|
|
4221
4782
|
const eventTitle = (_f2 = (_e2 = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _e2 : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _f2 : "";
|
|
4222
4783
|
const eventDateSource = (_g2 = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate) != null ? _g2 : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.endDate;
|
|
4223
4784
|
return {
|
|
4785
|
+
resultState: partialFillSummary ? "partial" : "success",
|
|
4224
4786
|
tradeSide: internalTab,
|
|
4225
4787
|
shares: sharesLabel,
|
|
4226
4788
|
avgPrice: avgPriceLabel,
|
|
@@ -4233,6 +4795,20 @@ var PlaceOrder = ({
|
|
|
4233
4795
|
amountLabel,
|
|
4234
4796
|
toWinLabel,
|
|
4235
4797
|
potentialReturnLabel,
|
|
4798
|
+
requestedAmountLabel: internalTab === "buy" ? formatUsd(internalAmount) : tradingLabels.executionShares(
|
|
4799
|
+
internalAmount.toLocaleString("en-US", { maximumFractionDigits: 2 })
|
|
4800
|
+
),
|
|
4801
|
+
executionGroups: deriveExecutionOrderGroups({
|
|
4802
|
+
quoteData,
|
|
4803
|
+
labels: tradingLabels,
|
|
4804
|
+
tradeSide: internalTab,
|
|
4805
|
+
hasSubmissionResponse: true,
|
|
4806
|
+
executionSteps: executionProgress.executionSteps,
|
|
4807
|
+
executionOrders: (_h2 = executionProgress.executionOrders) != null ? _h2 : [],
|
|
4808
|
+
rawExecutionSteps: (_i2 = executionProgress.rawExecutionSteps) != null ? _i2 : [],
|
|
4809
|
+
terminalOrderEvents: executionProgress.terminalOrderEvents,
|
|
4810
|
+
forceCompleted: true
|
|
4811
|
+
}),
|
|
4236
4812
|
executionStepGroups: (partialFillSummary == null ? void 0 : partialFillSummary.kind) === "partial_fill" ? buildPlaceOrderExecutionStepGroupsFromFailureSummary({
|
|
4237
4813
|
labels: tradingLabels,
|
|
4238
4814
|
summary: partialFillSummary,
|
|
@@ -4241,7 +4817,7 @@ var PlaceOrder = ({
|
|
|
4241
4817
|
treatPartialAsComplete: true
|
|
4242
4818
|
}) : buildPlaceOrderExecutionStepGroups({
|
|
4243
4819
|
labels: tradingLabels,
|
|
4244
|
-
orderId: orderId != null ? orderId : (
|
|
4820
|
+
orderId: orderId != null ? orderId : (_j2 = executionProgress.submittedOrders[0]) == null ? void 0 : _j2.orderId,
|
|
4245
4821
|
quoteData,
|
|
4246
4822
|
submittedOrders: executionProgress.submittedOrders
|
|
4247
4823
|
}),
|
|
@@ -4258,9 +4834,13 @@ var PlaceOrder = ({
|
|
|
4258
4834
|
},
|
|
4259
4835
|
[
|
|
4260
4836
|
executionProgress.submittedOrders,
|
|
4837
|
+
executionProgress.executionSteps,
|
|
4838
|
+
executionProgress.executionOrders,
|
|
4839
|
+
executionProgress.rawExecutionSteps,
|
|
4261
4840
|
executionProgress.terminalOrderEvents,
|
|
4262
4841
|
headerImage,
|
|
4263
4842
|
internalTab,
|
|
4843
|
+
internalAmount,
|
|
4264
4844
|
scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate,
|
|
4265
4845
|
scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title,
|
|
4266
4846
|
scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.endDate,
|
|
@@ -4294,11 +4874,15 @@ var PlaceOrder = ({
|
|
|
4294
4874
|
label: "dag_progress",
|
|
4295
4875
|
data: dp
|
|
4296
4876
|
});
|
|
4297
|
-
const normalizedRows =
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4877
|
+
const normalizedRows = executionOrderGroups.flatMap(
|
|
4878
|
+
(group) => group.steps.map((step) => ({
|
|
4879
|
+
id: step.id,
|
|
4880
|
+
kind: step.kind,
|
|
4881
|
+
label: step.status === "done" ? step.completedLabel : step.pendingLabel,
|
|
4882
|
+
status: step.status,
|
|
4883
|
+
venue: group.venue
|
|
4884
|
+
}))
|
|
4885
|
+
);
|
|
4302
4886
|
debugStore.setNormalizedSteps(debugAttemptId, normalizedRows);
|
|
4303
4887
|
debugStore.appendEvent(debugAttemptId, {
|
|
4304
4888
|
kind: "normalized_steps",
|
|
@@ -4332,7 +4916,7 @@ var PlaceOrder = ({
|
|
|
4332
4916
|
}
|
|
4333
4917
|
return __spreadProps(__spreadValues({}, prev), { dagProgress: dp });
|
|
4334
4918
|
});
|
|
4335
|
-
}, [executionProgress.dagProgress, tradingLabels]);
|
|
4919
|
+
}, [executionOrderGroups, executionProgress.dagProgress, tradingLabels]);
|
|
4336
4920
|
useEffect2(() => {
|
|
4337
4921
|
const orderIds = submissionProgressState == null ? void 0 : submissionProgressState.orderIds;
|
|
4338
4922
|
if (!(orderIds == null ? void 0 : orderIds.length)) return;
|
|
@@ -4353,7 +4937,7 @@ var PlaceOrder = ({
|
|
|
4353
4937
|
}
|
|
4354
4938
|
if (aggregateStatus === "pending") return;
|
|
4355
4939
|
setSubmissionProgressState((prev) => {
|
|
4356
|
-
var _a2, _b2, _c2;
|
|
4940
|
+
var _a2, _b2, _c2, _d2;
|
|
4357
4941
|
if (!prev || prev.phase === "success" || prev.phase === "failed") return prev;
|
|
4358
4942
|
if (aggregateStatus === "full_success") {
|
|
4359
4943
|
const primaryFilledEvent = executionProgress.terminalOrderEvents.find(
|
|
@@ -4363,9 +4947,9 @@ var PlaceOrder = ({
|
|
|
4363
4947
|
phase: "success",
|
|
4364
4948
|
orderId: (_a2 = primaryFilledEvent == null ? void 0 : primaryFilledEvent.orderId) != null ? _a2 : prev.orderId,
|
|
4365
4949
|
summary: buildExecutionSummary(
|
|
4366
|
-
selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData,
|
|
4950
|
+
(_b2 = prev.quoteData) != null ? _b2 : selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData,
|
|
4367
4951
|
prev.executionVenue,
|
|
4368
|
-
(
|
|
4952
|
+
(_c2 = primaryFilledEvent == null ? void 0 : primaryFilledEvent.orderId) != null ? _c2 : prev.orderId
|
|
4369
4953
|
)
|
|
4370
4954
|
});
|
|
4371
4955
|
}
|
|
@@ -4380,7 +4964,7 @@ var PlaceOrder = ({
|
|
|
4380
4964
|
});
|
|
4381
4965
|
return __spreadProps(__spreadValues({}, prev), {
|
|
4382
4966
|
phase: "failed",
|
|
4383
|
-
orderId: (
|
|
4967
|
+
orderId: (_d2 = firstFailedEvent == null ? void 0 : firstFailedEvent.orderId) != null ? _d2 : prev.orderId,
|
|
4384
4968
|
errorMessage
|
|
4385
4969
|
});
|
|
4386
4970
|
}
|
|
@@ -4393,7 +4977,7 @@ var PlaceOrder = ({
|
|
|
4393
4977
|
submissionProgressState == null ? void 0 : submissionProgressState.orderIds,
|
|
4394
4978
|
tradingLabels
|
|
4395
4979
|
]);
|
|
4396
|
-
const estDurationMs =
|
|
4980
|
+
const estDurationMs = executionQuoteData && typeof executionQuoteData.estDurationMs === "number" ? executionQuoteData.estDurationMs : 6e4;
|
|
4397
4981
|
useEffect2(() => {
|
|
4398
4982
|
const phase = submissionProgressState == null ? void 0 : submissionProgressState.phase;
|
|
4399
4983
|
if (phase !== "submitting" && phase !== "executing") return;
|
|
@@ -4490,23 +5074,24 @@ var PlaceOrder = ({
|
|
|
4490
5074
|
queryClient,
|
|
4491
5075
|
submissionProgressState
|
|
4492
5076
|
]);
|
|
4493
|
-
const activeQuoteData = isLimitOrder ? null : (
|
|
4494
|
-
const visibleMarketRouteCards =
|
|
5077
|
+
const activeQuoteData = isLimitOrder ? null : (__ = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? __ : scopedSmartRouteData;
|
|
5078
|
+
const visibleMarketRouteCards = displayedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT && !isRoutesExpanded ? displayedRouteCards.slice(0, PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT) : displayedRouteCards;
|
|
4495
5079
|
const hasEnteredAmount = internalAmount > 0;
|
|
4496
5080
|
const isQuoteLoading = !isLimitOrder && hasEnteredAmount && (isSell && isQuoteInputEditing || smartRoute.isLoading || !isSell && smartRoute.isFetching || isSell && venueSellQuotes.isLoading);
|
|
4497
5081
|
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 !==
|
|
5082
|
+
const selectedRouteFills = (_$ = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills) != null ? _$ : [];
|
|
5083
|
+
const isKalshiOnlyRoute = isKalshiRoute && ((selectedRouteCard == null ? void 0 : selectedRouteCard.venue) === Venue3.kalshi || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue === Venue3.kalshi));
|
|
5084
|
+
const isOnchainOnlyRoute = !isKalshiRoute || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue !== Venue3.kalshi);
|
|
5085
|
+
const kalshiRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue === Venue3.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
|
|
5086
|
+
const onchainRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue !== Venue3.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
|
|
4503
5087
|
const resolvedKalshiRequiredAmount = isKalshiOnlyRoute || isKalshiRoute && selectedRouteFills.length === 0 ? internalAmount : kalshiRequiredAmount;
|
|
4504
5088
|
const resolvedOnchainRequiredAmount = isOnchainOnlyRoute || !isKalshiRoute && selectedRouteFills.length === 0 ? internalAmount : onchainRequiredAmount;
|
|
4505
|
-
const isKalshiBalanceInsufficient = !isPaperMode && isKalshiRoute && resolvedKalshiRequiredAmount > ((
|
|
5089
|
+
const isKalshiBalanceInsufficient = !isPaperMode && isKalshiRoute && resolvedKalshiRequiredAmount > ((_aa = liveBalanceState.kalshiBalance) != null ? _aa : 0);
|
|
4506
5090
|
const isOnchainBalanceInsufficient = resolvedOnchainRequiredAmount > liveAvailableBalance;
|
|
4507
5091
|
const isInsufficientBalance = !isSell && isAuthenticated && hasEnteredAmount && !isBalanceLoading && (isLimitOrder ? internalAmount > totalBalance : isPaperMode ? internalAmount > paperTotalBalance : isKalshiBalanceInsufficient || isOnchainBalanceInsufficient);
|
|
4508
5092
|
const isQuoteInsufficientBalance = !isLimitOrder && (activeQuoteData == null ? void 0 : activeQuoteData.status) === "insufficient_balance";
|
|
4509
5093
|
const shouldShowInsufficientBalanceAlert = isInsufficientBalance || isQuoteInsufficientBalance;
|
|
5094
|
+
const insufficientBalanceDetails = isQuoteInsufficientBalance && (activeQuoteData == null ? void 0 : activeQuoteData.error) && activeQuoteData.error !== tradingLabels.insufficientBalance ? activeQuoteData.error : null;
|
|
4510
5095
|
const isSelectedVenueInventoryInsufficient = isSell && (selectedRouteCard == null ? void 0 : selectedRouteCard.kind) === "venue" && selectedRouteCard.insufficientInventory === true;
|
|
4511
5096
|
const isBelowClientMinimum = !isSell && hasEnteredAmount && internalAmount < MIN_BUY_ORDER_AMOUNT;
|
|
4512
5097
|
const isBelowVenueMinimumFromQuote = isQuoteBelowVenueMinimum(activeQuoteData);
|
|
@@ -4538,31 +5123,30 @@ var PlaceOrder = ({
|
|
|
4538
5123
|
});
|
|
4539
5124
|
}, [isSell, orderedRouteCards.length, smartRoute.error, tradingLabels, venueSellQuotes.error]);
|
|
4540
5125
|
const progressActionLabel = (internalTab === "buy" ? tradingLabels.buyingOutcome(selectedOutcomeLabel) : tradingLabels.sellingOutcome(selectedOutcomeLabel)).trim();
|
|
4541
|
-
const
|
|
4542
|
-
|
|
5126
|
+
const retryRemainingAmount = useMemo(() => {
|
|
5127
|
+
return getCanonicalPlaceOrderUnfilledRemaining({
|
|
4543
5128
|
originalAmount: internalAmount,
|
|
4544
5129
|
tradeSide: internalTab,
|
|
4545
5130
|
terminalOrderEvents: executionProgress.terminalOrderEvents
|
|
4546
5131
|
});
|
|
5132
|
+
}, [executionProgress.terminalOrderEvents, internalAmount, internalTab]);
|
|
5133
|
+
const canRetryRemaining = useMemo(() => {
|
|
5134
|
+
if (retryRemainingAmount == null) return false;
|
|
4547
5135
|
const minRemainder = isSell ? MIN_SELL_ORDER_SHARES : MIN_BUY_ORDER_AMOUNT;
|
|
4548
|
-
return
|
|
4549
|
-
}, [
|
|
5136
|
+
return retryRemainingAmount >= minRemainder;
|
|
5137
|
+
}, [isSell, retryRemainingAmount]);
|
|
4550
5138
|
const PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD = 0.95;
|
|
4551
5139
|
const shouldAutoSkipPartialFill = useMemo(() => {
|
|
4552
|
-
if (internalAmount <= 0) return false;
|
|
4553
|
-
const
|
|
4554
|
-
originalAmount: internalAmount,
|
|
4555
|
-
tradeSide: internalTab,
|
|
4556
|
-
terminalOrderEvents: executionProgress.terminalOrderEvents
|
|
4557
|
-
});
|
|
4558
|
-
const filled = Math.max(0, internalAmount - remaining);
|
|
5140
|
+
if (internalAmount <= 0 || retryRemainingAmount == null) return false;
|
|
5141
|
+
const filled = Math.max(0, internalAmount - retryRemainingAmount);
|
|
4559
5142
|
const fillRatio = filled / internalAmount;
|
|
4560
5143
|
return fillRatio >= PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD || !canRetryRemaining;
|
|
4561
|
-
}, [canRetryRemaining,
|
|
5144
|
+
}, [canRetryRemaining, internalAmount, retryRemainingAmount]);
|
|
4562
5145
|
const failureSummary = useMemo(() => {
|
|
4563
5146
|
var _a2;
|
|
4564
5147
|
if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return void 0;
|
|
4565
|
-
|
|
5148
|
+
const quoteData = (_a2 = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _a2 : activeQuoteData;
|
|
5149
|
+
const baseSummary = buildPlaceOrderFailureSummary({
|
|
4566
5150
|
actionLabel: progressActionLabel,
|
|
4567
5151
|
canRetryRemaining,
|
|
4568
5152
|
errorMessage: submissionProgressState.errorMessage,
|
|
@@ -4571,40 +5155,122 @@ var PlaceOrder = ({
|
|
|
4571
5155
|
eventTitle: headerTitle || tradingLabels.orderFailureTitle,
|
|
4572
5156
|
labels: tradingLabels,
|
|
4573
5157
|
orderId: submissionProgressState.orderId,
|
|
4574
|
-
quoteData
|
|
5158
|
+
quoteData,
|
|
4575
5159
|
submittedOrders: executionProgress.submittedOrders,
|
|
4576
5160
|
terminalOrderEvents: executionProgress.terminalOrderEvents
|
|
4577
5161
|
});
|
|
5162
|
+
const summaryWithGroups = __spreadValues(__spreadValues({}, baseSummary), executionOrderGroups.length > 0 ? { executionGroups: executionOrderGroups } : {});
|
|
5163
|
+
if (baseSummary.kind !== "partial_fill") return summaryWithGroups;
|
|
5164
|
+
const actualEconomics = resolveActualExecutionEconomics({
|
|
5165
|
+
quoteData,
|
|
5166
|
+
tradeSide: internalTab,
|
|
5167
|
+
terminalOrderEvents: executionProgress.terminalOrderEvents,
|
|
5168
|
+
submittedOrders: executionProgress.submittedOrders
|
|
5169
|
+
});
|
|
5170
|
+
if (!actualEconomics.hasActualFillData) return summaryWithGroups;
|
|
5171
|
+
if (retryRemainingAmount == null) return summaryWithGroups;
|
|
5172
|
+
const remaining = retryRemainingAmount;
|
|
5173
|
+
const remainingLabel = isSell ? tradingLabels.executionShares(
|
|
5174
|
+
remaining.toLocaleString("en-US", { maximumFractionDigits: 2 })
|
|
5175
|
+
) : formatUsd(remaining);
|
|
5176
|
+
const filledAmountLabel = isSell ? tradingLabels.executionShares(
|
|
5177
|
+
actualEconomics.actualTotalFilled.toLocaleString("en-US", {
|
|
5178
|
+
maximumFractionDigits: 2
|
|
5179
|
+
})
|
|
5180
|
+
) : formatUsd(actualEconomics.actualRawExecCost);
|
|
5181
|
+
const payoutLabel = isSell ? formatUsd(actualEconomics.actualRawExecCost) : formatUsd(actualEconomics.actualTotalFilled);
|
|
5182
|
+
return __spreadProps(__spreadValues({}, summaryWithGroups), {
|
|
5183
|
+
actions: summaryWithGroups.actions.map(
|
|
5184
|
+
(action) => action.variant === "retry" ? __spreadProps(__spreadValues({}, action), { label: tradingLabels.orderTryRemaining(remainingLabel) }) : action
|
|
5185
|
+
),
|
|
5186
|
+
result: {
|
|
5187
|
+
averagePriceLabel: getTradingRoutePriceLabel(actualEconomics.avgExecutionPrice),
|
|
5188
|
+
filledAmountLabel,
|
|
5189
|
+
payoutLabel
|
|
5190
|
+
}
|
|
5191
|
+
});
|
|
4578
5192
|
}, [
|
|
4579
5193
|
activeQuoteData,
|
|
4580
5194
|
canRetryRemaining,
|
|
5195
|
+
executionOrderGroups,
|
|
4581
5196
|
executionProgress.submittedOrders,
|
|
4582
5197
|
executionProgress.terminalOrderEvents,
|
|
4583
5198
|
headerImage,
|
|
4584
5199
|
headerSubtitle,
|
|
4585
5200
|
headerTitle,
|
|
5201
|
+
internalTab,
|
|
5202
|
+
isSell,
|
|
4586
5203
|
progressActionLabel,
|
|
5204
|
+
retryRemainingAmount,
|
|
4587
5205
|
selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData,
|
|
4588
5206
|
submissionProgressState,
|
|
4589
5207
|
tradingLabels
|
|
4590
5208
|
]);
|
|
4591
5209
|
const displayedToWinHint = useMemo(() => {
|
|
4592
|
-
var _a2;
|
|
4593
5210
|
if (!selectedRouteCard) return "";
|
|
4594
|
-
const averagePrice = selectedRouteCard.
|
|
5211
|
+
const averagePrice = selectedRouteCard.executionPrice;
|
|
4595
5212
|
return averagePrice == null ? "" : tradingLabels.averagePrice(averagePrice);
|
|
4596
5213
|
}, [selectedRouteCard, tradingLabels]);
|
|
4597
|
-
const displayedToWinValue = (
|
|
5214
|
+
const displayedToWinValue = (_ba = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _ba : 0;
|
|
5215
|
+
const originalLimitPriceRaw = useMemo(() => toLimitPriceRaw(limitPrice), [limitPrice]);
|
|
5216
|
+
const limitPriceAdjustmentByVenue = useMemo(() => {
|
|
5217
|
+
var _a2;
|
|
5218
|
+
const adjustments = /* @__PURE__ */ new Map();
|
|
5219
|
+
for (const option of visibleLimitVenueOptions) {
|
|
5220
|
+
try {
|
|
5221
|
+
adjustments.set(
|
|
5222
|
+
option.venue,
|
|
5223
|
+
adjustLimitPriceRawToTick({
|
|
5224
|
+
limitPriceRaw: originalLimitPriceRaw,
|
|
5225
|
+
side: internalTab,
|
|
5226
|
+
tickSize: (_a2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _a2.tickSize
|
|
5227
|
+
})
|
|
5228
|
+
);
|
|
5229
|
+
} catch (e) {
|
|
5230
|
+
adjustments.set(
|
|
5231
|
+
option.venue,
|
|
5232
|
+
adjustLimitPriceRawToTick({
|
|
5233
|
+
limitPriceRaw: originalLimitPriceRaw,
|
|
5234
|
+
side: internalTab,
|
|
5235
|
+
tickSize: null
|
|
5236
|
+
})
|
|
5237
|
+
);
|
|
5238
|
+
}
|
|
5239
|
+
}
|
|
5240
|
+
return adjustments;
|
|
5241
|
+
}, [internalTab, limitVenueQuoteByVenue, originalLimitPriceRaw, visibleLimitVenueOptions]);
|
|
5242
|
+
const selectedLimitPriceAdjustment = selectedLimitVenueOption ? limitPriceAdjustmentByVenue.get(selectedLimitVenueOption.venue) : void 0;
|
|
5243
|
+
const selectedLimitPriceRaw = (_ca = selectedLimitPriceAdjustment == null ? void 0 : selectedLimitPriceAdjustment.adjustedPriceRaw) != null ? _ca : originalLimitPriceRaw;
|
|
5244
|
+
const limitPriceAdjustmentMessage = useMemo(() => {
|
|
5245
|
+
if (!selectedLimitVenueOption || !(selectedLimitPriceAdjustment == null ? void 0 : selectedLimitPriceAdjustment.adjusted) || !selectedLimitPriceAdjustment.tickSizeRaw) {
|
|
5246
|
+
return "";
|
|
5247
|
+
}
|
|
5248
|
+
return tradingLabels.limitPriceAdjusted(
|
|
5249
|
+
[getTradingVenueLabel(selectedLimitVenueOption.venue)],
|
|
5250
|
+
Number(BigInt(selectedLimitPriceAdjustment.tickSizeRaw)) / Number(LIMIT_ORDER_RAW_SCALE) * 100,
|
|
5251
|
+
formatLimitPriceRawLabel(originalLimitPriceRaw),
|
|
5252
|
+
internalTab,
|
|
5253
|
+
formatLimitPriceRawLabel(selectedLimitPriceAdjustment.adjustedPriceRaw)
|
|
5254
|
+
);
|
|
5255
|
+
}, [
|
|
5256
|
+
internalTab,
|
|
5257
|
+
originalLimitPriceRaw,
|
|
5258
|
+
selectedLimitPriceAdjustment,
|
|
5259
|
+
selectedLimitVenueOption,
|
|
5260
|
+
tradingLabels
|
|
5261
|
+
]);
|
|
4598
5262
|
const limitOrderPayload = useMemo(() => {
|
|
4599
5263
|
if (!selectedLimitVenueOption || internalAmount <= 0) return null;
|
|
4600
5264
|
if (limitPriceInputError) return null;
|
|
5265
|
+
const effectivePriceRaw = BigInt(selectedLimitPriceRaw);
|
|
5266
|
+
if (effectivePriceRaw <= BigInt(0) || effectivePriceRaw >= LIMIT_ORDER_RAW_SCALE) return null;
|
|
4601
5267
|
const expirationDate = resolveLimitExpirationDate({
|
|
4602
5268
|
expirationType: limitExpirationType,
|
|
4603
5269
|
customDate: limitExpirationDate,
|
|
4604
5270
|
customTime: limitExpirationTime
|
|
4605
5271
|
});
|
|
4606
5272
|
if (limitExpirationType !== "GTC" && !expirationDate) return null;
|
|
4607
|
-
const limitPriceRaw =
|
|
5273
|
+
const limitPriceRaw = selectedLimitPriceRaw;
|
|
4608
5274
|
const sizeRaw = toLimitSizeRaw({
|
|
4609
5275
|
amount: internalAmount,
|
|
4610
5276
|
limitPriceRaw,
|
|
@@ -4625,9 +5291,9 @@ var PlaceOrder = ({
|
|
|
4625
5291
|
limitExpirationDate,
|
|
4626
5292
|
limitExpirationTime,
|
|
4627
5293
|
limitExpirationType,
|
|
4628
|
-
limitPrice,
|
|
4629
5294
|
limitPriceInputError,
|
|
4630
|
-
selectedLimitVenueOption
|
|
5295
|
+
selectedLimitVenueOption,
|
|
5296
|
+
selectedLimitPriceRaw
|
|
4631
5297
|
]);
|
|
4632
5298
|
const resolvedLimitExpirationDraftDate = useMemo(() => {
|
|
4633
5299
|
return resolveLimitExpirationDate({
|
|
@@ -4672,7 +5338,13 @@ var PlaceOrder = ({
|
|
|
4672
5338
|
}, [internalTab, limitOrderPayload]);
|
|
4673
5339
|
const limitRouteCards = useMemo(() => {
|
|
4674
5340
|
return visibleLimitVenueOptions.map((option) => {
|
|
4675
|
-
var _a2, _b2;
|
|
5341
|
+
var _a2, _b2, _c2, _d2;
|
|
5342
|
+
const effectiveLimitPriceRaw = (_b2 = (_a2 = limitPriceAdjustmentByVenue.get(option.venue)) == null ? void 0 : _a2.adjustedPriceRaw) != null ? _b2 : originalLimitPriceRaw;
|
|
5343
|
+
const venueToWinValue = getLimitOrderToWinValue({
|
|
5344
|
+
amount: internalAmount,
|
|
5345
|
+
limitPriceRaw: effectiveLimitPriceRaw,
|
|
5346
|
+
side: internalTab
|
|
5347
|
+
});
|
|
4676
5348
|
const availabilityState = getVenueAvailabilityState({
|
|
4677
5349
|
venueId: option.venue,
|
|
4678
5350
|
disabledVenues,
|
|
@@ -4682,7 +5354,7 @@ var PlaceOrder = ({
|
|
|
4682
5354
|
const isUnavailable = isTradingBlocked || isGeoBlocked || availabilityState !== "available";
|
|
4683
5355
|
const currentPriceLabel = option.currentPrice == null ? "\u2014" : formatProbabilityCents(option.currentPrice, formatPrice);
|
|
4684
5356
|
const totalFees = getSmartRouteTotalFees(
|
|
4685
|
-
(
|
|
5357
|
+
(_d2 = (_c2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _c2.data) == null ? void 0 : _d2.feeBreakdown
|
|
4686
5358
|
);
|
|
4687
5359
|
const feeLabel = totalFees == null ? void 0 : formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
4688
5360
|
return {
|
|
@@ -4691,8 +5363,8 @@ var PlaceOrder = ({
|
|
|
4691
5363
|
isUnavailable,
|
|
4692
5364
|
kind: "venue",
|
|
4693
5365
|
label: getTradingVenueLabel(option.venue),
|
|
4694
|
-
numericValue:
|
|
4695
|
-
value: formatUsd(
|
|
5366
|
+
numericValue: venueToWinValue,
|
|
5367
|
+
value: formatUsd(venueToWinValue, {
|
|
4696
5368
|
maximumFractionDigits: 2,
|
|
4697
5369
|
minimumFractionDigits: 2
|
|
4698
5370
|
}),
|
|
@@ -4701,12 +5373,15 @@ var PlaceOrder = ({
|
|
|
4701
5373
|
});
|
|
4702
5374
|
}, [
|
|
4703
5375
|
disabledVenues,
|
|
4704
|
-
displayedLimitToWinValue,
|
|
4705
5376
|
formatPrice,
|
|
4706
5377
|
geoBlockedLimitVenues,
|
|
5378
|
+
internalAmount,
|
|
5379
|
+
internalTab,
|
|
4707
5380
|
isAppConfigLoading,
|
|
4708
5381
|
isTradingBlocked,
|
|
5382
|
+
limitPriceAdjustmentByVenue,
|
|
4709
5383
|
limitVenueQuoteByVenue,
|
|
5384
|
+
originalLimitPriceRaw,
|
|
4710
5385
|
tradingLabels,
|
|
4711
5386
|
visibleLimitVenueOptions
|
|
4712
5387
|
]);
|
|
@@ -4719,7 +5394,7 @@ var PlaceOrder = ({
|
|
|
4719
5394
|
);
|
|
4720
5395
|
}, [visibleLimitVenueOptions]);
|
|
4721
5396
|
const activeRouteCards = isLimitOrder ? limitRouteCards : visibleMarketRouteCards;
|
|
4722
|
-
const activeRouteCardCount = isLimitOrder ? limitRouteCards.length :
|
|
5397
|
+
const activeRouteCardCount = isLimitOrder ? limitRouteCards.length : displayedRouteCards.length;
|
|
4723
5398
|
const handleActiveRouteCardSelect = (cardId) => {
|
|
4724
5399
|
if (!isLimitOrder) {
|
|
4725
5400
|
handleRouteCardSelect(cardId);
|
|
@@ -4729,7 +5404,7 @@ var PlaceOrder = ({
|
|
|
4729
5404
|
if (!option) return;
|
|
4730
5405
|
setSelectedLimitVenue(option.venue);
|
|
4731
5406
|
};
|
|
4732
|
-
const displayedLimitToWinHint =
|
|
5407
|
+
const displayedLimitToWinHint = formatLimitPriceRawLabel(selectedLimitPriceRaw);
|
|
4733
5408
|
const activeFeeBreakdown = activeQuoteData == null ? void 0 : activeQuoteData.feeBreakdown;
|
|
4734
5409
|
const estimatedFeesValue = useMemo(() => {
|
|
4735
5410
|
const totalFees = getSmartRouteTotalFees(activeFeeBreakdown);
|
|
@@ -4772,14 +5447,14 @@ var PlaceOrder = ({
|
|
|
4772
5447
|
}, [activeFeeBreakdown, tradingLabels]);
|
|
4773
5448
|
const isActionLoading = isPrimaryActionLoading || executeManaged.isPending || placeLimitOrder.isPending || isBeforeActionPending;
|
|
4774
5449
|
const selectedLimitRouteCardId = selectedLimitVenueOption ? `limit-venue-${selectedLimitVenueOption.venue}-${selectedLimitVenueOption.venueMarketOutcomeId}` : null;
|
|
4775
|
-
const selectedLimitRouteCard = selectedLimitRouteCardId ? (
|
|
4776
|
-
const selectedRouteGeoBlocked = isLimitOrder ? (
|
|
5450
|
+
const selectedLimitRouteCard = selectedLimitRouteCardId ? (_da = limitRouteCards.find((card) => card.id === selectedLimitRouteCardId)) != null ? _da : null : null;
|
|
5451
|
+
const selectedRouteGeoBlocked = isLimitOrder ? (_ea = selectedLimitRouteCard == null ? void 0 : selectedLimitRouteCard.isUnavailable) != null ? _ea : false : (_fa = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _fa : false;
|
|
4777
5452
|
const geoBlockedVenuesFromWarnings = useMemo(
|
|
4778
5453
|
() => {
|
|
4779
5454
|
var _a2;
|
|
4780
5455
|
return extractGeoBlockedVenues((_a2 = smartRoute.data) == null ? void 0 : _a2.warnings);
|
|
4781
5456
|
},
|
|
4782
|
-
[(
|
|
5457
|
+
[(_ga = smartRoute.data) == null ? void 0 : _ga.warnings]
|
|
4783
5458
|
);
|
|
4784
5459
|
const isPrimaryVenueGeoBlocked = useMemo(() => {
|
|
4785
5460
|
var _a2, _b2;
|
|
@@ -4788,11 +5463,15 @@ var PlaceOrder = ({
|
|
|
4788
5463
|
return fills.length > 0 && fills.every((f) => geoBlockedVenuesFromWarnings.has(f.venue));
|
|
4789
5464
|
}, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
|
|
4790
5465
|
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 &&
|
|
5466
|
+
const shouldShowLowLiquidityWarning = !isQuoteInputEditing && !isQuoteLoading && (activeQuoteData == null ? void 0 : activeQuoteData.venueMarketOutcomeId) === scopedSelectedOutcomeId && isPlaceOrderAveragePriceWorse({
|
|
5467
|
+
averageExecutionPrice: selectedRouteCard == null ? void 0 : selectedRouteCard.executionPrice,
|
|
5468
|
+
displayedMarketPrice: selectedOutcomeDisplayPrice,
|
|
5469
|
+
tradeSide: internalTab
|
|
5470
|
+
});
|
|
4792
5471
|
const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
|
|
4793
5472
|
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 &&
|
|
5473
|
+
const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (isLimitOrder ? limitRouteCards.length > 0 : displayedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
|
|
5474
|
+
const shouldShowRouteToggle = !isLimitOrder && !isQuoteLoading && displayedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
|
|
4796
5475
|
const handleReturnToOrderForm = useCallback2(() => {
|
|
4797
5476
|
const submittedSelection = submittedSelectionRef.current;
|
|
4798
5477
|
submittedSelectionRef.current = null;
|
|
@@ -4800,6 +5479,7 @@ var PlaceOrder = ({
|
|
|
4800
5479
|
setSubmissionFeedback(null);
|
|
4801
5480
|
setIsRoutesExpanded(false);
|
|
4802
5481
|
setSelectedRouteCardId(null);
|
|
5482
|
+
setManualRouteSelectionIdentity(null);
|
|
4803
5483
|
if (submittedSelection && tradingContext) {
|
|
4804
5484
|
tradingContext.selectMarketAndOutcome(
|
|
4805
5485
|
submittedSelection.marketId,
|
|
@@ -4856,6 +5536,12 @@ var PlaceOrder = ({
|
|
|
4856
5536
|
return;
|
|
4857
5537
|
}
|
|
4858
5538
|
try {
|
|
5539
|
+
setSubmissionProgressState({
|
|
5540
|
+
executionVenue: resolveExecutionVenueFromQuote(quoteData),
|
|
5541
|
+
quoteData,
|
|
5542
|
+
quoteId,
|
|
5543
|
+
phase: "submitting"
|
|
5544
|
+
});
|
|
4859
5545
|
const response = yield executeManaged.mutateAsync(
|
|
4860
5546
|
isPaperMode ? { quoteId, mode: "paper" } : { quoteId }
|
|
4861
5547
|
);
|
|
@@ -4869,13 +5555,14 @@ var PlaceOrder = ({
|
|
|
4869
5555
|
orderIds: response.orderIds
|
|
4870
5556
|
});
|
|
4871
5557
|
}
|
|
4872
|
-
setSubmissionProgressState({
|
|
5558
|
+
setSubmissionProgressState((previous) => __spreadProps(__spreadValues({}, previous), {
|
|
4873
5559
|
executionVenue: resolveExecutionVenueFromQuote(quoteData),
|
|
4874
5560
|
orderId: response.orderIds[0],
|
|
4875
5561
|
orderIds: response.orderIds,
|
|
5562
|
+
quoteData,
|
|
4876
5563
|
quoteId: response.quoteId,
|
|
4877
5564
|
phase: "submitting"
|
|
4878
|
-
});
|
|
5565
|
+
}));
|
|
4879
5566
|
} catch (error) {
|
|
4880
5567
|
if (debugAttempt) {
|
|
4881
5568
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
@@ -4944,7 +5631,7 @@ var PlaceOrder = ({
|
|
|
4944
5631
|
});
|
|
4945
5632
|
}
|
|
4946
5633
|
const response = yield placeLimitOrder.mutateAsync(submissionLimitOrderPayload);
|
|
4947
|
-
const limitPriceLabel =
|
|
5634
|
+
const limitPriceLabel = formatLimitPriceRawLabel(response.limitPriceRaw);
|
|
4948
5635
|
const size = Number(BigInt(submissionLimitOrderPayload.sizeRaw)) / Number(LIMIT_ORDER_RAW_SCALE);
|
|
4949
5636
|
const sizeLabel = size.toLocaleString("en-US", {
|
|
4950
5637
|
minimumFractionDigits: 2,
|
|
@@ -4960,7 +5647,7 @@ var PlaceOrder = ({
|
|
|
4960
5647
|
) : sizeLabel;
|
|
4961
5648
|
const eventTitle = (_b2 = (_a2 = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _a2 : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _b2 : "";
|
|
4962
5649
|
const eventDateSource = (_c2 = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate) != null ? _c2 : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.endDate;
|
|
4963
|
-
const responseVenue =
|
|
5650
|
+
const responseVenue = Venue3[response.venue];
|
|
4964
5651
|
setSubmissionProgressState({
|
|
4965
5652
|
orderId: response.orderId,
|
|
4966
5653
|
orderIds: [response.orderId],
|
|
@@ -4996,7 +5683,6 @@ var PlaceOrder = ({
|
|
|
4996
5683
|
headerImage,
|
|
4997
5684
|
internalTab,
|
|
4998
5685
|
isPaperMode,
|
|
4999
|
-
limitPrice,
|
|
5000
5686
|
onPrimaryAction,
|
|
5001
5687
|
placeLimitOrder,
|
|
5002
5688
|
scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate,
|
|
@@ -5013,14 +5699,14 @@ var PlaceOrder = ({
|
|
|
5013
5699
|
(e) => e.event === "filled" || e.event === "partial_fill"
|
|
5014
5700
|
);
|
|
5015
5701
|
setSubmissionProgressState((prev) => {
|
|
5016
|
-
var _a2;
|
|
5702
|
+
var _a2, _b2;
|
|
5017
5703
|
if (!prev) return prev;
|
|
5018
5704
|
const orderId = (_a2 = primaryFilledEvent == null ? void 0 : primaryFilledEvent.orderId) != null ? _a2 : prev.orderId;
|
|
5019
5705
|
return __spreadProps(__spreadValues({}, prev), {
|
|
5020
5706
|
phase: "success",
|
|
5021
5707
|
orderId,
|
|
5022
5708
|
summary: buildExecutionSummary(
|
|
5023
|
-
selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData,
|
|
5709
|
+
(_b2 = prev.quoteData) != null ? _b2 : selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData,
|
|
5024
5710
|
prev.executionVenue,
|
|
5025
5711
|
orderId,
|
|
5026
5712
|
failureSummary
|
|
@@ -5039,26 +5725,22 @@ var PlaceOrder = ({
|
|
|
5039
5725
|
if (!shouldAutoSkipPartialFill) return;
|
|
5040
5726
|
handleSkipToSuccess();
|
|
5041
5727
|
}, [
|
|
5042
|
-
failureSummary
|
|
5728
|
+
failureSummary,
|
|
5043
5729
|
handleSkipToSuccess,
|
|
5044
5730
|
shouldAutoSkipPartialFill,
|
|
5045
5731
|
submissionProgressState == null ? void 0 : submissionProgressState.phase
|
|
5046
5732
|
]);
|
|
5047
5733
|
const handleRetrySubmission = useCallback2(() => __async(null, null, function* () {
|
|
5048
5734
|
var _a2, _b2, _c2, _d2, _e2;
|
|
5049
|
-
if (!orderEligibility.canPlaceOrder ||
|
|
5735
|
+
if (!orderEligibility.canPlaceOrder || !failureSummary || failureSummary.kind === "generic") {
|
|
5050
5736
|
handleReturnToOrderForm();
|
|
5051
5737
|
return;
|
|
5052
5738
|
}
|
|
5053
5739
|
setSubmissionFeedback(null);
|
|
5054
5740
|
let retryAmount = internalAmount;
|
|
5055
5741
|
let useRemainderRoute = false;
|
|
5056
|
-
if ((failureSummary == null ? void 0 : failureSummary.kind) === "partial_fill" && internalAmount > 0) {
|
|
5057
|
-
const remaining =
|
|
5058
|
-
originalAmount: internalAmount,
|
|
5059
|
-
tradeSide: internalTab,
|
|
5060
|
-
terminalOrderEvents: executionProgress.terminalOrderEvents
|
|
5061
|
-
});
|
|
5742
|
+
if ((failureSummary == null ? void 0 : failureSummary.kind) === "partial_fill" && internalAmount > 0 && retryRemainingAmount != null) {
|
|
5743
|
+
const remaining = retryRemainingAmount;
|
|
5062
5744
|
if (remaining > 0) {
|
|
5063
5745
|
retryAmount = remaining;
|
|
5064
5746
|
useRemainderRoute = true;
|
|
@@ -5117,7 +5799,8 @@ var PlaceOrder = ({
|
|
|
5117
5799
|
sellShares: isSell ? retryAmount : void 0,
|
|
5118
5800
|
chainBalances: chainBalancesOverride,
|
|
5119
5801
|
slipCapBps: 1e6,
|
|
5120
|
-
compareVenues:
|
|
5802
|
+
compareVenues: !failureSummary.retryVenue,
|
|
5803
|
+
allowedVenues: failureSummary.retryVenue ? [failureSummary.retryVenue] : void 0,
|
|
5121
5804
|
tradeSide: isSell ? "sell" : "buy",
|
|
5122
5805
|
mode: isPaperMode ? "paper" : void 0
|
|
5123
5806
|
});
|
|
@@ -5152,9 +5835,9 @@ var PlaceOrder = ({
|
|
|
5152
5835
|
quoteData: refetchedQuoteData,
|
|
5153
5836
|
tradeSide: internalTab
|
|
5154
5837
|
});
|
|
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)) {
|
|
5838
|
+
const refreshedSelectedCard = failureSummary.retryVenue ? refreshedCards.find((card) => card.venue === failureSummary.retryVenue) : selectedRouteCardId ? refreshedCards.find((card) => card.id === selectedRouteCardId) : void 0;
|
|
5839
|
+
const venueIdentityChanged = !failureSummary.retryVenue && !!originalSelectedCard && !!refreshedSelectedCard && !routeCardsHaveSameVenueIdentity(originalSelectedCard, refreshedSelectedCard);
|
|
5840
|
+
if ((selectedRouteCardId || failureSummary.retryVenue) && (!refreshedSelectedCard || venueIdentityChanged)) {
|
|
5158
5841
|
setSubmissionProgressState(null);
|
|
5159
5842
|
setSubmissionFeedback({
|
|
5160
5843
|
message: tradingLabels.selectedVenueUnavailable,
|
|
@@ -5177,8 +5860,7 @@ var PlaceOrder = ({
|
|
|
5177
5860
|
}), [
|
|
5178
5861
|
aggClient,
|
|
5179
5862
|
chainBalancesOverride,
|
|
5180
|
-
|
|
5181
|
-
failureSummary == null ? void 0 : failureSummary.kind,
|
|
5863
|
+
failureSummary,
|
|
5182
5864
|
handleExecuteQuote,
|
|
5183
5865
|
handleReturnToOrderForm,
|
|
5184
5866
|
internalAmount,
|
|
@@ -5188,6 +5870,7 @@ var PlaceOrder = ({
|
|
|
5188
5870
|
onAmountChange,
|
|
5189
5871
|
orderEligibility.canPlaceOrder,
|
|
5190
5872
|
orderedRouteCards,
|
|
5873
|
+
retryRemainingAmount,
|
|
5191
5874
|
scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets,
|
|
5192
5875
|
scopedSelectedOutcomeId,
|
|
5193
5876
|
selectedRouteCardId,
|
|
@@ -5197,7 +5880,7 @@ var PlaceOrder = ({
|
|
|
5197
5880
|
]);
|
|
5198
5881
|
const resolvedStatusClassName = cn(classNames == null ? void 0 : classNames.root, className);
|
|
5199
5882
|
if (isLoading) {
|
|
5200
|
-
return /* @__PURE__ */
|
|
5883
|
+
return /* @__PURE__ */ jsx7(
|
|
5201
5884
|
Skeleton,
|
|
5202
5885
|
{
|
|
5203
5886
|
ariaLabel: labels.common.loading,
|
|
@@ -5208,7 +5891,7 @@ var PlaceOrder = ({
|
|
|
5208
5891
|
}
|
|
5209
5892
|
if (submissionProgressState) {
|
|
5210
5893
|
if (submissionProgressState.phase === "success" && submissionProgressState.summary) {
|
|
5211
|
-
return /* @__PURE__ */
|
|
5894
|
+
return /* @__PURE__ */ jsx7(
|
|
5212
5895
|
PlaceOrderSuccessView,
|
|
5213
5896
|
{
|
|
5214
5897
|
className: resolvedStatusClassName,
|
|
@@ -5220,7 +5903,7 @@ var PlaceOrder = ({
|
|
|
5220
5903
|
);
|
|
5221
5904
|
}
|
|
5222
5905
|
if (submissionProgressState.phase === "failed") {
|
|
5223
|
-
return /* @__PURE__ */
|
|
5906
|
+
return /* @__PURE__ */ jsx7(
|
|
5224
5907
|
PlaceOrderFailureView,
|
|
5225
5908
|
{
|
|
5226
5909
|
className: resolvedStatusClassName,
|
|
@@ -5233,17 +5916,20 @@ var PlaceOrder = ({
|
|
|
5233
5916
|
}
|
|
5234
5917
|
);
|
|
5235
5918
|
}
|
|
5236
|
-
return
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5919
|
+
return /* @__PURE__ */ jsx7(
|
|
5920
|
+
PlaceOrderExecutionView,
|
|
5921
|
+
{
|
|
5922
|
+
className,
|
|
5923
|
+
classNames,
|
|
5924
|
+
enableAnimations,
|
|
5925
|
+
eventDateLabel: executionDateLabel,
|
|
5926
|
+
eventImage: headerImage,
|
|
5927
|
+
eventTitle: headerTitle,
|
|
5928
|
+
groups: executionOrderGroups,
|
|
5929
|
+
labels: tradingLabels,
|
|
5930
|
+
progress: executionProgressPercent
|
|
5931
|
+
}
|
|
5932
|
+
);
|
|
5247
5933
|
}
|
|
5248
5934
|
const handleTabChange = (nextTab) => {
|
|
5249
5935
|
if (!orderEligibility.canPlaceOrder) return;
|
|
@@ -5277,6 +5963,12 @@ var PlaceOrder = ({
|
|
|
5277
5963
|
if (!isSell) return;
|
|
5278
5964
|
if (maxSellableShares <= 0) return;
|
|
5279
5965
|
setSelectedRouteCardId(PLACE_ORDER_MAXIMIZE_PAYOUT_ROUTE_ID);
|
|
5966
|
+
const maximizePayoutCard = routeCards.find(
|
|
5967
|
+
(card) => card.id === PLACE_ORDER_MAXIMIZE_PAYOUT_ROUTE_ID
|
|
5968
|
+
);
|
|
5969
|
+
setManualRouteSelectionIdentity(
|
|
5970
|
+
maximizePayoutCard ? getPlaceOrderRouteCardIdentity(maximizePayoutCard) : null
|
|
5971
|
+
);
|
|
5280
5972
|
setIsSplitDetailOpen(false);
|
|
5281
5973
|
handleAmountChange(maxSellableShares);
|
|
5282
5974
|
};
|
|
@@ -5420,7 +6112,10 @@ var PlaceOrder = ({
|
|
|
5420
6112
|
};
|
|
5421
6113
|
}
|
|
5422
6114
|
try {
|
|
5423
|
-
setSubmissionProgressState({
|
|
6115
|
+
setSubmissionProgressState({
|
|
6116
|
+
phase: "finding-route",
|
|
6117
|
+
quoteData: isLimitOrder ? void 0 : selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData
|
|
6118
|
+
});
|
|
5424
6119
|
if (isLimitOrder) {
|
|
5425
6120
|
yield handlePlaceLimitOrder(submissionLimitOrderPayload);
|
|
5426
6121
|
return;
|
|
@@ -5439,20 +6134,21 @@ var PlaceOrder = ({
|
|
|
5439
6134
|
}
|
|
5440
6135
|
});
|
|
5441
6136
|
if (isEndedWithoutKnownWinner || !orderEligibility.canPlaceOrder && resolvedReadOnlyTradingState.kind !== "open") {
|
|
5442
|
-
return /* @__PURE__ */
|
|
6137
|
+
return /* @__PURE__ */ jsx7(
|
|
5443
6138
|
PlaceOrderResolvedView,
|
|
5444
6139
|
{
|
|
5445
6140
|
tradingState: resolvedReadOnlyTradingState,
|
|
5446
|
-
resolutionTimestamp: (
|
|
6141
|
+
resolutionTimestamp: (_ha = resolvedEventTradingState.resolvesAt) != null ? _ha : resolvedReadOnlyTradingState.resolvesAt,
|
|
5447
6142
|
resolvedClaim,
|
|
5448
6143
|
classNames,
|
|
5449
6144
|
className,
|
|
5450
|
-
isSportsEvent: (scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.structureType) === "sport" && !!(scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.sport) && scopedSelectedEvent.sport !== "other_sport"
|
|
6145
|
+
isSportsEvent: (scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.structureType) === "sport" && !!(scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.sport) && scopedSelectedEvent.sport !== "other_sport",
|
|
6146
|
+
showResolvingState
|
|
5451
6147
|
}
|
|
5452
6148
|
);
|
|
5453
6149
|
}
|
|
5454
|
-
return /* @__PURE__ */
|
|
5455
|
-
/* @__PURE__ */
|
|
6150
|
+
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
6151
|
+
/* @__PURE__ */ jsxs6(
|
|
5456
6152
|
Card,
|
|
5457
6153
|
{
|
|
5458
6154
|
className: cn(
|
|
@@ -5469,20 +6165,20 @@ var PlaceOrder = ({
|
|
|
5469
6165
|
headerTitle,
|
|
5470
6166
|
onClose
|
|
5471
6167
|
}),
|
|
5472
|
-
/* @__PURE__ */
|
|
5473
|
-
/* @__PURE__ */
|
|
6168
|
+
/* @__PURE__ */ jsxs6("div", { className: cn("agg-order-panel-content flex flex-col gap-6", classNames == null ? void 0 : classNames.content), children: [
|
|
6169
|
+
/* @__PURE__ */ jsxs6(
|
|
5474
6170
|
"div",
|
|
5475
6171
|
{
|
|
5476
6172
|
className: "agg-order-tabs flex items-end border-b border-agg-separator",
|
|
5477
6173
|
role: "tablist",
|
|
5478
6174
|
"aria-label": labels.common.tabsAria,
|
|
5479
6175
|
children: [
|
|
5480
|
-
/* @__PURE__ */
|
|
6176
|
+
/* @__PURE__ */ jsx7("div", { className: "flex min-w-0 flex-1 items-end", children: [
|
|
5481
6177
|
{ value: "buy", label: tradingLabels.buy, ref: buyTabRef },
|
|
5482
6178
|
{ value: "sell", label: tradingLabels.sell, ref: sellTabRef }
|
|
5483
6179
|
].map((tabItem) => {
|
|
5484
6180
|
const isActive = internalTab === tabItem.value;
|
|
5485
|
-
return /* @__PURE__ */
|
|
6181
|
+
return /* @__PURE__ */ jsxs6(
|
|
5486
6182
|
"button",
|
|
5487
6183
|
{
|
|
5488
6184
|
ref: tabItem.ref,
|
|
@@ -5506,7 +6202,7 @@ var PlaceOrder = ({
|
|
|
5506
6202
|
onKeyDown: (event) => handleTabKeyDown(event, tabItem.value),
|
|
5507
6203
|
children: [
|
|
5508
6204
|
tabItem.label,
|
|
5509
|
-
/* @__PURE__ */
|
|
6205
|
+
/* @__PURE__ */ jsx7(
|
|
5510
6206
|
"span",
|
|
5511
6207
|
{
|
|
5512
6208
|
"aria-hidden": "true",
|
|
@@ -5526,7 +6222,7 @@ var PlaceOrder = ({
|
|
|
5526
6222
|
tabItem.value
|
|
5527
6223
|
);
|
|
5528
6224
|
}) }),
|
|
5529
|
-
showLimitOrders ? /* @__PURE__ */
|
|
6225
|
+
showLimitOrders ? /* @__PURE__ */ jsx7(
|
|
5530
6226
|
Select,
|
|
5531
6227
|
{
|
|
5532
6228
|
ariaLabel: tradingLabels.orderTypeAria,
|
|
@@ -5547,8 +6243,8 @@ var PlaceOrder = ({
|
|
|
5547
6243
|
]
|
|
5548
6244
|
}
|
|
5549
6245
|
),
|
|
5550
|
-
/* @__PURE__ */
|
|
5551
|
-
outcomes.length >= 2 ? /* @__PURE__ */
|
|
6246
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-order-entry-section flex flex-col gap-4", children: [
|
|
6247
|
+
outcomes.length >= 2 ? /* @__PURE__ */ jsx7("div", { className: "agg-outcomes flex w-full max-w-full gap-2", children: outcomes.map((outcome, index) => {
|
|
5552
6248
|
var _a2, _b2, _c2;
|
|
5553
6249
|
const price = getDisplayOutcomePrice({
|
|
5554
6250
|
outcomeId: outcome.id,
|
|
@@ -5562,7 +6258,7 @@ var PlaceOrder = ({
|
|
|
5562
6258
|
const isActive = outcome.id === scopedSelectedOutcomeId;
|
|
5563
6259
|
const isPositive = resolveIsPositiveOutcome(outcome, index);
|
|
5564
6260
|
const isPriceLoading = clusterMidpointResult.isLoading && price == null;
|
|
5565
|
-
return /* @__PURE__ */
|
|
6261
|
+
return /* @__PURE__ */ jsxs6(
|
|
5566
6262
|
"button",
|
|
5567
6263
|
{
|
|
5568
6264
|
"data-id": outcome.id,
|
|
@@ -5582,7 +6278,7 @@ var PlaceOrder = ({
|
|
|
5582
6278
|
disabled: !orderEligibility.canPlaceOrder || isResolvedOutcomeCtaLocked,
|
|
5583
6279
|
onClick: () => handleOutcomeChange(outcome.id),
|
|
5584
6280
|
children: [
|
|
5585
|
-
/* @__PURE__ */
|
|
6281
|
+
/* @__PURE__ */ jsx7(
|
|
5586
6282
|
Typography,
|
|
5587
6283
|
{
|
|
5588
6284
|
as: "span",
|
|
@@ -5591,7 +6287,7 @@ var PlaceOrder = ({
|
|
|
5591
6287
|
children: (_c2 = outcome.title) != null ? _c2 : outcome.label
|
|
5592
6288
|
}
|
|
5593
6289
|
),
|
|
5594
|
-
isPriceLoading ? /* @__PURE__ */
|
|
6290
|
+
isPriceLoading ? /* @__PURE__ */ jsx7(
|
|
5595
6291
|
"span",
|
|
5596
6292
|
{
|
|
5597
6293
|
"aria-hidden": "true",
|
|
@@ -5600,18 +6296,18 @@ var PlaceOrder = ({
|
|
|
5600
6296
|
"h-4 w-10 shrink-0 rounded-agg-sm bg-agg-separator animate-pulse"
|
|
5601
6297
|
)
|
|
5602
6298
|
}
|
|
5603
|
-
) : /* @__PURE__ */
|
|
6299
|
+
) : /* @__PURE__ */ jsx7(Typography, { as: "span", variant: isActive ? "body-strong" : "body", children: formatProbabilityCents(price, formatPrice) })
|
|
5604
6300
|
]
|
|
5605
6301
|
},
|
|
5606
6302
|
outcome.id
|
|
5607
6303
|
);
|
|
5608
6304
|
}) }) : null,
|
|
5609
|
-
isLimitOrder ? /* @__PURE__ */
|
|
5610
|
-
/* @__PURE__ */
|
|
5611
|
-
/* @__PURE__ */
|
|
5612
|
-
/* @__PURE__ */
|
|
5613
|
-
/* @__PURE__ */
|
|
5614
|
-
/* @__PURE__ */
|
|
6305
|
+
isLimitOrder ? /* @__PURE__ */ jsxs6("div", { className: "agg-limit-price-section flex items-center justify-between gap-4", children: [
|
|
6306
|
+
/* @__PURE__ */ jsx7("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.limitPrice }),
|
|
6307
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex min-w-0 flex-col items-end gap-1", children: [
|
|
6308
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
|
|
6309
|
+
/* @__PURE__ */ jsxs6("label", { className: "relative flex items-center", children: [
|
|
6310
|
+
/* @__PURE__ */ jsx7(
|
|
5615
6311
|
"input",
|
|
5616
6312
|
{
|
|
5617
6313
|
type: "text",
|
|
@@ -5628,38 +6324,58 @@ var PlaceOrder = ({
|
|
|
5628
6324
|
)
|
|
5629
6325
|
}
|
|
5630
6326
|
),
|
|
5631
|
-
/* @__PURE__ */
|
|
6327
|
+
/* @__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
6328
|
] }),
|
|
5633
|
-
/* @__PURE__ */
|
|
6329
|
+
/* @__PURE__ */ jsx7(
|
|
5634
6330
|
"button",
|
|
5635
6331
|
{
|
|
5636
6332
|
type: "button",
|
|
5637
6333
|
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
6334
|
"aria-label": tradingLabels.limitPriceDecreaseAria,
|
|
5639
6335
|
onClick: () => handleLimitPriceStep("decrease"),
|
|
5640
|
-
children: /* @__PURE__ */
|
|
6336
|
+
children: /* @__PURE__ */ jsx7(Icon, { name: "minus", size: "small", className: "h-4 w-4", "aria-hidden": true })
|
|
5641
6337
|
}
|
|
5642
6338
|
),
|
|
5643
|
-
/* @__PURE__ */
|
|
6339
|
+
/* @__PURE__ */ jsx7(
|
|
5644
6340
|
"button",
|
|
5645
6341
|
{
|
|
5646
6342
|
type: "button",
|
|
5647
6343
|
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
6344
|
"aria-label": tradingLabels.limitPriceIncreaseAria,
|
|
5649
6345
|
onClick: () => handleLimitPriceStep("increase"),
|
|
5650
|
-
children: /* @__PURE__ */
|
|
6346
|
+
children: /* @__PURE__ */ jsx7(Icon, { name: "plus", size: "small", className: "h-4 w-4", "aria-hidden": true })
|
|
5651
6347
|
}
|
|
5652
6348
|
)
|
|
5653
6349
|
] }),
|
|
5654
|
-
limitPriceInputError ? /* @__PURE__ */
|
|
6350
|
+
limitPriceInputError ? /* @__PURE__ */ jsx7("p", { className: "max-w-[220px] text-right text-agg-xs leading-agg-4 text-agg-error", children: limitPriceInputError }) : null
|
|
5655
6351
|
] })
|
|
5656
6352
|
] }) : null,
|
|
5657
|
-
/* @__PURE__ */
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
6353
|
+
isLimitOrder && limitPriceAdjustmentMessage ? /* @__PURE__ */ jsxs6(
|
|
6354
|
+
"div",
|
|
6355
|
+
{
|
|
6356
|
+
className: "agg-limit-price-adjustment flex w-full items-center gap-2 rounded-agg-lg bg-agg-warning/10 px-3 py-2",
|
|
6357
|
+
role: "status",
|
|
6358
|
+
"aria-live": "polite",
|
|
6359
|
+
children: [
|
|
6360
|
+
/* @__PURE__ */ jsx7(
|
|
6361
|
+
Icon,
|
|
6362
|
+
{
|
|
6363
|
+
name: "warning-filled",
|
|
6364
|
+
size: "small",
|
|
6365
|
+
className: "h-4! w-4! shrink-0 text-agg-warning",
|
|
6366
|
+
"aria-hidden": "true"
|
|
6367
|
+
}
|
|
6368
|
+
),
|
|
6369
|
+
/* @__PURE__ */ jsx7("p", { className: "min-w-0 flex-1 wrap-break-word text-agg-sm leading-agg-5 text-agg-foreground", children: limitPriceAdjustmentMessage })
|
|
6370
|
+
]
|
|
6371
|
+
}
|
|
6372
|
+
) : null,
|
|
6373
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-order-amount-section flex items-start justify-between gap-4", children: [
|
|
6374
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-order-amount-meta flex flex-col", children: [
|
|
6375
|
+
/* @__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) }),
|
|
6376
|
+
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: [
|
|
6377
|
+
/* @__PURE__ */ jsx7("span", { className: "whitespace-pre", children: displayedCurrentSellableSharesLabel }),
|
|
6378
|
+
displayedCurrentSellableShares > 0 ? /* @__PURE__ */ jsx7(
|
|
5663
6379
|
"button",
|
|
5664
6380
|
{
|
|
5665
6381
|
type: "button",
|
|
@@ -5675,9 +6391,9 @@ var PlaceOrder = ({
|
|
|
5675
6391
|
children: tradingLabels.maxShares
|
|
5676
6392
|
}
|
|
5677
6393
|
) : null
|
|
5678
|
-
] }) }) : /* @__PURE__ */
|
|
6394
|
+
] }) }) : /* @__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
6395
|
] }),
|
|
5680
|
-
/* @__PURE__ */
|
|
6396
|
+
/* @__PURE__ */ jsx7(
|
|
5681
6397
|
CurrencyInput,
|
|
5682
6398
|
{
|
|
5683
6399
|
value: internalAmount,
|
|
@@ -5699,9 +6415,9 @@ var PlaceOrder = ({
|
|
|
5699
6415
|
}
|
|
5700
6416
|
)
|
|
5701
6417
|
] }),
|
|
5702
|
-
showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */
|
|
5703
|
-
/* @__PURE__ */
|
|
5704
|
-
/* @__PURE__ */
|
|
6418
|
+
showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */ jsxs6("div", { className: "agg-order-fees-section flex items-center justify-between gap-4", children: [
|
|
6419
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1.5", children: [
|
|
6420
|
+
/* @__PURE__ */ jsx7(
|
|
5705
6421
|
Typography,
|
|
5706
6422
|
{
|
|
5707
6423
|
variant: "text-sm",
|
|
@@ -5709,7 +6425,7 @@ var PlaceOrder = ({
|
|
|
5709
6425
|
children: tradingLabels.estimatedFees
|
|
5710
6426
|
}
|
|
5711
6427
|
),
|
|
5712
|
-
feeBreakdownRows.length > 0 ? /* @__PURE__ */
|
|
6428
|
+
feeBreakdownRows.length > 0 ? /* @__PURE__ */ jsx7(
|
|
5713
6429
|
Tooltip,
|
|
5714
6430
|
{
|
|
5715
6431
|
"aria-label": tradingLabels.estimatedFeesTooltipAria,
|
|
@@ -5721,13 +6437,13 @@ var PlaceOrder = ({
|
|
|
5721
6437
|
icon: "h-3 w-3 text-agg-muted-foreground",
|
|
5722
6438
|
trigger: "h-3 w-3 text-agg-muted-foreground"
|
|
5723
6439
|
},
|
|
5724
|
-
content: /* @__PURE__ */
|
|
6440
|
+
content: /* @__PURE__ */ jsx7("div", { className: "flex w-full flex-col gap-2", children: feeBreakdownRows.map((row) => /* @__PURE__ */ jsxs6(
|
|
5725
6441
|
"div",
|
|
5726
6442
|
{
|
|
5727
6443
|
className: "flex items-center justify-between gap-3 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground",
|
|
5728
6444
|
children: [
|
|
5729
|
-
/* @__PURE__ */
|
|
5730
|
-
row.kind === "badge" ? /* @__PURE__ */
|
|
6445
|
+
/* @__PURE__ */ jsx7("span", { children: row.label }),
|
|
6446
|
+
row.kind === "badge" ? /* @__PURE__ */ jsx7(
|
|
5731
6447
|
"span",
|
|
5732
6448
|
{
|
|
5733
6449
|
className: cn(
|
|
@@ -5737,7 +6453,7 @@ var PlaceOrder = ({
|
|
|
5737
6453
|
),
|
|
5738
6454
|
children: row.badgeLabel
|
|
5739
6455
|
}
|
|
5740
|
-
) : /* @__PURE__ */
|
|
6456
|
+
) : /* @__PURE__ */ jsx7("span", { className: "text-right", children: row.value })
|
|
5741
6457
|
]
|
|
5742
6458
|
},
|
|
5743
6459
|
row.label
|
|
@@ -5745,57 +6461,64 @@ var PlaceOrder = ({
|
|
|
5745
6461
|
}
|
|
5746
6462
|
) : null
|
|
5747
6463
|
] }),
|
|
5748
|
-
/* @__PURE__ */
|
|
6464
|
+
/* @__PURE__ */ jsx7("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: estimatedFeesValue })
|
|
5749
6465
|
] }) : null
|
|
5750
6466
|
] }),
|
|
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
|
-
|
|
6467
|
+
shouldShowSmartRouting ? /* @__PURE__ */ jsxs6(
|
|
6468
|
+
"div",
|
|
6469
|
+
{
|
|
6470
|
+
className: "agg-route-panel flex flex-col gap-3",
|
|
6471
|
+
"aria-busy": !isLimitOrder && isQuoteLoading,
|
|
6472
|
+
children: [
|
|
6473
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-route-panel-header flex items-center justify-between gap-4", children: [
|
|
6474
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-route-panel-title text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.smartRouting }),
|
|
6475
|
+
shouldShowRouteToggle && !isRoutesExpanded ? /* @__PURE__ */ jsxs6(
|
|
6476
|
+
"button",
|
|
6477
|
+
{
|
|
6478
|
+
type: "button",
|
|
6479
|
+
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",
|
|
6480
|
+
"aria-label": tradingLabels.viewAllRoutes(activeRouteCardCount),
|
|
6481
|
+
onClick: () => setIsRoutesExpanded((currentValue) => !currentValue),
|
|
6482
|
+
children: [
|
|
6483
|
+
/* @__PURE__ */ jsx7("span", { children: tradingLabels.viewAllRoutes(activeRouteCardCount) }),
|
|
6484
|
+
/* @__PURE__ */ jsx7(
|
|
6485
|
+
Icon,
|
|
6486
|
+
{
|
|
6487
|
+
name: "chevron-down",
|
|
6488
|
+
size: "small",
|
|
6489
|
+
className: "h-4 w-4 text-agg-foreground",
|
|
6490
|
+
"aria-hidden": "true"
|
|
6491
|
+
}
|
|
6492
|
+
)
|
|
6493
|
+
]
|
|
6494
|
+
}
|
|
6495
|
+
) : null
|
|
6496
|
+
] }),
|
|
6497
|
+
/* @__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: [
|
|
6498
|
+
/* @__PURE__ */ jsx7(PlaceOrderRouteCardSkeleton, {}),
|
|
6499
|
+
/* @__PURE__ */ jsx7(PlaceOrderRouteCardSkeleton, {})
|
|
6500
|
+
] }) : activeRouteCards.length > 0 ? activeRouteCards.map((card) => {
|
|
6501
|
+
return /* @__PURE__ */ jsx7(Fragment2, { children: renderRouteCard({
|
|
6502
|
+
card,
|
|
6503
|
+
enableAnimations,
|
|
6504
|
+
isExpanded: card.kind === "split" ? isSplitDetailOpen : isRoutesExpanded,
|
|
6505
|
+
isSelected: !card.isUnavailable && card.id === (isLimitOrder ? selectedLimitRouteCardId : resolvedSelectedRouteCardId),
|
|
6506
|
+
onSelect: handleActiveRouteCardSelect,
|
|
6507
|
+
tradingLabels
|
|
6508
|
+
}) }, card.id);
|
|
6509
|
+
}) : null })
|
|
6510
|
+
]
|
|
6511
|
+
}
|
|
6512
|
+
) : null,
|
|
6513
|
+
isLimitOrder ? /* @__PURE__ */ jsxs6("div", { className: "agg-limit-expiration-section flex items-center justify-between gap-4", children: [
|
|
6514
|
+
/* @__PURE__ */ jsx7("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.expiration }),
|
|
6515
|
+
/* @__PURE__ */ jsxs6(
|
|
5793
6516
|
Popover.Root,
|
|
5794
6517
|
{
|
|
5795
6518
|
open: isLimitExpirationPickerOpen,
|
|
5796
6519
|
onOpenChange: handleLimitExpirationPickerOpenChange,
|
|
5797
6520
|
children: [
|
|
5798
|
-
/* @__PURE__ */
|
|
6521
|
+
/* @__PURE__ */ jsx7(Popover.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs6(
|
|
5799
6522
|
"button",
|
|
5800
6523
|
{
|
|
5801
6524
|
ref: expirationTriggerRef,
|
|
@@ -5803,10 +6526,10 @@ var PlaceOrder = ({
|
|
|
5803
6526
|
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
6527
|
"aria-label": tradingLabels.expirationMenuAria,
|
|
5805
6528
|
children: [
|
|
5806
|
-
/* @__PURE__ */
|
|
6529
|
+
/* @__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
6530
|
"MMM D, YYYY [at] HH:mm"
|
|
5808
6531
|
) : tradingLabels.expirationCustom }),
|
|
5809
|
-
/* @__PURE__ */
|
|
6532
|
+
/* @__PURE__ */ jsx7(
|
|
5810
6533
|
Icon,
|
|
5811
6534
|
{
|
|
5812
6535
|
name: isLimitExpirationPickerOpen ? "chevron-up" : "chevron-down",
|
|
@@ -5818,11 +6541,11 @@ var PlaceOrder = ({
|
|
|
5818
6541
|
]
|
|
5819
6542
|
}
|
|
5820
6543
|
) }),
|
|
5821
|
-
/* @__PURE__ */
|
|
6544
|
+
/* @__PURE__ */ jsx7(
|
|
5822
6545
|
Popover.Portal,
|
|
5823
6546
|
{
|
|
5824
6547
|
container: resolvePlaceOrderPortalContainer(expirationTriggerRef.current),
|
|
5825
|
-
children: /* @__PURE__ */
|
|
6548
|
+
children: /* @__PURE__ */ jsx7(
|
|
5826
6549
|
Popover.Content,
|
|
5827
6550
|
{
|
|
5828
6551
|
align: "end",
|
|
@@ -5831,14 +6554,14 @@ var PlaceOrder = ({
|
|
|
5831
6554
|
role: "dialog",
|
|
5832
6555
|
"aria-label": tradingLabels.expirationMenuAria,
|
|
5833
6556
|
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__ */
|
|
6557
|
+
children: limitExpirationPickerView === "calendar" ? /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-3 p-4", children: [
|
|
6558
|
+
/* @__PURE__ */ jsx7(
|
|
5836
6559
|
Button,
|
|
5837
6560
|
{
|
|
5838
6561
|
variant: "tertiary",
|
|
5839
6562
|
size: "small",
|
|
5840
6563
|
className: "w-fit px-0",
|
|
5841
|
-
prefix: /* @__PURE__ */
|
|
6564
|
+
prefix: /* @__PURE__ */ jsx7(
|
|
5842
6565
|
Icon,
|
|
5843
6566
|
{
|
|
5844
6567
|
name: "chevron-left",
|
|
@@ -5851,7 +6574,7 @@ var PlaceOrder = ({
|
|
|
5851
6574
|
children: tradingLabels.expirationOptions
|
|
5852
6575
|
}
|
|
5853
6576
|
),
|
|
5854
|
-
/* @__PURE__ */
|
|
6577
|
+
/* @__PURE__ */ jsx7(
|
|
5855
6578
|
Calendar,
|
|
5856
6579
|
{
|
|
5857
6580
|
mode: "single",
|
|
@@ -5866,9 +6589,9 @@ var PlaceOrder = ({
|
|
|
5866
6589
|
}
|
|
5867
6590
|
}
|
|
5868
6591
|
),
|
|
5869
|
-
/* @__PURE__ */
|
|
5870
|
-
/* @__PURE__ */
|
|
5871
|
-
/* @__PURE__ */
|
|
6592
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-4", children: [
|
|
6593
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex shrink-0 flex-col gap-0.5", children: [
|
|
6594
|
+
/* @__PURE__ */ jsx7(
|
|
5872
6595
|
"label",
|
|
5873
6596
|
{
|
|
5874
6597
|
htmlFor: expirationTimeInputId,
|
|
@@ -5876,9 +6599,9 @@ var PlaceOrder = ({
|
|
|
5876
6599
|
children: tradingLabels.expirationStartTime
|
|
5877
6600
|
}
|
|
5878
6601
|
),
|
|
5879
|
-
/* @__PURE__ */
|
|
6602
|
+
/* @__PURE__ */ jsx7("span", { className: "text-agg-xs leading-agg-4 text-agg-foreground", children: tradingLabels.expirationStartTimeHint })
|
|
5880
6603
|
] }),
|
|
5881
|
-
/* @__PURE__ */
|
|
6604
|
+
/* @__PURE__ */ jsx7(
|
|
5882
6605
|
"input",
|
|
5883
6606
|
{
|
|
5884
6607
|
id: expirationTimeInputId,
|
|
@@ -5889,8 +6612,8 @@ var PlaceOrder = ({
|
|
|
5889
6612
|
}
|
|
5890
6613
|
)
|
|
5891
6614
|
] }),
|
|
5892
|
-
/* @__PURE__ */
|
|
5893
|
-
/* @__PURE__ */
|
|
6615
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex gap-2", children: [
|
|
6616
|
+
/* @__PURE__ */ jsx7(
|
|
5894
6617
|
Button,
|
|
5895
6618
|
{
|
|
5896
6619
|
variant: "secondary",
|
|
@@ -5900,13 +6623,13 @@ var PlaceOrder = ({
|
|
|
5900
6623
|
children: tradingLabels.expirationCancel
|
|
5901
6624
|
}
|
|
5902
6625
|
),
|
|
5903
|
-
/* @__PURE__ */
|
|
6626
|
+
/* @__PURE__ */ jsx7(
|
|
5904
6627
|
Button,
|
|
5905
6628
|
{
|
|
5906
6629
|
size: "small",
|
|
5907
6630
|
className: "min-w-0 flex-1",
|
|
5908
6631
|
disabled: !isLimitExpirationDraftValid,
|
|
5909
|
-
prefix: /* @__PURE__ */
|
|
6632
|
+
prefix: /* @__PURE__ */ jsx7(
|
|
5910
6633
|
Icon,
|
|
5911
6634
|
{
|
|
5912
6635
|
name: "success-check",
|
|
@@ -5920,7 +6643,7 @@ var PlaceOrder = ({
|
|
|
5920
6643
|
}
|
|
5921
6644
|
)
|
|
5922
6645
|
] })
|
|
5923
|
-
] }) : /* @__PURE__ */
|
|
6646
|
+
] }) : /* @__PURE__ */ jsx7(
|
|
5924
6647
|
"div",
|
|
5925
6648
|
{
|
|
5926
6649
|
role: "radiogroup",
|
|
@@ -5938,7 +6661,7 @@ var PlaceOrder = ({
|
|
|
5938
6661
|
{ value: "ONE_HOUR", label: tradingLabels.expirationOneHour },
|
|
5939
6662
|
{ value: "END_OF_DAY", label: tradingLabels.expirationEndOfDay },
|
|
5940
6663
|
{ value: "CUSTOM", label: tradingLabels.expirationCustom }
|
|
5941
|
-
].map((item, optionIndex) => /* @__PURE__ */
|
|
6664
|
+
].map((item, optionIndex) => /* @__PURE__ */ jsxs6(
|
|
5942
6665
|
"button",
|
|
5943
6666
|
{
|
|
5944
6667
|
ref: (element) => {
|
|
@@ -5955,14 +6678,14 @@ var PlaceOrder = ({
|
|
|
5955
6678
|
onClick: () => handleLimitExpirationTypeChange(item.value),
|
|
5956
6679
|
onKeyDown: (event) => handleLimitExpirationOptionKeyDown(event, optionIndex),
|
|
5957
6680
|
children: [
|
|
5958
|
-
limitExpirationType === item.value ? /* @__PURE__ */
|
|
6681
|
+
limitExpirationType === item.value ? /* @__PURE__ */ jsx7(
|
|
5959
6682
|
"span",
|
|
5960
6683
|
{
|
|
5961
6684
|
className: "absolute bottom-2 left-0 top-2 w-1 bg-agg-primary",
|
|
5962
6685
|
"aria-hidden": true
|
|
5963
6686
|
}
|
|
5964
6687
|
) : null,
|
|
5965
|
-
/* @__PURE__ */
|
|
6688
|
+
/* @__PURE__ */ jsx7("span", { className: "truncate", children: item.label })
|
|
5966
6689
|
]
|
|
5967
6690
|
},
|
|
5968
6691
|
item.value
|
|
@@ -5977,12 +6700,12 @@ var PlaceOrder = ({
|
|
|
5977
6700
|
}
|
|
5978
6701
|
)
|
|
5979
6702
|
] }) : null,
|
|
5980
|
-
hasEnteredAmount && (isLimitOrder ? limitOrderPayload : selectedRouteCard) && !isQuoteLoading && !isBelowMinimum && orderEligibility.canPlaceOrder ? /* @__PURE__ */
|
|
5981
|
-
/* @__PURE__ */
|
|
5982
|
-
/* @__PURE__ */
|
|
5983
|
-
/* @__PURE__ */
|
|
6703
|
+
hasEnteredAmount && (isLimitOrder ? limitOrderPayload : selectedRouteCard) && !isQuoteLoading && !isBelowMinimum && orderEligibility.canPlaceOrder ? /* @__PURE__ */ jsxs6("div", { className: "agg-order-summary flex items-start justify-between gap-4", children: [
|
|
6704
|
+
/* @__PURE__ */ jsxs6("div", { className: "agg-order-summary-meta flex flex-col", children: [
|
|
6705
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-order-summary-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.toWin(internalTab) }),
|
|
6706
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-order-summary-hint text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isLimitOrder ? displayedLimitToWinHint : displayedToWinHint })
|
|
5984
6707
|
] }),
|
|
5985
|
-
/* @__PURE__ */
|
|
6708
|
+
/* @__PURE__ */ jsx7(
|
|
5986
6709
|
NumberFlow,
|
|
5987
6710
|
{
|
|
5988
6711
|
value: isLimitOrder ? displayedLimitToWinValue : displayedToWinValue,
|
|
@@ -5997,7 +6720,7 @@ var PlaceOrder = ({
|
|
|
5997
6720
|
}
|
|
5998
6721
|
)
|
|
5999
6722
|
] }) : null,
|
|
6000
|
-
/* @__PURE__ */
|
|
6723
|
+
/* @__PURE__ */ jsxs6(
|
|
6001
6724
|
"div",
|
|
6002
6725
|
{
|
|
6003
6726
|
className: cn(
|
|
@@ -6005,17 +6728,17 @@ var PlaceOrder = ({
|
|
|
6005
6728
|
classNames == null ? void 0 : classNames.footer
|
|
6006
6729
|
),
|
|
6007
6730
|
children: [
|
|
6008
|
-
!shouldShowGeoBlockBanner ? /* @__PURE__ */
|
|
6009
|
-
submissionFeedback ? /* @__PURE__ */
|
|
6731
|
+
!shouldShowGeoBlockBanner ? /* @__PURE__ */ jsxs6("div", { className: "agg-order-alerts flex flex-col gap-3 empty:hidden mb-3", children: [
|
|
6732
|
+
submissionFeedback ? /* @__PURE__ */ jsx7(
|
|
6010
6733
|
InlineAlert,
|
|
6011
6734
|
{
|
|
6012
6735
|
tone: submissionFeedback.tone,
|
|
6013
6736
|
message: submissionFeedback.message
|
|
6014
6737
|
}
|
|
6015
6738
|
) : 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__ */
|
|
6739
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && isBelowMinimum ? /* @__PURE__ */ jsx7(InlineAlert, { tone: "error", message: belowMinimumMessage }) : null,
|
|
6740
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && quoteStatus ? /* @__PURE__ */ jsx7(InlineAlert, { tone: quoteStatus.tone, message: quoteStatus.message }) : null,
|
|
6741
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && !quoteStatus && hasEnteredAmount && smartRouteErrorMessage ? /* @__PURE__ */ jsx7(
|
|
6019
6742
|
InlineAlert,
|
|
6020
6743
|
{
|
|
6021
6744
|
tone: "error",
|
|
@@ -6027,14 +6750,14 @@ var PlaceOrder = ({
|
|
|
6027
6750
|
}
|
|
6028
6751
|
) : null
|
|
6029
6752
|
] }) : null,
|
|
6030
|
-
!submissionFeedback && !shouldShowGeoBlockBanner && orderEligibility.canPlaceOrder && !needsKalshiConnection && shouldShowInsufficientBalanceAlert ? /* @__PURE__ */
|
|
6753
|
+
!submissionFeedback && !shouldShowGeoBlockBanner && orderEligibility.canPlaceOrder && !needsKalshiConnection && shouldShowInsufficientBalanceAlert ? /* @__PURE__ */ jsxs6(
|
|
6031
6754
|
"div",
|
|
6032
6755
|
{
|
|
6033
6756
|
className: "agg-order-insufficient-balance-alert flex items-center justify-center gap-2",
|
|
6034
6757
|
role: "status",
|
|
6035
6758
|
"aria-live": "polite",
|
|
6036
6759
|
children: [
|
|
6037
|
-
/* @__PURE__ */
|
|
6760
|
+
/* @__PURE__ */ jsx7(
|
|
6038
6761
|
Icon,
|
|
6039
6762
|
{
|
|
6040
6763
|
name: "warning-filled",
|
|
@@ -6043,11 +6766,24 @@ var PlaceOrder = ({
|
|
|
6043
6766
|
"aria-hidden": "true"
|
|
6044
6767
|
}
|
|
6045
6768
|
),
|
|
6046
|
-
/* @__PURE__ */
|
|
6769
|
+
/* @__PURE__ */ jsx7("span", { className: "text-agg-sm text-agg-foreground", children: tradingLabels.insufficientBalance }),
|
|
6770
|
+
insufficientBalanceDetails ? /* @__PURE__ */ jsx7(
|
|
6771
|
+
Tooltip,
|
|
6772
|
+
{
|
|
6773
|
+
"aria-label": tradingLabels.insufficientBalanceDetails,
|
|
6774
|
+
content: insufficientBalanceDetails,
|
|
6775
|
+
side: "top",
|
|
6776
|
+
sideOffset: 4,
|
|
6777
|
+
classNames: {
|
|
6778
|
+
icon: "h-3 w-3 text-agg-muted-foreground",
|
|
6779
|
+
trigger: "h-4 w-4 shrink-0 text-agg-muted-foreground"
|
|
6780
|
+
}
|
|
6781
|
+
}
|
|
6782
|
+
) : null
|
|
6047
6783
|
]
|
|
6048
6784
|
}
|
|
6049
6785
|
) : null,
|
|
6050
|
-
!submissionFeedback && !shouldShowGeoBlockBanner && needsKalshiConnection ? /* @__PURE__ */
|
|
6786
|
+
!submissionFeedback && !shouldShowGeoBlockBanner && needsKalshiConnection ? /* @__PURE__ */ jsx7(
|
|
6051
6787
|
Button,
|
|
6052
6788
|
{
|
|
6053
6789
|
size: "large",
|
|
@@ -6057,7 +6793,7 @@ var PlaceOrder = ({
|
|
|
6057
6793
|
onClick: () => setIsConnectKalshiModalOpen(true),
|
|
6058
6794
|
children: tradingLabels.connectKalshi
|
|
6059
6795
|
}
|
|
6060
|
-
) : needsKycVerification && !submissionFeedback && !shouldShowGeoBlockBanner ? /* @__PURE__ */
|
|
6796
|
+
) : needsKycVerification && !submissionFeedback && !shouldShowGeoBlockBanner ? /* @__PURE__ */ jsx7(
|
|
6061
6797
|
Button,
|
|
6062
6798
|
{
|
|
6063
6799
|
size: "large",
|
|
@@ -6067,7 +6803,7 @@ var PlaceOrder = ({
|
|
|
6067
6803
|
onClick: () => setIsConnectKalshiModalOpen(true),
|
|
6068
6804
|
children: verifyKalshiConnectionLabel
|
|
6069
6805
|
}
|
|
6070
|
-
) : !submissionFeedback && !shouldShowGeoBlockBanner && isInsufficientBalance ? /* @__PURE__ */
|
|
6806
|
+
) : !submissionFeedback && !shouldShowGeoBlockBanner && isInsufficientBalance ? /* @__PURE__ */ jsx7(
|
|
6071
6807
|
Button,
|
|
6072
6808
|
{
|
|
6073
6809
|
size: "large",
|
|
@@ -6077,7 +6813,7 @@ var PlaceOrder = ({
|
|
|
6077
6813
|
onClick: handleDepositRequiredClick,
|
|
6078
6814
|
children: isKalshiBalanceInsufficient ? tradingLabels.addFundsToKalshi : tradingLabels.deposit
|
|
6079
6815
|
}
|
|
6080
|
-
) : isQuoteLoading && !isActionLoading ? /* @__PURE__ */
|
|
6816
|
+
) : isQuoteLoading && !isActionLoading ? /* @__PURE__ */ jsx7(
|
|
6081
6817
|
Button,
|
|
6082
6818
|
{
|
|
6083
6819
|
size: "large",
|
|
@@ -6086,7 +6822,7 @@ var PlaceOrder = ({
|
|
|
6086
6822
|
disabled: true,
|
|
6087
6823
|
"aria-live": "polite",
|
|
6088
6824
|
"aria-label": routeLoadingMessage != null ? routeLoadingMessage : labels.common.loading,
|
|
6089
|
-
prefix: /* @__PURE__ */
|
|
6825
|
+
prefix: /* @__PURE__ */ jsx7(
|
|
6090
6826
|
"span",
|
|
6091
6827
|
{
|
|
6092
6828
|
className: cn(
|
|
@@ -6098,7 +6834,7 @@ var PlaceOrder = ({
|
|
|
6098
6834
|
),
|
|
6099
6835
|
children: routeLoadingMessage
|
|
6100
6836
|
}
|
|
6101
|
-
) : !isAuthenticated ? /* @__PURE__ */
|
|
6837
|
+
) : !isAuthenticated ? /* @__PURE__ */ jsx7(
|
|
6102
6838
|
Button,
|
|
6103
6839
|
{
|
|
6104
6840
|
size: "large",
|
|
@@ -6109,7 +6845,7 @@ var PlaceOrder = ({
|
|
|
6109
6845
|
onClick: requestAggAuthChooserOpen,
|
|
6110
6846
|
children: tradingLabels.signInToTrade
|
|
6111
6847
|
}
|
|
6112
|
-
) : /* @__PURE__ */
|
|
6848
|
+
) : /* @__PURE__ */ jsx7(
|
|
6113
6849
|
Button,
|
|
6114
6850
|
{
|
|
6115
6851
|
size: "large",
|
|
@@ -6124,27 +6860,17 @@ var PlaceOrder = ({
|
|
|
6124
6860
|
children: actionLabel
|
|
6125
6861
|
}
|
|
6126
6862
|
),
|
|
6127
|
-
shouldShowLowLiquidityWarning ? /* @__PURE__ */
|
|
6128
|
-
|
|
6863
|
+
shouldShowLowLiquidityWarning ? /* @__PURE__ */ jsx7(
|
|
6864
|
+
InlineAlert,
|
|
6129
6865
|
{
|
|
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
|
-
]
|
|
6866
|
+
tone: "warning",
|
|
6867
|
+
variant: "surface",
|
|
6868
|
+
className: "agg-order-low-liquidity-warning justify-start! border-0! bg-agg-warning/10! py-2!",
|
|
6869
|
+
message: internalTab === "buy" ? tradingLabels.lowLiquidityWarning : tradingLabels.lowLiquiditySellWarning
|
|
6144
6870
|
}
|
|
6145
6871
|
) : null,
|
|
6146
|
-
!shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown ? /* @__PURE__ */
|
|
6147
|
-
/* @__PURE__ */
|
|
6872
|
+
!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: [
|
|
6873
|
+
/* @__PURE__ */ jsx7(
|
|
6148
6874
|
Icon,
|
|
6149
6875
|
{
|
|
6150
6876
|
name: "shield-trust",
|
|
@@ -6153,10 +6879,10 @@ var PlaceOrder = ({
|
|
|
6153
6879
|
"aria-hidden": "true"
|
|
6154
6880
|
}
|
|
6155
6881
|
),
|
|
6156
|
-
/* @__PURE__ */
|
|
6882
|
+
/* @__PURE__ */ jsx7(Typography, { variant: "text-xs-caps", className: "text-agg-primary", children: tradingLabels.platformFee })
|
|
6157
6883
|
] }) : null,
|
|
6158
|
-
shouldShowGeoBlockBanner ? /* @__PURE__ */
|
|
6159
|
-
!shouldShowGeoBlockBanner ? /* @__PURE__ */
|
|
6884
|
+
shouldShowGeoBlockBanner ? /* @__PURE__ */ jsx7(GeoBlockBanner, { termsUrl: AGG_TERMS_OF_SERVICE_URL }) : null,
|
|
6885
|
+
!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
6886
|
]
|
|
6161
6887
|
}
|
|
6162
6888
|
)
|
|
@@ -6164,7 +6890,7 @@ var PlaceOrder = ({
|
|
|
6164
6890
|
]
|
|
6165
6891
|
}
|
|
6166
6892
|
),
|
|
6167
|
-
/* @__PURE__ */
|
|
6893
|
+
/* @__PURE__ */ jsx7(
|
|
6168
6894
|
ConnectKalshiModal,
|
|
6169
6895
|
{
|
|
6170
6896
|
open: isConnectKalshiModalOpen,
|
|
@@ -6172,7 +6898,7 @@ var PlaceOrder = ({
|
|
|
6172
6898
|
onVerify: handleVerifyKalshi
|
|
6173
6899
|
}
|
|
6174
6900
|
),
|
|
6175
|
-
/* @__PURE__ */
|
|
6901
|
+
/* @__PURE__ */ jsx7(FundKalshiModal, { open: isFundKalshiModalOpen, onOpenChange: setIsFundKalshiModalOpen })
|
|
6176
6902
|
] });
|
|
6177
6903
|
};
|
|
6178
6904
|
PlaceOrder.displayName = "PlaceOrder";
|
|
@@ -6188,7 +6914,7 @@ import {
|
|
|
6188
6914
|
useRedeem,
|
|
6189
6915
|
useRedeemLifecycles
|
|
6190
6916
|
} from "@agg-build/hooks";
|
|
6191
|
-
import { useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo2, useRef as useRef3, useState as
|
|
6917
|
+
import { useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo2, useRef as useRef3, useState as useState2 } from "react";
|
|
6192
6918
|
var toClaimError = (err) => {
|
|
6193
6919
|
if (err instanceof Error) return err;
|
|
6194
6920
|
return new Error(String(err));
|
|
@@ -6200,11 +6926,11 @@ function useClaimWinnings(options = {}) {
|
|
|
6200
6926
|
const toastCtx = useOptionalToast();
|
|
6201
6927
|
const queryClient = useQueryClient2();
|
|
6202
6928
|
const redeemMutation = useRedeem();
|
|
6203
|
-
const [activeRedeems, setActiveRedeems] =
|
|
6929
|
+
const [activeRedeems, setActiveRedeems] = useState2({});
|
|
6204
6930
|
const activeClaimKeysRef = useRef3(/* @__PURE__ */ new Set());
|
|
6205
6931
|
const pendingClaimToastIdsRef = useRef3({});
|
|
6206
6932
|
const submittedClaimToastKeysRef = useRef3(/* @__PURE__ */ new Set());
|
|
6207
|
-
const [submittingClaimKeys, setSubmittingClaimKeys] =
|
|
6933
|
+
const [submittingClaimKeys, setSubmittingClaimKeys] = useState2({});
|
|
6208
6934
|
const lifecycleInputs = useMemo2(
|
|
6209
6935
|
() => Object.values(activeRedeems),
|
|
6210
6936
|
[activeRedeems]
|
|
@@ -6497,7 +7223,7 @@ function useResolvedMarketClaim(options = {}) {
|
|
|
6497
7223
|
});
|
|
6498
7224
|
} : void 0
|
|
6499
7225
|
};
|
|
6500
|
-
}, [claimWinnings, marketId, positions, shouldFetch]);
|
|
7226
|
+
}, [claimWinnings, market, marketId, positions, shouldFetch]);
|
|
6501
7227
|
}
|
|
6502
7228
|
|
|
6503
7229
|
export {
|
|
@@ -6510,6 +7236,10 @@ export {
|
|
|
6510
7236
|
requestAggDepositModalOpen,
|
|
6511
7237
|
requestAggWithdrawModalOpen,
|
|
6512
7238
|
FundKalshiModal,
|
|
7239
|
+
formatChainIdLabel,
|
|
7240
|
+
PlaceOrderExecutionHeader,
|
|
7241
|
+
PlaceOrderExecutionGroups,
|
|
7242
|
+
PlaceOrderExecutionView,
|
|
6513
7243
|
PlaceOrderFailureView,
|
|
6514
7244
|
PlaceOrderSuccessView,
|
|
6515
7245
|
PlaceOrder,
|