@agg-build/ui 2.1.1 → 2.1.2
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-TERG43WW.mjs → chunk-5RBHMMY3.mjs} +1 -1
- package/dist/{chunk-RPXRTXCY.mjs → chunk-75AMJAWR.mjs} +1 -1
- package/dist/{chunk-IQT4I5B4.mjs → chunk-7ZR5JYB3.mjs} +39 -241
- package/dist/{chunk-NK57KMYN.mjs → chunk-JJDYOBVG.mjs} +117 -48
- package/dist/{chunk-WU2C3C6K.mjs → chunk-NRNBJPYK.mjs} +1 -1
- package/dist/{chunk-YJO6LMRT.mjs → chunk-TBD3N4T4.mjs} +69 -7
- package/dist/{chunk-XHDGSRG7.mjs → chunk-ZOECARZW.mjs} +359 -14
- package/dist/events.js +175 -59
- package/dist/events.mjs +3 -3
- package/dist/index.js +1080 -820
- package/dist/index.mjs +12 -8
- package/dist/modals.js +1 -1
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +845 -589
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +68 -7
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +679 -339
- package/dist/trading.mjs +10 -6
- package/dist/types/events/shared/format-event-title.d.mts +25 -0
- package/dist/types/events/shared/format-event-title.d.ts +25 -0
- package/dist/types/events/shared/select-best-outcome.d.mts +88 -0
- package/dist/types/events/shared/select-best-outcome.d.ts +88 -0
- package/dist/types/pages/event-market/event-market.types.d.mts +7 -0
- package/dist/types/pages/event-market/event-market.types.d.ts +7 -0
- package/dist/types/primitives/search/search.utils.d.mts +3 -1
- package/dist/types/primitives/search/search.utils.d.ts +3 -1
- package/dist/types/trading/index.d.mts +2 -0
- package/dist/types/trading/index.d.ts +2 -0
- 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 +23 -1
- package/dist/types/trading/place-order/index.place-order.types.d.ts +23 -1
- package/dist/types/trading/use-claim-winnings.d.mts +84 -0
- package/dist/types/trading/use-claim-winnings.d.ts +84 -0
- package/dist/types/trading/use-resolved-market-claim.d.mts +26 -0
- package/dist/types/trading/use-resolved-market-claim.d.ts +26 -0
- package/package.json +3 -3
package/dist/trading.js
CHANGED
|
@@ -24,6 +24,7 @@ var __spreadValues = (a, b) => {
|
|
|
24
24
|
return a;
|
|
25
25
|
};
|
|
26
26
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
27
|
+
var __restKey = (key) => typeof key === "symbol" ? key : key + "";
|
|
27
28
|
var __objRest = (source, exclude) => {
|
|
28
29
|
var target = {};
|
|
29
30
|
for (var prop in source)
|
|
@@ -99,7 +100,9 @@ __export(trading_exports, {
|
|
|
99
100
|
getTradingVenueLabel: () => getTradingVenueLabel,
|
|
100
101
|
parseAmount: () => parseAmount,
|
|
101
102
|
parseVenue: () => parseVenue,
|
|
102
|
-
|
|
103
|
+
useClaimWinnings: () => useClaimWinnings,
|
|
104
|
+
useEventTradingContext: () => import_hooks30.useEventTradingContext,
|
|
105
|
+
useResolvedMarketClaim: () => useResolvedMarketClaim
|
|
103
106
|
});
|
|
104
107
|
module.exports = __toCommonJS(trading_exports);
|
|
105
108
|
|
|
@@ -1205,9 +1208,9 @@ SettlementDetails.displayName = "SettlementDetails";
|
|
|
1205
1208
|
|
|
1206
1209
|
// src/trading/place-order/index.tsx
|
|
1207
1210
|
var import_hooks29 = require("@agg-build/hooks");
|
|
1208
|
-
var
|
|
1211
|
+
var import_react9 = __toESM(require("@number-flow/react"));
|
|
1209
1212
|
var Dialog2 = __toESM(require("@radix-ui/react-dialog"));
|
|
1210
|
-
var
|
|
1213
|
+
var import_react10 = require("react");
|
|
1211
1214
|
|
|
1212
1215
|
// src/events/market-details/market-details.utils.ts
|
|
1213
1216
|
var import_sdk12 = require("@agg-build/sdk");
|
|
@@ -5835,10 +5838,19 @@ var Typography = ({
|
|
|
5835
5838
|
};
|
|
5836
5839
|
Typography.displayName = "Typography";
|
|
5837
5840
|
|
|
5841
|
+
// src/primitives/toast/index.tsx
|
|
5842
|
+
var RadixToast = __toESM(require("@radix-ui/react-toast"));
|
|
5843
|
+
var import_react5 = require("react");
|
|
5844
|
+
var import_jsx_runtime118 = require("react/jsx-runtime");
|
|
5845
|
+
var ToastContext = (0, import_react5.createContext)(null);
|
|
5846
|
+
function useOptionalToast() {
|
|
5847
|
+
return (0, import_react5.useContext)(ToastContext);
|
|
5848
|
+
}
|
|
5849
|
+
|
|
5838
5850
|
// src/primitives/tooltip/index.tsx
|
|
5839
5851
|
var import_hooks27 = require("@agg-build/hooks");
|
|
5840
5852
|
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"));
|
|
5841
|
-
var
|
|
5853
|
+
var import_react6 = require("react");
|
|
5842
5854
|
|
|
5843
5855
|
// src/primitives/tooltip/tooltip.constants.ts
|
|
5844
5856
|
var tooltipSizeClasses = {
|
|
@@ -5870,7 +5882,7 @@ var resolveTooltipArrowDimensions = (size) => {
|
|
|
5870
5882
|
};
|
|
5871
5883
|
|
|
5872
5884
|
// src/primitives/tooltip/index.tsx
|
|
5873
|
-
var
|
|
5885
|
+
var import_jsx_runtime119 = require("react/jsx-runtime");
|
|
5874
5886
|
var Tooltip = ({
|
|
5875
5887
|
content,
|
|
5876
5888
|
children,
|
|
@@ -5886,24 +5898,24 @@ var Tooltip = ({
|
|
|
5886
5898
|
general: { rootClassName },
|
|
5887
5899
|
features: { enableAnimations }
|
|
5888
5900
|
} = (0, import_hooks27.useSdkUiConfig)();
|
|
5889
|
-
const trigger = (0,
|
|
5901
|
+
const trigger = (0, import_react6.useMemo)(() => {
|
|
5890
5902
|
if (children) return children;
|
|
5891
|
-
return /* @__PURE__ */ (0,
|
|
5903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
5892
5904
|
"button",
|
|
5893
5905
|
{
|
|
5894
5906
|
type: "button",
|
|
5895
5907
|
className: resolveTooltipTriggerClassName(classNames == null ? void 0 : classNames.trigger),
|
|
5896
5908
|
"aria-label": ariaLabel != null ? ariaLabel : defaultTooltipTriggerAriaLabel,
|
|
5897
|
-
children: /* @__PURE__ */ (0,
|
|
5909
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(Icon, { name: "info", size: "small", className: cn(classNames == null ? void 0 : classNames.icon), "aria-hidden": true })
|
|
5898
5910
|
}
|
|
5899
5911
|
);
|
|
5900
5912
|
}, [children, classNames == null ? void 0 : classNames.trigger, classNames == null ? void 0 : classNames.icon, ariaLabel]);
|
|
5901
5913
|
const { width: arrowWidth, height: arrowHeight } = resolveTooltipArrowDimensions(size);
|
|
5902
5914
|
const arrowPoints = `0,0 ${arrowWidth},0 ${arrowWidth / 2},${arrowHeight}`;
|
|
5903
5915
|
const arrowBorderPath = `M0 0 L${arrowWidth / 2} ${arrowHeight} L${arrowWidth} 0`;
|
|
5904
|
-
return /* @__PURE__ */ (0,
|
|
5905
|
-
/* @__PURE__ */ (0,
|
|
5906
|
-
/* @__PURE__ */ (0,
|
|
5916
|
+
return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(TooltipPrimitive.Provider, { delayDuration, children: /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(TooltipPrimitive.Root, { children: [
|
|
5917
|
+
/* @__PURE__ */ (0, import_jsx_runtime119.jsx)(TooltipPrimitive.Trigger, { asChild: true, children: trigger }),
|
|
5918
|
+
/* @__PURE__ */ (0, import_jsx_runtime119.jsx)(TooltipPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(
|
|
5907
5919
|
TooltipPrimitive.Content,
|
|
5908
5920
|
{
|
|
5909
5921
|
side,
|
|
@@ -5927,7 +5939,7 @@ var Tooltip = ({
|
|
|
5927
5939
|
classNames == null ? void 0 : classNames.content
|
|
5928
5940
|
),
|
|
5929
5941
|
children: [
|
|
5930
|
-
/* @__PURE__ */ (0,
|
|
5942
|
+
/* @__PURE__ */ (0, import_jsx_runtime119.jsx)(TooltipPrimitive.Arrow, { asChild: true, width: arrowWidth, height: arrowHeight, children: /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(
|
|
5931
5943
|
"svg",
|
|
5932
5944
|
{
|
|
5933
5945
|
width: arrowWidth,
|
|
@@ -5936,8 +5948,8 @@ var Tooltip = ({
|
|
|
5936
5948
|
"aria-hidden": "true",
|
|
5937
5949
|
className: cn("overflow-visible", classNames == null ? void 0 : classNames.arrow),
|
|
5938
5950
|
children: [
|
|
5939
|
-
/* @__PURE__ */ (0,
|
|
5940
|
-
/* @__PURE__ */ (0,
|
|
5951
|
+
/* @__PURE__ */ (0, import_jsx_runtime119.jsx)("polygon", { points: arrowPoints, className: "fill-agg-secondary" }),
|
|
5952
|
+
/* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
5941
5953
|
"path",
|
|
5942
5954
|
{
|
|
5943
5955
|
d: arrowBorderPath,
|
|
@@ -5967,7 +5979,7 @@ var requestAggDepositModalOpen = () => {
|
|
|
5967
5979
|
|
|
5968
5980
|
// src/trading/use-kalshi-kyc-flow.ts
|
|
5969
5981
|
var import_hooks28 = require("@agg-build/hooks");
|
|
5970
|
-
var
|
|
5982
|
+
var import_react7 = require("react");
|
|
5971
5983
|
var KYC_PENDING_STORAGE_KEY = "agg_kyc_pending";
|
|
5972
5984
|
var getKycPendingState = () => {
|
|
5973
5985
|
var _a, _b;
|
|
@@ -5998,13 +6010,13 @@ var useKalshiKycFlow = ({
|
|
|
5998
6010
|
onError
|
|
5999
6011
|
}) => {
|
|
6000
6012
|
const client = (0, import_hooks28.useAggClient)();
|
|
6001
|
-
const [isVerifyModalOpen, setIsVerifyModalOpen] = (0,
|
|
6002
|
-
const [showSuccessModal, setShowSuccessModal] = (0,
|
|
6003
|
-
const [isInitiating, setIsInitiating] = (0,
|
|
6004
|
-
const [needsDepositAddress, setNeedsDepositAddress] = (0,
|
|
6005
|
-
const initiationAttemptRef = (0,
|
|
6013
|
+
const [isVerifyModalOpen, setIsVerifyModalOpen] = (0, import_react7.useState)(false);
|
|
6014
|
+
const [showSuccessModal, setShowSuccessModal] = (0, import_react7.useState)(false);
|
|
6015
|
+
const [isInitiating, setIsInitiating] = (0, import_react7.useState)(false);
|
|
6016
|
+
const [needsDepositAddress, setNeedsDepositAddress] = (0, import_react7.useState)(false);
|
|
6017
|
+
const initiationAttemptRef = (0, import_react7.useRef)(0);
|
|
6006
6018
|
const { isReady, isTimedOut } = (0, import_hooks28.useDepositAddresses)({ enabled: needsDepositAddress, poll: true });
|
|
6007
|
-
const pendingState = (0,
|
|
6019
|
+
const pendingState = (0, import_react7.useMemo)(
|
|
6008
6020
|
() => ({
|
|
6009
6021
|
venue: "kalshi",
|
|
6010
6022
|
userId: userId != null ? userId : null,
|
|
@@ -6012,28 +6024,28 @@ var useKalshiKycFlow = ({
|
|
|
6012
6024
|
}),
|
|
6013
6025
|
[userId, walletAddress]
|
|
6014
6026
|
);
|
|
6015
|
-
const resetInitiation = (0,
|
|
6027
|
+
const resetInitiation = (0, import_react7.useCallback)(() => {
|
|
6016
6028
|
setIsInitiating(false);
|
|
6017
6029
|
setNeedsDepositAddress(false);
|
|
6018
6030
|
}, []);
|
|
6019
|
-
const closeVerifyModal = (0,
|
|
6031
|
+
const closeVerifyModal = (0, import_react7.useCallback)(() => {
|
|
6020
6032
|
initiationAttemptRef.current += 1;
|
|
6021
6033
|
clearKycPendingState();
|
|
6022
6034
|
resetInitiation();
|
|
6023
6035
|
setIsVerifyModalOpen(false);
|
|
6024
6036
|
}, [resetInitiation]);
|
|
6025
|
-
const closeSuccessModal = (0,
|
|
6037
|
+
const closeSuccessModal = (0, import_react7.useCallback)(() => {
|
|
6026
6038
|
setShowSuccessModal(false);
|
|
6027
6039
|
}, []);
|
|
6028
|
-
const openVerifyModal = (0,
|
|
6040
|
+
const openVerifyModal = (0, import_react7.useCallback)(() => {
|
|
6029
6041
|
setIsVerifyModalOpen(true);
|
|
6030
6042
|
}, []);
|
|
6031
|
-
const startVerification = (0,
|
|
6043
|
+
const startVerification = (0, import_react7.useCallback)(() => {
|
|
6032
6044
|
initiationAttemptRef.current += 1;
|
|
6033
6045
|
setIsInitiating(true);
|
|
6034
6046
|
setNeedsDepositAddress(true);
|
|
6035
6047
|
}, []);
|
|
6036
|
-
(0,
|
|
6048
|
+
(0, import_react7.useEffect)(() => {
|
|
6037
6049
|
if (!isInitiating || !isReady) return;
|
|
6038
6050
|
const attemptId = initiationAttemptRef.current;
|
|
6039
6051
|
const redirectUri = window.location.href;
|
|
@@ -6050,14 +6062,14 @@ var useKalshiKycFlow = ({
|
|
|
6050
6062
|
resetInitiation();
|
|
6051
6063
|
});
|
|
6052
6064
|
}, [client, isInitiating, isReady, onError, pendingState, resetInitiation]);
|
|
6053
|
-
(0,
|
|
6065
|
+
(0, import_react7.useEffect)(() => {
|
|
6054
6066
|
if (isTimedOut && isInitiating) {
|
|
6055
6067
|
clearKycPendingState();
|
|
6056
6068
|
resetInitiation();
|
|
6057
6069
|
onError == null ? void 0 : onError(new Error("Deposit address provisioning timed out"));
|
|
6058
6070
|
}
|
|
6059
6071
|
}, [isInitiating, isTimedOut, onError, resetInitiation]);
|
|
6060
|
-
(0,
|
|
6072
|
+
(0, import_react7.useEffect)(() => {
|
|
6061
6073
|
const storedPendingState = getKycPendingState();
|
|
6062
6074
|
const isMatchingSession = (storedPendingState == null ? void 0 : storedPendingState.venue) === "kalshi" && storedPendingState.userId === pendingState.userId && storedPendingState.walletAddress === pendingState.walletAddress;
|
|
6063
6075
|
if (isKalshiVerified && isMatchingSession) {
|
|
@@ -7647,7 +7659,7 @@ var isPercentageBelowMinimum = (value, minimumValue) => {
|
|
|
7647
7659
|
};
|
|
7648
7660
|
|
|
7649
7661
|
// src/trading/place-order/index.place-order.failure.tsx
|
|
7650
|
-
var
|
|
7662
|
+
var import_jsx_runtime120 = require("react/jsx-runtime");
|
|
7651
7663
|
var resolveFailureActionHandler = ({
|
|
7652
7664
|
action,
|
|
7653
7665
|
onDone,
|
|
@@ -7660,12 +7672,12 @@ var resolveFailureActionHandler = ({
|
|
|
7660
7672
|
};
|
|
7661
7673
|
var renderPartialFailureStep = (step) => {
|
|
7662
7674
|
const isWarningStep = step.tone === "warning" || step.tone === "error";
|
|
7663
|
-
return /* @__PURE__ */ (0,
|
|
7675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(
|
|
7664
7676
|
"div",
|
|
7665
7677
|
{
|
|
7666
7678
|
className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
7667
7679
|
children: [
|
|
7668
|
-
/* @__PURE__ */ (0,
|
|
7680
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
7669
7681
|
Icon,
|
|
7670
7682
|
{
|
|
7671
7683
|
name: isWarningStep ? "warning-filled" : "check-circle",
|
|
@@ -7674,8 +7686,8 @@ var renderPartialFailureStep = (step) => {
|
|
|
7674
7686
|
"aria-hidden": "true"
|
|
7675
7687
|
}
|
|
7676
7688
|
),
|
|
7677
|
-
/* @__PURE__ */ (0,
|
|
7678
|
-
step.venue ? /* @__PURE__ */ (0,
|
|
7689
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
7690
|
+
step.venue ? /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(VenueLogo, { venue: step.venue, size: "small", className: "h-4 w-4 shrink-0" }) : null
|
|
7679
7691
|
]
|
|
7680
7692
|
},
|
|
7681
7693
|
step.id
|
|
@@ -7694,10 +7706,10 @@ var PlaceOrderFailureView = ({
|
|
|
7694
7706
|
const shouldShowPartialFailureLayout = summary.kind === "partial_fill";
|
|
7695
7707
|
const failureStepGroups = shouldShowPartialFailureLayout ? groupPlaceOrderFailureSteps(summary.steps) : [];
|
|
7696
7708
|
if (shouldShowPartialFailureLayout) {
|
|
7697
|
-
return /* @__PURE__ */ (0,
|
|
7698
|
-
/* @__PURE__ */ (0,
|
|
7699
|
-
/* @__PURE__ */ (0,
|
|
7700
|
-
/* @__PURE__ */ (0,
|
|
7709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Card, { className: cn("group/agg-order-panel", getPlaceOrderContainerClassName(), className), children: /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "agg-order-failure-body flex flex-col gap-6 p-5", children: [
|
|
7710
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "agg-order-failure-header flex flex-col gap-2", children: [
|
|
7711
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "agg-order-failure-market flex items-center gap-3", children: [
|
|
7712
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
7701
7713
|
RemoteImage,
|
|
7702
7714
|
{
|
|
7703
7715
|
src: (_a = summary.eventImage) != null ? _a : null,
|
|
@@ -7705,12 +7717,12 @@ var PlaceOrderFailureView = ({
|
|
|
7705
7717
|
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
7706
7718
|
}
|
|
7707
7719
|
),
|
|
7708
|
-
/* @__PURE__ */ (0,
|
|
7720
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.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 })
|
|
7709
7721
|
] }),
|
|
7710
|
-
summary.eventSubtitle ? /* @__PURE__ */ (0,
|
|
7722
|
+
summary.eventSubtitle ? /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
|
|
7711
7723
|
] }),
|
|
7712
|
-
/* @__PURE__ */ (0,
|
|
7713
|
-
/* @__PURE__ */ (0,
|
|
7724
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { className: "flex flex-col gap-4", children: failureStepGroups.map((group, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { className: "flex flex-col gap-2", children: group.map((step) => renderPartialFailureStep(step)) }, `failure-group-${groupIndex}`)) }),
|
|
7725
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { className: "flex items-center gap-4", children: summary.actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
7714
7726
|
Button,
|
|
7715
7727
|
{
|
|
7716
7728
|
variant: "tertiary",
|
|
@@ -7724,10 +7736,10 @@ var PlaceOrderFailureView = ({
|
|
|
7724
7736
|
)) })
|
|
7725
7737
|
] }) });
|
|
7726
7738
|
}
|
|
7727
|
-
return /* @__PURE__ */ (0,
|
|
7728
|
-
/* @__PURE__ */ (0,
|
|
7729
|
-
/* @__PURE__ */ (0,
|
|
7730
|
-
/* @__PURE__ */ (0,
|
|
7739
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Card, { className: cn("group/agg-order-panel", getPlaceOrderContainerClassName(), className), children: /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "agg-order-failure-body flex flex-col gap-6 p-5", children: [
|
|
7740
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "agg-order-failure-header flex flex-col gap-2", children: [
|
|
7741
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "agg-order-failure-market flex items-center gap-3", children: [
|
|
7742
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
7731
7743
|
RemoteImage,
|
|
7732
7744
|
{
|
|
7733
7745
|
src: (_b = summary.eventImage) != null ? _b : null,
|
|
@@ -7735,11 +7747,11 @@ var PlaceOrderFailureView = ({
|
|
|
7735
7747
|
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
7736
7748
|
}
|
|
7737
7749
|
),
|
|
7738
|
-
/* @__PURE__ */ (0,
|
|
7750
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.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 })
|
|
7739
7751
|
] }),
|
|
7740
|
-
summary.eventSubtitle ? /* @__PURE__ */ (0,
|
|
7752
|
+
summary.eventSubtitle ? /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
|
|
7741
7753
|
] }),
|
|
7742
|
-
/* @__PURE__ */ (0,
|
|
7754
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
7743
7755
|
InlineAlert,
|
|
7744
7756
|
{
|
|
7745
7757
|
tone: "error",
|
|
@@ -7748,7 +7760,7 @@ var PlaceOrderFailureView = ({
|
|
|
7748
7760
|
message: tradingLabels.orderFailureDescription((_c = summary.errorMessage) != null ? _c : "")
|
|
7749
7761
|
}
|
|
7750
7762
|
),
|
|
7751
|
-
/* @__PURE__ */ (0,
|
|
7763
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { className: "agg-order-failure-actions flex items-center gap-3", children: summary.actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
7752
7764
|
Button,
|
|
7753
7765
|
{
|
|
7754
7766
|
variant: action.variant === "retry" ? "primary" : "secondary",
|
|
@@ -7765,8 +7777,8 @@ var PlaceOrderFailureView = ({
|
|
|
7765
7777
|
PlaceOrderFailureView.displayName = "PlaceOrderFailureView";
|
|
7766
7778
|
|
|
7767
7779
|
// src/trading/place-order/index.place-order.success.tsx
|
|
7768
|
-
var
|
|
7769
|
-
var
|
|
7780
|
+
var import_react8 = require("react");
|
|
7781
|
+
var import_jsx_runtime121 = require("react/jsx-runtime");
|
|
7770
7782
|
var resolveBuyToWinLabel = (shares) => {
|
|
7771
7783
|
if (!shares) return "$0";
|
|
7772
7784
|
return shares.startsWith("$") ? shares : `$${shares}`;
|
|
@@ -7779,7 +7791,7 @@ var PlaceOrderSuccessView = ({
|
|
|
7779
7791
|
onShare: _onShare
|
|
7780
7792
|
}) => {
|
|
7781
7793
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
7782
|
-
const [isExecutionDetailsExpanded, setIsExecutionDetailsExpanded] = (0,
|
|
7794
|
+
const [isExecutionDetailsExpanded, setIsExecutionDetailsExpanded] = (0, import_react8.useState)(true);
|
|
7783
7795
|
const doneLabel = tradingLabels.orderDone;
|
|
7784
7796
|
const _shareLabel = (_a = tradingLabels.orderShare) != null ? _a : "Share";
|
|
7785
7797
|
const potentialReturnLabel = summary.potentialReturnLabel && tradingLabels.potentialReturnBonus ? tradingLabels.potentialReturnBonus(summary.potentialReturnLabel) : summary.potentialReturnLabel ? `+${summary.potentialReturnLabel} Better Payout` : null;
|
|
@@ -7797,10 +7809,10 @@ var PlaceOrderSuccessView = ({
|
|
|
7797
7809
|
const resolveStepIconClassName = (tone) => {
|
|
7798
7810
|
return tone === "warning" || tone === "error" ? "text-agg-warning" : "text-agg-primary";
|
|
7799
7811
|
};
|
|
7800
|
-
return /* @__PURE__ */ (0,
|
|
7801
|
-
summary.eventTitle ? /* @__PURE__ */ (0,
|
|
7802
|
-
/* @__PURE__ */ (0,
|
|
7803
|
-
/* @__PURE__ */ (0,
|
|
7812
|
+
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-success-body flex flex-col gap-6 p-5", children: [
|
|
7813
|
+
summary.eventTitle ? /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "agg-order-success-header flex flex-col gap-2", children: [
|
|
7814
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "agg-order-success-market flex items-center gap-3", children: [
|
|
7815
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
7804
7816
|
RemoteImage,
|
|
7805
7817
|
{
|
|
7806
7818
|
src: (_h = summary.eventImage) != null ? _h : null,
|
|
@@ -7808,12 +7820,12 @@ var PlaceOrderSuccessView = ({
|
|
|
7808
7820
|
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
7809
7821
|
}
|
|
7810
7822
|
),
|
|
7811
|
-
/* @__PURE__ */ (0,
|
|
7823
|
+
/* @__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 })
|
|
7812
7824
|
] }),
|
|
7813
|
-
summary.eventDateLabel ? /* @__PURE__ */ (0,
|
|
7825
|
+
summary.eventDateLabel ? /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventDateLabel }) : null
|
|
7814
7826
|
] }) : null,
|
|
7815
|
-
executionStepGroups.length > 0 ? /* @__PURE__ */ (0,
|
|
7816
|
-
/* @__PURE__ */ (0,
|
|
7827
|
+
executionStepGroups.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "agg-order-success-timeline flex flex-col gap-2", children: [
|
|
7828
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
7817
7829
|
"div",
|
|
7818
7830
|
{
|
|
7819
7831
|
"aria-hidden": !isExecutionDetailsExpanded,
|
|
@@ -7826,12 +7838,12 @@ var PlaceOrderSuccessView = ({
|
|
|
7826
7838
|
"transition-[grid-template-rows,opacity] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
7827
7839
|
)
|
|
7828
7840
|
),
|
|
7829
|
-
children: /* @__PURE__ */ (0,
|
|
7841
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "flex flex-col gap-4 pb-2", children: detailedStepGroups.map((group, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "flex flex-col gap-2", children: group.map((step) => /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
|
|
7830
7842
|
"div",
|
|
7831
7843
|
{
|
|
7832
7844
|
className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
7833
7845
|
children: [
|
|
7834
|
-
/* @__PURE__ */ (0,
|
|
7846
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
7835
7847
|
Icon,
|
|
7836
7848
|
{
|
|
7837
7849
|
name: resolveStepIconName(step.tone),
|
|
@@ -7840,8 +7852,8 @@ var PlaceOrderSuccessView = ({
|
|
|
7840
7852
|
"aria-hidden": "true"
|
|
7841
7853
|
}
|
|
7842
7854
|
),
|
|
7843
|
-
/* @__PURE__ */ (0,
|
|
7844
|
-
step.venue ? /* @__PURE__ */ (0,
|
|
7855
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
7856
|
+
step.venue ? /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
7845
7857
|
VenueLogo,
|
|
7846
7858
|
{
|
|
7847
7859
|
venue: step.venue,
|
|
@@ -7855,7 +7867,7 @@ var PlaceOrderSuccessView = ({
|
|
|
7855
7867
|
)) }, `execution-group-${groupIndex}`)) }) })
|
|
7856
7868
|
}
|
|
7857
7869
|
),
|
|
7858
|
-
finalStep ? hasExecutionDetails ? /* @__PURE__ */ (0,
|
|
7870
|
+
finalStep ? hasExecutionDetails ? /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
|
|
7859
7871
|
"button",
|
|
7860
7872
|
{
|
|
7861
7873
|
type: "button",
|
|
@@ -7867,7 +7879,7 @@ var PlaceOrderSuccessView = ({
|
|
|
7867
7879
|
),
|
|
7868
7880
|
onClick: () => setIsExecutionDetailsExpanded((currentValue) => !currentValue),
|
|
7869
7881
|
children: [
|
|
7870
|
-
/* @__PURE__ */ (0,
|
|
7882
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
7871
7883
|
Icon,
|
|
7872
7884
|
{
|
|
7873
7885
|
name: resolveStepIconName(finalStep.tone),
|
|
@@ -7876,8 +7888,8 @@ var PlaceOrderSuccessView = ({
|
|
|
7876
7888
|
"aria-hidden": "true"
|
|
7877
7889
|
}
|
|
7878
7890
|
),
|
|
7879
|
-
/* @__PURE__ */ (0,
|
|
7880
|
-
/* @__PURE__ */ (0,
|
|
7891
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("p", { className: "min-w-0 flex-1", children: finalStep.label }),
|
|
7892
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
7881
7893
|
Icon,
|
|
7882
7894
|
{
|
|
7883
7895
|
name: isExecutionDetailsExpanded ? "chevron-up" : "chevron-down",
|
|
@@ -7888,8 +7900,8 @@ var PlaceOrderSuccessView = ({
|
|
|
7888
7900
|
)
|
|
7889
7901
|
]
|
|
7890
7902
|
}
|
|
7891
|
-
) : /* @__PURE__ */ (0,
|
|
7892
|
-
/* @__PURE__ */ (0,
|
|
7903
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
7904
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
7893
7905
|
Icon,
|
|
7894
7906
|
{
|
|
7895
7907
|
name: resolveStepIconName(finalStep.tone),
|
|
@@ -7898,34 +7910,34 @@ var PlaceOrderSuccessView = ({
|
|
|
7898
7910
|
"aria-hidden": "true"
|
|
7899
7911
|
}
|
|
7900
7912
|
),
|
|
7901
|
-
/* @__PURE__ */ (0,
|
|
7913
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("p", { className: "min-w-0 flex-1", children: finalStep.label })
|
|
7902
7914
|
] }) : null
|
|
7903
7915
|
] }) : null,
|
|
7904
|
-
/* @__PURE__ */ (0,
|
|
7916
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
|
|
7905
7917
|
"div",
|
|
7906
7918
|
{
|
|
7907
7919
|
className: cn(
|
|
7908
7920
|
"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"
|
|
7909
7921
|
),
|
|
7910
7922
|
children: [
|
|
7911
|
-
/* @__PURE__ */ (0,
|
|
7912
|
-
/* @__PURE__ */ (0,
|
|
7923
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Icon, { name: "success-check", size: "small", className: "h-4 w-4 shrink-0 text-current" }),
|
|
7924
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { children: resolvedActionLabel })
|
|
7913
7925
|
]
|
|
7914
7926
|
}
|
|
7915
7927
|
),
|
|
7916
|
-
/* @__PURE__ */ (0,
|
|
7917
|
-
/* @__PURE__ */ (0,
|
|
7918
|
-
/* @__PURE__ */ (0,
|
|
7928
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "agg-order-success-summary flex items-center justify-between gap-4", children: [
|
|
7929
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.amount(resolvedTradeSide) }),
|
|
7930
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("p", { className: "text-right text-[30px] font-agg-bold leading-[36px] text-agg-foreground", children: resolvedAmountLabel })
|
|
7919
7931
|
] }),
|
|
7920
|
-
/* @__PURE__ */ (0,
|
|
7921
|
-
/* @__PURE__ */ (0,
|
|
7922
|
-
/* @__PURE__ */ (0,
|
|
7932
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "agg-order-success-summary flex items-center justify-between gap-4", children: [
|
|
7933
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.toWin(resolvedTradeSide) }),
|
|
7934
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("p", { className: "text-right text-[30px] font-agg-bold leading-[36px] text-agg-success", children: resolvedToWinLabel })
|
|
7923
7935
|
] }),
|
|
7924
|
-
summary.potentialReturnLabel ? /* @__PURE__ */ (0,
|
|
7925
|
-
/* @__PURE__ */ (0,
|
|
7926
|
-
/* @__PURE__ */ (0,
|
|
7936
|
+
summary.potentialReturnLabel ? /* @__PURE__ */ (0, import_jsx_runtime121.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: [
|
|
7937
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.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 }),
|
|
7938
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("p", { className: "text-agg-xs leading-agg-4 text-agg-foreground", children: (_i = tradingLabels.withSmartRouting) != null ? _i : "with Smart Routing" })
|
|
7927
7939
|
] }) : null,
|
|
7928
|
-
/* @__PURE__ */ (0,
|
|
7940
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "agg-order-success-actions flex gap-3", children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
7929
7941
|
Button,
|
|
7930
7942
|
{
|
|
7931
7943
|
variant: "secondary",
|
|
@@ -7941,7 +7953,7 @@ var PlaceOrderSuccessView = ({
|
|
|
7941
7953
|
PlaceOrderSuccessView.displayName = "PlaceOrderSuccessView";
|
|
7942
7954
|
|
|
7943
7955
|
// src/trading/place-order/index.tsx
|
|
7944
|
-
var
|
|
7956
|
+
var import_jsx_runtime122 = require("react/jsx-runtime");
|
|
7945
7957
|
var resolveRefetchedQuoteData = (result) => {
|
|
7946
7958
|
if (!result || typeof result !== "object" || !("data" in result)) return null;
|
|
7947
7959
|
const data = result.data;
|
|
@@ -7960,7 +7972,7 @@ var LoadingGlyph = ({
|
|
|
7960
7972
|
className,
|
|
7961
7973
|
enableAnimations
|
|
7962
7974
|
}) => {
|
|
7963
|
-
return /* @__PURE__ */ (0,
|
|
7975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
7964
7976
|
"span",
|
|
7965
7977
|
{
|
|
7966
7978
|
"aria-hidden": "true",
|
|
@@ -7981,24 +7993,24 @@ var PlaceOrderSlippageControl = ({
|
|
|
7981
7993
|
}) => {
|
|
7982
7994
|
var _a, _b;
|
|
7983
7995
|
const labels = (0, import_hooks29.useLabels)();
|
|
7984
|
-
const containerRef = (0,
|
|
7985
|
-
const triggerRef = (0,
|
|
7986
|
-
const inputRef = (0,
|
|
7987
|
-
const warningId = (0,
|
|
7996
|
+
const containerRef = (0, import_react10.useRef)(null);
|
|
7997
|
+
const triggerRef = (0, import_react10.useRef)(null);
|
|
7998
|
+
const inputRef = (0, import_react10.useRef)(null);
|
|
7999
|
+
const warningId = (0, import_react10.useId)();
|
|
7988
8000
|
const defaultValue = finalizePercentageValue(slippageDefaultValue);
|
|
7989
8001
|
const committedValue = finalizePercentageValue(slippageValue) || defaultValue;
|
|
7990
|
-
const [draftValue, setDraftValue] = (0,
|
|
7991
|
-
const [isEditing, setIsEditing] = (0,
|
|
8002
|
+
const [draftValue, setDraftValue] = (0, import_react10.useState)(committedValue);
|
|
8003
|
+
const [isEditing, setIsEditing] = (0, import_react10.useState)(
|
|
7992
8004
|
() => isPercentageBelowMinimum(committedValue, slippageMinimumValue)
|
|
7993
8005
|
);
|
|
7994
|
-
const [shouldFocusInput, setShouldFocusInput] = (0,
|
|
7995
|
-
(0,
|
|
8006
|
+
const [shouldFocusInput, setShouldFocusInput] = (0, import_react10.useState)(false);
|
|
8007
|
+
(0, import_react10.useEffect)(() => {
|
|
7996
8008
|
setDraftValue(committedValue);
|
|
7997
8009
|
if (isPercentageBelowMinimum(committedValue, slippageMinimumValue)) {
|
|
7998
8010
|
setIsEditing(true);
|
|
7999
8011
|
}
|
|
8000
8012
|
}, [committedValue, slippageMinimumValue]);
|
|
8001
|
-
(0,
|
|
8013
|
+
(0, import_react10.useEffect)(() => {
|
|
8002
8014
|
if (!shouldFocusInput) return;
|
|
8003
8015
|
requestAnimationFrame(() => {
|
|
8004
8016
|
var _a2, _b2;
|
|
@@ -8015,7 +8027,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
8015
8027
|
Number(committedValue || slippageDefaultValue || DEFAULT_SLIPPAGE_VALUE)
|
|
8016
8028
|
);
|
|
8017
8029
|
const resolvedAutoLabel = labels.trading.resetSlippage;
|
|
8018
|
-
const resolvedWarningMessage = (0,
|
|
8030
|
+
const resolvedWarningMessage = (0, import_react10.useMemo)(() => {
|
|
8019
8031
|
if (isLowSlippage) {
|
|
8020
8032
|
return labels.trading.slippageLow(slippageMinimumValue);
|
|
8021
8033
|
}
|
|
@@ -8078,8 +8090,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
8078
8090
|
if (!isEditing) return;
|
|
8079
8091
|
handleCommitDraft(false);
|
|
8080
8092
|
};
|
|
8081
|
-
return /* @__PURE__ */ (0,
|
|
8082
|
-
/* @__PURE__ */ (0,
|
|
8093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { ref: containerRef, className: "agg-slippage-control w-full", onBlur: handleContainerBlur, children: [
|
|
8094
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
|
|
8083
8095
|
"button",
|
|
8084
8096
|
{
|
|
8085
8097
|
ref: triggerRef,
|
|
@@ -8097,8 +8109,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
8097
8109
|
),
|
|
8098
8110
|
onClick: handleToggleEditing,
|
|
8099
8111
|
children: [
|
|
8100
|
-
/* @__PURE__ */ (0,
|
|
8101
|
-
/* @__PURE__ */ (0,
|
|
8112
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("span", { className: "agg-slippage-label", children: collapsedLabel }),
|
|
8113
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8102
8114
|
Icon,
|
|
8103
8115
|
{
|
|
8104
8116
|
name: isEditing ? "chevron-up" : "pencil",
|
|
@@ -8110,7 +8122,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
8110
8122
|
]
|
|
8111
8123
|
}
|
|
8112
8124
|
),
|
|
8113
|
-
/* @__PURE__ */ (0,
|
|
8125
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8114
8126
|
"div",
|
|
8115
8127
|
{
|
|
8116
8128
|
"aria-hidden": !isEditing,
|
|
@@ -8124,10 +8136,10 @@ var PlaceOrderSlippageControl = ({
|
|
|
8124
8136
|
"transition-[grid-template-rows,opacity,margin-top] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
8125
8137
|
)
|
|
8126
8138
|
),
|
|
8127
|
-
children: /* @__PURE__ */ (0,
|
|
8128
|
-
/* @__PURE__ */ (0,
|
|
8129
|
-
/* @__PURE__ */ (0,
|
|
8130
|
-
/* @__PURE__ */ (0,
|
|
8139
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { className: "min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-slippage-editor-body flex flex-col gap-2", children: [
|
|
8140
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-slippage-input-row flex h-9 overflow-hidden rounded-agg-sm border border-agg-separator", children: [
|
|
8141
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-slippage-input-group flex min-w-0 flex-1 items-center gap-2 bg-agg-secondary px-3", children: [
|
|
8142
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8131
8143
|
"input",
|
|
8132
8144
|
{
|
|
8133
8145
|
ref: inputRef,
|
|
@@ -8142,7 +8154,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
8142
8154
|
onKeyDown: handleInputKeyDown
|
|
8143
8155
|
}
|
|
8144
8156
|
),
|
|
8145
|
-
/* @__PURE__ */ (0,
|
|
8157
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8146
8158
|
"button",
|
|
8147
8159
|
{
|
|
8148
8160
|
type: "button",
|
|
@@ -8160,8 +8172,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
8160
8172
|
}
|
|
8161
8173
|
)
|
|
8162
8174
|
] }),
|
|
8163
|
-
/* @__PURE__ */ (0,
|
|
8164
|
-
/* @__PURE__ */ (0,
|
|
8175
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { className: "h-full w-px bg-agg-separator", "aria-hidden": "true" }),
|
|
8176
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8165
8177
|
"div",
|
|
8166
8178
|
{
|
|
8167
8179
|
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",
|
|
@@ -8170,7 +8182,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
8170
8182
|
}
|
|
8171
8183
|
)
|
|
8172
8184
|
] }),
|
|
8173
|
-
/* @__PURE__ */ (0,
|
|
8185
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8174
8186
|
"div",
|
|
8175
8187
|
{
|
|
8176
8188
|
"aria-hidden": !resolvedWarningMessage,
|
|
@@ -8184,13 +8196,13 @@ var PlaceOrderSlippageControl = ({
|
|
|
8184
8196
|
"transition-[grid-template-rows,opacity] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
8185
8197
|
)
|
|
8186
8198
|
),
|
|
8187
|
-
children: /* @__PURE__ */ (0,
|
|
8199
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { className: "min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
|
|
8188
8200
|
"div",
|
|
8189
8201
|
{
|
|
8190
8202
|
id: warningId,
|
|
8191
8203
|
className: "agg-slippage-warning-message flex items-start gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
8192
8204
|
children: [
|
|
8193
|
-
/* @__PURE__ */ (0,
|
|
8205
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8194
8206
|
Icon,
|
|
8195
8207
|
{
|
|
8196
8208
|
name: "warning-filled",
|
|
@@ -8199,7 +8211,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
8199
8211
|
color: "currentColor"
|
|
8200
8212
|
}
|
|
8201
8213
|
),
|
|
8202
|
-
/* @__PURE__ */ (0,
|
|
8214
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { children: resolvedWarningMessage != null ? resolvedWarningMessage : "" })
|
|
8203
8215
|
]
|
|
8204
8216
|
}
|
|
8205
8217
|
) })
|
|
@@ -8219,9 +8231,9 @@ var renderCardHeader = ({
|
|
|
8219
8231
|
onClose
|
|
8220
8232
|
}) => {
|
|
8221
8233
|
if (!headerTitle) return null;
|
|
8222
|
-
return /* @__PURE__ */ (0,
|
|
8223
|
-
/* @__PURE__ */ (0,
|
|
8224
|
-
/* @__PURE__ */ (0,
|
|
8234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: cn("agg-order-panel-header flex flex-col gap-2", className), children: [
|
|
8235
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-order-market-summary flex items-center gap-3", children: [
|
|
8236
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8225
8237
|
RemoteImage,
|
|
8226
8238
|
{
|
|
8227
8239
|
src: headerImage,
|
|
@@ -8229,19 +8241,19 @@ var renderCardHeader = ({
|
|
|
8229
8241
|
className: "agg-order-market-image h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
8230
8242
|
}
|
|
8231
8243
|
),
|
|
8232
|
-
/* @__PURE__ */ (0,
|
|
8233
|
-
onClose ? /* @__PURE__ */ (0,
|
|
8244
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.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 }),
|
|
8245
|
+
onClose ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8234
8246
|
"button",
|
|
8235
8247
|
{
|
|
8236
8248
|
type: "button",
|
|
8237
8249
|
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",
|
|
8238
8250
|
"aria-label": "Close",
|
|
8239
8251
|
onClick: onClose,
|
|
8240
|
-
children: /* @__PURE__ */ (0,
|
|
8252
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(CloseIcon, { className: "h-5 w-5" })
|
|
8241
8253
|
}
|
|
8242
8254
|
) : null
|
|
8243
8255
|
] }),
|
|
8244
|
-
headerSubtitle ? /* @__PURE__ */ (0,
|
|
8256
|
+
headerSubtitle ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "agg-order-market-subtitle text-agg-base leading-agg-6 text-agg-foreground", children: headerSubtitle }) : null
|
|
8245
8257
|
] });
|
|
8246
8258
|
};
|
|
8247
8259
|
var PlaceOrderResolvedView = ({
|
|
@@ -8250,11 +8262,9 @@ var PlaceOrderResolvedView = ({
|
|
|
8250
8262
|
resolvedClaim,
|
|
8251
8263
|
className
|
|
8252
8264
|
}) => {
|
|
8253
|
-
var _a, _b, _c, _d, _e;
|
|
8254
8265
|
const labels = (0, import_hooks29.useLabels)();
|
|
8255
8266
|
const tradingLabels = labels.trading;
|
|
8256
|
-
|
|
8257
|
-
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
8267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8258
8268
|
Card,
|
|
8259
8269
|
{
|
|
8260
8270
|
className: cn(
|
|
@@ -8263,19 +8273,19 @@ var PlaceOrderResolvedView = ({
|
|
|
8263
8273
|
classNames == null ? void 0 : classNames.root,
|
|
8264
8274
|
className
|
|
8265
8275
|
),
|
|
8266
|
-
children: /* @__PURE__ */ (0,
|
|
8267
|
-
/* @__PURE__ */ (0,
|
|
8268
|
-
/* @__PURE__ */ (0,
|
|
8276
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: cn("agg-order-panel-body flex flex-col", classNames == null ? void 0 : classNames.body), children: [
|
|
8277
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "flex flex-col items-center gap-6 p-8", children: [
|
|
8278
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8269
8279
|
"div",
|
|
8270
8280
|
{
|
|
8271
8281
|
className: cn(
|
|
8272
8282
|
"flex h-15 w-15 items-center justify-center rounded-full",
|
|
8273
8283
|
"bg-agg-primary/15"
|
|
8274
8284
|
),
|
|
8275
|
-
children: /* @__PURE__ */ (0,
|
|
8285
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(Icon, { name: "success-check", className: cn("h-6 w-6", "text-agg-primary") })
|
|
8276
8286
|
}
|
|
8277
8287
|
),
|
|
8278
|
-
/* @__PURE__ */ (0,
|
|
8288
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
|
|
8279
8289
|
"div",
|
|
8280
8290
|
{
|
|
8281
8291
|
className: cn(
|
|
@@ -8283,31 +8293,31 @@ var PlaceOrderResolvedView = ({
|
|
|
8283
8293
|
classNames == null ? void 0 : classNames.content
|
|
8284
8294
|
),
|
|
8285
8295
|
children: [
|
|
8286
|
-
tradingState.market ? /* @__PURE__ */ (0,
|
|
8287
|
-
tradingState.winningOutcome ? /* @__PURE__ */ (0,
|
|
8296
|
+
tradingState.market ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(Typography, { variant: "body", children: tradingState.market.question }) : null,
|
|
8297
|
+
tradingState.winningOutcome ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(Typography, { variant: "body-large-strong", children: tradingLabels.outcome(tradingState.winningOutcome.label) }) : null
|
|
8288
8298
|
]
|
|
8289
8299
|
}
|
|
8290
8300
|
)
|
|
8291
8301
|
] }),
|
|
8292
|
-
resolvedClaim ? /* @__PURE__ */ (0,
|
|
8293
|
-
/* @__PURE__ */ (0,
|
|
8294
|
-
/* @__PURE__ */ (0,
|
|
8295
|
-
/* @__PURE__ */ (0,
|
|
8296
|
-
/* @__PURE__ */ (0,
|
|
8297
|
-
resolvedClaim.resolutionDateLabel ? /* @__PURE__ */ (0,
|
|
8298
|
-
/* @__PURE__ */ (0,
|
|
8299
|
-
/* @__PURE__ */ (0,
|
|
8302
|
+
resolvedClaim ? /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(import_jsx_runtime122.Fragment, { children: [
|
|
8303
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
|
|
8304
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "flex w-full flex-col gap-5 p-6", children: [
|
|
8305
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(Typography, { variant: "body-strong", className: "text-center", children: tradingLabels.resolvedEarningsTitle }),
|
|
8306
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "flex flex-col gap-3 text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
8307
|
+
resolvedClaim.resolutionDateLabel ? /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
8308
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("span", { children: tradingLabels.resolvedResolutionDateLabel }),
|
|
8309
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("span", { className: "font-agg-bold", children: resolvedClaim.resolutionDateLabel })
|
|
8300
8310
|
] }) : null,
|
|
8301
|
-
/* @__PURE__ */ (0,
|
|
8302
|
-
/* @__PURE__ */ (0,
|
|
8303
|
-
/* @__PURE__ */ (0,
|
|
8311
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
8312
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("span", { children: tradingLabels.resolvedSharesLabel }),
|
|
8313
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("span", { className: "font-agg-bold", children: resolvedClaim.sharesLabel })
|
|
8304
8314
|
] }),
|
|
8305
|
-
/* @__PURE__ */ (0,
|
|
8306
|
-
/* @__PURE__ */ (0,
|
|
8307
|
-
/* @__PURE__ */ (0,
|
|
8315
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
8316
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("span", { children: tradingLabels.resolvedTotalPayoutLabel }),
|
|
8317
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("span", { className: "font-agg-bold", children: resolvedClaim.totalPayoutLabel })
|
|
8308
8318
|
] })
|
|
8309
8319
|
] }),
|
|
8310
|
-
resolvedClaim.onClaim ? /* @__PURE__ */ (0,
|
|
8320
|
+
resolvedClaim.onClaim ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8311
8321
|
Button,
|
|
8312
8322
|
{
|
|
8313
8323
|
size: "large",
|
|
@@ -8315,7 +8325,7 @@ var PlaceOrderResolvedView = ({
|
|
|
8315
8325
|
onClick: resolvedClaim.onClaim,
|
|
8316
8326
|
isLoading: resolvedClaim.isClaiming,
|
|
8317
8327
|
disabled: resolvedClaim.isClaiming,
|
|
8318
|
-
children:
|
|
8328
|
+
children: tradingLabels.claimWinnings
|
|
8319
8329
|
}
|
|
8320
8330
|
) : null
|
|
8321
8331
|
] })
|
|
@@ -8328,18 +8338,18 @@ var renderRouteBreakdownRow = (row) => {
|
|
|
8328
8338
|
var _a, _b;
|
|
8329
8339
|
const venueLabel = getTradingVenueLabel(row.venue);
|
|
8330
8340
|
const rowKey = `${row.venue}-${row.label}-${row.priceLabel}-${(_a = row.resultLabel) != null ? _a : ""}`;
|
|
8331
|
-
return /* @__PURE__ */ (0,
|
|
8341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
|
|
8332
8342
|
"div",
|
|
8333
8343
|
{
|
|
8334
8344
|
className: "agg-route-breakdown-row flex items-center justify-between gap-4 text-left",
|
|
8335
8345
|
children: [
|
|
8336
|
-
/* @__PURE__ */ (0,
|
|
8337
|
-
/* @__PURE__ */ (0,
|
|
8338
|
-
/* @__PURE__ */ (0,
|
|
8346
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-route-breakdown-market flex min-w-0 items-center gap-2", children: [
|
|
8347
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(VenueLogo, { venue: row.venue, className: "size-3!", ariaLabel: venueLabel }),
|
|
8348
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "agg-route-breakdown-label truncate text-agg-sm leading-agg-5 text-agg-foreground", children: row.label })
|
|
8339
8349
|
] }),
|
|
8340
|
-
/* @__PURE__ */ (0,
|
|
8341
|
-
/* @__PURE__ */ (0,
|
|
8342
|
-
/* @__PURE__ */ (0,
|
|
8350
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-route-breakdown-value flex shrink-0 items-center gap-2 text-agg-sm leading-agg-5", children: [
|
|
8351
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "text-agg-muted-foreground", children: row.priceLabel }),
|
|
8352
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "text-agg-foreground", children: (_b = row.resultLabel) != null ? _b : "" })
|
|
8343
8353
|
] })
|
|
8344
8354
|
]
|
|
8345
8355
|
},
|
|
@@ -8357,7 +8367,7 @@ var renderRouteCard = ({
|
|
|
8357
8367
|
var _a, _b;
|
|
8358
8368
|
const showSplitDetails = isSelected && isExpanded && card.kind === "split" && !!((_a = card.rows) == null ? void 0 : _a.length);
|
|
8359
8369
|
const ariaLabel = [card.label, card.hint, card.value].filter(Boolean).join(" ");
|
|
8360
|
-
return /* @__PURE__ */ (0,
|
|
8370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8361
8371
|
"button",
|
|
8362
8372
|
{
|
|
8363
8373
|
type: "button",
|
|
@@ -8376,10 +8386,10 @@ var renderRouteCard = ({
|
|
|
8376
8386
|
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"
|
|
8377
8387
|
),
|
|
8378
8388
|
onClick: () => onSelect(card.id),
|
|
8379
|
-
children: /* @__PURE__ */ (0,
|
|
8380
|
-
/* @__PURE__ */ (0,
|
|
8381
|
-
/* @__PURE__ */ (0,
|
|
8382
|
-
card.kind === "split" ? /* @__PURE__ */ (0,
|
|
8389
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-route-card-content relative z-10 flex flex-col gap-3", children: [
|
|
8390
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-route-card-header flex items-center justify-between gap-4", children: [
|
|
8391
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-route-card-meta flex min-w-0 gap-3 items-center", children: [
|
|
8392
|
+
card.kind === "split" ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8383
8393
|
Icon,
|
|
8384
8394
|
{
|
|
8385
8395
|
name: "sparkles-filled",
|
|
@@ -8390,7 +8400,7 @@ var renderRouteCard = ({
|
|
|
8390
8400
|
),
|
|
8391
8401
|
"aria-hidden": "true"
|
|
8392
8402
|
}
|
|
8393
|
-
) : card.venue ? /* @__PURE__ */ (0,
|
|
8403
|
+
) : card.venue ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8394
8404
|
VenueLogo,
|
|
8395
8405
|
{
|
|
8396
8406
|
venue: card.venue,
|
|
@@ -8398,10 +8408,10 @@ var renderRouteCard = ({
|
|
|
8398
8408
|
ariaLabel: getTradingVenueLabel(card.venue)
|
|
8399
8409
|
}
|
|
8400
8410
|
) : null,
|
|
8401
|
-
/* @__PURE__ */ (0,
|
|
8402
|
-
/* @__PURE__ */ (0,
|
|
8403
|
-
/* @__PURE__ */ (0,
|
|
8404
|
-
card.isUnavailable ? /* @__PURE__ */ (0,
|
|
8411
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "flex flex-col gap-1 min-w-0", children: [
|
|
8412
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
8413
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "agg-route-card-title truncate text-agg-sm leading-agg-5 text-agg-foreground", children: card.label }),
|
|
8414
|
+
card.isUnavailable ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8405
8415
|
Icon,
|
|
8406
8416
|
{
|
|
8407
8417
|
name: "lock",
|
|
@@ -8409,7 +8419,7 @@ var renderRouteCard = ({
|
|
|
8409
8419
|
className: "shrink-0 text-agg-muted-foreground",
|
|
8410
8420
|
"aria-hidden": "true"
|
|
8411
8421
|
}
|
|
8412
|
-
) : card.kind === "split" && isSelected ? /* @__PURE__ */ (0,
|
|
8422
|
+
) : card.kind === "split" && isSelected ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8413
8423
|
Icon,
|
|
8414
8424
|
{
|
|
8415
8425
|
name: showSplitDetails ? "chevron-up" : "chevron-down",
|
|
@@ -8419,10 +8429,10 @@ var renderRouteCard = ({
|
|
|
8419
8429
|
}
|
|
8420
8430
|
) : null
|
|
8421
8431
|
] }),
|
|
8422
|
-
card.hint ? /* @__PURE__ */ (0,
|
|
8432
|
+
card.hint ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "agg-route-card-hint text-agg-xs leading-agg-4 text-agg-muted-foreground", children: card.hint }) : null
|
|
8423
8433
|
] })
|
|
8424
8434
|
] }),
|
|
8425
|
-
/* @__PURE__ */ (0,
|
|
8435
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8426
8436
|
"p",
|
|
8427
8437
|
{
|
|
8428
8438
|
className: cn(
|
|
@@ -8434,9 +8444,9 @@ var renderRouteCard = ({
|
|
|
8434
8444
|
}
|
|
8435
8445
|
)
|
|
8436
8446
|
] }),
|
|
8437
|
-
showSplitDetails ? /* @__PURE__ */ (0,
|
|
8438
|
-
/* @__PURE__ */ (0,
|
|
8439
|
-
/* @__PURE__ */ (0,
|
|
8447
|
+
showSplitDetails ? /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(import_jsx_runtime122.Fragment, { children: [
|
|
8448
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "agg-route-card-description text-agg-xs leading-agg-4 text-agg-foreground", children: tradingLabels.splitOrderDescription }),
|
|
8449
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { className: "agg-route-breakdown flex flex-col gap-3", children: (_b = card.rows) == null ? void 0 : _b.map((row) => renderRouteBreakdownRow(row)) })
|
|
8440
8450
|
] }) : null
|
|
8441
8451
|
] })
|
|
8442
8452
|
}
|
|
@@ -8459,7 +8469,7 @@ var renderSubmissionSurface = ({
|
|
|
8459
8469
|
executionVenue: progressState.executionVenue,
|
|
8460
8470
|
labels: tradingLabels
|
|
8461
8471
|
});
|
|
8462
|
-
return /* @__PURE__ */ (0,
|
|
8472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8463
8473
|
Card,
|
|
8464
8474
|
{
|
|
8465
8475
|
className: cn(
|
|
@@ -8468,31 +8478,31 @@ var renderSubmissionSurface = ({
|
|
|
8468
8478
|
classNames == null ? void 0 : classNames.root,
|
|
8469
8479
|
className
|
|
8470
8480
|
),
|
|
8471
|
-
children: /* @__PURE__ */ (0,
|
|
8481
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: cn("agg-order-submission-body flex flex-col gap-6 p-5", classNames == null ? void 0 : classNames.body), children: [
|
|
8472
8482
|
renderCardHeader({
|
|
8473
8483
|
className: classNames == null ? void 0 : classNames.header,
|
|
8474
8484
|
headerSubtitle,
|
|
8475
8485
|
headerImage,
|
|
8476
8486
|
headerTitle
|
|
8477
8487
|
}),
|
|
8478
|
-
/* @__PURE__ */ (0,
|
|
8479
|
-
/* @__PURE__ */ (0,
|
|
8480
|
-
/* @__PURE__ */ (0,
|
|
8481
|
-
/* @__PURE__ */ (0,
|
|
8488
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: cn("agg-order-panel-content flex flex-col gap-6", classNames == null ? void 0 : classNames.content), children: [
|
|
8489
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.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: [
|
|
8490
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(LoadingGlyph, { enableAnimations, className: "h-4 w-4 text-current" }),
|
|
8491
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("span", { children: actionLabel })
|
|
8482
8492
|
] }),
|
|
8483
|
-
/* @__PURE__ */ (0,
|
|
8493
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8484
8494
|
"div",
|
|
8485
8495
|
{
|
|
8486
8496
|
className: "agg-order-submission-steps agg-order-submission-group flex flex-col gap-2",
|
|
8487
8497
|
"data-testid": "agg-order-submission-steps",
|
|
8488
8498
|
children: displayRows.map((step) => {
|
|
8489
|
-
return /* @__PURE__ */ (0,
|
|
8499
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
|
|
8490
8500
|
"div",
|
|
8491
8501
|
{
|
|
8492
8502
|
className: "agg-order-submission-step flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
8493
8503
|
"data-status": step.status,
|
|
8494
8504
|
children: [
|
|
8495
|
-
step.status === "complete" ? /* @__PURE__ */ (0,
|
|
8505
|
+
step.status === "complete" ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8496
8506
|
Icon,
|
|
8497
8507
|
{
|
|
8498
8508
|
name: "check-circle",
|
|
@@ -8500,15 +8510,15 @@ var renderSubmissionSurface = ({
|
|
|
8500
8510
|
className: "h-3 w-3 shrink-0 text-agg-primary",
|
|
8501
8511
|
"aria-hidden": "true"
|
|
8502
8512
|
}
|
|
8503
|
-
) : /* @__PURE__ */ (0,
|
|
8513
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8504
8514
|
LoadingGlyph,
|
|
8505
8515
|
{
|
|
8506
8516
|
enableAnimations,
|
|
8507
8517
|
className: "h-3 w-3 shrink-0 text-agg-primary"
|
|
8508
8518
|
}
|
|
8509
8519
|
),
|
|
8510
|
-
/* @__PURE__ */ (0,
|
|
8511
|
-
step.venue ? /* @__PURE__ */ (0,
|
|
8520
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
8521
|
+
step.venue ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8512
8522
|
VenueLogo,
|
|
8513
8523
|
{
|
|
8514
8524
|
venue: step.venue,
|
|
@@ -8529,7 +8539,7 @@ var renderSubmissionSurface = ({
|
|
|
8529
8539
|
}
|
|
8530
8540
|
);
|
|
8531
8541
|
};
|
|
8532
|
-
var InitiateKycButton = ({ label: label2, onOpen }) => /* @__PURE__ */ (0,
|
|
8542
|
+
var InitiateKycButton = ({ label: label2, onOpen }) => /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8533
8543
|
Button,
|
|
8534
8544
|
{
|
|
8535
8545
|
size: "large",
|
|
@@ -8546,35 +8556,35 @@ var KycVerifyModal = ({
|
|
|
8546
8556
|
isInitiating,
|
|
8547
8557
|
labels
|
|
8548
8558
|
}) => {
|
|
8549
|
-
return /* @__PURE__ */ (0,
|
|
8559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8550
8560
|
Modal,
|
|
8551
8561
|
{
|
|
8552
8562
|
open,
|
|
8553
8563
|
onOpenChange: (next) => {
|
|
8554
8564
|
onOpenChange(next);
|
|
8555
8565
|
},
|
|
8556
|
-
children: /* @__PURE__ */ (0,
|
|
8557
|
-
/* @__PURE__ */ (0,
|
|
8558
|
-
/* @__PURE__ */ (0,
|
|
8559
|
-
/* @__PURE__ */ (0,
|
|
8560
|
-
/* @__PURE__ */ (0,
|
|
8566
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(Modal.Container, { maxWidth: "480px", "aria-label": labels.title, children: [
|
|
8567
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(Dialog2.Title, { className: "sr-only", children: labels.title }),
|
|
8568
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(Dialog2.Description, { className: "sr-only", children: labels.description }),
|
|
8569
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(Modal.Body, { classNames: { root: "sm:px-10 sm:py-12" }, children: [
|
|
8570
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8561
8571
|
"button",
|
|
8562
8572
|
{
|
|
8563
8573
|
type: "button",
|
|
8564
8574
|
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
8565
8575
|
onClick: () => onOpenChange(false),
|
|
8566
8576
|
"aria-label": "Close",
|
|
8567
|
-
children: /* @__PURE__ */ (0,
|
|
8577
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(CloseIcon, { className: "h-6 w-6" })
|
|
8568
8578
|
}
|
|
8569
8579
|
),
|
|
8570
|
-
/* @__PURE__ */ (0,
|
|
8571
|
-
/* @__PURE__ */ (0,
|
|
8572
|
-
/* @__PURE__ */ (0,
|
|
8573
|
-
/* @__PURE__ */ (0,
|
|
8574
|
-
/* @__PURE__ */ (0,
|
|
8580
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "flex flex-col items-center gap-8 text-center", children: [
|
|
8581
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { className: "flex h-[60px] w-[60px] items-center justify-center text-agg-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(UserTrustIcon, { className: "h-[60px] w-[60px]" }) }),
|
|
8582
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "flex flex-col items-center gap-3", children: [
|
|
8583
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: labels.title }),
|
|
8584
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "agg-type-body text-agg-foreground", children: labels.description })
|
|
8575
8585
|
] }),
|
|
8576
|
-
/* @__PURE__ */ (0,
|
|
8577
|
-
/* @__PURE__ */ (0,
|
|
8586
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "flex w-full flex-col items-center gap-5", children: [
|
|
8587
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8578
8588
|
Button,
|
|
8579
8589
|
{
|
|
8580
8590
|
size: "large",
|
|
@@ -8585,7 +8595,7 @@ var KycVerifyModal = ({
|
|
|
8585
8595
|
children: labels.startVerification
|
|
8586
8596
|
}
|
|
8587
8597
|
),
|
|
8588
|
-
/* @__PURE__ */ (0,
|
|
8598
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8589
8599
|
"button",
|
|
8590
8600
|
{
|
|
8591
8601
|
type: "button",
|
|
@@ -8605,27 +8615,27 @@ var KycSuccessModal = ({
|
|
|
8605
8615
|
open,
|
|
8606
8616
|
onOpenChange,
|
|
8607
8617
|
labels
|
|
8608
|
-
}) => /* @__PURE__ */ (0,
|
|
8609
|
-
/* @__PURE__ */ (0,
|
|
8610
|
-
/* @__PURE__ */ (0,
|
|
8611
|
-
/* @__PURE__ */ (0,
|
|
8612
|
-
/* @__PURE__ */ (0,
|
|
8618
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(Modal, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(Modal.Container, { maxWidth: "480px", "aria-label": labels.title, children: [
|
|
8619
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(Dialog2.Title, { className: "sr-only", children: labels.title }),
|
|
8620
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(Dialog2.Description, { className: "sr-only", children: labels.description }),
|
|
8621
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(Modal.Body, { classNames: { root: "px-10 py-12" }, children: [
|
|
8622
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8613
8623
|
"button",
|
|
8614
8624
|
{
|
|
8615
8625
|
type: "button",
|
|
8616
8626
|
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
8617
8627
|
onClick: () => onOpenChange(false),
|
|
8618
8628
|
"aria-label": "Close",
|
|
8619
|
-
children: /* @__PURE__ */ (0,
|
|
8629
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(CloseIcon, { className: "h-6 w-6" })
|
|
8620
8630
|
}
|
|
8621
8631
|
),
|
|
8622
|
-
/* @__PURE__ */ (0,
|
|
8623
|
-
/* @__PURE__ */ (0,
|
|
8624
|
-
/* @__PURE__ */ (0,
|
|
8625
|
-
/* @__PURE__ */ (0,
|
|
8626
|
-
/* @__PURE__ */ (0,
|
|
8632
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "flex flex-col items-center gap-8 text-center", children: [
|
|
8633
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { className: "flex h-[60px] w-[60px] items-center justify-center rounded-full bg-agg-success/15", children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(SuccessCheckIcon, { className: "h-6 w-6 text-agg-success" }) }),
|
|
8634
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "flex flex-col items-center gap-3", children: [
|
|
8635
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: labels.title }),
|
|
8636
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "agg-type-body text-agg-foreground", children: labels.description })
|
|
8627
8637
|
] }),
|
|
8628
|
-
/* @__PURE__ */ (0,
|
|
8638
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
8629
8639
|
Button,
|
|
8630
8640
|
{
|
|
8631
8641
|
variant: "secondary",
|
|
@@ -8651,6 +8661,7 @@ var PlaceOrder = ({
|
|
|
8651
8661
|
onClose,
|
|
8652
8662
|
onOutcomeChange,
|
|
8653
8663
|
onPrimaryAction,
|
|
8664
|
+
onBeforePrimaryAction,
|
|
8654
8665
|
onTabChange,
|
|
8655
8666
|
onSuccess,
|
|
8656
8667
|
onError,
|
|
@@ -8672,10 +8683,10 @@ var PlaceOrder = ({
|
|
|
8672
8683
|
const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
|
|
8673
8684
|
const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
|
|
8674
8685
|
const selectedOutcomeId = (_c = tradingContext == null ? void 0 : tradingContext.selectedOutcomeId) != null ? _c : null;
|
|
8675
|
-
const resolvedEventTradingState = (0,
|
|
8686
|
+
const resolvedEventTradingState = (0, import_react10.useMemo)(() => {
|
|
8676
8687
|
return eventTradingState != null ? eventTradingState : (0, import_hooks29.resolveEventTradingState)(selectedEvent);
|
|
8677
8688
|
}, [eventTradingState, selectedEvent]);
|
|
8678
|
-
const scopedSelectedEvent = (0,
|
|
8689
|
+
const scopedSelectedEvent = (0, import_react10.useMemo)(() => {
|
|
8679
8690
|
var _a2;
|
|
8680
8691
|
if (!selectedEvent) return null;
|
|
8681
8692
|
const primaryMarketId = (_a2 = resolvedEventTradingState.primaryMarket) == null ? void 0 : _a2.id;
|
|
@@ -8685,7 +8696,7 @@ var PlaceOrder = ({
|
|
|
8685
8696
|
);
|
|
8686
8697
|
return isSelectedEventInScope ? selectedEvent : null;
|
|
8687
8698
|
}, [(_d = resolvedEventTradingState.primaryMarket) == null ? void 0 : _d.id, selectedEvent]);
|
|
8688
|
-
const scopedSelectedMarket = (0,
|
|
8699
|
+
const scopedSelectedMarket = (0, import_react10.useMemo)(() => {
|
|
8689
8700
|
if (!selectedMarket) return resolvedEventTradingState.primaryMarket;
|
|
8690
8701
|
const isSelectedMarketInScope = resolvedEventTradingState.marketStates.some(
|
|
8691
8702
|
(item) => item.market.id === selectedMarket.id
|
|
@@ -8700,10 +8711,10 @@ var PlaceOrder = ({
|
|
|
8700
8711
|
(outcome) => outcome.label.trim().toLowerCase() === "yes"
|
|
8701
8712
|
)) != null ? _f : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes[0]) != null ? _g : null;
|
|
8702
8713
|
const scopedSelectedOutcomeId = (_h = scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.id) != null ? _h : null;
|
|
8703
|
-
const resolvedTradingState = (0,
|
|
8714
|
+
const resolvedTradingState = (0, import_react10.useMemo)(() => {
|
|
8704
8715
|
return (0, import_hooks29.resolveMarketTradingState)(scopedSelectedMarket);
|
|
8705
8716
|
}, [scopedSelectedMarket]);
|
|
8706
|
-
const resolvedReadOnlyMarket = (0,
|
|
8717
|
+
const resolvedReadOnlyMarket = (0, import_react10.useMemo)(() => {
|
|
8707
8718
|
var _a2;
|
|
8708
8719
|
if (resolvedEventTradingState.kind !== "resolved") {
|
|
8709
8720
|
return scopedSelectedMarket;
|
|
@@ -8714,10 +8725,10 @@ var PlaceOrder = ({
|
|
|
8714
8725
|
resolvedEventTradingState.primaryMarket,
|
|
8715
8726
|
scopedSelectedMarket
|
|
8716
8727
|
]);
|
|
8717
|
-
const resolvedReadOnlyTradingState = (0,
|
|
8728
|
+
const resolvedReadOnlyTradingState = (0, import_react10.useMemo)(() => {
|
|
8718
8729
|
return (0, import_hooks29.resolveMarketTradingState)(resolvedReadOnlyMarket);
|
|
8719
8730
|
}, [resolvedReadOnlyMarket]);
|
|
8720
|
-
const orderEligibility = (0,
|
|
8731
|
+
const orderEligibility = (0, import_react10.useMemo)(
|
|
8721
8732
|
() => (0, import_hooks29.resolveOrderEligibility)({
|
|
8722
8733
|
event: scopedSelectedEvent,
|
|
8723
8734
|
market: scopedSelectedMarket,
|
|
@@ -8735,7 +8746,7 @@ var PlaceOrder = ({
|
|
|
8735
8746
|
enabled: Boolean(isAuthenticated && isPaperMode),
|
|
8736
8747
|
mode: "paper"
|
|
8737
8748
|
});
|
|
8738
|
-
const paperTotalBalance = (0,
|
|
8749
|
+
const paperTotalBalance = (0, import_react10.useMemo)(() => {
|
|
8739
8750
|
var _a2, _b2;
|
|
8740
8751
|
const cash = (_b2 = (_a2 = paperBalancesQuery.balances) == null ? void 0 : _a2.cash) != null ? _b2 : [];
|
|
8741
8752
|
return cash.reduce((sum, token) => {
|
|
@@ -8770,36 +8781,37 @@ var PlaceOrder = ({
|
|
|
8770
8781
|
const clusterBestMidpointsByOutcomeId = (_i = clusterMidpointResult.bestMidpointsByOutcomeId) != null ? _i : clusterMidpointResult.prices;
|
|
8771
8782
|
const clusterBestMidpoint = clusterMidpointResult.bestMidpoint;
|
|
8772
8783
|
const clusterBestPricesRest = clusterMidpointResult.bestPrices;
|
|
8773
|
-
const clusterBestPrices = (0,
|
|
8784
|
+
const clusterBestPrices = (0, import_react10.useMemo)(
|
|
8774
8785
|
() => (0, import_hooks29.mergeBestPricesPreferringLive)(clusterBestPricesRest, wsBestPrices),
|
|
8775
8786
|
[clusterBestPricesRest, wsBestPrices]
|
|
8776
8787
|
);
|
|
8777
|
-
const outcomes = (0,
|
|
8788
|
+
const outcomes = (0, import_react10.useMemo)(
|
|
8778
8789
|
() => mapVenueMarketOutcomesToPlaceOrderOutcomes(scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes),
|
|
8779
8790
|
[scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes]
|
|
8780
8791
|
);
|
|
8781
|
-
const buyTabRef = (0,
|
|
8782
|
-
const sellTabRef = (0,
|
|
8783
|
-
const [internalTab, setInternalTab] = (0,
|
|
8784
|
-
const [internalAmount, setInternalAmount] = (0,
|
|
8785
|
-
const [sellFilledForOutcomeId, setSellFilledForOutcomeId] = (0,
|
|
8786
|
-
const [internalSlippage] = (0,
|
|
8787
|
-
const [isRoutesExpanded, setIsRoutesExpanded] = (0,
|
|
8788
|
-
const [selectedRouteCardId, setSelectedRouteCardId] = (0,
|
|
8789
|
-
const [isSplitDetailOpen, setIsSplitDetailOpen] = (0,
|
|
8790
|
-
const [submissionFeedback, setSubmissionFeedback] = (0,
|
|
8791
|
-
const [submissionProgressState, setSubmissionProgressState] = (0,
|
|
8792
|
-
const
|
|
8793
|
-
const
|
|
8794
|
-
const
|
|
8795
|
-
(0,
|
|
8792
|
+
const buyTabRef = (0, import_react10.useRef)(null);
|
|
8793
|
+
const sellTabRef = (0, import_react10.useRef)(null);
|
|
8794
|
+
const [internalTab, setInternalTab] = (0, import_react10.useState)("buy");
|
|
8795
|
+
const [internalAmount, setInternalAmount] = (0, import_react10.useState)(PLACE_ORDER_DEFAULT_AMOUNT);
|
|
8796
|
+
const [sellFilledForOutcomeId, setSellFilledForOutcomeId] = (0, import_react10.useState)(null);
|
|
8797
|
+
const [internalSlippage] = (0, import_react10.useState)(DEFAULT_SLIPPAGE_VALUE);
|
|
8798
|
+
const [isRoutesExpanded, setIsRoutesExpanded] = (0, import_react10.useState)(false);
|
|
8799
|
+
const [selectedRouteCardId, setSelectedRouteCardId] = (0, import_react10.useState)(null);
|
|
8800
|
+
const [isSplitDetailOpen, setIsSplitDetailOpen] = (0, import_react10.useState)(false);
|
|
8801
|
+
const [submissionFeedback, setSubmissionFeedback] = (0, import_react10.useState)(null);
|
|
8802
|
+
const [submissionProgressState, setSubmissionProgressState] = (0, import_react10.useState)(null);
|
|
8803
|
+
const [isBeforeActionPending, setIsBeforeActionPending] = (0, import_react10.useState)(false);
|
|
8804
|
+
const executionDebugStoreRef = (0, import_react10.useRef)(null);
|
|
8805
|
+
const executionDebugAttemptIdRef = (0, import_react10.useRef)(null);
|
|
8806
|
+
const submittedSelectionRef = (0, import_react10.useRef)(null);
|
|
8807
|
+
(0, import_react10.useEffect)(() => {
|
|
8796
8808
|
if (!isExecutionDebugEnabled) {
|
|
8797
8809
|
executionDebugStoreRef.current = null;
|
|
8798
8810
|
return;
|
|
8799
8811
|
}
|
|
8800
8812
|
executionDebugStoreRef.current = enableExecutionDebugInBrowser();
|
|
8801
8813
|
}, [isExecutionDebugEnabled]);
|
|
8802
|
-
(0,
|
|
8814
|
+
(0, import_react10.useEffect)(() => {
|
|
8803
8815
|
if (!isExecutionDebugEnabled) return;
|
|
8804
8816
|
const store = executionDebugStoreRef.current;
|
|
8805
8817
|
if (!store) return;
|
|
@@ -8812,7 +8824,7 @@ var PlaceOrder = ({
|
|
|
8812
8824
|
scopedSelectedOutcomeId
|
|
8813
8825
|
]);
|
|
8814
8826
|
const debouncedAmount = (0, import_hooks29.useDebouncedValue)(internalAmount, 300);
|
|
8815
|
-
const isSell = (0,
|
|
8827
|
+
const isSell = (0, import_react10.useMemo)(() => internalTab === "sell", [internalTab]);
|
|
8816
8828
|
const {
|
|
8817
8829
|
positions: executionPositions,
|
|
8818
8830
|
isLoading: isExecutionPositionsLoading,
|
|
@@ -8835,7 +8847,7 @@ var PlaceOrder = ({
|
|
|
8835
8847
|
mode: isPaperMode ? "paper" : void 0,
|
|
8836
8848
|
enabled: debouncedAmount > 0 && orderEligibility.canPlaceOrder
|
|
8837
8849
|
});
|
|
8838
|
-
const currentSellableShares = (0,
|
|
8850
|
+
const currentSellableShares = (0, import_react10.useMemo)(() => {
|
|
8839
8851
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
8840
8852
|
const sharesFromQuote = (_b2 = (_a2 = smartRoute.data) == null ? void 0 : _a2.positionAvailability) == null ? void 0 : _b2.totalSellableShares;
|
|
8841
8853
|
if (typeof sharesFromQuote === "number" && Number.isFinite(sharesFromQuote)) {
|
|
@@ -8872,12 +8884,12 @@ var PlaceOrder = ({
|
|
|
8872
8884
|
(_k = (_j = smartRoute.data) == null ? void 0 : _j.positionAvailability) == null ? void 0 : _k.totalSellableShares
|
|
8873
8885
|
]);
|
|
8874
8886
|
const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((_m = (_l = smartRoute.data) == null ? void 0 : _l.positionAvailability) == null ? void 0 : _m.totalSellableShares) === "number") && (isExecutionPositionsLoading || isExecutionPositionsFetching);
|
|
8875
|
-
const displayedCurrentSellableShares = (0,
|
|
8887
|
+
const displayedCurrentSellableShares = (0, import_react10.useMemo)(() => {
|
|
8876
8888
|
if (!Number.isFinite(currentSellableShares) || currentSellableShares <= 0) return 0;
|
|
8877
8889
|
return Math.floor(currentSellableShares * 100) / 100;
|
|
8878
8890
|
}, [currentSellableShares]);
|
|
8879
8891
|
const isAtMaxSellableShares = isSell && displayedCurrentSellableShares > 0 && Math.abs(internalAmount - displayedCurrentSellableShares) < 1e-9;
|
|
8880
|
-
(0,
|
|
8892
|
+
(0, import_react10.useEffect)(() => {
|
|
8881
8893
|
if (submissionProgressState != null) return;
|
|
8882
8894
|
if (!isSell || isCurrentSellableSharesLoading) return;
|
|
8883
8895
|
if (scopedSelectedOutcomeId === sellFilledForOutcomeId) return;
|
|
@@ -8893,7 +8905,7 @@ var PlaceOrder = ({
|
|
|
8893
8905
|
onAmountChange,
|
|
8894
8906
|
submissionProgressState
|
|
8895
8907
|
]);
|
|
8896
|
-
const routeCards = (0,
|
|
8908
|
+
const routeCards = (0, import_react10.useMemo)(
|
|
8897
8909
|
() => smartRoute.data ? buildLiveRouteCards({
|
|
8898
8910
|
eventVenues: scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets.map((market) => market.venue),
|
|
8899
8911
|
labels: tradingLabels,
|
|
@@ -8902,7 +8914,7 @@ var PlaceOrder = ({
|
|
|
8902
8914
|
}) : [],
|
|
8903
8915
|
[smartRoute.data, tradingLabels, isSell, scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets]
|
|
8904
8916
|
);
|
|
8905
|
-
const resolvedSelectedRouteCardId = (0,
|
|
8917
|
+
const resolvedSelectedRouteCardId = (0, import_react10.useMemo)(() => {
|
|
8906
8918
|
var _a2, _b2, _c2, _d2;
|
|
8907
8919
|
if (routeCards.length === 0) return null;
|
|
8908
8920
|
if (selectedRouteCardId && routeCards.some((card) => card.id === selectedRouteCardId && !card.isUnavailable)) {
|
|
@@ -8910,7 +8922,7 @@ var PlaceOrder = ({
|
|
|
8910
8922
|
}
|
|
8911
8923
|
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;
|
|
8912
8924
|
}, [routeCards, selectedRouteCardId]);
|
|
8913
|
-
(0,
|
|
8925
|
+
(0, import_react10.useEffect)(() => {
|
|
8914
8926
|
if (routeCards.length === 0) {
|
|
8915
8927
|
setSelectedRouteCardId(null);
|
|
8916
8928
|
setIsRoutesExpanded(false);
|
|
@@ -8922,22 +8934,22 @@ var PlaceOrder = ({
|
|
|
8922
8934
|
}
|
|
8923
8935
|
}, [resolvedSelectedRouteCardId, routeCards.length, selectedRouteCardId]);
|
|
8924
8936
|
const isSubmissionLocked = submissionProgressState != null;
|
|
8925
|
-
const isSubmissionLockedRef = (0,
|
|
8937
|
+
const isSubmissionLockedRef = (0, import_react10.useRef)(isSubmissionLocked);
|
|
8926
8938
|
isSubmissionLockedRef.current = isSubmissionLocked;
|
|
8927
|
-
(0,
|
|
8939
|
+
(0, import_react10.useEffect)(() => {
|
|
8928
8940
|
if (isSubmissionLockedRef.current) return;
|
|
8929
8941
|
setSubmissionFeedback(null);
|
|
8930
8942
|
setSubmissionProgressState(null);
|
|
8931
8943
|
}, [internalAmount, internalSlippage, internalTab, scopedSelectedOutcomeId]);
|
|
8932
8944
|
const orderedRouteCards = routeCards;
|
|
8933
8945
|
const selectedRouteCard = (_o = (_n = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _n : orderedRouteCards[0]) != null ? _o : null;
|
|
8934
|
-
const isKalshiRoute = (0,
|
|
8946
|
+
const isKalshiRoute = (0, import_react10.useMemo)(() => {
|
|
8935
8947
|
if (selectedRouteCard) {
|
|
8936
8948
|
return selectedRouteCard.venue === "kalshi" || selectedRouteCard.quoteData.fills.some((f) => f.venue === "kalshi");
|
|
8937
8949
|
}
|
|
8938
8950
|
return (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === "kalshi";
|
|
8939
8951
|
}, [selectedRouteCard, scopedSelectedMarket]);
|
|
8940
|
-
const isKalshiVerified = (0,
|
|
8952
|
+
const isKalshiVerified = (0, import_react10.useMemo)(() => {
|
|
8941
8953
|
var _a2;
|
|
8942
8954
|
const kalshiAccount = (_a2 = user == null ? void 0 : user.venueAccounts) == null ? void 0 : _a2.find((va) => va.venue === "kalshi");
|
|
8943
8955
|
return (kalshiAccount == null ? void 0 : kalshiAccount.kycStatus) === "verified";
|
|
@@ -8957,7 +8969,7 @@ var PlaceOrder = ({
|
|
|
8957
8969
|
walletAddress: (_p = (0, import_hooks29.getWalletAddressFromUserProfile)(user)) != null ? _p : null,
|
|
8958
8970
|
onError
|
|
8959
8971
|
});
|
|
8960
|
-
const handleRouteCardSelect = (0,
|
|
8972
|
+
const handleRouteCardSelect = (0, import_react10.useCallback)(
|
|
8961
8973
|
(cardId) => {
|
|
8962
8974
|
if (cardId === resolvedSelectedRouteCardId) {
|
|
8963
8975
|
const card = routeCards.find((c) => c.id === cardId);
|
|
@@ -8979,7 +8991,7 @@ var PlaceOrder = ({
|
|
|
8979
8991
|
const headerImage = (_w = (_v = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.image) != null ? _v : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.image) != null ? _w : null;
|
|
8980
8992
|
const headerTitle = (_y = (_x = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _x : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _y : "";
|
|
8981
8993
|
const headerSubtitle = (_z = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _z : "";
|
|
8982
|
-
const buildExecutionSummary = (0,
|
|
8994
|
+
const buildExecutionSummary = (0, import_react10.useCallback)(
|
|
8983
8995
|
(quoteData, executionVenue, orderId, partialFillSummary) => {
|
|
8984
8996
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
8985
8997
|
if (!quoteData) return void 0;
|
|
@@ -9055,7 +9067,7 @@ var PlaceOrder = ({
|
|
|
9055
9067
|
tradingLabels
|
|
9056
9068
|
]
|
|
9057
9069
|
);
|
|
9058
|
-
(0,
|
|
9070
|
+
(0, import_react10.useEffect)(() => {
|
|
9059
9071
|
if (executionProgress.phase === "order_submitted") {
|
|
9060
9072
|
const submittedOrder = executionProgress.submittedOrders[0];
|
|
9061
9073
|
setSubmissionProgressState((prev) => {
|
|
@@ -9068,7 +9080,7 @@ var PlaceOrder = ({
|
|
|
9068
9080
|
});
|
|
9069
9081
|
}
|
|
9070
9082
|
}, [executionProgress.phase, executionProgress.submittedOrders]);
|
|
9071
|
-
(0,
|
|
9083
|
+
(0, import_react10.useEffect)(() => {
|
|
9072
9084
|
var _a2, _b2;
|
|
9073
9085
|
const dp = executionProgress.dagProgress;
|
|
9074
9086
|
if (!dp) return;
|
|
@@ -9119,7 +9131,7 @@ var PlaceOrder = ({
|
|
|
9119
9131
|
return __spreadProps(__spreadValues({}, prev), { dagProgress: dp });
|
|
9120
9132
|
});
|
|
9121
9133
|
}, [executionProgress.dagProgress, tradingLabels]);
|
|
9122
|
-
(0,
|
|
9134
|
+
(0, import_react10.useEffect)(() => {
|
|
9123
9135
|
const orderIds = submissionProgressState == null ? void 0 : submissionProgressState.orderIds;
|
|
9124
9136
|
if (!(orderIds == null ? void 0 : orderIds.length)) return;
|
|
9125
9137
|
const aggregateStatus = deriveAggregateOrderStatus(
|
|
@@ -9180,7 +9192,7 @@ var PlaceOrder = ({
|
|
|
9180
9192
|
tradingLabels
|
|
9181
9193
|
]);
|
|
9182
9194
|
const estDurationMs = (selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) && typeof selectedRouteCard.quoteData.estDurationMs === "number" ? selectedRouteCard.quoteData.estDurationMs : 6e4;
|
|
9183
|
-
(0,
|
|
9195
|
+
(0, import_react10.useEffect)(() => {
|
|
9184
9196
|
const phase = submissionProgressState == null ? void 0 : submissionProgressState.phase;
|
|
9185
9197
|
if (phase !== "submitting" && phase !== "executing") return;
|
|
9186
9198
|
const timeoutMs = Math.max(6e4, 2 * estDurationMs);
|
|
@@ -9195,7 +9207,7 @@ var PlaceOrder = ({
|
|
|
9195
9207
|
}, timeoutMs);
|
|
9196
9208
|
return () => clearTimeout(id);
|
|
9197
9209
|
}, [submissionProgressState == null ? void 0 : submissionProgressState.phase, estDurationMs]);
|
|
9198
|
-
(0,
|
|
9210
|
+
(0, import_react10.useEffect)(() => {
|
|
9199
9211
|
var _a2, _b2;
|
|
9200
9212
|
if (!submissionProgressState) return;
|
|
9201
9213
|
onExecutionStateChange == null ? void 0 : onExecutionStateChange(submissionProgressState);
|
|
@@ -9250,7 +9262,7 @@ var PlaceOrder = ({
|
|
|
9250
9262
|
const isBelowVenueMinimumFromQuote = isQuoteBelowVenueMinimum(activeQuoteData);
|
|
9251
9263
|
const isBelowMinimum = isBelowClientMinimum || isBelowVenueMinimumFromQuote;
|
|
9252
9264
|
const belowMinimumMessage = isBelowClientMinimum ? tradingLabels.minimumOrderAmount(MIN_BUY_ORDER_AMOUNT) : tradingLabels.minOrderSizeViolated;
|
|
9253
|
-
const quoteStatus = (0,
|
|
9265
|
+
const quoteStatus = (0, import_react10.useMemo)(() => {
|
|
9254
9266
|
if (!orderEligibility.canPlaceOrder) return void 0;
|
|
9255
9267
|
return resolvePlaceOrderQuoteStatus({
|
|
9256
9268
|
amount: internalAmount,
|
|
@@ -9265,7 +9277,7 @@ var PlaceOrder = ({
|
|
|
9265
9277
|
scopedSelectedMarket,
|
|
9266
9278
|
tradingLabels
|
|
9267
9279
|
]);
|
|
9268
|
-
const smartRouteErrorMessage = (0,
|
|
9280
|
+
const smartRouteErrorMessage = (0, import_react10.useMemo)(() => {
|
|
9269
9281
|
if (!smartRoute.error) return null;
|
|
9270
9282
|
return normalizePlaceOrderErrorMessage({
|
|
9271
9283
|
errorMessage: smartRoute.error.message,
|
|
@@ -9274,7 +9286,7 @@ var PlaceOrder = ({
|
|
|
9274
9286
|
});
|
|
9275
9287
|
}, [smartRoute.error, tradingLabels]);
|
|
9276
9288
|
const progressActionLabel = (internalTab === "buy" ? tradingLabels.buyingOutcome(selectedOutcomeLabel) : tradingLabels.sellingOutcome(selectedOutcomeLabel)).trim();
|
|
9277
|
-
const canRetryRemaining = (0,
|
|
9289
|
+
const canRetryRemaining = (0, import_react10.useMemo)(() => {
|
|
9278
9290
|
const remaining = getPlaceOrderUnfilledRemaining({
|
|
9279
9291
|
originalAmount: internalAmount,
|
|
9280
9292
|
tradeSide: internalTab,
|
|
@@ -9284,7 +9296,7 @@ var PlaceOrder = ({
|
|
|
9284
9296
|
return remaining >= minRemainder;
|
|
9285
9297
|
}, [executionProgress.terminalOrderEvents, internalAmount, internalTab, isSell]);
|
|
9286
9298
|
const PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD = 0.95;
|
|
9287
|
-
const shouldAutoSkipPartialFill = (0,
|
|
9299
|
+
const shouldAutoSkipPartialFill = (0, import_react10.useMemo)(() => {
|
|
9288
9300
|
if (internalAmount <= 0) return false;
|
|
9289
9301
|
const remaining = getPlaceOrderUnfilledRemaining({
|
|
9290
9302
|
originalAmount: internalAmount,
|
|
@@ -9295,7 +9307,7 @@ var PlaceOrder = ({
|
|
|
9295
9307
|
const fillRatio = filled / internalAmount;
|
|
9296
9308
|
return fillRatio >= PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD || !canRetryRemaining;
|
|
9297
9309
|
}, [canRetryRemaining, executionProgress.terminalOrderEvents, internalAmount, internalTab]);
|
|
9298
|
-
const failureSummary = (0,
|
|
9310
|
+
const failureSummary = (0, import_react10.useMemo)(() => {
|
|
9299
9311
|
var _a2;
|
|
9300
9312
|
if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return void 0;
|
|
9301
9313
|
return buildPlaceOrderFailureSummary({
|
|
@@ -9324,7 +9336,7 @@ var PlaceOrder = ({
|
|
|
9324
9336
|
submissionProgressState,
|
|
9325
9337
|
tradingLabels
|
|
9326
9338
|
]);
|
|
9327
|
-
const displayedToWinHint = (0,
|
|
9339
|
+
const displayedToWinHint = (0, import_react10.useMemo)(() => {
|
|
9328
9340
|
var _a2, _b2, _c2, _d2;
|
|
9329
9341
|
if (!selectedRouteCard) return "";
|
|
9330
9342
|
if (selectedRouteCard.isUnavailable) {
|
|
@@ -9335,12 +9347,12 @@ var PlaceOrder = ({
|
|
|
9335
9347
|
}, [selectedRouteCard, tradingLabels]);
|
|
9336
9348
|
const displayedToWinValue = (_C = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _C : 0;
|
|
9337
9349
|
const activeFeeBreakdown = activeQuoteData == null ? void 0 : activeQuoteData.feeBreakdown;
|
|
9338
|
-
const estimatedFeesValue = (0,
|
|
9350
|
+
const estimatedFeesValue = (0, import_react10.useMemo)(() => {
|
|
9339
9351
|
if (!activeFeeBreakdown) return null;
|
|
9340
9352
|
const totalFees = activeFeeBreakdown.venueFees + activeFeeBreakdown.bridgeFees + activeFeeBreakdown.executionGas;
|
|
9341
9353
|
return formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
9342
9354
|
}, [activeFeeBreakdown]);
|
|
9343
|
-
const feeBreakdownRows = (0,
|
|
9355
|
+
const feeBreakdownRows = (0, import_react10.useMemo)(() => {
|
|
9344
9356
|
if (!activeFeeBreakdown) return [];
|
|
9345
9357
|
return [
|
|
9346
9358
|
{
|
|
@@ -9374,16 +9386,16 @@ var PlaceOrder = ({
|
|
|
9374
9386
|
}
|
|
9375
9387
|
];
|
|
9376
9388
|
}, [activeFeeBreakdown, tradingLabels]);
|
|
9377
|
-
const isActionLoading = isPrimaryActionLoading || executeManaged.isPending;
|
|
9389
|
+
const isActionLoading = isPrimaryActionLoading || executeManaged.isPending || isBeforeActionPending;
|
|
9378
9390
|
const selectedRouteGeoBlocked = (_D = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _D : false;
|
|
9379
|
-
const geoBlockedVenuesFromWarnings = (0,
|
|
9391
|
+
const geoBlockedVenuesFromWarnings = (0, import_react10.useMemo)(
|
|
9380
9392
|
() => {
|
|
9381
9393
|
var _a2;
|
|
9382
9394
|
return extractGeoBlockedVenues((_a2 = smartRoute.data) == null ? void 0 : _a2.warnings);
|
|
9383
9395
|
},
|
|
9384
9396
|
[(_E = smartRoute.data) == null ? void 0 : _E.warnings]
|
|
9385
9397
|
);
|
|
9386
|
-
const isPrimaryVenueGeoBlocked = (0,
|
|
9398
|
+
const isPrimaryVenueGeoBlocked = (0, import_react10.useMemo)(() => {
|
|
9387
9399
|
var _a2, _b2;
|
|
9388
9400
|
if (!selectedRouteCard || selectedRouteCard.isUnavailable) return false;
|
|
9389
9401
|
const fills = (_b2 = (_a2 = selectedRouteCard.quoteData) == null ? void 0 : _a2.fills) != null ? _b2 : [];
|
|
@@ -9394,7 +9406,7 @@ var PlaceOrder = ({
|
|
|
9394
9406
|
const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isQuoteInsufficientBalance || isBelowMinimum || isQuoteLoading || !selectedRouteCard || !selectedRouteCard.quoteData.quoteId || selectedRouteGeoBlocked || !isAuthenticated || quoteStatus !== void 0;
|
|
9395
9407
|
const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (orderedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading);
|
|
9396
9408
|
const shouldShowRouteToggle = !isQuoteLoading && orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
|
|
9397
|
-
const handleReturnToOrderForm = (0,
|
|
9409
|
+
const handleReturnToOrderForm = (0, import_react10.useCallback)(() => {
|
|
9398
9410
|
const submittedSelection = submittedSelectionRef.current;
|
|
9399
9411
|
submittedSelectionRef.current = null;
|
|
9400
9412
|
setSubmissionProgressState(null);
|
|
@@ -9415,7 +9427,7 @@ var PlaceOrder = ({
|
|
|
9415
9427
|
const shareUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(shareText)}`;
|
|
9416
9428
|
window.open(shareUrl, "_blank", "noopener,noreferrer");
|
|
9417
9429
|
};
|
|
9418
|
-
const handleExecuteQuote = (0,
|
|
9430
|
+
const handleExecuteQuote = (0, import_react10.useCallback)(
|
|
9419
9431
|
(quoteData) => __async(null, null, function* () {
|
|
9420
9432
|
var _a2, _b2, _c2;
|
|
9421
9433
|
const quoteId = quoteData == null ? void 0 : quoteData.quoteId;
|
|
@@ -9513,7 +9525,7 @@ var PlaceOrder = ({
|
|
|
9513
9525
|
tradingLabels.quoteUnavailable
|
|
9514
9526
|
]
|
|
9515
9527
|
);
|
|
9516
|
-
const handleSkipToSuccess = (0,
|
|
9528
|
+
const handleSkipToSuccess = (0, import_react10.useCallback)(() => {
|
|
9517
9529
|
const primaryFilledEvent = executionProgress.terminalOrderEvents.find(
|
|
9518
9530
|
(e) => e.event === "filled" || e.event === "partial_fill"
|
|
9519
9531
|
);
|
|
@@ -9538,7 +9550,7 @@ var PlaceOrder = ({
|
|
|
9538
9550
|
failureSummary,
|
|
9539
9551
|
selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData
|
|
9540
9552
|
]);
|
|
9541
|
-
(0,
|
|
9553
|
+
(0, import_react10.useEffect)(() => {
|
|
9542
9554
|
if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return;
|
|
9543
9555
|
if ((failureSummary == null ? void 0 : failureSummary.kind) !== "partial_fill") return;
|
|
9544
9556
|
if (!shouldAutoSkipPartialFill) return;
|
|
@@ -9549,7 +9561,7 @@ var PlaceOrder = ({
|
|
|
9549
9561
|
shouldAutoSkipPartialFill,
|
|
9550
9562
|
submissionProgressState == null ? void 0 : submissionProgressState.phase
|
|
9551
9563
|
]);
|
|
9552
|
-
const handleRetrySubmission = (0,
|
|
9564
|
+
const handleRetrySubmission = (0, import_react10.useCallback)(() => __async(null, null, function* () {
|
|
9553
9565
|
var _a2, _b2, _c2;
|
|
9554
9566
|
if (!orderEligibility.canPlaceOrder || (failureSummary == null ? void 0 : failureSummary.kind) === "generic") {
|
|
9555
9567
|
handleReturnToOrderForm();
|
|
@@ -9643,7 +9655,7 @@ var PlaceOrder = ({
|
|
|
9643
9655
|
]);
|
|
9644
9656
|
const resolvedStatusClassName = cn(classNames == null ? void 0 : classNames.root, className);
|
|
9645
9657
|
if (isLoading) {
|
|
9646
|
-
return /* @__PURE__ */ (0,
|
|
9658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
9647
9659
|
Skeleton,
|
|
9648
9660
|
{
|
|
9649
9661
|
ariaLabel: labels.common.loading,
|
|
@@ -9654,7 +9666,7 @@ var PlaceOrder = ({
|
|
|
9654
9666
|
}
|
|
9655
9667
|
if (submissionProgressState) {
|
|
9656
9668
|
if (submissionProgressState.phase === "success" && submissionProgressState.summary) {
|
|
9657
|
-
return /* @__PURE__ */ (0,
|
|
9669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
9658
9670
|
PlaceOrderSuccessView,
|
|
9659
9671
|
{
|
|
9660
9672
|
className: resolvedStatusClassName,
|
|
@@ -9666,7 +9678,7 @@ var PlaceOrder = ({
|
|
|
9666
9678
|
);
|
|
9667
9679
|
}
|
|
9668
9680
|
if (submissionProgressState.phase === "failed") {
|
|
9669
|
-
return /* @__PURE__ */ (0,
|
|
9681
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
9670
9682
|
PlaceOrderFailureView,
|
|
9671
9683
|
{
|
|
9672
9684
|
className: resolvedStatusClassName,
|
|
@@ -9740,7 +9752,7 @@ var PlaceOrder = ({
|
|
|
9740
9752
|
});
|
|
9741
9753
|
};
|
|
9742
9754
|
const handlePrimaryAction = () => __async(null, null, function* () {
|
|
9743
|
-
var _a2;
|
|
9755
|
+
var _a2, _b2, _c2;
|
|
9744
9756
|
if (!orderEligibility.canPlaceOrder) {
|
|
9745
9757
|
setSubmissionFeedback({
|
|
9746
9758
|
message: (_a2 = resolveOrderEligibilityMessage(labels, orderEligibility.reason)) != null ? _a2 : tradingLabels.orderFailed,
|
|
@@ -9750,6 +9762,26 @@ var PlaceOrder = ({
|
|
|
9750
9762
|
}
|
|
9751
9763
|
if (!selectedRouteCard) return;
|
|
9752
9764
|
setSubmissionFeedback(null);
|
|
9765
|
+
if (onBeforePrimaryAction) {
|
|
9766
|
+
const beforeContext = isPaperMode ? { quoteId: (_b2 = selectedRouteCard.quoteData) == null ? void 0 : _b2.quoteId, mode: "paper" } : { quoteId: (_c2 = selectedRouteCard.quoteData) == null ? void 0 : _c2.quoteId };
|
|
9767
|
+
setIsBeforeActionPending(true);
|
|
9768
|
+
try {
|
|
9769
|
+
const proceed = yield onBeforePrimaryAction(beforeContext);
|
|
9770
|
+
if (proceed === false) return;
|
|
9771
|
+
} catch (error) {
|
|
9772
|
+
setSubmissionFeedback({
|
|
9773
|
+
message: normalizePlaceOrderErrorMessage({
|
|
9774
|
+
errorMessage: error instanceof Error ? error.message : String(error),
|
|
9775
|
+
fallbackMessage: tradingLabels.orderFailed,
|
|
9776
|
+
labels: tradingLabels
|
|
9777
|
+
}),
|
|
9778
|
+
tone: "error"
|
|
9779
|
+
});
|
|
9780
|
+
return;
|
|
9781
|
+
} finally {
|
|
9782
|
+
setIsBeforeActionPending(false);
|
|
9783
|
+
}
|
|
9784
|
+
}
|
|
9753
9785
|
if (scopedSelectedMarket && scopedSelectedOutcomeId) {
|
|
9754
9786
|
submittedSelectionRef.current = {
|
|
9755
9787
|
marketId: scopedSelectedMarket.id,
|
|
@@ -9772,7 +9804,7 @@ var PlaceOrder = ({
|
|
|
9772
9804
|
}
|
|
9773
9805
|
});
|
|
9774
9806
|
if (!orderEligibility.canPlaceOrder && resolvedReadOnlyTradingState.kind !== "open") {
|
|
9775
|
-
return /* @__PURE__ */ (0,
|
|
9807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
9776
9808
|
PlaceOrderResolvedView,
|
|
9777
9809
|
{
|
|
9778
9810
|
tradingState: resolvedReadOnlyTradingState,
|
|
@@ -9782,8 +9814,8 @@ var PlaceOrder = ({
|
|
|
9782
9814
|
}
|
|
9783
9815
|
);
|
|
9784
9816
|
}
|
|
9785
|
-
return /* @__PURE__ */ (0,
|
|
9786
|
-
/* @__PURE__ */ (0,
|
|
9817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(import_react10.Fragment, { children: [
|
|
9818
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
|
|
9787
9819
|
Card,
|
|
9788
9820
|
{
|
|
9789
9821
|
className: cn(
|
|
@@ -9800,8 +9832,8 @@ var PlaceOrder = ({
|
|
|
9800
9832
|
headerTitle,
|
|
9801
9833
|
onClose
|
|
9802
9834
|
}),
|
|
9803
|
-
/* @__PURE__ */ (0,
|
|
9804
|
-
/* @__PURE__ */ (0,
|
|
9835
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: cn("agg-order-panel-content flex flex-col gap-6", classNames == null ? void 0 : classNames.content), children: [
|
|
9836
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
9805
9837
|
"div",
|
|
9806
9838
|
{
|
|
9807
9839
|
className: "agg-order-tabs flex items-end border-b border-agg-separator",
|
|
@@ -9812,7 +9844,7 @@ var PlaceOrder = ({
|
|
|
9812
9844
|
{ value: "sell", label: tradingLabels.sell, ref: sellTabRef }
|
|
9813
9845
|
].map((tabItem) => {
|
|
9814
9846
|
const isActive = internalTab === tabItem.value;
|
|
9815
|
-
return /* @__PURE__ */ (0,
|
|
9847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
|
|
9816
9848
|
"button",
|
|
9817
9849
|
{
|
|
9818
9850
|
ref: tabItem.ref,
|
|
@@ -9836,7 +9868,7 @@ var PlaceOrder = ({
|
|
|
9836
9868
|
onKeyDown: (event) => handleTabKeyDown(event, tabItem.value),
|
|
9837
9869
|
children: [
|
|
9838
9870
|
tabItem.label,
|
|
9839
|
-
/* @__PURE__ */ (0,
|
|
9871
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
9840
9872
|
"span",
|
|
9841
9873
|
{
|
|
9842
9874
|
"aria-hidden": "true",
|
|
@@ -9858,7 +9890,7 @@ var PlaceOrder = ({
|
|
|
9858
9890
|
})
|
|
9859
9891
|
}
|
|
9860
9892
|
),
|
|
9861
|
-
outcomes.length >= 2 ? /* @__PURE__ */ (0,
|
|
9893
|
+
outcomes.length >= 2 ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { className: "agg-outcomes flex w-full max-w-full gap-2", children: outcomes.map((outcome, index) => {
|
|
9862
9894
|
var _a2, _b2, _c2;
|
|
9863
9895
|
const price = getDisplayOutcomePrice({
|
|
9864
9896
|
outcomeId: outcome.id,
|
|
@@ -9872,7 +9904,7 @@ var PlaceOrder = ({
|
|
|
9872
9904
|
});
|
|
9873
9905
|
const isActive = outcome.id === scopedSelectedOutcomeId;
|
|
9874
9906
|
const isPositive = resolveIsPositiveOutcome(outcome, index);
|
|
9875
|
-
return /* @__PURE__ */ (0,
|
|
9907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
|
|
9876
9908
|
"button",
|
|
9877
9909
|
{
|
|
9878
9910
|
"data-id": outcome.id,
|
|
@@ -9892,7 +9924,7 @@ var PlaceOrder = ({
|
|
|
9892
9924
|
disabled: !orderEligibility.canPlaceOrder || isResolvedOutcomeCtaLocked,
|
|
9893
9925
|
onClick: () => handleOutcomeChange(outcome.id),
|
|
9894
9926
|
children: [
|
|
9895
|
-
/* @__PURE__ */ (0,
|
|
9927
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
9896
9928
|
Typography,
|
|
9897
9929
|
{
|
|
9898
9930
|
as: "span",
|
|
@@ -9901,18 +9933,18 @@ var PlaceOrder = ({
|
|
|
9901
9933
|
children: (_c2 = outcome.title) != null ? _c2 : outcome.label
|
|
9902
9934
|
}
|
|
9903
9935
|
),
|
|
9904
|
-
/* @__PURE__ */ (0,
|
|
9936
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(Typography, { as: "span", variant: isActive ? "body-strong" : "body", children: formatProbabilityCents(price) })
|
|
9905
9937
|
]
|
|
9906
9938
|
},
|
|
9907
9939
|
outcome.id
|
|
9908
9940
|
);
|
|
9909
9941
|
}) }) : null,
|
|
9910
|
-
/* @__PURE__ */ (0,
|
|
9911
|
-
/* @__PURE__ */ (0,
|
|
9912
|
-
/* @__PURE__ */ (0,
|
|
9913
|
-
isAuthenticated ? isSell ? /* @__PURE__ */ (0,
|
|
9914
|
-
/* @__PURE__ */ (0,
|
|
9915
|
-
displayedCurrentSellableShares > 0 ? /* @__PURE__ */ (0,
|
|
9942
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-order-amount-section flex items-start justify-between gap-4", children: [
|
|
9943
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-order-amount-meta flex flex-col", children: [
|
|
9944
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.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) }),
|
|
9945
|
+
isAuthenticated ? isSell ? /* @__PURE__ */ (0, import_jsx_runtime122.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_runtime122.jsx)(LoadingIcon, { size: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(import_jsx_runtime122.Fragment, { children: [
|
|
9946
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("span", { className: "whitespace-pre", children: tradingLabels.shares(displayedCurrentSellableShares) }),
|
|
9947
|
+
displayedCurrentSellableShares > 0 ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
9916
9948
|
"button",
|
|
9917
9949
|
{
|
|
9918
9950
|
type: "button",
|
|
@@ -9928,9 +9960,9 @@ var PlaceOrder = ({
|
|
|
9928
9960
|
children: tradingLabels.maxShares
|
|
9929
9961
|
}
|
|
9930
9962
|
) : null
|
|
9931
|
-
] }) }) : /* @__PURE__ */ (0,
|
|
9963
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime122.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_runtime122.jsx)(LoadingIcon, { size: "small" }) : tradingLabels.balance(formatUsd(totalBalance)) }) : null
|
|
9932
9964
|
] }),
|
|
9933
|
-
/* @__PURE__ */ (0,
|
|
9965
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
9934
9966
|
CurrencyInput,
|
|
9935
9967
|
{
|
|
9936
9968
|
value: internalAmount,
|
|
@@ -9950,9 +9982,9 @@ var PlaceOrder = ({
|
|
|
9950
9982
|
}
|
|
9951
9983
|
)
|
|
9952
9984
|
] }),
|
|
9953
|
-
showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */ (0,
|
|
9954
|
-
/* @__PURE__ */ (0,
|
|
9955
|
-
/* @__PURE__ */ (0,
|
|
9985
|
+
showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-order-fees-section flex items-center justify-between gap-4", children: [
|
|
9986
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
9987
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
9956
9988
|
Typography,
|
|
9957
9989
|
{
|
|
9958
9990
|
variant: "text-sm",
|
|
@@ -9960,7 +9992,7 @@ var PlaceOrder = ({
|
|
|
9960
9992
|
children: tradingLabels.estimatedFees
|
|
9961
9993
|
}
|
|
9962
9994
|
),
|
|
9963
|
-
feeBreakdownRows.length > 0 ? /* @__PURE__ */ (0,
|
|
9995
|
+
feeBreakdownRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
9964
9996
|
Tooltip,
|
|
9965
9997
|
{
|
|
9966
9998
|
"aria-label": tradingLabels.estimatedFeesTooltipAria,
|
|
@@ -9972,13 +10004,13 @@ var PlaceOrder = ({
|
|
|
9972
10004
|
icon: "h-3 w-3 text-agg-muted-foreground",
|
|
9973
10005
|
trigger: "h-3 w-3 text-agg-muted-foreground"
|
|
9974
10006
|
},
|
|
9975
|
-
content: /* @__PURE__ */ (0,
|
|
10007
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { className: "flex w-full flex-col gap-2", children: feeBreakdownRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
|
|
9976
10008
|
"div",
|
|
9977
10009
|
{
|
|
9978
10010
|
className: "flex items-center justify-between gap-3 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground",
|
|
9979
10011
|
children: [
|
|
9980
|
-
/* @__PURE__ */ (0,
|
|
9981
|
-
row.kind === "badge" ? /* @__PURE__ */ (0,
|
|
10012
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("span", { children: row.label }),
|
|
10013
|
+
row.kind === "badge" ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
9982
10014
|
"span",
|
|
9983
10015
|
{
|
|
9984
10016
|
className: cn(
|
|
@@ -9988,7 +10020,7 @@ var PlaceOrder = ({
|
|
|
9988
10020
|
),
|
|
9989
10021
|
children: row.badgeLabel
|
|
9990
10022
|
}
|
|
9991
|
-
) : /* @__PURE__ */ (0,
|
|
10023
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime122.jsx)("span", { className: "text-right", children: row.value })
|
|
9992
10024
|
]
|
|
9993
10025
|
},
|
|
9994
10026
|
row.label
|
|
@@ -9996,12 +10028,12 @@ var PlaceOrder = ({
|
|
|
9996
10028
|
}
|
|
9997
10029
|
) : null
|
|
9998
10030
|
] }),
|
|
9999
|
-
/* @__PURE__ */ (0,
|
|
10031
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: estimatedFeesValue })
|
|
10000
10032
|
] }) : null,
|
|
10001
|
-
shouldShowSmartRouting ? /* @__PURE__ */ (0,
|
|
10002
|
-
/* @__PURE__ */ (0,
|
|
10003
|
-
/* @__PURE__ */ (0,
|
|
10004
|
-
shouldShowRouteToggle && !isRoutesExpanded ? /* @__PURE__ */ (0,
|
|
10033
|
+
shouldShowSmartRouting ? /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-route-panel flex flex-col gap-3", children: [
|
|
10034
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-route-panel-header flex items-center justify-between gap-4", children: [
|
|
10035
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "agg-route-panel-title text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.smartRouting }),
|
|
10036
|
+
shouldShowRouteToggle && !isRoutesExpanded ? /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
|
|
10005
10037
|
"button",
|
|
10006
10038
|
{
|
|
10007
10039
|
type: "button",
|
|
@@ -10009,8 +10041,8 @@ var PlaceOrder = ({
|
|
|
10009
10041
|
"aria-label": tradingLabels.viewAllRoutes(orderedRouteCards.length),
|
|
10010
10042
|
onClick: () => setIsRoutesExpanded((currentValue) => !currentValue),
|
|
10011
10043
|
children: [
|
|
10012
|
-
/* @__PURE__ */ (0,
|
|
10013
|
-
/* @__PURE__ */ (0,
|
|
10044
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("span", { children: tradingLabels.viewAllRoutes(orderedRouteCards.length) }),
|
|
10045
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
10014
10046
|
Icon,
|
|
10015
10047
|
{
|
|
10016
10048
|
name: "chevron-down",
|
|
@@ -10023,11 +10055,11 @@ var PlaceOrder = ({
|
|
|
10023
10055
|
}
|
|
10024
10056
|
) : null
|
|
10025
10057
|
] }),
|
|
10026
|
-
/* @__PURE__ */ (0,
|
|
10027
|
-
/* @__PURE__ */ (0,
|
|
10028
|
-
/* @__PURE__ */ (0,
|
|
10058
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { className: "agg-route-list flex flex-col gap-2", children: isQuoteLoading ? /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-route-loading flex flex-col gap-2", "aria-hidden": "true", children: [
|
|
10059
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(PlaceOrderRouteCardSkeleton, {}),
|
|
10060
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(PlaceOrderRouteCardSkeleton, {})
|
|
10029
10061
|
] }) : visibleRouteCards.length > 0 ? visibleRouteCards.map((card) => {
|
|
10030
|
-
return /* @__PURE__ */ (0,
|
|
10062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(import_react10.Fragment, { children: renderRouteCard({
|
|
10031
10063
|
card,
|
|
10032
10064
|
enableAnimations,
|
|
10033
10065
|
isExpanded: card.kind === "split" ? isSplitDetailOpen : isRoutesExpanded,
|
|
@@ -10037,13 +10069,13 @@ var PlaceOrder = ({
|
|
|
10037
10069
|
}) }, card.id);
|
|
10038
10070
|
}) : null })
|
|
10039
10071
|
] }) : null,
|
|
10040
|
-
hasEnteredAmount && selectedRouteCard && !isQuoteLoading && !isBelowMinimum && orderEligibility.canPlaceOrder ? /* @__PURE__ */ (0,
|
|
10041
|
-
/* @__PURE__ */ (0,
|
|
10042
|
-
/* @__PURE__ */ (0,
|
|
10043
|
-
/* @__PURE__ */ (0,
|
|
10072
|
+
hasEnteredAmount && selectedRouteCard && !isQuoteLoading && !isBelowMinimum && orderEligibility.canPlaceOrder ? /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-order-summary flex items-start justify-between gap-4", children: [
|
|
10073
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-order-summary-meta flex flex-col", children: [
|
|
10074
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "agg-order-summary-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.toWin(internalTab) }),
|
|
10075
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "agg-order-summary-hint text-agg-sm leading-agg-5 text-agg-muted-foreground", children: displayedToWinHint })
|
|
10044
10076
|
] }),
|
|
10045
|
-
/* @__PURE__ */ (0,
|
|
10046
|
-
|
|
10077
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
10078
|
+
import_react9.default,
|
|
10047
10079
|
{
|
|
10048
10080
|
value: displayedToWinValue,
|
|
10049
10081
|
locales: locale,
|
|
@@ -10057,7 +10089,7 @@ var PlaceOrder = ({
|
|
|
10057
10089
|
}
|
|
10058
10090
|
)
|
|
10059
10091
|
] }) : null,
|
|
10060
|
-
/* @__PURE__ */ (0,
|
|
10092
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
|
|
10061
10093
|
"div",
|
|
10062
10094
|
{
|
|
10063
10095
|
className: cn(
|
|
@@ -10065,17 +10097,17 @@ var PlaceOrder = ({
|
|
|
10065
10097
|
classNames == null ? void 0 : classNames.footer
|
|
10066
10098
|
),
|
|
10067
10099
|
children: [
|
|
10068
|
-
!shouldShowGeoBlockBanner ? /* @__PURE__ */ (0,
|
|
10069
|
-
submissionFeedback ? /* @__PURE__ */ (0,
|
|
10100
|
+
!shouldShowGeoBlockBanner ? /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "agg-order-alerts flex flex-col gap-3 empty:hidden mb-3", children: [
|
|
10101
|
+
submissionFeedback ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
10070
10102
|
InlineAlert,
|
|
10071
10103
|
{
|
|
10072
10104
|
tone: submissionFeedback.tone,
|
|
10073
10105
|
message: submissionFeedback.message
|
|
10074
10106
|
}
|
|
10075
10107
|
) : null,
|
|
10076
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && isBelowMinimum ? /* @__PURE__ */ (0,
|
|
10077
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && quoteStatus ? /* @__PURE__ */ (0,
|
|
10078
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && !quoteStatus && isAuthenticated && hasEnteredAmount && smartRouteErrorMessage ? /* @__PURE__ */ (0,
|
|
10108
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && isBelowMinimum ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(InlineAlert, { tone: "error", message: belowMinimumMessage }) : null,
|
|
10109
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && quoteStatus ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(InlineAlert, { tone: quoteStatus.tone, message: quoteStatus.message }) : null,
|
|
10110
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && !quoteStatus && isAuthenticated && hasEnteredAmount && smartRouteErrorMessage ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
10079
10111
|
InlineAlert,
|
|
10080
10112
|
{
|
|
10081
10113
|
tone: "error",
|
|
@@ -10087,14 +10119,14 @@ var PlaceOrder = ({
|
|
|
10087
10119
|
}
|
|
10088
10120
|
) : null
|
|
10089
10121
|
] }) : null,
|
|
10090
|
-
!submissionFeedback && !shouldShowGeoBlockBanner && orderEligibility.canPlaceOrder && shouldShowInsufficientBalanceAlert ? /* @__PURE__ */ (0,
|
|
10122
|
+
!submissionFeedback && !shouldShowGeoBlockBanner && orderEligibility.canPlaceOrder && shouldShowInsufficientBalanceAlert ? /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
|
|
10091
10123
|
"div",
|
|
10092
10124
|
{
|
|
10093
10125
|
className: "agg-order-insufficient-balance-alert flex items-center justify-center gap-2",
|
|
10094
10126
|
role: "status",
|
|
10095
10127
|
"aria-live": "polite",
|
|
10096
10128
|
children: [
|
|
10097
|
-
/* @__PURE__ */ (0,
|
|
10129
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
10098
10130
|
Icon,
|
|
10099
10131
|
{
|
|
10100
10132
|
name: "warning-filled",
|
|
@@ -10103,11 +10135,11 @@ var PlaceOrder = ({
|
|
|
10103
10135
|
"aria-hidden": "true"
|
|
10104
10136
|
}
|
|
10105
10137
|
),
|
|
10106
|
-
/* @__PURE__ */ (0,
|
|
10138
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("span", { className: "text-agg-sm text-agg-foreground", children: tradingLabels.insufficientBalance })
|
|
10107
10139
|
]
|
|
10108
10140
|
}
|
|
10109
10141
|
) : null,
|
|
10110
|
-
!submissionFeedback && !shouldShowGeoBlockBanner && isInsufficientBalance ? /* @__PURE__ */ (0,
|
|
10142
|
+
!submissionFeedback && !shouldShowGeoBlockBanner && isInsufficientBalance ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
10111
10143
|
Button,
|
|
10112
10144
|
{
|
|
10113
10145
|
size: "large",
|
|
@@ -10117,7 +10149,7 @@ var PlaceOrder = ({
|
|
|
10117
10149
|
onClick: handleDepositRequiredClick,
|
|
10118
10150
|
children: tradingLabels.deposit
|
|
10119
10151
|
}
|
|
10120
|
-
) : needsKycVerification && !submissionFeedback && !shouldShowGeoBlockBanner ? /* @__PURE__ */ (0,
|
|
10152
|
+
) : needsKycVerification && !submissionFeedback && !shouldShowGeoBlockBanner ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(InitiateKycButton, { label: tradingLabels.kycRequired, onOpen: openVerifyModal }) : isQuoteLoading && !isActionLoading ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
10121
10153
|
Button,
|
|
10122
10154
|
{
|
|
10123
10155
|
size: "large",
|
|
@@ -10126,7 +10158,7 @@ var PlaceOrder = ({
|
|
|
10126
10158
|
disabled: true,
|
|
10127
10159
|
"aria-live": "polite",
|
|
10128
10160
|
"aria-label": routeLoadingMessage != null ? routeLoadingMessage : labels.common.loading,
|
|
10129
|
-
prefix: /* @__PURE__ */ (0,
|
|
10161
|
+
prefix: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
10130
10162
|
"span",
|
|
10131
10163
|
{
|
|
10132
10164
|
className: cn(
|
|
@@ -10138,7 +10170,7 @@ var PlaceOrder = ({
|
|
|
10138
10170
|
),
|
|
10139
10171
|
children: routeLoadingMessage
|
|
10140
10172
|
}
|
|
10141
|
-
) : !isAuthenticated ? /* @__PURE__ */ (0,
|
|
10173
|
+
) : !isAuthenticated ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
10142
10174
|
Button,
|
|
10143
10175
|
{
|
|
10144
10176
|
size: "large",
|
|
@@ -10149,7 +10181,7 @@ var PlaceOrder = ({
|
|
|
10149
10181
|
onClick: import_hooks29.requestAggAuthChooserOpen,
|
|
10150
10182
|
children: tradingLabels.signInToTrade
|
|
10151
10183
|
}
|
|
10152
|
-
) : /* @__PURE__ */ (0,
|
|
10184
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
10153
10185
|
Button,
|
|
10154
10186
|
{
|
|
10155
10187
|
size: "large",
|
|
@@ -10164,8 +10196,8 @@ var PlaceOrder = ({
|
|
|
10164
10196
|
children: actionLabel
|
|
10165
10197
|
}
|
|
10166
10198
|
),
|
|
10167
|
-
!shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown ? /* @__PURE__ */ (0,
|
|
10168
|
-
/* @__PURE__ */ (0,
|
|
10199
|
+
!shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown ? /* @__PURE__ */ (0, import_jsx_runtime122.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: [
|
|
10200
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
10169
10201
|
Icon,
|
|
10170
10202
|
{
|
|
10171
10203
|
name: "shield-trust",
|
|
@@ -10174,10 +10206,10 @@ var PlaceOrder = ({
|
|
|
10174
10206
|
"aria-hidden": "true"
|
|
10175
10207
|
}
|
|
10176
10208
|
),
|
|
10177
|
-
/* @__PURE__ */ (0,
|
|
10209
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(Typography, { variant: "text-xs-caps", className: "text-agg-primary", children: tradingLabels.platformFee })
|
|
10178
10210
|
] }) : null,
|
|
10179
|
-
shouldShowGeoBlockBanner ? /* @__PURE__ */ (0,
|
|
10180
|
-
!shouldShowGeoBlockBanner ? /* @__PURE__ */ (0,
|
|
10211
|
+
shouldShowGeoBlockBanner ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(GeoBlockBanner, { termsUrl: AGG_TERMS_OF_SERVICE_URL }) : null,
|
|
10212
|
+
!shouldShowGeoBlockBanner ? /* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "agg-order-disclaimer text-center text-agg-xs leading-agg-4 text-agg-muted-foreground", children: tradingLabels.disclaimer }) : null
|
|
10181
10213
|
]
|
|
10182
10214
|
}
|
|
10183
10215
|
)
|
|
@@ -10185,7 +10217,7 @@ var PlaceOrder = ({
|
|
|
10185
10217
|
]
|
|
10186
10218
|
}
|
|
10187
10219
|
),
|
|
10188
|
-
/* @__PURE__ */ (0,
|
|
10220
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
10189
10221
|
KycVerifyModal,
|
|
10190
10222
|
{
|
|
10191
10223
|
open: isKycVerifyModalOpen,
|
|
@@ -10202,7 +10234,7 @@ var PlaceOrder = ({
|
|
|
10202
10234
|
}
|
|
10203
10235
|
}
|
|
10204
10236
|
),
|
|
10205
|
-
/* @__PURE__ */ (0,
|
|
10237
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
10206
10238
|
KycSuccessModal,
|
|
10207
10239
|
{
|
|
10208
10240
|
open: showKycSuccessModal,
|
|
@@ -10222,6 +10254,312 @@ PlaceOrder.displayName = "PlaceOrder";
|
|
|
10222
10254
|
|
|
10223
10255
|
// src/trading/trading-context/index.tsx
|
|
10224
10256
|
var import_hooks30 = require("@agg-build/hooks");
|
|
10257
|
+
|
|
10258
|
+
// src/trading/use-claim-winnings.ts
|
|
10259
|
+
var import_hooks31 = require("@agg-build/hooks");
|
|
10260
|
+
var import_react11 = require("react");
|
|
10261
|
+
var toClaimError = (err) => {
|
|
10262
|
+
if (err instanceof Error) return err;
|
|
10263
|
+
return new Error(String(err));
|
|
10264
|
+
};
|
|
10265
|
+
function useClaimWinnings(options = {}) {
|
|
10266
|
+
const { onClaim, onClaimResult, onClaimSubmitError, externalClaimingKeys } = options;
|
|
10267
|
+
const labels = (0, import_hooks31.useLabels)();
|
|
10268
|
+
const claimNotificationLabels = labels.notifications.claim;
|
|
10269
|
+
const toastCtx = useOptionalToast();
|
|
10270
|
+
const queryClient = (0, import_hooks31.useQueryClient)();
|
|
10271
|
+
const redeemMutation = (0, import_hooks31.useRedeem)();
|
|
10272
|
+
const [activeRedeems, setActiveRedeems] = (0, import_react11.useState)({});
|
|
10273
|
+
const activeClaimKeysRef = (0, import_react11.useRef)(/* @__PURE__ */ new Set());
|
|
10274
|
+
const pendingClaimToastIdsRef = (0, import_react11.useRef)({});
|
|
10275
|
+
const submittedClaimToastKeysRef = (0, import_react11.useRef)(/* @__PURE__ */ new Set());
|
|
10276
|
+
const [submittingClaimKeys, setSubmittingClaimKeys] = (0, import_react11.useState)({});
|
|
10277
|
+
const lifecycleInputs = (0, import_react11.useMemo)(
|
|
10278
|
+
() => Object.values(activeRedeems),
|
|
10279
|
+
[activeRedeems]
|
|
10280
|
+
);
|
|
10281
|
+
const lifecycleStates = (0, import_hooks31.useRedeemLifecycles)(lifecycleInputs);
|
|
10282
|
+
const internalClaimingIds = (0, import_react11.useMemo)(() => {
|
|
10283
|
+
const out = __spreadValues({}, submittingClaimKeys);
|
|
10284
|
+
for (const [claimKey, active] of Object.entries(activeRedeems)) {
|
|
10285
|
+
const state = lifecycleStates[active.redeemId];
|
|
10286
|
+
if (!state || !state.terminal) out[claimKey] = true;
|
|
10287
|
+
}
|
|
10288
|
+
return out;
|
|
10289
|
+
}, [activeRedeems, lifecycleStates, submittingClaimKeys]);
|
|
10290
|
+
const claimingKeys = externalClaimingKeys != null ? externalClaimingKeys : internalClaimingIds;
|
|
10291
|
+
const isClaiming = (0, import_react11.useCallback)(
|
|
10292
|
+
(claimKey) => Boolean(externalClaimingKeys == null ? void 0 : externalClaimingKeys[claimKey]) || Boolean(internalClaimingIds[claimKey]),
|
|
10293
|
+
[externalClaimingKeys, internalClaimingIds]
|
|
10294
|
+
);
|
|
10295
|
+
const invalidateClaimUiState = (0, import_react11.useCallback)(() => {
|
|
10296
|
+
(0, import_hooks31.invalidateBalanceQueries)(queryClient);
|
|
10297
|
+
(0, import_hooks31.invalidatePositionQueries)(queryClient);
|
|
10298
|
+
queryClient.invalidateQueries({
|
|
10299
|
+
queryKey: import_hooks31.executionKeys.claimablePositionsCount(),
|
|
10300
|
+
refetchType: "active"
|
|
10301
|
+
});
|
|
10302
|
+
(0, import_hooks31.invalidateUserActivityQueries)(queryClient);
|
|
10303
|
+
}, [queryClient]);
|
|
10304
|
+
const claim = (0, import_react11.useCallback)(
|
|
10305
|
+
(_0) => __async(null, [_0], function* ({ claimKey, winningOutcomeIds, payload }) {
|
|
10306
|
+
if (activeClaimKeysRef.current.has(claimKey) || Boolean(externalClaimingKeys == null ? void 0 : externalClaimingKeys[claimKey]) || internalClaimingIds[claimKey]) {
|
|
10307
|
+
return;
|
|
10308
|
+
}
|
|
10309
|
+
activeClaimKeysRef.current.add(claimKey);
|
|
10310
|
+
setSubmittingClaimKeys((prev) => __spreadProps(__spreadValues({}, prev), { [claimKey]: true }));
|
|
10311
|
+
const pendingToastId = toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.pendingMessage, {
|
|
10312
|
+
title: claimNotificationLabels.pendingTitle,
|
|
10313
|
+
tone: "info"
|
|
10314
|
+
});
|
|
10315
|
+
if (pendingToastId != null) {
|
|
10316
|
+
pendingClaimToastIdsRef.current[claimKey] = pendingToastId;
|
|
10317
|
+
}
|
|
10318
|
+
if (onClaim) {
|
|
10319
|
+
try {
|
|
10320
|
+
yield onClaim(payload);
|
|
10321
|
+
const pendingId = pendingClaimToastIdsRef.current[claimKey];
|
|
10322
|
+
if (pendingId != null) toastCtx == null ? void 0 : toastCtx.dismiss(pendingId);
|
|
10323
|
+
delete pendingClaimToastIdsRef.current[claimKey];
|
|
10324
|
+
toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.successMessage, {
|
|
10325
|
+
title: claimNotificationLabels.successTitle,
|
|
10326
|
+
tone: "success"
|
|
10327
|
+
});
|
|
10328
|
+
} catch (err) {
|
|
10329
|
+
const error = toClaimError(err);
|
|
10330
|
+
console.error("[useClaimWinnings] redeem failed", error);
|
|
10331
|
+
const pendingId = pendingClaimToastIdsRef.current[claimKey];
|
|
10332
|
+
if (pendingId != null) toastCtx == null ? void 0 : toastCtx.dismiss(pendingId);
|
|
10333
|
+
delete pendingClaimToastIdsRef.current[claimKey];
|
|
10334
|
+
toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.failedMessage(error.message), {
|
|
10335
|
+
title: claimNotificationLabels.failedTitle,
|
|
10336
|
+
tone: "error"
|
|
10337
|
+
});
|
|
10338
|
+
onClaimSubmitError == null ? void 0 : onClaimSubmitError(claimKey, error);
|
|
10339
|
+
throw error;
|
|
10340
|
+
} finally {
|
|
10341
|
+
invalidateClaimUiState();
|
|
10342
|
+
activeClaimKeysRef.current.delete(claimKey);
|
|
10343
|
+
setSubmittingClaimKeys((prev) => {
|
|
10344
|
+
const _a = prev, { [claimKey]: _removed } = _a, rest = __objRest(_a, [__restKey(claimKey)]);
|
|
10345
|
+
return rest;
|
|
10346
|
+
});
|
|
10347
|
+
}
|
|
10348
|
+
return;
|
|
10349
|
+
}
|
|
10350
|
+
if (winningOutcomeIds.length === 0) {
|
|
10351
|
+
const error = new Error(claimNotificationLabels.missingOutcomeMessage);
|
|
10352
|
+
console.error("[useClaimWinnings] redeem failed", error);
|
|
10353
|
+
const pendingId = pendingClaimToastIdsRef.current[claimKey];
|
|
10354
|
+
if (pendingId != null) toastCtx == null ? void 0 : toastCtx.dismiss(pendingId);
|
|
10355
|
+
delete pendingClaimToastIdsRef.current[claimKey];
|
|
10356
|
+
toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.failedMessage(error.message), {
|
|
10357
|
+
title: claimNotificationLabels.failedTitle,
|
|
10358
|
+
tone: "error"
|
|
10359
|
+
});
|
|
10360
|
+
onClaimSubmitError == null ? void 0 : onClaimSubmitError(claimKey, error);
|
|
10361
|
+
invalidateClaimUiState();
|
|
10362
|
+
activeClaimKeysRef.current.delete(claimKey);
|
|
10363
|
+
setSubmittingClaimKeys((prev) => {
|
|
10364
|
+
const _a = prev, { [claimKey]: _removed } = _a, rest = __objRest(_a, [__restKey(claimKey)]);
|
|
10365
|
+
return rest;
|
|
10366
|
+
});
|
|
10367
|
+
throw error;
|
|
10368
|
+
}
|
|
10369
|
+
try {
|
|
10370
|
+
const response = yield redeemMutation.mutateAsync({
|
|
10371
|
+
venueMarketOutcomeIds: winningOutcomeIds
|
|
10372
|
+
});
|
|
10373
|
+
const expectedOutcomeIds = [];
|
|
10374
|
+
const preFailedOutcomeIds = [];
|
|
10375
|
+
const preFailedReasons = {};
|
|
10376
|
+
const preConfirmedOutcomeIds = [];
|
|
10377
|
+
const preConfirmedTxHashes = {};
|
|
10378
|
+
for (const result of response.results) {
|
|
10379
|
+
if (result.status === "submitted") {
|
|
10380
|
+
expectedOutcomeIds.push(result.venueMarketOutcomeId);
|
|
10381
|
+
} else if (result.status === "confirmed") {
|
|
10382
|
+
preConfirmedOutcomeIds.push(result.venueMarketOutcomeId);
|
|
10383
|
+
preConfirmedTxHashes[result.venueMarketOutcomeId] = result.txHash;
|
|
10384
|
+
} else if (result.status === "ineligible" || result.status === "rejected") {
|
|
10385
|
+
preFailedOutcomeIds.push(result.venueMarketOutcomeId);
|
|
10386
|
+
preFailedReasons[result.venueMarketOutcomeId] = result.reason;
|
|
10387
|
+
}
|
|
10388
|
+
}
|
|
10389
|
+
if (expectedOutcomeIds.length > 0) {
|
|
10390
|
+
const pendingId = pendingClaimToastIdsRef.current[claimKey];
|
|
10391
|
+
if (pendingId != null) toastCtx == null ? void 0 : toastCtx.dismiss(pendingId);
|
|
10392
|
+
delete pendingClaimToastIdsRef.current[claimKey];
|
|
10393
|
+
submittedClaimToastKeysRef.current.add(claimKey);
|
|
10394
|
+
toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.submittedMessage, {
|
|
10395
|
+
title: claimNotificationLabels.submittedTitle,
|
|
10396
|
+
tone: "success"
|
|
10397
|
+
});
|
|
10398
|
+
}
|
|
10399
|
+
setActiveRedeems((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
10400
|
+
[claimKey]: {
|
|
10401
|
+
redeemId: response.redeemId,
|
|
10402
|
+
expectedOutcomeIds,
|
|
10403
|
+
preFailedOutcomeIds,
|
|
10404
|
+
preFailedReasons,
|
|
10405
|
+
preConfirmedOutcomeIds,
|
|
10406
|
+
preConfirmedTxHashes
|
|
10407
|
+
}
|
|
10408
|
+
}));
|
|
10409
|
+
yield queryClient.invalidateQueries({ queryKey: ["current-user"] });
|
|
10410
|
+
} catch (err) {
|
|
10411
|
+
const error = toClaimError(err);
|
|
10412
|
+
console.error("[useClaimWinnings] redeem failed", error);
|
|
10413
|
+
const pendingId = pendingClaimToastIdsRef.current[claimKey];
|
|
10414
|
+
if (pendingId != null) toastCtx == null ? void 0 : toastCtx.dismiss(pendingId);
|
|
10415
|
+
delete pendingClaimToastIdsRef.current[claimKey];
|
|
10416
|
+
toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.failedMessage(error.message), {
|
|
10417
|
+
title: claimNotificationLabels.failedTitle,
|
|
10418
|
+
tone: "error"
|
|
10419
|
+
});
|
|
10420
|
+
onClaimSubmitError == null ? void 0 : onClaimSubmitError(claimKey, error);
|
|
10421
|
+
throw error;
|
|
10422
|
+
} finally {
|
|
10423
|
+
activeClaimKeysRef.current.delete(claimKey);
|
|
10424
|
+
setSubmittingClaimKeys((prev) => {
|
|
10425
|
+
const _a = prev, { [claimKey]: _removed } = _a, rest = __objRest(_a, [__restKey(claimKey)]);
|
|
10426
|
+
return rest;
|
|
10427
|
+
});
|
|
10428
|
+
}
|
|
10429
|
+
}),
|
|
10430
|
+
[
|
|
10431
|
+
claimNotificationLabels,
|
|
10432
|
+
externalClaimingKeys,
|
|
10433
|
+
internalClaimingIds,
|
|
10434
|
+
invalidateClaimUiState,
|
|
10435
|
+
onClaim,
|
|
10436
|
+
onClaimSubmitError,
|
|
10437
|
+
queryClient,
|
|
10438
|
+
redeemMutation,
|
|
10439
|
+
toastCtx
|
|
10440
|
+
]
|
|
10441
|
+
);
|
|
10442
|
+
const firedTerminalRef = (0, import_react11.useRef)({});
|
|
10443
|
+
(0, import_react11.useEffect)(() => {
|
|
10444
|
+
var _a, _b;
|
|
10445
|
+
for (const [claimKey, active] of Object.entries(activeRedeems)) {
|
|
10446
|
+
const state = lifecycleStates[active.redeemId];
|
|
10447
|
+
if (!state || !state.terminal) continue;
|
|
10448
|
+
if (firedTerminalRef.current[active.redeemId]) continue;
|
|
10449
|
+
firedTerminalRef.current[active.redeemId] = true;
|
|
10450
|
+
onClaimResult == null ? void 0 : onClaimResult(claimKey, {
|
|
10451
|
+
allConfirmed: state.allConfirmed,
|
|
10452
|
+
anyFailed: state.anyFailed,
|
|
10453
|
+
errorMessage: state.errorMessage
|
|
10454
|
+
});
|
|
10455
|
+
const pendingId = pendingClaimToastIdsRef.current[claimKey];
|
|
10456
|
+
if (pendingId != null) toastCtx == null ? void 0 : toastCtx.dismiss(pendingId);
|
|
10457
|
+
delete pendingClaimToastIdsRef.current[claimKey];
|
|
10458
|
+
if (state.allConfirmed) {
|
|
10459
|
+
if (!submittedClaimToastKeysRef.current.has(claimKey)) {
|
|
10460
|
+
toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.successMessage, {
|
|
10461
|
+
title: claimNotificationLabels.successTitle,
|
|
10462
|
+
tone: "success"
|
|
10463
|
+
});
|
|
10464
|
+
}
|
|
10465
|
+
} else if (state.anyFailed) {
|
|
10466
|
+
const hasConfirmedLeg = Object.values(state.legs).some((leg) => leg.status === "confirmed");
|
|
10467
|
+
if (hasConfirmedLeg) {
|
|
10468
|
+
toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.partialMessage((_a = state.errorMessage) != null ? _a : void 0), {
|
|
10469
|
+
title: claimNotificationLabels.partialTitle,
|
|
10470
|
+
tone: "warning"
|
|
10471
|
+
});
|
|
10472
|
+
} else {
|
|
10473
|
+
toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.failedMessage((_b = state.errorMessage) != null ? _b : void 0), {
|
|
10474
|
+
title: claimNotificationLabels.failedTitle,
|
|
10475
|
+
tone: "error"
|
|
10476
|
+
});
|
|
10477
|
+
}
|
|
10478
|
+
}
|
|
10479
|
+
submittedClaimToastKeysRef.current.delete(claimKey);
|
|
10480
|
+
invalidateClaimUiState();
|
|
10481
|
+
delete firedTerminalRef.current[active.redeemId];
|
|
10482
|
+
setActiveRedeems((prev) => {
|
|
10483
|
+
const _a2 = prev, { [claimKey]: _removed } = _a2, rest = __objRest(_a2, [__restKey(claimKey)]);
|
|
10484
|
+
return rest;
|
|
10485
|
+
});
|
|
10486
|
+
}
|
|
10487
|
+
}, [
|
|
10488
|
+
activeRedeems,
|
|
10489
|
+
claimNotificationLabels,
|
|
10490
|
+
invalidateClaimUiState,
|
|
10491
|
+
lifecycleStates,
|
|
10492
|
+
onClaimResult,
|
|
10493
|
+
toastCtx
|
|
10494
|
+
]);
|
|
10495
|
+
return { claim, claimingKeys, isClaiming };
|
|
10496
|
+
}
|
|
10497
|
+
|
|
10498
|
+
// src/trading/use-resolved-market-claim.ts
|
|
10499
|
+
var import_hooks32 = require("@agg-build/hooks");
|
|
10500
|
+
var import_react12 = require("react");
|
|
10501
|
+
var sharesFormatter = new Intl.NumberFormat("en-US", { maximumFractionDigits: 2 });
|
|
10502
|
+
var dateFormatter = new Intl.DateTimeFormat("en-US", {
|
|
10503
|
+
month: "short",
|
|
10504
|
+
day: "numeric",
|
|
10505
|
+
year: "numeric"
|
|
10506
|
+
});
|
|
10507
|
+
var formatResolutionDate = (value) => {
|
|
10508
|
+
if (!value) return "";
|
|
10509
|
+
const date = new Date(value);
|
|
10510
|
+
if (Number.isNaN(date.getTime())) return "";
|
|
10511
|
+
return dateFormatter.format(date);
|
|
10512
|
+
};
|
|
10513
|
+
function useResolvedMarketClaim(options = {}) {
|
|
10514
|
+
var _a;
|
|
10515
|
+
const { market, enabled = true, executionMode } = options;
|
|
10516
|
+
const { isAuthenticated } = (0, import_hooks32.useAggAuthState)();
|
|
10517
|
+
const tradingState = (0, import_react12.useMemo)(() => (0, import_hooks32.resolveMarketTradingState)(market), [market]);
|
|
10518
|
+
const isResolved = tradingState.kind === "resolved";
|
|
10519
|
+
const marketId = (_a = market == null ? void 0 : market.id) != null ? _a : null;
|
|
10520
|
+
const shouldFetch = Boolean(enabled && isAuthenticated && isResolved && marketId);
|
|
10521
|
+
const { positions } = (0, import_hooks32.useExecutionPositions)(__spreadValues({
|
|
10522
|
+
enabled: shouldFetch,
|
|
10523
|
+
status: "active",
|
|
10524
|
+
limit: 50
|
|
10525
|
+
}, executionMode === "paper" ? { mode: "paper" } : {}));
|
|
10526
|
+
const claimWinnings = useClaimWinnings();
|
|
10527
|
+
return (0, import_react12.useMemo)(() => {
|
|
10528
|
+
var _a2, _b, _c;
|
|
10529
|
+
if (!shouldFetch || !marketId) return void 0;
|
|
10530
|
+
const group = positions.find(
|
|
10531
|
+
(candidate) => candidate.targetMarketId === marketId
|
|
10532
|
+
);
|
|
10533
|
+
if (!group || group.venueMarket.status !== "resolved") return void 0;
|
|
10534
|
+
const winningOutcomes = group.venueMarket.venueMarketOutcomes.filter(
|
|
10535
|
+
(outcome) => outcome.winner === true && outcome.totalSize > 0
|
|
10536
|
+
);
|
|
10537
|
+
if (winningOutcomes.length === 0) return void 0;
|
|
10538
|
+
const totals = (0, import_hooks32.computeClosedPositionTotals)(group);
|
|
10539
|
+
const winningShares = winningOutcomes.reduce((sum, outcome) => sum + outcome.totalSize, 0);
|
|
10540
|
+
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
|
+
const claimKey = group.targetMarketId;
|
|
10542
|
+
const canClaim = group.redeemStatus === "eligible" && totals.winningOutcomeIds.length > 0;
|
|
10543
|
+
return {
|
|
10544
|
+
resolutionDateLabel: formatResolutionDate(group.resolutionDate),
|
|
10545
|
+
winningOutcomeLabel,
|
|
10546
|
+
sharesLabel: `${sharesFormatter.format(winningShares)} ${winningOutcomeLabel}`.trim(),
|
|
10547
|
+
// Payout is always shown with 2 decimals (e.g. "$8.50"), matching the
|
|
10548
|
+
// resolved-earnings design and the profile positions list.
|
|
10549
|
+
totalPayoutLabel: formatUsd(totals.amountWon, {
|
|
10550
|
+
minimumFractionDigits: 2,
|
|
10551
|
+
maximumFractionDigits: 2
|
|
10552
|
+
}),
|
|
10553
|
+
isClaiming: claimWinnings.isClaiming(claimKey),
|
|
10554
|
+
onClaim: canClaim ? () => {
|
|
10555
|
+
void claimWinnings.claim({
|
|
10556
|
+
claimKey,
|
|
10557
|
+
winningOutcomeIds: totals.winningOutcomeIds
|
|
10558
|
+
});
|
|
10559
|
+
} : void 0
|
|
10560
|
+
};
|
|
10561
|
+
}, [claimWinnings, marketId, positions, shouldFetch]);
|
|
10562
|
+
}
|
|
10225
10563
|
// Annotate the CommonJS export names for ESM import in node:
|
|
10226
10564
|
0 && (module.exports = {
|
|
10227
10565
|
PlaceOrder,
|
|
@@ -10242,5 +10580,7 @@ var import_hooks30 = require("@agg-build/hooks");
|
|
|
10242
10580
|
getTradingVenueLabel,
|
|
10243
10581
|
parseAmount,
|
|
10244
10582
|
parseVenue,
|
|
10245
|
-
|
|
10583
|
+
useClaimWinnings,
|
|
10584
|
+
useEventTradingContext,
|
|
10585
|
+
useResolvedMarketClaim
|
|
10246
10586
|
});
|