@agg-build/ui 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-5ES2VJHO.mjs → chunk-7JEJIGG4.mjs} +162 -253
- package/dist/{chunk-BYMLPLEZ.mjs → chunk-F3SU7BRE.mjs} +10 -10
- package/dist/{chunk-WLXYCBZV.mjs → chunk-IT2Y62MG.mjs} +31 -35
- package/dist/{chunk-43K4PFBC.mjs → chunk-JDYZJKTE.mjs} +2 -2
- package/dist/{chunk-HD6HBTK2.mjs → chunk-KDMNFHPL.mjs} +369 -19
- package/dist/{chunk-LPNZOX3E.mjs → chunk-OHEZGKFM.mjs} +443 -884
- package/dist/{chunk-YZNO6IUD.mjs → chunk-R6DETAZ6.mjs} +1343 -1173
- package/dist/events.js +1886 -1545
- package/dist/events.mjs +3 -3
- package/dist/index.js +3748 -3707
- package/dist/index.mjs +191 -118
- package/dist/modals.js +1042 -943
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +2822 -2864
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +1322 -1166
- package/dist/primitives.mjs +9 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +3770 -3718
- package/dist/trading.mjs +10 -12
- package/dist/types/events/item-details/settlement-summary.d.mts +6 -2
- package/dist/types/events/item-details/settlement-summary.d.ts +6 -2
- package/dist/types/events/list/event-list.types.d.mts +1 -1
- package/dist/types/events/list/event-list.types.d.ts +1 -1
- package/dist/types/events/list/event-list.utils.d.mts +1 -1
- package/dist/types/events/list/event-list.utils.d.ts +1 -1
- package/dist/types/pages/event-market/event-market.types.d.mts +1 -3
- package/dist/types/pages/event-market/event-market.types.d.ts +1 -3
- package/dist/types/pages/user-profile/components/available-balance-card.d.mts +0 -1
- package/dist/types/pages/user-profile/components/available-balance-card.d.ts +0 -1
- package/dist/types/primitives/icon/icon.types.d.mts +1 -2
- package/dist/types/primitives/icon/icon.types.d.ts +1 -2
- package/dist/types/primitives/icon/index.d.mts +4 -1
- package/dist/types/primitives/icon/index.d.ts +4 -1
- package/dist/types/primitives/icon/registry.d.mts +12 -0
- package/dist/types/primitives/icon/registry.d.ts +12 -0
- package/dist/types/primitives/icon/svg/apps.d.mts +5 -0
- package/dist/types/primitives/icon/svg/apps.d.ts +5 -0
- package/dist/types/primitives/icon/svg/circle-overlap.d.mts +5 -0
- package/dist/types/primitives/icon/svg/circle-overlap.d.ts +5 -0
- package/dist/types/primitives/icon/svg/lock.d.mts +5 -0
- package/dist/types/primitives/icon/svg/lock.d.ts +5 -0
- package/dist/types/primitives/select/index.d.mts +1 -1
- package/dist/types/primitives/select/index.d.ts +1 -1
- package/dist/types/primitives/select/select.types.d.mts +1 -1
- package/dist/types/primitives/select/select.types.d.ts +1 -1
- package/dist/types/primitives/select/select.utils.d.mts +0 -1
- package/dist/types/primitives/select/select.utils.d.ts +0 -1
- package/dist/types/primitives/skeleton/index.d.mts +2 -1
- package/dist/types/primitives/skeleton/index.d.ts +2 -1
- package/dist/types/primitives/skeleton/views/place-order-skeleton-view.d.mts +4 -0
- package/dist/types/primitives/skeleton/views/place-order-skeleton-view.d.ts +4 -0
- package/dist/types/primitives/typography/index.d.mts +1 -1
- package/dist/types/primitives/typography/index.d.ts +1 -1
- package/dist/types/primitives/typography/typography.types.d.mts +3 -1
- package/dist/types/primitives/typography/typography.types.d.ts +3 -1
- package/dist/types/shared/utils.d.mts +3 -1
- package/dist/types/shared/utils.d.ts +3 -1
- package/dist/types/trading/index.d.mts +0 -1
- package/dist/types/trading/index.d.ts +0 -1
- package/dist/types/trading/place-order/index.place-order.types.d.mts +0 -1
- package/dist/types/trading/place-order/index.place-order.types.d.ts +0 -1
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +0 -4
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +0 -4
- package/dist/types/trading/settlement/index.d.mts +9 -6
- package/dist/types/trading/settlement/index.d.ts +9 -6
- package/dist/types/trading/settlement/settlement-text-renderer.d.mts +8 -0
- package/dist/types/trading/settlement/settlement-text-renderer.d.ts +8 -0
- package/dist/types/trading/settlement/settlement-text.utils.d.mts +36 -0
- package/dist/types/trading/settlement/settlement-text.utils.d.ts +36 -0
- package/dist/types/trading/types.d.mts +0 -19
- package/dist/types/trading/types.d.ts +0 -19
- package/dist/types/trading/utils.d.mts +0 -1
- package/dist/types/trading/utils.d.ts +0 -1
- package/package.json +3 -3
- package/dist/types/primitives/card/card.constants.d.mts +0 -4
- package/dist/types/primitives/card/card.constants.d.ts +0 -4
- package/dist/types/trading/settlement/settlement-details.utils.d.mts +0 -7
- package/dist/types/trading/settlement/settlement-details.utils.d.ts +0 -7
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
+
Settlement,
|
|
3
4
|
formatProbabilityCents,
|
|
5
|
+
getTradingDateLabel,
|
|
6
|
+
getTradingPriceLabel,
|
|
7
|
+
getTradingValueLabel,
|
|
8
|
+
getTradingVenueLabel,
|
|
4
9
|
resolveOrderEligibilityMessage
|
|
5
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-KDMNFHPL.mjs";
|
|
6
11
|
import {
|
|
7
12
|
GeoBlockBanner
|
|
8
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-JDYZJKTE.mjs";
|
|
9
14
|
import {
|
|
10
15
|
AGG_TERMS_OF_SERVICE_URL,
|
|
11
16
|
Button,
|
|
@@ -16,6 +21,7 @@ import {
|
|
|
16
21
|
InlineAlert,
|
|
17
22
|
LoadingIcon,
|
|
18
23
|
Modal,
|
|
24
|
+
PlaceOrderRouteCardSkeleton,
|
|
19
25
|
RemoteImage,
|
|
20
26
|
Skeleton,
|
|
21
27
|
SuccessCheckIcon,
|
|
@@ -30,7 +36,7 @@ import {
|
|
|
30
36
|
getMotionClassName,
|
|
31
37
|
normalizeVenueMarketCluster,
|
|
32
38
|
skeletonViews
|
|
33
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-R6DETAZ6.mjs";
|
|
34
40
|
|
|
35
41
|
// src/trading/types.ts
|
|
36
42
|
import { Venue, enumGuard, isFiniteNonNeg, safeParse } from "@agg-build/sdk";
|
|
@@ -38,444 +44,32 @@ var isVenue = enumGuard(Venue);
|
|
|
38
44
|
var parseVenue = (v) => safeParse(v, isVenue);
|
|
39
45
|
var parseAmount = (v) => safeParse(v, isFiniteNonNeg);
|
|
40
46
|
|
|
41
|
-
// src/trading/utils.ts
|
|
42
|
-
import { resolveAggUiLabels } from "@agg-build/hooks";
|
|
43
|
-
import dayjs from "dayjs";
|
|
44
|
-
var defaultLabels = resolveAggUiLabels("en-US");
|
|
45
|
-
var defaultSettlementSectionLabel = defaultLabels.trading.settlementSection;
|
|
46
|
-
var defaultSettlementDifferencesTitle = defaultLabels.trading.settlementDifferencesTitle;
|
|
47
|
-
var defaultTradingDisclaimer = defaultLabels.trading.disclaimer;
|
|
48
|
-
var getTradingDateLabel = (value) => {
|
|
49
|
-
const parsedValue = dayjs(value);
|
|
50
|
-
if (!parsedValue.isValid()) {
|
|
51
|
-
return typeof value === "string" ? value : "";
|
|
52
|
-
}
|
|
53
|
-
return parsedValue.format("MMM D, YYYY");
|
|
54
|
-
};
|
|
55
|
-
var getTradingVenueLabel = (venue, label) => {
|
|
56
|
-
var _a;
|
|
57
|
-
if (label) return label;
|
|
58
|
-
if (!venue) return "Unknown";
|
|
59
|
-
return (_a = defaultLabels.venues[venue]) != null ? _a : venue;
|
|
60
|
-
};
|
|
61
|
-
var getTradingValueLabel = ({
|
|
62
|
-
amount,
|
|
63
|
-
minimumFractionDigits = 0,
|
|
64
|
-
maximumFractionDigits = 2
|
|
65
|
-
}) => {
|
|
66
|
-
return amount.toLocaleString("en-US", {
|
|
67
|
-
style: "currency",
|
|
68
|
-
currency: "USD",
|
|
69
|
-
minimumFractionDigits,
|
|
70
|
-
maximumFractionDigits
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
var getTradingPriceLabel = (value) => {
|
|
74
|
-
return `${Math.round(value * 100)}\xA2`;
|
|
75
|
-
};
|
|
76
|
-
var getTradingAveragePriceLabel = (value) => {
|
|
77
|
-
return defaultLabels.trading.averagePrice(value);
|
|
78
|
-
};
|
|
79
|
-
var getTradingBalanceLabel = (value) => {
|
|
80
|
-
return defaultLabels.trading.balance(formatUsd(value));
|
|
81
|
-
};
|
|
82
|
-
var getTradingSharesLabel = (value) => {
|
|
83
|
-
return defaultLabels.trading.shares(value);
|
|
84
|
-
};
|
|
85
|
-
var getTradingSlippageLabel = (value) => {
|
|
86
|
-
return defaultLabels.trading.slippage(value);
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
// src/trading/settlement/index.tsx
|
|
90
|
-
import { useLabels, useSdkUiConfig } from "@agg-build/hooks";
|
|
91
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
92
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
93
|
-
var getSettlementHeaderClassName = () => {
|
|
94
|
-
return "flex items-center justify-between gap-4";
|
|
95
|
-
};
|
|
96
|
-
var Settlement = ({
|
|
97
|
-
sectionLabel = defaultSettlementSectionLabel,
|
|
98
|
-
question,
|
|
99
|
-
differencesTitle = defaultSettlementDifferencesTitle,
|
|
100
|
-
differences = [],
|
|
101
|
-
venues,
|
|
102
|
-
expandedVenue,
|
|
103
|
-
isLoading = false,
|
|
104
|
-
onExpandedVenueChange,
|
|
105
|
-
onShowMore,
|
|
106
|
-
className
|
|
107
|
-
}) => {
|
|
108
|
-
var _a, _b;
|
|
109
|
-
const labels = useLabels();
|
|
110
|
-
const {
|
|
111
|
-
features: { enableAnimations }
|
|
112
|
-
} = useSdkUiConfig();
|
|
113
|
-
const [internalExpandedVenue, setInternalExpandedVenue] = useState(
|
|
114
|
-
(_b = (_a = venues[0]) == null ? void 0 : _a.venue) != null ? _b : null
|
|
115
|
-
);
|
|
116
|
-
const [expandedDescriptionByVenue, setExpandedDescriptionByVenue] = useState({});
|
|
117
|
-
const [overflowingDescriptionByVenue, setOverflowingDescriptionByVenue] = useState({});
|
|
118
|
-
const [collapsedDescriptionByVenue, setCollapsedDescriptionByVenue] = useState({});
|
|
119
|
-
const descriptionWrapperRefs = useRef(/* @__PURE__ */ new Map());
|
|
120
|
-
const descriptionMeasureRefs = useRef(/* @__PURE__ */ new Map());
|
|
121
|
-
useEffect(() => {
|
|
122
|
-
if (expandedVenue === void 0) return;
|
|
123
|
-
setInternalExpandedVenue(expandedVenue);
|
|
124
|
-
}, [expandedVenue]);
|
|
125
|
-
const resolvedExpandedVenue = expandedVenue === void 0 ? internalExpandedVenue : expandedVenue;
|
|
126
|
-
const handleVenueClick = (venue) => {
|
|
127
|
-
const nextVenue = resolvedExpandedVenue === venue ? null : venue;
|
|
128
|
-
if (expandedVenue === void 0) {
|
|
129
|
-
setInternalExpandedVenue(nextVenue);
|
|
130
|
-
}
|
|
131
|
-
onExpandedVenueChange == null ? void 0 : onExpandedVenueChange(nextVenue);
|
|
132
|
-
};
|
|
133
|
-
const handleDescriptionWrapperRef = useCallback(
|
|
134
|
-
(venue, element) => {
|
|
135
|
-
if (!element) {
|
|
136
|
-
descriptionWrapperRefs.current.delete(venue);
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
descriptionWrapperRefs.current.set(venue, element);
|
|
140
|
-
},
|
|
141
|
-
[]
|
|
142
|
-
);
|
|
143
|
-
const handleDescriptionMeasureRef = useCallback(
|
|
144
|
-
(venue, element) => {
|
|
145
|
-
if (!element) {
|
|
146
|
-
descriptionMeasureRefs.current.delete(venue);
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
descriptionMeasureRefs.current.set(venue, element);
|
|
150
|
-
},
|
|
151
|
-
[]
|
|
152
|
-
);
|
|
153
|
-
const updateDescriptionLayout = useCallback(
|
|
154
|
-
(venue, description, showMoreLabel) => {
|
|
155
|
-
const descriptionWrapperElement = descriptionWrapperRefs.current.get(venue);
|
|
156
|
-
const descriptionMeasureElement = descriptionMeasureRefs.current.get(venue);
|
|
157
|
-
if (!descriptionWrapperElement || !descriptionMeasureElement) return;
|
|
158
|
-
const wrapperWidth = descriptionWrapperElement.clientWidth;
|
|
159
|
-
if (wrapperWidth <= 0) return;
|
|
160
|
-
const computedStyles = window.getComputedStyle(descriptionWrapperElement);
|
|
161
|
-
const parsedLineHeight = Number.parseFloat(computedStyles.lineHeight);
|
|
162
|
-
const lineHeight = Number.isFinite(parsedLineHeight) ? parsedLineHeight : 20;
|
|
163
|
-
const maxHeight = lineHeight * 2 + 1;
|
|
164
|
-
descriptionMeasureElement.style.width = `${wrapperWidth}px`;
|
|
165
|
-
const getHeight = (value) => {
|
|
166
|
-
descriptionMeasureElement.textContent = value;
|
|
167
|
-
return descriptionMeasureElement.scrollHeight;
|
|
168
|
-
};
|
|
169
|
-
const fullHeight = getHeight(description);
|
|
170
|
-
if (fullHeight <= maxHeight) {
|
|
171
|
-
setOverflowingDescriptionByVenue((currentState) => {
|
|
172
|
-
if (currentState[venue] === false) return currentState;
|
|
173
|
-
return __spreadProps(__spreadValues({}, currentState), {
|
|
174
|
-
[venue]: false
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
setCollapsedDescriptionByVenue((currentState) => {
|
|
178
|
-
if (currentState[venue] === description) return currentState;
|
|
179
|
-
return __spreadProps(__spreadValues({}, currentState), {
|
|
180
|
-
[venue]: description
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
const suffix = `... ${showMoreLabel}`;
|
|
186
|
-
let left = 0;
|
|
187
|
-
let right = description.length;
|
|
188
|
-
let bestLength = 0;
|
|
189
|
-
while (left <= right) {
|
|
190
|
-
const middle = Math.floor((left + right) / 2);
|
|
191
|
-
const candidate = description.slice(0, middle).trimEnd();
|
|
192
|
-
const candidateHeight = getHeight(`${candidate}${suffix}`);
|
|
193
|
-
if (candidateHeight <= maxHeight) {
|
|
194
|
-
bestLength = middle;
|
|
195
|
-
left = middle + 1;
|
|
196
|
-
continue;
|
|
197
|
-
}
|
|
198
|
-
right = middle - 1;
|
|
199
|
-
}
|
|
200
|
-
const collapsedDescription = description.slice(0, bestLength).trimEnd();
|
|
201
|
-
setOverflowingDescriptionByVenue((currentState) => {
|
|
202
|
-
if (currentState[venue] === true) return currentState;
|
|
203
|
-
return __spreadProps(__spreadValues({}, currentState), {
|
|
204
|
-
[venue]: true
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
setCollapsedDescriptionByVenue((currentState) => {
|
|
208
|
-
if (currentState[venue] === collapsedDescription) return currentState;
|
|
209
|
-
return __spreadProps(__spreadValues({}, currentState), {
|
|
210
|
-
[venue]: collapsedDescription
|
|
211
|
-
});
|
|
212
|
-
});
|
|
213
|
-
},
|
|
214
|
-
[]
|
|
215
|
-
);
|
|
216
|
-
useEffect(() => {
|
|
217
|
-
if (typeof window === "undefined") return;
|
|
218
|
-
if (!resolvedExpandedVenue) return;
|
|
219
|
-
if (expandedDescriptionByVenue[resolvedExpandedVenue]) return;
|
|
220
|
-
const expandedVenueItem = venues.find((venueItem) => venueItem.venue === resolvedExpandedVenue);
|
|
221
|
-
if (!expandedVenueItem) return;
|
|
222
|
-
const frameId = window.requestAnimationFrame(() => {
|
|
223
|
-
var _a2;
|
|
224
|
-
updateDescriptionLayout(
|
|
225
|
-
resolvedExpandedVenue,
|
|
226
|
-
expandedVenueItem.description,
|
|
227
|
-
(_a2 = expandedVenueItem.showMoreLabel) != null ? _a2 : "Show more"
|
|
228
|
-
);
|
|
229
|
-
});
|
|
230
|
-
return () => {
|
|
231
|
-
window.cancelAnimationFrame(frameId);
|
|
232
|
-
};
|
|
233
|
-
}, [expandedDescriptionByVenue, resolvedExpandedVenue, updateDescriptionLayout, venues]);
|
|
234
|
-
useEffect(() => {
|
|
235
|
-
if (!resolvedExpandedVenue) return;
|
|
236
|
-
if (expandedDescriptionByVenue[resolvedExpandedVenue]) return;
|
|
237
|
-
if (typeof ResizeObserver === "undefined") return;
|
|
238
|
-
const expandedVenueItem = venues.find((venueItem) => venueItem.venue === resolvedExpandedVenue);
|
|
239
|
-
if (!expandedVenueItem) return;
|
|
240
|
-
const descriptionWrapperElement = descriptionWrapperRefs.current.get(resolvedExpandedVenue);
|
|
241
|
-
if (!descriptionWrapperElement) return;
|
|
242
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
243
|
-
var _a2;
|
|
244
|
-
updateDescriptionLayout(
|
|
245
|
-
resolvedExpandedVenue,
|
|
246
|
-
expandedVenueItem.description,
|
|
247
|
-
(_a2 = expandedVenueItem.showMoreLabel) != null ? _a2 : "Show more"
|
|
248
|
-
);
|
|
249
|
-
});
|
|
250
|
-
resizeObserver.observe(descriptionWrapperElement);
|
|
251
|
-
return () => {
|
|
252
|
-
resizeObserver.disconnect();
|
|
253
|
-
};
|
|
254
|
-
}, [expandedDescriptionByVenue, resolvedExpandedVenue, updateDescriptionLayout, venues]);
|
|
255
|
-
const handleDescriptionShowMoreClick = (event, venue) => {
|
|
256
|
-
event == null ? void 0 : event.stopPropagation();
|
|
257
|
-
setExpandedDescriptionByVenue((currentState) => {
|
|
258
|
-
if (currentState[venue]) return currentState;
|
|
259
|
-
return __spreadProps(__spreadValues({}, currentState), {
|
|
260
|
-
[venue]: true
|
|
261
|
-
});
|
|
262
|
-
});
|
|
263
|
-
onShowMore == null ? void 0 : onShowMore(venue);
|
|
264
|
-
};
|
|
265
|
-
if (isLoading) {
|
|
266
|
-
return /* @__PURE__ */ jsx(
|
|
267
|
-
Skeleton,
|
|
268
|
-
{
|
|
269
|
-
ariaLabel: labels.trading.settlementLoading,
|
|
270
|
-
className,
|
|
271
|
-
view: skeletonViews.settlement
|
|
272
|
-
}
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
return /* @__PURE__ */ jsxs(
|
|
276
|
-
Card,
|
|
277
|
-
{
|
|
278
|
-
className: cn(
|
|
279
|
-
"group/agg-settlement-card",
|
|
280
|
-
"flex flex-col w-full gap-5 rounded-agg-xl border border-agg-separator bg-agg-secondary p-5 shadow-none hover:shadow-none",
|
|
281
|
-
className
|
|
282
|
-
),
|
|
283
|
-
children: [
|
|
284
|
-
/* @__PURE__ */ jsxs("div", { className: cn("agg-settlement-header", getSettlementHeaderClassName()), children: [
|
|
285
|
-
/* @__PURE__ */ jsx("p", { className: "text-agg-xs font-agg-bold leading-agg-4 uppercase text-agg-muted-foreground", children: sectionLabel === defaultSettlementSectionLabel ? labels.trading.settlementSection : sectionLabel }),
|
|
286
|
-
question ? /* @__PURE__ */ jsx("p", { className: "agg-settlement-question text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: question }) : null
|
|
287
|
-
] }),
|
|
288
|
-
differences.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
289
|
-
/* @__PURE__ */ jsxs("div", { className: "agg-settlement-differences flex flex-col gap-2", children: [
|
|
290
|
-
/* @__PURE__ */ jsx("p", { className: "agg-settlement-differences-title text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: differencesTitle === defaultSettlementDifferencesTitle ? labels.trading.settlementDifferencesTitle : differencesTitle }),
|
|
291
|
-
/* @__PURE__ */ jsx("ul", { className: "agg-settlement-differences-list list-disc pl-5 text-agg-sm leading-agg-5 text-agg-foreground", children: differences.map((difference) => /* @__PURE__ */ jsx("li", { children: difference }, difference)) })
|
|
292
|
-
] }),
|
|
293
|
-
/* @__PURE__ */ jsx("div", { className: "h-px w-full bg-agg-separator" })
|
|
294
|
-
] }) : null,
|
|
295
|
-
/* @__PURE__ */ jsx("div", { className: "agg-settlement-venues flex flex-col gap-3", children: venues.map((venue) => {
|
|
296
|
-
var _a2, _b2;
|
|
297
|
-
const venueLabel = getTradingVenueLabel(venue.venue, venue.label);
|
|
298
|
-
const isExpanded = resolvedExpandedVenue === venue.venue;
|
|
299
|
-
const isDescriptionExpanded = !!expandedDescriptionByVenue[venue.venue];
|
|
300
|
-
const isDescriptionOverflowing = !!overflowingDescriptionByVenue[venue.venue];
|
|
301
|
-
const shouldShowDescriptionCta = isExpanded && isDescriptionOverflowing && !isDescriptionExpanded;
|
|
302
|
-
const resolvedShowMoreLabel = (_a2 = venue.showMoreLabel) != null ? _a2 : "Show more";
|
|
303
|
-
return /* @__PURE__ */ jsxs("div", { className: "agg-settlement-venue flex flex-col", children: [
|
|
304
|
-
/* @__PURE__ */ jsxs(
|
|
305
|
-
"button",
|
|
306
|
-
{
|
|
307
|
-
type: "button",
|
|
308
|
-
className: cn(
|
|
309
|
-
"agg-settlement-venue-trigger",
|
|
310
|
-
"flex items-center gap-2 text-left",
|
|
311
|
-
"cursor-pointer disabled:cursor-not-allowed hover:opacity-50",
|
|
312
|
-
getMotionClassName(
|
|
313
|
-
enableAnimations,
|
|
314
|
-
"transition-[opacity,color] duration-200 ease-in-out"
|
|
315
|
-
)
|
|
316
|
-
),
|
|
317
|
-
"aria-expanded": isExpanded,
|
|
318
|
-
"aria-label": labels.trading.settlementDetailsAria(venueLabel),
|
|
319
|
-
onClick: (e) => {
|
|
320
|
-
e.stopPropagation();
|
|
321
|
-
e.preventDefault();
|
|
322
|
-
handleVenueClick(venue.venue);
|
|
323
|
-
},
|
|
324
|
-
children: [
|
|
325
|
-
/* @__PURE__ */ jsx(
|
|
326
|
-
VenueLogo,
|
|
327
|
-
{
|
|
328
|
-
venue: venue.venue,
|
|
329
|
-
size: "small",
|
|
330
|
-
ariaLabel: venueLabel
|
|
331
|
-
}
|
|
332
|
-
),
|
|
333
|
-
/* @__PURE__ */ jsx(
|
|
334
|
-
"span",
|
|
335
|
-
{
|
|
336
|
-
className: cn(
|
|
337
|
-
"text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground",
|
|
338
|
-
"text-agg-foreground"
|
|
339
|
-
),
|
|
340
|
-
children: venueLabel
|
|
341
|
-
}
|
|
342
|
-
),
|
|
343
|
-
/* @__PURE__ */ jsx(
|
|
344
|
-
Icon,
|
|
345
|
-
{
|
|
346
|
-
name: isExpanded ? "chevron-up" : "chevron-down",
|
|
347
|
-
size: "small",
|
|
348
|
-
className: "text-agg-foreground",
|
|
349
|
-
color: "currentColor"
|
|
350
|
-
}
|
|
351
|
-
)
|
|
352
|
-
]
|
|
353
|
-
}
|
|
354
|
-
),
|
|
355
|
-
/* @__PURE__ */ jsx(
|
|
356
|
-
"div",
|
|
357
|
-
{
|
|
358
|
-
"aria-hidden": !isExpanded,
|
|
359
|
-
className: cn(
|
|
360
|
-
"grid overflow-hidden",
|
|
361
|
-
isExpanded ? "mt-2 grid-rows-[1fr] opacity-100" : "mt-0 grid-rows-[0fr] opacity-0",
|
|
362
|
-
!isExpanded && "pointer-events-none",
|
|
363
|
-
getMotionClassName(
|
|
364
|
-
enableAnimations,
|
|
365
|
-
"transition-[grid-template-rows,opacity,margin-top] duration-300 ease-in-out"
|
|
366
|
-
)
|
|
367
|
-
),
|
|
368
|
-
children: /* @__PURE__ */ jsxs(
|
|
369
|
-
"div",
|
|
370
|
-
{
|
|
371
|
-
ref: (element) => handleDescriptionWrapperRef(venue.venue, element),
|
|
372
|
-
className: "agg-settlement-venue-content relative min-h-0",
|
|
373
|
-
children: [
|
|
374
|
-
/* @__PURE__ */ jsxs("p", { className: "agg-settlement-venue-description min-h-0 text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
375
|
-
isDescriptionExpanded || !isDescriptionOverflowing ? venue.description : (_b2 = collapsedDescriptionByVenue[venue.venue]) != null ? _b2 : venue.description,
|
|
376
|
-
shouldShowDescriptionCta ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
377
|
-
"... ",
|
|
378
|
-
/* @__PURE__ */ jsx(
|
|
379
|
-
"button",
|
|
380
|
-
{
|
|
381
|
-
type: "button",
|
|
382
|
-
tabIndex: isExpanded ? 0 : -1,
|
|
383
|
-
className: cn(
|
|
384
|
-
"agg-settlement-venue-action",
|
|
385
|
-
"cursor-pointer disabled:cursor-not-allowed",
|
|
386
|
-
"text-agg-sm leading-agg-5 text-agg-foreground underline-offset-2 hover:underline hover:font-agg-bold",
|
|
387
|
-
getMotionClassName(
|
|
388
|
-
enableAnimations,
|
|
389
|
-
"transition-[text-decoration] duration-200 ease-in-out"
|
|
390
|
-
)
|
|
391
|
-
),
|
|
392
|
-
"aria-label": labels.trading.settlementShowMoreAria(
|
|
393
|
-
resolvedShowMoreLabel,
|
|
394
|
-
venueLabel
|
|
395
|
-
),
|
|
396
|
-
onClick: (event) => handleDescriptionShowMoreClick(event, venue.venue),
|
|
397
|
-
children: resolvedShowMoreLabel
|
|
398
|
-
}
|
|
399
|
-
)
|
|
400
|
-
] }) : null
|
|
401
|
-
] }),
|
|
402
|
-
/* @__PURE__ */ jsx(
|
|
403
|
-
"p",
|
|
404
|
-
{
|
|
405
|
-
ref: (element) => handleDescriptionMeasureRef(venue.venue, element),
|
|
406
|
-
"aria-hidden": true,
|
|
407
|
-
className: "pointer-events-none invisible fixed top-0 left-0 -z-10 whitespace-normal text-agg-sm leading-agg-5"
|
|
408
|
-
}
|
|
409
|
-
)
|
|
410
|
-
]
|
|
411
|
-
}
|
|
412
|
-
)
|
|
413
|
-
}
|
|
414
|
-
)
|
|
415
|
-
] }, venue.venue);
|
|
416
|
-
}) })
|
|
417
|
-
]
|
|
418
|
-
}
|
|
419
|
-
);
|
|
420
|
-
};
|
|
421
|
-
Settlement.displayName = "Settlement";
|
|
422
|
-
|
|
423
47
|
// src/trading/settlement/settlement-details.tsx
|
|
424
|
-
import { useEventTradingContext
|
|
425
|
-
import {
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
var SETTLEMENT_FIELD_KEYS = ["description", "rulesPrimary", "rulesSecondary"];
|
|
429
|
-
var FIELD_TO_LABEL_KEY = {
|
|
430
|
-
description: "settlementDescriptionLabel",
|
|
431
|
-
rulesPrimary: "settlementRulesPrimaryLabel",
|
|
432
|
-
rulesSecondary: "settlementRulesSecondaryLabel"
|
|
48
|
+
import { useEventTradingContext } from "@agg-build/hooks";
|
|
49
|
+
import { jsx } from "react/jsx-runtime";
|
|
50
|
+
var hasContent = (value) => {
|
|
51
|
+
return typeof value === "string" && value.trim().length > 0;
|
|
433
52
|
};
|
|
434
|
-
function mapVenueMarketsToSettlementSections(venueMarkets, labels, selectedMarketId) {
|
|
435
|
-
return SETTLEMENT_FIELD_KEYS.reduce((sections, fieldKey) => {
|
|
436
|
-
const venues = venueMarkets.filter((market) => {
|
|
437
|
-
const value = market[fieldKey];
|
|
438
|
-
return typeof value === "string" && value.trim().length > 0;
|
|
439
|
-
}).map(
|
|
440
|
-
(market) => market.id === selectedMarketId ? {
|
|
441
|
-
marketId: market.id,
|
|
442
|
-
venue: market.venue,
|
|
443
|
-
description: market[fieldKey]
|
|
444
|
-
} : null
|
|
445
|
-
).filter((venue) => venue !== null);
|
|
446
|
-
if (venues.length > 0) {
|
|
447
|
-
sections.push({
|
|
448
|
-
key: fieldKey,
|
|
449
|
-
label: labels.trading[FIELD_TO_LABEL_KEY[fieldKey]],
|
|
450
|
-
venues
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
return sections;
|
|
454
|
-
}, []);
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
// src/trading/settlement/settlement-details.tsx
|
|
458
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
459
53
|
var SettlementDetails = ({ className }) => {
|
|
460
54
|
var _a, _b, _c, _d, _e, _f;
|
|
461
|
-
const labels = useLabels2();
|
|
462
55
|
const tradingContext = useEventTradingContext();
|
|
463
|
-
const
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
return /* @__PURE__ */ jsx2("div", { className: "agg-settlement-list flex flex-col gap-6", children: /* @__PURE__ */ jsx2("div", { className: "agg-settlement-list-item", children: /* @__PURE__ */ jsx2(
|
|
56
|
+
const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
|
|
57
|
+
const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
|
|
58
|
+
if (!selectedEvent) return null;
|
|
59
|
+
if (!selectedMarket) return null;
|
|
60
|
+
const eventDescription = (_c = selectedEvent.description) != null ? _c : null;
|
|
61
|
+
const marketDescription = (_d = selectedMarket.description) != null ? _d : null;
|
|
62
|
+
const primaryRules = (_e = selectedMarket.rulesPrimary) != null ? _e : null;
|
|
63
|
+
if (!hasContent(eventDescription) && !hasContent(marketDescription) && !hasContent(primaryRules)) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
return /* @__PURE__ */ jsx("div", { className: "agg-settlement-list flex flex-col gap-6", children: /* @__PURE__ */ jsx("div", { className: "agg-settlement-list-item", children: /* @__PURE__ */ jsx(
|
|
475
67
|
Settlement,
|
|
476
68
|
{
|
|
477
|
-
question: (
|
|
478
|
-
|
|
69
|
+
question: (_f = selectedMarket.question) != null ? _f : selectedEvent.title,
|
|
70
|
+
eventDescription,
|
|
71
|
+
marketDescription,
|
|
72
|
+
primaryRules,
|
|
479
73
|
className
|
|
480
74
|
}
|
|
481
75
|
) }) });
|
|
@@ -500,16 +94,16 @@ import {
|
|
|
500
94
|
useExecutionPositions,
|
|
501
95
|
useExecutionProgress,
|
|
502
96
|
useGeoBlock,
|
|
503
|
-
useLabels
|
|
97
|
+
useLabels,
|
|
504
98
|
useLiveOutcomePrices,
|
|
505
99
|
useMidpoints,
|
|
506
100
|
useQueryClient,
|
|
507
|
-
useSdkUiConfig
|
|
101
|
+
useSdkUiConfig,
|
|
508
102
|
useSmartRoute
|
|
509
103
|
} from "@agg-build/hooks";
|
|
510
104
|
import NumberFlow from "@number-flow/react";
|
|
511
105
|
import * as Dialog from "@radix-ui/react-dialog";
|
|
512
|
-
import { Fragment
|
|
106
|
+
import { Fragment, useCallback as useCallback2, useEffect as useEffect2, useId, useMemo as useMemo2, useRef as useRef2, useState as useState3 } from "react";
|
|
513
107
|
|
|
514
108
|
// src/shared/deposit-modal-events.ts
|
|
515
109
|
var DEPOSIT_MODAL_OPEN_EVENT = "agg-deposit:open-modal";
|
|
@@ -525,7 +119,7 @@ var requestAggWithdrawModalOpen = () => {
|
|
|
525
119
|
|
|
526
120
|
// src/trading/use-kalshi-kyc-flow.ts
|
|
527
121
|
import { useAggClient, useDepositAddresses } from "@agg-build/hooks";
|
|
528
|
-
import { useCallback
|
|
122
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
529
123
|
var KYC_PENDING_STORAGE_KEY = "agg_kyc_pending";
|
|
530
124
|
var getKycPendingState = () => {
|
|
531
125
|
var _a, _b;
|
|
@@ -556,13 +150,13 @@ var useKalshiKycFlow = ({
|
|
|
556
150
|
onError
|
|
557
151
|
}) => {
|
|
558
152
|
const client = useAggClient();
|
|
559
|
-
const [isVerifyModalOpen, setIsVerifyModalOpen] =
|
|
560
|
-
const [showSuccessModal, setShowSuccessModal] =
|
|
561
|
-
const [isInitiating, setIsInitiating] =
|
|
562
|
-
const [needsDepositAddress, setNeedsDepositAddress] =
|
|
563
|
-
const initiationAttemptRef =
|
|
153
|
+
const [isVerifyModalOpen, setIsVerifyModalOpen] = useState(false);
|
|
154
|
+
const [showSuccessModal, setShowSuccessModal] = useState(false);
|
|
155
|
+
const [isInitiating, setIsInitiating] = useState(false);
|
|
156
|
+
const [needsDepositAddress, setNeedsDepositAddress] = useState(false);
|
|
157
|
+
const initiationAttemptRef = useRef(0);
|
|
564
158
|
const { isReady, isTimedOut } = useDepositAddresses({ enabled: needsDepositAddress, poll: true });
|
|
565
|
-
const pendingState =
|
|
159
|
+
const pendingState = useMemo(
|
|
566
160
|
() => ({
|
|
567
161
|
venue: "kalshi",
|
|
568
162
|
userId: userId != null ? userId : null,
|
|
@@ -570,28 +164,28 @@ var useKalshiKycFlow = ({
|
|
|
570
164
|
}),
|
|
571
165
|
[userId, walletAddress]
|
|
572
166
|
);
|
|
573
|
-
const resetInitiation =
|
|
167
|
+
const resetInitiation = useCallback(() => {
|
|
574
168
|
setIsInitiating(false);
|
|
575
169
|
setNeedsDepositAddress(false);
|
|
576
170
|
}, []);
|
|
577
|
-
const closeVerifyModal =
|
|
171
|
+
const closeVerifyModal = useCallback(() => {
|
|
578
172
|
initiationAttemptRef.current += 1;
|
|
579
173
|
clearKycPendingState();
|
|
580
174
|
resetInitiation();
|
|
581
175
|
setIsVerifyModalOpen(false);
|
|
582
176
|
}, [resetInitiation]);
|
|
583
|
-
const closeSuccessModal =
|
|
177
|
+
const closeSuccessModal = useCallback(() => {
|
|
584
178
|
setShowSuccessModal(false);
|
|
585
179
|
}, []);
|
|
586
|
-
const openVerifyModal =
|
|
180
|
+
const openVerifyModal = useCallback(() => {
|
|
587
181
|
setIsVerifyModalOpen(true);
|
|
588
182
|
}, []);
|
|
589
|
-
const startVerification =
|
|
183
|
+
const startVerification = useCallback(() => {
|
|
590
184
|
initiationAttemptRef.current += 1;
|
|
591
185
|
setIsInitiating(true);
|
|
592
186
|
setNeedsDepositAddress(true);
|
|
593
187
|
}, []);
|
|
594
|
-
|
|
188
|
+
useEffect(() => {
|
|
595
189
|
if (!isInitiating || !isReady) return;
|
|
596
190
|
const attemptId = initiationAttemptRef.current;
|
|
597
191
|
const redirectUri = window.location.href;
|
|
@@ -608,14 +202,14 @@ var useKalshiKycFlow = ({
|
|
|
608
202
|
resetInitiation();
|
|
609
203
|
});
|
|
610
204
|
}, [client, isInitiating, isReady, onError, pendingState, resetInitiation]);
|
|
611
|
-
|
|
205
|
+
useEffect(() => {
|
|
612
206
|
if (isTimedOut && isInitiating) {
|
|
613
207
|
clearKycPendingState();
|
|
614
208
|
resetInitiation();
|
|
615
209
|
onError == null ? void 0 : onError(new Error("Deposit address provisioning timed out"));
|
|
616
210
|
}
|
|
617
211
|
}, [isInitiating, isTimedOut, onError, resetInitiation]);
|
|
618
|
-
|
|
212
|
+
useEffect(() => {
|
|
619
213
|
const storedPendingState = getKycPendingState();
|
|
620
214
|
const isMatchingSession = (storedPendingState == null ? void 0 : storedPendingState.venue) === "kalshi" && storedPendingState.userId === pendingState.userId && storedPendingState.walletAddress === pendingState.walletAddress;
|
|
621
215
|
if (isKalshiVerified && isMatchingSession) {
|
|
@@ -862,14 +456,14 @@ var buildLiveRouteCards = ({
|
|
|
862
456
|
const isPrimaryRouteGeoBlocked = quoteData.fills.length > 0 && quoteData.fills.every((f) => geoBlockedVenues.has(f.venue));
|
|
863
457
|
const primaryCard = primaryResult ? isPrimaryRouteGeoBlocked ? {
|
|
864
458
|
id: "live-route",
|
|
865
|
-
hint:
|
|
459
|
+
hint: labels.venueUnavailableInRegion,
|
|
866
460
|
kind: "venue",
|
|
867
461
|
label: getTradingVenueLabel(
|
|
868
462
|
parsedPrimaryVenue.success ? parsedPrimaryVenue.data : void 0
|
|
869
463
|
),
|
|
870
|
-
numericValue:
|
|
464
|
+
numericValue: tradeSide === "sell" ? quoteData.rawExecCost : quoteData.totalFilled,
|
|
871
465
|
quoteData,
|
|
872
|
-
value:
|
|
466
|
+
value: primaryResult.value,
|
|
873
467
|
venue: parsedPrimaryVenue.success ? parsedPrimaryVenue.data : void 0,
|
|
874
468
|
isUnavailable: true
|
|
875
469
|
} : {
|
|
@@ -894,12 +488,16 @@ var buildLiveRouteCards = ({
|
|
|
894
488
|
if (geoBlockedVenues.has(sq.venue)) {
|
|
895
489
|
return {
|
|
896
490
|
id: `live-unavailable-${sq.venue}`,
|
|
897
|
-
hint:
|
|
491
|
+
hint: labels.venueUnavailableInRegion,
|
|
898
492
|
kind: "venue",
|
|
899
493
|
label: getTradingVenueLabel(venue),
|
|
900
|
-
numericValue:
|
|
494
|
+
numericValue: sq.filledQty,
|
|
901
495
|
quoteData,
|
|
902
|
-
value:
|
|
496
|
+
value: getTradingValueLabel({
|
|
497
|
+
amount: sq.filledQty,
|
|
498
|
+
minimumFractionDigits: 2,
|
|
499
|
+
maximumFractionDigits: 2
|
|
500
|
+
}),
|
|
903
501
|
venue,
|
|
904
502
|
isUnavailable: true
|
|
905
503
|
};
|
|
@@ -939,7 +537,7 @@ var buildLiveRouteCards = ({
|
|
|
939
537
|
const venue = parsedVenue.success ? parsedVenue.data : void 0;
|
|
940
538
|
return {
|
|
941
539
|
id: `live-unavailable-${sq.venue}`,
|
|
942
|
-
hint:
|
|
540
|
+
hint: labels.venueUnavailableInRegion,
|
|
943
541
|
kind: "venue",
|
|
944
542
|
label: getTradingVenueLabel(venue),
|
|
945
543
|
numericValue: 0,
|
|
@@ -959,7 +557,7 @@ var buildLiveRouteCards = ({
|
|
|
959
557
|
return [
|
|
960
558
|
{
|
|
961
559
|
id: "live-geo-blocked-kalshi",
|
|
962
|
-
hint:
|
|
560
|
+
hint: labels.venueUnavailableInRegion,
|
|
963
561
|
kind: "venue",
|
|
964
562
|
label: getTradingVenueLabel(kalshiVenue),
|
|
965
563
|
numericValue: 0,
|
|
@@ -978,14 +576,6 @@ var resolveExecutionVenueFromQuote = (quoteData) => {
|
|
|
978
576
|
const parsed = parseVenue(dominantFill == null ? void 0 : dominantFill.venue);
|
|
979
577
|
return parsed.success ? parsed.data : void 0;
|
|
980
578
|
};
|
|
981
|
-
var resolvePlaceOrderSuccessTone = ({
|
|
982
|
-
outcomeIndex,
|
|
983
|
-
tab
|
|
984
|
-
}) => {
|
|
985
|
-
const isNegativeOutcome = outcomeIndex > 0;
|
|
986
|
-
const isPositiveExposure = tab === "buy" && !isNegativeOutcome || tab === "sell" && isNegativeOutcome;
|
|
987
|
-
return isPositiveExposure ? "positive" : "negative";
|
|
988
|
-
};
|
|
989
579
|
var getPlaceOrderPotentialReturn = (quoteData) => {
|
|
990
580
|
var _a, _b;
|
|
991
581
|
if (!((_a = quoteData == null ? void 0 : quoteData.fills) == null ? void 0 : _a.length) || quoteData.fills.length < 2) return 0;
|
|
@@ -1542,7 +1132,7 @@ var isPercentageBelowMinimum = (value, minimumValue) => {
|
|
|
1542
1132
|
};
|
|
1543
1133
|
|
|
1544
1134
|
// src/trading/place-order/index.place-order.failure.tsx
|
|
1545
|
-
import { jsx as
|
|
1135
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
1546
1136
|
var resolveFailureActionHandler = ({
|
|
1547
1137
|
action,
|
|
1548
1138
|
onDone,
|
|
@@ -1555,12 +1145,12 @@ var resolveFailureActionHandler = ({
|
|
|
1555
1145
|
};
|
|
1556
1146
|
var renderPartialFailureStep = (step) => {
|
|
1557
1147
|
const isWarningStep = step.tone === "warning" || step.tone === "error";
|
|
1558
|
-
return /* @__PURE__ */
|
|
1148
|
+
return /* @__PURE__ */ jsxs(
|
|
1559
1149
|
"div",
|
|
1560
1150
|
{
|
|
1561
1151
|
className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
1562
1152
|
children: [
|
|
1563
|
-
/* @__PURE__ */
|
|
1153
|
+
/* @__PURE__ */ jsx2(
|
|
1564
1154
|
Icon,
|
|
1565
1155
|
{
|
|
1566
1156
|
name: isWarningStep ? "warning-filled" : "check-circle",
|
|
@@ -1569,8 +1159,8 @@ var renderPartialFailureStep = (step) => {
|
|
|
1569
1159
|
"aria-hidden": "true"
|
|
1570
1160
|
}
|
|
1571
1161
|
),
|
|
1572
|
-
/* @__PURE__ */
|
|
1573
|
-
step.venue ? /* @__PURE__ */
|
|
1162
|
+
/* @__PURE__ */ jsx2("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
1163
|
+
step.venue ? /* @__PURE__ */ jsx2(VenueLogo, { venue: step.venue, size: "small", className: "h-4 w-4 shrink-0" }) : null
|
|
1574
1164
|
]
|
|
1575
1165
|
},
|
|
1576
1166
|
step.id
|
|
@@ -1589,10 +1179,10 @@ var PlaceOrderFailureView = ({
|
|
|
1589
1179
|
const shouldShowPartialFailureLayout = summary.kind === "partial_fill";
|
|
1590
1180
|
const failureStepGroups = shouldShowPartialFailureLayout ? groupPlaceOrderFailureSteps(summary.steps) : [];
|
|
1591
1181
|
if (shouldShowPartialFailureLayout) {
|
|
1592
|
-
return /* @__PURE__ */
|
|
1593
|
-
/* @__PURE__ */
|
|
1594
|
-
/* @__PURE__ */
|
|
1595
|
-
/* @__PURE__ */
|
|
1182
|
+
return /* @__PURE__ */ jsx2(Card, { className: cn("group/agg-order-panel", getPlaceOrderContainerClassName(), className), children: /* @__PURE__ */ jsxs("div", { className: "agg-order-failure-body flex flex-col gap-6 p-5", children: [
|
|
1183
|
+
/* @__PURE__ */ jsxs("div", { className: "agg-order-failure-header flex flex-col gap-2", children: [
|
|
1184
|
+
/* @__PURE__ */ jsxs("div", { className: "agg-order-failure-market flex items-center gap-3", children: [
|
|
1185
|
+
/* @__PURE__ */ jsx2(
|
|
1596
1186
|
RemoteImage,
|
|
1597
1187
|
{
|
|
1598
1188
|
src: (_a = summary.eventImage) != null ? _a : null,
|
|
@@ -1600,12 +1190,12 @@ var PlaceOrderFailureView = ({
|
|
|
1600
1190
|
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
1601
1191
|
}
|
|
1602
1192
|
),
|
|
1603
|
-
/* @__PURE__ */
|
|
1193
|
+
/* @__PURE__ */ jsx2("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 })
|
|
1604
1194
|
] }),
|
|
1605
|
-
summary.eventSubtitle ? /* @__PURE__ */
|
|
1195
|
+
summary.eventSubtitle ? /* @__PURE__ */ jsx2("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
|
|
1606
1196
|
] }),
|
|
1607
|
-
/* @__PURE__ */
|
|
1608
|
-
/* @__PURE__ */
|
|
1197
|
+
/* @__PURE__ */ jsx2("div", { className: "flex flex-col gap-4", children: failureStepGroups.map((group, groupIndex) => /* @__PURE__ */ jsx2("div", { className: "flex flex-col gap-2", children: group.map((step) => renderPartialFailureStep(step)) }, `failure-group-${groupIndex}`)) }),
|
|
1198
|
+
/* @__PURE__ */ jsx2("div", { className: "flex items-center gap-4", children: summary.actions.map((action) => /* @__PURE__ */ jsx2(
|
|
1609
1199
|
Button,
|
|
1610
1200
|
{
|
|
1611
1201
|
variant: "tertiary",
|
|
@@ -1619,10 +1209,10 @@ var PlaceOrderFailureView = ({
|
|
|
1619
1209
|
)) })
|
|
1620
1210
|
] }) });
|
|
1621
1211
|
}
|
|
1622
|
-
return /* @__PURE__ */
|
|
1623
|
-
/* @__PURE__ */
|
|
1624
|
-
/* @__PURE__ */
|
|
1625
|
-
/* @__PURE__ */
|
|
1212
|
+
return /* @__PURE__ */ jsx2(Card, { className: cn("group/agg-order-panel", getPlaceOrderContainerClassName(), className), children: /* @__PURE__ */ jsxs("div", { className: "agg-order-failure-body flex flex-col gap-6 p-5", children: [
|
|
1213
|
+
/* @__PURE__ */ jsxs("div", { className: "agg-order-failure-header flex flex-col gap-2", children: [
|
|
1214
|
+
/* @__PURE__ */ jsxs("div", { className: "agg-order-failure-market flex items-center gap-3", children: [
|
|
1215
|
+
/* @__PURE__ */ jsx2(
|
|
1626
1216
|
RemoteImage,
|
|
1627
1217
|
{
|
|
1628
1218
|
src: (_b = summary.eventImage) != null ? _b : null,
|
|
@@ -1630,11 +1220,11 @@ var PlaceOrderFailureView = ({
|
|
|
1630
1220
|
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
1631
1221
|
}
|
|
1632
1222
|
),
|
|
1633
|
-
/* @__PURE__ */
|
|
1223
|
+
/* @__PURE__ */ jsx2("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 })
|
|
1634
1224
|
] }),
|
|
1635
|
-
summary.eventSubtitle ? /* @__PURE__ */
|
|
1225
|
+
summary.eventSubtitle ? /* @__PURE__ */ jsx2("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
|
|
1636
1226
|
] }),
|
|
1637
|
-
/* @__PURE__ */
|
|
1227
|
+
/* @__PURE__ */ jsx2(
|
|
1638
1228
|
InlineAlert,
|
|
1639
1229
|
{
|
|
1640
1230
|
tone: "error",
|
|
@@ -1643,7 +1233,7 @@ var PlaceOrderFailureView = ({
|
|
|
1643
1233
|
message: tradingLabels.orderFailureDescription((_c = summary.errorMessage) != null ? _c : "")
|
|
1644
1234
|
}
|
|
1645
1235
|
),
|
|
1646
|
-
/* @__PURE__ */
|
|
1236
|
+
/* @__PURE__ */ jsx2("div", { className: "agg-order-failure-actions flex items-center gap-3", children: summary.actions.map((action) => /* @__PURE__ */ jsx2(
|
|
1647
1237
|
Button,
|
|
1648
1238
|
{
|
|
1649
1239
|
variant: action.variant === "retry" ? "primary" : "secondary",
|
|
@@ -1660,8 +1250,8 @@ var PlaceOrderFailureView = ({
|
|
|
1660
1250
|
PlaceOrderFailureView.displayName = "PlaceOrderFailureView";
|
|
1661
1251
|
|
|
1662
1252
|
// src/trading/place-order/index.place-order.success.tsx
|
|
1663
|
-
import { useState as
|
|
1664
|
-
import { jsx as
|
|
1253
|
+
import { useState as useState2 } from "react";
|
|
1254
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1665
1255
|
var resolveBuyToWinLabel = (shares) => {
|
|
1666
1256
|
if (!shares) return "$0";
|
|
1667
1257
|
return shares.startsWith("$") ? shares : `$${shares}`;
|
|
@@ -1673,18 +1263,17 @@ var PlaceOrderSuccessView = ({
|
|
|
1673
1263
|
onDone,
|
|
1674
1264
|
onShare: _onShare
|
|
1675
1265
|
}) => {
|
|
1676
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j
|
|
1677
|
-
const [isExecutionDetailsExpanded, setIsExecutionDetailsExpanded] =
|
|
1266
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1267
|
+
const [isExecutionDetailsExpanded, setIsExecutionDetailsExpanded] = useState2(true);
|
|
1678
1268
|
const newTradeLabel = (_a = tradingLabels.orderNewTrade) != null ? _a : "New Trade";
|
|
1679
1269
|
const _shareLabel = (_b = tradingLabels.orderShare) != null ? _b : "Share";
|
|
1680
1270
|
const potentialReturnLabel = summary.potentialReturnLabel && tradingLabels.potentialReturnBonus ? tradingLabels.potentialReturnBonus(summary.potentialReturnLabel) : summary.potentialReturnLabel ? `+${summary.potentialReturnLabel} Better Payout` : null;
|
|
1681
|
-
const
|
|
1682
|
-
const
|
|
1683
|
-
const
|
|
1684
|
-
const
|
|
1685
|
-
const
|
|
1686
|
-
const
|
|
1687
|
-
const finalStep = (_i = executionStepGroups.at(-1)) == null ? void 0 : _i[0];
|
|
1271
|
+
const resolvedActionLabel = (_c = summary.actionLabel) != null ? _c : tradingLabels.orderSuccessTitle;
|
|
1272
|
+
const resolvedTradeSide = (_d = summary.tradeSide) != null ? _d : "buy";
|
|
1273
|
+
const resolvedAmountLabel = (_e = summary.amountLabel) != null ? _e : resolvedTradeSide === "sell" ? summary.shares : summary.estimatedCost;
|
|
1274
|
+
const resolvedToWinLabel = (_f = summary.toWinLabel) != null ? _f : resolvedTradeSide === "sell" ? summary.estimatedCost : resolveBuyToWinLabel(summary.shares);
|
|
1275
|
+
const executionStepGroups = (_g = summary.executionStepGroups) != null ? _g : [];
|
|
1276
|
+
const finalStep = (_h = executionStepGroups.at(-1)) == null ? void 0 : _h[0];
|
|
1688
1277
|
const detailedStepGroups = executionStepGroups.slice(0, -1);
|
|
1689
1278
|
const hasExecutionDetails = detailedStepGroups.length > 0;
|
|
1690
1279
|
const resolveStepIconName = (tone) => {
|
|
@@ -1693,23 +1282,23 @@ var PlaceOrderSuccessView = ({
|
|
|
1693
1282
|
const resolveStepIconClassName = (tone) => {
|
|
1694
1283
|
return tone === "warning" || tone === "error" ? "text-agg-warning" : "text-agg-primary";
|
|
1695
1284
|
};
|
|
1696
|
-
return /* @__PURE__ */
|
|
1697
|
-
summary.eventTitle ? /* @__PURE__ */
|
|
1698
|
-
/* @__PURE__ */
|
|
1699
|
-
/* @__PURE__ */
|
|
1285
|
+
return /* @__PURE__ */ jsx3(Card, { className: cn("group/agg-order-panel", getPlaceOrderContainerClassName(), className), children: /* @__PURE__ */ jsxs2("div", { className: "agg-order-success-body flex flex-col gap-6 p-5", children: [
|
|
1286
|
+
summary.eventTitle ? /* @__PURE__ */ jsxs2("div", { className: "agg-order-success-header flex flex-col gap-2", children: [
|
|
1287
|
+
/* @__PURE__ */ jsxs2("div", { className: "agg-order-success-market flex items-center gap-3", children: [
|
|
1288
|
+
/* @__PURE__ */ jsx3(
|
|
1700
1289
|
RemoteImage,
|
|
1701
1290
|
{
|
|
1702
|
-
src: (
|
|
1291
|
+
src: (_i = summary.eventImage) != null ? _i : null,
|
|
1703
1292
|
alt: "",
|
|
1704
1293
|
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
1705
1294
|
}
|
|
1706
1295
|
),
|
|
1707
|
-
/* @__PURE__ */
|
|
1296
|
+
/* @__PURE__ */ jsx3("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 })
|
|
1708
1297
|
] }),
|
|
1709
|
-
summary.eventDateLabel ? /* @__PURE__ */
|
|
1298
|
+
summary.eventDateLabel ? /* @__PURE__ */ jsx3("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventDateLabel }) : null
|
|
1710
1299
|
] }) : null,
|
|
1711
|
-
executionStepGroups.length > 0 ? /* @__PURE__ */
|
|
1712
|
-
/* @__PURE__ */
|
|
1300
|
+
executionStepGroups.length > 0 ? /* @__PURE__ */ jsxs2("div", { className: "agg-order-success-timeline flex flex-col gap-2", children: [
|
|
1301
|
+
/* @__PURE__ */ jsx3(
|
|
1713
1302
|
"div",
|
|
1714
1303
|
{
|
|
1715
1304
|
"aria-hidden": !isExecutionDetailsExpanded,
|
|
@@ -1722,12 +1311,12 @@ var PlaceOrderSuccessView = ({
|
|
|
1722
1311
|
"transition-[grid-template-rows,opacity] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
1723
1312
|
)
|
|
1724
1313
|
),
|
|
1725
|
-
children: /* @__PURE__ */
|
|
1314
|
+
children: /* @__PURE__ */ jsx3("div", { className: "min-h-0", children: /* @__PURE__ */ jsx3("div", { className: "flex flex-col gap-4 pb-2", children: detailedStepGroups.map((group, groupIndex) => /* @__PURE__ */ jsx3("div", { className: "flex flex-col gap-2", children: group.map((step) => /* @__PURE__ */ jsxs2(
|
|
1726
1315
|
"div",
|
|
1727
1316
|
{
|
|
1728
1317
|
className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
1729
1318
|
children: [
|
|
1730
|
-
/* @__PURE__ */
|
|
1319
|
+
/* @__PURE__ */ jsx3(
|
|
1731
1320
|
Icon,
|
|
1732
1321
|
{
|
|
1733
1322
|
name: resolveStepIconName(step.tone),
|
|
@@ -1736,8 +1325,8 @@ var PlaceOrderSuccessView = ({
|
|
|
1736
1325
|
"aria-hidden": "true"
|
|
1737
1326
|
}
|
|
1738
1327
|
),
|
|
1739
|
-
/* @__PURE__ */
|
|
1740
|
-
step.venue ? /* @__PURE__ */
|
|
1328
|
+
/* @__PURE__ */ jsx3("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
1329
|
+
step.venue ? /* @__PURE__ */ jsx3(
|
|
1741
1330
|
VenueLogo,
|
|
1742
1331
|
{
|
|
1743
1332
|
venue: step.venue,
|
|
@@ -1751,7 +1340,7 @@ var PlaceOrderSuccessView = ({
|
|
|
1751
1340
|
)) }, `execution-group-${groupIndex}`)) }) })
|
|
1752
1341
|
}
|
|
1753
1342
|
),
|
|
1754
|
-
finalStep ? hasExecutionDetails ? /* @__PURE__ */
|
|
1343
|
+
finalStep ? hasExecutionDetails ? /* @__PURE__ */ jsxs2(
|
|
1755
1344
|
"button",
|
|
1756
1345
|
{
|
|
1757
1346
|
type: "button",
|
|
@@ -1763,7 +1352,7 @@ var PlaceOrderSuccessView = ({
|
|
|
1763
1352
|
),
|
|
1764
1353
|
onClick: () => setIsExecutionDetailsExpanded((currentValue) => !currentValue),
|
|
1765
1354
|
children: [
|
|
1766
|
-
/* @__PURE__ */
|
|
1355
|
+
/* @__PURE__ */ jsx3(
|
|
1767
1356
|
Icon,
|
|
1768
1357
|
{
|
|
1769
1358
|
name: resolveStepIconName(finalStep.tone),
|
|
@@ -1772,8 +1361,8 @@ var PlaceOrderSuccessView = ({
|
|
|
1772
1361
|
"aria-hidden": "true"
|
|
1773
1362
|
}
|
|
1774
1363
|
),
|
|
1775
|
-
/* @__PURE__ */
|
|
1776
|
-
/* @__PURE__ */
|
|
1364
|
+
/* @__PURE__ */ jsx3("p", { className: "min-w-0 flex-1", children: finalStep.label }),
|
|
1365
|
+
/* @__PURE__ */ jsx3(
|
|
1777
1366
|
Icon,
|
|
1778
1367
|
{
|
|
1779
1368
|
name: isExecutionDetailsExpanded ? "chevron-up" : "chevron-down",
|
|
@@ -1784,8 +1373,8 @@ var PlaceOrderSuccessView = ({
|
|
|
1784
1373
|
)
|
|
1785
1374
|
]
|
|
1786
1375
|
}
|
|
1787
|
-
) : /* @__PURE__ */
|
|
1788
|
-
/* @__PURE__ */
|
|
1376
|
+
) : /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
1377
|
+
/* @__PURE__ */ jsx3(
|
|
1789
1378
|
Icon,
|
|
1790
1379
|
{
|
|
1791
1380
|
name: resolveStepIconName(finalStep.tone),
|
|
@@ -1794,35 +1383,34 @@ var PlaceOrderSuccessView = ({
|
|
|
1794
1383
|
"aria-hidden": "true"
|
|
1795
1384
|
}
|
|
1796
1385
|
),
|
|
1797
|
-
/* @__PURE__ */
|
|
1386
|
+
/* @__PURE__ */ jsx3("p", { className: "min-w-0 flex-1", children: finalStep.label })
|
|
1798
1387
|
] }) : null
|
|
1799
1388
|
] }) : null,
|
|
1800
|
-
/* @__PURE__ */
|
|
1389
|
+
/* @__PURE__ */ jsxs2(
|
|
1801
1390
|
"div",
|
|
1802
1391
|
{
|
|
1803
1392
|
className: cn(
|
|
1804
|
-
"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"
|
|
1805
|
-
resolvedActionTone === "positive" ? "bg-agg-success" : "bg-agg-error"
|
|
1393
|
+
"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"
|
|
1806
1394
|
),
|
|
1807
1395
|
children: [
|
|
1808
|
-
/* @__PURE__ */
|
|
1809
|
-
/* @__PURE__ */
|
|
1396
|
+
/* @__PURE__ */ jsx3(Icon, { name: "success-check", size: "small", className: "h-4 w-4 shrink-0 text-current" }),
|
|
1397
|
+
/* @__PURE__ */ jsx3("span", { children: resolvedActionLabel })
|
|
1810
1398
|
]
|
|
1811
1399
|
}
|
|
1812
1400
|
),
|
|
1813
|
-
/* @__PURE__ */
|
|
1814
|
-
/* @__PURE__ */
|
|
1815
|
-
/* @__PURE__ */
|
|
1401
|
+
/* @__PURE__ */ jsxs2("div", { className: "agg-order-success-summary flex items-center justify-between gap-4", children: [
|
|
1402
|
+
/* @__PURE__ */ jsx3("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.amount(resolvedTradeSide) }),
|
|
1403
|
+
/* @__PURE__ */ jsx3("p", { className: "text-right text-[30px] font-agg-bold leading-[36px] text-agg-foreground", children: resolvedAmountLabel })
|
|
1816
1404
|
] }),
|
|
1817
|
-
/* @__PURE__ */
|
|
1818
|
-
/* @__PURE__ */
|
|
1819
|
-
/* @__PURE__ */
|
|
1405
|
+
/* @__PURE__ */ jsxs2("div", { className: "agg-order-success-summary flex items-center justify-between gap-4", children: [
|
|
1406
|
+
/* @__PURE__ */ jsx3("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.toWin(resolvedTradeSide) }),
|
|
1407
|
+
/* @__PURE__ */ jsx3("p", { className: "text-right text-[30px] font-agg-bold leading-[36px] text-agg-success", children: resolvedToWinLabel })
|
|
1820
1408
|
] }),
|
|
1821
|
-
summary.potentialReturnLabel ? /* @__PURE__ */
|
|
1822
|
-
/* @__PURE__ */
|
|
1823
|
-
/* @__PURE__ */
|
|
1409
|
+
summary.potentialReturnLabel ? /* @__PURE__ */ jsxs2("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: [
|
|
1410
|
+
/* @__PURE__ */ jsx3("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 }),
|
|
1411
|
+
/* @__PURE__ */ jsx3("p", { className: "text-agg-xs leading-agg-4 text-agg-foreground", children: (_j = tradingLabels.withSmartRouting) != null ? _j : "with Smart Routing" })
|
|
1824
1412
|
] }) : null,
|
|
1825
|
-
/* @__PURE__ */
|
|
1413
|
+
/* @__PURE__ */ jsx3("div", { className: "agg-order-success-actions flex gap-3", children: /* @__PURE__ */ jsx3(
|
|
1826
1414
|
Button,
|
|
1827
1415
|
{
|
|
1828
1416
|
variant: "secondary",
|
|
@@ -1838,7 +1426,7 @@ var PlaceOrderSuccessView = ({
|
|
|
1838
1426
|
PlaceOrderSuccessView.displayName = "PlaceOrderSuccessView";
|
|
1839
1427
|
|
|
1840
1428
|
// src/trading/place-order/index.tsx
|
|
1841
|
-
import { Fragment as
|
|
1429
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1842
1430
|
var DEFAULT_STEP_LABELS = {
|
|
1843
1431
|
"check-balance": "Checking balance",
|
|
1844
1432
|
"check-position": "Checking position",
|
|
@@ -1864,7 +1452,7 @@ var LoadingGlyph = ({
|
|
|
1864
1452
|
className,
|
|
1865
1453
|
enableAnimations
|
|
1866
1454
|
}) => {
|
|
1867
|
-
return /* @__PURE__ */
|
|
1455
|
+
return /* @__PURE__ */ jsx4(
|
|
1868
1456
|
"span",
|
|
1869
1457
|
{
|
|
1870
1458
|
"aria-hidden": "true",
|
|
@@ -1884,25 +1472,25 @@ var PlaceOrderSlippageControl = ({
|
|
|
1884
1472
|
minimumValue: slippageMinimumValue
|
|
1885
1473
|
}) => {
|
|
1886
1474
|
var _a, _b;
|
|
1887
|
-
const labels =
|
|
1888
|
-
const containerRef =
|
|
1889
|
-
const triggerRef =
|
|
1890
|
-
const inputRef =
|
|
1475
|
+
const labels = useLabels();
|
|
1476
|
+
const containerRef = useRef2(null);
|
|
1477
|
+
const triggerRef = useRef2(null);
|
|
1478
|
+
const inputRef = useRef2(null);
|
|
1891
1479
|
const warningId = useId();
|
|
1892
1480
|
const defaultValue = finalizePercentageValue(slippageDefaultValue);
|
|
1893
1481
|
const committedValue = finalizePercentageValue(slippageValue) || defaultValue;
|
|
1894
|
-
const [draftValue, setDraftValue] =
|
|
1895
|
-
const [isEditing, setIsEditing] =
|
|
1482
|
+
const [draftValue, setDraftValue] = useState3(committedValue);
|
|
1483
|
+
const [isEditing, setIsEditing] = useState3(
|
|
1896
1484
|
() => isPercentageBelowMinimum(committedValue, slippageMinimumValue)
|
|
1897
1485
|
);
|
|
1898
|
-
const [shouldFocusInput, setShouldFocusInput] =
|
|
1899
|
-
|
|
1486
|
+
const [shouldFocusInput, setShouldFocusInput] = useState3(false);
|
|
1487
|
+
useEffect2(() => {
|
|
1900
1488
|
setDraftValue(committedValue);
|
|
1901
1489
|
if (isPercentageBelowMinimum(committedValue, slippageMinimumValue)) {
|
|
1902
1490
|
setIsEditing(true);
|
|
1903
1491
|
}
|
|
1904
1492
|
}, [committedValue, slippageMinimumValue]);
|
|
1905
|
-
|
|
1493
|
+
useEffect2(() => {
|
|
1906
1494
|
if (!shouldFocusInput) return;
|
|
1907
1495
|
requestAnimationFrame(() => {
|
|
1908
1496
|
var _a2, _b2;
|
|
@@ -1919,7 +1507,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
1919
1507
|
Number(committedValue || slippageDefaultValue || DEFAULT_SLIPPAGE_VALUE)
|
|
1920
1508
|
);
|
|
1921
1509
|
const resolvedAutoLabel = labels.trading.resetSlippage;
|
|
1922
|
-
const resolvedWarningMessage =
|
|
1510
|
+
const resolvedWarningMessage = useMemo2(() => {
|
|
1923
1511
|
if (isLowSlippage) {
|
|
1924
1512
|
return labels.trading.slippageLow(slippageMinimumValue);
|
|
1925
1513
|
}
|
|
@@ -1982,8 +1570,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
1982
1570
|
if (!isEditing) return;
|
|
1983
1571
|
handleCommitDraft(false);
|
|
1984
1572
|
};
|
|
1985
|
-
return /* @__PURE__ */
|
|
1986
|
-
/* @__PURE__ */
|
|
1573
|
+
return /* @__PURE__ */ jsxs3("div", { ref: containerRef, className: "agg-slippage-control w-full", onBlur: handleContainerBlur, children: [
|
|
1574
|
+
/* @__PURE__ */ jsxs3(
|
|
1987
1575
|
"button",
|
|
1988
1576
|
{
|
|
1989
1577
|
ref: triggerRef,
|
|
@@ -2001,8 +1589,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
2001
1589
|
),
|
|
2002
1590
|
onClick: handleToggleEditing,
|
|
2003
1591
|
children: [
|
|
2004
|
-
/* @__PURE__ */
|
|
2005
|
-
/* @__PURE__ */
|
|
1592
|
+
/* @__PURE__ */ jsx4("span", { className: "agg-slippage-label", children: collapsedLabel }),
|
|
1593
|
+
/* @__PURE__ */ jsx4(
|
|
2006
1594
|
Icon,
|
|
2007
1595
|
{
|
|
2008
1596
|
name: isEditing ? "chevron-up" : "pencil",
|
|
@@ -2014,7 +1602,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
2014
1602
|
]
|
|
2015
1603
|
}
|
|
2016
1604
|
),
|
|
2017
|
-
/* @__PURE__ */
|
|
1605
|
+
/* @__PURE__ */ jsx4(
|
|
2018
1606
|
"div",
|
|
2019
1607
|
{
|
|
2020
1608
|
"aria-hidden": !isEditing,
|
|
@@ -2028,10 +1616,10 @@ var PlaceOrderSlippageControl = ({
|
|
|
2028
1616
|
"transition-[grid-template-rows,opacity,margin-top] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
2029
1617
|
)
|
|
2030
1618
|
),
|
|
2031
|
-
children: /* @__PURE__ */
|
|
2032
|
-
/* @__PURE__ */
|
|
2033
|
-
/* @__PURE__ */
|
|
2034
|
-
/* @__PURE__ */
|
|
1619
|
+
children: /* @__PURE__ */ jsx4("div", { className: "min-h-0", children: /* @__PURE__ */ jsxs3("div", { className: "agg-slippage-editor-body flex flex-col gap-2", children: [
|
|
1620
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-slippage-input-row flex h-9 overflow-hidden rounded-agg-sm border border-agg-separator", children: [
|
|
1621
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-slippage-input-group flex min-w-0 flex-1 items-center gap-2 bg-agg-secondary px-3", children: [
|
|
1622
|
+
/* @__PURE__ */ jsx4(
|
|
2035
1623
|
"input",
|
|
2036
1624
|
{
|
|
2037
1625
|
ref: inputRef,
|
|
@@ -2046,7 +1634,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
2046
1634
|
onKeyDown: handleInputKeyDown
|
|
2047
1635
|
}
|
|
2048
1636
|
),
|
|
2049
|
-
/* @__PURE__ */
|
|
1637
|
+
/* @__PURE__ */ jsx4(
|
|
2050
1638
|
"button",
|
|
2051
1639
|
{
|
|
2052
1640
|
type: "button",
|
|
@@ -2064,8 +1652,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
2064
1652
|
}
|
|
2065
1653
|
)
|
|
2066
1654
|
] }),
|
|
2067
|
-
/* @__PURE__ */
|
|
2068
|
-
/* @__PURE__ */
|
|
1655
|
+
/* @__PURE__ */ jsx4("div", { className: "h-full w-px bg-agg-separator", "aria-hidden": "true" }),
|
|
1656
|
+
/* @__PURE__ */ jsx4(
|
|
2069
1657
|
"div",
|
|
2070
1658
|
{
|
|
2071
1659
|
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",
|
|
@@ -2074,7 +1662,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
2074
1662
|
}
|
|
2075
1663
|
)
|
|
2076
1664
|
] }),
|
|
2077
|
-
/* @__PURE__ */
|
|
1665
|
+
/* @__PURE__ */ jsx4(
|
|
2078
1666
|
"div",
|
|
2079
1667
|
{
|
|
2080
1668
|
"aria-hidden": !resolvedWarningMessage,
|
|
@@ -2088,13 +1676,13 @@ var PlaceOrderSlippageControl = ({
|
|
|
2088
1676
|
"transition-[grid-template-rows,opacity] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
2089
1677
|
)
|
|
2090
1678
|
),
|
|
2091
|
-
children: /* @__PURE__ */
|
|
1679
|
+
children: /* @__PURE__ */ jsx4("div", { className: "min-h-0", children: /* @__PURE__ */ jsxs3(
|
|
2092
1680
|
"div",
|
|
2093
1681
|
{
|
|
2094
1682
|
id: warningId,
|
|
2095
1683
|
className: "agg-slippage-warning-message flex items-start gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
2096
1684
|
children: [
|
|
2097
|
-
/* @__PURE__ */
|
|
1685
|
+
/* @__PURE__ */ jsx4(
|
|
2098
1686
|
Icon,
|
|
2099
1687
|
{
|
|
2100
1688
|
name: "warning-filled",
|
|
@@ -2103,7 +1691,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
2103
1691
|
color: "currentColor"
|
|
2104
1692
|
}
|
|
2105
1693
|
),
|
|
2106
|
-
/* @__PURE__ */
|
|
1694
|
+
/* @__PURE__ */ jsx4("p", { children: resolvedWarningMessage != null ? resolvedWarningMessage : "" })
|
|
2107
1695
|
]
|
|
2108
1696
|
}
|
|
2109
1697
|
) })
|
|
@@ -2123,9 +1711,9 @@ var renderCardHeader = ({
|
|
|
2123
1711
|
onClose
|
|
2124
1712
|
}) => {
|
|
2125
1713
|
if (!headerTitle) return null;
|
|
2126
|
-
return /* @__PURE__ */
|
|
2127
|
-
/* @__PURE__ */
|
|
2128
|
-
/* @__PURE__ */
|
|
1714
|
+
return /* @__PURE__ */ jsxs3("div", { className: cn("agg-order-panel-header flex flex-col gap-2", className), children: [
|
|
1715
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-order-market-summary flex items-center gap-3", children: [
|
|
1716
|
+
/* @__PURE__ */ jsx4(
|
|
2129
1717
|
RemoteImage,
|
|
2130
1718
|
{
|
|
2131
1719
|
src: headerImage,
|
|
@@ -2133,19 +1721,19 @@ var renderCardHeader = ({
|
|
|
2133
1721
|
className: "agg-order-market-image h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
2134
1722
|
}
|
|
2135
1723
|
),
|
|
2136
|
-
/* @__PURE__ */
|
|
2137
|
-
onClose ? /* @__PURE__ */
|
|
1724
|
+
/* @__PURE__ */ jsx4("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 }),
|
|
1725
|
+
onClose ? /* @__PURE__ */ jsx4(
|
|
2138
1726
|
"button",
|
|
2139
1727
|
{
|
|
2140
1728
|
type: "button",
|
|
2141
1729
|
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",
|
|
2142
1730
|
"aria-label": "Close",
|
|
2143
1731
|
onClick: onClose,
|
|
2144
|
-
children: /* @__PURE__ */
|
|
1732
|
+
children: /* @__PURE__ */ jsx4(CloseIcon, { className: "h-5 w-5" })
|
|
2145
1733
|
}
|
|
2146
1734
|
) : null
|
|
2147
1735
|
] }),
|
|
2148
|
-
headerSubtitle ? /* @__PURE__ */
|
|
1736
|
+
headerSubtitle ? /* @__PURE__ */ jsx4("p", { className: "agg-order-market-subtitle text-agg-base leading-agg-6 text-agg-foreground", children: headerSubtitle }) : null
|
|
2149
1737
|
] });
|
|
2150
1738
|
};
|
|
2151
1739
|
var PlaceOrderResolvedView = ({
|
|
@@ -2155,7 +1743,7 @@ var PlaceOrderResolvedView = ({
|
|
|
2155
1743
|
className
|
|
2156
1744
|
}) => {
|
|
2157
1745
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2158
|
-
const labels =
|
|
1746
|
+
const labels = useLabels();
|
|
2159
1747
|
const tradingLabels = labels.trading;
|
|
2160
1748
|
const extendedTradingLabels = tradingLabels;
|
|
2161
1749
|
const winningOutcomeLabel = (_c = (_b = (_a = tradingState.winningOutcome) == null ? void 0 : _a.label) == null ? void 0 : _b.trim().toLowerCase()) != null ? _c : "";
|
|
@@ -2165,7 +1753,7 @@ var PlaceOrderResolvedView = ({
|
|
|
2165
1753
|
const resolvedIconName = isPositiveWinningOutcome ? "success-check" : "close";
|
|
2166
1754
|
const resolvedIconToneClassName = isPositiveWinningOutcome ? "text-agg-success" : "text-agg-error";
|
|
2167
1755
|
const resolvedIconContainerClassName = isPositiveWinningOutcome ? "bg-agg-success/15" : "bg-agg-error/15";
|
|
2168
|
-
return /* @__PURE__ */
|
|
1756
|
+
return /* @__PURE__ */ jsx4(
|
|
2169
1757
|
Card,
|
|
2170
1758
|
{
|
|
2171
1759
|
className: cn(
|
|
@@ -2174,7 +1762,7 @@ var PlaceOrderResolvedView = ({
|
|
|
2174
1762
|
classNames == null ? void 0 : classNames.root,
|
|
2175
1763
|
className
|
|
2176
1764
|
),
|
|
2177
|
-
children: /* @__PURE__ */
|
|
1765
|
+
children: /* @__PURE__ */ jsxs3(
|
|
2178
1766
|
"div",
|
|
2179
1767
|
{
|
|
2180
1768
|
className: cn(
|
|
@@ -2182,17 +1770,17 @@ var PlaceOrderResolvedView = ({
|
|
|
2182
1770
|
classNames == null ? void 0 : classNames.body
|
|
2183
1771
|
),
|
|
2184
1772
|
children: [
|
|
2185
|
-
/* @__PURE__ */
|
|
1773
|
+
/* @__PURE__ */ jsx4(
|
|
2186
1774
|
"div",
|
|
2187
1775
|
{
|
|
2188
1776
|
className: cn(
|
|
2189
1777
|
"flex h-15 w-15 items-center justify-center rounded-full",
|
|
2190
1778
|
resolvedIconContainerClassName
|
|
2191
1779
|
),
|
|
2192
|
-
children: /* @__PURE__ */
|
|
1780
|
+
children: /* @__PURE__ */ jsx4(Icon, { name: resolvedIconName, className: cn("h-6 w-6", resolvedIconToneClassName) })
|
|
2193
1781
|
}
|
|
2194
1782
|
),
|
|
2195
|
-
/* @__PURE__ */
|
|
1783
|
+
/* @__PURE__ */ jsxs3(
|
|
2196
1784
|
"div",
|
|
2197
1785
|
{
|
|
2198
1786
|
className: cn(
|
|
@@ -2200,30 +1788,30 @@ var PlaceOrderResolvedView = ({
|
|
|
2200
1788
|
classNames == null ? void 0 : classNames.content
|
|
2201
1789
|
),
|
|
2202
1790
|
children: [
|
|
2203
|
-
tradingState.market ? /* @__PURE__ */
|
|
2204
|
-
tradingState.winningOutcome ? /* @__PURE__ */
|
|
1791
|
+
tradingState.market ? /* @__PURE__ */ jsx4(Typography, { variant: "body", children: tradingState.market.question }) : null,
|
|
1792
|
+
tradingState.winningOutcome ? /* @__PURE__ */ jsx4(Typography, { variant: "body-large-strong", children: tradingLabels.outcome(tradingState.winningOutcome.label) }) : null
|
|
2205
1793
|
]
|
|
2206
1794
|
}
|
|
2207
1795
|
),
|
|
2208
|
-
resolvedClaim ? /* @__PURE__ */
|
|
2209
|
-
/* @__PURE__ */
|
|
2210
|
-
/* @__PURE__ */
|
|
2211
|
-
/* @__PURE__ */
|
|
2212
|
-
/* @__PURE__ */
|
|
2213
|
-
/* @__PURE__ */
|
|
2214
|
-
/* @__PURE__ */
|
|
2215
|
-
/* @__PURE__ */
|
|
1796
|
+
resolvedClaim ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
1797
|
+
/* @__PURE__ */ jsx4("div", { className: "h-px w-full bg-agg-separator" }),
|
|
1798
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-5 p-6", children: [
|
|
1799
|
+
/* @__PURE__ */ jsx4(Typography, { variant: "body-strong", children: (_d = extendedTradingLabels.resolvedEarningsTitle) != null ? _d : "Your Earnings" }),
|
|
1800
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-3 text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
1801
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between gap-4", children: [
|
|
1802
|
+
/* @__PURE__ */ jsx4("span", { children: (_e = extendedTradingLabels.resolvedResolutionDateLabel) != null ? _e : "Resolution date" }),
|
|
1803
|
+
/* @__PURE__ */ jsx4("span", { className: "font-agg-bold", children: resolvedClaim.resolutionDateLabel })
|
|
2216
1804
|
] }),
|
|
2217
|
-
/* @__PURE__ */
|
|
2218
|
-
/* @__PURE__ */
|
|
2219
|
-
/* @__PURE__ */
|
|
1805
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between gap-4", children: [
|
|
1806
|
+
/* @__PURE__ */ jsx4("span", { children: (_f = extendedTradingLabels.resolvedSharesLabel) != null ? _f : "Shares" }),
|
|
1807
|
+
/* @__PURE__ */ jsx4("span", { className: "font-agg-bold", children: resolvedClaim.sharesLabel })
|
|
2220
1808
|
] }),
|
|
2221
|
-
/* @__PURE__ */
|
|
2222
|
-
/* @__PURE__ */
|
|
2223
|
-
/* @__PURE__ */
|
|
1809
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between gap-4", children: [
|
|
1810
|
+
/* @__PURE__ */ jsx4("span", { children: (_g = extendedTradingLabels.resolvedTotalPayoutLabel) != null ? _g : "Total payout" }),
|
|
1811
|
+
/* @__PURE__ */ jsx4("span", { className: "font-agg-bold", children: resolvedClaim.totalPayoutLabel })
|
|
2224
1812
|
] })
|
|
2225
1813
|
] }),
|
|
2226
|
-
resolvedClaim.onClaim ? /* @__PURE__ */
|
|
1814
|
+
resolvedClaim.onClaim ? /* @__PURE__ */ jsx4(
|
|
2227
1815
|
Button,
|
|
2228
1816
|
{
|
|
2229
1817
|
size: "large",
|
|
@@ -2245,18 +1833,18 @@ var renderRouteBreakdownRow = (row) => {
|
|
|
2245
1833
|
var _a, _b;
|
|
2246
1834
|
const venueLabel = getTradingVenueLabel(row.venue);
|
|
2247
1835
|
const rowKey = `${row.venue}-${row.label}-${row.priceLabel}-${(_a = row.resultLabel) != null ? _a : ""}`;
|
|
2248
|
-
return /* @__PURE__ */
|
|
1836
|
+
return /* @__PURE__ */ jsxs3(
|
|
2249
1837
|
"div",
|
|
2250
1838
|
{
|
|
2251
1839
|
className: "agg-route-breakdown-row flex items-center justify-between gap-4 text-left",
|
|
2252
1840
|
children: [
|
|
2253
|
-
/* @__PURE__ */
|
|
2254
|
-
/* @__PURE__ */
|
|
2255
|
-
/* @__PURE__ */
|
|
1841
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-route-breakdown-market flex min-w-0 items-center gap-2", children: [
|
|
1842
|
+
/* @__PURE__ */ jsx4(VenueLogo, { venue: row.venue, className: "!size-3", ariaLabel: venueLabel }),
|
|
1843
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-route-breakdown-label truncate text-agg-sm leading-agg-5 text-agg-foreground", children: row.label })
|
|
2256
1844
|
] }),
|
|
2257
|
-
/* @__PURE__ */
|
|
2258
|
-
/* @__PURE__ */
|
|
2259
|
-
/* @__PURE__ */
|
|
1845
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-route-breakdown-value flex shrink-0 items-center gap-2 text-agg-sm leading-agg-5", children: [
|
|
1846
|
+
/* @__PURE__ */ jsx4("p", { className: "text-agg-muted-foreground", children: row.priceLabel }),
|
|
1847
|
+
/* @__PURE__ */ jsx4("p", { className: "text-agg-foreground", children: (_b = row.resultLabel) != null ? _b : "" })
|
|
2260
1848
|
] })
|
|
2261
1849
|
]
|
|
2262
1850
|
},
|
|
@@ -2273,9 +1861,8 @@ var renderRouteCard = ({
|
|
|
2273
1861
|
}) => {
|
|
2274
1862
|
var _a, _b;
|
|
2275
1863
|
const showSplitDetails = isSelected && isExpanded && card.kind === "split" && !!((_a = card.rows) == null ? void 0 : _a.length);
|
|
2276
|
-
const
|
|
2277
|
-
|
|
2278
|
-
return /* @__PURE__ */ jsxs4(
|
|
1864
|
+
const ariaLabel = [card.label, card.hint, card.value].filter(Boolean).join(" ");
|
|
1865
|
+
return /* @__PURE__ */ jsxs3(
|
|
2279
1866
|
"button",
|
|
2280
1867
|
{
|
|
2281
1868
|
type: "button",
|
|
@@ -2284,22 +1871,22 @@ var renderRouteCard = ({
|
|
|
2284
1871
|
disabled: card.isUnavailable,
|
|
2285
1872
|
className: cn(
|
|
2286
1873
|
"agg-route-card",
|
|
2287
|
-
"relative w-full
|
|
1874
|
+
"relative w-full overflow-hidden rounded-agg-lg p-3 text-left",
|
|
2288
1875
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary",
|
|
2289
1876
|
getMotionClassName(
|
|
2290
1877
|
enableAnimations,
|
|
2291
1878
|
"transition-[background-color,border-color,color] duration-200 ease-in-out"
|
|
2292
1879
|
),
|
|
2293
|
-
|
|
2294
|
-
card.isUnavailable
|
|
1880
|
+
card.isUnavailable ? "cursor-not-allowed" : "cursor-pointer",
|
|
1881
|
+
isSelected && !card.isUnavailable ? "border border-agg-trade-highlight-border bg-gradient-to-b from-agg-trade-highlight-surface-from to-agg-trade-highlight-surface-to" : "border-transparent bg-agg-secondary-hover"
|
|
2295
1882
|
),
|
|
2296
1883
|
onClick: () => onSelect(card.id),
|
|
2297
1884
|
children: [
|
|
2298
|
-
isSelected && !card.isUnavailable ? /* @__PURE__ */
|
|
2299
|
-
/* @__PURE__ */
|
|
2300
|
-
/* @__PURE__ */
|
|
2301
|
-
/* @__PURE__ */
|
|
2302
|
-
card.kind === "split" ? /* @__PURE__ */
|
|
1885
|
+
isSelected && !card.isUnavailable ? /* @__PURE__ */ jsx4("div", { className: "agg-route-card-glow pointer-events-none absolute -inset-x-px -bottom-px h-11 bg-linear-to-b from-transparent to-agg-trade-highlight-glow" }) : null,
|
|
1886
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-route-card-content relative z-10 flex flex-col gap-3", children: [
|
|
1887
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-route-card-header flex items-center justify-between gap-4", children: [
|
|
1888
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-route-card-meta flex min-w-0 gap-3 items-center", children: [
|
|
1889
|
+
card.kind === "split" ? /* @__PURE__ */ jsx4(
|
|
2303
1890
|
Icon,
|
|
2304
1891
|
{
|
|
2305
1892
|
name: "sparkles-filled",
|
|
@@ -2310,7 +1897,7 @@ var renderRouteCard = ({
|
|
|
2310
1897
|
),
|
|
2311
1898
|
"aria-hidden": "true"
|
|
2312
1899
|
}
|
|
2313
|
-
) : card.venue ? /* @__PURE__ */
|
|
1900
|
+
) : card.venue ? /* @__PURE__ */ jsx4(
|
|
2314
1901
|
VenueLogo,
|
|
2315
1902
|
{
|
|
2316
1903
|
venue: card.venue,
|
|
@@ -2318,10 +1905,18 @@ var renderRouteCard = ({
|
|
|
2318
1905
|
ariaLabel: getTradingVenueLabel(card.venue)
|
|
2319
1906
|
}
|
|
2320
1907
|
) : null,
|
|
2321
|
-
/* @__PURE__ */
|
|
2322
|
-
/* @__PURE__ */
|
|
2323
|
-
/* @__PURE__ */
|
|
2324
|
-
card.
|
|
1908
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-1 min-w-0", children: [
|
|
1909
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1.5", children: [
|
|
1910
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-route-card-title truncate text-agg-sm leading-agg-5 text-agg-foreground", children: card.label }),
|
|
1911
|
+
card.isUnavailable ? /* @__PURE__ */ jsx4(
|
|
1912
|
+
Icon,
|
|
1913
|
+
{
|
|
1914
|
+
name: "lock",
|
|
1915
|
+
size: "xs",
|
|
1916
|
+
className: "shrink-0 text-agg-muted-foreground",
|
|
1917
|
+
"aria-hidden": "true"
|
|
1918
|
+
}
|
|
1919
|
+
) : card.kind === "split" && isSelected ? /* @__PURE__ */ jsx4(
|
|
2325
1920
|
Icon,
|
|
2326
1921
|
{
|
|
2327
1922
|
name: showSplitDetails ? "chevron-up" : "chevron-down",
|
|
@@ -2331,24 +1926,24 @@ var renderRouteCard = ({
|
|
|
2331
1926
|
}
|
|
2332
1927
|
) : null
|
|
2333
1928
|
] }),
|
|
2334
|
-
card.hint ? /* @__PURE__ */
|
|
1929
|
+
card.hint ? /* @__PURE__ */ jsx4("p", { className: "agg-route-card-hint text-agg-xs leading-agg-4 text-agg-muted-foreground", children: card.hint }) : null
|
|
2335
1930
|
] })
|
|
2336
1931
|
] }),
|
|
2337
|
-
/* @__PURE__ */
|
|
1932
|
+
/* @__PURE__ */ jsx4(
|
|
2338
1933
|
"p",
|
|
2339
1934
|
{
|
|
2340
1935
|
className: cn(
|
|
2341
1936
|
"agg-route-card-value",
|
|
2342
1937
|
"shrink-0 whitespace-nowrap",
|
|
2343
|
-
card.isUnavailable ? "text-agg-
|
|
1938
|
+
isSelected && !card.isUnavailable ? "text-agg-lg font-agg-bold leading-agg-7 text-agg-trade-highlight-accent" : "text-agg-base leading-agg-6 text-agg-foreground"
|
|
2344
1939
|
),
|
|
2345
|
-
children:
|
|
1940
|
+
children: card.value
|
|
2346
1941
|
}
|
|
2347
1942
|
)
|
|
2348
1943
|
] }),
|
|
2349
|
-
showSplitDetails ? /* @__PURE__ */
|
|
2350
|
-
/* @__PURE__ */
|
|
2351
|
-
/* @__PURE__ */
|
|
1944
|
+
showSplitDetails ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
1945
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-route-card-description text-agg-xs leading-agg-4 text-agg-foreground", children: tradingLabels.splitOrderDescription }),
|
|
1946
|
+
/* @__PURE__ */ jsx4("div", { className: "agg-route-breakdown flex flex-col gap-3", children: (_b = card.rows) == null ? void 0 : _b.map((row) => renderRouteBreakdownRow(row)) })
|
|
2352
1947
|
] }) : null
|
|
2353
1948
|
] })
|
|
2354
1949
|
]
|
|
@@ -2442,7 +2037,7 @@ var renderSubmissionSurface = ({
|
|
|
2442
2037
|
];
|
|
2443
2038
|
};
|
|
2444
2039
|
const stepGroups = resolveStepGroups();
|
|
2445
|
-
return /* @__PURE__ */
|
|
2040
|
+
return /* @__PURE__ */ jsx4(
|
|
2446
2041
|
Card,
|
|
2447
2042
|
{
|
|
2448
2043
|
className: cn(
|
|
@@ -2451,30 +2046,30 @@ var renderSubmissionSurface = ({
|
|
|
2451
2046
|
classNames == null ? void 0 : classNames.root,
|
|
2452
2047
|
className
|
|
2453
2048
|
),
|
|
2454
|
-
children: /* @__PURE__ */
|
|
2049
|
+
children: /* @__PURE__ */ jsxs3("div", { className: cn("agg-order-submission-body flex flex-col gap-6 p-5", classNames == null ? void 0 : classNames.body), children: [
|
|
2455
2050
|
renderCardHeader({
|
|
2456
2051
|
className: classNames == null ? void 0 : classNames.header,
|
|
2457
2052
|
headerSubtitle,
|
|
2458
2053
|
headerImage,
|
|
2459
2054
|
headerTitle
|
|
2460
2055
|
}),
|
|
2461
|
-
/* @__PURE__ */
|
|
2462
|
-
/* @__PURE__ */
|
|
2463
|
-
/* @__PURE__ */
|
|
2464
|
-
/* @__PURE__ */
|
|
2056
|
+
/* @__PURE__ */ jsxs3("div", { className: cn("agg-order-panel-content flex flex-col gap-6", classNames == null ? void 0 : classNames.content), children: [
|
|
2057
|
+
/* @__PURE__ */ jsxs3("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: [
|
|
2058
|
+
/* @__PURE__ */ jsx4(LoadingGlyph, { enableAnimations, className: "h-4 w-4 text-current" }),
|
|
2059
|
+
/* @__PURE__ */ jsx4("span", { children: actionLabel })
|
|
2465
2060
|
] }),
|
|
2466
|
-
/* @__PURE__ */
|
|
2467
|
-
return /* @__PURE__ */
|
|
2061
|
+
/* @__PURE__ */ jsx4("div", { className: "agg-order-submission-steps flex flex-col gap-4", children: stepGroups.map((steps, groupIndex) => {
|
|
2062
|
+
return /* @__PURE__ */ jsx4(
|
|
2468
2063
|
"div",
|
|
2469
2064
|
{
|
|
2470
2065
|
className: "agg-order-submission-group flex flex-col gap-2",
|
|
2471
2066
|
children: steps.map((step) => {
|
|
2472
|
-
return /* @__PURE__ */
|
|
2067
|
+
return /* @__PURE__ */ jsxs3(
|
|
2473
2068
|
"div",
|
|
2474
2069
|
{
|
|
2475
2070
|
className: "agg-order-submission-step flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
2476
2071
|
children: [
|
|
2477
|
-
step.status === "complete" ? /* @__PURE__ */
|
|
2072
|
+
step.status === "complete" ? /* @__PURE__ */ jsx4(
|
|
2478
2073
|
Icon,
|
|
2479
2074
|
{
|
|
2480
2075
|
name: "check-circle",
|
|
@@ -2482,15 +2077,15 @@ var renderSubmissionSurface = ({
|
|
|
2482
2077
|
className: "h-3 w-3 shrink-0 text-agg-primary",
|
|
2483
2078
|
"aria-hidden": "true"
|
|
2484
2079
|
}
|
|
2485
|
-
) : /* @__PURE__ */
|
|
2080
|
+
) : /* @__PURE__ */ jsx4(
|
|
2486
2081
|
LoadingGlyph,
|
|
2487
2082
|
{
|
|
2488
2083
|
enableAnimations,
|
|
2489
2084
|
className: "h-3 w-3 shrink-0 text-agg-primary"
|
|
2490
2085
|
}
|
|
2491
2086
|
),
|
|
2492
|
-
/* @__PURE__ */
|
|
2493
|
-
step.venue ? /* @__PURE__ */
|
|
2087
|
+
/* @__PURE__ */ jsx4("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
2088
|
+
step.venue ? /* @__PURE__ */ jsx4(
|
|
2494
2089
|
VenueLogo,
|
|
2495
2090
|
{
|
|
2496
2091
|
venue: step.venue,
|
|
@@ -2513,7 +2108,7 @@ var renderSubmissionSurface = ({
|
|
|
2513
2108
|
}
|
|
2514
2109
|
);
|
|
2515
2110
|
};
|
|
2516
|
-
var InitiateKycButton = ({ label, onOpen }) => /* @__PURE__ */
|
|
2111
|
+
var InitiateKycButton = ({ label, onOpen }) => /* @__PURE__ */ jsx4(
|
|
2517
2112
|
Button,
|
|
2518
2113
|
{
|
|
2519
2114
|
size: "large",
|
|
@@ -2530,35 +2125,35 @@ var KycVerifyModal = ({
|
|
|
2530
2125
|
isInitiating,
|
|
2531
2126
|
labels
|
|
2532
2127
|
}) => {
|
|
2533
|
-
return /* @__PURE__ */
|
|
2128
|
+
return /* @__PURE__ */ jsx4(
|
|
2534
2129
|
Modal,
|
|
2535
2130
|
{
|
|
2536
2131
|
open,
|
|
2537
2132
|
onOpenChange: (next) => {
|
|
2538
2133
|
onOpenChange(next);
|
|
2539
2134
|
},
|
|
2540
|
-
children: /* @__PURE__ */
|
|
2541
|
-
/* @__PURE__ */
|
|
2542
|
-
/* @__PURE__ */
|
|
2543
|
-
/* @__PURE__ */
|
|
2544
|
-
/* @__PURE__ */
|
|
2135
|
+
children: /* @__PURE__ */ jsxs3(Modal.Container, { maxWidth: "480px", "aria-label": labels.title, children: [
|
|
2136
|
+
/* @__PURE__ */ jsx4(Dialog.Title, { className: "sr-only", children: labels.title }),
|
|
2137
|
+
/* @__PURE__ */ jsx4(Dialog.Description, { className: "sr-only", children: labels.description }),
|
|
2138
|
+
/* @__PURE__ */ jsxs3(Modal.Body, { classNames: { root: "sm:px-10 sm:py-12" }, children: [
|
|
2139
|
+
/* @__PURE__ */ jsx4(
|
|
2545
2140
|
"button",
|
|
2546
2141
|
{
|
|
2547
2142
|
type: "button",
|
|
2548
2143
|
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
2549
2144
|
onClick: () => onOpenChange(false),
|
|
2550
2145
|
"aria-label": "Close",
|
|
2551
|
-
children: /* @__PURE__ */
|
|
2146
|
+
children: /* @__PURE__ */ jsx4(CloseIcon, { className: "h-6 w-6" })
|
|
2552
2147
|
}
|
|
2553
2148
|
),
|
|
2554
|
-
/* @__PURE__ */
|
|
2555
|
-
/* @__PURE__ */
|
|
2556
|
-
/* @__PURE__ */
|
|
2557
|
-
/* @__PURE__ */
|
|
2558
|
-
/* @__PURE__ */
|
|
2149
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center gap-8 text-center", children: [
|
|
2150
|
+
/* @__PURE__ */ jsx4("div", { className: "flex h-[60px] w-[60px] items-center justify-center text-agg-muted-foreground", children: /* @__PURE__ */ jsx4(UserTrustIcon, { className: "h-[60px] w-[60px]" }) }),
|
|
2151
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center gap-3", children: [
|
|
2152
|
+
/* @__PURE__ */ jsx4("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: labels.title }),
|
|
2153
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-type-body text-agg-foreground", children: labels.description })
|
|
2559
2154
|
] }),
|
|
2560
|
-
/* @__PURE__ */
|
|
2561
|
-
/* @__PURE__ */
|
|
2155
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex w-full flex-col items-center gap-5", children: [
|
|
2156
|
+
/* @__PURE__ */ jsx4(
|
|
2562
2157
|
Button,
|
|
2563
2158
|
{
|
|
2564
2159
|
size: "large",
|
|
@@ -2569,7 +2164,7 @@ var KycVerifyModal = ({
|
|
|
2569
2164
|
children: labels.startVerification
|
|
2570
2165
|
}
|
|
2571
2166
|
),
|
|
2572
|
-
/* @__PURE__ */
|
|
2167
|
+
/* @__PURE__ */ jsx4(
|
|
2573
2168
|
"button",
|
|
2574
2169
|
{
|
|
2575
2170
|
type: "button",
|
|
@@ -2589,27 +2184,27 @@ var KycSuccessModal = ({
|
|
|
2589
2184
|
open,
|
|
2590
2185
|
onOpenChange,
|
|
2591
2186
|
labels
|
|
2592
|
-
}) => /* @__PURE__ */
|
|
2593
|
-
/* @__PURE__ */
|
|
2594
|
-
/* @__PURE__ */
|
|
2595
|
-
/* @__PURE__ */
|
|
2596
|
-
/* @__PURE__ */
|
|
2187
|
+
}) => /* @__PURE__ */ jsx4(Modal, { open, onOpenChange, children: /* @__PURE__ */ jsxs3(Modal.Container, { maxWidth: "480px", "aria-label": labels.title, children: [
|
|
2188
|
+
/* @__PURE__ */ jsx4(Dialog.Title, { className: "sr-only", children: labels.title }),
|
|
2189
|
+
/* @__PURE__ */ jsx4(Dialog.Description, { className: "sr-only", children: labels.description }),
|
|
2190
|
+
/* @__PURE__ */ jsxs3(Modal.Body, { classNames: { root: "px-10 py-12" }, children: [
|
|
2191
|
+
/* @__PURE__ */ jsx4(
|
|
2597
2192
|
"button",
|
|
2598
2193
|
{
|
|
2599
2194
|
type: "button",
|
|
2600
2195
|
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
2601
2196
|
onClick: () => onOpenChange(false),
|
|
2602
2197
|
"aria-label": "Close",
|
|
2603
|
-
children: /* @__PURE__ */
|
|
2198
|
+
children: /* @__PURE__ */ jsx4(CloseIcon, { className: "h-6 w-6" })
|
|
2604
2199
|
}
|
|
2605
2200
|
),
|
|
2606
|
-
/* @__PURE__ */
|
|
2607
|
-
/* @__PURE__ */
|
|
2608
|
-
/* @__PURE__ */
|
|
2609
|
-
/* @__PURE__ */
|
|
2610
|
-
/* @__PURE__ */
|
|
2201
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center gap-8 text-center", children: [
|
|
2202
|
+
/* @__PURE__ */ jsx4("div", { className: "flex h-[60px] w-[60px] items-center justify-center rounded-full bg-agg-success/15", children: /* @__PURE__ */ jsx4(SuccessCheckIcon, { className: "h-6 w-6 text-agg-success" }) }),
|
|
2203
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center gap-3", children: [
|
|
2204
|
+
/* @__PURE__ */ jsx4("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: labels.title }),
|
|
2205
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-type-body text-agg-foreground", children: labels.description })
|
|
2611
2206
|
] }),
|
|
2612
|
-
/* @__PURE__ */
|
|
2207
|
+
/* @__PURE__ */ jsx4(
|
|
2613
2208
|
Button,
|
|
2614
2209
|
{
|
|
2615
2210
|
variant: "secondary",
|
|
@@ -2641,22 +2236,22 @@ var PlaceOrder = ({
|
|
|
2641
2236
|
onExecutionStateChange,
|
|
2642
2237
|
resolvedClaim
|
|
2643
2238
|
}) => {
|
|
2644
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D
|
|
2239
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D;
|
|
2645
2240
|
const {
|
|
2646
2241
|
features: { enableAnimations },
|
|
2647
2242
|
general: { locale }
|
|
2648
|
-
} =
|
|
2649
|
-
const labels =
|
|
2243
|
+
} = useSdkUiConfig();
|
|
2244
|
+
const labels = useLabels();
|
|
2650
2245
|
const tradingLabels = labels.trading;
|
|
2651
2246
|
const { isTradingBlocked } = useGeoBlock();
|
|
2652
2247
|
const tradingContext = useEventTradingContext2();
|
|
2653
2248
|
const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
|
|
2654
2249
|
const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
|
|
2655
2250
|
const selectedOutcomeId = (_c = tradingContext == null ? void 0 : tradingContext.selectedOutcomeId) != null ? _c : null;
|
|
2656
|
-
const resolvedEventTradingState =
|
|
2251
|
+
const resolvedEventTradingState = useMemo2(() => {
|
|
2657
2252
|
return eventTradingState != null ? eventTradingState : resolveEventTradingState(selectedEvent);
|
|
2658
2253
|
}, [eventTradingState, selectedEvent]);
|
|
2659
|
-
const scopedSelectedEvent =
|
|
2254
|
+
const scopedSelectedEvent = useMemo2(() => {
|
|
2660
2255
|
var _a2;
|
|
2661
2256
|
if (!selectedEvent) return null;
|
|
2662
2257
|
const primaryMarketId = (_a2 = resolvedEventTradingState.primaryMarket) == null ? void 0 : _a2.id;
|
|
@@ -2666,7 +2261,7 @@ var PlaceOrder = ({
|
|
|
2666
2261
|
);
|
|
2667
2262
|
return isSelectedEventInScope ? selectedEvent : null;
|
|
2668
2263
|
}, [(_d = resolvedEventTradingState.primaryMarket) == null ? void 0 : _d.id, selectedEvent]);
|
|
2669
|
-
const scopedSelectedMarket =
|
|
2264
|
+
const scopedSelectedMarket = useMemo2(() => {
|
|
2670
2265
|
if (!selectedMarket) return resolvedEventTradingState.primaryMarket;
|
|
2671
2266
|
const isSelectedMarketInScope = resolvedEventTradingState.marketStates.some(
|
|
2672
2267
|
(item) => item.market.id === selectedMarket.id
|
|
@@ -2681,10 +2276,10 @@ var PlaceOrder = ({
|
|
|
2681
2276
|
(outcome) => outcome.label.trim().toLowerCase() === "yes"
|
|
2682
2277
|
)) != null ? _f : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes[0]) != null ? _g : null;
|
|
2683
2278
|
const scopedSelectedOutcomeId = (_h = scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.id) != null ? _h : null;
|
|
2684
|
-
const resolvedTradingState =
|
|
2279
|
+
const resolvedTradingState = useMemo2(() => {
|
|
2685
2280
|
return resolveMarketTradingState(scopedSelectedMarket);
|
|
2686
2281
|
}, [scopedSelectedMarket]);
|
|
2687
|
-
const resolvedReadOnlyMarket =
|
|
2282
|
+
const resolvedReadOnlyMarket = useMemo2(() => {
|
|
2688
2283
|
var _a2;
|
|
2689
2284
|
if (resolvedEventTradingState.kind !== "resolved") {
|
|
2690
2285
|
return scopedSelectedMarket;
|
|
@@ -2695,10 +2290,10 @@ var PlaceOrder = ({
|
|
|
2695
2290
|
resolvedEventTradingState.primaryMarket,
|
|
2696
2291
|
scopedSelectedMarket
|
|
2697
2292
|
]);
|
|
2698
|
-
const resolvedReadOnlyTradingState =
|
|
2293
|
+
const resolvedReadOnlyTradingState = useMemo2(() => {
|
|
2699
2294
|
return resolveMarketTradingState(resolvedReadOnlyMarket);
|
|
2700
2295
|
}, [resolvedReadOnlyMarket]);
|
|
2701
|
-
const orderEligibility =
|
|
2296
|
+
const orderEligibility = useMemo2(
|
|
2702
2297
|
() => resolveOrderEligibility({
|
|
2703
2298
|
event: scopedSelectedEvent,
|
|
2704
2299
|
market: scopedSelectedMarket,
|
|
@@ -2716,7 +2311,7 @@ var PlaceOrder = ({
|
|
|
2716
2311
|
const livePrices = useLiveOutcomePrices(
|
|
2717
2312
|
scopedSelectedMarket ? [scopedSelectedMarket] : void 0
|
|
2718
2313
|
);
|
|
2719
|
-
const midpointsClusterMarkets =
|
|
2314
|
+
const midpointsClusterMarkets = useMemo2(() => {
|
|
2720
2315
|
if (!scopedSelectedMarket) return [];
|
|
2721
2316
|
return normalizeVenueMarketCluster(
|
|
2722
2317
|
resolvedEventTradingState.displayMarkets,
|
|
@@ -2724,23 +2319,23 @@ var PlaceOrder = ({
|
|
|
2724
2319
|
);
|
|
2725
2320
|
}, [resolvedEventTradingState.displayMarkets, scopedSelectedMarket]);
|
|
2726
2321
|
const { prices: clusterMidpoints } = useMidpoints(midpointsClusterMarkets);
|
|
2727
|
-
const outcomes =
|
|
2322
|
+
const outcomes = useMemo2(
|
|
2728
2323
|
() => mapVenueMarketOutcomesToPlaceOrderOutcomes(scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes),
|
|
2729
2324
|
[scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes]
|
|
2730
2325
|
);
|
|
2731
|
-
const buyTabRef =
|
|
2732
|
-
const sellTabRef =
|
|
2733
|
-
const [internalTab, setInternalTab] =
|
|
2734
|
-
const [internalAmount, setInternalAmount] =
|
|
2735
|
-
const [sellFilledForOutcomeId, setSellFilledForOutcomeId] =
|
|
2736
|
-
const [internalSlippage, setInternalSlippage] =
|
|
2737
|
-
const [isRoutesExpanded, setIsRoutesExpanded] =
|
|
2738
|
-
const [selectedRouteCardId, setSelectedRouteCardId] =
|
|
2739
|
-
const [isSplitDetailOpen, setIsSplitDetailOpen] =
|
|
2740
|
-
const [submissionFeedback, setSubmissionFeedback] =
|
|
2741
|
-
const [submissionProgressState, setSubmissionProgressState] =
|
|
2326
|
+
const buyTabRef = useRef2(null);
|
|
2327
|
+
const sellTabRef = useRef2(null);
|
|
2328
|
+
const [internalTab, setInternalTab] = useState3("buy");
|
|
2329
|
+
const [internalAmount, setInternalAmount] = useState3(PLACE_ORDER_DEFAULT_AMOUNT);
|
|
2330
|
+
const [sellFilledForOutcomeId, setSellFilledForOutcomeId] = useState3(null);
|
|
2331
|
+
const [internalSlippage, setInternalSlippage] = useState3(DEFAULT_SLIPPAGE_VALUE);
|
|
2332
|
+
const [isRoutesExpanded, setIsRoutesExpanded] = useState3(false);
|
|
2333
|
+
const [selectedRouteCardId, setSelectedRouteCardId] = useState3(null);
|
|
2334
|
+
const [isSplitDetailOpen, setIsSplitDetailOpen] = useState3(false);
|
|
2335
|
+
const [submissionFeedback, setSubmissionFeedback] = useState3(null);
|
|
2336
|
+
const [submissionProgressState, setSubmissionProgressState] = useState3(null);
|
|
2742
2337
|
const debouncedAmount = useDebouncedValue(internalAmount, 300);
|
|
2743
|
-
const isSell =
|
|
2338
|
+
const isSell = useMemo2(() => internalTab === "sell", [internalTab]);
|
|
2744
2339
|
const {
|
|
2745
2340
|
positions: executionPositions,
|
|
2746
2341
|
isLoading: isExecutionPositionsLoading,
|
|
@@ -2761,7 +2356,7 @@ var PlaceOrder = ({
|
|
|
2761
2356
|
tradeSide: isSell ? "sell" : "buy",
|
|
2762
2357
|
enabled: debouncedAmount > 0 && orderEligibility.canPlaceOrder
|
|
2763
2358
|
});
|
|
2764
|
-
const currentSellableShares =
|
|
2359
|
+
const currentSellableShares = useMemo2(() => {
|
|
2765
2360
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
2766
2361
|
const sharesFromQuote = (_b2 = (_a2 = smartRoute.data) == null ? void 0 : _a2.positionAvailability) == null ? void 0 : _b2.totalSellableShares;
|
|
2767
2362
|
if (typeof sharesFromQuote === "number" && Number.isFinite(sharesFromQuote)) {
|
|
@@ -2798,11 +2393,12 @@ var PlaceOrder = ({
|
|
|
2798
2393
|
(_j = (_i = smartRoute.data) == null ? void 0 : _i.positionAvailability) == null ? void 0 : _j.totalSellableShares
|
|
2799
2394
|
]);
|
|
2800
2395
|
const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((_l = (_k = smartRoute.data) == null ? void 0 : _k.positionAvailability) == null ? void 0 : _l.totalSellableShares) === "number") && (isExecutionPositionsLoading || isExecutionPositionsFetching);
|
|
2801
|
-
const displayedCurrentSellableShares =
|
|
2802
|
-
if (!Number.isFinite(currentSellableShares)) return 0;
|
|
2803
|
-
return currentSellableShares;
|
|
2396
|
+
const displayedCurrentSellableShares = useMemo2(() => {
|
|
2397
|
+
if (!Number.isFinite(currentSellableShares) || currentSellableShares <= 0) return 0;
|
|
2398
|
+
return Math.floor(currentSellableShares * 100) / 100;
|
|
2804
2399
|
}, [currentSellableShares]);
|
|
2805
|
-
|
|
2400
|
+
const isAtMaxSellableShares = isSell && displayedCurrentSellableShares > 0 && Math.abs(internalAmount - displayedCurrentSellableShares) < 1e-9;
|
|
2401
|
+
useEffect2(() => {
|
|
2806
2402
|
if (!isSell || isCurrentSellableSharesLoading) return;
|
|
2807
2403
|
if (scopedSelectedOutcomeId === sellFilledForOutcomeId) return;
|
|
2808
2404
|
setInternalAmount(displayedCurrentSellableShares);
|
|
@@ -2816,7 +2412,7 @@ var PlaceOrder = ({
|
|
|
2816
2412
|
displayedCurrentSellableShares,
|
|
2817
2413
|
onAmountChange
|
|
2818
2414
|
]);
|
|
2819
|
-
const routeCards =
|
|
2415
|
+
const routeCards = useMemo2(
|
|
2820
2416
|
() => smartRoute.data ? buildLiveRouteCards({
|
|
2821
2417
|
eventVenues: scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets.map((market) => market.venue),
|
|
2822
2418
|
labels: tradingLabels,
|
|
@@ -2825,7 +2421,7 @@ var PlaceOrder = ({
|
|
|
2825
2421
|
}) : [],
|
|
2826
2422
|
[smartRoute.data, tradingLabels, isSell, scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets]
|
|
2827
2423
|
);
|
|
2828
|
-
const resolvedSelectedRouteCardId =
|
|
2424
|
+
const resolvedSelectedRouteCardId = useMemo2(() => {
|
|
2829
2425
|
var _a2, _b2, _c2, _d2;
|
|
2830
2426
|
if (routeCards.length === 0) return null;
|
|
2831
2427
|
if (selectedRouteCardId && routeCards.some((card) => card.id === selectedRouteCardId && !card.isUnavailable)) {
|
|
@@ -2833,7 +2429,7 @@ var PlaceOrder = ({
|
|
|
2833
2429
|
}
|
|
2834
2430
|
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;
|
|
2835
2431
|
}, [routeCards, selectedRouteCardId]);
|
|
2836
|
-
|
|
2432
|
+
useEffect2(() => {
|
|
2837
2433
|
if (routeCards.length === 0) {
|
|
2838
2434
|
setSelectedRouteCardId(null);
|
|
2839
2435
|
setIsRoutesExpanded(false);
|
|
@@ -2844,19 +2440,19 @@ var PlaceOrder = ({
|
|
|
2844
2440
|
setSelectedRouteCardId(resolvedSelectedRouteCardId);
|
|
2845
2441
|
}
|
|
2846
2442
|
}, [resolvedSelectedRouteCardId, routeCards.length, selectedRouteCardId]);
|
|
2847
|
-
|
|
2443
|
+
useEffect2(() => {
|
|
2848
2444
|
setSubmissionFeedback(null);
|
|
2849
2445
|
setSubmissionProgressState(null);
|
|
2850
2446
|
}, [internalAmount, internalSlippage, internalTab, scopedSelectedOutcomeId]);
|
|
2851
2447
|
const orderedRouteCards = routeCards;
|
|
2852
2448
|
const selectedRouteCard = (_n = (_m = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _m : orderedRouteCards[0]) != null ? _n : null;
|
|
2853
|
-
const isKalshiRoute =
|
|
2449
|
+
const isKalshiRoute = useMemo2(() => {
|
|
2854
2450
|
if (selectedRouteCard) {
|
|
2855
2451
|
return selectedRouteCard.venue === "kalshi" || selectedRouteCard.quoteData.fills.some((f) => f.venue === "kalshi");
|
|
2856
2452
|
}
|
|
2857
2453
|
return (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === "kalshi";
|
|
2858
2454
|
}, [selectedRouteCard, scopedSelectedMarket]);
|
|
2859
|
-
const isKalshiVerified =
|
|
2455
|
+
const isKalshiVerified = useMemo2(() => {
|
|
2860
2456
|
var _a2;
|
|
2861
2457
|
const kalshiAccount = (_a2 = user == null ? void 0 : user.venueAccounts) == null ? void 0 : _a2.find((va) => va.venue === "kalshi");
|
|
2862
2458
|
return (kalshiAccount == null ? void 0 : kalshiAccount.kycStatus) === "verified";
|
|
@@ -2876,7 +2472,7 @@ var PlaceOrder = ({
|
|
|
2876
2472
|
walletAddress: (_o = getWalletAddressFromUserProfile(user)) != null ? _o : null,
|
|
2877
2473
|
onError
|
|
2878
2474
|
});
|
|
2879
|
-
const handleRouteCardSelect =
|
|
2475
|
+
const handleRouteCardSelect = useCallback2(
|
|
2880
2476
|
(cardId) => {
|
|
2881
2477
|
if (cardId === resolvedSelectedRouteCardId) {
|
|
2882
2478
|
const card = routeCards.find((c) => c.id === cardId);
|
|
@@ -2897,18 +2493,13 @@ var PlaceOrder = ({
|
|
|
2897
2493
|
const headerImage = (_v = (_u = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.image) != null ? _u : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.image) != null ? _v : null;
|
|
2898
2494
|
const headerTitle = (_x = (_w = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _w : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _x : "";
|
|
2899
2495
|
const headerSubtitle = (_y = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _y : "";
|
|
2900
|
-
const buildExecutionSummary =
|
|
2496
|
+
const buildExecutionSummary = useCallback2(
|
|
2901
2497
|
(quoteData, executionVenue, orderId, partialFillSummary) => {
|
|
2902
2498
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
2903
2499
|
if (!quoteData) return void 0;
|
|
2904
2500
|
const avgPriceValue = quoteData.totalFilled > 0 ? quoteData.rawExecCost / quoteData.totalFilled : 0;
|
|
2905
2501
|
const avgPriceLabel = quoteData.totalFilled > 0 ? getTradingRoutePriceLabel(avgPriceValue) : "\u2014";
|
|
2906
2502
|
const actionPriceLabel = quoteData.totalFilled > 0 ? `~${avgPriceLabel}` : avgPriceLabel;
|
|
2907
|
-
const selectedOutcomeIndex = outcomes.findIndex((o) => o.id === scopedSelectedOutcomeId);
|
|
2908
|
-
const actionTone = resolvePlaceOrderSuccessTone({
|
|
2909
|
-
outcomeIndex: selectedOutcomeIndex === -1 ? 0 : selectedOutcomeIndex,
|
|
2910
|
-
tab: internalTab
|
|
2911
|
-
});
|
|
2912
2503
|
const actionLabel2 = internalTab === "buy" ? (_b2 = (_a2 = tradingLabels.boughtOutcomeAtPrice) == null ? void 0 : _a2.call(tradingLabels, selectedOutcomeLabel, actionPriceLabel)) != null ? _b2 : `Bought ${selectedOutcomeLabel} at ${actionPriceLabel}` : (_d2 = (_c2 = tradingLabels.soldOutcomeAtPrice) == null ? void 0 : _c2.call(tradingLabels, selectedOutcomeLabel, actionPriceLabel)) != null ? _d2 : `Sold ${selectedOutcomeLabel} at ${actionPriceLabel}`;
|
|
2913
2504
|
const sharesLabel = quoteData.totalFilled.toLocaleString("en-US", {
|
|
2914
2505
|
minimumFractionDigits: 2,
|
|
@@ -2931,7 +2522,6 @@ var PlaceOrder = ({
|
|
|
2931
2522
|
eventDateLabel: eventDateSource ? getTradingDateLabel(eventDateSource) : "",
|
|
2932
2523
|
eventImage: headerImage,
|
|
2933
2524
|
actionLabel: actionLabel2,
|
|
2934
|
-
actionTone,
|
|
2935
2525
|
amountLabel,
|
|
2936
2526
|
toWinLabel,
|
|
2937
2527
|
potentialReturnLabel,
|
|
@@ -2962,17 +2552,15 @@ var PlaceOrder = ({
|
|
|
2962
2552
|
executionProgress.submittedOrders,
|
|
2963
2553
|
headerImage,
|
|
2964
2554
|
internalTab,
|
|
2965
|
-
outcomes,
|
|
2966
2555
|
scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate,
|
|
2967
2556
|
scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title,
|
|
2968
2557
|
scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.endDate,
|
|
2969
2558
|
scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question,
|
|
2970
|
-
scopedSelectedOutcomeId,
|
|
2971
2559
|
selectedOutcomeLabel,
|
|
2972
2560
|
tradingLabels
|
|
2973
2561
|
]
|
|
2974
2562
|
);
|
|
2975
|
-
|
|
2563
|
+
useEffect2(() => {
|
|
2976
2564
|
if (executionProgress.phase === "order_submitted") {
|
|
2977
2565
|
const submittedOrder = executionProgress.submittedOrders[0];
|
|
2978
2566
|
setSubmissionProgressState((prev) => {
|
|
@@ -3004,7 +2592,7 @@ var PlaceOrder = ({
|
|
|
3004
2592
|
executionProgress.submittedOrders,
|
|
3005
2593
|
selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData
|
|
3006
2594
|
]);
|
|
3007
|
-
|
|
2595
|
+
useEffect2(() => {
|
|
3008
2596
|
const dp = executionProgress.dagProgress;
|
|
3009
2597
|
if (!dp) return;
|
|
3010
2598
|
setSubmissionProgressState((prev) => {
|
|
@@ -3023,7 +2611,7 @@ var PlaceOrder = ({
|
|
|
3023
2611
|
return __spreadProps(__spreadValues({}, prev), { dagProgress: dp });
|
|
3024
2612
|
});
|
|
3025
2613
|
}, [executionProgress.dagProgress, tradingLabels.orderFailed]);
|
|
3026
|
-
|
|
2614
|
+
useEffect2(() => {
|
|
3027
2615
|
const orderIds = submissionProgressState == null ? void 0 : submissionProgressState.orderIds;
|
|
3028
2616
|
if (!(orderIds == null ? void 0 : orderIds.length)) return;
|
|
3029
2617
|
const aggregateStatus = deriveAggregateOrderStatus(
|
|
@@ -3071,7 +2659,7 @@ var PlaceOrder = ({
|
|
|
3071
2659
|
submissionProgressState == null ? void 0 : submissionProgressState.orderIds,
|
|
3072
2660
|
tradingLabels.orderFailed
|
|
3073
2661
|
]);
|
|
3074
|
-
|
|
2662
|
+
useEffect2(() => {
|
|
3075
2663
|
if (!submissionProgressState) return;
|
|
3076
2664
|
onExecutionStateChange == null ? void 0 : onExecutionStateChange(submissionProgressState);
|
|
3077
2665
|
if (submissionProgressState.phase === "success" && submissionProgressState.summary) {
|
|
@@ -3086,10 +2674,9 @@ var PlaceOrder = ({
|
|
|
3086
2674
|
const activeQuoteData = (_A = (_z = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _z : smartRoute.data) != null ? _A : null;
|
|
3087
2675
|
const visibleRouteCards = orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT && !isRoutesExpanded ? orderedRouteCards.slice(0, PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT) : orderedRouteCards;
|
|
3088
2676
|
const hasEnteredAmount = internalAmount > 0;
|
|
3089
|
-
const shouldPromptSignIn = orderEligibility.canPlaceOrder && !isAuthenticated && hasEnteredAmount;
|
|
3090
2677
|
const isInsufficientBalance = !isSell && isAuthenticated && hasEnteredAmount && !isBalanceLoading && internalAmount > totalBalance;
|
|
3091
2678
|
const isBelowMinimum = !isSell && hasEnteredAmount && internalAmount < MIN_BUY_ORDER_AMOUNT;
|
|
3092
|
-
const quoteStatus =
|
|
2679
|
+
const quoteStatus = useMemo2(() => {
|
|
3093
2680
|
if (!orderEligibility.canPlaceOrder) return void 0;
|
|
3094
2681
|
return resolvePlaceOrderQuoteStatus({
|
|
3095
2682
|
amount: internalAmount,
|
|
@@ -3104,7 +2691,7 @@ var PlaceOrder = ({
|
|
|
3104
2691
|
scopedSelectedMarket,
|
|
3105
2692
|
tradingLabels
|
|
3106
2693
|
]);
|
|
3107
|
-
const smartRouteErrorMessage =
|
|
2694
|
+
const smartRouteErrorMessage = useMemo2(() => {
|
|
3108
2695
|
if (!smartRoute.error) return null;
|
|
3109
2696
|
return normalizePlaceOrderErrorMessage({
|
|
3110
2697
|
errorMessage: smartRoute.error.message,
|
|
@@ -3112,7 +2699,7 @@ var PlaceOrder = ({
|
|
|
3112
2699
|
});
|
|
3113
2700
|
}, [smartRoute.error, tradingLabels.quoteUnavailable]);
|
|
3114
2701
|
const progressActionLabel = (internalTab === "buy" ? tradingLabels.buyingOutcome(selectedOutcomeLabel) : tradingLabels.sellingOutcome(selectedOutcomeLabel)).trim();
|
|
3115
|
-
const canRetryRemaining =
|
|
2702
|
+
const canRetryRemaining = useMemo2(() => {
|
|
3116
2703
|
const remaining = getPlaceOrderUnfilledRemaining({
|
|
3117
2704
|
originalAmount: internalAmount,
|
|
3118
2705
|
terminalOrderEvents: executionProgress.terminalOrderEvents
|
|
@@ -3121,7 +2708,7 @@ var PlaceOrder = ({
|
|
|
3121
2708
|
return remaining >= minRemainder;
|
|
3122
2709
|
}, [executionProgress.terminalOrderEvents, internalAmount, isSell]);
|
|
3123
2710
|
const PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD = 0.95;
|
|
3124
|
-
const shouldAutoSkipPartialFill =
|
|
2711
|
+
const shouldAutoSkipPartialFill = useMemo2(() => {
|
|
3125
2712
|
if (internalAmount <= 0) return false;
|
|
3126
2713
|
const remaining = getPlaceOrderUnfilledRemaining({
|
|
3127
2714
|
originalAmount: internalAmount,
|
|
@@ -3131,7 +2718,7 @@ var PlaceOrder = ({
|
|
|
3131
2718
|
const fillRatio = filled / internalAmount;
|
|
3132
2719
|
return fillRatio >= PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD || !canRetryRemaining;
|
|
3133
2720
|
}, [canRetryRemaining, executionProgress.terminalOrderEvents, internalAmount]);
|
|
3134
|
-
const failureSummary =
|
|
2721
|
+
const failureSummary = useMemo2(() => {
|
|
3135
2722
|
var _a2;
|
|
3136
2723
|
if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return void 0;
|
|
3137
2724
|
return buildPlaceOrderFailureSummary({
|
|
@@ -3160,30 +2747,37 @@ var PlaceOrder = ({
|
|
|
3160
2747
|
submissionProgressState,
|
|
3161
2748
|
tradingLabels
|
|
3162
2749
|
]);
|
|
3163
|
-
const displayedToWinHint = (
|
|
3164
|
-
|
|
2750
|
+
const displayedToWinHint = useMemo2(() => {
|
|
2751
|
+
var _a2, _b2, _c2, _d2;
|
|
2752
|
+
if (!selectedRouteCard) return "";
|
|
2753
|
+
if (selectedRouteCard.isUnavailable) {
|
|
2754
|
+
const avgPrice = (_c2 = (_b2 = (_a2 = selectedRouteCard.quoteData) == null ? void 0 : _a2.fills) == null ? void 0 : _b2[0]) == null ? void 0 : _c2.avgPrice;
|
|
2755
|
+
return avgPrice != null ? tradingLabels.averagePrice(avgPrice) : "";
|
|
2756
|
+
}
|
|
2757
|
+
return (_d2 = selectedRouteCard.hint) != null ? _d2 : "";
|
|
2758
|
+
}, [selectedRouteCard, tradingLabels]);
|
|
2759
|
+
const displayedToWinValue = (_B = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _B : 0;
|
|
3165
2760
|
const isActionLoading = isPrimaryActionLoading || executeManaged.isPending;
|
|
3166
|
-
const selectedRouteGeoBlocked = (
|
|
3167
|
-
const geoBlockedVenuesFromWarnings =
|
|
2761
|
+
const selectedRouteGeoBlocked = (_C = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _C : false;
|
|
2762
|
+
const geoBlockedVenuesFromWarnings = useMemo2(
|
|
3168
2763
|
() => {
|
|
3169
2764
|
var _a2;
|
|
3170
2765
|
return extractGeoBlockedVenues((_a2 = smartRoute.data) == null ? void 0 : _a2.warnings);
|
|
3171
2766
|
},
|
|
3172
|
-
[(
|
|
2767
|
+
[(_D = smartRoute.data) == null ? void 0 : _D.warnings]
|
|
3173
2768
|
);
|
|
3174
|
-
const isPrimaryVenueGeoBlocked =
|
|
2769
|
+
const isPrimaryVenueGeoBlocked = useMemo2(() => {
|
|
3175
2770
|
var _a2, _b2;
|
|
3176
2771
|
if (!selectedRouteCard || selectedRouteCard.isUnavailable) return false;
|
|
3177
2772
|
const fills = (_b2 = (_a2 = selectedRouteCard.quoteData) == null ? void 0 : _a2.fills) != null ? _b2 : [];
|
|
3178
2773
|
return fills.length > 0 && fills.every((f) => geoBlockedVenuesFromWarnings.has(f.venue));
|
|
3179
2774
|
}, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
|
|
3180
2775
|
const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked;
|
|
3181
|
-
const geoBlockVenueLabel = isTradingBlocked ? void 0 : selectedRouteGeoBlocked ? selectedRouteCard == null ? void 0 : selectedRouteCard.label : isPrimaryVenueGeoBlocked && (selectedRouteCard == null ? void 0 : selectedRouteCard.venue) ? getTradingVenueLabel(selectedRouteCard.venue) : void 0;
|
|
3182
2776
|
const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
|
|
3183
2777
|
const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isBelowMinimum || !selectedRouteCard || !selectedRouteCard.quoteData.quoteId || selectedRouteGeoBlocked || !isAuthenticated || quoteStatus !== void 0;
|
|
3184
2778
|
const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && (orderedRouteCards.length > 0 || smartRoute.isFetching);
|
|
3185
2779
|
const shouldShowRouteToggle = orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
|
|
3186
|
-
const handleStartNewTrade =
|
|
2780
|
+
const handleStartNewTrade = useCallback2(() => {
|
|
3187
2781
|
setSubmissionProgressState(null);
|
|
3188
2782
|
setSubmissionFeedback(null);
|
|
3189
2783
|
setInternalAmount(0);
|
|
@@ -3206,7 +2800,7 @@ var PlaceOrder = ({
|
|
|
3206
2800
|
const shareUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(shareText)}`;
|
|
3207
2801
|
window.open(shareUrl, "_blank", "noopener,noreferrer");
|
|
3208
2802
|
};
|
|
3209
|
-
const handleExecuteQuote =
|
|
2803
|
+
const handleExecuteQuote = useCallback2(
|
|
3210
2804
|
(quoteData) => __async(null, null, function* () {
|
|
3211
2805
|
const quoteId = quoteData == null ? void 0 : quoteData.quoteId;
|
|
3212
2806
|
if (!quoteId) {
|
|
@@ -3226,7 +2820,7 @@ var PlaceOrder = ({
|
|
|
3226
2820
|
}),
|
|
3227
2821
|
[executeManaged, onPrimaryAction, tradingLabels.quoteUnavailable]
|
|
3228
2822
|
);
|
|
3229
|
-
const handleSkipToSuccess =
|
|
2823
|
+
const handleSkipToSuccess = useCallback2(() => {
|
|
3230
2824
|
const primaryFilledEvent = executionProgress.terminalOrderEvents.find(
|
|
3231
2825
|
(e) => e.event === "filled" || e.event === "partial_fill"
|
|
3232
2826
|
);
|
|
@@ -3251,7 +2845,7 @@ var PlaceOrder = ({
|
|
|
3251
2845
|
failureSummary,
|
|
3252
2846
|
selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData
|
|
3253
2847
|
]);
|
|
3254
|
-
|
|
2848
|
+
useEffect2(() => {
|
|
3255
2849
|
if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return;
|
|
3256
2850
|
if ((failureSummary == null ? void 0 : failureSummary.kind) !== "partial_fill") return;
|
|
3257
2851
|
if (!shouldAutoSkipPartialFill) return;
|
|
@@ -3262,7 +2856,7 @@ var PlaceOrder = ({
|
|
|
3262
2856
|
shouldAutoSkipPartialFill,
|
|
3263
2857
|
submissionProgressState == null ? void 0 : submissionProgressState.phase
|
|
3264
2858
|
]);
|
|
3265
|
-
const handleRetrySubmission =
|
|
2859
|
+
const handleRetrySubmission = useCallback2(() => __async(null, null, function* () {
|
|
3266
2860
|
var _a2, _b2, _c2;
|
|
3267
2861
|
if (!orderEligibility.canPlaceOrder) {
|
|
3268
2862
|
handleStartNewTrade();
|
|
@@ -3349,7 +2943,7 @@ var PlaceOrder = ({
|
|
|
3349
2943
|
]);
|
|
3350
2944
|
const resolvedStatusClassName = cn(classNames == null ? void 0 : classNames.root, className);
|
|
3351
2945
|
if (isLoading) {
|
|
3352
|
-
return /* @__PURE__ */
|
|
2946
|
+
return /* @__PURE__ */ jsx4(
|
|
3353
2947
|
Skeleton,
|
|
3354
2948
|
{
|
|
3355
2949
|
ariaLabel: labels.common.loading,
|
|
@@ -3360,7 +2954,7 @@ var PlaceOrder = ({
|
|
|
3360
2954
|
}
|
|
3361
2955
|
if (submissionProgressState) {
|
|
3362
2956
|
if (submissionProgressState.phase === "success" && submissionProgressState.summary) {
|
|
3363
|
-
return /* @__PURE__ */
|
|
2957
|
+
return /* @__PURE__ */ jsx4(
|
|
3364
2958
|
PlaceOrderSuccessView,
|
|
3365
2959
|
{
|
|
3366
2960
|
className: resolvedStatusClassName,
|
|
@@ -3372,7 +2966,7 @@ var PlaceOrder = ({
|
|
|
3372
2966
|
);
|
|
3373
2967
|
}
|
|
3374
2968
|
if (submissionProgressState.phase === "failed") {
|
|
3375
|
-
return /* @__PURE__ */
|
|
2969
|
+
return /* @__PURE__ */ jsx4(
|
|
3376
2970
|
PlaceOrderFailureView,
|
|
3377
2971
|
{
|
|
3378
2972
|
className: resolvedStatusClassName,
|
|
@@ -3429,10 +3023,6 @@ var PlaceOrder = ({
|
|
|
3429
3023
|
if (displayedCurrentSellableShares <= 0) return;
|
|
3430
3024
|
handleAmountChange(displayedCurrentSellableShares);
|
|
3431
3025
|
};
|
|
3432
|
-
const handleSignInRequiredClick = () => {
|
|
3433
|
-
if (!shouldPromptSignIn) return;
|
|
3434
|
-
requestAggAuthChooserOpen();
|
|
3435
|
-
};
|
|
3436
3026
|
const handleDepositRequiredClick = () => {
|
|
3437
3027
|
if (!isInsufficientBalance) return;
|
|
3438
3028
|
requestAggDepositModalOpen();
|
|
@@ -3474,7 +3064,7 @@ var PlaceOrder = ({
|
|
|
3474
3064
|
}
|
|
3475
3065
|
});
|
|
3476
3066
|
if (!orderEligibility.canPlaceOrder && resolvedReadOnlyTradingState.kind !== "open") {
|
|
3477
|
-
return /* @__PURE__ */
|
|
3067
|
+
return /* @__PURE__ */ jsx4(
|
|
3478
3068
|
PlaceOrderResolvedView,
|
|
3479
3069
|
{
|
|
3480
3070
|
tradingState: resolvedReadOnlyTradingState,
|
|
@@ -3484,17 +3074,17 @@ var PlaceOrder = ({
|
|
|
3484
3074
|
}
|
|
3485
3075
|
);
|
|
3486
3076
|
}
|
|
3487
|
-
return /* @__PURE__ */
|
|
3488
|
-
/* @__PURE__ */
|
|
3077
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
3078
|
+
/* @__PURE__ */ jsxs3(
|
|
3489
3079
|
Card,
|
|
3490
3080
|
{
|
|
3491
3081
|
className: cn(
|
|
3492
|
-
"group/agg-order-panel",
|
|
3082
|
+
"group/agg-order-panel gap-6 p-5",
|
|
3493
3083
|
getPlaceOrderContainerClassName(),
|
|
3494
3084
|
classNames == null ? void 0 : classNames.root,
|
|
3495
3085
|
className
|
|
3496
3086
|
),
|
|
3497
|
-
children:
|
|
3087
|
+
children: [
|
|
3498
3088
|
renderCardHeader({
|
|
3499
3089
|
className: classNames == null ? void 0 : classNames.header,
|
|
3500
3090
|
headerSubtitle,
|
|
@@ -3502,8 +3092,8 @@ var PlaceOrder = ({
|
|
|
3502
3092
|
headerTitle,
|
|
3503
3093
|
onClose
|
|
3504
3094
|
}),
|
|
3505
|
-
/* @__PURE__ */
|
|
3506
|
-
/* @__PURE__ */
|
|
3095
|
+
/* @__PURE__ */ jsxs3("div", { className: cn("agg-order-panel-content flex flex-col gap-6", classNames == null ? void 0 : classNames.content), children: [
|
|
3096
|
+
/* @__PURE__ */ jsx4(
|
|
3507
3097
|
"div",
|
|
3508
3098
|
{
|
|
3509
3099
|
className: "agg-order-tabs flex items-end border-b border-agg-separator",
|
|
@@ -3514,7 +3104,7 @@ var PlaceOrder = ({
|
|
|
3514
3104
|
{ value: "sell", label: tradingLabels.sell, ref: sellTabRef }
|
|
3515
3105
|
].map((tabItem) => {
|
|
3516
3106
|
const isActive = internalTab === tabItem.value;
|
|
3517
|
-
return /* @__PURE__ */
|
|
3107
|
+
return /* @__PURE__ */ jsxs3(
|
|
3518
3108
|
"button",
|
|
3519
3109
|
{
|
|
3520
3110
|
ref: tabItem.ref,
|
|
@@ -3538,7 +3128,7 @@ var PlaceOrder = ({
|
|
|
3538
3128
|
onKeyDown: (event) => handleTabKeyDown(event, tabItem.value),
|
|
3539
3129
|
children: [
|
|
3540
3130
|
tabItem.label,
|
|
3541
|
-
/* @__PURE__ */
|
|
3131
|
+
/* @__PURE__ */ jsx4(
|
|
3542
3132
|
"span",
|
|
3543
3133
|
{
|
|
3544
3134
|
"aria-hidden": "true",
|
|
@@ -3560,13 +3150,13 @@ var PlaceOrder = ({
|
|
|
3560
3150
|
})
|
|
3561
3151
|
}
|
|
3562
3152
|
),
|
|
3563
|
-
outcomes.length >= 2 ? /* @__PURE__ */
|
|
3153
|
+
outcomes.length >= 2 ? /* @__PURE__ */ jsx4("div", { className: "agg-outcomes flex w-full max-w-full gap-2", children: outcomes.map((outcome, index) => {
|
|
3564
3154
|
var _a2, _b2, _c2;
|
|
3565
3155
|
const price = (_b2 = (_a2 = clusterMidpoints.get(outcome.id)) != null ? _a2 : livePrices.get(outcome.id)) != null ? _b2 : outcome.price;
|
|
3566
3156
|
const isActive = outcome.id === scopedSelectedOutcomeId;
|
|
3567
3157
|
const isPositive = resolveIsPositiveOutcome(outcome, index);
|
|
3568
3158
|
const displayLabel = ((_c2 = outcome.title) == null ? void 0 : _c2.trim()) || outcome.label;
|
|
3569
|
-
return /* @__PURE__ */
|
|
3159
|
+
return /* @__PURE__ */ jsxs3(
|
|
3570
3160
|
"button",
|
|
3571
3161
|
{
|
|
3572
3162
|
"data-id": outcome.id,
|
|
@@ -3586,7 +3176,7 @@ var PlaceOrder = ({
|
|
|
3586
3176
|
disabled: !orderEligibility.canPlaceOrder || isResolvedOutcomeCtaLocked,
|
|
3587
3177
|
onClick: () => handleOutcomeChange(outcome.id),
|
|
3588
3178
|
children: [
|
|
3589
|
-
/* @__PURE__ */
|
|
3179
|
+
/* @__PURE__ */ jsx4(
|
|
3590
3180
|
Typography,
|
|
3591
3181
|
{
|
|
3592
3182
|
as: "span",
|
|
@@ -3595,33 +3185,36 @@ var PlaceOrder = ({
|
|
|
3595
3185
|
children: displayLabel
|
|
3596
3186
|
}
|
|
3597
3187
|
),
|
|
3598
|
-
/* @__PURE__ */
|
|
3188
|
+
/* @__PURE__ */ jsx4(Typography, { as: "span", variant: isActive ? "body-strong" : "body", children: formatProbabilityCents(price) })
|
|
3599
3189
|
]
|
|
3600
3190
|
},
|
|
3601
3191
|
outcome.id
|
|
3602
3192
|
);
|
|
3603
3193
|
}) }) : null,
|
|
3604
|
-
/* @__PURE__ */
|
|
3605
|
-
/* @__PURE__ */
|
|
3606
|
-
/* @__PURE__ */
|
|
3607
|
-
isAuthenticated ? isSell ? /* @__PURE__ */
|
|
3608
|
-
"
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
"
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3194
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-order-amount-section flex items-start justify-between gap-4", children: [
|
|
3195
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-order-amount-meta flex flex-col", children: [
|
|
3196
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-order-amount-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground whitespace-nowrap", children: tradingLabels.amount(internalTab) }),
|
|
3197
|
+
isAuthenticated ? isSell ? /* @__PURE__ */ jsx4("div", { className: "agg-balance-value flex items-baseline gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isCurrentSellableSharesLoading ? /* @__PURE__ */ jsx4(LoadingIcon, { size: "small" }) : /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
3198
|
+
/* @__PURE__ */ jsx4("span", { children: tradingLabels.shares(displayedCurrentSellableShares) }),
|
|
3199
|
+
displayedCurrentSellableShares > 0 ? /* @__PURE__ */ jsx4(
|
|
3200
|
+
"button",
|
|
3201
|
+
{
|
|
3202
|
+
type: "button",
|
|
3203
|
+
className: cn(
|
|
3204
|
+
"agg-max-shares-button",
|
|
3205
|
+
"cursor-pointer disabled:cursor-not-allowed",
|
|
3206
|
+
"bg-transparent p-0 text-agg-sm font-agg-bold leading-agg-5 text-agg-primary disabled:text-agg-muted-foreground",
|
|
3207
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
|
|
3208
|
+
),
|
|
3209
|
+
"aria-label": tradingLabels.maxShares,
|
|
3210
|
+
disabled: !orderEligibility.canPlaceOrder || isAtMaxSellableShares,
|
|
3211
|
+
onClick: handleFillSellableShares,
|
|
3212
|
+
children: tradingLabels.maxShares
|
|
3213
|
+
}
|
|
3214
|
+
) : null
|
|
3215
|
+
] }) }) : /* @__PURE__ */ jsx4("p", { className: "agg-balance-value flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isBalanceLoading ? /* @__PURE__ */ jsx4(LoadingIcon, { size: "small" }) : tradingLabels.balance(formatUsd(totalBalance)) }) : null
|
|
3623
3216
|
] }),
|
|
3624
|
-
/* @__PURE__ */
|
|
3217
|
+
/* @__PURE__ */ jsx4(
|
|
3625
3218
|
CurrencyInput,
|
|
3626
3219
|
{
|
|
3627
3220
|
value: internalAmount,
|
|
@@ -3641,22 +3234,22 @@ var PlaceOrder = ({
|
|
|
3641
3234
|
}
|
|
3642
3235
|
)
|
|
3643
3236
|
] }),
|
|
3644
|
-
shouldShowSmartRouting ? /* @__PURE__ */
|
|
3645
|
-
/* @__PURE__ */
|
|
3646
|
-
/* @__PURE__ */
|
|
3647
|
-
shouldShowRouteToggle ? /* @__PURE__ */
|
|
3237
|
+
shouldShowSmartRouting ? /* @__PURE__ */ jsxs3("div", { className: "agg-route-panel flex flex-col gap-3", children: [
|
|
3238
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-route-panel-header flex items-center justify-between gap-4", children: [
|
|
3239
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-route-panel-title text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.smartRouting }),
|
|
3240
|
+
shouldShowRouteToggle && !isRoutesExpanded ? /* @__PURE__ */ jsxs3(
|
|
3648
3241
|
"button",
|
|
3649
3242
|
{
|
|
3650
3243
|
type: "button",
|
|
3651
3244
|
className: "agg-route-toggle flex cursor-pointer items-center gap-1.5 text-agg-sm leading-agg-5 text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary",
|
|
3652
|
-
"aria-label":
|
|
3245
|
+
"aria-label": tradingLabels.viewAllRoutes(orderedRouteCards.length),
|
|
3653
3246
|
onClick: () => setIsRoutesExpanded((currentValue) => !currentValue),
|
|
3654
3247
|
children: [
|
|
3655
|
-
/* @__PURE__ */
|
|
3656
|
-
/* @__PURE__ */
|
|
3248
|
+
/* @__PURE__ */ jsx4("span", { children: tradingLabels.viewAllRoutes(orderedRouteCards.length) }),
|
|
3249
|
+
/* @__PURE__ */ jsx4(
|
|
3657
3250
|
Icon,
|
|
3658
3251
|
{
|
|
3659
|
-
name:
|
|
3252
|
+
name: "chevron-down",
|
|
3660
3253
|
size: "small",
|
|
3661
3254
|
className: "h-4 w-4 text-agg-foreground",
|
|
3662
3255
|
"aria-hidden": "true"
|
|
@@ -3666,26 +3259,26 @@ var PlaceOrder = ({
|
|
|
3666
3259
|
}
|
|
3667
3260
|
) : null
|
|
3668
3261
|
] }),
|
|
3669
|
-
/* @__PURE__ */
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
}),
|
|
3680
|
-
|
|
3681
|
-
] })
|
|
3262
|
+
/* @__PURE__ */ jsx4("div", { className: "agg-route-list flex flex-col gap-2", children: visibleRouteCards.length > 0 ? smartRoute.isFetching ? Array.from({ length: visibleRouteCards.length }).map((_, index) => /* @__PURE__ */ jsx4(PlaceOrderRouteCardSkeleton, {}, index)) : visibleRouteCards.map((card) => {
|
|
3263
|
+
return /* @__PURE__ */ jsx4(Fragment, { children: renderRouteCard({
|
|
3264
|
+
card,
|
|
3265
|
+
enableAnimations,
|
|
3266
|
+
isExpanded: card.kind === "split" ? isSplitDetailOpen : isRoutesExpanded,
|
|
3267
|
+
isSelected: !card.isUnavailable && card.id === resolvedSelectedRouteCardId,
|
|
3268
|
+
onSelect: handleRouteCardSelect,
|
|
3269
|
+
tradingLabels
|
|
3270
|
+
}) }, card.id);
|
|
3271
|
+
}) : smartRoute.isFetching ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
3272
|
+
/* @__PURE__ */ jsx4(PlaceOrderRouteCardSkeleton, {}),
|
|
3273
|
+
/* @__PURE__ */ jsx4(PlaceOrderRouteCardSkeleton, {})
|
|
3274
|
+
] }) : null })
|
|
3682
3275
|
] }) : null,
|
|
3683
|
-
hasEnteredAmount && selectedRouteCard && orderEligibility.canPlaceOrder ? /* @__PURE__ */
|
|
3684
|
-
/* @__PURE__ */
|
|
3685
|
-
/* @__PURE__ */
|
|
3686
|
-
/* @__PURE__ */
|
|
3276
|
+
hasEnteredAmount && selectedRouteCard && orderEligibility.canPlaceOrder ? /* @__PURE__ */ jsxs3("div", { className: "agg-order-summary flex items-start justify-between gap-4", children: [
|
|
3277
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-order-summary-meta flex flex-col", children: [
|
|
3278
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-order-summary-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.toWin(internalTab) }),
|
|
3279
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-order-summary-hint text-agg-sm leading-agg-5 text-agg-muted-foreground", children: displayedToWinHint })
|
|
3687
3280
|
] }),
|
|
3688
|
-
/* @__PURE__ */
|
|
3281
|
+
/* @__PURE__ */ jsx4(
|
|
3689
3282
|
NumberFlow,
|
|
3690
3283
|
{
|
|
3691
3284
|
value: displayedToWinValue,
|
|
@@ -3700,7 +3293,7 @@ var PlaceOrder = ({
|
|
|
3700
3293
|
}
|
|
3701
3294
|
)
|
|
3702
3295
|
] }) : null,
|
|
3703
|
-
/* @__PURE__ */
|
|
3296
|
+
/* @__PURE__ */ jsxs3(
|
|
3704
3297
|
"div",
|
|
3705
3298
|
{
|
|
3706
3299
|
className: cn(
|
|
@@ -3708,54 +3301,23 @@ var PlaceOrder = ({
|
|
|
3708
3301
|
classNames == null ? void 0 : classNames.footer
|
|
3709
3302
|
),
|
|
3710
3303
|
children: [
|
|
3711
|
-
!shouldShowGeoBlockBanner ? /* @__PURE__ */
|
|
3712
|
-
submissionFeedback ? /* @__PURE__ */
|
|
3304
|
+
!shouldShowGeoBlockBanner ? /* @__PURE__ */ jsxs3("div", { className: "agg-order-alerts flex flex-col gap-3 empty:hidden mb-3", children: [
|
|
3305
|
+
submissionFeedback ? /* @__PURE__ */ jsx4(
|
|
3713
3306
|
InlineAlert,
|
|
3714
3307
|
{
|
|
3715
3308
|
tone: submissionFeedback.tone,
|
|
3716
3309
|
message: submissionFeedback.message
|
|
3717
3310
|
}
|
|
3718
3311
|
) : null,
|
|
3719
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && isInsufficientBalance ? /* @__PURE__ */
|
|
3720
|
-
"div",
|
|
3721
|
-
{
|
|
3722
|
-
className: "agg-order-sign-in-alert flex items-center justify-center gap-2",
|
|
3723
|
-
role: "status",
|
|
3724
|
-
"aria-live": "polite",
|
|
3725
|
-
children: /* @__PURE__ */ jsx5(
|
|
3726
|
-
Button,
|
|
3727
|
-
{
|
|
3728
|
-
variant: "tertiary",
|
|
3729
|
-
"aria-label": tradingLabels.insufficientBalance,
|
|
3730
|
-
onClick: handleDepositRequiredClick,
|
|
3731
|
-
className: cn(
|
|
3732
|
-
"agg-order-sign-in-alert-trigger text-agg-sm! text-agg-foreground! font-agg-normal! hover:text-agg-muted-foreground!"
|
|
3733
|
-
),
|
|
3734
|
-
children: /* @__PURE__ */ jsxs4("span", { className: "flex items-center gap-2", children: [
|
|
3735
|
-
/* @__PURE__ */ jsx5(
|
|
3736
|
-
Icon,
|
|
3737
|
-
{
|
|
3738
|
-
name: "warning-filled",
|
|
3739
|
-
size: "small",
|
|
3740
|
-
className: "h-4! w-4! shrink-0 text-agg-warning",
|
|
3741
|
-
"aria-hidden": "true"
|
|
3742
|
-
}
|
|
3743
|
-
),
|
|
3744
|
-
/* @__PURE__ */ jsx5("span", { children: tradingLabels.insufficientBalance })
|
|
3745
|
-
] })
|
|
3746
|
-
}
|
|
3747
|
-
)
|
|
3748
|
-
}
|
|
3749
|
-
) : null,
|
|
3750
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && isBelowMinimum ? /* @__PURE__ */ jsx5(
|
|
3312
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && isBelowMinimum ? /* @__PURE__ */ jsx4(
|
|
3751
3313
|
InlineAlert,
|
|
3752
3314
|
{
|
|
3753
3315
|
tone: "error",
|
|
3754
3316
|
message: tradingLabels.minimumOrderAmount(MIN_BUY_ORDER_AMOUNT)
|
|
3755
3317
|
}
|
|
3756
3318
|
) : null,
|
|
3757
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && quoteStatus ? /* @__PURE__ */
|
|
3758
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && !quoteStatus && isAuthenticated && hasEnteredAmount && smartRouteErrorMessage ? /* @__PURE__ */
|
|
3319
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && quoteStatus ? /* @__PURE__ */ jsx4(InlineAlert, { tone: quoteStatus.tone, message: quoteStatus.message }) : null,
|
|
3320
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && !quoteStatus && isAuthenticated && hasEnteredAmount && smartRouteErrorMessage ? /* @__PURE__ */ jsx4(
|
|
3759
3321
|
InlineAlert,
|
|
3760
3322
|
{
|
|
3761
3323
|
tone: "error",
|
|
@@ -3765,40 +3327,50 @@ var PlaceOrder = ({
|
|
|
3765
3327
|
void smartRoute.refetch();
|
|
3766
3328
|
}
|
|
3767
3329
|
}
|
|
3768
|
-
) : null,
|
|
3769
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && !quoteStatus && !isAuthenticated && hasEnteredAmount ? /* @__PURE__ */ jsx5(
|
|
3770
|
-
"div",
|
|
3771
|
-
{
|
|
3772
|
-
className: "agg-order-sign-in-alert flex items-center justify-center gap-2",
|
|
3773
|
-
role: "status",
|
|
3774
|
-
"aria-live": "polite",
|
|
3775
|
-
children: /* @__PURE__ */ jsx5(
|
|
3776
|
-
Button,
|
|
3777
|
-
{
|
|
3778
|
-
variant: "tertiary",
|
|
3779
|
-
"aria-label": tradingLabels.signInRequired,
|
|
3780
|
-
onClick: handleSignInRequiredClick,
|
|
3781
|
-
className: cn(
|
|
3782
|
-
"agg-order-sign-in-alert-trigger text-agg-sm! text-agg-foreground! font-agg-normal! hover:text-agg-muted-foreground!"
|
|
3783
|
-
),
|
|
3784
|
-
children: /* @__PURE__ */ jsxs4("span", { className: "flex items-center gap-2", children: [
|
|
3785
|
-
/* @__PURE__ */ jsx5(
|
|
3786
|
-
Icon,
|
|
3787
|
-
{
|
|
3788
|
-
name: "warning-filled",
|
|
3789
|
-
size: "small",
|
|
3790
|
-
className: "h-4! w-4! shrink-0 text-agg-warning",
|
|
3791
|
-
"aria-hidden": "true"
|
|
3792
|
-
}
|
|
3793
|
-
),
|
|
3794
|
-
/* @__PURE__ */ jsx5("span", { children: tradingLabels.signInRequired })
|
|
3795
|
-
] })
|
|
3796
|
-
}
|
|
3797
|
-
)
|
|
3798
|
-
}
|
|
3799
3330
|
) : null
|
|
3800
3331
|
] }) : null,
|
|
3801
|
-
|
|
3332
|
+
!submissionFeedback && !shouldShowGeoBlockBanner && orderEligibility.canPlaceOrder && isInsufficientBalance ? /* @__PURE__ */ jsxs3(
|
|
3333
|
+
"div",
|
|
3334
|
+
{
|
|
3335
|
+
className: "agg-order-insufficient-balance-alert flex items-center justify-center gap-2",
|
|
3336
|
+
role: "status",
|
|
3337
|
+
"aria-live": "polite",
|
|
3338
|
+
children: [
|
|
3339
|
+
/* @__PURE__ */ jsx4(
|
|
3340
|
+
Icon,
|
|
3341
|
+
{
|
|
3342
|
+
name: "warning-filled",
|
|
3343
|
+
size: "small",
|
|
3344
|
+
className: "h-4 w-4 shrink-0 text-agg-warning",
|
|
3345
|
+
"aria-hidden": "true"
|
|
3346
|
+
}
|
|
3347
|
+
),
|
|
3348
|
+
/* @__PURE__ */ jsx4("span", { className: "text-agg-sm text-agg-foreground", children: tradingLabels.insufficientBalance })
|
|
3349
|
+
]
|
|
3350
|
+
}
|
|
3351
|
+
) : null,
|
|
3352
|
+
!submissionFeedback && !shouldShowGeoBlockBanner && isInsufficientBalance ? /* @__PURE__ */ jsx4(
|
|
3353
|
+
Button,
|
|
3354
|
+
{
|
|
3355
|
+
size: "large",
|
|
3356
|
+
variant: "primary",
|
|
3357
|
+
className: "agg-order-submit h-12 w-full px-8 text-agg-base leading-agg-6 shadow-none",
|
|
3358
|
+
"aria-label": tradingLabels.deposit,
|
|
3359
|
+
onClick: handleDepositRequiredClick,
|
|
3360
|
+
children: tradingLabels.deposit
|
|
3361
|
+
}
|
|
3362
|
+
) : needsKycVerification && !submissionFeedback && !shouldShowGeoBlockBanner ? /* @__PURE__ */ jsx4(InitiateKycButton, { label: tradingLabels.kycRequired, onOpen: openVerifyModal }) : !isAuthenticated ? /* @__PURE__ */ jsx4(
|
|
3363
|
+
Button,
|
|
3364
|
+
{
|
|
3365
|
+
size: "large",
|
|
3366
|
+
variant: "primary",
|
|
3367
|
+
className: "agg-order-submit h-12 w-full px-8 text-agg-base leading-agg-6 shadow-none",
|
|
3368
|
+
disabled: !orderEligibility.canPlaceOrder || shouldShowGeoBlockBanner,
|
|
3369
|
+
"aria-label": tradingLabels.signInToTrade,
|
|
3370
|
+
onClick: requestAggAuthChooserOpen,
|
|
3371
|
+
children: tradingLabels.signInToTrade
|
|
3372
|
+
}
|
|
3373
|
+
) : /* @__PURE__ */ jsx4(
|
|
3802
3374
|
Button,
|
|
3803
3375
|
{
|
|
3804
3376
|
size: "large",
|
|
@@ -3813,16 +3385,16 @@ var PlaceOrder = ({
|
|
|
3813
3385
|
children: actionLabel
|
|
3814
3386
|
}
|
|
3815
3387
|
),
|
|
3816
|
-
shouldShowGeoBlockBanner ? /* @__PURE__ */
|
|
3817
|
-
!shouldShowGeoBlockBanner ? /* @__PURE__ */
|
|
3388
|
+
shouldShowGeoBlockBanner ? /* @__PURE__ */ jsx4(GeoBlockBanner, { termsUrl: AGG_TERMS_OF_SERVICE_URL }) : null,
|
|
3389
|
+
!shouldShowGeoBlockBanner ? /* @__PURE__ */ jsx4("p", { className: "agg-order-disclaimer text-center text-agg-xs leading-agg-4 text-agg-muted-foreground", children: tradingLabels.disclaimer }) : null
|
|
3818
3390
|
]
|
|
3819
3391
|
}
|
|
3820
3392
|
)
|
|
3821
3393
|
] })
|
|
3822
|
-
]
|
|
3394
|
+
]
|
|
3823
3395
|
}
|
|
3824
3396
|
),
|
|
3825
|
-
/* @__PURE__ */
|
|
3397
|
+
/* @__PURE__ */ jsx4(
|
|
3826
3398
|
KycVerifyModal,
|
|
3827
3399
|
{
|
|
3828
3400
|
open: isKycVerifyModalOpen,
|
|
@@ -3839,7 +3411,7 @@ var PlaceOrder = ({
|
|
|
3839
3411
|
}
|
|
3840
3412
|
}
|
|
3841
3413
|
),
|
|
3842
|
-
/* @__PURE__ */
|
|
3414
|
+
/* @__PURE__ */ jsx4(
|
|
3843
3415
|
KycSuccessModal,
|
|
3844
3416
|
{
|
|
3845
3417
|
open: showKycSuccessModal,
|
|
@@ -3860,19 +3432,6 @@ PlaceOrder.displayName = "PlaceOrder";
|
|
|
3860
3432
|
export {
|
|
3861
3433
|
parseVenue,
|
|
3862
3434
|
parseAmount,
|
|
3863
|
-
defaultSettlementSectionLabel,
|
|
3864
|
-
defaultSettlementDifferencesTitle,
|
|
3865
|
-
defaultTradingDisclaimer,
|
|
3866
|
-
getTradingDateLabel,
|
|
3867
|
-
getTradingVenueLabel,
|
|
3868
|
-
getTradingValueLabel,
|
|
3869
|
-
getTradingPriceLabel,
|
|
3870
|
-
getTradingAveragePriceLabel,
|
|
3871
|
-
getTradingBalanceLabel,
|
|
3872
|
-
getTradingSharesLabel,
|
|
3873
|
-
getTradingSlippageLabel,
|
|
3874
|
-
Settlement,
|
|
3875
|
-
mapVenueMarketsToSettlementSections,
|
|
3876
3435
|
SettlementDetails,
|
|
3877
3436
|
DEPOSIT_MODAL_OPEN_EVENT,
|
|
3878
3437
|
WITHDRAW_MODAL_OPEN_EVENT,
|