@agg-build/hooks 1.2.12 → 1.3.0

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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __async,
3
3
  useAggClient
4
- } from "./chunk-2C7JR5OH.mjs";
4
+ } from "./chunk-VLYLQSDD.mjs";
5
5
 
6
6
  // src/use-ramp-quotes.ts
7
7
  import { useMutation } from "@tanstack/react-query";
@@ -10,7 +10,7 @@ import {
10
10
  useOnWithdrawalLifecycle,
11
11
  useSyncBalances,
12
12
  useWithdrawManaged
13
- } from "./chunk-2C7JR5OH.mjs";
13
+ } from "./chunk-VLYLQSDD.mjs";
14
14
 
15
15
  // src/withdraw/use-withdraw-flow.ts
16
16
  import { useCallback, useEffect, useMemo, useState } from "react";
@@ -394,11 +394,8 @@ var enUsLabels = {
394
394
  loadingDescription: "This may take a few minutes. You can safely close this window and check the status later in your activity.",
395
395
  summary: {
396
396
  requestedWithdrawal: "Requested withdrawal",
397
- // The response is `pricingStatus: "unquoted"` we don't know net
398
- // output until on-chain settlement. Calling this "Amount received"
399
- // would imply receipt before the lifecycle has confirmed. Keep it
400
- // honest as the submitted amount until the multi-stable quote
401
- // layer (PR-E) populates `expected.outputRaw`.
397
+ // Calling this "Amount received" would imply receipt before the
398
+ // lifecycle has confirmed. Keep it honest as the submitted amount.
402
399
  amountReceived: "Amount",
403
400
  network: "Network",
404
401
  toWallet: "To wallet",
@@ -446,9 +443,8 @@ var enUsLabels = {
446
443
  }
447
444
  },
448
445
  summary: {
449
- // Lifecycle-honest: until quoting is live (PR-E) the response is
450
- // `pricingStatus: "unquoted"` so this is the submitted amount, not
451
- // a guaranteed net output.
446
+ // Lifecycle-honest: this is the submitted amount, not a guaranteed net
447
+ // output.
452
448
  amountReceived: "Amount",
453
449
  network: "Network"
454
450
  }
@@ -459,14 +455,21 @@ var enUsLabels = {
459
455
  },
460
456
  home: {
461
457
  trending: "Trending",
462
- topMarkets: "Top Markets",
458
+ topMarkets: "Trending",
463
459
  newMarkets: "New Markets",
464
460
  categoryTabsAria: "Home page category tabs"
465
461
  },
466
462
  userProfile: {
467
463
  activity: {
468
464
  depositType: "Deposit",
465
+ redeemType: "Claim",
469
466
  withdrawalType: "Withdrawal",
467
+ redeemStatusTitles: {
468
+ pending: "Processing claim",
469
+ completed: "Successful claim",
470
+ failed: "Failed claim",
471
+ canceled: "Canceled claim"
472
+ },
470
473
  depositTitles: {
471
474
  connectedWallet: "Deposit from connected wallet",
472
475
  externalWallet: "Deposit from external wallet",
@@ -574,12 +577,14 @@ var enUsLabels = {
574
577
  unavailableTitle: "Market unavailable",
575
578
  unavailableDescription: "We could not load this market right now.",
576
579
  arbitrage: "Arbitrage",
577
- priceGap: "Price Gap",
578
580
  volumeSuffix: "Vol.",
579
581
  marketSingular: "Market",
580
582
  marketPlural: "Markets",
581
583
  venueSingular: "Venue",
582
- venuePlural: "Venues"
584
+ venuePlural: "Venues",
585
+ matched: "Matched",
586
+ matchedCount: (count) => `${count} ${count === 1 ? "Match" : "Matches"}`,
587
+ priceGap: "Price Gap"
583
588
  },
584
589
  eventItemDetails: {
585
590
  loading: "Loading market details",
@@ -691,8 +696,8 @@ var enUsLabels = {
691
696
  })}\xA2 avg. price`,
692
697
  balance: (value) => `Balance ${value}`,
693
698
  shares: (value) => `${value.toLocaleString("en-US", {
694
- minimumFractionDigits: Number.isInteger(value) ? 0 : 2,
695
- maximumFractionDigits: 6
699
+ minimumFractionDigits: Number.isInteger(value) ? 0 : 1,
700
+ maximumFractionDigits: 2
696
701
  })} shares`,
697
702
  maxShares: "Max",
698
703
  slippage: (value) => `Slippage: ${value}%`,
@@ -776,9 +781,11 @@ var enUsLabels = {
776
781
  platformFee: "0% platform fees",
777
782
  estimatedFees: "Estimated fees",
778
783
  estimatedFeesTooltipAria: "Estimated fees breakdown",
779
- feeBreakdownVenueFees: "Venue fees",
780
- feeBreakdownBridgeFees: "Bridge fees",
781
- feeBreakdownExecutionGas: "Execution gas",
784
+ feeBreakdownVenueFees: "Venue",
785
+ feeBreakdownBridgeFees: "Bridging",
786
+ feeBreakdownExecutionGas: "Gas",
787
+ feeBreakdownAggMarket: "agg.market",
788
+ feeBreakdownPlatformFeeBadge: "0% fee",
782
789
  feeBreakdownTotalFees: "Total fees",
783
790
  toWin: (tab) => tab === "buy" ? "To win" : "Payout",
784
791
  buyingOutcome: (label) => `Buying ${label}`,
@@ -1014,6 +1021,19 @@ var enUsLabels = {
1014
1021
  },
1015
1022
  failedTitle: "Withdrawal failed",
1016
1023
  failedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your funds have been returned to your balance."
1024
+ },
1025
+ claim: {
1026
+ pendingTitle: "Claim started",
1027
+ pendingMessage: "Claiming your winnings.",
1028
+ submittedTitle: "Claim submitted",
1029
+ submittedMessage: "Your claim was submitted. It may take a little while to finish.",
1030
+ successTitle: "Claim complete",
1031
+ successMessage: "Your winnings have been claimed.",
1032
+ partialTitle: "Claim partially completed",
1033
+ partialMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Some winnings could not be claimed. Please try again.",
1034
+ failedTitle: "Claim failed",
1035
+ failedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your winnings could not be claimed. Please try again.",
1036
+ missingOutcomeMessage: "This position is missing claimable outcome data. Please refresh."
1017
1037
  }
1018
1038
  }
1019
1039
  };
@@ -1104,6 +1124,7 @@ var defaultAggUiConfig = {
1104
1124
  features: {
1105
1125
  enableAnimations: true,
1106
1126
  enableLiveUpdates: true,
1127
+ enablePriceGap: false,
1107
1128
  showFeesBreakdown: false,
1108
1129
  enableGradients: false,
1109
1130
  enableVenueEventDiscoveryFilters: false,
@@ -1134,7 +1155,7 @@ var mergeAggUiSearchConfig = (config) => {
1134
1155
  };
1135
1156
  };
1136
1157
  var mergeAggUiConfig = (persisted, config) => {
1137
- 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;
1158
+ 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;
1138
1159
  const locale = (_d = (_c = (_a = config == null ? void 0 : config.general) == null ? void 0 : _a.locale) != null ? _c : (_b = persisted.general) == null ? void 0 : _b.locale) != null ? _d : DEFAULT_LOCALE;
1139
1160
  const theme = (_h = (_g = (_e = config == null ? void 0 : config.general) == null ? void 0 : _e.theme) != null ? _g : (_f = persisted.general) == null ? void 0 : _f.theme) != null ? _h : defaultAggUiConfig.general.theme;
1140
1161
  const formatters = createFormatters(locale);
@@ -1152,25 +1173,26 @@ var mergeAggUiConfig = (persisted, config) => {
1152
1173
  features: {
1153
1174
  enableAnimations: (_p = (_o = config == null ? void 0 : config.features) == null ? void 0 : _o.enableAnimations) != null ? _p : defaultAggUiConfig.features.enableAnimations,
1154
1175
  enableLiveUpdates: (_r = (_q = config == null ? void 0 : config.features) == null ? void 0 : _q.enableLiveUpdates) != null ? _r : defaultAggUiConfig.features.enableLiveUpdates,
1155
- showFeesBreakdown: (_t = (_s = config == null ? void 0 : config.features) == null ? void 0 : _s.showFeesBreakdown) != null ? _t : defaultAggUiConfig.features.showFeesBreakdown,
1156
- enableGradients: (_v = (_u = config == null ? void 0 : config.features) == null ? void 0 : _u.enableGradients) != null ? _v : defaultAggUiConfig.features.enableGradients,
1157
- enableVenueEventDiscoveryFilters: (_x = (_w = config == null ? void 0 : config.features) == null ? void 0 : _w.enableVenueEventDiscoveryFilters) != null ? _x : defaultAggUiConfig.features.enableVenueEventDiscoveryFilters,
1158
- enableNotifications: (_z = (_y = config == null ? void 0 : config.features) == null ? void 0 : _y.enableNotifications) != null ? _z : defaultAggUiConfig.features.enableNotifications
1176
+ enablePriceGap: (_t = (_s = config == null ? void 0 : config.features) == null ? void 0 : _s.enablePriceGap) != null ? _t : defaultAggUiConfig.features.enablePriceGap,
1177
+ showFeesBreakdown: (_v = (_u = config == null ? void 0 : config.features) == null ? void 0 : _u.showFeesBreakdown) != null ? _v : defaultAggUiConfig.features.showFeesBreakdown,
1178
+ enableGradients: (_x = (_w = config == null ? void 0 : config.features) == null ? void 0 : _w.enableGradients) != null ? _x : defaultAggUiConfig.features.enableGradients,
1179
+ enableVenueEventDiscoveryFilters: (_z = (_y = config == null ? void 0 : config.features) == null ? void 0 : _y.enableVenueEventDiscoveryFilters) != null ? _z : defaultAggUiConfig.features.enableVenueEventDiscoveryFilters,
1180
+ enableNotifications: (_B = (_A = config == null ? void 0 : config.features) == null ? void 0 : _A.enableNotifications) != null ? _B : defaultAggUiConfig.features.enableNotifications
1159
1181
  },
1160
1182
  market: {
1161
- arbitrageThreshold: (_B = (_A = config == null ? void 0 : config.market) == null ? void 0 : _A.arbitrageThreshold) != null ? _B : defaultAggUiConfig.market.arbitrageThreshold
1183
+ arbitrageThreshold: (_D = (_C = config == null ? void 0 : config.market) == null ? void 0 : _C.arbitrageThreshold) != null ? _D : defaultAggUiConfig.market.arbitrageThreshold
1162
1184
  },
1163
1185
  chart: {
1164
- defaultChartTimeRange: (_D = (_C = config == null ? void 0 : config.chart) == null ? void 0 : _C.defaultChartTimeRange) != null ? _D : defaultAggUiConfig.chart.defaultChartTimeRange,
1165
- selectedChartTimeRange: (_H = (_G = (_E = persisted.chart) == null ? void 0 : _E.selectedChartTimeRange) != null ? _G : (_F = config == null ? void 0 : config.chart) == null ? void 0 : _F.defaultChartTimeRange) != null ? _H : defaultAggUiConfig.chart.defaultChartTimeRange,
1186
+ defaultChartTimeRange: (_F = (_E = config == null ? void 0 : config.chart) == null ? void 0 : _E.defaultChartTimeRange) != null ? _F : defaultAggUiConfig.chart.defaultChartTimeRange,
1187
+ selectedChartTimeRange: (_J = (_I = (_G = persisted.chart) == null ? void 0 : _G.selectedChartTimeRange) != null ? _I : (_H = config == null ? void 0 : config.chart) == null ? void 0 : _H.defaultChartTimeRange) != null ? _J : defaultAggUiConfig.chart.defaultChartTimeRange,
1166
1188
  setSelectedChartTimeRange: defaultAggUiConfig.chart.setSelectedChartTimeRange
1167
1189
  },
1168
1190
  formatting: {
1169
- formatNumber: (_J = (_I = config == null ? void 0 : config.formatting) == null ? void 0 : _I.formatNumber) != null ? _J : formatters.formatNumber,
1170
- formatPercent: (_L = (_K = config == null ? void 0 : config.formatting) == null ? void 0 : _K.formatPercent) != null ? _L : formatters.formatPercent,
1171
- formatCurrency: (_N = (_M = config == null ? void 0 : config.formatting) == null ? void 0 : _M.formatCurrency) != null ? _N : formatters.formatCurrency,
1172
- formatCompactCurrency: (_P = (_O = config == null ? void 0 : config.formatting) == null ? void 0 : _O.formatCompactCurrency) != null ? _P : formatters.formatCompactCurrency,
1173
- formatDate: (_R = (_Q = config == null ? void 0 : config.formatting) == null ? void 0 : _Q.formatDate) != null ? _R : formatters.formatDate
1191
+ formatNumber: (_L = (_K = config == null ? void 0 : config.formatting) == null ? void 0 : _K.formatNumber) != null ? _L : formatters.formatNumber,
1192
+ formatPercent: (_N = (_M = config == null ? void 0 : config.formatting) == null ? void 0 : _M.formatPercent) != null ? _N : formatters.formatPercent,
1193
+ formatCurrency: (_P = (_O = config == null ? void 0 : config.formatting) == null ? void 0 : _O.formatCurrency) != null ? _P : formatters.formatCurrency,
1194
+ formatCompactCurrency: (_R = (_Q = config == null ? void 0 : config.formatting) == null ? void 0 : _Q.formatCompactCurrency) != null ? _R : formatters.formatCompactCurrency,
1195
+ formatDate: (_T = (_S = config == null ? void 0 : config.formatting) == null ? void 0 : _S.formatDate) != null ? _T : formatters.formatDate
1174
1196
  },
1175
1197
  search: mergeAggUiSearchConfig(config == null ? void 0 : config.search),
1176
1198
  walletActions: config == null ? void 0 : config.walletActions,
@@ -1181,9 +1203,16 @@ var mergeAggUiConfig = (persisted, config) => {
1181
1203
  // src/execution/query-keys.ts
1182
1204
  var executionKeys = {
1183
1205
  all: () => ["execution"],
1184
- balances: () => ["execution", "balances"],
1185
- positions: (cursor, limit, status) => ["execution", "positions", cursor != null ? cursor : null, limit != null ? limit : null, status != null ? status : null],
1206
+ balances: (mode) => mode ? ["execution", "balances", mode] : ["execution", "balances"],
1207
+ positions: (cursor, limit, status, mode) => mode ? ["execution", "positions", cursor != null ? cursor : null, limit != null ? limit : null, status != null ? status : null, mode] : ["execution", "positions", cursor != null ? cursor : null, limit != null ? limit : null, status != null ? status : null],
1186
1208
  positionsPrefix: () => ["execution", "positions"],
1209
+ claimablePositionsCount: () => ["execution", "positions", "claimable-count"],
1210
+ /**
1211
+ * @deprecated Misnomer — claimable (redeemStatus "eligible") groups live in
1212
+ * the ACTIVE bucket, not closed (won-but-unclaimed stays Active until a
1213
+ * redeem stamps redeemedAt). Same key value as `claimablePositionsCount`;
1214
+ * kept so existing invalidation call sites keep matching.
1215
+ */
1187
1216
  claimableClosedPositionsCount: () => ["execution", "positions", "claimable-count"],
1188
1217
  orders: (status, cursor, limit) => ["execution", "orders", status != null ? status : null, cursor != null ? cursor : null, limit != null ? limit : null],
1189
1218
  ordersPrefix: () => ["execution", "orders"],
@@ -1234,7 +1263,8 @@ var shouldInvalidateBalancesForOrderEvent = (event, currentUserId) => {
1234
1263
  return event.userId === currentUserId;
1235
1264
  };
1236
1265
  var userActivityQueryKeys = {
1237
- all: () => ["user-activity"]
1266
+ all: () => ["user-activity"],
1267
+ feed: (type, limit) => ["user-activity", type != null ? type : "all", limit != null ? limit : 50]
1238
1268
  };
1239
1269
  var invalidateUserActivityQueries = (queryClient, options) => {
1240
1270
  var _a;
@@ -1253,6 +1283,17 @@ var invalidateUserMoneyState = (queryClient, options) => {
1253
1283
  invalidatePositionQueries(queryClient, { refetchType: options == null ? void 0 : options.refetchType });
1254
1284
  invalidateUserActivityQueries(queryClient, { strategy: options == null ? void 0 : options.activityStrategy });
1255
1285
  };
1286
+ var invalidateUserClaimState = (queryClient, options) => {
1287
+ var _a;
1288
+ const refetchType = (_a = options == null ? void 0 : options.refetchType) != null ? _a : "active";
1289
+ invalidateBalanceQueries(queryClient, { refetchType });
1290
+ invalidatePositionQueries(queryClient, { refetchType });
1291
+ queryClient.invalidateQueries({
1292
+ queryKey: executionKeys.claimablePositionsCount(),
1293
+ refetchType
1294
+ });
1295
+ invalidateUserActivityQueries(queryClient, { strategy: options == null ? void 0 : options.activityStrategy });
1296
+ };
1256
1297
 
1257
1298
  // src/core/providers/balance-provider.tsx
1258
1299
  import { useQuery } from "@tanstack/react-query";
@@ -3053,8 +3094,20 @@ var AggUiProvider = ({ config, children }) => {
3053
3094
  import { useQueryClient as useQueryClient2 } from "@tanstack/react-query";
3054
3095
 
3055
3096
  // src/core/providers/auth-provider.tsx
3097
+ import { QueryClient, QueryClientContext } from "@tanstack/react-query";
3056
3098
  import { useCallback as useCallback6, useContext as useContext6, useEffect as useEffect3, useMemo as useMemo5, useState as useState3 } from "react";
3057
3099
 
3100
+ // src/current-user-query.ts
3101
+ var CURRENT_USER_QUERY_KEY = ["current-user"];
3102
+ var CURRENT_USER_STALE_TIME_MS = 6e4;
3103
+ var fetchCurrentUserProfile = (queryClient, client, queryKey = CURRENT_USER_QUERY_KEY) => {
3104
+ return queryClient.fetchQuery({
3105
+ queryKey,
3106
+ queryFn: () => client.getCurrentUser(),
3107
+ staleTime: CURRENT_USER_STALE_TIME_MS
3108
+ });
3109
+ };
3110
+
3058
3111
  // src/core/providers/auth-utils.ts
3059
3112
  import { TurnstileChallengeError } from "@agg-build/sdk";
3060
3113
  var createPlaceholderUserProfile = (input) => {
@@ -3209,6 +3262,9 @@ var replaceAuthCallbackUrl = (cleanupPath) => {
3209
3262
  };
3210
3263
  function AggAuthProvider({ children }) {
3211
3264
  const client = useContext6(AggClientContext);
3265
+ const queryClientFromContext = useContext6(QueryClientContext);
3266
+ const fallbackQueryClient = useMemo5(() => new QueryClient(), []);
3267
+ const queryClient = queryClientFromContext && "fetchQuery" in queryClientFromContext ? queryClientFromContext : fallbackQueryClient;
3212
3268
  const snapshot = getClientAuthSnapshot(client);
3213
3269
  const [isAuthenticated, setIsAuthenticated] = useState3(snapshot.isAuthenticated);
3214
3270
  const [user, setUser] = useState3(snapshot.user);
@@ -3223,12 +3279,15 @@ function AggAuthProvider({ children }) {
3223
3279
  return provider === "wallet" || provider === "solana_wallet";
3224
3280
  });
3225
3281
  }, [user]);
3226
- const refreshCurrentUser = useCallback6((targetClient) => __async(null, null, function* () {
3227
- const fullUser = yield targetClient.getCurrentUser();
3228
- setIsAuthenticated(true);
3229
- setUser(fullUser);
3230
- return fullUser;
3231
- }), []);
3282
+ const refreshCurrentUser = useCallback6(
3283
+ (targetClient) => __async(null, null, function* () {
3284
+ const fullUser = yield fetchCurrentUserProfile(queryClient, targetClient);
3285
+ setIsAuthenticated(true);
3286
+ setUser(fullUser);
3287
+ return fullUser;
3288
+ }),
3289
+ [queryClient]
3290
+ );
3232
3291
  useEffect3(() => {
3233
3292
  const state = getClientAuthSnapshot(client);
3234
3293
  setIsAuthenticated(state.isAuthenticated);
@@ -3499,10 +3558,10 @@ function useWithdrawManaged(options) {
3499
3558
  import { useQuery as useQuery2 } from "@tanstack/react-query";
3500
3559
  function useManagedBalances(options) {
3501
3560
  const client = useAggClient();
3502
- const { enabled = true } = options != null ? options : {};
3561
+ const { enabled = true, mode } = options != null ? options : {};
3503
3562
  const query = useQuery2({
3504
- queryKey: executionKeys.balances(),
3505
- queryFn: () => client.getManagedBalances(),
3563
+ queryKey: executionKeys.balances(mode),
3564
+ queryFn: () => client.getManagedBalances(mode ? { mode } : void 0),
3506
3565
  enabled,
3507
3566
  staleTime: 1e4,
3508
3567
  gcTime: 5 * 6e4,
@@ -3518,10 +3577,10 @@ import { useQuery as useQuery3 } from "@tanstack/react-query";
3518
3577
  function usePositions(options) {
3519
3578
  var _a, _b, _c, _d;
3520
3579
  const client = useAggClient();
3521
- const { enabled = true, cursor, limit, status } = options != null ? options : {};
3580
+ const { enabled = true, cursor, limit, status, mode } = options != null ? options : {};
3522
3581
  const query = useQuery3({
3523
- queryKey: executionKeys.positions(cursor, limit, status),
3524
- queryFn: () => client.getPositions({ cursor, limit, status }),
3582
+ queryKey: executionKeys.positions(cursor, limit, status, mode),
3583
+ queryFn: () => client.getPositions(__spreadValues({ cursor, limit, status }, mode ? { mode } : {})),
3525
3584
  enabled,
3526
3585
  staleTime: 1e4,
3527
3586
  gcTime: 5 * 6e4,
@@ -3625,7 +3684,8 @@ function mapOrderStatusToTerminalEvent(status) {
3625
3684
  }
3626
3685
  function useExecutionProgress({
3627
3686
  orderIds,
3628
- enabled
3687
+ enabled,
3688
+ mode
3629
3689
  }) {
3630
3690
  const [phase, setPhase] = useState5("idle");
3631
3691
  const [submittedOrders, setSubmittedOrders] = useState5([]);
@@ -3833,7 +3893,10 @@ function useExecutionProgress({
3833
3893
  pending.map((orderId) => __async(null, null, function* () {
3834
3894
  var _a2, _b2;
3835
3895
  try {
3836
- const res = yield client.getExecutionOrders({ orderId, limit: 1 });
3896
+ const res = yield client.getExecutionOrders(__spreadValues({
3897
+ orderId,
3898
+ limit: 1
3899
+ }, mode ? { mode } : {}));
3837
3900
  return (_b2 = (_a2 = res.data) == null ? void 0 : _a2[0]) != null ? _b2 : null;
3838
3901
  } catch (e) {
3839
3902
  return null;
@@ -3894,7 +3957,7 @@ function useExecutionProgress({
3894
3957
  cancelled = true;
3895
3958
  stopPolling();
3896
3959
  };
3897
- }, [client, isListening, orderIds]);
3960
+ }, [client, isListening, mode, orderIds]);
3898
3961
  return { phase, submittedOrders, latestBalance, dagProgress, terminalOrderEvents };
3899
3962
  }
3900
3963
 
@@ -3959,10 +4022,8 @@ var useRedeem = () => {
3959
4022
  }
3960
4023
  return response;
3961
4024
  }),
3962
- onSuccess: () => {
3963
- queryClient.invalidateQueries({ queryKey: executionKeys.positionsPrefix() });
3964
- queryClient.invalidateQueries({ queryKey: executionKeys.balances() });
3965
- queryClient.invalidateQueries({ queryKey: executionKeys.claimableClosedPositionsCount() });
4025
+ onSettled: () => {
4026
+ invalidateUserClaimState(queryClient);
3966
4027
  }
3967
4028
  });
3968
4029
  };
@@ -3975,13 +4036,13 @@ var useOnRedeemEvent2 = (listener) => {
3975
4036
  // src/execution/use-redeem-eligible-count.ts
3976
4037
  import { useQuery as useQuery5 } from "@tanstack/react-query";
3977
4038
  var CLAIMABLE_COUNT_PAGE_LIMIT = 100;
3978
- var getClaimableClosedPositionsCount = (client) => __async(null, null, function* () {
4039
+ var getClaimablePositionsCount = (client) => __async(null, null, function* () {
3979
4040
  var _a;
3980
4041
  let total = 0;
3981
4042
  let cursor;
3982
4043
  do {
3983
4044
  const page = yield client.getExecutionPositions({
3984
- status: "closed",
4045
+ status: "active",
3985
4046
  limit: CLAIMABLE_COUNT_PAGE_LIMIT,
3986
4047
  cursor
3987
4048
  });
@@ -3999,8 +4060,8 @@ var useRedeemEligibleCount = () => {
3999
4060
  const client = useAggClient();
4000
4061
  const { isAuthenticated } = useAggAuthState();
4001
4062
  const query = useQuery5({
4002
- queryKey: executionKeys.claimableClosedPositionsCount(),
4003
- queryFn: () => getClaimableClosedPositionsCount(client),
4063
+ queryKey: executionKeys.claimablePositionsCount(),
4064
+ queryFn: () => getClaimablePositionsCount(client),
4004
4065
  enabled: isAuthenticated,
4005
4066
  staleTime: 3e4,
4006
4067
  refetchInterval: isAuthenticated ? 45e3 : false
@@ -4172,6 +4233,7 @@ export {
4172
4233
  userActivityQueryKeys,
4173
4234
  invalidateUserActivityQueries,
4174
4235
  invalidateUserMoneyState,
4236
+ invalidateUserClaimState,
4175
4237
  AggBalanceProvider,
4176
4238
  EventListStateProvider,
4177
4239
  useEventListState,
package/dist/deposit.js CHANGED
@@ -287,11 +287,8 @@ var enUsLabels = {
287
287
  loadingDescription: "This may take a few minutes. You can safely close this window and check the status later in your activity.",
288
288
  summary: {
289
289
  requestedWithdrawal: "Requested withdrawal",
290
- // The response is `pricingStatus: "unquoted"` we don't know net
291
- // output until on-chain settlement. Calling this "Amount received"
292
- // would imply receipt before the lifecycle has confirmed. Keep it
293
- // honest as the submitted amount until the multi-stable quote
294
- // layer (PR-E) populates `expected.outputRaw`.
290
+ // Calling this "Amount received" would imply receipt before the
291
+ // lifecycle has confirmed. Keep it honest as the submitted amount.
295
292
  amountReceived: "Amount",
296
293
  network: "Network",
297
294
  toWallet: "To wallet",
@@ -339,9 +336,8 @@ var enUsLabels = {
339
336
  }
340
337
  },
341
338
  summary: {
342
- // Lifecycle-honest: until quoting is live (PR-E) the response is
343
- // `pricingStatus: "unquoted"` so this is the submitted amount, not
344
- // a guaranteed net output.
339
+ // Lifecycle-honest: this is the submitted amount, not a guaranteed net
340
+ // output.
345
341
  amountReceived: "Amount",
346
342
  network: "Network"
347
343
  }
@@ -352,14 +348,21 @@ var enUsLabels = {
352
348
  },
353
349
  home: {
354
350
  trending: "Trending",
355
- topMarkets: "Top Markets",
351
+ topMarkets: "Trending",
356
352
  newMarkets: "New Markets",
357
353
  categoryTabsAria: "Home page category tabs"
358
354
  },
359
355
  userProfile: {
360
356
  activity: {
361
357
  depositType: "Deposit",
358
+ redeemType: "Claim",
362
359
  withdrawalType: "Withdrawal",
360
+ redeemStatusTitles: {
361
+ pending: "Processing claim",
362
+ completed: "Successful claim",
363
+ failed: "Failed claim",
364
+ canceled: "Canceled claim"
365
+ },
363
366
  depositTitles: {
364
367
  connectedWallet: "Deposit from connected wallet",
365
368
  externalWallet: "Deposit from external wallet",
@@ -467,12 +470,14 @@ var enUsLabels = {
467
470
  unavailableTitle: "Market unavailable",
468
471
  unavailableDescription: "We could not load this market right now.",
469
472
  arbitrage: "Arbitrage",
470
- priceGap: "Price Gap",
471
473
  volumeSuffix: "Vol.",
472
474
  marketSingular: "Market",
473
475
  marketPlural: "Markets",
474
476
  venueSingular: "Venue",
475
- venuePlural: "Venues"
477
+ venuePlural: "Venues",
478
+ matched: "Matched",
479
+ matchedCount: (count) => `${count} ${count === 1 ? "Match" : "Matches"}`,
480
+ priceGap: "Price Gap"
476
481
  },
477
482
  eventItemDetails: {
478
483
  loading: "Loading market details",
@@ -584,8 +589,8 @@ var enUsLabels = {
584
589
  })}\xA2 avg. price`,
585
590
  balance: (value) => `Balance ${value}`,
586
591
  shares: (value) => `${value.toLocaleString("en-US", {
587
- minimumFractionDigits: Number.isInteger(value) ? 0 : 2,
588
- maximumFractionDigits: 6
592
+ minimumFractionDigits: Number.isInteger(value) ? 0 : 1,
593
+ maximumFractionDigits: 2
589
594
  })} shares`,
590
595
  maxShares: "Max",
591
596
  slippage: (value) => `Slippage: ${value}%`,
@@ -669,9 +674,11 @@ var enUsLabels = {
669
674
  platformFee: "0% platform fees",
670
675
  estimatedFees: "Estimated fees",
671
676
  estimatedFeesTooltipAria: "Estimated fees breakdown",
672
- feeBreakdownVenueFees: "Venue fees",
673
- feeBreakdownBridgeFees: "Bridge fees",
674
- feeBreakdownExecutionGas: "Execution gas",
677
+ feeBreakdownVenueFees: "Venue",
678
+ feeBreakdownBridgeFees: "Bridging",
679
+ feeBreakdownExecutionGas: "Gas",
680
+ feeBreakdownAggMarket: "agg.market",
681
+ feeBreakdownPlatformFeeBadge: "0% fee",
675
682
  feeBreakdownTotalFees: "Total fees",
676
683
  toWin: (tab) => tab === "buy" ? "To win" : "Payout",
677
684
  buyingOutcome: (label) => `Buying ${label}`,
@@ -907,6 +914,19 @@ var enUsLabels = {
907
914
  },
908
915
  failedTitle: "Withdrawal failed",
909
916
  failedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your funds have been returned to your balance."
917
+ },
918
+ claim: {
919
+ pendingTitle: "Claim started",
920
+ pendingMessage: "Claiming your winnings.",
921
+ submittedTitle: "Claim submitted",
922
+ submittedMessage: "Your claim was submitted. It may take a little while to finish.",
923
+ successTitle: "Claim complete",
924
+ successMessage: "Your winnings have been claimed.",
925
+ partialTitle: "Claim partially completed",
926
+ partialMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Some winnings could not be claimed. Please try again.",
927
+ failedTitle: "Claim failed",
928
+ failedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your winnings could not be claimed. Please try again.",
929
+ missingOutcomeMessage: "This position is missing claimable outcome data. Please refresh."
910
930
  }
911
931
  }
912
932
  };
@@ -977,6 +997,7 @@ var defaultAggUiConfig = {
977
997
  features: {
978
998
  enableAnimations: true,
979
999
  enableLiveUpdates: true,
1000
+ enablePriceGap: false,
980
1001
  showFeesBreakdown: false,
981
1002
  enableGradients: false,
982
1003
  enableVenueEventDiscoveryFilters: false,
@@ -1005,9 +1026,16 @@ var AggBalanceContext = (0, import_react.createContext)(null);
1005
1026
  // src/execution/query-keys.ts
1006
1027
  var executionKeys = {
1007
1028
  all: () => ["execution"],
1008
- balances: () => ["execution", "balances"],
1009
- positions: (cursor, limit, status) => ["execution", "positions", cursor != null ? cursor : null, limit != null ? limit : null, status != null ? status : null],
1029
+ balances: (mode) => mode ? ["execution", "balances", mode] : ["execution", "balances"],
1030
+ positions: (cursor, limit, status, mode) => mode ? ["execution", "positions", cursor != null ? cursor : null, limit != null ? limit : null, status != null ? status : null, mode] : ["execution", "positions", cursor != null ? cursor : null, limit != null ? limit : null, status != null ? status : null],
1010
1031
  positionsPrefix: () => ["execution", "positions"],
1032
+ claimablePositionsCount: () => ["execution", "positions", "claimable-count"],
1033
+ /**
1034
+ * @deprecated Misnomer — claimable (redeemStatus "eligible") groups live in
1035
+ * the ACTIVE bucket, not closed (won-but-unclaimed stays Active until a
1036
+ * redeem stamps redeemedAt). Same key value as `claimablePositionsCount`;
1037
+ * kept so existing invalidation call sites keep matching.
1038
+ */
1011
1039
  claimableClosedPositionsCount: () => ["execution", "positions", "claimable-count"],
1012
1040
  orders: (status, cursor, limit) => ["execution", "orders", status != null ? status : null, cursor != null ? cursor : null, limit != null ? limit : null],
1013
1041
  ordersPrefix: () => ["execution", "orders"],
@@ -1052,7 +1080,8 @@ var invalidatePositionQueries = (queryClient, options) => {
1052
1080
  });
1053
1081
  };
1054
1082
  var userActivityQueryKeys = {
1055
- all: () => ["user-activity"]
1083
+ all: () => ["user-activity"],
1084
+ feed: (type, limit) => ["user-activity", type != null ? type : "all", limit != null ? limit : 50]
1056
1085
  };
1057
1086
  var invalidateUserActivityQueries = (queryClient, options) => {
1058
1087
  var _a;
package/dist/deposit.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  useRampQuotes,
3
3
  useRampSession
4
- } from "./chunk-R6VANZRA.mjs";
4
+ } from "./chunk-KXO3JOXF.mjs";
5
5
  import {
6
6
  __async,
7
7
  useAggAuthState,
@@ -9,7 +9,7 @@ import {
9
9
  useAggUiConfig,
10
10
  useDepositAddresses,
11
11
  useSyncBalances
12
- } from "./chunk-2C7JR5OH.mjs";
12
+ } from "./chunk-VLYLQSDD.mjs";
13
13
 
14
14
  // src/deposit/normalize-wallet-error.ts
15
15
  function normalizeWalletError(error, supportedChains) {