@@ -4,6 +4,7 @@ import type { ThirdwebClient } from "../../../../../client/client.js";
44import { useUnlinkProfile } from "../../../../../react/web/hooks/wallets/useUnlinkProfile.js" ;
55import { shortenAddress } from "../../../../../utils/address.js" ;
66import type { Profile } from "../../../../../wallets/in-app/core/authentication/types.js" ;
7+ import { getProfileEmail , getProfilePhone , getProfileAddress } from "../../../../../wallets/in-app/core/authentication/types.js" ;
78import { fontSize , iconSize } from "../../../../core/design-system/index.js" ;
89import { useSocialProfiles } from "../../../../core/social/useSocialProfiles.js" ;
910import { getSocialIcon } from "../../../../core/utils/walletIcon.js" ;
@@ -24,18 +25,21 @@ import { MenuButton } from "../MenuButton.js";
2425import type { WalletDetailsModalScreen } from "./types.js" ;
2526
2627function getProfileDisplayName ( profile : Profile ) {
28+ const email = getProfileEmail ( profile ) ;
29+ const phone = getProfilePhone ( profile ) ;
30+ const address = getProfileAddress ( profile ) ;
31+
2732 switch ( true ) {
28- case profile . type === "email" && profile . details . email !== undefined :
29- return profile . details . email ;
30- case profile . type === "google" && profile . details . email !== undefined :
31- return profile . details . email ;
32- case profile . type === "phone" && profile . details . phone !== undefined :
33- return profile . details . phone ;
34- case profile . details . address !== undefined :
35- return shortenAddress ( profile . details . address , 6 ) ;
36- case ( profile . type as string ) === "cognito" &&
37- profile . details . email !== undefined :
38- return profile . details . email ;
33+ case profile . type === "email" && email !== undefined :
34+ return email ;
35+ case profile . type === "google" && email !== undefined :
36+ return email ;
37+ case profile . type === "phone" && phone !== undefined :
38+ return phone ;
39+ case address !== undefined :
40+ return shortenAddress ( address , 6 ) ;
41+ case ( profile . type as string ) === "cognito" && email !== undefined :
42+ return email ;
3943 case ( profile . type as string ) . toLowerCase ( ) === "custom_auth_endpoint" :
4044 return "Custom Profile" ;
4145 default :
@@ -128,8 +132,9 @@ function LinkedProfile({
128132 enableUnlinking : boolean ;
129133 client : ThirdwebClient ;
130134} ) {
135+ const profileAddress = getProfileAddress ( profile ) ;
131136 const { data : socialProfiles } = useSocialProfiles ( {
132- address : profile . details . address ,
137+ address : profileAddress ,
133138 client,
134139 } ) ;
135140 const { mutate : unlinkProfileMutation , isPending } = useUnlinkProfile ( ) ;
@@ -154,7 +159,7 @@ function LinkedProfile({
154159 } }
155160 width = { iconSize . lg }
156161 />
157- ) : profile . details . address !== undefined ? (
162+ ) : profileAddress !== undefined ? (
158163 < Container
159164 style = { {
160165 borderRadius : "100%" ,
@@ -163,7 +168,7 @@ function LinkedProfile({
163168 width : "32px" ,
164169 } }
165170 >
166- < Blobbie address = { profile . details . address } size = { 32 } />
171+ < Blobbie address = { profileAddress } size = { 32 } />
167172 </ Container >
168173 ) : profile . type === "passkey" ? (
169174 < FingerPrintIcon size = { iconSize . lg } />
@@ -202,9 +207,9 @@ function LinkedProfile({
202207 } }
203208 >
204209 { socialProfiles ?. find ( ( p ) => p . avatar ) ?. name &&
205- profile . details . address && (
210+ profileAddress && (
206211 < Text color = "secondaryText" size = "sm" >
207- { shortenAddress ( profile . details . address , 4 ) }
212+ { shortenAddress ( profileAddress , 4 ) }
208213 </ Text >
209214 ) }
210215 { enableUnlinking && (
0 commit comments