@b3dotfun/sdk 0.0.33 → 0.0.34-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/react/components/AnySpend.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +5 -36
- package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.d.ts +12 -0
- package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.js +25 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +3 -3
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +65 -60
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -4
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +4 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
- package/dist/cjs/anyspend/react/hooks/useAnyspendQuote.js +1 -1
- package/dist/cjs/anyspend/types/api.d.ts +130 -14
- package/dist/cjs/anyspend/utils/chain.js +1 -1
- package/dist/cjs/anyspend/utils/format.js +1 -0
- package/dist/cjs/anyspend/utils/orderPayload.js +7 -0
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +1 -4
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +14 -0
- package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +23 -4
- package/dist/cjs/global-account/react/components/index.d.ts +8 -9
- package/dist/cjs/global-account/react/components/index.js +25 -28
- package/dist/cjs/global-account/react/index.native.d.ts +2 -1
- package/dist/cjs/global-account/react/index.native.js +5 -3
- package/dist/cjs/global-account/react/stores/index.d.ts +1 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -22
- package/dist/esm/anyspend/react/components/AnySpend.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +6 -37
- package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.d.ts +12 -0
- package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.js +22 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +3 -3
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +48 -43
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -4
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +4 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
- package/dist/esm/anyspend/react/hooks/useAnyspendQuote.js +1 -1
- package/dist/esm/anyspend/types/api.d.ts +130 -14
- package/dist/esm/anyspend/utils/chain.js +1 -1
- package/dist/esm/anyspend/utils/format.js +1 -0
- package/dist/esm/anyspend/utils/orderPayload.js +7 -0
- package/dist/esm/global-account/react/components/B3DynamicModal.js +1 -4
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +11 -0
- package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +23 -4
- package/dist/esm/global-account/react/components/index.d.ts +8 -9
- package/dist/esm/global-account/react/components/index.js +8 -10
- package/dist/esm/global-account/react/index.native.d.ts +2 -1
- package/dist/esm/global-account/react/index.native.js +2 -1
- package/dist/esm/global-account/react/stores/index.d.ts +1 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -22
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
- package/dist/types/anyspend/react/components/common/InsufficientDepositPayment.d.ts +12 -0
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +3 -3
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -4
- package/dist/types/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
- package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
- package/dist/types/anyspend/types/api.d.ts +130 -14
- package/dist/types/global-account/react/components/index.d.ts +8 -9
- package/dist/types/global-account/react/index.native.d.ts +2 -1
- package/dist/types/global-account/react/stores/index.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -22
- package/package.json +2 -4
- package/src/anyspend/react/components/AnySpend.tsx +2 -1
- package/src/anyspend/react/components/AnySpendCustom.tsx +1 -1
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +5 -43
- package/src/anyspend/react/components/common/InsufficientDepositPayment.tsx +144 -0
- package/src/anyspend/react/components/common/OrderDetails.tsx +95 -71
- package/src/anyspend/react/components/common/OrderStatus.tsx +2 -2
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +5 -3
- package/src/anyspend/react/hooks/useAnyspendQuote.ts +1 -1
- package/src/anyspend/types/api.ts +131 -11
- package/src/anyspend/utils/chain.ts +1 -1
- package/src/anyspend/utils/format.ts +1 -0
- package/src/anyspend/utils/orderPayload.ts +7 -0
- package/src/global-account/react/components/B3DynamicModal.tsx +0 -4
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +10 -0
- package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +6 -6
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +109 -83
- package/src/global-account/react/components/index.ts +13 -16
- package/src/global-account/react/index.native.ts +2 -1
- package/src/global-account/react/stores/index.ts +1 -2
- package/src/global-account/react/stores/useModalStore.ts +3 -23
- package/dist/cjs/global-account/react/components/Transak/TransakModal.d.ts +0 -1
- package/dist/cjs/global-account/react/components/Transak/TransakModal.js +0 -110
- package/dist/esm/global-account/react/components/Transak/TransakModal.d.ts +0 -1
- package/dist/esm/global-account/react/components/Transak/TransakModal.js +0 -104
- package/dist/types/global-account/react/components/Transak/TransakModal.d.ts +0 -1
- package/src/global-account/react/components/Transak/TransakModal.tsx +0 -131
|
@@ -417,18 +417,23 @@ export interface paths {
|
|
|
417
417
|
* }
|
|
418
418
|
* ]
|
|
419
419
|
*/
|
|
420
|
-
depositTxs: components["schemas"]["DepositTx"][]
|
|
421
|
-
/**
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
|
|
420
|
+
depositTxs: components["schemas"]["DepositTx"][];
|
|
421
|
+
/**
|
|
422
|
+
* @description Cross-chain relay transactions
|
|
423
|
+
* @example [
|
|
424
|
+
* {
|
|
425
|
+
* "orderId": "5392f7a7-d472-4d6b-9848-bd07117fb82d",
|
|
426
|
+
* "chain": 8453,
|
|
427
|
+
* "txHash": "0x9df917e14bb089f74763d1d2662761d75c97a5a068b8a9e411c3d384c9c40d19",
|
|
428
|
+
* "status": "success",
|
|
429
|
+
* "createdAt": 1752505817654
|
|
430
|
+
* }
|
|
431
|
+
* ]
|
|
432
|
+
*/
|
|
433
|
+
relayTxs: components["schemas"]["RelayTx"][];
|
|
429
434
|
executeTx: components["schemas"]["ExecuteTx"] | null;
|
|
430
435
|
/** @description Refund transactions if order failed */
|
|
431
|
-
refundTxs: components["schemas"]["RefundTx"][]
|
|
436
|
+
refundTxs: components["schemas"]["RefundTx"][];
|
|
432
437
|
};
|
|
433
438
|
/** @example 200 */
|
|
434
439
|
statusCode: number;
|
|
@@ -467,7 +472,7 @@ export interface paths {
|
|
|
467
472
|
"/orders/quote": {
|
|
468
473
|
/**
|
|
469
474
|
* Get anyspend quote
|
|
470
|
-
* @description Retrieves a quote to swap or
|
|
475
|
+
* @description Retrieves a quote to swap, execute contract, or participate in HypeDuel
|
|
471
476
|
*/
|
|
472
477
|
post: {
|
|
473
478
|
requestBody: {
|
|
@@ -591,6 +596,42 @@ export interface paths {
|
|
|
591
596
|
onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
|
|
592
597
|
contractAddress: string;
|
|
593
598
|
fundAmount: string;
|
|
599
|
+
} | {
|
|
600
|
+
/**
|
|
601
|
+
* @description Order type for HypeDuel
|
|
602
|
+
* @enum {string}
|
|
603
|
+
*/
|
|
604
|
+
type: "hype_duel";
|
|
605
|
+
/**
|
|
606
|
+
* @description Source chain ID
|
|
607
|
+
* @example 1
|
|
608
|
+
*/
|
|
609
|
+
srcChain: number;
|
|
610
|
+
/**
|
|
611
|
+
* @description Destination chain ID
|
|
612
|
+
* @example 8453
|
|
613
|
+
*/
|
|
614
|
+
dstChain: number;
|
|
615
|
+
/**
|
|
616
|
+
* @description Source token contract address
|
|
617
|
+
* @example 0x0000000000000000000000000000000000000000
|
|
618
|
+
*/
|
|
619
|
+
srcTokenAddress: string;
|
|
620
|
+
/**
|
|
621
|
+
* @description Destination token contract address
|
|
622
|
+
* @example 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
|
|
623
|
+
*/
|
|
624
|
+
dstTokenAddress: string;
|
|
625
|
+
/**
|
|
626
|
+
* @description Amount to quote
|
|
627
|
+
* @example 1000000000000000000
|
|
628
|
+
*/
|
|
629
|
+
amount: string;
|
|
630
|
+
/**
|
|
631
|
+
* @description Optional onramp vendor
|
|
632
|
+
* @enum {string}
|
|
633
|
+
*/
|
|
634
|
+
onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
|
|
594
635
|
};
|
|
595
636
|
};
|
|
596
637
|
};
|
|
@@ -1037,6 +1078,19 @@ export interface components {
|
|
|
1037
1078
|
*/
|
|
1038
1079
|
actualDstAmount: string | null;
|
|
1039
1080
|
};
|
|
1081
|
+
/** @description HypeDuel-specific payload */
|
|
1082
|
+
HypeDuelPayload: {
|
|
1083
|
+
/**
|
|
1084
|
+
* @description Expected amount of destination tokens
|
|
1085
|
+
* @example 990000
|
|
1086
|
+
*/
|
|
1087
|
+
expectedDstAmount: string;
|
|
1088
|
+
/**
|
|
1089
|
+
* @description Actual received amount (null for new orders)
|
|
1090
|
+
* @example 990000
|
|
1091
|
+
*/
|
|
1092
|
+
actualDstAmount: string | null;
|
|
1093
|
+
};
|
|
1040
1094
|
/** @description Custom execution payload */
|
|
1041
1095
|
CustomPayload: {
|
|
1042
1096
|
/**
|
|
@@ -1115,6 +1169,11 @@ export interface components {
|
|
|
1115
1169
|
srcToken: components["schemas"]["Token"];
|
|
1116
1170
|
dstToken: components["schemas"]["Token"];
|
|
1117
1171
|
};
|
|
1172
|
+
/** @description HypeDuel metadata for display purposes */
|
|
1173
|
+
HypeDuelMetadata: {
|
|
1174
|
+
srcToken: components["schemas"]["Token"];
|
|
1175
|
+
dstToken: components["schemas"]["Token"];
|
|
1176
|
+
};
|
|
1118
1177
|
/** @description Custom metadata for display purposes */
|
|
1119
1178
|
CustomMetadata: {
|
|
1120
1179
|
srcToken: components["schemas"]["Token"];
|
|
@@ -1185,7 +1244,7 @@ export interface components {
|
|
|
1185
1244
|
* @example executed
|
|
1186
1245
|
* @enum {string}
|
|
1187
1246
|
*/
|
|
1188
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
|
|
1247
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
1189
1248
|
/** @description Error details if order failed */
|
|
1190
1249
|
errorDetails: string | null;
|
|
1191
1250
|
/**
|
|
@@ -1224,6 +1283,15 @@ export interface components {
|
|
|
1224
1283
|
payload: components["schemas"]["SwapPayload"];
|
|
1225
1284
|
metadata: components["schemas"]["SwapMetadata"];
|
|
1226
1285
|
};
|
|
1286
|
+
HypeDuelOrder: components["schemas"]["BaseOrder"] & {
|
|
1287
|
+
/**
|
|
1288
|
+
* @description Order type
|
|
1289
|
+
* @enum {string}
|
|
1290
|
+
*/
|
|
1291
|
+
type: "hype_duel";
|
|
1292
|
+
payload: components["schemas"]["HypeDuelPayload"];
|
|
1293
|
+
metadata: components["schemas"]["HypeDuelMetadata"];
|
|
1294
|
+
};
|
|
1227
1295
|
CustomOrder: components["schemas"]["BaseOrder"] & {
|
|
1228
1296
|
/**
|
|
1229
1297
|
* @description Order type
|
|
@@ -1260,7 +1328,7 @@ export interface components {
|
|
|
1260
1328
|
payload: components["schemas"]["FundTournamentPayload"];
|
|
1261
1329
|
metadata: components["schemas"]["TournamentMetadata"];
|
|
1262
1330
|
};
|
|
1263
|
-
Order: components["schemas"]["SwapOrder"] | components["schemas"]["CustomOrder"] | components["schemas"]["MintNftOrder"] | components["schemas"]["JoinTournamentOrder"] | components["schemas"]["FundTournamentOrder"];
|
|
1331
|
+
Order: components["schemas"]["SwapOrder"] | components["schemas"]["HypeDuelOrder"] | components["schemas"]["CustomOrder"] | components["schemas"]["MintNftOrder"] | components["schemas"]["JoinTournamentOrder"] | components["schemas"]["FundTournamentOrder"];
|
|
1264
1332
|
/** @description Swap order request */
|
|
1265
1333
|
SwapOrderRequest: {
|
|
1266
1334
|
/**
|
|
@@ -1309,6 +1377,54 @@ export interface components {
|
|
|
1309
1377
|
*/
|
|
1310
1378
|
creatorAddress?: string;
|
|
1311
1379
|
};
|
|
1380
|
+
/** @description HypeDuel order request */
|
|
1381
|
+
HypeDuelOrderRequest: {
|
|
1382
|
+
/**
|
|
1383
|
+
* @description Order type
|
|
1384
|
+
* @enum {string}
|
|
1385
|
+
*/
|
|
1386
|
+
type: "hype_duel";
|
|
1387
|
+
/**
|
|
1388
|
+
* @description Address to receive the destination tokens
|
|
1389
|
+
* @example 0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1
|
|
1390
|
+
*/
|
|
1391
|
+
recipientAddress: string;
|
|
1392
|
+
/**
|
|
1393
|
+
* @description Source chain ID
|
|
1394
|
+
* @example 1
|
|
1395
|
+
*/
|
|
1396
|
+
srcChain: number;
|
|
1397
|
+
/**
|
|
1398
|
+
* @description Destination chain ID
|
|
1399
|
+
* @example 8453
|
|
1400
|
+
*/
|
|
1401
|
+
dstChain: number;
|
|
1402
|
+
/**
|
|
1403
|
+
* @description Source token contract address
|
|
1404
|
+
* @example 0xA0b86a33E6441E8A91DEF8f5663ACb4C9B4a1234
|
|
1405
|
+
*/
|
|
1406
|
+
srcTokenAddress: string;
|
|
1407
|
+
/**
|
|
1408
|
+
* @description Destination token contract address
|
|
1409
|
+
* @example 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
|
|
1410
|
+
*/
|
|
1411
|
+
dstTokenAddress: string;
|
|
1412
|
+
/**
|
|
1413
|
+
* @description Amount of source tokens for HypeDuel
|
|
1414
|
+
* @example 1000000
|
|
1415
|
+
*/
|
|
1416
|
+
srcAmount: string;
|
|
1417
|
+
payload: components["schemas"]["HypeDuelPayload"];
|
|
1418
|
+
metadata: components["schemas"]["HypeDuelMetadata"];
|
|
1419
|
+
/** @description Optional partner identifier */
|
|
1420
|
+
partnerId?: string;
|
|
1421
|
+
onramp?: components["schemas"]["Onramp"];
|
|
1422
|
+
/**
|
|
1423
|
+
* @description Optional address of the order creator
|
|
1424
|
+
* @example 0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1
|
|
1425
|
+
*/
|
|
1426
|
+
creatorAddress?: string;
|
|
1427
|
+
};
|
|
1312
1428
|
/** @description Custom order request */
|
|
1313
1429
|
CustomOrderRequest: {
|
|
1314
1430
|
/**
|
|
@@ -1501,7 +1617,7 @@ export interface components {
|
|
|
1501
1617
|
*/
|
|
1502
1618
|
creatorAddress?: string;
|
|
1503
1619
|
};
|
|
1504
|
-
OrderRequest: components["schemas"]["SwapOrderRequest"] | components["schemas"]["CustomOrderRequest"] | components["schemas"]["MintNftOrderRequest"] | components["schemas"]["JoinTournamentOrderRequest"] | components["schemas"]["FundTournamentOrderRequest"];
|
|
1620
|
+
OrderRequest: components["schemas"]["SwapOrderRequest"] | components["schemas"]["HypeDuelOrderRequest"] | components["schemas"]["CustomOrderRequest"] | components["schemas"]["MintNftOrderRequest"] | components["schemas"]["JoinTournamentOrderRequest"] | components["schemas"]["FundTournamentOrderRequest"];
|
|
1505
1621
|
/** @description Deposit transaction (payment from user) */
|
|
1506
1622
|
DepositTx: {
|
|
1507
1623
|
/**
|
|
@@ -34,7 +34,7 @@ export const EVM_MAINNET = {
|
|
|
34
34
|
name: "Arbitrum",
|
|
35
35
|
type: ChainType.EVM,
|
|
36
36
|
logoUrl: "https://assets.relay.link/icons/square/42161/light.png",
|
|
37
|
-
nativeRequired: parseEther("0.
|
|
37
|
+
nativeRequired: parseEther("0.0003"),
|
|
38
38
|
canDepositNative: true,
|
|
39
39
|
defaultToken: getEthToken(arbitrum.id),
|
|
40
40
|
nativeToken: getEthToken(arbitrum.id),
|
|
@@ -38,6 +38,11 @@ export const buildPayload = (orderType, params) => {
|
|
|
38
38
|
};
|
|
39
39
|
case "custom":
|
|
40
40
|
return { ...payload };
|
|
41
|
+
case "hype_duel":
|
|
42
|
+
return {
|
|
43
|
+
expectedDstAmount,
|
|
44
|
+
actualDstAmount: null,
|
|
45
|
+
};
|
|
41
46
|
default:
|
|
42
47
|
throw new Error(`Invalid order type: ${orderType}`);
|
|
43
48
|
}
|
|
@@ -58,6 +63,8 @@ export const buildMetadata = (orderType, params) => {
|
|
|
58
63
|
return { ...baseMetadata, tournament };
|
|
59
64
|
case "custom":
|
|
60
65
|
return { ...baseMetadata, action: payload.action };
|
|
66
|
+
case "hype_duel":
|
|
67
|
+
return { ...baseMetadata };
|
|
61
68
|
default:
|
|
62
69
|
throw new Error(`Invalid order type: ${orderType}`);
|
|
63
70
|
}
|
|
@@ -9,7 +9,6 @@ import { LinkAccount } from "./LinkAccount/LinkAccount.js";
|
|
|
9
9
|
import { ManageAccount } from "./ManageAccount/ManageAccount.js";
|
|
10
10
|
import { RequestPermissions } from "./RequestPermissions/RequestPermissions.js";
|
|
11
11
|
import { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow.js";
|
|
12
|
-
import { TransakModal } from "./Transak/TransakModal.js";
|
|
13
12
|
import { Dialog, DialogContent, DialogDescription, DialogTitle } from "./ui/dialog.js";
|
|
14
13
|
import { Drawer, DrawerContent, DrawerDescription, DrawerTitle } from "./ui/drawer.js";
|
|
15
14
|
const debug = debugB3React("B3DynamicModal");
|
|
@@ -45,7 +44,7 @@ export function B3DynamicModal() {
|
|
|
45
44
|
const hideCloseButton = isFreestyleType;
|
|
46
45
|
// Build content class using cn utility
|
|
47
46
|
// eslint-disable-next-line tailwindcss/no-custom-classname
|
|
48
|
-
const contentClass = cn("b3-modal", theme === "dark" && "dark", fullWidthTypes.includes(contentType?.type) && "w-full", isFreestyleType && "b3-modal-freestyle", contentType?.type === "signInWithB3" && "p-0", contentType?.type === "anySpend" && "md:px-6"
|
|
47
|
+
const contentClass = cn("b3-modal", theme === "dark" && "dark", fullWidthTypes.includes(contentType?.type) && "w-full", isFreestyleType && "b3-modal-freestyle", contentType?.type === "signInWithB3" && "p-0", contentType?.type === "anySpend" && "md:px-6");
|
|
49
48
|
debug("contentType", contentType);
|
|
50
49
|
const renderContent = () => {
|
|
51
50
|
if (!contentType)
|
|
@@ -67,8 +66,6 @@ export function B3DynamicModal() {
|
|
|
67
66
|
return _jsx(AnySpendTournament, { ...contentType, mode: "modal", action: "join" });
|
|
68
67
|
case "anySpendFundTournament":
|
|
69
68
|
return _jsx(AnySpendTournament, { ...contentType, mode: "modal", action: "fund" });
|
|
70
|
-
case "transak":
|
|
71
|
-
return _jsx(TransakModal, {});
|
|
72
69
|
case "anySpendOrderHistory":
|
|
73
70
|
return _jsx(OrderHistory, { onBack: () => { }, mode: "modal" });
|
|
74
71
|
case "anySpendStakeB3":
|
|
@@ -10,6 +10,7 @@ import { useModalStore } from "../../stores/useModalStore.js";
|
|
|
10
10
|
import { getProfileDisplayInfo } from "../../utils/profileDisplay.js";
|
|
11
11
|
import { useB3 } from "../B3Provider/useB3.js";
|
|
12
12
|
import { Button } from "../ui/button.js";
|
|
13
|
+
import app from "../../../../global-account/app.js";
|
|
13
14
|
const AUTH_METHODS = [
|
|
14
15
|
{ id: "email", label: "Email", enabled: true },
|
|
15
16
|
{ id: "phone", label: "Phone", enabled: true },
|
|
@@ -60,6 +61,16 @@ export function LinkAccount({ onSuccess: onSuccessCallback, onError, onClose, ch
|
|
|
60
61
|
setLinkingState(false);
|
|
61
62
|
onError?.(error);
|
|
62
63
|
},
|
|
64
|
+
onSuccess: async (data) => {
|
|
65
|
+
console.log("Raw Link Account Data:", data);
|
|
66
|
+
try {
|
|
67
|
+
console.log("Sync user data...");
|
|
68
|
+
await app.service("users").syncTwProfiles({});
|
|
69
|
+
}
|
|
70
|
+
catch (refreshError) {
|
|
71
|
+
console.warn("⚠️ Could not sync user data:", refreshError);
|
|
72
|
+
}
|
|
73
|
+
},
|
|
63
74
|
};
|
|
64
75
|
const validateInput = () => {
|
|
65
76
|
if (selectedMethod === "email") {
|
|
@@ -71,7 +71,7 @@ export function BalanceContent({ onLogout, partnerId }) {
|
|
|
71
71
|
setB3ModalOpen(false);
|
|
72
72
|
setLogoutLoading(false);
|
|
73
73
|
};
|
|
74
|
-
return (_jsxs("div", { className: "flex flex-col gap-6", children: [_jsx("div", { className: "flex items-center justify-between", children: _jsxs("div", { className: "flex items-center gap-4", children: [_jsxs("div", { className: "relative", children: [profile?.avatar ? (_jsx("img", { src: profile?.avatar, alt: "Profile", className: "size-24 rounded-full" })) : (_jsx("div", { className: "bg-b3-primary-wash size-24 rounded-full" })), _jsx("div", { className: "bg-b3-grey border-b3-background absolute -bottom-1 -right-1 flex size-8 items-center justify-center rounded-full border-4", children: _jsx(Pencil, { size: 16, className: "text-b3-background" }) })] }), _jsxs("div", { children: [_jsx("h2", { className: "text-b3-grey text-xl font-semibold", children: profile?.displayName || formatUsername(profile?.name || "") }), _jsxs("div", { className: "border-b3-line bg-b3-line/20 hover:bg-b3-line/40 flex w-fit items-center gap-2 rounded-full border px-3 py-1 transition-colors", children: [_jsx("span", { className: "text-b3-foreground-muted font-mono text-xs", children: centerTruncate(account?.address || "", 6) }), _jsx(CopyToClipboard, { text: account?.address || "" })] })] })] }) }), _jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsxs(Button, { className: "manage-account-deposit bg-b3-primary-wash hover:bg-b3-primary-wash/70 h-[84px] w-full flex-col items-start gap-2 rounded-2xl", onClick: () => {
|
|
74
|
+
return (_jsxs("div", { className: "flex flex-col gap-6", children: [_jsx("div", { className: "flex items-center justify-between", children: _jsxs("div", { className: "global-account-profile flex items-center gap-4", children: [_jsxs("div", { className: "global-account-profile-avatar relative", children: [profile?.avatar ? (_jsx("img", { src: profile?.avatar, alt: "Profile", className: "size-24 rounded-full" })) : (_jsx("div", { className: "bg-b3-primary-wash size-24 rounded-full" })), _jsx("div", { className: "bg-b3-grey border-b3-background absolute -bottom-1 -right-1 flex size-8 items-center justify-center rounded-full border-4", children: _jsx(Pencil, { size: 16, className: "text-b3-background" }) })] }), _jsxs("div", { className: "global-account-profile-info", children: [_jsx("h2", { className: "text-b3-grey text-xl font-semibold", children: profile?.displayName || formatUsername(profile?.name || "") }), _jsxs("div", { className: "address-button border-b3-line bg-b3-line/20 hover:bg-b3-line/40 flex w-fit items-center gap-2 rounded-full border px-3 py-1 transition-colors", children: [_jsx("span", { className: "text-b3-foreground-muted font-mono text-xs", children: centerTruncate(account?.address || "", 6) }), _jsx(CopyToClipboard, { text: account?.address || "" })] })] })] }) }), _jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsxs(Button, { className: "manage-account-deposit bg-b3-primary-wash hover:bg-b3-primary-wash/70 h-[84px] w-full flex-col items-start gap-2 rounded-2xl", onClick: () => {
|
|
75
75
|
setB3ModalOpen(true);
|
|
76
76
|
setB3ModalContentType({
|
|
77
77
|
type: "anySpend",
|
|
@@ -84,5 +84,5 @@ export function BalanceContent({ onLogout, partnerId }) {
|
|
|
84
84
|
type: "anySpend",
|
|
85
85
|
showBackButton: true,
|
|
86
86
|
});
|
|
87
|
-
}, children: [_jsx(SwapIcon, { size: 24, className: "text-b3-primary-blue" }), _jsx("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Swap" })] })] }), _jsxs(Accordion, { type: "multiple", value: openAccordions, onValueChange: setOpenAccordions, className: "space-y-2", children: [_jsxs(AccordionItem, { value: "global-account", className: "border-none", children: [_jsx(AccordionTrigger, { className: "text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline", children: _jsx("span", { children: "Balance" }) }), _jsxs(AccordionContent, { className: "space-y-4", children: [_jsx(TokenBalanceRow, { icon: _jsx(B3TokenIcon, { className: "size-10" }), name: "B3", balance: `${b3Balance?.formattedTotal || "0.00"} B3`, usdValue: b3Balance?.balanceUsdFormatted || "0.00", priceChange: b3Balance?.priceChange24h }), _jsx(TokenBalanceRow, { icon: _jsx(EthereumTokenIcon, { className: "size-10" }), name: "Ethereum", balance: `${nativeBalance?.formattedTotal || "0.00"} ETH`, usdValue: nativeBalance?.formattedTotalUsd || "0.00", priceChange: nativeBalance?.priceChange24h })] })] }), eoaAddress && (_jsxs(AccordionItem, { value: "eoa-account", className: "border-none", children: [_jsx(AccordionTrigger, { className: "text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsxs("span", { children: ["Connected ", eoaInfo?.data?.name || "Wallet"] }), _jsxs("div", { className: "border-b3-line bg-b3-line/20 hover:bg-b3-line/40 flex w-fit items-center gap-2 rounded-full border px-3 py-1 transition-colors", children: [_jsx("span", { className: "text-b3-foreground-muted font-mono text-xs", children: centerTruncate(eoaAddress, 6) }), _jsx(CopyToClipboard, { text: eoaAddress })] })] }) }), _jsxs(AccordionContent, { className: "space-y-4", children: [_jsx(TokenBalanceRow, { icon: _jsx(B3TokenIcon, { className: "size-10" }), name: "B3", balance: `${eoaB3Balance?.formattedTotal || "0.00"} B3`, usdValue: eoaB3Balance?.balanceUsdFormatted || "0.00", priceChange: eoaB3Balance?.priceChange24h }), _jsx(TokenBalanceRow, { icon: _jsx(EthereumTokenIcon, { className: "size-10" }), name: "Ethereum", balance: `${eoaNativeBalance?.formattedTotal || "0.00"} ETH`, usdValue: eoaNativeBalance?.formattedTotalUsd || "0.00", priceChange: eoaNativeBalance?.priceChange24h })] })] }))] }), _jsxs("button", { className: "border-b3-line hover:bg-b3-line relative flex w-full items-center justify-center rounded-2xl border p-4 transition-colors", onClick: onLogoutEnhanced, children: [_jsx("span", { className: "font-neue-montreal-semibold text-b3-grey", children: "Sign out" }), _jsx("div", { className: "absolute right-4", children: logoutLoading ? (_jsx(Loader2, { className: "animate-spin", size: 16 })) : (_jsx(SignOutIcon, { size: 16, className: "text-b3-grey" })) })] })] }));
|
|
87
|
+
}, children: [_jsx(SwapIcon, { size: 24, className: "text-b3-primary-blue" }), _jsx("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Swap" })] })] }), _jsxs(Accordion, { type: "multiple", value: openAccordions, onValueChange: setOpenAccordions, className: "space-y-2", children: [_jsxs(AccordionItem, { value: "global-account", className: "border-none", children: [_jsx(AccordionTrigger, { className: "text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline", children: _jsx("span", { children: "Balance" }) }), _jsxs(AccordionContent, { className: "space-y-4", children: [_jsx(TokenBalanceRow, { icon: _jsx(B3TokenIcon, { className: "size-10" }), name: "B3", balance: `${b3Balance?.formattedTotal || "0.00"} B3`, usdValue: b3Balance?.balanceUsdFormatted || "0.00", priceChange: b3Balance?.priceChange24h }), _jsx(TokenBalanceRow, { icon: _jsx(EthereumTokenIcon, { className: "size-10" }), name: "Ethereum", balance: `${nativeBalance?.formattedTotal || "0.00"} ETH`, usdValue: nativeBalance?.formattedTotalUsd || "0.00", priceChange: nativeBalance?.priceChange24h })] })] }), eoaAddress && (_jsxs(AccordionItem, { value: "eoa-account", className: "border-none", children: [_jsx(AccordionTrigger, { className: "text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsxs("span", { children: ["Connected ", eoaInfo?.data?.name || "Wallet"] }), _jsxs("div", { className: "address-button border-b3-line bg-b3-line/20 hover:bg-b3-line/40 flex w-fit items-center gap-2 rounded-full border px-3 py-1 transition-colors", children: [_jsx("span", { className: "text-b3-foreground-muted font-mono text-xs", children: centerTruncate(eoaAddress, 6) }), _jsx(CopyToClipboard, { text: eoaAddress })] })] }) }), _jsxs(AccordionContent, { className: "space-y-4", children: [_jsx(TokenBalanceRow, { icon: _jsx(B3TokenIcon, { className: "size-10" }), name: "B3", balance: `${eoaB3Balance?.formattedTotal || "0.00"} B3`, usdValue: eoaB3Balance?.balanceUsdFormatted || "0.00", priceChange: eoaB3Balance?.priceChange24h }), _jsx(TokenBalanceRow, { icon: _jsx(EthereumTokenIcon, { className: "size-10" }), name: "Ethereum", balance: `${eoaNativeBalance?.formattedTotal || "0.00"} ETH`, usdValue: eoaNativeBalance?.formattedTotalUsd || "0.00", priceChange: eoaNativeBalance?.priceChange24h })] })] }))] }), _jsxs("button", { className: "logout-button border-b3-line hover:bg-b3-line relative flex w-full items-center justify-center rounded-2xl border p-4 transition-colors", onClick: onLogoutEnhanced, children: [_jsx("span", { className: "font-neue-montreal-semibold text-b3-grey", children: "Sign out" }), _jsx("div", { className: "absolute right-4", children: logoutLoading ? (_jsx(Loader2, { className: "animate-spin", size: 16 })) : (_jsx(SignOutIcon, { size: 16, className: "text-b3-grey" })) })] })] }));
|
|
88
88
|
}
|
|
@@ -53,13 +53,30 @@ export function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit
|
|
|
53
53
|
const [unlinkingAccountId, setUnlinkingAccountId] = useState(null);
|
|
54
54
|
const { data: profilesRaw = [], isLoading: isLoadingProfiles } = useProfiles({ client });
|
|
55
55
|
const { mutate: unlinkProfile, isPending: isUnlinking } = useUnlinkProfile();
|
|
56
|
-
const { setB3ModalOpen, setB3ModalContentType, isLinking } = useModalStore();
|
|
56
|
+
const { setB3ModalOpen, setB3ModalContentType, isLinking, contentType } = useModalStore();
|
|
57
57
|
const { user, setUser } = useB3();
|
|
58
58
|
const [isUpdatingCode, setIsUpdatingCode] = useState(false);
|
|
59
59
|
const [newReferralCode, setNewReferralCode] = useState("");
|
|
60
60
|
const [isEditingCode, setIsEditingCode] = useState(false);
|
|
61
61
|
const referallCodeRef = useRef(null);
|
|
62
62
|
const { data: referrals, isLoading: isLoadingReferrals } = useQueryB3("referrals", "find", { query: { referrerId: user?.userId } }, !!user?.userId);
|
|
63
|
+
const showReferralInfo = contentType?.showReferralInfo ?? false;
|
|
64
|
+
const mutationOptions = {
|
|
65
|
+
onError: (error) => {
|
|
66
|
+
console.error("Error Unlinking account:", error);
|
|
67
|
+
toast.error(error.message);
|
|
68
|
+
},
|
|
69
|
+
onSuccess: async (data) => {
|
|
70
|
+
console.log("Raw Link Account Data:", data);
|
|
71
|
+
try {
|
|
72
|
+
console.log("Sync user data...");
|
|
73
|
+
await app.service("users").syncTwProfiles({});
|
|
74
|
+
}
|
|
75
|
+
catch (refreshError) {
|
|
76
|
+
console.warn("⚠️ Could not sync user data:", refreshError);
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
};
|
|
63
80
|
// Fetch referred users
|
|
64
81
|
const currentReferralCode = user?.referralCode || user?.userId || "";
|
|
65
82
|
const handleCopyCode = async () => {
|
|
@@ -102,7 +119,7 @@ export function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit
|
|
|
102
119
|
const handleUnlink = async (profile) => {
|
|
103
120
|
setUnlinkingAccountId(profile.title);
|
|
104
121
|
try {
|
|
105
|
-
unlinkProfile({ client, profileToUnlink: profile.originalProfile });
|
|
122
|
+
unlinkProfile({ client, profileToUnlink: profile.originalProfile }, mutationOptions);
|
|
106
123
|
}
|
|
107
124
|
catch (error) {
|
|
108
125
|
console.error("Error unlinking account:", error);
|
|
@@ -129,7 +146,9 @@ export function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit
|
|
|
129
146
|
},
|
|
130
147
|
});
|
|
131
148
|
};
|
|
132
|
-
return (_jsxs("div", { className: "space-y-8", children: [_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h3", { className: "text-b3-grey font-neue-montreal-semibold text-xl", children: "Linked Accounts" }), _jsxs(Button, { className: "bg-b3-primary-wash hover:bg-b3-primary-wash/70 flex items-center gap-2 rounded-full px-4 py-2", onClick: handleOpenLinkModal, disabled: isLinking, children: [isLinking ? (_jsx(Loader2, { className: "text-b3-primary-blue animate-spin", size: 16 })) : (_jsx(LinkIcon, { size: 16, className: "text-b3-primary-blue" })), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold", children: isLinking ? "Linking..." : "Link New Account" })] })] }), isLoadingProfiles ? (_jsx("div", { className: "flex justify-center py-8", children: _jsx(Loader2, { className: "text-b3-grey animate-spin" }) })) : profiles.length > 0 ? (_jsx("div", { className: "space-y-4", children: profiles.map(profile => (_jsxs("div", { className: "bg-b3-line flex items-center justify-between rounded-xl p-4", children: [_jsxs("div", { className: "flex items-center gap-3", children: [profile.imageUrl ? (_jsx("img", { src: profile.imageUrl, alt: profile.title, className: "size-10 rounded-full" })) : (_jsx("div", { className: "bg-b3-primary-wash flex h-10 w-10 items-center justify-center rounded-full", children: _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm uppercase", children: profile.initial }) })), _jsxs("div", { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-b3-grey font-neue-montreal-semibold", children: profile.title }), _jsx("span", { className: "text-b3-foreground-muted font-neue-montreal-medium bg-b3-primary-wash rounded px-2 py-0.5 text-xs", children: profile.type.toUpperCase() })] }), _jsx("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: profile.subtitle })] })] }), _jsx(Button, { variant: "ghost", size: "icon", className: "text-b3-grey hover:text-b3-negative", onClick: () => handleUnlink(profile), disabled: unlinkingAccountId === profile.title || isUnlinking, children: unlinkingAccountId === profile.title || isUnlinking ? (_jsx(Loader2, { className: "animate-spin" })) : (_jsx(UnlinkIcon, { size: 16 })) })] }, profile.title))) })) : (_jsx("div", { className: "text-b3-foreground-muted py-8 text-center", children: "No linked accounts found" }))] }),
|
|
149
|
+
return (_jsxs("div", { className: "space-y-8", children: [_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h3", { className: "text-b3-grey font-neue-montreal-semibold text-xl", children: "Linked Accounts" }), _jsxs(Button, { className: "bg-b3-primary-wash hover:bg-b3-primary-wash/70 flex items-center gap-2 rounded-full px-4 py-2", onClick: handleOpenLinkModal, disabled: isLinking, children: [isLinking ? (_jsx(Loader2, { className: "text-b3-primary-blue animate-spin", size: 16 })) : (_jsx(LinkIcon, { size: 16, className: "text-b3-primary-blue" })), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold", children: isLinking ? "Linking..." : "Link New Account" })] })] }), isLoadingProfiles ? (_jsx("div", { className: "flex justify-center py-8", children: _jsx(Loader2, { className: "text-b3-grey animate-spin" }) })) : profiles.length > 0 ? (_jsx("div", { className: "space-y-4", children: profiles.map(profile => (_jsxs("div", { className: "bg-b3-line flex items-center justify-between rounded-xl p-4", children: [_jsxs("div", { className: "flex items-center gap-3", children: [profile.imageUrl ? (_jsx("img", { src: profile.imageUrl, alt: profile.title, className: "size-10 rounded-full" })) : (_jsx("div", { className: "bg-b3-primary-wash flex h-10 w-10 items-center justify-center rounded-full", children: _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm uppercase", children: profile.initial }) })), _jsxs("div", { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-b3-grey font-neue-montreal-semibold", children: profile.title }), _jsx("span", { className: "text-b3-foreground-muted font-neue-montreal-medium bg-b3-primary-wash rounded px-2 py-0.5 text-xs", children: profile.type.toUpperCase() })] }), _jsx("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: profile.subtitle })] })] }), _jsx(Button, { variant: "ghost", size: "icon", className: "text-b3-grey hover:text-b3-negative", onClick: () => handleUnlink(profile), disabled: unlinkingAccountId === profile.title || isUnlinking, children: unlinkingAccountId === profile.title || isUnlinking ? (_jsx(Loader2, { className: "animate-spin" })) : (_jsx(UnlinkIcon, { size: 16 })) })] }, profile.title))) })) : (_jsx("div", { className: "text-b3-foreground-muted py-8 text-center", children: "No linked accounts found" }))] }), showReferralInfo && (
|
|
150
|
+
/* Referral Section */
|
|
151
|
+
_jsxs("div", { className: "space-y-4", children: [_jsx("h3", { className: "text-b3-grey font-neue-montreal-semibold text-xl", children: "Referrals" }), _jsxs("div", { className: "bg-b3-line rounded-xl p-4", children: [isEditingCode && (_jsxs("div", { children: [_jsx("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Your Referral Code" }), _jsx("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Share this code with friends to earn rewards" })] })), _jsxs("div", { className: "flex items-center justify-between", children: [!isEditingCode && (_jsxs("div", { children: [_jsx("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Your Referral Code" }), _jsx("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Share this code with friends to earn rewards" })] })), _jsx("div", { className: "flex items-center gap-2", children: isEditingCode ? (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("input", { type: "text", value: newReferralCode, onChange: e => setNewReferralCode(e.target.value), className: "rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm", placeholder: "Enter new code", ref: referallCodeRef }), _jsx(Button, { size: "sm", onClick: handleUpdateReferralCode, disabled: isUpdatingCode || !newReferralCode, children: isUpdatingCode ? _jsx(Loader2, { className: "h-4 w-4 animate-spin" }) : "Save" }), _jsx(Button, { size: "sm", variant: "ghost", onClick: () => {
|
|
133
152
|
setIsEditingCode(false);
|
|
134
153
|
setNewReferralCode("");
|
|
135
154
|
}, children: "Cancel" })] })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm", children: currentReferralCode }), _jsx(Button, { size: "icon", variant: "ghost", onClick: handleCopyCode, children: _jsx(Copy, { className: "h-4 w-4" }) }), _jsx(Button, { size: "icon", variant: "ghost", onClick: () => {
|
|
@@ -137,7 +156,7 @@ export function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit
|
|
|
137
156
|
setTimeout(() => {
|
|
138
157
|
referallCodeRef.current?.focus();
|
|
139
158
|
}, 100);
|
|
140
|
-
}, children: _jsx(Pencil, { className: "h-4 w-4" }) })] })) })] })] }), _jsxs("div", { className: "bg-b3-line rounded-xl p-4", children: [_jsx("div", { className: "text-b3-grey font-neue-montreal-semibold mb-4", children: "Referred Users" }), isLoadingReferrals ? (_jsx("div", { className: "flex justify-center py-4", children: _jsx(Loader2, { className: "h-6 w-6 animate-spin text-gray-400" }) })) : referrals?.data?.length ? (_jsx("div", { className: "space-y-3", children: referrals.data.map((referral) => (_jsxs("div", { className: "flex items-center justify-between rounded-lg bg-white p-3", children: [_jsx("div", { className: "text-sm font-medium", children: referral.referreeId }), _jsx("div", { className: "text-sm text-gray-500", children: new Date(referral.createdAt).toLocaleDateString() })] }, String(referral._id)))) })) : (_jsx("div", { className: "py-4 text-center text-gray-500", children: "No referred users yet" }))] })] }), _jsxs("div", { className: "space-y-4", children: [_jsx("h3", { className: "text-b3-grey font-neue-montreal-semibold text-xl", children: "Account Preferences" }), _jsx("div", { className: "bg-b3-line rounded-xl p-4", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { children: [_jsx("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Dark Mode" }), _jsx("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Switch between light and dark theme" })] }), _jsx("div", { className: "bg-b3-primary-wash h-6 w-12 rounded-full" })] }) })] }), _jsxs("div", { className: "border-b3-line flex items-center justify-between rounded-2xl border p-4", children: [_jsxs("div", { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("img", { src: "https://cdn.b3.fun/b3_logo.svg", alt: "B3", className: "h-4" }), _jsx("h3", { className: "font-neue-montreal-semibold text-b3-grey", children: "Global Account" })] }), _jsx("p", { className: "text-b3-foreground-muted font-neue-montreal-medium mt-2 text-sm", children: "Your universal account for all B3 apps" })] }), _jsx("button", { className: "text-b3-grey hover:text-b3-grey/80 hover:bg-b3-line border-b3-line flex size-12 items-center justify-center rounded-full border", onClick: onLogoutEnhanced, children: logoutLoading ? _jsx(Loader2, { className: "animate-spin" }) : _jsx(SignOutIcon, { size: 16, className: "text-b3-grey" }) })] })] }));
|
|
159
|
+
}, children: _jsx(Pencil, { className: "h-4 w-4" }) })] })) })] })] }), _jsxs("div", { className: "bg-b3-line rounded-xl p-4", children: [_jsx("div", { className: "text-b3-grey font-neue-montreal-semibold mb-4", children: "Referred Users" }), isLoadingReferrals ? (_jsx("div", { className: "flex justify-center py-4", children: _jsx(Loader2, { className: "h-6 w-6 animate-spin text-gray-400" }) })) : referrals?.data?.length ? (_jsx("div", { className: "space-y-3", children: referrals.data.map((referral) => (_jsxs("div", { className: "flex items-center justify-between rounded-lg bg-white p-3", children: [_jsx("div", { className: "text-sm font-medium", children: referral.referreeId }), _jsx("div", { className: "text-sm text-gray-500", children: new Date(referral.createdAt).toLocaleDateString() })] }, String(referral._id)))) })) : (_jsx("div", { className: "py-4 text-center text-gray-500", children: "No referred users yet" }))] })] })), _jsxs("div", { className: "space-y-4", children: [_jsx("h3", { className: "text-b3-grey font-neue-montreal-semibold text-xl", children: "Account Preferences" }), _jsx("div", { className: "bg-b3-line rounded-xl p-4", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { children: [_jsx("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Dark Mode" }), _jsx("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Switch between light and dark theme" })] }), _jsx("div", { className: "bg-b3-primary-wash h-6 w-12 rounded-full" })] }) })] }), _jsxs("div", { className: "border-b3-line flex items-center justify-between rounded-2xl border p-4", children: [_jsxs("div", { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("img", { src: "https://cdn.b3.fun/b3_logo.svg", alt: "B3", className: "h-4" }), _jsx("h3", { className: "font-neue-montreal-semibold text-b3-grey", children: "Global Account" })] }), _jsx("p", { className: "text-b3-foreground-muted font-neue-montreal-medium mt-2 text-sm", children: "Your universal account for all B3 apps" })] }), _jsx("button", { className: "text-b3-grey hover:text-b3-grey/80 hover:bg-b3-line border-b3-line flex size-12 items-center justify-center rounded-full border", onClick: onLogoutEnhanced, children: logoutLoading ? _jsx(Loader2, { className: "animate-spin" }) : _jsx(SignOutIcon, { size: 16, className: "text-b3-grey" }) })] })] }));
|
|
141
160
|
};
|
|
142
161
|
return (_jsx("div", { className: "b3-manage-account bg-b3-background flex flex-col rounded-xl", children: _jsx("div", { className: "flex-1", children: _jsxs(TabsPrimitive, { defaultValue: activeTab, onValueChange: value => {
|
|
143
162
|
const tab = value;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
|
|
2
1
|
export { B3DynamicModal } from "./B3DynamicModal";
|
|
3
2
|
export { B3Provider, InnerProvider } from "./B3Provider/B3Provider";
|
|
3
|
+
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
|
|
4
4
|
export { B3Context, type B3ContextType } from "./B3Provider/types";
|
|
5
5
|
export { useB3 } from "./B3Provider/useB3";
|
|
6
6
|
export { StyleRoot } from "./StyleRoot";
|
|
7
|
-
export { AuthButton } from "./SignInWithB3/components/AuthButton";
|
|
8
|
-
export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
|
|
9
|
-
export { WalletRow } from "./SignInWithB3/components/WalletRow";
|
|
10
7
|
export { SignInWithB3 } from "./SignInWithB3/SignInWithB3";
|
|
11
8
|
export { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow";
|
|
12
9
|
export { SignInWithB3Privy } from "./SignInWithB3/SignInWithB3Privy";
|
|
10
|
+
export { AuthButton } from "./SignInWithB3/components/AuthButton";
|
|
11
|
+
export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
|
|
12
|
+
export { WalletRow } from "./SignInWithB3/components/WalletRow";
|
|
13
13
|
export { LoginStepContainer } from "./SignInWithB3/steps/LoginStep";
|
|
14
14
|
export { getConnectOptionsFromStrategy, isWalletType, type AllowedStrategy } from "./SignInWithB3/utils/signInUtils";
|
|
15
15
|
export { ManageAccount } from "./ManageAccount/ManageAccount";
|
|
@@ -19,12 +19,15 @@ export { AccountAssets } from "./AccountAssets/AccountAssets";
|
|
|
19
19
|
export { MintButton } from "./MintButton/MintButton";
|
|
20
20
|
export { SendETHButton } from "./SendETHButton/SendETHButton";
|
|
21
21
|
export { SendERC20Button } from "./SendERC20Button/SendERC20Button";
|
|
22
|
-
export { TransakModal } from "./Transak/TransakModal";
|
|
23
22
|
export { Button as CustomButton, buttonVariants as customButtonVariants } from "./custom/Button";
|
|
24
23
|
export { ClientOnly } from "./custom/ClientOnly";
|
|
25
24
|
export { CopyToClipboard } from "./custom/CopyToClipboard";
|
|
26
25
|
export { StaggeredFadeLoader } from "./custom/StaggeredFadeLoader";
|
|
27
26
|
export { WalletConnectorIcon } from "./custom/WalletConnectorIcon";
|
|
27
|
+
export { Loading } from "./ui/Loading";
|
|
28
|
+
export { ShinyButton } from "./ui/ShinyButton";
|
|
29
|
+
export { TabTrigger, Tabs, TabsContent, TabsList, TabsTransitionWrapper } from "./ui/TabSystem";
|
|
30
|
+
export { TabTrigger as TabTriggerPrimitive, TabsContent as TabsContentPrimitive, TabsList as TabsListPrimitive, Tabs as TabsPrimitive, } from "./ui/Tabs";
|
|
28
31
|
export { Badge, badgeVariants } from "./ui/badge";
|
|
29
32
|
export { Button, buttonVariants } from "./ui/button";
|
|
30
33
|
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, } from "./ui/command";
|
|
@@ -33,13 +36,9 @@ export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, Dr
|
|
|
33
36
|
export { GlareCard } from "./ui/glare-card";
|
|
34
37
|
export { GlareCardRounded } from "./ui/glare-card-rounded";
|
|
35
38
|
export { Input } from "./ui/input";
|
|
36
|
-
export { Loading } from "./ui/Loading";
|
|
37
39
|
export { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";
|
|
38
40
|
export { ScrollArea, ScrollBar } from "./ui/scroll-area";
|
|
39
|
-
export { ShinyButton } from "./ui/ShinyButton";
|
|
40
41
|
export { Skeleton } from "./ui/skeleton";
|
|
41
|
-
export { TabsContent as TabsContentPrimitive, TabsList as TabsListPrimitive, Tabs as TabsPrimitive, TabTrigger as TabTriggerPrimitive, } from "./ui/Tabs";
|
|
42
|
-
export { Tabs, TabsContent, TabsList, TabsTransitionWrapper, TabTrigger } from "./ui/TabSystem";
|
|
43
42
|
export { TextLoop } from "./ui/text-loop";
|
|
44
43
|
export { TextShimmer } from "./ui/text-shimmer";
|
|
45
44
|
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./ui/tooltip";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// Core Components
|
|
2
|
-
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper.js";
|
|
3
2
|
export { B3DynamicModal } from "./B3DynamicModal.js";
|
|
4
3
|
export { B3Provider, InnerProvider } from "./B3Provider/B3Provider.js";
|
|
4
|
+
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper.js";
|
|
5
5
|
export { B3Context } from "./B3Provider/types.js";
|
|
6
6
|
export { useB3 } from "./B3Provider/useB3.js";
|
|
7
7
|
export { StyleRoot } from "./StyleRoot.js";
|
|
8
8
|
// SignInWithB3 Components
|
|
9
|
-
export { AuthButton } from "./SignInWithB3/components/AuthButton.js";
|
|
10
|
-
export { PermissionItem } from "./SignInWithB3/components/PermissionItem.js";
|
|
11
|
-
export { WalletRow } from "./SignInWithB3/components/WalletRow.js";
|
|
12
9
|
export { SignInWithB3 } from "./SignInWithB3/SignInWithB3.js";
|
|
13
10
|
export { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow.js";
|
|
14
11
|
export { SignInWithB3Privy } from "./SignInWithB3/SignInWithB3Privy.js";
|
|
12
|
+
export { AuthButton } from "./SignInWithB3/components/AuthButton.js";
|
|
13
|
+
export { PermissionItem } from "./SignInWithB3/components/PermissionItem.js";
|
|
14
|
+
export { WalletRow } from "./SignInWithB3/components/WalletRow.js";
|
|
15
15
|
export { LoginStepContainer } from "./SignInWithB3/steps/LoginStep.js";
|
|
16
16
|
export { getConnectOptionsFromStrategy, isWalletType } from "./SignInWithB3/utils/signInUtils.js";
|
|
17
17
|
// ManageAccount Components
|
|
@@ -27,8 +27,6 @@ export { MintButton } from "./MintButton/MintButton.js";
|
|
|
27
27
|
export { SendETHButton } from "./SendETHButton/SendETHButton.js";
|
|
28
28
|
// SendERC20Button Components
|
|
29
29
|
export { SendERC20Button } from "./SendERC20Button/SendERC20Button.js";
|
|
30
|
-
// Transak Components
|
|
31
|
-
export { TransakModal } from "./Transak/TransakModal.js";
|
|
32
30
|
// Custom Components
|
|
33
31
|
export { Button as CustomButton, buttonVariants as customButtonVariants } from "./custom/Button.js";
|
|
34
32
|
export { ClientOnly } from "./custom/ClientOnly.js";
|
|
@@ -36,6 +34,10 @@ export { CopyToClipboard } from "./custom/CopyToClipboard.js";
|
|
|
36
34
|
export { StaggeredFadeLoader } from "./custom/StaggeredFadeLoader.js";
|
|
37
35
|
export { WalletConnectorIcon } from "./custom/WalletConnectorIcon.js";
|
|
38
36
|
// UI Components
|
|
37
|
+
export { Loading } from "./ui/Loading.js";
|
|
38
|
+
export { ShinyButton } from "./ui/ShinyButton.js";
|
|
39
|
+
export { TabTrigger, Tabs, TabsContent, TabsList, TabsTransitionWrapper } from "./ui/TabSystem.js";
|
|
40
|
+
export { TabTrigger as TabTriggerPrimitive, TabsContent as TabsContentPrimitive, TabsList as TabsListPrimitive, Tabs as TabsPrimitive, } from "./ui/Tabs.js";
|
|
39
41
|
export { Badge, badgeVariants } from "./ui/badge.js";
|
|
40
42
|
export { Button, buttonVariants } from "./ui/button.js";
|
|
41
43
|
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, } from "./ui/command.js";
|
|
@@ -44,13 +46,9 @@ export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, Dr
|
|
|
44
46
|
export { GlareCard } from "./ui/glare-card.js";
|
|
45
47
|
export { GlareCardRounded } from "./ui/glare-card-rounded.js";
|
|
46
48
|
export { Input } from "./ui/input.js";
|
|
47
|
-
export { Loading } from "./ui/Loading.js";
|
|
48
49
|
export { Popover, PopoverContent, PopoverTrigger } from "./ui/popover.js";
|
|
49
50
|
export { ScrollArea, ScrollBar } from "./ui/scroll-area.js";
|
|
50
|
-
export { ShinyButton } from "./ui/ShinyButton.js";
|
|
51
51
|
export { Skeleton } from "./ui/skeleton.js";
|
|
52
|
-
export { TabsContent as TabsContentPrimitive, TabsList as TabsListPrimitive, Tabs as TabsPrimitive, TabTrigger as TabTriggerPrimitive, } from "./ui/Tabs.js";
|
|
53
|
-
export { Tabs, TabsContent, TabsList, TabsTransitionWrapper, TabTrigger } from "./ui/TabSystem.js";
|
|
54
52
|
export { TextLoop } from "./ui/text-loop.js";
|
|
55
53
|
export { TextShimmer } from "./ui/text-shimmer.js";
|
|
56
54
|
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./ui/tooltip.js";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { B3Provider } from "./components/B3Provider/B3Provider.native";
|
|
2
|
-
export { useB3 } from "./components/B3Provider/useB3";
|
|
3
2
|
export { B3Context, type B3ContextType } from "./components/B3Provider/types";
|
|
3
|
+
export { useB3 } from "./components/B3Provider/useB3";
|
|
4
4
|
export { useAccountWallet } from "./hooks/useAccountWallet";
|
|
5
5
|
export { useAuthentication } from "./hooks/useAuthentication";
|
|
6
|
+
export { useProfile } from "./hooks/useProfile";
|
|
6
7
|
export { useSiwe } from "./hooks/useSiwe";
|
|
7
8
|
export { useAuthStore } from "./stores/useAuthStore";
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
// export * from "./stores/index.js";
|
|
4
4
|
// We only export the components and hooks that are needed for the native app
|
|
5
5
|
export { B3Provider } from "./components/B3Provider/B3Provider.native.js";
|
|
6
|
-
export { useB3 } from "./components/B3Provider/useB3.js";
|
|
7
6
|
export { B3Context } from "./components/B3Provider/types.js";
|
|
7
|
+
export { useB3 } from "./components/B3Provider/useB3.js";
|
|
8
8
|
export { useAccountWallet } from "./hooks/useAccountWallet.js";
|
|
9
9
|
export { useAuthentication } from "./hooks/useAuthentication.js";
|
|
10
|
+
export { useProfile } from "./hooks/useProfile.js";
|
|
10
11
|
export { useSiwe } from "./hooks/useSiwe.js";
|
|
11
12
|
export { useAuthStore } from "./stores/useAuthStore.js";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { useAuthStore } from "./useAuthStore";
|
|
2
2
|
export { useModalStore } from "./useModalStore";
|
|
3
|
-
export type { AnySpendBuySpinProps, AnySpendFundTournamentProps, AnySpendJoinTournamentProps, AnySpendModalProps, AnySpendNftProps,
|
|
3
|
+
export type { AnySpendBuySpinProps, AnySpendFundTournamentProps, AnySpendJoinTournamentProps, AnySpendModalProps, AnySpendNftProps, AnySpendOrderHistoryProps, AnySpendStakeB3Props, AnyspendOrderDetailsProps, ManageAccountModalProps, ModalContentType, RequestPermissionsModalProps, SignInWithB3ModalProps, } from "./useModalStore";
|
|
@@ -82,6 +82,8 @@ export interface ManageAccountModalProps extends BaseModalProps {
|
|
|
82
82
|
activeTab?: "overview" | "tokens" | "nfts" | "apps" | "settings";
|
|
83
83
|
/** Function to set the active tab */
|
|
84
84
|
setActiveTab?: (tab: "overview" | "tokens" | "nfts" | "apps" | "settings") => void;
|
|
85
|
+
/** Whether to show the referral information */
|
|
86
|
+
showReferralInfo?: boolean;
|
|
85
87
|
}
|
|
86
88
|
/**
|
|
87
89
|
* Props for the AnySpend modal
|
|
@@ -183,24 +185,6 @@ export interface AnyspendOrderDetailsProps extends BaseModalProps {
|
|
|
183
185
|
/** Whether to show the back button */
|
|
184
186
|
showBackButton?: boolean;
|
|
185
187
|
}
|
|
186
|
-
/**
|
|
187
|
-
* Props for the Transak modal
|
|
188
|
-
* Handles Transak-specific on-ramping
|
|
189
|
-
*/
|
|
190
|
-
export interface TransakProps extends BaseModalProps {
|
|
191
|
-
/** Modal type identifier */
|
|
192
|
-
type: "transak";
|
|
193
|
-
/** Wallet address to receive the purchased crypto */
|
|
194
|
-
destinationWalletAddress?: string;
|
|
195
|
-
/** Default amount of crypto to purchase */
|
|
196
|
-
defaultCryptoAmount?: number;
|
|
197
|
-
/** Amount of fiat currency to spend */
|
|
198
|
-
fiatAmount?: number;
|
|
199
|
-
/** ISO country code for KYC and available payment methods */
|
|
200
|
-
countryCode?: string;
|
|
201
|
-
/** Callback function called when the purchase is successful */
|
|
202
|
-
onSuccess?: () => void;
|
|
203
|
-
}
|
|
204
188
|
/**
|
|
205
189
|
* Props for the AnySpend order history modal
|
|
206
190
|
*/
|
|
@@ -298,17 +282,15 @@ export interface AnySpendDepositHypeProps extends BaseModalProps {
|
|
|
298
282
|
sourceTokenChainId?: number;
|
|
299
283
|
/** Payment type - crypto or fiat */
|
|
300
284
|
paymentType?: "crypto" | "fiat";
|
|
301
|
-
/** Deposit contract address */
|
|
302
|
-
depositContractAddress: string;
|
|
303
285
|
/** Main footer */
|
|
304
286
|
mainFooter?: React.ReactNode;
|
|
305
287
|
/** Callback function called when the deposit is successful */
|
|
306
|
-
onSuccess?: () => void;
|
|
288
|
+
onSuccess?: (amount?: string) => void;
|
|
307
289
|
}
|
|
308
290
|
/**
|
|
309
291
|
* Union type of all possible modal content types
|
|
310
292
|
*/
|
|
311
|
-
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps |
|
|
293
|
+
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps;
|
|
312
294
|
/**
|
|
313
295
|
* State interface for the modal store
|
|
314
296
|
*/
|