@b3dotfun/sdk 0.1.69-alpha.0 → 0.1.69-alpha.10

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 (137) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +1 -1
  2. package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +1 -1
  3. package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.js +2 -4
  4. package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.d.ts +2 -1
  5. package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.js +5 -3
  6. package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.js +1 -2
  7. package/dist/cjs/anyspend/react/components/checkout/KycGate.js +1 -2
  8. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +5 -0
  9. package/dist/cjs/anyspend/react/components/common/OrderStatus.js +37 -6
  10. package/dist/cjs/anyspend/react/components/common/StepProgress.d.ts +2 -0
  11. package/dist/cjs/anyspend/react/components/common/StepProgress.js +7 -2
  12. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +4 -6
  13. package/dist/cjs/anyspend/react/hooks/useKycStatus.d.ts +3 -1
  14. package/dist/cjs/anyspend/react/hooks/useKycStatus.js +11 -7
  15. package/dist/cjs/app.shared.js +9 -7
  16. package/dist/cjs/global-account/react/components/B3DynamicModal.js +5 -2
  17. package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +3 -1
  18. package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.js +2 -1
  19. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +5 -2
  20. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +3 -3
  21. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +2 -1
  22. package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
  23. package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.js +3 -1
  24. package/dist/cjs/global-account/react/components/ManageAccount/SessionDurationContent.d.ts +5 -0
  25. package/dist/cjs/global-account/react/components/ManageAccount/SessionDurationContent.js +57 -0
  26. package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.js +12 -29
  27. package/dist/cjs/global-account/react/components/SignInWithB3/components/AuthButton.js +10 -1
  28. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +96 -15
  29. package/dist/cjs/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +5 -3
  30. package/dist/cjs/global-account/react/components/SignInWithB3/utils/signInUtils.js +15 -2
  31. package/dist/cjs/global-account/react/components/Toast/ToastContext.d.ts +3 -0
  32. package/dist/cjs/global-account/react/components/Toast/ToastContext.js +30 -7
  33. package/dist/cjs/global-account/react/hooks/useAuth.js +26 -15
  34. package/dist/cjs/global-account/react/hooks/useAuthentication.js +23 -12
  35. package/dist/cjs/global-account/react/hooks/useAutoSelectWallet.d.ts +6 -3
  36. package/dist/cjs/global-account/react/hooks/useAutoSelectWallet.js +31 -3
  37. package/dist/cjs/global-account/react/hooks/useConnect.d.ts +2 -2
  38. package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +8 -8
  39. package/dist/cjs/global-account/react/hooks/useTWAuth.js +0 -1
  40. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +10 -1
  41. package/dist/cjs/global-account/react/utils/createWagmiConfig.d.ts +0 -18
  42. package/dist/cjs/global-account/react/utils/createWagmiConfig.js +0 -17
  43. package/dist/cjs/shared/utils/session-duration.d.ts +15 -0
  44. package/dist/cjs/shared/utils/session-duration.js +69 -0
  45. package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +2 -2
  46. package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
  47. package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.js +2 -4
  48. package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.d.ts +2 -1
  49. package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.js +5 -3
  50. package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.js +2 -3
  51. package/dist/esm/anyspend/react/components/checkout/KycGate.js +2 -3
  52. package/dist/esm/anyspend/react/components/common/OrderDetails.js +6 -1
  53. package/dist/esm/anyspend/react/components/common/OrderStatus.js +34 -3
  54. package/dist/esm/anyspend/react/components/common/StepProgress.d.ts +2 -0
  55. package/dist/esm/anyspend/react/components/common/StepProgress.js +4 -2
  56. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +5 -7
  57. package/dist/esm/anyspend/react/hooks/useKycStatus.d.ts +3 -1
  58. package/dist/esm/anyspend/react/hooks/useKycStatus.js +9 -5
  59. package/dist/esm/app.shared.js +9 -7
  60. package/dist/esm/global-account/react/components/B3DynamicModal.js +5 -2
  61. package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +3 -1
  62. package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.js +2 -1
  63. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +5 -2
  64. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +3 -3
  65. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +2 -1
  66. package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
  67. package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.js +3 -1
  68. package/dist/esm/global-account/react/components/ManageAccount/SessionDurationContent.d.ts +5 -0
  69. package/dist/esm/global-account/react/components/ManageAccount/SessionDurationContent.js +52 -0
  70. package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.js +12 -29
  71. package/dist/esm/global-account/react/components/SignInWithB3/components/AuthButton.js +11 -2
  72. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +100 -19
  73. package/dist/esm/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +5 -3
  74. package/dist/esm/global-account/react/components/SignInWithB3/utils/signInUtils.js +14 -1
  75. package/dist/esm/global-account/react/components/Toast/ToastContext.d.ts +3 -0
  76. package/dist/esm/global-account/react/components/Toast/ToastContext.js +30 -7
  77. package/dist/esm/global-account/react/hooks/useAuth.js +28 -17
  78. package/dist/esm/global-account/react/hooks/useAuthentication.js +24 -13
  79. package/dist/esm/global-account/react/hooks/useAutoSelectWallet.d.ts +6 -3
  80. package/dist/esm/global-account/react/hooks/useAutoSelectWallet.js +33 -5
  81. package/dist/esm/global-account/react/hooks/useConnect.d.ts +2 -2
  82. package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +8 -8
  83. package/dist/esm/global-account/react/hooks/useTWAuth.js +0 -1
  84. package/dist/esm/global-account/react/stores/useModalStore.d.ts +10 -1
  85. package/dist/esm/global-account/react/utils/createWagmiConfig.d.ts +0 -18
  86. package/dist/esm/global-account/react/utils/createWagmiConfig.js +0 -16
  87. package/dist/esm/shared/utils/session-duration.d.ts +15 -0
  88. package/dist/esm/shared/utils/session-duration.js +64 -0
  89. package/dist/styles/index.css +1 -1
  90. package/dist/types/anyspend/react/components/checkout/CheckoutSuccess.d.ts +2 -1
  91. package/dist/types/anyspend/react/components/common/StepProgress.d.ts +2 -0
  92. package/dist/types/anyspend/react/hooks/useKycStatus.d.ts +3 -1
  93. package/dist/types/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +3 -1
  94. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +5 -2
  95. package/dist/types/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
  96. package/dist/types/global-account/react/components/ManageAccount/SessionDurationContent.d.ts +5 -0
  97. package/dist/types/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +5 -3
  98. package/dist/types/global-account/react/components/Toast/ToastContext.d.ts +3 -0
  99. package/dist/types/global-account/react/hooks/useAutoSelectWallet.d.ts +6 -3
  100. package/dist/types/global-account/react/hooks/useConnect.d.ts +2 -2
  101. package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +8 -8
  102. package/dist/types/global-account/react/stores/useModalStore.d.ts +10 -1
  103. package/dist/types/global-account/react/utils/createWagmiConfig.d.ts +0 -18
  104. package/dist/types/shared/utils/session-duration.d.ts +15 -0
  105. package/package.json +2 -1
  106. package/src/anyspend/react/components/AnySpendStakeB3.tsx +2 -2
  107. package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +2 -2
  108. package/src/anyspend/react/components/checkout/CheckoutPaymentPanel.tsx +2 -4
  109. package/src/anyspend/react/components/checkout/CheckoutSuccess.tsx +13 -3
  110. package/src/anyspend/react/components/checkout/FiatCheckoutPanel.tsx +9 -3
  111. package/src/anyspend/react/components/checkout/KycGate.tsx +8 -3
  112. package/src/anyspend/react/components/common/OrderDetails.tsx +8 -0
  113. package/src/anyspend/react/components/common/OrderStatus.tsx +38 -3
  114. package/src/anyspend/react/components/common/StepProgress.tsx +15 -5
  115. package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +5 -7
  116. package/src/anyspend/react/hooks/useKycStatus.ts +8 -5
  117. package/src/app.shared.ts +9 -8
  118. package/src/global-account/react/components/B3DynamicModal.tsx +5 -2
  119. package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +4 -0
  120. package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +2 -1
  121. package/src/global-account/react/components/B3Provider/B3Provider.tsx +16 -3
  122. package/src/global-account/react/components/B3Provider/LocalSDKProvider.tsx +5 -0
  123. package/src/global-account/react/components/ManageAccount/SessionDurationContent.tsx +107 -0
  124. package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +28 -30
  125. package/src/global-account/react/components/SignInWithB3/components/AuthButton.tsx +21 -2
  126. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +207 -54
  127. package/src/global-account/react/components/SignInWithB3/utils/signInUtils.ts +19 -3
  128. package/src/global-account/react/components/Toast/ToastContext.tsx +39 -7
  129. package/src/global-account/react/hooks/useAuth.ts +28 -17
  130. package/src/global-account/react/hooks/useAuthentication.ts +24 -13
  131. package/src/global-account/react/hooks/useAutoSelectWallet.ts +40 -6
  132. package/src/global-account/react/hooks/useConnect.tsx +2 -2
  133. package/src/global-account/react/hooks/useTWAuth.tsx +0 -1
  134. package/src/global-account/react/stores/useModalStore.ts +11 -0
  135. package/src/global-account/react/utils/createWagmiConfig.tsx +0 -18
  136. package/src/shared/utils/session-duration.ts +64 -0
  137. package/src/types/torph.d.ts +4 -0
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const app_1 = __importDefault(require("../../../../global-account/app"));
8
+ const react_1 = require("../../../../global-account/react");
9
+ const session_duration_1 = require("../../../../shared/utils/session-duration");
10
+ const react_2 = require("react");
11
+ const ModalHeader_1 = __importDefault(require("../ModalHeader/ModalHeader"));
12
+ const DESCRIPTIONS = {
13
+ 0: "Sign out when browser closes",
14
+ 1: "Stay signed in for 1 day",
15
+ 7: "Stay signed in for 7 days",
16
+ 14: "Stay signed in for 2 weeks",
17
+ 30: "Stay signed in for 30 days",
18
+ };
19
+ const SessionDurationContent = ({ partnerId }) => {
20
+ const { user, setUser } = (0, react_1.useAuthentication)(partnerId);
21
+ const navigateBack = (0, react_1.useModalStore)(state => state.navigateBack);
22
+ const [sessionDays, setSessionDays] = (0, react_2.useState)(() => (0, session_duration_1.getSessionDurationDays)(user?.preferences, partnerId));
23
+ const [saving, setSaving] = (0, react_2.useState)(false);
24
+ const handleSelect = async (days) => {
25
+ const previous = sessionDays;
26
+ (0, session_duration_1.setSessionDurationDays)(days, partnerId);
27
+ setSessionDays(days);
28
+ if (user?.userId) {
29
+ setSaving(true);
30
+ try {
31
+ const updated = await app_1.default.service("users").patch(user.userId, {
32
+ preferences: {
33
+ ...user.preferences,
34
+ [partnerId]: {
35
+ ...((user.preferences ?? {})[partnerId] ?? {}),
36
+ sessionDuration: days,
37
+ },
38
+ },
39
+ });
40
+ setUser(updated);
41
+ }
42
+ catch (error) {
43
+ console.error("Failed to save session duration preference:", error);
44
+ // Revert optimistic update so UI stays consistent with server state
45
+ setSessionDays(previous);
46
+ (0, session_duration_1.setSessionDurationDays)(previous, partnerId);
47
+ }
48
+ finally {
49
+ setSaving(false);
50
+ }
51
+ }
52
+ };
53
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "flex h-[470px] flex-col", children: [(0, jsx_runtime_1.jsx)(ModalHeader_1.default, { showBackButton: true, showCloseButton: false, title: "Stay signed in", handleBack: navigateBack }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col gap-2 p-5", children: session_duration_1.SESSION_DURATION_OPTIONS.map(days => ((0, jsx_runtime_1.jsxs)("button", { type: "button", onClick: () => handleSelect(days), disabled: saving, className: `flex items-center justify-between rounded-xl border px-4 py-3 transition-colors ${sessionDays === days
54
+ ? "border-[#3f3f46] bg-[#f4f4f5] dark:border-white dark:bg-white/10"
55
+ : "border-[#e4e4e7] bg-transparent hover:bg-[#f4f4f5] dark:border-white/10 dark:hover:bg-white/5"}`, children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-start gap-0.5", children: [(0, jsx_runtime_1.jsx)("span", { className: "font-neue-montreal-semibold text-[14px] leading-none tracking-[-0.28px] text-[#3f3f46] dark:text-white", children: session_duration_1.SESSION_DURATION_LABELS[days] }), (0, jsx_runtime_1.jsx)("span", { className: "font-neue-montreal-medium text-[13px] leading-none tracking-[-0.26px] text-[#70707b] dark:text-white/50", children: DESCRIPTIONS[days] })] }), sessionDays === days && ((0, jsx_runtime_1.jsx)("div", { className: "flex size-5 items-center justify-center rounded-full bg-[#3f3f46] dark:bg-white", children: (0, jsx_runtime_1.jsx)("svg", { width: "10", height: "8", viewBox: "0 0 10 8", fill: "none", children: (0, jsx_runtime_1.jsx)("path", { d: "M1 4L3.5 6.5L9 1", stroke: "white", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", className: "dark:stroke-[#3f3f46]" }) }) }))] }, days))) })] }));
56
+ };
57
+ exports.default = SessionDurationContent;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  const react_1 = require("../../../../global-account/react");
8
8
  const thirdweb_1 = require("../../../../shared/utils/thirdweb");
9
+ const session_duration_1 = require("../../../../shared/utils/session-duration");
9
10
  const lucide_react_1 = require("lucide-react");
10
11
  const react_2 = require("react");
11
12
  const react_3 = require("thirdweb/react");
@@ -16,47 +17,29 @@ const SettingsProfileCard_1 = __importDefault(require("./SettingsProfileCard"));
16
17
  const SettingsContent = ({ partnerId, onLogout, chain, }) => {
17
18
  const setB3ModalContentType = (0, react_1.useModalStore)(state => state.setB3ModalContentType);
18
19
  const setB3ModalOpen = (0, react_1.useModalStore)(state => state.setB3ModalOpen);
19
- const { logout } = (0, react_1.useAuthentication)(partnerId);
20
+ const { logout, user } = (0, react_1.useAuthentication)(partnerId);
20
21
  const [logoutLoading, setLogoutLoading] = (0, react_2.useState)(false);
22
+ const sessionDays = (0, session_duration_1.getSessionDurationDays)(user?.preferences, partnerId);
21
23
  const { data: profilesRaw = [] } = (0, react_3.useProfiles)({ client: thirdweb_1.client });
22
24
  const profiles = profilesRaw.filter((profile) => !["custom_auth_endpoint"].includes(profile.type));
23
25
  const handleNavigate = (type) => {
24
26
  if (type === "home") {
25
- setB3ModalContentType({
26
- type: "manageAccount",
27
- chain,
28
- partnerId,
29
- onLogout,
30
- activeTab: "home",
31
- });
27
+ setB3ModalContentType({ type: "manageAccount", chain, partnerId, onLogout, activeTab: "home" });
32
28
  }
33
29
  else if (type === "swap") {
34
- setB3ModalContentType({
35
- type: "manageAccount",
36
- chain,
37
- partnerId,
38
- onLogout,
39
- activeTab: "tokens",
40
- });
30
+ setB3ModalContentType({ type: "manageAccount", chain, partnerId, onLogout, activeTab: "tokens" });
41
31
  }
42
32
  else if (type === "linkAccount") {
43
- setB3ModalContentType({
44
- type: "linkAccount",
45
- chain,
46
- partnerId,
47
- });
33
+ setB3ModalContentType({ type: "linkAccount", chain, partnerId });
48
34
  }
49
35
  else if (type === "notifications") {
50
- setB3ModalContentType({
51
- type: "notifications",
52
- chain,
53
- partnerId,
54
- });
36
+ setB3ModalContentType({ type: "notifications", chain, partnerId });
37
+ }
38
+ else if (type === "sessionDuration") {
39
+ setB3ModalContentType({ type: "sessionDuration", chain, partnerId });
55
40
  }
56
41
  else {
57
- setB3ModalContentType({
58
- type: "avatarEditor",
59
- });
42
+ setB3ModalContentType({ type: "avatarEditor" });
60
43
  }
61
44
  setB3ModalOpen(true);
62
45
  };
@@ -67,7 +50,7 @@ const SettingsContent = ({ partnerId, onLogout, chain, }) => {
67
50
  setB3ModalOpen(false);
68
51
  setLogoutLoading(false);
69
52
  };
70
- return ((0, jsx_runtime_1.jsxs)("div", { className: "flex h-[470px] flex-col", children: [(0, jsx_runtime_1.jsx)(ModalHeader_1.default, { showBackButton: false, showCloseButton: false, title: "Settings" }), (0, jsx_runtime_1.jsx)("div", { className: "p-5", children: (0, jsx_runtime_1.jsx)("div", { className: "b3-modal-settings-profile-card dark:border-b3-line dark:bg-b3-background flex items-center rounded-xl border border-[#e4e4e7] bg-[#f4f4f5] p-4", children: (0, jsx_runtime_1.jsx)(SettingsProfileCard_1.default, {}) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-3 px-5", children: [(0, jsx_runtime_1.jsx)(SettingsMenuItem_1.default, { icon: (0, jsx_runtime_1.jsx)("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M0 12C0 5.37258 5.37258 0 12 0H28C34.6274 0 40 5.37258 40 12V28C40 34.6274 34.6274 40 28 40H12C5.37258 40 0 34.6274 0 28V12Z", fill: "#F4F4F5" }) }), title: "Linked Accounts", subtitle: `${profiles.length} connected account${profiles.length > 1 ? "s" : ""}`, onClick: () => handleNavigate("linkAccount") }), (0, jsx_runtime_1.jsx)(SettingsMenuItem_1.default, { icon: (0, jsx_runtime_1.jsx)("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M0 12C0 5.37258 5.37258 0 12 0H28C34.6274 0 40 5.37258 40 12V28C40 34.6274 34.6274 40 28 40H12C5.37258 40 0 34.6274 0 28V12Z", fill: "#F4F4F5" }) }), title: "Notifications", subtitle: "Manage your notifications", onClick: () => handleNavigate("notifications") })] }), (0, jsx_runtime_1.jsx)("div", { className: "mt-auto px-5 pb-5", children: (0, jsx_runtime_1.jsxs)("button", { className: "b3-modal-sign-out-button border-b3-line hover:bg-b3-line bg-b3-background dark:bg-b3-background dark:border-b3-line dark:hover:bg-b3-line/80 flex w-full items-center justify-center gap-1.5 rounded-xl border border-solid p-3 transition-colors", onClick: onLogoutEnhanced, disabled: logoutLoading, style: {
53
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "flex h-[470px] flex-col", children: [(0, jsx_runtime_1.jsx)(ModalHeader_1.default, { showBackButton: false, showCloseButton: false, title: "Settings" }), (0, jsx_runtime_1.jsx)("div", { className: "p-5", children: (0, jsx_runtime_1.jsx)("div", { className: "b3-modal-settings-profile-card dark:border-b3-line dark:bg-b3-background flex items-center rounded-xl border border-[#e4e4e7] bg-[#f4f4f5] p-4", children: (0, jsx_runtime_1.jsx)(SettingsProfileCard_1.default, {}) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-3 px-5", children: [(0, jsx_runtime_1.jsx)(SettingsMenuItem_1.default, { icon: (0, jsx_runtime_1.jsx)("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M0 12C0 5.37258 5.37258 0 12 0H28C34.6274 0 40 5.37258 40 12V28C40 34.6274 34.6274 40 28 40H12C5.37258 40 0 34.6274 0 28V12Z", fill: "#F4F4F5" }) }), title: "Linked Accounts", subtitle: `${profiles.length} connected account${profiles.length > 1 ? "s" : ""}`, onClick: () => handleNavigate("linkAccount") }), (0, jsx_runtime_1.jsx)(SettingsMenuItem_1.default, { icon: (0, jsx_runtime_1.jsx)("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M0 12C0 5.37258 5.37258 0 12 0H28C34.6274 0 40 5.37258 40 12V28C40 34.6274 34.6274 40 28 40H12C5.37258 40 0 34.6274 0 28V12Z", fill: "#F4F4F5" }) }), title: "Notifications", subtitle: "Manage your notifications", onClick: () => handleNavigate("notifications") }), (0, jsx_runtime_1.jsx)(SettingsMenuItem_1.default, { icon: (0, jsx_runtime_1.jsx)("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M0 12C0 5.37258 5.37258 0 12 0H28C34.6274 0 40 5.37258 40 12V28C40 34.6274 34.6274 40 28 40H12C5.37258 40 0 34.6274 0 28V12Z", fill: "#F4F4F5" }) }), title: "Stay signed in", subtitle: session_duration_1.SESSION_DURATION_LABELS[sessionDays] ?? `${sessionDays} days`, onClick: () => handleNavigate("sessionDuration") })] }), (0, jsx_runtime_1.jsx)("div", { className: "mt-auto px-5 pb-5", children: (0, jsx_runtime_1.jsxs)("button", { type: "button", className: "b3-modal-sign-out-button border-b3-line hover:bg-b3-line bg-b3-background dark:bg-b3-background dark:border-b3-line dark:hover:bg-b3-line/80 flex w-full items-center justify-center gap-1.5 rounded-xl border border-solid p-3 transition-colors", onClick: onLogoutEnhanced, disabled: logoutLoading, style: {
71
54
  boxShadow: "inset 0px 0px 0px 1px rgba(10,13,18,0.18), inset 0px -2px 0px 0px rgba(10,13,18,0.05)",
72
55
  }, children: [logoutLoading ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-b3-grey animate-spin", size: 20 })) : ((0, jsx_runtime_1.jsx)(SignOutIcon_1.default, { size: 20, className: "text-b3-grey", color: "currentColor" })), (0, jsx_runtime_1.jsx)("p", { className: "text-b3-grey dark:text-b3-foreground-muted font-neue-montreal-semibold text-base", children: "Sign out" })] }) })] }));
73
56
  };
@@ -3,7 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AuthButton = AuthButton;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const Button_1 = require("../../custom/Button");
6
+ const lucide_react_1 = require("lucide-react");
6
7
  const signInUtils_1 = require("../utils/signInUtils");
8
+ const fallbackIcons = {
9
+ github: lucide_react_1.Github,
10
+ email: lucide_react_1.Mail,
11
+ };
7
12
  function AuthButton({ strategy, onClick, isLoading, }) {
8
- return ((0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: onClick, disabled: isLoading, className: "flex w-full items-center justify-center bg-gray-100 px-2 py-3 hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700", children: (0, jsx_runtime_1.jsx)("img", { src: signInUtils_1.strategyIcons[strategy], className: "h-9 w-9" }) }, strategy));
13
+ const strategyIcon = signInUtils_1.strategyIcons[strategy];
14
+ const strategyLabel = signInUtils_1.strategyLabels[strategy] || strategy;
15
+ const FallbackIcon = fallbackIcons[strategy];
16
+ const buttonLabel = `Sign in with ${strategyLabel}`;
17
+ return ((0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: onClick, disabled: isLoading, "aria-label": buttonLabel, title: buttonLabel, className: "flex w-full items-center justify-center bg-gray-100 px-2 py-3 hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700", children: strategyIcon ? ((0, jsx_runtime_1.jsx)("img", { src: strategyIcon, alt: `${strategyLabel} icon`, className: "h-9 w-9" })) : FallbackIcon ? ((0, jsx_runtime_1.jsx)(FallbackIcon, { className: "h-9 w-9 text-gray-900 dark:text-gray-100" })) : ((0, jsx_runtime_1.jsx)("span", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100", children: strategyLabel.charAt(0) })) }, strategy));
9
18
  }
@@ -3,39 +3,53 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LoginStepCustom = LoginStepCustom;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("../../../../../global-account/react");
6
+ const constants_1 = require("../../../../../shared/constants");
6
7
  const debug_1 = require("../../../../../shared/utils/debug");
7
8
  const thirdweb_1 = require("../../../../../shared/utils/thirdweb");
8
9
  const react_2 = require("react");
9
10
  const react_3 = require("thirdweb/react");
10
11
  const wallets_1 = require("thirdweb/wallets");
11
12
  const debug = (0, debug_1.debugB3React)("LoginStepCustom");
13
+ const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
12
14
  function LoginStepCustom({ onSuccess, onError, chain, strategies, maxInitialWallets = 2, automaticallySetFirstEoa, }) {
13
15
  const { partnerId } = (0, react_1.useB3Config)();
14
16
  const [isLoading, setIsLoading] = (0, react_2.useState)(false);
15
17
  const [showAllWallets, setShowAllWallets] = (0, react_2.useState)(false);
18
+ const [showEmailFlow, setShowEmailFlow] = (0, react_2.useState)(false);
19
+ const [email, setEmail] = (0, react_2.useState)("");
20
+ const [verificationCode, setVerificationCode] = (0, react_2.useState)("");
21
+ const [emailCodeSent, setEmailCodeSent] = (0, react_2.useState)(false);
22
+ const [emailError, setEmailError] = (0, react_2.useState)(null);
16
23
  const { connect } = (0, react_1.useConnect)(partnerId, chain);
17
24
  const setIsAuthenticating = (0, react_1.useAuthStore)(state => state.setIsAuthenticating);
18
- const setIsAuthenticated = (0, react_1.useAuthStore)(state => state.setIsAuthenticated);
19
- const { logout } = (0, react_1.useAuthentication)(partnerId, { skipAutoConnect: true });
25
+ const { connect: onAuthConnect, logout } = (0, react_1.useAuthentication)(partnerId, { skipAutoConnect: true });
20
26
  const { connect: connectTW } = (0, react_3.useConnect)();
27
+ const connectedWallets = (0, react_3.useConnectedWallets)();
21
28
  // Split strategies into auth and wallet types
22
29
  const authStrategies = strategies.filter(s => !(0, react_1.isWalletType)(s));
23
30
  const walletStrategies = strategies.filter(react_1.isWalletType);
24
31
  const initialWallets = walletStrategies.slice(0, maxInitialWallets);
25
32
  const additionalWallets = walletStrategies.slice(maxInitialWallets);
26
- const handleConnect = async (strategy) => {
33
+ const authGridColumns = Math.max(1, Math.min(authStrategies.length, 4));
34
+ const resetEmailFlow = () => {
35
+ setShowEmailFlow(false);
36
+ setEmailCodeSent(false);
37
+ setVerificationCode("");
38
+ setEmailError(null);
39
+ };
40
+ const connectWithOptions = async (strategy, options) => {
27
41
  try {
28
42
  setIsLoading(true);
29
43
  debug("setIsAuthenticating:true:3");
30
44
  setIsAuthenticating(true);
31
- const options = (0, react_1.getConnectOptionsFromStrategy)(strategy);
32
45
  let connectResult;
33
- if (automaticallySetFirstEoa) {
34
- if (!options.wallet?.id) {
46
+ if (automaticallySetFirstEoa && (0, react_1.isWalletType)(strategy) && options.strategy === "wallet") {
47
+ const walletId = options.wallet?.id;
48
+ if (!walletId) {
35
49
  throw new Error("Wallet ID is required");
36
50
  }
37
51
  connectResult = await connectTW(async () => {
38
- const wallet = (0, wallets_1.createWallet)(options.wallet?.id);
52
+ const wallet = (0, wallets_1.createWallet)(walletId);
39
53
  await wallet.connect({
40
54
  client: thirdweb_1.client,
41
55
  });
@@ -43,20 +57,27 @@ function LoginStepCustom({ onSuccess, onError, chain, strategies, maxInitialWall
43
57
  });
44
58
  }
45
59
  else {
46
- // @ts-expect-error we have custom strategies too and we also get things like "apple" isn't assignable to "wallet"
47
60
  connectResult = await connect(options);
48
61
  }
49
62
  const account = connectResult?.getAccount();
50
63
  debug("@@connectResult", { connectResult, account, options });
51
- if (!account)
64
+ if (!account || !connectResult)
52
65
  throw new Error("Failed to connect");
66
+ const allConnectedWallets = connectedWallets.length > 0 && connectedWallets.some(wallet => wallet.id === connectResult.id)
67
+ ? connectedWallets
68
+ : [connectResult, ...connectedWallets.filter(wallet => wallet.id !== connectResult.id)];
69
+ await onAuthConnect(connectResult, allConnectedWallets);
53
70
  await onSuccess(account);
54
- setIsAuthenticated(true);
71
+ if (strategy === "email") {
72
+ resetEmailFlow();
73
+ }
55
74
  }
56
75
  catch (error) {
76
+ if (strategy === "email") {
77
+ setEmailError(error instanceof Error ? error.message : "Failed to sign in with email");
78
+ }
57
79
  await onError?.(error);
58
80
  await logout();
59
- setIsAuthenticated(false);
60
81
  }
61
82
  finally {
62
83
  setIsLoading(false);
@@ -64,8 +85,68 @@ function LoginStepCustom({ onSuccess, onError, chain, strategies, maxInitialWall
64
85
  setIsAuthenticating(false);
65
86
  }
66
87
  };
67
- return ((0, jsx_runtime_1.jsxs)(react_1.LoginStepContainer, { partnerId: partnerId, children: [authStrategies.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: `mb-6 w-full ${authStrategies.length <= 3 ? "space-y-3 px-3" : "grid grid-cols-4 gap-4"}`, children: authStrategies.map(strategy => {
68
- console.log("strategy", strategy);
69
- return ((0, jsx_runtime_1.jsx)(react_1.AuthButton, { strategy: strategy, onClick: () => handleConnect(strategy), isLoading: isLoading }, strategy));
70
- }) })), (0, jsx_runtime_1.jsx)("div", { className: "mb-4 w-full space-y-2", children: initialWallets.map(walletId => ((0, jsx_runtime_1.jsx)(react_1.WalletRow, { walletId: walletId, onClick: () => handleConnect(walletId), isLoading: isLoading }, walletId))) }), additionalWallets.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: "w-full", children: [(0, jsx_runtime_1.jsx)(react_1.Button, { onClick: () => setShowAllWallets(!showAllWallets), className: "mb-2 w-full bg-transparent text-gray-600 hover:bg-gray-100", children: showAllWallets ? "Show less" : "More options" }), showAllWallets && ((0, jsx_runtime_1.jsx)("div", { className: "max-h-60 space-y-2 overflow-y-auto", children: additionalWallets.map(walletId => ((0, jsx_runtime_1.jsx)(react_1.WalletRow, { walletId: walletId, onClick: () => handleConnect(walletId), isLoading: isLoading }, walletId))) }))] }))] }));
88
+ const handleConnect = async (strategy) => {
89
+ if (strategy === "email") {
90
+ setShowEmailFlow(true);
91
+ setEmailCodeSent(false);
92
+ setVerificationCode("");
93
+ setEmailError(null);
94
+ return;
95
+ }
96
+ const options = (0, react_1.getConnectOptionsFromStrategy)(strategy);
97
+ await connectWithOptions(strategy, options);
98
+ };
99
+ const handleSendEmailCode = async () => {
100
+ const normalizedEmail = email.trim().toLowerCase();
101
+ if (!normalizedEmail) {
102
+ setEmailError("Please enter your email address");
103
+ return;
104
+ }
105
+ if (!EMAIL_REGEX.test(normalizedEmail)) {
106
+ setEmailError("Please enter a valid email address");
107
+ return;
108
+ }
109
+ try {
110
+ setIsLoading(true);
111
+ setEmailError(null);
112
+ await (0, wallets_1.preAuthenticate)({
113
+ client: thirdweb_1.client,
114
+ strategy: "email",
115
+ email: normalizedEmail,
116
+ ecosystem: {
117
+ id: constants_1.ecosystemWalletId,
118
+ partnerId,
119
+ },
120
+ });
121
+ setEmail(normalizedEmail);
122
+ setEmailCodeSent(true);
123
+ }
124
+ catch (error) {
125
+ setEmailError(error instanceof Error ? error.message : "Failed to send verification code");
126
+ await onError?.(error);
127
+ }
128
+ finally {
129
+ setIsLoading(false);
130
+ }
131
+ };
132
+ const handleEmailLogin = async () => {
133
+ const normalizedEmail = email.trim().toLowerCase();
134
+ const normalizedCode = verificationCode.trim();
135
+ if (!EMAIL_REGEX.test(normalizedEmail)) {
136
+ setEmailError("Please enter a valid email address");
137
+ return;
138
+ }
139
+ if (!normalizedCode) {
140
+ setEmailError("Please enter your verification code");
141
+ return;
142
+ }
143
+ await connectWithOptions("email", {
144
+ strategy: "email",
145
+ email: normalizedEmail,
146
+ verificationCode: normalizedCode,
147
+ });
148
+ };
149
+ return ((0, jsx_runtime_1.jsx)(react_1.LoginStepContainer, { partnerId: partnerId, children: showEmailFlow ? ((0, jsx_runtime_1.jsxs)("div", { className: "mb-6 w-full space-y-3 px-3", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-center text-sm font-medium text-gray-900 dark:text-gray-100", children: "Sign in with email" }), (0, jsx_runtime_1.jsx)(react_1.Input, { type: "email", placeholder: "you@example.com", value: email, onChange: event => setEmail(event.target.value), disabled: isLoading || emailCodeSent }), emailCodeSent && ((0, jsx_runtime_1.jsx)(react_1.Input, { type: "text", placeholder: "Enter verification code", value: verificationCode, onChange: event => setVerificationCode(event.target.value), disabled: isLoading })), emailError && (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-red-500", children: emailError }), (0, jsx_runtime_1.jsx)(react_1.Button, { onClick: emailCodeSent ? handleEmailLogin : handleSendEmailCode, disabled: isLoading, className: "w-full", children: isLoading ? "Loading..." : emailCodeSent ? "Verify code" : "Send code" }), emailCodeSent && ((0, jsx_runtime_1.jsx)(react_1.Button, { variant: "outline", onClick: handleSendEmailCode, disabled: isLoading, className: "w-full", children: "Resend code" })), (0, jsx_runtime_1.jsx)(react_1.Button, { variant: "outline", onClick: resetEmailFlow, disabled: isLoading, className: "w-full", children: "Back" })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [authStrategies.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: `mb-6 grid w-full gap-4 px-3 ${authStrategies.length > 4 ? "grid-cols-4" : ""}`, style: authStrategies.length <= 4
150
+ ? { gridTemplateColumns: `repeat(${authGridColumns}, minmax(0, 1fr))` }
151
+ : undefined, children: authStrategies.map(strategy => ((0, jsx_runtime_1.jsx)(react_1.AuthButton, { strategy: strategy, onClick: () => handleConnect(strategy), isLoading: isLoading }, strategy))) })), (0, jsx_runtime_1.jsx)("div", { className: "mb-4 w-full space-y-2", children: initialWallets.map(walletId => ((0, jsx_runtime_1.jsx)(react_1.WalletRow, { walletId: walletId, onClick: () => handleConnect(walletId), isLoading: isLoading }, walletId))) }), additionalWallets.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: "w-full", children: [(0, jsx_runtime_1.jsx)(react_1.Button, { onClick: () => setShowAllWallets(!showAllWallets), className: "mb-2 w-full bg-transparent text-gray-600 hover:bg-gray-100", children: showAllWallets ? "Show less" : "More options" }), showAllWallets && ((0, jsx_runtime_1.jsx)("div", { className: "max-h-60 space-y-2 overflow-y-auto", children: additionalWallets.map(walletId => ((0, jsx_runtime_1.jsx)(react_1.WalletRow, { walletId: walletId, onClick: () => handleConnect(walletId), isLoading: isLoading }, walletId))) }))] }))] })) }));
71
152
  }
@@ -3,15 +3,17 @@ import { SingleStepAuthArgsType, Wallet } from "thirdweb/wallets";
3
3
  type WalletType = Wallet["id"];
4
4
  type StrategyType = SingleStepAuthArgsType["strategy"];
5
5
  type CustomStrategyType = "basement" | "privy";
6
- type AllowedStrategies = StrategyType | WalletType | CustomStrategyType;
7
- export declare const allowedStrategies: readonly ["apple", "google", "x", "discord", "guest", "walletConnect", "io.metamask", "com.coinbase.wallet", "basement", "privy"];
6
+ type AllowedStrategies = StrategyType | WalletType | CustomStrategyType | "email";
7
+ type NonWalletStrategyType = Exclude<AllowedStrategies, WalletType>;
8
+ export declare const allowedStrategies: readonly ["apple", "google", "github", "x", "discord", "email", "guest", "walletConnect", "io.metamask", "com.coinbase.wallet", "basement", "privy"];
8
9
  export type AllowedStrategy = (typeof allowedStrategies)[number];
9
10
  export declare function isWalletType(strategy: AllowedStrategies): strategy is WalletType;
10
- export declare function isStrategyType(strategy: AllowedStrategies): strategy is StrategyType;
11
+ export declare function isStrategyType(strategy: AllowedStrategies): strategy is NonWalletStrategyType;
11
12
  export declare function getConnectOptionsFromStrategy(strategy: AllowedStrategy): {
12
13
  strategy: StrategyType;
13
14
  wallet?: Wallet;
14
15
  chain?: Chain;
15
16
  };
16
17
  export declare const strategyIcons: Record<string, string>;
18
+ export declare const strategyLabels: Record<string, string>;
17
19
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.strategyIcons = exports.allowedStrategies = void 0;
3
+ exports.strategyLabels = exports.strategyIcons = exports.allowedStrategies = void 0;
4
4
  exports.isWalletType = isWalletType;
5
5
  exports.isStrategyType = isStrategyType;
6
6
  exports.getConnectOptionsFromStrategy = getConnectOptionsFromStrategy;
@@ -11,9 +11,10 @@ exports.allowedStrategies = [
11
11
  // Auth strategies
12
12
  "apple",
13
13
  "google",
14
+ "github",
14
15
  "x",
15
16
  "discord",
16
- // "github",
17
+ "email",
17
18
  "guest",
18
19
  // Wallet IDs
19
20
  "walletConnect",
@@ -35,6 +36,9 @@ function getConnectOptionsFromStrategy(strategy) {
35
36
  if (!exports.allowedStrategies.includes(strategy)) {
36
37
  throw new Error(`Invalid strategy: ${strategy}`);
37
38
  }
39
+ if (strategy === "email") {
40
+ throw new Error("Email strategy requires OTP flow and cannot be connected in a single step");
41
+ }
38
42
  if (isWalletType(strategy)) {
39
43
  return { strategy: "wallet", wallet: (0, wallets_1.createWallet)(strategy) };
40
44
  }
@@ -51,6 +55,15 @@ exports.strategyIcons = {
51
55
  guest: "https://cdn.b3.fun/incognito.svg",
52
56
  // Add more strategies as needed
53
57
  };
58
+ exports.strategyLabels = {
59
+ google: "Google",
60
+ x: "X",
61
+ discord: "Discord",
62
+ apple: "Apple",
63
+ guest: "Guest",
64
+ github: "GitHub",
65
+ email: "Email",
66
+ };
54
67
  // Test it
55
68
  // console.log(getConnectOptionsFromStrategy("io.metamask"));
56
69
  // console.log(getConnectOptionsFromStrategy("google"));
@@ -11,6 +11,9 @@ interface ToastContextType {
11
11
  addToast: (type: ToastType, message: string, duration?: number) => string;
12
12
  removeToast: (id: string) => void;
13
13
  clearAll: () => void;
14
+ headerMode: boolean;
15
+ setHeaderMode: (enabled: boolean) => void;
16
+ latestToast: ToastItem | null;
14
17
  }
15
18
  export declare function ToastProvider({ children }: {
16
19
  children: React.ReactNode;
@@ -8,6 +8,9 @@ const ToastContext = (0, react_1.createContext)(undefined);
8
8
  let globalToastCounter = 0;
9
9
  function ToastProvider({ children }) {
10
10
  const [toasts, setToasts] = (0, react_1.useState)([]);
11
+ const [headerMode, setHeaderMode] = (0, react_1.useState)(false);
12
+ const headerModeRef = (0, react_1.useRef)(false);
13
+ const [latestToast, setLatestToast] = (0, react_1.useState)(null);
11
14
  const timeoutsRef = (0, react_1.useRef)(new Map());
12
15
  const removeToast = (0, react_1.useCallback)((id) => {
13
16
  setToasts(prev => prev.filter(toast => toast.id !== id));
@@ -26,12 +29,23 @@ function ToastProvider({ children }) {
26
29
  duration,
27
30
  createdAt: Date.now(),
28
31
  };
29
- setToasts(prev => [...prev, newToast]);
30
- if (duration > 0) {
31
- const timeout = setTimeout(() => {
32
- removeToast(id);
33
- }, duration);
34
- timeoutsRef.current.set(id, timeout);
32
+ if (headerModeRef.current) {
33
+ setLatestToast(newToast);
34
+ if (duration > 0) {
35
+ const timeout = setTimeout(() => {
36
+ setLatestToast(null);
37
+ }, duration);
38
+ timeoutsRef.current.set(id, timeout);
39
+ }
40
+ }
41
+ else {
42
+ setToasts(prev => [...prev, newToast]);
43
+ if (duration > 0) {
44
+ const timeout = setTimeout(() => {
45
+ removeToast(id);
46
+ }, duration);
47
+ timeoutsRef.current.set(id, timeout);
48
+ }
35
49
  }
36
50
  return id;
37
51
  }, [removeToast]);
@@ -40,6 +54,15 @@ function ToastProvider({ children }) {
40
54
  timeoutsRef.current.clear();
41
55
  setToasts([]);
42
56
  }, []);
57
+ const setHeaderModeCallback = (0, react_1.useCallback)((enabled) => {
58
+ setHeaderMode(enabled);
59
+ headerModeRef.current = enabled;
60
+ if (!enabled) {
61
+ setLatestToast(null);
62
+ timeoutsRef.current.forEach(timeout => clearTimeout(timeout));
63
+ timeoutsRef.current.clear();
64
+ }
65
+ }, []);
43
66
  // Cleanup on unmount
44
67
  (0, react_1.useEffect)(() => {
45
68
  const timeouts = timeoutsRef.current;
@@ -48,7 +71,7 @@ function ToastProvider({ children }) {
48
71
  timeouts.clear();
49
72
  };
50
73
  }, []);
51
- return (0, jsx_runtime_1.jsx)(ToastContext.Provider, { value: { toasts, addToast, removeToast, clearAll }, children: children });
74
+ return ((0, jsx_runtime_1.jsx)(ToastContext.Provider, { value: { toasts, addToast, removeToast, clearAll, headerMode, setHeaderMode: setHeaderModeCallback, latestToast }, children: children }));
52
75
  }
53
76
  function useToastContext() {
54
77
  const context = (0, react_1.useContext)(ToastContext);
@@ -27,7 +27,7 @@ const debug = (0, debug_1.debugB3React)("useAuth");
27
27
  * This hook provides 1:1 feature parity with useAuthentication.ts
28
28
  */
29
29
  function useAuth() {
30
- const { onConnectCallback } = (0, react_2.useContext)(LocalSDKProvider_1.LocalSDKContext);
30
+ const { onConnectCallback, disableBSMNTAuthentication } = (0, react_2.useContext)(LocalSDKProvider_1.LocalSDKContext);
31
31
  const { disconnect } = (0, react_3.useDisconnect)();
32
32
  const wallets = (0, react_3.useConnectedWallets)();
33
33
  const activeWallet = (0, react_3.useActiveWallet)();
@@ -44,7 +44,7 @@ function useAuth() {
44
44
  const useAutoConnectLoadingPrevious = (0, react_2.useRef)(false);
45
45
  const referralCode = (0, useSearchParamsSSR_1.useSearchParam)("referralCode");
46
46
  const { partnerId } = (0, react_1.useB3Config)();
47
- const wagmiConfig = (0, createWagmiConfig_1.getCachedWagmiConfig)({ partnerId });
47
+ const wagmiConfig = (0, react_2.useMemo)(() => (0, createWagmiConfig_1.createWagmiConfig)({ partnerId }), [partnerId]);
48
48
  const { connect } = (0, wagmi_1.useConnect)();
49
49
  const activeWagmiAccount = (0, wagmi_1.useAccount)();
50
50
  const { switchAccount } = (0, wagmi_1.useSwitchAccount)();
@@ -69,8 +69,10 @@ function useAuth() {
69
69
  }
70
70
  // Authenticate with BSMNT
71
71
  try {
72
- const b3Jwt = await (0, bsmnt_1.authenticateWithB3JWT)(response.accessToken);
73
- debug("BSMNT re-authentication successful", b3Jwt);
72
+ if (!disableBSMNTAuthentication) {
73
+ const b3Jwt = await (0, bsmnt_1.authenticateWithB3JWT)(response.accessToken);
74
+ debug("BSMNT re-authentication successful", b3Jwt);
75
+ }
74
76
  }
75
77
  catch (bsmntError) {
76
78
  // BSMNT authentication failure shouldn't block the main auth flow
@@ -82,7 +84,7 @@ function useAuth() {
82
84
  debug("Re-authentication failed", err);
83
85
  throw err;
84
86
  }
85
- }, [setUser]);
87
+ }, [setUser, disableBSMNTAuthentication]);
86
88
  const syncWagmi = (0, react_2.useCallback)(async () => {
87
89
  function syncWagmiFunc() {
88
90
  const connectors = (0, core_1.getConnectors)(wagmiConfig);
@@ -126,9 +128,7 @@ function useAuth() {
126
128
  });
127
129
  }
128
130
  syncWagmiFunc();
129
- // wagmi config shouldn't change
130
- // eslint-disable-next-line react-hooks/exhaustive-deps
131
- }, [partnerId, wallets]);
131
+ }, [wagmiConfig, wallets, connect, switchAccount]);
132
132
  (0, react_2.useEffect)(() => {
133
133
  syncWagmi();
134
134
  }, [wallets, syncWagmi]);
@@ -145,9 +145,11 @@ function useAuth() {
145
145
  setIsAuthenticated(true);
146
146
  setIsAuthenticating(false);
147
147
  debug("Re-authenticated successfully", { userAuth });
148
- // Authenticate on BSMNT with B3 JWT
149
- const b3Jwt = await (0, bsmnt_1.authenticateWithB3JWT)(userAuth.accessToken);
150
- debug("@@b3Jwt", b3Jwt);
148
+ if (!disableBSMNTAuthentication) {
149
+ // Authenticate on BSMNT with B3 JWT
150
+ const b3Jwt = await (0, bsmnt_1.authenticateWithB3JWT)(userAuth.accessToken);
151
+ debug("@@b3Jwt", b3Jwt);
152
+ }
151
153
  return userAuth;
152
154
  }
153
155
  catch (error) {
@@ -157,7 +159,14 @@ function useAuth() {
157
159
  setIsAuthenticating(false);
158
160
  throw new Error("Authentication required. Please authenticate.");
159
161
  }
160
- }, [reAuthenticate, setIsAuthenticated, setIsAuthenticating, setUser, setHasStartedConnecting]);
162
+ }, [
163
+ reAuthenticate,
164
+ setIsAuthenticated,
165
+ setIsAuthenticating,
166
+ setUser,
167
+ setHasStartedConnecting,
168
+ disableBSMNTAuthentication,
169
+ ]);
161
170
  /**
162
171
  * Authenticate with B3
163
172
  *
@@ -187,8 +196,10 @@ function useAuth() {
187
196
  }
188
197
  // Step 3: Authenticate with BSMNT for basement integration
189
198
  try {
190
- const b3Jwt = await (0, bsmnt_1.authenticateWithB3JWT)(response.accessToken);
191
- debug("BSMNT authentication successful", b3Jwt);
199
+ if (!disableBSMNTAuthentication) {
200
+ const b3Jwt = await (0, bsmnt_1.authenticateWithB3JWT)(response.accessToken);
201
+ debug("BSMNT authentication successful", b3Jwt);
202
+ }
192
203
  }
193
204
  catch (bsmntError) {
194
205
  // BSMNT authentication failure shouldn't block the main auth flow
@@ -200,7 +211,7 @@ function useAuth() {
200
211
  debug("Authentication failed", err);
201
212
  throw err;
202
213
  }
203
- }, [referralCode, setUser]);
214
+ }, [referralCode, setUser, disableBSMNTAuthentication]);
204
215
  /**
205
216
  * Handle wallet connection
206
217
  */