@b3dotfun/sdk 0.0.34 → 0.0.35-alpha.1

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 (79) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.js +5 -3
  2. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +2 -2
  3. package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.d.ts +3 -1
  4. package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +5 -2
  5. package/dist/cjs/anyspend/react/components/common/CryptoPaySection.d.ts +16 -0
  6. package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +58 -0
  7. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.d.ts +1 -0
  8. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +22 -15
  9. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +12 -4
  10. package/dist/cjs/anyspend/react/components/common/PaySection.d.ts +2 -6
  11. package/dist/cjs/anyspend/react/components/common/PaySection.js +10 -15
  12. package/dist/cjs/anyspend/react/components/index.d.ts +2 -2
  13. package/dist/cjs/anyspend/react/components/index.js +5 -5
  14. package/dist/cjs/global-account/react/components/B3DynamicModal.js +1 -1
  15. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +6 -3
  16. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3.js +3 -3
  17. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +13 -1
  18. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +3 -1
  19. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +4 -1
  20. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +3 -0
  21. package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +1 -0
  22. package/dist/cjs/global-account/react/hooks/useAuthentication.js +20 -0
  23. package/dist/cjs/global-account/react/stores/useAuthStore.d.ts +4 -0
  24. package/dist/cjs/global-account/react/stores/useAuthStore.js +4 -0
  25. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +2 -0
  26. package/dist/esm/anyspend/react/components/AnySpend.js +5 -3
  27. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +2 -2
  28. package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.d.ts +3 -1
  29. package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +5 -2
  30. package/dist/esm/anyspend/react/components/common/CryptoPaySection.d.ts +16 -0
  31. package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +55 -0
  32. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.d.ts +1 -0
  33. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +22 -15
  34. package/dist/esm/anyspend/react/components/common/OrderDetails.js +12 -4
  35. package/dist/esm/anyspend/react/components/common/PaySection.d.ts +2 -6
  36. package/dist/esm/anyspend/react/components/common/PaySection.js +10 -15
  37. package/dist/esm/anyspend/react/components/index.d.ts +2 -2
  38. package/dist/esm/anyspend/react/components/index.js +2 -2
  39. package/dist/esm/global-account/react/components/B3DynamicModal.js +1 -1
  40. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +6 -3
  41. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3.js +3 -3
  42. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +13 -1
  43. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +3 -1
  44. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +4 -1
  45. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +3 -0
  46. package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +1 -0
  47. package/dist/esm/global-account/react/hooks/useAuthentication.js +21 -1
  48. package/dist/esm/global-account/react/stores/useAuthStore.d.ts +4 -0
  49. package/dist/esm/global-account/react/stores/useAuthStore.js +4 -0
  50. package/dist/esm/global-account/react/stores/useModalStore.d.ts +2 -0
  51. package/dist/styles/index.css +1 -1
  52. package/dist/types/anyspend/react/components/common/ConnectWalletPayment.d.ts +3 -1
  53. package/dist/types/anyspend/react/components/common/CryptoPaySection.d.ts +16 -0
  54. package/dist/types/anyspend/react/components/common/CryptoPaymentMethod.d.ts +1 -0
  55. package/dist/types/anyspend/react/components/common/PaySection.d.ts +2 -6
  56. package/dist/types/anyspend/react/components/index.d.ts +2 -2
  57. package/dist/types/global-account/react/hooks/useAuthentication.d.ts +1 -0
  58. package/dist/types/global-account/react/stores/useAuthStore.d.ts +4 -0
  59. package/dist/types/global-account/react/stores/useModalStore.d.ts +2 -0
  60. package/package.json +1 -1
  61. package/src/anyspend/react/components/AnySpend.tsx +7 -6
  62. package/src/anyspend/react/components/AnyspendDepositHype.tsx +2 -5
  63. package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +6 -1
  64. package/src/anyspend/react/components/common/CryptoPaySection.tsx +153 -0
  65. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +80 -43
  66. package/src/anyspend/react/components/common/OrderDetails.tsx +13 -4
  67. package/src/anyspend/react/components/common/PaySection.tsx +64 -140
  68. package/src/anyspend/react/components/index.ts +2 -2
  69. package/src/global-account/react/components/B3DynamicModal.tsx +1 -6
  70. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +92 -82
  71. package/src/global-account/react/components/SignInWithB3/SignInWithB3.tsx +3 -3
  72. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +13 -1
  73. package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +3 -1
  74. package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +5 -2
  75. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +3 -0
  76. package/src/global-account/react/hooks/useAuthentication.ts +24 -1
  77. package/src/global-account/react/stores/useAuthStore.ts +8 -0
  78. package/src/global-account/react/stores/useModalStore.ts +2 -0
  79. package/src/styles/index.css +5 -2
@@ -59,13 +59,14 @@ function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain
59
59
  const [unlinkingAccountId, setUnlinkingAccountId] = (0, react_2.useState)(null);
60
60
  const { data: profilesRaw = [], isLoading: isLoadingProfiles } = (0, react_3.useProfiles)({ client: thirdweb_1.client });
61
61
  const { mutate: unlinkProfile, isPending: isUnlinking } = (0, react_3.useUnlinkProfile)();
62
- const { setB3ModalOpen, setB3ModalContentType, isLinking } = (0, react_1.useModalStore)();
62
+ const { setB3ModalOpen, setB3ModalContentType, isLinking, contentType } = (0, react_1.useModalStore)();
63
63
  const { user, setUser } = (0, react_1.useB3)();
64
64
  const [isUpdatingCode, setIsUpdatingCode] = (0, react_2.useState)(false);
65
65
  const [newReferralCode, setNewReferralCode] = (0, react_2.useState)("");
66
66
  const [isEditingCode, setIsEditingCode] = (0, react_2.useState)(false);
67
67
  const referallCodeRef = (0, react_2.useRef)(null);
68
68
  const { data: referrals, isLoading: isLoadingReferrals } = (0, react_1.useQueryB3)("referrals", "find", { query: { referrerId: user?.userId } }, !!user?.userId);
69
+ const showReferralInfo = contentType?.showReferralInfo ?? false;
69
70
  const mutationOptions = {
70
71
  onError: (error) => {
71
72
  console.error("Error Unlinking account:", error);
@@ -151,7 +152,9 @@ function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain
151
152
  },
152
153
  });
153
154
  };
