@agg-build/ui 4.17.0 → 4.17.3
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-D2BTU7QI.mjs → chunk-7E4UXCEX.mjs} +223 -169
- package/dist/{chunk-QGONLJLE.mjs → chunk-B5ALKYD5.mjs} +210 -184
- package/dist/{chunk-RR44PSKH.mjs → chunk-BBDFSTIA.mjs} +3 -1
- package/dist/{chunk-M6U2RKBD.mjs → chunk-DSQSQ4RG.mjs} +127 -62
- package/dist/{chunk-5SCDQSNA.mjs → chunk-JI5KV4QI.mjs} +2 -2
- package/dist/{chunk-NIRCF54M.mjs → chunk-RZLM3M5R.mjs} +2 -2
- package/dist/{chunk-HFMKCV4L.mjs → chunk-TK62UB5F.mjs} +27 -16
- package/dist/events.js +29 -16
- package/dist/events.mjs +3 -3
- package/dist/index.js +1060 -930
- package/dist/index.mjs +9 -38
- package/dist/modals.js +212 -184
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +841 -684
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +3 -1
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +535 -442
- package/dist/trading.mjs +4 -4
- package/dist/types/auth/connect-button-view/connect-button-view.types.d.mts +0 -2
- package/dist/types/auth/connect-button-view/connect-button-view.types.d.ts +0 -2
- package/dist/types/auth/connect-button-view/index.d.mts +1 -1
- package/dist/types/auth/connect-button-view/index.d.ts +1 -1
- package/dist/types/pages/user-profile/components/available-balance-card.d.mts +3 -1
- package/dist/types/pages/user-profile/components/available-balance-card.d.ts +3 -1
- package/dist/types/pages/user-profile/cost-basis-display.d.mts +29 -0
- package/dist/types/pages/user-profile/cost-basis-display.d.ts +29 -0
- package/dist/types/pages/user-profile/user-profile.types.d.mts +8 -0
- package/dist/types/pages/user-profile/user-profile.types.d.ts +8 -0
- package/dist/types/primitives/modal/index.d.mts +1 -1
- package/dist/types/primitives/modal/index.d.ts +1 -1
- package/dist/types/primitives/modal/modal.types.d.mts +6 -0
- package/dist/types/primitives/modal/modal.types.d.ts +6 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +12 -1
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +12 -1
- package/package.json +3 -3
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
isErrorWithStatus,
|
|
13
13
|
useEventListTabs,
|
|
14
14
|
useEventListTabsHeaderOverflow
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-RZLM3M5R.mjs";
|
|
16
16
|
import {
|
|
17
17
|
DEPOSIT_MODAL_OPEN_EVENT,
|
|
18
18
|
PlaceOrder,
|
|
@@ -21,12 +21,12 @@ import {
|
|
|
21
21
|
formatChainIdLabel,
|
|
22
22
|
useClaimWinnings,
|
|
23
23
|
useResolvedMarketClaim
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-7E4UXCEX.mjs";
|
|
25
25
|
import {
|
|
26
26
|
getDisplayOutcomePrice,
|
|
27
27
|
resolveHeaderOutcomeItems,
|
|
28
28
|
resolveMarketFromVenueMarkets
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-TK62UB5F.mjs";
|
|
30
30
|
import {
|
|
31
31
|
AggErrorBoundary,
|
|
32
32
|
Button,
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
skeletonViews,
|
|
63
63
|
sortCategoriesForNavigation,
|
|
64
64
|
useOptionalToast
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-BBDFSTIA.mjs";
|
|
66
66
|
|
|
67
67
|
// src/pages/home/index.tsx
|
|
68
68
|
import {
|
|
@@ -3798,12 +3798,31 @@ import {
|
|
|
3798
3798
|
useLabels as useLabels13,
|
|
3799
3799
|
useSdkUiConfig as useSdkUiConfig4,
|
|
3800
3800
|
useUserActivity,
|
|
3801
|
-
useResolvedExecutionMode as useResolvedExecutionMode4
|
|
3801
|
+
useResolvedExecutionMode as useResolvedExecutionMode4,
|
|
3802
|
+
useVenueMarketMidpoints as useVenueMarketMidpoints2
|
|
3802
3803
|
} from "@agg-build/hooks";
|
|
3803
3804
|
import { Venue as Venue3 } from "@agg-build/sdk";
|
|
3804
3805
|
import dayjs from "dayjs";
|
|
3805
3806
|
import { useCallback as useCallback7, useEffect as useEffect11, useMemo as useMemo8, useRef as useRef10, useState as useState12 } from "react";
|
|
3806
3807
|
|
|
3808
|
+
// src/pages/user-profile/cost-basis-display.ts
|
|
3809
|
+
function costBasisDisplay(outcome) {
|
|
3810
|
+
if (outcome.costBasisUnknown === true) {
|
|
3811
|
+
return {
|
|
3812
|
+
averagePriceCents: null,
|
|
3813
|
+
averagePrice: null,
|
|
3814
|
+
totalTradedValue: null,
|
|
3815
|
+
costUnknown: true
|
|
3816
|
+
};
|
|
3817
|
+
}
|
|
3818
|
+
return {
|
|
3819
|
+
averagePriceCents: Math.round(outcome.avgEntryPrice * 100),
|
|
3820
|
+
averagePrice: outcome.avgEntryPrice,
|
|
3821
|
+
totalTradedValue: outcome.avgEntryPrice * outcome.totalSize,
|
|
3822
|
+
costUnknown: false
|
|
3823
|
+
};
|
|
3824
|
+
}
|
|
3825
|
+
|
|
3807
3826
|
// src/pages/user-profile/components/available-balance-card.tsx
|
|
3808
3827
|
import { useLabels as useLabels6 } from "@agg-build/hooks";
|
|
3809
3828
|
import { ACTIVE_VENUES, VENUE_CHAIN_IDS } from "@agg-build/sdk";
|
|
@@ -3850,6 +3869,7 @@ var AvailableBalanceCard = ({
|
|
|
3850
3869
|
label,
|
|
3851
3870
|
valueLabel,
|
|
3852
3871
|
reservedValueLabel,
|
|
3872
|
+
kalshiValueLabel,
|
|
3853
3873
|
chains,
|
|
3854
3874
|
isLoading = false,
|
|
3855
3875
|
className,
|
|
@@ -4002,6 +4022,13 @@ var AvailableBalanceCard = ({
|
|
|
4002
4022
|
}
|
|
4003
4023
|
)
|
|
4004
4024
|
] }),
|
|
4025
|
+
kalshiValueLabel !== void 0 ? /* @__PURE__ */ jsxs7("div", { className: "agg-balance-kalshi flex items-center justify-between gap-3", children: [
|
|
4026
|
+
/* @__PURE__ */ jsx8("div", { className: "font-agg-sans text-agg-base leading-6 font-agg-bold text-agg-foreground", children: isLoading ? /* @__PURE__ */ jsx8("div", { role: "status", "aria-label": "Loading Kalshi balance", children: /* @__PURE__ */ jsx8(SkeletonBlock, { className: "h-6 w-16 rounded-agg-sm" }) }) : kalshiValueLabel }),
|
|
4027
|
+
/* @__PURE__ */ jsxs7("span", { className: "flex h-5 shrink-0 items-center gap-1 rounded-[4px] bg-agg-secondary-hover px-1.5", children: [
|
|
4028
|
+
/* @__PURE__ */ jsx8(VenueLogo, { venue: "kalshi", size: "small", className: "size-3" }),
|
|
4029
|
+
/* @__PURE__ */ jsx8("span", { className: "font-agg-sans text-agg-xs leading-agg-4 font-agg-normal text-agg-muted-foreground", children: labels.venues.kalshi })
|
|
4030
|
+
] })
|
|
4031
|
+
] }) : null,
|
|
4005
4032
|
!isLoading && reservedValueLabel ? /* @__PURE__ */ jsx8("p", { className: "font-agg-sans text-agg-xs leading-agg-4 text-agg-muted-foreground", children: balanceLabels.reservedForOpenOrders(reservedValueLabel) }) : null
|
|
4006
4033
|
]
|
|
4007
4034
|
}
|
|
@@ -4937,6 +4964,7 @@ var resolvePositionStatus = (position) => {
|
|
|
4937
4964
|
return "open";
|
|
4938
4965
|
};
|
|
4939
4966
|
var resolvePositionBucket = (position) => {
|
|
4967
|
+
if (position.status === "closed") return "closed";
|
|
4940
4968
|
const status = resolvePositionStatus(position);
|
|
4941
4969
|
if (status === "won_unclaimed") return "active";
|
|
4942
4970
|
if (status === "open") return "active";
|
|
@@ -5713,6 +5741,18 @@ var OpenOrderRow = ({
|
|
|
5713
5741
|
};
|
|
5714
5742
|
const canCancel = canCancelOpenOrder(order);
|
|
5715
5743
|
const isPending = isPendingOpenOrder(order);
|
|
5744
|
+
const sideLabel = order.side === "buy" ? labels.buy : order.side === "sell" ? labels.sell : void 0;
|
|
5745
|
+
const outcomePillLabel = sideLabel ? `${sideLabel} ${order.outcomeLabel}` : order.outcomeLabel;
|
|
5746
|
+
const currentPriceLabel = order.currentPriceLabel ? `${labels.nowPrefix} ${order.currentPriceLabel}` : void 0;
|
|
5747
|
+
const mobileStats = [
|
|
5748
|
+
__spreadValues({
|
|
5749
|
+
label: resolvedLimitPriceHeader,
|
|
5750
|
+
value: (_a = order.limitPriceLabel) != null ? _a : "\u2014"
|
|
5751
|
+
}, currentPriceLabel ? { subValue: currentPriceLabel } : {}),
|
|
5752
|
+
{ label: resolvedFilledHeader, value: order.filledLabel },
|
|
5753
|
+
{ label: resolvedTotalHeader, value: order.valueLabel },
|
|
5754
|
+
{ label: resolvedExpirationHeader, value: (_b = order.expirationLabel) != null ? _b : "\u2014" }
|
|
5755
|
+
];
|
|
5716
5756
|
const Wrapper = href ? "a" : "div";
|
|
5717
5757
|
const wrapperProps = href ? {
|
|
5718
5758
|
href,
|
|
@@ -5751,22 +5791,23 @@ var OpenOrderRow = ({
|
|
|
5751
5791
|
) }),
|
|
5752
5792
|
/* @__PURE__ */ jsxs12("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
|
|
5753
5793
|
/* @__PURE__ */ jsx13("p", { className: "agg-open-order-market min-w-0 overflow-hidden font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground [display:-webkit-box] [-webkit-line-clamp:2] [-webkit-box-orient:vertical] lg:text-agg-base lg:leading-agg-6 lg:whitespace-nowrap lg:text-ellipsis lg:[-webkit-line-clamp:1] lg:[display:block]", children: order.title }),
|
|
5754
|
-
/* @__PURE__ */ jsx13("span", { className: "agg-open-order-outcome hidden lg:inline-flex w-fit items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ jsx13("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children:
|
|
5794
|
+
/* @__PURE__ */ jsx13("span", { className: "agg-open-order-outcome hidden lg:inline-flex w-fit items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ jsx13("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: outcomePillLabel }) })
|
|
5755
5795
|
] })
|
|
5756
5796
|
] }),
|
|
5757
5797
|
/* @__PURE__ */ jsxs12("div", { className: "flex w-full flex-wrap items-center gap-x-4 gap-y-2 lg:hidden", children: [
|
|
5758
|
-
/* @__PURE__ */ jsx13("span", { className: "agg-open-order-outcome inline-flex shrink-0 items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ jsx13("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children:
|
|
5759
|
-
[
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
/* @__PURE__ */ jsx13("span", { className: "font-agg-sans text-agg-lg leading-agg-7 font-agg-normal text-agg-foreground", children: value }),
|
|
5766
|
-
/* @__PURE__ */ jsx13("span", { className: "font-agg-sans text-[10px] leading-[14px] font-agg-bold uppercase text-agg-muted-foreground", children: label })
|
|
5798
|
+
/* @__PURE__ */ jsx13("span", { className: "agg-open-order-outcome inline-flex shrink-0 items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ jsx13("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: outcomePillLabel }) }),
|
|
5799
|
+
mobileStats.map(({ label, value, subValue }) => /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-0.5", children: [
|
|
5800
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-baseline gap-1.5 whitespace-nowrap", children: [
|
|
5801
|
+
/* @__PURE__ */ jsx13("span", { className: "font-agg-sans text-agg-lg leading-agg-7 font-agg-normal text-agg-foreground", children: value }),
|
|
5802
|
+
/* @__PURE__ */ jsx13("span", { className: "font-agg-sans text-[10px] leading-[14px] font-agg-bold uppercase text-agg-muted-foreground", children: label })
|
|
5803
|
+
] }),
|
|
5804
|
+
subValue ? /* @__PURE__ */ jsx13("span", { className: "agg-open-order-current-price font-agg-sans text-agg-sm leading-agg-5 font-agg-normal whitespace-nowrap text-agg-foreground", children: subValue }) : null
|
|
5767
5805
|
] }, label))
|
|
5768
5806
|
] }),
|
|
5769
|
-
/* @__PURE__ */
|
|
5807
|
+
/* @__PURE__ */ jsxs12("div", { className: "agg-open-order-limit-price hidden w-[120px] shrink-0 flex-col justify-center gap-0.5 lg:flex", children: [
|
|
5808
|
+
/* @__PURE__ */ jsx13("p", { className: "agg-type-body-strong text-agg-foreground", children: (_c = order.limitPriceLabel) != null ? _c : "\u2014" }),
|
|
5809
|
+
currentPriceLabel ? /* @__PURE__ */ jsx13("p", { className: "agg-open-order-current-price font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: currentPriceLabel }) : null
|
|
5810
|
+
] }),
|
|
5770
5811
|
/* @__PURE__ */ jsx13("p", { className: "agg-open-order-filled hidden w-[120px] shrink-0 agg-type-body-strong text-agg-foreground lg:block", children: order.filledLabel }),
|
|
5771
5812
|
/* @__PURE__ */ jsx13("p", { className: "agg-open-order-value hidden w-[120px] shrink-0 agg-type-body-strong text-agg-foreground lg:block", children: order.valueLabel }),
|
|
5772
5813
|
/* @__PURE__ */ jsx13("p", { className: "agg-open-order-expiration hidden w-[140px] shrink-0 agg-type-label text-agg-foreground lg:block", children: (_d = order.expirationLabel) != null ? _d : "\u2014" }),
|
|
@@ -5857,8 +5898,8 @@ var ResultBadge = ({
|
|
|
5857
5898
|
status,
|
|
5858
5899
|
labels
|
|
5859
5900
|
}) => {
|
|
5860
|
-
|
|
5861
|
-
|
|
5901
|
+
const isWon = status === "won_claimed" || status === "won_unclaimed";
|
|
5902
|
+
if (!isWon && status !== "lost" && status !== "sold") return null;
|
|
5862
5903
|
const isSold = status === "sold";
|
|
5863
5904
|
return /* @__PURE__ */ jsxs13(
|
|
5864
5905
|
"span",
|
|
@@ -7080,11 +7121,13 @@ var formatScaledNumberTwoDecimals = (value) => {
|
|
|
7080
7121
|
if (parsed == null) return "0.00";
|
|
7081
7122
|
return twoDecimalNumberFormatter.format(parsed);
|
|
7082
7123
|
};
|
|
7124
|
+
var formatPriceCentsLabel = (value) => `${limitPriceCentsFormatter.format(value * 100)}\xA2`;
|
|
7083
7125
|
var formatLimitPriceLabel = (value) => {
|
|
7084
7126
|
const parsed = parseRawMicroValue(value);
|
|
7085
7127
|
if (parsed == null) return void 0;
|
|
7086
|
-
return
|
|
7128
|
+
return formatPriceCentsLabel(parsed);
|
|
7087
7129
|
};
|
|
7130
|
+
var normalizeOutcomeMatchLabel = (value) => typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
7088
7131
|
var formatOpenOrderExpirationLabel = ({
|
|
7089
7132
|
timeInForce,
|
|
7090
7133
|
expiresAt,
|
|
@@ -7972,8 +8015,7 @@ var UserProfilePage = ({
|
|
|
7972
8015
|
};
|
|
7973
8016
|
});
|
|
7974
8017
|
}, [activities, activityQuery.activities, isHydrated, labels, ordersQuery.orders]);
|
|
7975
|
-
const
|
|
7976
|
-
if (openOrders) return openOrders.filter(isUserProfileLimitOrder);
|
|
8018
|
+
const openOrderRows = useMemo8(() => {
|
|
7977
8019
|
const orderRowsById = /* @__PURE__ */ new Map();
|
|
7978
8020
|
for (const query of openOrderQueries) {
|
|
7979
8021
|
for (const order of query.orders) {
|
|
@@ -7984,7 +8026,47 @@ var UserProfilePage = ({
|
|
|
7984
8026
|
(order) => isOpenOrderStatus(order.status) && isExecutionLimitOrder(order)
|
|
7985
8027
|
).sort(
|
|
7986
8028
|
(a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
|
|
7987
|
-
)
|
|
8029
|
+
);
|
|
8030
|
+
}, [openOrderQueries]);
|
|
8031
|
+
const openOrderVenueMarketIds = useMemo8(
|
|
8032
|
+
() => openOrderRows.map((order) => {
|
|
8033
|
+
var _a2;
|
|
8034
|
+
return (_a2 = order.venueMarket) == null ? void 0 : _a2.id;
|
|
8035
|
+
}).filter((venueMarketId) => Boolean(venueMarketId)),
|
|
8036
|
+
[openOrderRows]
|
|
8037
|
+
);
|
|
8038
|
+
const openOrderMidpointsQuery = useVenueMarketMidpoints2({
|
|
8039
|
+
venueMarketIds: openOrderVenueMarketIds,
|
|
8040
|
+
enabled: !openOrders && openOrderVenueMarketIds.length > 0
|
|
8041
|
+
});
|
|
8042
|
+
const openOrderMidpointRows = openOrderMidpointsQuery.midpointRows;
|
|
8043
|
+
const openOrderCurrentPriceLabels = useMemo8(() => {
|
|
8044
|
+
var _a2, _b2, _c2, _d;
|
|
8045
|
+
const midpointRowsByVenueMarketId = new Map(
|
|
8046
|
+
openOrderMidpointRows.map((row) => [row.venueMarketId, row])
|
|
8047
|
+
);
|
|
8048
|
+
const labelsByOrderId = /* @__PURE__ */ new Map();
|
|
8049
|
+
for (const order of openOrderRows) {
|
|
8050
|
+
const venueMarketId = (_a2 = order.venueMarket) == null ? void 0 : _a2.id;
|
|
8051
|
+
if (!venueMarketId) continue;
|
|
8052
|
+
const midpointRow = midpointRowsByVenueMarketId.get(venueMarketId);
|
|
8053
|
+
if (!midpointRow) continue;
|
|
8054
|
+
const orderOutcomeLabels = [
|
|
8055
|
+
normalizeOutcomeMatchLabel((_b2 = order.venueMarketOutcome) == null ? void 0 : _b2.label),
|
|
8056
|
+
normalizeOutcomeMatchLabel((_c2 = order.venueMarketOutcome) == null ? void 0 : _c2.title)
|
|
8057
|
+
].filter(Boolean);
|
|
8058
|
+
if (orderOutcomeLabels.length === 0) continue;
|
|
8059
|
+
const outcomeMidpoint = (_d = midpointRow.outcomes) == null ? void 0 : _d.find(
|
|
8060
|
+
(outcome) => orderOutcomeLabels.includes(normalizeOutcomeMatchLabel(outcome.label))
|
|
8061
|
+
);
|
|
8062
|
+
if ((outcomeMidpoint == null ? void 0 : outcomeMidpoint.midpoint) == null) continue;
|
|
8063
|
+
labelsByOrderId.set(order.id, formatPriceCentsLabel(outcomeMidpoint.midpoint));
|
|
8064
|
+
}
|
|
8065
|
+
return labelsByOrderId;
|
|
8066
|
+
}, [openOrderMidpointRows, openOrderRows]);
|
|
8067
|
+
const resolvedOpenOrders = useMemo8(() => {
|
|
8068
|
+
if (openOrders) return openOrders.filter(isUserProfileLimitOrder);
|
|
8069
|
+
return openOrderRows.map((order) => {
|
|
7988
8070
|
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
7989
8071
|
const isLimitOrder = isExecutionLimitOrder(order);
|
|
7990
8072
|
const filledRaw = isLimitOrder ? order.filledSizeRaw : order.filledAmountRaw;
|
|
@@ -7997,15 +8079,17 @@ var UserProfilePage = ({
|
|
|
7997
8079
|
goodTilCanceledLabel: labels.userProfile.openOrders.goodTilCanceled,
|
|
7998
8080
|
expiredLabel: labels.userProfile.openOrders.expired
|
|
7999
8081
|
});
|
|
8000
|
-
|
|
8082
|
+
const currentPriceLabel = openOrderCurrentPriceLabels.get(order.id);
|
|
8083
|
+
return __spreadProps(__spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadProps(__spreadValues({
|
|
8001
8084
|
id: order.id,
|
|
8002
8085
|
eventId: (_c2 = (_b2 = order.venueMarket) == null ? void 0 : _b2.venueEventId) != null ? _c2 : void 0,
|
|
8003
8086
|
marketId: (_e = (_d = order.venueMarket) == null ? void 0 : _d.id) != null ? _e : void 0,
|
|
8004
8087
|
thumbnailSrc: (_g = (_f = order.venueMarket) == null ? void 0 : _f.image) != null ? _g : fallbackThumbnailSrc,
|
|
8005
8088
|
title: ((_h = order.venueMarket) == null ? void 0 : _h.question) || "Market",
|
|
8006
|
-
outcomeLabel: ((_i = order.venueMarketOutcome) == null ? void 0 : _i.title) || ((_j = order.venueMarketOutcome) == null ? void 0 : _j.label) || "Outcome"
|
|
8089
|
+
outcomeLabel: ((_i = order.venueMarketOutcome) == null ? void 0 : _i.title) || ((_j = order.venueMarketOutcome) == null ? void 0 : _j.label) || "Outcome"
|
|
8090
|
+
}, order.side === "sell" || order.side === "buy" ? { side: order.side } : {}), {
|
|
8007
8091
|
venue: order.venue
|
|
8008
|
-
}, limitPriceLabel ? { limitPriceLabel } : {}), {
|
|
8092
|
+
}), limitPriceLabel ? { limitPriceLabel } : {}), currentPriceLabel ? { currentPriceLabel } : {}), {
|
|
8009
8093
|
filledLabel: `${formatScaledNumberTwoDecimals(filledRaw != null ? filledRaw : "0")}/${formatScaledNumberTwoDecimals(totalRaw)}`,
|
|
8010
8094
|
valueLabel: formatFilledUsdTwoDecimals(totalCostRaw)
|
|
8011
8095
|
}), expirationLabel ? { expirationLabel } : {}), {
|
|
@@ -8014,7 +8098,7 @@ var UserProfilePage = ({
|
|
|
8014
8098
|
dagRunId: (_k = order.dagRunId) != null ? _k : null
|
|
8015
8099
|
});
|
|
8016
8100
|
});
|
|
8017
|
-
}, [labels,
|
|
8101
|
+
}, [labels, openOrderCurrentPriceLabels, openOrderRows, openOrders]);
|
|
8018
8102
|
const isOpenOrdersQueryLoading = useMemo8(
|
|
8019
8103
|
() => openOrderQueries.some((query) => query.isLoading),
|
|
8020
8104
|
[openOrderQueries]
|
|
@@ -8055,16 +8139,15 @@ var UserProfilePage = ({
|
|
|
8055
8139
|
const outcomeId = (_b3 = (_a3 = outcome.venueBreakdown.find((row) => row.venueMarketOutcomeId)) == null ? void 0 : _a3.venueMarketOutcomeId) != null ? _b3 : void 0;
|
|
8056
8140
|
const isResolved = group.venueMarket.status === "resolved";
|
|
8057
8141
|
const isUnpriced = outcome.priceSource === "entry";
|
|
8058
|
-
const averagePriceCents =
|
|
8059
|
-
const totalTradedValue = outcome.avgEntryPrice * outcome.totalSize;
|
|
8142
|
+
const { averagePriceCents, averagePrice, totalTradedValue, costUnknown } = costBasisDisplay(outcome);
|
|
8060
8143
|
const finalPayoutValue = isResolved ? outcome.winner === true ? outcome.totalValue : 0 : outcome.totalValue;
|
|
8061
8144
|
const finalPrice = isResolved ? outcome.winner === true ? 1 : 0 : outcome.currentPrice;
|
|
8062
|
-
const finalPnlValue = finalPayoutValue - totalTradedValue;
|
|
8063
|
-
const finalPnlPercent = totalTradedValue === 0 ?
|
|
8145
|
+
const finalPnlValue = totalTradedValue == null ? null : finalPayoutValue - totalTradedValue;
|
|
8146
|
+
const finalPnlPercent = totalTradedValue == null || totalTradedValue === 0 || finalPnlValue == null ? null : finalPnlValue / Math.abs(totalTradedValue) * 100;
|
|
8064
8147
|
const displayCurrentPrice = isResolved ? finalPrice : isUnpriced ? null : outcome.currentPrice;
|
|
8065
8148
|
const displayCurrentValue = isResolved ? finalPayoutValue : isUnpriced ? null : outcome.totalValue;
|
|
8066
|
-
const displayPnlValue = isResolved ? finalPnlValue : isUnpriced ? null : outcome.unrealizedPnl;
|
|
8067
|
-
const displayPnlPercent = isResolved ? finalPnlPercent : isUnpriced ? null : outcome.unrealizedPnlPercent;
|
|
8149
|
+
const displayPnlValue = costUnknown ? null : isResolved ? finalPnlValue : isUnpriced ? null : outcome.unrealizedPnl;
|
|
8150
|
+
const displayPnlPercent = costUnknown ? null : isResolved ? finalPnlPercent : isUnpriced ? null : outcome.unrealizedPnlPercent;
|
|
8068
8151
|
const currentPriceCents = typeof displayCurrentPrice === "number" ? Math.round(displayCurrentPrice * 100) : null;
|
|
8069
8152
|
const pnlPrefix = (displayPnlValue != null ? displayPnlValue : 0) >= 0 ? "+" : "";
|
|
8070
8153
|
const pnlPercent = displayPnlPercent == null ? null : displayPnlPercent.toFixed(2);
|
|
@@ -8080,8 +8163,8 @@ var UserProfilePage = ({
|
|
|
8080
8163
|
resolutionLabel: winningOutcomeLabel,
|
|
8081
8164
|
venueShareBreakdown: buildVenueShareBreakdown(outcome),
|
|
8082
8165
|
totalShares: outcome.totalSize,
|
|
8083
|
-
averageLabel: `${averagePriceCents}\xA2`,
|
|
8084
|
-
averagePrice
|
|
8166
|
+
averageLabel: averagePriceCents == null ? "\u2014" : `${averagePriceCents}\xA2`,
|
|
8167
|
+
averagePrice,
|
|
8085
8168
|
currentLabel: currentPriceCents == null ? "\u2014" : `${currentPriceCents}\xA2`,
|
|
8086
8169
|
currentPrice: displayCurrentPrice,
|
|
8087
8170
|
valueLabel: displayCurrentValue == null ? "\u2014" : formatUsd2(displayCurrentValue),
|
|
@@ -8094,14 +8177,14 @@ var UserProfilePage = ({
|
|
|
8094
8177
|
marketStatus: group.venueMarket.status,
|
|
8095
8178
|
winner: (_f = outcome.winner) != null ? _f : null,
|
|
8096
8179
|
resolutionDate: group.resolutionDate,
|
|
8097
|
-
closedTotalTradedLabel: formatUsd2(totalTradedValue),
|
|
8180
|
+
closedTotalTradedLabel: totalTradedValue == null ? "\u2014" : formatUsd2(totalTradedValue),
|
|
8098
8181
|
totalTradedValue,
|
|
8099
8182
|
closedAmountWonLabel: formatUsd2(finalPayoutValue),
|
|
8100
8183
|
finalPayoutValue,
|
|
8101
8184
|
finalPnlValue,
|
|
8102
8185
|
finalPnlPercent,
|
|
8103
8186
|
finalPrice,
|
|
8104
|
-
closedReturnLabel: formatSignedPercentLabel(finalPnlPercent / 100),
|
|
8187
|
+
closedReturnLabel: finalPnlPercent == null ? "\u2014" : formatSignedPercentLabel(finalPnlPercent / 100),
|
|
8105
8188
|
closedClaimStatus: group.redeemStatus,
|
|
8106
8189
|
winningOutcomeIds: winningOutcomeIds.length > 0 ? winningOutcomeIds : closedTotals.winningOutcomeIds
|
|
8107
8190
|
};
|
|
@@ -8179,32 +8262,13 @@ var UserProfilePage = ({
|
|
|
8179
8262
|
classNames == null ? void 0 : classNames.rightColumn
|
|
8180
8263
|
),
|
|
8181
8264
|
children: [
|
|
8182
|
-
/* @__PURE__ */
|
|
8183
|
-
|
|
8265
|
+
/* @__PURE__ */ jsx19(
|
|
8266
|
+
PositionsValueCard,
|
|
8184
8267
|
{
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
children: [
|
|
8190
|
-
/* @__PURE__ */ jsx19(
|
|
8191
|
-
PositionsValueCard,
|
|
8192
|
-
{
|
|
8193
|
-
label: labels.userProfile.balance.positionsValue,
|
|
8194
|
-
valueLabel: positionsValueLabel,
|
|
8195
|
-
isLoading: isPositionsValueLoading,
|
|
8196
|
-
compact: isPaperMode
|
|
8197
|
-
}
|
|
8198
|
-
),
|
|
8199
|
-
isKalshiAvailable && !isPaperMode ? /* @__PURE__ */ jsx19(
|
|
8200
|
-
PositionsValueCard,
|
|
8201
|
-
{
|
|
8202
|
-
label: labels.userProfile.balance.kalshiBalance,
|
|
8203
|
-
valueLabel: formatUsd2((_b = balanceState.kalshiBalance) != null ? _b : 0),
|
|
8204
|
-
icon: /* @__PURE__ */ jsx19(VenueLogo, { venue: Venue3.kalshi, size: "small", className: "size-4" })
|
|
8205
|
-
}
|
|
8206
|
-
) : null
|
|
8207
|
-
]
|
|
8268
|
+
label: labels.userProfile.balance.positionsValue,
|
|
8269
|
+
valueLabel: positionsValueLabel,
|
|
8270
|
+
isLoading: isPositionsValueLoading,
|
|
8271
|
+
compact: isPaperMode
|
|
8208
8272
|
}
|
|
8209
8273
|
),
|
|
8210
8274
|
isPaperMode ? (
|
|
@@ -8253,13 +8317,14 @@ var UserProfilePage = ({
|
|
|
8253
8317
|
{
|
|
8254
8318
|
valueLabel: availableBalanceLabel,
|
|
8255
8319
|
isLoading: isAvailableBalanceLoading,
|
|
8256
|
-
chains: ((
|
|
8320
|
+
chains: ((_b = balanceChainsOverride != null ? balanceChainsOverride : balanceState.availableBalanceBreakdown) != null ? _b : balanceState.balanceBreakdown).map((b) => ({
|
|
8257
8321
|
key: b.key,
|
|
8258
8322
|
label: b.label,
|
|
8259
8323
|
balance: b.balance,
|
|
8260
8324
|
accountCount: b.accountCount,
|
|
8261
8325
|
venues: b.venues
|
|
8262
8326
|
})),
|
|
8327
|
+
kalshiValueLabel: isKalshiAvailable ? formatUsd2((_c = balanceState.kalshiBalance) != null ? _c : 0) : void 0,
|
|
8263
8328
|
manageButtonRef: manageBalancesButtonRef,
|
|
8264
8329
|
onManage: () => handleManageBalancesOpenChange(true)
|
|
8265
8330
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ConnectKalshiModal,
|
|
4
4
|
dispatchAggDepositNotification
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-B5ALKYD5.mjs";
|
|
6
6
|
import {
|
|
7
7
|
BoltIcon,
|
|
8
8
|
Button,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
shortenAddress,
|
|
37
37
|
useOptionalToast,
|
|
38
38
|
venueLogoLabels
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-BBDFSTIA.mjs";
|
|
40
40
|
|
|
41
41
|
// src/deposit/index.tsx
|
|
42
42
|
import { useAggAuthState, useAggUiConfig, useDepositAddresses, useLabels as useLabels11 } from "@agg-build/hooks";
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
resolveUnifiedOrderBookEntries,
|
|
25
25
|
sortOutcomeSelectorOutcomes,
|
|
26
26
|
useEventTradingContext
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-TK62UB5F.mjs";
|
|
28
28
|
import {
|
|
29
29
|
AutocompleteSelect,
|
|
30
30
|
Badge,
|
|
@@ -78,7 +78,7 @@ import {
|
|
|
78
78
|
sortOutcomes,
|
|
79
79
|
splitEventsByLifecycle,
|
|
80
80
|
validateSubcategoryPath
|
|
81
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-BBDFSTIA.mjs";
|
|
82
82
|
|
|
83
83
|
// src/events/item/index.tsx
|
|
84
84
|
import {
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
selectPrimaryVenueMarket,
|
|
20
20
|
skeletonViews,
|
|
21
21
|
sortOutcomes
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-BBDFSTIA.mjs";
|
|
23
23
|
|
|
24
24
|
// src/trading/trading-context/index.tsx
|
|
25
25
|
import { useEventTradingContext } from "@agg-build/hooks";
|
|
@@ -400,13 +400,14 @@ var parseSettlementDateMs = (value) => {
|
|
|
400
400
|
var isDateLikeDifference = (canonicalKey) => {
|
|
401
401
|
return canonicalKey === "resolution_timing" || canonicalKey === "start_date" || canonicalKey === "end_date";
|
|
402
402
|
};
|
|
403
|
-
var
|
|
404
|
-
if (!isDateLikeDifference(canonicalKey)) return false;
|
|
403
|
+
var hasEqualValuesAcrossVenues = (difference) => {
|
|
405
404
|
const values = Object.values(difference.perVenue);
|
|
406
405
|
if (values.length < 2) return false;
|
|
407
406
|
const timestamps = values.map(parseSettlementDateMs);
|
|
408
|
-
if (timestamps.
|
|
409
|
-
|
|
407
|
+
if (timestamps.every((timestamp) => timestamp !== null)) {
|
|
408
|
+
return new Set(timestamps).size === 1;
|
|
409
|
+
}
|
|
410
|
+
return new Set(values.map(normalizeSettlementForCompare)).size === 1;
|
|
410
411
|
};
|
|
411
412
|
var resolveDifferenceSeverity = (difference, canonicalKey) => {
|
|
412
413
|
var _a;
|
|
@@ -441,7 +442,7 @@ var prepareSettlementDifferences = (differences) => {
|
|
|
441
442
|
if (!title || Object.keys(perVenue).length === 0) continue;
|
|
442
443
|
const difference = __spreadProps(__spreadValues({}, rawDifference), { title, perVenue });
|
|
443
444
|
const canonicalKey = resolveCanonicalDifferenceKey(difference);
|
|
444
|
-
if (
|
|
445
|
+
if (hasEqualValuesAcrossVenues(difference)) continue;
|
|
445
446
|
const existing = byCanonicalKey.get(canonicalKey);
|
|
446
447
|
if (existing) {
|
|
447
448
|
byCanonicalKey.set(canonicalKey, __spreadProps(__spreadValues({}, existing), {
|
|
@@ -455,7 +456,7 @@ var prepareSettlementDifferences = (differences) => {
|
|
|
455
456
|
originalIndex
|
|
456
457
|
}));
|
|
457
458
|
}
|
|
458
|
-
return Array.from(byCanonicalKey.values()).sort((left, right) => {
|
|
459
|
+
return Array.from(byCanonicalKey.values()).filter((difference) => !hasEqualValuesAcrossVenues(difference)).sort((left, right) => {
|
|
459
460
|
const severityDelta = Number(right.severity === "critical") - Number(left.severity === "critical");
|
|
460
461
|
if (severityDelta !== 0) return severityDelta;
|
|
461
462
|
return left.originalIndex - right.originalIndex;
|
|
@@ -469,9 +470,7 @@ var resolveSettlementVenueLabel = (venue, labels) => {
|
|
|
469
470
|
return (_a = labels.venues[venue]) != null ? _a : formatVenueFallbackLabel(venue);
|
|
470
471
|
};
|
|
471
472
|
var resolveDifferenceVenueKeys = (difference, settlementVenues) => {
|
|
472
|
-
const
|
|
473
|
-
if (!isDateLikeDifference(difference.canonicalKey)) return explicitVenues;
|
|
474
|
-
const allVenues = [...settlementVenues != null ? settlementVenues : [], ...explicitVenues];
|
|
473
|
+
const allVenues = [...settlementVenues != null ? settlementVenues : [], ...Object.keys(difference.perVenue)];
|
|
475
474
|
return Array.from(new Set(allVenues.filter((venue) => venue.trim().length > 0)));
|
|
476
475
|
};
|
|
477
476
|
var resolveDifferenceIconClassName = (canonicalKey) => {
|
|
@@ -510,6 +509,12 @@ var buildSettlementVenueRules = ({
|
|
|
510
509
|
if (!venueRules.includes(content2)) venueRules.push(content2);
|
|
511
510
|
rulesByVenue.set(venue2, venueRules);
|
|
512
511
|
}
|
|
512
|
+
if (rulesByVenue.size > 0) {
|
|
513
|
+
for (const venue2 of settlementVenues != null ? settlementVenues : []) {
|
|
514
|
+
const trimmedVenue = venue2.trim();
|
|
515
|
+
if (trimmedVenue && !rulesByVenue.has(trimmedVenue)) rulesByVenue.set(trimmedVenue, []);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
513
518
|
return Array.from(rulesByVenue, ([venue2, contents]) => ({
|
|
514
519
|
venue: venue2,
|
|
515
520
|
content: contents.join("\n\n")
|
|
@@ -519,6 +524,11 @@ var buildSettlementVenueRules = ({
|
|
|
519
524
|
const venue = (_b = settlementVenues == null ? void 0 : settlementVenues.find((candidate) => candidate.trim().length > 0)) == null ? void 0 : _b.trim();
|
|
520
525
|
return content && venue ? [{ venue, content }] : [];
|
|
521
526
|
};
|
|
527
|
+
var repeatsQuestion = (content, question) => {
|
|
528
|
+
const normalizedQuestion = normalizeSettlementForCompare(question != null ? question : "");
|
|
529
|
+
if (!normalizedQuestion) return false;
|
|
530
|
+
return normalizeSettlementForCompare(content) === normalizedQuestion;
|
|
531
|
+
};
|
|
522
532
|
var isDuplicatedByVenueRules = (content, venueRules) => {
|
|
523
533
|
const normalizedContent = normalizeSettlementForCompare(content);
|
|
524
534
|
if (!normalizedContent) return false;
|
|
@@ -535,8 +545,8 @@ var SettlementVenueRules = ({
|
|
|
535
545
|
/* @__PURE__ */ jsx2("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.trading.settlementFullRulesTitle }),
|
|
536
546
|
/* @__PURE__ */ jsx2("div", { className: "flex w-full flex-col items-start gap-4", children: rules.map((rule) => {
|
|
537
547
|
const venueLabel = resolveSettlementVenueLabel(rule.venue, labels);
|
|
538
|
-
return /* @__PURE__ */ jsxs2("details", { className: "
|
|
539
|
-
/* @__PURE__ */ jsxs2("summary", { className: "flex cursor-pointer list-none items-center gap-2 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground
|
|
548
|
+
return /* @__PURE__ */ jsxs2("details", { className: "w-full", children: [
|
|
549
|
+
/* @__PURE__ */ jsxs2("summary", { className: "group/agg-settlement-rule flex w-fit cursor-pointer list-none items-center gap-2 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground transition-colors marker:hidden", children: [
|
|
540
550
|
/* @__PURE__ */ jsx2(
|
|
541
551
|
VenueLogo,
|
|
542
552
|
{
|
|
@@ -560,7 +570,7 @@ var SettlementVenueRules = ({
|
|
|
560
570
|
}
|
|
561
571
|
)
|
|
562
572
|
] }),
|
|
563
|
-
/* @__PURE__ */ jsx2("div", { className: "mt-3 pl-6", children: /* @__PURE__ */ jsx2(SettlementTextRenderer, { content: rule.content }) })
|
|
573
|
+
/* @__PURE__ */ jsx2("div", { className: "mt-3 pl-6", children: rule.content ? /* @__PURE__ */ jsx2(SettlementTextRenderer, { content: rule.content }) : /* @__PURE__ */ jsx2("p", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-muted-foreground", children: labels.trading.settlementValueUnavailable }) })
|
|
564
574
|
] }, rule.venue);
|
|
565
575
|
}) })
|
|
566
576
|
] });
|
|
@@ -588,9 +598,10 @@ var Settlement = ({
|
|
|
588
598
|
}),
|
|
589
599
|
[eventDescription, marketDescription, primaryRules]
|
|
590
600
|
);
|
|
601
|
+
const isSingleVenueCluster = settlementVenues !== void 0 && settlementVenues.length < 2;
|
|
591
602
|
const settlementDifferences = useMemo(
|
|
592
|
-
() => prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences),
|
|
593
|
-
[settlementDiff == null ? void 0 : settlementDiff.differences]
|
|
603
|
+
() => isSingleVenueCluster ? [] : prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences),
|
|
604
|
+
[isSingleVenueCluster, settlementDiff == null ? void 0 : settlementDiff.differences]
|
|
594
605
|
);
|
|
595
606
|
const eventBlock = (_a = blocks.find((block) => block.key === "eventDescription")) != null ? _a : null;
|
|
596
607
|
const marketBlock = (_b = blocks.find((block) => block.key === "marketDescription")) != null ? _b : null;
|
|
@@ -606,7 +617,7 @@ var Settlement = ({
|
|
|
606
617
|
);
|
|
607
618
|
const hasSettlementDifferences = settlementDifferences.length > 0;
|
|
608
619
|
const hasVenueSettlementRules = venueRuleBlocks.length > 0;
|
|
609
|
-
const standaloneEventBlock = eventBlock && !isDuplicatedByVenueRules(eventBlock.content, venueRuleBlocks) ? eventBlock : null;
|
|
620
|
+
const standaloneEventBlock = eventBlock && !isDuplicatedByVenueRules(eventBlock.content, venueRuleBlocks) && !repeatsQuestion(eventBlock.content, question) ? eventBlock : null;
|
|
610
621
|
const standaloneMarketBlock = hasVenueSettlementRules ? null : marketBlock;
|
|
611
622
|
const standalonePrimaryRulesBlock = hasVenueSettlementRules ? null : primaryRulesBlock;
|
|
612
623
|
const hasStandaloneSettlementText = hasVenueSettlementRules ? standaloneEventBlock !== null : blocks.length > 0;
|