@b3dotfun/sdk 0.0.65-test.1 → 0.0.65-test.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.
Files changed (87) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.js +4 -2
  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 +4 -2
  7. package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +1 -1
  8. package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +80 -37
  9. package/dist/cjs/global-account/react/components/B3DynamicModal.js +1 -9
  10. package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +39 -0
  11. package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +37 -0
  12. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +4 -3
  13. package/dist/cjs/global-account/react/components/ManageAccount/HomeActions.js +1 -1
  14. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +1 -1
  15. package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +6 -3
  16. package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +77 -9
  17. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +3 -1
  18. package/dist/cjs/global-account/react/components/index.d.ts +1 -2
  19. package/dist/cjs/global-account/react/components/index.js +6 -8
  20. package/dist/cjs/global-account/react/hooks/useAccountWallet.d.ts +1 -0
  21. package/dist/cjs/global-account/react/hooks/useAccountWallet.js +18 -0
  22. package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +2 -2
  23. package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +2 -2
  24. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +1 -7
  25. package/dist/cjs/shared/constants/chains/supported.d.ts +1 -1
  26. package/dist/cjs/shared/utils/ipfs.js +10 -3
  27. package/dist/esm/anyspend/react/components/AnySpend.js +4 -2
  28. package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -1
  29. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +1 -1
  30. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +1 -1
  31. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.d.ts +0 -6
  32. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +4 -2
  33. package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +1 -1
  34. package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +81 -38
  35. package/dist/esm/global-account/react/components/B3DynamicModal.js +1 -9
  36. package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +39 -0
  37. package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +34 -0
  38. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +4 -3
  39. package/dist/esm/global-account/react/components/ManageAccount/HomeActions.js +1 -1
  40. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +1 -1
  41. package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +6 -3
  42. package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +74 -9
  43. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +4 -2
  44. package/dist/esm/global-account/react/components/index.d.ts +1 -2
  45. package/dist/esm/global-account/react/components/index.js +3 -4
  46. package/dist/esm/global-account/react/hooks/useAccountWallet.d.ts +1 -0
  47. package/dist/esm/global-account/react/hooks/useAccountWallet.js +17 -0
  48. package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +2 -2
  49. package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +2 -2
  50. package/dist/esm/global-account/react/stores/useModalStore.d.ts +1 -7
  51. package/dist/esm/shared/constants/chains/supported.d.ts +1 -1
  52. package/dist/esm/shared/utils/ipfs.js +10 -3
  53. package/dist/styles/index.css +1 -1
  54. package/dist/types/anyspend/react/components/common/CryptoPaymentMethod.d.ts +0 -6
  55. package/dist/types/anyspend/react/hooks/useSigMint.d.ts +1 -1
  56. package/dist/types/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +39 -0
  57. package/dist/types/global-account/react/components/index.d.ts +1 -2
  58. package/dist/types/global-account/react/hooks/useAccountWallet.d.ts +1 -0
  59. package/dist/types/global-account/react/hooks/useAuthentication.d.ts +2 -2
  60. package/dist/types/global-account/react/hooks/useUserQuery.d.ts +2 -2
  61. package/dist/types/global-account/react/stores/useModalStore.d.ts +1 -7
  62. package/dist/types/shared/constants/chains/supported.d.ts +1 -1
  63. package/package.json +1 -1
  64. package/src/anyspend/react/components/AnySpend.tsx +4 -3
  65. package/src/anyspend/react/components/AnySpendCustom.tsx +0 -2
  66. package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +0 -2
  67. package/src/anyspend/react/components/AnyspendDepositHype.tsx +0 -2
  68. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +6 -13
  69. package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +129 -74
  70. package/src/global-account/react/components/B3DynamicModal.tsx +2 -10
  71. package/src/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.tsx +84 -0
  72. package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +4 -7
  73. package/src/global-account/react/components/ManageAccount/HomeActions.tsx +1 -1
  74. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +2 -2
  75. package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +9 -11
  76. package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +129 -23
  77. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +11 -7
  78. package/src/global-account/react/components/index.ts +3 -4
  79. package/src/global-account/react/hooks/useAccountWallet.tsx +26 -0
  80. package/src/global-account/react/stores/useModalStore.ts +1 -9
  81. package/src/shared/utils/ipfs.ts +10 -3
  82. package/dist/cjs/global-account/react/components/ProfileEditor/ProfileEditor.d.ts +0 -6
  83. package/dist/cjs/global-account/react/components/ProfileEditor/ProfileEditor.js +0 -141
  84. package/dist/esm/global-account/react/components/ProfileEditor/ProfileEditor.d.ts +0 -6
  85. package/dist/esm/global-account/react/components/ProfileEditor/ProfileEditor.js +0 -135
  86. package/dist/types/global-account/react/components/ProfileEditor/ProfileEditor.d.ts +0 -6
  87. package/src/global-account/react/components/ProfileEditor/ProfileEditor.tsx +0 -265
@@ -11,6 +11,7 @@ const anyspend_1 = require("../../../anyspend");
11
11
  const react_1 = require("../../../anyspend/react");
12
12
  const react_2 = require("../../../global-account/react");
13
13
  const BottomNavigation_1 = __importDefault(require("../../../global-account/react/components/ManageAccount/BottomNavigation"));
14
+ const useAccountWallet_1 = require("../../../global-account/react/hooks/useAccountWallet");
14
15
  const cn_1 = require("../../../shared/utils/cn");
15
16
  const number_1 = require("../../../shared/utils/number");
16
17
  const invariant_1 = __importDefault(require("invariant"));
@@ -337,6 +338,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
337
338
  const { address: globalAddress, wallet: globalWallet, connectedEOAWallet } = (0, react_2.useAccountWallet)();
338
339
  const recipientProfile = (0, react_2.useProfile)({ address: recipientAddress, fresh: true });
339
340
  const recipientName = recipientProfile.data?.name;
341
+ const globalWalletImage = (0, useAccountWallet_1.useAccountWalletImage)();
340
342
  // Auto-set active wallet from wagmi
341
343
  (0, useAutoSetActiveWalletFromWagmi_1.useAutoSetActiveWalletFromWagmi)();
342
344
  // Check token balance for crypto payments
@@ -858,12 +860,12 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
858
860
  params.set("paymentMethod", selectedCryptoPaymentMethod);
859
861
  }
860
862
  router.push(`${window.location.pathname}?${params.toString()}`);
861
- }, onBack: navigateBack, recipientEnsName: globalWallet?.ensName, recipientImageUrl: globalWallet?.meta?.icon }));
863
+ }, onBack: navigateBack, recipientEnsName: globalWallet?.ensName, recipientImageUrl: globalWalletImage }));
862
864
  const recipientSelectionView = ((0, jsx_runtime_1.jsx)(RecipientSelection_1.RecipientSelection, { initialValue: recipientAddress || "", onBack: navigateBack, onConfirm: address => {
863
865
  setRecipientAddress(address);
864
866
  navigateBack();
865
867
  } }));
