@agg-build/ui 1.2.10 → 1.2.12

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 (140) hide show
  1. package/dist/{chunk-K23CJ5UP.mjs → chunk-3JXBOU24.mjs} +580 -307
  2. package/dist/{chunk-5MTIBPDY.mjs → chunk-4WBQTUPW.mjs} +1091 -441
  3. package/dist/{chunk-5PSAIGOT.mjs → chunk-IBOE7DRY.mjs} +137 -61
  4. package/dist/{chunk-XKADJNAJ.mjs → chunk-J6WELNCX.mjs} +601 -326
  5. package/dist/{chunk-7JKGAWU5.mjs → chunk-U55T5BPE.mjs} +1802 -1564
  6. package/dist/{chunk-QFW5NDJ6.mjs → chunk-X3KCFWXN.mjs} +1312 -1040
  7. package/dist/{chunk-5MDFM2MX.mjs → chunk-YSW4ULL5.mjs} +1 -1
  8. package/dist/events.js +2892 -1746
  9. package/dist/events.mjs +3 -3
  10. package/dist/index.js +7085 -4956
  11. package/dist/index.mjs +520 -139
  12. package/dist/modals.js +3434 -2315
  13. package/dist/modals.mjs +3 -3
  14. package/dist/pages.js +4175 -2764
  15. package/dist/pages.mjs +6 -6
  16. package/dist/primitives.js +1295 -942
  17. package/dist/primitives.mjs +5 -1
  18. package/dist/styles.css +1 -1
  19. package/dist/tailwind.css +1 -1
  20. package/dist/trading.js +1677 -1249
  21. package/dist/trading.mjs +4 -4
  22. package/dist/types/agg-provider.d.mts +27 -0
  23. package/dist/types/agg-provider.d.ts +27 -0
  24. package/dist/types/deposit/deposit-modal.types.d.mts +10 -1
  25. package/dist/types/deposit/deposit-modal.types.d.ts +10 -1
  26. package/dist/types/deposit/index.d.mts +1 -1
  27. package/dist/types/deposit/index.d.ts +1 -1
  28. package/dist/types/deposit/steps/crypto-transfer.d.mts +1 -2
  29. package/dist/types/deposit/steps/crypto-transfer.d.ts +1 -2
  30. package/dist/types/deposit/steps/deposit-method.d.mts +2 -1
  31. package/dist/types/deposit/steps/deposit-method.d.ts +2 -1
  32. package/dist/types/events/item/event-list-item.types.d.mts +3 -1
  33. package/dist/types/events/item/event-list-item.types.d.ts +3 -1
  34. package/dist/types/events/item/event-list-item.utils.d.mts +26 -2
  35. package/dist/types/events/item/event-list-item.utils.d.ts +26 -2
  36. package/dist/types/events/item-details/event-list-item-details.types.d.mts +30 -1
  37. package/dist/types/events/item-details/event-list-item-details.types.d.ts +30 -1
  38. package/dist/types/events/list/event-list-tabs.d.mts +6 -1
  39. package/dist/types/events/list/event-list-tabs.d.ts +6 -1
  40. package/dist/types/events/market-details/index.d.mts +1 -1
  41. package/dist/types/events/market-details/index.d.ts +1 -1
  42. package/dist/types/events/market-details/market-details.types.d.mts +27 -2
  43. package/dist/types/events/market-details/market-details.types.d.ts +27 -2
  44. package/dist/types/events/market-details/market-details.utils.d.mts +18 -4
  45. package/dist/types/events/market-details/market-details.utils.d.ts +18 -4
  46. package/dist/types/events/market-details/orderbook-aggregation.d.mts +30 -10
  47. package/dist/types/events/market-details/orderbook-aggregation.d.ts +30 -10
  48. package/dist/types/events/shared/chart-auto-fallback.d.mts +43 -0
  49. package/dist/types/events/shared/chart-auto-fallback.d.ts +43 -0
  50. package/dist/types/events/shared/display-outcome-price.d.mts +14 -0
  51. package/dist/types/events/shared/display-outcome-price.d.ts +14 -0
  52. package/dist/types/events/shared/display-outcome-venue.d.mts +30 -0
  53. package/dist/types/events/shared/display-outcome-venue.d.ts +30 -0
  54. package/dist/types/events/shared/display-reference-price.d.mts +4 -0
  55. package/dist/types/events/shared/display-reference-price.d.ts +4 -0
  56. package/dist/types/events/shared/select-outcome-price.d.mts +21 -0
  57. package/dist/types/events/shared/select-outcome-price.d.ts +21 -0
  58. package/dist/types/index.d.mts +2 -0
  59. package/dist/types/index.d.ts +2 -0
  60. package/dist/types/notifications/agg-notification-events-provider.d.mts +35 -0
  61. package/dist/types/notifications/agg-notification-events-provider.d.ts +35 -0
  62. package/dist/types/notifications/agg-toast-provider.d.mts +27 -0
  63. package/dist/types/notifications/agg-toast-provider.d.ts +27 -0
  64. package/dist/types/notifications/deposit-notification-events.d.mts +10 -0
  65. package/dist/types/notifications/deposit-notification-events.d.ts +10 -0
  66. package/dist/types/notifications/index.d.mts +2 -0
  67. package/dist/types/notifications/index.d.ts +2 -0
  68. package/dist/types/pages/user-profile/components/available-balance-card.d.mts +2 -1
  69. package/dist/types/pages/user-profile/components/available-balance-card.d.ts +2 -1
  70. package/dist/types/pages/user-profile/components/positions-value-card.d.mts +2 -1
  71. package/dist/types/pages/user-profile/components/positions-value-card.d.ts +2 -1
  72. package/dist/types/pages/user-profile/index.d.mts +2 -2
  73. package/dist/types/pages/user-profile/index.d.ts +2 -2
  74. package/dist/types/pages/user-profile/user-profile.types.d.mts +54 -1
  75. package/dist/types/pages/user-profile/user-profile.types.d.ts +54 -1
  76. package/dist/types/primitives/button/button.types.d.mts +4 -0
  77. package/dist/types/primitives/button/button.types.d.ts +4 -0
  78. package/dist/types/primitives/button/index.d.mts +1 -1
  79. package/dist/types/primitives/button/index.d.ts +1 -1
  80. package/dist/types/primitives/chart/chart.utils.d.mts +9 -10
  81. package/dist/types/primitives/chart/chart.utils.d.ts +9 -10
  82. package/dist/types/primitives/icon/index.d.mts +2 -1
  83. package/dist/types/primitives/icon/index.d.ts +2 -1
  84. package/dist/types/primitives/icon/registry.d.mts +24 -0
  85. package/dist/types/primitives/icon/registry.d.ts +24 -0
  86. package/dist/types/primitives/icon/svg/circle-xmark.d.mts +5 -0
  87. package/dist/types/primitives/icon/svg/circle-xmark.d.ts +5 -0
  88. package/dist/types/primitives/icon/svg/sort-end-date.d.mts +5 -0
  89. package/dist/types/primitives/icon/svg/sort-end-date.d.ts +5 -0
  90. package/dist/types/primitives/icon/svg/sort-top-arbitrage.d.mts +5 -0
  91. package/dist/types/primitives/icon/svg/sort-top-arbitrage.d.ts +5 -0
  92. package/dist/types/primitives/icon/svg/sort-volume-24hr.d.mts +5 -0
  93. package/dist/types/primitives/icon/svg/sort-volume-24hr.d.ts +5 -0
  94. package/dist/types/primitives/icon/svg/sort-volume.d.mts +5 -0
  95. package/dist/types/primitives/icon/svg/sort-volume.d.ts +5 -0
  96. package/dist/types/primitives/icon/svg/spinner.d.mts +5 -0
  97. package/dist/types/primitives/icon/svg/spinner.d.ts +5 -0
  98. package/dist/types/primitives/select/index.d.mts +1 -1
  99. package/dist/types/primitives/select/index.d.ts +1 -1
  100. package/dist/types/primitives/select/select.types.d.mts +9 -0
  101. package/dist/types/primitives/select/select.types.d.ts +9 -0
  102. package/dist/types/primitives/toast/index.d.mts +2 -0
  103. package/dist/types/primitives/toast/index.d.ts +2 -0
  104. package/dist/types/primitives/toast/toast.types.d.mts +3 -0
  105. package/dist/types/primitives/toast/toast.types.d.ts +3 -0
  106. package/dist/types/primitives/tooltip/tooltip.types.d.mts +1 -0
  107. package/dist/types/primitives/tooltip/tooltip.types.d.ts +1 -0
  108. package/dist/types/primitives/typography/index.d.mts +1 -1
  109. package/dist/types/primitives/typography/index.d.ts +1 -1
  110. package/dist/types/primitives/typography/typography.types.d.mts +2 -0
  111. package/dist/types/primitives/typography/typography.types.d.ts +2 -0
  112. package/dist/types/profile/index.d.mts +1 -1
  113. package/dist/types/profile/index.d.ts +1 -1
  114. package/dist/types/profile/profile-modal.constants.d.mts +2 -2
  115. package/dist/types/profile/profile-modal.constants.d.ts +2 -2
  116. package/dist/types/profile/tabs/accounts-wallets-tab.d.mts +2 -17
  117. package/dist/types/profile/tabs/accounts-wallets-tab.d.ts +2 -17
  118. package/dist/types/profile/tabs/trading-access-tab.d.mts +15 -0
  119. package/dist/types/profile/tabs/trading-access-tab.d.ts +15 -0
  120. package/dist/types/shared/transfer-fee-summary.d.mts +10 -0
  121. package/dist/types/shared/transfer-fee-summary.d.ts +10 -0
  122. package/dist/types/shared/utils.d.mts +3 -0
  123. package/dist/types/shared/utils.d.ts +3 -0
  124. package/dist/types/trading/place-order/index.d.mts +1 -1
  125. package/dist/types/trading/place-order/index.d.ts +1 -1
  126. package/dist/types/trading/place-order/index.place-order.execution-steps.d.mts +9 -0
  127. package/dist/types/trading/place-order/index.place-order.execution-steps.d.ts +9 -0
  128. package/dist/types/trading/place-order/index.place-order.types.d.mts +15 -2
  129. package/dist/types/trading/place-order/index.place-order.types.d.ts +15 -2
  130. package/dist/types/trading/place-order/index.place-order.utils.d.mts +49 -6
  131. package/dist/types/trading/place-order/index.place-order.utils.d.ts +49 -6
  132. package/dist/types/withdraw/index.d.mts +1 -1
  133. package/dist/types/withdraw/index.d.ts +1 -1
  134. package/dist/types/withdraw/steps/withdraw-success.d.mts +13 -7
  135. package/dist/types/withdraw/steps/withdraw-success.d.ts +13 -7
  136. package/dist/types/withdraw/steps/withdraw-success.utils.d.mts +2 -0
  137. package/dist/types/withdraw/steps/withdraw-success.utils.d.ts +2 -0
  138. package/dist/types/withdraw/withdraw-modal.types.d.mts +5 -0
  139. package/dist/types/withdraw/withdraw-modal.types.d.ts +5 -0
  140. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  USER_PROFILE_TAB_POSITIONS,
