@agg-build/ui 1.2.11 → 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.
- package/README.md +34 -1
- package/dist/{chunk-NWJHFGBZ.mjs → chunk-55ODXLOS.mjs} +1 -1
- package/dist/{chunk-3ZSNHGAB.mjs → chunk-5ALBEKAT.mjs} +842 -300
- package/dist/{chunk-YP75TIY6.mjs → chunk-6PQ6O6M5.mjs} +583 -186
- package/dist/{chunk-ENAGASVU.mjs → chunk-ONVP7YWS.mjs} +439 -339
- package/dist/{chunk-SJLHOAKK.mjs → chunk-QUZWA34R.mjs} +1256 -844
- package/dist/{chunk-54PCEK6G.mjs → chunk-UFC7L74C.mjs} +26 -27
- package/dist/{chunk-J7K2U44E.mjs → chunk-YWJIYEJV.mjs} +236 -121
- package/dist/events.js +2460 -1355
- package/dist/events.mjs +5 -3
- package/dist/index.js +5741 -3841
- package/dist/index.mjs +485 -106
- package/dist/modals.js +1399 -1093
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +4039 -2687
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +1267 -895
- package/dist/primitives.mjs +3 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +1032 -695
- package/dist/trading.mjs +4 -4
- package/dist/types/agg-provider.d.mts +27 -0
- package/dist/types/agg-provider.d.ts +27 -0
- package/dist/types/events/item/event-list-item-v2.utils.d.mts +28 -0
- package/dist/types/events/item/event-list-item-v2.utils.d.ts +28 -0
- package/dist/types/events/item/event-list-item.constants.d.mts +1 -1
- package/dist/types/events/item/event-list-item.constants.d.ts +1 -1
- package/dist/types/events/item/index.d.mts +4 -0
- package/dist/types/events/item/index.d.ts +4 -0
- package/dist/types/events/list/event-list-tabs.d.mts +6 -1
- package/dist/types/events/list/event-list-tabs.d.ts +6 -1
- package/dist/types/events/list/event-list.types.d.mts +2 -0
- package/dist/types/events/list/event-list.types.d.ts +2 -0
- package/dist/types/events/list/event-list.utils.d.mts +19 -0
- package/dist/types/events/list/event-list.utils.d.ts +19 -0
- package/dist/types/events/list/index.d.mts +1 -1
- package/dist/types/events/list/index.d.ts +1 -1
- package/dist/types/index.d.mts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/notifications/agg-notification-events-provider.d.mts +35 -0
- package/dist/types/notifications/agg-notification-events-provider.d.ts +35 -0
- package/dist/types/notifications/agg-toast-provider.d.mts +27 -0
- package/dist/types/notifications/agg-toast-provider.d.ts +27 -0
- package/dist/types/notifications/deposit-notification-events.d.mts +10 -0
- package/dist/types/notifications/deposit-notification-events.d.ts +10 -0
- package/dist/types/notifications/index.d.mts +2 -0
- package/dist/types/notifications/index.d.ts +2 -0
- package/dist/types/pages/home/home.types.d.mts +1 -0
- package/dist/types/pages/home/home.types.d.ts +1 -0
- package/dist/types/pages/user-profile/user-profile.types.d.mts +30 -4
- package/dist/types/pages/user-profile/user-profile.types.d.ts +30 -4
- package/dist/types/primitives/button/button.types.d.mts +4 -0
- package/dist/types/primitives/button/button.types.d.ts +4 -0
- package/dist/types/primitives/button/index.d.mts +1 -1
- package/dist/types/primitives/button/index.d.ts +1 -1
- package/dist/types/primitives/icon/index.d.mts +2 -1
- package/dist/types/primitives/icon/index.d.ts +2 -1
- package/dist/types/primitives/icon/registry.d.mts +20 -0
- package/dist/types/primitives/icon/registry.d.ts +20 -0
- package/dist/types/primitives/icon/svg/gift-bonus.d.mts +5 -0
- package/dist/types/primitives/icon/svg/gift-bonus.d.ts +5 -0
- package/dist/types/primitives/icon/svg/sort-end-date.d.mts +5 -0
- package/dist/types/primitives/icon/svg/sort-end-date.d.ts +5 -0
- package/dist/types/primitives/icon/svg/sort-top-arbitrage.d.mts +5 -0
- package/dist/types/primitives/icon/svg/sort-top-arbitrage.d.ts +5 -0
- package/dist/types/primitives/icon/svg/sort-volume-24hr.d.mts +5 -0
- package/dist/types/primitives/icon/svg/sort-volume-24hr.d.ts +5 -0
- package/dist/types/primitives/icon/svg/sort-volume.d.mts +5 -0
- package/dist/types/primitives/icon/svg/sort-volume.d.ts +5 -0
- package/dist/types/primitives/search/search.types.d.mts +2 -1
- package/dist/types/primitives/search/search.types.d.ts +2 -1
- package/dist/types/primitives/select/index.d.mts +1 -1
- package/dist/types/primitives/select/index.d.ts +1 -1
- package/dist/types/primitives/select/select.types.d.mts +9 -0
- package/dist/types/primitives/select/select.types.d.ts +9 -0
- package/dist/types/primitives/skeleton/index.d.mts +1 -1
- package/dist/types/primitives/skeleton/index.d.ts +1 -1
- package/dist/types/primitives/skeleton/skeleton.types.d.mts +4 -0
- package/dist/types/primitives/skeleton/skeleton.types.d.ts +4 -0
- package/dist/types/primitives/skeleton/views/event-list-skeleton-view.d.mts +1 -1
- package/dist/types/primitives/skeleton/views/event-list-skeleton-view.d.ts +1 -1
- package/dist/types/primitives/toast/toast.types.d.mts +3 -0
- package/dist/types/primitives/toast/toast.types.d.ts +3 -0
- package/dist/types/profile/index.d.mts +1 -1
- package/dist/types/profile/index.d.ts +1 -1
- package/dist/types/profile/profile-modal.constants.d.mts +2 -2
- package/dist/types/profile/profile-modal.constants.d.ts +2 -2
- package/dist/types/profile/tabs/accounts-wallets-tab.d.mts +2 -17
- package/dist/types/profile/tabs/accounts-wallets-tab.d.ts +2 -17
- package/dist/types/profile/tabs/trading-access-tab.d.mts +15 -0
- package/dist/types/profile/tabs/trading-access-tab.d.ts +15 -0
- package/dist/types/trading/place-order/index.d.mts +1 -1
- package/dist/types/trading/place-order/index.d.ts +1 -1
- package/dist/types/trading/place-order/index.place-order.types.d.mts +4 -1
- package/dist/types/trading/place-order/index.place-order.types.d.ts +4 -1
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +3 -1
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +3 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -10,11 +10,12 @@ import {
|
|
|
10
10
|
USER_PROFILE_TAB_POSITIONS,
|
|
11
11
|
UserProfilePage,
|
|
12
12
|
useHomePageModals
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-6PQ6O6M5.mjs";
|
|
14
14
|
import {
|
|
15
15
|
EventList,
|
|
16
16
|
EventListItem,
|
|
17
17
|
EventListItemDetails,
|
|
18
|
+
EventListItemV2,
|
|
18
19
|
MarketDetails,
|
|
19
20
|
MarketDetailsList,
|
|
20
21
|
Orderbook,
|
|
@@ -25,7 +26,7 @@ import {
|
|
|
25
26
|
mergeVenueOutcomeOrderbooks,
|
|
26
27
|
orderbookRowLimitDefault,
|
|
27
28
|
useCenterOrderbookSpread
|
|
28
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-5ALBEKAT.mjs";
|
|
29
30
|
import {
|
|
30
31
|
CARD_NETWORK_OPTIONS,
|
|
31
32
|
ConnectAccountsStep,
|
|
@@ -39,8 +40,9 @@ import {
|
|
|
39
40
|
ProfileSetupStep,
|
|
40
41
|
WithdrawModal,
|
|
41
42
|
clearPendingCardSession,
|
|
42
|
-
getPendingCardSession
|
|
43
|
-
|
|
43
|
+
getPendingCardSession,
|
|
44
|
+
subscribeAggDepositNotification
|
|
45
|
+
} from "./chunk-ONVP7YWS.mjs";
|
|
44
46
|
import {
|
|
45
47
|
DEPOSIT_MODAL_OPEN_EVENT,
|
|
46
48
|
PlaceOrder,
|
|
@@ -52,7 +54,7 @@ import {
|
|
|
52
54
|
parseVenue,
|
|
53
55
|
requestAggDepositModalOpen,
|
|
54
56
|
requestAggWithdrawModalOpen
|
|
55
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-YWJIYEJV.mjs";
|
|
56
58
|
import {
|
|
57
59
|
SETTLEMENT_SECTION_ID,
|
|
58
60
|
Settlement,
|
|
@@ -70,10 +72,10 @@ import {
|
|
|
70
72
|
resolveOrderBookRows,
|
|
71
73
|
resolveUnifiedOrderBookEntries,
|
|
72
74
|
useEventTradingContext
|
|
73
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-UFC7L74C.mjs";
|
|
74
76
|
import {
|
|
75
77
|
GeoBlockBanner
|
|
76
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-55ODXLOS.mjs";
|
|
77
79
|
import {
|
|
78
80
|
AGG_DEFAULT_URL,
|
|
79
81
|
AGG_DOCS_URL,
|
|
@@ -122,6 +124,7 @@ import {
|
|
|
122
124
|
EthereumIcon,
|
|
123
125
|
ExternalLinkIcon,
|
|
124
126
|
Footer,
|
|
127
|
+
GiftBonusIcon,
|
|
125
128
|
GoogleIcon,
|
|
126
129
|
Header,
|
|
127
130
|
HourglassStartIcon,
|
|
@@ -170,6 +173,7 @@ import {
|
|
|
170
173
|
WalletIcon,
|
|
171
174
|
WarningFilledIcon,
|
|
172
175
|
WarningIcon,
|
|
176
|
+
__objRest,
|
|
173
177
|
__spreadProps,
|
|
174
178
|
__spreadValues,
|
|
175
179
|
badgeSizes,
|
|
@@ -190,7 +194,377 @@ import {
|
|
|
190
194
|
useOptionalToast,
|
|
191
195
|
useToast,
|
|
192
196
|
venueLogoNames
|
|
193
|
-
} from "./chunk-
|
|
197
|
+
} from "./chunk-QUZWA34R.mjs";
|
|
198
|
+
|
|
199
|
+
// src/notifications/agg-notification-events-provider.tsx
|
|
200
|
+
import {
|
|
201
|
+
useAggAuthState,
|
|
202
|
+
useAggLabels,
|
|
203
|
+
useAggUiConfig,
|
|
204
|
+
useOnOrderEvent,
|
|
205
|
+
useOnWithdrawalLifecycle,
|
|
206
|
+
useOptionalAggClient,
|
|
207
|
+
useUserActivity
|
|
208
|
+
} from "@agg-build/hooks";
|
|
209
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
210
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
211
|
+
function AggNotificationEventsProvider({
|
|
212
|
+
children,
|
|
213
|
+
enabled = true,
|
|
214
|
+
depositActivityLimit = 25
|
|
215
|
+
}) {
|
|
216
|
+
const aggClient = useOptionalAggClient();
|
|
217
|
+
if (!aggClient) {
|
|
218
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
219
|
+
}
|
|
220
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
221
|
+
/* @__PURE__ */ jsx(AggNotificationEventsBridge, { enabled, depositActivityLimit }),
|
|
222
|
+
children
|
|
223
|
+
] });
|
|
224
|
+
}
|
|
225
|
+
var TERMINAL_ORDER_EVENTS = /* @__PURE__ */ new Set(["filled", "partial_fill", "failed"]);
|
|
226
|
+
var TERMINAL_WITHDRAWAL_STATUSES = /* @__PURE__ */ new Set([
|
|
227
|
+
"completed",
|
|
228
|
+
"partial",
|
|
229
|
+
"failed"
|
|
230
|
+
]);
|
|
231
|
+
var isTerminalWithdrawalStatus = (value) => TERMINAL_WITHDRAWAL_STATUSES.has(value);
|
|
232
|
+
var MICRO_UNITS_SCALE = 1e6;
|
|
233
|
+
var formatScaledMicroAmount = (value) => {
|
|
234
|
+
if (!value) return void 0;
|
|
235
|
+
if (value.includes(".")) {
|
|
236
|
+
const parsed = Number(value);
|
|
237
|
+
if (!Number.isFinite(parsed)) return void 0;
|
|
238
|
+
return parsed.toLocaleString("en-US", { maximumFractionDigits: 2 });
|
|
239
|
+
}
|
|
240
|
+
try {
|
|
241
|
+
const raw = BigInt(value);
|
|
242
|
+
const whole = raw / BigInt(MICRO_UNITS_SCALE);
|
|
243
|
+
const remainder = raw % BigInt(MICRO_UNITS_SCALE);
|
|
244
|
+
const parsed = Number(whole) + Number(remainder) / MICRO_UNITS_SCALE;
|
|
245
|
+
return parsed.toLocaleString("en-US", { maximumFractionDigits: 2 });
|
|
246
|
+
} catch (e) {
|
|
247
|
+
const parsed = Number(value);
|
|
248
|
+
if (!Number.isFinite(parsed)) return void 0;
|
|
249
|
+
return (parsed / MICRO_UNITS_SCALE).toLocaleString("en-US", { maximumFractionDigits: 2 });
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
var formatDecimalAmount = (value) => {
|
|
253
|
+
if (!value) return void 0;
|
|
254
|
+
const parsed = Number(value.replace(/,/g, ""));
|
|
255
|
+
if (!Number.isFinite(parsed)) return value;
|
|
256
|
+
return parsed.toLocaleString("en-US", { maximumFractionDigits: 2 });
|
|
257
|
+
};
|
|
258
|
+
var formatPriceCents = (value) => {
|
|
259
|
+
if (!value) return void 0;
|
|
260
|
+
const parsed = Number(value);
|
|
261
|
+
if (!Number.isFinite(parsed)) return void 0;
|
|
262
|
+
const cents = parsed * 100;
|
|
263
|
+
const display = cents.toLocaleString("en-US", {
|
|
264
|
+
minimumFractionDigits: 0,
|
|
265
|
+
maximumFractionDigits: 1
|
|
266
|
+
});
|
|
267
|
+
return `${display}\xA2`;
|
|
268
|
+
};
|
|
269
|
+
var formatSharesLabel = (raw) => {
|
|
270
|
+
const formatted = formatScaledMicroAmount(raw);
|
|
271
|
+
if (!formatted) return void 0;
|
|
272
|
+
return `${formatted} shares`;
|
|
273
|
+
};
|
|
274
|
+
var capitalize = (value) => {
|
|
275
|
+
if (!value) return void 0;
|
|
276
|
+
return value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();
|
|
277
|
+
};
|
|
278
|
+
var venueLabelFor = (venueKey, labels) => {
|
|
279
|
+
var _a;
|
|
280
|
+
if (!venueKey) return void 0;
|
|
281
|
+
const normalized = venueKey.toLowerCase();
|
|
282
|
+
const lookup = labels.venues;
|
|
283
|
+
return (_a = lookup[normalized]) != null ? _a : capitalize(venueKey);
|
|
284
|
+
};
|
|
285
|
+
function AggNotificationEventsBridge({ enabled, depositActivityLimit }) {
|
|
286
|
+
var _a;
|
|
287
|
+
const toastCtx = useOptionalToast();
|
|
288
|
+
const { user, isAuthenticated } = useAggAuthState();
|
|
289
|
+
const labels = useAggLabels();
|
|
290
|
+
const { features } = useAggUiConfig();
|
|
291
|
+
const notificationsFeatureEnabled = features.enableNotifications !== false;
|
|
292
|
+
const effectivelyEnabled = enabled && notificationsFeatureEnabled;
|
|
293
|
+
const currentUserId = (_a = user == null ? void 0 : user.id) != null ? _a : null;
|
|
294
|
+
const firedKeysRef = useRef(/* @__PURE__ */ new Set());
|
|
295
|
+
const depositStatusesRef = useRef(/* @__PURE__ */ new Map());
|
|
296
|
+
const hasSeededDepositStatusesRef = useRef(false);
|
|
297
|
+
const recentClientDepositFingerprintsRef = useRef(/* @__PURE__ */ new Map());
|
|
298
|
+
const lastUserIdRef = useRef("uninitialized");
|
|
299
|
+
useEffect(() => {
|
|
300
|
+
if (lastUserIdRef.current === currentUserId) return;
|
|
301
|
+
lastUserIdRef.current = currentUserId;
|
|
302
|
+
firedKeysRef.current = /* @__PURE__ */ new Set();
|
|
303
|
+
depositStatusesRef.current = /* @__PURE__ */ new Map();
|
|
304
|
+
hasSeededDepositStatusesRef.current = false;
|
|
305
|
+
recentClientDepositFingerprintsRef.current = /* @__PURE__ */ new Map();
|
|
306
|
+
}, [currentUserId]);
|
|
307
|
+
const fireOnce = useCallback(
|
|
308
|
+
(key, tone, title, message, detail) => {
|
|
309
|
+
if (!effectivelyEnabled) return;
|
|
310
|
+
const toast = toastCtx == null ? void 0 : toastCtx.toast;
|
|
311
|
+
if (!toast) return;
|
|
312
|
+
if (firedKeysRef.current.has(key)) return;
|
|
313
|
+
firedKeysRef.current.add(key);
|
|
314
|
+
toast(message, { tone, title, detail });
|
|
315
|
+
},
|
|
316
|
+
[effectivelyEnabled, toastCtx]
|
|
317
|
+
);
|
|
318
|
+
const orderEventCallback = useCallback(
|
|
319
|
+
(event) => {
|
|
320
|
+
if (!effectivelyEnabled || !isAuthenticated) return;
|
|
321
|
+
if (!currentUserId || event.userId !== currentUserId) return;
|
|
322
|
+
if (!TERMINAL_ORDER_EVENTS.has(event.event)) return;
|
|
323
|
+
handleOrderEvent({ event, labels, fireOnce });
|
|
324
|
+
},
|
|
325
|
+
[currentUserId, effectivelyEnabled, fireOnce, isAuthenticated, labels]
|
|
326
|
+
);
|
|
327
|
+
useOnOrderEvent(orderEventCallback);
|
|
328
|
+
const withdrawalCallback = useCallback(
|
|
329
|
+
(event) => {
|
|
330
|
+
if (!effectivelyEnabled || !isAuthenticated) return;
|
|
331
|
+
if (!currentUserId || event.userId !== currentUserId) return;
|
|
332
|
+
if (!event.terminal) return;
|
|
333
|
+
if (!isTerminalWithdrawalStatus(event.status)) return;
|
|
334
|
+
handleWithdrawalEvent({ event, labels, fireOnce });
|
|
335
|
+
},
|
|
336
|
+
[currentUserId, effectivelyEnabled, fireOnce, isAuthenticated, labels]
|
|
337
|
+
);
|
|
338
|
+
useOnWithdrawalLifecycle(withdrawalCallback);
|
|
339
|
+
useEffect(() => {
|
|
340
|
+
if (!effectivelyEnabled || !isAuthenticated || !currentUserId) return;
|
|
341
|
+
return subscribeAggDepositNotification((event) => {
|
|
342
|
+
handleClientDepositNotification({
|
|
343
|
+
event,
|
|
344
|
+
labels,
|
|
345
|
+
fireOnce,
|
|
346
|
+
recentClientDepositFingerprints: recentClientDepositFingerprintsRef.current
|
|
347
|
+
});
|
|
348
|
+
});
|
|
349
|
+
}, [currentUserId, effectivelyEnabled, fireOnce, isAuthenticated, labels]);
|
|
350
|
+
const depositActivity = useUserActivity({
|
|
351
|
+
type: "deposit",
|
|
352
|
+
limit: depositActivityLimit,
|
|
353
|
+
enabled: effectivelyEnabled && isAuthenticated && currentUserId !== null
|
|
354
|
+
});
|
|
355
|
+
const depositActivities = depositActivity.activities;
|
|
356
|
+
useEffect(() => {
|
|
357
|
+
if (!effectivelyEnabled || !isAuthenticated || !currentUserId) return;
|
|
358
|
+
if (!depositActivity.isSuccess) return;
|
|
359
|
+
handleDepositActivities({
|
|
360
|
+
deposits: depositActivities,
|
|
361
|
+
previousStatuses: depositStatusesRef.current,
|
|
362
|
+
hasSeededStatuses: hasSeededDepositStatusesRef.current,
|
|
363
|
+
labels,
|
|
364
|
+
fireOnce,
|
|
365
|
+
shouldSuppressToast: (status, amountLabel, tokenLabel) => hasRecentClientDepositNotification({
|
|
366
|
+
recentClientDepositFingerprints: recentClientDepositFingerprintsRef.current,
|
|
367
|
+
status,
|
|
368
|
+
amountLabel,
|
|
369
|
+
tokenLabel
|
|
370
|
+
})
|
|
371
|
+
});
|
|
372
|
+
hasSeededDepositStatusesRef.current = true;
|
|
373
|
+
}, [
|
|
374
|
+
currentUserId,
|
|
375
|
+
depositActivities,
|
|
376
|
+
depositActivity.isSuccess,
|
|
377
|
+
effectivelyEnabled,
|
|
378
|
+
fireOnce,
|
|
379
|
+
isAuthenticated,
|
|
380
|
+
labels
|
|
381
|
+
]);
|
|
382
|
+
return null;
|
|
383
|
+
}
|
|
384
|
+
function handleOrderEvent({ event, labels, fireOnce }) {
|
|
385
|
+
var _a, _b;
|
|
386
|
+
const venueLabel = venueLabelFor(event.venue, labels);
|
|
387
|
+
const amountLabel = formatSharesLabel((_a = event.actualSharesRaw) != null ? _a : event.filledAmountRaw);
|
|
388
|
+
const priceLabel = formatPriceCents((_b = event.executionPriceRaw) != null ? _b : event.quotedPriceRaw);
|
|
389
|
+
if (event.event === "filled") {
|
|
390
|
+
fireOnce(
|
|
391
|
+
`order:${event.orderId}:filled`,
|
|
392
|
+
"success",
|
|
393
|
+
labels.notifications.order.filledTitle,
|
|
394
|
+
labels.notifications.order.filledMessage({ venueLabel, amountLabel, priceLabel })
|
|
395
|
+
);
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
if (event.event === "partial_fill") {
|
|
399
|
+
fireOnce(
|
|
400
|
+
`order:${event.orderId}:partial_fill`,
|
|
401
|
+
"warning",
|
|
402
|
+
labels.notifications.order.partialFilledTitle,
|
|
403
|
+
labels.notifications.order.partialFilledMessage({ venueLabel, amountLabel, priceLabel })
|
|
404
|
+
);
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
if (event.event === "failed") {
|
|
408
|
+
fireOnce(
|
|
409
|
+
`order:${event.orderId}:failed`,
|
|
410
|
+
"error",
|
|
411
|
+
labels.notifications.order.failedTitle,
|
|
412
|
+
labels.notifications.order.failedMessage(event.errorReason),
|
|
413
|
+
venueLabel
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
function handleWithdrawalEvent({ event, labels, fireOnce }) {
|
|
418
|
+
var _a;
|
|
419
|
+
const amountLabel = formatScaledMicroAmount((_a = event.completedAmountRaw) != null ? _a : event.requestedAmountRaw);
|
|
420
|
+
if (event.status === "completed") {
|
|
421
|
+
fireOnce(
|
|
422
|
+
`withdrawal:${event.withdrawalId}:completed`,
|
|
423
|
+
"success",
|
|
424
|
+
labels.notifications.withdrawal.completedTitle,
|
|
425
|
+
labels.notifications.withdrawal.completedMessage({ amountLabel })
|
|
426
|
+
);
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
if (event.status === "partial") {
|
|
430
|
+
fireOnce(
|
|
431
|
+
`withdrawal:${event.withdrawalId}:partial`,
|
|
432
|
+
"warning",
|
|
433
|
+
labels.notifications.withdrawal.partialTitle,
|
|
434
|
+
labels.notifications.withdrawal.partialMessage({ amountLabel })
|
|
435
|
+
);
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
if (event.status === "failed") {
|
|
439
|
+
fireOnce(
|
|
440
|
+
`withdrawal:${event.withdrawalId}:failed`,
|
|
441
|
+
"error",
|
|
442
|
+
labels.notifications.withdrawal.failedTitle,
|
|
443
|
+
labels.notifications.withdrawal.failedMessage(event.errorMessage)
|
|
444
|
+
);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
var DEPOSIT_COMPLETED_STATUSES = /* @__PURE__ */ new Set(["completed", "confirmed", "succeeded", "success"]);
|
|
448
|
+
var DEPOSIT_FAILED_STATUSES = /* @__PURE__ */ new Set(["failed", "errored", "rejected"]);
|
|
449
|
+
var CLIENT_DEPOSIT_ACTIVITY_SUPPRESSION_MS = 2 * 60 * 1e3;
|
|
450
|
+
var isTerminalDepositStatus = (status) => DEPOSIT_COMPLETED_STATUSES.has(status) || DEPOSIT_FAILED_STATUSES.has(status);
|
|
451
|
+
var getDepositNotificationFingerprint = ({
|
|
452
|
+
status,
|
|
453
|
+
amountLabel,
|
|
454
|
+
tokenLabel
|
|
455
|
+
}) => `${status}:${amountLabel != null ? amountLabel : ""}:${tokenLabel != null ? tokenLabel : ""}`.toLowerCase();
|
|
456
|
+
var hasRecentClientDepositNotification = ({
|
|
457
|
+
recentClientDepositFingerprints,
|
|
458
|
+
status,
|
|
459
|
+
amountLabel,
|
|
460
|
+
tokenLabel
|
|
461
|
+
}) => {
|
|
462
|
+
const fingerprint = getDepositNotificationFingerprint({ status, amountLabel, tokenLabel });
|
|
463
|
+
const lastNotifiedAt = recentClientDepositFingerprints.get(fingerprint);
|
|
464
|
+
if (!lastNotifiedAt) return false;
|
|
465
|
+
if (Date.now() - lastNotifiedAt <= CLIENT_DEPOSIT_ACTIVITY_SUPPRESSION_MS) {
|
|
466
|
+
return true;
|
|
467
|
+
}
|
|
468
|
+
recentClientDepositFingerprints.delete(fingerprint);
|
|
469
|
+
return false;
|
|
470
|
+
};
|
|
471
|
+
function handleClientDepositNotification({
|
|
472
|
+
event,
|
|
473
|
+
labels,
|
|
474
|
+
fireOnce,
|
|
475
|
+
recentClientDepositFingerprints
|
|
476
|
+
}) {
|
|
477
|
+
var _a, _b, _c;
|
|
478
|
+
const amountLabel = formatDecimalAmount(event.amount);
|
|
479
|
+
const tokenLabel = event.tokenSymbol;
|
|
480
|
+
const fingerprint = getDepositNotificationFingerprint({
|
|
481
|
+
status: event.status,
|
|
482
|
+
amountLabel,
|
|
483
|
+
tokenLabel
|
|
484
|
+
});
|
|
485
|
+
recentClientDepositFingerprints.set(fingerprint, Date.now());
|
|
486
|
+
if (event.status === "completed") {
|
|
487
|
+
fireOnce(
|
|
488
|
+
`deposit-client:${(_a = event.id) != null ? _a : fingerprint}:completed`,
|
|
489
|
+
"success",
|
|
490
|
+
labels.notifications.deposit.completedTitle,
|
|
491
|
+
labels.notifications.deposit.completedMessage({ amountLabel, tokenLabel })
|
|
492
|
+
);
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
fireOnce(
|
|
496
|
+
`deposit-client:${(_b = event.id) != null ? _b : fingerprint}:failed`,
|
|
497
|
+
"error",
|
|
498
|
+
labels.notifications.deposit.failedTitle,
|
|
499
|
+
(_c = event.errorMessage) != null ? _c : labels.notifications.deposit.failedMessage({ amountLabel, tokenLabel })
|
|
500
|
+
);
|
|
501
|
+
}
|
|
502
|
+
function handleDepositActivities({
|
|
503
|
+
deposits,
|
|
504
|
+
previousStatuses,
|
|
505
|
+
hasSeededStatuses,
|
|
506
|
+
labels,
|
|
507
|
+
fireOnce,
|
|
508
|
+
shouldSuppressToast
|
|
509
|
+
}) {
|
|
510
|
+
for (const item of deposits) {
|
|
511
|
+
if (item.type !== "deposit") continue;
|
|
512
|
+
const deposit = item;
|
|
513
|
+
const status = deposit.status.toLowerCase();
|
|
514
|
+
const isCompleted = DEPOSIT_COMPLETED_STATUSES.has(status);
|
|
515
|
+
const isFailed = DEPOSIT_FAILED_STATUSES.has(status);
|
|
516
|
+
const previousStatus = previousStatuses.get(deposit.id);
|
|
517
|
+
previousStatuses.set(deposit.id, status);
|
|
518
|
+
if (!hasSeededStatuses) continue;
|
|
519
|
+
if (!previousStatus) continue;
|
|
520
|
+
if (isTerminalDepositStatus(previousStatus)) continue;
|
|
521
|
+
if (!isCompleted && !isFailed) continue;
|
|
522
|
+
const amountLabel = formatScaledMicroAmount(deposit.amountRaw);
|
|
523
|
+
const tokenLabel = deposit.tokenSymbol;
|
|
524
|
+
const terminalStatus = isCompleted ? "completed" : "failed";
|
|
525
|
+
if (shouldSuppressToast == null ? void 0 : shouldSuppressToast(terminalStatus, amountLabel, tokenLabel)) continue;
|
|
526
|
+
if (isCompleted) {
|
|
527
|
+
fireOnce(
|
|
528
|
+
`deposit:${deposit.id}:completed`,
|
|
529
|
+
"success",
|
|
530
|
+
labels.notifications.deposit.completedTitle,
|
|
531
|
+
labels.notifications.deposit.completedMessage({ amountLabel, tokenLabel })
|
|
532
|
+
);
|
|
533
|
+
} else {
|
|
534
|
+
fireOnce(
|
|
535
|
+
`deposit:${deposit.id}:failed`,
|
|
536
|
+
"error",
|
|
537
|
+
labels.notifications.deposit.failedTitle,
|
|
538
|
+
labels.notifications.deposit.failedMessage({ amountLabel, tokenLabel })
|
|
539
|
+
);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// src/notifications/agg-toast-provider.tsx
|
|
545
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
546
|
+
function AggToastProvider(_a) {
|
|
547
|
+
var _b = _a, {
|
|
548
|
+
children,
|
|
549
|
+
disableAggNotifications = false,
|
|
550
|
+
notificationDepositActivityLimit
|
|
551
|
+
} = _b, toastProps = __objRest(_b, [
|
|
552
|
+
"children",
|
|
553
|
+
"disableAggNotifications",
|
|
554
|
+
"notificationDepositActivityLimit"
|
|
555
|
+
]);
|
|
556
|
+
return /* @__PURE__ */ jsx2(ToastProvider, __spreadProps(__spreadValues({}, toastProps), { children: disableAggNotifications ? children : /* @__PURE__ */ jsx2(AggNotificationEventsProvider, { depositActivityLimit: notificationDepositActivityLimit, children }) }));
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
// src/agg-provider.tsx
|
|
560
|
+
import {
|
|
561
|
+
AggProvider as AggSdkProvider
|
|
562
|
+
} from "@agg-build/hooks";
|
|
563
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
564
|
+
function AggProvider(_a) {
|
|
565
|
+
var _b = _a, { children, toast } = _b, providerProps = __objRest(_b, ["children", "toast"]);
|
|
566
|
+
return /* @__PURE__ */ jsx3(AggSdkProvider, __spreadProps(__spreadValues({}, providerProps), { children: /* @__PURE__ */ jsx3(AggToastProvider, __spreadProps(__spreadValues({}, toast), { children })) }));
|
|
567
|
+
}
|
|
194
568
|
|
|
195
569
|
// src/auth/connect-button-view/index.tsx
|
|
196
570
|
import { optimizedImageUrl, useAggAuthContext, useLabels, useSdkUiConfig } from "@agg-build/hooks";
|
|
@@ -269,11 +643,11 @@ var avatarRootClassName = cn(
|
|
|
269
643
|
var avatarIconClassName = cn("h-[66%] w-[66%] text-agg-muted-foreground");
|
|
270
644
|
|
|
271
645
|
// src/auth/connect-button-view/index.tsx
|
|
272
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
646
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
273
647
|
var WalletAvatar = ({ className }) => {
|
|
274
648
|
const { isAuthenticated, user } = useAggAuthContext();
|
|
275
649
|
if (isAuthenticated && (user == null ? void 0 : user.avatarUrl)) {
|
|
276
|
-
return /* @__PURE__ */
|
|
650
|
+
return /* @__PURE__ */ jsx4(
|
|
277
651
|
"img",
|
|
278
652
|
{
|
|
279
653
|
src: optimizedImageUrl(user.avatarUrl, 44),
|
|
@@ -282,7 +656,7 @@ var WalletAvatar = ({ className }) => {
|
|
|
282
656
|
}
|
|
283
657
|
);
|
|
284
658
|
}
|
|
285
|
-
return /* @__PURE__ */
|
|
659
|
+
return /* @__PURE__ */ jsx4(DefaultAvatar, { className: cn("size-6 shrink-0 rounded-full", className) });
|
|
286
660
|
};
|
|
287
661
|
var AuthMethodActionButton = ({
|
|
288
662
|
activeMethodId,
|
|
@@ -296,7 +670,7 @@ var AuthMethodActionButton = ({
|
|
|
296
670
|
const labels = useLabels();
|
|
297
671
|
const isMethodLoading = activeMethodId === method.id;
|
|
298
672
|
const isMethodDisabled = disabled || !method.isAvailable || activeMethodId !== null && !isMethodLoading;
|
|
299
|
-
return /* @__PURE__ */
|
|
673
|
+
return /* @__PURE__ */ jsxs2(
|
|
300
674
|
"button",
|
|
301
675
|
{
|
|
302
676
|
type: "button",
|
|
@@ -306,7 +680,7 @@ var AuthMethodActionButton = ({
|
|
|
306
680
|
"aria-label": labels.auth.signInWithMethod(method.label),
|
|
307
681
|
onClick: () => onSelect(method.id),
|
|
308
682
|
children: [
|
|
309
|
-
isMethodLoading ? /* @__PURE__ */
|
|
683
|
+
isMethodLoading ? /* @__PURE__ */ jsx4(LoadingIcon, { size: "small" }) : /* @__PURE__ */ jsx4(
|
|
310
684
|
Icon,
|
|
311
685
|
{
|
|
312
686
|
name: (_a = method.iconName) != null ? _a : "profile",
|
|
@@ -315,7 +689,7 @@ var AuthMethodActionButton = ({
|
|
|
315
689
|
title: renderLabel ? void 0 : method.label
|
|
316
690
|
}
|
|
317
691
|
),
|
|
318
|
-
renderLabel ? /* @__PURE__ */
|
|
692
|
+
renderLabel ? /* @__PURE__ */ jsx4("span", { children: labels.auth.connect(method.label) }) : null
|
|
319
693
|
]
|
|
320
694
|
}
|
|
321
695
|
);
|
|
@@ -344,8 +718,8 @@ var UnauthenticatedConnectView = ({
|
|
|
344
718
|
const labels = useLabels();
|
|
345
719
|
const hasConfiguredMethods = emailMethod !== null || socialMethods.length > 0 || walletMethods.length > 0;
|
|
346
720
|
const showWalletDivider = walletMethods.length > 0 && (emailMethod !== null || socialMethods.length > 0);
|
|
347
|
-
return /* @__PURE__ */
|
|
348
|
-
/* @__PURE__ */
|
|
721
|
+
return /* @__PURE__ */ jsxs2("div", { className: cn(connectButtonContainerClassName, classNames == null ? void 0 : classNames.root), children: [
|
|
722
|
+
/* @__PURE__ */ jsx4(
|
|
349
723
|
Button,
|
|
350
724
|
__spreadProps(__spreadValues({
|
|
351
725
|
variant: "primary",
|
|
@@ -358,8 +732,8 @@ var UnauthenticatedConnectView = ({
|
|
|
358
732
|
children: labels.auth.connect()
|
|
359
733
|
})
|
|
360
734
|
),
|
|
361
|
-
notice ? /* @__PURE__ */
|
|
362
|
-
/* @__PURE__ */
|
|
735
|
+
notice ? /* @__PURE__ */ jsx4("p", { className: cn(authNoticeClassName, classNames == null ? void 0 : classNames.authNotice), children: notice }) : null,
|
|
736
|
+
/* @__PURE__ */ jsx4(Modal, { open: isChooserOpen || !!challengeContent, onOpenChange: onChooserOpenChange, children: /* @__PURE__ */ jsxs2(
|
|
363
737
|
Modal.Container,
|
|
364
738
|
{
|
|
365
739
|
maxWidth: "400px",
|
|
@@ -368,7 +742,7 @@ var UnauthenticatedConnectView = ({
|
|
|
368
742
|
},
|
|
369
743
|
"aria-label": challengeContent ? "Security Check" : labels.auth.signIn,
|
|
370
744
|
children: [
|
|
371
|
-
/* @__PURE__ */
|
|
745
|
+
/* @__PURE__ */ jsx4(
|
|
372
746
|
Modal.Header,
|
|
373
747
|
{
|
|
374
748
|
title: challengeContent ? "Security Check" : labels.auth.signIn,
|
|
@@ -380,8 +754,8 @@ var UnauthenticatedConnectView = ({
|
|
|
380
754
|
}
|
|
381
755
|
}
|
|
382
756
|
),
|
|
383
|
-
/* @__PURE__ */
|
|
384
|
-
emailMethod ? /* @__PURE__ */
|
|
757
|
+
/* @__PURE__ */ jsx4(Modal.Body, { classNames: { root: authModalBodyClassName }, children: challengeContent ? challengeContent : /* @__PURE__ */ jsxs2("div", { className: authMethodsListClassName, children: [
|
|
758
|
+
emailMethod ? /* @__PURE__ */ jsxs2(
|
|
385
759
|
"form",
|
|
386
760
|
{
|
|
387
761
|
className: authSectionClassName,
|
|
@@ -390,8 +764,8 @@ var UnauthenticatedConnectView = ({
|
|
|
390
764
|
onEmailSubmit();
|
|
391
765
|
},
|
|
392
766
|
children: [
|
|
393
|
-
/* @__PURE__ */
|
|
394
|
-
/* @__PURE__ */
|
|
767
|
+
/* @__PURE__ */ jsxs2("div", { className: authInputFormClassName, children: [
|
|
768
|
+
/* @__PURE__ */ jsx4(
|
|
395
769
|
"input",
|
|
396
770
|
{
|
|
397
771
|
id: "agg-auth-email",
|
|
@@ -404,7 +778,7 @@ var UnauthenticatedConnectView = ({
|
|
|
404
778
|
disabled: disabled || isBusy || !emailMethod.isAvailable
|
|
405
779
|
}
|
|
406
780
|
),
|
|
407
|
-
/* @__PURE__ */
|
|
781
|
+
/* @__PURE__ */ jsx4(
|
|
408
782
|
Button,
|
|
409
783
|
{
|
|
410
784
|
type: "submit",
|
|
@@ -417,8 +791,8 @@ var UnauthenticatedConnectView = ({
|
|
|
417
791
|
}
|
|
418
792
|
)
|
|
419
793
|
] }),
|
|
420
|
-
emailMethod.isAvailable && ((_e = emailMethod.input) == null ? void 0 : _e.helperText) ? /* @__PURE__ */
|
|
421
|
-
!emailMethod.isAvailable ? /* @__PURE__ */
|
|
794
|
+
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,
|
|
795
|
+
!emailMethod.isAvailable ? /* @__PURE__ */ jsx4(
|
|
422
796
|
InlineAlert,
|
|
423
797
|
{
|
|
424
798
|
tone: "warning",
|
|
@@ -427,7 +801,7 @@ var UnauthenticatedConnectView = ({
|
|
|
427
801
|
className: classNames == null ? void 0 : classNames.authError
|
|
428
802
|
}
|
|
429
803
|
) : null,
|
|
430
|
-
emailError ? /* @__PURE__ */
|
|
804
|
+
emailError ? /* @__PURE__ */ jsx4(
|
|
431
805
|
InlineAlert,
|
|
432
806
|
{
|
|
433
807
|
tone: "error",
|
|
@@ -438,8 +812,8 @@ var UnauthenticatedConnectView = ({
|
|
|
438
812
|
]
|
|
439
813
|
}
|
|
440
814
|
) : null,
|
|
441
|
-
socialMethods.length > 0 ? /* @__PURE__ */
|
|
442
|
-
/* @__PURE__ */
|
|
815
|
+
socialMethods.length > 0 ? /* @__PURE__ */ jsxs2("div", { className: authSectionClassName, children: [
|
|
816
|
+
/* @__PURE__ */ jsx4("div", { className: cn(authMethodGridClassName, classNames == null ? void 0 : classNames.authMethodGrid), children: socialMethods.map((method) => /* @__PURE__ */ jsx4(
|
|
443
817
|
AuthMethodActionButton,
|
|
444
818
|
{
|
|
445
819
|
activeMethodId,
|
|
@@ -451,18 +825,18 @@ var UnauthenticatedConnectView = ({
|
|
|
451
825
|
},
|
|
452
826
|
method.id
|
|
453
827
|
)) }),
|
|
454
|
-
/* @__PURE__ */
|
|
828
|
+
/* @__PURE__ */ jsxs2("p", { className: authHelperTextClassName, children: [
|
|
455
829
|
labels.auth.socialWalletNotice,
|
|
456
830
|
" ",
|
|
457
|
-
/* @__PURE__ */
|
|
831
|
+
/* @__PURE__ */ jsx4("span", { className: cn(authHelperLinkClassName, classNames == null ? void 0 : classNames.authHelperLink), children: labels.auth.learnMore })
|
|
458
832
|
] })
|
|
459
833
|
] }) : null,
|
|
460
|
-
showWalletDivider ? /* @__PURE__ */
|
|
461
|
-
/* @__PURE__ */
|
|
462
|
-
/* @__PURE__ */
|
|
463
|
-
/* @__PURE__ */
|
|
834
|
+
showWalletDivider ? /* @__PURE__ */ jsxs2("div", { className: authDividerClassName, children: [
|
|
835
|
+
/* @__PURE__ */ jsx4("div", { className: authDividerLineClassName }),
|
|
836
|
+
/* @__PURE__ */ jsx4("span", { className: authDividerLabelClassName, children: labels.auth.dividerOr }),
|
|
837
|
+
/* @__PURE__ */ jsx4("div", { className: authDividerLineClassName })
|
|
464
838
|
] }) : null,
|
|
465
|
-
walletMethods.length > 0 ? /* @__PURE__ */
|
|
839
|
+
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(
|
|
466
840
|
AuthMethodActionButton,
|
|
467
841
|
{
|
|
468
842
|
activeMethodId,
|
|
@@ -473,10 +847,10 @@ var UnauthenticatedConnectView = ({
|
|
|
473
847
|
},
|
|
474
848
|
method.id
|
|
475
849
|
)) }) }) : null,
|
|
476
|
-
/* @__PURE__ */
|
|
850
|
+
/* @__PURE__ */ jsxs2("p", { className: authLegalTextClassName, children: [
|
|
477
851
|
labels.auth.legalNoticePrefix,
|
|
478
852
|
" ",
|
|
479
|
-
/* @__PURE__ */
|
|
853
|
+
/* @__PURE__ */ jsx4(
|
|
480
854
|
"a",
|
|
481
855
|
{
|
|
482
856
|
className: cn(authHelperLinkClassName, classNames == null ? void 0 : classNames.authHelperLink),
|
|
@@ -489,7 +863,7 @@ var UnauthenticatedConnectView = ({
|
|
|
489
863
|
" ",
|
|
490
864
|
labels.auth.legalNoticeSeparator,
|
|
491
865
|
" ",
|
|
492
|
-
/* @__PURE__ */
|
|
866
|
+
/* @__PURE__ */ jsx4(
|
|
493
867
|
"a",
|
|
494
868
|
{
|
|
495
869
|
className: cn(authHelperLinkClassName, classNames == null ? void 0 : classNames.authHelperLink),
|
|
@@ -501,7 +875,7 @@ var UnauthenticatedConnectView = ({
|
|
|
501
875
|
),
|
|
502
876
|
"."
|
|
503
877
|
] }),
|
|
504
|
-
errorMessage ? /* @__PURE__ */
|
|
878
|
+
errorMessage ? /* @__PURE__ */ jsx4(
|
|
505
879
|
InlineAlert,
|
|
506
880
|
{
|
|
507
881
|
tone: "error",
|
|
@@ -576,7 +950,7 @@ var AuthConnectButtonView = ({
|
|
|
576
950
|
classNames == null ? void 0 : classNames.profileMenuActionItem
|
|
577
951
|
);
|
|
578
952
|
if (!isAuthenticated) {
|
|
579
|
-
return /* @__PURE__ */
|
|
953
|
+
return /* @__PURE__ */ jsx4(
|
|
580
954
|
UnauthenticatedConnectView,
|
|
581
955
|
{
|
|
582
956
|
activeMethodId,
|
|
@@ -600,21 +974,21 @@ var AuthConnectButtonView = ({
|
|
|
600
974
|
}
|
|
601
975
|
);
|
|
602
976
|
}
|
|
603
|
-
return /* @__PURE__ */
|
|
604
|
-
/* @__PURE__ */
|
|
605
|
-
/* @__PURE__ */
|
|
977
|
+
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: [
|
|
978
|
+
/* @__PURE__ */ jsxs2("div", { className: cn(connectedBalanceChipClassName, classNames == null ? void 0 : classNames.balanceChip), children: [
|
|
979
|
+
/* @__PURE__ */ jsx4("div", { className: "hidden lg:inline-flex", children: /* @__PURE__ */ jsx4(
|
|
606
980
|
ConditionalWrapper,
|
|
607
981
|
{
|
|
608
982
|
condition: isDepositBlocked,
|
|
609
|
-
wrapper: (children) => /* @__PURE__ */
|
|
983
|
+
wrapper: (children) => /* @__PURE__ */ jsx4(
|
|
610
984
|
Tooltip,
|
|
611
985
|
{
|
|
612
|
-
content: /* @__PURE__ */
|
|
986
|
+
content: /* @__PURE__ */ jsx4("p", { className: "text-center", children: labels.auth.depositGeoBlocked }),
|
|
613
987
|
sideOffset: 4,
|
|
614
988
|
children
|
|
615
989
|
}
|
|
616
990
|
),
|
|
617
|
-
children: /* @__PURE__ */
|
|
991
|
+
children: /* @__PURE__ */ jsx4(
|
|
618
992
|
Button,
|
|
619
993
|
__spreadProps(__spreadValues({
|
|
620
994
|
variant: "primary",
|
|
@@ -627,17 +1001,17 @@ var AuthConnectButtonView = ({
|
|
|
627
1001
|
)
|
|
628
1002
|
}
|
|
629
1003
|
) }),
|
|
630
|
-
/* @__PURE__ */
|
|
631
|
-
/* @__PURE__ */
|
|
632
|
-
/* @__PURE__ */
|
|
633
|
-
claimReadyCount > 0 ? /* @__PURE__ */
|
|
1004
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
|
|
1005
|
+
/* @__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" }) }),
|
|
1006
|
+
/* @__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) }),
|
|
1007
|
+
claimReadyCount > 0 ? /* @__PURE__ */ jsx4(
|
|
634
1008
|
Tooltip,
|
|
635
1009
|
{
|
|
636
1010
|
size: "medium",
|
|
637
1011
|
classNames: { content: "px-5 py-4" },
|
|
638
|
-
content: /* @__PURE__ */
|
|
639
|
-
/* @__PURE__ */
|
|
640
|
-
onClaimWinningsClick ? /* @__PURE__ */
|
|
1012
|
+
content: /* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center gap-2", children: [
|
|
1013
|
+
/* @__PURE__ */ jsx4("p", { children: resolveClaimTooltipLabel(claimReadyCount) }),
|
|
1014
|
+
onClaimWinningsClick ? /* @__PURE__ */ jsxs2(
|
|
641
1015
|
"button",
|
|
642
1016
|
{
|
|
643
1017
|
type: "button",
|
|
@@ -645,7 +1019,7 @@ var AuthConnectButtonView = ({
|
|
|
645
1019
|
onClick: onClaimWinningsClick,
|
|
646
1020
|
children: [
|
|
647
1021
|
claimWinningsLabel,
|
|
648
|
-
/* @__PURE__ */
|
|
1022
|
+
/* @__PURE__ */ jsx4(
|
|
649
1023
|
Icon,
|
|
650
1024
|
{
|
|
651
1025
|
name: "arrow-right",
|
|
@@ -658,7 +1032,7 @@ var AuthConnectButtonView = ({
|
|
|
658
1032
|
}
|
|
659
1033
|
) : null
|
|
660
1034
|
] }),
|
|
661
|
-
children: /* @__PURE__ */
|
|
1035
|
+
children: /* @__PURE__ */ jsx4(
|
|
662
1036
|
"span",
|
|
663
1037
|
{
|
|
664
1038
|
className: cn(
|
|
@@ -675,13 +1049,13 @@ var AuthConnectButtonView = ({
|
|
|
675
1049
|
}
|
|
676
1050
|
) : null
|
|
677
1051
|
] }),
|
|
678
|
-
/* @__PURE__ */
|
|
679
|
-
/* @__PURE__ */
|
|
680
|
-
/* @__PURE__ */
|
|
1052
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
|
|
1053
|
+
/* @__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" }) }),
|
|
1054
|
+
/* @__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) })
|
|
681
1055
|
] })
|
|
682
1056
|
] }),
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
-
/* @__PURE__ */
|
|
1057
|
+
/* @__PURE__ */ jsxs2(DropdownMenu.Root, { open: isProfileMenuOpen, onOpenChange: onProfileMenuOpenChange, children: [
|
|
1058
|
+
/* @__PURE__ */ jsx4(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs2(
|
|
685
1059
|
"button",
|
|
686
1060
|
{
|
|
687
1061
|
type: "button",
|
|
@@ -699,19 +1073,19 @@ var AuthConnectButtonView = ({
|
|
|
699
1073
|
disabled,
|
|
700
1074
|
"aria-label": labels.auth.walletMenuFor(resolvedProfileLabel),
|
|
701
1075
|
children: [
|
|
702
|
-
/* @__PURE__ */
|
|
703
|
-
/* @__PURE__ */
|
|
1076
|
+
/* @__PURE__ */ jsx4(WalletAvatar, { className: "size-5! md:size-6!" }),
|
|
1077
|
+
/* @__PURE__ */ jsx4(
|
|
704
1078
|
Typography,
|
|
705
1079
|
{
|
|
706
1080
|
variant: "body-strong",
|
|
707
1081
|
className: cn(
|
|
708
|
-
"whitespace-pre text-sm md:text-base leading-5 md:leading-6",
|
|
1082
|
+
"whitespace-pre text-sm md:text-base leading-5 md:leading-6 truncate",
|
|
709
1083
|
classNames == null ? void 0 : classNames.profileTriggerLabel
|
|
710
1084
|
),
|
|
711
1085
|
children: resolvedProfileLabel
|
|
712
1086
|
}
|
|
713
1087
|
),
|
|
714
|
-
/* @__PURE__ */
|
|
1088
|
+
/* @__PURE__ */ jsx4(
|
|
715
1089
|
Icon,
|
|
716
1090
|
{
|
|
717
1091
|
name: isProfileMenuOpen ? "chevron-up" : "chevron-down",
|
|
@@ -723,14 +1097,14 @@ var AuthConnectButtonView = ({
|
|
|
723
1097
|
]
|
|
724
1098
|
}
|
|
725
1099
|
) }),
|
|
726
|
-
/* @__PURE__ */
|
|
1100
|
+
/* @__PURE__ */ jsx4(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx4(
|
|
727
1101
|
DropdownMenu.Content,
|
|
728
1102
|
{
|
|
729
1103
|
className: cn(AGG_ROOT_CLASS_NAME, rootClassName, "z-50 outline-none"),
|
|
730
1104
|
"data-agg-animations": enableAnimations ? "true" : "false",
|
|
731
1105
|
sideOffset: 4,
|
|
732
1106
|
align: "end",
|
|
733
|
-
children: /* @__PURE__ */
|
|
1107
|
+
children: /* @__PURE__ */ jsxs2(
|
|
734
1108
|
"div",
|
|
735
1109
|
{
|
|
736
1110
|
className: cn(
|
|
@@ -740,7 +1114,7 @@ var AuthConnectButtonView = ({
|
|
|
740
1114
|
classNames == null ? void 0 : classNames.profileMenuContent
|
|
741
1115
|
),
|
|
742
1116
|
children: [
|
|
743
|
-
/* @__PURE__ */
|
|
1117
|
+
/* @__PURE__ */ jsxs2(
|
|
744
1118
|
"button",
|
|
745
1119
|
{
|
|
746
1120
|
type: "button",
|
|
@@ -758,15 +1132,15 @@ var AuthConnectButtonView = ({
|
|
|
758
1132
|
},
|
|
759
1133
|
disabled,
|
|
760
1134
|
children: [
|
|
761
|
-
/* @__PURE__ */
|
|
762
|
-
/* @__PURE__ */
|
|
763
|
-
/* @__PURE__ */
|
|
764
|
-
/* @__PURE__ */
|
|
765
|
-
/* @__PURE__ */
|
|
766
|
-
addressLabel ? /* @__PURE__ */
|
|
1135
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex w-full flex-row items-center justify-between gap-3", children: [
|
|
1136
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
1137
|
+
/* @__PURE__ */ jsx4(WalletAvatar, { className: "size-11" }),
|
|
1138
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex min-w-0 flex-col items-start justify-start gap-0.5", children: [
|
|
1139
|
+
/* @__PURE__ */ jsx4("p", { className: "w-full text-agg-lg font-agg-bold leading-agg-7 text-agg-foreground text-left truncate", children: resolvedProfileLabel }),
|
|
1140
|
+
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
|
|
767
1141
|
] })
|
|
768
1142
|
] }),
|
|
769
|
-
/* @__PURE__ */
|
|
1143
|
+
/* @__PURE__ */ jsx4(
|
|
770
1144
|
Icon,
|
|
771
1145
|
{
|
|
772
1146
|
name: "arrow-right",
|
|
@@ -776,10 +1150,10 @@ var AuthConnectButtonView = ({
|
|
|
776
1150
|
}
|
|
777
1151
|
)
|
|
778
1152
|
] }),
|
|
779
|
-
/* @__PURE__ */
|
|
780
|
-
/* @__PURE__ */
|
|
781
|
-
/* @__PURE__ */
|
|
782
|
-
/* @__PURE__ */
|
|
1153
|
+
/* @__PURE__ */ jsxs2("div", { className: "md:hidden flex w-full items-start gap-5", children: [
|
|
1154
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-1 min-w-0 flex-col gap-2", children: [
|
|
1155
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
1156
|
+
/* @__PURE__ */ jsx4(
|
|
783
1157
|
Icon,
|
|
784
1158
|
{
|
|
785
1159
|
name: "wallet-filled",
|
|
@@ -787,13 +1161,13 @@ var AuthConnectButtonView = ({
|
|
|
787
1161
|
className: "h-4 w-4 shrink-0 text-agg-muted-foreground"
|
|
788
1162
|
}
|
|
789
1163
|
),
|
|
790
|
-
/* @__PURE__ */
|
|
1164
|
+
/* @__PURE__ */ jsx4("span", { className: "truncate text-agg-sm leading-agg-5 text-agg-foreground", children: "Withdrawable Balance" })
|
|
791
1165
|
] }),
|
|
792
|
-
/* @__PURE__ */
|
|
1166
|
+
/* @__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) })
|
|
793
1167
|
] }),
|
|
794
|
-
/* @__PURE__ */
|
|
795
|
-
/* @__PURE__ */
|
|
796
|
-
/* @__PURE__ */
|
|
1168
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-1 min-w-0 flex-col gap-2", children: [
|
|
1169
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
1170
|
+
/* @__PURE__ */ jsx4(
|
|
797
1171
|
Icon,
|
|
798
1172
|
{
|
|
799
1173
|
name: "activity-chart",
|
|
@@ -801,85 +1175,85 @@ var AuthConnectButtonView = ({
|
|
|
801
1175
|
className: "h-4 w-4 shrink-0 text-agg-muted-foreground"
|
|
802
1176
|
}
|
|
803
1177
|
),
|
|
804
|
-
/* @__PURE__ */
|
|
1178
|
+
/* @__PURE__ */ jsx4("span", { className: "truncate text-agg-sm leading-agg-5 text-agg-foreground", children: "Positions Value" })
|
|
805
1179
|
] }),
|
|
806
|
-
/* @__PURE__ */
|
|
1180
|
+
/* @__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) })
|
|
807
1181
|
] })
|
|
808
1182
|
] })
|
|
809
1183
|
]
|
|
810
1184
|
}
|
|
811
1185
|
),
|
|
812
|
-
/* @__PURE__ */
|
|
1186
|
+
/* @__PURE__ */ jsx4(
|
|
813
1187
|
"div",
|
|
814
1188
|
{
|
|
815
1189
|
className: cn(profileMenuSeparatorClassName, classNames == null ? void 0 : classNames.profileMenuSeparator)
|
|
816
1190
|
}
|
|
817
1191
|
),
|
|
818
|
-
/* @__PURE__ */
|
|
819
|
-
/* @__PURE__ */
|
|
1192
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex w-full flex-col py-2", children: [
|
|
1193
|
+
/* @__PURE__ */ jsxs2(
|
|
820
1194
|
DropdownMenu.Item,
|
|
821
1195
|
{
|
|
822
1196
|
className: dropdownMenuItemClassName,
|
|
823
1197
|
onSelect: onProfileClick,
|
|
824
1198
|
disabled,
|
|
825
1199
|
children: [
|
|
826
|
-
/* @__PURE__ */
|
|
827
|
-
/* @__PURE__ */
|
|
1200
|
+
/* @__PURE__ */ jsx4(Icon, { name: "profile", size: "small", className: "text-agg-foreground" }),
|
|
1201
|
+
/* @__PURE__ */ jsx4("span", { children: labels.auth.myProfile })
|
|
828
1202
|
]
|
|
829
1203
|
}
|
|
830
1204
|
),
|
|
831
|
-
isDepositBlocked ? /* @__PURE__ */
|
|
1205
|
+
isDepositBlocked ? /* @__PURE__ */ jsx4(
|
|
832
1206
|
DropdownMenu.Item,
|
|
833
1207
|
{
|
|
834
1208
|
className: cn(dropdownMenuItemClassName, "opacity-50 cursor-not-allowed!"),
|
|
835
1209
|
onSelect: (e) => e.preventDefault(),
|
|
836
1210
|
"aria-disabled": "true",
|
|
837
|
-
children: /* @__PURE__ */
|
|
1211
|
+
children: /* @__PURE__ */ jsx4(
|
|
838
1212
|
Tooltip,
|
|
839
1213
|
{
|
|
840
|
-
content: /* @__PURE__ */
|
|
1214
|
+
content: /* @__PURE__ */ jsx4("p", { className: "text-center", children: labels.auth.depositGeoBlocked }),
|
|
841
1215
|
side: "bottom",
|
|
842
1216
|
sideOffset: 4,
|
|
843
|
-
children: /* @__PURE__ */
|
|
844
|
-
/* @__PURE__ */
|
|
845
|
-
/* @__PURE__ */
|
|
1217
|
+
children: /* @__PURE__ */ jsxs2("span", { className: "inline-flex items-center gap-3", children: [
|
|
1218
|
+
/* @__PURE__ */ jsx4(Icon, { name: "download", size: "small", className: "text-agg-foreground" }),
|
|
1219
|
+
/* @__PURE__ */ jsx4("span", { children: labels.auth.deposit })
|
|
846
1220
|
] })
|
|
847
1221
|
}
|
|
848
1222
|
)
|
|
849
1223
|
}
|
|
850
|
-
) : /* @__PURE__ */
|
|
1224
|
+
) : /* @__PURE__ */ jsxs2(
|
|
851
1225
|
DropdownMenu.Item,
|
|
852
1226
|
{
|
|
853
1227
|
className: dropdownMenuItemClassName,
|
|
854
1228
|
onSelect: onDepositClick,
|
|
855
1229
|
disabled,
|
|
856
1230
|
children: [
|
|
857
|
-
/* @__PURE__ */
|
|
858
|
-
/* @__PURE__ */
|
|
1231
|
+
/* @__PURE__ */ jsx4(Icon, { name: "download", size: "small", className: "text-agg-foreground" }),
|
|
1232
|
+
/* @__PURE__ */ jsx4("span", { children: labels.auth.deposit })
|
|
859
1233
|
]
|
|
860
1234
|
}
|
|
861
1235
|
),
|
|
862
|
-
/* @__PURE__ */
|
|
1236
|
+
/* @__PURE__ */ jsxs2(
|
|
863
1237
|
DropdownMenu.Item,
|
|
864
1238
|
{
|
|
865
1239
|
className: dropdownMenuItemClassName,
|
|
866
1240
|
onSelect: onWithdrawClick,
|
|
867
1241
|
disabled,
|
|
868
1242
|
children: [
|
|
869
|
-
/* @__PURE__ */
|
|
870
|
-
/* @__PURE__ */
|
|
1243
|
+
/* @__PURE__ */ jsx4(Icon, { name: "upload", size: "small", className: "text-agg-foreground" }),
|
|
1244
|
+
/* @__PURE__ */ jsx4("span", { children: labels.auth.withdraw })
|
|
871
1245
|
]
|
|
872
1246
|
}
|
|
873
1247
|
),
|
|
874
|
-
/* @__PURE__ */
|
|
1248
|
+
/* @__PURE__ */ jsxs2(
|
|
875
1249
|
DropdownMenu.Item,
|
|
876
1250
|
{
|
|
877
1251
|
className: dropdownMenuItemClassName,
|
|
878
1252
|
onSelect: onDisconnectClick,
|
|
879
1253
|
disabled,
|
|
880
1254
|
children: [
|
|
881
|
-
/* @__PURE__ */
|
|
882
|
-
/* @__PURE__ */
|
|
1255
|
+
/* @__PURE__ */ jsx4(Icon, { name: "disconnect", size: "small", className: "text-agg-foreground" }),
|
|
1256
|
+
/* @__PURE__ */ jsx4("span", { children: labels.auth.disconnect })
|
|
883
1257
|
]
|
|
884
1258
|
}
|
|
885
1259
|
)
|
|
@@ -902,6 +1276,9 @@ export {
|
|
|
902
1276
|
ActivityChartIcon,
|
|
903
1277
|
AggErrorBoundary,
|
|
904
1278
|
AggLogo,
|
|
1279
|
+
AggNotificationEventsProvider,
|
|
1280
|
+
AggProvider,
|
|
1281
|
+
AggToastProvider,
|
|
905
1282
|
AppleIcon,
|
|
906
1283
|
AppsIcon,
|
|
907
1284
|
ArbitrumIcon,
|
|
@@ -949,11 +1326,13 @@ export {
|
|
|
949
1326
|
EventList,
|
|
950
1327
|
EventListItem,
|
|
951
1328
|
EventListItemDetails,
|
|
1329
|
+
EventListItemV2,
|
|
952
1330
|
EventMarketPage,
|
|
953
1331
|
ExternalLinkIcon,
|
|
954
1332
|
Footer,
|
|
955
1333
|
GeoBlockBanner,
|
|
956
1334
|
GeoBlockModal,
|
|
1335
|
+
GiftBonusIcon,
|
|
957
1336
|
GoogleIcon,
|
|
958
1337
|
Header,
|
|
959
1338
|
HomePage,
|