@agg-build/ui 2.1.5 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/{chunk-T4YZGAYS.mjs → chunk-4QGZ3FWI.mjs} +1 -1
  2. package/dist/{chunk-XUBIJI4R.mjs → chunk-JGBEQ4IV.mjs} +1079 -872
  3. package/dist/{chunk-BW7S2YR3.mjs → chunk-JOZPXDNZ.mjs} +48 -21
  4. package/dist/{chunk-R2YNZJZ3.mjs → chunk-LPIAEKSZ.mjs} +82 -2
  5. package/dist/{chunk-TBZWRUFB.mjs → chunk-QM3WWPCV.mjs} +201 -87
  6. package/dist/{chunk-VP76G6PN.mjs → chunk-UTXQUOU3.mjs} +177 -27
  7. package/dist/{chunk-XHE2VO3S.mjs → chunk-ZRYHWHTD.mjs} +2 -2
  8. package/dist/events.js +369 -82
  9. package/dist/events.mjs +3 -3
  10. package/dist/index.js +2180 -1621
  11. package/dist/index.mjs +9 -7
  12. package/dist/modals.js +2 -2
  13. package/dist/modals.mjs +3 -3
  14. package/dist/pages.js +1552 -995
  15. package/dist/pages.mjs +6 -6
  16. package/dist/primitives.js +74 -26
  17. package/dist/primitives.mjs +1 -1
  18. package/dist/styles.css +1 -1
  19. package/dist/tailwind.css +1 -1
  20. package/dist/trading.js +131 -20
  21. package/dist/trading.mjs +4 -4
  22. package/dist/types/events/item/event-list-item.types.d.mts +6 -2
  23. package/dist/types/events/item/event-list-item.types.d.ts +6 -2
  24. package/dist/types/events/item/event-list-item.utils.d.mts +3 -2
  25. package/dist/types/events/item/event-list-item.utils.d.ts +3 -2
  26. package/dist/types/events/item-details/event-list-item-details.types.d.mts +0 -6
  27. package/dist/types/events/item-details/event-list-item-details.types.d.ts +0 -6
  28. package/dist/types/events/item-details/event-list-item-details.utils.d.mts +9 -0
  29. package/dist/types/events/item-details/event-list-item-details.utils.d.ts +9 -0
  30. package/dist/types/events/market-details/market-details.types.d.mts +1 -0
  31. package/dist/types/events/market-details/market-details.types.d.ts +1 -0
  32. package/dist/types/events/shared/chart-venue-selection.d.mts +2 -1
  33. package/dist/types/events/shared/chart-venue-selection.d.ts +2 -1
  34. package/dist/types/events/shared/event-trading-state.utils.d.mts +4 -2
  35. package/dist/types/events/shared/event-trading-state.utils.d.ts +4 -2
  36. package/dist/types/pages/event-market/sports-event-market.utils.d.mts +1 -1
  37. package/dist/types/pages/event-market/sports-event-market.utils.d.ts +1 -1
  38. package/dist/types/pages/user-profile/components/claim-activity-breakdown-modal.d.mts +8 -0
  39. package/dist/types/pages/user-profile/components/claim-activity-breakdown-modal.d.ts +8 -0
  40. package/dist/types/pages/user-profile/index.d.mts +1 -1
  41. package/dist/types/pages/user-profile/index.d.ts +1 -1
  42. package/dist/types/pages/user-profile/user-profile.types.d.mts +14 -0
  43. package/dist/types/pages/user-profile/user-profile.types.d.ts +14 -0
  44. package/dist/types/primitives/search/search.types.d.mts +1 -0
  45. package/dist/types/primitives/search/search.types.d.ts +1 -0
  46. package/dist/types/primitives/search/search.utils.d.mts +4 -1
  47. package/dist/types/primitives/search/search.utils.d.ts +4 -1
  48. package/dist/types/shared/utils.d.mts +16 -0
  49. package/dist/types/shared/utils.d.ts +16 -0
  50. package/dist/types/trading/types.d.mts +2 -1
  51. package/dist/types/trading/types.d.ts +2 -1
  52. package/package.json +3 -3
