@agg-build/ui 1.0.0 → 1.0.1

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.
Files changed (56) hide show
  1. package/dist/{chunk-2QJXRRYP.mjs → chunk-43K4PFBC.mjs} +3 -2
  2. package/dist/{chunk-I2WBGEWK.mjs → chunk-5ES2VJHO.mjs} +159 -93
  3. package/dist/{chunk-DMKKNK76.mjs → chunk-BYMLPLEZ.mjs} +791 -583
  4. package/dist/{chunk-C7T56TJR.mjs → chunk-HD6HBTK2.mjs} +1 -1
  5. package/dist/{chunk-CGNDMLQL.mjs → chunk-LPNZOX3E.mjs} +123 -52
  6. package/dist/{chunk-75IGOQ4N.mjs → chunk-WLXYCBZV.mjs} +62 -32
  7. package/dist/{chunk-6NS7D73S.mjs → chunk-YZNO6IUD.mjs} +740 -521
  8. package/dist/events.js +196 -93
  9. package/dist/events.mjs +3 -3
  10. package/dist/index.js +3396 -2806
  11. package/dist/index.mjs +13 -7
  12. package/dist/modals.js +798 -535
  13. package/dist/modals.mjs +3 -3
  14. package/dist/pages.js +378 -176
  15. package/dist/pages.mjs +6 -6
  16. package/dist/primitives.js +713 -531
  17. package/dist/primitives.mjs +7 -1
  18. package/dist/styles.css +1 -1
  19. package/dist/tailwind.css +1 -1
  20. package/dist/trading.js +242 -54
  21. package/dist/trading.mjs +4 -4
  22. package/dist/types/deposit/steps/card-payment-pending.d.mts +3 -1
  23. package/dist/types/deposit/steps/card-payment-pending.d.ts +3 -1
  24. package/dist/types/deposit/steps/crypto-transfer.d.mts +1 -1
  25. package/dist/types/deposit/steps/crypto-transfer.d.ts +1 -1
  26. package/dist/types/events/item/event-list-item.utils.d.mts +57 -0
  27. package/dist/types/events/item/event-list-item.utils.d.ts +57 -0
  28. package/dist/types/events/item-details/event-list-item-details.types.d.mts +16 -1
  29. package/dist/types/events/item-details/event-list-item-details.types.d.ts +16 -1
  30. package/dist/types/events/market-details/market-details.types.d.mts +8 -0
  31. package/dist/types/events/market-details/market-details.types.d.ts +8 -0
  32. package/dist/types/primitives/copy-button/index.d.mts +25 -0
  33. package/dist/types/primitives/copy-button/index.d.ts +25 -0
  34. package/dist/types/primitives/index.d.mts +2 -0
  35. package/dist/types/primitives/index.d.ts +2 -0
  36. package/dist/types/primitives/toast/index.d.mts +4 -0
  37. package/dist/types/primitives/toast/index.d.ts +4 -0
  38. package/dist/types/primitives/toast/toast.types.d.mts +31 -0
  39. package/dist/types/primitives/toast/toast.types.d.ts +31 -0
  40. package/dist/types/trading/place-order/index.place-order.constants.d.mts +8 -0
  41. package/dist/types/trading/place-order/index.place-order.constants.d.ts +8 -0
  42. package/dist/types/trading/place-order/index.place-order.types.d.mts +6 -0
  43. package/dist/types/trading/place-order/index.place-order.types.d.ts +6 -0
  44. package/dist/types/trading/place-order/index.place-order.utils.d.mts +4 -7
  45. package/dist/types/trading/place-order/index.place-order.utils.d.ts +4 -7
  46. package/dist/types/withdraw/index.d.mts +2 -2
  47. package/dist/types/withdraw/index.d.ts +2 -2
  48. package/dist/types/withdraw/steps/withdraw-amount.d.mts +6 -3
  49. package/dist/types/withdraw/steps/withdraw-amount.d.ts +6 -3
  50. package/dist/types/withdraw/steps/withdraw-success.d.mts +8 -1
  51. package/dist/types/withdraw/steps/withdraw-success.d.ts +8 -1
  52. package/dist/types/withdraw/steps/withdraw-success.utils.d.mts +36 -0
  53. package/dist/types/withdraw/steps/withdraw-success.utils.d.ts +36 -0
  54. package/dist/types/withdraw/withdraw-modal.types.d.mts +25 -15
  55. package/dist/types/withdraw/withdraw-modal.types.d.ts +25 -15
  56. package/package.json +6 -5
package/dist/pages.js CHANGED
@@ -110,6 +110,7 @@ var import_react = require("react");
110
110
 
111
111
  // src/constants.ts
112
112
  var AGG_ROOT_CLASS_NAME = "agg-root";
113
+ var AGG_TERMS_OF_SERVICE_URL = "https://build.agg.market/terms-and-conditions";
113
114
 
114
115
  // src/shared/utils.ts
115
116
  var cn = (...values) => values.filter(Boolean).join(" ");