866
- const cryptoPaymentMethodView = ((0, jsx_runtime_1.jsx)(CryptoPaymentMethod_1.CryptoPaymentMethod, { globalAddress: globalAddress, globalWallet: globalWallet, selectedPaymentMethod: selectedCryptoPaymentMethod, setSelectedPaymentMethod: setSelectedCryptoPaymentMethod, isCreatingOrder: isCreatingOrder, onBack: navigateBack, onSelectPaymentMethod: (method) => {
868
+ const cryptoPaymentMethodView = ((0, jsx_runtime_1.jsx)(CryptoPaymentMethod_1.CryptoPaymentMethod, { selectedPaymentMethod: selectedCryptoPaymentMethod, setSelectedPaymentMethod: setSelectedCryptoPaymentMethod, isCreatingOrder: isCreatingOrder, onBack: navigateBack, onSelectPaymentMethod: (method) => {
867
869
  setSelectedCryptoPaymentMethod(method);
868
870
  navigateBack();
869
871
  } }));
@@ -554,7 +554,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
554
554
  setActivePanel(PanelView.CONFIRM_ORDER);
555
555
  } }) }));
556
556
  // Crypto payment method view
557
- const cryptoPaymentMethodView = ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("bg-as-surface-primary mx-auto w-[460px] max-w-full rounded-xl p-4"), children: (0, jsx_runtime_1.jsx)(CryptoPaymentMethod_1.CryptoPaymentMethod, { globalAddress: currentWallet?.wallet?.address, globalWallet: currentWallet?.wallet, selectedPaymentMethod: selectedCryptoPaymentMethod, setSelectedPaymentMethod: setSelectedCryptoPaymentMethod, isCreatingOrder: isCreatingOrder, onBack: () => setActivePanel(PanelView.CONFIRM_ORDER), onSelectPaymentMethod: (method) => {
557
+ const cryptoPaymentMethodView = ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("bg-as-surface-primary mx-auto w-[460px] max-w-full rounded-xl p-4"), children: (0, jsx_runtime_1.jsx)(CryptoPaymentMethod_1.CryptoPaymentMethod, { selectedPaymentMethod: selectedCryptoPaymentMethod, setSelectedPaymentMethod: setSelectedCryptoPaymentMethod, isCreatingOrder: isCreatingOrder, onBack: () => setActivePanel(PanelView.CONFIRM_ORDER), onSelectPaymentMethod: (method) => {
558
558
  setSelectedCryptoPaymentMethod(method);
559
559
  setActivePanel(PanelView.CONFIRM_ORDER);
560
560
  } }) }));
@@ -232,7 +232,7 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
232
232
  setSelectedRecipientAddress(address);
233
233
  setActivePanel(useAnyspendFlow_1.PanelView.MAIN);
234
234
  } }));
235
- const cryptoPaymentMethodView = ((0, jsx_runtime_1.jsx)(CryptoPaymentMethod_1.CryptoPaymentMethod, { globalAddress: globalAddress, globalWallet: undefined, selectedPaymentMethod: selectedCryptoPaymentMethod, setSelectedPaymentMethod: setSelectedCryptoPaymentMethod, isCreatingOrder: isCreatingOrder, onBack: () => setActivePanel(useAnyspendFlow_1.PanelView.MAIN), onSelectPaymentMethod: (method) => {
235
+ const cryptoPaymentMethodView = ((0, jsx_runtime_1.jsx)(CryptoPaymentMethod_1.CryptoPaymentMethod, { selectedPaymentMethod: selectedCryptoPaymentMethod, setSelectedPaymentMethod: setSelectedCryptoPaymentMethod, isCreatingOrder: isCreatingOrder, onBack: () => setActivePanel(useAnyspendFlow_1.PanelView.MAIN), onSelectPaymentMethod: (method) => {
236
236
  setSelectedCryptoPaymentMethod(method);
237
237
  setActivePanel(useAnyspendFlow_1.PanelView.MAIN);
238
238
  } }));
@@ -223,7 +223,7 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
223
223
  setSelectedRecipientAddress(address);
224
224
  setActivePanel(useAnyspendFlow_1.PanelView.MAIN);
225
225
  } }));
