@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.
- package/dist/{chunk-K23CJ5UP.mjs → chunk-3JXBOU24.mjs} +580 -307
- package/dist/{chunk-5MTIBPDY.mjs → chunk-4WBQTUPW.mjs} +1091 -441
- package/dist/{chunk-5PSAIGOT.mjs → chunk-IBOE7DRY.mjs} +137 -61
- package/dist/{chunk-XKADJNAJ.mjs → chunk-J6WELNCX.mjs} +601 -326
- package/dist/{chunk-7JKGAWU5.mjs → chunk-U55T5BPE.mjs} +1802 -1564
- package/dist/{chunk-QFW5NDJ6.mjs → chunk-X3KCFWXN.mjs} +1312 -1040
- package/dist/{chunk-5MDFM2MX.mjs → chunk-YSW4ULL5.mjs} +1 -1
- package/dist/events.js +2892 -1746
- package/dist/events.mjs +3 -3
- package/dist/index.js +7085 -4956
- package/dist/index.mjs +520 -139
- package/dist/modals.js +3434 -2315
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +4175 -2764
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +1295 -942
- package/dist/primitives.mjs +5 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +1677 -1249
- 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/deposit/deposit-modal.types.d.mts +10 -1
- package/dist/types/deposit/deposit-modal.types.d.ts +10 -1
- package/dist/types/deposit/index.d.mts +1 -1
- package/dist/types/deposit/index.d.ts +1 -1
- package/dist/types/deposit/steps/crypto-transfer.d.mts +1 -2
- package/dist/types/deposit/steps/crypto-transfer.d.ts +1 -2
- package/dist/types/deposit/steps/deposit-method.d.mts +2 -1
- package/dist/types/deposit/steps/deposit-method.d.ts +2 -1
- package/dist/types/events/item/event-list-item.types.d.mts +3 -1
- package/dist/types/events/item/event-list-item.types.d.ts +3 -1
- package/dist/types/events/item/event-list-item.utils.d.mts +26 -2
- package/dist/types/events/item/event-list-item.utils.d.ts +26 -2
- package/dist/types/events/item-details/event-list-item-details.types.d.mts +30 -1
- package/dist/types/events/item-details/event-list-item-details.types.d.ts +30 -1
- 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/market-details/index.d.mts +1 -1
- package/dist/types/events/market-details/index.d.ts +1 -1
- package/dist/types/events/market-details/market-details.types.d.mts +27 -2
- package/dist/types/events/market-details/market-details.types.d.ts +27 -2
- package/dist/types/events/market-details/market-details.utils.d.mts +18 -4
- package/dist/types/events/market-details/market-details.utils.d.ts +18 -4
- package/dist/types/events/market-details/orderbook-aggregation.d.mts +30 -10
- package/dist/types/events/market-details/orderbook-aggregation.d.ts +30 -10
- package/dist/types/events/shared/chart-auto-fallback.d.mts +43 -0
- package/dist/types/events/shared/chart-auto-fallback.d.ts +43 -0
- package/dist/types/events/shared/display-outcome-price.d.mts +14 -0
- package/dist/types/events/shared/display-outcome-price.d.ts +14 -0
- package/dist/types/events/shared/display-outcome-venue.d.mts +30 -0
- package/dist/types/events/shared/display-outcome-venue.d.ts +30 -0
- package/dist/types/events/shared/display-reference-price.d.mts +4 -0
- package/dist/types/events/shared/display-reference-price.d.ts +4 -0
- package/dist/types/events/shared/select-outcome-price.d.mts +21 -0
- package/dist/types/events/shared/select-outcome-price.d.ts +21 -0
- 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/user-profile/components/available-balance-card.d.mts +2 -1
- package/dist/types/pages/user-profile/components/available-balance-card.d.ts +2 -1
- package/dist/types/pages/user-profile/components/positions-value-card.d.mts +2 -1
- package/dist/types/pages/user-profile/components/positions-value-card.d.ts +2 -1
- package/dist/types/pages/user-profile/index.d.mts +2 -2
- package/dist/types/pages/user-profile/index.d.ts +2 -2
- package/dist/types/pages/user-profile/user-profile.types.d.mts +54 -1
- package/dist/types/pages/user-profile/user-profile.types.d.ts +54 -1
- 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/chart/chart.utils.d.mts +9 -10
- package/dist/types/primitives/chart/chart.utils.d.ts +9 -10
- 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 +24 -0
- package/dist/types/primitives/icon/registry.d.ts +24 -0
- package/dist/types/primitives/icon/svg/circle-xmark.d.mts +5 -0
- package/dist/types/primitives/icon/svg/circle-xmark.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/icon/svg/spinner.d.mts +5 -0
- package/dist/types/primitives/icon/svg/spinner.d.ts +5 -0
- 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/toast/index.d.mts +2 -0
- package/dist/types/primitives/toast/index.d.ts +2 -0
- 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/primitives/tooltip/tooltip.types.d.mts +1 -0
- package/dist/types/primitives/tooltip/tooltip.types.d.ts +1 -0
- package/dist/types/primitives/typography/index.d.mts +1 -1
- package/dist/types/primitives/typography/index.d.ts +1 -1
- package/dist/types/primitives/typography/typography.types.d.mts +2 -0
- package/dist/types/primitives/typography/typography.types.d.ts +2 -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/shared/transfer-fee-summary.d.mts +10 -0
- package/dist/types/shared/transfer-fee-summary.d.ts +10 -0
- package/dist/types/shared/utils.d.mts +3 -0
- package/dist/types/shared/utils.d.ts +3 -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.execution-steps.d.mts +9 -0
- package/dist/types/trading/place-order/index.place-order.execution-steps.d.ts +9 -0
- package/dist/types/trading/place-order/index.place-order.types.d.mts +15 -2
- package/dist/types/trading/place-order/index.place-order.types.d.ts +15 -2
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +49 -6
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +49 -6
- package/dist/types/withdraw/index.d.mts +1 -1
- package/dist/types/withdraw/index.d.ts +1 -1
- package/dist/types/withdraw/steps/withdraw-success.d.mts +13 -7
- package/dist/types/withdraw/steps/withdraw-success.d.ts +13 -7
- package/dist/types/withdraw/steps/withdraw-success.utils.d.mts +2 -0
- package/dist/types/withdraw/steps/withdraw-success.utils.d.ts +2 -0
- package/dist/types/withdraw/withdraw-modal.types.d.mts +5 -0
- package/dist/types/withdraw/withdraw-modal.types.d.ts +5 -0
- package/package.json +3 -3
|
@@ -22,6 +22,8 @@ import {
|
|
|
22
22
|
Select,
|
|
23
23
|
StayInControlIcon,
|
|
24
24
|
SuccessCheckIcon,
|
|
25
|
+
Tabs,
|
|
26
|
+
Tooltip,
|
|
25
27
|
UsdcIcon,
|
|
26
28
|
VenueLogo,
|
|
27
29
|
WalletIcon,
|
|
@@ -31,15 +33,36 @@ import {
|
|
|
31
33
|
__spreadValues,
|
|
32
34
|
cn,
|
|
33
35
|
formatCompactUsd,
|
|
36
|
+
formatTokenAmount,
|
|
34
37
|
getMotionClassName,
|
|
35
38
|
shortenAddress,
|
|
39
|
+
useOptionalToast,
|
|
36
40
|
venueLogoLabels
|
|
37
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-X3KCFWXN.mjs";
|
|
38
42
|
|
|
39
43
|
// src/deposit/index.tsx
|
|
40
|
-
import {
|
|
41
|
-
import { useAggAuthState, useAggUiConfig, useDepositAddresses, useLabels as useLabels10 } from "@agg-build/hooks";
|
|
44
|
+
import { useAggAuthState, useAggUiConfig, useDepositAddresses, useLabels as useLabels11 } from "@agg-build/hooks";
|
|
42
45
|
import { SVM_CHAIN_IDS, useDepositFlow } from "@agg-build/hooks/deposit";
|
|
46
|
+
import { useCallback, useEffect as useEffect3, useMemo, useRef, useState as useState2 } from "react";
|
|
47
|
+
|
|
48
|
+
// src/notifications/deposit-notification-events.ts
|
|
49
|
+
var AGG_DEPOSIT_NOTIFICATION_EVENT = "agg:deposit-notification";
|
|
50
|
+
var dispatchAggDepositNotification = (detail) => {
|
|
51
|
+
if (typeof window === "undefined") return;
|
|
52
|
+
window.dispatchEvent(new CustomEvent(AGG_DEPOSIT_NOTIFICATION_EVENT, { detail }));
|
|
53
|
+
};
|
|
54
|
+
var subscribeAggDepositNotification = (handler) => {
|
|
55
|
+
if (typeof window === "undefined") return () => {
|
|
56
|
+
};
|
|
57
|
+
const handleDepositNotification = (event) => {
|
|
58
|
+
if (!(event instanceof CustomEvent)) return;
|
|
59
|
+
handler(event.detail);
|
|
60
|
+
};
|
|
61
|
+
window.addEventListener(AGG_DEPOSIT_NOTIFICATION_EVENT, handleDepositNotification);
|
|
62
|
+
return () => {
|
|
63
|
+
window.removeEventListener(AGG_DEPOSIT_NOTIFICATION_EVENT, handleDepositNotification);
|
|
64
|
+
};
|
|
65
|
+
};
|
|
43
66
|
|
|
44
67
|
// src/shared/constants.ts
|
|
45
68
|
var USDC = {
|
|
@@ -78,6 +101,12 @@ var SUPPORTED_NETWORKS = [
|
|
|
78
101
|
iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/Flow.svg",
|
|
79
102
|
tokens: [USDC]
|
|
80
103
|
},
|
|
104
|
+
{
|
|
105
|
+
value: "hyperliquid",
|
|
106
|
+
label: "Hyperliquid",
|
|
107
|
+
iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/hyperliquid.png",
|
|
108
|
+
tokens: [USDC]
|
|
109
|
+
},
|
|
81
110
|
{
|
|
82
111
|
value: "mainnet",
|
|
83
112
|
label: "Ethereum",
|
|
@@ -116,11 +145,37 @@ var mapNetworksToOptions = () => {
|
|
|
116
145
|
iconUrl: n.iconUrl
|
|
117
146
|
}));
|
|
118
147
|
};
|
|
148
|
+
var USDC_ICON_URL = "https://assets.snagsolutions.io/public/web/icons/usdc.svg";
|
|
119
149
|
var DEFAULT_CURRENCY_OPTIONS = [
|
|
120
150
|
{
|
|
121
151
|
value: "USDC",
|
|
122
152
|
label: "USDC",
|
|
123
|
-
iconUrl:
|
|
153
|
+
iconUrl: USDC_ICON_URL
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
value: "USDC.e",
|
|
157
|
+
label: "USDC.e",
|
|
158
|
+
iconUrl: USDC_ICON_URL
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
value: "USDH",
|
|
162
|
+
label: "USDH",
|
|
163
|
+
iconUrl: USDC_ICON_URL
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
value: "pUSD",
|
|
167
|
+
label: "pUSD",
|
|
168
|
+
iconUrl: USDC_ICON_URL
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
value: "USDT",
|
|
172
|
+
label: "USDT",
|
|
173
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/usdt.svg"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
value: "USDT",
|
|
177
|
+
label: "USDT",
|
|
178
|
+
iconUrl: "https://assets.snagsolutions.io/public/web/icons/usdt.svg"
|
|
124
179
|
},
|
|
125
180
|
// Add commonly-used tokens with icons. These can be overridden by props.
|
|
126
181
|
{
|
|
@@ -170,6 +225,7 @@ var CHAIN_ID_TO_SLUG = {
|
|
|
170
225
|
"137": "polygon",
|
|
171
226
|
"324": "zksync",
|
|
172
227
|
"747": "flow",
|
|
228
|
+
"1337": "hyperliquid",
|
|
173
229
|
"8453": "base",
|
|
174
230
|
"42161": "arbitrum",
|
|
175
231
|
"2741": "abstract",
|
|
@@ -236,111 +292,10 @@ var NETWORK_TO_CURRENCY_CODE = {
|
|
|
236
292
|
polygon: "USDC_POLYGON"
|
|
237
293
|
};
|
|
238
294
|
|
|
239
|
-
// src/deposit/steps/deposit-method.tsx
|
|
240
|
-
import { useLabels } from "@agg-build/hooks";
|
|
241
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
242
|
-
var DepositMethodCard = ({
|
|
243
|
-
icon,
|
|
244
|
-
title,
|
|
245
|
-
description,
|
|
246
|
-
value,
|
|
247
|
-
highlighted = false,
|
|
248
|
-
disabled = false,
|
|
249
|
-
onContinue
|
|
250
|
-
}) => /* @__PURE__ */ jsxs(
|
|
251
|
-
"div",
|
|
252
|
-
{
|
|
253
|
-
className: cn(
|
|
254
|
-
"flex items-center gap-3 sm:gap-4",
|
|
255
|
-
"rounded-xl border border-agg-separator",
|
|
256
|
-
"p-3 sm:p-4",
|
|
257
|
-
"transition-colors",
|
|
258
|
-
disabled ? "opacity-50 cursor-not-allowed pointer-events-none" : "cursor-pointer hover:bg-agg-secondary-hover",
|
|
259
|
-
highlighted ? "" : ""
|
|
260
|
-
),
|
|
261
|
-
role: "button",
|
|
262
|
-
tabIndex: disabled ? -1 : 0,
|
|
263
|
-
"aria-disabled": disabled || void 0,
|
|
264
|
-
onClick: disabled ? void 0 : onContinue,
|
|
265
|
-
onKeyDown: disabled ? void 0 : (e) => {
|
|
266
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
267
|
-
e.preventDefault();
|
|
268
|
-
onContinue();
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
|
-
children: [
|
|
272
|
-
/* @__PURE__ */ jsx("div", { className: "shrink-0 flex items-center justify-center h-10 w-10 rounded-lg bg-agg-secondary-hover", children: icon }),
|
|
273
|
-
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
274
|
-
/* @__PURE__ */ jsx("p", { className: "agg-type-body-strong text-agg-foreground", children: title }),
|
|
275
|
-
/* @__PURE__ */ jsx("p", { className: "agg-type-label text-agg-muted-foreground", children: description })
|
|
276
|
-
] }),
|
|
277
|
-
value ? /* @__PURE__ */ jsx("p", { className: "agg-type-label text-agg-muted-foreground", children: value }) : null,
|
|
278
|
-
/* @__PURE__ */ jsx("div", { className: "shrink-0 text-agg-muted-foreground", children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-5 w-5" }) })
|
|
279
|
-
]
|
|
280
|
-
}
|
|
281
|
-
);
|
|
282
|
-
var DepositMethodStep = ({
|
|
283
|
-
balance,
|
|
284
|
-
walletLabel,
|
|
285
|
-
walletBalance,
|
|
286
|
-
isWalletBalanceLoading = false,
|
|
287
|
-
showWalletMethod = true,
|
|
288
|
-
highlightedMethod,
|
|
289
|
-
depositAddressesReady = true,
|
|
290
|
-
onSelectMethod
|
|
291
|
-
}) => {
|
|
292
|
-
const labels = useLabels();
|
|
293
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
294
|
-
/* @__PURE__ */ jsx(Modal.Header, { title: labels.deposit.title, hideBorder: true }),
|
|
295
|
-
/* @__PURE__ */ jsx(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5", children: [
|
|
296
|
-
/* @__PURE__ */ jsxs("p", { className: "agg-type-body text-agg-foreground", children: [
|
|
297
|
-
labels.deposit.balancePrefix,
|
|
298
|
-
" ",
|
|
299
|
-
formatCompactUsd(balance)
|
|
300
|
-
] }),
|
|
301
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
302
|
-
showWalletMethod ? /* @__PURE__ */ jsx(
|
|
303
|
-
DepositMethodCard,
|
|
304
|
-
{
|
|
305
|
-
icon: /* @__PURE__ */ jsx(WalletIcon, { className: "h-6 w-6 text-agg-muted-foreground" }),
|
|
306
|
-
title: labels.deposit.methods.walletTitle(walletLabel),
|
|
307
|
-
description: labels.deposit.methods.walletDescription,
|
|
308
|
-
value: isWalletBalanceLoading ? /* @__PURE__ */ jsx(LoadingIcon, { size: "small" }) : formatCompactUsd(walletBalance),
|
|
309
|
-
highlighted: highlightedMethod === "wallet",
|
|
310
|
-
disabled: !depositAddressesReady,
|
|
311
|
-
onContinue: () => onSelectMethod("wallet")
|
|
312
|
-
}
|
|
313
|
-
) : null,
|
|
314
|
-
/* @__PURE__ */ jsx(
|
|
315
|
-
DepositMethodCard,
|
|
316
|
-
{
|
|
317
|
-
icon: /* @__PURE__ */ jsx(BoltIcon, { className: "h-6 w-6 text-agg-muted-foreground" }),
|
|
318
|
-
title: labels.deposit.methods.cryptoTitle,
|
|
319
|
-
description: labels.deposit.methods.cryptoDescription,
|
|
320
|
-
highlighted: highlightedMethod === "crypto",
|
|
321
|
-
disabled: !depositAddressesReady,
|
|
322
|
-
onContinue: () => onSelectMethod("crypto")
|
|
323
|
-
}
|
|
324
|
-
),
|
|
325
|
-
/* @__PURE__ */ jsx(
|
|
326
|
-
DepositMethodCard,
|
|
327
|
-
{
|
|
328
|
-
icon: /* @__PURE__ */ jsx(CreditCardIcon, { className: "h-6 w-6 text-agg-muted-foreground" }),
|
|
329
|
-
title: labels.deposit.methods.cardTitle,
|
|
330
|
-
description: labels.deposit.methods.cardDescription,
|
|
331
|
-
highlighted: highlightedMethod === "card",
|
|
332
|
-
onContinue: () => onSelectMethod("card")
|
|
333
|
-
}
|
|
334
|
-
)
|
|
335
|
-
] })
|
|
336
|
-
] }) })
|
|
337
|
-
] });
|
|
338
|
-
};
|
|
339
|
-
|
|
340
295
|
// src/deposit/steps/card-deposit.tsx
|
|
341
|
-
import { useLabels
|
|
296
|
+
import { useLabels } from "@agg-build/hooks";
|
|
342
297
|
import { useEffect, useState } from "react";
|
|
343
|
-
import { Fragment
|
|
298
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
344
299
|
var CardDepositStep = ({
|
|
345
300
|
amount,
|
|
346
301
|
currency,
|
|
@@ -356,7 +311,7 @@ var CardDepositStep = ({
|
|
|
356
311
|
onNetworkChange,
|
|
357
312
|
onContinue
|
|
358
313
|
}) => {
|
|
359
|
-
const labels =
|
|
314
|
+
const labels = useLabels();
|
|
360
315
|
const [localAmount, setLocalAmount] = useState(amount);
|
|
361
316
|
useEffect(() => {
|
|
362
317
|
setLocalAmount(amount);
|
|
@@ -366,33 +321,33 @@ var CardDepositStep = ({
|
|
|
366
321
|
const isBelowMin = minAmount != null && hasInput && numericAmount < minAmount;
|
|
367
322
|
const isValid = numericAmount > 0 && !isBelowMin;
|
|
368
323
|
const formattedMin = minAmount != null ? `$${minAmount}` : void 0;
|
|
369
|
-
return /* @__PURE__ */
|
|
370
|
-
/* @__PURE__ */
|
|
324
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
325
|
+
/* @__PURE__ */ jsx(
|
|
371
326
|
Modal.Header,
|
|
372
327
|
{
|
|
373
328
|
title: labels.deposit.cardFlow.title,
|
|
374
329
|
hideBorder: true,
|
|
375
|
-
leftElement: /* @__PURE__ */
|
|
330
|
+
leftElement: /* @__PURE__ */ jsx(
|
|
376
331
|
"button",
|
|
377
332
|
{
|
|
378
333
|
type: "button",
|
|
379
334
|
className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
|
|
380
335
|
onClick: onBack,
|
|
381
336
|
"aria-label": "Go back",
|
|
382
|
-
children: /* @__PURE__ */
|
|
337
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "h-6 w-6" })
|
|
383
338
|
}
|
|
384
339
|
)
|
|
385
340
|
}
|
|
386
341
|
),
|
|
387
|
-
/* @__PURE__ */
|
|
388
|
-
/* @__PURE__ */
|
|
389
|
-
/* @__PURE__ */
|
|
390
|
-
/* @__PURE__ */
|
|
391
|
-
/* @__PURE__ */
|
|
392
|
-
formattedMin ? /* @__PURE__ */
|
|
342
|
+
/* @__PURE__ */ jsx(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5", children: [
|
|
343
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
344
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col gap-2", children: [
|
|
345
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
346
|
+
/* @__PURE__ */ jsx("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.cardFlow.amountLabel }),
|
|
347
|
+
formattedMin ? /* @__PURE__ */ jsx("p", { className: "agg-type-label text-agg-foreground", children: labels.deposit.cardFlow.minRequired(formattedMin) }) : null
|
|
393
348
|
] }),
|
|
394
|
-
/* @__PURE__ */
|
|
395
|
-
/* @__PURE__ */
|
|
349
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-3 items-center", children: [
|
|
350
|
+
/* @__PURE__ */ jsxs(
|
|
396
351
|
"div",
|
|
397
352
|
{
|
|
398
353
|
className: cn(
|
|
@@ -400,7 +355,7 @@ var CardDepositStep = ({
|
|
|
400
355
|
isBelowMin ? "border-agg-primary border-2" : "border-agg-separator"
|
|
401
356
|
),
|
|
402
357
|
children: [
|
|
403
|
-
/* @__PURE__ */
|
|
358
|
+
/* @__PURE__ */ jsx(
|
|
404
359
|
"input",
|
|
405
360
|
{
|
|
406
361
|
type: "text",
|
|
@@ -416,11 +371,11 @@ var CardDepositStep = ({
|
|
|
416
371
|
}
|
|
417
372
|
}
|
|
418
373
|
),
|
|
419
|
-
/* @__PURE__ */
|
|
374
|
+
/* @__PURE__ */ jsx("span", { className: "agg-type-body text-agg-muted-foreground", children: "$" })
|
|
420
375
|
]
|
|
421
376
|
}
|
|
422
377
|
),
|
|
423
|
-
/* @__PURE__ */
|
|
378
|
+
/* @__PURE__ */ jsx("div", { className: "w-[100px]", children: /* @__PURE__ */ jsx(
|
|
424
379
|
Select,
|
|
425
380
|
{
|
|
426
381
|
items: [{ value: currency, label: currency }],
|
|
@@ -432,8 +387,8 @@ var CardDepositStep = ({
|
|
|
432
387
|
) })
|
|
433
388
|
] })
|
|
434
389
|
] }),
|
|
435
|
-
isBelowMin && formattedMin ? /* @__PURE__ */
|
|
436
|
-
/* @__PURE__ */
|
|
390
|
+
isBelowMin && formattedMin ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", role: "alert", "aria-live": "assertive", children: [
|
|
391
|
+
/* @__PURE__ */ jsx(
|
|
437
392
|
Icon,
|
|
438
393
|
{
|
|
439
394
|
name: "warning",
|
|
@@ -441,12 +396,12 @@ var CardDepositStep = ({
|
|
|
441
396
|
"aria-hidden": "true"
|
|
442
397
|
}
|
|
443
398
|
),
|
|
444
|
-
/* @__PURE__ */
|
|
399
|
+
/* @__PURE__ */ jsx("p", { className: "agg-type-label text-agg-error", children: labels.deposit.cardFlow.minAmountError(formattedMin) })
|
|
445
400
|
] }) : null
|
|
446
401
|
] }),
|
|
447
|
-
/* @__PURE__ */
|
|
448
|
-
/* @__PURE__ */
|
|
449
|
-
/* @__PURE__ */
|
|
402
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
403
|
+
/* @__PURE__ */ jsx("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.cardFlow.networkLabel }),
|
|
404
|
+
/* @__PURE__ */ jsx(
|
|
450
405
|
Select,
|
|
451
406
|
{
|
|
452
407
|
items: networkOptions,
|
|
@@ -457,7 +412,7 @@ var CardDepositStep = ({
|
|
|
457
412
|
}
|
|
458
413
|
)
|
|
459
414
|
] }),
|
|
460
|
-
/* @__PURE__ */
|
|
415
|
+
/* @__PURE__ */ jsx(
|
|
461
416
|
Button,
|
|
462
417
|
{
|
|
463
418
|
variant: "secondary",
|
|
@@ -472,161 +427,456 @@ var CardDepositStep = ({
|
|
|
472
427
|
] });
|
|
473
428
|
};
|
|
474
429
|
|
|
475
|
-
// src/deposit/steps/
|
|
476
|
-
import { useLabels as
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
networkLogo,
|
|
485
|
-
size = 160
|
|
486
|
-
}) {
|
|
487
|
-
const logoOverlay = networkLogo ? /* @__PURE__ */ jsx3(
|
|
488
|
-
"div",
|
|
489
|
-
{
|
|
490
|
-
className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-sm",
|
|
491
|
-
style: { width: 32, height: 32, backgroundColor: "#FFFFFF", padding: 2 },
|
|
492
|
-
children: networkLogo
|
|
493
|
-
}
|
|
494
|
-
) : networkLogoUrl ? /* @__PURE__ */ jsx3(
|
|
495
|
-
"img",
|
|
496
|
-
{
|
|
497
|
-
src: networkLogoUrl,
|
|
498
|
-
alt: "",
|
|
499
|
-
className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-sm",
|
|
500
|
-
width: 32,
|
|
501
|
-
height: 32,
|
|
502
|
-
style: { backgroundColor: "#FFFFFF", padding: 2 }
|
|
503
|
-
}
|
|
504
|
-
) : null;
|
|
505
|
-
return /* @__PURE__ */ jsx3(
|
|
506
|
-
"div",
|
|
507
|
-
{
|
|
508
|
-
className: "inline-flex items-center justify-center rounded-xl border",
|
|
509
|
-
style: {
|
|
510
|
-
padding: 16,
|
|
511
|
-
borderColor: "#E5E7EB",
|
|
512
|
-
backgroundColor: "#FFFFFF"
|
|
513
|
-
},
|
|
514
|
-
children: /* @__PURE__ */ jsxs3("div", { className: "relative", style: { width: size, height: size }, children: [
|
|
515
|
-
/* @__PURE__ */ jsx3(QRCodeSVG, { value: depositAddress, size, level: "H" }),
|
|
516
|
-
logoOverlay
|
|
517
|
-
] })
|
|
518
|
-
}
|
|
519
|
-
);
|
|
520
|
-
}
|
|
521
|
-
DepositQRCode.displayName = "DepositQRCode";
|
|
522
|
-
|
|
523
|
-
// src/deposit/steps/crypto-transfer.tsx
|
|
524
|
-
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
525
|
-
var CryptoAddressLoadingState = () => {
|
|
526
|
-
const labels = useLabels3();
|
|
527
|
-
const sendCryptoLabels = labels.deposit.sendCrypto;
|
|
528
|
-
return /* @__PURE__ */ jsxs4(
|
|
529
|
-
"div",
|
|
530
|
-
{
|
|
531
|
-
className: "flex w-full flex-col items-center justify-center gap-6 py-10 text-center text-agg-foreground",
|
|
532
|
-
role: "status",
|
|
533
|
-
"aria-live": "polite",
|
|
534
|
-
children: [
|
|
535
|
-
/* @__PURE__ */ jsx4(
|
|
536
|
-
"span",
|
|
537
|
-
{
|
|
538
|
-
className: "h-9 w-9 animate-spin rounded-full border-2 border-agg-primary/25 border-t-agg-primary",
|
|
539
|
-
"aria-hidden": "true"
|
|
540
|
-
}
|
|
541
|
-
),
|
|
542
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex w-full flex-col items-center gap-2", children: [
|
|
543
|
-
/* @__PURE__ */ jsx4("p", { className: "text-agg-base font-agg-bold leading-agg-6", children: sendCryptoLabels.addressLoadingTitle }),
|
|
544
|
-
/* @__PURE__ */ jsx4("p", { className: "max-w-[300px] text-agg-sm leading-agg-5", children: sendCryptoLabels.addressLoadingDescription })
|
|
545
|
-
] })
|
|
546
|
-
]
|
|
547
|
-
}
|
|
548
|
-
);
|
|
549
|
-
};
|
|
550
|
-
var CryptoTransferStep = ({
|
|
551
|
-
tokenOptions,
|
|
552
|
-
networkOptions,
|
|
553
|
-
selectedToken,
|
|
554
|
-
selectedNetwork,
|
|
555
|
-
depositAddress,
|
|
556
|
-
minDeposit,
|
|
557
|
-
feeEstimate,
|
|
558
|
-
eta,
|
|
559
|
-
isLoadingAddress,
|
|
560
|
-
addressError,
|
|
561
|
-
onBack,
|
|
562
|
-
onTokenChange,
|
|
563
|
-
onNetworkChange,
|
|
564
|
-
onCopyAddress,
|
|
565
|
-
onDone
|
|
430
|
+
// src/deposit/steps/card-payment-pending.tsx
|
|
431
|
+
import { useLabels as useLabels2 } from "@agg-build/hooks";
|
|
432
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
433
|
+
var CardPaymentPendingStep = ({
|
|
434
|
+
providerName,
|
|
435
|
+
walletAddress,
|
|
436
|
+
onClose,
|
|
437
|
+
onViewActivity,
|
|
438
|
+
onChooseAnotherProvider
|
|
566
439
|
}) => {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
const networkLogo = selectedNetworkOption == null ? void 0 : selectedNetworkOption.icon;
|
|
572
|
-
return /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
573
|
-
/* @__PURE__ */ jsx4(
|
|
574
|
-
Modal.Header,
|
|
440
|
+
const labels = useLabels2();
|
|
441
|
+
return /* @__PURE__ */ jsx2("div", { className: "relative", children: /* @__PURE__ */ jsxs2(Modal.Body, { classNames: { root: "px-5 py-8 sm:px-8 sm:py-10" }, children: [
|
|
442
|
+
/* @__PURE__ */ jsx2(
|
|
443
|
+
"button",
|
|
575
444
|
{
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
type: "button",
|
|
582
|
-
className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
|
|
583
|
-
onClick: onBack,
|
|
584
|
-
"aria-label": "Go back",
|
|
585
|
-
children: /* @__PURE__ */ jsx4(ChevronLeftIcon, { className: "h-6 w-6" })
|
|
586
|
-
}
|
|
587
|
-
)
|
|
445
|
+
type: "button",
|
|
446
|
+
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors cursor-pointer hover:text-agg-foreground/80",
|
|
447
|
+
onClick: onClose,
|
|
448
|
+
"aria-label": labels.common.close,
|
|
449
|
+
children: /* @__PURE__ */ jsx2(CloseIcon, { className: "h-6 w-6" })
|
|
588
450
|
}
|
|
589
451
|
),
|
|
590
|
-
/* @__PURE__ */
|
|
591
|
-
/* @__PURE__ */
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
)
|
|
603
|
-
] }),
|
|
604
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex flex-1 flex-col gap-2 min-w-0", children: [
|
|
605
|
-
/* @__PURE__ */ jsx4("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.sendCrypto.networkLabel }),
|
|
606
|
-
/* @__PURE__ */ jsx4(
|
|
607
|
-
Select,
|
|
452
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center gap-8", children: [
|
|
453
|
+
/* @__PURE__ */ jsx2("div", { className: "flex h-[60px] w-[60px] items-center justify-center text-agg-muted-foreground", children: /* @__PURE__ */ jsx2(ExternalLinkIcon, { className: "h-[60px] w-[60px]" }) }),
|
|
454
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
455
|
+
/* @__PURE__ */ jsx2("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: labels.deposit.cardFlow.pendingTitle(providerName) }),
|
|
456
|
+
/* @__PURE__ */ jsx2("p", { className: "agg-type-body text-agg-foreground", children: labels.deposit.cardFlow.pendingDescription })
|
|
457
|
+
] }),
|
|
458
|
+
walletAddress ? /* @__PURE__ */ jsxs2("div", { className: "flex w-full flex-col items-center gap-3 rounded-agg-md bg-agg-secondary-hover p-5", children: [
|
|
459
|
+
/* @__PURE__ */ jsx2("p", { className: "agg-type-label text-agg-foreground w-full", children: labels.deposit.cardFlow.pendingWalletAddressHelp }),
|
|
460
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex w-full h-10 items-center gap-2 rounded border border-agg-separator bg-agg-secondary px-3 py-[10px]", children: [
|
|
461
|
+
/* @__PURE__ */ jsx2("p", { className: "agg-type-body flex-1 min-w-0 truncate text-agg-foreground", children: walletAddress }),
|
|
462
|
+
/* @__PURE__ */ jsx2(
|
|
463
|
+
CopyButton,
|
|
608
464
|
{
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
ariaLabel: labels.deposit.sendCrypto.networkLabel
|
|
465
|
+
value: walletAddress,
|
|
466
|
+
"aria-label": labels.deposit.cardFlow.pendingCopyAddress,
|
|
467
|
+
className: "text-agg-muted-foreground hover:text-agg-foreground"
|
|
613
468
|
}
|
|
614
469
|
)
|
|
615
470
|
] })
|
|
616
|
-
] })
|
|
617
|
-
/* @__PURE__ */
|
|
618
|
-
|
|
471
|
+
] }) : null,
|
|
472
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-start justify-center gap-3", children: [
|
|
473
|
+
/* @__PURE__ */ jsx2(Button, { variant: "secondary", size: "large", className: "w-[120px]", onClick: onClose, children: labels.common.close }),
|
|
474
|
+
/* @__PURE__ */ jsx2(Button, { variant: "primary", size: "large", onClick: onViewActivity, children: labels.deposit.cardFlow.viewActivity })
|
|
475
|
+
] }),
|
|
476
|
+
/* @__PURE__ */ jsx2(
|
|
477
|
+
"button",
|
|
619
478
|
{
|
|
620
|
-
|
|
479
|
+
type: "button",
|
|
480
|
+
className: "agg-type-body font-agg-bold text-agg-primary transition-colors cursor-pointer hover:text-agg-primary/80",
|
|
481
|
+
onClick: onChooseAnotherProvider,
|
|
482
|
+
children: labels.deposit.cardFlow.chooseAnotherProvider
|
|
483
|
+
}
|
|
484
|
+
)
|
|
485
|
+
] })
|
|
486
|
+
] }) });
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
// src/deposit/steps/card-provider.tsx
|
|
490
|
+
import { useLabels as useLabels3 } from "@agg-build/hooks";
|
|
491
|
+
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
492
|
+
var CardProviderItem = ({ provider, onSelect }) => {
|
|
493
|
+
const labels = useLabels3();
|
|
494
|
+
const badgeText = provider.badge === "best" ? labels.deposit.cardFlow.providerBadges.best : provider.badge === "low-kyc" ? labels.deposit.cardFlow.providerBadges.lowKyc : void 0;
|
|
495
|
+
return /* @__PURE__ */ jsx3(
|
|
496
|
+
"button",
|
|
497
|
+
{
|
|
498
|
+
type: "button",
|
|
499
|
+
className: "w-full rounded-xl border border-agg-separator px-4 py-3 text-left bg-agg-secondary hover:bg-agg-secondary-hover transition-colors cursor-pointer",
|
|
500
|
+
onClick: () => onSelect(provider.id),
|
|
501
|
+
children: /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between gap-4", children: [
|
|
502
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2", children: [
|
|
503
|
+
/* @__PURE__ */ jsx3("p", { className: "text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: provider.name }),
|
|
504
|
+
badgeText ? /* @__PURE__ */ jsx3(
|
|
505
|
+
"span",
|
|
506
|
+
{
|
|
507
|
+
className: `rounded border px-2 py-[2px] text-[10px] leading-[14px] font-agg-bold uppercase ${provider.badge === "best" ? "border-agg-primary/50 text-agg-primary bg-agg-secondary" : "border-agg-separator text-agg-foreground bg-agg-secondary"}`,
|
|
508
|
+
children: badgeText
|
|
509
|
+
}
|
|
510
|
+
) : null
|
|
511
|
+
] }),
|
|
512
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-4", children: [
|
|
513
|
+
/* @__PURE__ */ jsxs3("div", { className: "text-right", children: [
|
|
514
|
+
/* @__PURE__ */ jsx3("p", { className: "agg-type-body text-agg-foreground", children: provider.quote }),
|
|
515
|
+
/* @__PURE__ */ jsxs3("p", { className: "agg-type-label text-agg-muted-foreground", children: [
|
|
516
|
+
labels.deposit.cardFlow.feeLabel,
|
|
517
|
+
" ",
|
|
518
|
+
provider.fee
|
|
519
|
+
] })
|
|
520
|
+
] }),
|
|
521
|
+
/* @__PURE__ */ jsx3(ChevronRightIcon, { className: "h-5 w-5 text-agg-muted-foreground" })
|
|
522
|
+
] })
|
|
523
|
+
] })
|
|
524
|
+
}
|
|
525
|
+
);
|
|
526
|
+
};
|
|
527
|
+
var CardProviderStep = ({
|
|
528
|
+
token,
|
|
529
|
+
amount,
|
|
530
|
+
currency,
|
|
531
|
+
providers,
|
|
532
|
+
isLoading,
|
|
533
|
+
error,
|
|
534
|
+
sessionError,
|
|
535
|
+
onBack,
|
|
536
|
+
onSelectProvider,
|
|
537
|
+
onRetry
|
|
538
|
+
}) => {
|
|
539
|
+
const labels = useLabels3();
|
|
540
|
+
return /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
541
|
+
/* @__PURE__ */ jsx3(
|
|
542
|
+
Modal.Header,
|
|
543
|
+
{
|
|
544
|
+
title: labels.deposit.cardFlow.selectProviderTitle,
|
|
545
|
+
hideBorder: true,
|
|
546
|
+
leftElement: /* @__PURE__ */ jsx3(
|
|
547
|
+
"button",
|
|
548
|
+
{
|
|
549
|
+
type: "button",
|
|
550
|
+
className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
|
|
551
|
+
onClick: onBack,
|
|
552
|
+
"aria-label": labels.deposit.back,
|
|
553
|
+
children: /* @__PURE__ */ jsx3(ChevronLeftIcon, { className: "h-6 w-6" })
|
|
554
|
+
}
|
|
555
|
+
)
|
|
556
|
+
}
|
|
557
|
+
),
|
|
558
|
+
/* @__PURE__ */ jsx3(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-4", children: [
|
|
559
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1.5", children: [
|
|
560
|
+
/* @__PURE__ */ jsx3(UsdcIcon, { className: "h-4 w-4 shrink-0" }),
|
|
561
|
+
/* @__PURE__ */ jsx3("span", { className: "agg-type-body font-agg-bold text-agg-foreground", children: token }),
|
|
562
|
+
/* @__PURE__ */ jsxs3("span", { className: "agg-type-body text-agg-foreground", children: [
|
|
563
|
+
"$",
|
|
564
|
+
amount,
|
|
565
|
+
" ",
|
|
566
|
+
currency
|
|
567
|
+
] })
|
|
568
|
+
] }),
|
|
569
|
+
isLoading ? /* @__PURE__ */ jsxs3("div", { className: "flex min-h-[200px] flex-col items-center justify-center gap-3", children: [
|
|
570
|
+
/* @__PURE__ */ jsx3(LoadingIcon, { variant: "prominent" }),
|
|
571
|
+
/* @__PURE__ */ jsx3("p", { className: "agg-type-body text-agg-foreground", children: labels.deposit.cardFlow.loadingQuotes })
|
|
572
|
+
] }) : error ? /* @__PURE__ */ jsxs3("div", { className: "flex min-h-[200px] flex-col items-center justify-center gap-6 px-2 text-center", children: [
|
|
573
|
+
/* @__PURE__ */ jsx3(
|
|
574
|
+
Icon,
|
|
575
|
+
{
|
|
576
|
+
name: "quotes-warning",
|
|
577
|
+
size: "large",
|
|
578
|
+
className: "!h-9 !w-9 shrink-0 text-agg-muted-foreground",
|
|
579
|
+
color: "currentColor"
|
|
580
|
+
}
|
|
581
|
+
),
|
|
582
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex max-w-[320px] flex-col gap-2", children: [
|
|
583
|
+
/* @__PURE__ */ jsx3("p", { className: "text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: labels.deposit.cardFlow.errorLoadingQuotesTitle }),
|
|
584
|
+
/* @__PURE__ */ jsx3("p", { className: "agg-type-body text-agg-muted-foreground", children: labels.deposit.cardFlow.errorLoadingQuotesDescription })
|
|
585
|
+
] }),
|
|
586
|
+
onRetry ? /* @__PURE__ */ jsx3(Button, { variant: "secondary", size: "medium", onClick: onRetry, children: labels.deposit.cardFlow.retry }) : null
|
|
587
|
+
] }) : providers.length === 0 ? /* @__PURE__ */ jsx3("div", { className: "flex min-h-[200px] items-center justify-center", children: /* @__PURE__ */ jsx3("p", { className: "agg-type-body text-agg-muted-foreground", children: labels.deposit.cardFlow.noQuotes }) }) : /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-4", children: [
|
|
588
|
+
providers.map((provider) => /* @__PURE__ */ jsx3(
|
|
589
|
+
CardProviderItem,
|
|
590
|
+
{
|
|
591
|
+
provider,
|
|
592
|
+
onSelect: onSelectProvider
|
|
593
|
+
},
|
|
594
|
+
provider.id
|
|
595
|
+
)),
|
|
596
|
+
sessionError ? /* @__PURE__ */ jsx3("p", { className: "agg-type-label text-agg-error text-center", children: sessionError }) : null
|
|
597
|
+
] })
|
|
598
|
+
] }) })
|
|
599
|
+
] });
|
|
600
|
+
};
|
|
601
|
+
|
|
602
|
+
// src/deposit/steps/card-purchase-success.tsx
|
|
603
|
+
import { useLabels as useLabels4 } from "@agg-build/hooks";
|
|
604
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
605
|
+
var SummaryRow = ({ label, value }) => /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between border-b border-agg-separator py-2 last:border-b-0", children: [
|
|
606
|
+
/* @__PURE__ */ jsx4("p", { className: "text-[12px] leading-4 font-agg-bold uppercase text-agg-muted-foreground", children: label }),
|
|
607
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-type-label text-agg-foreground", children: value })
|
|
608
|
+
] });
|
|
609
|
+
var CardPurchaseSuccessStep = ({
|
|
610
|
+
summary,
|
|
611
|
+
onDone,
|
|
612
|
+
onClose
|
|
613
|
+
}) => {
|
|
614
|
+
const labels = useLabels4();
|
|
615
|
+
return /* @__PURE__ */ jsx4("div", { className: "relative", children: /* @__PURE__ */ jsxs4(Modal.Body, { classNames: { root: "px-5 py-8 sm:px-8 sm:py-10" }, children: [
|
|
616
|
+
/* @__PURE__ */ jsx4(
|
|
617
|
+
"button",
|
|
618
|
+
{
|
|
619
|
+
type: "button",
|
|
620
|
+
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
621
|
+
onClick: onClose,
|
|
622
|
+
"aria-label": labels.common.close,
|
|
623
|
+
children: /* @__PURE__ */ jsx4(CloseIcon, { className: "h-6 w-6" })
|
|
624
|
+
}
|
|
625
|
+
),
|
|
626
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center gap-8", children: [
|
|
627
|
+
/* @__PURE__ */ jsx4("div", { className: "flex h-[60px] w-[60px] items-center justify-center rounded-full bg-agg-success/15", children: /* @__PURE__ */ jsx4(SuccessCheckIcon, { className: "h-6 w-6 text-agg-success" }) }),
|
|
628
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
629
|
+
/* @__PURE__ */ jsx4("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: labels.deposit.cardFlow.successTitle }),
|
|
630
|
+
/* @__PURE__ */ jsx4("p", { className: "agg-type-body text-agg-foreground", children: labels.deposit.cardFlow.successDescription })
|
|
631
|
+
] }),
|
|
632
|
+
/* @__PURE__ */ jsxs4("div", { className: "w-full rounded-lg border border-agg-separator bg-agg-secondary px-3 py-1", children: [
|
|
633
|
+
/* @__PURE__ */ jsx4(
|
|
634
|
+
SummaryRow,
|
|
635
|
+
{
|
|
636
|
+
label: labels.deposit.summary.amountReceived,
|
|
637
|
+
value: summary.amountReceived
|
|
638
|
+
}
|
|
639
|
+
),
|
|
640
|
+
/* @__PURE__ */ jsx4(SummaryRow, { label: labels.deposit.summary.network, value: summary.network }),
|
|
641
|
+
/* @__PURE__ */ jsx4(SummaryRow, { label: labels.deposit.cardFlow.summary.fees, value: summary.fees })
|
|
642
|
+
] }),
|
|
643
|
+
/* @__PURE__ */ jsx4(Button, { variant: "secondary", size: "large", className: "w-[120px]", onClick: onDone, children: labels.deposit.done })
|
|
644
|
+
] })
|
|
645
|
+
] }) });
|
|
646
|
+
};
|
|
647
|
+
|
|
648
|
+
// src/deposit/steps/crypto-transfer.tsx
|
|
649
|
+
import { useLabels as useLabels6, useWithdrawEstimate } from "@agg-build/hooks";
|
|
650
|
+
|
|
651
|
+
// src/shared/transfer-fee-summary.tsx
|
|
652
|
+
import { useLabels as useLabels5 } from "@agg-build/hooks";
|
|
653
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
654
|
+
var separator = /* @__PURE__ */ jsx5("span", { className: "text-agg-muted-foreground", "aria-hidden": "true", children: "\xB7" });
|
|
655
|
+
var normalizeFeeLabel = (label) => label.replace(/\s*~\s*$/, "");
|
|
656
|
+
var TransferFeeSummary = ({
|
|
657
|
+
estimate,
|
|
658
|
+
view,
|
|
659
|
+
minDeposit,
|
|
660
|
+
eta
|
|
661
|
+
}) => {
|
|
662
|
+
const labels = useLabels5();
|
|
663
|
+
if (!estimate) return null;
|
|
664
|
+
if (view === "deposit") {
|
|
665
|
+
return /* @__PURE__ */ jsxs5("p", { className: "agg-type-label flex flex-wrap items-center gap-x-2 gap-y-1 text-agg-foreground", children: [
|
|
666
|
+
minDeposit ? /* @__PURE__ */ jsxs5("span", { children: [
|
|
667
|
+
labels.deposit.sendCrypto.minDepositPrefix,
|
|
668
|
+
" ",
|
|
669
|
+
minDeposit
|
|
670
|
+
] }) : null,
|
|
671
|
+
minDeposit ? separator : null,
|
|
672
|
+
/* @__PURE__ */ jsxs5("span", { children: [
|
|
673
|
+
normalizeFeeLabel(labels.deposit.walletFlow.feePrefix),
|
|
674
|
+
": ",
|
|
675
|
+
estimate.estimatedFees
|
|
676
|
+
] }),
|
|
677
|
+
eta ? separator : null,
|
|
678
|
+
eta ? /* @__PURE__ */ jsx5("span", { children: eta }) : null
|
|
679
|
+
] });
|
|
680
|
+
}
|
|
681
|
+
return /* @__PURE__ */ jsxs5("div", { className: "agg-type-label flex flex-wrap items-center gap-x-2 gap-y-1 text-agg-foreground", children: [
|
|
682
|
+
/* @__PURE__ */ jsxs5("span", { children: [
|
|
683
|
+
labels.withdraw.walletFlow.estimatedFees,
|
|
684
|
+
": ",
|
|
685
|
+
estimate.estimatedFees
|
|
686
|
+
] }),
|
|
687
|
+
separator,
|
|
688
|
+
/* @__PURE__ */ jsxs5("span", { className: "inline-flex items-center gap-1", children: [
|
|
689
|
+
/* @__PURE__ */ jsxs5("span", { children: [
|
|
690
|
+
labels.withdraw.walletFlow.networkReserve,
|
|
691
|
+
": ",
|
|
692
|
+
estimate.networkReserve
|
|
693
|
+
] }),
|
|
694
|
+
/* @__PURE__ */ jsx5(
|
|
695
|
+
Tooltip,
|
|
696
|
+
{
|
|
697
|
+
"aria-label": labels.withdraw.walletFlow.networkReserveTooltipAria,
|
|
698
|
+
size: "medium",
|
|
699
|
+
content: /* @__PURE__ */ jsxs5("div", { className: "text-center", children: [
|
|
700
|
+
/* @__PURE__ */ jsx5("p", { children: labels.withdraw.walletFlow.networkReserveTooltipLineOne }),
|
|
701
|
+
/* @__PURE__ */ jsx5("p", { children: labels.withdraw.walletFlow.networkReserveTooltipLineTwo })
|
|
702
|
+
] }),
|
|
703
|
+
classNames: {
|
|
704
|
+
content: "min-w-96 max-w-none!",
|
|
705
|
+
arrow: "[&_polygon]:fill-agg-background",
|
|
706
|
+
icon: "text-agg-foreground! h-3! w-3!"
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
)
|
|
710
|
+
] }),
|
|
711
|
+
separator,
|
|
712
|
+
/* @__PURE__ */ jsxs5("span", { children: [
|
|
713
|
+
labels.withdraw.walletFlow.youReceive,
|
|
714
|
+
": ",
|
|
715
|
+
estimate.youReceive
|
|
716
|
+
] })
|
|
717
|
+
] });
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
// src/deposit/components/DepositQRCode.tsx
|
|
721
|
+
import { QRCodeSVG } from "qrcode.react";
|
|
722
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
723
|
+
function DepositQRCode({
|
|
724
|
+
depositAddress,
|
|
725
|
+
networkLogoUrl,
|
|
726
|
+
networkLogo,
|
|
727
|
+
size = 160
|
|
728
|
+
}) {
|
|
729
|
+
const logoOverlay = networkLogo ? /* @__PURE__ */ jsx6(
|
|
730
|
+
"div",
|
|
731
|
+
{
|
|
732
|
+
className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-sm",
|
|
733
|
+
style: { width: 32, height: 32, backgroundColor: "#FFFFFF", padding: 2 },
|
|
734
|
+
children: networkLogo
|
|
735
|
+
}
|
|
736
|
+
) : networkLogoUrl ? /* @__PURE__ */ jsx6(
|
|
737
|
+
"img",
|
|
738
|
+
{
|
|
739
|
+
src: networkLogoUrl,
|
|
740
|
+
alt: "",
|
|
741
|
+
className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-sm",
|
|
742
|
+
width: 32,
|
|
743
|
+
height: 32,
|
|
744
|
+
style: { backgroundColor: "#FFFFFF", padding: 2 }
|
|
745
|
+
}
|
|
746
|
+
) : null;
|
|
747
|
+
return /* @__PURE__ */ jsx6(
|
|
748
|
+
"div",
|
|
749
|
+
{
|
|
750
|
+
className: "inline-flex items-center justify-center rounded-xl border",
|
|
751
|
+
style: {
|
|
752
|
+
padding: 16,
|
|
753
|
+
borderColor: "#E5E7EB",
|
|
754
|
+
backgroundColor: "#FFFFFF"
|
|
755
|
+
},
|
|
756
|
+
children: /* @__PURE__ */ jsxs6("div", { className: "relative", style: { width: size, height: size }, children: [
|
|
757
|
+
/* @__PURE__ */ jsx6(QRCodeSVG, { value: depositAddress, size, level: "H" }),
|
|
758
|
+
logoOverlay
|
|
759
|
+
] })
|
|
760
|
+
}
|
|
761
|
+
);
|
|
762
|
+
}
|
|
763
|
+
DepositQRCode.displayName = "DepositQRCode";
|
|
764
|
+
|
|
765
|
+
// src/deposit/steps/crypto-transfer.tsx
|
|
766
|
+
import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
767
|
+
var CryptoAddressLoadingState = () => {
|
|
768
|
+
const labels = useLabels6();
|
|
769
|
+
const sendCryptoLabels = labels.deposit.sendCrypto;
|
|
770
|
+
return /* @__PURE__ */ jsxs7(
|
|
771
|
+
"div",
|
|
772
|
+
{
|
|
773
|
+
className: "flex w-full flex-col items-center justify-center gap-6 py-10 text-center text-agg-foreground",
|
|
774
|
+
role: "status",
|
|
775
|
+
"aria-live": "polite",
|
|
776
|
+
children: [
|
|
777
|
+
/* @__PURE__ */ jsx7(
|
|
778
|
+
"span",
|
|
779
|
+
{
|
|
780
|
+
className: "h-9 w-9 animate-spin rounded-full border-2 border-agg-primary/25 border-t-agg-primary",
|
|
781
|
+
"aria-hidden": "true"
|
|
782
|
+
}
|
|
783
|
+
),
|
|
784
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex w-full flex-col items-center gap-2", children: [
|
|
785
|
+
/* @__PURE__ */ jsx7("p", { className: "text-agg-base font-agg-bold leading-agg-6", children: sendCryptoLabels.addressLoadingTitle }),
|
|
786
|
+
/* @__PURE__ */ jsx7("p", { className: "max-w-[300px] text-agg-sm leading-agg-5", children: sendCryptoLabels.addressLoadingDescription })
|
|
787
|
+
] })
|
|
788
|
+
]
|
|
789
|
+
}
|
|
790
|
+
);
|
|
791
|
+
};
|
|
792
|
+
var getEstimateAmountFromMinDeposit = (minDeposit) => {
|
|
793
|
+
const numericMinDeposit = minDeposit.replace(/[^0-9.]/g, "");
|
|
794
|
+
return numericMinDeposit || "1";
|
|
795
|
+
};
|
|
796
|
+
var CryptoTransferStep = ({
|
|
797
|
+
tokenOptions,
|
|
798
|
+
networkOptions,
|
|
799
|
+
selectedToken,
|
|
800
|
+
selectedNetwork,
|
|
801
|
+
depositAddress,
|
|
802
|
+
minDeposit,
|
|
803
|
+
eta,
|
|
804
|
+
isLoadingAddress,
|
|
805
|
+
addressError,
|
|
806
|
+
onBack,
|
|
807
|
+
onTokenChange,
|
|
808
|
+
onNetworkChange,
|
|
809
|
+
onCopyAddress,
|
|
810
|
+
onDone
|
|
811
|
+
}) => {
|
|
812
|
+
var _a;
|
|
813
|
+
const labels = useLabels6();
|
|
814
|
+
const selectedNetworkOption = networkOptions.find((n) => n.value === selectedNetwork);
|
|
815
|
+
const networkLogoUrl = (_a = selectedNetworkOption == null ? void 0 : selectedNetworkOption.iconUrl) != null ? _a : "";
|
|
816
|
+
const networkLogo = selectedNetworkOption == null ? void 0 : selectedNetworkOption.icon;
|
|
817
|
+
const transferFeeEstimate = useWithdrawEstimate({
|
|
818
|
+
amount: getEstimateAmountFromMinDeposit(minDeposit),
|
|
819
|
+
selectedToken,
|
|
820
|
+
selectedNetwork
|
|
821
|
+
});
|
|
822
|
+
return /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
823
|
+
/* @__PURE__ */ jsx7(
|
|
824
|
+
Modal.Header,
|
|
825
|
+
{
|
|
826
|
+
title: labels.deposit.sendCrypto.title,
|
|
827
|
+
hideBorder: true,
|
|
828
|
+
leftElement: /* @__PURE__ */ jsx7(
|
|
829
|
+
"button",
|
|
830
|
+
{
|
|
831
|
+
type: "button",
|
|
832
|
+
className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
|
|
833
|
+
onClick: onBack,
|
|
834
|
+
"aria-label": "Go back",
|
|
835
|
+
children: /* @__PURE__ */ jsx7(ChevronLeftIcon, { className: "h-6 w-6" })
|
|
836
|
+
}
|
|
837
|
+
)
|
|
838
|
+
}
|
|
839
|
+
),
|
|
840
|
+
/* @__PURE__ */ jsx7(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-7", children: [
|
|
841
|
+
/* @__PURE__ */ jsx7("div", { className: "flex flex-col gap-5", children: /* @__PURE__ */ jsxs7("div", { className: "flex gap-5", children: [
|
|
842
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex flex-1 flex-col gap-2 min-w-0", children: [
|
|
843
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.sendCrypto.tokenLabel }),
|
|
844
|
+
/* @__PURE__ */ jsx7(
|
|
845
|
+
Select,
|
|
846
|
+
{
|
|
847
|
+
items: tokenOptions,
|
|
848
|
+
value: selectedToken,
|
|
849
|
+
onChange: onTokenChange,
|
|
850
|
+
ariaLabel: labels.deposit.sendCrypto.tokenLabel
|
|
851
|
+
}
|
|
852
|
+
)
|
|
853
|
+
] }),
|
|
854
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex flex-1 flex-col gap-2 min-w-0", children: [
|
|
855
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.sendCrypto.networkLabel }),
|
|
856
|
+
/* @__PURE__ */ jsx7(
|
|
857
|
+
Select,
|
|
858
|
+
{
|
|
859
|
+
items: networkOptions,
|
|
860
|
+
value: selectedNetwork,
|
|
861
|
+
onChange: onNetworkChange,
|
|
862
|
+
ariaLabel: labels.deposit.sendCrypto.networkLabel
|
|
863
|
+
}
|
|
864
|
+
)
|
|
865
|
+
] })
|
|
866
|
+
] }) }),
|
|
867
|
+
/* @__PURE__ */ jsx7("div", { className: "mx-auto", children: isLoadingAddress ? /* @__PURE__ */ jsx7(CryptoAddressLoadingState, {}) : addressError ? /* @__PURE__ */ jsx7("div", { className: "flex h-[192px] w-[192px] items-center justify-center rounded-xl border border-agg-separator bg-agg-secondary", children: /* @__PURE__ */ jsx7("p", { className: "agg-type-label text-center text-agg-error px-3", children: addressError }) }) : /* @__PURE__ */ jsx7(
|
|
868
|
+
DepositQRCode,
|
|
869
|
+
{
|
|
870
|
+
depositAddress,
|
|
621
871
|
networkLogoUrl,
|
|
622
872
|
networkLogo
|
|
623
873
|
}
|
|
624
874
|
) }),
|
|
625
|
-
/* @__PURE__ */
|
|
626
|
-
/* @__PURE__ */
|
|
627
|
-
/* @__PURE__ */
|
|
628
|
-
isLoadingAddress ? /* @__PURE__ */
|
|
629
|
-
/* @__PURE__ */
|
|
875
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-3", children: [
|
|
876
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.sendCrypto.depositAddressLabel }),
|
|
877
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2 rounded border border-agg-separator bg-agg-secondary h-10 px-3", children: [
|
|
878
|
+
isLoadingAddress ? /* @__PURE__ */ jsx7("div", { className: "h-4 flex-1 animate-pulse rounded bg-agg-muted-foreground/20" }) : /* @__PURE__ */ jsx7("p", { className: "agg-type-body flex-1 min-w-0 truncate text-agg-foreground", children: depositAddress }),
|
|
879
|
+
/* @__PURE__ */ jsx7(
|
|
630
880
|
CopyButton,
|
|
631
881
|
{
|
|
632
882
|
value: depositAddress,
|
|
@@ -638,29 +888,139 @@ var CryptoTransferStep = ({
|
|
|
638
888
|
}
|
|
639
889
|
)
|
|
640
890
|
] }),
|
|
641
|
-
/* @__PURE__ */
|
|
891
|
+
/* @__PURE__ */ jsx7(
|
|
892
|
+
TransferFeeSummary,
|
|
893
|
+
{
|
|
894
|
+
estimate: transferFeeEstimate,
|
|
895
|
+
view: "deposit",
|
|
896
|
+
minDeposit,
|
|
897
|
+
eta
|
|
898
|
+
}
|
|
899
|
+
)
|
|
900
|
+
] }),
|
|
901
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-start gap-3 rounded-lg bg-agg-secondary-hover p-3", children: [
|
|
902
|
+
/* @__PURE__ */ jsx7(WarningIcon, { className: "h-4 w-4 text-agg-muted-foreground mt-0.5" }),
|
|
903
|
+
/* @__PURE__ */ jsx7("p", { className: "text-agg-xs leading-agg-4 text-agg-foreground", children: labels.deposit.sendCrypto.warning })
|
|
904
|
+
] }),
|
|
905
|
+
/* @__PURE__ */ jsx7(
|
|
906
|
+
Button,
|
|
907
|
+
{
|
|
908
|
+
variant: "secondary",
|
|
909
|
+
size: "large",
|
|
910
|
+
className: "w-[120px] self-center",
|
|
911
|
+
onClick: onDone,
|
|
912
|
+
children: labels.deposit.done
|
|
913
|
+
}
|
|
914
|
+
)
|
|
915
|
+
] }) })
|
|
916
|
+
] });
|
|
917
|
+
};
|
|
918
|
+
|
|
919
|
+
// src/deposit/steps/deposit-method.tsx
|
|
920
|
+
import { useLabels as useLabels7 } from "@agg-build/hooks";
|
|
921
|
+
import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
922
|
+
var DepositMethodCard = ({
|
|
923
|
+
icon,
|
|
924
|
+
title,
|
|
925
|
+
description,
|
|
926
|
+
value,
|
|
927
|
+
highlighted = false,
|
|
928
|
+
disabled = false,
|
|
929
|
+
onContinue
|
|
930
|
+
}) => /* @__PURE__ */ jsxs8(
|
|
931
|
+
"div",
|
|
932
|
+
{
|
|
933
|
+
className: cn(
|
|
934
|
+
"flex items-center gap-3 sm:gap-4",
|
|
935
|
+
"rounded-xl border border-agg-separator",
|
|
936
|
+
"p-3 sm:p-4",
|
|
937
|
+
"transition-colors",
|
|
938
|
+
disabled ? "opacity-50 cursor-not-allowed pointer-events-none" : "cursor-pointer hover:bg-agg-secondary-hover",
|
|
939
|
+
highlighted ? "" : ""
|
|
940
|
+
),
|
|
941
|
+
role: "button",
|
|
942
|
+
tabIndex: disabled ? -1 : 0,
|
|
943
|
+
"aria-disabled": disabled || void 0,
|
|
944
|
+
onClick: disabled ? void 0 : onContinue,
|
|
945
|
+
onKeyDown: disabled ? void 0 : (e) => {
|
|
946
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
947
|
+
e.preventDefault();
|
|
948
|
+
onContinue();
|
|
949
|
+
}
|
|
950
|
+
},
|
|
951
|
+
children: [
|
|
952
|
+
/* @__PURE__ */ jsx8("div", { className: "shrink-0 flex items-center justify-center h-10 w-10 rounded-lg bg-agg-secondary-hover", children: icon }),
|
|
953
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex-1 min-w-0", children: [
|
|
954
|
+
/* @__PURE__ */ jsx8("p", { className: "agg-type-body-strong text-agg-foreground", children: title }),
|
|
955
|
+
/* @__PURE__ */ jsx8("p", { className: "agg-type-label text-agg-muted-foreground", children: description })
|
|
642
956
|
] }),
|
|
643
|
-
/* @__PURE__ */
|
|
644
|
-
|
|
645
|
-
|
|
957
|
+
value ? /* @__PURE__ */ jsx8("p", { className: "agg-type-label text-agg-muted-foreground", children: value }) : null,
|
|
958
|
+
/* @__PURE__ */ jsx8("div", { className: "shrink-0 text-agg-muted-foreground", children: /* @__PURE__ */ jsx8(ChevronRightIcon, { className: "h-5 w-5" }) })
|
|
959
|
+
]
|
|
960
|
+
}
|
|
961
|
+
);
|
|
962
|
+
var DepositMethodStep = ({
|
|
963
|
+
balance,
|
|
964
|
+
walletLabel,
|
|
965
|
+
walletBalance,
|
|
966
|
+
walletToken,
|
|
967
|
+
isWalletBalanceLoading = false,
|
|
968
|
+
showWalletMethod = true,
|
|
969
|
+
highlightedMethod,
|
|
970
|
+
depositAddressesReady = true,
|
|
971
|
+
onSelectMethod
|
|
972
|
+
}) => {
|
|
973
|
+
const labels = useLabels7();
|
|
974
|
+
return /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
975
|
+
/* @__PURE__ */ jsx8(Modal.Header, { title: labels.deposit.title, hideBorder: true }),
|
|
976
|
+
/* @__PURE__ */ jsx8(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-5", children: [
|
|
977
|
+
/* @__PURE__ */ jsxs8("p", { className: "agg-type-body text-agg-foreground", children: [
|
|
978
|
+
labels.deposit.balancePrefix,
|
|
979
|
+
" ",
|
|
980
|
+
formatCompactUsd(balance)
|
|
646
981
|
] }),
|
|
647
|
-
/* @__PURE__ */
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
982
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-4", children: [
|
|
983
|
+
showWalletMethod ? /* @__PURE__ */ jsx8(
|
|
984
|
+
DepositMethodCard,
|
|
985
|
+
{
|
|
986
|
+
icon: /* @__PURE__ */ jsx8(WalletIcon, { className: "h-6 w-6 text-agg-muted-foreground" }),
|
|
987
|
+
title: labels.deposit.methods.walletTitle(walletLabel),
|
|
988
|
+
description: labels.deposit.methods.walletDescription,
|
|
989
|
+
value: isWalletBalanceLoading ? /* @__PURE__ */ jsx8(LoadingIcon, { size: "small" }) : formatTokenAmount(walletBalance, walletToken),
|
|
990
|
+
highlighted: highlightedMethod === "wallet",
|
|
991
|
+
disabled: !depositAddressesReady,
|
|
992
|
+
onContinue: () => onSelectMethod("wallet")
|
|
993
|
+
}
|
|
994
|
+
) : null,
|
|
995
|
+
/* @__PURE__ */ jsx8(
|
|
996
|
+
DepositMethodCard,
|
|
997
|
+
{
|
|
998
|
+
icon: /* @__PURE__ */ jsx8(BoltIcon, { className: "h-6 w-6 text-agg-muted-foreground" }),
|
|
999
|
+
title: labels.deposit.methods.cryptoTitle,
|
|
1000
|
+
description: labels.deposit.methods.cryptoDescription,
|
|
1001
|
+
highlighted: highlightedMethod === "crypto",
|
|
1002
|
+
disabled: !depositAddressesReady,
|
|
1003
|
+
onContinue: () => onSelectMethod("crypto")
|
|
1004
|
+
}
|
|
1005
|
+
),
|
|
1006
|
+
/* @__PURE__ */ jsx8(
|
|
1007
|
+
DepositMethodCard,
|
|
1008
|
+
{
|
|
1009
|
+
icon: /* @__PURE__ */ jsx8(CreditCardIcon, { className: "h-6 w-6 text-agg-muted-foreground" }),
|
|
1010
|
+
title: labels.deposit.methods.cardTitle,
|
|
1011
|
+
description: labels.deposit.methods.cardDescription,
|
|
1012
|
+
highlighted: highlightedMethod === "card",
|
|
1013
|
+
onContinue: () => onSelectMethod("card")
|
|
1014
|
+
}
|
|
1015
|
+
)
|
|
1016
|
+
] })
|
|
657
1017
|
] }) })
|
|
658
1018
|
] });
|
|
659
1019
|
};
|
|
660
1020
|
|
|
661
1021
|
// src/deposit/steps/wallet-form.tsx
|
|
662
|
-
import { useLabels as
|
|
663
|
-
import { Fragment as
|
|
1022
|
+
import { useLabels as useLabels8 } from "@agg-build/hooks";
|
|
1023
|
+
import { Fragment as Fragment5, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
664
1024
|
var WalletFormStep = ({
|
|
665
1025
|
walletLabel,
|
|
666
1026
|
walletBalance,
|
|
@@ -683,40 +1043,40 @@ var WalletFormStep = ({
|
|
|
683
1043
|
onMax,
|
|
684
1044
|
onConfirm
|
|
685
1045
|
}) => {
|
|
686
|
-
const labels =
|
|
1046
|
+
const labels = useLabels8();
|
|
687
1047
|
const isConfirmEnabled = !isSubmitting && !isBalanceLoading && Number(amount) > 0 && Number(amount) <= walletBalance;
|
|
688
|
-
return /* @__PURE__ */
|
|
689
|
-
/* @__PURE__ */
|
|
1048
|
+
return /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
1049
|
+
/* @__PURE__ */ jsx9(
|
|
690
1050
|
Modal.Header,
|
|
691
1051
|
{
|
|
692
1052
|
title: labels.deposit.walletFlow.title,
|
|
693
1053
|
hideBorder: true,
|
|
694
|
-
leftElement: /* @__PURE__ */
|
|
1054
|
+
leftElement: /* @__PURE__ */ jsx9(
|
|
695
1055
|
"button",
|
|
696
1056
|
{
|
|
697
1057
|
type: "button",
|
|
698
1058
|
className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
|
|
699
1059
|
onClick: onBack,
|
|
700
1060
|
"aria-label": "Go back",
|
|
701
|
-
children: /* @__PURE__ */
|
|
1061
|
+
children: /* @__PURE__ */ jsx9(ChevronLeftIcon, { className: "h-6 w-6" })
|
|
702
1062
|
}
|
|
703
1063
|
)
|
|
704
1064
|
}
|
|
705
1065
|
),
|
|
706
|
-
/* @__PURE__ */
|
|
707
|
-
/* @__PURE__ */
|
|
708
|
-
/* @__PURE__ */
|
|
709
|
-
/* @__PURE__ */
|
|
1066
|
+
/* @__PURE__ */ jsx9(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-7", children: [
|
|
1067
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between", children: [
|
|
1068
|
+
/* @__PURE__ */ jsx9("p", { className: "agg-type-label text-agg-foreground", children: walletLabel }),
|
|
1069
|
+
/* @__PURE__ */ jsxs9("p", { className: "agg-type-label text-agg-muted-foreground", children: [
|
|
710
1070
|
labels.deposit.balanceLabel,
|
|
711
1071
|
" ",
|
|
712
|
-
isBalanceLoading ? /* @__PURE__ */
|
|
1072
|
+
isBalanceLoading ? /* @__PURE__ */ jsx9(LoadingIcon, { size: "small" }) : formatTokenAmount(walletBalance, selectedToken)
|
|
713
1073
|
] })
|
|
714
1074
|
] }),
|
|
715
|
-
/* @__PURE__ */
|
|
716
|
-
/* @__PURE__ */
|
|
717
|
-
/* @__PURE__ */
|
|
718
|
-
/* @__PURE__ */
|
|
719
|
-
/* @__PURE__ */
|
|
1075
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-5", children: [
|
|
1076
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex gap-5", children: [
|
|
1077
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex flex-1 flex-col gap-2 min-w-0", children: [
|
|
1078
|
+
/* @__PURE__ */ jsx9("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.walletFlow.tokenLabel }),
|
|
1079
|
+
/* @__PURE__ */ jsx9(
|
|
720
1080
|
Select,
|
|
721
1081
|
{
|
|
722
1082
|
items: tokenOptions,
|
|
@@ -726,9 +1086,9 @@ var WalletFormStep = ({
|
|
|
726
1086
|
}
|
|
727
1087
|
)
|
|
728
1088
|
] }),
|
|
729
|
-
networkOptions.length
|
|
730
|
-
/* @__PURE__ */
|
|
731
|
-
/* @__PURE__ */
|
|
1089
|
+
networkOptions.length >= 1 ? /* @__PURE__ */ jsxs9("div", { className: "flex flex-1 flex-col gap-2 min-w-0", children: [
|
|
1090
|
+
/* @__PURE__ */ jsx9("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.walletFlow.networkLabel }),
|
|
1091
|
+
/* @__PURE__ */ jsx9(
|
|
732
1092
|
Select,
|
|
733
1093
|
{
|
|
734
1094
|
items: networkOptions,
|
|
@@ -739,9 +1099,9 @@ var WalletFormStep = ({
|
|
|
739
1099
|
)
|
|
740
1100
|
] }) : null
|
|
741
1101
|
] }),
|
|
742
|
-
/* @__PURE__ */
|
|
743
|
-
/* @__PURE__ */
|
|
744
|
-
/* @__PURE__ */
|
|
1102
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-2", children: [
|
|
1103
|
+
/* @__PURE__ */ jsx9("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.walletFlow.amountLabel }),
|
|
1104
|
+
/* @__PURE__ */ jsxs9(
|
|
745
1105
|
"div",
|
|
746
1106
|
{
|
|
747
1107
|
className: cn(
|
|
@@ -750,7 +1110,7 @@ var WalletFormStep = ({
|
|
|
750
1110
|
"h-10 px-3"
|
|
751
1111
|
),
|
|
752
1112
|
children: [
|
|
753
|
-
/* @__PURE__ */
|
|
1113
|
+
/* @__PURE__ */ jsx9(
|
|
754
1114
|
"input",
|
|
755
1115
|
{
|
|
756
1116
|
type: "text",
|
|
@@ -762,7 +1122,7 @@ var WalletFormStep = ({
|
|
|
762
1122
|
onChange: (event) => onAmountChange(event.target.value)
|
|
763
1123
|
}
|
|
764
1124
|
),
|
|
765
|
-
/* @__PURE__ */
|
|
1125
|
+
/* @__PURE__ */ jsx9(
|
|
766
1126
|
"button",
|
|
767
1127
|
{
|
|
768
1128
|
type: "button",
|
|
@@ -776,8 +1136,8 @@ var WalletFormStep = ({
|
|
|
776
1136
|
}
|
|
777
1137
|
)
|
|
778
1138
|
] }),
|
|
779
|
-
estimatedReceive && feeEstimate && eta ? /* @__PURE__ */
|
|
780
|
-
formErrorMessage ? /* @__PURE__ */
|
|
1139
|
+
estimatedReceive && feeEstimate && eta ? /* @__PURE__ */ jsx9("p", { className: "agg-type-label text-agg-foreground", children: `\u2248 ${estimatedReceive} \xB7 ${labels.deposit.walletFlow.feePrefix} ${feeEstimate} \xB7 ${eta}` }) : null,
|
|
1140
|
+
formErrorMessage ? /* @__PURE__ */ jsxs9(
|
|
781
1141
|
"div",
|
|
782
1142
|
{
|
|
783
1143
|
className: cn(
|
|
@@ -785,13 +1145,13 @@ var WalletFormStep = ({
|
|
|
785
1145
|
formErrorTone === "warning" ? "text-agg-warning" : "text-agg-error"
|
|
786
1146
|
),
|
|
787
1147
|
children: [
|
|
788
|
-
/* @__PURE__ */
|
|
789
|
-
/* @__PURE__ */
|
|
1148
|
+
/* @__PURE__ */ jsx9(WarningIcon, { className: "mt-0.5 h-4 w-4 shrink-0" }),
|
|
1149
|
+
/* @__PURE__ */ jsx9("p", { className: "agg-type-label", children: formErrorMessage })
|
|
790
1150
|
]
|
|
791
1151
|
}
|
|
792
1152
|
) : null
|
|
793
1153
|
] }),
|
|
794
|
-
/* @__PURE__ */
|
|
1154
|
+
/* @__PURE__ */ jsx9(
|
|
795
1155
|
Button,
|
|
796
1156
|
{
|
|
797
1157
|
variant: isConfirmEnabled ? "primary" : "secondary",
|
|
@@ -808,248 +1168,30 @@ var WalletFormStep = ({
|
|
|
808
1168
|
] });
|
|
809
1169
|
};
|
|
810
1170
|
|
|
811
|
-
// src/deposit/steps/card-provider.tsx
|
|
812
|
-
import { useLabels as useLabels5 } from "@agg-build/hooks";
|
|
813
|
-
import { Fragment as Fragment5, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
814
|
-
var CardProviderItem = ({ provider, onSelect }) => {
|
|
815
|
-
const labels = useLabels5();
|
|
816
|
-
const badgeText = provider.badge === "best" ? labels.deposit.cardFlow.providerBadges.best : provider.badge === "low-kyc" ? labels.deposit.cardFlow.providerBadges.lowKyc : void 0;
|
|
817
|
-
return /* @__PURE__ */ jsx6(
|
|
818
|
-
"button",
|
|
819
|
-
{
|
|
820
|
-
type: "button",
|
|
821
|
-
className: "w-full rounded-xl border border-agg-separator px-4 py-3 text-left bg-agg-secondary hover:bg-agg-secondary-hover transition-colors cursor-pointer",
|
|
822
|
-
onClick: () => onSelect(provider.id),
|
|
823
|
-
children: /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-4", children: [
|
|
824
|
-
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
|
|
825
|
-
/* @__PURE__ */ jsx6("p", { className: "text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: provider.name }),
|
|
826
|
-
badgeText ? /* @__PURE__ */ jsx6(
|
|
827
|
-
"span",
|
|
828
|
-
{
|
|
829
|
-
className: `rounded border px-2 py-[2px] text-[10px] leading-[14px] font-agg-bold uppercase ${provider.badge === "best" ? "border-agg-primary/50 text-agg-primary bg-agg-secondary" : "border-agg-separator text-agg-foreground bg-agg-secondary"}`,
|
|
830
|
-
children: badgeText
|
|
831
|
-
}
|
|
832
|
-
) : null
|
|
833
|
-
] }),
|
|
834
|
-
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-4", children: [
|
|
835
|
-
/* @__PURE__ */ jsxs6("div", { className: "text-right", children: [
|
|
836
|
-
/* @__PURE__ */ jsx6("p", { className: "agg-type-body text-agg-foreground", children: provider.quote }),
|
|
837
|
-
/* @__PURE__ */ jsxs6("p", { className: "agg-type-label text-agg-muted-foreground", children: [
|
|
838
|
-
labels.deposit.cardFlow.feeLabel,
|
|
839
|
-
" ",
|
|
840
|
-
provider.fee
|
|
841
|
-
] })
|
|
842
|
-
] }),
|
|
843
|
-
/* @__PURE__ */ jsx6(ChevronRightIcon, { className: "h-5 w-5 text-agg-muted-foreground" })
|
|
844
|
-
] })
|
|
845
|
-
] })
|
|
846
|
-
}
|
|
847
|
-
);
|
|
848
|
-
};
|
|
849
|
-
var CardProviderStep = ({
|
|
850
|
-
token,
|
|
851
|
-
amount,
|
|
852
|
-
currency,
|
|
853
|
-
providers,
|
|
854
|
-
isLoading,
|
|
855
|
-
error,
|
|
856
|
-
sessionError,
|
|
857
|
-
onBack,
|
|
858
|
-
onSelectProvider,
|
|
859
|
-
onRetry
|
|
860
|
-
}) => {
|
|
861
|
-
const labels = useLabels5();
|
|
862
|
-
return /* @__PURE__ */ jsxs6(Fragment5, { children: [
|
|
863
|
-
/* @__PURE__ */ jsx6(
|
|
864
|
-
Modal.Header,
|
|
865
|
-
{
|
|
866
|
-
title: labels.deposit.cardFlow.selectProviderTitle,
|
|
867
|
-
hideBorder: true,
|
|
868
|
-
leftElement: /* @__PURE__ */ jsx6(
|
|
869
|
-
"button",
|
|
870
|
-
{
|
|
871
|
-
type: "button",
|
|
872
|
-
className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
|
|
873
|
-
onClick: onBack,
|
|
874
|
-
"aria-label": labels.deposit.back,
|
|
875
|
-
children: /* @__PURE__ */ jsx6(ChevronLeftIcon, { className: "h-6 w-6" })
|
|
876
|
-
}
|
|
877
|
-
)
|
|
878
|
-
}
|
|
879
|
-
),
|
|
880
|
-
/* @__PURE__ */ jsx6(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-4", children: [
|
|
881
|
-
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1.5", children: [
|
|
882
|
-
/* @__PURE__ */ jsx6(UsdcIcon, { className: "h-4 w-4 shrink-0" }),
|
|
883
|
-
/* @__PURE__ */ jsx6("span", { className: "agg-type-body font-agg-bold text-agg-foreground", children: token }),
|
|
884
|
-
/* @__PURE__ */ jsxs6("span", { className: "agg-type-body text-agg-foreground", children: [
|
|
885
|
-
"$",
|
|
886
|
-
amount,
|
|
887
|
-
" ",
|
|
888
|
-
currency
|
|
889
|
-
] })
|
|
890
|
-
] }),
|
|
891
|
-
isLoading ? /* @__PURE__ */ jsxs6("div", { className: "flex min-h-[200px] flex-col items-center justify-center gap-3", children: [
|
|
892
|
-
/* @__PURE__ */ jsx6(LoadingIcon, { variant: "prominent" }),
|
|
893
|
-
/* @__PURE__ */ jsx6("p", { className: "agg-type-body text-agg-foreground", children: labels.deposit.cardFlow.loadingQuotes })
|
|
894
|
-
] }) : error ? /* @__PURE__ */ jsxs6("div", { className: "flex min-h-[200px] flex-col items-center justify-center gap-6 px-2 text-center", children: [
|
|
895
|
-
/* @__PURE__ */ jsx6(
|
|
896
|
-
Icon,
|
|
897
|
-
{
|
|
898
|
-
name: "quotes-warning",
|
|
899
|
-
size: "large",
|
|
900
|
-
className: "!h-9 !w-9 shrink-0 text-agg-muted-foreground",
|
|
901
|
-
color: "currentColor"
|
|
902
|
-
}
|
|
903
|
-
),
|
|
904
|
-
/* @__PURE__ */ jsxs6("div", { className: "flex max-w-[320px] flex-col gap-2", children: [
|
|
905
|
-
/* @__PURE__ */ jsx6("p", { className: "text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: labels.deposit.cardFlow.errorLoadingQuotesTitle }),
|
|
906
|
-
/* @__PURE__ */ jsx6("p", { className: "agg-type-body text-agg-muted-foreground", children: labels.deposit.cardFlow.errorLoadingQuotesDescription })
|
|
907
|
-
] }),
|
|
908
|
-
onRetry ? /* @__PURE__ */ jsx6(Button, { variant: "secondary", size: "medium", onClick: onRetry, children: labels.deposit.cardFlow.retry }) : null
|
|
909
|
-
] }) : providers.length === 0 ? /* @__PURE__ */ jsx6("div", { className: "flex min-h-[200px] items-center justify-center", children: /* @__PURE__ */ jsx6("p", { className: "agg-type-body text-agg-muted-foreground", children: labels.deposit.cardFlow.noQuotes }) }) : /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-4", children: [
|
|
910
|
-
providers.map((provider) => /* @__PURE__ */ jsx6(
|
|
911
|
-
CardProviderItem,
|
|
912
|
-
{
|
|
913
|
-
provider,
|
|
914
|
-
onSelect: onSelectProvider
|
|
915
|
-
},
|
|
916
|
-
provider.id
|
|
917
|
-
)),
|
|
918
|
-
sessionError ? /* @__PURE__ */ jsx6("p", { className: "agg-type-label text-agg-error text-center", children: sessionError }) : null
|
|
919
|
-
] })
|
|
920
|
-
] }) })
|
|
921
|
-
] });
|
|
922
|
-
};
|
|
923
|
-
|
|
924
|
-
// src/deposit/steps/card-payment-pending.tsx
|
|
925
|
-
import { useLabels as useLabels6 } from "@agg-build/hooks";
|
|
926
|
-
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
927
|
-
var CardPaymentPendingStep = ({
|
|
928
|
-
providerName,
|
|
929
|
-
walletAddress,
|
|
930
|
-
onClose,
|
|
931
|
-
onViewActivity,
|
|
932
|
-
onChooseAnotherProvider
|
|
933
|
-
}) => {
|
|
934
|
-
const labels = useLabels6();
|
|
935
|
-
return /* @__PURE__ */ jsx7("div", { className: "relative", children: /* @__PURE__ */ jsxs7(Modal.Body, { classNames: { root: "px-5 py-8 sm:px-8 sm:py-10" }, children: [
|
|
936
|
-
/* @__PURE__ */ jsx7(
|
|
937
|
-
"button",
|
|
938
|
-
{
|
|
939
|
-
type: "button",
|
|
940
|
-
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors cursor-pointer hover:text-agg-foreground/80",
|
|
941
|
-
onClick: onClose,
|
|
942
|
-
"aria-label": labels.common.close,
|
|
943
|
-
children: /* @__PURE__ */ jsx7(CloseIcon, { className: "h-6 w-6" })
|
|
944
|
-
}
|
|
945
|
-
),
|
|
946
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex flex-col items-center gap-8", children: [
|
|
947
|
-
/* @__PURE__ */ jsx7("div", { className: "flex h-[60px] w-[60px] items-center justify-center text-agg-muted-foreground", children: /* @__PURE__ */ jsx7(ExternalLinkIcon, { className: "h-[60px] w-[60px]" }) }),
|
|
948
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
949
|
-
/* @__PURE__ */ jsx7("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: labels.deposit.cardFlow.pendingTitle(providerName) }),
|
|
950
|
-
/* @__PURE__ */ jsx7("p", { className: "agg-type-body text-agg-foreground", children: labels.deposit.cardFlow.pendingDescription })
|
|
951
|
-
] }),
|
|
952
|
-
walletAddress ? /* @__PURE__ */ jsxs7("div", { className: "flex w-full flex-col items-center gap-3 rounded-agg-md bg-agg-secondary-hover p-5", children: [
|
|
953
|
-
/* @__PURE__ */ jsx7("p", { className: "agg-type-label text-agg-foreground w-full", children: labels.deposit.cardFlow.pendingWalletAddressHelp }),
|
|
954
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex w-full h-10 items-center gap-2 rounded border border-agg-separator bg-agg-secondary px-3 py-[10px]", children: [
|
|
955
|
-
/* @__PURE__ */ jsx7("p", { className: "agg-type-body flex-1 min-w-0 truncate text-agg-foreground", children: walletAddress }),
|
|
956
|
-
/* @__PURE__ */ jsx7(
|
|
957
|
-
CopyButton,
|
|
958
|
-
{
|
|
959
|
-
value: walletAddress,
|
|
960
|
-
"aria-label": labels.deposit.cardFlow.pendingCopyAddress,
|
|
961
|
-
className: "text-agg-muted-foreground hover:text-agg-foreground"
|
|
962
|
-
}
|
|
963
|
-
)
|
|
964
|
-
] })
|
|
965
|
-
] }) : null,
|
|
966
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex items-start justify-center gap-3", children: [
|
|
967
|
-
/* @__PURE__ */ jsx7(Button, { variant: "secondary", size: "large", className: "w-[120px]", onClick: onClose, children: labels.common.close }),
|
|
968
|
-
/* @__PURE__ */ jsx7(Button, { variant: "primary", size: "large", onClick: onViewActivity, children: labels.deposit.cardFlow.viewActivity })
|
|
969
|
-
] }),
|
|
970
|
-
/* @__PURE__ */ jsx7(
|
|
971
|
-
"button",
|
|
972
|
-
{
|
|
973
|
-
type: "button",
|
|
974
|
-
className: "agg-type-body font-agg-bold text-agg-primary transition-colors cursor-pointer hover:text-agg-primary/80",
|
|
975
|
-
onClick: onChooseAnotherProvider,
|
|
976
|
-
children: labels.deposit.cardFlow.chooseAnotherProvider
|
|
977
|
-
}
|
|
978
|
-
)
|
|
979
|
-
] })
|
|
980
|
-
] }) });
|
|
981
|
-
};
|
|
982
|
-
|
|
983
|
-
// src/deposit/steps/card-purchase-success.tsx
|
|
984
|
-
import { useLabels as useLabels7 } from "@agg-build/hooks";
|
|
985
|
-
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
986
|
-
var SummaryRow = ({ label, value }) => /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between border-b border-agg-separator py-2 last:border-b-0", children: [
|
|
987
|
-
/* @__PURE__ */ jsx8("p", { className: "text-[12px] leading-4 font-agg-bold uppercase text-agg-muted-foreground", children: label }),
|
|
988
|
-
/* @__PURE__ */ jsx8("p", { className: "agg-type-label text-agg-foreground", children: value })
|
|
989
|
-
] });
|
|
990
|
-
var CardPurchaseSuccessStep = ({
|
|
991
|
-
summary,
|
|
992
|
-
onDone,
|
|
993
|
-
onClose
|
|
994
|
-
}) => {
|
|
995
|
-
const labels = useLabels7();
|
|
996
|
-
return /* @__PURE__ */ jsx8("div", { className: "relative", children: /* @__PURE__ */ jsxs8(Modal.Body, { classNames: { root: "px-5 py-8 sm:px-8 sm:py-10" }, children: [
|
|
997
|
-
/* @__PURE__ */ jsx8(
|
|
998
|
-
"button",
|
|
999
|
-
{
|
|
1000
|
-
type: "button",
|
|
1001
|
-
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
1002
|
-
onClick: onClose,
|
|
1003
|
-
"aria-label": labels.common.close,
|
|
1004
|
-
children: /* @__PURE__ */ jsx8(CloseIcon, { className: "h-6 w-6" })
|
|
1005
|
-
}
|
|
1006
|
-
),
|
|
1007
|
-
/* @__PURE__ */ jsxs8("div", { className: "flex flex-col items-center gap-8", children: [
|
|
1008
|
-
/* @__PURE__ */ jsx8("div", { className: "flex h-[60px] w-[60px] items-center justify-center rounded-full bg-agg-success/15", children: /* @__PURE__ */ jsx8(SuccessCheckIcon, { className: "h-6 w-6 text-agg-success" }) }),
|
|
1009
|
-
/* @__PURE__ */ jsxs8("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
1010
|
-
/* @__PURE__ */ jsx8("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: labels.deposit.cardFlow.successTitle }),
|
|
1011
|
-
/* @__PURE__ */ jsx8("p", { className: "agg-type-body text-agg-foreground", children: labels.deposit.cardFlow.successDescription })
|
|
1012
|
-
] }),
|
|
1013
|
-
/* @__PURE__ */ jsxs8("div", { className: "w-full rounded-lg border border-agg-separator bg-agg-secondary px-3 py-1", children: [
|
|
1014
|
-
/* @__PURE__ */ jsx8(
|
|
1015
|
-
SummaryRow,
|
|
1016
|
-
{
|
|
1017
|
-
label: labels.deposit.summary.amountReceived,
|
|
1018
|
-
value: summary.amountReceived
|
|
1019
|
-
}
|
|
1020
|
-
),
|
|
1021
|
-
/* @__PURE__ */ jsx8(SummaryRow, { label: labels.deposit.summary.network, value: summary.network }),
|
|
1022
|
-
/* @__PURE__ */ jsx8(SummaryRow, { label: labels.deposit.cardFlow.summary.fees, value: summary.fees })
|
|
1023
|
-
] }),
|
|
1024
|
-
/* @__PURE__ */ jsx8(Button, { variant: "secondary", size: "large", className: "w-[120px]", onClick: onDone, children: labels.deposit.done })
|
|
1025
|
-
] })
|
|
1026
|
-
] }) });
|
|
1027
|
-
};
|
|
1028
|
-
|
|
1029
1171
|
// src/deposit/steps/wallet-processing.tsx
|
|
1030
|
-
import { useLabels as
|
|
1172
|
+
import { useLabels as useLabels9 } from "@agg-build/hooks";
|
|
1031
1173
|
import { useEffect as useEffect2 } from "react";
|
|
1032
|
-
import { Fragment as Fragment6, jsx as
|
|
1174
|
+
import { Fragment as Fragment6, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1033
1175
|
var WalletProcessingStep = ({
|
|
1034
1176
|
steps,
|
|
1035
1177
|
errorMessage,
|
|
1036
1178
|
onComplete
|
|
1037
1179
|
}) => {
|
|
1038
|
-
const labels =
|
|
1180
|
+
const labels = useLabels9();
|
|
1039
1181
|
useEffect2(() => {
|
|
1040
1182
|
const allDone = steps.length > 0 && steps.every((s) => s.status === "complete");
|
|
1041
1183
|
if (allDone) {
|
|
1042
1184
|
onComplete();
|
|
1043
1185
|
}
|
|
1044
1186
|
}, [steps, onComplete]);
|
|
1045
|
-
return /* @__PURE__ */
|
|
1046
|
-
/* @__PURE__ */
|
|
1047
|
-
/* @__PURE__ */
|
|
1187
|
+
return /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
1188
|
+
/* @__PURE__ */ jsx10(Modal.Header, { title: labels.deposit.processingTitle, hideBorder: true }),
|
|
1189
|
+
/* @__PURE__ */ jsx10(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-5", children: [
|
|
1048
1190
|
steps.map((step) => {
|
|
1049
1191
|
const isComplete = step.status === "complete";
|
|
1050
1192
|
const isActive = step.status === "active";
|
|
1051
|
-
return /* @__PURE__ */
|
|
1052
|
-
isComplete ? /* @__PURE__ */
|
|
1193
|
+
return /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-3", children: [
|
|
1194
|
+
isComplete ? /* @__PURE__ */ jsx10(CheckCircleIcon, { className: "h-4 w-4 text-agg-primary" }) : /* @__PURE__ */ jsx10(
|
|
1053
1195
|
"span",
|
|
1054
1196
|
{
|
|
1055
1197
|
className: [
|
|
@@ -1059,7 +1201,7 @@ var WalletProcessingStep = ({
|
|
|
1059
1201
|
].join(" ")
|
|
1060
1202
|
}
|
|
1061
1203
|
),
|
|
1062
|
-
/* @__PURE__ */
|
|
1204
|
+
/* @__PURE__ */ jsx10(
|
|
1063
1205
|
"p",
|
|
1064
1206
|
{
|
|
1065
1207
|
className: isComplete || isActive ? "agg-type-body text-agg-foreground" : "agg-type-body text-agg-muted-foreground",
|
|
@@ -1068,61 +1210,63 @@ var WalletProcessingStep = ({
|
|
|
1068
1210
|
)
|
|
1069
1211
|
] }, step.id);
|
|
1070
1212
|
}),
|
|
1071
|
-
errorMessage ? /* @__PURE__ */
|
|
1213
|
+
errorMessage ? /* @__PURE__ */ jsx10("p", { className: "agg-type-body text-agg-destructive", children: errorMessage }) : null
|
|
1072
1214
|
] }) })
|
|
1073
1215
|
] });
|
|
1074
1216
|
};
|
|
1075
1217
|
|
|
1076
1218
|
// src/deposit/steps/wallet-success.tsx
|
|
1077
|
-
import { useLabels as
|
|
1078
|
-
import { jsx as
|
|
1079
|
-
var SummaryRow2 = ({ label, value }) => /* @__PURE__ */
|
|
1080
|
-
/* @__PURE__ */
|
|
1081
|
-
/* @__PURE__ */
|
|
1219
|
+
import { useLabels as useLabels10 } from "@agg-build/hooks";
|
|
1220
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1221
|
+
var SummaryRow2 = ({ label, value }) => /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between border-b border-agg-separator py-2 last:border-b-0", children: [
|
|
1222
|
+
/* @__PURE__ */ jsx11("p", { className: "text-[12px] leading-4 font-agg-bold uppercase text-agg-muted-foreground", children: label }),
|
|
1223
|
+
/* @__PURE__ */ jsx11("p", { className: "agg-type-label text-agg-foreground", children: value })
|
|
1082
1224
|
] });
|
|
1083
1225
|
var WalletSuccessStep = ({
|
|
1084
1226
|
summary,
|
|
1085
1227
|
onDone,
|
|
1086
1228
|
onClose
|
|
1087
1229
|
}) => {
|
|
1088
|
-
const labels =
|
|
1089
|
-
return /* @__PURE__ */
|
|
1090
|
-
/* @__PURE__ */
|
|
1230
|
+
const labels = useLabels10();
|
|
1231
|
+
return /* @__PURE__ */ jsx11("div", { className: "relative", children: /* @__PURE__ */ jsxs11(Modal.Body, { classNames: { root: "px-5 py-8 sm:px-8 sm:py-10" }, children: [
|
|
1232
|
+
/* @__PURE__ */ jsx11(
|
|
1091
1233
|
"button",
|
|
1092
1234
|
{
|
|
1093
1235
|
type: "button",
|
|
1094
1236
|
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
1095
1237
|
onClick: onClose,
|
|
1096
1238
|
"aria-label": labels.common.close,
|
|
1097
|
-
children: /* @__PURE__ */
|
|
1239
|
+
children: /* @__PURE__ */ jsx11(CloseIcon, { className: "h-6 w-6" })
|
|
1098
1240
|
}
|
|
1099
1241
|
),
|
|
1100
|
-
/* @__PURE__ */
|
|
1101
|
-
/* @__PURE__ */
|
|
1102
|
-
/* @__PURE__ */
|
|
1103
|
-
/* @__PURE__ */
|
|
1104
|
-
/* @__PURE__ */
|
|
1242
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-center gap-8", children: [
|
|
1243
|
+
/* @__PURE__ */ jsx11("div", { className: "flex h-[60px] w-[60px] items-center justify-center rounded-full bg-agg-success/15", children: /* @__PURE__ */ jsx11(SuccessCheckIcon, { className: "h-6 w-6 text-agg-success" }) }),
|
|
1244
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
1245
|
+
/* @__PURE__ */ jsx11("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: labels.deposit.successTitle }),
|
|
1246
|
+
/* @__PURE__ */ jsx11("p", { className: "agg-type-body text-agg-foreground", children: labels.deposit.successDescription })
|
|
1105
1247
|
] }),
|
|
1106
|
-
/* @__PURE__ */
|
|
1107
|
-
/* @__PURE__ */
|
|
1248
|
+
/* @__PURE__ */ jsxs11("div", { className: "w-full rounded-lg border border-agg-separator bg-agg-secondary px-3 py-1", children: [
|
|
1249
|
+
/* @__PURE__ */ jsx11(
|
|
1108
1250
|
SummaryRow2,
|
|
1109
1251
|
{
|
|
1110
1252
|
label: labels.deposit.summary.amountReceived,
|
|
1111
1253
|
value: summary.amountReceived
|
|
1112
1254
|
}
|
|
1113
1255
|
),
|
|
1114
|
-
/* @__PURE__ */
|
|
1115
|
-
/* @__PURE__ */
|
|
1116
|
-
/* @__PURE__ */
|
|
1256
|
+
/* @__PURE__ */ jsx11(SummaryRow2, { label: labels.deposit.summary.network, value: summary.network }),
|
|
1257
|
+
/* @__PURE__ */ jsx11(SummaryRow2, { label: labels.deposit.summary.fromWallet, value: summary.fromWallet }),
|
|
1258
|
+
/* @__PURE__ */ jsx11(SummaryRow2, { label: labels.deposit.summary.gasFee, value: summary.gasFee })
|
|
1117
1259
|
] }),
|
|
1118
|
-
/* @__PURE__ */
|
|
1260
|
+
/* @__PURE__ */ jsx11(Button, { variant: "secondary", size: "large", className: "w-[120px]", onClick: onDone, children: labels.deposit.done })
|
|
1119
1261
|
] })
|
|
1120
1262
|
] }) });
|
|
1121
1263
|
};
|
|
1122
1264
|
|
|
1123
1265
|
// src/deposit/index.tsx
|
|
1124
|
-
import { jsx as
|
|
1266
|
+
import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1125
1267
|
var PENDING_CARD_SESSION_KEY = "agg-pending-card-session";
|
|
1268
|
+
var DEFAULT_WALLET_CHAIN_ID = "1";
|
|
1269
|
+
var DEFAULT_WALLET_TOKEN = "USDC";
|
|
1126
1270
|
function savePendingCardSession(data) {
|
|
1127
1271
|
try {
|
|
1128
1272
|
localStorage.setItem(PENDING_CARD_SESSION_KEY, JSON.stringify(data));
|
|
@@ -1169,7 +1313,7 @@ function isControlledDepositModalProps(props) {
|
|
|
1169
1313
|
}
|
|
1170
1314
|
function DepositModalSelfDriven({ open, onOpenChange }) {
|
|
1171
1315
|
const depositProps = useDepositFlow({ open, onOpenChange });
|
|
1172
|
-
return /* @__PURE__ */
|
|
1316
|
+
return /* @__PURE__ */ jsx12(DepositModalControlled, __spreadValues({}, depositProps));
|
|
1173
1317
|
}
|
|
1174
1318
|
function DepositModalControlled({
|
|
1175
1319
|
open,
|
|
@@ -1181,6 +1325,7 @@ function DepositModalControlled({
|
|
|
1181
1325
|
onWalletAmountChange,
|
|
1182
1326
|
onWalletMax,
|
|
1183
1327
|
onConfirmWalletDeposit,
|
|
1328
|
+
onCancelWalletDeposit,
|
|
1184
1329
|
onDoneWalletDeposit,
|
|
1185
1330
|
onWalletNetworkChange,
|
|
1186
1331
|
onWalletTokenChange,
|
|
@@ -1201,16 +1346,18 @@ function DepositModalControlled({
|
|
|
1201
1346
|
onCreateCardSession,
|
|
1202
1347
|
pendingCardPurchaseSummary
|
|
1203
1348
|
}) {
|
|
1204
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i
|
|
1349
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1205
1350
|
const { isWeb3User } = useAggAuthState();
|
|
1206
1351
|
const { walletActions } = useAggUiConfig();
|
|
1207
|
-
const labels =
|
|
1352
|
+
const labels = useLabels11();
|
|
1208
1353
|
const defaultMethod = isWeb3User ? "wallet" : "crypto";
|
|
1209
1354
|
const [step, setStep] = useState2(
|
|
1210
1355
|
() => pendingCardPurchaseSummary ? "card-success" : "method"
|
|
1211
1356
|
);
|
|
1212
1357
|
const [highlightedMethod, setHighlightedMethod] = useState2(defaultMethod);
|
|
1213
1358
|
const walletSubmitInFlightRef = useRef(false);
|
|
1359
|
+
const walletDepositAttemptIdRef = useRef(0);
|
|
1360
|
+
const notifiedWalletDepositStatusesRef = useRef(/* @__PURE__ */ new Set());
|
|
1214
1361
|
const [isWalletSubmitting, setIsWalletSubmitting] = useState2(false);
|
|
1215
1362
|
const [cardProviders, setCardProviders] = useState2([]);
|
|
1216
1363
|
const [quotesLoading, setQuotesLoading] = useState2(false);
|
|
@@ -1263,7 +1410,10 @@ function DepositModalControlled({
|
|
|
1263
1410
|
useEffect3(() => {
|
|
1264
1411
|
if (walletNetworkOptions.length > 0) {
|
|
1265
1412
|
if (!walletChainId || !walletNetworkOptions.some((o) => o.value === walletChainId)) {
|
|
1266
|
-
const
|
|
1413
|
+
const ethereumMainnetOption = walletNetworkOptions.find(
|
|
1414
|
+
(option) => option.value === DEFAULT_WALLET_CHAIN_ID || option.value === "mainnet" || option.label.toLowerCase() === "ethereum"
|
|
1415
|
+
);
|
|
1416
|
+
const preferred = ethereumMainnetOption ? ethereumMainnetOption.value : initialWalletChainId && walletNetworkOptions.some((option) => option.value === initialWalletChainId) ? initialWalletChainId : walletNetworkOptions[0].value;
|
|
1267
1417
|
setWalletChainId(preferred);
|
|
1268
1418
|
}
|
|
1269
1419
|
}
|
|
@@ -1276,10 +1426,15 @@ function DepositModalControlled({
|
|
|
1276
1426
|
}
|
|
1277
1427
|
}, [networkOptions, sendChainId]);
|
|
1278
1428
|
useEffect3(() => {
|
|
1279
|
-
|
|
1429
|
+
var _a2, _b2;
|
|
1430
|
+
if (walletTokenOptions.length > 0) {
|
|
1431
|
+
const preferredToken = (_b2 = (_a2 = walletTokenOptions.find((option) => option.value === DEFAULT_WALLET_TOKEN)) == null ? void 0 : _a2.value) != null ? _b2 : walletTokenOptions[0].value;
|
|
1432
|
+
setWalletToken(preferredToken);
|
|
1433
|
+
}
|
|
1280
1434
|
}, [walletTokenOptions]);
|
|
1281
1435
|
useEffect3(() => {
|
|
1282
|
-
|
|
1436
|
+
var _a2, _b2;
|
|
1437
|
+
setSendToken((_b2 = (_a2 = sendTokenOptions == null ? void 0 : sendTokenOptions[0]) == null ? void 0 : _a2.value) != null ? _b2 : "");
|
|
1283
1438
|
}, [sendTokenOptions]);
|
|
1284
1439
|
useEffect3(() => {
|
|
1285
1440
|
if (walletChainId) {
|
|
@@ -1305,11 +1460,42 @@ function DepositModalControlled({
|
|
|
1305
1460
|
fromWallet: walletFlow.walletLabel,
|
|
1306
1461
|
gasFee: ""
|
|
1307
1462
|
}, walletFlow.successSummary);
|
|
1463
|
+
const handleWalletDepositNotification = useCallback(
|
|
1464
|
+
(status, errorMessage) => {
|
|
1465
|
+
if (notifiedWalletDepositStatusesRef.current.has(status)) return;
|
|
1466
|
+
notifiedWalletDepositStatusesRef.current.add(status);
|
|
1467
|
+
dispatchAggDepositNotification({
|
|
1468
|
+
id: `wallet-${walletDepositAttemptIdRef.current}`,
|
|
1469
|
+
status,
|
|
1470
|
+
amount: walletFlow.amount,
|
|
1471
|
+
tokenSymbol: walletToken || DEFAULT_WALLET_TOKEN,
|
|
1472
|
+
errorMessage
|
|
1473
|
+
});
|
|
1474
|
+
},
|
|
1475
|
+
[walletFlow.amount, walletToken]
|
|
1476
|
+
);
|
|
1308
1477
|
useEffect3(() => {
|
|
1309
1478
|
if (step === "wallet-processing" && !isWalletSubmitting && walletFlow.transactionStatus === "settled") {
|
|
1479
|
+
handleWalletDepositNotification("completed");
|
|
1310
1480
|
setStep("wallet-success");
|
|
1311
1481
|
}
|
|
1312
|
-
}, [isWalletSubmitting, step, walletFlow.transactionStatus]);
|
|
1482
|
+
}, [handleWalletDepositNotification, isWalletSubmitting, step, walletFlow.transactionStatus]);
|
|
1483
|
+
useEffect3(() => {
|
|
1484
|
+
if (!onCancelWalletDeposit) return;
|
|
1485
|
+
if (step === "wallet-processing" && !isWalletSubmitting && walletFlow.transactionStatus === "error") {
|
|
1486
|
+
walletSubmitInFlightRef.current = false;
|
|
1487
|
+
handleWalletDepositNotification("failed", walletFlow.transactionErrorMessage);
|
|
1488
|
+
onCancelWalletDeposit();
|
|
1489
|
+
setStep("wallet-form");
|
|
1490
|
+
}
|
|
1491
|
+
}, [
|
|
1492
|
+
handleWalletDepositNotification,
|
|
1493
|
+
isWalletSubmitting,
|
|
1494
|
+
onCancelWalletDeposit,
|
|
1495
|
+
step,
|
|
1496
|
+
walletFlow.transactionErrorMessage,
|
|
1497
|
+
walletFlow.transactionStatus
|
|
1498
|
+
]);
|
|
1313
1499
|
const cardTokenOptions = withTokenIcons(
|
|
1314
1500
|
mergeSelectOptionsUnique(cardFlow == null ? void 0 : cardFlow.tokenOptions, DEFAULT_CURRENCY_OPTIONS)
|
|
1315
1501
|
);
|
|
@@ -1362,7 +1548,7 @@ function DepositModalControlled({
|
|
|
1362
1548
|
}
|
|
1363
1549
|
};
|
|
1364
1550
|
const handleSelectProvider = (providerId) => __async(null, null, function* () {
|
|
1365
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2,
|
|
1551
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j, _k, _l, _m;
|
|
1366
1552
|
onSelectCardProvider == null ? void 0 : onSelectCardProvider(providerId);
|
|
1367
1553
|
if (onCreateCardSession) {
|
|
1368
1554
|
setSessionError(null);
|
|
@@ -1380,7 +1566,7 @@ function DepositModalControlled({
|
|
|
1380
1566
|
redirectUrl: cardRedirectUrl
|
|
1381
1567
|
});
|
|
1382
1568
|
const selectedProvider = cardProviders.find((p) => p.id === providerId);
|
|
1383
|
-
const networkLabel = (
|
|
1569
|
+
const networkLabel = (_j = (_i2 = (_h2 = (_g2 = cardFlow == null ? void 0 : cardFlow.networkOptions) == null ? void 0 : _g2.find((o) => o.value === (cardFlow == null ? void 0 : cardFlow.selectedNetwork))) == null ? void 0 : _h2.label) != null ? _i2 : cardFlow == null ? void 0 : cardFlow.selectedNetwork) != null ? _j : "";
|
|
1384
1570
|
savePendingCardSession({
|
|
1385
1571
|
sessionId: session.id,
|
|
1386
1572
|
summary: {
|
|
@@ -1433,6 +1619,8 @@ function DepositModalControlled({
|
|
|
1433
1619
|
setSendChainId("");
|
|
1434
1620
|
setSendToken("");
|
|
1435
1621
|
walletSubmitInFlightRef.current = false;
|
|
1622
|
+
walletDepositAttemptIdRef.current = 0;
|
|
1623
|
+
notifiedWalletDepositStatusesRef.current = /* @__PURE__ */ new Set();
|
|
1436
1624
|
setIsWalletSubmitting(false);
|
|
1437
1625
|
setCardProviders([]);
|
|
1438
1626
|
setQuotesLoading(false);
|
|
@@ -1445,13 +1633,14 @@ function DepositModalControlled({
|
|
|
1445
1633
|
onOpenChange(isOpen);
|
|
1446
1634
|
};
|
|
1447
1635
|
const depositModalMaxWidth = step === "method" ? "600px" : "480px";
|
|
1448
|
-
return /* @__PURE__ */
|
|
1449
|
-
step === "method" ? /* @__PURE__ */
|
|
1636
|
+
return /* @__PURE__ */ jsx12(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs12(Modal.Container, { maxWidth: depositModalMaxWidth, "aria-label": "Deposit", children: [
|
|
1637
|
+
step === "method" ? /* @__PURE__ */ jsx12(
|
|
1450
1638
|
DepositMethodStep,
|
|
1451
1639
|
{
|
|
1452
1640
|
balance: walletFlow.balance,
|
|
1453
1641
|
walletLabel: walletFlow.walletLabel,
|
|
1454
1642
|
walletBalance: walletFlow.walletBalance,
|
|
1643
|
+
walletToken,
|
|
1455
1644
|
isWalletBalanceLoading: walletFlow.isWalletBalanceLoading,
|
|
1456
1645
|
showWalletMethod: isWeb3User,
|
|
1457
1646
|
highlightedMethod,
|
|
@@ -1459,7 +1648,7 @@ function DepositModalControlled({
|
|
|
1459
1648
|
onSelectMethod: handleSelectMethod
|
|
1460
1649
|
}
|
|
1461
1650
|
) : null,
|
|
1462
|
-
step === "wallet-form" ? /* @__PURE__ */
|
|
1651
|
+
step === "wallet-form" ? /* @__PURE__ */ jsx12(
|
|
1463
1652
|
WalletFormStep,
|
|
1464
1653
|
{
|
|
1465
1654
|
walletLabel: walletFlow.walletLabel,
|
|
@@ -1488,6 +1677,8 @@ function DepositModalControlled({
|
|
|
1488
1677
|
var _a2, _b2;
|
|
1489
1678
|
if (walletSubmitInFlightRef.current) return;
|
|
1490
1679
|
walletSubmitInFlightRef.current = true;
|
|
1680
|
+
walletDepositAttemptIdRef.current += 1;
|
|
1681
|
+
notifiedWalletDepositStatusesRef.current = /* @__PURE__ */ new Set();
|
|
1491
1682
|
setIsWalletSubmitting(true);
|
|
1492
1683
|
setStep("wallet-processing");
|
|
1493
1684
|
const walletChainIdNum = walletChainId ? Number(walletChainId) : void 0;
|
|
@@ -1523,7 +1714,7 @@ function DepositModalControlled({
|
|
|
1523
1714
|
})
|
|
1524
1715
|
}
|
|
1525
1716
|
) : null,
|
|
1526
|
-
step === "wallet-processing" ? /* @__PURE__ */
|
|
1717
|
+
step === "wallet-processing" ? /* @__PURE__ */ jsx12(
|
|
1527
1718
|
WalletProcessingStep,
|
|
1528
1719
|
{
|
|
1529
1720
|
steps: processingSteps,
|
|
@@ -1531,7 +1722,7 @@ function DepositModalControlled({
|
|
|
1531
1722
|
onComplete: () => setStep("wallet-success")
|
|
1532
1723
|
}
|
|
1533
1724
|
) : null,
|
|
1534
|
-
step === "wallet-success" ? /* @__PURE__ */
|
|
1725
|
+
step === "wallet-success" ? /* @__PURE__ */ jsx12(
|
|
1535
1726
|
WalletSuccessStep,
|
|
1536
1727
|
{
|
|
1537
1728
|
summary: resolvedSuccessSummary,
|
|
@@ -1539,7 +1730,7 @@ function DepositModalControlled({
|
|
|
1539
1730
|
onClose: () => handleOpenChange(false)
|
|
1540
1731
|
}
|
|
1541
1732
|
) : null,
|
|
1542
|
-
step === "card-deposit" && cardFlow ? /* @__PURE__ */
|
|
1733
|
+
step === "card-deposit" && cardFlow ? /* @__PURE__ */ jsx12(
|
|
1543
1734
|
CardDepositStep,
|
|
1544
1735
|
{
|
|
1545
1736
|
amount: cardFlow.amount,
|
|
@@ -1561,7 +1752,7 @@ function DepositModalControlled({
|
|
|
1561
1752
|
onContinue: handleContinueCardDeposit
|
|
1562
1753
|
}
|
|
1563
1754
|
) : null,
|
|
1564
|
-
step === "card-provider" && cardFlow ? /* @__PURE__ */
|
|
1755
|
+
step === "card-provider" && cardFlow ? /* @__PURE__ */ jsx12(
|
|
1565
1756
|
CardProviderStep,
|
|
1566
1757
|
{
|
|
1567
1758
|
amount: cardFlow.amount,
|
|
@@ -1576,7 +1767,7 @@ function DepositModalControlled({
|
|
|
1576
1767
|
onRetry: handleRetryQuotes
|
|
1577
1768
|
}
|
|
1578
1769
|
) : null,
|
|
1579
|
-
step === "card-payment-pending" ? /* @__PURE__ */
|
|
1770
|
+
step === "card-payment-pending" ? /* @__PURE__ */ jsx12(
|
|
1580
1771
|
CardPaymentPendingStep,
|
|
1581
1772
|
{
|
|
1582
1773
|
providerName: pendingProviderName,
|
|
@@ -1586,7 +1777,7 @@ function DepositModalControlled({
|
|
|
1586
1777
|
onChooseAnotherProvider: handleChooseAnotherProvider
|
|
1587
1778
|
}
|
|
1588
1779
|
) : null,
|
|
1589
|
-
step === "card-success" ? /* @__PURE__ */
|
|
1780
|
+
step === "card-success" ? /* @__PURE__ */ jsx12(
|
|
1590
1781
|
CardPurchaseSuccessStep,
|
|
1591
1782
|
{
|
|
1592
1783
|
summary: (_g = pendingCardPurchaseSummary != null ? pendingCardPurchaseSummary : cardFlow == null ? void 0 : cardFlow.purchaseSummary) != null ? _g : {
|
|
@@ -1598,7 +1789,7 @@ function DepositModalControlled({
|
|
|
1598
1789
|
onDone: handleDoneCardPurchase
|
|
1599
1790
|
}
|
|
1600
1791
|
) : null,
|
|
1601
|
-
step === "crypto-transfer" ? /* @__PURE__ */
|
|
1792
|
+
step === "crypto-transfer" ? /* @__PURE__ */ jsx12(
|
|
1602
1793
|
CryptoTransferStep,
|
|
1603
1794
|
{
|
|
1604
1795
|
tokenOptions: sendTokenOptions,
|
|
@@ -1607,15 +1798,16 @@ function DepositModalControlled({
|
|
|
1607
1798
|
selectedNetwork: sendChainId,
|
|
1608
1799
|
depositAddress,
|
|
1609
1800
|
minDeposit: (_h = sendCryptoConfig == null ? void 0 : sendCryptoConfig.minDeposit) != null ? _h : "$1",
|
|
1610
|
-
|
|
1611
|
-
eta: (_j = sendCryptoConfig == null ? void 0 : sendCryptoConfig.eta) != null ? _j : "~30s",
|
|
1801
|
+
eta: (_i = sendCryptoConfig == null ? void 0 : sendCryptoConfig.eta) != null ? _i : "~30s",
|
|
1612
1802
|
isLoadingAddress,
|
|
1613
1803
|
addressError,
|
|
1614
1804
|
onBack: () => setStep("method"),
|
|
1615
1805
|
onTokenChange: setSendToken,
|
|
1616
1806
|
onNetworkChange: (id) => {
|
|
1617
1807
|
setSendChainId(id);
|
|
1618
|
-
|
|
1808
|
+
if (id !== sendChainId) {
|
|
1809
|
+
setSendToken("");
|
|
1810
|
+
}
|
|
1619
1811
|
},
|
|
1620
1812
|
onDone: handleDoneCryptoTransfer
|
|
1621
1813
|
}
|
|
@@ -1624,33 +1816,33 @@ function DepositModalControlled({
|
|
|
1624
1816
|
}
|
|
1625
1817
|
var DepositModal = (props) => {
|
|
1626
1818
|
if (!isControlledDepositModalProps(props)) {
|
|
1627
|
-
return /* @__PURE__ */
|
|
1819
|
+
return /* @__PURE__ */ jsx12(DepositModalSelfDriven, __spreadValues({}, props));
|
|
1628
1820
|
}
|
|
1629
|
-
return /* @__PURE__ */
|
|
1821
|
+
return /* @__PURE__ */ jsx12(DepositModalControlled, __spreadValues({}, props));
|
|
1630
1822
|
};
|
|
1631
1823
|
DepositModal.displayName = "DepositModal";
|
|
1632
1824
|
|
|
1633
1825
|
// src/withdraw/index.tsx
|
|
1634
|
-
import { useEffect as
|
|
1635
|
-
import { useWithdrawFlow } from "@agg-build/hooks/withdraw";
|
|
1826
|
+
import { useEffect as useEffect4, useState as useState3 } from "react";
|
|
1827
|
+
import { useWithdrawalLifecycle, useWithdrawFlow } from "@agg-build/hooks/withdraw";
|
|
1636
1828
|
|
|
1637
1829
|
// src/withdraw/steps/withdraw-method.tsx
|
|
1638
|
-
import { useLabels as
|
|
1639
|
-
import { Fragment as Fragment7, jsx as
|
|
1830
|
+
import { useLabels as useLabels12 } from "@agg-build/hooks";
|
|
1831
|
+
import { Fragment as Fragment7, jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1640
1832
|
var WithdrawMethodStep = ({
|
|
1641
1833
|
balance,
|
|
1642
1834
|
onSelectMethod
|
|
1643
1835
|
}) => {
|
|
1644
|
-
const labels =
|
|
1645
|
-
return /* @__PURE__ */
|
|
1646
|
-
/* @__PURE__ */
|
|
1647
|
-
/* @__PURE__ */
|
|
1648
|
-
/* @__PURE__ */
|
|
1836
|
+
const labels = useLabels12();
|
|
1837
|
+
return /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
|
1838
|
+
/* @__PURE__ */ jsx13(Modal.Header, { title: labels.withdraw.title, hideBorder: true }),
|
|
1839
|
+
/* @__PURE__ */ jsx13(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-5", children: [
|
|
1840
|
+
/* @__PURE__ */ jsxs13("p", { className: "agg-type-body text-agg-foreground", children: [
|
|
1649
1841
|
labels.withdraw.balancePrefix,
|
|
1650
1842
|
" ",
|
|
1651
1843
|
formatCompactUsd(balance)
|
|
1652
1844
|
] }),
|
|
1653
|
-
/* @__PURE__ */
|
|
1845
|
+
/* @__PURE__ */ jsxs13(
|
|
1654
1846
|
"div",
|
|
1655
1847
|
{
|
|
1656
1848
|
className: cn(
|
|
@@ -1667,12 +1859,12 @@ var WithdrawMethodStep = ({
|
|
|
1667
1859
|
}
|
|
1668
1860
|
},
|
|
1669
1861
|
children: [
|
|
1670
|
-
/* @__PURE__ */
|
|
1671
|
-
/* @__PURE__ */
|
|
1672
|
-
/* @__PURE__ */
|
|
1673
|
-
/* @__PURE__ */
|
|
1862
|
+
/* @__PURE__ */ jsx13("div", { className: "shrink-0 flex items-center justify-center h-10 w-10 rounded-lg bg-agg-secondary-hover", children: /* @__PURE__ */ jsx13(WalletIcon, { className: "h-6 w-6 text-agg-muted-foreground" }) }),
|
|
1863
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex-1 min-w-0", children: [
|
|
1864
|
+
/* @__PURE__ */ jsx13("p", { className: "agg-type-body-strong text-agg-foreground", children: labels.withdraw.methods.walletTitle }),
|
|
1865
|
+
/* @__PURE__ */ jsx13("p", { className: "agg-type-label text-agg-muted-foreground", children: labels.withdraw.methods.walletDescription })
|
|
1674
1866
|
] }),
|
|
1675
|
-
/* @__PURE__ */
|
|
1867
|
+
/* @__PURE__ */ jsx13("div", { className: "shrink-0 text-agg-muted-foreground", children: /* @__PURE__ */ jsx13(ChevronRightIcon, { className: "h-5 w-5" }) })
|
|
1676
1868
|
]
|
|
1677
1869
|
}
|
|
1678
1870
|
)
|
|
@@ -1681,8 +1873,8 @@ var WithdrawMethodStep = ({
|
|
|
1681
1873
|
};
|
|
1682
1874
|
|
|
1683
1875
|
// src/withdraw/steps/withdraw-amount.tsx
|
|
1684
|
-
import { useLabels as
|
|
1685
|
-
import { Fragment as Fragment8, jsx as
|
|
1876
|
+
import { useLabels as useLabels13, useWithdrawEstimate as useWithdrawEstimate2 } from "@agg-build/hooks";
|
|
1877
|
+
import { Fragment as Fragment8, jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1686
1878
|
var WithdrawAmountStep = ({
|
|
1687
1879
|
amount,
|
|
1688
1880
|
destinationWallet,
|
|
@@ -1701,114 +1893,123 @@ var WithdrawAmountStep = ({
|
|
|
1701
1893
|
onMaxClick,
|
|
1702
1894
|
onContinue
|
|
1703
1895
|
}) => {
|
|
1704
|
-
const labels =
|
|
1896
|
+
const labels = useLabels13();
|
|
1705
1897
|
const SOLANA_CHAIN_ID = "792703809";
|
|
1706
1898
|
const isSolanaDest = selectedNetwork === SOLANA_CHAIN_ID;
|
|
1707
1899
|
const trimmedDestination = destinationWallet.trim();
|
|
1708
1900
|
const isValidAddress = isSolanaDest ? /^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(trimmedDestination) : /^0x[a-fA-F0-9]{40}$/.test(trimmedDestination);
|
|
1709
1901
|
const isValid = Number(amount) > 0 && isValidAddress;
|
|
1710
1902
|
const isDisabled = !isValid || isConfirming;
|
|
1711
|
-
|
|
1712
|
-
|
|
1903
|
+
const withdrawEstimate = useWithdrawEstimate2({
|
|
1904
|
+
amount,
|
|
1905
|
+
selectedToken,
|
|
1906
|
+
selectedNetwork
|
|
1907
|
+
});
|
|
1908
|
+
const shouldShowWithdrawEstimate = Boolean(withdrawEstimate);
|
|
1909
|
+
return /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
1910
|
+
/* @__PURE__ */ jsx14(
|
|
1713
1911
|
Modal.Header,
|
|
1714
1912
|
{
|
|
1715
1913
|
title: labels.withdraw.walletFlow.title,
|
|
1716
1914
|
hideBorder: true,
|
|
1717
|
-
leftElement: /* @__PURE__ */
|
|
1915
|
+
leftElement: /* @__PURE__ */ jsx14(
|
|
1718
1916
|
"button",
|
|
1719
1917
|
{
|
|
1720
1918
|
type: "button",
|
|
1721
1919
|
className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
|
|
1722
1920
|
onClick: onBack,
|
|
1723
1921
|
"aria-label": labels.withdraw.back,
|
|
1724
|
-
children: /* @__PURE__ */
|
|
1922
|
+
children: /* @__PURE__ */ jsx14(ChevronLeftIcon, { className: "h-6 w-6" })
|
|
1725
1923
|
}
|
|
1726
1924
|
)
|
|
1727
1925
|
}
|
|
1728
1926
|
),
|
|
1729
|
-
/* @__PURE__ */
|
|
1730
|
-
/* @__PURE__ */
|
|
1731
|
-
/* @__PURE__ */
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
{
|
|
1735
|
-
type: "text",
|
|
1736
|
-
"aria-label": labels.withdraw.walletFlow.recipientAddressLabel,
|
|
1737
|
-
className: cn(
|
|
1738
|
-
"agg-type-body w-full h-10 rounded border border-agg-separator bg-agg-secondary px-3 outline-none",
|
|
1739
|
-
"text-agg-foreground placeholder:text-agg-muted-foreground",
|
|
1740
|
-
"focus:border-agg-primary transition-colors"
|
|
1741
|
-
),
|
|
1742
|
-
placeholder: isSolanaDest ? "FwR3..." : "0x971d...",
|
|
1743
|
-
value: destinationWallet,
|
|
1744
|
-
onChange: (e) => onDestinationChange(e.target.value)
|
|
1745
|
-
}
|
|
1746
|
-
)
|
|
1747
|
-
] }),
|
|
1748
|
-
/* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-2", children: [
|
|
1749
|
-
/* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between", children: [
|
|
1750
|
-
/* @__PURE__ */ jsx13("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.withdraw.walletFlow.amountLabel }),
|
|
1751
|
-
/* @__PURE__ */ jsxs13("p", { className: "agg-type-label text-agg-muted-foreground", children: [
|
|
1752
|
-
labels.withdraw.balancePrefix,
|
|
1753
|
-
" ",
|
|
1754
|
-
balanceDisplay
|
|
1755
|
-
] })
|
|
1756
|
-
] }),
|
|
1757
|
-
/* @__PURE__ */ jsxs13("div", { className: "flex h-10 items-center gap-2 rounded border border-agg-separator bg-agg-secondary px-3 focus-within:border-agg-primary transition-colors", children: [
|
|
1758
|
-
/* @__PURE__ */ jsx13(
|
|
1927
|
+
/* @__PURE__ */ jsx14(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-5", children: [
|
|
1928
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-5", children: [
|
|
1929
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-2", children: [
|
|
1930
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.withdraw.walletFlow.recipientAddressLabel }),
|
|
1931
|
+
/* @__PURE__ */ jsx14(
|
|
1759
1932
|
"input",
|
|
1760
1933
|
{
|
|
1761
1934
|
type: "text",
|
|
1762
|
-
|
|
1763
|
-
"aria-label": labels.withdraw.walletFlow.amountLabel,
|
|
1935
|
+
"aria-label": labels.withdraw.walletFlow.recipientAddressLabel,
|
|
1764
1936
|
className: cn(
|
|
1765
|
-
"agg-type-body
|
|
1766
|
-
|
|
1937
|
+
"agg-type-body w-full h-10 rounded border border-agg-separator bg-agg-secondary px-3 outline-none",
|
|
1938
|
+
"text-agg-foreground placeholder:text-agg-muted-foreground",
|
|
1939
|
+
"focus:border-agg-primary transition-colors"
|
|
1767
1940
|
),
|
|
1768
|
-
placeholder: "
|
|
1769
|
-
value:
|
|
1770
|
-
onChange: (e) =>
|
|
1771
|
-
}
|
|
1772
|
-
),
|
|
1773
|
-
/* @__PURE__ */ jsx13("span", { className: "agg-type-body text-agg-muted-foreground shrink-0", children: selectedToken }),
|
|
1774
|
-
onMaxClick ? /* @__PURE__ */ jsx13(
|
|
1775
|
-
"button",
|
|
1776
|
-
{
|
|
1777
|
-
type: "button",
|
|
1778
|
-
className: "agg-type-label-strong text-agg-primary hover:opacity-80 transition-opacity cursor-pointer shrink-0",
|
|
1779
|
-
onClick: onMaxClick,
|
|
1780
|
-
children: labels.withdraw.walletFlow.max
|
|
1781
|
-
}
|
|
1782
|
-
) : null
|
|
1783
|
-
] })
|
|
1784
|
-
] }),
|
|
1785
|
-
/* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-3 sm:flex-row sm:gap-5", children: [
|
|
1786
|
-
/* @__PURE__ */ jsxs13("div", { className: "flex-1 flex flex-col gap-2 min-w-0", children: [
|
|
1787
|
-
/* @__PURE__ */ jsx13("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.withdraw.walletFlow.tokenLabel }),
|
|
1788
|
-
/* @__PURE__ */ jsx13(
|
|
1789
|
-
Select,
|
|
1790
|
-
{
|
|
1791
|
-
items: tokenOptions,
|
|
1792
|
-
value: selectedToken,
|
|
1793
|
-
onChange: onTokenChange,
|
|
1794
|
-
ariaLabel: labels.withdraw.walletFlow.tokenLabel
|
|
1941
|
+
placeholder: isSolanaDest ? "FwR3..." : "0x971d...",
|
|
1942
|
+
value: destinationWallet,
|
|
1943
|
+
onChange: (e) => onDestinationChange(e.target.value)
|
|
1795
1944
|
}
|
|
1796
1945
|
)
|
|
1797
1946
|
] }),
|
|
1798
|
-
/* @__PURE__ */
|
|
1799
|
-
/* @__PURE__ */
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1947
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-2", children: [
|
|
1948
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between", children: [
|
|
1949
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.withdraw.walletFlow.amountLabel }),
|
|
1950
|
+
/* @__PURE__ */ jsxs14("p", { className: "agg-type-label text-agg-muted-foreground", children: [
|
|
1951
|
+
labels.withdraw.balancePrefix,
|
|
1952
|
+
" ",
|
|
1953
|
+
balanceDisplay
|
|
1954
|
+
] })
|
|
1955
|
+
] }),
|
|
1956
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex h-10 items-center gap-2 rounded border border-agg-separator bg-agg-secondary px-3 focus-within:border-agg-primary transition-colors", children: [
|
|
1957
|
+
/* @__PURE__ */ jsx14(
|
|
1958
|
+
"input",
|
|
1959
|
+
{
|
|
1960
|
+
type: "text",
|
|
1961
|
+
inputMode: "decimal",
|
|
1962
|
+
"aria-label": labels.withdraw.walletFlow.amountLabel,
|
|
1963
|
+
className: cn(
|
|
1964
|
+
"agg-type-body flex-1 min-w-0 bg-transparent outline-none",
|
|
1965
|
+
Number(amount) > 0 ? "text-agg-foreground" : "text-agg-muted-foreground"
|
|
1966
|
+
),
|
|
1967
|
+
placeholder: "0.00",
|
|
1968
|
+
value: amount,
|
|
1969
|
+
onChange: (e) => onAmountChange(e.target.value)
|
|
1970
|
+
}
|
|
1971
|
+
),
|
|
1972
|
+
/* @__PURE__ */ jsx14("span", { className: "agg-type-body text-agg-muted-foreground shrink-0", children: selectedToken }),
|
|
1973
|
+
onMaxClick ? /* @__PURE__ */ jsx14(
|
|
1974
|
+
"button",
|
|
1975
|
+
{
|
|
1976
|
+
type: "button",
|
|
1977
|
+
className: "agg-type-label-strong text-agg-primary hover:opacity-80 transition-opacity cursor-pointer shrink-0",
|
|
1978
|
+
onClick: onMaxClick,
|
|
1979
|
+
children: labels.withdraw.walletFlow.max
|
|
1980
|
+
}
|
|
1981
|
+
) : null
|
|
1982
|
+
] })
|
|
1983
|
+
] }),
|
|
1984
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-3 sm:flex-row sm:gap-5", children: [
|
|
1985
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex-1 flex flex-col gap-2 min-w-0", children: [
|
|
1986
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.withdraw.walletFlow.tokenLabel }),
|
|
1987
|
+
/* @__PURE__ */ jsx14(
|
|
1988
|
+
Select,
|
|
1989
|
+
{
|
|
1990
|
+
items: tokenOptions,
|
|
1991
|
+
value: selectedToken,
|
|
1992
|
+
onChange: onTokenChange,
|
|
1993
|
+
ariaLabel: labels.withdraw.walletFlow.tokenLabel
|
|
1994
|
+
}
|
|
1995
|
+
)
|
|
1996
|
+
] }),
|
|
1997
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex-1 flex flex-col gap-2 min-w-0", children: [
|
|
1998
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.withdraw.walletFlow.networkLabel }),
|
|
1999
|
+
/* @__PURE__ */ jsx14(
|
|
2000
|
+
Select,
|
|
2001
|
+
{
|
|
2002
|
+
items: networkOptions,
|
|
2003
|
+
value: selectedNetwork,
|
|
2004
|
+
onChange: onNetworkChange,
|
|
2005
|
+
ariaLabel: labels.withdraw.walletFlow.networkLabel
|
|
2006
|
+
}
|
|
2007
|
+
)
|
|
2008
|
+
] })
|
|
2009
|
+
] }),
|
|
2010
|
+
shouldShowWithdrawEstimate && withdrawEstimate ? /* @__PURE__ */ jsx14(TransferFeeSummary, { estimate: withdrawEstimate, view: "withdraw" }) : null
|
|
1810
2011
|
] }),
|
|
1811
|
-
/* @__PURE__ */
|
|
2012
|
+
/* @__PURE__ */ jsx14(
|
|
1812
2013
|
Button,
|
|
1813
2014
|
{
|
|
1814
2015
|
variant: isValid && !isConfirming ? "primary" : "secondary",
|
|
@@ -1819,107 +2020,32 @@ var WithdrawAmountStep = ({
|
|
|
1819
2020
|
children: isConfirming ? labels.common.loading : labels.withdraw.walletFlow.confirm
|
|
1820
2021
|
}
|
|
1821
2022
|
),
|
|
1822
|
-
error ? /* @__PURE__ */
|
|
2023
|
+
error ? /* @__PURE__ */ jsx14("p", { className: "agg-type-label text-agg-error text-center", role: "alert", children: error }) : null
|
|
1823
2024
|
] }) })
|
|
1824
2025
|
] });
|
|
1825
2026
|
};
|
|
1826
2027
|
|
|
1827
2028
|
// src/withdraw/steps/withdraw-success.tsx
|
|
1828
|
-
import {
|
|
1829
|
-
import {
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
var CHAIN_LABELS = {
|
|
1834
|
-
1: "Ethereum",
|
|
1835
|
-
10: "Optimism",
|
|
1836
|
-
56: "BNB Chain",
|
|
1837
|
-
137: "Polygon",
|
|
1838
|
-
8453: "Base",
|
|
1839
|
-
42161: "Arbitrum",
|
|
1840
|
-
43114: "Avalanche",
|
|
1841
|
-
11155111: "Sepolia",
|
|
1842
|
-
792703809: "Solana"
|
|
1843
|
-
};
|
|
1844
|
-
var resolveChainLabel = (chainId) => {
|
|
1845
|
-
var _a;
|
|
1846
|
-
return (_a = CHAIN_LABELS[chainId]) != null ? _a : `Chain ${chainId}`;
|
|
1847
|
-
};
|
|
1848
|
-
var legStepStatusFor = (legStatus) => {
|
|
1849
|
-
switch (legStatus) {
|
|
1850
|
-
case "confirmed":
|
|
1851
|
-
return "complete";
|
|
1852
|
-
case "failed":
|
|
1853
|
-
return "error";
|
|
1854
|
-
case "submitted":
|
|
1855
|
-
case "planned":
|
|
1856
|
-
default:
|
|
1857
|
-
return "pending";
|
|
1858
|
-
}
|
|
1859
|
-
};
|
|
1860
|
-
var legStepLabel = (leg, labels) => {
|
|
1861
|
-
if (leg.type === "bridge") {
|
|
1862
|
-
return labels.bridge(resolveChainLabel(leg.sourceChainId), resolveChainLabel(leg.destChainId));
|
|
1863
|
-
}
|
|
1864
|
-
return labels.transfer(resolveChainLabel(leg.destChainId));
|
|
1865
|
-
};
|
|
1866
|
-
var finalStepStatusFor = (status) => {
|
|
1867
|
-
switch (status) {
|
|
1868
|
-
case "completed":
|
|
1869
|
-
return "complete";
|
|
1870
|
-
case "partial":
|
|
1871
|
-
return "warning";
|
|
1872
|
-
case "failed":
|
|
1873
|
-
return "error";
|
|
1874
|
-
case "pending":
|
|
1875
|
-
case "bridging":
|
|
1876
|
-
case "transferring":
|
|
1877
|
-
default:
|
|
1878
|
-
return "pending";
|
|
1879
|
-
}
|
|
1880
|
-
};
|
|
1881
|
-
var finalStepLabelFor = (status, pending, walletFlowLabels) => {
|
|
1882
|
-
var _a;
|
|
1883
|
-
if (pending || status === null) {
|
|
1884
|
-
return walletFlowLabels.lifecycle.pending;
|
|
1885
|
-
}
|
|
1886
|
-
return (_a = walletFlowLabels.lifecycle[status]) != null ? _a : walletFlowLabels.lifecycle.pending;
|
|
1887
|
-
};
|
|
1888
|
-
var buildWithdrawalLifecycleSteps = ({
|
|
1889
|
-
pending,
|
|
1890
|
-
status,
|
|
1891
|
-
legs,
|
|
1892
|
-
walletFlowLabels
|
|
1893
|
-
}) => {
|
|
1894
|
-
const stepLabels = walletFlowLabels.lifecycle.steps;
|
|
1895
|
-
const legSteps = legs.map((leg, index) => ({
|
|
1896
|
-
id: `leg-${index}-${leg.type}-${leg.sourceChainId}-${leg.destChainId}`,
|
|
1897
|
-
label: legStepLabel(leg, stepLabels),
|
|
1898
|
-
status: legStepStatusFor(leg.status)
|
|
1899
|
-
}));
|
|
1900
|
-
const groups = legSteps.length > 0 ? [legSteps] : [];
|
|
1901
|
-
const finalStep = {
|
|
1902
|
-
id: `final-${status != null ? status : "pending"}`,
|
|
1903
|
-
label: finalStepLabelFor(status, pending, walletFlowLabels),
|
|
1904
|
-
status: finalStepStatusFor(status != null ? status : "pending")
|
|
1905
|
-
};
|
|
1906
|
-
return {
|
|
1907
|
-
groups,
|
|
1908
|
-
finalStep,
|
|
1909
|
-
hasDetails: legSteps.length > 0
|
|
1910
|
-
};
|
|
1911
|
-
};
|
|
1912
|
-
|
|
1913
|
-
// src/withdraw/steps/withdraw-success.tsx
|
|
1914
|
-
import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1915
|
-
var SummaryRow3 = ({ label, value }) => /* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between border-b border-agg-separator py-2 last:border-b-0", children: [
|
|
1916
|
-
/* @__PURE__ */ jsx14("p", { className: "text-[12px] leading-4 font-agg-bold uppercase text-agg-muted-foreground", children: label }),
|
|
1917
|
-
/* @__PURE__ */ jsx14("p", { className: "agg-type-label text-agg-foreground", children: value })
|
|
2029
|
+
import { useLabels as useLabels14, useSdkUiConfig } from "@agg-build/hooks";
|
|
2030
|
+
import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2031
|
+
var SummaryRow3 = ({ label, value }) => /* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between gap-4 border-b border-agg-separator py-2 last:border-b-0", children: [
|
|
2032
|
+
/* @__PURE__ */ jsx15("p", { className: "min-w-0 text-[12px] leading-4 font-agg-bold uppercase text-agg-muted-foreground", children: label }),
|
|
2033
|
+
/* @__PURE__ */ jsx15("p", { className: "min-w-0 text-right text-[14px] leading-5 text-agg-foreground", children: value })
|
|
1918
2034
|
] });
|
|
2035
|
+
var WithdrawCloseButton = ({ onClose, label }) => /* @__PURE__ */ jsx15(
|
|
2036
|
+
"button",
|
|
2037
|
+
{
|
|
2038
|
+
type: "button",
|
|
2039
|
+
className: "absolute right-8 top-7 flex cursor-pointer items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
|
|
2040
|
+
onClick: onClose,
|
|
2041
|
+
"aria-label": label,
|
|
2042
|
+
children: /* @__PURE__ */ jsx15(CloseIcon, { className: "h-6 w-6" })
|
|
2043
|
+
}
|
|
2044
|
+
);
|
|
1919
2045
|
var LoadingGlyph = ({
|
|
1920
2046
|
className,
|
|
1921
2047
|
enableAnimations
|
|
1922
|
-
}) => /* @__PURE__ */
|
|
2048
|
+
}) => /* @__PURE__ */ jsx15(
|
|
1923
2049
|
"span",
|
|
1924
2050
|
{
|
|
1925
2051
|
"aria-hidden": "true",
|
|
@@ -1930,213 +2056,242 @@ var LoadingGlyph = ({
|
|
|
1930
2056
|
)
|
|
1931
2057
|
}
|
|
1932
2058
|
);
|
|
1933
|
-
var
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
case "warning":
|
|
1938
|
-
return "text-agg-warning";
|
|
1939
|
-
case "error":
|
|
1940
|
-
return "text-agg-error";
|
|
1941
|
-
case "pending":
|
|
1942
|
-
default:
|
|
1943
|
-
return "text-agg-primary";
|
|
1944
|
-
}
|
|
2059
|
+
var loadingActiveIndexFor = (state) => {
|
|
2060
|
+
if (state.status === "transferring") return 2;
|
|
2061
|
+
if (state.status === "bridging") return 1;
|
|
2062
|
+
return 0;
|
|
1945
2063
|
};
|
|
1946
|
-
var
|
|
1947
|
-
|
|
2064
|
+
var getLoadingSteps = (labels) => [
|
|
2065
|
+
{ id: "preparing", label: labels.lifecycle.loadingSteps.preparing },
|
|
2066
|
+
{ id: "bridging", label: labels.lifecycle.loadingSteps.bridging },
|
|
2067
|
+
{ id: "sending", label: labels.lifecycle.loadingSteps.sending },
|
|
2068
|
+
{ id: "confirming", label: labels.lifecycle.loadingSteps.confirming }
|
|
2069
|
+
];
|
|
2070
|
+
var WithdrawLoadingStep = ({
|
|
2071
|
+
lifecycleState,
|
|
2072
|
+
onClose
|
|
2073
|
+
}) => {
|
|
2074
|
+
const labels = useLabels14();
|
|
2075
|
+
const {
|
|
2076
|
+
features: { enableAnimations }
|
|
2077
|
+
} = useSdkUiConfig();
|
|
2078
|
+
const walletFlowLabels = labels.withdraw.walletFlow;
|
|
2079
|
+
const activeIndex = loadingActiveIndexFor(lifecycleState);
|
|
2080
|
+
const loadingSteps = getLoadingSteps(walletFlowLabels);
|
|
2081
|
+
return /* @__PURE__ */ jsx15("div", { className: "relative", children: /* @__PURE__ */ jsx15(Modal.Body, { classNames: { root: "px-8 py-7" }, children: /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-7", children: [
|
|
2082
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between gap-4", children: [
|
|
2083
|
+
/* @__PURE__ */ jsx15("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: walletFlowLabels.successTitle }),
|
|
2084
|
+
/* @__PURE__ */ jsx15(
|
|
2085
|
+
"button",
|
|
2086
|
+
{
|
|
2087
|
+
type: "button",
|
|
2088
|
+
className: "flex cursor-pointer items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
|
|
2089
|
+
onClick: onClose,
|
|
2090
|
+
"aria-label": labels.common.close,
|
|
2091
|
+
children: /* @__PURE__ */ jsx15(CloseIcon, { className: "h-6 w-6" })
|
|
2092
|
+
}
|
|
2093
|
+
)
|
|
2094
|
+
] }),
|
|
2095
|
+
/* @__PURE__ */ jsx15("div", { className: "flex flex-col gap-5", role: "status", "aria-live": "polite", children: loadingSteps.map((step, index) => {
|
|
2096
|
+
const isComplete = index < activeIndex;
|
|
2097
|
+
const isActive = index === activeIndex;
|
|
2098
|
+
const textClassName = isActive || isComplete ? "text-agg-foreground" : "text-agg-muted-foreground";
|
|
2099
|
+
return /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-3", children: [
|
|
2100
|
+
isComplete ? /* @__PURE__ */ jsx15(
|
|
2101
|
+
Icon,
|
|
2102
|
+
{
|
|
2103
|
+
name: "check-circle",
|
|
2104
|
+
size: "small",
|
|
2105
|
+
className: "h-4 w-4 shrink-0 text-agg-primary",
|
|
2106
|
+
"aria-hidden": "true"
|
|
2107
|
+
}
|
|
2108
|
+
) : null,
|
|
2109
|
+
isActive ? /* @__PURE__ */ jsx15(
|
|
2110
|
+
LoadingGlyph,
|
|
2111
|
+
{
|
|
2112
|
+
enableAnimations,
|
|
2113
|
+
className: "h-4 w-4 shrink-0 text-agg-primary"
|
|
2114
|
+
}
|
|
2115
|
+
) : null,
|
|
2116
|
+
!isComplete && !isActive ? /* @__PURE__ */ jsx15(
|
|
2117
|
+
"span",
|
|
2118
|
+
{
|
|
2119
|
+
"aria-hidden": "true",
|
|
2120
|
+
className: "h-4 w-4 shrink-0 rounded-full border border-agg-separator"
|
|
2121
|
+
}
|
|
2122
|
+
) : null,
|
|
2123
|
+
/* @__PURE__ */ jsx15("p", { className: cn("min-w-0 flex-1 text-agg-base leading-agg-6", textClassName), children: step.label })
|
|
2124
|
+
] }, step.id);
|
|
2125
|
+
}) }),
|
|
2126
|
+
/* @__PURE__ */ jsx15("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: walletFlowLabels.loadingDescription })
|
|
2127
|
+
] }) }) });
|
|
2128
|
+
};
|
|
2129
|
+
var resultCopyFor = ({
|
|
2130
|
+
status,
|
|
2131
|
+
tokenSymbol,
|
|
2132
|
+
labels
|
|
2133
|
+
}) => {
|
|
2134
|
+
if (status === "failed") {
|
|
2135
|
+
return {
|
|
2136
|
+
title: labels.successTitleFailed,
|
|
2137
|
+
description: labels.successDescriptionFailed(tokenSymbol)
|
|
2138
|
+
};
|
|
2139
|
+
}
|
|
2140
|
+
if (status === "partial_success") {
|
|
2141
|
+
return {
|
|
2142
|
+
title: labels.successTitlePartial,
|
|
2143
|
+
description: labels.successDescriptionPartial(tokenSymbol)
|
|
2144
|
+
};
|
|
2145
|
+
}
|
|
2146
|
+
return {
|
|
2147
|
+
title: labels.successTitleCompleted,
|
|
2148
|
+
description: labels.successDescriptionCompleted(tokenSymbol)
|
|
2149
|
+
};
|
|
1948
2150
|
};
|
|
1949
2151
|
var WithdrawSuccessStep = ({
|
|
1950
2152
|
summary,
|
|
1951
2153
|
tokenSymbol,
|
|
1952
|
-
|
|
2154
|
+
requestedWithdrawal,
|
|
2155
|
+
resultStatus,
|
|
2156
|
+
errorMessage,
|
|
1953
2157
|
onDone,
|
|
2158
|
+
onRetry,
|
|
1954
2159
|
onClose
|
|
1955
2160
|
}) => {
|
|
1956
|
-
|
|
1957
|
-
const labels = useLabels13();
|
|
1958
|
-
const {
|
|
1959
|
-
features: { enableAnimations }
|
|
1960
|
-
} = useSdkUiConfig();
|
|
1961
|
-
const { state } = useWithdrawalLifecycle(withdrawalId);
|
|
1962
|
-
const [isTimelineExpanded, setIsTimelineExpanded] = useState3(true);
|
|
2161
|
+
const labels = useLabels14();
|
|
1963
2162
|
const walletFlowLabels = labels.withdraw.walletFlow;
|
|
1964
|
-
const {
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
walletFlowLabels
|
|
2163
|
+
const { title, description } = resultCopyFor({
|
|
2164
|
+
status: resultStatus,
|
|
2165
|
+
tokenSymbol,
|
|
2166
|
+
labels: walletFlowLabels
|
|
1969
2167
|
});
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
}
|
|
1989
|
-
if (state.terminal && state.status === "failed") {
|
|
1990
|
-
return {
|
|
1991
|
-
titleCopy: walletFlowLabels.successTitleFailed,
|
|
1992
|
-
descriptionCopy: walletFlowLabels.successDescriptionFailed(tokenSymbol)
|
|
1993
|
-
};
|
|
1994
|
-
}
|
|
1995
|
-
return {
|
|
1996
|
-
titleCopy: walletFlowLabels.successTitle,
|
|
1997
|
-
descriptionCopy: walletFlowLabels.successDescription(tokenSymbol)
|
|
1998
|
-
};
|
|
1999
|
-
})();
|
|
2000
|
-
return /* @__PURE__ */ jsx14("div", { className: "relative", children: /* @__PURE__ */ jsxs14(Modal.Body, { classNames: { root: "px-5 py-8 sm:px-8 sm:py-10" }, children: [
|
|
2001
|
-
/* @__PURE__ */ jsx14(
|
|
2002
|
-
"button",
|
|
2003
|
-
{
|
|
2004
|
-
type: "button",
|
|
2005
|
-
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80 cursor-pointer",
|
|
2006
|
-
onClick: onClose,
|
|
2007
|
-
"aria-label": labels.common.close,
|
|
2008
|
-
children: /* @__PURE__ */ jsx14(CloseIcon, { className: "h-6 w-6" })
|
|
2009
|
-
}
|
|
2010
|
-
),
|
|
2011
|
-
/* @__PURE__ */ jsxs14("div", { className: "flex flex-col items-center gap-8", children: [
|
|
2012
|
-
/* @__PURE__ */ jsxs14("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
2013
|
-
/* @__PURE__ */ jsx14("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: titleCopy }),
|
|
2014
|
-
/* @__PURE__ */ jsx14(
|
|
2168
|
+
const isFailed = resultStatus === "failed";
|
|
2169
|
+
return /* @__PURE__ */ jsx15("div", { className: "relative", children: /* @__PURE__ */ jsxs15(Modal.Body, { classNames: { root: "px-10 py-12" }, children: [
|
|
2170
|
+
/* @__PURE__ */ jsx15(WithdrawCloseButton, { onClose, label: labels.common.close }),
|
|
2171
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-col items-center justify-center gap-8 text-center", children: [
|
|
2172
|
+
/* @__PURE__ */ jsx15(
|
|
2173
|
+
"div",
|
|
2174
|
+
{
|
|
2175
|
+
className: cn(
|
|
2176
|
+
"flex h-[60px] w-[60px] items-center justify-center rounded-full",
|
|
2177
|
+
isFailed ? "bg-agg-error/15" : "bg-agg-success/15"
|
|
2178
|
+
),
|
|
2179
|
+
"aria-hidden": "true",
|
|
2180
|
+
children: isFailed ? /* @__PURE__ */ jsx15(CloseIcon, { className: "h-6 w-6 text-agg-error" }) : /* @__PURE__ */ jsx15(SuccessCheckIcon, { className: "h-6 w-6 text-agg-success" })
|
|
2181
|
+
}
|
|
2182
|
+
),
|
|
2183
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex w-full flex-col items-center gap-3 text-center text-agg-foreground", children: [
|
|
2184
|
+
/* @__PURE__ */ jsx15("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold", children: title }),
|
|
2185
|
+
/* @__PURE__ */ jsx15(
|
|
2015
2186
|
"p",
|
|
2016
2187
|
{
|
|
2017
|
-
className: "
|
|
2018
|
-
"data-
|
|
2019
|
-
|
|
2020
|
-
children: descriptionCopy
|
|
2188
|
+
className: "max-w-[400px] text-agg-base leading-agg-6",
|
|
2189
|
+
"data-withdraw-result-status": resultStatus,
|
|
2190
|
+
children: errorMessage && isFailed ? errorMessage : description
|
|
2021
2191
|
}
|
|
2022
|
-
)
|
|
2023
|
-
state.errorMessage ? /* @__PURE__ */ jsx14("p", { className: "agg-type-body text-agg-destructive", children: state.errorMessage }) : null
|
|
2192
|
+
)
|
|
2024
2193
|
] }),
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
{
|
|
2029
|
-
"aria-hidden": !isTimelineExpanded,
|
|
2030
|
-
className: cn(
|
|
2031
|
-
"grid overflow-hidden",
|
|
2032
|
-
isTimelineExpanded ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0",
|
|
2033
|
-
!isTimelineExpanded && "pointer-events-none",
|
|
2034
|
-
getMotionClassName(
|
|
2035
|
-
enableAnimations,
|
|
2036
|
-
"transition-[grid-template-rows,opacity] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
2037
|
-
)
|
|
2038
|
-
),
|
|
2039
|
-
children: /* @__PURE__ */ jsx14("div", { className: "min-h-0", children: /* @__PURE__ */ jsx14("div", { className: "flex flex-col gap-4 pb-2", children: groups.map((group, groupIndex) => /* @__PURE__ */ jsx14(
|
|
2040
|
-
"div",
|
|
2041
|
-
{
|
|
2042
|
-
className: "flex flex-col gap-2",
|
|
2043
|
-
children: group.map((step) => /* @__PURE__ */ jsxs14(
|
|
2044
|
-
"div",
|
|
2045
|
-
{
|
|
2046
|
-
className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
2047
|
-
"data-step-status": step.status,
|
|
2048
|
-
children: [
|
|
2049
|
-
step.status === "pending" ? /* @__PURE__ */ jsx14(
|
|
2050
|
-
LoadingGlyph,
|
|
2051
|
-
{
|
|
2052
|
-
enableAnimations,
|
|
2053
|
-
className: cn(
|
|
2054
|
-
"h-3 w-3 shrink-0",
|
|
2055
|
-
stepIconClassNameFor(step.status)
|
|
2056
|
-
)
|
|
2057
|
-
}
|
|
2058
|
-
) : /* @__PURE__ */ jsx14(
|
|
2059
|
-
Icon,
|
|
2060
|
-
{
|
|
2061
|
-
name: stepIconNameFor(step.status),
|
|
2062
|
-
size: "small",
|
|
2063
|
-
className: cn(
|
|
2064
|
-
"h-3 w-3 shrink-0",
|
|
2065
|
-
stepIconClassNameFor(step.status)
|
|
2066
|
-
),
|
|
2067
|
-
"aria-hidden": "true"
|
|
2068
|
-
}
|
|
2069
|
-
),
|
|
2070
|
-
/* @__PURE__ */ jsx14("p", { className: "min-w-0 flex-1", children: step.label })
|
|
2071
|
-
]
|
|
2072
|
-
},
|
|
2073
|
-
step.id
|
|
2074
|
-
))
|
|
2075
|
-
},
|
|
2076
|
-
`withdraw-step-group-${groupIndex}`
|
|
2077
|
-
)) }) })
|
|
2078
|
-
}
|
|
2079
|
-
) : null,
|
|
2080
|
-
hasDetails ? /* @__PURE__ */ jsxs14(
|
|
2081
|
-
"button",
|
|
2194
|
+
!isFailed ? /* @__PURE__ */ jsxs15("div", { className: "flex w-full max-w-[400px] flex-col rounded-agg-lg border border-agg-separator bg-agg-secondary px-3 py-1 text-left", children: [
|
|
2195
|
+
/* @__PURE__ */ jsx15(
|
|
2196
|
+
SummaryRow3,
|
|
2082
2197
|
{
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
className: cn(
|
|
2086
|
-
"flex w-full items-center gap-2 text-left text-agg-sm leading-agg-5 text-agg-foreground",
|
|
2087
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary",
|
|
2088
|
-
"cursor-pointer"
|
|
2089
|
-
),
|
|
2090
|
-
onClick: () => setIsTimelineExpanded((current) => !current),
|
|
2091
|
-
children: [
|
|
2092
|
-
finalStep.status === "pending" ? /* @__PURE__ */ jsx14(
|
|
2093
|
-
LoadingGlyph,
|
|
2094
|
-
{
|
|
2095
|
-
enableAnimations,
|
|
2096
|
-
className: cn("h-3 w-3 shrink-0", stepIconClassNameFor(finalStep.status))
|
|
2097
|
-
}
|
|
2098
|
-
) : /* @__PURE__ */ jsx14(
|
|
2099
|
-
Icon,
|
|
2100
|
-
{
|
|
2101
|
-
name: stepIconNameFor(finalStep.status),
|
|
2102
|
-
size: "small",
|
|
2103
|
-
className: cn("h-3 w-3 shrink-0", stepIconClassNameFor(finalStep.status)),
|
|
2104
|
-
"aria-hidden": "true"
|
|
2105
|
-
}
|
|
2106
|
-
),
|
|
2107
|
-
/* @__PURE__ */ jsx14("p", { className: "min-w-0 flex-1", children: finalStep.label }),
|
|
2108
|
-
/* @__PURE__ */ jsx14(
|
|
2109
|
-
Icon,
|
|
2110
|
-
{
|
|
2111
|
-
name: isTimelineExpanded ? "chevron-up" : "chevron-down",
|
|
2112
|
-
size: "small",
|
|
2113
|
-
className: "h-4 w-4 shrink-0 text-agg-muted-foreground",
|
|
2114
|
-
"aria-hidden": "true"
|
|
2115
|
-
}
|
|
2116
|
-
)
|
|
2117
|
-
]
|
|
2198
|
+
label: walletFlowLabels.summary.requestedWithdrawal,
|
|
2199
|
+
value: requestedWithdrawal
|
|
2118
2200
|
}
|
|
2119
|
-
)
|
|
2120
|
-
|
|
2121
|
-
/* @__PURE__ */ jsxs14("div", { className: "w-full rounded-lg border border-agg-separator bg-agg-secondary px-3 py-1", children: [
|
|
2122
|
-
/* @__PURE__ */ jsx14(
|
|
2201
|
+
),
|
|
2202
|
+
/* @__PURE__ */ jsx15(
|
|
2123
2203
|
SummaryRow3,
|
|
2124
2204
|
{
|
|
2125
2205
|
label: walletFlowLabels.summary.amountReceived,
|
|
2126
2206
|
value: summary.amountReceived
|
|
2127
2207
|
}
|
|
2128
2208
|
),
|
|
2129
|
-
/* @__PURE__ */
|
|
2130
|
-
/* @__PURE__ */
|
|
2131
|
-
/* @__PURE__ */
|
|
2132
|
-
] }),
|
|
2133
|
-
/* @__PURE__ */
|
|
2209
|
+
/* @__PURE__ */ jsx15(SummaryRow3, { label: walletFlowLabels.summary.fees, value: summary.fees }),
|
|
2210
|
+
/* @__PURE__ */ jsx15(SummaryRow3, { label: walletFlowLabels.summary.network, value: summary.network }),
|
|
2211
|
+
/* @__PURE__ */ jsx15(SummaryRow3, { label: walletFlowLabels.summary.toWallet, value: summary.toWallet })
|
|
2212
|
+
] }) : null,
|
|
2213
|
+
isFailed ? /* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-center gap-3", children: [
|
|
2214
|
+
/* @__PURE__ */ jsx15(Button, { variant: "secondary", size: "large", className: "w-[120px]", onClick: onClose, children: walletFlowLabels.close }),
|
|
2215
|
+
/* @__PURE__ */ jsx15(Button, { variant: "primary", size: "large", className: "w-[123px]", onClick: onRetry, children: walletFlowLabels.retry })
|
|
2216
|
+
] }) : /* @__PURE__ */ jsx15(Button, { variant: "secondary", size: "large", className: "w-[120px]", onClick: onDone, children: labels.withdraw.done })
|
|
2134
2217
|
] })
|
|
2135
2218
|
] }) });
|
|
2136
2219
|
};
|
|
2137
2220
|
|
|
2138
2221
|
// src/withdraw/index.tsx
|
|
2139
|
-
import { jsx as
|
|
2222
|
+
import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2223
|
+
var DEFAULT_TOKEN_DECIMALS = 6;
|
|
2224
|
+
var TOKEN_DECIMALS_BY_SYMBOL = {
|
|
2225
|
+
BNB: 18,
|
|
2226
|
+
ETH: 18,
|
|
2227
|
+
MATIC: 18,
|
|
2228
|
+
POL: 18,
|
|
2229
|
+
WETH: 18,
|
|
2230
|
+
USDC: 6,
|
|
2231
|
+
USDT: 6
|
|
2232
|
+
};
|
|
2233
|
+
var TOKEN_DECIMALS_BY_CHAIN_AND_SYMBOL = {
|
|
2234
|
+
"56": {
|
|
2235
|
+
USDC: 18,
|
|
2236
|
+
USDT: 18
|
|
2237
|
+
}
|
|
2238
|
+
};
|
|
2239
|
+
var getTokenDecimals = (tokenSymbol, chainId) => {
|
|
2240
|
+
var _a;
|
|
2241
|
+
const normalizedSymbol = tokenSymbol.trim().toUpperCase();
|
|
2242
|
+
const normalizedChainId = chainId == null ? void 0 : chainId.trim();
|
|
2243
|
+
if (normalizedChainId) {
|
|
2244
|
+
const chainDecimals = TOKEN_DECIMALS_BY_CHAIN_AND_SYMBOL[normalizedChainId];
|
|
2245
|
+
const chainTokenDecimals = chainDecimals == null ? void 0 : chainDecimals[normalizedSymbol];
|
|
2246
|
+
if (chainTokenDecimals != null) return chainTokenDecimals;
|
|
2247
|
+
}
|
|
2248
|
+
return (_a = TOKEN_DECIMALS_BY_SYMBOL[normalizedSymbol]) != null ? _a : DEFAULT_TOKEN_DECIMALS;
|
|
2249
|
+
};
|
|
2250
|
+
var formatRawTokenAmount = (rawAmount, decimals) => {
|
|
2251
|
+
const raw = BigInt(rawAmount);
|
|
2252
|
+
const divisor = BigInt(`1${"0".repeat(decimals)}`);
|
|
2253
|
+
const whole = raw / divisor;
|
|
2254
|
+
const remainder = raw % divisor;
|
|
2255
|
+
if (remainder === BigInt(0)) return whole.toString();
|
|
2256
|
+
return `${whole.toString()}.${remainder.toString().padStart(decimals, "0").replace(/0+$/, "")}`;
|
|
2257
|
+
};
|
|
2258
|
+
var formatLifecycleTokenAmount = ({
|
|
2259
|
+
rawAmount,
|
|
2260
|
+
tokenSymbol,
|
|
2261
|
+
chainId
|
|
2262
|
+
}) => `${formatRawTokenAmount(rawAmount, getTokenDecimals(tokenSymbol, chainId))} ${tokenSymbol}`;
|
|
2263
|
+
var buildTerminalSummary = ({
|
|
2264
|
+
fallbackSummary,
|
|
2265
|
+
lifecycleCompletedAmountRaw,
|
|
2266
|
+
lifecycleRequestedAmountRaw,
|
|
2267
|
+
tokenSymbol,
|
|
2268
|
+
chainId
|
|
2269
|
+
}) => {
|
|
2270
|
+
if (!lifecycleCompletedAmountRaw) return fallbackSummary;
|
|
2271
|
+
const amountReceived = formatLifecycleTokenAmount({
|
|
2272
|
+
rawAmount: lifecycleCompletedAmountRaw,
|
|
2273
|
+
tokenSymbol,
|
|
2274
|
+
chainId
|
|
2275
|
+
});
|
|
2276
|
+
if (!lifecycleRequestedAmountRaw) {
|
|
2277
|
+
return __spreadProps(__spreadValues({}, fallbackSummary), { amountReceived });
|
|
2278
|
+
}
|
|
2279
|
+
try {
|
|
2280
|
+
const requestedRaw = BigInt(lifecycleRequestedAmountRaw);
|
|
2281
|
+
const completedRaw = BigInt(lifecycleCompletedAmountRaw);
|
|
2282
|
+
const feeRaw = requestedRaw > completedRaw ? requestedRaw - completedRaw : BigInt(0);
|
|
2283
|
+
return __spreadProps(__spreadValues({}, fallbackSummary), {
|
|
2284
|
+
amountReceived,
|
|
2285
|
+
fees: formatLifecycleTokenAmount({
|
|
2286
|
+
rawAmount: feeRaw.toString(),
|
|
2287
|
+
tokenSymbol,
|
|
2288
|
+
chainId
|
|
2289
|
+
})
|
|
2290
|
+
});
|
|
2291
|
+
} catch (e) {
|
|
2292
|
+
return __spreadProps(__spreadValues({}, fallbackSummary), { amountReceived });
|
|
2293
|
+
}
|
|
2294
|
+
};
|
|
2140
2295
|
function isControlledWithdrawModalProps(props) {
|
|
2141
2296
|
return "withdrawFlow" in props;
|
|
2142
2297
|
}
|
|
@@ -2145,7 +2300,7 @@ function WithdrawModalSelfDriven({
|
|
|
2145
2300
|
onOpenChange
|
|
2146
2301
|
}) {
|
|
2147
2302
|
const withdrawProps = useWithdrawFlow({ open, onOpenChange });
|
|
2148
|
-
return /* @__PURE__ */
|
|
2303
|
+
return /* @__PURE__ */ jsx16(WithdrawModalControlled, __spreadValues({}, withdrawProps));
|
|
2149
2304
|
}
|
|
2150
2305
|
function WithdrawModalControlled({
|
|
2151
2306
|
open,
|
|
@@ -2159,51 +2314,98 @@ function WithdrawModalControlled({
|
|
|
2159
2314
|
onSelectWithdrawProvider,
|
|
2160
2315
|
onDoneWithdraw
|
|
2161
2316
|
}) {
|
|
2162
|
-
const [
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2317
|
+
const [flowState, setFlowState] = useState3({
|
|
2318
|
+
status: "form",
|
|
2319
|
+
formStep: "method"
|
|
2320
|
+
});
|
|
2321
|
+
const [isConfirming, setIsConfirming] = useState3(false);
|
|
2322
|
+
const [confirmError, setConfirmError] = useState3(null);
|
|
2323
|
+
const { state: withdrawalLifecycleState, reset: resetWithdrawalLifecycle } = useWithdrawalLifecycle(withdrawFlow.withdrawalId);
|
|
2324
|
+
useEffect4(() => {
|
|
2166
2325
|
if (!open) {
|
|
2167
|
-
|
|
2326
|
+
setFlowState({ status: "form", formStep: "method" });
|
|
2168
2327
|
setIsConfirming(false);
|
|
2169
2328
|
setConfirmError(null);
|
|
2329
|
+
resetWithdrawalLifecycle();
|
|
2170
2330
|
}
|
|
2171
|
-
}, [open]);
|
|
2331
|
+
}, [open, resetWithdrawalLifecycle]);
|
|
2332
|
+
useEffect4(() => {
|
|
2333
|
+
if (flowState.status !== "loading") return;
|
|
2334
|
+
if (!withdrawalLifecycleState.terminal) return;
|
|
2335
|
+
if (withdrawalLifecycleState.status === "completed") {
|
|
2336
|
+
setFlowState({ status: "success" });
|
|
2337
|
+
return;
|
|
2338
|
+
}
|
|
2339
|
+
if (withdrawalLifecycleState.status === "partial") {
|
|
2340
|
+
setFlowState({ status: "partial_success" });
|
|
2341
|
+
return;
|
|
2342
|
+
}
|
|
2343
|
+
if (withdrawalLifecycleState.status === "failed") {
|
|
2344
|
+
setFlowState({
|
|
2345
|
+
status: "failed",
|
|
2346
|
+
errorMessage: withdrawalLifecycleState.errorMessage
|
|
2347
|
+
});
|
|
2348
|
+
}
|
|
2349
|
+
}, [
|
|
2350
|
+
flowState.status,
|
|
2351
|
+
withdrawalLifecycleState.errorMessage,
|
|
2352
|
+
withdrawalLifecycleState.status,
|
|
2353
|
+
withdrawalLifecycleState.terminal
|
|
2354
|
+
]);
|
|
2172
2355
|
const handleOpenChange = (isOpen) => {
|
|
2173
2356
|
if (!isOpen) {
|
|
2174
|
-
|
|
2357
|
+
setFlowState({ status: "form", formStep: "method" });
|
|
2175
2358
|
setIsConfirming(false);
|
|
2176
2359
|
setConfirmError(null);
|
|
2360
|
+
resetWithdrawalLifecycle();
|
|
2177
2361
|
}
|
|
2178
2362
|
onOpenChange(isOpen);
|
|
2179
2363
|
};
|
|
2180
2364
|
const handleBack = () => {
|
|
2181
2365
|
setConfirmError(null);
|
|
2182
|
-
|
|
2366
|
+
setFlowState({ status: "form", formStep: "method" });
|
|
2367
|
+
};
|
|
2368
|
+
const handleRetry = () => {
|
|
2369
|
+
setConfirmError(null);
|
|
2370
|
+
setIsConfirming(false);
|
|
2371
|
+
resetWithdrawalLifecycle();
|
|
2372
|
+
setFlowState({ status: "form", formStep: "withdraw-amount" });
|
|
2183
2373
|
};
|
|
2184
2374
|
const handleConfirm = () => __async(null, null, function* () {
|
|
2375
|
+
setFlowState({ status: "loading" });
|
|
2185
2376
|
setIsConfirming(true);
|
|
2186
2377
|
setConfirmError(null);
|
|
2187
2378
|
try {
|
|
2188
2379
|
yield onSelectWithdrawProvider("wallet");
|
|
2189
|
-
setStep("success");
|
|
2190
2380
|
} catch (err) {
|
|
2191
|
-
|
|
2381
|
+
const errorMessage = err instanceof Error ? err.message : "Withdrawal failed. Please try again.";
|
|
2382
|
+
setConfirmError(errorMessage);
|
|
2383
|
+
setFlowState({ status: "failed", errorMessage });
|
|
2192
2384
|
} finally {
|
|
2193
2385
|
setIsConfirming(false);
|
|
2194
2386
|
}
|
|
2195
2387
|
});
|
|
2196
2388
|
const withdrawTokenOptions = withTokenIcons(withdrawFlow.tokenOptions);
|
|
2197
2389
|
const withdrawNetworkOptions = withNetworkIcons(withdrawFlow.networkOptions);
|
|
2198
|
-
|
|
2199
|
-
|
|
2390
|
+
const requestedWithdrawal = `${withdrawFlow.amount} ${withdrawFlow.selectedToken}`.trim();
|
|
2391
|
+
const modalMaxWidth = flowState.status === "form" && flowState.formStep === "method" ? "600px" : "480px";
|
|
2392
|
+
const resultStatus = flowState.status;
|
|
2393
|
+
const terminalSummary = buildTerminalSummary({
|
|
2394
|
+
fallbackSummary: withdrawFlow.purchaseSummary,
|
|
2395
|
+
lifecycleCompletedAmountRaw: withdrawalLifecycleState.completedAmountRaw,
|
|
2396
|
+
lifecycleRequestedAmountRaw: withdrawalLifecycleState.requestedAmountRaw,
|
|
2397
|
+
tokenSymbol: withdrawFlow.selectedToken,
|
|
2398
|
+
chainId: withdrawFlow.selectedNetwork
|
|
2399
|
+
});
|
|
2400
|
+
return /* @__PURE__ */ jsx16(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs16(Modal.Container, { maxWidth: modalMaxWidth, "aria-label": "Withdraw", children: [
|
|
2401
|
+
flowState.status === "form" && flowState.formStep === "method" ? /* @__PURE__ */ jsx16(
|
|
2200
2402
|
WithdrawMethodStep,
|
|
2201
2403
|
{
|
|
2202
2404
|
balance: withdrawFlow.balance,
|
|
2203
|
-
onSelectMethod: () =>
|
|
2405
|
+
onSelectMethod: () => setFlowState({ status: "form", formStep: "withdraw-amount" })
|
|
2204
2406
|
}
|
|
2205
2407
|
) : null,
|
|
2206
|
-
|
|
2408
|
+
flowState.status === "form" && flowState.formStep === "withdraw-amount" ? /* @__PURE__ */ jsx16(
|
|
2207
2409
|
WithdrawAmountStep,
|
|
2208
2410
|
{
|
|
2209
2411
|
amount: withdrawFlow.amount,
|
|
@@ -2224,13 +2426,23 @@ function WithdrawModalControlled({
|
|
|
2224
2426
|
onContinue: handleConfirm
|
|
2225
2427
|
}
|
|
2226
2428
|
) : null,
|
|
2227
|
-
|
|
2429
|
+
flowState.status === "loading" ? /* @__PURE__ */ jsx16(
|
|
2430
|
+
WithdrawLoadingStep,
|
|
2431
|
+
{
|
|
2432
|
+
lifecycleState: withdrawalLifecycleState,
|
|
2433
|
+
onClose: () => handleOpenChange(false)
|
|
2434
|
+
}
|
|
2435
|
+
) : null,
|
|
2436
|
+
flowState.status === "success" || flowState.status === "partial_success" || flowState.status === "failed" ? /* @__PURE__ */ jsx16(
|
|
2228
2437
|
WithdrawSuccessStep,
|
|
2229
2438
|
{
|
|
2230
|
-
summary:
|
|
2439
|
+
summary: terminalSummary,
|
|
2231
2440
|
tokenSymbol: withdrawFlow.selectedToken,
|
|
2232
|
-
|
|
2441
|
+
requestedWithdrawal,
|
|
2442
|
+
resultStatus,
|
|
2443
|
+
errorMessage: flowState.status === "failed" ? flowState.errorMessage : null,
|
|
2233
2444
|
onDone: onDoneWithdraw,
|
|
2445
|
+
onRetry: handleRetry,
|
|
2234
2446
|
onClose: () => handleOpenChange(false)
|
|
2235
2447
|
}
|
|
2236
2448
|
) : null
|
|
@@ -2238,15 +2450,15 @@ function WithdrawModalControlled({
|
|
|
2238
2450
|
}
|
|
2239
2451
|
var WithdrawModal = (props) => {
|
|
2240
2452
|
if (isControlledWithdrawModalProps(props)) {
|
|
2241
|
-
return /* @__PURE__ */
|
|
2453
|
+
return /* @__PURE__ */ jsx16(WithdrawModalControlled, __spreadValues({}, props));
|
|
2242
2454
|
}
|
|
2243
|
-
return /* @__PURE__ */
|
|
2455
|
+
return /* @__PURE__ */ jsx16(WithdrawModalSelfDriven, __spreadValues({}, props));
|
|
2244
2456
|
};
|
|
2245
2457
|
WithdrawModal.displayName = "WithdrawModal";
|
|
2246
2458
|
|
|
2247
2459
|
// src/onboarding/index.tsx
|
|
2248
|
-
import { useCallback as
|
|
2249
|
-
import { useLabels as
|
|
2460
|
+
import { useCallback as useCallback6, useEffect as useEffect5, useState as useState8 } from "react";
|
|
2461
|
+
import { useLabels as useLabels20 } from "@agg-build/hooks";
|
|
2250
2462
|
import * as Dialog3 from "@radix-ui/react-dialog";
|
|
2251
2463
|
|
|
2252
2464
|
// src/onboarding/onboarding-modal.constants.ts
|
|
@@ -2265,30 +2477,30 @@ var ONBOARDING_STEPS = {
|
|
|
2265
2477
|
var ONCHAIN_VENUES = [Venue.polymarket, Venue.opinion, Venue.predict];
|
|
2266
2478
|
|
|
2267
2479
|
// src/onboarding/steps/how-it-works.tsx
|
|
2268
|
-
import { useCallback, useRef as useRef2, useState as
|
|
2269
|
-
import { useLabels as
|
|
2270
|
-
import { jsx as
|
|
2480
|
+
import { useCallback as useCallback2, useRef as useRef2, useState as useState4 } from "react";
|
|
2481
|
+
import { useLabels as useLabels15 } from "@agg-build/hooks";
|
|
2482
|
+
import { jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2271
2483
|
var defaultIcons = {
|
|
2272
|
-
createAccount: /* @__PURE__ */
|
|
2273
|
-
linkAccounts: /* @__PURE__ */
|
|
2274
|
-
bestPrices: /* @__PURE__ */
|
|
2275
|
-
stayInControl: /* @__PURE__ */
|
|
2484
|
+
createAccount: /* @__PURE__ */ jsx17(CreateAccountIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
|
|
2485
|
+
linkAccounts: /* @__PURE__ */ jsx17(LinkAccountsIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
|
|
2486
|
+
bestPrices: /* @__PURE__ */ jsx17(BestPricesIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
|
|
2487
|
+
stayInControl: /* @__PURE__ */ jsx17(StayInControlIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" })
|
|
2276
2488
|
};
|
|
2277
2489
|
var HowItWorksStep = ({ onContinue, icons }) => {
|
|
2278
|
-
const labels =
|
|
2490
|
+
const labels = useLabels15();
|
|
2279
2491
|
const scrollRef = useRef2(null);
|
|
2280
|
-
const [showTopGradient, setShowTopGradient] =
|
|
2281
|
-
const [showBottomGradient, setShowBottomGradient] =
|
|
2282
|
-
const handleScroll =
|
|
2492
|
+
const [showTopGradient, setShowTopGradient] = useState4(false);
|
|
2493
|
+
const [showBottomGradient, setShowBottomGradient] = useState4(true);
|
|
2494
|
+
const handleScroll = useCallback2(() => {
|
|
2283
2495
|
const el = scrollRef.current;
|
|
2284
2496
|
if (!el) return;
|
|
2285
2497
|
setShowTopGradient(el.scrollTop > 0);
|
|
2286
2498
|
setShowBottomGradient(el.scrollTop + el.clientHeight < el.scrollHeight - 1);
|
|
2287
2499
|
}, []);
|
|
2288
|
-
return /* @__PURE__ */
|
|
2289
|
-
/* @__PURE__ */
|
|
2290
|
-
/* @__PURE__ */
|
|
2291
|
-
/* @__PURE__ */
|
|
2500
|
+
return /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-6 h-[600px] sm:h-auto", children: [
|
|
2501
|
+
/* @__PURE__ */ jsx17("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.howItWorks.title }),
|
|
2502
|
+
/* @__PURE__ */ jsxs17("div", { className: "relative flex-1 min-h-0 sm:flex-initial", children: [
|
|
2503
|
+
/* @__PURE__ */ jsx17(
|
|
2292
2504
|
"div",
|
|
2293
2505
|
{
|
|
2294
2506
|
ref: scrollRef,
|
|
@@ -2298,7 +2510,7 @@ var HowItWorksStep = ({ onContinue, icons }) => {
|
|
|
2298
2510
|
var _a;
|
|
2299
2511
|
const icon = (_a = icons == null ? void 0 : icons[featureKey]) != null ? _a : defaultIcons[featureKey];
|
|
2300
2512
|
const feature = labels.onboarding.howItWorks.features[featureKey];
|
|
2301
|
-
return /* @__PURE__ */
|
|
2513
|
+
return /* @__PURE__ */ jsxs17(
|
|
2302
2514
|
"div",
|
|
2303
2515
|
{
|
|
2304
2516
|
className: cn(
|
|
@@ -2307,11 +2519,11 @@ var HowItWorksStep = ({ onContinue, icons }) => {
|
|
|
2307
2519
|
"bg-agg-secondary-hover"
|
|
2308
2520
|
),
|
|
2309
2521
|
children: [
|
|
2310
|
-
/* @__PURE__ */
|
|
2311
|
-
/* @__PURE__ */
|
|
2312
|
-
/* @__PURE__ */
|
|
2522
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-col flex-1 min-w-0 gap-[6px]", children: [
|
|
2523
|
+
/* @__PURE__ */ jsx17("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: feature.title }),
|
|
2524
|
+
/* @__PURE__ */ jsx17("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: feature.description })
|
|
2313
2525
|
] }),
|
|
2314
|
-
icon ? /* @__PURE__ */
|
|
2526
|
+
icon ? /* @__PURE__ */ jsx17("div", { className: "hidden shrink-0 items-center justify-center text-agg-muted-foreground sm:flex", children: icon }) : null
|
|
2315
2527
|
]
|
|
2316
2528
|
},
|
|
2317
2529
|
featureKey
|
|
@@ -2319,7 +2531,7 @@ var HowItWorksStep = ({ onContinue, icons }) => {
|
|
|
2319
2531
|
})
|
|
2320
2532
|
}
|
|
2321
2533
|
),
|
|
2322
|
-
/* @__PURE__ */
|
|
2534
|
+
/* @__PURE__ */ jsx17(
|
|
2323
2535
|
"div",
|
|
2324
2536
|
{
|
|
2325
2537
|
className: cn(
|
|
@@ -2330,7 +2542,7 @@ var HowItWorksStep = ({ onContinue, icons }) => {
|
|
|
2330
2542
|
)
|
|
2331
2543
|
}
|
|
2332
2544
|
),
|
|
2333
|
-
/* @__PURE__ */
|
|
2545
|
+
/* @__PURE__ */ jsx17(
|
|
2334
2546
|
"div",
|
|
2335
2547
|
{
|
|
2336
2548
|
className: cn(
|
|
@@ -2342,26 +2554,26 @@ var HowItWorksStep = ({ onContinue, icons }) => {
|
|
|
2342
2554
|
}
|
|
2343
2555
|
)
|
|
2344
2556
|
] }),
|
|
2345
|
-
/* @__PURE__ */
|
|
2557
|
+
/* @__PURE__ */ jsx17(Button, { variant: "primary", size: "large", className: "w-full", onClick: onContinue, children: labels.onboarding.howItWorks.continue })
|
|
2346
2558
|
] });
|
|
2347
2559
|
};
|
|
2348
2560
|
HowItWorksStep.displayName = "HowItWorksStep";
|
|
2349
2561
|
|
|
2350
2562
|
// src/onboarding/steps/profile-setup.tsx
|
|
2351
|
-
import { useCallback as
|
|
2352
|
-
import { useLabels as
|
|
2353
|
-
import { jsx as
|
|
2563
|
+
import { useCallback as useCallback3, useRef as useRef3, useState as useState5 } from "react";
|
|
2564
|
+
import { useLabels as useLabels16 } from "@agg-build/hooks";
|
|
2565
|
+
import { jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2354
2566
|
var ProfileSetupStep = ({ onContinue }) => {
|
|
2355
|
-
const labels =
|
|
2356
|
-
const [username, setUsername] =
|
|
2357
|
-
const [avatarFile, setAvatarFile] =
|
|
2358
|
-
const [avatarPreview, setAvatarPreview] =
|
|
2567
|
+
const labels = useLabels16();
|
|
2568
|
+
const [username, setUsername] = useState5("");
|
|
2569
|
+
const [avatarFile, setAvatarFile] = useState5();
|
|
2570
|
+
const [avatarPreview, setAvatarPreview] = useState5();
|
|
2359
2571
|
const fileInputRef = useRef3(null);
|
|
2360
|
-
const handleAvatarClick =
|
|
2572
|
+
const handleAvatarClick = useCallback3(() => {
|
|
2361
2573
|
var _a;
|
|
2362
2574
|
(_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
2363
2575
|
}, []);
|
|
2364
|
-
const handleFileChange =
|
|
2576
|
+
const handleFileChange = useCallback3((e) => {
|
|
2365
2577
|
var _a;
|
|
2366
2578
|
const file = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
2367
2579
|
if (!file) return;
|
|
@@ -2373,18 +2585,18 @@ var ProfileSetupStep = ({ onContinue }) => {
|
|
|
2373
2585
|
};
|
|
2374
2586
|
reader.readAsDataURL(file);
|
|
2375
2587
|
}, []);
|
|
2376
|
-
const handleContinue =
|
|
2588
|
+
const handleContinue = useCallback3(() => {
|
|
2377
2589
|
onContinue({
|
|
2378
2590
|
username,
|
|
2379
2591
|
avatarFile,
|
|
2380
2592
|
avatarPreview
|
|
2381
2593
|
});
|
|
2382
2594
|
}, [username, avatarFile, avatarPreview, onContinue]);
|
|
2383
|
-
return /* @__PURE__ */
|
|
2384
|
-
/* @__PURE__ */
|
|
2385
|
-
/* @__PURE__ */
|
|
2386
|
-
/* @__PURE__ */
|
|
2387
|
-
/* @__PURE__ */
|
|
2595
|
+
return /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-7", children: [
|
|
2596
|
+
/* @__PURE__ */ jsx18("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.profileSetup.title }),
|
|
2597
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-5 items-center w-full", children: [
|
|
2598
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex justify-center", children: [
|
|
2599
|
+
/* @__PURE__ */ jsxs18(
|
|
2388
2600
|
"button",
|
|
2389
2601
|
{
|
|
2390
2602
|
type: "button",
|
|
@@ -2400,13 +2612,13 @@ var ProfileSetupStep = ({ onContinue }) => {
|
|
|
2400
2612
|
),
|
|
2401
2613
|
"aria-label": labels.onboarding.profileSetup.uploadProfilePictureAria,
|
|
2402
2614
|
children: [
|
|
2403
|
-
!avatarPreview ? /* @__PURE__ */
|
|
2615
|
+
!avatarPreview ? /* @__PURE__ */ jsx18(
|
|
2404
2616
|
"svg",
|
|
2405
2617
|
{
|
|
2406
2618
|
"aria-hidden": true,
|
|
2407
2619
|
viewBox: "0 0 80 80",
|
|
2408
2620
|
className: "pointer-events-none absolute inset-0 h-full w-full text-agg-separator group-hover:text-agg-muted-foreground",
|
|
2409
|
-
children: /* @__PURE__ */
|
|
2621
|
+
children: /* @__PURE__ */ jsx18(
|
|
2410
2622
|
"circle",
|
|
2411
2623
|
{
|
|
2412
2624
|
cx: "40",
|
|
@@ -2420,18 +2632,18 @@ var ProfileSetupStep = ({ onContinue }) => {
|
|
|
2420
2632
|
)
|
|
2421
2633
|
}
|
|
2422
2634
|
) : null,
|
|
2423
|
-
avatarPreview ? /* @__PURE__ */
|
|
2635
|
+
avatarPreview ? /* @__PURE__ */ jsx18(
|
|
2424
2636
|
RemoteImage,
|
|
2425
2637
|
{
|
|
2426
2638
|
src: avatarPreview,
|
|
2427
2639
|
alt: labels.onboarding.profileSetup.profilePreviewAlt,
|
|
2428
2640
|
className: "h-full w-full object-cover"
|
|
2429
2641
|
}
|
|
2430
|
-
) : /* @__PURE__ */
|
|
2642
|
+
) : /* @__PURE__ */ jsx18(ProfileIcon, { className: "h-7 w-7 text-agg-muted-foreground" })
|
|
2431
2643
|
]
|
|
2432
2644
|
}
|
|
2433
2645
|
),
|
|
2434
|
-
/* @__PURE__ */
|
|
2646
|
+
/* @__PURE__ */ jsx18(
|
|
2435
2647
|
"input",
|
|
2436
2648
|
{
|
|
2437
2649
|
ref: fileInputRef,
|
|
@@ -2443,8 +2655,8 @@ var ProfileSetupStep = ({ onContinue }) => {
|
|
|
2443
2655
|
}
|
|
2444
2656
|
)
|
|
2445
2657
|
] }),
|
|
2446
|
-
/* @__PURE__ */
|
|
2447
|
-
/* @__PURE__ */
|
|
2658
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-2 w-full", children: [
|
|
2659
|
+
/* @__PURE__ */ jsx18(
|
|
2448
2660
|
"label",
|
|
2449
2661
|
{
|
|
2450
2662
|
htmlFor: "onboarding-username",
|
|
@@ -2452,7 +2664,7 @@ var ProfileSetupStep = ({ onContinue }) => {
|
|
|
2452
2664
|
children: labels.onboarding.profileSetup.usernameLabel
|
|
2453
2665
|
}
|
|
2454
2666
|
),
|
|
2455
|
-
/* @__PURE__ */
|
|
2667
|
+
/* @__PURE__ */ jsx18(
|
|
2456
2668
|
"input",
|
|
2457
2669
|
{
|
|
2458
2670
|
id: "onboarding-username",
|
|
@@ -2476,17 +2688,17 @@ var ProfileSetupStep = ({ onContinue }) => {
|
|
|
2476
2688
|
)
|
|
2477
2689
|
] })
|
|
2478
2690
|
] }),
|
|
2479
|
-
/* @__PURE__ */
|
|
2691
|
+
/* @__PURE__ */ jsx18(Button, { variant: "primary", size: "large", className: "w-full", onClick: handleContinue, children: labels.onboarding.profileSetup.continue })
|
|
2480
2692
|
] });
|
|
2481
2693
|
};
|
|
2482
2694
|
ProfileSetupStep.displayName = "ProfileSetupStep";
|
|
2483
2695
|
|
|
2484
2696
|
// src/onboarding/steps/connect-accounts.tsx
|
|
2485
2697
|
import { Venue as Venue2 } from "@agg-build/sdk";
|
|
2486
|
-
import { useLabels as
|
|
2487
|
-
import { jsx as
|
|
2698
|
+
import { useLabels as useLabels17 } from "@agg-build/hooks";
|
|
2699
|
+
import { jsx as jsx19, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2488
2700
|
var OnchainVenueLogos = () => {
|
|
2489
|
-
return /* @__PURE__ */
|
|
2701
|
+
return /* @__PURE__ */ jsx19("div", { className: "flex gap-1 sm:gap-0 sm:-space-x-5", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ jsx19("div", { style: { zIndex: ONCHAIN_VENUES.length - index }, children: /* @__PURE__ */ jsx19(VenueLogo, { venue, variant: "logo", size: "medium", className: "sm:h-8 sm:w-8" }) }, venue)) });
|
|
2490
2702
|
};
|
|
2491
2703
|
var VenueCard = ({
|
|
2492
2704
|
logos,
|
|
@@ -2497,8 +2709,8 @@ var VenueCard = ({
|
|
|
2497
2709
|
onConnect,
|
|
2498
2710
|
connected = false
|
|
2499
2711
|
}) => {
|
|
2500
|
-
const labels =
|
|
2501
|
-
const action = connected ? /* @__PURE__ */
|
|
2712
|
+
const labels = useLabels17();
|
|
2713
|
+
const action = connected ? /* @__PURE__ */ jsx19(CheckCircleIcon, { className: "h-6 w-6 text-agg-success" }) : /* @__PURE__ */ jsx19(
|
|
2502
2714
|
Button,
|
|
2503
2715
|
{
|
|
2504
2716
|
variant: "tertiary",
|
|
@@ -2508,18 +2720,18 @@ var VenueCard = ({
|
|
|
2508
2720
|
children: labels.onboarding.connectAccounts.connect
|
|
2509
2721
|
}
|
|
2510
2722
|
);
|
|
2511
|
-
const mobileAction = connected ? /* @__PURE__ */
|
|
2723
|
+
const mobileAction = connected ? /* @__PURE__ */ jsx19(CheckCircleIcon, { className: "h-6 w-6 text-agg-success" }) : /* @__PURE__ */ jsx19(
|
|
2512
2724
|
Button,
|
|
2513
2725
|
{
|
|
2514
2726
|
variant: "tertiary",
|
|
2515
2727
|
size: "medium",
|
|
2516
2728
|
className: "!h-auto !px-0 !py-0 text-agg-primary hover:bg-transparent hover:text-agg-primary-hover",
|
|
2517
2729
|
onClick: onConnect,
|
|
2518
|
-
suffix: /* @__PURE__ */
|
|
2730
|
+
suffix: /* @__PURE__ */ jsx19(ChevronRightIcon, { className: "h-4 w-4" }),
|
|
2519
2731
|
children: labels.onboarding.connectAccounts.connectAccount
|
|
2520
2732
|
}
|
|
2521
2733
|
);
|
|
2522
|
-
return /* @__PURE__ */
|
|
2734
|
+
return /* @__PURE__ */ jsxs19(
|
|
2523
2735
|
"div",
|
|
2524
2736
|
{
|
|
2525
2737
|
className: cn(
|
|
@@ -2527,23 +2739,23 @@ var VenueCard = ({
|
|
|
2527
2739
|
connected ? "bg-agg-success/5" : "bg-agg-secondary-hover hover:bg-agg-tertiary"
|
|
2528
2740
|
),
|
|
2529
2741
|
children: [
|
|
2530
|
-
/* @__PURE__ */
|
|
2531
|
-
/* @__PURE__ */
|
|
2532
|
-
/* @__PURE__ */
|
|
2533
|
-
/* @__PURE__ */
|
|
2534
|
-
/* @__PURE__ */
|
|
2535
|
-
/* @__PURE__ */
|
|
2742
|
+
/* @__PURE__ */ jsxs19("div", { className: "hidden sm:flex items-center justify-between", children: [
|
|
2743
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-5", children: [
|
|
2744
|
+
/* @__PURE__ */ jsx19("div", { className: "shrink-0", children: logos }),
|
|
2745
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-[2px]", children: [
|
|
2746
|
+
/* @__PURE__ */ jsx19("p", { className: "text-agg-base font-agg-bold text-agg-foreground", children: title }),
|
|
2747
|
+
/* @__PURE__ */ jsx19("p", { className: "text-agg-sm text-agg-foreground", children: description })
|
|
2536
2748
|
] })
|
|
2537
2749
|
] }),
|
|
2538
|
-
/* @__PURE__ */
|
|
2750
|
+
/* @__PURE__ */ jsx19("div", { className: "shrink-0", children: action })
|
|
2539
2751
|
] }),
|
|
2540
|
-
/* @__PURE__ */
|
|
2541
|
-
/* @__PURE__ */
|
|
2542
|
-
/* @__PURE__ */
|
|
2543
|
-
/* @__PURE__ */
|
|
2752
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-3 sm:hidden", children: [
|
|
2753
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-3", children: [
|
|
2754
|
+
/* @__PURE__ */ jsx19("div", { className: "shrink-0", children: logos }),
|
|
2755
|
+
/* @__PURE__ */ jsx19("p", { className: "text-agg-lg font-agg-bold text-agg-foreground", children: mobileTitle != null ? mobileTitle : title })
|
|
2544
2756
|
] }),
|
|
2545
|
-
/* @__PURE__ */
|
|
2546
|
-
/* @__PURE__ */
|
|
2757
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-col items-start gap-2", children: [
|
|
2758
|
+
/* @__PURE__ */ jsx19("p", { className: "text-agg-base text-agg-foreground", children: mobileDescription != null ? mobileDescription : description }),
|
|
2547
2759
|
mobileAction
|
|
2548
2760
|
] })
|
|
2549
2761
|
] })
|
|
@@ -2558,15 +2770,15 @@ var ConnectAccountsStep = ({
|
|
|
2558
2770
|
connectedOnchain = false,
|
|
2559
2771
|
connectedKalshi = false
|
|
2560
2772
|
}) => {
|
|
2561
|
-
const labels =
|
|
2773
|
+
const labels = useLabels17();
|
|
2562
2774
|
const canContinue = connectedOnchain || connectedKalshi;
|
|
2563
|
-
return /* @__PURE__ */
|
|
2564
|
-
/* @__PURE__ */
|
|
2565
|
-
/* @__PURE__ */
|
|
2566
|
-
/* @__PURE__ */
|
|
2775
|
+
return /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-6", children: [
|
|
2776
|
+
/* @__PURE__ */ jsx19("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectAccounts.title }),
|
|
2777
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-4", children: [
|
|
2778
|
+
/* @__PURE__ */ jsx19(
|
|
2567
2779
|
VenueCard,
|
|
2568
2780
|
{
|
|
2569
|
-
logos: /* @__PURE__ */
|
|
2781
|
+
logos: /* @__PURE__ */ jsx19(OnchainVenueLogos, {}),
|
|
2570
2782
|
title: labels.onboarding.connectAccounts.onchainTitle,
|
|
2571
2783
|
mobileTitle: labels.onboarding.connectAccounts.onchainMobileTitle(
|
|
2572
2784
|
ONCHAIN_VENUES.length - 1
|
|
@@ -2577,10 +2789,10 @@ var ConnectAccountsStep = ({
|
|
|
2577
2789
|
connected: connectedOnchain
|
|
2578
2790
|
}
|
|
2579
2791
|
),
|
|
2580
|
-
/* @__PURE__ */
|
|
2792
|
+
/* @__PURE__ */ jsx19(
|
|
2581
2793
|
VenueCard,
|
|
2582
2794
|
{
|
|
2583
|
-
logos: /* @__PURE__ */
|
|
2795
|
+
logos: /* @__PURE__ */ jsx19("div", { className: "sm:flex sm:w-14 sm:items-center sm:justify-center", children: /* @__PURE__ */ jsx19(
|
|
2584
2796
|
VenueLogo,
|
|
2585
2797
|
{
|
|
2586
2798
|
venue: Venue2.kalshi,
|
|
@@ -2598,7 +2810,7 @@ var ConnectAccountsStep = ({
|
|
|
2598
2810
|
}
|
|
2599
2811
|
)
|
|
2600
2812
|
] }),
|
|
2601
|
-
/* @__PURE__ */
|
|
2813
|
+
/* @__PURE__ */ jsx19(
|
|
2602
2814
|
Button,
|
|
2603
2815
|
{
|
|
2604
2816
|
variant: "primary",
|
|
@@ -2615,25 +2827,25 @@ ConnectAccountsStep.displayName = "ConnectAccountsStep";
|
|
|
2615
2827
|
|
|
2616
2828
|
// src/onboarding/steps/connect-kalshi-modal.tsx
|
|
2617
2829
|
import { Venue as Venue3 } from "@agg-build/sdk";
|
|
2618
|
-
import { useCallback as
|
|
2619
|
-
import { useLabels as
|
|
2830
|
+
import { useCallback as useCallback4, useState as useState6 } from "react";
|
|
2831
|
+
import { useLabels as useLabels18 } from "@agg-build/hooks";
|
|
2620
2832
|
import * as Dialog from "@radix-ui/react-dialog";
|
|
2621
|
-
import { jsx as
|
|
2833
|
+
import { jsx as jsx20, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2622
2834
|
var ConnectKalshiModal = ({
|
|
2623
2835
|
open,
|
|
2624
2836
|
onOpenChange,
|
|
2625
2837
|
onVerify
|
|
2626
2838
|
}) => {
|
|
2627
|
-
const labels =
|
|
2628
|
-
const [apiKeyId, setApiKeyId] =
|
|
2629
|
-
const [privateKey, setPrivateKey] =
|
|
2630
|
-
const [verifying, setVerifying] =
|
|
2631
|
-
const [error, setError] =
|
|
2839
|
+
const labels = useLabels18();
|
|
2840
|
+
const [apiKeyId, setApiKeyId] = useState6("");
|
|
2841
|
+
const [privateKey, setPrivateKey] = useState6("");
|
|
2842
|
+
const [verifying, setVerifying] = useState6(false);
|
|
2843
|
+
const [error, setError] = useState6();
|
|
2632
2844
|
const canVerify = apiKeyId.trim().length > 0 && privateKey.trim().length > 0;
|
|
2633
|
-
const handleCancel =
|
|
2845
|
+
const handleCancel = useCallback4(() => {
|
|
2634
2846
|
onOpenChange(false);
|
|
2635
2847
|
}, [onOpenChange]);
|
|
2636
|
-
const handleVerify =
|
|
2848
|
+
const handleVerify = useCallback4(() => __async(null, null, function* () {
|
|
2637
2849
|
if (!canVerify || verifying) return;
|
|
2638
2850
|
setVerifying(true);
|
|
2639
2851
|
setError(void 0);
|
|
@@ -2662,7 +2874,7 @@ var ConnectKalshiModal = ({
|
|
|
2662
2874
|
privateKey,
|
|
2663
2875
|
verifying
|
|
2664
2876
|
]);
|
|
2665
|
-
const handleOpenChange =
|
|
2877
|
+
const handleOpenChange = useCallback4(
|
|
2666
2878
|
(value) => {
|
|
2667
2879
|
if (value) {
|
|
2668
2880
|
setApiKeyId("");
|
|
@@ -2674,15 +2886,15 @@ var ConnectKalshiModal = ({
|
|
|
2674
2886
|
},
|
|
2675
2887
|
[onOpenChange]
|
|
2676
2888
|
);
|
|
2677
|
-
return /* @__PURE__ */
|
|
2889
|
+
return /* @__PURE__ */ jsx20(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs20(
|
|
2678
2890
|
Modal.Container,
|
|
2679
2891
|
{
|
|
2680
2892
|
maxWidth: "600px",
|
|
2681
2893
|
"aria-label": labels.onboarding.connectKalshiModal.ariaLabel,
|
|
2682
2894
|
classNames: { container: "!rounded-agg-lg" },
|
|
2683
2895
|
children: [
|
|
2684
|
-
/* @__PURE__ */
|
|
2685
|
-
/* @__PURE__ */
|
|
2896
|
+
/* @__PURE__ */ jsx20(Dialog.Title, { className: "sr-only", children: labels.onboarding.connectKalshiModal.title }),
|
|
2897
|
+
/* @__PURE__ */ jsx20(
|
|
2686
2898
|
Modal.Header,
|
|
2687
2899
|
{
|
|
2688
2900
|
hideClose: false,
|
|
@@ -2693,8 +2905,8 @@ var ConnectKalshiModal = ({
|
|
|
2693
2905
|
}
|
|
2694
2906
|
}
|
|
2695
2907
|
),
|
|
2696
|
-
/* @__PURE__ */
|
|
2697
|
-
/* @__PURE__ */
|
|
2908
|
+
/* @__PURE__ */ jsx20(Modal.Body, { classNames: { root: "!px-5 !pt-0 !pb-[60px] sm:!px-8" }, children: /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-8 items-center", children: [
|
|
2909
|
+
/* @__PURE__ */ jsx20(
|
|
2698
2910
|
VenueLogo,
|
|
2699
2911
|
{
|
|
2700
2912
|
venue: Venue3.kalshi,
|
|
@@ -2703,54 +2915,54 @@ var ConnectKalshiModal = ({
|
|
|
2703
2915
|
className: "h-[60px] w-[60px]"
|
|
2704
2916
|
}
|
|
2705
2917
|
),
|
|
2706
|
-
/* @__PURE__ */
|
|
2707
|
-
/* @__PURE__ */
|
|
2708
|
-
/* @__PURE__ */
|
|
2918
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-4 items-center text-center", children: [
|
|
2919
|
+
/* @__PURE__ */ jsx20("h2", { className: "text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectKalshiModal.title }),
|
|
2920
|
+
/* @__PURE__ */ jsx20("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: labels.onboarding.connectKalshiModal.description })
|
|
2709
2921
|
] }),
|
|
2710
|
-
/* @__PURE__ */
|
|
2711
|
-
/* @__PURE__ */
|
|
2712
|
-
/* @__PURE__ */
|
|
2713
|
-
/* @__PURE__ */
|
|
2714
|
-
/* @__PURE__ */
|
|
2922
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-4 w-full", children: [
|
|
2923
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-3 rounded-agg-lg bg-agg-secondary-hover p-4", children: [
|
|
2924
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-1", children: [
|
|
2925
|
+
/* @__PURE__ */ jsx20("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepOne.label }),
|
|
2926
|
+
/* @__PURE__ */ jsx20("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepOne.title })
|
|
2715
2927
|
] }),
|
|
2716
|
-
/* @__PURE__ */
|
|
2717
|
-
/* @__PURE__ */
|
|
2718
|
-
/* @__PURE__ */
|
|
2928
|
+
/* @__PURE__ */ jsxs20("div", { className: "space-y-0 text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
2929
|
+
/* @__PURE__ */ jsx20("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.signIn }),
|
|
2930
|
+
/* @__PURE__ */ jsxs20("p", { children: [
|
|
2719
2931
|
labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfilePrefix,
|
|
2720
2932
|
" ",
|
|
2721
|
-
/* @__PURE__ */
|
|
2933
|
+
/* @__PURE__ */ jsx20("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileText }),
|
|
2722
2934
|
labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfileSeparator,
|
|
2723
2935
|
" ",
|
|
2724
|
-
/* @__PURE__ */
|
|
2936
|
+
/* @__PURE__ */ jsx20("span", { className: "text-agg-foreground underline", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileUrl })
|
|
2725
2937
|
] }),
|
|
2726
|
-
/* @__PURE__ */
|
|
2938
|
+
/* @__PURE__ */ jsxs20("p", { children: [
|
|
2727
2939
|
labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeyPrefix,
|
|
2728
2940
|
" ",
|
|
2729
|
-
/* @__PURE__ */
|
|
2941
|
+
/* @__PURE__ */ jsx20("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKeyText }),
|
|
2730
2942
|
labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeySuffix
|
|
2731
2943
|
] }),
|
|
2732
|
-
/* @__PURE__ */
|
|
2944
|
+
/* @__PURE__ */ jsxs20("p", { children: [
|
|
2733
2945
|
labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsPrefix,
|
|
2734
2946
|
" ",
|
|
2735
|
-
/* @__PURE__ */
|
|
2947
|
+
/* @__PURE__ */ jsx20("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.readWriteText }),
|
|
2736
2948
|
labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsSuffix
|
|
2737
2949
|
] }),
|
|
2738
|
-
/* @__PURE__ */
|
|
2950
|
+
/* @__PURE__ */ jsx20("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKey })
|
|
2739
2951
|
] }),
|
|
2740
|
-
/* @__PURE__ */
|
|
2952
|
+
/* @__PURE__ */ jsxs20("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
2741
2953
|
labels.onboarding.connectKalshiModal.stepOne.footerLineOne,
|
|
2742
|
-
/* @__PURE__ */
|
|
2954
|
+
/* @__PURE__ */ jsx20("br", {}),
|
|
2743
2955
|
labels.onboarding.connectKalshiModal.stepOne.footerLineTwo
|
|
2744
2956
|
] })
|
|
2745
2957
|
] }),
|
|
2746
|
-
/* @__PURE__ */
|
|
2747
|
-
/* @__PURE__ */
|
|
2748
|
-
/* @__PURE__ */
|
|
2749
|
-
/* @__PURE__ */
|
|
2958
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-3 rounded-agg-lg bg-agg-secondary-hover p-4", children: [
|
|
2959
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-1", children: [
|
|
2960
|
+
/* @__PURE__ */ jsx20("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.label }),
|
|
2961
|
+
/* @__PURE__ */ jsx20("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.title })
|
|
2750
2962
|
] }),
|
|
2751
|
-
/* @__PURE__ */
|
|
2752
|
-
/* @__PURE__ */
|
|
2753
|
-
/* @__PURE__ */
|
|
2963
|
+
/* @__PURE__ */ jsx20("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.description }),
|
|
2964
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-2", children: [
|
|
2965
|
+
/* @__PURE__ */ jsx20(
|
|
2754
2966
|
"label",
|
|
2755
2967
|
{
|
|
2756
2968
|
htmlFor: "kalshi-api-key-id",
|
|
@@ -2758,7 +2970,7 @@ var ConnectKalshiModal = ({
|
|
|
2758
2970
|
children: labels.onboarding.connectKalshiModal.stepTwo.apiKeyIdLabel
|
|
2759
2971
|
}
|
|
2760
2972
|
),
|
|
2761
|
-
/* @__PURE__ */
|
|
2973
|
+
/* @__PURE__ */ jsx20(
|
|
2762
2974
|
"input",
|
|
2763
2975
|
{
|
|
2764
2976
|
id: "kalshi-api-key-id",
|
|
@@ -2778,8 +2990,8 @@ var ConnectKalshiModal = ({
|
|
|
2778
2990
|
}
|
|
2779
2991
|
)
|
|
2780
2992
|
] }),
|
|
2781
|
-
/* @__PURE__ */
|
|
2782
|
-
/* @__PURE__ */
|
|
2993
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-2", children: [
|
|
2994
|
+
/* @__PURE__ */ jsx20(
|
|
2783
2995
|
"label",
|
|
2784
2996
|
{
|
|
2785
2997
|
htmlFor: "kalshi-private-key",
|
|
@@ -2787,7 +2999,7 @@ var ConnectKalshiModal = ({
|
|
|
2787
2999
|
children: labels.onboarding.connectKalshiModal.stepTwo.privateKeyLabel
|
|
2788
3000
|
}
|
|
2789
3001
|
),
|
|
2790
|
-
/* @__PURE__ */
|
|
3002
|
+
/* @__PURE__ */ jsx20(
|
|
2791
3003
|
"textarea",
|
|
2792
3004
|
{
|
|
2793
3005
|
id: "kalshi-private-key",
|
|
@@ -2809,42 +3021,42 @@ var ConnectKalshiModal = ({
|
|
|
2809
3021
|
] })
|
|
2810
3022
|
] })
|
|
2811
3023
|
] }),
|
|
2812
|
-
/* @__PURE__ */
|
|
2813
|
-
/* @__PURE__ */
|
|
2814
|
-
/* @__PURE__ */
|
|
2815
|
-
/* @__PURE__ */
|
|
3024
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between w-full", children: [
|
|
3025
|
+
/* @__PURE__ */ jsx20("p", { className: "text-agg-base text-agg-foreground", children: labels.onboarding.connectKalshiModal.help.label }),
|
|
3026
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-3", children: [
|
|
3027
|
+
/* @__PURE__ */ jsxs20(
|
|
2816
3028
|
"a",
|
|
2817
3029
|
{
|
|
2818
3030
|
href: "#",
|
|
2819
3031
|
className: "flex items-center gap-2 text-agg-base font-agg-bold text-agg-primary hover:text-agg-primary-hover",
|
|
2820
3032
|
children: [
|
|
2821
|
-
/* @__PURE__ */
|
|
3033
|
+
/* @__PURE__ */ jsx20(DocumentIcon, { className: "h-4 w-4" }),
|
|
2822
3034
|
labels.onboarding.connectKalshiModal.help.docsLinkLabel
|
|
2823
3035
|
]
|
|
2824
3036
|
}
|
|
2825
3037
|
),
|
|
2826
|
-
/* @__PURE__ */
|
|
2827
|
-
/* @__PURE__ */
|
|
3038
|
+
/* @__PURE__ */ jsx20("span", { className: "h-3 w-px bg-agg-separator" }),
|
|
3039
|
+
/* @__PURE__ */ jsxs20(
|
|
2828
3040
|
"a",
|
|
2829
3041
|
{
|
|
2830
3042
|
href: "#",
|
|
2831
3043
|
className: "flex items-center gap-2 text-agg-base font-agg-bold text-agg-primary hover:text-agg-primary-hover",
|
|
2832
3044
|
children: [
|
|
2833
|
-
/* @__PURE__ */
|
|
3045
|
+
/* @__PURE__ */ jsx20(PlaySquareIcon, { className: "h-4 w-4" }),
|
|
2834
3046
|
labels.onboarding.connectKalshiModal.help.tutorialLinkLabel
|
|
2835
3047
|
]
|
|
2836
3048
|
}
|
|
2837
3049
|
)
|
|
2838
3050
|
] })
|
|
2839
3051
|
] }),
|
|
2840
|
-
/* @__PURE__ */
|
|
2841
|
-
error ? /* @__PURE__ */
|
|
2842
|
-
/* @__PURE__ */
|
|
2843
|
-
/* @__PURE__ */
|
|
3052
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-5 items-center", children: [
|
|
3053
|
+
error ? /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2", children: [
|
|
3054
|
+
/* @__PURE__ */ jsx20(WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }),
|
|
3055
|
+
/* @__PURE__ */ jsx20("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
|
|
2844
3056
|
] }) : null,
|
|
2845
|
-
/* @__PURE__ */
|
|
2846
|
-
/* @__PURE__ */
|
|
2847
|
-
/* @__PURE__ */
|
|
3057
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-3 justify-center", children: [
|
|
3058
|
+
/* @__PURE__ */ jsx20(Button, { variant: "secondary", size: "large", onClick: handleCancel, children: labels.onboarding.connectKalshiModal.actions.cancel }),
|
|
3059
|
+
/* @__PURE__ */ jsx20(
|
|
2848
3060
|
Button,
|
|
2849
3061
|
{
|
|
2850
3062
|
variant: "primary",
|
|
@@ -2865,22 +3077,22 @@ var ConnectKalshiModal = ({
|
|
|
2865
3077
|
ConnectKalshiModal.displayName = "ConnectKalshiModal";
|
|
2866
3078
|
|
|
2867
3079
|
// src/onboarding/steps/connect-onchain-modal.tsx
|
|
2868
|
-
import { useCallback as
|
|
2869
|
-
import { useLabels as
|
|
3080
|
+
import { useCallback as useCallback5, useState as useState7 } from "react";
|
|
3081
|
+
import { useLabels as useLabels19 } from "@agg-build/hooks";
|
|
2870
3082
|
import * as Dialog2 from "@radix-ui/react-dialog";
|
|
2871
|
-
import { jsx as
|
|
3083
|
+
import { jsx as jsx21, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2872
3084
|
var ConnectOnchainModal = ({
|
|
2873
3085
|
open,
|
|
2874
3086
|
onOpenChange,
|
|
2875
3087
|
onConnect
|
|
2876
3088
|
}) => {
|
|
2877
|
-
const labels =
|
|
2878
|
-
const [connecting, setConnecting] =
|
|
2879
|
-
const [error, setError] =
|
|
2880
|
-
const handleCancel =
|
|
3089
|
+
const labels = useLabels19();
|
|
3090
|
+
const [connecting, setConnecting] = useState7(false);
|
|
3091
|
+
const [error, setError] = useState7();
|
|
3092
|
+
const handleCancel = useCallback5(() => {
|
|
2881
3093
|
onOpenChange(false);
|
|
2882
3094
|
}, [onOpenChange]);
|
|
2883
|
-
const handleConnect =
|
|
3095
|
+
const handleConnect = useCallback5(() => __async(null, null, function* () {
|
|
2884
3096
|
if (connecting) return;
|
|
2885
3097
|
setConnecting(true);
|
|
2886
3098
|
setError(void 0);
|
|
@@ -2895,7 +3107,7 @@ var ConnectOnchainModal = ({
|
|
|
2895
3107
|
setConnecting(false);
|
|
2896
3108
|
}
|
|
2897
3109
|
}), [connecting, labels.onboarding.connectOnchainModal.fallbackError, onConnect, onOpenChange]);
|
|
2898
|
-
const handleOpenChange =
|
|
3110
|
+
const handleOpenChange = useCallback5(
|
|
2899
3111
|
(value) => {
|
|
2900
3112
|
if (value) {
|
|
2901
3113
|
setError(void 0);
|
|
@@ -2905,15 +3117,15 @@ var ConnectOnchainModal = ({
|
|
|
2905
3117
|
},
|
|
2906
3118
|
[onOpenChange]
|
|
2907
3119
|
);
|
|
2908
|
-
return /* @__PURE__ */
|
|
3120
|
+
return /* @__PURE__ */ jsx21(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs21(
|
|
2909
3121
|
Modal.Container,
|
|
2910
3122
|
{
|
|
2911
3123
|
maxWidth: "600px",
|
|
2912
3124
|
"aria-label": labels.onboarding.connectOnchainModal.ariaLabel,
|
|
2913
3125
|
classNames: { container: "!rounded-agg-lg" },
|
|
2914
3126
|
children: [
|
|
2915
|
-
/* @__PURE__ */
|
|
2916
|
-
/* @__PURE__ */
|
|
3127
|
+
/* @__PURE__ */ jsx21(Dialog2.Title, { className: "sr-only", children: labels.onboarding.connectOnchainModal.title }),
|
|
3128
|
+
/* @__PURE__ */ jsx21(
|
|
2917
3129
|
Modal.Header,
|
|
2918
3130
|
{
|
|
2919
3131
|
hideClose: false,
|
|
@@ -2924,26 +3136,26 @@ var ConnectOnchainModal = ({
|
|
|
2924
3136
|
}
|
|
2925
3137
|
}
|
|
2926
3138
|
),
|
|
2927
|
-
/* @__PURE__ */
|
|
2928
|
-
/* @__PURE__ */
|
|
2929
|
-
/* @__PURE__ */
|
|
2930
|
-
/* @__PURE__ */
|
|
3139
|
+
/* @__PURE__ */ jsx21(Modal.Body, { classNames: { root: "!px-5 !pt-0 !pb-[60px] sm:!px-8" }, children: /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-8 items-center", children: [
|
|
3140
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-4 items-center text-center", children: [
|
|
3141
|
+
/* @__PURE__ */ jsx21("h2", { className: "text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectOnchainModal.title }),
|
|
3142
|
+
/* @__PURE__ */ jsx21("p", { className: "text-agg-base text-center leading-agg-6 text-agg-foreground whitespace-pre-line", children: labels.onboarding.connectOnchainModal.description })
|
|
2931
3143
|
] }),
|
|
2932
|
-
/* @__PURE__ */
|
|
2933
|
-
/* @__PURE__ */
|
|
2934
|
-
/* @__PURE__ */
|
|
2935
|
-
index > 0 && /* @__PURE__ */
|
|
2936
|
-
/* @__PURE__ */
|
|
2937
|
-
/* @__PURE__ */
|
|
3144
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex w-full flex-col items-center gap-4 rounded-agg-xl bg-agg-secondary-hover p-6", children: [
|
|
3145
|
+
/* @__PURE__ */ jsx21("p", { className: "text-agg-sm font-agg-bold uppercase leading-agg-5 text-agg-muted-foreground", children: labels.onboarding.connectOnchainModal.supportedVenuesLabel }),
|
|
3146
|
+
/* @__PURE__ */ jsx21("div", { className: "flex flex-wrap items-center justify-center gap-x-4 gap-y-3", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-[6px]", children: [
|
|
3147
|
+
index > 0 && /* @__PURE__ */ jsx21("span", { className: "mr-2.5 h-3 w-px bg-agg-separator" }),
|
|
3148
|
+
/* @__PURE__ */ jsx21(VenueLogo, { venue, size: "medium" }),
|
|
3149
|
+
/* @__PURE__ */ jsx21("span", { className: "text-agg-base text-agg-foreground", children: labels.venues[venue] })
|
|
2938
3150
|
] }, venue)) })
|
|
2939
3151
|
] }),
|
|
2940
|
-
/* @__PURE__ */
|
|
2941
|
-
/* @__PURE__ */
|
|
2942
|
-
error ? /* @__PURE__ */
|
|
2943
|
-
/* @__PURE__ */
|
|
2944
|
-
/* @__PURE__ */
|
|
3152
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-6 items-center", children: [
|
|
3153
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-3 items-center", children: [
|
|
3154
|
+
error ? /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-2", children: [
|
|
3155
|
+
/* @__PURE__ */ jsx21(WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }),
|
|
3156
|
+
/* @__PURE__ */ jsx21("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
|
|
2945
3157
|
] }) : null,
|
|
2946
|
-
/* @__PURE__ */
|
|
3158
|
+
/* @__PURE__ */ jsx21(
|
|
2947
3159
|
Button,
|
|
2948
3160
|
{
|
|
2949
3161
|
variant: "primary",
|
|
@@ -2954,7 +3166,7 @@ var ConnectOnchainModal = ({
|
|
|
2954
3166
|
}
|
|
2955
3167
|
)
|
|
2956
3168
|
] }),
|
|
2957
|
-
/* @__PURE__ */
|
|
3169
|
+
/* @__PURE__ */ jsx21(
|
|
2958
3170
|
Button,
|
|
2959
3171
|
{
|
|
2960
3172
|
variant: "tertiary",
|
|
@@ -2973,7 +3185,7 @@ var ConnectOnchainModal = ({
|
|
|
2973
3185
|
ConnectOnchainModal.displayName = "ConnectOnchainModal";
|
|
2974
3186
|
|
|
2975
3187
|
// src/onboarding/index.tsx
|
|
2976
|
-
import { Fragment as Fragment9, jsx as
|
|
3188
|
+
import { Fragment as Fragment9, jsx as jsx22, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2977
3189
|
var OnboardingModal = ({
|
|
2978
3190
|
open,
|
|
2979
3191
|
onOpenChange,
|
|
@@ -2986,68 +3198,68 @@ var OnboardingModal = ({
|
|
|
2986
3198
|
connectedKalshi = false
|
|
2987
3199
|
}) => {
|
|
2988
3200
|
var _a;
|
|
2989
|
-
const labels =
|
|
2990
|
-
const [step, setStep] =
|
|
3201
|
+
const labels = useLabels20();
|
|
3202
|
+
const [step, setStep] = useState8(ONBOARDING_STEPS.HOW_IT_WORKS);
|
|
2991
3203
|
const stepLabels = {
|
|
2992
3204
|
[ONBOARDING_STEPS.HOW_IT_WORKS]: labels.onboarding.modal.stepHowItWorks,
|
|
2993
3205
|
[ONBOARDING_STEPS.PROFILE_SETUP]: labels.onboarding.modal.stepProfileSetup,
|
|
2994
3206
|
[ONBOARDING_STEPS.CONNECT_ACCOUNTS]: labels.onboarding.modal.stepConnectAccounts
|
|
2995
3207
|
};
|
|
2996
3208
|
const resolvedTitle = (_a = stepLabels[step]) != null ? _a : labels.onboarding.modal.title;
|
|
2997
|
-
const [kalshiModalOpen, setKalshiModalOpen] =
|
|
2998
|
-
const [kalshiConnected, setKalshiConnected] =
|
|
2999
|
-
const [onchainModalOpen, setOnchainModalOpen] =
|
|
3000
|
-
const [onchainConnected, setOnchainConnected] =
|
|
3001
|
-
|
|
3209
|
+
const [kalshiModalOpen, setKalshiModalOpen] = useState8(false);
|
|
3210
|
+
const [kalshiConnected, setKalshiConnected] = useState8(false);
|
|
3211
|
+
const [onchainModalOpen, setOnchainModalOpen] = useState8(false);
|
|
3212
|
+
const [onchainConnected, setOnchainConnected] = useState8(false);
|
|
3213
|
+
useEffect5(() => {
|
|
3002
3214
|
if (open) {
|
|
3003
3215
|
setStep(ONBOARDING_STEPS.HOW_IT_WORKS);
|
|
3004
3216
|
setKalshiConnected(false);
|
|
3005
3217
|
setOnchainConnected(false);
|
|
3006
3218
|
}
|
|
3007
3219
|
}, [open]);
|
|
3008
|
-
const handleHowItWorksContinue =
|
|
3220
|
+
const handleHowItWorksContinue = useCallback6(() => {
|
|
3009
3221
|
setStep(ONBOARDING_STEPS.PROFILE_SETUP);
|
|
3010
3222
|
}, []);
|
|
3011
|
-
const handleProfileContinue =
|
|
3223
|
+
const handleProfileContinue = useCallback6(
|
|
3012
3224
|
(data) => {
|
|
3013
3225
|
onProfileSubmit == null ? void 0 : onProfileSubmit(data);
|
|
3014
3226
|
setStep(ONBOARDING_STEPS.CONNECT_ACCOUNTS);
|
|
3015
3227
|
},
|
|
3016
3228
|
[onProfileSubmit]
|
|
3017
3229
|
);
|
|
3018
|
-
const handleConnectContinue =
|
|
3230
|
+
const handleConnectContinue = useCallback6(() => {
|
|
3019
3231
|
onComplete == null ? void 0 : onComplete();
|
|
3020
3232
|
}, [onComplete]);
|
|
3021
|
-
const handleOpenOnchainModal =
|
|
3233
|
+
const handleOpenOnchainModal = useCallback6(() => {
|
|
3022
3234
|
setOnchainModalOpen(true);
|
|
3023
3235
|
}, []);
|
|
3024
|
-
const handleOnchainConnect =
|
|
3236
|
+
const handleOnchainConnect = useCallback6(() => __async(null, null, function* () {
|
|
3025
3237
|
yield onConnectOnchain == null ? void 0 : onConnectOnchain();
|
|
3026
3238
|
setOnchainConnected(true);
|
|
3027
3239
|
}), [onConnectOnchain]);
|
|
3028
|
-
const handleOpenKalshiModal =
|
|
3240
|
+
const handleOpenKalshiModal = useCallback6(() => {
|
|
3029
3241
|
setKalshiModalOpen(true);
|
|
3030
3242
|
}, []);
|
|
3031
|
-
const handleKalshiVerify =
|
|
3243
|
+
const handleKalshiVerify = useCallback6(
|
|
3032
3244
|
(credentials) => __async(null, null, function* () {
|
|
3033
3245
|
yield onConnectKalshi == null ? void 0 : onConnectKalshi(credentials);
|
|
3034
3246
|
setKalshiConnected(true);
|
|
3035
3247
|
}),
|
|
3036
3248
|
[onConnectKalshi]
|
|
3037
3249
|
);
|
|
3038
|
-
return /* @__PURE__ */
|
|
3039
|
-
/* @__PURE__ */
|
|
3250
|
+
return /* @__PURE__ */ jsxs22(Fragment9, { children: [
|
|
3251
|
+
/* @__PURE__ */ jsx22(Modal, { open, onOpenChange, children: /* @__PURE__ */ jsxs22(
|
|
3040
3252
|
Modal.Container,
|
|
3041
3253
|
{
|
|
3042
3254
|
maxWidth: "600px",
|
|
3043
3255
|
"aria-label": resolvedTitle,
|
|
3044
3256
|
classNames: { container: "!rounded-agg-lg" },
|
|
3045
3257
|
children: [
|
|
3046
|
-
/* @__PURE__ */
|
|
3047
|
-
/* @__PURE__ */
|
|
3048
|
-
step === ONBOARDING_STEPS.HOW_IT_WORKS && /* @__PURE__ */
|
|
3049
|
-
step === ONBOARDING_STEPS.PROFILE_SETUP && /* @__PURE__ */
|
|
3050
|
-
step === ONBOARDING_STEPS.CONNECT_ACCOUNTS && /* @__PURE__ */
|
|
3258
|
+
/* @__PURE__ */ jsx22(Dialog3.Title, { className: "sr-only", children: resolvedTitle }),
|
|
3259
|
+
/* @__PURE__ */ jsxs22(Modal.Body, { classNames: { root: "px-5 py-6 sm:px-10 sm:py-8" }, children: [
|
|
3260
|
+
step === ONBOARDING_STEPS.HOW_IT_WORKS && /* @__PURE__ */ jsx22(HowItWorksStep, { onContinue: handleHowItWorksContinue, icons: howItWorksIcons }),
|
|
3261
|
+
step === ONBOARDING_STEPS.PROFILE_SETUP && /* @__PURE__ */ jsx22(ProfileSetupStep, { onContinue: handleProfileContinue }),
|
|
3262
|
+
step === ONBOARDING_STEPS.CONNECT_ACCOUNTS && /* @__PURE__ */ jsx22(
|
|
3051
3263
|
ConnectAccountsStep,
|
|
3052
3264
|
{
|
|
3053
3265
|
onConnectOnchain: handleOpenOnchainModal,
|
|
@@ -3061,7 +3273,7 @@ var OnboardingModal = ({
|
|
|
3061
3273
|
]
|
|
3062
3274
|
}
|
|
3063
3275
|
) }),
|
|
3064
|
-
/* @__PURE__ */
|
|
3276
|
+
/* @__PURE__ */ jsx22(
|
|
3065
3277
|
ConnectOnchainModal,
|
|
3066
3278
|
{
|
|
3067
3279
|
open: onchainModalOpen,
|
|
@@ -3069,7 +3281,7 @@ var OnboardingModal = ({
|
|
|
3069
3281
|
onConnect: handleOnchainConnect
|
|
3070
3282
|
}
|
|
3071
3283
|
),
|
|
3072
|
-
/* @__PURE__ */
|
|
3284
|
+
/* @__PURE__ */ jsx22(
|
|
3073
3285
|
ConnectKalshiModal,
|
|
3074
3286
|
{
|
|
3075
3287
|
open: kalshiModalOpen,
|
|
@@ -3082,28 +3294,27 @@ var OnboardingModal = ({
|
|
|
3082
3294
|
OnboardingModal.displayName = "OnboardingModal";
|
|
3083
3295
|
|
|
3084
3296
|
// src/profile/index.tsx
|
|
3085
|
-
import {
|
|
3086
|
-
import { useState as useState11, useEffect as useEffect8, useCallback as useCallback8, useMemo as useMemo2 } from "react";
|
|
3297
|
+
import { useState as useState10, useEffect as useEffect7, useCallback as useCallback9, useMemo as useMemo2 } from "react";
|
|
3087
3298
|
import { useAggClient as useAggClient2, useAggAuthState as useAggAuthState2 } from "@agg-build/hooks";
|
|
3088
3299
|
|
|
3089
3300
|
// src/profile/profile-modal.constants.ts
|
|
3090
3301
|
var PROFILE_TAB_KEYS = {
|
|
3091
|
-
|
|
3092
|
-
|
|
3302
|
+
PROFILE_ACCOUNTS: "profile-accounts",
|
|
3303
|
+
TRADING_ACCESS: "trading-access"
|
|
3093
3304
|
};
|
|
3094
3305
|
var PROFILE_TAB_ITEMS = [
|
|
3095
|
-
{ value: PROFILE_TAB_KEYS.ABOUT, label: "About", icon: "profile-about-tab" },
|
|
3096
3306
|
{
|
|
3097
|
-
value: PROFILE_TAB_KEYS.
|
|
3098
|
-
label: "
|
|
3099
|
-
icon: "profile-
|
|
3100
|
-
}
|
|
3307
|
+
value: PROFILE_TAB_KEYS.PROFILE_ACCOUNTS,
|
|
3308
|
+
label: "Profile & accounts",
|
|
3309
|
+
icon: "profile-about-tab"
|
|
3310
|
+
},
|
|
3311
|
+
{ value: PROFILE_TAB_KEYS.TRADING_ACCESS, label: "Trading access", icon: "shield-trust" }
|
|
3101
3312
|
];
|
|
3102
3313
|
|
|
3103
3314
|
// src/profile/tabs/about-tab.tsx
|
|
3104
|
-
import { useCallback as
|
|
3105
|
-
import { useLabels as
|
|
3106
|
-
import { jsx as
|
|
3315
|
+
import { useCallback as useCallback7, useRef as useRef4 } from "react";
|
|
3316
|
+
import { useLabels as useLabels21 } from "@agg-build/hooks";
|
|
3317
|
+
import { jsx as jsx23, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3107
3318
|
var AboutTab = ({
|
|
3108
3319
|
avatarPreview,
|
|
3109
3320
|
onDeleteProfile: _onDeleteProfile,
|
|
@@ -3113,13 +3324,13 @@ var AboutTab = ({
|
|
|
3113
3324
|
draftAvatarPreview,
|
|
3114
3325
|
avatarError: _avatarError
|
|
3115
3326
|
}) => {
|
|
3116
|
-
const labels =
|
|
3327
|
+
const labels = useLabels21();
|
|
3117
3328
|
const fileInputRef = useRef4(null);
|
|
3118
|
-
const handleAvatarClick =
|
|
3329
|
+
const handleAvatarClick = useCallback7(() => {
|
|
3119
3330
|
var _a;
|
|
3120
3331
|
(_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
3121
3332
|
}, []);
|
|
3122
|
-
const handleFileChange =
|
|
3333
|
+
const handleFileChange = useCallback7(
|
|
3123
3334
|
(e) => {
|
|
3124
3335
|
var _a;
|
|
3125
3336
|
const file = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
@@ -3135,70 +3346,68 @@ var AboutTab = ({
|
|
|
3135
3346
|
);
|
|
3136
3347
|
const resolvedPreview = draftAvatarPreview != null ? draftAvatarPreview : avatarPreview;
|
|
3137
3348
|
const hasAvatarPreview = Boolean(resolvedPreview);
|
|
3138
|
-
return /* @__PURE__ */
|
|
3139
|
-
/* @__PURE__ */
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
/* @__PURE__ */ jsxs22("div", { className: "agg-form-section flex flex-col gap-2", children: [
|
|
3201
|
-
/* @__PURE__ */ jsx22(
|
|
3349
|
+
return /* @__PURE__ */ jsx23("div", { className: "agg-profile-about flex flex-col gap-8", children: /* @__PURE__ */ jsxs23("div", { className: "agg-profile-avatar-section flex w-full items-center gap-6", children: [
|
|
3350
|
+
/* @__PURE__ */ jsxs23(
|
|
3351
|
+
"button",
|
|
3352
|
+
{
|
|
3353
|
+
type: "button",
|
|
3354
|
+
onClick: handleAvatarClick,
|
|
3355
|
+
className: cn(
|
|
3356
|
+
"agg-profile-avatar-trigger",
|
|
3357
|
+
"group relative flex items-center justify-center self-start",
|
|
3358
|
+
"h-[80px] w-[80px]",
|
|
3359
|
+
"rounded-agg-full",
|
|
3360
|
+
"bg-agg-secondary-hover",
|
|
3361
|
+
!hasAvatarPreview && "hover:bg-agg-tertiary",
|
|
3362
|
+
"transition-colors cursor-pointer",
|
|
3363
|
+
"overflow-hidden"
|
|
3364
|
+
),
|
|
3365
|
+
"aria-label": labels.onboarding.profileSetup.uploadProfilePictureAria,
|
|
3366
|
+
children: [
|
|
3367
|
+
!hasAvatarPreview ? /* @__PURE__ */ jsx23(
|
|
3368
|
+
"svg",
|
|
3369
|
+
{
|
|
3370
|
+
"aria-hidden": true,
|
|
3371
|
+
viewBox: "0 0 80 80",
|
|
3372
|
+
className: "pointer-events-none absolute inset-0 h-full w-full text-agg-separator group-hover:text-agg-muted-foreground",
|
|
3373
|
+
children: /* @__PURE__ */ jsx23(
|
|
3374
|
+
"circle",
|
|
3375
|
+
{
|
|
3376
|
+
cx: "40",
|
|
3377
|
+
cy: "40",
|
|
3378
|
+
r: "39.5",
|
|
3379
|
+
fill: "none",
|
|
3380
|
+
stroke: "currentColor",
|
|
3381
|
+
strokeWidth: "1",
|
|
3382
|
+
strokeDasharray: "8 8"
|
|
3383
|
+
}
|
|
3384
|
+
)
|
|
3385
|
+
}
|
|
3386
|
+
) : null,
|
|
3387
|
+
resolvedPreview ? /* @__PURE__ */ jsx23(
|
|
3388
|
+
RemoteImage,
|
|
3389
|
+
{
|
|
3390
|
+
src: resolvedPreview,
|
|
3391
|
+
alt: labels.onboarding.profileSetup.profilePreviewAlt,
|
|
3392
|
+
className: "h-full w-full object-cover"
|
|
3393
|
+
}
|
|
3394
|
+
) : /* @__PURE__ */ jsx23(Icon, { name: "profile", className: "h-7 w-7 text-agg-muted-foreground" })
|
|
3395
|
+
]
|
|
3396
|
+
}
|
|
3397
|
+
),
|
|
3398
|
+
/* @__PURE__ */ jsx23(
|
|
3399
|
+
"input",
|
|
3400
|
+
{
|
|
3401
|
+
ref: fileInputRef,
|
|
3402
|
+
type: "file",
|
|
3403
|
+
accept: "image/*",
|
|
3404
|
+
onChange: handleFileChange,
|
|
3405
|
+
className: "hidden",
|
|
3406
|
+
"aria-hidden": "true"
|
|
3407
|
+
}
|
|
3408
|
+
),
|
|
3409
|
+
/* @__PURE__ */ jsxs23("div", { className: "agg-form-section flex min-w-0 flex-1 flex-col gap-2", children: [
|
|
3410
|
+
/* @__PURE__ */ jsx23(
|
|
3202
3411
|
"label",
|
|
3203
3412
|
{
|
|
3204
3413
|
htmlFor: "profile-username",
|
|
@@ -3206,7 +3415,7 @@ var AboutTab = ({
|
|
|
3206
3415
|
children: "Username"
|
|
3207
3416
|
}
|
|
3208
3417
|
),
|
|
3209
|
-
/* @__PURE__ */
|
|
3418
|
+
/* @__PURE__ */ jsx23(
|
|
3210
3419
|
"input",
|
|
3211
3420
|
{
|
|
3212
3421
|
id: "profile-username",
|
|
@@ -3215,7 +3424,7 @@ var AboutTab = ({
|
|
|
3215
3424
|
value: draftUsername,
|
|
3216
3425
|
onChange: (e) => onDraftUsernameChange(e.target.value),
|
|
3217
3426
|
className: cn(
|
|
3218
|
-
"w-full px-
|
|
3427
|
+
"h-10 w-full px-3 py-2.5",
|
|
3219
3428
|
"rounded-agg-sm",
|
|
3220
3429
|
"border border-agg-separator",
|
|
3221
3430
|
"bg-agg-secondary text-agg-foreground",
|
|
@@ -3228,28 +3437,34 @@ var AboutTab = ({
|
|
|
3228
3437
|
}
|
|
3229
3438
|
)
|
|
3230
3439
|
] })
|
|
3231
|
-
] });
|
|
3440
|
+
] }) });
|
|
3232
3441
|
};
|
|
3233
3442
|
AboutTab.displayName = "AboutTab";
|
|
3234
3443
|
|
|
3235
3444
|
// src/profile/tabs/accounts-wallets-tab.tsx
|
|
3236
|
-
import {
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
var SectionTitle = ({ children }) => /* @__PURE__ */ jsx23("h3", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children });
|
|
3240
|
-
var AccountRow = ({ children, className }) => /* @__PURE__ */ jsx23(
|
|
3445
|
+
import { jsx as jsx24, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3446
|
+
var SectionTitle = ({ children }) => /* @__PURE__ */ jsx24("h3", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children });
|
|
3447
|
+
var AccountRow = ({ children, className }) => /* @__PURE__ */ jsx24(
|
|
3241
3448
|
"div",
|
|
3242
3449
|
{
|
|
3243
3450
|
className: cn(
|
|
3244
|
-
"flex items-center justify-between",
|
|
3451
|
+
"flex h-12 items-center justify-between",
|
|
3245
3452
|
"rounded-agg-lg border border-agg-separator bg-agg-secondary",
|
|
3246
|
-
"px-5
|
|
3453
|
+
"px-5",
|
|
3247
3454
|
className
|
|
3248
3455
|
),
|
|
3249
3456
|
children
|
|
3250
3457
|
}
|
|
3251
3458
|
);
|
|
3252
|
-
var
|
|
3459
|
+
var AccountIdentity = ({
|
|
3460
|
+
icon,
|
|
3461
|
+
label,
|
|
3462
|
+
iconClassName
|
|
3463
|
+
}) => /* @__PURE__ */ jsxs24("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
3464
|
+
/* @__PURE__ */ jsx24("span", { className: cn("flex h-5 w-5 shrink-0 items-center justify-center", iconClassName), children: /* @__PURE__ */ jsx24(Icon, { name: icon, size: "small", color: "currentColor" }) }),
|
|
3465
|
+
/* @__PURE__ */ jsx24("span", { className: "truncate text-agg-base font-agg-normal leading-6 text-agg-foreground", children: label })
|
|
3466
|
+
] });
|
|
3467
|
+
var ConnectTextButton = ({ onClick }) => /* @__PURE__ */ jsx24(
|
|
3253
3468
|
"button",
|
|
3254
3469
|
{
|
|
3255
3470
|
type: "button",
|
|
@@ -3258,7 +3473,7 @@ var ConnectTextButton = ({ onClick }) => /* @__PURE__ */ jsx23(
|
|
|
3258
3473
|
children: "Connect"
|
|
3259
3474
|
}
|
|
3260
3475
|
);
|
|
3261
|
-
var DisconnectTextButton = ({ onClick }) => /* @__PURE__ */
|
|
3476
|
+
var DisconnectTextButton = ({ onClick }) => /* @__PURE__ */ jsx24(
|
|
3262
3477
|
"button",
|
|
3263
3478
|
{
|
|
3264
3479
|
type: "button",
|
|
@@ -3267,16 +3482,153 @@ var DisconnectTextButton = ({ onClick }) => /* @__PURE__ */ jsx23(
|
|
|
3267
3482
|
children: "Disconnect"
|
|
3268
3483
|
}
|
|
3269
3484
|
);
|
|
3270
|
-
var
|
|
3485
|
+
var VerifiedBadge = () => /* @__PURE__ */ jsx24(Icon, { name: "check-badge", size: "small", color: "var(--agg-color-primary, #536dfe)" });
|
|
3486
|
+
var ConnectedAccountRow = ({
|
|
3487
|
+
icon,
|
|
3488
|
+
label,
|
|
3489
|
+
connectedLabel,
|
|
3490
|
+
connected,
|
|
3491
|
+
iconClassName,
|
|
3492
|
+
onConnect,
|
|
3493
|
+
onDisconnect
|
|
3494
|
+
}) => {
|
|
3495
|
+
const displayLabel = connected ? connectedLabel != null ? connectedLabel : label : label;
|
|
3496
|
+
return /* @__PURE__ */ jsxs24(AccountRow, { className: "agg-social-account-row gap-4", children: [
|
|
3497
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
3498
|
+
/* @__PURE__ */ jsx24(AccountIdentity, { icon, label: displayLabel, iconClassName }),
|
|
3499
|
+
connected ? /* @__PURE__ */ jsx24(VerifiedBadge, {}) : null
|
|
3500
|
+
] }),
|
|
3501
|
+
connected ? /* @__PURE__ */ jsx24(DisconnectTextButton, { onClick: onDisconnect }) : /* @__PURE__ */ jsx24(ConnectTextButton, { onClick: onConnect })
|
|
3502
|
+
] });
|
|
3503
|
+
};
|
|
3504
|
+
var AccountsWalletsTab = ({
|
|
3505
|
+
socialAccounts,
|
|
3506
|
+
email,
|
|
3507
|
+
wallets = [],
|
|
3508
|
+
onConnectTwitter,
|
|
3509
|
+
onDisconnectTwitter,
|
|
3510
|
+
onConnectGoogle,
|
|
3511
|
+
onDisconnectGoogle,
|
|
3512
|
+
onConnectApple,
|
|
3513
|
+
onDisconnectApple,
|
|
3514
|
+
onDisconnectWallet,
|
|
3515
|
+
onConnectEmail
|
|
3516
|
+
}) => {
|
|
3517
|
+
const twitter = socialAccounts == null ? void 0 : socialAccounts.twitter;
|
|
3518
|
+
const google = socialAccounts == null ? void 0 : socialAccounts.google;
|
|
3519
|
+
const apple = socialAccounts == null ? void 0 : socialAccounts.apple;
|
|
3520
|
+
const hasEmail = Boolean(email);
|
|
3521
|
+
return /* @__PURE__ */ jsxs24("div", { className: "agg-accounts-wallets-tab flex flex-col gap-6", children: [
|
|
3522
|
+
/* @__PURE__ */ jsxs24("div", { className: "agg-social-accounts-section flex flex-col gap-3", children: [
|
|
3523
|
+
/* @__PURE__ */ jsx24(SectionTitle, { children: "Connected accounts" }),
|
|
3524
|
+
/* @__PURE__ */ jsxs24("div", { className: "agg-social-accounts-list flex flex-col gap-4", children: [
|
|
3525
|
+
/* @__PURE__ */ jsx24(
|
|
3526
|
+
ConnectedAccountRow,
|
|
3527
|
+
{
|
|
3528
|
+
icon: "google",
|
|
3529
|
+
iconClassName: "text-agg-foreground",
|
|
3530
|
+
label: "Google",
|
|
3531
|
+
connected: google == null ? void 0 : google.connected,
|
|
3532
|
+
connectedLabel: google == null ? void 0 : google.handle,
|
|
3533
|
+
onConnect: onConnectGoogle,
|
|
3534
|
+
onDisconnect: onDisconnectGoogle
|
|
3535
|
+
}
|
|
3536
|
+
),
|
|
3537
|
+
/* @__PURE__ */ jsx24(
|
|
3538
|
+
ConnectedAccountRow,
|
|
3539
|
+
{
|
|
3540
|
+
icon: "apple",
|
|
3541
|
+
iconClassName: "text-agg-foreground",
|
|
3542
|
+
label: "Apple",
|
|
3543
|
+
connected: apple == null ? void 0 : apple.connected,
|
|
3544
|
+
connectedLabel: apple == null ? void 0 : apple.handle,
|
|
3545
|
+
onConnect: onConnectApple,
|
|
3546
|
+
onDisconnect: onDisconnectApple
|
|
3547
|
+
}
|
|
3548
|
+
),
|
|
3549
|
+
/* @__PURE__ */ jsx24(
|
|
3550
|
+
ConnectedAccountRow,
|
|
3551
|
+
{
|
|
3552
|
+
icon: "twitter",
|
|
3553
|
+
iconClassName: "text-agg-foreground",
|
|
3554
|
+
label: "X (Twitter)",
|
|
3555
|
+
connected: twitter == null ? void 0 : twitter.connected,
|
|
3556
|
+
connectedLabel: twitter == null ? void 0 : twitter.handle,
|
|
3557
|
+
onConnect: onConnectTwitter,
|
|
3558
|
+
onDisconnect: onDisconnectTwitter
|
|
3559
|
+
}
|
|
3560
|
+
),
|
|
3561
|
+
/* @__PURE__ */ jsx24(
|
|
3562
|
+
ConnectedAccountRow,
|
|
3563
|
+
{
|
|
3564
|
+
icon: "email",
|
|
3565
|
+
iconClassName: "text-agg-foreground",
|
|
3566
|
+
label: "Email address",
|
|
3567
|
+
connected: hasEmail,
|
|
3568
|
+
connectedLabel: email != null ? email : void 0,
|
|
3569
|
+
onConnect: onConnectEmail
|
|
3570
|
+
}
|
|
3571
|
+
)
|
|
3572
|
+
] })
|
|
3573
|
+
] }),
|
|
3574
|
+
/* @__PURE__ */ jsxs24("div", { className: "agg-wallets-section flex flex-col gap-3", children: [
|
|
3575
|
+
/* @__PURE__ */ jsx24(SectionTitle, { children: "Wallets" }),
|
|
3576
|
+
/* @__PURE__ */ jsx24("div", { className: "flex flex-col gap-2", children: wallets.length > 0 ? wallets.map((wallet) => {
|
|
3577
|
+
var _a;
|
|
3578
|
+
return /* @__PURE__ */ jsx24(AccountRow, { className: "gap-4", children: /* @__PURE__ */ jsxs24("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
3579
|
+
/* @__PURE__ */ jsx24(
|
|
3580
|
+
AccountIdentity,
|
|
3581
|
+
{
|
|
3582
|
+
icon: "wallet",
|
|
3583
|
+
iconClassName: "text-agg-foreground",
|
|
3584
|
+
label: (_a = wallet.displayAddress) != null ? _a : wallet.address
|
|
3585
|
+
}
|
|
3586
|
+
),
|
|
3587
|
+
/* @__PURE__ */ jsx24(VerifiedBadge, {})
|
|
3588
|
+
] }) }, `${wallet.chain}:${wallet.address}`);
|
|
3589
|
+
}) : null })
|
|
3590
|
+
] })
|
|
3591
|
+
] });
|
|
3592
|
+
};
|
|
3593
|
+
AccountsWalletsTab.displayName = "AccountsWalletsTab";
|
|
3594
|
+
|
|
3595
|
+
// src/profile/tabs/trading-access-tab.tsx
|
|
3596
|
+
import { useAggClient, useDepositAddresses as useDepositAddresses2, useLabels as useLabels22 } from "@agg-build/hooks";
|
|
3597
|
+
import { useCallback as useCallback8, useEffect as useEffect6, useState as useState9 } from "react";
|
|
3598
|
+
import { jsx as jsx25, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3599
|
+
var TRADING_ACCESS_VENUES = [
|
|
3600
|
+
"kalshi",
|
|
3601
|
+
"polymarket",
|
|
3602
|
+
"opinion",
|
|
3603
|
+
"probable",
|
|
3604
|
+
"limitless",
|
|
3605
|
+
"predict",
|
|
3606
|
+
"myriad",
|
|
3607
|
+
"hyperliquid"
|
|
3608
|
+
];
|
|
3609
|
+
var UNAVAILABLE_VENUES = /* @__PURE__ */ new Set([]);
|
|
3610
|
+
var SectionTitle2 = ({ children }) => /* @__PURE__ */ jsx25("h3", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children });
|
|
3611
|
+
var AccessRow = ({ children }) => /* @__PURE__ */ jsx25(
|
|
3612
|
+
"div",
|
|
3613
|
+
{
|
|
3614
|
+
className: cn(
|
|
3615
|
+
"flex h-12 items-center justify-between gap-4",
|
|
3616
|
+
"rounded-agg-lg border border-agg-separator bg-agg-secondary",
|
|
3617
|
+
"px-5"
|
|
3618
|
+
),
|
|
3619
|
+
children
|
|
3620
|
+
}
|
|
3621
|
+
);
|
|
3271
3622
|
var VerifyIdentityButton = ({ onError }) => {
|
|
3623
|
+
const labels = useLabels22();
|
|
3272
3624
|
const client = useAggClient();
|
|
3273
|
-
const [isInitiating, setIsInitiating] =
|
|
3274
|
-
const [needsDepositAddress, setNeedsDepositAddress] =
|
|
3625
|
+
const [isInitiating, setIsInitiating] = useState9(false);
|
|
3626
|
+
const [needsDepositAddress, setNeedsDepositAddress] = useState9(false);
|
|
3275
3627
|
const { isReady, isTimedOut } = useDepositAddresses2({
|
|
3276
3628
|
enabled: needsDepositAddress,
|
|
3277
3629
|
poll: true
|
|
3278
3630
|
});
|
|
3279
|
-
|
|
3631
|
+
useEffect6(() => {
|
|
3280
3632
|
if (!isInitiating || !isReady) return;
|
|
3281
3633
|
const redirectUri = window.location.href;
|
|
3282
3634
|
client.initiateKyc("kalshi", redirectUri).then((res) => {
|
|
@@ -3290,149 +3642,65 @@ var VerifyIdentityButton = ({ onError }) => {
|
|
|
3290
3642
|
setNeedsDepositAddress(false);
|
|
3291
3643
|
});
|
|
3292
3644
|
}, [isReady, isInitiating, client, onError]);
|
|
3293
|
-
|
|
3294
|
-
if (isTimedOut
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
}
|
|
3645
|
+
useEffect6(() => {
|
|
3646
|
+
if (!isTimedOut || !isInitiating) return;
|
|
3647
|
+
setIsInitiating(false);
|
|
3648
|
+
setNeedsDepositAddress(false);
|
|
3649
|
+
onError == null ? void 0 : onError(new Error("Deposit address provisioning timed out"));
|
|
3299
3650
|
}, [isTimedOut, isInitiating, onError]);
|
|
3300
|
-
const handleClick =
|
|
3651
|
+
const handleClick = useCallback8(() => {
|
|
3301
3652
|
setIsInitiating(true);
|
|
3302
3653
|
setNeedsDepositAddress(true);
|
|
3303
3654
|
}, []);
|
|
3304
|
-
return /* @__PURE__ */
|
|
3655
|
+
return /* @__PURE__ */ jsx25(
|
|
3305
3656
|
"button",
|
|
3306
3657
|
{
|
|
3307
3658
|
type: "button",
|
|
3308
3659
|
disabled: isInitiating,
|
|
3309
3660
|
onClick: handleClick,
|
|
3310
3661
|
className: "shrink-0 cursor-pointer text-agg-sm font-agg-bold leading-agg-5 text-agg-primary whitespace-nowrap disabled:cursor-not-allowed disabled:opacity-60",
|
|
3311
|
-
children: isInitiating ? /* @__PURE__ */
|
|
3662
|
+
children: isInitiating ? /* @__PURE__ */ jsx25("span", { className: "inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }) : labels.trading.kycVerify
|
|
3312
3663
|
}
|
|
3313
3664
|
);
|
|
3314
3665
|
};
|
|
3315
|
-
var
|
|
3666
|
+
var AvailableStatus = () => /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2", children: [
|
|
3667
|
+
/* @__PURE__ */ jsx25(Icon, { name: "check-badge", size: "small", color: "var(--agg-color-primary, #536dfe)" }),
|
|
3668
|
+
/* @__PURE__ */ jsx25("span", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground whitespace-nowrap", children: "Available" })
|
|
3669
|
+
] });
|
|
3670
|
+
var TradingAccessTab = ({
|
|
3316
3671
|
venueAccounts,
|
|
3317
3672
|
onKycError
|
|
3318
3673
|
}) => {
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
/* @__PURE__ */
|
|
3674
|
+
const labels = useLabels22();
|
|
3675
|
+
return /* @__PURE__ */ jsxs25("div", { className: "agg-trading-access-section flex flex-col gap-4", children: [
|
|
3676
|
+
/* @__PURE__ */ jsx25(SectionTitle2, { children: "Venues" }),
|
|
3677
|
+
/* @__PURE__ */ jsx25("div", { className: "flex flex-col gap-3", children: TRADING_ACCESS_VENUES.map((venue) => {
|
|
3322
3678
|
var _a;
|
|
3323
|
-
const venueAccount = venueAccounts == null ? void 0 : venueAccounts.find((
|
|
3679
|
+
const venueAccount = venueAccounts == null ? void 0 : venueAccounts.find((account) => account.venue === venue);
|
|
3324
3680
|
const isKalshi = venue === "kalshi";
|
|
3325
3681
|
const isVerified = (venueAccount == null ? void 0 : venueAccount.kycStatus) === "verified";
|
|
3682
|
+
const isUnavailable = UNAVAILABLE_VENUES.has(venue);
|
|
3326
3683
|
const displayName = (_a = venueLogoLabels[venue]) != null ? _a : venue;
|
|
3327
|
-
return /* @__PURE__ */
|
|
3328
|
-
/* @__PURE__ */
|
|
3329
|
-
/* @__PURE__ */
|
|
3330
|
-
/* @__PURE__ */
|
|
3684
|
+
return /* @__PURE__ */ jsxs25(AccessRow, { children: [
|
|
3685
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
3686
|
+
/* @__PURE__ */ jsx25(VenueLogo, { venue, size: "small" }),
|
|
3687
|
+
/* @__PURE__ */ jsx25("span", { className: "truncate text-agg-base font-agg-normal leading-6 text-agg-foreground", children: displayName })
|
|
3331
3688
|
] }),
|
|
3332
|
-
isKalshi && !isVerified ? /* @__PURE__ */
|
|
3333
|
-
/* @__PURE__ */
|
|
3334
|
-
/* @__PURE__ */
|
|
3335
|
-
] }) : isKalshi && isVerified ? /* @__PURE__ */
|
|
3336
|
-
/* @__PURE__ */
|
|
3337
|
-
/* @__PURE__ */
|
|
3338
|
-
|
|
3339
|
-
Icon,
|
|
3340
|
-
{
|
|
3341
|
-
name: "check-badge",
|
|
3342
|
-
size: "small",
|
|
3343
|
-
color: "var(--agg-color-primary, #536dfe)"
|
|
3344
|
-
}
|
|
3345
|
-
),
|
|
3346
|
-
/* @__PURE__ */ jsx23("span", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground whitespace-nowrap", children: "Available" })
|
|
3347
|
-
] })
|
|
3348
|
-
] }) : /* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-2", children: [
|
|
3349
|
-
/* @__PURE__ */ jsx23(Icon, { name: "check-badge", size: "small", color: "var(--agg-color-primary, #536dfe)" }),
|
|
3350
|
-
/* @__PURE__ */ jsx23("span", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground whitespace-nowrap", children: "Available" })
|
|
3351
|
-
] })
|
|
3689
|
+
isKalshi && !isVerified ? /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-4", children: [
|
|
3690
|
+
/* @__PURE__ */ jsx25("span", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-muted-foreground whitespace-nowrap", children: labels.trading.kycRequired }),
|
|
3691
|
+
/* @__PURE__ */ jsx25(VerifyIdentityButton, { onError: onKycError })
|
|
3692
|
+
] }) : isKalshi && isVerified ? /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-4", children: [
|
|
3693
|
+
/* @__PURE__ */ jsx25("span", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-muted-foreground whitespace-nowrap", children: labels.trading.verified }),
|
|
3694
|
+
/* @__PURE__ */ jsx25(AvailableStatus, {})
|
|
3695
|
+
] }) : isUnavailable ? /* @__PURE__ */ jsx25("span", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-muted-foreground whitespace-nowrap", children: labels.trading.venueUnavailableInRegion }) : /* @__PURE__ */ jsx25(AvailableStatus, {})
|
|
3352
3696
|
] }, venue);
|
|
3353
3697
|
}) })
|
|
3354
3698
|
] });
|
|
3355
3699
|
};
|
|
3356
|
-
|
|
3357
|
-
exchanges: _exchanges,
|
|
3358
|
-
socialAccounts,
|
|
3359
|
-
email,
|
|
3360
|
-
venueAccounts,
|
|
3361
|
-
onKycError,
|
|
3362
|
-
onDisconnectExchange: _onDisconnectExchange,
|
|
3363
|
-
onConnectTwitter,
|
|
3364
|
-
onDisconnectTwitter,
|
|
3365
|
-
onConnectGoogle,
|
|
3366
|
-
onDisconnectGoogle,
|
|
3367
|
-
onConnectApple,
|
|
3368
|
-
onDisconnectApple,
|
|
3369
|
-
onConnectDiscord: _onConnectDiscord,
|
|
3370
|
-
onDisconnectDiscord: _onDisconnectDiscord,
|
|
3371
|
-
onConnectTelegram: _onConnectTelegram,
|
|
3372
|
-
onDisconnectTelegram: _onDisconnectTelegram,
|
|
3373
|
-
onConnectEmail
|
|
3374
|
-
}) => {
|
|
3375
|
-
const twitter = socialAccounts == null ? void 0 : socialAccounts.twitter;
|
|
3376
|
-
const google = socialAccounts == null ? void 0 : socialAccounts.google;
|
|
3377
|
-
const apple = socialAccounts == null ? void 0 : socialAccounts.apple;
|
|
3378
|
-
return /* @__PURE__ */ jsxs23("div", { className: "agg-accounts-wallets-tab flex flex-col gap-8", children: [
|
|
3379
|
-
/* @__PURE__ */ jsx23(TradingAccessSection, { venueAccounts, onKycError }),
|
|
3380
|
-
/* @__PURE__ */ jsxs23("div", { className: "agg-social-accounts-section flex flex-col gap-3", children: [
|
|
3381
|
-
/* @__PURE__ */ jsx23(SectionTitle, { children: "Social Accounts" }),
|
|
3382
|
-
/* @__PURE__ */ jsxs23("div", { className: "agg-social-accounts-list flex flex-col gap-2", children: [
|
|
3383
|
-
/* @__PURE__ */ jsxs23(AccountRow, { className: "agg-social-account-row", children: [
|
|
3384
|
-
/* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-3", children: [
|
|
3385
|
-
/* @__PURE__ */ jsx23("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-agg-foreground", children: /* @__PURE__ */ jsx23(Icon, { name: "google", size: "small", color: "currentColor" }) }),
|
|
3386
|
-
/* @__PURE__ */ jsx23("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground whitespace-nowrap", children: "Google" })
|
|
3387
|
-
] }),
|
|
3388
|
-
(google == null ? void 0 : google.connected) ? /* @__PURE__ */ jsx23(DisconnectTextButton, { onClick: onDisconnectGoogle }) : /* @__PURE__ */ jsx23(ConnectTextButton, { onClick: onConnectGoogle })
|
|
3389
|
-
] }),
|
|
3390
|
-
/* @__PURE__ */ jsxs23(AccountRow, { className: "agg-social-account-row", children: [
|
|
3391
|
-
/* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-3", children: [
|
|
3392
|
-
/* @__PURE__ */ jsx23("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-agg-foreground", children: /* @__PURE__ */ jsx23(Icon, { name: "apple", size: "small", color: "currentColor" }) }),
|
|
3393
|
-
/* @__PURE__ */ jsx23("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground whitespace-nowrap", children: "Apple" })
|
|
3394
|
-
] }),
|
|
3395
|
-
(apple == null ? void 0 : apple.connected) ? /* @__PURE__ */ jsx23(DisconnectTextButton, { onClick: onDisconnectApple }) : /* @__PURE__ */ jsx23(ConnectTextButton, { onClick: onConnectApple })
|
|
3396
|
-
] }),
|
|
3397
|
-
/* @__PURE__ */ jsxs23(AccountRow, { className: "agg-social-account-row", children: [
|
|
3398
|
-
/* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-3", children: [
|
|
3399
|
-
/* @__PURE__ */ jsx23("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-agg-foreground", children: /* @__PURE__ */ jsx23(Icon, { name: "twitter", size: "small", color: "currentColor" }) }),
|
|
3400
|
-
/* @__PURE__ */ jsx23("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground whitespace-nowrap", children: "X (Twitter)" })
|
|
3401
|
-
] }),
|
|
3402
|
-
(twitter == null ? void 0 : twitter.connected) ? /* @__PURE__ */ jsx23(DisconnectTextButton, { onClick: onDisconnectTwitter }) : /* @__PURE__ */ jsx23(ConnectTextButton, { onClick: onConnectTwitter })
|
|
3403
|
-
] })
|
|
3404
|
-
] })
|
|
3405
|
-
] }),
|
|
3406
|
-
/* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-3", children: [
|
|
3407
|
-
/* @__PURE__ */ jsx23(SectionTitle, { children: "Email Address" }),
|
|
3408
|
-
/* @__PURE__ */ jsxs23(
|
|
3409
|
-
"button",
|
|
3410
|
-
{
|
|
3411
|
-
type: "button",
|
|
3412
|
-
onClick: onConnectEmail,
|
|
3413
|
-
className: cn(
|
|
3414
|
-
"flex items-center justify-between",
|
|
3415
|
-
"rounded-agg-lg border border-agg-separator bg-agg-secondary",
|
|
3416
|
-
"px-5 py-3",
|
|
3417
|
-
"cursor-pointer hover:bg-agg-secondary-hover"
|
|
3418
|
-
),
|
|
3419
|
-
children: [
|
|
3420
|
-
/* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-3", children: [
|
|
3421
|
-
/* @__PURE__ */ jsx23("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-agg-foreground", children: /* @__PURE__ */ jsx23(Icon, { name: "email", size: "small", color: "currentColor" }) }),
|
|
3422
|
-
/* @__PURE__ */ jsx23("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground whitespace-nowrap", children: email != null ? email : "Connect email" })
|
|
3423
|
-
] }),
|
|
3424
|
-
/* @__PURE__ */ jsx23(Icon, { name: "chevron-right", size: "small", color: "currentColor" })
|
|
3425
|
-
]
|
|
3426
|
-
}
|
|
3427
|
-
)
|
|
3428
|
-
] })
|
|
3429
|
-
] });
|
|
3430
|
-
};
|
|
3431
|
-
AccountsWalletsTab.displayName = "AccountsWalletsTab";
|
|
3700
|
+
TradingAccessTab.displayName = "TradingAccessTab";
|
|
3432
3701
|
|
|
3433
3702
|
// src/profile/index.tsx
|
|
3434
|
-
import { jsx as
|
|
3435
|
-
var EVM_WALLET_VENUES = [Venue4.polymarket, Venue4.predict, Venue4.opinion];
|
|
3703
|
+
import { jsx as jsx26, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3436
3704
|
var ProfileModal = ({
|
|
3437
3705
|
open,
|
|
3438
3706
|
onOpenChange,
|
|
@@ -3440,21 +3708,15 @@ var ProfileModal = ({
|
|
|
3440
3708
|
avatarPreview,
|
|
3441
3709
|
onSave,
|
|
3442
3710
|
onDeleteProfile,
|
|
3443
|
-
exchanges,
|
|
3444
3711
|
socialAccounts,
|
|
3445
3712
|
wallets,
|
|
3446
3713
|
email,
|
|
3447
|
-
onDisconnectExchange: onDisconnectExchangeProp,
|
|
3448
3714
|
onConnectTwitter,
|
|
3449
3715
|
onDisconnectTwitter,
|
|
3450
3716
|
onConnectGoogle,
|
|
3451
3717
|
onDisconnectGoogle,
|
|
3452
3718
|
onConnectApple,
|
|
3453
3719
|
onDisconnectApple,
|
|
3454
|
-
onConnectDiscord,
|
|
3455
|
-
onDisconnectDiscord,
|
|
3456
|
-
onConnectTelegram,
|
|
3457
|
-
onDisconnectTelegram,
|
|
3458
3720
|
onDisconnectWallet,
|
|
3459
3721
|
onConnectEmail,
|
|
3460
3722
|
onKycError
|
|
@@ -3462,22 +3724,23 @@ var ProfileModal = ({
|
|
|
3462
3724
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
3463
3725
|
const client = useAggClient2();
|
|
3464
3726
|
const { user, startAuth } = useAggAuthState2();
|
|
3465
|
-
const
|
|
3727
|
+
const toastCtx = useOptionalToast();
|
|
3728
|
+
const [activeTab, setActiveTab] = useState10(PROFILE_TAB_KEYS.PROFILE_ACCOUNTS);
|
|
3466
3729
|
const resolvedInitialUsername = (_a = username != null ? username : user == null ? void 0 : user.username) != null ? _a : "";
|
|
3467
|
-
const [draftUsername, setDraftUsername] =
|
|
3468
|
-
const [draftAvatarFile, setDraftAvatarFile] =
|
|
3469
|
-
const [draftAvatarPreview, setDraftAvatarPreview] =
|
|
3470
|
-
const [isSaving, setIsSaving] =
|
|
3471
|
-
const [avatarTypeError, setAvatarTypeError] =
|
|
3472
|
-
|
|
3730
|
+
const [draftUsername, setDraftUsername] = useState10(resolvedInitialUsername);
|
|
3731
|
+
const [draftAvatarFile, setDraftAvatarFile] = useState10();
|
|
3732
|
+
const [draftAvatarPreview, setDraftAvatarPreview] = useState10();
|
|
3733
|
+
const [isSaving, setIsSaving] = useState10(false);
|
|
3734
|
+
const [avatarTypeError, setAvatarTypeError] = useState10(null);
|
|
3735
|
+
useEffect7(() => {
|
|
3473
3736
|
var _a2;
|
|
3474
3737
|
setDraftUsername((_a2 = username != null ? username : user == null ? void 0 : user.username) != null ? _a2 : "");
|
|
3475
3738
|
}, [username, user == null ? void 0 : user.username]);
|
|
3476
|
-
const handleOpenChange =
|
|
3739
|
+
const handleOpenChange = useCallback9(
|
|
3477
3740
|
(isOpen) => {
|
|
3478
3741
|
var _a2;
|
|
3479
3742
|
if (!isOpen) {
|
|
3480
|
-
setActiveTab(PROFILE_TAB_KEYS.
|
|
3743
|
+
setActiveTab(PROFILE_TAB_KEYS.PROFILE_ACCOUNTS);
|
|
3481
3744
|
setIsSaving(false);
|
|
3482
3745
|
setDraftUsername((_a2 = username != null ? username : user == null ? void 0 : user.username) != null ? _a2 : "");
|
|
3483
3746
|
setDraftAvatarFile(void 0);
|
|
@@ -3497,7 +3760,7 @@ var ProfileModal = ({
|
|
|
3497
3760
|
setDraftAvatarPreview
|
|
3498
3761
|
]
|
|
3499
3762
|
);
|
|
3500
|
-
const handleDraftAvatarChange =
|
|
3763
|
+
const handleDraftAvatarChange = useCallback9(
|
|
3501
3764
|
(file, preview) => {
|
|
3502
3765
|
const ACCEPTED_AVATAR_TYPES = ["image/jpeg", "image/png", "image/gif", "image/webp"];
|
|
3503
3766
|
if (file && !ACCEPTED_AVATAR_TYPES.includes(file.type)) {
|
|
@@ -3512,8 +3775,8 @@ var ProfileModal = ({
|
|
|
3512
3775
|
);
|
|
3513
3776
|
const originalUsername = (_b = username != null ? username : user == null ? void 0 : user.username) != null ? _b : "";
|
|
3514
3777
|
const hasChanges = draftUsername !== originalUsername || draftAvatarFile !== void 0;
|
|
3515
|
-
const handleSave =
|
|
3516
|
-
var _a2, _b2;
|
|
3778
|
+
const handleSave = useCallback9(() => __async(null, null, function* () {
|
|
3779
|
+
var _a2, _b2, _c2;
|
|
3517
3780
|
setIsSaving(true);
|
|
3518
3781
|
try {
|
|
3519
3782
|
const normalizedUsername = draftUsername.trim();
|
|
@@ -3545,6 +3808,15 @@ var ProfileModal = ({
|
|
|
3545
3808
|
avatarPreview: resolvedAvatarPreview
|
|
3546
3809
|
});
|
|
3547
3810
|
onOpenChange(false);
|
|
3811
|
+
} catch (err) {
|
|
3812
|
+
const apiError = err;
|
|
3813
|
+
const fieldErrors = ((_c2 = apiError.errors) != null ? _c2 : []).map((e) => e == null ? void 0 : e.message).filter((m) => typeof m === "string" && m.length > 0);
|
|
3814
|
+
const toastMessage = fieldErrors.length > 0 ? fieldErrors.join("\n") : apiError.message || "Failed to save profile. Please try again.";
|
|
3815
|
+
if (toastCtx) {
|
|
3816
|
+
toastCtx.toast(toastMessage, { tone: "error", title: "Could not save profile" });
|
|
3817
|
+
} else if (typeof console !== "undefined") {
|
|
3818
|
+
console.error("[ProfileModal] save failed:", toastMessage);
|
|
3819
|
+
}
|
|
3548
3820
|
} finally {
|
|
3549
3821
|
setIsSaving(false);
|
|
3550
3822
|
}
|
|
@@ -3555,9 +3827,10 @@ var ProfileModal = ({
|
|
|
3555
3827
|
draftUsername,
|
|
3556
3828
|
onOpenChange,
|
|
3557
3829
|
onSave,
|
|
3558
|
-
originalUsername
|
|
3830
|
+
originalUsername,
|
|
3831
|
+
toastCtx
|
|
3559
3832
|
]);
|
|
3560
|
-
const handleCancel =
|
|
3833
|
+
const handleCancel = useCallback9(() => {
|
|
3561
3834
|
handleOpenChange(false);
|
|
3562
3835
|
}, [handleOpenChange]);
|
|
3563
3836
|
const isAccountConnected = (providers) => {
|
|
@@ -3601,7 +3874,7 @@ var ProfileModal = ({
|
|
|
3601
3874
|
if (typeof window === "undefined") return;
|
|
3602
3875
|
((_a2 = window.top) != null ? _a2 : window).location.assign(url);
|
|
3603
3876
|
};
|
|
3604
|
-
const handleConnectTwitter =
|
|
3877
|
+
const handleConnectTwitter = useCallback9(() => __async(null, null, function* () {
|
|
3605
3878
|
const result = yield startAuth({
|
|
3606
3879
|
provider: "twitter",
|
|
3607
3880
|
redirectUrl: resolveRedirectUrl()
|
|
@@ -3611,7 +3884,7 @@ var ProfileModal = ({
|
|
|
3611
3884
|
navigateTopWindow(result.url);
|
|
3612
3885
|
}
|
|
3613
3886
|
}), [onConnectTwitter, startAuth]);
|
|
3614
|
-
const handleConnectGoogle =
|
|
3887
|
+
const handleConnectGoogle = useCallback9(() => __async(null, null, function* () {
|
|
3615
3888
|
const result = yield startAuth({
|
|
3616
3889
|
provider: "google",
|
|
3617
3890
|
redirectUrl: resolveRedirectUrl()
|
|
@@ -3621,7 +3894,7 @@ var ProfileModal = ({
|
|
|
3621
3894
|
navigateTopWindow(result.url);
|
|
3622
3895
|
}
|
|
3623
3896
|
}), [onConnectGoogle, startAuth]);
|
|
3624
|
-
const handleConnectApple =
|
|
3897
|
+
const handleConnectApple = useCallback9(() => __async(null, null, function* () {
|
|
3625
3898
|
const result = yield startAuth({
|
|
3626
3899
|
provider: "apple",
|
|
3627
3900
|
redirectUrl: resolveRedirectUrl()
|
|
@@ -3631,22 +3904,22 @@ var ProfileModal = ({
|
|
|
3631
3904
|
navigateTopWindow(result.url);
|
|
3632
3905
|
}
|
|
3633
3906
|
}), [onConnectApple, startAuth]);
|
|
3634
|
-
const handleDisconnectTwitter =
|
|
3907
|
+
const handleDisconnectTwitter = useCallback9(() => __async(null, null, function* () {
|
|
3635
3908
|
yield client.disconnectAccount("twitter");
|
|
3636
3909
|
yield client.getCurrentUser();
|
|
3637
3910
|
onDisconnectTwitter == null ? void 0 : onDisconnectTwitter();
|
|
3638
3911
|
}), [client, onDisconnectTwitter]);
|
|
3639
|
-
const handleDisconnectGoogle =
|
|
3912
|
+
const handleDisconnectGoogle = useCallback9(() => __async(null, null, function* () {
|
|
3640
3913
|
yield client.disconnectAccount("google");
|
|
3641
3914
|
yield client.getCurrentUser();
|
|
3642
3915
|
onDisconnectGoogle == null ? void 0 : onDisconnectGoogle();
|
|
3643
3916
|
}), [client, onDisconnectGoogle]);
|
|
3644
|
-
const handleDisconnectApple =
|
|
3917
|
+
const handleDisconnectApple = useCallback9(() => __async(null, null, function* () {
|
|
3645
3918
|
yield client.disconnectAccount("apple");
|
|
3646
3919
|
yield client.getCurrentUser();
|
|
3647
3920
|
onDisconnectApple == null ? void 0 : onDisconnectApple();
|
|
3648
3921
|
}), [client, onDisconnectApple]);
|
|
3649
|
-
const handleConnectEmail =
|
|
3922
|
+
const handleConnectEmail = useCallback9(() => __async(null, null, function* () {
|
|
3650
3923
|
var _a2;
|
|
3651
3924
|
const typedEmail = typeof window !== "undefined" ? (_a2 = window.prompt("Enter your email to receive a magic link")) == null ? void 0 : _a2.trim() : void 0;
|
|
3652
3925
|
if (!typedEmail) return;
|
|
@@ -3657,7 +3930,7 @@ var ProfileModal = ({
|
|
|
3657
3930
|
});
|
|
3658
3931
|
onConnectEmail == null ? void 0 : onConnectEmail();
|
|
3659
3932
|
}), [onConnectEmail, startAuth]);
|
|
3660
|
-
const handleDisconnectWallet =
|
|
3933
|
+
const handleDisconnectWallet = useCallback9(
|
|
3661
3934
|
(wallet) => __async(null, null, function* () {
|
|
3662
3935
|
const normalizedChain = wallet.chain.toLowerCase();
|
|
3663
3936
|
const provider = normalizedChain === "solana" || normalizedChain === "svm" ? "solana_wallet" : "wallet";
|
|
@@ -3721,30 +3994,7 @@ var ProfileModal = ({
|
|
|
3721
3994
|
};
|
|
3722
3995
|
})) != null ? _b2 : [];
|
|
3723
3996
|
}, [user == null ? void 0 : user.wallets, wallets]);
|
|
3724
|
-
|
|
3725
|
-
var _a2, _b2;
|
|
3726
|
-
if (exchanges !== void 0) return exchanges;
|
|
3727
|
-
const walletAccount = (_a2 = user == null ? void 0 : user.accounts) == null ? void 0 : _a2.find(
|
|
3728
|
-
(a) => a.provider.toLowerCase() === "wallet"
|
|
3729
|
-
);
|
|
3730
|
-
if (!walletAccount) return [];
|
|
3731
|
-
const addr = walletAccount.providerAccountId;
|
|
3732
|
-
const displayAddress = (_b2 = shortenAddress(addr)) != null ? _b2 : addr;
|
|
3733
|
-
return EVM_WALLET_VENUES.map((venue) => ({ venue, displayAddress, verified: false }));
|
|
3734
|
-
}, [exchanges, user == null ? void 0 : user.accounts]);
|
|
3735
|
-
const handleDisconnectExchange = useCallback8(
|
|
3736
|
-
(venue) => __async(null, null, function* () {
|
|
3737
|
-
if (exchanges !== void 0) {
|
|
3738
|
-
onDisconnectExchangeProp == null ? void 0 : onDisconnectExchangeProp(venue);
|
|
3739
|
-
return;
|
|
3740
|
-
}
|
|
3741
|
-
yield client.disconnectAccount("wallet");
|
|
3742
|
-
yield client.getCurrentUser();
|
|
3743
|
-
onDisconnectExchangeProp == null ? void 0 : onDisconnectExchangeProp(venue);
|
|
3744
|
-
}),
|
|
3745
|
-
[client, exchanges, onDisconnectExchangeProp]
|
|
3746
|
-
);
|
|
3747
|
-
return /* @__PURE__ */ jsx24(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs24(
|
|
3997
|
+
return /* @__PURE__ */ jsx26(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs26(
|
|
3748
3998
|
Modal.Container,
|
|
3749
3999
|
{
|
|
3750
4000
|
maxWidth: "800px",
|
|
@@ -3753,123 +4003,106 @@ var ProfileModal = ({
|
|
|
3753
4003
|
container: cn("agg-profile-modal", "min-h-[37.5rem]")
|
|
3754
4004
|
},
|
|
3755
4005
|
children: [
|
|
3756
|
-
/* @__PURE__ */
|
|
3757
|
-
/* @__PURE__ */
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
4006
|
+
/* @__PURE__ */ jsx26(Modal.Header, { title: "Edit Profile", classNames: { root: "agg-profile-modal-header" } }),
|
|
4007
|
+
/* @__PURE__ */ jsx26("div", { className: "agg-profile-tabs sm:hidden w-full", children: /* @__PURE__ */ jsx26(
|
|
4008
|
+
Tabs,
|
|
4009
|
+
{
|
|
4010
|
+
className: "w-full [&>div]:w-full",
|
|
4011
|
+
variant: "underline",
|
|
4012
|
+
classNames: { tabList: "w-full" },
|
|
4013
|
+
items: PROFILE_TAB_ITEMS.map((tab) => ({
|
|
4014
|
+
value: tab.value,
|
|
4015
|
+
label: tab.label,
|
|
4016
|
+
icon: /* @__PURE__ */ jsx26(Icon, { name: tab.icon, size: "small" })
|
|
4017
|
+
})),
|
|
4018
|
+
value: activeTab,
|
|
4019
|
+
onChange: (val) => setActiveTab(val)
|
|
4020
|
+
}
|
|
4021
|
+
) }),
|
|
4022
|
+
/* @__PURE__ */ jsx26(Modal.Body, { classNames: { root: cn("agg-profile-modal-body", "overflow-x-visible") }, children: /* @__PURE__ */ jsxs26("div", { className: "agg-profile-layout flex flex-col sm:flex-row sm:gap-10", children: [
|
|
4023
|
+
/* @__PURE__ */ jsx26("div", { className: "shrink-0", children: /* @__PURE__ */ jsx26(
|
|
4024
|
+
"nav",
|
|
4025
|
+
{
|
|
4026
|
+
className: cn(
|
|
4027
|
+
"agg-profile-sidebar",
|
|
4028
|
+
"hidden sm:sticky sm:top-0 sm:self-start sm:flex sm:flex-col",
|
|
4029
|
+
"w-[240px]",
|
|
4030
|
+
"overflow-hidden rounded-agg-lg",
|
|
4031
|
+
"border border-agg-separator",
|
|
4032
|
+
"bg-agg-secondary",
|
|
4033
|
+
"py-3"
|
|
4034
|
+
),
|
|
4035
|
+
role: "tablist",
|
|
4036
|
+
"aria-label": "Profile sections",
|
|
4037
|
+
children: PROFILE_TAB_ITEMS.map((tab) => {
|
|
4038
|
+
const isActive = activeTab === tab.value;
|
|
4039
|
+
return /* @__PURE__ */ jsxs26(
|
|
4040
|
+
"button",
|
|
4041
|
+
{
|
|
4042
|
+
type: "button",
|
|
4043
|
+
role: "tab",
|
|
4044
|
+
"aria-selected": isActive,
|
|
4045
|
+
onClick: () => setActiveTab(tab.value),
|
|
4046
|
+
className: cn(
|
|
4047
|
+
"agg-profile-tab-trigger",
|
|
4048
|
+
"relative flex items-center gap-3",
|
|
4049
|
+
"h-[49px] px-6 py-4",
|
|
4050
|
+
"text-agg-sm leading-agg-5 font-agg-sans",
|
|
4051
|
+
"transition-colors cursor-pointer",
|
|
4052
|
+
isActive ? "font-agg-normal text-agg-foreground bg-agg-secondary-hover" : "font-agg-normal text-agg-foreground"
|
|
4053
|
+
),
|
|
4054
|
+
children: [
|
|
4055
|
+
isActive ? /* @__PURE__ */ jsx26("div", { className: "absolute left-0 top-0 bottom-0 w-1 bg-agg-primary" }) : null,
|
|
4056
|
+
/* @__PURE__ */ jsx26(Icon, { name: tab.icon, size: "small", color: "currentColor" }),
|
|
4057
|
+
/* @__PURE__ */ jsx26("span", { className: "shrink-0 whitespace-nowrap", children: tab.label })
|
|
4058
|
+
]
|
|
4059
|
+
},
|
|
4060
|
+
tab.value
|
|
4061
|
+
);
|
|
4062
|
+
})
|
|
4063
|
+
}
|
|
4064
|
+
) }),
|
|
4065
|
+
/* @__PURE__ */ jsxs26("div", { className: "agg-profile-content min-w-0 flex-1", children: [
|
|
4066
|
+
activeTab === PROFILE_TAB_KEYS.PROFILE_ACCOUNTS ? /* @__PURE__ */ jsxs26("div", { className: "agg-profile-accounts-tab flex flex-col gap-8", children: [
|
|
4067
|
+
/* @__PURE__ */ jsx26(
|
|
4068
|
+
AboutTab,
|
|
3763
4069
|
{
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
"aria-label": "Profile sections",
|
|
3796
|
-
children: PROFILE_TAB_ITEMS.map((tab) => {
|
|
3797
|
-
const isActive = activeTab === tab.value;
|
|
3798
|
-
return /* @__PURE__ */ jsxs24(
|
|
3799
|
-
"button",
|
|
3800
|
-
{
|
|
3801
|
-
type: "button",
|
|
3802
|
-
role: "tab",
|
|
3803
|
-
"aria-selected": isActive,
|
|
3804
|
-
onClick: () => setActiveTab(tab.value),
|
|
3805
|
-
className: cn(
|
|
3806
|
-
"agg-profile-tab-trigger",
|
|
3807
|
-
"relative flex items-center gap-3",
|
|
3808
|
-
"h-[49px] px-6 py-4",
|
|
3809
|
-
"text-agg-sm leading-agg-5 font-agg-sans",
|
|
3810
|
-
"transition-colors cursor-pointer",
|
|
3811
|
-
isActive ? "font-agg-normal text-agg-foreground bg-agg-secondary-hover" : "font-agg-normal text-agg-foreground"
|
|
3812
|
-
),
|
|
3813
|
-
children: [
|
|
3814
|
-
isActive ? /* @__PURE__ */ jsx24("div", { className: "absolute left-0 top-0 bottom-0 w-1 bg-agg-primary" }) : null,
|
|
3815
|
-
/* @__PURE__ */ jsx24(Icon, { name: tab.icon, size: "small", color: "currentColor" }),
|
|
3816
|
-
/* @__PURE__ */ jsx24("span", { className: "shrink-0 whitespace-nowrap", children: tab.label })
|
|
3817
|
-
]
|
|
3818
|
-
},
|
|
3819
|
-
tab.value
|
|
3820
|
-
);
|
|
3821
|
-
})
|
|
3822
|
-
}
|
|
3823
|
-
)
|
|
3824
|
-
] }),
|
|
3825
|
-
/* @__PURE__ */ jsxs24("div", { className: "agg-profile-content min-w-0 flex-1", children: [
|
|
3826
|
-
activeTab === PROFILE_TAB_KEYS.ABOUT ? /* @__PURE__ */ jsx24(
|
|
3827
|
-
AboutTab,
|
|
3828
|
-
{
|
|
3829
|
-
username: username != null ? username : user == null ? void 0 : user.username,
|
|
3830
|
-
avatarPreview: (_i = user == null ? void 0 : user.avatarUrl) != null ? _i : avatarPreview,
|
|
3831
|
-
onDeleteProfile,
|
|
3832
|
-
draftUsername,
|
|
3833
|
-
onDraftUsernameChange: setDraftUsername,
|
|
3834
|
-
draftAvatarFile,
|
|
3835
|
-
onDraftAvatarChange: handleDraftAvatarChange,
|
|
3836
|
-
draftAvatarPreview,
|
|
3837
|
-
avatarError: avatarTypeError
|
|
3838
|
-
}
|
|
3839
|
-
) : null,
|
|
3840
|
-
activeTab === PROFILE_TAB_KEYS.ACCOUNTS_WALLETS ? /* @__PURE__ */ jsx24(
|
|
3841
|
-
AccountsWalletsTab,
|
|
3842
|
-
{
|
|
3843
|
-
exchanges: resolvedExchanges,
|
|
3844
|
-
venueAccounts: user == null ? void 0 : user.venueAccounts,
|
|
3845
|
-
onKycError,
|
|
3846
|
-
socialAccounts: resolvedSocialAccounts,
|
|
3847
|
-
wallets: resolvedWallets,
|
|
3848
|
-
email: resolvedEmail,
|
|
3849
|
-
onDisconnectExchange: (venue) => {
|
|
3850
|
-
void handleDisconnectExchange(venue);
|
|
3851
|
-
},
|
|
3852
|
-
onConnectTwitter: providerActionMap.twitter.connect,
|
|
3853
|
-
onDisconnectTwitter: providerActionMap.twitter.disconnect,
|
|
3854
|
-
onConnectGoogle: providerActionMap.google.connect,
|
|
3855
|
-
onDisconnectGoogle: providerActionMap.google.disconnect,
|
|
3856
|
-
onConnectApple: providerActionMap.apple.connect,
|
|
3857
|
-
onDisconnectApple: providerActionMap.apple.disconnect,
|
|
3858
|
-
onConnectDiscord,
|
|
3859
|
-
onDisconnectDiscord,
|
|
3860
|
-
onConnectTelegram,
|
|
3861
|
-
onDisconnectTelegram,
|
|
3862
|
-
onDisconnectWallet: (wallet) => {
|
|
3863
|
-
void handleDisconnectWallet(wallet);
|
|
3864
|
-
},
|
|
3865
|
-
onConnectEmail: providerActionMap.email.connect
|
|
3866
|
-
}
|
|
3867
|
-
) : null
|
|
4070
|
+
username: username != null ? username : user == null ? void 0 : user.username,
|
|
4071
|
+
avatarPreview: (_i = user == null ? void 0 : user.avatarUrl) != null ? _i : avatarPreview,
|
|
4072
|
+
onDeleteProfile,
|
|
4073
|
+
draftUsername,
|
|
4074
|
+
onDraftUsernameChange: setDraftUsername,
|
|
4075
|
+
draftAvatarFile,
|
|
4076
|
+
onDraftAvatarChange: handleDraftAvatarChange,
|
|
4077
|
+
draftAvatarPreview,
|
|
4078
|
+
avatarError: avatarTypeError
|
|
4079
|
+
}
|
|
4080
|
+
),
|
|
4081
|
+
/* @__PURE__ */ jsx26(
|
|
4082
|
+
AccountsWalletsTab,
|
|
4083
|
+
{
|
|
4084
|
+
socialAccounts: resolvedSocialAccounts,
|
|
4085
|
+
wallets: resolvedWallets,
|
|
4086
|
+
email: resolvedEmail,
|
|
4087
|
+
onConnectTwitter: providerActionMap.twitter.connect,
|
|
4088
|
+
onDisconnectTwitter: providerActionMap.twitter.disconnect,
|
|
4089
|
+
onConnectGoogle: providerActionMap.google.connect,
|
|
4090
|
+
onDisconnectGoogle: providerActionMap.google.disconnect,
|
|
4091
|
+
onConnectApple: providerActionMap.apple.connect,
|
|
4092
|
+
onDisconnectApple: providerActionMap.apple.disconnect,
|
|
4093
|
+
onDisconnectWallet: (wallet) => {
|
|
4094
|
+
void handleDisconnectWallet(wallet);
|
|
4095
|
+
},
|
|
4096
|
+
onConnectEmail: providerActionMap.email.connect
|
|
4097
|
+
}
|
|
4098
|
+
)
|
|
4099
|
+
] }) : null,
|
|
4100
|
+
activeTab === PROFILE_TAB_KEYS.TRADING_ACCESS ? /* @__PURE__ */ jsx26(TradingAccessTab, { venueAccounts: user == null ? void 0 : user.venueAccounts, onKycError }) : null
|
|
3868
4101
|
] })
|
|
3869
4102
|
] }) }),
|
|
3870
|
-
/* @__PURE__ */
|
|
3871
|
-
/* @__PURE__ */
|
|
3872
|
-
/* @__PURE__ */
|
|
4103
|
+
/* @__PURE__ */ jsxs26(Modal.Footer, { classNames: { root: "agg-profile-modal-footer" }, children: [
|
|
4104
|
+
/* @__PURE__ */ jsx26(Button, { variant: "secondary", size: "large", onClick: handleCancel, className: "min-w-[120px]", children: "Cancel" }),
|
|
4105
|
+
/* @__PURE__ */ jsx26(
|
|
3873
4106
|
Button,
|
|
3874
4107
|
{
|
|
3875
4108
|
variant: "primary",
|
|
@@ -3877,7 +4110,7 @@ var ProfileModal = ({
|
|
|
3877
4110
|
disabled: !hasChanges,
|
|
3878
4111
|
isLoading: isSaving,
|
|
3879
4112
|
onClick: handleSave,
|
|
3880
|
-
children: "Save
|
|
4113
|
+
children: "Save changes"
|
|
3881
4114
|
}
|
|
3882
4115
|
)
|
|
3883
4116
|
] })
|
|
@@ -3888,53 +4121,57 @@ var ProfileModal = ({
|
|
|
3888
4121
|
ProfileModal.displayName = "ProfileModal";
|
|
3889
4122
|
|
|
3890
4123
|
// src/geo-block-modal/index.tsx
|
|
3891
|
-
import { useLabels as
|
|
3892
|
-
import { useCallback as
|
|
3893
|
-
import { jsx as
|
|
4124
|
+
import { useLabels as useLabels23 } from "@agg-build/hooks";
|
|
4125
|
+
import { useCallback as useCallback10 } from "react";
|
|
4126
|
+
import { jsx as jsx27, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3894
4127
|
var GeoBlockModal = ({
|
|
3895
4128
|
open,
|
|
3896
4129
|
onOpenChange,
|
|
3897
4130
|
onConfirm,
|
|
3898
4131
|
classNames
|
|
3899
4132
|
}) => {
|
|
3900
|
-
const labels =
|
|
3901
|
-
const handleConfirm =
|
|
4133
|
+
const labels = useLabels23();
|
|
4134
|
+
const handleConfirm = useCallback10(() => {
|
|
3902
4135
|
onConfirm == null ? void 0 : onConfirm();
|
|
3903
4136
|
onOpenChange(false);
|
|
3904
4137
|
}, [onConfirm, onOpenChange]);
|
|
3905
|
-
return /* @__PURE__ */
|
|
4138
|
+
return /* @__PURE__ */ jsx27(
|
|
3906
4139
|
Modal,
|
|
3907
4140
|
{
|
|
3908
4141
|
open,
|
|
3909
4142
|
onOpenChange,
|
|
3910
4143
|
"aria-label": labels.trading.geoBlockModalAriaLabel,
|
|
3911
|
-
children: /* @__PURE__ */
|
|
4144
|
+
children: /* @__PURE__ */ jsxs27(
|
|
3912
4145
|
Modal.Container,
|
|
3913
4146
|
{
|
|
3914
4147
|
maxWidth: "480px",
|
|
3915
4148
|
classNames: { container: cn("!rounded-agg-2xl", classNames == null ? void 0 : classNames.container) },
|
|
3916
4149
|
children: [
|
|
3917
|
-
/* @__PURE__ */
|
|
4150
|
+
/* @__PURE__ */ jsx27(
|
|
3918
4151
|
Modal.Header,
|
|
3919
4152
|
{
|
|
3920
4153
|
title: "",
|
|
3921
4154
|
hideBorder: true,
|
|
3922
|
-
classNames: {
|
|
4155
|
+
classNames: {
|
|
4156
|
+
root: "min-h-0! h-12!",
|
|
4157
|
+
container: "p-0! sm:p-0!",
|
|
4158
|
+
close: "absolute top-8 right-8"
|
|
4159
|
+
}
|
|
3923
4160
|
}
|
|
3924
4161
|
),
|
|
3925
|
-
/* @__PURE__ */
|
|
3926
|
-
/* @__PURE__ */
|
|
4162
|
+
/* @__PURE__ */ jsx27(Modal.Body, { classNames: { root: cn("!px-10 !pt-0 !pb-12", classNames == null ? void 0 : classNames.body) }, children: /* @__PURE__ */ jsxs27("div", { className: "flex flex-col items-center gap-8", children: [
|
|
4163
|
+
/* @__PURE__ */ jsx27(
|
|
3927
4164
|
Icon,
|
|
3928
4165
|
{
|
|
3929
4166
|
name: "internet-security",
|
|
3930
4167
|
className: "h-[60px] w-[60px] text-agg-muted-foreground"
|
|
3931
4168
|
}
|
|
3932
4169
|
),
|
|
3933
|
-
/* @__PURE__ */
|
|
3934
|
-
/* @__PURE__ */
|
|
3935
|
-
/* @__PURE__ */
|
|
4170
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
4171
|
+
/* @__PURE__ */ jsx27("h2", { className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground", children: labels.trading.geoBlockModalTitle }),
|
|
4172
|
+
/* @__PURE__ */ jsx27("p", { className: "text-agg-base font-agg-normal leading-agg-6 text-agg-foreground", children: labels.trading.geoBlockModalDescription })
|
|
3936
4173
|
] }),
|
|
3937
|
-
/* @__PURE__ */
|
|
4174
|
+
/* @__PURE__ */ jsx27(
|
|
3938
4175
|
Button,
|
|
3939
4176
|
{
|
|
3940
4177
|
variant: "secondary",
|
|
@@ -3954,6 +4191,7 @@ var GeoBlockModal = ({
|
|
|
3954
4191
|
GeoBlockModal.displayName = "GeoBlockModal";
|
|
3955
4192
|
|
|
3956
4193
|
export {
|
|
4194
|
+
subscribeAggDepositNotification,
|
|
3957
4195
|
CARD_NETWORK_OPTIONS,
|
|
3958
4196
|
clearPendingCardSession,
|
|
3959
4197
|
getPendingCardSession,
|