@b3dotfun/sdk 0.0.65-test.1 → 0.0.65-test.4

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 (105) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.js +5 -3
  2. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +1 -1
  3. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +1 -1
  4. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +1 -1
  5. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.d.ts +0 -6
  6. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +5 -3
  7. package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +1 -1
  8. package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +1 -1
  9. package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +1 -0
  10. package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +149 -39
  11. package/dist/cjs/global-account/react/components/B3DynamicModal.js +1 -9
  12. package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +39 -0
  13. package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +37 -0
  14. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +4 -3
  15. package/dist/cjs/global-account/react/components/ManageAccount/HomeActions.js +1 -1
  16. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +1 -1
  17. package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +6 -3
  18. package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.js +1 -1
  19. package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +77 -9
  20. package/dist/cjs/global-account/react/components/ModalHeader/ModalHeader.d.ts +2 -1
  21. package/dist/cjs/global-account/react/components/ModalHeader/ModalHeader.js +2 -2
  22. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +3 -1
  23. package/dist/cjs/global-account/react/components/index.d.ts +1 -2
  24. package/dist/cjs/global-account/react/components/index.js +6 -8
  25. package/dist/cjs/global-account/react/components/ui/drawer.js +1 -1
  26. package/dist/cjs/global-account/react/hooks/useAccountWallet.d.ts +1 -0
  27. package/dist/cjs/global-account/react/hooks/useAccountWallet.js +18 -0
  28. package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +2 -2
  29. package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +2 -2
  30. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +1 -7
  31. package/dist/cjs/shared/constants/chains/supported.d.ts +1 -1
  32. package/dist/cjs/shared/utils/ipfs.js +10 -3
  33. package/dist/esm/anyspend/react/components/AnySpend.js +5 -3
  34. package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -1
  35. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +1 -1
  36. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +1 -1
  37. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.d.ts +0 -6
  38. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +5 -3
  39. package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +1 -1
  40. package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +1 -1
  41. package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +1 -0
  42. package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +151 -41
  43. package/dist/esm/global-account/react/components/B3DynamicModal.js +1 -9
  44. package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +39 -0
  45. package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +34 -0
  46. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +4 -3
  47. package/dist/esm/global-account/react/components/ManageAccount/HomeActions.js +1 -1
  48. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +1 -1
  49. package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +6 -3
  50. package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.js +1 -1
  51. package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +74 -9
  52. package/dist/esm/global-account/react/components/ModalHeader/ModalHeader.d.ts +2 -1
  53. package/dist/esm/global-account/react/components/ModalHeader/ModalHeader.js +2 -2
  54. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +4 -2
  55. package/dist/esm/global-account/react/components/index.d.ts +1 -2
  56. package/dist/esm/global-account/react/components/index.js +3 -4
  57. package/dist/esm/global-account/react/components/ui/drawer.js +1 -1
  58. package/dist/esm/global-account/react/hooks/useAccountWallet.d.ts +1 -0
  59. package/dist/esm/global-account/react/hooks/useAccountWallet.js +17 -0
  60. package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +2 -2
  61. package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +2 -2
  62. package/dist/esm/global-account/react/stores/useModalStore.d.ts +1 -7
  63. package/dist/esm/shared/constants/chains/supported.d.ts +1 -1
  64. package/dist/esm/shared/utils/ipfs.js +10 -3
  65. package/dist/styles/index.css +1 -1
  66. package/dist/types/anyspend/react/components/common/CryptoPaymentMethod.d.ts +0 -6
  67. package/dist/types/anyspend/react/hooks/useSigMint.d.ts +1 -1
  68. package/dist/types/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +1 -0
  69. package/dist/types/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +39 -0
  70. package/dist/types/global-account/react/components/ModalHeader/ModalHeader.d.ts +2 -1
  71. package/dist/types/global-account/react/components/index.d.ts +1 -2
  72. package/dist/types/global-account/react/hooks/useAccountWallet.d.ts +1 -0
  73. package/dist/types/global-account/react/hooks/useAuthentication.d.ts +2 -2
  74. package/dist/types/global-account/react/hooks/useUserQuery.d.ts +2 -2
  75. package/dist/types/global-account/react/stores/useModalStore.d.ts +1 -7
  76. package/dist/types/shared/constants/chains/supported.d.ts +1 -1
  77. package/package.json +2 -1
  78. package/src/anyspend/react/components/AnySpend.tsx +5 -4
  79. package/src/anyspend/react/components/AnySpendCustom.tsx +0 -2
  80. package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +0 -2
  81. package/src/anyspend/react/components/AnyspendDepositHype.tsx +0 -2
  82. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +7 -14
  83. package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +1 -1
  84. package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +251 -79
  85. package/src/global-account/react/components/B3DynamicModal.tsx +3 -11
  86. package/src/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.tsx +84 -0
  87. package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +4 -7
  88. package/src/global-account/react/components/ManageAccount/HomeActions.tsx +1 -1
  89. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +2 -2
  90. package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +14 -11
  91. package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +1 -1
  92. package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +129 -23
  93. package/src/global-account/react/components/ModalHeader/ModalHeader.tsx +16 -8
  94. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +11 -7
  95. package/src/global-account/react/components/index.ts +3 -4
  96. package/src/global-account/react/components/ui/drawer.tsx +1 -1
  97. package/src/global-account/react/hooks/useAccountWallet.tsx +26 -0
  98. package/src/global-account/react/stores/useModalStore.ts +1 -9
  99. package/src/shared/utils/ipfs.ts +10 -3
  100. package/dist/cjs/global-account/react/components/ProfileEditor/ProfileEditor.d.ts +0 -6
  101. package/dist/cjs/global-account/react/components/ProfileEditor/ProfileEditor.js +0 -141
  102. package/dist/esm/global-account/react/components/ProfileEditor/ProfileEditor.d.ts +0 -6
  103. package/dist/esm/global-account/react/components/ProfileEditor/ProfileEditor.js +0 -135
  104. package/dist/types/global-account/react/components/ProfileEditor/ProfileEditor.d.ts +0 -6
  105. package/src/global-account/react/components/ProfileEditor/ProfileEditor.tsx +0 -265
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useAccountWallet } from "../../../../global-account/react/index.js";
4
+ import { useAccountWalletImage } from "../../../../global-account/react/hooks/useAccountWallet.js";
4
5
  import { cn } from "../../../../shared/utils/cn.js";
5
6
  import { shortenAddress } from "../../../../shared/utils/formatAddress.js";
6
7
  import { client } from "../../../../shared/utils/thirdweb.js";
@@ -21,7 +22,7 @@ export var CryptoPaymentMethodType;
21
22
  CryptoPaymentMethodType["TRANSFER_CRYPTO"] = "transfer_crypto";
22
23
  })(CryptoPaymentMethodType || (CryptoPaymentMethodType = {}));
23
24
  export function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentMethod, isCreatingOrder, onBack, onSelectPaymentMethod, }) {
24
- const { wallet: globalWallet, connectedEOAWallet: connectedEOAWallet, connectedSmartWallet: connectedSmartWallet, } = useAccountWallet();
25
+ const { connectedEOAWallet: connectedEOAWallet, connectedSmartWallet: connectedSmartWallet } = useAccountWallet();
25
26
  const { connector, address } = useAccount();
26
27
  const { connect, connectors, isPending } = useConnect();
27
28
  const { disconnect } = useDisconnect();
@@ -31,6 +32,7 @@ export function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentM
31
32
  const { data: eoaWalletInfo } = useWalletInfo(connectedEOAWallet?.id);
32
33
  const isConnected = !!connectedEOAWallet;
33
34
  const globalAddress = connectedSmartWallet?.getAccount()?.address;
35
+ const walletImage = useAccountWalletImage();
34
36
  // Use custom hook to determine wallet display logic
35
37
  const { shouldShowConnectedEOA, shouldShowWagmiWallet } = useConnectedWalletDisplay(selectedPaymentMethod);
36
38
  // Map wagmi connector names to thirdweb wallet IDs
@@ -156,7 +158,7 @@ export function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentM
156
158
  }
157
159
  }
158
160
  };
