@agg-build/ui 4.17.0 → 4.17.3
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-D2BTU7QI.mjs → chunk-7E4UXCEX.mjs} +223 -169
- package/dist/{chunk-QGONLJLE.mjs → chunk-B5ALKYD5.mjs} +210 -184
- package/dist/{chunk-RR44PSKH.mjs → chunk-BBDFSTIA.mjs} +3 -1
- package/dist/{chunk-M6U2RKBD.mjs → chunk-DSQSQ4RG.mjs} +127 -62
- package/dist/{chunk-5SCDQSNA.mjs → chunk-JI5KV4QI.mjs} +2 -2
- package/dist/{chunk-NIRCF54M.mjs → chunk-RZLM3M5R.mjs} +2 -2
- package/dist/{chunk-HFMKCV4L.mjs → chunk-TK62UB5F.mjs} +27 -16
- package/dist/events.js +29 -16
- package/dist/events.mjs +3 -3
- package/dist/index.js +1060 -930
- package/dist/index.mjs +9 -38
- package/dist/modals.js +212 -184
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +841 -684
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +3 -1
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +535 -442
- package/dist/trading.mjs +4 -4
- package/dist/types/auth/connect-button-view/connect-button-view.types.d.mts +0 -2
- package/dist/types/auth/connect-button-view/connect-button-view.types.d.ts +0 -2
- package/dist/types/auth/connect-button-view/index.d.mts +1 -1
- package/dist/types/auth/connect-button-view/index.d.ts +1 -1
- package/dist/types/pages/user-profile/components/available-balance-card.d.mts +3 -1
- package/dist/types/pages/user-profile/components/available-balance-card.d.ts +3 -1
- package/dist/types/pages/user-profile/cost-basis-display.d.mts +29 -0
- package/dist/types/pages/user-profile/cost-basis-display.d.ts +29 -0
- package/dist/types/pages/user-profile/user-profile.types.d.mts +8 -0
- package/dist/types/pages/user-profile/user-profile.types.d.ts +8 -0
- package/dist/types/primitives/modal/index.d.mts +1 -1
- package/dist/types/primitives/modal/index.d.ts +1 -1
- package/dist/types/primitives/modal/modal.types.d.mts +6 -0
- package/dist/types/primitives/modal/modal.types.d.ts +6 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +12 -1
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +12 -1
- package/package.json +3 -3
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
getTradingVenueLabel,
|
|
10
10
|
prepareSettlementDifferences,
|
|
11
11
|
resolveOrderEligibilityMessage
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-TK62UB5F.mjs";
|
|
13
13
|
import {
|
|
14
14
|
ConnectKalshiModal,
|
|
15
15
|
GeoBlockBanner,
|
|
16
16
|
SharedKycModal,
|
|
17
17
|
subscribeAggDepositNotification
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-B5ALKYD5.mjs";
|
|
19
19
|
import {
|
|
20
20
|
AGG_TERMS_OF_SERVICE_URL,
|
|
21
21
|
Button,
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
resolveResolvedOutcomeLabel,
|
|
49
49
|
skeletonViews,
|
|
50
50
|
useOptionalToast
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-BBDFSTIA.mjs";
|
|
52
52
|
|
|
53
53
|
// src/trading/types.ts
|
|
54
54
|
import { Venue, enumGuard, isFiniteNonNeg, safeParse } from "@agg-build/sdk";
|
|
@@ -172,7 +172,7 @@ import * as Popover from "@radix-ui/react-popover";
|
|
|
172
172
|
import dayjs from "dayjs";
|
|
173
173
|
import timezone from "dayjs/plugin/timezone";
|
|
174
174
|
import utc from "dayjs/plugin/utc";
|
|
175
|
-
import { Fragment as Fragment2, useCallback as useCallback3, useEffect as
|
|
175
|
+
import { Fragment as Fragment2, useCallback as useCallback3, useEffect as useEffect4, useId, useMemo, useRef as useRef4, useState as useState3 } from "react";
|
|
176
176
|
|
|
177
177
|
// src/kyc/shared-kyc.ts
|
|
178
178
|
import { Venue as Venue2 } from "@agg-build/sdk";
|
|
@@ -1128,14 +1128,10 @@ var routePriceLabelFormatter = new Intl.NumberFormat("en-US", {
|
|
|
1128
1128
|
minimumFractionDigits: 0,
|
|
1129
1129
|
maximumFractionDigits: 1
|
|
1130
1130
|
});
|
|
1131
|
-
var PLACE_ORDER_PRICE_DISPLAY_MULTIPLIER = 1e3;
|
|
1132
1131
|
var GEO_BLOCK_WARNING_PREFIX = "Venue not available in your region";
|
|
1133
1132
|
var isFiniteNonNegativePrice = (value) => {
|
|
1134
1133
|
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
1135
1134
|
};
|
|
1136
|
-
var isPredictionMarketPrice = (value) => {
|
|
1137
|
-
return isFiniteNonNegativePrice(value) && value <= 1;
|
|
1138
|
-
};
|
|
1139
1135
|
var getPlaceOrderAverageExecutionPrice = (quoteData) => {
|
|
1140
1136
|
var _a;
|
|
1141
1137
|
if (!quoteData || quoteData.totalFilled <= 0) return null;
|
|
@@ -1146,22 +1142,6 @@ var getPlaceOrderAverageExecutionPrice = (quoteData) => {
|
|
|
1146
1142
|
const averageExecutionPrice = quoteData.rawExecCost / quoteData.totalFilled;
|
|
1147
1143
|
return isFiniteNonNegativePrice(averageExecutionPrice) ? averageExecutionPrice : null;
|
|
1148
1144
|
};
|
|
1149
|
-
var isPlaceOrderAveragePriceWorse = ({
|
|
1150
|
-
averageExecutionPrice,
|
|
1151
|
-
displayedMarketPrice,
|
|
1152
|
-
tradeSide
|
|
1153
|
-
}) => {
|
|
1154
|
-
if (!isPredictionMarketPrice(averageExecutionPrice) || !isPredictionMarketPrice(displayedMarketPrice)) {
|
|
1155
|
-
return false;
|
|
1156
|
-
}
|
|
1157
|
-
const displayedAveragePrice = Math.round(
|
|
1158
|
-
averageExecutionPrice * PLACE_ORDER_PRICE_DISPLAY_MULTIPLIER
|
|
1159
|
-
);
|
|
1160
|
-
const displayedReferencePrice = Math.round(
|
|
1161
|
-
displayedMarketPrice * PLACE_ORDER_PRICE_DISPLAY_MULTIPLIER
|
|
1162
|
-
);
|
|
1163
|
-
return tradeSide === "buy" ? displayedAveragePrice > displayedReferencePrice : displayedAveragePrice < displayedReferencePrice;
|
|
1164
|
-
};
|
|
1165
1145
|
var floorToDecimals = (value, decimals) => {
|
|
1166
1146
|
if (!Number.isFinite(value) || value <= 0) return 0;
|
|
1167
1147
|
const [coefficient = "0", exponentText = "0"] = value.toString().toLowerCase().split("e");
|
|
@@ -1772,16 +1752,21 @@ var buildLiveRouteCards = ({
|
|
|
1772
1752
|
})() : [];
|
|
1773
1753
|
return [...baseCards, ...unavailableCards, ...warningOnlyUnavailableCards];
|
|
1774
1754
|
};
|
|
1775
|
-
var
|
|
1776
|
-
|
|
1755
|
+
var routeCardRequiresKalshi = (card) => card.venue === "kalshi" || card.quoteData.fills.some((fill) => fill.venue === "kalshi");
|
|
1756
|
+
var resolveDefaultRouteCardId = (routeCards, primaryStatus, options) => {
|
|
1757
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1777
1758
|
if (routeCards.length === 0) return null;
|
|
1778
|
-
const
|
|
1779
|
-
|
|
1780
|
-
|
|
1759
|
+
const isExecutableCard = (card) => !card.isUnavailable && card.quoteData.status === "ok" && !!card.quoteData.quoteId;
|
|
1760
|
+
if (options == null ? void 0 : options.isKalshiDisconnected) {
|
|
1761
|
+
const nonKalshiCards = routeCards.filter((card) => !routeCardRequiresKalshi(card));
|
|
1762
|
+
const preferredCard = (_a = nonKalshiCards.find(isExecutableCard)) != null ? _a : nonKalshiCards.find((card) => !card.isUnavailable);
|
|
1763
|
+
if (preferredCard) return preferredCard.id;
|
|
1764
|
+
}
|
|
1765
|
+
const firstExecutableCard = routeCards.find(isExecutableCard);
|
|
1781
1766
|
if (primaryStatus === "insufficient_balance") {
|
|
1782
1767
|
if (firstExecutableCard) return firstExecutableCard.id;
|
|
1783
1768
|
}
|
|
1784
|
-
return (
|
|
1769
|
+
return (_f = (_e = (_c = firstExecutableCard == null ? void 0 : firstExecutableCard.id) != null ? _c : (_b = routeCards.find((card) => !card.isUnavailable)) == null ? void 0 : _b.id) != null ? _e : (_d = routeCards[0]) == null ? void 0 : _d.id) != null ? _f : null;
|
|
1785
1770
|
};
|
|
1786
1771
|
var getPlaceOrderRouteCardIdentity = (card) => {
|
|
1787
1772
|
var _a;
|
|
@@ -2987,9 +2972,9 @@ var deriveBackendExecutionOrderGroups = ({
|
|
|
2987
2972
|
return [__spreadProps(__spreadValues({ id: order.orderId }, presentation), { steps })];
|
|
2988
2973
|
});
|
|
2989
2974
|
const allOrdersTerminal = executionOrders.every((order) => order.event !== null);
|
|
2990
|
-
return deriveSequentialDisplayGroups(realGroups, allOrdersTerminal);
|
|
2975
|
+
return deriveSequentialDisplayGroups(realGroups, allOrdersTerminal, "per-leg");
|
|
2991
2976
|
};
|
|
2992
|
-
var deriveSequentialDisplayGroups = (groups, revealTerminalOutcomes = false) => {
|
|
2977
|
+
var deriveSequentialDisplayGroups = (groups, revealTerminalOutcomes = false, scope = "global") => {
|
|
2993
2978
|
if (revealTerminalOutcomes) {
|
|
2994
2979
|
return groups.map((group) => __spreadProps(__spreadValues({}, group), {
|
|
2995
2980
|
steps: group.steps.map((_a) => {
|
|
@@ -2999,19 +2984,22 @@ var deriveSequentialDisplayGroups = (groups, revealTerminalOutcomes = false) =>
|
|
|
2999
2984
|
}));
|
|
3000
2985
|
}
|
|
3001
2986
|
let hasUnresolvedPredecessor = false;
|
|
3002
|
-
return groups.map((group) =>
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
2987
|
+
return groups.map((group) => {
|
|
2988
|
+
if (scope === "per-leg") hasUnresolvedPredecessor = false;
|
|
2989
|
+
return __spreadProps(__spreadValues({}, group), {
|
|
2990
|
+
steps: group.steps.map((_a) => {
|
|
2991
|
+
var _b = _a, { realStatus } = _b, step = __objRest(_b, ["realStatus"]);
|
|
2992
|
+
if (hasUnresolvedPredecessor) {
|
|
2993
|
+
return __spreadProps(__spreadValues({}, step), { status: "not-started" });
|
|
2994
|
+
}
|
|
2995
|
+
if (realStatus === "done") {
|
|
2996
|
+
return __spreadProps(__spreadValues({}, step), { status: "done" });
|
|
2997
|
+
}
|
|
2998
|
+
hasUnresolvedPredecessor = true;
|
|
2999
|
+
return __spreadProps(__spreadValues({}, step), { status: realStatus });
|
|
3000
|
+
})
|
|
3001
|
+
});
|
|
3002
|
+
});
|
|
3015
3003
|
};
|
|
3016
3004
|
var deriveExecutionOrderGroups = ({
|
|
3017
3005
|
quoteData,
|
|
@@ -3232,6 +3220,7 @@ var calculateExecutionProgress = ({
|
|
|
3232
3220
|
};
|
|
3233
3221
|
|
|
3234
3222
|
// src/trading/place-order/index.place-order.execution-view.tsx
|
|
3223
|
+
import { useEffect as useEffect3, useRef as useRef3, useState as useState2 } from "react";
|
|
3235
3224
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
3236
3225
|
var PlaceOrderExecutionHeader = ({
|
|
3237
3226
|
className,
|
|
@@ -3254,6 +3243,85 @@ var PlaceOrderExecutionHeader = ({
|
|
|
3254
3243
|
eventDateLabel ? /* @__PURE__ */ jsx4("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: eventDateLabel }) : null
|
|
3255
3244
|
] });
|
|
3256
3245
|
};
|
|
3246
|
+
var PROGRESS_TWEEN_MS = 700;
|
|
3247
|
+
var prefersReducedMotion = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
3248
|
+
var useTweenedProgress = (target, enabled) => {
|
|
3249
|
+
const [value, setValue] = useState2(target);
|
|
3250
|
+
const valueRef = useRef3(target);
|
|
3251
|
+
useEffect3(() => {
|
|
3252
|
+
const from = valueRef.current;
|
|
3253
|
+
if (!enabled || from === target || prefersReducedMotion()) {
|
|
3254
|
+
valueRef.current = target;
|
|
3255
|
+
setValue(target);
|
|
3256
|
+
return;
|
|
3257
|
+
}
|
|
3258
|
+
let frame = 0;
|
|
3259
|
+
const start = performance.now();
|
|
3260
|
+
const tick = (now) => {
|
|
3261
|
+
const t = Math.min(1, (now - start) / PROGRESS_TWEEN_MS);
|
|
3262
|
+
const eased = 1 - Math.pow(1 - t, 3);
|
|
3263
|
+
const next = Math.round(from + (target - from) * eased);
|
|
3264
|
+
valueRef.current = next;
|
|
3265
|
+
setValue(next);
|
|
3266
|
+
if (t < 1) frame = requestAnimationFrame(tick);
|
|
3267
|
+
};
|
|
3268
|
+
frame = requestAnimationFrame(tick);
|
|
3269
|
+
return () => cancelAnimationFrame(frame);
|
|
3270
|
+
}, [enabled, target]);
|
|
3271
|
+
return value;
|
|
3272
|
+
};
|
|
3273
|
+
var ExecutionProgressBar = ({
|
|
3274
|
+
enableAnimations,
|
|
3275
|
+
label,
|
|
3276
|
+
progress
|
|
3277
|
+
}) => {
|
|
3278
|
+
const clamped = Math.max(0, Math.min(100, progress));
|
|
3279
|
+
const displayed = useTweenedProgress(clamped, enableAnimations);
|
|
3280
|
+
const isRunning = clamped < 100;
|
|
3281
|
+
return /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3", children: [
|
|
3282
|
+
/* @__PURE__ */ jsxs3("p", { className: "shrink-0 tabular-nums text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
|
|
3283
|
+
displayed,
|
|
3284
|
+
"%"
|
|
3285
|
+
] }),
|
|
3286
|
+
/* @__PURE__ */ jsx4(
|
|
3287
|
+
"div",
|
|
3288
|
+
{
|
|
3289
|
+
role: "progressbar",
|
|
3290
|
+
"aria-label": label,
|
|
3291
|
+
"aria-valuemin": 0,
|
|
3292
|
+
"aria-valuemax": 100,
|
|
3293
|
+
"aria-valuenow": clamped,
|
|
3294
|
+
className: "relative h-1 min-w-0 flex-1 overflow-hidden rounded-agg-full bg-agg-separator",
|
|
3295
|
+
children: /* @__PURE__ */ jsx4(
|
|
3296
|
+
"div",
|
|
3297
|
+
{
|
|
3298
|
+
className: cn(
|
|
3299
|
+
"absolute inset-y-0 left-0 overflow-hidden rounded-agg-full bg-agg-primary",
|
|
3300
|
+
getMotionClassName(
|
|
3301
|
+
enableAnimations,
|
|
3302
|
+
"transition-[width] duration-700 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none"
|
|
3303
|
+
)
|
|
3304
|
+
),
|
|
3305
|
+
style: { width: `${clamped}%` },
|
|
3306
|
+
children: isRunning ? /* @__PURE__ */ jsx4(
|
|
3307
|
+
"span",
|
|
3308
|
+
{
|
|
3309
|
+
"aria-hidden": "true",
|
|
3310
|
+
className: cn(
|
|
3311
|
+
"absolute inset-0 hidden bg-gradient-to-r from-transparent via-white/40 to-transparent",
|
|
3312
|
+
getMotionClassName(
|
|
3313
|
+
enableAnimations,
|
|
3314
|
+
"motion-safe:block motion-safe:animate-agg-progress-shimmer"
|
|
3315
|
+
)
|
|
3316
|
+
)
|
|
3317
|
+
}
|
|
3318
|
+
) : null
|
|
3319
|
+
}
|
|
3320
|
+
)
|
|
3321
|
+
}
|
|
3322
|
+
)
|
|
3323
|
+
] });
|
|
3324
|
+
};
|
|
3257
3325
|
var ExecutionStepIndicator = ({
|
|
3258
3326
|
enableAnimations,
|
|
3259
3327
|
step
|
|
@@ -3389,21 +3457,14 @@ var PlaceOrderExecutionView = ({
|
|
|
3389
3457
|
}
|
|
3390
3458
|
),
|
|
3391
3459
|
/* @__PURE__ */ jsxs3("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.content), children: [
|
|
3392
|
-
/* @__PURE__ */
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
"aria-label": labels.executingOrder,
|
|
3401
|
-
className: "h-1 min-w-0 flex-1 overflow-hidden rounded-agg-full bg-agg-separator text-agg-primary accent-agg-primary [&::-moz-progress-bar]:bg-agg-primary [&::-webkit-progress-bar]:bg-agg-separator [&::-webkit-progress-value]:bg-agg-primary",
|
|
3402
|
-
max: 100,
|
|
3403
|
-
value: progress
|
|
3404
|
-
}
|
|
3405
|
-
)
|
|
3406
|
-
] }),
|
|
3460
|
+
/* @__PURE__ */ jsx4(
|
|
3461
|
+
ExecutionProgressBar,
|
|
3462
|
+
{
|
|
3463
|
+
enableAnimations,
|
|
3464
|
+
label: labels.executingOrder,
|
|
3465
|
+
progress
|
|
3466
|
+
}
|
|
3467
|
+
),
|
|
3407
3468
|
/* @__PURE__ */ jsx4(
|
|
3408
3469
|
PlaceOrderExecutionGroups,
|
|
3409
3470
|
{
|
|
@@ -3651,7 +3712,7 @@ var PlaceOrderSuccessView = ({
|
|
|
3651
3712
|
/* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between gap-4", children: [
|
|
3652
3713
|
/* @__PURE__ */ jsxs5("div", { className: "flex min-w-0 flex-col gap-0.5", children: [
|
|
3653
3714
|
/* @__PURE__ */ jsx6("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.orderPayout }),
|
|
3654
|
-
potentialReturnLabel ? /* @__PURE__ */ jsx6("span", { className: "
|
|
3715
|
+
potentialReturnLabel ? /* @__PURE__ */ jsx6("span", { className: "agg-type-overline agg-text-brand", children: potentialReturnLabel }) : null
|
|
3655
3716
|
] }),
|
|
3656
3717
|
/* @__PURE__ */ jsx6("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-success", children: resolvedPayoutLabel })
|
|
3657
3718
|
] })
|
|
@@ -3793,24 +3854,24 @@ var PlaceOrderSlippageControl = ({
|
|
|
3793
3854
|
}) => {
|
|
3794
3855
|
var _a, _b;
|
|
3795
3856
|
const labels = useLabels2();
|
|
3796
|
-
const containerRef =
|
|
3797
|
-
const triggerRef =
|
|
3798
|
-
const inputRef =
|
|
3857
|
+
const containerRef = useRef4(null);
|
|
3858
|
+
const triggerRef = useRef4(null);
|
|
3859
|
+
const inputRef = useRef4(null);
|
|
3799
3860
|
const warningId = useId();
|
|
3800
3861
|
const defaultValue = finalizePercentageValue(slippageDefaultValue);
|
|
3801
3862
|
const committedValue = finalizePercentageValue(slippageValue) || defaultValue;
|
|
3802
|
-
const [draftValue, setDraftValue] =
|
|
3803
|
-
const [isEditing, setIsEditing] =
|
|
3863
|
+
const [draftValue, setDraftValue] = useState3(committedValue);
|
|
3864
|
+
const [isEditing, setIsEditing] = useState3(
|
|
3804
3865
|
() => isPercentageBelowMinimum(committedValue, slippageMinimumValue)
|
|
3805
3866
|
);
|
|
3806
|
-
const [shouldFocusInput, setShouldFocusInput] =
|
|
3807
|
-
|
|
3867
|
+
const [shouldFocusInput, setShouldFocusInput] = useState3(false);
|
|
3868
|
+
useEffect4(() => {
|
|
3808
3869
|
setDraftValue(committedValue);
|
|
3809
3870
|
if (isPercentageBelowMinimum(committedValue, slippageMinimumValue)) {
|
|
3810
3871
|
setIsEditing(true);
|
|
3811
3872
|
}
|
|
3812
3873
|
}, [committedValue, slippageMinimumValue]);
|
|
3813
|
-
|
|
3874
|
+
useEffect4(() => {
|
|
3814
3875
|
if (!shouldFocusInput) return;
|
|
3815
3876
|
requestAnimationFrame(() => {
|
|
3816
3877
|
var _a2, _b2;
|
|
@@ -4234,13 +4295,15 @@ var renderRouteCard = ({
|
|
|
4234
4295
|
isExpanded,
|
|
4235
4296
|
isSelected,
|
|
4236
4297
|
onSelect,
|
|
4298
|
+
isKalshiDisconnected = false,
|
|
4237
4299
|
sharedKycStatus,
|
|
4238
4300
|
tradingLabels
|
|
4239
4301
|
}) => {
|
|
4240
4302
|
var _a, _b, _c;
|
|
4241
4303
|
const showSharedKycRequirement = card.requiresSharedKyc === true && sharedKycStatus !== void 0 && sharedKycStatus !== "verified" && !card.isUnavailable;
|
|
4304
|
+
const showKalshiRequirement = isKalshiDisconnected && card.kind === "venue" && card.venue === "kalshi" && !isSelected && !card.isUnavailable;
|
|
4242
4305
|
const showSplitDetails = isSelected && isExpanded && card.kind === "split" && !!((_a = card.rows) == null ? void 0 : _a.length);
|
|
4243
|
-
const displayedHint = showSharedKycRequirement ? tradingLabels.sharedKyc.required : card.hint;
|
|
4306
|
+
const displayedHint = showKalshiRequirement ? tradingLabels.requiresKalshiAccount : showSharedKycRequirement ? tradingLabels.sharedKyc.required : card.hint;
|
|
4244
4307
|
const ariaLabel = [card.label, displayedHint, card.value].filter(Boolean).join(" ");
|
|
4245
4308
|
return /* @__PURE__ */ jsx7(
|
|
4246
4309
|
"button",
|
|
@@ -4294,7 +4357,7 @@ var renderRouteCard = ({
|
|
|
4294
4357
|
className: "shrink-0 text-agg-muted-foreground",
|
|
4295
4358
|
"aria-hidden": "true"
|
|
4296
4359
|
}
|
|
4297
|
-
) : showSharedKycRequirement || card.insufficientInventory ? /* @__PURE__ */ jsx7(
|
|
4360
|
+
) : showKalshiRequirement || showSharedKycRequirement || card.insufficientInventory ? /* @__PURE__ */ jsx7(
|
|
4298
4361
|
Icon,
|
|
4299
4362
|
{
|
|
4300
4363
|
name: "warning",
|
|
@@ -4471,8 +4534,8 @@ var PlaceOrder = ({
|
|
|
4471
4534
|
Venue4.kalshi,
|
|
4472
4535
|
isAuthenticated
|
|
4473
4536
|
);
|
|
4474
|
-
const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] =
|
|
4475
|
-
const [isFundKalshiModalOpen, setIsFundKalshiModalOpen] =
|
|
4537
|
+
const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = useState3(false);
|
|
4538
|
+
const [isFundKalshiModalOpen, setIsFundKalshiModalOpen] = useState3(false);
|
|
4476
4539
|
const livePrices = useLiveOutcomePrices(
|
|
4477
4540
|
scopedSelectedMarket ? [scopedSelectedMarket] : void 0
|
|
4478
4541
|
);
|
|
@@ -4488,32 +4551,32 @@ var PlaceOrder = ({
|
|
|
4488
4551
|
() => mergeBestPricesPreferringLive(clusterBestPricesRest, wsBestPrices),
|
|
4489
4552
|
[clusterBestPricesRest, wsBestPrices]
|
|
4490
4553
|
);
|
|
4491
|
-
const [internalTab, setInternalTab] =
|
|
4492
|
-
const [executionType, setExecutionType] =
|
|
4493
|
-
const [selectedLimitVenue, setSelectedLimitVenue] =
|
|
4494
|
-
const [limitPrice, setLimitPrice] =
|
|
4495
|
-
const [limitPriceInputValue, setLimitPriceInputValue] =
|
|
4496
|
-
const [limitPriceInputError, setLimitPriceInputError] =
|
|
4497
|
-
const [limitExpirationType, setLimitExpirationType] =
|
|
4498
|
-
const [limitExpirationDate, setLimitExpirationDate] =
|
|
4499
|
-
const [limitExpirationTime, setLimitExpirationTime] =
|
|
4500
|
-
const [limitExpirationDraftDate, setLimitExpirationDraftDate] =
|
|
4501
|
-
const [limitExpirationDraftTime, setLimitExpirationDraftTime] =
|
|
4502
|
-
const [limitExpirationPickerView, setLimitExpirationPickerView] =
|
|
4503
|
-
const [isLimitExpirationPickerOpen, setIsLimitExpirationPickerOpen] =
|
|
4504
|
-
const [internalAmount, setInternalAmount] =
|
|
4505
|
-
const [sellFilledForOutcomeId, setSellFilledForOutcomeId] =
|
|
4506
|
-
const [internalSlippage] =
|
|
4507
|
-
const [isRoutesExpanded, setIsRoutesExpanded] =
|
|
4508
|
-
const [selectedRouteCardId, setSelectedRouteCardId] =
|
|
4509
|
-
const [manualRouteSelectionIdentity, setManualRouteSelectionIdentity] =
|
|
4554
|
+
const [internalTab, setInternalTab] = useState3("buy");
|
|
4555
|
+
const [executionType, setExecutionType] = useState3("market");
|
|
4556
|
+
const [selectedLimitVenue, setSelectedLimitVenue] = useState3(null);
|
|
4557
|
+
const [limitPrice, setLimitPrice] = useState3(0.5);
|
|
4558
|
+
const [limitPriceInputValue, setLimitPriceInputValue] = useState3(formatLimitPriceInputValue(0.5));
|
|
4559
|
+
const [limitPriceInputError, setLimitPriceInputError] = useState3(null);
|
|
4560
|
+
const [limitExpirationType, setLimitExpirationType] = useState3("GTC");
|
|
4561
|
+
const [limitExpirationDate, setLimitExpirationDate] = useState3(void 0);
|
|
4562
|
+
const [limitExpirationTime, setLimitExpirationTime] = useState3("17:00");
|
|
4563
|
+
const [limitExpirationDraftDate, setLimitExpirationDraftDate] = useState3();
|
|
4564
|
+
const [limitExpirationDraftTime, setLimitExpirationDraftTime] = useState3("17:00");
|
|
4565
|
+
const [limitExpirationPickerView, setLimitExpirationPickerView] = useState3("options");
|
|
4566
|
+
const [isLimitExpirationPickerOpen, setIsLimitExpirationPickerOpen] = useState3(false);
|
|
4567
|
+
const [internalAmount, setInternalAmount] = useState3(PLACE_ORDER_DEFAULT_AMOUNT);
|
|
4568
|
+
const [sellFilledForOutcomeId, setSellFilledForOutcomeId] = useState3(null);
|
|
4569
|
+
const [internalSlippage] = useState3(DEFAULT_SLIPPAGE_VALUE);
|
|
4570
|
+
const [isRoutesExpanded, setIsRoutesExpanded] = useState3(false);
|
|
4571
|
+
const [selectedRouteCardId, setSelectedRouteCardId] = useState3(null);
|
|
4572
|
+
const [manualRouteSelectionIdentity, setManualRouteSelectionIdentity] = useState3(
|
|
4510
4573
|
null
|
|
4511
4574
|
);
|
|
4512
|
-
const [isSplitDetailOpen, setIsSplitDetailOpen] =
|
|
4513
|
-
const [buyGeoBlockSnapshot, setBuyGeoBlockSnapshot] =
|
|
4514
|
-
const [submissionFeedback, setSubmissionFeedback] =
|
|
4515
|
-
const [submissionProgressState, setSubmissionProgressState] =
|
|
4516
|
-
const [isBeforeActionPending, setIsBeforeActionPending] =
|
|
4575
|
+
const [isSplitDetailOpen, setIsSplitDetailOpen] = useState3(false);
|
|
4576
|
+
const [buyGeoBlockSnapshot, setBuyGeoBlockSnapshot] = useState3(null);
|
|
4577
|
+
const [submissionFeedback, setSubmissionFeedback] = useState3(null);
|
|
4578
|
+
const [submissionProgressState, setSubmissionProgressState] = useState3(null);
|
|
4579
|
+
const [isBeforeActionPending, setIsBeforeActionPending] = useState3(false);
|
|
4517
4580
|
const outcomes = useMemo(
|
|
4518
4581
|
() => mapVenueMarketOutcomesToPlaceOrderOutcomes(scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes),
|
|
4519
4582
|
[scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes]
|
|
@@ -4541,25 +4604,25 @@ var PlaceOrder = ({
|
|
|
4541
4604
|
scopedSelectedOutcomeId,
|
|
4542
4605
|
tradingContext == null ? void 0 : tradingContext.tradeSide
|
|
4543
4606
|
]);
|
|
4544
|
-
const buyTabRef =
|
|
4545
|
-
const sellTabRef =
|
|
4546
|
-
const expirationTriggerRef =
|
|
4547
|
-
const limitPriceInitializedForOutcomeRef =
|
|
4548
|
-
const expirationOptionRefs =
|
|
4549
|
-
const shouldFocusExpirationOptionsRef =
|
|
4607
|
+
const buyTabRef = useRef4(null);
|
|
4608
|
+
const sellTabRef = useRef4(null);
|
|
4609
|
+
const expirationTriggerRef = useRef4(null);
|
|
4610
|
+
const limitPriceInitializedForOutcomeRef = useRef4(void 0);
|
|
4611
|
+
const expirationOptionRefs = useRef4([]);
|
|
4612
|
+
const shouldFocusExpirationOptionsRef = useRef4(false);
|
|
4550
4613
|
const expirationTimeInputId = useId();
|
|
4551
|
-
const executionDebugStoreRef =
|
|
4552
|
-
const executionDebugAttemptIdRef =
|
|
4553
|
-
const submittedSelectionRef =
|
|
4554
|
-
const lastValidRouteCardsRef =
|
|
4555
|
-
|
|
4614
|
+
const executionDebugStoreRef = useRef4(null);
|
|
4615
|
+
const executionDebugAttemptIdRef = useRef4(null);
|
|
4616
|
+
const submittedSelectionRef = useRef4(null);
|
|
4617
|
+
const lastValidRouteCardsRef = useRef4(null);
|
|
4618
|
+
useEffect4(() => {
|
|
4556
4619
|
if (!isExecutionDebugEnabled) {
|
|
4557
4620
|
executionDebugStoreRef.current = null;
|
|
4558
4621
|
return;
|
|
4559
4622
|
}
|
|
4560
4623
|
executionDebugStoreRef.current = enableExecutionDebugInBrowser();
|
|
4561
4624
|
}, [isExecutionDebugEnabled]);
|
|
4562
|
-
|
|
4625
|
+
useEffect4(() => {
|
|
4563
4626
|
var _a2;
|
|
4564
4627
|
if (!isLimitExpirationPickerOpen) return;
|
|
4565
4628
|
if (limitExpirationPickerView !== "options") return;
|
|
@@ -4567,7 +4630,7 @@ var PlaceOrder = ({
|
|
|
4567
4630
|
(_a2 = expirationOptionRefs.current[LIMIT_EXPIRATION_OPTION_COUNT - 1]) == null ? void 0 : _a2.focus();
|
|
4568
4631
|
shouldFocusExpirationOptionsRef.current = false;
|
|
4569
4632
|
}, [isLimitExpirationPickerOpen, limitExpirationPickerView]);
|
|
4570
|
-
|
|
4633
|
+
useEffect4(() => {
|
|
4571
4634
|
if (!isExecutionDebugEnabled) return;
|
|
4572
4635
|
const store = executionDebugStoreRef.current;
|
|
4573
4636
|
if (!store) return;
|
|
@@ -4704,7 +4767,7 @@ var PlaceOrder = ({
|
|
|
4704
4767
|
}
|
|
4705
4768
|
return automaticLimitVenueOption;
|
|
4706
4769
|
}, [automaticLimitVenueOption, availableLimitVenueOptions, selectedLimitVenue]);
|
|
4707
|
-
|
|
4770
|
+
useEffect4(() => {
|
|
4708
4771
|
if (!selectedLimitVenue || !geoBlockedLimitVenues.has(selectedLimitVenue)) return;
|
|
4709
4772
|
setSelectedLimitVenue(null);
|
|
4710
4773
|
}, [geoBlockedLimitVenues, selectedLimitVenue]);
|
|
@@ -4733,7 +4796,7 @@ var PlaceOrder = ({
|
|
|
4733
4796
|
} : {}), {
|
|
4734
4797
|
refreshContext: smartRouteRefreshContext
|
|
4735
4798
|
}));
|
|
4736
|
-
|
|
4799
|
+
useEffect4(() => {
|
|
4737
4800
|
var _a2, _b2, _c2;
|
|
4738
4801
|
if (isSell || smartRoute.isFetching || ((_a2 = smartRoute.data) == null ? void 0 : _a2.venueMarketOutcomeId) !== scopedSelectedOutcomeId) {
|
|
4739
4802
|
return;
|
|
@@ -4816,7 +4879,7 @@ var PlaceOrder = ({
|
|
|
4816
4879
|
);
|
|
4817
4880
|
const isAtMaxSellableShares = isSell && maxSellableShares > 0 && Math.abs(internalAmount - maxSellableShares) < 1e-9;
|
|
4818
4881
|
const isSellAmountAboveAvailability = isSell && ((_t = smartRoute.data) == null ? void 0 : _t.venueMarketOutcomeId) === scopedSelectedOutcomeId && typeof ((_u = smartRoute.data.positionAvailability) == null ? void 0 : _u.totalSellableShares) === "number" && internalAmount > maxSellableShares;
|
|
4819
|
-
|
|
4882
|
+
useEffect4(() => {
|
|
4820
4883
|
if (submissionProgressState != null) return;
|
|
4821
4884
|
if (!isSell || isCurrentSellableSharesLoading) return;
|
|
4822
4885
|
if (scopedSelectedOutcomeId === sellFilledForOutcomeId) return;
|
|
@@ -4832,7 +4895,7 @@ var PlaceOrder = ({
|
|
|
4832
4895
|
onAmountChange,
|
|
4833
4896
|
submissionProgressState
|
|
4834
4897
|
]);
|
|
4835
|
-
|
|
4898
|
+
useEffect4(() => {
|
|
4836
4899
|
var _a2, _b2;
|
|
4837
4900
|
if (submissionProgressState != null || !isSell) return;
|
|
4838
4901
|
if (((_a2 = smartRoute.data) == null ? void 0 : _a2.venueMarketOutcomeId) !== scopedSelectedOutcomeId) return;
|
|
@@ -4900,6 +4963,21 @@ var PlaceOrder = ({
|
|
|
4900
4963
|
const selectedManualRouteCard = manualRouteSelectionIdentity ? routeCards.find(
|
|
4901
4964
|
(card) => getPlaceOrderRouteCardIdentity(card) === manualRouteSelectionIdentity
|
|
4902
4965
|
) : void 0;
|
|
4966
|
+
const legacyKalshiAccount = useMemo(
|
|
4967
|
+
() => {
|
|
4968
|
+
var _a2;
|
|
4969
|
+
return (_a2 = user == null ? void 0 : user.venueAccounts) == null ? void 0 : _a2.find((venueAccount) => venueAccount.venue === "kalshi");
|
|
4970
|
+
},
|
|
4971
|
+
[user == null ? void 0 : user.venueAccounts]
|
|
4972
|
+
);
|
|
4973
|
+
const isKalshiAccountActive = (_B = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.connected) != null ? _B : (legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.status) === "active";
|
|
4974
|
+
const hasKalshiConnectionState = kalshiKeyStatus !== void 0 || (user == null ? void 0 : user.venueAccounts) != null;
|
|
4975
|
+
const isKalshiAvailable = getVenueAvailabilityState({
|
|
4976
|
+
venueId: "kalshi",
|
|
4977
|
+
disabledVenues,
|
|
4978
|
+
isConfigLoading: isAppConfigLoading
|
|
4979
|
+
}) === "available";
|
|
4980
|
+
const isKalshiDisconnected = !isPaperMode && isAuthenticated && hasKalshiConnectionState && isKalshiAvailable && !isKalshiAccountActive;
|
|
4903
4981
|
const resolvedSelectedRouteCardId = useMemo(() => {
|
|
4904
4982
|
var _a2;
|
|
4905
4983
|
if (selectedManualRouteCard && !selectedManualRouteCard.isUnavailable) {
|
|
@@ -4909,17 +4987,20 @@ var PlaceOrder = ({
|
|
|
4909
4987
|
return selectedRouteCardId;
|
|
4910
4988
|
}
|
|
4911
4989
|
if (routeCards.length === 0) return null;
|
|
4912
|
-
return resolveDefaultRouteCardId(routeCards, isSell ? void 0 : (_a2 = smartRoute.data) == null ? void 0 : _a2.status
|
|
4990
|
+
return resolveDefaultRouteCardId(routeCards, isSell ? void 0 : (_a2 = smartRoute.data) == null ? void 0 : _a2.status, {
|
|
4991
|
+
isKalshiDisconnected
|
|
4992
|
+
});
|
|
4913
4993
|
}, [
|
|
4994
|
+
isKalshiDisconnected,
|
|
4914
4995
|
isSell,
|
|
4915
4996
|
isRouteCardsTransient,
|
|
4916
4997
|
manualRouteSelectionIdentity,
|
|
4917
4998
|
routeCards,
|
|
4918
4999
|
selectedManualRouteCard,
|
|
4919
5000
|
selectedRouteCardId,
|
|
4920
|
-
(
|
|
5001
|
+
(_C = smartRoute.data) == null ? void 0 : _C.status
|
|
4921
5002
|
]);
|
|
4922
|
-
|
|
5003
|
+
useEffect4(() => {
|
|
4923
5004
|
if (routeCards.length === 0) {
|
|
4924
5005
|
if (isRouteCardsTransient) return;
|
|
4925
5006
|
setSelectedRouteCardId(null);
|
|
@@ -4943,19 +5024,19 @@ var PlaceOrder = ({
|
|
|
4943
5024
|
selectedRouteCardId
|
|
4944
5025
|
]);
|
|
4945
5026
|
const isSubmissionLocked = submissionProgressState != null;
|
|
4946
|
-
const isSubmissionLockedRef =
|
|
5027
|
+
const isSubmissionLockedRef = useRef4(isSubmissionLocked);
|
|
4947
5028
|
isSubmissionLockedRef.current = isSubmissionLocked;
|
|
4948
|
-
|
|
5029
|
+
useEffect4(() => {
|
|
4949
5030
|
if (isSubmissionLockedRef.current) return;
|
|
4950
5031
|
setSubmissionFeedback(null);
|
|
4951
5032
|
setSubmissionProgressState(null);
|
|
4952
5033
|
}, [executionType, internalAmount, internalSlippage, internalTab, scopedSelectedOutcomeId]);
|
|
4953
|
-
|
|
5034
|
+
useEffect4(() => {
|
|
4954
5035
|
if (showLimitOrders || executionType !== "limit") return;
|
|
4955
5036
|
setExecutionType("market");
|
|
4956
5037
|
setIsLimitExpirationPickerOpen(false);
|
|
4957
5038
|
}, [executionType, showLimitOrders]);
|
|
4958
|
-
|
|
5039
|
+
useEffect4(() => {
|
|
4959
5040
|
if (executionType !== "limit") {
|
|
4960
5041
|
limitPriceInitializedForOutcomeRef.current = void 0;
|
|
4961
5042
|
return;
|
|
@@ -4968,17 +5049,17 @@ var PlaceOrder = ({
|
|
|
4968
5049
|
setLimitPriceInputValue(formatLimitPriceInputValue(nextLimitPrice));
|
|
4969
5050
|
setLimitPriceInputError(null);
|
|
4970
5051
|
}, [executionType, scopedSelectedOutcomeId, selectedOutcomeDisplayPrice]);
|
|
4971
|
-
|
|
5052
|
+
useEffect4(() => {
|
|
4972
5053
|
setSelectedLimitVenue(null);
|
|
4973
5054
|
}, [scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id, scopedSelectedOutcomeId]);
|
|
4974
|
-
|
|
5055
|
+
useEffect4(() => {
|
|
4975
5056
|
setSelectedRouteCardId(null);
|
|
4976
5057
|
setManualRouteSelectionIdentity(null);
|
|
4977
5058
|
setIsRoutesExpanded(false);
|
|
4978
5059
|
setIsSplitDetailOpen(false);
|
|
4979
5060
|
}, [executionType, internalTab, scopedSelectedOutcomeId]);
|
|
4980
5061
|
const orderedRouteCards = routeCards;
|
|
4981
|
-
const selectedRouteCard = (
|
|
5062
|
+
const selectedRouteCard = (_E = (_D = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _D : orderedRouteCards[0]) != null ? _E : null;
|
|
4982
5063
|
const selectedSharedKycVenue = useMemo(() => {
|
|
4983
5064
|
var _a2, _b2;
|
|
4984
5065
|
const candidateVenue = isLimitOrder ? selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue : (_b2 = (_a2 = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills.find(
|
|
@@ -4996,22 +5077,8 @@ var PlaceOrder = ({
|
|
|
4996
5077
|
}
|
|
4997
5078
|
return (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === "kalshi";
|
|
4998
5079
|
}, [isLimitOrder, selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue, selectedRouteCard, scopedSelectedMarket]);
|
|
4999
|
-
const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (
|
|
5000
|
-
const
|
|
5001
|
-
() => {
|
|
5002
|
-
var _a2;
|
|
5003
|
-
return (_a2 = user == null ? void 0 : user.venueAccounts) == null ? void 0 : _a2.find((venueAccount) => venueAccount.venue === "kalshi");
|
|
5004
|
-
},
|
|
5005
|
-
[user == null ? void 0 : user.venueAccounts]
|
|
5006
|
-
);
|
|
5007
|
-
const isKalshiAccountActive = (_F = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.connected) != null ? _F : (legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.status) === "active";
|
|
5008
|
-
const hasKalshiConnectionState = kalshiKeyStatus !== void 0 || (user == null ? void 0 : user.venueAccounts) != null;
|
|
5009
|
-
const isKalshiAvailable = getVenueAvailabilityState({
|
|
5010
|
-
venueId: "kalshi",
|
|
5011
|
-
disabledVenues,
|
|
5012
|
-
isConfigLoading: isAppConfigLoading
|
|
5013
|
-
}) === "available";
|
|
5014
|
-
const needsKalshiConnection = !isPaperMode && isAuthenticated && hasKalshiConnectionState && isKalshiAvailable && isKalshiRoute && !isKalshiAccountActive;
|
|
5080
|
+
const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (_F = liveBalanceState.kalshiBalance) != null ? _F : 0 : liveAvailableBalance;
|
|
5081
|
+
const needsKalshiConnection = isKalshiDisconnected && isKalshiRoute;
|
|
5015
5082
|
const handleVerifyKalshi = useCallback3(
|
|
5016
5083
|
(credentials) => __async(null, null, function* () {
|
|
5017
5084
|
if (onConnectKalshi) {
|
|
@@ -5067,7 +5134,7 @@ var PlaceOrder = ({
|
|
|
5067
5134
|
mode: isPaperMode ? "paper" : void 0,
|
|
5068
5135
|
enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((_I = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _I.length)
|
|
5069
5136
|
});
|
|
5070
|
-
const executionProgressFloorRef =
|
|
5137
|
+
const executionProgressFloorRef = useRef4({
|
|
5071
5138
|
quoteId: null,
|
|
5072
5139
|
value: 0
|
|
5073
5140
|
});
|
|
@@ -5225,7 +5292,7 @@ var PlaceOrder = ({
|
|
|
5225
5292
|
tradingLabels
|
|
5226
5293
|
]
|
|
5227
5294
|
);
|
|
5228
|
-
|
|
5295
|
+
useEffect4(() => {
|
|
5229
5296
|
if (executionProgress.phase === "order_submitted") {
|
|
5230
5297
|
const submittedOrder = executionProgress.submittedOrders[0];
|
|
5231
5298
|
setSubmissionProgressState((prev) => {
|
|
@@ -5238,7 +5305,7 @@ var PlaceOrder = ({
|
|
|
5238
5305
|
});
|
|
5239
5306
|
}
|
|
5240
5307
|
}, [executionProgress.phase, executionProgress.submittedOrders]);
|
|
5241
|
-
|
|
5308
|
+
useEffect4(() => {
|
|
5242
5309
|
var _a2, _b2;
|
|
5243
5310
|
const dp = executionProgress.dagProgress;
|
|
5244
5311
|
if (!dp) return;
|
|
@@ -5293,7 +5360,7 @@ var PlaceOrder = ({
|
|
|
5293
5360
|
return __spreadProps(__spreadValues({}, prev), { dagProgress: dp });
|
|
5294
5361
|
});
|
|
5295
5362
|
}, [executionOrderGroups, executionProgress.dagProgress, tradingLabels]);
|
|
5296
|
-
|
|
5363
|
+
useEffect4(() => {
|
|
5297
5364
|
const orderIds = submissionProgressState == null ? void 0 : submissionProgressState.orderIds;
|
|
5298
5365
|
if (!(orderIds == null ? void 0 : orderIds.length)) return;
|
|
5299
5366
|
const aggregateStatus = deriveAggregateOrderStatus(
|
|
@@ -5354,7 +5421,7 @@ var PlaceOrder = ({
|
|
|
5354
5421
|
tradingLabels
|
|
5355
5422
|
]);
|
|
5356
5423
|
const estDurationMs = executionQuoteData && typeof executionQuoteData.estDurationMs === "number" ? executionQuoteData.estDurationMs : 6e4;
|
|
5357
|
-
|
|
5424
|
+
useEffect4(() => {
|
|
5358
5425
|
const phase = submissionProgressState == null ? void 0 : submissionProgressState.phase;
|
|
5359
5426
|
if (phase !== "submitting" && phase !== "executing") return;
|
|
5360
5427
|
const timeoutMs = Math.max(6e4, 2 * estDurationMs);
|
|
@@ -5398,7 +5465,7 @@ var PlaceOrder = ({
|
|
|
5398
5465
|
});
|
|
5399
5466
|
}
|
|
5400
5467
|
}, [executionProgress.terminalOrderEvents, labels, toastCtx]);
|
|
5401
|
-
|
|
5468
|
+
useEffect4(() => {
|
|
5402
5469
|
var _a2, _b2;
|
|
5403
5470
|
if (!submissionProgressState) return;
|
|
5404
5471
|
onExecutionStateChange == null ? void 0 : onExecutionStateChange(submissionProgressState);
|
|
@@ -5867,11 +5934,6 @@ var PlaceOrder = ({
|
|
|
5867
5934
|
return fills.length > 0 && fills.every((f) => geoBlockedVenuesFromWarnings.has(f.venue));
|
|
5868
5935
|
}, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
|
|
5869
5936
|
const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked || isLimitOrder && limitRouteCards.length > 0 && limitRouteCards.every((card) => card.isUnavailable);
|
|
5870
|
-
const shouldShowLowLiquidityWarning = !isQuoteInputEditing && !isQuoteLoading && (activeQuoteData == null ? void 0 : activeQuoteData.venueMarketOutcomeId) === scopedSelectedOutcomeId && !(activeQuoteData == null ? void 0 : activeQuoteData.fills.some((fill) => fill.venue === "prophetx")) && isPlaceOrderAveragePriceWorse({
|
|
5871
|
-
averageExecutionPrice: selectedRouteCard == null ? void 0 : selectedRouteCard.executionPrice,
|
|
5872
|
-
displayedMarketPrice: selectedOutcomeDisplayPrice,
|
|
5873
|
-
tradeSide: internalTab
|
|
5874
|
-
});
|
|
5875
5937
|
const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
|
|
5876
5938
|
const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isQuoteInsufficientBalance || isSell && isQuoteInputEditing || isSellAmountAboveAvailability || isBelowMinimum || !isLimitOrder && isQuoteLoading || isSelectedVenueInventoryInsufficient || (isLimitOrder ? !limitOrderPayload : !selectedRouteCard || !selectedRouteCard.quoteData.quoteId) || selectedRouteGeoBlocked || !isAuthenticated || !isLimitOrder && quoteStatus !== void 0;
|
|
5877
5939
|
const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (isLimitOrder ? limitRouteCards.length > 0 : displayedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
|
|
@@ -6123,7 +6185,7 @@ var PlaceOrder = ({
|
|
|
6123
6185
|
failureSummary,
|
|
6124
6186
|
selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData
|
|
6125
6187
|
]);
|
|
6126
|
-
|
|
6188
|
+
useEffect4(() => {
|
|
6127
6189
|
if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return;
|
|
6128
6190
|
if ((failureSummary == null ? void 0 : failureSummary.kind) !== "partial_fill") return;
|
|
6129
6191
|
if (!shouldAutoSkipPartialFill) return;
|
|
@@ -6934,6 +6996,7 @@ var PlaceOrder = ({
|
|
|
6934
6996
|
isExpanded: card.kind === "split" ? isSplitDetailOpen : isRoutesExpanded,
|
|
6935
6997
|
isSelected: !card.isUnavailable && card.id === (isLimitOrder ? selectedLimitRouteCardId : resolvedSelectedRouteCardId),
|
|
6936
6998
|
onSelect: handleActiveRouteCardSelect,
|
|
6999
|
+
isKalshiDisconnected,
|
|
6937
7000
|
sharedKycStatus: isPaperMode ? void 0 : sharedKyc == null ? void 0 : sharedKyc.status,
|
|
6938
7001
|
tradingLabels
|
|
6939
7002
|
}) }, card.id);
|
|
@@ -7295,15 +7358,6 @@ var PlaceOrder = ({
|
|
|
7295
7358
|
children: actionLabel
|
|
7296
7359
|
}
|
|
7297
7360
|
),
|
|
7298
|
-
shouldShowLowLiquidityWarning ? /* @__PURE__ */ jsx7(
|
|
7299
|
-
InlineAlert,
|
|
7300
|
-
{
|
|
7301
|
-
tone: "warning",
|
|
7302
|
-
variant: "surface",
|
|
7303
|
-
className: "agg-order-low-liquidity-warning justify-start! border-0! bg-agg-warning/10! py-2!",
|
|
7304
|
-
message: internalTab === "buy" ? tradingLabels.lowLiquidityWarning : tradingLabels.lowLiquiditySellWarning
|
|
7305
|
-
}
|
|
7306
|
-
) : null,
|
|
7307
7361
|
!shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown && appFeeValue === 0 ? /* @__PURE__ */ jsxs6("div", { className: "agg-order-platform-fee mt-1 flex items-center justify-center gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
|
|
7308
7362
|
/* @__PURE__ */ jsx7(
|
|
7309
7363
|
Icon,
|
|
@@ -7363,7 +7417,7 @@ import {
|
|
|
7363
7417
|
useRedeem,
|
|
7364
7418
|
useRedeemLifecycles
|
|
7365
7419
|
} from "@agg-build/hooks";
|
|
7366
|
-
import { useCallback as useCallback4, useEffect as
|
|
7420
|
+
import { useCallback as useCallback4, useEffect as useEffect5, useMemo as useMemo2, useRef as useRef5, useState as useState4 } from "react";
|
|
7367
7421
|
var toClaimError = (err) => {
|
|
7368
7422
|
if (err instanceof Error) return err;
|
|
7369
7423
|
return new Error(String(err));
|
|
@@ -7375,11 +7429,11 @@ function useClaimWinnings(options = {}) {
|
|
|
7375
7429
|
const toastCtx = useOptionalToast();
|
|
7376
7430
|
const queryClient = useQueryClient2();
|
|
7377
7431
|
const redeemMutation = useRedeem();
|
|
7378
|
-
const [activeRedeems, setActiveRedeems] =
|
|
7379
|
-
const activeClaimKeysRef =
|
|
7380
|
-
const pendingClaimToastIdsRef =
|
|
7381
|
-
const submittedClaimToastKeysRef =
|
|
7382
|
-
const [submittingClaimKeys, setSubmittingClaimKeys] =
|
|
7432
|
+
const [activeRedeems, setActiveRedeems] = useState4({});
|
|
7433
|
+
const activeClaimKeysRef = useRef5(/* @__PURE__ */ new Set());
|
|
7434
|
+
const pendingClaimToastIdsRef = useRef5({});
|
|
7435
|
+
const submittedClaimToastKeysRef = useRef5(/* @__PURE__ */ new Set());
|
|
7436
|
+
const [submittingClaimKeys, setSubmittingClaimKeys] = useState4({});
|
|
7383
7437
|
const lifecycleInputs = useMemo2(
|
|
7384
7438
|
() => Object.values(activeRedeems),
|
|
7385
7439
|
[activeRedeems]
|
|
@@ -7545,8 +7599,8 @@ function useClaimWinnings(options = {}) {
|
|
|
7545
7599
|
toastCtx
|
|
7546
7600
|
]
|
|
7547
7601
|
);
|
|
7548
|
-
const firedTerminalRef =
|
|
7549
|
-
|
|
7602
|
+
const firedTerminalRef = useRef5({});
|
|
7603
|
+
useEffect5(() => {
|
|
7550
7604
|
var _a, _b;
|
|
7551
7605
|
for (const [claimKey, active] of Object.entries(activeRedeems)) {
|
|
7552
7606
|
const state = lifecycleStates[active.redeemId];
|