154
- return ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-8", children: [(0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-b3-grey font-neue-montreal-semibold text-xl", children: "Linked Accounts" }), (0, jsx_runtime_1.jsxs)(react_1.Button, { className: "bg-b3-primary-wash hover:bg-b3-primary-wash/70 flex items-center gap-2 rounded-full px-4 py-2", onClick: handleOpenLinkModal, disabled: isLinking, children: [isLinking ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-b3-primary-blue animate-spin", size: 16 })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.LinkIcon, { size: 16, className: "text-b3-primary-blue" })), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold", children: isLinking ? "Linking..." : "Link New Account" })] })] }), isLoadingProfiles ? ((0, jsx_runtime_1.jsx)("div", { className: "flex justify-center py-8", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-b3-grey animate-spin" }) })) : profiles.length > 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "space-y-4", children: profiles.map(profile => ((0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-line flex items-center justify-between rounded-xl p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [profile.imageUrl ? ((0, jsx_runtime_1.jsx)("img", { src: profile.imageUrl, alt: profile.title, className: "size-10 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "bg-b3-primary-wash flex h-10 w-10 items-center justify-center rounded-full", children: (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm uppercase", children: profile.initial }) })), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold", children: profile.title }), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-foreground-muted font-neue-montreal-medium bg-b3-primary-wash rounded px-2 py-0.5 text-xs", children: profile.type.toUpperCase() })] }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: profile.subtitle })] })] }), (0, jsx_runtime_1.jsx)(react_1.Button, { variant: "ghost", size: "icon", className: "text-b3-grey hover:text-b3-negative", onClick: () => handleUnlink(profile), disabled: unlinkingAccountId === profile.title || isUnlinking, children: unlinkingAccountId === profile.title || isUnlinking ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "animate-spin" })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.UnlinkIcon, { size: 16 })) })] }, profile.title))) })) : ((0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted py-8 text-center", children: "No linked accounts found" }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-b3-grey font-neue-montreal-semibold text-xl", children: "Referrals" }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-line rounded-xl p-4", children: [isEditingCode && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Your Referral Code" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Share this code with friends to earn rewards" })] })), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [!isEditingCode && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Your Referral Code" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Share this code with friends to earn rewards" })] })), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: isEditingCode ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("input", { type: "text", value: newReferralCode, onChange: e => setNewReferralCode(e.target.value), className: "rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm", placeholder: "Enter new code", ref: referallCodeRef }), (0, jsx_runtime_1.jsx)(react_1.Button, { size: "sm", onClick: handleUpdateReferralCode, disabled: isUpdatingCode || !newReferralCode, children: isUpdatingCode ? (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-4 w-4 animate-spin" }) : "Save" }), (0, jsx_runtime_1.jsx)(react_1.Button, { size: "sm", variant: "ghost", onClick: () => {
155
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-8", children: [(0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-b3-grey font-neue-montreal-semibold text-xl", children: "Linked Accounts" }), (0, jsx_runtime_1.jsxs)(react_1.Button, { className: "bg-b3-primary-wash hover:bg-b3-primary-wash/70 flex items-center gap-2 rounded-full px-4 py-2", onClick: handleOpenLinkModal, disabled: isLinking, children: [isLinking ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-b3-primary-blue animate-spin", size: 16 })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.LinkIcon, { size: 16, className: "text-b3-primary-blue" })), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold", children: isLinking ? "Linking..." : "Link New Account" })] })] }), isLoadingProfiles ? ((0, jsx_runtime_1.jsx)("div", { className: "flex justify-center py-8", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-b3-grey animate-spin" }) })) : profiles.length > 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "space-y-4", children: profiles.map(profile => ((0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-line flex items-center justify-between rounded-xl p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [profile.imageUrl ? ((0, jsx_runtime_1.jsx)("img", { src: profile.imageUrl, alt: profile.title, className: "size-10 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "bg-b3-primary-wash flex h-10 w-10 items-center justify-center rounded-full", children: (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm uppercase", children: profile.initial }) })), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold", children: profile.title }), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-foreground-muted font-neue-montreal-medium bg-b3-primary-wash rounded px-2 py-0.5 text-xs", children: profile.type.toUpperCase() })] }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: profile.subtitle })] })] }), (0, jsx_runtime_1.jsx)(react_1.Button, { variant: "ghost", size: "icon", className: "text-b3-grey hover:text-b3-negative", onClick: () => handleUnlink(profile), disabled: unlinkingAccountId === profile.title || isUnlinking, children: unlinkingAccountId === profile.title || isUnlinking ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "animate-spin" })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.UnlinkIcon, { size: 16 })) })] }, profile.title))) })) : ((0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted py-8 text-center", children: "No linked accounts found" }))] }), showReferralInfo && (
156
+ /* Referral Section */
157
+ (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-b3-grey font-neue-montreal-semibold text-xl", children: "Referrals" }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-line rounded-xl p-4", children: [isEditingCode && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Your Referral Code" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Share this code with friends to earn rewards" })] })), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [!isEditingCode && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Your Referral Code" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Share this code with friends to earn rewards" })] })), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: isEditingCode ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("input", { type: "text", value: newReferralCode, onChange: e => setNewReferralCode(e.target.value), className: "rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm", placeholder: "Enter new code", ref: referallCodeRef }), (0, jsx_runtime_1.jsx)(react_1.Button, { size: "sm", onClick: handleUpdateReferralCode, disabled: isUpdatingCode || !newReferralCode, children: isUpdatingCode ? (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-4 w-4 animate-spin" }) : "Save" }), (0, jsx_runtime_1.jsx)(react_1.Button, { size: "sm", variant: "ghost", onClick: () => {
155
158
  setIsEditingCode(false);
156
159
  setNewReferralCode("");
157
160
  }, children: "Cancel" })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm", children: currentReferralCode }), (0, jsx_runtime_1.jsx)(react_1.Button, { size: "icon", variant: "ghost", onClick: handleCopyCode, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "h-4 w-4" }) }), (0, jsx_runtime_1.jsx)(react_1.Button, { size: "icon", variant: "ghost", onClick: () => {
@@ -159,7 +162,7 @@ function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain
159
162
  setTimeout(() => {
160
163
  referallCodeRef.current?.focus();
161
164
  }, 100);