159
- return (_jsxs("div", { className: "crypto-payment-method mx-auto h-fit w-[460px] max-w-full px-5 pb-5", children: [_jsxs("div", { className: cn("relative flex flex-col gap-10"), children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary absolute flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsx("div", { className: "flex items-center justify-around gap-4", children: _jsx("div", { className: "flex-1 text-center", children: _jsx("h2", { className: "text-as-primary text-lg font-semibold", children: "Select a payment method" }) }) }), _jsxs("div", { className: "crypto-payment-methods flex flex-col gap-4", children: [(shouldShowConnectedEOA || shouldShowWagmiWallet || globalAddress) && (_jsxs("div", { className: "installed-wallets", children: [_jsx("h3", { className: "text-as-primary/80 mb-3 text-sm font-medium", children: "Connected wallets" }), _jsxs("div", { className: "space-y-2", children: [shouldShowConnectedEOA && (_jsx("button", { onClick: () => {
161
+ return (_jsxs("div", { className: "crypto-payment-method mx-auto h-fit w-[460px] max-w-full px-5 pb-5 pt-5 sm:px-0 sm:pt-5", children: [_jsxs("div", { className: cn("relative flex flex-col gap-10"), children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary absolute flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsx("div", { className: "flex items-center justify-around gap-4", children: _jsx("div", { className: "flex-1 text-center", children: _jsx("h2", { className: "text-as-primary text-lg font-semibold", children: "Select a payment method" }) }) }), _jsxs("div", { className: "crypto-payment-methods flex flex-col gap-4", children: [(shouldShowConnectedEOA || shouldShowWagmiWallet || globalAddress) && (_jsxs("div", { className: "installed-wallets", children: [_jsx("h3", { className: "text-as-primary/80 mb-3 text-sm font-medium", children: "Connected wallets" }), _jsxs("div", { className: "space-y-2", children: [shouldShowConnectedEOA && (_jsx("button", { onClick: () => {
160
162
  setSelectedPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
161
163
  onSelectPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
162
164
  if (connectedEOAWallet) {
@@ -198,7 +200,7 @@ export function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentM
198
200
  toast.success("Selected B3 Account");
199
201
  }, className: cn("crypto-payment-method-global-wallet w-full rounded-xl border p-4 text-left transition-all hover:shadow-md", selectedPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
200
202
  ? "connected-wallet border-as-brand bg-as-brand/5"
201
- : "border-as-border-secondary bg-as-surface-primary hover:border-as-secondary/80"), children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-3", children: [globalWallet?.meta?.icon ? (_jsx("img", { src: globalWallet.meta.icon, alt: "Global Account", className: "h-10 w-10 rounded-full" })) : (_jsx("div", { className: "wallet-icon flex h-10 w-10 items-center justify-center rounded-full bg-purple-100", children: _jsx(Wallet, { className: "h-5 w-5 text-purple-600" }) })), _jsxs("div", { className: "flex flex-col", children: [_jsx("span", { className: "text-as-primary font-semibold", children: "Global Account" }), _jsx("span", { className: "text-as-primary/60 text-sm", children: shortenAddress(globalAddress || "") })] })] }), _jsx("div", { className: "flex items-center gap-2", children: selectedPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET && (_jsx("div", { className: "h-2 w-2 rounded-full bg-green-500" })) })] }) }))] })] })), _jsxs("div", { className: "other-payment-methods", children: [_jsx("h3", { className: "text-as-primary/80 mb-3 text-sm font-medium", children: "Payment methods" }), _jsxs("div", { className: "space-y-3", children: [_jsxs("button", { onClick: () => {
203
+ : "border-as-border-secondary bg-as-surface-primary hover:border-as-secondary/80"), children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-3", children: [walletImage ? (_jsx("img", { src: walletImage, alt: "Global Account", className: "h-10 w-10 rounded-full" })) : (_jsx("div", { className: "wallet-icon flex h-10 w-10 items-center justify-center rounded-full bg-purple-100", children: _jsx(Wallet, { className: "h-5 w-5 text-purple-600" }) })), _jsxs("div", { className: "flex flex-col", children: [_jsx("span", { className: "text-as-primary font-semibold", children: "Global Account" }), _jsx("span", { className: "text-as-primary/60 text-sm", children: shortenAddress(globalAddress || "") })] })] }), _jsx("div", { className: "flex items-center gap-2", children: selectedPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET && (_jsx("div", { className: "h-2 w-2 rounded-full bg-green-500" })) })] }) }))] })] })), _jsxs("div", { className: "other-payment-methods", children: [_jsx("h3", { className: "text-as-primary/80 mb-3 text-sm font-medium", children: "Payment methods" }), _jsxs("div", { className: "space-y-3", children: [_jsxs("button", { onClick: () => {
202
204
  // Always show wallet selection modal first
203
205
  setShowWalletModal(true);
204
206
  }, className: "crypto-payment-method-connect-wallet bg-as-surface-primary border-as-border-secondary hover:border-as-secondary/80 group flex w-full items-center justify-between gap-4 rounded-xl border px-4 py-3.5 transition-all duration-200 hover:shadow-md", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "wallet-icon flex h-8 w-8 items-center justify-center rounded-full bg-blue-100", children: _jsx(Wallet, { className: "h-4 w-4 text-blue-600" }) }), _jsx("div", { className: "flex flex-col items-start text-left", children: _jsx("h4", { className: "text-as-primary font-semibold", children: "Connect wallet" }) })] }), _jsx(ChevronRightCircle, { className: "text-as-primary/40 group-hover:text-as-primary/60 h-5 w-5 transition-colors" })] }), _jsxs("button", { onClick: () => {
@@ -82,7 +82,7 @@ function PanelOnrampPaymentInner(props) {
82
82
  toast.error("Failed to create order: " + err.message);
83
83
  }
84
84
  };
85
- return (_jsxs("div", { className: "mx-auto flex w-full max-w-[460px] flex-col gap-6 px-5", children: [_jsxs(_Fragment, { children: [_jsx("h2", { className: "-mb-3 text-lg font-semibold", children: "Order summary" }), _jsxs("div", { className: "bg-b3-react-background border-b3-react-border flex flex-col gap-3 rounded-lg border p-4", children: [recipientAddress && (_jsxs(motion.div, { initial: false, animate: {
85
+ return (_jsxs("div", { className: "mx-auto flex w-full max-w-[460px] flex-col gap-6 px-5 pt-5", children: [_jsxs(_Fragment, { children: [_jsx("h2", { className: "-mb-3 text-lg font-semibold", children: "Order summary" }), _jsxs("div", { className: "bg-b3-react-background border-b3-react-border flex flex-col gap-3 rounded-lg border p-4", children: [recipientAddress && (_jsxs(motion.div, { initial: false, animate: {
86
86
  opacity: 1,
87
87
  y: 0,
88
88
  filter: "blur(0px)",
@@ -48,8 +48,8 @@ export declare const useGenerateSigMintData: ({ recipientAddress, contractAddres
48
48
  creatorMap?: {} | undefined;
49
49
  chainId: number;
50
50
  address: string;
51
- title: string;
52
51
  _id: string | {};
52
+ title: string;
53
53
  };
54
54
  } | null;
55
55
  error: Error | null;
@@ -1,3 +1,4 @@
1
+ import "react-easy-crop/react-easy-crop.css";
1
2
  interface AvatarEditorProps {
2
3
  onSetAvatar?: () => void;
3
4
  className?: string;
@@ -1,13 +1,15 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import app from "../../../../global-account/app.js";
4
- import { Button, useB3, useProfile } from "../../../../global-account/react/index.js";
4
+ import { Button, IPFSMediaRenderer, useB3, useProfile } from "../../../../global-account/react/index.js";
5
+ import { validateImageUrl } from "../../../../global-account/react/utils/profileDisplay.js";
5
6
  import { cn } from "../../../../shared/utils/cn.js";
6
7
  import { debugB3React } from "../../../../shared/utils/debug.js";
7
- import { getIpfsUrl } from "../../../../shared/utils/ipfs.js";
8
8
  import { client } from "../../../../shared/utils/thirdweb.js";
9
9
  import { Loader2, Upload, X } from "lucide-react";
10
- import { useRef, useState } from "react";
10
+ import { useCallback, useRef, useState } from "react";
11
+ import Cropper from "react-easy-crop";
12
+ import "react-easy-crop/react-easy-crop.css";
11
13
  import { toast } from "sonner";
12
14
  import { useActiveAccount } from "thirdweb/react";
13
15
  import { upload } from "thirdweb/storage";
@@ -15,19 +17,29 @@ import { useProfileSettings } from "../../hooks/useProfile.js";
15
17
  import { useModalStore } from "../../stores/index.js";
16
18
  import ModalHeader from "../ModalHeader/ModalHeader.js";
17
19
  const debug = debugB3React("AvatarEditor");
20
+ // Helper function to create an image element from a URL
21
+ const createImage = (url) => new Promise((resolve, reject) => {
22
+ const image = new Image();
23
+ image.addEventListener("load", () => resolve(image));
24
+ image.addEventListener("error", error => reject(error));
25
+ image.setAttribute("crossOrigin", "anonymous");
26
+ image.src = url;
27
+ });
18
28
  export function AvatarEditor({ onSetAvatar, className }) {
19
29
  const [viewStep, setViewStep] = useState("select");
20
30
  const [selectedAvatar, setSelectedAvatar] = useState(null);
31
+ const [selectedProfileType, setSelectedProfileType] = useState(null); // Track which profile was selected
21
32
  const [hoveredProfile, setHoveredProfile] = useState(null);
22
33
  const [selectedFile, setSelectedFile] = useState(null);
23
34
  const [previewUrl, setPreviewUrl] = useState(null);
24
- const [isUploading, setIsUploading] = useState(false);
25
35
  const [isSaving, setIsSaving] = useState(false);
26
36
  const [isDragging, setIsDragging] = useState(false);
37
+ const [crop, setCrop] = useState({ x: 0, y: 0 });
38
+ const [zoom, setZoom] = useState(1);
39
+ const [croppedAreaPixels, setCroppedAreaPixels] = useState(null);
27
40
  const fileInputRef = useRef(null);
28
41
  const { setUser, user, partnerId } = useB3();
29
42
  const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
30
- const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
31
43
  const contentType = useModalStore(state => state.contentType);
32
44
  const { setPreference } = useProfileSettings();
33
45
  const account = useActiveAccount();
@@ -35,11 +47,36 @@ export function AvatarEditor({ onSetAvatar, className }) {
35
47
  address: account?.address,
36
48
  fresh: true,
37
49
  });
38
- const currentAvatar = user?.avatar
39
- ? getIpfsUrl(user?.avatar)
40
- : profile?.avatar
41
- ? getIpfsUrl(profile.avatar)
42
- : undefined;
50
+ // Get raw avatar URLs, convert IPFS URLs, and validate them
51
+ const rawCurrentAvatar = user?.avatar || profile?.avatar;
52
+ const currentAvatar = validateImageUrl(rawCurrentAvatar);
53
+ const safePreviewUrl = validateImageUrl(previewUrl);
54
+ const onCropComplete = useCallback((_croppedArea, croppedAreaPixels) => {
55
+ setCroppedAreaPixels(croppedAreaPixels);
56
+ }, []);
57
+ const createCroppedImage = async (imageSrc, pixelCrop) => {
58
+ const image = await createImage(imageSrc);
59
+ const canvas = document.createElement("canvas");
60
+ const ctx = canvas.getContext("2d");
61
+ if (!ctx) {
62
+ throw new Error("Failed to get canvas context");
63
+ }
64
+ // Set canvas size to the crop area
65
+ canvas.width = pixelCrop.width;
66
+ canvas.height = pixelCrop.height;
67
+ // Draw the cropped image
68
+ ctx.drawImage(image, pixelCrop.x, pixelCrop.y, pixelCrop.width, pixelCrop.height, 0, 0, pixelCrop.width, pixelCrop.height);
69
+ // Return as blob
70
+ return new Promise((resolve, reject) => {
71
+ canvas.toBlob(blob => {
72
+ if (!blob) {
73
+ reject(new Error("Canvas is empty"));
74
+ return;
75
+ }
76
+ resolve(blob);
77
+ }, "image/jpeg");
78
+ });
79
+ };
43
80
  const handleFileSelect = (event) => {
44
81
  const file = event.target.files?.[0];
45
82
  if (file) {
@@ -54,6 +91,8 @@ export function AvatarEditor({ onSetAvatar, className }) {
54
91
  return;
55
92
  }
56
93
  setSelectedFile(file);
94
+ // Clear profile type selection when uploading a new file
95
+ setSelectedProfileType(null);
57
96
  // Create preview URL
58
97
  const url = URL.createObjectURL(file);
59
98
  setPreviewUrl(url);
@@ -62,6 +101,7 @@ export function AvatarEditor({ onSetAvatar, className }) {
62
101
  };
63
102
  const handleRemovePreview = () => {
64
103
  setSelectedAvatar(currentAvatar || null);
104
+ setSelectedProfileType(null);
65
105
  setSelectedFile(null);
66
106
  if (previewUrl) {
67
107
  URL.revokeObjectURL(previewUrl);
@@ -70,6 +110,10 @@ export function AvatarEditor({ onSetAvatar, className }) {
70
110
  if (fileInputRef.current) {
71
111
  fileInputRef.current.value = "";
72
112
  }
113
+ // Reset crop state
114
+ setCrop({ x: 0, y: 0 });
115
+ setZoom(1);
116
+ setCroppedAreaPixels(null);
73
117
  };
74
118
  const handleSaveChanges = async () => {
75
119
  if (!account?.address) {
@@ -78,13 +122,65 @@ export function AvatarEditor({ onSetAvatar, className }) {
78
122
  }
79
123
  setIsSaving(true);
80
124
  try {
81
- // If user uploaded a new file
82
- if (selectedFile) {
83
- debug("Starting upload to IPFS", selectedFile);
125
+ let fileToUpload = null;
126
+ // If user uploaded a new file and cropped it
127
+ if (selectedFile && previewUrl && croppedAreaPixels) {
128
+ try {
129
+ const croppedBlob = await createCroppedImage(previewUrl, croppedAreaPixels);
130
+ const extension = selectedFile.name.split(".").pop() || "jpg";
131
+ fileToUpload = new File([croppedBlob], `avatar-cropped.${extension}`, { type: "image/jpeg" });
132
+ }
133
+ catch (error) {
134
+ debug("Error cropping image:", error);
135
+ toast.error("Failed to crop image. Please try again.");
136
+ setIsSaving(false);
137
+ return;
138
+ }
139
+ }
140
+ else if (selectedFile) {
141
+ // Fallback if no crop was made
142
+ fileToUpload = selectedFile;
143
+ }
144
+ else if (selectedProfileType && selectedAvatar) {
145
+ // User selected from existing profile avatars
146
+ // Fetch the image from the URL and convert to blob
147
+ debug("Fetching image from social profile:", selectedAvatar);
148
+ try {
149
+ const response = await fetch(selectedAvatar);
150
+ if (!response.ok) {
151
+ throw new Error("Failed to fetch image");
152
+ }
153
+ const blob = await response.blob();
154
+ debug("Fetched blob with type:", blob.type);
155
+ // Determine the correct extension from the blob's MIME type
156
+ // This handles URLs without extensions (like Farcaster images)
157
+ const mimeToExtension = {
158
+ "image/jpeg": "jpg",
159
+ "image/jpg": "jpg",
160
+ "image/png": "png",
161
+ "image/gif": "gif",
162
+ "image/webp": "webp",
163
+ "image/svg+xml": "svg",
164
+ };
165
+ const extension = blob.type ? mimeToExtension[blob.type.toLowerCase()] || "jpg" : "jpg";
166
+ const mimeType = blob.type || `image/${extension}`;
167
+ fileToUpload = new File([blob], `avatar-${selectedProfileType}.${extension}`, { type: mimeType });
168
+ debug("Successfully converted social profile image to file with extension:", extension);
169
+ }
170
+ catch (fetchError) {
171
+ debug("Error fetching social profile image:", fetchError);
172
+ toast.error("Failed to fetch profile image. Please try uploading manually.");
173
+ setIsSaving(false);
174
+ return;
175
+ }
176
+ }
177
+ // Upload to IPFS if we have a file
178
+ if (fileToUpload) {
179
+ debug("Starting upload to IPFS", fileToUpload);
84
180
  // Upload to IPFS using Thirdweb
85
181
  const ipfsUrl = await upload({
86
182
  client,
87
- files: [selectedFile],
183
+ files: [fileToUpload],
88
184
  });
89
185
  debug("Upload successful", ipfsUrl);
90
186
  // Save avatar URL using profiles service
@@ -98,21 +194,6 @@ export function AvatarEditor({ onSetAvatar, className }) {
98
194
  setUser(user);
99
195
  toast.success("Looks great! Your avatar has been saved!");
100
196
  }
101
- else if (selectedAvatar && selectedAvatar !== currentAvatar) {
102
- // User selected from existing profile avatars
103
- // Find the profile that matches the selected avatar
104
- const selectedProfile = profile?.profiles?.find(p => p.avatar === selectedAvatar);
105
- if (selectedProfile && selectedProfile.type) {
106
- debug("Setting profile preference to:", selectedProfile.type);
107
- // Set preference for this profile type
108
- await setPreference(account.address, selectedProfile.type, account.address, async (message) => {
109
- // Sign the message using the active account
110
- const signature = await account.signMessage({ message });
111
- return signature;
112
- });
113
- toast.success("Avatar updated successfully!");
114
- }
115
- }
116
197
  // Refresh profile to get updated avatar
117
198
  await refreshProfile();
118
199
  onSetAvatar?.();
@@ -138,8 +219,15 @@ export function AvatarEditor({ onSetAvatar, className }) {
138
219
  });
139
220
  }
140
221
  };
141
- const handleProfileAvatarSelect = (avatarUrl) => {
222
+ const handleProfileAvatarSelect = (avatarUrl, profileType) => {
142
223
  setSelectedAvatar(avatarUrl);
224
+ setSelectedProfileType(profileType);
225
+ // Clear any selected file since we're selecting from profile
226
+ setSelectedFile(null);
227
+ if (previewUrl) {
228
+ URL.revokeObjectURL(previewUrl);
229
+ setPreviewUrl(null);
230
+ }
143
231
  };
144
232
  const handleUploadImageClick = () => {
145
233
  setViewStep("upload");
@@ -178,6 +266,8 @@ export function AvatarEditor({ onSetAvatar, className }) {
178
266
  return;
179
267
  }
180
268
  setSelectedFile(file);
269
+ // Clear profile type selection when uploading a new file
270
+ setSelectedProfileType(null);
181
271
  // Create preview URL
182
272
  const url = URL.createObjectURL(file);
183
273
  setPreviewUrl(url);
@@ -191,18 +281,38 @@ export function AvatarEditor({ onSetAvatar, className }) {
191
281
  partnerId: partnerId,
192
282
  });
193
283
  };
194
- const isLoading = isUploading || isSaving;
195
- // Get profile avatars
284
+ const isLoading = isSaving;
285
+ // Get profile avatars with validated URLs
196
286
  const profileAvatars = profile?.profiles
197
287
  ?.filter(p => p.avatar)
198
- .map(p => ({
199
- type: p.type,
200
- avatar: getIpfsUrl(p?.avatar || ""),
201
- name: p.name || p.type,
202
- })) || [];
203
- return (_jsxs("div", { className: cn("flex w-full max-w-md flex-col bg-white", className), children: [viewStep === "upload" && _jsx(ModalHeader, { title: "Upload Image" }), _jsxs("div", { className: "flex flex-col items-center p-6", children: [viewStep === "select" ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "relative mb-6", children: [_jsx("div", { className: "h-32 w-32 overflow-hidden rounded-full", children: _jsx("img", { src: selectedAvatar || currentAvatar || "https://via.placeholder.com/128", alt: "Avatar preview", className: "h-full w-full object-cover" }) }), selectedAvatar && (_jsx("button", { onClick: handleRemovePreview, className: "absolute -right-1 -top-1 flex h-8 w-8 items-center justify-center rounded-full bg-[#51525c] text-white transition-colors hover:bg-[#71717a]", children: _jsx(X, { className: "h-4 w-4" }) }))] }), _jsxs("button", { onClick: handleUploadImageClick, className: "font-inter shadow-xs mb-6 flex w-full items-center justify-center gap-2 rounded-xl border border-[#e4e4e7] bg-white px-4 py-3 text-sm font-semibold text-[#18181b] transition-colors hover:bg-[#f4f4f5]", children: [_jsx(Upload, { className: "h-4 w-4" }), "Upload image"] }), _jsxs("div", { className: "w-full", children: [_jsx("h3", { className: "mb-2 text-base font-semibold text-[#18181b]", children: "Select your profile image" }), _jsx("p", { className: "mb-4 text-sm font-semibold text-[#475467]", children: "Pick an avatar from your linked profiles, ENS or upload a new one." }), _jsx("div", { className: "mb-4 flex gap-3", children: profileAvatars.map((profileAvatar, index) => (_jsxs("div", { className: "relative", onMouseEnter: () => setHoveredProfile(profileAvatar.type), onMouseLeave: () => setHoveredProfile(null), children: [_jsx("button", { onClick: () => handleProfileAvatarSelect(profileAvatar.avatar), className: cn("h-16 w-16 overflow-hidden rounded-full border-2 transition-all", selectedAvatar === profileAvatar.avatar
204
- ? "border-[#3368ef] ring-2 ring-[#3368ef]/20"
205
- : "border-transparent hover:border-[#e4e4e7]"), children: _jsx("img", { src: profileAvatar.avatar, alt: `${profileAvatar.type} avatar`, className: "h-full w-full object-cover" }) }), hoveredProfile === profileAvatar.type && (_jsx("div", { className: "absolute -top-10 left-1/2 -translate-x-1/2 whitespace-nowrap rounded-md bg-[#18181b] px-3 py-1.5 text-xs text-white", children: profileAvatar.name }))] }, index))) }), _jsxs("button", { onClick: handleLinkMoreAccount, className: "font-inter flex items-center gap-2 text-sm font-semibold text-[#3368ef] hover:underline", children: [_jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "h-4 w-4", children: _jsx("path", { d: "M8.75 2.75C8.75 2.33579 8.41421 2 8 2C7.58579 2 7.25 2.33579 7.25 2.75V7.25H2.75C2.33579 7.25 2 7.58579 2 8C2 8.41421 2.33579 8.75 2.75 8.75H7.25V13.25C7.25 13.6642 7.58579 14 8 14C8.41421 14 8.75 13.6642 8.75 13.25V8.75H13.25C13.6642 8.75 14 8.41421 14 8C14 7.58579 13.6642 7.25 13.25 7.25H8.75V2.75Z", fill: "currentColor" }) }), "Link more account"] })] })] })) : (_jsx(_Fragment, { children: !selectedFile ? (_jsxs("div", { onClick: handleOpenFilePicker, onDragEnter: handleDragEnter, onDragLeave: handleDragLeave, onDragOver: handleDragOver, onDrop: handleDrop, className: cn("mb-6 flex w-full cursor-pointer flex-col items-center justify-center rounded-xl border-2 border-dashed p-16 transition-colors", isDragging
288
+ .map(p => {
289
+ const rawAvatarUrl = p?.avatar || "";
290
+ const validatedUrl = validateImageUrl(rawAvatarUrl);
291
+ return {
292
+ type: p.type,
293
+ avatar: validatedUrl,
294
+ name: p.name || p.type,
295
+ };
296
+ })
297
+ .filter(p => p.avatar !== null) || []; // Filter out profiles with invalid avatars
298
+ return (_jsxs("div", { className: cn("flex w-full max-w-md flex-col bg-white", className), children: [viewStep === "upload" && _jsx(ModalHeader, { title: "Upload Image" }), _jsxs("div", { className: "flex flex-col items-center p-6", children: [viewStep === "select" ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "relative mb-6", children: [_jsx("div", { className: "h-32 w-32 overflow-hidden rounded-full", children: safePreviewUrl || selectedAvatar || currentAvatar ? (_jsx(IPFSMediaRenderer, { src: safePreviewUrl || selectedAvatar || currentAvatar || "", alt: "Avatar preview", className: "h-full w-full object-cover" })) : (_jsx("div", { className: "bg-b3-primary-wash h-full w-full" })) }), (selectedAvatar !== currentAvatar || selectedFile) && (_jsx("button", { onClick: handleRemovePreview, className: "absolute -right-1 -top-1 flex h-8 w-8 items-center justify-center rounded-full bg-[#51525c] text-white transition-colors hover:bg-[#71717a]", children: _jsx(X, { className: "h-4 w-4" }) }))] }), _jsxs("button", { onClick: handleUploadImageClick, className: "font-inter mb-6 flex w-full items-center justify-center gap-2 rounded-xl border border-[#e4e4e7] bg-white px-4 py-3 text-sm font-semibold text-[#18181b] shadow-sm transition-colors hover:bg-[#f4f4f5]", children: [_jsx(Upload, { className: "h-4 w-4" }), "Upload image"] }), _jsxs("div", { className: "w-full", children: [_jsx("h3", { className: "mb-2 text-base font-semibold text-[#18181b]", children: "Select your profile image" }), _jsx("p", { className: "mb-4 text-sm font-semibold text-[#475467]", children: "Pick an avatar from your linked profiles, ENS or upload a new one." }), _jsx("div", { className: "mb-4 flex gap-3", children: profileAvatars.map((profileAvatar, index) => {
299
+ // Skip if avatar is null (should not happen due to filter, but TypeScript doesn't know that)
300
+ if (!profileAvatar.avatar)
301
+ return null;
302
+ return (_jsxs("div", { className: "relative", onMouseEnter: () => setHoveredProfile(profileAvatar.type), onMouseLeave: () => setHoveredProfile(null), children: [_jsx("button", { onClick: () => handleProfileAvatarSelect(profileAvatar.avatar || "", profileAvatar.type || ""), className: cn("h-16 w-16 overflow-hidden rounded-full border-2 transition-all", selectedProfileType === profileAvatar.type
303
+ ? "border-[#3368ef] ring-2 ring-[#3368ef]/20"
304
+ : "border-transparent hover:border-[#e4e4e7]"), children: _jsx("img", { src: profileAvatar.avatar, alt: `${profileAvatar.type} avatar`, className: "h-full w-full object-cover" }) }), hoveredProfile === profileAvatar.type && (_jsx("div", { className: "absolute -top-10 left-1/2 -translate-x-1/2 whitespace-nowrap rounded-md bg-[#18181b] px-3 py-1.5 text-xs text-white", children: profileAvatar.name }))] }, index));
305
+ }) }), _jsxs("button", { onClick: handleLinkMoreAccount, className: "font-inter flex items-center gap-2 text-sm font-semibold text-[#3368ef] hover:underline", children: [_jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "h-4 w-4", children: _jsx("path", { d: "M8.75 2.75C8.75 2.33579 8.41421 2 8 2C7.58579 2 7.25 2.33579 7.25 2.75V7.25H2.75C2.33579 7.25 2 7.58579 2 8C2 8.41421 2.33579 8.75 2.75 8.75H7.25V13.25C7.25 13.6642 7.58579 14 8 14C8.41421 14 8.75 13.6642 8.75 13.25V8.75H13.25C13.6642 8.75 14 8.41421 14 8C14 7.58579 13.6642 7.25 13.25 7.25H8.75V2.75Z", fill: "currentColor" }) }), "Link more account"] })] })] })) : (_jsx(_Fragment, { children: !selectedFile ? (_jsxs("div", { onClick: handleOpenFilePicker, onDragEnter: handleDragEnter, onDragLeave: handleDragLeave, onDragOver: handleDragOver, onDrop: handleDrop, className: cn("mb-6 flex w-full cursor-pointer flex-col items-center justify-center rounded-xl border-2 border-dashed p-16 transition-colors", isDragging
206
306
  ? "border-[#3368ef] bg-[#f0f5ff]"
207
- : "border-[#e4e4e7] hover:border-[#3368ef] hover:bg-[#f0f5ff]"), children: [_jsxs("p", { className: "font-inter mb-1 text-sm", children: [_jsx("span", { className: "font-semibold text-[#3368ef]", children: "Click to upload" }), _jsx("span", { className: "text-[#71717a]", children: " or drag and drop" })] }), _jsx("p", { className: "text-xs text-[#71717a]", children: "PNG, JPG or GIF (up to 5MB)" })] })) : (_jsx("div", { className: "mb-6 w-full", children: _jsx("div", { className: "aspect-square w-full overflow-hidden rounded-xl bg-[#f4f4f5]", children: _jsx("img", { src: previewUrl || "", alt: "Preview", className: "h-full w-full object-cover" }) }) })) })), _jsx("input", { ref: fileInputRef, type: "file", accept: "image/*", onChange: handleFileSelect, className: "hidden" })] }), _jsxs("div", { className: "font-inter flex gap-3 border-t border-[#e4e4e7] p-6 font-semibold", children: [_jsx(Button, { onClick: handleCancel, variant: "outline", disabled: isLoading, className: "flex-1 rounded-xl border-[#e4e4e7] text-[#18181b] hover:bg-[#f4f4f5]", children: "Cancel" }), _jsx(Button, { onClick: handleSaveChanges, disabled: isLoading || !selectedAvatar, className: "flex-1 rounded-xl bg-[#3368ef] text-white hover:bg-[#2952cc]", children: isLoading ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), "Saving..."] })) : ("Save changes") })] })] }));
307
+ : "border-[#e4e4e7] hover:border-[#3368ef] hover:bg-[#f0f5ff]"), children: [_jsxs("p", { className: "font-inter mb-1 text-sm", children: [_jsx("span", { className: "font-semibold text-[#3368ef]", children: "Click to upload" }), _jsx("span", { className: "text-[#71717a]", children: " or drag and drop" })] }), _jsx("p", { className: "text-xs text-[#71717a]", children: "PNG, JPG or GIF (up to 5MB)" })] })) : (_jsxs("div", { className: "mb-6 w-full", children: [_jsx("div", { className: "relative aspect-square w-full overflow-hidden rounded-xl bg-[#f4f4f5]", children: safePreviewUrl ? (_jsxs(_Fragment, { children: [_jsx(Cropper, { image: safePreviewUrl, crop: crop, zoom: zoom, aspect: 1, onCropChange: setCrop, onCropComplete: onCropComplete, onZoomChange: setZoom, cropShape: "rect", showGrid: false, style: {
308
+ containerStyle: {
309
+ width: "100%",
310
+ height: "100%",
311
+ backgroundColor: "#f4f4f5",
312
+ },
313
+ cropAreaStyle: {
314
+ border: "2px solid #3368ef",
315
+ borderRadius: "0px",
316
+ },
317
+ } }), _jsx("button", { onClick: handleRemovePreview, className: "absolute right-4 top-4 z-10 flex h-8 w-8 items-center justify-center rounded-full bg-[#51525c] text-white transition-colors hover:bg-[#71717a]", children: _jsx(X, { className: "h-4 w-4" }) })] })) : (_jsx("div", { className: "bg-b3-primary-wash h-full w-full" })) }), safePreviewUrl && (_jsxs("div", { className: "mt-4 flex items-center gap-3", children: [_jsx("label", { className: "flex-shrink-0 text-sm font-semibold text-[#475467]", children: "Zoom" }), _jsx("input", { type: "range", min: 1, max: 3, step: 0.1, value: zoom, onChange: e => setZoom(Number(e.target.value)), className: "flex-1 accent-[#3368ef]" })] }))] })) })), _jsx("input", { ref: fileInputRef, type: "file", accept: "image/*", onChange: handleFileSelect, className: "hidden" })] }), _jsxs("div", { className: "font-inter flex gap-3 border-t border-[#e4e4e7] p-6 font-semibold", children: [_jsx(Button, { onClick: handleCancel, variant: "outline", disabled: isLoading, className: "flex-1 rounded-xl border-[#e4e4e7] text-[#18181b] hover:bg-[#f4f4f5]", children: "Cancel" }), _jsx(Button, { onClick: handleSaveChanges, disabled: isLoading || (!selectedFile && !selectedProfileType), className: "flex-1 rounded-xl bg-[#3368ef] text-white hover:bg-[#2952cc]", children: isLoading ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), "Saving..."] })) : ("Save changes") })] })] }));
208
318
  }
@@ -14,7 +14,6 @@ import { Deposit } from "./Deposit/Deposit.js";
14
14
  import { LinkAccount } from "./LinkAccount/LinkAccount.js";
15
15
  import { LinkNewAccount } from "./LinkAccount/LinkNewAccount.js";
16
16
  import { ManageAccount } from "./ManageAccount/ManageAccount.js";
17
- import { ProfileEditor } from "./ProfileEditor/ProfileEditor.js";
18
17
  import { RequestPermissions } from "./RequestPermissions/RequestPermissions.js";
19
18
  import { Send } from "./Send/Send.js";
20
19
  import { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow.js";
@@ -60,7 +59,6 @@ export function B3DynamicModal() {
60
59
  "avatarEditor",
61
60
  "deposit",
62
61
  "send",
63
- "profileEditor",
64
62
  ];
65
63
  const freestyleTypes = [
66
64
  "anySpendNft",
@@ -129,8 +127,6 @@ export function B3DynamicModal() {
129
127
  return _jsx(Deposit, {});
130
128
  case "send":
131
129
  return _jsx(Send, { ...contentType });
132
- case "profileEditor":
133
- return _jsx(ProfileEditor, { onSuccess: contentType.onSuccess });
134
130
  // Add other modal types here
135
131
  default:
136
132
  return null;
@@ -144,9 +140,5 @@ export function B3DynamicModal() {
144
140
  contentType?.type === "deposit" ||
145
141
  contentType?.type === "send" ||
146
142
  contentType?.type === "avatarEditor") &&
147
- "p-0", "mx-auto w-full max-w-md sm:max-w-lg", // TODO CHECK THIS
148
- // Remove default width classes for avatar editor and profile editor
149
- contentType?.type === "avatarEditor" || contentType?.type === "profileEditor"
150
- ? "!w-[90vw] !max-w-none" // Use !important to override default styles
151
- : "mx-auto w-full max-w-md sm:max-w-lg"), hideCloseButton: hideCloseButton, children: [_jsx(ModalTitle, { className: "sr-only hidden", children: contentType?.type || "Modal" }), _jsx(ModalDescription, { className: "sr-only hidden", children: contentType?.type || "Modal Body" }), _jsxs("div", { className: cn("no-scrollbar max-h-[90dvh] overflow-auto sm:max-h-[80dvh]"), children: [(!hideCloseButton || contentType?.showBackButton) && (_jsxs("button", { onClick: navigateBack, className: "flex items-center gap-2 px-6 py-4 text-gray-600 transition-colors hover:text-gray-900 dark:text-gray-400 dark:hover:text-white", children: [_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M15.8337 10H4.16699", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M10.0003 15.8334L4.16699 10L10.0003 4.16669", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }), _jsx("span", { className: "font-inter text-sm font-semibold", children: "Back" })] })), renderContent()] })] }), (contentType?.type === "avatarEditor" || contentType?.type === "profileEditor") && (_jsx("button", { onClick: () => setB3ModalOpen(false), className: "fixed right-5 top-5 z-[100] cursor-pointer text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white", children: _jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M18 6L6 18M6 6L18 18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }))] }));
143
+ "p-0", "mx-auto w-full max-w-md sm:max-w-lg"), hideCloseButton: hideCloseButton, children: [_jsx(ModalTitle, { className: "sr-only hidden", children: contentType?.type || "Modal" }), _jsx(ModalDescription, { className: "sr-only hidden", children: contentType?.type || "Modal Body" }), _jsxs("div", { className: cn("no-scrollbar max-h-[90dvh] overflow-auto sm:max-h-[80dvh]"), children: [!hideCloseButton && (_jsxs("button", { onClick: navigateBack, className: "flex items-center gap-2 px-6 py-4 text-gray-600 transition-colors hover:text-gray-900 dark:text-gray-400 dark:hover:text-white", children: [_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M15.8337 10H4.16699", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M10.0003 15.8334L4.16699 10L10.0003 4.16669", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }), _jsx("span", { className: "font-inter text-sm font-semibold", children: "Back" })] })), renderContent()] })] }), contentType?.type === "avatarEditor" && (_jsx("button", { onClick: () => setB3ModalOpen(false), className: "fixed right-5 top-5 z-[100] cursor-pointer text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white", children: _jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M18 6L6 18M6 6L18 18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }))] }));
152
144
  }
@@ -0,0 +1,39 @@
1
+ import type { ThirdwebClient } from "thirdweb";
2
+ interface IPFSMediaRendererProps {
3
+ /** The source URL - can be IPFS URL (ipfs://...) or HTTP URL */
4
+ src: string | null | undefined;
5
+ /** Alt text for the media */
6
+ alt?: string;
7
+ /** CSS class name */
8
+ className?: string;
9
+ /** Thirdweb client instance (optional, uses default if not provided) */
10
+ client?: ThirdwebClient;
11
+ /** Width of the media */
12
+ width?: string | number;
13
+ /** Height of the media */
14
+ height?: string | number;
15
+ /** Controls property for video/audio */
16
+ controls?: boolean;
17
+ /** Style object */
18
+ style?: React.CSSProperties;
19
+ }
20
+ /**
21
+ * IPFSMediaRenderer - A wrapper around Thirdweb's MediaRenderer that configures
22
+ * the IPFS gateway URL to use our validated gateway.
23
+ *
24
+ * Features:
25
+ * - Configures MediaRenderer to use cloudflare-ipfs.com gateway
26
+ * - Gateway matches our allowed list in profileDisplay.ts
27
+ * - Provides fallback for missing sources
28
+ *
29
+ * @example
30
+ * ```tsx
31
+ * <IPFSMediaRenderer
32
+ * src="ipfs://QmX..."
33
+ * alt="Profile Avatar"
34
+ * className="size-14 rounded-full"
35
+ * />
36
+ * ```
37
+ */
38
+ export declare function IPFSMediaRenderer({ src, alt, className, client, width, height, controls, style, }: IPFSMediaRendererProps): import("react/jsx-runtime").JSX.Element;
39
+ export {};
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { client as defaultClient } from "../../../../shared/utils/thirdweb.js";
4
+ import { MediaRenderer } from "thirdweb/react";
5
+ // Primary IPFS gateway URL - matches our allowed list in profileDisplay.ts
6
+ // Note: MediaRenderer expects the base gateway URL without /ipfs path
7
+ const IPFS_GATEWAY_URL = "https://cloudflare-ipfs.com";
8
+ /**
9
+ * IPFSMediaRenderer - A wrapper around Thirdweb's MediaRenderer that configures
10
+ * the IPFS gateway URL to use our validated gateway.
11
+ *
12
+ * Features:
13
+ * - Configures MediaRenderer to use cloudflare-ipfs.com gateway
14
+ * - Gateway matches our allowed list in profileDisplay.ts
15
+ * - Provides fallback for missing sources
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * <IPFSMediaRenderer
20
+ * src="ipfs://QmX..."
21
+ * alt="Profile Avatar"
22
+ * className="size-14 rounded-full"
23
+ * />
24
+ * ```
25
+ */
26
+ export function IPFSMediaRenderer({ src, alt = "Media", className, client = defaultClient, width, height, controls, style, }) {
27
+ // If no source, render fallback
28
+ if (!src) {
29
+ return (_jsx("div", { className: className, style: style, "aria-label": alt, children: _jsx("div", { className: "bg-b3-primary-wash flex h-full w-full items-center justify-center", children: _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-xs", children: alt.charAt(0).toUpperCase() }) }) }));
30
+ }
31
+ // Convert IPFS URLs to HTTP gateway URLs if needed
32
+ // This handles both ipfs:// URLs and existing HTTP gateway URLs
33
+ return (_jsx(MediaRenderer, { src: src, client: client, alt: alt, className: className, width: width ? width.toString() : undefined, height: height ? height.toString() : undefined, controls: controls, style: style }));
34
+ }
@@ -4,11 +4,11 @@ import { BankIcon } from "../../../../global-account/react/components/icons/Bank
4
4
  import { SignOutIcon } from "../../../../global-account/react/components/icons/SignOutIcon.js";
5
5
  import { SwapIcon } from "../../../../global-account/react/components/icons/SwapIcon.js";
6
6
  import { formatUsername } from "../../../../shared/utils/index.js";
7
- import { getIpfsUrl } from "../../../../shared/utils/ipfs.js";
8
7
  import { Loader2, Pencil } from "lucide-react";
9
8
  import { useEffect, useRef, useState } from "react";
10
9
  import { useActiveAccount } from "thirdweb/react";
11
10
  import { useFirstEOA } from "../../hooks/useFirstEOA.js";
11
+ import { IPFSMediaRenderer } from "../IPFSMediaRenderer/IPFSMediaRenderer.js";
12
12
  import { B3TokenIcon, EthereumTokenIcon } from "../TokenIcon.js";
13
13
  import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "../ui/accordion.js";
14
14
  import { TokenBalanceRow } from "./TokenBalanceRow.js";
@@ -32,7 +32,8 @@ export function BalanceContent({ onLogout, showDeposit = true, showSwap = true }
32
32
  const [logoutLoading, setLogoutLoading] = useState(false);
33
33
  const [openAccordions, setOpenAccordions] = useState([]);
34
34
  const hasExpandedRef = useRef(false);
35
- const avatarUrl = user?.avatar ? getIpfsUrl(user?.avatar) : profile?.avatar;
35
+ // IPFSMediaRenderer will handle IPFS URL conversion and validation
36
+ const avatarSrc = user?.avatar || profile?.avatar;
36
37
  const handleEditProfile = () => {
37
38
  setB3ModalOpen(true);
38
39
  setB3ModalContentType({
@@ -87,7 +88,7 @@ export function BalanceContent({ onLogout, showDeposit = true, showSwap = true }
87
88
  setB3ModalOpen(false);
88
89
  setLogoutLoading(false);
89
90
  };
90
- 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: [avatarUrl ? (_jsx("img", { src: avatarUrl, alt: "Profile", className: "size-24 rounded-full" })) : (_jsx("div", { className: "bg-b3-primary-wash size-24 rounded-full" })), _jsx("button", { onClick: handleEditProfile, className: "bg-b3-grey border-b3-background hover:bg-b3-grey/80 absolute -bottom-1 -right-1 flex size-8 items-center justify-center rounded-full border-4 transition-colors", 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: user?.username || 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 || "" })] })] })] }) }), (showDeposit || showSwap) && (_jsxs("div", { className: "grid grid-cols-2 gap-3", children: [showDeposit && (_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: () => {
91
+ 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: [_jsx(IPFSMediaRenderer, { src: avatarSrc, alt: "Profile", className: "size-24 rounded-full" }), _jsx("button", { onClick: handleEditProfile, className: "bg-b3-grey border-b3-background hover:bg-b3-grey/80 absolute -bottom-1 -right-1 flex size-8 items-center justify-center rounded-full border-4 transition-colors", 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: user?.username || 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 || "" })] })] })] }) }), (showDeposit || showSwap) && (_jsxs("div", { className: "grid grid-cols-2 gap-3", children: [showDeposit && (_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: () => {
91
92
  setB3ModalOpen(true);
92
93
  setB3ModalContentType({
93
94
  type: "anySpend",
@@ -6,7 +6,7 @@ import { cn } from "../../../../shared/utils/index.js";
6
6
  const SendIcon = () => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: _jsx("path", { d: "M17.9958 1.21467C17.666 1.10449 17.359 1.18417 17.2063 1.22851C17.04 1.27683 16.8417 1.35425 16.6428 1.43191L2.51187 6.94641C2.28951 7.03315 2.07413 7.11717 1.9079 7.19936C1.76427 7.27038 1.45899 7.42845 1.28859 7.75646C1.10067 8.11818 1.10092 8.54881 1.28927 8.9103C1.46006 9.23811 1.76552 9.39582 1.90924 9.46667C2.07556 9.54867 2.29099 9.63241 2.51345 9.71889L6.4468 11.2485C6.74023 11.3626 6.88695 11.4197 7.03291 11.4232C7.16193 11.4263 7.2899 11.3994 7.40674 11.3446C7.53893 11.2826 7.65024 11.1713 7.87287 10.9487L11.9107 6.91083C12.2361 6.58539 12.7638 6.58539 13.0892 6.91083C13.4147 7.23626 13.4147 7.7639 13.0892 8.08934L9.05138 12.1272C8.82875 12.3498 8.71744 12.4611 8.65545 12.5933C8.60065 12.7101 8.57374 12.8381 8.57684 12.9671C8.58035 13.1131 8.6374 13.2598 8.75152 13.5532L10.2811 17.4865C10.3676 17.709 10.4514 17.9245 10.5334 18.0908C10.6042 18.2345 10.7619 18.54 11.0897 18.7108C11.4512 18.8991 11.8819 18.8994 12.2436 18.7115C12.5716 18.541 12.7297 18.2358 12.8007 18.0921C12.8829 17.9259 12.9669 17.7106 13.0536 17.4882L18.5681 3.35726C18.6458 3.15833 18.7232 2.96007 18.7715 2.79371C18.8159 2.64105 18.8955 2.334 18.7854 2.00419C18.6609 1.63157 18.3685 1.33915 17.9958 1.21467Z", fill: "#0C68E9" }) }));
7
7
  const BuyIcon = () => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [_jsx("path", { d: "M9.99998 8.75C9.30962 8.75 8.74998 9.30964 8.74998 10C8.74998 10.6904 9.30962 11.25 9.99998 11.25C10.6903 11.25 11.25 10.6904 11.25 10C11.25 9.30964 10.6903 8.75 9.99998 8.75Z", fill: "#0C68E9" }), _jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M14.1666 2.5C12.3642 2.5 10.8013 2.95205 9.44241 3.37018L9.18862 3.44844C7.90485 3.84476 6.86213 4.16667 5.83332 4.16667C5.09512 4.16667 4.43564 4.08819 3.88041 3.98151L3.85421 3.97647C3.44746 3.89831 3.10585 3.83267 2.84038 3.79758C2.60748 3.76679 2.26236 3.7302 1.94675 3.84126C1.78134 3.89947 1.60242 3.98249 1.43327 4.12224C1.26411 4.26199 1.14882 4.42202 1.06045 4.57348C0.898119 4.85168 0.864329 5.167 0.849347 5.3925C0.833297 5.63407 0.833306 5.94132 0.833317 6.29588L0.833315 15.2922C0.833263 15.4565 0.833201 15.6516 0.932434 15.9263C0.981719 16.0628 1.06288 16.1945 1.10974 16.2664C1.15659 16.3383 1.24436 16.4657 1.34932 16.5659C1.41718 16.6306 1.49456 16.6992 1.58722 16.76C1.67809 16.8196 1.76087 16.8559 1.79699 16.8717L1.80356 16.8746C2.48669 17.1759 3.71203 17.5 5.83332 17.5C7.63579 17.5 9.19862 17.0479 10.5576 16.6298L10.8113 16.5516C12.0951 16.1552 13.1378 15.8333 14.1666 15.8333C14.9048 15.8333 15.5643 15.9118 16.1196 16.0185L16.1458 16.0235C16.5525 16.1017 16.8941 16.1673 17.1596 16.2024C17.3925 16.2332 17.7376 16.2698 18.0532 16.1587C18.2186 16.1005 18.3975 16.0175 18.5667 15.8778C18.7359 15.738 18.8511 15.578 18.9395 15.4265C19.1018 15.1483 19.1356 14.833 19.1506 14.6075C19.1667 14.3659 19.1667 14.0587 19.1666 13.7041L19.1667 4.70776C19.1667 4.54347 19.1668 4.34839 19.0675 4.07365C19.0182 3.9372 18.9371 3.80547 18.8902 3.73359C18.8434 3.6617 18.7556 3.53428 18.6507 3.43412C18.5828 3.36935 18.5054 3.30084 18.4127 3.24003C18.3219 3.1804 18.2391 3.14413 18.203 3.1283L18.1964 3.12542C17.5133 2.82409 16.2879 2.5 14.1666 2.5ZM15.8333 7.5C15.8333 7.03976 15.4602 6.66667 15 6.66667C14.5397 6.66667 14.1666 7.03976 14.1666 7.5V10.8333C14.1666 11.2936 14.5397 11.6667 15 11.6667C15.4602 11.6667 15.8333 11.2936 15.8333 10.8333V7.5ZM7.08331 10C7.08331 8.38917 8.38915 7.08333 9.99998 7.08333C11.6108 7.08333 12.9166 8.38917 12.9166 10C12.9166 11.6108 11.6108 12.9167 9.99998 12.9167C8.38915 12.9167 7.08331 11.6108 7.08331 10ZM4.99998 8.33333C5.46022 8.33333 5.83331 8.70643 5.83331 9.16667V12.5C5.83331 12.9602 5.46022 13.3333 4.99998 13.3333C4.53974 13.3333 4.16665 12.9602 4.16665 12.5V9.16667C4.16665 8.70643 4.53974 8.33333 4.99998 8.33333Z", fill: "#0C68E9" })] }));
8
8
  const HomeActionButton = ({ customClass, icon, label, onClick, }) => {
9
- return (_jsxs(Button, { className: cn("border-b3-line hover:border-b3-primary-blue flex h-[84px] w-full flex-col items-center justify-center gap-2 rounded-2xl border-[1.5px] bg-[#FAFAFA] hover:bg-[#FAFAFA]", customClass), onClick: onClick, children: [icon, _jsx("div", { className: "text-b3-grey font-neue-montreal-semibold", children: label })] }));
9
+ return (_jsxs(Button, { className: cn("border-b3-line hover:border-b3-primary-blue flex h-[84px] w-full flex-col items-center justify-center gap-2 rounded-2xl border-[1.5px] bg-[#FAFAFA] shadow-[0_0_0_1px_rgba(10,13,18,0.18)_inset,0_-2px_0_0_rgba(10,13,18,0.05)_inset,0_1px_2px_0_rgba(10,13,18,0.05)] hover:bg-[#FAFAFA]", customClass), onClick: onClick, children: [icon, _jsx("div", { className: "text-b3-grey font-neue-montreal-semibold", children: label })] }));
10
10
  };
11
11
  const HomeActions = ({ showDeposit, showSwap }) => {
12
12
  const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
@@ -27,5 +27,5 @@ export function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit
27
27
  else if (["home", "tokens", "nfts", "apps", "settings"].includes(tab)) {
28
28
  setActiveTab?.(tab);
29
29
  }
30
- }, children: [_jsxs("div", { className: "p-0", children: [_jsx(TabsContentPrimitive, { value: "home", className: "px-0 pb-4 pt-2", children: _jsx(HomeContent, { showDeposit: showDeposit, showSwap: showSwap }) }), _jsx(TabsContentPrimitive, { value: "swap", className: "hidden" }), _jsx(TabsContentPrimitive, { value: "settings", className: "pb-4 pt-2", children: _jsx(SettingsContent, { partnerId: partnerId, onLogout: onLogout, chain: chain }) })] }), _jsx(BottomNavigation, {})] }) }));
30
+ }, children: [_jsxs("div", { className: "p-0", children: [_jsx(TabsContentPrimitive, { value: "home", className: "m-0 p-0 pb-2", children: _jsx(HomeContent, { showDeposit: showDeposit, showSwap: showSwap }) }), _jsx(TabsContentPrimitive, { value: "swap", className: "hidden" }), _jsx(TabsContentPrimitive, { value: "settings", className: "m-0 p-0 pb-2", children: _jsx(SettingsContent, { partnerId: partnerId, onLogout: onLogout, chain: chain }) })] }), _jsx(BottomNavigation, {})] }) }));
31
31
  }
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useAccountWallet, useB3, useModalStore, useProfile, useSimBalance } from "../../../../global-account/react/index.js";
3
3
  import { formatUsername } from "../../../../shared/utils/index.js";
4
- import { getIpfsUrl } from "../../../../shared/utils/ipfs.js";
5
4
  import { formatDisplayNumber } from "../../../../shared/utils/number.js";
6
5
  import { Pencil } from "lucide-react";
7
6
  import { useMemo } from "react";
8
7
  import { useActiveAccount } from "thirdweb/react";
9
8
  import { useFirstEOA } from "../../hooks/useFirstEOA.js";
9
+ import { IPFSMediaRenderer } from "../IPFSMediaRenderer/IPFSMediaRenderer.js";
10
10
  const ProfileSection = () => {
11
11
  const account = useActiveAccount();
12
12
  const { address: eoaAddress } = useFirstEOA();
@@ -26,7 +26,6 @@ const ProfileSection = () => {
26
26
  return 0;
27
27
  return simBalance.balances.reduce((sum, token) => sum + (token.value_usd || 0), 0);
28
28
  }, [simBalance]);
29
- const avatarUrl = user?.avatar ? getIpfsUrl(user?.avatar) : profile?.avatar;
30
29
  const handleEditAvatar = () => {
31
30
  setB3ModalOpen(true);
32
31
  setB3ModalContentType({
@@ -37,6 +36,10 @@ const ProfileSection = () => {
37
36
  },
38
37
  });
39
38
  };
40
- return (_jsx("div", { className: "flex items-center justify-between px-5 py-6", children: _jsxs("div", { className: "global-account-profile flex items-center gap-4", children: [_jsxs("div", { className: "global-account-profile-avatar relative", children: [avatarUrl ? (_jsx("img", { src: avatarUrl, alt: "Profile", className: "size-14 rounded-full" })) : (_jsx("div", { className: "bg-b3-primary-wash size-14 rounded-full" })), _jsx("button", { onClick: handleEditAvatar, className: "border-b3-background hover:bg-b3-grey/80 absolute -bottom-1 -right-1 flex size-6 items-center justify-center rounded-full border-4 bg-[#a0a0ab] transition-colors", children: _jsx(Pencil, { size: 10, className: "text-b3-background" }) })] }), _jsxs("div", { className: "global-account-profile-info flex flex-col gap-1", children: [_jsxs("h2", { className: "text-b3-grey font-neue-montreal-semibold flex h-[38px] items-center gap-1 text-xl", children: [_jsx("div", { className: "text-b3-foreground-muted", children: " $" }), _jsx("div", { className: "text-[30px]", children: formatDisplayNumber(totalBalanceUsd, { fractionDigits: 2 }) })] }), _jsx("div", { className: "font-neue-montreal-semibold text-base leading-none text-[#0B57C2]", children: profile?.displayName || formatUsername(profile?.name || "") })] })] }) }));
39
+ // IPFSMediaRenderer will handle IPFS URL conversion and validation
40
+ const avatarSrc = user?.avatar || profile?.avatar;
41
+ // Get current username - prioritize user.username, fallback to profile data
42
+ const currentUsername = user?.username || profile?.displayName || formatUsername(profile?.name || "");
43
+ return (_jsx("div", { className: "flex items-center justify-between px-5 py-6", children: _jsxs("div", { className: "global-account-profile flex items-center gap-4", children: [_jsxs("div", { className: "global-account-profile-avatar relative", children: [_jsx(IPFSMediaRenderer, { src: avatarSrc, alt: "Profile Avatar", className: "border-b3-line border-1 bg-b3-primary-wash size-14 rounded-full border" }), _jsx("button", { onClick: handleEditAvatar, className: "border-b3-background hover:bg-b3-grey/80 absolute -bottom-1 -right-1 flex size-6 items-center justify-center rounded-full border-4 bg-[#a0a0ab] transition-colors", children: _jsx(Pencil, { size: 10, className: "text-b3-background" }) })] }), _jsxs("div", { className: "global-account-profile-info flex flex-col gap-1", children: [_jsxs("h2", { className: "text-b3-grey font-neue-montreal-semibold flex h-[38px] items-center gap-1 text-xl", children: [_jsx("div", { className: "text-b3-foreground-muted", children: " $" }), _jsx("div", { className: "text-[30px]", children: formatDisplayNumber(totalBalanceUsd, { fractionDigits: 2 }) })] }), _jsx("div", { className: "font-neue-montreal-semibold text-base leading-none text-[#0B57C2]", children: currentUsername })] })] }) }));
41
44
  };
42
45
  export default ProfileSection;