@agg-build/ui 4.10.0 → 4.11.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.
@@ -5623,6 +5623,7 @@ import { getEffectiveDisabledVenues, isVenueInactive } from "@agg-build/sdk";
5623
5623
  import { useCallback as useCallback3, useEffect as useEffect7, useMemo as useMemo9, useRef as useRef7, useState as useState6 } from "react";
5624
5624
 
5625
5625
  // src/events/list/event-list.constants.ts
5626
+ import { sortVenues as sortVenues4 } from "@agg-build/hooks";
5626
5627
  import { MatchStatus, Venue as Venue2 } from "@agg-build/sdk";
5627
5628
  var DEFAULT_EVENTS_LIMIT = 50;
5628
5629
  var DEFAULT_EVENT_LIST_SORT = "volume24hr";
@@ -5633,7 +5634,7 @@ var EVENT_LIST_SORT_VALUES = [
5633
5634
  "endDate"
5634
5635
  ];
5635
5636
  var getDefaultEventListTabs = (labels) => {
5636
- return [
5637
+ const tabs = [
5637
5638
  {
5638
5639
  value: "matched",
5639
5640
  label: labels.eventList.matchedTab,
@@ -5709,6 +5710,17 @@ var getDefaultEventListTabs = (labels) => {
5709
5710
  isComingSoon: true
5710
5711
  }
5711
5712
  ];
5713
+ const venueRank = new Map(
5714
+ sortVenues4(tabs.flatMap((tab) => tab.venueLogo ? [tab.venueLogo] : [])).map((venue, i) => [
5715
+ venue,
5716
+ i
5717
+ ])
5718
+ );
5719
+ const rank = (tab) => {
5720
+ var _a;
5721
+ return tab.venueLogo ? 1 + ((_a = venueRank.get(tab.venueLogo)) != null ? _a : venueRank.size) : 0;
5722
+ };
5723
+ return [...tabs].sort((a, b) => rank(a) - rank(b));
5712
5724
  };
5713
5725
 
5714
5726
  // src/events/list/event-list-tabs.tsx
@@ -12,7 +12,7 @@ import {
12
12
  isErrorWithStatus,
13
13
  useEventListTabs,
14
14
  useEventListTabsHeaderOverflow
15
- } from "./chunk-H5LCCV2J.mjs";
15
+ } from "./chunk-EYJS45RP.mjs";
16
16
  import {
17
17
  DEPOSIT_MODAL_OPEN_EVENT,
18
18
  PlaceOrder,
@@ -21,7 +21,7 @@ import {
21
21
  formatChainIdLabel,
22
22
  useClaimWinnings,
23
23
  useResolvedMarketClaim
24
- } from "./chunk-4HTE5IEZ.mjs";
24
+ } from "./chunk-WWIVSROM.mjs";
25
25
  import {
26
26
  getDisplayOutcomePrice,
27
27
  resolveHeaderOutcomeItems,
@@ -1311,8 +1311,14 @@ var extractGeoBlockedVenues = (warnings) => {
1311
1311
  );
1312
1312
  };
1313
1313
  var getSmartRouteTotalFees = (feeBreakdown) => {
1314
+ var _a, _b;
1314
1315
  if (!feeBreakdown) return null;
1315
- const feeParts = [feeBreakdown.venueFees, feeBreakdown.bridgeFees, feeBreakdown.executionGas];
1316
+ const feeParts = [
1317
+ feeBreakdown.venueFees + ((_a = feeBreakdown.builderFee) != null ? _a : 0),
1318
+ feeBreakdown.bridgeFees,
1319
+ feeBreakdown.executionGas,
1320
+ (_b = feeBreakdown.appFee) != null ? _b : 0
1321
+ ];
1316
1322
  if (!feeParts.every(Number.isFinite)) return null;
1317
1323
  return feeParts.reduce((total, fee) => total + Math.round(fee * 100) / 100, 0);
1318
1324
  };
@@ -4285,7 +4291,7 @@ var PlaceOrder = ({
4285
4291
  showResolvingState = false,
4286
4292
  midpointsResult
4287
4293
  }) => {
4288
- 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, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca;
4294
+ 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, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da;
4289
4295
  const {
4290
4296
  enableDebug: isExecutionDebugEnabled,
4291
4297
  features: { enableAnimations, showFeesBreakdown, showLimitOrders: limitOrdersFeature },
@@ -5706,13 +5712,17 @@ var PlaceOrder = ({
5706
5712
  if (totalFees == null) return null;
5707
5713
  return formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
5708
5714
  }, [activeFeeBreakdown]);
5715
+ const appFeeValue = (__ = activeFeeBreakdown == null ? void 0 : activeFeeBreakdown.appFee) != null ? __ : 0;
5709
5716
  const feeBreakdownRows = useMemo(() => {
5717
+ var _a2;
5710
5718
  if (!activeFeeBreakdown) return [];
5711
5719
  return [
5712
5720
  {
5721
+ // The builder slice (Hyperliquid only today) is a separate field on the
5722
+ // wire but reads as one cost to the user, so it renders inside "Venue".
5713
5723
  kind: "amount",
5714
5724
  label: tradingLabels.feeBreakdownVenueFees,
5715
- value: formatUsd(activeFeeBreakdown.venueFees, {
5725
+ value: formatUsd(activeFeeBreakdown.venueFees + ((_a2 = activeFeeBreakdown.builderFee) != null ? _a2 : 0), {
5716
5726
  minimumFractionDigits: 2,
5717
5727
  maximumFractionDigits: 2
5718
5728
  })
@@ -5733,23 +5743,33 @@ var PlaceOrder = ({
5733
5743
  maximumFractionDigits: 2
5734
5744
  })
5735
5745
  },
5736
- {
5746
+ // A partner charging a non-zero app fee gets a plain dollar row like every
5747
+ // other cost above it — the "0% fee" badge is only true, and only worth
5748
+ // highlighting, when the fee really is zero.
5749
+ appFeeValue > 0 ? {
5750
+ kind: "amount",
5751
+ label: tradingLabels.feeBreakdownAggMarket,
5752
+ value: formatUsd(appFeeValue, {
5753
+ minimumFractionDigits: 2,
5754
+ maximumFractionDigits: 2
5755
+ })
5756
+ } : {
5737
5757
  kind: "badge",
5738
5758
  label: tradingLabels.feeBreakdownAggMarket,
5739
5759
  badgeLabel: tradingLabels.feeBreakdownPlatformFeeBadge
5740
5760
  }
5741
5761
  ];
5742
- }, [activeFeeBreakdown, tradingLabels]);
5762
+ }, [activeFeeBreakdown, appFeeValue, tradingLabels]);
5743
5763
  const isActionLoading = isPrimaryActionLoading || executeManaged.isPending || placeLimitOrder.isPending || isBeforeActionPending;
5744
5764
  const selectedLimitRouteCardId = selectedLimitVenueOption ? `limit-venue-${selectedLimitVenueOption.venue}-${selectedLimitVenueOption.venueMarketOutcomeId}` : null;
5745
- const selectedLimitRouteCard = selectedLimitRouteCardId ? (__ = limitRouteCards.find((card) => card.id === selectedLimitRouteCardId)) != null ? __ : null : null;
5746
- const selectedRouteGeoBlocked = isLimitOrder ? (_$ = selectedLimitRouteCard == null ? void 0 : selectedLimitRouteCard.isUnavailable) != null ? _$ : false : (_aa = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _aa : false;
5765
+ const selectedLimitRouteCard = selectedLimitRouteCardId ? (_$ = limitRouteCards.find((card) => card.id === selectedLimitRouteCardId)) != null ? _$ : null : null;
5766
+ const selectedRouteGeoBlocked = isLimitOrder ? (_aa = selectedLimitRouteCard == null ? void 0 : selectedLimitRouteCard.isUnavailable) != null ? _aa : false : (_ba = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _ba : false;
5747
5767
  const geoBlockedVenuesFromWarnings = useMemo(
5748
5768
  () => {
5749
5769
  var _a2;
5750
5770
  return extractGeoBlockedVenues((_a2 = smartRoute.data) == null ? void 0 : _a2.warnings);
5751
5771
  },
5752
- [(_ba = smartRoute.data) == null ? void 0 : _ba.warnings]
5772
+ [(_ca = smartRoute.data) == null ? void 0 : _ca.warnings]
5753
5773
  );
5754
5774
  const isPrimaryVenueGeoBlocked = useMemo(() => {
5755
5775
  var _a2, _b2;
@@ -6434,7 +6454,7 @@ var PlaceOrder = ({
6434
6454
  PlaceOrderResolvedView,
6435
6455
  {
6436
6456
  tradingState: resolvedReadOnlyTradingState,
6437
- resolutionTimestamp: (_ca = resolvedEventTradingState.resolvesAt) != null ? _ca : resolvedReadOnlyTradingState.resolvesAt,
6457
+ resolutionTimestamp: (_da = resolvedEventTradingState.resolvesAt) != null ? _da : resolvedReadOnlyTradingState.resolvesAt,
6438
6458
  resolvedClaim,
6439
6459
  classNames,
6440
6460
  className,
@@ -7195,7 +7215,7 @@ var PlaceOrder = ({
7195
7215
  message: internalTab === "buy" ? tradingLabels.lowLiquidityWarning : tradingLabels.lowLiquiditySellWarning
7196
7216
  }
7197
7217
  ) : null,
7198
- !shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown ? /* @__PURE__ */ jsxs6("div", { className: "agg-order-platform-fee mt-1 flex items-center justify-center gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
7218
+ !shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown && appFeeValue === 0 ? /* @__PURE__ */ jsxs6("div", { className: "agg-order-platform-fee mt-1 flex items-center justify-center gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
7199
7219
  /* @__PURE__ */ jsx7(
7200
7220
  Icon,
7201
7221
  {
package/dist/events.js CHANGED
@@ -14927,7 +14927,7 @@ var MarketDetailsList = ({
14927
14927
  MarketDetailsList.displayName = "MarketDetailsList";
14928
14928
 
14929
14929
  // src/events/list/index.tsx
14930
- var import_hooks51 = require("@agg-build/hooks");
14930
+ var import_hooks52 = require("@agg-build/hooks");
14931
14931
  var import_sdk17 = require("@agg-build/sdk");
14932
14932
  var Dialog2 = __toESM(require("@radix-ui/react-dialog"));
14933
14933
  var import_react25 = require("react");
@@ -15050,16 +15050,17 @@ var CategorySidebar = ({
15050
15050
  CategorySidebar.displayName = "CategorySidebar";
15051
15051
 
15052
15052
  // src/events/list/event-list-tabs.tsx
15053
- var import_hooks50 = require("@agg-build/hooks");
15053
+ var import_hooks51 = require("@agg-build/hooks");
15054
15054
  var import_sdk16 = require("@agg-build/sdk");
15055
15055
  var import_react24 = require("react");
15056
15056
 
15057
15057
  // src/events/list/event-list.constants.ts
15058
+ var import_hooks50 = require("@agg-build/hooks");
15058
15059
  var import_sdk15 = require("@agg-build/sdk");
15059
15060
  var DEFAULT_EVENTS_LIMIT = 50;
15060
15061
  var DEFAULT_EVENT_LIST_SORT = "volume24hr";
15061
15062
  var getDefaultEventListTabs = (labels) => {
15062
- return [
15063
+ const tabs = [
15063
15064
  {
15064
15065
  value: "matched",
15065
15066
  label: labels.eventList.matchedTab,
@@ -15135,6 +15136,17 @@ var getDefaultEventListTabs = (labels) => {
15135
15136
  isComingSoon: true
15136
15137
  }
15137
15138
  ];
15139
+ const venueRank = new Map(
15140
+ (0, import_hooks50.sortVenues)(tabs.flatMap((tab) => tab.venueLogo ? [tab.venueLogo] : [])).map((venue, i) => [
15141
+ venue,
15142
+ i
15143
+ ])
15144
+ );
15145
+ const rank = (tab) => {
15146
+ var _a;
15147
+ return tab.venueLogo ? 1 + ((_a = venueRank.get(tab.venueLogo)) != null ? _a : venueRank.size) : 0;
15148
+ };
15149
+ return [...tabs].sort((a, b) => rank(a) - rank(b));
15138
15150
  };
15139
15151
 
15140
15152
  // src/events/list/event-list-tabs.tsx
@@ -15158,14 +15170,14 @@ var renderTabIcon = (tab, isActive) => {
15158
15170
  );
15159
15171
  };
15160
15172
  var useEventListTabs = (tabs) => {
15161
- const labels = (0, import_hooks50.useLabels)();
15162
- const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks50.useAppConfig)();
15163
- const { isLocationBlocked } = (0, import_hooks50.useGeoBlock)();
15173
+ const labels = (0, import_hooks51.useLabels)();
15174
+ const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks51.useAppConfig)();
15175
+ const { isLocationBlocked } = (0, import_hooks51.useGeoBlock)();
15164
15176
  return (0, import_react24.useMemo)(() => {
15165
15177
  const baseTabs = tabs != null ? tabs : getDefaultEventListTabs(labels);
15166
15178
  return baseTabs.flatMap((tab) => {
15167
15179
  if (!tab.venueLogo) return [tab];
15168
- const availabilityState = (0, import_hooks50.getVenueAvailabilityState)({
15180
+ const availabilityState = (0, import_hooks51.getVenueAvailabilityState)({
15169
15181
  venueId: tab.venueLogo,
15170
15182
  disabledVenues,
15171
15183
  // A globally inactive or default-disabled venue is hidden until
@@ -15289,15 +15301,15 @@ var EventList = ({
15289
15301
  stateRef
15290
15302
  }) => {
15291
15303
  var _a, _b, _c, _d, _e, _f;
15292
- const labels = (0, import_hooks51.useLabels)();
15293
- const { disabledVenues } = (0, import_hooks51.useAppConfig)();
15304
+ const labels = (0, import_hooks52.useLabels)();
15305
+ const { disabledVenues } = (0, import_hooks52.useAppConfig)();
15294
15306
  const {
15295
15307
  features: { enableVenueEventDiscoveryFilters, showSportsMarkets }
15296
- } = (0, import_hooks51.useSdkUiConfig)();
15308
+ } = (0, import_hooks52.useSdkUiConfig)();
15297
15309
  const isDiscoveryFiltersEnabled = enableVenueEventDiscoveryFilters && !search;
15298
15310
  const resolvedTabs = useEventListTabs();
15299
15311
  const visibleVenues = (0, import_react25.useMemo)(
15300
- () => disabledVenues.length === 0 ? void 0 : (0, import_hooks51.getVisibleVenueIdsByConfig)(import_sdk17.VENUES, disabledVenues),
15312
+ () => disabledVenues.length === 0 ? void 0 : (0, import_hooks52.getVisibleVenueIdsByConfig)(import_sdk17.VENUES, disabledVenues),
15301
15313
  [disabledVenues]
15302
15314
  );
15303
15315
  const [internalActiveTabValue, setInternalActiveTabValue] = (0, import_react25.useState)(
@@ -15366,7 +15378,7 @@ var EventList = ({
15366
15378
  if (controlledCategoryPath == null) setInternalCategoryPath([]);
15367
15379
  setCollapsedCategoryIds(/* @__PURE__ */ new Set());
15368
15380
  }, [baseCategoryId, controlledCategoryPath, isDiscoveryFiltersEnabled]);
15369
- const { categories: topLevelCategories } = (0, import_hooks51.useCategories)({
15381
+ const { categories: topLevelCategories } = (0, import_hooks52.useCategories)({
15370
15382
  queryKeyScope: "event-list-top-categories",
15371
15383
  enabled: isDiscoveryFiltersEnabled,
15372
15384
  limit: 100
@@ -15383,7 +15395,7 @@ var EventList = ({
15383
15395
  ])
15384
15396
  );
15385
15397
  }, [baseCategoryId, categoryPath, sortedTopLevelCategories]);
15386
- const { childrenByParentId: baseChildrenByParentId, isLoading: isBaseCategoryChildrenLoading } = (0, import_hooks51.useCategoryChildren)({
15398
+ const { childrenByParentId: baseChildrenByParentId, isLoading: isBaseCategoryChildrenLoading } = (0, import_hooks52.useCategoryChildren)({
15387
15399
  queryKeyScope: "event-list-category-children",
15388
15400
  enabled: isDiscoveryFiltersEnabled,
15389
15401
  parentIds: baseCategoryChildPrefetchIds,
@@ -15404,7 +15416,7 @@ var EventList = ({
15404
15416
  }
15405
15417
  return Array.from(ids);
15406
15418
  }, [baseCategoryId, baseChildrenByParentId, categoryPath]);
15407
- const { childrenByParentId: visibleChildrenByParentId } = (0, import_hooks51.useCategoryChildren)({
15419
+ const { childrenByParentId: visibleChildrenByParentId } = (0, import_hooks52.useCategoryChildren)({
15408
15420
  queryKeyScope: "event-list-category-children",
15409
15421
  enabled: isDiscoveryFiltersEnabled,
15410
15422
  parentIds: visibleChildPrefetchIds,
@@ -15420,7 +15432,7 @@ var EventList = ({
15420
15432
  }
15421
15433
  return Array.from(ids);
15422
15434
  }, [categoryPath, visibleChildrenByParentId]);
15423
- const { childrenByParentId: visibleGrandchildrenByParentId } = (0, import_hooks51.useCategoryChildren)({
15435
+ const { childrenByParentId: visibleGrandchildrenByParentId } = (0, import_hooks52.useCategoryChildren)({
15424
15436
  queryKeyScope: "event-list-category-children",
15425
15437
  enabled: isDiscoveryFiltersEnabled,
15426
15438
  parentIds: visibleGrandchildPrefetchIds,
@@ -15505,14 +15517,14 @@ var EventList = ({
15505
15517
  isFetchingNextPage,
15506
15518
  isPlaceholderData,
15507
15519
  loadedPageCount
15508
- } = (0, import_hooks51.useVenueEvents)({
15520
+ } = (0, import_hooks52.useVenueEvents)({
15509
15521
  queryKeyScope: "event-list",
15510
15522
  venues,
15511
15523
  search,
15512
15524
  categoryIds: resolvedCategoryIds,
15513
15525
  matchStatus,
15514
15526
  limit: requestLimit,
15515
- status: [import_hooks51.MarketStatus.open],
15527
+ status: [import_hooks52.MarketStatus.open],
15516
15528
  sortBy: sortQueryParams.sortBy,
15517
15529
  sortDir: sortQueryParams.sortDir,
15518
15530
  endDateFrom,
@@ -15548,7 +15560,7 @@ var EventList = ({
15548
15560
  const visibleMidpointVenueMarketIds = (0, import_react25.useMemo)(() => {
15549
15561
  return collectMidpointVenueMarketIds(visibleVenueMarkets);
15550
15562
  }, [visibleVenueMarkets]);
15551
- const { midpointRows: sharedMidpointRows, isLoading: isSharedMidpointsLoading } = (0, import_hooks51.useVenueMarketMidpoints)({
15563
+ const { midpointRows: sharedMidpointRows, isLoading: isSharedMidpointsLoading } = (0, import_hooks52.useVenueMarketMidpoints)({
15552
15564
  venueMarketIds: visibleMidpointVenueMarketIds,
15553
15565
  enabled: visibleMidpointVenueMarketIds.length > 0
15554
15566
  });
@@ -15729,7 +15741,7 @@ var EventList = ({
15729
15741
  onMarketClick,
15730
15742
  getMarketHref,
15731
15743
  href: getEventHref == null ? void 0 : getEventHref(event),
15732
- marketStatus: import_hooks51.MarketStatus.open
15744
+ marketStatus: import_hooks52.MarketStatus.open
15733
15745
  },
15734
15746
  event.id
15735
15747
  )),
package/dist/events.mjs CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  orderbookRowLimitDefault,
18
18
  resolveEventDetailsSyncKey,
19
19
  useCenterOrderbookSpread
20
- } from "./chunk-H5LCCV2J.mjs";
20
+ } from "./chunk-EYJS45RP.mjs";
21
21
  import {
22
22
  formatProbabilityCents,
23
23
  resolveOrderBookRows,