@agg-build/ui 2.1.2 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-ZOECARZW.mjs → chunk-BW7S2YR3.mjs} +798 -312
- package/dist/{chunk-7ZR5JYB3.mjs → chunk-FLESSOSU.mjs} +2077 -533
- package/dist/{chunk-5RBHMMY3.mjs → chunk-R2YNZJZ3.mjs} +69 -27
- package/dist/{chunk-75AMJAWR.mjs → chunk-T4YZGAYS.mjs} +22 -1
- package/dist/{chunk-JJDYOBVG.mjs → chunk-TBZWRUFB.mjs} +654 -560
- package/dist/{chunk-TBD3N4T4.mjs → chunk-VP76G6PN.mjs} +41 -41
- package/dist/{chunk-NRNBJPYK.mjs → chunk-XHE2VO3S.mjs} +4 -21
- package/dist/events.js +776 -638
- package/dist/events.mjs +5 -3
- package/dist/index.js +5665 -3867
- package/dist/index.mjs +112 -455
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +8330 -6452
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +40 -41
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +652 -415
- package/dist/trading.mjs +4 -4
- package/dist/types/events/item/event-list-item.utils.d.mts +1 -25
- package/dist/types/events/item/event-list-item.utils.d.ts +1 -25
- package/dist/types/events/item-details/index.d.mts +2 -1
- package/dist/types/events/item-details/index.d.ts +2 -1
- package/dist/types/events/market-details/market-details-graph-panel.d.mts +39 -0
- package/dist/types/events/market-details/market-details-graph-panel.d.ts +39 -0
- package/dist/types/events/market-details/market-details-outcome-button.d.mts +2 -1
- package/dist/types/events/market-details/market-details-outcome-button.d.ts +2 -1
- package/dist/types/events/market-details/market-details.types.d.mts +31 -0
- package/dist/types/events/market-details/market-details.types.d.ts +31 -0
- package/dist/types/events/market-details/market-details.utils.d.mts +3 -16
- package/dist/types/events/market-details/market-details.utils.d.ts +3 -16
- package/dist/types/events/shared/format-event-title.d.mts +1 -2
- package/dist/types/events/shared/format-event-title.d.ts +1 -2
- 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/notifications/agg-notification-events-provider.d.mts +10 -1
- package/dist/types/notifications/agg-notification-events-provider.d.ts +10 -1
- package/dist/types/pages/event-market/event-market.shared.d.mts +30 -0
- package/dist/types/pages/event-market/event-market.shared.d.ts +30 -0
- package/dist/types/pages/event-market/sports-event-market-page.d.mts +8 -0
- package/dist/types/pages/event-market/sports-event-market-page.d.ts +8 -0
- package/dist/types/pages/event-market/sports-event-market.fixtures.d.mts +13 -0
- package/dist/types/pages/event-market/sports-event-market.fixtures.d.ts +13 -0
- package/dist/types/pages/event-market/sports-event-market.utils.d.mts +156 -0
- package/dist/types/pages/event-market/sports-event-market.utils.d.ts +156 -0
- package/dist/types/pages/event-market/sports-line-rail.d.mts +17 -0
- package/dist/types/pages/event-market/sports-line-rail.d.ts +17 -0
- package/dist/types/pages/event-market/sports-market-card.d.mts +22 -0
- package/dist/types/pages/event-market/sports-market-card.d.ts +22 -0
- package/dist/types/pages/event-market/sports-markets.d.mts +13 -0
- package/dist/types/pages/event-market/sports-markets.d.ts +13 -0
- package/dist/types/primitives/search/search.utils.d.mts +1 -3
- package/dist/types/primitives/search/search.utils.d.ts +1 -3
- package/dist/types/primitives/state-message/index.d.mts +1 -1
- package/dist/types/primitives/state-message/index.d.ts +1 -1
- package/dist/types/primitives/state-message/state-message.types.d.mts +1 -1
- package/dist/types/primitives/state-message/state-message.types.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 +7 -0
- package/dist/types/trading/place-order/index.place-order.types.d.ts +7 -0
- package/dist/types/trading/settlement/settlement-text.utils.d.mts +5 -2
- package/dist/types/trading/settlement/settlement-text.utils.d.ts +5 -2
- package/package.json +3 -3
package/dist/trading.js
CHANGED
|
@@ -101,7 +101,7 @@ __export(trading_exports, {
|
|
|
101
101
|
parseAmount: () => parseAmount,
|
|
102
102
|
parseVenue: () => parseVenue,
|
|
103
103
|
useClaimWinnings: () => useClaimWinnings,
|
|
104
|
-
useEventTradingContext: () =>
|
|
104
|
+
useEventTradingContext: () => import_hooks31.useEventTradingContext,
|
|
105
105
|
useResolvedMarketClaim: () => useResolvedMarketClaim
|
|
106
106
|
});
|
|
107
107
|
module.exports = __toCommonJS(trading_exports);
|
|
@@ -930,7 +930,6 @@ var normalizeSettlementForCompare = (input) => {
|
|
|
930
930
|
};
|
|
931
931
|
var dedupeSettlementSources = (sources) => {
|
|
932
932
|
const order = ["eventDescription", "marketDescription", "primaryRules"];
|
|
933
|
-
const seen = /* @__PURE__ */ new Set();
|
|
934
933
|
const result = [];
|
|
935
934
|
for (const key of order) {
|
|
936
935
|
const value = sources[key];
|
|
@@ -939,11 +938,13 @@ var dedupeSettlementSources = (sources) => {
|
|
|
939
938
|
if (!trimmed) continue;
|
|
940
939
|
const fingerprint = normalizeSettlementForCompare(trimmed);
|
|
941
940
|
if (!fingerprint) continue;
|
|
942
|
-
if (
|
|
943
|
-
|
|
944
|
-
|
|
941
|
+
if (result.some((block) => block.fingerprint.includes(fingerprint))) continue;
|
|
942
|
+
for (let i = result.length - 1; i >= 0; i -= 1) {
|
|
943
|
+
if (fingerprint.includes(result[i].fingerprint)) result.splice(i, 1);
|
|
944
|
+
}
|
|
945
|
+
result.push({ key, content: trimmed, fingerprint });
|
|
945
946
|
}
|
|
946
|
-
return result;
|
|
947
|
+
return result.map(({ key, content }) => ({ key, content }));
|
|
947
948
|
};
|
|
948
949
|
|
|
949
950
|
// src/trading/settlement/settlement-text-renderer.tsx
|
|
@@ -1207,10 +1208,10 @@ var SettlementDetails = ({ className }) => {
|
|
|
1207
1208
|
SettlementDetails.displayName = "SettlementDetails";
|
|
1208
1209
|
|
|
1209
1210
|
// src/trading/place-order/index.tsx
|
|
1210
|
-
var
|
|
1211
|
-
var
|
|
1211
|
+
var import_hooks30 = require("@agg-build/hooks");
|
|
1212
|
+
var import_react10 = __toESM(require("@number-flow/react"));
|
|
1212
1213
|
var Dialog2 = __toESM(require("@radix-ui/react-dialog"));
|
|
1213
|
-
var
|
|
1214
|
+
var import_react11 = require("react");
|
|
1214
1215
|
|
|
1215
1216
|
// src/events/market-details/market-details.utils.ts
|
|
1216
1217
|
var import_sdk12 = require("@agg-build/sdk");
|
|
@@ -5237,6 +5238,22 @@ var VenueLogo = ({
|
|
|
5237
5238
|
};
|
|
5238
5239
|
VenueLogo.displayName = "VenueLogo";
|
|
5239
5240
|
|
|
5241
|
+
// src/events/shared/format-sports-event-time.ts
|
|
5242
|
+
var import_dayjs4 = __toESM(require("dayjs"));
|
|
5243
|
+
var import_timezone = __toESM(require("dayjs/plugin/timezone"));
|
|
5244
|
+
var import_utc = __toESM(require("dayjs/plugin/utc"));
|
|
5245
|
+
import_dayjs4.default.extend(import_utc.default);
|
|
5246
|
+
import_dayjs4.default.extend(import_timezone.default);
|
|
5247
|
+
var SPORTS_EVENT_TIMEZONE = "America/New_York";
|
|
5248
|
+
var SPORTS_EVENT_TIME_FORMAT = "MMM D, h:mm A";
|
|
5249
|
+
var formatSportsEventTimeEt = (value) => {
|
|
5250
|
+
const resolvedValue = value.trim();
|
|
5251
|
+
if (!resolvedValue) return null;
|
|
5252
|
+
const parsedValue = import_dayjs4.default.utc(resolvedValue);
|
|
5253
|
+
if (!parsedValue.isValid()) return null;
|
|
5254
|
+
return `${parsedValue.tz(SPORTS_EVENT_TIMEZONE).format(SPORTS_EVENT_TIME_FORMAT)} ET`;
|
|
5255
|
+
};
|
|
5256
|
+
|
|
5240
5257
|
// src/primitives/inline-alert/inline-alert.constants.ts
|
|
5241
5258
|
var INLINE_ALERT_DEFAULT_TONE = "error";
|
|
5242
5259
|
var INLINE_ALERT_TONE_ICON_NAME = {
|
|
@@ -5970,6 +5987,98 @@ var Tooltip = ({
|
|
|
5970
5987
|
};
|
|
5971
5988
|
Tooltip.displayName = "Tooltip";
|
|
5972
5989
|
|
|
5990
|
+
// src/notifications/agg-notification-events-provider.tsx
|
|
5991
|
+
var import_hooks28 = require("@agg-build/hooks");
|
|
5992
|
+
var import_react7 = require("react");
|
|
5993
|
+
var import_jsx_runtime120 = require("react/jsx-runtime");
|
|
5994
|
+
var firedOrderNotificationKeys = /* @__PURE__ */ new Set();
|
|
5995
|
+
var MICRO_UNITS_SCALE = 1e6;
|
|
5996
|
+
var formatScaledMicroAmount = (value) => {
|
|
5997
|
+
if (!value) return void 0;
|
|
5998
|
+
if (value.includes(".")) {
|
|
5999
|
+
const parsed = Number(value);
|
|
6000
|
+
if (!Number.isFinite(parsed)) return void 0;
|
|
6001
|
+
return parsed.toLocaleString("en-US", { maximumFractionDigits: 2 });
|
|
6002
|
+
}
|
|
6003
|
+
try {
|
|
6004
|
+
const raw = BigInt(value);
|
|
6005
|
+
const whole = raw / BigInt(MICRO_UNITS_SCALE);
|
|
6006
|
+
const remainder = raw % BigInt(MICRO_UNITS_SCALE);
|
|
6007
|
+
const parsed = Number(whole) + Number(remainder) / MICRO_UNITS_SCALE;
|
|
6008
|
+
return parsed.toLocaleString("en-US", { maximumFractionDigits: 2 });
|
|
6009
|
+
} catch (e) {
|
|
6010
|
+
const parsed = Number(value);
|
|
6011
|
+
if (!Number.isFinite(parsed)) return void 0;
|
|
6012
|
+
return (parsed / MICRO_UNITS_SCALE).toLocaleString("en-US", { maximumFractionDigits: 2 });
|
|
6013
|
+
}
|
|
6014
|
+
};
|
|
6015
|
+
var formatPriceCents = (value) => {
|
|
6016
|
+
if (!value) return void 0;
|
|
6017
|
+
const parsed = Number(value);
|
|
6018
|
+
if (!Number.isFinite(parsed)) return void 0;
|
|
6019
|
+
const cents = parsed * 100;
|
|
6020
|
+
const display2 = cents.toLocaleString("en-US", {
|
|
6021
|
+
minimumFractionDigits: 0,
|
|
6022
|
+
maximumFractionDigits: 1
|
|
6023
|
+
});
|
|
6024
|
+
return `${display2}\xA2`;
|
|
6025
|
+
};
|
|
6026
|
+
var formatSharesLabel = (raw) => {
|
|
6027
|
+
const formatted = formatScaledMicroAmount(raw);
|
|
6028
|
+
if (!formatted) return void 0;
|
|
6029
|
+
return `${formatted} shares`;
|
|
6030
|
+
};
|
|
6031
|
+
var capitalize = (value) => {
|
|
6032
|
+
if (!value) return void 0;
|
|
6033
|
+
return value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();
|
|
6034
|
+
};
|
|
6035
|
+
var venueLabelFor = (venueKey, labels) => {
|
|
6036
|
+
var _a;
|
|
6037
|
+
if (!venueKey) return void 0;
|
|
6038
|
+
const normalized = venueKey.toLowerCase();
|
|
6039
|
+
const lookup = labels.venues;
|
|
6040
|
+
return (_a = lookup[normalized]) != null ? _a : capitalize(venueKey);
|
|
6041
|
+
};
|
|
6042
|
+
function handleOrderEvent({ event, labels, fireOnce }) {
|
|
6043
|
+
var _a, _b;
|
|
6044
|
+
const venueLabel = venueLabelFor(event.venue, labels);
|
|
6045
|
+
const amountLabel = formatSharesLabel((_a = event.actualSharesRaw) != null ? _a : event.filledAmountRaw);
|
|
6046
|
+
const priceLabel = formatPriceCents((_b = event.executionPriceRaw) != null ? _b : event.quotedPriceRaw);
|
|
6047
|
+
const fireOrderOnce = (key, tone, title2, message, detail) => {
|
|
6048
|
+
if (firedOrderNotificationKeys.has(key)) return;
|
|
6049
|
+
firedOrderNotificationKeys.add(key);
|
|
6050
|
+
fireOnce(key, tone, title2, message, detail);
|
|
6051
|
+
};
|
|
6052
|
+
if (event.event === "filled") {
|
|
6053
|
+
fireOrderOnce(
|
|
6054
|
+
`order:${event.orderId}:filled`,
|
|
6055
|
+
"success",
|
|
6056
|
+
labels.notifications.order.filledTitle,
|
|
6057
|
+
labels.notifications.order.filledMessage({ venueLabel, amountLabel, priceLabel })
|
|
6058
|
+
);
|
|
6059
|
+
return;
|
|
6060
|
+
}
|
|
6061
|
+
if (event.event === "partial_fill") {
|
|
6062
|
+
fireOrderOnce(
|
|
6063
|
+
`order:${event.orderId}:partial_fill`,
|
|
6064
|
+
"warning",
|
|
6065
|
+
labels.notifications.order.partialFilledTitle,
|
|
6066
|
+
labels.notifications.order.partialFilledMessage({ venueLabel, amountLabel, priceLabel })
|
|
6067
|
+
);
|
|
6068
|
+
return;
|
|
6069
|
+
}
|
|
6070
|
+
if (event.event === "failed") {
|
|
6071
|
+
fireOrderOnce(
|
|
6072
|
+
`order:${event.orderId}:failed`,
|
|
6073
|
+
"error",
|
|
6074
|
+
labels.notifications.order.failedTitle,
|
|
6075
|
+
labels.notifications.order.failedMessage(event.errorReason),
|
|
6076
|
+
venueLabel
|
|
6077
|
+
);
|
|
6078
|
+
}
|
|
6079
|
+
}
|
|
6080
|
+
var CLIENT_DEPOSIT_ACTIVITY_SUPPRESSION_MS = 2 * 60 * 1e3;
|
|
6081
|
+
|
|
5973
6082
|
// src/shared/deposit-modal-events.ts
|
|
5974
6083
|
var DEPOSIT_MODAL_OPEN_EVENT = "agg-deposit:open-modal";
|
|
5975
6084
|
var requestAggDepositModalOpen = () => {
|
|
@@ -5978,8 +6087,8 @@ var requestAggDepositModalOpen = () => {
|
|
|
5978
6087
|
};
|
|
5979
6088
|
|
|
5980
6089
|
// src/trading/use-kalshi-kyc-flow.ts
|
|
5981
|
-
var
|
|
5982
|
-
var
|
|
6090
|
+
var import_hooks29 = require("@agg-build/hooks");
|
|
6091
|
+
var import_react8 = require("react");
|
|
5983
6092
|
var KYC_PENDING_STORAGE_KEY = "agg_kyc_pending";
|
|
5984
6093
|
var getKycPendingState = () => {
|
|
5985
6094
|
var _a, _b;
|
|
@@ -6009,14 +6118,14 @@ var useKalshiKycFlow = ({
|
|
|
6009
6118
|
walletAddress,
|
|
6010
6119
|
onError
|
|
6011
6120
|
}) => {
|
|
6012
|
-
const client = (0,
|
|
6013
|
-
const [isVerifyModalOpen, setIsVerifyModalOpen] = (0,
|
|
6014
|
-
const [showSuccessModal, setShowSuccessModal] = (0,
|
|
6015
|
-
const [isInitiating, setIsInitiating] = (0,
|
|
6016
|
-
const [needsDepositAddress, setNeedsDepositAddress] = (0,
|
|
6017
|
-
const initiationAttemptRef = (0,
|
|
6018
|
-
const { isReady, isTimedOut } = (0,
|
|
6019
|
-
const pendingState = (0,
|
|
6121
|
+
const client = (0, import_hooks29.useAggClient)();
|
|
6122
|
+
const [isVerifyModalOpen, setIsVerifyModalOpen] = (0, import_react8.useState)(false);
|
|
6123
|
+
const [showSuccessModal, setShowSuccessModal] = (0, import_react8.useState)(false);
|
|
6124
|
+
const [isInitiating, setIsInitiating] = (0, import_react8.useState)(false);
|
|
6125
|
+
const [needsDepositAddress, setNeedsDepositAddress] = (0, import_react8.useState)(false);
|
|
6126
|
+
const initiationAttemptRef = (0, import_react8.useRef)(0);
|
|
6127
|
+
const { isReady, isTimedOut } = (0, import_hooks29.useDepositAddresses)({ enabled: needsDepositAddress, poll: true });
|
|
6128
|
+
const pendingState = (0, import_react8.useMemo)(
|
|
6020
6129
|
() => ({
|
|
6021
6130
|
venue: "kalshi",
|
|
6022
6131
|
userId: userId != null ? userId : null,
|
|
@@ -6024,28 +6133,28 @@ var useKalshiKycFlow = ({
|
|
|
6024
6133
|
}),
|
|
6025
6134
|
[userId, walletAddress]
|
|
6026
6135
|
);
|
|
6027
|
-
const resetInitiation = (0,
|
|
6136
|
+
const resetInitiation = (0, import_react8.useCallback)(() => {
|
|
6028
6137
|
setIsInitiating(false);
|
|
6029
6138
|
setNeedsDepositAddress(false);
|
|
6030
6139
|
}, []);
|
|
6031
|
-
const closeVerifyModal = (0,
|
|
6140
|
+
const closeVerifyModal = (0, import_react8.useCallback)(() => {
|
|
6032
6141
|
initiationAttemptRef.current += 1;
|
|
6033
6142
|
clearKycPendingState();
|
|
6034
6143
|
resetInitiation();
|
|
6035
6144
|
setIsVerifyModalOpen(false);
|
|
6036
6145
|
}, [resetInitiation]);
|
|
6037
|
-
const closeSuccessModal = (0,
|
|
6146
|
+
const closeSuccessModal = (0, import_react8.useCallback)(() => {
|
|
6038
6147
|
setShowSuccessModal(false);
|
|
6039
6148
|
}, []);
|
|
6040
|
-
const openVerifyModal = (0,
|
|
6149
|
+
const openVerifyModal = (0, import_react8.useCallback)(() => {
|
|
6041
6150
|
setIsVerifyModalOpen(true);
|
|
6042
6151
|
}, []);
|
|
6043
|
-
const startVerification = (0,
|
|
6152
|
+
const startVerification = (0, import_react8.useCallback)(() => {
|
|
6044
6153
|
initiationAttemptRef.current += 1;
|
|
6045
6154
|
setIsInitiating(true);
|
|
6046
6155
|
setNeedsDepositAddress(true);
|
|
6047
6156
|
}, []);
|
|
6048
|
-
(0,
|
|
6157
|
+
(0, import_react8.useEffect)(() => {
|
|
6049
6158
|
if (!isInitiating || !isReady) return;
|
|
6050
6159
|
const attemptId = initiationAttemptRef.current;
|
|
6051
6160
|
const redirectUri = window.location.href;
|
|
@@ -6062,14 +6171,14 @@ var useKalshiKycFlow = ({
|
|
|
6062
6171
|
resetInitiation();
|
|
6063
6172
|
});
|
|
6064
6173
|
}, [client, isInitiating, isReady, onError, pendingState, resetInitiation]);
|
|
6065
|
-
(0,
|
|
6174
|
+
(0, import_react8.useEffect)(() => {
|
|
6066
6175
|
if (isTimedOut && isInitiating) {
|
|
6067
6176
|
clearKycPendingState();
|
|
6068
6177
|
resetInitiation();
|
|
6069
6178
|
onError == null ? void 0 : onError(new Error("Deposit address provisioning timed out"));
|
|
6070
6179
|
}
|
|
6071
6180
|
}, [isInitiating, isTimedOut, onError, resetInitiation]);
|
|
6072
|
-
(0,
|
|
6181
|
+
(0, import_react8.useEffect)(() => {
|
|
6073
6182
|
const storedPendingState = getKycPendingState();
|
|
6074
6183
|
const isMatchingSession = (storedPendingState == null ? void 0 : storedPendingState.venue) === "kalshi" && storedPendingState.userId === pendingState.userId && storedPendingState.walletAddress === pendingState.walletAddress;
|
|
6075
6184
|
if (isKalshiVerified && isMatchingSession) {
|
|
@@ -7659,7 +7768,7 @@ var isPercentageBelowMinimum = (value, minimumValue) => {
|
|
|
7659
7768
|
};
|
|
7660
7769
|
|
|
7661
7770
|
// src/trading/place-order/index.place-order.failure.tsx
|
|
7662
|
-
var
|
|
7771
|
+
var import_jsx_runtime121 = require("react/jsx-runtime");
|
|
7663
7772
|
var resolveFailureActionHandler = ({
|
|
7664
7773
|
action,
|
|
7665
7774
|
onDone,
|
|
@@ -7672,12 +7781,12 @@ var resolveFailureActionHandler = ({
|
|
|
7672
7781
|
};
|
|
7673
7782
|
var renderPartialFailureStep = (step) => {
|
|
7674
7783
|
const isWarningStep = step.tone === "warning" || step.tone === "error";
|
|
7675
|
-
return /* @__PURE__ */ (0,
|
|
7784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
|
|
7676
7785
|
"div",
|
|
7677
7786
|
{
|
|
7678
7787
|
className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
7679
7788
|
children: [
|
|
7680
|
-
/* @__PURE__ */ (0,
|
|
7789
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
7681
7790
|
Icon,
|
|
7682
7791
|
{
|
|
7683
7792
|
name: isWarningStep ? "warning-filled" : "check-circle",
|
|
@@ -7686,8 +7795,8 @@ var renderPartialFailureStep = (step) => {
|
|
|
7686
7795
|
"aria-hidden": "true"
|
|
7687
7796
|
}
|
|
7688
7797
|
),
|
|
7689
|
-
/* @__PURE__ */ (0,
|
|
7690
|
-
step.venue ? /* @__PURE__ */ (0,
|
|
7798
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
7799
|
+
step.venue ? /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(VenueLogo, { venue: step.venue, size: "small", className: "h-4 w-4 shrink-0" }) : null
|
|
7691
7800
|
]
|
|
7692
7801
|
},
|
|
7693
7802
|
step.id
|
|
@@ -7706,10 +7815,10 @@ var PlaceOrderFailureView = ({
|
|
|
7706
7815
|
const shouldShowPartialFailureLayout = summary.kind === "partial_fill";
|
|
7707
7816
|
const failureStepGroups = shouldShowPartialFailureLayout ? groupPlaceOrderFailureSteps(summary.steps) : [];
|
|
7708
7817
|
if (shouldShowPartialFailureLayout) {
|
|
7709
|
-
return /* @__PURE__ */ (0,
|
|
7710
|
-
/* @__PURE__ */ (0,
|
|
7711
|
-
/* @__PURE__ */ (0,
|
|
7712
|
-
/* @__PURE__ */ (0,
|
|
7818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Card, { className: cn("group/agg-order-panel", getPlaceOrderContainerClassName(), className), children: /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "agg-order-failure-body flex flex-col gap-6 p-5", children: [
|
|
7819
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "agg-order-failure-header flex flex-col gap-2", children: [
|
|
7820
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "agg-order-failure-market flex items-center gap-3", children: [
|
|
7821
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
7713
7822
|
RemoteImage,
|
|
7714
7823
|
{
|
|
7715
7824
|
src: (_a = summary.eventImage) != null ? _a : null,
|
|
@@ -7717,12 +7826,12 @@ var PlaceOrderFailureView = ({
|
|
|
7717
7826
|
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
7718
7827
|
}
|
|
7719
7828
|
),
|
|
7720
|
-
/* @__PURE__ */ (0,
|
|
7829
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("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 })
|
|
7721
7830
|
] }),
|
|
7722
|
-
summary.eventSubtitle ? /* @__PURE__ */ (0,
|
|
7831
|
+
summary.eventSubtitle ? /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
|
|
7723
7832
|
] }),
|
|
7724
|
-
/* @__PURE__ */ (0,
|
|
7725
|
-
/* @__PURE__ */ (0,
|
|
7833
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "flex flex-col gap-4", children: failureStepGroups.map((group, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "flex flex-col gap-2", children: group.map((step) => renderPartialFailureStep(step)) }, `failure-group-${groupIndex}`)) }),
|
|
7834
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "flex items-center gap-4", children: summary.actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
7726
7835
|
Button,
|
|
7727
7836
|
{
|
|
7728
7837
|
variant: "tertiary",
|
|
@@ -7736,10 +7845,10 @@ var PlaceOrderFailureView = ({
|
|
|
7736
7845
|
)) })
|
|
7737
7846
|
] }) });
|
|
7738
7847
|
}
|
|
7739
|
-
return /* @__PURE__ */ (0,
|
|
7740
|
-
/* @__PURE__ */ (0,
|
|
7741
|
-
/* @__PURE__ */ (0,
|
|
7742
|
-
/* @__PURE__ */ (0,
|
|
7848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Card, { className: cn("group/agg-order-panel", getPlaceOrderContainerClassName(), className), children: /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "agg-order-failure-body flex flex-col gap-6 p-5", children: [
|
|
7849
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "agg-order-failure-header flex flex-col gap-2", children: [
|
|
7850
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "agg-order-failure-market flex items-center gap-3", children: [
|
|
7851
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
7743
7852
|
RemoteImage,
|
|
7744
7853
|
{
|
|
7745
7854
|
src: (_b = summary.eventImage) != null ? _b : null,
|
|
@@ -7747,11 +7856,11 @@ var PlaceOrderFailureView = ({
|
|
|
7747
7856
|
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
7748
7857
|
}
|
|
7749
7858
|
),
|
|
7750
|
-
/* @__PURE__ */ (0,
|
|
7859
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("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 })
|
|
7751
7860
|
] }),
|
|
7752
|
-
summary.eventSubtitle ? /* @__PURE__ */ (0,
|
|
7861
|
+
summary.eventSubtitle ? /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
|
|
7753
7862
|
] }),
|
|
7754
|
-
/* @__PURE__ */ (0,
|
|
7863
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
7755
7864
|
InlineAlert,
|
|
7756
7865
|
{
|
|
7757
7866
|
tone: "error",
|
|
@@ -7760,7 +7869,7 @@ var PlaceOrderFailureView = ({
|
|
|
7760
7869
|
message: tradingLabels.orderFailureDescription((_c = summary.errorMessage) != null ? _c : "")
|
|
7761
7870
|
}
|
|
7762
7871
|
),
|
|
7763
|
-
/* @__PURE__ */ (0,
|
|
7872
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "agg-order-failure-actions flex items-center gap-3", children: summary.actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
7764
7873
|
Button,
|
|
7765
7874
|
{
|
|
7766
7875
|
variant: action.variant === "retry" ? "primary" : "secondary",
|
|
@@ -7777,8 +7886,8 @@ var PlaceOrderFailureView = ({
|
|
|
7777
7886
|
PlaceOrderFailureView.displayName = "PlaceOrderFailureView";
|
|
7778
7887
|
|
|
7779
7888
|
// src/trading/place-order/index.place-order.success.tsx
|
|
7780
|
-
var
|
|
7781
|
-
var
|
|
7889
|
+
var import_react9 = require("react");
|
|
7890
|
+
var import_jsx_runtime122 = require("react/jsx-runtime");
|
|
7782
7891
|
var resolveBuyToWinLabel = (shares) => {
|
|
7783
7892
|
if (!shares) return "$0";
|
|
7784
7893
|
return shares.startsWith("$") ? shares : `$${shares}`;
|
|
@@ -7791,7 +7900,7 @@ var PlaceOrderSuccessView = ({
|
|
|
7791
7900
|
onShare: _onShare
|
|
7792
7901
|
}) => {
|
|
7793
7902
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
7794
|
-
const [isExecutionDetailsExpanded, setIsExecutionDetailsExpanded] = (0,
|
|
7903
|
+
const [isExecutionDetailsExpanded, setIsExecutionDetailsExpanded] = (0, import_react9.useState)(true);
|
|
7795
7904
|
const doneLabel = tradingLabels.orderDone;
|
|
7796
7905
|
const _shareLabel = (_a = tradingLabels.orderShare) != null ? _a : "Share";
|
|
7797
7906
|
const potentialReturnLabel = summary.potentialReturnLabel && tradingLabels.potentialReturnBonus ? tradingLabels.potentialReturnBonus(summary.potentialReturnLabel) : summary.potentialReturnLabel ? `+${summary.potentialReturnLabel} Better Payout` : null;
|
|
@@ -7809,10 +7918,10 @@ var PlaceOrderSuccessView = ({
|
|
|
7809
7918
|
const resolveStepIconClassName = (tone) => {
|
|
7810
7919
|
return tone === "warning" || tone === "error" ? "text-agg-warning" : "text-agg-primary";
|
|
7811
7920
|
};
|
|
7812
|
-
return /* @__PURE__ */ (0,
|
|
7813
|
-
summary.eventTitle ? /* @__PURE__ */ (0,
|
|
7814
|
-
/* @__PURE__ */ (0,
|
|
7815
|
-
/* @__PURE__ */ (0,
|
|
7921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(Card, { className: cn("group/agg-order-panel", getPlaceOrderContainerClassName(), className), children: /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-order-success-body flex flex-col gap-6 p-5", children: [
|
|
7922
|
+
summary.eventTitle ? /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-order-success-header flex flex-col gap-2", children: [
|
|
7923
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-order-success-market flex items-center gap-3", children: [
|
|
7924
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
7816
7925
|
RemoteImage,
|
|
7817
7926
|
{
|
|
7818
7927
|
src: (_h = summary.eventImage) != null ? _h : null,
|
|
@@ -7820,12 +7929,12 @@ var PlaceOrderSuccessView = ({
|
|
|
7820
7929
|
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
7821
7930
|
}
|
|
7822
7931
|
),
|
|
7823
|
-
/* @__PURE__ */ (0,
|
|
7932
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("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 })
|
|
7824
7933
|
] }),
|
|
7825
|
-
summary.eventDateLabel ? /* @__PURE__ */ (0,
|
|
7934
|
+
summary.eventDateLabel ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventDateLabel }) : null
|
|
7826
7935
|
] }) : null,
|
|
7827
|
-
executionStepGroups.length > 0 ? /* @__PURE__ */ (0,
|
|
7828
|
-
/* @__PURE__ */ (0,
|
|
7936
|
+
executionStepGroups.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-order-success-timeline flex flex-col gap-2", children: [
|
|
7937
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
7829
7938
|
"div",
|
|
7830
7939
|
{
|
|
7831
7940
|
"aria-hidden": !isExecutionDetailsExpanded,
|
|
@@ -7838,12 +7947,12 @@ var PlaceOrderSuccessView = ({
|
|
|
7838
7947
|
"transition-[grid-template-rows,opacity] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
7839
7948
|
)
|
|
7840
7949
|
),
|
|
7841
|
-
children: /* @__PURE__ */ (0,
|
|
7950
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { className: "min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { className: "flex flex-col gap-4 pb-2", children: detailedStepGroups.map((group, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { className: "flex flex-col gap-2", children: group.map((step) => /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
|
|
7842
7951
|
"div",
|
|
7843
7952
|
{
|
|
7844
7953
|
className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
7845
7954
|
children: [
|
|
7846
|
-
/* @__PURE__ */ (0,
|
|
7955
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
7847
7956
|
Icon,
|
|
7848
7957
|
{
|
|
7849
7958
|
name: resolveStepIconName(step.tone),
|
|
@@ -7852,8 +7961,8 @@ var PlaceOrderSuccessView = ({
|
|
|
7852
7961
|
"aria-hidden": "true"
|
|
7853
7962
|
}
|
|
7854
7963
|
),
|
|
7855
|
-
/* @__PURE__ */ (0,
|
|
7856
|
-
step.venue ? /* @__PURE__ */ (0,
|
|
7964
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
7965
|
+
step.venue ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
7857
7966
|
VenueLogo,
|
|
7858
7967
|
{
|
|
7859
7968
|
venue: step.venue,
|
|
@@ -7867,7 +7976,7 @@ var PlaceOrderSuccessView = ({
|
|
|
7867
7976
|
)) }, `execution-group-${groupIndex}`)) }) })
|
|
7868
7977
|
}
|
|
7869
7978
|
),
|
|
7870
|
-
finalStep ? hasExecutionDetails ? /* @__PURE__ */ (0,
|
|
7979
|
+
finalStep ? hasExecutionDetails ? /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
|
|
7871
7980
|
"button",
|
|
7872
7981
|
{
|
|
7873
7982
|
type: "button",
|
|
@@ -7879,7 +7988,7 @@ var PlaceOrderSuccessView = ({
|
|
|
7879
7988
|
),
|
|
7880
7989
|
onClick: () => setIsExecutionDetailsExpanded((currentValue) => !currentValue),
|
|
7881
7990
|
children: [
|
|
7882
|
-
/* @__PURE__ */ (0,
|
|
7991
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
7883
7992
|
Icon,
|
|
7884
7993
|
{
|
|
7885
7994
|
name: resolveStepIconName(finalStep.tone),
|
|
@@ -7888,8 +7997,8 @@ var PlaceOrderSuccessView = ({
|
|
|
7888
7997
|
"aria-hidden": "true"
|
|
7889
7998
|
}
|
|
7890
7999
|
),
|
|
7891
|
-
/* @__PURE__ */ (0,
|
|
7892
|
-
/* @__PURE__ */ (0,
|
|
8000
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "min-w-0 flex-1", children: finalStep.label }),
|
|
8001
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
7893
8002
|
Icon,
|
|
7894
8003
|
{
|
|
7895
8004
|
name: isExecutionDetailsExpanded ? "chevron-up" : "chevron-down",
|
|
@@ -7900,8 +8009,8 @@ var PlaceOrderSuccessView = ({
|
|
|
7900
8009
|
)
|
|
7901
8010
|
]
|
|
7902
8011
|
}
|
|
7903
|
-
) : /* @__PURE__ */ (0,
|
|
7904
|
-
/* @__PURE__ */ (0,
|
|
8012
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
8013
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
7905
8014
|
Icon,
|
|
7906
8015
|
{
|
|
7907
8016
|
name: resolveStepIconName(finalStep.tone),
|
|
@@ -7910,34 +8019,34 @@ var PlaceOrderSuccessView = ({
|
|
|
7910
8019
|
"aria-hidden": "true"
|
|
7911
8020
|
}
|
|
7912
8021
|
),
|
|
7913
|
-
/* @__PURE__ */ (0,
|
|
8022
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "min-w-0 flex-1", children: finalStep.label })
|
|
7914
8023
|
] }) : null
|
|
7915
8024
|
] }) : null,
|
|
7916
|
-
/* @__PURE__ */ (0,
|
|
8025
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
|
|
7917
8026
|
"div",
|
|
7918
8027
|
{
|
|
7919
8028
|
className: cn(
|
|
7920
8029
|
"agg-order-success-pill flex min-h-12 w-full items-center justify-center gap-2 rounded-agg-full px-6 py-2.5 text-center text-agg-base font-agg-bold leading-agg-6 text-agg-on-primary bg-agg-success"
|
|
7921
8030
|
),
|
|
7922
8031
|
children: [
|
|
7923
|
-
/* @__PURE__ */ (0,
|
|
7924
|
-
/* @__PURE__ */ (0,
|
|
8032
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(Icon, { name: "success-check", size: "small", className: "h-4 w-4 shrink-0 text-current" }),
|
|
8033
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("span", { children: resolvedActionLabel })
|
|
7925
8034
|
]
|
|
7926
8035
|
}
|
|
7927
8036
|
),
|
|
7928
|
-
/* @__PURE__ */ (0,
|
|
7929
|
-
/* @__PURE__ */ (0,
|
|
7930
|
-
/* @__PURE__ */ (0,
|
|
8037
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-order-success-summary flex items-center justify-between gap-4", children: [
|
|
8038
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.amount(resolvedTradeSide) }),
|
|
8039
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "text-right text-[30px] font-agg-bold leading-[36px] text-agg-foreground", children: resolvedAmountLabel })
|
|
7931
8040
|
] }),
|
|
7932
|
-
/* @__PURE__ */ (0,
|
|
7933
|
-
/* @__PURE__ */ (0,
|
|
7934
|
-
/* @__PURE__ */ (0,
|
|
8041
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-order-success-summary flex items-center justify-between gap-4", children: [
|
|
8042
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.toWin(resolvedTradeSide) }),
|
|
8043
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "text-right text-[30px] font-agg-bold leading-[36px] text-agg-success", children: resolvedToWinLabel })
|
|
7935
8044
|
] }),
|
|
7936
|
-
summary.potentialReturnLabel ? /* @__PURE__ */ (0,
|
|
7937
|
-
/* @__PURE__ */ (0,
|
|
7938
|
-
/* @__PURE__ */ (0,
|
|
8045
|
+
summary.potentialReturnLabel ? /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "flex w-full flex-col items-center justify-center gap-1 overflow-hidden rounded-agg-lg border border-agg-primary/50 bg-gradient-to-b from-agg-primary/8 to-agg-primary/15 p-3 text-center", children: [
|
|
8046
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "bg-gradient-to-r from-agg-primary to-agg-primary-hover bg-clip-text text-agg-lg font-agg-bold leading-[28px] text-transparent", children: potentialReturnLabel }),
|
|
8047
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "text-agg-xs leading-agg-4 text-agg-foreground", children: (_i = tradingLabels.withSmartRouting) != null ? _i : "with Smart Routing" })
|
|
7939
8048
|
] }) : null,
|
|
7940
|
-
/* @__PURE__ */ (0,
|
|
8049
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { className: "agg-order-success-actions flex gap-3", children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
7941
8050
|
Button,
|
|
7942
8051
|
{
|
|
7943
8052
|
variant: "secondary",
|
|
@@ -7953,7 +8062,23 @@ var PlaceOrderSuccessView = ({
|
|
|
7953
8062
|
PlaceOrderSuccessView.displayName = "PlaceOrderSuccessView";
|
|
7954
8063
|
|
|
7955
8064
|
// src/trading/place-order/index.tsx
|
|
7956
|
-
var
|
|
8065
|
+
var import_jsx_runtime123 = require("react/jsx-runtime");
|
|
8066
|
+
var SELL_SHARE_INPUT_DECIMALS = 6;
|
|
8067
|
+
var SELL_SHARE_DISPLAY_DECIMALS = 2;
|
|
8068
|
+
var floorToDecimals = (value, decimals) => {
|
|
8069
|
+
if (!Number.isFinite(value) || value <= 0) return 0;
|
|
8070
|
+
const scale = __pow(10, decimals);
|
|
8071
|
+
return Math.trunc(value * scale) / scale;
|
|
8072
|
+
};
|
|
8073
|
+
var formatFlooredShareAmount = (value, decimals) => {
|
|
8074
|
+
const flooredValue = floorToDecimals(value, decimals);
|
|
8075
|
+
if (flooredValue <= 0) return "0";
|
|
8076
|
+
const formattedValue = flooredValue.toLocaleString("en-US", {
|
|
8077
|
+
minimumFractionDigits: 0,
|
|
8078
|
+
maximumFractionDigits: decimals
|
|
8079
|
+
});
|
|
8080
|
+
return formattedValue.replace(/(\.\d*?[1-9])0+$/u, "$1").replace(/\.0+$/u, "");
|
|
8081
|
+
};
|
|
7957
8082
|
var resolveRefetchedQuoteData = (result) => {
|
|
7958
8083
|
if (!result || typeof result !== "object" || !("data" in result)) return null;
|
|
7959
8084
|
const data = result.data;
|
|
@@ -7972,7 +8097,7 @@ var LoadingGlyph = ({
|
|
|
7972
8097
|
className,
|
|
7973
8098
|
enableAnimations
|
|
7974
8099
|
}) => {
|
|
7975
|
-
return /* @__PURE__ */ (0,
|
|
8100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
7976
8101
|
"span",
|
|
7977
8102
|
{
|
|
7978
8103
|
"aria-hidden": "true",
|
|
@@ -7992,25 +8117,25 @@ var PlaceOrderSlippageControl = ({
|
|
|
7992
8117
|
minimumValue: slippageMinimumValue
|
|
7993
8118
|
}) => {
|
|
7994
8119
|
var _a, _b;
|
|
7995
|
-
const labels = (0,
|
|
7996
|
-
const containerRef = (0,
|
|
7997
|
-
const triggerRef = (0,
|
|
7998
|
-
const inputRef = (0,
|
|
7999
|
-
const warningId = (0,
|
|
8120
|
+
const labels = (0, import_hooks30.useLabels)();
|
|
8121
|
+
const containerRef = (0, import_react11.useRef)(null);
|
|
8122
|
+
const triggerRef = (0, import_react11.useRef)(null);
|
|
8123
|
+
const inputRef = (0, import_react11.useRef)(null);
|
|
8124
|
+
const warningId = (0, import_react11.useId)();
|
|
8000
8125
|
const defaultValue = finalizePercentageValue(slippageDefaultValue);
|
|
8001
8126
|
const committedValue = finalizePercentageValue(slippageValue) || defaultValue;
|
|
8002
|
-
const [draftValue, setDraftValue] = (0,
|
|
8003
|
-
const [isEditing, setIsEditing] = (0,
|
|
8127
|
+
const [draftValue, setDraftValue] = (0, import_react11.useState)(committedValue);
|
|
8128
|
+
const [isEditing, setIsEditing] = (0, import_react11.useState)(
|
|
8004
8129
|
() => isPercentageBelowMinimum(committedValue, slippageMinimumValue)
|
|
8005
8130
|
);
|
|
8006
|
-
const [shouldFocusInput, setShouldFocusInput] = (0,
|
|
8007
|
-
(0,
|
|
8131
|
+
const [shouldFocusInput, setShouldFocusInput] = (0, import_react11.useState)(false);
|
|
8132
|
+
(0, import_react11.useEffect)(() => {
|
|
8008
8133
|
setDraftValue(committedValue);
|
|
8009
8134
|
if (isPercentageBelowMinimum(committedValue, slippageMinimumValue)) {
|
|
8010
8135
|
setIsEditing(true);
|
|
8011
8136
|
}
|
|
8012
8137
|
}, [committedValue, slippageMinimumValue]);
|
|
8013
|
-
(0,
|
|
8138
|
+
(0, import_react11.useEffect)(() => {
|
|
8014
8139
|
if (!shouldFocusInput) return;
|
|
8015
8140
|
requestAnimationFrame(() => {
|
|
8016
8141
|
var _a2, _b2;
|
|
@@ -8027,7 +8152,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
8027
8152
|
Number(committedValue || slippageDefaultValue || DEFAULT_SLIPPAGE_VALUE)
|
|
8028
8153
|
);
|
|
8029
8154
|
const resolvedAutoLabel = labels.trading.resetSlippage;
|
|
8030
|
-
const resolvedWarningMessage = (0,
|
|
8155
|
+
const resolvedWarningMessage = (0, import_react11.useMemo)(() => {
|
|
8031
8156
|
if (isLowSlippage) {
|
|
8032
8157
|
return labels.trading.slippageLow(slippageMinimumValue);
|
|
8033
8158
|
}
|
|
@@ -8090,8 +8215,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
8090
8215
|
if (!isEditing) return;
|
|
8091
8216
|
handleCommitDraft(false);
|
|
8092
8217
|
};
|
|
8093
|
-
return /* @__PURE__ */ (0,
|
|
8094
|
-
/* @__PURE__ */ (0,
|
|
8218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { ref: containerRef, className: "agg-slippage-control w-full", onBlur: handleContainerBlur, children: [
|
|
8219
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
8095
8220
|
"button",
|
|
8096
8221
|
{
|
|
8097
8222
|
ref: triggerRef,
|
|
@@ -8109,8 +8234,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
8109
8234
|
),
|
|
8110
8235
|
onClick: handleToggleEditing,
|
|
8111
8236
|
children: [
|
|
8112
|
-
/* @__PURE__ */ (0,
|
|
8113
|
-
/* @__PURE__ */ (0,
|
|
8237
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { className: "agg-slippage-label", children: collapsedLabel }),
|
|
8238
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8114
8239
|
Icon,
|
|
8115
8240
|
{
|
|
8116
8241
|
name: isEditing ? "chevron-up" : "pencil",
|
|
@@ -8122,7 +8247,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
8122
8247
|
]
|
|
8123
8248
|
}
|
|
8124
8249
|
),
|
|
8125
|
-
/* @__PURE__ */ (0,
|
|
8250
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8126
8251
|
"div",
|
|
8127
8252
|
{
|
|
8128
8253
|
"aria-hidden": !isEditing,
|
|
@@ -8136,10 +8261,10 @@ var PlaceOrderSlippageControl = ({
|
|
|
8136
8261
|
"transition-[grid-template-rows,opacity,margin-top] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
8137
8262
|
)
|
|
8138
8263
|
),
|
|
8139
|
-
children: /* @__PURE__ */ (0,
|
|
8140
|
-
/* @__PURE__ */ (0,
|
|
8141
|
-
/* @__PURE__ */ (0,
|
|
8142
|
-
/* @__PURE__ */ (0,
|
|
8264
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-slippage-editor-body flex flex-col gap-2", children: [
|
|
8265
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-slippage-input-row flex h-9 overflow-hidden rounded-agg-sm border border-agg-separator", children: [
|
|
8266
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-slippage-input-group flex min-w-0 flex-1 items-center gap-2 bg-agg-secondary px-3", children: [
|
|
8267
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8143
8268
|
"input",
|
|
8144
8269
|
{
|
|
8145
8270
|
ref: inputRef,
|
|
@@ -8154,7 +8279,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
8154
8279
|
onKeyDown: handleInputKeyDown
|
|
8155
8280
|
}
|
|
8156
8281
|
),
|
|
8157
|
-
/* @__PURE__ */ (0,
|
|
8282
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8158
8283
|
"button",
|
|
8159
8284
|
{
|
|
8160
8285
|
type: "button",
|
|
@@ -8172,8 +8297,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
8172
8297
|
}
|
|
8173
8298
|
)
|
|
8174
8299
|
] }),
|
|
8175
|
-
/* @__PURE__ */ (0,
|
|
8176
|
-
/* @__PURE__ */ (0,
|
|
8300
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "h-full w-px bg-agg-separator", "aria-hidden": "true" }),
|
|
8301
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8177
8302
|
"div",
|
|
8178
8303
|
{
|
|
8179
8304
|
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",
|
|
@@ -8182,7 +8307,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
8182
8307
|
}
|
|
8183
8308
|
)
|
|
8184
8309
|
] }),
|
|
8185
|
-
/* @__PURE__ */ (0,
|
|
8310
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8186
8311
|
"div",
|
|
8187
8312
|
{
|
|
8188
8313
|
"aria-hidden": !resolvedWarningMessage,
|
|
@@ -8196,13 +8321,13 @@ var PlaceOrderSlippageControl = ({
|
|
|
8196
8321
|
"transition-[grid-template-rows,opacity] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
8197
8322
|
)
|
|
8198
8323
|
),
|
|
8199
|
-
children: /* @__PURE__ */ (0,
|
|
8324
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
8200
8325
|
"div",
|
|
8201
8326
|
{
|
|
8202
8327
|
id: warningId,
|
|
8203
8328
|
className: "agg-slippage-warning-message flex items-start gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
8204
8329
|
children: [
|
|
8205
|
-
/* @__PURE__ */ (0,
|
|
8330
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8206
8331
|
Icon,
|
|
8207
8332
|
{
|
|
8208
8333
|
name: "warning-filled",
|
|
@@ -8211,7 +8336,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
8211
8336
|
color: "currentColor"
|
|
8212
8337
|
}
|
|
8213
8338
|
),
|
|
8214
|
-
/* @__PURE__ */ (0,
|
|
8339
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { children: resolvedWarningMessage != null ? resolvedWarningMessage : "" })
|
|
8215
8340
|
]
|
|
8216
8341
|
}
|
|
8217
8342
|
) })
|
|
@@ -8231,9 +8356,9 @@ var renderCardHeader = ({
|
|
|
8231
8356
|
onClose
|
|
8232
8357
|
}) => {
|
|
8233
8358
|
if (!headerTitle) return null;
|
|
8234
|
-
return /* @__PURE__ */ (0,
|
|
8235
|
-
/* @__PURE__ */ (0,
|
|
8236
|
-
/* @__PURE__ */ (0,
|
|
8359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: cn("agg-order-panel-header flex flex-col gap-2", className), children: [
|
|
8360
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-order-market-summary flex items-center gap-3", children: [
|
|
8361
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8237
8362
|
RemoteImage,
|
|
8238
8363
|
{
|
|
8239
8364
|
src: headerImage,
|
|
@@ -8241,30 +8366,78 @@ var renderCardHeader = ({
|
|
|
8241
8366
|
className: "agg-order-market-image h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
8242
8367
|
}
|
|
8243
8368
|
),
|
|
8244
|
-
/* @__PURE__ */ (0,
|
|
8245
|
-
onClose ? /* @__PURE__ */ (0,
|
|
8369
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("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 }),
|
|
8370
|
+
onClose ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8246
8371
|
"button",
|
|
8247
8372
|
{
|
|
8248
8373
|
type: "button",
|
|
8249
8374
|
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",
|
|
8250
8375
|
"aria-label": "Close",
|
|
8251
8376
|
onClick: onClose,
|
|
8252
|
-
children: /* @__PURE__ */ (0,
|
|
8377
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(CloseIcon, { className: "h-5 w-5" })
|
|
8253
8378
|
}
|
|
8254
8379
|
) : null
|
|
8255
8380
|
] }),
|
|
8256
|
-
headerSubtitle ? /* @__PURE__ */ (0,
|
|
8381
|
+
headerSubtitle ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "agg-order-market-subtitle text-agg-base leading-agg-6 text-agg-foreground", children: headerSubtitle }) : null
|
|
8257
8382
|
] });
|
|
8258
8383
|
};
|
|
8259
8384
|
var PlaceOrderResolvedView = ({
|
|
8260
8385
|
classNames,
|
|
8261
8386
|
tradingState,
|
|
8387
|
+
resolutionTimestamp,
|
|
8262
8388
|
resolvedClaim,
|
|
8263
|
-
className
|
|
8389
|
+
className,
|
|
8390
|
+
isSportsEvent = false
|
|
8264
8391
|
}) => {
|
|
8265
|
-
|
|
8392
|
+
var _a;
|
|
8393
|
+
const labels = (0, import_hooks30.useLabels)();
|
|
8266
8394
|
const tradingLabels = labels.trading;
|
|
8267
|
-
|
|
8395
|
+
const resolvingTimestamp = (_a = resolutionTimestamp != null ? resolutionTimestamp : tradingState.resolvesAt) != null ? _a : tradingState.endsAt;
|
|
8396
|
+
const isResolvingMarket = false;
|
|
8397
|
+
const resolvingSubtitle = tradingState.market ? (() => {
|
|
8398
|
+
const endDateLabel = isSportsEvent ? formatSportsEventTimeEt(resolvingTimestamp != null ? resolvingTimestamp : "") : getTradingDateLabel(resolvingTimestamp != null ? resolvingTimestamp : "");
|
|
8399
|
+
return endDateLabel ? `${tradingState.market.question} \xB7 ${endDateLabel}` : tradingState.market.question;
|
|
8400
|
+
})() : "";
|
|
8401
|
+
if (isResolvingMarket) {
|
|
8402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8403
|
+
Card,
|
|
8404
|
+
{
|
|
8405
|
+
className: cn(
|
|
8406
|
+
"group/agg-order-panel",
|
|
8407
|
+
getPlaceOrderContainerClassName(),
|
|
8408
|
+
classNames == null ? void 0 : classNames.root,
|
|
8409
|
+
className
|
|
8410
|
+
),
|
|
8411
|
+
role: "status",
|
|
8412
|
+
"aria-label": labels.marketDetails.resolvingTitle,
|
|
8413
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
8414
|
+
"div",
|
|
8415
|
+
{
|
|
8416
|
+
className: cn(
|
|
8417
|
+
"agg-order-panel-body flex flex-col items-center justify-center gap-6 px-5 py-10 text-center",
|
|
8418
|
+
classNames == null ? void 0 : classNames.body
|
|
8419
|
+
),
|
|
8420
|
+
children: [
|
|
8421
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "flex h-[60px] w-[60px] items-center justify-center rounded-full bg-agg-primary/10", children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(LoadingIcon, { variant: "prominent" }) }),
|
|
8422
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: cn("flex w-full flex-col items-center gap-1", classNames == null ? void 0 : classNames.content), children: [
|
|
8423
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Typography, { variant: "body-large-strong", children: labels.marketDetails.resolvingTitle }),
|
|
8424
|
+
resolvingSubtitle ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Typography, { variant: "body", className: "text-center", children: resolvingSubtitle }) : null
|
|
8425
|
+
] }),
|
|
8426
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8427
|
+
Typography,
|
|
8428
|
+
{
|
|
8429
|
+
variant: "label",
|
|
8430
|
+
className: "max-w-[300px] text-center text-agg-muted-foreground",
|
|
8431
|
+
children: labels.marketDetails.resolvingDescription
|
|
8432
|
+
}
|
|
8433
|
+
)
|
|
8434
|
+
]
|
|
8435
|
+
}
|
|
8436
|
+
)
|
|
8437
|
+
}
|
|
8438
|
+
);
|
|
8439
|
+
}
|
|
8440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8268
8441
|
Card,
|
|
8269
8442
|
{
|
|
8270
8443
|
className: cn(
|
|
@@ -8273,19 +8446,19 @@ var PlaceOrderResolvedView = ({
|
|
|
8273
8446
|
classNames == null ? void 0 : classNames.root,
|
|
8274
8447
|
className
|
|
8275
8448
|
),
|
|
8276
|
-
children: /* @__PURE__ */ (0,
|
|
8277
|
-
/* @__PURE__ */ (0,
|
|
8278
|
-
/* @__PURE__ */ (0,
|
|
8449
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: cn("agg-order-panel-body flex flex-col", classNames == null ? void 0 : classNames.body), children: [
|
|
8450
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex flex-col items-center gap-6 p-8", children: [
|
|
8451
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8279
8452
|
"div",
|
|
8280
8453
|
{
|
|
8281
8454
|
className: cn(
|
|
8282
8455
|
"flex h-15 w-15 items-center justify-center rounded-full",
|
|
8283
8456
|
"bg-agg-primary/15"
|
|
8284
8457
|
),
|
|
8285
|
-
children: /* @__PURE__ */ (0,
|
|
8458
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Icon, { name: "success-check", className: cn("h-6 w-6", "text-agg-primary") })
|
|
8286
8459
|
}
|
|
8287
8460
|
),
|
|
8288
|
-
/* @__PURE__ */ (0,
|
|
8461
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
8289
8462
|
"div",
|
|
8290
8463
|
{
|
|
8291
8464
|
className: cn(
|
|
@@ -8293,31 +8466,31 @@ var PlaceOrderResolvedView = ({
|
|
|
8293
8466
|
classNames == null ? void 0 : classNames.content
|
|
8294
8467
|
),
|
|
8295
8468
|
children: [
|
|
8296
|
-
tradingState.market ? /* @__PURE__ */ (0,
|
|
8297
|
-
tradingState.winningOutcome ? /* @__PURE__ */ (0,
|
|
8469
|
+
tradingState.market ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Typography, { variant: "body", className: "text-center", children: tradingState.market.question }) : null,
|
|
8470
|
+
tradingState.winningOutcome ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Typography, { variant: "body-large-strong", children: tradingLabels.outcome(tradingState.winningOutcome.label) }) : null
|
|
8298
8471
|
]
|
|
8299
8472
|
}
|
|
8300
8473
|
)
|
|
8301
8474
|
] }),
|
|
8302
|
-
resolvedClaim ? /* @__PURE__ */ (0,
|
|
8303
|
-
/* @__PURE__ */ (0,
|
|
8304
|
-
/* @__PURE__ */ (0,
|
|
8305
|
-
/* @__PURE__ */ (0,
|
|
8306
|
-
/* @__PURE__ */ (0,
|
|
8307
|
-
resolvedClaim.resolutionDateLabel ? /* @__PURE__ */ (0,
|
|
8308
|
-
/* @__PURE__ */ (0,
|
|
8309
|
-
/* @__PURE__ */ (0,
|
|
8475
|
+
resolvedClaim ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(import_jsx_runtime123.Fragment, { children: [
|
|
8476
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
|
|
8477
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex w-full flex-col gap-5 p-6", children: [
|
|
8478
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Typography, { variant: "body-strong", className: "text-center", children: tradingLabels.resolvedEarningsTitle }),
|
|
8479
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex flex-col gap-3 text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
8480
|
+
resolvedClaim.resolutionDateLabel ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
8481
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { children: tradingLabels.resolvedResolutionDateLabel }),
|
|
8482
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { className: "font-agg-bold", children: resolvedClaim.resolutionDateLabel })
|
|
8310
8483
|
] }) : null,
|
|
8311
|
-
/* @__PURE__ */ (0,
|
|
8312
|
-
/* @__PURE__ */ (0,
|
|
8313
|
-
/* @__PURE__ */ (0,
|
|
8484
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
8485
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { children: tradingLabels.resolvedSharesLabel }),
|
|
8486
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { className: "font-agg-bold", children: resolvedClaim.sharesLabel })
|
|
8314
8487
|
] }),
|
|
8315
|
-
/* @__PURE__ */ (0,
|
|
8316
|
-
/* @__PURE__ */ (0,
|
|
8317
|
-
/* @__PURE__ */ (0,
|
|
8488
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
8489
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { children: tradingLabels.resolvedTotalPayoutLabel }),
|
|
8490
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { className: "font-agg-bold", children: resolvedClaim.totalPayoutLabel })
|
|
8318
8491
|
] })
|
|
8319
8492
|
] }),
|
|
8320
|
-
resolvedClaim.onClaim ? /* @__PURE__ */ (0,
|
|
8493
|
+
resolvedClaim.onClaim ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8321
8494
|
Button,
|
|
8322
8495
|
{
|
|
8323
8496
|
size: "large",
|
|
@@ -8338,18 +8511,18 @@ var renderRouteBreakdownRow = (row) => {
|
|
|
8338
8511
|
var _a, _b;
|
|
8339
8512
|
const venueLabel = getTradingVenueLabel(row.venue);
|
|
8340
8513
|
const rowKey = `${row.venue}-${row.label}-${row.priceLabel}-${(_a = row.resultLabel) != null ? _a : ""}`;
|
|
8341
|
-
return /* @__PURE__ */ (0,
|
|
8514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
8342
8515
|
"div",
|
|
8343
8516
|
{
|
|
8344
8517
|
className: "agg-route-breakdown-row flex items-center justify-between gap-4 text-left",
|
|
8345
8518
|
children: [
|
|
8346
|
-
/* @__PURE__ */ (0,
|
|
8347
|
-
/* @__PURE__ */ (0,
|
|
8348
|
-
/* @__PURE__ */ (0,
|
|
8519
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-route-breakdown-market flex min-w-0 items-center gap-2", children: [
|
|
8520
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(VenueLogo, { venue: row.venue, className: "size-3!", ariaLabel: venueLabel }),
|
|
8521
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "agg-route-breakdown-label truncate text-agg-sm leading-agg-5 text-agg-foreground", children: row.label })
|
|
8349
8522
|
] }),
|
|
8350
|
-
/* @__PURE__ */ (0,
|
|
8351
|
-
/* @__PURE__ */ (0,
|
|
8352
|
-
/* @__PURE__ */ (0,
|
|
8523
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-route-breakdown-value flex shrink-0 items-center gap-2 text-agg-sm leading-agg-5", children: [
|
|
8524
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "text-agg-muted-foreground", children: row.priceLabel }),
|
|
8525
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "text-agg-foreground", children: (_b = row.resultLabel) != null ? _b : "" })
|
|
8353
8526
|
] })
|
|
8354
8527
|
]
|
|
8355
8528
|
},
|
|
@@ -8367,7 +8540,7 @@ var renderRouteCard = ({
|
|
|
8367
8540
|
var _a, _b;
|
|
8368
8541
|
const showSplitDetails = isSelected && isExpanded && card.kind === "split" && !!((_a = card.rows) == null ? void 0 : _a.length);
|
|
8369
8542
|
const ariaLabel = [card.label, card.hint, card.value].filter(Boolean).join(" ");
|
|
8370
|
-
return /* @__PURE__ */ (0,
|
|
8543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8371
8544
|
"button",
|
|
8372
8545
|
{
|
|
8373
8546
|
type: "button",
|
|
@@ -8386,10 +8559,10 @@ var renderRouteCard = ({
|
|
|
8386
8559
|
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"
|
|
8387
8560
|
),
|
|
8388
8561
|
onClick: () => onSelect(card.id),
|
|
8389
|
-
children: /* @__PURE__ */ (0,
|
|
8390
|
-
/* @__PURE__ */ (0,
|
|
8391
|
-
/* @__PURE__ */ (0,
|
|
8392
|
-
card.kind === "split" ? /* @__PURE__ */ (0,
|
|
8562
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-route-card-content relative z-10 flex flex-col gap-3", children: [
|
|
8563
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-route-card-header flex items-center justify-between gap-4", children: [
|
|
8564
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-route-card-meta flex min-w-0 gap-3 items-center", children: [
|
|
8565
|
+
card.kind === "split" ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8393
8566
|
Icon,
|
|
8394
8567
|
{
|
|
8395
8568
|
name: "sparkles-filled",
|
|
@@ -8400,7 +8573,7 @@ var renderRouteCard = ({
|
|
|
8400
8573
|
),
|
|
8401
8574
|
"aria-hidden": "true"
|
|
8402
8575
|
}
|
|
8403
|
-
) : card.venue ? /* @__PURE__ */ (0,
|
|
8576
|
+
) : card.venue ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8404
8577
|
VenueLogo,
|
|
8405
8578
|
{
|
|
8406
8579
|
venue: card.venue,
|
|
@@ -8408,10 +8581,10 @@ var renderRouteCard = ({
|
|
|
8408
8581
|
ariaLabel: getTradingVenueLabel(card.venue)
|
|
8409
8582
|
}
|
|
8410
8583
|
) : null,
|
|
8411
|
-
/* @__PURE__ */ (0,
|
|
8412
|
-
/* @__PURE__ */ (0,
|
|
8413
|
-
/* @__PURE__ */ (0,
|
|
8414
|
-
card.isUnavailable ? /* @__PURE__ */ (0,
|
|
8584
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex flex-col gap-1 min-w-0", children: [
|
|
8585
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
8586
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "agg-route-card-title truncate text-agg-sm leading-agg-5 text-agg-foreground", children: card.label }),
|
|
8587
|
+
card.isUnavailable ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8415
8588
|
Icon,
|
|
8416
8589
|
{
|
|
8417
8590
|
name: "lock",
|
|
@@ -8419,7 +8592,7 @@ var renderRouteCard = ({
|
|
|
8419
8592
|
className: "shrink-0 text-agg-muted-foreground",
|
|
8420
8593
|
"aria-hidden": "true"
|
|
8421
8594
|
}
|
|
8422
|
-
) : card.kind === "split" && isSelected ? /* @__PURE__ */ (0,
|
|
8595
|
+
) : card.kind === "split" && isSelected ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8423
8596
|
Icon,
|
|
8424
8597
|
{
|
|
8425
8598
|
name: showSplitDetails ? "chevron-up" : "chevron-down",
|
|
@@ -8429,10 +8602,10 @@ var renderRouteCard = ({
|
|
|
8429
8602
|
}
|
|
8430
8603
|
) : null
|
|
8431
8604
|
] }),
|
|
8432
|
-
card.hint ? /* @__PURE__ */ (0,
|
|
8605
|
+
card.hint ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "agg-route-card-hint text-agg-xs leading-agg-4 text-agg-muted-foreground", children: card.hint }) : null
|
|
8433
8606
|
] })
|
|
8434
8607
|
] }),
|
|
8435
|
-
/* @__PURE__ */ (0,
|
|
8608
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8436
8609
|
"p",
|
|
8437
8610
|
{
|
|
8438
8611
|
className: cn(
|
|
@@ -8444,9 +8617,9 @@ var renderRouteCard = ({
|
|
|
8444
8617
|
}
|
|
8445
8618
|
)
|
|
8446
8619
|
] }),
|
|
8447
|
-
showSplitDetails ? /* @__PURE__ */ (0,
|
|
8448
|
-
/* @__PURE__ */ (0,
|
|
8449
|
-
/* @__PURE__ */ (0,
|
|
8620
|
+
showSplitDetails ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(import_jsx_runtime123.Fragment, { children: [
|
|
8621
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "agg-route-card-description text-agg-xs leading-agg-4 text-agg-foreground", children: tradingLabels.splitOrderDescription }),
|
|
8622
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "agg-route-breakdown flex flex-col gap-3", children: (_b = card.rows) == null ? void 0 : _b.map((row) => renderRouteBreakdownRow(row)) })
|
|
8450
8623
|
] }) : null
|
|
8451
8624
|
] })
|
|
8452
8625
|
}
|
|
@@ -8469,7 +8642,7 @@ var renderSubmissionSurface = ({
|
|
|
8469
8642
|
executionVenue: progressState.executionVenue,
|
|
8470
8643
|
labels: tradingLabels
|
|
8471
8644
|
});
|
|
8472
|
-
return /* @__PURE__ */ (0,
|
|
8645
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8473
8646
|
Card,
|
|
8474
8647
|
{
|
|
8475
8648
|
className: cn(
|
|
@@ -8478,31 +8651,31 @@ var renderSubmissionSurface = ({
|
|
|
8478
8651
|
classNames == null ? void 0 : classNames.root,
|
|
8479
8652
|
className
|
|
8480
8653
|
),
|
|
8481
|
-
children: /* @__PURE__ */ (0,
|
|
8654
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: cn("agg-order-submission-body flex flex-col gap-6 p-5", classNames == null ? void 0 : classNames.body), children: [
|
|
8482
8655
|
renderCardHeader({
|
|
8483
8656
|
className: classNames == null ? void 0 : classNames.header,
|
|
8484
8657
|
headerSubtitle,
|
|
8485
8658
|
headerImage,
|
|
8486
8659
|
headerTitle
|
|
8487
8660
|
}),
|
|
8488
|
-
/* @__PURE__ */ (0,
|
|
8489
|
-
/* @__PURE__ */ (0,
|
|
8490
|
-
/* @__PURE__ */ (0,
|
|
8491
|
-
/* @__PURE__ */ (0,
|
|
8661
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: cn("agg-order-panel-content flex flex-col gap-6", classNames == null ? void 0 : classNames.content), children: [
|
|
8662
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("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: [
|
|
8663
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(LoadingGlyph, { enableAnimations, className: "h-4 w-4 text-current" }),
|
|
8664
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { children: actionLabel })
|
|
8492
8665
|
] }),
|
|
8493
|
-
/* @__PURE__ */ (0,
|
|
8666
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8494
8667
|
"div",
|
|
8495
8668
|
{
|
|
8496
8669
|
className: "agg-order-submission-steps agg-order-submission-group flex flex-col gap-2",
|
|
8497
8670
|
"data-testid": "agg-order-submission-steps",
|
|
8498
8671
|
children: displayRows.map((step) => {
|
|
8499
|
-
return /* @__PURE__ */ (0,
|
|
8672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
8500
8673
|
"div",
|
|
8501
8674
|
{
|
|
8502
8675
|
className: "agg-order-submission-step flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
8503
8676
|
"data-status": step.status,
|
|
8504
8677
|
children: [
|
|
8505
|
-
step.status === "complete" ? /* @__PURE__ */ (0,
|
|
8678
|
+
step.status === "complete" ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8506
8679
|
Icon,
|
|
8507
8680
|
{
|
|
8508
8681
|
name: "check-circle",
|
|
@@ -8510,15 +8683,15 @@ var renderSubmissionSurface = ({
|
|
|
8510
8683
|
className: "h-3 w-3 shrink-0 text-agg-primary",
|
|
8511
8684
|
"aria-hidden": "true"
|
|
8512
8685
|
}
|
|
8513
|
-
) : /* @__PURE__ */ (0,
|
|
8686
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8514
8687
|
LoadingGlyph,
|
|
8515
8688
|
{
|
|
8516
8689
|
enableAnimations,
|
|
8517
8690
|
className: "h-3 w-3 shrink-0 text-agg-primary"
|
|
8518
8691
|
}
|
|
8519
8692
|
),
|
|
8520
|
-
/* @__PURE__ */ (0,
|
|
8521
|
-
step.venue ? /* @__PURE__ */ (0,
|
|
8693
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
8694
|
+
step.venue ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8522
8695
|
VenueLogo,
|
|
8523
8696
|
{
|
|
8524
8697
|
venue: step.venue,
|
|
@@ -8539,7 +8712,7 @@ var renderSubmissionSurface = ({
|
|
|
8539
8712
|
}
|
|
8540
8713
|
);
|
|
8541
8714
|
};
|
|
8542
|
-
var InitiateKycButton = ({ label: label2, onOpen }) => /* @__PURE__ */ (0,
|
|
8715
|
+
var InitiateKycButton = ({ label: label2, onOpen }) => /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8543
8716
|
Button,
|
|
8544
8717
|
{
|
|
8545
8718
|
size: "large",
|
|
@@ -8556,35 +8729,35 @@ var KycVerifyModal = ({
|
|
|
8556
8729
|
isInitiating,
|
|
8557
8730
|
labels
|
|
8558
8731
|
}) => {
|
|
8559
|
-
return /* @__PURE__ */ (0,
|
|
8732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8560
8733
|
Modal,
|
|
8561
8734
|
{
|
|
8562
8735
|
open,
|
|
8563
8736
|
onOpenChange: (next) => {
|
|
8564
8737
|
onOpenChange(next);
|
|
8565
8738
|
},
|
|
8566
|
-
children: /* @__PURE__ */ (0,
|
|
8567
|
-
/* @__PURE__ */ (0,
|
|
8568
|
-
/* @__PURE__ */ (0,
|
|
8569
|
-
/* @__PURE__ */ (0,
|
|
8570
|
-
/* @__PURE__ */ (0,
|
|
8739
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(Modal.Container, { maxWidth: "480px", "aria-label": labels.title, children: [
|
|
8740
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Dialog2.Title, { className: "sr-only", children: labels.title }),
|
|
8741
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Dialog2.Description, { className: "sr-only", children: labels.description }),
|
|
8742
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(Modal.Body, { classNames: { root: "sm:px-10 sm:py-12" }, children: [
|
|
8743
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8571
8744
|
"button",
|
|
8572
8745
|
{
|
|
8573
8746
|
type: "button",
|
|
8574
8747
|
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
8575
8748
|
onClick: () => onOpenChange(false),
|
|
8576
8749
|
"aria-label": "Close",
|
|
8577
|
-
children: /* @__PURE__ */ (0,
|
|
8750
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(CloseIcon, { className: "h-6 w-6" })
|
|
8578
8751
|
}
|
|
8579
8752
|
),
|
|
8580
|
-
/* @__PURE__ */ (0,
|
|
8581
|
-
/* @__PURE__ */ (0,
|
|
8582
|
-
/* @__PURE__ */ (0,
|
|
8583
|
-
/* @__PURE__ */ (0,
|
|
8584
|
-
/* @__PURE__ */ (0,
|
|
8753
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex flex-col items-center gap-8 text-center", children: [
|
|
8754
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "flex h-[60px] w-[60px] items-center justify-center text-agg-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(UserTrustIcon, { className: "h-[60px] w-[60px]" }) }),
|
|
8755
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex flex-col items-center gap-3", children: [
|
|
8756
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: labels.title }),
|
|
8757
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "agg-type-body text-agg-foreground", children: labels.description })
|
|
8585
8758
|
] }),
|
|
8586
|
-
/* @__PURE__ */ (0,
|
|
8587
|
-
/* @__PURE__ */ (0,
|
|
8759
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex w-full flex-col items-center gap-5", children: [
|
|
8760
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8588
8761
|
Button,
|
|
8589
8762
|
{
|
|
8590
8763
|
size: "large",
|
|
@@ -8595,7 +8768,7 @@ var KycVerifyModal = ({
|
|
|
8595
8768
|
children: labels.startVerification
|
|
8596
8769
|
}
|
|
8597
8770
|
),
|
|
8598
|
-
/* @__PURE__ */ (0,
|
|
8771
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8599
8772
|
"button",
|
|
8600
8773
|
{
|
|
8601
8774
|
type: "button",
|
|
@@ -8615,27 +8788,27 @@ var KycSuccessModal = ({
|
|
|
8615
8788
|
open,
|
|
8616
8789
|
onOpenChange,
|
|
8617
8790
|
labels
|
|
8618
|
-
}) => /* @__PURE__ */ (0,
|
|
8619
|
-
/* @__PURE__ */ (0,
|
|
8620
|
-
/* @__PURE__ */ (0,
|
|
8621
|
-
/* @__PURE__ */ (0,
|
|
8622
|
-
/* @__PURE__ */ (0,
|
|
8791
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Modal, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(Modal.Container, { maxWidth: "480px", "aria-label": labels.title, children: [
|
|
8792
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Dialog2.Title, { className: "sr-only", children: labels.title }),
|
|
8793
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Dialog2.Description, { className: "sr-only", children: labels.description }),
|
|
8794
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(Modal.Body, { classNames: { root: "px-10 py-12" }, children: [
|
|
8795
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8623
8796
|
"button",
|
|
8624
8797
|
{
|
|
8625
8798
|
type: "button",
|
|
8626
8799
|
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
8627
8800
|
onClick: () => onOpenChange(false),
|
|
8628
8801
|
"aria-label": "Close",
|
|
8629
|
-
children: /* @__PURE__ */ (0,
|
|
8802
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(CloseIcon, { className: "h-6 w-6" })
|
|
8630
8803
|
}
|
|
8631
8804
|
),
|
|
8632
|
-
/* @__PURE__ */ (0,
|
|
8633
|
-
/* @__PURE__ */ (0,
|
|
8634
|
-
/* @__PURE__ */ (0,
|
|
8635
|
-
/* @__PURE__ */ (0,
|
|
8636
|
-
/* @__PURE__ */ (0,
|
|
8805
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex flex-col items-center gap-8 text-center", children: [
|
|
8806
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "flex h-[60px] w-[60px] items-center justify-center rounded-full bg-agg-success/15", children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(SuccessCheckIcon, { className: "h-6 w-6 text-agg-success" }) }),
|
|
8807
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex flex-col items-center gap-3", children: [
|
|
8808
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: labels.title }),
|
|
8809
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "agg-type-body text-agg-foreground", children: labels.description })
|
|
8637
8810
|
] }),
|
|
8638
|
-
/* @__PURE__ */ (0,
|
|
8811
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
8639
8812
|
Button,
|
|
8640
8813
|
{
|
|
8641
8814
|
variant: "secondary",
|
|
@@ -8656,6 +8829,7 @@ var PlaceOrder = ({
|
|
|
8656
8829
|
isLoading = false,
|
|
8657
8830
|
isPrimaryActionDisabled = false,
|
|
8658
8831
|
isPrimaryActionLoading = false,
|
|
8832
|
+
isQuotePanelActive = true,
|
|
8659
8833
|
chainBalancesOverride,
|
|
8660
8834
|
onAmountChange,
|
|
8661
8835
|
onClose,
|
|
@@ -8669,24 +8843,25 @@ var PlaceOrder = ({
|
|
|
8669
8843
|
resolvedClaim,
|
|
8670
8844
|
midpointsResult
|
|
8671
8845
|
}) => {
|
|
8672
|
-
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;
|
|
8846
|
+
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;
|
|
8673
8847
|
const {
|
|
8674
8848
|
enableDebug: isExecutionDebugEnabled,
|
|
8675
8849
|
features: { enableAnimations, showFeesBreakdown },
|
|
8676
8850
|
general: { locale },
|
|
8677
8851
|
trading: { executionMode: configuredExecutionMode = "live" } = { executionMode: "live" }
|
|
8678
|
-
} = (0,
|
|
8679
|
-
const labels = (0,
|
|
8852
|
+
} = (0, import_hooks30.useSdkUiConfig)();
|
|
8853
|
+
const labels = (0, import_hooks30.useLabels)();
|
|
8680
8854
|
const tradingLabels = labels.trading;
|
|
8681
|
-
const
|
|
8682
|
-
const
|
|
8855
|
+
const toastCtx = useOptionalToast();
|
|
8856
|
+
const { isTradingBlocked } = (0, import_hooks30.useGeoBlock)();
|
|
8857
|
+
const tradingContext = (0, import_hooks30.useEventTradingContext)();
|
|
8683
8858
|
const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
|
|
8684
8859
|
const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
|
|
8685
8860
|
const selectedOutcomeId = (_c = tradingContext == null ? void 0 : tradingContext.selectedOutcomeId) != null ? _c : null;
|
|
8686
|
-
const resolvedEventTradingState = (0,
|
|
8687
|
-
return eventTradingState != null ? eventTradingState : (0,
|
|
8861
|
+
const resolvedEventTradingState = (0, import_react11.useMemo)(() => {
|
|
8862
|
+
return eventTradingState != null ? eventTradingState : (0, import_hooks30.resolveEventTradingState)(selectedEvent);
|
|
8688
8863
|
}, [eventTradingState, selectedEvent]);
|
|
8689
|
-
const scopedSelectedEvent = (0,
|
|
8864
|
+
const scopedSelectedEvent = (0, import_react11.useMemo)(() => {
|
|
8690
8865
|
var _a2;
|
|
8691
8866
|
if (!selectedEvent) return null;
|
|
8692
8867
|
const primaryMarketId = (_a2 = resolvedEventTradingState.primaryMarket) == null ? void 0 : _a2.id;
|
|
@@ -8696,7 +8871,7 @@ var PlaceOrder = ({
|
|
|
8696
8871
|
);
|
|
8697
8872
|
return isSelectedEventInScope ? selectedEvent : null;
|
|
8698
8873
|
}, [(_d = resolvedEventTradingState.primaryMarket) == null ? void 0 : _d.id, selectedEvent]);
|
|
8699
|
-
const scopedSelectedMarket = (0,
|
|
8874
|
+
const scopedSelectedMarket = (0, import_react11.useMemo)(() => {
|
|
8700
8875
|
if (!selectedMarket) return resolvedEventTradingState.primaryMarket;
|
|
8701
8876
|
const isSelectedMarketInScope = resolvedEventTradingState.marketStates.some(
|
|
8702
8877
|
(item) => item.market.id === selectedMarket.id
|
|
@@ -8711,10 +8886,10 @@ var PlaceOrder = ({
|
|
|
8711
8886
|
(outcome) => outcome.label.trim().toLowerCase() === "yes"
|
|
8712
8887
|
)) != null ? _f : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes[0]) != null ? _g : null;
|
|
8713
8888
|
const scopedSelectedOutcomeId = (_h = scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.id) != null ? _h : null;
|
|
8714
|
-
const resolvedTradingState = (0,
|
|
8715
|
-
return (0,
|
|
8889
|
+
const resolvedTradingState = (0, import_react11.useMemo)(() => {
|
|
8890
|
+
return (0, import_hooks30.resolveMarketTradingState)(scopedSelectedMarket);
|
|
8716
8891
|
}, [scopedSelectedMarket]);
|
|
8717
|
-
const resolvedReadOnlyMarket = (0,
|
|
8892
|
+
const resolvedReadOnlyMarket = (0, import_react11.useMemo)(() => {
|
|
8718
8893
|
var _a2;
|
|
8719
8894
|
if (resolvedEventTradingState.kind !== "resolved") {
|
|
8720
8895
|
return scopedSelectedMarket;
|
|
@@ -8725,11 +8900,12 @@ var PlaceOrder = ({
|
|
|
8725
8900
|
resolvedEventTradingState.primaryMarket,
|
|
8726
8901
|
scopedSelectedMarket
|
|
8727
8902
|
]);
|
|
8728
|
-
const resolvedReadOnlyTradingState = (0,
|
|
8729
|
-
return (0,
|
|
8903
|
+
const resolvedReadOnlyTradingState = (0, import_react11.useMemo)(() => {
|
|
8904
|
+
return (0, import_hooks30.resolveMarketTradingState)(resolvedReadOnlyMarket);
|
|
8730
8905
|
}, [resolvedReadOnlyMarket]);
|
|
8731
|
-
const
|
|
8732
|
-
|
|
8906
|
+
const isEndedWithoutKnownWinner = false;
|
|
8907
|
+
const orderEligibility = (0, import_react11.useMemo)(
|
|
8908
|
+
() => (0, import_hooks30.resolveOrderEligibility)({
|
|
8733
8909
|
event: scopedSelectedEvent,
|
|
8734
8910
|
market: scopedSelectedMarket,
|
|
8735
8911
|
outcome: scopedSelectedOutcome,
|
|
@@ -8738,15 +8914,15 @@ var PlaceOrder = ({
|
|
|
8738
8914
|
[scopedSelectedEvent, scopedSelectedMarket, scopedSelectedOutcome, resolvedEventTradingState]
|
|
8739
8915
|
);
|
|
8740
8916
|
const isResolvedOutcomeCtaLocked = resolvedEventTradingState.kind === "resolved" || resolvedTradingState.kind === "resolved";
|
|
8741
|
-
const { isAuthenticated, user } = (0,
|
|
8917
|
+
const { isAuthenticated, user } = (0, import_hooks30.useAggAuthContext)();
|
|
8742
8918
|
const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
|
|
8743
8919
|
const isPaperMode = resolvedExecutionMode === "paper";
|
|
8744
|
-
const liveBalanceState = (0,
|
|
8745
|
-
const paperBalancesQuery = (0,
|
|
8920
|
+
const liveBalanceState = (0, import_hooks30.useAggBalanceState)();
|
|
8921
|
+
const paperBalancesQuery = (0, import_hooks30.useManagedBalances)({
|
|
8746
8922
|
enabled: Boolean(isAuthenticated && isPaperMode),
|
|
8747
8923
|
mode: "paper"
|
|
8748
8924
|
});
|
|
8749
|
-
const paperTotalBalance = (0,
|
|
8925
|
+
const paperTotalBalance = (0, import_react11.useMemo)(() => {
|
|
8750
8926
|
var _a2, _b2;
|
|
8751
8927
|
const cash = (_b2 = (_a2 = paperBalancesQuery.balances) == null ? void 0 : _a2.cash) != null ? _b2 : [];
|
|
8752
8928
|
return cash.reduce((sum, token) => {
|
|
@@ -8761,13 +8937,13 @@ var PlaceOrder = ({
|
|
|
8761
8937
|
}, [paperBalancesQuery.balances]);
|
|
8762
8938
|
const totalBalance = isPaperMode ? paperTotalBalance : liveBalanceState.totalBalance;
|
|
8763
8939
|
const isBalanceLoading = isPaperMode ? paperBalancesQuery.isLoading : liveBalanceState.isLoading;
|
|
8764
|
-
const executeManaged = (0,
|
|
8765
|
-
const aggClient = (0,
|
|
8766
|
-
const queryClient = (0,
|
|
8767
|
-
const livePrices = (0,
|
|
8940
|
+
const executeManaged = (0, import_hooks30.useExecuteManaged)();
|
|
8941
|
+
const aggClient = (0, import_hooks30.useAggClient)();
|
|
8942
|
+
const queryClient = (0, import_hooks30.useQueryClient)();
|
|
8943
|
+
const livePrices = (0, import_hooks30.useLiveOutcomePrices)(
|
|
8768
8944
|
scopedSelectedMarket ? [scopedSelectedMarket] : void 0
|
|
8769
8945
|
);
|
|
8770
|
-
const wsBestPrices = (0,
|
|
8946
|
+
const wsBestPrices = (0, import_hooks30.useLiveBestPrices)(scopedSelectedMarket ? [scopedSelectedMarket] : void 0);
|
|
8771
8947
|
const clusterMidpointResult = midpointsResult != null ? midpointsResult : {
|
|
8772
8948
|
prices: /* @__PURE__ */ new Map(),
|
|
8773
8949
|
bestMidpointsByOutcomeId: /* @__PURE__ */ new Map(),
|
|
@@ -8781,37 +8957,37 @@ var PlaceOrder = ({
|
|
|
8781
8957
|
const clusterBestMidpointsByOutcomeId = (_i = clusterMidpointResult.bestMidpointsByOutcomeId) != null ? _i : clusterMidpointResult.prices;
|
|
8782
8958
|
const clusterBestMidpoint = clusterMidpointResult.bestMidpoint;
|
|
8783
8959
|
const clusterBestPricesRest = clusterMidpointResult.bestPrices;
|
|
8784
|
-
const clusterBestPrices = (0,
|
|
8785
|
-
() => (0,
|
|
8960
|
+
const clusterBestPrices = (0, import_react11.useMemo)(
|
|
8961
|
+
() => (0, import_hooks30.mergeBestPricesPreferringLive)(clusterBestPricesRest, wsBestPrices),
|
|
8786
8962
|
[clusterBestPricesRest, wsBestPrices]
|
|
8787
8963
|
);
|
|
8788
|
-
const outcomes = (0,
|
|
8964
|
+
const outcomes = (0, import_react11.useMemo)(
|
|
8789
8965
|
() => mapVenueMarketOutcomesToPlaceOrderOutcomes(scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes),
|
|
8790
8966
|
[scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes]
|
|
8791
8967
|
);
|
|
8792
|
-
const buyTabRef = (0,
|
|
8793
|
-
const sellTabRef = (0,
|
|
8794
|
-
const [internalTab, setInternalTab] = (0,
|
|
8795
|
-
const [internalAmount, setInternalAmount] = (0,
|
|
8796
|
-
const [sellFilledForOutcomeId, setSellFilledForOutcomeId] = (0,
|
|
8797
|
-
const [internalSlippage] = (0,
|
|
8798
|
-
const [isRoutesExpanded, setIsRoutesExpanded] = (0,
|
|
8799
|
-
const [selectedRouteCardId, setSelectedRouteCardId] = (0,
|
|
8800
|
-
const [isSplitDetailOpen, setIsSplitDetailOpen] = (0,
|
|
8801
|
-
const [submissionFeedback, setSubmissionFeedback] = (0,
|
|
8802
|
-
const [submissionProgressState, setSubmissionProgressState] = (0,
|
|
8803
|
-
const [isBeforeActionPending, setIsBeforeActionPending] = (0,
|
|
8804
|
-
const executionDebugStoreRef = (0,
|
|
8805
|
-
const executionDebugAttemptIdRef = (0,
|
|
8806
|
-
const submittedSelectionRef = (0,
|
|
8807
|
-
(0,
|
|
8968
|
+
const buyTabRef = (0, import_react11.useRef)(null);
|
|
8969
|
+
const sellTabRef = (0, import_react11.useRef)(null);
|
|
8970
|
+
const [internalTab, setInternalTab] = (0, import_react11.useState)("buy");
|
|
8971
|
+
const [internalAmount, setInternalAmount] = (0, import_react11.useState)(PLACE_ORDER_DEFAULT_AMOUNT);
|
|
8972
|
+
const [sellFilledForOutcomeId, setSellFilledForOutcomeId] = (0, import_react11.useState)(null);
|
|
8973
|
+
const [internalSlippage] = (0, import_react11.useState)(DEFAULT_SLIPPAGE_VALUE);
|
|
8974
|
+
const [isRoutesExpanded, setIsRoutesExpanded] = (0, import_react11.useState)(false);
|
|
8975
|
+
const [selectedRouteCardId, setSelectedRouteCardId] = (0, import_react11.useState)(null);
|
|
8976
|
+
const [isSplitDetailOpen, setIsSplitDetailOpen] = (0, import_react11.useState)(false);
|
|
8977
|
+
const [submissionFeedback, setSubmissionFeedback] = (0, import_react11.useState)(null);
|
|
8978
|
+
const [submissionProgressState, setSubmissionProgressState] = (0, import_react11.useState)(null);
|
|
8979
|
+
const [isBeforeActionPending, setIsBeforeActionPending] = (0, import_react11.useState)(false);
|
|
8980
|
+
const executionDebugStoreRef = (0, import_react11.useRef)(null);
|
|
8981
|
+
const executionDebugAttemptIdRef = (0, import_react11.useRef)(null);
|
|
8982
|
+
const submittedSelectionRef = (0, import_react11.useRef)(null);
|
|
8983
|
+
(0, import_react11.useEffect)(() => {
|
|
8808
8984
|
if (!isExecutionDebugEnabled) {
|
|
8809
8985
|
executionDebugStoreRef.current = null;
|
|
8810
8986
|
return;
|
|
8811
8987
|
}
|
|
8812
8988
|
executionDebugStoreRef.current = enableExecutionDebugInBrowser();
|
|
8813
8989
|
}, [isExecutionDebugEnabled]);
|
|
8814
|
-
(0,
|
|
8990
|
+
(0, import_react11.useEffect)(() => {
|
|
8815
8991
|
if (!isExecutionDebugEnabled) return;
|
|
8816
8992
|
const store = executionDebugStoreRef.current;
|
|
8817
8993
|
if (!store) return;
|
|
@@ -8823,17 +8999,18 @@ var PlaceOrder = ({
|
|
|
8823
8999
|
scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id,
|
|
8824
9000
|
scopedSelectedOutcomeId
|
|
8825
9001
|
]);
|
|
8826
|
-
const debouncedAmount = (0,
|
|
8827
|
-
const
|
|
9002
|
+
const debouncedAmount = (0, import_hooks30.useDebouncedValue)(internalAmount, 300);
|
|
9003
|
+
const isQuoteInputEditing = internalAmount !== debouncedAmount;
|
|
9004
|
+
const isSell = (0, import_react11.useMemo)(() => internalTab === "sell", [internalTab]);
|
|
8828
9005
|
const {
|
|
8829
9006
|
positions: executionPositions,
|
|
8830
9007
|
isLoading: isExecutionPositionsLoading,
|
|
8831
9008
|
isFetching: isExecutionPositionsFetching
|
|
8832
|
-
} = (0,
|
|
9009
|
+
} = (0, import_hooks30.useExecutionPositions)({
|
|
8833
9010
|
enabled: Boolean(isAuthenticated && isSell),
|
|
8834
9011
|
mode: isPaperMode ? "paper" : void 0
|
|
8835
9012
|
});
|
|
8836
|
-
const smartRoute = (0,
|
|
9013
|
+
const smartRoute = (0, import_hooks30.useSmartRoute)({
|
|
8837
9014
|
venueMarketOutcomeId: scopedSelectedOutcomeId,
|
|
8838
9015
|
maxSpend: isSell ? void 0 : debouncedAmount,
|
|
8839
9016
|
sellShares: isSell ? debouncedAmount : void 0,
|
|
@@ -8845,9 +9022,21 @@ var PlaceOrder = ({
|
|
|
8845
9022
|
compareVenues: true,
|
|
8846
9023
|
tradeSide: isSell ? "sell" : "buy",
|
|
8847
9024
|
mode: isPaperMode ? "paper" : void 0,
|
|
8848
|
-
enabled: debouncedAmount > 0 && orderEligibility.canPlaceOrder
|
|
9025
|
+
enabled: isQuotePanelActive && !isEndedWithoutKnownWinner && !submissionProgressState && !isBeforeActionPending && !executeManaged.isPending && debouncedAmount > 0 && orderEligibility.canPlaceOrder && // On the sell tab, hold the quote until the amount has been initialized
|
|
9026
|
+
// from the user's position for THIS outcome AND the debounced value has
|
|
9027
|
+
// caught up to it. The amount input is shared with the buy tab, so right
|
|
9028
|
+
// after switching to sell the debounced value still holds the buy default
|
|
9029
|
+
// (PLACE_ORDER_DEFAULT_AMOUNT) for ~300ms — without this gate it leaks into
|
|
9030
|
+
// the first sell quote as `sellShares` (e.g. sellShares=20).
|
|
9031
|
+
(!isSell || sellFilledForOutcomeId === scopedSelectedOutcomeId && !isQuoteInputEditing),
|
|
9032
|
+
refreshContext: {
|
|
9033
|
+
isEditing: isQuoteInputEditing,
|
|
9034
|
+
isMarketOpen: resolvedTradingState.kind === "open" && !isEndedWithoutKnownWinner,
|
|
9035
|
+
isPanelActive: isQuotePanelActive,
|
|
9036
|
+
isSubmitting: submissionProgressState != null || isBeforeActionPending || executeManaged.isPending
|
|
9037
|
+
}
|
|
8849
9038
|
});
|
|
8850
|
-
const currentSellableShares = (0,
|
|
9039
|
+
const currentSellableShares = (0, import_react11.useMemo)(() => {
|
|
8851
9040
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
8852
9041
|
const sharesFromQuote = (_b2 = (_a2 = smartRoute.data) == null ? void 0 : _a2.positionAvailability) == null ? void 0 : _b2.totalSellableShares;
|
|
8853
9042
|
if (typeof sharesFromQuote === "number" && Number.isFinite(sharesFromQuote)) {
|
|
@@ -8861,15 +9050,13 @@ var PlaceOrder = ({
|
|
|
8861
9050
|
(_d2 = scopedSelectedMarket.externalIdentifier) != null ? _d2 : void 0
|
|
8862
9051
|
].filter((value) => Boolean(value));
|
|
8863
9052
|
const selectedMarketIdSet = new Set(selectedMarketIds);
|
|
8864
|
-
const selectedVenue = scopedSelectedMarket.venue;
|
|
8865
9053
|
let resolvedShares = 0;
|
|
8866
9054
|
for (const group of executionPositions) {
|
|
8867
9055
|
const groupOutcomes = (_f2 = (_e2 = group.venueMarket) == null ? void 0 : _e2.venueMarketOutcomes) != null ? _f2 : [];
|
|
8868
9056
|
for (const outcome of groupOutcomes) {
|
|
8869
9057
|
if (outcome.label.trim().toLowerCase() !== normalizedSelectedOutcomeLabel) continue;
|
|
8870
9058
|
for (const breakdown of (_g2 = outcome.venueBreakdown) != null ? _g2 : []) {
|
|
8871
|
-
|
|
8872
|
-
const matchesMarketId = selectedMarketIdSet.size === 0 || selectedMarketIdSet.has(breakdown.venueMarketId) || selectedMarketIdSet.has(group.targetMarketId);
|
|
9059
|
+
const matchesMarketId = selectedMarketIdSet.size === 0 || selectedMarketIdSet.has(group.targetMarketId) || selectedMarketIdSet.has(breakdown.venueMarketId);
|
|
8873
9060
|
if (!matchesMarketId) continue;
|
|
8874
9061
|
resolvedShares += Number.isFinite(breakdown.size) ? breakdown.size : 0;
|
|
8875
9062
|
}
|
|
@@ -8883,29 +9070,37 @@ var PlaceOrder = ({
|
|
|
8883
9070
|
scopedSelectedOutcome,
|
|
8884
9071
|
(_k = (_j = smartRoute.data) == null ? void 0 : _j.positionAvailability) == null ? void 0 : _k.totalSellableShares
|
|
8885
9072
|
]);
|
|
9073
|
+
const maxSellableShares = (0, import_react11.useMemo)(
|
|
9074
|
+
() => floorToDecimals(currentSellableShares, SELL_SHARE_INPUT_DECIMALS),
|
|
9075
|
+
[currentSellableShares]
|
|
9076
|
+
);
|
|
8886
9077
|
const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((_m = (_l = smartRoute.data) == null ? void 0 : _l.positionAvailability) == null ? void 0 : _m.totalSellableShares) === "number") && (isExecutionPositionsLoading || isExecutionPositionsFetching);
|
|
8887
|
-
const displayedCurrentSellableShares = (0,
|
|
9078
|
+
const displayedCurrentSellableShares = (0, import_react11.useMemo)(() => {
|
|
8888
9079
|
if (!Number.isFinite(currentSellableShares) || currentSellableShares <= 0) return 0;
|
|
8889
|
-
return
|
|
9080
|
+
return floorToDecimals(currentSellableShares, SELL_SHARE_DISPLAY_DECIMALS);
|
|
8890
9081
|
}, [currentSellableShares]);
|
|
8891
|
-
const
|
|
8892
|
-
|
|
9082
|
+
const displayedCurrentSellableSharesLabel = (0, import_react11.useMemo)(
|
|
9083
|
+
() => `${formatFlooredShareAmount(maxSellableShares, SELL_SHARE_DISPLAY_DECIMALS)} shares`,
|
|
9084
|
+
[maxSellableShares]
|
|
9085
|
+
);
|
|
9086
|
+
const isAtMaxSellableShares = isSell && maxSellableShares > 0 && Math.abs(internalAmount - maxSellableShares) < 1e-9;
|
|
9087
|
+
(0, import_react11.useEffect)(() => {
|
|
8893
9088
|
if (submissionProgressState != null) return;
|
|
8894
9089
|
if (!isSell || isCurrentSellableSharesLoading) return;
|
|
8895
9090
|
if (scopedSelectedOutcomeId === sellFilledForOutcomeId) return;
|
|
8896
|
-
setInternalAmount(
|
|
9091
|
+
setInternalAmount(maxSellableShares);
|
|
8897
9092
|
setSellFilledForOutcomeId(scopedSelectedOutcomeId != null ? scopedSelectedOutcomeId : null);
|
|
8898
|
-
onAmountChange == null ? void 0 : onAmountChange(
|
|
9093
|
+
onAmountChange == null ? void 0 : onAmountChange(maxSellableShares);
|
|
8899
9094
|
}, [
|
|
8900
9095
|
isSell,
|
|
8901
9096
|
isCurrentSellableSharesLoading,
|
|
8902
9097
|
scopedSelectedOutcomeId,
|
|
8903
9098
|
sellFilledForOutcomeId,
|
|
8904
|
-
|
|
9099
|
+
maxSellableShares,
|
|
8905
9100
|
onAmountChange,
|
|
8906
9101
|
submissionProgressState
|
|
8907
9102
|
]);
|
|
8908
|
-
const routeCards = (0,
|
|
9103
|
+
const routeCards = (0, import_react11.useMemo)(
|
|
8909
9104
|
() => smartRoute.data ? buildLiveRouteCards({
|
|
8910
9105
|
eventVenues: scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets.map((market) => market.venue),
|
|
8911
9106
|
labels: tradingLabels,
|
|
@@ -8914,7 +9109,7 @@ var PlaceOrder = ({
|
|
|
8914
9109
|
}) : [],
|
|
8915
9110
|
[smartRoute.data, tradingLabels, isSell, scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets]
|
|
8916
9111
|
);
|
|
8917
|
-
const resolvedSelectedRouteCardId = (0,
|
|
9112
|
+
const resolvedSelectedRouteCardId = (0, import_react11.useMemo)(() => {
|
|
8918
9113
|
var _a2, _b2, _c2, _d2;
|
|
8919
9114
|
if (routeCards.length === 0) return null;
|
|
8920
9115
|
if (selectedRouteCardId && routeCards.some((card) => card.id === selectedRouteCardId && !card.isUnavailable)) {
|
|
@@ -8922,7 +9117,7 @@ var PlaceOrder = ({
|
|
|
8922
9117
|
}
|
|
8923
9118
|
return (_d2 = (_c2 = (_a2 = routeCards.find((card) => !card.isUnavailable)) == null ? void 0 : _a2.id) != null ? _c2 : (_b2 = routeCards[0]) == null ? void 0 : _b2.id) != null ? _d2 : null;
|
|
8924
9119
|
}, [routeCards, selectedRouteCardId]);
|
|
8925
|
-
(0,
|
|
9120
|
+
(0, import_react11.useEffect)(() => {
|
|
8926
9121
|
if (routeCards.length === 0) {
|
|
8927
9122
|
setSelectedRouteCardId(null);
|
|
8928
9123
|
setIsRoutesExpanded(false);
|
|
@@ -8934,22 +9129,22 @@ var PlaceOrder = ({
|
|
|
8934
9129
|
}
|
|
8935
9130
|
}, [resolvedSelectedRouteCardId, routeCards.length, selectedRouteCardId]);
|
|
8936
9131
|
const isSubmissionLocked = submissionProgressState != null;
|
|
8937
|
-
const isSubmissionLockedRef = (0,
|
|
9132
|
+
const isSubmissionLockedRef = (0, import_react11.useRef)(isSubmissionLocked);
|
|
8938
9133
|
isSubmissionLockedRef.current = isSubmissionLocked;
|
|
8939
|
-
(0,
|
|
9134
|
+
(0, import_react11.useEffect)(() => {
|
|
8940
9135
|
if (isSubmissionLockedRef.current) return;
|
|
8941
9136
|
setSubmissionFeedback(null);
|
|
8942
9137
|
setSubmissionProgressState(null);
|
|
8943
9138
|
}, [internalAmount, internalSlippage, internalTab, scopedSelectedOutcomeId]);
|
|
8944
9139
|
const orderedRouteCards = routeCards;
|
|
8945
9140
|
const selectedRouteCard = (_o = (_n = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _n : orderedRouteCards[0]) != null ? _o : null;
|
|
8946
|
-
const isKalshiRoute = (0,
|
|
9141
|
+
const isKalshiRoute = (0, import_react11.useMemo)(() => {
|
|
8947
9142
|
if (selectedRouteCard) {
|
|
8948
9143
|
return selectedRouteCard.venue === "kalshi" || selectedRouteCard.quoteData.fills.some((f) => f.venue === "kalshi");
|
|
8949
9144
|
}
|
|
8950
9145
|
return (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === "kalshi";
|
|
8951
9146
|
}, [selectedRouteCard, scopedSelectedMarket]);
|
|
8952
|
-
const isKalshiVerified = (0,
|
|
9147
|
+
const isKalshiVerified = (0, import_react11.useMemo)(() => {
|
|
8953
9148
|
var _a2;
|
|
8954
9149
|
const kalshiAccount = (_a2 = user == null ? void 0 : user.venueAccounts) == null ? void 0 : _a2.find((va) => va.venue === "kalshi");
|
|
8955
9150
|
return (kalshiAccount == null ? void 0 : kalshiAccount.kycStatus) === "verified";
|
|
@@ -8966,10 +9161,10 @@ var PlaceOrder = ({
|
|
|
8966
9161
|
} = useKalshiKycFlow({
|
|
8967
9162
|
isKalshiVerified,
|
|
8968
9163
|
userId: user == null ? void 0 : user.id,
|
|
8969
|
-
walletAddress: (_p = (0,
|
|
9164
|
+
walletAddress: (_p = (0, import_hooks30.getWalletAddressFromUserProfile)(user)) != null ? _p : null,
|
|
8970
9165
|
onError
|
|
8971
9166
|
});
|
|
8972
|
-
const handleRouteCardSelect = (0,
|
|
9167
|
+
const handleRouteCardSelect = (0, import_react11.useCallback)(
|
|
8973
9168
|
(cardId) => {
|
|
8974
9169
|
if (cardId === resolvedSelectedRouteCardId) {
|
|
8975
9170
|
const card = routeCards.find((c) => c.id === cardId);
|
|
@@ -8982,16 +9177,17 @@ var PlaceOrder = ({
|
|
|
8982
9177
|
},
|
|
8983
9178
|
[resolvedSelectedRouteCardId, routeCards]
|
|
8984
9179
|
);
|
|
8985
|
-
const executionProgress = (0,
|
|
9180
|
+
const executionProgress = (0, import_hooks30.useExecutionProgress)({
|
|
8986
9181
|
orderIds: (_q = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) != null ? _q : null,
|
|
9182
|
+
quoteId: (_r = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _r : null,
|
|
8987
9183
|
mode: isPaperMode ? "paper" : void 0,
|
|
8988
|
-
enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((
|
|
9184
|
+
enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((_s = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _s.length)
|
|
8989
9185
|
});
|
|
8990
|
-
const selectedOutcomeLabel = (
|
|
8991
|
-
const headerImage = (
|
|
8992
|
-
const headerTitle = (
|
|
8993
|
-
const headerSubtitle = (
|
|
8994
|
-
const buildExecutionSummary = (0,
|
|
9186
|
+
const selectedOutcomeLabel = (_v = (_u = (_t = outcomes.find((outcome) => outcome.id === scopedSelectedOutcomeId)) == null ? void 0 : _t.label) != null ? _u : scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.label) != null ? _v : "";
|
|
9187
|
+
const headerImage = (_x = (_w = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.image) != null ? _w : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.image) != null ? _x : null;
|
|
9188
|
+
const headerTitle = (_z = (_y = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _y : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _z : "";
|
|
9189
|
+
const headerSubtitle = (_A = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _A : "";
|
|
9190
|
+
const buildExecutionSummary = (0, import_react11.useCallback)(
|
|
8995
9191
|
(quoteData, executionVenue, orderId, partialFillSummary) => {
|
|
8996
9192
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
8997
9193
|
if (!quoteData) return void 0;
|
|
@@ -9067,7 +9263,7 @@ var PlaceOrder = ({
|
|
|
9067
9263
|
tradingLabels
|
|
9068
9264
|
]
|
|
9069
9265
|
);
|
|
9070
|
-
(0,
|
|
9266
|
+
(0, import_react11.useEffect)(() => {
|
|
9071
9267
|
if (executionProgress.phase === "order_submitted") {
|
|
9072
9268
|
const submittedOrder = executionProgress.submittedOrders[0];
|
|
9073
9269
|
setSubmissionProgressState((prev) => {
|
|
@@ -9080,7 +9276,7 @@ var PlaceOrder = ({
|
|
|
9080
9276
|
});
|
|
9081
9277
|
}
|
|
9082
9278
|
}, [executionProgress.phase, executionProgress.submittedOrders]);
|
|
9083
|
-
(0,
|
|
9279
|
+
(0, import_react11.useEffect)(() => {
|
|
9084
9280
|
var _a2, _b2;
|
|
9085
9281
|
const dp = executionProgress.dagProgress;
|
|
9086
9282
|
if (!dp) return;
|
|
@@ -9131,7 +9327,7 @@ var PlaceOrder = ({
|
|
|
9131
9327
|
return __spreadProps(__spreadValues({}, prev), { dagProgress: dp });
|
|
9132
9328
|
});
|
|
9133
9329
|
}, [executionProgress.dagProgress, tradingLabels]);
|
|
9134
|
-
(0,
|
|
9330
|
+
(0, import_react11.useEffect)(() => {
|
|
9135
9331
|
const orderIds = submissionProgressState == null ? void 0 : submissionProgressState.orderIds;
|
|
9136
9332
|
if (!(orderIds == null ? void 0 : orderIds.length)) return;
|
|
9137
9333
|
const aggregateStatus = deriveAggregateOrderStatus(
|
|
@@ -9192,7 +9388,7 @@ var PlaceOrder = ({
|
|
|
9192
9388
|
tradingLabels
|
|
9193
9389
|
]);
|
|
9194
9390
|
const estDurationMs = (selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) && typeof selectedRouteCard.quoteData.estDurationMs === "number" ? selectedRouteCard.quoteData.estDurationMs : 6e4;
|
|
9195
|
-
(0,
|
|
9391
|
+
(0, import_react11.useEffect)(() => {
|
|
9196
9392
|
const phase = submissionProgressState == null ? void 0 : submissionProgressState.phase;
|
|
9197
9393
|
if (phase !== "submitting" && phase !== "executing") return;
|
|
9198
9394
|
const timeoutMs = Math.max(6e4, 2 * estDurationMs);
|
|
@@ -9207,7 +9403,36 @@ var PlaceOrder = ({
|
|
|
9207
9403
|
}, timeoutMs);
|
|
9208
9404
|
return () => clearTimeout(id);
|
|
9209
9405
|
}, [submissionProgressState == null ? void 0 : submissionProgressState.phase, estDurationMs]);
|
|
9210
|
-
(0,
|
|
9406
|
+
const emitTerminalOrderNotifications = (0, import_react11.useCallback)(() => {
|
|
9407
|
+
const toast = toastCtx == null ? void 0 : toastCtx.toast;
|
|
9408
|
+
if (!toast) return;
|
|
9409
|
+
for (const event of executionProgress.terminalOrderEvents) {
|
|
9410
|
+
handleOrderEvent({
|
|
9411
|
+
event: {
|
|
9412
|
+
type: "order_event",
|
|
9413
|
+
userId: "",
|
|
9414
|
+
orderId: event.orderId,
|
|
9415
|
+
venue: event.venue,
|
|
9416
|
+
event: event.event,
|
|
9417
|
+
filledAmountRaw: event.filledAmountRaw,
|
|
9418
|
+
remainingAmountRaw: event.remainingAmountRaw,
|
|
9419
|
+
actualSharesRaw: event.actualSharesRaw,
|
|
9420
|
+
actualToWinRaw: event.actualToWinRaw,
|
|
9421
|
+
quotedSharesRaw: event.quotedSharesRaw,
|
|
9422
|
+
quotedToWinRaw: event.quotedToWinRaw,
|
|
9423
|
+
executionPriceRaw: event.executionPriceRaw,
|
|
9424
|
+
quotedPriceRaw: event.quotedPriceRaw,
|
|
9425
|
+
errorReason: event.errorReason,
|
|
9426
|
+
timestamp: event.timestamp
|
|
9427
|
+
},
|
|
9428
|
+
labels,
|
|
9429
|
+
fireOnce: (key, tone, title2, message, detail) => {
|
|
9430
|
+
toast(message, { tone, title: title2, detail });
|
|
9431
|
+
}
|
|
9432
|
+
});
|
|
9433
|
+
}
|
|
9434
|
+
}, [executionProgress.terminalOrderEvents, labels, toastCtx]);
|
|
9435
|
+
(0, import_react11.useEffect)(() => {
|
|
9211
9436
|
var _a2, _b2;
|
|
9212
9437
|
if (!submissionProgressState) return;
|
|
9213
9438
|
onExecutionStateChange == null ? void 0 : onExecutionStateChange(submissionProgressState);
|
|
@@ -9226,8 +9451,9 @@ var PlaceOrder = ({
|
|
|
9226
9451
|
});
|
|
9227
9452
|
}
|
|
9228
9453
|
if (submissionProgressState.phase === "success" && submissionProgressState.summary) {
|
|
9229
|
-
(
|
|
9230
|
-
(0,
|
|
9454
|
+
emitTerminalOrderNotifications();
|
|
9455
|
+
(0, import_hooks30.invalidateBalanceQueries)(queryClient);
|
|
9456
|
+
(0, import_hooks30.invalidatePositionQueries)(queryClient);
|
|
9231
9457
|
if (debugStore && debugAttemptId) {
|
|
9232
9458
|
debugStore.updateAttempt(debugAttemptId, {
|
|
9233
9459
|
status: "succeeded",
|
|
@@ -9237,6 +9463,7 @@ var PlaceOrder = ({
|
|
|
9237
9463
|
onSuccess == null ? void 0 : onSuccess(submissionProgressState.summary);
|
|
9238
9464
|
}
|
|
9239
9465
|
if (submissionProgressState.phase === "failed" && submissionProgressState.errorMessage) {
|
|
9466
|
+
emitTerminalOrderNotifications();
|
|
9240
9467
|
if (debugStore && debugAttemptId) {
|
|
9241
9468
|
debugStore.appendError(debugAttemptId, {
|
|
9242
9469
|
message: submissionProgressState.errorMessage,
|
|
@@ -9249,8 +9476,15 @@ var PlaceOrder = ({
|
|
|
9249
9476
|
}
|
|
9250
9477
|
onError == null ? void 0 : onError(new Error(submissionProgressState.errorMessage));
|
|
9251
9478
|
}
|
|
9252
|
-
}, [
|
|
9253
|
-
|
|
9479
|
+
}, [
|
|
9480
|
+
emitTerminalOrderNotifications,
|
|
9481
|
+
onError,
|
|
9482
|
+
onExecutionStateChange,
|
|
9483
|
+
onSuccess,
|
|
9484
|
+
queryClient,
|
|
9485
|
+
submissionProgressState
|
|
9486
|
+
]);
|
|
9487
|
+
const activeQuoteData = (_C = (_B = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _B : smartRoute.data) != null ? _C : null;
|
|
9254
9488
|
const visibleRouteCards = orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT && !isRoutesExpanded ? orderedRouteCards.slice(0, PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT) : orderedRouteCards;
|
|
9255
9489
|
const hasEnteredAmount = internalAmount > 0;
|
|
9256
9490
|
const isQuoteLoading = hasEnteredAmount && (smartRoute.isFetching || smartRoute.isLoading);
|
|
@@ -9262,7 +9496,7 @@ var PlaceOrder = ({
|
|
|
9262
9496
|
const isBelowVenueMinimumFromQuote = isQuoteBelowVenueMinimum(activeQuoteData);
|
|
9263
9497
|
const isBelowMinimum = isBelowClientMinimum || isBelowVenueMinimumFromQuote;
|
|
9264
9498
|
const belowMinimumMessage = isBelowClientMinimum ? tradingLabels.minimumOrderAmount(MIN_BUY_ORDER_AMOUNT) : tradingLabels.minOrderSizeViolated;
|
|
9265
|
-
const quoteStatus = (0,
|
|
9499
|
+
const quoteStatus = (0, import_react11.useMemo)(() => {
|
|
9266
9500
|
if (!orderEligibility.canPlaceOrder) return void 0;
|
|
9267
9501
|
return resolvePlaceOrderQuoteStatus({
|
|
9268
9502
|
amount: internalAmount,
|
|
@@ -9277,7 +9511,7 @@ var PlaceOrder = ({
|
|
|
9277
9511
|
scopedSelectedMarket,
|
|
9278
9512
|
tradingLabels
|
|
9279
9513
|
]);
|
|
9280
|
-
const smartRouteErrorMessage = (0,
|
|
9514
|
+
const smartRouteErrorMessage = (0, import_react11.useMemo)(() => {
|
|
9281
9515
|
if (!smartRoute.error) return null;
|
|
9282
9516
|
return normalizePlaceOrderErrorMessage({
|
|
9283
9517
|
errorMessage: smartRoute.error.message,
|
|
@@ -9286,7 +9520,7 @@ var PlaceOrder = ({
|
|
|
9286
9520
|
});
|
|
9287
9521
|
}, [smartRoute.error, tradingLabels]);
|
|
9288
9522
|
const progressActionLabel = (internalTab === "buy" ? tradingLabels.buyingOutcome(selectedOutcomeLabel) : tradingLabels.sellingOutcome(selectedOutcomeLabel)).trim();
|
|
9289
|
-
const canRetryRemaining = (0,
|
|
9523
|
+
const canRetryRemaining = (0, import_react11.useMemo)(() => {
|
|
9290
9524
|
const remaining = getPlaceOrderUnfilledRemaining({
|
|
9291
9525
|
originalAmount: internalAmount,
|
|
9292
9526
|
tradeSide: internalTab,
|
|
@@ -9296,7 +9530,7 @@ var PlaceOrder = ({
|
|
|
9296
9530
|
return remaining >= minRemainder;
|
|
9297
9531
|
}, [executionProgress.terminalOrderEvents, internalAmount, internalTab, isSell]);
|
|
9298
9532
|
const PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD = 0.95;
|
|
9299
|
-
const shouldAutoSkipPartialFill = (0,
|
|
9533
|
+
const shouldAutoSkipPartialFill = (0, import_react11.useMemo)(() => {
|
|
9300
9534
|
if (internalAmount <= 0) return false;
|
|
9301
9535
|
const remaining = getPlaceOrderUnfilledRemaining({
|
|
9302
9536
|
originalAmount: internalAmount,
|
|
@@ -9307,7 +9541,7 @@ var PlaceOrder = ({
|
|
|
9307
9541
|
const fillRatio = filled / internalAmount;
|
|
9308
9542
|
return fillRatio >= PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD || !canRetryRemaining;
|
|
9309
9543
|
}, [canRetryRemaining, executionProgress.terminalOrderEvents, internalAmount, internalTab]);
|
|
9310
|
-
const failureSummary = (0,
|
|
9544
|
+
const failureSummary = (0, import_react11.useMemo)(() => {
|
|
9311
9545
|
var _a2;
|
|
9312
9546
|
if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return void 0;
|
|
9313
9547
|
return buildPlaceOrderFailureSummary({
|
|
@@ -9336,7 +9570,7 @@ var PlaceOrder = ({
|
|
|
9336
9570
|
submissionProgressState,
|
|
9337
9571
|
tradingLabels
|
|
9338
9572
|
]);
|
|
9339
|
-
const displayedToWinHint = (0,
|
|
9573
|
+
const displayedToWinHint = (0, import_react11.useMemo)(() => {
|
|
9340
9574
|
var _a2, _b2, _c2, _d2;
|
|
9341
9575
|
if (!selectedRouteCard) return "";
|
|
9342
9576
|
if (selectedRouteCard.isUnavailable) {
|
|
@@ -9345,14 +9579,14 @@ var PlaceOrder = ({
|
|
|
9345
9579
|
}
|
|
9346
9580
|
return (_d2 = selectedRouteCard.hint) != null ? _d2 : "";
|
|
9347
9581
|
}, [selectedRouteCard, tradingLabels]);
|
|
9348
|
-
const displayedToWinValue = (
|
|
9582
|
+
const displayedToWinValue = (_D = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _D : 0;
|
|
9349
9583
|
const activeFeeBreakdown = activeQuoteData == null ? void 0 : activeQuoteData.feeBreakdown;
|
|
9350
|
-
const estimatedFeesValue = (0,
|
|
9584
|
+
const estimatedFeesValue = (0, import_react11.useMemo)(() => {
|
|
9351
9585
|
if (!activeFeeBreakdown) return null;
|
|
9352
9586
|
const totalFees = activeFeeBreakdown.venueFees + activeFeeBreakdown.bridgeFees + activeFeeBreakdown.executionGas;
|
|
9353
9587
|
return formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
9354
9588
|
}, [activeFeeBreakdown]);
|
|
9355
|
-
const feeBreakdownRows = (0,
|
|
9589
|
+
const feeBreakdownRows = (0, import_react11.useMemo)(() => {
|
|
9356
9590
|
if (!activeFeeBreakdown) return [];
|
|
9357
9591
|
return [
|
|
9358
9592
|
{
|
|
@@ -9387,15 +9621,15 @@ var PlaceOrder = ({
|
|
|
9387
9621
|
];
|
|
9388
9622
|
}, [activeFeeBreakdown, tradingLabels]);
|
|
9389
9623
|
const isActionLoading = isPrimaryActionLoading || executeManaged.isPending || isBeforeActionPending;
|
|
9390
|
-
const selectedRouteGeoBlocked = (
|
|
9391
|
-
const geoBlockedVenuesFromWarnings = (0,
|
|
9624
|
+
const selectedRouteGeoBlocked = (_E = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _E : false;
|
|
9625
|
+
const geoBlockedVenuesFromWarnings = (0, import_react11.useMemo)(
|
|
9392
9626
|
() => {
|
|
9393
9627
|
var _a2;
|
|
9394
9628
|
return extractGeoBlockedVenues((_a2 = smartRoute.data) == null ? void 0 : _a2.warnings);
|
|
9395
9629
|
},
|
|
9396
|
-
[(
|
|
9630
|
+
[(_F = smartRoute.data) == null ? void 0 : _F.warnings]
|
|
9397
9631
|
);
|
|
9398
|
-
const isPrimaryVenueGeoBlocked = (0,
|
|
9632
|
+
const isPrimaryVenueGeoBlocked = (0, import_react11.useMemo)(() => {
|
|
9399
9633
|
var _a2, _b2;
|
|
9400
9634
|
if (!selectedRouteCard || selectedRouteCard.isUnavailable) return false;
|
|
9401
9635
|
const fills = (_b2 = (_a2 = selectedRouteCard.quoteData) == null ? void 0 : _a2.fills) != null ? _b2 : [];
|
|
@@ -9406,7 +9640,7 @@ var PlaceOrder = ({
|
|
|
9406
9640
|
const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isQuoteInsufficientBalance || isBelowMinimum || isQuoteLoading || !selectedRouteCard || !selectedRouteCard.quoteData.quoteId || selectedRouteGeoBlocked || !isAuthenticated || quoteStatus !== void 0;
|
|
9407
9641
|
const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (orderedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading);
|
|
9408
9642
|
const shouldShowRouteToggle = !isQuoteLoading && orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
|
|
9409
|
-
const handleReturnToOrderForm = (0,
|
|
9643
|
+
const handleReturnToOrderForm = (0, import_react11.useCallback)(() => {
|
|
9410
9644
|
const submittedSelection = submittedSelectionRef.current;
|
|
9411
9645
|
submittedSelectionRef.current = null;
|
|
9412
9646
|
setSubmissionProgressState(null);
|
|
@@ -9427,7 +9661,7 @@ var PlaceOrder = ({
|
|
|
9427
9661
|
const shareUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(shareText)}`;
|
|
9428
9662
|
window.open(shareUrl, "_blank", "noopener,noreferrer");
|
|
9429
9663
|
};
|
|
9430
|
-
const handleExecuteQuote = (0,
|
|
9664
|
+
const handleExecuteQuote = (0, import_react11.useCallback)(
|
|
9431
9665
|
(quoteData) => __async(null, null, function* () {
|
|
9432
9666
|
var _a2, _b2, _c2;
|
|
9433
9667
|
const quoteId = quoteData == null ? void 0 : quoteData.quoteId;
|
|
@@ -9486,6 +9720,7 @@ var PlaceOrder = ({
|
|
|
9486
9720
|
executionVenue: resolveExecutionVenueFromQuote(quoteData),
|
|
9487
9721
|
orderId: response.orderIds[0],
|
|
9488
9722
|
orderIds: response.orderIds,
|
|
9723
|
+
quoteId: response.quoteId,
|
|
9489
9724
|
phase: "submitting"
|
|
9490
9725
|
});
|
|
9491
9726
|
} catch (error) {
|
|
@@ -9525,7 +9760,7 @@ var PlaceOrder = ({
|
|
|
9525
9760
|
tradingLabels.quoteUnavailable
|
|
9526
9761
|
]
|
|
9527
9762
|
);
|
|
9528
|
-
const handleSkipToSuccess = (0,
|
|
9763
|
+
const handleSkipToSuccess = (0, import_react11.useCallback)(() => {
|
|
9529
9764
|
const primaryFilledEvent = executionProgress.terminalOrderEvents.find(
|
|
9530
9765
|
(e) => e.event === "filled" || e.event === "partial_fill"
|
|
9531
9766
|
);
|
|
@@ -9550,7 +9785,7 @@ var PlaceOrder = ({
|
|
|
9550
9785
|
failureSummary,
|
|
9551
9786
|
selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData
|
|
9552
9787
|
]);
|
|
9553
|
-
(0,
|
|
9788
|
+
(0, import_react11.useEffect)(() => {
|
|
9554
9789
|
if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return;
|
|
9555
9790
|
if ((failureSummary == null ? void 0 : failureSummary.kind) !== "partial_fill") return;
|
|
9556
9791
|
if (!shouldAutoSkipPartialFill) return;
|
|
@@ -9561,7 +9796,7 @@ var PlaceOrder = ({
|
|
|
9561
9796
|
shouldAutoSkipPartialFill,
|
|
9562
9797
|
submissionProgressState == null ? void 0 : submissionProgressState.phase
|
|
9563
9798
|
]);
|
|
9564
|
-
const handleRetrySubmission = (0,
|
|
9799
|
+
const handleRetrySubmission = (0, import_react11.useCallback)(() => __async(null, null, function* () {
|
|
9565
9800
|
var _a2, _b2, _c2;
|
|
9566
9801
|
if (!orderEligibility.canPlaceOrder || (failureSummary == null ? void 0 : failureSummary.kind) === "generic") {
|
|
9567
9802
|
handleReturnToOrderForm();
|
|
@@ -9655,7 +9890,7 @@ var PlaceOrder = ({
|
|
|
9655
9890
|
]);
|
|
9656
9891
|
const resolvedStatusClassName = cn(classNames == null ? void 0 : classNames.root, className);
|
|
9657
9892
|
if (isLoading) {
|
|
9658
|
-
return /* @__PURE__ */ (0,
|
|
9893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
9659
9894
|
Skeleton,
|
|
9660
9895
|
{
|
|
9661
9896
|
ariaLabel: labels.common.loading,
|
|
@@ -9666,7 +9901,7 @@ var PlaceOrder = ({
|
|
|
9666
9901
|
}
|
|
9667
9902
|
if (submissionProgressState) {
|
|
9668
9903
|
if (submissionProgressState.phase === "success" && submissionProgressState.summary) {
|
|
9669
|
-
return /* @__PURE__ */ (0,
|
|
9904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
9670
9905
|
PlaceOrderSuccessView,
|
|
9671
9906
|
{
|
|
9672
9907
|
className: resolvedStatusClassName,
|
|
@@ -9678,7 +9913,7 @@ var PlaceOrder = ({
|
|
|
9678
9913
|
);
|
|
9679
9914
|
}
|
|
9680
9915
|
if (submissionProgressState.phase === "failed") {
|
|
9681
|
-
return /* @__PURE__ */ (0,
|
|
9916
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
9682
9917
|
PlaceOrderFailureView,
|
|
9683
9918
|
{
|
|
9684
9919
|
className: resolvedStatusClassName,
|
|
@@ -9733,8 +9968,8 @@ var PlaceOrder = ({
|
|
|
9733
9968
|
};
|
|
9734
9969
|
const handleFillSellableShares = () => {
|
|
9735
9970
|
if (!isSell) return;
|
|
9736
|
-
if (
|
|
9737
|
-
handleAmountChange(
|
|
9971
|
+
if (maxSellableShares <= 0) return;
|
|
9972
|
+
handleAmountChange(maxSellableShares);
|
|
9738
9973
|
};
|
|
9739
9974
|
const handleDepositRequiredClick = () => {
|
|
9740
9975
|
if (!isInsufficientBalance) return;
|
|
@@ -9803,19 +10038,21 @@ var PlaceOrder = ({
|
|
|
9803
10038
|
});
|
|
9804
10039
|
}
|
|
9805
10040
|
});
|
|
9806
|
-
if (!orderEligibility.canPlaceOrder && resolvedReadOnlyTradingState.kind !== "open") {
|
|
9807
|
-
return /* @__PURE__ */ (0,
|
|
10041
|
+
if (isEndedWithoutKnownWinner || !orderEligibility.canPlaceOrder && resolvedReadOnlyTradingState.kind !== "open") {
|
|
10042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
9808
10043
|
PlaceOrderResolvedView,
|
|
9809
10044
|
{
|
|
9810
10045
|
tradingState: resolvedReadOnlyTradingState,
|
|
10046
|
+
resolutionTimestamp: (_G = resolvedEventTradingState.resolvesAt) != null ? _G : resolvedReadOnlyTradingState.resolvesAt,
|
|
9811
10047
|
resolvedClaim,
|
|
9812
10048
|
classNames,
|
|
9813
|
-
className
|
|
10049
|
+
className,
|
|
10050
|
+
isSportsEvent: (scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.structureType) === "sport" && !!(scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.sport) && scopedSelectedEvent.sport !== "other_sport"
|
|
9814
10051
|
}
|
|
9815
10052
|
);
|
|
9816
10053
|
}
|
|
9817
|
-
return /* @__PURE__ */ (0,
|
|
9818
|
-
/* @__PURE__ */ (0,
|
|
10054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(import_react11.Fragment, { children: [
|
|
10055
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
9819
10056
|
Card,
|
|
9820
10057
|
{
|
|
9821
10058
|
className: cn(
|
|
@@ -9832,8 +10069,8 @@ var PlaceOrder = ({
|
|
|
9832
10069
|
headerTitle,
|
|
9833
10070
|
onClose
|
|
9834
10071
|
}),
|
|
9835
|
-
/* @__PURE__ */ (0,
|
|
9836
|
-
/* @__PURE__ */ (0,
|
|
10072
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: cn("agg-order-panel-content flex flex-col gap-6", classNames == null ? void 0 : classNames.content), children: [
|
|
10073
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
9837
10074
|
"div",
|
|
9838
10075
|
{
|
|
9839
10076
|
className: "agg-order-tabs flex items-end border-b border-agg-separator",
|
|
@@ -9844,7 +10081,7 @@ var PlaceOrder = ({
|
|
|
9844
10081
|
{ value: "sell", label: tradingLabels.sell, ref: sellTabRef }
|
|
9845
10082
|
].map((tabItem) => {
|
|
9846
10083
|
const isActive = internalTab === tabItem.value;
|
|
9847
|
-
return /* @__PURE__ */ (0,
|
|
10084
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
9848
10085
|
"button",
|
|
9849
10086
|
{
|
|
9850
10087
|
ref: tabItem.ref,
|
|
@@ -9868,7 +10105,7 @@ var PlaceOrder = ({
|
|
|
9868
10105
|
onKeyDown: (event) => handleTabKeyDown(event, tabItem.value),
|
|
9869
10106
|
children: [
|
|
9870
10107
|
tabItem.label,
|
|
9871
|
-
/* @__PURE__ */ (0,
|
|
10108
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
9872
10109
|
"span",
|
|
9873
10110
|
{
|
|
9874
10111
|
"aria-hidden": "true",
|
|
@@ -9890,7 +10127,7 @@ var PlaceOrder = ({
|
|
|
9890
10127
|
})
|
|
9891
10128
|
}
|
|
9892
10129
|
),
|
|
9893
|
-
outcomes.length >= 2 ? /* @__PURE__ */ (0,
|
|
10130
|
+
outcomes.length >= 2 ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "agg-outcomes flex w-full max-w-full gap-2", children: outcomes.map((outcome, index) => {
|
|
9894
10131
|
var _a2, _b2, _c2;
|
|
9895
10132
|
const price = getDisplayOutcomePrice({
|
|
9896
10133
|
outcomeId: outcome.id,
|
|
@@ -9904,7 +10141,7 @@ var PlaceOrder = ({
|
|
|
9904
10141
|
});
|
|
9905
10142
|
const isActive = outcome.id === scopedSelectedOutcomeId;
|
|
9906
10143
|
const isPositive = resolveIsPositiveOutcome(outcome, index);
|
|
9907
|
-
return /* @__PURE__ */ (0,
|
|
10144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
9908
10145
|
"button",
|
|
9909
10146
|
{
|
|
9910
10147
|
"data-id": outcome.id,
|
|
@@ -9924,7 +10161,7 @@ var PlaceOrder = ({
|
|
|
9924
10161
|
disabled: !orderEligibility.canPlaceOrder || isResolvedOutcomeCtaLocked,
|
|
9925
10162
|
onClick: () => handleOutcomeChange(outcome.id),
|
|
9926
10163
|
children: [
|
|
9927
|
-
/* @__PURE__ */ (0,
|
|
10164
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
9928
10165
|
Typography,
|
|
9929
10166
|
{
|
|
9930
10167
|
as: "span",
|
|
@@ -9933,18 +10170,18 @@ var PlaceOrder = ({
|
|
|
9933
10170
|
children: (_c2 = outcome.title) != null ? _c2 : outcome.label
|
|
9934
10171
|
}
|
|
9935
10172
|
),
|
|
9936
|
-
/* @__PURE__ */ (0,
|
|
10173
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Typography, { as: "span", variant: isActive ? "body-strong" : "body", children: formatProbabilityCents(price) })
|
|
9937
10174
|
]
|
|
9938
10175
|
},
|
|
9939
10176
|
outcome.id
|
|
9940
10177
|
);
|
|
9941
10178
|
}) }) : null,
|
|
9942
|
-
/* @__PURE__ */ (0,
|
|
9943
|
-
/* @__PURE__ */ (0,
|
|
9944
|
-
/* @__PURE__ */ (0,
|
|
9945
|
-
isAuthenticated ? isSell ? /* @__PURE__ */ (0,
|
|
9946
|
-
/* @__PURE__ */ (0,
|
|
9947
|
-
displayedCurrentSellableShares > 0 ? /* @__PURE__ */ (0,
|
|
10179
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-order-amount-section flex items-start justify-between gap-4", children: [
|
|
10180
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-order-amount-meta flex flex-col", children: [
|
|
10181
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "agg-order-amount-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground whitespace-nowrap", children: tradingLabels.amount(internalTab) }),
|
|
10182
|
+
isAuthenticated ? isSell ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "agg-balance-value flex items-baseline gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isCurrentSellableSharesLoading ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(LoadingIcon, { size: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(import_jsx_runtime123.Fragment, { children: [
|
|
10183
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { className: "whitespace-pre", children: displayedCurrentSellableSharesLabel }),
|
|
10184
|
+
displayedCurrentSellableShares > 0 ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
9948
10185
|
"button",
|
|
9949
10186
|
{
|
|
9950
10187
|
type: "button",
|
|
@@ -9960,9 +10197,9 @@ var PlaceOrder = ({
|
|
|
9960
10197
|
children: tradingLabels.maxShares
|
|
9961
10198
|
}
|
|
9962
10199
|
) : null
|
|
9963
|
-
] }) }) : /* @__PURE__ */ (0,
|
|
10200
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "agg-balance-value flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isBalanceLoading ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(LoadingIcon, { size: "small" }) : tradingLabels.balance(formatUsd(totalBalance)) }) : null
|
|
9964
10201
|
] }),
|
|
9965
|
-
/* @__PURE__ */ (0,
|
|
10202
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
9966
10203
|
CurrencyInput,
|
|
9967
10204
|
{
|
|
9968
10205
|
value: internalAmount,
|
|
@@ -9971,7 +10208,7 @@ var PlaceOrder = ({
|
|
|
9971
10208
|
isInvalid: isInsufficientBalance || isBelowMinimum,
|
|
9972
10209
|
disabled: !orderEligibility.canPlaceOrder,
|
|
9973
10210
|
prefix: internalTab === "buy" ? "$" : "",
|
|
9974
|
-
decimalPlaces: isSell ?
|
|
10211
|
+
decimalPlaces: isSell ? SELL_SHARE_INPUT_DECIMALS : 2,
|
|
9975
10212
|
classNames: {
|
|
9976
10213
|
input: cn(
|
|
9977
10214
|
"agg-order-amount-input",
|
|
@@ -9982,9 +10219,9 @@ var PlaceOrder = ({
|
|
|
9982
10219
|
}
|
|
9983
10220
|
)
|
|
9984
10221
|
] }),
|
|
9985
|
-
showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */ (0,
|
|
9986
|
-
/* @__PURE__ */ (0,
|
|
9987
|
-
/* @__PURE__ */ (0,
|
|
10222
|
+
showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-order-fees-section flex items-center justify-between gap-4", children: [
|
|
10223
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
10224
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
9988
10225
|
Typography,
|
|
9989
10226
|
{
|
|
9990
10227
|
variant: "text-sm",
|
|
@@ -9992,7 +10229,7 @@ var PlaceOrder = ({
|
|
|
9992
10229
|
children: tradingLabels.estimatedFees
|
|
9993
10230
|
}
|
|
9994
10231
|
),
|
|
9995
|
-
feeBreakdownRows.length > 0 ? /* @__PURE__ */ (0,
|
|
10232
|
+
feeBreakdownRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
9996
10233
|
Tooltip,
|
|
9997
10234
|
{
|
|
9998
10235
|
"aria-label": tradingLabels.estimatedFeesTooltipAria,
|
|
@@ -10004,13 +10241,13 @@ var PlaceOrder = ({
|
|
|
10004
10241
|
icon: "h-3 w-3 text-agg-muted-foreground",
|
|
10005
10242
|
trigger: "h-3 w-3 text-agg-muted-foreground"
|
|
10006
10243
|
},
|
|
10007
|
-
content: /* @__PURE__ */ (0,
|
|
10244
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "flex w-full flex-col gap-2", children: feeBreakdownRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
10008
10245
|
"div",
|
|
10009
10246
|
{
|
|
10010
10247
|
className: "flex items-center justify-between gap-3 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground",
|
|
10011
10248
|
children: [
|
|
10012
|
-
/* @__PURE__ */ (0,
|
|
10013
|
-
row.kind === "badge" ? /* @__PURE__ */ (0,
|
|
10249
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { children: row.label }),
|
|
10250
|
+
row.kind === "badge" ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
10014
10251
|
"span",
|
|
10015
10252
|
{
|
|
10016
10253
|
className: cn(
|
|
@@ -10020,7 +10257,7 @@ var PlaceOrder = ({
|
|
|
10020
10257
|
),
|
|
10021
10258
|
children: row.badgeLabel
|
|
10022
10259
|
}
|
|
10023
|
-
) : /* @__PURE__ */ (0,
|
|
10260
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { className: "text-right", children: row.value })
|
|
10024
10261
|
]
|
|
10025
10262
|
},
|
|
10026
10263
|
row.label
|
|
@@ -10028,12 +10265,12 @@ var PlaceOrder = ({
|
|
|
10028
10265
|
}
|
|
10029
10266
|
) : null
|
|
10030
10267
|
] }),
|
|
10031
|
-
/* @__PURE__ */ (0,
|
|
10268
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: estimatedFeesValue })
|
|
10032
10269
|
] }) : null,
|
|
10033
|
-
shouldShowSmartRouting ? /* @__PURE__ */ (0,
|
|
10034
|
-
/* @__PURE__ */ (0,
|
|
10035
|
-
/* @__PURE__ */ (0,
|
|
10036
|
-
shouldShowRouteToggle && !isRoutesExpanded ? /* @__PURE__ */ (0,
|
|
10270
|
+
shouldShowSmartRouting ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-route-panel flex flex-col gap-3", children: [
|
|
10271
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-route-panel-header flex items-center justify-between gap-4", children: [
|
|
10272
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "agg-route-panel-title text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.smartRouting }),
|
|
10273
|
+
shouldShowRouteToggle && !isRoutesExpanded ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
10037
10274
|
"button",
|
|
10038
10275
|
{
|
|
10039
10276
|
type: "button",
|
|
@@ -10041,8 +10278,8 @@ var PlaceOrder = ({
|
|
|
10041
10278
|
"aria-label": tradingLabels.viewAllRoutes(orderedRouteCards.length),
|
|
10042
10279
|
onClick: () => setIsRoutesExpanded((currentValue) => !currentValue),
|
|
10043
10280
|
children: [
|
|
10044
|
-
/* @__PURE__ */ (0,
|
|
10045
|
-
/* @__PURE__ */ (0,
|
|
10281
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { children: tradingLabels.viewAllRoutes(orderedRouteCards.length) }),
|
|
10282
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
10046
10283
|
Icon,
|
|
10047
10284
|
{
|
|
10048
10285
|
name: "chevron-down",
|
|
@@ -10055,11 +10292,11 @@ var PlaceOrder = ({
|
|
|
10055
10292
|
}
|
|
10056
10293
|
) : null
|
|
10057
10294
|
] }),
|
|
10058
|
-
/* @__PURE__ */ (0,
|
|
10059
|
-
/* @__PURE__ */ (0,
|
|
10060
|
-
/* @__PURE__ */ (0,
|
|
10295
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "agg-route-list flex flex-col gap-2", children: isQuoteLoading ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-route-loading flex flex-col gap-2", "aria-hidden": "true", children: [
|
|
10296
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(PlaceOrderRouteCardSkeleton, {}),
|
|
10297
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(PlaceOrderRouteCardSkeleton, {})
|
|
10061
10298
|
] }) : visibleRouteCards.length > 0 ? visibleRouteCards.map((card) => {
|
|
10062
|
-
return /* @__PURE__ */ (0,
|
|
10299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_react11.Fragment, { children: renderRouteCard({
|
|
10063
10300
|
card,
|
|
10064
10301
|
enableAnimations,
|
|
10065
10302
|
isExpanded: card.kind === "split" ? isSplitDetailOpen : isRoutesExpanded,
|
|
@@ -10069,13 +10306,13 @@ var PlaceOrder = ({
|
|
|
10069
10306
|
}) }, card.id);
|
|
10070
10307
|
}) : null })
|
|
10071
10308
|
] }) : null,
|
|
10072
|
-
hasEnteredAmount && selectedRouteCard && !isQuoteLoading && !isBelowMinimum && orderEligibility.canPlaceOrder ? /* @__PURE__ */ (0,
|
|
10073
|
-
/* @__PURE__ */ (0,
|
|
10074
|
-
/* @__PURE__ */ (0,
|
|
10075
|
-
/* @__PURE__ */ (0,
|
|
10309
|
+
hasEnteredAmount && selectedRouteCard && !isQuoteLoading && !isBelowMinimum && orderEligibility.canPlaceOrder ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-order-summary flex items-start justify-between gap-4", children: [
|
|
10310
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-order-summary-meta flex flex-col", children: [
|
|
10311
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "agg-order-summary-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.toWin(internalTab) }),
|
|
10312
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "agg-order-summary-hint text-agg-sm leading-agg-5 text-agg-muted-foreground", children: displayedToWinHint })
|
|
10076
10313
|
] }),
|
|
10077
|
-
/* @__PURE__ */ (0,
|
|
10078
|
-
|
|
10314
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
10315
|
+
import_react10.default,
|
|
10079
10316
|
{
|
|
10080
10317
|
value: displayedToWinValue,
|
|
10081
10318
|
locales: locale,
|
|
@@ -10089,7 +10326,7 @@ var PlaceOrder = ({
|
|
|
10089
10326
|
}
|
|
10090
10327
|
)
|
|
10091
10328
|
] }) : null,
|
|
10092
|
-
/* @__PURE__ */ (0,
|
|
10329
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
10093
10330
|
"div",
|
|
10094
10331
|
{
|
|
10095
10332
|
className: cn(
|
|
@@ -10097,17 +10334,17 @@ var PlaceOrder = ({
|
|
|
10097
10334
|
classNames == null ? void 0 : classNames.footer
|
|
10098
10335
|
),
|
|
10099
10336
|
children: [
|
|
10100
|
-
!shouldShowGeoBlockBanner ? /* @__PURE__ */ (0,
|
|
10101
|
-
submissionFeedback ? /* @__PURE__ */ (0,
|
|
10337
|
+
!shouldShowGeoBlockBanner ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "agg-order-alerts flex flex-col gap-3 empty:hidden mb-3", children: [
|
|
10338
|
+
submissionFeedback ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
10102
10339
|
InlineAlert,
|
|
10103
10340
|
{
|
|
10104
10341
|
tone: submissionFeedback.tone,
|
|
10105
10342
|
message: submissionFeedback.message
|
|
10106
10343
|
}
|
|
10107
10344
|
) : null,
|
|
10108
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && isBelowMinimum ? /* @__PURE__ */ (0,
|
|
10109
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && quoteStatus ? /* @__PURE__ */ (0,
|
|
10110
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && !quoteStatus && isAuthenticated && hasEnteredAmount && smartRouteErrorMessage ? /* @__PURE__ */ (0,
|
|
10345
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && isBelowMinimum ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(InlineAlert, { tone: "error", message: belowMinimumMessage }) : null,
|
|
10346
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && quoteStatus ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(InlineAlert, { tone: quoteStatus.tone, message: quoteStatus.message }) : null,
|
|
10347
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && !quoteStatus && isAuthenticated && hasEnteredAmount && smartRouteErrorMessage ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
10111
10348
|
InlineAlert,
|
|
10112
10349
|
{
|
|
10113
10350
|
tone: "error",
|
|
@@ -10119,14 +10356,14 @@ var PlaceOrder = ({
|
|
|
10119
10356
|
}
|
|
10120
10357
|
) : null
|
|
10121
10358
|
] }) : null,
|
|
10122
|
-
!submissionFeedback && !shouldShowGeoBlockBanner && orderEligibility.canPlaceOrder && shouldShowInsufficientBalanceAlert ? /* @__PURE__ */ (0,
|
|
10359
|
+
!submissionFeedback && !shouldShowGeoBlockBanner && orderEligibility.canPlaceOrder && shouldShowInsufficientBalanceAlert ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
10123
10360
|
"div",
|
|
10124
10361
|
{
|
|
10125
10362
|
className: "agg-order-insufficient-balance-alert flex items-center justify-center gap-2",
|
|
10126
10363
|
role: "status",
|
|
10127
10364
|
"aria-live": "polite",
|
|
10128
10365
|
children: [
|
|
10129
|
-
/* @__PURE__ */ (0,
|
|
10366
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
10130
10367
|
Icon,
|
|
10131
10368
|
{
|
|
10132
10369
|
name: "warning-filled",
|
|
@@ -10135,11 +10372,11 @@ var PlaceOrder = ({
|
|
|
10135
10372
|
"aria-hidden": "true"
|
|
10136
10373
|
}
|
|
10137
10374
|
),
|
|
10138
|
-
/* @__PURE__ */ (0,
|
|
10375
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { className: "text-agg-sm text-agg-foreground", children: tradingLabels.insufficientBalance })
|
|
10139
10376
|
]
|
|
10140
10377
|
}
|
|
10141
10378
|
) : null,
|
|
10142
|
-
!submissionFeedback && !shouldShowGeoBlockBanner && isInsufficientBalance ? /* @__PURE__ */ (0,
|
|
10379
|
+
!submissionFeedback && !shouldShowGeoBlockBanner && isInsufficientBalance ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
10143
10380
|
Button,
|
|
10144
10381
|
{
|
|
10145
10382
|
size: "large",
|
|
@@ -10149,7 +10386,7 @@ var PlaceOrder = ({
|
|
|
10149
10386
|
onClick: handleDepositRequiredClick,
|
|
10150
10387
|
children: tradingLabels.deposit
|
|
10151
10388
|
}
|
|
10152
|
-
) : needsKycVerification && !submissionFeedback && !shouldShowGeoBlockBanner ? /* @__PURE__ */ (0,
|
|
10389
|
+
) : needsKycVerification && !submissionFeedback && !shouldShowGeoBlockBanner ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(InitiateKycButton, { label: tradingLabels.kycRequired, onOpen: openVerifyModal }) : isQuoteLoading && !isActionLoading ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
10153
10390
|
Button,
|
|
10154
10391
|
{
|
|
10155
10392
|
size: "large",
|
|
@@ -10158,7 +10395,7 @@ var PlaceOrder = ({
|
|
|
10158
10395
|
disabled: true,
|
|
10159
10396
|
"aria-live": "polite",
|
|
10160
10397
|
"aria-label": routeLoadingMessage != null ? routeLoadingMessage : labels.common.loading,
|
|
10161
|
-
prefix: /* @__PURE__ */ (0,
|
|
10398
|
+
prefix: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
10162
10399
|
"span",
|
|
10163
10400
|
{
|
|
10164
10401
|
className: cn(
|
|
@@ -10170,7 +10407,7 @@ var PlaceOrder = ({
|
|
|
10170
10407
|
),
|
|
10171
10408
|
children: routeLoadingMessage
|
|
10172
10409
|
}
|
|
10173
|
-
) : !isAuthenticated ? /* @__PURE__ */ (0,
|
|
10410
|
+
) : !isAuthenticated ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
10174
10411
|
Button,
|
|
10175
10412
|
{
|
|
10176
10413
|
size: "large",
|
|
@@ -10178,10 +10415,10 @@ var PlaceOrder = ({
|
|
|
10178
10415
|
className: "agg-order-submit h-12 w-full px-8 text-agg-base leading-agg-6 shadow-none",
|
|
10179
10416
|
disabled: !orderEligibility.canPlaceOrder || shouldShowGeoBlockBanner,
|
|
10180
10417
|
"aria-label": tradingLabels.signInToTrade,
|
|
10181
|
-
onClick:
|
|
10418
|
+
onClick: import_hooks30.requestAggAuthChooserOpen,
|
|
10182
10419
|
children: tradingLabels.signInToTrade
|
|
10183
10420
|
}
|
|
10184
|
-
) : /* @__PURE__ */ (0,
|
|
10421
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
10185
10422
|
Button,
|
|
10186
10423
|
{
|
|
10187
10424
|
size: "large",
|
|
@@ -10196,8 +10433,8 @@ var PlaceOrder = ({
|
|
|
10196
10433
|
children: actionLabel
|
|
10197
10434
|
}
|
|
10198
10435
|
),
|
|
10199
|
-
!shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown ? /* @__PURE__ */ (0,
|
|
10200
|
-
/* @__PURE__ */ (0,
|
|
10436
|
+
!shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("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: [
|
|
10437
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
10201
10438
|
Icon,
|
|
10202
10439
|
{
|
|
10203
10440
|
name: "shield-trust",
|
|
@@ -10206,10 +10443,10 @@ var PlaceOrder = ({
|
|
|
10206
10443
|
"aria-hidden": "true"
|
|
10207
10444
|
}
|
|
10208
10445
|
),
|
|
10209
|
-
/* @__PURE__ */ (0,
|
|
10446
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Typography, { variant: "text-xs-caps", className: "text-agg-primary", children: tradingLabels.platformFee })
|
|
10210
10447
|
] }) : null,
|
|
10211
|
-
shouldShowGeoBlockBanner ? /* @__PURE__ */ (0,
|
|
10212
|
-
!shouldShowGeoBlockBanner ? /* @__PURE__ */ (0,
|
|
10448
|
+
shouldShowGeoBlockBanner ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(GeoBlockBanner, { termsUrl: AGG_TERMS_OF_SERVICE_URL }) : null,
|
|
10449
|
+
!shouldShowGeoBlockBanner ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "agg-order-disclaimer text-center text-agg-xs leading-agg-4 text-agg-muted-foreground", children: tradingLabels.disclaimer }) : null
|
|
10213
10450
|
]
|
|
10214
10451
|
}
|
|
10215
10452
|
)
|
|
@@ -10217,7 +10454,7 @@ var PlaceOrder = ({
|
|
|
10217
10454
|
]
|
|
10218
10455
|
}
|
|
10219
10456
|
),
|
|
10220
|
-
/* @__PURE__ */ (0,
|
|
10457
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
10221
10458
|
KycVerifyModal,
|
|
10222
10459
|
{
|
|
10223
10460
|
open: isKycVerifyModalOpen,
|
|
@@ -10234,7 +10471,7 @@ var PlaceOrder = ({
|
|
|
10234
10471
|
}
|
|
10235
10472
|
}
|
|
10236
10473
|
),
|
|
10237
|
-
/* @__PURE__ */ (0,
|
|
10474
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
10238
10475
|
KycSuccessModal,
|
|
10239
10476
|
{
|
|
10240
10477
|
open: showKycSuccessModal,
|
|
@@ -10253,33 +10490,33 @@ var PlaceOrder = ({
|
|
|
10253
10490
|
PlaceOrder.displayName = "PlaceOrder";
|
|
10254
10491
|
|
|
10255
10492
|
// src/trading/trading-context/index.tsx
|
|
10256
|
-
var
|
|
10493
|
+
var import_hooks31 = require("@agg-build/hooks");
|
|
10257
10494
|
|
|
10258
10495
|
// src/trading/use-claim-winnings.ts
|
|
10259
|
-
var
|
|
10260
|
-
var
|
|
10496
|
+
var import_hooks32 = require("@agg-build/hooks");
|
|
10497
|
+
var import_react12 = require("react");
|
|
10261
10498
|
var toClaimError = (err) => {
|
|
10262
10499
|
if (err instanceof Error) return err;
|
|
10263
10500
|
return new Error(String(err));
|
|
10264
10501
|
};
|
|
10265
10502
|
function useClaimWinnings(options = {}) {
|
|
10266
10503
|
const { onClaim, onClaimResult, onClaimSubmitError, externalClaimingKeys } = options;
|
|
10267
|
-
const labels = (0,
|
|
10504
|
+
const labels = (0, import_hooks32.useLabels)();
|
|
10268
10505
|
const claimNotificationLabels = labels.notifications.claim;
|
|
10269
10506
|
const toastCtx = useOptionalToast();
|
|
10270
|
-
const queryClient = (0,
|
|
10271
|
-
const redeemMutation = (0,
|
|
10272
|
-
const [activeRedeems, setActiveRedeems] = (0,
|
|
10273
|
-
const activeClaimKeysRef = (0,
|
|
10274
|
-
const pendingClaimToastIdsRef = (0,
|
|
10275
|
-
const submittedClaimToastKeysRef = (0,
|
|
10276
|
-
const [submittingClaimKeys, setSubmittingClaimKeys] = (0,
|
|
10277
|
-
const lifecycleInputs = (0,
|
|
10507
|
+
const queryClient = (0, import_hooks32.useQueryClient)();
|
|
10508
|
+
const redeemMutation = (0, import_hooks32.useRedeem)();
|
|
10509
|
+
const [activeRedeems, setActiveRedeems] = (0, import_react12.useState)({});
|
|
10510
|
+
const activeClaimKeysRef = (0, import_react12.useRef)(/* @__PURE__ */ new Set());
|
|
10511
|
+
const pendingClaimToastIdsRef = (0, import_react12.useRef)({});
|
|
10512
|
+
const submittedClaimToastKeysRef = (0, import_react12.useRef)(/* @__PURE__ */ new Set());
|
|
10513
|
+
const [submittingClaimKeys, setSubmittingClaimKeys] = (0, import_react12.useState)({});
|
|
10514
|
+
const lifecycleInputs = (0, import_react12.useMemo)(
|
|
10278
10515
|
() => Object.values(activeRedeems),
|
|
10279
10516
|
[activeRedeems]
|
|
10280
10517
|
);
|
|
10281
|
-
const lifecycleStates = (0,
|
|
10282
|
-
const internalClaimingIds = (0,
|
|
10518
|
+
const lifecycleStates = (0, import_hooks32.useRedeemLifecycles)(lifecycleInputs);
|
|
10519
|
+
const internalClaimingIds = (0, import_react12.useMemo)(() => {
|
|
10283
10520
|
const out = __spreadValues({}, submittingClaimKeys);
|
|
10284
10521
|
for (const [claimKey, active] of Object.entries(activeRedeems)) {
|
|
10285
10522
|
const state = lifecycleStates[active.redeemId];
|
|
@@ -10288,20 +10525,20 @@ function useClaimWinnings(options = {}) {
|
|
|
10288
10525
|
return out;
|
|
10289
10526
|
}, [activeRedeems, lifecycleStates, submittingClaimKeys]);
|
|
10290
10527
|
const claimingKeys = externalClaimingKeys != null ? externalClaimingKeys : internalClaimingIds;
|
|
10291
|
-
const isClaiming = (0,
|
|
10528
|
+
const isClaiming = (0, import_react12.useCallback)(
|
|
10292
10529
|
(claimKey) => Boolean(externalClaimingKeys == null ? void 0 : externalClaimingKeys[claimKey]) || Boolean(internalClaimingIds[claimKey]),
|
|
10293
10530
|
[externalClaimingKeys, internalClaimingIds]
|
|
10294
10531
|
);
|
|
10295
|
-
const invalidateClaimUiState = (0,
|
|
10296
|
-
(0,
|
|
10297
|
-
(0,
|
|
10532
|
+
const invalidateClaimUiState = (0, import_react12.useCallback)(() => {
|
|
10533
|
+
(0, import_hooks32.invalidateBalanceQueries)(queryClient);
|
|
10534
|
+
(0, import_hooks32.invalidatePositionQueries)(queryClient);
|
|
10298
10535
|
queryClient.invalidateQueries({
|
|
10299
|
-
queryKey:
|
|
10536
|
+
queryKey: import_hooks32.executionKeys.claimablePositionsCount(),
|
|
10300
10537
|
refetchType: "active"
|
|
10301
10538
|
});
|
|
10302
|
-
(0,
|
|
10539
|
+
(0, import_hooks32.invalidateUserActivityQueries)(queryClient);
|
|
10303
10540
|
}, [queryClient]);
|
|
10304
|
-
const claim = (0,
|
|
10541
|
+
const claim = (0, import_react12.useCallback)(
|
|
10305
10542
|
(_0) => __async(null, [_0], function* ({ claimKey, winningOutcomeIds, payload }) {
|
|
10306
10543
|
if (activeClaimKeysRef.current.has(claimKey) || Boolean(externalClaimingKeys == null ? void 0 : externalClaimingKeys[claimKey]) || internalClaimingIds[claimKey]) {
|
|
10307
10544
|
return;
|
|
@@ -10439,8 +10676,8 @@ function useClaimWinnings(options = {}) {
|
|
|
10439
10676
|
toastCtx
|
|
10440
10677
|
]
|
|
10441
10678
|
);
|
|
10442
|
-
const firedTerminalRef = (0,
|
|
10443
|
-
(0,
|
|
10679
|
+
const firedTerminalRef = (0, import_react12.useRef)({});
|
|
10680
|
+
(0, import_react12.useEffect)(() => {
|
|
10444
10681
|
var _a, _b;
|
|
10445
10682
|
for (const [claimKey, active] of Object.entries(activeRedeems)) {
|
|
10446
10683
|
const state = lifecycleStates[active.redeemId];
|
|
@@ -10496,8 +10733,8 @@ function useClaimWinnings(options = {}) {
|
|
|
10496
10733
|
}
|
|
10497
10734
|
|
|
10498
10735
|
// src/trading/use-resolved-market-claim.ts
|
|
10499
|
-
var
|
|
10500
|
-
var
|
|
10736
|
+
var import_hooks33 = require("@agg-build/hooks");
|
|
10737
|
+
var import_react13 = require("react");
|
|
10501
10738
|
var sharesFormatter = new Intl.NumberFormat("en-US", { maximumFractionDigits: 2 });
|
|
10502
10739
|
var dateFormatter = new Intl.DateTimeFormat("en-US", {
|
|
10503
10740
|
month: "short",
|
|
@@ -10513,18 +10750,18 @@ var formatResolutionDate = (value) => {
|
|
|
10513
10750
|
function useResolvedMarketClaim(options = {}) {
|
|
10514
10751
|
var _a;
|
|
10515
10752
|
const { market, enabled = true, executionMode } = options;
|
|
10516
|
-
const { isAuthenticated } = (0,
|
|
10517
|
-
const tradingState = (0,
|
|
10753
|
+
const { isAuthenticated } = (0, import_hooks33.useAggAuthState)();
|
|
10754
|
+
const tradingState = (0, import_react13.useMemo)(() => (0, import_hooks33.resolveMarketTradingState)(market), [market]);
|
|
10518
10755
|
const isResolved = tradingState.kind === "resolved";
|
|
10519
10756
|
const marketId = (_a = market == null ? void 0 : market.id) != null ? _a : null;
|
|
10520
10757
|
const shouldFetch = Boolean(enabled && isAuthenticated && isResolved && marketId);
|
|
10521
|
-
const { positions } = (0,
|
|
10758
|
+
const { positions } = (0, import_hooks33.useExecutionPositions)(__spreadValues({
|
|
10522
10759
|
enabled: shouldFetch,
|
|
10523
10760
|
status: "active",
|
|
10524
10761
|
limit: 50
|
|
10525
10762
|
}, executionMode === "paper" ? { mode: "paper" } : {}));
|
|
10526
10763
|
const claimWinnings = useClaimWinnings();
|
|
10527
|
-
return (0,
|
|
10764
|
+
return (0, import_react13.useMemo)(() => {
|
|
10528
10765
|
var _a2, _b, _c;
|
|
10529
10766
|
if (!shouldFetch || !marketId) return void 0;
|
|
10530
10767
|
const group = positions.find(
|
|
@@ -10535,7 +10772,7 @@ function useResolvedMarketClaim(options = {}) {
|
|
|
10535
10772
|
(outcome) => outcome.winner === true && outcome.totalSize > 0
|
|
10536
10773
|
);
|
|
10537
10774
|
if (winningOutcomes.length === 0) return void 0;
|
|
10538
|
-
const totals = (0,
|
|
10775
|
+
const totals = (0, import_hooks33.computeClosedPositionTotals)(group);
|
|
10539
10776
|
const winningShares = winningOutcomes.reduce((sum, outcome) => sum + outcome.totalSize, 0);
|
|
10540
10777
|
const winningOutcomeLabel = ((_b = (_a2 = winningOutcomes[0]) == null ? void 0 : _a2.title) == null ? void 0 : _b.trim()) || ((_c = winningOutcomes[0]) == null ? void 0 : _c.label) || "";
|
|
10541
10778
|
const claimKey = group.targetMarketId;
|