162
- }, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Pencil, { className: "h-4 w-4" }) })] })) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-line rounded-xl p-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold mb-4", children: "Referred Users" }), isLoadingReferrals ? ((0, jsx_runtime_1.jsx)("div", { className: "flex justify-center py-4", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-6 w-6 animate-spin text-gray-400" }) })) : referrals?.data?.length ? ((0, jsx_runtime_1.jsx)("div", { className: "space-y-3", children: referrals.data.map((referral) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between rounded-lg bg-white p-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-sm font-medium", children: referral.referreeId }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm text-gray-500", children: new Date(referral.createdAt).toLocaleDateString() })] }, String(referral._id)))) })) : ((0, jsx_runtime_1.jsx)("div", { className: "py-4 text-center text-gray-500", children: "No referred users yet" }))] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-b3-grey font-neue-montreal-semibold text-xl", children: "Account Preferences" }), (0, jsx_runtime_1.jsx)("div", { className: "bg-b3-line rounded-xl p-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Dark Mode" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Switch between light and dark theme" })] }), (0, jsx_runtime_1.jsx)("div", { className: "bg-b3-primary-wash h-6 w-12 rounded-full" })] }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "border-b3-line flex items-center justify-between rounded-2xl border p-4", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: "https://cdn.b3.fun/b3_logo.svg", alt: "B3", className: "h-4" }), (0, jsx_runtime_1.jsx)("h3", { className: "font-neue-montreal-semibold text-b3-grey", children: "Global Account" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-b3-foreground-muted font-neue-montreal-medium mt-2 text-sm", children: "Your universal account for all B3 apps" })] }), (0, jsx_runtime_1.jsx)("button", { className: "text-b3-grey hover:text-b3-grey/80 hover:bg-b3-line border-b3-line flex size-12 items-center justify-center rounded-full border", onClick: onLogoutEnhanced, children: logoutLoading ? (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "animate-spin" }) : (0, jsx_runtime_1.jsx)(SignOutIcon_1.SignOutIcon, { size: 16, className: "text-b3-grey" }) })] })] }));
165
+ }, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Pencil, { className: "h-4 w-4" }) })] })) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-line rounded-xl p-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold mb-4", children: "Referred Users" }), isLoadingReferrals ? ((0, jsx_runtime_1.jsx)("div", { className: "flex justify-center py-4", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-6 w-6 animate-spin text-gray-400" }) })) : referrals?.data?.length ? ((0, jsx_runtime_1.jsx)("div", { className: "space-y-3", children: referrals.data.map((referral) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between rounded-lg bg-white p-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-sm font-medium", children: referral.referreeId }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm text-gray-500", children: new Date(referral.createdAt).toLocaleDateString() })] }, String(referral._id)))) })) : ((0, jsx_runtime_1.jsx)("div", { className: "py-4 text-center text-gray-500", children: "No referred users yet" }))] })] })), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-b3-grey font-neue-montreal-semibold text-xl", children: "Account Preferences" }), (0, jsx_runtime_1.jsx)("div", { className: "bg-b3-line rounded-xl p-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Dark Mode" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Switch between light and dark theme" })] }), (0, jsx_runtime_1.jsx)("div", { className: "bg-b3-primary-wash h-6 w-12 rounded-full" })] }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "border-b3-line flex items-center justify-between rounded-2xl border p-4", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: "https://cdn.b3.fun/b3_logo.svg", alt: "B3", className: "h-4" }), (0, jsx_runtime_1.jsx)("h3", { className: "font-neue-montreal-semibold text-b3-grey", children: "Global Account" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-b3-foreground-muted font-neue-montreal-medium mt-2 text-sm", children: "Your universal account for all B3 apps" })] }), (0, jsx_runtime_1.jsx)("button", { className: "text-b3-grey hover:text-b3-grey/80 hover:bg-b3-line border-b3-line flex size-12 items-center justify-center rounded-full border", onClick: onLogoutEnhanced, children: logoutLoading ? (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "animate-spin" }) : (0, jsx_runtime_1.jsx)(SignOutIcon_1.SignOutIcon, { size: 16, className: "text-b3-grey" }) })] })] }));
163
166
  };
164
167
  return ((0, jsx_runtime_1.jsx)("div", { className: "b3-manage-account bg-b3-background flex flex-col rounded-xl", children: (0, jsx_runtime_1.jsx)("div", { className: "flex-1", children: (0, jsx_runtime_1.jsxs)(react_1.TabsPrimitive, { defaultValue: activeTab, onValueChange: value => {
165
168
  const tab = value;
@@ -9,7 +9,7 @@ const Loading_1 = require("../ui/Loading");
9
9
  function SignInWithB3(props) {
10
10
  const { setB3ModalOpen, setB3ModalContentType, setEcoSystemAccountAddress } = (0, react_1.useModalStore)();
11
11
  const { account } = (0, react_1.useB3)();
12
- const { isAuthenticating, isConnected } = (0, react_1.useAuthentication)(props.partnerId, props.loginWithSiwe);
12
+ const { isAuthenticatingV2, isAuthenticated } = (0, react_1.useAuthentication)(props.partnerId, props.loginWithSiwe);
13
13
  const isMobile = (0, react_1.useIsMobile)();
14
14
  (0, react_2.useEffect)(() => {
15
15
  if (account) {
@@ -24,10 +24,10 @@ function SignInWithB3(props) {
24
24
  });
25
25
  setB3ModalOpen(true);
26
26
  };
27
- if (isConnected) {
27
+ if (isAuthenticated) {
28
28
  return (0, jsx_runtime_1.jsx)(ManageAccountButton_1.ManageAccountButton, { ...props });
29
29
  }
30
- if (isAuthenticating) {
30
+ if (isAuthenticatingV2) {
31
31
  return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsxs)(react_1.Button, { disabled: true, style: { backgroundColor: "#3368ef" }, className: "flex items-center gap-2 text-white", children: [props.withLogo !== false && ((0, jsx_runtime_1.jsx)("img", { src: "https://cdn.b3.fun/b3_logo_white.svg", alt: "B3 Logo", className: "h-5 w-5" })), props.loadingButtonText || (isMobile ? (0, jsx_runtime_1.jsx)(Loading_1.Loading, { size: "sm" }) : "Signing in…")] }) }));
32
32
  }
33
33
  return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)(react_1.Button, { onClick: handleClick, style: { backgroundColor: "#3368ef" }, className: "b3-sign-in-button flex items-center gap-2 font-medium text-white", children: props.buttonText ? (props.buttonText) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { children: "Sign in with" }), props.withLogo !== false && ((0, jsx_runtime_1.jsx)("img", { src: "https://cdn.b3.fun/b3_logo_white.svg", alt: "B3 Logo", className: "h-5 w-6" }))] })) }) }));
@@ -22,6 +22,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
22
22
  const { setB3ModalContentType, setB3ModalOpen, isOpen } = (0, react_1.useModalStore)();
23
23
  const account = (0, react_3.useActiveAccount)();
24
24
  const setIsAuthenticating = (0, react_1.useAuthStore)(state => state.setIsAuthenticating);
25
+ const setIsAuthenticatingV2 = (0, react_1.useAuthStore)(state => state.setIsAuthenticatingV2);
25
26
  const isAuthenticating = (0, react_1.useAuthStore)(state => state.isAuthenticating);
26
27
  const isConnected = (0, react_1.useAuthStore)(state => state.isConnected);
27
28
  const setIsConnected = (0, react_1.useAuthStore)(state => state.setIsConnected);
