@b3dotfun/sdk 0.0.26-alpha.5 → 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.
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +3 -2
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +4 -0
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.d.ts +2 -0
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +228 -0
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +56 -3
- package/dist/cjs/global-account/react/components/custom/Button.d.ts +1 -1
- package/dist/cjs/global-account/react/components/ui/button.d.ts +1 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +20 -1
- package/dist/cjs/global-account/react/stores/useModalStore.js +3 -0
- package/dist/cjs/global-account/react/utils/profileDisplay.d.ts +21 -0
- package/dist/cjs/global-account/react/utils/profileDisplay.js +63 -0
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +1 -0
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +3 -2
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/esm/global-account/react/components/B3DynamicModal.js +4 -0
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.d.ts +2 -0
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +225 -0
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +58 -5
- package/dist/esm/global-account/react/components/custom/Button.d.ts +1 -1
- package/dist/esm/global-account/react/components/ui/button.d.ts +1 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +20 -1
- package/dist/esm/global-account/react/stores/useModalStore.js +3 -0
- package/dist/esm/global-account/react/utils/profileDisplay.d.ts +21 -0
- package/dist/esm/global-account/react/utils/profileDisplay.js +60 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +1 -0
- package/dist/types/global-account/react/components/LinkAccount/LinkAccount.d.ts +2 -0
- package/dist/types/global-account/react/components/custom/Button.d.ts +1 -1
- package/dist/types/global-account/react/components/ui/button.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +20 -1
- package/dist/types/global-account/react/utils/profileDisplay.d.ts +21 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpendCustom.tsx +7 -3
- package/src/anyspend/react/components/AnySpendNFT.tsx +2 -1
- package/src/global-account/react/components/B3DynamicModal.tsx +4 -0
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +369 -0
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +187 -5
- package/src/global-account/react/stores/useModalStore.ts +26 -1
- 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
|
+
}
|