11
11
  UserProfilePage,
12
12
  useHomePageModals
13
- } from "./chunk-XKADJNAJ.mjs";
13
+ } from "./chunk-J6WELNCX.mjs";
14
14
  import {
15
15
  EventList,
16
16
  EventListItem,
@@ -25,7 +25,7 @@ import {
25
25
  mergeVenueOutcomeOrderbooks,
26
26
  orderbookRowLimitDefault,
27
27
  useCenterOrderbookSpread
28
- } from "./chunk-5MTIBPDY.mjs";
28
+ } from "./chunk-4WBQTUPW.mjs";
29
29
  import {
30
30
  CARD_NETWORK_OPTIONS,
31
31
  ConnectAccountsStep,
@@ -39,8 +39,9 @@ import {
39
39
  ProfileSetupStep,
40
40
  WithdrawModal,
41
41
  clearPendingCardSession,
42
- getPendingCardSession
43
- } from "./chunk-7JKGAWU5.mjs";
42
+ getPendingCardSession,
43
+ subscribeAggDepositNotification
44
+ } from "./chunk-U55T5BPE.mjs";
44
45
  import {
45
46
  DEPOSIT_MODAL_OPEN_EVENT,
46
47
  PlaceOrder,
@@ -52,7 +53,7 @@ import {
52
53
  parseVenue,
53
54
  requestAggDepositModalOpen,
54
55
  requestAggWithdrawModalOpen
55
- } from "./chunk-K23CJ5UP.mjs";
56
+ } from "./chunk-3JXBOU24.mjs";
56
57
  import {
57
58
  SETTLEMENT_SECTION_ID,
58
59
  Settlement,
@@ -70,10 +71,10 @@ import {
70
71
  resolveOrderBookRows,
71
72
  resolveUnifiedOrderBookEntries,
72
73
  useEventTradingContext
73
- } from "./chunk-5PSAIGOT.mjs";
74
+ } from "./chunk-IBOE7DRY.mjs";
74
75
  import {
75
76
  GeoBlockBanner
76
- } from "./chunk-5MDFM2MX.mjs";
77
+ } from "./chunk-YSW4ULL5.mjs";
77
78
  import {
78
79
  AGG_DEFAULT_URL,
79
80
  AGG_DOCS_URL,
@@ -107,6 +108,7 @@ import {
107
108
  ChevronRightIcon,
108
109
  ChevronUpIcon,
109
110
  CircleOverlapIcon,
111
+ CircleXmarkIcon,
110
112
  CloseIcon,
111
113
  CopyButton,
112
114
  CopyIcon,
@@ -169,12 +171,14 @@ import {
169
171
  WalletIcon,
170
172
  WarningFilledIcon,
171
173
  WarningIcon,
174
+ __objRest,
172
175
  __spreadProps,
173
176
  __spreadValues,
174
177
  badgeSizes,
175
178
  cn,
176
179
  formatAmountDisplay,
177
180
  formatCompactUsd,
181
+ formatTokenAmount,
178
182
  formatUsd,
179
183
  getMotionClassName,
180
184
  getScrollBehavior,
@@ -185,9 +189,380 @@ import {
185
189
  skeletonViews,
186
190
  toDate,
187
191
  typographyVariants,
192
+ useOptionalToast,
188
193
  useToast,
189
194
  venueLogoNames
190
- } from "./chunk-QFW5NDJ6.mjs";
195
+ } from "./chunk-X3KCFWXN.mjs";
196
+
197
+ // src/notifications/agg-notification-events-provider.tsx
198
+ import {
199
+ useAggAuthState,
200
+ useAggLabels,
201
+ useAggUiConfig,
202
+ useOnOrderEvent,
203
+ useOnWithdrawalLifecycle,
204
+ useOptionalAggClient,
205
+ useUserActivity
206
+ } from "@agg-build/hooks";
207
+ import { useCallback, useEffect, useRef } from "react";
208
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
209
+ function AggNotificationEventsProvider({
210
+ children,
211
+ enabled = true,
212
+ depositActivityLimit = 25
213
+ }) {
214
+ const aggClient = useOptionalAggClient();
215
+ if (!aggClient) {
216
+ return /* @__PURE__ */ jsx(Fragment, { children });
217
+ }
218
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
219
+ /* @__PURE__ */ jsx(AggNotificationEventsBridge, { enabled, depositActivityLimit }),
220
+ children
221
+ ] });
222
+ }
223
+ var TERMINAL_ORDER_EVENTS = /* @__PURE__ */ new Set(["filled", "partial_fill", "failed"]);
224
+ var TERMINAL_WITHDRAWAL_STATUSES = /* @__PURE__ */ new Set([
225
+ "completed",
226
+ "partial",
227
+ "failed"
228
+ ]);
229
+ var isTerminalWithdrawalStatus = (value) => TERMINAL_WITHDRAWAL_STATUSES.has(value);
230
+ var MICRO_UNITS_SCALE = 1e6;
231
+ var formatScaledMicroAmount = (value) => {
232
+ if (!value) return void 0;
233
+ if (value.includes(".")) {
234
+ const parsed = Number(value);
235
+ if (!Number.isFinite(parsed)) return void 0;
236
+ return parsed.toLocaleString("en-US", { maximumFractionDigits: 2 });
237
+ }
238
+ try {
239
+ const raw = BigInt(value);
240
+ const whole = raw / BigInt(MICRO_UNITS_SCALE);
241
+ const remainder = raw % BigInt(MICRO_UNITS_SCALE);
242
+ const parsed = Number(whole) + Number(remainder) / MICRO_UNITS_SCALE;
243
+ return parsed.toLocaleString("en-US", { maximumFractionDigits: 2 });
244
+ } catch (e) {
245
+ const parsed = Number(value);
246
+ if (!Number.isFinite(parsed)) return void 0;
247
+ return (parsed / MICRO_UNITS_SCALE).toLocaleString("en-US", { maximumFractionDigits: 2 });
248
+ }
249
+ };
250
+ var formatDecimalAmount = (value) => {
251
+ if (!value) return void 0;
252
+ const parsed = Number(value.replace(/,/g, ""));
253
+ if (!Number.isFinite(parsed)) return value;
254
+ return parsed.toLocaleString("en-US", { maximumFractionDigits: 2 });
255
+ };
256
+ var formatPriceCents = (value) => {
257
+ if (!value) return void 0;
258
+ const parsed = Number(value);
259
+ if (!Number.isFinite(parsed)) return void 0;
260
+ const cents = parsed * 100;
261
+ const display = cents.toLocaleString("en-US", {
262
+ minimumFractionDigits: 0,
263
+ maximumFractionDigits: 1
264
+ });
265
+ return `${display}\xA2`;
266
+ };
267
+ var formatSharesLabel = (raw) => {
268
+ const formatted = formatScaledMicroAmount(raw);
269
+ if (!formatted) return void 0;
270
+ return `${formatted} shares`;
271
+ };
272
+ var capitalize = (value) => {
273
+ if (!value) return void 0;
274
+ return value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();
275
+ };
276
+ var venueLabelFor = (venueKey, labels) => {
277
+ var _a;
278
+ if (!venueKey) return void 0;
279
+ const normalized = venueKey.toLowerCase();
280
+ const lookup = labels.venues;
281
+ return (_a = lookup[normalized]) != null ? _a : capitalize(venueKey);
282
+ };
283
+ function AggNotificationEventsBridge({ enabled, depositActivityLimit }) {
284
+ var _a;
285
+ const toastCtx = useOptionalToast();
286
+ const { user, isAuthenticated } = useAggAuthState();
287
+ const labels = useAggLabels();
288
+ const { features } = useAggUiConfig();
289
+ const notificationsFeatureEnabled = features.enableNotifications !== false;
290
+ const effectivelyEnabled = enabled && notificationsFeatureEnabled;
291
+ const currentUserId = (_a = user == null ? void 0 : user.id) != null ? _a : null;
292
+ const firedKeysRef = useRef(/* @__PURE__ */ new Set());
293
+ const depositStatusesRef = useRef(/* @__PURE__ */ new Map());
294
+ const hasSeededDepositStatusesRef = useRef(false);
295
+ const recentClientDepositFingerprintsRef = useRef(/* @__PURE__ */ new Map());
296
+ const lastUserIdRef = useRef("uninitialized");
297
+ useEffect(() => {
298
+ if (lastUserIdRef.current === currentUserId) return;
299
+ lastUserIdRef.current = currentUserId;
300
+ firedKeysRef.current = /* @__PURE__ */ new Set();
301
+ depositStatusesRef.current = /* @__PURE__ */ new Map();
302
+ hasSeededDepositStatusesRef.current = false;
303
+ recentClientDepositFingerprintsRef.current = /* @__PURE__ */ new Map();
304
+ }, [currentUserId]);
305
+ const fireOnce = useCallback(
306
+ (key, tone, title, message, detail) => {
307
+ if (!effectivelyEnabled) return;
308
+ const toast = toastCtx == null ? void 0 : toastCtx.toast;
309
+ if (!toast) return;
310
+ if (firedKeysRef.current.has(key)) return;
311
+ firedKeysRef.current.add(key);
312
+ toast(message, { tone, title, detail });
313
+ },
314
+ [effectivelyEnabled, toastCtx]
315
+ );
316
+ const orderEventCallback = useCallback(
317
+ (event) => {
318
+ if (!effectivelyEnabled || !isAuthenticated) return;
319
+ if (!currentUserId || event.userId !== currentUserId) return;
320
+ if (!TERMINAL_ORDER_EVENTS.has(event.event)) return;
321
+ handleOrderEvent({ event, labels, fireOnce });
322
+ },
323
+ [currentUserId, effectivelyEnabled, fireOnce, isAuthenticated, labels]
324
+ );
325
+ useOnOrderEvent(orderEventCallback);
326
+ const withdrawalCallback = useCallback(
327
+ (event) => {
328
+ if (!effectivelyEnabled || !isAuthenticated) return;
329
+ if (!currentUserId || event.userId !== currentUserId) return;
330
+ if (!event.terminal) return;
331
+ if (!isTerminalWithdrawalStatus(event.status)) return;
332
+ handleWithdrawalEvent({ event, labels, fireOnce });
333
+ },
334
+ [currentUserId, effectivelyEnabled, fireOnce, isAuthenticated, labels]
335
+ );
336
+ useOnWithdrawalLifecycle(withdrawalCallback);
337
+ useEffect(() => {
338
+ if (!effectivelyEnabled || !isAuthenticated || !currentUserId) return;
339
+ return subscribeAggDepositNotification((event) => {
340
+ handleClientDepositNotification({
341
+ event,
342
+ labels,
343
+ fireOnce,
344
+ recentClientDepositFingerprints: recentClientDepositFingerprintsRef.current
345
+ });
346
+ });
347
+ }, [currentUserId, effectivelyEnabled, fireOnce, isAuthenticated, labels]);
348
+ const depositActivity = useUserActivity({
349
+ type: "deposit",
350
+ limit: depositActivityLimit,
351
+ enabled: effectivelyEnabled && isAuthenticated && currentUserId !== null
352
+ });
353
+ const depositActivities = depositActivity.activities;
354
+ useEffect(() => {
355
+ if (!effectivelyEnabled || !isAuthenticated || !currentUserId) return;
356
+ if (!depositActivity.isSuccess) return;
357
+ handleDepositActivities({
358
+ deposits: depositActivities,
359
+ previousStatuses: depositStatusesRef.current,
360
+ hasSeededStatuses: hasSeededDepositStatusesRef.current,
361
+ labels,
362
+ fireOnce,
363
+ shouldSuppressToast: (status, amountLabel, tokenLabel) => hasRecentClientDepositNotification({
364
+ recentClientDepositFingerprints: recentClientDepositFingerprintsRef.current,
365
+ status,
366
+ amountLabel,
367
+ tokenLabel
368
+ })
369
+ });
370
+ hasSeededDepositStatusesRef.current = true;
371
+ }, [
372
+ currentUserId,
373
+ depositActivities,
374
+ depositActivity.isSuccess,
375
+ effectivelyEnabled,
376
+ fireOnce,
377
+ isAuthenticated,
378
+ labels
379
+ ]);
380
+ return null;
381
+ }
382
+ function handleOrderEvent({ event, labels, fireOnce }) {
383
+ var _a, _b;
384
+ const venueLabel = venueLabelFor(event.venue, labels);
385
+ const amountLabel = formatSharesLabel((_a = event.actualSharesRaw) != null ? _a : event.filledAmountRaw);
386
+ const priceLabel = formatPriceCents((_b = event.executionPriceRaw) != null ? _b : event.quotedPriceRaw);
387
+ if (event.event === "filled") {
388
+ fireOnce(
389
+ `order:${event.orderId}:filled`,
390
+ "success",
391
+ labels.notifications.order.filledTitle,
392
+ labels.notifications.order.filledMessage({ venueLabel, amountLabel, priceLabel })
393
+ );
394
+ return;
395
+ }
396
+ if (event.event === "partial_fill") {
397
+ fireOnce(
398
+ `order:${event.orderId}:partial_fill`,
399
+ "warning",
400
+ labels.notifications.order.partialFilledTitle,
401
+ labels.notifications.order.partialFilledMessage({ venueLabel, amountLabel, priceLabel })
402
+ );
403
+ return;
404
+ }
405
+ if (event.event === "failed") {
406
+ fireOnce(
407
+ `order:${event.orderId}:failed`,
408
+ "error",
409
+ labels.notifications.order.failedTitle,
410
+ labels.notifications.order.failedMessage(event.errorReason),
411
+ venueLabel
412
+ );
413
+ }
414
+ }
415
+ function handleWithdrawalEvent({ event, labels, fireOnce }) {
416
+ var _a;
417
+ const amountLabel = formatScaledMicroAmount((_a = event.completedAmountRaw) != null ? _a : event.requestedAmountRaw);
418
+ if (event.status === "completed") {
419
+ fireOnce(
420
+ `withdrawal:${event.withdrawalId}:completed`,
421
+ "success",
422
+ labels.notifications.withdrawal.completedTitle,
423
+ labels.notifications.withdrawal.completedMessage({ amountLabel })
424
+ );
425
+ return;
426
+ }
427
+ if (event.status === "partial") {
428
+ fireOnce(
429
+ `withdrawal:${event.withdrawalId}:partial`,
430
+ "warning",
431
+ labels.notifications.withdrawal.partialTitle,
432
+ labels.notifications.withdrawal.partialMessage({ amountLabel })
433
+ );
434
+ return;
435
+ }
436
+ if (event.status === "failed") {
437
+ fireOnce(
438
+ `withdrawal:${event.withdrawalId}:failed`,
439
+ "error",
440
+ labels.notifications.withdrawal.failedTitle,
441
+ labels.notifications.withdrawal.failedMessage(event.errorMessage)
442
+ );
443
+ }
444
+ }
445
+ var DEPOSIT_COMPLETED_STATUSES = /* @__PURE__ */ new Set(["completed", "confirmed", "succeeded", "success"]);
446
+ var DEPOSIT_FAILED_STATUSES = /* @__PURE__ */ new Set(["failed", "errored", "rejected"]);
447
+ var CLIENT_DEPOSIT_ACTIVITY_SUPPRESSION_MS = 2 * 60 * 1e3;
448
+ var isTerminalDepositStatus = (status) => DEPOSIT_COMPLETED_STATUSES.has(status) || DEPOSIT_FAILED_STATUSES.has(status);
449
+ var getDepositNotificationFingerprint = ({
450
+ status,
451
+ amountLabel,
452
+ tokenLabel
453
+ }) => `${status}:${amountLabel != null ? amountLabel : ""}:${tokenLabel != null ? tokenLabel : ""}`.toLowerCase();
454
+ var hasRecentClientDepositNotification = ({
455
+ recentClientDepositFingerprints,
456
+ status,
457
+ amountLabel,
458
+ tokenLabel
459
+ }) => {
460
+ const fingerprint = getDepositNotificationFingerprint({ status, amountLabel, tokenLabel });
461
+ const lastNotifiedAt = recentClientDepositFingerprints.get(fingerprint);
462
+ if (!lastNotifiedAt) return false;
463
+ if (Date.now() - lastNotifiedAt <= CLIENT_DEPOSIT_ACTIVITY_SUPPRESSION_MS) {
464
+ return true;
465
+ }
466
+ recentClientDepositFingerprints.delete(fingerprint);
467
+ return false;
468
+ };
469
+ function handleClientDepositNotification({
470
+ event,
471
+ labels,
472
+ fireOnce,
473
+ recentClientDepositFingerprints
474
+ }) {
475
+ var _a, _b, _c;
476
+ const amountLabel = formatDecimalAmount(event.amount);
477
+ const tokenLabel = event.tokenSymbol;
478
+ const fingerprint = getDepositNotificationFingerprint({
479
+ status: event.status,
480
+ amountLabel,
481
+ tokenLabel
482
+ });
483
+ recentClientDepositFingerprints.set(fingerprint, Date.now());
484
+ if (event.status === "completed") {
485
+ fireOnce(
486
+ `deposit-client:${(_a = event.id) != null ? _a : fingerprint}:completed`,
487
+ "success",
488
+ labels.notifications.deposit.completedTitle,
489
+ labels.notifications.deposit.completedMessage({ amountLabel, tokenLabel })
490
+ );
491
+ return;
492
+ }
493
+ fireOnce(
494
+ `deposit-client:${(_b = event.id) != null ? _b : fingerprint}:failed`,
495
+ "error",
496
+ labels.notifications.deposit.failedTitle,
497
+ (_c = event.errorMessage) != null ? _c : labels.notifications.deposit.failedMessage({ amountLabel, tokenLabel })
498
+ );
499
+ }
500
+ function handleDepositActivities({
501
+ deposits,
502
+ previousStatuses,
503
+ hasSeededStatuses,
504
+ labels,
505
+ fireOnce,
506
+ shouldSuppressToast
507
+ }) {
508
+ for (const item of deposits) {
509
+ if (item.type !== "deposit") continue;
510
+ const deposit = item;
511
+ const status = deposit.status.toLowerCase();
512
+ const isCompleted = DEPOSIT_COMPLETED_STATUSES.has(status);
513
+ const isFailed = DEPOSIT_FAILED_STATUSES.has(status);
514
+ const previousStatus = previousStatuses.get(deposit.id);
515
+ previousStatuses.set(deposit.id, status);
516
+ if (!hasSeededStatuses) continue;
517
+ if (!previousStatus) continue;
518
+ if (isTerminalDepositStatus(previousStatus)) continue;
519
+ if (!isCompleted && !isFailed) continue;
520
+ const amountLabel = formatScaledMicroAmount(deposit.amountRaw);
521
+ const tokenLabel = deposit.tokenSymbol;
522
+ const terminalStatus = isCompleted ? "completed" : "failed";
523
+ if (shouldSuppressToast == null ? void 0 : shouldSuppressToast(terminalStatus, amountLabel, tokenLabel)) continue;
524
+ if (isCompleted) {
525
+ fireOnce(
526
+ `deposit:${deposit.id}:completed`,
527
+ "success",
528
+ labels.notifications.deposit.completedTitle,
529
+ labels.notifications.deposit.completedMessage({ amountLabel, tokenLabel })
530
+ );
531
+ } else {
532
+ fireOnce(
533
+ `deposit:${deposit.id}:failed`,
534
+ "error",
535
+ labels.notifications.deposit.failedTitle,
536
+ labels.notifications.deposit.failedMessage({ amountLabel, tokenLabel })
537
+ );
538
+ }
539
+ }
540
+ }
541
+
542
+ // src/notifications/agg-toast-provider.tsx
543
+ import { jsx as jsx2 } from "react/jsx-runtime";
544
+ function AggToastProvider(_a) {
545
+ var _b = _a, {
546
+ children,
547
+ disableAggNotifications = false,
548
+ notificationDepositActivityLimit
549
+ } = _b, toastProps = __objRest(_b, [
550
+ "children",
551
+ "disableAggNotifications",
552
+ "notificationDepositActivityLimit"
553
+ ]);
554
+ return /* @__PURE__ */ jsx2(ToastProvider, __spreadProps(__spreadValues({}, toastProps), { children: disableAggNotifications ? children : /* @__PURE__ */ jsx2(AggNotificationEventsProvider, { depositActivityLimit: notificationDepositActivityLimit, children }) }));
555
+ }
556
+
557
+ // src/agg-provider.tsx
558
+ import {
559
+ AggProvider as AggSdkProvider
560
+ } from "@agg-build/hooks";
561
+ import { jsx as jsx3 } from "react/jsx-runtime";
562
+ function AggProvider(_a) {
563
+ var _b = _a, { children, toast } = _b, providerProps = __objRest(_b, ["children", "toast"]);
564
+ return /* @__PURE__ */ jsx3(AggSdkProvider, __spreadProps(__spreadValues({}, providerProps), { children: /* @__PURE__ */ jsx3(AggToastProvider, __spreadProps(__spreadValues({}, toast), { children })) }));
565
+ }
191
566
 
