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