@agg-build/ui 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-WLXYCBZV.mjs → chunk-3IY2GA2D.mjs} +10 -16
- package/dist/{chunk-5ES2VJHO.mjs → chunk-4ILR2YH3.mjs} +162 -253
- package/dist/{chunk-HD6HBTK2.mjs → chunk-PEVG67XU.mjs} +369 -19
- package/dist/{chunk-YZNO6IUD.mjs → chunk-TLGQ4LID.mjs} +1306 -1173
- package/dist/{chunk-BYMLPLEZ.mjs → chunk-WFS772A3.mjs} +10 -10
- package/dist/{chunk-LPNZOX3E.mjs → chunk-XDZLCWUZ.mjs} +404 -863
- package/dist/{chunk-43K4PFBC.mjs → chunk-YSCHNVBZ.mjs} +1 -1
- package/dist/events.js +1850 -1545
- package/dist/events.mjs +3 -3
- package/dist/index.js +3651 -3669
- package/dist/index.mjs +189 -118
- package/dist/modals.js +1005 -942
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +2751 -2850
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +1284 -1166
- package/dist/primitives.mjs +7 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +3679 -3681
- 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/primitives/icon/index.d.mts +3 -1
- package/dist/types/primitives/icon/index.d.ts +3 -1
- package/dist/types/primitives/icon/registry.d.mts +8 -0
- package/dist/types/primitives/icon/registry.d.ts +8 -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/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 +2 -2
- 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-PEVG67XU.mjs";
|
|
6
11
|
import {
|
|
7
12
|
GeoBlockBanner
|
|
8
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-YSCHNVBZ.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-TLGQ4LID.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) {
|
|
@@ -978,14 +572,6 @@ var resolveExecutionVenueFromQuote = (quoteData) => {
|
|
|
978
572
|
const parsed = parseVenue(dominantFill == null ? void 0 : dominantFill.venue);
|
|
979
573
|
return parsed.success ? parsed.data : void 0;
|
|
980
574
|
};
|
|
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
575
|
var getPlaceOrderPotentialReturn = (quoteData) => {
|
|
990
576
|
var _a, _b;
|
|
991
577
|
if (!((_a = quoteData == null ? void 0 : quoteData.fills) == null ? void 0 : _a.length) || quoteData.fills.length < 2) return 0;
|
|
@@ -1542,7 +1128,7 @@ var isPercentageBelowMinimum = (value, minimumValue) => {
|
|
|
1542
1128
|
};
|
|
1543
1129
|
|
|
1544
1130
|
// src/trading/place-order/index.place-order.failure.tsx
|
|
1545
|
-
import { jsx as
|
|
1131
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
1546
1132
|
var resolveFailureActionHandler = ({
|
|
1547
1133
|
action,
|
|
1548
1134
|
onDone,
|
|
@@ -1555,12 +1141,12 @@ var resolveFailureActionHandler = ({
|
|
|
1555
1141
|
};
|
|
1556
1142
|
var renderPartialFailureStep = (step) => {
|
|
1557
1143
|
const isWarningStep = step.tone === "warning" || step.tone === "error";
|
|
1558
|
-
return /* @__PURE__ */
|
|
1144
|
+
return /* @__PURE__ */ jsxs(
|
|
1559
1145
|
"div",
|
|
1560
1146
|
{
|
|
1561
1147
|
className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
1562
1148
|
children: [
|
|
1563
|
-
/* @__PURE__ */
|
|
1149
|
+
/* @__PURE__ */ jsx2(
|
|
1564
1150
|
Icon,
|
|
1565
1151
|
{
|
|
1566
1152
|
name: isWarningStep ? "warning-filled" : "check-circle",
|
|
@@ -1569,8 +1155,8 @@ var renderPartialFailureStep = (step) => {
|
|
|
1569
1155
|
"aria-hidden": "true"
|
|
1570
1156
|
}
|
|
1571
1157
|
),
|
|
1572
|
-
/* @__PURE__ */
|
|
1573
|
-
step.venue ? /* @__PURE__ */
|
|
1158
|
+
/* @__PURE__ */ jsx2("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
1159
|
+
step.venue ? /* @__PURE__ */ jsx2(VenueLogo, { venue: step.venue, size: "small", className: "h-4 w-4 shrink-0" }) : null
|
|
1574
1160
|
]
|
|
1575
1161
|
},
|
|
1576
1162
|
step.id
|
|
@@ -1589,10 +1175,10 @@ var PlaceOrderFailureView = ({
|
|
|
1589
1175
|
const shouldShowPartialFailureLayout = summary.kind === "partial_fill";
|
|
1590
1176
|
const failureStepGroups = shouldShowPartialFailureLayout ? groupPlaceOrderFailureSteps(summary.steps) : [];
|
|
1591
1177
|
if (shouldShowPartialFailureLayout) {
|
|
1592
|
-
return /* @__PURE__ */
|
|
1593
|
-
/* @__PURE__ */
|
|
1594
|
-
/* @__PURE__ */
|
|
1595
|
-
/* @__PURE__ */
|
|
1178
|
+
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: [
|
|
1179
|
+
/* @__PURE__ */ jsxs("div", { className: "agg-order-failure-header flex flex-col gap-2", children: [
|
|
1180
|
+
/* @__PURE__ */ jsxs("div", { className: "agg-order-failure-market flex items-center gap-3", children: [
|
|
1181
|
+
/* @__PURE__ */ jsx2(
|
|
1596
1182
|
RemoteImage,
|
|
1597
1183
|
{
|
|
1598
1184
|
src: (_a = summary.eventImage) != null ? _a : null,
|
|
@@ -1600,12 +1186,12 @@ var PlaceOrderFailureView = ({
|
|
|
1600
1186
|
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
1601
1187
|
}
|
|
1602
1188
|
),
|
|
1603
|
-
/* @__PURE__ */
|
|
1189
|
+
/* @__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
1190
|
] }),
|
|
1605
|
-
summary.eventSubtitle ? /* @__PURE__ */
|
|
1191
|
+
summary.eventSubtitle ? /* @__PURE__ */ jsx2("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
|
|
1606
1192
|
] }),
|
|
1607
|
-
/* @__PURE__ */
|
|
1608
|
-
/* @__PURE__ */
|
|
1193
|
+
/* @__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}`)) }),
|
|
1194
|
+
/* @__PURE__ */ jsx2("div", { className: "flex items-center gap-4", children: summary.actions.map((action) => /* @__PURE__ */ jsx2(
|
|
1609
1195
|
Button,
|
|
1610
1196
|
{
|
|
1611
1197
|
variant: "tertiary",
|
|
@@ -1619,10 +1205,10 @@ var PlaceOrderFailureView = ({
|
|
|
1619
1205
|
)) })
|
|
1620
1206
|
] }) });
|
|
1621
1207
|
}
|
|
1622
|
-
return /* @__PURE__ */
|
|
1623
|
-
/* @__PURE__ */
|
|
1624
|
-
/* @__PURE__ */
|
|
1625
|
-
/* @__PURE__ */
|
|
1208
|
+
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: [
|
|
1209
|
+
/* @__PURE__ */ jsxs("div", { className: "agg-order-failure-header flex flex-col gap-2", children: [
|
|
1210
|
+
/* @__PURE__ */ jsxs("div", { className: "agg-order-failure-market flex items-center gap-3", children: [
|
|
1211
|
+
/* @__PURE__ */ jsx2(
|
|
1626
1212
|
RemoteImage,
|
|
1627
1213
|
{
|
|
1628
1214
|
src: (_b = summary.eventImage) != null ? _b : null,
|
|
@@ -1630,11 +1216,11 @@ var PlaceOrderFailureView = ({
|
|
|
1630
1216
|
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
1631
1217
|
}
|
|
1632
1218
|
),
|
|
1633
|
-
/* @__PURE__ */
|
|
1219
|
+
/* @__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
1220
|
] }),
|
|
1635
|
-
summary.eventSubtitle ? /* @__PURE__ */
|
|
1221
|
+
summary.eventSubtitle ? /* @__PURE__ */ jsx2("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
|
|
1636
1222
|
] }),
|
|
1637
|
-
/* @__PURE__ */
|
|
1223
|
+
/* @__PURE__ */ jsx2(
|
|
1638
1224
|
InlineAlert,
|
|
1639
1225
|
{
|
|
1640
1226
|
tone: "error",
|
|
@@ -1643,7 +1229,7 @@ var PlaceOrderFailureView = ({
|
|
|
1643
1229
|
message: tradingLabels.orderFailureDescription((_c = summary.errorMessage) != null ? _c : "")
|
|
1644
1230
|
}
|
|
1645
1231
|
),
|
|
1646
|
-
/* @__PURE__ */
|
|
1232
|
+
/* @__PURE__ */ jsx2("div", { className: "agg-order-failure-actions flex items-center gap-3", children: summary.actions.map((action) => /* @__PURE__ */ jsx2(
|
|
1647
1233
|
Button,
|
|
1648
1234
|
{
|
|
1649
1235
|
variant: action.variant === "retry" ? "primary" : "secondary",
|
|
@@ -1660,8 +1246,8 @@ var PlaceOrderFailureView = ({
|
|
|
1660
1246
|
PlaceOrderFailureView.displayName = "PlaceOrderFailureView";
|
|
1661
1247
|
|
|
1662
1248
|
// src/trading/place-order/index.place-order.success.tsx
|
|
1663
|
-
import { useState as
|
|
1664
|
-
import { jsx as
|
|
1249
|
+
import { useState as useState2 } from "react";
|
|
1250
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1665
1251
|
var resolveBuyToWinLabel = (shares) => {
|
|
1666
1252
|
if (!shares) return "$0";
|
|
1667
1253
|
return shares.startsWith("$") ? shares : `$${shares}`;
|
|
@@ -1673,18 +1259,17 @@ var PlaceOrderSuccessView = ({
|
|
|
1673
1259
|
onDone,
|
|
1674
1260
|
onShare: _onShare
|
|
1675
1261
|
}) => {
|
|
1676
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j
|
|
1677
|
-
const [isExecutionDetailsExpanded, setIsExecutionDetailsExpanded] =
|
|
1262
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1263
|
+
const [isExecutionDetailsExpanded, setIsExecutionDetailsExpanded] = useState2(true);
|
|
1678
1264
|
const newTradeLabel = (_a = tradingLabels.orderNewTrade) != null ? _a : "New Trade";
|
|
1679
1265
|
const _shareLabel = (_b = tradingLabels.orderShare) != null ? _b : "Share";
|
|
1680
1266
|
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];
|
|
1267
|
+
const resolvedActionLabel = (_c = summary.actionLabel) != null ? _c : tradingLabels.orderSuccessTitle;
|
|
1268
|
+
const resolvedTradeSide = (_d = summary.tradeSide) != null ? _d : "buy";
|
|
1269
|
+
const resolvedAmountLabel = (_e = summary.amountLabel) != null ? _e : resolvedTradeSide === "sell" ? summary.shares : summary.estimatedCost;
|
|
1270
|
+
const resolvedToWinLabel = (_f = summary.toWinLabel) != null ? _f : resolvedTradeSide === "sell" ? summary.estimatedCost : resolveBuyToWinLabel(summary.shares);
|
|
1271
|
+
const executionStepGroups = (_g = summary.executionStepGroups) != null ? _g : [];
|
|
1272
|
+
const finalStep = (_h = executionStepGroups.at(-1)) == null ? void 0 : _h[0];
|
|
1688
1273
|
const detailedStepGroups = executionStepGroups.slice(0, -1);
|
|
1689
1274
|
const hasExecutionDetails = detailedStepGroups.length > 0;
|
|
1690
1275
|
const resolveStepIconName = (tone) => {
|
|
@@ -1693,23 +1278,23 @@ var PlaceOrderSuccessView = ({
|
|
|
1693
1278
|
const resolveStepIconClassName = (tone) => {
|
|
1694
1279
|
return tone === "warning" || tone === "error" ? "text-agg-warning" : "text-agg-primary";
|
|
1695
1280
|
};
|
|
1696
|
-
return /* @__PURE__ */
|
|
1697
|
-
summary.eventTitle ? /* @__PURE__ */
|
|
1698
|
-
/* @__PURE__ */
|
|
1699
|
-
/* @__PURE__ */
|
|
1281
|
+
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: [
|
|
1282
|
+
summary.eventTitle ? /* @__PURE__ */ jsxs2("div", { className: "agg-order-success-header flex flex-col gap-2", children: [
|
|
1283
|
+
/* @__PURE__ */ jsxs2("div", { className: "agg-order-success-market flex items-center gap-3", children: [
|
|
1284
|
+
/* @__PURE__ */ jsx3(
|
|
1700
1285
|
RemoteImage,
|
|
1701
1286
|
{
|
|
1702
|
-
src: (
|
|
1287
|
+
src: (_i = summary.eventImage) != null ? _i : null,
|
|
1703
1288
|
alt: "",
|
|
1704
1289
|
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
1705
1290
|
}
|
|
1706
1291
|
),
|
|
1707
|
-
/* @__PURE__ */
|
|
1292
|
+
/* @__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
1293
|
] }),
|
|
1709
|
-
summary.eventDateLabel ? /* @__PURE__ */
|
|
1294
|
+
summary.eventDateLabel ? /* @__PURE__ */ jsx3("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventDateLabel }) : null
|
|
1710
1295
|
] }) : null,
|
|
1711
|
-
executionStepGroups.length > 0 ? /* @__PURE__ */
|
|
1712
|
-
/* @__PURE__ */
|
|
1296
|
+
executionStepGroups.length > 0 ? /* @__PURE__ */ jsxs2("div", { className: "agg-order-success-timeline flex flex-col gap-2", children: [
|
|
1297
|
+
/* @__PURE__ */ jsx3(
|
|
1713
1298
|
"div",
|
|
1714
1299
|
{
|
|
1715
1300
|
"aria-hidden": !isExecutionDetailsExpanded,
|
|
@@ -1722,12 +1307,12 @@ var PlaceOrderSuccessView = ({
|
|
|
1722
1307
|
"transition-[grid-template-rows,opacity] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
1723
1308
|
)
|
|
1724
1309
|
),
|
|
1725
|
-
children: /* @__PURE__ */
|
|
1310
|
+
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
1311
|
"div",
|
|
1727
1312
|
{
|
|
1728
1313
|
className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
1729
1314
|
children: [
|
|
1730
|
-
/* @__PURE__ */
|
|
1315
|
+
/* @__PURE__ */ jsx3(
|
|
1731
1316
|
Icon,
|
|
1732
1317
|
{
|
|
1733
1318
|
name: resolveStepIconName(step.tone),
|
|
@@ -1736,8 +1321,8 @@ var PlaceOrderSuccessView = ({
|
|
|
1736
1321
|
"aria-hidden": "true"
|
|
1737
1322
|
}
|
|
1738
1323
|
),
|
|
1739
|
-
/* @__PURE__ */
|
|
1740
|
-
step.venue ? /* @__PURE__ */
|
|
1324
|
+
/* @__PURE__ */ jsx3("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
1325
|
+
step.venue ? /* @__PURE__ */ jsx3(
|
|
1741
1326
|
VenueLogo,
|
|
1742
1327
|
{
|
|
1743
1328
|
venue: step.venue,
|
|
@@ -1751,7 +1336,7 @@ var PlaceOrderSuccessView = ({
|
|
|
1751
1336
|
)) }, `execution-group-${groupIndex}`)) }) })
|
|
1752
1337
|
}
|
|
1753
1338
|
),
|
|
1754
|
-
finalStep ? hasExecutionDetails ? /* @__PURE__ */
|
|
1339
|
+
finalStep ? hasExecutionDetails ? /* @__PURE__ */ jsxs2(
|
|
1755
1340
|
"button",
|
|
1756
1341
|
{
|
|
1757
1342
|
type: "button",
|
|
@@ -1763,7 +1348,7 @@ var PlaceOrderSuccessView = ({
|
|
|
1763
1348
|
),
|
|
1764
1349
|
onClick: () => setIsExecutionDetailsExpanded((currentValue) => !currentValue),
|
|
1765
1350
|
children: [
|
|
1766
|
-
/* @__PURE__ */
|
|
1351
|
+
/* @__PURE__ */ jsx3(
|
|
1767
1352
|
Icon,
|
|
1768
1353
|
{
|
|
1769
1354
|
name: resolveStepIconName(finalStep.tone),
|
|
@@ -1772,8 +1357,8 @@ var PlaceOrderSuccessView = ({
|
|
|
1772
1357
|
"aria-hidden": "true"
|
|
1773
1358
|
}
|
|
1774
1359
|
),
|
|
1775
|
-
/* @__PURE__ */
|
|
1776
|
-
/* @__PURE__ */
|
|
1360
|
+
/* @__PURE__ */ jsx3("p", { className: "min-w-0 flex-1", children: finalStep.label }),
|
|
1361
|
+
/* @__PURE__ */ jsx3(
|
|
1777
1362
|
Icon,
|
|
1778
1363
|
{
|
|
1779
1364
|
name: isExecutionDetailsExpanded ? "chevron-up" : "chevron-down",
|
|
@@ -1784,8 +1369,8 @@ var PlaceOrderSuccessView = ({
|
|
|
1784
1369
|
)
|
|
1785
1370
|
]
|
|
1786
1371
|
}
|
|
1787
|
-
) : /* @__PURE__ */
|
|
1788
|
-
/* @__PURE__ */
|
|
1372
|
+
) : /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
1373
|
+
/* @__PURE__ */ jsx3(
|
|
1789
1374
|
Icon,
|
|
1790
1375
|
{
|
|
1791
1376
|
name: resolveStepIconName(finalStep.tone),
|
|
@@ -1794,35 +1379,34 @@ var PlaceOrderSuccessView = ({
|
|
|
1794
1379
|
"aria-hidden": "true"
|
|
1795
1380
|
}
|
|
1796
1381
|
),
|
|
1797
|
-
/* @__PURE__ */
|
|
1382
|
+
/* @__PURE__ */ jsx3("p", { className: "min-w-0 flex-1", children: finalStep.label })
|
|
1798
1383
|
] }) : null
|
|
1799
1384
|
] }) : null,
|
|
1800
|
-
/* @__PURE__ */
|
|
1385
|
+
/* @__PURE__ */ jsxs2(
|
|
1801
1386
|
"div",
|
|
1802
1387
|
{
|
|
1803
1388
|
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"
|
|
1389
|
+
"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
1390
|
),
|
|
1807
1391
|
children: [
|
|
1808
|
-
/* @__PURE__ */
|
|
1809
|
-
/* @__PURE__ */
|
|
1392
|
+
/* @__PURE__ */ jsx3(Icon, { name: "success-check", size: "small", className: "h-4 w-4 shrink-0 text-current" }),
|
|
1393
|
+
/* @__PURE__ */ jsx3("span", { children: resolvedActionLabel })
|
|
1810
1394
|
]
|
|
1811
1395
|
}
|
|
1812
1396
|
),
|
|
1813
|
-
/* @__PURE__ */
|
|
1814
|
-
/* @__PURE__ */
|
|
1815
|
-
/* @__PURE__ */
|
|
1397
|
+
/* @__PURE__ */ jsxs2("div", { className: "agg-order-success-summary flex items-center justify-between gap-4", children: [
|
|
1398
|
+
/* @__PURE__ */ jsx3("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.amount(resolvedTradeSide) }),
|
|
1399
|
+
/* @__PURE__ */ jsx3("p", { className: "text-right text-[30px] font-agg-bold leading-[36px] text-agg-foreground", children: resolvedAmountLabel })
|
|
1816
1400
|
] }),
|
|
1817
|
-
/* @__PURE__ */
|
|
1818
|
-
/* @__PURE__ */
|
|
1819
|
-
/* @__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.toWin(resolvedTradeSide) }),
|
|
1403
|
+
/* @__PURE__ */ jsx3("p", { className: "text-right text-[30px] font-agg-bold leading-[36px] text-agg-success", children: resolvedToWinLabel })
|
|
1820
1404
|
] }),
|
|
1821
|
-
summary.potentialReturnLabel ? /* @__PURE__ */
|
|
1822
|
-
/* @__PURE__ */
|
|
1823
|
-
/* @__PURE__ */
|
|
1405
|
+
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: [
|
|
1406
|
+
/* @__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 }),
|
|
1407
|
+
/* @__PURE__ */ jsx3("p", { className: "text-agg-xs leading-agg-4 text-agg-foreground", children: (_j = tradingLabels.withSmartRouting) != null ? _j : "with Smart Routing" })
|
|
1824
1408
|
] }) : null,
|
|
1825
|
-
/* @__PURE__ */
|
|
1409
|
+
/* @__PURE__ */ jsx3("div", { className: "agg-order-success-actions flex gap-3", children: /* @__PURE__ */ jsx3(
|
|
1826
1410
|
Button,
|
|
1827
1411
|
{
|
|
1828
1412
|
variant: "secondary",
|
|
@@ -1838,7 +1422,7 @@ var PlaceOrderSuccessView = ({
|
|
|
1838
1422
|
PlaceOrderSuccessView.displayName = "PlaceOrderSuccessView";
|
|
1839
1423
|
|
|
1840
1424
|
// src/trading/place-order/index.tsx
|
|
1841
|
-
import { Fragment as
|
|
1425
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1842
1426
|
var DEFAULT_STEP_LABELS = {
|
|
1843
1427
|
"check-balance": "Checking balance",
|
|
1844
1428
|
"check-position": "Checking position",
|
|
@@ -1864,7 +1448,7 @@ var LoadingGlyph = ({
|
|
|
1864
1448
|
className,
|
|
1865
1449
|
enableAnimations
|
|
1866
1450
|
}) => {
|
|
1867
|
-
return /* @__PURE__ */
|
|
1451
|
+
return /* @__PURE__ */ jsx4(
|
|
1868
1452
|
"span",
|
|
1869
1453
|
{
|
|
1870
1454
|
"aria-hidden": "true",
|
|
@@ -1884,25 +1468,25 @@ var PlaceOrderSlippageControl = ({
|
|
|
1884
1468
|
minimumValue: slippageMinimumValue
|
|
1885
1469
|
}) => {
|
|
1886
1470
|
var _a, _b;
|
|
1887
|
-
const labels =
|
|
1888
|
-
const containerRef =
|
|
1889
|
-
const triggerRef =
|
|
1890
|
-
const inputRef =
|
|
1471
|
+
const labels = useLabels();
|
|
1472
|
+
const containerRef = useRef2(null);
|
|
1473
|
+
const triggerRef = useRef2(null);
|
|
1474
|
+
const inputRef = useRef2(null);
|
|
1891
1475
|
const warningId = useId();
|
|
1892
1476
|
const defaultValue = finalizePercentageValue(slippageDefaultValue);
|
|
1893
1477
|
const committedValue = finalizePercentageValue(slippageValue) || defaultValue;
|
|
1894
|
-
const [draftValue, setDraftValue] =
|
|
1895
|
-
const [isEditing, setIsEditing] =
|
|
1478
|
+
const [draftValue, setDraftValue] = useState3(committedValue);
|
|
1479
|
+
const [isEditing, setIsEditing] = useState3(
|
|
1896
1480
|
() => isPercentageBelowMinimum(committedValue, slippageMinimumValue)
|
|
1897
1481
|
);
|
|
1898
|
-
const [shouldFocusInput, setShouldFocusInput] =
|
|
1899
|
-
|
|
1482
|
+
const [shouldFocusInput, setShouldFocusInput] = useState3(false);
|
|
1483
|
+
useEffect2(() => {
|
|
1900
1484
|
setDraftValue(committedValue);
|
|
1901
1485
|
if (isPercentageBelowMinimum(committedValue, slippageMinimumValue)) {
|
|
1902
1486
|
setIsEditing(true);
|
|
1903
1487
|
}
|
|
1904
1488
|
}, [committedValue, slippageMinimumValue]);
|
|
1905
|
-
|
|
1489
|
+
useEffect2(() => {
|
|
1906
1490
|
if (!shouldFocusInput) return;
|
|
1907
1491
|
requestAnimationFrame(() => {
|
|
1908
1492
|
var _a2, _b2;
|
|
@@ -1919,7 +1503,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
1919
1503
|
Number(committedValue || slippageDefaultValue || DEFAULT_SLIPPAGE_VALUE)
|
|
1920
1504
|
);
|
|
1921
1505
|
const resolvedAutoLabel = labels.trading.resetSlippage;
|
|
1922
|
-
const resolvedWarningMessage =
|
|
1506
|
+
const resolvedWarningMessage = useMemo2(() => {
|
|
1923
1507
|
if (isLowSlippage) {
|
|
1924
1508
|
return labels.trading.slippageLow(slippageMinimumValue);
|
|
1925
1509
|
}
|
|
@@ -1982,8 +1566,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
1982
1566
|
if (!isEditing) return;
|
|
1983
1567
|
handleCommitDraft(false);
|
|
1984
1568
|
};
|
|
1985
|
-
return /* @__PURE__ */
|
|
1986
|
-
/* @__PURE__ */
|
|
1569
|
+
return /* @__PURE__ */ jsxs3("div", { ref: containerRef, className: "agg-slippage-control w-full", onBlur: handleContainerBlur, children: [
|
|
1570
|
+
/* @__PURE__ */ jsxs3(
|
|
1987
1571
|
"button",
|
|
1988
1572
|
{
|
|
1989
1573
|
ref: triggerRef,
|
|
@@ -2001,8 +1585,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
2001
1585
|
),
|
|
2002
1586
|
onClick: handleToggleEditing,
|
|
2003
1587
|
children: [
|
|
2004
|
-
/* @__PURE__ */
|
|
2005
|
-
/* @__PURE__ */
|
|
1588
|
+
/* @__PURE__ */ jsx4("span", { className: "agg-slippage-label", children: collapsedLabel }),
|
|
1589
|
+
/* @__PURE__ */ jsx4(
|
|
2006
1590
|
Icon,
|
|
2007
1591
|
{
|
|
2008
1592
|
name: isEditing ? "chevron-up" : "pencil",
|
|
@@ -2014,7 +1598,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
2014
1598
|
]
|
|
2015
1599
|
}
|
|
2016
1600
|
),
|
|
2017
|
-
/* @__PURE__ */
|
|
1601
|
+
/* @__PURE__ */ jsx4(
|
|
2018
1602
|
"div",
|
|
2019
1603
|
{
|
|
2020
1604
|
"aria-hidden": !isEditing,
|
|
@@ -2028,10 +1612,10 @@ var PlaceOrderSlippageControl = ({
|
|
|
2028
1612
|
"transition-[grid-template-rows,opacity,margin-top] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
2029
1613
|
)
|
|
2030
1614
|
),
|
|
2031
|
-
children: /* @__PURE__ */
|
|
2032
|
-
/* @__PURE__ */
|
|
2033
|
-
/* @__PURE__ */
|
|
2034
|
-
/* @__PURE__ */
|
|
1615
|
+
children: /* @__PURE__ */ jsx4("div", { className: "min-h-0", children: /* @__PURE__ */ jsxs3("div", { className: "agg-slippage-editor-body flex flex-col gap-2", children: [
|
|
1616
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-slippage-input-row flex h-9 overflow-hidden rounded-agg-sm border border-agg-separator", children: [
|
|
1617
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-slippage-input-group flex min-w-0 flex-1 items-center gap-2 bg-agg-secondary px-3", children: [
|
|
1618
|
+
/* @__PURE__ */ jsx4(
|
|
2035
1619
|
"input",
|
|
2036
1620
|
{
|
|
2037
1621
|
ref: inputRef,
|
|
@@ -2046,7 +1630,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
2046
1630
|
onKeyDown: handleInputKeyDown
|
|
2047
1631
|
}
|
|
2048
1632
|
),
|
|
2049
|
-
/* @__PURE__ */
|
|
1633
|
+
/* @__PURE__ */ jsx4(
|
|
2050
1634
|
"button",
|
|
2051
1635
|
{
|
|
2052
1636
|
type: "button",
|
|
@@ -2064,8 +1648,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
2064
1648
|
}
|
|
2065
1649
|
)
|
|
2066
1650
|
] }),
|
|
2067
|
-
/* @__PURE__ */
|
|
2068
|
-
/* @__PURE__ */
|
|
1651
|
+
/* @__PURE__ */ jsx4("div", { className: "h-full w-px bg-agg-separator", "aria-hidden": "true" }),
|
|
1652
|
+
/* @__PURE__ */ jsx4(
|
|
2069
1653
|
"div",
|
|
2070
1654
|
{
|
|
2071
1655
|
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 +1658,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
2074
1658
|
}
|
|
2075
1659
|
)
|
|
2076
1660
|
] }),
|
|
2077
|
-
/* @__PURE__ */
|
|
1661
|
+
/* @__PURE__ */ jsx4(
|
|
2078
1662
|
"div",
|
|
2079
1663
|
{
|
|
2080
1664
|
"aria-hidden": !resolvedWarningMessage,
|
|
@@ -2088,13 +1672,13 @@ var PlaceOrderSlippageControl = ({
|
|
|
2088
1672
|
"transition-[grid-template-rows,opacity] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
2089
1673
|
)
|
|
2090
1674
|
),
|
|
2091
|
-
children: /* @__PURE__ */
|
|
1675
|
+
children: /* @__PURE__ */ jsx4("div", { className: "min-h-0", children: /* @__PURE__ */ jsxs3(
|
|
2092
1676
|
"div",
|
|
2093
1677
|
{
|
|
2094
1678
|
id: warningId,
|
|
2095
1679
|
className: "agg-slippage-warning-message flex items-start gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
2096
1680
|
children: [
|
|
2097
|
-
/* @__PURE__ */
|
|
1681
|
+
/* @__PURE__ */ jsx4(
|
|
2098
1682
|
Icon,
|
|
2099
1683
|
{
|
|
2100
1684
|
name: "warning-filled",
|
|
@@ -2103,7 +1687,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
2103
1687
|
color: "currentColor"
|
|
2104
1688
|
}
|
|
2105
1689
|
),
|
|
2106
|
-
/* @__PURE__ */
|
|
1690
|
+
/* @__PURE__ */ jsx4("p", { children: resolvedWarningMessage != null ? resolvedWarningMessage : "" })
|
|
2107
1691
|
]
|
|
2108
1692
|
}
|
|
2109
1693
|
) })
|
|
@@ -2123,9 +1707,9 @@ var renderCardHeader = ({
|
|
|
2123
1707
|
onClose
|
|
2124
1708
|
}) => {
|
|
2125
1709
|
if (!headerTitle) return null;
|
|
2126
|
-
return /* @__PURE__ */
|
|
2127
|
-
/* @__PURE__ */
|
|
2128
|
-
/* @__PURE__ */
|
|
1710
|
+
return /* @__PURE__ */ jsxs3("div", { className: cn("agg-order-panel-header flex flex-col gap-2", className), children: [
|
|
1711
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-order-market-summary flex items-center gap-3", children: [
|
|
1712
|
+
/* @__PURE__ */ jsx4(
|
|
2129
1713
|
RemoteImage,
|
|
2130
1714
|
{
|
|
2131
1715
|
src: headerImage,
|
|
@@ -2133,19 +1717,19 @@ var renderCardHeader = ({
|
|
|
2133
1717
|
className: "agg-order-market-image h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
2134
1718
|
}
|
|
2135
1719
|
),
|
|
2136
|
-
/* @__PURE__ */
|
|
2137
|
-
onClose ? /* @__PURE__ */
|
|
1720
|
+
/* @__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 }),
|
|
1721
|
+
onClose ? /* @__PURE__ */ jsx4(
|
|
2138
1722
|
"button",
|
|
2139
1723
|
{
|
|
2140
1724
|
type: "button",
|
|
2141
1725
|
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
1726
|
"aria-label": "Close",
|
|
2143
1727
|
onClick: onClose,
|
|
2144
|
-
children: /* @__PURE__ */
|
|
1728
|
+
children: /* @__PURE__ */ jsx4(CloseIcon, { className: "h-5 w-5" })
|
|
2145
1729
|
}
|
|
2146
1730
|
) : null
|
|
2147
1731
|
] }),
|
|
2148
|
-
headerSubtitle ? /* @__PURE__ */
|
|
1732
|
+
headerSubtitle ? /* @__PURE__ */ jsx4("p", { className: "agg-order-market-subtitle text-agg-base leading-agg-6 text-agg-foreground", children: headerSubtitle }) : null
|
|
2149
1733
|
] });
|
|
2150
1734
|
};
|
|
2151
1735
|
var PlaceOrderResolvedView = ({
|
|
@@ -2155,7 +1739,7 @@ var PlaceOrderResolvedView = ({
|
|
|
2155
1739
|
className
|
|
2156
1740
|
}) => {
|
|
2157
1741
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2158
|
-
const labels =
|
|
1742
|
+
const labels = useLabels();
|
|
2159
1743
|
const tradingLabels = labels.trading;
|
|
2160
1744
|
const extendedTradingLabels = tradingLabels;
|
|
2161
1745
|
const winningOutcomeLabel = (_c = (_b = (_a = tradingState.winningOutcome) == null ? void 0 : _a.label) == null ? void 0 : _b.trim().toLowerCase()) != null ? _c : "";
|
|
@@ -2165,7 +1749,7 @@ var PlaceOrderResolvedView = ({
|
|
|
2165
1749
|
const resolvedIconName = isPositiveWinningOutcome ? "success-check" : "close";
|
|
2166
1750
|
const resolvedIconToneClassName = isPositiveWinningOutcome ? "text-agg-success" : "text-agg-error";
|
|
2167
1751
|
const resolvedIconContainerClassName = isPositiveWinningOutcome ? "bg-agg-success/15" : "bg-agg-error/15";
|
|
2168
|
-
return /* @__PURE__ */
|
|
1752
|
+
return /* @__PURE__ */ jsx4(
|
|
2169
1753
|
Card,
|
|
2170
1754
|
{
|
|
2171
1755
|
className: cn(
|
|
@@ -2174,7 +1758,7 @@ var PlaceOrderResolvedView = ({
|
|
|
2174
1758
|
classNames == null ? void 0 : classNames.root,
|
|
2175
1759
|
className
|
|
2176
1760
|
),
|
|
2177
|
-
children: /* @__PURE__ */
|
|
1761
|
+
children: /* @__PURE__ */ jsxs3(
|
|
2178
1762
|
"div",
|
|
2179
1763
|
{
|
|
2180
1764
|
className: cn(
|
|
@@ -2182,17 +1766,17 @@ var PlaceOrderResolvedView = ({
|
|
|
2182
1766
|
classNames == null ? void 0 : classNames.body
|
|
2183
1767
|
),
|
|
2184
1768
|
children: [
|
|
2185
|
-
/* @__PURE__ */
|
|
1769
|
+
/* @__PURE__ */ jsx4(
|
|
2186
1770
|
"div",
|
|
2187
1771
|
{
|
|
2188
1772
|
className: cn(
|
|
2189
1773
|
"flex h-15 w-15 items-center justify-center rounded-full",
|
|
2190
1774
|
resolvedIconContainerClassName
|
|
2191
1775
|
),
|
|
2192
|
-
children: /* @__PURE__ */
|
|
1776
|
+
children: /* @__PURE__ */ jsx4(Icon, { name: resolvedIconName, className: cn("h-6 w-6", resolvedIconToneClassName) })
|
|
2193
1777
|
}
|
|
2194
1778
|
),
|
|
2195
|
-
/* @__PURE__ */
|
|
1779
|
+
/* @__PURE__ */ jsxs3(
|
|
2196
1780
|
"div",
|
|
2197
1781
|
{
|
|
2198
1782
|
className: cn(
|
|
@@ -2200,30 +1784,30 @@ var PlaceOrderResolvedView = ({
|
|
|
2200
1784
|
classNames == null ? void 0 : classNames.content
|
|
2201
1785
|
),
|
|
2202
1786
|
children: [
|
|
2203
|
-
tradingState.market ? /* @__PURE__ */
|
|
2204
|
-
tradingState.winningOutcome ? /* @__PURE__ */
|
|
1787
|
+
tradingState.market ? /* @__PURE__ */ jsx4(Typography, { variant: "body", children: tradingState.market.question }) : null,
|
|
1788
|
+
tradingState.winningOutcome ? /* @__PURE__ */ jsx4(Typography, { variant: "body-large-strong", children: tradingLabels.outcome(tradingState.winningOutcome.label) }) : null
|
|
2205
1789
|
]
|
|
2206
1790
|
}
|
|
2207
1791
|
),
|
|
2208
|
-
resolvedClaim ? /* @__PURE__ */
|
|
2209
|
-
/* @__PURE__ */
|
|
2210
|
-
/* @__PURE__ */
|
|
2211
|
-
/* @__PURE__ */
|
|
2212
|
-
/* @__PURE__ */
|
|
2213
|
-
/* @__PURE__ */
|
|
2214
|
-
/* @__PURE__ */
|
|
2215
|
-
/* @__PURE__ */
|
|
1792
|
+
resolvedClaim ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
1793
|
+
/* @__PURE__ */ jsx4("div", { className: "h-px w-full bg-agg-separator" }),
|
|
1794
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-5 p-6", children: [
|
|
1795
|
+
/* @__PURE__ */ jsx4(Typography, { variant: "body-strong", children: (_d = extendedTradingLabels.resolvedEarningsTitle) != null ? _d : "Your Earnings" }),
|
|
1796
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-3 text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
1797
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between gap-4", children: [
|
|
1798
|
+
/* @__PURE__ */ jsx4("span", { children: (_e = extendedTradingLabels.resolvedResolutionDateLabel) != null ? _e : "Resolution date" }),
|
|
1799
|
+
/* @__PURE__ */ jsx4("span", { className: "font-agg-bold", children: resolvedClaim.resolutionDateLabel })
|
|
2216
1800
|
] }),
|
|
2217
|
-
/* @__PURE__ */
|
|
2218
|
-
/* @__PURE__ */
|
|
2219
|
-
/* @__PURE__ */
|
|
1801
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between gap-4", children: [
|
|
1802
|
+
/* @__PURE__ */ jsx4("span", { children: (_f = extendedTradingLabels.resolvedSharesLabel) != null ? _f : "Shares" }),
|
|
1803
|
+
/* @__PURE__ */ jsx4("span", { className: "font-agg-bold", children: resolvedClaim.sharesLabel })
|
|
2220
1804
|
] }),
|
|
2221
|
-
/* @__PURE__ */
|
|
2222
|
-
/* @__PURE__ */
|
|
2223
|
-
/* @__PURE__ */
|
|
1805
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between gap-4", children: [
|
|
1806
|
+
/* @__PURE__ */ jsx4("span", { children: (_g = extendedTradingLabels.resolvedTotalPayoutLabel) != null ? _g : "Total payout" }),
|
|
1807
|
+
/* @__PURE__ */ jsx4("span", { className: "font-agg-bold", children: resolvedClaim.totalPayoutLabel })
|
|
2224
1808
|
] })
|
|
2225
1809
|
] }),
|
|
2226
|
-
resolvedClaim.onClaim ? /* @__PURE__ */
|
|
1810
|
+
resolvedClaim.onClaim ? /* @__PURE__ */ jsx4(
|
|
2227
1811
|
Button,
|
|
2228
1812
|
{
|
|
2229
1813
|
size: "large",
|
|
@@ -2245,18 +1829,18 @@ var renderRouteBreakdownRow = (row) => {
|
|
|
2245
1829
|
var _a, _b;
|
|
2246
1830
|
const venueLabel = getTradingVenueLabel(row.venue);
|
|
2247
1831
|
const rowKey = `${row.venue}-${row.label}-${row.priceLabel}-${(_a = row.resultLabel) != null ? _a : ""}`;
|
|
2248
|
-
return /* @__PURE__ */
|
|
1832
|
+
return /* @__PURE__ */ jsxs3(
|
|
2249
1833
|
"div",
|
|
2250
1834
|
{
|
|
2251
1835
|
className: "agg-route-breakdown-row flex items-center justify-between gap-4 text-left",
|
|
2252
1836
|
children: [
|
|
2253
|
-
/* @__PURE__ */
|
|
2254
|
-
/* @__PURE__ */
|
|
2255
|
-
/* @__PURE__ */
|
|
1837
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-route-breakdown-market flex min-w-0 items-center gap-2", children: [
|
|
1838
|
+
/* @__PURE__ */ jsx4(VenueLogo, { venue: row.venue, className: "!size-3", ariaLabel: venueLabel }),
|
|
1839
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-route-breakdown-label truncate text-agg-sm leading-agg-5 text-agg-foreground", children: row.label })
|
|
2256
1840
|
] }),
|
|
2257
|
-
/* @__PURE__ */
|
|
2258
|
-
/* @__PURE__ */
|
|
2259
|
-
/* @__PURE__ */
|
|
1841
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-route-breakdown-value flex shrink-0 items-center gap-2 text-agg-sm leading-agg-5", children: [
|
|
1842
|
+
/* @__PURE__ */ jsx4("p", { className: "text-agg-muted-foreground", children: row.priceLabel }),
|
|
1843
|
+
/* @__PURE__ */ jsx4("p", { className: "text-agg-foreground", children: (_b = row.resultLabel) != null ? _b : "" })
|
|
2260
1844
|
] })
|
|
2261
1845
|
]
|
|
2262
1846
|
},
|
|
@@ -2275,7 +1859,7 @@ var renderRouteCard = ({
|
|
|
2275
1859
|
const showSplitDetails = isSelected && isExpanded && card.kind === "split" && !!((_a = card.rows) == null ? void 0 : _a.length);
|
|
2276
1860
|
const valueLabel = card.isUnavailable ? tradingLabels.venueUnavailableInRegion : card.value;
|
|
2277
1861
|
const ariaLabel = [card.label, card.hint, valueLabel].filter(Boolean).join(" ");
|
|
2278
|
-
return /* @__PURE__ */
|
|
1862
|
+
return /* @__PURE__ */ jsxs3(
|
|
2279
1863
|
"button",
|
|
2280
1864
|
{
|
|
2281
1865
|
type: "button",
|
|
@@ -2295,11 +1879,11 @@ var renderRouteCard = ({
|
|
|
2295
1879
|
),
|
|
2296
1880
|
onClick: () => onSelect(card.id),
|
|
2297
1881
|
children: [
|
|
2298
|
-
isSelected && !card.isUnavailable ? /* @__PURE__ */
|
|
2299
|
-
/* @__PURE__ */
|
|
2300
|
-
/* @__PURE__ */
|
|
2301
|
-
/* @__PURE__ */
|
|
2302
|
-
card.kind === "split" ? /* @__PURE__ */
|
|
1882
|
+
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,
|
|
1883
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-route-card-content relative z-10 flex flex-col gap-3", children: [
|
|
1884
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-route-card-header flex items-center justify-between gap-4", children: [
|
|
1885
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-route-card-meta flex min-w-0 gap-3 items-center", children: [
|
|
1886
|
+
card.kind === "split" ? /* @__PURE__ */ jsx4(
|
|
2303
1887
|
Icon,
|
|
2304
1888
|
{
|
|
2305
1889
|
name: "sparkles-filled",
|
|
@@ -2310,7 +1894,7 @@ var renderRouteCard = ({
|
|
|
2310
1894
|
),
|
|
2311
1895
|
"aria-hidden": "true"
|
|
2312
1896
|
}
|
|
2313
|
-
) : card.venue ? /* @__PURE__ */
|
|
1897
|
+
) : card.venue ? /* @__PURE__ */ jsx4(
|
|
2314
1898
|
VenueLogo,
|
|
2315
1899
|
{
|
|
2316
1900
|
venue: card.venue,
|
|
@@ -2318,10 +1902,10 @@ var renderRouteCard = ({
|
|
|
2318
1902
|
ariaLabel: getTradingVenueLabel(card.venue)
|
|
2319
1903
|
}
|
|
2320
1904
|
) : null,
|
|
2321
|
-
/* @__PURE__ */
|
|
2322
|
-
/* @__PURE__ */
|
|
2323
|
-
/* @__PURE__ */
|
|
2324
|
-
card.kind === "split" && isSelected ? /* @__PURE__ */
|
|
1905
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-1 min-w-0", children: [
|
|
1906
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1.5", children: [
|
|
1907
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-route-card-title truncate text-agg-sm leading-agg-5 text-agg-foreground", children: card.label }),
|
|
1908
|
+
card.kind === "split" && isSelected ? /* @__PURE__ */ jsx4(
|
|
2325
1909
|
Icon,
|
|
2326
1910
|
{
|
|
2327
1911
|
name: showSplitDetails ? "chevron-up" : "chevron-down",
|
|
@@ -2331,10 +1915,10 @@ var renderRouteCard = ({
|
|
|
2331
1915
|
}
|
|
2332
1916
|
) : null
|
|
2333
1917
|
] }),
|
|
2334
|
-
card.hint ? /* @__PURE__ */
|
|
1918
|
+
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
1919
|
] })
|
|
2336
1920
|
] }),
|
|
2337
|
-
/* @__PURE__ */
|
|
1921
|
+
/* @__PURE__ */ jsx4(
|
|
2338
1922
|
"p",
|
|
2339
1923
|
{
|
|
2340
1924
|
className: cn(
|
|
@@ -2346,9 +1930,9 @@ var renderRouteCard = ({
|
|
|
2346
1930
|
}
|
|
2347
1931
|
)
|
|
2348
1932
|
] }),
|
|
2349
|
-
showSplitDetails ? /* @__PURE__ */
|
|
2350
|
-
/* @__PURE__ */
|
|
2351
|
-
/* @__PURE__ */
|
|
1933
|
+
showSplitDetails ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
1934
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-route-card-description text-agg-xs leading-agg-4 text-agg-foreground", children: tradingLabels.splitOrderDescription }),
|
|
1935
|
+
/* @__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
1936
|
] }) : null
|
|
2353
1937
|
] })
|
|
2354
1938
|
]
|
|
@@ -2442,7 +2026,7 @@ var renderSubmissionSurface = ({
|
|
|
2442
2026
|
];
|
|
2443
2027
|
};
|
|
2444
2028
|
const stepGroups = resolveStepGroups();
|
|
2445
|
-
return /* @__PURE__ */
|
|
2029
|
+
return /* @__PURE__ */ jsx4(
|
|
2446
2030
|
Card,
|
|
2447
2031
|
{
|
|
2448
2032
|
className: cn(
|
|
@@ -2451,30 +2035,30 @@ var renderSubmissionSurface = ({
|
|
|
2451
2035
|
classNames == null ? void 0 : classNames.root,
|
|
2452
2036
|
className
|
|
2453
2037
|
),
|
|
2454
|
-
children: /* @__PURE__ */
|
|
2038
|
+
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
2039
|
renderCardHeader({
|
|
2456
2040
|
className: classNames == null ? void 0 : classNames.header,
|
|
2457
2041
|
headerSubtitle,
|
|
2458
2042
|
headerImage,
|
|
2459
2043
|
headerTitle
|
|
2460
2044
|
}),
|
|
2461
|
-
/* @__PURE__ */
|
|
2462
|
-
/* @__PURE__ */
|
|
2463
|
-
/* @__PURE__ */
|
|
2464
|
-
/* @__PURE__ */
|
|
2045
|
+
/* @__PURE__ */ jsxs3("div", { className: cn("agg-order-panel-content flex flex-col gap-6", classNames == null ? void 0 : classNames.content), children: [
|
|
2046
|
+
/* @__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: [
|
|
2047
|
+
/* @__PURE__ */ jsx4(LoadingGlyph, { enableAnimations, className: "h-4 w-4 text-current" }),
|
|
2048
|
+
/* @__PURE__ */ jsx4("span", { children: actionLabel })
|
|
2465
2049
|
] }),
|
|
2466
|
-
/* @__PURE__ */
|
|
2467
|
-
return /* @__PURE__ */
|
|
2050
|
+
/* @__PURE__ */ jsx4("div", { className: "agg-order-submission-steps flex flex-col gap-4", children: stepGroups.map((steps, groupIndex) => {
|
|
2051
|
+
return /* @__PURE__ */ jsx4(
|
|
2468
2052
|
"div",
|
|
2469
2053
|
{
|
|
2470
2054
|
className: "agg-order-submission-group flex flex-col gap-2",
|
|
2471
2055
|
children: steps.map((step) => {
|
|
2472
|
-
return /* @__PURE__ */
|
|
2056
|
+
return /* @__PURE__ */ jsxs3(
|
|
2473
2057
|
"div",
|
|
2474
2058
|
{
|
|
2475
2059
|
className: "agg-order-submission-step flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
2476
2060
|
children: [
|
|
2477
|
-
step.status === "complete" ? /* @__PURE__ */
|
|
2061
|
+
step.status === "complete" ? /* @__PURE__ */ jsx4(
|
|
2478
2062
|
Icon,
|
|
2479
2063
|
{
|
|
2480
2064
|
name: "check-circle",
|
|
@@ -2482,15 +2066,15 @@ var renderSubmissionSurface = ({
|
|
|
2482
2066
|
className: "h-3 w-3 shrink-0 text-agg-primary",
|
|
2483
2067
|
"aria-hidden": "true"
|
|
2484
2068
|
}
|
|
2485
|
-
) : /* @__PURE__ */
|
|
2069
|
+
) : /* @__PURE__ */ jsx4(
|
|
2486
2070
|
LoadingGlyph,
|
|
2487
2071
|
{
|
|
2488
2072
|
enableAnimations,
|
|
2489
2073
|
className: "h-3 w-3 shrink-0 text-agg-primary"
|
|
2490
2074
|
}
|
|
2491
2075
|
),
|
|
2492
|
-
/* @__PURE__ */
|
|
2493
|
-
step.venue ? /* @__PURE__ */
|
|
2076
|
+
/* @__PURE__ */ jsx4("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
2077
|
+
step.venue ? /* @__PURE__ */ jsx4(
|
|
2494
2078
|
VenueLogo,
|
|
2495
2079
|
{
|
|
2496
2080
|
venue: step.venue,
|
|
@@ -2513,7 +2097,7 @@ var renderSubmissionSurface = ({
|
|
|
2513
2097
|
}
|
|
2514
2098
|
);
|
|
2515
2099
|
};
|
|
2516
|
-
var InitiateKycButton = ({ label, onOpen }) => /* @__PURE__ */
|
|
2100
|
+
var InitiateKycButton = ({ label, onOpen }) => /* @__PURE__ */ jsx4(
|
|
2517
2101
|
Button,
|
|
2518
2102
|
{
|
|
2519
2103
|
size: "large",
|
|
@@ -2530,35 +2114,35 @@ var KycVerifyModal = ({
|
|
|
2530
2114
|
isInitiating,
|
|
2531
2115
|
labels
|
|
2532
2116
|
}) => {
|
|
2533
|
-
return /* @__PURE__ */
|
|
2117
|
+
return /* @__PURE__ */ jsx4(
|
|
2534
2118
|
Modal,
|
|
2535
2119
|
{
|
|
2536
2120
|
open,
|
|
2537
2121
|
onOpenChange: (next) => {
|
|
2538
2122
|
onOpenChange(next);
|
|
2539
2123
|
},
|
|
2540
|
-
children: /* @__PURE__ */
|
|
2541
|
-
/* @__PURE__ */
|
|
2542
|
-
/* @__PURE__ */
|
|
2543
|
-
/* @__PURE__ */
|
|
2544
|
-
/* @__PURE__ */
|
|
2124
|
+
children: /* @__PURE__ */ jsxs3(Modal.Container, { maxWidth: "480px", "aria-label": labels.title, children: [
|
|
2125
|
+
/* @__PURE__ */ jsx4(Dialog.Title, { className: "sr-only", children: labels.title }),
|
|
2126
|
+
/* @__PURE__ */ jsx4(Dialog.Description, { className: "sr-only", children: labels.description }),
|
|
2127
|
+
/* @__PURE__ */ jsxs3(Modal.Body, { classNames: { root: "sm:px-10 sm:py-12" }, children: [
|
|
2128
|
+
/* @__PURE__ */ jsx4(
|
|
2545
2129
|
"button",
|
|
2546
2130
|
{
|
|
2547
2131
|
type: "button",
|
|
2548
2132
|
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
2549
2133
|
onClick: () => onOpenChange(false),
|
|
2550
2134
|
"aria-label": "Close",
|
|
2551
|
-
children: /* @__PURE__ */
|
|
2135
|
+
children: /* @__PURE__ */ jsx4(CloseIcon, { className: "h-6 w-6" })
|
|
2552
2136
|
}
|
|
2553
2137
|
),
|
|
2554
|
-
/* @__PURE__ */
|
|
2555
|
-
/* @__PURE__ */
|
|
2556
|
-
/* @__PURE__ */
|
|
2557
|
-
/* @__PURE__ */
|
|
2558
|
-
/* @__PURE__ */
|
|
2138
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center gap-8 text-center", children: [
|
|
2139
|
+
/* @__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]" }) }),
|
|
2140
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center gap-3", children: [
|
|
2141
|
+
/* @__PURE__ */ jsx4("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: labels.title }),
|
|
2142
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-type-body text-agg-foreground", children: labels.description })
|
|
2559
2143
|
] }),
|
|
2560
|
-
/* @__PURE__ */
|
|
2561
|
-
/* @__PURE__ */
|
|
2144
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex w-full flex-col items-center gap-5", children: [
|
|
2145
|
+
/* @__PURE__ */ jsx4(
|
|
2562
2146
|
Button,
|
|
2563
2147
|
{
|
|
2564
2148
|
size: "large",
|
|
@@ -2569,7 +2153,7 @@ var KycVerifyModal = ({
|
|
|
2569
2153
|
children: labels.startVerification
|
|
2570
2154
|
}
|
|
2571
2155
|
),
|
|
2572
|
-
/* @__PURE__ */
|
|
2156
|
+
/* @__PURE__ */ jsx4(
|
|
2573
2157
|
"button",
|
|
2574
2158
|
{
|
|
2575
2159
|
type: "button",
|
|
@@ -2589,27 +2173,27 @@ var KycSuccessModal = ({
|
|
|
2589
2173
|
open,
|
|
2590
2174
|
onOpenChange,
|
|
2591
2175
|
labels
|
|
2592
|
-
}) => /* @__PURE__ */
|
|
2593
|
-
/* @__PURE__ */
|
|
2594
|
-
/* @__PURE__ */
|
|
2595
|
-
/* @__PURE__ */
|
|
2596
|
-
/* @__PURE__ */
|
|
2176
|
+
}) => /* @__PURE__ */ jsx4(Modal, { open, onOpenChange, children: /* @__PURE__ */ jsxs3(Modal.Container, { maxWidth: "480px", "aria-label": labels.title, children: [
|
|
2177
|
+
/* @__PURE__ */ jsx4(Dialog.Title, { className: "sr-only", children: labels.title }),
|
|
2178
|
+
/* @__PURE__ */ jsx4(Dialog.Description, { className: "sr-only", children: labels.description }),
|
|
2179
|
+
/* @__PURE__ */ jsxs3(Modal.Body, { classNames: { root: "px-10 py-12" }, children: [
|
|
2180
|
+
/* @__PURE__ */ jsx4(
|
|
2597
2181
|
"button",
|
|
2598
2182
|
{
|
|
2599
2183
|
type: "button",
|
|
2600
2184
|
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
2601
2185
|
onClick: () => onOpenChange(false),
|
|
2602
2186
|
"aria-label": "Close",
|
|
2603
|
-
children: /* @__PURE__ */
|
|
2187
|
+
children: /* @__PURE__ */ jsx4(CloseIcon, { className: "h-6 w-6" })
|
|
2604
2188
|
}
|
|
2605
2189
|
),
|
|
2606
|
-
/* @__PURE__ */
|
|
2607
|
-
/* @__PURE__ */
|
|
2608
|
-
/* @__PURE__ */
|
|
2609
|
-
/* @__PURE__ */
|
|
2610
|
-
/* @__PURE__ */
|
|
2190
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center gap-8 text-center", children: [
|
|
2191
|
+
/* @__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" }) }),
|
|
2192
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center gap-3", children: [
|
|
2193
|
+
/* @__PURE__ */ jsx4("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: labels.title }),
|
|
2194
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-type-body text-agg-foreground", children: labels.description })
|
|
2611
2195
|
] }),
|
|
2612
|
-
/* @__PURE__ */
|
|
2196
|
+
/* @__PURE__ */ jsx4(
|
|
2613
2197
|
Button,
|
|
2614
2198
|
{
|
|
2615
2199
|
variant: "secondary",
|
|
@@ -2645,18 +2229,18 @@ var PlaceOrder = ({
|
|
|
2645
2229
|
const {
|
|
2646
2230
|
features: { enableAnimations },
|
|
2647
2231
|
general: { locale }
|
|
2648
|
-
} =
|
|
2649
|
-
const labels =
|
|
2232
|
+
} = useSdkUiConfig();
|
|
2233
|
+
const labels = useLabels();
|
|
2650
2234
|
const tradingLabels = labels.trading;
|
|
2651
2235
|
const { isTradingBlocked } = useGeoBlock();
|
|
2652
2236
|
const tradingContext = useEventTradingContext2();
|
|
2653
2237
|
const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
|
|
2654
2238
|
const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
|
|
2655
2239
|
const selectedOutcomeId = (_c = tradingContext == null ? void 0 : tradingContext.selectedOutcomeId) != null ? _c : null;
|
|
2656
|
-
const resolvedEventTradingState =
|
|
2240
|
+
const resolvedEventTradingState = useMemo2(() => {
|
|
2657
2241
|
return eventTradingState != null ? eventTradingState : resolveEventTradingState(selectedEvent);
|
|
2658
2242
|
}, [eventTradingState, selectedEvent]);
|
|
2659
|
-
const scopedSelectedEvent =
|
|
2243
|
+
const scopedSelectedEvent = useMemo2(() => {
|
|
2660
2244
|
var _a2;
|
|
2661
2245
|
if (!selectedEvent) return null;
|
|
2662
2246
|
const primaryMarketId = (_a2 = resolvedEventTradingState.primaryMarket) == null ? void 0 : _a2.id;
|
|
@@ -2666,7 +2250,7 @@ var PlaceOrder = ({
|
|
|
2666
2250
|
);
|
|
2667
2251
|
return isSelectedEventInScope ? selectedEvent : null;
|
|
2668
2252
|
}, [(_d = resolvedEventTradingState.primaryMarket) == null ? void 0 : _d.id, selectedEvent]);
|
|
2669
|
-
const scopedSelectedMarket =
|
|
2253
|
+
const scopedSelectedMarket = useMemo2(() => {
|
|
2670
2254
|
if (!selectedMarket) return resolvedEventTradingState.primaryMarket;
|
|
2671
2255
|
const isSelectedMarketInScope = resolvedEventTradingState.marketStates.some(
|
|
2672
2256
|
(item) => item.market.id === selectedMarket.id
|
|
@@ -2681,10 +2265,10 @@ var PlaceOrder = ({
|
|
|
2681
2265
|
(outcome) => outcome.label.trim().toLowerCase() === "yes"
|
|
2682
2266
|
)) != null ? _f : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes[0]) != null ? _g : null;
|
|
2683
2267
|
const scopedSelectedOutcomeId = (_h = scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.id) != null ? _h : null;
|
|
2684
|
-
const resolvedTradingState =
|
|
2268
|
+
const resolvedTradingState = useMemo2(() => {
|
|
2685
2269
|
return resolveMarketTradingState(scopedSelectedMarket);
|
|
2686
2270
|
}, [scopedSelectedMarket]);
|
|
2687
|
-
const resolvedReadOnlyMarket =
|
|
2271
|
+
const resolvedReadOnlyMarket = useMemo2(() => {
|
|
2688
2272
|
var _a2;
|
|
2689
2273
|
if (resolvedEventTradingState.kind !== "resolved") {
|
|
2690
2274
|
return scopedSelectedMarket;
|
|
@@ -2695,10 +2279,10 @@ var PlaceOrder = ({
|
|
|
2695
2279
|
resolvedEventTradingState.primaryMarket,
|
|
2696
2280
|
scopedSelectedMarket
|
|
2697
2281
|
]);
|
|
2698
|
-
const resolvedReadOnlyTradingState =
|
|
2282
|
+
const resolvedReadOnlyTradingState = useMemo2(() => {
|
|
2699
2283
|
return resolveMarketTradingState(resolvedReadOnlyMarket);
|
|
2700
2284
|
}, [resolvedReadOnlyMarket]);
|
|
2701
|
-
const orderEligibility =
|
|
2285
|
+
const orderEligibility = useMemo2(
|
|
2702
2286
|
() => resolveOrderEligibility({
|
|
2703
2287
|
event: scopedSelectedEvent,
|
|
2704
2288
|
market: scopedSelectedMarket,
|
|
@@ -2716,7 +2300,7 @@ var PlaceOrder = ({
|
|
|
2716
2300
|
const livePrices = useLiveOutcomePrices(
|
|
2717
2301
|
scopedSelectedMarket ? [scopedSelectedMarket] : void 0
|
|
2718
2302
|
);
|
|
2719
|
-
const midpointsClusterMarkets =
|
|
2303
|
+
const midpointsClusterMarkets = useMemo2(() => {
|
|
2720
2304
|
if (!scopedSelectedMarket) return [];
|
|
2721
2305
|
return normalizeVenueMarketCluster(
|
|
2722
2306
|
resolvedEventTradingState.displayMarkets,
|
|
@@ -2724,23 +2308,23 @@ var PlaceOrder = ({
|
|
|
2724
2308
|
);
|
|
2725
2309
|
}, [resolvedEventTradingState.displayMarkets, scopedSelectedMarket]);
|
|
2726
2310
|
const { prices: clusterMidpoints } = useMidpoints(midpointsClusterMarkets);
|
|
2727
|
-
const outcomes =
|
|
2311
|
+
const outcomes = useMemo2(
|
|
2728
2312
|
() => mapVenueMarketOutcomesToPlaceOrderOutcomes(scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes),
|
|
2729
2313
|
[scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes]
|
|
2730
2314
|
);
|
|
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] =
|
|
2315
|
+
const buyTabRef = useRef2(null);
|
|
2316
|
+
const sellTabRef = useRef2(null);
|
|
2317
|
+
const [internalTab, setInternalTab] = useState3("buy");
|
|
2318
|
+
const [internalAmount, setInternalAmount] = useState3(PLACE_ORDER_DEFAULT_AMOUNT);
|
|
2319
|
+
const [sellFilledForOutcomeId, setSellFilledForOutcomeId] = useState3(null);
|
|
2320
|
+
const [internalSlippage, setInternalSlippage] = useState3(DEFAULT_SLIPPAGE_VALUE);
|
|
2321
|
+
const [isRoutesExpanded, setIsRoutesExpanded] = useState3(false);
|
|
2322
|
+
const [selectedRouteCardId, setSelectedRouteCardId] = useState3(null);
|
|
2323
|
+
const [isSplitDetailOpen, setIsSplitDetailOpen] = useState3(false);
|
|
2324
|
+
const [submissionFeedback, setSubmissionFeedback] = useState3(null);
|
|
2325
|
+
const [submissionProgressState, setSubmissionProgressState] = useState3(null);
|
|
2742
2326
|
const debouncedAmount = useDebouncedValue(internalAmount, 300);
|
|
2743
|
-
const isSell =
|
|
2327
|
+
const isSell = useMemo2(() => internalTab === "sell", [internalTab]);
|
|
2744
2328
|
const {
|
|
2745
2329
|
positions: executionPositions,
|
|
2746
2330
|
isLoading: isExecutionPositionsLoading,
|
|
@@ -2761,7 +2345,7 @@ var PlaceOrder = ({
|
|
|
2761
2345
|
tradeSide: isSell ? "sell" : "buy",
|
|
2762
2346
|
enabled: debouncedAmount > 0 && orderEligibility.canPlaceOrder
|
|
2763
2347
|
});
|
|
2764
|
-
const currentSellableShares =
|
|
2348
|
+
const currentSellableShares = useMemo2(() => {
|
|
2765
2349
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
2766
2350
|
const sharesFromQuote = (_b2 = (_a2 = smartRoute.data) == null ? void 0 : _a2.positionAvailability) == null ? void 0 : _b2.totalSellableShares;
|
|
2767
2351
|
if (typeof sharesFromQuote === "number" && Number.isFinite(sharesFromQuote)) {
|
|
@@ -2798,11 +2382,12 @@ var PlaceOrder = ({
|
|
|
2798
2382
|
(_j = (_i = smartRoute.data) == null ? void 0 : _i.positionAvailability) == null ? void 0 : _j.totalSellableShares
|
|
2799
2383
|
]);
|
|
2800
2384
|
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;
|
|
2385
|
+
const displayedCurrentSellableShares = useMemo2(() => {
|
|
2386
|
+
if (!Number.isFinite(currentSellableShares) || currentSellableShares <= 0) return 0;
|
|
2387
|
+
return Math.floor(currentSellableShares * 100) / 100;
|
|
2804
2388
|
}, [currentSellableShares]);
|
|
2805
|
-
|
|
2389
|
+
const isAtMaxSellableShares = isSell && displayedCurrentSellableShares > 0 && Math.abs(internalAmount - displayedCurrentSellableShares) < 1e-9;
|
|
2390
|
+
useEffect2(() => {
|
|
2806
2391
|
if (!isSell || isCurrentSellableSharesLoading) return;
|
|
2807
2392
|
if (scopedSelectedOutcomeId === sellFilledForOutcomeId) return;
|
|
2808
2393
|
setInternalAmount(displayedCurrentSellableShares);
|
|
@@ -2816,7 +2401,7 @@ var PlaceOrder = ({
|
|
|
2816
2401
|
displayedCurrentSellableShares,
|
|
2817
2402
|
onAmountChange
|
|
2818
2403
|
]);
|
|
2819
|
-
const routeCards =
|
|
2404
|
+
const routeCards = useMemo2(
|
|
2820
2405
|
() => smartRoute.data ? buildLiveRouteCards({
|
|
2821
2406
|
eventVenues: scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets.map((market) => market.venue),
|
|
2822
2407
|
labels: tradingLabels,
|
|
@@ -2825,7 +2410,7 @@ var PlaceOrder = ({
|
|
|
2825
2410
|
}) : [],
|
|
2826
2411
|
[smartRoute.data, tradingLabels, isSell, scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets]
|
|
2827
2412
|
);
|
|
2828
|
-
const resolvedSelectedRouteCardId =
|
|
2413
|
+
const resolvedSelectedRouteCardId = useMemo2(() => {
|
|
2829
2414
|
var _a2, _b2, _c2, _d2;
|
|
2830
2415
|
if (routeCards.length === 0) return null;
|
|
2831
2416
|
if (selectedRouteCardId && routeCards.some((card) => card.id === selectedRouteCardId && !card.isUnavailable)) {
|
|
@@ -2833,7 +2418,7 @@ var PlaceOrder = ({
|
|
|
2833
2418
|
}
|
|
2834
2419
|
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
2420
|
}, [routeCards, selectedRouteCardId]);
|
|
2836
|
-
|
|
2421
|
+
useEffect2(() => {
|
|
2837
2422
|
if (routeCards.length === 0) {
|
|
2838
2423
|
setSelectedRouteCardId(null);
|
|
2839
2424
|
setIsRoutesExpanded(false);
|
|
@@ -2844,19 +2429,19 @@ var PlaceOrder = ({
|
|
|
2844
2429
|
setSelectedRouteCardId(resolvedSelectedRouteCardId);
|
|
2845
2430
|
}
|
|
2846
2431
|
}, [resolvedSelectedRouteCardId, routeCards.length, selectedRouteCardId]);
|
|
2847
|
-
|
|
2432
|
+
useEffect2(() => {
|
|
2848
2433
|
setSubmissionFeedback(null);
|
|
2849
2434
|
setSubmissionProgressState(null);
|
|
2850
2435
|
}, [internalAmount, internalSlippage, internalTab, scopedSelectedOutcomeId]);
|
|
2851
2436
|
const orderedRouteCards = routeCards;
|
|
2852
2437
|
const selectedRouteCard = (_n = (_m = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _m : orderedRouteCards[0]) != null ? _n : null;
|
|
2853
|
-
const isKalshiRoute =
|
|
2438
|
+
const isKalshiRoute = useMemo2(() => {
|
|
2854
2439
|
if (selectedRouteCard) {
|
|
2855
2440
|
return selectedRouteCard.venue === "kalshi" || selectedRouteCard.quoteData.fills.some((f) => f.venue === "kalshi");
|
|
2856
2441
|
}
|
|
2857
2442
|
return (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === "kalshi";
|
|
2858
2443
|
}, [selectedRouteCard, scopedSelectedMarket]);
|
|
2859
|
-
const isKalshiVerified =
|
|
2444
|
+
const isKalshiVerified = useMemo2(() => {
|
|
2860
2445
|
var _a2;
|
|
2861
2446
|
const kalshiAccount = (_a2 = user == null ? void 0 : user.venueAccounts) == null ? void 0 : _a2.find((va) => va.venue === "kalshi");
|
|
2862
2447
|
return (kalshiAccount == null ? void 0 : kalshiAccount.kycStatus) === "verified";
|
|
@@ -2876,7 +2461,7 @@ var PlaceOrder = ({
|
|
|
2876
2461
|
walletAddress: (_o = getWalletAddressFromUserProfile(user)) != null ? _o : null,
|
|
2877
2462
|
onError
|
|
2878
2463
|
});
|
|
2879
|
-
const handleRouteCardSelect =
|
|
2464
|
+
const handleRouteCardSelect = useCallback2(
|
|
2880
2465
|
(cardId) => {
|
|
2881
2466
|
if (cardId === resolvedSelectedRouteCardId) {
|
|
2882
2467
|
const card = routeCards.find((c) => c.id === cardId);
|
|
@@ -2897,18 +2482,13 @@ var PlaceOrder = ({
|
|
|
2897
2482
|
const headerImage = (_v = (_u = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.image) != null ? _u : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.image) != null ? _v : null;
|
|
2898
2483
|
const headerTitle = (_x = (_w = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _w : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _x : "";
|
|
2899
2484
|
const headerSubtitle = (_y = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _y : "";
|
|
2900
|
-
const buildExecutionSummary =
|
|
2485
|
+
const buildExecutionSummary = useCallback2(
|
|
2901
2486
|
(quoteData, executionVenue, orderId, partialFillSummary) => {
|
|
2902
2487
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
2903
2488
|
if (!quoteData) return void 0;
|
|
2904
2489
|
const avgPriceValue = quoteData.totalFilled > 0 ? quoteData.rawExecCost / quoteData.totalFilled : 0;
|
|
2905
2490
|
const avgPriceLabel = quoteData.totalFilled > 0 ? getTradingRoutePriceLabel(avgPriceValue) : "\u2014";
|
|
2906
2491
|
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
2492
|
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
2493
|
const sharesLabel = quoteData.totalFilled.toLocaleString("en-US", {
|
|
2914
2494
|
minimumFractionDigits: 2,
|
|
@@ -2931,7 +2511,6 @@ var PlaceOrder = ({
|
|
|
2931
2511
|
eventDateLabel: eventDateSource ? getTradingDateLabel(eventDateSource) : "",
|
|
2932
2512
|
eventImage: headerImage,
|
|
2933
2513
|
actionLabel: actionLabel2,
|
|
2934
|
-
actionTone,
|
|
2935
2514
|
amountLabel,
|
|
2936
2515
|
toWinLabel,
|
|
2937
2516
|
potentialReturnLabel,
|
|
@@ -2962,17 +2541,15 @@ var PlaceOrder = ({
|
|
|
2962
2541
|
executionProgress.submittedOrders,
|
|
2963
2542
|
headerImage,
|
|
2964
2543
|
internalTab,
|
|
2965
|
-
outcomes,
|
|
2966
2544
|
scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate,
|
|
2967
2545
|
scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title,
|
|
2968
2546
|
scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.endDate,
|
|
2969
2547
|
scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question,
|
|
2970
|
-
scopedSelectedOutcomeId,
|
|
2971
2548
|
selectedOutcomeLabel,
|
|
2972
2549
|
tradingLabels
|
|
2973
2550
|
]
|
|
2974
2551
|
);
|
|
2975
|
-
|
|
2552
|
+
useEffect2(() => {
|
|
2976
2553
|
if (executionProgress.phase === "order_submitted") {
|
|
2977
2554
|
const submittedOrder = executionProgress.submittedOrders[0];
|
|
2978
2555
|
setSubmissionProgressState((prev) => {
|
|
@@ -3004,7 +2581,7 @@ var PlaceOrder = ({
|
|
|
3004
2581
|
executionProgress.submittedOrders,
|
|
3005
2582
|
selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData
|
|
3006
2583
|
]);
|
|
3007
|
-
|
|
2584
|
+
useEffect2(() => {
|
|
3008
2585
|
const dp = executionProgress.dagProgress;
|
|
3009
2586
|
if (!dp) return;
|
|
3010
2587
|
setSubmissionProgressState((prev) => {
|
|
@@ -3023,7 +2600,7 @@ var PlaceOrder = ({
|
|
|
3023
2600
|
return __spreadProps(__spreadValues({}, prev), { dagProgress: dp });
|
|
3024
2601
|
});
|
|
3025
2602
|
}, [executionProgress.dagProgress, tradingLabels.orderFailed]);
|
|
3026
|
-
|
|
2603
|
+
useEffect2(() => {
|
|
3027
2604
|
const orderIds = submissionProgressState == null ? void 0 : submissionProgressState.orderIds;
|
|
3028
2605
|
if (!(orderIds == null ? void 0 : orderIds.length)) return;
|
|
3029
2606
|
const aggregateStatus = deriveAggregateOrderStatus(
|
|
@@ -3071,7 +2648,7 @@ var PlaceOrder = ({
|
|
|
3071
2648
|
submissionProgressState == null ? void 0 : submissionProgressState.orderIds,
|
|
3072
2649
|
tradingLabels.orderFailed
|
|
3073
2650
|
]);
|
|
3074
|
-
|
|
2651
|
+
useEffect2(() => {
|
|
3075
2652
|
if (!submissionProgressState) return;
|
|
3076
2653
|
onExecutionStateChange == null ? void 0 : onExecutionStateChange(submissionProgressState);
|
|
3077
2654
|
if (submissionProgressState.phase === "success" && submissionProgressState.summary) {
|
|
@@ -3086,10 +2663,9 @@ var PlaceOrder = ({
|
|
|
3086
2663
|
const activeQuoteData = (_A = (_z = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _z : smartRoute.data) != null ? _A : null;
|
|
3087
2664
|
const visibleRouteCards = orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT && !isRoutesExpanded ? orderedRouteCards.slice(0, PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT) : orderedRouteCards;
|
|
3088
2665
|
const hasEnteredAmount = internalAmount > 0;
|
|
3089
|
-
const shouldPromptSignIn = orderEligibility.canPlaceOrder && !isAuthenticated && hasEnteredAmount;
|
|
3090
2666
|
const isInsufficientBalance = !isSell && isAuthenticated && hasEnteredAmount && !isBalanceLoading && internalAmount > totalBalance;
|
|
3091
2667
|
const isBelowMinimum = !isSell && hasEnteredAmount && internalAmount < MIN_BUY_ORDER_AMOUNT;
|
|
3092
|
-
const quoteStatus =
|
|
2668
|
+
const quoteStatus = useMemo2(() => {
|
|
3093
2669
|
if (!orderEligibility.canPlaceOrder) return void 0;
|
|
3094
2670
|
return resolvePlaceOrderQuoteStatus({
|
|
3095
2671
|
amount: internalAmount,
|
|
@@ -3104,7 +2680,7 @@ var PlaceOrder = ({
|
|
|
3104
2680
|
scopedSelectedMarket,
|
|
3105
2681
|
tradingLabels
|
|
3106
2682
|
]);
|
|
3107
|
-
const smartRouteErrorMessage =
|
|
2683
|
+
const smartRouteErrorMessage = useMemo2(() => {
|
|
3108
2684
|
if (!smartRoute.error) return null;
|
|
3109
2685
|
return normalizePlaceOrderErrorMessage({
|
|
3110
2686
|
errorMessage: smartRoute.error.message,
|
|
@@ -3112,7 +2688,7 @@ var PlaceOrder = ({
|
|
|
3112
2688
|
});
|
|
3113
2689
|
}, [smartRoute.error, tradingLabels.quoteUnavailable]);
|
|
3114
2690
|
const progressActionLabel = (internalTab === "buy" ? tradingLabels.buyingOutcome(selectedOutcomeLabel) : tradingLabels.sellingOutcome(selectedOutcomeLabel)).trim();
|
|
3115
|
-
const canRetryRemaining =
|
|
2691
|
+
const canRetryRemaining = useMemo2(() => {
|
|
3116
2692
|
const remaining = getPlaceOrderUnfilledRemaining({
|
|
3117
2693
|
originalAmount: internalAmount,
|
|
3118
2694
|
terminalOrderEvents: executionProgress.terminalOrderEvents
|
|
@@ -3121,7 +2697,7 @@ var PlaceOrder = ({
|
|
|
3121
2697
|
return remaining >= minRemainder;
|
|
3122
2698
|
}, [executionProgress.terminalOrderEvents, internalAmount, isSell]);
|
|
3123
2699
|
const PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD = 0.95;
|
|
3124
|
-
const shouldAutoSkipPartialFill =
|
|
2700
|
+
const shouldAutoSkipPartialFill = useMemo2(() => {
|
|
3125
2701
|
if (internalAmount <= 0) return false;
|
|
3126
2702
|
const remaining = getPlaceOrderUnfilledRemaining({
|
|
3127
2703
|
originalAmount: internalAmount,
|
|
@@ -3131,7 +2707,7 @@ var PlaceOrder = ({
|
|
|
3131
2707
|
const fillRatio = filled / internalAmount;
|
|
3132
2708
|
return fillRatio >= PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD || !canRetryRemaining;
|
|
3133
2709
|
}, [canRetryRemaining, executionProgress.terminalOrderEvents, internalAmount]);
|
|
3134
|
-
const failureSummary =
|
|
2710
|
+
const failureSummary = useMemo2(() => {
|
|
3135
2711
|
var _a2;
|
|
3136
2712
|
if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return void 0;
|
|
3137
2713
|
return buildPlaceOrderFailureSummary({
|
|
@@ -3164,14 +2740,14 @@ var PlaceOrder = ({
|
|
|
3164
2740
|
const displayedToWinValue = (_C = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _C : 0;
|
|
3165
2741
|
const isActionLoading = isPrimaryActionLoading || executeManaged.isPending;
|
|
3166
2742
|
const selectedRouteGeoBlocked = (_D = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _D : false;
|
|
3167
|
-
const geoBlockedVenuesFromWarnings =
|
|
2743
|
+
const geoBlockedVenuesFromWarnings = useMemo2(
|
|
3168
2744
|
() => {
|
|
3169
2745
|
var _a2;
|
|
3170
2746
|
return extractGeoBlockedVenues((_a2 = smartRoute.data) == null ? void 0 : _a2.warnings);
|
|
3171
2747
|
},
|
|
3172
2748
|
[(_E = smartRoute.data) == null ? void 0 : _E.warnings]
|
|
3173
2749
|
);
|
|
3174
|
-
const isPrimaryVenueGeoBlocked =
|
|
2750
|
+
const isPrimaryVenueGeoBlocked = useMemo2(() => {
|
|
3175
2751
|
var _a2, _b2;
|
|
3176
2752
|
if (!selectedRouteCard || selectedRouteCard.isUnavailable) return false;
|
|
3177
2753
|
const fills = (_b2 = (_a2 = selectedRouteCard.quoteData) == null ? void 0 : _a2.fills) != null ? _b2 : [];
|
|
@@ -3183,7 +2759,7 @@ var PlaceOrder = ({
|
|
|
3183
2759
|
const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isBelowMinimum || !selectedRouteCard || !selectedRouteCard.quoteData.quoteId || selectedRouteGeoBlocked || !isAuthenticated || quoteStatus !== void 0;
|
|
3184
2760
|
const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && (orderedRouteCards.length > 0 || smartRoute.isFetching);
|
|
3185
2761
|
const shouldShowRouteToggle = orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
|
|
3186
|
-
const handleStartNewTrade =
|
|
2762
|
+
const handleStartNewTrade = useCallback2(() => {
|
|
3187
2763
|
setSubmissionProgressState(null);
|
|
3188
2764
|
setSubmissionFeedback(null);
|
|
3189
2765
|
setInternalAmount(0);
|
|
@@ -3206,7 +2782,7 @@ var PlaceOrder = ({
|
|
|
3206
2782
|
const shareUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(shareText)}`;
|
|
3207
2783
|
window.open(shareUrl, "_blank", "noopener,noreferrer");
|
|
3208
2784
|
};
|
|
3209
|
-
const handleExecuteQuote =
|
|
2785
|
+
const handleExecuteQuote = useCallback2(
|
|
3210
2786
|
(quoteData) => __async(null, null, function* () {
|
|
3211
2787
|
const quoteId = quoteData == null ? void 0 : quoteData.quoteId;
|
|
3212
2788
|
if (!quoteId) {
|
|
@@ -3226,7 +2802,7 @@ var PlaceOrder = ({
|
|
|
3226
2802
|
}),
|
|
3227
2803
|
[executeManaged, onPrimaryAction, tradingLabels.quoteUnavailable]
|
|
3228
2804
|
);
|
|
3229
|
-
const handleSkipToSuccess =
|
|
2805
|
+
const handleSkipToSuccess = useCallback2(() => {
|
|
3230
2806
|
const primaryFilledEvent = executionProgress.terminalOrderEvents.find(
|
|
3231
2807
|
(e) => e.event === "filled" || e.event === "partial_fill"
|
|
3232
2808
|
);
|
|
@@ -3251,7 +2827,7 @@ var PlaceOrder = ({
|
|
|
3251
2827
|
failureSummary,
|
|
3252
2828
|
selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData
|
|
3253
2829
|
]);
|
|
3254
|
-
|
|
2830
|
+
useEffect2(() => {
|
|
3255
2831
|
if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return;
|
|
3256
2832
|
if ((failureSummary == null ? void 0 : failureSummary.kind) !== "partial_fill") return;
|
|
3257
2833
|
if (!shouldAutoSkipPartialFill) return;
|
|
@@ -3262,7 +2838,7 @@ var PlaceOrder = ({
|
|
|
3262
2838
|
shouldAutoSkipPartialFill,
|
|
3263
2839
|
submissionProgressState == null ? void 0 : submissionProgressState.phase
|
|
3264
2840
|
]);
|
|
3265
|
-
const handleRetrySubmission =
|
|
2841
|
+
const handleRetrySubmission = useCallback2(() => __async(null, null, function* () {
|
|
3266
2842
|
var _a2, _b2, _c2;
|
|
3267
2843
|
if (!orderEligibility.canPlaceOrder) {
|
|
3268
2844
|
handleStartNewTrade();
|
|
@@ -3349,7 +2925,7 @@ var PlaceOrder = ({
|
|
|
3349
2925
|
]);
|
|
3350
2926
|
const resolvedStatusClassName = cn(classNames == null ? void 0 : classNames.root, className);
|
|
3351
2927
|
if (isLoading) {
|
|
3352
|
-
return /* @__PURE__ */
|
|
2928
|
+
return /* @__PURE__ */ jsx4(
|
|
3353
2929
|
Skeleton,
|
|
3354
2930
|
{
|
|
3355
2931
|
ariaLabel: labels.common.loading,
|
|
@@ -3360,7 +2936,7 @@ var PlaceOrder = ({
|
|
|
3360
2936
|
}
|
|
3361
2937
|
if (submissionProgressState) {
|
|
3362
2938
|
if (submissionProgressState.phase === "success" && submissionProgressState.summary) {
|
|
3363
|
-
return /* @__PURE__ */
|
|
2939
|
+
return /* @__PURE__ */ jsx4(
|
|
3364
2940
|
PlaceOrderSuccessView,
|
|
3365
2941
|
{
|
|
3366
2942
|
className: resolvedStatusClassName,
|
|
@@ -3372,7 +2948,7 @@ var PlaceOrder = ({
|
|
|
3372
2948
|
);
|
|
3373
2949
|
}
|
|
3374
2950
|
if (submissionProgressState.phase === "failed") {
|
|
3375
|
-
return /* @__PURE__ */
|
|
2951
|
+
return /* @__PURE__ */ jsx4(
|
|
3376
2952
|
PlaceOrderFailureView,
|
|
3377
2953
|
{
|
|
3378
2954
|
className: resolvedStatusClassName,
|
|
@@ -3429,10 +3005,6 @@ var PlaceOrder = ({
|
|
|
3429
3005
|
if (displayedCurrentSellableShares <= 0) return;
|
|
3430
3006
|
handleAmountChange(displayedCurrentSellableShares);
|
|
3431
3007
|
};
|
|
3432
|
-
const handleSignInRequiredClick = () => {
|
|
3433
|
-
if (!shouldPromptSignIn) return;
|
|
3434
|
-
requestAggAuthChooserOpen();
|
|
3435
|
-
};
|
|
3436
3008
|
const handleDepositRequiredClick = () => {
|
|
3437
3009
|
if (!isInsufficientBalance) return;
|
|
3438
3010
|
requestAggDepositModalOpen();
|
|
@@ -3474,7 +3046,7 @@ var PlaceOrder = ({
|
|
|
3474
3046
|
}
|
|
3475
3047
|
});
|
|
3476
3048
|
if (!orderEligibility.canPlaceOrder && resolvedReadOnlyTradingState.kind !== "open") {
|
|
3477
|
-
return /* @__PURE__ */
|
|
3049
|
+
return /* @__PURE__ */ jsx4(
|
|
3478
3050
|
PlaceOrderResolvedView,
|
|
3479
3051
|
{
|
|
3480
3052
|
tradingState: resolvedReadOnlyTradingState,
|
|
@@ -3484,17 +3056,17 @@ var PlaceOrder = ({
|
|
|
3484
3056
|
}
|
|
3485
3057
|
);
|
|
3486
3058
|
}
|
|
3487
|
-
return /* @__PURE__ */
|
|
3488
|
-
/* @__PURE__ */
|
|
3059
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
3060
|
+
/* @__PURE__ */ jsxs3(
|
|
3489
3061
|
Card,
|
|
3490
3062
|
{
|
|
3491
3063
|
className: cn(
|
|
3492
|
-
"group/agg-order-panel",
|
|
3064
|
+
"group/agg-order-panel gap-6 p-5",
|
|
3493
3065
|
getPlaceOrderContainerClassName(),
|
|
3494
3066
|
classNames == null ? void 0 : classNames.root,
|
|
3495
3067
|
className
|
|
3496
3068
|
),
|
|
3497
|
-
children:
|
|
3069
|
+
children: [
|
|
3498
3070
|
renderCardHeader({
|
|
3499
3071
|
className: classNames == null ? void 0 : classNames.header,
|
|
3500
3072
|
headerSubtitle,
|
|
@@ -3502,8 +3074,8 @@ var PlaceOrder = ({
|
|
|
3502
3074
|
headerTitle,
|
|
3503
3075
|
onClose
|
|
3504
3076
|
}),
|
|
3505
|
-
/* @__PURE__ */
|
|
3506
|
-
/* @__PURE__ */
|
|
3077
|
+
/* @__PURE__ */ jsxs3("div", { className: cn("agg-order-panel-content flex flex-col gap-6", classNames == null ? void 0 : classNames.content), children: [
|
|
3078
|
+
/* @__PURE__ */ jsx4(
|
|
3507
3079
|
"div",
|
|
3508
3080
|
{
|
|
3509
3081
|
className: "agg-order-tabs flex items-end border-b border-agg-separator",
|
|
@@ -3514,7 +3086,7 @@ var PlaceOrder = ({
|
|
|
3514
3086
|
{ value: "sell", label: tradingLabels.sell, ref: sellTabRef }
|
|
3515
3087
|
].map((tabItem) => {
|
|
3516
3088
|
const isActive = internalTab === tabItem.value;
|
|
3517
|
-
return /* @__PURE__ */
|
|
3089
|
+
return /* @__PURE__ */ jsxs3(
|
|
3518
3090
|
"button",
|
|
3519
3091
|
{
|
|
3520
3092
|
ref: tabItem.ref,
|
|
@@ -3538,7 +3110,7 @@ var PlaceOrder = ({
|
|
|
3538
3110
|
onKeyDown: (event) => handleTabKeyDown(event, tabItem.value),
|
|
3539
3111
|
children: [
|
|
3540
3112
|
tabItem.label,
|
|
3541
|
-
/* @__PURE__ */
|
|
3113
|
+
/* @__PURE__ */ jsx4(
|
|
3542
3114
|
"span",
|
|
3543
3115
|
{
|
|
3544
3116
|
"aria-hidden": "true",
|
|
@@ -3560,13 +3132,13 @@ var PlaceOrder = ({
|
|
|
3560
3132
|
})
|
|
3561
3133
|
}
|
|
3562
3134
|
),
|
|
3563
|
-
outcomes.length >= 2 ? /* @__PURE__ */
|
|
3135
|
+
outcomes.length >= 2 ? /* @__PURE__ */ jsx4("div", { className: "agg-outcomes flex w-full max-w-full gap-2", children: outcomes.map((outcome, index) => {
|
|
3564
3136
|
var _a2, _b2, _c2;
|
|
3565
3137
|
const price = (_b2 = (_a2 = clusterMidpoints.get(outcome.id)) != null ? _a2 : livePrices.get(outcome.id)) != null ? _b2 : outcome.price;
|
|
3566
3138
|
const isActive = outcome.id === scopedSelectedOutcomeId;
|
|
3567
3139
|
const isPositive = resolveIsPositiveOutcome(outcome, index);
|
|
3568
3140
|
const displayLabel = ((_c2 = outcome.title) == null ? void 0 : _c2.trim()) || outcome.label;
|
|
3569
|
-
return /* @__PURE__ */
|
|
3141
|
+
return /* @__PURE__ */ jsxs3(
|
|
3570
3142
|
"button",
|
|
3571
3143
|
{
|
|
3572
3144
|
"data-id": outcome.id,
|
|
@@ -3586,7 +3158,7 @@ var PlaceOrder = ({
|
|
|
3586
3158
|
disabled: !orderEligibility.canPlaceOrder || isResolvedOutcomeCtaLocked,
|
|
3587
3159
|
onClick: () => handleOutcomeChange(outcome.id),
|
|
3588
3160
|
children: [
|
|
3589
|
-
/* @__PURE__ */
|
|
3161
|
+
/* @__PURE__ */ jsx4(
|
|
3590
3162
|
Typography,
|
|
3591
3163
|
{
|
|
3592
3164
|
as: "span",
|
|
@@ -3595,33 +3167,36 @@ var PlaceOrder = ({
|
|
|
3595
3167
|
children: displayLabel
|
|
3596
3168
|
}
|
|
3597
3169
|
),
|
|
3598
|
-
/* @__PURE__ */
|
|
3170
|
+
/* @__PURE__ */ jsx4(Typography, { as: "span", variant: isActive ? "body-strong" : "body", children: formatProbabilityCents(price) })
|
|
3599
3171
|
]
|
|
3600
3172
|
},
|
|
3601
3173
|
outcome.id
|
|
3602
3174
|
);
|
|
3603
3175
|
}) }) : 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
|
-
|
|
3176
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-order-amount-section flex items-start justify-between gap-4", children: [
|
|
3177
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-order-amount-meta flex flex-col", children: [
|
|
3178
|
+
/* @__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) }),
|
|
3179
|
+
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: [
|
|
3180
|
+
/* @__PURE__ */ jsx4("span", { children: tradingLabels.shares(displayedCurrentSellableShares) }),
|
|
3181
|
+
displayedCurrentSellableShares > 0 ? /* @__PURE__ */ jsx4(
|
|
3182
|
+
"button",
|
|
3183
|
+
{
|
|
3184
|
+
type: "button",
|
|
3185
|
+
className: cn(
|
|
3186
|
+
"agg-max-shares-button",
|
|
3187
|
+
"cursor-pointer disabled:cursor-not-allowed",
|
|
3188
|
+
"bg-transparent p-0 text-agg-sm font-agg-bold leading-agg-5 text-agg-primary disabled:text-agg-muted-foreground",
|
|
3189
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
|
|
3190
|
+
),
|
|
3191
|
+
"aria-label": tradingLabels.maxShares,
|
|
3192
|
+
disabled: !orderEligibility.canPlaceOrder || isAtMaxSellableShares,
|
|
3193
|
+
onClick: handleFillSellableShares,
|
|
3194
|
+
children: tradingLabels.maxShares
|
|
3195
|
+
}
|
|
3196
|
+
) : null
|
|
3197
|
+
] }) }) : /* @__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
3198
|
] }),
|
|
3624
|
-
/* @__PURE__ */
|
|
3199
|
+
/* @__PURE__ */ jsx4(
|
|
3625
3200
|
CurrencyInput,
|
|
3626
3201
|
{
|
|
3627
3202
|
value: internalAmount,
|
|
@@ -3641,22 +3216,22 @@ var PlaceOrder = ({
|
|
|
3641
3216
|
}
|
|
3642
3217
|
)
|
|
3643
3218
|
] }),
|
|
3644
|
-
shouldShowSmartRouting ? /* @__PURE__ */
|
|
3645
|
-
/* @__PURE__ */
|
|
3646
|
-
/* @__PURE__ */
|
|
3647
|
-
shouldShowRouteToggle ? /* @__PURE__ */
|
|
3219
|
+
shouldShowSmartRouting ? /* @__PURE__ */ jsxs3("div", { className: "agg-route-panel flex flex-col gap-3", children: [
|
|
3220
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-route-panel-header flex items-center justify-between gap-4", children: [
|
|
3221
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-route-panel-title text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.smartRouting }),
|
|
3222
|
+
shouldShowRouteToggle && !isRoutesExpanded ? /* @__PURE__ */ jsxs3(
|
|
3648
3223
|
"button",
|
|
3649
3224
|
{
|
|
3650
3225
|
type: "button",
|
|
3651
3226
|
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":
|
|
3227
|
+
"aria-label": tradingLabels.viewAllRoutes(orderedRouteCards.length),
|
|
3653
3228
|
onClick: () => setIsRoutesExpanded((currentValue) => !currentValue),
|
|
3654
3229
|
children: [
|
|
3655
|
-
/* @__PURE__ */
|
|
3656
|
-
/* @__PURE__ */
|
|
3230
|
+
/* @__PURE__ */ jsx4("span", { children: tradingLabels.viewAllRoutes(orderedRouteCards.length) }),
|
|
3231
|
+
/* @__PURE__ */ jsx4(
|
|
3657
3232
|
Icon,
|
|
3658
3233
|
{
|
|
3659
|
-
name:
|
|
3234
|
+
name: "chevron-down",
|
|
3660
3235
|
size: "small",
|
|
3661
3236
|
className: "h-4 w-4 text-agg-foreground",
|
|
3662
3237
|
"aria-hidden": "true"
|
|
@@ -3666,26 +3241,26 @@ var PlaceOrder = ({
|
|
|
3666
3241
|
}
|
|
3667
3242
|
) : null
|
|
3668
3243
|
] }),
|
|
3669
|
-
/* @__PURE__ */
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
}),
|
|
3680
|
-
|
|
3681
|
-
] })
|
|
3244
|
+
/* @__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) => {
|
|
3245
|
+
return /* @__PURE__ */ jsx4(Fragment, { children: renderRouteCard({
|
|
3246
|
+
card,
|
|
3247
|
+
enableAnimations,
|
|
3248
|
+
isExpanded: card.kind === "split" ? isSplitDetailOpen : isRoutesExpanded,
|
|
3249
|
+
isSelected: !card.isUnavailable && card.id === resolvedSelectedRouteCardId,
|
|
3250
|
+
onSelect: handleRouteCardSelect,
|
|
3251
|
+
tradingLabels
|
|
3252
|
+
}) }, card.id);
|
|
3253
|
+
}) : smartRoute.isFetching ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
3254
|
+
/* @__PURE__ */ jsx4(PlaceOrderRouteCardSkeleton, {}),
|
|
3255
|
+
/* @__PURE__ */ jsx4(PlaceOrderRouteCardSkeleton, {})
|
|
3256
|
+
] }) : null })
|
|
3682
3257
|
] }) : null,
|
|
3683
|
-
hasEnteredAmount && selectedRouteCard && orderEligibility.canPlaceOrder ? /* @__PURE__ */
|
|
3684
|
-
/* @__PURE__ */
|
|
3685
|
-
/* @__PURE__ */
|
|
3686
|
-
/* @__PURE__ */
|
|
3258
|
+
hasEnteredAmount && selectedRouteCard && orderEligibility.canPlaceOrder ? /* @__PURE__ */ jsxs3("div", { className: "agg-order-summary flex items-start justify-between gap-4", children: [
|
|
3259
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-order-summary-meta flex flex-col", children: [
|
|
3260
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-order-summary-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.toWin(internalTab) }),
|
|
3261
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-order-summary-hint text-agg-sm leading-agg-5 text-agg-muted-foreground", children: displayedToWinHint })
|
|
3687
3262
|
] }),
|
|
3688
|
-
/* @__PURE__ */
|
|
3263
|
+
/* @__PURE__ */ jsx4(
|
|
3689
3264
|
NumberFlow,
|
|
3690
3265
|
{
|
|
3691
3266
|
value: displayedToWinValue,
|
|
@@ -3700,7 +3275,7 @@ var PlaceOrder = ({
|
|
|
3700
3275
|
}
|
|
3701
3276
|
)
|
|
3702
3277
|
] }) : null,
|
|
3703
|
-
/* @__PURE__ */
|
|
3278
|
+
/* @__PURE__ */ jsxs3(
|
|
3704
3279
|
"div",
|
|
3705
3280
|
{
|
|
3706
3281
|
className: cn(
|
|
@@ -3708,54 +3283,23 @@ var PlaceOrder = ({
|
|
|
3708
3283
|
classNames == null ? void 0 : classNames.footer
|
|
3709
3284
|
),
|
|
3710
3285
|
children: [
|
|
3711
|
-
!shouldShowGeoBlockBanner ? /* @__PURE__ */
|
|
3712
|
-
submissionFeedback ? /* @__PURE__ */
|
|
3286
|
+
!shouldShowGeoBlockBanner ? /* @__PURE__ */ jsxs3("div", { className: "agg-order-alerts flex flex-col gap-3 empty:hidden mb-3", children: [
|
|
3287
|
+
submissionFeedback ? /* @__PURE__ */ jsx4(
|
|
3713
3288
|
InlineAlert,
|
|
3714
3289
|
{
|
|
3715
3290
|
tone: submissionFeedback.tone,
|
|
3716
3291
|
message: submissionFeedback.message
|
|
3717
3292
|
}
|
|
3718
3293
|
) : 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(
|
|
3294
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && isBelowMinimum ? /* @__PURE__ */ jsx4(
|
|
3751
3295
|
InlineAlert,
|
|
3752
3296
|
{
|
|
3753
3297
|
tone: "error",
|
|
3754
3298
|
message: tradingLabels.minimumOrderAmount(MIN_BUY_ORDER_AMOUNT)
|
|
3755
3299
|
}
|
|
3756
3300
|
) : null,
|
|
3757
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && quoteStatus ? /* @__PURE__ */
|
|
3758
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && !quoteStatus && isAuthenticated && hasEnteredAmount && smartRouteErrorMessage ? /* @__PURE__ */
|
|
3301
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && quoteStatus ? /* @__PURE__ */ jsx4(InlineAlert, { tone: quoteStatus.tone, message: quoteStatus.message }) : null,
|
|
3302
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && !quoteStatus && isAuthenticated && hasEnteredAmount && smartRouteErrorMessage ? /* @__PURE__ */ jsx4(
|
|
3759
3303
|
InlineAlert,
|
|
3760
3304
|
{
|
|
3761
3305
|
tone: "error",
|
|
@@ -3765,40 +3309,50 @@ var PlaceOrder = ({
|
|
|
3765
3309
|
void smartRoute.refetch();
|
|
3766
3310
|
}
|
|
3767
3311
|
}
|
|
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
3312
|
) : null
|
|
3800
3313
|
] }) : null,
|
|
3801
|
-
|
|
3314
|
+
!submissionFeedback && !shouldShowGeoBlockBanner && orderEligibility.canPlaceOrder && isInsufficientBalance ? /* @__PURE__ */ jsxs3(
|
|
3315
|
+
"div",
|
|
3316
|
+
{
|
|
3317
|
+
className: "agg-order-insufficient-balance-alert flex items-center justify-center gap-2",
|
|
3318
|
+
role: "status",
|
|
3319
|
+
"aria-live": "polite",
|
|
3320
|
+
children: [
|
|
3321
|
+
/* @__PURE__ */ jsx4(
|
|
3322
|
+
Icon,
|
|
3323
|
+
{
|
|
3324
|
+
name: "warning-filled",
|
|
3325
|
+
size: "small",
|
|
3326
|
+
className: "h-4 w-4 shrink-0 text-agg-warning",
|
|
3327
|
+
"aria-hidden": "true"
|
|
3328
|
+
}
|
|
3329
|
+
),
|
|
3330
|
+
/* @__PURE__ */ jsx4("span", { className: "text-agg-sm text-agg-foreground", children: tradingLabels.insufficientBalance })
|
|
3331
|
+
]
|
|
3332
|
+
}
|
|
3333
|
+
) : null,
|
|
3334
|
+
!submissionFeedback && !shouldShowGeoBlockBanner && isInsufficientBalance ? /* @__PURE__ */ jsx4(
|
|
3335
|
+
Button,
|
|
3336
|
+
{
|
|
3337
|
+
size: "large",
|
|
3338
|
+
variant: "primary",
|
|
3339
|
+
className: "agg-order-submit h-12 w-full px-8 text-agg-base leading-agg-6 shadow-none",
|
|
3340
|
+
"aria-label": tradingLabels.deposit,
|
|
3341
|
+
onClick: handleDepositRequiredClick,
|
|
3342
|
+
children: tradingLabels.deposit
|
|
3343
|
+
}
|
|
3344
|
+
) : needsKycVerification && !submissionFeedback && !shouldShowGeoBlockBanner ? /* @__PURE__ */ jsx4(InitiateKycButton, { label: tradingLabels.kycRequired, onOpen: openVerifyModal }) : !isAuthenticated ? /* @__PURE__ */ jsx4(
|
|
3345
|
+
Button,
|
|
3346
|
+
{
|
|
3347
|
+
size: "large",
|
|
3348
|
+
variant: "primary",
|
|
3349
|
+
className: "agg-order-submit h-12 w-full px-8 text-agg-base leading-agg-6 shadow-none",
|
|
3350
|
+
disabled: !orderEligibility.canPlaceOrder || shouldShowGeoBlockBanner,
|
|
3351
|
+
"aria-label": tradingLabels.signInToTrade,
|
|
3352
|
+
onClick: requestAggAuthChooserOpen,
|
|
3353
|
+
children: tradingLabels.signInToTrade
|
|
3354
|
+
}
|
|
3355
|
+
) : /* @__PURE__ */ jsx4(
|
|
3802
3356
|
Button,
|
|
3803
3357
|
{
|
|
3804
3358
|
size: "large",
|
|
@@ -3813,16 +3367,16 @@ var PlaceOrder = ({
|
|
|
3813
3367
|
children: actionLabel
|
|
3814
3368
|
}
|
|
3815
3369
|
),
|
|
3816
|
-
shouldShowGeoBlockBanner ? /* @__PURE__ */
|
|
3817
|
-
!shouldShowGeoBlockBanner ? /* @__PURE__ */
|
|
3370
|
+
shouldShowGeoBlockBanner ? /* @__PURE__ */ jsx4(GeoBlockBanner, { venue: geoBlockVenueLabel, termsUrl: AGG_TERMS_OF_SERVICE_URL }) : null,
|
|
3371
|
+
!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
3372
|
]
|
|
3819
3373
|
}
|
|
3820
3374
|
)
|
|
3821
3375
|
] })
|
|
3822
|
-
]
|
|
3376
|
+
]
|
|
3823
3377
|
}
|
|
3824
3378
|
),
|
|
3825
|
-
/* @__PURE__ */
|
|
3379
|
+
/* @__PURE__ */ jsx4(
|
|
3826
3380
|
KycVerifyModal,
|
|
3827
3381
|
{
|
|
3828
3382
|
open: isKycVerifyModalOpen,
|
|
@@ -3839,7 +3393,7 @@ var PlaceOrder = ({
|
|
|
3839
3393
|
}
|
|
3840
3394
|
}
|
|
3841
3395
|
),
|
|
3842
|
-
/* @__PURE__ */
|
|
3396
|
+
/* @__PURE__ */ jsx4(
|
|
3843
3397
|
KycSuccessModal,
|
|
3844
3398
|
{
|
|
3845
3399
|
open: showKycSuccessModal,
|
|
@@ -3860,19 +3414,6 @@ PlaceOrder.displayName = "PlaceOrder";
|
|
|
3860
3414
|
export {
|
|
3861
3415
|
parseVenue,
|
|
3862
3416
|
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
3417
|
SettlementDetails,
|
|
3877
3418
|
DEPOSIT_MODAL_OPEN_EVENT,
|
|
3878
3419
|
WITHDRAW_MODAL_OPEN_EVENT,
|