@agg-build/ui 2.0.0 → 2.1.1
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-RF2EPYLN.mjs → chunk-IQT4I5B4.mjs} +405 -318
- package/dist/{chunk-RWOF44TC.mjs → chunk-NK57KMYN.mjs} +239 -183
- package/dist/{chunk-HH7L3KLS.mjs → chunk-RPXRTXCY.mjs} +1 -1
- package/dist/{chunk-4CM4F4S6.mjs → chunk-TERG43WW.mjs} +1 -1
- package/dist/{chunk-2UKDQ7WP.mjs → chunk-WU2C3C6K.mjs} +94 -39
- package/dist/{chunk-R3U6YXSQ.mjs → chunk-XHDGSRG7.mjs} +36 -21
- package/dist/{chunk-2ZS3BPSF.mjs → chunk-YJO6LMRT.mjs} +906 -827
- package/dist/events.js +1376 -1314
- package/dist/events.mjs +3 -3
- package/dist/index.js +3701 -3408
- package/dist/index.mjs +13 -7
- package/dist/modals.js +1117 -983
- package/dist/modals.mjs +5 -3
- package/dist/pages.js +2664 -2429
- package/dist/pages.mjs +8 -6
- package/dist/primitives.js +912 -832
- package/dist/primitives.mjs +3 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +554 -510
- package/dist/trading.mjs +4 -4
- package/dist/types/events/list/category-sidebar.d.mts +33 -0
- package/dist/types/events/list/category-sidebar.d.ts +33 -0
- package/dist/types/events/list/event-list-tabs.d.mts +2 -0
- package/dist/types/events/list/event-list-tabs.d.ts +2 -0
- package/dist/types/events/list/index.d.mts +1 -0
- package/dist/types/events/list/index.d.ts +1 -0
- package/dist/types/pages/event-market/event-market.types.d.mts +1 -0
- package/dist/types/pages/event-market/event-market.types.d.ts +1 -0
- package/dist/types/pages/user-profile/index.d.mts +2 -1
- package/dist/types/pages/user-profile/index.d.ts +2 -1
- package/dist/types/pages/user-profile/transaction-explorer.d.mts +1 -0
- package/dist/types/pages/user-profile/transaction-explorer.d.ts +1 -0
- package/dist/types/pages/user-profile/user-profile.types.d.mts +9 -2
- package/dist/types/pages/user-profile/user-profile.types.d.ts +9 -2
- package/dist/types/primitives/icon/index.d.mts +2 -1
- package/dist/types/primitives/icon/index.d.ts +2 -1
- package/dist/types/primitives/icon/registry.d.mts +4 -0
- package/dist/types/primitives/icon/registry.d.ts +4 -0
- package/dist/types/primitives/icon/svg/paper-mode.d.mts +5 -0
- package/dist/types/primitives/icon/svg/paper-mode.d.ts +5 -0
- package/dist/types/shared/use-horizontal-scroll-state.d.mts +15 -0
- package/dist/types/shared/use-horizontal-scroll-state.d.ts +15 -0
- package/dist/types/withdraw/index.d.mts +9 -1
- package/dist/types/withdraw/index.d.ts +9 -1
- package/dist/types/withdraw/steps/withdraw-amount.d.mts +10 -1
- package/dist/types/withdraw/steps/withdraw-amount.d.ts +10 -1
- package/dist/types/withdraw/withdraw-modal.types.d.mts +8 -0
- package/dist/types/withdraw/withdraw-modal.types.d.ts +8 -0
- package/package.json +3 -3
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
shortenAddress,
|
|
39
39
|
useOptionalToast,
|
|
40
40
|
venueLogoLabels
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-YJO6LMRT.mjs";
|
|
42
42
|
|
|
43
43
|
// src/deposit/index.tsx
|
|
44
44
|
import { useAggAuthState, useAggUiConfig, useDepositAddresses, useLabels as useLabels11 } from "@agg-build/hooks";
|
|
@@ -1873,8 +1873,30 @@ var WithdrawMethodStep = ({
|
|
|
1873
1873
|
};
|
|
1874
1874
|
|
|
1875
1875
|
// src/withdraw/steps/withdraw-amount.tsx
|
|
1876
|
-
import { useLabels as useLabels13,
|
|
1876
|
+
import { useLabels as useLabels13, useWithdrawPreview } from "@agg-build/hooks";
|
|
1877
1877
|
import { Fragment as Fragment8, jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1878
|
+
var formatRawTokenAmount = (rawAmount, decimals) => {
|
|
1879
|
+
if (!rawAmount) return "0";
|
|
1880
|
+
const raw = BigInt(rawAmount);
|
|
1881
|
+
const divisor = BigInt(`1${"0".repeat(decimals)}`);
|
|
1882
|
+
const whole = raw / divisor;
|
|
1883
|
+
const remainder = raw % divisor;
|
|
1884
|
+
if (remainder === BigInt(0)) return whole.toString();
|
|
1885
|
+
return `${whole.toString()}.${remainder.toString().padStart(decimals, "0").replace(/0+$/, "")}`;
|
|
1886
|
+
};
|
|
1887
|
+
var parseTokenAmountToRaw = (amount, decimals) => {
|
|
1888
|
+
const normalizedAmount = amount.trim();
|
|
1889
|
+
if (!normalizedAmount || !/^\d*(?:\.\d*)?$/.test(normalizedAmount)) return null;
|
|
1890
|
+
const [wholePart = "0", fractionalPart = ""] = normalizedAmount.split(".");
|
|
1891
|
+
if (fractionalPart.length > decimals) return null;
|
|
1892
|
+
const normalizedWhole = wholePart === "" ? "0" : wholePart;
|
|
1893
|
+
const normalizedFraction = fractionalPart.padEnd(decimals, "0");
|
|
1894
|
+
try {
|
|
1895
|
+
return `${BigInt(normalizedWhole)}${normalizedFraction}`.replace(/^0+(?=\d)/, "");
|
|
1896
|
+
} catch (e) {
|
|
1897
|
+
return null;
|
|
1898
|
+
}
|
|
1899
|
+
};
|
|
1878
1900
|
var WithdrawAmountStep = ({
|
|
1879
1901
|
amount,
|
|
1880
1902
|
destinationWallet,
|
|
@@ -1883,8 +1905,10 @@ var WithdrawAmountStep = ({
|
|
|
1883
1905
|
networkOptions,
|
|
1884
1906
|
selectedToken,
|
|
1885
1907
|
selectedNetwork,
|
|
1908
|
+
destDecimals,
|
|
1886
1909
|
isConfirming = false,
|
|
1887
1910
|
error,
|
|
1911
|
+
max = false,
|
|
1888
1912
|
onBack,
|
|
1889
1913
|
onAmountChange,
|
|
1890
1914
|
onDestinationChange,
|
|
@@ -1893,18 +1917,31 @@ var WithdrawAmountStep = ({
|
|
|
1893
1917
|
onMaxClick,
|
|
1894
1918
|
onContinue
|
|
1895
1919
|
}) => {
|
|
1920
|
+
var _a, _b, _c, _d;
|
|
1896
1921
|
const labels = useLabels13();
|
|
1897
1922
|
const SOLANA_CHAIN_ID = "792703809";
|
|
1898
1923
|
const isSolanaDest = selectedNetwork === SOLANA_CHAIN_ID;
|
|
1899
1924
|
const trimmedDestination = destinationWallet.trim();
|
|
1900
1925
|
const isValidAddress = isSolanaDest ? /^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(trimmedDestination) : /^0x[a-fA-F0-9]{40}$/.test(trimmedDestination);
|
|
1901
1926
|
const isValid = Number(amount) > 0 && isValidAddress;
|
|
1902
|
-
const
|
|
1903
|
-
const
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1927
|
+
const amountRaw = amount && Number(amount) > 0 ? parseTokenAmountToRaw(amount, destDecimals) : null;
|
|
1928
|
+
const destinationChainId = Number(selectedNetwork) || null;
|
|
1929
|
+
const preview = useWithdrawPreview({
|
|
1930
|
+
amountRaw,
|
|
1931
|
+
tokenSymbol: selectedToken || null,
|
|
1932
|
+
destinationChainId,
|
|
1933
|
+
destinationAddress: trimmedDestination || null,
|
|
1934
|
+
max
|
|
1907
1935
|
});
|
|
1936
|
+
const previewUnviable = ((_a = preview.data) == null ? void 0 : _a.pricingStatus) === "unviable";
|
|
1937
|
+
const previewUnviableMessage = previewUnviable ? ((_b = preview.data) == null ? void 0 : _b.maxDeliverableRaw) != null && BigInt(preview.data.maxDeliverableRaw) > BigInt(0) ? `Amount exceeds your withdrawable balance. Max: ~${formatRawTokenAmount(preview.data.maxDeliverableRaw, destDecimals)} ${selectedToken}` : (_d = (_c = preview.data) == null ? void 0 : _c.unviableReason) != null ? _d : "This amount can't be withdrawn right now." : null;
|
|
1938
|
+
const previewLoading = preview.isFetching;
|
|
1939
|
+
const isDisabled = !isValid || isConfirming || previewUnviable || previewLoading;
|
|
1940
|
+
const withdrawEstimate = preview.data && preview.data.pricingStatus === "quoted" ? {
|
|
1941
|
+
estimatedFees: preview.data.feeRaw != null ? `~${formatRawTokenAmount(preview.data.feeRaw, destDecimals)} ${selectedToken}` : "\u2014",
|
|
1942
|
+
networkReserve: preview.data.networkFeeRaw != null ? `~${formatRawTokenAmount(preview.data.networkFeeRaw, destDecimals)} ${selectedToken}` : "\u2014",
|
|
1943
|
+
youReceive: preview.data.receiveAmountRaw != null ? `~${formatRawTokenAmount(preview.data.receiveAmountRaw, destDecimals)} ${selectedToken}` : "\u2014"
|
|
1944
|
+
} : null;
|
|
1908
1945
|
const shouldShowWithdrawEstimate = Boolean(withdrawEstimate);
|
|
1909
1946
|
return /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
1910
1947
|
/* @__PURE__ */ jsx14(
|
|
@@ -2007,17 +2044,19 @@ var WithdrawAmountStep = ({
|
|
|
2007
2044
|
)
|
|
2008
2045
|
] })
|
|
2009
2046
|
] }),
|
|
2010
|
-
shouldShowWithdrawEstimate && withdrawEstimate ? /* @__PURE__ */ jsx14(TransferFeeSummary, { estimate: withdrawEstimate, view: "withdraw" }) : null
|
|
2047
|
+
shouldShowWithdrawEstimate && withdrawEstimate ? /* @__PURE__ */ jsx14(TransferFeeSummary, { estimate: withdrawEstimate, view: "withdraw" }) : null,
|
|
2048
|
+
previewUnviableMessage ? /* @__PURE__ */ jsx14("p", { className: "agg-type-label text-agg-error", role: "alert", children: previewUnviableMessage }) : null
|
|
2011
2049
|
] }),
|
|
2012
2050
|
/* @__PURE__ */ jsx14(
|
|
2013
2051
|
Button,
|
|
2014
2052
|
{
|
|
2015
|
-
variant: isValid && !isConfirming ? "primary" : "secondary",
|
|
2053
|
+
variant: isValid && !isConfirming && !previewUnviable && !previewLoading ? "primary" : "secondary",
|
|
2016
2054
|
size: "large",
|
|
2017
2055
|
className: "w-full",
|
|
2018
2056
|
disabled: isDisabled,
|
|
2057
|
+
prefix: previewLoading && !isConfirming ? /* @__PURE__ */ jsx14(LoadingIcon, { size: "small", className: "mr-2 text-current" }) : void 0,
|
|
2019
2058
|
onClick: onContinue,
|
|
2020
|
-
children: isConfirming ? labels.common.loading : labels.withdraw.walletFlow.confirm
|
|
2059
|
+
children: isConfirming ? labels.common.loading : previewLoading ? labels.withdraw.walletFlow.calculatingFees : labels.withdraw.walletFlow.confirm
|
|
2021
2060
|
}
|
|
2022
2061
|
),
|
|
2023
2062
|
error ? /* @__PURE__ */ jsx14("p", { className: "agg-type-label text-agg-error text-center", role: "alert", children: error }) : null
|
|
@@ -2247,7 +2286,7 @@ var getTokenDecimals = (tokenSymbol, chainId) => {
|
|
|
2247
2286
|
}
|
|
2248
2287
|
return (_a = TOKEN_DECIMALS_BY_SYMBOL[normalizedSymbol]) != null ? _a : DEFAULT_TOKEN_DECIMALS;
|
|
2249
2288
|
};
|
|
2250
|
-
var
|
|
2289
|
+
var formatRawTokenAmount2 = (rawAmount, decimals) => {
|
|
2251
2290
|
const raw = BigInt(rawAmount);
|
|
2252
2291
|
const divisor = BigInt(`1${"0".repeat(decimals)}`);
|
|
2253
2292
|
const whole = raw / divisor;
|
|
@@ -2259,11 +2298,12 @@ var formatLifecycleTokenAmount = ({
|
|
|
2259
2298
|
rawAmount,
|
|
2260
2299
|
tokenSymbol,
|
|
2261
2300
|
chainId
|
|
2262
|
-
}) => `${
|
|
2301
|
+
}) => `${formatRawTokenAmount2(rawAmount, getTokenDecimals(tokenSymbol, chainId))} ${tokenSymbol}`;
|
|
2263
2302
|
var buildTerminalSummary = ({
|
|
2264
2303
|
fallbackSummary,
|
|
2265
2304
|
lifecycleCompletedAmountRaw,
|
|
2266
2305
|
lifecycleRequestedAmountRaw,
|
|
2306
|
+
lifecycleFeeRaw,
|
|
2267
2307
|
tokenSymbol,
|
|
2268
2308
|
chainId
|
|
2269
2309
|
}) => {
|
|
@@ -2273,24 +2313,25 @@ var buildTerminalSummary = ({
|
|
|
2273
2313
|
tokenSymbol,
|
|
2274
2314
|
chainId
|
|
2275
2315
|
});
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
fees: formatLifecycleTokenAmount({
|
|
2286
|
-
rawAmount: feeRaw.toString(),
|
|
2287
|
-
tokenSymbol,
|
|
2288
|
-
chainId
|
|
2289
|
-
})
|
|
2290
|
-
});
|
|
2291
|
-
} catch (e) {
|
|
2292
|
-
return __spreadProps(__spreadValues({}, fallbackSummary), { amountReceived });
|
|
2316
|
+
let feeRaw = lifecycleFeeRaw;
|
|
2317
|
+
if (feeRaw == null && lifecycleRequestedAmountRaw) {
|
|
2318
|
+
try {
|
|
2319
|
+
const r = BigInt(lifecycleRequestedAmountRaw);
|
|
2320
|
+
const c = BigInt(lifecycleCompletedAmountRaw);
|
|
2321
|
+
feeRaw = (r > c ? r - c : BigInt(0)).toString();
|
|
2322
|
+
} catch (e) {
|
|
2323
|
+
feeRaw = null;
|
|
2324
|
+
}
|
|
2293
2325
|
}
|
|
2326
|
+
return __spreadValues(__spreadProps(__spreadValues({}, fallbackSummary), {
|
|
2327
|
+
amountReceived
|
|
2328
|
+
}), feeRaw != null ? {
|
|
2329
|
+
fees: formatLifecycleTokenAmount({
|
|
2330
|
+
rawAmount: feeRaw,
|
|
2331
|
+
tokenSymbol,
|
|
2332
|
+
chainId
|
|
2333
|
+
})
|
|
2334
|
+
} : {});
|
|
2294
2335
|
};
|
|
2295
2336
|
function isControlledWithdrawModalProps(props) {
|
|
2296
2337
|
return "withdrawFlow" in props;
|
|
@@ -2394,6 +2435,7 @@ function WithdrawModalControlled({
|
|
|
2394
2435
|
fallbackSummary: withdrawFlow.purchaseSummary,
|
|
2395
2436
|
lifecycleCompletedAmountRaw: withdrawalLifecycleState.completedAmountRaw,
|
|
2396
2437
|
lifecycleRequestedAmountRaw: withdrawalLifecycleState.requestedAmountRaw,
|
|
2438
|
+
lifecycleFeeRaw: withdrawalLifecycleState.feeRaw,
|
|
2397
2439
|
tokenSymbol: withdrawFlow.selectedToken,
|
|
2398
2440
|
chainId: withdrawFlow.selectedNetwork
|
|
2399
2441
|
});
|
|
@@ -2415,8 +2457,13 @@ function WithdrawModalControlled({
|
|
|
2415
2457
|
networkOptions: withdrawNetworkOptions,
|
|
2416
2458
|
selectedToken: withdrawFlow.selectedToken,
|
|
2417
2459
|
selectedNetwork: withdrawFlow.selectedNetwork,
|
|
2460
|
+
destDecimals: getTokenDecimals(
|
|
2461
|
+
withdrawFlow.selectedToken,
|
|
2462
|
+
withdrawFlow.selectedNetwork
|
|
2463
|
+
),
|
|
2418
2464
|
isConfirming,
|
|
2419
2465
|
error: confirmError,
|
|
2466
|
+
max: withdrawFlow.isMax,
|
|
2420
2467
|
onBack: handleBack,
|
|
2421
2468
|
onAmountChange: onWithdrawAmountChange,
|
|
2422
2469
|
onDestinationChange: onWithdrawDestinationChange,
|
|
@@ -3577,9 +3624,9 @@ var AccountsWalletsTab = ({
|
|
|
3577
3624
|
)
|
|
3578
3625
|
] })
|
|
3579
3626
|
] }),
|
|
3580
|
-
/* @__PURE__ */ jsxs24("div", { className: "agg-wallets-section flex flex-col gap-3", children: [
|
|
3627
|
+
wallets.length > 0 ? /* @__PURE__ */ jsxs24("div", { className: "agg-wallets-section flex flex-col gap-3", children: [
|
|
3581
3628
|
/* @__PURE__ */ jsx24(SectionTitle, { children: "Wallets" }),
|
|
3582
|
-
/* @__PURE__ */ jsx24("div", { className: "flex flex-col gap-2", children: wallets.
|
|
3629
|
+
/* @__PURE__ */ jsx24("div", { className: "flex flex-col gap-2", children: wallets.map((wallet) => {
|
|
3583
3630
|
var _a;
|
|
3584
3631
|
return /* @__PURE__ */ jsx24(AccountRow, { className: "gap-4", children: /* @__PURE__ */ jsxs24("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
3585
3632
|
/* @__PURE__ */ jsx24(
|
|
@@ -3592,8 +3639,8 @@ var AccountsWalletsTab = ({
|
|
|
3592
3639
|
),
|
|
3593
3640
|
/* @__PURE__ */ jsx24(VerifiedBadge, {})
|
|
3594
3641
|
] }) }, `${wallet.chain}:${wallet.address}`);
|
|
3595
|
-
})
|
|
3596
|
-
] })
|
|
3642
|
+
}) })
|
|
3643
|
+
] }) : null
|
|
3597
3644
|
] });
|
|
3598
3645
|
};
|
|
3599
3646
|
AccountsWalletsTab.displayName = "AccountsWalletsTab";
|
|
@@ -4016,15 +4063,22 @@ var ProfileModal = ({
|
|
|
4016
4063
|
const resolvedWallets = useMemo3(() => {
|
|
4017
4064
|
var _a2, _b2;
|
|
4018
4065
|
if (wallets) return wallets;
|
|
4019
|
-
|
|
4066
|
+
const walletAccounts = (_b2 = (_a2 = user == null ? void 0 : user.accounts) == null ? void 0 : _a2.filter((account) => {
|
|
4020
4067
|
var _a3;
|
|
4068
|
+
const provider = (_a3 = account.provider) == null ? void 0 : _a3.toLowerCase();
|
|
4069
|
+
return provider === "wallet" || provider === "solana_wallet";
|
|
4070
|
+
})) != null ? _b2 : [];
|
|
4071
|
+
return walletAccounts.filter((account) => Boolean(account.providerAccountId)).map((account) => {
|
|
4072
|
+
var _a3, _b3;
|
|
4073
|
+
const chain = ((_a3 = account.provider) == null ? void 0 : _a3.toLowerCase()) === "solana_wallet" ? "solana" : "evm";
|
|
4074
|
+
const address = account.providerAccountId;
|
|
4021
4075
|
return {
|
|
4022
|
-
chain
|
|
4023
|
-
address
|
|
4024
|
-
displayAddress: (
|
|
4076
|
+
chain,
|
|
4077
|
+
address,
|
|
4078
|
+
displayAddress: (_b3 = shortenAddress(address, { chain })) != null ? _b3 : address
|
|
4025
4079
|
};
|
|
4026
|
-
})
|
|
4027
|
-
}, [user == null ? void 0 : user.
|
|
4080
|
+
});
|
|
4081
|
+
}, [user == null ? void 0 : user.accounts, wallets]);
|
|
4028
4082
|
return /* @__PURE__ */ jsx26(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs26(
|
|
4029
4083
|
Modal.Container,
|
|
4030
4084
|
{
|
|
@@ -4227,6 +4281,7 @@ export {
|
|
|
4227
4281
|
clearPendingCardSession,
|
|
4228
4282
|
getPendingCardSession,
|
|
4229
4283
|
DepositModal,
|
|
4284
|
+
buildTerminalSummary,
|
|
4230
4285
|
WithdrawModal,
|
|
4231
4286
|
HowItWorksStep,
|
|
4232
4287
|
ProfileSetupStep,
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
getTradingValueLabel,
|
|
9
9
|
getTradingVenueLabel,
|
|
10
10
|
resolveOrderEligibilityMessage
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-TERG43WW.mjs";
|
|
12
12
|
import {
|
|
13
13
|
GeoBlockBanner
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-RPXRTXCY.mjs";
|
|
15
15
|
import {
|
|
16
16
|
AGG_TERMS_OF_SERVICE_URL,
|
|
17
17
|
Button,
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
formatUsd,
|
|
39
39
|
getMotionClassName,
|
|
40
40
|
skeletonViews
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-YJO6LMRT.mjs";
|
|
42
42
|
|
|
43
43
|
// src/trading/types.ts
|
|
44
44
|
import { Venue, enumGuard, isFiniteNonNeg, safeParse } from "@agg-build/sdk";
|
|
@@ -2798,7 +2798,7 @@ var PlaceOrder = ({
|
|
|
2798
2798
|
className,
|
|
2799
2799
|
classNames,
|
|
2800
2800
|
eventTradingState,
|
|
2801
|
-
executionMode
|
|
2801
|
+
executionMode,
|
|
2802
2802
|
isLoading = false,
|
|
2803
2803
|
isPrimaryActionDisabled = false,
|
|
2804
2804
|
isPrimaryActionLoading = false,
|
|
@@ -2818,7 +2818,8 @@ var PlaceOrder = ({
|
|
|
2818
2818
|
const {
|
|
2819
2819
|
enableDebug: isExecutionDebugEnabled,
|
|
2820
2820
|
features: { enableAnimations, showFeesBreakdown },
|
|
2821
|
-
general: { locale }
|
|
2821
|
+
general: { locale },
|
|
2822
|
+
trading: { executionMode: configuredExecutionMode = "live" } = { executionMode: "live" }
|
|
2822
2823
|
} = useSdkUiConfig();
|
|
2823
2824
|
const labels = useLabels();
|
|
2824
2825
|
const tradingLabels = labels.trading;
|
|
@@ -2883,7 +2884,8 @@ var PlaceOrder = ({
|
|
|
2883
2884
|
);
|
|
2884
2885
|
const isResolvedOutcomeCtaLocked = resolvedEventTradingState.kind === "resolved" || resolvedTradingState.kind === "resolved";
|
|
2885
2886
|
const { isAuthenticated, user } = useAggAuthContext();
|
|
2886
|
-
const
|
|
2887
|
+
const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
|
|
2888
|
+
const isPaperMode = resolvedExecutionMode === "paper";
|
|
2887
2889
|
const liveBalanceState = useAggBalanceState();
|
|
2888
2890
|
const paperBalancesQuery = useManagedBalances({
|
|
2889
2891
|
enabled: Boolean(isAuthenticated && isPaperMode),
|
|
@@ -3396,6 +3398,7 @@ var PlaceOrder = ({
|
|
|
3396
3398
|
const visibleRouteCards = orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT && !isRoutesExpanded ? orderedRouteCards.slice(0, PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT) : orderedRouteCards;
|
|
3397
3399
|
const hasEnteredAmount = internalAmount > 0;
|
|
3398
3400
|
const isQuoteLoading = hasEnteredAmount && (smartRoute.isFetching || smartRoute.isLoading);
|
|
3401
|
+
const routeLoadingMessage = isQuoteLoading ? smartRoute.loadingReason === "updating-route" ? tradingLabels.updatingRoute : smartRoute.loadingReason === "refreshing-quotes" ? tradingLabels.refreshingQuotes : tradingLabels.findingBestOdds : null;
|
|
3399
3402
|
const isInsufficientBalance = !isSell && isAuthenticated && hasEnteredAmount && !isBalanceLoading && internalAmount > totalBalance;
|
|
3400
3403
|
const isQuoteInsufficientBalance = (activeQuoteData == null ? void 0 : activeQuoteData.status) === "insufficient_balance";
|
|
3401
3404
|
const shouldShowInsufficientBalanceAlert = isInsufficientBalance || isQuoteInsufficientBalance;
|
|
@@ -3545,7 +3548,7 @@ var PlaceOrder = ({
|
|
|
3545
3548
|
const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked;
|
|
3546
3549
|
const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
|
|
3547
3550
|
const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isQuoteInsufficientBalance || isBelowMinimum || isQuoteLoading || !selectedRouteCard || !selectedRouteCard.quoteData.quoteId || selectedRouteGeoBlocked || !isAuthenticated || quoteStatus !== void 0;
|
|
3548
|
-
const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (orderedRouteCards.length > 0 || smartRoute.isFetching);
|
|
3551
|
+
const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (orderedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading);
|
|
3549
3552
|
const shouldShowRouteToggle = !isQuoteLoading && orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
|
|
3550
3553
|
const handleReturnToOrderForm = useCallback2(() => {
|
|
3551
3554
|
const submittedSelection = submittedSelectionRef.current;
|
|
@@ -4176,19 +4179,10 @@ var PlaceOrder = ({
|
|
|
4176
4179
|
}
|
|
4177
4180
|
) : null
|
|
4178
4181
|
] }),
|
|
4179
|
-
/* @__PURE__ */ jsx4("div", { className: "agg-route-list flex flex-col gap-2", children: isQuoteLoading ? /* @__PURE__ */ jsxs3(
|
|
4180
|
-
|
|
4181
|
-
{
|
|
4182
|
-
|
|
4183
|
-
role: "status",
|
|
4184
|
-
"aria-label": labels.common.loading,
|
|
4185
|
-
"aria-live": "polite",
|
|
4186
|
-
children: [
|
|
4187
|
-
/* @__PURE__ */ jsx4(PlaceOrderRouteCardSkeleton, {}),
|
|
4188
|
-
/* @__PURE__ */ jsx4(PlaceOrderRouteCardSkeleton, {})
|
|
4189
|
-
]
|
|
4190
|
-
}
|
|
4191
|
-
) : visibleRouteCards.length > 0 ? visibleRouteCards.map((card) => {
|
|
4182
|
+
/* @__PURE__ */ jsx4("div", { className: "agg-route-list flex flex-col gap-2", children: isQuoteLoading ? /* @__PURE__ */ jsxs3("div", { className: "agg-route-loading flex flex-col gap-2", "aria-hidden": "true", children: [
|
|
4183
|
+
/* @__PURE__ */ jsx4(PlaceOrderRouteCardSkeleton, {}),
|
|
4184
|
+
/* @__PURE__ */ jsx4(PlaceOrderRouteCardSkeleton, {})
|
|
4185
|
+
] }) : visibleRouteCards.length > 0 ? visibleRouteCards.map((card) => {
|
|
4192
4186
|
return /* @__PURE__ */ jsx4(Fragment, { children: renderRouteCard({
|
|
4193
4187
|
card,
|
|
4194
4188
|
enableAnimations,
|
|
@@ -4279,7 +4273,28 @@ var PlaceOrder = ({
|
|
|
4279
4273
|
onClick: handleDepositRequiredClick,
|
|
4280
4274
|
children: tradingLabels.deposit
|
|
4281
4275
|
}
|
|
4282
|
-
) : needsKycVerification && !submissionFeedback && !shouldShowGeoBlockBanner ? /* @__PURE__ */ jsx4(InitiateKycButton, { label: tradingLabels.kycRequired, onOpen: openVerifyModal }) : !
|
|
4276
|
+
) : needsKycVerification && !submissionFeedback && !shouldShowGeoBlockBanner ? /* @__PURE__ */ jsx4(InitiateKycButton, { label: tradingLabels.kycRequired, onOpen: openVerifyModal }) : isQuoteLoading && !isActionLoading ? /* @__PURE__ */ jsx4(
|
|
4277
|
+
Button,
|
|
4278
|
+
{
|
|
4279
|
+
size: "large",
|
|
4280
|
+
variant: "secondary",
|
|
4281
|
+
className: "agg-order-submit-loading h-12 w-full px-8 text-agg-base leading-agg-6 shadow-none",
|
|
4282
|
+
disabled: true,
|
|
4283
|
+
"aria-live": "polite",
|
|
4284
|
+
"aria-label": routeLoadingMessage != null ? routeLoadingMessage : labels.common.loading,
|
|
4285
|
+
prefix: /* @__PURE__ */ jsx4(
|
|
4286
|
+
"span",
|
|
4287
|
+
{
|
|
4288
|
+
className: cn(
|
|
4289
|
+
"inline-block h-4 w-4 shrink-0 rounded-agg-full border-2 border-current border-r-transparent",
|
|
4290
|
+
getMotionClassName(enableAnimations, "animate-spin")
|
|
4291
|
+
),
|
|
4292
|
+
"aria-hidden": "true"
|
|
4293
|
+
}
|
|
4294
|
+
),
|
|
4295
|
+
children: routeLoadingMessage
|
|
4296
|
+
}
|
|
4297
|
+
) : !isAuthenticated ? /* @__PURE__ */ jsx4(
|
|
4283
4298
|
Button,
|
|
4284
4299
|
{
|
|
4285
4300
|
size: "large",
|