@agg-build/ui 1.2.7 → 1.2.9
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-5FXMHTVR.mjs → chunk-5MDFM2MX.mjs} +1 -1
- package/dist/{chunk-TBKDLNOE.mjs → chunk-5PSAIGOT.mjs} +29 -8
- package/dist/{chunk-WPF47BQQ.mjs → chunk-7JKGAWU5.mjs} +9 -2
- package/dist/{chunk-3RG2K7MV.mjs → chunk-K23CJ5UP.mjs} +666 -148
- package/dist/{chunk-E45WOOMN.mjs → chunk-PFOSEY46.mjs} +22 -8
- package/dist/{chunk-QMWKXDVZ.mjs → chunk-PYKD4W4T.mjs} +18 -12
- package/dist/{chunk-34L7ZKJW.mjs → chunk-QFW5NDJ6.mjs} +7 -10
- package/dist/events.js +55 -23
- package/dist/events.mjs +3 -3
- package/dist/index.js +777 -207
- package/dist/index.mjs +28 -21
- package/dist/modals.js +12 -9
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +740 -184
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +7 -10
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +669 -154
- package/dist/trading.mjs +4 -4
- package/dist/types/primitives/switch-button/switch-button.constants.d.mts +1 -1
- package/dist/types/primitives/switch-button/switch-button.constants.d.ts +1 -1
- package/dist/types/primitives/tooltip/index.d.mts +1 -1
- package/dist/types/primitives/tooltip/index.d.ts +1 -1
- package/dist/types/primitives/tooltip/tooltip.types.d.mts +2 -0
- package/dist/types/primitives/tooltip/tooltip.types.d.ts +2 -0
- package/dist/types/trading/place-order/index.place-order.execution-debug.d.mts +183 -0
- package/dist/types/trading/place-order/index.place-order.execution-debug.d.ts +183 -0
- package/dist/types/trading/place-order/index.place-order.execution-steps.d.mts +72 -0
- package/dist/types/trading/place-order/index.place-order.execution-steps.d.ts +72 -0
- package/package.json +1 -1
package/dist/pages.js
CHANGED
|
@@ -98,7 +98,7 @@ module.exports = __toCommonJS(pages_exports);
|
|
|
98
98
|
|
|
99
99
|
// src/pages/home/index.tsx
|
|
100
100
|
var import_hooks53 = require("@agg-build/hooks");
|
|
101
|
-
var
|
|
101
|
+
var import_sdk18 = require("@agg-build/sdk");
|
|
102
102
|
var import_react31 = require("react");
|
|
103
103
|
|
|
104
104
|
// src/events/item/index.tsx
|
|
@@ -1403,7 +1403,7 @@ var HourglassStartIcon = (_a) => {
|
|
|
1403
1403
|
__spreadProps(__spreadValues(__spreadValues({
|
|
1404
1404
|
width: "16",
|
|
1405
1405
|
height: "16",
|
|
1406
|
-
viewBox: "0 0
|
|
1406
|
+
viewBox: "0 0 10 10",
|
|
1407
1407
|
fill: "none",
|
|
1408
1408
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1409
1409
|
className
|
|
@@ -1413,14 +1413,10 @@ var HourglassStartIcon = (_a) => {
|
|
|
1413
1413
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
1414
1414
|
"path",
|
|
1415
1415
|
{
|
|
1416
|
-
d: "
|
|
1417
|
-
|
|
1418
|
-
strokeWidth: "1.4",
|
|
1419
|
-
strokeLinecap: "round",
|
|
1420
|
-
strokeLinejoin: "round"
|
|
1416
|
+
d: "M8.7324 1.90708C8.80282 1.43542 8.66324 0.95625 8.3499 0.5925C8.03115 0.2225 7.56907 0.0108337 7.08157 0.0108337H2.91907C2.43157 0.0108337 1.96949 0.223334 1.65115 0.593334C1.3374 0.9575 1.19824 1.43667 1.26907 1.90875C1.43824 3.03333 2.05449 4.07458 3.10282 5.01042C2.05407 5.94625 1.43782 6.9875 1.26907 8.11208C1.19824 8.58417 1.33782 9.06333 1.65115 9.4275C1.96949 9.79792 2.43199 10.0096 2.91907 10.0096H7.08157C7.56907 10.0096 8.03115 9.79792 8.3499 9.42792C8.66324 9.06417 8.80282 8.585 8.7324 8.11375C8.56449 6.99292 7.9474 5.95083 6.89657 5.01C7.9474 4.06917 8.56449 3.0275 8.7324 1.90708ZM7.46949 1.83333C7.05949 2.84667 6.19824 3.67583 5.54907 4.1925L5.26157 4.42208C5.10949 4.54292 4.8949 4.54292 4.74282 4.42292L4.44949 4.19C3.80074 3.67708 2.94157 2.85167 2.53074 1.83333C2.47865 1.70458 2.49449 1.55917 2.57157 1.44417C2.64907 1.32958 2.77865 1.26083 2.91699 1.26083H7.08365C7.2224 1.26083 7.35199 1.32917 7.42907 1.44417C7.50657 1.55875 7.52157 1.705 7.46949 1.83333ZM5.0299 3.54083L5.00074 3.56417L4.96657 3.53708C4.53032 3.19208 3.9874 2.69167 3.60365 2.09458H6.39615C6.01115 2.69 5.4674 3.19292 5.03032 3.54125L5.0299 3.54083Z",
|
|
1417
|
+
fill: "currentColor"
|
|
1421
1418
|
}
|
|
1422
|
-
)
|
|
1423
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("path", { d: "M6.75 4.25H9.25L8 5.25L6.75 4.25Z", fill: "currentColor" })
|
|
1419
|
+
)
|
|
1424
1420
|
]
|
|
1425
1421
|
})
|
|
1426
1422
|
);
|
|
@@ -3509,7 +3505,7 @@ var SWITCH_BUTTON_ANIMATION_DURATION_MS = 350;
|
|
|
3509
3505
|
var SWITCH_BUTTON_CONTAINER_CLASS_NAME = "group/agg-switch-button min-w-fit inline-flex min-w-0 rounded-agg-full bg-agg-secondary-hover font-agg-sans cursor-pointer hover:bg-agg-tertiary";
|
|
3510
3506
|
var SWITCH_BUTTON_TRACK_CLASS_NAME = "agg-switch-button-track relative grid min-w-0 flex-1 items-center";
|
|
3511
3507
|
var SWITCH_BUTTON_TRACK_HIGHLIGHT_CLASS_NAME = "pointer-events-none absolute inset-y-0 left-0 rounded-agg-full border border-agg-primary bg-agg-secondary";
|
|
3512
|
-
var SWITCH_BUTTON_OPTION_BASE_CLASS_NAME = "agg-switch-button-option whitespace-nowrap relative z-10 min-w-0 rounded-agg-full px-5 py-1.5 font-agg-sans text-agg-base leading-agg-6 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-hover cursor-pointer disabled:cursor-not-allowed disabled:text-agg-muted-foreground";
|
|
3508
|
+
var SWITCH_BUTTON_OPTION_BASE_CLASS_NAME = "agg-switch-button-option whitespace-nowrap relative z-10 min-w-0 rounded-agg-full px-5 py-1.5 font-agg-sans text-agg-sm leading-agg-5 md:text-agg-base md:leading-agg-6 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-hover cursor-pointer disabled:cursor-not-allowed disabled:text-agg-muted-foreground";
|
|
3513
3509
|
|
|
3514
3510
|
// src/primitives/switch-button/switch-button.utils.ts
|
|
3515
3511
|
var resolveActiveIndex = (options, value) => {
|
|
@@ -8254,6 +8250,7 @@ var Tooltip = ({
|
|
|
8254
8250
|
side = "top",
|
|
8255
8251
|
delayDuration = 150,
|
|
8256
8252
|
collisionPadding = 12,
|
|
8253
|
+
sideOffset = 0,
|
|
8257
8254
|
classNames,
|
|
8258
8255
|
"aria-label": ariaLabel
|
|
8259
8256
|
}) => {
|
|
@@ -8281,7 +8278,7 @@ var Tooltip = ({
|
|
|
8281
8278
|
TooltipPrimitive.Content,
|
|
8282
8279
|
{
|
|
8283
8280
|
side,
|
|
8284
|
-
sideOffset
|
|
8281
|
+
sideOffset,
|
|
8285
8282
|
collisionPadding,
|
|
8286
8283
|
className: cn(
|
|
8287
8284
|
"group/agg-tooltip",
|
|
@@ -9564,6 +9561,18 @@ var marketChartCandleToScaledCandlePoint = (candle, transformProbability) => {
|
|
|
9564
9561
|
v: candle.volume
|
|
9565
9562
|
};
|
|
9566
9563
|
};
|
|
9564
|
+
var venueCandlesToLinePoints = (venueData, transformProbability) => {
|
|
9565
|
+
const candles = venueData.liveCandle && !venueData.candles.some((candle) => {
|
|
9566
|
+
var _a;
|
|
9567
|
+
return candle.time === ((_a = venueData.liveCandle) == null ? void 0 : _a.time);
|
|
9568
|
+
}) ? [...venueData.candles, venueData.liveCandle] : venueData.liveCandle ? venueData.candles.map(
|
|
9569
|
+
(candle) => {
|
|
9570
|
+
var _a;
|
|
9571
|
+
return candle.time === ((_a = venueData.liveCandle) == null ? void 0 : _a.time) ? venueData.liveCandle : candle;
|
|
9572
|
+
}
|
|
9573
|
+
) : venueData.candles;
|
|
9574
|
+
return candles.map((candle) => marketChartCandleToLineChartPoint(candle, transformProbability));
|
|
9575
|
+
};
|
|
9567
9576
|
var resolveMarketChartVenueSeries = ({
|
|
9568
9577
|
chartData,
|
|
9569
9578
|
transformProbability
|
|
@@ -9571,9 +9580,7 @@ var resolveMarketChartVenueSeries = ({
|
|
|
9571
9580
|
if (!chartData) return [];
|
|
9572
9581
|
return Object.entries(chartData.venues).map(([venue, venueData]) => ({
|
|
9573
9582
|
venue,
|
|
9574
|
-
points: venueData
|
|
9575
|
-
(candle) => marketChartCandleToLineChartPoint(candle, transformProbability)
|
|
9576
|
-
)
|
|
9583
|
+
points: venueCandlesToLinePoints(venueData, transformProbability)
|
|
9577
9584
|
})).filter((item) => item.points.length > 0);
|
|
9578
9585
|
};
|
|
9579
9586
|
var resolveAggregatedCandleSource = (candles) => {
|
|
@@ -9626,13 +9633,24 @@ var resolveMarketChartDisplaySeries = ({
|
|
|
9626
9633
|
if (selectedVenue) {
|
|
9627
9634
|
return venueEntries.map(([venue, venueData]) => ({
|
|
9628
9635
|
venue,
|
|
9629
|
-
points: venueData
|
|
9630
|
-
(candle) => marketChartCandleToLineChartPoint(candle, transformProbability)
|
|
9631
|
-
)
|
|
9636
|
+
points: venueCandlesToLinePoints(venueData, transformProbability)
|
|
9632
9637
|
})).filter((item) => item.points.length > 0);
|
|
9633
9638
|
}
|
|
9634
9639
|
const aggregatedCandles = aggregateMarketChartCandles(
|
|
9635
|
-
venueEntries.flatMap(([, venueData]) =>
|
|
9640
|
+
venueEntries.flatMap(([, venueData]) => {
|
|
9641
|
+
const closed = venueData.candles;
|
|
9642
|
+
if (!venueData.liveCandle) return closed;
|
|
9643
|
+
const hasOverlap = closed.some((candle) => {
|
|
9644
|
+
var _a;
|
|
9645
|
+
return candle.time === ((_a = venueData.liveCandle) == null ? void 0 : _a.time);
|
|
9646
|
+
});
|
|
9647
|
+
return hasOverlap ? closed.map(
|
|
9648
|
+
(candle) => {
|
|
9649
|
+
var _a;
|
|
9650
|
+
return candle.time === ((_a = venueData.liveCandle) == null ? void 0 : _a.time) ? venueData.liveCandle : candle;
|
|
9651
|
+
}
|
|
9652
|
+
) : [...closed, venueData.liveCandle];
|
|
9653
|
+
})
|
|
9636
9654
|
);
|
|
9637
9655
|
if (aggregatedCandles.length === 0) return [];
|
|
9638
9656
|
return [
|
|
@@ -11442,7 +11460,9 @@ var EventListItemDetailsGraphSection = ({
|
|
|
11442
11460
|
}
|
|
11443
11461
|
),
|
|
11444
11462
|
classNames: {
|
|
11445
|
-
root: cn(
|
|
11463
|
+
root: cn(
|
|
11464
|
+
"shrink-0 border px-4 h-8 text-agg-sm leading-agg-5 md:h-9 md:text-agg-base md:leading-agg-6"
|
|
11465
|
+
)
|
|
11446
11466
|
},
|
|
11447
11467
|
isActive: isActiveVenue
|
|
11448
11468
|
}
|
|
@@ -12123,8 +12143,20 @@ var OrderbookRow = ({
|
|
|
12123
12143
|
}).map(([venue]) => venue);
|
|
12124
12144
|
const venues = entry.row.venues && entry.row.venues.length > 0 ? entry.row.venues : venuesFromBreakdown.length > 0 ? venuesFromBreakdown : [entry.row.venue];
|
|
12125
12145
|
const barPercent = Math.max(2, Number((entry.unifiedBarScale * 100).toFixed(2)));
|
|
12126
|
-
return /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "agg-orderbook-row relative flex h-9 items-center gap-2.5 overflow-clip
|
|
12127
|
-
/* @__PURE__ */ (0, import_jsx_runtime128.
|
|
12146
|
+
return /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "agg-orderbook-row relative flex h-9 items-center gap-2.5 overflow-clip pl-5 pr-2.5 md:gap-10 md:pl-0 md:pr-5", children: [
|
|
12147
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
12148
|
+
"div",
|
|
12149
|
+
{
|
|
12150
|
+
"aria-hidden": "true",
|
|
12151
|
+
className: cn(
|
|
12152
|
+
"agg-orderbook-bar md:hidden absolute inset-y-0 left-0",
|
|
12153
|
+
barClassName,
|
|
12154
|
+
getMotionClassName(enableAnimations, "transition-[width] duration-200 ease-in-out")
|
|
12155
|
+
),
|
|
12156
|
+
style: { width: `${barPercent}%` }
|
|
12157
|
+
}
|
|
12158
|
+
),
|
|
12159
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "hidden md:block md:relative min-w-0 flex-1 self-stretch", children: [
|
|
12128
12160
|
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
12129
12161
|
"div",
|
|
12130
12162
|
{
|
|
@@ -12227,8 +12259,8 @@ var Orderbook = ({
|
|
|
12227
12259
|
spreadEntry
|
|
12228
12260
|
]);
|
|
12229
12261
|
return /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: cn("agg-orderbook-unified flex flex-col", className), children: [
|
|
12230
|
-
/* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "flex h-9 items-center gap-2.5 overflow-clip border-b border-agg-separator pr-5 md:gap-10", children: [
|
|
12231
|
-
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { className: "flex min-w-0 flex-1 items-center gap-2 pl-5", children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.tradeOutcome }) }),
|
|
12262
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "flex h-9 items-center gap-2.5 overflow-clip border-b border-agg-separator pl-5 pr-5 md:pl-0 md:gap-10", children: [
|
|
12263
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { className: "hidden md:flex min-w-0 flex-1 items-center gap-2 pl-5", children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.tradeOutcome }) }),
|
|
12232
12264
|
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { className: "w-20 shrink-0 text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground md:w-[120px]", children: labels.price }),
|
|
12233
12265
|
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { className: "w-20 shrink-0 text-center text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground md:w-[120px]", children: labels.shares }),
|
|
12234
12266
|
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { className: "w-20 shrink-0 text-center text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground md:w-[120px]", children: labels.total })
|
|
@@ -13063,7 +13095,7 @@ var MarketDetailsContent = ({
|
|
|
13063
13095
|
"span",
|
|
13064
13096
|
{
|
|
13065
13097
|
className: cn(
|
|
13066
|
-
"min-w-35 inline-flex h-9 items-center justify-center gap-2 rounded-agg-full",
|
|
13098
|
+
"w-full md:w-auto md:min-w-35 inline-flex h-9 items-center justify-center gap-2 rounded-agg-full",
|
|
13067
13099
|
"border px-5 py-1.5 text-agg-sm font-agg-bold",
|
|
13068
13100
|
getMotionClassName(
|
|
13069
13101
|
enableAnimations,
|
|
@@ -13897,6 +13929,447 @@ var PLACE_ORDER_OUTCOME_BUTTON_CLASS_NAMES = {
|
|
|
13897
13929
|
inactive: "border-transparent bg-agg-secondary-hover font-agg-normal text-agg-foreground hover:bg-agg-tertiary"
|
|
13898
13930
|
};
|
|
13899
13931
|
|
|
13932
|
+
// src/trading/place-order/index.place-order.execution-steps.ts
|
|
13933
|
+
var import_sdk17 = require("@agg-build/sdk");
|
|
13934
|
+
var WAIT_STEP_TYPES = /* @__PURE__ */ new Set(["_wait", "wait"]);
|
|
13935
|
+
var CHECKING_BALANCE_STEP_TYPES = /* @__PURE__ */ new Set([
|
|
13936
|
+
"check-balance",
|
|
13937
|
+
"check-position",
|
|
13938
|
+
"position-reserve",
|
|
13939
|
+
"position-release"
|
|
13940
|
+
]);
|
|
13941
|
+
var VENUE_BUY_SELL_REGEX = /^(?:buy|sell)-([a-z]+)$/;
|
|
13942
|
+
var VENUE_FINALIZE_REGEX = /^([a-z]+)-finalize$/;
|
|
13943
|
+
var VENUE_NAME_MAP = {
|
|
13944
|
+
kalshi: import_sdk17.Venue.kalshi,
|
|
13945
|
+
polymarket: import_sdk17.Venue.polymarket,
|
|
13946
|
+
limitless: import_sdk17.Venue.limitless,
|
|
13947
|
+
opinion: import_sdk17.Venue.opinion,
|
|
13948
|
+
predict: import_sdk17.Venue.predict,
|
|
13949
|
+
probable: import_sdk17.Venue.probable,
|
|
13950
|
+
myriad: import_sdk17.Venue.myriad,
|
|
13951
|
+
hyperliquid: import_sdk17.Venue.hyperliquid
|
|
13952
|
+
};
|
|
13953
|
+
var parseVenueName = (raw) => VENUE_NAME_MAP[raw];
|
|
13954
|
+
var NON_VENUE_FINALIZE_PREFIXES = /* @__PURE__ */ new Set(["bridge"]);
|
|
13955
|
+
var classifyExecutionStepType = (stepType) => {
|
|
13956
|
+
if (!stepType) return null;
|
|
13957
|
+
if (WAIT_STEP_TYPES.has(stepType)) return null;
|
|
13958
|
+
if (CHECKING_BALANCE_STEP_TYPES.has(stepType)) {
|
|
13959
|
+
return { kind: "checking-balance" };
|
|
13960
|
+
}
|
|
13961
|
+
const buySellMatch = stepType.match(VENUE_BUY_SELL_REGEX);
|
|
13962
|
+
if (buySellMatch) {
|
|
13963
|
+
const venue = parseVenueName(buySellMatch[1]);
|
|
13964
|
+
if (venue) return { kind: "executing-venue", venue };
|
|
13965
|
+
}
|
|
13966
|
+
const finalizeMatch = stepType.match(VENUE_FINALIZE_REGEX);
|
|
13967
|
+
if (finalizeMatch && !NON_VENUE_FINALIZE_PREFIXES.has(finalizeMatch[1])) {
|
|
13968
|
+
const venue = parseVenueName(finalizeMatch[1]);
|
|
13969
|
+
if (venue) return { kind: "executing-venue", venue };
|
|
13970
|
+
}
|
|
13971
|
+
if (stepType === "submit-verify-order-status") {
|
|
13972
|
+
return null;
|
|
13973
|
+
}
|
|
13974
|
+
return { kind: "submitting" };
|
|
13975
|
+
};
|
|
13976
|
+
var buildPhaseTimeline = (dag) => {
|
|
13977
|
+
const timeline = [];
|
|
13978
|
+
const completed = new Set(dag.completedSequences);
|
|
13979
|
+
for (let seq = 1; seq <= dag.totalSteps; seq++) {
|
|
13980
|
+
const stepType = dag.stepTypes[seq];
|
|
13981
|
+
if (!stepType) continue;
|
|
13982
|
+
const classified = classifyExecutionStepType(stepType);
|
|
13983
|
+
if (!classified) continue;
|
|
13984
|
+
const isCompleted = completed.has(seq);
|
|
13985
|
+
const last = timeline[timeline.length - 1];
|
|
13986
|
+
if (last && last.kind === classified.kind && last.venue === classified.venue) {
|
|
13987
|
+
last.lastSeq = seq;
|
|
13988
|
+
last.allCompleted = last.allCompleted && isCompleted;
|
|
13989
|
+
continue;
|
|
13990
|
+
}
|
|
13991
|
+
timeline.push({
|
|
13992
|
+
kind: classified.kind,
|
|
13993
|
+
venue: classified.venue,
|
|
13994
|
+
firstSeq: seq,
|
|
13995
|
+
lastSeq: seq,
|
|
13996
|
+
allCompleted: isCompleted
|
|
13997
|
+
});
|
|
13998
|
+
}
|
|
13999
|
+
return timeline;
|
|
14000
|
+
};
|
|
14001
|
+
var phaseRowId = (phase) => phase.venue ? `${phase.kind}:${phase.venue}` : phase.kind;
|
|
14002
|
+
var phaseRowLabel = (phase, labels) => {
|
|
14003
|
+
switch (phase.kind) {
|
|
14004
|
+
case "finding-route":
|
|
14005
|
+
return labels.findingBestRoute;
|
|
14006
|
+
case "checking-balance":
|
|
14007
|
+
return labels.checkingBalance;
|
|
14008
|
+
case "submitting":
|
|
14009
|
+
return labels.submittingOrderProgress;
|
|
14010
|
+
case "wallet-confirm":
|
|
14011
|
+
return labels.confirmTransactionInWallet;
|
|
14012
|
+
case "executing-venue":
|
|
14013
|
+
return labels.executingOnVenue(getTradingVenueLabel(phase.venue));
|
|
14014
|
+
case "filled":
|
|
14015
|
+
return labels.executionConfirmed;
|
|
14016
|
+
case "failed":
|
|
14017
|
+
return labels.orderFailureTitle;
|
|
14018
|
+
}
|
|
14019
|
+
};
|
|
14020
|
+
var buildSubmissionDisplayRows = ({
|
|
14021
|
+
phase,
|
|
14022
|
+
dagProgress,
|
|
14023
|
+
executionVenue,
|
|
14024
|
+
isAwaitingWalletConfirmation,
|
|
14025
|
+
labels
|
|
14026
|
+
}) => {
|
|
14027
|
+
if (phase === "finding-route") {
|
|
14028
|
+
return [
|
|
14029
|
+
{
|
|
14030
|
+
id: "finding-route",
|
|
14031
|
+
label: labels.findingBestRoute,
|
|
14032
|
+
status: "pending"
|
|
14033
|
+
}
|
|
14034
|
+
];
|
|
14035
|
+
}
|
|
14036
|
+
const rows = [
|
|
14037
|
+
{
|
|
14038
|
+
id: "finding-route",
|
|
14039
|
+
label: labels.findingBestRoute,
|
|
14040
|
+
status: "complete"
|
|
14041
|
+
}
|
|
14042
|
+
];
|
|
14043
|
+
const pushPhase = (phaseEntry, status) => {
|
|
14044
|
+
const id = phaseRowId(phaseEntry);
|
|
14045
|
+
if (rows.some((row) => row.id === id)) return;
|
|
14046
|
+
rows.push({
|
|
14047
|
+
id,
|
|
14048
|
+
label: phaseRowLabel(phaseEntry, labels),
|
|
14049
|
+
status,
|
|
14050
|
+
venue: phaseEntry.venue
|
|
14051
|
+
});
|
|
14052
|
+
};
|
|
14053
|
+
if (dagProgress && dagProgress.totalSteps > 0) {
|
|
14054
|
+
const timeline = buildPhaseTimeline(dagProgress);
|
|
14055
|
+
let activeEmitted = false;
|
|
14056
|
+
for (const entry of timeline) {
|
|
14057
|
+
const id = phaseRowId(entry);
|
|
14058
|
+
const alreadyShown = rows.some((row) => row.id === id);
|
|
14059
|
+
if (entry.allCompleted) {
|
|
14060
|
+
if (alreadyShown) continue;
|
|
14061
|
+
pushPhase(entry, "complete");
|
|
14062
|
+
continue;
|
|
14063
|
+
}
|
|
14064
|
+
if (activeEmitted) break;
|
|
14065
|
+
if (alreadyShown) continue;
|
|
14066
|
+
if (isAwaitingWalletConfirmation && entry.kind === "submitting") {
|
|
14067
|
+
pushPhase({ kind: "wallet-confirm" }, "pending");
|
|
14068
|
+
} else {
|
|
14069
|
+
pushPhase(entry, "pending");
|
|
14070
|
+
}
|
|
14071
|
+
activeEmitted = true;
|
|
14072
|
+
}
|
|
14073
|
+
if (!activeEmitted) {
|
|
14074
|
+
const last = rows[rows.length - 1];
|
|
14075
|
+
if (last && last.id.startsWith("executing-venue")) {
|
|
14076
|
+
last.status = "pending";
|
|
14077
|
+
} else {
|
|
14078
|
+
const fallbackVenue = executionVenue;
|
|
14079
|
+
rows.push({
|
|
14080
|
+
id: fallbackVenue ? `executing-venue:${fallbackVenue}` : "executing-venue",
|
|
14081
|
+
label: phaseRowLabel({ kind: "executing-venue", venue: fallbackVenue }, labels),
|
|
14082
|
+
status: "pending",
|
|
14083
|
+
venue: fallbackVenue
|
|
14084
|
+
});
|
|
14085
|
+
}
|
|
14086
|
+
}
|
|
14087
|
+
return rows;
|
|
14088
|
+
}
|
|
14089
|
+
if (isAwaitingWalletConfirmation) {
|
|
14090
|
+
pushPhase({ kind: "wallet-confirm" }, "pending");
|
|
14091
|
+
return rows;
|
|
14092
|
+
}
|
|
14093
|
+
if (phase === "submitting") {
|
|
14094
|
+
pushPhase({ kind: "submitting" }, "pending");
|
|
14095
|
+
return rows;
|
|
14096
|
+
}
|
|
14097
|
+
pushPhase({ kind: "submitting" }, "complete");
|
|
14098
|
+
pushPhase({ kind: "executing-venue", venue: executionVenue }, "pending");
|
|
14099
|
+
return rows;
|
|
14100
|
+
};
|
|
14101
|
+
|
|
14102
|
+
// src/trading/place-order/index.place-order.execution-debug.ts
|
|
14103
|
+
var REDACTED = "[redacted]";
|
|
14104
|
+
var SENSITIVE_FIELD_PATTERNS = [
|
|
14105
|
+
"token",
|
|
14106
|
+
"authorization",
|
|
14107
|
+
"cookie",
|
|
14108
|
+
"secret",
|
|
14109
|
+
"signature",
|
|
14110
|
+
"privatekey",
|
|
14111
|
+
"private_key",
|
|
14112
|
+
"accesstoken",
|
|
14113
|
+
"access_token",
|
|
14114
|
+
"refreshtoken",
|
|
14115
|
+
"refresh_token",
|
|
14116
|
+
"jwt",
|
|
14117
|
+
"password",
|
|
14118
|
+
"apikey",
|
|
14119
|
+
"api_key",
|
|
14120
|
+
"email",
|
|
14121
|
+
"headers"
|
|
14122
|
+
];
|
|
14123
|
+
var isSensitiveFieldName = (name) => {
|
|
14124
|
+
const normalized = name.toLowerCase();
|
|
14125
|
+
return SENSITIVE_FIELD_PATTERNS.some((pattern) => normalized.includes(pattern));
|
|
14126
|
+
};
|
|
14127
|
+
var sanitizeExecutionDebugValue = (input) => {
|
|
14128
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
14129
|
+
const walk = (value) => {
|
|
14130
|
+
if (value === null || value === void 0) return value;
|
|
14131
|
+
if (typeof value !== "object") return value;
|
|
14132
|
+
if (ancestors.has(value)) return "[circular]";
|
|
14133
|
+
ancestors.add(value);
|
|
14134
|
+
try {
|
|
14135
|
+
if (Array.isArray(value)) {
|
|
14136
|
+
return value.map((entry) => walk(entry));
|
|
14137
|
+
}
|
|
14138
|
+
if (value instanceof Error) {
|
|
14139
|
+
return {
|
|
14140
|
+
name: value.name,
|
|
14141
|
+
message: value.message,
|
|
14142
|
+
stack: value.stack
|
|
14143
|
+
};
|
|
14144
|
+
}
|
|
14145
|
+
const out = {};
|
|
14146
|
+
for (const [key, raw] of Object.entries(value)) {
|
|
14147
|
+
if (isSensitiveFieldName(key)) {
|
|
14148
|
+
out[key] = REDACTED;
|
|
14149
|
+
continue;
|
|
14150
|
+
}
|
|
14151
|
+
out[key] = walk(raw);
|
|
14152
|
+
}
|
|
14153
|
+
return out;
|
|
14154
|
+
} finally {
|
|
14155
|
+
ancestors.delete(value);
|
|
14156
|
+
}
|
|
14157
|
+
};
|
|
14158
|
+
return walk(input);
|
|
14159
|
+
};
|
|
14160
|
+
var cloneEnvironment = (env) => __spreadProps(__spreadValues({}, env), {
|
|
14161
|
+
packageVersions: env.packageVersions ? __spreadValues({}, env.packageVersions) : void 0
|
|
14162
|
+
});
|
|
14163
|
+
var buildEnvironment = (overrides) => {
|
|
14164
|
+
var _a;
|
|
14165
|
+
const url = typeof window !== "undefined" ? (_a = window.location) == null ? void 0 : _a.href : void 0;
|
|
14166
|
+
const userAgent = typeof navigator !== "undefined" && typeof navigator.userAgent === "string" ? navigator.userAgent : void 0;
|
|
14167
|
+
return __spreadValues({
|
|
14168
|
+
url,
|
|
14169
|
+
userAgent,
|
|
14170
|
+
capturedAt: Date.now()
|
|
14171
|
+
}, overrides);
|
|
14172
|
+
};
|
|
14173
|
+
var generateAttemptId = () => {
|
|
14174
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
14175
|
+
return crypto.randomUUID();
|
|
14176
|
+
}
|
|
14177
|
+
return `attempt-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
14178
|
+
};
|
|
14179
|
+
var createExecutionDebugStore = (initial) => {
|
|
14180
|
+
let attempts = [];
|
|
14181
|
+
let environment = buildEnvironment(initial);
|
|
14182
|
+
const findAttempt = (attemptId) => attempts.find((attempt) => attempt.attemptId === attemptId);
|
|
14183
|
+
const touch = (attempt) => {
|
|
14184
|
+
attempt.updatedAt = Date.now();
|
|
14185
|
+
};
|
|
14186
|
+
return {
|
|
14187
|
+
appendAttempt(input = {}) {
|
|
14188
|
+
var _a, _b;
|
|
14189
|
+
const now = Date.now();
|
|
14190
|
+
const attempt = {
|
|
14191
|
+
attemptId: (_a = input.attemptId) != null ? _a : generateAttemptId(),
|
|
14192
|
+
startedAt: now,
|
|
14193
|
+
updatedAt: now,
|
|
14194
|
+
status: (_b = input.status) != null ? _b : "quoting",
|
|
14195
|
+
quoteId: input.quoteId,
|
|
14196
|
+
orderId: input.orderId,
|
|
14197
|
+
orderIds: input.orderIds,
|
|
14198
|
+
quote: input.quote,
|
|
14199
|
+
selectedRoute: input.selectedRoute,
|
|
14200
|
+
bridge: input.bridge,
|
|
14201
|
+
venueExecution: input.venueExecution,
|
|
14202
|
+
rawEvents: [],
|
|
14203
|
+
normalizedSteps: [],
|
|
14204
|
+
errors: []
|
|
14205
|
+
};
|
|
14206
|
+
attempts = [...attempts, attempt];
|
|
14207
|
+
return attempt;
|
|
14208
|
+
},
|
|
14209
|
+
updateAttempt(attemptId, patch) {
|
|
14210
|
+
const attempt = findAttempt(attemptId);
|
|
14211
|
+
if (!attempt) return;
|
|
14212
|
+
if (patch.status !== void 0) attempt.status = patch.status;
|
|
14213
|
+
if (patch.quoteId !== void 0) attempt.quoteId = patch.quoteId;
|
|
14214
|
+
if (patch.orderId !== void 0) attempt.orderId = patch.orderId;
|
|
14215
|
+
if (patch.orderIds !== void 0) attempt.orderIds = patch.orderIds;
|
|
14216
|
+
if (patch.quote !== void 0) attempt.quote = patch.quote;
|
|
14217
|
+
if (patch.selectedRoute !== void 0) attempt.selectedRoute = patch.selectedRoute;
|
|
14218
|
+
if (patch.bridge !== void 0) attempt.bridge = patch.bridge;
|
|
14219
|
+
if (patch.venueExecution !== void 0) attempt.venueExecution = patch.venueExecution;
|
|
14220
|
+
if (patch.finalStatus !== void 0) attempt.finalStatus = patch.finalStatus;
|
|
14221
|
+
touch(attempt);
|
|
14222
|
+
},
|
|
14223
|
+
appendEvent(attemptId, event) {
|
|
14224
|
+
var _a;
|
|
14225
|
+
const attempt = findAttempt(attemptId);
|
|
14226
|
+
if (!attempt) return;
|
|
14227
|
+
attempt.rawEvents.push({
|
|
14228
|
+
kind: event.kind,
|
|
14229
|
+
label: event.label,
|
|
14230
|
+
data: event.data,
|
|
14231
|
+
timestamp: (_a = event.timestamp) != null ? _a : Date.now()
|
|
14232
|
+
});
|
|
14233
|
+
touch(attempt);
|
|
14234
|
+
},
|
|
14235
|
+
appendError(attemptId, error) {
|
|
14236
|
+
var _a;
|
|
14237
|
+
const attempt = findAttempt(attemptId);
|
|
14238
|
+
if (!attempt) return;
|
|
14239
|
+
attempt.errors.push({
|
|
14240
|
+
message: error.message,
|
|
14241
|
+
name: error.name,
|
|
14242
|
+
code: error.code,
|
|
14243
|
+
stack: error.stack,
|
|
14244
|
+
failedStep: error.failedStep,
|
|
14245
|
+
data: error.data,
|
|
14246
|
+
timestamp: (_a = error.timestamp) != null ? _a : Date.now()
|
|
14247
|
+
});
|
|
14248
|
+
touch(attempt);
|
|
14249
|
+
},
|
|
14250
|
+
setNormalizedSteps(attemptId, steps) {
|
|
14251
|
+
const attempt = findAttempt(attemptId);
|
|
14252
|
+
if (!attempt) return;
|
|
14253
|
+
attempt.normalizedSteps = steps;
|
|
14254
|
+
touch(attempt);
|
|
14255
|
+
},
|
|
14256
|
+
getSnapshot() {
|
|
14257
|
+
return {
|
|
14258
|
+
attempts: attempts.map((attempt) => __spreadProps(__spreadValues({}, attempt), {
|
|
14259
|
+
rawEvents: [...attempt.rawEvents],
|
|
14260
|
+
normalizedSteps: [...attempt.normalizedSteps],
|
|
14261
|
+
errors: [...attempt.errors]
|
|
14262
|
+
})),
|
|
14263
|
+
environment: cloneEnvironment(environment)
|
|
14264
|
+
};
|
|
14265
|
+
},
|
|
14266
|
+
getFailedAttempts() {
|
|
14267
|
+
return attempts.filter(
|
|
14268
|
+
(attempt) => attempt.status === "failed" || attempt.finalStatus === "failed" || attempt.errors.length > 0
|
|
14269
|
+
).map((attempt) => __spreadProps(__spreadValues({}, attempt), {
|
|
14270
|
+
rawEvents: [...attempt.rawEvents],
|
|
14271
|
+
normalizedSteps: [...attempt.normalizedSteps],
|
|
14272
|
+
errors: [...attempt.errors]
|
|
14273
|
+
}));
|
|
14274
|
+
},
|
|
14275
|
+
clear() {
|
|
14276
|
+
attempts = [];
|
|
14277
|
+
environment = buildEnvironment(initial);
|
|
14278
|
+
}
|
|
14279
|
+
};
|
|
14280
|
+
};
|
|
14281
|
+
var writeClipboardLegacy = (text) => {
|
|
14282
|
+
if (typeof document === "undefined") return false;
|
|
14283
|
+
const textarea = document.createElement("textarea");
|
|
14284
|
+
textarea.value = text;
|
|
14285
|
+
textarea.setAttribute("readonly", "");
|
|
14286
|
+
textarea.style.position = "fixed";
|
|
14287
|
+
textarea.style.top = "-1000px";
|
|
14288
|
+
textarea.style.opacity = "0";
|
|
14289
|
+
document.body.appendChild(textarea);
|
|
14290
|
+
try {
|
|
14291
|
+
textarea.select();
|
|
14292
|
+
return document.execCommand("copy");
|
|
14293
|
+
} catch (e) {
|
|
14294
|
+
return false;
|
|
14295
|
+
} finally {
|
|
14296
|
+
document.body.removeChild(textarea);
|
|
14297
|
+
}
|
|
14298
|
+
};
|
|
14299
|
+
var tryWriteClipboard = (text, consoleImpl) => __async(null, null, function* () {
|
|
14300
|
+
var _a;
|
|
14301
|
+
if (typeof navigator !== "undefined" && ((_a = navigator.clipboard) == null ? void 0 : _a.writeText)) {
|
|
14302
|
+
try {
|
|
14303
|
+
yield navigator.clipboard.writeText(text);
|
|
14304
|
+
consoleImpl.info("[agg-execution-debug] Copied execution data to clipboard.");
|
|
14305
|
+
return;
|
|
14306
|
+
} catch (e) {
|
|
14307
|
+
}
|
|
14308
|
+
}
|
|
14309
|
+
if (writeClipboardLegacy(text)) {
|
|
14310
|
+
consoleImpl.info("[agg-execution-debug] Copied execution data to clipboard.");
|
|
14311
|
+
return;
|
|
14312
|
+
}
|
|
14313
|
+
consoleImpl.warn(
|
|
14314
|
+
"[agg-execution-debug] Clipboard copy was blocked by the browser. The JSON is logged below \u2014 right-click the entry and copy."
|
|
14315
|
+
);
|
|
14316
|
+
consoleImpl.log(text);
|
|
14317
|
+
});
|
|
14318
|
+
var installExecutionDebugWindow = ({
|
|
14319
|
+
store,
|
|
14320
|
+
consoleImpl
|
|
14321
|
+
}) => {
|
|
14322
|
+
if (typeof window === "undefined") return () => {
|
|
14323
|
+
};
|
|
14324
|
+
const targetConsole = consoleImpl != null ? consoleImpl : console;
|
|
14325
|
+
const previous = {
|
|
14326
|
+
executionData: window.executionData,
|
|
14327
|
+
getExecutionData: window.getExecutionData,
|
|
14328
|
+
getFailedExecutionData: window.getFailedExecutionData,
|
|
14329
|
+
clearExecutionData: window.clearExecutionData,
|
|
14330
|
+
storeRef: window.__aggExecutionDebugStore
|
|
14331
|
+
};
|
|
14332
|
+
const refresh = () => {
|
|
14333
|
+
window.executionData = sanitizeExecutionDebugValue(store.getSnapshot());
|
|
14334
|
+
};
|
|
14335
|
+
refresh();
|
|
14336
|
+
window.__aggExecutionDebugStore = store;
|
|
14337
|
+
window.getExecutionData = () => {
|
|
14338
|
+
const data = sanitizeExecutionDebugValue(store.getSnapshot());
|
|
14339
|
+
window.executionData = data;
|
|
14340
|
+
void tryWriteClipboard(JSON.stringify(data, null, 2), targetConsole);
|
|
14341
|
+
return data;
|
|
14342
|
+
};
|
|
14343
|
+
window.getFailedExecutionData = () => {
|
|
14344
|
+
const failed = sanitizeExecutionDebugValue({ attempts: store.getFailedAttempts() });
|
|
14345
|
+
void tryWriteClipboard(JSON.stringify(failed, null, 2), targetConsole);
|
|
14346
|
+
return failed;
|
|
14347
|
+
};
|
|
14348
|
+
window.clearExecutionData = () => {
|
|
14349
|
+
store.clear();
|
|
14350
|
+
refresh();
|
|
14351
|
+
};
|
|
14352
|
+
targetConsole.info(
|
|
14353
|
+
"AGG execution debug enabled. Run window.getFailedExecutionData() after a failed order to copy logs."
|
|
14354
|
+
);
|
|
14355
|
+
return () => {
|
|
14356
|
+
if (typeof window === "undefined") return;
|
|
14357
|
+
window.executionData = previous.executionData;
|
|
14358
|
+
window.getExecutionData = previous.getExecutionData;
|
|
14359
|
+
window.getFailedExecutionData = previous.getFailedExecutionData;
|
|
14360
|
+
window.clearExecutionData = previous.clearExecutionData;
|
|
14361
|
+
window.__aggExecutionDebugStore = previous.storeRef;
|
|
14362
|
+
};
|
|
14363
|
+
};
|
|
14364
|
+
var enableExecutionDebugInBrowser = (initial) => {
|
|
14365
|
+
if (typeof window === "undefined") return null;
|
|
14366
|
+
const existing = window.__aggExecutionDebugStore;
|
|
14367
|
+
if (existing) return existing;
|
|
14368
|
+
const store = createExecutionDebugStore(initial);
|
|
14369
|
+
installExecutionDebugWindow({ store });
|
|
14370
|
+
return store;
|
|
14371
|
+
};
|
|
14372
|
+
|
|
13900
14373
|
// src/trading/place-order/index.place-order.utils.ts
|
|
13901
14374
|
var routePriceLabelFormatter = new Intl.NumberFormat("en-US", {
|
|
13902
14375
|
minimumFractionDigits: 0,
|
|
@@ -15084,21 +15557,6 @@ PlaceOrderSuccessView.displayName = "PlaceOrderSuccessView";
|
|
|
15084
15557
|
|
|
15085
15558
|
// src/trading/place-order/index.tsx
|
|
15086
15559
|
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
15087
|
-
var DEFAULT_STEP_LABELS = {
|
|
15088
|
-
"check-balance": "Checking balance",
|
|
15089
|
-
"check-position": "Checking position",
|
|
15090
|
-
"lane-bridge": "Bridging funds",
|
|
15091
|
-
bridge: "Bridging funds",
|
|
15092
|
-
"bridge-to-user": "Transferring to wallet",
|
|
15093
|
-
"sweep-bridge": "Completing bridge",
|
|
15094
|
-
"submit-order": "Submitting order",
|
|
15095
|
-
"order-bridge-execute": "Executing order",
|
|
15096
|
-
"transfer-to-user": "Transferring to wallet"
|
|
15097
|
-
};
|
|
15098
|
-
var getDefaultStepLabel = (stepType) => {
|
|
15099
|
-
var _a;
|
|
15100
|
-
return (_a = DEFAULT_STEP_LABELS[stepType]) != null ? _a : stepType.replace(/-/g, " ").replace(/^\w/, (c) => c.toUpperCase());
|
|
15101
|
-
};
|
|
15102
15560
|
var resolveRefetchedQuoteData = (result) => {
|
|
15103
15561
|
if (!result || typeof result !== "object" || !("data" in result)) return null;
|
|
15104
15562
|
const data = result.data;
|
|
@@ -15598,7 +16056,6 @@ var renderRouteCard = ({
|
|
|
15598
16056
|
}
|
|
15599
16057
|
);
|
|
15600
16058
|
};
|
|
15601
|
-
var normalizeOrderIdLabelInput2 = (orderId) => orderId.replace(/^#+/, "");
|
|
15602
16059
|
var renderSubmissionSurface = ({
|
|
15603
16060
|
actionLabel,
|
|
15604
16061
|
className,
|
|
@@ -15610,81 +16067,12 @@ var renderSubmissionSurface = ({
|
|
|
15610
16067
|
progressState,
|
|
15611
16068
|
tradingLabels
|
|
15612
16069
|
}) => {
|
|
15613
|
-
const
|
|
15614
|
-
|
|
15615
|
-
|
|
15616
|
-
|
|
15617
|
-
|
|
15618
|
-
|
|
15619
|
-
id: "finding-route",
|
|
15620
|
-
label: tradingLabels.findingBestRoute,
|
|
15621
|
-
status: "pending"
|
|
15622
|
-
}
|
|
15623
|
-
]
|
|
15624
|
-
];
|
|
15625
|
-
}
|
|
15626
|
-
const dag = progressState.dagProgress;
|
|
15627
|
-
if (dag && dag.totalSteps > 0) {
|
|
15628
|
-
const steps = [
|
|
15629
|
-
{
|
|
15630
|
-
id: "finding-route",
|
|
15631
|
-
label: tradingLabels.findingBestRoute,
|
|
15632
|
-
status: "complete"
|
|
15633
|
-
}
|
|
15634
|
-
];
|
|
15635
|
-
for (let i = 1; i <= dag.totalSteps; i++) {
|
|
15636
|
-
const isCompleted = dag.completedSequences.includes(i);
|
|
15637
|
-
const isCurrent = i === dag.currentSequence && !isCompleted;
|
|
15638
|
-
const stepType = (_a = dag.stepTypes[i]) != null ? _a : null;
|
|
15639
|
-
const stepLabel = stepType ? getDefaultStepLabel(stepType) : `Step ${i} of ${dag.totalSteps}`;
|
|
15640
|
-
const prev = steps[steps.length - 1];
|
|
15641
|
-
if (prev && prev.label === stepLabel) {
|
|
15642
|
-
if (prev.status === "complete" && !isCompleted) {
|
|
15643
|
-
prev.status = "pending";
|
|
15644
|
-
}
|
|
15645
|
-
continue;
|
|
15646
|
-
}
|
|
15647
|
-
steps.push({
|
|
15648
|
-
id: `dag-step-${i}`,
|
|
15649
|
-
label: stepLabel,
|
|
15650
|
-
status: isCompleted ? "complete" : isCurrent ? "pending" : "pending"
|
|
15651
|
-
});
|
|
15652
|
-
}
|
|
15653
|
-
return [steps];
|
|
15654
|
-
}
|
|
15655
|
-
const baseSteps = [
|
|
15656
|
-
{
|
|
15657
|
-
id: "finding-route",
|
|
15658
|
-
label: tradingLabels.findingBestRoute,
|
|
15659
|
-
status: "complete"
|
|
15660
|
-
},
|
|
15661
|
-
{
|
|
15662
|
-
id: "submitting-order",
|
|
15663
|
-
label: tradingLabels.submittingOrderProgress,
|
|
15664
|
-
status: "complete"
|
|
15665
|
-
}
|
|
15666
|
-
];
|
|
15667
|
-
const submittedOrderId = (_c = progressState.orderId) != null ? _c : (_b = progressState.orderIds) == null ? void 0 : _b[0];
|
|
15668
|
-
if (submittedOrderId) {
|
|
15669
|
-
baseSteps.push({
|
|
15670
|
-
id: "order-submitted",
|
|
15671
|
-
label: tradingLabels.orderSubmittedProgress(normalizeOrderIdLabelInput2(submittedOrderId)),
|
|
15672
|
-
status: "complete"
|
|
15673
|
-
});
|
|
15674
|
-
}
|
|
15675
|
-
return [
|
|
15676
|
-
baseSteps,
|
|
15677
|
-
[
|
|
15678
|
-
{
|
|
15679
|
-
id: "executing-order",
|
|
15680
|
-
label: tradingLabels.executingOnVenue(getTradingVenueLabel(progressState.executionVenue)),
|
|
15681
|
-
status: "pending",
|
|
15682
|
-
venue: progressState.executionVenue
|
|
15683
|
-
}
|
|
15684
|
-
]
|
|
15685
|
-
];
|
|
15686
|
-
};
|
|
15687
|
-
const stepGroups = resolveStepGroups();
|
|
16070
|
+
const displayRows = buildSubmissionDisplayRows({
|
|
16071
|
+
phase: progressState.phase,
|
|
16072
|
+
dagProgress: progressState.dagProgress,
|
|
16073
|
+
executionVenue: progressState.executionVenue,
|
|
16074
|
+
labels: tradingLabels
|
|
16075
|
+
});
|
|
15688
16076
|
return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
15689
16077
|
Card,
|
|
15690
16078
|
{
|
|
@@ -15706,51 +16094,50 @@ var renderSubmissionSurface = ({
|
|
|
15706
16094
|
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(LoadingGlyph, { enableAnimations, className: "h-4 w-4 text-current" }),
|
|
15707
16095
|
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)("span", { children: actionLabel })
|
|
15708
16096
|
] }),
|
|
15709
|
-
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
15710
|
-
|
|
15711
|
-
|
|
15712
|
-
|
|
15713
|
-
|
|
15714
|
-
|
|
15715
|
-
|
|
15716
|
-
|
|
15717
|
-
|
|
15718
|
-
|
|
15719
|
-
|
|
15720
|
-
|
|
15721
|
-
|
|
15722
|
-
|
|
15723
|
-
|
|
15724
|
-
|
|
15725
|
-
|
|
15726
|
-
|
|
15727
|
-
|
|
15728
|
-
|
|
15729
|
-
|
|
15730
|
-
|
|
15731
|
-
|
|
15732
|
-
|
|
15733
|
-
|
|
15734
|
-
|
|
15735
|
-
|
|
15736
|
-
|
|
15737
|
-
|
|
15738
|
-
|
|
15739
|
-
|
|
15740
|
-
|
|
15741
|
-
|
|
15742
|
-
|
|
15743
|
-
|
|
15744
|
-
|
|
15745
|
-
|
|
15746
|
-
|
|
15747
|
-
|
|
15748
|
-
|
|
15749
|
-
|
|
15750
|
-
}
|
|
15751
|
-
|
|
15752
|
-
|
|
15753
|
-
}) })
|
|
16097
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
16098
|
+
"div",
|
|
16099
|
+
{
|
|
16100
|
+
className: "agg-order-submission-steps agg-order-submission-group flex flex-col gap-2",
|
|
16101
|
+
"data-testid": "agg-order-submission-steps",
|
|
16102
|
+
children: displayRows.map((step) => {
|
|
16103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
|
|
16104
|
+
"div",
|
|
16105
|
+
{
|
|
16106
|
+
className: "agg-order-submission-step flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
16107
|
+
"data-status": step.status,
|
|
16108
|
+
children: [
|
|
16109
|
+
step.status === "complete" ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
16110
|
+
Icon,
|
|
16111
|
+
{
|
|
16112
|
+
name: "check-circle",
|
|
16113
|
+
size: "small",
|
|
16114
|
+
className: "h-3 w-3 shrink-0 text-agg-primary",
|
|
16115
|
+
"aria-hidden": "true"
|
|
16116
|
+
}
|
|
16117
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
16118
|
+
LoadingGlyph,
|
|
16119
|
+
{
|
|
16120
|
+
enableAnimations,
|
|
16121
|
+
className: "h-3 w-3 shrink-0 text-agg-primary"
|
|
16122
|
+
}
|
|
16123
|
+
),
|
|
16124
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
16125
|
+
step.venue ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
16126
|
+
VenueLogo,
|
|
16127
|
+
{
|
|
16128
|
+
venue: step.venue,
|
|
16129
|
+
size: "small",
|
|
16130
|
+
ariaLabel: getTradingVenueLabel(step.venue),
|
|
16131
|
+
className: "h-4 w-4"
|
|
16132
|
+
}
|
|
16133
|
+
) : null
|
|
16134
|
+
]
|
|
16135
|
+
},
|
|
16136
|
+
step.id
|
|
16137
|
+
);
|
|
16138
|
+
})
|
|
16139
|
+
}
|
|
16140
|
+
)
|
|
15754
16141
|
] })
|
|
15755
16142
|
] })
|
|
15756
16143
|
}
|
|
@@ -15886,6 +16273,7 @@ var PlaceOrder = ({
|
|
|
15886
16273
|
}) => {
|
|
15887
16274
|
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;
|
|
15888
16275
|
const {
|
|
16276
|
+
enableDebug: isExecutionDebugEnabled,
|
|
15889
16277
|
features: { enableAnimations, showFeesBreakdown },
|
|
15890
16278
|
general: { locale }
|
|
15891
16279
|
} = (0, import_hooks51.useSdkUiConfig)();
|
|
@@ -15982,6 +16370,27 @@ var PlaceOrder = ({
|
|
|
15982
16370
|
const [isSplitDetailOpen, setIsSplitDetailOpen] = (0, import_react27.useState)(false);
|
|
15983
16371
|
const [submissionFeedback, setSubmissionFeedback] = (0, import_react27.useState)(null);
|
|
15984
16372
|
const [submissionProgressState, setSubmissionProgressState] = (0, import_react27.useState)(null);
|
|
16373
|
+
const executionDebugStoreRef = (0, import_react27.useRef)(null);
|
|
16374
|
+
const executionDebugAttemptIdRef = (0, import_react27.useRef)(null);
|
|
16375
|
+
(0, import_react27.useEffect)(() => {
|
|
16376
|
+
if (!isExecutionDebugEnabled) {
|
|
16377
|
+
executionDebugStoreRef.current = null;
|
|
16378
|
+
return;
|
|
16379
|
+
}
|
|
16380
|
+
executionDebugStoreRef.current = enableExecutionDebugInBrowser();
|
|
16381
|
+
}, [isExecutionDebugEnabled]);
|
|
16382
|
+
(0, import_react27.useEffect)(() => {
|
|
16383
|
+
if (!isExecutionDebugEnabled) return;
|
|
16384
|
+
const store = executionDebugStoreRef.current;
|
|
16385
|
+
if (!store) return;
|
|
16386
|
+
store.clear();
|
|
16387
|
+
executionDebugAttemptIdRef.current = null;
|
|
16388
|
+
}, [
|
|
16389
|
+
isExecutionDebugEnabled,
|
|
16390
|
+
scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.id,
|
|
16391
|
+
scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id,
|
|
16392
|
+
scopedSelectedOutcomeId
|
|
16393
|
+
]);
|
|
15985
16394
|
const debouncedAmount = (0, import_hooks51.useDebouncedValue)(internalAmount, 300);
|
|
15986
16395
|
const isSell = (0, import_react27.useMemo)(() => internalTab === "sell", [internalTab]);
|
|
15987
16396
|
const {
|
|
@@ -16241,8 +16650,39 @@ var PlaceOrder = ({
|
|
|
16241
16650
|
selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData
|
|
16242
16651
|
]);
|
|
16243
16652
|
(0, import_react27.useEffect)(() => {
|
|
16653
|
+
var _a2, _b2;
|
|
16244
16654
|
const dp = executionProgress.dagProgress;
|
|
16245
16655
|
if (!dp) return;
|
|
16656
|
+
const debugStore = executionDebugStoreRef.current;
|
|
16657
|
+
const debugAttemptId = executionDebugAttemptIdRef.current;
|
|
16658
|
+
if (debugStore && debugAttemptId) {
|
|
16659
|
+
debugStore.appendEvent(debugAttemptId, {
|
|
16660
|
+
kind: "ws_update",
|
|
16661
|
+
label: "dag_progress",
|
|
16662
|
+
data: dp
|
|
16663
|
+
});
|
|
16664
|
+
const normalizedRows = buildSubmissionDisplayRows({
|
|
16665
|
+
phase: "executing",
|
|
16666
|
+
dagProgress: dp,
|
|
16667
|
+
labels: tradingLabels
|
|
16668
|
+
});
|
|
16669
|
+
debugStore.setNormalizedSteps(debugAttemptId, normalizedRows);
|
|
16670
|
+
debugStore.appendEvent(debugAttemptId, {
|
|
16671
|
+
kind: "normalized_steps",
|
|
16672
|
+
data: normalizedRows
|
|
16673
|
+
});
|
|
16674
|
+
if (dp.status === "failed") {
|
|
16675
|
+
debugStore.appendError(debugAttemptId, {
|
|
16676
|
+
message: (_a2 = dp.errorReason) != null ? _a2 : "DAG execution failed",
|
|
16677
|
+
failedStep: (_b2 = dp.currentStepType) != null ? _b2 : void 0,
|
|
16678
|
+
data: { currentSequence: dp.currentSequence, totalSteps: dp.totalSteps }
|
|
16679
|
+
});
|
|
16680
|
+
debugStore.updateAttempt(debugAttemptId, {
|
|
16681
|
+
status: "failed",
|
|
16682
|
+
finalStatus: "failed"
|
|
16683
|
+
});
|
|
16684
|
+
}
|
|
16685
|
+
}
|
|
16246
16686
|
setSubmissionProgressState((prev) => {
|
|
16247
16687
|
if (!prev) return prev;
|
|
16248
16688
|
if (dp.status === "failed") {
|
|
@@ -16258,7 +16698,7 @@ var PlaceOrder = ({
|
|
|
16258
16698
|
}
|
|
16259
16699
|
return __spreadProps(__spreadValues({}, prev), { dagProgress: dp });
|
|
16260
16700
|
});
|
|
16261
|
-
}, [executionProgress.dagProgress, tradingLabels
|
|
16701
|
+
}, [executionProgress.dagProgress, tradingLabels]);
|
|
16262
16702
|
(0, import_react27.useEffect)(() => {
|
|
16263
16703
|
const orderIds = submissionProgressState == null ? void 0 : submissionProgressState.orderIds;
|
|
16264
16704
|
if (!(orderIds == null ? void 0 : orderIds.length)) return;
|
|
@@ -16266,6 +16706,17 @@ var PlaceOrder = ({
|
|
|
16266
16706
|
orderIds,
|
|
16267
16707
|
executionProgress.terminalOrderEvents
|
|
16268
16708
|
);
|
|
16709
|
+
const debugStore = executionDebugStoreRef.current;
|
|
16710
|
+
const debugAttemptId = executionDebugAttemptIdRef.current;
|
|
16711
|
+
if (debugStore && debugAttemptId && executionProgress.terminalOrderEvents.length > 0) {
|
|
16712
|
+
debugStore.appendEvent(debugAttemptId, {
|
|
16713
|
+
kind: "terminal_event",
|
|
16714
|
+
data: {
|
|
16715
|
+
aggregateStatus,
|
|
16716
|
+
events: executionProgress.terminalOrderEvents
|
|
16717
|
+
}
|
|
16718
|
+
});
|
|
16719
|
+
}
|
|
16269
16720
|
if (aggregateStatus === "pending") return;
|
|
16270
16721
|
setSubmissionProgressState((prev) => {
|
|
16271
16722
|
var _a2, _b2, _c2;
|
|
@@ -16308,14 +16759,45 @@ var PlaceOrder = ({
|
|
|
16308
16759
|
tradingLabels.orderFailed
|
|
16309
16760
|
]);
|
|
16310
16761
|
(0, import_react27.useEffect)(() => {
|
|
16762
|
+
var _a2, _b2;
|
|
16311
16763
|
if (!submissionProgressState) return;
|
|
16312
16764
|
onExecutionStateChange == null ? void 0 : onExecutionStateChange(submissionProgressState);
|
|
16765
|
+
const debugStore = executionDebugStoreRef.current;
|
|
16766
|
+
const debugAttemptId = executionDebugAttemptIdRef.current;
|
|
16767
|
+
if (debugStore && debugAttemptId) {
|
|
16768
|
+
debugStore.appendEvent(debugAttemptId, {
|
|
16769
|
+
kind: "state_change",
|
|
16770
|
+
label: submissionProgressState.phase,
|
|
16771
|
+
data: {
|
|
16772
|
+
phase: submissionProgressState.phase,
|
|
16773
|
+
executionVenue: submissionProgressState.executionVenue,
|
|
16774
|
+
orderIds: submissionProgressState.orderIds,
|
|
16775
|
+
errorMessage: submissionProgressState.errorMessage
|
|
16776
|
+
}
|
|
16777
|
+
});
|
|
16778
|
+
}
|
|
16313
16779
|
if (submissionProgressState.phase === "success" && submissionProgressState.summary) {
|
|
16314
16780
|
(0, import_hooks51.invalidateBalanceQueries)(queryClient);
|
|
16315
16781
|
(0, import_hooks51.invalidatePositionQueries)(queryClient);
|
|
16782
|
+
if (debugStore && debugAttemptId) {
|
|
16783
|
+
debugStore.updateAttempt(debugAttemptId, {
|
|
16784
|
+
status: "succeeded",
|
|
16785
|
+
finalStatus: "succeeded"
|
|
16786
|
+
});
|
|
16787
|
+
}
|
|
16316
16788
|
onSuccess == null ? void 0 : onSuccess(submissionProgressState.summary);
|
|
16317
16789
|
}
|
|
16318
16790
|
if (submissionProgressState.phase === "failed" && submissionProgressState.errorMessage) {
|
|
16791
|
+
if (debugStore && debugAttemptId) {
|
|
16792
|
+
debugStore.appendError(debugAttemptId, {
|
|
16793
|
+
message: submissionProgressState.errorMessage,
|
|
16794
|
+
failedStep: (_b2 = (_a2 = submissionProgressState.dagProgress) == null ? void 0 : _a2.currentStepType) != null ? _b2 : void 0
|
|
16795
|
+
});
|
|
16796
|
+
debugStore.updateAttempt(debugAttemptId, {
|
|
16797
|
+
status: "failed",
|
|
16798
|
+
finalStatus: "failed"
|
|
16799
|
+
});
|
|
16800
|
+
}
|
|
16319
16801
|
onError == null ? void 0 : onError(new Error(submissionProgressState.errorMessage));
|
|
16320
16802
|
}
|
|
16321
16803
|
}, [submissionProgressState, onExecutionStateChange, onSuccess, onError, queryClient]);
|
|
@@ -16489,23 +16971,91 @@ var PlaceOrder = ({
|
|
|
16489
16971
|
};
|
|
16490
16972
|
const handleExecuteQuote = (0, import_react27.useCallback)(
|
|
16491
16973
|
(quoteData) => __async(null, null, function* () {
|
|
16974
|
+
var _a2, _b2, _c2;
|
|
16492
16975
|
const quoteId = quoteData == null ? void 0 : quoteData.quoteId;
|
|
16493
16976
|
if (!quoteId) {
|
|
16494
16977
|
throw new Error(tradingLabels.quoteUnavailable);
|
|
16495
16978
|
}
|
|
16979
|
+
const debugStore = executionDebugStoreRef.current;
|
|
16980
|
+
const venues = (_b2 = (_a2 = quoteData == null ? void 0 : quoteData.fills) == null ? void 0 : _a2.map((fill) => fill.venue).filter(Boolean)) != null ? _b2 : [];
|
|
16981
|
+
const debugAttempt = debugStore == null ? void 0 : debugStore.appendAttempt({
|
|
16982
|
+
status: "executing",
|
|
16983
|
+
quoteId,
|
|
16984
|
+
quote: {
|
|
16985
|
+
request: {
|
|
16986
|
+
venueMarketOutcomeId: scopedSelectedOutcomeId,
|
|
16987
|
+
amount: internalAmount,
|
|
16988
|
+
slippage: internalSlippage,
|
|
16989
|
+
tradeSide: isSell ? "sell" : "buy"
|
|
16990
|
+
},
|
|
16991
|
+
response: smartRoute.data,
|
|
16992
|
+
selectedRoute: quoteData,
|
|
16993
|
+
side: isSell ? "sell" : "buy",
|
|
16994
|
+
marketId: scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id,
|
|
16995
|
+
eventId: scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.id,
|
|
16996
|
+
outcomeId: scopedSelectedOutcomeId != null ? scopedSelectedOutcomeId : void 0,
|
|
16997
|
+
venues,
|
|
16998
|
+
capturedAt: Date.now()
|
|
16999
|
+
},
|
|
17000
|
+
selectedRoute: quoteData
|
|
17001
|
+
});
|
|
17002
|
+
executionDebugAttemptIdRef.current = (_c2 = debugAttempt == null ? void 0 : debugAttempt.attemptId) != null ? _c2 : null;
|
|
16496
17003
|
if (onPrimaryAction) {
|
|
17004
|
+
debugStore == null ? void 0 : debugStore.appendEvent(debugAttempt.attemptId, {
|
|
17005
|
+
kind: "execute_request",
|
|
17006
|
+
label: "delegated_to_partner",
|
|
17007
|
+
data: { quoteId }
|
|
17008
|
+
});
|
|
16497
17009
|
onPrimaryAction({ quoteId });
|
|
16498
17010
|
return;
|
|
16499
17011
|
}
|
|
16500
|
-
|
|
16501
|
-
|
|
16502
|
-
|
|
16503
|
-
|
|
16504
|
-
|
|
16505
|
-
|
|
16506
|
-
|
|
17012
|
+
try {
|
|
17013
|
+
const response = yield executeManaged.mutateAsync({ quoteId });
|
|
17014
|
+
if (debugAttempt) {
|
|
17015
|
+
debugStore == null ? void 0 : debugStore.appendEvent(debugAttempt.attemptId, {
|
|
17016
|
+
kind: "execute_response",
|
|
17017
|
+
data: { orderIds: response.orderIds }
|
|
17018
|
+
});
|
|
17019
|
+
debugStore == null ? void 0 : debugStore.updateAttempt(debugAttempt.attemptId, {
|
|
17020
|
+
orderId: response.orderIds[0],
|
|
17021
|
+
orderIds: response.orderIds
|
|
17022
|
+
});
|
|
17023
|
+
}
|
|
17024
|
+
setSubmissionProgressState({
|
|
17025
|
+
executionVenue: resolveExecutionVenueFromQuote(quoteData),
|
|
17026
|
+
orderId: response.orderIds[0],
|
|
17027
|
+
orderIds: response.orderIds,
|
|
17028
|
+
phase: "submitting"
|
|
17029
|
+
});
|
|
17030
|
+
} catch (error) {
|
|
17031
|
+
if (debugAttempt) {
|
|
17032
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
17033
|
+
debugStore == null ? void 0 : debugStore.appendError(debugAttempt.attemptId, {
|
|
17034
|
+
message: err.message,
|
|
17035
|
+
name: err.name,
|
|
17036
|
+
stack: err.stack,
|
|
17037
|
+
failedStep: "execute_request"
|
|
17038
|
+
});
|
|
17039
|
+
debugStore == null ? void 0 : debugStore.updateAttempt(debugAttempt.attemptId, {
|
|
17040
|
+
status: "failed",
|
|
17041
|
+
finalStatus: "failed"
|
|
17042
|
+
});
|
|
17043
|
+
}
|
|
17044
|
+
throw error;
|
|
17045
|
+
}
|
|
16507
17046
|
}),
|
|
16508
|
-
[
|
|
17047
|
+
[
|
|
17048
|
+
executeManaged,
|
|
17049
|
+
internalAmount,
|
|
17050
|
+
internalSlippage,
|
|
17051
|
+
isSell,
|
|
17052
|
+
onPrimaryAction,
|
|
17053
|
+
scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.id,
|
|
17054
|
+
scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id,
|
|
17055
|
+
scopedSelectedOutcomeId,
|
|
17056
|
+
smartRoute.data,
|
|
17057
|
+
tradingLabels.quoteUnavailable
|
|
17058
|
+
]
|
|
16509
17059
|
);
|
|
16510
17060
|
const handleSkipToSuccess = (0, import_react27.useCallback)(() => {
|
|
16511
17061
|
const primaryFilledEvent = executionProgress.terminalOrderEvents.find(
|
|
@@ -17720,7 +18270,7 @@ var HomeSearchResults = ({
|
|
|
17720
18270
|
const eventListTabs = useEventListTabs();
|
|
17721
18271
|
const { headerRef, titleRef, shouldUseSelectOverflow } = useEventListTabsHeaderOverflow(eventListTabs);
|
|
17722
18272
|
const visibleVenues = (0, import_react31.useMemo)(
|
|
17723
|
-
() => disabledVenues.length === 0 ? void 0 :
|
|
18273
|
+
() => disabledVenues.length === 0 ? void 0 : import_sdk18.VENUES.filter(
|
|
17724
18274
|
(v) => !disabledVenues.includes(v)
|
|
17725
18275
|
),
|
|
17726
18276
|
[disabledVenues]
|
|
@@ -18154,7 +18704,7 @@ HomePage.displayName = "HomePage";
|
|
|
18154
18704
|
|
|
18155
18705
|
// src/pages/user-profile/index.tsx
|
|
18156
18706
|
var import_hooks57 = require("@agg-build/hooks");
|
|
18157
|
-
var
|
|
18707
|
+
var import_sdk19 = require("@agg-build/sdk");
|
|
18158
18708
|
var import_react33 = require("react");
|
|
18159
18709
|
|
|
18160
18710
|
// src/pages/user-profile/chain-display.ts
|
|
@@ -18894,7 +19444,7 @@ var toneTextClassName = (tone) => {
|
|
|
18894
19444
|
if (tone === "negative") return "text-agg-error";
|
|
18895
19445
|
return "text-agg-muted-foreground";
|
|
18896
19446
|
};
|
|
18897
|
-
var OutcomePill = ({ label: label2 }) => /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("span", { className: "agg-position-outcome inline-flex items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("span", { className: "whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: label2 }) });
|
|
19447
|
+
var OutcomePill = ({ label: label2 }) => /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("span", { className: "agg-position-outcome max-w-[120px] inline-flex items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("span", { className: "whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground truncate", children: label2 }) });
|
|
18898
19448
|
var VenueShares = ({
|
|
18899
19449
|
model,
|
|
18900
19450
|
className,
|
|
@@ -18928,7 +19478,7 @@ var StatusBadge = ({
|
|
|
18928
19478
|
isWon ? "border-agg-success/50 bg-agg-success/10 text-agg-success" : "border-agg-muted-foreground/30 bg-agg-secondary-hover text-agg-foreground"
|
|
18929
19479
|
),
|
|
18930
19480
|
children: [
|
|
18931
|
-
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)(Icon, { name: isWon ? "check-circle" : "hourglass-start", size: "small", className: "size-2.5" }),
|
|
19481
|
+
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)(Icon, { name: isWon ? "check-circle" : "hourglass-start", size: "small", className: "size-2.5!" }),
|
|
18932
19482
|
isWon ? labels.won : labels.open
|
|
18933
19483
|
]
|
|
18934
19484
|
}
|
|
@@ -18968,7 +19518,7 @@ var TotalTradedCell = ({
|
|
|
18968
19518
|
className
|
|
18969
19519
|
}) => /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)("div", { className: cn("flex flex-col gap-[2px] whitespace-nowrap", className), children: [
|
|
18970
19520
|
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: model.totalTraded.primaryLabel }),
|
|
18971
|
-
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-
|
|
19521
|
+
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: model.totalTraded.averageLabel })
|
|
18972
19522
|
] });
|
|
18973
19523
|
var PositionValueCell = ({
|
|
18974
19524
|
value,
|
|
@@ -19077,7 +19627,7 @@ var PositionRow = ({
|
|
|
19077
19627
|
{
|
|
19078
19628
|
model,
|
|
19079
19629
|
keyPrefix: "desktop",
|
|
19080
|
-
className: "agg-position-venues flex
|
|
19630
|
+
className: "agg-position-venues flex flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2"
|
|
19081
19631
|
}
|
|
19082
19632
|
)
|
|
19083
19633
|
] })
|
|
@@ -19104,12 +19654,12 @@ var PositionRow = ({
|
|
|
19104
19654
|
"button",
|
|
19105
19655
|
{
|
|
19106
19656
|
type: "button",
|
|
19107
|
-
className: "ml-auto inline-flex h-8 items-center justify-center gap-1 rounded-agg-full px-2 font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-
|
|
19657
|
+
className: "ml-auto inline-flex h-8 cursor-pointer items-center justify-center gap-1 rounded-agg-full px-2 font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-primary hover:text-agg-primary-hover disabled:cursor-not-allowed disabled:opacity-60",
|
|
19108
19658
|
onClick: handleClaim,
|
|
19109
19659
|
disabled: isClaiming,
|
|
19110
19660
|
"aria-busy": isClaiming || void 0,
|
|
19111
19661
|
children: [
|
|
19112
|
-
isClaiming ? /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(LoadingIcon, { size: "small", className: "text-agg-
|
|
19662
|
+
isClaiming ? /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(LoadingIcon, { size: "small", className: "text-agg-primary" }) : null,
|
|
19113
19663
|
labels.claim
|
|
19114
19664
|
]
|
|
19115
19665
|
}
|
|
@@ -19137,13 +19687,13 @@ var PositionRow = ({
|
|
|
19137
19687
|
className: "hidden w-[160px] shrink-0 md:flex"
|
|
19138
19688
|
}
|
|
19139
19689
|
),
|
|
19140
|
-
/* @__PURE__ */ (0, import_jsx_runtime141.jsxs)("div", { className: "hidden w-[100px] shrink-0 items-center gap-
|
|
19690
|
+
/* @__PURE__ */ (0, import_jsx_runtime141.jsxs)("div", { className: "hidden w-[100px] shrink-0 items-center gap-3 md:flex", children: [
|
|
19141
19691
|
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)(StatusBadge, { status: model.positionStatus, labels }),
|
|
19142
19692
|
model.canClaim ? /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(
|
|
19143
19693
|
"button",
|
|
19144
19694
|
{
|
|
19145
19695
|
type: "button",
|
|
19146
|
-
className: "inline-flex h-6 items-center justify-center gap-1 rounded-agg-full font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-primary disabled:cursor-not-allowed disabled:opacity-60",
|
|
19696
|
+
className: "inline-flex h-6 cursor-pointer items-center justify-center gap-1 rounded-agg-full font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-primary hover:text-agg-primary-hover disabled:cursor-not-allowed disabled:opacity-60",
|
|
19147
19697
|
onClick: handleClaim,
|
|
19148
19698
|
disabled: isClaiming,
|
|
19149
19699
|
"aria-busy": isClaiming || void 0,
|
|
@@ -19830,6 +20380,7 @@ var UserInfoCard = ({
|
|
|
19830
20380
|
content: /* @__PURE__ */ (0, import_jsx_runtime145.jsx)("p", { className: "text-center", children: labels.auth.depositGeoBlocked }),
|
|
19831
20381
|
size: "small",
|
|
19832
20382
|
side: "bottom",
|
|
20383
|
+
sideOffset: 4,
|
|
19833
20384
|
children
|
|
19834
20385
|
}
|
|
19835
20386
|
),
|
|
@@ -20151,10 +20702,10 @@ var toTokenAmountLabel = ({
|
|
|
20151
20702
|
return `${prefix}${formatTokenAmountTwoDecimals(amountRaw, tokenSymbol, chainId)} ${tokenSymbol}`;
|
|
20152
20703
|
};
|
|
20153
20704
|
var POSITION_ROW_VENUE_ORDER = [
|
|
20154
|
-
|
|
20155
|
-
|
|
20156
|
-
|
|
20157
|
-
|
|
20705
|
+
import_sdk19.Venue.polymarket,
|
|
20706
|
+
import_sdk19.Venue.kalshi,
|
|
20707
|
+
import_sdk19.Venue.opinion,
|
|
20708
|
+
import_sdk19.Venue.limitless
|
|
20158
20709
|
];
|
|
20159
20710
|
function venueBreakdownSortKey(venue) {
|
|
20160
20711
|
const idx = POSITION_ROW_VENUE_ORDER.indexOf(venue);
|
|
@@ -20310,6 +20861,8 @@ var UserProfilePage = ({
|
|
|
20310
20861
|
try {
|
|
20311
20862
|
yield redeemMutation.mutateAsync({ venueMarketOutcomeIds });
|
|
20312
20863
|
yield queryClient.invalidateQueries({ queryKey: ["current-user"] });
|
|
20864
|
+
} catch (err) {
|
|
20865
|
+
console.error("[UserProfilePage] redeem failed", err);
|
|
20313
20866
|
} finally {
|
|
20314
20867
|
setInternalClaimingIds((prev) => {
|
|
20315
20868
|
const _a2 = prev, { [claimKey]: _removed } = _a2, rest = __objRest(_a2, [__restKey(claimKey)]);
|
|
@@ -20692,7 +21245,10 @@ var UserProfilePage = ({
|
|
|
20692
21245
|
/* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(
|
|
20693
21246
|
"div",
|
|
20694
21247
|
{
|
|
20695
|
-
className: cn(
|
|
21248
|
+
className: cn(
|
|
21249
|
+
"agg-profile-side-panels flex flex-col-reverse md:flex-col gap-4",
|
|
21250
|
+
classNames == null ? void 0 : classNames.rightColumn
|
|
21251
|
+
),
|
|
20696
21252
|
children: [
|
|
20697
21253
|
/* @__PURE__ */ (0, import_jsx_runtime146.jsx)(PositionsValueCard, { valueLabel: positionsValueLabel }),
|
|
20698
21254
|
/* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|