@@ -3881,8 +3882,8 @@ var LineChart = ({
3881
3882
  LineChart.displayName = "LineChart";
3882
3883
 
3883
3884
  // src/primitives/currency-input/index.tsx
3884
- var import_react5 = require("react");
3885
3885
  var import_hooks7 = require("@agg-build/hooks");
3886
+ var import_react5 = require("react");
3886
3887
 
3887
3888
  // src/primitives/currency-input/currency-input.constants.ts
3888
3889
  var CURRENCY_INPUT_DEFAULT_PREFIX = "$";
@@ -3993,13 +3994,13 @@ var CurrencyInput = ({
3993
3994
  general: { locale }
3994
3995
  } = (0, import_hooks7.useSdkUiConfig)();
3995
3996
  const parts = (0, import_react5.useMemo)(() => resolveCurrencyInputFormatParts(locale), [locale]);
3996
- const [raw, setRaw] = (0, import_react5.useState)(() => value > 0 ? String(value) : "");
3997
+ const [raw, setRaw] = (0, import_react5.useState)(() => value >= 0 ? String(value) : "");
3997
3998
  const isEditingRef = (0, import_react5.useRef)(false);
3998
3999
  const inputRef = (0, import_react5.useRef)(null);
3999
4000
  const caretPosRef = (0, import_react5.useRef)(null);
4000
4001
  (0, import_react5.useEffect)(() => {
4001
4002
  if (!isEditingRef.current) {
4002
- setRaw(value > 0 ? String(value) : "");
4003
+ setRaw(value >= 0 ? String(value) : "");
4003
4004
  }
4004
4005
  }, [value]);
4005
4006
  const numericDisplay = formatCurrencyInputRawValue(raw, locale, decimalPlaces, parts);
@@ -4097,7 +4098,7 @@ var CurrencyInput = ({
4097
4098
  isEditingRef.current = false;
4098
4099
  const numericValue = parseFloat(raw);
4099
4100
  const nextValue = isNaN(numericValue) ? min : clampCurrencyInputValue(numericValue, min, max);
4100
- setRaw(nextValue > 0 ? String(nextValue) : "");
4101
+ setRaw(nextValue >= 0 ? String(nextValue) : "");
4101
4102
  onChange == null ? void 0 : onChange(nextValue);
4102
4103
  onBlur == null ? void 0 : onBlur();
4103
4104
  };
@@ -4380,12 +4381,16 @@ var resolveVisibleOutcomes = (venueMarkets) => {
4380
4381
  return [...visibleOutcomesByLabel.values()].sort(compareVisibleOutcomeRows).slice(0, Math.max(1, 2));
4381
4382
  };
4382
4383
  var dedupeVenueMarketsById = (venueMarkets) => {
4383
- const seenVenueMarketIds = /* @__PURE__ */ new Set();
4384
+ const seenClusterIds = /* @__PURE__ */ new Set();
4384
4385
  return venueMarkets.filter((venueMarket) => {
4385
- if (seenVenueMarketIds.has(venueMarket.id)) {
4386
+ var _a;
4387
+ if (seenClusterIds.has(venueMarket.id)) {
4386
4388
  return false;
4387
4389
  }
4388
- seenVenueMarketIds.add(venueMarket.id);
4390
+ seenClusterIds.add(venueMarket.id);
4391
+ for (const sibling of (_a = venueMarket.matchedVenueMarkets) != null ? _a : []) {
4392
+ seenClusterIds.add(sibling.id);
4393
+ }
4389
4394
  return true;
4390
4395
  });
4391
4396
  };
@@ -4427,6 +4432,40 @@ var getVenueSummary = (venueMarkets) => {
4427
4432
  singleVenue: uniqueVenues.length === 1 ? uniqueVenues[0] : void 0
4428
4433
  };
4429
4434
  };
4435
+ function buildSpreadByVenueMarketId(midpointRows) {
4436
+ const map = /* @__PURE__ */ new Map();
4437
+ for (const row of midpointRows) {
4438
+ map.set(row.venueMarketId, row.spread);
4439
+ for (const matched of row.matched) {
4440
+ if (!map.has(matched.venueMarketId)) {
4441
+ map.set(matched.venueMarketId, matched.spread);
4442
+ }
4443
+ }
4444
+ }
4445
+ return map;
4446
+ }
4447
+ function resolveBestMidpointForMarket(market, midpointsByVenueMarketId, spreadByVenueMarketId) {
4448
+ var _a;
4449
+ const candidates = [
4450
+ { id: market.id, venue: market.venue },
4451
+ ...((_a = market.matchedVenueMarkets) != null ? _a : []).map((m) => ({ id: m.id, venue: m.venue }))
4452
+ ];
4453
+ const seen = /* @__PURE__ */ new Set();
4454
+ const deduped = candidates.filter((c) => {
4455
+ if (seen.has(c.id)) return false;
4456
+ seen.add(c.id);
4457
+ return true;
4458
+ });
4459
+ const valid = [];
4460
+ for (const candidate of deduped) {
4461
+ const midpoint = midpointsByVenueMarketId.get(candidate.id);
4462
+ if (midpoint == null) continue;
4463
+ valid.push(__spreadProps(__spreadValues({}, candidate), { midpoint }));
4464
+ }
4465
+ if (valid.length === 0) return void 0;
4466
+ const best = valid.reduce((acc, cur) => cur.midpoint < acc.midpoint ? cur : acc);
4467
+ return { midpoint: best.midpoint, venueMarketId: best.id, venue: best.venue };
4468
+ }
4430
4469
  var resolveDisplayVolume = (eventVolume, venueMarkets) => {
4431
4470
  const clusterMarkets = normalizeVenueMarketCluster(venueMarkets);
4432
4471
  const marketSum = clusterMarkets.reduce(
@@ -8210,9 +8249,6 @@ var EventListItemContent = ({
8210
8249
  const allVenueMarkets = (0, import_react12.useMemo)(() => {
8211
8250
  return dedupeVenueMarketsById(event.venueMarkets);
8212
8251
  }, [event.venueMarkets]);
8213
- const _primaryVenueMarket = (0, import_react12.useMemo)(() => {
8214
- return selectPrimaryVenueMarket(allVenueMarkets);
8215
- }, [allVenueMarkets]);
8216
8252
  const resolvedTitle = event.title;
8217
8253
  const resolvedImage = event.image;
8218
8254
  const visibleVenueLogos = (0, import_react12.useMemo)(() => {
@@ -8223,11 +8259,12 @@ var EventListItemContent = ({
8223
8259
  const resolvedVenueCount = typeof event.venueCount === "number" && Number.isFinite(event.venueCount) ? Math.max(0, Math.floor(event.venueCount)) : visibleVenueLogos.length;
8224
8260
  const [isLazyMarketsQueryEnabled, setIsLazyMarketsQueryEnabled] = (0, import_react12.useState)(false);
8225
8261
  const shouldEnableLazyMarketLoading = (0, import_react12.useMemo)(() => {
8226
- if (allVenueMarkets.length <= 1) return false;
8227
8262
  if (!event.id) return false;
8228
8263
  const hasExplicitMarketCount = typeof event.marketCount === "number" && Number.isFinite(event.marketCount);
8229
- if (!hasExplicitMarketCount) return true;
8230
- return resolvedMarketCount > allVenueMarkets.length;
8264
+ if (hasExplicitMarketCount) {
8265
+ return resolvedMarketCount > allVenueMarkets.length;
8266
+ }
8267
+ return allVenueMarkets.length > 1;
8231
8268
  }, [allVenueMarkets.length, event.id, event.marketCount, resolvedMarketCount]);
8232
8269
  const {
8233
8270
  markets: lazyLoadedMarkets,
@@ -8258,12 +8295,17 @@ var EventListItemContent = ({
8258
8295
  }, [resolvedOutcomeMarkets]);
8259
8296
  const {
8260
8297
  midpointsByVenueMarketId,
8298
+ midpointRows,
8261
8299
  isLoading: isLoadingMidpoints,
8262
8300
  isFetching: isFetchingMidpoints
8263
8301
  } = (0, import_hooks34.useVenueMarketMidpoints)({
8264
8302
  venueMarketIds: midpointVenueMarketIds,
8265
8303
  enabled: midpointVenueMarketIds.length > 0
8266
8304
  });
8305
+ const spreadByVenueMarketId = (0, import_react12.useMemo)(
8306
+ () => buildSpreadByVenueMarketId(midpointRows),
8307
+ [midpointRows]
8308
+ );
8267
8309
  const gapsByVenueMarketId = (0, import_react12.useMemo)(
8268
8310
  () => (0, import_hooks34.computePriceGaps)({
8269
8311
  markets: resolvedOutcomeMarkets,
@@ -8272,13 +8314,7 @@ var EventListItemContent = ({
8272
8314
  [resolvedOutcomeMarkets, midpointsByVenueMarketId]
8273
8315
  );
8274
8316
  const isMidpointQueryInFlight = isLoadingMidpoints || isFetchingMidpoints;
8275
- const resolveMarketMidpoint = (0, import_react12.useCallback)(
8276
- (marketId) => {
8277
- return normalizeProbability(midpointsByVenueMarketId.get(marketId));
8278
- },
8279
- [midpointsByVenueMarketId]
8280
- );
8281
- const shouldRenderLoadingOutcomeRow = shouldEnableLazyMarketLoading && isLazyMarketsQueryEnabled && (isLoadingLazyMarkets || isFetchingNextLazyMarketsPage);
8317
+ const shouldRenderLoadingOutcomeRow = shouldEnableLazyMarketLoading && (!isLazyMarketsQueryEnabled || isLoadingLazyMarkets || isFetchingNextLazyMarketsPage || hasNextLazyMarketsPage);
8282
8318
  const resolvedVolume = resolveDisplayVolume(event.volume, allVenueMarkets);
8283
8319
  const volumeLabel = typeof resolvedVolume === "number" ? `${config.formatting.formatCompactCurrency(resolvedVolume)} ${labels.eventItem.volumeSuffix}` : "";
8284
8320
  const shouldUseNativeLinkNavigation3 = (eventToHandle) => {
@@ -8484,72 +8520,87 @@ var EventListItemContent = ({
8484
8520
  ),
8485
8521
  onScroll: handleOutcomesScroll,
8486
8522
  children: [
8487
- resolvedOutcomeMarkets.length === 1 ? sortOutcomes(resolvedOutcomeMarkets[0].venueMarketOutcomes).map((outcome) => {
8523
+ resolvedOutcomeMarkets.length === 1 ? (() => {
8524
+ var _a;
8488
8525
  const market = resolvedOutcomeMarkets[0];
8489
- const marketMidpoint = resolveMarketMidpoint(market.id);
8526
+ const bestMidpoint = resolveBestMidpointForMarket(
8527
+ market,
8528
+ midpointsByVenueMarketId,
8529
+ spreadByVenueMarketId
8530
+ );
8531
+ const marketMidpoint = bestMidpoint != null ? normalizeProbability(bestMidpoint.midpoint) : void 0;
8532
+ const bestVenue = (_a = bestMidpoint == null ? void 0 : bestMidpoint.venue) != null ? _a : market.venue;
8490
8533
  const hasYesOutcome = market.venueMarketOutcomes.some(
8491
8534
  (item) => isYesLabel(item.label)
8492
8535
  );
8493
8536
  const hasNoOutcome = market.venueMarketOutcomes.some((item) => isNoLabel2(item.label));
8494
8537
  const shouldUseMidpoint = hasYesOutcome && hasNoOutcome;
8495
- const probability = (() => {
8496
- if (!shouldUseMidpoint) {
8497
- return normalizeProbability(outcome.price);
8498
- }
8499
- if (marketMidpoint == null) {
8500
- if (isMidpointQueryInFlight) return void 0;
8538
+ return sortOutcomes(market.venueMarketOutcomes).map((outcome) => {
8539
+ const probability = (() => {
8540
+ if (!shouldUseMidpoint) {
8541
+ return normalizeProbability(outcome.price);
8542
+ }
8543
+ if (marketMidpoint == null) {
8544
+ if (isMidpointQueryInFlight) return void 0;
8545
+ return normalizeProbability(outcome.price);
8546
+ }
8547
+ if (isYesLabel(outcome.label)) {
8548
+ return marketMidpoint;
8549
+ }
8550
+ if (isNoLabel2(outcome.label)) {
8551
+ return normalizeProbability(1 - marketMidpoint);
8552
+ }
8501
8553
  return normalizeProbability(outcome.price);
8502
- }
8503
- if (isYesLabel(outcome.label)) {
8504
- return marketMidpoint;
8505
- }
8506
- if (isNoLabel2(outcome.label)) {
8507
- return normalizeProbability(1 - marketMidpoint);
8508
- }
8509
- return normalizeProbability(outcome.price);
8510
- })();
8511
- const shouldRenderMidpointSkeleton = shouldUseMidpoint && marketMidpoint == null && isMidpointQueryInFlight;
8512
- const arbitragePercent = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[outcome.id];
8513
- const _priceGapPct = gapsByVenueMarketId.get(market.id);
8514
- return /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(
8515
- "div",
8516
- {
8517
- className: cn(
8518
- "agg-outcome-row",
8519
- "flex flex-row gap-3 w-full items-center justify-between",
8520
- classNames == null ? void 0 : classNames.outcomeRow
8521
- ),
8522
- children: [
8523
- /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("div", { className: "agg-outcome-label-row flex min-w-0 flex-row items-center justify-start gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
8524
- Typography,
8525
- {
8526
- variant: "body",
8527
- className: "agg-outcome-label min-w-0 truncate text-agg-sm leading-agg-5 md:text-agg-base md:leading-agg-6",
8528
- children: resolveOutcomeTitle(outcome)
8529
- }
8530
- ) }),
8531
- /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: "agg-outcome-meta flex flex-row items-center justify-end gap-3", children: [
8532
- renderArbitrage(arbitragePercent),
8533
- renderOutcomePriceBadge(
8534
- probability,
8535
- market.venue,
8536
- shouldRenderMidpointSkeleton,
8537
- market,
8538
- outcome
8539
- )
8540
- ] })
8541
- ]
8542
- },
8543
- outcome.id
8544
- );
8545
- }) : sortMarketsByYesOddsDesc(resolvedOutcomeMarkets).map((market) => {
8546
- var _a, _b;
8554
+ })();
8555
+ const shouldRenderMidpointSkeleton = shouldUseMidpoint && marketMidpoint == null && isMidpointQueryInFlight;
8556
+ const arbitragePercent = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[outcome.id];
8557
+ const _priceGapPct = gapsByVenueMarketId.get(market.id);
8558
+ return /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(
8559
+ "div",
8560
+ {
8561
+ className: cn(
8562
+ "agg-outcome-row",
8563
+ "flex flex-row gap-3 w-full items-center justify-between",
8564
+ classNames == null ? void 0 : classNames.outcomeRow
8565
+ ),
8566
+ children: [
8567
+ /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("div", { className: "agg-outcome-label-row flex min-w-0 flex-row items-center justify-start gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
8568
+ Typography,
8569
+ {
8570
+ variant: "body",
8571
+ className: "agg-outcome-label min-w-0 truncate text-agg-sm leading-agg-5 md:text-agg-base md:leading-agg-6",
8572
+ children: resolveOutcomeTitle(outcome)
8573
+ }
8574
+ ) }),
8575
+ /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: "agg-outcome-meta flex flex-row items-center justify-end gap-3", children: [
8576
+ renderArbitrage(arbitragePercent),
8577
+ renderOutcomePriceBadge(
8578
+ probability,
8579
+ bestVenue,
8580
+ shouldRenderMidpointSkeleton,
8581
+ market,
8582
+ outcome
8583
+ )
8584
+ ] })
8585
+ ]
8586
+ },
8587
+ outcome.id
8588
+ );
8589
+ });
8590
+ })() : sortMarketsByYesOddsDesc(resolvedOutcomeMarkets).map((market) => {
8591
+ var _a, _b, _c;
8547
8592
  const yesOutcome = resolveYesOutcome(market);
8548
8593
  const displayOutcome = yesOutcome != null ? yesOutcome : (_b = market.venueMarketOutcomes) == null ? void 0 : _b.reduce(
8549
8594
  (acc, o) => o.price > acc.price ? o : acc,
8550
8595
  (_a = market.venueMarketOutcomes) == null ? void 0 : _a[0]
8551
8596
  );
8552
- const marketMidpoint = resolveMarketMidpoint(market.id);
8597
+ const bestMidpoint = resolveBestMidpointForMarket(
8598
+ market,
8599
+ midpointsByVenueMarketId,
8600
+ spreadByVenueMarketId
8601
+ );
8602
+ const marketMidpoint = bestMidpoint != null ? normalizeProbability(bestMidpoint.midpoint) : void 0;
8603
+ const bestVenue = (_c = bestMidpoint == null ? void 0 : bestMidpoint.venue) != null ? _c : market.venue;
8553
8604
  const probability = marketMidpoint != null ? marketMidpoint : isMidpointQueryInFlight ? void 0 : normalizeProbability(displayOutcome == null ? void 0 : displayOutcome.price);
8554
8605
  const shouldRenderMidpointSkeleton = marketMidpoint == null && isMidpointQueryInFlight;
8555
8606
  const arbitragePercent = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[market.id];
@@ -8576,7 +8627,7 @@ var EventListItemContent = ({
8576
8627
  renderArbitrage(arbitragePercent),
8577
8628
  renderOutcomePriceBadge(
8578
8629
  probability,
8579
- market.venue,
8630
+ bestVenue,
8580
8631
  shouldRenderMidpointSkeleton,
8581
8632
  market,
8582
8633
  displayOutcome
@@ -10775,6 +10826,8 @@ var EventListItemDetailsGraphSection = ({
10775
10826
  selectedChartType,
10776
10827
  venueMarkets,
10777
10828
  livePrices,
10829
+ wsLivePrices,
10830
+ restMidpoints,
10778
10831
  live
10779
10832
  }) => {
10780
10833
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
@@ -10931,7 +10984,7 @@ var EventListItemDetailsGraphSection = ({
10931
10984
  ),
10932
10985
  children: chartAvailableVenueOutcomes.map((item) => {
10933
10986
  var _a3;
10934
- const percentage = (_a3 = livePrices.get(item.outcome.id)) != null ? _a3 : item.outcome.price;
10987
+ const percentage = (_a3 = wsLivePrices.get(item.outcome.id)) != null ? _a3 : item.outcome.price;
10935
10988
  const text = formatMarketProbabilityPercent(percentage, formatPercent);
10936
10989
  const seriesId = `${item.venue}-chart`;
10937
10990
  const isActiveVenue = activeGraphVenue === item.venue;
@@ -10992,8 +11045,8 @@ var EventListItemDetailsGraphSection = ({
10992
11045
  tradingContext == null ? void 0 : tradingContext.selectOutcome(outcomeId);
10993
11046
  },
10994
11047
  options: selectedMarketOutcomes.map((outcome) => {
10995
- var _a3;
10996
- const price = (_a3 = livePrices.get(outcome.id)) != null ? _a3 : outcome.price;
11048
+ var _a3, _b3;
11049
+ const price = (_b3 = (_a3 = restMidpoints.get(outcome.id)) != null ? _a3 : livePrices.get(outcome.id)) != null ? _b3 : outcome.price;
10997
11050
  return {
10998
11051
  value: outcome.id,
10999
11052
  label: `${outcome.label} ${formatProbabilityCents(price)}`,
@@ -11210,6 +11263,8 @@ var EventListItemDetailsContent = ({
11210
11263
  venueInfo,
11211
11264
  venueMarkets,
11212
11265
  livePrices,
11266
+ wsLivePrices,
11267
+ restMidpoints,
11213
11268
  live: false
11214
11269
  }
11215
11270
  ),
@@ -11448,18 +11503,42 @@ var useCenterOrderbookSpread = ({
11448
11503
  if (!enabled) return;
11449
11504
  if (hasAutoCenteredRef.current || hasUserScrolledRef.current) return;
11450
11505
  let isCancelled = false;
11506
+ let resizeObserver = null;
11451
11507
  const cancelPendingFrame = () => {
11452
11508
  if (animationFrameRef.current === null) return;
11453
11509
  window.cancelAnimationFrame(animationFrameRef.current);
11454
11510
  animationFrameRef.current = null;
11455
11511
  };
11512
+ const disconnectResizeObserver = () => {
11513
+ resizeObserver == null ? void 0 : resizeObserver.disconnect();
11514
+ resizeObserver = null;
11515
+ };
11456
11516
  const scheduleMeasurement = () => {
11457
11517
  cancelPendingFrame();
11458
11518
  animationFrameRef.current = window.requestAnimationFrame(measureAndCenter);
11459
11519
  };
11520
+ const setupResizeObserverFallback = () => {
11521
+ if (resizeObserver) return;
11522
+ const container = containerRef.current;
11523
+ if (!container) return;
11524
+ resizeObserver = new ResizeObserver(() => {
11525
+ if (isCancelled || hasAutoCenteredRef.current || hasUserScrolledRef.current) {
11526
+ disconnectResizeObserver();
11527
+ return;
11528
+ }
11529
+ if (container.clientHeight <= 0) return;
11530
+ disconnectResizeObserver();
11531
+ retryCountRef.current = 0;
11532
+ scheduleMeasurement();
11533
+ });
11534
+ resizeObserver.observe(container);
11535
+ };
11460
11536
  const scheduleRetry = () => {
11461
11537
  if (isCancelled || hasUserScrolledRef.current || hasAutoCenteredRef.current) return;
11462
- if (retryCountRef.current >= maxAutoCenterAttempts) return;
11538
+ if (retryCountRef.current >= maxAutoCenterAttempts) {
11539
+ setupResizeObserverFallback();
11540
+ return;
11541
+ }
11463
11542
  retryCountRef.current += 1;
11464
11543
  scheduleMeasurement();
11465
11544
  };
@@ -11484,6 +11563,11 @@ var useCenterOrderbookSpread = ({
11484
11563
  }
11485
11564
  const spreadOffsetTop = container.scrollTop + (spreadRect.top - containerRect.top);
11486
11565
  const maxScrollTop = Math.max(0, container.scrollHeight - containerHeight);
11566
+ if (maxScrollTop === 0) {
11567
+ retryCountRef.current = 0;
11568
+ animationFrameRef.current = null;
11569
+ return;
11570
+ }
11487
11571
  const targetScrollTop = Math.max(
11488
11572
  0,
11489
11573
  Math.min(maxScrollTop, spreadOffsetTop - containerHeight / 2 + spreadRect.height / 2)
@@ -11492,11 +11576,13 @@ var useCenterOrderbookSpread = ({
11492
11576
  hasAutoCenteredRef.current = true;
11493
11577
  retryCountRef.current = 0;
11494
11578
  animationFrameRef.current = null;
11579
+ disconnectResizeObserver();
11495
11580
  };
11496
11581
  scheduleMeasurement();
11497
11582
  return () => {
11498
11583
  isCancelled = true;
11499
11584
  cancelPendingFrame();
11585
+ disconnectResizeObserver();
11500
11586
  };
11501
11587
  }, [containerRef, enabled, resetKey, rowCount, spreadRef]);
11502
11588
  const recenter = (0, import_react19.useCallback)(() => {
@@ -11980,6 +12066,7 @@ var MarketDetailsOutcomeButton = ({
11980
12066
  type: "button",
11981
12067
  role: "tab",
11982
12068
  "data-id": item.id,
12069
+ "data-venue": item.venue,
11983
12070
  "aria-controls": ariaControls,
11984
12071
  "aria-selected": isSelected,
11985
12072
  tabIndex: isSelected ? 0 : -1,
@@ -12081,7 +12168,8 @@ var MarketDetailsContent = ({
12081
12168
  classNames,
12082
12169
  otherContent,
12083
12170
  live,
12084
- midpointsFallback
12171
+ midpointsFallback,
12172
+ midpointsFallbackVenues
12085
12173
  }) => {
12086
12174
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12087
12175
  const config = (0, import_hooks45.useSdkUiConfig)();
@@ -12112,7 +12200,7 @@ var MarketDetailsContent = ({
12112
12200
  if (!controlledIsOpened || !resolvedMarket) return [];
12113
12201
  return resolvedMarket.venueMarkets;
12114
12202
  }, [controlledIsOpened, resolvedMarket]);
12115
- const { prices: clusterMidpoints } = (0, import_hooks45.useMidpoints)(clusterMidpointMarkets);
12203
+ const { prices: clusterMidpoints, venueByOutcomeId: clusterVenueByOutcomeId } = (0, import_hooks45.useMidpoints)(clusterMidpointMarkets);
12116
12204
  const livePrices = (0, import_react21.useMemo)(() => {
12117
12205
  const merged = /* @__PURE__ */ new Map();
12118
12206
  if (midpointsFallback == null ? void 0 : midpointsFallback.size) {
@@ -12194,24 +12282,39 @@ var MarketDetailsContent = ({
12194
12282
  if (!model) return [];
12195
12283
  const items = resolveHeaderOutcomeItems(model.market.venueMarkets);
12196
12284
  return items.map((item) => {
12197
- const livePrice = (0, import_hooks45.findLivePriceById)(livePrices, item.id);
12198
- return livePrice != null ? __spreadProps(__spreadValues({}, item), { probability: livePrice }) : item;
12285
+ const clusterPrice = clusterMidpoints.get(item.id);
12286
+ if (clusterPrice != null) {
12287
+ const bestVenue = clusterVenueByOutcomeId.get(item.id);
12288
+ return __spreadValues(__spreadProps(__spreadValues({}, item), { probability: clusterPrice }), bestVenue ? { venue: bestVenue } : {});
12289
+ }
12290
+ const fallbackPrice = midpointsFallback == null ? void 0 : midpointsFallback.get(item.id);
12291
+ if (fallbackPrice != null) {
12292
+ const bestVenue = midpointsFallbackVenues == null ? void 0 : midpointsFallbackVenues.get(item.id);
12293
+ return __spreadValues(__spreadProps(__spreadValues({}, item), { probability: fallbackPrice }), bestVenue ? { venue: bestVenue } : {});
12294
+ }
12295
+ const wsPrice = (0, import_hooks45.findLivePriceById)(wsLivePrices, item.id);
12296
+ return wsPrice != null ? __spreadProps(__spreadValues({}, item), { probability: wsPrice }) : item;
12199
12297
  });
12200
- }, [model, livePrices]);
12298
+ }, [
12299
+ model,
12300
+ clusterMidpoints,
12301
+ clusterVenueByOutcomeId,
12302
+ midpointsFallback,
12303
+ midpointsFallbackVenues,
12304
+ wsLivePrices
12305
+ ]);
12201
12306
  const headlineProbability = (0, import_react21.useMemo)(() => {
12202
- var _a2, _b2;
12307
+ var _a2, _b2, _c2, _d2;
12203
12308
  if (!model || !scopedMarketForCard) return void 0;
12204
- const resolveLiveProbability = (outcomeId, fallbackPrice) => {
12205
- const liveProbability = (0, import_hooks45.findLivePriceById)(livePrices, outcomeId);
12206
- return liveProbability != null ? liveProbability : fallbackPrice;
12207
- };
12208
12309
  const yesOutcome = resolveYesOutcome(scopedMarketForCard);
12209
12310
  const displayOutcome = yesOutcome != null ? yesOutcome : (_b2 = scopedMarketForCard.venueMarketOutcomes) == null ? void 0 : _b2.reduce(
12210
12311
  (acc, outcome) => outcome.price > acc.price ? outcome : acc,
12211
12312
  (_a2 = scopedMarketForCard.venueMarketOutcomes) == null ? void 0 : _a2[0]
12212
12313
  );
12213
- return resolveLiveProbability(displayOutcome.id, displayOutcome.price);
12214
- }, [model, scopedMarketForCard, livePrices]);
12314
+ const restPrice = (_c2 = clusterMidpoints.get(displayOutcome.id)) != null ? _c2 : midpointsFallback == null ? void 0 : midpointsFallback.get(displayOutcome.id);
12315
+ if (restPrice != null) return restPrice;
12316
+ return (_d2 = (0, import_hooks45.findLivePriceById)(wsLivePrices, displayOutcome.id)) != null ? _d2 : displayOutcome.price;
12317
+ }, [model, scopedMarketForCard, clusterMidpoints, midpointsFallback, wsLivePrices]);
12215
12318
  const selectedOutcomesByVenue = (0, import_react21.useMemo)(() => {
12216
12319
  if (!model) return [];
12217
12320
  return collectEligibleVenueOutcomes({
@@ -12711,7 +12814,7 @@ var MarketDetailsContent = ({
12711
12814
  /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("div", { className: "agg-market-venues flex flex-wrap gap-2", children: chartAvailableOutcomesByVenue.map((item) => {
12712
12815
  var _a3;
12713
12816
  const probability = formatProbabilityPercent(
12714
- (_a3 = livePrices.get(item.outcome.id)) != null ? _a3 : item.outcome.price,
12817
+ (_a3 = wsLivePrices.get(item.outcome.id)) != null ? _a3 : item.outcome.price,
12715
12818
  formatPercent
12716
12819
  );
12717
12820
  const isActiveVenue = selectedGraphVenue === item.venue;
@@ -12757,8 +12860,7 @@ var MarketDetailsContent = ({
12757
12860
  setChartOutcomeLabel(outcome.label);
12758
12861
  },
12759
12862
  options: headerOutcomeItems.map((outcome) => {
12760
- var _a3;
12761
- const price = (_a3 = livePrices.get(outcome.id)) != null ? _a3 : outcome.probability;
12863
+ const price = outcome.probability;
12762
12864
  const outcomeLabel = `${outcome.label} ${formatProbabilityCents(price)}`;
12763
12865
  return {
12764
12866
  value: outcome.id,
@@ -12864,7 +12966,8 @@ var MarketDetails = (_a) => {
12864
12966
  isOpened,
12865
12967
  onOpenChange: props.onOpenChange,
12866
12968
  venueMarkets: props.venueMarkets,
12867
- midpointsFallback: props.midpointsFallback
12969
+ midpointsFallback: props.midpointsFallback,
12970
+ midpointsFallbackVenues: props.midpointsFallbackVenues
12868
12971
  })
12869
12972
  );
12870
12973
  }
@@ -13001,7 +13104,7 @@ var MarketDetailsList = ({
13001
13104
  return [...groupedMarkets.primary, ...visibleResolvedMarkets];
13002
13105
  }, [groupedMarkets.primary, visibleResolvedMarkets]);
13003
13106
  const hasPrefetchedMarkets = !!providedMarkets || !!((_b = eventTradingState == null ? void 0 : eventTradingState.marketStates) == null ? void 0 : _b.length);
13004
- const { prices: midpointsFallback } = (0, import_hooks45.useViewportMidpoints)(displayedMarkets);
13107
+ const { prices: midpointsFallback, venueByOutcomeId: midpointsFallbackVenues } = (0, import_hooks45.useViewportMidpoints)(displayedMarkets);
13005
13108
  (0, import_react21.useEffect)(() => {
13006
13109
  if (isResolvedEvent) {
13007
13110
  setAreResolvedMarketsVisible(false);
@@ -13114,7 +13217,8 @@ var MarketDetailsList = ({
13114
13217
  ariaLabel: market.question,
13115
13218
  classNames: { root: cn("agg-market-list-item", classNames == null ? void 0 : classNames.item) },
13116
13219
  live,
13117
- midpointsFallback
13220
+ midpointsFallback,
13221
+ midpointsFallbackVenues
13118
13222
  }
13119
13223
  ) }, market.id);
13120
13224
  return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: cn("agg-market-list flex flex-col gap-3", classNames == null ? void 0 : classNames.root), children: [
@@ -13594,7 +13698,7 @@ var import_hooks49 = require("@agg-build/hooks");
13594
13698
  var import_jsx_runtime127 = require("react/jsx-runtime");
13595
13699
  var GeoBlockBanner = ({
13596
13700
  venue,
13597
- termsUrl = "#",
13701
+ termsUrl = AGG_TERMS_OF_SERVICE_URL,
13598
13702
  className
13599
13703
  }) => {
13600
13704
  const labels = (0, import_hooks49.useLabels)();
@@ -13741,7 +13845,9 @@ var useKalshiKycFlow = ({
13741
13845
  };
13742
13846
 
13743
13847
  // src/trading/place-order/index.place-order.constants.ts
13848
+ var PLACE_ORDER_DEFAULT_AMOUNT = 20;
13744
13849
  var MIN_BUY_ORDER_AMOUNT = 1;
13850
+ var MIN_SELL_ORDER_SHARES = 1;
13745
13851
  var DEFAULT_SLIPPAGE_VALUE = "0.5";
13746
13852
  var HIGH_SLIPPAGE_THRESHOLD = 10;
13747
13853
  var PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT = 3;
@@ -13952,10 +14058,12 @@ var resolvePlaceOrderQuoteStatus = ({
13952
14058
  var buildLiveRouteCards = ({
13953
14059
  labels,
13954
14060
  quoteData,
13955
- tradeSide
14061
+ tradeSide,
14062
+ eventVenues = []
13956
14063
  }) => {
13957
14064
  var _a, _b, _c;
13958
14065
  const geoBlockedVenues = extractGeoBlockedVenues(quoteData.warnings);
14066
+ const eventVenueSet = new Set(eventVenues);
13959
14067
  const primaryResult = resolvePlaceOrderQuoteResult({ labels, quoteData, tradeSide });
13960
14068
  const primaryVenue = (_a = quoteData.fills[0]) == null ? void 0 : _a.venue;
13961
14069
  const parsedPrimaryVenue = parseVenue(primaryVenue);
@@ -14053,24 +14161,26 @@ var buildLiveRouteCards = ({
14053
14161
  });
14054
14162
  const baseCards = primaryCard ? [primaryCard, ...soloCards] : soloCards;
14055
14163
  const coveredVenueStrings = new Set(
14056
- [...baseCards, ...unavailableCards].flatMap((c) => c.venue ? [c.venue] : [])
14164
+ [...baseCards, ...unavailableCards].flatMap((card) => card.venue ? [card.venue] : [])
14057
14165
  );
14058
- const geoBlockedOnlyCards = [...geoBlockedVenues].filter((venueStr) => !coveredVenueStrings.has(venueStr)).map((venueStr) => {
14059
- const parsedVenue = parseVenue(venueStr);
14060
- const venue = parsedVenue.success ? parsedVenue.data : void 0;
14061
- return {
14062
- id: `live-geo-blocked-${venueStr}`,
14063
- hint: "",
14064
- kind: "venue",
14065
- label: getTradingVenueLabel(venue),
14066
- numericValue: 0,
14067
- quoteData,
14068
- value: "",
14069
- venue,
14070
- isUnavailable: true
14071
- };
14072
- });
14073
- return [...baseCards, ...unavailableCards, ...geoBlockedOnlyCards];
14166
+ const parsedKalshiVenue = parseVenue("kalshi");
14167
+ const kalshiVenue = parsedKalshiVenue.success ? parsedKalshiVenue.data : void 0;
14168
+ const warningOnlyUnavailableCards = geoBlockedVenues.has("kalshi") && !!kalshiVenue && eventVenueSet.has(kalshiVenue) && !coveredVenueStrings.has("kalshi") ? (() => {
14169
+ return [
14170
+ {
14171
+ id: "live-geo-blocked-kalshi",
14172
+ hint: "",
14173
+ kind: "venue",
14174
+ label: getTradingVenueLabel(kalshiVenue),
14175
+ numericValue: 0,
14176
+ quoteData,
14177
+ value: "",
14178
+ venue: kalshiVenue,
14179
+ isUnavailable: true
14180
+ }
14181
+ ];
14182
+ })() : [];
14183
+ return [...baseCards, ...unavailableCards, ...warningOnlyUnavailableCards];
14074
14184
  };
14075
14185
  var resolveExecutionVenueFromQuote = (quoteData) => {
14076
14186
  if (!(quoteData == null ? void 0 : quoteData.fills.length)) return void 0;
@@ -14232,14 +14342,18 @@ var groupPlaceOrderFailureSteps = (steps) => {
14232
14342
  };
14233
14343
  var buildPlaceOrderExecutionStepGroupsFromFailureSummary = ({
14234
14344
  labels,
14235
- summary
14345
+ summary,
14346
+ // When the partial-fill steps are rendered inside the success view (auto
14347
+ // 95%+ skip or after the user clicks Skip), surface them as completed
14348
+ // checks instead of warnings — the order is being treated as complete.
14349
+ treatPartialAsComplete = false
14236
14350
  }) => {
14237
14351
  var _a;
14238
14352
  const failureStepGroups = groupPlaceOrderFailureSteps(summary.steps).map(
14239
14353
  (group) => group.map((step) => ({
14240
14354
  id: step.id,
14241
14355
  label: step.label,
14242
- tone: step.tone,
14356
+ tone: treatPartialAsComplete && (step.tone === "warning" || step.tone === "error") ? "complete" : step.tone,
14243
14357
  venue: step.venue
14244
14358
  }))
14245
14359
  );
@@ -14700,10 +14814,6 @@ var PlaceOrderFailureView = ({
14700
14814
  ] }),
14701
14815
  summary.eventSubtitle ? /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
14702
14816
  ] }),
14703
- /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "flex min-h-12 w-full items-center justify-center gap-3 rounded-agg-full agg-bg-brand px-8 text-agg-base font-agg-bold leading-agg-6 text-agg-on-primary", children: [
14704
- /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(LoadingIcon, { size: "small", className: "text-agg-on-primary!" }),
14705
- /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { children: summary.actionLabel })
14706
- ] }),
14707
14817
  /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("div", { className: "flex flex-col gap-4", children: failureStepGroups.map((group, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("div", { className: "flex flex-col gap-2", children: group.map((step) => renderPartialFailureStep(step)) }, `failure-group-${groupIndex}`)) }),
14708
14818
  /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("div", { className: "flex items-center gap-4", children: summary.actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
14709
14819
  Button,
@@ -14808,19 +14918,6 @@ var PlaceOrderSuccessView = ({
14808
14918
  ] }),
14809
14919
  summary.eventDateLabel ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventDateLabel }) : null
14810
14920
  ] }) : null,
14811
- /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(
14812
- "div",
14813
- {
14814
- className: cn(
14815
- "agg-order-success-pill flex min-h-12 w-full items-center justify-center gap-2 rounded-agg-full px-6 py-2.5 text-center text-agg-base font-agg-bold leading-agg-6 text-agg-on-primary",
14816
- resolvedActionTone === "positive" ? "bg-agg-success" : "bg-agg-error"
14817
- ),
14818
- children: [
14819
- /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Icon, { name: "success-check", size: "small", className: "h-4 w-4 shrink-0 text-current" }),
14820
- /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("span", { children: resolvedActionLabel })
14821
- ]
14822
- }
14823
- ),
14824
14921
  executionStepGroups.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { className: "agg-order-success-timeline flex flex-col gap-2", children: [
14825
14922
  /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
14826
14923
  "div",
@@ -14910,6 +15007,19 @@ var PlaceOrderSuccessView = ({
14910
15007
  /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("p", { className: "min-w-0 flex-1", children: finalStep.label })
14911
15008
  ] }) : null
14912
15009
  ] }) : null,
15010
+ /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(
15011
+ "div",
15012
+ {
15013
+ className: cn(
15014
+ "agg-order-success-pill flex min-h-12 w-full items-center justify-center gap-2 rounded-agg-full px-6 py-2.5 text-center text-agg-base font-agg-bold leading-agg-6 text-agg-on-primary",
15015
+ resolvedActionTone === "positive" ? "bg-agg-success" : "bg-agg-error"
15016
+ ),
15017
+ children: [
15018
+ /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Icon, { name: "success-check", size: "small", className: "h-4 w-4 shrink-0 text-current" }),
15019
+ /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("span", { children: resolvedActionLabel })
15020
+ ]
15021
+ }
15022
+ ),
14913
15023
  /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { className: "agg-order-success-summary flex items-center justify-between gap-4", children: [
14914
15024
  /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.amount(resolvedTradeSide) }),
14915
15025
  /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("p", { className: "text-right text-[30px] font-agg-bold leading-[36px] text-agg-foreground", children: resolvedAmountLabel })
@@ -15619,7 +15729,7 @@ var InitiateKycButton = ({ label, onOpen }) => /* @__PURE__ */ (0, import_jsx_ru
15619
15729
  size: "large",
15620
15730
  variant: "primary",
15621
15731
  onClick: onOpen,
15622
- className: "agg-order-kyc-action h-12 w-full px-8 text-agg-base leading-agg-6 shadow-none mb-3",
15732
+ className: "agg-order-kyc-action h-12 w-full px-8 text-agg-base leading-agg-6 shadow-none",
15623
15733
  children: label
15624
15734
  }
15625
15735
  );
@@ -15816,6 +15926,14 @@ var PlaceOrder = ({
15816
15926
  const livePrices = (0, import_hooks51.useLiveOutcomePrices)(
15817
15927
  scopedSelectedMarket ? [scopedSelectedMarket] : void 0
15818
15928
  );
15929
+ const midpointsClusterMarkets = (0, import_react27.useMemo)(() => {
15930
+ if (!scopedSelectedMarket) return [];
15931
+ return normalizeVenueMarketCluster(
15932
+ resolvedEventTradingState.displayMarkets,
15933
+ scopedSelectedMarket.id
15934
+ );
15935
+ }, [resolvedEventTradingState.displayMarkets, scopedSelectedMarket]);
15936
+ const { prices: clusterMidpoints } = (0, import_hooks51.useMidpoints)(midpointsClusterMarkets);
15819
15937
  const outcomes = (0, import_react27.useMemo)(
15820
15938
  () => mapVenueMarketOutcomesToPlaceOrderOutcomes(scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes),
15821
15939
  [scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes]
@@ -15823,7 +15941,8 @@ var PlaceOrder = ({
15823
15941
  const buyTabRef = (0, import_react27.useRef)(null);
15824
15942
  const sellTabRef = (0, import_react27.useRef)(null);
15825
15943
  const [internalTab, setInternalTab] = (0, import_react27.useState)("buy");
15826
- const [internalAmount, setInternalAmount] = (0, import_react27.useState)(0);
15944
+ const [internalAmount, setInternalAmount] = (0, import_react27.useState)(PLACE_ORDER_DEFAULT_AMOUNT);
15945
+ const [sellFilledForOutcomeId, setSellFilledForOutcomeId] = (0, import_react27.useState)(null);
15827
15946
  const [internalSlippage, setInternalSlippage] = (0, import_react27.useState)(DEFAULT_SLIPPAGE_VALUE);
15828
15947
  const [isRoutesExpanded, setIsRoutesExpanded] = (0, import_react27.useState)(false);
15829
15948
  const [selectedRouteCardId, setSelectedRouteCardId] = (0, import_react27.useState)(null);
@@ -15893,13 +16012,28 @@ var PlaceOrder = ({
15893
16012
  if (!Number.isFinite(currentSellableShares)) return 0;
15894
16013
  return currentSellableShares;
15895
16014
  }, [currentSellableShares]);
16015
+ (0, import_react27.useEffect)(() => {
16016
+ if (!isSell || isCurrentSellableSharesLoading) return;
16017
+ if (scopedSelectedOutcomeId === sellFilledForOutcomeId) return;
16018
+ setInternalAmount(displayedCurrentSellableShares);
16019
+ setSellFilledForOutcomeId(scopedSelectedOutcomeId != null ? scopedSelectedOutcomeId : null);
16020
+ onAmountChange == null ? void 0 : onAmountChange(displayedCurrentSellableShares);
16021
+ }, [
16022
+ isSell,
16023
+ isCurrentSellableSharesLoading,
16024
+ scopedSelectedOutcomeId,
16025
+ sellFilledForOutcomeId,
16026
+ displayedCurrentSellableShares,
16027
+ onAmountChange
16028
+ ]);
15896
16029
  const routeCards = (0, import_react27.useMemo)(
15897
16030
  () => smartRoute.data ? buildLiveRouteCards({
16031
+ eventVenues: scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets.map((market) => market.venue),
15898
16032
  labels: tradingLabels,
15899
16033
  quoteData: smartRoute.data,
15900
16034
  tradeSide: isSell ? "sell" : "buy"
15901
16035
  }) : [],
15902
- [smartRoute.data, tradingLabels, isSell]
16036
+ [smartRoute.data, tradingLabels, isSell, scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets]
15903
16037
  );
15904
16038
  const resolvedSelectedRouteCardId = (0, import_react27.useMemo)(() => {
15905
16039
  var _a2, _b2, _c2, _d2;
@@ -16013,7 +16147,10 @@ var PlaceOrder = ({
16013
16147
  potentialReturnLabel,
16014
16148
  executionStepGroups: (partialFillSummary == null ? void 0 : partialFillSummary.kind) === "partial_fill" ? buildPlaceOrderExecutionStepGroupsFromFailureSummary({
16015
16149
  labels: tradingLabels,
16016
- summary: partialFillSummary
16150
+ summary: partialFillSummary,
16151
+ // Inside the success view (auto-95% skip or user-clicked
16152
+ // Skip), surface partial-fill steps as completed checks.
16153
+ treatPartialAsComplete: true
16017
16154
  }) : buildPlaceOrderExecutionStepGroups({
16018
16155
  labels: tradingLabels,
16019
16156
  orderId: orderId != null ? orderId : (_h2 = executionProgress.submittedOrders[0]) == null ? void 0 : _h2.orderId,
@@ -16186,13 +16323,24 @@ var PlaceOrder = ({
16186
16323
  }, [smartRoute.error, tradingLabels.quoteUnavailable]);
16187
16324
  const progressActionLabel = (internalTab === "buy" ? tradingLabels.buyingOutcome(selectedOutcomeLabel) : tradingLabels.sellingOutcome(selectedOutcomeLabel)).trim();
16188
16325
  const canRetryRemaining = (0, import_react27.useMemo)(() => {
16189
- if (isSell) return true;
16190
16326
  const remaining = getPlaceOrderUnfilledRemaining({
16191
16327
  originalAmount: internalAmount,
16192
16328
  terminalOrderEvents: executionProgress.terminalOrderEvents
16193
16329
  });
16194
- return remaining >= MIN_BUY_ORDER_AMOUNT;
16330
+ const minRemainder = isSell ? MIN_SELL_ORDER_SHARES : MIN_BUY_ORDER_AMOUNT;
16331
+ return remaining >= minRemainder;
16195
16332
  }, [executionProgress.terminalOrderEvents, internalAmount, isSell]);
16333
+ const PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD = 0.95;
16334
+ const shouldAutoSkipPartialFill = (0, import_react27.useMemo)(() => {
16335
+ if (internalAmount <= 0) return false;
16336
+ const remaining = getPlaceOrderUnfilledRemaining({
16337
+ originalAmount: internalAmount,
16338
+ terminalOrderEvents: executionProgress.terminalOrderEvents
16339
+ });
16340
+ const filled = Math.max(0, internalAmount - remaining);
16341
+ const fillRatio = filled / internalAmount;
16342
+ return fillRatio >= PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD || !canRetryRemaining;
16343
+ }, [canRetryRemaining, executionProgress.terminalOrderEvents, internalAmount]);
16196
16344
  const failureSummary = (0, import_react27.useMemo)(() => {
16197
16345
  var _a2;
16198
16346
  if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return void 0;
@@ -16249,6 +16397,7 @@ var PlaceOrder = ({
16249
16397
  setSubmissionProgressState(null);
16250
16398
  setSubmissionFeedback(null);
16251
16399
  setInternalAmount(0);
16400
+ setSellFilledForOutcomeId(null);
16252
16401
  setInternalSlippage(DEFAULT_SLIPPAGE_VALUE);
16253
16402
  setInternalTab("buy");
16254
16403
  setIsRoutesExpanded(false);
@@ -16312,6 +16461,17 @@ var PlaceOrder = ({
16312
16461
  failureSummary,
16313
16462
  selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData
16314
16463
  ]);
16464
+ (0, import_react27.useEffect)(() => {
16465
+ if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return;
16466
+ if ((failureSummary == null ? void 0 : failureSummary.kind) !== "partial_fill") return;
16467
+ if (!shouldAutoSkipPartialFill) return;
16468
+ handleSkipToSuccess();
16469
+ }, [
16470
+ failureSummary == null ? void 0 : failureSummary.kind,
16471
+ handleSkipToSuccess,
16472
+ shouldAutoSkipPartialFill,
16473
+ submissionProgressState == null ? void 0 : submissionProgressState.phase
16474
+ ]);
16315
16475
  const handleRetrySubmission = (0, import_react27.useCallback)(() => __async(null, null, function* () {
16316
16476
  var _a2, _b2, _c2;
16317
16477
  if (!orderEligibility.canPlaceOrder) {
@@ -16354,6 +16514,7 @@ var PlaceOrder = ({
16354
16514
  throw new Error(tradingLabels.quoteUnavailable);
16355
16515
  }
16356
16516
  const refreshedCards = buildLiveRouteCards({
16517
+ eventVenues: scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets.map((market) => market.venue),
16357
16518
  labels: tradingLabels,
16358
16519
  quoteData: refetchedQuoteData,
16359
16520
  tradeSide: internalTab
@@ -16390,6 +16551,7 @@ var PlaceOrder = ({
16390
16551
  isSell,
16391
16552
  onAmountChange,
16392
16553
  orderEligibility.canPlaceOrder,
16554
+ scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets,
16393
16555
  scopedSelectedOutcomeId,
16394
16556
  selectedRouteCardId,
16395
16557
  smartRoute,
@@ -16448,11 +16610,20 @@ var PlaceOrder = ({
16448
16610
  const handleTabChange = (nextTab) => {
16449
16611
  if (!orderEligibility.canPlaceOrder) return;
16450
16612
  setInternalTab(nextTab);
16613
+ if (nextTab === "sell") {
16614
+ setInternalAmount(0);
16615
+ setSellFilledForOutcomeId(null);
16616
+ onAmountChange == null ? void 0 : onAmountChange(0);
16617
+ } else {
16618
+ setInternalAmount(PLACE_ORDER_DEFAULT_AMOUNT);
16619
+ onAmountChange == null ? void 0 : onAmountChange(PLACE_ORDER_DEFAULT_AMOUNT);
16620
+ }
16451
16621
  onTabChange == null ? void 0 : onTabChange(nextTab);
16452
16622
  };
16453
16623
  const handleOutcomeChange = (nextOutcomeId) => {
16454
16624
  if (isResolvedOutcomeCtaLocked) return;
16455
16625
  if (!orderEligibility.canPlaceOrder) return;
16626
+ if (isSell) setSellFilledForOutcomeId(null);
16456
16627
  onOutcomeChange == null ? void 0 : onOutcomeChange(nextOutcomeId);
16457
16628
  tradingContext == null ? void 0 : tradingContext.selectOutcome(nextOutcomeId);
16458
16629
  };
@@ -16460,6 +16631,7 @@ var PlaceOrder = ({
16460
16631
  if (!orderEligibility.canPlaceOrder) return;
16461
16632
  const resolvedNextValue = nextValue != null ? nextValue : 0;
16462
16633
  setInternalAmount(resolvedNextValue);
16634
+ if (isSell) setSellFilledForOutcomeId(scopedSelectedOutcomeId != null ? scopedSelectedOutcomeId : null);
16463
16635
  onAmountChange == null ? void 0 : onAmountChange(resolvedNextValue);
16464
16636
  };
16465
16637
  const handleFillSellableShares = () => {
@@ -16599,11 +16771,11 @@ var PlaceOrder = ({
16599
16771
  }
16600
16772
  ),
16601
16773
  outcomes.length >= 2 ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { className: "agg-outcomes flex w-full max-w-full gap-2", children: outcomes.map((outcome, index) => {
16602
- var _a2, _b2;
16603
- const price = (_a2 = livePrices.get(outcome.id)) != null ? _a2 : outcome.price;
16774
+ var _a2, _b2, _c2;
16775
+ const price = (_b2 = (_a2 = clusterMidpoints.get(outcome.id)) != null ? _a2 : livePrices.get(outcome.id)) != null ? _b2 : outcome.price;
16604
16776
  const isActive = outcome.id === scopedSelectedOutcomeId;
16605
16777
  const isPositive = resolveIsPositiveOutcome(outcome, index);
16606
- const displayLabel = ((_b2 = outcome.title) == null ? void 0 : _b2.trim()) || outcome.label;
16778
+ const displayLabel = ((_c2 = outcome.title) == null ? void 0 : _c2.trim()) || outcome.label;
16607
16779
  return /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
16608
16780
  "button",
16609
16781
  {
@@ -16710,7 +16882,7 @@ var PlaceOrder = ({
16710
16882
  card,
16711
16883
  enableAnimations,
16712
16884
  isExpanded: card.kind === "split" ? isSplitDetailOpen : isRoutesExpanded,
16713
- isSelected: card.id === resolvedSelectedRouteCardId,
16885
+ isSelected: !card.isUnavailable && card.id === resolvedSelectedRouteCardId,
16714
16886
  onSelect: handleRouteCardSelect,
16715
16887
  tradingLabels
16716
16888
  }) }, card.id);
@@ -16841,7 +17013,7 @@ var PlaceOrder = ({
16841
17013
  {
16842
17014
  size: "large",
16843
17015
  variant: hasEnteredAmount && !shouldShowGeoBlockBanner ? "primary" : "secondary",
16844
- className: "agg-order-submit h-12 w-full px-8 text-agg-base leading-agg-6 shadow-none mb-3",
17016
+ className: "agg-order-submit h-12 w-full px-8 text-agg-base leading-agg-6 shadow-none",
16845
17017
  disabled: isActionDisabled || shouldShowGeoBlockBanner,
16846
17018
  isLoading: isActionLoading,
16847
17019
  "aria-label": actionLabel,
@@ -16851,7 +17023,7 @@ var PlaceOrder = ({
16851
17023
  children: actionLabel
16852
17024
  }
16853
17025
  ),
16854
- shouldShowGeoBlockBanner ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(GeoBlockBanner, { venue: geoBlockVenueLabel }) : null,
17026
+ shouldShowGeoBlockBanner ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(GeoBlockBanner, { venue: geoBlockVenueLabel, termsUrl: AGG_TERMS_OF_SERVICE_URL }) : null,
16855
17027
  !shouldShowGeoBlockBanner ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("p", { className: "agg-order-disclaimer text-center text-agg-xs leading-agg-4 text-agg-muted-foreground", children: tradingLabels.disclaimer }) : null
16856
17028
  ]
16857
17029
  }
@@ -17567,11 +17739,32 @@ var HomeSearchResults = ({
17567
17739
  ]
17568
17740
  }
17569
17741
  ),
17742
+ !isError && openEvents.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", { className: "col-span-full w-full", children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
17743
+ StateMessage,
17744
+ {
17745
+ title: labels.eventList.emptyTitle,
17746
+ description: labels.eventList.emptyDescription,
17747
+ classNames: {
17748
+ title: "!text-agg-base leading-agg-6",
17749
+ description: "!text-agg-sm leading-agg-5"
17750
+ },
17751
+ icon: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { name: "search-empty" })
17752
+ }
17753
+ ) }) : null,
17754
+ isError ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
17755
+ StateMessage,
17756
+ {
17757
+ title: labels.eventList.errorTitle,
17758
+ description: labels.eventList.errorDescription,
17759
+ icon: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { name: "warning" })
17760
+ }
17761
+ ) : null,
17570
17762
  /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(
17571
17763
  "div",
17572
17764
  {
17573
17765
  className: cn(
17574
17766
  "agg-event-list-grid grid grid-cols-[repeat(auto-fill,minmax(240px,1fr))] md:grid-cols-[repeat(auto-fill,minmax(360px,1fr))] gap-4 transition-opacity duration-200",
17767
+ "empty:hidden",
17575
17768
  isPlaceholderData && "opacity-60"
17576
17769
  ),
17577
17770
  children: [
@@ -17606,27 +17799,7 @@ var HomeSearchResults = ({
17606
17799
  }
17607
17800
  },
17608
17801
  `search-results-loading-${index}`
17609
- )) : null,
17610
- !isError && openEvents.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", { className: "col-span-full w-full", children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
17611
- StateMessage,
17612
- {
17613
- title: labels.eventList.emptyTitle,
17614
- description: labels.eventList.emptyDescription,
17615
- classNames: {
17616
- title: "!text-agg-base leading-agg-6",
17617
- description: "!text-agg-sm leading-agg-5"
17618
- },
17619
- icon: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { name: "search-empty" })
17620
- }
17621
- ) }) : null,
17622
- isError ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
17623
- StateMessage,
17624
- {
17625
- title: labels.eventList.errorTitle,
17626
- description: labels.eventList.errorDescription,
17627
- icon: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { name: "warning" })
17628
- }
17629
- ) : null
17802
+ )) : null
17630
17803
  ]
17631
17804
  }
17632
17805
  ),
@@ -18190,13 +18363,13 @@ var AmountTimeStack = ({
18190
18363
  var TradeTypeCell = ({
18191
18364
  activity,
18192
18365
  tone
18193
- }) => /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "hidden w-22 shrink-0 items-center gap-3 sm:flex", children: [
18366
+ }) => /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
18194
18367
  /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(VenueLogo, { venue: activity.venue, size: "small", className: "shrink-0" }),
18195
18368
  /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
18196
18369
  "p",
18197
18370
  {
18198
18371
  className: cn(
18199
- "agg-activity-type w-15 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
18372
+ "agg-activity-type w-20 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
18200
18373
  tone.primary
18201
18374
  ),
18202
18375
  children: activity.type
@@ -18206,7 +18379,7 @@ var TradeTypeCell = ({
18206
18379
  var TransferTypeCell = ({
18207
18380
  activity,
18208
18381
  tone
18209
- }) => /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "hidden w-[88px] shrink-0 items-center gap-3 sm:flex", children: [
18382
+ }) => /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
18210
18383
  /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
18211
18384
  Icon,
18212
18385
  {
@@ -18219,7 +18392,7 @@ var TransferTypeCell = ({
18219
18392
  "p",
18220
18393
  {
18221
18394
  className: cn(
18222
- "agg-activity-type w-15 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
18395
+ "agg-activity-type w-20 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
18223
18396
  tone.primary
18224
18397
  ),
18225
18398
  children: activity.type
@@ -18336,7 +18509,6 @@ var TransferRow = ({
18336
18509
  onClick
18337
18510
  }) => {
18338
18511
  const tone = resolveToneClasses(activity);
18339
- const isDeposit = activity.kind === "deposit";
18340
18512
  const transferIconName = TRANSFER_ICON[activity.kind];
18341
18513
  return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("button", { type: "button", className, onClick, children: /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
18342
18514
  "div",
@@ -18362,7 +18534,7 @@ var TransferRow = ({
18362
18534
  ] }) }),
18363
18535
  /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "flex w-full items-center justify-between sm:contents", children: [
18364
18536
  /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
18365
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "agg-activity-deposit-square hidden h-15 w-15 shrink-0 items-center justify-center rounded-agg-lg bg-agg-secondary-hover sm:flex", children: isDeposit ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(Icon, { name: "badge-check-thin", size: "medium", className: "text-agg-muted-foreground" }) : /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(Icon, { name: transferIconName, size: "medium", className: "text-agg-foreground" }) }),
18537
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "agg-activity-deposit-square hidden h-15 w-15 shrink-0 items-center justify-center rounded-agg-lg bg-agg-secondary-hover sm:flex", children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(Icon, { name: "badge-check-thin", size: "medium", className: "text-agg-muted-foreground" }) }),
18366
18538
  /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-1", children: [
18367
18539
  /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
18368
18540
  "p",
@@ -18371,7 +18543,7 @@ var TransferRow = ({
18371
18543
  "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-bold sm:text-agg-base sm:leading-agg-6",
18372
18544
  tone.primary
18373
18545
  ),
18374
- children: isDeposit ? "Successful deposit" : activity.title
18546
+ children: activity.title
18375
18547
  }
18376
18548
  ),
18377
18549
  /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
@@ -19472,6 +19644,7 @@ var twoDecimalUsdFormatter = new Intl.NumberFormat("en-US", {
19472
19644
  maximumFractionDigits: 2
19473
19645
  });
19474
19646
  var DEFAULT_TOKEN_DECIMALS = 6;
19647
+ var LEGACY_TWELVE_DECIMAL_SCALE = BigInt("1000000000000");
19475
19648
  var TOKEN_DECIMALS_BY_SYMBOL = {
19476
19649
  BNB: 18,
19477
19650
  ETH: 18,
@@ -19540,9 +19713,38 @@ var parseRawTokenValue = (value, decimals) => {
19540
19713
  return parsed / __pow(10, decimals);
19541
19714
  }
19542
19715
  };
19716
+ var shouldUseLegacyEighteenDecimalFallback = ({
19717
+ value,
19718
+ parsed,
19719
+ decimals,
19720
+ tokenSymbol,
19721
+ chainId
19722
+ }) => {
19723
+ if (parsed == null || decimals !== 6 || value.includes(".")) return false;
19724
+ const normalizedSymbol = tokenSymbol.trim().toUpperCase();
19725
+ if (normalizedSymbol !== "USDC" && normalizedSymbol !== "USDT") return false;
19726
+ const normalizedChainId = chainId == null ? void 0 : chainId.trim();
19727
+ if (normalizedChainId === "56") return false;
19728
+ if (!/^\d+$/.test(value)) return false;
19729
+ try {
19730
+ const raw = BigInt(value);
19731
+ if (raw % LEGACY_TWELVE_DECIMAL_SCALE !== BigInt(0)) return false;
19732
+ const parsedAsEighteen = Number(raw / LEGACY_TWELVE_DECIMAL_SCALE) / 1e6;
19733
+ return Number.isFinite(parsedAsEighteen) && parsed > 1e6 && parsedAsEighteen < 1e6;
19734
+ } catch (e) {
19735
+ return false;
19736
+ }
19737
+ };
19543
19738
  var formatTokenAmountTwoDecimals = (value, tokenSymbol, chainId) => {
19544
- const parsed = parseRawTokenValue(value, getTokenDecimals(tokenSymbol, chainId));
19739
+ const decimals = getTokenDecimals(tokenSymbol, chainId);
19740
+ const parsed = parseRawTokenValue(value, decimals);
19545
19741
  if (parsed == null) return "0.00";
19742
+ if (value && shouldUseLegacyEighteenDecimalFallback({ value, parsed, decimals, tokenSymbol, chainId })) {
19743
+ const fallbackParsed = parseRawTokenValue(value, 18);
19744
+ if (fallbackParsed != null) {
19745
+ return twoDecimalNumberFormatter.format(fallbackParsed);
19746
+ }
19747
+ }
19546
19748
  return twoDecimalNumberFormatter.format(parsed);
19547
19749
  };
19548
19750
  var getFilledUsdValue = (filledAmountRaw) => {