@agg-build/ui 1.2.12 → 1.3.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 +34 -1
- package/dist/{chunk-YSW4ULL5.mjs → chunk-55ODXLOS.mjs} +1 -1
- package/dist/{chunk-4WBQTUPW.mjs → chunk-5ALBEKAT.mjs} +603 -317
- package/dist/{chunk-J6WELNCX.mjs → chunk-6PQ6O6M5.mjs} +583 -186
- package/dist/{chunk-U55T5BPE.mjs → chunk-ONVP7YWS.mjs} +44 -13
- package/dist/{chunk-X3KCFWXN.mjs → chunk-QUZWA34R.mjs} +975 -849
- package/dist/{chunk-IBOE7DRY.mjs → chunk-UFC7L74C.mjs} +26 -27
- package/dist/{chunk-3JXBOU24.mjs → chunk-YWJIYEJV.mjs} +146 -81
- package/dist/events.js +1833 -1435
- package/dist/events.mjs +5 -3
- package/dist/index.js +4100 -3213
- package/dist/index.mjs +13 -9
- package/dist/modals.js +964 -899
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +3593 -2724
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +995 -902
- package/dist/primitives.mjs +3 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +828 -688
- package/dist/trading.mjs +4 -4
- package/dist/types/events/item/event-list-item-v2.utils.d.mts +28 -0
- package/dist/types/events/item/event-list-item-v2.utils.d.ts +28 -0
- package/dist/types/events/item/event-list-item.constants.d.mts +1 -1
- package/dist/types/events/item/event-list-item.constants.d.ts +1 -1
- package/dist/types/events/item/index.d.mts +4 -0
- package/dist/types/events/item/index.d.ts +4 -0
- package/dist/types/events/list/event-list.types.d.mts +2 -0
- package/dist/types/events/list/event-list.types.d.ts +2 -0
- package/dist/types/events/list/event-list.utils.d.mts +19 -0
- package/dist/types/events/list/event-list.utils.d.ts +19 -0
- package/dist/types/events/list/index.d.mts +1 -1
- package/dist/types/events/list/index.d.ts +1 -1
- package/dist/types/pages/home/home.types.d.mts +1 -0
- package/dist/types/pages/home/home.types.d.ts +1 -0
- package/dist/types/pages/user-profile/user-profile.types.d.mts +30 -4
- package/dist/types/pages/user-profile/user-profile.types.d.ts +30 -4
- package/dist/types/primitives/icon/index.d.mts +2 -1
- package/dist/types/primitives/icon/index.d.ts +2 -1
- package/dist/types/primitives/icon/registry.d.mts +4 -0
- package/dist/types/primitives/icon/registry.d.ts +4 -0
- package/dist/types/primitives/icon/svg/gift-bonus.d.mts +5 -0
- package/dist/types/primitives/icon/svg/gift-bonus.d.ts +5 -0
- package/dist/types/primitives/search/search.types.d.mts +2 -1
- package/dist/types/primitives/search/search.types.d.ts +2 -1
- package/dist/types/primitives/skeleton/index.d.mts +1 -1
- package/dist/types/primitives/skeleton/index.d.ts +1 -1
- package/dist/types/primitives/skeleton/skeleton.types.d.mts +4 -0
- package/dist/types/primitives/skeleton/skeleton.types.d.ts +4 -0
- package/dist/types/primitives/skeleton/views/event-list-skeleton-view.d.mts +1 -1
- package/dist/types/primitives/skeleton/views/event-list-skeleton-view.d.ts +1 -1
- package/dist/types/profile/tabs/accounts-wallets-tab.d.mts +1 -1
- package/dist/types/profile/tabs/accounts-wallets-tab.d.ts +1 -1
- package/dist/types/trading/place-order/index.d.mts +1 -1
- package/dist/types/trading/place-order/index.d.ts +1 -1
- package/dist/types/trading/place-order/index.place-order.types.d.mts +4 -1
- package/dist/types/trading/place-order/index.place-order.types.d.ts +4 -1
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +2 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +2 -0
- package/package.json +3 -3
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
selectPrimaryVenueMarket,
|
|
18
18
|
skeletonViews,
|
|
19
19
|
sortOutcomes
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-QUZWA34R.mjs";
|
|
21
21
|
|
|
22
22
|
// src/trading/trading-context/index.tsx
|
|
23
23
|
import { useEventTradingContext } from "@agg-build/hooks";
|
|
@@ -449,31 +449,6 @@ var Settlement = ({
|
|
|
449
449
|
};
|
|
450
450
|
Settlement.displayName = "Settlement";
|
|
451
451
|
|
|
452
|
-
// src/events/shared/select-outcome-price.ts
|
|
453
|
-
var selectOutcomePrice = ({
|
|
454
|
-
outcomeId,
|
|
455
|
-
selection,
|
|
456
|
-
bestPrices,
|
|
457
|
-
bestMidpointsByOutcomeId,
|
|
458
|
-
livePrices,
|
|
459
|
-
fallbackPrice
|
|
460
|
-
}) => {
|
|
461
|
-
var _a, _b;
|
|
462
|
-
if (!outcomeId) return void 0;
|
|
463
|
-
if (selection === "buy") {
|
|
464
|
-
const bestAsk = (_a = bestPrices == null ? void 0 : bestPrices.get(outcomeId)) == null ? void 0 : _a.bestAsk;
|
|
465
|
-
if (bestAsk != null) return bestAsk;
|
|
466
|
-
} else if (selection === "sell") {
|
|
467
|
-
const bestBid = (_b = bestPrices == null ? void 0 : bestPrices.get(outcomeId)) == null ? void 0 : _b.bestBid;
|
|
468
|
-
if (bestBid != null) return bestBid;
|
|
469
|
-
}
|
|
470
|
-
const livePrice = livePrices == null ? void 0 : livePrices.get(outcomeId);
|
|
471
|
-
if (livePrice != null) return livePrice;
|
|
472
|
-
const midpointPrice = bestMidpointsByOutcomeId == null ? void 0 : bestMidpointsByOutcomeId.get(outcomeId);
|
|
473
|
-
if (midpointPrice != null) return midpointPrice;
|
|
474
|
-
return fallbackPrice != null ? fallbackPrice : void 0;
|
|
475
|
-
};
|
|
476
|
-
|
|
477
452
|
// src/events/item-details/event-list-item-details.utils.ts
|
|
478
453
|
import dayjs2 from "dayjs";
|
|
479
454
|
var compareOutcomeSelectorLabels = (leftLabel, rightLabel) => {
|
|
@@ -1023,6 +998,31 @@ var getDisplayReferencePrice = ({
|
|
|
1023
998
|
return (_a = bestMidpoint != null ? bestMidpoint : fallbackPrice) != null ? _a : void 0;
|
|
1024
999
|
};
|
|
1025
1000
|
|
|
1001
|
+
// src/events/shared/select-outcome-price.ts
|
|
1002
|
+
var selectOutcomePrice = ({
|
|
1003
|
+
outcomeId,
|
|
1004
|
+
selection,
|
|
1005
|
+
bestPrices,
|
|
1006
|
+
bestMidpointsByOutcomeId,
|
|
1007
|
+
livePrices,
|
|
1008
|
+
fallbackPrice
|
|
1009
|
+
}) => {
|
|
1010
|
+
var _a, _b;
|
|
1011
|
+
if (!outcomeId) return void 0;
|
|
1012
|
+
if (selection === "buy") {
|
|
1013
|
+
const bestAsk = (_a = bestPrices == null ? void 0 : bestPrices.get(outcomeId)) == null ? void 0 : _a.bestAsk;
|
|
1014
|
+
if (bestAsk != null) return bestAsk;
|
|
1015
|
+
} else if (selection === "sell") {
|
|
1016
|
+
const bestBid = (_b = bestPrices == null ? void 0 : bestPrices.get(outcomeId)) == null ? void 0 : _b.bestBid;
|
|
1017
|
+
if (bestBid != null) return bestBid;
|
|
1018
|
+
}
|
|
1019
|
+
const livePrice = livePrices == null ? void 0 : livePrices.get(outcomeId);
|
|
1020
|
+
if (livePrice != null) return livePrice;
|
|
1021
|
+
const midpointPrice = bestMidpointsByOutcomeId == null ? void 0 : bestMidpointsByOutcomeId.get(outcomeId);
|
|
1022
|
+
if (midpointPrice != null) return midpointPrice;
|
|
1023
|
+
return fallbackPrice != null ? fallbackPrice : void 0;
|
|
1024
|
+
};
|
|
1025
|
+
|
|
1026
1026
|
// src/events/shared/display-outcome-price.ts
|
|
1027
1027
|
var normalizeOutcomeLabel = (label) => {
|
|
1028
1028
|
return typeof label === "string" ? label.trim().toLowerCase() : "";
|
|
@@ -1167,7 +1167,6 @@ var resolveOrderEligibilityMessage = (labels, reason) => {
|
|
|
1167
1167
|
};
|
|
1168
1168
|
|
|
1169
1169
|
export {
|
|
1170
|
-
selectOutcomePrice,
|
|
1171
1170
|
useEventTradingContext,
|
|
1172
1171
|
sortOutcomeSelectorOutcomes,
|
|
1173
1172
|
resolveOutcomesByVenue,
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
getTradingValueLabel,
|
|
9
9
|
getTradingVenueLabel,
|
|
10
10
|
resolveOrderEligibilityMessage
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-UFC7L74C.mjs";
|
|
12
12
|
import {
|
|
13
13
|
GeoBlockBanner
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-55ODXLOS.mjs";
|
|
15
15
|
import {
|
|
16
16
|
AGG_TERMS_OF_SERVICE_URL,
|
|
17
17
|
Button,
|
|
@@ -31,13 +31,14 @@ import {
|
|
|
31
31
|
UserTrustIcon,
|
|
32
32
|
VenueLogo,
|
|
33
33
|
__async,
|
|
34
|
+
__pow,
|
|
34
35
|
__spreadProps,
|
|
35
36
|
__spreadValues,
|
|
36
37
|
cn,
|
|
37
38
|
formatUsd,
|
|
38
39
|
getMotionClassName,
|
|
39
40
|
skeletonViews
|
|
40
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-QUZWA34R.mjs";
|
|
41
42
|
|
|
42
43
|
// src/trading/types.ts
|
|
43
44
|
import { Venue, enumGuard, isFiniteNonNeg, safeParse } from "@agg-build/sdk";
|
|
@@ -99,6 +100,7 @@ import {
|
|
|
99
100
|
useLabels,
|
|
100
101
|
useLiveBestPrices,
|
|
101
102
|
useLiveOutcomePrices,
|
|
103
|
+
useManagedBalances,
|
|
102
104
|
useQueryClient,
|
|
103
105
|
useSdkUiConfig,
|
|
104
106
|
useSmartRoute
|
|
@@ -817,13 +819,19 @@ var getTradingRoutePriceLabel = (value) => {
|
|
|
817
819
|
const centsValue = Number.isFinite(value) ? value * 100 : 0;
|
|
818
820
|
return `${routePriceLabelFormatter.format(centsValue)}\xA2`;
|
|
819
821
|
};
|
|
822
|
+
var isQuoteBelowVenueMinimum = (quoteData) => {
|
|
823
|
+
if (!quoteData) return false;
|
|
824
|
+
if (quoteData.status === "insufficient_balance") return false;
|
|
825
|
+
if (quoteData.status === "min_order_size_violated") return true;
|
|
826
|
+
return typeof quoteData.error === "string" && quoteData.error.startsWith("Trade below ");
|
|
827
|
+
};
|
|
820
828
|
var resolvePlaceOrderQuoteStatus = ({
|
|
821
829
|
amount,
|
|
822
830
|
labels,
|
|
823
831
|
quoteData,
|
|
824
832
|
selectedMarket
|
|
825
833
|
}) => {
|
|
826
|
-
var _a, _b, _c
|
|
834
|
+
var _a, _b, _c;
|
|
827
835
|
if (!selectedMarket) {
|
|
828
836
|
return {
|
|
829
837
|
tone: "warning",
|
|
@@ -832,43 +840,46 @@ var resolvePlaceOrderQuoteStatus = ({
|
|
|
832
840
|
};
|
|
833
841
|
}
|
|
834
842
|
if (!quoteData) return void 0;
|
|
835
|
-
if (quoteData.status === "
|
|
843
|
+
if (quoteData.status === "insufficient_balance") {
|
|
844
|
+
return void 0;
|
|
845
|
+
}
|
|
846
|
+
if (isQuoteBelowVenueMinimum(quoteData)) {
|
|
836
847
|
return {
|
|
837
848
|
tone: "error",
|
|
838
|
-
message: labels.
|
|
849
|
+
message: labels.minOrderSizeViolated,
|
|
839
850
|
placement: "above-action"
|
|
840
851
|
};
|
|
841
852
|
}
|
|
842
|
-
if (quoteData.status === "
|
|
853
|
+
if (quoteData.status === "no_orderbooks") {
|
|
843
854
|
return {
|
|
844
855
|
tone: "error",
|
|
845
|
-
message: labels.
|
|
856
|
+
message: labels.noOrderbooks,
|
|
846
857
|
placement: "above-action"
|
|
847
858
|
};
|
|
848
859
|
}
|
|
849
|
-
if (quoteData.status === "
|
|
860
|
+
if (quoteData.status === "infeasible") {
|
|
850
861
|
return {
|
|
851
862
|
tone: "error",
|
|
852
|
-
message:
|
|
863
|
+
message: labels.insufficientLiquidity,
|
|
853
864
|
placement: "above-action"
|
|
854
865
|
};
|
|
855
866
|
}
|
|
856
867
|
if (quoteData.status === "insufficient_input_amount") {
|
|
857
868
|
return {
|
|
858
869
|
tone: "error",
|
|
859
|
-
message: (
|
|
870
|
+
message: (_a = quoteData.message) != null ? _a : labels.insufficientInputAmount,
|
|
860
871
|
placement: "above-action"
|
|
861
872
|
};
|
|
862
873
|
}
|
|
863
874
|
if (quoteData.status === "invalid_input") {
|
|
864
875
|
return {
|
|
865
876
|
tone: "error",
|
|
866
|
-
message: (
|
|
877
|
+
message: (_b = quoteData.message) != null ? _b : labels.quoteUnavailable,
|
|
867
878
|
placement: "above-action"
|
|
868
879
|
};
|
|
869
880
|
}
|
|
870
881
|
if (quoteData.status === "insufficient_position") {
|
|
871
|
-
const total = (
|
|
882
|
+
const total = (_c = quoteData.positionAvailability) == null ? void 0 : _c.totalSellableShares;
|
|
872
883
|
const message = total != null ? labels.insufficientPosition(total) : labels.insufficientPositionGeneric;
|
|
873
884
|
return { tone: "error", message, placement: "above-action" };
|
|
874
885
|
}
|
|
@@ -886,9 +897,6 @@ var resolvePlaceOrderQuoteStatus = ({
|
|
|
886
897
|
placement: "above-action"
|
|
887
898
|
};
|
|
888
899
|
}
|
|
889
|
-
if (quoteData.status === "insufficient_balance") {
|
|
890
|
-
return void 0;
|
|
891
|
-
}
|
|
892
900
|
if (quoteData.status !== "ok") {
|
|
893
901
|
return {
|
|
894
902
|
tone: "error",
|
|
@@ -1044,6 +1052,14 @@ var resolveExecutionVenueFromQuote = (quoteData) => {
|
|
|
1044
1052
|
const parsed = parseVenue(dominantFill == null ? void 0 : dominantFill.venue);
|
|
1045
1053
|
return parsed.success ? parsed.data : void 0;
|
|
1046
1054
|
};
|
|
1055
|
+
var routeCardsHaveSameVenueIdentity = (a, b) => {
|
|
1056
|
+
if (a.kind !== b.kind) return false;
|
|
1057
|
+
if (a.kind === "venue") return a.venue === b.venue;
|
|
1058
|
+
const venuesA = [...new Set(a.quoteData.fills.map((f) => f.venue))].sort();
|
|
1059
|
+
const venuesB = [...new Set(b.quoteData.fills.map((f) => f.venue))].sort();
|
|
1060
|
+
if (venuesA.length !== venuesB.length) return false;
|
|
1061
|
+
return venuesA.every((v, i) => v === venuesB[i]);
|
|
1062
|
+
};
|
|
1047
1063
|
var getPlaceOrderPotentialReturn = (quoteData) => {
|
|
1048
1064
|
var _a, _b;
|
|
1049
1065
|
if (!((_a = quoteData == null ? void 0 : quoteData.fills) == null ? void 0 : _a.length) || quoteData.fills.length < 2) return 0;
|
|
@@ -1234,7 +1250,7 @@ var VENUE_NO_QUOTE_PATH_PATTERN = /No active quote path/i;
|
|
|
1234
1250
|
var SOLANA_BLOCKHASH_EXPIRED_PATTERN = /\b(blockhash(?:\s+(?:expired|not\s+found))?|TransactionExpiredBlockheightExceeded|transaction\s+expired)\b/i;
|
|
1235
1251
|
var VENUE_RATE_LIMITED_PATTERN = /\b(429|rate[\s-]?limit(?:ed)?|too\s+many\s+requests|backoff)\b/i;
|
|
1236
1252
|
var SERVICE_BLOCKED_ORDER_PATTERN = /Something on our side blocked this order/i;
|
|
1237
|
-
var ALCHEMY_BALANCE_REVERT_PATTERN = /\b(transfer amount exceeds balance|transferFrom failed|insufficient balance|insufficient funds)\b/i;
|
|
1253
|
+
var ALCHEMY_BALANCE_REVERT_PATTERN = /\b(transfer amount exceeds (?:balance|allowance)|transferFrom failed|insufficient balance|insufficient funds|insufficient allowance)\b/i;
|
|
1238
1254
|
var ALCHEMY_REVERT_DATA_SELECTOR_PATTERN = /\brevertData["']?:?\s*['"]?(0x[0-9a-fA-F]{8})/i;
|
|
1239
1255
|
var REVERT_SELECTOR_MESSAGES = {
|
|
1240
1256
|
// Solady TransferFromFailed() — ERC-20 transferFrom revert. Same recovery
|
|
@@ -1255,6 +1271,7 @@ function lookupRevertSelectorMessage(message) {
|
|
|
1255
1271
|
}
|
|
1256
1272
|
var ALCHEMY_SPONSORSHIP_POLICY_PATTERN = /\b(SPONSORSHIP_FAILED|sponsorship.*(quota|cap|exhausted|disabled)|policy.*(disabled|not found|exhausted))\b/i;
|
|
1257
1273
|
var ALCHEMY_POLICY_MAX_COUNT_PATTERN = /\bSponsorship failed: Policy (max count|count) exceeded\b/i;
|
|
1274
|
+
var ORDER_FAILED_PREFIX_PATTERN = /^Order failed\s+(?:-|--|\u2014)\s+/i;
|
|
1258
1275
|
var VENUE_TERMINATED_STATUS_PATTERN = /\bterminated with status=(\w+)/i;
|
|
1259
1276
|
var friendlyTerminatedStatusMessage = (status) => {
|
|
1260
1277
|
const normalized = status.toLowerCase();
|
|
@@ -1307,72 +1324,70 @@ var normalizePlaceOrderErrorMessage = ({
|
|
|
1307
1324
|
fallbackMessage,
|
|
1308
1325
|
labels
|
|
1309
1326
|
}) => {
|
|
1310
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
1327
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
1311
1328
|
const extractedMessage = extractPlaceOrderErrorMessage(errorMessage);
|
|
1312
1329
|
if (!extractedMessage) return fallbackMessage;
|
|
1313
|
-
|
|
1330
|
+
const normalizedMessage = extractedMessage.replace(ORDER_FAILED_PREFIX_PATTERN, "").trim();
|
|
1331
|
+
if (DAG_CHECK_BALANCE_SHORTFALL_PATTERN.test(normalizedMessage)) {
|
|
1314
1332
|
return (_a = labels == null ? void 0 : labels.quoteBalanceMismatch) != null ? _a : "Quote balance mismatch. Try a different amount.";
|
|
1315
1333
|
}
|
|
1316
|
-
if (VENUE_CONNECTOR_UNREACHABLE_PATTERN.test(
|
|
1334
|
+
if (VENUE_CONNECTOR_UNREACHABLE_PATTERN.test(normalizedMessage)) {
|
|
1317
1335
|
return (_b = labels == null ? void 0 : labels.serviceTemporarilyUnavailable) != null ? _b : "Service temporarily unavailable. Please try again in a moment.";
|
|
1318
1336
|
}
|
|
1319
|
-
if (POLYMARKET_DEADLINE_TOO_SOON_PATTERN.test(
|
|
1337
|
+
if (POLYMARKET_DEADLINE_TOO_SOON_PATTERN.test(normalizedMessage)) {
|
|
1320
1338
|
return (_c = labels == null ? void 0 : labels.orderDeadlineExpiredBeforeSubmission) != null ? _c : "Order deadline expired before submission. Please try again.";
|
|
1321
1339
|
}
|
|
1322
|
-
if (DFLOW_WALLET_UNVERIFIED_PATTERN.test(
|
|
1340
|
+
if (DFLOW_WALLET_UNVERIFIED_PATTERN.test(normalizedMessage)) {
|
|
1323
1341
|
return (_d = labels == null ? void 0 : labels.dflowWalletUnverified) != null ? _d : "Your Solana wallet needs to be verified with dFlow before you can trade Kalshi markets. Verify at https://dflow.net/proof, then try again.";
|
|
1324
1342
|
}
|
|
1325
|
-
if (SELL_NO_ONCHAIN_POSITION_PATTERN.test(
|
|
1343
|
+
if (SELL_NO_ONCHAIN_POSITION_PATTERN.test(normalizedMessage)) {
|
|
1326
1344
|
return (_e = labels == null ? void 0 : labels.sellNoOnchainPosition) != null ? _e : "You don't currently hold any on-chain shares of this outcome. If you just sold or redeemed elsewhere, your position display will refresh shortly \u2014 try again after that.";
|
|
1327
1345
|
}
|
|
1328
|
-
if (VENUE_MARKET_RESOLVED_PATTERN.test(
|
|
1346
|
+
if (VENUE_MARKET_RESOLVED_PATTERN.test(normalizedMessage)) {
|
|
1329
1347
|
return (_f = labels == null ? void 0 : labels.venueMarketResolved) != null ? _f : "This market just resolved. Pick a different market or wait for the next round.";
|
|
1330
1348
|
}
|
|
1331
|
-
if (VENUE_NO_QUOTE_PATH_PATTERN.test(
|
|
1349
|
+
if (VENUE_NO_QUOTE_PATH_PATTERN.test(normalizedMessage)) {
|
|
1332
1350
|
return (_g = labels == null ? void 0 : labels.venueNoQuotePath) != null ? _g : "No active quote path for this market right now. Try a different size, or wait a moment and re-quote.";
|
|
1333
1351
|
}
|
|
1334
|
-
if (QUOTED_PRICE_UNAVAILABLE_PATTERN.test(
|
|
1352
|
+
if (QUOTED_PRICE_UNAVAILABLE_PATTERN.test(normalizedMessage)) {
|
|
1335
1353
|
return (_h = labels == null ? void 0 : labels.quoteUnavailable) != null ? _h : "Quote temporarily unavailable. Please try again.";
|
|
1336
1354
|
}
|
|
1337
|
-
if (VENUE_QUOTE_UNFILLABLE_PATTERN.test(
|
|
1355
|
+
if (VENUE_QUOTE_UNFILLABLE_PATTERN.test(normalizedMessage)) {
|
|
1338
1356
|
return (_i = labels == null ? void 0 : labels.venueQuoteUnfillable) != null ? _i : "The venue couldn't fill this order at the quoted price right now. Try a smaller size, a higher slippage tolerance, or wait a moment and re-quote.";
|
|
1339
1357
|
}
|
|
1340
|
-
if (VENUE_MIN_ORDER_SIZE_PATTERN.test(
|
|
1358
|
+
if (VENUE_MIN_ORDER_SIZE_PATTERN.test(normalizedMessage)) {
|
|
1341
1359
|
return (_j = labels == null ? void 0 : labels.venueMinOrderSize) != null ? _j : "Order size is below the venue minimum. Try a larger amount.";
|
|
1342
1360
|
}
|
|
1343
|
-
if (SOURCE_BALANCE_CHANGED_PATTERN.test(
|
|
1361
|
+
if (SOURCE_BALANCE_CHANGED_PATTERN.test(normalizedMessage)) {
|
|
1344
1362
|
return (_k = labels == null ? void 0 : labels.sourceBalanceChanged) != null ? _k : "Your balance changed since the quote. Refresh and try again, or pick a smaller amount.";
|
|
1345
1363
|
}
|
|
1346
|
-
if (SOLANA_BLOCKHASH_EXPIRED_PATTERN.test(
|
|
1364
|
+
if (SOLANA_BLOCKHASH_EXPIRED_PATTERN.test(normalizedMessage)) {
|
|
1347
1365
|
return (_l = labels == null ? void 0 : labels.solanaBlockhashExpired) != null ? _l : "Solana transaction expired before submission. Please re-quote and try again.";
|
|
1348
1366
|
}
|
|
1349
|
-
if (VENUE_RATE_LIMITED_PATTERN.test(
|
|
1367
|
+
if (VENUE_RATE_LIMITED_PATTERN.test(normalizedMessage)) {
|
|
1350
1368
|
return (_m = labels == null ? void 0 : labels.venueRateLimited) != null ? _m : "The venue is rate-limiting requests right now. Please wait a moment and try again.";
|
|
1351
1369
|
}
|
|
1352
|
-
if (SERVICE_BLOCKED_ORDER_PATTERN.test(
|
|
1370
|
+
if (SERVICE_BLOCKED_ORDER_PATTERN.test(normalizedMessage)) {
|
|
1353
1371
|
return (_n = labels == null ? void 0 : labels.serviceBlockedOrder) != null ? _n : "Something on our side blocked this order. Please contact support if it keeps happening \u2014 retrying with the same quote will hit the same issue.";
|
|
1354
1372
|
}
|
|
1355
|
-
if (ALCHEMY_BALANCE_REVERT_PATTERN.test(
|
|
1356
|
-
return "Your balance changed since the quote.
|
|
1373
|
+
if (ALCHEMY_BALANCE_REVERT_PATTERN.test(normalizedMessage)) {
|
|
1374
|
+
return (_o = labels == null ? void 0 : labels.sourceBalanceChanged) != null ? _o : "Your balance changed since the quote. Refresh and try again, or pick a smaller amount.";
|
|
1357
1375
|
}
|
|
1358
|
-
const selectorMessage = lookupRevertSelectorMessage(
|
|
1376
|
+
const selectorMessage = lookupRevertSelectorMessage(normalizedMessage);
|
|
1359
1377
|
if (selectorMessage) {
|
|
1360
1378
|
return selectorMessage;
|
|
1361
1379
|
}
|
|
1362
|
-
if (ALCHEMY_POLICY_MAX_COUNT_PATTERN.test(
|
|
1380
|
+
if (ALCHEMY_POLICY_MAX_COUNT_PATTERN.test(normalizedMessage)) {
|
|
1363
1381
|
return "Sponsored execution is temporarily unavailable (sponsor policy capacity reached). Please try again in a few minutes.";
|
|
1364
1382
|
}
|
|
1365
|
-
if (ALCHEMY_SPONSORSHIP_POLICY_PATTERN.test(
|
|
1366
|
-
return "Sponsored execution is temporarily unavailable. Please try again.";
|
|
1367
|
-
}
|
|
1368
|
-
if (ALCHEMY_PREPARE_CALLS_ERROR_PATTERN.test(extractedMessage)) {
|
|
1383
|
+
if (ALCHEMY_SPONSORSHIP_POLICY_PATTERN.test(normalizedMessage) || ALCHEMY_SPONSORSHIP_ERROR_PATTERN.test(normalizedMessage) || ALCHEMY_PREPARE_CALLS_ERROR_PATTERN.test(normalizedMessage)) {
|
|
1369
1384
|
return "Sponsored execution is temporarily unavailable. Please try again.";
|
|
1370
1385
|
}
|
|
1371
|
-
const terminatedMatch =
|
|
1386
|
+
const terminatedMatch = normalizedMessage.match(VENUE_TERMINATED_STATUS_PATTERN);
|
|
1372
1387
|
if (terminatedMatch) {
|
|
1373
|
-
return friendlyTerminatedStatusMessage((
|
|
1388
|
+
return friendlyTerminatedStatusMessage((_p = terminatedMatch[1]) != null ? _p : "");
|
|
1374
1389
|
}
|
|
1375
|
-
return
|
|
1390
|
+
return normalizedMessage;
|
|
1376
1391
|
};
|
|
1377
1392
|
var resolvePlaceOrderFailureKind = ({
|
|
1378
1393
|
errorMessage,
|
|
@@ -2783,6 +2798,7 @@ var PlaceOrder = ({
|
|
|
2783
2798
|
className,
|
|
2784
2799
|
classNames,
|
|
2785
2800
|
eventTradingState,
|
|
2801
|
+
executionMode = "live",
|
|
2786
2802
|
isLoading = false,
|
|
2787
2803
|
isPrimaryActionDisabled = false,
|
|
2788
2804
|
isPrimaryActionLoading = false,
|
|
@@ -2791,7 +2807,6 @@ var PlaceOrder = ({
|
|
|
2791
2807
|
onClose,
|
|
2792
2808
|
onOutcomeChange,
|
|
2793
2809
|
onPrimaryAction,
|
|
2794
|
-
onSlippageChange,
|
|
2795
2810
|
onTabChange,
|
|
2796
2811
|
onSuccess,
|
|
2797
2812
|
onError,
|
|
@@ -2868,7 +2883,27 @@ var PlaceOrder = ({
|
|
|
2868
2883
|
);
|
|
2869
2884
|
const isResolvedOutcomeCtaLocked = resolvedEventTradingState.kind === "resolved" || resolvedTradingState.kind === "resolved";
|
|
2870
2885
|
const { isAuthenticated, user } = useAggAuthContext();
|
|
2871
|
-
const
|
|
2886
|
+
const isPaperMode = executionMode === "paper";
|
|
2887
|
+
const liveBalanceState = useAggBalanceState();
|
|
2888
|
+
const paperBalancesQuery = useManagedBalances({
|
|
2889
|
+
enabled: Boolean(isAuthenticated && isPaperMode),
|
|
2890
|
+
mode: "paper"
|
|
2891
|
+
});
|
|
2892
|
+
const paperTotalBalance = useMemo2(() => {
|
|
2893
|
+
var _a2, _b2;
|
|
2894
|
+
const cash = (_b2 = (_a2 = paperBalancesQuery.balances) == null ? void 0 : _a2.cash) != null ? _b2 : [];
|
|
2895
|
+
return cash.reduce((sum, token) => {
|
|
2896
|
+
if (!token.tokenSymbol.toUpperCase().includes("USD")) return sum;
|
|
2897
|
+
return sum + token.chains.reduce((chainSum, chain) => {
|
|
2898
|
+
var _a3;
|
|
2899
|
+
const raw = Number(chain.balanceRaw);
|
|
2900
|
+
if (!Number.isFinite(raw)) return chainSum;
|
|
2901
|
+
return chainSum + raw / __pow(10, (_a3 = chain.decimals) != null ? _a3 : token.decimals);
|
|
2902
|
+
}, 0);
|
|
2903
|
+
}, 0);
|
|
2904
|
+
}, [paperBalancesQuery.balances]);
|
|
2905
|
+
const totalBalance = isPaperMode ? paperTotalBalance : liveBalanceState.totalBalance;
|
|
2906
|
+
const isBalanceLoading = isPaperMode ? paperBalancesQuery.isLoading : liveBalanceState.isLoading;
|
|
2872
2907
|
const executeManaged = useExecuteManaged();
|
|
2873
2908
|
const aggClient = useAggClient2();
|
|
2874
2909
|
const queryClient = useQueryClient();
|
|
@@ -2902,7 +2937,7 @@ var PlaceOrder = ({
|
|
|
2902
2937
|
const [internalTab, setInternalTab] = useState3("buy");
|
|
2903
2938
|
const [internalAmount, setInternalAmount] = useState3(PLACE_ORDER_DEFAULT_AMOUNT);
|
|
2904
2939
|
const [sellFilledForOutcomeId, setSellFilledForOutcomeId] = useState3(null);
|
|
2905
|
-
const [internalSlippage
|
|
2940
|
+
const [internalSlippage] = useState3(DEFAULT_SLIPPAGE_VALUE);
|
|
2906
2941
|
const [isRoutesExpanded, setIsRoutesExpanded] = useState3(false);
|
|
2907
2942
|
const [selectedRouteCardId, setSelectedRouteCardId] = useState3(null);
|
|
2908
2943
|
const [isSplitDetailOpen, setIsSplitDetailOpen] = useState3(false);
|
|
@@ -2937,7 +2972,8 @@ var PlaceOrder = ({
|
|
|
2937
2972
|
isLoading: isExecutionPositionsLoading,
|
|
2938
2973
|
isFetching: isExecutionPositionsFetching
|
|
2939
2974
|
} = useExecutionPositions({
|
|
2940
|
-
enabled: Boolean(isAuthenticated && isSell)
|
|
2975
|
+
enabled: Boolean(isAuthenticated && isSell),
|
|
2976
|
+
mode: isPaperMode ? "paper" : void 0
|
|
2941
2977
|
});
|
|
2942
2978
|
const smartRoute = useSmartRoute({
|
|
2943
2979
|
venueMarketOutcomeId: scopedSelectedOutcomeId,
|
|
@@ -2950,6 +2986,7 @@ var PlaceOrder = ({
|
|
|
2950
2986
|
slipCapBps: 1e6,
|
|
2951
2987
|
compareVenues: true,
|
|
2952
2988
|
tradeSide: isSell ? "sell" : "buy",
|
|
2989
|
+
mode: isPaperMode ? "paper" : void 0,
|
|
2953
2990
|
enabled: debouncedAmount > 0 && orderEligibility.canPlaceOrder
|
|
2954
2991
|
});
|
|
2955
2992
|
const currentSellableShares = useMemo2(() => {
|
|
@@ -3089,6 +3126,7 @@ var PlaceOrder = ({
|
|
|
3089
3126
|
);
|
|
3090
3127
|
const executionProgress = useExecutionProgress({
|
|
3091
3128
|
orderIds: (_q = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) != null ? _q : null,
|
|
3129
|
+
mode: isPaperMode ? "paper" : void 0,
|
|
3092
3130
|
enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((_r = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _r.length)
|
|
3093
3131
|
});
|
|
3094
3132
|
const selectedOutcomeLabel = (_u = (_t = (_s = outcomes.find((outcome) => outcome.id === scopedSelectedOutcomeId)) == null ? void 0 : _s.label) != null ? _t : scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.label) != null ? _u : "";
|
|
@@ -3359,7 +3397,12 @@ var PlaceOrder = ({
|
|
|
3359
3397
|
const hasEnteredAmount = internalAmount > 0;
|
|
3360
3398
|
const isQuoteLoading = hasEnteredAmount && (smartRoute.isFetching || smartRoute.isLoading);
|
|
3361
3399
|
const isInsufficientBalance = !isSell && isAuthenticated && hasEnteredAmount && !isBalanceLoading && internalAmount > totalBalance;
|
|
3362
|
-
const
|
|
3400
|
+
const isQuoteInsufficientBalance = (activeQuoteData == null ? void 0 : activeQuoteData.status) === "insufficient_balance";
|
|
3401
|
+
const shouldShowInsufficientBalanceAlert = isInsufficientBalance || isQuoteInsufficientBalance;
|
|
3402
|
+
const isBelowClientMinimum = !isSell && hasEnteredAmount && internalAmount < MIN_BUY_ORDER_AMOUNT;
|
|
3403
|
+
const isBelowVenueMinimumFromQuote = isQuoteBelowVenueMinimum(activeQuoteData);
|
|
3404
|
+
const isBelowMinimum = isBelowClientMinimum || isBelowVenueMinimumFromQuote;
|
|
3405
|
+
const belowMinimumMessage = isBelowClientMinimum ? tradingLabels.minimumOrderAmount(MIN_BUY_ORDER_AMOUNT) : tradingLabels.minOrderSizeViolated;
|
|
3363
3406
|
const quoteStatus = useMemo2(() => {
|
|
3364
3407
|
if (!orderEligibility.canPlaceOrder) return void 0;
|
|
3365
3408
|
return resolvePlaceOrderQuoteStatus({
|
|
@@ -3454,6 +3497,7 @@ var PlaceOrder = ({
|
|
|
3454
3497
|
if (!activeFeeBreakdown) return [];
|
|
3455
3498
|
return [
|
|
3456
3499
|
{
|
|
3500
|
+
kind: "amount",
|
|
3457
3501
|
label: tradingLabels.feeBreakdownVenueFees,
|
|
3458
3502
|
value: formatUsd(activeFeeBreakdown.venueFees, {
|
|
3459
3503
|
minimumFractionDigits: 2,
|
|
@@ -3461,25 +3505,25 @@ var PlaceOrder = ({
|
|
|
3461
3505
|
})
|
|
3462
3506
|
},
|
|
3463
3507
|
{
|
|
3464
|
-
|
|
3465
|
-
|
|
3508
|
+
kind: "amount",
|
|
3509
|
+
label: tradingLabels.feeBreakdownExecutionGas,
|
|
3510
|
+
value: formatUsd(activeFeeBreakdown.executionGas, {
|
|
3466
3511
|
minimumFractionDigits: 2,
|
|
3467
3512
|
maximumFractionDigits: 2
|
|
3468
3513
|
})
|
|
3469
3514
|
},
|
|
3470
3515
|
{
|
|
3471
|
-
|
|
3472
|
-
|
|
3516
|
+
kind: "amount",
|
|
3517
|
+
label: tradingLabels.feeBreakdownBridgeFees,
|
|
3518
|
+
value: formatUsd(activeFeeBreakdown.bridgeFees, {
|
|
3473
3519
|
minimumFractionDigits: 2,
|
|
3474
3520
|
maximumFractionDigits: 2
|
|
3475
3521
|
})
|
|
3476
3522
|
},
|
|
3477
3523
|
{
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
{ minimumFractionDigits: 2, maximumFractionDigits: 2 }
|
|
3482
|
-
)
|
|
3524
|
+
kind: "badge",
|
|
3525
|
+
label: tradingLabels.feeBreakdownAggMarket,
|
|
3526
|
+
badgeLabel: tradingLabels.feeBreakdownPlatformFeeBadge
|
|
3483
3527
|
}
|
|
3484
3528
|
];
|
|
3485
3529
|
}, [activeFeeBreakdown, tradingLabels]);
|
|
@@ -3500,8 +3544,8 @@ var PlaceOrder = ({
|
|
|
3500
3544
|
}, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
|
|
3501
3545
|
const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked;
|
|
3502
3546
|
const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
|
|
3503
|
-
const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isBelowMinimum || isQuoteLoading || !selectedRouteCard || !selectedRouteCard.quoteData.quoteId || selectedRouteGeoBlocked || !isAuthenticated || quoteStatus !== void 0;
|
|
3504
|
-
const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && (orderedRouteCards.length > 0 || smartRoute.isFetching);
|
|
3547
|
+
const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isQuoteInsufficientBalance || isBelowMinimum || isQuoteLoading || !selectedRouteCard || !selectedRouteCard.quoteData.quoteId || selectedRouteGeoBlocked || !isAuthenticated || quoteStatus !== void 0;
|
|
3548
|
+
const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (orderedRouteCards.length > 0 || smartRoute.isFetching);
|
|
3505
3549
|
const shouldShowRouteToggle = !isQuoteLoading && orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
|
|
3506
3550
|
const handleReturnToOrderForm = useCallback2(() => {
|
|
3507
3551
|
const submittedSelection = submittedSelectionRef.current;
|
|
@@ -3556,16 +3600,19 @@ var PlaceOrder = ({
|
|
|
3556
3600
|
});
|
|
3557
3601
|
executionDebugAttemptIdRef.current = (_c2 = debugAttempt == null ? void 0 : debugAttempt.attemptId) != null ? _c2 : null;
|
|
3558
3602
|
if (onPrimaryAction) {
|
|
3603
|
+
const primaryActionPayload = isPaperMode ? { quoteId, mode: "paper" } : { quoteId };
|
|
3559
3604
|
debugStore == null ? void 0 : debugStore.appendEvent(debugAttempt.attemptId, {
|
|
3560
3605
|
kind: "execute_request",
|
|
3561
3606
|
label: "delegated_to_partner",
|
|
3562
|
-
data:
|
|
3607
|
+
data: primaryActionPayload
|
|
3563
3608
|
});
|
|
3564
|
-
onPrimaryAction(
|
|
3609
|
+
onPrimaryAction(primaryActionPayload);
|
|
3565
3610
|
return;
|
|
3566
3611
|
}
|
|
3567
3612
|
try {
|
|
3568
|
-
const response = yield executeManaged.mutateAsync(
|
|
3613
|
+
const response = yield executeManaged.mutateAsync(
|
|
3614
|
+
isPaperMode ? { quoteId, mode: "paper" } : { quoteId }
|
|
3615
|
+
);
|
|
3569
3616
|
if (debugAttempt) {
|
|
3570
3617
|
debugStore == null ? void 0 : debugStore.appendEvent(debugAttempt.attemptId, {
|
|
3571
3618
|
kind: "execute_response",
|
|
@@ -3610,6 +3657,7 @@ var PlaceOrder = ({
|
|
|
3610
3657
|
internalAmount,
|
|
3611
3658
|
internalSlippage,
|
|
3612
3659
|
isSell,
|
|
3660
|
+
isPaperMode,
|
|
3613
3661
|
onPrimaryAction,
|
|
3614
3662
|
scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.id,
|
|
3615
3663
|
scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id,
|
|
@@ -3687,7 +3735,8 @@ var PlaceOrder = ({
|
|
|
3687
3735
|
chainBalances: chainBalancesOverride,
|
|
3688
3736
|
slipCapBps: 1e6,
|
|
3689
3737
|
compareVenues: true,
|
|
3690
|
-
tradeSide: isSell ? "sell" : "buy"
|
|
3738
|
+
tradeSide: isSell ? "sell" : "buy",
|
|
3739
|
+
mode: isPaperMode ? "paper" : void 0
|
|
3691
3740
|
});
|
|
3692
3741
|
} else {
|
|
3693
3742
|
const refetchedQuoteResult = yield smartRoute.refetch();
|
|
@@ -3702,8 +3751,10 @@ var PlaceOrder = ({
|
|
|
3702
3751
|
quoteData: refetchedQuoteData,
|
|
3703
3752
|
tradeSide: internalTab
|
|
3704
3753
|
});
|
|
3754
|
+
const originalSelectedCard = selectedRouteCardId ? orderedRouteCards.find((card) => card.id === selectedRouteCardId) : void 0;
|
|
3705
3755
|
const refreshedSelectedCard = selectedRouteCardId ? refreshedCards.find((card) => card.id === selectedRouteCardId) : void 0;
|
|
3706
|
-
|
|
3756
|
+
const venueIdentityChanged = !!originalSelectedCard && !!refreshedSelectedCard && !routeCardsHaveSameVenueIdentity(originalSelectedCard, refreshedSelectedCard);
|
|
3757
|
+
if (selectedRouteCardId && (!refreshedSelectedCard || venueIdentityChanged)) {
|
|
3707
3758
|
setSubmissionProgressState(null);
|
|
3708
3759
|
setSubmissionFeedback({
|
|
3709
3760
|
message: tradingLabels.selectedVenueUnavailable,
|
|
@@ -3733,8 +3784,10 @@ var PlaceOrder = ({
|
|
|
3733
3784
|
internalAmount,
|
|
3734
3785
|
internalTab,
|
|
3735
3786
|
isSell,
|
|
3787
|
+
isPaperMode,
|
|
3736
3788
|
onAmountChange,
|
|
3737
3789
|
orderEligibility.canPlaceOrder,
|
|
3790
|
+
orderedRouteCards,
|
|
3738
3791
|
scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets,
|
|
3739
3792
|
scopedSelectedOutcomeId,
|
|
3740
3793
|
selectedRouteCardId,
|
|
@@ -4011,7 +4064,7 @@ var PlaceOrder = ({
|
|
|
4011
4064
|
/* @__PURE__ */ jsxs3("div", { className: "agg-order-amount-meta flex flex-col", children: [
|
|
4012
4065
|
/* @__PURE__ */ jsx4("p", { className: "agg-order-amount-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground whitespace-nowrap", children: tradingLabels.amount(internalTab) }),
|
|
4013
4066
|
isAuthenticated ? isSell ? /* @__PURE__ */ jsx4("div", { className: "agg-balance-value flex items-baseline gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isCurrentSellableSharesLoading ? /* @__PURE__ */ jsx4(LoadingIcon, { size: "small" }) : /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
4014
|
-
/* @__PURE__ */ jsx4("span", { children: tradingLabels.shares(displayedCurrentSellableShares) }),
|
|
4067
|
+
/* @__PURE__ */ jsx4("span", { className: "whitespace-pre", children: tradingLabels.shares(displayedCurrentSellableShares) }),
|
|
4015
4068
|
displayedCurrentSellableShares > 0 ? /* @__PURE__ */ jsx4(
|
|
4016
4069
|
"button",
|
|
4017
4070
|
{
|
|
@@ -4036,7 +4089,7 @@ var PlaceOrder = ({
|
|
|
4036
4089
|
value: internalAmount,
|
|
4037
4090
|
onChange: handleAmountChange,
|
|
4038
4091
|
ariaLabel: tradingLabels.amount(internalTab),
|
|
4039
|
-
isInvalid: isInsufficientBalance,
|
|
4092
|
+
isInvalid: isInsufficientBalance || isBelowMinimum,
|
|
4040
4093
|
disabled: !orderEligibility.canPlaceOrder,
|
|
4041
4094
|
prefix: internalTab === "buy" ? "$" : "",
|
|
4042
4095
|
decimalPlaces: isSell ? 6 : 2,
|
|
@@ -4050,7 +4103,7 @@ var PlaceOrder = ({
|
|
|
4050
4103
|
}
|
|
4051
4104
|
)
|
|
4052
4105
|
] }),
|
|
4053
|
-
showFeesBreakdown && hasEnteredAmount && estimatedFeesValue ? /* @__PURE__ */ jsxs3("div", { className: "agg-order-fees-section flex items-center justify-between gap-4", children: [
|
|
4106
|
+
showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */ jsxs3("div", { className: "agg-order-fees-section flex items-center justify-between gap-4", children: [
|
|
4054
4107
|
/* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1.5", children: [
|
|
4055
4108
|
/* @__PURE__ */ jsx4(
|
|
4056
4109
|
Typography,
|
|
@@ -4064,13 +4117,31 @@ var PlaceOrder = ({
|
|
|
4064
4117
|
Tooltip,
|
|
4065
4118
|
{
|
|
4066
4119
|
"aria-label": tradingLabels.estimatedFeesTooltipAria,
|
|
4067
|
-
|
|
4120
|
+
classNames: {
|
|
4121
|
+
content: cn(
|
|
4122
|
+
"min-w-[220px] max-w-[320px] rounded-[10px] px-5 py-4",
|
|
4123
|
+
"shadow-[0_12px_12px_rgba(0,0,0,0.10)]"
|
|
4124
|
+
),
|
|
4125
|
+
icon: "h-3 w-3 text-agg-muted-foreground",
|
|
4126
|
+
trigger: "h-3 w-3 text-agg-muted-foreground"
|
|
4127
|
+
},
|
|
4128
|
+
content: /* @__PURE__ */ jsx4("div", { className: "flex w-full flex-col gap-2", children: feeBreakdownRows.map((row) => /* @__PURE__ */ jsxs3(
|
|
4068
4129
|
"div",
|
|
4069
4130
|
{
|
|
4070
|
-
className: "flex items-center justify-between gap-3 text-agg-sm leading-agg-5",
|
|
4131
|
+
className: "flex items-center justify-between gap-3 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground",
|
|
4071
4132
|
children: [
|
|
4072
|
-
/* @__PURE__ */ jsx4("span", {
|
|
4073
|
-
/* @__PURE__ */ jsx4(
|
|
4133
|
+
/* @__PURE__ */ jsx4("span", { children: row.label }),
|
|
4134
|
+
row.kind === "badge" ? /* @__PURE__ */ jsx4(
|
|
4135
|
+
"span",
|
|
4136
|
+
{
|
|
4137
|
+
className: cn(
|
|
4138
|
+
"agg-fee-badge inline-flex items-center justify-center rounded-agg-sm border border-agg-primary/50",
|
|
4139
|
+
"bg-linear-to-b from-agg-primary/8 to-agg-primary/15 px-1.5 py-1",
|
|
4140
|
+
"text-agg-xs font-agg-bold leading-agg-4 text-agg-primary uppercase whitespace-nowrap"
|
|
4141
|
+
),
|
|
4142
|
+
children: row.badgeLabel
|
|
4143
|
+
}
|
|
4144
|
+
) : /* @__PURE__ */ jsx4("span", { className: "text-right", children: row.value })
|
|
4074
4145
|
]
|
|
4075
4146
|
},
|
|
4076
4147
|
row.label
|
|
@@ -4078,7 +4149,7 @@ var PlaceOrder = ({
|
|
|
4078
4149
|
}
|
|
4079
4150
|
) : null
|
|
4080
4151
|
] }),
|
|
4081
|
-
/* @__PURE__ */ jsx4("p", { className: "text-agg-sm
|
|
4152
|
+
/* @__PURE__ */ jsx4("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: estimatedFeesValue })
|
|
4082
4153
|
] }) : null,
|
|
4083
4154
|
shouldShowSmartRouting ? /* @__PURE__ */ jsxs3("div", { className: "agg-route-panel flex flex-col gap-3", children: [
|
|
4084
4155
|
/* @__PURE__ */ jsxs3("div", { className: "agg-route-panel-header flex items-center justify-between gap-4", children: [
|
|
@@ -4128,7 +4199,7 @@ var PlaceOrder = ({
|
|
|
4128
4199
|
}) }, card.id);
|
|
4129
4200
|
}) : null })
|
|
4130
4201
|
] }) : null,
|
|
4131
|
-
hasEnteredAmount && selectedRouteCard && !isQuoteLoading && orderEligibility.canPlaceOrder ? /* @__PURE__ */ jsxs3("div", { className: "agg-order-summary flex items-start justify-between gap-4", children: [
|
|
4202
|
+
hasEnteredAmount && selectedRouteCard && !isQuoteLoading && !isBelowMinimum && orderEligibility.canPlaceOrder ? /* @__PURE__ */ jsxs3("div", { className: "agg-order-summary flex items-start justify-between gap-4", children: [
|
|
4132
4203
|
/* @__PURE__ */ jsxs3("div", { className: "agg-order-summary-meta flex flex-col", children: [
|
|
4133
4204
|
/* @__PURE__ */ jsx4("p", { className: "agg-order-summary-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.toWin(internalTab) }),
|
|
4134
4205
|
/* @__PURE__ */ jsx4("p", { className: "agg-order-summary-hint text-agg-sm leading-agg-5 text-agg-muted-foreground", children: displayedToWinHint })
|
|
@@ -4164,13 +4235,7 @@ var PlaceOrder = ({
|
|
|
4164
4235
|
message: submissionFeedback.message
|
|
4165
4236
|
}
|
|
4166
4237
|
) : null,
|
|
4167
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && isBelowMinimum ? /* @__PURE__ */ jsx4(
|
|
4168
|
-
InlineAlert,
|
|
4169
|
-
{
|
|
4170
|
-
tone: "error",
|
|
4171
|
-
message: tradingLabels.minimumOrderAmount(MIN_BUY_ORDER_AMOUNT)
|
|
4172
|
-
}
|
|
4173
|
-
) : null,
|
|
4238
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && isBelowMinimum ? /* @__PURE__ */ jsx4(InlineAlert, { tone: "error", message: belowMinimumMessage }) : null,
|
|
4174
4239
|
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && quoteStatus ? /* @__PURE__ */ jsx4(InlineAlert, { tone: quoteStatus.tone, message: quoteStatus.message }) : null,
|
|
4175
4240
|
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && !quoteStatus && isAuthenticated && hasEnteredAmount && smartRouteErrorMessage ? /* @__PURE__ */ jsx4(
|
|
4176
4241
|
InlineAlert,
|
|
@@ -4184,7 +4249,7 @@ var PlaceOrder = ({
|
|
|
4184
4249
|
}
|
|
4185
4250
|
) : null
|
|
4186
4251
|
] }) : null,
|
|
4187
|
-
!submissionFeedback && !shouldShowGeoBlockBanner && orderEligibility.canPlaceOrder &&
|
|
4252
|
+
!submissionFeedback && !shouldShowGeoBlockBanner && orderEligibility.canPlaceOrder && shouldShowInsufficientBalanceAlert ? /* @__PURE__ */ jsxs3(
|
|
4188
4253
|
"div",
|
|
4189
4254
|
{
|
|
4190
4255
|
className: "agg-order-insufficient-balance-alert flex items-center justify-center gap-2",
|