@agg-build/ui 2.1.2 → 2.1.4
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-ZOECARZW.mjs → chunk-BW7S2YR3.mjs} +798 -312
- package/dist/{chunk-7ZR5JYB3.mjs → chunk-FLESSOSU.mjs} +2077 -533
- package/dist/{chunk-5RBHMMY3.mjs → chunk-R2YNZJZ3.mjs} +69 -27
- package/dist/{chunk-75AMJAWR.mjs → chunk-T4YZGAYS.mjs} +22 -1
- package/dist/{chunk-JJDYOBVG.mjs → chunk-TBZWRUFB.mjs} +654 -560
- package/dist/{chunk-TBD3N4T4.mjs → chunk-VP76G6PN.mjs} +41 -41
- package/dist/{chunk-NRNBJPYK.mjs → chunk-XHE2VO3S.mjs} +4 -21
- package/dist/events.js +776 -638
- package/dist/events.mjs +5 -3
- package/dist/index.js +5665 -3867
- package/dist/index.mjs +112 -455
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +8330 -6452
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +40 -41
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +652 -415
- package/dist/trading.mjs +4 -4
- package/dist/types/events/item/event-list-item.utils.d.mts +1 -25
- package/dist/types/events/item/event-list-item.utils.d.ts +1 -25
- package/dist/types/events/item-details/index.d.mts +2 -1
- package/dist/types/events/item-details/index.d.ts +2 -1
- package/dist/types/events/market-details/market-details-graph-panel.d.mts +39 -0
- package/dist/types/events/market-details/market-details-graph-panel.d.ts +39 -0
- package/dist/types/events/market-details/market-details-outcome-button.d.mts +2 -1
- package/dist/types/events/market-details/market-details-outcome-button.d.ts +2 -1
- package/dist/types/events/market-details/market-details.types.d.mts +31 -0
- package/dist/types/events/market-details/market-details.types.d.ts +31 -0
- package/dist/types/events/market-details/market-details.utils.d.mts +3 -16
- package/dist/types/events/market-details/market-details.utils.d.ts +3 -16
- package/dist/types/events/shared/format-event-title.d.mts +1 -2
- package/dist/types/events/shared/format-event-title.d.ts +1 -2
- package/dist/types/events/shared/format-sports-event-time.d.mts +2 -0
- package/dist/types/events/shared/format-sports-event-time.d.ts +2 -0
- package/dist/types/notifications/agg-notification-events-provider.d.mts +10 -1
- package/dist/types/notifications/agg-notification-events-provider.d.ts +10 -1
- package/dist/types/pages/event-market/event-market.shared.d.mts +30 -0
- package/dist/types/pages/event-market/event-market.shared.d.ts +30 -0
- package/dist/types/pages/event-market/sports-event-market-page.d.mts +8 -0
- package/dist/types/pages/event-market/sports-event-market-page.d.ts +8 -0
- package/dist/types/pages/event-market/sports-event-market.fixtures.d.mts +13 -0
- package/dist/types/pages/event-market/sports-event-market.fixtures.d.ts +13 -0
- package/dist/types/pages/event-market/sports-event-market.utils.d.mts +156 -0
- package/dist/types/pages/event-market/sports-event-market.utils.d.ts +156 -0
- package/dist/types/pages/event-market/sports-line-rail.d.mts +17 -0
- package/dist/types/pages/event-market/sports-line-rail.d.ts +17 -0
- package/dist/types/pages/event-market/sports-market-card.d.mts +22 -0
- package/dist/types/pages/event-market/sports-market-card.d.ts +22 -0
- package/dist/types/pages/event-market/sports-markets.d.mts +13 -0
- package/dist/types/pages/event-market/sports-markets.d.ts +13 -0
- package/dist/types/primitives/search/search.utils.d.mts +1 -3
- package/dist/types/primitives/search/search.utils.d.ts +1 -3
- package/dist/types/primitives/state-message/index.d.mts +1 -1
- package/dist/types/primitives/state-message/index.d.ts +1 -1
- package/dist/types/primitives/state-message/state-message.types.d.mts +1 -1
- package/dist/types/primitives/state-message/state-message.types.d.ts +1 -1
- package/dist/types/trading/place-order/index.d.mts +1 -1
- package/dist/types/trading/place-order/index.d.ts +1 -1
- package/dist/types/trading/place-order/index.place-order.types.d.mts +7 -0
- package/dist/types/trading/place-order/index.place-order.types.d.ts +7 -0
- package/dist/types/trading/settlement/settlement-text.utils.d.mts +5 -2
- package/dist/types/trading/settlement/settlement-text.utils.d.ts +5 -2
- package/package.json +3 -3
|
@@ -8,10 +8,11 @@ import {
|
|
|
8
8
|
getTradingValueLabel,
|
|
9
9
|
getTradingVenueLabel,
|
|
10
10
|
resolveOrderEligibilityMessage
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-R2YNZJZ3.mjs";
|
|
12
12
|
import {
|
|
13
|
-
GeoBlockBanner
|
|
14
|
-
|
|
13
|
+
GeoBlockBanner,
|
|
14
|
+
subscribeAggDepositNotification
|
|
15
|
+
} from "./chunk-T4YZGAYS.mjs";
|
|
15
16
|
import {
|
|
16
17
|
AGG_TERMS_OF_SERVICE_URL,
|
|
17
18
|
Button,
|
|
@@ -37,11 +38,12 @@ import {
|
|
|
37
38
|
__spreadProps,
|
|
38
39
|
__spreadValues,
|
|
39
40
|
cn,
|
|
41
|
+
formatSportsEventTimeEt,
|
|
40
42
|
formatUsd,
|
|
41
43
|
getMotionClassName,
|
|
42
44
|
skeletonViews,
|
|
43
45
|
useOptionalToast
|
|
44
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-VP76G6PN.mjs";
|
|
45
47
|
|
|
46
48
|
// src/trading/types.ts
|
|
47
49
|
import { Venue, enumGuard, isFiniteNonNeg, safeParse } from "@agg-build/sdk";
|
|
@@ -110,7 +112,362 @@ import {
|
|
|
110
112
|
} from "@agg-build/hooks";
|
|
111
113
|
import NumberFlow from "@number-flow/react";
|
|
112
114
|
import * as Dialog from "@radix-ui/react-dialog";
|
|
113
|
-
import { Fragment, useCallback as
|
|
115
|
+
import { Fragment as Fragment2, useCallback as useCallback3, useEffect as useEffect3, useId, useMemo as useMemo2, useRef as useRef3, useState as useState3 } from "react";
|
|
116
|
+
|
|
117
|
+
// src/notifications/agg-notification-events-provider.tsx
|
|
118
|
+
import {
|
|
119
|
+
useAggAuthState,
|
|
120
|
+
useAggLabels,
|
|
121
|
+
useAggUiConfig,
|
|
122
|
+
useOnOrderEvent,
|
|
123
|
+
useOnWithdrawalLifecycle,
|
|
124
|
+
useOptionalAggClient,
|
|
125
|
+
useUserActivity
|
|
126
|
+
} from "@agg-build/hooks";
|
|
127
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
128
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
129
|
+
function AggNotificationEventsProvider({
|
|
130
|
+
children,
|
|
131
|
+
enabled = true,
|
|
132
|
+
depositActivityLimit = 25
|
|
133
|
+
}) {
|
|
134
|
+
const aggClient = useOptionalAggClient();
|
|
135
|
+
if (!aggClient) {
|
|
136
|
+
return /* @__PURE__ */ jsx2(Fragment, { children });
|
|
137
|
+
}
|
|
138
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
139
|
+
/* @__PURE__ */ jsx2(AggNotificationEventsBridge, { enabled, depositActivityLimit }),
|
|
140
|
+
children
|
|
141
|
+
] });
|
|
142
|
+
}
|
|
143
|
+
var TERMINAL_ORDER_EVENTS = /* @__PURE__ */ new Set(["filled", "partial_fill", "failed"]);
|
|
144
|
+
var firedOrderNotificationKeys = /* @__PURE__ */ new Set();
|
|
145
|
+
var TERMINAL_WITHDRAWAL_STATUSES = /* @__PURE__ */ new Set([
|
|
146
|
+
"completed",
|
|
147
|
+
"partial",
|
|
148
|
+
"failed"
|
|
149
|
+
]);
|
|
150
|
+
var isTerminalWithdrawalStatus = (value) => TERMINAL_WITHDRAWAL_STATUSES.has(value);
|
|
151
|
+
var MICRO_UNITS_SCALE = 1e6;
|
|
152
|
+
var formatScaledMicroAmount = (value) => {
|
|
153
|
+
if (!value) return void 0;
|
|
154
|
+
if (value.includes(".")) {
|
|
155
|
+
const parsed = Number(value);
|
|
156
|
+
if (!Number.isFinite(parsed)) return void 0;
|
|
157
|
+
return parsed.toLocaleString("en-US", { maximumFractionDigits: 2 });
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
const raw = BigInt(value);
|
|
161
|
+
const whole = raw / BigInt(MICRO_UNITS_SCALE);
|
|
162
|
+
const remainder = raw % BigInt(MICRO_UNITS_SCALE);
|
|
163
|
+
const parsed = Number(whole) + Number(remainder) / MICRO_UNITS_SCALE;
|
|
164
|
+
return parsed.toLocaleString("en-US", { maximumFractionDigits: 2 });
|
|
165
|
+
} catch (e) {
|
|
166
|
+
const parsed = Number(value);
|
|
167
|
+
if (!Number.isFinite(parsed)) return void 0;
|
|
168
|
+
return (parsed / MICRO_UNITS_SCALE).toLocaleString("en-US", { maximumFractionDigits: 2 });
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
var formatDecimalAmount = (value) => {
|
|
172
|
+
if (!value) return void 0;
|
|
173
|
+
const parsed = Number(value.replace(/,/g, ""));
|
|
174
|
+
if (!Number.isFinite(parsed)) return value;
|
|
175
|
+
return parsed.toLocaleString("en-US", { maximumFractionDigits: 2 });
|
|
176
|
+
};
|
|
177
|
+
var formatPriceCents = (value) => {
|
|
178
|
+
if (!value) return void 0;
|
|
179
|
+
const parsed = Number(value);
|
|
180
|
+
if (!Number.isFinite(parsed)) return void 0;
|
|
181
|
+
const cents = parsed * 100;
|
|
182
|
+
const display = cents.toLocaleString("en-US", {
|
|
183
|
+
minimumFractionDigits: 0,
|
|
184
|
+
maximumFractionDigits: 1
|
|
185
|
+
});
|
|
186
|
+
return `${display}\xA2`;
|
|
187
|
+
};
|
|
188
|
+
var formatSharesLabel = (raw) => {
|
|
189
|
+
const formatted = formatScaledMicroAmount(raw);
|
|
190
|
+
if (!formatted) return void 0;
|
|
191
|
+
return `${formatted} shares`;
|
|
192
|
+
};
|
|
193
|
+
var capitalize = (value) => {
|
|
194
|
+
if (!value) return void 0;
|
|
195
|
+
return value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();
|
|
196
|
+
};
|
|
197
|
+
var venueLabelFor = (venueKey, labels) => {
|
|
198
|
+
var _a;
|
|
199
|
+
if (!venueKey) return void 0;
|
|
200
|
+
const normalized = venueKey.toLowerCase();
|
|
201
|
+
const lookup = labels.venues;
|
|
202
|
+
return (_a = lookup[normalized]) != null ? _a : capitalize(venueKey);
|
|
203
|
+
};
|
|
204
|
+
function resetOrderNotificationDedupe() {
|
|
205
|
+
firedOrderNotificationKeys.clear();
|
|
206
|
+
}
|
|
207
|
+
function AggNotificationEventsBridge({ enabled, depositActivityLimit }) {
|
|
208
|
+
var _a;
|
|
209
|
+
const toastCtx = useOptionalToast();
|
|
210
|
+
const { user, isAuthenticated } = useAggAuthState();
|
|
211
|
+
const labels = useAggLabels();
|
|
212
|
+
const { features } = useAggUiConfig();
|
|
213
|
+
const notificationsFeatureEnabled = features.enableNotifications !== false;
|
|
214
|
+
const effectivelyEnabled = enabled && notificationsFeatureEnabled;
|
|
215
|
+
const currentUserId = (_a = user == null ? void 0 : user.id) != null ? _a : null;
|
|
216
|
+
const firedKeysRef = useRef(/* @__PURE__ */ new Set());
|
|
217
|
+
const depositStatusesRef = useRef(/* @__PURE__ */ new Map());
|
|
218
|
+
const hasSeededDepositStatusesRef = useRef(false);
|
|
219
|
+
const recentClientDepositFingerprintsRef = useRef(/* @__PURE__ */ new Map());
|
|
220
|
+
const lastUserIdRef = useRef("uninitialized");
|
|
221
|
+
useEffect(() => {
|
|
222
|
+
if (lastUserIdRef.current === currentUserId) return;
|
|
223
|
+
lastUserIdRef.current = currentUserId;
|
|
224
|
+
firedKeysRef.current = /* @__PURE__ */ new Set();
|
|
225
|
+
resetOrderNotificationDedupe();
|
|
226
|
+
depositStatusesRef.current = /* @__PURE__ */ new Map();
|
|
227
|
+
hasSeededDepositStatusesRef.current = false;
|
|
228
|
+
recentClientDepositFingerprintsRef.current = /* @__PURE__ */ new Map();
|
|
229
|
+
}, [currentUserId]);
|
|
230
|
+
const fireOnce = useCallback(
|
|
231
|
+
(key, tone, title, message, detail) => {
|
|
232
|
+
if (!effectivelyEnabled) return;
|
|
233
|
+
const toast = toastCtx == null ? void 0 : toastCtx.toast;
|
|
234
|
+
if (!toast) return;
|
|
235
|
+
if (firedKeysRef.current.has(key)) return;
|
|
236
|
+
firedKeysRef.current.add(key);
|
|
237
|
+
toast(message, { tone, title, detail });
|
|
238
|
+
},
|
|
239
|
+
[effectivelyEnabled, toastCtx]
|
|
240
|
+
);
|
|
241
|
+
const orderEventCallback = useCallback(
|
|
242
|
+
(event) => {
|
|
243
|
+
if (!effectivelyEnabled || !isAuthenticated) return;
|
|
244
|
+
if (!currentUserId || event.userId !== currentUserId) return;
|
|
245
|
+
if (!TERMINAL_ORDER_EVENTS.has(event.event)) return;
|
|
246
|
+
handleOrderEvent({ event, labels, fireOnce });
|
|
247
|
+
},
|
|
248
|
+
[currentUserId, effectivelyEnabled, fireOnce, isAuthenticated, labels]
|
|
249
|
+
);
|
|
250
|
+
useOnOrderEvent(orderEventCallback);
|
|
251
|
+
const withdrawalCallback = useCallback(
|
|
252
|
+
(event) => {
|
|
253
|
+
if (!effectivelyEnabled || !isAuthenticated) return;
|
|
254
|
+
if (!currentUserId || event.userId !== currentUserId) return;
|
|
255
|
+
if (!event.terminal) return;
|
|
256
|
+
if (!isTerminalWithdrawalStatus(event.status)) return;
|
|
257
|
+
handleWithdrawalEvent({ event, labels, fireOnce });
|
|
258
|
+
},
|
|
259
|
+
[currentUserId, effectivelyEnabled, fireOnce, isAuthenticated, labels]
|
|
260
|
+
);
|
|
261
|
+
useOnWithdrawalLifecycle(withdrawalCallback);
|
|
262
|
+
useEffect(() => {
|
|
263
|
+
if (!effectivelyEnabled || !isAuthenticated || !currentUserId) return;
|
|
264
|
+
return subscribeAggDepositNotification((event) => {
|
|
265
|
+
handleClientDepositNotification({
|
|
266
|
+
event,
|
|
267
|
+
labels,
|
|
268
|
+
fireOnce,
|
|
269
|
+
recentClientDepositFingerprints: recentClientDepositFingerprintsRef.current
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
}, [currentUserId, effectivelyEnabled, fireOnce, isAuthenticated, labels]);
|
|
273
|
+
const depositActivity = useUserActivity({
|
|
274
|
+
type: "deposit",
|
|
275
|
+
limit: depositActivityLimit,
|
|
276
|
+
enabled: effectivelyEnabled && isAuthenticated && currentUserId !== null
|
|
277
|
+
});
|
|
278
|
+
const depositActivities = depositActivity.activities;
|
|
279
|
+
useEffect(() => {
|
|
280
|
+
if (!effectivelyEnabled || !isAuthenticated || !currentUserId) return;
|
|
281
|
+
if (!depositActivity.isSuccess) return;
|
|
282
|
+
handleDepositActivities({
|
|
283
|
+
deposits: depositActivities,
|
|
284
|
+
previousStatuses: depositStatusesRef.current,
|
|
285
|
+
hasSeededStatuses: hasSeededDepositStatusesRef.current,
|
|
286
|
+
labels,
|
|
287
|
+
fireOnce,
|
|
288
|
+
shouldSuppressToast: (status, amountLabel, tokenLabel) => hasRecentClientDepositNotification({
|
|
289
|
+
recentClientDepositFingerprints: recentClientDepositFingerprintsRef.current,
|
|
290
|
+
status,
|
|
291
|
+
amountLabel,
|
|
292
|
+
tokenLabel
|
|
293
|
+
})
|
|
294
|
+
});
|
|
295
|
+
hasSeededDepositStatusesRef.current = true;
|
|
296
|
+
}, [
|
|
297
|
+
currentUserId,
|
|
298
|
+
depositActivities,
|
|
299
|
+
depositActivity.isSuccess,
|
|
300
|
+
effectivelyEnabled,
|
|
301
|
+
fireOnce,
|
|
302
|
+
isAuthenticated,
|
|
303
|
+
labels
|
|
304
|
+
]);
|
|
305
|
+
return null;
|
|
306
|
+
}
|
|
307
|
+
function handleOrderEvent({ event, labels, fireOnce }) {
|
|
308
|
+
var _a, _b;
|
|
309
|
+
const venueLabel = venueLabelFor(event.venue, labels);
|
|
310
|
+
const amountLabel = formatSharesLabel((_a = event.actualSharesRaw) != null ? _a : event.filledAmountRaw);
|
|
311
|
+
const priceLabel = formatPriceCents((_b = event.executionPriceRaw) != null ? _b : event.quotedPriceRaw);
|
|
312
|
+
const fireOrderOnce = (key, tone, title, message, detail) => {
|
|
313
|
+
if (firedOrderNotificationKeys.has(key)) return;
|
|
314
|
+
firedOrderNotificationKeys.add(key);
|
|
315
|
+
fireOnce(key, tone, title, message, detail);
|
|
316
|
+
};
|
|
317
|
+
if (event.event === "filled") {
|
|
318
|
+
fireOrderOnce(
|
|
319
|
+
`order:${event.orderId}:filled`,
|
|
320
|
+
"success",
|
|
321
|
+
labels.notifications.order.filledTitle,
|
|
322
|
+
labels.notifications.order.filledMessage({ venueLabel, amountLabel, priceLabel })
|
|
323
|
+
);
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
if (event.event === "partial_fill") {
|
|
327
|
+
fireOrderOnce(
|
|
328
|
+
`order:${event.orderId}:partial_fill`,
|
|
329
|
+
"warning",
|
|
330
|
+
labels.notifications.order.partialFilledTitle,
|
|
331
|
+
labels.notifications.order.partialFilledMessage({ venueLabel, amountLabel, priceLabel })
|
|
332
|
+
);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
if (event.event === "failed") {
|
|
336
|
+
fireOrderOnce(
|
|
337
|
+
`order:${event.orderId}:failed`,
|
|
338
|
+
"error",
|
|
339
|
+
labels.notifications.order.failedTitle,
|
|
340
|
+
labels.notifications.order.failedMessage(event.errorReason),
|
|
341
|
+
venueLabel
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
function handleWithdrawalEvent({ event, labels, fireOnce }) {
|
|
346
|
+
var _a;
|
|
347
|
+
const amountLabel = formatScaledMicroAmount((_a = event.completedAmountRaw) != null ? _a : event.requestedAmountRaw);
|
|
348
|
+
if (event.status === "completed") {
|
|
349
|
+
fireOnce(
|
|
350
|
+
`withdrawal:${event.withdrawalId}:completed`,
|
|
351
|
+
"success",
|
|
352
|
+
labels.notifications.withdrawal.completedTitle,
|
|
353
|
+
labels.notifications.withdrawal.completedMessage({ amountLabel })
|
|
354
|
+
);
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
if (event.status === "partial") {
|
|
358
|
+
fireOnce(
|
|
359
|
+
`withdrawal:${event.withdrawalId}:partial`,
|
|
360
|
+
"warning",
|
|
361
|
+
labels.notifications.withdrawal.partialTitle,
|
|
362
|
+
labels.notifications.withdrawal.partialMessage({ amountLabel })
|
|
363
|
+
);
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
if (event.status === "failed") {
|
|
367
|
+
fireOnce(
|
|
368
|
+
`withdrawal:${event.withdrawalId}:failed`,
|
|
369
|
+
"error",
|
|
370
|
+
labels.notifications.withdrawal.failedTitle,
|
|
371
|
+
labels.notifications.withdrawal.failedMessage(event.errorMessage)
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
var DEPOSIT_COMPLETED_STATUSES = /* @__PURE__ */ new Set(["completed", "confirmed", "succeeded", "success"]);
|
|
376
|
+
var DEPOSIT_FAILED_STATUSES = /* @__PURE__ */ new Set(["failed", "errored", "rejected"]);
|
|
377
|
+
var CLIENT_DEPOSIT_ACTIVITY_SUPPRESSION_MS = 2 * 60 * 1e3;
|
|
378
|
+
var isTerminalDepositStatus = (status) => DEPOSIT_COMPLETED_STATUSES.has(status) || DEPOSIT_FAILED_STATUSES.has(status);
|
|
379
|
+
var getDepositNotificationFingerprint = ({
|
|
380
|
+
status,
|
|
381
|
+
amountLabel,
|
|
382
|
+
tokenLabel
|
|
383
|
+
}) => `${status}:${amountLabel != null ? amountLabel : ""}:${tokenLabel != null ? tokenLabel : ""}`.toLowerCase();
|
|
384
|
+
var hasRecentClientDepositNotification = ({
|
|
385
|
+
recentClientDepositFingerprints,
|
|
386
|
+
status,
|
|
387
|
+
amountLabel,
|
|
388
|
+
tokenLabel
|
|
389
|
+
}) => {
|
|
390
|
+
const fingerprint = getDepositNotificationFingerprint({ status, amountLabel, tokenLabel });
|
|
391
|
+
const lastNotifiedAt = recentClientDepositFingerprints.get(fingerprint);
|
|
392
|
+
if (!lastNotifiedAt) return false;
|
|
393
|
+
if (Date.now() - lastNotifiedAt <= CLIENT_DEPOSIT_ACTIVITY_SUPPRESSION_MS) {
|
|
394
|
+
return true;
|
|
395
|
+
}
|
|
396
|
+
recentClientDepositFingerprints.delete(fingerprint);
|
|
397
|
+
return false;
|
|
398
|
+
};
|
|
399
|
+
function handleClientDepositNotification({
|
|
400
|
+
event,
|
|
401
|
+
labels,
|
|
402
|
+
fireOnce,
|
|
403
|
+
recentClientDepositFingerprints
|
|
404
|
+
}) {
|
|
405
|
+
var _a, _b, _c;
|
|
406
|
+
const amountLabel = formatDecimalAmount(event.amount);
|
|
407
|
+
const tokenLabel = event.tokenSymbol;
|
|
408
|
+
const fingerprint = getDepositNotificationFingerprint({
|
|
409
|
+
status: event.status,
|
|
410
|
+
amountLabel,
|
|
411
|
+
tokenLabel
|
|
412
|
+
});
|
|
413
|
+
recentClientDepositFingerprints.set(fingerprint, Date.now());
|
|
414
|
+
if (event.status === "completed") {
|
|
415
|
+
fireOnce(
|
|
416
|
+
`deposit-client:${(_a = event.id) != null ? _a : fingerprint}:completed`,
|
|
417
|
+
"success",
|
|
418
|
+
labels.notifications.deposit.completedTitle,
|
|
419
|
+
labels.notifications.deposit.completedMessage({ amountLabel, tokenLabel })
|
|
420
|
+
);
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
fireOnce(
|
|
424
|
+
`deposit-client:${(_b = event.id) != null ? _b : fingerprint}:failed`,
|
|
425
|
+
"error",
|
|
426
|
+
labels.notifications.deposit.failedTitle,
|
|
427
|
+
(_c = event.errorMessage) != null ? _c : labels.notifications.deposit.failedMessage({ amountLabel, tokenLabel })
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
function handleDepositActivities({
|
|
431
|
+
deposits,
|
|
432
|
+
previousStatuses,
|
|
433
|
+
hasSeededStatuses,
|
|
434
|
+
labels,
|
|
435
|
+
fireOnce,
|
|
436
|
+
shouldSuppressToast
|
|
437
|
+
}) {
|
|
438
|
+
for (const item of deposits) {
|
|
439
|
+
if (item.type !== "deposit") continue;
|
|
440
|
+
const deposit = item;
|
|
441
|
+
const status = deposit.status.toLowerCase();
|
|
442
|
+
const isCompleted = DEPOSIT_COMPLETED_STATUSES.has(status);
|
|
443
|
+
const isFailed = DEPOSIT_FAILED_STATUSES.has(status);
|
|
444
|
+
const previousStatus = previousStatuses.get(deposit.id);
|
|
445
|
+
previousStatuses.set(deposit.id, status);
|
|
446
|
+
if (!hasSeededStatuses) continue;
|
|
447
|
+
if (!previousStatus) continue;
|
|
448
|
+
if (isTerminalDepositStatus(previousStatus)) continue;
|
|
449
|
+
if (!isCompleted && !isFailed) continue;
|
|
450
|
+
const amountLabel = formatScaledMicroAmount(deposit.amountRaw);
|
|
451
|
+
const tokenLabel = deposit.tokenSymbol;
|
|
452
|
+
const terminalStatus = isCompleted ? "completed" : "failed";
|
|
453
|
+
if (shouldSuppressToast == null ? void 0 : shouldSuppressToast(terminalStatus, amountLabel, tokenLabel)) continue;
|
|
454
|
+
if (isCompleted) {
|
|
455
|
+
fireOnce(
|
|
456
|
+
`deposit:${deposit.id}:completed`,
|
|
457
|
+
"success",
|
|
458
|
+
labels.notifications.deposit.completedTitle,
|
|
459
|
+
labels.notifications.deposit.completedMessage({ amountLabel, tokenLabel })
|
|
460
|
+
);
|
|
461
|
+
} else {
|
|
462
|
+
fireOnce(
|
|
463
|
+
`deposit:${deposit.id}:failed`,
|
|
464
|
+
"error",
|
|
465
|
+
labels.notifications.deposit.failedTitle,
|
|
466
|
+
labels.notifications.deposit.failedMessage({ amountLabel, tokenLabel })
|
|
467
|
+
);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}
|
|
114
471
|
|
|
115
472
|
// src/shared/deposit-modal-events.ts
|
|
116
473
|
var DEPOSIT_MODAL_OPEN_EVENT = "agg-deposit:open-modal";
|
|
@@ -126,7 +483,7 @@ var requestAggWithdrawModalOpen = () => {
|
|
|
126
483
|
|
|
127
484
|
// src/trading/use-kalshi-kyc-flow.ts
|
|
128
485
|
import { useAggClient, useDepositAddresses } from "@agg-build/hooks";
|
|
129
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
486
|
+
import { useCallback as useCallback2, useEffect as useEffect2, useMemo, useRef as useRef2, useState } from "react";
|
|
130
487
|
var KYC_PENDING_STORAGE_KEY = "agg_kyc_pending";
|
|
131
488
|
var getKycPendingState = () => {
|
|
132
489
|
var _a, _b;
|
|
@@ -161,7 +518,7 @@ var useKalshiKycFlow = ({
|
|
|
161
518
|
const [showSuccessModal, setShowSuccessModal] = useState(false);
|
|
162
519
|
const [isInitiating, setIsInitiating] = useState(false);
|
|
163
520
|
const [needsDepositAddress, setNeedsDepositAddress] = useState(false);
|
|
164
|
-
const initiationAttemptRef =
|
|
521
|
+
const initiationAttemptRef = useRef2(0);
|
|
165
522
|
const { isReady, isTimedOut } = useDepositAddresses({ enabled: needsDepositAddress, poll: true });
|
|
166
523
|
const pendingState = useMemo(
|
|
167
524
|
() => ({
|
|
@@ -171,28 +528,28 @@ var useKalshiKycFlow = ({
|
|
|
171
528
|
}),
|
|
172
529
|
[userId, walletAddress]
|
|
173
530
|
);
|
|
174
|
-
const resetInitiation =
|
|
531
|
+
const resetInitiation = useCallback2(() => {
|
|
175
532
|
setIsInitiating(false);
|
|
176
533
|
setNeedsDepositAddress(false);
|
|
177
534
|
}, []);
|
|
178
|
-
const closeVerifyModal =
|
|
535
|
+
const closeVerifyModal = useCallback2(() => {
|
|
179
536
|
initiationAttemptRef.current += 1;
|
|
180
537
|
clearKycPendingState();
|
|
181
538
|
resetInitiation();
|
|
182
539
|
setIsVerifyModalOpen(false);
|
|
183
540
|
}, [resetInitiation]);
|
|
184
|
-
const closeSuccessModal =
|
|
541
|
+
const closeSuccessModal = useCallback2(() => {
|
|
185
542
|
setShowSuccessModal(false);
|
|
186
543
|
}, []);
|
|
187
|
-
const openVerifyModal =
|
|
544
|
+
const openVerifyModal = useCallback2(() => {
|
|
188
545
|
setIsVerifyModalOpen(true);
|
|
189
546
|
}, []);
|
|
190
|
-
const startVerification =
|
|
547
|
+
const startVerification = useCallback2(() => {
|
|
191
548
|
initiationAttemptRef.current += 1;
|
|
192
549
|
setIsInitiating(true);
|
|
193
550
|
setNeedsDepositAddress(true);
|
|
194
551
|
}, []);
|
|
195
|
-
|
|
552
|
+
useEffect2(() => {
|
|
196
553
|
if (!isInitiating || !isReady) return;
|
|
197
554
|
const attemptId = initiationAttemptRef.current;
|
|
198
555
|
const redirectUri = window.location.href;
|
|
@@ -209,14 +566,14 @@ var useKalshiKycFlow = ({
|
|
|
209
566
|
resetInitiation();
|
|
210
567
|
});
|
|
211
568
|
}, [client, isInitiating, isReady, onError, pendingState, resetInitiation]);
|
|
212
|
-
|
|
569
|
+
useEffect2(() => {
|
|
213
570
|
if (isTimedOut && isInitiating) {
|
|
214
571
|
clearKycPendingState();
|
|
215
572
|
resetInitiation();
|
|
216
573
|
onError == null ? void 0 : onError(new Error("Deposit address provisioning timed out"));
|
|
217
574
|
}
|
|
218
575
|
}, [isInitiating, isTimedOut, onError, resetInitiation]);
|
|
219
|
-
|
|
576
|
+
useEffect2(() => {
|
|
220
577
|
const storedPendingState = getKycPendingState();
|
|
221
578
|
const isMatchingSession = (storedPendingState == null ? void 0 : storedPendingState.venue) === "kalshi" && storedPendingState.userId === pendingState.userId && storedPendingState.walletAddress === pendingState.walletAddress;
|
|
222
579
|
if (isKalshiVerified && isMatchingSession) {
|
|
@@ -1806,7 +2163,7 @@ var isPercentageBelowMinimum = (value, minimumValue) => {
|
|
|
1806
2163
|
};
|
|
1807
2164
|
|
|
1808
2165
|
// src/trading/place-order/index.place-order.failure.tsx
|
|
1809
|
-
import { jsx as
|
|
2166
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1810
2167
|
var resolveFailureActionHandler = ({
|
|
1811
2168
|
action,
|
|
1812
2169
|
onDone,
|
|
@@ -1819,12 +2176,12 @@ var resolveFailureActionHandler = ({
|
|
|
1819
2176
|
};
|
|
1820
2177
|
var renderPartialFailureStep = (step) => {
|
|
1821
2178
|
const isWarningStep = step.tone === "warning" || step.tone === "error";
|
|
1822
|
-
return /* @__PURE__ */
|
|
2179
|
+
return /* @__PURE__ */ jsxs2(
|
|
1823
2180
|
"div",
|
|
1824
2181
|
{
|
|
1825
2182
|
className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
1826
2183
|
children: [
|
|
1827
|
-
/* @__PURE__ */
|
|
2184
|
+
/* @__PURE__ */ jsx3(
|
|
1828
2185
|
Icon,
|
|
1829
2186
|
{
|
|
1830
2187
|
name: isWarningStep ? "warning-filled" : "check-circle",
|
|
@@ -1833,8 +2190,8 @@ var renderPartialFailureStep = (step) => {
|
|
|
1833
2190
|
"aria-hidden": "true"
|
|
1834
2191
|
}
|
|
1835
2192
|
),
|
|
1836
|
-
/* @__PURE__ */
|
|
1837
|
-
step.venue ? /* @__PURE__ */
|
|
2193
|
+
/* @__PURE__ */ jsx3("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
2194
|
+
step.venue ? /* @__PURE__ */ jsx3(VenueLogo, { venue: step.venue, size: "small", className: "h-4 w-4 shrink-0" }) : null
|
|
1838
2195
|
]
|
|
1839
2196
|
},
|
|
1840
2197
|
step.id
|
|
@@ -1853,10 +2210,10 @@ var PlaceOrderFailureView = ({
|
|
|
1853
2210
|
const shouldShowPartialFailureLayout = summary.kind === "partial_fill";
|
|
1854
2211
|
const failureStepGroups = shouldShowPartialFailureLayout ? groupPlaceOrderFailureSteps(summary.steps) : [];
|
|
1855
2212
|
if (shouldShowPartialFailureLayout) {
|
|
1856
|
-
return /* @__PURE__ */
|
|
1857
|
-
/* @__PURE__ */
|
|
1858
|
-
/* @__PURE__ */
|
|
1859
|
-
/* @__PURE__ */
|
|
2213
|
+
return /* @__PURE__ */ jsx3(Card, { className: cn("group/agg-order-panel", getPlaceOrderContainerClassName(), className), children: /* @__PURE__ */ jsxs2("div", { className: "agg-order-failure-body flex flex-col gap-6 p-5", children: [
|
|
2214
|
+
/* @__PURE__ */ jsxs2("div", { className: "agg-order-failure-header flex flex-col gap-2", children: [
|
|
2215
|
+
/* @__PURE__ */ jsxs2("div", { className: "agg-order-failure-market flex items-center gap-3", children: [
|
|
2216
|
+
/* @__PURE__ */ jsx3(
|
|
1860
2217
|
RemoteImage,
|
|
1861
2218
|
{
|
|
1862
2219
|
src: (_a = summary.eventImage) != null ? _a : null,
|
|
@@ -1864,12 +2221,12 @@ var PlaceOrderFailureView = ({
|
|
|
1864
2221
|
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
1865
2222
|
}
|
|
1866
2223
|
),
|
|
1867
|
-
/* @__PURE__ */
|
|
2224
|
+
/* @__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 })
|
|
1868
2225
|
] }),
|
|
1869
|
-
summary.eventSubtitle ? /* @__PURE__ */
|
|
2226
|
+
summary.eventSubtitle ? /* @__PURE__ */ jsx3("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
|
|
1870
2227
|
] }),
|
|
1871
|
-
/* @__PURE__ */
|
|
1872
|
-
/* @__PURE__ */
|
|
2228
|
+
/* @__PURE__ */ jsx3("div", { className: "flex flex-col gap-4", children: failureStepGroups.map((group, groupIndex) => /* @__PURE__ */ jsx3("div", { className: "flex flex-col gap-2", children: group.map((step) => renderPartialFailureStep(step)) }, `failure-group-${groupIndex}`)) }),
|
|
2229
|
+
/* @__PURE__ */ jsx3("div", { className: "flex items-center gap-4", children: summary.actions.map((action) => /* @__PURE__ */ jsx3(
|
|
1873
2230
|
Button,
|
|
1874
2231
|
{
|
|
1875
2232
|
variant: "tertiary",
|
|
@@ -1883,10 +2240,10 @@ var PlaceOrderFailureView = ({
|
|
|
1883
2240
|
)) })
|
|
1884
2241
|
] }) });
|
|
1885
2242
|
}
|
|
1886
|
-
return /* @__PURE__ */
|
|
1887
|
-
/* @__PURE__ */
|
|
1888
|
-
/* @__PURE__ */
|
|
1889
|
-
/* @__PURE__ */
|
|
2243
|
+
return /* @__PURE__ */ jsx3(Card, { className: cn("group/agg-order-panel", getPlaceOrderContainerClassName(), className), children: /* @__PURE__ */ jsxs2("div", { className: "agg-order-failure-body flex flex-col gap-6 p-5", children: [
|
|
2244
|
+
/* @__PURE__ */ jsxs2("div", { className: "agg-order-failure-header flex flex-col gap-2", children: [
|
|
2245
|
+
/* @__PURE__ */ jsxs2("div", { className: "agg-order-failure-market flex items-center gap-3", children: [
|
|
2246
|
+
/* @__PURE__ */ jsx3(
|
|
1890
2247
|
RemoteImage,
|
|
1891
2248
|
{
|
|
1892
2249
|
src: (_b = summary.eventImage) != null ? _b : null,
|
|
@@ -1894,11 +2251,11 @@ var PlaceOrderFailureView = ({
|
|
|
1894
2251
|
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
1895
2252
|
}
|
|
1896
2253
|
),
|
|
1897
|
-
/* @__PURE__ */
|
|
2254
|
+
/* @__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 })
|
|
1898
2255
|
] }),
|
|
1899
|
-
summary.eventSubtitle ? /* @__PURE__ */
|
|
2256
|
+
summary.eventSubtitle ? /* @__PURE__ */ jsx3("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
|
|
1900
2257
|
] }),
|
|
1901
|
-
/* @__PURE__ */
|
|
2258
|
+
/* @__PURE__ */ jsx3(
|
|
1902
2259
|
InlineAlert,
|
|
1903
2260
|
{
|
|
1904
2261
|
tone: "error",
|
|
@@ -1907,7 +2264,7 @@ var PlaceOrderFailureView = ({
|
|
|
1907
2264
|
message: tradingLabels.orderFailureDescription((_c = summary.errorMessage) != null ? _c : "")
|
|
1908
2265
|
}
|
|
1909
2266
|
),
|
|
1910
|
-
/* @__PURE__ */
|
|
2267
|
+
/* @__PURE__ */ jsx3("div", { className: "agg-order-failure-actions flex items-center gap-3", children: summary.actions.map((action) => /* @__PURE__ */ jsx3(
|
|
1911
2268
|
Button,
|
|
1912
2269
|
{
|
|
1913
2270
|
variant: action.variant === "retry" ? "primary" : "secondary",
|
|
@@ -1925,7 +2282,7 @@ PlaceOrderFailureView.displayName = "PlaceOrderFailureView";
|
|
|
1925
2282
|
|
|
1926
2283
|
// src/trading/place-order/index.place-order.success.tsx
|
|
1927
2284
|
import { useState as useState2 } from "react";
|
|
1928
|
-
import { jsx as
|
|
2285
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1929
2286
|
var resolveBuyToWinLabel = (shares) => {
|
|
1930
2287
|
if (!shares) return "$0";
|
|
1931
2288
|
return shares.startsWith("$") ? shares : `$${shares}`;
|
|
@@ -1956,10 +2313,10 @@ var PlaceOrderSuccessView = ({
|
|
|
1956
2313
|
const resolveStepIconClassName = (tone) => {
|
|
1957
2314
|
return tone === "warning" || tone === "error" ? "text-agg-warning" : "text-agg-primary";
|
|
1958
2315
|
};
|
|
1959
|
-
return /* @__PURE__ */
|
|
1960
|
-
summary.eventTitle ? /* @__PURE__ */
|
|
1961
|
-
/* @__PURE__ */
|
|
1962
|
-
/* @__PURE__ */
|
|
2316
|
+
return /* @__PURE__ */ jsx4(Card, { className: cn("group/agg-order-panel", getPlaceOrderContainerClassName(), className), children: /* @__PURE__ */ jsxs3("div", { className: "agg-order-success-body flex flex-col gap-6 p-5", children: [
|
|
2317
|
+
summary.eventTitle ? /* @__PURE__ */ jsxs3("div", { className: "agg-order-success-header flex flex-col gap-2", children: [
|
|
2318
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-order-success-market flex items-center gap-3", children: [
|
|
2319
|
+
/* @__PURE__ */ jsx4(
|
|
1963
2320
|
RemoteImage,
|
|
1964
2321
|
{
|
|
1965
2322
|
src: (_h = summary.eventImage) != null ? _h : null,
|
|
@@ -1967,12 +2324,12 @@ var PlaceOrderSuccessView = ({
|
|
|
1967
2324
|
className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
1968
2325
|
}
|
|
1969
2326
|
),
|
|
1970
|
-
/* @__PURE__ */
|
|
2327
|
+
/* @__PURE__ */ jsx4("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 })
|
|
1971
2328
|
] }),
|
|
1972
|
-
summary.eventDateLabel ? /* @__PURE__ */
|
|
2329
|
+
summary.eventDateLabel ? /* @__PURE__ */ jsx4("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventDateLabel }) : null
|
|
1973
2330
|
] }) : null,
|
|
1974
|
-
executionStepGroups.length > 0 ? /* @__PURE__ */
|
|
1975
|
-
/* @__PURE__ */
|
|
2331
|
+
executionStepGroups.length > 0 ? /* @__PURE__ */ jsxs3("div", { className: "agg-order-success-timeline flex flex-col gap-2", children: [
|
|
2332
|
+
/* @__PURE__ */ jsx4(
|
|
1976
2333
|
"div",
|
|
1977
2334
|
{
|
|
1978
2335
|
"aria-hidden": !isExecutionDetailsExpanded,
|
|
@@ -1985,12 +2342,12 @@ var PlaceOrderSuccessView = ({
|
|
|
1985
2342
|
"transition-[grid-template-rows,opacity] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
1986
2343
|
)
|
|
1987
2344
|
),
|
|
1988
|
-
children: /* @__PURE__ */
|
|
2345
|
+
children: /* @__PURE__ */ jsx4("div", { className: "min-h-0", children: /* @__PURE__ */ jsx4("div", { className: "flex flex-col gap-4 pb-2", children: detailedStepGroups.map((group, groupIndex) => /* @__PURE__ */ jsx4("div", { className: "flex flex-col gap-2", children: group.map((step) => /* @__PURE__ */ jsxs3(
|
|
1989
2346
|
"div",
|
|
1990
2347
|
{
|
|
1991
2348
|
className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
1992
2349
|
children: [
|
|
1993
|
-
/* @__PURE__ */
|
|
2350
|
+
/* @__PURE__ */ jsx4(
|
|
1994
2351
|
Icon,
|
|
1995
2352
|
{
|
|
1996
2353
|
name: resolveStepIconName(step.tone),
|
|
@@ -1999,8 +2356,8 @@ var PlaceOrderSuccessView = ({
|
|
|
1999
2356
|
"aria-hidden": "true"
|
|
2000
2357
|
}
|
|
2001
2358
|
),
|
|
2002
|
-
/* @__PURE__ */
|
|
2003
|
-
step.venue ? /* @__PURE__ */
|
|
2359
|
+
/* @__PURE__ */ jsx4("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
2360
|
+
step.venue ? /* @__PURE__ */ jsx4(
|
|
2004
2361
|
VenueLogo,
|
|
2005
2362
|
{
|
|
2006
2363
|
venue: step.venue,
|
|
@@ -2014,7 +2371,7 @@ var PlaceOrderSuccessView = ({
|
|
|
2014
2371
|
)) }, `execution-group-${groupIndex}`)) }) })
|
|
2015
2372
|
}
|
|
2016
2373
|
),
|
|
2017
|
-
finalStep ? hasExecutionDetails ? /* @__PURE__ */
|
|
2374
|
+
finalStep ? hasExecutionDetails ? /* @__PURE__ */ jsxs3(
|
|
2018
2375
|
"button",
|
|
2019
2376
|
{
|
|
2020
2377
|
type: "button",
|
|
@@ -2026,7 +2383,7 @@ var PlaceOrderSuccessView = ({
|
|
|
2026
2383
|
),
|
|
2027
2384
|
onClick: () => setIsExecutionDetailsExpanded((currentValue) => !currentValue),
|
|
2028
2385
|
children: [
|
|
2029
|
-
/* @__PURE__ */
|
|
2386
|
+
/* @__PURE__ */ jsx4(
|
|
2030
2387
|
Icon,
|
|
2031
2388
|
{
|
|
2032
2389
|
name: resolveStepIconName(finalStep.tone),
|
|
@@ -2035,8 +2392,8 @@ var PlaceOrderSuccessView = ({
|
|
|
2035
2392
|
"aria-hidden": "true"
|
|
2036
2393
|
}
|
|
2037
2394
|
),
|
|
2038
|
-
/* @__PURE__ */
|
|
2039
|
-
/* @__PURE__ */
|
|
2395
|
+
/* @__PURE__ */ jsx4("p", { className: "min-w-0 flex-1", children: finalStep.label }),
|
|
2396
|
+
/* @__PURE__ */ jsx4(
|
|
2040
2397
|
Icon,
|
|
2041
2398
|
{
|
|
2042
2399
|
name: isExecutionDetailsExpanded ? "chevron-up" : "chevron-down",
|
|
@@ -2047,8 +2404,8 @@ var PlaceOrderSuccessView = ({
|
|
|
2047
2404
|
)
|
|
2048
2405
|
]
|
|
2049
2406
|
}
|
|
2050
|
-
) : /* @__PURE__ */
|
|
2051
|
-
/* @__PURE__ */
|
|
2407
|
+
) : /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
2408
|
+
/* @__PURE__ */ jsx4(
|
|
2052
2409
|
Icon,
|
|
2053
2410
|
{
|
|
2054
2411
|
name: resolveStepIconName(finalStep.tone),
|
|
@@ -2057,34 +2414,34 @@ var PlaceOrderSuccessView = ({
|
|
|
2057
2414
|
"aria-hidden": "true"
|
|
2058
2415
|
}
|
|
2059
2416
|
),
|
|
2060
|
-
/* @__PURE__ */
|
|
2417
|
+
/* @__PURE__ */ jsx4("p", { className: "min-w-0 flex-1", children: finalStep.label })
|
|
2061
2418
|
] }) : null
|
|
2062
2419
|
] }) : null,
|
|
2063
|
-
/* @__PURE__ */
|
|
2420
|
+
/* @__PURE__ */ jsxs3(
|
|
2064
2421
|
"div",
|
|
2065
2422
|
{
|
|
2066
2423
|
className: cn(
|
|
2067
2424
|
"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"
|
|
2068
2425
|
),
|
|
2069
2426
|
children: [
|
|
2070
|
-
/* @__PURE__ */
|
|
2071
|
-
/* @__PURE__ */
|
|
2427
|
+
/* @__PURE__ */ jsx4(Icon, { name: "success-check", size: "small", className: "h-4 w-4 shrink-0 text-current" }),
|
|
2428
|
+
/* @__PURE__ */ jsx4("span", { children: resolvedActionLabel })
|
|
2072
2429
|
]
|
|
2073
2430
|
}
|
|
2074
2431
|
),
|
|
2075
|
-
/* @__PURE__ */
|
|
2076
|
-
/* @__PURE__ */
|
|
2077
|
-
/* @__PURE__ */
|
|
2432
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-order-success-summary flex items-center justify-between gap-4", children: [
|
|
2433
|
+
/* @__PURE__ */ jsx4("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.amount(resolvedTradeSide) }),
|
|
2434
|
+
/* @__PURE__ */ jsx4("p", { className: "text-right text-[30px] font-agg-bold leading-[36px] text-agg-foreground", children: resolvedAmountLabel })
|
|
2078
2435
|
] }),
|
|
2079
|
-
/* @__PURE__ */
|
|
2080
|
-
/* @__PURE__ */
|
|
2081
|
-
/* @__PURE__ */
|
|
2436
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-order-success-summary flex items-center justify-between gap-4", children: [
|
|
2437
|
+
/* @__PURE__ */ jsx4("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.toWin(resolvedTradeSide) }),
|
|
2438
|
+
/* @__PURE__ */ jsx4("p", { className: "text-right text-[30px] font-agg-bold leading-[36px] text-agg-success", children: resolvedToWinLabel })
|
|
2082
2439
|
] }),
|
|
2083
|
-
summary.potentialReturnLabel ? /* @__PURE__ */
|
|
2084
|
-
/* @__PURE__ */
|
|
2085
|
-
/* @__PURE__ */
|
|
2440
|
+
summary.potentialReturnLabel ? /* @__PURE__ */ jsxs3("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: [
|
|
2441
|
+
/* @__PURE__ */ jsx4("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 }),
|
|
2442
|
+
/* @__PURE__ */ jsx4("p", { className: "text-agg-xs leading-agg-4 text-agg-foreground", children: (_i = tradingLabels.withSmartRouting) != null ? _i : "with Smart Routing" })
|
|
2086
2443
|
] }) : null,
|
|
2087
|
-
/* @__PURE__ */
|
|
2444
|
+
/* @__PURE__ */ jsx4("div", { className: "agg-order-success-actions flex gap-3", children: /* @__PURE__ */ jsx4(
|
|
2088
2445
|
Button,
|
|
2089
2446
|
{
|
|
2090
2447
|
variant: "secondary",
|
|
@@ -2100,7 +2457,23 @@ var PlaceOrderSuccessView = ({
|
|
|
2100
2457
|
PlaceOrderSuccessView.displayName = "PlaceOrderSuccessView";
|
|
2101
2458
|
|
|
2102
2459
|
// src/trading/place-order/index.tsx
|
|
2103
|
-
import { Fragment as
|
|
2460
|
+
import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2461
|
+
var SELL_SHARE_INPUT_DECIMALS = 6;
|
|
2462
|
+
var SELL_SHARE_DISPLAY_DECIMALS = 2;
|
|
2463
|
+
var floorToDecimals = (value, decimals) => {
|
|
2464
|
+
if (!Number.isFinite(value) || value <= 0) return 0;
|
|
2465
|
+
const scale = __pow(10, decimals);
|
|
2466
|
+
return Math.trunc(value * scale) / scale;
|
|
2467
|
+
};
|
|
2468
|
+
var formatFlooredShareAmount = (value, decimals) => {
|
|
2469
|
+
const flooredValue = floorToDecimals(value, decimals);
|
|
2470
|
+
if (flooredValue <= 0) return "0";
|
|
2471
|
+
const formattedValue = flooredValue.toLocaleString("en-US", {
|
|
2472
|
+
minimumFractionDigits: 0,
|
|
2473
|
+
maximumFractionDigits: decimals
|
|
2474
|
+
});
|
|
2475
|
+
return formattedValue.replace(/(\.\d*?[1-9])0+$/u, "$1").replace(/\.0+$/u, "");
|
|
2476
|
+
};
|
|
2104
2477
|
var resolveRefetchedQuoteData = (result) => {
|
|
2105
2478
|
if (!result || typeof result !== "object" || !("data" in result)) return null;
|
|
2106
2479
|
const data = result.data;
|
|
@@ -2119,7 +2492,7 @@ var LoadingGlyph = ({
|
|
|
2119
2492
|
className,
|
|
2120
2493
|
enableAnimations
|
|
2121
2494
|
}) => {
|
|
2122
|
-
return /* @__PURE__ */
|
|
2495
|
+
return /* @__PURE__ */ jsx5(
|
|
2123
2496
|
"span",
|
|
2124
2497
|
{
|
|
2125
2498
|
"aria-hidden": "true",
|
|
@@ -2140,9 +2513,9 @@ var PlaceOrderSlippageControl = ({
|
|
|
2140
2513
|
}) => {
|
|
2141
2514
|
var _a, _b;
|
|
2142
2515
|
const labels = useLabels();
|
|
2143
|
-
const containerRef =
|
|
2144
|
-
const triggerRef =
|
|
2145
|
-
const inputRef =
|
|
2516
|
+
const containerRef = useRef3(null);
|
|
2517
|
+
const triggerRef = useRef3(null);
|
|
2518
|
+
const inputRef = useRef3(null);
|
|
2146
2519
|
const warningId = useId();
|
|
2147
2520
|
const defaultValue = finalizePercentageValue(slippageDefaultValue);
|
|
2148
2521
|
const committedValue = finalizePercentageValue(slippageValue) || defaultValue;
|
|
@@ -2151,13 +2524,13 @@ var PlaceOrderSlippageControl = ({
|
|
|
2151
2524
|
() => isPercentageBelowMinimum(committedValue, slippageMinimumValue)
|
|
2152
2525
|
);
|
|
2153
2526
|
const [shouldFocusInput, setShouldFocusInput] = useState3(false);
|
|
2154
|
-
|
|
2527
|
+
useEffect3(() => {
|
|
2155
2528
|
setDraftValue(committedValue);
|
|
2156
2529
|
if (isPercentageBelowMinimum(committedValue, slippageMinimumValue)) {
|
|
2157
2530
|
setIsEditing(true);
|
|
2158
2531
|
}
|
|
2159
2532
|
}, [committedValue, slippageMinimumValue]);
|
|
2160
|
-
|
|
2533
|
+
useEffect3(() => {
|
|
2161
2534
|
if (!shouldFocusInput) return;
|
|
2162
2535
|
requestAnimationFrame(() => {
|
|
2163
2536
|
var _a2, _b2;
|
|
@@ -2237,8 +2610,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
2237
2610
|
if (!isEditing) return;
|
|
2238
2611
|
handleCommitDraft(false);
|
|
2239
2612
|
};
|
|
2240
|
-
return /* @__PURE__ */
|
|
2241
|
-
/* @__PURE__ */
|
|
2613
|
+
return /* @__PURE__ */ jsxs4("div", { ref: containerRef, className: "agg-slippage-control w-full", onBlur: handleContainerBlur, children: [
|
|
2614
|
+
/* @__PURE__ */ jsxs4(
|
|
2242
2615
|
"button",
|
|
2243
2616
|
{
|
|
2244
2617
|
ref: triggerRef,
|
|
@@ -2256,8 +2629,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
2256
2629
|
),
|
|
2257
2630
|
onClick: handleToggleEditing,
|
|
2258
2631
|
children: [
|
|
2259
|
-
/* @__PURE__ */
|
|
2260
|
-
/* @__PURE__ */
|
|
2632
|
+
/* @__PURE__ */ jsx5("span", { className: "agg-slippage-label", children: collapsedLabel }),
|
|
2633
|
+
/* @__PURE__ */ jsx5(
|
|
2261
2634
|
Icon,
|
|
2262
2635
|
{
|
|
2263
2636
|
name: isEditing ? "chevron-up" : "pencil",
|
|
@@ -2269,7 +2642,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
2269
2642
|
]
|
|
2270
2643
|
}
|
|
2271
2644
|
),
|
|
2272
|
-
/* @__PURE__ */
|
|
2645
|
+
/* @__PURE__ */ jsx5(
|
|
2273
2646
|
"div",
|
|
2274
2647
|
{
|
|
2275
2648
|
"aria-hidden": !isEditing,
|
|
@@ -2283,10 +2656,10 @@ var PlaceOrderSlippageControl = ({
|
|
|
2283
2656
|
"transition-[grid-template-rows,opacity,margin-top] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
2284
2657
|
)
|
|
2285
2658
|
),
|
|
2286
|
-
children: /* @__PURE__ */
|
|
2287
|
-
/* @__PURE__ */
|
|
2288
|
-
/* @__PURE__ */
|
|
2289
|
-
/* @__PURE__ */
|
|
2659
|
+
children: /* @__PURE__ */ jsx5("div", { className: "min-h-0", children: /* @__PURE__ */ jsxs4("div", { className: "agg-slippage-editor-body flex flex-col gap-2", children: [
|
|
2660
|
+
/* @__PURE__ */ jsxs4("div", { className: "agg-slippage-input-row flex h-9 overflow-hidden rounded-agg-sm border border-agg-separator", children: [
|
|
2661
|
+
/* @__PURE__ */ jsxs4("div", { className: "agg-slippage-input-group flex min-w-0 flex-1 items-center gap-2 bg-agg-secondary px-3", children: [
|
|
2662
|
+
/* @__PURE__ */ jsx5(
|
|
2290
2663
|
"input",
|
|
2291
2664
|
{
|
|
2292
2665
|
ref: inputRef,
|
|
@@ -2301,7 +2674,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
2301
2674
|
onKeyDown: handleInputKeyDown
|
|
2302
2675
|
}
|
|
2303
2676
|
),
|
|
2304
|
-
/* @__PURE__ */
|
|
2677
|
+
/* @__PURE__ */ jsx5(
|
|
2305
2678
|
"button",
|
|
2306
2679
|
{
|
|
2307
2680
|
type: "button",
|
|
@@ -2319,8 +2692,8 @@ var PlaceOrderSlippageControl = ({
|
|
|
2319
2692
|
}
|
|
2320
2693
|
)
|
|
2321
2694
|
] }),
|
|
2322
|
-
/* @__PURE__ */
|
|
2323
|
-
/* @__PURE__ */
|
|
2695
|
+
/* @__PURE__ */ jsx5("div", { className: "h-full w-px bg-agg-separator", "aria-hidden": "true" }),
|
|
2696
|
+
/* @__PURE__ */ jsx5(
|
|
2324
2697
|
"div",
|
|
2325
2698
|
{
|
|
2326
2699
|
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",
|
|
@@ -2329,7 +2702,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
2329
2702
|
}
|
|
2330
2703
|
)
|
|
2331
2704
|
] }),
|
|
2332
|
-
/* @__PURE__ */
|
|
2705
|
+
/* @__PURE__ */ jsx5(
|
|
2333
2706
|
"div",
|
|
2334
2707
|
{
|
|
2335
2708
|
"aria-hidden": !resolvedWarningMessage,
|
|
@@ -2343,13 +2716,13 @@ var PlaceOrderSlippageControl = ({
|
|
|
2343
2716
|
"transition-[grid-template-rows,opacity] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
2344
2717
|
)
|
|
2345
2718
|
),
|
|
2346
|
-
children: /* @__PURE__ */
|
|
2719
|
+
children: /* @__PURE__ */ jsx5("div", { className: "min-h-0", children: /* @__PURE__ */ jsxs4(
|
|
2347
2720
|
"div",
|
|
2348
2721
|
{
|
|
2349
2722
|
id: warningId,
|
|
2350
2723
|
className: "agg-slippage-warning-message flex items-start gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
2351
2724
|
children: [
|
|
2352
|
-
/* @__PURE__ */
|
|
2725
|
+
/* @__PURE__ */ jsx5(
|
|
2353
2726
|
Icon,
|
|
2354
2727
|
{
|
|
2355
2728
|
name: "warning-filled",
|
|
@@ -2358,7 +2731,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
2358
2731
|
color: "currentColor"
|
|
2359
2732
|
}
|
|
2360
2733
|
),
|
|
2361
|
-
/* @__PURE__ */
|
|
2734
|
+
/* @__PURE__ */ jsx5("p", { children: resolvedWarningMessage != null ? resolvedWarningMessage : "" })
|
|
2362
2735
|
]
|
|
2363
2736
|
}
|
|
2364
2737
|
) })
|
|
@@ -2378,9 +2751,9 @@ var renderCardHeader = ({
|
|
|
2378
2751
|
onClose
|
|
2379
2752
|
}) => {
|
|
2380
2753
|
if (!headerTitle) return null;
|
|
2381
|
-
return /* @__PURE__ */
|
|
2382
|
-
/* @__PURE__ */
|
|
2383
|
-
/* @__PURE__ */
|
|
2754
|
+
return /* @__PURE__ */ jsxs4("div", { className: cn("agg-order-panel-header flex flex-col gap-2", className), children: [
|
|
2755
|
+
/* @__PURE__ */ jsxs4("div", { className: "agg-order-market-summary flex items-center gap-3", children: [
|
|
2756
|
+
/* @__PURE__ */ jsx5(
|
|
2384
2757
|
RemoteImage,
|
|
2385
2758
|
{
|
|
2386
2759
|
src: headerImage,
|
|
@@ -2388,30 +2761,78 @@ var renderCardHeader = ({
|
|
|
2388
2761
|
className: "agg-order-market-image h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
|
|
2389
2762
|
}
|
|
2390
2763
|
),
|
|
2391
|
-
/* @__PURE__ */
|
|
2392
|
-
onClose ? /* @__PURE__ */
|
|
2764
|
+
/* @__PURE__ */ jsx5("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 }),
|
|
2765
|
+
onClose ? /* @__PURE__ */ jsx5(
|
|
2393
2766
|
"button",
|
|
2394
2767
|
{
|
|
2395
2768
|
type: "button",
|
|
2396
2769
|
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",
|
|
2397
2770
|
"aria-label": "Close",
|
|
2398
2771
|
onClick: onClose,
|
|
2399
|
-
children: /* @__PURE__ */
|
|
2772
|
+
children: /* @__PURE__ */ jsx5(CloseIcon, { className: "h-5 w-5" })
|
|
2400
2773
|
}
|
|
2401
2774
|
) : null
|
|
2402
2775
|
] }),
|
|
2403
|
-
headerSubtitle ? /* @__PURE__ */
|
|
2776
|
+
headerSubtitle ? /* @__PURE__ */ jsx5("p", { className: "agg-order-market-subtitle text-agg-base leading-agg-6 text-agg-foreground", children: headerSubtitle }) : null
|
|
2404
2777
|
] });
|
|
2405
2778
|
};
|
|
2406
2779
|
var PlaceOrderResolvedView = ({
|
|
2407
2780
|
classNames,
|
|
2408
2781
|
tradingState,
|
|
2782
|
+
resolutionTimestamp,
|
|
2409
2783
|
resolvedClaim,
|
|
2410
|
-
className
|
|
2784
|
+
className,
|
|
2785
|
+
isSportsEvent = false
|
|
2411
2786
|
}) => {
|
|
2787
|
+
var _a;
|
|
2412
2788
|
const labels = useLabels();
|
|
2413
2789
|
const tradingLabels = labels.trading;
|
|
2414
|
-
|
|
2790
|
+
const resolvingTimestamp = (_a = resolutionTimestamp != null ? resolutionTimestamp : tradingState.resolvesAt) != null ? _a : tradingState.endsAt;
|
|
2791
|
+
const isResolvingMarket = false;
|
|
2792
|
+
const resolvingSubtitle = tradingState.market ? (() => {
|
|
2793
|
+
const endDateLabel = isSportsEvent ? formatSportsEventTimeEt(resolvingTimestamp != null ? resolvingTimestamp : "") : getTradingDateLabel(resolvingTimestamp != null ? resolvingTimestamp : "");
|
|
2794
|
+
return endDateLabel ? `${tradingState.market.question} \xB7 ${endDateLabel}` : tradingState.market.question;
|
|
2795
|
+
})() : "";
|
|
2796
|
+
if (isResolvingMarket) {
|
|
2797
|
+
return /* @__PURE__ */ jsx5(
|
|
2798
|
+
Card,
|
|
2799
|
+
{
|
|
2800
|
+
className: cn(
|
|
2801
|
+
"group/agg-order-panel",
|
|
2802
|
+
getPlaceOrderContainerClassName(),
|
|
2803
|
+
classNames == null ? void 0 : classNames.root,
|
|
2804
|
+
className
|
|
2805
|
+
),
|
|
2806
|
+
role: "status",
|
|
2807
|
+
"aria-label": labels.marketDetails.resolvingTitle,
|
|
2808
|
+
children: /* @__PURE__ */ jsxs4(
|
|
2809
|
+
"div",
|
|
2810
|
+
{
|
|
2811
|
+
className: cn(
|
|
2812
|
+
"agg-order-panel-body flex flex-col items-center justify-center gap-6 px-5 py-10 text-center",
|
|
2813
|
+
classNames == null ? void 0 : classNames.body
|
|
2814
|
+
),
|
|
2815
|
+
children: [
|
|
2816
|
+
/* @__PURE__ */ jsx5("div", { className: "flex h-[60px] w-[60px] items-center justify-center rounded-full bg-agg-primary/10", children: /* @__PURE__ */ jsx5(LoadingIcon, { variant: "prominent" }) }),
|
|
2817
|
+
/* @__PURE__ */ jsxs4("div", { className: cn("flex w-full flex-col items-center gap-1", classNames == null ? void 0 : classNames.content), children: [
|
|
2818
|
+
/* @__PURE__ */ jsx5(Typography, { variant: "body-large-strong", children: labels.marketDetails.resolvingTitle }),
|
|
2819
|
+
resolvingSubtitle ? /* @__PURE__ */ jsx5(Typography, { variant: "body", className: "text-center", children: resolvingSubtitle }) : null
|
|
2820
|
+
] }),
|
|
2821
|
+
/* @__PURE__ */ jsx5(
|
|
2822
|
+
Typography,
|
|
2823
|
+
{
|
|
2824
|
+
variant: "label",
|
|
2825
|
+
className: "max-w-[300px] text-center text-agg-muted-foreground",
|
|
2826
|
+
children: labels.marketDetails.resolvingDescription
|
|
2827
|
+
}
|
|
2828
|
+
)
|
|
2829
|
+
]
|
|
2830
|
+
}
|
|
2831
|
+
)
|
|
2832
|
+
}
|
|
2833
|
+
);
|
|
2834
|
+
}
|
|
2835
|
+
return /* @__PURE__ */ jsx5(
|
|
2415
2836
|
Card,
|
|
2416
2837
|
{
|
|
2417
2838
|
className: cn(
|
|
@@ -2420,19 +2841,19 @@ var PlaceOrderResolvedView = ({
|
|
|
2420
2841
|
classNames == null ? void 0 : classNames.root,
|
|
2421
2842
|
className
|
|
2422
2843
|
),
|
|
2423
|
-
children: /* @__PURE__ */
|
|
2424
|
-
/* @__PURE__ */
|
|
2425
|
-
/* @__PURE__ */
|
|
2844
|
+
children: /* @__PURE__ */ jsxs4("div", { className: cn("agg-order-panel-body flex flex-col", classNames == null ? void 0 : classNames.body), children: [
|
|
2845
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center gap-6 p-8", children: [
|
|
2846
|
+
/* @__PURE__ */ jsx5(
|
|
2426
2847
|
"div",
|
|
2427
2848
|
{
|
|
2428
2849
|
className: cn(
|
|
2429
2850
|
"flex h-15 w-15 items-center justify-center rounded-full",
|
|
2430
2851
|
"bg-agg-primary/15"
|
|
2431
2852
|
),
|
|
2432
|
-
children: /* @__PURE__ */
|
|
2853
|
+
children: /* @__PURE__ */ jsx5(Icon, { name: "success-check", className: cn("h-6 w-6", "text-agg-primary") })
|
|
2433
2854
|
}
|
|
2434
2855
|
),
|
|
2435
|
-
/* @__PURE__ */
|
|
2856
|
+
/* @__PURE__ */ jsxs4(
|
|
2436
2857
|
"div",
|
|
2437
2858
|
{
|
|
2438
2859
|
className: cn(
|
|
@@ -2440,31 +2861,31 @@ var PlaceOrderResolvedView = ({
|
|
|
2440
2861
|
classNames == null ? void 0 : classNames.content
|
|
2441
2862
|
),
|
|
2442
2863
|
children: [
|
|
2443
|
-
tradingState.market ? /* @__PURE__ */
|
|
2444
|
-
tradingState.winningOutcome ? /* @__PURE__ */
|
|
2864
|
+
tradingState.market ? /* @__PURE__ */ jsx5(Typography, { variant: "body", className: "text-center", children: tradingState.market.question }) : null,
|
|
2865
|
+
tradingState.winningOutcome ? /* @__PURE__ */ jsx5(Typography, { variant: "body-large-strong", children: tradingLabels.outcome(tradingState.winningOutcome.label) }) : null
|
|
2445
2866
|
]
|
|
2446
2867
|
}
|
|
2447
2868
|
)
|
|
2448
2869
|
] }),
|
|
2449
|
-
resolvedClaim ? /* @__PURE__ */
|
|
2450
|
-
/* @__PURE__ */
|
|
2451
|
-
/* @__PURE__ */
|
|
2452
|
-
/* @__PURE__ */
|
|
2453
|
-
/* @__PURE__ */
|
|
2454
|
-
resolvedClaim.resolutionDateLabel ? /* @__PURE__ */
|
|
2455
|
-
/* @__PURE__ */
|
|
2456
|
-
/* @__PURE__ */
|
|
2870
|
+
resolvedClaim ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
2871
|
+
/* @__PURE__ */ jsx5("div", { className: "h-px w-full bg-agg-separator" }),
|
|
2872
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex w-full flex-col gap-5 p-6", children: [
|
|
2873
|
+
/* @__PURE__ */ jsx5(Typography, { variant: "body-strong", className: "text-center", children: tradingLabels.resolvedEarningsTitle }),
|
|
2874
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-3 text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
2875
|
+
resolvedClaim.resolutionDateLabel ? /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between gap-4", children: [
|
|
2876
|
+
/* @__PURE__ */ jsx5("span", { children: tradingLabels.resolvedResolutionDateLabel }),
|
|
2877
|
+
/* @__PURE__ */ jsx5("span", { className: "font-agg-bold", children: resolvedClaim.resolutionDateLabel })
|
|
2457
2878
|
] }) : null,
|
|
2458
|
-
/* @__PURE__ */
|
|
2459
|
-
/* @__PURE__ */
|
|
2460
|
-
/* @__PURE__ */
|
|
2879
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between gap-4", children: [
|
|
2880
|
+
/* @__PURE__ */ jsx5("span", { children: tradingLabels.resolvedSharesLabel }),
|
|
2881
|
+
/* @__PURE__ */ jsx5("span", { className: "font-agg-bold", children: resolvedClaim.sharesLabel })
|
|
2461
2882
|
] }),
|
|
2462
|
-
/* @__PURE__ */
|
|
2463
|
-
/* @__PURE__ */
|
|
2464
|
-
/* @__PURE__ */
|
|
2883
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between gap-4", children: [
|
|
2884
|
+
/* @__PURE__ */ jsx5("span", { children: tradingLabels.resolvedTotalPayoutLabel }),
|
|
2885
|
+
/* @__PURE__ */ jsx5("span", { className: "font-agg-bold", children: resolvedClaim.totalPayoutLabel })
|
|
2465
2886
|
] })
|
|
2466
2887
|
] }),
|
|
2467
|
-
resolvedClaim.onClaim ? /* @__PURE__ */
|
|
2888
|
+
resolvedClaim.onClaim ? /* @__PURE__ */ jsx5(
|
|
2468
2889
|
Button,
|
|
2469
2890
|
{
|
|
2470
2891
|
size: "large",
|
|
@@ -2485,18 +2906,18 @@ var renderRouteBreakdownRow = (row) => {
|
|
|
2485
2906
|
var _a, _b;
|
|
2486
2907
|
const venueLabel = getTradingVenueLabel(row.venue);
|
|
2487
2908
|
const rowKey = `${row.venue}-${row.label}-${row.priceLabel}-${(_a = row.resultLabel) != null ? _a : ""}`;
|
|
2488
|
-
return /* @__PURE__ */
|
|
2909
|
+
return /* @__PURE__ */ jsxs4(
|
|
2489
2910
|
"div",
|
|
2490
2911
|
{
|
|
2491
2912
|
className: "agg-route-breakdown-row flex items-center justify-between gap-4 text-left",
|
|
2492
2913
|
children: [
|
|
2493
|
-
/* @__PURE__ */
|
|
2494
|
-
/* @__PURE__ */
|
|
2495
|
-
/* @__PURE__ */
|
|
2914
|
+
/* @__PURE__ */ jsxs4("div", { className: "agg-route-breakdown-market flex min-w-0 items-center gap-2", children: [
|
|
2915
|
+
/* @__PURE__ */ jsx5(VenueLogo, { venue: row.venue, className: "size-3!", ariaLabel: venueLabel }),
|
|
2916
|
+
/* @__PURE__ */ jsx5("p", { className: "agg-route-breakdown-label truncate text-agg-sm leading-agg-5 text-agg-foreground", children: row.label })
|
|
2496
2917
|
] }),
|
|
2497
|
-
/* @__PURE__ */
|
|
2498
|
-
/* @__PURE__ */
|
|
2499
|
-
/* @__PURE__ */
|
|
2918
|
+
/* @__PURE__ */ jsxs4("div", { className: "agg-route-breakdown-value flex shrink-0 items-center gap-2 text-agg-sm leading-agg-5", children: [
|
|
2919
|
+
/* @__PURE__ */ jsx5("p", { className: "text-agg-muted-foreground", children: row.priceLabel }),
|
|
2920
|
+
/* @__PURE__ */ jsx5("p", { className: "text-agg-foreground", children: (_b = row.resultLabel) != null ? _b : "" })
|
|
2500
2921
|
] })
|
|
2501
2922
|
]
|
|
2502
2923
|
},
|
|
@@ -2514,7 +2935,7 @@ var renderRouteCard = ({
|
|
|
2514
2935
|
var _a, _b;
|
|
2515
2936
|
const showSplitDetails = isSelected && isExpanded && card.kind === "split" && !!((_a = card.rows) == null ? void 0 : _a.length);
|
|
2516
2937
|
const ariaLabel = [card.label, card.hint, card.value].filter(Boolean).join(" ");
|
|
2517
|
-
return /* @__PURE__ */
|
|
2938
|
+
return /* @__PURE__ */ jsx5(
|
|
2518
2939
|
"button",
|
|
2519
2940
|
{
|
|
2520
2941
|
type: "button",
|
|
@@ -2533,10 +2954,10 @@ var renderRouteCard = ({
|
|
|
2533
2954
|
isSelected && !card.isUnavailable ? "border border-agg-trade-highlight-border bg-linear-to-b from-agg-trade-highlight-surface-from to-agg-trade-highlight-surface-to" : "border-transparent bg-agg-secondary-hover"
|
|
2534
2955
|
),
|
|
2535
2956
|
onClick: () => onSelect(card.id),
|
|
2536
|
-
children: /* @__PURE__ */
|
|
2537
|
-
/* @__PURE__ */
|
|
2538
|
-
/* @__PURE__ */
|
|
2539
|
-
card.kind === "split" ? /* @__PURE__ */
|
|
2957
|
+
children: /* @__PURE__ */ jsxs4("div", { className: "agg-route-card-content relative z-10 flex flex-col gap-3", children: [
|
|
2958
|
+
/* @__PURE__ */ jsxs4("div", { className: "agg-route-card-header flex items-center justify-between gap-4", children: [
|
|
2959
|
+
/* @__PURE__ */ jsxs4("div", { className: "agg-route-card-meta flex min-w-0 gap-3 items-center", children: [
|
|
2960
|
+
card.kind === "split" ? /* @__PURE__ */ jsx5(
|
|
2540
2961
|
Icon,
|
|
2541
2962
|
{
|
|
2542
2963
|
name: "sparkles-filled",
|
|
@@ -2547,7 +2968,7 @@ var renderRouteCard = ({
|
|
|
2547
2968
|
),
|
|
2548
2969
|
"aria-hidden": "true"
|
|
2549
2970
|
}
|
|
2550
|
-
) : card.venue ? /* @__PURE__ */
|
|
2971
|
+
) : card.venue ? /* @__PURE__ */ jsx5(
|
|
2551
2972
|
VenueLogo,
|
|
2552
2973
|
{
|
|
2553
2974
|
venue: card.venue,
|
|
@@ -2555,10 +2976,10 @@ var renderRouteCard = ({
|
|
|
2555
2976
|
ariaLabel: getTradingVenueLabel(card.venue)
|
|
2556
2977
|
}
|
|
2557
2978
|
) : null,
|
|
2558
|
-
/* @__PURE__ */
|
|
2559
|
-
/* @__PURE__ */
|
|
2560
|
-
/* @__PURE__ */
|
|
2561
|
-
card.isUnavailable ? /* @__PURE__ */
|
|
2979
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-1 min-w-0", children: [
|
|
2980
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1.5", children: [
|
|
2981
|
+
/* @__PURE__ */ jsx5("p", { className: "agg-route-card-title truncate text-agg-sm leading-agg-5 text-agg-foreground", children: card.label }),
|
|
2982
|
+
card.isUnavailable ? /* @__PURE__ */ jsx5(
|
|
2562
2983
|
Icon,
|
|
2563
2984
|
{
|
|
2564
2985
|
name: "lock",
|
|
@@ -2566,7 +2987,7 @@ var renderRouteCard = ({
|
|
|
2566
2987
|
className: "shrink-0 text-agg-muted-foreground",
|
|
2567
2988
|
"aria-hidden": "true"
|
|
2568
2989
|
}
|
|
2569
|
-
) : card.kind === "split" && isSelected ? /* @__PURE__ */
|
|
2990
|
+
) : card.kind === "split" && isSelected ? /* @__PURE__ */ jsx5(
|
|
2570
2991
|
Icon,
|
|
2571
2992
|
{
|
|
2572
2993
|
name: showSplitDetails ? "chevron-up" : "chevron-down",
|
|
@@ -2576,10 +2997,10 @@ var renderRouteCard = ({
|
|
|
2576
2997
|
}
|
|
2577
2998
|
) : null
|
|
2578
2999
|
] }),
|
|
2579
|
-
card.hint ? /* @__PURE__ */
|
|
3000
|
+
card.hint ? /* @__PURE__ */ jsx5("p", { className: "agg-route-card-hint text-agg-xs leading-agg-4 text-agg-muted-foreground", children: card.hint }) : null
|
|
2580
3001
|
] })
|
|
2581
3002
|
] }),
|
|
2582
|
-
/* @__PURE__ */
|
|
3003
|
+
/* @__PURE__ */ jsx5(
|
|
2583
3004
|
"p",
|
|
2584
3005
|
{
|
|
2585
3006
|
className: cn(
|
|
@@ -2591,9 +3012,9 @@ var renderRouteCard = ({
|
|
|
2591
3012
|
}
|
|
2592
3013
|
)
|
|
2593
3014
|
] }),
|
|
2594
|
-
showSplitDetails ? /* @__PURE__ */
|
|
2595
|
-
/* @__PURE__ */
|
|
2596
|
-
/* @__PURE__ */
|
|
3015
|
+
showSplitDetails ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
3016
|
+
/* @__PURE__ */ jsx5("p", { className: "agg-route-card-description text-agg-xs leading-agg-4 text-agg-foreground", children: tradingLabels.splitOrderDescription }),
|
|
3017
|
+
/* @__PURE__ */ jsx5("div", { className: "agg-route-breakdown flex flex-col gap-3", children: (_b = card.rows) == null ? void 0 : _b.map((row) => renderRouteBreakdownRow(row)) })
|
|
2597
3018
|
] }) : null
|
|
2598
3019
|
] })
|
|
2599
3020
|
}
|
|
@@ -2616,7 +3037,7 @@ var renderSubmissionSurface = ({
|
|
|
2616
3037
|
executionVenue: progressState.executionVenue,
|
|
2617
3038
|
labels: tradingLabels
|
|
2618
3039
|
});
|
|
2619
|
-
return /* @__PURE__ */
|
|
3040
|
+
return /* @__PURE__ */ jsx5(
|
|
2620
3041
|
Card,
|
|
2621
3042
|
{
|
|
2622
3043
|
className: cn(
|
|
@@ -2625,31 +3046,31 @@ var renderSubmissionSurface = ({
|
|
|
2625
3046
|
classNames == null ? void 0 : classNames.root,
|
|
2626
3047
|
className
|
|
2627
3048
|
),
|
|
2628
|
-
children: /* @__PURE__ */
|
|
3049
|
+
children: /* @__PURE__ */ jsxs4("div", { className: cn("agg-order-submission-body flex flex-col gap-6 p-5", classNames == null ? void 0 : classNames.body), children: [
|
|
2629
3050
|
renderCardHeader({
|
|
2630
3051
|
className: classNames == null ? void 0 : classNames.header,
|
|
2631
3052
|
headerSubtitle,
|
|
2632
3053
|
headerImage,
|
|
2633
3054
|
headerTitle
|
|
2634
3055
|
}),
|
|
2635
|
-
/* @__PURE__ */
|
|
2636
|
-
/* @__PURE__ */
|
|
2637
|
-
/* @__PURE__ */
|
|
2638
|
-
/* @__PURE__ */
|
|
3056
|
+
/* @__PURE__ */ jsxs4("div", { className: cn("agg-order-panel-content flex flex-col gap-6", classNames == null ? void 0 : classNames.content), children: [
|
|
3057
|
+
/* @__PURE__ */ jsxs4("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: [
|
|
3058
|
+
/* @__PURE__ */ jsx5(LoadingGlyph, { enableAnimations, className: "h-4 w-4 text-current" }),
|
|
3059
|
+
/* @__PURE__ */ jsx5("span", { children: actionLabel })
|
|
2639
3060
|
] }),
|
|
2640
|
-
/* @__PURE__ */
|
|
3061
|
+
/* @__PURE__ */ jsx5(
|
|
2641
3062
|
"div",
|
|
2642
3063
|
{
|
|
2643
3064
|
className: "agg-order-submission-steps agg-order-submission-group flex flex-col gap-2",
|
|
2644
3065
|
"data-testid": "agg-order-submission-steps",
|
|
2645
3066
|
children: displayRows.map((step) => {
|
|
2646
|
-
return /* @__PURE__ */
|
|
3067
|
+
return /* @__PURE__ */ jsxs4(
|
|
2647
3068
|
"div",
|
|
2648
3069
|
{
|
|
2649
3070
|
className: "agg-order-submission-step flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
2650
3071
|
"data-status": step.status,
|
|
2651
3072
|
children: [
|
|
2652
|
-
step.status === "complete" ? /* @__PURE__ */
|
|
3073
|
+
step.status === "complete" ? /* @__PURE__ */ jsx5(
|
|
2653
3074
|
Icon,
|
|
2654
3075
|
{
|
|
2655
3076
|
name: "check-circle",
|
|
@@ -2657,15 +3078,15 @@ var renderSubmissionSurface = ({
|
|
|
2657
3078
|
className: "h-3 w-3 shrink-0 text-agg-primary",
|
|
2658
3079
|
"aria-hidden": "true"
|
|
2659
3080
|
}
|
|
2660
|
-
) : /* @__PURE__ */
|
|
3081
|
+
) : /* @__PURE__ */ jsx5(
|
|
2661
3082
|
LoadingGlyph,
|
|
2662
3083
|
{
|
|
2663
3084
|
enableAnimations,
|
|
2664
3085
|
className: "h-3 w-3 shrink-0 text-agg-primary"
|
|
2665
3086
|
}
|
|
2666
3087
|
),
|
|
2667
|
-
/* @__PURE__ */
|
|
2668
|
-
step.venue ? /* @__PURE__ */
|
|
3088
|
+
/* @__PURE__ */ jsx5("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
3089
|
+
step.venue ? /* @__PURE__ */ jsx5(
|
|
2669
3090
|
VenueLogo,
|
|
2670
3091
|
{
|
|
2671
3092
|
venue: step.venue,
|
|
@@ -2686,7 +3107,7 @@ var renderSubmissionSurface = ({
|
|
|
2686
3107
|
}
|
|
2687
3108
|
);
|
|
2688
3109
|
};
|
|
2689
|
-
var InitiateKycButton = ({ label, onOpen }) => /* @__PURE__ */
|
|
3110
|
+
var InitiateKycButton = ({ label, onOpen }) => /* @__PURE__ */ jsx5(
|
|
2690
3111
|
Button,
|
|
2691
3112
|
{
|
|
2692
3113
|
size: "large",
|
|
@@ -2703,35 +3124,35 @@ var KycVerifyModal = ({
|
|
|
2703
3124
|
isInitiating,
|
|
2704
3125
|
labels
|
|
2705
3126
|
}) => {
|
|
2706
|
-
return /* @__PURE__ */
|
|
3127
|
+
return /* @__PURE__ */ jsx5(
|
|
2707
3128
|
Modal,
|
|
2708
3129
|
{
|
|
2709
3130
|
open,
|
|
2710
3131
|
onOpenChange: (next) => {
|
|
2711
3132
|
onOpenChange(next);
|
|
2712
3133
|
},
|
|
2713
|
-
children: /* @__PURE__ */
|
|
2714
|
-
/* @__PURE__ */
|
|
2715
|
-
/* @__PURE__ */
|
|
2716
|
-
/* @__PURE__ */
|
|
2717
|
-
/* @__PURE__ */
|
|
3134
|
+
children: /* @__PURE__ */ jsxs4(Modal.Container, { maxWidth: "480px", "aria-label": labels.title, children: [
|
|
3135
|
+
/* @__PURE__ */ jsx5(Dialog.Title, { className: "sr-only", children: labels.title }),
|
|
3136
|
+
/* @__PURE__ */ jsx5(Dialog.Description, { className: "sr-only", children: labels.description }),
|
|
3137
|
+
/* @__PURE__ */ jsxs4(Modal.Body, { classNames: { root: "sm:px-10 sm:py-12" }, children: [
|
|
3138
|
+
/* @__PURE__ */ jsx5(
|
|
2718
3139
|
"button",
|
|
2719
3140
|
{
|
|
2720
3141
|
type: "button",
|
|
2721
3142
|
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
2722
3143
|
onClick: () => onOpenChange(false),
|
|
2723
3144
|
"aria-label": "Close",
|
|
2724
|
-
children: /* @__PURE__ */
|
|
3145
|
+
children: /* @__PURE__ */ jsx5(CloseIcon, { className: "h-6 w-6" })
|
|
2725
3146
|
}
|
|
2726
3147
|
),
|
|
2727
|
-
/* @__PURE__ */
|
|
2728
|
-
/* @__PURE__ */
|
|
2729
|
-
/* @__PURE__ */
|
|
2730
|
-
/* @__PURE__ */
|
|
2731
|
-
/* @__PURE__ */
|
|
3148
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center gap-8 text-center", children: [
|
|
3149
|
+
/* @__PURE__ */ jsx5("div", { className: "flex h-[60px] w-[60px] items-center justify-center text-agg-muted-foreground", children: /* @__PURE__ */ jsx5(UserTrustIcon, { className: "h-[60px] w-[60px]" }) }),
|
|
3150
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center gap-3", children: [
|
|
3151
|
+
/* @__PURE__ */ jsx5("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: labels.title }),
|
|
3152
|
+
/* @__PURE__ */ jsx5("p", { className: "agg-type-body text-agg-foreground", children: labels.description })
|
|
2732
3153
|
] }),
|
|
2733
|
-
/* @__PURE__ */
|
|
2734
|
-
/* @__PURE__ */
|
|
3154
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex w-full flex-col items-center gap-5", children: [
|
|
3155
|
+
/* @__PURE__ */ jsx5(
|
|
2735
3156
|
Button,
|
|
2736
3157
|
{
|
|
2737
3158
|
size: "large",
|
|
@@ -2742,7 +3163,7 @@ var KycVerifyModal = ({
|
|
|
2742
3163
|
children: labels.startVerification
|
|
2743
3164
|
}
|
|
2744
3165
|
),
|
|
2745
|
-
/* @__PURE__ */
|
|
3166
|
+
/* @__PURE__ */ jsx5(
|
|
2746
3167
|
"button",
|
|
2747
3168
|
{
|
|
2748
3169
|
type: "button",
|
|
@@ -2762,27 +3183,27 @@ var KycSuccessModal = ({
|
|
|
2762
3183
|
open,
|
|
2763
3184
|
onOpenChange,
|
|
2764
3185
|
labels
|
|
2765
|
-
}) => /* @__PURE__ */
|
|
2766
|
-
/* @__PURE__ */
|
|
2767
|
-
/* @__PURE__ */
|
|
2768
|
-
/* @__PURE__ */
|
|
2769
|
-
/* @__PURE__ */
|
|
3186
|
+
}) => /* @__PURE__ */ jsx5(Modal, { open, onOpenChange, children: /* @__PURE__ */ jsxs4(Modal.Container, { maxWidth: "480px", "aria-label": labels.title, children: [
|
|
3187
|
+
/* @__PURE__ */ jsx5(Dialog.Title, { className: "sr-only", children: labels.title }),
|
|
3188
|
+
/* @__PURE__ */ jsx5(Dialog.Description, { className: "sr-only", children: labels.description }),
|
|
3189
|
+
/* @__PURE__ */ jsxs4(Modal.Body, { classNames: { root: "px-10 py-12" }, children: [
|
|
3190
|
+
/* @__PURE__ */ jsx5(
|
|
2770
3191
|
"button",
|
|
2771
3192
|
{
|
|
2772
3193
|
type: "button",
|
|
2773
3194
|
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
2774
3195
|
onClick: () => onOpenChange(false),
|
|
2775
3196
|
"aria-label": "Close",
|
|
2776
|
-
children: /* @__PURE__ */
|
|
3197
|
+
children: /* @__PURE__ */ jsx5(CloseIcon, { className: "h-6 w-6" })
|
|
2777
3198
|
}
|
|
2778
3199
|
),
|
|
2779
|
-
/* @__PURE__ */
|
|
2780
|
-
/* @__PURE__ */
|
|
2781
|
-
/* @__PURE__ */
|
|
2782
|
-
/* @__PURE__ */
|
|
2783
|
-
/* @__PURE__ */
|
|
3200
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center gap-8 text-center", children: [
|
|
3201
|
+
/* @__PURE__ */ jsx5("div", { className: "flex h-[60px] w-[60px] items-center justify-center rounded-full bg-agg-success/15", children: /* @__PURE__ */ jsx5(SuccessCheckIcon, { className: "h-6 w-6 text-agg-success" }) }),
|
|
3202
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center gap-3", children: [
|
|
3203
|
+
/* @__PURE__ */ jsx5("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: labels.title }),
|
|
3204
|
+
/* @__PURE__ */ jsx5("p", { className: "agg-type-body text-agg-foreground", children: labels.description })
|
|
2784
3205
|
] }),
|
|
2785
|
-
/* @__PURE__ */
|
|
3206
|
+
/* @__PURE__ */ jsx5(
|
|
2786
3207
|
Button,
|
|
2787
3208
|
{
|
|
2788
3209
|
variant: "secondary",
|
|
@@ -2803,6 +3224,7 @@ var PlaceOrder = ({
|
|
|
2803
3224
|
isLoading = false,
|
|
2804
3225
|
isPrimaryActionDisabled = false,
|
|
2805
3226
|
isPrimaryActionLoading = false,
|
|
3227
|
+
isQuotePanelActive = true,
|
|
2806
3228
|
chainBalancesOverride,
|
|
2807
3229
|
onAmountChange,
|
|
2808
3230
|
onClose,
|
|
@@ -2816,7 +3238,7 @@ var PlaceOrder = ({
|
|
|
2816
3238
|
resolvedClaim,
|
|
2817
3239
|
midpointsResult
|
|
2818
3240
|
}) => {
|
|
2819
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E;
|
|
3241
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G;
|
|
2820
3242
|
const {
|
|
2821
3243
|
enableDebug: isExecutionDebugEnabled,
|
|
2822
3244
|
features: { enableAnimations, showFeesBreakdown },
|
|
@@ -2825,6 +3247,7 @@ var PlaceOrder = ({
|
|
|
2825
3247
|
} = useSdkUiConfig();
|
|
2826
3248
|
const labels = useLabels();
|
|
2827
3249
|
const tradingLabels = labels.trading;
|
|
3250
|
+
const toastCtx = useOptionalToast();
|
|
2828
3251
|
const { isTradingBlocked } = useGeoBlock();
|
|
2829
3252
|
const tradingContext = useEventTradingContext2();
|
|
2830
3253
|
const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
|
|
@@ -2875,6 +3298,7 @@ var PlaceOrder = ({
|
|
|
2875
3298
|
const resolvedReadOnlyTradingState = useMemo2(() => {
|
|
2876
3299
|
return resolveMarketTradingState(resolvedReadOnlyMarket);
|
|
2877
3300
|
}, [resolvedReadOnlyMarket]);
|
|
3301
|
+
const isEndedWithoutKnownWinner = false;
|
|
2878
3302
|
const orderEligibility = useMemo2(
|
|
2879
3303
|
() => resolveOrderEligibility({
|
|
2880
3304
|
event: scopedSelectedEvent,
|
|
@@ -2936,8 +3360,8 @@ var PlaceOrder = ({
|
|
|
2936
3360
|
() => mapVenueMarketOutcomesToPlaceOrderOutcomes(scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes),
|
|
2937
3361
|
[scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes]
|
|
2938
3362
|
);
|
|
2939
|
-
const buyTabRef =
|
|
2940
|
-
const sellTabRef =
|
|
3363
|
+
const buyTabRef = useRef3(null);
|
|
3364
|
+
const sellTabRef = useRef3(null);
|
|
2941
3365
|
const [internalTab, setInternalTab] = useState3("buy");
|
|
2942
3366
|
const [internalAmount, setInternalAmount] = useState3(PLACE_ORDER_DEFAULT_AMOUNT);
|
|
2943
3367
|
const [sellFilledForOutcomeId, setSellFilledForOutcomeId] = useState3(null);
|
|
@@ -2948,17 +3372,17 @@ var PlaceOrder = ({
|
|
|
2948
3372
|
const [submissionFeedback, setSubmissionFeedback] = useState3(null);
|
|
2949
3373
|
const [submissionProgressState, setSubmissionProgressState] = useState3(null);
|
|
2950
3374
|
const [isBeforeActionPending, setIsBeforeActionPending] = useState3(false);
|
|
2951
|
-
const executionDebugStoreRef =
|
|
2952
|
-
const executionDebugAttemptIdRef =
|
|
2953
|
-
const submittedSelectionRef =
|
|
2954
|
-
|
|
3375
|
+
const executionDebugStoreRef = useRef3(null);
|
|
3376
|
+
const executionDebugAttemptIdRef = useRef3(null);
|
|
3377
|
+
const submittedSelectionRef = useRef3(null);
|
|
3378
|
+
useEffect3(() => {
|
|
2955
3379
|
if (!isExecutionDebugEnabled) {
|
|
2956
3380
|
executionDebugStoreRef.current = null;
|
|
2957
3381
|
return;
|
|
2958
3382
|
}
|
|
2959
3383
|
executionDebugStoreRef.current = enableExecutionDebugInBrowser();
|
|
2960
3384
|
}, [isExecutionDebugEnabled]);
|
|
2961
|
-
|
|
3385
|
+
useEffect3(() => {
|
|
2962
3386
|
if (!isExecutionDebugEnabled) return;
|
|
2963
3387
|
const store = executionDebugStoreRef.current;
|
|
2964
3388
|
if (!store) return;
|
|
@@ -2971,6 +3395,7 @@ var PlaceOrder = ({
|
|
|
2971
3395
|
scopedSelectedOutcomeId
|
|
2972
3396
|
]);
|
|
2973
3397
|
const debouncedAmount = useDebouncedValue(internalAmount, 300);
|
|
3398
|
+
const isQuoteInputEditing = internalAmount !== debouncedAmount;
|
|
2974
3399
|
const isSell = useMemo2(() => internalTab === "sell", [internalTab]);
|
|
2975
3400
|
const {
|
|
2976
3401
|
positions: executionPositions,
|
|
@@ -2992,7 +3417,19 @@ var PlaceOrder = ({
|
|
|
2992
3417
|
compareVenues: true,
|
|
2993
3418
|
tradeSide: isSell ? "sell" : "buy",
|
|
2994
3419
|
mode: isPaperMode ? "paper" : void 0,
|
|
2995
|
-
enabled: debouncedAmount > 0 && orderEligibility.canPlaceOrder
|
|
3420
|
+
enabled: isQuotePanelActive && !isEndedWithoutKnownWinner && !submissionProgressState && !isBeforeActionPending && !executeManaged.isPending && debouncedAmount > 0 && orderEligibility.canPlaceOrder && // On the sell tab, hold the quote until the amount has been initialized
|
|
3421
|
+
// from the user's position for THIS outcome AND the debounced value has
|
|
3422
|
+
// caught up to it. The amount input is shared with the buy tab, so right
|
|
3423
|
+
// after switching to sell the debounced value still holds the buy default
|
|
3424
|
+
// (PLACE_ORDER_DEFAULT_AMOUNT) for ~300ms — without this gate it leaks into
|
|
3425
|
+
// the first sell quote as `sellShares` (e.g. sellShares=20).
|
|
3426
|
+
(!isSell || sellFilledForOutcomeId === scopedSelectedOutcomeId && !isQuoteInputEditing),
|
|
3427
|
+
refreshContext: {
|
|
3428
|
+
isEditing: isQuoteInputEditing,
|
|
3429
|
+
isMarketOpen: resolvedTradingState.kind === "open" && !isEndedWithoutKnownWinner,
|
|
3430
|
+
isPanelActive: isQuotePanelActive,
|
|
3431
|
+
isSubmitting: submissionProgressState != null || isBeforeActionPending || executeManaged.isPending
|
|
3432
|
+
}
|
|
2996
3433
|
});
|
|
2997
3434
|
const currentSellableShares = useMemo2(() => {
|
|
2998
3435
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
@@ -3008,15 +3445,13 @@ var PlaceOrder = ({
|
|
|
3008
3445
|
(_d2 = scopedSelectedMarket.externalIdentifier) != null ? _d2 : void 0
|
|
3009
3446
|
].filter((value) => Boolean(value));
|
|
3010
3447
|
const selectedMarketIdSet = new Set(selectedMarketIds);
|
|
3011
|
-
const selectedVenue = scopedSelectedMarket.venue;
|
|
3012
3448
|
let resolvedShares = 0;
|
|
3013
3449
|
for (const group of executionPositions) {
|
|
3014
3450
|
const groupOutcomes = (_f2 = (_e2 = group.venueMarket) == null ? void 0 : _e2.venueMarketOutcomes) != null ? _f2 : [];
|
|
3015
3451
|
for (const outcome of groupOutcomes) {
|
|
3016
3452
|
if (outcome.label.trim().toLowerCase() !== normalizedSelectedOutcomeLabel) continue;
|
|
3017
3453
|
for (const breakdown of (_g2 = outcome.venueBreakdown) != null ? _g2 : []) {
|
|
3018
|
-
|
|
3019
|
-
const matchesMarketId = selectedMarketIdSet.size === 0 || selectedMarketIdSet.has(breakdown.venueMarketId) || selectedMarketIdSet.has(group.targetMarketId);
|
|
3454
|
+
const matchesMarketId = selectedMarketIdSet.size === 0 || selectedMarketIdSet.has(group.targetMarketId) || selectedMarketIdSet.has(breakdown.venueMarketId);
|
|
3020
3455
|
if (!matchesMarketId) continue;
|
|
3021
3456
|
resolvedShares += Number.isFinite(breakdown.size) ? breakdown.size : 0;
|
|
3022
3457
|
}
|
|
@@ -3030,25 +3465,33 @@ var PlaceOrder = ({
|
|
|
3030
3465
|
scopedSelectedOutcome,
|
|
3031
3466
|
(_k = (_j = smartRoute.data) == null ? void 0 : _j.positionAvailability) == null ? void 0 : _k.totalSellableShares
|
|
3032
3467
|
]);
|
|
3468
|
+
const maxSellableShares = useMemo2(
|
|
3469
|
+
() => floorToDecimals(currentSellableShares, SELL_SHARE_INPUT_DECIMALS),
|
|
3470
|
+
[currentSellableShares]
|
|
3471
|
+
);
|
|
3033
3472
|
const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((_m = (_l = smartRoute.data) == null ? void 0 : _l.positionAvailability) == null ? void 0 : _m.totalSellableShares) === "number") && (isExecutionPositionsLoading || isExecutionPositionsFetching);
|
|
3034
3473
|
const displayedCurrentSellableShares = useMemo2(() => {
|
|
3035
3474
|
if (!Number.isFinite(currentSellableShares) || currentSellableShares <= 0) return 0;
|
|
3036
|
-
return
|
|
3475
|
+
return floorToDecimals(currentSellableShares, SELL_SHARE_DISPLAY_DECIMALS);
|
|
3037
3476
|
}, [currentSellableShares]);
|
|
3038
|
-
const
|
|
3039
|
-
|
|
3477
|
+
const displayedCurrentSellableSharesLabel = useMemo2(
|
|
3478
|
+
() => `${formatFlooredShareAmount(maxSellableShares, SELL_SHARE_DISPLAY_DECIMALS)} shares`,
|
|
3479
|
+
[maxSellableShares]
|
|
3480
|
+
);
|
|
3481
|
+
const isAtMaxSellableShares = isSell && maxSellableShares > 0 && Math.abs(internalAmount - maxSellableShares) < 1e-9;
|
|
3482
|
+
useEffect3(() => {
|
|
3040
3483
|
if (submissionProgressState != null) return;
|
|
3041
3484
|
if (!isSell || isCurrentSellableSharesLoading) return;
|
|
3042
3485
|
if (scopedSelectedOutcomeId === sellFilledForOutcomeId) return;
|
|
3043
|
-
setInternalAmount(
|
|
3486
|
+
setInternalAmount(maxSellableShares);
|
|
3044
3487
|
setSellFilledForOutcomeId(scopedSelectedOutcomeId != null ? scopedSelectedOutcomeId : null);
|
|
3045
|
-
onAmountChange == null ? void 0 : onAmountChange(
|
|
3488
|
+
onAmountChange == null ? void 0 : onAmountChange(maxSellableShares);
|
|
3046
3489
|
}, [
|
|
3047
3490
|
isSell,
|
|
3048
3491
|
isCurrentSellableSharesLoading,
|
|
3049
3492
|
scopedSelectedOutcomeId,
|
|
3050
3493
|
sellFilledForOutcomeId,
|
|
3051
|
-
|
|
3494
|
+
maxSellableShares,
|
|
3052
3495
|
onAmountChange,
|
|
3053
3496
|
submissionProgressState
|
|
3054
3497
|
]);
|
|
@@ -3069,7 +3512,7 @@ var PlaceOrder = ({
|
|
|
3069
3512
|
}
|
|
3070
3513
|
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;
|
|
3071
3514
|
}, [routeCards, selectedRouteCardId]);
|
|
3072
|
-
|
|
3515
|
+
useEffect3(() => {
|
|
3073
3516
|
if (routeCards.length === 0) {
|
|
3074
3517
|
setSelectedRouteCardId(null);
|
|
3075
3518
|
setIsRoutesExpanded(false);
|
|
@@ -3081,9 +3524,9 @@ var PlaceOrder = ({
|
|
|
3081
3524
|
}
|
|
3082
3525
|
}, [resolvedSelectedRouteCardId, routeCards.length, selectedRouteCardId]);
|
|
3083
3526
|
const isSubmissionLocked = submissionProgressState != null;
|
|
3084
|
-
const isSubmissionLockedRef =
|
|
3527
|
+
const isSubmissionLockedRef = useRef3(isSubmissionLocked);
|
|
3085
3528
|
isSubmissionLockedRef.current = isSubmissionLocked;
|
|
3086
|
-
|
|
3529
|
+
useEffect3(() => {
|
|
3087
3530
|
if (isSubmissionLockedRef.current) return;
|
|
3088
3531
|
setSubmissionFeedback(null);
|
|
3089
3532
|
setSubmissionProgressState(null);
|
|
@@ -3116,7 +3559,7 @@ var PlaceOrder = ({
|
|
|
3116
3559
|
walletAddress: (_p = getWalletAddressFromUserProfile(user)) != null ? _p : null,
|
|
3117
3560
|
onError
|
|
3118
3561
|
});
|
|
3119
|
-
const handleRouteCardSelect =
|
|
3562
|
+
const handleRouteCardSelect = useCallback3(
|
|
3120
3563
|
(cardId) => {
|
|
3121
3564
|
if (cardId === resolvedSelectedRouteCardId) {
|
|
3122
3565
|
const card = routeCards.find((c) => c.id === cardId);
|
|
@@ -3131,14 +3574,15 @@ var PlaceOrder = ({
|
|
|
3131
3574
|
);
|
|
3132
3575
|
const executionProgress = useExecutionProgress({
|
|
3133
3576
|
orderIds: (_q = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) != null ? _q : null,
|
|
3577
|
+
quoteId: (_r = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _r : null,
|
|
3134
3578
|
mode: isPaperMode ? "paper" : void 0,
|
|
3135
|
-
enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((
|
|
3579
|
+
enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((_s = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _s.length)
|
|
3136
3580
|
});
|
|
3137
|
-
const selectedOutcomeLabel = (
|
|
3138
|
-
const headerImage = (
|
|
3139
|
-
const headerTitle = (
|
|
3140
|
-
const headerSubtitle = (
|
|
3141
|
-
const buildExecutionSummary =
|
|
3581
|
+
const selectedOutcomeLabel = (_v = (_u = (_t = outcomes.find((outcome) => outcome.id === scopedSelectedOutcomeId)) == null ? void 0 : _t.label) != null ? _u : scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.label) != null ? _v : "";
|
|
3582
|
+
const headerImage = (_x = (_w = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.image) != null ? _w : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.image) != null ? _x : null;
|
|
3583
|
+
const headerTitle = (_z = (_y = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _y : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _z : "";
|
|
3584
|
+
const headerSubtitle = (_A = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _A : "";
|
|
3585
|
+
const buildExecutionSummary = useCallback3(
|
|
3142
3586
|
(quoteData, executionVenue, orderId, partialFillSummary) => {
|
|
3143
3587
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
3144
3588
|
if (!quoteData) return void 0;
|
|
@@ -3214,7 +3658,7 @@ var PlaceOrder = ({
|
|
|
3214
3658
|
tradingLabels
|
|
3215
3659
|
]
|
|
3216
3660
|
);
|
|
3217
|
-
|
|
3661
|
+
useEffect3(() => {
|
|
3218
3662
|
if (executionProgress.phase === "order_submitted") {
|
|
3219
3663
|
const submittedOrder = executionProgress.submittedOrders[0];
|
|
3220
3664
|
setSubmissionProgressState((prev) => {
|
|
@@ -3227,7 +3671,7 @@ var PlaceOrder = ({
|
|
|
3227
3671
|
});
|
|
3228
3672
|
}
|
|
3229
3673
|
}, [executionProgress.phase, executionProgress.submittedOrders]);
|
|
3230
|
-
|
|
3674
|
+
useEffect3(() => {
|
|
3231
3675
|
var _a2, _b2;
|
|
3232
3676
|
const dp = executionProgress.dagProgress;
|
|
3233
3677
|
if (!dp) return;
|
|
@@ -3278,7 +3722,7 @@ var PlaceOrder = ({
|
|
|
3278
3722
|
return __spreadProps(__spreadValues({}, prev), { dagProgress: dp });
|
|
3279
3723
|
});
|
|
3280
3724
|
}, [executionProgress.dagProgress, tradingLabels]);
|
|
3281
|
-
|
|
3725
|
+
useEffect3(() => {
|
|
3282
3726
|
const orderIds = submissionProgressState == null ? void 0 : submissionProgressState.orderIds;
|
|
3283
3727
|
if (!(orderIds == null ? void 0 : orderIds.length)) return;
|
|
3284
3728
|
const aggregateStatus = deriveAggregateOrderStatus(
|
|
@@ -3339,7 +3783,7 @@ var PlaceOrder = ({
|
|
|
3339
3783
|
tradingLabels
|
|
3340
3784
|
]);
|
|
3341
3785
|
const estDurationMs = (selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) && typeof selectedRouteCard.quoteData.estDurationMs === "number" ? selectedRouteCard.quoteData.estDurationMs : 6e4;
|
|
3342
|
-
|
|
3786
|
+
useEffect3(() => {
|
|
3343
3787
|
const phase = submissionProgressState == null ? void 0 : submissionProgressState.phase;
|
|
3344
3788
|
if (phase !== "submitting" && phase !== "executing") return;
|
|
3345
3789
|
const timeoutMs = Math.max(6e4, 2 * estDurationMs);
|
|
@@ -3354,7 +3798,36 @@ var PlaceOrder = ({
|
|
|
3354
3798
|
}, timeoutMs);
|
|
3355
3799
|
return () => clearTimeout(id);
|
|
3356
3800
|
}, [submissionProgressState == null ? void 0 : submissionProgressState.phase, estDurationMs]);
|
|
3357
|
-
|
|
3801
|
+
const emitTerminalOrderNotifications = useCallback3(() => {
|
|
3802
|
+
const toast = toastCtx == null ? void 0 : toastCtx.toast;
|
|
3803
|
+
if (!toast) return;
|
|
3804
|
+
for (const event of executionProgress.terminalOrderEvents) {
|
|
3805
|
+
handleOrderEvent({
|
|
3806
|
+
event: {
|
|
3807
|
+
type: "order_event",
|
|
3808
|
+
userId: "",
|
|
3809
|
+
orderId: event.orderId,
|
|
3810
|
+
venue: event.venue,
|
|
3811
|
+
event: event.event,
|
|
3812
|
+
filledAmountRaw: event.filledAmountRaw,
|
|
3813
|
+
remainingAmountRaw: event.remainingAmountRaw,
|
|
3814
|
+
actualSharesRaw: event.actualSharesRaw,
|
|
3815
|
+
actualToWinRaw: event.actualToWinRaw,
|
|
3816
|
+
quotedSharesRaw: event.quotedSharesRaw,
|
|
3817
|
+
quotedToWinRaw: event.quotedToWinRaw,
|
|
3818
|
+
executionPriceRaw: event.executionPriceRaw,
|
|
3819
|
+
quotedPriceRaw: event.quotedPriceRaw,
|
|
3820
|
+
errorReason: event.errorReason,
|
|
3821
|
+
timestamp: event.timestamp
|
|
3822
|
+
},
|
|
3823
|
+
labels,
|
|
3824
|
+
fireOnce: (key, tone, title, message, detail) => {
|
|
3825
|
+
toast(message, { tone, title, detail });
|
|
3826
|
+
}
|
|
3827
|
+
});
|
|
3828
|
+
}
|
|
3829
|
+
}, [executionProgress.terminalOrderEvents, labels, toastCtx]);
|
|
3830
|
+
useEffect3(() => {
|
|
3358
3831
|
var _a2, _b2;
|
|
3359
3832
|
if (!submissionProgressState) return;
|
|
3360
3833
|
onExecutionStateChange == null ? void 0 : onExecutionStateChange(submissionProgressState);
|
|
@@ -3373,6 +3846,7 @@ var PlaceOrder = ({
|
|
|
3373
3846
|
});
|
|
3374
3847
|
}
|
|
3375
3848
|
if (submissionProgressState.phase === "success" && submissionProgressState.summary) {
|
|
3849
|
+
emitTerminalOrderNotifications();
|
|
3376
3850
|
invalidateBalanceQueries(queryClient);
|
|
3377
3851
|
invalidatePositionQueries(queryClient);
|
|
3378
3852
|
if (debugStore && debugAttemptId) {
|
|
@@ -3384,6 +3858,7 @@ var PlaceOrder = ({
|
|
|
3384
3858
|
onSuccess == null ? void 0 : onSuccess(submissionProgressState.summary);
|
|
3385
3859
|
}
|
|
3386
3860
|
if (submissionProgressState.phase === "failed" && submissionProgressState.errorMessage) {
|
|
3861
|
+
emitTerminalOrderNotifications();
|
|
3387
3862
|
if (debugStore && debugAttemptId) {
|
|
3388
3863
|
debugStore.appendError(debugAttemptId, {
|
|
3389
3864
|
message: submissionProgressState.errorMessage,
|
|
@@ -3396,8 +3871,15 @@ var PlaceOrder = ({
|
|
|
3396
3871
|
}
|
|
3397
3872
|
onError == null ? void 0 : onError(new Error(submissionProgressState.errorMessage));
|
|
3398
3873
|
}
|
|
3399
|
-
}, [
|
|
3400
|
-
|
|
3874
|
+
}, [
|
|
3875
|
+
emitTerminalOrderNotifications,
|
|
3876
|
+
onError,
|
|
3877
|
+
onExecutionStateChange,
|
|
3878
|
+
onSuccess,
|
|
3879
|
+
queryClient,
|
|
3880
|
+
submissionProgressState
|
|
3881
|
+
]);
|
|
3882
|
+
const activeQuoteData = (_C = (_B = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _B : smartRoute.data) != null ? _C : null;
|
|
3401
3883
|
const visibleRouteCards = orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT && !isRoutesExpanded ? orderedRouteCards.slice(0, PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT) : orderedRouteCards;
|
|
3402
3884
|
const hasEnteredAmount = internalAmount > 0;
|
|
3403
3885
|
const isQuoteLoading = hasEnteredAmount && (smartRoute.isFetching || smartRoute.isLoading);
|
|
@@ -3492,7 +3974,7 @@ var PlaceOrder = ({
|
|
|
3492
3974
|
}
|
|
3493
3975
|
return (_d2 = selectedRouteCard.hint) != null ? _d2 : "";
|
|
3494
3976
|
}, [selectedRouteCard, tradingLabels]);
|
|
3495
|
-
const displayedToWinValue = (
|
|
3977
|
+
const displayedToWinValue = (_D = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _D : 0;
|
|
3496
3978
|
const activeFeeBreakdown = activeQuoteData == null ? void 0 : activeQuoteData.feeBreakdown;
|
|
3497
3979
|
const estimatedFeesValue = useMemo2(() => {
|
|
3498
3980
|
if (!activeFeeBreakdown) return null;
|
|
@@ -3534,13 +4016,13 @@ var PlaceOrder = ({
|
|
|
3534
4016
|
];
|
|
3535
4017
|
}, [activeFeeBreakdown, tradingLabels]);
|
|
3536
4018
|
const isActionLoading = isPrimaryActionLoading || executeManaged.isPending || isBeforeActionPending;
|
|
3537
|
-
const selectedRouteGeoBlocked = (
|
|
4019
|
+
const selectedRouteGeoBlocked = (_E = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _E : false;
|
|
3538
4020
|
const geoBlockedVenuesFromWarnings = useMemo2(
|
|
3539
4021
|
() => {
|
|
3540
4022
|
var _a2;
|
|
3541
4023
|
return extractGeoBlockedVenues((_a2 = smartRoute.data) == null ? void 0 : _a2.warnings);
|
|
3542
4024
|
},
|
|
3543
|
-
[(
|
|
4025
|
+
[(_F = smartRoute.data) == null ? void 0 : _F.warnings]
|
|
3544
4026
|
);
|
|
3545
4027
|
const isPrimaryVenueGeoBlocked = useMemo2(() => {
|
|
3546
4028
|
var _a2, _b2;
|
|
@@ -3553,7 +4035,7 @@ var PlaceOrder = ({
|
|
|
3553
4035
|
const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isQuoteInsufficientBalance || isBelowMinimum || isQuoteLoading || !selectedRouteCard || !selectedRouteCard.quoteData.quoteId || selectedRouteGeoBlocked || !isAuthenticated || quoteStatus !== void 0;
|
|
3554
4036
|
const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (orderedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading);
|
|
3555
4037
|
const shouldShowRouteToggle = !isQuoteLoading && orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
|
|
3556
|
-
const handleReturnToOrderForm =
|
|
4038
|
+
const handleReturnToOrderForm = useCallback3(() => {
|
|
3557
4039
|
const submittedSelection = submittedSelectionRef.current;
|
|
3558
4040
|
submittedSelectionRef.current = null;
|
|
3559
4041
|
setSubmissionProgressState(null);
|
|
@@ -3574,7 +4056,7 @@ var PlaceOrder = ({
|
|
|
3574
4056
|
const shareUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(shareText)}`;
|
|
3575
4057
|
window.open(shareUrl, "_blank", "noopener,noreferrer");
|
|
3576
4058
|
};
|
|
3577
|
-
const handleExecuteQuote =
|
|
4059
|
+
const handleExecuteQuote = useCallback3(
|
|
3578
4060
|
(quoteData) => __async(null, null, function* () {
|
|
3579
4061
|
var _a2, _b2, _c2;
|
|
3580
4062
|
const quoteId = quoteData == null ? void 0 : quoteData.quoteId;
|
|
@@ -3633,6 +4115,7 @@ var PlaceOrder = ({
|
|
|
3633
4115
|
executionVenue: resolveExecutionVenueFromQuote(quoteData),
|
|
3634
4116
|
orderId: response.orderIds[0],
|
|
3635
4117
|
orderIds: response.orderIds,
|
|
4118
|
+
quoteId: response.quoteId,
|
|
3636
4119
|
phase: "submitting"
|
|
3637
4120
|
});
|
|
3638
4121
|
} catch (error) {
|
|
@@ -3672,7 +4155,7 @@ var PlaceOrder = ({
|
|
|
3672
4155
|
tradingLabels.quoteUnavailable
|
|
3673
4156
|
]
|
|
3674
4157
|
);
|
|
3675
|
-
const handleSkipToSuccess =
|
|
4158
|
+
const handleSkipToSuccess = useCallback3(() => {
|
|
3676
4159
|
const primaryFilledEvent = executionProgress.terminalOrderEvents.find(
|
|
3677
4160
|
(e) => e.event === "filled" || e.event === "partial_fill"
|
|
3678
4161
|
);
|
|
@@ -3697,7 +4180,7 @@ var PlaceOrder = ({
|
|
|
3697
4180
|
failureSummary,
|
|
3698
4181
|
selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData
|
|
3699
4182
|
]);
|
|
3700
|
-
|
|
4183
|
+
useEffect3(() => {
|
|
3701
4184
|
if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return;
|
|
3702
4185
|
if ((failureSummary == null ? void 0 : failureSummary.kind) !== "partial_fill") return;
|
|
3703
4186
|
if (!shouldAutoSkipPartialFill) return;
|
|
@@ -3708,7 +4191,7 @@ var PlaceOrder = ({
|
|
|
3708
4191
|
shouldAutoSkipPartialFill,
|
|
3709
4192
|
submissionProgressState == null ? void 0 : submissionProgressState.phase
|
|
3710
4193
|
]);
|
|
3711
|
-
const handleRetrySubmission =
|
|
4194
|
+
const handleRetrySubmission = useCallback3(() => __async(null, null, function* () {
|
|
3712
4195
|
var _a2, _b2, _c2;
|
|
3713
4196
|
if (!orderEligibility.canPlaceOrder || (failureSummary == null ? void 0 : failureSummary.kind) === "generic") {
|
|
3714
4197
|
handleReturnToOrderForm();
|
|
@@ -3802,7 +4285,7 @@ var PlaceOrder = ({
|
|
|
3802
4285
|
]);
|
|
3803
4286
|
const resolvedStatusClassName = cn(classNames == null ? void 0 : classNames.root, className);
|
|
3804
4287
|
if (isLoading) {
|
|
3805
|
-
return /* @__PURE__ */
|
|
4288
|
+
return /* @__PURE__ */ jsx5(
|
|
3806
4289
|
Skeleton,
|
|
3807
4290
|
{
|
|
3808
4291
|
ariaLabel: labels.common.loading,
|
|
@@ -3813,7 +4296,7 @@ var PlaceOrder = ({
|
|
|
3813
4296
|
}
|
|
3814
4297
|
if (submissionProgressState) {
|
|
3815
4298
|
if (submissionProgressState.phase === "success" && submissionProgressState.summary) {
|
|
3816
|
-
return /* @__PURE__ */
|
|
4299
|
+
return /* @__PURE__ */ jsx5(
|
|
3817
4300
|
PlaceOrderSuccessView,
|
|
3818
4301
|
{
|
|
3819
4302
|
className: resolvedStatusClassName,
|
|
@@ -3825,7 +4308,7 @@ var PlaceOrder = ({
|
|
|
3825
4308
|
);
|
|
3826
4309
|
}
|
|
3827
4310
|
if (submissionProgressState.phase === "failed") {
|
|
3828
|
-
return /* @__PURE__ */
|
|
4311
|
+
return /* @__PURE__ */ jsx5(
|
|
3829
4312
|
PlaceOrderFailureView,
|
|
3830
4313
|
{
|
|
3831
4314
|
className: resolvedStatusClassName,
|
|
@@ -3880,8 +4363,8 @@ var PlaceOrder = ({
|
|
|
3880
4363
|
};
|
|
3881
4364
|
const handleFillSellableShares = () => {
|
|
3882
4365
|
if (!isSell) return;
|
|
3883
|
-
if (
|
|
3884
|
-
handleAmountChange(
|
|
4366
|
+
if (maxSellableShares <= 0) return;
|
|
4367
|
+
handleAmountChange(maxSellableShares);
|
|
3885
4368
|
};
|
|
3886
4369
|
const handleDepositRequiredClick = () => {
|
|
3887
4370
|
if (!isInsufficientBalance) return;
|
|
@@ -3950,19 +4433,21 @@ var PlaceOrder = ({
|
|
|
3950
4433
|
});
|
|
3951
4434
|
}
|
|
3952
4435
|
});
|
|
3953
|
-
if (!orderEligibility.canPlaceOrder && resolvedReadOnlyTradingState.kind !== "open") {
|
|
3954
|
-
return /* @__PURE__ */
|
|
4436
|
+
if (isEndedWithoutKnownWinner || !orderEligibility.canPlaceOrder && resolvedReadOnlyTradingState.kind !== "open") {
|
|
4437
|
+
return /* @__PURE__ */ jsx5(
|
|
3955
4438
|
PlaceOrderResolvedView,
|
|
3956
4439
|
{
|
|
3957
4440
|
tradingState: resolvedReadOnlyTradingState,
|
|
4441
|
+
resolutionTimestamp: (_G = resolvedEventTradingState.resolvesAt) != null ? _G : resolvedReadOnlyTradingState.resolvesAt,
|
|
3958
4442
|
resolvedClaim,
|
|
3959
4443
|
classNames,
|
|
3960
|
-
className
|
|
4444
|
+
className,
|
|
4445
|
+
isSportsEvent: (scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.structureType) === "sport" && !!(scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.sport) && scopedSelectedEvent.sport !== "other_sport"
|
|
3961
4446
|
}
|
|
3962
4447
|
);
|
|
3963
4448
|
}
|
|
3964
|
-
return /* @__PURE__ */
|
|
3965
|
-
/* @__PURE__ */
|
|
4449
|
+
return /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
4450
|
+
/* @__PURE__ */ jsxs4(
|
|
3966
4451
|
Card,
|
|
3967
4452
|
{
|
|
3968
4453
|
className: cn(
|
|
@@ -3979,8 +4464,8 @@ var PlaceOrder = ({
|
|
|
3979
4464
|
headerTitle,
|
|
3980
4465
|
onClose
|
|
3981
4466
|
}),
|
|
3982
|
-
/* @__PURE__ */
|
|
3983
|
-
/* @__PURE__ */
|
|
4467
|
+
/* @__PURE__ */ jsxs4("div", { className: cn("agg-order-panel-content flex flex-col gap-6", classNames == null ? void 0 : classNames.content), children: [
|
|
4468
|
+
/* @__PURE__ */ jsx5(
|
|
3984
4469
|
"div",
|
|
3985
4470
|
{
|
|
3986
4471
|
className: "agg-order-tabs flex items-end border-b border-agg-separator",
|
|
@@ -3991,7 +4476,7 @@ var PlaceOrder = ({
|
|
|
3991
4476
|
{ value: "sell", label: tradingLabels.sell, ref: sellTabRef }
|
|
3992
4477
|
].map((tabItem) => {
|
|
3993
4478
|
const isActive = internalTab === tabItem.value;
|
|
3994
|
-
return /* @__PURE__ */
|
|
4479
|
+
return /* @__PURE__ */ jsxs4(
|
|
3995
4480
|
"button",
|
|
3996
4481
|
{
|
|
3997
4482
|
ref: tabItem.ref,
|
|
@@ -4015,7 +4500,7 @@ var PlaceOrder = ({
|
|
|
4015
4500
|
onKeyDown: (event) => handleTabKeyDown(event, tabItem.value),
|
|
4016
4501
|
children: [
|
|
4017
4502
|
tabItem.label,
|
|
4018
|
-
/* @__PURE__ */
|
|
4503
|
+
/* @__PURE__ */ jsx5(
|
|
4019
4504
|
"span",
|
|
4020
4505
|
{
|
|
4021
4506
|
"aria-hidden": "true",
|
|
@@ -4037,7 +4522,7 @@ var PlaceOrder = ({
|
|
|
4037
4522
|
})
|
|
4038
4523
|
}
|
|
4039
4524
|
),
|
|
4040
|
-
outcomes.length >= 2 ? /* @__PURE__ */
|
|
4525
|
+
outcomes.length >= 2 ? /* @__PURE__ */ jsx5("div", { className: "agg-outcomes flex w-full max-w-full gap-2", children: outcomes.map((outcome, index) => {
|
|
4041
4526
|
var _a2, _b2, _c2;
|
|
4042
4527
|
const price = getDisplayOutcomePrice({
|
|
4043
4528
|
outcomeId: outcome.id,
|
|
@@ -4051,7 +4536,7 @@ var PlaceOrder = ({
|
|
|
4051
4536
|
});
|
|
4052
4537
|
const isActive = outcome.id === scopedSelectedOutcomeId;
|
|
4053
4538
|
const isPositive = resolveIsPositiveOutcome(outcome, index);
|
|
4054
|
-
return /* @__PURE__ */
|
|
4539
|
+
return /* @__PURE__ */ jsxs4(
|
|
4055
4540
|
"button",
|
|
4056
4541
|
{
|
|
4057
4542
|
"data-id": outcome.id,
|
|
@@ -4071,7 +4556,7 @@ var PlaceOrder = ({
|
|
|
4071
4556
|
disabled: !orderEligibility.canPlaceOrder || isResolvedOutcomeCtaLocked,
|
|
4072
4557
|
onClick: () => handleOutcomeChange(outcome.id),
|
|
4073
4558
|
children: [
|
|
4074
|
-
/* @__PURE__ */
|
|
4559
|
+
/* @__PURE__ */ jsx5(
|
|
4075
4560
|
Typography,
|
|
4076
4561
|
{
|
|
4077
4562
|
as: "span",
|
|
@@ -4080,18 +4565,18 @@ var PlaceOrder = ({
|
|
|
4080
4565
|
children: (_c2 = outcome.title) != null ? _c2 : outcome.label
|
|
4081
4566
|
}
|
|
4082
4567
|
),
|
|
4083
|
-
/* @__PURE__ */
|
|
4568
|
+
/* @__PURE__ */ jsx5(Typography, { as: "span", variant: isActive ? "body-strong" : "body", children: formatProbabilityCents(price) })
|
|
4084
4569
|
]
|
|
4085
4570
|
},
|
|
4086
4571
|
outcome.id
|
|
4087
4572
|
);
|
|
4088
4573
|
}) }) : null,
|
|
4089
|
-
/* @__PURE__ */
|
|
4090
|
-
/* @__PURE__ */
|
|
4091
|
-
/* @__PURE__ */
|
|
4092
|
-
isAuthenticated ? isSell ? /* @__PURE__ */
|
|
4093
|
-
/* @__PURE__ */
|
|
4094
|
-
displayedCurrentSellableShares > 0 ? /* @__PURE__ */
|
|
4574
|
+
/* @__PURE__ */ jsxs4("div", { className: "agg-order-amount-section flex items-start justify-between gap-4", children: [
|
|
4575
|
+
/* @__PURE__ */ jsxs4("div", { className: "agg-order-amount-meta flex flex-col", children: [
|
|
4576
|
+
/* @__PURE__ */ jsx5("p", { className: "agg-order-amount-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground whitespace-nowrap", children: tradingLabels.amount(internalTab) }),
|
|
4577
|
+
isAuthenticated ? isSell ? /* @__PURE__ */ jsx5("div", { className: "agg-balance-value flex items-baseline gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isCurrentSellableSharesLoading ? /* @__PURE__ */ jsx5(LoadingIcon, { size: "small" }) : /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
4578
|
+
/* @__PURE__ */ jsx5("span", { className: "whitespace-pre", children: displayedCurrentSellableSharesLabel }),
|
|
4579
|
+
displayedCurrentSellableShares > 0 ? /* @__PURE__ */ jsx5(
|
|
4095
4580
|
"button",
|
|
4096
4581
|
{
|
|
4097
4582
|
type: "button",
|
|
@@ -4107,9 +4592,9 @@ var PlaceOrder = ({
|
|
|
4107
4592
|
children: tradingLabels.maxShares
|
|
4108
4593
|
}
|
|
4109
4594
|
) : null
|
|
4110
|
-
] }) }) : /* @__PURE__ */
|
|
4595
|
+
] }) }) : /* @__PURE__ */ jsx5("p", { className: "agg-balance-value flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isBalanceLoading ? /* @__PURE__ */ jsx5(LoadingIcon, { size: "small" }) : tradingLabels.balance(formatUsd(totalBalance)) }) : null
|
|
4111
4596
|
] }),
|
|
4112
|
-
/* @__PURE__ */
|
|
4597
|
+
/* @__PURE__ */ jsx5(
|
|
4113
4598
|
CurrencyInput,
|
|
4114
4599
|
{
|
|
4115
4600
|
value: internalAmount,
|
|
@@ -4118,7 +4603,7 @@ var PlaceOrder = ({
|
|
|
4118
4603
|
isInvalid: isInsufficientBalance || isBelowMinimum,
|
|
4119
4604
|
disabled: !orderEligibility.canPlaceOrder,
|
|
4120
4605
|
prefix: internalTab === "buy" ? "$" : "",
|
|
4121
|
-
decimalPlaces: isSell ?
|
|
4606
|
+
decimalPlaces: isSell ? SELL_SHARE_INPUT_DECIMALS : 2,
|
|
4122
4607
|
classNames: {
|
|
4123
4608
|
input: cn(
|
|
4124
4609
|
"agg-order-amount-input",
|
|
@@ -4129,9 +4614,9 @@ var PlaceOrder = ({
|
|
|
4129
4614
|
}
|
|
4130
4615
|
)
|
|
4131
4616
|
] }),
|
|
4132
|
-
showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */
|
|
4133
|
-
/* @__PURE__ */
|
|
4134
|
-
/* @__PURE__ */
|
|
4617
|
+
showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */ jsxs4("div", { className: "agg-order-fees-section flex items-center justify-between gap-4", children: [
|
|
4618
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1.5", children: [
|
|
4619
|
+
/* @__PURE__ */ jsx5(
|
|
4135
4620
|
Typography,
|
|
4136
4621
|
{
|
|
4137
4622
|
variant: "text-sm",
|
|
@@ -4139,7 +4624,7 @@ var PlaceOrder = ({
|
|
|
4139
4624
|
children: tradingLabels.estimatedFees
|
|
4140
4625
|
}
|
|
4141
4626
|
),
|
|
4142
|
-
feeBreakdownRows.length > 0 ? /* @__PURE__ */
|
|
4627
|
+
feeBreakdownRows.length > 0 ? /* @__PURE__ */ jsx5(
|
|
4143
4628
|
Tooltip,
|
|
4144
4629
|
{
|
|
4145
4630
|
"aria-label": tradingLabels.estimatedFeesTooltipAria,
|
|
@@ -4151,13 +4636,13 @@ var PlaceOrder = ({
|
|
|
4151
4636
|
icon: "h-3 w-3 text-agg-muted-foreground",
|
|
4152
4637
|
trigger: "h-3 w-3 text-agg-muted-foreground"
|
|
4153
4638
|
},
|
|
4154
|
-
content: /* @__PURE__ */
|
|
4639
|
+
content: /* @__PURE__ */ jsx5("div", { className: "flex w-full flex-col gap-2", children: feeBreakdownRows.map((row) => /* @__PURE__ */ jsxs4(
|
|
4155
4640
|
"div",
|
|
4156
4641
|
{
|
|
4157
4642
|
className: "flex items-center justify-between gap-3 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground",
|
|
4158
4643
|
children: [
|
|
4159
|
-
/* @__PURE__ */
|
|
4160
|
-
row.kind === "badge" ? /* @__PURE__ */
|
|
4644
|
+
/* @__PURE__ */ jsx5("span", { children: row.label }),
|
|
4645
|
+
row.kind === "badge" ? /* @__PURE__ */ jsx5(
|
|
4161
4646
|
"span",
|
|
4162
4647
|
{
|
|
4163
4648
|
className: cn(
|
|
@@ -4167,7 +4652,7 @@ var PlaceOrder = ({
|
|
|
4167
4652
|
),
|
|
4168
4653
|
children: row.badgeLabel
|
|
4169
4654
|
}
|
|
4170
|
-
) : /* @__PURE__ */
|
|
4655
|
+
) : /* @__PURE__ */ jsx5("span", { className: "text-right", children: row.value })
|
|
4171
4656
|
]
|
|
4172
4657
|
},
|
|
4173
4658
|
row.label
|
|
@@ -4175,12 +4660,12 @@ var PlaceOrder = ({
|
|
|
4175
4660
|
}
|
|
4176
4661
|
) : null
|
|
4177
4662
|
] }),
|
|
4178
|
-
/* @__PURE__ */
|
|
4663
|
+
/* @__PURE__ */ jsx5("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: estimatedFeesValue })
|
|
4179
4664
|
] }) : null,
|
|
4180
|
-
shouldShowSmartRouting ? /* @__PURE__ */
|
|
4181
|
-
/* @__PURE__ */
|
|
4182
|
-
/* @__PURE__ */
|
|
4183
|
-
shouldShowRouteToggle && !isRoutesExpanded ? /* @__PURE__ */
|
|
4665
|
+
shouldShowSmartRouting ? /* @__PURE__ */ jsxs4("div", { className: "agg-route-panel flex flex-col gap-3", children: [
|
|
4666
|
+
/* @__PURE__ */ jsxs4("div", { className: "agg-route-panel-header flex items-center justify-between gap-4", children: [
|
|
4667
|
+
/* @__PURE__ */ jsx5("p", { className: "agg-route-panel-title text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.smartRouting }),
|
|
4668
|
+
shouldShowRouteToggle && !isRoutesExpanded ? /* @__PURE__ */ jsxs4(
|
|
4184
4669
|
"button",
|
|
4185
4670
|
{
|
|
4186
4671
|
type: "button",
|
|
@@ -4188,8 +4673,8 @@ var PlaceOrder = ({
|
|
|
4188
4673
|
"aria-label": tradingLabels.viewAllRoutes(orderedRouteCards.length),
|
|
4189
4674
|
onClick: () => setIsRoutesExpanded((currentValue) => !currentValue),
|
|
4190
4675
|
children: [
|
|
4191
|
-
/* @__PURE__ */
|
|
4192
|
-
/* @__PURE__ */
|
|
4676
|
+
/* @__PURE__ */ jsx5("span", { children: tradingLabels.viewAllRoutes(orderedRouteCards.length) }),
|
|
4677
|
+
/* @__PURE__ */ jsx5(
|
|
4193
4678
|
Icon,
|
|
4194
4679
|
{
|
|
4195
4680
|
name: "chevron-down",
|
|
@@ -4202,11 +4687,11 @@ var PlaceOrder = ({
|
|
|
4202
4687
|
}
|
|
4203
4688
|
) : null
|
|
4204
4689
|
] }),
|
|
4205
|
-
/* @__PURE__ */
|
|
4206
|
-
/* @__PURE__ */
|
|
4207
|
-
/* @__PURE__ */
|
|
4690
|
+
/* @__PURE__ */ jsx5("div", { className: "agg-route-list flex flex-col gap-2", children: isQuoteLoading ? /* @__PURE__ */ jsxs4("div", { className: "agg-route-loading flex flex-col gap-2", "aria-hidden": "true", children: [
|
|
4691
|
+
/* @__PURE__ */ jsx5(PlaceOrderRouteCardSkeleton, {}),
|
|
4692
|
+
/* @__PURE__ */ jsx5(PlaceOrderRouteCardSkeleton, {})
|
|
4208
4693
|
] }) : visibleRouteCards.length > 0 ? visibleRouteCards.map((card) => {
|
|
4209
|
-
return /* @__PURE__ */
|
|
4694
|
+
return /* @__PURE__ */ jsx5(Fragment2, { children: renderRouteCard({
|
|
4210
4695
|
card,
|
|
4211
4696
|
enableAnimations,
|
|
4212
4697
|
isExpanded: card.kind === "split" ? isSplitDetailOpen : isRoutesExpanded,
|
|
@@ -4216,12 +4701,12 @@ var PlaceOrder = ({
|
|
|
4216
4701
|
}) }, card.id);
|
|
4217
4702
|
}) : null })
|
|
4218
4703
|
] }) : null,
|
|
4219
|
-
hasEnteredAmount && selectedRouteCard && !isQuoteLoading && !isBelowMinimum && orderEligibility.canPlaceOrder ? /* @__PURE__ */
|
|
4220
|
-
/* @__PURE__ */
|
|
4221
|
-
/* @__PURE__ */
|
|
4222
|
-
/* @__PURE__ */
|
|
4704
|
+
hasEnteredAmount && selectedRouteCard && !isQuoteLoading && !isBelowMinimum && orderEligibility.canPlaceOrder ? /* @__PURE__ */ jsxs4("div", { className: "agg-order-summary flex items-start justify-between gap-4", children: [
|
|
4705
|
+
/* @__PURE__ */ jsxs4("div", { className: "agg-order-summary-meta flex flex-col", children: [
|
|
4706
|
+
/* @__PURE__ */ jsx5("p", { className: "agg-order-summary-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.toWin(internalTab) }),
|
|
4707
|
+
/* @__PURE__ */ jsx5("p", { className: "agg-order-summary-hint text-agg-sm leading-agg-5 text-agg-muted-foreground", children: displayedToWinHint })
|
|
4223
4708
|
] }),
|
|
4224
|
-
/* @__PURE__ */
|
|
4709
|
+
/* @__PURE__ */ jsx5(
|
|
4225
4710
|
NumberFlow,
|
|
4226
4711
|
{
|
|
4227
4712
|
value: displayedToWinValue,
|
|
@@ -4236,7 +4721,7 @@ var PlaceOrder = ({
|
|
|
4236
4721
|
}
|
|
4237
4722
|
)
|
|
4238
4723
|
] }) : null,
|
|
4239
|
-
/* @__PURE__ */
|
|
4724
|
+
/* @__PURE__ */ jsxs4(
|
|
4240
4725
|
"div",
|
|
4241
4726
|
{
|
|
4242
4727
|
className: cn(
|
|
@@ -4244,17 +4729,17 @@ var PlaceOrder = ({
|
|
|
4244
4729
|
classNames == null ? void 0 : classNames.footer
|
|
4245
4730
|
),
|
|
4246
4731
|
children: [
|
|
4247
|
-
!shouldShowGeoBlockBanner ? /* @__PURE__ */
|
|
4248
|
-
submissionFeedback ? /* @__PURE__ */
|
|
4732
|
+
!shouldShowGeoBlockBanner ? /* @__PURE__ */ jsxs4("div", { className: "agg-order-alerts flex flex-col gap-3 empty:hidden mb-3", children: [
|
|
4733
|
+
submissionFeedback ? /* @__PURE__ */ jsx5(
|
|
4249
4734
|
InlineAlert,
|
|
4250
4735
|
{
|
|
4251
4736
|
tone: submissionFeedback.tone,
|
|
4252
4737
|
message: submissionFeedback.message
|
|
4253
4738
|
}
|
|
4254
4739
|
) : null,
|
|
4255
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && isBelowMinimum ? /* @__PURE__ */
|
|
4256
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && quoteStatus ? /* @__PURE__ */
|
|
4257
|
-
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && !quoteStatus && isAuthenticated && hasEnteredAmount && smartRouteErrorMessage ? /* @__PURE__ */
|
|
4740
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && isBelowMinimum ? /* @__PURE__ */ jsx5(InlineAlert, { tone: "error", message: belowMinimumMessage }) : null,
|
|
4741
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && quoteStatus ? /* @__PURE__ */ jsx5(InlineAlert, { tone: quoteStatus.tone, message: quoteStatus.message }) : null,
|
|
4742
|
+
!submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && !quoteStatus && isAuthenticated && hasEnteredAmount && smartRouteErrorMessage ? /* @__PURE__ */ jsx5(
|
|
4258
4743
|
InlineAlert,
|
|
4259
4744
|
{
|
|
4260
4745
|
tone: "error",
|
|
@@ -4266,14 +4751,14 @@ var PlaceOrder = ({
|
|
|
4266
4751
|
}
|
|
4267
4752
|
) : null
|
|
4268
4753
|
] }) : null,
|
|
4269
|
-
!submissionFeedback && !shouldShowGeoBlockBanner && orderEligibility.canPlaceOrder && shouldShowInsufficientBalanceAlert ? /* @__PURE__ */
|
|
4754
|
+
!submissionFeedback && !shouldShowGeoBlockBanner && orderEligibility.canPlaceOrder && shouldShowInsufficientBalanceAlert ? /* @__PURE__ */ jsxs4(
|
|
4270
4755
|
"div",
|
|
4271
4756
|
{
|
|
4272
4757
|
className: "agg-order-insufficient-balance-alert flex items-center justify-center gap-2",
|
|
4273
4758
|
role: "status",
|
|
4274
4759
|
"aria-live": "polite",
|
|
4275
4760
|
children: [
|
|
4276
|
-
/* @__PURE__ */
|
|
4761
|
+
/* @__PURE__ */ jsx5(
|
|
4277
4762
|
Icon,
|
|
4278
4763
|
{
|
|
4279
4764
|
name: "warning-filled",
|
|
@@ -4282,11 +4767,11 @@ var PlaceOrder = ({
|
|
|
4282
4767
|
"aria-hidden": "true"
|
|
4283
4768
|
}
|
|
4284
4769
|
),
|
|
4285
|
-
/* @__PURE__ */
|
|
4770
|
+
/* @__PURE__ */ jsx5("span", { className: "text-agg-sm text-agg-foreground", children: tradingLabels.insufficientBalance })
|
|
4286
4771
|
]
|
|
4287
4772
|
}
|
|
4288
4773
|
) : null,
|
|
4289
|
-
!submissionFeedback && !shouldShowGeoBlockBanner && isInsufficientBalance ? /* @__PURE__ */
|
|
4774
|
+
!submissionFeedback && !shouldShowGeoBlockBanner && isInsufficientBalance ? /* @__PURE__ */ jsx5(
|
|
4290
4775
|
Button,
|
|
4291
4776
|
{
|
|
4292
4777
|
size: "large",
|
|
@@ -4296,7 +4781,7 @@ var PlaceOrder = ({
|
|
|
4296
4781
|
onClick: handleDepositRequiredClick,
|
|
4297
4782
|
children: tradingLabels.deposit
|
|
4298
4783
|
}
|
|
4299
|
-
) : needsKycVerification && !submissionFeedback && !shouldShowGeoBlockBanner ? /* @__PURE__ */
|
|
4784
|
+
) : needsKycVerification && !submissionFeedback && !shouldShowGeoBlockBanner ? /* @__PURE__ */ jsx5(InitiateKycButton, { label: tradingLabels.kycRequired, onOpen: openVerifyModal }) : isQuoteLoading && !isActionLoading ? /* @__PURE__ */ jsx5(
|
|
4300
4785
|
Button,
|
|
4301
4786
|
{
|
|
4302
4787
|
size: "large",
|
|
@@ -4305,7 +4790,7 @@ var PlaceOrder = ({
|
|
|
4305
4790
|
disabled: true,
|
|
4306
4791
|
"aria-live": "polite",
|
|
4307
4792
|
"aria-label": routeLoadingMessage != null ? routeLoadingMessage : labels.common.loading,
|
|
4308
|
-
prefix: /* @__PURE__ */
|
|
4793
|
+
prefix: /* @__PURE__ */ jsx5(
|
|
4309
4794
|
"span",
|
|
4310
4795
|
{
|
|
4311
4796
|
className: cn(
|
|
@@ -4317,7 +4802,7 @@ var PlaceOrder = ({
|
|
|
4317
4802
|
),
|
|
4318
4803
|
children: routeLoadingMessage
|
|
4319
4804
|
}
|
|
4320
|
-
) : !isAuthenticated ? /* @__PURE__ */
|
|
4805
|
+
) : !isAuthenticated ? /* @__PURE__ */ jsx5(
|
|
4321
4806
|
Button,
|
|
4322
4807
|
{
|
|
4323
4808
|
size: "large",
|
|
@@ -4328,7 +4813,7 @@ var PlaceOrder = ({
|
|
|
4328
4813
|
onClick: requestAggAuthChooserOpen,
|
|
4329
4814
|
children: tradingLabels.signInToTrade
|
|
4330
4815
|
}
|
|
4331
|
-
) : /* @__PURE__ */
|
|
4816
|
+
) : /* @__PURE__ */ jsx5(
|
|
4332
4817
|
Button,
|
|
4333
4818
|
{
|
|
4334
4819
|
size: "large",
|
|
@@ -4343,8 +4828,8 @@ var PlaceOrder = ({
|
|
|
4343
4828
|
children: actionLabel
|
|
4344
4829
|
}
|
|
4345
4830
|
),
|
|
4346
|
-
!shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown ? /* @__PURE__ */
|
|
4347
|
-
/* @__PURE__ */
|
|
4831
|
+
!shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown ? /* @__PURE__ */ jsxs4("div", { className: "agg-order-platform-fee mt-1 flex items-center justify-center gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
|
|
4832
|
+
/* @__PURE__ */ jsx5(
|
|
4348
4833
|
Icon,
|
|
4349
4834
|
{
|
|
4350
4835
|
name: "shield-trust",
|
|
@@ -4353,10 +4838,10 @@ var PlaceOrder = ({
|
|
|
4353
4838
|
"aria-hidden": "true"
|
|
4354
4839
|
}
|
|
4355
4840
|
),
|
|
4356
|
-
/* @__PURE__ */
|
|
4841
|
+
/* @__PURE__ */ jsx5(Typography, { variant: "text-xs-caps", className: "text-agg-primary", children: tradingLabels.platformFee })
|
|
4357
4842
|
] }) : null,
|
|
4358
|
-
shouldShowGeoBlockBanner ? /* @__PURE__ */
|
|
4359
|
-
!shouldShowGeoBlockBanner ? /* @__PURE__ */
|
|
4843
|
+
shouldShowGeoBlockBanner ? /* @__PURE__ */ jsx5(GeoBlockBanner, { termsUrl: AGG_TERMS_OF_SERVICE_URL }) : null,
|
|
4844
|
+
!shouldShowGeoBlockBanner ? /* @__PURE__ */ jsx5("p", { className: "agg-order-disclaimer text-center text-agg-xs leading-agg-4 text-agg-muted-foreground", children: tradingLabels.disclaimer }) : null
|
|
4360
4845
|
]
|
|
4361
4846
|
}
|
|
4362
4847
|
)
|
|
@@ -4364,7 +4849,7 @@ var PlaceOrder = ({
|
|
|
4364
4849
|
]
|
|
4365
4850
|
}
|
|
4366
4851
|
),
|
|
4367
|
-
/* @__PURE__ */
|
|
4852
|
+
/* @__PURE__ */ jsx5(
|
|
4368
4853
|
KycVerifyModal,
|
|
4369
4854
|
{
|
|
4370
4855
|
open: isKycVerifyModalOpen,
|
|
@@ -4381,7 +4866,7 @@ var PlaceOrder = ({
|
|
|
4381
4866
|
}
|
|
4382
4867
|
}
|
|
4383
4868
|
),
|
|
4384
|
-
/* @__PURE__ */
|
|
4869
|
+
/* @__PURE__ */ jsx5(
|
|
4385
4870
|
KycSuccessModal,
|
|
4386
4871
|
{
|
|
4387
4872
|
open: showKycSuccessModal,
|
|
@@ -4410,7 +4895,7 @@ import {
|
|
|
4410
4895
|
useRedeem,
|
|
4411
4896
|
useRedeemLifecycles
|
|
4412
4897
|
} from "@agg-build/hooks";
|
|
4413
|
-
import { useCallback as
|
|
4898
|
+
import { useCallback as useCallback4, useEffect as useEffect4, useMemo as useMemo3, useRef as useRef4, useState as useState4 } from "react";
|
|
4414
4899
|
var toClaimError = (err) => {
|
|
4415
4900
|
if (err instanceof Error) return err;
|
|
4416
4901
|
return new Error(String(err));
|
|
@@ -4423,9 +4908,9 @@ function useClaimWinnings(options = {}) {
|
|
|
4423
4908
|
const queryClient = useQueryClient2();
|
|
4424
4909
|
const redeemMutation = useRedeem();
|
|
4425
4910
|
const [activeRedeems, setActiveRedeems] = useState4({});
|
|
4426
|
-
const activeClaimKeysRef =
|
|
4427
|
-
const pendingClaimToastIdsRef =
|
|
4428
|
-
const submittedClaimToastKeysRef =
|
|
4911
|
+
const activeClaimKeysRef = useRef4(/* @__PURE__ */ new Set());
|
|
4912
|
+
const pendingClaimToastIdsRef = useRef4({});
|
|
4913
|
+
const submittedClaimToastKeysRef = useRef4(/* @__PURE__ */ new Set());
|
|
4429
4914
|
const [submittingClaimKeys, setSubmittingClaimKeys] = useState4({});
|
|
4430
4915
|
const lifecycleInputs = useMemo3(
|
|
4431
4916
|
() => Object.values(activeRedeems),
|
|
@@ -4441,11 +4926,11 @@ function useClaimWinnings(options = {}) {
|
|
|
4441
4926
|
return out;
|
|
4442
4927
|
}, [activeRedeems, lifecycleStates, submittingClaimKeys]);
|
|
4443
4928
|
const claimingKeys = externalClaimingKeys != null ? externalClaimingKeys : internalClaimingIds;
|
|
4444
|
-
const isClaiming =
|
|
4929
|
+
const isClaiming = useCallback4(
|
|
4445
4930
|
(claimKey) => Boolean(externalClaimingKeys == null ? void 0 : externalClaimingKeys[claimKey]) || Boolean(internalClaimingIds[claimKey]),
|
|
4446
4931
|
[externalClaimingKeys, internalClaimingIds]
|
|
4447
4932
|
);
|
|
4448
|
-
const invalidateClaimUiState =
|
|
4933
|
+
const invalidateClaimUiState = useCallback4(() => {
|
|
4449
4934
|
invalidateBalanceQueries2(queryClient);
|
|
4450
4935
|
invalidatePositionQueries2(queryClient);
|
|
4451
4936
|
queryClient.invalidateQueries({
|
|
@@ -4454,7 +4939,7 @@ function useClaimWinnings(options = {}) {
|
|
|
4454
4939
|
});
|
|
4455
4940
|
invalidateUserActivityQueries(queryClient);
|
|
4456
4941
|
}, [queryClient]);
|
|
4457
|
-
const claim =
|
|
4942
|
+
const claim = useCallback4(
|
|
4458
4943
|
(_0) => __async(null, [_0], function* ({ claimKey, winningOutcomeIds, payload }) {
|
|
4459
4944
|
if (activeClaimKeysRef.current.has(claimKey) || Boolean(externalClaimingKeys == null ? void 0 : externalClaimingKeys[claimKey]) || internalClaimingIds[claimKey]) {
|
|
4460
4945
|
return;
|
|
@@ -4592,8 +5077,8 @@ function useClaimWinnings(options = {}) {
|
|
|
4592
5077
|
toastCtx
|
|
4593
5078
|
]
|
|
4594
5079
|
);
|
|
4595
|
-
const firedTerminalRef =
|
|
4596
|
-
|
|
5080
|
+
const firedTerminalRef = useRef4({});
|
|
5081
|
+
useEffect4(() => {
|
|
4597
5082
|
var _a, _b;
|
|
4598
5083
|
for (const [claimKey, active] of Object.entries(activeRedeems)) {
|
|
4599
5084
|
const state = lifecycleStates[active.redeemId];
|
|
@@ -4652,7 +5137,7 @@ function useClaimWinnings(options = {}) {
|
|
|
4652
5137
|
import {
|
|
4653
5138
|
computeClosedPositionTotals,
|
|
4654
5139
|
resolveMarketTradingState as resolveMarketTradingState2,
|
|
4655
|
-
useAggAuthState,
|
|
5140
|
+
useAggAuthState as useAggAuthState2,
|
|
4656
5141
|
useExecutionPositions as useExecutionPositions2
|
|
4657
5142
|
} from "@agg-build/hooks";
|
|
4658
5143
|
import { useMemo as useMemo4 } from "react";
|
|
@@ -4671,7 +5156,7 @@ var formatResolutionDate = (value) => {
|
|
|
4671
5156
|
function useResolvedMarketClaim(options = {}) {
|
|
4672
5157
|
var _a;
|
|
4673
5158
|
const { market, enabled = true, executionMode } = options;
|
|
4674
|
-
const { isAuthenticated } =
|
|
5159
|
+
const { isAuthenticated } = useAggAuthState2();
|
|
4675
5160
|
const tradingState = useMemo4(() => resolveMarketTradingState2(market), [market]);
|
|
4676
5161
|
const isResolved = tradingState.kind === "resolved";
|
|
4677
5162
|
const marketId = (_a = market == null ? void 0 : market.id) != null ? _a : null;
|
|
@@ -4720,6 +5205,7 @@ function useResolvedMarketClaim(options = {}) {
|
|
|
4720
5205
|
}
|
|
4721
5206
|
|
|
4722
5207
|
export {
|
|
5208
|
+
AggNotificationEventsProvider,
|
|
4723
5209
|
parseVenue,
|
|
4724
5210
|
parseAmount,
|
|
4725
5211
|
SettlementDetails,
|