package/dist/pages.mjs CHANGED
@@ -8,17 +8,17 @@ import {
8
8
  UserProfilePage,
9
9
  buildAggTxExplorerHref,
10
10
  useHomePageModals
11
- } from "./chunk-XUBIJI4R.mjs";
12
- import "./chunk-TBZWRUFB.mjs";
11
+ } from "./chunk-JGBEQ4IV.mjs";
12
+ import "./chunk-QM3WWPCV.mjs";
13
13
  import {
14
14
  DEPOSIT_MODAL_OPEN_EVENT,
15
15
  WITHDRAW_MODAL_OPEN_EVENT,
16
16
  requestAggDepositModalOpen,
17
17
  requestAggWithdrawModalOpen
18
- } from "./chunk-BW7S2YR3.mjs";
19
- import "./chunk-R2YNZJZ3.mjs";
20
- import "./chunk-T4YZGAYS.mjs";
21
- import "./chunk-VP76G6PN.mjs";
18
+ } from "./chunk-JOZPXDNZ.mjs";
19
+ import "./chunk-LPIAEKSZ.mjs";
20
+ import "./chunk-4QGZ3FWI.mjs";
21
+ import "./chunk-UTXQUOU3.mjs";
22
22
  export {
23
23
  DEPOSIT_MODAL_OPEN_EVENT,
24
24
  EventMarketPage,
@@ -3993,7 +3993,8 @@ var normalizeSeries = (series) => {
3993
3993
  }).filter((seriesItem) => seriesItem.points.length > 0);
3994
3994
  };
3995
3995
  var formatDefaultChartValue = (value) => {
3996
- return `${Number(value).toFixed(2)}%`;
3996
+ const roundedValue = Number(value.toFixed(1));
3997
+ return `${Number.isInteger(roundedValue) ? String(roundedValue) : roundedValue.toFixed(1)}%`;
3997
3998
  };
