@agg-build/ui 4.17.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-M6U2RKBD.mjs → chunk-3Y2GCNVL.mjs} +100 -52
- package/dist/{chunk-D2BTU7QI.mjs → chunk-7E4UXCEX.mjs} +223 -169
- package/dist/{chunk-QGONLJLE.mjs → chunk-B5ALKYD5.mjs} +210 -184
- package/dist/{chunk-RR44PSKH.mjs → chunk-BBDFSTIA.mjs} +3 -1
- package/dist/{chunk-5SCDQSNA.mjs → chunk-JI5KV4QI.mjs} +2 -2
- package/dist/{chunk-NIRCF54M.mjs → chunk-RZLM3M5R.mjs} +2 -2
- package/dist/{chunk-HFMKCV4L.mjs → chunk-TK62UB5F.mjs} +27 -16
- package/dist/events.js +29 -16
- package/dist/events.mjs +3 -3
- package/dist/index.js +1033 -920
- package/dist/index.mjs +9 -38
- package/dist/modals.js +212 -184
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +814 -674
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +3 -1
- 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/pages.js
CHANGED
|
@@ -103,7 +103,7 @@ module.exports = __toCommonJS(pages_exports);
|
|
|
103
103
|
// src/pages/home/index.tsx
|
|
104
104
|
var import_hooks75 = require("@agg-build/hooks");
|
|
105
105
|
var import_sdk25 = require("@agg-build/sdk");
|
|
106
|
-
var
|
|
106
|
+
var import_react49 = require("react");
|
|
107
107
|
|
|
108
108
|
// src/events/item/index.tsx
|
|
109
109
|
var import_hooks38 = require("@agg-build/hooks");
|
|
@@ -8166,7 +8166,8 @@ var ModalContainer = ({
|
|
|
8166
8166
|
maxWidth = "600px",
|
|
8167
8167
|
classNames,
|
|
8168
8168
|
"aria-label": ariaLabel,
|
|
8169
|
-
"aria-labelledby": ariaLabelledBy
|
|
8169
|
+
"aria-labelledby": ariaLabelledBy,
|
|
8170
|
+
onOpenAutoFocus
|
|
8170
8171
|
}) => {
|
|
8171
8172
|
const {
|
|
8172
8173
|
general: { rootClassName },
|
|
@@ -8197,6 +8198,7 @@ var ModalContainer = ({
|
|
|
8197
8198
|
),
|
|
8198
8199
|
"aria-label": ariaLabel,
|
|
8199
8200
|
"aria-labelledby": ariaLabelledBy,
|
|
8201
|
+
onOpenAutoFocus,
|
|
8200
8202
|
onCloseAutoFocus: (event) => {
|
|
8201
8203
|
event.preventDefault();
|
|
8202
8204
|
},
|
|
@@ -11523,7 +11525,7 @@ EventList.displayName = "EventList";
|
|
|
11523
11525
|
|
|
11524
11526
|
// src/pages/event-market/index.tsx
|
|
11525
11527
|
var import_hooks74 = require("@agg-build/hooks");
|
|
11526
|
-
var
|
|
11528
|
+
var import_react46 = require("react");
|
|
11527
11529
|
|
|
11528
11530
|
// src/events/item-details/index.tsx
|
|
11529
11531
|
var import_hooks51 = require("@agg-build/hooks");
|
|
@@ -13906,13 +13908,14 @@ var parseSettlementDateMs = (value) => {
|
|
|
13906
13908
|
var isDateLikeDifference = (canonicalKey) => {
|
|
13907
13909
|
return canonicalKey === "resolution_timing" || canonicalKey === "start_date" || canonicalKey === "end_date";
|
|
13908
13910
|
};
|
|
13909
|
-
var
|
|
13910
|
-
if (!isDateLikeDifference(canonicalKey)) return false;
|
|
13911
|
+
var hasEqualValuesAcrossVenues = (difference) => {
|
|
13911
13912
|
const values = Object.values(difference.perVenue);
|
|
13912
13913
|
if (values.length < 2) return false;
|
|
13913
13914
|
const timestamps = values.map(parseSettlementDateMs);
|
|
13914
|
-
if (timestamps.
|
|
13915
|
-
|
|
13915
|
+
if (timestamps.every((timestamp) => timestamp !== null)) {
|
|
13916
|
+
return new Set(timestamps).size === 1;
|
|
13917
|
+
}
|
|
13918
|
+
return new Set(values.map(normalizeSettlementForCompare)).size === 1;
|
|
13916
13919
|
};
|
|
13917
13920
|
var resolveDifferenceSeverity = (difference, canonicalKey) => {
|
|
13918
13921
|
var _a;
|
|
@@ -13947,7 +13950,7 @@ var prepareSettlementDifferences = (differences) => {
|
|
|
13947
13950
|
if (!title2 || Object.keys(perVenue).length === 0) continue;
|
|
13948
13951
|
const difference = __spreadProps(__spreadValues({}, rawDifference), { title: title2, perVenue });
|
|
13949
13952
|
const canonicalKey = resolveCanonicalDifferenceKey(difference);
|
|
13950
|
-
if (
|
|
13953
|
+
if (hasEqualValuesAcrossVenues(difference)) continue;
|
|
13951
13954
|
const existing = byCanonicalKey.get(canonicalKey);
|
|
13952
13955
|
if (existing) {
|
|
13953
13956
|
byCanonicalKey.set(canonicalKey, __spreadProps(__spreadValues({}, existing), {
|
|
@@ -13961,7 +13964,7 @@ var prepareSettlementDifferences = (differences) => {
|
|
|
13961
13964
|
originalIndex
|
|
13962
13965
|
}));
|
|
13963
13966
|
}
|
|
13964
|
-
return Array.from(byCanonicalKey.values()).sort((left, right) => {
|
|
13967
|
+
return Array.from(byCanonicalKey.values()).filter((difference) => !hasEqualValuesAcrossVenues(difference)).sort((left, right) => {
|
|
13965
13968
|
const severityDelta = Number(right.severity === "critical") - Number(left.severity === "critical");
|
|
13966
13969
|
if (severityDelta !== 0) return severityDelta;
|
|
13967
13970
|
return left.originalIndex - right.originalIndex;
|
|
@@ -13975,9 +13978,7 @@ var resolveSettlementVenueLabel = (venue, labels) => {
|
|
|
13975
13978
|
return (_a = labels.venues[venue]) != null ? _a : formatVenueFallbackLabel(venue);
|
|
13976
13979
|
};
|
|
13977
13980
|
var resolveDifferenceVenueKeys = (difference, settlementVenues) => {
|
|
13978
|
-
const
|
|
13979
|
-
if (!isDateLikeDifference(difference.canonicalKey)) return explicitVenues;
|
|
13980
|
-
const allVenues = [...settlementVenues != null ? settlementVenues : [], ...explicitVenues];
|
|
13981
|
+
const allVenues = [...settlementVenues != null ? settlementVenues : [], ...Object.keys(difference.perVenue)];
|
|
13981
13982
|
return Array.from(new Set(allVenues.filter((venue) => venue.trim().length > 0)));
|
|
13982
13983
|
};
|
|
13983
13984
|
var resolveDifferenceIconClassName = (canonicalKey) => {
|
|
@@ -14016,6 +14017,12 @@ var buildSettlementVenueRules = ({
|
|
|
14016
14017
|
if (!venueRules.includes(content2)) venueRules.push(content2);
|
|
14017
14018
|
rulesByVenue.set(venue2, venueRules);
|
|
14018
14019
|
}
|
|
14020
|
+
if (rulesByVenue.size > 0) {
|
|
14021
|
+
for (const venue2 of settlementVenues != null ? settlementVenues : []) {
|
|
14022
|
+
const trimmedVenue = venue2.trim();
|
|
14023
|
+
if (trimmedVenue && !rulesByVenue.has(trimmedVenue)) rulesByVenue.set(trimmedVenue, []);
|
|
14024
|
+
}
|
|
14025
|
+
}
|
|
14019
14026
|
return Array.from(rulesByVenue, ([venue2, contents]) => ({
|
|
14020
14027
|
venue: venue2,
|
|
14021
14028
|
content: contents.join("\n\n")
|
|
@@ -14025,6 +14032,11 @@ var buildSettlementVenueRules = ({
|
|
|
14025
14032
|
const venue = (_b = settlementVenues == null ? void 0 : settlementVenues.find((candidate) => candidate.trim().length > 0)) == null ? void 0 : _b.trim();
|
|
14026
14033
|
return content && venue ? [{ venue, content }] : [];
|
|
14027
14034
|
};
|
|
14035
|
+
var repeatsQuestion = (content, question) => {
|
|
14036
|
+
const normalizedQuestion = normalizeSettlementForCompare(question != null ? question : "");
|
|
14037
|
+
if (!normalizedQuestion) return false;
|
|
14038
|
+
return normalizeSettlementForCompare(content) === normalizedQuestion;
|
|
14039
|
+
};
|
|
14028
14040
|
var isDuplicatedByVenueRules = (content, venueRules) => {
|
|
14029
14041
|
const normalizedContent = normalizeSettlementForCompare(content);
|
|
14030
14042
|
if (!normalizedContent) return false;
|
|
@@ -14041,8 +14053,8 @@ var SettlementVenueRules = ({
|
|
|
14041
14053
|
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.trading.settlementFullRulesTitle }),
|
|
14042
14054
|
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "flex w-full flex-col items-start gap-4", children: rules.map((rule) => {
|
|
14043
14055
|
const venueLabel = resolveSettlementVenueLabel(rule.venue, labels);
|
|
14044
|
-
return /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("details", { className: "
|
|
14045
|
-
/* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("summary", { className: "flex cursor-pointer list-none items-center gap-2 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground
|
|
14056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("details", { className: "w-full", children: [
|
|
14057
|
+
/* @__PURE__ */ (0, import_jsx_runtime147.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: [
|
|
14046
14058
|
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
|
|
14047
14059
|
VenueLogo,
|
|
14048
14060
|
{
|
|
@@ -14066,7 +14078,7 @@ var SettlementVenueRules = ({
|
|
|
14066
14078
|
}
|
|
14067
14079
|
)
|
|
14068
14080
|
] }),
|
|
14069
|
-
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "mt-3 pl-6", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(SettlementTextRenderer, { content: rule.content }) })
|
|
14081
|
+
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "mt-3 pl-6", children: rule.content ? /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(SettlementTextRenderer, { content: rule.content }) : /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("p", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-muted-foreground", children: labels.trading.settlementValueUnavailable }) })
|
|
14070
14082
|
] }, rule.venue);
|
|
14071
14083
|
}) })
|
|
14072
14084
|
] });
|
|
@@ -14094,9 +14106,10 @@ var Settlement = ({
|
|
|
14094
14106
|
}),
|
|
14095
14107
|
[eventDescription, marketDescription, primaryRules]
|
|
14096
14108
|
);
|
|
14109
|
+
const isSingleVenueCluster = settlementVenues !== void 0 && settlementVenues.length < 2;
|
|
14097
14110
|
const settlementDifferences = (0, import_react23.useMemo)(
|
|
14098
|
-
() => prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences),
|
|
14099
|
-
[settlementDiff == null ? void 0 : settlementDiff.differences]
|
|
14111
|
+
() => isSingleVenueCluster ? [] : prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences),
|
|
14112
|
+
[isSingleVenueCluster, settlementDiff == null ? void 0 : settlementDiff.differences]
|
|
14100
14113
|
);
|
|
14101
14114
|
const eventBlock = (_a = blocks.find((block) => block.key === "eventDescription")) != null ? _a : null;
|
|
14102
14115
|
const marketBlock = (_b = blocks.find((block) => block.key === "marketDescription")) != null ? _b : null;
|
|
@@ -14112,7 +14125,7 @@ var Settlement = ({
|
|
|
14112
14125
|
);
|
|
14113
14126
|
const hasSettlementDifferences = settlementDifferences.length > 0;
|
|
14114
14127
|
const hasVenueSettlementRules = venueRuleBlocks.length > 0;
|
|
14115
|
-
const standaloneEventBlock = eventBlock && !isDuplicatedByVenueRules(eventBlock.content, venueRuleBlocks) ? eventBlock : null;
|
|
14128
|
+
const standaloneEventBlock = eventBlock && !isDuplicatedByVenueRules(eventBlock.content, venueRuleBlocks) && !repeatsQuestion(eventBlock.content, question) ? eventBlock : null;
|
|
14116
14129
|
const standaloneMarketBlock = hasVenueSettlementRules ? null : marketBlock;
|
|
14117
14130
|
const standalonePrimaryRulesBlock = hasVenueSettlementRules ? null : primaryRulesBlock;
|
|
14118
14131
|
const hasStandaloneSettlementText = hasVenueSettlementRules ? standaloneEventBlock !== null : blocks.length > 0;
|
|
@@ -17533,12 +17546,12 @@ SettlementDetails.displayName = "SettlementDetails";
|
|
|
17533
17546
|
// src/trading/place-order/index.tsx
|
|
17534
17547
|
var import_hooks67 = require("@agg-build/hooks");
|
|
17535
17548
|
var import_sdk24 = require("@agg-build/sdk");
|
|
17536
|
-
var
|
|
17549
|
+
var import_react38 = __toESM(require("@number-flow/react"));
|
|
17537
17550
|
var Popover = __toESM(require("@radix-ui/react-popover"));
|
|
17538
17551
|
var import_dayjs8 = __toESM(require("dayjs"));
|
|
17539
17552
|
var import_timezone2 = __toESM(require("dayjs/plugin/timezone"));
|
|
17540
17553
|
var import_utc2 = __toESM(require("dayjs/plugin/utc"));
|
|
17541
|
-
var
|
|
17554
|
+
var import_react39 = require("react");
|
|
17542
17555
|
|
|
17543
17556
|
// src/geo-block-banner/index.tsx
|
|
17544
17557
|
var import_hooks57 = require("@agg-build/hooks");
|
|
@@ -18439,6 +18452,27 @@ var getSafeConnectionError = ({
|
|
|
18439
18452
|
error.message
|
|
18440
18453
|
).trim();
|
|
18441
18454
|
};
|
|
18455
|
+
var CloseButton = ({
|
|
18456
|
+
className,
|
|
18457
|
+
disabled
|
|
18458
|
+
}) => {
|
|
18459
|
+
const labels = (0, import_hooks64.useLabels)();
|
|
18460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
|
|
18461
|
+
Dialog5.Close,
|
|
18462
|
+
{
|
|
18463
|
+
"aria-label": labels.common.close,
|
|
18464
|
+
disabled,
|
|
18465
|
+
className: cn(
|
|
18466
|
+
"z-30 flex size-6 cursor-pointer items-center justify-center rounded-agg-full",
|
|
18467
|
+
"text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
18468
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-accent",
|
|
18469
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
18470
|
+
className
|
|
18471
|
+
),
|
|
18472
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(Icon, { name: "close", size: "medium", className: "!text-agg-foreground" })
|
|
18473
|
+
}
|
|
18474
|
+
);
|
|
18475
|
+
};
|
|
18442
18476
|
var ConnectKalshiModal = ({
|
|
18443
18477
|
open,
|
|
18444
18478
|
onOpenChange,
|
|
@@ -18469,12 +18503,12 @@ var ConnectKalshiModal = ({
|
|
|
18469
18503
|
setError(void 0);
|
|
18470
18504
|
setIsVerifying(false);
|
|
18471
18505
|
setIsConnected(false);
|
|
18472
|
-
const animationFrame = window.requestAnimationFrame(() => {
|
|
18473
|
-
var _a;
|
|
18474
|
-
return (_a = apiKeyInputRef.current) == null ? void 0 : _a.focus();
|
|
18475
|
-
});
|
|
18476
|
-
return () => window.cancelAnimationFrame(animationFrame);
|
|
18477
18506
|
}, [open]);
|
|
18507
|
+
const handleOpenAutoFocus = (0, import_react35.useCallback)((event) => {
|
|
18508
|
+
var _a;
|
|
18509
|
+
event.preventDefault();
|
|
18510
|
+
(_a = apiKeyInputRef.current) == null ? void 0 : _a.focus({ preventScroll: true });
|
|
18511
|
+
}, []);
|
|
18478
18512
|
const handleOpenChange = (0, import_react35.useCallback)(
|
|
18479
18513
|
(nextOpen) => {
|
|
18480
18514
|
if (isVerifying && !nextOpen) return;
|
|
@@ -18517,207 +18551,211 @@ var ConnectKalshiModal = ({
|
|
|
18517
18551
|
[handleVerify]
|
|
18518
18552
|
);
|
|
18519
18553
|
if (availabilityState === "hidden") return null;
|
|
18520
|
-
return /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime163.
|
|
18554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
|
|
18521
18555
|
Modal.Container,
|
|
18522
18556
|
{
|
|
18523
|
-
maxWidth: "600px",
|
|
18557
|
+
maxWidth: isConnected ? "480px" : "600px",
|
|
18524
18558
|
"aria-label": labels.onboarding.connectKalshiModal.ariaLabel,
|
|
18525
|
-
classNames: {
|
|
18526
|
-
|
|
18527
|
-
|
|
18528
|
-
|
|
18529
|
-
|
|
18530
|
-
|
|
18531
|
-
|
|
18532
|
-
disabled: isVerifying,
|
|
18533
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(Icon, { name: "close", size: "medium" })
|
|
18534
|
-
}
|
|
18535
|
-
) }),
|
|
18536
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)(Modal.Body, { classNames: { root: "!px-5 !pb-12 !pt-0 sm:!px-10" }, children: isConnected ? /* @__PURE__ */ (0, import_jsx_runtime163.jsxs)(
|
|
18559
|
+
classNames: {
|
|
18560
|
+
container: "!rounded-t-agg-xl !rounded-b-none md:!rounded-agg-2xl"
|
|
18561
|
+
},
|
|
18562
|
+
onOpenAutoFocus: isConnected ? void 0 : handleOpenAutoFocus,
|
|
18563
|
+
children: isConnected ? /* @__PURE__ */ (0, import_jsx_runtime163.jsxs)(Modal.Body, { classNames: { root: "relative !px-5 !py-8 md:!px-10 md:!py-12" }, children: [
|
|
18564
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)(CloseButton, { className: "absolute right-5 top-5 md:right-8 md:top-8" }),
|
|
18565
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)(
|
|
18537
18566
|
"div",
|
|
18538
18567
|
{
|
|
18539
|
-
className: "flex flex-col items-center gap-8
|
|
18568
|
+
className: "flex flex-col items-center gap-8 text-center",
|
|
18540
18569
|
role: "status",
|
|
18541
18570
|
"aria-live": "polite",
|
|
18542
18571
|
children: [
|
|
18543
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("div", { className: "flex size-[60px] items-center justify-center rounded-agg-full bg-agg-success", children: /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
|
|
18544
|
-
|
|
18545
|
-
{
|
|
18546
|
-
name: "success-check",
|
|
18547
|
-
className: "size-7 text-agg-on-primary",
|
|
18548
|
-
"aria-hidden": "true"
|
|
18549
|
-
}
|
|
18550
|
-
) }),
|
|
18551
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("div", { className: "flex flex-col items-center gap-4", children: [
|
|
18572
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("div", { className: "flex size-[60px] items-center justify-center rounded-agg-full bg-agg-success/15", children: /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(Icon, { name: "success-check", className: "size-6 text-agg-success", "aria-hidden": "true" }) }),
|
|
18573
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("div", { className: "flex flex-col items-center gap-3", children: [
|
|
18552
18574
|
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)(Dialog5.Title, { className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground", children: labels.onboarding.connectKalshiModal.success.title }),
|
|
18553
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)(Dialog5.Description, { className: "
|
|
18575
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)(Dialog5.Description, { className: "text-agg-base leading-agg-6 text-agg-foreground", children: labels.onboarding.connectKalshiModal.success.description })
|
|
18554
18576
|
] }),
|
|
18555
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
|
|
18556
|
-
Button,
|
|
18557
|
-
{
|
|
18558
|
-
variant: "primary",
|
|
18559
|
-
size: "large",
|
|
18560
|
-
className: "min-w-[120px]",
|
|
18561
|
-
onClick: () => handleOpenChange(false),
|
|
18562
|
-
children: labels.onboarding.connectKalshiModal.success.done
|
|
18563
|
-
}
|
|
18564
|
-
)
|
|
18577
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)(Button, { variant: "secondary", size: "large", onClick: () => handleOpenChange(false), children: labels.onboarding.connectKalshiModal.success.done })
|
|
18565
18578
|
]
|
|
18566
18579
|
}
|
|
18567
|
-
)
|
|
18568
|
-
|
|
18569
|
-
|
|
18570
|
-
|
|
18571
|
-
|
|
18572
|
-
|
|
18573
|
-
|
|
18574
|
-
|
|
18575
|
-
|
|
18576
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepOne.label }),
|
|
18577
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepOne.title })
|
|
18578
|
-
] }),
|
|
18579
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("div", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
18580
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.signIn }),
|
|
18581
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("p", { children: [
|
|
18582
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfilePrefix,
|
|
18583
|
-
" ",
|
|
18584
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileText }),
|
|
18585
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfileSeparator,
|
|
18586
|
-
" ",
|
|
18580
|
+
)
|
|
18581
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("form", { className: "flex min-h-0 flex-1 flex-col", onSubmit: handleSubmit, children: [
|
|
18582
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
|
|
18583
|
+
Modal.Body,
|
|
18584
|
+
{
|
|
18585
|
+
classNames: { root: "relative !px-5 !pb-6 !pt-5 md:!px-10 md:!pb-0 md:!pt-12" },
|
|
18586
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("div", { className: "flex flex-col gap-6 md:items-center md:gap-0", children: [
|
|
18587
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("div", { className: "flex w-full flex-col md:contents", children: [
|
|
18588
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("div", { className: "flex items-center gap-3 md:contents", children: [
|
|
18587
18589
|
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
|
|
18588
|
-
|
|
18590
|
+
VenueLogo,
|
|
18589
18591
|
{
|
|
18590
|
-
|
|
18591
|
-
|
|
18592
|
-
|
|
18593
|
-
className: "
|
|
18594
|
-
|
|
18592
|
+
venue: import_sdk22.Venue.kalshi,
|
|
18593
|
+
variant: "logo",
|
|
18594
|
+
size: "large",
|
|
18595
|
+
className: "!size-10 md:!mb-8 md:!size-[60px]"
|
|
18596
|
+
}
|
|
18597
|
+
),
|
|
18598
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)(Dialog5.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 }),
|
|
18599
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
|
|
18600
|
+
CloseButton,
|
|
18601
|
+
{
|
|
18602
|
+
disabled: isVerifying,
|
|
18603
|
+
className: "ml-auto shrink-0 md:absolute md:right-8 md:top-8 md:ml-0"
|
|
18595
18604
|
}
|
|
18596
18605
|
)
|
|
18597
18606
|
] }),
|
|
18598
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.
|
|
18599
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeyPrefix,
|
|
18600
|
-
" ",
|
|
18601
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKeyText }),
|
|
18602
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeySuffix
|
|
18603
|
-
] }),
|
|
18604
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("p", { children: [
|
|
18605
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsPrefix,
|
|
18606
|
-
" ",
|
|
18607
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.readWriteText }),
|
|
18608
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsSuffix
|
|
18609
|
-
] }),
|
|
18610
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKey })
|
|
18611
|
-
] }),
|
|
18612
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
18613
|
-
labels.onboarding.connectKalshiModal.stepOne.footerLineOne,
|
|
18614
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("br", {}),
|
|
18615
|
-
labels.onboarding.connectKalshiModal.stepOne.footerLineTwo
|
|
18616
|
-
] })
|
|
18617
|
-
] }),
|
|
18618
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-xl bg-agg-secondary-hover p-4", children: [
|
|
18619
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
18620
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.label }),
|
|
18621
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.title })
|
|
18607
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)(Dialog5.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 })
|
|
18622
18608
|
] }),
|
|
18623
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.
|
|
18624
|
-
|
|
18625
|
-
|
|
18626
|
-
|
|
18627
|
-
|
|
18628
|
-
|
|
18629
|
-
|
|
18630
|
-
children: labels.onboarding.connectKalshiModal.
|
|
18631
|
-
|
|
18632
|
-
|
|
18633
|
-
|
|
18634
|
-
|
|
18635
|
-
|
|
18636
|
-
|
|
18637
|
-
|
|
18638
|
-
|
|
18639
|
-
|
|
18640
|
-
|
|
18641
|
-
|
|
18642
|
-
|
|
18643
|
-
|
|
18644
|
-
|
|
18645
|
-
|
|
18646
|
-
|
|
18647
|
-
|
|
18648
|
-
|
|
18649
|
-
|
|
18650
|
-
"
|
|
18609
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("div", { className: "flex w-full flex-col gap-4", children: [
|
|
18610
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-xl bg-agg-secondary-hover p-4", children: [
|
|
18611
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
18612
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepOne.label }),
|
|
18613
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepOne.title })
|
|
18614
|
+
] }),
|
|
18615
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("div", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
18616
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.signIn }),
|
|
18617
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("p", { children: [
|
|
18618
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfilePrefix,
|
|
18619
|
+
" ",
|
|
18620
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileText }),
|
|
18621
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfileSeparator,
|
|
18622
|
+
" ",
|
|
18623
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
|
|
18624
|
+
"a",
|
|
18625
|
+
{
|
|
18626
|
+
href: labels.onboarding.connectKalshiModal.stepOne.instructions.profileUrl,
|
|
18627
|
+
target: "_blank",
|
|
18628
|
+
rel: "noreferrer",
|
|
18629
|
+
className: "cursor-pointer underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
|
|
18630
|
+
children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileUrl
|
|
18631
|
+
}
|
|
18632
|
+
)
|
|
18633
|
+
] }),
|
|
18634
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("p", { children: [
|
|
18635
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeyPrefix,
|
|
18636
|
+
" ",
|
|
18637
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKeyText }),
|
|
18638
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeySuffix
|
|
18639
|
+
] }),
|
|
18640
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("p", { children: [
|
|
18641
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsPrefix,
|
|
18642
|
+
" ",
|
|
18643
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.readWriteText }),
|
|
18644
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsSuffix
|
|
18645
|
+
] }),
|
|
18646
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKey })
|
|
18647
|
+
] }),
|
|
18648
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
18649
|
+
labels.onboarding.connectKalshiModal.stepOne.footerLineOne,
|
|
18650
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("br", {}),
|
|
18651
|
+
labels.onboarding.connectKalshiModal.stepOne.footerLineTwo
|
|
18652
|
+
] })
|
|
18653
|
+
] }),
|
|
18654
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-xl bg-agg-secondary-hover p-4", children: [
|
|
18655
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
18656
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.label }),
|
|
18657
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.title })
|
|
18658
|
+
] }),
|
|
18659
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.description }),
|
|
18660
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
18661
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
|
|
18662
|
+
"label",
|
|
18663
|
+
{
|
|
18664
|
+
htmlFor: "kalshi-api-key-id",
|
|
18665
|
+
className: "text-agg-sm font-agg-bold text-agg-foreground",
|
|
18666
|
+
children: labels.onboarding.connectKalshiModal.stepTwo.apiKeyIdLabel
|
|
18667
|
+
}
|
|
18668
|
+
),
|
|
18669
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
|
|
18670
|
+
"input",
|
|
18671
|
+
{
|
|
18672
|
+
ref: apiKeyInputRef,
|
|
18673
|
+
id: "kalshi-api-key-id",
|
|
18674
|
+
type: "text",
|
|
18675
|
+
autoComplete: "off",
|
|
18676
|
+
value: apiKeyId,
|
|
18677
|
+
onChange: (event) => setApiKeyId(event.target.value),
|
|
18678
|
+
placeholder: labels.onboarding.connectKalshiModal.stepTwo.apiKeyIdPlaceholder,
|
|
18679
|
+
disabled: isVerifying,
|
|
18680
|
+
"aria-invalid": !!error,
|
|
18681
|
+
"aria-describedby": error ? errorId : void 0,
|
|
18682
|
+
className: cn(
|
|
18683
|
+
"h-10 w-full rounded-agg-sm border border-agg-separator bg-agg-secondary px-3 py-2.5",
|
|
18684
|
+
"text-agg-base text-agg-foreground placeholder:text-agg-muted-foreground",
|
|
18685
|
+
"outline-none transition-colors focus:border-agg-primary focus:ring-1 focus:ring-agg-primary",
|
|
18686
|
+
"disabled:cursor-not-allowed disabled:opacity-60"
|
|
18687
|
+
)
|
|
18688
|
+
}
|
|
18651
18689
|
)
|
|
18652
|
-
}
|
|
18653
|
-
|
|
18654
|
-
|
|
18655
|
-
|
|
18656
|
-
|
|
18657
|
-
|
|
18658
|
-
|
|
18659
|
-
|
|
18660
|
-
|
|
18661
|
-
|
|
18662
|
-
|
|
18663
|
-
|
|
18664
|
-
|
|
18665
|
-
|
|
18666
|
-
|
|
18667
|
-
|
|
18668
|
-
|
|
18669
|
-
|
|
18670
|
-
|
|
18671
|
-
|
|
18672
|
-
|
|
18673
|
-
|
|
18674
|
-
|
|
18675
|
-
|
|
18676
|
-
|
|
18677
|
-
|
|
18678
|
-
|
|
18679
|
-
|
|
18680
|
-
|
|
18690
|
+
] }),
|
|
18691
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
18692
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
|
|
18693
|
+
"label",
|
|
18694
|
+
{
|
|
18695
|
+
htmlFor: "kalshi-private-key",
|
|
18696
|
+
className: "text-agg-sm font-agg-bold text-agg-foreground",
|
|
18697
|
+
children: labels.onboarding.connectKalshiModal.stepTwo.privateKeyLabel
|
|
18698
|
+
}
|
|
18699
|
+
),
|
|
18700
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
|
|
18701
|
+
"textarea",
|
|
18702
|
+
{
|
|
18703
|
+
id: "kalshi-private-key",
|
|
18704
|
+
autoComplete: "off",
|
|
18705
|
+
value: privateKey,
|
|
18706
|
+
onChange: (event) => setPrivateKey(event.target.value),
|
|
18707
|
+
placeholder: labels.onboarding.connectKalshiModal.stepTwo.privateKeyPlaceholder,
|
|
18708
|
+
rows: 3,
|
|
18709
|
+
disabled: isVerifying,
|
|
18710
|
+
"aria-invalid": !!error,
|
|
18711
|
+
"aria-describedby": error ? errorId : void 0,
|
|
18712
|
+
className: cn(
|
|
18713
|
+
"w-full resize-none rounded-agg-sm border border-agg-separator bg-agg-secondary px-3 py-2.5",
|
|
18714
|
+
"text-agg-base text-agg-foreground placeholder:text-agg-muted-foreground",
|
|
18715
|
+
"outline-none transition-colors focus:border-agg-primary focus:ring-1 focus:ring-agg-primary",
|
|
18716
|
+
"disabled:cursor-not-allowed disabled:opacity-60"
|
|
18717
|
+
)
|
|
18718
|
+
}
|
|
18681
18719
|
)
|
|
18682
|
-
}
|
|
18683
|
-
)
|
|
18684
|
-
] })
|
|
18685
|
-
] })
|
|
18686
|
-
] }),
|
|
18687
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("div", { className: "flex w-full items-center justify-between gap-4", children: [
|
|
18688
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("p", { className: "text-agg-base text-agg-foreground", children: labels.onboarding.connectKalshiModal.help.label }),
|
|
18689
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
18690
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("span", { className: "flex items-center gap-2 text-agg-base font-agg-bold text-agg-primary", children: [
|
|
18691
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)(Icon, { name: "document", size: "small", className: "size-4 text-agg-primary" }),
|
|
18692
|
-
labels.onboarding.connectKalshiModal.help.docsLinkLabel
|
|
18720
|
+
] })
|
|
18721
|
+
] })
|
|
18693
18722
|
] }),
|
|
18694
|
-
/* @__PURE__ */ (0, import_jsx_runtime163.
|
|
18695
|
-
|
|
18696
|
-
|
|
18697
|
-
|
|
18698
|
-
|
|
18723
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime163.jsxs)(
|
|
18724
|
+
"div",
|
|
18725
|
+
{
|
|
18726
|
+
id: errorId,
|
|
18727
|
+
className: "flex items-center gap-2 md:justify-center",
|
|
18728
|
+
role: "alert",
|
|
18729
|
+
"aria-live": "assertive",
|
|
18730
|
+
children: [
|
|
18731
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)(Icon, { name: "warning", size: "small", className: "size-3.5 text-agg-error" }),
|
|
18732
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
|
|
18733
|
+
]
|
|
18734
|
+
}
|
|
18735
|
+
) : null
|
|
18699
18736
|
] })
|
|
18700
|
-
|
|
18701
|
-
|
|
18702
|
-
|
|
18703
|
-
|
|
18704
|
-
|
|
18705
|
-
|
|
18706
|
-
|
|
18707
|
-
|
|
18708
|
-
|
|
18709
|
-
|
|
18710
|
-
|
|
18711
|
-
|
|
18712
|
-
|
|
18713
|
-
|
|
18714
|
-
|
|
18715
|
-
|
|
18737
|
+
}
|
|
18738
|
+
),
|
|
18739
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsxs)(
|
|
18740
|
+
Modal.Footer,
|
|
18741
|
+
{
|
|
18742
|
+
classNames: {
|
|
18743
|
+
root: "relative !h-auto !gap-3 !p-4 md:!justify-center md:!border-0 md:!px-10 md:!pb-12 md:!pt-8"
|
|
18744
|
+
},
|
|
18745
|
+
children: [
|
|
18746
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
|
|
18747
|
+
"div",
|
|
18748
|
+
{
|
|
18749
|
+
"aria-hidden": "true",
|
|
18750
|
+
className: "pointer-events-none absolute inset-x-0 -top-[60px] h-[60px] bg-gradient-to-b from-transparent to-agg-secondary md:hidden"
|
|
18751
|
+
}
|
|
18752
|
+
),
|
|
18716
18753
|
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
|
|
18717
18754
|
Button,
|
|
18718
18755
|
{
|
|
18719
18756
|
variant: "secondary",
|
|
18720
18757
|
size: "large",
|
|
18758
|
+
className: "shrink-0",
|
|
18721
18759
|
onClick: () => handleOpenChange(false),
|
|
18722
18760
|
disabled: isVerifying,
|
|
18723
18761
|
children: labels.onboarding.connectKalshiModal.actions.cancel
|
|
@@ -18729,15 +18767,16 @@ var ConnectKalshiModal = ({
|
|
|
18729
18767
|
type: "submit",
|
|
18730
18768
|
variant: "primary",
|
|
18731
18769
|
size: "large",
|
|
18770
|
+
className: "flex-1 md:flex-none",
|
|
18732
18771
|
disabled: !parsedCredentials.success || isVerifying,
|
|
18733
18772
|
isLoading: isVerifying,
|
|
18734
18773
|
children: labels.onboarding.connectKalshiModal.actions.verifyConnection
|
|
18735
18774
|
}
|
|
18736
18775
|
)
|
|
18737
|
-
]
|
|
18738
|
-
|
|
18739
|
-
|
|
18740
|
-
]
|
|
18776
|
+
]
|
|
18777
|
+
}
|
|
18778
|
+
)
|
|
18779
|
+
] })
|
|
18741
18780
|
}
|
|
18742
18781
|
) });
|
|
18743
18782
|
};
|
|
@@ -19225,14 +19264,10 @@ var routePriceLabelFormatter = new Intl.NumberFormat("en-US", {
|
|
|
19225
19264
|
minimumFractionDigits: 0,
|
|
19226
19265
|
maximumFractionDigits: 1
|
|
19227
19266
|
});
|
|
19228
|
-
var PLACE_ORDER_PRICE_DISPLAY_MULTIPLIER = 1e3;
|
|
19229
19267
|
var GEO_BLOCK_WARNING_PREFIX = "Venue not available in your region";
|
|
19230
19268
|
var isFiniteNonNegativePrice = (value) => {
|
|
19231
19269
|
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
19232
19270
|
};
|
|
19233
|
-
var isPredictionMarketPrice = (value) => {
|
|
19234
|
-
return isFiniteNonNegativePrice(value) && value <= 1;
|
|
19235
|
-
};
|
|
19236
19271
|
var getPlaceOrderAverageExecutionPrice = (quoteData) => {
|
|
19237
19272
|
var _a;
|
|
19238
19273
|
if (!quoteData || quoteData.totalFilled <= 0) return null;
|
|
@@ -19243,22 +19278,6 @@ var getPlaceOrderAverageExecutionPrice = (quoteData) => {
|
|
|
19243
19278
|
const averageExecutionPrice = quoteData.rawExecCost / quoteData.totalFilled;
|
|
19244
19279
|
return isFiniteNonNegativePrice(averageExecutionPrice) ? averageExecutionPrice : null;
|
|
19245
19280
|
};
|
|
19246
|
-
var isPlaceOrderAveragePriceWorse = ({
|
|
19247
|
-
averageExecutionPrice,
|
|
19248
|
-
displayedMarketPrice,
|
|
19249
|
-
tradeSide
|
|
19250
|
-
}) => {
|
|
19251
|
-
if (!isPredictionMarketPrice(averageExecutionPrice) || !isPredictionMarketPrice(displayedMarketPrice)) {
|
|
19252
|
-
return false;
|
|
19253
|
-
}
|
|
19254
|
-
const displayedAveragePrice = Math.round(
|
|
19255
|
-
averageExecutionPrice * PLACE_ORDER_PRICE_DISPLAY_MULTIPLIER
|
|
19256
|
-
);
|
|
19257
|
-
const displayedReferencePrice = Math.round(
|
|
19258
|
-
displayedMarketPrice * PLACE_ORDER_PRICE_DISPLAY_MULTIPLIER
|
|
19259
|
-
);
|
|
19260
|
-
return tradeSide === "buy" ? displayedAveragePrice > displayedReferencePrice : displayedAveragePrice < displayedReferencePrice;
|
|
19261
|
-
};
|
|
19262
19281
|
var floorToDecimals = (value, decimals) => {
|
|
19263
19282
|
if (!Number.isFinite(value) || value <= 0) return 0;
|
|
19264
19283
|
const [coefficient = "0", exponentText = "0"] = value.toString().toLowerCase().split("e");
|
|
@@ -19869,16 +19888,21 @@ var buildLiveRouteCards = ({
|
|
|
19869
19888
|
})() : [];
|
|
19870
19889
|
return [...baseCards, ...unavailableCards, ...warningOnlyUnavailableCards];
|
|
19871
19890
|
};
|
|
19872
|
-
var
|
|
19873
|
-
|
|
19891
|
+
var routeCardRequiresKalshi = (card) => card.venue === "kalshi" || card.quoteData.fills.some((fill) => fill.venue === "kalshi");
|
|
19892
|
+
var resolveDefaultRouteCardId = (routeCards, primaryStatus, options) => {
|
|
19893
|
+
var _a, _b, _c, _d, _e, _f;
|
|
19874
19894
|
if (routeCards.length === 0) return null;
|
|
19875
|
-
const
|
|
19876
|
-
|
|
19877
|
-
|
|
19895
|
+
const isExecutableCard = (card) => !card.isUnavailable && card.quoteData.status === "ok" && !!card.quoteData.quoteId;
|
|
19896
|
+
if (options == null ? void 0 : options.isKalshiDisconnected) {
|
|
19897
|
+
const nonKalshiCards = routeCards.filter((card) => !routeCardRequiresKalshi(card));
|
|
19898
|
+
const preferredCard = (_a = nonKalshiCards.find(isExecutableCard)) != null ? _a : nonKalshiCards.find((card) => !card.isUnavailable);
|
|
19899
|
+
if (preferredCard) return preferredCard.id;
|
|
19900
|
+
}
|
|
19901
|
+
const firstExecutableCard = routeCards.find(isExecutableCard);
|
|
19878
19902
|
if (primaryStatus === "insufficient_balance") {
|
|
19879
19903
|
if (firstExecutableCard) return firstExecutableCard.id;
|
|
19880
19904
|
}
|
|
19881
|
-
return (
|
|
19905
|
+
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;
|
|
19882
19906
|
};
|
|
19883
19907
|
var getPlaceOrderRouteCardIdentity = (card) => {
|
|
19884
19908
|
var _a;
|
|
@@ -21084,9 +21108,9 @@ var deriveBackendExecutionOrderGroups = ({
|
|
|
21084
21108
|
return [__spreadProps(__spreadValues({ id: order.orderId }, presentation), { steps })];
|
|
21085
21109
|
});
|
|
21086
21110
|
const allOrdersTerminal = executionOrders.every((order) => order.event !== null);
|
|
21087
|
-
return deriveSequentialDisplayGroups(realGroups, allOrdersTerminal);
|
|
21111
|
+
return deriveSequentialDisplayGroups(realGroups, allOrdersTerminal, "per-leg");
|
|
21088
21112
|
};
|
|
21089
|
-
var deriveSequentialDisplayGroups = (groups, revealTerminalOutcomes = false) => {
|
|
21113
|
+
var deriveSequentialDisplayGroups = (groups, revealTerminalOutcomes = false, scope = "global") => {
|
|
21090
21114
|
if (revealTerminalOutcomes) {
|
|
21091
21115
|
return groups.map((group) => __spreadProps(__spreadValues({}, group), {
|
|
21092
21116
|
steps: group.steps.map((_a) => {
|
|
@@ -21096,19 +21120,22 @@ var deriveSequentialDisplayGroups = (groups, revealTerminalOutcomes = false) =>
|
|
|
21096
21120
|
}));
|
|
21097
21121
|
}
|
|
21098
21122
|
let hasUnresolvedPredecessor = false;
|
|
21099
|
-
return groups.map((group) =>
|
|
21100
|
-
|
|
21101
|
-
|
|
21102
|
-
|
|
21103
|
-
|
|
21104
|
-
|
|
21105
|
-
|
|
21106
|
-
|
|
21107
|
-
|
|
21108
|
-
|
|
21109
|
-
|
|
21110
|
-
|
|
21111
|
-
|
|
21123
|
+
return groups.map((group) => {
|
|
21124
|
+
if (scope === "per-leg") hasUnresolvedPredecessor = false;
|
|
21125
|
+
return __spreadProps(__spreadValues({}, group), {
|
|
21126
|
+
steps: group.steps.map((_a) => {
|
|
21127
|
+
var _b = _a, { realStatus } = _b, step = __objRest(_b, ["realStatus"]);
|
|
21128
|
+
if (hasUnresolvedPredecessor) {
|
|
21129
|
+
return __spreadProps(__spreadValues({}, step), { status: "not-started" });
|
|
21130
|
+
}
|
|
21131
|
+
if (realStatus === "done") {
|
|
21132
|
+
return __spreadProps(__spreadValues({}, step), { status: "done" });
|
|
21133
|
+
}
|
|
21134
|
+
hasUnresolvedPredecessor = true;
|
|
21135
|
+
return __spreadProps(__spreadValues({}, step), { status: realStatus });
|
|
21136
|
+
})
|
|
21137
|
+
});
|
|
21138
|
+
});
|
|
21112
21139
|
};
|
|
21113
21140
|
var deriveExecutionOrderGroups = ({
|
|
21114
21141
|
quoteData,
|
|
@@ -21329,6 +21356,7 @@ var calculateExecutionProgress = ({
|
|
|
21329
21356
|
};
|
|
21330
21357
|
|
|
21331
21358
|
// src/trading/place-order/index.place-order.execution-view.tsx
|
|
21359
|
+
var import_react37 = require("react");
|
|
21332
21360
|
var import_jsx_runtime166 = require("react/jsx-runtime");
|
|
21333
21361
|
var PlaceOrderExecutionHeader = ({
|
|
21334
21362
|
className,
|
|
@@ -21351,6 +21379,85 @@ var PlaceOrderExecutionHeader = ({
|
|
|
21351
21379
|
eventDateLabel ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: eventDateLabel }) : null
|
|
21352
21380
|
] });
|
|
21353
21381
|
};
|
|
21382
|
+
var PROGRESS_TWEEN_MS = 700;
|
|
21383
|
+
var prefersReducedMotion = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
21384
|
+
var useTweenedProgress = (target, enabled) => {
|
|
21385
|
+
const [value, setValue] = (0, import_react37.useState)(target);
|
|
21386
|
+
const valueRef = (0, import_react37.useRef)(target);
|
|
21387
|
+
(0, import_react37.useEffect)(() => {
|
|
21388
|
+
const from = valueRef.current;
|
|
21389
|
+
if (!enabled || from === target || prefersReducedMotion()) {
|
|
21390
|
+
valueRef.current = target;
|
|
21391
|
+
setValue(target);
|
|
21392
|
+
return;
|
|
21393
|
+
}
|
|
21394
|
+
let frame = 0;
|
|
21395
|
+
const start = performance.now();
|
|
21396
|
+
const tick = (now) => {
|
|
21397
|
+
const t = Math.min(1, (now - start) / PROGRESS_TWEEN_MS);
|
|
21398
|
+
const eased = 1 - Math.pow(1 - t, 3);
|
|
21399
|
+
const next = Math.round(from + (target - from) * eased);
|
|
21400
|
+
valueRef.current = next;
|
|
21401
|
+
setValue(next);
|
|
21402
|
+
if (t < 1) frame = requestAnimationFrame(tick);
|
|
21403
|
+
};
|
|
21404
|
+
frame = requestAnimationFrame(tick);
|
|
21405
|
+
return () => cancelAnimationFrame(frame);
|
|
21406
|
+
}, [enabled, target]);
|
|
21407
|
+
return value;
|
|
21408
|
+
};
|
|
21409
|
+
var ExecutionProgressBar = ({
|
|
21410
|
+
enableAnimations,
|
|
21411
|
+
label: label2,
|
|
21412
|
+
progress
|
|
21413
|
+
}) => {
|
|
21414
|
+
const clamped = Math.max(0, Math.min(100, progress));
|
|
21415
|
+
const displayed = useTweenedProgress(clamped, enableAnimations);
|
|
21416
|
+
const isRunning = clamped < 100;
|
|
21417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
21418
|
+
/* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("p", { className: "shrink-0 tabular-nums text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
|
|
21419
|
+
displayed,
|
|
21420
|
+
"%"
|
|
21421
|
+
] }),
|
|
21422
|
+
/* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
|
|
21423
|
+
"div",
|
|
21424
|
+
{
|
|
21425
|
+
role: "progressbar",
|
|
21426
|
+
"aria-label": label2,
|
|
21427
|
+
"aria-valuemin": 0,
|
|
21428
|
+
"aria-valuemax": 100,
|
|
21429
|
+
"aria-valuenow": clamped,
|
|
21430
|
+
className: "relative h-1 min-w-0 flex-1 overflow-hidden rounded-agg-full bg-agg-separator",
|
|
21431
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
|
|
21432
|
+
"div",
|
|
21433
|
+
{
|
|
21434
|
+
className: cn(
|
|
21435
|
+
"absolute inset-y-0 left-0 overflow-hidden rounded-agg-full bg-agg-primary",
|
|
21436
|
+
getMotionClassName(
|
|
21437
|
+
enableAnimations,
|
|
21438
|
+
"transition-[width] duration-700 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none"
|
|
21439
|
+
)
|
|
21440
|
+
),
|
|
21441
|
+
style: { width: `${clamped}%` },
|
|
21442
|
+
children: isRunning ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
|
|
21443
|
+
"span",
|
|
21444
|
+
{
|
|
21445
|
+
"aria-hidden": "true",
|
|
21446
|
+
className: cn(
|
|
21447
|
+
"absolute inset-0 hidden bg-gradient-to-r from-transparent via-white/40 to-transparent",
|
|
21448
|
+
getMotionClassName(
|
|
21449
|
+
enableAnimations,
|
|
21450
|
+
"motion-safe:block motion-safe:animate-agg-progress-shimmer"
|
|
21451
|
+
)
|
|
21452
|
+
)
|
|
21453
|
+
}
|
|
21454
|
+
) : null
|
|
21455
|
+
}
|
|
21456
|
+
)
|
|
21457
|
+
}
|
|
21458
|
+
)
|
|
21459
|
+
] });
|
|
21460
|
+
};
|
|
21354
21461
|
var ExecutionStepIndicator = ({
|
|
21355
21462
|
enableAnimations,
|
|
21356
21463
|
step
|
|
@@ -21486,21 +21593,14 @@ var PlaceOrderExecutionView = ({
|
|
|
21486
21593
|
}
|
|
21487
21594
|
),
|
|
21488
21595
|
/* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.content), children: [
|
|
21489
|
-
/* @__PURE__ */ (0, import_jsx_runtime166.
|
|
21490
|
-
|
|
21491
|
-
|
|
21492
|
-
|
|
21493
|
-
|
|
21494
|
-
|
|
21495
|
-
|
|
21496
|
-
|
|
21497
|
-
"aria-label": labels.executingOrder,
|
|
21498
|
-
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",
|
|
21499
|
-
max: 100,
|
|
21500
|
-
value: progress
|
|
21501
|
-
}
|
|
21502
|
-
)
|
|
21503
|
-
] }),
|
|
21596
|
+
/* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
|
|
21597
|
+
ExecutionProgressBar,
|
|
21598
|
+
{
|
|
21599
|
+
enableAnimations,
|
|
21600
|
+
label: labels.executingOrder,
|
|
21601
|
+
progress
|
|
21602
|
+
}
|
|
21603
|
+
),
|
|
21504
21604
|
/* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
|
|
21505
21605
|
PlaceOrderExecutionGroups,
|
|
21506
21606
|
{
|
|
@@ -21748,7 +21848,7 @@ var PlaceOrderSuccessView = ({
|
|
|
21748
21848
|
/* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
21749
21849
|
/* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "flex min-w-0 flex-col gap-0.5", children: [
|
|
21750
21850
|
/* @__PURE__ */ (0, import_jsx_runtime168.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.orderPayout }),
|
|
21751
|
-
potentialReturnLabel ? /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("span", { className: "
|
|
21851
|
+
potentialReturnLabel ? /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("span", { className: "agg-type-overline agg-text-brand", children: potentialReturnLabel }) : null
|
|
21752
21852
|
] }),
|
|
21753
21853
|
/* @__PURE__ */ (0, import_jsx_runtime168.jsx)("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-success", children: resolvedPayoutLabel })
|
|
21754
21854
|
] })
|
|
@@ -21890,24 +21990,24 @@ var PlaceOrderSlippageControl = ({
|
|
|
21890
21990
|
}) => {
|
|
21891
21991
|
var _a, _b;
|
|
21892
21992
|
const labels = (0, import_hooks67.useLabels)();
|
|
21893
|
-
const containerRef = (0,
|
|
21894
|
-
const triggerRef = (0,
|
|
21895
|
-
const inputRef = (0,
|
|
21896
|
-
const warningId = (0,
|
|
21993
|
+
const containerRef = (0, import_react39.useRef)(null);
|
|
21994
|
+
const triggerRef = (0, import_react39.useRef)(null);
|
|
21995
|
+
const inputRef = (0, import_react39.useRef)(null);
|
|
21996
|
+
const warningId = (0, import_react39.useId)();
|
|
21897
21997
|
const defaultValue = finalizePercentageValue(slippageDefaultValue);
|
|
21898
21998
|
const committedValue = finalizePercentageValue(slippageValue) || defaultValue;
|
|
21899
|
-
const [draftValue, setDraftValue] = (0,
|
|
21900
|
-
const [isEditing, setIsEditing] = (0,
|
|
21999
|
+
const [draftValue, setDraftValue] = (0, import_react39.useState)(committedValue);
|
|
22000
|
+
const [isEditing, setIsEditing] = (0, import_react39.useState)(
|
|
21901
22001
|
() => isPercentageBelowMinimum(committedValue, slippageMinimumValue)
|
|
21902
22002
|
);
|
|
21903
|
-
const [shouldFocusInput, setShouldFocusInput] = (0,
|
|
21904
|
-
(0,
|
|
22003
|
+
const [shouldFocusInput, setShouldFocusInput] = (0, import_react39.useState)(false);
|
|
22004
|
+
(0, import_react39.useEffect)(() => {
|
|
21905
22005
|
setDraftValue(committedValue);
|
|
21906
22006
|
if (isPercentageBelowMinimum(committedValue, slippageMinimumValue)) {
|
|
21907
22007
|
setIsEditing(true);
|
|
21908
22008
|
}
|
|
21909
22009
|
}, [committedValue, slippageMinimumValue]);
|
|
21910
|
-
(0,
|
|
22010
|
+
(0, import_react39.useEffect)(() => {
|
|
21911
22011
|
if (!shouldFocusInput) return;
|
|
21912
22012
|
requestAnimationFrame(() => {
|
|
21913
22013
|
var _a2, _b2;
|
|
@@ -21924,7 +22024,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
21924
22024
|
Number(committedValue || slippageDefaultValue || DEFAULT_SLIPPAGE_VALUE)
|
|
21925
22025
|
);
|
|
21926
22026
|
const resolvedAutoLabel = labels.trading.resetSlippage;
|
|
21927
|
-
const resolvedWarningMessage = (0,
|
|
22027
|
+
const resolvedWarningMessage = (0, import_react39.useMemo)(() => {
|
|
21928
22028
|
if (isLowSlippage) {
|
|
21929
22029
|
return labels.trading.slippageLow(slippageMinimumValue);
|
|
21930
22030
|
}
|
|
@@ -22331,13 +22431,15 @@ var renderRouteCard = ({
|
|
|
22331
22431
|
isExpanded,
|
|
22332
22432
|
isSelected,
|
|
22333
22433
|
onSelect,
|
|
22434
|
+
isKalshiDisconnected = false,
|
|
22334
22435
|
sharedKycStatus,
|
|
22335
22436
|
tradingLabels
|
|
22336
22437
|
}) => {
|
|
22337
22438
|
var _a, _b, _c;
|
|
22338
22439
|
const showSharedKycRequirement = card.requiresSharedKyc === true && sharedKycStatus !== void 0 && sharedKycStatus !== "verified" && !card.isUnavailable;
|
|
22440
|
+
const showKalshiRequirement = isKalshiDisconnected && card.kind === "venue" && card.venue === "kalshi" && !isSelected && !card.isUnavailable;
|
|
22339
22441
|
const showSplitDetails = isSelected && isExpanded && card.kind === "split" && !!((_a = card.rows) == null ? void 0 : _a.length);
|
|
22340
|
-
const displayedHint = showSharedKycRequirement ? tradingLabels.sharedKyc.required : card.hint;
|
|
22442
|
+
const displayedHint = showKalshiRequirement ? tradingLabels.requiresKalshiAccount : showSharedKycRequirement ? tradingLabels.sharedKyc.required : card.hint;
|
|
22341
22443
|
const ariaLabel = [card.label, displayedHint, card.value].filter(Boolean).join(" ");
|
|
22342
22444
|
return /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
|
|
22343
22445
|
"button",
|
|
@@ -22391,7 +22493,7 @@ var renderRouteCard = ({
|
|
|
22391
22493
|
className: "shrink-0 text-agg-muted-foreground",
|
|
22392
22494
|
"aria-hidden": "true"
|
|
22393
22495
|
}
|
|
22394
|
-
) : showSharedKycRequirement || card.insufficientInventory ? /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
|
|
22496
|
+
) : showKalshiRequirement || showSharedKycRequirement || card.insufficientInventory ? /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
|
|
22395
22497
|
Icon,
|
|
22396
22498
|
{
|
|
22397
22499
|
name: "warning",
|
|
@@ -22474,10 +22576,10 @@ var PlaceOrder = ({
|
|
|
22474
22576
|
const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
|
|
22475
22577
|
const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
|
|
22476
22578
|
const selectedOutcomeId = (_c = tradingContext == null ? void 0 : tradingContext.selectedOutcomeId) != null ? _c : null;
|
|
22477
|
-
const resolvedEventTradingState = (0,
|
|
22579
|
+
const resolvedEventTradingState = (0, import_react39.useMemo)(() => {
|
|
22478
22580
|
return eventTradingState != null ? eventTradingState : (0, import_hooks67.resolveEventTradingState)(selectedEvent);
|
|
22479
22581
|
}, [eventTradingState, selectedEvent]);
|
|
22480
|
-
const scopedSelectedEvent = (0,
|
|
22582
|
+
const scopedSelectedEvent = (0, import_react39.useMemo)(() => {
|
|
22481
22583
|
var _a2;
|
|
22482
22584
|
if (!selectedEvent) return null;
|
|
22483
22585
|
const primaryMarketId = (_a2 = resolvedEventTradingState.primaryMarket) == null ? void 0 : _a2.id;
|
|
@@ -22487,7 +22589,7 @@ var PlaceOrder = ({
|
|
|
22487
22589
|
);
|
|
22488
22590
|
return isSelectedEventInScope ? selectedEvent : null;
|
|
22489
22591
|
}, [(_d = resolvedEventTradingState.primaryMarket) == null ? void 0 : _d.id, selectedEvent]);
|
|
22490
|
-
const scopedSelectedMarket = (0,
|
|
22592
|
+
const scopedSelectedMarket = (0, import_react39.useMemo)(() => {
|
|
22491
22593
|
if (!selectedMarket) return resolvedEventTradingState.primaryMarket;
|
|
22492
22594
|
const isSelectedMarketInScope = resolvedEventTradingState.marketStates.some(
|
|
22493
22595
|
(item) => item.market.id === selectedMarket.id
|
|
@@ -22502,10 +22604,10 @@ var PlaceOrder = ({
|
|
|
22502
22604
|
(outcome) => outcome.label.trim().toLowerCase() === "yes"
|
|
22503
22605
|
)) != null ? _f : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes[0]) != null ? _g : null;
|
|
22504
22606
|
const scopedSelectedOutcomeId = (_h = scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.id) != null ? _h : null;
|
|
22505
|
-
const resolvedTradingState = (0,
|
|
22607
|
+
const resolvedTradingState = (0, import_react39.useMemo)(() => {
|
|
22506
22608
|
return (0, import_hooks67.resolveMarketTradingState)(scopedSelectedMarket);
|
|
22507
22609
|
}, [scopedSelectedMarket]);
|
|
22508
|
-
const resolvedReadOnlyMarket = (0,
|
|
22610
|
+
const resolvedReadOnlyMarket = (0, import_react39.useMemo)(() => {
|
|
22509
22611
|
var _a2;
|
|
22510
22612
|
if (resolvedEventTradingState.kind !== "resolved") {
|
|
22511
22613
|
return scopedSelectedMarket;
|
|
@@ -22516,11 +22618,11 @@ var PlaceOrder = ({
|
|
|
22516
22618
|
resolvedEventTradingState.primaryMarket,
|
|
22517
22619
|
scopedSelectedMarket
|
|
22518
22620
|
]);
|
|
22519
|
-
const resolvedReadOnlyTradingState = (0,
|
|
22621
|
+
const resolvedReadOnlyTradingState = (0, import_react39.useMemo)(() => {
|
|
22520
22622
|
return (0, import_hooks67.resolveMarketTradingState)(resolvedReadOnlyMarket);
|
|
22521
22623
|
}, [resolvedReadOnlyMarket]);
|
|
22522
22624
|
const isEndedWithoutKnownWinner = showResolvingState && !resolvedEventTradingState.winningOutcome && !resolvedReadOnlyTradingState.winningOutcome;
|
|
22523
|
-
const orderEligibility = (0,
|
|
22625
|
+
const orderEligibility = (0, import_react39.useMemo)(
|
|
22524
22626
|
() => (0, import_hooks67.resolveOrderEligibility)({
|
|
22525
22627
|
event: scopedSelectedEvent,
|
|
22526
22628
|
market: scopedSelectedMarket,
|
|
@@ -22543,7 +22645,7 @@ var PlaceOrder = ({
|
|
|
22543
22645
|
enabled: Boolean(isAuthenticated && isPaperMode),
|
|
22544
22646
|
mode: "paper"
|
|
22545
22647
|
});
|
|
22546
|
-
const paperTotalBalance = (0,
|
|
22648
|
+
const paperTotalBalance = (0, import_react39.useMemo)(() => {
|
|
22547
22649
|
var _a2, _b2;
|
|
22548
22650
|
const cash = (_b2 = (_a2 = paperBalancesQuery.balances) == null ? void 0 : _a2.cash) != null ? _b2 : [];
|
|
22549
22651
|
return cash.reduce((sum, token) => {
|
|
@@ -22568,8 +22670,8 @@ var PlaceOrder = ({
|
|
|
22568
22670
|
import_sdk24.Venue.kalshi,
|
|
22569
22671
|
isAuthenticated
|
|
22570
22672
|
);
|
|
22571
|
-
const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0,
|
|
22572
|
-
const [isFundKalshiModalOpen, setIsFundKalshiModalOpen] = (0,
|
|
22673
|
+
const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0, import_react39.useState)(false);
|
|
22674
|
+
const [isFundKalshiModalOpen, setIsFundKalshiModalOpen] = (0, import_react39.useState)(false);
|
|
22573
22675
|
const livePrices = (0, import_hooks67.useLiveOutcomePrices)(
|
|
22574
22676
|
scopedSelectedMarket ? [scopedSelectedMarket] : void 0
|
|
22575
22677
|
);
|
|
@@ -22581,41 +22683,41 @@ var PlaceOrder = ({
|
|
|
22581
22683
|
const clusterBestMidpointsByOutcomeId = (_j = clusterMidpointResult.bestMidpointsByOutcomeId) != null ? _j : clusterMidpointResult.prices;
|
|
22582
22684
|
const clusterBestMidpoint = clusterMidpointResult.bestMidpoint;
|
|
22583
22685
|
const clusterBestPricesRest = clusterMidpointResult.bestPrices;
|
|
22584
|
-
const clusterBestPrices = (0,
|
|
22686
|
+
const clusterBestPrices = (0, import_react39.useMemo)(
|
|
22585
22687
|
() => (0, import_hooks67.mergeBestPricesPreferringLive)(clusterBestPricesRest, wsBestPrices),
|
|
22586
22688
|
[clusterBestPricesRest, wsBestPrices]
|
|
22587
22689
|
);
|
|
22588
|
-
const [internalTab, setInternalTab] = (0,
|
|
22589
|
-
const [executionType, setExecutionType] = (0,
|
|
22590
|
-
const [selectedLimitVenue, setSelectedLimitVenue] = (0,
|
|
22591
|
-
const [limitPrice, setLimitPrice] = (0,
|
|
22592
|
-
const [limitPriceInputValue, setLimitPriceInputValue] = (0,
|
|
22593
|
-
const [limitPriceInputError, setLimitPriceInputError] = (0,
|
|
22594
|
-
const [limitExpirationType, setLimitExpirationType] = (0,
|
|
22595
|
-
const [limitExpirationDate, setLimitExpirationDate] = (0,
|
|
22596
|
-
const [limitExpirationTime, setLimitExpirationTime] = (0,
|
|
22597
|
-
const [limitExpirationDraftDate, setLimitExpirationDraftDate] = (0,
|
|
22598
|
-
const [limitExpirationDraftTime, setLimitExpirationDraftTime] = (0,
|
|
22599
|
-
const [limitExpirationPickerView, setLimitExpirationPickerView] = (0,
|
|
22600
|
-
const [isLimitExpirationPickerOpen, setIsLimitExpirationPickerOpen] = (0,
|
|
22601
|
-
const [internalAmount, setInternalAmount] = (0,
|
|
22602
|
-
const [sellFilledForOutcomeId, setSellFilledForOutcomeId] = (0,
|
|
22603
|
-
const [internalSlippage] = (0,
|
|
22604
|
-
const [isRoutesExpanded, setIsRoutesExpanded] = (0,
|
|
22605
|
-
const [selectedRouteCardId, setSelectedRouteCardId] = (0,
|
|
22606
|
-
const [manualRouteSelectionIdentity, setManualRouteSelectionIdentity] = (0,
|
|
22690
|
+
const [internalTab, setInternalTab] = (0, import_react39.useState)("buy");
|
|
22691
|
+
const [executionType, setExecutionType] = (0, import_react39.useState)("market");
|
|
22692
|
+
const [selectedLimitVenue, setSelectedLimitVenue] = (0, import_react39.useState)(null);
|
|
22693
|
+
const [limitPrice, setLimitPrice] = (0, import_react39.useState)(0.5);
|
|
22694
|
+
const [limitPriceInputValue, setLimitPriceInputValue] = (0, import_react39.useState)(formatLimitPriceInputValue(0.5));
|
|
22695
|
+
const [limitPriceInputError, setLimitPriceInputError] = (0, import_react39.useState)(null);
|
|
22696
|
+
const [limitExpirationType, setLimitExpirationType] = (0, import_react39.useState)("GTC");
|
|
22697
|
+
const [limitExpirationDate, setLimitExpirationDate] = (0, import_react39.useState)(void 0);
|
|
22698
|
+
const [limitExpirationTime, setLimitExpirationTime] = (0, import_react39.useState)("17:00");
|
|
22699
|
+
const [limitExpirationDraftDate, setLimitExpirationDraftDate] = (0, import_react39.useState)();
|
|
22700
|
+
const [limitExpirationDraftTime, setLimitExpirationDraftTime] = (0, import_react39.useState)("17:00");
|
|
22701
|
+
const [limitExpirationPickerView, setLimitExpirationPickerView] = (0, import_react39.useState)("options");
|
|
22702
|
+
const [isLimitExpirationPickerOpen, setIsLimitExpirationPickerOpen] = (0, import_react39.useState)(false);
|
|
22703
|
+
const [internalAmount, setInternalAmount] = (0, import_react39.useState)(PLACE_ORDER_DEFAULT_AMOUNT);
|
|
22704
|
+
const [sellFilledForOutcomeId, setSellFilledForOutcomeId] = (0, import_react39.useState)(null);
|
|
22705
|
+
const [internalSlippage] = (0, import_react39.useState)(DEFAULT_SLIPPAGE_VALUE);
|
|
22706
|
+
const [isRoutesExpanded, setIsRoutesExpanded] = (0, import_react39.useState)(false);
|
|
22707
|
+
const [selectedRouteCardId, setSelectedRouteCardId] = (0, import_react39.useState)(null);
|
|
22708
|
+
const [manualRouteSelectionIdentity, setManualRouteSelectionIdentity] = (0, import_react39.useState)(
|
|
22607
22709
|
null
|
|
22608
22710
|
);
|
|
22609
|
-
const [isSplitDetailOpen, setIsSplitDetailOpen] = (0,
|
|
22610
|
-
const [buyGeoBlockSnapshot, setBuyGeoBlockSnapshot] = (0,
|
|
22611
|
-
const [submissionFeedback, setSubmissionFeedback] = (0,
|
|
22612
|
-
const [submissionProgressState, setSubmissionProgressState] = (0,
|
|
22613
|
-
const [isBeforeActionPending, setIsBeforeActionPending] = (0,
|
|
22614
|
-
const outcomes = (0,
|
|
22711
|
+
const [isSplitDetailOpen, setIsSplitDetailOpen] = (0, import_react39.useState)(false);
|
|
22712
|
+
const [buyGeoBlockSnapshot, setBuyGeoBlockSnapshot] = (0, import_react39.useState)(null);
|
|
22713
|
+
const [submissionFeedback, setSubmissionFeedback] = (0, import_react39.useState)(null);
|
|
22714
|
+
const [submissionProgressState, setSubmissionProgressState] = (0, import_react39.useState)(null);
|
|
22715
|
+
const [isBeforeActionPending, setIsBeforeActionPending] = (0, import_react39.useState)(false);
|
|
22716
|
+
const outcomes = (0, import_react39.useMemo)(
|
|
22615
22717
|
() => mapVenueMarketOutcomesToPlaceOrderOutcomes(scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes),
|
|
22616
22718
|
[scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes]
|
|
22617
22719
|
);
|
|
22618
|
-
const selectedOutcomeDisplayPrice = (0,
|
|
22720
|
+
const selectedOutcomeDisplayPrice = (0, import_react39.useMemo)(() => {
|
|
22619
22721
|
var _a2;
|
|
22620
22722
|
if (!scopedSelectedOutcomeId || !scopedSelectedOutcome) return 0.5;
|
|
22621
22723
|
return getDisplayOutcomePrice({
|
|
@@ -22638,25 +22740,25 @@ var PlaceOrder = ({
|
|
|
22638
22740
|
scopedSelectedOutcomeId,
|
|
22639
22741
|
tradingContext == null ? void 0 : tradingContext.tradeSide
|
|
22640
22742
|
]);
|
|
22641
|
-
const buyTabRef = (0,
|
|
22642
|
-
const sellTabRef = (0,
|
|
22643
|
-
const expirationTriggerRef = (0,
|
|
22644
|
-
const limitPriceInitializedForOutcomeRef = (0,
|
|
22645
|
-
const expirationOptionRefs = (0,
|
|
22646
|
-
const shouldFocusExpirationOptionsRef = (0,
|
|
22647
|
-
const expirationTimeInputId = (0,
|
|
22648
|
-
const executionDebugStoreRef = (0,
|
|
22649
|
-
const executionDebugAttemptIdRef = (0,
|
|
22650
|
-
const submittedSelectionRef = (0,
|
|
22651
|
-
const lastValidRouteCardsRef = (0,
|
|
22652
|
-
(0,
|
|
22743
|
+
const buyTabRef = (0, import_react39.useRef)(null);
|
|
22744
|
+
const sellTabRef = (0, import_react39.useRef)(null);
|
|
22745
|
+
const expirationTriggerRef = (0, import_react39.useRef)(null);
|
|
22746
|
+
const limitPriceInitializedForOutcomeRef = (0, import_react39.useRef)(void 0);
|
|
22747
|
+
const expirationOptionRefs = (0, import_react39.useRef)([]);
|
|
22748
|
+
const shouldFocusExpirationOptionsRef = (0, import_react39.useRef)(false);
|
|
22749
|
+
const expirationTimeInputId = (0, import_react39.useId)();
|
|
22750
|
+
const executionDebugStoreRef = (0, import_react39.useRef)(null);
|
|
22751
|
+
const executionDebugAttemptIdRef = (0, import_react39.useRef)(null);
|
|
22752
|
+
const submittedSelectionRef = (0, import_react39.useRef)(null);
|
|
22753
|
+
const lastValidRouteCardsRef = (0, import_react39.useRef)(null);
|
|
22754
|
+
(0, import_react39.useEffect)(() => {
|
|
22653
22755
|
if (!isExecutionDebugEnabled) {
|
|
22654
22756
|
executionDebugStoreRef.current = null;
|
|
22655
22757
|
return;
|
|
22656
22758
|
}
|
|
22657
22759
|
executionDebugStoreRef.current = enableExecutionDebugInBrowser();
|
|
22658
22760
|
}, [isExecutionDebugEnabled]);
|
|
22659
|
-
(0,
|
|
22761
|
+
(0, import_react39.useEffect)(() => {
|
|
22660
22762
|
var _a2;
|
|
22661
22763
|
if (!isLimitExpirationPickerOpen) return;
|
|
22662
22764
|
if (limitExpirationPickerView !== "options") return;
|
|
@@ -22664,7 +22766,7 @@ var PlaceOrder = ({
|
|
|
22664
22766
|
(_a2 = expirationOptionRefs.current[LIMIT_EXPIRATION_OPTION_COUNT - 1]) == null ? void 0 : _a2.focus();
|
|
22665
22767
|
shouldFocusExpirationOptionsRef.current = false;
|
|
22666
22768
|
}, [isLimitExpirationPickerOpen, limitExpirationPickerView]);
|
|
22667
|
-
(0,
|
|
22769
|
+
(0, import_react39.useEffect)(() => {
|
|
22668
22770
|
if (!isExecutionDebugEnabled) return;
|
|
22669
22771
|
const store = executionDebugStoreRef.current;
|
|
22670
22772
|
if (!store) return;
|
|
@@ -22679,8 +22781,8 @@ var PlaceOrder = ({
|
|
|
22679
22781
|
const debouncedAmount = (0, import_hooks67.useDebouncedValue)(internalAmount, 300);
|
|
22680
22782
|
const isQuoteInputEditing = internalAmount !== debouncedAmount;
|
|
22681
22783
|
const isLimitOrder = showLimitOrders && executionType === "limit";
|
|
22682
|
-
const isSell = (0,
|
|
22683
|
-
const limitVenueOptions = (0,
|
|
22784
|
+
const isSell = (0, import_react39.useMemo)(() => internalTab === "sell", [internalTab]);
|
|
22785
|
+
const limitVenueOptions = (0, import_react39.useMemo)(
|
|
22684
22786
|
() => {
|
|
22685
22787
|
var _a2;
|
|
22686
22788
|
return buildLimitOrderVenueOptions({
|
|
@@ -22692,7 +22794,7 @@ var PlaceOrder = ({
|
|
|
22692
22794
|
},
|
|
22693
22795
|
[clusterMidpointResult, livePrices, scopedSelectedMarket, scopedSelectedOutcomeId]
|
|
22694
22796
|
);
|
|
22695
|
-
const visibleLimitVenueOptions = (0,
|
|
22797
|
+
const visibleLimitVenueOptions = (0, import_react39.useMemo)(() => {
|
|
22696
22798
|
return limitVenueOptions.filter((option) => {
|
|
22697
22799
|
return (0, import_hooks67.getVenueAvailabilityState)({
|
|
22698
22800
|
venueId: option.venue,
|
|
@@ -22710,7 +22812,7 @@ var PlaceOrder = ({
|
|
|
22710
22812
|
enabled: Boolean(isAuthenticated && isSell),
|
|
22711
22813
|
mode: isPaperMode ? "paper" : void 0
|
|
22712
22814
|
});
|
|
22713
|
-
const sellableSharesByVenue = (0,
|
|
22815
|
+
const sellableSharesByVenue = (0, import_react39.useMemo)(
|
|
22714
22816
|
() => isSell ? resolveSellableSharesByVenue({
|
|
22715
22817
|
positions: executionPositions,
|
|
22716
22818
|
market: scopedSelectedMarket,
|
|
@@ -22731,7 +22833,7 @@ var PlaceOrder = ({
|
|
|
22731
22833
|
isPanelActive: isQuotePanelActive,
|
|
22732
22834
|
isSubmitting: submissionProgressState != null || isBeforeActionPending || executeManaged.isPending || placeLimitOrder.isPending
|
|
22733
22835
|
};
|
|
22734
|
-
const limitVenueQuoteRequests = (0,
|
|
22836
|
+
const limitVenueQuoteRequests = (0, import_react39.useMemo)(
|
|
22735
22837
|
() => visibleLimitVenueOptions.map((option) => ({
|
|
22736
22838
|
venue: option.venue,
|
|
22737
22839
|
venueMarketOutcomeId: option.venueMarketOutcomeId
|
|
@@ -22752,11 +22854,11 @@ var PlaceOrder = ({
|
|
|
22752
22854
|
enabled: isLimitVenueQuoteEnabled,
|
|
22753
22855
|
refreshContext: smartRouteRefreshContext
|
|
22754
22856
|
});
|
|
22755
|
-
const limitVenueQuoteByVenue = (0,
|
|
22857
|
+
const limitVenueQuoteByVenue = (0, import_react39.useMemo)(
|
|
22756
22858
|
() => new Map(limitVenueQuotes.quotes.map((quote) => [quote.request.venue, quote])),
|
|
22757
22859
|
[limitVenueQuotes.quotes]
|
|
22758
22860
|
);
|
|
22759
|
-
const geoBlockedLimitVenues = (0,
|
|
22861
|
+
const geoBlockedLimitVenues = (0, import_react39.useMemo)(() => {
|
|
22760
22862
|
var _a2;
|
|
22761
22863
|
const venues = /* @__PURE__ */ new Set();
|
|
22762
22864
|
for (const quote of limitVenueQuotes.quotes) {
|
|
@@ -22766,7 +22868,7 @@ var PlaceOrder = ({
|
|
|
22766
22868
|
}
|
|
22767
22869
|
return venues;
|
|
22768
22870
|
}, [limitVenueQuotes.quotes]);
|
|
22769
|
-
const availableLimitVenueOptions = (0,
|
|
22871
|
+
const availableLimitVenueOptions = (0, import_react39.useMemo)(() => {
|
|
22770
22872
|
return visibleLimitVenueOptions.filter((option) => {
|
|
22771
22873
|
var _a2;
|
|
22772
22874
|
return !geoBlockedLimitVenues.has(option.venue) && // A limit SELL rests against shares held at that specific venue, so a
|
|
@@ -22788,11 +22890,11 @@ var PlaceOrder = ({
|
|
|
22788
22890
|
sellableSharesByVenue,
|
|
22789
22891
|
visibleLimitVenueOptions
|
|
22790
22892
|
]);
|
|
22791
|
-
const automaticLimitVenueOption = (0,
|
|
22893
|
+
const automaticLimitVenueOption = (0, import_react39.useMemo)(
|
|
22792
22894
|
() => resolveAutomaticLimitOrderVenueOption(availableLimitVenueOptions, internalTab),
|
|
22793
22895
|
[availableLimitVenueOptions, internalTab]
|
|
22794
22896
|
);
|
|
22795
|
-
const selectedLimitVenueOption = (0,
|
|
22897
|
+
const selectedLimitVenueOption = (0, import_react39.useMemo)(() => {
|
|
22796
22898
|
if (selectedLimitVenue) {
|
|
22797
22899
|
const selectedOption = availableLimitVenueOptions.find(
|
|
22798
22900
|
(option) => option.venue === selectedLimitVenue
|
|
@@ -22801,7 +22903,7 @@ var PlaceOrder = ({
|
|
|
22801
22903
|
}
|
|
22802
22904
|
return automaticLimitVenueOption;
|
|
22803
22905
|
}, [automaticLimitVenueOption, availableLimitVenueOptions, selectedLimitVenue]);
|
|
22804
|
-
(0,
|
|
22906
|
+
(0, import_react39.useEffect)(() => {
|
|
22805
22907
|
if (!selectedLimitVenue || !geoBlockedLimitVenues.has(selectedLimitVenue)) return;
|
|
22806
22908
|
setSelectedLimitVenue(null);
|
|
22807
22909
|
}, [geoBlockedLimitVenues, selectedLimitVenue]);
|
|
@@ -22830,7 +22932,7 @@ var PlaceOrder = ({
|
|
|
22830
22932
|
} : {}), {
|
|
22831
22933
|
refreshContext: smartRouteRefreshContext
|
|
22832
22934
|
}));
|
|
22833
|
-
(0,
|
|
22935
|
+
(0, import_react39.useEffect)(() => {
|
|
22834
22936
|
var _a2, _b2, _c2;
|
|
22835
22937
|
if (isSell || smartRoute.isFetching || ((_a2 = smartRoute.data) == null ? void 0 : _a2.venueMarketOutcomeId) !== scopedSelectedOutcomeId) {
|
|
22836
22938
|
return;
|
|
@@ -22852,7 +22954,7 @@ var PlaceOrder = ({
|
|
|
22852
22954
|
smartRoute.isFetching,
|
|
22853
22955
|
user == null ? void 0 : user.id
|
|
22854
22956
|
]);
|
|
22855
|
-
const inheritedBuyGeoBlockedVenues = (0,
|
|
22957
|
+
const inheritedBuyGeoBlockedVenues = (0, import_react39.useMemo)(() => {
|
|
22856
22958
|
var _a2, _b2;
|
|
22857
22959
|
if (!isSell || !buyGeoBlockSnapshot || !scopedSelectedOutcomeId) return void 0;
|
|
22858
22960
|
if (buyGeoBlockSnapshot.eventId !== ((_a2 = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.id) != null ? _a2 : null)) return void 0;
|
|
@@ -22868,7 +22970,7 @@ var PlaceOrder = ({
|
|
|
22868
22970
|
scopedSelectedOutcomeId,
|
|
22869
22971
|
user == null ? void 0 : user.id
|
|
22870
22972
|
]);
|
|
22871
|
-
const venueSellQuoteRequests = (0,
|
|
22973
|
+
const venueSellQuoteRequests = (0, import_react39.useMemo)(
|
|
22872
22974
|
() => {
|
|
22873
22975
|
var _a2;
|
|
22874
22976
|
return isSell && !smartRoute.isLoading && ((_a2 = smartRoute.data) == null ? void 0 : _a2.venueMarketOutcomeId) === scopedSelectedOutcomeId ? buildVenueSellQuoteRequests({
|
|
@@ -22888,7 +22990,7 @@ var PlaceOrder = ({
|
|
|
22888
22990
|
enabled: isSell && isSmartRouteEnabled && !smartRoute.isLoading && ((_o = smartRoute.data) == null ? void 0 : _o.venueMarketOutcomeId) === scopedSelectedOutcomeId,
|
|
22889
22991
|
refreshContext: smartRouteRefreshContext
|
|
22890
22992
|
});
|
|
22891
|
-
const currentSellableShares = (0,
|
|
22993
|
+
const currentSellableShares = (0, import_react39.useMemo)(() => {
|
|
22892
22994
|
var _a2, _b2;
|
|
22893
22995
|
const sharesFromQuote = (_b2 = (_a2 = smartRoute.data) == null ? void 0 : _a2.positionAvailability) == null ? void 0 : _b2.totalSellableShares;
|
|
22894
22996
|
if (typeof sharesFromQuote === "number" && Number.isFinite(sharesFromQuote)) {
|
|
@@ -22898,22 +23000,22 @@ var PlaceOrder = ({
|
|
|
22898
23000
|
for (const size of sellableSharesByVenue.values()) resolvedShares += size;
|
|
22899
23001
|
return Math.max(0, resolvedShares);
|
|
22900
23002
|
}, [sellableSharesByVenue, (_q = (_p = smartRoute.data) == null ? void 0 : _p.positionAvailability) == null ? void 0 : _q.totalSellableShares]);
|
|
22901
|
-
const maxSellableShares = (0,
|
|
23003
|
+
const maxSellableShares = (0, import_react39.useMemo)(
|
|
22902
23004
|
() => floorToDecimals(currentSellableShares, SELL_SHARE_INPUT_DECIMALS),
|
|
22903
23005
|
[currentSellableShares]
|
|
22904
23006
|
);
|
|
22905
23007
|
const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((_s = (_r = smartRoute.data) == null ? void 0 : _r.positionAvailability) == null ? void 0 : _s.totalSellableShares) === "number") && (isExecutionPositionsLoading || isExecutionPositionsFetching);
|
|
22906
|
-
const displayedCurrentSellableShares = (0,
|
|
23008
|
+
const displayedCurrentSellableShares = (0, import_react39.useMemo)(() => {
|
|
22907
23009
|
if (!Number.isFinite(currentSellableShares) || currentSellableShares <= 0) return 0;
|
|
22908
23010
|
return floorToDecimals(currentSellableShares, SELL_SHARE_DISPLAY_DECIMALS);
|
|
22909
23011
|
}, [currentSellableShares]);
|
|
22910
|
-
const displayedCurrentSellableSharesLabel = (0,
|
|
23012
|
+
const displayedCurrentSellableSharesLabel = (0, import_react39.useMemo)(
|
|
22911
23013
|
() => `${formatFlooredShareAmount(maxSellableShares, SELL_SHARE_DISPLAY_DECIMALS)} shares`,
|
|
22912
23014
|
[maxSellableShares]
|
|
22913
23015
|
);
|
|
22914
23016
|
const isAtMaxSellableShares = isSell && maxSellableShares > 0 && Math.abs(internalAmount - maxSellableShares) < 1e-9;
|
|
22915
23017
|
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;
|
|
22916
|
-
(0,
|
|
23018
|
+
(0, import_react39.useEffect)(() => {
|
|
22917
23019
|
if (submissionProgressState != null) return;
|
|
22918
23020
|
if (!isSell || isCurrentSellableSharesLoading) return;
|
|
22919
23021
|
if (scopedSelectedOutcomeId === sellFilledForOutcomeId) return;
|
|
@@ -22929,7 +23031,7 @@ var PlaceOrder = ({
|
|
|
22929
23031
|
onAmountChange,
|
|
22930
23032
|
submissionProgressState
|
|
22931
23033
|
]);
|
|
22932
|
-
(0,
|
|
23034
|
+
(0, import_react39.useEffect)(() => {
|
|
22933
23035
|
var _a2, _b2;
|
|
22934
23036
|
if (submissionProgressState != null || !isSell) return;
|
|
22935
23037
|
if (((_a2 = smartRoute.data) == null ? void 0 : _a2.venueMarketOutcomeId) !== scopedSelectedOutcomeId) return;
|
|
@@ -22953,7 +23055,7 @@ var PlaceOrder = ({
|
|
|
22953
23055
|
submissionProgressState
|
|
22954
23056
|
]);
|
|
22955
23057
|
const scopedSmartRouteData = ((_y = smartRoute.data) == null ? void 0 : _y.venueMarketOutcomeId) === scopedSelectedOutcomeId ? smartRoute.data : null;
|
|
22956
|
-
const routeCards = (0,
|
|
23058
|
+
const routeCards = (0, import_react39.useMemo)(() => {
|
|
22957
23059
|
const eventVenues = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets.map((market) => market.venue);
|
|
22958
23060
|
if (isSell) {
|
|
22959
23061
|
return buildLiveSellRouteCards({
|
|
@@ -22997,7 +23099,22 @@ var PlaceOrder = ({
|
|
|
22997
23099
|
const selectedManualRouteCard = manualRouteSelectionIdentity ? routeCards.find(
|
|
22998
23100
|
(card) => getPlaceOrderRouteCardIdentity(card) === manualRouteSelectionIdentity
|
|
22999
23101
|
) : void 0;
|
|
23000
|
-
const
|
|
23102
|
+
const legacyKalshiAccount = (0, import_react39.useMemo)(
|
|
23103
|
+
() => {
|
|
23104
|
+
var _a2;
|
|
23105
|
+
return (_a2 = user == null ? void 0 : user.venueAccounts) == null ? void 0 : _a2.find((venueAccount) => venueAccount.venue === "kalshi");
|
|
23106
|
+
},
|
|
23107
|
+
[user == null ? void 0 : user.venueAccounts]
|
|
23108
|
+
);
|
|
23109
|
+
const isKalshiAccountActive = (_B = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.connected) != null ? _B : (legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.status) === "active";
|
|
23110
|
+
const hasKalshiConnectionState = kalshiKeyStatus !== void 0 || (user == null ? void 0 : user.venueAccounts) != null;
|
|
23111
|
+
const isKalshiAvailable = (0, import_hooks67.getVenueAvailabilityState)({
|
|
23112
|
+
venueId: "kalshi",
|
|
23113
|
+
disabledVenues,
|
|
23114
|
+
isConfigLoading: isAppConfigLoading
|
|
23115
|
+
}) === "available";
|
|
23116
|
+
const isKalshiDisconnected = !isPaperMode && isAuthenticated && hasKalshiConnectionState && isKalshiAvailable && !isKalshiAccountActive;
|
|
23117
|
+
const resolvedSelectedRouteCardId = (0, import_react39.useMemo)(() => {
|
|
23001
23118
|
var _a2;
|
|
23002
23119
|
if (selectedManualRouteCard && !selectedManualRouteCard.isUnavailable) {
|
|
23003
23120
|
return selectedManualRouteCard.id;
|
|
@@ -23006,17 +23123,20 @@ var PlaceOrder = ({
|
|
|
23006
23123
|
return selectedRouteCardId;
|
|
23007
23124
|
}
|
|
23008
23125
|
if (routeCards.length === 0) return null;
|
|
23009
|
-
return resolveDefaultRouteCardId(routeCards, isSell ? void 0 : (_a2 = smartRoute.data) == null ? void 0 : _a2.status
|
|
23126
|
+
return resolveDefaultRouteCardId(routeCards, isSell ? void 0 : (_a2 = smartRoute.data) == null ? void 0 : _a2.status, {
|
|
23127
|
+
isKalshiDisconnected
|
|
23128
|
+
});
|
|
23010
23129
|
}, [
|
|
23130
|
+
isKalshiDisconnected,
|
|
23011
23131
|
isSell,
|
|
23012
23132
|
isRouteCardsTransient,
|
|
23013
23133
|
manualRouteSelectionIdentity,
|
|
23014
23134
|
routeCards,
|
|
23015
23135
|
selectedManualRouteCard,
|
|
23016
23136
|
selectedRouteCardId,
|
|
23017
|
-
(
|
|
23137
|
+
(_C = smartRoute.data) == null ? void 0 : _C.status
|
|
23018
23138
|
]);
|
|
23019
|
-
(0,
|
|
23139
|
+
(0, import_react39.useEffect)(() => {
|
|
23020
23140
|
if (routeCards.length === 0) {
|
|
23021
23141
|
if (isRouteCardsTransient) return;
|
|
23022
23142
|
setSelectedRouteCardId(null);
|
|
@@ -23040,19 +23160,19 @@ var PlaceOrder = ({
|
|
|
23040
23160
|
selectedRouteCardId
|
|
23041
23161
|
]);
|
|
23042
23162
|
const isSubmissionLocked = submissionProgressState != null;
|
|
23043
|
-
const isSubmissionLockedRef = (0,
|
|
23163
|
+
const isSubmissionLockedRef = (0, import_react39.useRef)(isSubmissionLocked);
|
|
23044
23164
|
isSubmissionLockedRef.current = isSubmissionLocked;
|
|
23045
|
-
(0,
|
|
23165
|
+
(0, import_react39.useEffect)(() => {
|
|
23046
23166
|
if (isSubmissionLockedRef.current) return;
|
|
23047
23167
|
setSubmissionFeedback(null);
|
|
23048
23168
|
setSubmissionProgressState(null);
|
|
23049
23169
|
}, [executionType, internalAmount, internalSlippage, internalTab, scopedSelectedOutcomeId]);
|
|
23050
|
-
(0,
|
|
23170
|
+
(0, import_react39.useEffect)(() => {
|
|
23051
23171
|
if (showLimitOrders || executionType !== "limit") return;
|
|
23052
23172
|
setExecutionType("market");
|
|
23053
23173
|
setIsLimitExpirationPickerOpen(false);
|
|
23054
23174
|
}, [executionType, showLimitOrders]);
|
|
23055
|
-
(0,
|
|
23175
|
+
(0, import_react39.useEffect)(() => {
|
|
23056
23176
|
if (executionType !== "limit") {
|
|
23057
23177
|
limitPriceInitializedForOutcomeRef.current = void 0;
|
|
23058
23178
|
return;
|
|
@@ -23065,18 +23185,18 @@ var PlaceOrder = ({
|
|
|
23065
23185
|
setLimitPriceInputValue(formatLimitPriceInputValue(nextLimitPrice));
|
|
23066
23186
|
setLimitPriceInputError(null);
|
|
23067
23187
|
}, [executionType, scopedSelectedOutcomeId, selectedOutcomeDisplayPrice]);
|
|
23068
|
-
(0,
|
|
23188
|
+
(0, import_react39.useEffect)(() => {
|
|
23069
23189
|
setSelectedLimitVenue(null);
|
|
23070
23190
|
}, [scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id, scopedSelectedOutcomeId]);
|
|
23071
|
-
(0,
|
|
23191
|
+
(0, import_react39.useEffect)(() => {
|
|
23072
23192
|
setSelectedRouteCardId(null);
|
|
23073
23193
|
setManualRouteSelectionIdentity(null);
|
|
23074
23194
|
setIsRoutesExpanded(false);
|
|
23075
23195
|
setIsSplitDetailOpen(false);
|
|
23076
23196
|
}, [executionType, internalTab, scopedSelectedOutcomeId]);
|
|
23077
23197
|
const orderedRouteCards = routeCards;
|
|
23078
|
-
const selectedRouteCard = (
|
|
23079
|
-
const selectedSharedKycVenue = (0,
|
|
23198
|
+
const selectedRouteCard = (_E = (_D = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _D : orderedRouteCards[0]) != null ? _E : null;
|
|
23199
|
+
const selectedSharedKycVenue = (0, import_react39.useMemo)(() => {
|
|
23080
23200
|
var _a2, _b2;
|
|
23081
23201
|
const candidateVenue = isLimitOrder ? selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue : (_b2 = (_a2 = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills.find(
|
|
23082
23202
|
(fill) => venueRequiresSharedKyc({ venue: fill.venue })
|
|
@@ -23086,30 +23206,16 @@ var PlaceOrder = ({
|
|
|
23086
23206
|
return parsedVenue.success ? parsedVenue.data : null;
|
|
23087
23207
|
}, [isLimitOrder, selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue, selectedRouteCard]);
|
|
23088
23208
|
const needsSharedKycVerification = !isPaperMode && isAuthenticated && sharedKyc !== void 0 && selectedSharedKycVenue !== null && sharedKyc.status !== "verified";
|
|
23089
|
-
const isKalshiRoute = (0,
|
|
23209
|
+
const isKalshiRoute = (0, import_react39.useMemo)(() => {
|
|
23090
23210
|
if (isLimitOrder) return (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) === import_sdk24.Venue.kalshi;
|
|
23091
23211
|
if (selectedRouteCard) {
|
|
23092
23212
|
return selectedRouteCard.venue === "kalshi" || selectedRouteCard.quoteData.fills.some((f) => f.venue === "kalshi");
|
|
23093
23213
|
}
|
|
23094
23214
|
return (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === "kalshi";
|
|
23095
23215
|
}, [isLimitOrder, selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue, selectedRouteCard, scopedSelectedMarket]);
|
|
23096
|
-
const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (
|
|
23097
|
-
const
|
|
23098
|
-
|
|
23099
|
-
var _a2;
|
|
23100
|
-
return (_a2 = user == null ? void 0 : user.venueAccounts) == null ? void 0 : _a2.find((venueAccount) => venueAccount.venue === "kalshi");
|
|
23101
|
-
},
|
|
23102
|
-
[user == null ? void 0 : user.venueAccounts]
|
|
23103
|
-
);
|
|
23104
|
-
const isKalshiAccountActive = (_F = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.connected) != null ? _F : (legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.status) === "active";
|
|
23105
|
-
const hasKalshiConnectionState = kalshiKeyStatus !== void 0 || (user == null ? void 0 : user.venueAccounts) != null;
|
|
23106
|
-
const isKalshiAvailable = (0, import_hooks67.getVenueAvailabilityState)({
|
|
23107
|
-
venueId: "kalshi",
|
|
23108
|
-
disabledVenues,
|
|
23109
|
-
isConfigLoading: isAppConfigLoading
|
|
23110
|
-
}) === "available";
|
|
23111
|
-
const needsKalshiConnection = !isPaperMode && isAuthenticated && hasKalshiConnectionState && isKalshiAvailable && isKalshiRoute && !isKalshiAccountActive;
|
|
23112
|
-
const handleVerifyKalshi = (0, import_react38.useCallback)(
|
|
23216
|
+
const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (_F = liveBalanceState.kalshiBalance) != null ? _F : 0 : liveAvailableBalance;
|
|
23217
|
+
const needsKalshiConnection = isKalshiDisconnected && isKalshiRoute;
|
|
23218
|
+
const handleVerifyKalshi = (0, import_react39.useCallback)(
|
|
23113
23219
|
(credentials) => __async(null, null, function* () {
|
|
23114
23220
|
if (onConnectKalshi) {
|
|
23115
23221
|
yield onConnectKalshi(credentials);
|
|
@@ -23127,7 +23233,7 @@ var PlaceOrder = ({
|
|
|
23127
23233
|
}),
|
|
23128
23234
|
[aggClient, onConnectKalshi, refetchKalshiKeyStatus]
|
|
23129
23235
|
);
|
|
23130
|
-
const handleRouteCardSelect = (0,
|
|
23236
|
+
const handleRouteCardSelect = (0, import_react39.useCallback)(
|
|
23131
23237
|
(cardId) => {
|
|
23132
23238
|
const card = routeCards.find((routeCard) => routeCard.id === cardId);
|
|
23133
23239
|
if (!card || card.isUnavailable) return;
|
|
@@ -23164,7 +23270,7 @@ var PlaceOrder = ({
|
|
|
23164
23270
|
mode: isPaperMode ? "paper" : void 0,
|
|
23165
23271
|
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)
|
|
23166
23272
|
});
|
|
23167
|
-
const executionProgressFloorRef = (0,
|
|
23273
|
+
const executionProgressFloorRef = (0, import_react39.useRef)({
|
|
23168
23274
|
quoteId: null,
|
|
23169
23275
|
value: 0
|
|
23170
23276
|
});
|
|
@@ -23175,7 +23281,7 @@ var PlaceOrder = ({
|
|
|
23175
23281
|
const executionDateSource = (_R = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate) != null ? _R : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.endDate;
|
|
23176
23282
|
const executionDateLabel = executionDateSource ? getTradingDateLabel(executionDateSource) : "";
|
|
23177
23283
|
const executionQuoteData = (_T = (_S = submissionProgressState == null ? void 0 : submissionProgressState.quoteData) != null ? _S : selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _T : null;
|
|
23178
|
-
const executionOrderGroups = (0,
|
|
23284
|
+
const executionOrderGroups = (0, import_react39.useMemo)(() => {
|
|
23179
23285
|
var _a2, _b2, _c2;
|
|
23180
23286
|
if (!executionQuoteData) return [];
|
|
23181
23287
|
return deriveExecutionOrderGroups({
|
|
@@ -23198,7 +23304,7 @@ var PlaceOrder = ({
|
|
|
23198
23304
|
(_U = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _U.length,
|
|
23199
23305
|
tradingLabels
|
|
23200
23306
|
]);
|
|
23201
|
-
const executionProgressPercent = (0,
|
|
23307
|
+
const executionProgressPercent = (0, import_react39.useMemo)(() => {
|
|
23202
23308
|
var _a2, _b2, _c2;
|
|
23203
23309
|
const quoteId = (_a2 = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _a2 : null;
|
|
23204
23310
|
const previousProgress = executionProgressFloorRef.current.quoteId === quoteId ? executionProgressFloorRef.current.value : 0;
|
|
@@ -23218,7 +23324,7 @@ var PlaceOrder = ({
|
|
|
23218
23324
|
submissionProgressState == null ? void 0 : submissionProgressState.orderIds,
|
|
23219
23325
|
submissionProgressState == null ? void 0 : submissionProgressState.quoteId
|
|
23220
23326
|
]);
|
|
23221
|
-
const buildExecutionSummary = (0,
|
|
23327
|
+
const buildExecutionSummary = (0, import_react39.useCallback)(
|
|
23222
23328
|
(quoteData, executionVenue, orderId, partialFillSummary) => {
|
|
23223
23329
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2;
|
|
23224
23330
|
if (!quoteData) return void 0;
|
|
@@ -23322,7 +23428,7 @@ var PlaceOrder = ({
|
|
|
23322
23428
|
tradingLabels
|
|
23323
23429
|
]
|
|
23324
23430
|
);
|
|
23325
|
-
(0,
|
|
23431
|
+
(0, import_react39.useEffect)(() => {
|
|
23326
23432
|
if (executionProgress.phase === "order_submitted") {
|
|
23327
23433
|
const submittedOrder = executionProgress.submittedOrders[0];
|
|
23328
23434
|
setSubmissionProgressState((prev) => {
|
|
@@ -23335,7 +23441,7 @@ var PlaceOrder = ({
|
|
|
23335
23441
|
});
|
|
23336
23442
|
}
|
|
23337
23443
|
}, [executionProgress.phase, executionProgress.submittedOrders]);
|
|
23338
|
-
(0,
|
|
23444
|
+
(0, import_react39.useEffect)(() => {
|
|
23339
23445
|
var _a2, _b2;
|
|
23340
23446
|
const dp = executionProgress.dagProgress;
|
|
23341
23447
|
if (!dp) return;
|
|
@@ -23390,7 +23496,7 @@ var PlaceOrder = ({
|
|
|
23390
23496
|
return __spreadProps(__spreadValues({}, prev), { dagProgress: dp });
|
|
23391
23497
|
});
|
|
23392
23498
|
}, [executionOrderGroups, executionProgress.dagProgress, tradingLabels]);
|
|
23393
|
-
(0,
|
|
23499
|
+
(0, import_react39.useEffect)(() => {
|
|
23394
23500
|
const orderIds = submissionProgressState == null ? void 0 : submissionProgressState.orderIds;
|
|
23395
23501
|
if (!(orderIds == null ? void 0 : orderIds.length)) return;
|
|
23396
23502
|
const aggregateStatus = deriveAggregateOrderStatus(
|
|
@@ -23451,7 +23557,7 @@ var PlaceOrder = ({
|
|
|
23451
23557
|
tradingLabels
|
|
23452
23558
|
]);
|
|
23453
23559
|
const estDurationMs = executionQuoteData && typeof executionQuoteData.estDurationMs === "number" ? executionQuoteData.estDurationMs : 6e4;
|
|
23454
|
-
(0,
|
|
23560
|
+
(0, import_react39.useEffect)(() => {
|
|
23455
23561
|
const phase = submissionProgressState == null ? void 0 : submissionProgressState.phase;
|
|
23456
23562
|
if (phase !== "submitting" && phase !== "executing") return;
|
|
23457
23563
|
const timeoutMs = Math.max(6e4, 2 * estDurationMs);
|
|
@@ -23466,7 +23572,7 @@ var PlaceOrder = ({
|
|
|
23466
23572
|
}, timeoutMs);
|
|
23467
23573
|
return () => clearTimeout(id);
|
|
23468
23574
|
}, [submissionProgressState == null ? void 0 : submissionProgressState.phase, estDurationMs, tradingLabels.orderStillSettling]);
|
|
23469
|
-
const emitTerminalOrderNotifications = (0,
|
|
23575
|
+
const emitTerminalOrderNotifications = (0, import_react39.useCallback)(() => {
|
|
23470
23576
|
const toast = toastCtx == null ? void 0 : toastCtx.toast;
|
|
23471
23577
|
if (!toast) return;
|
|
23472
23578
|
for (const event of executionProgress.terminalOrderEvents) {
|
|
@@ -23495,7 +23601,7 @@ var PlaceOrder = ({
|
|
|
23495
23601
|
});
|
|
23496
23602
|
}
|
|
23497
23603
|
}, [executionProgress.terminalOrderEvents, labels, toastCtx]);
|
|
23498
|
-
(0,
|
|
23604
|
+
(0, import_react39.useEffect)(() => {
|
|
23499
23605
|
var _a2, _b2;
|
|
23500
23606
|
if (!submissionProgressState) return;
|
|
23501
23607
|
onExecutionStateChange == null ? void 0 : onExecutionStateChange(submissionProgressState);
|
|
@@ -23570,7 +23676,7 @@ var PlaceOrder = ({
|
|
|
23570
23676
|
const isBelowVenueMinimumFromQuote = isQuoteBelowVenueMinimum(activeQuoteData);
|
|
23571
23677
|
const isBelowMinimum = isBelowClientMinimum || isBelowVenueMinimumFromQuote;
|
|
23572
23678
|
const belowMinimumMessage = isBelowClientMinimum ? tradingLabels.minimumOrderAmount(MIN_BUY_ORDER_AMOUNT) : tradingLabels.minOrderSizeViolated;
|
|
23573
|
-
const quoteStatus = (0,
|
|
23679
|
+
const quoteStatus = (0, import_react39.useMemo)(() => {
|
|
23574
23680
|
if (!orderEligibility.canPlaceOrder) return void 0;
|
|
23575
23681
|
return resolvePlaceOrderQuoteStatus({
|
|
23576
23682
|
amount: internalAmount,
|
|
@@ -23587,7 +23693,7 @@ var PlaceOrder = ({
|
|
|
23587
23693
|
scopedSelectedMarket,
|
|
23588
23694
|
tradingLabels
|
|
23589
23695
|
]);
|
|
23590
|
-
const smartRouteErrorMessage = (0,
|
|
23696
|
+
const smartRouteErrorMessage = (0, import_react39.useMemo)(() => {
|
|
23591
23697
|
var _a2;
|
|
23592
23698
|
const quoteError = (_a2 = smartRoute.error) != null ? _a2 : isSell ? venueSellQuotes.error : null;
|
|
23593
23699
|
if (!quoteError || orderedRouteCards.length > 0) return null;
|
|
@@ -23598,26 +23704,26 @@ var PlaceOrder = ({
|
|
|
23598
23704
|
});
|
|
23599
23705
|
}, [isSell, orderedRouteCards.length, smartRoute.error, tradingLabels, venueSellQuotes.error]);
|
|
23600
23706
|
const progressActionLabel = (internalTab === "buy" ? tradingLabels.buyingOutcome(selectedOutcomeLabel) : tradingLabels.sellingOutcome(selectedOutcomeLabel)).trim();
|
|
23601
|
-
const retryRemainingAmount = (0,
|
|
23707
|
+
const retryRemainingAmount = (0, import_react39.useMemo)(() => {
|
|
23602
23708
|
return getCanonicalPlaceOrderUnfilledRemaining({
|
|
23603
23709
|
originalAmount: internalAmount,
|
|
23604
23710
|
tradeSide: internalTab,
|
|
23605
23711
|
terminalOrderEvents: executionProgress.terminalOrderEvents
|
|
23606
23712
|
});
|
|
23607
23713
|
}, [executionProgress.terminalOrderEvents, internalAmount, internalTab]);
|
|
23608
|
-
const canRetryRemaining = (0,
|
|
23714
|
+
const canRetryRemaining = (0, import_react39.useMemo)(() => {
|
|
23609
23715
|
if (retryRemainingAmount == null) return false;
|
|
23610
23716
|
const minRemainder = isSell ? MIN_SELL_ORDER_SHARES : MIN_BUY_ORDER_AMOUNT;
|
|
23611
23717
|
return retryRemainingAmount >= minRemainder;
|
|
23612
23718
|
}, [isSell, retryRemainingAmount]);
|
|
23613
23719
|
const PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD = 0.95;
|
|
23614
|
-
const shouldAutoSkipPartialFill = (0,
|
|
23720
|
+
const shouldAutoSkipPartialFill = (0, import_react39.useMemo)(() => {
|
|
23615
23721
|
if (internalAmount <= 0 || retryRemainingAmount == null) return false;
|
|
23616
23722
|
const filled = Math.max(0, internalAmount - retryRemainingAmount);
|
|
23617
23723
|
const fillRatio = filled / internalAmount;
|
|
23618
23724
|
return fillRatio >= PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD || !canRetryRemaining;
|
|
23619
23725
|
}, [canRetryRemaining, internalAmount, retryRemainingAmount]);
|
|
23620
|
-
const failureSummary = (0,
|
|
23726
|
+
const failureSummary = (0, import_react39.useMemo)(() => {
|
|
23621
23727
|
var _a2;
|
|
23622
23728
|
if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return void 0;
|
|
23623
23729
|
const quoteData = (_a2 = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _a2 : activeQuoteData;
|
|
@@ -23690,14 +23796,14 @@ var PlaceOrder = ({
|
|
|
23690
23796
|
submissionProgressState,
|
|
23691
23797
|
tradingLabels
|
|
23692
23798
|
]);
|
|
23693
|
-
const displayedToWinHint = (0,
|
|
23799
|
+
const displayedToWinHint = (0, import_react39.useMemo)(() => {
|
|
23694
23800
|
if (!selectedRouteCard) return "";
|
|
23695
23801
|
const averagePrice = selectedRouteCard.executionPrice;
|
|
23696
23802
|
return averagePrice == null ? "" : tradingLabels.averagePrice(averagePrice);
|
|
23697
23803
|
}, [selectedRouteCard, tradingLabels]);
|
|
23698
23804
|
const displayedToWinValue = (_Y = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _Y : 0;
|
|
23699
|
-
const originalLimitPriceRaw = (0,
|
|
23700
|
-
const limitPriceAdjustmentByVenue = (0,
|
|
23805
|
+
const originalLimitPriceRaw = (0, import_react39.useMemo)(() => toLimitPriceRaw(limitPrice), [limitPrice]);
|
|
23806
|
+
const limitPriceAdjustmentByVenue = (0, import_react39.useMemo)(() => {
|
|
23701
23807
|
var _a2;
|
|
23702
23808
|
const adjustments = /* @__PURE__ */ new Map();
|
|
23703
23809
|
for (const option of visibleLimitVenueOptions) {
|
|
@@ -23725,7 +23831,7 @@ var PlaceOrder = ({
|
|
|
23725
23831
|
}, [internalTab, limitVenueQuoteByVenue, originalLimitPriceRaw, visibleLimitVenueOptions]);
|
|
23726
23832
|
const selectedLimitPriceAdjustment = selectedLimitVenueOption ? limitPriceAdjustmentByVenue.get(selectedLimitVenueOption.venue) : void 0;
|
|
23727
23833
|
const selectedLimitPriceRaw = (_Z = selectedLimitPriceAdjustment == null ? void 0 : selectedLimitPriceAdjustment.adjustedPriceRaw) != null ? _Z : originalLimitPriceRaw;
|
|
23728
|
-
const limitPriceAdjustmentMessage = (0,
|
|
23834
|
+
const limitPriceAdjustmentMessage = (0, import_react39.useMemo)(() => {
|
|
23729
23835
|
if (!selectedLimitVenueOption || !(selectedLimitPriceAdjustment == null ? void 0 : selectedLimitPriceAdjustment.adjusted) || !selectedLimitPriceAdjustment.tickSizeRaw) {
|
|
23730
23836
|
return "";
|
|
23731
23837
|
}
|
|
@@ -23743,7 +23849,7 @@ var PlaceOrder = ({
|
|
|
23743
23849
|
selectedLimitVenueOption,
|
|
23744
23850
|
tradingLabels
|
|
23745
23851
|
]);
|
|
23746
|
-
const limitOrderPayload = (0,
|
|
23852
|
+
const limitOrderPayload = (0, import_react39.useMemo)(() => {
|
|
23747
23853
|
if (!selectedLimitVenueOption || internalAmount <= 0) return null;
|
|
23748
23854
|
if (limitPriceInputError) return null;
|
|
23749
23855
|
const effectivePriceRaw = BigInt(selectedLimitPriceRaw);
|
|
@@ -23779,7 +23885,7 @@ var PlaceOrder = ({
|
|
|
23779
23885
|
selectedLimitVenueOption,
|
|
23780
23886
|
selectedLimitPriceRaw
|
|
23781
23887
|
]);
|
|
23782
|
-
const resolvedLimitExpirationDraftDate = (0,
|
|
23888
|
+
const resolvedLimitExpirationDraftDate = (0, import_react39.useMemo)(() => {
|
|
23783
23889
|
return resolveLimitExpirationDate({
|
|
23784
23890
|
expirationType: "CUSTOM",
|
|
23785
23891
|
customDate: limitExpirationDraftDate,
|
|
@@ -23787,7 +23893,7 @@ var PlaceOrder = ({
|
|
|
23787
23893
|
});
|
|
23788
23894
|
}, [limitExpirationDraftDate, limitExpirationDraftTime]);
|
|
23789
23895
|
const isLimitExpirationDraftValid = isFutureLimitExpiration(resolvedLimitExpirationDraftDate);
|
|
23790
|
-
const resolvedCustomExpirationDate = (0,
|
|
23896
|
+
const resolvedCustomExpirationDate = (0, import_react39.useMemo)(() => {
|
|
23791
23897
|
return resolveLimitExpirationDate({
|
|
23792
23898
|
expirationType: "CUSTOM",
|
|
23793
23899
|
customDate: limitExpirationDate,
|
|
@@ -23809,7 +23915,7 @@ var PlaceOrder = ({
|
|
|
23809
23915
|
expiresAt: serializeLimitOrderExpiration(expirationDate)
|
|
23810
23916
|
});
|
|
23811
23917
|
};
|
|
23812
|
-
const displayedLimitToWinValue = (0,
|
|
23918
|
+
const displayedLimitToWinValue = (0, import_react39.useMemo)(() => {
|
|
23813
23919
|
if (!limitOrderPayload) return 0;
|
|
23814
23920
|
const size = Number(BigInt(limitOrderPayload.sizeRaw)) / Number(import_sdk24.LIMIT_PRICE_RAW_SCALE);
|
|
23815
23921
|
if (internalTab === "buy") return size;
|
|
@@ -23820,7 +23926,7 @@ var PlaceOrder = ({
|
|
|
23820
23926
|
)
|
|
23821
23927
|
) / Number(import_sdk24.LIMIT_PRICE_RAW_SCALE);
|
|
23822
23928
|
}, [internalTab, limitOrderPayload]);
|
|
23823
|
-
const limitRouteCards = (0,
|
|
23929
|
+
const limitRouteCards = (0, import_react39.useMemo)(() => {
|
|
23824
23930
|
return visibleLimitVenueOptions.map((option) => {
|
|
23825
23931
|
var _a2, _b2, _c2, _d2;
|
|
23826
23932
|
const effectiveLimitPriceRaw = (_b2 = (_a2 = limitPriceAdjustmentByVenue.get(option.venue)) == null ? void 0 : _a2.adjustedPriceRaw) != null ? _b2 : originalLimitPriceRaw;
|
|
@@ -23870,7 +23976,7 @@ var PlaceOrder = ({
|
|
|
23870
23976
|
tradingLabels,
|
|
23871
23977
|
visibleLimitVenueOptions
|
|
23872
23978
|
]);
|
|
23873
|
-
const limitVenueOptionByCardId = (0,
|
|
23979
|
+
const limitVenueOptionByCardId = (0, import_react39.useMemo)(() => {
|
|
23874
23980
|
return new Map(
|
|
23875
23981
|
visibleLimitVenueOptions.map((option) => [
|
|
23876
23982
|
`limit-venue-${option.venue}-${option.venueMarketOutcomeId}`,
|
|
@@ -23893,13 +23999,13 @@ var PlaceOrder = ({
|
|
|
23893
23999
|
const activeFeeBreakdown = activeQuoteData == null ? void 0 : activeQuoteData.feeBreakdown;
|
|
23894
24000
|
const executionReserve = activeFeeBreakdown == null ? void 0 : activeFeeBreakdown.executionReserve;
|
|
23895
24001
|
const executionReserveValue = typeof executionReserve === "number" && Number.isFinite(executionReserve) && executionReserve > 0 ? formatUsd(executionReserve, { minimumFractionDigits: 2, maximumFractionDigits: 2 }) : null;
|
|
23896
|
-
const estimatedFeesValue = (0,
|
|
24002
|
+
const estimatedFeesValue = (0, import_react39.useMemo)(() => {
|
|
23897
24003
|
const totalFees = getSmartRouteTotalFees(activeFeeBreakdown);
|
|
23898
24004
|
if (totalFees == null) return null;
|
|
23899
24005
|
return formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
23900
24006
|
}, [activeFeeBreakdown]);
|
|
23901
24007
|
const appFeeValue = (__ = activeFeeBreakdown == null ? void 0 : activeFeeBreakdown.appFee) != null ? __ : 0;
|
|
23902
|
-
const feeBreakdownRows = (0,
|
|
24008
|
+
const feeBreakdownRows = (0, import_react39.useMemo)(() => {
|
|
23903
24009
|
var _a2;
|
|
23904
24010
|
if (!activeFeeBreakdown) return [];
|
|
23905
24011
|
return [
|
|
@@ -23950,30 +24056,25 @@ var PlaceOrder = ({
|
|
|
23950
24056
|
const selectedLimitRouteCardId = selectedLimitVenueOption ? `limit-venue-${selectedLimitVenueOption.venue}-${selectedLimitVenueOption.venueMarketOutcomeId}` : null;
|
|
23951
24057
|
const selectedLimitRouteCard = selectedLimitRouteCardId ? (_$ = limitRouteCards.find((card) => card.id === selectedLimitRouteCardId)) != null ? _$ : null : null;
|
|
23952
24058
|
const selectedRouteGeoBlocked = isLimitOrder ? (_aa = selectedLimitRouteCard == null ? void 0 : selectedLimitRouteCard.isUnavailable) != null ? _aa : false : (_ba = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _ba : false;
|
|
23953
|
-
const geoBlockedVenuesFromWarnings = (0,
|
|
24059
|
+
const geoBlockedVenuesFromWarnings = (0, import_react39.useMemo)(
|
|
23954
24060
|
() => {
|
|
23955
24061
|
var _a2;
|
|
23956
24062
|
return extractGeoBlockedVenues((_a2 = smartRoute.data) == null ? void 0 : _a2.warnings);
|
|
23957
24063
|
},
|
|
23958
24064
|
[(_ca = smartRoute.data) == null ? void 0 : _ca.warnings]
|
|
23959
24065
|
);
|
|
23960
|
-
const isPrimaryVenueGeoBlocked = (0,
|
|
24066
|
+
const isPrimaryVenueGeoBlocked = (0, import_react39.useMemo)(() => {
|
|
23961
24067
|
var _a2, _b2;
|
|
23962
24068
|
if (!selectedRouteCard || selectedRouteCard.isUnavailable) return false;
|
|
23963
24069
|
const fills = (_b2 = (_a2 = selectedRouteCard.quoteData) == null ? void 0 : _a2.fills) != null ? _b2 : [];
|
|
23964
24070
|
return fills.length > 0 && fills.every((f) => geoBlockedVenuesFromWarnings.has(f.venue));
|
|
23965
24071
|
}, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
|
|
23966
24072
|
const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked || isLimitOrder && limitRouteCards.length > 0 && limitRouteCards.every((card) => card.isUnavailable);
|
|
23967
|
-
const shouldShowLowLiquidityWarning = !isQuoteInputEditing && !isQuoteLoading && (activeQuoteData == null ? void 0 : activeQuoteData.venueMarketOutcomeId) === scopedSelectedOutcomeId && !(activeQuoteData == null ? void 0 : activeQuoteData.fills.some((fill) => fill.venue === "prophetx")) && isPlaceOrderAveragePriceWorse({
|
|
23968
|
-
averageExecutionPrice: selectedRouteCard == null ? void 0 : selectedRouteCard.executionPrice,
|
|
23969
|
-
displayedMarketPrice: selectedOutcomeDisplayPrice,
|
|
23970
|
-
tradeSide: internalTab
|
|
23971
|
-
});
|
|
23972
24073
|
const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
|
|
23973
24074
|
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;
|
|
23974
24075
|
const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (isLimitOrder ? limitRouteCards.length > 0 : displayedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
|
|
23975
24076
|
const shouldShowRouteToggle = !isLimitOrder && !isQuoteLoading && displayedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
|
|
23976
|
-
const handleReturnToOrderForm = (0,
|
|
24077
|
+
const handleReturnToOrderForm = (0, import_react39.useCallback)(() => {
|
|
23977
24078
|
const submittedSelection = submittedSelectionRef.current;
|
|
23978
24079
|
submittedSelectionRef.current = null;
|
|
23979
24080
|
setSubmissionProgressState(null);
|
|
@@ -23995,7 +24096,7 @@ var PlaceOrder = ({
|
|
|
23995
24096
|
const shareUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(shareText)}`;
|
|
23996
24097
|
window.open(shareUrl, "_blank", "noopener,noreferrer");
|
|
23997
24098
|
};
|
|
23998
|
-
const handleExecuteQuote = (0,
|
|
24099
|
+
const handleExecuteQuote = (0, import_react39.useCallback)(
|
|
23999
24100
|
(quoteData) => __async(null, null, function* () {
|
|
24000
24101
|
var _a2, _b2, _c2;
|
|
24001
24102
|
const quoteId = quoteData == null ? void 0 : quoteData.quoteId;
|
|
@@ -24112,7 +24213,7 @@ var PlaceOrder = ({
|
|
|
24112
24213
|
venueSellQuotes.quotes
|
|
24113
24214
|
]
|
|
24114
24215
|
);
|
|
24115
|
-
const handlePlaceLimitOrder = (0,
|
|
24216
|
+
const handlePlaceLimitOrder = (0, import_react39.useCallback)(
|
|
24116
24217
|
(submissionLimitOrderPayload) => __async(null, null, function* () {
|
|
24117
24218
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
24118
24219
|
if (!showLimitOrders) return;
|
|
@@ -24195,7 +24296,7 @@ var PlaceOrder = ({
|
|
|
24195
24296
|
tradingLabels
|
|
24196
24297
|
]
|
|
24197
24298
|
);
|
|
24198
|
-
const handleSkipToSuccess = (0,
|
|
24299
|
+
const handleSkipToSuccess = (0, import_react39.useCallback)(() => {
|
|
24199
24300
|
const primaryFilledEvent = executionProgress.terminalOrderEvents.find(
|
|
24200
24301
|
(e) => e.event === "filled" || e.event === "partial_fill"
|
|
24201
24302
|
);
|
|
@@ -24220,7 +24321,7 @@ var PlaceOrder = ({
|
|
|
24220
24321
|
failureSummary,
|
|
24221
24322
|
selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData
|
|
24222
24323
|
]);
|
|
24223
|
-
(0,
|
|
24324
|
+
(0, import_react39.useEffect)(() => {
|
|
24224
24325
|
if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return;
|
|
24225
24326
|
if ((failureSummary == null ? void 0 : failureSummary.kind) !== "partial_fill") return;
|
|
24226
24327
|
if (!shouldAutoSkipPartialFill) return;
|
|
@@ -24231,7 +24332,7 @@ var PlaceOrder = ({
|
|
|
24231
24332
|
shouldAutoSkipPartialFill,
|
|
24232
24333
|
submissionProgressState == null ? void 0 : submissionProgressState.phase
|
|
24233
24334
|
]);
|
|
24234
|
-
const handleRetrySubmission = (0,
|
|
24335
|
+
const handleRetrySubmission = (0, import_react39.useCallback)(() => __async(null, null, function* () {
|
|
24235
24336
|
var _a2, _b2, _c2, _d2, _e2;
|
|
24236
24337
|
if (!orderEligibility.canPlaceOrder || !failureSummary || failureSummary.kind === "generic") {
|
|
24237
24338
|
handleReturnToOrderForm();
|
|
@@ -24649,7 +24750,7 @@ var PlaceOrder = ({
|
|
|
24649
24750
|
}
|
|
24650
24751
|
);
|
|
24651
24752
|
}
|
|
24652
|
-
return /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)(
|
|
24753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)(import_react39.Fragment, { children: [
|
|
24653
24754
|
/* @__PURE__ */ (0, import_jsx_runtime169.jsxs)(
|
|
24654
24755
|
Card,
|
|
24655
24756
|
{
|
|
@@ -25025,12 +25126,13 @@ var PlaceOrder = ({
|
|
|
25025
25126
|
/* @__PURE__ */ (0, import_jsx_runtime169.jsx)(PlaceOrderRouteCardSkeleton, {}),
|
|
25026
25127
|
/* @__PURE__ */ (0, import_jsx_runtime169.jsx)(PlaceOrderRouteCardSkeleton, {})
|
|
25027
25128
|
] }) : activeRouteCards.length > 0 ? activeRouteCards.map((card) => {
|
|
25028
|
-
return /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
|
|
25129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(import_react39.Fragment, { children: renderRouteCard({
|
|
25029
25130
|
card,
|
|
25030
25131
|
enableAnimations,
|
|
25031
25132
|
isExpanded: card.kind === "split" ? isSplitDetailOpen : isRoutesExpanded,
|
|
25032
25133
|
isSelected: !card.isUnavailable && card.id === (isLimitOrder ? selectedLimitRouteCardId : resolvedSelectedRouteCardId),
|
|
25033
25134
|
onSelect: handleActiveRouteCardSelect,
|
|
25135
|
+
isKalshiDisconnected,
|
|
25034
25136
|
sharedKycStatus: isPaperMode ? void 0 : sharedKyc == null ? void 0 : sharedKyc.status,
|
|
25035
25137
|
tradingLabels
|
|
25036
25138
|
}) }, card.id);
|
|
@@ -25234,7 +25336,7 @@ var PlaceOrder = ({
|
|
|
25234
25336
|
/* @__PURE__ */ (0, import_jsx_runtime169.jsx)("p", { className: "agg-order-summary-hint text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isLimitOrder ? displayedLimitToWinHint : displayedToWinHint })
|
|
25235
25337
|
] }),
|
|
25236
25338
|
/* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
|
|
25237
|
-
|
|
25339
|
+
import_react38.default,
|
|
25238
25340
|
{
|
|
25239
25341
|
value: isLimitOrder ? displayedLimitToWinValue : displayedToWinValue,
|
|
25240
25342
|
locales: locale,
|
|
@@ -25392,15 +25494,6 @@ var PlaceOrder = ({
|
|
|
25392
25494
|
children: actionLabel
|
|
25393
25495
|
}
|
|
25394
25496
|
),
|
|
25395
|
-
shouldShowLowLiquidityWarning ? /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
|
|
25396
|
-
InlineAlert,
|
|
25397
|
-
{
|
|
25398
|
-
tone: "warning",
|
|
25399
|
-
variant: "surface",
|
|
25400
|
-
className: "agg-order-low-liquidity-warning justify-start! border-0! bg-agg-warning/10! py-2!",
|
|
25401
|
-
message: internalTab === "buy" ? tradingLabels.lowLiquidityWarning : tradingLabels.lowLiquiditySellWarning
|
|
25402
|
-
}
|
|
25403
|
-
) : null,
|
|
25404
25497
|
!shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown && appFeeValue === 0 ? /* @__PURE__ */ (0, import_jsx_runtime169.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: [
|
|
25405
25498
|
/* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
|
|
25406
25499
|
Icon,
|
|
@@ -25451,7 +25544,7 @@ PlaceOrder.displayName = "PlaceOrder";
|
|
|
25451
25544
|
|
|
25452
25545
|
// src/trading/use-claim-winnings.ts
|
|
25453
25546
|
var import_hooks68 = require("@agg-build/hooks");
|
|
25454
|
-
var
|
|
25547
|
+
var import_react40 = require("react");
|
|
25455
25548
|
var toClaimError = (err) => {
|
|
25456
25549
|
if (err instanceof Error) return err;
|
|
25457
25550
|
return new Error(String(err));
|
|
@@ -25463,17 +25556,17 @@ function useClaimWinnings(options = {}) {
|
|
|
25463
25556
|
const toastCtx = useOptionalToast();
|
|
25464
25557
|
const queryClient = (0, import_hooks68.useQueryClient)();
|
|
25465
25558
|
const redeemMutation = (0, import_hooks68.useRedeem)();
|
|
25466
|
-
const [activeRedeems, setActiveRedeems] = (0,
|
|
25467
|
-
const activeClaimKeysRef = (0,
|
|
25468
|
-
const pendingClaimToastIdsRef = (0,
|
|
25469
|
-
const submittedClaimToastKeysRef = (0,
|
|
25470
|
-
const [submittingClaimKeys, setSubmittingClaimKeys] = (0,
|
|
25471
|
-
const lifecycleInputs = (0,
|
|
25559
|
+
const [activeRedeems, setActiveRedeems] = (0, import_react40.useState)({});
|
|
25560
|
+
const activeClaimKeysRef = (0, import_react40.useRef)(/* @__PURE__ */ new Set());
|
|
25561
|
+
const pendingClaimToastIdsRef = (0, import_react40.useRef)({});
|
|
25562
|
+
const submittedClaimToastKeysRef = (0, import_react40.useRef)(/* @__PURE__ */ new Set());
|
|
25563
|
+
const [submittingClaimKeys, setSubmittingClaimKeys] = (0, import_react40.useState)({});
|
|
25564
|
+
const lifecycleInputs = (0, import_react40.useMemo)(
|
|
25472
25565
|
() => Object.values(activeRedeems),
|
|
25473
25566
|
[activeRedeems]
|
|
25474
25567
|
);
|
|
25475
25568
|
const lifecycleStates = (0, import_hooks68.useRedeemLifecycles)(lifecycleInputs);
|
|
25476
|
-
const internalClaimingIds = (0,
|
|
25569
|
+
const internalClaimingIds = (0, import_react40.useMemo)(() => {
|
|
25477
25570
|
const out = __spreadValues({}, submittingClaimKeys);
|
|
25478
25571
|
for (const [claimKey, active] of Object.entries(activeRedeems)) {
|
|
25479
25572
|
const state = lifecycleStates[active.redeemId];
|
|
@@ -25482,11 +25575,11 @@ function useClaimWinnings(options = {}) {
|
|
|
25482
25575
|
return out;
|
|
25483
25576
|
}, [activeRedeems, lifecycleStates, submittingClaimKeys]);
|
|
25484
25577
|
const claimingKeys = externalClaimingKeys != null ? externalClaimingKeys : internalClaimingIds;
|
|
25485
|
-
const isClaiming = (0,
|
|
25578
|
+
const isClaiming = (0, import_react40.useCallback)(
|
|
25486
25579
|
(claimKey) => Boolean(externalClaimingKeys == null ? void 0 : externalClaimingKeys[claimKey]) || Boolean(internalClaimingIds[claimKey]),
|
|
25487
25580
|
[externalClaimingKeys, internalClaimingIds]
|
|
25488
25581
|
);
|
|
25489
|
-
const invalidateClaimUiState = (0,
|
|
25582
|
+
const invalidateClaimUiState = (0, import_react40.useCallback)(() => {
|
|
25490
25583
|
(0, import_hooks68.invalidateBalanceQueries)(queryClient);
|
|
25491
25584
|
(0, import_hooks68.invalidatePositionQueries)(queryClient);
|
|
25492
25585
|
queryClient.invalidateQueries({
|
|
@@ -25495,7 +25588,7 @@ function useClaimWinnings(options = {}) {
|
|
|
25495
25588
|
});
|
|
25496
25589
|
(0, import_hooks68.invalidateUserActivityQueries)(queryClient);
|
|
25497
25590
|
}, [queryClient]);
|
|
25498
|
-
const claim = (0,
|
|
25591
|
+
const claim = (0, import_react40.useCallback)(
|
|
25499
25592
|
(_0) => __async(null, [_0], function* ({ claimKey, winningOutcomeIds, payload }) {
|
|
25500
25593
|
if (activeClaimKeysRef.current.has(claimKey) || Boolean(externalClaimingKeys == null ? void 0 : externalClaimingKeys[claimKey]) || internalClaimingIds[claimKey]) {
|
|
25501
25594
|
return;
|
|
@@ -25633,8 +25726,8 @@ function useClaimWinnings(options = {}) {
|
|
|
25633
25726
|
toastCtx
|
|
25634
25727
|
]
|
|
25635
25728
|
);
|
|
25636
|
-
const firedTerminalRef = (0,
|
|
25637
|
-
(0,
|
|
25729
|
+
const firedTerminalRef = (0, import_react40.useRef)({});
|
|
25730
|
+
(0, import_react40.useEffect)(() => {
|
|
25638
25731
|
var _a, _b;
|
|
25639
25732
|
for (const [claimKey, active] of Object.entries(activeRedeems)) {
|
|
25640
25733
|
const state = lifecycleStates[active.redeemId];
|
|
@@ -25691,7 +25784,7 @@ function useClaimWinnings(options = {}) {
|
|
|
25691
25784
|
|
|
25692
25785
|
// src/trading/use-resolved-market-claim.ts
|
|
25693
25786
|
var import_hooks69 = require("@agg-build/hooks");
|
|
25694
|
-
var
|
|
25787
|
+
var import_react41 = require("react");
|
|
25695
25788
|
var sharesFormatter = new Intl.NumberFormat("en-US", { maximumFractionDigits: 2 });
|
|
25696
25789
|
var dateFormatter = new Intl.DateTimeFormat("en-US", {
|
|
25697
25790
|
month: "short",
|
|
@@ -25708,7 +25801,7 @@ function useResolvedMarketClaim(options = {}) {
|
|
|
25708
25801
|
var _a;
|
|
25709
25802
|
const { market, enabled = true, executionMode } = options;
|
|
25710
25803
|
const { isAuthenticated } = (0, import_hooks69.useAggAuthState)();
|
|
25711
|
-
const tradingState = (0,
|
|
25804
|
+
const tradingState = (0, import_react41.useMemo)(() => (0, import_hooks69.resolveMarketTradingState)(market), [market]);
|
|
25712
25805
|
const isResolved = tradingState.kind === "resolved";
|
|
25713
25806
|
const marketId = (_a = market == null ? void 0 : market.id) != null ? _a : null;
|
|
25714
25807
|
const shouldFetch = Boolean(enabled && isAuthenticated && isResolved && marketId);
|
|
@@ -25718,7 +25811,7 @@ function useResolvedMarketClaim(options = {}) {
|
|
|
25718
25811
|
limit: 50
|
|
25719
25812
|
}, executionMode === "paper" ? { mode: "paper" } : {}));
|
|
25720
25813
|
const claimWinnings = useClaimWinnings();
|
|
25721
|
-
return (0,
|
|
25814
|
+
return (0, import_react41.useMemo)(() => {
|
|
25722
25815
|
var _a2;
|
|
25723
25816
|
if (!shouldFetch || !marketId) return void 0;
|
|
25724
25817
|
const group = positions.find(
|
|
@@ -25815,7 +25908,7 @@ var resolveEventMarketPageStickyState = ({
|
|
|
25815
25908
|
// src/pages/event-market/event-market.shared.tsx
|
|
25816
25909
|
var import_hooks70 = require("@agg-build/hooks");
|
|
25817
25910
|
var Dialog8 = __toESM(require("@radix-ui/react-dialog"));
|
|
25818
|
-
var
|
|
25911
|
+
var import_react42 = require("react");
|
|
25819
25912
|
var import_jsx_runtime170 = require("react/jsx-runtime");
|
|
25820
25913
|
var MOBILE_EVENT_MARKET_MEDIA_QUERY = "(max-width: 1023px)";
|
|
25821
25914
|
var SPORTS_EVENT_MARKET_MEDIA_QUERY = "(max-width: 1279px)";
|
|
@@ -25825,10 +25918,10 @@ var getIsMobileEventMarketViewport = (mediaQuery = MOBILE_EVENT_MARKET_MEDIA_QUE
|
|
|
25825
25918
|
return window.matchMedia(mediaQuery).matches;
|
|
25826
25919
|
};
|
|
25827
25920
|
var useIsMobileEventMarketViewport = (mediaQuery = MOBILE_EVENT_MARKET_MEDIA_QUERY) => {
|
|
25828
|
-
const [isMobileViewport, setIsMobileViewport] = (0,
|
|
25921
|
+
const [isMobileViewport, setIsMobileViewport] = (0, import_react42.useState)(
|
|
25829
25922
|
() => getIsMobileEventMarketViewport(mediaQuery)
|
|
25830
25923
|
);
|
|
25831
|
-
(0,
|
|
25924
|
+
(0, import_react42.useEffect)(() => {
|
|
25832
25925
|
if (typeof window === "undefined") return;
|
|
25833
25926
|
if (typeof window.matchMedia !== "function") return;
|
|
25834
25927
|
const mediaQueryList = window.matchMedia(mediaQuery);
|
|
@@ -26053,11 +26146,11 @@ var EventMarketPageLoadingState = ({
|
|
|
26053
26146
|
|
|
26054
26147
|
// src/pages/event-market/sports-event-market-page.tsx
|
|
26055
26148
|
var import_hooks73 = require("@agg-build/hooks");
|
|
26056
|
-
var
|
|
26149
|
+
var import_react45 = require("react");
|
|
26057
26150
|
|
|
26058
26151
|
// src/pages/event-market/sports-markets.tsx
|
|
26059
26152
|
var import_hooks72 = require("@agg-build/hooks");
|
|
26060
|
-
var
|
|
26153
|
+
var import_react44 = require("react");
|
|
26061
26154
|
|
|
26062
26155
|
// src/pages/event-market/sports-event-market.utils.ts
|
|
26063
26156
|
var SPORTS_MARKET_TYPE_KEYS = [
|
|
@@ -27072,7 +27165,7 @@ var mergeSportsSectionMarketsIntoEvent = ({
|
|
|
27072
27165
|
|
|
27073
27166
|
// src/pages/event-market/sports-market-card.tsx
|
|
27074
27167
|
var import_hooks71 = require("@agg-build/hooks");
|
|
27075
|
-
var
|
|
27168
|
+
var import_react43 = require("react");
|
|
27076
27169
|
|
|
27077
27170
|
// src/pages/event-market/sports-line-rail.tsx
|
|
27078
27171
|
var React = __toESM(require("react"));
|
|
@@ -27425,18 +27518,18 @@ var SportsMarketCard = ({
|
|
|
27425
27518
|
formatting: { formatCompactCurrency }
|
|
27426
27519
|
} = (0, import_hooks71.useSdkUiConfig)();
|
|
27427
27520
|
const tradingContext = (0, import_hooks71.useEventTradingContext)();
|
|
27428
|
-
const slide = (0,
|
|
27429
|
-
const [selectedLineIndex, setSelectedLineIndex] = (0,
|
|
27430
|
-
const combinedLegs = (0,
|
|
27521
|
+
const slide = (0, import_react43.useMemo)(() => buildSportsSlideFromGroup(group), [group]);
|
|
27522
|
+
const [selectedLineIndex, setSelectedLineIndex] = (0, import_react43.useState)(slide.defaultStopIndex);
|
|
27523
|
+
const combinedLegs = (0, import_react43.useMemo)(() => resolveSportsCombinedLegs(group), [group]);
|
|
27431
27524
|
const isCombinedLegGroup = combinedLegs != null;
|
|
27432
|
-
const combinedLegMarkets = (0,
|
|
27525
|
+
const combinedLegMarkets = (0, import_react43.useMemo)(
|
|
27433
27526
|
() => {
|
|
27434
27527
|
var _a2;
|
|
27435
27528
|
return (_a2 = combinedLegs == null ? void 0 : combinedLegs.map((leg) => leg.market)) != null ? _a2 : [];
|
|
27436
27529
|
},
|
|
27437
27530
|
[combinedLegs]
|
|
27438
27531
|
);
|
|
27439
|
-
const preferredResolvedLegMarket = (0,
|
|
27532
|
+
const preferredResolvedLegMarket = (0, import_react43.useMemo)(() => {
|
|
27440
27533
|
var _a2, _b2;
|
|
27441
27534
|
const resolvedYesWinnerMarket = (_a2 = combinedLegMarkets.find(
|
|
27442
27535
|
(market) => market.venueMarketOutcomes.some(
|
|
@@ -27448,7 +27541,7 @@ var SportsMarketCard = ({
|
|
|
27448
27541
|
(market) => market.venueMarketOutcomes.some((outcome) => outcome.winner === true)
|
|
27449
27542
|
)) != null ? _b2 : null;
|
|
27450
27543
|
}, [combinedLegMarkets]);
|
|
27451
|
-
(0,
|
|
27544
|
+
(0, import_react43.useEffect)(() => {
|
|
27452
27545
|
if (!slide.hasLadder) return;
|
|
27453
27546
|
const tradingMarketId = tradingContext == null ? void 0 : tradingContext.selectedMarketId;
|
|
27454
27547
|
if (!tradingMarketId) return;
|
|
@@ -27460,8 +27553,8 @@ var SportsMarketCard = ({
|
|
|
27460
27553
|
const activeDefaultOutcome = isCombinedLegGroup && activeMarket ? (_g = activeMarket.venueMarketOutcomes.find(
|
|
27461
27554
|
(outcome) => outcome.label.trim().toLowerCase() === "yes"
|
|
27462
27555
|
)) != null ? _g : activeMarket.venueMarketOutcomes[0] : activeMarket == null ? void 0 : activeMarket.venueMarketOutcomes[0];
|
|
27463
|
-
const wasExpandedRef = (0,
|
|
27464
|
-
(0,
|
|
27556
|
+
const wasExpandedRef = (0, import_react43.useRef)(isExpanded);
|
|
27557
|
+
(0, import_react43.useEffect)(() => {
|
|
27465
27558
|
const justOpened = isExpanded && !wasExpandedRef.current;
|
|
27466
27559
|
wasExpandedRef.current = isExpanded;
|
|
27467
27560
|
if (!justOpened || !activeMarket) return;
|
|
@@ -27474,7 +27567,7 @@ var SportsMarketCard = ({
|
|
|
27474
27567
|
tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(activeMarket.id, firstOutcome.id);
|
|
27475
27568
|
}
|
|
27476
27569
|
}, [activeDefaultOutcome, isExpanded, activeMarket, tradingContext]);
|
|
27477
|
-
const combinedLegHeaderOutcomeItems = (0,
|
|
27570
|
+
const combinedLegHeaderOutcomeItems = (0, import_react43.useMemo)(() => {
|
|
27478
27571
|
if (!combinedLegs) return void 0;
|
|
27479
27572
|
return combinedLegs.flatMap(({ label: label2, market }, index) => {
|
|
27480
27573
|
var _a2;
|
|
@@ -27501,7 +27594,7 @@ var SportsMarketCard = ({
|
|
|
27501
27594
|
];
|
|
27502
27595
|
});
|
|
27503
27596
|
}, [combinedLegs, midpointsResult]);
|
|
27504
|
-
const spreadHeaderOutcomeItems = (0,
|
|
27597
|
+
const spreadHeaderOutcomeItems = (0, import_react43.useMemo)(() => {
|
|
27505
27598
|
if (slide.kind !== "spread" || !activeMarket) return void 0;
|
|
27506
27599
|
return resolveSpreadHeaderOutcomeItems({
|
|
27507
27600
|
market: activeMarket,
|
|
@@ -27744,7 +27837,7 @@ var SportsMarkets = ({
|
|
|
27744
27837
|
isFetchingNextPage: isFetchingNextGameMarketsPage,
|
|
27745
27838
|
fetchNextPage: fetchNextGameMarketsPage
|
|
27746
27839
|
} = gameMarketsQuery;
|
|
27747
|
-
const tabSourceMarkets = (0,
|
|
27840
|
+
const tabSourceMarkets = (0, import_react44.useMemo)(() => {
|
|
27748
27841
|
const seen = /* @__PURE__ */ new Set();
|
|
27749
27842
|
const merged = [];
|
|
27750
27843
|
for (const market of [...event.venueMarkets, ...gameMarkets]) {
|
|
@@ -27754,21 +27847,21 @@ var SportsMarkets = ({
|
|
|
27754
27847
|
}
|
|
27755
27848
|
return merged;
|
|
27756
27849
|
}, [event.venueMarkets, gameMarkets]);
|
|
27757
|
-
const visibleTabs = (0,
|
|
27850
|
+
const visibleTabs = (0, import_react44.useMemo)(
|
|
27758
27851
|
() => resolveVisibleSportsSectionTabs(__spreadProps(__spreadValues({}, event), { venueMarkets: tabSourceMarkets })),
|
|
27759
27852
|
[event, tabSourceMarkets]
|
|
27760
27853
|
);
|
|
27761
27854
|
const shouldRenderTabs = visibleTabs.length > 1 && tabSourceMarkets.length > 1;
|
|
27762
|
-
const [activeTabKey, setActiveTabKey] = (0,
|
|
27763
|
-
const activeTab = (0,
|
|
27855
|
+
const [activeTabKey, setActiveTabKey] = (0, import_react44.useState)((_b = (_a = visibleTabs[0]) == null ? void 0 : _a.key) != null ? _b : "game_lines");
|
|
27856
|
+
const activeTab = (0, import_react44.useMemo)(
|
|
27764
27857
|
() => {
|
|
27765
27858
|
var _a2, _b2;
|
|
27766
27859
|
return (_b2 = (_a2 = visibleTabs.find((tab) => tab.key === activeTabKey)) != null ? _a2 : visibleTabs[0]) != null ? _b2 : { key: "game_lines", kind: "game_lines" };
|
|
27767
27860
|
},
|
|
27768
27861
|
[visibleTabs, activeTabKey]
|
|
27769
27862
|
);
|
|
27770
|
-
const [expandedGroupId, setExpandedGroupId] = (0,
|
|
27771
|
-
const [stableMarketsByTab, setStableMarketsByTab] = (0,
|
|
27863
|
+
const [expandedGroupId, setExpandedGroupId] = (0, import_react44.useState)(null);
|
|
27864
|
+
const [stableMarketsByTab, setStableMarketsByTab] = (0, import_react44.useState)({});
|
|
27772
27865
|
const activeTabLabel = resolveSportsSectionLabel(labels, activeTab);
|
|
27773
27866
|
const sectionFilters = resolveSportsSectionFilters(activeTab);
|
|
27774
27867
|
const sectionMarketsQuery = (0, import_hooks72.useVenueMarkets)({
|
|
@@ -27791,7 +27884,7 @@ var SportsMarkets = ({
|
|
|
27791
27884
|
isFetchingNextPage,
|
|
27792
27885
|
fetchNextPage
|
|
27793
27886
|
} = sectionMarketsQuery;
|
|
27794
|
-
const resolvedSectionMarkets = (0,
|
|
27887
|
+
const resolvedSectionMarkets = (0, import_react44.useMemo)(
|
|
27795
27888
|
() => resolveSportsSectionMarkets({
|
|
27796
27889
|
tab: activeTab,
|
|
27797
27890
|
eventMarkets: tabSourceMarkets,
|
|
@@ -27802,29 +27895,29 @@ var SportsMarkets = ({
|
|
|
27802
27895
|
);
|
|
27803
27896
|
const isSectionSettled = !isSectionLoading && !hasNextPage && !isFetchingNextPage;
|
|
27804
27897
|
const stableSectionMarkets = stableMarketsByTab[activeTabKey];
|
|
27805
|
-
const displayedSectionMarkets = (0,
|
|
27898
|
+
const displayedSectionMarkets = (0, import_react44.useMemo)(
|
|
27806
27899
|
() => stableSectionMarkets != null ? stableSectionMarkets : isSectionSettled ? resolvedSectionMarkets : [],
|
|
27807
27900
|
[stableSectionMarkets, isSectionSettled, resolvedSectionMarkets]
|
|
27808
27901
|
);
|
|
27809
|
-
const periodGroups = (0,
|
|
27902
|
+
const periodGroups = (0, import_react44.useMemo)(
|
|
27810
27903
|
() => groupSportsMarketsByPeriod(displayedSectionMarkets, event.sport),
|
|
27811
27904
|
[displayedSectionMarkets, event.sport]
|
|
27812
27905
|
);
|
|
27813
|
-
const allGroups = (0,
|
|
27906
|
+
const allGroups = (0, import_react44.useMemo)(
|
|
27814
27907
|
() => periodGroups.flatMap((periodGroup) => periodGroup.groups),
|
|
27815
27908
|
[periodGroups]
|
|
27816
27909
|
);
|
|
27817
|
-
(0,
|
|
27910
|
+
(0, import_react44.useEffect)(() => {
|
|
27818
27911
|
if (hasNextPage && !isFetchingNextPage) {
|
|
27819
27912
|
void fetchNextPage();
|
|
27820
27913
|
}
|
|
27821
27914
|
}, [hasNextPage, isFetchingNextPage, fetchNextPage]);
|
|
27822
|
-
(0,
|
|
27915
|
+
(0, import_react44.useEffect)(() => {
|
|
27823
27916
|
if (hasNextGameMarketsPage && !isFetchingNextGameMarketsPage) {
|
|
27824
27917
|
void fetchNextGameMarketsPage();
|
|
27825
27918
|
}
|
|
27826
27919
|
}, [hasNextGameMarketsPage, isFetchingNextGameMarketsPage, fetchNextGameMarketsPage]);
|
|
27827
|
-
(0,
|
|
27920
|
+
(0, import_react44.useEffect)(() => {
|
|
27828
27921
|
if (!isSectionSettled) return;
|
|
27829
27922
|
setStableMarketsByTab((currentStableMarketsByTab) => {
|
|
27830
27923
|
var _a2;
|
|
@@ -27840,17 +27933,17 @@ var SportsMarkets = ({
|
|
|
27840
27933
|
});
|
|
27841
27934
|
});
|
|
27842
27935
|
}, [activeTabKey, isSectionSettled, resolvedSectionMarkets]);
|
|
27843
|
-
(0,
|
|
27936
|
+
(0, import_react44.useEffect)(() => {
|
|
27844
27937
|
if (!hasAggKey) return;
|
|
27845
27938
|
onSectionMarketsChange(activeTabKey, displayedSectionMarkets);
|
|
27846
27939
|
}, [activeTabKey, displayedSectionMarkets, hasAggKey, onSectionMarketsChange]);
|
|
27847
|
-
(0,
|
|
27940
|
+
(0, import_react44.useEffect)(() => {
|
|
27848
27941
|
var _a2, _b2;
|
|
27849
27942
|
if (visibleTabs.some((tab) => tab.key === activeTabKey)) return;
|
|
27850
27943
|
setActiveTabKey((_b2 = (_a2 = visibleTabs[0]) == null ? void 0 : _a2.key) != null ? _b2 : "game_lines");
|
|
27851
27944
|
}, [activeTabKey, visibleTabs]);
|
|
27852
|
-
const lastActiveTabRef = (0,
|
|
27853
|
-
(0,
|
|
27945
|
+
const lastActiveTabRef = (0, import_react44.useRef)(null);
|
|
27946
|
+
(0, import_react44.useEffect)(() => {
|
|
27854
27947
|
if (allGroups.length === 0) return;
|
|
27855
27948
|
if (lastActiveTabRef.current !== activeTabKey) {
|
|
27856
27949
|
lastActiveTabRef.current = activeTabKey;
|
|
@@ -27976,15 +28069,15 @@ var SportsEventMarketPage = ({
|
|
|
27976
28069
|
onBeforePrimaryAction,
|
|
27977
28070
|
sharedKyc
|
|
27978
28071
|
}) => {
|
|
27979
|
-
const [sectionMarketsByKey, setSectionMarketsByKey] = (0,
|
|
27980
|
-
const composedEvent = (0,
|
|
28072
|
+
const [sectionMarketsByKey, setSectionMarketsByKey] = (0, import_react45.useState)({});
|
|
28073
|
+
const composedEvent = (0, import_react45.useMemo)(() => {
|
|
27981
28074
|
return mergeSportsSectionMarketsIntoEvent({
|
|
27982
28075
|
event,
|
|
27983
28076
|
sectionMarketsByKey
|
|
27984
28077
|
});
|
|
27985
28078
|
}, [event, sectionMarketsByKey]);
|
|
27986
|
-
const eventTradingState = (0,
|
|
27987
|
-
const hasSportsSections = (0,
|
|
28079
|
+
const eventTradingState = (0, import_react45.useMemo)(() => (0, import_hooks73.resolveEventTradingState)(composedEvent), [composedEvent]);
|
|
28080
|
+
const hasSportsSections = (0, import_react45.useMemo)(
|
|
27988
28081
|
() => resolveVisibleSportsSectionTabs(event).length > 0,
|
|
27989
28082
|
[event]
|
|
27990
28083
|
);
|
|
@@ -27992,7 +28085,7 @@ var SportsEventMarketPage = ({
|
|
|
27992
28085
|
stickyOrderPanel
|
|
27993
28086
|
});
|
|
27994
28087
|
const { executionMode: resolvedExecutionMode } = (0, import_hooks73.useResolvedExecutionMode)(executionMode);
|
|
27995
|
-
const [isMobileTradeOpen, setIsMobileTradeOpen] = (0,
|
|
28088
|
+
const [isMobileTradeOpen, setIsMobileTradeOpen] = (0, import_react45.useState)(false);
|
|
27996
28089
|
const isMobileViewport = useIsMobileEventMarketViewport(SPORTS_EVENT_MARKET_MEDIA_QUERY);
|
|
27997
28090
|
const tradingContext = (0, import_hooks73.useEventTradingContext)();
|
|
27998
28091
|
const { stateByEventId: sportsLiveStateByEventId } = (0, import_hooks73.useSportsLive)([event.id]);
|
|
@@ -28003,15 +28096,15 @@ var SportsEventMarketPage = ({
|
|
|
28003
28096
|
executionMode: resolvedExecutionMode
|
|
28004
28097
|
});
|
|
28005
28098
|
const effectiveResolvedClaim = resolvedClaim != null ? resolvedClaim : internalResolvedClaim;
|
|
28006
|
-
const setTradeSideRef = (0,
|
|
28099
|
+
const setTradeSideRef = (0, import_react45.useRef)(tradingContext == null ? void 0 : tradingContext.setTradeSide);
|
|
28007
28100
|
setTradeSideRef.current = tradingContext == null ? void 0 : tradingContext.setTradeSide;
|
|
28008
|
-
(0,
|
|
28101
|
+
(0, import_react45.useEffect)(() => {
|
|
28009
28102
|
return () => {
|
|
28010
28103
|
var _a;
|
|
28011
28104
|
(_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, import_hooks73.TradeSide.Buy);
|
|
28012
28105
|
};
|
|
28013
28106
|
}, []);
|
|
28014
|
-
const handleSectionMarketsChange = (0,
|
|
28107
|
+
const handleSectionMarketsChange = (0, import_react45.useCallback)(
|
|
28015
28108
|
(tabKey, markets) => {
|
|
28016
28109
|
setSectionMarketsByKey((currentSectionMarketsByKey) => {
|
|
28017
28110
|
var _a;
|
|
@@ -28184,8 +28277,8 @@ var formatRecurringCountdown = (remainingMs) => {
|
|
|
28184
28277
|
return hours > 0 ? `${hours}:${minuteSecondLabel}` : minuteSecondLabel;
|
|
28185
28278
|
};
|
|
28186
28279
|
var useCurrentTimestamp = (enabled) => {
|
|
28187
|
-
const [currentTimestamp, setCurrentTimestamp] = (0,
|
|
28188
|
-
(0,
|
|
28280
|
+
const [currentTimestamp, setCurrentTimestamp] = (0, import_react46.useState)(null);
|
|
28281
|
+
(0, import_react46.useEffect)(() => {
|
|
28189
28282
|
if (!enabled) {
|
|
28190
28283
|
setCurrentTimestamp(null);
|
|
28191
28284
|
return;
|
|
@@ -28219,18 +28312,18 @@ var EventMarketPageContent = ({
|
|
|
28219
28312
|
onRecurringMarketNavigate
|
|
28220
28313
|
}) => {
|
|
28221
28314
|
var _a;
|
|
28222
|
-
const eventTradingState = (0,
|
|
28315
|
+
const eventTradingState = (0, import_react46.useMemo)(() => (0, import_hooks74.resolveEventTradingState)(event), [event]);
|
|
28223
28316
|
const stickyOrderPanelState = resolveEventMarketPageStickyState({
|
|
28224
28317
|
stickyOrderPanel
|
|
28225
28318
|
});
|
|
28226
28319
|
const { executionMode: resolvedExecutionMode } = (0, import_hooks74.useResolvedExecutionMode)(executionMode);
|
|
28227
|
-
const [isMobileTradeOpen, setIsMobileTradeOpen] = (0,
|
|
28320
|
+
const [isMobileTradeOpen, setIsMobileTradeOpen] = (0, import_react46.useState)(false);
|
|
28228
28321
|
const isMobileViewport = useIsMobileEventMarketViewport();
|
|
28229
28322
|
const tradingContext = (0, import_hooks74.useEventTradingContext)();
|
|
28230
28323
|
const labels = (0, import_hooks74.useLabels)();
|
|
28231
28324
|
const recurringQuery = (0, import_hooks74.useRecurringCryptoMarkets)({ event });
|
|
28232
28325
|
const currentTimestamp = useCurrentTimestamp(recurringQuery.isRecurringCryptoMarket);
|
|
28233
|
-
const recurringTimeline = (0,
|
|
28326
|
+
const recurringTimeline = (0, import_react46.useMemo)(
|
|
28234
28327
|
() => currentTimestamp == null ? null : (0, import_hooks74.resolveRecurringCryptoTimeline)(recurringQuery.windows, event, currentTimestamp),
|
|
28235
28328
|
[currentTimestamp, event, recurringQuery.windows]
|
|
28236
28329
|
);
|
|
@@ -28238,11 +28331,11 @@ var EventMarketPageContent = ({
|
|
|
28238
28331
|
const recurringViewedEndTimestamp = (recurringTimeline == null ? void 0 : recurringTimeline.viewed) ? Date.parse(recurringTimeline.viewed.windowEnd) : Number.NaN;
|
|
28239
28332
|
const hasViewedMarketEnded = currentTimestamp != null && Number.isFinite(recurringViewedEndTimestamp) && currentTimestamp >= recurringViewedEndTimestamp;
|
|
28240
28333
|
const isRecurringResolvingMarket = recurringQuery.isRecurringCryptoMarket && eventTradingState.kind === "closed";
|
|
28241
|
-
const lastBoundaryRefetchRef = (0,
|
|
28242
|
-
(0,
|
|
28334
|
+
const lastBoundaryRefetchRef = (0, import_react46.useRef)(null);
|
|
28335
|
+
(0, import_react46.useEffect)(() => {
|
|
28243
28336
|
lastBoundaryRefetchRef.current = null;
|
|
28244
28337
|
}, [event.id]);
|
|
28245
|
-
(0,
|
|
28338
|
+
(0, import_react46.useEffect)(() => {
|
|
28246
28339
|
if (!isRecurringCryptoMarket || !hasViewedMarketEnded || !(recurringTimeline == null ? void 0 : recurringTimeline.viewed)) return;
|
|
28247
28340
|
const refetchKey = `${event.id}:${recurringTimeline.viewed.windowEnd}`;
|
|
28248
28341
|
if (lastBoundaryRefetchRef.current === refetchKey) return;
|
|
@@ -28255,20 +28348,20 @@ var EventMarketPageContent = ({
|
|
|
28255
28348
|
recurringQuery,
|
|
28256
28349
|
recurringTimeline == null ? void 0 : recurringTimeline.viewed
|
|
28257
28350
|
]);
|
|
28258
|
-
const handleRecurringMarketSelect = (0,
|
|
28351
|
+
const handleRecurringMarketSelect = (0, import_react46.useCallback)(
|
|
28259
28352
|
(eventId) => {
|
|
28260
28353
|
if (!onRecurringMarketNavigate || eventId === event.id) return;
|
|
28261
28354
|
onRecurringMarketNavigate(eventId, { replace: false });
|
|
28262
28355
|
},
|
|
28263
28356
|
[event.id, onRecurringMarketNavigate]
|
|
28264
28357
|
);
|
|
28265
|
-
const handleGoToLive = (0,
|
|
28358
|
+
const handleGoToLive = (0, import_react46.useCallback)(() => {
|
|
28266
28359
|
var _a2;
|
|
28267
28360
|
const liveEventId = (_a2 = recurringTimeline == null ? void 0 : recurringTimeline.live) == null ? void 0 : _a2.venueEventId;
|
|
28268
28361
|
if (!onRecurringMarketNavigate || !liveEventId || liveEventId === event.id) return;
|
|
28269
28362
|
onRecurringMarketNavigate(liveEventId, { replace: false });
|
|
28270
28363
|
}, [event.id, onRecurringMarketNavigate, (_a = recurringTimeline == null ? void 0 : recurringTimeline.live) == null ? void 0 : _a.venueEventId]);
|
|
28271
|
-
const recurringMarketsPresentation = (0,
|
|
28364
|
+
const recurringMarketsPresentation = (0, import_react46.useMemo)(() => {
|
|
28272
28365
|
var _a2, _b;
|
|
28273
28366
|
if (!isRecurringCryptoMarket || !(recurringTimeline == null ? void 0 : recurringTimeline.viewed)) return void 0;
|
|
28274
28367
|
const toOption = (market) => {
|
|
@@ -28307,7 +28400,7 @@ var EventMarketPageContent = ({
|
|
|
28307
28400
|
recurringTimeline,
|
|
28308
28401
|
recurringViewedEndTimestamp
|
|
28309
28402
|
]);
|
|
28310
|
-
const eventDetailVenueMarkets = (0,
|
|
28403
|
+
const eventDetailVenueMarkets = (0, import_react46.useMemo)(
|
|
28311
28404
|
() => normalizeVenueMarketCluster(event.venueMarkets),
|
|
28312
28405
|
[event.venueMarkets]
|
|
28313
28406
|
);
|
|
@@ -28320,9 +28413,9 @@ var EventMarketPageContent = ({
|
|
|
28320
28413
|
executionMode: resolvedExecutionMode
|
|
28321
28414
|
});
|
|
28322
28415
|
const effectiveResolvedClaim = resolvedClaim != null ? resolvedClaim : internalResolvedClaim;
|
|
28323
|
-
const setTradeSideRef = (0,
|
|
28416
|
+
const setTradeSideRef = (0, import_react46.useRef)(tradingContext == null ? void 0 : tradingContext.setTradeSide);
|
|
28324
28417
|
setTradeSideRef.current = tradingContext == null ? void 0 : tradingContext.setTradeSide;
|
|
28325
|
-
(0,
|
|
28418
|
+
(0, import_react46.useEffect)(() => {
|
|
28326
28419
|
return () => {
|
|
28327
28420
|
var _a2;
|
|
28328
28421
|
(_a2 = setTradeSideRef.current) == null ? void 0 : _a2.call(setTradeSideRef, import_hooks74.TradeSide.Buy);
|
|
@@ -28663,15 +28756,15 @@ var buildEventDiscoveryUrl = ({
|
|
|
28663
28756
|
};
|
|
28664
28757
|
|
|
28665
28758
|
// src/pages/home/use-scroll-restoration.ts
|
|
28666
|
-
var
|
|
28759
|
+
var import_react47 = require("react");
|
|
28667
28760
|
function useScrollRestoration({
|
|
28668
28761
|
enabled,
|
|
28669
28762
|
scrollY,
|
|
28670
28763
|
isReady
|
|
28671
28764
|
}) {
|
|
28672
|
-
const restoredRef = (0,
|
|
28673
|
-
const [isRestoring, setIsRestoring] = (0,
|
|
28674
|
-
(0,
|
|
28765
|
+
const restoredRef = (0, import_react47.useRef)(false);
|
|
28766
|
+
const [isRestoring, setIsRestoring] = (0, import_react47.useState)(enabled && scrollY > 0);
|
|
28767
|
+
(0, import_react47.useLayoutEffect)(() => {
|
|
28675
28768
|
if (!enabled || restoredRef.current) return;
|
|
28676
28769
|
if (!isReady) return;
|
|
28677
28770
|
restoredRef.current = true;
|
|
@@ -28684,15 +28777,15 @@ function useScrollRestoration({
|
|
|
28684
28777
|
}
|
|
28685
28778
|
|
|
28686
28779
|
// src/pages/home/use-home-page-modals.ts
|
|
28687
|
-
var
|
|
28780
|
+
var import_react48 = require("react");
|
|
28688
28781
|
var useHomePageModals = () => {
|
|
28689
|
-
const [profileOpen, setProfileOpen] = (0,
|
|
28690
|
-
const [depositOpen, setDepositOpen] = (0,
|
|
28691
|
-
const [withdrawOpen, setWithdrawOpen] = (0,
|
|
28692
|
-
const onProfileClick = (0,
|
|
28693
|
-
const onDepositClick = (0,
|
|
28694
|
-
const onWithdrawClick = (0,
|
|
28695
|
-
(0,
|
|
28782
|
+
const [profileOpen, setProfileOpen] = (0, import_react48.useState)(false);
|
|
28783
|
+
const [depositOpen, setDepositOpen] = (0, import_react48.useState)(false);
|
|
28784
|
+
const [withdrawOpen, setWithdrawOpen] = (0, import_react48.useState)(false);
|
|
28785
|
+
const onProfileClick = (0, import_react48.useCallback)(() => setProfileOpen(true), []);
|
|
28786
|
+
const onDepositClick = (0, import_react48.useCallback)(() => setDepositOpen(true), []);
|
|
28787
|
+
const onWithdrawClick = (0, import_react48.useCallback)(() => setWithdrawOpen(true), []);
|
|
28788
|
+
(0, import_react48.useEffect)(() => {
|
|
28696
28789
|
if (typeof window === "undefined") return;
|
|
28697
28790
|
window.addEventListener(DEPOSIT_MODAL_OPEN_EVENT, onDepositClick);
|
|
28698
28791
|
window.addEventListener(WITHDRAW_MODAL_OPEN_EVENT, onWithdrawClick);
|
|
@@ -28743,17 +28836,17 @@ var HomeSearchResults = ({
|
|
|
28743
28836
|
const labels = (0, import_hooks75.useLabels)();
|
|
28744
28837
|
const { search: searchConfig } = (0, import_hooks75.useSdkUiConfig)();
|
|
28745
28838
|
const { disabledVenues } = (0, import_hooks75.useAppConfig)();
|
|
28746
|
-
const [activeVenueTabValue, setActiveVenueTabValue] = (0,
|
|
28839
|
+
const [activeVenueTabValue, setActiveVenueTabValue] = (0, import_react49.useState)("all");
|
|
28747
28840
|
const eventListTabs = useEventListTabs();
|
|
28748
28841
|
const { headerRef, titleRef, shouldUseSelectOverflow } = useEventListTabsHeaderOverflow(eventListTabs);
|
|
28749
|
-
const visibleVenues = (0,
|
|
28842
|
+
const visibleVenues = (0, import_react49.useMemo)(
|
|
28750
28843
|
() => disabledVenues.length === 0 ? void 0 : (0, import_hooks75.getVisibleVenueIdsByConfig)(import_sdk25.VENUES, disabledVenues),
|
|
28751
28844
|
[disabledVenues]
|
|
28752
28845
|
);
|
|
28753
|
-
const activeVenueTab = (0,
|
|
28846
|
+
const activeVenueTab = (0, import_react49.useMemo)(() => {
|
|
28754
28847
|
return eventListTabs.find((tab) => tab.value === activeVenueTabValue);
|
|
28755
28848
|
}, [activeVenueTabValue, eventListTabs]);
|
|
28756
|
-
const activeCategoryTab = (0,
|
|
28849
|
+
const activeCategoryTab = (0, import_react49.useMemo)(() => {
|
|
28757
28850
|
return resolvedTabs.find((tab) => tab.value === activeTabValue);
|
|
28758
28851
|
}, [activeTabValue, resolvedTabs]);
|
|
28759
28852
|
const activeVenues = resolveTabVenus(activeVenueTab, visibleVenues);
|
|
@@ -28777,28 +28870,28 @@ var HomeSearchResults = ({
|
|
|
28777
28870
|
// so debounced keystrokes don't pay reranker latency.
|
|
28778
28871
|
deep: true
|
|
28779
28872
|
});
|
|
28780
|
-
const openEvents = (0,
|
|
28873
|
+
const openEvents = (0, import_react49.useMemo)(() => {
|
|
28781
28874
|
let filtered = filterOpenEvents(searchResults);
|
|
28782
28875
|
if (activeVenues == null ? void 0 : activeVenues.length) {
|
|
28783
28876
|
filtered = filtered.filter((e) => activeVenues.includes(e.venue));
|
|
28784
28877
|
}
|
|
28785
28878
|
return filtered;
|
|
28786
28879
|
}, [searchResults, activeVenues]);
|
|
28787
|
-
const visibleVenueMarkets = (0,
|
|
28880
|
+
const visibleVenueMarkets = (0, import_react49.useMemo)(() => {
|
|
28788
28881
|
return openEvents.flatMap((event) => {
|
|
28789
28882
|
var _a;
|
|
28790
28883
|
return (_a = event.venueMarkets) != null ? _a : [];
|
|
28791
28884
|
});
|
|
28792
28885
|
}, [openEvents]);
|
|
28793
|
-
const visibleMidpointVenueMarketIds = (0,
|
|
28886
|
+
const visibleMidpointVenueMarketIds = (0, import_react49.useMemo)(() => {
|
|
28794
28887
|
return collectVisibleVenueMarketIds(visibleVenueMarkets);
|
|
28795
28888
|
}, [visibleVenueMarkets]);
|
|
28796
28889
|
const { midpointRows: sharedMidpointRows, isLoading: isSharedMidpointsLoading } = (0, import_hooks75.useVenueMarketMidpoints)({
|
|
28797
28890
|
venueMarketIds: visibleMidpointVenueMarketIds,
|
|
28798
28891
|
enabled: visibleMidpointVenueMarketIds.length > 0
|
|
28799
28892
|
});
|
|
28800
|
-
const loadMoreRef = (0,
|
|
28801
|
-
(0,
|
|
28893
|
+
const loadMoreRef = (0, import_react49.useRef)(null);
|
|
28894
|
+
(0, import_react49.useEffect)(() => {
|
|
28802
28895
|
if (!hasNextPage) return;
|
|
28803
28896
|
const target = loadMoreRef.current;
|
|
28804
28897
|
if (!target) return;
|
|
@@ -28957,9 +29050,9 @@ var HomePage = ({
|
|
|
28957
29050
|
const { isLoading: isAppConfigLoading } = (0, import_hooks75.useAppConfig)();
|
|
28958
29051
|
const primaryEventListTabs = useEventListTabs();
|
|
28959
29052
|
const { capture, consume } = (0, import_hooks75.useEventListState)();
|
|
28960
|
-
const [snapshot] = (0,
|
|
28961
|
-
const eventListStateRef = (0,
|
|
28962
|
-
const handleSelectEvent = (0,
|
|
29053
|
+
const [snapshot] = (0, import_react49.useState)(() => consume());
|
|
29054
|
+
const eventListStateRef = (0, import_react49.useRef)(null);
|
|
29055
|
+
const handleSelectEvent = (0, import_react49.useCallback)(
|
|
28963
29056
|
(event) => {
|
|
28964
29057
|
var _a2, _b2, _c2, _d2;
|
|
28965
29058
|
capture({
|
|
@@ -28978,14 +29071,14 @@ var HomePage = ({
|
|
|
28978
29071
|
);
|
|
28979
29072
|
const hasCustomTabs = !!tabs && tabs.length > 0;
|
|
28980
29073
|
const normalizedSearchValue = searchValue.trim();
|
|
28981
|
-
const [stickySelectedEvent, setStickySelectedEvent] = (0,
|
|
29074
|
+
const [stickySelectedEvent, setStickySelectedEvent] = (0, import_react49.useState)(
|
|
28982
29075
|
selectedEvent
|
|
28983
29076
|
);
|
|
28984
|
-
const [debouncedSearchValue, setDebouncedSearchValue] = (0,
|
|
29077
|
+
const [debouncedSearchValue, setDebouncedSearchValue] = (0, import_react49.useState)(() => {
|
|
28985
29078
|
return normalizedSearchValue.length >= MIN_SEARCH_LENGTH2 ? normalizedSearchValue : "";
|
|
28986
29079
|
});
|
|
28987
|
-
const [isMobileSearchViewport, setIsMobileSearchViewport] = (0,
|
|
28988
|
-
(0,
|
|
29080
|
+
const [isMobileSearchViewport, setIsMobileSearchViewport] = (0, import_react49.useState)(false);
|
|
29081
|
+
(0, import_react49.useEffect)(() => {
|
|
28989
29082
|
if (typeof window === "undefined") return;
|
|
28990
29083
|
const mediaQueryList = window.matchMedia(MOBILE_HOME_SEARCH_MEDIA_QUERY);
|
|
28991
29084
|
const handleMediaQueryChange = (event) => {
|
|
@@ -29003,7 +29096,7 @@ var HomePage = ({
|
|
|
29003
29096
|
mediaQueryList.removeListener(handleMediaQueryChange);
|
|
29004
29097
|
};
|
|
29005
29098
|
}, []);
|
|
29006
|
-
(0,
|
|
29099
|
+
(0, import_react49.useEffect)(() => {
|
|
29007
29100
|
if (normalizedSearchValue.length < MIN_SEARCH_LENGTH2) {
|
|
29008
29101
|
setDebouncedSearchValue("");
|
|
29009
29102
|
return;
|
|
@@ -29015,7 +29108,7 @@ var HomePage = ({
|
|
|
29015
29108
|
window.clearTimeout(timeoutId);
|
|
29016
29109
|
};
|
|
29017
29110
|
}, [normalizedSearchValue]);
|
|
29018
|
-
(0,
|
|
29111
|
+
(0, import_react49.useEffect)(() => {
|
|
29019
29112
|
if (selectedEvent) {
|
|
29020
29113
|
setStickySelectedEvent(selectedEvent);
|
|
29021
29114
|
return;
|
|
@@ -29030,30 +29123,30 @@ var HomePage = ({
|
|
|
29030
29123
|
limit: categoriesLimit,
|
|
29031
29124
|
enabled: !hasCustomTabs
|
|
29032
29125
|
});
|
|
29033
|
-
const categoryTabs = (0,
|
|
29126
|
+
const categoryTabs = (0, import_react49.useMemo)(() => {
|
|
29034
29127
|
return resolveCategoryTabs(categories, resolvedAllCategoryTabLabel);
|
|
29035
29128
|
}, [categories, resolvedAllCategoryTabLabel]);
|
|
29036
|
-
const resolvedTabs = (0,
|
|
29129
|
+
const resolvedTabs = (0, import_react49.useMemo)(() => {
|
|
29037
29130
|
if (hasCustomTabs && tabs) return tabs;
|
|
29038
29131
|
return categoryTabs;
|
|
29039
29132
|
}, [categoryTabs, hasCustomTabs, tabs]);
|
|
29040
|
-
const availableCategoryValues = (0,
|
|
29133
|
+
const availableCategoryValues = (0, import_react49.useMemo)(
|
|
29041
29134
|
() => resolvedTabs.filter((tab) => !tab.disabled).map((tab) => tab.value),
|
|
29042
29135
|
[resolvedTabs]
|
|
29043
29136
|
);
|
|
29044
29137
|
const resolvedDefaultCategory = resolveInitialTabValue(resolvedTabs, defaultActiveTab);
|
|
29045
29138
|
const defaultCategory = availableCategoryValues.includes(resolvedDefaultCategory) ? resolvedDefaultCategory : (_a = availableCategoryValues[0]) != null ? _a : resolvedDefaultCategory;
|
|
29046
|
-
const availableVenueTabs = (0,
|
|
29139
|
+
const availableVenueTabs = (0, import_react49.useMemo)(
|
|
29047
29140
|
() => primaryEventListTabs.filter((tab) => !tab.disabled && !tab.isComingSoon),
|
|
29048
29141
|
[primaryEventListTabs]
|
|
29049
29142
|
);
|
|
29050
|
-
const availableVenueValues = (0,
|
|
29143
|
+
const availableVenueValues = (0, import_react49.useMemo)(
|
|
29051
29144
|
() => availableVenueTabs.map((tab) => tab.value),
|
|
29052
29145
|
[availableVenueTabs]
|
|
29053
29146
|
);
|
|
29054
29147
|
const defaultVenue = (_c = (_b = availableVenueTabs[0]) == null ? void 0 : _b.value) != null ? _c : "matched";
|
|
29055
29148
|
const resolvedEventSectionItems = eventSectionItems && eventSectionItems.length > 0 ? eventSectionItems : getDefaultEventSectionItems(labels);
|
|
29056
|
-
const [discoveryFilterState, setDiscoveryFilterState] = (0,
|
|
29149
|
+
const [discoveryFilterState, setDiscoveryFilterState] = (0, import_react49.useState)(
|
|
29057
29150
|
() => {
|
|
29058
29151
|
var _a2, _b2;
|
|
29059
29152
|
return {
|
|
@@ -29064,12 +29157,12 @@ var HomePage = ({
|
|
|
29064
29157
|
};
|
|
29065
29158
|
}
|
|
29066
29159
|
);
|
|
29067
|
-
const discoveryFilterStateRef = (0,
|
|
29160
|
+
const discoveryFilterStateRef = (0, import_react49.useRef)(discoveryFilterState);
|
|
29068
29161
|
discoveryFilterStateRef.current = discoveryFilterState;
|
|
29069
|
-
const [isUrlStateReady, setIsUrlStateReady] = (0,
|
|
29070
|
-
const hasInitializedUrlStateRef = (0,
|
|
29162
|
+
const [isUrlStateReady, setIsUrlStateReady] = (0, import_react49.useState)(!enableEventDiscoveryUrlPersistence);
|
|
29163
|
+
const hasInitializedUrlStateRef = (0, import_react49.useRef)(false);
|
|
29071
29164
|
const activeTabValue = discoveryFilterState.category;
|
|
29072
|
-
const resolveCurrentUrlState = (0,
|
|
29165
|
+
const resolveCurrentUrlState = (0, import_react49.useCallback)(() => {
|
|
29073
29166
|
if (typeof window === "undefined") return null;
|
|
29074
29167
|
const parsedState = readEventDiscoveryUrlState(new URL(window.location.href).searchParams);
|
|
29075
29168
|
const resolvedState = resolveEventDiscoveryUrlState({
|
|
@@ -29093,7 +29186,7 @@ var HomePage = ({
|
|
|
29093
29186
|
shouldCanonicalize: resolvedState.shouldCanonicalize
|
|
29094
29187
|
};
|
|
29095
29188
|
}, [availableCategoryValues, availableVenueValues, defaultCategory, defaultVenue]);
|
|
29096
|
-
const writeFilterStateToHistory = (0,
|
|
29189
|
+
const writeFilterStateToHistory = (0, import_react49.useCallback)(
|
|
29097
29190
|
(state, historyMode) => {
|
|
29098
29191
|
if (!enableEventDiscoveryUrlPersistence || typeof window === "undefined") return;
|
|
29099
29192
|
const currentUrl = new URL(window.location.href);
|
|
@@ -29115,7 +29208,7 @@ var HomePage = ({
|
|
|
29115
29208
|
},
|
|
29116
29209
|
[defaultCategory, defaultVenue, enableEventDiscoveryUrlPersistence]
|
|
29117
29210
|
);
|
|
29118
|
-
const commitDiscoveryFilterState = (0,
|
|
29211
|
+
const commitDiscoveryFilterState = (0, import_react49.useCallback)(
|
|
29119
29212
|
(state, historyMode) => {
|
|
29120
29213
|
discoveryFilterStateRef.current = state;
|
|
29121
29214
|
setDiscoveryFilterState(state);
|
|
@@ -29123,7 +29216,7 @@ var HomePage = ({
|
|
|
29123
29216
|
},
|
|
29124
29217
|
[isUrlStateReady, writeFilterStateToHistory]
|
|
29125
29218
|
);
|
|
29126
|
-
(0,
|
|
29219
|
+
(0, import_react49.useEffect)(() => {
|
|
29127
29220
|
if (!enableEventDiscoveryUrlPersistence) {
|
|
29128
29221
|
hasInitializedUrlStateRef.current = false;
|
|
29129
29222
|
setIsUrlStateReady(true);
|
|
@@ -29162,7 +29255,7 @@ var HomePage = ({
|
|
|
29162
29255
|
isCategoriesLoading,
|
|
29163
29256
|
resolveCurrentUrlState
|
|
29164
29257
|
]);
|
|
29165
|
-
(0,
|
|
29258
|
+
(0, import_react49.useEffect)(() => {
|
|
29166
29259
|
if (!enableEventDiscoveryUrlPersistence || !isUrlStateReady) return;
|
|
29167
29260
|
const handlePopState = () => {
|
|
29168
29261
|
const resolvedUrlState = resolveCurrentUrlState();
|
|
@@ -29183,9 +29276,9 @@ var HomePage = ({
|
|
|
29183
29276
|
resolveCurrentUrlState,
|
|
29184
29277
|
writeFilterStateToHistory
|
|
29185
29278
|
]);
|
|
29186
|
-
const activeTabValueRef = (0,
|
|
29279
|
+
const activeTabValueRef = (0, import_react49.useRef)(activeTabValue);
|
|
29187
29280
|
activeTabValueRef.current = activeTabValue;
|
|
29188
|
-
(0,
|
|
29281
|
+
(0, import_react49.useEffect)(() => {
|
|
29189
29282
|
if (enableEventDiscoveryUrlPersistence && !isUrlStateReady) return;
|
|
29190
29283
|
const currentState = discoveryFilterStateRef.current;
|
|
29191
29284
|
const categoryIsAvailable = availableCategoryValues.includes(currentState.category);
|
|
@@ -29211,7 +29304,7 @@ var HomePage = ({
|
|
|
29211
29304
|
enableEventDiscoveryUrlPersistence,
|
|
29212
29305
|
isUrlStateReady
|
|
29213
29306
|
]);
|
|
29214
|
-
const tabsItems = (0,
|
|
29307
|
+
const tabsItems = (0, import_react49.useMemo)(() => {
|
|
29215
29308
|
return resolvedTabs.map((tab) => {
|
|
29216
29309
|
const isActive = tab.value === activeTabValue;
|
|
29217
29310
|
return {
|
|
@@ -29231,10 +29324,10 @@ var HomePage = ({
|
|
|
29231
29324
|
};
|
|
29232
29325
|
});
|
|
29233
29326
|
}, [activeTabValue, resolvedTabs]);
|
|
29234
|
-
const activeTab = (0,
|
|
29327
|
+
const activeTab = (0, import_react49.useMemo)(() => {
|
|
29235
29328
|
return resolvedTabs.find((tab) => tab.value === activeTabValue);
|
|
29236
29329
|
}, [activeTabValue, resolvedTabs]);
|
|
29237
|
-
const resolvedSectionItems = (0,
|
|
29330
|
+
const resolvedSectionItems = (0, import_react49.useMemo)(() => {
|
|
29238
29331
|
var _a2, _b2, _c2;
|
|
29239
29332
|
if (activeTabValue === ALL_CATEGORIES_TAB_VALUE) {
|
|
29240
29333
|
return resolvedEventSectionItems;
|
|
@@ -29431,7 +29524,7 @@ HomePage.displayName = "HomePage";
|
|
|
29431
29524
|
var import_hooks83 = require("@agg-build/hooks");
|
|
29432
29525
|
var import_sdk29 = require("@agg-build/sdk");
|
|
29433
29526
|
var import_dayjs9 = __toESM(require("dayjs"));
|
|
29434
|
-
var
|
|
29527
|
+
var import_react52 = require("react");
|
|
29435
29528
|
|
|
29436
29529
|
// src/pages/user-profile/components/available-balance-card.tsx
|
|
29437
29530
|
var import_hooks76 = require("@agg-build/hooks");
|
|
@@ -29479,6 +29572,7 @@ var AvailableBalanceCard = ({
|
|
|
29479
29572
|
label: label2,
|
|
29480
29573
|
valueLabel,
|
|
29481
29574
|
reservedValueLabel,
|
|
29575
|
+
kalshiValueLabel,
|
|
29482
29576
|
chains,
|
|
29483
29577
|
isLoading = false,
|
|
29484
29578
|
className,
|
|
@@ -29631,6 +29725,13 @@ var AvailableBalanceCard = ({
|
|
|
29631
29725
|
}
|
|
29632
29726
|
)
|
|
29633
29727
|
] }),
|
|
29728
|
+
kalshiValueLabel !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)("div", { className: "agg-balance-kalshi flex items-center justify-between gap-3", children: [
|
|
29729
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)("div", { className: "font-agg-sans text-agg-base leading-6 font-agg-bold text-agg-foreground", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime177.jsx)("div", { role: "status", "aria-label": "Loading Kalshi balance", children: /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(SkeletonBlock, { className: "h-6 w-16 rounded-agg-sm" }) }) : kalshiValueLabel }),
|
|
29730
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsxs)("span", { className: "flex h-5 shrink-0 items-center gap-1 rounded-[4px] bg-agg-secondary-hover px-1.5", children: [
|
|
29731
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)(VenueLogo, { venue: "kalshi", size: "small", className: "size-3" }),
|
|
29732
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)("span", { className: "font-agg-sans text-agg-xs leading-agg-4 font-agg-normal text-agg-muted-foreground", children: labels.venues.kalshi })
|
|
29733
|
+
] })
|
|
29734
|
+
] }) : null,
|
|
29634
29735
|
!isLoading && reservedValueLabel ? /* @__PURE__ */ (0, import_jsx_runtime177.jsx)("p", { className: "font-agg-sans text-agg-xs leading-agg-4 text-agg-muted-foreground", children: balanceLabels.reservedForOpenOrders(reservedValueLabel) }) : null
|
|
29635
29736
|
]
|
|
29636
29737
|
}
|
|
@@ -29773,7 +29874,7 @@ var ClaimActivityBreakdownModal = ({
|
|
|
29773
29874
|
var import_hooks78 = require("@agg-build/hooks");
|
|
29774
29875
|
var import_sdk28 = require("@agg-build/sdk");
|
|
29775
29876
|
var Dialog9 = __toESM(require("@radix-ui/react-dialog"));
|
|
29776
|
-
var
|
|
29877
|
+
var import_react50 = require("react");
|
|
29777
29878
|
var import_zod3 = require("zod");
|
|
29778
29879
|
var import_jsx_runtime179 = require("react/jsx-runtime");
|
|
29779
29880
|
var USDC_DECIMALS = 6;
|
|
@@ -29857,16 +29958,16 @@ var ManageBalancesModal = ({
|
|
|
29857
29958
|
const depositAddressesQuery = (0, import_hooks78.useDepositAddresses)({ enabled: open });
|
|
29858
29959
|
const policiesQuery = (0, import_hooks78.useBalanceRefillPolicies)({ enabled: open });
|
|
29859
29960
|
const toastContext = useOptionalToast();
|
|
29860
|
-
const descriptionId = (0,
|
|
29861
|
-
const savingRef = (0,
|
|
29862
|
-
const [expandedChainIds, setExpandedChainIds] = (0,
|
|
29863
|
-
const [resetChainIds, setResetChainIds] = (0,
|
|
29864
|
-
const [drafts, setDrafts] = (0,
|
|
29865
|
-
const [initialDrafts, setInitialDrafts] = (0,
|
|
29866
|
-
const [submissionErrors, setSubmissionErrors] = (0,
|
|
29867
|
-
const [isInitialized, setIsInitialized] = (0,
|
|
29868
|
-
const [isSaving, setIsSaving] = (0,
|
|
29869
|
-
const networks = (0,
|
|
29961
|
+
const descriptionId = (0, import_react50.useId)();
|
|
29962
|
+
const savingRef = (0, import_react50.useRef)(false);
|
|
29963
|
+
const [expandedChainIds, setExpandedChainIds] = (0, import_react50.useState)(/* @__PURE__ */ new Set());
|
|
29964
|
+
const [resetChainIds, setResetChainIds] = (0, import_react50.useState)(/* @__PURE__ */ new Set());
|
|
29965
|
+
const [drafts, setDrafts] = (0, import_react50.useState)({});
|
|
29966
|
+
const [initialDrafts, setInitialDrafts] = (0, import_react50.useState)({});
|
|
29967
|
+
const [submissionErrors, setSubmissionErrors] = (0, import_react50.useState)({});
|
|
29968
|
+
const [isInitialized, setIsInitialized] = (0, import_react50.useState)(false);
|
|
29969
|
+
const [isSaving, setIsSaving] = (0, import_react50.useState)(false);
|
|
29970
|
+
const networks = (0, import_react50.useMemo)(() => {
|
|
29870
29971
|
var _a, _b, _c;
|
|
29871
29972
|
const supportedChains = (_a = depositAddressesQuery.supportedChains) != null ? _a : [];
|
|
29872
29973
|
const availableBalanceBreakdown = (_c = (_b = balanceState.availableBalanceBreakdown) != null ? _b : balanceState.balanceBreakdown) != null ? _c : [];
|
|
@@ -29906,7 +30007,7 @@ var ManageBalancesModal = ({
|
|
|
29906
30007
|
const hasPoliciesLoadError = policiesQuery.isError && policiesQuery.data === void 0;
|
|
29907
30008
|
const loadError = hasDepositAddressesLoadError ? depositAddressesQuery.error : hasPoliciesLoadError ? policiesQuery.error : balanceState.error;
|
|
29908
30009
|
const hasLoadError = hasDepositAddressesLoadError || hasPoliciesLoadError || Boolean(balanceState.error);
|
|
29909
|
-
(0,
|
|
30010
|
+
(0, import_react50.useEffect)(() => {
|
|
29910
30011
|
if (open) return;
|
|
29911
30012
|
setExpandedChainIds(/* @__PURE__ */ new Set());
|
|
29912
30013
|
setResetChainIds(/* @__PURE__ */ new Set());
|
|
@@ -29917,7 +30018,7 @@ var ManageBalancesModal = ({
|
|
|
29917
30018
|
setIsSaving(false);
|
|
29918
30019
|
savingRef.current = false;
|
|
29919
30020
|
}, [open]);
|
|
29920
|
-
(0,
|
|
30021
|
+
(0, import_react50.useEffect)(() => {
|
|
29921
30022
|
if (!open || isLoading || hasLoadError || isInitialized) return;
|
|
29922
30023
|
const nextDrafts = Object.fromEntries(
|
|
29923
30024
|
networks.map((network) => [network.chainId, getInitialDraft(network.policy)])
|
|
@@ -29926,7 +30027,7 @@ var ManageBalancesModal = ({
|
|
|
29926
30027
|
setInitialDrafts(nextDrafts);
|
|
29927
30028
|
setIsInitialized(true);
|
|
29928
30029
|
}, [hasLoadError, isInitialized, isLoading, networks, open]);
|
|
29929
|
-
const validateDraft = (0,
|
|
30030
|
+
const validateDraft = (0, import_react50.useCallback)(
|
|
29930
30031
|
(network, draft) => {
|
|
29931
30032
|
const errors = {};
|
|
29932
30033
|
const minimum = draft.minimum.trim();
|
|
@@ -29960,7 +30061,7 @@ var ManageBalancesModal = ({
|
|
|
29960
30061
|
},
|
|
29961
30062
|
[refillLabels]
|
|
29962
30063
|
);
|
|
29963
|
-
const dirtyNetworks = (0,
|
|
30064
|
+
const dirtyNetworks = (0, import_react50.useMemo)(
|
|
29964
30065
|
() => networks.filter((network) => {
|
|
29965
30066
|
if (!network.canManageBalance) return false;
|
|
29966
30067
|
if (resetChainIds.has(network.chainId)) return true;
|
|
@@ -29971,7 +30072,7 @@ var ManageBalancesModal = ({
|
|
|
29971
30072
|
}),
|
|
29972
30073
|
[drafts, initialDrafts, networks, resetChainIds]
|
|
29973
30074
|
);
|
|
29974
|
-
const validationErrors = (0,
|
|
30075
|
+
const validationErrors = (0, import_react50.useMemo)(
|
|
29975
30076
|
() => Object.fromEntries(
|
|
29976
30077
|
dirtyNetworks.map((network) => {
|
|
29977
30078
|
var _a;
|
|
@@ -29987,14 +30088,14 @@ var ManageBalancesModal = ({
|
|
|
29987
30088
|
(errors) => errors.minimum || errors.refillTo || errors.general
|
|
29988
30089
|
);
|
|
29989
30090
|
const isSaveDisabled = dirtyNetworks.length === 0 || hasValidationErrors || isSaving;
|
|
29990
|
-
const handleOpenChange = (0,
|
|
30091
|
+
const handleOpenChange = (0, import_react50.useCallback)(
|
|
29991
30092
|
(nextOpen) => {
|
|
29992
30093
|
if (isSaving && !nextOpen) return;
|
|
29993
30094
|
onOpenChange(nextOpen);
|
|
29994
30095
|
},
|
|
29995
30096
|
[isSaving, onOpenChange]
|
|
29996
30097
|
);
|
|
29997
|
-
const handleToggleNetwork = (0,
|
|
30098
|
+
const handleToggleNetwork = (0, import_react50.useCallback)((chainId, canManageBalance) => {
|
|
29998
30099
|
if (!canManageBalance) return;
|
|
29999
30100
|
setExpandedChainIds((current) => {
|
|
30000
30101
|
const next = new Set(current);
|
|
@@ -30003,7 +30104,7 @@ var ManageBalancesModal = ({
|
|
|
30003
30104
|
return next;
|
|
30004
30105
|
});
|
|
30005
30106
|
}, []);
|
|
30006
|
-
const handleDraftChange = (0,
|
|
30107
|
+
const handleDraftChange = (0, import_react50.useCallback)(
|
|
30007
30108
|
(chainId, field, value) => {
|
|
30008
30109
|
if (!EDITABLE_AMOUNT_PATTERN.test(value)) return;
|
|
30009
30110
|
setDrafts((current) => {
|
|
@@ -30032,7 +30133,7 @@ var ManageBalancesModal = ({
|
|
|
30032
30133
|
},
|
|
30033
30134
|
[]
|
|
30034
30135
|
);
|
|
30035
|
-
const handleResetNetwork = (0,
|
|
30136
|
+
const handleResetNetwork = (0, import_react50.useCallback)((network) => {
|
|
30036
30137
|
setDrafts((current) => __spreadProps(__spreadValues({}, current), {
|
|
30037
30138
|
[network.chainId]: { minimum: "0", refillTo: "0" }
|
|
30038
30139
|
}));
|
|
@@ -30048,7 +30149,7 @@ var ManageBalancesModal = ({
|
|
|
30048
30149
|
return __spreadProps(__spreadValues({}, current), { [network.chainId]: {} });
|
|
30049
30150
|
});
|
|
30050
30151
|
}, []);
|
|
30051
|
-
const handleAmountBlur = (0,
|
|
30152
|
+
const handleAmountBlur = (0, import_react50.useCallback)((chainId, field) => {
|
|
30052
30153
|
setDrafts((current) => {
|
|
30053
30154
|
const currentDraft = current[chainId];
|
|
30054
30155
|
if (!currentDraft) return current;
|
|
@@ -30059,12 +30160,12 @@ var ManageBalancesModal = ({
|
|
|
30059
30160
|
});
|
|
30060
30161
|
});
|
|
30061
30162
|
}, []);
|
|
30062
|
-
const handleRetry = (0,
|
|
30163
|
+
const handleRetry = (0, import_react50.useCallback)(() => {
|
|
30063
30164
|
void depositAddressesQuery.refetch();
|
|
30064
30165
|
void policiesQuery.refetch();
|
|
30065
30166
|
balanceState.refetch();
|
|
30066
30167
|
}, [balanceState, depositAddressesQuery, policiesQuery]);
|
|
30067
|
-
const handleSave = (0,
|
|
30168
|
+
const handleSave = (0, import_react50.useCallback)(() => __async(null, null, function* () {
|
|
30068
30169
|
if (savingRef.current || isSaveDisabled) return;
|
|
30069
30170
|
savingRef.current = true;
|
|
30070
30171
|
setIsSaving(true);
|
|
@@ -30477,7 +30578,7 @@ ManageBalancesModal.displayName = "ManageBalancesModal";
|
|
|
30477
30578
|
|
|
30478
30579
|
// src/pages/user-profile/components/positions-activity.tsx
|
|
30479
30580
|
var import_hooks81 = require("@agg-build/hooks");
|
|
30480
|
-
var
|
|
30581
|
+
var import_react51 = require("react");
|
|
30481
30582
|
|
|
30482
30583
|
// src/pages/user-profile/user-profile.constants.ts
|
|
30483
30584
|
var USER_PROFILE_TAB_POSITIONS = "positions";
|
|
@@ -30556,6 +30657,7 @@ var resolvePositionStatus = (position) => {
|
|
|
30556
30657
|
return "open";
|
|
30557
30658
|
};
|
|
30558
30659
|
var resolvePositionBucket = (position) => {
|
|
30660
|
+
if (position.status === "closed") return "closed";
|
|
30559
30661
|
const status = resolvePositionStatus(position);
|
|
30560
30662
|
if (status === "won_unclaimed") return "active";
|
|
30561
30663
|
if (status === "open") return "active";
|
|
@@ -31332,6 +31434,18 @@ var OpenOrderRow = ({
|
|
|
31332
31434
|
};
|
|
31333
31435
|
const canCancel = canCancelOpenOrder(order);
|
|
31334
31436
|
const isPending = isPendingOpenOrder(order);
|
|
31437
|
+
const sideLabel = order.side === "buy" ? labels.buy : order.side === "sell" ? labels.sell : void 0;
|
|
31438
|
+
const outcomePillLabel = sideLabel ? `${sideLabel} ${order.outcomeLabel}` : order.outcomeLabel;
|
|
31439
|
+
const currentPriceLabel = order.currentPriceLabel ? `${labels.nowPrefix} ${order.currentPriceLabel}` : void 0;
|
|
31440
|
+
const mobileStats = [
|
|
31441
|
+
__spreadValues({
|
|
31442
|
+
label: resolvedLimitPriceHeader,
|
|
31443
|
+
value: (_a = order.limitPriceLabel) != null ? _a : "\u2014"
|
|
31444
|
+
}, currentPriceLabel ? { subValue: currentPriceLabel } : {}),
|
|
31445
|
+
{ label: resolvedFilledHeader, value: order.filledLabel },
|
|
31446
|
+
{ label: resolvedTotalHeader, value: order.valueLabel },
|
|
31447
|
+
{ label: resolvedExpirationHeader, value: (_b = order.expirationLabel) != null ? _b : "\u2014" }
|
|
31448
|
+
];
|
|
31335
31449
|
const Wrapper = href ? "a" : "div";
|
|
31336
31450
|
const wrapperProps = href ? {
|
|
31337
31451
|
href,
|
|
@@ -31370,22 +31484,23 @@ var OpenOrderRow = ({
|
|
|
31370
31484
|
) }),
|
|
31371
31485
|
/* @__PURE__ */ (0, import_jsx_runtime182.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
|
|
31372
31486
|
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)("p", { className: "agg-open-order-market min-w-0 overflow-hidden font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground [display:-webkit-box] [-webkit-line-clamp:2] [-webkit-box-orient:vertical] lg:text-agg-base lg:leading-agg-6 lg:whitespace-nowrap lg:text-ellipsis lg:[-webkit-line-clamp:1] lg:[display:block]", children: order.title }),
|
|
31373
|
-
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)("span", { className: "agg-open-order-outcome hidden lg:inline-flex w-fit items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ (0, import_jsx_runtime182.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children:
|
|
31487
|
+
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)("span", { className: "agg-open-order-outcome hidden lg:inline-flex w-fit items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ (0, import_jsx_runtime182.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: outcomePillLabel }) })
|
|
31374
31488
|
] })
|
|
31375
31489
|
] }),
|
|
31376
31490
|
/* @__PURE__ */ (0, import_jsx_runtime182.jsxs)("div", { className: "flex w-full flex-wrap items-center gap-x-4 gap-y-2 lg:hidden", children: [
|
|
31377
|
-
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)("span", { className: "agg-open-order-outcome inline-flex shrink-0 items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ (0, import_jsx_runtime182.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children:
|
|
31378
|
-
[
|
|
31379
|
-
|
|
31380
|
-
|
|
31381
|
-
|
|
31382
|
-
|
|
31383
|
-
|
|
31384
|
-
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)("span", { className: "font-agg-sans text-agg-lg leading-agg-7 font-agg-normal text-agg-foreground", children: value }),
|
|
31385
|
-
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)("span", { className: "font-agg-sans text-[10px] leading-[14px] font-agg-bold uppercase text-agg-muted-foreground", children: label2 })
|
|
31491
|
+
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)("span", { className: "agg-open-order-outcome inline-flex shrink-0 items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ (0, import_jsx_runtime182.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: outcomePillLabel }) }),
|
|
31492
|
+
mobileStats.map(({ label: label2, value, subValue }) => /* @__PURE__ */ (0, import_jsx_runtime182.jsxs)("div", { className: "flex flex-col gap-0.5", children: [
|
|
31493
|
+
/* @__PURE__ */ (0, import_jsx_runtime182.jsxs)("div", { className: "flex items-baseline gap-1.5 whitespace-nowrap", children: [
|
|
31494
|
+
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)("span", { className: "font-agg-sans text-agg-lg leading-agg-7 font-agg-normal text-agg-foreground", children: value }),
|
|
31495
|
+
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)("span", { className: "font-agg-sans text-[10px] leading-[14px] font-agg-bold uppercase text-agg-muted-foreground", children: label2 })
|
|
31496
|
+
] }),
|
|
31497
|
+
subValue ? /* @__PURE__ */ (0, import_jsx_runtime182.jsx)("span", { className: "agg-open-order-current-price font-agg-sans text-agg-sm leading-agg-5 font-agg-normal whitespace-nowrap text-agg-foreground", children: subValue }) : null
|
|
31386
31498
|
] }, label2))
|
|
31387
31499
|
] }),
|
|
31388
|
-
/* @__PURE__ */ (0, import_jsx_runtime182.
|
|
31500
|
+
/* @__PURE__ */ (0, import_jsx_runtime182.jsxs)("div", { className: "agg-open-order-limit-price hidden w-[120px] shrink-0 flex-col justify-center gap-0.5 lg:flex", children: [
|
|
31501
|
+
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)("p", { className: "agg-type-body-strong text-agg-foreground", children: (_c = order.limitPriceLabel) != null ? _c : "\u2014" }),
|
|
31502
|
+
currentPriceLabel ? /* @__PURE__ */ (0, import_jsx_runtime182.jsx)("p", { className: "agg-open-order-current-price font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: currentPriceLabel }) : null
|
|
31503
|
+
] }),
|
|
31389
31504
|
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)("p", { className: "agg-open-order-filled hidden w-[120px] shrink-0 agg-type-body-strong text-agg-foreground lg:block", children: order.filledLabel }),
|
|
31390
31505
|
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)("p", { className: "agg-open-order-value hidden w-[120px] shrink-0 agg-type-body-strong text-agg-foreground lg:block", children: order.valueLabel }),
|
|
31391
31506
|
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)("p", { className: "agg-open-order-expiration hidden w-[140px] shrink-0 agg-type-label text-agg-foreground lg:block", children: (_d = order.expirationLabel) != null ? _d : "\u2014" }),
|
|
@@ -31476,8 +31591,8 @@ var ResultBadge = ({
|
|
|
31476
31591
|
status,
|
|
31477
31592
|
labels
|
|
31478
31593
|
}) => {
|
|
31479
|
-
|
|
31480
|
-
|
|
31594
|
+
const isWon = status === "won_claimed" || status === "won_unclaimed";
|
|
31595
|
+
if (!isWon && status !== "lost" && status !== "sold") return null;
|
|
31481
31596
|
const isSold = status === "sold";
|
|
31482
31597
|
return /* @__PURE__ */ (0, import_jsx_runtime183.jsxs)(
|
|
31483
31598
|
"span",
|
|
@@ -31743,7 +31858,7 @@ var getTabItems = (tabsLabels, showOpenOrders) => [
|
|
|
31743
31858
|
...showOpenOrders ? [{ value: USER_PROFILE_TAB_OPEN_ORDERS, label: tabsLabels.openOrders }] : [],
|
|
31744
31859
|
{ value: USER_PROFILE_TAB_ACTIVITY, label: tabsLabels.activity }
|
|
31745
31860
|
];
|
|
31746
|
-
var TabRowsSkeleton = ({ ariaLabel }) => /* @__PURE__ */ (0, import_jsx_runtime184.jsx)("div", { role: "status", "aria-label": ariaLabel, className: "flex flex-col gap-3 sm:gap-4", children: Array.from({ length: 3 }).map((_, index, acc) => /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)(
|
|
31861
|
+
var TabRowsSkeleton = ({ ariaLabel }) => /* @__PURE__ */ (0, import_jsx_runtime184.jsx)("div", { role: "status", "aria-label": ariaLabel, className: "flex flex-col gap-3 sm:gap-4", children: Array.from({ length: 3 }).map((_, index, acc) => /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)(import_react51.Fragment, { children: [
|
|
31747
31862
|
/* @__PURE__ */ (0, import_jsx_runtime184.jsx)("div", { className: "h-14 rounded-agg-sm bg-agg-secondary-hover/80 sm:h-16" }, index),
|
|
31748
31863
|
index < acc.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime184.jsx)("div", { className: "agg-position-divider h-px w-full shrink-0 bg-agg-separator", "aria-hidden": true }) : null
|
|
31749
31864
|
] }, index)) });
|
|
@@ -31791,12 +31906,12 @@ var PositionsActivity = ({
|
|
|
31791
31906
|
const positionsLabels = userProfileLabels.positions;
|
|
31792
31907
|
const openOrdersLabels = userProfileLabels.openOrders;
|
|
31793
31908
|
const { formatCurrency: formatCurrency2, formatPrice } = (0, import_hooks81.useAggUiConfig)().formatting;
|
|
31794
|
-
const tabItems = (0,
|
|
31909
|
+
const tabItems = (0, import_react51.useMemo)(
|
|
31795
31910
|
() => getTabItems(userProfileLabels.tabs, showOpenOrders),
|
|
31796
31911
|
[showOpenOrders, userProfileLabels.tabs]
|
|
31797
31912
|
);
|
|
31798
31913
|
const isTabControlled = tab !== void 0;
|
|
31799
|
-
const [internalActiveTab, setInternalActiveTab] = (0,
|
|
31914
|
+
const [internalActiveTab, setInternalActiveTab] = (0, import_react51.useState)(
|
|
31800
31915
|
tab != null ? tab : USER_PROFILE_TAB_POSITIONS
|
|
31801
31916
|
);
|
|
31802
31917
|
const requestedActiveTab = isTabControlled ? tab : internalActiveTab;
|
|
@@ -31806,21 +31921,21 @@ var PositionsActivity = ({
|
|
|
31806
31921
|
if (!isTabControlled) setInternalActiveTab(next);
|
|
31807
31922
|
onTabChange == null ? void 0 : onTabChange(next);
|
|
31808
31923
|
};
|
|
31809
|
-
const [positionFilter, setPositionFilter] = (0,
|
|
31810
|
-
const [searchValue, setSearchValue] = (0,
|
|
31811
|
-
const [isSearchFocused, setIsSearchFocused] = (0,
|
|
31812
|
-
const [locallyClaimedPositionIds, setLocallyClaimedPositionIds] = (0,
|
|
31924
|
+
const [positionFilter, setPositionFilter] = (0, import_react51.useState)(initialPositionFilter);
|
|
31925
|
+
const [searchValue, setSearchValue] = (0, import_react51.useState)("");
|
|
31926
|
+
const [isSearchFocused, setIsSearchFocused] = (0, import_react51.useState)(false);
|
|
31927
|
+
const [locallyClaimedPositionIds, setLocallyClaimedPositionIds] = (0, import_react51.useState)(
|
|
31813
31928
|
() => /* @__PURE__ */ new Set()
|
|
31814
31929
|
);
|
|
31815
|
-
const positionsLoadMoreRef = (0,
|
|
31816
|
-
const openOrdersLoadMoreRef = (0,
|
|
31817
|
-
const activitiesLoadMoreRef = (0,
|
|
31818
|
-
const rowsScrollRef = (0,
|
|
31930
|
+
const positionsLoadMoreRef = (0, import_react51.useRef)(null);
|
|
31931
|
+
const openOrdersLoadMoreRef = (0, import_react51.useRef)(null);
|
|
31932
|
+
const activitiesLoadMoreRef = (0, import_react51.useRef)(null);
|
|
31933
|
+
const rowsScrollRef = (0, import_react51.useRef)(null);
|
|
31819
31934
|
const isPositionsTab = activeTab === USER_PROFILE_TAB_POSITIONS;
|
|
31820
31935
|
const isOpenOrdersTab = activeTab === USER_PROFILE_TAB_OPEN_ORDERS;
|
|
31821
31936
|
const isActivityTab = activeTab === USER_PROFILE_TAB_ACTIVITY;
|
|
31822
31937
|
const isClosedPositionsFilter = isPositionsTab && positionFilter === "closed";
|
|
31823
|
-
const positionsForCurrentFilter = (0,
|
|
31938
|
+
const positionsForCurrentFilter = (0, import_react51.useMemo)(() => {
|
|
31824
31939
|
if (positionFilter === "active") {
|
|
31825
31940
|
return activePositions.filter((position) => !locallyClaimedPositionIds.has(position.id));
|
|
31826
31941
|
}
|
|
@@ -31837,7 +31952,7 @@ var PositionsActivity = ({
|
|
|
31837
31952
|
}
|
|
31838
31953
|
return Array.from(byId.values());
|
|
31839
31954
|
}, [activePositions, closedPositions, locallyClaimedPositionIds, positionFilter]);
|
|
31840
|
-
const filteredPositions = (0,
|
|
31955
|
+
const filteredPositions = (0, import_react51.useMemo)(() => {
|
|
31841
31956
|
if (!searchValue.trim()) return positionsForCurrentFilter;
|
|
31842
31957
|
const q = searchValue.toLowerCase();
|
|
31843
31958
|
return positionsForCurrentFilter.filter((p) => p.title.toLowerCase().includes(q));
|
|
@@ -31862,7 +31977,7 @@ var PositionsActivity = ({
|
|
|
31862
31977
|
const isLoadingMorePositions = positionFilter === "active" ? isLoadingMoreActivePositions : isLoadingMoreClosedPositions;
|
|
31863
31978
|
const loadMorePositions = positionFilter === "active" ? onLoadMoreActivePositions : onLoadMoreClosedPositions;
|
|
31864
31979
|
const filteredActivities = activities;
|
|
31865
|
-
const searchResults = (0,
|
|
31980
|
+
const searchResults = (0, import_react51.useMemo)(() => {
|
|
31866
31981
|
if (!isPositionsTab || !searchValue.trim()) return [];
|
|
31867
31982
|
return filteredPositions.slice(0, 5).map((position) => ({
|
|
31868
31983
|
id: position.id,
|
|
@@ -31891,11 +32006,11 @@ var PositionsActivity = ({
|
|
|
31891
32006
|
const handleSearchChange = (event) => {
|
|
31892
32007
|
setSearchValue(event.target.value);
|
|
31893
32008
|
};
|
|
31894
|
-
(0,
|
|
32009
|
+
(0, import_react51.useEffect)(() => {
|
|
31895
32010
|
if (isPositionsTab) return;
|
|
31896
32011
|
setIsSearchFocused(false);
|
|
31897
32012
|
}, [isPositionsTab]);
|
|
31898
|
-
(0,
|
|
32013
|
+
(0, import_react51.useEffect)(() => {
|
|
31899
32014
|
if (!isPositionsTab || !hasMorePositions) return;
|
|
31900
32015
|
const target = positionsLoadMoreRef.current;
|
|
31901
32016
|
if (!target || !loadMorePositions) return;
|
|
@@ -31917,7 +32032,7 @@ var PositionsActivity = ({
|
|
|
31917
32032
|
isPositionsTab,
|
|
31918
32033
|
loadMorePositions
|
|
31919
32034
|
]);
|
|
31920
|
-
(0,
|
|
32035
|
+
(0, import_react51.useEffect)(() => {
|
|
31921
32036
|
if (!isActivityTab || !hasMoreActivities) return;
|
|
31922
32037
|
const target = activitiesLoadMoreRef.current;
|
|
31923
32038
|
if (!target || !onLoadMoreActivities) return;
|
|
@@ -31939,7 +32054,7 @@ var PositionsActivity = ({
|
|
|
31939
32054
|
isLoadingMoreActivities,
|
|
31940
32055
|
onLoadMoreActivities
|
|
31941
32056
|
]);
|
|
31942
|
-
(0,
|
|
32057
|
+
(0, import_react51.useEffect)(() => {
|
|
31943
32058
|
if (!isOpenOrdersTab || !hasMoreOpenOrders) return;
|
|
31944
32059
|
const target = openOrdersLoadMoreRef.current;
|
|
31945
32060
|
if (!target || !onLoadMoreOpenOrders) return;
|
|
@@ -32174,7 +32289,7 @@ var PositionsActivity = ({
|
|
|
32174
32289
|
}
|
|
32175
32290
|
) : filteredPositions.length > 0 ? filteredPositions.map((position, index) => {
|
|
32176
32291
|
var _a;
|
|
32177
|
-
return /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)(
|
|
32292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)(import_react51.Fragment, { children: [
|
|
32178
32293
|
index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(
|
|
32179
32294
|
"div",
|
|
32180
32295
|
{
|
|
@@ -32219,7 +32334,7 @@ var PositionsActivity = ({
|
|
|
32219
32334
|
title: openOrdersLabels.errorTitle,
|
|
32220
32335
|
description: openOrdersLabels.errorDescription
|
|
32221
32336
|
}
|
|
32222
|
-
) : openOrders.length > 0 ? openOrders.map((order, index) => /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)(
|
|
32337
|
+
) : openOrders.length > 0 ? openOrders.map((order, index) => /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)(import_react51.Fragment, { children: [
|
|
32223
32338
|
index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(
|
|
32224
32339
|
"div",
|
|
32225
32340
|
{
|
|
@@ -32266,7 +32381,7 @@ var PositionsActivity = ({
|
|
|
32266
32381
|
title: "Unable to load activity",
|
|
32267
32382
|
description: "Please try again in a moment."
|
|
32268
32383
|
}
|
|
32269
|
-
) : filteredActivities.length > 0 ? filteredActivities.map((activity, index) => /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)(
|
|
32384
|
+
) : filteredActivities.length > 0 ? filteredActivities.map((activity, index) => /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)(import_react51.Fragment, { children: [
|
|
32270
32385
|
index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(
|
|
32271
32386
|
"div",
|
|
32272
32387
|
{
|
|
@@ -32699,11 +32814,13 @@ var formatScaledNumberTwoDecimals = (value) => {
|
|
|
32699
32814
|
if (parsed == null) return "0.00";
|
|
32700
32815
|
return twoDecimalNumberFormatter.format(parsed);
|
|
32701
32816
|
};
|
|
32817
|
+
var formatPriceCentsLabel = (value) => `${limitPriceCentsFormatter.format(value * 100)}\xA2`;
|
|
32702
32818
|
var formatLimitPriceLabel2 = (value) => {
|
|
32703
32819
|
const parsed = parseRawMicroValue(value);
|
|
32704
32820
|
if (parsed == null) return void 0;
|
|
32705
|
-
return
|
|
32821
|
+
return formatPriceCentsLabel(parsed);
|
|
32706
32822
|
};
|
|
32823
|
+
var normalizeOutcomeMatchLabel = (value) => typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
32707
32824
|
var formatOpenOrderExpirationLabel = ({
|
|
32708
32825
|
timeInForce,
|
|
32709
32826
|
expiresAt,
|
|
@@ -33134,8 +33251,8 @@ var UserProfilePage = ({
|
|
|
33134
33251
|
onError
|
|
33135
33252
|
}) => {
|
|
33136
33253
|
var _a, _b, _c;
|
|
33137
|
-
const [isHydrated, setIsHydrated] = (0,
|
|
33138
|
-
(0,
|
|
33254
|
+
const [isHydrated, setIsHydrated] = (0, import_react52.useState)(false);
|
|
33255
|
+
(0, import_react52.useEffect)(() => {
|
|
33139
33256
|
setIsHydrated(true);
|
|
33140
33257
|
}, []);
|
|
33141
33258
|
const { user: currentUser, isAuthenticated } = (0, import_hooks83.useAggAuthState)();
|
|
@@ -33148,28 +33265,28 @@ var UserProfilePage = ({
|
|
|
33148
33265
|
const client = (0, import_hooks83.useAggClient)();
|
|
33149
33266
|
const cancelOrderMutation = (0, import_hooks83.useCancelManagedOrder)();
|
|
33150
33267
|
const toastContext = useOptionalToast();
|
|
33151
|
-
const [internalCancellingIds, setInternalCancellingIds] = (0,
|
|
33268
|
+
const [internalCancellingIds, setInternalCancellingIds] = (0, import_react52.useState)({});
|
|
33152
33269
|
const { claim: startClaim, claimingKeys } = useClaimWinnings({
|
|
33153
33270
|
onClaim,
|
|
33154
33271
|
onClaimResult,
|
|
33155
33272
|
onClaimSubmitError,
|
|
33156
33273
|
externalClaimingKeys: claimingPositionKeys
|
|
33157
33274
|
});
|
|
33158
|
-
const [profileUser, setProfileUser] = (0,
|
|
33275
|
+
const [profileUser, setProfileUser] = (0, import_react52.useState)(void 0);
|
|
33159
33276
|
const shouldUseHookData = !user;
|
|
33160
|
-
const connectedVenues = (0,
|
|
33277
|
+
const connectedVenues = (0, import_react52.useMemo)(() => {
|
|
33161
33278
|
var _a2;
|
|
33162
33279
|
if (!shouldUseHookData) return [];
|
|
33163
33280
|
const fromBalance = (_a2 = balanceState.connectedVenues) != null ? _a2 : [];
|
|
33164
33281
|
return [...new Set(fromBalance)].sort((a, b) => a.localeCompare(b));
|
|
33165
33282
|
}, [balanceState, shouldUseHookData]);
|
|
33166
|
-
const [positionFilter, setPositionFilter] = (0,
|
|
33167
|
-
const [selectedClaimActivity, setSelectedClaimActivity] = (0,
|
|
33168
|
-
const [isManageBalancesOpen, setIsManageBalancesOpen] = (0,
|
|
33169
|
-
const manageBalancesButtonRef = (0,
|
|
33283
|
+
const [positionFilter, setPositionFilter] = (0, import_react52.useState)(initialPositionFilter);
|
|
33284
|
+
const [selectedClaimActivity, setSelectedClaimActivity] = (0, import_react52.useState)(null);
|
|
33285
|
+
const [isManageBalancesOpen, setIsManageBalancesOpen] = (0, import_react52.useState)(false);
|
|
33286
|
+
const manageBalancesButtonRef = (0, import_react52.useRef)(null);
|
|
33170
33287
|
const { executionMode: resolvedExecutionMode, isPaperMode } = (0, import_hooks83.useResolvedExecutionMode)(executionMode);
|
|
33171
33288
|
const queryExecutionMode = resolvedExecutionMode === "paper" ? "paper" : void 0;
|
|
33172
|
-
const handleManageBalancesOpenChange = (0,
|
|
33289
|
+
const handleManageBalancesOpenChange = (0, import_react52.useCallback)((open) => {
|
|
33173
33290
|
setIsManageBalancesOpen(open);
|
|
33174
33291
|
if (open) return;
|
|
33175
33292
|
requestAnimationFrame(() => {
|
|
@@ -33189,14 +33306,14 @@ var UserProfilePage = ({
|
|
|
33189
33306
|
limit: 25,
|
|
33190
33307
|
mode: queryExecutionMode
|
|
33191
33308
|
});
|
|
33192
|
-
const handlePositionFilterChange = (0,
|
|
33309
|
+
const handlePositionFilterChange = (0, import_react52.useCallback)(
|
|
33193
33310
|
(filter) => {
|
|
33194
33311
|
setPositionFilter(filter);
|
|
33195
33312
|
onPositionFilterChangeProp == null ? void 0 : onPositionFilterChangeProp(filter);
|
|
33196
33313
|
},
|
|
33197
33314
|
[onPositionFilterChangeProp]
|
|
33198
33315
|
);
|
|
33199
|
-
(0,
|
|
33316
|
+
(0, import_react52.useEffect)(() => {
|
|
33200
33317
|
setPositionFilter(initialPositionFilter);
|
|
33201
33318
|
}, [initialPositionFilter]);
|
|
33202
33319
|
const ordersQuery = (0, import_hooks83.useExecutionOrders)({
|
|
@@ -33261,7 +33378,7 @@ var UserProfilePage = ({
|
|
|
33261
33378
|
limit: 25,
|
|
33262
33379
|
mode: queryExecutionMode
|
|
33263
33380
|
});
|
|
33264
|
-
const openOrderQueries = (0,
|
|
33381
|
+
const openOrderQueries = (0, import_react52.useMemo)(
|
|
33265
33382
|
() => [
|
|
33266
33383
|
pendingOpenOrdersQuery,
|
|
33267
33384
|
signingOpenOrdersQuery,
|
|
@@ -33287,7 +33404,7 @@ var UserProfilePage = ({
|
|
|
33287
33404
|
enabled: shouldUseHookData && isAuthenticated,
|
|
33288
33405
|
limit: 25
|
|
33289
33406
|
});
|
|
33290
|
-
const handleCancelOrder = (0,
|
|
33407
|
+
const handleCancelOrder = (0, import_react52.useCallback)(
|
|
33291
33408
|
(order) => __async(null, null, function* () {
|
|
33292
33409
|
if (onCancelOrder) {
|
|
33293
33410
|
onCancelOrder(order);
|
|
@@ -33320,7 +33437,7 @@ var UserProfilePage = ({
|
|
|
33320
33437
|
}),
|
|
33321
33438
|
[cancelOrderMutation, labels.notifications.order, onCancelOrder, toastContext]
|
|
33322
33439
|
);
|
|
33323
|
-
const handleClaimPosition = (0,
|
|
33440
|
+
const handleClaimPosition = (0, import_react52.useCallback)(
|
|
33324
33441
|
(position) => {
|
|
33325
33442
|
var _a2, _b2;
|
|
33326
33443
|
return startClaim({
|
|
@@ -33331,7 +33448,7 @@ var UserProfilePage = ({
|
|
|
33331
33448
|
},
|
|
33332
33449
|
[startClaim]
|
|
33333
33450
|
);
|
|
33334
|
-
const handleActivityRowClick = (0,
|
|
33451
|
+
const handleActivityRowClick = (0, import_react52.useCallback)(
|
|
33335
33452
|
(activity) => {
|
|
33336
33453
|
if (activity.kind === "redeem") {
|
|
33337
33454
|
setSelectedClaimActivity(activity);
|
|
@@ -33341,13 +33458,13 @@ var UserProfilePage = ({
|
|
|
33341
33458
|
},
|
|
33342
33459
|
[onActivityClick]
|
|
33343
33460
|
);
|
|
33344
|
-
const handleClaimTransactionSelect = (0,
|
|
33461
|
+
const handleClaimTransactionSelect = (0, import_react52.useCallback)((transaction) => {
|
|
33345
33462
|
const href = buildAggTxExplorerHref(transaction.chainId, transaction.txHash);
|
|
33346
33463
|
setSelectedClaimActivity(null);
|
|
33347
33464
|
if (!href || typeof window === "undefined") return;
|
|
33348
33465
|
window.open(href, "_blank", "noopener,noreferrer");
|
|
33349
33466
|
}, []);
|
|
33350
|
-
(0,
|
|
33467
|
+
(0, import_react52.useEffect)(() => {
|
|
33351
33468
|
if (!shouldUseHookData || !isAuthenticated) {
|
|
33352
33469
|
setProfileUser(void 0);
|
|
33353
33470
|
return;
|
|
@@ -33366,7 +33483,7 @@ var UserProfilePage = ({
|
|
|
33366
33483
|
isActive = false;
|
|
33367
33484
|
};
|
|
33368
33485
|
}, [client, currentUser, isAuthenticated, shouldUseHookData]);
|
|
33369
|
-
const resolvedUser = (0,
|
|
33486
|
+
const resolvedUser = (0, import_react52.useMemo)(() => {
|
|
33370
33487
|
var _a2, _b2, _c2, _d, _e, _f;
|
|
33371
33488
|
if (user) return user;
|
|
33372
33489
|
const fullUser = profileUser != null ? profileUser : currentUser;
|
|
@@ -33400,7 +33517,7 @@ var UserProfilePage = ({
|
|
|
33400
33517
|
socialHandle: normalizedTwitterHandle != null ? normalizedTwitterHandle : void 0
|
|
33401
33518
|
};
|
|
33402
33519
|
}, [connectedVenues, currentUser, profileUser, user]);
|
|
33403
|
-
const _resolvedVenueBalances = (0,
|
|
33520
|
+
const _resolvedVenueBalances = (0, import_react52.useMemo)(() => {
|
|
33404
33521
|
if (_venueBalances) return _venueBalances;
|
|
33405
33522
|
return balanceState.balanceBreakdown.map((item) => ({
|
|
33406
33523
|
chain: item.label,
|
|
@@ -33408,24 +33525,24 @@ var UserProfilePage = ({
|
|
|
33408
33525
|
balanceLabel: formatUsd2(item.balance)
|
|
33409
33526
|
}));
|
|
33410
33527
|
}, [_venueBalances, balanceState.balanceBreakdown]);
|
|
33411
|
-
const positionsValueLabel = (0,
|
|
33528
|
+
const positionsValueLabel = (0, import_react52.useMemo)(() => {
|
|
33412
33529
|
var _a2;
|
|
33413
33530
|
if (balance == null ? void 0 : balance.totalLabel) return balance.totalLabel;
|
|
33414
33531
|
return formatUsd2((_a2 = balanceState.positionsBalanceTotal) != null ? _a2 : 0);
|
|
33415
33532
|
}, [balance == null ? void 0 : balance.totalLabel, balanceState.positionsBalanceTotal]);
|
|
33416
|
-
const availableBalanceLabel = (0,
|
|
33533
|
+
const availableBalanceLabel = (0, import_react52.useMemo)(() => {
|
|
33417
33534
|
var _a2, _b2;
|
|
33418
33535
|
return formatUsd2((_b2 = (_a2 = balanceState.availableBalance) != null ? _a2 : balanceState.totalBalance) != null ? _b2 : 0);
|
|
33419
33536
|
}, [balanceState.availableBalance, balanceState.totalBalance]);
|
|
33420
33537
|
const paperSummary = (_a = balanceState.managedBalances) == null ? void 0 : _a.paper;
|
|
33421
|
-
const paperBuyingPowerLabel = (0,
|
|
33538
|
+
const paperBuyingPowerLabel = (0, import_react52.useMemo)(
|
|
33422
33539
|
() => {
|
|
33423
33540
|
var _a2;
|
|
33424
33541
|
return formatUsd2((_a2 = paperSummary == null ? void 0 : paperSummary.cashBalance) != null ? _a2 : 0);
|
|
33425
33542
|
},
|
|
33426
33543
|
[paperSummary == null ? void 0 : paperSummary.cashBalance]
|
|
33427
33544
|
);
|
|
33428
|
-
const paperEarningsLabel = (0,
|
|
33545
|
+
const paperEarningsLabel = (0, import_react52.useMemo)(
|
|
33429
33546
|
() => {
|
|
33430
33547
|
var _a2;
|
|
33431
33548
|
return formatUsd2((_a2 = paperSummary == null ? void 0 : paperSummary.earnings) != null ? _a2 : 0);
|
|
@@ -33440,7 +33557,7 @@ var UserProfilePage = ({
|
|
|
33440
33557
|
}) === "available";
|
|
33441
33558
|
const isPositionsValueLoading = !(balance == null ? void 0 : balance.totalLabel) && balanceState.isLoading;
|
|
33442
33559
|
const isAvailableBalanceLoading = balanceState.isLoading;
|
|
33443
|
-
const resolvedActivities = (0,
|
|
33560
|
+
const resolvedActivities = (0, import_react52.useMemo)(() => {
|
|
33444
33561
|
if (activities) return activities.filter(isVisibleUserProfileActivity);
|
|
33445
33562
|
const formatTime = isHydrated ? toRelativeTimeLabel : toAbsoluteTimeLabel;
|
|
33446
33563
|
return activityQuery.activities.filter(isVisibleActivityItem).map((item, index) => {
|
|
@@ -33591,8 +33708,7 @@ var UserProfilePage = ({
|
|
|
33591
33708
|
};
|
|
33592
33709
|
});
|
|
33593
33710
|
}, [activities, activityQuery.activities, isHydrated, labels, ordersQuery.orders]);
|
|
33594
|
-
const
|
|
33595
|
-
if (openOrders) return openOrders.filter(isUserProfileLimitOrder);
|
|
33711
|
+
const openOrderRows = (0, import_react52.useMemo)(() => {
|
|
33596
33712
|
const orderRowsById = /* @__PURE__ */ new Map();
|
|
33597
33713
|
for (const query of openOrderQueries) {
|
|
33598
33714
|
for (const order of query.orders) {
|
|
@@ -33603,7 +33719,47 @@ var UserProfilePage = ({
|
|
|
33603
33719
|
(order) => isOpenOrderStatus(order.status) && isExecutionLimitOrder(order)
|
|
33604
33720
|
).sort(
|
|
33605
33721
|
(a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
|
|
33606
|
-
)
|
|
33722
|
+
);
|
|
33723
|
+
}, [openOrderQueries]);
|
|
33724
|
+
const openOrderVenueMarketIds = (0, import_react52.useMemo)(
|
|
33725
|
+
() => openOrderRows.map((order) => {
|
|
33726
|
+
var _a2;
|
|
33727
|
+
return (_a2 = order.venueMarket) == null ? void 0 : _a2.id;
|
|
33728
|
+
}).filter((venueMarketId) => Boolean(venueMarketId)),
|
|
33729
|
+
[openOrderRows]
|
|
33730
|
+
);
|
|
33731
|
+
const openOrderMidpointsQuery = (0, import_hooks83.useVenueMarketMidpoints)({
|
|
33732
|
+
venueMarketIds: openOrderVenueMarketIds,
|
|
33733
|
+
enabled: !openOrders && openOrderVenueMarketIds.length > 0
|
|
33734
|
+
});
|
|
33735
|
+
const openOrderMidpointRows = openOrderMidpointsQuery.midpointRows;
|
|
33736
|
+
const openOrderCurrentPriceLabels = (0, import_react52.useMemo)(() => {
|
|
33737
|
+
var _a2, _b2, _c2, _d;
|
|
33738
|
+
const midpointRowsByVenueMarketId = new Map(
|
|
33739
|
+
openOrderMidpointRows.map((row) => [row.venueMarketId, row])
|
|
33740
|
+
);
|
|
33741
|
+
const labelsByOrderId = /* @__PURE__ */ new Map();
|
|
33742
|
+
for (const order of openOrderRows) {
|
|
33743
|
+
const venueMarketId = (_a2 = order.venueMarket) == null ? void 0 : _a2.id;
|
|
33744
|
+
if (!venueMarketId) continue;
|
|
33745
|
+
const midpointRow = midpointRowsByVenueMarketId.get(venueMarketId);
|
|
33746
|
+
if (!midpointRow) continue;
|
|
33747
|
+
const orderOutcomeLabels = [
|
|
33748
|
+
normalizeOutcomeMatchLabel((_b2 = order.venueMarketOutcome) == null ? void 0 : _b2.label),
|
|
33749
|
+
normalizeOutcomeMatchLabel((_c2 = order.venueMarketOutcome) == null ? void 0 : _c2.title)
|
|
33750
|
+
].filter(Boolean);
|
|
33751
|
+
if (orderOutcomeLabels.length === 0) continue;
|
|
33752
|
+
const outcomeMidpoint = (_d = midpointRow.outcomes) == null ? void 0 : _d.find(
|
|
33753
|
+
(outcome) => orderOutcomeLabels.includes(normalizeOutcomeMatchLabel(outcome.label))
|
|
33754
|
+
);
|
|
33755
|
+
if ((outcomeMidpoint == null ? void 0 : outcomeMidpoint.midpoint) == null) continue;
|
|
33756
|
+
labelsByOrderId.set(order.id, formatPriceCentsLabel(outcomeMidpoint.midpoint));
|
|
33757
|
+
}
|
|
33758
|
+
return labelsByOrderId;
|
|
33759
|
+
}, [openOrderMidpointRows, openOrderRows]);
|
|
33760
|
+
const resolvedOpenOrders = (0, import_react52.useMemo)(() => {
|
|
33761
|
+
if (openOrders) return openOrders.filter(isUserProfileLimitOrder);
|
|
33762
|
+
return openOrderRows.map((order) => {
|
|
33607
33763
|
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
33608
33764
|
const isLimitOrder = isExecutionLimitOrder(order);
|
|
33609
33765
|
const filledRaw = isLimitOrder ? order.filledSizeRaw : order.filledAmountRaw;
|
|
@@ -33616,15 +33772,17 @@ var UserProfilePage = ({
|
|
|
33616
33772
|
goodTilCanceledLabel: labels.userProfile.openOrders.goodTilCanceled,
|
|
33617
33773
|
expiredLabel: labels.userProfile.openOrders.expired
|
|
33618
33774
|
});
|
|
33619
|
-
|
|
33775
|
+
const currentPriceLabel = openOrderCurrentPriceLabels.get(order.id);
|
|
33776
|
+
return __spreadProps(__spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadProps(__spreadValues({
|
|
33620
33777
|
id: order.id,
|
|
33621
33778
|
eventId: (_c2 = (_b2 = order.venueMarket) == null ? void 0 : _b2.venueEventId) != null ? _c2 : void 0,
|
|
33622
33779
|
marketId: (_e = (_d = order.venueMarket) == null ? void 0 : _d.id) != null ? _e : void 0,
|
|
33623
33780
|
thumbnailSrc: (_g = (_f = order.venueMarket) == null ? void 0 : _f.image) != null ? _g : fallbackThumbnailSrc,
|
|
33624
33781
|
title: ((_h = order.venueMarket) == null ? void 0 : _h.question) || "Market",
|
|
33625
|
-
outcomeLabel: ((_i = order.venueMarketOutcome) == null ? void 0 : _i.title) || ((_j = order.venueMarketOutcome) == null ? void 0 : _j.label) || "Outcome"
|
|
33782
|
+
outcomeLabel: ((_i = order.venueMarketOutcome) == null ? void 0 : _i.title) || ((_j = order.venueMarketOutcome) == null ? void 0 : _j.label) || "Outcome"
|
|
33783
|
+
}, order.side === "sell" || order.side === "buy" ? { side: order.side } : {}), {
|
|
33626
33784
|
venue: order.venue
|
|
33627
|
-
}, limitPriceLabel ? { limitPriceLabel } : {}), {
|
|
33785
|
+
}), limitPriceLabel ? { limitPriceLabel } : {}), currentPriceLabel ? { currentPriceLabel } : {}), {
|
|
33628
33786
|
filledLabel: `${formatScaledNumberTwoDecimals(filledRaw != null ? filledRaw : "0")}/${formatScaledNumberTwoDecimals(totalRaw)}`,
|
|
33629
33787
|
valueLabel: formatFilledUsdTwoDecimals(totalCostRaw)
|
|
33630
33788
|
}), expirationLabel ? { expirationLabel } : {}), {
|
|
@@ -33633,31 +33791,31 @@ var UserProfilePage = ({
|
|
|
33633
33791
|
dagRunId: (_k = order.dagRunId) != null ? _k : null
|
|
33634
33792
|
});
|
|
33635
33793
|
});
|
|
33636
|
-
}, [labels,
|
|
33637
|
-
const isOpenOrdersQueryLoading = (0,
|
|
33794
|
+
}, [labels, openOrderCurrentPriceLabels, openOrderRows, openOrders]);
|
|
33795
|
+
const isOpenOrdersQueryLoading = (0, import_react52.useMemo)(
|
|
33638
33796
|
() => openOrderQueries.some((query) => query.isLoading),
|
|
33639
33797
|
[openOrderQueries]
|
|
33640
33798
|
);
|
|
33641
|
-
const hasOpenOrdersQueryError = (0,
|
|
33799
|
+
const hasOpenOrdersQueryError = (0, import_react52.useMemo)(
|
|
33642
33800
|
() => openOrderQueries.some((query) => query.error),
|
|
33643
33801
|
[openOrderQueries]
|
|
33644
33802
|
);
|
|
33645
|
-
const hasMoreOpenOrdersQuery = (0,
|
|
33803
|
+
const hasMoreOpenOrdersQuery = (0, import_react52.useMemo)(
|
|
33646
33804
|
() => openOrderQueries.some((query) => query.hasNextPage),
|
|
33647
33805
|
[openOrderQueries]
|
|
33648
33806
|
);
|
|
33649
|
-
const isLoadingMoreOpenOrdersQuery = (0,
|
|
33807
|
+
const isLoadingMoreOpenOrdersQuery = (0, import_react52.useMemo)(
|
|
33650
33808
|
() => openOrderQueries.some((query) => query.isFetchingNextPage),
|
|
33651
33809
|
[openOrderQueries]
|
|
33652
33810
|
);
|
|
33653
|
-
const handleLoadMoreOpenOrders = (0,
|
|
33811
|
+
const handleLoadMoreOpenOrders = (0, import_react52.useCallback)(() => {
|
|
33654
33812
|
for (const query of openOrderQueries) {
|
|
33655
33813
|
if (query.hasNextPage) {
|
|
33656
33814
|
void query.fetchNextPage();
|
|
33657
33815
|
}
|
|
33658
33816
|
}
|
|
33659
33817
|
}, [openOrderQueries]);
|
|
33660
|
-
const adaptPositionGroups = (0,
|
|
33818
|
+
const adaptPositionGroups = (0, import_react52.useCallback)(
|
|
33661
33819
|
(groups) => {
|
|
33662
33820
|
return groups.flatMap((group) => {
|
|
33663
33821
|
var _a2, _b2, _c2, _d;
|
|
@@ -33729,11 +33887,11 @@ var UserProfilePage = ({
|
|
|
33729
33887
|
},
|
|
33730
33888
|
[]
|
|
33731
33889
|
);
|
|
33732
|
-
const resolvedActivePositions = (0,
|
|
33890
|
+
const resolvedActivePositions = (0, import_react52.useMemo)(() => {
|
|
33733
33891
|
const source = activePositions != null ? activePositions : adaptPositionGroups(activePositionsQuery.positions);
|
|
33734
33892
|
return source.filter(shouldIncludeByShares);
|
|
33735
33893
|
}, [activePositions, activePositionsQuery.positions, adaptPositionGroups]);
|
|
33736
|
-
const resolvedClosedPositions = (0,
|
|
33894
|
+
const resolvedClosedPositions = (0, import_react52.useMemo)(() => {
|
|
33737
33895
|
const source = closedPositions != null ? closedPositions : adaptPositionGroups(closedPositionsQuery.positions);
|
|
33738
33896
|
return source.filter(shouldIncludeByShares);
|
|
33739
33897
|
}, [closedPositions, closedPositionsQuery.positions, adaptPositionGroups]);
|
|
@@ -33798,32 +33956,13 @@ var UserProfilePage = ({
|
|
|
33798
33956
|
classNames == null ? void 0 : classNames.rightColumn
|
|
33799
33957
|
),
|
|
33800
33958
|
children: [
|
|
33801
|
-
/* @__PURE__ */ (0, import_jsx_runtime188.
|
|
33802
|
-
|
|
33959
|
+
/* @__PURE__ */ (0, import_jsx_runtime188.jsx)(
|
|
33960
|
+
PositionsValueCard,
|
|
33803
33961
|
{
|
|
33804
|
-
|
|
33805
|
-
|
|
33806
|
-
|
|
33807
|
-
|
|
33808
|
-
children: [
|
|
33809
|
-
/* @__PURE__ */ (0, import_jsx_runtime188.jsx)(
|
|
33810
|
-
PositionsValueCard,
|
|
33811
|
-
{
|
|
33812
|
-
label: labels.userProfile.balance.positionsValue,
|
|
33813
|
-
valueLabel: positionsValueLabel,
|
|
33814
|
-
isLoading: isPositionsValueLoading,
|
|
33815
|
-
compact: isPaperMode
|
|
33816
|
-
}
|
|
33817
|
-
),
|
|
33818
|
-
isKalshiAvailable && !isPaperMode ? /* @__PURE__ */ (0, import_jsx_runtime188.jsx)(
|
|
33819
|
-
PositionsValueCard,
|
|
33820
|
-
{
|
|
33821
|
-
label: labels.userProfile.balance.kalshiBalance,
|
|
33822
|
-
valueLabel: formatUsd2((_b = balanceState.kalshiBalance) != null ? _b : 0),
|
|
33823
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime188.jsx)(VenueLogo, { venue: import_sdk29.Venue.kalshi, size: "small", className: "size-4" })
|
|
33824
|
-
}
|
|
33825
|
-
) : null
|
|
33826
|
-
]
|
|
33962
|
+
label: labels.userProfile.balance.positionsValue,
|
|
33963
|
+
valueLabel: positionsValueLabel,
|
|
33964
|
+
isLoading: isPositionsValueLoading,
|
|
33965
|
+
compact: isPaperMode
|
|
33827
33966
|
}
|
|
33828
33967
|
),
|
|
33829
33968
|
isPaperMode ? (
|
|
@@ -33872,13 +34011,14 @@ var UserProfilePage = ({
|
|
|
33872
34011
|
{
|
|
33873
34012
|
valueLabel: availableBalanceLabel,
|
|
33874
34013
|
isLoading: isAvailableBalanceLoading,
|
|
33875
|
-
chains: ((
|
|
34014
|
+
chains: ((_b = balanceChainsOverride != null ? balanceChainsOverride : balanceState.availableBalanceBreakdown) != null ? _b : balanceState.balanceBreakdown).map((b) => ({
|
|
33876
34015
|
key: b.key,
|
|
33877
34016
|
label: b.label,
|
|
33878
34017
|
balance: b.balance,
|
|
33879
34018
|
accountCount: b.accountCount,
|
|
33880
34019
|
venues: b.venues
|
|
33881
34020
|
})),
|
|
34021
|
+
kalshiValueLabel: isKalshiAvailable ? formatUsd2((_c = balanceState.kalshiBalance) != null ? _c : 0) : void 0,
|
|
33882
34022
|
manageButtonRef: manageBalancesButtonRef,
|
|
33883
34023
|
onManage: () => handleManageBalancesOpenChange(true)
|
|
33884
34024
|
}
|