@@ -166,6 +167,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
166
167
  if (loginWithSiwe) {
167
168
  debug("setIsAuthenticating:true:1");
168
169
  setIsAuthenticating(true);
170
+ setIsAuthenticatingV2(true);
169
171
  const userAuth = await authenticate(account, partnerId);
170
172
  setUser(userAuth.user);
171
173
  }
@@ -173,7 +175,17 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
173
175
  onLoginSuccess?.(account);
174
176
  debug("setIsAuthenticating:false:1");
175
177
  setIsAuthenticating(false);
176
- }, [loginWithSiwe, onLoginSuccess, setIsAuthenticating, authenticate, partnerId, setUser, setIsConnected]);
178
+ setIsAuthenticatingV2(false);
179
+ }, [
180
+ loginWithSiwe,
181
+ onLoginSuccess,
182
+ setIsAuthenticating,
183
+ authenticate,
184
+ partnerId,
185
+ setUser,
186
+ setIsConnected,
187
+ setIsAuthenticatingV2,
188
+ ]);
177
189
  (0, react_2.useEffect)(() => {
178
190
  if (step === "permissions") {
179
191
  setB3ModalContentType({
@@ -9,6 +9,7 @@ const debug = (0, debug_1.debugB3React)("SignInWithB3Privy");
9
9
  function SignInWithB3Privy({ onSuccess, onError, partnerId, chain }) {
10
10
  const { isLoading, connectTw, fullToken } = (0, react_1.useHandleConnectWithPrivy)(partnerId, chain, onSuccess);
11
11
  const setIsAuthenticating = (0, react_1.useAuthStore)(state => state.setIsAuthenticating);
12
+ const setIsAuthenticatingV2 = (0, react_1.useAuthStore)(state => state.setIsAuthenticatingV2);
12
13
  const setIsAuthenticated = (0, react_1.useAuthStore)(state => state.setIsAuthenticated);
13
14
  const { logout } = (0, react_1.useAuthentication)(partnerId);
14
15
  debug("@@SignInWithB3Privy", {
@@ -36,10 +37,11 @@ function SignInWithB3Privy({ onSuccess, onError, partnerId, chain }) {
36
37
  finally {
37
38
  debug("setIsAuthenticating:false:7");
38
39
  setIsAuthenticating(false);
40
+ setIsAuthenticatingV2(false);
39
41
  }
40
42
  }
41
43
  autoConnect();
42
- }, [connectTw, onSuccess, onError, setIsAuthenticating, setIsAuthenticated, logout]);
44
+ }, [connectTw, onSuccess, onError, setIsAuthenticating, setIsAuthenticated, logout, setIsAuthenticatingV2]);
43
45
  // Currently we auto login, so we can show loading immediately and the onSuccess will proceed to the next modal
44
46
  return ((0, jsx_runtime_1.jsx)("div", { className: "flex aspect-square items-center justify-center p-6", children: (0, jsx_runtime_1.jsx)(react_1.Loading, { variant: "white", size: "lg" }) }));
45
47
  }
@@ -17,7 +17,7 @@ function LoginStepContainer({ children, partnerId }) {
17
17
  },
18
18
  }, !!partnerId);
19
19
  const partnerLogo = partner?.data?.[0]?.loginCustomization?.logoUrl;
20
- return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center justify-center", children: [partnerLogo && ((0, jsx_runtime_1.jsx)("img", { src: partnerLogo, alt: "Partner Logo", className: "partner-logo mb-6 mt-6 h-12 w-auto object-contain" })), children, (0, jsx_runtime_1.jsxs)("h2", { className: "mt-6 flex items-center gap-2 text-lg font-bold", children: ["Powered by", (0, jsx_runtime_1.jsx)("img", { alt: "B3 Logo", className: "h-5", src: "https://cdn.b3.fun/b3_logo.svg" }), "Connect"] })] }));
20
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center justify-center pt-6", children: [partnerLogo && ((0, jsx_runtime_1.jsx)("img", { src: partnerLogo, alt: "Partner Logo", className: "partner-logo mb-6 h-12 w-auto object-contain" })), children, (0, jsx_runtime_1.jsxs)("h2", { className: "mt-6 flex items-center gap-2 text-lg font-bold", children: ["Powered by", (0, jsx_runtime_1.jsx)("img", { alt: "B3 Logo", className: "h-5", src: "https://cdn.b3.fun/b3_logo.svg" }), "Connect"] })] }));
21
21
  }
