@agg-build/ui 2.1.1 → 2.1.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 (40) hide show
  1. package/dist/{chunk-TERG43WW.mjs → chunk-5RBHMMY3.mjs} +1 -1
  2. package/dist/{chunk-RPXRTXCY.mjs → chunk-75AMJAWR.mjs} +1 -1
  3. package/dist/{chunk-IQT4I5B4.mjs → chunk-7ZR5JYB3.mjs} +39 -241
  4. package/dist/{chunk-NK57KMYN.mjs → chunk-JJDYOBVG.mjs} +117 -48
  5. package/dist/{chunk-WU2C3C6K.mjs → chunk-NRNBJPYK.mjs} +1 -1
  6. package/dist/{chunk-YJO6LMRT.mjs → chunk-TBD3N4T4.mjs} +69 -7
  7. package/dist/{chunk-XHDGSRG7.mjs → chunk-ZOECARZW.mjs} +359 -14
  8. package/dist/events.js +175 -59
  9. package/dist/events.mjs +3 -3
  10. package/dist/index.js +1080 -820
  11. package/dist/index.mjs +12 -8
  12. package/dist/modals.js +1 -1
  13. package/dist/modals.mjs +3 -3
  14. package/dist/pages.js +845 -589
  15. package/dist/pages.mjs +6 -6
  16. package/dist/primitives.js +68 -7
  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 +679 -339
  21. package/dist/trading.mjs +10 -6
  22. package/dist/types/events/shared/format-event-title.d.mts +25 -0
  23. package/dist/types/events/shared/format-event-title.d.ts +25 -0
  24. package/dist/types/events/shared/select-best-outcome.d.mts +88 -0
  25. package/dist/types/events/shared/select-best-outcome.d.ts +88 -0
  26. package/dist/types/pages/event-market/event-market.types.d.mts +7 -0
  27. package/dist/types/pages/event-market/event-market.types.d.ts +7 -0
  28. package/dist/types/primitives/search/search.utils.d.mts +3 -1
  29. package/dist/types/primitives/search/search.utils.d.ts +3 -1
  30. package/dist/types/trading/index.d.mts +2 -0
  31. package/dist/types/trading/index.d.ts +2 -0
  32. package/dist/types/trading/place-order/index.d.mts +1 -1
  33. package/dist/types/trading/place-order/index.d.ts +1 -1
  34. package/dist/types/trading/place-order/index.place-order.types.d.mts +23 -1
  35. package/dist/types/trading/place-order/index.place-order.types.d.ts +23 -1
  36. package/dist/types/trading/use-claim-winnings.d.mts +84 -0
  37. package/dist/types/trading/use-claim-winnings.d.ts +84 -0
  38. package/dist/types/trading/use-resolved-market-claim.d.mts +26 -0
  39. package/dist/types/trading/use-resolved-market-claim.d.ts +26 -0
  40. 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-IQT4I5B4.mjs";