3998
3999
  var resolveChartTimeFormatter = (windowSeconds) => {
3999
4000
  return (timestamp) => {
@@ -6414,7 +6415,7 @@ var sizeClasses2 = {
6414
6415
  var lineColorByVenue = {
6415
6416
  light: {
6416
6417
  [import_sdk10.Venue.kalshi]: "#00D295",
6417
- [import_sdk10.Venue.limitless]: "#000000",
6418
+ [import_sdk10.Venue.limitless]: "#C4FF00",
6418
6419
  [import_sdk10.Venue.opinion]: "#000000",
6419
6420
  [import_sdk10.Venue.polymarket]: "#2E5CFF",
6420
6421
  [import_sdk10.Venue.predict]: "#6D57F8",
@@ -6424,7 +6425,7 @@ var lineColorByVenue = {
6424
6425
  },
6425
6426
  dark: {
6426
6427
  [import_sdk10.Venue.kalshi]: "#00D295",
6427
- [import_sdk10.Venue.limitless]: "#FFFFFF",
6428
+ [import_sdk10.Venue.limitless]: "#C4FF00",
6428
6429
  [import_sdk10.Venue.opinion]: "#FFFFFF",
6429
6430
  [import_sdk10.Venue.polymarket]: "#2E5CFF",
6430
6431
  [import_sdk10.Venue.predict]: "#6D57F8",
@@ -6731,7 +6732,11 @@ var formatMarketProbabilityPercent = (value, formatPercent = formatWholePercent)
6731
6732
  }
6732
6733
  return formattedValue;
6733
6734
  };
6734
- var sortOutcomes = (outcomes) => {
6735
+ var resolveOutcomeProbability = (outcome, priceByOutcomeId) => {
6736
+ const resolvedPrice = priceByOutcomeId === void 0 ? outcome.price : priceByOutcomeId.has(outcome.id) ? priceByOutcomeId.get(outcome.id) : void 0;
6737
+ return normalizeProbability(resolvedPrice);
6738
+ };
6739
+ var sortOutcomesWithPrices = (outcomes, priceByOutcomeId) => {
6735
6740
  if (outcomes.length <= 1) return outcomes;
6736
6741
  if (hasBinaryOutcomes(outcomes)) {
6737
6742
  return sortYesFirst(outcomes);
@@ -6747,38 +6752,41 @@ var sortOutcomes = (outcomes) => {
6747
6752
  }
6748
6753
  return [...outcomes].sort((a, b) => {
6749
6754
  var _a, _b;
6750
- const aPrice = (_a = normalizeProbability(a.price)) != null ? _a : 0;
6751
- const bPrice = (_b = normalizeProbability(b.price)) != null ? _b : 0;
6755
+ const aPrice = (_a = resolveOutcomeProbability(a, priceByOutcomeId)) != null ? _a : 0;
6756
+ const bPrice = (_b = resolveOutcomeProbability(b, priceByOutcomeId)) != null ? _b : 0;
6752
6757
  return bPrice - aPrice;
6753
6758
  });
6754
6759
  };
6755
- var compareVisibleOutcomeRows = (left, right) => {
6760
+ var compareVisibleOutcomeRows = (left, right, priceByOutcomeId) => {
6756
6761
  var _a, _b;
6757
6762
  const leftDate = toDate(resolveOutcomeTitle(left.outcome));
6758
6763
  const rightDate = toDate(resolveOutcomeTitle(right.outcome));
6759
6764
  if (leftDate && rightDate) {
6760
6765
  return leftDate.getTime() - rightDate.getTime();
6761
6766
  }
6762
- const leftProbability = (_a = normalizeProbability(left.outcome.price)) != null ? _a : -1;
6763
- const rightProbability = (_b = normalizeProbability(right.outcome.price)) != null ? _b : -1;
6767
+ const leftProbability = (_a = resolveOutcomeProbability(left.outcome, priceByOutcomeId)) != null ? _a : -1;
6768
+ const rightProbability = (_b = resolveOutcomeProbability(right.outcome, priceByOutcomeId)) != null ? _b : -1;
6764
6769
  return rightProbability - leftProbability;
6765
6770
  };
6766
- var shouldReplaceVisibleOutcome = (current, next) => {
6771
+ var shouldReplaceVisibleOutcome = (current, next, priceByOutcomeId) => {
6767
6772
  var _a, _b;
6768
6773
  const currentVolume = typeof current.market.volume === "number" ? current.market.volume : -1;
6769
6774
  const nextVolume = typeof next.market.volume === "number" ? next.market.volume : -1;
6770
6775
  if (currentVolume !== nextVolume) {
6771
6776
  return nextVolume > currentVolume;
6772
6777
  }
6773
- const currentProbability = (_a = normalizeProbability(current.outcome.price)) != null ? _a : -1;
6774
- const nextProbability = (_b = normalizeProbability(next.outcome.price)) != null ? _b : -1;
6778
+ const currentProbability = (_a = resolveOutcomeProbability(current.outcome, priceByOutcomeId)) != null ? _a : -1;
6779
+ const nextProbability = (_b = resolveOutcomeProbability(next.outcome, priceByOutcomeId)) != null ? _b : -1;
6775
6780
  return nextProbability > currentProbability;
6776
6781
  };
6777
- var resolveVisibleOutcomes = (venueMarkets) => {
6782
+ var resolveVisibleOutcomes = (venueMarkets, priceByOutcomeId) => {
6778
6783
  const visibleOutcomesByLabel = /* @__PURE__ */ new Map();
6779
6784
  venueMarkets.forEach((market) => {
6780
6785
  const title2 = market.question;
6781
- const canonicalOutcome = sortOutcomes(market.venueMarketOutcomes)[0];
6786
+ const canonicalOutcome = sortOutcomesWithPrices(
6787
+ market.venueMarketOutcomes,
6788
+ priceByOutcomeId
6789
+ )[0];
6782
6790
  if (!canonicalOutcome) return;
6783
6791
  const normalizedTitle = title2.trim().toLowerCase();
6784
6792
  const nextVisibleOutcome = {
@@ -6788,11 +6796,11 @@ var resolveVisibleOutcomes = (venueMarkets) => {
6788
6796
  title: title2
6789
6797
  };
6790
6798
  const currentVisibleOutcome = visibleOutcomesByLabel.get(normalizedTitle);
6791
- if (!currentVisibleOutcome || shouldReplaceVisibleOutcome(currentVisibleOutcome, nextVisibleOutcome)) {
6799
+ if (!currentVisibleOutcome || shouldReplaceVisibleOutcome(currentVisibleOutcome, nextVisibleOutcome, priceByOutcomeId)) {
6792
6800
  visibleOutcomesByLabel.set(normalizedTitle, nextVisibleOutcome);
6793
6801
  }
6794
6802
  });
6795
- return [...visibleOutcomesByLabel.values()].sort(compareVisibleOutcomeRows).slice(0, Math.max(1, 2));
6803
+ return [...visibleOutcomesByLabel.values()].sort((left, right) => compareVisibleOutcomeRows(left, right, priceByOutcomeId)).slice(0, Math.max(1, 2));
6796
6804
  };
6797
6805
  var resolveOutcomeTitle = (outcome) => {
6798
6806
  var _a, _b;
@@ -6853,18 +6861,19 @@ var toVenueLogoName = (value) => {
6853
6861
  if (!venueLogoNameSet.has(value)) return null;
6854
6862
  return value;
6855
6863
  };
6856
- var mapVenueEventToSearchResult = (event, labels, formatPercent, formatCompactCurrency) => {
6857
- var _a, _b;
6864
+ var mapVenueEventToSearchResult = (event, labels, formatPercent, formatCompactCurrency, options) => {
6865
+ var _a, _b, _c;
6858
6866
  const primaryVenueMarket = selectPrimaryVenueMarket(event.venueMarkets);
6859
6867
  if (!primaryVenueMarket) return null;
6860
6868
  const primaryVenue = toVenueLogoName(primaryVenueMarket.venue);
6861
6869
  if (!primaryVenue) return null;
6862
- const visibleOutcome = resolveVisibleOutcomes(event.venueMarkets)[0];
6870
+ const visibleOutcome = resolveVisibleOutcomes(event.venueMarkets, options == null ? void 0 : options.priceByOutcomeId)[0];
6863
6871
  if (!visibleOutcome) return null;
6864
- const probability = normalizeProbability(visibleOutcome.outcome.price);
6865
- if (probability == null) return null;
6872
+ const probability = normalizeProbability(
6873
+ (_a = options == null ? void 0 : options.priceByOutcomeId) == null ? void 0 : _a.get(visibleOutcome.outcome.id)
6874
+ );
6866
6875
  const resolvedTitle = formatEventTitleWithDateSuffix({
6867
- title: (_a = event == null ? void 0 : event.title) != null ? _a : "",
6876
+ title: (_b = event == null ? void 0 : event.title) != null ? _b : "",
6868
6877
  categories: event.categories,
6869
6878
  structureType: event.structureType,
6870
6879
  gameStartTime: event.gameStartTime,
@@ -6886,13 +6895,14 @@ var mapVenueEventToSearchResult = (event, labels, formatPercent, formatCompactCu
6886
6895
  return {
6887
6896
  id: event.id,
6888
6897
  title: resolvedTitle,
6889
- thumbnailSrc: (_b = resolveTileImage(event, primaryVenueMarket, void 0)) != null ? _b : "",
6898
+ thumbnailSrc: (_c = resolveTileImage(event, primaryVenueMarket, void 0)) != null ? _c : "",
6890
6899
  thumbnailAlt: resolvedTitle,
6891
6900
  venue: primaryVenue,
6892
6901
  visibleVenues,
6893
6902
  marketSummaryLabel,
6894
6903
  volumeLabel,
6895
6904
  valueLabel: formatMarketProbabilityPercent(probability, formatPercent),
6905
+ isValueLoading: probability == null && (options == null ? void 0 : options.isPriceLoading) === true,
6896
6906
  contextLabel: formatSearchContextLabel(visibleOutcome.title)
6897
6907
  };
6898
6908
  };
@@ -7002,7 +7012,16 @@ var SearchResultRow = ({
7002
7012
  children: [
7003
7013
  /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(VenueLogo, { venue: item.venue, size: "small" }),
7004
7014
  /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "flex min-w-0 flex-1 items-baseline gap-2", children: [
7005
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
7015
+ item.isValueLoading ? /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
7016
+ "span",
7017
+ {
7018
+ "aria-hidden": "true",
7019
+ className: cn(
7020
+ "agg-search-result-value-loading",
7021
+ "h-5 w-12 shrink-0 rounded-agg-sm bg-agg-separator animate-pulse"
7022
+ )
7023
+ }
7024
+ ) : /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
7006
7025
  "p",
7007
7026
  {
7008
7027
  className: cn(
@@ -7115,6 +7134,24 @@ var Search = ({
7115
7134
  () => filterOpenEvents(searchResults),
7116
7135
  [searchResults]
7117
7136
  );
7137
+ const visibleVenueMarkets = (0, import_react9.useMemo)(
7138
+ () => openEvents.flatMap((event) => {
7139
+ var _a;
7140
+ return (_a = event.venueMarkets) != null ? _a : [];
7141
+ }),
7142
+ [openEvents]
7143
+ );
7144
+ const livePrices = (0, import_hooks27.useLiveOutcomePrices)(visibleVenueMarkets);
7145
+ const midpointResult = (0, import_hooks27.useMidpoints)(visibleVenueMarkets);
7146
+ const searchDisplayPrices = (0, import_react9.useMemo)(() => {
7147
+ if (!midpointResult.bestMidpointsByOutcomeId.size) return livePrices;
7148
+ if (!livePrices.size) return midpointResult.bestMidpointsByOutcomeId;
7149
+ const merged = new Map(midpointResult.bestMidpointsByOutcomeId);
7150
+ for (const [outcomeId, price] of livePrices) {
7151
+ merged.set(outcomeId, price);
7152
+ }
7153
+ return merged;
7154
+ }, [livePrices, midpointResult.bestMidpointsByOutcomeId]);
7118
7155
  const { validatedResults, eventsByResultId } = (0, import_react9.useMemo)(() => {
7119
7156
  const nextEventsByResultId = /* @__PURE__ */ new Map();
7120
7157
  const nextResults = openEvents.map((event) => {
@@ -7122,7 +7159,11 @@ var Search = ({
7122
7159
  event,
7123
7160
  labels,
7124
7161
  formatPercent,
7125
- formatCompactCurrency
7162
+ formatCompactCurrency,
7163
+ {
7164
+ priceByOutcomeId: searchDisplayPrices,
7165
+ isPriceLoading: midpointResult.isLoading
7166
+ }
7126
7167
  );
7127
7168
  if (!item) return null;
7128
7169
  nextEventsByResultId.set(item.id, event);
@@ -7132,7 +7173,14 @@ var Search = ({
7132
7173
  validatedResults: nextResults,
7133
7174
  eventsByResultId: nextEventsByResultId
7134
7175
  };
7135
- }, [formatCompactCurrency, formatPercent, labels, openEvents]);
7176
+ }, [
7177
+ formatCompactCurrency,
7178
+ formatPercent,
7179
+ labels,
7180
+ midpointResult.isLoading,
7181
+ openEvents,
7182
+ searchDisplayPrices
7183
+ ]);
7136
7184
  const hasSearchValue = trimmedValue.length > 0;
7137
7185
  const shouldRenderDropdown = isFocused && shouldSearchValue && !searchConfig.result && !searchConfig.isShowingAllResults;
7138
7186
  const resolvedIsActive = isFocused;
@@ -99,7 +99,7 @@ import {
99
99
  useOptionalToast,
100
100
  useToast,
101
101
  venueLogoNames
102
- } from "./chunk-VP76G6PN.mjs";
102
+ } from "./chunk-UTXQUOU3.mjs";
103
103
  export {
104
104
  ActivityChartIcon,
105
105
  AggErrorBoundary,