22
22
  function LoginStep({ onSuccess, onError, partnerId, chain }) {
23
23
  const wallet = (0, wallets_1.ecosystemWallet)(constants_1.ecosystemWalletId, {
@@ -25,6 +25,7 @@ function LoginStep({ onSuccess, onError, partnerId, chain }) {
25
25
  });
26
26
  const { theme } = (0, react_1.useB3)();
27
27
  const setIsAuthenticating = (0, react_1.useAuthStore)(state => state.setIsAuthenticating);
28
+ const setIsAuthenticatingV2 = (0, react_1.useAuthStore)(state => state.setIsAuthenticatingV2);
28
29
  const setIsAuthenticated = (0, react_1.useAuthStore)(state => state.setIsAuthenticated);
29
30
  const { logout } = (0, react_1.useAuthentication)(partnerId);
30
31
  return ((0, jsx_runtime_1.jsx)(LoginStepContainer, { partnerId: partnerId, children: (0, jsx_runtime_1.jsx)(react_2.ConnectEmbed, { showThirdwebBranding: false, client: thirdweb_1.client, chain: chain, wallets: [wallet], theme: theme === "light"
@@ -65,6 +66,7 @@ function LoginStep({ onSuccess, onError, partnerId, chain }) {
65
66
  }, className: "b3-login-step", onConnect: async (wallet) => {
66
67
  try {
67
68
  setIsAuthenticating(true);
69
+ setIsAuthenticatingV2(true);
68
70
  (0, debug_1.debug)("setIsAuthenticating:true:6");
69
71
  const account = wallet.getAccount();
70
72
  if (!account)
@@ -81,6 +83,7 @@ function LoginStep({ onSuccess, onError, partnerId, chain }) {
81
83
  finally {
82
84
  (0, debug_1.debug)("setIsAuthenticating:false:6");
83
85
  setIsAuthenticating(false);
86
+ setIsAuthenticatingV2(false);
84
87
  }
85
88
  } }) }));
86
89
  }
@@ -13,6 +13,7 @@ function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, max
13
13
  const [showAllWallets, setShowAllWallets] = (0, react_2.useState)(false);
14
14
  const { connect } = (0, react_1.useConnect)(partnerId, chain);
15
15
  const setIsAuthenticating = (0, react_1.useAuthStore)(state => state.setIsAuthenticating);
16
+ const setIsAuthenticatingV2 = (0, react_1.useAuthStore)(state => state.setIsAuthenticatingV2);
16
17
  const setIsAuthenticated = (0, react_1.useAuthStore)(state => state.setIsAuthenticated);
17
18
  const { logout } = (0, react_1.useAuthentication)(partnerId);
18
19
  const { connect: connectTW } = (0, react_3.useConnect)();
@@ -26,6 +27,7 @@ function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, max
26
27
  setIsLoading(true);
27
28
  (0, debug_1.debug)("setIsAuthenticating:true:3");
28
29
  setIsAuthenticating(true);
30
+ setIsAuthenticatingV2(true);
29
31
  const options = (0, react_1.getConnectOptionsFromStrategy)(strategy);
30
32
  let connectResult;
31
33
  if (automaticallySetFirstEoa) {
@@ -60,6 +62,7 @@ function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, max
60
62
  setIsLoading(false);
61
63
  (0, debug_1.debug)("setIsAuthenticating:false:3");
62
64
  setIsAuthenticating(false);
65
+ setIsAuthenticatingV2(false);
63
66
  }
64
67
  };
65
68
  return ((0, jsx_runtime_1.jsxs)(react_1.LoginStepContainer, { partnerId: partnerId, children: [authStrategies.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: "mb-6 grid w-full grid-cols-4 gap-4", children: authStrategies.map(strategy => {
@@ -9,4 +9,5 @@ export declare function useAuthentication(partnerId: string, loginWithSiwe?: boo
9
9
  wallet: import("thirdweb/dist/types/wallets/in-app/core/wallet/types").EcosystemWallet;
10
10
  preAuthenticate: typeof preAuthenticate;
11
11
  connect: (strategyOptions?: import("thirdweb/wallets").SingleStepAuthArgsType) => Promise<import("thirdweb/wallets").Wallet | null>;
12
+ isAuthenticatingV2: boolean;
12
13
  };
@@ -31,6 +31,11 @@ function useAuthentication(partnerId, loginWithSiwe) {
31
31
  const setIsConnected = (0, react_1.useAuthStore)(state => state.setIsConnected);
32
32
  const isConnecting = (0, react_1.useAuthStore)(state => state.isConnecting);
33
33
  const isConnected = (0, react_1.useAuthStore)(state => state.isConnected);
34
+ const useAutoConnectLoadingPrevious = (0, react_2.useRef)(false);
35
+ const setIsAuthenticatingV2 = (0, react_1.useAuthStore)(state => state.setIsAuthenticatingV2);
36
+ const isAuthenticatingV2 = (0, react_1.useAuthStore)(state => state.isAuthenticatingV2);
37
+ const hasStartedConnecting = (0, react_1.useAuthStore)(state => state.hasStartedConnecting);
38
+ const setHasStartedConnecting = (0, react_1.useAuthStore)(state => state.setHasStartedConnecting);
34
39
  const { connect } = (0, useConnect_1.useConnect)(partnerId, supported_1.b3MainnetThirdWeb);
35
40
  const wallet = (0, wallets_1.ecosystemWallet)(constants_1.ecosystemWalletId, {
36
41
  partnerId: partnerId,
@@ -39,11 +44,13 @@ function useAuthentication(partnerId, loginWithSiwe) {
39
44
  client: thirdweb_1.client,
40
45
  wallets: [wallet],
41
46
  onConnect: async (wallet) => {
47
+ setHasStartedConnecting(true);
42
48
  try {
43
49
  setIsConnected(true);
44
50
  if (!loginWithSiwe) {
45
51
  debug("Skipping SIWE login", { loginWithSiwe });
46
52
  setIsAuthenticated(true);
53
+ setIsAuthenticatingV2(false);
47
54
  return;
48
55
  }
49
56
  debug("setIsAuthenticating:true:4");
@@ -57,6 +64,7 @@ function useAuthentication(partnerId, loginWithSiwe) {
57
64
  const userAuth = await app_1.default.reAuthenticate();
58
65
  setUser(userAuth.user);
59
66
  setIsAuthenticated(true);
67
+ setIsAuthenticatingV2(false);
60
68
  debug("Re-authenticated successfully", { userAuth });
61
69
  }
62
70
  catch (error) {
@@ -65,6 +73,7 @@ function useAuthentication(partnerId, loginWithSiwe) {
65
73
  const userAuth = await authenticate(account, partnerId);
66
74
  setUser(userAuth.user);
67
75
  setIsAuthenticated(true);
76
+ setIsAuthenticatingV2(false);
68
77
  debug("Fresh authentication successful", { userAuth });
69
78
  }
70
79
  }
@@ -74,8 +83,18 @@ function useAuthentication(partnerId, loginWithSiwe) {
74
83
  debug("setIsAuthenticating:false:4");
75
84
  setUser();
76
85
  }
86
+ setIsAuthenticatingV2(false);
77
87
  },
78
88
  });
89
+ /**
90
+ * useAutoConnectLoading starts as false
91
+ */
92
+ (0, react_2.useEffect)(() => {
93
+ if (!useAutoConnectLoading && useAutoConnectLoadingPrevious.current && !hasStartedConnecting) {
94
+ setIsAuthenticatingV2(false);
95
+ }
96
+ useAutoConnectLoadingPrevious.current = useAutoConnectLoading;
97
+ }, [useAutoConnectLoading]);
79
98
  // Ensure isAuthenticating stays true until we're fully ready
80
99
  (0, react_2.useEffect)(() => {
81
100
  if (useAutoConnectLoading) {
@@ -134,5 +153,6 @@ function useAuthentication(partnerId, loginWithSiwe) {
134
153
  wallet,
135
154
  preAuthenticate: in_app_1.preAuthenticate,
136
155
  connect,
156
+ isAuthenticatingV2,
137
157
  };
138
158
  }
@@ -25,6 +25,10 @@ interface AuthState {
25
25
  onError?: (error: Error) => void;
26
26
  }) => void;
27
27
  reset: () => void;
28
+ isAuthenticatingV2: boolean;
29
+ setIsAuthenticatingV2: (isAuthenticating: boolean) => void;
30
+ hasStartedConnecting: boolean;
31
+ setHasStartedConnecting: (hasStartedConnecting: boolean) => void;
28
32
  }
29
33
  export declare const useAuthStore: import("zustand").UseBoundStore<import("zustand").StoreApi<AuthState>>;
30
34
  export {};
@@ -40,4 +40,8 @@ exports.useAuthStore = (0, zustand_1.create)(set => ({
40
40
  onSuccess: undefined,
41
41
  onError: undefined,
42
42
  }),
43
+ isAuthenticatingV2: true,
44
+ setIsAuthenticatingV2: isAuthenticating => set({ isAuthenticatingV2: isAuthenticating }),
45
+ hasStartedConnecting: false,
46
+ setHasStartedConnecting: hasStartedConnecting => set({ hasStartedConnecting }),
43
47
  }));
@@ -82,6 +82,8 @@ export interface ManageAccountModalProps extends BaseModalProps {
82
82
  activeTab?: "overview" | "tokens" | "nfts" | "apps" | "settings";
83
83
  /** Function to set the active tab */
84
84
  setActiveTab?: (tab: "overview" | "tokens" | "nfts" | "apps" | "settings") => void;
85
+ /** Whether to show the referral information */
86
+ showReferralInfo?: boolean;
85
87
  }
86
88
  /**
87
89
  * Props for the AnySpend modal
@@ -14,6 +14,7 @@ import { parseUnits } from "viem";
14
14
  import { base, mainnet } from "viem/chains";
15
15
  import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper.js";
16
16
  import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPaymentMethod.js";
17
+ import { CryptoPaySection } from "./common/CryptoPaySection.js";
17
18
  import { CryptoReceiveSection } from "./common/CryptoReceiveSection.js";
18
19
  import { ErrorSection } from "./common/ErrorSection.js";
19
20
  import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod.js";
@@ -22,7 +23,6 @@ import { OrderHistory } from "./common/OrderHistory.js";
22
23
  import { OrderStatus } from "./common/OrderStatus.js";
23
24
  import { PanelOnramp } from "./common/PanelOnramp.js";
24
25
  import { PanelOnrampPayment } from "./common/PanelOnrampPayment.js";
25
- import { PaySection } from "./common/PaySection.js";
26
26
  import { RecipientSelection } from "./common/RecipientSelection.js";
27
27
  import { TabSection } from "./common/TabSection.js";
28
28
  export var PanelView;
@@ -444,7 +444,8 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
444
444
  return { text: "Choose payment method", disable: false, error: false };
445
445
  }
446
446
  // If payment method selected, show appropriate action
447
- if (selectedCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET) {
447
+ if (selectedCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ||
448
+ selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET) {
448
449
  return { text: "Swap", disable: false, error: false };
449
450
  }
450
451
  if (selectedCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO) {
@@ -501,6 +502,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
501
502
  }
502
503
  // If payment method is selected, create order with payment method info
503
504
  if (selectedCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ||
505
+ selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET ||
504
506
  selectedCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO) {
505
507
  console.log("Creating crypto order with payment method:", selectedCryptoPaymentMethod);
506
508
  await handleCryptoSwap(selectedCryptoPaymentMethod);
@@ -655,7 +657,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
655
657
  setActivePanel(PanelView.MAIN);
656
658
  setSelectedCryptoPaymentMethod(CryptoPaymentMethodType.NONE); // Reset payment method when going back
657
659
  } })] })) }) }));
658
- const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [isBuyMode && (_jsxs("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && (_jsx("div", { className: "relative", children: _jsx("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), _jsx("div", { children: _jsxs("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), _jsx(TabSection, { activeTab: activeTab, setActiveTab: setActiveTab, setSelectedCryptoPaymentMethod: setSelectedCryptoPaymentMethod, setSelectedFiatPaymentMethod: setSelectedFiatPaymentMethod }), _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? (_jsx(PaySection, { paymentType: "crypto", selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, selectedFiatPaymentMethod: selectedFiatPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), onSelectFiatPaymentMethod: () => setActivePanel(PanelView.FIAT_PAYMENT_METHOD), anyspendQuote: anyspendQuote })) : (_jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: recipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode }) })), _jsx(Button, { variant: "ghost", className: cn("border-as-stroke bg-as-surface-primary absolute left-1/2 top-1/2 z-10 h-10 w-10 -translate-x-1/2 -translate-y-1/2 rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl", isBuyMode && "top-[calc(50%+56px)] cursor-default", activeTab === "fiat" && "hidden"), onClick: () => {
660
+ const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [isBuyMode && (_jsxs("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && (_jsx("div", { className: "relative", children: _jsx("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), _jsx("div", { children: _jsxs("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), _jsx(TabSection, { activeTab: activeTab, setActiveTab: setActiveTab, setSelectedCryptoPaymentMethod: setSelectedCryptoPaymentMethod, setSelectedFiatPaymentMethod: setSelectedFiatPaymentMethod }), _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? (_jsx(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), anyspendQuote: anyspendQuote })) : (_jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: recipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode }) })), _jsx(Button, { variant: "ghost", className: cn("border-as-stroke bg-as-surface-primary absolute left-1/2 top-1/2 z-10 h-10 w-10 -translate-x-1/2 -translate-y-1/2 rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl", isBuyMode && "top-[calc(50%+56px)] cursor-default", activeTab === "fiat" && "hidden"), onClick: () => {
659
661
  if (activeTab === "fiat" || isBuyMode) {
660
662
  return;
661
663
  }
@@ -9,13 +9,13 @@ import { toast } from "sonner";
9
9
  import { base } from "viem/chains";
10
10
  import { PanelView, useAnyspendFlow } from "../hooks/useAnyspendFlow.js";
11
11
  import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper.js";
12
+ import { CryptoPaySection } from "./common/CryptoPaySection.js";
12
13
  import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPaymentMethod.js";
13
14
  import { CryptoReceiveSection } from "./common/CryptoReceiveSection.js";
14
15
  import { ErrorSection } from "./common/ErrorSection.js";
15
16
  import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod.js";
16
17
  import { OrderDetails } from "./common/OrderDetails.js";
17
18
  import { OrderStatus } from "./common/OrderStatus.js";
18
- import { PaySection } from "./common/PaySection.js";
19
19
  import { RecipientSelection } from "./common/RecipientSelection.js";
20
20
  import { ArrowDown } from "lucide-react";
21
21
  import { PanelOnramp } from "./common/PanelOnramp.js";
@@ -112,7 +112,7 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
112
112
  await handleFiatOrder();
113
113
  }
114
114
  };
115
- const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [_jsx("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: _jsx("div", { children: _jsx("h1", { className: "text-as-primary text-xl font-bold", children: paymentType === "crypto" ? "Deposit Crypto" : "Fund with Fiat" }) }) }), _jsx("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [paymentType === "crypto" ? (_jsx(PaySection, { paymentType: "crypto", selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, selectedFiatPaymentMethod: selectedFiatPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), onSelectFiatPaymentMethod: () => setActivePanel(PanelView.FIAT_PAYMENT_METHOD), anyspendQuote: anyspendQuote })) : (_jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmount, setSrcAmountOnRamp: setSrcAmount, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: recipientAddress, destinationToken: B3_TOKEN, destinationChainId: base.id, dstTokenSymbol: HYPE_TOKEN_DETAILS.SYMBOL, hideDstToken: true, destinationAmount: dstAmount, onDestinationTokenChange: () => { }, onDestinationChainChange: () => { }, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION }) })), _jsx("div", { className: cn("relative -my-1 flex h-0 items-center justify-center", paymentType === "fiat" && "hidden"), children: _jsx(Button, { variant: "ghost", className: cn("swap-direction-button border-as-stroke bg-as-surface-primary z-10 h-10 w-10 cursor-default rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl"), children: _jsx("div", { className: "relative flex items-center justify-center transition-opacity", children: _jsx(ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }) }), paymentType === "crypto" && (_jsx(CryptoReceiveSection, { isDepositMode: false, isBuyMode: true, selectedRecipientAddress: recipientAddress, recipientName: recipientName || undefined, onSelectRecipient: () => setActivePanel(PanelView.RECIPIENT_SELECTION), dstAmount: dstAmount, dstToken: B3_TOKEN, dstTokenSymbol: HYPE_TOKEN_DETAILS.SYMBOL, dstTokenLogoURI: HYPE_TOKEN_DETAILS.LOGO_URI, selectedDstChainId: base.id, setSelectedDstChainId: () => { }, setSelectedDstToken: () => { }, onChangeDstAmount: value => {
115
+ const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [_jsx("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: _jsx("div", { children: _jsx("h1", { className: "text-as-primary text-xl font-bold", children: paymentType === "crypto" ? "Deposit Crypto" : "Fund with Fiat" }) }) }), _jsx("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [paymentType === "crypto" ? (_jsx(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), anyspendQuote: anyspendQuote })) : (_jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmount, setSrcAmountOnRamp: setSrcAmount, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: recipientAddress, destinationToken: B3_TOKEN, destinationChainId: base.id, dstTokenSymbol: HYPE_TOKEN_DETAILS.SYMBOL, hideDstToken: true, destinationAmount: dstAmount, onDestinationTokenChange: () => { }, onDestinationChainChange: () => { }, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION }) })), _jsx("div", { className: cn("relative -my-1 flex h-0 items-center justify-center", paymentType === "fiat" && "hidden"), children: _jsx(Button, { variant: "ghost", className: cn("swap-direction-button border-as-stroke bg-as-surface-primary z-10 h-10 w-10 cursor-default rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl"), children: _jsx("div", { className: "relative flex items-center justify-center transition-opacity", children: _jsx(ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }) }), paymentType === "crypto" && (_jsx(CryptoReceiveSection, { isDepositMode: false, isBuyMode: true, selectedRecipientAddress: recipientAddress, recipientName: recipientName || undefined, onSelectRecipient: () => setActivePanel(PanelView.RECIPIENT_SELECTION), dstAmount: dstAmount, dstToken: B3_TOKEN, dstTokenSymbol: HYPE_TOKEN_DETAILS.SYMBOL, dstTokenLogoURI: HYPE_TOKEN_DETAILS.LOGO_URI, selectedDstChainId: base.id, setSelectedDstChainId: () => { }, setSelectedDstToken: () => { }, onChangeDstAmount: value => {
116
116
  setIsSrcInputDirty(false);
117
117
  setSrcAmount(value);
118
118
  }, anyspendQuote: anyspendQuote }))] }) }), _jsx(ErrorSection, { error: getAnyspendQuoteError }), _jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: cn("mt-4 flex w-full max-w-[460px] flex-col gap-2", getAnyspendQuoteError && "mt-0"), children: _jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: cn("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: btnInfo.text }) }), mainFooter ? mainFooter : null] }));
@@ -1,4 +1,5 @@
1
1
  import { components } from "../../../../anyspend/types/api";
2
+ import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
2
3
  type Tournament = components["schemas"]["Tournament"];
3
4
  type NFT = components["schemas"]["NFT"];
4
5
  interface ConnectWalletPaymentProps {
@@ -10,6 +11,7 @@ interface ConnectWalletPaymentProps {
10
11
  phantomWalletAddress?: string | null;
11
12
  tournament?: Tournament;
12
13
  nft?: NFT;
14
+ cryptoPaymentMethod: CryptoPaymentMethodType;
13
15
  }
14
- export default function ConnectWalletPayment({ order, onPayment, txLoading, isSwitchingOrExecuting, phantomWalletAddress, tournament, nft, }: ConnectWalletPaymentProps): import("react/jsx-runtime").JSX.Element;
16
+ export default function ConnectWalletPayment({ order, onPayment, txLoading, isSwitchingOrExecuting, phantomWalletAddress, tournament, nft, cryptoPaymentMethod, }: ConnectWalletPaymentProps): import("react/jsx-runtime").JSX.Element;
15
17
  export {};
@@ -7,8 +7,9 @@ import { formatTokenAmount } from "../../../../shared/utils/number.js";
7
7
  import { motion } from "framer-motion";
8
8
  import { ChevronRight, Loader2 } from "lucide-react";
9
9
  import { useAccount } from "wagmi";
10
+ import { CryptoPaymentMethodType } from "./CryptoPaymentMethod.js";
10
11
  import { OrderDetailsCollapsible } from "./OrderDetailsCollapsible.js";
11
- export default function ConnectWalletPayment({ order, onPayment, txLoading, isSwitchingOrExecuting, phantomWalletAddress, tournament, nft, }) {
12
+ export default function ConnectWalletPayment({ order, onPayment, txLoading, isSwitchingOrExecuting, phantomWalletAddress, tournament, nft, cryptoPaymentMethod, }) {
12
13
  const profile = useProfile({ address: order.recipientAddress });
13
14
  const recipientName = profile.data?.name?.replace(/\.b3\.fun/g, "");
14
15
  const { address: connectedAddress } = useAccount();
@@ -26,7 +27,9 @@ export default function ConnectWalletPayment({ order, onPayment, txLoading, isSw
26
27
  }
27
28
  return (_jsx("div", { className: "flex w-full flex-col items-center gap-6", children: _jsxs(motion.div, { initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, transition: { delay: 0.5 }, className: "flex w-full flex-col items-center gap-2", children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "flex w-5/6 max-w-[400px] items-center gap-2 sm:px-0", disabled: txLoading || isSwitchingOrExecuting, onClick: onPayment, children: txLoading ? (_jsxs(_Fragment, { children: ["Transaction Pending", _jsx(Loader2, { className: "ml-2 h-5 w-5 animate-spin" })] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "whitespace-nowrap pl-4 text-lg md:text-sm", children: order.srcChain === RELAY_SOLANA_MAINNET_CHAIN_ID && phantomWalletAddress
28
29
  ? "Pay from Phantom Wallet"
29
- : "Pay from Connected Wallet" }), _jsx(ChevronRight, { className: "h-4 w-4" })] })) }), _jsxs("span", { className: "label-style text-as-primary/50 text-xs", children: ["Connected to:", " ", order.srcChain === RELAY_SOLANA_MAINNET_CHAIN_ID && phantomWalletAddress
30
+ : cryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
31
+ ? "Pay from Global Account"
32
+ : "Pay from Connected Wallet" }), _jsx(ChevronRight, { className: "h-4 w-4" })] })) }), _jsxs("span", { className: "label-style text-as-primary/50 text-xs", children: ["Connected to:", " ", order.srcChain === RELAY_SOLANA_MAINNET_CHAIN_ID && phantomWalletAddress
30
33
  ? centerTruncate(phantomWalletAddress, 6)
31
34
  : centerTruncate(connectedAddress || "")] }), _jsx("div", { className: "mt-4", children: _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }) })] }) }));
32
35
  }
@@ -0,0 +1,16 @@
1
+ import { components } from "../../../types/api";
2
+ import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
3
+ interface CryptoPaySectionProps {
4
+ selectedSrcChainId: number;
5
+ setSelectedSrcChainId: (chainId: number) => void;
6
+ selectedSrcToken: components["schemas"]["Token"];
7
+ setSelectedSrcToken: (token: components["schemas"]["Token"]) => void;
8
+ srcAmount: string;
9
+ setSrcAmount: (amount: string) => void;
10
+ setIsSrcInputDirty: (dirty: boolean) => void;
11
+ selectedCryptoPaymentMethod: CryptoPaymentMethodType;
12
+ onSelectCryptoPaymentMethod: () => void;
13
+ anyspendQuote?: any;
14
+ }
15
+ export declare function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, setIsSrcInputDirty, selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod, anyspendQuote, }: CryptoPaySectionProps): import("react/jsx-runtime").JSX.Element;
16
+ export {};
@@ -0,0 +1,55 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useAccountWallet, useProfile, useTokenData } from "../../../../global-account/react/index.js";
3
+ import { formatUsername } from "../../../../shared/utils/index.js";
4
+ import { shortenAddress } from "../../../../shared/utils/formatAddress.js";
5
+ import { formatDisplayNumber } from "../../../../shared/utils/number.js";
6
+ import { ChevronRight } from "lucide-react";
7
+ import { motion } from "motion/react";
8
+ import { useEffect, useRef } from "react";
9
+ import { useAccount } from "wagmi";
10
+ import { CryptoPaymentMethodType } from "./CryptoPaymentMethod.js";
11
+ import { OrderTokenAmount } from "./OrderTokenAmount.js";
12
+ import { TokenBalance } from "./TokenBalance.js";
13
+ export function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, setIsSrcInputDirty, selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod, anyspendQuote, }) {
14
+ const { address: connectedAddress, isConnected } = useAccount();
15
+ const { data: profileData } = useProfile({ address: connectedAddress });
16
+ const connectedName = profileData?.displayName;
17
+ const { address: globalAddress } = useAccountWallet();
18
+ const { data: srcTokenMetadata } = useTokenData(selectedSrcToken?.chainId, selectedSrcToken?.address);
19
+ // Determine which address to use based on payment method
20
+ const walletAddress = selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET ? globalAddress : connectedAddress;
21
+ // Add ref to track if we've applied metadata
22
+ const appliedSrcMetadataRef = useRef(false);
23
+ // Update source token with metadata
24
+ useEffect(() => {
25
+ if (selectedSrcToken && srcTokenMetadata && !appliedSrcMetadataRef.current) {
26
+ // Mark as applied
27
+ appliedSrcMetadataRef.current = true;
28
+ const enhancedToken = {
29
+ ...selectedSrcToken,
30
+ decimals: srcTokenMetadata.decimals || selectedSrcToken.decimals,
31
+ symbol: srcTokenMetadata.symbol || selectedSrcToken.symbol,
32
+ name: srcTokenMetadata.name || selectedSrcToken.name,
33
+ metadata: {
34
+ ...selectedSrcToken.metadata,
35
+ logoURI: srcTokenMetadata?.logoURI || selectedSrcToken.metadata.logoURI,
36
+ },
37
+ };
38
+ setSelectedSrcToken(enhancedToken);
39
+ }
40
+ }, [srcTokenMetadata, selectedSrcToken, setSelectedSrcToken]);
41
+ // Reset source token ref when address/chain changes
42
+ useEffect(() => {
43
+ appliedSrcMetadataRef.current = false;
44
+ }, [selectedSrcToken.address, selectedSrcToken.chainId]);
45
+ return (_jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: "pay-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary/50 flex h-7 items-center text-sm", children: "Pay" }), _jsx("button", { className: "text-as-tertiarry flex h-7 items-center gap-2 text-sm transition-colors focus:!outline-none", onClick: onSelectCryptoPaymentMethod, children: selectedCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ? (_jsxs(_Fragment, { children: [isConnected ? (_jsx("div", { className: "flex items-center gap-1", children: connectedName ? formatUsername(connectedName) : shortenAddress(connectedAddress || "") })) : ("Connect wallet"), _jsx(ChevronRight, { className: "h-4 w-4" })] })) : selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET ? (_jsxs(_Fragment, { children: ["Global Account", _jsx(ChevronRight, { className: "h-4 w-4" })] })) : selectedCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO ? (_jsxs(_Fragment, { children: ["Transfer crypto", _jsx(ChevronRight, { className: "h-4 w-4" })] })) : (_jsxs(_Fragment, { children: ["Select payment method", _jsx(ChevronRight, { className: "h-4 w-4" })] })) })] }), _jsx(OrderTokenAmount, { address: walletAddress, context: "from", inputValue: srcAmount, onChangeInput: value => {
46
+ setIsSrcInputDirty(true);
47
+ setSrcAmount(value);
48
+ }, chainId: selectedSrcChainId, setChainId: setSelectedSrcChainId, token: selectedSrcToken, setToken: setSelectedSrcToken }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary/50 flex h-5 items-center text-sm", children: formatDisplayNumber(anyspendQuote?.data?.currencyIn?.amountUsd, {
49
+ style: "currency",
50
+ fallback: "",
51
+ }) }), _jsx(TokenBalance, { token: selectedSrcToken, walletAddress: walletAddress, onChangeInput: value => {
52
+ setIsSrcInputDirty(true);
53
+ setSrcAmount(value);
54
+ } })] })] }));
55
+ }
@@ -1,6 +1,7 @@
1
1
  export declare enum CryptoPaymentMethodType {
2
2
  NONE = "none",
3
3
  CONNECT_WALLET = "connect_wallet",
4
+ GLOBAL_WALLET = "global_wallet",
4
5
  TRANSFER_CRYPTO = "transfer_crypto"
5
6
  }
6
7
  interface CryptoPaymentMethodProps {