192
567
  // src/auth/connect-button-view/index.tsx
193
568
  import { optimizedImageUrl, useAggAuthContext, useLabels, useSdkUiConfig } from "@agg-build/hooks";
@@ -266,11 +641,11 @@ var avatarRootClassName = cn(
266
641
  var avatarIconClassName = cn("h-[66%] w-[66%] text-agg-muted-foreground");
267
642
 
268
643
  // src/auth/connect-button-view/index.tsx
269
- import { jsx, jsxs } from "react/jsx-runtime";
644
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
270
645
  var WalletAvatar = ({ className }) => {
271
646
  const { isAuthenticated, user } = useAggAuthContext();
272
647
  if (isAuthenticated && (user == null ? void 0 : user.avatarUrl)) {
273
- return /* @__PURE__ */ jsx(
648
+ return /* @__PURE__ */ jsx4(
274
649
  "img",
275
650
  {
276
651
  src: optimizedImageUrl(user.avatarUrl, 44),
@@ -279,7 +654,7 @@ var WalletAvatar = ({ className }) => {
279
654
  }
280
655
  );
281
656
  }
282
- return /* @__PURE__ */ jsx(DefaultAvatar, { className: cn("size-6 shrink-0 rounded-full", className) });
657
+ return /* @__PURE__ */ jsx4(DefaultAvatar, { className: cn("size-6 shrink-0 rounded-full", className) });
283
658
  };
284
659
  var AuthMethodActionButton = ({
285
660
  activeMethodId,
@@ -293,7 +668,7 @@ var AuthMethodActionButton = ({
293
668
  const labels = useLabels();
294
669
  const isMethodLoading = activeMethodId === method.id;
295
670
  const isMethodDisabled = disabled || !method.isAvailable || activeMethodId !== null && !isMethodLoading;
296
- return /* @__PURE__ */ jsxs(
671
+ return /* @__PURE__ */ jsxs2(
297
672
  "button",
298
673
  {
299
674
  type: "button",
@@ -303,7 +678,7 @@ var AuthMethodActionButton = ({
303
678
  "aria-label": labels.auth.signInWithMethod(method.label),
304
679
  onClick: () => onSelect(method.id),
305
680
  children: [
306
- isMethodLoading ? /* @__PURE__ */ jsx(LoadingIcon, { size: "small" }) : /* @__PURE__ */ jsx(
681
+ isMethodLoading ? /* @__PURE__ */ jsx4(LoadingIcon, { size: "small" }) : /* @__PURE__ */ jsx4(
307
682
  Icon,
308
683
  {
309
684
  name: (_a = method.iconName) != null ? _a : "profile",
@@ -312,7 +687,7 @@ var AuthMethodActionButton = ({
312
687
  title: renderLabel ? void 0 : method.label
313
688
  }
314
689
  ),
315
- renderLabel ? /* @__PURE__ */ jsx("span", { children: labels.auth.connect(method.label) }) : null
690
+ renderLabel ? /* @__PURE__ */ jsx4("span", { children: labels.auth.connect(method.label) }) : null
316
691
  ]
317
692
  }
318
693
  );
@@ -341,8 +716,8 @@ var UnauthenticatedConnectView = ({
341
716
  const labels = useLabels();
342
717
  const hasConfiguredMethods = emailMethod !== null || socialMethods.length > 0 || walletMethods.length > 0;
343
718
  const showWalletDivider = walletMethods.length > 0 && (emailMethod !== null || socialMethods.length > 0);
344
- return /* @__PURE__ */ jsxs("div", { className: cn(connectButtonContainerClassName, classNames == null ? void 0 : classNames.root), children: [
345
- /* @__PURE__ */ jsx(
719
+ return /* @__PURE__ */ jsxs2("div", { className: cn(connectButtonContainerClassName, classNames == null ? void 0 : classNames.root), children: [
720
+ /* @__PURE__ */ jsx4(
346
721
  Button,
347
722
  __spreadProps(__spreadValues({
348
723
  variant: "primary",
@@ -355,8 +730,8 @@ var UnauthenticatedConnectView = ({
355
730
  children: labels.auth.connect()
356
731
  })
357
732
  ),
358
- notice ? /* @__PURE__ */ jsx("p", { className: cn(authNoticeClassName, classNames == null ? void 0 : classNames.authNotice), children: notice }) : null,
359
- /* @__PURE__ */ jsx(Modal, { open: isChooserOpen || !!challengeContent, onOpenChange: onChooserOpenChange, children: /* @__PURE__ */ jsxs(
733
+ notice ? /* @__PURE__ */ jsx4("p", { className: cn(authNoticeClassName, classNames == null ? void 0 : classNames.authNotice), children: notice }) : null,
734
+ /* @__PURE__ */ jsx4(Modal, { open: isChooserOpen || !!challengeContent, onOpenChange: onChooserOpenChange, children: /* @__PURE__ */ jsxs2(
360
735
  Modal.Container,
361
736
  {
362
737
  maxWidth: "400px",
@@ -365,7 +740,7 @@ var UnauthenticatedConnectView = ({
365
740
  },
366
741
  "aria-label": challengeContent ? "Security Check" : labels.auth.signIn,
367
742
  children: [
368
- /* @__PURE__ */ jsx(
743
+ /* @__PURE__ */ jsx4(
369
744
  Modal.Header,
370
745
  {
371
746
  title: challengeContent ? "Security Check" : labels.auth.signIn,
@@ -377,8 +752,8 @@ var UnauthenticatedConnectView = ({
377
752
  }
378
753
  }
379
754
  ),
380
- /* @__PURE__ */ jsx(Modal.Body, { classNames: { root: authModalBodyClassName }, children: challengeContent ? challengeContent : /* @__PURE__ */ jsxs("div", { className: authMethodsListClassName, children: [
381
- emailMethod ? /* @__PURE__ */ jsxs(
755
+ /* @__PURE__ */ jsx4(Modal.Body, { classNames: { root: authModalBodyClassName }, children: challengeContent ? challengeContent : /* @__PURE__ */ jsxs2("div", { className: authMethodsListClassName, children: [
756
+ emailMethod ? /* @__PURE__ */ jsxs2(
382
757
  "form",
383
758
  {
384
759
  className: authSectionClassName,
@@ -387,8 +762,8 @@ var UnauthenticatedConnectView = ({
387
762
  onEmailSubmit();
388
763
  },
389
764
  children: [
390
- /* @__PURE__ */ jsxs("div", { className: authInputFormClassName, children: [
391
- /* @__PURE__ */ jsx(
765
+ /* @__PURE__ */ jsxs2("div", { className: authInputFormClassName, children: [
766
+ /* @__PURE__ */ jsx4(
392
767
  "input",
393
768
  {
394
769
  id: "agg-auth-email",
@@ -401,7 +776,7 @@ var UnauthenticatedConnectView = ({
401
776
  disabled: disabled || isBusy || !emailMethod.isAvailable
402
777
  }
403
778
  ),
404
- /* @__PURE__ */ jsx(
779
+ /* @__PURE__ */ jsx4(
405
780
  Button,
406
781
  {
407
782
  type: "submit",
@@ -414,8 +789,8 @@ var UnauthenticatedConnectView = ({
414
789
  }
415
790
  )
416
791
  ] }),
417
- emailMethod.isAvailable && ((_e = emailMethod.input) == null ? void 0 : _e.helperText) ? /* @__PURE__ */ jsx("p", { className: cn(authNoticeClassName, classNames == null ? void 0 : classNames.authNotice), children: emailMethod.input.helperText }) : null,
418
- !emailMethod.isAvailable ? /* @__PURE__ */ jsx(
792
+ emailMethod.isAvailable && ((_e = emailMethod.input) == null ? void 0 : _e.helperText) ? /* @__PURE__ */ jsx4("p", { className: cn(authNoticeClassName, classNames == null ? void 0 : classNames.authNotice), children: emailMethod.input.helperText }) : null,
793
+ !emailMethod.isAvailable ? /* @__PURE__ */ jsx4(
419
794
  InlineAlert,
420
795
  {
421
796
  tone: "warning",
@@ -424,7 +799,7 @@ var UnauthenticatedConnectView = ({
424
799
  className: classNames == null ? void 0 : classNames.authError
425
800
  }
426
801
  ) : null,
427
- emailError ? /* @__PURE__ */ jsx(
802
+ emailError ? /* @__PURE__ */ jsx4(
428
803
  InlineAlert,
429
804
  {
430
805
  tone: "error",
@@ -435,8 +810,8 @@ var UnauthenticatedConnectView = ({
435
810
  ]
436
811
  }
437
812
  ) : null,
438
- socialMethods.length > 0 ? /* @__PURE__ */ jsxs("div", { className: authSectionClassName, children: [
439
- /* @__PURE__ */ jsx("div", { className: cn(authMethodGridClassName, classNames == null ? void 0 : classNames.authMethodGrid), children: socialMethods.map((method) => /* @__PURE__ */ jsx(
813
+ socialMethods.length > 0 ? /* @__PURE__ */ jsxs2("div", { className: authSectionClassName, children: [
814
+ /* @__PURE__ */ jsx4("div", { className: cn(authMethodGridClassName, classNames == null ? void 0 : classNames.authMethodGrid), children: socialMethods.map((method) => /* @__PURE__ */ jsx4(
440
815
  AuthMethodActionButton,
441
816
  {
442
817
  activeMethodId,
@@ -448,18 +823,18 @@ var UnauthenticatedConnectView = ({
448
823
  },
449
824
  method.id
450
825
  )) }),
451
- /* @__PURE__ */ jsxs("p", { className: authHelperTextClassName, children: [
826
+ /* @__PURE__ */ jsxs2("p", { className: authHelperTextClassName, children: [
452
827
  labels.auth.socialWalletNotice,
453
828
  " ",
454
- /* @__PURE__ */ jsx("span", { className: cn(authHelperLinkClassName, classNames == null ? void 0 : classNames.authHelperLink), children: labels.auth.learnMore })
829
+ /* @__PURE__ */ jsx4("span", { className: cn(authHelperLinkClassName, classNames == null ? void 0 : classNames.authHelperLink), children: labels.auth.learnMore })
455
830
  ] })
456
831
  ] }) : null,
457
- showWalletDivider ? /* @__PURE__ */ jsxs("div", { className: authDividerClassName, children: [
458
- /* @__PURE__ */ jsx("div", { className: authDividerLineClassName }),
459
- /* @__PURE__ */ jsx("span", { className: authDividerLabelClassName, children: labels.auth.dividerOr }),
460
- /* @__PURE__ */ jsx("div", { className: authDividerLineClassName })
832
+ showWalletDivider ? /* @__PURE__ */ jsxs2("div", { className: authDividerClassName, children: [
833
+ /* @__PURE__ */ jsx4("div", { className: authDividerLineClassName }),
834
+ /* @__PURE__ */ jsx4("span", { className: authDividerLabelClassName, children: labels.auth.dividerOr }),
835
+ /* @__PURE__ */ jsx4("div", { className: authDividerLineClassName })
461
836
  ] }) : null,
462
- walletMethods.length > 0 ? /* @__PURE__ */ jsx("div", { className: authSectionClassName, children: /* @__PURE__ */ jsx("div", { className: cn(authWalletMethodGridClassName, classNames == null ? void 0 : classNames.authMethodGrid), children: walletMethods.map((method) => /* @__PURE__ */ jsx(
837
+ walletMethods.length > 0 ? /* @__PURE__ */ jsx4("div", { className: authSectionClassName, children: /* @__PURE__ */ jsx4("div", { className: cn(authWalletMethodGridClassName, classNames == null ? void 0 : classNames.authMethodGrid), children: walletMethods.map((method) => /* @__PURE__ */ jsx4(
463
838
  AuthMethodActionButton,
464
839
  {
465
840
  activeMethodId,
@@ -470,10 +845,10 @@ var UnauthenticatedConnectView = ({
470
845
  },
471
846
  method.id
472
847
  )) }) }) : null,
473
- /* @__PURE__ */ jsxs("p", { className: authLegalTextClassName, children: [
848
+ /* @__PURE__ */ jsxs2("p", { className: authLegalTextClassName, children: [
474
849
  labels.auth.legalNoticePrefix,
475
850
  " ",
476
- /* @__PURE__ */ jsx(
851
+ /* @__PURE__ */ jsx4(
477
852
  "a",
478
853
  {
479
854
  className: cn(authHelperLinkClassName, classNames == null ? void 0 : classNames.authHelperLink),
@@ -486,7 +861,7 @@ var UnauthenticatedConnectView = ({
486
861
  " ",
487
862
  labels.auth.legalNoticeSeparator,
488
863
  " ",
489
- /* @__PURE__ */ jsx(
864
+ /* @__PURE__ */ jsx4(
490
865
  "a",
491
866
  {
492
867
  className: cn(authHelperLinkClassName, classNames == null ? void 0 : classNames.authHelperLink),
@@ -498,7 +873,7 @@ var UnauthenticatedConnectView = ({
498
873
  ),
499
874
  "."
500
875
  ] }),
501
- errorMessage ? /* @__PURE__ */ jsx(
876
+ errorMessage ? /* @__PURE__ */ jsx4(
502
877
  InlineAlert,
503
878
  {
504
879
  tone: "error",
@@ -573,7 +948,7 @@ var AuthConnectButtonView = ({
573
948
  classNames == null ? void 0 : classNames.profileMenuActionItem
574
949
  );
575
950
  if (!isAuthenticated) {
576
- return /* @__PURE__ */ jsx(
951
+ return /* @__PURE__ */ jsx4(
577
952
  UnauthenticatedConnectView,
578
953
  {
579
954
  activeMethodId,
@@ -597,21 +972,21 @@ var AuthConnectButtonView = ({
597
972
  }
598
973
  );
599
974
  }
600
- return /* @__PURE__ */ jsx("div", { className: cn(connectButtonContainerClassName, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ jsxs("div", { className: cn(connectedButtonsRowClassName, classNames == null ? void 0 : classNames.connectedRow), children: [
601
- /* @__PURE__ */ jsxs("div", { className: cn(connectedBalanceChipClassName, classNames == null ? void 0 : classNames.balanceChip), children: [
602
- /* @__PURE__ */ jsx("div", { className: "hidden lg:inline-flex", children: /* @__PURE__ */ jsx(
975
+ return /* @__PURE__ */ jsx4("div", { className: cn(connectButtonContainerClassName, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ jsxs2("div", { className: cn(connectedButtonsRowClassName, classNames == null ? void 0 : classNames.connectedRow), children: [
976
+ /* @__PURE__ */ jsxs2("div", { className: cn(connectedBalanceChipClassName, classNames == null ? void 0 : classNames.balanceChip), children: [
977
+ /* @__PURE__ */ jsx4("div", { className: "hidden lg:inline-flex", children: /* @__PURE__ */ jsx4(
603
978
  ConditionalWrapper,
604
979
  {
605
980
  condition: isDepositBlocked,
606
- wrapper: (children) => /* @__PURE__ */ jsx(
981
+ wrapper: (children) => /* @__PURE__ */ jsx4(
607
982
  Tooltip,
608
983
  {
609
- content: /* @__PURE__ */ jsx("p", { className: "text-center", children: labels.auth.depositGeoBlocked }),
984
+ content: /* @__PURE__ */ jsx4("p", { className: "text-center", children: labels.auth.depositGeoBlocked }),
610
985
  sideOffset: 4,
611
986
  children
612
987
  }
613
988
  ),
614
- children: /* @__PURE__ */ jsx(
989
+ children: /* @__PURE__ */ jsx4(
615
990
  Button,
616
991
  __spreadProps(__spreadValues({
617
992
  variant: "primary",
@@ -624,61 +999,61 @@ var AuthConnectButtonView = ({
624
999
  )
625
1000
  }
626
1001
  ) }),
627
- /* @__PURE__ */ jsx(
628
- ConditionalWrapper,
629
- {
630
- condition: claimReadyCount > 0,
631
- wrapper: (children) => /* @__PURE__ */ jsx(
632
- Tooltip,
633
- {
634
- size: "medium",
635
- content: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
636
- /* @__PURE__ */ jsx("p", { children: resolveClaimTooltipLabel(claimReadyCount) }),
637
- onClaimWinningsClick ? /* @__PURE__ */ jsxs(
638
- "button",
639
- {
640
- type: "button",
641
- className: "inline-flex cursor-pointer items-center gap-1.5 font-agg-bold text-agg-primary hover:text-agg-primary-hover",
642
- onClick: onClaimWinningsClick,
643
- children: [
644
- claimWinningsLabel,
645
- /* @__PURE__ */ jsx(
646
- Icon,
647
- {
648
- name: "arrow-right",
649
- size: "small",
650
- className: "h-3.5 w-3.5 text-agg-primary",
651
- "aria-hidden": true
652
- }
653
- )
654
- ]
655
- }
656
- ) : null
657
- ] }),
658
- children
659
- }
660
- ),
661
- children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
662
- /* @__PURE__ */ jsx("span", { className: "h-3.5 w-3.5 shrink-0 [&_svg]:h-full [&_svg]:w-full", children: /* @__PURE__ */ jsx(Icon, { name: "activity-chart", size: "small", className: "text-agg-muted-foreground" }) }),
663
- /* @__PURE__ */ jsx("p", { className: cn("agg-type-label text-agg-foreground", classNames == null ? void 0 : classNames.positionsText), children: isBalanceLoading ? /* @__PURE__ */ jsx(LoadingIcon, { size: "small" }) : formatUsd(positionsBalance) }),
664
- claimReadyCount > 0 ? /* @__PURE__ */ jsx(
1002
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
1003
+ /* @__PURE__ */ jsx4("span", { className: "h-3.5 w-3.5 shrink-0 [&_svg]:h-full [&_svg]:w-full", children: /* @__PURE__ */ jsx4(Icon, { name: "activity-chart", size: "small", className: "text-agg-muted-foreground" }) }),
1004
+ /* @__PURE__ */ jsx4("p", { className: cn("agg-type-label text-agg-foreground", classNames == null ? void 0 : classNames.positionsText), children: isBalanceLoading ? /* @__PURE__ */ jsx4(LoadingIcon, { size: "small" }) : formatUsd(positionsBalance) }),
1005
+ claimReadyCount > 0 ? /* @__PURE__ */ jsx4(
1006
+ Tooltip,
1007
+ {
1008
+ size: "medium",
1009
+ classNames: { content: "px-5 py-4" },
1010
+ content: /* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center gap-2", children: [
1011
+ /* @__PURE__ */ jsx4("p", { children: resolveClaimTooltipLabel(claimReadyCount) }),
1012
+ onClaimWinningsClick ? /* @__PURE__ */ jsxs2(
1013
+ "button",
1014
+ {
1015
+ type: "button",
1016
+ className: "inline-flex cursor-pointer items-center gap-1.5 font-agg-bold text-agg-primary hover:text-agg-primary-hover",
1017
+ onClick: onClaimWinningsClick,
1018
+ children: [
1019
+ claimWinningsLabel,
1020
+ /* @__PURE__ */ jsx4(
1021
+ Icon,
1022
+ {
1023
+ name: "arrow-right",
1024
+ size: "small",
1025
+ className: "h-3.5 w-3.5 text-agg-primary",
1026
+ "aria-hidden": true
1027
+ }
1028
+ )
1029
+ ]
1030
+ }
1031
+ ) : null
1032
+ ] }),
1033
+ children: /* @__PURE__ */ jsx4(
665
1034
  "span",
666
1035
  {
667
- className: "inline-flex size-4 shrink-0 items-center justify-center rounded-full bg-linear-to-r from-agg-primary to-agg-primary-hover text-2.5 leading-3.5 font-agg-bold text-agg-foreground uppercase",
1036
+ className: cn(
1037
+ "agg-claim-badge agg-type-overline",
1038
+ "inline-flex items-center justify-center rounded-full leading-none",
1039
+ "bg-linear-to-r from-agg-primary to-agg-primary-hover",
1040
+ "shrink-0 px-0.5 min-w-4 h-4 text-agg-on-primary text-center",
1041
+ "cursor-pointer"
1042
+ ),
668
1043
  "aria-label": resolveClaimBadgeAriaLabel(claimReadyCount),
669
1044
  children: claimReadyCount
670
1045
  }
671
- ) : null
672
- ] })
673
- }
674
- ),
675
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
676
- /* @__PURE__ */ jsx("span", { className: "h-3.5 w-3.5 shrink-0 [&_svg]:h-full [&_svg]:w-full", children: /* @__PURE__ */ jsx(Icon, { name: "wallet-filled", size: "small", className: "text-agg-muted-foreground" }) }),
677
- /* @__PURE__ */ jsx("p", { className: cn("agg-type-label text-agg-foreground", classNames == null ? void 0 : classNames.balanceText), children: isBalanceLoading ? /* @__PURE__ */ jsx(LoadingIcon, { size: "small" }) : formatUsd(totalBalance) })
1046
+ )
1047
+ }
1048
+ ) : null
1049
+ ] }),
1050
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
1051
+ /* @__PURE__ */ jsx4("span", { className: "h-3.5 w-3.5 shrink-0 [&_svg]:h-full [&_svg]:w-full", children: /* @__PURE__ */ jsx4(Icon, { name: "wallet-filled", size: "small", className: "text-agg-muted-foreground" }) }),
1052
+ /* @__PURE__ */ jsx4("p", { className: cn("agg-type-label text-agg-foreground", classNames == null ? void 0 : classNames.balanceText), children: isBalanceLoading ? /* @__PURE__ */ jsx4(LoadingIcon, { size: "small" }) : formatUsd(totalBalance) })
678
1053
  ] })
679
1054
  ] }),
680
- /* @__PURE__ */ jsxs(DropdownMenu.Root, { open: isProfileMenuOpen, onOpenChange: onProfileMenuOpenChange, children: [
681
- /* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(
1055
+ /* @__PURE__ */ jsxs2(DropdownMenu.Root, { open: isProfileMenuOpen, onOpenChange: onProfileMenuOpenChange, children: [
1056
+ /* @__PURE__ */ jsx4(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs2(
682
1057
  "button",
683
1058
  {
684
1059
  type: "button",
@@ -696,8 +1071,8 @@ var AuthConnectButtonView = ({
696
1071
  disabled,
697
1072
  "aria-label": labels.auth.walletMenuFor(resolvedProfileLabel),
698
1073
  children: [
699
- /* @__PURE__ */ jsx(WalletAvatar, { className: "size-5! md:size-6!" }),
700
- /* @__PURE__ */ jsx(
1074
+ /* @__PURE__ */ jsx4(WalletAvatar, { className: "size-5! md:size-6!" }),
1075
+ /* @__PURE__ */ jsx4(
701
1076
  Typography,
702
1077
  {
703
1078
  variant: "body-strong",
@@ -708,7 +1083,7 @@ var AuthConnectButtonView = ({
708
1083
  children: resolvedProfileLabel
709
1084
  }
710
1085
  ),
711
- /* @__PURE__ */ jsx(
1086
+ /* @__PURE__ */ jsx4(
712
1087
  Icon,
713
1088
  {
714
1089
  name: isProfileMenuOpen ? "chevron-up" : "chevron-down",
@@ -720,14 +1095,14 @@ var AuthConnectButtonView = ({
720
1095
  ]
721
1096
  }
722
1097
  ) }),
723
- /* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx(
1098
+ /* @__PURE__ */ jsx4(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx4(
724
1099
  DropdownMenu.Content,
725
1100
  {
726
1101
  className: cn(AGG_ROOT_CLASS_NAME, rootClassName, "z-50 outline-none"),
727
1102
  "data-agg-animations": enableAnimations ? "true" : "false",
728
1103
  sideOffset: 4,
729
1104
  align: "end",
730
- children: /* @__PURE__ */ jsxs(
1105
+ children: /* @__PURE__ */ jsxs2(
731
1106
  "div",
732
1107
  {
733
1108
  className: cn(
@@ -737,7 +1112,7 @@ var AuthConnectButtonView = ({
737
1112
  classNames == null ? void 0 : classNames.profileMenuContent
738
1113
  ),
739
1114
  children: [
740
- /* @__PURE__ */ jsxs(
1115
+ /* @__PURE__ */ jsxs2(
741
1116
  "button",
742
1117
  {
743
1118
  type: "button",
@@ -755,15 +1130,15 @@ var AuthConnectButtonView = ({
755
1130
  },
756
1131
  disabled,
757
1132
  children: [
758
- /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-row items-center justify-between gap-3", children: [
759
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [
760
- /* @__PURE__ */ jsx(WalletAvatar, { className: "size-11" }),
761
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col items-start justify-start gap-0.5", children: [
762
- /* @__PURE__ */ jsx("p", { className: "w-full text-agg-lg font-agg-bold leading-agg-7 text-agg-foreground text-left", children: resolvedProfileLabel }),
763
- addressLabel ? /* @__PURE__ */ jsx("p", { className: "w-full text-agg-sm font-agg-normal leading-agg-5 text-agg-muted-foreground text-left", children: addressLabel }) : null
1133
+ /* @__PURE__ */ jsxs2("div", { className: "flex w-full flex-row items-center justify-between gap-3", children: [
1134
+ /* @__PURE__ */ jsxs2("div", { className: "flex min-w-0 items-center gap-3", children: [
1135
+ /* @__PURE__ */ jsx4(WalletAvatar, { className: "size-11" }),
1136
+ /* @__PURE__ */ jsxs2("div", { className: "flex min-w-0 flex-col items-start justify-start gap-0.5", children: [
1137
+ /* @__PURE__ */ jsx4("p", { className: "w-full text-agg-lg font-agg-bold leading-agg-7 text-agg-foreground text-left", children: resolvedProfileLabel }),
1138
+ addressLabel ? /* @__PURE__ */ jsx4("p", { className: "w-full text-agg-sm font-agg-normal leading-agg-5 text-agg-muted-foreground text-left", children: addressLabel }) : null
764
1139
  ] })
765
1140
  ] }),
766
- /* @__PURE__ */ jsx(
1141
+ /* @__PURE__ */ jsx4(
767
1142
  Icon,
768
1143
  {
769
1144
  name: "arrow-right",
@@ -773,10 +1148,10 @@ var AuthConnectButtonView = ({
773
1148
  }
774
1149
  )
775
1150
  ] }),
776
- /* @__PURE__ */ jsxs("div", { className: "md:hidden flex w-full items-start gap-5", children: [
777
- /* @__PURE__ */ jsxs("div", { className: "flex flex-1 min-w-0 flex-col gap-2", children: [
778
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
779
- /* @__PURE__ */ jsx(
1151
+ /* @__PURE__ */ jsxs2("div", { className: "md:hidden flex w-full items-start gap-5", children: [
1152
+ /* @__PURE__ */ jsxs2("div", { className: "flex flex-1 min-w-0 flex-col gap-2", children: [
1153
+ /* @__PURE__ */ jsxs2("div", { className: "flex min-w-0 items-center gap-2", children: [
1154
+ /* @__PURE__ */ jsx4(
780
1155
  Icon,
781
1156
  {
782
1157
  name: "wallet-filled",
@@ -784,13 +1159,13 @@ var AuthConnectButtonView = ({
784
1159
  className: "h-4 w-4 shrink-0 text-agg-muted-foreground"
785
1160
  }
786
1161
  ),
787
- /* @__PURE__ */ jsx("span", { className: "truncate text-agg-sm leading-agg-5 text-agg-foreground", children: "Withdrawable Balance" })
1162
+ /* @__PURE__ */ jsx4("span", { className: "truncate text-agg-sm leading-agg-5 text-agg-foreground", children: "Withdrawable Balance" })
788
1163
  ] }),
789
- /* @__PURE__ */ jsx("p", { className: "text-agg-lg font-agg-bold leading-agg-7 text-agg-foreground text-left", children: isBalanceLoading ? /* @__PURE__ */ jsx(LoadingIcon, { size: "small" }) : formatUsd(totalBalance) })
1164
+ /* @__PURE__ */ jsx4("p", { className: "text-agg-lg font-agg-bold leading-agg-7 text-agg-foreground text-left", children: isBalanceLoading ? /* @__PURE__ */ jsx4(LoadingIcon, { size: "small" }) : formatUsd(totalBalance) })
790
1165
  ] }),
791
- /* @__PURE__ */ jsxs("div", { className: "flex flex-1 min-w-0 flex-col gap-2", children: [
792
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
793
- /* @__PURE__ */ jsx(
1166
+ /* @__PURE__ */ jsxs2("div", { className: "flex flex-1 min-w-0 flex-col gap-2", children: [
1167
+ /* @__PURE__ */ jsxs2("div", { className: "flex min-w-0 items-center gap-2", children: [
1168
+ /* @__PURE__ */ jsx4(
794
1169
  Icon,
795
1170
  {
796
1171
  name: "activity-chart",
@@ -798,85 +1173,85 @@ var AuthConnectButtonView = ({
798
1173
  className: "h-4 w-4 shrink-0 text-agg-muted-foreground"
799
1174
  }
800
1175
  ),
801
- /* @__PURE__ */ jsx("span", { className: "truncate text-agg-sm leading-agg-5 text-agg-foreground", children: "Positions Value" })
1176
+ /* @__PURE__ */ jsx4("span", { className: "truncate text-agg-sm leading-agg-5 text-agg-foreground", children: "Positions Value" })
802
1177
  ] }),
803
- /* @__PURE__ */ jsx("p", { className: "text-agg-lg font-agg-bold leading-agg-7 text-agg-foreground text-left", children: isBalanceLoading ? /* @__PURE__ */ jsx(LoadingIcon, { size: "small" }) : formatUsd(positionsBalance) })
1178
+ /* @__PURE__ */ jsx4("p", { className: "text-agg-lg font-agg-bold leading-agg-7 text-agg-foreground text-left", children: isBalanceLoading ? /* @__PURE__ */ jsx4(LoadingIcon, { size: "small" }) : formatUsd(positionsBalance) })
804
1179
  ] })
805
1180
  ] })
806
1181
  ]
807
1182
  }
808
1183
  ),
809
- /* @__PURE__ */ jsx(
1184
+ /* @__PURE__ */ jsx4(
810
1185
  "div",
811
1186
  {
812
1187
  className: cn(profileMenuSeparatorClassName, classNames == null ? void 0 : classNames.profileMenuSeparator)
813
1188
  }
814
1189
  ),
815
- /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col py-2", children: [
816
- /* @__PURE__ */ jsxs(
1190
+ /* @__PURE__ */ jsxs2("div", { className: "flex w-full flex-col py-2", children: [
1191
+ /* @__PURE__ */ jsxs2(
817
1192
  DropdownMenu.Item,
818
1193
  {
819
1194
  className: dropdownMenuItemClassName,
820
1195
  onSelect: onProfileClick,
821
1196
  disabled,
822
1197
  children: [
823
- /* @__PURE__ */ jsx(Icon, { name: "profile", size: "small", className: "text-agg-foreground" }),
824
- /* @__PURE__ */ jsx("span", { children: labels.auth.myProfile })
1198
+ /* @__PURE__ */ jsx4(Icon, { name: "profile", size: "small", className: "text-agg-foreground" }),
1199
+ /* @__PURE__ */ jsx4("span", { children: labels.auth.myProfile })
825
1200
  ]
826
1201
  }
827
1202
  ),
828
- isDepositBlocked ? /* @__PURE__ */ jsx(
1203
+ isDepositBlocked ? /* @__PURE__ */ jsx4(
829
1204
  DropdownMenu.Item,
830
1205
  {
831
1206
  className: cn(dropdownMenuItemClassName, "opacity-50 cursor-not-allowed!"),
832
1207
  onSelect: (e) => e.preventDefault(),
833
1208
  "aria-disabled": "true",
834
- children: /* @__PURE__ */ jsx(
1209
+ children: /* @__PURE__ */ jsx4(
835
1210
  Tooltip,
836
1211
  {
837
- content: /* @__PURE__ */ jsx("p", { className: "text-center", children: labels.auth.depositGeoBlocked }),
1212
+ content: /* @__PURE__ */ jsx4("p", { className: "text-center", children: labels.auth.depositGeoBlocked }),
838
1213
  side: "bottom",
839
1214
  sideOffset: 4,
840
- children: /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-3", children: [
841
- /* @__PURE__ */ jsx(Icon, { name: "download", size: "small", className: "text-agg-foreground" }),
842
- /* @__PURE__ */ jsx("span", { children: labels.auth.deposit })
1215
+ children: /* @__PURE__ */ jsxs2("span", { className: "inline-flex items-center gap-3", children: [
1216
+ /* @__PURE__ */ jsx4(Icon, { name: "download", size: "small", className: "text-agg-foreground" }),
1217
+ /* @__PURE__ */ jsx4("span", { children: labels.auth.deposit })
843
1218
  ] })
844
1219
  }
845
1220
  )
846
1221
  }
847
- ) : /* @__PURE__ */ jsxs(
1222
+ ) : /* @__PURE__ */ jsxs2(
848
1223
  DropdownMenu.Item,
849
1224
  {
850
1225
  className: dropdownMenuItemClassName,
851
1226
  onSelect: onDepositClick,
852
1227
  disabled,
853
1228
  children: [
854
- /* @__PURE__ */ jsx(Icon, { name: "download", size: "small", className: "text-agg-foreground" }),
855
- /* @__PURE__ */ jsx("span", { children: labels.auth.deposit })
1229
+ /* @__PURE__ */ jsx4(Icon, { name: "download", size: "small", className: "text-agg-foreground" }),
1230
+ /* @__PURE__ */ jsx4("span", { children: labels.auth.deposit })
856
1231
  ]
857
1232
  }
858
1233
  ),
859
- /* @__PURE__ */ jsxs(
1234
+ /* @__PURE__ */ jsxs2(
860
1235
  DropdownMenu.Item,
861
1236
  {
862
1237
  className: dropdownMenuItemClassName,
863
1238
  onSelect: onWithdrawClick,
864
1239
  disabled,
865
1240
  children: [
866
- /* @__PURE__ */ jsx(Icon, { name: "upload", size: "small", className: "text-agg-foreground" }),
867
- /* @__PURE__ */ jsx("span", { children: labels.auth.withdraw })
1241
+ /* @__PURE__ */ jsx4(Icon, { name: "upload", size: "small", className: "text-agg-foreground" }),
1242
+ /* @__PURE__ */ jsx4("span", { children: labels.auth.withdraw })
868
1243
  ]
869
1244
  }
870
1245
  ),
871
- /* @__PURE__ */ jsxs(
1246
+ /* @__PURE__ */ jsxs2(
872
1247
  DropdownMenu.Item,
873
1248
  {
874
1249
  className: dropdownMenuItemClassName,
875
1250
  onSelect: onDisconnectClick,
876
1251
  disabled,
877
1252
  children: [
878
- /* @__PURE__ */ jsx(Icon, { name: "disconnect", size: "small", className: "text-agg-foreground" }),
879
- /* @__PURE__ */ jsx("span", { children: labels.auth.disconnect })
1253
+ /* @__PURE__ */ jsx4(Icon, { name: "disconnect", size: "small", className: "text-agg-foreground" }),
1254
+ /* @__PURE__ */ jsx4("span", { children: labels.auth.disconnect })
880
1255
  ]
881
1256
  }
882
1257
  )
@@ -899,6 +1274,9 @@ export {
899
1274
  ActivityChartIcon,
900
1275
  AggErrorBoundary,
901
1276
  AggLogo,
1277
+ AggNotificationEventsProvider,
1278
+ AggProvider,
1279
+ AggToastProvider,
902
1280
  AppleIcon,
903
1281
  AppsIcon,
904
1282
  ArbitrumIcon,
@@ -925,6 +1303,7 @@ export {
925
1303
  ChevronRightIcon,
926
1304
  ChevronUpIcon,
927
1305
  CircleOverlapIcon,
1306
+ CircleXmarkIcon,
928
1307
  CloseIcon,
929
1308
  ConnectAccountsStep,
930
1309
  ConnectKalshiModal,
@@ -1031,6 +1410,7 @@ export {
1031
1410
  formatAmountDisplay,
1032
1411
  formatCompactUsd,
1033
1412
  formatProbabilityCents,
1413
+ formatTokenAmount,
1034
1414
  formatUsd,
1035
1415
  getMotionClassName,
1036
1416
  getPendingCardSession,
@@ -1061,6 +1441,7 @@ export {
1061
1441
  useCenterOrderbookSpread,
1062
1442
  useEventTradingContext,
1063
1443
  useHomePageModals,
1444
+ useOptionalToast,
1064
1445
  useToast,
1065
1446
  venueLogoNames
1066
1447
  };