@agg-build/ui 4.15.0 → 4.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-UFU5HUHC.mjs → chunk-3Y2GCNVL.mjs} +100 -52
- package/dist/{chunk-HK4DEG4E.mjs → chunk-7E4UXCEX.mjs} +223 -169
- package/dist/{chunk-QQ2Q75BF.mjs → chunk-B5ALKYD5.mjs} +210 -184
- package/dist/{chunk-U6ANP4P5.mjs → chunk-BBDFSTIA.mjs} +6 -2
- package/dist/{chunk-MR6AORPA.mjs → chunk-JI5KV4QI.mjs} +4 -3
- package/dist/{chunk-BTQGP257.mjs → chunk-RZLM3M5R.mjs} +2 -2
- package/dist/{chunk-2OQCZNGY.mjs → chunk-TK62UB5F.mjs} +27 -16
- package/dist/events.js +32 -17
- package/dist/events.mjs +3 -3
- package/dist/index.js +1038 -922
- package/dist/index.mjs +9 -38
- package/dist/modals.js +214 -185
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +817 -675
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +6 -2
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +535 -442
- package/dist/trading.mjs +4 -4
- package/dist/types/auth/connect-button-view/connect-button-view.types.d.mts +0 -2
- package/dist/types/auth/connect-button-view/connect-button-view.types.d.ts +0 -2
- package/dist/types/auth/connect-button-view/index.d.mts +1 -1
- package/dist/types/auth/connect-button-view/index.d.ts +1 -1
- package/dist/types/pages/user-profile/components/available-balance-card.d.mts +3 -1
- package/dist/types/pages/user-profile/components/available-balance-card.d.ts +3 -1
- package/dist/types/pages/user-profile/user-profile.types.d.mts +8 -0
- package/dist/types/pages/user-profile/user-profile.types.d.ts +8 -0
- package/dist/types/primitives/modal/index.d.mts +1 -1
- package/dist/types/primitives/modal/index.d.ts +1 -1
- package/dist/types/primitives/modal/modal.types.d.mts +6 -0
- package/dist/types/primitives/modal/modal.types.d.ts +6 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +12 -1
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +12 -1
- package/package.json +3 -3
package/dist/trading.js
CHANGED
|
@@ -5190,13 +5190,14 @@ var parseSettlementDateMs = (value) => {
|
|
|
5190
5190
|
var isDateLikeDifference = (canonicalKey) => {
|
|
5191
5191
|
return canonicalKey === "resolution_timing" || canonicalKey === "start_date" || canonicalKey === "end_date";
|
|
5192
5192
|
};
|
|
5193
|
-
var
|
|
5194
|
-
if (!isDateLikeDifference(canonicalKey)) return false;
|
|
5193
|
+
var hasEqualValuesAcrossVenues = (difference) => {
|
|
5195
5194
|
const values = Object.values(difference.perVenue);
|
|
5196
5195
|
if (values.length < 2) return false;
|
|
5197
5196
|
const timestamps = values.map(parseSettlementDateMs);
|
|
5198
|
-
if (timestamps.
|
|
5199
|
-
|
|
5197
|
+
if (timestamps.every((timestamp) => timestamp !== null)) {
|
|
5198
|
+
return new Set(timestamps).size === 1;
|
|
5199
|
+
}
|
|
5200
|
+
return new Set(values.map(normalizeSettlementForCompare)).size === 1;
|
|
5200
5201
|
};
|
|
5201
5202
|
var resolveDifferenceSeverity = (difference, canonicalKey) => {
|
|
5202
5203
|
var _a;
|
|
@@ -5231,7 +5232,7 @@ var prepareSettlementDifferences = (differences) => {
|
|
|
5231
5232
|
if (!title2 || Object.keys(perVenue).length === 0) continue;
|
|
5232
5233
|
const difference = __spreadProps(__spreadValues({}, rawDifference), { title: title2, perVenue });
|
|
5233
5234
|
const canonicalKey = resolveCanonicalDifferenceKey(difference);
|
|
5234
|
-
if (
|
|
5235
|
+
if (hasEqualValuesAcrossVenues(difference)) continue;
|
|
5235
5236
|
const existing = byCanonicalKey.get(canonicalKey);
|
|
5236
5237
|
if (existing) {
|
|
5237
5238
|
byCanonicalKey.set(canonicalKey, __spreadProps(__spreadValues({}, existing), {
|
|
@@ -5245,7 +5246,7 @@ var prepareSettlementDifferences = (differences) => {
|
|
|
5245
5246
|
originalIndex
|
|
5246
5247
|
}));
|
|
5247
5248
|
}
|
|
5248
|
-
return Array.from(byCanonicalKey.values()).sort((left, right) => {
|
|
5249
|
+
return Array.from(byCanonicalKey.values()).filter((difference) => !hasEqualValuesAcrossVenues(difference)).sort((left, right) => {
|
|
5249
5250
|
const severityDelta = Number(right.severity === "critical") - Number(left.severity === "critical");
|
|
5250
5251
|
if (severityDelta !== 0) return severityDelta;
|
|
5251
5252
|
return left.originalIndex - right.originalIndex;
|
|
@@ -5259,9 +5260,7 @@ var resolveSettlementVenueLabel = (venue, labels) => {
|
|
|
5259
5260
|
return (_a = labels.venues[venue]) != null ? _a : formatVenueFallbackLabel(venue);
|
|
5260
5261
|
};
|
|
5261
5262
|
var resolveDifferenceVenueKeys = (difference, settlementVenues) => {
|
|
5262
|
-
const
|
|
5263
|
-
if (!isDateLikeDifference(difference.canonicalKey)) return explicitVenues;
|
|
5264
|
-
const allVenues = [...settlementVenues != null ? settlementVenues : [], ...explicitVenues];
|
|
5263
|
+
const allVenues = [...settlementVenues != null ? settlementVenues : [], ...Object.keys(difference.perVenue)];
|
|
5265
5264
|
return Array.from(new Set(allVenues.filter((venue) => venue.trim().length > 0)));
|
|
5266
5265
|
};
|
|
5267
5266
|
var resolveDifferenceIconClassName = (canonicalKey) => {
|
|
@@ -5300,6 +5299,12 @@ var buildSettlementVenueRules = ({
|
|
|
5300
5299
|
if (!venueRules.includes(content2)) venueRules.push(content2);
|
|
5301
5300
|
rulesByVenue.set(venue2, venueRules);
|
|
5302
5301
|
}
|
|
5302
|
+
if (rulesByVenue.size > 0) {
|
|
5303
|
+
for (const venue2 of settlementVenues != null ? settlementVenues : []) {
|
|
5304
|
+
const trimmedVenue = venue2.trim();
|
|
5305
|
+
if (trimmedVenue && !rulesByVenue.has(trimmedVenue)) rulesByVenue.set(trimmedVenue, []);
|
|
5306
|
+
}
|
|
5307
|
+
}
|
|
5303
5308
|
return Array.from(rulesByVenue, ([venue2, contents]) => ({
|
|
5304
5309
|
venue: venue2,
|
|
5305
5310
|
content: contents.join("\n\n")
|
|
@@ -5309,6 +5314,11 @@ var buildSettlementVenueRules = ({
|
|
|
5309
5314
|
const venue = (_b = settlementVenues == null ? void 0 : settlementVenues.find((candidate) => candidate.trim().length > 0)) == null ? void 0 : _b.trim();
|
|
5310
5315
|
return content && venue ? [{ venue, content }] : [];
|
|
5311
5316
|
};
|
|
5317
|
+
var repeatsQuestion = (content, question) => {
|
|
5318
|
+
const normalizedQuestion = normalizeSettlementForCompare(question != null ? question : "");
|
|
5319
|
+
if (!normalizedQuestion) return false;
|
|
5320
|
+
return normalizeSettlementForCompare(content) === normalizedQuestion;
|
|
5321
|
+
};
|
|
5312
5322
|
var isDuplicatedByVenueRules = (content, venueRules) => {
|
|
5313
5323
|
const normalizedContent = normalizeSettlementForCompare(content);
|
|
5314
5324
|
if (!normalizedContent) return false;
|
|
@@ -5325,8 +5335,8 @@ var SettlementVenueRules = ({
|
|
|
5325
5335
|
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.trading.settlementFullRulesTitle }),
|
|
5326
5336
|
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { className: "flex w-full flex-col items-start gap-4", children: rules.map((rule) => {
|
|
5327
5337
|
const venueLabel = resolveSettlementVenueLabel(rule.venue, labels);
|
|
5328
|
-
return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("details", { className: "
|
|
5329
|
-
/* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("summary", { className: "flex cursor-pointer list-none items-center gap-2 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground
|
|
5338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("details", { className: "w-full", children: [
|
|
5339
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("summary", { className: "group/agg-settlement-rule flex w-fit cursor-pointer list-none items-center gap-2 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground transition-colors marker:hidden", children: [
|
|
5330
5340
|
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
5331
5341
|
VenueLogo,
|
|
5332
5342
|
{
|
|
@@ -5350,7 +5360,7 @@ var SettlementVenueRules = ({
|
|
|
5350
5360
|
}
|
|
5351
5361
|
)
|
|
5352
5362
|
] }),
|
|
5353
|
-
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { className: "mt-3 pl-6", children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(SettlementTextRenderer, { content: rule.content }) })
|
|
5363
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { className: "mt-3 pl-6", children: rule.content ? /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(SettlementTextRenderer, { content: rule.content }) : /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("p", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-muted-foreground", children: labels.trading.settlementValueUnavailable }) })
|
|
5354
5364
|
] }, rule.venue);
|
|
5355
5365
|
}) })
|
|
5356
5366
|
] });
|
|
@@ -5378,9 +5388,10 @@ var Settlement = ({
|
|
|
5378
5388
|
}),
|
|
5379
5389
|
[eventDescription, marketDescription, primaryRules]
|
|
5380
5390
|
);
|
|
5391
|
+
const isSingleVenueCluster = settlementVenues !== void 0 && settlementVenues.length < 2;
|
|
5381
5392
|
const settlementDifferences = (0, import_react4.useMemo)(
|
|
5382
|
-
() => prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences),
|
|
5383
|
-
[settlementDiff == null ? void 0 : settlementDiff.differences]
|
|
5393
|
+
() => isSingleVenueCluster ? [] : prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences),
|
|
5394
|
+
[isSingleVenueCluster, settlementDiff == null ? void 0 : settlementDiff.differences]
|
|
5384
5395
|
);
|
|
5385
5396
|
const eventBlock = (_a = blocks.find((block) => block.key === "eventDescription")) != null ? _a : null;
|
|
5386
5397
|
const marketBlock = (_b = blocks.find((block) => block.key === "marketDescription")) != null ? _b : null;
|
|
@@ -5396,7 +5407,7 @@ var Settlement = ({
|
|
|
5396
5407
|
);
|
|
5397
5408
|
const hasSettlementDifferences = settlementDifferences.length > 0;
|
|
5398
5409
|
const hasVenueSettlementRules = venueRuleBlocks.length > 0;
|
|
5399
|
-
const standaloneEventBlock = eventBlock && !isDuplicatedByVenueRules(eventBlock.content, venueRuleBlocks) ? eventBlock : null;
|
|
5410
|
+
const standaloneEventBlock = eventBlock && !isDuplicatedByVenueRules(eventBlock.content, venueRuleBlocks) && !repeatsQuestion(eventBlock.content, question) ? eventBlock : null;
|
|
5400
5411
|
const standaloneMarketBlock = hasVenueSettlementRules ? null : marketBlock;
|
|
5401
5412
|
const standalonePrimaryRulesBlock = hasVenueSettlementRules ? null : primaryRulesBlock;
|
|
5402
5413
|
const hasStandaloneSettlementText = hasVenueSettlementRules ? standaloneEventBlock !== null : blocks.length > 0;
|
|
@@ -5742,12 +5753,12 @@ SettlementDetails.displayName = "SettlementDetails";
|
|
|
5742
5753
|
// src/trading/place-order/index.tsx
|
|
5743
5754
|
var import_hooks41 = require("@agg-build/hooks");
|
|
5744
5755
|
var import_sdk19 = require("@agg-build/sdk");
|
|
5745
|
-
var
|
|
5756
|
+
var import_react17 = __toESM(require("@number-flow/react"));
|
|
5746
5757
|
var Popover = __toESM(require("@radix-ui/react-popover"));
|
|
5747
5758
|
var import_dayjs5 = __toESM(require("dayjs"));
|
|
5748
5759
|
var import_timezone2 = __toESM(require("dayjs/plugin/timezone"));
|
|
5749
5760
|
var import_utc2 = __toESM(require("dayjs/plugin/utc"));
|
|
5750
|
-
var
|
|
5761
|
+
var import_react18 = require("react");
|
|
5751
5762
|
|
|
5752
5763
|
// src/events/market-details/market-details.utils.ts
|
|
5753
5764
|
var import_sdk14 = require("@agg-build/sdk");
|
|
@@ -6228,7 +6239,8 @@ var ModalContainer = ({
|
|
|
6228
6239
|
maxWidth = "600px",
|
|
6229
6240
|
classNames,
|
|
6230
6241
|
"aria-label": ariaLabel,
|
|
6231
|
-
"aria-labelledby": ariaLabelledBy
|
|
6242
|
+
"aria-labelledby": ariaLabelledBy,
|
|
6243
|
+
onOpenAutoFocus
|
|
6232
6244
|
}) => {
|
|
6233
6245
|
const {
|
|
6234
6246
|
general: { rootClassName },
|
|
@@ -6259,6 +6271,7 @@ var ModalContainer = ({
|
|
|
6259
6271
|
),
|
|
6260
6272
|
"aria-label": ariaLabel,
|
|
6261
6273
|
"aria-labelledby": ariaLabelledBy,
|
|
6274
|
+
onOpenAutoFocus,
|
|
6262
6275
|
onCloseAutoFocus: (event) => {
|
|
6263
6276
|
event.preventDefault();
|
|
6264
6277
|
},
|
|
@@ -8251,6 +8264,27 @@ var getSafeConnectionError = ({
|
|
|
8251
8264
|
error.message
|
|
8252
8265
|
).trim();
|
|
8253
8266
|
};
|
|
8267
|
+
var CloseButton = ({
|
|
8268
|
+
className,
|
|
8269
|
+
disabled
|
|
8270
|
+
}) => {
|
|
8271
|
+
const labels = (0, import_hooks38.useLabels)();
|
|
8272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
8273
|
+
Dialog4.Close,
|
|
8274
|
+
{
|
|
8275
|
+
"aria-label": labels.common.close,
|
|
8276
|
+
disabled,
|
|
8277
|
+
className: cn(
|
|
8278
|
+
"z-30 flex size-6 cursor-pointer items-center justify-center rounded-agg-full",
|
|
8279
|
+
"text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
8280
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-accent",
|
|
8281
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
8282
|
+
className
|
|
8283
|
+
),
|
|
8284
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Icon, { name: "close", size: "medium", className: "!text-agg-foreground" })
|
|
8285
|
+
}
|
|
8286
|
+
);
|
|
8287
|
+
};
|
|
8254
8288
|
var ConnectKalshiModal = ({
|
|
8255
8289
|
open,
|
|
8256
8290
|
onOpenChange,
|
|
@@ -8281,12 +8315,12 @@ var ConnectKalshiModal = ({
|
|
|
8281
8315
|
setError(void 0);
|
|
8282
8316
|
setIsVerifying(false);
|
|
8283
8317
|
setIsConnected(false);
|
|
8284
|
-
const animationFrame = window.requestAnimationFrame(() => {
|
|
8285
|
-
var _a;
|
|
8286
|
-
return (_a = apiKeyInputRef.current) == null ? void 0 : _a.focus();
|
|
8287
|
-
});
|
|
8288
|
-
return () => window.cancelAnimationFrame(animationFrame);
|
|
8289
8318
|
}, [open]);
|
|
8319
|
+
const handleOpenAutoFocus = (0, import_react14.useCallback)((event) => {
|
|
8320
|
+
var _a;
|
|
8321
|
+
event.preventDefault();
|
|
8322
|
+
(_a = apiKeyInputRef.current) == null ? void 0 : _a.focus({ preventScroll: true });
|
|
8323
|
+
}, []);
|
|
8290
8324
|
const handleOpenChange = (0, import_react14.useCallback)(
|
|
8291
8325
|
(nextOpen) => {
|
|
8292
8326
|
if (isVerifying && !nextOpen) return;
|
|
@@ -8329,207 +8363,211 @@ var ConnectKalshiModal = ({
|
|
|
8329
8363
|
[handleVerify]
|
|
8330
8364
|
);
|
|
8331
8365
|
if (availabilityState === "hidden") return null;
|
|
8332
|
-
return /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime139.
|
|
8366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
8333
8367
|
Modal.Container,
|
|
8334
8368
|
{
|
|
8335
|
-
maxWidth: "600px",
|
|
8369
|
+
maxWidth: isConnected ? "480px" : "600px",
|
|
8336
8370
|
"aria-label": labels.onboarding.connectKalshiModal.ariaLabel,
|
|
8337
|
-
classNames: {
|
|
8338
|
-
|
|
8339
|
-
|
|
8340
|
-
|
|
8341
|
-
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
disabled: isVerifying,
|
|
8345
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Icon, { name: "close", size: "medium" })
|
|
8346
|
-
}
|
|
8347
|
-
) }),
|
|
8348
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Modal.Body, { classNames: { root: "!px-5 !pb-12 !pt-0 sm:!px-10" }, children: isConnected ? /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(
|
|
8371
|
+
classNames: {
|
|
8372
|
+
container: "!rounded-t-agg-xl !rounded-b-none md:!rounded-agg-2xl"
|
|
8373
|
+
},
|
|
8374
|
+
onOpenAutoFocus: isConnected ? void 0 : handleOpenAutoFocus,
|
|
8375
|
+
children: isConnected ? /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(Modal.Body, { classNames: { root: "relative !px-5 !py-8 md:!px-10 md:!py-12" }, children: [
|
|
8376
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(CloseButton, { className: "absolute right-5 top-5 md:right-8 md:top-8" }),
|
|
8377
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(
|
|
8349
8378
|
"div",
|
|
8350
8379
|
{
|
|
8351
|
-
className: "flex flex-col items-center gap-8
|
|
8380
|
+
className: "flex flex-col items-center gap-8 text-center",
|
|
8352
8381
|
role: "status",
|
|
8353
8382
|
"aria-live": "polite",
|
|
8354
8383
|
children: [
|
|
8355
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("div", { className: "flex size-[60px] items-center justify-center rounded-agg-full bg-agg-success", children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
8356
|
-
|
|
8357
|
-
{
|
|
8358
|
-
name: "success-check",
|
|
8359
|
-
className: "size-7 text-agg-on-primary",
|
|
8360
|
-
"aria-hidden": "true"
|
|
8361
|
-
}
|
|
8362
|
-
) }),
|
|
8363
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { className: "flex flex-col items-center gap-4", children: [
|
|
8384
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("div", { className: "flex size-[60px] items-center justify-center rounded-agg-full bg-agg-success/15", children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Icon, { name: "success-check", className: "size-6 text-agg-success", "aria-hidden": "true" }) }),
|
|
8385
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { className: "flex flex-col items-center gap-3", children: [
|
|
8364
8386
|
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Dialog4.Title, { className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground", children: labels.onboarding.connectKalshiModal.success.title }),
|
|
8365
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Dialog4.Description, { className: "
|
|
8387
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Dialog4.Description, { className: "text-agg-base leading-agg-6 text-agg-foreground", children: labels.onboarding.connectKalshiModal.success.description })
|
|
8366
8388
|
] }),
|
|
8367
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
8368
|
-
Button,
|
|
8369
|
-
{
|
|
8370
|
-
variant: "primary",
|
|
8371
|
-
size: "large",
|
|
8372
|
-
className: "min-w-[120px]",
|
|
8373
|
-
onClick: () => handleOpenChange(false),
|
|
8374
|
-
children: labels.onboarding.connectKalshiModal.success.done
|
|
8375
|
-
}
|
|
8376
|
-
)
|
|
8389
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Button, { variant: "secondary", size: "large", onClick: () => handleOpenChange(false), children: labels.onboarding.connectKalshiModal.success.done })
|
|
8377
8390
|
]
|
|
8378
8391
|
}
|
|
8379
|
-
)
|
|
8380
|
-
|
|
8381
|
-
|
|
8382
|
-
|
|
8383
|
-
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
|
|
8387
|
-
|
|
8388
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepOne.label }),
|
|
8389
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepOne.title })
|
|
8390
|
-
] }),
|
|
8391
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
8392
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.signIn }),
|
|
8393
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("p", { children: [
|
|
8394
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfilePrefix,
|
|
8395
|
-
" ",
|
|
8396
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileText }),
|
|
8397
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfileSeparator,
|
|
8398
|
-
" ",
|
|
8392
|
+
)
|
|
8393
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("form", { className: "flex min-h-0 flex-1 flex-col", onSubmit: handleSubmit, children: [
|
|
8394
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
8395
|
+
Modal.Body,
|
|
8396
|
+
{
|
|
8397
|
+
classNames: { root: "relative !px-5 !pb-6 !pt-5 md:!px-10 md:!pb-0 md:!pt-12" },
|
|
8398
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { className: "flex flex-col gap-6 md:items-center md:gap-0", children: [
|
|
8399
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { className: "flex w-full flex-col md:contents", children: [
|
|
8400
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { className: "flex items-center gap-3 md:contents", children: [
|
|
8399
8401
|
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
8400
|
-
|
|
8402
|
+
VenueLogo,
|
|
8401
8403
|
{
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
className: "
|
|
8406
|
-
|
|
8404
|
+
venue: import_sdk17.Venue.kalshi,
|
|
8405
|
+
variant: "logo",
|
|
8406
|
+
size: "large",
|
|
8407
|
+
className: "!size-10 md:!mb-8 md:!size-[60px]"
|
|
8408
|
+
}
|
|
8409
|
+
),
|
|
8410
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Dialog4.Title, { className: "text-agg-lg font-agg-bold leading-agg-7 text-agg-foreground md:mb-4 md:text-center md:text-agg-2xl md:leading-agg-8", children: labels.onboarding.connectKalshiModal.title }),
|
|
8411
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
8412
|
+
CloseButton,
|
|
8413
|
+
{
|
|
8414
|
+
disabled: isVerifying,
|
|
8415
|
+
className: "ml-auto shrink-0 md:absolute md:right-8 md:top-8 md:ml-0"
|
|
8407
8416
|
}
|
|
8408
8417
|
)
|
|
8409
8418
|
] }),
|
|
8410
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.
|
|
8411
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeyPrefix,
|
|
8412
|
-
" ",
|
|
8413
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKeyText }),
|
|
8414
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeySuffix
|
|
8415
|
-
] }),
|
|
8416
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("p", { children: [
|
|
8417
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsPrefix,
|
|
8418
|
-
" ",
|
|
8419
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.readWriteText }),
|
|
8420
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsSuffix
|
|
8421
|
-
] }),
|
|
8422
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKey })
|
|
8419
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Dialog4.Description, { className: "mt-3 text-agg-sm leading-agg-5 text-agg-foreground md:mb-8 md:mt-0 md:text-center md:text-agg-base md:leading-agg-6", children: labels.onboarding.connectKalshiModal.description })
|
|
8423
8420
|
] }),
|
|
8424
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("
|
|
8425
|
-
|
|
8426
|
-
|
|
8427
|
-
|
|
8428
|
-
|
|
8429
|
-
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
|
|
8435
|
-
|
|
8436
|
-
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
|
|
8459
|
-
|
|
8460
|
-
|
|
8461
|
-
|
|
8462
|
-
|
|
8421
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { className: "flex w-full flex-col gap-4", children: [
|
|
8422
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-xl bg-agg-secondary-hover p-4", children: [
|
|
8423
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
8424
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepOne.label }),
|
|
8425
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepOne.title })
|
|
8426
|
+
] }),
|
|
8427
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
8428
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.signIn }),
|
|
8429
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("p", { children: [
|
|
8430
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfilePrefix,
|
|
8431
|
+
" ",
|
|
8432
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileText }),
|
|
8433
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfileSeparator,
|
|
8434
|
+
" ",
|
|
8435
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
8436
|
+
"a",
|
|
8437
|
+
{
|
|
8438
|
+
href: labels.onboarding.connectKalshiModal.stepOne.instructions.profileUrl,
|
|
8439
|
+
target: "_blank",
|
|
8440
|
+
rel: "noreferrer",
|
|
8441
|
+
className: "cursor-pointer underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
|
|
8442
|
+
children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileUrl
|
|
8443
|
+
}
|
|
8444
|
+
)
|
|
8445
|
+
] }),
|
|
8446
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("p", { children: [
|
|
8447
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeyPrefix,
|
|
8448
|
+
" ",
|
|
8449
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKeyText }),
|
|
8450
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeySuffix
|
|
8451
|
+
] }),
|
|
8452
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("p", { children: [
|
|
8453
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsPrefix,
|
|
8454
|
+
" ",
|
|
8455
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.readWriteText }),
|
|
8456
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsSuffix
|
|
8457
|
+
] }),
|
|
8458
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKey })
|
|
8459
|
+
] }),
|
|
8460
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
8461
|
+
labels.onboarding.connectKalshiModal.stepOne.footerLineOne,
|
|
8462
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("br", {}),
|
|
8463
|
+
labels.onboarding.connectKalshiModal.stepOne.footerLineTwo
|
|
8464
|
+
] })
|
|
8465
|
+
] }),
|
|
8466
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-xl bg-agg-secondary-hover p-4", children: [
|
|
8467
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
8468
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.label }),
|
|
8469
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.title })
|
|
8470
|
+
] }),
|
|
8471
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.description }),
|
|
8472
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
8473
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
8474
|
+
"label",
|
|
8475
|
+
{
|
|
8476
|
+
htmlFor: "kalshi-api-key-id",
|
|
8477
|
+
className: "text-agg-sm font-agg-bold text-agg-foreground",
|
|
8478
|
+
children: labels.onboarding.connectKalshiModal.stepTwo.apiKeyIdLabel
|
|
8479
|
+
}
|
|
8480
|
+
),
|
|
8481
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
8482
|
+
"input",
|
|
8483
|
+
{
|
|
8484
|
+
ref: apiKeyInputRef,
|
|
8485
|
+
id: "kalshi-api-key-id",
|
|
8486
|
+
type: "text",
|
|
8487
|
+
autoComplete: "off",
|
|
8488
|
+
value: apiKeyId,
|
|
8489
|
+
onChange: (event) => setApiKeyId(event.target.value),
|
|
8490
|
+
placeholder: labels.onboarding.connectKalshiModal.stepTwo.apiKeyIdPlaceholder,
|
|
8491
|
+
disabled: isVerifying,
|
|
8492
|
+
"aria-invalid": !!error,
|
|
8493
|
+
"aria-describedby": error ? errorId : void 0,
|
|
8494
|
+
className: cn(
|
|
8495
|
+
"h-10 w-full rounded-agg-sm border border-agg-separator bg-agg-secondary px-3 py-2.5",
|
|
8496
|
+
"text-agg-base text-agg-foreground placeholder:text-agg-muted-foreground",
|
|
8497
|
+
"outline-none transition-colors focus:border-agg-primary focus:ring-1 focus:ring-agg-primary",
|
|
8498
|
+
"disabled:cursor-not-allowed disabled:opacity-60"
|
|
8499
|
+
)
|
|
8500
|
+
}
|
|
8463
8501
|
)
|
|
8464
|
-
}
|
|
8465
|
-
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8502
|
+
] }),
|
|
8503
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
8504
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
8505
|
+
"label",
|
|
8506
|
+
{
|
|
8507
|
+
htmlFor: "kalshi-private-key",
|
|
8508
|
+
className: "text-agg-sm font-agg-bold text-agg-foreground",
|
|
8509
|
+
children: labels.onboarding.connectKalshiModal.stepTwo.privateKeyLabel
|
|
8510
|
+
}
|
|
8511
|
+
),
|
|
8512
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
8513
|
+
"textarea",
|
|
8514
|
+
{
|
|
8515
|
+
id: "kalshi-private-key",
|
|
8516
|
+
autoComplete: "off",
|
|
8517
|
+
value: privateKey,
|
|
8518
|
+
onChange: (event) => setPrivateKey(event.target.value),
|
|
8519
|
+
placeholder: labels.onboarding.connectKalshiModal.stepTwo.privateKeyPlaceholder,
|
|
8520
|
+
rows: 3,
|
|
8521
|
+
disabled: isVerifying,
|
|
8522
|
+
"aria-invalid": !!error,
|
|
8523
|
+
"aria-describedby": error ? errorId : void 0,
|
|
8524
|
+
className: cn(
|
|
8525
|
+
"w-full resize-none rounded-agg-sm border border-agg-separator bg-agg-secondary px-3 py-2.5",
|
|
8526
|
+
"text-agg-base text-agg-foreground placeholder:text-agg-muted-foreground",
|
|
8527
|
+
"outline-none transition-colors focus:border-agg-primary focus:ring-1 focus:ring-agg-primary",
|
|
8528
|
+
"disabled:cursor-not-allowed disabled:opacity-60"
|
|
8529
|
+
)
|
|
8530
|
+
}
|
|
8493
8531
|
)
|
|
8494
|
-
}
|
|
8495
|
-
)
|
|
8496
|
-
] })
|
|
8497
|
-
] })
|
|
8498
|
-
] }),
|
|
8499
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { className: "flex w-full items-center justify-between gap-4", children: [
|
|
8500
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("p", { className: "text-agg-base text-agg-foreground", children: labels.onboarding.connectKalshiModal.help.label }),
|
|
8501
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
8502
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("span", { className: "flex items-center gap-2 text-agg-base font-agg-bold text-agg-primary", children: [
|
|
8503
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Icon, { name: "document", size: "small", className: "size-4 text-agg-primary" }),
|
|
8504
|
-
labels.onboarding.connectKalshiModal.help.docsLinkLabel
|
|
8532
|
+
] })
|
|
8533
|
+
] })
|
|
8505
8534
|
] }),
|
|
8506
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8535
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(
|
|
8536
|
+
"div",
|
|
8537
|
+
{
|
|
8538
|
+
id: errorId,
|
|
8539
|
+
className: "flex items-center gap-2 md:justify-center",
|
|
8540
|
+
role: "alert",
|
|
8541
|
+
"aria-live": "assertive",
|
|
8542
|
+
children: [
|
|
8543
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Icon, { name: "warning", size: "small", className: "size-3.5 text-agg-error" }),
|
|
8544
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
|
|
8545
|
+
]
|
|
8546
|
+
}
|
|
8547
|
+
) : null
|
|
8511
8548
|
] })
|
|
8512
|
-
|
|
8513
|
-
|
|
8514
|
-
|
|
8515
|
-
|
|
8516
|
-
|
|
8517
|
-
|
|
8518
|
-
|
|
8519
|
-
|
|
8520
|
-
|
|
8521
|
-
|
|
8522
|
-
|
|
8523
|
-
|
|
8524
|
-
|
|
8525
|
-
|
|
8526
|
-
|
|
8527
|
-
|
|
8549
|
+
}
|
|
8550
|
+
),
|
|
8551
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(
|
|
8552
|
+
Modal.Footer,
|
|
8553
|
+
{
|
|
8554
|
+
classNames: {
|
|
8555
|
+
root: "relative !h-auto !gap-3 !p-4 md:!justify-center md:!border-0 md:!px-10 md:!pb-12 md:!pt-8"
|
|
8556
|
+
},
|
|
8557
|
+
children: [
|
|
8558
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
8559
|
+
"div",
|
|
8560
|
+
{
|
|
8561
|
+
"aria-hidden": "true",
|
|
8562
|
+
className: "pointer-events-none absolute inset-x-0 -top-[60px] h-[60px] bg-gradient-to-b from-transparent to-agg-secondary md:hidden"
|
|
8563
|
+
}
|
|
8564
|
+
),
|
|
8528
8565
|
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
8529
8566
|
Button,
|
|
8530
8567
|
{
|
|
8531
8568
|
variant: "secondary",
|
|
8532
8569
|
size: "large",
|
|
8570
|
+
className: "shrink-0",
|
|
8533
8571
|
onClick: () => handleOpenChange(false),
|
|
8534
8572
|
disabled: isVerifying,
|
|
8535
8573
|
children: labels.onboarding.connectKalshiModal.actions.cancel
|
|
@@ -8541,15 +8579,16 @@ var ConnectKalshiModal = ({
|
|
|
8541
8579
|
type: "submit",
|
|
8542
8580
|
variant: "primary",
|
|
8543
8581
|
size: "large",
|
|
8582
|
+
className: "flex-1 md:flex-none",
|
|
8544
8583
|
disabled: !parsedCredentials.success || isVerifying,
|
|
8545
8584
|
isLoading: isVerifying,
|
|
8546
8585
|
children: labels.onboarding.connectKalshiModal.actions.verifyConnection
|
|
8547
8586
|
}
|
|
8548
8587
|
)
|
|
8549
|
-
]
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
]
|
|
8588
|
+
]
|
|
8589
|
+
}
|
|
8590
|
+
)
|
|
8591
|
+
] })
|
|
8553
8592
|
}
|
|
8554
8593
|
) });
|
|
8555
8594
|
};
|
|
@@ -9032,14 +9071,10 @@ var routePriceLabelFormatter = new Intl.NumberFormat("en-US", {
|
|
|
9032
9071
|
minimumFractionDigits: 0,
|
|
9033
9072
|
maximumFractionDigits: 1
|
|
9034
9073
|
});
|
|
9035
|
-
var PLACE_ORDER_PRICE_DISPLAY_MULTIPLIER = 1e3;
|
|
9036
9074
|
var GEO_BLOCK_WARNING_PREFIX = "Venue not available in your region";
|
|
9037
9075
|
var isFiniteNonNegativePrice = (value) => {
|
|
9038
9076
|
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
9039
9077
|
};
|
|
9040
|
-
var isPredictionMarketPrice = (value) => {
|
|
9041
|
-
return isFiniteNonNegativePrice(value) && value <= 1;
|
|
9042
|
-
};
|
|
9043
9078
|
var getPlaceOrderAverageExecutionPrice = (quoteData) => {
|
|
9044
9079
|
var _a;
|
|
9045
9080
|
if (!quoteData || quoteData.totalFilled <= 0) return null;
|
|
@@ -9050,22 +9085,6 @@ var getPlaceOrderAverageExecutionPrice = (quoteData) => {
|
|
|
9050
9085
|
const averageExecutionPrice = quoteData.rawExecCost / quoteData.totalFilled;
|
|
9051
9086
|
return isFiniteNonNegativePrice(averageExecutionPrice) ? averageExecutionPrice : null;
|
|
9052
9087
|
};
|
|
9053
|
-
var isPlaceOrderAveragePriceWorse = ({
|
|
9054
|
-
averageExecutionPrice,
|
|
9055
|
-
displayedMarketPrice,
|
|
9056
|
-
tradeSide
|
|
9057
|
-
}) => {
|
|
9058
|
-
if (!isPredictionMarketPrice(averageExecutionPrice) || !isPredictionMarketPrice(displayedMarketPrice)) {
|
|
9059
|
-
return false;
|
|
9060
|
-
}
|
|
9061
|
-
const displayedAveragePrice = Math.round(
|
|
9062
|
-
averageExecutionPrice * PLACE_ORDER_PRICE_DISPLAY_MULTIPLIER
|
|
9063
|
-
);
|
|
9064
|
-
const displayedReferencePrice = Math.round(
|
|
9065
|
-
displayedMarketPrice * PLACE_ORDER_PRICE_DISPLAY_MULTIPLIER
|
|
9066
|
-
);
|
|
9067
|
-
return tradeSide === "buy" ? displayedAveragePrice > displayedReferencePrice : displayedAveragePrice < displayedReferencePrice;
|
|
9068
|
-
};
|
|
9069
9088
|
var floorToDecimals = (value, decimals) => {
|
|
9070
9089
|
if (!Number.isFinite(value) || value <= 0) return 0;
|
|
9071
9090
|
const [coefficient = "0", exponentText = "0"] = value.toString().toLowerCase().split("e");
|
|
@@ -9676,16 +9695,21 @@ var buildLiveRouteCards = ({
|
|
|
9676
9695
|
})() : [];
|
|
9677
9696
|
return [...baseCards, ...unavailableCards, ...warningOnlyUnavailableCards];
|
|
9678
9697
|
};
|
|
9679
|
-
var
|
|
9680
|
-
|
|
9698
|
+
var routeCardRequiresKalshi = (card) => card.venue === "kalshi" || card.quoteData.fills.some((fill) => fill.venue === "kalshi");
|
|
9699
|
+
var resolveDefaultRouteCardId = (routeCards, primaryStatus, options) => {
|
|
9700
|
+
var _a, _b, _c, _d, _e, _f;
|
|
9681
9701
|
if (routeCards.length === 0) return null;
|
|
9682
|
-
const
|
|
9683
|
-
|
|
9684
|
-
|
|
9702
|
+
const isExecutableCard = (card) => !card.isUnavailable && card.quoteData.status === "ok" && !!card.quoteData.quoteId;
|
|
9703
|
+
if (options == null ? void 0 : options.isKalshiDisconnected) {
|
|
9704
|
+
const nonKalshiCards = routeCards.filter((card) => !routeCardRequiresKalshi(card));
|
|
9705
|
+
const preferredCard = (_a = nonKalshiCards.find(isExecutableCard)) != null ? _a : nonKalshiCards.find((card) => !card.isUnavailable);
|
|
9706
|
+
if (preferredCard) return preferredCard.id;
|
|
9707
|
+
}
|
|
9708
|
+
const firstExecutableCard = routeCards.find(isExecutableCard);
|
|
9685
9709
|
if (primaryStatus === "insufficient_balance") {
|
|
9686
9710
|
if (firstExecutableCard) return firstExecutableCard.id;
|
|
9687
9711
|
}
|
|
9688
|
-
return (
|
|
9712
|
+
return (_f = (_e = (_c = firstExecutableCard == null ? void 0 : firstExecutableCard.id) != null ? _c : (_b = routeCards.find((card) => !card.isUnavailable)) == null ? void 0 : _b.id) != null ? _e : (_d = routeCards[0]) == null ? void 0 : _d.id) != null ? _f : null;
|
|
9689
9713
|
};
|
|
9690
9714
|
var getPlaceOrderRouteCardIdentity = (card) => {
|
|
9691
9715
|
var _a;
|
|
@@ -10891,9 +10915,9 @@ var deriveBackendExecutionOrderGroups = ({
|
|
|
10891
10915
|
return [__spreadProps(__spreadValues({ id: order.orderId }, presentation), { steps })];
|
|
10892
10916
|
});
|
|
10893
10917
|
const allOrdersTerminal = executionOrders.every((order) => order.event !== null);
|
|
10894
|
-
return deriveSequentialDisplayGroups(realGroups, allOrdersTerminal);
|
|
10918
|
+
return deriveSequentialDisplayGroups(realGroups, allOrdersTerminal, "per-leg");
|
|
10895
10919
|
};
|
|
10896
|
-
var deriveSequentialDisplayGroups = (groups, revealTerminalOutcomes = false) => {
|
|
10920
|
+
var deriveSequentialDisplayGroups = (groups, revealTerminalOutcomes = false, scope = "global") => {
|
|
10897
10921
|
if (revealTerminalOutcomes) {
|
|
10898
10922
|
return groups.map((group) => __spreadProps(__spreadValues({}, group), {
|
|
10899
10923
|
steps: group.steps.map((_a) => {
|
|
@@ -10903,19 +10927,22 @@ var deriveSequentialDisplayGroups = (groups, revealTerminalOutcomes = false) =>
|
|
|
10903
10927
|
}));
|
|
10904
10928
|
}
|
|
10905
10929
|
let hasUnresolvedPredecessor = false;
|
|
10906
|
-
return groups.map((group) =>
|
|
10907
|
-
|
|
10908
|
-
|
|
10909
|
-
|
|
10910
|
-
|
|
10911
|
-
|
|
10912
|
-
|
|
10913
|
-
|
|
10914
|
-
|
|
10915
|
-
|
|
10916
|
-
|
|
10917
|
-
|
|
10918
|
-
|
|
10930
|
+
return groups.map((group) => {
|
|
10931
|
+
if (scope === "per-leg") hasUnresolvedPredecessor = false;
|
|
10932
|
+
return __spreadProps(__spreadValues({}, group), {
|
|
10933
|
+
steps: group.steps.map((_a) => {
|
|
10934
|
+
var _b = _a, { realStatus } = _b, step = __objRest(_b, ["realStatus"]);
|
|
10935
|
+
if (hasUnresolvedPredecessor) {
|
|
10936
|
+
return __spreadProps(__spreadValues({}, step), { status: "not-started" });
|
|
10937
|
+
}
|
|
10938
|
+
if (realStatus === "done") {
|
|
10939
|
+
return __spreadProps(__spreadValues({}, step), { status: "done" });
|
|
10940
|
+
}
|
|
10941
|
+
hasUnresolvedPredecessor = true;
|
|
10942
|
+
return __spreadProps(__spreadValues({}, step), { status: realStatus });
|
|
10943
|
+
})
|
|
10944
|
+
});
|
|
10945
|
+
});
|
|
10919
10946
|
};
|
|
10920
10947
|
var deriveExecutionOrderGroups = ({
|
|
10921
10948
|
quoteData,
|
|
@@ -11136,6 +11163,7 @@ var calculateExecutionProgress = ({
|
|
|
11136
11163
|
};
|
|
11137
11164
|
|
|
11138
11165
|
// src/trading/place-order/index.place-order.execution-view.tsx
|
|
11166
|
+
var import_react16 = require("react");
|
|
11139
11167
|
var import_jsx_runtime142 = require("react/jsx-runtime");
|
|
11140
11168
|
var PlaceOrderExecutionHeader = ({
|
|
11141
11169
|
className,
|
|
@@ -11158,6 +11186,85 @@ var PlaceOrderExecutionHeader = ({
|
|
|
11158
11186
|
eventDateLabel ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: eventDateLabel }) : null
|
|
11159
11187
|
] });
|
|
11160
11188
|
};
|
|
11189
|
+
var PROGRESS_TWEEN_MS = 700;
|
|
11190
|
+
var prefersReducedMotion = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
11191
|
+
var useTweenedProgress = (target, enabled) => {
|
|
11192
|
+
const [value, setValue] = (0, import_react16.useState)(target);
|
|
11193
|
+
const valueRef = (0, import_react16.useRef)(target);
|
|
11194
|
+
(0, import_react16.useEffect)(() => {
|
|
11195
|
+
const from = valueRef.current;
|
|
11196
|
+
if (!enabled || from === target || prefersReducedMotion()) {
|
|
11197
|
+
valueRef.current = target;
|
|
11198
|
+
setValue(target);
|
|
11199
|
+
return;
|
|
11200
|
+
}
|
|
11201
|
+
let frame = 0;
|
|
11202
|
+
const start = performance.now();
|
|
11203
|
+
const tick = (now) => {
|
|
11204
|
+
const t = Math.min(1, (now - start) / PROGRESS_TWEEN_MS);
|
|
11205
|
+
const eased = 1 - Math.pow(1 - t, 3);
|
|
11206
|
+
const next = Math.round(from + (target - from) * eased);
|
|
11207
|
+
valueRef.current = next;
|
|
11208
|
+
setValue(next);
|
|
11209
|
+
if (t < 1) frame = requestAnimationFrame(tick);
|
|
11210
|
+
};
|
|
11211
|
+
frame = requestAnimationFrame(tick);
|
|
11212
|
+
return () => cancelAnimationFrame(frame);
|
|
11213
|
+
}, [enabled, target]);
|
|
11214
|
+
return value;
|
|
11215
|
+
};
|
|
11216
|
+
var ExecutionProgressBar = ({
|
|
11217
|
+
enableAnimations,
|
|
11218
|
+
label: label2,
|
|
11219
|
+
progress
|
|
11220
|
+
}) => {
|
|
11221
|
+
const clamped = Math.max(0, Math.min(100, progress));
|
|
11222
|
+
const displayed = useTweenedProgress(clamped, enableAnimations);
|
|
11223
|
+
const isRunning = clamped < 100;
|
|
11224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
11225
|
+
/* @__PURE__ */ (0, import_jsx_runtime142.jsxs)("p", { className: "shrink-0 tabular-nums text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
|
|
11226
|
+
displayed,
|
|
11227
|
+
"%"
|
|
11228
|
+
] }),
|
|
11229
|
+
/* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
11230
|
+
"div",
|
|
11231
|
+
{
|
|
11232
|
+
role: "progressbar",
|
|
11233
|
+
"aria-label": label2,
|
|
11234
|
+
"aria-valuemin": 0,
|
|
11235
|
+
"aria-valuemax": 100,
|
|
11236
|
+
"aria-valuenow": clamped,
|
|
11237
|
+
className: "relative h-1 min-w-0 flex-1 overflow-hidden rounded-agg-full bg-agg-separator",
|
|
11238
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
11239
|
+
"div",
|
|
11240
|
+
{
|
|
11241
|
+
className: cn(
|
|
11242
|
+
"absolute inset-y-0 left-0 overflow-hidden rounded-agg-full bg-agg-primary",
|
|
11243
|
+
getMotionClassName(
|
|
11244
|
+
enableAnimations,
|
|
11245
|
+
"transition-[width] duration-700 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none"
|
|
11246
|
+
)
|
|
11247
|
+
),
|
|
11248
|
+
style: { width: `${clamped}%` },
|
|
11249
|
+
children: isRunning ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
11250
|
+
"span",
|
|
11251
|
+
{
|
|
11252
|
+
"aria-hidden": "true",
|
|
11253
|
+
className: cn(
|
|
11254
|
+
"absolute inset-0 hidden bg-gradient-to-r from-transparent via-white/40 to-transparent",
|
|
11255
|
+
getMotionClassName(
|
|
11256
|
+
enableAnimations,
|
|
11257
|
+
"motion-safe:block motion-safe:animate-agg-progress-shimmer"
|
|
11258
|
+
)
|
|
11259
|
+
)
|
|
11260
|
+
}
|
|
11261
|
+
) : null
|
|
11262
|
+
}
|
|
11263
|
+
)
|
|
11264
|
+
}
|
|
11265
|
+
)
|
|
11266
|
+
] });
|
|
11267
|
+
};
|
|
11161
11268
|
var ExecutionStepIndicator = ({
|
|
11162
11269
|
enableAnimations,
|
|
11163
11270
|
step
|
|
@@ -11293,21 +11400,14 @@ var PlaceOrderExecutionView = ({
|
|
|
11293
11400
|
}
|
|
11294
11401
|
),
|
|
11295
11402
|
/* @__PURE__ */ (0, import_jsx_runtime142.jsxs)("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.content), children: [
|
|
11296
|
-
/* @__PURE__ */ (0, import_jsx_runtime142.
|
|
11297
|
-
|
|
11298
|
-
|
|
11299
|
-
|
|
11300
|
-
|
|
11301
|
-
|
|
11302
|
-
|
|
11303
|
-
|
|
11304
|
-
"aria-label": labels.executingOrder,
|
|
11305
|
-
className: "h-1 min-w-0 flex-1 overflow-hidden rounded-agg-full bg-agg-separator text-agg-primary accent-agg-primary [&::-moz-progress-bar]:bg-agg-primary [&::-webkit-progress-bar]:bg-agg-separator [&::-webkit-progress-value]:bg-agg-primary",
|
|
11306
|
-
max: 100,
|
|
11307
|
-
value: progress
|
|
11308
|
-
}
|
|
11309
|
-
)
|
|
11310
|
-
] }),
|
|
11403
|
+
/* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
11404
|
+
ExecutionProgressBar,
|
|
11405
|
+
{
|
|
11406
|
+
enableAnimations,
|
|
11407
|
+
label: labels.executingOrder,
|
|
11408
|
+
progress
|
|
11409
|
+
}
|
|
11410
|
+
),
|
|
11311
11411
|
/* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
11312
11412
|
PlaceOrderExecutionGroups,
|
|
11313
11413
|
{
|
|
@@ -11555,7 +11655,7 @@ var PlaceOrderSuccessView = ({
|
|
|
11555
11655
|
/* @__PURE__ */ (0, import_jsx_runtime144.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
11556
11656
|
/* @__PURE__ */ (0, import_jsx_runtime144.jsxs)("div", { className: "flex min-w-0 flex-col gap-0.5", children: [
|
|
11557
11657
|
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.orderPayout }),
|
|
11558
|
-
potentialReturnLabel ? /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("span", { className: "
|
|
11658
|
+
potentialReturnLabel ? /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("span", { className: "agg-type-overline agg-text-brand", children: potentialReturnLabel }) : null
|
|
11559
11659
|
] }),
|
|
11560
11660
|
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-success", children: resolvedPayoutLabel })
|
|
11561
11661
|
] })
|
|
@@ -11697,24 +11797,24 @@ var PlaceOrderSlippageControl = ({
|
|
|
11697
11797
|
}) => {
|
|
11698
11798
|
var _a, _b;
|
|
11699
11799
|
const labels = (0, import_hooks41.useLabels)();
|
|
11700
|
-
const containerRef = (0,
|
|
11701
|
-
const triggerRef = (0,
|
|
11702
|
-
const inputRef = (0,
|
|
11703
|
-
const warningId = (0,
|
|
11800
|
+
const containerRef = (0, import_react18.useRef)(null);
|
|
11801
|
+
const triggerRef = (0, import_react18.useRef)(null);
|
|
11802
|
+
const inputRef = (0, import_react18.useRef)(null);
|
|
11803
|
+
const warningId = (0, import_react18.useId)();
|
|
11704
11804
|
const defaultValue = finalizePercentageValue(slippageDefaultValue);
|
|
11705
11805
|
const committedValue = finalizePercentageValue(slippageValue) || defaultValue;
|
|
11706
|
-
const [draftValue, setDraftValue] = (0,
|
|
11707
|
-
const [isEditing, setIsEditing] = (0,
|
|
11806
|
+
const [draftValue, setDraftValue] = (0, import_react18.useState)(committedValue);
|
|
11807
|
+
const [isEditing, setIsEditing] = (0, import_react18.useState)(
|
|
11708
11808
|
() => isPercentageBelowMinimum(committedValue, slippageMinimumValue)
|
|
11709
11809
|
);
|
|
11710
|
-
const [shouldFocusInput, setShouldFocusInput] = (0,
|
|
11711
|
-
(0,
|
|
11810
|
+
const [shouldFocusInput, setShouldFocusInput] = (0, import_react18.useState)(false);
|
|
11811
|
+
(0, import_react18.useEffect)(() => {
|
|
11712
11812
|
setDraftValue(committedValue);
|
|
11713
11813
|
if (isPercentageBelowMinimum(committedValue, slippageMinimumValue)) {
|
|
11714
11814
|
setIsEditing(true);
|
|
11715
11815
|
}
|
|
11716
11816
|
}, [committedValue, slippageMinimumValue]);
|
|
11717
|
-
(0,
|
|
11817
|
+
(0, import_react18.useEffect)(() => {
|
|
11718
11818
|
if (!shouldFocusInput) return;
|
|
11719
11819
|
requestAnimationFrame(() => {
|
|
11720
11820
|
var _a2, _b2;
|
|
@@ -11731,7 +11831,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
11731
11831
|
Number(committedValue || slippageDefaultValue || DEFAULT_SLIPPAGE_VALUE)
|
|
11732
11832
|
);
|
|
11733
11833
|
const resolvedAutoLabel = labels.trading.resetSlippage;
|
|
11734
|
-
const resolvedWarningMessage = (0,
|
|
11834
|
+
const resolvedWarningMessage = (0, import_react18.useMemo)(() => {
|
|
11735
11835
|
if (isLowSlippage) {
|
|
11736
11836
|
return labels.trading.slippageLow(slippageMinimumValue);
|
|
11737
11837
|
}
|
|
@@ -12138,13 +12238,15 @@ var renderRouteCard = ({
|
|
|
12138
12238
|
isExpanded,
|
|
12139
12239
|
isSelected,
|
|
12140
12240
|
onSelect,
|
|
12241
|
+
isKalshiDisconnected = false,
|
|
12141
12242
|
sharedKycStatus,
|
|
12142
12243
|
tradingLabels
|
|
12143
12244
|
}) => {
|
|
12144
12245
|
var _a, _b, _c;
|
|
12145
12246
|
const showSharedKycRequirement = card.requiresSharedKyc === true && sharedKycStatus !== void 0 && sharedKycStatus !== "verified" && !card.isUnavailable;
|
|
12247
|
+
const showKalshiRequirement = isKalshiDisconnected && card.kind === "venue" && card.venue === "kalshi" && !isSelected && !card.isUnavailable;
|
|
12146
12248
|
const showSplitDetails = isSelected && isExpanded && card.kind === "split" && !!((_a = card.rows) == null ? void 0 : _a.length);
|
|
12147
|
-
const displayedHint = showSharedKycRequirement ? tradingLabels.sharedKyc.required : card.hint;
|
|
12249
|
+
const displayedHint = showKalshiRequirement ? tradingLabels.requiresKalshiAccount : showSharedKycRequirement ? tradingLabels.sharedKyc.required : card.hint;
|
|
12148
12250
|
const ariaLabel = [card.label, displayedHint, card.value].filter(Boolean).join(" ");
|
|
12149
12251
|
return /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
12150
12252
|
"button",
|
|
@@ -12198,7 +12300,7 @@ var renderRouteCard = ({
|
|
|
12198
12300
|
className: "shrink-0 text-agg-muted-foreground",
|
|
12199
12301
|
"aria-hidden": "true"
|
|
12200
12302
|
}
|
|
12201
|
-
) : showSharedKycRequirement || card.insufficientInventory ? /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
12303
|
+
) : showKalshiRequirement || showSharedKycRequirement || card.insufficientInventory ? /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
12202
12304
|
Icon,
|
|
12203
12305
|
{
|
|
12204
12306
|
name: "warning",
|
|
@@ -12281,10 +12383,10 @@ var PlaceOrder = ({
|
|
|
12281
12383
|
const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
|
|
12282
12384
|
const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
|
|
12283
12385
|
const selectedOutcomeId = (_c = tradingContext == null ? void 0 : tradingContext.selectedOutcomeId) != null ? _c : null;
|
|
12284
|
-
const resolvedEventTradingState = (0,
|
|
12386
|
+
const resolvedEventTradingState = (0, import_react18.useMemo)(() => {
|
|
12285
12387
|
return eventTradingState != null ? eventTradingState : (0, import_hooks41.resolveEventTradingState)(selectedEvent);
|
|
12286
12388
|
}, [eventTradingState, selectedEvent]);
|
|
12287
|
-
const scopedSelectedEvent = (0,
|
|
12389
|
+
const scopedSelectedEvent = (0, import_react18.useMemo)(() => {
|
|
12288
12390
|
var _a2;
|
|
12289
12391
|
if (!selectedEvent) return null;
|
|
12290
12392
|
const primaryMarketId = (_a2 = resolvedEventTradingState.primaryMarket) == null ? void 0 : _a2.id;
|
|
@@ -12294,7 +12396,7 @@ var PlaceOrder = ({
|
|
|
12294
12396
|
);
|
|
12295
12397
|
return isSelectedEventInScope ? selectedEvent : null;
|
|
12296
12398
|
}, [(_d = resolvedEventTradingState.primaryMarket) == null ? void 0 : _d.id, selectedEvent]);
|
|
12297
|
-
const scopedSelectedMarket = (0,
|
|
12399
|
+
const scopedSelectedMarket = (0, import_react18.useMemo)(() => {
|
|
12298
12400
|
if (!selectedMarket) return resolvedEventTradingState.primaryMarket;
|
|
12299
12401
|
const isSelectedMarketInScope = resolvedEventTradingState.marketStates.some(
|
|
12300
12402
|
(item) => item.market.id === selectedMarket.id
|
|
@@ -12309,10 +12411,10 @@ var PlaceOrder = ({
|
|
|
12309
12411
|
(outcome) => outcome.label.trim().toLowerCase() === "yes"
|
|
12310
12412
|
)) != null ? _f : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes[0]) != null ? _g : null;
|
|
12311
12413
|
const scopedSelectedOutcomeId = (_h = scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.id) != null ? _h : null;
|
|
12312
|
-
const resolvedTradingState = (0,
|
|
12414
|
+
const resolvedTradingState = (0, import_react18.useMemo)(() => {
|
|
12313
12415
|
return (0, import_hooks41.resolveMarketTradingState)(scopedSelectedMarket);
|
|
12314
12416
|
}, [scopedSelectedMarket]);
|
|
12315
|
-
const resolvedReadOnlyMarket = (0,
|
|
12417
|
+
const resolvedReadOnlyMarket = (0, import_react18.useMemo)(() => {
|
|
12316
12418
|
var _a2;
|
|
12317
12419
|
if (resolvedEventTradingState.kind !== "resolved") {
|
|
12318
12420
|
return scopedSelectedMarket;
|
|
@@ -12323,11 +12425,11 @@ var PlaceOrder = ({
|
|
|
12323
12425
|
resolvedEventTradingState.primaryMarket,
|
|
12324
12426
|
scopedSelectedMarket
|
|
12325
12427
|
]);
|
|
12326
|
-
const resolvedReadOnlyTradingState = (0,
|
|
12428
|
+
const resolvedReadOnlyTradingState = (0, import_react18.useMemo)(() => {
|
|
12327
12429
|
return (0, import_hooks41.resolveMarketTradingState)(resolvedReadOnlyMarket);
|
|
12328
12430
|
}, [resolvedReadOnlyMarket]);
|
|
12329
12431
|
const isEndedWithoutKnownWinner = showResolvingState && !resolvedEventTradingState.winningOutcome && !resolvedReadOnlyTradingState.winningOutcome;
|
|
12330
|
-
const orderEligibility = (0,
|
|
12432
|
+
const orderEligibility = (0, import_react18.useMemo)(
|
|
12331
12433
|
() => (0, import_hooks41.resolveOrderEligibility)({
|
|
12332
12434
|
event: scopedSelectedEvent,
|
|
12333
12435
|
market: scopedSelectedMarket,
|
|
@@ -12350,7 +12452,7 @@ var PlaceOrder = ({
|
|
|
12350
12452
|
enabled: Boolean(isAuthenticated && isPaperMode),
|
|
12351
12453
|
mode: "paper"
|
|
12352
12454
|
});
|
|
12353
|
-
const paperTotalBalance = (0,
|
|
12455
|
+
const paperTotalBalance = (0, import_react18.useMemo)(() => {
|
|
12354
12456
|
var _a2, _b2;
|
|
12355
12457
|
const cash = (_b2 = (_a2 = paperBalancesQuery.balances) == null ? void 0 : _a2.cash) != null ? _b2 : [];
|
|
12356
12458
|
return cash.reduce((sum, token) => {
|
|
@@ -12375,8 +12477,8 @@ var PlaceOrder = ({
|
|
|
12375
12477
|
import_sdk19.Venue.kalshi,
|
|
12376
12478
|
isAuthenticated
|
|
12377
12479
|
);
|
|
12378
|
-
const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0,
|
|
12379
|
-
const [isFundKalshiModalOpen, setIsFundKalshiModalOpen] = (0,
|
|
12480
|
+
const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0, import_react18.useState)(false);
|
|
12481
|
+
const [isFundKalshiModalOpen, setIsFundKalshiModalOpen] = (0, import_react18.useState)(false);
|
|
12380
12482
|
const livePrices = (0, import_hooks41.useLiveOutcomePrices)(
|
|
12381
12483
|
scopedSelectedMarket ? [scopedSelectedMarket] : void 0
|
|
12382
12484
|
);
|
|
@@ -12388,41 +12490,41 @@ var PlaceOrder = ({
|
|
|
12388
12490
|
const clusterBestMidpointsByOutcomeId = (_j = clusterMidpointResult.bestMidpointsByOutcomeId) != null ? _j : clusterMidpointResult.prices;
|
|
12389
12491
|
const clusterBestMidpoint = clusterMidpointResult.bestMidpoint;
|
|
12390
12492
|
const clusterBestPricesRest = clusterMidpointResult.bestPrices;
|
|
12391
|
-
const clusterBestPrices = (0,
|
|
12493
|
+
const clusterBestPrices = (0, import_react18.useMemo)(
|
|
12392
12494
|
() => (0, import_hooks41.mergeBestPricesPreferringLive)(clusterBestPricesRest, wsBestPrices),
|
|
12393
12495
|
[clusterBestPricesRest, wsBestPrices]
|
|
12394
12496
|
);
|
|
12395
|
-
const [internalTab, setInternalTab] = (0,
|
|
12396
|
-
const [executionType, setExecutionType] = (0,
|
|
12397
|
-
const [selectedLimitVenue, setSelectedLimitVenue] = (0,
|
|
12398
|
-
const [limitPrice, setLimitPrice] = (0,
|
|
12399
|
-
const [limitPriceInputValue, setLimitPriceInputValue] = (0,
|
|
12400
|
-
const [limitPriceInputError, setLimitPriceInputError] = (0,
|
|
12401
|
-
const [limitExpirationType, setLimitExpirationType] = (0,
|
|
12402
|
-
const [limitExpirationDate, setLimitExpirationDate] = (0,
|
|
12403
|
-
const [limitExpirationTime, setLimitExpirationTime] = (0,
|
|
12404
|
-
const [limitExpirationDraftDate, setLimitExpirationDraftDate] = (0,
|
|
12405
|
-
const [limitExpirationDraftTime, setLimitExpirationDraftTime] = (0,
|
|
12406
|
-
const [limitExpirationPickerView, setLimitExpirationPickerView] = (0,
|
|
12407
|
-
const [isLimitExpirationPickerOpen, setIsLimitExpirationPickerOpen] = (0,
|
|
12408
|
-
const [internalAmount, setInternalAmount] = (0,
|
|
12409
|
-
const [sellFilledForOutcomeId, setSellFilledForOutcomeId] = (0,
|
|
12410
|
-
const [internalSlippage] = (0,
|
|
12411
|
-
const [isRoutesExpanded, setIsRoutesExpanded] = (0,
|
|
12412
|
-
const [selectedRouteCardId, setSelectedRouteCardId] = (0,
|
|
12413
|
-
const [manualRouteSelectionIdentity, setManualRouteSelectionIdentity] = (0,
|
|
12497
|
+
const [internalTab, setInternalTab] = (0, import_react18.useState)("buy");
|
|
12498
|
+
const [executionType, setExecutionType] = (0, import_react18.useState)("market");
|
|
12499
|
+
const [selectedLimitVenue, setSelectedLimitVenue] = (0, import_react18.useState)(null);
|
|
12500
|
+
const [limitPrice, setLimitPrice] = (0, import_react18.useState)(0.5);
|
|
12501
|
+
const [limitPriceInputValue, setLimitPriceInputValue] = (0, import_react18.useState)(formatLimitPriceInputValue(0.5));
|
|
12502
|
+
const [limitPriceInputError, setLimitPriceInputError] = (0, import_react18.useState)(null);
|
|
12503
|
+
const [limitExpirationType, setLimitExpirationType] = (0, import_react18.useState)("GTC");
|
|
12504
|
+
const [limitExpirationDate, setLimitExpirationDate] = (0, import_react18.useState)(void 0);
|
|
12505
|
+
const [limitExpirationTime, setLimitExpirationTime] = (0, import_react18.useState)("17:00");
|
|
12506
|
+
const [limitExpirationDraftDate, setLimitExpirationDraftDate] = (0, import_react18.useState)();
|
|
12507
|
+
const [limitExpirationDraftTime, setLimitExpirationDraftTime] = (0, import_react18.useState)("17:00");
|
|
12508
|
+
const [limitExpirationPickerView, setLimitExpirationPickerView] = (0, import_react18.useState)("options");
|
|
12509
|
+
const [isLimitExpirationPickerOpen, setIsLimitExpirationPickerOpen] = (0, import_react18.useState)(false);
|
|
12510
|
+
const [internalAmount, setInternalAmount] = (0, import_react18.useState)(PLACE_ORDER_DEFAULT_AMOUNT);
|
|
12511
|
+
const [sellFilledForOutcomeId, setSellFilledForOutcomeId] = (0, import_react18.useState)(null);
|
|
12512
|
+
const [internalSlippage] = (0, import_react18.useState)(DEFAULT_SLIPPAGE_VALUE);
|
|
12513
|
+
const [isRoutesExpanded, setIsRoutesExpanded] = (0, import_react18.useState)(false);
|
|
12514
|
+
const [selectedRouteCardId, setSelectedRouteCardId] = (0, import_react18.useState)(null);
|
|
12515
|
+
const [manualRouteSelectionIdentity, setManualRouteSelectionIdentity] = (0, import_react18.useState)(
|
|
12414
12516
|
null
|
|
12415
12517
|
);
|
|
12416
|
-
const [isSplitDetailOpen, setIsSplitDetailOpen] = (0,
|
|
12417
|
-
const [buyGeoBlockSnapshot, setBuyGeoBlockSnapshot] = (0,
|
|
12418
|
-
const [submissionFeedback, setSubmissionFeedback] = (0,
|
|
12419
|
-
const [submissionProgressState, setSubmissionProgressState] = (0,
|
|
12420
|
-
const [isBeforeActionPending, setIsBeforeActionPending] = (0,
|
|
12421
|
-
const outcomes = (0,
|
|
12518
|
+
const [isSplitDetailOpen, setIsSplitDetailOpen] = (0, import_react18.useState)(false);
|
|
12519
|
+
const [buyGeoBlockSnapshot, setBuyGeoBlockSnapshot] = (0, import_react18.useState)(null);
|
|
12520
|
+
const [submissionFeedback, setSubmissionFeedback] = (0, import_react18.useState)(null);
|
|
12521
|
+
const [submissionProgressState, setSubmissionProgressState] = (0, import_react18.useState)(null);
|
|
12522
|
+
const [isBeforeActionPending, setIsBeforeActionPending] = (0, import_react18.useState)(false);
|
|
12523
|
+
const outcomes = (0, import_react18.useMemo)(
|
|
12422
12524
|
() => mapVenueMarketOutcomesToPlaceOrderOutcomes(scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes),
|
|
12423
12525
|
[scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes]
|
|
12424
12526
|
);
|
|
12425
|
-
const selectedOutcomeDisplayPrice = (0,
|
|
12527
|
+
const selectedOutcomeDisplayPrice = (0, import_react18.useMemo)(() => {
|
|
12426
12528
|
var _a2;
|
|
12427
12529
|
if (!scopedSelectedOutcomeId || !scopedSelectedOutcome) return 0.5;
|
|
12428
12530
|
return getDisplayOutcomePrice({
|
|
@@ -12445,25 +12547,25 @@ var PlaceOrder = ({
|
|
|
12445
12547
|
scopedSelectedOutcomeId,
|
|
12446
12548
|
tradingContext == null ? void 0 : tradingContext.tradeSide
|
|
12447
12549
|
]);
|
|
12448
|
-
const buyTabRef = (0,
|
|
12449
|
-
const sellTabRef = (0,
|
|
12450
|
-
const expirationTriggerRef = (0,
|
|
12451
|
-
const limitPriceInitializedForOutcomeRef = (0,
|
|
12452
|
-
const expirationOptionRefs = (0,
|
|
12453
|
-
const shouldFocusExpirationOptionsRef = (0,
|
|
12454
|
-
const expirationTimeInputId = (0,
|
|
12455
|
-
const executionDebugStoreRef = (0,
|
|
12456
|
-
const executionDebugAttemptIdRef = (0,
|
|
12457
|
-
const submittedSelectionRef = (0,
|
|
12458
|
-
const lastValidRouteCardsRef = (0,
|
|
12459
|
-
(0,
|
|
12550
|
+
const buyTabRef = (0, import_react18.useRef)(null);
|
|
12551
|
+
const sellTabRef = (0, import_react18.useRef)(null);
|
|
12552
|
+
const expirationTriggerRef = (0, import_react18.useRef)(null);
|
|
12553
|
+
const limitPriceInitializedForOutcomeRef = (0, import_react18.useRef)(void 0);
|
|
12554
|
+
const expirationOptionRefs = (0, import_react18.useRef)([]);
|
|
12555
|
+
const shouldFocusExpirationOptionsRef = (0, import_react18.useRef)(false);
|
|
12556
|
+
const expirationTimeInputId = (0, import_react18.useId)();
|
|
12557
|
+
const executionDebugStoreRef = (0, import_react18.useRef)(null);
|
|
12558
|
+
const executionDebugAttemptIdRef = (0, import_react18.useRef)(null);
|
|
12559
|
+
const submittedSelectionRef = (0, import_react18.useRef)(null);
|
|
12560
|
+
const lastValidRouteCardsRef = (0, import_react18.useRef)(null);
|
|
12561
|
+
(0, import_react18.useEffect)(() => {
|
|
12460
12562
|
if (!isExecutionDebugEnabled) {
|
|
12461
12563
|
executionDebugStoreRef.current = null;
|
|
12462
12564
|
return;
|
|
12463
12565
|
}
|
|
12464
12566
|
executionDebugStoreRef.current = enableExecutionDebugInBrowser();
|
|
12465
12567
|
}, [isExecutionDebugEnabled]);
|
|
12466
|
-
(0,
|
|
12568
|
+
(0, import_react18.useEffect)(() => {
|
|
12467
12569
|
var _a2;
|
|
12468
12570
|
if (!isLimitExpirationPickerOpen) return;
|
|
12469
12571
|
if (limitExpirationPickerView !== "options") return;
|
|
@@ -12471,7 +12573,7 @@ var PlaceOrder = ({
|
|
|
12471
12573
|
(_a2 = expirationOptionRefs.current[LIMIT_EXPIRATION_OPTION_COUNT - 1]) == null ? void 0 : _a2.focus();
|
|
12472
12574
|
shouldFocusExpirationOptionsRef.current = false;
|
|
12473
12575
|
}, [isLimitExpirationPickerOpen, limitExpirationPickerView]);
|
|
12474
|
-
(0,
|
|
12576
|
+
(0, import_react18.useEffect)(() => {
|
|
12475
12577
|
if (!isExecutionDebugEnabled) return;
|
|
12476
12578
|
const store = executionDebugStoreRef.current;
|
|
12477
12579
|
if (!store) return;
|
|
@@ -12486,8 +12588,8 @@ var PlaceOrder = ({
|
|
|
12486
12588
|
const debouncedAmount = (0, import_hooks41.useDebouncedValue)(internalAmount, 300);
|
|
12487
12589
|
const isQuoteInputEditing = internalAmount !== debouncedAmount;
|
|
12488
12590
|
const isLimitOrder = showLimitOrders && executionType === "limit";
|
|
12489
|
-
const isSell = (0,
|
|
12490
|
-
const limitVenueOptions = (0,
|
|
12591
|
+
const isSell = (0, import_react18.useMemo)(() => internalTab === "sell", [internalTab]);
|
|
12592
|
+
const limitVenueOptions = (0, import_react18.useMemo)(
|
|
12491
12593
|
() => {
|
|
12492
12594
|
var _a2;
|
|
12493
12595
|
return buildLimitOrderVenueOptions({
|
|
@@ -12499,7 +12601,7 @@ var PlaceOrder = ({
|
|
|
12499
12601
|
},
|
|
12500
12602
|
[clusterMidpointResult, livePrices, scopedSelectedMarket, scopedSelectedOutcomeId]
|
|
12501
12603
|
);
|
|
12502
|
-
const visibleLimitVenueOptions = (0,
|
|
12604
|
+
const visibleLimitVenueOptions = (0, import_react18.useMemo)(() => {
|
|
12503
12605
|
return limitVenueOptions.filter((option) => {
|
|
12504
12606
|
return (0, import_hooks41.getVenueAvailabilityState)({
|
|
12505
12607
|
venueId: option.venue,
|
|
@@ -12517,7 +12619,7 @@ var PlaceOrder = ({
|
|
|
12517
12619
|
enabled: Boolean(isAuthenticated && isSell),
|
|
12518
12620
|
mode: isPaperMode ? "paper" : void 0
|
|
12519
12621
|
});
|
|
12520
|
-
const sellableSharesByVenue = (0,
|
|
12622
|
+
const sellableSharesByVenue = (0, import_react18.useMemo)(
|
|
12521
12623
|
() => isSell ? resolveSellableSharesByVenue({
|
|
12522
12624
|
positions: executionPositions,
|
|
12523
12625
|
market: scopedSelectedMarket,
|
|
@@ -12538,7 +12640,7 @@ var PlaceOrder = ({
|
|
|
12538
12640
|
isPanelActive: isQuotePanelActive,
|
|
12539
12641
|
isSubmitting: submissionProgressState != null || isBeforeActionPending || executeManaged.isPending || placeLimitOrder.isPending
|
|
12540
12642
|
};
|
|
12541
|
-
const limitVenueQuoteRequests = (0,
|
|
12643
|
+
const limitVenueQuoteRequests = (0, import_react18.useMemo)(
|
|
12542
12644
|
() => visibleLimitVenueOptions.map((option) => ({
|
|
12543
12645
|
venue: option.venue,
|
|
12544
12646
|
venueMarketOutcomeId: option.venueMarketOutcomeId
|
|
@@ -12559,11 +12661,11 @@ var PlaceOrder = ({
|
|
|
12559
12661
|
enabled: isLimitVenueQuoteEnabled,
|
|
12560
12662
|
refreshContext: smartRouteRefreshContext
|
|
12561
12663
|
});
|
|
12562
|
-
const limitVenueQuoteByVenue = (0,
|
|
12664
|
+
const limitVenueQuoteByVenue = (0, import_react18.useMemo)(
|
|
12563
12665
|
() => new Map(limitVenueQuotes.quotes.map((quote) => [quote.request.venue, quote])),
|
|
12564
12666
|
[limitVenueQuotes.quotes]
|
|
12565
12667
|
);
|
|
12566
|
-
const geoBlockedLimitVenues = (0,
|
|
12668
|
+
const geoBlockedLimitVenues = (0, import_react18.useMemo)(() => {
|
|
12567
12669
|
var _a2;
|
|
12568
12670
|
const venues = /* @__PURE__ */ new Set();
|
|
12569
12671
|
for (const quote of limitVenueQuotes.quotes) {
|
|
@@ -12573,7 +12675,7 @@ var PlaceOrder = ({
|
|
|
12573
12675
|
}
|
|
12574
12676
|
return venues;
|
|
12575
12677
|
}, [limitVenueQuotes.quotes]);
|
|
12576
|
-
const availableLimitVenueOptions = (0,
|
|
12678
|
+
const availableLimitVenueOptions = (0, import_react18.useMemo)(() => {
|
|
12577
12679
|
return visibleLimitVenueOptions.filter((option) => {
|
|
12578
12680
|
var _a2;
|
|
12579
12681
|
return !geoBlockedLimitVenues.has(option.venue) && // A limit SELL rests against shares held at that specific venue, so a
|
|
@@ -12595,11 +12697,11 @@ var PlaceOrder = ({
|
|
|
12595
12697
|
sellableSharesByVenue,
|
|
12596
12698
|
visibleLimitVenueOptions
|
|
12597
12699
|
]);
|
|
12598
|
-
const automaticLimitVenueOption = (0,
|
|
12700
|
+
const automaticLimitVenueOption = (0, import_react18.useMemo)(
|
|
12599
12701
|
() => resolveAutomaticLimitOrderVenueOption(availableLimitVenueOptions, internalTab),
|
|
12600
12702
|
[availableLimitVenueOptions, internalTab]
|
|
12601
12703
|
);
|
|
12602
|
-
const selectedLimitVenueOption = (0,
|
|
12704
|
+
const selectedLimitVenueOption = (0, import_react18.useMemo)(() => {
|
|
12603
12705
|
if (selectedLimitVenue) {
|
|
12604
12706
|
const selectedOption = availableLimitVenueOptions.find(
|
|
12605
12707
|
(option) => option.venue === selectedLimitVenue
|
|
@@ -12608,7 +12710,7 @@ var PlaceOrder = ({
|
|
|
12608
12710
|
}
|
|
12609
12711
|
return automaticLimitVenueOption;
|
|
12610
12712
|
}, [automaticLimitVenueOption, availableLimitVenueOptions, selectedLimitVenue]);
|
|
12611
|
-
(0,
|
|
12713
|
+
(0, import_react18.useEffect)(() => {
|
|
12612
12714
|
if (!selectedLimitVenue || !geoBlockedLimitVenues.has(selectedLimitVenue)) return;
|
|
12613
12715
|
setSelectedLimitVenue(null);
|
|
12614
12716
|
}, [geoBlockedLimitVenues, selectedLimitVenue]);
|
|
@@ -12637,7 +12739,7 @@ var PlaceOrder = ({
|
|
|
12637
12739
|
} : {}), {
|
|
12638
12740
|
refreshContext: smartRouteRefreshContext
|
|
12639
12741
|
}));
|
|
12640
|
-
(0,
|
|
12742
|
+
(0, import_react18.useEffect)(() => {
|
|
12641
12743
|
var _a2, _b2, _c2;
|
|
12642
12744
|
if (isSell || smartRoute.isFetching || ((_a2 = smartRoute.data) == null ? void 0 : _a2.venueMarketOutcomeId) !== scopedSelectedOutcomeId) {
|
|
12643
12745
|
return;
|
|
@@ -12659,7 +12761,7 @@ var PlaceOrder = ({
|
|
|
12659
12761
|
smartRoute.isFetching,
|
|
12660
12762
|
user == null ? void 0 : user.id
|
|
12661
12763
|
]);
|
|
12662
|
-
const inheritedBuyGeoBlockedVenues = (0,
|
|
12764
|
+
const inheritedBuyGeoBlockedVenues = (0, import_react18.useMemo)(() => {
|
|
12663
12765
|
var _a2, _b2;
|
|
12664
12766
|
if (!isSell || !buyGeoBlockSnapshot || !scopedSelectedOutcomeId) return void 0;
|
|
12665
12767
|
if (buyGeoBlockSnapshot.eventId !== ((_a2 = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.id) != null ? _a2 : null)) return void 0;
|
|
@@ -12675,7 +12777,7 @@ var PlaceOrder = ({
|
|
|
12675
12777
|
scopedSelectedOutcomeId,
|
|
12676
12778
|
user == null ? void 0 : user.id
|
|
12677
12779
|
]);
|
|
12678
|
-
const venueSellQuoteRequests = (0,
|
|
12780
|
+
const venueSellQuoteRequests = (0, import_react18.useMemo)(
|
|
12679
12781
|
() => {
|
|
12680
12782
|
var _a2;
|
|
12681
12783
|
return isSell && !smartRoute.isLoading && ((_a2 = smartRoute.data) == null ? void 0 : _a2.venueMarketOutcomeId) === scopedSelectedOutcomeId ? buildVenueSellQuoteRequests({
|
|
@@ -12695,7 +12797,7 @@ var PlaceOrder = ({
|
|
|
12695
12797
|
enabled: isSell && isSmartRouteEnabled && !smartRoute.isLoading && ((_o = smartRoute.data) == null ? void 0 : _o.venueMarketOutcomeId) === scopedSelectedOutcomeId,
|
|
12696
12798
|
refreshContext: smartRouteRefreshContext
|
|
12697
12799
|
});
|
|
12698
|
-
const currentSellableShares = (0,
|
|
12800
|
+
const currentSellableShares = (0, import_react18.useMemo)(() => {
|
|
12699
12801
|
var _a2, _b2;
|
|
12700
12802
|
const sharesFromQuote = (_b2 = (_a2 = smartRoute.data) == null ? void 0 : _a2.positionAvailability) == null ? void 0 : _b2.totalSellableShares;
|
|
12701
12803
|
if (typeof sharesFromQuote === "number" && Number.isFinite(sharesFromQuote)) {
|
|
@@ -12705,22 +12807,22 @@ var PlaceOrder = ({
|
|
|
12705
12807
|
for (const size of sellableSharesByVenue.values()) resolvedShares += size;
|
|
12706
12808
|
return Math.max(0, resolvedShares);
|
|
12707
12809
|
}, [sellableSharesByVenue, (_q = (_p = smartRoute.data) == null ? void 0 : _p.positionAvailability) == null ? void 0 : _q.totalSellableShares]);
|
|
12708
|
-
const maxSellableShares = (0,
|
|
12810
|
+
const maxSellableShares = (0, import_react18.useMemo)(
|
|
12709
12811
|
() => floorToDecimals(currentSellableShares, SELL_SHARE_INPUT_DECIMALS),
|
|
12710
12812
|
[currentSellableShares]
|
|
12711
12813
|
);
|
|
12712
12814
|
const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((_s = (_r = smartRoute.data) == null ? void 0 : _r.positionAvailability) == null ? void 0 : _s.totalSellableShares) === "number") && (isExecutionPositionsLoading || isExecutionPositionsFetching);
|
|
12713
|
-
const displayedCurrentSellableShares = (0,
|
|
12815
|
+
const displayedCurrentSellableShares = (0, import_react18.useMemo)(() => {
|
|
12714
12816
|
if (!Number.isFinite(currentSellableShares) || currentSellableShares <= 0) return 0;
|
|
12715
12817
|
return floorToDecimals(currentSellableShares, SELL_SHARE_DISPLAY_DECIMALS);
|
|
12716
12818
|
}, [currentSellableShares]);
|
|
12717
|
-
const displayedCurrentSellableSharesLabel = (0,
|
|
12819
|
+
const displayedCurrentSellableSharesLabel = (0, import_react18.useMemo)(
|
|
12718
12820
|
() => `${formatFlooredShareAmount(maxSellableShares, SELL_SHARE_DISPLAY_DECIMALS)} shares`,
|
|
12719
12821
|
[maxSellableShares]
|
|
12720
12822
|
);
|
|
12721
12823
|
const isAtMaxSellableShares = isSell && maxSellableShares > 0 && Math.abs(internalAmount - maxSellableShares) < 1e-9;
|
|
12722
12824
|
const isSellAmountAboveAvailability = isSell && ((_t = smartRoute.data) == null ? void 0 : _t.venueMarketOutcomeId) === scopedSelectedOutcomeId && typeof ((_u = smartRoute.data.positionAvailability) == null ? void 0 : _u.totalSellableShares) === "number" && internalAmount > maxSellableShares;
|
|
12723
|
-
(0,
|
|
12825
|
+
(0, import_react18.useEffect)(() => {
|
|
12724
12826
|
if (submissionProgressState != null) return;
|
|
12725
12827
|
if (!isSell || isCurrentSellableSharesLoading) return;
|
|
12726
12828
|
if (scopedSelectedOutcomeId === sellFilledForOutcomeId) return;
|
|
@@ -12736,7 +12838,7 @@ var PlaceOrder = ({
|
|
|
12736
12838
|
onAmountChange,
|
|
12737
12839
|
submissionProgressState
|
|
12738
12840
|
]);
|
|
12739
|
-
(0,
|
|
12841
|
+
(0, import_react18.useEffect)(() => {
|
|
12740
12842
|
var _a2, _b2;
|
|
12741
12843
|
if (submissionProgressState != null || !isSell) return;
|
|
12742
12844
|
if (((_a2 = smartRoute.data) == null ? void 0 : _a2.venueMarketOutcomeId) !== scopedSelectedOutcomeId) return;
|
|
@@ -12760,7 +12862,7 @@ var PlaceOrder = ({
|
|
|
12760
12862
|
submissionProgressState
|
|
12761
12863
|
]);
|
|
12762
12864
|
const scopedSmartRouteData = ((_y = smartRoute.data) == null ? void 0 : _y.venueMarketOutcomeId) === scopedSelectedOutcomeId ? smartRoute.data : null;
|
|
12763
|
-
const routeCards = (0,
|
|
12865
|
+
const routeCards = (0, import_react18.useMemo)(() => {
|
|
12764
12866
|
const eventVenues = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets.map((market) => market.venue);
|
|
12765
12867
|
if (isSell) {
|
|
12766
12868
|
return buildLiveSellRouteCards({
|
|
@@ -12804,7 +12906,22 @@ var PlaceOrder = ({
|
|
|
12804
12906
|
const selectedManualRouteCard = manualRouteSelectionIdentity ? routeCards.find(
|
|
12805
12907
|
(card) => getPlaceOrderRouteCardIdentity(card) === manualRouteSelectionIdentity
|
|
12806
12908
|
) : void 0;
|
|
12807
|
-
const
|
|
12909
|
+
const legacyKalshiAccount = (0, import_react18.useMemo)(
|
|
12910
|
+
() => {
|
|
12911
|
+
var _a2;
|
|
12912
|
+
return (_a2 = user == null ? void 0 : user.venueAccounts) == null ? void 0 : _a2.find((venueAccount) => venueAccount.venue === "kalshi");
|
|
12913
|
+
},
|
|
12914
|
+
[user == null ? void 0 : user.venueAccounts]
|
|
12915
|
+
);
|
|
12916
|
+
const isKalshiAccountActive = (_B = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.connected) != null ? _B : (legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.status) === "active";
|
|
12917
|
+
const hasKalshiConnectionState = kalshiKeyStatus !== void 0 || (user == null ? void 0 : user.venueAccounts) != null;
|
|
12918
|
+
const isKalshiAvailable = (0, import_hooks41.getVenueAvailabilityState)({
|
|
12919
|
+
venueId: "kalshi",
|
|
12920
|
+
disabledVenues,
|
|
12921
|
+
isConfigLoading: isAppConfigLoading
|
|
12922
|
+
}) === "available";
|
|
12923
|
+
const isKalshiDisconnected = !isPaperMode && isAuthenticated && hasKalshiConnectionState && isKalshiAvailable && !isKalshiAccountActive;
|
|
12924
|
+
const resolvedSelectedRouteCardId = (0, import_react18.useMemo)(() => {
|
|
12808
12925
|
var _a2;
|
|
12809
12926
|
if (selectedManualRouteCard && !selectedManualRouteCard.isUnavailable) {
|
|
12810
12927
|
return selectedManualRouteCard.id;
|
|
@@ -12813,17 +12930,20 @@ var PlaceOrder = ({
|
|
|
12813
12930
|
return selectedRouteCardId;
|
|
12814
12931
|
}
|
|
12815
12932
|
if (routeCards.length === 0) return null;
|
|
12816
|
-
return resolveDefaultRouteCardId(routeCards, isSell ? void 0 : (_a2 = smartRoute.data) == null ? void 0 : _a2.status
|
|
12933
|
+
return resolveDefaultRouteCardId(routeCards, isSell ? void 0 : (_a2 = smartRoute.data) == null ? void 0 : _a2.status, {
|
|
12934
|
+
isKalshiDisconnected
|
|
12935
|
+
});
|
|
12817
12936
|
}, [
|
|
12937
|
+
isKalshiDisconnected,
|
|
12818
12938
|
isSell,
|
|
12819
12939
|
isRouteCardsTransient,
|
|
12820
12940
|
manualRouteSelectionIdentity,
|
|
12821
12941
|
routeCards,
|
|
12822
12942
|
selectedManualRouteCard,
|
|
12823
12943
|
selectedRouteCardId,
|
|
12824
|
-
(
|
|
12944
|
+
(_C = smartRoute.data) == null ? void 0 : _C.status
|
|
12825
12945
|
]);
|
|
12826
|
-
(0,
|
|
12946
|
+
(0, import_react18.useEffect)(() => {
|
|
12827
12947
|
if (routeCards.length === 0) {
|
|
12828
12948
|
if (isRouteCardsTransient) return;
|
|
12829
12949
|
setSelectedRouteCardId(null);
|
|
@@ -12847,19 +12967,19 @@ var PlaceOrder = ({
|
|
|
12847
12967
|
selectedRouteCardId
|
|
12848
12968
|
]);
|
|
12849
12969
|
const isSubmissionLocked = submissionProgressState != null;
|
|
12850
|
-
const isSubmissionLockedRef = (0,
|
|
12970
|
+
const isSubmissionLockedRef = (0, import_react18.useRef)(isSubmissionLocked);
|
|
12851
12971
|
isSubmissionLockedRef.current = isSubmissionLocked;
|
|
12852
|
-
(0,
|
|
12972
|
+
(0, import_react18.useEffect)(() => {
|
|
12853
12973
|
if (isSubmissionLockedRef.current) return;
|
|
12854
12974
|
setSubmissionFeedback(null);
|
|
12855
12975
|
setSubmissionProgressState(null);
|
|
12856
12976
|
}, [executionType, internalAmount, internalSlippage, internalTab, scopedSelectedOutcomeId]);
|
|
12857
|
-
(0,
|
|
12977
|
+
(0, import_react18.useEffect)(() => {
|
|
12858
12978
|
if (showLimitOrders || executionType !== "limit") return;
|
|
12859
12979
|
setExecutionType("market");
|
|
12860
12980
|
setIsLimitExpirationPickerOpen(false);
|
|
12861
12981
|
}, [executionType, showLimitOrders]);
|
|
12862
|
-
(0,
|
|
12982
|
+
(0, import_react18.useEffect)(() => {
|
|
12863
12983
|
if (executionType !== "limit") {
|
|
12864
12984
|
limitPriceInitializedForOutcomeRef.current = void 0;
|
|
12865
12985
|
return;
|
|
@@ -12872,18 +12992,18 @@ var PlaceOrder = ({
|
|
|
12872
12992
|
setLimitPriceInputValue(formatLimitPriceInputValue(nextLimitPrice));
|
|
12873
12993
|
setLimitPriceInputError(null);
|
|
12874
12994
|
}, [executionType, scopedSelectedOutcomeId, selectedOutcomeDisplayPrice]);
|
|
12875
|
-
(0,
|
|
12995
|
+
(0, import_react18.useEffect)(() => {
|
|
12876
12996
|
setSelectedLimitVenue(null);
|
|
12877
12997
|
}, [scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id, scopedSelectedOutcomeId]);
|
|
12878
|
-
(0,
|
|
12998
|
+
(0, import_react18.useEffect)(() => {
|
|
12879
12999
|
setSelectedRouteCardId(null);
|
|
12880
13000
|
setManualRouteSelectionIdentity(null);
|
|
12881
13001
|
setIsRoutesExpanded(false);
|
|
12882
13002
|
setIsSplitDetailOpen(false);
|
|
12883
13003
|
}, [executionType, internalTab, scopedSelectedOutcomeId]);
|
|
12884
13004
|
const orderedRouteCards = routeCards;
|
|
12885
|
-
const selectedRouteCard = (
|
|
12886
|
-
const selectedSharedKycVenue = (0,
|
|
13005
|
+
const selectedRouteCard = (_E = (_D = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _D : orderedRouteCards[0]) != null ? _E : null;
|
|
13006
|
+
const selectedSharedKycVenue = (0, import_react18.useMemo)(() => {
|
|
12887
13007
|
var _a2, _b2;
|
|
12888
13008
|
const candidateVenue = isLimitOrder ? selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue : (_b2 = (_a2 = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills.find(
|
|
12889
13009
|
(fill) => venueRequiresSharedKyc({ venue: fill.venue })
|
|
@@ -12893,30 +13013,16 @@ var PlaceOrder = ({
|
|
|
12893
13013
|
return parsedVenue.success ? parsedVenue.data : null;
|
|
12894
13014
|
}, [isLimitOrder, selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue, selectedRouteCard]);
|
|
12895
13015
|
const needsSharedKycVerification = !isPaperMode && isAuthenticated && sharedKyc !== void 0 && selectedSharedKycVenue !== null && sharedKyc.status !== "verified";
|
|
12896
|
-
const isKalshiRoute = (0,
|
|
13016
|
+
const isKalshiRoute = (0, import_react18.useMemo)(() => {
|
|
12897
13017
|
if (isLimitOrder) return (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) === import_sdk19.Venue.kalshi;
|
|
12898
13018
|
if (selectedRouteCard) {
|
|
12899
13019
|
return selectedRouteCard.venue === "kalshi" || selectedRouteCard.quoteData.fills.some((f) => f.venue === "kalshi");
|
|
12900
13020
|
}
|
|
12901
13021
|
return (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === "kalshi";
|
|
12902
13022
|
}, [isLimitOrder, selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue, selectedRouteCard, scopedSelectedMarket]);
|
|
12903
|
-
const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (
|
|
12904
|
-
const
|
|
12905
|
-
|
|
12906
|
-
var _a2;
|
|
12907
|
-
return (_a2 = user == null ? void 0 : user.venueAccounts) == null ? void 0 : _a2.find((venueAccount) => venueAccount.venue === "kalshi");
|
|
12908
|
-
},
|
|
12909
|
-
[user == null ? void 0 : user.venueAccounts]
|
|
12910
|
-
);
|
|
12911
|
-
const isKalshiAccountActive = (_F = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.connected) != null ? _F : (legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.status) === "active";
|
|
12912
|
-
const hasKalshiConnectionState = kalshiKeyStatus !== void 0 || (user == null ? void 0 : user.venueAccounts) != null;
|
|
12913
|
-
const isKalshiAvailable = (0, import_hooks41.getVenueAvailabilityState)({
|
|
12914
|
-
venueId: "kalshi",
|
|
12915
|
-
disabledVenues,
|
|
12916
|
-
isConfigLoading: isAppConfigLoading
|
|
12917
|
-
}) === "available";
|
|
12918
|
-
const needsKalshiConnection = !isPaperMode && isAuthenticated && hasKalshiConnectionState && isKalshiAvailable && isKalshiRoute && !isKalshiAccountActive;
|
|
12919
|
-
const handleVerifyKalshi = (0, import_react17.useCallback)(
|
|
13023
|
+
const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (_F = liveBalanceState.kalshiBalance) != null ? _F : 0 : liveAvailableBalance;
|
|
13024
|
+
const needsKalshiConnection = isKalshiDisconnected && isKalshiRoute;
|
|
13025
|
+
const handleVerifyKalshi = (0, import_react18.useCallback)(
|
|
12920
13026
|
(credentials) => __async(null, null, function* () {
|
|
12921
13027
|
if (onConnectKalshi) {
|
|
12922
13028
|
yield onConnectKalshi(credentials);
|
|
@@ -12934,7 +13040,7 @@ var PlaceOrder = ({
|
|
|
12934
13040
|
}),
|
|
12935
13041
|
[aggClient, onConnectKalshi, refetchKalshiKeyStatus]
|
|
12936
13042
|
);
|
|
12937
|
-
const handleRouteCardSelect = (0,
|
|
13043
|
+
const handleRouteCardSelect = (0, import_react18.useCallback)(
|
|
12938
13044
|
(cardId) => {
|
|
12939
13045
|
const card = routeCards.find((routeCard) => routeCard.id === cardId);
|
|
12940
13046
|
if (!card || card.isUnavailable) return;
|
|
@@ -12971,7 +13077,7 @@ var PlaceOrder = ({
|
|
|
12971
13077
|
mode: isPaperMode ? "paper" : void 0,
|
|
12972
13078
|
enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((_I = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _I.length)
|
|
12973
13079
|
});
|
|
12974
|
-
const executionProgressFloorRef = (0,
|
|
13080
|
+
const executionProgressFloorRef = (0, import_react18.useRef)({
|
|
12975
13081
|
quoteId: null,
|
|
12976
13082
|
value: 0
|
|
12977
13083
|
});
|
|
@@ -12982,7 +13088,7 @@ var PlaceOrder = ({
|
|
|
12982
13088
|
const executionDateSource = (_R = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate) != null ? _R : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.endDate;
|
|
12983
13089
|
const executionDateLabel = executionDateSource ? getTradingDateLabel(executionDateSource) : "";
|
|
12984
13090
|
const executionQuoteData = (_T = (_S = submissionProgressState == null ? void 0 : submissionProgressState.quoteData) != null ? _S : selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _T : null;
|
|
12985
|
-
const executionOrderGroups = (0,
|
|
13091
|
+
const executionOrderGroups = (0, import_react18.useMemo)(() => {
|
|
12986
13092
|
var _a2, _b2, _c2;
|
|
12987
13093
|
if (!executionQuoteData) return [];
|
|
12988
13094
|
return deriveExecutionOrderGroups({
|
|
@@ -13005,7 +13111,7 @@ var PlaceOrder = ({
|
|
|
13005
13111
|
(_U = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _U.length,
|
|
13006
13112
|
tradingLabels
|
|
13007
13113
|
]);
|
|
13008
|
-
const executionProgressPercent = (0,
|
|
13114
|
+
const executionProgressPercent = (0, import_react18.useMemo)(() => {
|
|
13009
13115
|
var _a2, _b2, _c2;
|
|
13010
13116
|
const quoteId = (_a2 = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _a2 : null;
|
|
13011
13117
|
const previousProgress = executionProgressFloorRef.current.quoteId === quoteId ? executionProgressFloorRef.current.value : 0;
|
|
@@ -13025,7 +13131,7 @@ var PlaceOrder = ({
|
|
|
13025
13131
|
submissionProgressState == null ? void 0 : submissionProgressState.orderIds,
|
|
13026
13132
|
submissionProgressState == null ? void 0 : submissionProgressState.quoteId
|
|
13027
13133
|
]);
|
|
13028
|
-
const buildExecutionSummary = (0,
|
|
13134
|
+
const buildExecutionSummary = (0, import_react18.useCallback)(
|
|
13029
13135
|
(quoteData, executionVenue, orderId, partialFillSummary) => {
|
|
13030
13136
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2;
|
|
13031
13137
|
if (!quoteData) return void 0;
|
|
@@ -13129,7 +13235,7 @@ var PlaceOrder = ({
|
|
|
13129
13235
|
tradingLabels
|
|
13130
13236
|
]
|
|
13131
13237
|
);
|
|
13132
|
-
(0,
|
|
13238
|
+
(0, import_react18.useEffect)(() => {
|
|
13133
13239
|
if (executionProgress.phase === "order_submitted") {
|
|
13134
13240
|
const submittedOrder = executionProgress.submittedOrders[0];
|
|
13135
13241
|
setSubmissionProgressState((prev) => {
|
|
@@ -13142,7 +13248,7 @@ var PlaceOrder = ({
|
|
|
13142
13248
|
});
|
|
13143
13249
|
}
|
|
13144
13250
|
}, [executionProgress.phase, executionProgress.submittedOrders]);
|
|
13145
|
-
(0,
|
|
13251
|
+
(0, import_react18.useEffect)(() => {
|
|
13146
13252
|
var _a2, _b2;
|
|
13147
13253
|
const dp = executionProgress.dagProgress;
|
|
13148
13254
|
if (!dp) return;
|
|
@@ -13197,7 +13303,7 @@ var PlaceOrder = ({
|
|
|
13197
13303
|
return __spreadProps(__spreadValues({}, prev), { dagProgress: dp });
|
|
13198
13304
|
});
|
|
13199
13305
|
}, [executionOrderGroups, executionProgress.dagProgress, tradingLabels]);
|
|
13200
|
-
(0,
|
|
13306
|
+
(0, import_react18.useEffect)(() => {
|
|
13201
13307
|
const orderIds = submissionProgressState == null ? void 0 : submissionProgressState.orderIds;
|
|
13202
13308
|
if (!(orderIds == null ? void 0 : orderIds.length)) return;
|
|
13203
13309
|
const aggregateStatus = deriveAggregateOrderStatus(
|
|
@@ -13258,7 +13364,7 @@ var PlaceOrder = ({
|
|
|
13258
13364
|
tradingLabels
|
|
13259
13365
|
]);
|
|
13260
13366
|
const estDurationMs = executionQuoteData && typeof executionQuoteData.estDurationMs === "number" ? executionQuoteData.estDurationMs : 6e4;
|
|
13261
|
-
(0,
|
|
13367
|
+
(0, import_react18.useEffect)(() => {
|
|
13262
13368
|
const phase = submissionProgressState == null ? void 0 : submissionProgressState.phase;
|
|
13263
13369
|
if (phase !== "submitting" && phase !== "executing") return;
|
|
13264
13370
|
const timeoutMs = Math.max(6e4, 2 * estDurationMs);
|
|
@@ -13273,7 +13379,7 @@ var PlaceOrder = ({
|
|
|
13273
13379
|
}, timeoutMs);
|
|
13274
13380
|
return () => clearTimeout(id);
|
|
13275
13381
|
}, [submissionProgressState == null ? void 0 : submissionProgressState.phase, estDurationMs, tradingLabels.orderStillSettling]);
|
|
13276
|
-
const emitTerminalOrderNotifications = (0,
|
|
13382
|
+
const emitTerminalOrderNotifications = (0, import_react18.useCallback)(() => {
|
|
13277
13383
|
const toast = toastCtx == null ? void 0 : toastCtx.toast;
|
|
13278
13384
|
if (!toast) return;
|
|
13279
13385
|
for (const event of executionProgress.terminalOrderEvents) {
|
|
@@ -13302,7 +13408,7 @@ var PlaceOrder = ({
|
|
|
13302
13408
|
});
|
|
13303
13409
|
}
|
|
13304
13410
|
}, [executionProgress.terminalOrderEvents, labels, toastCtx]);
|
|
13305
|
-
(0,
|
|
13411
|
+
(0, import_react18.useEffect)(() => {
|
|
13306
13412
|
var _a2, _b2;
|
|
13307
13413
|
if (!submissionProgressState) return;
|
|
13308
13414
|
onExecutionStateChange == null ? void 0 : onExecutionStateChange(submissionProgressState);
|
|
@@ -13377,7 +13483,7 @@ var PlaceOrder = ({
|
|
|
13377
13483
|
const isBelowVenueMinimumFromQuote = isQuoteBelowVenueMinimum(activeQuoteData);
|
|
13378
13484
|
const isBelowMinimum = isBelowClientMinimum || isBelowVenueMinimumFromQuote;
|
|
13379
13485
|
const belowMinimumMessage = isBelowClientMinimum ? tradingLabels.minimumOrderAmount(MIN_BUY_ORDER_AMOUNT) : tradingLabels.minOrderSizeViolated;
|
|
13380
|
-
const quoteStatus = (0,
|
|
13486
|
+
const quoteStatus = (0, import_react18.useMemo)(() => {
|
|
13381
13487
|
if (!orderEligibility.canPlaceOrder) return void 0;
|
|
13382
13488
|
return resolvePlaceOrderQuoteStatus({
|
|
13383
13489
|
amount: internalAmount,
|
|
@@ -13394,7 +13500,7 @@ var PlaceOrder = ({
|
|
|
13394
13500
|
scopedSelectedMarket,
|
|
13395
13501
|
tradingLabels
|
|
13396
13502
|
]);
|
|
13397
|
-
const smartRouteErrorMessage = (0,
|
|
13503
|
+
const smartRouteErrorMessage = (0, import_react18.useMemo)(() => {
|
|
13398
13504
|
var _a2;
|
|
13399
13505
|
const quoteError = (_a2 = smartRoute.error) != null ? _a2 : isSell ? venueSellQuotes.error : null;
|
|
13400
13506
|
if (!quoteError || orderedRouteCards.length > 0) return null;
|
|
@@ -13405,26 +13511,26 @@ var PlaceOrder = ({
|
|
|
13405
13511
|
});
|
|
13406
13512
|
}, [isSell, orderedRouteCards.length, smartRoute.error, tradingLabels, venueSellQuotes.error]);
|
|
13407
13513
|
const progressActionLabel = (internalTab === "buy" ? tradingLabels.buyingOutcome(selectedOutcomeLabel) : tradingLabels.sellingOutcome(selectedOutcomeLabel)).trim();
|
|
13408
|
-
const retryRemainingAmount = (0,
|
|
13514
|
+
const retryRemainingAmount = (0, import_react18.useMemo)(() => {
|
|
13409
13515
|
return getCanonicalPlaceOrderUnfilledRemaining({
|
|
13410
13516
|
originalAmount: internalAmount,
|
|
13411
13517
|
tradeSide: internalTab,
|
|
13412
13518
|
terminalOrderEvents: executionProgress.terminalOrderEvents
|
|
13413
13519
|
});
|
|
13414
13520
|
}, [executionProgress.terminalOrderEvents, internalAmount, internalTab]);
|
|
13415
|
-
const canRetryRemaining = (0,
|
|
13521
|
+
const canRetryRemaining = (0, import_react18.useMemo)(() => {
|
|
13416
13522
|
if (retryRemainingAmount == null) return false;
|
|
13417
13523
|
const minRemainder = isSell ? MIN_SELL_ORDER_SHARES : MIN_BUY_ORDER_AMOUNT;
|
|
13418
13524
|
return retryRemainingAmount >= minRemainder;
|
|
13419
13525
|
}, [isSell, retryRemainingAmount]);
|
|
13420
13526
|
const PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD = 0.95;
|
|
13421
|
-
const shouldAutoSkipPartialFill = (0,
|
|
13527
|
+
const shouldAutoSkipPartialFill = (0, import_react18.useMemo)(() => {
|
|
13422
13528
|
if (internalAmount <= 0 || retryRemainingAmount == null) return false;
|
|
13423
13529
|
const filled = Math.max(0, internalAmount - retryRemainingAmount);
|
|
13424
13530
|
const fillRatio = filled / internalAmount;
|
|
13425
13531
|
return fillRatio >= PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD || !canRetryRemaining;
|
|
13426
13532
|
}, [canRetryRemaining, internalAmount, retryRemainingAmount]);
|
|
13427
|
-
const failureSummary = (0,
|
|
13533
|
+
const failureSummary = (0, import_react18.useMemo)(() => {
|
|
13428
13534
|
var _a2;
|
|
13429
13535
|
if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return void 0;
|
|
13430
13536
|
const quoteData = (_a2 = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _a2 : activeQuoteData;
|
|
@@ -13497,14 +13603,14 @@ var PlaceOrder = ({
|
|
|
13497
13603
|
submissionProgressState,
|
|
13498
13604
|
tradingLabels
|
|
13499
13605
|
]);
|
|
13500
|
-
const displayedToWinHint = (0,
|
|
13606
|
+
const displayedToWinHint = (0, import_react18.useMemo)(() => {
|
|
13501
13607
|
if (!selectedRouteCard) return "";
|
|
13502
13608
|
const averagePrice = selectedRouteCard.executionPrice;
|
|
13503
13609
|
return averagePrice == null ? "" : tradingLabels.averagePrice(averagePrice);
|
|
13504
13610
|
}, [selectedRouteCard, tradingLabels]);
|
|
13505
13611
|
const displayedToWinValue = (_Y = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _Y : 0;
|
|
13506
|
-
const originalLimitPriceRaw = (0,
|
|
13507
|
-
const limitPriceAdjustmentByVenue = (0,
|
|
13612
|
+
const originalLimitPriceRaw = (0, import_react18.useMemo)(() => toLimitPriceRaw(limitPrice), [limitPrice]);
|
|
13613
|
+
const limitPriceAdjustmentByVenue = (0, import_react18.useMemo)(() => {
|
|
13508
13614
|
var _a2;
|
|
13509
13615
|
const adjustments = /* @__PURE__ */ new Map();
|
|
13510
13616
|
for (const option of visibleLimitVenueOptions) {
|
|
@@ -13532,7 +13638,7 @@ var PlaceOrder = ({
|
|
|
13532
13638
|
}, [internalTab, limitVenueQuoteByVenue, originalLimitPriceRaw, visibleLimitVenueOptions]);
|
|
13533
13639
|
const selectedLimitPriceAdjustment = selectedLimitVenueOption ? limitPriceAdjustmentByVenue.get(selectedLimitVenueOption.venue) : void 0;
|
|
13534
13640
|
const selectedLimitPriceRaw = (_Z = selectedLimitPriceAdjustment == null ? void 0 : selectedLimitPriceAdjustment.adjustedPriceRaw) != null ? _Z : originalLimitPriceRaw;
|
|
13535
|
-
const limitPriceAdjustmentMessage = (0,
|
|
13641
|
+
const limitPriceAdjustmentMessage = (0, import_react18.useMemo)(() => {
|
|
13536
13642
|
if (!selectedLimitVenueOption || !(selectedLimitPriceAdjustment == null ? void 0 : selectedLimitPriceAdjustment.adjusted) || !selectedLimitPriceAdjustment.tickSizeRaw) {
|
|
13537
13643
|
return "";
|
|
13538
13644
|
}
|
|
@@ -13550,7 +13656,7 @@ var PlaceOrder = ({
|
|
|
13550
13656
|
selectedLimitVenueOption,
|
|
13551
13657
|
tradingLabels
|
|
13552
13658
|
]);
|
|
13553
|
-
const limitOrderPayload = (0,
|
|
13659
|
+
const limitOrderPayload = (0, import_react18.useMemo)(() => {
|
|
13554
13660
|
if (!selectedLimitVenueOption || internalAmount <= 0) return null;
|
|
13555
13661
|
if (limitPriceInputError) return null;
|
|
13556
13662
|
const effectivePriceRaw = BigInt(selectedLimitPriceRaw);
|
|
@@ -13586,7 +13692,7 @@ var PlaceOrder = ({
|
|
|
13586
13692
|
selectedLimitVenueOption,
|
|
13587
13693
|
selectedLimitPriceRaw
|
|
13588
13694
|
]);
|
|
13589
|
-
const resolvedLimitExpirationDraftDate = (0,
|
|
13695
|
+
const resolvedLimitExpirationDraftDate = (0, import_react18.useMemo)(() => {
|
|
13590
13696
|
return resolveLimitExpirationDate({
|
|
13591
13697
|
expirationType: "CUSTOM",
|
|
13592
13698
|
customDate: limitExpirationDraftDate,
|
|
@@ -13594,7 +13700,7 @@ var PlaceOrder = ({
|
|
|
13594
13700
|
});
|
|
13595
13701
|
}, [limitExpirationDraftDate, limitExpirationDraftTime]);
|
|
13596
13702
|
const isLimitExpirationDraftValid = isFutureLimitExpiration(resolvedLimitExpirationDraftDate);
|
|
13597
|
-
const resolvedCustomExpirationDate = (0,
|
|
13703
|
+
const resolvedCustomExpirationDate = (0, import_react18.useMemo)(() => {
|
|
13598
13704
|
return resolveLimitExpirationDate({
|
|
13599
13705
|
expirationType: "CUSTOM",
|
|
13600
13706
|
customDate: limitExpirationDate,
|
|
@@ -13616,7 +13722,7 @@ var PlaceOrder = ({
|
|
|
13616
13722
|
expiresAt: serializeLimitOrderExpiration(expirationDate)
|
|
13617
13723
|
});
|
|
13618
13724
|
};
|
|
13619
|
-
const displayedLimitToWinValue = (0,
|
|
13725
|
+
const displayedLimitToWinValue = (0, import_react18.useMemo)(() => {
|
|
13620
13726
|
if (!limitOrderPayload) return 0;
|
|
13621
13727
|
const size = Number(BigInt(limitOrderPayload.sizeRaw)) / Number(import_sdk19.LIMIT_PRICE_RAW_SCALE);
|
|
13622
13728
|
if (internalTab === "buy") return size;
|
|
@@ -13627,7 +13733,7 @@ var PlaceOrder = ({
|
|
|
13627
13733
|
)
|
|
13628
13734
|
) / Number(import_sdk19.LIMIT_PRICE_RAW_SCALE);
|
|
13629
13735
|
}, [internalTab, limitOrderPayload]);
|
|
13630
|
-
const limitRouteCards = (0,
|
|
13736
|
+
const limitRouteCards = (0, import_react18.useMemo)(() => {
|
|
13631
13737
|
return visibleLimitVenueOptions.map((option) => {
|
|
13632
13738
|
var _a2, _b2, _c2, _d2;
|
|
13633
13739
|
const effectiveLimitPriceRaw = (_b2 = (_a2 = limitPriceAdjustmentByVenue.get(option.venue)) == null ? void 0 : _a2.adjustedPriceRaw) != null ? _b2 : originalLimitPriceRaw;
|
|
@@ -13677,7 +13783,7 @@ var PlaceOrder = ({
|
|
|
13677
13783
|
tradingLabels,
|
|
13678
13784
|
visibleLimitVenueOptions
|
|
13679
13785
|
]);
|
|
13680
|
-
const limitVenueOptionByCardId = (0,
|
|
13786
|
+
const limitVenueOptionByCardId = (0, import_react18.useMemo)(() => {
|
|
13681
13787
|
return new Map(
|
|
13682
13788
|
visibleLimitVenueOptions.map((option) => [
|
|
13683
13789
|
`limit-venue-${option.venue}-${option.venueMarketOutcomeId}`,
|
|
@@ -13700,13 +13806,13 @@ var PlaceOrder = ({
|
|
|
13700
13806
|
const activeFeeBreakdown = activeQuoteData == null ? void 0 : activeQuoteData.feeBreakdown;
|
|
13701
13807
|
const executionReserve = activeFeeBreakdown == null ? void 0 : activeFeeBreakdown.executionReserve;
|
|
13702
13808
|
const executionReserveValue = typeof executionReserve === "number" && Number.isFinite(executionReserve) && executionReserve > 0 ? formatUsd(executionReserve, { minimumFractionDigits: 2, maximumFractionDigits: 2 }) : null;
|
|
13703
|
-
const estimatedFeesValue = (0,
|
|
13809
|
+
const estimatedFeesValue = (0, import_react18.useMemo)(() => {
|
|
13704
13810
|
const totalFees = getSmartRouteTotalFees(activeFeeBreakdown);
|
|
13705
13811
|
if (totalFees == null) return null;
|
|
13706
13812
|
return formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
13707
13813
|
}, [activeFeeBreakdown]);
|
|
13708
13814
|
const appFeeValue = (__ = activeFeeBreakdown == null ? void 0 : activeFeeBreakdown.appFee) != null ? __ : 0;
|
|
13709
|
-
const feeBreakdownRows = (0,
|
|
13815
|
+
const feeBreakdownRows = (0, import_react18.useMemo)(() => {
|
|
13710
13816
|
var _a2;
|
|
13711
13817
|
if (!activeFeeBreakdown) return [];
|
|
13712
13818
|
return [
|
|
@@ -13757,30 +13863,25 @@ var PlaceOrder = ({
|
|
|
13757
13863
|
const selectedLimitRouteCardId = selectedLimitVenueOption ? `limit-venue-${selectedLimitVenueOption.venue}-${selectedLimitVenueOption.venueMarketOutcomeId}` : null;
|
|
13758
13864
|
const selectedLimitRouteCard = selectedLimitRouteCardId ? (_$ = limitRouteCards.find((card) => card.id === selectedLimitRouteCardId)) != null ? _$ : null : null;
|
|
13759
13865
|
const selectedRouteGeoBlocked = isLimitOrder ? (_aa = selectedLimitRouteCard == null ? void 0 : selectedLimitRouteCard.isUnavailable) != null ? _aa : false : (_ba = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _ba : false;
|
|
13760
|
-
const geoBlockedVenuesFromWarnings = (0,
|
|
13866
|
+
const geoBlockedVenuesFromWarnings = (0, import_react18.useMemo)(
|
|
13761
13867
|
() => {
|
|
13762
13868
|
var _a2;
|
|
13763
13869
|
return extractGeoBlockedVenues((_a2 = smartRoute.data) == null ? void 0 : _a2.warnings);
|
|
13764
13870
|
},
|
|
13765
13871
|
[(_ca = smartRoute.data) == null ? void 0 : _ca.warnings]
|
|
13766
13872
|
);
|
|
13767
|
-
const isPrimaryVenueGeoBlocked = (0,
|
|
13873
|
+
const isPrimaryVenueGeoBlocked = (0, import_react18.useMemo)(() => {
|
|
13768
13874
|
var _a2, _b2;
|
|
13769
13875
|
if (!selectedRouteCard || selectedRouteCard.isUnavailable) return false;
|
|
13770
13876
|
const fills = (_b2 = (_a2 = selectedRouteCard.quoteData) == null ? void 0 : _a2.fills) != null ? _b2 : [];
|
|
13771
13877
|
return fills.length > 0 && fills.every((f) => geoBlockedVenuesFromWarnings.has(f.venue));
|
|
13772
13878
|
}, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
|
|
13773
13879
|
const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked || isLimitOrder && limitRouteCards.length > 0 && limitRouteCards.every((card) => card.isUnavailable);
|
|
13774
|
-
const shouldShowLowLiquidityWarning = !isQuoteInputEditing && !isQuoteLoading && (activeQuoteData == null ? void 0 : activeQuoteData.venueMarketOutcomeId) === scopedSelectedOutcomeId && !(activeQuoteData == null ? void 0 : activeQuoteData.fills.some((fill) => fill.venue === "prophetx")) && isPlaceOrderAveragePriceWorse({
|
|
13775
|
-
averageExecutionPrice: selectedRouteCard == null ? void 0 : selectedRouteCard.executionPrice,
|
|
13776
|
-
displayedMarketPrice: selectedOutcomeDisplayPrice,
|
|
13777
|
-
tradeSide: internalTab
|
|
13778
|
-
});
|
|
13779
13880
|
const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
|
|
13780
13881
|
const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isQuoteInsufficientBalance || isSell && isQuoteInputEditing || isSellAmountAboveAvailability || isBelowMinimum || !isLimitOrder && isQuoteLoading || isSelectedVenueInventoryInsufficient || (isLimitOrder ? !limitOrderPayload : !selectedRouteCard || !selectedRouteCard.quoteData.quoteId) || selectedRouteGeoBlocked || !isAuthenticated || !isLimitOrder && quoteStatus !== void 0;
|
|
13781
13882
|
const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (isLimitOrder ? limitRouteCards.length > 0 : displayedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
|
|
13782
13883
|
const shouldShowRouteToggle = !isLimitOrder && !isQuoteLoading && displayedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
|
|
13783
|
-
const handleReturnToOrderForm = (0,
|
|
13884
|
+
const handleReturnToOrderForm = (0, import_react18.useCallback)(() => {
|
|
13784
13885
|
const submittedSelection = submittedSelectionRef.current;
|
|
13785
13886
|
submittedSelectionRef.current = null;
|
|
13786
13887
|
setSubmissionProgressState(null);
|
|
@@ -13802,7 +13903,7 @@ var PlaceOrder = ({
|
|
|
13802
13903
|
const shareUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(shareText)}`;
|
|
13803
13904
|
window.open(shareUrl, "_blank", "noopener,noreferrer");
|
|
13804
13905
|
};
|
|
13805
|
-
const handleExecuteQuote = (0,
|
|
13906
|
+
const handleExecuteQuote = (0, import_react18.useCallback)(
|
|
13806
13907
|
(quoteData) => __async(null, null, function* () {
|
|
13807
13908
|
var _a2, _b2, _c2;
|
|
13808
13909
|
const quoteId = quoteData == null ? void 0 : quoteData.quoteId;
|
|
@@ -13919,7 +14020,7 @@ var PlaceOrder = ({
|
|
|
13919
14020
|
venueSellQuotes.quotes
|
|
13920
14021
|
]
|
|
13921
14022
|
);
|
|
13922
|
-
const handlePlaceLimitOrder = (0,
|
|
14023
|
+
const handlePlaceLimitOrder = (0, import_react18.useCallback)(
|
|
13923
14024
|
(submissionLimitOrderPayload) => __async(null, null, function* () {
|
|
13924
14025
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
13925
14026
|
if (!showLimitOrders) return;
|
|
@@ -14002,7 +14103,7 @@ var PlaceOrder = ({
|
|
|
14002
14103
|
tradingLabels
|
|
14003
14104
|
]
|
|
14004
14105
|
);
|
|
14005
|
-
const handleSkipToSuccess = (0,
|
|
14106
|
+
const handleSkipToSuccess = (0, import_react18.useCallback)(() => {
|
|
14006
14107
|
const primaryFilledEvent = executionProgress.terminalOrderEvents.find(
|
|
14007
14108
|
(e) => e.event === "filled" || e.event === "partial_fill"
|
|
14008
14109
|
);
|
|
@@ -14027,7 +14128,7 @@ var PlaceOrder = ({
|
|
|
14027
14128
|
failureSummary,
|
|
14028
14129
|
selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData
|
|
14029
14130
|
]);
|
|
14030
|
-
(0,
|
|
14131
|
+
(0, import_react18.useEffect)(() => {
|
|
14031
14132
|
if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return;
|
|
14032
14133
|
if ((failureSummary == null ? void 0 : failureSummary.kind) !== "partial_fill") return;
|
|
14033
14134
|
if (!shouldAutoSkipPartialFill) return;
|
|
@@ -14038,7 +14139,7 @@ var PlaceOrder = ({
|
|
|
14038
14139
|
shouldAutoSkipPartialFill,
|
|
14039
14140
|
submissionProgressState == null ? void 0 : submissionProgressState.phase
|
|
14040
14141
|
]);
|
|
14041
|
-
const handleRetrySubmission = (0,
|
|
14142
|
+
const handleRetrySubmission = (0, import_react18.useCallback)(() => __async(null, null, function* () {
|
|
14042
14143
|
var _a2, _b2, _c2, _d2, _e2;
|
|
14043
14144
|
if (!orderEligibility.canPlaceOrder || !failureSummary || failureSummary.kind === "generic") {
|
|
14044
14145
|
handleReturnToOrderForm();
|
|
@@ -14456,7 +14557,7 @@ var PlaceOrder = ({
|
|
|
14456
14557
|
}
|
|
14457
14558
|
);
|
|
14458
14559
|
}
|
|
14459
|
-
return /* @__PURE__ */ (0, import_jsx_runtime145.jsxs)(
|
|
14560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime145.jsxs)(import_react18.Fragment, { children: [
|
|
14460
14561
|
/* @__PURE__ */ (0, import_jsx_runtime145.jsxs)(
|
|
14461
14562
|
Card,
|
|
14462
14563
|
{
|
|
@@ -14832,12 +14933,13 @@ var PlaceOrder = ({
|
|
|
14832
14933
|
/* @__PURE__ */ (0, import_jsx_runtime145.jsx)(PlaceOrderRouteCardSkeleton, {}),
|
|
14833
14934
|
/* @__PURE__ */ (0, import_jsx_runtime145.jsx)(PlaceOrderRouteCardSkeleton, {})
|
|
14834
14935
|
] }) : activeRouteCards.length > 0 ? activeRouteCards.map((card) => {
|
|
14835
|
-
return /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
14936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(import_react18.Fragment, { children: renderRouteCard({
|
|
14836
14937
|
card,
|
|
14837
14938
|
enableAnimations,
|
|
14838
14939
|
isExpanded: card.kind === "split" ? isSplitDetailOpen : isRoutesExpanded,
|
|
14839
14940
|
isSelected: !card.isUnavailable && card.id === (isLimitOrder ? selectedLimitRouteCardId : resolvedSelectedRouteCardId),
|
|
14840
14941
|
onSelect: handleActiveRouteCardSelect,
|
|
14942
|
+
isKalshiDisconnected,
|
|
14841
14943
|
sharedKycStatus: isPaperMode ? void 0 : sharedKyc == null ? void 0 : sharedKyc.status,
|
|
14842
14944
|
tradingLabels
|
|
14843
14945
|
}) }, card.id);
|
|
@@ -15041,7 +15143,7 @@ var PlaceOrder = ({
|
|
|
15041
15143
|
/* @__PURE__ */ (0, import_jsx_runtime145.jsx)("p", { className: "agg-order-summary-hint text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isLimitOrder ? displayedLimitToWinHint : displayedToWinHint })
|
|
15042
15144
|
] }),
|
|
15043
15145
|
/* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
15044
|
-
|
|
15146
|
+
import_react17.default,
|
|
15045
15147
|
{
|
|
15046
15148
|
value: isLimitOrder ? displayedLimitToWinValue : displayedToWinValue,
|
|
15047
15149
|
locales: locale,
|
|
@@ -15199,15 +15301,6 @@ var PlaceOrder = ({
|
|
|
15199
15301
|
children: actionLabel
|
|
15200
15302
|
}
|
|
15201
15303
|
),
|
|
15202
|
-
shouldShowLowLiquidityWarning ? /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
15203
|
-
InlineAlert,
|
|
15204
|
-
{
|
|
15205
|
-
tone: "warning",
|
|
15206
|
-
variant: "surface",
|
|
15207
|
-
className: "agg-order-low-liquidity-warning justify-start! border-0! bg-agg-warning/10! py-2!",
|
|
15208
|
-
message: internalTab === "buy" ? tradingLabels.lowLiquidityWarning : tradingLabels.lowLiquiditySellWarning
|
|
15209
|
-
}
|
|
15210
|
-
) : null,
|
|
15211
15304
|
!shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown && appFeeValue === 0 ? /* @__PURE__ */ (0, import_jsx_runtime145.jsxs)("div", { className: "agg-order-platform-fee mt-1 flex items-center justify-center gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
|
|
15212
15305
|
/* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
15213
15306
|
Icon,
|
|
@@ -15261,7 +15354,7 @@ var import_hooks42 = require("@agg-build/hooks");
|
|
|
15261
15354
|
|
|
15262
15355
|
// src/trading/use-claim-winnings.ts
|
|
15263
15356
|
var import_hooks43 = require("@agg-build/hooks");
|
|
15264
|
-
var
|
|
15357
|
+
var import_react19 = require("react");
|
|
15265
15358
|
var toClaimError = (err) => {
|
|
15266
15359
|
if (err instanceof Error) return err;
|
|
15267
15360
|
return new Error(String(err));
|
|
@@ -15273,17 +15366,17 @@ function useClaimWinnings(options = {}) {
|
|
|
15273
15366
|
const toastCtx = useOptionalToast();
|
|
15274
15367
|
const queryClient = (0, import_hooks43.useQueryClient)();
|
|
15275
15368
|
const redeemMutation = (0, import_hooks43.useRedeem)();
|
|
15276
|
-
const [activeRedeems, setActiveRedeems] = (0,
|
|
15277
|
-
const activeClaimKeysRef = (0,
|
|
15278
|
-
const pendingClaimToastIdsRef = (0,
|
|
15279
|
-
const submittedClaimToastKeysRef = (0,
|
|
15280
|
-
const [submittingClaimKeys, setSubmittingClaimKeys] = (0,
|
|
15281
|
-
const lifecycleInputs = (0,
|
|
15369
|
+
const [activeRedeems, setActiveRedeems] = (0, import_react19.useState)({});
|
|
15370
|
+
const activeClaimKeysRef = (0, import_react19.useRef)(/* @__PURE__ */ new Set());
|
|
15371
|
+
const pendingClaimToastIdsRef = (0, import_react19.useRef)({});
|
|
15372
|
+
const submittedClaimToastKeysRef = (0, import_react19.useRef)(/* @__PURE__ */ new Set());
|
|
15373
|
+
const [submittingClaimKeys, setSubmittingClaimKeys] = (0, import_react19.useState)({});
|
|
15374
|
+
const lifecycleInputs = (0, import_react19.useMemo)(
|
|
15282
15375
|
() => Object.values(activeRedeems),
|
|
15283
15376
|
[activeRedeems]
|
|
15284
15377
|
);
|
|
15285
15378
|
const lifecycleStates = (0, import_hooks43.useRedeemLifecycles)(lifecycleInputs);
|
|
15286
|
-
const internalClaimingIds = (0,
|
|
15379
|
+
const internalClaimingIds = (0, import_react19.useMemo)(() => {
|
|
15287
15380
|
const out = __spreadValues({}, submittingClaimKeys);
|
|
15288
15381
|
for (const [claimKey, active] of Object.entries(activeRedeems)) {
|
|
15289
15382
|
const state = lifecycleStates[active.redeemId];
|
|
@@ -15292,11 +15385,11 @@ function useClaimWinnings(options = {}) {
|
|
|
15292
15385
|
return out;
|
|
15293
15386
|
}, [activeRedeems, lifecycleStates, submittingClaimKeys]);
|
|
15294
15387
|
const claimingKeys = externalClaimingKeys != null ? externalClaimingKeys : internalClaimingIds;
|
|
15295
|
-
const isClaiming = (0,
|
|
15388
|
+
const isClaiming = (0, import_react19.useCallback)(
|
|
15296
15389
|
(claimKey) => Boolean(externalClaimingKeys == null ? void 0 : externalClaimingKeys[claimKey]) || Boolean(internalClaimingIds[claimKey]),
|
|
15297
15390
|
[externalClaimingKeys, internalClaimingIds]
|
|
15298
15391
|
);
|
|
15299
|
-
const invalidateClaimUiState = (0,
|
|
15392
|
+
const invalidateClaimUiState = (0, import_react19.useCallback)(() => {
|
|
15300
15393
|
(0, import_hooks43.invalidateBalanceQueries)(queryClient);
|
|
15301
15394
|
(0, import_hooks43.invalidatePositionQueries)(queryClient);
|
|
15302
15395
|
queryClient.invalidateQueries({
|
|
@@ -15305,7 +15398,7 @@ function useClaimWinnings(options = {}) {
|
|
|
15305
15398
|
});
|
|
15306
15399
|
(0, import_hooks43.invalidateUserActivityQueries)(queryClient);
|
|
15307
15400
|
}, [queryClient]);
|
|
15308
|
-
const claim = (0,
|
|
15401
|
+
const claim = (0, import_react19.useCallback)(
|
|
15309
15402
|
(_0) => __async(null, [_0], function* ({ claimKey, winningOutcomeIds, payload }) {
|
|
15310
15403
|
if (activeClaimKeysRef.current.has(claimKey) || Boolean(externalClaimingKeys == null ? void 0 : externalClaimingKeys[claimKey]) || internalClaimingIds[claimKey]) {
|
|
15311
15404
|
return;
|
|
@@ -15443,8 +15536,8 @@ function useClaimWinnings(options = {}) {
|
|
|
15443
15536
|
toastCtx
|
|
15444
15537
|
]
|
|
15445
15538
|
);
|
|
15446
|
-
const firedTerminalRef = (0,
|
|
15447
|
-
(0,
|
|
15539
|
+
const firedTerminalRef = (0, import_react19.useRef)({});
|
|
15540
|
+
(0, import_react19.useEffect)(() => {
|
|
15448
15541
|
var _a, _b;
|
|
15449
15542
|
for (const [claimKey, active] of Object.entries(activeRedeems)) {
|
|
15450
15543
|
const state = lifecycleStates[active.redeemId];
|
|
@@ -15501,7 +15594,7 @@ function useClaimWinnings(options = {}) {
|
|
|
15501
15594
|
|
|
15502
15595
|
// src/trading/use-resolved-market-claim.ts
|
|
15503
15596
|
var import_hooks44 = require("@agg-build/hooks");
|
|
15504
|
-
var
|
|
15597
|
+
var import_react20 = require("react");
|
|
15505
15598
|
var sharesFormatter = new Intl.NumberFormat("en-US", { maximumFractionDigits: 2 });
|
|
15506
15599
|
var dateFormatter = new Intl.DateTimeFormat("en-US", {
|
|
15507
15600
|
month: "short",
|
|
@@ -15518,7 +15611,7 @@ function useResolvedMarketClaim(options = {}) {
|
|
|
15518
15611
|
var _a;
|
|
15519
15612
|
const { market, enabled = true, executionMode } = options;
|
|
15520
15613
|
const { isAuthenticated } = (0, import_hooks44.useAggAuthState)();
|
|
15521
|
-
const tradingState = (0,
|
|
15614
|
+
const tradingState = (0, import_react20.useMemo)(() => (0, import_hooks44.resolveMarketTradingState)(market), [market]);
|
|
15522
15615
|
const isResolved = tradingState.kind === "resolved";
|
|
15523
15616
|
const marketId = (_a = market == null ? void 0 : market.id) != null ? _a : null;
|
|
15524
15617
|
const shouldFetch = Boolean(enabled && isAuthenticated && isResolved && marketId);
|
|
@@ -15528,7 +15621,7 @@ function useResolvedMarketClaim(options = {}) {
|
|
|
15528
15621
|
limit: 50
|
|
15529
15622
|
}, executionMode === "paper" ? { mode: "paper" } : {}));
|
|
15530
15623
|
const claimWinnings = useClaimWinnings();
|
|
15531
|
-
return (0,
|
|
15624
|
+
return (0, import_react20.useMemo)(() => {
|
|
15532
15625
|
var _a2;
|
|
15533
15626
|
if (!shouldFetch || !marketId) return void 0;
|
|
15534
15627
|
const group = positions.find(
|