@b3dotfun/sdk 0.0.35-alpha.1 → 0.0.35-alpha.3
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/global-account/react/components/ManageAccount/BalanceContent.d.ts +3 -1
- package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +4 -4
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.d.ts +3 -1
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +6 -6
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -0
- package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.d.ts +3 -1
- package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +4 -4
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.d.ts +3 -1
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +6 -6
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/global-account/react/components/ManageAccount/BalanceContent.d.ts +3 -1
- package/dist/types/global-account/react/components/ManageAccount/ManageAccount.d.ts +3 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -0
- package/package.json +3 -3
- package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +38 -30
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +106 -77
- package/src/global-account/react/stores/useModalStore.ts +4 -0
|
@@ -42,6 +42,8 @@ interface ManageAccountProps {
|
|
|
42
42
|
chain: Chain;
|
|
43
43
|
partnerId: string;
|
|
44
44
|
containerClassName?: string;
|
|
45
|
+
showSwap?: boolean;
|
|
46
|
+
showDeposit?: boolean;
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
export function ManageAccount({
|
|
@@ -50,6 +52,8 @@ export function ManageAccount({
|
|
|
50
52
|
onDeposit: _onDeposit,
|
|
51
53
|
chain,
|
|
52
54
|
partnerId,
|
|
55
|
+
showSwap,
|
|
56
|
+
showDeposit,
|
|
53
57
|
}: ManageAccountProps) {
|
|
54
58
|
const [revokingSignerId, setRevokingSignerId] = useState<string | null>(null);
|
|
55
59
|
const account = useActiveAccount();
|
|
@@ -234,53 +238,64 @@ export function ManageAccount({
|
|
|
234
238
|
};
|
|
235
239
|
|
|
236
240
|
return (
|
|
237
|
-
<div className="space-y-8">
|
|
241
|
+
<div className="linked-accounts-settings space-y-8">
|
|
238
242
|
{/* Linked Accounts Section */}
|
|
239
|
-
<div className="space-y-4">
|
|
240
|
-
<div className="flex items-center justify-between">
|
|
241
|
-
<h3 className="text-b3-grey font-neue-montreal-semibold text-xl">
|
|
243
|
+
<div className="linked-accounts-section space-y-4">
|
|
244
|
+
<div className="linked-accounts-header flex items-center justify-between">
|
|
245
|
+
<h3 className="text-b3-grey font-neue-montreal-semibold linked-accounts-settings-title text-xl">
|
|
246
|
+
Linked Accounts
|
|
247
|
+
</h3>
|
|
242
248
|
<Button
|
|
243
|
-
className="bg-b3-primary-wash hover:bg-b3-primary-wash/70 flex items-center gap-2 rounded-full px-4 py-2"
|
|
249
|
+
className="linked-accounts-settings-button linked-accounts-link-button bg-b3-primary-wash hover:bg-b3-primary-wash/70 flex items-center gap-2 rounded-full px-4 py-2"
|
|
244
250
|
onClick={handleOpenLinkModal}
|
|
245
251
|
disabled={isLinking}
|
|
246
252
|
>
|
|
247
253
|
{isLinking ? (
|
|
248
|
-
<Loader2 className="text-b3-primary-blue animate-spin" size={16} />
|
|
254
|
+
<Loader2 className="linked-accounts-link-loading text-b3-primary-blue animate-spin" size={16} />
|
|
249
255
|
) : (
|
|
250
|
-
<LinkIcon size={16} className="text-b3-primary-blue" />
|
|
256
|
+
<LinkIcon size={16} className="linked-accounts-link-icon text-b3-primary-blue" />
|
|
251
257
|
)}
|
|
252
|
-
<span className="text-b3-grey font-neue-montreal-semibold">
|
|
258
|
+
<span className="linked-accounts-link-text text-b3-grey font-neue-montreal-semibold">
|
|
253
259
|
{isLinking ? "Linking..." : "Link New Account"}
|
|
254
260
|
</span>
|
|
255
261
|
</Button>
|
|
256
262
|
</div>
|
|
257
263
|
|
|
258
264
|
{isLoadingProfiles ? (
|
|
259
|
-
<div className="flex justify-center py-8">
|
|
265
|
+
<div className="linked-accounts-loading flex justify-center py-8">
|
|
260
266
|
<Loader2 className="text-b3-grey animate-spin" />
|
|
261
267
|
</div>
|
|
262
268
|
) : profiles.length > 0 ? (
|
|
263
|
-
<div className="space-y-4">
|
|
269
|
+
<div className="linked-accounts-list space-y-4">
|
|
264
270
|
{profiles.map(profile => (
|
|
265
|
-
<div
|
|
266
|
-
|
|
271
|
+
<div
|
|
272
|
+
key={profile.title}
|
|
273
|
+
className="linked-account-item bg-b3-line flex items-center justify-between rounded-xl p-4"
|
|
274
|
+
>
|
|
275
|
+
<div className="linked-account-info flex items-center gap-3">
|
|
267
276
|
{profile.imageUrl ? (
|
|
268
|
-
<img
|
|
277
|
+
<img
|
|
278
|
+
src={profile.imageUrl}
|
|
279
|
+
alt={profile.title}
|
|
280
|
+
className="linked-account-avatar linked-account-avatar-image size-10 rounded-full"
|
|
281
|
+
/>
|
|
269
282
|
) : (
|
|
270
|
-
<div className="bg-b3-primary-wash flex h-10 w-10 items-center justify-center rounded-full">
|
|
271
|
-
<span className="text-b3-grey font-neue-montreal-semibold text-sm uppercase">
|
|
283
|
+
<div className="linked-account-avatar linked-account-avatar-placeholder bg-b3-primary-wash flex h-10 w-10 items-center justify-center rounded-full">
|
|
284
|
+
<span className="linked-account-initial text-b3-grey font-neue-montreal-semibold text-sm uppercase">
|
|
272
285
|
{profile.initial}
|
|
273
286
|
</span>
|
|
274
287
|
</div>
|
|
275
288
|
)}
|
|
276
|
-
<div>
|
|
277
|
-
<div className="flex items-center gap-2">
|
|
278
|
-
<span className="text-b3-grey font-neue-montreal-semibold">
|
|
279
|
-
|
|
289
|
+
<div className="linked-account-details">
|
|
290
|
+
<div className="linked-account-title-row flex items-center gap-2">
|
|
291
|
+
<span className="linked-account-title text-b3-grey font-neue-montreal-semibold">
|
|
292
|
+
{profile.title}
|
|
293
|
+
</span>
|
|
294
|
+
<span className="linked-account-type text-b3-foreground-muted font-neue-montreal-medium bg-b3-primary-wash rounded px-2 py-0.5 text-xs">
|
|
280
295
|
{profile.type.toUpperCase()}
|
|
281
296
|
</span>
|
|
282
297
|
</div>
|
|
283
|
-
<div className="text-b3-foreground-muted font-neue-montreal-medium text-sm">
|
|
298
|
+
<div className="linked-account-subtitle text-b3-foreground-muted font-neue-montreal-medium text-sm">
|
|
284
299
|
{profile.subtitle}
|
|
285
300
|
</div>
|
|
286
301
|
</div>
|
|
@@ -288,69 +303,79 @@ export function ManageAccount({
|
|
|
288
303
|
<Button
|
|
289
304
|
variant="ghost"
|
|
290
305
|
size="icon"
|
|
291
|
-
className="text-b3-grey hover:text-b3-negative"
|
|
306
|
+
className="linked-account-unlink-button text-b3-grey hover:text-b3-negative"
|
|
292
307
|
onClick={() => handleUnlink(profile)}
|
|
293
308
|
disabled={unlinkingAccountId === profile.title || isUnlinking}
|
|
294
309
|
>
|
|
295
310
|
{unlinkingAccountId === profile.title || isUnlinking ? (
|
|
296
|
-
<Loader2 className="animate-spin" />
|
|
311
|
+
<Loader2 className="linked-account-unlink-loading animate-spin" />
|
|
297
312
|
) : (
|
|
298
|
-
<UnlinkIcon size={16} />
|
|
313
|
+
<UnlinkIcon size={16} className="linked-account-unlink-icon" />
|
|
299
314
|
)}
|
|
300
315
|
</Button>
|
|
301
316
|
</div>
|
|
302
317
|
))}
|
|
303
318
|
</div>
|
|
304
319
|
) : (
|
|
305
|
-
<div className="text-b3-foreground-muted py-8 text-center">
|
|
320
|
+
<div className="linked-accounts-empty text-b3-foreground-muted py-8 text-center">
|
|
321
|
+
No linked accounts found
|
|
322
|
+
</div>
|
|
306
323
|
)}
|
|
307
324
|
</div>
|
|
308
325
|
|
|
309
326
|
{showReferralInfo && (
|
|
310
327
|
/* Referral Section */
|
|
311
|
-
<div className="space-y-4">
|
|
312
|
-
<h3 className="text-b3-grey font-neue-montreal-semibold text-xl">Referrals</h3>
|
|
328
|
+
<div className="referrals-section space-y-4">
|
|
329
|
+
<h3 className="referrals-title text-b3-grey font-neue-montreal-semibold text-xl">Referrals</h3>
|
|
313
330
|
|
|
314
331
|
{/* Referral Code */}
|
|
315
|
-
<div className="bg-b3-line rounded-xl p-4">
|
|
332
|
+
<div className="referral-code-container bg-b3-line rounded-xl p-4">
|
|
316
333
|
{isEditingCode && (
|
|
317
|
-
<div>
|
|
318
|
-
<div className="text-b3-grey font-neue-montreal-semibold">Your Referral Code</div>
|
|
319
|
-
<div className="text-b3-foreground-muted font-neue-montreal-medium text-sm">
|
|
334
|
+
<div className="referral-code-header-editing">
|
|
335
|
+
<div className="referral-code-title text-b3-grey font-neue-montreal-semibold">Your Referral Code</div>
|
|
336
|
+
<div className="referral-code-description text-b3-foreground-muted font-neue-montreal-medium text-sm">
|
|
320
337
|
Share this code with friends to earn rewards
|
|
321
338
|
</div>
|
|
322
339
|
</div>
|
|
323
340
|
)}
|
|
324
|
-
<div className="flex items-center justify-between">
|
|
341
|
+
<div className="referral-code-content flex items-center justify-between">
|
|
325
342
|
{!isEditingCode && (
|
|
326
|
-
<div>
|
|
327
|
-
<div className="text-b3-grey font-neue-montreal-semibold">
|
|
328
|
-
|
|
343
|
+
<div className="referral-code-header">
|
|
344
|
+
<div className="referral-code-title text-b3-grey font-neue-montreal-semibold">
|
|
345
|
+
Your Referral Code
|
|
346
|
+
</div>
|
|
347
|
+
<div className="referral-code-description text-b3-foreground-muted font-neue-montreal-medium text-sm">
|
|
329
348
|
Share this code with friends to earn rewards
|
|
330
349
|
</div>
|
|
331
350
|
</div>
|
|
332
351
|
)}
|
|
333
|
-
<div className="flex items-center gap-2">
|
|
352
|
+
<div className="referral-code-actions flex items-center gap-2">
|
|
334
353
|
{isEditingCode ? (
|
|
335
|
-
<div className="flex items-center gap-2">
|
|
354
|
+
<div className="referral-code-edit-form flex items-center gap-2">
|
|
336
355
|
<input
|
|
337
356
|
type="text"
|
|
338
357
|
value={newReferralCode}
|
|
339
358
|
onChange={e => setNewReferralCode(e.target.value)}
|
|
340
|
-
className="rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm"
|
|
359
|
+
className="referral-code-input rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm"
|
|
341
360
|
placeholder="Enter new code"
|
|
342
361
|
ref={referallCodeRef}
|
|
343
362
|
/>
|
|
344
363
|
<Button
|
|
345
364
|
size="sm"
|
|
365
|
+
className="referral-code-save-button"
|
|
346
366
|
onClick={handleUpdateReferralCode}
|
|
347
367
|
disabled={isUpdatingCode || !newReferralCode}
|
|
348
368
|
>
|
|
349
|
-
{isUpdatingCode ?
|
|
369
|
+
{isUpdatingCode ? (
|
|
370
|
+
<Loader2 className="referral-code-save-loading h-4 w-4 animate-spin" />
|
|
371
|
+
) : (
|
|
372
|
+
"Save"
|
|
373
|
+
)}
|
|
350
374
|
</Button>
|
|
351
375
|
<Button
|
|
352
376
|
size="sm"
|
|
353
377
|
variant="ghost"
|
|
378
|
+
className="referral-code-cancel-button"
|
|
354
379
|
onClick={() => {
|
|
355
380
|
setIsEditingCode(false);
|
|
356
381
|
setNewReferralCode("");
|
|
@@ -361,15 +386,21 @@ export function ManageAccount({
|
|
|
361
386
|
</div>
|
|
362
387
|
) : (
|
|
363
388
|
<>
|
|
364
|
-
<div className="rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm">
|
|
389
|
+
<div className="referral-code-display rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm">
|
|
365
390
|
{currentReferralCode}
|
|
366
391
|
</div>
|
|
367
|
-
<Button
|
|
368
|
-
|
|
392
|
+
<Button
|
|
393
|
+
size="icon"
|
|
394
|
+
variant="ghost"
|
|
395
|
+
className="referral-code-copy-button"
|
|
396
|
+
onClick={handleCopyCode}
|
|
397
|
+
>
|
|
398
|
+
<Copy className="referral-code-copy-icon h-4 w-4" />
|
|
369
399
|
</Button>
|
|
370
400
|
<Button
|
|
371
401
|
size="icon"
|
|
372
402
|
variant="ghost"
|
|
403
|
+
className="referral-code-edit-button"
|
|
373
404
|
onClick={() => {
|
|
374
405
|
setIsEditingCode(true);
|
|
375
406
|
setTimeout(() => {
|
|
@@ -377,7 +408,7 @@ export function ManageAccount({
|
|
|
377
408
|
}, 100);
|
|
378
409
|
}}
|
|
379
410
|
>
|
|
380
|
-
<Pencil className="h-4 w-4" />
|
|
411
|
+
<Pencil className="referral-code-edit-icon h-4 w-4" />
|
|
381
412
|
</Button>
|
|
382
413
|
</>
|
|
383
414
|
)}
|
|
@@ -386,67 +417,65 @@ export function ManageAccount({
|
|
|
386
417
|
</div>
|
|
387
418
|
|
|
388
419
|
{/* Referred Users */}
|
|
389
|
-
<div className="bg-b3-line rounded-xl p-4">
|
|
390
|
-
<div className="text-b3-grey font-neue-montreal-semibold mb-4">Referred Users</div>
|
|
420
|
+
<div className="referred-users-container bg-b3-line rounded-xl p-4">
|
|
421
|
+
<div className="referred-users-title text-b3-grey font-neue-montreal-semibold mb-4">Referred Users</div>
|
|
391
422
|
{isLoadingReferrals ? (
|
|
392
|
-
<div className="flex justify-center py-4">
|
|
423
|
+
<div className="referred-users-loading flex justify-center py-4">
|
|
393
424
|
<Loader2 className="h-6 w-6 animate-spin text-gray-400" />
|
|
394
425
|
</div>
|
|
395
426
|
) : referrals?.data?.length ? (
|
|
396
|
-
<div className="space-y-3">
|
|
427
|
+
<div className="referred-users-list space-y-3">
|
|
397
428
|
{referrals.data.map((referral: Referrals) => (
|
|
398
429
|
<div
|
|
399
430
|
key={String(referral._id)}
|
|
400
|
-
className="flex items-center justify-between rounded-lg bg-white p-3"
|
|
431
|
+
className="referred-user-item flex items-center justify-between rounded-lg bg-white p-3"
|
|
401
432
|
>
|
|
402
|
-
<div className="text-sm font-medium">{referral.referreeId}</div>
|
|
403
|
-
<div className="text-sm text-gray-500">
|
|
433
|
+
<div className="referred-user-id text-sm font-medium">{referral.referreeId}</div>
|
|
434
|
+
<div className="referred-user-date text-sm text-gray-500">
|
|
435
|
+
{new Date(referral.createdAt).toLocaleDateString()}
|
|
436
|
+
</div>
|
|
404
437
|
</div>
|
|
405
438
|
))}
|
|
406
439
|
</div>
|
|
407
440
|
) : (
|
|
408
|
-
<div className="py-4 text-center text-gray-500">No referred users yet</div>
|
|
441
|
+
<div className="referred-users-empty py-4 text-center text-gray-500">No referred users yet</div>
|
|
409
442
|
)}
|
|
410
443
|
</div>
|
|
411
444
|
</div>
|
|
412
445
|
)}
|
|
413
446
|
|
|
414
447
|
{/* Additional Settings Sections */}
|
|
415
|
-
<div className="space-y-4">
|
|
416
|
-
<h3 className="text-b3-grey font-neue-montreal-semibold text-xl">
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
448
|
+
<div className="account-preferences-section space-y-4">
|
|
449
|
+
<h3 className="account-preferences-title text-b3-grey font-neue-montreal-semibold text-xl">
|
|
450
|
+
Account Preferences
|
|
451
|
+
</h3>
|
|
452
|
+
<div className="account-preferences-container bg-b3-line rounded-xl p-4">
|
|
453
|
+
<div className="account-preference-item flex items-center justify-between">
|
|
454
|
+
<div className="account-preference-info">
|
|
455
|
+
<div className="account-preference-title text-b3-grey font-neue-montreal-semibold">Dark Mode</div>
|
|
456
|
+
<div className="account-preference-description text-b3-foreground-muted font-neue-montreal-medium text-sm">
|
|
422
457
|
Switch between light and dark theme
|
|
423
458
|
</div>
|
|
424
459
|
</div>
|
|
425
460
|
{/* Theme toggle placeholder - can be implemented later */}
|
|
426
|
-
<div className="bg-b3-primary-wash h-6 w-12 rounded-full"></div>
|
|
461
|
+
<div className="account-preference-toggle theme-toggle-placeholder bg-b3-primary-wash h-6 w-12 rounded-full"></div>
|
|
427
462
|
</div>
|
|
428
463
|
</div>
|
|
429
464
|
</div>
|
|
430
465
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
466
|
+
<button
|
|
467
|
+
className="logout-button logout-section border-b3-line hover:bg-b3-line relative flex w-full items-center justify-center rounded-2xl border p-4 transition-colors"
|
|
468
|
+
onClick={onLogoutEnhanced}
|
|
469
|
+
>
|
|
470
|
+
<span className="logout-text font-neue-montreal-semibold text-b3-grey">Sign out</span>
|
|
471
|
+
<div className="logout-icon-container absolute right-4">
|
|
472
|
+
{logoutLoading ? (
|
|
473
|
+
<Loader2 className="logout-loading animate-spin" size={16} />
|
|
474
|
+
) : (
|
|
475
|
+
<SignOutIcon size={16} className="logout-icon text-b3-grey" />
|
|
476
|
+
)}
|
|
442
477
|
</div>
|
|
443
|
-
|
|
444
|
-
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"
|
|
445
|
-
onClick={onLogoutEnhanced}
|
|
446
|
-
>
|
|
447
|
-
{logoutLoading ? <Loader2 className="animate-spin" /> : <SignOutIcon size={16} className="text-b3-grey" />}
|
|
448
|
-
</button>
|
|
449
|
-
</div>
|
|
478
|
+
</button>
|
|
450
479
|
</div>
|
|
451
480
|
);
|
|
452
481
|
};
|
|
@@ -521,7 +550,7 @@ export function ManageAccount({
|
|
|
521
550
|
</div>
|
|
522
551
|
|
|
523
552
|
<TabsContentPrimitive value="overview" className="px-4 pb-4 pt-2">
|
|
524
|
-
<BalanceContent onLogout={onLogout} partnerId={partnerId} />
|
|
553
|
+
<BalanceContent onLogout={onLogout} partnerId={partnerId} showDeposit={showDeposit} showSwap={showSwap} />
|
|
525
554
|
</TabsContentPrimitive>
|
|
526
555
|
|
|
527
556
|
<TabsContentPrimitive value="tokens" className="px-4 pb-4 pt-2">
|
|
@@ -89,6 +89,10 @@ export interface ManageAccountModalProps extends BaseModalProps {
|
|
|
89
89
|
setActiveTab?: (tab: "overview" | "tokens" | "nfts" | "apps" | "settings") => void;
|
|
90
90
|
/** Whether to show the referral information */
|
|
91
91
|
showReferralInfo?: boolean;
|
|
92
|
+
/** Whether to show the swap button */
|
|
93
|
+
showSwap?: boolean;
|
|
94
|
+
/** Whether to show the deposit button */
|
|
95
|
+
showDeposit?: boolean;
|
|
92
96
|
}
|
|
93
97
|
|
|
94
98
|
/**
|