@agg-build/ui 1.0.0 → 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-75IGOQ4N.mjs → chunk-3IY2GA2D.mjs} +69 -45
- package/dist/{chunk-I2WBGEWK.mjs → chunk-4ILR2YH3.mjs} +319 -344
- package/dist/{chunk-C7T56TJR.mjs → chunk-PEVG67XU.mjs} +369 -19
- package/dist/{chunk-6NS7D73S.mjs → chunk-TLGQ4LID.mjs} +1556 -1204
- package/dist/{chunk-DMKKNK76.mjs → chunk-WFS772A3.mjs} +800 -592
- package/dist/{chunk-CGNDMLQL.mjs → chunk-XDZLCWUZ.mjs} +511 -899
- package/dist/{chunk-2QJXRRYP.mjs → chunk-YSCHNVBZ.mjs} +3 -2
- package/dist/events.js +2081 -1673
- package/dist/events.mjs +3 -3
- package/dist/index.js +4890 -4318
- package/dist/index.mjs +195 -118
- package/dist/modals.js +1568 -1242
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +3007 -2904
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +1507 -1207
- package/dist/primitives.mjs +13 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +3920 -3734
- package/dist/trading.mjs +10 -12
- package/dist/types/deposit/steps/card-payment-pending.d.mts +3 -1
- package/dist/types/deposit/steps/card-payment-pending.d.ts +3 -1
- package/dist/types/deposit/steps/crypto-transfer.d.mts +1 -1
- package/dist/types/deposit/steps/crypto-transfer.d.ts +1 -1
- package/dist/types/events/item/event-list-item.utils.d.mts +57 -0
- package/dist/types/events/item/event-list-item.utils.d.ts +57 -0
- package/dist/types/events/item-details/event-list-item-details.types.d.mts +16 -1
- package/dist/types/events/item-details/event-list-item-details.types.d.ts +16 -1
- 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/events/market-details/market-details.types.d.mts +8 -0
- package/dist/types/events/market-details/market-details.types.d.ts +8 -0
- 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/copy-button/index.d.mts +25 -0
- package/dist/types/primitives/copy-button/index.d.ts +25 -0
- 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/index.d.mts +2 -0
- package/dist/types/primitives/index.d.ts +2 -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/toast/index.d.mts +4 -0
- package/dist/types/primitives/toast/index.d.ts +4 -0
- package/dist/types/primitives/toast/toast.types.d.mts +31 -0
- package/dist/types/primitives/toast/toast.types.d.ts +31 -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.constants.d.mts +8 -0
- package/dist/types/trading/place-order/index.place-order.constants.d.ts +8 -0
- package/dist/types/trading/place-order/index.place-order.types.d.mts +6 -1
- package/dist/types/trading/place-order/index.place-order.types.d.ts +6 -1
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +4 -11
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +4 -11
- 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/dist/types/withdraw/index.d.mts +2 -2
- package/dist/types/withdraw/index.d.ts +2 -2
- package/dist/types/withdraw/steps/withdraw-amount.d.mts +6 -3
- package/dist/types/withdraw/steps/withdraw-amount.d.ts +6 -3
- package/dist/types/withdraw/steps/withdraw-success.d.mts +8 -1
- package/dist/types/withdraw/steps/withdraw-success.d.ts +8 -1
- package/dist/types/withdraw/steps/withdraw-success.utils.d.mts +36 -0
- package/dist/types/withdraw/steps/withdraw-success.utils.d.ts +36 -0
- package/dist/types/withdraw/withdraw-modal.types.d.mts +25 -15
- package/dist/types/withdraw/withdraw-modal.types.d.ts +25 -15
- package/package.json +6 -5
- 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,12 +1,18 @@
|
|
|
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 {
|
|
15
|
+
AGG_TERMS_OF_SERVICE_URL,
|
|
10
16
|
Button,
|
|
11
17
|
Card,
|
|
12
18
|
CloseIcon,
|
|
@@ -15,6 +21,7 @@ import {
|
|
|
15
21
|
InlineAlert,
|
|
16
22
|
LoadingIcon,
|
|
17
23
|
Modal,
|
|
24
|
+
PlaceOrderRouteCardSkeleton,
|
|
18
25
|
RemoteImage,
|
|
19
26
|
Skeleton,
|
|
20
27
|
SuccessCheckIcon,
|
|
@@ -27,8 +34,9 @@ import {
|
|
|
27
34
|
cn,
|
|
28
35
|
formatUsd,
|
|
29
36
|
getMotionClassName,
|
|
37
|
+
normalizeVenueMarketCluster,
|
|
30
38
|
skeletonViews
|
|
31
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-TLGQ4LID.mjs";
|
|
32
40
|
|
|
33
41
|
// src/trading/types.ts
|
|
34
42
|
import { Venue, enumGuard, isFiniteNonNeg, safeParse } from "@agg-build/sdk";
|
|
@@ -36,444 +44,32 @@ var isVenue = enumGuard(Venue);
|
|
|
36
44
|
var parseVenue = (v) => safeParse(v, isVenue);
|
|
37
45
|
var parseAmount = (v) => safeParse(v, isFiniteNonNeg);
|
|
38
46
|
|
|
39
|
-
// src/trading/utils.ts
|
|
40
|
-
import { resolveAggUiLabels } from "@agg-build/hooks";
|
|
41
|
-
import dayjs from "dayjs";
|
|
42
|
-
var defaultLabels = resolveAggUiLabels("en-US");
|
|
43
|
-
var defaultSettlementSectionLabel = defaultLabels.trading.settlementSection;
|
|
44
|
-
var defaultSettlementDifferencesTitle = defaultLabels.trading.settlementDifferencesTitle;
|
|
45
|
-
var defaultTradingDisclaimer = defaultLabels.trading.disclaimer;
|
|
46
|
-
var getTradingDateLabel = (value) => {
|
|
47
|
-
const parsedValue = dayjs(value);
|
|
48
|
-
if (!parsedValue.isValid()) {
|
|
49
|
-
return typeof value === "string" ? value : "";
|
|
50
|
-
}
|
|
51
|
-
return parsedValue.format("MMM D, YYYY");
|
|
52
|
-
};
|
|
53
|
-
var getTradingVenueLabel = (venue, label) => {
|
|
54
|
-
var _a;
|
|
55
|
-
if (label) return label;
|
|
56
|
-
if (!venue) return "Unknown";
|
|
57
|
-
return (_a = defaultLabels.venues[venue]) != null ? _a : venue;
|
|
58
|
-
};
|
|
59
|
-
var getTradingValueLabel = ({
|
|
60
|
-
amount,
|
|
61
|
-
minimumFractionDigits = 0,
|
|
62
|
-
maximumFractionDigits = 2
|
|
63
|
-
}) => {
|
|
64
|
-
return amount.toLocaleString("en-US", {
|
|
65
|
-
style: "currency",
|
|
66
|
-
currency: "USD",
|
|
67
|
-
minimumFractionDigits,
|
|
68
|
-
maximumFractionDigits
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
var getTradingPriceLabel = (value) => {
|
|
72
|
-
return `${Math.round(value * 100)}\xA2`;
|
|
73
|
-
};
|
|
74
|
-
var getTradingAveragePriceLabel = (value) => {
|
|
75
|
-
return defaultLabels.trading.averagePrice(value);
|
|
76
|
-
};
|
|
77
|
-
var getTradingBalanceLabel = (value) => {
|
|
78
|
-
return defaultLabels.trading.balance(formatUsd(value));
|
|
79
|
-
};
|
|
80
|
-
var getTradingSharesLabel = (value) => {
|
|
81
|
-
return defaultLabels.trading.shares(value);
|
|
82
|
-
};
|
|
83
|
-
var getTradingSlippageLabel = (value) => {
|
|
84
|
-
return defaultLabels.trading.slippage(value);
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
// src/trading/settlement/index.tsx
|
|
88
|
-
import { useLabels, useSdkUiConfig } from "@agg-build/hooks";
|
|
89
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
90
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
91
|
-
var getSettlementHeaderClassName = () => {
|
|
92
|
-
return "flex items-center justify-between gap-4";
|
|
93
|
-
};
|
|
94
|
-
var Settlement = ({
|
|
95
|
-
sectionLabel = defaultSettlementSectionLabel,
|
|
96
|
-
question,
|
|
97
|
-
differencesTitle = defaultSettlementDifferencesTitle,
|
|
98
|
-
differences = [],
|
|
99
|
-
venues,
|
|
100
|
-
expandedVenue,
|
|
101
|
-
isLoading = false,
|
|
102
|
-
onExpandedVenueChange,
|
|
103
|
-
onShowMore,
|
|
104
|
-
className
|
|
105
|
-
}) => {
|
|
106
|
-
var _a, _b;
|
|
107
|
-
const labels = useLabels();
|
|
108
|
-
const {
|
|
109
|
-
features: { enableAnimations }
|
|
110
|
-
} = useSdkUiConfig();
|
|
111
|
-
const [internalExpandedVenue, setInternalExpandedVenue] = useState(
|
|
112
|
-
(_b = (_a = venues[0]) == null ? void 0 : _a.venue) != null ? _b : null
|
|
113
|
-
);
|
|
114
|
-
const [expandedDescriptionByVenue, setExpandedDescriptionByVenue] = useState({});
|
|
115
|
-
const [overflowingDescriptionByVenue, setOverflowingDescriptionByVenue] = useState({});
|
|
116
|
-
const [collapsedDescriptionByVenue, setCollapsedDescriptionByVenue] = useState({});
|
|
117
|
-
const descriptionWrapperRefs = useRef(/* @__PURE__ */ new Map());
|
|
118
|
-
const descriptionMeasureRefs = useRef(/* @__PURE__ */ new Map());
|
|
119
|
-
useEffect(() => {
|
|
120
|
-
if (expandedVenue === void 0) return;
|
|
121
|
-
setInternalExpandedVenue(expandedVenue);
|
|
122
|
-
}, [expandedVenue]);
|
|
123
|
-
const resolvedExpandedVenue = expandedVenue === void 0 ? internalExpandedVenue : expandedVenue;
|
|
124
|
-
const handleVenueClick = (venue) => {
|
|
125
|
-
const nextVenue = resolvedExpandedVenue === venue ? null : venue;
|
|
126
|
-
if (expandedVenue === void 0) {
|
|
127
|
-
setInternalExpandedVenue(nextVenue);
|
|
128
|
-
}
|
|
129
|
-
onExpandedVenueChange == null ? void 0 : onExpandedVenueChange(nextVenue);
|
|
130
|
-
};
|
|
131
|
-
const handleDescriptionWrapperRef = useCallback(
|
|
132
|
-
(venue, element) => {
|
|
133
|
-
if (!element) {
|
|
134
|
-
descriptionWrapperRefs.current.delete(venue);
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
descriptionWrapperRefs.current.set(venue, element);
|
|
138
|
-
},
|
|
139
|
-
[]
|
|
140
|
-
);
|
|
141
|
-
const handleDescriptionMeasureRef = useCallback(
|
|
142
|
-
(venue, element) => {
|
|
143
|
-
if (!element) {
|
|
144
|
-
descriptionMeasureRefs.current.delete(venue);
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
descriptionMeasureRefs.current.set(venue, element);
|
|
148
|
-
},
|
|
149
|
-
[]
|
|
150
|
-
);
|
|
151
|
-
const updateDescriptionLayout = useCallback(
|
|
152
|
-
(venue, description, showMoreLabel) => {
|
|
153
|
-
const descriptionWrapperElement = descriptionWrapperRefs.current.get(venue);
|
|
154
|
-
const descriptionMeasureElement = descriptionMeasureRefs.current.get(venue);
|
|
155
|
-
if (!descriptionWrapperElement || !descriptionMeasureElement) return;
|
|
156
|
-
const wrapperWidth = descriptionWrapperElement.clientWidth;
|
|
157
|
-
if (wrapperWidth <= 0) return;
|
|
158
|
-
const computedStyles = window.getComputedStyle(descriptionWrapperElement);
|
|
159
|
-
const parsedLineHeight = Number.parseFloat(computedStyles.lineHeight);
|
|
160
|
-
const lineHeight = Number.isFinite(parsedLineHeight) ? parsedLineHeight : 20;
|
|
161
|
-
const maxHeight = lineHeight * 2 + 1;
|
|
162
|
-
descriptionMeasureElement.style.width = `${wrapperWidth}px`;
|
|
163
|
-
const getHeight = (value) => {
|
|
164
|
-
descriptionMeasureElement.textContent = value;
|
|
165
|
-
return descriptionMeasureElement.scrollHeight;
|
|
166
|
-
};
|
|
167
|
-
const fullHeight = getHeight(description);
|
|
168
|
-
if (fullHeight <= maxHeight) {
|
|
169
|
-
setOverflowingDescriptionByVenue((currentState) => {
|
|
170
|
-
if (currentState[venue] === false) return currentState;
|
|
171
|
-
return __spreadProps(__spreadValues({}, currentState), {
|
|
172
|
-
[venue]: false
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
setCollapsedDescriptionByVenue((currentState) => {
|
|
176
|
-
if (currentState[venue] === description) return currentState;
|
|
177
|
-
return __spreadProps(__spreadValues({}, currentState), {
|
|
178
|
-
[venue]: description
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
const suffix = `... ${showMoreLabel}`;
|
|
184
|
-
let left = 0;
|
|
185
|
-
let right = description.length;
|
|
186
|
-
let bestLength = 0;
|
|
187
|
-
while (left <= right) {
|
|
188
|
-
const middle = Math.floor((left + right) / 2);
|
|
189
|
-
const candidate = description.slice(0, middle).trimEnd();
|
|
190
|
-
const candidateHeight = getHeight(`${candidate}${suffix}`);
|
|
191
|
-
if (candidateHeight <= maxHeight) {
|
|
192
|
-
bestLength = middle;
|
|
193
|
-
left = middle + 1;
|
|
194
|
-
continue;
|
|
195
|
-
}
|
|
196
|
-
right = middle - 1;
|
|
197
|
-
}
|
|
198
|
-
const collapsedDescription = description.slice(0, bestLength).trimEnd();
|
|
199
|
-
setOverflowingDescriptionByVenue((currentState) => {
|
|
200
|
-
if (currentState[venue] === true) return currentState;
|
|
201
|
-
return __spreadProps(__spreadValues({}, currentState), {
|
|
202
|
-
[venue]: true
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
setCollapsedDescriptionByVenue((currentState) => {
|
|
206
|
-
if (currentState[venue] === collapsedDescription) return currentState;
|
|
207
|
-
return __spreadProps(__spreadValues({}, currentState), {
|
|
208
|
-
[venue]: collapsedDescription
|
|
209
|
-
});
|
|
210
|
-
});
|
|
211
|
-
},
|
|
212
|
-
[]
|
|
213
|
-
);
|
|
214
|
-
useEffect(() => {
|
|
215
|
-
if (typeof window === "undefined") return;
|
|
216
|
-
if (!resolvedExpandedVenue) return;
|
|
217
|
-
if (expandedDescriptionByVenue[resolvedExpandedVenue]) return;
|
|
218
|
-
const expandedVenueItem = venues.find((venueItem) => venueItem.venue === resolvedExpandedVenue);
|
|
219
|
-
if (!expandedVenueItem) return;
|
|
220
|
-
const frameId = window.requestAnimationFrame(() => {
|
|
221
|
-
var _a2;
|
|
222
|
-
updateDescriptionLayout(
|
|
223
|
-
resolvedExpandedVenue,
|
|
224
|
-
expandedVenueItem.description,
|
|
225
|
-
(_a2 = expandedVenueItem.showMoreLabel) != null ? _a2 : "Show more"
|
|
226
|
-
);
|
|
227
|
-
});
|
|
228
|
-
return () => {
|
|
229
|
-
window.cancelAnimationFrame(frameId);
|
|
230
|
-
};
|
|
231
|
-
}, [expandedDescriptionByVenue, resolvedExpandedVenue, updateDescriptionLayout, venues]);
|
|
232
|
-
useEffect(() => {
|
|
233
|
-
if (!resolvedExpandedVenue) return;
|
|
234
|
-
if (expandedDescriptionByVenue[resolvedExpandedVenue]) return;
|
|
235
|
-
if (typeof ResizeObserver === "undefined") return;
|
|
236
|
-
const expandedVenueItem = venues.find((venueItem) => venueItem.venue === resolvedExpandedVenue);
|
|
237
|
-
if (!expandedVenueItem) return;
|
|
238
|
-
const descriptionWrapperElement = descriptionWrapperRefs.current.get(resolvedExpandedVenue);
|
|
239
|
-
if (!descriptionWrapperElement) return;
|
|
240
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
241
|
-
var _a2;
|
|
242
|
-
updateDescriptionLayout(
|
|
243
|
-
resolvedExpandedVenue,
|
|
244
|
-
expandedVenueItem.description,
|
|
245
|
-
(_a2 = expandedVenueItem.showMoreLabel) != null ? _a2 : "Show more"
|
|
246
|
-
);
|
|
247
|
-
});
|
|
248
|
-
resizeObserver.observe(descriptionWrapperElement);
|
|
249
|
-
return () => {
|
|
250
|
-
resizeObserver.disconnect();
|
|
251
|
-
};
|
|
252
|
-
}, [expandedDescriptionByVenue, resolvedExpandedVenue, updateDescriptionLayout, venues]);
|
|
253
|
-
const handleDescriptionShowMoreClick = (event, venue) => {
|
|
254
|
-
event == null ? void 0 : event.stopPropagation();
|
|
255
|
-
setExpandedDescriptionByVenue((currentState) => {
|
|
256
|
-
if (currentState[venue]) return currentState;
|
|
257
|
-
return __spreadProps(__spreadValues({}, currentState), {
|
|
258
|
-
[venue]: true
|
|
259
|
-
});
|
|
260
|
-
});
|
|
261
|
-
onShowMore == null ? void 0 : onShowMore(venue);
|
|
262
|
-
};
|
|
263
|
-
if (isLoading) {
|
|
264
|
-
return /* @__PURE__ */ jsx(
|
|
265
|
-
Skeleton,
|
|
266
|
-
{
|
|
267
|
-
ariaLabel: labels.trading.settlementLoading,
|
|
268
|
-
className,
|
|
269
|
-
view: skeletonViews.settlement
|
|
270
|
-
}
|
|
271
|
-
);
|
|
272
|
-
}
|
|
273
|
-
return /* @__PURE__ */ jsxs(
|
|
274
|
-
Card,
|
|
275
|
-
{
|
|
276
|
-
className: cn(
|
|
277
|
-
"group/agg-settlement-card",
|
|
278
|
-
"flex flex-col w-full gap-5 rounded-agg-xl border border-agg-separator bg-agg-secondary p-5 shadow-none hover:shadow-none",
|
|
279
|
-
className
|
|
280
|
-
),
|
|
281
|
-
children: [
|
|
282
|
-
/* @__PURE__ */ jsxs("div", { className: cn("agg-settlement-header", getSettlementHeaderClassName()), children: [
|
|
283
|
-
/* @__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 }),
|
|
284
|
-
question ? /* @__PURE__ */ jsx("p", { className: "agg-settlement-question text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: question }) : null
|
|
285
|
-
] }),
|
|
286
|
-
differences.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
287
|
-
/* @__PURE__ */ jsxs("div", { className: "agg-settlement-differences flex flex-col gap-2", children: [
|
|
288
|
-
/* @__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 }),
|
|
289
|
-
/* @__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)) })
|
|
290
|
-
] }),
|
|
291
|
-
/* @__PURE__ */ jsx("div", { className: "h-px w-full bg-agg-separator" })
|
|
292
|
-
] }) : null,
|
|
293
|
-
/* @__PURE__ */ jsx("div", { className: "agg-settlement-venues flex flex-col gap-3", children: venues.map((venue) => {
|
|
294
|
-
var _a2, _b2;
|
|
295
|
-
const venueLabel = getTradingVenueLabel(venue.venue, venue.label);
|
|
296
|
-
const isExpanded = resolvedExpandedVenue === venue.venue;
|
|
297
|
-
const isDescriptionExpanded = !!expandedDescriptionByVenue[venue.venue];
|
|
298
|
-
const isDescriptionOverflowing = !!overflowingDescriptionByVenue[venue.venue];
|
|
299
|
-
const shouldShowDescriptionCta = isExpanded && isDescriptionOverflowing && !isDescriptionExpanded;
|
|
300
|
-
const resolvedShowMoreLabel = (_a2 = venue.showMoreLabel) != null ? _a2 : "Show more";
|
|
301
|
-
return /* @__PURE__ */ jsxs("div", { className: "agg-settlement-venue flex flex-col", children: [
|
|
302
|
-
/* @__PURE__ */ jsxs(
|
|
303
|
-
"button",
|
|
304
|
-
{
|
|
305
|
-
type: "button",
|
|
306
|
-
className: cn(
|
|
307
|
-
"agg-settlement-venue-trigger",
|
|
308
|
-
"flex items-center gap-2 text-left",
|
|
309
|
-
"cursor-pointer disabled:cursor-not-allowed hover:opacity-50",
|
|
310
|
-
getMotionClassName(
|
|
311
|
-
enableAnimations,
|
|
312
|
-
"transition-[opacity,color] duration-200 ease-in-out"
|
|
313
|
-
)
|
|
314
|
-
),
|
|
315
|
-
"aria-expanded": isExpanded,
|
|
316
|
-
"aria-label": labels.trading.settlementDetailsAria(venueLabel),
|
|
317
|
-
onClick: (e) => {
|
|
318
|
-
e.stopPropagation();
|
|
319
|
-
e.preventDefault();
|
|
320
|
-
handleVenueClick(venue.venue);
|
|
321
|
-
},
|
|
322
|
-
children: [
|
|
323
|
-
/* @__PURE__ */ jsx(
|
|
324
|
-
VenueLogo,
|
|
325
|
-
{
|
|
326
|
-
venue: venue.venue,
|
|
327
|
-
size: "small",
|
|
328
|
-
ariaLabel: venueLabel
|
|
329
|
-
}
|
|
330
|
-
),
|
|
331
|
-
/* @__PURE__ */ jsx(
|
|
332
|
-
"span",
|
|
333
|
-
{
|
|
334
|
-
className: cn(
|
|
335
|
-
"text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground",
|
|
336
|
-
"text-agg-foreground"
|
|
337
|
-
),
|
|
338
|
-
children: venueLabel
|
|
339
|
-
}
|
|
340
|
-
),
|
|
341
|
-
/* @__PURE__ */ jsx(
|
|
342
|
-
Icon,
|
|
343
|
-
{
|
|
344
|
-
name: isExpanded ? "chevron-up" : "chevron-down",
|
|
345
|
-
size: "small",
|
|
346
|
-
className: "text-agg-foreground",
|
|
347
|
-
color: "currentColor"
|
|
348
|
-
}
|
|
349
|
-
)
|
|
350
|
-
]
|
|
351
|
-
}
|
|
352
|
-
),
|
|
353
|
-
/* @__PURE__ */ jsx(
|
|
354
|
-
"div",
|
|
355
|
-
{
|
|
356
|
-
"aria-hidden": !isExpanded,
|
|
357
|
-
className: cn(
|
|
358
|
-
"grid overflow-hidden",
|
|
359
|
-
isExpanded ? "mt-2 grid-rows-[1fr] opacity-100" : "mt-0 grid-rows-[0fr] opacity-0",
|
|
360
|
-
!isExpanded && "pointer-events-none",
|
|
361
|
-
getMotionClassName(
|
|
362
|
-
enableAnimations,
|
|
363
|
-
"transition-[grid-template-rows,opacity,margin-top] duration-300 ease-in-out"
|
|
364
|
-
)
|
|
365
|
-
),
|
|
366
|
-
children: /* @__PURE__ */ jsxs(
|
|
367
|
-
"div",
|
|
368
|
-
{
|
|
369
|
-
ref: (element) => handleDescriptionWrapperRef(venue.venue, element),
|
|
370
|
-
className: "agg-settlement-venue-content relative min-h-0",
|
|
371
|
-
children: [
|
|
372
|
-
/* @__PURE__ */ jsxs("p", { className: "agg-settlement-venue-description min-h-0 text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
373
|
-
isDescriptionExpanded || !isDescriptionOverflowing ? venue.description : (_b2 = collapsedDescriptionByVenue[venue.venue]) != null ? _b2 : venue.description,
|
|
374
|
-
shouldShowDescriptionCta ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
375
|
-
"... ",
|
|
376
|
-
/* @__PURE__ */ jsx(
|
|
377
|
-
"button",
|
|
378
|
-
{
|
|
379
|
-
type: "button",
|
|
380
|
-
tabIndex: isExpanded ? 0 : -1,
|
|
381
|
-
className: cn(
|
|
382
|
-
"agg-settlement-venue-action",
|
|
383
|
-
"cursor-pointer disabled:cursor-not-allowed",
|
|
384
|
-
"text-agg-sm leading-agg-5 text-agg-foreground underline-offset-2 hover:underline hover:font-agg-bold",
|
|
385
|
-
getMotionClassName(
|
|
386
|
-
enableAnimations,
|
|
387
|
-
"transition-[text-decoration] duration-200 ease-in-out"
|
|
388
|
-
)
|
|
389
|
-
),
|
|
390
|
-
"aria-label": labels.trading.settlementShowMoreAria(
|
|
391
|
-
resolvedShowMoreLabel,
|
|
392
|
-
venueLabel
|
|
393
|
-
),
|
|
394
|
-
onClick: (event) => handleDescriptionShowMoreClick(event, venue.venue),
|
|
395
|
-
children: resolvedShowMoreLabel
|
|
396
|
-
}
|
|
397
|
-
)
|
|
398
|
-
] }) : null
|
|
399
|
-
] }),
|
|
400
|
-
/* @__PURE__ */ jsx(
|
|
401
|
-
"p",
|
|
402
|
-
{
|
|
403
|
-
ref: (element) => handleDescriptionMeasureRef(venue.venue, element),
|
|
404
|
-
"aria-hidden": true,
|
|
405
|
-
className: "pointer-events-none invisible fixed top-0 left-0 -z-10 whitespace-normal text-agg-sm leading-agg-5"
|
|
406
|
-
}
|
|
407
|
-
)
|
|
408
|
-
]
|
|
409
|
-
}
|
|
410
|
-
)
|
|
411
|
-
}
|
|
412
|
-
)
|
|
413
|
-
] }, venue.venue);
|
|
414
|
-
}) })
|
|
415
|
-
]
|
|
416
|
-
}
|
|
417
|
-
);
|
|
418
|
-
};
|
|
419
|
-
Settlement.displayName = "Settlement";
|
|
420
|
-
|
|
421
47
|
// src/trading/settlement/settlement-details.tsx
|
|
422
|
-
import { useEventTradingContext
|
|
423
|
-
import {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
var SETTLEMENT_FIELD_KEYS = ["description", "rulesPrimary", "rulesSecondary"];
|
|
427
|
-
var FIELD_TO_LABEL_KEY = {
|
|
428
|
-
description: "settlementDescriptionLabel",
|
|
429
|
-
rulesPrimary: "settlementRulesPrimaryLabel",
|
|
430
|
-
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;
|
|
431
52
|
};
|
|
432
|
-
function mapVenueMarketsToSettlementSections(venueMarkets, labels, selectedMarketId) {
|
|
433
|
-
return SETTLEMENT_FIELD_KEYS.reduce((sections, fieldKey) => {
|
|
434
|
-
const venues = venueMarkets.filter((market) => {
|
|
435
|
-
const value = market[fieldKey];
|
|
436
|
-
return typeof value === "string" && value.trim().length > 0;
|
|
437
|
-
}).map(
|
|
438
|
-
(market) => market.id === selectedMarketId ? {
|
|
439
|
-
marketId: market.id,
|
|
440
|
-
venue: market.venue,
|
|
441
|
-
description: market[fieldKey]
|
|
442
|
-
} : null
|
|
443
|
-
).filter((venue) => venue !== null);
|
|
444
|
-
if (venues.length > 0) {
|
|
445
|
-
sections.push({
|
|
446
|
-
key: fieldKey,
|
|
447
|
-
label: labels.trading[FIELD_TO_LABEL_KEY[fieldKey]],
|
|
448
|
-
venues
|
|
449
|
-
});
|
|
450
|
-
}
|
|
451
|
-
return sections;
|
|
452
|
-
}, []);
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
// src/trading/settlement/settlement-details.tsx
|
|
456
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
457
53
|
var SettlementDetails = ({ className }) => {
|
|
458
54
|
var _a, _b, _c, _d, _e, _f;
|
|
459
|
-
const labels = useLabels2();
|
|
460
55
|
const tradingContext = useEventTradingContext();
|
|
461
|
-
const
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
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(
|
|
473
67
|
Settlement,
|
|
474
68
|
{
|
|
475
|
-
question: (
|
|
476
|
-
|
|
69
|
+
question: (_f = selectedMarket.question) != null ? _f : selectedEvent.title,
|
|
70
|
+
eventDescription,
|
|
71
|
+
marketDescription,
|
|
72
|
+
primaryRules,
|
|
477
73
|
className
|
|
478
74
|
}
|
|
479
75
|
) }) });
|
|
@@ -498,15 +94,16 @@ import {
|
|
|
498
94
|
useExecutionPositions,
|
|
499
95
|
useExecutionProgress,
|
|
500
96
|
useGeoBlock,
|
|
501
|
-
useLabels
|
|
97
|
+
useLabels,
|
|
502
98
|
useLiveOutcomePrices,
|
|
99
|
+
useMidpoints,
|
|
503
100
|
useQueryClient,
|
|
504
|
-
useSdkUiConfig
|
|
101
|
+
useSdkUiConfig,
|
|
505
102
|
useSmartRoute
|
|
506
103
|
} from "@agg-build/hooks";
|
|
507
104
|
import NumberFlow from "@number-flow/react";
|
|
508
105
|
import * as Dialog from "@radix-ui/react-dialog";
|
|
509
|
-
import { Fragment
|
|
106
|
+
import { Fragment, useCallback as useCallback2, useEffect as useEffect2, useId, useMemo as useMemo2, useRef as useRef2, useState as useState3 } from "react";
|
|
510
107
|
|
|
511
108
|
// src/shared/deposit-modal-events.ts
|
|
512
109
|
var DEPOSIT_MODAL_OPEN_EVENT = "agg-deposit:open-modal";
|
|
@@ -522,7 +119,7 @@ var requestAggWithdrawModalOpen = () => {
|
|
|
522
119
|
|
|
523
120
|
// src/trading/use-kalshi-kyc-flow.ts
|
|
524
121
|
import { useAggClient, useDepositAddresses } from "@agg-build/hooks";
|
|
525
|
-
import { useCallback
|
|
122
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
526
123
|
var KYC_PENDING_STORAGE_KEY = "agg_kyc_pending";
|
|
527
124
|
var getKycPendingState = () => {
|
|
528
125
|
var _a, _b;
|
|
@@ -553,13 +150,13 @@ var useKalshiKycFlow = ({
|
|
|
553
150
|
onError
|
|
554
151
|
}) => {
|
|
555
152
|
const client = useAggClient();
|
|
556
|
-
const [isVerifyModalOpen, setIsVerifyModalOpen] =
|
|
557
|
-
const [showSuccessModal, setShowSuccessModal] =
|
|
558
|
-
const [isInitiating, setIsInitiating] =
|
|
559
|
-
const [needsDepositAddress, setNeedsDepositAddress] =
|
|
560
|
-
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);
|
|
561
158
|
const { isReady, isTimedOut } = useDepositAddresses({ enabled: needsDepositAddress, poll: true });
|
|
562
|
-
const pendingState =
|
|
159
|
+
const pendingState = useMemo(
|
|
563
160
|
() => ({
|
|
564
161
|
venue: "kalshi",
|
|
565
162
|
userId: userId != null ? userId : null,
|
|
@@ -567,28 +164,28 @@ var useKalshiKycFlow = ({
|
|
|
567
164
|
}),
|
|
568
165
|
[userId, walletAddress]
|
|
569
166
|
);
|
|
570
|
-
const resetInitiation =
|
|
167
|
+
const resetInitiation = useCallback(() => {
|
|
571
168
|
setIsInitiating(false);
|
|
572
169
|
setNeedsDepositAddress(false);
|
|
573
170
|
}, []);
|
|
574
|
-
const closeVerifyModal =
|
|
171
|
+
const closeVerifyModal = useCallback(() => {
|
|
575
172
|
initiationAttemptRef.current += 1;
|
|
576
173
|
clearKycPendingState();
|
|
577
174
|
resetInitiation();
|
|
578
175
|
setIsVerifyModalOpen(false);
|
|
579
176
|
}, [resetInitiation]);
|
|
580
|
-
const closeSuccessModal =
|
|
177
|
+
const closeSuccessModal = useCallback(() => {
|
|
581
178
|
setShowSuccessModal(false);
|
|
582
179
|
}, []);
|
|
583
|
-
const openVerifyModal =
|
|
180
|
+
const openVerifyModal = useCallback(() => {
|
|
584
181
|
setIsVerifyModalOpen(true);
|
|
585
182
|
}, []);
|
|
586
|
-
const startVerification =
|
|
183
|
+
const startVerification = useCallback(() => {
|
|
587
184
|
initiationAttemptRef.current += 1;
|
|
588
185
|
setIsInitiating(true);
|
|
589
186
|
setNeedsDepositAddress(true);
|
|
590
187
|
}, []);
|
|
591
|
-
|
|
188
|
+
useEffect(() => {
|
|
592
189
|
if (!isInitiating || !isReady) return;
|
|
593
190
|
const attemptId = initiationAttemptRef.current;
|
|
594
191
|
const redirectUri = window.location.href;
|
|
@@ -605,14 +202,14 @@ var useKalshiKycFlow = ({
|
|
|
605
202
|
resetInitiation();
|
|
606
203
|
});
|
|
607
204
|
}, [client, isInitiating, isReady, onError, pendingState, resetInitiation]);
|
|
608
|
-
|
|
205
|
+
useEffect(() => {
|
|
609
206
|
if (isTimedOut && isInitiating) {
|
|
610
207
|
clearKycPendingState();
|
|
611
208
|
resetInitiation();
|
|
612
209
|
onError == null ? void 0 : onError(new Error("Deposit address provisioning timed out"));
|
|
613
210
|
}
|
|
614
211
|
}, [isInitiating, isTimedOut, onError, resetInitiation]);
|
|
615
|
-
|
|
212
|
+
useEffect(() => {
|
|
616
213
|
const storedPendingState = getKycPendingState();
|
|
617
214
|
const isMatchingSession = (storedPendingState == null ? void 0 : storedPendingState.venue) === "kalshi" && storedPendingState.userId === pendingState.userId && storedPendingState.walletAddress === pendingState.walletAddress;
|
|
618
215
|
if (isKalshiVerified && isMatchingSession) {
|
|
@@ -632,7 +229,9 @@ var useKalshiKycFlow = ({
|
|
|
632
229
|
};
|
|
633
230
|
|
|
634
231
|
// src/trading/place-order/index.place-order.constants.ts
|
|
232
|
+
var PLACE_ORDER_DEFAULT_AMOUNT = 20;
|
|
635
233
|
var MIN_BUY_ORDER_AMOUNT = 1;
|
|
234
|
+
var MIN_SELL_ORDER_SHARES = 1;
|
|
636
235
|
var DEFAULT_SLIPPAGE_VALUE = "0.5";
|
|
637
236
|
var HIGH_SLIPPAGE_THRESHOLD = 10;
|
|
638
237
|
var PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT = 3;
|
|
@@ -843,10 +442,12 @@ var resolvePlaceOrderQuoteStatus = ({
|
|
|
843
442
|
var buildLiveRouteCards = ({
|
|
844
443
|
labels,
|
|
845
444
|
quoteData,
|
|
846
|
-
tradeSide
|
|
445
|
+
tradeSide,
|
|
446
|
+
eventVenues = []
|
|
847
447
|
}) => {
|
|
848
448
|
var _a, _b, _c;
|
|
849
449
|
const geoBlockedVenues = extractGeoBlockedVenues(quoteData.warnings);
|
|
450
|
+
const eventVenueSet = new Set(eventVenues);
|
|
850
451
|
const primaryResult = resolvePlaceOrderQuoteResult({ labels, quoteData, tradeSide });
|
|
851
452
|
const primaryVenue = (_a = quoteData.fills[0]) == null ? void 0 : _a.venue;
|
|
852
453
|
const parsedPrimaryVenue = parseVenue(primaryVenue);
|
|
@@ -944,24 +545,26 @@ var buildLiveRouteCards = ({
|
|
|
944
545
|
});
|
|
945
546
|
const baseCards = primaryCard ? [primaryCard, ...soloCards] : soloCards;
|
|
946
547
|
const coveredVenueStrings = new Set(
|
|
947
|
-
[...baseCards, ...unavailableCards].flatMap((
|
|
548
|
+
[...baseCards, ...unavailableCards].flatMap((card) => card.venue ? [card.venue] : [])
|
|
948
549
|
);
|
|
949
|
-
const
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
return
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
550
|
+
const parsedKalshiVenue = parseVenue("kalshi");
|
|
551
|
+
const kalshiVenue = parsedKalshiVenue.success ? parsedKalshiVenue.data : void 0;
|
|
552
|
+
const warningOnlyUnavailableCards = geoBlockedVenues.has("kalshi") && !!kalshiVenue && eventVenueSet.has(kalshiVenue) && !coveredVenueStrings.has("kalshi") ? (() => {
|
|
553
|
+
return [
|
|
554
|
+
{
|
|
555
|
+
id: "live-geo-blocked-kalshi",
|
|
556
|
+
hint: "",
|
|
557
|
+
kind: "venue",
|
|
558
|
+
label: getTradingVenueLabel(kalshiVenue),
|
|
559
|
+
numericValue: 0,
|
|
560
|
+
quoteData,
|
|
561
|
+
value: "",
|
|
562
|
+
venue: kalshiVenue,
|
|
563
|
+
isUnavailable: true
|
|
564
|
+
}
|
|
565
|
+
];
|
|
566
|
+
})() : [];
|
|
567
|
+
return [...baseCards, ...unavailableCards, ...warningOnlyUnavailableCards];
|
|
965
568
|
};
|
|
966
569
|
var resolveExecutionVenueFromQuote = (quoteData) => {
|
|
967
570
|
if (!(quoteData == null ? void 0 : quoteData.fills.length)) return void 0;
|
|
@@ -969,14 +572,6 @@ var resolveExecutionVenueFromQuote = (quoteData) => {
|
|
|
969
572
|
const parsed = parseVenue(dominantFill == null ? void 0 : dominantFill.venue);
|
|
970
573
|
return parsed.success ? parsed.data : void 0;
|
|
971
574
|
};
|
|
972
|
-
var resolvePlaceOrderSuccessTone = ({
|
|
973
|
-
outcomeIndex,
|
|
974
|
-
tab
|
|
975
|
-
}) => {
|
|
976
|
-
const isNegativeOutcome = outcomeIndex > 0;
|
|
977
|
-
const isPositiveExposure = tab === "buy" && !isNegativeOutcome || tab === "sell" && isNegativeOutcome;
|
|
978
|
-
return isPositiveExposure ? "positive" : "negative";
|
|
979
|
-
};
|
|
980
575
|
var getPlaceOrderPotentialReturn = (quoteData) => {
|
|
981
576
|
var _a, _b;
|
|
982
577
|
if (!((_a = quoteData == null ? void 0 : quoteData.fills) == null ? void 0 : _a.length) || quoteData.fills.length < 2) return 0;
|
|
@@ -1123,14 +718,18 @@ var groupPlaceOrderFailureSteps = (steps) => {
|
|
|
1123
718
|
};
|
|
1124
719
|
var buildPlaceOrderExecutionStepGroupsFromFailureSummary = ({
|
|
1125
720
|
labels,
|
|
1126
|
-
summary
|
|
721
|
+
summary,
|
|
722
|
+
// When the partial-fill steps are rendered inside the success view (auto
|
|
723
|
+
// 95%+ skip or after the user clicks Skip), surface them as completed
|
|
724
|
+
// checks instead of warnings — the order is being treated as complete.
|
|
725
|
+
treatPartialAsComplete = false
|
|
1127
726
|
}) => {
|
|
1128
727
|
var _a;
|
|
1129
728
|
const failureStepGroups = groupPlaceOrderFailureSteps(summary.steps).map(
|
|
1130
729
|
(group) => group.map((step) => ({
|
|
1131
730
|
id: step.id,
|
|
1132
731
|
label: step.label,
|
|
1133
|
-
tone: step.tone,
|
|
732
|
+
tone: treatPartialAsComplete && (step.tone === "warning" || step.tone === "error") ? "complete" : step.tone,
|
|
1134
733
|
venue: step.venue
|
|
1135
734
|
}))
|
|
1136
735
|
);
|
|
@@ -1529,7 +1128,7 @@ var isPercentageBelowMinimum = (value, minimumValue) => {
|
|
|
1529
1128
|
};
|
|
1530
1129
|
|
|
1531
1130
|
// src/trading/place-order/index.place-order.failure.tsx
|
|
1532
|
-
import { jsx as
|
|
1131
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
1533
1132
|
var resolveFailureActionHandler = ({
|
|
1534
1133
|
action,
|
|
1535
1134
|
onDone,
|
|
@@ -1542,12 +1141,12 @@ var resolveFailureActionHandler = ({
|
|
|
1542
1141
|
};
|
|
1543
1142
|
var renderPartialFailureStep = (step) => {
|
|
1544
1143
|
const isWarningStep = step.tone === "warning" || step.tone === "error";
|
|
1545
|
-
return /* @__PURE__ */
|
|
1144
|
+
return /* @__PURE__ */ jsxs(
|
|
1546
1145
|
"div",
|
|
1547
1146
|
{
|
|
1548
1147
|
className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
1549
1148
|
children: [
|
|
1550
|
-
/* @__PURE__ */
|
|
1149
|
+
/* @__PURE__ */ jsx2(
|
|
1551
1150
|
Icon,
|
|
1552
1151
|
{
|
|
1553
1152
|
name: isWarningStep ? "warning-filled" : "check-circle",
|
|
@@ -1556,8 +1155,8 @@ var renderPartialFailureStep = (step) => {
|
|
|
1556
1155
|
"aria-hidden": "true"
|
|
1557
1156
|
}
|
|
1558
1157
|
),
|
|
1559
|
-
/* @__PURE__ */
|
|
1560
|
-
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
|
|
1561
1160
|
]
|
|
1562
1161
|
},
|
|
1563
1162
|
step.id
|
|
@@ -1576,10 +1175,10 @@ var PlaceOrderFailureView = ({
|
|
|
1576
1175
|
const shouldShowPartialFailureLayout = summary.kind === "partial_fill";
|
|
1577
1176
|
const failureStepGroups = shouldShowPartialFailureLayout ? groupPlaceOrderFailureSteps(summary.steps) : [];
|
|
1578
1177
|
if (shouldShowPartialFailureLayout) {
|
|
1579
|
-
return /* @__PURE__ */
|
|
1580
|
-
/* @__PURE__ */
|
|
1581
|
-
/* @__PURE__ */
|
|
1582
|
-
/* @__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(
|
|
1583
1182
|
RemoteImage,
|
|
1584
1183
|
{
|
|
1585
1184
|
src: (_a = summary.eventImage) != null ? _a : null,
|
|
@@ -1587,16 +1186,12 @@ var PlaceOrderFailureView = ({
|
|
|
1587
1186
|
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
1588
1187
|
}
|
|
1589
1188
|
),
|
|
1590
|
-
/* @__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 })
|
|
1591
1190
|
] }),
|
|
1592
|
-
summary.eventSubtitle ? /* @__PURE__ */
|
|
1593
|
-
] }),
|
|
1594
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex min-h-12 w-full items-center justify-center gap-3 rounded-agg-full agg-bg-brand px-8 text-agg-base font-agg-bold leading-agg-6 text-agg-on-primary", children: [
|
|
1595
|
-
/* @__PURE__ */ jsx3(LoadingIcon, { size: "small", className: "text-agg-on-primary!" }),
|
|
1596
|
-
/* @__PURE__ */ jsx3("span", { children: summary.actionLabel })
|
|
1191
|
+
summary.eventSubtitle ? /* @__PURE__ */ jsx2("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
|
|
1597
1192
|
] }),
|
|
1598
|
-
/* @__PURE__ */
|
|
1599
|
-
/* @__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(
|
|
1600
1195
|
Button,
|
|
1601
1196
|
{
|
|
1602
1197
|
variant: "tertiary",
|
|
@@ -1610,10 +1205,10 @@ var PlaceOrderFailureView = ({
|
|
|
1610
1205
|
)) })
|
|
1611
1206
|
] }) });
|
|
1612
1207
|
}
|
|
1613
|
-
return /* @__PURE__ */
|
|
1614
|
-
/* @__PURE__ */
|
|
1615
|
-
/* @__PURE__ */
|
|
1616
|
-
/* @__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(
|
|
1617
1212
|
RemoteImage,
|
|
1618
1213
|
{
|
|
1619
1214
|
src: (_b = summary.eventImage) != null ? _b : null,
|
|
@@ -1621,11 +1216,11 @@ var PlaceOrderFailureView = ({
|
|
|
1621
1216
|
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
1622
1217
|
}
|
|
1623
1218
|
),
|
|
1624
|
-
/* @__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 })
|
|
1625
1220
|
] }),
|
|
1626
|
-
summary.eventSubtitle ? /* @__PURE__ */
|
|
1221
|
+
summary.eventSubtitle ? /* @__PURE__ */ jsx2("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
|
|
1627
1222
|
] }),
|
|
1628
|
-
/* @__PURE__ */
|
|
1223
|
+
/* @__PURE__ */ jsx2(
|
|
1629
1224
|
InlineAlert,
|
|
1630
1225
|
{
|
|
1631
1226
|
tone: "error",
|
|
@@ -1634,7 +1229,7 @@ var PlaceOrderFailureView = ({
|
|
|
1634
1229
|
message: tradingLabels.orderFailureDescription((_c = summary.errorMessage) != null ? _c : "")
|
|
1635
1230
|
}
|
|
1636
1231
|
),
|
|
1637
|
-
/* @__PURE__ */
|
|
1232
|
+
/* @__PURE__ */ jsx2("div", { className: "agg-order-failure-actions flex items-center gap-3", children: summary.actions.map((action) => /* @__PURE__ */ jsx2(
|
|
1638
1233
|
Button,
|
|
1639
1234
|
{
|
|
1640
1235
|
variant: action.variant === "retry" ? "primary" : "secondary",
|
|
@@ -1651,8 +1246,8 @@ var PlaceOrderFailureView = ({
|
|
|
1651
1246
|
PlaceOrderFailureView.displayName = "PlaceOrderFailureView";
|
|
1652
1247
|
|
|
1653
1248
|
// src/trading/place-order/index.place-order.success.tsx
|
|
1654
|
-
import { useState as
|
|
1655
|
-
import { jsx as
|
|
1249
|
+
import { useState as useState2 } from "react";
|
|
1250
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1656
1251
|
var resolveBuyToWinLabel = (shares) => {
|
|
1657
1252
|
if (!shares) return "$0";
|
|
1658
1253
|
return shares.startsWith("$") ? shares : `$${shares}`;
|
|
@@ -1664,18 +1259,17 @@ var PlaceOrderSuccessView = ({
|
|
|
1664
1259
|
onDone,
|
|
1665
1260
|
onShare: _onShare
|
|
1666
1261
|
}) => {
|
|
1667
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j
|
|
1668
|
-
const [isExecutionDetailsExpanded, setIsExecutionDetailsExpanded] =
|
|
1262
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1263
|
+
const [isExecutionDetailsExpanded, setIsExecutionDetailsExpanded] = useState2(true);
|
|
1669
1264
|
const newTradeLabel = (_a = tradingLabels.orderNewTrade) != null ? _a : "New Trade";
|
|
1670
1265
|
const _shareLabel = (_b = tradingLabels.orderShare) != null ? _b : "Share";
|
|
1671
1266
|
const potentialReturnLabel = summary.potentialReturnLabel && tradingLabels.potentialReturnBonus ? tradingLabels.potentialReturnBonus(summary.potentialReturnLabel) : summary.potentialReturnLabel ? `+${summary.potentialReturnLabel} Better Payout` : null;
|
|
1672
|
-
const
|
|
1673
|
-
const
|
|
1674
|
-
const
|
|
1675
|
-
const
|
|
1676
|
-
const
|
|
1677
|
-
const
|
|
1678
|
-
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];
|
|
1679
1273
|
const detailedStepGroups = executionStepGroups.slice(0, -1);
|
|
1680
1274
|
const hasExecutionDetails = detailedStepGroups.length > 0;
|
|
1681
1275
|
const resolveStepIconName = (tone) => {
|
|
@@ -1684,36 +1278,23 @@ var PlaceOrderSuccessView = ({
|
|
|
1684
1278
|
const resolveStepIconClassName = (tone) => {
|
|
1685
1279
|
return tone === "warning" || tone === "error" ? "text-agg-warning" : "text-agg-primary";
|
|
1686
1280
|
};
|
|
1687
|
-
return /* @__PURE__ */
|
|
1688
|
-
summary.eventTitle ? /* @__PURE__ */
|
|
1689
|
-
/* @__PURE__ */
|
|
1690
|
-
/* @__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(
|
|
1691
1285
|
RemoteImage,
|
|
1692
1286
|
{
|
|
1693
|
-
src: (
|
|
1287
|
+
src: (_i = summary.eventImage) != null ? _i : null,
|
|
1694
1288
|
alt: "",
|
|
1695
1289
|
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
1696
1290
|
}
|
|
1697
1291
|
),
|
|
1698
|
-
/* @__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 })
|
|
1699
1293
|
] }),
|
|
1700
|
-
summary.eventDateLabel ? /* @__PURE__ */
|
|
1294
|
+
summary.eventDateLabel ? /* @__PURE__ */ jsx3("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventDateLabel }) : null
|
|
1701
1295
|
] }) : null,
|
|
1702
|
-
/* @__PURE__ */
|
|
1703
|
-
|
|
1704
|
-
{
|
|
1705
|
-
className: cn(
|
|
1706
|
-
"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",
|
|
1707
|
-
resolvedActionTone === "positive" ? "bg-agg-success" : "bg-agg-error"
|
|
1708
|
-
),
|
|
1709
|
-
children: [
|
|
1710
|
-
/* @__PURE__ */ jsx4(Icon, { name: "success-check", size: "small", className: "h-4 w-4 shrink-0 text-current" }),
|
|
1711
|
-
/* @__PURE__ */ jsx4("span", { children: resolvedActionLabel })
|
|
1712
|
-
]
|
|
1713
|
-
}
|
|
1714
|
-
),
|
|
1715
|
-
executionStepGroups.length > 0 ? /* @__PURE__ */ jsxs3("div", { className: "agg-order-success-timeline flex flex-col gap-2", children: [
|
|
1716
|
-
/* @__PURE__ */ jsx4(
|
|
1296
|
+
executionStepGroups.length > 0 ? /* @__PURE__ */ jsxs2("div", { className: "agg-order-success-timeline flex flex-col gap-2", children: [
|
|
1297
|
+
/* @__PURE__ */ jsx3(
|
|
1717
1298
|
"div",
|
|
1718
1299
|
{
|
|
1719
1300
|
"aria-hidden": !isExecutionDetailsExpanded,
|
|
@@ -1726,12 +1307,12 @@ var PlaceOrderSuccessView = ({
|
|
|
1726
1307
|
"transition-[grid-template-rows,opacity] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
1727
1308
|
)
|
|
1728
1309
|
),
|
|
1729
|
-
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(
|
|
1730
1311
|
"div",
|
|
1731
1312
|
{
|
|
1732
1313
|
className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
1733
1314
|
children: [
|
|
1734
|
-
/* @__PURE__ */
|
|
1315
|
+
/* @__PURE__ */ jsx3(
|
|
1735
1316
|
Icon,
|
|
1736
1317
|
{
|
|
1737
1318
|
name: resolveStepIconName(step.tone),
|
|
@@ -1740,8 +1321,8 @@ var PlaceOrderSuccessView = ({
|
|
|
1740
1321
|
"aria-hidden": "true"
|
|
1741
1322
|
}
|
|
1742
1323
|
),
|
|
1743
|
-
/* @__PURE__ */
|
|
1744
|
-
step.venue ? /* @__PURE__ */
|
|
1324
|
+
/* @__PURE__ */ jsx3("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
1325
|
+
step.venue ? /* @__PURE__ */ jsx3(
|
|
1745
1326
|
VenueLogo,
|
|
1746
1327
|
{
|
|
1747
1328
|
venue: step.venue,
|
|
@@ -1755,7 +1336,7 @@ var PlaceOrderSuccessView = ({
|
|
|
1755
1336
|
)) }, `execution-group-${groupIndex}`)) }) })
|
|
1756
1337
|
}
|
|
1757
1338
|
),
|
|
1758
|
-
finalStep ? hasExecutionDetails ? /* @__PURE__ */
|
|
1339
|
+
finalStep ? hasExecutionDetails ? /* @__PURE__ */ jsxs2(
|
|
1759
1340
|
"button",
|
|
1760
1341
|
{
|
|
1761
1342
|
type: "button",
|
|
@@ -1767,7 +1348,7 @@ var PlaceOrderSuccessView = ({
|
|
|
1767
1348
|
),
|
|
1768
1349
|
onClick: () => setIsExecutionDetailsExpanded((currentValue) => !currentValue),
|
|
1769
1350
|
children: [
|
|
1770
|
-
/* @__PURE__ */
|
|
1351
|
+
/* @__PURE__ */ jsx3(
|
|
1771
1352
|
Icon,
|
|
1772
1353
|
{
|
|
1773
1354
|
name: resolveStepIconName(finalStep.tone),
|
|
@@ -1776,8 +1357,8 @@ var PlaceOrderSuccessView = ({
|
|
|
1776
1357
|
"aria-hidden": "true"
|
|
1777
1358
|
}
|
|
1778
1359
|
),
|
|
1779
|
-
/* @__PURE__ */
|
|
1780
|
-
/* @__PURE__ */
|
|
1360
|
+
/* @__PURE__ */ jsx3("p", { className: "min-w-0 flex-1", children: finalStep.label }),
|
|
1361
|
+
/* @__PURE__ */ jsx3(
|
|
1781
1362
|
Icon,
|
|
1782
1363
|
{
|
|
1783
1364
|
name: isExecutionDetailsExpanded ? "chevron-up" : "chevron-down",
|
|
@@ -1788,8 +1369,8 @@ var PlaceOrderSuccessView = ({
|
|
|
1788
1369
|
)
|
|
1789
1370
|
]
|
|
1790
1371
|
}
|
|
1791
|
-
) : /* @__PURE__ */
|
|
1792
|
-
/* @__PURE__ */
|
|
1372
|
+
) : /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
1373
|
+
/* @__PURE__ */ jsx3(
|
|
1793
1374
|
Icon,
|
|
1794
1375
|
{
|
|
1795
1376
|
name: resolveStepIconName(finalStep.tone),
|
|
@@ -1798,22 +1379,34 @@ var PlaceOrderSuccessView = ({
|
|
|
1798
1379
|
"aria-hidden": "true"
|
|
1799
1380
|
}
|
|
1800
1381
|
),
|
|
1801
|
-
/* @__PURE__ */
|
|
1382
|
+
/* @__PURE__ */ jsx3("p", { className: "min-w-0 flex-1", children: finalStep.label })
|
|
1802
1383
|
] }) : null
|
|
1803
1384
|
] }) : null,
|
|
1804
|
-
/* @__PURE__ */
|
|
1805
|
-
|
|
1806
|
-
|
|
1385
|
+
/* @__PURE__ */ jsxs2(
|
|
1386
|
+
"div",
|
|
1387
|
+
{
|
|
1388
|
+
className: cn(
|
|
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"
|
|
1390
|
+
),
|
|
1391
|
+
children: [
|
|
1392
|
+
/* @__PURE__ */ jsx3(Icon, { name: "success-check", size: "small", className: "h-4 w-4 shrink-0 text-current" }),
|
|
1393
|
+
/* @__PURE__ */ jsx3("span", { children: resolvedActionLabel })
|
|
1394
|
+
]
|
|
1395
|
+
}
|
|
1396
|
+
),
|
|
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 })
|
|
1807
1400
|
] }),
|
|
1808
|
-
/* @__PURE__ */
|
|
1809
|
-
/* @__PURE__ */
|
|
1810
|
-
/* @__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 })
|
|
1811
1404
|
] }),
|
|
1812
|
-
summary.potentialReturnLabel ? /* @__PURE__ */
|
|
1813
|
-
/* @__PURE__ */
|
|
1814
|
-
/* @__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" })
|
|
1815
1408
|
] }) : null,
|
|
1816
|
-
/* @__PURE__ */
|
|
1409
|
+
/* @__PURE__ */ jsx3("div", { className: "agg-order-success-actions flex gap-3", children: /* @__PURE__ */ jsx3(
|
|
1817
1410
|
Button,
|
|
1818
1411
|
{
|
|
1819
1412
|
variant: "secondary",
|
|
@@ -1829,7 +1422,7 @@ var PlaceOrderSuccessView = ({
|
|
|
1829
1422
|
PlaceOrderSuccessView.displayName = "PlaceOrderSuccessView";
|
|
1830
1423
|
|
|
1831
1424
|
// src/trading/place-order/index.tsx
|
|
1832
|
-
import { Fragment as
|
|
1425
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1833
1426
|
var DEFAULT_STEP_LABELS = {
|
|
1834
1427
|
"check-balance": "Checking balance",
|
|
1835
1428
|
"check-position": "Checking position",
|
|
@@ -1855,7 +1448,7 @@ var LoadingGlyph = ({
|
|
|
1855
1448
|
className,
|
|
1856
1449
|
enableAnimations
|
|
1857
1450
|
}) => {
|
|
1858
|
-
return /* @__PURE__ */
|
|
1451
|
+
return /* @__PURE__ */ jsx4(
|
|
1859
1452
|
"span",
|
|
1860
1453
|
{
|
|
1861
1454
|
"aria-hidden": "true",
|
|
@@ -1875,25 +1468,25 @@ var PlaceOrderSlippageControl = ({
|
|
|
1875
1468
|
minimumValue: slippageMinimumValue
|
|
1876
1469
|
}) => {
|
|
1877
1470
|
var _a, _b;
|
|
1878
|
-
const labels =
|
|
1879
|
-
const containerRef =
|
|
1880
|
-
const triggerRef =
|
|
1881
|
-
const inputRef =
|
|
1471
|
+
const labels = useLabels();
|
|
1472
|
+
const containerRef = useRef2(null);
|
|
1473
|
+
const triggerRef = useRef2(null);
|
|
1474
|
+
const inputRef = useRef2(null);
|
|
1882
1475
|
const warningId = useId();
|
|
1883
1476
|
const defaultValue = finalizePercentageValue(slippageDefaultValue);
|
|
1884
1477
|
const committedValue = finalizePercentageValue(slippageValue) || defaultValue;
|
|
1885
|
-
const [draftValue, setDraftValue] =
|
|
1886
|
-
const [isEditing, setIsEditing] =
|
|
1478
|
+
const [draftValue, setDraftValue] = useState3(committedValue);
|
|
1479
|
+
const [isEditing, setIsEditing] = useState3(
|
|
1887
1480
|
() => isPercentageBelowMinimum(committedValue, slippageMinimumValue)
|
|
1888
1481
|
);
|
|
1889
|
-
const [shouldFocusInput, setShouldFocusInput] =
|
|
1890
|
-
|
|
1482
|
+
const [shouldFocusInput, setShouldFocusInput] = useState3(false);
|
|
1483
|
+
useEffect2(() => {
|
|
1891
1484
|
setDraftValue(committedValue);
|
|
1892
1485
|
if (isPercentageBelowMinimum(committedValue, slippageMinimumValue)) {
|
|
1893
1486
|
setIsEditing(true);
|
|
1894
1487
|
}
|
|
1895
1488
|
}, [committedValue, slippageMinimumValue]);
|
|
1896
|
-
|
|
1489
|
+
useEffect2(() => {
|
|
1897
1490
|
if (!shouldFocusInput) return;
|
|
1898
1491
|
requestAnimationFrame(() => {
|
|
1899
1492
|
var _a2, _b2;
|
|
@@ -1910,7 +1503,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
1910
1503
|
Number(committedValue || slippageDefaultValue || DEFAULT_SLIPPAGE_VALUE)
|
|
1911
1504
|
);
|
|
1912
1505
|
const resolvedAutoLabel = labels.trading.resetSlippage;
|
|
1913
|
-
const resolvedWarningMessage =
|
|
1506
|
+
const resolvedWarningMessage = useMemo2(() => {
|
|
1914
1507
|
if (isLowSlippage) {
|
|
1915
1508
|
return labels.trading.slippageLow(slippageMinimumValue);
|
|
1916
1509
|
}
|
|
@@ -1973,8 +1566,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
1973
1566
|
if (!isEditing) return;
|
|
1974
1567
|
handleCommitDraft(false);
|
|
1975
1568
|
};
|
|
1976
|
-
return /* @__PURE__ */
|
|
1977
|
-
/* @__PURE__ */
|
|
1569
|
+
return /* @__PURE__ */ jsxs3("div", { ref: containerRef, className: "agg-slippage-control w-full", onBlur: handleContainerBlur, children: [
|
|
1570
|
+
/* @__PURE__ */ jsxs3(
|
|
1978
1571
|
"button",
|
|
1979
1572
|
{
|
|
1980
1573
|
ref: triggerRef,
|
|
@@ -1992,8 +1585,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
1992
1585
|
),
|
|
1993
1586
|
onClick: handleToggleEditing,
|
|
1994
1587
|
children: [
|
|
1995
|
-
/* @__PURE__ */
|
|
1996
|
-
/* @__PURE__ */
|
|
1588
|
+
/* @__PURE__ */ jsx4("span", { className: "agg-slippage-label", children: collapsedLabel }),
|
|
1589
|
+
/* @__PURE__ */ jsx4(
|
|
1997
1590
|
Icon,
|
|
1998
1591
|
{
|
|
1999
1592
|
name: isEditing ? "chevron-up" : "pencil",
|
|
@@ -2005,7 +1598,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
2005
1598
|
]
|
|
2006
1599
|
}
|
|
2007
1600
|
),
|
|
2008
|
-
/* @__PURE__ */
|
|
1601
|
+
/* @__PURE__ */ jsx4(
|
|
2009
1602
|
"div",
|
|
2010
1603
|
{
|
|
2011
1604
|
"aria-hidden": !isEditing,
|
|
@@ -2019,10 +1612,10 @@ var PlaceOrderSlippageControl = ({
|
|
|
2019
1612
|
"transition-[grid-template-rows,opacity,margin-top] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
2020
1613
|
)
|
|
2021
1614
|
),
|
|
2022
|
-
children: /* @__PURE__ */
|
|
2023
|
-
/* @__PURE__ */
|
|
2024
|
-
/* @__PURE__ */
|
|
2025
|
-
/* @__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(
|
|
2026
1619
|
"input",
|
|
2027
1620
|
{
|
|
2028
1621
|
ref: inputRef,
|
|
@@ -2037,7 +1630,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
2037
1630
|
onKeyDown: handleInputKeyDown
|
|
2038
1631
|
}
|
|
2039
1632
|
),
|
|
2040
|
-
/* @__PURE__ */
|
|
1633
|
+
/* @__PURE__ */ jsx4(
|
|
2041
1634
|
"button",
|
|
2042
1635
|
{
|
|
2043
1636
|
type: "button",
|
|
@@ -2055,8 +1648,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
2055
1648
|
}
|
|
2056
1649
|
)
|
|
2057
1650
|
] }),
|
|
2058
|
-
/* @__PURE__ */
|
|
2059
|
-
/* @__PURE__ */
|
|
1651
|
+
/* @__PURE__ */ jsx4("div", { className: "h-full w-px bg-agg-separator", "aria-hidden": "true" }),
|
|
1652
|
+
/* @__PURE__ */ jsx4(
|
|
2060
1653
|
"div",
|
|
2061
1654
|
{
|
|
2062
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",
|
|
@@ -2065,7 +1658,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
2065
1658
|
}
|
|
2066
1659
|
)
|
|
2067
1660
|
] }),
|
|
2068
|
-
/* @__PURE__ */
|
|
1661
|
+
/* @__PURE__ */ jsx4(
|
|
2069
1662
|
"div",
|
|
2070
1663
|
{
|
|
2071
1664
|
"aria-hidden": !resolvedWarningMessage,
|
|
@@ -2079,13 +1672,13 @@ var PlaceOrderSlippageControl = ({
|
|
|
2079
1672
|
"transition-[grid-template-rows,opacity] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
2080
1673
|
)
|
|
2081
1674
|
),
|
|
2082
|
-
children: /* @__PURE__ */
|
|
1675
|
+
children: /* @__PURE__ */ jsx4("div", { className: "min-h-0", children: /* @__PURE__ */ jsxs3(
|
|
2083
1676
|
"div",
|
|
2084
1677
|
{
|
|
2085
1678
|
id: warningId,
|
|
2086
1679
|
className: "agg-slippage-warning-message flex items-start gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
2087
1680
|
children: [
|
|
2088
|
-
/* @__PURE__ */
|
|
1681
|
+
/* @__PURE__ */ jsx4(
|
|
2089
1682
|
Icon,
|
|
2090
1683
|
{
|
|
2091
1684
|
name: "warning-filled",
|
|
@@ -2094,7 +1687,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
2094
1687
|
color: "currentColor"
|
|
2095
1688
|
}
|
|
2096
1689
|
),
|
|
2097
|
-
/* @__PURE__ */
|
|
1690
|
+
/* @__PURE__ */ jsx4("p", { children: resolvedWarningMessage != null ? resolvedWarningMessage : "" })
|
|
2098
1691
|
]
|
|
2099
1692
|
}
|
|
2100
1693
|
) })
|
|
@@ -2114,9 +1707,9 @@ var renderCardHeader = ({
|
|
|
2114
1707
|
onClose
|
|
2115
1708
|
}) => {
|
|
2116
1709
|
if (!headerTitle) return null;
|
|
2117
|
-
return /* @__PURE__ */
|
|
2118
|
-
/* @__PURE__ */
|
|
2119
|
-
/* @__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(
|
|
2120
1713
|
RemoteImage,
|
|
2121
1714
|
{
|
|
2122
1715
|
src: headerImage,
|
|
@@ -2124,19 +1717,19 @@ var renderCardHeader = ({
|
|
|
2124
1717
|
className: "agg-order-market-image h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
2125
1718
|
}
|
|
2126
1719
|
),
|
|
2127
|
-
/* @__PURE__ */
|
|
2128
|
-
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(
|
|
2129
1722
|
"button",
|
|
2130
1723
|
{
|
|
2131
1724
|
type: "button",
|
|
2132
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",
|
|
2133
1726
|
"aria-label": "Close",
|
|
2134
1727
|
onClick: onClose,
|
|
2135
|
-
children: /* @__PURE__ */
|
|
1728
|
+
children: /* @__PURE__ */ jsx4(CloseIcon, { className: "h-5 w-5" })
|
|
2136
1729
|
}
|
|
2137
1730
|
) : null
|
|
2138
1731
|
] }),
|
|
2139
|
-
headerSubtitle ? /* @__PURE__ */
|
|
1732
|
+
headerSubtitle ? /* @__PURE__ */ jsx4("p", { className: "agg-order-market-subtitle text-agg-base leading-agg-6 text-agg-foreground", children: headerSubtitle }) : null
|
|
2140
1733
|
] });
|
|
2141
1734
|
};
|
|
2142
1735
|
var PlaceOrderResolvedView = ({
|
|
@@ -2146,7 +1739,7 @@ var PlaceOrderResolvedView = ({
|
|
|
2146
1739
|
className
|
|
2147
1740
|
}) => {
|
|
2148
1741
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2149
|
-
const labels =
|
|
1742
|
+
const labels = useLabels();
|
|
2150
1743
|
const tradingLabels = labels.trading;
|
|
2151
1744
|
const extendedTradingLabels = tradingLabels;
|
|
2152
1745
|
const winningOutcomeLabel = (_c = (_b = (_a = tradingState.winningOutcome) == null ? void 0 : _a.label) == null ? void 0 : _b.trim().toLowerCase()) != null ? _c : "";
|
|
@@ -2156,7 +1749,7 @@ var PlaceOrderResolvedView = ({
|
|
|
2156
1749
|
const resolvedIconName = isPositiveWinningOutcome ? "success-check" : "close";
|
|
2157
1750
|
const resolvedIconToneClassName = isPositiveWinningOutcome ? "text-agg-success" : "text-agg-error";
|
|
2158
1751
|
const resolvedIconContainerClassName = isPositiveWinningOutcome ? "bg-agg-success/15" : "bg-agg-error/15";
|
|
2159
|
-
return /* @__PURE__ */
|
|
1752
|
+
return /* @__PURE__ */ jsx4(
|
|
2160
1753
|
Card,
|
|
2161
1754
|
{
|
|
2162
1755
|
className: cn(
|
|
@@ -2165,7 +1758,7 @@ var PlaceOrderResolvedView = ({
|
|
|
2165
1758
|
classNames == null ? void 0 : classNames.root,
|
|
2166
1759
|
className
|
|
2167
1760
|
),
|
|
2168
|
-
children: /* @__PURE__ */
|
|
1761
|
+
children: /* @__PURE__ */ jsxs3(
|
|
2169
1762
|
"div",
|
|
2170
1763
|
{
|
|
2171
1764
|
className: cn(
|
|
@@ -2173,17 +1766,17 @@ var PlaceOrderResolvedView = ({
|
|
|
2173
1766
|
classNames == null ? void 0 : classNames.body
|
|
2174
1767
|
),
|
|
2175
1768
|
children: [
|
|
2176
|
-
/* @__PURE__ */
|
|
1769
|
+
/* @__PURE__ */ jsx4(
|
|
2177
1770
|
"div",
|
|
2178
1771
|
{
|
|
2179
1772
|
className: cn(
|
|
2180
1773
|
"flex h-15 w-15 items-center justify-center rounded-full",
|
|
2181
1774
|
resolvedIconContainerClassName
|
|
2182
1775
|
),
|
|
2183
|
-
children: /* @__PURE__ */
|
|
1776
|
+
children: /* @__PURE__ */ jsx4(Icon, { name: resolvedIconName, className: cn("h-6 w-6", resolvedIconToneClassName) })
|
|
2184
1777
|
}
|
|
2185
1778
|
),
|
|
2186
|
-
/* @__PURE__ */
|
|
1779
|
+
/* @__PURE__ */ jsxs3(
|
|
2187
1780
|
"div",
|
|
2188
1781
|
{
|
|
2189
1782
|
className: cn(
|
|
@@ -2191,30 +1784,30 @@ var PlaceOrderResolvedView = ({
|
|
|
2191
1784
|
classNames == null ? void 0 : classNames.content
|
|
2192
1785
|
),
|
|
2193
1786
|
children: [
|
|
2194
|
-
tradingState.market ? /* @__PURE__ */
|
|
2195
|
-
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
|
|
2196
1789
|
]
|
|
2197
1790
|
}
|
|
2198
1791
|
),
|
|
2199
|
-
resolvedClaim ? /* @__PURE__ */
|
|
2200
|
-
/* @__PURE__ */
|
|
2201
|
-
/* @__PURE__ */
|
|
2202
|
-
/* @__PURE__ */
|
|
2203
|
-
/* @__PURE__ */
|
|
2204
|
-
/* @__PURE__ */
|
|
2205
|
-
/* @__PURE__ */
|
|
2206
|
-
/* @__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 })
|
|
2207
1800
|
] }),
|
|
2208
|
-
/* @__PURE__ */
|
|
2209
|
-
/* @__PURE__ */
|
|
2210
|
-
/* @__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 })
|
|
2211
1804
|
] }),
|
|
2212
|
-
/* @__PURE__ */
|
|
2213
|
-
/* @__PURE__ */
|
|
2214
|
-
/* @__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 })
|
|
2215
1808
|
] })
|
|
2216
1809
|
] }),
|
|
2217
|
-
resolvedClaim.onClaim ? /* @__PURE__ */
|
|
1810
|
+
resolvedClaim.onClaim ? /* @__PURE__ */ jsx4(
|
|
2218
1811
|
Button,
|
|
2219
1812
|
{
|
|
2220
1813
|
size: "large",
|
|
@@ -2236,18 +1829,18 @@ var renderRouteBreakdownRow = (row) => {
|
|
|
2236
1829
|
var _a, _b;
|
|
2237
1830
|
const venueLabel = getTradingVenueLabel(row.venue);
|
|
2238
1831
|
const rowKey = `${row.venue}-${row.label}-${row.priceLabel}-${(_a = row.resultLabel) != null ? _a : ""}`;
|
|
2239
|
-
return /* @__PURE__ */
|
|
1832
|
+
return /* @__PURE__ */ jsxs3(
|
|
2240
1833
|
"div",
|
|
2241
1834
|
{
|
|
2242
1835
|
className: "agg-route-breakdown-row flex items-center justify-between gap-4 text-left",
|
|
2243
1836
|
children: [
|
|
2244
|
-
/* @__PURE__ */
|
|
2245
|
-
/* @__PURE__ */
|
|
2246
|
-
/* @__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 })
|
|
2247
1840
|
] }),
|
|
2248
|
-
/* @__PURE__ */
|
|
2249
|
-
/* @__PURE__ */
|
|
2250
|
-
/* @__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 : "" })
|
|
2251
1844
|
] })
|
|
2252
1845
|
]
|
|
2253
1846
|
},
|
|
@@ -2266,7 +1859,7 @@ var renderRouteCard = ({
|
|
|
2266
1859
|
const showSplitDetails = isSelected && isExpanded && card.kind === "split" && !!((_a = card.rows) == null ? void 0 : _a.length);
|
|
2267
1860
|
const valueLabel = card.isUnavailable ? tradingLabels.venueUnavailableInRegion : card.value;
|
|
2268
1861
|
const ariaLabel = [card.label, card.hint, valueLabel].filter(Boolean).join(" ");
|
|
2269
|
-
return /* @__PURE__ */
|
|
1862
|
+
return /* @__PURE__ */ jsxs3(
|
|
2270
1863
|
"button",
|
|
2271
1864
|
{
|
|
2272
1865
|
type: "button",
|
|
@@ -2286,11 +1879,11 @@ var renderRouteCard = ({
|
|
|
2286
1879
|
),
|
|
2287
1880
|
onClick: () => onSelect(card.id),
|
|
2288
1881
|
children: [
|
|
2289
|
-
isSelected && !card.isUnavailable ? /* @__PURE__ */
|
|
2290
|
-
/* @__PURE__ */
|
|
2291
|
-
/* @__PURE__ */
|
|
2292
|
-
/* @__PURE__ */
|
|
2293
|
-
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(
|
|
2294
1887
|
Icon,
|
|
2295
1888
|
{
|
|
2296
1889
|
name: "sparkles-filled",
|
|
@@ -2301,7 +1894,7 @@ var renderRouteCard = ({
|
|
|
2301
1894
|
),
|
|
2302
1895
|
"aria-hidden": "true"
|
|
2303
1896
|
}
|
|
2304
|
-
) : card.venue ? /* @__PURE__ */
|
|
1897
|
+
) : card.venue ? /* @__PURE__ */ jsx4(
|
|
2305
1898
|
VenueLogo,
|
|
2306
1899
|
{
|
|
2307
1900
|
venue: card.venue,
|
|
@@ -2309,10 +1902,10 @@ var renderRouteCard = ({
|
|
|
2309
1902
|
ariaLabel: getTradingVenueLabel(card.venue)
|
|
2310
1903
|
}
|
|
2311
1904
|
) : null,
|
|
2312
|
-
/* @__PURE__ */
|
|
2313
|
-
/* @__PURE__ */
|
|
2314
|
-
/* @__PURE__ */
|
|
2315
|
-
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(
|
|
2316
1909
|
Icon,
|
|
2317
1910
|
{
|
|
2318
1911
|
name: showSplitDetails ? "chevron-up" : "chevron-down",
|
|
@@ -2322,10 +1915,10 @@ var renderRouteCard = ({
|
|
|
2322
1915
|
}
|
|
2323
1916
|
) : null
|
|
2324
1917
|
] }),
|
|
2325
|
-
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
|
|
2326
1919
|
] })
|
|
2327
1920
|
] }),
|
|
2328
|
-
/* @__PURE__ */
|
|
1921
|
+
/* @__PURE__ */ jsx4(
|
|
2329
1922
|
"p",
|
|
2330
1923
|
{
|
|
2331
1924
|
className: cn(
|
|
@@ -2337,9 +1930,9 @@ var renderRouteCard = ({
|
|
|
2337
1930
|
}
|
|
2338
1931
|
)
|
|
2339
1932
|
] }),
|
|
2340
|
-
showSplitDetails ? /* @__PURE__ */
|
|
2341
|
-
/* @__PURE__ */
|
|
2342
|
-
/* @__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)) })
|
|
2343
1936
|
] }) : null
|
|
2344
1937
|
] })
|
|
2345
1938
|
]
|
|
@@ -2433,7 +2026,7 @@ var renderSubmissionSurface = ({
|
|
|
2433
2026
|
];
|
|
2434
2027
|
};
|
|
2435
2028
|
const stepGroups = resolveStepGroups();
|
|
2436
|
-
return /* @__PURE__ */
|
|
2029
|
+
return /* @__PURE__ */ jsx4(
|
|
2437
2030
|
Card,
|
|
2438
2031
|
{
|
|
2439
2032
|
className: cn(
|
|
@@ -2442,30 +2035,30 @@ var renderSubmissionSurface = ({
|
|
|
2442
2035
|
classNames == null ? void 0 : classNames.root,
|
|
2443
2036
|
className
|
|
2444
2037
|
),
|
|
2445
|
-
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: [
|
|
2446
2039
|
renderCardHeader({
|
|
2447
2040
|
className: classNames == null ? void 0 : classNames.header,
|
|
2448
2041
|
headerSubtitle,
|
|
2449
2042
|
headerImage,
|
|
2450
2043
|
headerTitle
|
|
2451
2044
|
}),
|
|
2452
|
-
/* @__PURE__ */
|
|
2453
|
-
/* @__PURE__ */
|
|
2454
|
-
/* @__PURE__ */
|
|
2455
|
-
/* @__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 })
|
|
2456
2049
|
] }),
|
|
2457
|
-
/* @__PURE__ */
|
|
2458
|
-
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(
|
|
2459
2052
|
"div",
|
|
2460
2053
|
{
|
|
2461
2054
|
className: "agg-order-submission-group flex flex-col gap-2",
|
|
2462
2055
|
children: steps.map((step) => {
|
|
2463
|
-
return /* @__PURE__ */
|
|
2056
|
+
return /* @__PURE__ */ jsxs3(
|
|
2464
2057
|
"div",
|
|
2465
2058
|
{
|
|
2466
2059
|
className: "agg-order-submission-step flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
2467
2060
|
children: [
|
|
2468
|
-
step.status === "complete" ? /* @__PURE__ */
|
|
2061
|
+
step.status === "complete" ? /* @__PURE__ */ jsx4(
|
|
2469
2062
|
Icon,
|
|
2470
2063
|
{
|
|
2471
2064
|
name: "check-circle",
|
|
@@ -2473,15 +2066,15 @@ var renderSubmissionSurface = ({
|
|
|
2473
2066
|
className: "h-3 w-3 shrink-0 text-agg-primary",
|
|
2474
2067
|
"aria-hidden": "true"
|
|
2475
2068
|
}
|
|
2476
|
-
) : /* @__PURE__ */
|
|
2069
|
+
) : /* @__PURE__ */ jsx4(
|
|
2477
2070
|
LoadingGlyph,
|
|
2478
2071
|
{
|
|
2479
2072
|
enableAnimations,
|
|
2480
2073
|
className: "h-3 w-3 shrink-0 text-agg-primary"
|
|
2481
2074
|
}
|
|
2482
2075
|
),
|
|
2483
|
-
/* @__PURE__ */
|
|
2484
|
-
step.venue ? /* @__PURE__ */
|
|
2076
|
+
/* @__PURE__ */ jsx4("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
2077
|
+
step.venue ? /* @__PURE__ */ jsx4(
|
|
2485
2078
|
VenueLogo,
|
|
2486
2079
|
{
|
|
2487
2080
|
venue: step.venue,
|
|
@@ -2504,13 +2097,13 @@ var renderSubmissionSurface = ({
|
|
|
2504
2097
|
}
|
|
2505
2098
|
);
|
|
2506
2099
|
};
|
|
2507
|
-
var InitiateKycButton = ({ label, onOpen }) => /* @__PURE__ */
|
|
2100
|
+
var InitiateKycButton = ({ label, onOpen }) => /* @__PURE__ */ jsx4(
|
|
2508
2101
|
Button,
|
|
2509
2102
|
{
|
|
2510
2103
|
size: "large",
|
|
2511
2104
|
variant: "primary",
|
|
2512
2105
|
onClick: onOpen,
|
|
2513
|
-
className: "agg-order-kyc-action h-12 w-full px-8 text-agg-base leading-agg-6 shadow-none
|
|
2106
|
+
className: "agg-order-kyc-action h-12 w-full px-8 text-agg-base leading-agg-6 shadow-none",
|
|
2514
2107
|
children: label
|
|
2515
2108
|
}
|
|
2516
2109
|
);
|
|
@@ -2521,35 +2114,35 @@ var KycVerifyModal = ({
|
|
|
2521
2114
|
isInitiating,
|
|
2522
2115
|
labels
|
|
2523
2116
|
}) => {
|
|
2524
|
-
return /* @__PURE__ */
|
|
2117
|
+
return /* @__PURE__ */ jsx4(
|
|
2525
2118
|
Modal,
|
|
2526
2119
|
{
|
|
2527
2120
|
open,
|
|
2528
2121
|
onOpenChange: (next) => {
|
|
2529
2122
|
onOpenChange(next);
|
|
2530
2123
|
},
|
|
2531
|
-
children: /* @__PURE__ */
|
|
2532
|
-
/* @__PURE__ */
|
|
2533
|
-
/* @__PURE__ */
|
|
2534
|
-
/* @__PURE__ */
|
|
2535
|
-
/* @__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(
|
|
2536
2129
|
"button",
|
|
2537
2130
|
{
|
|
2538
2131
|
type: "button",
|
|
2539
2132
|
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
2540
2133
|
onClick: () => onOpenChange(false),
|
|
2541
2134
|
"aria-label": "Close",
|
|
2542
|
-
children: /* @__PURE__ */
|
|
2135
|
+
children: /* @__PURE__ */ jsx4(CloseIcon, { className: "h-6 w-6" })
|
|
2543
2136
|
}
|
|
2544
2137
|
),
|
|
2545
|
-
/* @__PURE__ */
|
|
2546
|
-
/* @__PURE__ */
|
|
2547
|
-
/* @__PURE__ */
|
|
2548
|
-
/* @__PURE__ */
|
|
2549
|
-
/* @__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 })
|
|
2550
2143
|
] }),
|
|
2551
|
-
/* @__PURE__ */
|
|
2552
|
-
/* @__PURE__ */
|
|
2144
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex w-full flex-col items-center gap-5", children: [
|
|
2145
|
+
/* @__PURE__ */ jsx4(
|
|
2553
2146
|
Button,
|
|
2554
2147
|
{
|
|
2555
2148
|
size: "large",
|
|
@@ -2560,7 +2153,7 @@ var KycVerifyModal = ({
|
|
|
2560
2153
|
children: labels.startVerification
|
|
2561
2154
|
}
|
|
2562
2155
|
),
|
|
2563
|
-
/* @__PURE__ */
|
|
2156
|
+
/* @__PURE__ */ jsx4(
|
|
2564
2157
|
"button",
|
|
2565
2158
|
{
|
|
2566
2159
|
type: "button",
|
|
@@ -2580,27 +2173,27 @@ var KycSuccessModal = ({
|
|
|
2580
2173
|
open,
|
|
2581
2174
|
onOpenChange,
|
|
2582
2175
|
labels
|
|
2583
|
-
}) => /* @__PURE__ */
|
|
2584
|
-
/* @__PURE__ */
|
|
2585
|
-
/* @__PURE__ */
|
|
2586
|
-
/* @__PURE__ */
|
|
2587
|
-
/* @__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(
|
|
2588
2181
|
"button",
|
|
2589
2182
|
{
|
|
2590
2183
|
type: "button",
|
|
2591
2184
|
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
2592
2185
|
onClick: () => onOpenChange(false),
|
|
2593
2186
|
"aria-label": "Close",
|
|
2594
|
-
children: /* @__PURE__ */
|
|
2187
|
+
children: /* @__PURE__ */ jsx4(CloseIcon, { className: "h-6 w-6" })
|
|
2595
2188
|
}
|
|
2596
2189
|
),
|
|
2597
|
-
/* @__PURE__ */
|
|
2598
|
-
/* @__PURE__ */
|
|
2599
|
-
/* @__PURE__ */
|
|
2600
|
-
/* @__PURE__ */
|
|
2601
|
-
/* @__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 })
|
|
2602
2195
|
] }),
|
|
2603
|
-
/* @__PURE__ */
|
|
2196
|
+
/* @__PURE__ */ jsx4(
|
|
2604
2197
|
Button,
|
|
2605
2198
|
{
|
|
2606
2199
|
variant: "secondary",
|
|
@@ -2636,18 +2229,18 @@ var PlaceOrder = ({
|
|
|
2636
2229
|
const {
|
|
2637
2230
|
features: { enableAnimations },
|
|
2638
2231
|
general: { locale }
|
|
2639
|
-
} =
|
|
2640
|
-
const labels =
|
|
2232
|
+
} = useSdkUiConfig();
|
|
2233
|
+
const labels = useLabels();
|
|
2641
2234
|
const tradingLabels = labels.trading;
|
|
2642
2235
|
const { isTradingBlocked } = useGeoBlock();
|
|
2643
2236
|
const tradingContext = useEventTradingContext2();
|
|
2644
2237
|
const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
|
|
2645
2238
|
const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
|
|
2646
2239
|
const selectedOutcomeId = (_c = tradingContext == null ? void 0 : tradingContext.selectedOutcomeId) != null ? _c : null;
|
|
2647
|
-
const resolvedEventTradingState =
|
|
2240
|
+
const resolvedEventTradingState = useMemo2(() => {
|
|
2648
2241
|
return eventTradingState != null ? eventTradingState : resolveEventTradingState(selectedEvent);
|
|
2649
2242
|
}, [eventTradingState, selectedEvent]);
|
|
2650
|
-
const scopedSelectedEvent =
|
|
2243
|
+
const scopedSelectedEvent = useMemo2(() => {
|
|
2651
2244
|
var _a2;
|
|
2652
2245
|
if (!selectedEvent) return null;
|
|
2653
2246
|
const primaryMarketId = (_a2 = resolvedEventTradingState.primaryMarket) == null ? void 0 : _a2.id;
|
|
@@ -2657,7 +2250,7 @@ var PlaceOrder = ({
|
|
|
2657
2250
|
);
|
|
2658
2251
|
return isSelectedEventInScope ? selectedEvent : null;
|
|
2659
2252
|
}, [(_d = resolvedEventTradingState.primaryMarket) == null ? void 0 : _d.id, selectedEvent]);
|
|
2660
|
-
const scopedSelectedMarket =
|
|
2253
|
+
const scopedSelectedMarket = useMemo2(() => {
|
|
2661
2254
|
if (!selectedMarket) return resolvedEventTradingState.primaryMarket;
|
|
2662
2255
|
const isSelectedMarketInScope = resolvedEventTradingState.marketStates.some(
|
|
2663
2256
|
(item) => item.market.id === selectedMarket.id
|
|
@@ -2672,10 +2265,10 @@ var PlaceOrder = ({
|
|
|
2672
2265
|
(outcome) => outcome.label.trim().toLowerCase() === "yes"
|
|
2673
2266
|
)) != null ? _f : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes[0]) != null ? _g : null;
|
|
2674
2267
|
const scopedSelectedOutcomeId = (_h = scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.id) != null ? _h : null;
|
|
2675
|
-
const resolvedTradingState =
|
|
2268
|
+
const resolvedTradingState = useMemo2(() => {
|
|
2676
2269
|
return resolveMarketTradingState(scopedSelectedMarket);
|
|
2677
2270
|
}, [scopedSelectedMarket]);
|
|
2678
|
-
const resolvedReadOnlyMarket =
|
|
2271
|
+
const resolvedReadOnlyMarket = useMemo2(() => {
|
|
2679
2272
|
var _a2;
|
|
2680
2273
|
if (resolvedEventTradingState.kind !== "resolved") {
|
|
2681
2274
|
return scopedSelectedMarket;
|
|
@@ -2686,10 +2279,10 @@ var PlaceOrder = ({
|
|
|
2686
2279
|
resolvedEventTradingState.primaryMarket,
|
|
2687
2280
|
scopedSelectedMarket
|
|
2688
2281
|
]);
|
|
2689
|
-
const resolvedReadOnlyTradingState =
|
|
2282
|
+
const resolvedReadOnlyTradingState = useMemo2(() => {
|
|
2690
2283
|
return resolveMarketTradingState(resolvedReadOnlyMarket);
|
|
2691
2284
|
}, [resolvedReadOnlyMarket]);
|
|
2692
|
-
const orderEligibility =
|
|
2285
|
+
const orderEligibility = useMemo2(
|
|
2693
2286
|
() => resolveOrderEligibility({
|
|
2694
2287
|
event: scopedSelectedEvent,
|
|
2695
2288
|
market: scopedSelectedMarket,
|
|
@@ -2707,22 +2300,31 @@ var PlaceOrder = ({
|
|
|
2707
2300
|
const livePrices = useLiveOutcomePrices(
|
|
2708
2301
|
scopedSelectedMarket ? [scopedSelectedMarket] : void 0
|
|
2709
2302
|
);
|
|
2710
|
-
const
|
|
2303
|
+
const midpointsClusterMarkets = useMemo2(() => {
|
|
2304
|
+
if (!scopedSelectedMarket) return [];
|
|
2305
|
+
return normalizeVenueMarketCluster(
|
|
2306
|
+
resolvedEventTradingState.displayMarkets,
|
|
2307
|
+
scopedSelectedMarket.id
|
|
2308
|
+
);
|
|
2309
|
+
}, [resolvedEventTradingState.displayMarkets, scopedSelectedMarket]);
|
|
2310
|
+
const { prices: clusterMidpoints } = useMidpoints(midpointsClusterMarkets);
|
|
2311
|
+
const outcomes = useMemo2(
|
|
2711
2312
|
() => mapVenueMarketOutcomesToPlaceOrderOutcomes(scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes),
|
|
2712
2313
|
[scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes]
|
|
2713
2314
|
);
|
|
2714
|
-
const buyTabRef =
|
|
2715
|
-
const sellTabRef =
|
|
2716
|
-
const [internalTab, setInternalTab] =
|
|
2717
|
-
const [internalAmount, setInternalAmount] =
|
|
2718
|
-
const [
|
|
2719
|
-
const [
|
|
2720
|
-
const [
|
|
2721
|
-
const [
|
|
2722
|
-
const [
|
|
2723
|
-
const [
|
|
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);
|
|
2724
2326
|
const debouncedAmount = useDebouncedValue(internalAmount, 300);
|
|
2725
|
-
const isSell =
|
|
2327
|
+
const isSell = useMemo2(() => internalTab === "sell", [internalTab]);
|
|
2726
2328
|
const {
|
|
2727
2329
|
positions: executionPositions,
|
|
2728
2330
|
isLoading: isExecutionPositionsLoading,
|
|
@@ -2743,7 +2345,7 @@ var PlaceOrder = ({
|
|
|
2743
2345
|
tradeSide: isSell ? "sell" : "buy",
|
|
2744
2346
|
enabled: debouncedAmount > 0 && orderEligibility.canPlaceOrder
|
|
2745
2347
|
});
|
|
2746
|
-
const currentSellableShares =
|
|
2348
|
+
const currentSellableShares = useMemo2(() => {
|
|
2747
2349
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
2748
2350
|
const sharesFromQuote = (_b2 = (_a2 = smartRoute.data) == null ? void 0 : _a2.positionAvailability) == null ? void 0 : _b2.totalSellableShares;
|
|
2749
2351
|
if (typeof sharesFromQuote === "number" && Number.isFinite(sharesFromQuote)) {
|
|
@@ -2780,19 +2382,35 @@ var PlaceOrder = ({
|
|
|
2780
2382
|
(_j = (_i = smartRoute.data) == null ? void 0 : _i.positionAvailability) == null ? void 0 : _j.totalSellableShares
|
|
2781
2383
|
]);
|
|
2782
2384
|
const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((_l = (_k = smartRoute.data) == null ? void 0 : _k.positionAvailability) == null ? void 0 : _l.totalSellableShares) === "number") && (isExecutionPositionsLoading || isExecutionPositionsFetching);
|
|
2783
|
-
const displayedCurrentSellableShares =
|
|
2784
|
-
if (!Number.isFinite(currentSellableShares)) return 0;
|
|
2785
|
-
return currentSellableShares;
|
|
2385
|
+
const displayedCurrentSellableShares = useMemo2(() => {
|
|
2386
|
+
if (!Number.isFinite(currentSellableShares) || currentSellableShares <= 0) return 0;
|
|
2387
|
+
return Math.floor(currentSellableShares * 100) / 100;
|
|
2786
2388
|
}, [currentSellableShares]);
|
|
2787
|
-
const
|
|
2389
|
+
const isAtMaxSellableShares = isSell && displayedCurrentSellableShares > 0 && Math.abs(internalAmount - displayedCurrentSellableShares) < 1e-9;
|
|
2390
|
+
useEffect2(() => {
|
|
2391
|
+
if (!isSell || isCurrentSellableSharesLoading) return;
|
|
2392
|
+
if (scopedSelectedOutcomeId === sellFilledForOutcomeId) return;
|
|
2393
|
+
setInternalAmount(displayedCurrentSellableShares);
|
|
2394
|
+
setSellFilledForOutcomeId(scopedSelectedOutcomeId != null ? scopedSelectedOutcomeId : null);
|
|
2395
|
+
onAmountChange == null ? void 0 : onAmountChange(displayedCurrentSellableShares);
|
|
2396
|
+
}, [
|
|
2397
|
+
isSell,
|
|
2398
|
+
isCurrentSellableSharesLoading,
|
|
2399
|
+
scopedSelectedOutcomeId,
|
|
2400
|
+
sellFilledForOutcomeId,
|
|
2401
|
+
displayedCurrentSellableShares,
|
|
2402
|
+
onAmountChange
|
|
2403
|
+
]);
|
|
2404
|
+
const routeCards = useMemo2(
|
|
2788
2405
|
() => smartRoute.data ? buildLiveRouteCards({
|
|
2406
|
+
eventVenues: scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets.map((market) => market.venue),
|
|
2789
2407
|
labels: tradingLabels,
|
|
2790
2408
|
quoteData: smartRoute.data,
|
|
2791
2409
|
tradeSide: isSell ? "sell" : "buy"
|
|
2792
2410
|
}) : [],
|
|
2793
|
-
[smartRoute.data, tradingLabels, isSell]
|
|
2411
|
+
[smartRoute.data, tradingLabels, isSell, scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets]
|
|
2794
2412
|
);
|
|
2795
|
-
const resolvedSelectedRouteCardId =
|
|
2413
|
+
const resolvedSelectedRouteCardId = useMemo2(() => {
|
|
2796
2414
|
var _a2, _b2, _c2, _d2;
|
|
2797
2415
|
if (routeCards.length === 0) return null;
|
|
2798
2416
|
if (selectedRouteCardId && routeCards.some((card) => card.id === selectedRouteCardId && !card.isUnavailable)) {
|
|
@@ -2800,7 +2418,7 @@ var PlaceOrder = ({
|
|
|
2800
2418
|
}
|
|
2801
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;
|
|
2802
2420
|
}, [routeCards, selectedRouteCardId]);
|
|
2803
|
-
|
|
2421
|
+
useEffect2(() => {
|
|
2804
2422
|
if (routeCards.length === 0) {
|
|
2805
2423
|
setSelectedRouteCardId(null);
|
|
2806
2424
|
setIsRoutesExpanded(false);
|
|
@@ -2811,19 +2429,19 @@ var PlaceOrder = ({
|
|
|
2811
2429
|
setSelectedRouteCardId(resolvedSelectedRouteCardId);
|
|
2812
2430
|
}
|
|
2813
2431
|
}, [resolvedSelectedRouteCardId, routeCards.length, selectedRouteCardId]);
|
|
2814
|
-
|
|
2432
|
+
useEffect2(() => {
|
|
2815
2433
|
setSubmissionFeedback(null);
|
|
2816
2434
|
setSubmissionProgressState(null);
|
|
2817
2435
|
}, [internalAmount, internalSlippage, internalTab, scopedSelectedOutcomeId]);
|
|
2818
2436
|
const orderedRouteCards = routeCards;
|
|
2819
2437
|
const selectedRouteCard = (_n = (_m = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _m : orderedRouteCards[0]) != null ? _n : null;
|
|
2820
|
-
const isKalshiRoute =
|
|
2438
|
+
const isKalshiRoute = useMemo2(() => {
|
|
2821
2439
|
if (selectedRouteCard) {
|
|
2822
2440
|
return selectedRouteCard.venue === "kalshi" || selectedRouteCard.quoteData.fills.some((f) => f.venue === "kalshi");
|
|
2823
2441
|
}
|
|
2824
2442
|
return (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === "kalshi";
|
|
2825
2443
|
}, [selectedRouteCard, scopedSelectedMarket]);
|
|
2826
|
-
const isKalshiVerified =
|
|
2444
|
+
const isKalshiVerified = useMemo2(() => {
|
|
2827
2445
|
var _a2;
|
|
2828
2446
|
const kalshiAccount = (_a2 = user == null ? void 0 : user.venueAccounts) == null ? void 0 : _a2.find((va) => va.venue === "kalshi");
|
|
2829
2447
|
return (kalshiAccount == null ? void 0 : kalshiAccount.kycStatus) === "verified";
|
|
@@ -2843,7 +2461,7 @@ var PlaceOrder = ({
|
|
|
2843
2461
|
walletAddress: (_o = getWalletAddressFromUserProfile(user)) != null ? _o : null,
|
|
2844
2462
|
onError
|
|
2845
2463
|
});
|
|
2846
|
-
const handleRouteCardSelect =
|
|
2464
|
+
const handleRouteCardSelect = useCallback2(
|
|
2847
2465
|
(cardId) => {
|
|
2848
2466
|
if (cardId === resolvedSelectedRouteCardId) {
|
|
2849
2467
|
const card = routeCards.find((c) => c.id === cardId);
|
|
@@ -2864,18 +2482,13 @@ var PlaceOrder = ({
|
|
|
2864
2482
|
const headerImage = (_v = (_u = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.image) != null ? _u : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.image) != null ? _v : null;
|
|
2865
2483
|
const headerTitle = (_x = (_w = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _w : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _x : "";
|
|
2866
2484
|
const headerSubtitle = (_y = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _y : "";
|
|
2867
|
-
const buildExecutionSummary =
|
|
2485
|
+
const buildExecutionSummary = useCallback2(
|
|
2868
2486
|
(quoteData, executionVenue, orderId, partialFillSummary) => {
|
|
2869
2487
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
2870
2488
|
if (!quoteData) return void 0;
|
|
2871
2489
|
const avgPriceValue = quoteData.totalFilled > 0 ? quoteData.rawExecCost / quoteData.totalFilled : 0;
|
|
2872
2490
|
const avgPriceLabel = quoteData.totalFilled > 0 ? getTradingRoutePriceLabel(avgPriceValue) : "\u2014";
|
|
2873
2491
|
const actionPriceLabel = quoteData.totalFilled > 0 ? `~${avgPriceLabel}` : avgPriceLabel;
|
|
2874
|
-
const selectedOutcomeIndex = outcomes.findIndex((o) => o.id === scopedSelectedOutcomeId);
|
|
2875
|
-
const actionTone = resolvePlaceOrderSuccessTone({
|
|
2876
|
-
outcomeIndex: selectedOutcomeIndex === -1 ? 0 : selectedOutcomeIndex,
|
|
2877
|
-
tab: internalTab
|
|
2878
|
-
});
|
|
2879
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}`;
|
|
2880
2493
|
const sharesLabel = quoteData.totalFilled.toLocaleString("en-US", {
|
|
2881
2494
|
minimumFractionDigits: 2,
|
|
@@ -2898,13 +2511,15 @@ var PlaceOrder = ({
|
|
|
2898
2511
|
eventDateLabel: eventDateSource ? getTradingDateLabel(eventDateSource) : "",
|
|
2899
2512
|
eventImage: headerImage,
|
|
2900
2513
|
actionLabel: actionLabel2,
|
|
2901
|
-
actionTone,
|
|
2902
2514
|
amountLabel,
|
|
2903
2515
|
toWinLabel,
|
|
2904
2516
|
potentialReturnLabel,
|
|
2905
2517
|
executionStepGroups: (partialFillSummary == null ? void 0 : partialFillSummary.kind) === "partial_fill" ? buildPlaceOrderExecutionStepGroupsFromFailureSummary({
|
|
2906
2518
|
labels: tradingLabels,
|
|
2907
|
-
summary: partialFillSummary
|
|
2519
|
+
summary: partialFillSummary,
|
|
2520
|
+
// Inside the success view (auto-95% skip or user-clicked
|
|
2521
|
+
// Skip), surface partial-fill steps as completed checks.
|
|
2522
|
+
treatPartialAsComplete: true
|
|
2908
2523
|
}) : buildPlaceOrderExecutionStepGroups({
|
|
2909
2524
|
labels: tradingLabels,
|
|
2910
2525
|
orderId: orderId != null ? orderId : (_h2 = executionProgress.submittedOrders[0]) == null ? void 0 : _h2.orderId,
|
|
@@ -2926,17 +2541,15 @@ var PlaceOrder = ({
|
|
|
2926
2541
|
executionProgress.submittedOrders,
|
|
2927
2542
|
headerImage,
|
|
2928
2543
|
internalTab,
|
|
2929
|
-
outcomes,
|
|
2930
2544
|
scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate,
|
|
2931
2545
|
scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title,
|
|
2932
2546
|
scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.endDate,
|
|
2933
2547
|
scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question,
|
|
2934
|
-
scopedSelectedOutcomeId,
|
|
2935
2548
|
selectedOutcomeLabel,
|
|
2936
2549
|
tradingLabels
|
|
2937
2550
|
]
|
|
2938
2551
|
);
|
|
2939
|
-
|
|
2552
|
+
useEffect2(() => {
|
|
2940
2553
|
if (executionProgress.phase === "order_submitted") {
|
|
2941
2554
|
const submittedOrder = executionProgress.submittedOrders[0];
|
|
2942
2555
|
setSubmissionProgressState((prev) => {
|
|
@@ -2968,7 +2581,7 @@ var PlaceOrder = ({
|
|
|
2968
2581
|
executionProgress.submittedOrders,
|
|
2969
2582
|
selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData
|
|
2970
2583
|
]);
|
|
2971
|
-
|
|
2584
|
+
useEffect2(() => {
|
|
2972
2585
|
const dp = executionProgress.dagProgress;
|
|
2973
2586
|
if (!dp) return;
|
|
2974
2587
|
setSubmissionProgressState((prev) => {
|
|
@@ -2987,7 +2600,7 @@ var PlaceOrder = ({
|
|
|
2987
2600
|
return __spreadProps(__spreadValues({}, prev), { dagProgress: dp });
|
|
2988
2601
|
});
|
|
2989
2602
|
}, [executionProgress.dagProgress, tradingLabels.orderFailed]);
|
|
2990
|
-
|
|
2603
|
+
useEffect2(() => {
|
|
2991
2604
|
const orderIds = submissionProgressState == null ? void 0 : submissionProgressState.orderIds;
|
|
2992
2605
|
if (!(orderIds == null ? void 0 : orderIds.length)) return;
|
|
2993
2606
|
const aggregateStatus = deriveAggregateOrderStatus(
|
|
@@ -3035,7 +2648,7 @@ var PlaceOrder = ({
|
|
|
3035
2648
|
submissionProgressState == null ? void 0 : submissionProgressState.orderIds,
|
|
3036
2649
|
tradingLabels.orderFailed
|
|
3037
2650
|
]);
|
|
3038
|
-
|
|
2651
|
+
useEffect2(() => {
|
|
3039
2652
|
if (!submissionProgressState) return;
|
|
3040
2653
|
onExecutionStateChange == null ? void 0 : onExecutionStateChange(submissionProgressState);
|
|
3041
2654
|
if (submissionProgressState.phase === "success" && submissionProgressState.summary) {
|
|
@@ -3050,10 +2663,9 @@ var PlaceOrder = ({
|
|
|
3050
2663
|
const activeQuoteData = (_A = (_z = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _z : smartRoute.data) != null ? _A : null;
|
|
3051
2664
|
const visibleRouteCards = orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT && !isRoutesExpanded ? orderedRouteCards.slice(0, PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT) : orderedRouteCards;
|
|
3052
2665
|
const hasEnteredAmount = internalAmount > 0;
|
|
3053
|
-
const shouldPromptSignIn = orderEligibility.canPlaceOrder && !isAuthenticated && hasEnteredAmount;
|
|
3054
2666
|
const isInsufficientBalance = !isSell && isAuthenticated && hasEnteredAmount && !isBalanceLoading && internalAmount > totalBalance;
|
|
3055
2667
|
const isBelowMinimum = !isSell && hasEnteredAmount && internalAmount < MIN_BUY_ORDER_AMOUNT;
|
|
3056
|
-
const quoteStatus =
|
|
2668
|
+
const quoteStatus = useMemo2(() => {
|
|
3057
2669
|
if (!orderEligibility.canPlaceOrder) return void 0;
|
|
3058
2670
|
return resolvePlaceOrderQuoteStatus({
|
|
3059
2671
|
amount: internalAmount,
|
|
@@ -3068,7 +2680,7 @@ var PlaceOrder = ({
|
|
|
3068
2680
|
scopedSelectedMarket,
|
|
3069
2681
|
tradingLabels
|
|
3070
2682
|
]);
|
|
3071
|
-
const smartRouteErrorMessage =
|
|
2683
|
+
const smartRouteErrorMessage = useMemo2(() => {
|
|
3072
2684
|
if (!smartRoute.error) return null;
|
|
3073
2685
|
return normalizePlaceOrderErrorMessage({
|
|
3074
2686
|
errorMessage: smartRoute.error.message,
|
|
@@ -3076,15 +2688,26 @@ var PlaceOrder = ({
|
|
|
3076
2688
|
});
|
|
3077
2689
|
}, [smartRoute.error, tradingLabels.quoteUnavailable]);
|
|
3078
2690
|
const progressActionLabel = (internalTab === "buy" ? tradingLabels.buyingOutcome(selectedOutcomeLabel) : tradingLabels.sellingOutcome(selectedOutcomeLabel)).trim();
|
|
3079
|
-
const canRetryRemaining =
|
|
3080
|
-
if (isSell) return true;
|
|
2691
|
+
const canRetryRemaining = useMemo2(() => {
|
|
3081
2692
|
const remaining = getPlaceOrderUnfilledRemaining({
|
|
3082
2693
|
originalAmount: internalAmount,
|
|
3083
2694
|
terminalOrderEvents: executionProgress.terminalOrderEvents
|
|
3084
2695
|
});
|
|
3085
|
-
|
|
2696
|
+
const minRemainder = isSell ? MIN_SELL_ORDER_SHARES : MIN_BUY_ORDER_AMOUNT;
|
|
2697
|
+
return remaining >= minRemainder;
|
|
3086
2698
|
}, [executionProgress.terminalOrderEvents, internalAmount, isSell]);
|
|
3087
|
-
const
|
|
2699
|
+
const PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD = 0.95;
|
|
2700
|
+
const shouldAutoSkipPartialFill = useMemo2(() => {
|
|
2701
|
+
if (internalAmount <= 0) return false;
|
|
2702
|
+
const remaining = getPlaceOrderUnfilledRemaining({
|
|
2703
|
+
originalAmount: internalAmount,
|
|
2704
|
+
terminalOrderEvents: executionProgress.terminalOrderEvents
|
|
2705
|
+
});
|
|
2706
|
+
const filled = Math.max(0, internalAmount - remaining);
|
|
2707
|
+
const fillRatio = filled / internalAmount;
|
|
2708
|
+
return fillRatio >= PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD || !canRetryRemaining;
|
|
2709
|
+
}, [canRetryRemaining, executionProgress.terminalOrderEvents, internalAmount]);
|
|
2710
|
+
const failureSummary = useMemo2(() => {
|
|
3088
2711
|
var _a2;
|
|
3089
2712
|
if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return void 0;
|
|
3090
2713
|
return buildPlaceOrderFailureSummary({
|
|
@@ -3117,14 +2740,14 @@ var PlaceOrder = ({
|
|
|
3117
2740
|
const displayedToWinValue = (_C = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _C : 0;
|
|
3118
2741
|
const isActionLoading = isPrimaryActionLoading || executeManaged.isPending;
|
|
3119
2742
|
const selectedRouteGeoBlocked = (_D = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _D : false;
|
|
3120
|
-
const geoBlockedVenuesFromWarnings =
|
|
2743
|
+
const geoBlockedVenuesFromWarnings = useMemo2(
|
|
3121
2744
|
() => {
|
|
3122
2745
|
var _a2;
|
|
3123
2746
|
return extractGeoBlockedVenues((_a2 = smartRoute.data) == null ? void 0 : _a2.warnings);
|
|
3124
2747
|
},
|
|
3125
2748
|
[(_E = smartRoute.data) == null ? void 0 : _E.warnings]
|
|
3126
2749
|
);
|
|
3127
|
-
const isPrimaryVenueGeoBlocked =
|
|
2750
|
+
const isPrimaryVenueGeoBlocked = useMemo2(() => {
|
|
3128
2751
|
var _a2, _b2;
|
|
3129
2752
|
if (!selectedRouteCard || selectedRouteCard.isUnavailable) return false;
|
|
3130
2753
|
const fills = (_b2 = (_a2 = selectedRouteCard.quoteData) == null ? void 0 : _a2.fills) != null ? _b2 : [];
|
|
@@ -3136,10 +2759,11 @@ var PlaceOrder = ({
|
|
|
3136
2759
|
const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isBelowMinimum || !selectedRouteCard || !selectedRouteCard.quoteData.quoteId || selectedRouteGeoBlocked || !isAuthenticated || quoteStatus !== void 0;
|
|
3137
2760
|
const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && (orderedRouteCards.length > 0 || smartRoute.isFetching);
|
|
3138
2761
|
const shouldShowRouteToggle = orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
|
|
3139
|
-
const handleStartNewTrade =
|
|
2762
|
+
const handleStartNewTrade = useCallback2(() => {
|
|
3140
2763
|
setSubmissionProgressState(null);
|
|
3141
2764
|
setSubmissionFeedback(null);
|
|
3142
2765
|
setInternalAmount(0);
|
|
2766
|
+
setSellFilledForOutcomeId(null);
|
|
3143
2767
|
setInternalSlippage(DEFAULT_SLIPPAGE_VALUE);
|
|
3144
2768
|
setInternalTab("buy");
|
|
3145
2769
|
setIsRoutesExpanded(false);
|
|
@@ -3158,7 +2782,7 @@ var PlaceOrder = ({
|
|
|
3158
2782
|
const shareUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(shareText)}`;
|
|
3159
2783
|
window.open(shareUrl, "_blank", "noopener,noreferrer");
|
|
3160
2784
|
};
|
|
3161
|
-
const handleExecuteQuote =
|
|
2785
|
+
const handleExecuteQuote = useCallback2(
|
|
3162
2786
|
(quoteData) => __async(null, null, function* () {
|
|
3163
2787
|
const quoteId = quoteData == null ? void 0 : quoteData.quoteId;
|
|
3164
2788
|
if (!quoteId) {
|
|
@@ -3178,7 +2802,7 @@ var PlaceOrder = ({
|
|
|
3178
2802
|
}),
|
|
3179
2803
|
[executeManaged, onPrimaryAction, tradingLabels.quoteUnavailable]
|
|
3180
2804
|
);
|
|
3181
|
-
const handleSkipToSuccess =
|
|
2805
|
+
const handleSkipToSuccess = useCallback2(() => {
|
|
3182
2806
|
const primaryFilledEvent = executionProgress.terminalOrderEvents.find(
|
|
3183
2807
|
(e) => e.event === "filled" || e.event === "partial_fill"
|
|
3184
2808
|
);
|
|
@@ -3203,7 +2827,18 @@ var PlaceOrder = ({
|
|
|
3203
2827
|
failureSummary,
|
|
3204
2828
|
selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData
|
|
3205
2829
|
]);
|
|
3206
|
-
|
|
2830
|
+
useEffect2(() => {
|
|
2831
|
+
if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return;
|
|
2832
|
+
if ((failureSummary == null ? void 0 : failureSummary.kind) !== "partial_fill") return;
|
|
2833
|
+
if (!shouldAutoSkipPartialFill) return;
|
|
2834
|
+
handleSkipToSuccess();
|
|
2835
|
+
}, [
|
|
2836
|
+
failureSummary == null ? void 0 : failureSummary.kind,
|
|
2837
|
+
handleSkipToSuccess,
|
|
2838
|
+
shouldAutoSkipPartialFill,
|
|
2839
|
+
submissionProgressState == null ? void 0 : submissionProgressState.phase
|
|
2840
|
+
]);
|
|
2841
|
+
const handleRetrySubmission = useCallback2(() => __async(null, null, function* () {
|
|
3207
2842
|
var _a2, _b2, _c2;
|
|
3208
2843
|
if (!orderEligibility.canPlaceOrder) {
|
|
3209
2844
|
handleStartNewTrade();
|
|
@@ -3245,6 +2880,7 @@ var PlaceOrder = ({
|
|
|
3245
2880
|
throw new Error(tradingLabels.quoteUnavailable);
|
|
3246
2881
|
}
|
|
3247
2882
|
const refreshedCards = buildLiveRouteCards({
|
|
2883
|
+
eventVenues: scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets.map((market) => market.venue),
|
|
3248
2884
|
labels: tradingLabels,
|
|
3249
2885
|
quoteData: refetchedQuoteData,
|
|
3250
2886
|
tradeSide: internalTab
|
|
@@ -3281,6 +2917,7 @@ var PlaceOrder = ({
|
|
|
3281
2917
|
isSell,
|
|
3282
2918
|
onAmountChange,
|
|
3283
2919
|
orderEligibility.canPlaceOrder,
|
|
2920
|
+
scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets,
|
|
3284
2921
|
scopedSelectedOutcomeId,
|
|
3285
2922
|
selectedRouteCardId,
|
|
3286
2923
|
smartRoute,
|
|
@@ -3288,7 +2925,7 @@ var PlaceOrder = ({
|
|
|
3288
2925
|
]);
|
|
3289
2926
|
const resolvedStatusClassName = cn(classNames == null ? void 0 : classNames.root, className);
|
|
3290
2927
|
if (isLoading) {
|
|
3291
|
-
return /* @__PURE__ */
|
|
2928
|
+
return /* @__PURE__ */ jsx4(
|
|
3292
2929
|
Skeleton,
|
|
3293
2930
|
{
|
|
3294
2931
|
ariaLabel: labels.common.loading,
|
|
@@ -3299,7 +2936,7 @@ var PlaceOrder = ({
|
|
|
3299
2936
|
}
|
|
3300
2937
|
if (submissionProgressState) {
|
|
3301
2938
|
if (submissionProgressState.phase === "success" && submissionProgressState.summary) {
|
|
3302
|
-
return /* @__PURE__ */
|
|
2939
|
+
return /* @__PURE__ */ jsx4(
|
|
3303
2940
|
PlaceOrderSuccessView,
|
|
3304
2941
|
{
|
|
3305
2942
|
className: resolvedStatusClassName,
|
|
@@ -3311,7 +2948,7 @@ var PlaceOrder = ({
|
|
|
3311
2948
|
);
|
|
3312
2949
|
}
|
|
3313
2950
|
if (submissionProgressState.phase === "failed") {
|
|
3314
|
-
return /* @__PURE__ */
|
|
2951
|
+
return /* @__PURE__ */ jsx4(
|
|
3315
2952
|
PlaceOrderFailureView,
|
|
3316
2953
|
{
|
|
3317
2954
|
className: resolvedStatusClassName,
|
|
@@ -3339,11 +2976,20 @@ var PlaceOrder = ({
|
|
|
3339
2976
|
const handleTabChange = (nextTab) => {
|
|
3340
2977
|
if (!orderEligibility.canPlaceOrder) return;
|
|
3341
2978
|
setInternalTab(nextTab);
|
|
2979
|
+
if (nextTab === "sell") {
|
|
2980
|
+
setInternalAmount(0);
|
|
2981
|
+
setSellFilledForOutcomeId(null);
|
|
2982
|
+
onAmountChange == null ? void 0 : onAmountChange(0);
|
|
2983
|
+
} else {
|
|
2984
|
+
setInternalAmount(PLACE_ORDER_DEFAULT_AMOUNT);
|
|
2985
|
+
onAmountChange == null ? void 0 : onAmountChange(PLACE_ORDER_DEFAULT_AMOUNT);
|
|
2986
|
+
}
|
|
3342
2987
|
onTabChange == null ? void 0 : onTabChange(nextTab);
|
|
3343
2988
|
};
|
|
3344
2989
|
const handleOutcomeChange = (nextOutcomeId) => {
|
|
3345
2990
|
if (isResolvedOutcomeCtaLocked) return;
|
|
3346
2991
|
if (!orderEligibility.canPlaceOrder) return;
|
|
2992
|
+
if (isSell) setSellFilledForOutcomeId(null);
|
|
3347
2993
|
onOutcomeChange == null ? void 0 : onOutcomeChange(nextOutcomeId);
|
|
3348
2994
|
tradingContext == null ? void 0 : tradingContext.selectOutcome(nextOutcomeId);
|
|
3349
2995
|
};
|
|
@@ -3351,6 +2997,7 @@ var PlaceOrder = ({
|
|
|
3351
2997
|
if (!orderEligibility.canPlaceOrder) return;
|
|
3352
2998
|
const resolvedNextValue = nextValue != null ? nextValue : 0;
|
|
3353
2999
|
setInternalAmount(resolvedNextValue);
|
|
3000
|
+
if (isSell) setSellFilledForOutcomeId(scopedSelectedOutcomeId != null ? scopedSelectedOutcomeId : null);
|
|
3354
3001
|
onAmountChange == null ? void 0 : onAmountChange(resolvedNextValue);
|
|
3355
3002
|
};
|
|
3356
3003
|
const handleFillSellableShares = () => {
|
|
@@ -3358,10 +3005,6 @@ var PlaceOrder = ({
|
|
|
3358
3005
|
if (displayedCurrentSellableShares <= 0) return;
|
|
3359
3006
|
handleAmountChange(displayedCurrentSellableShares);
|
|
3360
3007
|
};
|
|
3361
|
-
const handleSignInRequiredClick = () => {
|
|
3362
|
-
if (!shouldPromptSignIn) return;
|
|
3363
|
-
requestAggAuthChooserOpen();
|
|
3364
|
-
};
|
|
3365
3008
|
const handleDepositRequiredClick = () => {
|
|
3366
3009
|
if (!isInsufficientBalance) return;
|
|
3367
3010
|
requestAggDepositModalOpen();
|
|
@@ -3403,7 +3046,7 @@ var PlaceOrder = ({
|
|
|
3403
3046
|
}
|
|
3404
3047
|
});
|
|
3405
3048
|
if (!orderEligibility.canPlaceOrder && resolvedReadOnlyTradingState.kind !== "open") {
|
|
3406
|
-
return /* @__PURE__ */
|
|
3049
|
+
return /* @__PURE__ */ jsx4(
|
|
3407
3050
|
PlaceOrderResolvedView,
|
|
3408
3051
|
{
|
|
3409
3052
|
tradingState: resolvedReadOnlyTradingState,
|
|
@@ -3413,17 +3056,17 @@ var PlaceOrder = ({
|
|
|
3413
3056
|
}
|
|
3414
3057
|
);
|
|
3415
3058
|
}
|
|
3416
|
-
return /* @__PURE__ */
|
|
3417
|
-
/* @__PURE__ */
|
|
3059
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
3060
|
+
/* @__PURE__ */ jsxs3(
|
|
3418
3061
|
Card,
|
|
3419
3062
|
{
|
|
3420
3063
|
className: cn(
|
|
3421
|
-
"group/agg-order-panel",
|
|
3064
|
+
"group/agg-order-panel gap-6 p-5",
|
|
3422
3065
|
getPlaceOrderContainerClassName(),
|
|
3423
3066
|
classNames == null ? void 0 : classNames.root,
|
|
3424
3067
|
className
|
|
3425
3068
|
),
|
|
3426
|
-
children:
|
|
3069
|
+
children: [
|
|
3427
3070
|
renderCardHeader({
|
|
3428
3071
|
className: classNames == null ? void 0 : classNames.header,
|
|
3429
3072
|
headerSubtitle,
|
|
@@ -3431,8 +3074,8 @@ var PlaceOrder = ({
|
|
|
3431
3074
|
headerTitle,
|
|
3432
3075
|
onClose
|
|
3433
3076
|
}),
|
|
3434
|
-
/* @__PURE__ */
|
|
3435
|
-
/* @__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(
|
|
3436
3079
|
"div",
|
|
3437
3080
|
{
|
|
3438
3081
|
className: "agg-order-tabs flex items-end border-b border-agg-separator",
|
|
@@ -3443,7 +3086,7 @@ var PlaceOrder = ({
|
|
|
3443
3086
|
{ value: "sell", label: tradingLabels.sell, ref: sellTabRef }
|
|
3444
3087
|
].map((tabItem) => {
|
|
3445
3088
|
const isActive = internalTab === tabItem.value;
|
|
3446
|
-
return /* @__PURE__ */
|
|
3089
|
+
return /* @__PURE__ */ jsxs3(
|
|
3447
3090
|
"button",
|
|
3448
3091
|
{
|
|
3449
3092
|
ref: tabItem.ref,
|
|
@@ -3467,7 +3110,7 @@ var PlaceOrder = ({
|
|
|
3467
3110
|
onKeyDown: (event) => handleTabKeyDown(event, tabItem.value),
|
|
3468
3111
|
children: [
|
|
3469
3112
|
tabItem.label,
|
|
3470
|
-
/* @__PURE__ */
|
|
3113
|
+
/* @__PURE__ */ jsx4(
|
|
3471
3114
|
"span",
|
|
3472
3115
|
{
|
|
3473
3116
|
"aria-hidden": "true",
|
|
@@ -3489,13 +3132,13 @@ var PlaceOrder = ({
|
|
|
3489
3132
|
})
|
|
3490
3133
|
}
|
|
3491
3134
|
),
|
|
3492
|
-
outcomes.length >= 2 ? /* @__PURE__ */
|
|
3493
|
-
var _a2, _b2;
|
|
3494
|
-
const price = (_a2 =
|
|
3135
|
+
outcomes.length >= 2 ? /* @__PURE__ */ jsx4("div", { className: "agg-outcomes flex w-full max-w-full gap-2", children: outcomes.map((outcome, index) => {
|
|
3136
|
+
var _a2, _b2, _c2;
|
|
3137
|
+
const price = (_b2 = (_a2 = clusterMidpoints.get(outcome.id)) != null ? _a2 : livePrices.get(outcome.id)) != null ? _b2 : outcome.price;
|
|
3495
3138
|
const isActive = outcome.id === scopedSelectedOutcomeId;
|
|
3496
3139
|
const isPositive = resolveIsPositiveOutcome(outcome, index);
|
|
3497
|
-
const displayLabel = ((
|
|
3498
|
-
return /* @__PURE__ */
|
|
3140
|
+
const displayLabel = ((_c2 = outcome.title) == null ? void 0 : _c2.trim()) || outcome.label;
|
|
3141
|
+
return /* @__PURE__ */ jsxs3(
|
|
3499
3142
|
"button",
|
|
3500
3143
|
{
|
|
3501
3144
|
"data-id": outcome.id,
|
|
@@ -3515,7 +3158,7 @@ var PlaceOrder = ({
|
|
|
3515
3158
|
disabled: !orderEligibility.canPlaceOrder || isResolvedOutcomeCtaLocked,
|
|
3516
3159
|
onClick: () => handleOutcomeChange(outcome.id),
|
|
3517
3160
|
children: [
|
|
3518
|
-
/* @__PURE__ */
|
|
3161
|
+
/* @__PURE__ */ jsx4(
|
|
3519
3162
|
Typography,
|
|
3520
3163
|
{
|
|
3521
3164
|
as: "span",
|
|
@@ -3524,33 +3167,36 @@ var PlaceOrder = ({
|
|
|
3524
3167
|
children: displayLabel
|
|
3525
3168
|
}
|
|
3526
3169
|
),
|
|
3527
|
-
/* @__PURE__ */
|
|
3170
|
+
/* @__PURE__ */ jsx4(Typography, { as: "span", variant: isActive ? "body-strong" : "body", children: formatProbabilityCents(price) })
|
|
3528
3171
|
]
|
|
3529
3172
|
},
|
|
3530
3173
|
outcome.id
|
|
3531
3174
|
);
|
|
3532
3175
|
}) }) : null,
|
|
3533
|
-
/* @__PURE__ */
|
|
3534
|
-
/* @__PURE__ */
|
|
3535
|
-
/* @__PURE__ */
|
|
3536
|
-
isAuthenticated ? isSell ? /* @__PURE__ */
|
|
3537
|
-
"
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
"
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
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
|
|
3552
3198
|
] }),
|
|
3553
|
-
/* @__PURE__ */
|
|
3199
|
+
/* @__PURE__ */ jsx4(
|
|
3554
3200
|
CurrencyInput,
|
|
3555
3201
|
{
|
|
3556
3202
|
value: internalAmount,
|
|
@@ -3570,22 +3216,22 @@ var PlaceOrder = ({
|
|
|
3570
3216
|
}
|
|
3571
3217
|
)
|
|
3572
3218
|
] }),
|
|
3573
|
-
shouldShowSmartRouting ? /* @__PURE__ */
|
|
3574
|
-
/* @__PURE__ */
|
|
3575
|
-
/* @__PURE__ */
|
|
3576
|
-
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(
|
|
3577
3223
|
"button",
|
|
3578
3224
|
{
|
|
3579
3225
|
type: "button",
|
|
3580
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",
|
|
3581
|
-
"aria-label":
|
|
3227
|
+
"aria-label": tradingLabels.viewAllRoutes(orderedRouteCards.length),
|
|
3582
3228
|
onClick: () => setIsRoutesExpanded((currentValue) => !currentValue),
|
|
3583
3229
|
children: [
|
|
3584
|
-
/* @__PURE__ */
|
|
3585
|
-
/* @__PURE__ */
|
|
3230
|
+
/* @__PURE__ */ jsx4("span", { children: tradingLabels.viewAllRoutes(orderedRouteCards.length) }),
|
|
3231
|
+
/* @__PURE__ */ jsx4(
|
|
3586
3232
|
Icon,
|
|
3587
3233
|
{
|
|
3588
|
-
name:
|
|
3234
|
+
name: "chevron-down",
|
|
3589
3235
|
size: "small",
|
|
3590
3236
|
className: "h-4 w-4 text-agg-foreground",
|
|
3591
3237
|
"aria-hidden": "true"
|
|
@@ -3595,26 +3241,26 @@ var PlaceOrder = ({
|
|
|
3595
3241
|
}
|
|
3596
3242
|
) : null
|
|
3597
3243
|
] }),
|
|
3598
|
-
/* @__PURE__ */
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
}),
|
|
3609
|
-
|
|
3610
|
-
] })
|
|
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 })
|
|
3611
3257
|
] }) : null,
|
|
3612
|
-
hasEnteredAmount && selectedRouteCard && orderEligibility.canPlaceOrder ? /* @__PURE__ */
|
|
3613
|
-
/* @__PURE__ */
|
|
3614
|
-
/* @__PURE__ */
|
|
3615
|
-
/* @__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 })
|
|
3616
3262
|
] }),
|
|
3617
|
-
/* @__PURE__ */
|
|
3263
|
+
/* @__PURE__ */ jsx4(
|
|
3618
3264
|
NumberFlow,
|
|
3619
3265
|
{
|
|
3620
3266
|
value: displayedToWinValue,
|
|
@@ -3629,7 +3275,7 @@ var PlaceOrder = ({
|
|
|
3629
3275
|
}
|
|
3630
3276
|
)
|
|
3631
3277
|
] }) : null,
|
|
3632
|
-
/* @__PURE__ */
|
|
3278
|
+
/* @__PURE__ */ jsxs3(
|
|
3633
3279
|
"div",
|
|
3634
3280
|
{
|
|
3635
3281
|
className: cn(
|
|
@@ -3637,54 +3283,23 @@ var PlaceOrder = ({
|
|
|
3637
3283
|
classNames == null ? void 0 : classNames.footer
|
|
3638
3284
|
),
|
|
3639
3285
|
children: [
|
|
3640
|
-
!shouldShowGeoBlockBanner ? /* @__PURE__ */
|
|
3641
|
-
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(
|
|
3642
3288
|
InlineAlert,
|
|
3643
3289
|
{
|
|
3644
3290
|
tone: submissionFeedback.tone,
|
|
3645
3291
|
message: submissionFeedback.message
|
|
3646
3292
|
}
|
|
3647
3293
|
) : null,
|
|
3648
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && isInsufficientBalance ? /* @__PURE__ */
|
|
3649
|
-
"div",
|
|
3650
|
-
{
|
|
3651
|
-
className: "agg-order-sign-in-alert flex items-center justify-center gap-2",
|
|
3652
|
-
role: "status",
|
|
3653
|
-
"aria-live": "polite",
|
|
3654
|
-
children: /* @__PURE__ */ jsx5(
|
|
3655
|
-
Button,
|
|
3656
|
-
{
|
|
3657
|
-
variant: "tertiary",
|
|
3658
|
-
"aria-label": tradingLabels.insufficientBalance,
|
|
3659
|
-
onClick: handleDepositRequiredClick,
|
|
3660
|
-
className: cn(
|
|
3661
|
-
"agg-order-sign-in-alert-trigger text-agg-sm! text-agg-foreground! font-agg-normal! hover:text-agg-muted-foreground!"
|
|
3662
|
-
),
|
|
3663
|
-
children: /* @__PURE__ */ jsxs4("span", { className: "flex items-center gap-2", children: [
|
|
3664
|
-
/* @__PURE__ */ jsx5(
|
|
3665
|
-
Icon,
|
|
3666
|
-
{
|
|
3667
|
-
name: "warning-filled",
|
|
3668
|
-
size: "small",
|
|
3669
|
-
className: "h-4! w-4! shrink-0 text-agg-warning",
|
|
3670
|
-
"aria-hidden": "true"
|
|
3671
|
-
}
|
|
3672
|
-
),
|
|
3673
|
-
/* @__PURE__ */ jsx5("span", { children: tradingLabels.insufficientBalance })
|
|
3674
|
-
] })
|
|
3675
|
-
}
|
|
3676
|
-
)
|
|
3677
|
-
}
|
|
3678
|
-
) : null,
|
|
3679
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && isBelowMinimum ? /* @__PURE__ */ jsx5(
|
|
3294
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && isBelowMinimum ? /* @__PURE__ */ jsx4(
|
|
3680
3295
|
InlineAlert,
|
|
3681
3296
|
{
|
|
3682
3297
|
tone: "error",
|
|
3683
3298
|
message: tradingLabels.minimumOrderAmount(MIN_BUY_ORDER_AMOUNT)
|
|
3684
3299
|
}
|
|
3685
3300
|
) : null,
|
|
3686
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && quoteStatus ? /* @__PURE__ */
|
|
3687
|
-
!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(
|
|
3688
3303
|
InlineAlert,
|
|
3689
3304
|
{
|
|
3690
3305
|
tone: "error",
|
|
@@ -3694,45 +3309,55 @@ var PlaceOrder = ({
|
|
|
3694
3309
|
void smartRoute.refetch();
|
|
3695
3310
|
}
|
|
3696
3311
|
}
|
|
3697
|
-
) : null,
|
|
3698
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && !quoteStatus && !isAuthenticated && hasEnteredAmount ? /* @__PURE__ */ jsx5(
|
|
3699
|
-
"div",
|
|
3700
|
-
{
|
|
3701
|
-
className: "agg-order-sign-in-alert flex items-center justify-center gap-2",
|
|
3702
|
-
role: "status",
|
|
3703
|
-
"aria-live": "polite",
|
|
3704
|
-
children: /* @__PURE__ */ jsx5(
|
|
3705
|
-
Button,
|
|
3706
|
-
{
|
|
3707
|
-
variant: "tertiary",
|
|
3708
|
-
"aria-label": tradingLabels.signInRequired,
|
|
3709
|
-
onClick: handleSignInRequiredClick,
|
|
3710
|
-
className: cn(
|
|
3711
|
-
"agg-order-sign-in-alert-trigger text-agg-sm! text-agg-foreground! font-agg-normal! hover:text-agg-muted-foreground!"
|
|
3712
|
-
),
|
|
3713
|
-
children: /* @__PURE__ */ jsxs4("span", { className: "flex items-center gap-2", children: [
|
|
3714
|
-
/* @__PURE__ */ jsx5(
|
|
3715
|
-
Icon,
|
|
3716
|
-
{
|
|
3717
|
-
name: "warning-filled",
|
|
3718
|
-
size: "small",
|
|
3719
|
-
className: "h-4! w-4! shrink-0 text-agg-warning",
|
|
3720
|
-
"aria-hidden": "true"
|
|
3721
|
-
}
|
|
3722
|
-
),
|
|
3723
|
-
/* @__PURE__ */ jsx5("span", { children: tradingLabels.signInRequired })
|
|
3724
|
-
] })
|
|
3725
|
-
}
|
|
3726
|
-
)
|
|
3727
|
-
}
|
|
3728
3312
|
) : null
|
|
3729
3313
|
] }) : null,
|
|
3730
|
-
|
|
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(
|
|
3731
3356
|
Button,
|
|
3732
3357
|
{
|
|
3733
3358
|
size: "large",
|
|
3734
3359
|
variant: hasEnteredAmount && !shouldShowGeoBlockBanner ? "primary" : "secondary",
|
|
3735
|
-
className: "agg-order-submit h-12 w-full px-8 text-agg-base leading-agg-6 shadow-none
|
|
3360
|
+
className: "agg-order-submit h-12 w-full px-8 text-agg-base leading-agg-6 shadow-none",
|
|
3736
3361
|
disabled: isActionDisabled || shouldShowGeoBlockBanner,
|
|
3737
3362
|
isLoading: isActionLoading,
|
|
3738
3363
|
"aria-label": actionLabel,
|
|
@@ -3742,16 +3367,16 @@ var PlaceOrder = ({
|
|
|
3742
3367
|
children: actionLabel
|
|
3743
3368
|
}
|
|
3744
3369
|
),
|
|
3745
|
-
shouldShowGeoBlockBanner ? /* @__PURE__ */
|
|
3746
|
-
!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
|
|
3747
3372
|
]
|
|
3748
3373
|
}
|
|
3749
3374
|
)
|
|
3750
3375
|
] })
|
|
3751
|
-
]
|
|
3376
|
+
]
|
|
3752
3377
|
}
|
|
3753
3378
|
),
|
|
3754
|
-
/* @__PURE__ */
|
|
3379
|
+
/* @__PURE__ */ jsx4(
|
|
3755
3380
|
KycVerifyModal,
|
|
3756
3381
|
{
|
|
3757
3382
|
open: isKycVerifyModalOpen,
|
|
@@ -3768,7 +3393,7 @@ var PlaceOrder = ({
|
|
|
3768
3393
|
}
|
|
3769
3394
|
}
|
|
3770
3395
|
),
|
|
3771
|
-
/* @__PURE__ */
|
|
3396
|
+
/* @__PURE__ */ jsx4(
|
|
3772
3397
|
KycSuccessModal,
|
|
3773
3398
|
{
|
|
3774
3399
|
open: showKycSuccessModal,
|
|
@@ -3789,19 +3414,6 @@ PlaceOrder.displayName = "PlaceOrder";
|
|
|
3789
3414
|
export {
|
|
3790
3415
|
parseVenue,
|
|
3791
3416
|
parseAmount,
|
|
3792
|
-
defaultSettlementSectionLabel,
|
|
3793
|
-
defaultSettlementDifferencesTitle,
|
|
3794
|
-
defaultTradingDisclaimer,
|
|
3795
|
-
getTradingDateLabel,
|
|
3796
|
-
getTradingVenueLabel,
|
|
3797
|
-
getTradingValueLabel,
|
|
3798
|
-
getTradingPriceLabel,
|
|
3799
|
-
getTradingAveragePriceLabel,
|
|
3800
|
-
getTradingBalanceLabel,
|
|
3801
|
-
getTradingSharesLabel,
|
|
3802
|
-
getTradingSlippageLabel,
|
|
3803
|
-
Settlement,
|
|
3804
|
-
mapVenueMarketsToSettlementSections,
|
|
3805
3417
|
SettlementDetails,
|
|
3806
3418
|
DEPOSIT_MODAL_OPEN_EVENT,
|
|
3807
3419
|
WITHDRAW_MODAL_OPEN_EVENT,
|