@b3dotfun/sdk 0.0.26-alpha.6 → 0.0.26-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/cjs/global-account/react/components/B3DynamicModal.js +4 -0
  2. package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.d.ts +2 -0
  3. package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +228 -0
  4. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +56 -3
  5. package/dist/cjs/global-account/react/components/custom/Button.d.ts +1 -1
  6. package/dist/cjs/global-account/react/components/ui/button.d.ts +1 -1
  7. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +20 -1
  8. package/dist/cjs/global-account/react/stores/useModalStore.js +3 -0
  9. package/dist/cjs/global-account/react/utils/profileDisplay.d.ts +21 -0
  10. package/dist/cjs/global-account/react/utils/profileDisplay.js +63 -0
  11. package/dist/esm/global-account/react/components/B3DynamicModal.js +4 -0
  12. package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.d.ts +2 -0
  13. package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +225 -0
  14. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +58 -5
  15. package/dist/esm/global-account/react/components/custom/Button.d.ts +1 -1
  16. package/dist/esm/global-account/react/components/ui/button.d.ts +1 -1
  17. package/dist/esm/global-account/react/stores/useModalStore.d.ts +20 -1
  18. package/dist/esm/global-account/react/stores/useModalStore.js +3 -0
  19. package/dist/esm/global-account/react/utils/profileDisplay.d.ts +21 -0
  20. package/dist/esm/global-account/react/utils/profileDisplay.js +60 -0
  21. package/dist/styles/index.css +1 -1
  22. package/dist/types/global-account/react/components/LinkAccount/LinkAccount.d.ts +2 -0
  23. package/dist/types/global-account/react/components/custom/Button.d.ts +1 -1
  24. package/dist/types/global-account/react/components/ui/button.d.ts +1 -1
  25. package/dist/types/global-account/react/stores/useModalStore.d.ts +20 -1
  26. package/dist/types/global-account/react/utils/profileDisplay.d.ts +21 -0
  27. package/package.json +1 -1
  28. package/src/global-account/react/components/B3DynamicModal.tsx +4 -0
  29. package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +369 -0
  30. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +187 -5
  31. package/src/global-account/react/stores/useModalStore.ts +26 -1
  32. package/src/global-account/react/utils/profileDisplay.ts +87 -0
@@ -0,0 +1,87 @@
1
+ import { type Profile } from "thirdweb/wallets";
2
+
3
+ export interface ExtendedProfileDetails {
4
+ id?: string;
5
+ email?: string;
6
+ phone?: string;
7
+ address?: string;
8
+ name?: string;
9
+ username?: string;
10
+ profileImageUrl?: string;
11
+ }
12
+
13
+ export interface ExtendedProfile extends Omit<Profile, "details"> {
14
+ details: ExtendedProfileDetails;
15
+ }
16
+
17
+ export interface ProfileDisplayInfo {
18
+ title: string;
19
+ subtitle: string;
20
+ imageUrl: string | null;
21
+ initial: string;
22
+ type: Profile["type"];
23
+ }
24
+
25
+ export function getProfileDisplayInfo(profile: ExtendedProfile): ProfileDisplayInfo {
26
+ const { type, details } = profile;
27
+
28
+ // Default display info
29
+ let displayInfo: ProfileDisplayInfo = {
30
+ title: details.email || details.phone || details.address || "Unknown",
31
+ subtitle: `Connected with ${type}`,
32
+ imageUrl: null,
33
+ initial: (type.charAt(0) || "U").toUpperCase(),
34
+ type,
35
+ };
36
+
37
+ // Handle specific providers
38
+ switch (type) {
39
+ case "x":
40
+ displayInfo = {
41
+ title: details.name || details.username || "Unknown",
42
+ subtitle: details.username ? `@${details.username}` : "X Account",
43
+ imageUrl: details.profileImageUrl || null,
44
+ initial: "X",
45
+ type,
46
+ };
47
+ break;
48
+ case "google":
49
+ displayInfo = {
50
+ title: details.name || details.email || "Unknown",
51
+ subtitle: details.email || "Google Account",
52
+ imageUrl: details.profileImageUrl || null,
53
+ initial: "G",
54
+ type,
55
+ };
56
+ break;
57
+ case "discord":
58
+ displayInfo = {
59
+ title: details.username || details.name || "Unknown",
60
+ subtitle: "Discord Account",
61
+ imageUrl: details.profileImageUrl || null,
62
+ initial: "D",
63
+ type,
64
+ };
65
+ break;
66
+ case "email":
67
+ displayInfo = {
68
+ title: details.email || "Unknown",
69
+ subtitle: "Email Account",
70
+ imageUrl: null,
71
+ initial: "E",
72
+ type,
73
+ };
74
+ break;
75
+ case "phone":
76
+ displayInfo = {
77
+ title: details.phone || "Unknown",
78
+ subtitle: "Phone Number",
79
+ imageUrl: null,
80
+ initial: "P",
81
+ type,
82
+ };
83
+ break;
84
+ }
85
+
86
+ return displayInfo;
87
+ }