12
- import "./chunk-NK57KMYN.mjs";
11
+ } from "./chunk-7ZR5JYB3.mjs";
12
+ import "./chunk-JJDYOBVG.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-XHDGSRG7.mjs";
19
- import "./chunk-TERG43WW.mjs";
20
- import "./chunk-RPXRTXCY.mjs";
21
- import "./chunk-YJO6LMRT.mjs";
18
+ } from "./chunk-ZOECARZW.mjs";
19
+ import "./chunk-5RBHMMY3.mjs";
20
+ import "./chunk-75AMJAWR.mjs";
21
+ import "./chunk-TBD3N4T4.mjs";
22
22
  export {
23
23
  DEPOSIT_MODAL_OPEN_EVENT,
24
24
  EventMarketPage,
@@ -6517,7 +6517,57 @@ var SEARCH_DEBOUNCE_MS = 300;
6517
6517
 
6518
6518
  // src/primitives/search/search.utils.ts
6519
6519
  var import_sdk11 = require("@agg-build/sdk");
6520
+ var import_dayjs3 = __toESM(require("dayjs"));
6521
+
6522
+ // src/events/shared/format-event-title.ts
6520
6523
  var import_dayjs2 = __toESM(require("dayjs"));
6524
+ var SPORT_CATEGORY_TOKENS = /* @__PURE__ */ new Set(["sport", "sports"]);
6525
+ var normalizeCategoryToken = (value) => {
6526
+ if (typeof value !== "string") return null;
6527
+ const normalizedValue = value.trim().toLowerCase();
6528
+ if (!normalizedValue) return null;
6529
+ return normalizedValue;
6530
+ };
6531
+ var isSportCategoryToken = (value) => {
6532
+ const normalizedValue = normalizeCategoryToken(value);
6533
+ if (!normalizedValue) return false;
6534
+ return SPORT_CATEGORY_TOKENS.has(normalizedValue);
6535
+ };
6536
+ var isSportEvent = (categories, structureType) => {
6537
+ var _a;
6538
+ if (isSportCategoryToken(structureType)) return true;
6539
+ return (_a = categories == null ? void 0 : categories.some((categoryEntry) => {
6540
+ var _a2, _b, _c, _d;
6541
+ return isSportCategoryToken(categoryEntry.id) || isSportCategoryToken((_a2 = categoryEntry.category) == null ? void 0 : _a2.id) || isSportCategoryToken((_b = categoryEntry.category) == null ? void 0 : _b.name) || isSportCategoryToken((_c = categoryEntry.category) == null ? void 0 : _c.displayName) || isSportCategoryToken((_d = categoryEntry.category) == null ? void 0 : _d.parentId);
6542
+ })) != null ? _a : false;
6543
+ };
6544
+ var formatEventDateSuffix = (value, locale) => {
6545
+ if (!(0, import_dayjs2.default)(value).isValid()) return null;
6546
+ return new Intl.DateTimeFormat(locale, {
6547
+ month: "long",
6548
+ day: "numeric",
6549
+ timeZone: "UTC"
6550
+ }).format(new Date(value));
6551
+ };
6552
+ var formatEventTitleWithDateSuffix = ({
6553
+ title: title2,
6554
+ categories,
6555
+ structureType,
6556
+ gameStartTime,
6557
+ endDate,
6558
+ locale = "en-US"
6559
+ }) => {
6560
+ const resolvedTitle = title2.trim();
6561
+ if (!resolvedTitle) return resolvedTitle;
6562
+ if (!isSportEvent(categories, structureType)) return resolvedTitle;
6563
+ const dateSource = gameStartTime != null ? gameStartTime : endDate;
6564
+ if (!dateSource) return resolvedTitle;
6565
+ const formattedDate = formatEventDateSuffix(dateSource, locale);
6566
+ if (!formattedDate) return resolvedTitle;
6567
+ const suffix = ` - ${formattedDate}`;
6568
+ if (resolvedTitle.endsWith(suffix)) return resolvedTitle;
6569
+ return `${resolvedTitle}${suffix}`;
6570
+ };
6521
6571
 
6522
6572
  // src/events/item/event-list-item.utils.ts
6523
6573
  var import_hooks26 = require("@agg-build/hooks");
@@ -6797,8 +6847,8 @@ var resolveDisplayVolume = (eventVolume, venueMarkets) => {
6797
6847
 
6798
6848
  // src/primitives/search/search.utils.ts
6799
6849
  var formatSearchContextLabel = (value) => {
6800
- if (!(0, import_dayjs2.default)(value).isValid()) return value;
6801
- return (0, import_dayjs2.default)(value).format("MMMM D, YYYY");
6850
+ if (!(0, import_dayjs3.default)(value).isValid()) return value;
6851
+ return (0, import_dayjs3.default)(value).format("MMMM D, YYYY");
6802
6852
  };
6803
6853
  var venueLogoNameSet = new Set(import_sdk11.VENUES);
6804
6854
  var toVenueLogoName = (value) => {
@@ -6806,7 +6856,7 @@ var toVenueLogoName = (value) => {
6806
6856
  if (!venueLogoNameSet.has(value)) return null;
6807
6857
  return value;
6808
6858
  };
6809
- var mapVenueEventToSearchResult = (event, labels, formatPercent, formatCompactCurrency) => {
6859
+ var mapVenueEventToSearchResult = (event, labels, formatPercent, formatCompactCurrency, options) => {
6810
6860
  var _a, _b;
6811
6861
  const primaryVenueMarket = selectPrimaryVenueMarket(event.venueMarkets);
6812
6862
  if (!primaryVenueMarket) return null;
@@ -6816,7 +6866,14 @@ var mapVenueEventToSearchResult = (event, labels, formatPercent, formatCompactCu
6816
6866
  if (!visibleOutcome) return null;
6817
6867
  const probability = normalizeProbability(visibleOutcome.outcome.price);
6818
6868
  if (probability == null) return null;
6819
- const resolvedTitle = (_a = event == null ? void 0 : event.title) == null ? void 0 : _a.trim();
6869
+ const resolvedTitle = formatEventTitleWithDateSuffix({
6870
+ title: (_a = event == null ? void 0 : event.title) != null ? _a : "",
6871
+ categories: event.categories,
6872
+ structureType: event.structureType,
6873
+ gameStartTime: event.gameStartTime,
6874
+ endDate: event.endDate,
6875
+ locale: options == null ? void 0 : options.locale
6876
+ });
6820
6877
  if (!resolvedTitle) return null;
6821
6878
  const { marketCount, venueCount } = getVenueSummary(event.venueMarkets);
6822
6879
  const marketSummaryLabel = [
@@ -7029,6 +7086,7 @@ var Search = ({
7029
7086
  const {
7030
7087
  search: searchConfig,
7031
7088
  features: { enableAnimations },
7089
+ general: { locale },
7032
7090
  formatting: { formatCompactCurrency, formatPercent }
7033
7091
  } = (0, import_hooks27.useSdkUiConfig)();
7034
7092
  const resolvedValue = searchConfig.value;
@@ -7069,7 +7127,10 @@ var Search = ({
7069
7127
  event,
7070
7128
  labels,
7071
7129
  formatPercent,
7072
- formatCompactCurrency
7130
+ formatCompactCurrency,
7131
+ {
7132
+ locale
7133
+ }
7073
7134
  );
7074
7135
  if (!item) return null;
7075
7136
  nextEventsByResultId.set(item.id, event);
@@ -7079,7 +7140,7 @@ var Search = ({
7079
7140
  validatedResults: nextResults,
7080
7141
  eventsByResultId: nextEventsByResultId
7081
7142
  };
7082
- }, [openEvents, formatCompactCurrency, formatPercent, labels]);
7143
+ }, [formatCompactCurrency, formatPercent, labels, locale, openEvents]);
7083
7144
  const hasSearchValue = trimmedValue.length > 0;
7084
7145
  const shouldRenderDropdown = isFocused && shouldSearchValue && !searchConfig.result && !searchConfig.isShowingAllResults;
7085
7146
  const resolvedIsActive = isFocused;
@@ -8175,7 +8236,7 @@ var Select = ({
8175
8236
  disabled: item.disabled,
8176
8237
  className: cn(
8177
8238
  "agg-select-item",
8178
- "relative flex w-full items-center gap-3 rounded-[6px] px-5 py-3 text-left text-agg-sm leading-agg-5 outline-none",
8239
+ "relative flex w-full items-center gap-3 rounded-[6px] pl-3 pr-5 py-3 text-left text-agg-sm leading-agg-5 outline-none",
8179
8240
  "hover:bg-agg-secondary-hover focus-visible:bg-agg-secondary-hover",
8180
8241
  isSelected ? "bg-agg-primary/10 font-agg-normal text-agg-primary" : "font-agg-normal text-agg-foreground",
8181
8242
  item.disabled && "cursor-not-allowed opacity-60",
@@ -99,7 +99,7 @@ import {
99
99
  useOptionalToast,
100
100
  useToast,
101
101
  venueLogoNames
102
- } from "./chunk-YJO6LMRT.mjs";
102
+ } from "./chunk-TBD3N4T4.mjs";
103
103
  export {
104
104
  ActivityChartIcon,
105
105
  AggErrorBoundary,