226
- const cryptoPaymentMethodView = ((0, jsx_runtime_1.jsx)(CryptoPaymentMethod_1.CryptoPaymentMethod, { globalAddress: globalAddress, globalWallet: undefined, selectedPaymentMethod: selectedCryptoPaymentMethod, setSelectedPaymentMethod: setSelectedCryptoPaymentMethod, isCreatingOrder: isCreatingOrder, onBack: () => setActivePanel(useAnyspendFlow_1.PanelView.MAIN), onSelectPaymentMethod: (method) => {
226
+ const cryptoPaymentMethodView = ((0, jsx_runtime_1.jsx)(CryptoPaymentMethod_1.CryptoPaymentMethod, { selectedPaymentMethod: selectedCryptoPaymentMethod, setSelectedPaymentMethod: setSelectedCryptoPaymentMethod, isCreatingOrder: isCreatingOrder, onBack: () => setActivePanel(useAnyspendFlow_1.PanelView.MAIN), onSelectPaymentMethod: (method) => {
227
227
  setSelectedCryptoPaymentMethod(method);
228
228
  setActivePanel(useAnyspendFlow_1.PanelView.MAIN);
229
229
  } }));
@@ -5,12 +5,6 @@ export declare enum CryptoPaymentMethodType {
5
5
  TRANSFER_CRYPTO = "transfer_crypto"
6
6
  }
7
7
  interface CryptoPaymentMethodProps {
8
- globalAddress?: string;
9
- globalWallet?: {
10
- meta?: {
11
- icon?: string;
12
- };
13
- };
14
8
  selectedPaymentMethod: CryptoPaymentMethodType;
15
9
  setSelectedPaymentMethod: (method: CryptoPaymentMethodType) => void;
16
10
  isCreatingOrder: boolean;
@@ -5,6 +5,7 @@ exports.CryptoPaymentMethodType = void 0;
5
5
  exports.CryptoPaymentMethod = CryptoPaymentMethod;
6
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  const react_1 = require("../../../../global-account/react");
8
+ const useAccountWallet_1 = require("../../../../global-account/react/hooks/useAccountWallet");
8
9
  const cn_1 = require("../../../../shared/utils/cn");
9
10
  const formatAddress_1 = require("../../../../shared/utils/formatAddress");
10
11
  const thirdweb_1 = require("../../../../shared/utils/thirdweb");
@@ -25,7 +26,7 @@ var CryptoPaymentMethodType;
25
26
  CryptoPaymentMethodType["TRANSFER_CRYPTO"] = "transfer_crypto";
26
27
  })(CryptoPaymentMethodType || (exports.CryptoPaymentMethodType = CryptoPaymentMethodType = {}));
27
28
  function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentMethod, isCreatingOrder, onBack, onSelectPaymentMethod, }) {
28
- const { wallet: globalWallet, connectedEOAWallet: connectedEOAWallet, connectedSmartWallet: connectedSmartWallet, } = (0, react_1.useAccountWallet)();
29
+ const { connectedEOAWallet: connectedEOAWallet, connectedSmartWallet: connectedSmartWallet } = (0, react_1.useAccountWallet)();
29
30
  const { connector, address } = (0, wagmi_1.useAccount)();
30
31
  const { connect, connectors, isPending } = (0, wagmi_1.useConnect)();
31
32
  const { disconnect } = (0, wagmi_1.useDisconnect)();
@@ -35,6 +36,7 @@ function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentMethod,
35
36
  const { data: eoaWalletInfo } = (0, react_4.useWalletInfo)(connectedEOAWallet?.id);
36
37
  const isConnected = !!connectedEOAWallet;
37
38
  const globalAddress = connectedSmartWallet?.getAccount()?.address;
39
+ const walletImage = (0, useAccountWallet_1.useAccountWalletImage)();
38
40
  // Use custom hook to determine wallet display logic
39
41
  const { shouldShowConnectedEOA, shouldShowWagmiWallet } = (0, useConnectedWalletDisplay_1.useConnectedWalletDisplay)(selectedPaymentMethod);
40
42
  // Map wagmi connector names to thirdweb wallet IDs
@@ -202,7 +204,7 @@ function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentMethod,
202
204
  sonner_1.toast.success("Selected B3 Account");
203
205
  }, className: (0, cn_1.cn)("crypto-payment-method-global-wallet w-full rounded-xl border p-4 text-left transition-all hover:shadow-md", selectedPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
204
206
  ? "connected-wallet border-as-brand bg-as-brand/5"
205
- : "border-as-border-secondary bg-as-surface-primary hover:border-as-secondary/80"), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [globalWallet?.meta?.icon ? ((0, jsx_runtime_1.jsx)("img", { src: globalWallet.meta.icon, alt: "Global Account", className: "h-10 w-10 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "wallet-icon flex h-10 w-10 items-center justify-center rounded-full bg-purple-100", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-5 w-5 text-purple-600" }) })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary font-semibold", children: "Global Account" }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/60 text-sm", children: (0, formatAddress_1.shortenAddress)(globalAddress || "") })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: selectedPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET && ((0, jsx_runtime_1.jsx)("div", { className: "h-2 w-2 rounded-full bg-green-500" })) })] }) }))] })] })), (0, jsx_runtime_1.jsxs)("div", { className: "other-payment-methods", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-as-primary/80 mb-3 text-sm font-medium", children: "Payment methods" }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-3", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => {
207
+ : "border-as-border-secondary bg-as-surface-primary hover:border-as-secondary/80"), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [walletImage ? ((0, jsx_runtime_1.jsx)("img", { src: walletImage, alt: "Global Account", className: "h-10 w-10 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "wallet-icon flex h-10 w-10 items-center justify-center rounded-full bg-purple-100", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-5 w-5 text-purple-600" }) })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary font-semibold", children: "Global Account" }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/60 text-sm", children: (0, formatAddress_1.shortenAddress)(globalAddress || "") })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: selectedPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET && ((0, jsx_runtime_1.jsx)("div", { className: "h-2 w-2 rounded-full bg-green-500" })) })] }) }))] })] })), (0, jsx_runtime_1.jsxs)("div", { className: "other-payment-methods", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-as-primary/80 mb-3 text-sm font-medium", children: "Payment methods" }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-3", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => {
206
208
  // Always show wallet selection modal first
207
209
  setShowWalletModal(true);
208
210
  }, 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: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "wallet-icon flex h-8 w-8 items-center justify-center rounded-full bg-blue-100", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-4 w-4 text-blue-600" }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col items-start text-left", children: (0, jsx_runtime_1.jsx)("h4", { className: "text-as-primary font-semibold", children: "Connect wallet" }) })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "text-as-primary/40 group-hover:text-as-primary/60 h-5 w-5 transition-colors" })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => {
@@ -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;
@@ -8,9 +8,9 @@ exports.AvatarEditor = AvatarEditor;
8
8
  const jsx_runtime_1 = require("react/jsx-runtime");
9
9
  const app_1 = __importDefault(require("../../../../global-account/app"));
10
10
  const react_1 = require("../../../../global-account/react");
11
+ const profileDisplay_1 = require("../../../../global-account/react/utils/profileDisplay");
11
12
  const cn_1 = require("../../../../shared/utils/cn");
12
13
  const debug_1 = require("../../../../shared/utils/debug");
13
- const ipfs_1 = require("../../../../shared/utils/ipfs");
14
14
  const thirdweb_1 = require("../../../../shared/utils/thirdweb");
15
15
  const lucide_react_1 = require("lucide-react");
16
16
  const react_2 = require("react");
@@ -24,16 +24,15 @@ const debug = (0, debug_1.debugB3React)("AvatarEditor");
24
24
  function AvatarEditor({ onSetAvatar, className }) {
25
25
  const [viewStep, setViewStep] = (0, react_2.useState)("select");
26
26
  const [selectedAvatar, setSelectedAvatar] = (0, react_2.useState)(null);
27
+ const [selectedProfileType, setSelectedProfileType] = (0, react_2.useState)(null); // Track which profile was selected
27
28
  const [hoveredProfile, setHoveredProfile] = (0, react_2.useState)(null);
28
29
  const [selectedFile, setSelectedFile] = (0, react_2.useState)(null);
29
30
  const [previewUrl, setPreviewUrl] = (0, react_2.useState)(null);
30
- const [isUploading, setIsUploading] = (0, react_2.useState)(false);
31
31
  const [isSaving, setIsSaving] = (0, react_2.useState)(false);
32
32
  const [isDragging, setIsDragging] = (0, react_2.useState)(false);
33
33
  const fileInputRef = (0, react_2.useRef)(null);
34
34
  const { setUser, user, partnerId } = (0, react_1.useB3)();
35
35
  const setB3ModalContentType = (0, stores_1.useModalStore)(state => state.setB3ModalContentType);
36
- const setB3ModalOpen = (0, stores_1.useModalStore)(state => state.setB3ModalOpen);
37
36
  const contentType = (0, stores_1.useModalStore)(state => state.contentType);
38
37
  const { setPreference } = (0, useProfile_1.useProfileSettings)();
39
38
  const account = (0, react_3.useActiveAccount)();
@@ -41,11 +40,10 @@ function AvatarEditor({ onSetAvatar, className }) {
41
40
  address: account?.address,
42
41
  fresh: true,
43
42
  });
44
- const currentAvatar = user?.avatar
45
- ? (0, ipfs_1.getIpfsUrl)(user?.avatar)
46
- : profile?.avatar
47
- ? (0, ipfs_1.getIpfsUrl)(profile.avatar)
48
- : undefined;
43
+ // Get raw avatar URLs, convert IPFS URLs, and validate them
44
+ const rawCurrentAvatar = user?.avatar || profile?.avatar;
45
+ const currentAvatar = (0, profileDisplay_1.validateImageUrl)(rawCurrentAvatar);
46
+ const safePreviewUrl = (0, profileDisplay_1.validateImageUrl)(previewUrl);
49
47
  const handleFileSelect = (event) => {
50
48
  const file = event.target.files?.[0];
51
49
  if (file) {
@@ -60,6 +58,8 @@ function AvatarEditor({ onSetAvatar, className }) {
60
58
  return;
61
59
  }
62
60
  setSelectedFile(file);
61
+ // Clear profile type selection when uploading a new file
62
+ setSelectedProfileType(null);
63
63
  // Create preview URL
64
64
  const url = URL.createObjectURL(file);
65
65
  setPreviewUrl(url);
@@ -68,6 +68,7 @@ function AvatarEditor({ onSetAvatar, className }) {
68
68
  };
69
69
  const handleRemovePreview = () => {
70
70
  setSelectedAvatar(currentAvatar || null);
71
+ setSelectedProfileType(null);
71
72
  setSelectedFile(null);
72
73
  if (previewUrl) {
73
74
  URL.revokeObjectURL(previewUrl);
@@ -84,13 +85,51 @@ function AvatarEditor({ onSetAvatar, className }) {
84
85
  }
85
86
  setIsSaving(true);
86
87
  try {
88
+ let fileToUpload = null;
87
89
  // If user uploaded a new file
88
90
  if (selectedFile) {
89
- debug("Starting upload to IPFS", selectedFile);
91
+ fileToUpload = selectedFile;
92
+ }
93
+ else if (selectedProfileType && selectedAvatar) {
94
+ // User selected from existing profile avatars
95
+ // Fetch the image from the URL and convert to blob
96
+ debug("Fetching image from social profile:", selectedAvatar);
97
+ try {
98
+ const response = await fetch(selectedAvatar);
99
+ if (!response.ok) {
100
+ throw new Error("Failed to fetch image");
101
+ }
102
+ const blob = await response.blob();
103
+ debug("Fetched blob with type:", blob.type);
104
+ // Determine the correct extension from the blob's MIME type
105
+ // This handles URLs without extensions (like Farcaster images)
106
+ const mimeToExtension = {
107
+ "image/jpeg": "jpg",
108
+ "image/jpg": "jpg",
109
+ "image/png": "png",
110
+ "image/gif": "gif",
111
+ "image/webp": "webp",
112
+ "image/svg+xml": "svg",
113
+ };
114
+ const extension = blob.type ? mimeToExtension[blob.type.toLowerCase()] || "jpg" : "jpg";
115
+ const mimeType = blob.type || `image/${extension}`;
116
+ fileToUpload = new File([blob], `avatar-${selectedProfileType}.${extension}`, { type: mimeType });
117
+ debug("Successfully converted social profile image to file with extension:", extension);
118
+ }
119
+ catch (fetchError) {
120
+ debug("Error fetching social profile image:", fetchError);
121
+ sonner_1.toast.error("Failed to fetch profile image. Please try uploading manually.");
122
+ setIsSaving(false);
123
+ return;
124
+ }
125
+ }
126
+ // Upload to IPFS if we have a file
127
+ if (fileToUpload) {
128
+ debug("Starting upload to IPFS", fileToUpload);
90
129
  // Upload to IPFS using Thirdweb
91
130
  const ipfsUrl = await (0, storage_1.upload)({
92
131
  client: thirdweb_1.client,
93
- files: [selectedFile],
132
+ files: [fileToUpload],
94
133
  });
95
134
  debug("Upload successful", ipfsUrl);
96
135
  // Save avatar URL using profiles service
@@ -104,21 +143,6 @@ function AvatarEditor({ onSetAvatar, className }) {
104
143
  setUser(user);
105
144
  sonner_1.toast.success("Looks great! Your avatar has been saved!");
106
145
  }
107
- else if (selectedAvatar && selectedAvatar !== currentAvatar) {
108
- // User selected from existing profile avatars
109
- // Find the profile that matches the selected avatar
110
- const selectedProfile = profile?.profiles?.find(p => p.avatar === selectedAvatar);
111
- if (selectedProfile && selectedProfile.type) {
112
- debug("Setting profile preference to:", selectedProfile.type);
113
- // Set preference for this profile type
114
- await setPreference(account.address, selectedProfile.type, account.address, async (message) => {
115
- // Sign the message using the active account
116
- const signature = await account.signMessage({ message });
117
- return signature;
118
- });
119
- sonner_1.toast.success("Avatar updated successfully!");
120
- }
121
- }
122
146
  // Refresh profile to get updated avatar
123
147
  await refreshProfile();
124
148
  onSetAvatar?.();
@@ -144,8 +168,15 @@ function AvatarEditor({ onSetAvatar, className }) {
144
168
  });
145
169
  }
146
170
  };
147
- const handleProfileAvatarSelect = (avatarUrl) => {
171
+ const handleProfileAvatarSelect = (avatarUrl, profileType) => {
148
172
  setSelectedAvatar(avatarUrl);
173
+ setSelectedProfileType(profileType);
174
+ // Clear any selected file since we're selecting from profile
175
+ setSelectedFile(null);
176
+ if (previewUrl) {
177
+ URL.revokeObjectURL(previewUrl);
178
+ setPreviewUrl(null);
179
+ }
149
180
  };
150
181
  const handleUploadImageClick = () => {
151
182
  setViewStep("upload");
@@ -184,6 +215,8 @@ function AvatarEditor({ onSetAvatar, className }) {
184
215
  return;
185
216
  }
186
217
  setSelectedFile(file);
218
+ // Clear profile type selection when uploading a new file
219
+ setSelectedProfileType(null);
187
220
  // Create preview URL
188
221
  const url = URL.createObjectURL(file);
189
222
  setPreviewUrl(url);
@@ -197,18 +230,28 @@ function AvatarEditor({ onSetAvatar, className }) {
197
230
  partnerId: partnerId,
198
231
  });
199
232
  };
200
- const isLoading = isUploading || isSaving;
201
- // Get profile avatars
233
+ const isLoading = isSaving;
234
+ // Get profile avatars with validated URLs
202
235
  const profileAvatars = profile?.profiles
203
236
  ?.filter(p => p.avatar)
204
- .map(p => ({
205
- type: p.type,
206
- avatar: (0, ipfs_1.getIpfsUrl)(p?.avatar || ""),
207
- name: p.name || p.type,
208
- })) || [];
209
- return ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("flex w-full max-w-md flex-col bg-white", className), children: [viewStep === "upload" && (0, jsx_runtime_1.jsx)(ModalHeader_1.default, { title: "Upload Image" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center p-6", children: [viewStep === "select" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative mb-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-32 w-32 overflow-hidden rounded-full", children: (0, jsx_runtime_1.jsx)("img", { src: selectedAvatar || currentAvatar || "https://via.placeholder.com/128", alt: "Avatar preview", className: "h-full w-full object-cover" }) }), selectedAvatar && ((0, jsx_runtime_1.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: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-4 w-4" }) }))] }), (0, jsx_runtime_1.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: [(0, jsx_runtime_1.jsx)(lucide_react_1.Upload, { className: "h-4 w-4" }), "Upload image"] }), (0, jsx_runtime_1.jsxs)("div", { className: "w-full", children: [(0, jsx_runtime_1.jsx)("h3", { className: "mb-2 text-base font-semibold text-[#18181b]", children: "Select your profile image" }), (0, jsx_runtime_1.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." }), (0, jsx_runtime_1.jsx)("div", { className: "mb-4 flex gap-3", children: profileAvatars.map((profileAvatar, index) => ((0, jsx_runtime_1.jsxs)("div", { className: "relative", onMouseEnter: () => setHoveredProfile(profileAvatar.type), onMouseLeave: () => setHoveredProfile(null), children: [(0, jsx_runtime_1.jsx)("button", { onClick: () => handleProfileAvatarSelect(profileAvatar.avatar), className: (0, cn_1.cn)("h-16 w-16 overflow-hidden rounded-full border-2 transition-all", selectedAvatar === profileAvatar.avatar
210
- ? "border-[#3368ef] ring-2 ring-[#3368ef]/20"
211
- : "border-transparent hover:border-[#e4e4e7]"), children: (0, jsx_runtime_1.jsx)("img", { src: profileAvatar.avatar, alt: `${profileAvatar.type} avatar`, className: "h-full w-full object-cover" }) }), hoveredProfile === profileAvatar.type && ((0, jsx_runtime_1.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))) }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleLinkMoreAccount, className: "font-inter flex items-center gap-2 text-sm font-semibold text-[#3368ef] hover:underline", children: [(0, jsx_runtime_1.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: (0, jsx_runtime_1.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"] })] })] })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !selectedFile ? ((0, jsx_runtime_1.jsxs)("div", { onClick: handleOpenFilePicker, onDragEnter: handleDragEnter, onDragLeave: handleDragLeave, onDragOver: handleDragOver, onDrop: handleDrop, className: (0, cn_1.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
237
+ .map(p => {
238
+ const rawAvatarUrl = p?.avatar || "";
239
+ const validatedUrl = (0, profileDisplay_1.validateImageUrl)(rawAvatarUrl);
240
+ return {
241
+ type: p.type,
242
+ avatar: validatedUrl,
243
+ name: p.name || p.type,
244
+ };
245
+ })
246
+ .filter(p => p.avatar !== null) || []; // Filter out profiles with invalid avatars
247
+ return ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("flex w-full max-w-md flex-col bg-white", className), children: [viewStep === "upload" && (0, jsx_runtime_1.jsx)(ModalHeader_1.default, { title: "Upload Image" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center p-6", children: [viewStep === "select" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative mb-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-32 w-32 overflow-hidden rounded-full", children: safePreviewUrl || selectedAvatar || currentAvatar ? ((0, jsx_runtime_1.jsx)(react_1.IPFSMediaRenderer, { src: safePreviewUrl || selectedAvatar || currentAvatar || "", alt: "Avatar preview", className: "h-full w-full object-cover" })) : ((0, jsx_runtime_1.jsx)("div", { className: "bg-b3-primary-wash h-full w-full" })) }), (selectedAvatar !== currentAvatar || selectedFile) && ((0, jsx_runtime_1.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: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-4 w-4" }) }))] }), (0, jsx_runtime_1.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: [(0, jsx_runtime_1.jsx)(lucide_react_1.Upload, { className: "h-4 w-4" }), "Upload image"] }), (0, jsx_runtime_1.jsxs)("div", { className: "w-full", children: [(0, jsx_runtime_1.jsx)("h3", { className: "mb-2 text-base font-semibold text-[#18181b]", children: "Select your profile image" }), (0, jsx_runtime_1.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." }), (0, jsx_runtime_1.jsx)("div", { className: "mb-4 flex gap-3", children: profileAvatars.map((profileAvatar, index) => {
248
+ // Skip if avatar is null (should not happen due to filter, but TypeScript doesn't know that)
249
+ if (!profileAvatar.avatar)
250
+ return null;
251
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "relative", onMouseEnter: () => setHoveredProfile(profileAvatar.type), onMouseLeave: () => setHoveredProfile(null), children: [(0, jsx_runtime_1.jsx)("button", { onClick: () => handleProfileAvatarSelect(profileAvatar.avatar || "", profileAvatar.type || ""), className: (0, cn_1.cn)("h-16 w-16 overflow-hidden rounded-full border-2 transition-all", selectedProfileType === profileAvatar.type
252
+ ? "border-[#3368ef] ring-2 ring-[#3368ef]/20"
253
+ : "border-transparent hover:border-[#e4e4e7]"), children: (0, jsx_runtime_1.jsx)("img", { src: profileAvatar.avatar, alt: `${profileAvatar.type} avatar`, className: "h-full w-full object-cover" }) }), hoveredProfile === profileAvatar.type && ((0, jsx_runtime_1.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));
254
+ }) }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleLinkMoreAccount, className: "font-inter flex items-center gap-2 text-sm font-semibold text-[#3368ef] hover:underline", children: [(0, jsx_runtime_1.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: (0, jsx_runtime_1.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"] })] })] })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !selectedFile ? ((0, jsx_runtime_1.jsxs)("div", { onClick: handleOpenFilePicker, onDragEnter: handleDragEnter, onDragLeave: handleDragLeave, onDragOver: handleDragOver, onDrop: handleDrop, className: (0, cn_1.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
212
255
  ? "border-[#3368ef] bg-[#f0f5ff]"
213
- : "border-[#e4e4e7] hover:border-[#3368ef] hover:bg-[#f0f5ff]"), children: [(0, jsx_runtime_1.jsxs)("p", { className: "font-inter mb-1 text-sm", children: [(0, jsx_runtime_1.jsx)("span", { className: "font-semibold text-[#3368ef]", children: "Click to upload" }), (0, jsx_runtime_1.jsx)("span", { className: "text-[#71717a]", children: " or drag and drop" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-[#71717a]", children: "PNG, JPG or GIF (up to 5MB)" })] })) : ((0, jsx_runtime_1.jsx)("div", { className: "mb-6 w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "aspect-square w-full overflow-hidden rounded-xl bg-[#f4f4f5]", children: (0, jsx_runtime_1.jsx)("img", { src: previewUrl || "", alt: "Preview", className: "h-full w-full object-cover" }) }) })) })), (0, jsx_runtime_1.jsx)("input", { ref: fileInputRef, type: "file", accept: "image/*", onChange: handleFileSelect, className: "hidden" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "font-inter flex gap-3 border-t border-[#e4e4e7] p-6 font-semibold", children: [(0, jsx_runtime_1.jsx)(react_1.Button, { onClick: handleCancel, variant: "outline", disabled: isLoading, className: "flex-1 rounded-xl border-[#e4e4e7] text-[#18181b] hover:bg-[#f4f4f5]", children: "Cancel" }), (0, jsx_runtime_1.jsx)(react_1.Button, { onClick: handleSaveChanges, disabled: isLoading || !selectedAvatar, className: "flex-1 rounded-xl bg-[#3368ef] text-white hover:bg-[#2952cc]", children: isLoading ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), "Saving..."] })) : ("Save changes") })] })] }));
256
+ : "border-[#e4e4e7] hover:border-[#3368ef] hover:bg-[#f0f5ff]"), children: [(0, jsx_runtime_1.jsxs)("p", { className: "font-inter mb-1 text-sm", children: [(0, jsx_runtime_1.jsx)("span", { className: "font-semibold text-[#3368ef]", children: "Click to upload" }), (0, jsx_runtime_1.jsx)("span", { className: "text-[#71717a]", children: " or drag and drop" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-[#71717a]", children: "PNG, JPG or GIF (up to 5MB)" })] })) : ((0, jsx_runtime_1.jsx)("div", { className: "mb-6 w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "aspect-square w-full overflow-hidden rounded-xl bg-[#f4f4f5]", children: safePreviewUrl ? ((0, jsx_runtime_1.jsx)("img", { src: safePreviewUrl, alt: "Preview", className: "h-full w-full object-cover" })) : ((0, jsx_runtime_1.jsx)("div", { className: "bg-b3-primary-wash h-full w-full" })) }) })) })), (0, jsx_runtime_1.jsx)("input", { ref: fileInputRef, type: "file", accept: "image/*", onChange: handleFileSelect, className: "hidden" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "font-inter flex gap-3 border-t border-[#e4e4e7] p-6 font-semibold", children: [(0, jsx_runtime_1.jsx)(react_1.Button, { onClick: handleCancel, variant: "outline", disabled: isLoading, className: "flex-1 rounded-xl border-[#e4e4e7] text-[#18181b] hover:bg-[#f4f4f5]", children: "Cancel" }), (0, jsx_runtime_1.jsx)(react_1.Button, { onClick: handleSaveChanges, disabled: isLoading || (!selectedFile && !selectedProfileType), className: "flex-1 rounded-xl bg-[#3368ef] text-white hover:bg-[#2952cc]", children: isLoading ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), "Saving..."] })) : ("Save changes") })] })] }));
214
257
  }
@@ -17,7 +17,6 @@ const Deposit_1 = require("./Deposit/Deposit");
17
17
  const LinkAccount_1 = require("./LinkAccount/LinkAccount");
18
18
  const LinkNewAccount_1 = require("./LinkAccount/LinkNewAccount");
19
19
  const ManageAccount_1 = require("./ManageAccount/ManageAccount");
20
- const ProfileEditor_1 = require("./ProfileEditor/ProfileEditor");
21
20
  const RequestPermissions_1 = require("./RequestPermissions/RequestPermissions");
22
21
  const Send_1 = require("./Send/Send");
23
22
  const SignInWithB3Flow_1 = require("./SignInWithB3/SignInWithB3Flow");
@@ -63,7 +62,6 @@ function B3DynamicModal() {
63
62
  "avatarEditor",
64
63
  "deposit",
65
64
  "send",
66
- "profileEditor",
67
65
  ];
68
66
  const freestyleTypes = [
69
67
  "anySpendNft",
@@ -132,8 +130,6 @@ function B3DynamicModal() {
132
130
  return (0, jsx_runtime_1.jsx)(Deposit_1.Deposit, {});
133
131
  case "send":
134
132
  return (0, jsx_runtime_1.jsx)(Send_1.Send, { ...contentType });
135
- case "profileEditor":
136
- return (0, jsx_runtime_1.jsx)(ProfileEditor_1.ProfileEditor, { onSuccess: contentType.onSuccess });
137
133
  // Add other modal types here
138
134
  default:
139
135
  return null;
@@ -147,9 +143,5 @@ function B3DynamicModal() {
147
143
  contentType?.type === "deposit" ||
148
144
  contentType?.type === "send" ||
149
145
  contentType?.type === "avatarEditor") &&
150
- "p-0", "mx-auto w-full max-w-md sm:max-w-lg", // TODO CHECK THIS
151
- // Remove default width classes for avatar editor and profile editor
152
- contentType?.type === "avatarEditor" || contentType?.type === "profileEditor"
153
- ? "!w-[90vw] !max-w-none" // Use !important to override default styles
154
- : "mx-auto w-full max-w-md sm:max-w-lg"), hideCloseButton: hideCloseButton, children: [(0, jsx_runtime_1.jsx)(ModalTitle, { className: "sr-only hidden", children: contentType?.type || "Modal" }), (0, jsx_runtime_1.jsx)(ModalDescription, { className: "sr-only hidden", children: contentType?.type || "Modal Body" }), (0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("no-scrollbar max-h-[90dvh] overflow-auto sm:max-h-[80dvh]"), children: [(!hideCloseButton || contentType?.showBackButton) && ((0, jsx_runtime_1.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: [(0, jsx_runtime_1.jsxs)("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("path", { d: "M15.8337 10H4.16699", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M10.0003 15.8334L4.16699 10L10.0003 4.16669", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }), (0, jsx_runtime_1.jsx)("span", { className: "font-inter text-sm font-semibold", children: "Back" })] })), renderContent()] })] }), (contentType?.type === "avatarEditor" || contentType?.type === "profileEditor") && ((0, jsx_runtime_1.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: (0, jsx_runtime_1.jsx)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M18 6L6 18M6 6L18 18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }))] }));
146
+ "p-0", "mx-auto w-full max-w-md sm:max-w-lg"), hideCloseButton: hideCloseButton, children: [(0, jsx_runtime_1.jsx)(ModalTitle, { className: "sr-only hidden", children: contentType?.type || "Modal" }), (0, jsx_runtime_1.jsx)(ModalDescription, { className: "sr-only hidden", children: contentType?.type || "Modal Body" }), (0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("no-scrollbar max-h-[90dvh] overflow-auto sm:max-h-[80dvh]"), children: [(!hideCloseButton || contentType?.showBackButton) && ((0, jsx_runtime_1.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: [(0, jsx_runtime_1.jsxs)("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("path", { d: "M15.8337 10H4.16699", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M10.0003 15.8334L4.16699 10L10.0003 4.16669", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }), (0, jsx_runtime_1.jsx)("span", { className: "font-inter text-sm font-semibold", children: "Back" })] })), renderContent()] })] }), contentType?.type === "avatarEditor" && ((0, jsx_runtime_1.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: (0, jsx_runtime_1.jsx)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M18 6L6 18M6 6L18 18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }))] }));
155
147
  }
@@ -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,37 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.IPFSMediaRenderer = IPFSMediaRenderer;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const thirdweb_1 = require("../../../../shared/utils/thirdweb");
7
+ const react_1 = require("thirdweb/react");
8
+ // Primary IPFS gateway URL - matches our allowed list in profileDisplay.ts
9
+ // Note: MediaRenderer expects the base gateway URL without /ipfs path
10
+ const IPFS_GATEWAY_URL = "https://cloudflare-ipfs.com";
11
+ /**
12
+ * IPFSMediaRenderer - A wrapper around Thirdweb's MediaRenderer that configures
13
+ * the IPFS gateway URL to use our validated gateway.
14
+ *
15
+ * Features:
16
+ * - Configures MediaRenderer to use cloudflare-ipfs.com gateway
17
+ * - Gateway matches our allowed list in profileDisplay.ts
18
+ * - Provides fallback for missing sources
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * <IPFSMediaRenderer
23
+ * src="ipfs://QmX..."
24
+ * alt="Profile Avatar"
25
+ * className="size-14 rounded-full"
26
+ * />
27
+ * ```
28
+ */
29
+ function IPFSMediaRenderer({ src, alt = "Media", className, client = thirdweb_1.client, width, height, controls, style, }) {
30
+ // If no source, render fallback
31
+ if (!src) {
32
+ return ((0, jsx_runtime_1.jsx)("div", { className: className, style: style, "aria-label": alt, children: (0, jsx_runtime_1.jsx)("div", { className: "bg-b3-primary-wash flex h-full w-full items-center justify-center", children: (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold text-xs", children: alt.charAt(0).toUpperCase() }) }) }));
33
+ }
34
+ // Convert IPFS URLs to HTTP gateway URLs if needed
35
+ // This handles both ipfs:// URLs and existing HTTP gateway URLs
36
+ return ((0, jsx_runtime_1.jsx)(react_1.MediaRenderer, { src: src, client: client, alt: alt, className: className, width: width ? width.toString() : undefined, height: height ? height.toString() : undefined, controls: controls, style: style }));
37
+ }
@@ -7,11 +7,11 @@ const BankIcon_1 = require("../../../../global-account/react/components/icons/Ba
7
7
  const SignOutIcon_1 = require("../../../../global-account/react/components/icons/SignOutIcon");
8
8
  const SwapIcon_1 = require("../../../../global-account/react/components/icons/SwapIcon");
9
9
  const utils_1 = require("../../../../shared/utils");
10
- const ipfs_1 = require("../../../../shared/utils/ipfs");
11
10
  const lucide_react_1 = require("lucide-react");
12
11
  const react_2 = require("react");
13
12
  const react_3 = require("thirdweb/react");
14
13
  const useFirstEOA_1 = require("../../hooks/useFirstEOA");
14
+ const IPFSMediaRenderer_1 = require("../IPFSMediaRenderer/IPFSMediaRenderer");
15
15
  const TokenIcon_1 = require("../TokenIcon");
16
16
  const accordion_1 = require("../ui/accordion");
17
17
  const TokenBalanceRow_1 = require("./TokenBalanceRow");
@@ -35,7 +35,8 @@ function BalanceContent({ onLogout, showDeposit = true, showSwap = true }) {
35
35
  const [logoutLoading, setLogoutLoading] = (0, react_2.useState)(false);
36
36
  const [openAccordions, setOpenAccordions] = (0, react_2.useState)([]);
37
37
  const hasExpandedRef = (0, react_2.useRef)(false);
38
- const avatarUrl = user?.avatar ? (0, ipfs_1.getIpfsUrl)(user?.avatar) : profile?.avatar;
38
+ // IPFSMediaRenderer will handle IPFS URL conversion and validation
39
+ const avatarSrc = user?.avatar || profile?.avatar;
39
40
  const handleEditProfile = () => {
40
41
  setB3ModalOpen(true);
41
42
  setB3ModalContentType({
@@ -90,7 +91,7 @@ function BalanceContent({ onLogout, showDeposit = true, showSwap = true }) {
90
91
  setB3ModalOpen(false);
91
92
  setLogoutLoading(false);
92
93
  };
93
- return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between", children: (0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile flex items-center gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile-avatar relative", children: [avatarUrl ? ((0, jsx_runtime_1.jsx)("img", { src: avatarUrl, alt: "Profile", className: "size-24 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "bg-b3-primary-wash size-24 rounded-full" })), (0, jsx_runtime_1.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: (0, jsx_runtime_1.jsx)(lucide_react_1.Pencil, { size: 16, className: "text-b3-background" }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile-info", children: [(0, jsx_runtime_1.jsx)("h2", { className: "text-b3-grey text-xl font-semibold", children: user?.username || profile?.displayName || (0, utils_1.formatUsername)(profile?.name || "") }), (0, jsx_runtime_1.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: [(0, jsx_runtime_1.jsx)("span", { className: "text-b3-foreground-muted font-mono text-xs", children: centerTruncate(account?.address || "", 6) }), (0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: account?.address || "" })] })] })] }) }), (showDeposit || showSwap) && ((0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 gap-3", children: [showDeposit && ((0, jsx_runtime_1.jsxs)(react_1.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: () => {
94
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between", children: (0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile flex items-center gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile-avatar relative", children: [(0, jsx_runtime_1.jsx)(IPFSMediaRenderer_1.IPFSMediaRenderer, { src: avatarSrc, alt: "Profile", className: "size-24 rounded-full" }), (0, jsx_runtime_1.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: (0, jsx_runtime_1.jsx)(lucide_react_1.Pencil, { size: 16, className: "text-b3-background" }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile-info", children: [(0, jsx_runtime_1.jsx)("h2", { className: "text-b3-grey text-xl font-semibold", children: user?.username || profile?.displayName || (0, utils_1.formatUsername)(profile?.name || "") }), (0, jsx_runtime_1.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: [(0, jsx_runtime_1.jsx)("span", { className: "text-b3-foreground-muted font-mono text-xs", children: centerTruncate(account?.address || "", 6) }), (0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: account?.address || "" })] })] })] }) }), (showDeposit || showSwap) && ((0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 gap-3", children: [showDeposit && ((0, jsx_runtime_1.jsxs)(react_1.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: () => {
94
95
  setB3ModalOpen(true);
95
96
  setB3ModalContentType({
96
97
  type: "anySpend",
@@ -8,7 +8,7 @@ const utils_1 = require("../../../../shared/utils");
8
8
  const SendIcon = () => ((0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: (0, jsx_runtime_1.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" }) }));
9
9
  const BuyIcon = () => ((0, jsx_runtime_1.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [(0, jsx_runtime_1.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" }), (0, jsx_runtime_1.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" })] }));
10
10
  const HomeActionButton = ({ customClass, icon, label, onClick, }) => {
11
- return ((0, jsx_runtime_1.jsxs)(react_1.Button, { className: (0, utils_1.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, (0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: label })] }));
11
+ return ((0, jsx_runtime_1.jsxs)(react_1.Button, { className: (0, utils_1.cn)("border-b3-line hover:border-b3-primary-blue shadow-xs 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, (0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: label })] }));
12
12
  };
13
13
  const HomeActions = ({ showDeposit, showSwap }) => {
14
14
  const setB3ModalOpen = (0, react_1.useModalStore)(state => state.setB3ModalOpen);
@@ -33,5 +33,5 @@ function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain
33
33
  else if (["home", "tokens", "nfts", "apps", "settings"].includes(tab)) {
34
34
  setActiveTab?.(tab);
35
35
  }
36
- }, children: [(0, jsx_runtime_1.jsxs)("div", { className: "p-0", children: [(0, jsx_runtime_1.jsx)(react_1.TabsContentPrimitive, { value: "home", className: "px-0 pb-4 pt-2", children: (0, jsx_runtime_1.jsx)(HomeContent_1.HomeContent, { showDeposit: showDeposit, showSwap: showSwap }) }), (0, jsx_runtime_1.jsx)(react_1.TabsContentPrimitive, { value: "swap", className: "hidden" }), (0, jsx_runtime_1.jsx)(react_1.TabsContentPrimitive, { value: "settings", className: "pb-4 pt-2", children: (0, jsx_runtime_1.jsx)(SettingsContent_1.default, { partnerId: partnerId, onLogout: onLogout, chain: chain }) })] }), (0, jsx_runtime_1.jsx)(BottomNavigation_1.default, {})] }) }));
36
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { className: "p-0", children: [(0, jsx_runtime_1.jsx)(react_1.TabsContentPrimitive, { value: "home", className: "m-0 p-0 pb-2", children: (0, jsx_runtime_1.jsx)(HomeContent_1.HomeContent, { showDeposit: showDeposit, showSwap: showSwap }) }), (0, jsx_runtime_1.jsx)(react_1.TabsContentPrimitive, { value: "swap", className: "hidden" }), (0, jsx_runtime_1.jsx)(react_1.TabsContentPrimitive, { value: "settings", className: "m-0 p-0 pb-2", children: (0, jsx_runtime_1.jsx)(SettingsContent_1.default, { partnerId: partnerId, onLogout: onLogout, chain: chain }) })] }), (0, jsx_runtime_1.jsx)(BottomNavigation_1.default, {})] }) }));
37
37
  }
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const jsx_runtime_1 = require("react/jsx-runtime");
4
4
  const react_1 = require("../../../../global-account/react");
5
5
  const utils_1 = require("../../../../shared/utils");
6
- const ipfs_1 = require("../../../../shared/utils/ipfs");
7
6
  const number_1 = require("../../../../shared/utils/number");
8
7
  const lucide_react_1 = require("lucide-react");
9
8
  const react_2 = require("react");
10
9
  const react_3 = require("thirdweb/react");
11
10
  const useFirstEOA_1 = require("../../hooks/useFirstEOA");
11
+ const IPFSMediaRenderer_1 = require("../IPFSMediaRenderer/IPFSMediaRenderer");
12
12
  const ProfileSection = () => {
13
13
  const account = (0, react_3.useActiveAccount)();
14
14
  const { address: eoaAddress } = (0, useFirstEOA_1.useFirstEOA)();
@@ -28,7 +28,6 @@ const ProfileSection = () => {
28
28
  return 0;
29
29
  return simBalance.balances.reduce((sum, token) => sum + (token.value_usd || 0), 0);
30
30
  }, [simBalance]);
31
- const avatarUrl = user?.avatar ? (0, ipfs_1.getIpfsUrl)(user?.avatar) : profile?.avatar;
32
31
  const handleEditAvatar = () => {
33
32
  setB3ModalOpen(true);
34
33
  setB3ModalContentType({
@@ -39,6 +38,10 @@ const ProfileSection = () => {
39
38
  },
40
39
  });
41
40
  };
42
- return ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between px-5 py-6", children: (0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile flex items-center gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile-avatar relative", children: [avatarUrl ? ((0, jsx_runtime_1.jsx)("img", { src: avatarUrl, alt: "Profile", className: "size-14 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "bg-b3-primary-wash size-14 rounded-full" })), (0, jsx_runtime_1.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: (0, jsx_runtime_1.jsx)(lucide_react_1.Pencil, { size: 10, className: "text-b3-background" }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile-info flex flex-col gap-1", children: [(0, jsx_runtime_1.jsxs)("h2", { className: "text-b3-grey font-neue-montreal-semibold flex h-[38px] items-center gap-1 text-xl", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted", children: " $" }), (0, jsx_runtime_1.jsx)("div", { className: "text-[30px]", children: (0, number_1.formatDisplayNumber)(totalBalanceUsd, { fractionDigits: 2 }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "font-neue-montreal-semibold text-base leading-none text-[#0B57C2]", children: profile?.displayName || (0, utils_1.formatUsername)(profile?.name || "") })] })] }) }));
41
+ // IPFSMediaRenderer will handle IPFS URL conversion and validation
42
+ const avatarSrc = user?.avatar || profile?.avatar;
43
+ // Get current username - prioritize user.username, fallback to profile data
44
+ const currentUsername = user?.username || profile?.displayName || (0, utils_1.formatUsername)(profile?.name || "");
45
+ return ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between px-5 py-6", children: (0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile flex items-center gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile-avatar relative", children: [(0, jsx_runtime_1.jsx)(IPFSMediaRenderer_1.IPFSMediaRenderer, { src: avatarSrc, alt: "Profile Avatar", className: "size-14 rounded-full" }), (0, jsx_runtime_1.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: (0, jsx_runtime_1.jsx)(lucide_react_1.Pencil, { size: 10, className: "text-b3-background" }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile-info flex flex-col gap-1", children: [(0, jsx_runtime_1.jsxs)("h2", { className: "text-b3-grey font-neue-montreal-semibold flex h-[38px] items-center gap-1 text-xl", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted", children: " $" }), (0, jsx_runtime_1.jsx)("div", { className: "text-[30px]", children: (0, number_1.formatDisplayNumber)(totalBalanceUsd, { fractionDigits: 2 }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "font-neue-montreal-semibold text-base leading-none text-[#0B57C2]", children: currentUsername })] })] }) }));
43
46
  };
44
47
  exports.default = ProfileSection;