@agg-build/ui 2.7.3 → 2.8.0
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-MZBYIXYA.mjs → chunk-2QCNDFNC.mjs} +193 -103
- package/dist/{chunk-EDQ64EKO.mjs → chunk-AKLGQ6AB.mjs} +254 -53
- package/dist/{chunk-FMYYPNZZ.mjs → chunk-KO6VTRV6.mjs} +101 -27
- package/dist/{chunk-AHQA3B7D.mjs → chunk-KX3TQ7WC.mjs} +1 -1
- package/dist/{chunk-7DM45TMO.mjs → chunk-MKU5Q6PN.mjs} +21 -13
- package/dist/{chunk-O27JUYCF.mjs → chunk-R5S2QOYL.mjs} +495 -289
- package/dist/{chunk-JQKJDSTW.mjs → chunk-VR5ZRDQT.mjs} +3 -2
- package/dist/events.js +168 -91
- package/dist/events.mjs +3 -3
- package/dist/index.js +1315 -746
- package/dist/index.mjs +7 -7
- package/dist/modals.js +941 -418
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +978 -609
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +94 -26
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +1403 -902
- package/dist/trading.mjs +4 -4
- package/dist/types/events/orderbook/orderbook.utils.d.mts +1 -1
- package/dist/types/events/orderbook/orderbook.utils.d.ts +1 -1
- package/dist/types/pages/user-profile/components/open-order-row.d.mts +1 -0
- package/dist/types/pages/user-profile/components/open-order-row.d.ts +1 -0
- package/dist/types/pages/user-profile/position-view-model.d.mts +15 -4
- package/dist/types/pages/user-profile/position-view-model.d.ts +15 -4
- package/dist/types/primitives/select/index.d.mts +1 -1
- package/dist/types/primitives/select/index.d.ts +1 -1
- package/dist/types/primitives/select/select.types.d.mts +8 -0
- package/dist/types/primitives/select/select.types.d.ts +8 -0
- package/dist/types/profile/profile-modal.constants.d.mts +2 -1
- package/dist/types/profile/profile-modal.constants.d.ts +2 -1
- package/dist/types/profile/tabs/balance-management-tab.d.mts +3 -0
- package/dist/types/profile/tabs/balance-management-tab.d.ts +3 -0
- package/dist/types/trading/place-order/index.place-order.constants.d.mts +2 -1
- package/dist/types/trading/place-order/index.place-order.constants.d.ts +2 -1
- package/dist/types/trading/place-order/index.place-order.types.d.mts +6 -0
- package/dist/types/trading/place-order/index.place-order.types.d.ts +6 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +10 -2
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +10 -2
- package/package.json +3 -3
package/dist/pages.js
CHANGED
|
@@ -98,7 +98,7 @@ __export(pages_exports, {
|
|
|
98
98
|
module.exports = __toCommonJS(pages_exports);
|
|
99
99
|
|
|
100
100
|
// src/pages/home/index.tsx
|
|
101
|
-
var
|
|
101
|
+
var import_hooks69 = require("@agg-build/hooks");
|
|
102
102
|
var import_sdk23 = require("@agg-build/sdk");
|
|
103
103
|
var import_react46 = require("react");
|
|
104
104
|
|
|
@@ -7960,7 +7960,11 @@ var Select = ({
|
|
|
7960
7960
|
triggerClassName,
|
|
7961
7961
|
contentClassName,
|
|
7962
7962
|
itemClassName,
|
|
7963
|
-
disabled = SELECT_DEFAULT_IS_DISABLED
|
|
7963
|
+
disabled = SELECT_DEFAULT_IS_DISABLED,
|
|
7964
|
+
variant = "default",
|
|
7965
|
+
openOnHover = false,
|
|
7966
|
+
contentAlign = "start",
|
|
7967
|
+
contentSideOffset = 8
|
|
7964
7968
|
}) => {
|
|
7965
7969
|
var _a;
|
|
7966
7970
|
const labels = (0, import_hooks31.useLabels)();
|
|
@@ -7971,17 +7975,30 @@ var Select = ({
|
|
|
7971
7975
|
const isDisabled = resolveIsSelectDisabled({ disabled, items });
|
|
7972
7976
|
const selectedItem = resolveSelectedItem(items, value);
|
|
7973
7977
|
const [isOpen, setIsOpen] = (0, import_react8.useState)(false);
|
|
7974
|
-
const [menuRect, setMenuRect] = (0, import_react8.useState)(
|
|
7975
|
-
null
|
|
7976
|
-
);
|
|
7978
|
+
const [menuRect, setMenuRect] = (0, import_react8.useState)(null);
|
|
7977
7979
|
const containerRef = (0, import_react8.useRef)(null);
|
|
7978
7980
|
const portalRef = (0, import_react8.useRef)(null);
|
|
7979
|
-
const
|
|
7981
|
+
const closeTimerRef = (0, import_react8.useRef)(null);
|
|
7982
|
+
const openedByHoverRef = (0, import_react8.useRef)(false);
|
|
7983
|
+
const handleClose = (0, import_react8.useCallback)(() => {
|
|
7984
|
+
setIsOpen(false);
|
|
7985
|
+
openedByHoverRef.current = false;
|
|
7986
|
+
}, []);
|
|
7980
7987
|
const updateMenuRect = (0, import_react8.useCallback)(() => {
|
|
7981
7988
|
const el = containerRef.current;
|
|
7982
7989
|
if (!el) return;
|
|
7983
7990
|
const r = el.getBoundingClientRect();
|
|
7984
|
-
setMenuRect({
|
|
7991
|
+
setMenuRect({
|
|
7992
|
+
top: r.bottom + contentSideOffset,
|
|
7993
|
+
left: r.left,
|
|
7994
|
+
right: r.right,
|
|
7995
|
+
width: r.width
|
|
7996
|
+
});
|
|
7997
|
+
}, [contentSideOffset]);
|
|
7998
|
+
(0, import_react8.useEffect)(() => {
|
|
7999
|
+
return () => {
|
|
8000
|
+
if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
|
|
8001
|
+
};
|
|
7985
8002
|
}, []);
|
|
7986
8003
|
(0, import_react8.useLayoutEffect)(() => {
|
|
7987
8004
|
if (!isOpen) {
|
|
@@ -8019,7 +8036,33 @@ var Select = ({
|
|
|
8019
8036
|
document.addEventListener("keydown", handleKeyDown);
|
|
8020
8037
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
8021
8038
|
}, [isOpen, handleClose]);
|
|
8022
|
-
const
|
|
8039
|
+
const handlePointerEnter = (event) => {
|
|
8040
|
+
if (!openOnHover || isDisabled || event.pointerType === "touch") return;
|
|
8041
|
+
if (closeTimerRef.current) {
|
|
8042
|
+
clearTimeout(closeTimerRef.current);
|
|
8043
|
+
closeTimerRef.current = null;
|
|
8044
|
+
}
|
|
8045
|
+
if (isOpen) return;
|
|
8046
|
+
openedByHoverRef.current = true;
|
|
8047
|
+
setIsOpen(true);
|
|
8048
|
+
};
|
|
8049
|
+
const handlePointerLeave = (event) => {
|
|
8050
|
+
if (!openOnHover || event.pointerType === "touch") return;
|
|
8051
|
+
if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
|
|
8052
|
+
closeTimerRef.current = setTimeout(() => {
|
|
8053
|
+
handleClose();
|
|
8054
|
+
closeTimerRef.current = null;
|
|
8055
|
+
}, 120);
|
|
8056
|
+
};
|
|
8057
|
+
const handleTriggerClick = () => {
|
|
8058
|
+
if (openedByHoverRef.current && isOpen) {
|
|
8059
|
+
openedByHoverRef.current = false;
|
|
8060
|
+
return;
|
|
8061
|
+
}
|
|
8062
|
+
setIsOpen((previousValue) => !previousValue);
|
|
8063
|
+
};
|
|
8064
|
+
const isInline = variant === "inline";
|
|
8065
|
+
const triggerRadiusClass = triggerClassName != null ? triggerClassName : isInline ? "rounded-agg-sm" : "rounded-agg-md";
|
|
8023
8066
|
const listbox = menuRect ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
8024
8067
|
"div",
|
|
8025
8068
|
{
|
|
@@ -8030,16 +8073,20 @@ var Select = ({
|
|
|
8030
8073
|
style: {
|
|
8031
8074
|
position: "fixed",
|
|
8032
8075
|
top: menuRect.top,
|
|
8033
|
-
left: menuRect.left,
|
|
8076
|
+
left: contentAlign === "start" ? menuRect.left : void 0,
|
|
8077
|
+
right: contentAlign === "end" ? window.innerWidth - menuRect.right : void 0,
|
|
8034
8078
|
width: menuRect.width,
|
|
8035
8079
|
zIndex: SELECT_DROPDOWN_Z
|
|
8036
8080
|
},
|
|
8037
8081
|
className: cn(
|
|
8038
8082
|
AGG_ROOT_CLASS_NAME,
|
|
8039
8083
|
rootClassName,
|
|
8040
|
-
"agg-select-content pointer-events-auto max-h-[min(20rem,calc(100vh-4rem))] overflow-y-auto
|
|
8084
|
+
"agg-select-content pointer-events-auto max-h-[min(20rem,calc(100vh-4rem))] overflow-y-auto border border-agg-separator bg-agg-secondary flex flex-col",
|
|
8085
|
+
isInline ? "min-w-[120px] gap-0 rounded-agg-lg py-1 shadow-[0_8px_16px_rgba(0,0,0,0.12)]" : "gap-1 rounded-[12px] p-2 shadow-[0_8px_16px_rgba(0,0,0,0.1)]",
|
|
8041
8086
|
contentClassName
|
|
8042
8087
|
),
|
|
8088
|
+
onPointerEnter: handlePointerEnter,
|
|
8089
|
+
onPointerLeave: handlePointerLeave,
|
|
8043
8090
|
children: items.map((item) => {
|
|
8044
8091
|
const isSelected = item.value === value;
|
|
8045
8092
|
const isHidden = item.hidden === true;
|
|
@@ -8053,9 +8100,10 @@ var Select = ({
|
|
|
8053
8100
|
disabled: item.disabled,
|
|
8054
8101
|
className: cn(
|
|
8055
8102
|
"agg-select-item",
|
|
8056
|
-
"relative flex w-full items-center
|
|
8103
|
+
"relative flex w-full items-center text-left text-agg-sm leading-agg-5 outline-none",
|
|
8104
|
+
isInline ? "gap-2 px-4 py-2" : "gap-3 rounded-[6px] py-3 pl-3 pr-5",
|
|
8057
8105
|
"hover:bg-agg-secondary-hover focus-visible:bg-agg-secondary-hover",
|
|
8058
|
-
isSelected ? "bg-agg-primary/10 font-agg-normal text-agg-primary" : "font-agg-normal text-agg-foreground",
|
|
8106
|
+
isSelected ? isInline ? "font-agg-bold text-agg-foreground" : "bg-agg-primary/10 font-agg-normal text-agg-primary" : "font-agg-normal text-agg-foreground",
|
|
8059
8107
|
item.disabled && "cursor-not-allowed opacity-60",
|
|
8060
8108
|
itemClassName
|
|
8061
8109
|
),
|
|
@@ -8067,6 +8115,13 @@ var Select = ({
|
|
|
8067
8115
|
handleClose();
|
|
8068
8116
|
},
|
|
8069
8117
|
children: [
|
|
8118
|
+
isInline && isSelected ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
8119
|
+
"span",
|
|
8120
|
+
{
|
|
8121
|
+
className: "agg-select-item-indicator absolute bottom-2 left-0 top-2 w-1 bg-agg-primary",
|
|
8122
|
+
"aria-hidden": true
|
|
8123
|
+
}
|
|
8124
|
+
) : null,
|
|
8070
8125
|
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
8071
8126
|
"span",
|
|
8072
8127
|
{
|
|
@@ -8096,7 +8151,11 @@ var Select = ({
|
|
|
8096
8151
|
"div",
|
|
8097
8152
|
{
|
|
8098
8153
|
ref: containerRef,
|
|
8099
|
-
className: cn(
|
|
8154
|
+
className: cn(
|
|
8155
|
+
"group/agg-select relative inline-flex",
|
|
8156
|
+
isInline ? "w-auto" : "w-full",
|
|
8157
|
+
className
|
|
8158
|
+
),
|
|
8100
8159
|
children: [
|
|
8101
8160
|
/* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(
|
|
8102
8161
|
"button",
|
|
@@ -8108,19 +8167,19 @@ var Select = ({
|
|
|
8108
8167
|
disabled: isDisabled,
|
|
8109
8168
|
className: cn(
|
|
8110
8169
|
"agg-select-trigger",
|
|
8111
|
-
"flex
|
|
8112
|
-
"
|
|
8170
|
+
"flex cursor-pointer items-center gap-2 font-agg-sans text-agg-foreground outline-none disabled:cursor-not-allowed disabled:opacity-60",
|
|
8171
|
+
isInline ? "h-auto w-auto bg-transparent px-2 py-1 pr-8 text-left text-agg-base leading-agg-6" : "h-10 w-full border border-agg-separator bg-agg-secondary px-3 py-[9px] pr-10 text-left text-agg-sm leading-agg-5",
|
|
8113
8172
|
triggerRadiusClass,
|
|
8114
|
-
getMotionClassName(
|
|
8173
|
+
!isInline && getMotionClassName(
|
|
8115
8174
|
enableAnimations,
|
|
8116
8175
|
"transition-[border-color,box-shadow] duration-200 ease-in-out"
|
|
8117
8176
|
),
|
|
8118
|
-
isOpen && "border-2 border-agg-primary px-[11px] py-2 ring-0",
|
|
8119
|
-
"hover:border-agg-primary"
|
|
8120
|
-
"focus:border-agg-primary focus:ring-0",
|
|
8121
|
-
"disabled:cursor-not-allowed disabled:opacity-60"
|
|
8177
|
+
!isInline && isOpen && "border-2 border-agg-primary px-[11px] py-2 ring-0",
|
|
8178
|
+
!isInline && "hover:border-agg-primary focus:border-agg-primary focus:ring-0"
|
|
8122
8179
|
),
|
|
8123
|
-
onClick:
|
|
8180
|
+
onClick: handleTriggerClick,
|
|
8181
|
+
onPointerEnter: handlePointerEnter,
|
|
8182
|
+
onPointerLeave: handlePointerLeave,
|
|
8124
8183
|
children: [
|
|
8125
8184
|
(selectedItem == null ? void 0 : selectedItem.icon) ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("span", { className: "h-4 w-4 shrink-0 [&_svg]:h-full [&_svg]:w-full", children: selectedItem.icon }) : (selectedItem == null ? void 0 : selectedItem.iconUrl) ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
8126
8185
|
RemoteImage,
|
|
@@ -8134,14 +8193,23 @@ var Select = ({
|
|
|
8134
8193
|
]
|
|
8135
8194
|
}
|
|
8136
8195
|
),
|
|
8137
|
-
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
8138
|
-
|
|
8196
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
8197
|
+
"span",
|
|
8139
8198
|
{
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8199
|
+
className: cn(
|
|
8200
|
+
"agg-select-chevron pointer-events-none absolute inset-y-0 inline-flex items-center justify-center",
|
|
8201
|
+
isInline ? "right-2 text-agg-foreground" : "right-3 text-agg-muted-foreground"
|
|
8202
|
+
),
|
|
8203
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
8204
|
+
Icon,
|
|
8205
|
+
{
|
|
8206
|
+
name: isOpen ? "chevron-up" : "chevron-down-thin",
|
|
8207
|
+
size: "small",
|
|
8208
|
+
color: "currentColor"
|
|
8209
|
+
}
|
|
8210
|
+
)
|
|
8143
8211
|
}
|
|
8144
|
-
)
|
|
8212
|
+
),
|
|
8145
8213
|
isOpen && typeof document !== "undefined" && listbox ? (0, import_react_dom.createPortal)(listbox, resolveSelectPortalContainer(containerRef.current)) : null
|
|
8146
8214
|
]
|
|
8147
8215
|
}
|
|
@@ -10857,7 +10925,7 @@ var EventList = ({
|
|
|
10857
10925
|
EventList.displayName = "EventList";
|
|
10858
10926
|
|
|
10859
10927
|
// src/pages/event-market/index.tsx
|
|
10860
|
-
var
|
|
10928
|
+
var import_hooks68 = require("@agg-build/hooks");
|
|
10861
10929
|
var import_react43 = require("react");
|
|
10862
10930
|
|
|
10863
10931
|
// src/events/item-details/index.tsx
|
|
@@ -11323,8 +11391,9 @@ var resolveMarketChartLiveState = ({
|
|
|
11323
11391
|
|
|
11324
11392
|
// src/events/orderbook/orderbook.utils.ts
|
|
11325
11393
|
var import_sdk15 = require("@agg-build/sdk");
|
|
11326
|
-
var formatProbabilityCents = (value) => {
|
|
11394
|
+
var formatProbabilityCents = (value, formatPrice) => {
|
|
11327
11395
|
if (value == null) return "-";
|
|
11396
|
+
if (formatPrice) return formatPrice(value);
|
|
11328
11397
|
const cents = (value * 100).toFixed(1).replace(/\.0$/, "");
|
|
11329
11398
|
return `${cents}\xA2`;
|
|
11330
11399
|
};
|
|
@@ -13565,7 +13634,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
13565
13634
|
}, [chartOutcomeLabel, (_d = tradingContext == null ? void 0 : tradingContext.selectedOutcome) == null ? void 0 : _d.label]);
|
|
13566
13635
|
const {
|
|
13567
13636
|
chart: { selectedChartTimeRange },
|
|
13568
|
-
formatting: { formatPercent },
|
|
13637
|
+
formatting: { formatPercent, formatPrice },
|
|
13569
13638
|
general: { theme }
|
|
13570
13639
|
} = (0, import_hooks46.useSdkUiConfig)();
|
|
13571
13640
|
const isDarkTheme = theme === "dark";
|
|
@@ -13840,8 +13909,8 @@ var EventListItemDetailsGraphSection = ({
|
|
|
13840
13909
|
});
|
|
13841
13910
|
return {
|
|
13842
13911
|
value: outcome.id,
|
|
13843
|
-
label: `${(_d3 = outcome.title) != null ? _d3 : outcome.label} ${formatProbabilityCents(price)}`,
|
|
13844
|
-
ariaLabel: `${(_e2 = outcome.title) != null ? _e2 : outcome.label} ${formatProbabilityCents(price)}`
|
|
13912
|
+
label: `${(_d3 = outcome.title) != null ? _d3 : outcome.label} ${formatProbabilityCents(price, formatPrice)}`,
|
|
13913
|
+
ariaLabel: `${(_e2 = outcome.title) != null ? _e2 : outcome.label} ${formatProbabilityCents(price, formatPrice)}`
|
|
13845
13914
|
};
|
|
13846
13915
|
})
|
|
13847
13916
|
}
|
|
@@ -14263,7 +14332,7 @@ var EventListItemDetails = (props) => {
|
|
|
14263
14332
|
EventListItemDetails.displayName = "EventListItemDetails";
|
|
14264
14333
|
|
|
14265
14334
|
// src/events/market-details/index.tsx
|
|
14266
|
-
var
|
|
14335
|
+
var import_hooks50 = require("@agg-build/hooks");
|
|
14267
14336
|
var import_react27 = require("react");
|
|
14268
14337
|
|
|
14269
14338
|
// src/events/orderbook/index.tsx
|
|
@@ -14511,6 +14580,7 @@ var OrderbookRow = ({
|
|
|
14511
14580
|
entry,
|
|
14512
14581
|
formatNumber,
|
|
14513
14582
|
formatCurrency: formatCurrency2,
|
|
14583
|
+
formatPrice,
|
|
14514
14584
|
enableAnimations,
|
|
14515
14585
|
showBadge,
|
|
14516
14586
|
badgeLabel
|
|
@@ -14579,7 +14649,7 @@ var OrderbookRow = ({
|
|
|
14579
14649
|
"w-9 min-w-9 md:min-w-10 md:w-10 text-agg-sm font-agg-bold leading-agg-5",
|
|
14580
14650
|
priceClassName
|
|
14581
14651
|
),
|
|
14582
|
-
children: formatProbabilityCents(entry.row.price)
|
|
14652
|
+
children: formatProbabilityCents(entry.row.price, formatPrice)
|
|
14583
14653
|
}
|
|
14584
14654
|
),
|
|
14585
14655
|
/* @__PURE__ */ (0, import_jsx_runtime142.jsx)(OrderbookVenueLogos, { venues })
|
|
@@ -14601,7 +14671,10 @@ var Orderbook = ({
|
|
|
14601
14671
|
className
|
|
14602
14672
|
}) => {
|
|
14603
14673
|
var _a, _b, _c, _d, _e;
|
|
14604
|
-
const {
|
|
14674
|
+
const {
|
|
14675
|
+
enableWebsocketsLogs,
|
|
14676
|
+
formatting: { formatPrice }
|
|
14677
|
+
} = (0, import_hooks47.useAggUiConfig)();
|
|
14605
14678
|
const labels = __spreadValues(__spreadValues({}, orderbookDefaultLabels), labelsProp);
|
|
14606
14679
|
const scrollContainerRef = (0, import_react25.useRef)(null);
|
|
14607
14680
|
const spreadRowRef = (0, import_react25.useRef)(null);
|
|
@@ -14666,6 +14739,7 @@ var Orderbook = ({
|
|
|
14666
14739
|
entry,
|
|
14667
14740
|
formatNumber,
|
|
14668
14741
|
formatCurrency: formatCurrency2,
|
|
14742
|
+
formatPrice,
|
|
14669
14743
|
enableAnimations,
|
|
14670
14744
|
showBadge: index === askEntries.length - 1,
|
|
14671
14745
|
badgeLabel: labels.asks
|
|
@@ -14678,7 +14752,7 @@ var Orderbook = ({
|
|
|
14678
14752
|
ref: spreadRowRef,
|
|
14679
14753
|
className: "agg-orderbook-spread flex items-center border-y border-agg-separator h-9 px-5 py-2 gap-3 md:gap-10",
|
|
14680
14754
|
role: "separator",
|
|
14681
|
-
"aria-label": `${labels.midPrice}: ${formatProbabilityCents((_b = spreadEntry == null ? void 0 : spreadEntry.midPrice) != null ? _b : null)}, ${labels.spread}: ${formatProbabilityCents((_c = spreadEntry == null ? void 0 : spreadEntry.spread) != null ? _c : null)}`,
|
|
14755
|
+
"aria-label": `${labels.midPrice}: ${formatProbabilityCents((_b = spreadEntry == null ? void 0 : spreadEntry.midPrice) != null ? _b : null, formatPrice)}, ${labels.spread}: ${formatProbabilityCents((_c = spreadEntry == null ? void 0 : spreadEntry.spread) != null ? _c : null)}`,
|
|
14682
14756
|
children: [
|
|
14683
14757
|
/* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(
|
|
14684
14758
|
Typography,
|
|
@@ -14688,7 +14762,7 @@ var Orderbook = ({
|
|
|
14688
14762
|
children: [
|
|
14689
14763
|
"Last: ",
|
|
14690
14764
|
labels.lastOutcome ? `${labels.lastOutcome} ` : "",
|
|
14691
|
-
formatProbabilityCents((_d = spreadEntry == null ? void 0 : spreadEntry.midPrice) != null ? _d : null)
|
|
14765
|
+
formatProbabilityCents((_d = spreadEntry == null ? void 0 : spreadEntry.midPrice) != null ? _d : null, formatPrice)
|
|
14692
14766
|
]
|
|
14693
14767
|
}
|
|
14694
14768
|
),
|
|
@@ -14715,6 +14789,7 @@ var Orderbook = ({
|
|
|
14715
14789
|
entry,
|
|
14716
14790
|
formatNumber,
|
|
14717
14791
|
formatCurrency: formatCurrency2,
|
|
14792
|
+
formatPrice,
|
|
14718
14793
|
enableAnimations,
|
|
14719
14794
|
showBadge: index === 0,
|
|
14720
14795
|
badgeLabel: labels.bids
|
|
@@ -14910,6 +14985,7 @@ var resolveOrderEligibilityMessage = (labels, reason) => {
|
|
|
14910
14985
|
};
|
|
14911
14986
|
|
|
14912
14987
|
// src/events/market-details/market-details-outcome-button.tsx
|
|
14988
|
+
var import_hooks48 = require("@agg-build/hooks");
|
|
14913
14989
|
var import_jsx_runtime143 = require("react/jsx-runtime");
|
|
14914
14990
|
var marketDetailsOutcomeButtonToneClasses = {
|
|
14915
14991
|
positive: {
|
|
@@ -14960,6 +15036,7 @@ var OutcomePriceContent = ({
|
|
|
14960
15036
|
value,
|
|
14961
15037
|
textClassName
|
|
14962
15038
|
}) => {
|
|
15039
|
+
const { formatPrice } = (0, import_hooks48.useAggUiConfig)().formatting;
|
|
14963
15040
|
if (isLoading) {
|
|
14964
15041
|
return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
|
|
14965
15042
|
"span",
|
|
@@ -14978,7 +15055,7 @@ var OutcomePriceContent = ({
|
|
|
14978
15055
|
as: "span",
|
|
14979
15056
|
variant: isSelected ? "body-strong" : "body",
|
|
14980
15057
|
className: cn("shrink-0 whitespace-nowrap", textClassName),
|
|
14981
|
-
children: formatProbabilityCents(value)
|
|
15058
|
+
children: formatProbabilityCents(value, formatPrice)
|
|
14982
15059
|
}
|
|
14983
15060
|
);
|
|
14984
15061
|
};
|
|
@@ -15072,7 +15149,7 @@ var MarketDetailsOutcomeButton = ({
|
|
|
15072
15149
|
MarketDetailsOutcomeButton.displayName = "MarketDetailsOutcomeButton";
|
|
15073
15150
|
|
|
15074
15151
|
// src/events/market-details/market-details-graph-panel.tsx
|
|
15075
|
-
var
|
|
15152
|
+
var import_hooks49 = require("@agg-build/hooks");
|
|
15076
15153
|
var import_react26 = require("react");
|
|
15077
15154
|
var import_jsx_runtime144 = require("react/jsx-runtime");
|
|
15078
15155
|
var MarketDetailsGraphPanel = ({
|
|
@@ -15089,13 +15166,13 @@ var MarketDetailsGraphPanel = ({
|
|
|
15089
15166
|
classNames
|
|
15090
15167
|
}) => {
|
|
15091
15168
|
var _a, _b, _c;
|
|
15092
|
-
const config = (0,
|
|
15169
|
+
const config = (0, import_hooks49.useSdkUiConfig)();
|
|
15093
15170
|
const {
|
|
15094
|
-
formatting: { formatPercent, formatCompactCurrency },
|
|
15171
|
+
formatting: { formatPercent, formatCompactCurrency, formatPrice },
|
|
15095
15172
|
general: { theme }
|
|
15096
15173
|
} = config;
|
|
15097
15174
|
const isDarkTheme = theme === "dark";
|
|
15098
|
-
const labels = (0,
|
|
15175
|
+
const labels = (0, import_hooks49.useLabels)();
|
|
15099
15176
|
const selectedTimeRange = config.chart.selectedChartTimeRange;
|
|
15100
15177
|
const setSelectedTimeRange = config.chart.setSelectedChartTimeRange;
|
|
15101
15178
|
const [chartRangeOverride, setChartRangeOverride] = (0, import_react26.useState)(null);
|
|
@@ -15115,7 +15192,7 @@ var MarketDetailsGraphPanel = ({
|
|
|
15115
15192
|
livePrices
|
|
15116
15193
|
});
|
|
15117
15194
|
}, [livePrices, venueMarkets, resolvedChartOutcomeLabel, chartSelectedOutcomeId]);
|
|
15118
|
-
const rollingWindow = (0,
|
|
15195
|
+
const rollingWindow = (0, import_hooks49.useRollingChartWindow)({ range: effectiveChartTimeRange });
|
|
15119
15196
|
const chartPrimaryOutcomeId = (_b = (_a = chartOutcomesByVenue[0]) == null ? void 0 : _a.outcome.id) != null ? _b : null;
|
|
15120
15197
|
const chartVenueOutcomeIds = (0, import_react26.useMemo)(() => {
|
|
15121
15198
|
return chartOutcomesByVenue.map((item) => item.outcome.id);
|
|
@@ -15125,7 +15202,7 @@ var MarketDetailsGraphPanel = ({
|
|
|
15125
15202
|
isLoading: isMarketChartLoading,
|
|
15126
15203
|
error: marketChartError,
|
|
15127
15204
|
refetch: refetchMarketChart
|
|
15128
|
-
} = (0,
|
|
15205
|
+
} = (0, import_hooks49.useMarketChart)({
|
|
15129
15206
|
marketId: chartPrimaryOutcomeId,
|
|
15130
15207
|
venueMarketIds: chartVenueOutcomeIds,
|
|
15131
15208
|
interval: rollingWindow.interval,
|
|
@@ -15305,8 +15382,8 @@ var MarketDetailsGraphPanel = ({
|
|
|
15305
15382
|
const price = outcome.probability;
|
|
15306
15383
|
return {
|
|
15307
15384
|
value: outcome.id,
|
|
15308
|
-
label: `${(_a3 = outcome == null ? void 0 : outcome.title) != null ? _a3 : outcome.label} ${formatProbabilityCents(price)}`,
|
|
15309
|
-
ariaLabel: `${(_b3 = outcome == null ? void 0 : outcome.title) != null ? _b3 : outcome.label} ${formatProbabilityCents(price)}`
|
|
15385
|
+
label: `${(_a3 = outcome == null ? void 0 : outcome.title) != null ? _a3 : outcome.label} ${formatProbabilityCents(price, formatPrice)}`,
|
|
15386
|
+
ariaLabel: `${(_b3 = outcome == null ? void 0 : outcome.title) != null ? _b3 : outcome.label} ${formatProbabilityCents(price, formatPrice)}`
|
|
15310
15387
|
};
|
|
15311
15388
|
})
|
|
15312
15389
|
}
|
|
@@ -15335,7 +15412,7 @@ var MarketDetailsGraphPanel = ({
|
|
|
15335
15412
|
}
|
|
15336
15413
|
),
|
|
15337
15414
|
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)("span", { "aria-hidden": "true", className: "hidden h-4 w-px bg-agg-separator md:block" }),
|
|
15338
|
-
|
|
15415
|
+
import_hooks49.CHART_TIME_RANGES.map((timeRange) => {
|
|
15339
15416
|
const isActive = effectiveChartTimeRange === timeRange;
|
|
15340
15417
|
const isDisabled = isResolvedMarket && timeRange !== "ALL";
|
|
15341
15418
|
return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
|
|
@@ -15378,7 +15455,7 @@ var MarketDetailsUnavailableState = ({
|
|
|
15378
15455
|
ariaLabel,
|
|
15379
15456
|
classNames
|
|
15380
15457
|
}) => {
|
|
15381
|
-
const labels = (0,
|
|
15458
|
+
const labels = (0, import_hooks50.useLabels)();
|
|
15382
15459
|
return /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
15383
15460
|
Card,
|
|
15384
15461
|
{
|
|
@@ -15402,7 +15479,7 @@ var MarketDetailsNotFoundState = ({
|
|
|
15402
15479
|
ariaLabel: _ariaLabel,
|
|
15403
15480
|
classNames: _classNames
|
|
15404
15481
|
}) => {
|
|
15405
|
-
const labels = (0,
|
|
15482
|
+
const labels = (0, import_hooks50.useLabels)();
|
|
15406
15483
|
return /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
15407
15484
|
StateMessage,
|
|
15408
15485
|
{
|
|
@@ -15440,33 +15517,33 @@ var MarketDetailsContent = ({
|
|
|
15440
15517
|
midpointsResult
|
|
15441
15518
|
}) => {
|
|
15442
15519
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
15443
|
-
const config = (0,
|
|
15520
|
+
const config = (0, import_hooks50.useSdkUiConfig)();
|
|
15444
15521
|
const {
|
|
15445
15522
|
features: { enableAnimations },
|
|
15446
15523
|
formatting: { formatPercent }
|
|
15447
15524
|
} = config;
|
|
15448
|
-
const labels = (0,
|
|
15449
|
-
const tradingContext = (0,
|
|
15525
|
+
const labels = (0, import_hooks50.useLabels)();
|
|
15526
|
+
const tradingContext = (0, import_hooks50.useEventTradingContext)();
|
|
15450
15527
|
const detailsContentId = (0, import_react27.useId)();
|
|
15451
15528
|
const tradeSide = (_a = tradingContext == null ? void 0 : tradingContext.tradeSide) != null ? _a : "buy";
|
|
15452
15529
|
const resolvedMarket = (0, import_react27.useMemo)(() => {
|
|
15453
15530
|
return resolveMarketFromVenueMarkets(venueMarkets, marketId);
|
|
15454
15531
|
}, [venueMarkets, marketId]);
|
|
15455
15532
|
const clusterVenueMarkets = resolvedMarket == null ? void 0 : resolvedMarket.venueMarkets;
|
|
15456
|
-
const wsLivePrices = (0,
|
|
15457
|
-
const wsBestPrices = (0,
|
|
15458
|
-
const wsBestCandidates = (0,
|
|
15533
|
+
const wsLivePrices = (0, import_hooks50.useLiveOutcomePrices)(clusterVenueMarkets);
|
|
15534
|
+
const wsBestPrices = (0, import_hooks50.useLiveBestPrices)(clusterVenueMarkets);
|
|
15535
|
+
const wsBestCandidates = (0, import_hooks50.useLiveBestPriceCandidates)(clusterVenueMarkets);
|
|
15459
15536
|
const scopedResolvedMarket = (0, import_react27.useMemo)(() => {
|
|
15460
15537
|
var _a2, _b2;
|
|
15461
15538
|
if (!resolvedMarket) return null;
|
|
15462
15539
|
return (_b2 = (_a2 = resolvedMarket.venueMarkets.find((venueMarket) => venueMarket.id === resolvedMarket.id)) != null ? _a2 : resolvedMarket.venueMarkets[0]) != null ? _b2 : null;
|
|
15463
15540
|
}, [resolvedMarket]);
|
|
15464
|
-
const isResolvedMarket = (0,
|
|
15465
|
-
(0,
|
|
15541
|
+
const isResolvedMarket = (0, import_hooks50.resolveMarketTradingState)(scopedResolvedMarket).kind === "resolved";
|
|
15542
|
+
(0, import_hooks50.useEventOrderbookData)(
|
|
15466
15543
|
isResolvedMarket ? [] : resolvedMarket == null ? void 0 : resolvedMarket.venueMarkets,
|
|
15467
15544
|
(_b = scopedResolvedMarket == null ? void 0 : scopedResolvedMarket.id) != null ? _b : null
|
|
15468
15545
|
);
|
|
15469
|
-
const fetchedClusterMidpointResult = (0,
|
|
15546
|
+
const fetchedClusterMidpointResult = (0, import_hooks50.useMidpoints)(midpointsResult ? [] : clusterVenueMarkets);
|
|
15470
15547
|
const clusterMidpointResult = midpointsResult != null ? midpointsResult : fetchedClusterMidpointResult;
|
|
15471
15548
|
const clusterMidpoints = (_c = clusterMidpointResult.bestMidpointsByOutcomeId) != null ? _c : clusterMidpointResult.prices;
|
|
15472
15549
|
const clusterBestMidpointsByOutcomeId = clusterMidpoints;
|
|
@@ -15475,7 +15552,7 @@ var MarketDetailsContent = ({
|
|
|
15475
15552
|
const clusterBestMidpointVenue = clusterMidpointResult.bestMidpointVenue;
|
|
15476
15553
|
const clusterBestPricesRest = clusterMidpointResult.bestPrices;
|
|
15477
15554
|
const clusterBestPrices = (0, import_react27.useMemo)(
|
|
15478
|
-
() => (0,
|
|
15555
|
+
() => (0, import_hooks50.mergeBestPricesPreferringLive)(clusterBestPricesRest, wsBestPrices),
|
|
15479
15556
|
[clusterBestPricesRest, wsBestPrices]
|
|
15480
15557
|
);
|
|
15481
15558
|
const clusterBestPriceVenuesByOutcomeId = clusterMidpointResult.bestPriceVenuesByOutcomeId;
|
|
@@ -15530,7 +15607,7 @@ var MarketDetailsContent = ({
|
|
|
15530
15607
|
return (_a2 = model.market.venueMarkets.find((venueMarket) => venueMarket.id === model.market.id)) != null ? _a2 : model.primaryVenueMarket;
|
|
15531
15608
|
}, [model]);
|
|
15532
15609
|
const marketTradingState = (0, import_react27.useMemo)(() => {
|
|
15533
|
-
return (0,
|
|
15610
|
+
return (0, import_hooks50.resolveMarketTradingState)(scopedMarketForCard);
|
|
15534
15611
|
}, [scopedMarketForCard]);
|
|
15535
15612
|
const isOutcomeSelectionLocked = marketTradingState.isTradingDisabled;
|
|
15536
15613
|
const isUpcomingMarket = marketTradingState.kind === "unopened";
|
|
@@ -15691,7 +15768,7 @@ var MarketDetailsContent = ({
|
|
|
15691
15768
|
fallbackPrice: midpointsFallback == null ? void 0 : midpointsFallback.get(displayOutcome.id)
|
|
15692
15769
|
});
|
|
15693
15770
|
if (referencePrice != null) return referencePrice;
|
|
15694
|
-
return (0,
|
|
15771
|
+
return (0, import_hooks50.findLivePriceById)(wsLivePrices, displayOutcome.id);
|
|
15695
15772
|
}, [
|
|
15696
15773
|
clusterBestMidpoint,
|
|
15697
15774
|
clusterBestMidpointsByOutcomeId,
|
|
@@ -15717,7 +15794,7 @@ var MarketDetailsContent = ({
|
|
|
15717
15794
|
const orderBookEnabled = isOpened && effectiveSelectedTab === "order-book" && !marketTradingState.isTradingDisabled;
|
|
15718
15795
|
const primaryVenueMarketId = (_g = (_f = selectedOutcomesByVenue[0]) == null ? void 0 : _f.market.id) != null ? _g : null;
|
|
15719
15796
|
const primaryOutcomeId = (_i = (_h = selectedOutcomesByVenue[0]) == null ? void 0 : _h.outcome.id) != null ? _i : null;
|
|
15720
|
-
const marketOrderbookResult = (0,
|
|
15797
|
+
const marketOrderbookResult = (0, import_hooks50.useMarketOrderbook)({
|
|
15721
15798
|
marketId: primaryVenueMarketId,
|
|
15722
15799
|
enabled: orderBookEnabled && !!primaryVenueMarketId,
|
|
15723
15800
|
venueOutcomes: selectedOutcomesByVenue.map((item) => ({
|
|
@@ -15898,7 +15975,7 @@ var MarketDetailsContent = ({
|
|
|
15898
15975
|
!compactHeader ? /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
15899
15976
|
RemoteImage,
|
|
15900
15977
|
{
|
|
15901
|
-
src: (0,
|
|
15978
|
+
src: (0, import_hooks50.optimizedImageUrl)(model.image, 60),
|
|
15902
15979
|
alt: "",
|
|
15903
15980
|
className: "agg-market-image size-12 rounded-agg-lg object-cover md:size-[60px]"
|
|
15904
15981
|
}
|
|
@@ -16149,7 +16226,7 @@ var MarketDetailsContent = ({
|
|
|
16149
16226
|
};
|
|
16150
16227
|
var MarketDetails = (_a) => {
|
|
16151
16228
|
var _b = _a, { isOpened } = _b, props = __objRest(_b, ["isOpened"]);
|
|
16152
|
-
const labels = (0,
|
|
16229
|
+
const labels = (0, import_hooks50.useLabels)();
|
|
16153
16230
|
if (props.isLoading) {
|
|
16154
16231
|
return /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
16155
16232
|
Skeleton,
|
|
@@ -16204,13 +16281,13 @@ var resolveIsResolvedEvent = (sourceMarkets, eventTradingState) => {
|
|
|
16204
16281
|
return eventTradingState.kind === "resolved";
|
|
16205
16282
|
}
|
|
16206
16283
|
if (sourceMarkets.length === 0) return false;
|
|
16207
|
-
return sourceMarkets.every((market) => (0,
|
|
16284
|
+
return sourceMarkets.every((market) => (0, import_hooks50.resolveMarketTradingState)(market).kind === "resolved");
|
|
16208
16285
|
};
|
|
16209
16286
|
var resolveResolvedWinnerMarketId = (sourceMarkets, eventTradingState) => {
|
|
16210
16287
|
var _a, _b, _c, _d, _e;
|
|
16211
16288
|
const preferredMarket = (_a = eventTradingState == null ? void 0 : eventTradingState.primaryMarket) != null ? _a : null;
|
|
16212
16289
|
if (preferredMarket && sourceMarkets.some((market) => market.id === preferredMarket.id)) {
|
|
16213
|
-
if ((0,
|
|
16290
|
+
if ((0, import_hooks50.resolveMarketTradingState)(preferredMarket).kind === "resolved") {
|
|
16214
16291
|
return preferredMarket.id;
|
|
16215
16292
|
}
|
|
16216
16293
|
}
|
|
@@ -16230,8 +16307,8 @@ var MarketDetailsList = ({
|
|
|
16230
16307
|
midpointsResult
|
|
16231
16308
|
}) => {
|
|
16232
16309
|
var _a, _b;
|
|
16233
|
-
const labels = (0,
|
|
16234
|
-
const tradingContext = (0,
|
|
16310
|
+
const labels = (0, import_hooks50.useLabels)();
|
|
16311
|
+
const tradingContext = (0, import_hooks50.useEventTradingContext)();
|
|
16235
16312
|
const selectedMarketId = (_a = tradingContext == null ? void 0 : tradingContext.selectedMarketId) != null ? _a : null;
|
|
16236
16313
|
const [expandedMarketId, setExpandedMarketId] = (0, import_react27.useState)(null);
|
|
16237
16314
|
const [areResolvedMarketsVisible, setAreResolvedMarketsVisible] = (0, import_react27.useState)(false);
|
|
@@ -16240,10 +16317,10 @@ var MarketDetailsList = ({
|
|
|
16240
16317
|
markets: rawMarkets,
|
|
16241
16318
|
isLoading,
|
|
16242
16319
|
error
|
|
16243
|
-
} = (0,
|
|
16320
|
+
} = (0, import_hooks50.useVenueMarkets)({
|
|
16244
16321
|
venueEventId: resolvedEventId,
|
|
16245
16322
|
enabled: !providedMarkets && !!resolvedEventId,
|
|
16246
|
-
status:
|
|
16323
|
+
status: import_hooks50.MarketStatus.open,
|
|
16247
16324
|
// Keep in lockstep with useEnrichedVenueEvent: limit is part of the React
|
|
16248
16325
|
// Query key, so a mismatch would fork the shared cache into two requests.
|
|
16249
16326
|
// fetchAll drains every page — events can exceed any single-page limit
|
|
@@ -16287,7 +16364,7 @@ var MarketDetailsList = ({
|
|
|
16287
16364
|
const resolved = [];
|
|
16288
16365
|
const closed = [];
|
|
16289
16366
|
sourceMarkets.forEach((market) => {
|
|
16290
|
-
const marketStateKind = (0,
|
|
16367
|
+
const marketStateKind = (0, import_hooks50.resolveMarketTradingState)(market).kind;
|
|
16291
16368
|
if (marketStateKind === "resolved") {
|
|
16292
16369
|
resolved.push(market);
|
|
16293
16370
|
return;
|
|
@@ -16315,10 +16392,10 @@ var MarketDetailsList = ({
|
|
|
16315
16392
|
const hasPrefetchedMarkets = !!providedMarkets || !!((_b = eventTradingState == null ? void 0 : eventTradingState.marketStates) == null ? void 0 : _b.length);
|
|
16316
16393
|
const midpointEligibleMarkets = (0, import_react27.useMemo)(() => {
|
|
16317
16394
|
return displayedMarkets.filter(
|
|
16318
|
-
(market) => (0,
|
|
16395
|
+
(market) => (0, import_hooks50.resolveMarketTradingState)(market).kind !== "resolved"
|
|
16319
16396
|
);
|
|
16320
16397
|
}, [displayedMarkets]);
|
|
16321
|
-
const { prices: midpointsFallback, venueByOutcomeId: midpointsFallbackVenues } = (0,
|
|
16398
|
+
const { prices: midpointsFallback, venueByOutcomeId: midpointsFallbackVenues } = (0, import_hooks50.useViewportMidpoints)(midpointEligibleMarkets);
|
|
16322
16399
|
(0, import_react27.useEffect)(() => {
|
|
16323
16400
|
if (isResolvedEvent) {
|
|
16324
16401
|
setAreResolvedMarketsVisible(false);
|
|
@@ -16337,7 +16414,7 @@ var MarketDetailsList = ({
|
|
|
16337
16414
|
return;
|
|
16338
16415
|
}
|
|
16339
16416
|
const fallbackSelectableMarket = displayedMarkets.find(
|
|
16340
|
-
(market) => !(0,
|
|
16417
|
+
(market) => !(0, import_hooks50.resolveMarketTradingState)(market).isTradingDisabled
|
|
16341
16418
|
);
|
|
16342
16419
|
if (!fallbackSelectableMarket) {
|
|
16343
16420
|
return;
|
|
@@ -16359,7 +16436,7 @@ var MarketDetailsList = ({
|
|
|
16359
16436
|
setExpandedMarketId(marketId);
|
|
16360
16437
|
onExpandedMarketChange == null ? void 0 : onExpandedMarketChange(marketId);
|
|
16361
16438
|
if (marketId === selectedMarketId) return;
|
|
16362
|
-
if ((0,
|
|
16439
|
+
if ((0, import_hooks50.resolveMarketTradingState)(market).isTradingDisabled) return;
|
|
16363
16440
|
tradingContext == null ? void 0 : tradingContext.selectMarket(market.id, market);
|
|
16364
16441
|
};
|
|
16365
16442
|
if (!hasPrefetchedMarkets && isLoading) {
|
|
@@ -16457,7 +16534,7 @@ var isVenue = (0, import_sdk17.enumGuard)(import_sdk17.Venue);
|
|
|
16457
16534
|
var parseVenue = (v) => (0, import_sdk17.safeParse)(v, isVenue);
|
|
16458
16535
|
|
|
16459
16536
|
// src/trading/settlement/settlement-details.tsx
|
|
16460
|
-
var
|
|
16537
|
+
var import_hooks51 = require("@agg-build/hooks");
|
|
16461
16538
|
var import_jsx_runtime146 = require("react/jsx-runtime");
|
|
16462
16539
|
var hasContent = (value) => {
|
|
16463
16540
|
return typeof value === "string" && value.trim().length > 0;
|
|
@@ -16481,11 +16558,11 @@ var buildVenueSettlementRules = (venueMarkets) => {
|
|
|
16481
16558
|
};
|
|
16482
16559
|
var SettlementDetails = ({ className }) => {
|
|
16483
16560
|
var _a, _b, _c, _d, _e, _f;
|
|
16484
|
-
const tradingContext = (0,
|
|
16561
|
+
const tradingContext = (0, import_hooks51.useEventTradingContext)();
|
|
16485
16562
|
const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
|
|
16486
16563
|
const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
|
|
16487
16564
|
if (!selectedEvent) return null;
|
|
16488
|
-
const activeMarket = selectedMarket != null ? selectedMarket : (0,
|
|
16565
|
+
const activeMarket = selectedMarket != null ? selectedMarket : (0, import_hooks51.resolveDefaultTradingMarket)(selectedEvent);
|
|
16489
16566
|
if (!activeMarket) return null;
|
|
16490
16567
|
const allVenueMarkets = normalizeVenueMarketCluster(selectedEvent.venueMarkets);
|
|
16491
16568
|
const activeMarketCluster = normalizeVenueMarketCluster(
|
|
@@ -16526,10 +16603,9 @@ var SettlementDetails = ({ className }) => {
|
|
|
16526
16603
|
SettlementDetails.displayName = "SettlementDetails";
|
|
16527
16604
|
|
|
16528
16605
|
// src/trading/place-order/index.tsx
|
|
16529
|
-
var
|
|
16606
|
+
var import_hooks61 = require("@agg-build/hooks");
|
|
16530
16607
|
var import_sdk22 = require("@agg-build/sdk");
|
|
16531
16608
|
var import_react35 = __toESM(require("@number-flow/react"));
|
|
16532
|
-
var DropdownMenu = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
16533
16609
|
var Popover = __toESM(require("@radix-ui/react-popover"));
|
|
16534
16610
|
var import_dayjs8 = __toESM(require("dayjs"));
|
|
16535
16611
|
var import_timezone2 = __toESM(require("dayjs/plugin/timezone"));
|
|
@@ -16537,14 +16613,14 @@ var import_utc2 = __toESM(require("dayjs/plugin/utc"));
|
|
|
16537
16613
|
var import_react36 = require("react");
|
|
16538
16614
|
|
|
16539
16615
|
// src/geo-block-banner/index.tsx
|
|
16540
|
-
var
|
|
16616
|
+
var import_hooks52 = require("@agg-build/hooks");
|
|
16541
16617
|
var import_jsx_runtime147 = require("react/jsx-runtime");
|
|
16542
16618
|
var GeoBlockBanner = ({
|
|
16543
16619
|
venue,
|
|
16544
16620
|
termsUrl = AGG_TERMS_OF_SERVICE_URL,
|
|
16545
16621
|
className
|
|
16546
16622
|
}) => {
|
|
16547
|
-
const labels = (0,
|
|
16623
|
+
const labels = (0, import_hooks52.useLabels)();
|
|
16548
16624
|
const message = venue ? labels.trading.geoBlockVenueMessage(venue) : labels.trading.geoBlockGenericMessage;
|
|
16549
16625
|
return /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)(
|
|
16550
16626
|
"div",
|
|
@@ -16566,7 +16642,7 @@ GeoBlockBanner.displayName = "GeoBlockBanner";
|
|
|
16566
16642
|
|
|
16567
16643
|
// src/onboarding/index.tsx
|
|
16568
16644
|
var import_react32 = require("react");
|
|
16569
|
-
var
|
|
16645
|
+
var import_hooks58 = require("@agg-build/hooks");
|
|
16570
16646
|
var Dialog5 = __toESM(require("@radix-ui/react-dialog"));
|
|
16571
16647
|
|
|
16572
16648
|
// src/onboarding/onboarding-modal.constants.ts
|
|
@@ -16590,7 +16666,7 @@ var ONCHAIN_VENUES = [
|
|
|
16590
16666
|
|
|
16591
16667
|
// src/onboarding/steps/how-it-works.tsx
|
|
16592
16668
|
var import_react28 = require("react");
|
|
16593
|
-
var
|
|
16669
|
+
var import_hooks53 = require("@agg-build/hooks");
|
|
16594
16670
|
var import_jsx_runtime148 = require("react/jsx-runtime");
|
|
16595
16671
|
var defaultIcons = {
|
|
16596
16672
|
createAccount: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(CreateAccountIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
|
|
@@ -16599,7 +16675,7 @@ var defaultIcons = {
|
|
|
16599
16675
|
stayInControl: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(StayInControlIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" })
|
|
16600
16676
|
};
|
|
16601
16677
|
var HowItWorksStep = ({ onContinue, icons }) => {
|
|
16602
|
-
const labels = (0,
|
|
16678
|
+
const labels = (0, import_hooks53.useLabels)();
|
|
16603
16679
|
const scrollRef = (0, import_react28.useRef)(null);
|
|
16604
16680
|
const [showTopGradient, setShowTopGradient] = (0, import_react28.useState)(false);
|
|
16605
16681
|
const [showBottomGradient, setShowBottomGradient] = (0, import_react28.useState)(true);
|
|
@@ -16673,10 +16749,10 @@ HowItWorksStep.displayName = "HowItWorksStep";
|
|
|
16673
16749
|
|
|
16674
16750
|
// src/onboarding/steps/profile-setup.tsx
|
|
16675
16751
|
var import_react29 = require("react");
|
|
16676
|
-
var
|
|
16752
|
+
var import_hooks54 = require("@agg-build/hooks");
|
|
16677
16753
|
var import_jsx_runtime149 = require("react/jsx-runtime");
|
|
16678
16754
|
var ProfileSetupStep = ({ onContinue }) => {
|
|
16679
|
-
const labels = (0,
|
|
16755
|
+
const labels = (0, import_hooks54.useLabels)();
|
|
16680
16756
|
const [username, setUsername] = (0, import_react29.useState)("");
|
|
16681
16757
|
const [avatarFile, setAvatarFile] = (0, import_react29.useState)();
|
|
16682
16758
|
const [avatarPreview, setAvatarPreview] = (0, import_react29.useState)();
|
|
@@ -16806,7 +16882,7 @@ var ProfileSetupStep = ({ onContinue }) => {
|
|
|
16806
16882
|
ProfileSetupStep.displayName = "ProfileSetupStep";
|
|
16807
16883
|
|
|
16808
16884
|
// src/onboarding/steps/connect-accounts.tsx
|
|
16809
|
-
var
|
|
16885
|
+
var import_hooks55 = require("@agg-build/hooks");
|
|
16810
16886
|
var import_jsx_runtime150 = require("react/jsx-runtime");
|
|
16811
16887
|
var OnchainVenueLogos = () => {
|
|
16812
16888
|
return /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("div", { className: "flex gap-1 sm:gap-0 sm:-space-x-5", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("div", { style: { zIndex: ONCHAIN_VENUES.length - index }, children: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(VenueLogo, { venue, variant: "logo", size: "medium", className: "sm:h-8 sm:w-8" }) }, venue)) });
|
|
@@ -16820,7 +16896,7 @@ var VenueCard = ({
|
|
|
16820
16896
|
onConnect,
|
|
16821
16897
|
connected = false
|
|
16822
16898
|
}) => {
|
|
16823
|
-
const labels = (0,
|
|
16899
|
+
const labels = (0, import_hooks55.useLabels)();
|
|
16824
16900
|
const action = connected ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(CheckCircleIcon, { className: "h-6 w-6 text-agg-success" }) : /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
|
|
16825
16901
|
Button,
|
|
16826
16902
|
{
|
|
@@ -16879,7 +16955,7 @@ var ConnectAccountsStep = ({
|
|
|
16879
16955
|
onContinue,
|
|
16880
16956
|
connectedOnchain = false
|
|
16881
16957
|
}) => {
|
|
16882
|
-
const labels = (0,
|
|
16958
|
+
const labels = (0, import_hooks55.useLabels)();
|
|
16883
16959
|
const canContinue = connectedOnchain;
|
|
16884
16960
|
return /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex flex-col gap-6", children: [
|
|
16885
16961
|
/* @__PURE__ */ (0, import_jsx_runtime150.jsx)("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectAccounts.title }),
|
|
@@ -16914,7 +16990,7 @@ ConnectAccountsStep.displayName = "ConnectAccountsStep";
|
|
|
16914
16990
|
|
|
16915
16991
|
// src/onboarding/steps/connect-onchain-modal.tsx
|
|
16916
16992
|
var import_react30 = require("react");
|
|
16917
|
-
var
|
|
16993
|
+
var import_hooks56 = require("@agg-build/hooks");
|
|
16918
16994
|
var Dialog3 = __toESM(require("@radix-ui/react-dialog"));
|
|
16919
16995
|
var import_jsx_runtime151 = require("react/jsx-runtime");
|
|
16920
16996
|
var ConnectOnchainModal = ({
|
|
@@ -16922,7 +16998,7 @@ var ConnectOnchainModal = ({
|
|
|
16922
16998
|
onOpenChange,
|
|
16923
16999
|
onConnect
|
|
16924
17000
|
}) => {
|
|
16925
|
-
const labels = (0,
|
|
17001
|
+
const labels = (0, import_hooks56.useLabels)();
|
|
16926
17002
|
const [connecting, setConnecting] = (0, import_react30.useState)(false);
|
|
16927
17003
|
const [error, setError] = (0, import_react30.useState)();
|
|
16928
17004
|
const handleCancel = (0, import_react30.useCallback)(() => {
|
|
@@ -17021,7 +17097,7 @@ var ConnectOnchainModal = ({
|
|
|
17021
17097
|
ConnectOnchainModal.displayName = "ConnectOnchainModal";
|
|
17022
17098
|
|
|
17023
17099
|
// src/onboarding/steps/connect-kalshi-modal.tsx
|
|
17024
|
-
var
|
|
17100
|
+
var import_hooks57 = require("@agg-build/hooks");
|
|
17025
17101
|
var import_sdk19 = require("@agg-build/sdk");
|
|
17026
17102
|
var Dialog4 = __toESM(require("@radix-ui/react-dialog"));
|
|
17027
17103
|
var import_react31 = require("react");
|
|
@@ -17048,8 +17124,8 @@ var ConnectKalshiModal = ({
|
|
|
17048
17124
|
onOpenChange,
|
|
17049
17125
|
onVerify
|
|
17050
17126
|
}) => {
|
|
17051
|
-
const labels = (0,
|
|
17052
|
-
const { disabledVenues, isLoading: isAppConfigLoading } = (0,
|
|
17127
|
+
const labels = (0, import_hooks57.useLabels)();
|
|
17128
|
+
const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks57.useAppConfig)();
|
|
17053
17129
|
const apiKeyInputRef = (0, import_react31.useRef)(null);
|
|
17054
17130
|
const errorId = (0, import_react31.useId)();
|
|
17055
17131
|
const [apiKeyId, setApiKeyId] = (0, import_react31.useState)("");
|
|
@@ -17057,7 +17133,7 @@ var ConnectKalshiModal = ({
|
|
|
17057
17133
|
const [isVerifying, setIsVerifying] = (0, import_react31.useState)(false);
|
|
17058
17134
|
const [isConnected, setIsConnected] = (0, import_react31.useState)(false);
|
|
17059
17135
|
const [error, setError] = (0, import_react31.useState)();
|
|
17060
|
-
const availabilityState = (0,
|
|
17136
|
+
const availabilityState = (0, import_hooks57.getVenueAvailabilityState)({
|
|
17061
17137
|
venueId: import_sdk19.Venue.kalshi,
|
|
17062
17138
|
disabledVenues,
|
|
17063
17139
|
isConfigLoading: isAppConfigLoading
|
|
@@ -17359,7 +17435,7 @@ var OnboardingModal = ({
|
|
|
17359
17435
|
connectedOnchain = false
|
|
17360
17436
|
}) => {
|
|
17361
17437
|
var _a;
|
|
17362
|
-
const labels = (0,
|
|
17438
|
+
const labels = (0, import_hooks58.useLabels)();
|
|
17363
17439
|
const [step, setStep] = (0, import_react32.useState)(ONBOARDING_STEPS.HOW_IT_WORKS);
|
|
17364
17440
|
const stepLabels = {
|
|
17365
17441
|
[ONBOARDING_STEPS.HOW_IT_WORKS]: labels.onboarding.modal.stepHowItWorks,
|
|
@@ -17432,7 +17508,7 @@ var OnboardingModal = ({
|
|
|
17432
17508
|
OnboardingModal.displayName = "OnboardingModal";
|
|
17433
17509
|
|
|
17434
17510
|
// src/notifications/agg-notification-events-provider.tsx
|
|
17435
|
-
var
|
|
17511
|
+
var import_hooks59 = require("@agg-build/hooks");
|
|
17436
17512
|
var import_react33 = require("react");
|
|
17437
17513
|
var import_jsx_runtime154 = require("react/jsx-runtime");
|
|
17438
17514
|
var firedOrderNotificationKeys = /* @__PURE__ */ new Set();
|
|
@@ -17536,12 +17612,12 @@ var requestAggWithdrawModalOpen = () => {
|
|
|
17536
17612
|
};
|
|
17537
17613
|
|
|
17538
17614
|
// src/trading/fund-kalshi-modal.tsx
|
|
17539
|
-
var
|
|
17615
|
+
var import_hooks60 = require("@agg-build/hooks");
|
|
17540
17616
|
var import_sdk20 = require("@agg-build/sdk");
|
|
17541
17617
|
var Dialog6 = __toESM(require("@radix-ui/react-dialog"));
|
|
17542
17618
|
var import_jsx_runtime155 = require("react/jsx-runtime");
|
|
17543
17619
|
var FundKalshiModal = ({ open, onOpenChange }) => {
|
|
17544
|
-
const labels = (0,
|
|
17620
|
+
const labels = (0, import_hooks60.useLabels)();
|
|
17545
17621
|
const modalLabels = labels.trading.fundKalshiModal;
|
|
17546
17622
|
return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(Modal, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime155.jsxs)(
|
|
17547
17623
|
Modal.Container,
|
|
@@ -17613,11 +17689,12 @@ var MIN_SELL_ORDER_SHARES = 1;
|
|
|
17613
17689
|
var DEFAULT_SLIPPAGE_VALUE = "0.5";
|
|
17614
17690
|
var HIGH_SLIPPAGE_THRESHOLD = 10;
|
|
17615
17691
|
var PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT = 3;
|
|
17692
|
+
var PLACE_ORDER_NUMERIC_INPUT_CLASS_NAME = "bg-transparent text-right text-agg-3xl font-agg-bold leading-agg-9 tracking-agg-normal text-agg-foreground outline-none";
|
|
17616
17693
|
var PLACE_ORDER_CONTAINER_CLASS_NAME = "w-full overflow-hidden rounded-agg-xl border border-agg-separator bg-agg-secondary shadow-none hover:shadow-none";
|
|
17617
17694
|
var PLACE_ORDER_OUTCOME_BUTTON_CLASS_NAMES = {
|
|
17618
17695
|
activeNegative: "border-agg-error/50 bg-agg-error/15 font-agg-bold text-agg-error",
|
|
17619
17696
|
activePositive: "border-agg-success/50 bg-agg-success/15 font-agg-bold text-agg-success",
|
|
17620
|
-
base: "flex h-
|
|
17697
|
+
base: "flex h-11 flex-1 items-center justify-center rounded-agg-full border px-6 text-agg-base leading-agg-6",
|
|
17621
17698
|
inactive: "border-transparent bg-agg-secondary-hover font-agg-normal text-agg-foreground hover:bg-agg-tertiary"
|
|
17622
17699
|
};
|
|
17623
17700
|
|
|
@@ -18086,6 +18163,93 @@ var routePriceLabelFormatter = new Intl.NumberFormat("en-US", {
|
|
|
18086
18163
|
maximumFractionDigits: 1
|
|
18087
18164
|
});
|
|
18088
18165
|
var GEO_BLOCK_WARNING_PREFIX = "Venue not available in your region";
|
|
18166
|
+
var normalizeOutcomeName = (value) => {
|
|
18167
|
+
var _a;
|
|
18168
|
+
return (_a = value == null ? void 0 : value.trim().toLowerCase()) != null ? _a : "";
|
|
18169
|
+
};
|
|
18170
|
+
var findMatchingVenueOutcome = (market, selectedOutcome) => {
|
|
18171
|
+
var _a, _b;
|
|
18172
|
+
const selectedNames = new Set(
|
|
18173
|
+
[selectedOutcome.label, selectedOutcome.title].map(normalizeOutcomeName).filter(Boolean)
|
|
18174
|
+
);
|
|
18175
|
+
return (_b = (_a = market.venueMarketOutcomes) == null ? void 0 : _a.find((outcome) => {
|
|
18176
|
+
const normalizedLabel = normalizeOutcomeName(outcome.label);
|
|
18177
|
+
return normalizedLabel !== "" && selectedNames.has(normalizedLabel);
|
|
18178
|
+
})) != null ? _b : null;
|
|
18179
|
+
};
|
|
18180
|
+
var buildLimitOrderVenueOptions = ({
|
|
18181
|
+
currentPrices,
|
|
18182
|
+
livePrices,
|
|
18183
|
+
market,
|
|
18184
|
+
selectedOutcomeId
|
|
18185
|
+
}) => {
|
|
18186
|
+
var _a, _b, _c, _d;
|
|
18187
|
+
if (!market || !selectedOutcomeId) return [];
|
|
18188
|
+
const selectedOutcome = market.venueMarketOutcomes.find(
|
|
18189
|
+
(outcome) => outcome.id === selectedOutcomeId
|
|
18190
|
+
);
|
|
18191
|
+
if (!selectedOutcome) return [];
|
|
18192
|
+
const options = /* @__PURE__ */ new Map();
|
|
18193
|
+
const addOption = ({
|
|
18194
|
+
outcomeId,
|
|
18195
|
+
venue,
|
|
18196
|
+
venueMarketId
|
|
18197
|
+
}) => {
|
|
18198
|
+
var _a2;
|
|
18199
|
+
const parsedVenue = parseVenue(venue);
|
|
18200
|
+
if (!parsedVenue.success || options.has(parsedVenue.data)) return;
|
|
18201
|
+
options.set(parsedVenue.data, {
|
|
18202
|
+
currentPrice: (_a2 = livePrices == null ? void 0 : livePrices.get(outcomeId)) != null ? _a2 : currentPrices.get(outcomeId),
|
|
18203
|
+
venue: parsedVenue.data,
|
|
18204
|
+
venueMarketId,
|
|
18205
|
+
venueMarketOutcomeId: outcomeId
|
|
18206
|
+
});
|
|
18207
|
+
};
|
|
18208
|
+
addOption({
|
|
18209
|
+
outcomeId: selectedOutcome.id,
|
|
18210
|
+
venue: market.venue,
|
|
18211
|
+
venueMarketId: market.id
|
|
18212
|
+
});
|
|
18213
|
+
const matchedMarketsById = new Map(
|
|
18214
|
+
((_a = market.matchedVenueMarkets) != null ? _a : []).map((matchedMarket) => [matchedMarket.id, matchedMarket])
|
|
18215
|
+
);
|
|
18216
|
+
const matchedOutcomeRefs = (_b = selectedOutcome.matchedVenueMarketOutcomes) != null ? _b : [];
|
|
18217
|
+
for (const ref of matchedOutcomeRefs) {
|
|
18218
|
+
const matchedMarket = matchedMarketsById.get(ref.venueMarketId);
|
|
18219
|
+
const matchedOutcome = (_c = matchedMarket == null ? void 0 : matchedMarket.venueMarketOutcomes) == null ? void 0 : _c.find(
|
|
18220
|
+
(outcome) => outcome.id === ref.venueMarketOutcomeId
|
|
18221
|
+
);
|
|
18222
|
+
if (!matchedMarket || !matchedOutcome) continue;
|
|
18223
|
+
addOption({
|
|
18224
|
+
outcomeId: matchedOutcome.id,
|
|
18225
|
+
venue: matchedMarket.venue,
|
|
18226
|
+
venueMarketId: matchedMarket.id
|
|
18227
|
+
});
|
|
18228
|
+
}
|
|
18229
|
+
if (matchedOutcomeRefs.length === 0) {
|
|
18230
|
+
for (const matchedMarket of (_d = market.matchedVenueMarkets) != null ? _d : []) {
|
|
18231
|
+
const matchedOutcome = findMatchingVenueOutcome(matchedMarket, selectedOutcome);
|
|
18232
|
+
if (!matchedOutcome) continue;
|
|
18233
|
+
addOption({
|
|
18234
|
+
outcomeId: matchedOutcome.id,
|
|
18235
|
+
venue: matchedMarket.venue,
|
|
18236
|
+
venueMarketId: matchedMarket.id
|
|
18237
|
+
});
|
|
18238
|
+
}
|
|
18239
|
+
}
|
|
18240
|
+
return [...options.values()];
|
|
18241
|
+
};
|
|
18242
|
+
var resolveAutomaticLimitOrderVenueOption = (options, side) => {
|
|
18243
|
+
if (options.length === 0) return null;
|
|
18244
|
+
return [...options].sort((left, right) => {
|
|
18245
|
+
if (left.currentPrice == null && right.currentPrice == null) {
|
|
18246
|
+
return left.venue.localeCompare(right.venue);
|
|
18247
|
+
}
|
|
18248
|
+
if (left.currentPrice == null) return 1;
|
|
18249
|
+
if (right.currentPrice == null) return -1;
|
|
18250
|
+
return side === "buy" ? left.currentPrice - right.currentPrice : right.currentPrice - left.currentPrice;
|
|
18251
|
+
})[0];
|
|
18252
|
+
};
|
|
18089
18253
|
var isGeoBlockWarningReason = (reason) => reason.startsWith(GEO_BLOCK_WARNING_PREFIX);
|
|
18090
18254
|
var extractGeoBlockedVenues = (warnings) => {
|
|
18091
18255
|
if (!(warnings == null ? void 0 : warnings.length)) return /* @__PURE__ */ new Set();
|
|
@@ -18093,6 +18257,12 @@ var extractGeoBlockedVenues = (warnings) => {
|
|
|
18093
18257
|
warnings.filter((w) => w.venue && isGeoBlockWarningReason(w.reason)).map((w) => w.venue)
|
|
18094
18258
|
);
|
|
18095
18259
|
};
|
|
18260
|
+
var getSmartRouteTotalFees = (feeBreakdown) => {
|
|
18261
|
+
if (!feeBreakdown) return null;
|
|
18262
|
+
const feeParts = [feeBreakdown.venueFees, feeBreakdown.bridgeFees, feeBreakdown.executionGas];
|
|
18263
|
+
if (!feeParts.every(Number.isFinite)) return null;
|
|
18264
|
+
return feeParts.reduce((total, fee) => total + fee, 0);
|
|
18265
|
+
};
|
|
18096
18266
|
var hasLowLiquidityWarning = (warnings) => {
|
|
18097
18267
|
if (!(warnings == null ? void 0 : warnings.length)) return false;
|
|
18098
18268
|
return warnings.some((warning) => (warning == null ? void 0 : warning.reason) === "low_liquidity");
|
|
@@ -19744,7 +19914,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
19744
19914
|
minimumValue: slippageMinimumValue
|
|
19745
19915
|
}) => {
|
|
19746
19916
|
var _a, _b;
|
|
19747
|
-
const labels = (0,
|
|
19917
|
+
const labels = (0, import_hooks61.useLabels)();
|
|
19748
19918
|
const containerRef = (0, import_react36.useRef)(null);
|
|
19749
19919
|
const triggerRef = (0, import_react36.useRef)(null);
|
|
19750
19920
|
const inputRef = (0, import_react36.useRef)(null);
|
|
@@ -20017,7 +20187,7 @@ var PlaceOrderResolvedView = ({
|
|
|
20017
20187
|
isSportsEvent = false
|
|
20018
20188
|
}) => {
|
|
20019
20189
|
var _a, _b;
|
|
20020
|
-
const labels = (0,
|
|
20190
|
+
const labels = (0, import_hooks61.useLabels)();
|
|
20021
20191
|
const tradingLabels = labels.trading;
|
|
20022
20192
|
const resolvingTimestamp = (_a = resolutionTimestamp != null ? resolutionTimestamp : tradingState.resolvesAt) != null ? _a : tradingState.endsAt;
|
|
20023
20193
|
const isResolvingMarket = false;
|
|
@@ -20381,23 +20551,24 @@ var PlaceOrder = ({
|
|
|
20381
20551
|
resolvedClaim,
|
|
20382
20552
|
midpointsResult
|
|
20383
20553
|
}) => {
|
|
20384
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y
|
|
20554
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$;
|
|
20385
20555
|
const {
|
|
20386
20556
|
enableDebug: isExecutionDebugEnabled,
|
|
20387
20557
|
features: { enableAnimations, showFeesBreakdown, showLimitOrders },
|
|
20558
|
+
formatting: { formatPrice },
|
|
20388
20559
|
general: { locale },
|
|
20389
20560
|
trading: { executionMode: configuredExecutionMode = "live" } = { executionMode: "live" }
|
|
20390
|
-
} = (0,
|
|
20391
|
-
const labels = (0,
|
|
20561
|
+
} = (0, import_hooks61.useSdkUiConfig)();
|
|
20562
|
+
const labels = (0, import_hooks61.useLabels)();
|
|
20392
20563
|
const tradingLabels = labels.trading;
|
|
20393
20564
|
const toastCtx = useOptionalToast();
|
|
20394
|
-
const { isTradingBlocked } = (0,
|
|
20395
|
-
const tradingContext = (0,
|
|
20565
|
+
const { isTradingBlocked } = (0, import_hooks61.useGeoBlock)();
|
|
20566
|
+
const tradingContext = (0, import_hooks61.useEventTradingContext)();
|
|
20396
20567
|
const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
|
|
20397
20568
|
const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
|
|
20398
20569
|
const selectedOutcomeId = (_c = tradingContext == null ? void 0 : tradingContext.selectedOutcomeId) != null ? _c : null;
|
|
20399
20570
|
const resolvedEventTradingState = (0, import_react36.useMemo)(() => {
|
|
20400
|
-
return eventTradingState != null ? eventTradingState : (0,
|
|
20571
|
+
return eventTradingState != null ? eventTradingState : (0, import_hooks61.resolveEventTradingState)(selectedEvent);
|
|
20401
20572
|
}, [eventTradingState, selectedEvent]);
|
|
20402
20573
|
const scopedSelectedEvent = (0, import_react36.useMemo)(() => {
|
|
20403
20574
|
var _a2;
|
|
@@ -20425,7 +20596,7 @@ var PlaceOrder = ({
|
|
|
20425
20596
|
)) != null ? _f : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes[0]) != null ? _g : null;
|
|
20426
20597
|
const scopedSelectedOutcomeId = (_h = scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.id) != null ? _h : null;
|
|
20427
20598
|
const resolvedTradingState = (0, import_react36.useMemo)(() => {
|
|
20428
|
-
return (0,
|
|
20599
|
+
return (0, import_hooks61.resolveMarketTradingState)(scopedSelectedMarket);
|
|
20429
20600
|
}, [scopedSelectedMarket]);
|
|
20430
20601
|
const resolvedReadOnlyMarket = (0, import_react36.useMemo)(() => {
|
|
20431
20602
|
var _a2;
|
|
@@ -20439,11 +20610,11 @@ var PlaceOrder = ({
|
|
|
20439
20610
|
scopedSelectedMarket
|
|
20440
20611
|
]);
|
|
20441
20612
|
const resolvedReadOnlyTradingState = (0, import_react36.useMemo)(() => {
|
|
20442
|
-
return (0,
|
|
20613
|
+
return (0, import_hooks61.resolveMarketTradingState)(resolvedReadOnlyMarket);
|
|
20443
20614
|
}, [resolvedReadOnlyMarket]);
|
|
20444
20615
|
const isEndedWithoutKnownWinner = false;
|
|
20445
20616
|
const orderEligibility = (0, import_react36.useMemo)(
|
|
20446
|
-
() => (0,
|
|
20617
|
+
() => (0, import_hooks61.resolveOrderEligibility)({
|
|
20447
20618
|
event: scopedSelectedEvent,
|
|
20448
20619
|
market: scopedSelectedMarket,
|
|
20449
20620
|
outcome: scopedSelectedOutcome,
|
|
@@ -20452,11 +20623,11 @@ var PlaceOrder = ({
|
|
|
20452
20623
|
[scopedSelectedEvent, scopedSelectedMarket, scopedSelectedOutcome, resolvedEventTradingState]
|
|
20453
20624
|
);
|
|
20454
20625
|
const isResolvedOutcomeCtaLocked = resolvedEventTradingState.kind === "resolved" || resolvedTradingState.kind === "resolved";
|
|
20455
|
-
const { isAuthenticated, user } = (0,
|
|
20626
|
+
const { isAuthenticated, user } = (0, import_hooks61.useAggAuthContext)();
|
|
20456
20627
|
const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
|
|
20457
20628
|
const isPaperMode = resolvedExecutionMode === "paper";
|
|
20458
|
-
const liveBalanceState = (0,
|
|
20459
|
-
const paperBalancesQuery = (0,
|
|
20629
|
+
const liveBalanceState = (0, import_hooks61.useAggBalanceState)();
|
|
20630
|
+
const paperBalancesQuery = (0, import_hooks61.useManagedBalances)({
|
|
20460
20631
|
enabled: Boolean(isAuthenticated && isPaperMode),
|
|
20461
20632
|
mode: "paper"
|
|
20462
20633
|
});
|
|
@@ -20476,22 +20647,22 @@ var PlaceOrder = ({
|
|
|
20476
20647
|
const liveAvailableBalance = (_i = liveBalanceState.availableBalance) != null ? _i : liveBalanceState.totalBalance;
|
|
20477
20648
|
const totalBalance = isPaperMode ? paperTotalBalance : liveAvailableBalance;
|
|
20478
20649
|
const isBalanceLoading = isPaperMode ? paperBalancesQuery.isLoading : liveBalanceState.isLoading;
|
|
20479
|
-
const executeManaged = (0,
|
|
20480
|
-
const placeLimitOrder = (0,
|
|
20481
|
-
const aggClient = (0,
|
|
20482
|
-
const queryClient = (0,
|
|
20483
|
-
const { disabledVenues, isLoading: isAppConfigLoading } = (0,
|
|
20484
|
-
const { data: kalshiKeyStatus, refetch: refetchKalshiKeyStatus } = (0,
|
|
20650
|
+
const executeManaged = (0, import_hooks61.useExecuteManaged)();
|
|
20651
|
+
const placeLimitOrder = (0, import_hooks61.usePlaceLimitOrder)();
|
|
20652
|
+
const aggClient = (0, import_hooks61.useAggClient)();
|
|
20653
|
+
const queryClient = (0, import_hooks61.useQueryClient)();
|
|
20654
|
+
const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks61.useAppConfig)();
|
|
20655
|
+
const { data: kalshiKeyStatus, refetch: refetchKalshiKeyStatus } = (0, import_hooks61.useVenueKeyStatus)(
|
|
20485
20656
|
import_sdk22.Venue.kalshi,
|
|
20486
20657
|
isAuthenticated
|
|
20487
20658
|
);
|
|
20488
20659
|
const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0, import_react36.useState)(false);
|
|
20489
20660
|
const [isFundKalshiModalOpen, setIsFundKalshiModalOpen] = (0, import_react36.useState)(false);
|
|
20490
|
-
const livePrices = (0,
|
|
20661
|
+
const livePrices = (0, import_hooks61.useLiveOutcomePrices)(
|
|
20491
20662
|
scopedSelectedMarket ? [scopedSelectedMarket] : void 0
|
|
20492
20663
|
);
|
|
20493
|
-
const wsBestPrices = (0,
|
|
20494
|
-
const fetchedClusterMidpointResult = (0,
|
|
20664
|
+
const wsBestPrices = (0, import_hooks61.useLiveBestPrices)(scopedSelectedMarket ? [scopedSelectedMarket] : void 0);
|
|
20665
|
+
const fetchedClusterMidpointResult = (0, import_hooks61.useMidpoints)(
|
|
20495
20666
|
midpointsResult ? [] : scopedSelectedMarket ? [scopedSelectedMarket] : []
|
|
20496
20667
|
);
|
|
20497
20668
|
const clusterMidpointResult = midpointsResult != null ? midpointsResult : fetchedClusterMidpointResult;
|
|
@@ -20499,12 +20670,12 @@ var PlaceOrder = ({
|
|
|
20499
20670
|
const clusterBestMidpoint = clusterMidpointResult.bestMidpoint;
|
|
20500
20671
|
const clusterBestPricesRest = clusterMidpointResult.bestPrices;
|
|
20501
20672
|
const clusterBestPrices = (0, import_react36.useMemo)(
|
|
20502
|
-
() => (0,
|
|
20673
|
+
() => (0, import_hooks61.mergeBestPricesPreferringLive)(clusterBestPricesRest, wsBestPrices),
|
|
20503
20674
|
[clusterBestPricesRest, wsBestPrices]
|
|
20504
20675
|
);
|
|
20505
20676
|
const [internalTab, setInternalTab] = (0, import_react36.useState)("buy");
|
|
20506
20677
|
const [executionType, setExecutionType] = (0, import_react36.useState)("market");
|
|
20507
|
-
const [
|
|
20678
|
+
const [selectedLimitVenue, setSelectedLimitVenue] = (0, import_react36.useState)(null);
|
|
20508
20679
|
const [limitPrice, setLimitPrice] = (0, import_react36.useState)(0.5);
|
|
20509
20680
|
const [limitPriceInputValue, setLimitPriceInputValue] = (0, import_react36.useState)(formatLimitPriceInputValue(0.5));
|
|
20510
20681
|
const [limitPriceInputError, setLimitPriceInputError] = (0, import_react36.useState)(null);
|
|
@@ -20554,7 +20725,6 @@ var PlaceOrder = ({
|
|
|
20554
20725
|
]);
|
|
20555
20726
|
const buyTabRef = (0, import_react36.useRef)(null);
|
|
20556
20727
|
const sellTabRef = (0, import_react36.useRef)(null);
|
|
20557
|
-
const executionTypeTriggerRef = (0, import_react36.useRef)(null);
|
|
20558
20728
|
const expirationTriggerRef = (0, import_react36.useRef)(null);
|
|
20559
20729
|
const limitPriceInitializedForOutcomeRef = (0, import_react36.useRef)(void 0);
|
|
20560
20730
|
const expirationOptionRefs = (0, import_react36.useRef)([]);
|
|
@@ -20590,16 +20760,37 @@ var PlaceOrder = ({
|
|
|
20590
20760
|
scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id,
|
|
20591
20761
|
scopedSelectedOutcomeId
|
|
20592
20762
|
]);
|
|
20593
|
-
const debouncedAmount = (0,
|
|
20763
|
+
const debouncedAmount = (0, import_hooks61.useDebouncedValue)(internalAmount, 300);
|
|
20594
20764
|
const isQuoteInputEditing = internalAmount !== debouncedAmount;
|
|
20595
20765
|
const isLimitOrder = showLimitOrders && executionType === "limit";
|
|
20596
20766
|
const isSell = (0, import_react36.useMemo)(() => internalTab === "sell", [internalTab]);
|
|
20767
|
+
const limitVenueOptions = (0, import_react36.useMemo)(
|
|
20768
|
+
() => {
|
|
20769
|
+
var _a2;
|
|
20770
|
+
return buildLimitOrderVenueOptions({
|
|
20771
|
+
currentPrices: (_a2 = clusterMidpointResult.currentMidpointsByOutcomeId) != null ? _a2 : clusterMidpointResult.prices,
|
|
20772
|
+
livePrices,
|
|
20773
|
+
market: scopedSelectedMarket,
|
|
20774
|
+
selectedOutcomeId: scopedSelectedOutcomeId
|
|
20775
|
+
});
|
|
20776
|
+
},
|
|
20777
|
+
[clusterMidpointResult, livePrices, scopedSelectedMarket, scopedSelectedOutcomeId]
|
|
20778
|
+
);
|
|
20779
|
+
const visibleLimitVenueOptions = (0, import_react36.useMemo)(() => {
|
|
20780
|
+
return limitVenueOptions.filter((option) => {
|
|
20781
|
+
return (0, import_hooks61.getVenueAvailabilityState)({
|
|
20782
|
+
venueId: option.venue,
|
|
20783
|
+
disabledVenues,
|
|
20784
|
+
isConfigLoading: isAppConfigLoading
|
|
20785
|
+
}) !== "hidden";
|
|
20786
|
+
});
|
|
20787
|
+
}, [disabledVenues, isAppConfigLoading, limitVenueOptions]);
|
|
20597
20788
|
const {
|
|
20598
20789
|
positions: executionPositions,
|
|
20599
20790
|
dataUpdatedAt: executionPositionsUpdatedAt,
|
|
20600
20791
|
isLoading: isExecutionPositionsLoading,
|
|
20601
20792
|
isFetching: isExecutionPositionsFetching
|
|
20602
|
-
} = (0,
|
|
20793
|
+
} = (0, import_hooks61.useExecutionPositions)({
|
|
20603
20794
|
enabled: Boolean(isAuthenticated && isSell),
|
|
20604
20795
|
mode: isPaperMode ? "paper" : void 0
|
|
20605
20796
|
});
|
|
@@ -20614,9 +20805,70 @@ var PlaceOrder = ({
|
|
|
20614
20805
|
isEditing: isQuoteInputEditing,
|
|
20615
20806
|
isMarketOpen: resolvedTradingState.kind === "open" && !isEndedWithoutKnownWinner,
|
|
20616
20807
|
isPanelActive: isQuotePanelActive,
|
|
20617
|
-
isSubmitting: submissionProgressState != null || isBeforeActionPending || executeManaged.isPending
|
|
20808
|
+
isSubmitting: submissionProgressState != null || isBeforeActionPending || executeManaged.isPending || placeLimitOrder.isPending
|
|
20618
20809
|
};
|
|
20619
|
-
const
|
|
20810
|
+
const limitVenueQuoteRequests = (0, import_react36.useMemo)(
|
|
20811
|
+
() => visibleLimitVenueOptions.map((option) => ({
|
|
20812
|
+
venue: option.venue,
|
|
20813
|
+
venueMarketOutcomeId: option.venueMarketOutcomeId
|
|
20814
|
+
})),
|
|
20815
|
+
[visibleLimitVenueOptions]
|
|
20816
|
+
);
|
|
20817
|
+
const hasValidLimitVenueQuoteAmount = debouncedAmount > 0;
|
|
20818
|
+
const isLimitVenueQuoteEnabled = isLimitOrder && isQuotePanelActive && !isEndedWithoutKnownWinner && !submissionProgressState && !isBeforeActionPending && !placeLimitOrder.isPending && hasValidLimitVenueQuoteAmount && orderEligibility.canPlaceOrder && (!isSell || sellFilledForOutcomeId === scopedSelectedOutcomeId && !isQuoteInputEditing);
|
|
20819
|
+
const limitVenueQuotes = (0, import_hooks61.useLimitOrderVenueQuotes)({
|
|
20820
|
+
requests: limitVenueQuoteRequests,
|
|
20821
|
+
tradeSide: internalTab,
|
|
20822
|
+
amount: debouncedAmount,
|
|
20823
|
+
marketId: scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id,
|
|
20824
|
+
accountId: (_k = user == null ? void 0 : user.id) != null ? _k : null,
|
|
20825
|
+
chainBalances: chainBalancesOverride,
|
|
20826
|
+
mode: isPaperMode ? "paper" : void 0,
|
|
20827
|
+
slipCapBps: 1e6,
|
|
20828
|
+
enabled: isLimitVenueQuoteEnabled,
|
|
20829
|
+
refreshContext: smartRouteRefreshContext
|
|
20830
|
+
});
|
|
20831
|
+
const limitVenueQuoteByVenue = (0, import_react36.useMemo)(
|
|
20832
|
+
() => new Map(limitVenueQuotes.quotes.map((quote) => [quote.request.venue, quote])),
|
|
20833
|
+
[limitVenueQuotes.quotes]
|
|
20834
|
+
);
|
|
20835
|
+
const geoBlockedLimitVenues = (0, import_react36.useMemo)(() => {
|
|
20836
|
+
var _a2;
|
|
20837
|
+
const venues = /* @__PURE__ */ new Set();
|
|
20838
|
+
for (const quote of limitVenueQuotes.quotes) {
|
|
20839
|
+
if (extractGeoBlockedVenues((_a2 = quote.data) == null ? void 0 : _a2.warnings).has(quote.request.venue)) {
|
|
20840
|
+
venues.add(quote.request.venue);
|
|
20841
|
+
}
|
|
20842
|
+
}
|
|
20843
|
+
return venues;
|
|
20844
|
+
}, [limitVenueQuotes.quotes]);
|
|
20845
|
+
const availableLimitVenueOptions = (0, import_react36.useMemo)(() => {
|
|
20846
|
+
return visibleLimitVenueOptions.filter((option) => {
|
|
20847
|
+
return !geoBlockedLimitVenues.has(option.venue) && (0, import_hooks61.getVenueAvailabilityState)({
|
|
20848
|
+
venueId: option.venue,
|
|
20849
|
+
disabledVenues,
|
|
20850
|
+
isConfigLoading: isAppConfigLoading
|
|
20851
|
+
}) === "available";
|
|
20852
|
+
});
|
|
20853
|
+
}, [disabledVenues, geoBlockedLimitVenues, isAppConfigLoading, visibleLimitVenueOptions]);
|
|
20854
|
+
const automaticLimitVenueOption = (0, import_react36.useMemo)(
|
|
20855
|
+
() => resolveAutomaticLimitOrderVenueOption(availableLimitVenueOptions, internalTab),
|
|
20856
|
+
[availableLimitVenueOptions, internalTab]
|
|
20857
|
+
);
|
|
20858
|
+
const selectedLimitVenueOption = (0, import_react36.useMemo)(() => {
|
|
20859
|
+
if (selectedLimitVenue) {
|
|
20860
|
+
const selectedOption = availableLimitVenueOptions.find(
|
|
20861
|
+
(option) => option.venue === selectedLimitVenue
|
|
20862
|
+
);
|
|
20863
|
+
if (selectedOption) return selectedOption;
|
|
20864
|
+
}
|
|
20865
|
+
return automaticLimitVenueOption;
|
|
20866
|
+
}, [automaticLimitVenueOption, availableLimitVenueOptions, selectedLimitVenue]);
|
|
20867
|
+
(0, import_react36.useEffect)(() => {
|
|
20868
|
+
if (!selectedLimitVenue || !geoBlockedLimitVenues.has(selectedLimitVenue)) return;
|
|
20869
|
+
setSelectedLimitVenue(null);
|
|
20870
|
+
}, [geoBlockedLimitVenues, selectedLimitVenue]);
|
|
20871
|
+
const smartRoute = (0, import_hooks61.useSmartRoute)(__spreadProps(__spreadValues({
|
|
20620
20872
|
venueMarketOutcomeId: scopedSelectedOutcomeId,
|
|
20621
20873
|
maxSpend: isSell ? void 0 : debouncedAmount,
|
|
20622
20874
|
sellShares: isSell ? debouncedAmount : void 0,
|
|
@@ -20631,7 +20883,7 @@ var PlaceOrder = ({
|
|
|
20631
20883
|
enabled: isSmartRouteEnabled
|
|
20632
20884
|
}, isSell ? {
|
|
20633
20885
|
sellCacheScope: {
|
|
20634
|
-
accountId: (
|
|
20886
|
+
accountId: (_l = user == null ? void 0 : user.id) != null ? _l : null,
|
|
20635
20887
|
positionVersion: executionPositionsUpdatedAt
|
|
20636
20888
|
}
|
|
20637
20889
|
} : {}), {
|
|
@@ -20685,14 +20937,14 @@ var PlaceOrder = ({
|
|
|
20685
20937
|
},
|
|
20686
20938
|
[debouncedAmount, isSell, scopedSelectedOutcomeId, smartRoute.data, smartRoute.isLoading]
|
|
20687
20939
|
);
|
|
20688
|
-
const venueSellQuotes = (0,
|
|
20940
|
+
const venueSellQuotes = (0, import_hooks61.useVenueSellQuotes)({
|
|
20689
20941
|
venueMarketOutcomeId: scopedSelectedOutcomeId,
|
|
20690
|
-
accountId: (
|
|
20942
|
+
accountId: (_m = user == null ? void 0 : user.id) != null ? _m : null,
|
|
20691
20943
|
positionVersion: executionPositionsUpdatedAt,
|
|
20692
20944
|
requests: venueSellQuoteRequests,
|
|
20693
20945
|
mode: isPaperMode ? "paper" : void 0,
|
|
20694
20946
|
slipCapBps: 1e6,
|
|
20695
|
-
enabled: isSell && isSmartRouteEnabled && !smartRoute.isLoading && ((
|
|
20947
|
+
enabled: isSell && isSmartRouteEnabled && !smartRoute.isLoading && ((_n = smartRoute.data) == null ? void 0 : _n.venueMarketOutcomeId) === scopedSelectedOutcomeId,
|
|
20696
20948
|
refreshContext: smartRouteRefreshContext
|
|
20697
20949
|
});
|
|
20698
20950
|
const currentSellableShares = (0, import_react36.useMemo)(() => {
|
|
@@ -20727,13 +20979,13 @@ var PlaceOrder = ({
|
|
|
20727
20979
|
isSell,
|
|
20728
20980
|
scopedSelectedMarket,
|
|
20729
20981
|
scopedSelectedOutcome,
|
|
20730
|
-
(
|
|
20982
|
+
(_p = (_o = smartRoute.data) == null ? void 0 : _o.positionAvailability) == null ? void 0 : _p.totalSellableShares
|
|
20731
20983
|
]);
|
|
20732
20984
|
const maxSellableShares = (0, import_react36.useMemo)(
|
|
20733
20985
|
() => floorToDecimals(currentSellableShares, SELL_SHARE_INPUT_DECIMALS),
|
|
20734
20986
|
[currentSellableShares]
|
|
20735
20987
|
);
|
|
20736
|
-
const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((
|
|
20988
|
+
const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((_r = (_q = smartRoute.data) == null ? void 0 : _q.positionAvailability) == null ? void 0 : _r.totalSellableShares) === "number") && (isExecutionPositionsLoading || isExecutionPositionsFetching);
|
|
20737
20989
|
const displayedCurrentSellableShares = (0, import_react36.useMemo)(() => {
|
|
20738
20990
|
if (!Number.isFinite(currentSellableShares) || currentSellableShares <= 0) return 0;
|
|
20739
20991
|
return floorToDecimals(currentSellableShares, SELL_SHARE_DISPLAY_DECIMALS);
|
|
@@ -20743,7 +20995,7 @@ var PlaceOrder = ({
|
|
|
20743
20995
|
[maxSellableShares]
|
|
20744
20996
|
);
|
|
20745
20997
|
const isAtMaxSellableShares = isSell && maxSellableShares > 0 && Math.abs(internalAmount - maxSellableShares) < 1e-9;
|
|
20746
|
-
const isSellAmountAboveAvailability = isSell && ((
|
|
20998
|
+
const isSellAmountAboveAvailability = isSell && ((_s = smartRoute.data) == null ? void 0 : _s.venueMarketOutcomeId) === scopedSelectedOutcomeId && typeof ((_t = smartRoute.data.positionAvailability) == null ? void 0 : _t.totalSellableShares) === "number" && internalAmount > maxSellableShares;
|
|
20747
20999
|
(0, import_react36.useEffect)(() => {
|
|
20748
21000
|
if (submissionProgressState != null) return;
|
|
20749
21001
|
if (!isSell || isCurrentSellableSharesLoading) return;
|
|
@@ -20779,8 +21031,8 @@ var PlaceOrder = ({
|
|
|
20779
21031
|
isSell,
|
|
20780
21032
|
onAmountChange,
|
|
20781
21033
|
scopedSelectedOutcomeId,
|
|
20782
|
-
(
|
|
20783
|
-
(
|
|
21034
|
+
(_v = (_u = smartRoute.data) == null ? void 0 : _u.positionAvailability) == null ? void 0 : _v.totalSellableShares,
|
|
21035
|
+
(_w = smartRoute.data) == null ? void 0 : _w.venueMarketOutcomeId,
|
|
20784
21036
|
submissionProgressState
|
|
20785
21037
|
]);
|
|
20786
21038
|
const routeCards = (0, import_react36.useMemo)(() => {
|
|
@@ -20818,7 +21070,7 @@ var PlaceOrder = ({
|
|
|
20818
21070
|
return selectedRouteCardId;
|
|
20819
21071
|
}
|
|
20820
21072
|
return resolveDefaultRouteCardId(routeCards, isSell ? void 0 : (_a2 = smartRoute.data) == null ? void 0 : _a2.status);
|
|
20821
|
-
}, [routeCards, selectedRouteCardId, isSell, (
|
|
21073
|
+
}, [routeCards, selectedRouteCardId, isSell, (_x = smartRoute.data) == null ? void 0 : _x.status]);
|
|
20822
21074
|
(0, import_react36.useEffect)(() => {
|
|
20823
21075
|
if (routeCards.length === 0) {
|
|
20824
21076
|
setSelectedRouteCardId(null);
|
|
@@ -20841,7 +21093,6 @@ var PlaceOrder = ({
|
|
|
20841
21093
|
(0, import_react36.useEffect)(() => {
|
|
20842
21094
|
if (showLimitOrders || executionType !== "limit") return;
|
|
20843
21095
|
setExecutionType("market");
|
|
20844
|
-
setIsExecutionTypeMenuOpen(false);
|
|
20845
21096
|
setIsLimitExpirationPickerOpen(false);
|
|
20846
21097
|
}, [executionType, showLimitOrders]);
|
|
20847
21098
|
(0, import_react36.useEffect)(() => {
|
|
@@ -20857,15 +21108,19 @@ var PlaceOrder = ({
|
|
|
20857
21108
|
setLimitPriceInputValue(formatLimitPriceInputValue(nextLimitPrice));
|
|
20858
21109
|
setLimitPriceInputError(null);
|
|
20859
21110
|
}, [executionType, scopedSelectedOutcomeId, selectedOutcomeDisplayPrice]);
|
|
21111
|
+
(0, import_react36.useEffect)(() => {
|
|
21112
|
+
setSelectedLimitVenue(null);
|
|
21113
|
+
}, [scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id, scopedSelectedOutcomeId]);
|
|
20860
21114
|
const orderedRouteCards = routeCards;
|
|
20861
|
-
const selectedRouteCard = (
|
|
21115
|
+
const selectedRouteCard = (_z = (_y = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _y : orderedRouteCards[0]) != null ? _z : null;
|
|
20862
21116
|
const isKalshiRoute = (0, import_react36.useMemo)(() => {
|
|
21117
|
+
if (isLimitOrder) return (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) === import_sdk22.Venue.kalshi;
|
|
20863
21118
|
if (selectedRouteCard) {
|
|
20864
21119
|
return selectedRouteCard.venue === "kalshi" || selectedRouteCard.quoteData.fills.some((f) => f.venue === "kalshi");
|
|
20865
21120
|
}
|
|
20866
21121
|
return (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === "kalshi";
|
|
20867
|
-
}, [selectedRouteCard, scopedSelectedMarket]);
|
|
20868
|
-
const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (
|
|
21122
|
+
}, [isLimitOrder, selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue, selectedRouteCard, scopedSelectedMarket]);
|
|
21123
|
+
const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (_A = liveBalanceState.kalshiBalance) != null ? _A : 0 : liveAvailableBalance;
|
|
20869
21124
|
const legacyKalshiAccount = (0, import_react36.useMemo)(
|
|
20870
21125
|
() => {
|
|
20871
21126
|
var _a2;
|
|
@@ -20873,10 +21128,10 @@ var PlaceOrder = ({
|
|
|
20873
21128
|
},
|
|
20874
21129
|
[user == null ? void 0 : user.venueAccounts]
|
|
20875
21130
|
);
|
|
20876
|
-
const isKalshiAccountActive = (
|
|
20877
|
-
const isKalshiVerified = ((
|
|
21131
|
+
const isKalshiAccountActive = (_B = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.connected) != null ? _B : (legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.status) === "active";
|
|
21132
|
+
const isKalshiVerified = ((_C = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.kycStatus) != null ? _C : legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.kycStatus) === "verified";
|
|
20878
21133
|
const hasKalshiConnectionState = kalshiKeyStatus !== void 0 || (user == null ? void 0 : user.venueAccounts) != null;
|
|
20879
|
-
const isKalshiAvailable = (0,
|
|
21134
|
+
const isKalshiAvailable = (0, import_hooks61.getVenueAvailabilityState)({
|
|
20880
21135
|
venueId: "kalshi",
|
|
20881
21136
|
disabledVenues,
|
|
20882
21137
|
isConfigLoading: isAppConfigLoading
|
|
@@ -20901,7 +21156,7 @@ var PlaceOrder = ({
|
|
|
20901
21156
|
[aggClient, onConnectKalshi, refetchKalshiKeyStatus]
|
|
20902
21157
|
);
|
|
20903
21158
|
const needsKycVerification = isAuthenticated && hasKalshiConnectionState && isKalshiRoute && isKalshiAccountActive && !isKalshiVerified;
|
|
20904
|
-
const verifyKalshiConnectionLabel = (
|
|
21159
|
+
const verifyKalshiConnectionLabel = (_G = (_F = (_E = (_D = labels.onboarding) == null ? void 0 : _D.connectKalshiModal) == null ? void 0 : _E.actions) == null ? void 0 : _F.verifyConnection) != null ? _G : tradingLabels.kycRequired;
|
|
20905
21160
|
const handleRouteCardSelect = (0, import_react36.useCallback)(
|
|
20906
21161
|
(cardId) => {
|
|
20907
21162
|
if (cardId === resolvedSelectedRouteCardId) {
|
|
@@ -20915,16 +21170,16 @@ var PlaceOrder = ({
|
|
|
20915
21170
|
},
|
|
20916
21171
|
[resolvedSelectedRouteCardId, routeCards]
|
|
20917
21172
|
);
|
|
20918
|
-
const executionProgress = (0,
|
|
20919
|
-
orderIds: (
|
|
20920
|
-
quoteId: (
|
|
21173
|
+
const executionProgress = (0, import_hooks61.useExecutionProgress)({
|
|
21174
|
+
orderIds: (_H = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) != null ? _H : null,
|
|
21175
|
+
quoteId: (_I = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _I : null,
|
|
20921
21176
|
mode: isPaperMode ? "paper" : void 0,
|
|
20922
|
-
enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((
|
|
21177
|
+
enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((_J = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _J.length)
|
|
20923
21178
|
});
|
|
20924
|
-
const selectedOutcomeLabel = (
|
|
20925
|
-
const headerImage = (
|
|
20926
|
-
const headerTitle = (
|
|
20927
|
-
const headerSubtitle = (
|
|
21179
|
+
const selectedOutcomeLabel = (_M = (_L = (_K = outcomes.find((outcome) => outcome.id === scopedSelectedOutcomeId)) == null ? void 0 : _K.label) != null ? _L : scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.label) != null ? _M : "";
|
|
21180
|
+
const headerImage = (_O = (_N = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.image) != null ? _N : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.image) != null ? _O : null;
|
|
21181
|
+
const headerTitle = (_Q = (_P = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _P : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _Q : "";
|
|
21182
|
+
const headerSubtitle = (_R = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _R : "";
|
|
20928
21183
|
const buildExecutionSummary = (0, import_react36.useCallback)(
|
|
20929
21184
|
(quoteData, executionVenue, orderId, partialFillSummary) => {
|
|
20930
21185
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
@@ -21190,8 +21445,8 @@ var PlaceOrder = ({
|
|
|
21190
21445
|
}
|
|
21191
21446
|
if (submissionProgressState.phase === "success" && submissionProgressState.summary) {
|
|
21192
21447
|
emitTerminalOrderNotifications();
|
|
21193
|
-
(0,
|
|
21194
|
-
(0,
|
|
21448
|
+
(0, import_hooks61.invalidateBalanceQueries)(queryClient);
|
|
21449
|
+
(0, import_hooks61.invalidatePositionQueries)(queryClient);
|
|
21195
21450
|
if (debugStore && debugAttemptId) {
|
|
21196
21451
|
debugStore.updateAttempt(debugAttemptId, {
|
|
21197
21452
|
status: "succeeded",
|
|
@@ -21222,19 +21477,19 @@ var PlaceOrder = ({
|
|
|
21222
21477
|
queryClient,
|
|
21223
21478
|
submissionProgressState
|
|
21224
21479
|
]);
|
|
21225
|
-
const activeQuoteData = (
|
|
21226
|
-
const
|
|
21480
|
+
const activeQuoteData = isLimitOrder ? null : (_T = (_S = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _S : smartRoute.data) != null ? _T : null;
|
|
21481
|
+
const visibleMarketRouteCards = orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT && !isRoutesExpanded ? orderedRouteCards.slice(0, PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT) : orderedRouteCards;
|
|
21227
21482
|
const hasEnteredAmount = internalAmount > 0;
|
|
21228
21483
|
const isQuoteLoading = !isLimitOrder && hasEnteredAmount && (smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
|
|
21229
21484
|
const routeLoadingMessage = isQuoteLoading ? smartRoute.loadingReason === "updating-route" ? tradingLabels.updatingRoute : smartRoute.loadingReason === "refreshing-quotes" ? tradingLabels.refreshingQuotes : tradingLabels.findingBestOdds : null;
|
|
21230
|
-
const selectedRouteFills = (
|
|
21485
|
+
const selectedRouteFills = (_U = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills) != null ? _U : [];
|
|
21231
21486
|
const isKalshiOnlyRoute = isKalshiRoute && ((selectedRouteCard == null ? void 0 : selectedRouteCard.venue) === import_sdk22.Venue.kalshi || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue === import_sdk22.Venue.kalshi));
|
|
21232
21487
|
const isOnchainOnlyRoute = !isKalshiRoute || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue !== import_sdk22.Venue.kalshi);
|
|
21233
21488
|
const kalshiRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue === import_sdk22.Venue.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
|
|
21234
21489
|
const onchainRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue !== import_sdk22.Venue.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
|
|
21235
21490
|
const resolvedKalshiRequiredAmount = isKalshiOnlyRoute || isKalshiRoute && selectedRouteFills.length === 0 ? internalAmount : kalshiRequiredAmount;
|
|
21236
21491
|
const resolvedOnchainRequiredAmount = isOnchainOnlyRoute || !isKalshiRoute && selectedRouteFills.length === 0 ? internalAmount : onchainRequiredAmount;
|
|
21237
|
-
const isKalshiBalanceInsufficient = !isPaperMode && isKalshiRoute && resolvedKalshiRequiredAmount > ((
|
|
21492
|
+
const isKalshiBalanceInsufficient = !isPaperMode && isKalshiRoute && resolvedKalshiRequiredAmount > ((_V = liveBalanceState.kalshiBalance) != null ? _V : 0);
|
|
21238
21493
|
const isOnchainBalanceInsufficient = resolvedOnchainRequiredAmount > liveAvailableBalance;
|
|
21239
21494
|
const isInsufficientBalance = !isSell && isAuthenticated && hasEnteredAmount && !isBalanceLoading && (isLimitOrder ? internalAmount > totalBalance : isPaperMode ? internalAmount > paperTotalBalance : isKalshiBalanceInsufficient || isOnchainBalanceInsufficient);
|
|
21240
21495
|
const isQuoteInsufficientBalance = !isLimitOrder && (activeQuoteData == null ? void 0 : activeQuoteData.status) === "insufficient_balance";
|
|
@@ -21328,9 +21583,9 @@ var PlaceOrder = ({
|
|
|
21328
21583
|
}
|
|
21329
21584
|
return (_d2 = selectedRouteCard.hint) != null ? _d2 : "";
|
|
21330
21585
|
}, [selectedRouteCard, tradingLabels]);
|
|
21331
|
-
const displayedToWinValue = (
|
|
21586
|
+
const displayedToWinValue = (_W = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _W : 0;
|
|
21332
21587
|
const limitOrderPayload = (0, import_react36.useMemo)(() => {
|
|
21333
|
-
if (!
|
|
21588
|
+
if (!selectedLimitVenueOption || internalAmount <= 0) return null;
|
|
21334
21589
|
if (limitPriceInputError) return null;
|
|
21335
21590
|
const expirationDate = resolveLimitExpirationDate({
|
|
21336
21591
|
expirationType: limitExpirationType,
|
|
@@ -21346,8 +21601,8 @@ var PlaceOrder = ({
|
|
|
21346
21601
|
});
|
|
21347
21602
|
const expiresAt = expirationDate ? serializeLimitOrderExpiration(expirationDate) : void 0;
|
|
21348
21603
|
return __spreadValues({
|
|
21349
|
-
venue:
|
|
21350
|
-
venueMarketOutcomeId:
|
|
21604
|
+
venue: selectedLimitVenueOption.venue,
|
|
21605
|
+
venueMarketOutcomeId: selectedLimitVenueOption.venueMarketOutcomeId,
|
|
21351
21606
|
side: internalTab,
|
|
21352
21607
|
limitPriceRaw,
|
|
21353
21608
|
sizeRaw,
|
|
@@ -21361,8 +21616,7 @@ var PlaceOrder = ({
|
|
|
21361
21616
|
limitExpirationType,
|
|
21362
21617
|
limitPrice,
|
|
21363
21618
|
limitPriceInputError,
|
|
21364
|
-
|
|
21365
|
-
scopedSelectedOutcomeId
|
|
21619
|
+
selectedLimitVenueOption
|
|
21366
21620
|
]);
|
|
21367
21621
|
const resolvedLimitExpirationDraftDate = (0, import_react36.useMemo)(() => {
|
|
21368
21622
|
return resolveLimitExpirationDate({
|
|
@@ -21405,11 +21659,70 @@ var PlaceOrder = ({
|
|
|
21405
21659
|
)
|
|
21406
21660
|
) / Number(LIMIT_ORDER_RAW_SCALE);
|
|
21407
21661
|
}, [internalTab, limitOrderPayload]);
|
|
21662
|
+
const limitRouteCards = (0, import_react36.useMemo)(() => {
|
|
21663
|
+
return visibleLimitVenueOptions.map((option) => {
|
|
21664
|
+
var _a2, _b2;
|
|
21665
|
+
const availabilityState = (0, import_hooks61.getVenueAvailabilityState)({
|
|
21666
|
+
venueId: option.venue,
|
|
21667
|
+
disabledVenues,
|
|
21668
|
+
isConfigLoading: isAppConfigLoading
|
|
21669
|
+
});
|
|
21670
|
+
const isGeoBlocked = geoBlockedLimitVenues.has(option.venue);
|
|
21671
|
+
const isUnavailable = isTradingBlocked || isGeoBlocked || availabilityState !== "available";
|
|
21672
|
+
const currentPriceLabel = option.currentPrice == null ? "\u2014" : formatProbabilityCents(option.currentPrice, formatPrice);
|
|
21673
|
+
const totalFees = getSmartRouteTotalFees(
|
|
21674
|
+
(_b2 = (_a2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _a2.data) == null ? void 0 : _b2.feeBreakdown
|
|
21675
|
+
);
|
|
21676
|
+
const feeLabel = totalFees == null ? void 0 : formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
21677
|
+
return {
|
|
21678
|
+
id: `limit-venue-${option.venue}-${option.venueMarketOutcomeId}`,
|
|
21679
|
+
hint: isGeoBlocked ? tradingLabels.venueUnavailableInRegion : tradingLabels.limitRoutingCurrentPrice(currentPriceLabel, feeLabel),
|
|
21680
|
+
isUnavailable,
|
|
21681
|
+
kind: "venue",
|
|
21682
|
+
label: getTradingVenueLabel(option.venue),
|
|
21683
|
+
numericValue: displayedLimitToWinValue,
|
|
21684
|
+
value: formatUsd(displayedLimitToWinValue, {
|
|
21685
|
+
maximumFractionDigits: 2,
|
|
21686
|
+
minimumFractionDigits: 2
|
|
21687
|
+
}),
|
|
21688
|
+
venue: option.venue
|
|
21689
|
+
};
|
|
21690
|
+
});
|
|
21691
|
+
}, [
|
|
21692
|
+
disabledVenues,
|
|
21693
|
+
displayedLimitToWinValue,
|
|
21694
|
+
formatPrice,
|
|
21695
|
+
geoBlockedLimitVenues,
|
|
21696
|
+
isAppConfigLoading,
|
|
21697
|
+
isTradingBlocked,
|
|
21698
|
+
limitVenueQuoteByVenue,
|
|
21699
|
+
tradingLabels,
|
|
21700
|
+
visibleLimitVenueOptions
|
|
21701
|
+
]);
|
|
21702
|
+
const limitVenueOptionByCardId = (0, import_react36.useMemo)(() => {
|
|
21703
|
+
return new Map(
|
|
21704
|
+
visibleLimitVenueOptions.map((option) => [
|
|
21705
|
+
`limit-venue-${option.venue}-${option.venueMarketOutcomeId}`,
|
|
21706
|
+
option
|
|
21707
|
+
])
|
|
21708
|
+
);
|
|
21709
|
+
}, [visibleLimitVenueOptions]);
|
|
21710
|
+
const activeRouteCards = isLimitOrder ? limitRouteCards : visibleMarketRouteCards;
|
|
21711
|
+
const activeRouteCardCount = isLimitOrder ? limitRouteCards.length : orderedRouteCards.length;
|
|
21712
|
+
const handleActiveRouteCardSelect = (cardId) => {
|
|
21713
|
+
if (!isLimitOrder) {
|
|
21714
|
+
handleRouteCardSelect(cardId);
|
|
21715
|
+
return;
|
|
21716
|
+
}
|
|
21717
|
+
const option = limitVenueOptionByCardId.get(cardId);
|
|
21718
|
+
if (!option) return;
|
|
21719
|
+
setSelectedLimitVenue(option.venue);
|
|
21720
|
+
};
|
|
21408
21721
|
const displayedLimitToWinHint = formatLimitPriceLabel(limitPrice);
|
|
21409
21722
|
const activeFeeBreakdown = activeQuoteData == null ? void 0 : activeQuoteData.feeBreakdown;
|
|
21410
21723
|
const estimatedFeesValue = (0, import_react36.useMemo)(() => {
|
|
21411
|
-
|
|
21412
|
-
|
|
21724
|
+
const totalFees = getSmartRouteTotalFees(activeFeeBreakdown);
|
|
21725
|
+
if (totalFees == null) return null;
|
|
21413
21726
|
return formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
21414
21727
|
}, [activeFeeBreakdown]);
|
|
21415
21728
|
const feeBreakdownRows = (0, import_react36.useMemo)(() => {
|
|
@@ -21447,13 +21760,15 @@ var PlaceOrder = ({
|
|
|
21447
21760
|
];
|
|
21448
21761
|
}, [activeFeeBreakdown, tradingLabels]);
|
|
21449
21762
|
const isActionLoading = isPrimaryActionLoading || executeManaged.isPending || placeLimitOrder.isPending || isBeforeActionPending;
|
|
21450
|
-
const
|
|
21763
|
+
const selectedLimitRouteCardId = selectedLimitVenueOption ? `limit-venue-${selectedLimitVenueOption.venue}-${selectedLimitVenueOption.venueMarketOutcomeId}` : null;
|
|
21764
|
+
const selectedLimitRouteCard = selectedLimitRouteCardId ? (_X = limitRouteCards.find((card) => card.id === selectedLimitRouteCardId)) != null ? _X : null : null;
|
|
21765
|
+
const selectedRouteGeoBlocked = isLimitOrder ? (_Y = selectedLimitRouteCard == null ? void 0 : selectedLimitRouteCard.isUnavailable) != null ? _Y : false : (_Z = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _Z : false;
|
|
21451
21766
|
const geoBlockedVenuesFromWarnings = (0, import_react36.useMemo)(
|
|
21452
21767
|
() => {
|
|
21453
21768
|
var _a2;
|
|
21454
21769
|
return extractGeoBlockedVenues((_a2 = smartRoute.data) == null ? void 0 : _a2.warnings);
|
|
21455
21770
|
},
|
|
21456
|
-
[(
|
|
21771
|
+
[(__ = smartRoute.data) == null ? void 0 : __.warnings]
|
|
21457
21772
|
);
|
|
21458
21773
|
const isPrimaryVenueGeoBlocked = (0, import_react36.useMemo)(() => {
|
|
21459
21774
|
var _a2, _b2;
|
|
@@ -21461,12 +21776,12 @@ var PlaceOrder = ({
|
|
|
21461
21776
|
const fills = (_b2 = (_a2 = selectedRouteCard.quoteData) == null ? void 0 : _a2.fills) != null ? _b2 : [];
|
|
21462
21777
|
return fills.length > 0 && fills.every((f) => geoBlockedVenuesFromWarnings.has(f.venue));
|
|
21463
21778
|
}, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
|
|
21464
|
-
const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked;
|
|
21779
|
+
const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked || isLimitOrder && limitRouteCards.length > 0 && limitRouteCards.every((card) => card.isUnavailable);
|
|
21465
21780
|
const shouldShowLowLiquidityWarning = !isQuoteInputEditing && !isQuoteLoading && (activeQuoteData == null ? void 0 : activeQuoteData.venueMarketOutcomeId) === scopedSelectedOutcomeId && hasLowLiquidityWarning(activeQuoteData.warnings);
|
|
21466
21781
|
const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
|
|
21467
21782
|
const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isQuoteInsufficientBalance || isSell && isQuoteInputEditing || isSellAmountAboveAvailability || isBelowMinimum || !isLimitOrder && isQuoteLoading || (isLimitOrder ? !limitOrderPayload : !selectedRouteCard || !selectedRouteCard.quoteData.quoteId) || selectedRouteGeoBlocked || !isAuthenticated || !isLimitOrder && quoteStatus !== void 0;
|
|
21468
|
-
const shouldShowSmartRouting =
|
|
21469
|
-
const shouldShowRouteToggle = !isQuoteLoading && orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
|
|
21783
|
+
const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (isLimitOrder ? limitRouteCards.length > 0 : orderedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
|
|
21784
|
+
const shouldShowRouteToggle = !isLimitOrder && !isQuoteLoading && orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
|
|
21470
21785
|
const handleReturnToOrderForm = (0, import_react36.useCallback)(() => {
|
|
21471
21786
|
const submittedSelection = submittedSelectionRef.current;
|
|
21472
21787
|
submittedSelectionRef.current = null;
|
|
@@ -22111,7 +22426,7 @@ var PlaceOrder = ({
|
|
|
22111
22426
|
PlaceOrderResolvedView,
|
|
22112
22427
|
{
|
|
22113
22428
|
tradingState: resolvedReadOnlyTradingState,
|
|
22114
|
-
resolutionTimestamp: (
|
|
22429
|
+
resolutionTimestamp: (_$ = resolvedEventTradingState.resolvesAt) != null ? _$ : resolvedReadOnlyTradingState.resolvesAt,
|
|
22115
22430
|
resolvedClaim,
|
|
22116
22431
|
classNames,
|
|
22117
22432
|
className,
|
|
@@ -22194,261 +22509,228 @@ var PlaceOrder = ({
|
|
|
22194
22509
|
tabItem.value
|
|
22195
22510
|
);
|
|
22196
22511
|
}) }),
|
|
22197
|
-
showLimitOrders ? /* @__PURE__ */ (0, import_jsx_runtime158.
|
|
22198
|
-
|
|
22512
|
+
showLimitOrders ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
22513
|
+
Select,
|
|
22199
22514
|
{
|
|
22200
|
-
|
|
22201
|
-
|
|
22202
|
-
|
|
22203
|
-
|
|
22204
|
-
|
|
22205
|
-
|
|
22206
|
-
|
|
22207
|
-
|
|
22208
|
-
|
|
22209
|
-
|
|
22210
|
-
|
|
22211
|
-
|
|
22212
|
-
|
|
22213
|
-
children: [
|
|
22214
|
-
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { children: isLimitOrder ? tradingLabels.orderTypeLimit : tradingLabels.orderTypeMarket }),
|
|
22215
|
-
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Icon, { name: "chevron-down", size: "small", className: "h-4 w-4", "aria-hidden": true })
|
|
22216
|
-
]
|
|
22217
|
-
}
|
|
22218
|
-
) }),
|
|
22219
|
-
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
22220
|
-
DropdownMenu.Portal,
|
|
22221
|
-
{
|
|
22222
|
-
container: resolvePlaceOrderPortalContainer(executionTypeTriggerRef.current),
|
|
22223
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
22224
|
-
DropdownMenu.Content,
|
|
22225
|
-
{
|
|
22226
|
-
align: "end",
|
|
22227
|
-
sideOffset: 8,
|
|
22228
|
-
className: "z-50 min-w-[140px] rounded-agg-lg border border-agg-separator bg-agg-secondary p-1 shadow-[0_8px_16px_rgba(0,0,0,0.12)]",
|
|
22229
|
-
children: [
|
|
22230
|
-
{ value: "market", label: tradingLabels.orderTypeMarket },
|
|
22231
|
-
{ value: "limit", label: tradingLabels.orderTypeLimit }
|
|
22232
|
-
].map((item) => /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
22233
|
-
DropdownMenu.Item,
|
|
22234
|
-
{
|
|
22235
|
-
className: cn(
|
|
22236
|
-
"cursor-pointer rounded-agg-sm px-3 py-2 text-agg-sm leading-agg-5 text-agg-foreground outline-none hover:bg-agg-secondary-hover focus:bg-agg-secondary-hover",
|
|
22237
|
-
executionType === item.value && "font-agg-bold text-agg-primary"
|
|
22238
|
-
),
|
|
22239
|
-
onSelect: () => handleExecutionTypeChange(item.value),
|
|
22240
|
-
children: item.label
|
|
22241
|
-
},
|
|
22242
|
-
item.value
|
|
22243
|
-
))
|
|
22244
|
-
}
|
|
22245
|
-
)
|
|
22246
|
-
}
|
|
22247
|
-
)
|
|
22248
|
-
]
|
|
22515
|
+
ariaLabel: tradingLabels.orderTypeAria,
|
|
22516
|
+
className: "mb-2",
|
|
22517
|
+
triggerClassName: "agg-order-type-trigger",
|
|
22518
|
+
items: [
|
|
22519
|
+
{ value: "market", label: tradingLabels.orderTypeMarket },
|
|
22520
|
+
{ value: "limit", label: tradingLabels.orderTypeLimit }
|
|
22521
|
+
],
|
|
22522
|
+
value: executionType,
|
|
22523
|
+
onChange: handleExecutionTypeChange,
|
|
22524
|
+
variant: "inline",
|
|
22525
|
+
openOnHover: true,
|
|
22526
|
+
contentAlign: "end",
|
|
22527
|
+
contentSideOffset: 4
|
|
22249
22528
|
}
|
|
22250
22529
|
) : null
|
|
22251
22530
|
]
|
|
22252
22531
|
}
|
|
22253
22532
|
),
|
|
22254
|
-
|
|
22255
|
-
|
|
22256
|
-
|
|
22257
|
-
|
|
22258
|
-
|
|
22259
|
-
|
|
22260
|
-
|
|
22261
|
-
|
|
22262
|
-
|
|
22263
|
-
|
|
22264
|
-
|
|
22265
|
-
|
|
22266
|
-
|
|
22267
|
-
|
|
22268
|
-
|
|
22269
|
-
|
|
22270
|
-
|
|
22271
|
-
|
|
22272
|
-
|
|
22273
|
-
|
|
22274
|
-
|
|
22275
|
-
|
|
22276
|
-
|
|
22277
|
-
|
|
22278
|
-
|
|
22279
|
-
|
|
22280
|
-
|
|
22281
|
-
|
|
22282
|
-
|
|
22283
|
-
|
|
22284
|
-
|
|
22285
|
-
|
|
22286
|
-
|
|
22287
|
-
|
|
22533
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-entry-section flex flex-col gap-4", children: [
|
|
22534
|
+
outcomes.length >= 2 ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "agg-outcomes flex w-full max-w-full gap-2", children: outcomes.map((outcome, index) => {
|
|
22535
|
+
var _a2, _b2, _c2;
|
|
22536
|
+
const price = getDisplayOutcomePrice({
|
|
22537
|
+
outcomeId: outcome.id,
|
|
22538
|
+
outcomeLabel: outcome.label,
|
|
22539
|
+
selection: (_a2 = tradingContext == null ? void 0 : tradingContext.tradeSide) != null ? _a2 : isSell ? "sell" : "buy",
|
|
22540
|
+
bestPrices: clusterBestPrices,
|
|
22541
|
+
bestMidpoint: clusterBestMidpoint,
|
|
22542
|
+
bestMidpointsByOutcomeId: clusterBestMidpointsByOutcomeId,
|
|
22543
|
+
livePrices
|
|
22544
|
+
});
|
|
22545
|
+
const isActive = outcome.id === scopedSelectedOutcomeId;
|
|
22546
|
+
const isPositive = resolveIsPositiveOutcome(outcome, index);
|
|
22547
|
+
const isPriceLoading = clusterMidpointResult.isLoading && price == null;
|
|
22548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
|
|
22549
|
+
"button",
|
|
22550
|
+
{
|
|
22551
|
+
"data-id": outcome.id,
|
|
22552
|
+
type: "button",
|
|
22553
|
+
className: cn(
|
|
22554
|
+
"agg-outcome-button",
|
|
22555
|
+
getOutcomeButtonClassName({
|
|
22556
|
+
enableAnimations,
|
|
22557
|
+
isActive,
|
|
22558
|
+
isPositive
|
|
22559
|
+
}),
|
|
22560
|
+
"disabled:cursor-not-allowed disabled:opacity-60",
|
|
22561
|
+
"leading-agg-5! flex-1 min-w-0 gap-1 md:gap-2"
|
|
22562
|
+
),
|
|
22563
|
+
"aria-pressed": isActive,
|
|
22564
|
+
"aria-label": `${(_b2 = outcome.title) != null ? _b2 : outcome.label} ${formatProbabilityCents(price, formatPrice)}`,
|
|
22565
|
+
disabled: !orderEligibility.canPlaceOrder || isResolvedOutcomeCtaLocked,
|
|
22566
|
+
onClick: () => handleOutcomeChange(outcome.id),
|
|
22567
|
+
children: [
|
|
22568
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
22569
|
+
Typography,
|
|
22570
|
+
{
|
|
22571
|
+
as: "span",
|
|
22572
|
+
variant: isActive ? "body-strong" : "body",
|
|
22573
|
+
className: cn("whitespace-nowrap truncate"),
|
|
22574
|
+
children: (_c2 = outcome.title) != null ? _c2 : outcome.label
|
|
22575
|
+
}
|
|
22576
|
+
),
|
|
22577
|
+
isPriceLoading ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
22578
|
+
"span",
|
|
22579
|
+
{
|
|
22580
|
+
"aria-hidden": "true",
|
|
22581
|
+
className: cn(
|
|
22582
|
+
"agg-place-order-outcome-price-loading",
|
|
22583
|
+
"h-4 w-10 shrink-0 rounded-agg-sm bg-agg-separator animate-pulse"
|
|
22584
|
+
)
|
|
22585
|
+
}
|
|
22586
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Typography, { as: "span", variant: isActive ? "body-strong" : "body", children: formatProbabilityCents(price, formatPrice) })
|
|
22587
|
+
]
|
|
22588
|
+
},
|
|
22589
|
+
outcome.id
|
|
22590
|
+
);
|
|
22591
|
+
}) }) : null,
|
|
22592
|
+
isLimitOrder ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-limit-price-section flex items-center justify-between gap-4", children: [
|
|
22593
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.limitPrice }),
|
|
22594
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex min-w-0 flex-col items-end gap-1", children: [
|
|
22595
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
22596
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("label", { className: "relative flex items-center", children: [
|
|
22597
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
22598
|
+
"input",
|
|
22599
|
+
{
|
|
22600
|
+
type: "text",
|
|
22601
|
+
inputMode: "decimal",
|
|
22602
|
+
"aria-label": tradingLabels.limitPriceInputAria,
|
|
22603
|
+
"aria-invalid": Boolean(limitPriceInputError),
|
|
22604
|
+
value: limitPriceInputValue,
|
|
22605
|
+
onChange: handleLimitPriceInputChange,
|
|
22606
|
+
onBlur: handleLimitPriceInputBlur,
|
|
22607
|
+
className: cn(
|
|
22608
|
+
PLACE_ORDER_NUMERIC_INPUT_CLASS_NAME,
|
|
22609
|
+
"h-9 w-[108px] pr-5",
|
|
22610
|
+
limitPriceInputError && "text-agg-error focus-visible:text-agg-error"
|
|
22611
|
+
)
|
|
22612
|
+
}
|
|
22613
|
+
),
|
|
22614
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "pointer-events-none absolute right-1 text-agg-3xl font-agg-bold leading-agg-9 text-agg-foreground", children: "\xA2" })
|
|
22615
|
+
] }),
|
|
22288
22616
|
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
22289
|
-
|
|
22617
|
+
"button",
|
|
22290
22618
|
{
|
|
22291
|
-
|
|
22292
|
-
|
|
22293
|
-
|
|
22294
|
-
|
|
22619
|
+
type: "button",
|
|
22620
|
+
className: "flex size-8 cursor-pointer items-center justify-center rounded-agg-lg bg-agg-secondary-hover text-agg-foreground hover:bg-agg-tertiary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
|
|
22621
|
+
"aria-label": tradingLabels.limitPriceDecreaseAria,
|
|
22622
|
+
onClick: () => handleLimitPriceStep("decrease"),
|
|
22623
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Icon, { name: "minus", size: "small", className: "h-4 w-4", "aria-hidden": true })
|
|
22295
22624
|
}
|
|
22296
22625
|
),
|
|
22297
|
-
|
|
22298
|
-
"
|
|
22626
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
22627
|
+
"button",
|
|
22299
22628
|
{
|
|
22300
|
-
|
|
22301
|
-
className:
|
|
22302
|
-
|
|
22303
|
-
|
|
22304
|
-
)
|
|
22629
|
+
type: "button",
|
|
22630
|
+
className: "flex size-8 cursor-pointer items-center justify-center rounded-agg-lg bg-agg-secondary-hover text-agg-foreground hover:bg-agg-tertiary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
|
|
22631
|
+
"aria-label": tradingLabels.limitPriceIncreaseAria,
|
|
22632
|
+
onClick: () => handleLimitPriceStep("increase"),
|
|
22633
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Icon, { name: "plus", size: "small", className: "h-4 w-4", "aria-hidden": true })
|
|
22305
22634
|
}
|
|
22306
|
-
)
|
|
22307
|
-
]
|
|
22308
|
-
|
|
22309
|
-
|
|
22310
|
-
)
|
|
22311
|
-
|
|
22312
|
-
|
|
22313
|
-
|
|
22314
|
-
|
|
22315
|
-
|
|
22316
|
-
|
|
22317
|
-
|
|
22318
|
-
"input",
|
|
22635
|
+
)
|
|
22636
|
+
] }),
|
|
22637
|
+
limitPriceInputError ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "max-w-[220px] text-right text-agg-xs leading-agg-4 text-agg-error", children: limitPriceInputError }) : null
|
|
22638
|
+
] })
|
|
22639
|
+
] }) : null,
|
|
22640
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-amount-section flex items-start justify-between gap-4", children: [
|
|
22641
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-amount-meta flex flex-col", children: [
|
|
22642
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "agg-order-amount-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground whitespace-nowrap", children: tradingLabels.amount(internalTab) }),
|
|
22643
|
+
isAuthenticated ? isSell ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "agg-balance-value flex items-baseline gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isCurrentSellableSharesLoading ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(LoadingIcon, { size: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(import_jsx_runtime158.Fragment, { children: [
|
|
22644
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "whitespace-pre", children: displayedCurrentSellableSharesLabel }),
|
|
22645
|
+
displayedCurrentSellableShares > 0 ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
22646
|
+
"button",
|
|
22319
22647
|
{
|
|
22320
|
-
type: "
|
|
22321
|
-
inputMode: "decimal",
|
|
22322
|
-
"aria-label": tradingLabels.limitPriceInputAria,
|
|
22323
|
-
"aria-invalid": Boolean(limitPriceInputError),
|
|
22324
|
-
value: limitPriceInputValue,
|
|
22325
|
-
onChange: handleLimitPriceInputChange,
|
|
22326
|
-
onBlur: handleLimitPriceInputBlur,
|
|
22648
|
+
type: "button",
|
|
22327
22649
|
className: cn(
|
|
22328
|
-
"
|
|
22329
|
-
"
|
|
22330
|
-
|
|
22331
|
-
|
|
22650
|
+
"agg-max-shares-button",
|
|
22651
|
+
"cursor-pointer disabled:cursor-not-allowed",
|
|
22652
|
+
"bg-transparent p-0 text-agg-sm font-agg-bold leading-agg-5 text-agg-primary disabled:text-agg-muted-foreground",
|
|
22653
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
|
|
22654
|
+
),
|
|
22655
|
+
"aria-label": tradingLabels.maxShares,
|
|
22656
|
+
disabled: !orderEligibility.canPlaceOrder || isAtMaxSellableShares,
|
|
22657
|
+
onClick: handleFillSellableShares,
|
|
22658
|
+
children: tradingLabels.maxShares
|
|
22332
22659
|
}
|
|
22333
|
-
)
|
|
22334
|
-
|
|
22335
|
-
|
|
22336
|
-
|
|
22337
|
-
|
|
22338
|
-
|
|
22339
|
-
|
|
22340
|
-
|
|
22341
|
-
|
|
22342
|
-
|
|
22343
|
-
|
|
22660
|
+
) : null
|
|
22661
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "agg-balance-value flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isBalanceLoading ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(LoadingIcon, { size: "small" }) : tradingLabels.balance(formatUsd(displayedBalance)) }) : null
|
|
22662
|
+
] }),
|
|
22663
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
22664
|
+
CurrencyInput,
|
|
22665
|
+
{
|
|
22666
|
+
value: internalAmount,
|
|
22667
|
+
onChange: handleAmountChange,
|
|
22668
|
+
ariaLabel: tradingLabels.amount(internalTab),
|
|
22669
|
+
max: isLimitOrder && !isSell && isAuthenticated && !isBalanceLoading ? totalBalance : void 0,
|
|
22670
|
+
isInvalid: isInsufficientBalance || isBelowMinimum,
|
|
22671
|
+
disabled: !orderEligibility.canPlaceOrder,
|
|
22672
|
+
prefix: internalTab === "buy" ? "$" : "",
|
|
22673
|
+
decimalPlaces: isSell ? SELL_SHARE_INPUT_DECIMALS : 2,
|
|
22674
|
+
classNames: {
|
|
22675
|
+
input: cn(
|
|
22676
|
+
"agg-order-amount-input",
|
|
22677
|
+
PLACE_ORDER_NUMERIC_INPUT_CLASS_NAME,
|
|
22678
|
+
"w-full max-w-[168px]",
|
|
22679
|
+
hasEnteredAmount ? "text-agg-foreground" : "text-agg-separator caret-agg-foreground"
|
|
22680
|
+
)
|
|
22344
22681
|
}
|
|
22345
|
-
|
|
22682
|
+
}
|
|
22683
|
+
)
|
|
22684
|
+
] }),
|
|
22685
|
+
showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-fees-section flex items-center justify-between gap-4", children: [
|
|
22686
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
22346
22687
|
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
22347
|
-
|
|
22688
|
+
Typography,
|
|
22348
22689
|
{
|
|
22349
|
-
|
|
22350
|
-
className: "
|
|
22351
|
-
|
|
22352
|
-
onClick: () => handleLimitPriceStep("increase"),
|
|
22353
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Icon, { name: "plus", size: "small", className: "h-4 w-4", "aria-hidden": true })
|
|
22690
|
+
variant: "text-sm",
|
|
22691
|
+
className: "text-agg-sm leading-agg-5 text-agg-muted-foreground",
|
|
22692
|
+
children: tradingLabels.estimatedFees
|
|
22354
22693
|
}
|
|
22355
|
-
)
|
|
22356
|
-
|
|
22357
|
-
|
|
22358
|
-
] })
|
|
22359
|
-
] }) : null,
|
|
22360
|
-
/* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-amount-section flex items-start justify-between gap-4", children: [
|
|
22361
|
-
/* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-amount-meta flex flex-col", children: [
|
|
22362
|
-
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "agg-order-amount-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground whitespace-nowrap", children: tradingLabels.amount(internalTab) }),
|
|
22363
|
-
isAuthenticated ? isSell ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "agg-balance-value flex items-baseline gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isCurrentSellableSharesLoading ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(LoadingIcon, { size: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(import_jsx_runtime158.Fragment, { children: [
|
|
22364
|
-
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "whitespace-pre", children: displayedCurrentSellableSharesLabel }),
|
|
22365
|
-
displayedCurrentSellableShares > 0 ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
22366
|
-
"button",
|
|
22694
|
+
),
|
|
22695
|
+
feeBreakdownRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
22696
|
+
Tooltip,
|
|
22367
22697
|
{
|
|
22368
|
-
|
|
22369
|
-
|
|
22370
|
-
|
|
22371
|
-
|
|
22372
|
-
|
|
22373
|
-
|
|
22374
|
-
|
|
22375
|
-
|
|
22376
|
-
|
|
22377
|
-
|
|
22378
|
-
|
|
22698
|
+
"aria-label": tradingLabels.estimatedFeesTooltipAria,
|
|
22699
|
+
classNames: {
|
|
22700
|
+
content: cn(
|
|
22701
|
+
"min-w-[220px] max-w-[320px] rounded-[10px] px-5 py-4",
|
|
22702
|
+
"shadow-[0_12px_12px_rgba(0,0,0,0.10)]"
|
|
22703
|
+
),
|
|
22704
|
+
icon: "h-3 w-3 text-agg-muted-foreground",
|
|
22705
|
+
trigger: "h-3 w-3 text-agg-muted-foreground"
|
|
22706
|
+
},
|
|
22707
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "flex w-full flex-col gap-2", children: feeBreakdownRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
|
|
22708
|
+
"div",
|
|
22709
|
+
{
|
|
22710
|
+
className: "flex items-center justify-between gap-3 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground",
|
|
22711
|
+
children: [
|
|
22712
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { children: row.label }),
|
|
22713
|
+
row.kind === "badge" ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
22714
|
+
"span",
|
|
22715
|
+
{
|
|
22716
|
+
className: cn(
|
|
22717
|
+
"agg-fee-badge inline-flex items-center justify-center rounded-agg-sm border border-agg-primary/50",
|
|
22718
|
+
"bg-linear-to-b from-agg-primary/8 to-agg-primary/15 px-1.5 py-1",
|
|
22719
|
+
"text-agg-xs font-agg-bold leading-agg-4 text-agg-primary uppercase whitespace-nowrap"
|
|
22720
|
+
),
|
|
22721
|
+
children: row.badgeLabel
|
|
22722
|
+
}
|
|
22723
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "text-right", children: row.value })
|
|
22724
|
+
]
|
|
22725
|
+
},
|
|
22726
|
+
row.label
|
|
22727
|
+
)) })
|
|
22379
22728
|
}
|
|
22380
22729
|
) : null
|
|
22381
|
-
] })
|
|
22382
|
-
|
|
22383
|
-
|
|
22384
|
-
CurrencyInput,
|
|
22385
|
-
{
|
|
22386
|
-
value: internalAmount,
|
|
22387
|
-
onChange: handleAmountChange,
|
|
22388
|
-
ariaLabel: tradingLabels.amount(internalTab),
|
|
22389
|
-
max: isLimitOrder && !isSell && isAuthenticated && !isBalanceLoading ? totalBalance : void 0,
|
|
22390
|
-
isInvalid: isInsufficientBalance || isBelowMinimum,
|
|
22391
|
-
disabled: !orderEligibility.canPlaceOrder,
|
|
22392
|
-
prefix: internalTab === "buy" ? "$" : "",
|
|
22393
|
-
decimalPlaces: isSell ? SELL_SHARE_INPUT_DECIMALS : 2,
|
|
22394
|
-
classNames: {
|
|
22395
|
-
input: cn(
|
|
22396
|
-
"agg-order-amount-input",
|
|
22397
|
-
"w-full max-w-[168px] text-right text-agg-3xl font-agg-bold leading-agg-9 tracking-agg-normal",
|
|
22398
|
-
hasEnteredAmount ? "text-agg-foreground" : "text-agg-separator caret-agg-foreground"
|
|
22399
|
-
)
|
|
22400
|
-
}
|
|
22401
|
-
}
|
|
22402
|
-
)
|
|
22730
|
+
] }),
|
|
22731
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: estimatedFeesValue })
|
|
22732
|
+
] }) : null
|
|
22403
22733
|
] }),
|
|
22404
|
-
showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-fees-section flex items-center justify-between gap-4", children: [
|
|
22405
|
-
/* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
22406
|
-
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
22407
|
-
Typography,
|
|
22408
|
-
{
|
|
22409
|
-
variant: "text-sm",
|
|
22410
|
-
className: "text-agg-sm leading-agg-5 text-agg-muted-foreground",
|
|
22411
|
-
children: tradingLabels.estimatedFees
|
|
22412
|
-
}
|
|
22413
|
-
),
|
|
22414
|
-
feeBreakdownRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
22415
|
-
Tooltip,
|
|
22416
|
-
{
|
|
22417
|
-
"aria-label": tradingLabels.estimatedFeesTooltipAria,
|
|
22418
|
-
classNames: {
|
|
22419
|
-
content: cn(
|
|
22420
|
-
"min-w-[220px] max-w-[320px] rounded-[10px] px-5 py-4",
|
|
22421
|
-
"shadow-[0_12px_12px_rgba(0,0,0,0.10)]"
|
|
22422
|
-
),
|
|
22423
|
-
icon: "h-3 w-3 text-agg-muted-foreground",
|
|
22424
|
-
trigger: "h-3 w-3 text-agg-muted-foreground"
|
|
22425
|
-
},
|
|
22426
|
-
content: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "flex w-full flex-col gap-2", children: feeBreakdownRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
|
|
22427
|
-
"div",
|
|
22428
|
-
{
|
|
22429
|
-
className: "flex items-center justify-between gap-3 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground",
|
|
22430
|
-
children: [
|
|
22431
|
-
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { children: row.label }),
|
|
22432
|
-
row.kind === "badge" ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
22433
|
-
"span",
|
|
22434
|
-
{
|
|
22435
|
-
className: cn(
|
|
22436
|
-
"agg-fee-badge inline-flex items-center justify-center rounded-agg-sm border border-agg-primary/50",
|
|
22437
|
-
"bg-linear-to-b from-agg-primary/8 to-agg-primary/15 px-1.5 py-1",
|
|
22438
|
-
"text-agg-xs font-agg-bold leading-agg-4 text-agg-primary uppercase whitespace-nowrap"
|
|
22439
|
-
),
|
|
22440
|
-
children: row.badgeLabel
|
|
22441
|
-
}
|
|
22442
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "text-right", children: row.value })
|
|
22443
|
-
]
|
|
22444
|
-
},
|
|
22445
|
-
row.label
|
|
22446
|
-
)) })
|
|
22447
|
-
}
|
|
22448
|
-
) : null
|
|
22449
|
-
] }),
|
|
22450
|
-
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: estimatedFeesValue })
|
|
22451
|
-
] }) : null,
|
|
22452
22734
|
shouldShowSmartRouting ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-route-panel flex flex-col gap-3", children: [
|
|
22453
22735
|
/* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-route-panel-header flex items-center justify-between gap-4", children: [
|
|
22454
22736
|
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "agg-route-panel-title text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.smartRouting }),
|
|
@@ -22457,10 +22739,10 @@ var PlaceOrder = ({
|
|
|
22457
22739
|
{
|
|
22458
22740
|
type: "button",
|
|
22459
22741
|
className: "agg-route-toggle flex cursor-pointer items-center gap-1.5 text-agg-sm leading-agg-5 text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary",
|
|
22460
|
-
"aria-label": tradingLabels.viewAllRoutes(
|
|
22742
|
+
"aria-label": tradingLabels.viewAllRoutes(activeRouteCardCount),
|
|
22461
22743
|
onClick: () => setIsRoutesExpanded((currentValue) => !currentValue),
|
|
22462
22744
|
children: [
|
|
22463
|
-
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { children: tradingLabels.viewAllRoutes(
|
|
22745
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { children: tradingLabels.viewAllRoutes(activeRouteCardCount) }),
|
|
22464
22746
|
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
22465
22747
|
Icon,
|
|
22466
22748
|
{
|
|
@@ -22474,16 +22756,16 @@ var PlaceOrder = ({
|
|
|
22474
22756
|
}
|
|
22475
22757
|
) : null
|
|
22476
22758
|
] }),
|
|
22477
|
-
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "agg-route-list flex flex-col gap-2", children: isQuoteLoading ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-route-loading flex flex-col gap-2", "aria-hidden": "true", children: [
|
|
22759
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "agg-route-list flex flex-col gap-2", children: !isLimitOrder && isQuoteLoading ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-route-loading flex flex-col gap-2", "aria-hidden": "true", children: [
|
|
22478
22760
|
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)(PlaceOrderRouteCardSkeleton, {}),
|
|
22479
22761
|
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)(PlaceOrderRouteCardSkeleton, {})
|
|
22480
|
-
] }) :
|
|
22762
|
+
] }) : activeRouteCards.length > 0 ? activeRouteCards.map((card) => {
|
|
22481
22763
|
return /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(import_react36.Fragment, { children: renderRouteCard({
|
|
22482
22764
|
card,
|
|
22483
22765
|
enableAnimations,
|
|
22484
22766
|
isExpanded: card.kind === "split" ? isSplitDetailOpen : isRoutesExpanded,
|
|
22485
|
-
isSelected: !card.isUnavailable && card.id === resolvedSelectedRouteCardId,
|
|
22486
|
-
onSelect:
|
|
22767
|
+
isSelected: !card.isUnavailable && card.id === (isLimitOrder ? selectedLimitRouteCardId : resolvedSelectedRouteCardId),
|
|
22768
|
+
onSelect: handleActiveRouteCardSelect,
|
|
22487
22769
|
tradingLabels
|
|
22488
22770
|
}) }, card.id);
|
|
22489
22771
|
}) : null })
|
|
@@ -22504,7 +22786,6 @@ var PlaceOrder = ({
|
|
|
22504
22786
|
className: "flex min-w-0 cursor-pointer items-center justify-end gap-2 text-right text-agg-base leading-agg-6 text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
|
|
22505
22787
|
"aria-label": tradingLabels.expirationMenuAria,
|
|
22506
22788
|
children: [
|
|
22507
|
-
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Icon, { name: "calendar", size: "small", className: "h-4 w-4 shrink-0", "aria-hidden": true }),
|
|
22508
22789
|
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "min-w-0 truncate", children: limitExpirationType === "GTC" ? tradingLabels.expirationGoodTilCanceled : limitExpirationType === "FIVE_MINUTES" ? tradingLabels.expirationFiveMinutes : limitExpirationType === "ONE_HOUR" ? tradingLabels.expirationOneHour : limitExpirationType === "END_OF_DAY" ? tradingLabels.expirationEndOfDay : resolvedCustomExpirationDate ? (0, import_dayjs8.default)(resolvedCustomExpirationDate).format(
|
|
22509
22790
|
"MMM D, YYYY [at] HH:mm"
|
|
22510
22791
|
) : tradingLabels.expirationCustom }),
|
|
@@ -22808,7 +23089,7 @@ var PlaceOrder = ({
|
|
|
22808
23089
|
className: "agg-order-submit h-12 w-full px-8 text-agg-base leading-agg-6 shadow-none",
|
|
22809
23090
|
disabled: !orderEligibility.canPlaceOrder || shouldShowGeoBlockBanner,
|
|
22810
23091
|
"aria-label": tradingLabels.signInToTrade,
|
|
22811
|
-
onClick:
|
|
23092
|
+
onClick: import_hooks61.requestAggAuthChooserOpen,
|
|
22812
23093
|
children: tradingLabels.signInToTrade
|
|
22813
23094
|
}
|
|
22814
23095
|
) : /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
@@ -22880,7 +23161,7 @@ var PlaceOrder = ({
|
|
|
22880
23161
|
PlaceOrder.displayName = "PlaceOrder";
|
|
22881
23162
|
|
|
22882
23163
|
// src/trading/use-claim-winnings.ts
|
|
22883
|
-
var
|
|
23164
|
+
var import_hooks62 = require("@agg-build/hooks");
|
|
22884
23165
|
var import_react37 = require("react");
|
|
22885
23166
|
var toClaimError = (err) => {
|
|
22886
23167
|
if (err instanceof Error) return err;
|
|
@@ -22888,11 +23169,11 @@ var toClaimError = (err) => {
|
|
|
22888
23169
|
};
|
|
22889
23170
|
function useClaimWinnings(options = {}) {
|
|
22890
23171
|
const { onClaim, onClaimResult, onClaimSubmitError, externalClaimingKeys } = options;
|
|
22891
|
-
const labels = (0,
|
|
23172
|
+
const labels = (0, import_hooks62.useLabels)();
|
|
22892
23173
|
const claimNotificationLabels = labels.notifications.claim;
|
|
22893
23174
|
const toastCtx = useOptionalToast();
|
|
22894
|
-
const queryClient = (0,
|
|
22895
|
-
const redeemMutation = (0,
|
|
23175
|
+
const queryClient = (0, import_hooks62.useQueryClient)();
|
|
23176
|
+
const redeemMutation = (0, import_hooks62.useRedeem)();
|
|
22896
23177
|
const [activeRedeems, setActiveRedeems] = (0, import_react37.useState)({});
|
|
22897
23178
|
const activeClaimKeysRef = (0, import_react37.useRef)(/* @__PURE__ */ new Set());
|
|
22898
23179
|
const pendingClaimToastIdsRef = (0, import_react37.useRef)({});
|
|
@@ -22902,7 +23183,7 @@ function useClaimWinnings(options = {}) {
|
|
|
22902
23183
|
() => Object.values(activeRedeems),
|
|
22903
23184
|
[activeRedeems]
|
|
22904
23185
|
);
|
|
22905
|
-
const lifecycleStates = (0,
|
|
23186
|
+
const lifecycleStates = (0, import_hooks62.useRedeemLifecycles)(lifecycleInputs);
|
|
22906
23187
|
const internalClaimingIds = (0, import_react37.useMemo)(() => {
|
|
22907
23188
|
const out = __spreadValues({}, submittingClaimKeys);
|
|
22908
23189
|
for (const [claimKey, active] of Object.entries(activeRedeems)) {
|
|
@@ -22917,13 +23198,13 @@ function useClaimWinnings(options = {}) {
|
|
|
22917
23198
|
[externalClaimingKeys, internalClaimingIds]
|
|
22918
23199
|
);
|
|
22919
23200
|
const invalidateClaimUiState = (0, import_react37.useCallback)(() => {
|
|
22920
|
-
(0,
|
|
22921
|
-
(0,
|
|
23201
|
+
(0, import_hooks62.invalidateBalanceQueries)(queryClient);
|
|
23202
|
+
(0, import_hooks62.invalidatePositionQueries)(queryClient);
|
|
22922
23203
|
queryClient.invalidateQueries({
|
|
22923
|
-
queryKey:
|
|
23204
|
+
queryKey: import_hooks62.executionKeys.claimablePositionsCount(),
|
|
22924
23205
|
refetchType: "active"
|
|
22925
23206
|
});
|
|
22926
|
-
(0,
|
|
23207
|
+
(0, import_hooks62.invalidateUserActivityQueries)(queryClient);
|
|
22927
23208
|
}, [queryClient]);
|
|
22928
23209
|
const claim = (0, import_react37.useCallback)(
|
|
22929
23210
|
(_0) => __async(null, [_0], function* ({ claimKey, winningOutcomeIds, payload }) {
|
|
@@ -23120,7 +23401,7 @@ function useClaimWinnings(options = {}) {
|
|
|
23120
23401
|
}
|
|
23121
23402
|
|
|
23122
23403
|
// src/trading/use-resolved-market-claim.ts
|
|
23123
|
-
var
|
|
23404
|
+
var import_hooks63 = require("@agg-build/hooks");
|
|
23124
23405
|
var import_react38 = require("react");
|
|
23125
23406
|
var sharesFormatter = new Intl.NumberFormat("en-US", { maximumFractionDigits: 2 });
|
|
23126
23407
|
var dateFormatter = new Intl.DateTimeFormat("en-US", {
|
|
@@ -23137,12 +23418,12 @@ var formatResolutionDate = (value) => {
|
|
|
23137
23418
|
function useResolvedMarketClaim(options = {}) {
|
|
23138
23419
|
var _a;
|
|
23139
23420
|
const { market, enabled = true, executionMode } = options;
|
|
23140
|
-
const { isAuthenticated } = (0,
|
|
23141
|
-
const tradingState = (0, import_react38.useMemo)(() => (0,
|
|
23421
|
+
const { isAuthenticated } = (0, import_hooks63.useAggAuthState)();
|
|
23422
|
+
const tradingState = (0, import_react38.useMemo)(() => (0, import_hooks63.resolveMarketTradingState)(market), [market]);
|
|
23142
23423
|
const isResolved = tradingState.kind === "resolved";
|
|
23143
23424
|
const marketId = (_a = market == null ? void 0 : market.id) != null ? _a : null;
|
|
23144
23425
|
const shouldFetch = Boolean(enabled && isAuthenticated && isResolved && marketId);
|
|
23145
|
-
const { positions } = (0,
|
|
23426
|
+
const { positions } = (0, import_hooks63.useExecutionPositions)(__spreadValues({
|
|
23146
23427
|
enabled: shouldFetch,
|
|
23147
23428
|
status: "active",
|
|
23148
23429
|
limit: 50
|
|
@@ -23159,7 +23440,7 @@ function useResolvedMarketClaim(options = {}) {
|
|
|
23159
23440
|
(outcome) => outcome.winner === true && outcome.totalSize > 0
|
|
23160
23441
|
);
|
|
23161
23442
|
if (winningOutcomes.length === 0) return void 0;
|
|
23162
|
-
const totals = (0,
|
|
23443
|
+
const totals = (0, import_hooks63.computeClosedPositionTotals)(group);
|
|
23163
23444
|
const winningShares = winningOutcomes.reduce((sum, outcome) => sum + outcome.totalSize, 0);
|
|
23164
23445
|
const winningOutcomeLabel = (_a2 = resolveResolvedOutcomeLabel({
|
|
23165
23446
|
market: market != null ? market : group.venueMarket,
|
|
@@ -23243,7 +23524,7 @@ var resolveEventMarketPageStickyState = ({
|
|
|
23243
23524
|
};
|
|
23244
23525
|
|
|
23245
23526
|
// src/pages/event-market/event-market.shared.tsx
|
|
23246
|
-
var
|
|
23527
|
+
var import_hooks64 = require("@agg-build/hooks");
|
|
23247
23528
|
var Dialog7 = __toESM(require("@radix-ui/react-dialog"));
|
|
23248
23529
|
var import_react39 = require("react");
|
|
23249
23530
|
var import_jsx_runtime159 = require("react/jsx-runtime");
|
|
@@ -23312,7 +23593,7 @@ var EventMarketPageMobileTrade = ({
|
|
|
23312
23593
|
midpointsResult,
|
|
23313
23594
|
onBeforePrimaryAction
|
|
23314
23595
|
}) => {
|
|
23315
|
-
const labels = (0,
|
|
23596
|
+
const labels = (0, import_hooks64.useLabels)();
|
|
23316
23597
|
if (!showPlaceOrder) return null;
|
|
23317
23598
|
const handleOpenChange = (nextOpen) => {
|
|
23318
23599
|
onOpenChange(nextOpen);
|
|
@@ -23367,7 +23648,7 @@ var EventMarketPageMobileTrade = ({
|
|
|
23367
23648
|
var EventMarketPageUnavailableState = ({
|
|
23368
23649
|
ariaLabel: _ariaLabel
|
|
23369
23650
|
}) => {
|
|
23370
|
-
const labels = (0,
|
|
23651
|
+
const labels = (0, import_hooks64.useLabels)();
|
|
23371
23652
|
return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
|
|
23372
23653
|
StateMessage,
|
|
23373
23654
|
{
|
|
@@ -23383,7 +23664,7 @@ var EventMarketPageUnavailableState = ({
|
|
|
23383
23664
|
var EventMarketPageNotFoundState = ({
|
|
23384
23665
|
ariaLabel: _ariaLabel
|
|
23385
23666
|
}) => {
|
|
23386
|
-
const labels = (0,
|
|
23667
|
+
const labels = (0, import_hooks64.useLabels)();
|
|
23387
23668
|
return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
|
|
23388
23669
|
StateMessage,
|
|
23389
23670
|
{
|
|
@@ -23480,11 +23761,11 @@ var EventMarketPageLoadingState = ({
|
|
|
23480
23761
|
};
|
|
23481
23762
|
|
|
23482
23763
|
// src/pages/event-market/sports-event-market-page.tsx
|
|
23483
|
-
var
|
|
23764
|
+
var import_hooks67 = require("@agg-build/hooks");
|
|
23484
23765
|
var import_react42 = require("react");
|
|
23485
23766
|
|
|
23486
23767
|
// src/pages/event-market/sports-markets.tsx
|
|
23487
|
-
var
|
|
23768
|
+
var import_hooks66 = require("@agg-build/hooks");
|
|
23488
23769
|
var import_react41 = require("react");
|
|
23489
23770
|
|
|
23490
23771
|
// src/pages/event-market/sports-event-market.utils.ts
|
|
@@ -24333,7 +24614,7 @@ var mergeSportsSectionMarketsIntoEvent = ({
|
|
|
24333
24614
|
};
|
|
24334
24615
|
|
|
24335
24616
|
// src/pages/event-market/sports-market-card.tsx
|
|
24336
|
-
var
|
|
24617
|
+
var import_hooks65 = require("@agg-build/hooks");
|
|
24337
24618
|
var import_react40 = require("react");
|
|
24338
24619
|
|
|
24339
24620
|
// src/pages/event-market/sports-line-rail.tsx
|
|
@@ -24383,7 +24664,7 @@ function SportsLineRail({
|
|
|
24383
24664
|
const didInit = React.useRef(false);
|
|
24384
24665
|
const programmatic = React.useRef(false);
|
|
24385
24666
|
const progTimer = React.useRef(void 0);
|
|
24386
|
-
const
|
|
24667
|
+
const skipCenterForIndex = React.useRef(null);
|
|
24387
24668
|
const pendingScrollIndex = React.useRef(null);
|
|
24388
24669
|
const scrollSettleTimer = React.useRef(void 0);
|
|
24389
24670
|
const stopCount = stops.length;
|
|
@@ -24423,9 +24704,15 @@ function SportsLineRail({
|
|
|
24423
24704
|
if (!w) return;
|
|
24424
24705
|
const firstW = (_b = (_a = itemRefs.current[0]) == null ? void 0 : _a.offsetWidth) != null ? _b : 0;
|
|
24425
24706
|
const lastW = (_d = (_c = itemRefs.current[stopCount - 1]) == null ? void 0 : _c.offsetWidth) != null ? _d : 0;
|
|
24426
|
-
|
|
24707
|
+
const nextPad = {
|
|
24427
24708
|
left: Math.max(0, w / 2 - firstW / 2),
|
|
24428
24709
|
right: Math.max(0, w / 2 - lastW / 2)
|
|
24710
|
+
};
|
|
24711
|
+
setPad((currentPad) => {
|
|
24712
|
+
if (currentPad.left === nextPad.left && currentPad.right === nextPad.right) {
|
|
24713
|
+
return currentPad;
|
|
24714
|
+
}
|
|
24715
|
+
return nextPad;
|
|
24429
24716
|
});
|
|
24430
24717
|
updateMask();
|
|
24431
24718
|
};
|
|
@@ -24438,7 +24725,7 @@ function SportsLineRail({
|
|
|
24438
24725
|
scrollSettleTimer.current = setTimeout(() => {
|
|
24439
24726
|
const nextIndex = pendingScrollIndex.current;
|
|
24440
24727
|
if (nextIndex == null || nextIndex === selectedIndex) return;
|
|
24441
|
-
|
|
24728
|
+
skipCenterForIndex.current = nextIndex;
|
|
24442
24729
|
onSelect(nextIndex);
|
|
24443
24730
|
}, 120);
|
|
24444
24731
|
}
|
|
@@ -24462,11 +24749,12 @@ function SportsLineRail({
|
|
|
24462
24749
|
const c = scrollRef.current;
|
|
24463
24750
|
const el = itemRefs.current[selectedIndex];
|
|
24464
24751
|
if (!c || !el || !c.clientWidth) return;
|
|
24465
|
-
if (
|
|
24466
|
-
|
|
24752
|
+
if (skipCenterForIndex.current === selectedIndex) {
|
|
24753
|
+
skipCenterForIndex.current = null;
|
|
24467
24754
|
updateMask();
|
|
24468
24755
|
return;
|
|
24469
24756
|
}
|
|
24757
|
+
skipCenterForIndex.current = null;
|
|
24470
24758
|
const max = c.scrollWidth - c.clientWidth;
|
|
24471
24759
|
const target = el.offsetLeft - c.clientWidth / 2 + el.clientWidth / 2;
|
|
24472
24760
|
programmatic.current = true;
|
|
@@ -24481,11 +24769,18 @@ function SportsLineRail({
|
|
|
24481
24769
|
}, 500);
|
|
24482
24770
|
updateMask();
|
|
24483
24771
|
}, [selectedIndex, stopCount, pad, updateMask]);
|
|
24484
|
-
const
|
|
24485
|
-
|
|
24772
|
+
const clampStopIndex = (index) => Math.min(stops.length - 1, Math.max(0, index));
|
|
24773
|
+
const handleStopClick = (index) => {
|
|
24774
|
+
const next = clampStopIndex(index);
|
|
24775
|
+
if (next !== selectedIndex) {
|
|
24776
|
+
skipCenterForIndex.current = next;
|
|
24777
|
+
}
|
|
24778
|
+
onSelect(next);
|
|
24779
|
+
};
|
|
24780
|
+
const handleStep = (delta) => {
|
|
24781
|
+
const next = clampStopIndex(selectedIndex + delta);
|
|
24486
24782
|
if (next !== selectedIndex) onSelect(next);
|
|
24487
24783
|
};
|
|
24488
|
-
const step = (delta) => select(selectedIndex + delta);
|
|
24489
24784
|
if (stopCount === 0) return null;
|
|
24490
24785
|
return /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)(
|
|
24491
24786
|
"div",
|
|
@@ -24497,7 +24792,7 @@ function SportsLineRail({
|
|
|
24497
24792
|
"button",
|
|
24498
24793
|
{
|
|
24499
24794
|
type: "button",
|
|
24500
|
-
onClick: () =>
|
|
24795
|
+
onClick: () => handleStep(-1),
|
|
24501
24796
|
disabled: selectedIndex === 0,
|
|
24502
24797
|
"aria-label": previousAriaLabel != null ? previousAriaLabel : "Previous line",
|
|
24503
24798
|
className: "flex size-5! shrink-0 cursor-pointer items-center justify-center text-agg-muted-foreground transition-colors hover:text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary disabled:cursor-not-allowed disabled:opacity-30",
|
|
@@ -24520,7 +24815,7 @@ function SportsLineRail({
|
|
|
24520
24815
|
ref: (el) => {
|
|
24521
24816
|
itemRefs.current[index] = el;
|
|
24522
24817
|
},
|
|
24523
|
-
onClick: () =>
|
|
24818
|
+
onClick: () => handleStopClick(index),
|
|
24524
24819
|
disabled: stop.disabled,
|
|
24525
24820
|
"aria-pressed": active,
|
|
24526
24821
|
className: "flex shrink-0 cursor-pointer flex-col items-center gap-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40",
|
|
@@ -24566,7 +24861,7 @@ function SportsLineRail({
|
|
|
24566
24861
|
"button",
|
|
24567
24862
|
{
|
|
24568
24863
|
type: "button",
|
|
24569
|
-
onClick: () =>
|
|
24864
|
+
onClick: () => handleStep(1),
|
|
24570
24865
|
disabled: selectedIndex === stopCount - 1,
|
|
24571
24866
|
"aria-label": nextAriaLabel != null ? nextAriaLabel : "Next line",
|
|
24572
24867
|
className: "flex size-5! shrink-0 cursor-pointer items-center justify-center text-agg-muted-foreground transition-colors hover:text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary disabled:cursor-not-allowed disabled:opacity-30",
|
|
@@ -24580,15 +24875,81 @@ function SportsLineRail({
|
|
|
24580
24875
|
|
|
24581
24876
|
// src/pages/event-market/sports-market-card.tsx
|
|
24582
24877
|
var import_jsx_runtime161 = require("react/jsx-runtime");
|
|
24583
|
-
var
|
|
24878
|
+
var resolveSpreadHeaderOutcomeItems = ({
|
|
24879
|
+
market,
|
|
24880
|
+
groupMarkets,
|
|
24881
|
+
midpointsResult
|
|
24882
|
+
}) => {
|
|
24584
24883
|
var _a;
|
|
24585
|
-
|
|
24586
|
-
|
|
24587
|
-
|
|
24588
|
-
|
|
24589
|
-
|
|
24884
|
+
const outcomes = (_a = market.venueMarketOutcomes) != null ? _a : [];
|
|
24885
|
+
const lineValue = market.lineValue;
|
|
24886
|
+
if (outcomes.length < 2 || lineValue == null) return void 0;
|
|
24887
|
+
const { favored, dog } = resolveSpreadOutcomeTeamNames(market, groupMarkets);
|
|
24888
|
+
if (!favored && !dog) return void 0;
|
|
24889
|
+
const magnitude = Math.abs(lineValue);
|
|
24890
|
+
const formatLine = (value) => `${value > 0 ? "+" : "\u2212"}${Number.isInteger(magnitude) ? String(magnitude) : magnitude.toFixed(1)}`;
|
|
24891
|
+
return [
|
|
24892
|
+
{ index: 0, name: favored, signedLine: -magnitude },
|
|
24893
|
+
{ index: 1, name: dog, signedLine: magnitude }
|
|
24894
|
+
].flatMap(({ index, name, signedLine }) => {
|
|
24895
|
+
var _a2;
|
|
24896
|
+
const outcome = outcomes[index];
|
|
24897
|
+
if (!outcome) return [];
|
|
24898
|
+
const label2 = name != null ? name : outcome.label.trim();
|
|
24899
|
+
const probability = midpointsResult == null ? void 0 : getDisplayOutcomePrice({
|
|
24900
|
+
outcomeId: outcome.id,
|
|
24901
|
+
outcomeLabel: outcome.label,
|
|
24902
|
+
bestMidpointsByOutcomeId: (_a2 = midpointsResult.bestMidpointsByOutcomeId) != null ? _a2 : midpointsResult.prices
|
|
24903
|
+
});
|
|
24904
|
+
return [
|
|
24905
|
+
{
|
|
24906
|
+
id: outcome.id,
|
|
24907
|
+
label: label2,
|
|
24908
|
+
title: label2,
|
|
24909
|
+
lineLabel: formatLine(signedLine),
|
|
24910
|
+
probability,
|
|
24911
|
+
isPriceLoading: (midpointsResult == null ? void 0 : midpointsResult.isLoading) === true && probability == null,
|
|
24912
|
+
tone: index === 0 ? "positive" : "negative",
|
|
24913
|
+
variant: "line",
|
|
24914
|
+
venue: market.venue
|
|
24915
|
+
}
|
|
24916
|
+
];
|
|
24917
|
+
});
|
|
24918
|
+
};
|
|
24919
|
+
var resolveDisplayedOutcomes = ({
|
|
24920
|
+
market,
|
|
24921
|
+
venueMarkets,
|
|
24922
|
+
groupMarkets,
|
|
24923
|
+
useSpreadOverride
|
|
24924
|
+
}) => {
|
|
24925
|
+
var _a;
|
|
24926
|
+
const spreadHeaderOutcomeItems = useSpreadOverride ? resolveSpreadHeaderOutcomeItems({ market, groupMarkets }) : void 0;
|
|
24927
|
+
const resolvedMarket = resolveMarketFromVenueMarkets(venueMarkets, market.id);
|
|
24928
|
+
const headerOutcomeItems = spreadHeaderOutcomeItems != null ? spreadHeaderOutcomeItems : resolveHeaderOutcomeItems(
|
|
24929
|
+
(_a = resolvedMarket == null ? void 0 : resolvedMarket.venueMarkets) != null ? _a : [market],
|
|
24930
|
+
market,
|
|
24931
|
+
resolveSportsMarketCardVariant(market)
|
|
24932
|
+
);
|
|
24933
|
+
return headerOutcomeItems.flatMap((item) => {
|
|
24934
|
+
const outcome = market.venueMarketOutcomes.find((candidate) => candidate.id === item.id);
|
|
24935
|
+
return outcome ? [outcome] : [];
|
|
24936
|
+
});
|
|
24937
|
+
};
|
|
24938
|
+
var resolveSelectedOutcomeSide = ({
|
|
24939
|
+
displayedOutcomes,
|
|
24940
|
+
selectedOutcomeId
|
|
24941
|
+
}) => {
|
|
24942
|
+
const selectedOutcomeIndex = displayedOutcomes.findIndex(
|
|
24943
|
+
(outcome) => outcome.id === selectedOutcomeId
|
|
24944
|
+
);
|
|
24945
|
+
if (selectedOutcomeIndex === 0) return "left";
|
|
24946
|
+
if (selectedOutcomeIndex === 1) return "right";
|
|
24590
24947
|
return null;
|
|
24591
24948
|
};
|
|
24949
|
+
var resolveOutcomeBySide = (displayedOutcomes, side) => {
|
|
24950
|
+
var _a;
|
|
24951
|
+
return (_a = displayedOutcomes[side === "right" ? 1 : 0]) != null ? _a : displayedOutcomes[0];
|
|
24952
|
+
};
|
|
24592
24953
|
var SportsMarketCard = ({
|
|
24593
24954
|
group,
|
|
24594
24955
|
venueMarkets,
|
|
@@ -24601,11 +24962,11 @@ var SportsMarketCard = ({
|
|
|
24601
24962
|
midpointsResult
|
|
24602
24963
|
}) => {
|
|
24603
24964
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
24604
|
-
const labels = (0,
|
|
24965
|
+
const labels = (0, import_hooks65.useLabels)();
|
|
24605
24966
|
const {
|
|
24606
24967
|
formatting: { formatCompactCurrency }
|
|
24607
|
-
} = (0,
|
|
24608
|
-
const tradingContext = (0,
|
|
24968
|
+
} = (0, import_hooks65.useSdkUiConfig)();
|
|
24969
|
+
const tradingContext = (0, import_hooks65.useEventTradingContext)();
|
|
24609
24970
|
const slide = (0, import_react40.useMemo)(() => buildSportsSlideFromGroup(group), [group]);
|
|
24610
24971
|
const [selectedLineIndex, setSelectedLineIndex] = (0, import_react40.useState)(slide.defaultStopIndex);
|
|
24611
24972
|
const combinedMoneylineMarkets = (0, import_react40.useMemo)(
|
|
@@ -24646,7 +25007,7 @@ var SportsMarketCard = ({
|
|
|
24646
25007
|
const justOpened = isExpanded && !wasExpandedRef.current;
|
|
24647
25008
|
wasExpandedRef.current = isExpanded;
|
|
24648
25009
|
if (!justOpened || !activeMarket) return;
|
|
24649
|
-
if ((0,
|
|
25010
|
+
if ((0, import_hooks65.resolveMarketTradingState)(activeMarket).isTradingDisabled) return;
|
|
24650
25011
|
const selectedOutcomeId = tradingContext == null ? void 0 : tradingContext.selectedOutcomeId;
|
|
24651
25012
|
const hasInScopeOutcome = selectedOutcomeId != null && activeMarket.venueMarketOutcomes.some((outcome) => outcome.id === selectedOutcomeId);
|
|
24652
25013
|
if (hasInScopeOutcome) return;
|
|
@@ -24706,69 +25067,46 @@ var SportsMarketCard = ({
|
|
|
24706
25067
|
});
|
|
24707
25068
|
}, [combinedMoneylineMarkets, isCombinedMoneylineGroup, midpointsResult]);
|
|
24708
25069
|
const spreadHeaderOutcomeItems = (0, import_react40.useMemo)(() => {
|
|
24709
|
-
var _a2;
|
|
24710
25070
|
if (slide.kind !== "spread" || !activeMarket) return void 0;
|
|
24711
|
-
|
|
24712
|
-
|
|
24713
|
-
|
|
24714
|
-
|
|
24715
|
-
if (!favored && !dog) return void 0;
|
|
24716
|
-
const magnitude = Math.abs(lineValue);
|
|
24717
|
-
const formatLine = (value) => `${value > 0 ? "+" : "\u2212"}${Number.isInteger(magnitude) ? String(magnitude) : magnitude.toFixed(1)}`;
|
|
24718
|
-
return [
|
|
24719
|
-
{ index: 0, name: favored, signedLine: -magnitude },
|
|
24720
|
-
{ index: 1, name: dog, signedLine: magnitude }
|
|
24721
|
-
].flatMap(({ index, name, signedLine }) => {
|
|
24722
|
-
var _a3;
|
|
24723
|
-
const outcome = outcomes[index];
|
|
24724
|
-
if (!outcome) return [];
|
|
24725
|
-
const label2 = name != null ? name : outcome.label.trim();
|
|
24726
|
-
const probability = midpointsResult == null ? void 0 : getDisplayOutcomePrice({
|
|
24727
|
-
outcomeId: outcome.id,
|
|
24728
|
-
outcomeLabel: outcome.label,
|
|
24729
|
-
bestMidpointsByOutcomeId: (_a3 = midpointsResult.bestMidpointsByOutcomeId) != null ? _a3 : midpointsResult.prices
|
|
24730
|
-
});
|
|
24731
|
-
return [
|
|
24732
|
-
{
|
|
24733
|
-
id: outcome.id,
|
|
24734
|
-
label: label2,
|
|
24735
|
-
title: label2,
|
|
24736
|
-
lineLabel: formatLine(signedLine),
|
|
24737
|
-
probability,
|
|
24738
|
-
isPriceLoading: (midpointsResult == null ? void 0 : midpointsResult.isLoading) === true && probability == null,
|
|
24739
|
-
tone: index === 0 ? "positive" : "negative",
|
|
24740
|
-
variant: "line",
|
|
24741
|
-
venue: activeMarket.venue
|
|
24742
|
-
}
|
|
24743
|
-
];
|
|
25071
|
+
return resolveSpreadHeaderOutcomeItems({
|
|
25072
|
+
market: activeMarket,
|
|
25073
|
+
groupMarkets: group.markets,
|
|
25074
|
+
midpointsResult
|
|
24744
25075
|
});
|
|
24745
25076
|
}, [slide.kind, activeMarket, group.markets, midpointsResult]);
|
|
24746
25077
|
const headerOutcomeItemsOverride = combinedMoneylineHeaderOutcomeItems != null ? combinedMoneylineHeaderOutcomeItems : spreadHeaderOutcomeItems;
|
|
24747
25078
|
const headerOutcomeVariant = isCombinedMoneylineGroup ? "outcome" : resolveSportsMarketCardVariant(activeMarket);
|
|
24748
25079
|
const handleLineSelect = (index) => {
|
|
24749
|
-
var _a2, _b2;
|
|
24750
|
-
const
|
|
25080
|
+
var _a2, _b2, _c2;
|
|
25081
|
+
const targetMarket = (_a2 = slide.stops[index]) == null ? void 0 : _a2.market;
|
|
25082
|
+
if (!targetMarket) return;
|
|
25083
|
+
const selectedMarket = (_c2 = (_b2 = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b2 : venueMarkets.find((market) => market.id === (tradingContext == null ? void 0 : tradingContext.selectedMarketId))) != null ? _c2 : null;
|
|
25084
|
+
const selectedMarketIsInGroup = selectedMarket != null && group.markets.some((market) => market.id === selectedMarket.id);
|
|
25085
|
+
const selectedSide = selectedMarket ? resolveSelectedOutcomeSide({
|
|
25086
|
+
displayedOutcomes: resolveDisplayedOutcomes({
|
|
25087
|
+
market: selectedMarket,
|
|
25088
|
+
venueMarkets,
|
|
25089
|
+
groupMarkets: group.markets,
|
|
25090
|
+
useSpreadOverride: slide.kind === "spread" && selectedMarketIsInGroup
|
|
25091
|
+
}),
|
|
25092
|
+
selectedOutcomeId: tradingContext == null ? void 0 : tradingContext.selectedOutcomeId
|
|
25093
|
+
}) : null;
|
|
25094
|
+
const targetDisplayedOutcomes = resolveDisplayedOutcomes({
|
|
25095
|
+
market: targetMarket,
|
|
25096
|
+
venueMarkets,
|
|
25097
|
+
groupMarkets: group.markets,
|
|
25098
|
+
useSpreadOverride: slide.kind === "spread"
|
|
25099
|
+
});
|
|
25100
|
+
const nextOutcome = resolveOutcomeBySide(targetDisplayedOutcomes, selectedSide != null ? selectedSide : "left");
|
|
24751
25101
|
setSelectedLineIndex(index);
|
|
24752
|
-
const market = (_a2 = slide.stops[index]) == null ? void 0 : _a2.market;
|
|
24753
|
-
if (!market) return;
|
|
24754
|
-
const previousOutcomeIndex = previousMarket ? previousMarket.venueMarketOutcomes.findIndex(
|
|
24755
|
-
(outcome) => outcome.id === (tradingContext == null ? void 0 : tradingContext.selectedOutcomeId)
|
|
24756
|
-
) : -1;
|
|
24757
|
-
const previousOutcome = previousOutcomeIndex >= 0 ? previousMarket == null ? void 0 : previousMarket.venueMarketOutcomes[previousOutcomeIndex] : void 0;
|
|
24758
|
-
const previousOutcomeSide = previousOutcome ? resolveSportsLineOutcomeSide(previousOutcome) : null;
|
|
24759
|
-
const matchingSideOutcomes = previousOutcomeSide ? market.venueMarketOutcomes.filter(
|
|
24760
|
-
(outcome) => resolveSportsLineOutcomeSide(outcome) === previousOutcomeSide
|
|
24761
|
-
) : [];
|
|
24762
|
-
const matchingSideOutcome = matchingSideOutcomes.length === 1 ? matchingSideOutcomes[0] : void 0;
|
|
24763
|
-
const nextOutcome = (_b2 = matchingSideOutcome != null ? matchingSideOutcome : previousOutcomeIndex >= 0 ? market.venueMarketOutcomes[previousOutcomeIndex] : void 0) != null ? _b2 : market.venueMarketOutcomes[0];
|
|
24764
25102
|
if (nextOutcome) {
|
|
24765
|
-
tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(
|
|
25103
|
+
tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(targetMarket.id, nextOutcome.id);
|
|
24766
25104
|
onOutcomeSelect == null ? void 0 : onOutcomeSelect(group.id, {
|
|
24767
|
-
marketId:
|
|
25105
|
+
marketId: targetMarket.id,
|
|
24768
25106
|
outcomeId: nextOutcome.id
|
|
24769
25107
|
});
|
|
24770
25108
|
} else {
|
|
24771
|
-
tradingContext == null ? void 0 : tradingContext.selectMarket(
|
|
25109
|
+
tradingContext == null ? void 0 : tradingContext.selectMarket(targetMarket.id, targetMarket);
|
|
24772
25110
|
}
|
|
24773
25111
|
};
|
|
24774
25112
|
return /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
@@ -24791,7 +25129,7 @@ var SportsMarketCard = ({
|
|
|
24791
25129
|
stops: slide.stops.map((stop) => ({
|
|
24792
25130
|
value: stop.value,
|
|
24793
25131
|
venues: stop.venues,
|
|
24794
|
-
disabled: stop.market.status !==
|
|
25132
|
+
disabled: stop.market.status !== import_hooks65.MarketStatus.open
|
|
24795
25133
|
})),
|
|
24796
25134
|
selectedIndex: selectedLineIndex,
|
|
24797
25135
|
onSelect: handleLineSelect,
|
|
@@ -24878,7 +25216,7 @@ var SportsTabButton = ({
|
|
|
24878
25216
|
);
|
|
24879
25217
|
};
|
|
24880
25218
|
var SportsMarketsLoadingState = () => {
|
|
24881
|
-
const labels = (0,
|
|
25219
|
+
const labels = (0, import_hooks66.useLabels)();
|
|
24882
25220
|
return /* @__PURE__ */ (0, import_jsx_runtime162.jsxs)(
|
|
24883
25221
|
"div",
|
|
24884
25222
|
{
|
|
@@ -24916,13 +25254,13 @@ var SportsMarkets = ({
|
|
|
24916
25254
|
midpointsResult
|
|
24917
25255
|
}) => {
|
|
24918
25256
|
var _a, _b;
|
|
24919
|
-
const labels = (0,
|
|
24920
|
-
const tradingContext = (0,
|
|
25257
|
+
const labels = (0, import_hooks66.useLabels)();
|
|
25258
|
+
const tradingContext = (0, import_hooks66.useEventTradingContext)();
|
|
24921
25259
|
const hasAggKey = Boolean(event.aggKey);
|
|
24922
|
-
const gameMarketsQuery = (0,
|
|
25260
|
+
const gameMarketsQuery = (0, import_hooks66.useVenueMarkets)({
|
|
24923
25261
|
aggKey: event.aggKey ? [event.aggKey] : void 0,
|
|
24924
25262
|
limit: 100,
|
|
24925
|
-
status:
|
|
25263
|
+
status: import_hooks66.MarketStatus.open,
|
|
24926
25264
|
enabled: hasAggKey
|
|
24927
25265
|
});
|
|
24928
25266
|
const {
|
|
@@ -24958,7 +25296,7 @@ var SportsMarkets = ({
|
|
|
24958
25296
|
const [stableMarketsByTab, setStableMarketsByTab] = (0, import_react41.useState)({});
|
|
24959
25297
|
const activeTabLabel = resolveSportsSectionLabel(labels, activeTab);
|
|
24960
25298
|
const sectionFilters = resolveSportsSectionFilters(activeTab);
|
|
24961
|
-
const sectionMarketsQuery = (0,
|
|
25299
|
+
const sectionMarketsQuery = (0, import_hooks66.useVenueMarkets)({
|
|
24962
25300
|
aggKey: event.aggKey ? [event.aggKey] : void 0,
|
|
24963
25301
|
sportsMarketType: sectionFilters.sportsMarketType,
|
|
24964
25302
|
period: sectionFilters.period,
|
|
@@ -24968,7 +25306,7 @@ var SportsMarkets = ({
|
|
|
24968
25306
|
// heavy tab (e.g. "Other" spans other/team_props/player_props/specials/
|
|
24969
25307
|
// completion — hundreds of markets on prop-rich events) from ~15 calls to 1-3.
|
|
24970
25308
|
limit: 100,
|
|
24971
|
-
status:
|
|
25309
|
+
status: import_hooks66.MarketStatus.open,
|
|
24972
25310
|
enabled: hasAggKey
|
|
24973
25311
|
});
|
|
24974
25312
|
const {
|
|
@@ -25054,7 +25392,7 @@ var SportsMarkets = ({
|
|
|
25054
25392
|
return;
|
|
25055
25393
|
}
|
|
25056
25394
|
setExpandedGroupId(groupId);
|
|
25057
|
-
if ((0,
|
|
25395
|
+
if ((0, import_hooks66.resolveMarketTradingState)(market).isTradingDisabled) return;
|
|
25058
25396
|
if (market.id !== (tradingContext == null ? void 0 : tradingContext.selectedMarketId)) {
|
|
25059
25397
|
tradingContext == null ? void 0 : tradingContext.selectMarket(market.id, market);
|
|
25060
25398
|
}
|
|
@@ -25158,7 +25496,7 @@ var SportsEventMarketPage = ({
|
|
|
25158
25496
|
sectionMarketsByKey
|
|
25159
25497
|
});
|
|
25160
25498
|
}, [event, sectionMarketsByKey]);
|
|
25161
|
-
const eventTradingState = (0, import_react42.useMemo)(() => (0,
|
|
25499
|
+
const eventTradingState = (0, import_react42.useMemo)(() => (0, import_hooks67.resolveEventTradingState)(composedEvent), [composedEvent]);
|
|
25162
25500
|
const hasSportsSections = (0, import_react42.useMemo)(
|
|
25163
25501
|
() => resolveVisibleSportsSectionTabs(event).length > 0,
|
|
25164
25502
|
[event]
|
|
@@ -25168,12 +25506,12 @@ var SportsEventMarketPage = ({
|
|
|
25168
25506
|
});
|
|
25169
25507
|
const {
|
|
25170
25508
|
trading: { executionMode: configuredExecutionMode }
|
|
25171
|
-
} = (0,
|
|
25509
|
+
} = (0, import_hooks67.useSdkUiConfig)();
|
|
25172
25510
|
const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
|
|
25173
25511
|
const [isMobileTradeOpen, setIsMobileTradeOpen] = (0, import_react42.useState)(false);
|
|
25174
25512
|
const isMobileViewport = useIsMobileEventMarketViewport(SPORTS_EVENT_MARKET_MEDIA_QUERY);
|
|
25175
|
-
const tradingContext = (0,
|
|
25176
|
-
const midpointsResult = (0,
|
|
25513
|
+
const tradingContext = (0, import_hooks67.useEventTradingContext)();
|
|
25514
|
+
const midpointsResult = (0, import_hooks67.useMidpoints)(composedEvent.venueMarkets);
|
|
25177
25515
|
const internalResolvedClaim = useResolvedMarketClaim({
|
|
25178
25516
|
market: eventTradingState.primaryMarket,
|
|
25179
25517
|
enabled: eventTradingState.kind === "resolved",
|
|
@@ -25185,7 +25523,7 @@ var SportsEventMarketPage = ({
|
|
|
25185
25523
|
(0, import_react42.useEffect)(() => {
|
|
25186
25524
|
return () => {
|
|
25187
25525
|
var _a;
|
|
25188
|
-
(_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef,
|
|
25526
|
+
(_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, import_hooks67.TradeSide.Buy);
|
|
25189
25527
|
};
|
|
25190
25528
|
}, []);
|
|
25191
25529
|
const handleSectionMarketsChange = (0, import_react42.useCallback)(
|
|
@@ -25357,22 +25695,22 @@ var EventMarketPageContent = ({
|
|
|
25357
25695
|
resolvedClaim,
|
|
25358
25696
|
onBeforePrimaryAction
|
|
25359
25697
|
}) => {
|
|
25360
|
-
const eventTradingState = (0, import_react43.useMemo)(() => (0,
|
|
25698
|
+
const eventTradingState = (0, import_react43.useMemo)(() => (0, import_hooks68.resolveEventTradingState)(event), [event]);
|
|
25361
25699
|
const stickyOrderPanelState = resolveEventMarketPageStickyState({
|
|
25362
25700
|
stickyOrderPanel
|
|
25363
25701
|
});
|
|
25364
25702
|
const {
|
|
25365
25703
|
trading: { executionMode: configuredExecutionMode }
|
|
25366
|
-
} = (0,
|
|
25704
|
+
} = (0, import_hooks68.useSdkUiConfig)();
|
|
25367
25705
|
const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
|
|
25368
25706
|
const [isMobileTradeOpen, setIsMobileTradeOpen] = (0, import_react43.useState)(false);
|
|
25369
25707
|
const isMobileViewport = useIsMobileEventMarketViewport();
|
|
25370
|
-
const tradingContext = (0,
|
|
25708
|
+
const tradingContext = (0, import_hooks68.useEventTradingContext)();
|
|
25371
25709
|
const eventDetailVenueMarkets = (0, import_react43.useMemo)(
|
|
25372
25710
|
() => normalizeVenueMarketCluster(event.venueMarkets),
|
|
25373
25711
|
[event.venueMarkets]
|
|
25374
25712
|
);
|
|
25375
|
-
const midpointsResult = (0,
|
|
25713
|
+
const midpointsResult = (0, import_hooks68.useMidpoints)(eventDetailVenueMarkets);
|
|
25376
25714
|
const internalResolvedClaim = useResolvedMarketClaim({
|
|
25377
25715
|
market: eventTradingState.primaryMarket,
|
|
25378
25716
|
enabled: eventTradingState.kind === "resolved",
|
|
@@ -25384,7 +25722,7 @@ var EventMarketPageContent = ({
|
|
|
25384
25722
|
(0, import_react43.useEffect)(() => {
|
|
25385
25723
|
return () => {
|
|
25386
25724
|
var _a;
|
|
25387
|
-
(_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef,
|
|
25725
|
+
(_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, import_hooks68.TradeSide.Buy);
|
|
25388
25726
|
};
|
|
25389
25727
|
}, []);
|
|
25390
25728
|
if (!event.venueMarkets.length) {
|
|
@@ -25518,14 +25856,14 @@ var EventMarketPage = (props) => {
|
|
|
25518
25856
|
var _a;
|
|
25519
25857
|
const {
|
|
25520
25858
|
features: { showSportsMarkets }
|
|
25521
|
-
} = (0,
|
|
25859
|
+
} = (0, import_hooks68.useSdkUiConfig)();
|
|
25522
25860
|
const hasEventProp = "event" in props && !!props.event;
|
|
25523
25861
|
const {
|
|
25524
25862
|
event: fetchedEvent,
|
|
25525
25863
|
error: eventError,
|
|
25526
25864
|
isLoading: isFetchingEvent,
|
|
25527
25865
|
isEnriching
|
|
25528
|
-
} = (0,
|
|
25866
|
+
} = (0, import_hooks68.useEnrichedVenueEvent)({
|
|
25529
25867
|
eventId: hasEventProp ? "" : (_a = props.eventId) != null ? _a : "",
|
|
25530
25868
|
enabled: !props.isLoading && !hasEventProp && !!props.eventId
|
|
25531
25869
|
});
|
|
@@ -25712,14 +26050,14 @@ var HomeSearchResults = ({
|
|
|
25712
26050
|
onEventClick,
|
|
25713
26051
|
onMarketClick
|
|
25714
26052
|
}) => {
|
|
25715
|
-
const labels = (0,
|
|
25716
|
-
const { search: searchConfig } = (0,
|
|
25717
|
-
const { disabledVenues } = (0,
|
|
26053
|
+
const labels = (0, import_hooks69.useLabels)();
|
|
26054
|
+
const { search: searchConfig } = (0, import_hooks69.useSdkUiConfig)();
|
|
26055
|
+
const { disabledVenues } = (0, import_hooks69.useAppConfig)();
|
|
25718
26056
|
const [activeVenueTabValue, setActiveVenueTabValue] = (0, import_react46.useState)("all");
|
|
25719
26057
|
const eventListTabs = useEventListTabs();
|
|
25720
26058
|
const { headerRef, titleRef, shouldUseSelectOverflow } = useEventListTabsHeaderOverflow(eventListTabs);
|
|
25721
26059
|
const visibleVenues = (0, import_react46.useMemo)(
|
|
25722
|
-
() => disabledVenues.length === 0 ? void 0 : (0,
|
|
26060
|
+
() => disabledVenues.length === 0 ? void 0 : (0, import_hooks69.getVisibleVenueIdsByConfig)(import_sdk23.VENUES, disabledVenues),
|
|
25723
26061
|
[disabledVenues]
|
|
25724
26062
|
);
|
|
25725
26063
|
const activeVenueTab = (0, import_react46.useMemo)(() => {
|
|
@@ -25737,7 +26075,7 @@ var HomeSearchResults = ({
|
|
|
25737
26075
|
hasNextPage,
|
|
25738
26076
|
isFetchingNextPage,
|
|
25739
26077
|
isPlaceholderData
|
|
25740
|
-
} = (0,
|
|
26078
|
+
} = (0, import_hooks69.useSearch)({
|
|
25741
26079
|
q: query,
|
|
25742
26080
|
type: "events",
|
|
25743
26081
|
categoryIds: activeTabValue === ALL_CATEGORIES_TAB_VALUE ? void 0 : activeCategoryTab == null ? void 0 : activeCategoryTab.categoryIds,
|
|
@@ -25765,7 +26103,7 @@ var HomeSearchResults = ({
|
|
|
25765
26103
|
const visibleMidpointVenueMarketIds = (0, import_react46.useMemo)(() => {
|
|
25766
26104
|
return collectVisibleVenueMarketIds(visibleVenueMarkets);
|
|
25767
26105
|
}, [visibleVenueMarkets]);
|
|
25768
|
-
const { midpointRows: sharedMidpointRows, isLoading: isSharedMidpointsLoading } = (0,
|
|
26106
|
+
const { midpointRows: sharedMidpointRows, isLoading: isSharedMidpointsLoading } = (0, import_hooks69.useVenueMarketMidpoints)({
|
|
25769
26107
|
venueMarketIds: visibleMidpointVenueMarketIds,
|
|
25770
26108
|
enabled: visibleMidpointVenueMarketIds.length > 0
|
|
25771
26109
|
});
|
|
@@ -25914,7 +26252,7 @@ var HomePage = ({
|
|
|
25914
26252
|
stickyOrderPanel
|
|
25915
26253
|
}) => {
|
|
25916
26254
|
var _a, _b, _c, _d;
|
|
25917
|
-
const labels = (0,
|
|
26255
|
+
const labels = (0, import_hooks69.useLabels)();
|
|
25918
26256
|
const {
|
|
25919
26257
|
search: {
|
|
25920
26258
|
value: searchValue,
|
|
@@ -25924,8 +26262,8 @@ var HomePage = ({
|
|
|
25924
26262
|
onSelect: onSelectEventInternal
|
|
25925
26263
|
},
|
|
25926
26264
|
trading: { executionMode }
|
|
25927
|
-
} = (0,
|
|
25928
|
-
const { capture, consume } = (0,
|
|
26265
|
+
} = (0, import_hooks69.useSdkUiConfig)();
|
|
26266
|
+
const { capture, consume } = (0, import_hooks69.useEventListState)();
|
|
25929
26267
|
const [snapshot] = (0, import_react46.useState)(() => consume());
|
|
25930
26268
|
const eventListStateRef = (0, import_react46.useRef)(null);
|
|
25931
26269
|
const handleSelectEvent = (0, import_react46.useCallback)(
|
|
@@ -25995,7 +26333,7 @@ var HomePage = ({
|
|
|
25995
26333
|
}, [isShowingAllResults, normalizedSearchValue, selectedEvent]);
|
|
25996
26334
|
const resolvedSelectedEvent = selectedEvent != null ? selectedEvent : stickySelectedEvent;
|
|
25997
26335
|
const resolvedAllCategoryTabLabel = allCategoryTabLabel === DEFAULT_ALL_CATEGORY_TAB_LABEL ? labels.home.trending : allCategoryTabLabel;
|
|
25998
|
-
const { categories } = (0,
|
|
26336
|
+
const { categories } = (0, import_hooks69.useCategories)({
|
|
25999
26337
|
limit: categoriesLimit,
|
|
26000
26338
|
enabled: !hasCustomTabs
|
|
26001
26339
|
});
|
|
@@ -26205,7 +26543,7 @@ var HomePage = ({
|
|
|
26205
26543
|
HomePage.displayName = "HomePage";
|
|
26206
26544
|
|
|
26207
26545
|
// src/pages/user-profile/index.tsx
|
|
26208
|
-
var
|
|
26546
|
+
var import_hooks76 = require("@agg-build/hooks");
|
|
26209
26547
|
var import_sdk25 = require("@agg-build/sdk");
|
|
26210
26548
|
var import_dayjs9 = __toESM(require("dayjs"));
|
|
26211
26549
|
var import_react48 = require("react");
|
|
@@ -26231,7 +26569,7 @@ var formatChainIdLabel = (chainId) => {
|
|
|
26231
26569
|
};
|
|
26232
26570
|
|
|
26233
26571
|
// src/pages/user-profile/components/available-balance-card.tsx
|
|
26234
|
-
var
|
|
26572
|
+
var import_hooks70 = require("@agg-build/hooks");
|
|
26235
26573
|
var import_jsx_runtime166 = require("react/jsx-runtime");
|
|
26236
26574
|
var BASE_URL = "https://assets.snagsolutions.io";
|
|
26237
26575
|
var CHAIN_ID_TO_ICON_URL = {
|
|
@@ -26287,7 +26625,7 @@ var AvailableBalanceCard = ({
|
|
|
26287
26625
|
isLoading = false,
|
|
26288
26626
|
className
|
|
26289
26627
|
}) => {
|
|
26290
|
-
const labels = (0,
|
|
26628
|
+
const labels = (0, import_hooks70.useLabels)();
|
|
26291
26629
|
const balanceLabels = labels.userProfile.balance;
|
|
26292
26630
|
const resolvedLabel = label2 != null ? label2 : balanceLabels.availableBalance;
|
|
26293
26631
|
const hasPaperBalance = chains.some(isPaperChain);
|
|
@@ -26447,7 +26785,7 @@ var AvailableBalanceCard = ({
|
|
|
26447
26785
|
AvailableBalanceCard.displayName = "AvailableBalanceCard";
|
|
26448
26786
|
|
|
26449
26787
|
// src/pages/user-profile/components/claim-activity-breakdown-modal.tsx
|
|
26450
|
-
var
|
|
26788
|
+
var import_hooks71 = require("@agg-build/hooks");
|
|
26451
26789
|
var import_sdk24 = require("@agg-build/sdk");
|
|
26452
26790
|
var import_jsx_runtime167 = require("react/jsx-runtime");
|
|
26453
26791
|
var CLAIM_VENUE_LABELS = {
|
|
@@ -26466,7 +26804,7 @@ var ClaimActivityBreakdownModal = ({
|
|
|
26466
26804
|
onTransactionSelect
|
|
26467
26805
|
}) => {
|
|
26468
26806
|
var _a;
|
|
26469
|
-
const labels = (0,
|
|
26807
|
+
const labels = (0, import_hooks71.useLabels)();
|
|
26470
26808
|
return /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
|
|
26471
26809
|
Modal,
|
|
26472
26810
|
{
|
|
@@ -26575,7 +26913,7 @@ var ClaimActivityBreakdownModal = ({
|
|
|
26575
26913
|
};
|
|
26576
26914
|
|
|
26577
26915
|
// src/pages/user-profile/components/positions-activity.tsx
|
|
26578
|
-
var
|
|
26916
|
+
var import_hooks74 = require("@agg-build/hooks");
|
|
26579
26917
|
var import_react47 = require("react");
|
|
26580
26918
|
|
|
26581
26919
|
// src/pages/user-profile/user-profile.constants.ts
|
|
@@ -26625,17 +26963,19 @@ var parsePercentLabel = (label2) => {
|
|
|
26625
26963
|
const parsed = Number(match[1].replace(/,/g, ""));
|
|
26626
26964
|
return Number.isFinite(parsed) ? parsed : null;
|
|
26627
26965
|
};
|
|
26628
|
-
var formatCurrency = (value) => {
|
|
26966
|
+
var formatCurrency = (value, formatCurrencyOverride) => {
|
|
26629
26967
|
if (!isFiniteNumber(value)) return missingLabel;
|
|
26968
|
+
if (formatCurrencyOverride) return formatCurrencyOverride(value);
|
|
26630
26969
|
return usdFormatter.format(value);
|
|
26631
26970
|
};
|
|
26632
|
-
var formatSignedCurrency = (value) => {
|
|
26971
|
+
var formatSignedCurrency = (value, formatCurrencyOverride) => {
|
|
26633
26972
|
if (!isFiniteNumber(value)) return missingLabel;
|
|
26634
|
-
if (value === 0) return
|
|
26635
|
-
return `${value > 0 ? "+" : "-"}${
|
|
26973
|
+
if (value === 0) return formatCurrency(0, formatCurrencyOverride);
|
|
26974
|
+
return `${value > 0 ? "+" : "-"}${formatCurrency(Math.abs(value), formatCurrencyOverride)}`;
|
|
26636
26975
|
};
|
|
26637
|
-
var formatPriceCents2 = (value) => {
|
|
26976
|
+
var formatPriceCents2 = (value, formatPrice) => {
|
|
26638
26977
|
if (!isFiniteNumber(value)) return missingLabel;
|
|
26978
|
+
if (formatPrice) return formatPrice(value);
|
|
26639
26979
|
return `${Math.round(value * 100)}\xA2`;
|
|
26640
26980
|
};
|
|
26641
26981
|
var formatSignedPercent = (value) => {
|
|
@@ -26730,7 +27070,8 @@ var getPositionTone = (value) => {
|
|
|
26730
27070
|
if (!isFiniteNumber(value) || value === 0) return "neutral";
|
|
26731
27071
|
return value > 0 ? "positive" : "negative";
|
|
26732
27072
|
};
|
|
26733
|
-
var toPositionRowViewModel = (position, labels = defaultLabels2) => {
|
|
27073
|
+
var toPositionRowViewModel = (position, labels = defaultLabels2, formatters = {}) => {
|
|
27074
|
+
const { formatCurrency: currency, formatPrice: price } = formatters;
|
|
26734
27075
|
const positionStatus = resolvePositionStatus(position);
|
|
26735
27076
|
const currentValue = getCurrentValue(position);
|
|
26736
27077
|
const currentPnl = getPnlValue(position, currentValue);
|
|
@@ -26748,20 +27089,20 @@ var toPositionRowViewModel = (position, labels = defaultLabels2) => {
|
|
|
26748
27089
|
resolutionLabel: position.resolutionLabel || position.outcomeLabel || missingLabel,
|
|
26749
27090
|
venueShareBreakdown: position.venueShareBreakdown,
|
|
26750
27091
|
totalTraded: {
|
|
26751
|
-
primaryLabel: formatCurrency(getTotalTradedValue(position)),
|
|
26752
|
-
averageLabel: `${labels.avgPrefix} ${formatPriceCents2(getAveragePrice(position))}`
|
|
27092
|
+
primaryLabel: formatCurrency(getTotalTradedValue(position), currency),
|
|
27093
|
+
averageLabel: `${labels.avgPrefix} ${formatPriceCents2(getAveragePrice(position), price)}`
|
|
26753
27094
|
},
|
|
26754
27095
|
currentValue: {
|
|
26755
|
-
primaryLabel: formatCurrency(currentValue),
|
|
26756
|
-
deltaLabel: formatSignedCurrency(currentPnl),
|
|
26757
|
-
priceLabel: `${labels.nowPrefix} ${formatPriceCents2(getCurrentPrice(position))}`,
|
|
27096
|
+
primaryLabel: formatCurrency(currentValue, currency),
|
|
27097
|
+
deltaLabel: formatSignedCurrency(currentPnl, currency),
|
|
27098
|
+
priceLabel: `${labels.nowPrefix} ${formatPriceCents2(getCurrentPrice(position), price)}`,
|
|
26758
27099
|
percentLabel: formatSignedPercent(currentPercent),
|
|
26759
27100
|
tone: getPositionTone(currentPnl)
|
|
26760
27101
|
},
|
|
26761
27102
|
payout: {
|
|
26762
|
-
primaryLabel: formatCurrency(finalPayout),
|
|
26763
|
-
deltaLabel: formatSignedCurrency(payoutPnl),
|
|
26764
|
-
priceLabel: `${labels.finalPrefix} ${formatPriceCents2(getFinalPrice(position))}`,
|
|
27103
|
+
primaryLabel: formatCurrency(finalPayout, currency),
|
|
27104
|
+
deltaLabel: formatSignedCurrency(payoutPnl, currency),
|
|
27105
|
+
priceLabel: `${labels.finalPrefix} ${formatPriceCents2(getFinalPrice(position), price)}`,
|
|
26765
27106
|
percentLabel: formatSignedPercent(payoutPercent),
|
|
26766
27107
|
tone: getPositionTone(payoutPnl)
|
|
26767
27108
|
},
|
|
@@ -27363,11 +27704,24 @@ var EmptyState = ({ title: title2, description, className }) => {
|
|
|
27363
27704
|
EmptyState.displayName = "EmptyState";
|
|
27364
27705
|
|
|
27365
27706
|
// src/pages/user-profile/components/open-order-row.tsx
|
|
27366
|
-
var
|
|
27707
|
+
var import_hooks72 = require("@agg-build/hooks");
|
|
27367
27708
|
var import_jsx_runtime170 = require("react/jsx-runtime");
|
|
27368
27709
|
var shouldUseNativeLinkNavigation2 = (event) => {
|
|
27369
27710
|
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
|
|
27370
27711
|
};
|
|
27712
|
+
var CANCELLABLE_LIMIT_ORDER_STATUSES = /* @__PURE__ */ new Set([
|
|
27713
|
+
"submitted",
|
|
27714
|
+
"open",
|
|
27715
|
+
"partially_filled_open",
|
|
27716
|
+
"cancel_pending"
|
|
27717
|
+
]);
|
|
27718
|
+
var canCancelOpenOrder = (order) => {
|
|
27719
|
+
const status = order.status.trim().toLowerCase();
|
|
27720
|
+
if (status === "pending" && !order.dagRunId) return true;
|
|
27721
|
+
const isLimitOrder = order.orderType === "limit" || order.limitPriceLabel != null;
|
|
27722
|
+
if (!isLimitOrder) return false;
|
|
27723
|
+
return CANCELLABLE_LIMIT_ORDER_STATUSES.has(status);
|
|
27724
|
+
};
|
|
27371
27725
|
var OpenOrderRow = ({
|
|
27372
27726
|
order,
|
|
27373
27727
|
href,
|
|
@@ -27382,7 +27736,7 @@ var OpenOrderRow = ({
|
|
|
27382
27736
|
expirationHeader
|
|
27383
27737
|
}) => {
|
|
27384
27738
|
var _a, _b, _c, _d;
|
|
27385
|
-
const labels = (0,
|
|
27739
|
+
const labels = (0, import_hooks72.useLabels)().userProfile.openOrders;
|
|
27386
27740
|
const resolvedCancelLabel = cancelLabel != null ? cancelLabel : labels.cancel;
|
|
27387
27741
|
const resolvedCancelAriaLabel = cancelAriaLabel != null ? cancelAriaLabel : labels.cancelOrderAria(order.id);
|
|
27388
27742
|
const resolvedLimitPriceHeader = limitPriceHeader != null ? limitPriceHeader : labels.limitPriceHeader;
|
|
@@ -27403,9 +27757,7 @@ var OpenOrderRow = ({
|
|
|
27403
27757
|
event.stopPropagation();
|
|
27404
27758
|
onCancel == null ? void 0 : onCancel(order);
|
|
27405
27759
|
};
|
|
27406
|
-
const
|
|
27407
|
-
const isLimitOrder = order.orderType === "limit";
|
|
27408
|
-
const canCancel = status === "open" || status === "partially_filled_open" || status === "cancel_pending" || status === "submitted" && isLimitOrder || status === "pending" && !order.dagRunId;
|
|
27760
|
+
const canCancel = canCancelOpenOrder(order);
|
|
27409
27761
|
const Wrapper = href ? "a" : "div";
|
|
27410
27762
|
const wrapperProps = href ? {
|
|
27411
27763
|
href,
|
|
@@ -27437,7 +27789,7 @@ var OpenOrderRow = ({
|
|
|
27437
27789
|
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)("div", { className: "agg-open-order-image flex h-10 w-10 shrink-0 items-center justify-center lg:h-15 lg:w-15", children: /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
|
|
27438
27790
|
RemoteImage,
|
|
27439
27791
|
{
|
|
27440
|
-
src: (0,
|
|
27792
|
+
src: (0, import_hooks72.optimizedImageUrl)(order.thumbnailSrc, 60),
|
|
27441
27793
|
alt: "",
|
|
27442
27794
|
className: "h-full w-full rounded-agg-sm object-cover"
|
|
27443
27795
|
}
|
|
@@ -27492,7 +27844,7 @@ var OpenOrderRow = ({
|
|
|
27492
27844
|
OpenOrderRow.displayName = "OpenOrderRow";
|
|
27493
27845
|
|
|
27494
27846
|
// src/pages/user-profile/components/position-row.tsx
|
|
27495
|
-
var
|
|
27847
|
+
var import_hooks73 = require("@agg-build/hooks");
|
|
27496
27848
|
var import_jsx_runtime171 = require("react/jsx-runtime");
|
|
27497
27849
|
var shouldUseNativeLinkNavigation3 = (event) => {
|
|
27498
27850
|
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
|
|
@@ -27630,12 +27982,17 @@ var PositionRow = ({
|
|
|
27630
27982
|
onClaim,
|
|
27631
27983
|
isClaiming = false
|
|
27632
27984
|
}) => {
|
|
27633
|
-
const labels = (0,
|
|
27634
|
-
const
|
|
27635
|
-
|
|
27636
|
-
|
|
27637
|
-
|
|
27638
|
-
|
|
27985
|
+
const labels = (0, import_hooks73.useLabels)().userProfile.positions;
|
|
27986
|
+
const { formatCurrency: formatCurrency2, formatPrice } = (0, import_hooks73.useAggUiConfig)().formatting;
|
|
27987
|
+
const model = toPositionRowViewModel(
|
|
27988
|
+
position,
|
|
27989
|
+
{
|
|
27990
|
+
avgPrefix: labels.avgPrefix,
|
|
27991
|
+
nowPrefix: labels.nowPrefix,
|
|
27992
|
+
finalPrefix: labels.finalPrefix
|
|
27993
|
+
},
|
|
27994
|
+
{ formatCurrency: formatCurrency2, formatPrice }
|
|
27995
|
+
);
|
|
27639
27996
|
const isClosed = (variant != null ? variant : model.bucket) === "closed";
|
|
27640
27997
|
const handleClaim = (event) => {
|
|
27641
27998
|
event.preventDefault();
|
|
@@ -27684,7 +28041,7 @@ var PositionRow = ({
|
|
|
27684
28041
|
/* @__PURE__ */ (0, import_jsx_runtime171.jsx)("div", { className: "agg-position-image flex h-10 w-10 shrink-0 items-center justify-center md:h-15 md:w-15", children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
|
|
27685
28042
|
RemoteImage,
|
|
27686
28043
|
{
|
|
27687
|
-
src: (0,
|
|
28044
|
+
src: (0, import_hooks73.optimizedImageUrl)(model.thumbnailSrc, 60),
|
|
27688
28045
|
alt: "",
|
|
27689
28046
|
className: "h-full w-full rounded-agg-sm object-cover"
|
|
27690
28047
|
}
|
|
@@ -27853,9 +28210,10 @@ var PositionsActivity = ({
|
|
|
27853
28210
|
initialPositionFilter = "active",
|
|
27854
28211
|
className
|
|
27855
28212
|
}) => {
|
|
27856
|
-
const userProfileLabels = (0,
|
|
28213
|
+
const userProfileLabels = (0, import_hooks74.useLabels)().userProfile;
|
|
27857
28214
|
const positionsLabels = userProfileLabels.positions;
|
|
27858
28215
|
const openOrdersLabels = userProfileLabels.openOrders;
|
|
28216
|
+
const { formatCurrency: formatCurrency2, formatPrice } = (0, import_hooks74.useAggUiConfig)().formatting;
|
|
27859
28217
|
const tabItems = (0, import_react47.useMemo)(
|
|
27860
28218
|
() => getTabItems(userProfileLabels.tabs, showOpenOrders),
|
|
27861
28219
|
[showOpenOrders, userProfileLabels.tabs]
|
|
@@ -27934,14 +28292,25 @@ var PositionsActivity = ({
|
|
|
27934
28292
|
title: position.title,
|
|
27935
28293
|
thumbnailSrc: position.thumbnailSrc,
|
|
27936
28294
|
metaPrimary: position.outcomeLabel,
|
|
27937
|
-
metaSecondary: toPositionRowViewModel(
|
|
27938
|
-
|
|
27939
|
-
|
|
27940
|
-
|
|
27941
|
-
|
|
28295
|
+
metaSecondary: toPositionRowViewModel(
|
|
28296
|
+
position,
|
|
28297
|
+
{
|
|
28298
|
+
avgPrefix: positionsLabels.avgPrefix,
|
|
28299
|
+
nowPrefix: positionsLabels.nowPrefix,
|
|
28300
|
+
finalPrefix: positionsLabels.finalPrefix
|
|
28301
|
+
},
|
|
28302
|
+
{ formatCurrency: formatCurrency2, formatPrice }
|
|
28303
|
+
).currentValue.primaryLabel,
|
|
27942
28304
|
raw: position
|
|
27943
28305
|
}));
|
|
27944
|
-
}, [
|
|
28306
|
+
}, [
|
|
28307
|
+
filteredPositions,
|
|
28308
|
+
formatCurrency2,
|
|
28309
|
+
formatPrice,
|
|
28310
|
+
isPositionsTab,
|
|
28311
|
+
positionsLabels,
|
|
28312
|
+
searchValue
|
|
28313
|
+
]);
|
|
27945
28314
|
const handleSearchChange = (event) => {
|
|
27946
28315
|
setSearchValue(event.target.value);
|
|
27947
28316
|
};
|
|
@@ -28112,7 +28481,7 @@ var PositionsActivity = ({
|
|
|
28112
28481
|
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
|
|
28113
28482
|
"img",
|
|
28114
28483
|
{
|
|
28115
|
-
src: (0,
|
|
28484
|
+
src: (0, import_hooks74.optimizedImageUrl)(item.thumbnailSrc, 48),
|
|
28116
28485
|
alt: "",
|
|
28117
28486
|
className: "size-12 shrink-0 rounded-agg-lg object-cover"
|
|
28118
28487
|
}
|
|
@@ -28433,7 +28802,7 @@ var buildAggTxExplorerHref = (chainId, txHash) => {
|
|
|
28433
28802
|
};
|
|
28434
28803
|
|
|
28435
28804
|
// src/pages/user-profile/components/user-info-card.tsx
|
|
28436
|
-
var
|
|
28805
|
+
var import_hooks75 = require("@agg-build/hooks");
|
|
28437
28806
|
|
|
28438
28807
|
// src/primitives/conditional-wrapper.tsx
|
|
28439
28808
|
var ConditionalWrapper = ({
|
|
@@ -28500,7 +28869,7 @@ var UserInfoCard = ({
|
|
|
28500
28869
|
className
|
|
28501
28870
|
}) => {
|
|
28502
28871
|
var _a;
|
|
28503
|
-
const labels = (0,
|
|
28872
|
+
const labels = (0, import_hooks75.useLabels)();
|
|
28504
28873
|
const wallets = (_a = user.connectedWallets) != null ? _a : [];
|
|
28505
28874
|
const hasWallets = wallets.length > 0;
|
|
28506
28875
|
return /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)(
|
|
@@ -28516,7 +28885,7 @@ var UserInfoCard = ({
|
|
|
28516
28885
|
/* @__PURE__ */ (0, import_jsx_runtime175.jsx)("div", { className: "agg-profile-avatar shrink-0", children: user.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
|
|
28517
28886
|
RemoteImage,
|
|
28518
28887
|
{
|
|
28519
|
-
src: (0,
|
|
28888
|
+
src: (0, import_hooks75.optimizedImageUrl)(user.avatarUrl, 120),
|
|
28520
28889
|
alt: user.username,
|
|
28521
28890
|
className: "h-20 w-20 rounded-full object-cover sm:h-[120px] sm:w-[120px]"
|
|
28522
28891
|
}
|
|
@@ -29136,16 +29505,16 @@ var UserProfilePage = ({
|
|
|
29136
29505
|
(0, import_react48.useEffect)(() => {
|
|
29137
29506
|
setIsHydrated(true);
|
|
29138
29507
|
}, []);
|
|
29139
|
-
const { user: currentUser, isAuthenticated } = (0,
|
|
29140
|
-
const { isDepositBlocked } = (0,
|
|
29141
|
-
const balanceState = (0,
|
|
29142
|
-
const labels = (0,
|
|
29508
|
+
const { user: currentUser, isAuthenticated } = (0, import_hooks76.useAggAuthState)();
|
|
29509
|
+
const { isDepositBlocked } = (0, import_hooks76.useGeoBlock)();
|
|
29510
|
+
const balanceState = (0, import_hooks76.useAggBalance)();
|
|
29511
|
+
const labels = (0, import_hooks76.useLabels)();
|
|
29143
29512
|
const {
|
|
29144
29513
|
features: { showLimitOrders },
|
|
29145
29514
|
trading: { executionMode: configuredExecutionMode }
|
|
29146
|
-
} = (0,
|
|
29147
|
-
const client = (0,
|
|
29148
|
-
const cancelOrderMutation = (0,
|
|
29515
|
+
} = (0, import_hooks76.useSdkUiConfig)();
|
|
29516
|
+
const client = (0, import_hooks76.useAggClient)();
|
|
29517
|
+
const cancelOrderMutation = (0, import_hooks76.useCancelManagedOrder)();
|
|
29149
29518
|
const toastContext = useOptionalToast();
|
|
29150
29519
|
const [internalCancellingIds, setInternalCancellingIds] = (0, import_react48.useState)({});
|
|
29151
29520
|
const { claim: startClaim, claimingKeys } = useClaimWinnings({
|
|
@@ -29166,13 +29535,13 @@ var UserProfilePage = ({
|
|
|
29166
29535
|
const [selectedClaimActivity, setSelectedClaimActivity] = (0, import_react48.useState)(null);
|
|
29167
29536
|
const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
|
|
29168
29537
|
const queryExecutionMode = resolvedExecutionMode === "paper" ? "paper" : void 0;
|
|
29169
|
-
const activePositionsQuery = (0,
|
|
29538
|
+
const activePositionsQuery = (0, import_hooks76.useExecutionPositions)({
|
|
29170
29539
|
enabled: shouldUseHookData && isAuthenticated,
|
|
29171
29540
|
status: "active",
|
|
29172
29541
|
limit: 25,
|
|
29173
29542
|
mode: queryExecutionMode
|
|
29174
29543
|
});
|
|
29175
|
-
const closedPositionsQuery = (0,
|
|
29544
|
+
const closedPositionsQuery = (0, import_hooks76.useExecutionPositions)({
|
|
29176
29545
|
enabled: shouldUseHookData && isAuthenticated,
|
|
29177
29546
|
status: "closed",
|
|
29178
29547
|
limit: 25,
|
|
@@ -29188,55 +29557,55 @@ var UserProfilePage = ({
|
|
|
29188
29557
|
(0, import_react48.useEffect)(() => {
|
|
29189
29558
|
setPositionFilter(initialPositionFilter);
|
|
29190
29559
|
}, [initialPositionFilter]);
|
|
29191
|
-
const ordersQuery = (0,
|
|
29560
|
+
const ordersQuery = (0, import_hooks76.useExecutionOrders)({
|
|
29192
29561
|
enabled: shouldUseHookData && isAuthenticated,
|
|
29193
29562
|
limit: 25,
|
|
29194
29563
|
mode: queryExecutionMode,
|
|
29195
29564
|
refetchIntervalMs: 5e3
|
|
29196
29565
|
});
|
|
29197
|
-
const pendingOpenOrdersQuery = (0,
|
|
29566
|
+
const pendingOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
|
|
29198
29567
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
29199
29568
|
status: OPEN_ORDER_QUERY_STATUSES[0],
|
|
29200
29569
|
limit: 25,
|
|
29201
29570
|
mode: queryExecutionMode
|
|
29202
29571
|
});
|
|
29203
|
-
const signingOpenOrdersQuery = (0,
|
|
29572
|
+
const signingOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
|
|
29204
29573
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
29205
29574
|
status: OPEN_ORDER_QUERY_STATUSES[1],
|
|
29206
29575
|
limit: 25,
|
|
29207
29576
|
mode: queryExecutionMode
|
|
29208
29577
|
});
|
|
29209
|
-
const pendingBridgeOpenOrdersQuery = (0,
|
|
29578
|
+
const pendingBridgeOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
|
|
29210
29579
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
29211
29580
|
status: OPEN_ORDER_QUERY_STATUSES[2],
|
|
29212
29581
|
limit: 25,
|
|
29213
29582
|
mode: queryExecutionMode
|
|
29214
29583
|
});
|
|
29215
|
-
const submittingOpenOrdersQuery = (0,
|
|
29584
|
+
const submittingOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
|
|
29216
29585
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
29217
29586
|
status: OPEN_ORDER_QUERY_STATUSES[3],
|
|
29218
29587
|
limit: 25,
|
|
29219
29588
|
mode: queryExecutionMode
|
|
29220
29589
|
});
|
|
29221
|
-
const submittedOpenOrdersQuery = (0,
|
|
29590
|
+
const submittedOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
|
|
29222
29591
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
29223
29592
|
status: OPEN_ORDER_QUERY_STATUSES[4],
|
|
29224
29593
|
limit: 25,
|
|
29225
29594
|
mode: queryExecutionMode
|
|
29226
29595
|
});
|
|
29227
|
-
const openOpenOrdersQuery = (0,
|
|
29596
|
+
const openOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
|
|
29228
29597
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
29229
29598
|
status: OPEN_ORDER_QUERY_STATUSES[5],
|
|
29230
29599
|
limit: 25,
|
|
29231
29600
|
mode: queryExecutionMode
|
|
29232
29601
|
});
|
|
29233
|
-
const partiallyFilledOpenOrdersQuery = (0,
|
|
29602
|
+
const partiallyFilledOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
|
|
29234
29603
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
29235
29604
|
status: OPEN_ORDER_QUERY_STATUSES[6],
|
|
29236
29605
|
limit: 25,
|
|
29237
29606
|
mode: queryExecutionMode
|
|
29238
29607
|
});
|
|
29239
|
-
const cancelPendingOpenOrdersQuery = (0,
|
|
29608
|
+
const cancelPendingOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
|
|
29240
29609
|
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
29241
29610
|
status: OPEN_ORDER_QUERY_STATUSES[7],
|
|
29242
29611
|
limit: 25,
|
|
@@ -29264,7 +29633,7 @@ var UserProfilePage = ({
|
|
|
29264
29633
|
submittingOpenOrdersQuery
|
|
29265
29634
|
]
|
|
29266
29635
|
);
|
|
29267
|
-
const activityQuery = (0,
|
|
29636
|
+
const activityQuery = (0, import_hooks76.useUserActivity)({
|
|
29268
29637
|
enabled: shouldUseHookData && isAuthenticated,
|
|
29269
29638
|
limit: 25
|
|
29270
29639
|
});
|
|
@@ -29351,7 +29720,7 @@ var UserProfilePage = ({
|
|
|
29351
29720
|
var _a2, _b2, _c, _d, _e, _f;
|
|
29352
29721
|
if (user) return user;
|
|
29353
29722
|
const fullUser = profileUser != null ? profileUser : currentUser;
|
|
29354
|
-
const walletAddress = (0,
|
|
29723
|
+
const walletAddress = (0, import_hooks76.getWalletAddressFromUserProfile)(fullUser);
|
|
29355
29724
|
const fallbackUsername = walletAddress && shortenAddress(walletAddress) || "username";
|
|
29356
29725
|
const twitterAccount = (_a2 = fullUser == null ? void 0 : fullUser.accounts) == null ? void 0 : _a2.find(
|
|
29357
29726
|
(account) => String(account.provider).toLowerCase() === "twitter"
|
|
@@ -29406,8 +29775,8 @@ var UserProfilePage = ({
|
|
|
29406
29775
|
const reserved = (_a2 = balanceState.reservedBalance) != null ? _a2 : 0;
|
|
29407
29776
|
return reserved > 0 ? formatUsd2(reserved) : void 0;
|
|
29408
29777
|
}, [balanceState.reservedBalance]);
|
|
29409
|
-
const { disabledVenues, isLoading: isAppConfigLoading } = (0,
|
|
29410
|
-
const isKalshiAvailable = (0,
|
|
29778
|
+
const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks76.useAppConfig)();
|
|
29779
|
+
const isKalshiAvailable = (0, import_hooks76.getVenueAvailabilityState)({
|
|
29411
29780
|
venueId: import_sdk25.Venue.kalshi,
|
|
29412
29781
|
disabledVenues,
|
|
29413
29782
|
isConfigLoading: isAppConfigLoading
|
|
@@ -29633,7 +30002,7 @@ var UserProfilePage = ({
|
|
|
29633
30002
|
(groups) => {
|
|
29634
30003
|
return groups.flatMap((group) => {
|
|
29635
30004
|
var _a2, _b2, _c, _d;
|
|
29636
|
-
const closedTotals = (0,
|
|
30005
|
+
const closedTotals = (0, import_hooks76.computeClosedPositionTotals)(group);
|
|
29637
30006
|
const winningOutcome = group.venueMarket.venueMarketOutcomes.find(
|
|
29638
30007
|
(outcome) => outcome.winner === true
|
|
29639
30008
|
);
|