@b3dotfun/sdk 0.0.47-alpha.0 → 0.0.47-test.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +3 -2
  3. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +15 -64
  4. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -2
  5. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +26 -21
  6. package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +2 -0
  7. package/dist/cjs/global-account/react/components/B3Provider/types.js +2 -0
  8. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.d.ts +1 -2
  9. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
  10. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +1 -1
  11. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +2 -2
  12. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3.js +1 -1
  13. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
  14. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +6 -22
  15. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +1 -2
  16. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +3 -2
  17. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -2
  18. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +10 -45
  19. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.d.ts +1 -2
  20. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -1
  21. package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +2 -1
  22. package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +51 -2
  23. package/dist/cjs/global-account/react/hooks/useAuthentication.js +134 -84
  24. package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +1 -1
  25. package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.js +2 -1
  26. package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +58 -0
  27. package/dist/cjs/global-account/react/hooks/useUserQuery.js +86 -0
  28. package/dist/cjs/global-account/react/hooks/useWagmiConfig.d.ts +13 -0
  29. package/dist/cjs/global-account/react/hooks/useWagmiConfig.js +42 -0
  30. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -2
  31. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +3 -2
  32. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +19 -68
  33. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -2
  34. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +24 -19
  35. package/dist/esm/global-account/react/components/B3Provider/types.d.ts +2 -0
  36. package/dist/esm/global-account/react/components/B3Provider/types.js +2 -0
  37. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.d.ts +1 -2
  38. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
  39. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +1 -1
  40. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
  41. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3.js +2 -2
  42. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
  43. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +7 -23
  44. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +1 -2
  45. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +4 -3
  46. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -2
  47. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +11 -46
  48. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.d.ts +1 -2
  49. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +3 -2
  50. package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +3 -2
  51. package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +51 -2
  52. package/dist/esm/global-account/react/hooks/useAuthentication.js +137 -87
  53. package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +1 -1
  54. package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +3 -2
  55. package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +58 -0
  56. package/dist/esm/global-account/react/hooks/useUserQuery.js +83 -0
  57. package/dist/esm/global-account/react/hooks/useWagmiConfig.d.ts +13 -0
  58. package/dist/esm/global-account/react/hooks/useWagmiConfig.js +39 -0
  59. package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -2
  60. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +3 -2
  61. package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -2
  62. package/dist/types/global-account/react/components/B3Provider/types.d.ts +2 -0
  63. package/dist/types/global-account/react/components/ManageAccount/BalanceContent.d.ts +1 -2
  64. package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
  65. package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +1 -2
  66. package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -2
  67. package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStepCustom.d.ts +1 -2
  68. package/dist/types/global-account/react/hooks/useAuthentication.d.ts +51 -2
  69. package/dist/types/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +1 -1
  70. package/dist/types/global-account/react/hooks/useUserQuery.d.ts +58 -0
  71. package/dist/types/global-account/react/hooks/useWagmiConfig.d.ts +13 -0
  72. package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -2
  73. package/package.json +3 -3
  74. package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +51 -35
  75. package/src/global-account/react/components/B3Provider/B3Provider.tsx +28 -72
  76. package/src/global-account/react/components/B3Provider/types.ts +4 -0
  77. package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +2 -3
  78. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +1 -1
  79. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
  80. package/src/global-account/react/components/SignInWithB3/SignInWithB3.tsx +2 -2
  81. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +4 -23
  82. package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +4 -3
  83. package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +8 -46
  84. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +2 -2
  85. package/src/global-account/react/components/custom/ManageAccountButton.tsx +3 -2
  86. package/src/global-account/react/hooks/useAuthentication.ts +159 -90
  87. package/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx +3 -2
  88. package/src/global-account/react/hooks/useUserQuery.ts +95 -0
  89. package/src/global-account/react/hooks/useWagmiConfig.tsx +44 -0
  90. package/src/global-account/react/stores/useModalStore.ts +0 -2
package/README.md CHANGED
@@ -196,7 +196,7 @@ import { B3Provider, SignInWithB3 } from "@b3dotfun/sdk/global-account/react";
196
196
 
197
197
  function App() {
198
198
  return (
199
- <B3Provider environment="production">
199
+ <B3Provider environment="production" partnerId="your-awesome-partner-id">
200
200
  <SignInWithB3
201
201
  provider={{ strategy: "google" }}
202
202
  partnerId="your-partner-id"
@@ -223,7 +223,7 @@ const b3Chain = {
223
223
 
224
224
  function SessionKeyAuth() {
225
225
  return (
226
- <B3Provider environment="production">
226
+ <B3Provider environment="production" partnerId="your-awesome-partner-id">
227
227
  <SignInWithB3
228
228
  provider={{ strategy: "google" }}
229
229
  chain={b3Chain}
@@ -368,7 +368,7 @@ import B3DynamicModal from "@b3dotfun/sdk/global-account/react/components/B3Dyna
368
368
 
369
369
  function App() {
370
370
  return (
371
- <B3Provider environment="production">
371
+ <B3Provider environment="production" partnerId="your-awesome-partner-id">
372
372
  <YourApp />
373
373
  <B3DynamicModal />
374
374
  </B3Provider>
@@ -19,12 +19,12 @@ export declare function B3Provider({ theme, children, accountOverride, environme
19
19
  };
20
20
  clientType?: ClientType;
21
21
  rpcUrls?: Record<number, string>;
22
- partnerId?: string;
22
+ partnerId: string;
23
23
  }): import("react/jsx-runtime").JSX.Element;
24
24
  /**
25
25
  * Inner provider component that provides the actual B3Context
26
26
  */
27
- export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, }: {
27
+ export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, }: {
28
28
  children: React.ReactNode;
29
29
  accountOverride?: Account;
30
30
  environment: B3ContextType["environment"];
@@ -32,4 +32,5 @@ export declare function InnerProvider({ children, accountOverride, environment,
32
32
  automaticallySetFirstEoa: boolean;
33
33
  theme: "light" | "dark";
34
34
  clientType?: ClientType;
35
+ partnerId: string;
35
36
  }): import("react/jsx-runtime").JSX.Element;
@@ -4,14 +4,11 @@ exports.B3Provider = B3Provider;
4
4
  exports.InnerProvider = InnerProvider;
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  const react_1 = require("../../../../global-account/react");
7
+ const useWagmiConfig_1 = require("../../../../global-account/react/hooks/useWagmiConfig");
7
8
  const analytics_1 = require("../../../../global-account/utils/analytics");
8
- const constants_1 = require("../../../../shared/constants");
9
- const supported_1 = require("../../../../shared/constants/chains/supported");
10
9
  const debug_1 = require("../../../../shared/utils/debug");
11
- const thirdweb_1 = require("../../../../shared/utils/thirdweb");
12
10
  require("@reservoir0x/relay-kit-ui/styles.css");
13
11
  const react_query_1 = require("@tanstack/react-query");
14
- const wagmi_adapter_1 = require("@thirdweb-dev/wagmi-adapter");
15
12
  const react_2 = require("react");
16
13
  const sonner_1 = require("sonner");
17
14
  const react_3 = require("thirdweb/react");
@@ -43,76 +40,25 @@ function B3Provider({ theme = "light", children, accountOverride, environment, a
43
40
  (0, react_2.useEffect)(() => {
44
41
  (0, client_manager_1.setClientType)(clientType);
45
42
  }, [clientType]);
46
- const ecocystemConfig = (0, react_2.useMemo)(() => {
47
- if (!partnerId)
48
- return undefined;
49
- return {
50
- ecosystemId: constants_1.ecosystemWalletId,
51
- partnerId: partnerId,
52
- client: thirdweb_1.client,
53
- };
54
- }, [partnerId]);
55
- // Stringify rpcUrls for stable comparison to prevent wagmiConfig recreation
56
- // when parent component passes new object references with same content
57
- const rpcUrlsString = (0, react_2.useMemo)(() => (rpcUrls ? JSON.stringify(rpcUrls) : undefined), [rpcUrls]);
58
- /**
59
- * Creates wagmi config with optional custom RPC URLs
60
- * @param rpcUrls - Optional mapping of chain IDs to RPC URLs
61
- */
62
- const wagmiConfig = (0, react_2.useMemo)(() => {
63
- const parsedRpcUrls = rpcUrlsString ? JSON.parse(rpcUrlsString) : undefined;
64
- return (0, wagmi_1.createConfig)({
65
- chains: [supported_1.supportedChains[0], ...supported_1.supportedChains.slice(1)],
66
- transports: Object.fromEntries(supported_1.supportedChains.map(chain => [chain.id, (0, wagmi_1.http)(parsedRpcUrls?.[chain.id])])),
67
- connectors: [
68
- (0, wagmi_adapter_1.inAppWalletConnector)({
69
- ...(ecocystemConfig || {}),
70
- client: thirdweb_1.client,
71
- }),
72
- // injected(),
73
- // coinbaseWallet({ appName: "HypeDuel" }),
74
- ],
75
- });
76
- }, [ecocystemConfig, rpcUrlsString]);
77
- return ((0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, clientType: clientType, children: (0, jsx_runtime_1.jsxs)(react_1.RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, (0, jsx_runtime_1.jsx)(StyleRoot_1.StyleRoot, { id: "b3-root" }), (0, jsx_runtime_1.jsx)(sonner_1.Toaster, { theme: theme, position: toaster?.position, style: toaster?.style })] }) }) }) }) }) }));
43
+ const wagmiConfig = (0, useWagmiConfig_1.useWagmiConfig)(partnerId, rpcUrls);
44
+ return ((0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, clientType: clientType, partnerId: partnerId, children: (0, jsx_runtime_1.jsxs)(react_1.RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, (0, jsx_runtime_1.jsx)(StyleRoot_1.StyleRoot, { id: "b3-root" }), (0, jsx_runtime_1.jsx)(sonner_1.Toaster, { theme: theme, position: toaster?.position, style: toaster?.style })] }) }) }) }) }) }));
78
45
  }
79
46
  /**
80
47
  * Inner provider component that provides the actual B3Context
81
48
  */
82
- function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa, theme = "light", clientType = "socket", }) {
49
+ function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa, theme = "light", clientType = "socket", partnerId, }) {
83
50
  const activeAccount = (0, react_3.useActiveAccount)();
84
51
  const [manuallySelectedWallet, setManuallySelectedWallet] = (0, react_2.useState)(undefined);
85
52
  const wallets = (0, react_3.useConnectedWallets)();
86
- const setActiveWallet = (0, react_3.useSetActiveWallet)();
87
53
  const isAuthenticated = (0, react_1.useAuthStore)(state => state.isAuthenticated);
54
+ const isConnected = (0, react_1.useAuthStore)(state => state.isConnected);
55
+ const setActiveWallet = (0, react_3.useSetActiveWallet)();
56
+ const { user, setUser, refetchUser } = (0, react_1.useAuthentication)(partnerId);
57
+ debug("@@B3Provider:isConnected", isConnected);
88
58
  debug("@@wallets", wallets);
89
- const [user, setUser] = (0, react_2.useState)(() => {
90
- // Try to restore user from localStorage on initialization
91
- if (typeof window !== "undefined") {
92
- try {
93
- const storedUser = localStorage.getItem("b3-user");
94
- return storedUser ? JSON.parse(storedUser) : undefined;
95
- }
96
- catch (error) {
97
- console.warn("Failed to restore user from localStorage:", error);
98
- return undefined;
99
- }
100
- }
101
- return undefined;
102
- });
59
+ debug("@@B3Provider:user", user);
103
60
  // Use given accountOverride or activeAccount from thirdweb
104
61
  const effectiveAccount = isAuthenticated ? accountOverride || activeAccount : undefined;
105
- // Persist user to localStorage when it changes
106
- (0, react_2.useEffect)(() => {
107
- if (typeof window !== "undefined") {
108
- if (user) {
109
- localStorage.setItem("b3-user", JSON.stringify(user));
110
- }
111
- else {
112
- localStorage.removeItem("b3-user");
113
- }
114
- }
115
- }, [user]);
116
62
  const setWallet = (0, react_2.useCallback)((wallet) => {
117
63
  setManuallySelectedWallet(wallet);
118
64
  const account = wallet.getAccount();
@@ -145,6 +91,7 @@ function InnerProvider({ children, accountOverride, environment, defaultPermissi
145
91
  wallet: manuallySelectedWallet,
146
92
  user,
147
93
  setUser,
94
+ refetchUser,
148
95
  initialized: true,
149
96
  ready: !!effectiveAccount,
150
97
  automaticallySetFirstEoa,
@@ -152,5 +99,9 @@ function InnerProvider({ children, accountOverride, environment, defaultPermissi
152
99
  defaultPermissions,
153
100
  theme,
154
101
  clientType,
155
- }, children: children }));
102
+ partnerId: partnerId,
103
+ }, children: (0, jsx_runtime_1.jsx)(InnerProvider2, { children: children }) }));
156
104
  }
105
+ const InnerProvider2 = ({ children }) => {
106
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
107
+ };
@@ -5,21 +5,25 @@ import { B3ContextType } from "./types";
5
5
  /**
6
6
  * Main B3Provider component
7
7
  */
8
- export declare function B3Provider({ theme, children, accountOverride, environment, clientType, }: {
8
+ export declare function B3Provider({ theme, children, accountOverride, environment, clientType, partnerId, rpcUrls, }: {
9
9
  theme: "light" | "dark";
10
10
  children: React.ReactNode;
11
11
  accountOverride?: Account;
12
12
  environment: B3ContextType["environment"];
13
13
  clientType?: ClientType;
14
+ partnerId: string;
15
+ rpcUrls?: Record<number, string>;
14
16
  }): import("react/jsx-runtime").JSX.Element;
15
17
  /**
16
18
  * Inner provider component that provides the actual B3Context
17
19
  */
18
- export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, theme, clientType, }: {
20
+ export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, theme, clientType, partnerId, rpcUrls, }: {
19
21
  children: React.ReactNode;
20
22
  accountOverride?: Account;
21
23
  environment: B3ContextType["environment"];
22
24
  defaultPermissions?: PermissionsConfig;
23
25
  theme: "light" | "dark";
24
26
  clientType?: ClientType;
27
+ partnerId: string;
28
+ rpcUrls?: Record<number, string>;
25
29
  }): import("react/jsx-runtime").JSX.Element;
@@ -4,8 +4,10 @@ exports.B3Provider = B3Provider;
4
4
  exports.InnerProvider = InnerProvider;
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  const react_query_1 = require("@tanstack/react-query");
7
- const react_1 = require("react");
8
- const react_2 = require("thirdweb/react");
7
+ const react_1 = require("thirdweb/react");
8
+ const wagmi_1 = require("wagmi");
9
+ const useAuthentication_1 = require("../../hooks/useAuthentication");
10
+ const useWagmiConfig_1 = require("../../hooks/useWagmiConfig");
9
11
  const types_1 = require("./types");
10
12
  /**
11
13
  * Default permissions configuration for B3 provider
@@ -21,29 +23,32 @@ const queryClient = new react_query_1.QueryClient();
21
23
  /**
22
24
  * Main B3Provider component
23
25
  */
24
- function B3Provider({ theme = "light", children, accountOverride, environment, clientType = "socket", }) {
25
- return ((0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_2.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, clientType: clientType, children: children }) }) }));
26
+ function B3Provider({ theme = "light", children, accountOverride, environment, clientType = "socket", partnerId, rpcUrls, }) {
27
+ return ((0, jsx_runtime_1.jsx)(react_1.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, clientType: clientType, partnerId: partnerId, rpcUrls: rpcUrls, children: children }) }));
26
28
  }
27
29
  /**
28
30
  * Inner provider component that provides the actual B3Context
29
31
  */
30
- function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, theme = "light", clientType = "socket", }) {
31
- const activeAccount = (0, react_2.useActiveAccount)();
32
- const [user, setUser] = (0, react_1.useState)(undefined);
32
+ function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, theme = "light", clientType = "socket", partnerId, rpcUrls, }) {
33
+ const activeAccount = (0, react_1.useActiveAccount)();
34
+ const { user, setUser, refetchUser } = (0, useAuthentication_1.useAuthentication)(partnerId);
35
+ const wagmiConfig = (0, useWagmiConfig_1.useWagmiConfig)(partnerId, rpcUrls);
33
36
  // Use given accountOverride or activeAccount from thirdweb
34
37
  const effectiveAccount = accountOverride || activeAccount;
35
- return ((0, jsx_runtime_1.jsx)(types_1.B3Context.Provider, { value: {
36
- account: effectiveAccount,
37
- automaticallySetFirstEoa: false,
38
- setWallet: () => { },
39
- wallet: undefined,
40
- user,
41
- setUser,
42
- initialized: true,
43
- ready: !!effectiveAccount,
44
- environment,
45
- defaultPermissions,
46
- theme,
47
- clientType,
48
- }, children: children }));
38
+ return ((0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(types_1.B3Context.Provider, { value: {
39
+ account: effectiveAccount,
40
+ automaticallySetFirstEoa: false,
41
+ setWallet: () => { },
42
+ wallet: undefined,
43
+ user,
44
+ setUser,
45
+ initialized: true,
46
+ ready: !!effectiveAccount,
47
+ environment,
48
+ defaultPermissions,
49
+ theme,
50
+ clientType,
51
+ partnerId,
52
+ refetchUser,
53
+ }, children: children }) }) }));
49
54
  }
@@ -12,12 +12,14 @@ export interface B3ContextType {
12
12
  setWallet: (wallet: Wallet) => void;
13
13
  wallet?: Wallet;
14
14
  setUser: (user?: Users) => void;
15
+ refetchUser: () => Promise<any>;
15
16
  initialized: boolean;
16
17
  ready: boolean;
17
18
  environment?: "development" | "production";
18
19
  defaultPermissions?: PermissionsConfig;
19
20
  theme: "light" | "dark";
20
21
  clientType: ClientType;
22
+ partnerId: string;
21
23
  }
22
24
  /**
23
25
  * Context for B3 provider
@@ -12,9 +12,11 @@ exports.B3Context = (0, react_1.createContext)({
12
12
  setWallet: () => { },
13
13
  wallet: undefined,
14
14
  setUser: () => { },
15
+ refetchUser: async () => { },
15
16
  initialized: false,
16
17
  ready: false,
17
18
  environment: "development",
18
19
  theme: "light",
19
20
  clientType: "rest",
21
+ partnerId: "",
20
22
  });
@@ -1,8 +1,7 @@
1
1
  interface BalanceContentProps {
2
2
  onLogout?: () => void;
3
- partnerId: string;
4
3
  showDeposit?: boolean;
5
4
  showSwap?: boolean;
6
5
  }
7
- export declare function BalanceContent({ onLogout, partnerId, showDeposit, showSwap }: BalanceContentProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function BalanceContent({ onLogout, showDeposit, showSwap }: BalanceContentProps): import("react/jsx-runtime").JSX.Element;
8
7
  export {};
@@ -20,14 +20,14 @@ function centerTruncate(str, length = 4) {
20
20
  return str;
21
21
  return `${str.slice(0, length)}...${str.slice(-length)}`;
22
22
  }
23
- function BalanceContent({ onLogout, partnerId, showDeposit = true, showSwap = true }) {
23
+ function BalanceContent({ onLogout, showDeposit = true, showSwap = true }) {
24
24
  const account = (0, react_3.useActiveAccount)();
25
25
  const { address: eoaAddress, info: eoaInfo } = (0, useFirstEOA_1.useFirstEOA)();
26
26
  const { data: profile } = (0, react_1.useProfile)({
27
27
  address: eoaAddress || account?.address,
28
28
  fresh: true,
29
29
  });
30
- const { user } = (0, react_1.useB3)();
30
+ const { user, partnerId } = (0, react_1.useB3)();
31
31
  const { setB3ModalOpen, setB3ModalContentType, navigateBack } = (0, react_1.useModalStore)();
32
32
  const { logout } = (0, react_1.useAuthentication)(partnerId);
33
33
  const [logoutLoading, setLogoutLoading] = (0, react_2.useState)(false);
@@ -202,5 +202,5 @@ function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain
202
202
  if (["overview", "tokens", "nfts", "apps", "settings"].includes(tab)) {
203
203
  setActiveTab?.(tab);
204
204
  }
205
- }, children: [(0, jsx_runtime_1.jsx)("div", { className: "px-4", children: (0, jsx_runtime_1.jsxs)(react_1.TabsListPrimitive, { className: "grid h-auto grid-cols-2 grid-rows-2 gap-3 rounded-none border-none bg-transparent", children: [(0, jsx_runtime_1.jsxs)(react_1.TabTriggerPrimitive, { value: "overview", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.BarChart3, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "Overview" })] }), (0, jsx_runtime_1.jsxs)(react_1.TabTriggerPrimitive, { value: "tokens", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Coins, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "Tokens" })] }), (0, jsx_runtime_1.jsxs)(react_1.TabTriggerPrimitive, { value: "nfts", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Image, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "NFTs" })] }), (0, jsx_runtime_1.jsxs)(react_1.TabTriggerPrimitive, { value: "settings", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Settings, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "Settings" })] })] }) }), (0, jsx_runtime_1.jsx)(react_1.TabsContentPrimitive, { value: "overview", className: "px-4 pb-4 pt-2", children: (0, jsx_runtime_1.jsx)(BalanceContent_1.BalanceContent, { onLogout: onLogout, partnerId: partnerId, showDeposit: showDeposit, showSwap: showSwap }) }), (0, jsx_runtime_1.jsx)(react_1.TabsContentPrimitive, { value: "tokens", className: "px-4 pb-4 pt-2", children: (0, jsx_runtime_1.jsx)(ContentTokens_1.ContentTokens, { activeTab: activeTab }) }), (0, jsx_runtime_1.jsx)(react_1.TabsContentPrimitive, { value: "nfts", className: "px-4 pb-4 pt-2", children: (0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-3 gap-4", children: nfts?.nftResponse ? ((0, jsx_runtime_1.jsx)(AccountAssets_1.AccountAssets, { nfts: nfts.nftResponse, isLoading: isLoading })) : ((0, jsx_runtime_1.jsx)("div", { className: "col-span-3 py-12 text-center text-gray-500", children: "No NFTs found" })) }) }), (0, jsx_runtime_1.jsx)(react_1.TabsContentPrimitive, { value: "apps", className: "px-4 pb-4 pt-2", children: (0, jsx_runtime_1.jsx)(AppsContent, {}) }), (0, jsx_runtime_1.jsx)(react_1.TabsContentPrimitive, { value: "settings", className: "px-4 pb-4 pt-2", children: (0, jsx_runtime_1.jsx)(SettingsContent, {}) })] }) }) }));
205
+ }, children: [(0, jsx_runtime_1.jsx)("div", { className: "px-4", children: (0, jsx_runtime_1.jsxs)(react_1.TabsListPrimitive, { className: "grid h-auto grid-cols-2 grid-rows-2 gap-3 rounded-none border-none bg-transparent", children: [(0, jsx_runtime_1.jsxs)(react_1.TabTriggerPrimitive, { value: "overview", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.BarChart3, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "Overview" })] }), (0, jsx_runtime_1.jsxs)(react_1.TabTriggerPrimitive, { value: "tokens", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Coins, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "Tokens" })] }), (0, jsx_runtime_1.jsxs)(react_1.TabTriggerPrimitive, { value: "nfts", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Image, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "NFTs" })] }), (0, jsx_runtime_1.jsxs)(react_1.TabTriggerPrimitive, { value: "settings", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Settings, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "Settings" })] })] }) }), (0, jsx_runtime_1.jsx)(react_1.TabsContentPrimitive, { value: "overview", className: "px-4 pb-4 pt-2", children: (0, jsx_runtime_1.jsx)(BalanceContent_1.BalanceContent, { onLogout: onLogout, showDeposit: showDeposit, showSwap: showSwap }) }), (0, jsx_runtime_1.jsx)(react_1.TabsContentPrimitive, { value: "tokens", className: "px-4 pb-4 pt-2", children: (0, jsx_runtime_1.jsx)(ContentTokens_1.ContentTokens, { activeTab: activeTab }) }), (0, jsx_runtime_1.jsx)(react_1.TabsContentPrimitive, { value: "nfts", className: "px-4 pb-4 pt-2", children: (0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-3 gap-4", children: nfts?.nftResponse ? ((0, jsx_runtime_1.jsx)(AccountAssets_1.AccountAssets, { nfts: nfts.nftResponse, isLoading: isLoading })) : ((0, jsx_runtime_1.jsx)("div", { className: "col-span-3 py-12 text-center text-gray-500", children: "No NFTs found" })) }) }), (0, jsx_runtime_1.jsx)(react_1.TabsContentPrimitive, { value: "apps", className: "px-4 pb-4 pt-2", children: (0, jsx_runtime_1.jsx)(AppsContent, {}) }), (0, jsx_runtime_1.jsx)(react_1.TabsContentPrimitive, { value: "settings", className: "px-4 pb-4 pt-2", children: (0, jsx_runtime_1.jsx)(SettingsContent, {}) })] }) }) }));
206
206
  }
@@ -15,10 +15,10 @@ const react_4 = require("thirdweb/react");
15
15
  const ManageAccountButton_1 = require("../custom/ManageAccountButton");
16
16
  function SignIn(props) {
17
17
  const { className } = props;
18
- const { automaticallySetFirstEoa } = (0, react_1.useB3)();
18
+ const { automaticallySetFirstEoa, partnerId } = (0, react_1.useB3)();
19
19
  const { wallet, address: globalAddress, ensName, connectedSmartWallet, connectedEOAWallet, isActiveSmartWallet, isActiveEOAWallet, smartWalletIcon, eoaWalletIcon, } = (0, react_1.useAccountWallet)();
20
20
  const isMobile = (0, react_1.useIsMobile)();
21
- const { logout } = (0, react_1.useAuthentication)(String(process.env.NEXT_PUBLIC_THIRDWEB_PARTNER_ID));
21
+ const { logout } = (0, react_1.useAuthentication)(partnerId);
22
22
  const onDisconnect = async () => {
23
23
  await logout();
24
24
  };
@@ -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, isAuthenticated } = (0, react_1.useAuthentication)(props.partnerId, props.loginWithSiwe);
12
+ const { isAuthenticating, isAuthenticated } = (0, react_1.useAuthStore)();
13
13
  const isMobile = (0, react_1.useIsMobile)();
14
14
  (0, react_2.useEffect)(() => {
15
15
  if (account) {
@@ -3,4 +3,4 @@ import { SignInWithB3ModalProps } from "../../../../global-account/react";
3
3
  * Component that manages the authentication flow for Sign In With B3
4
4
  * Handles different login providers, authentication steps, and session key management
5
5
  */
6
- export declare function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin, loginWithSiwe, source, signersEnabled, }: SignInWithB3ModalProps): import("react/jsx-runtime").JSX.Element | null;
6
+ export declare function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin, source, signersEnabled, }: SignInWithB3ModalProps): import("react/jsx-runtime").JSX.Element | null;
@@ -15,16 +15,14 @@ const MAX_REFETCH_ATTEMPTS = 20;
15
15
  * Component that manages the authentication flow for Sign In With B3
16
16
  * Handles different login providers, authentication steps, and session key management
17
17
  */
18
- function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin = false, loginWithSiwe = false, source = "signInWithB3Button", signersEnabled = false, }) {
19
- const { setUser, automaticallySetFirstEoa } = (0, react_1.useB3)();
18
+ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin = false, source = "signInWithB3Button", signersEnabled = false, }) {
19
+ const { automaticallySetFirstEoa } = (0, react_1.useB3)();
20
20
  const [step, setStep] = (0, react_2.useState)(source === "requestPermissions" ? null : "login");
21
21
  const [sessionKeyAdded, setSessionKeyAdded] = (0, react_2.useState)(source === "requestPermissions" ? true : false);
22
22
  const { setB3ModalContentType, setB3ModalOpen, isOpen } = (0, react_1.useModalStore)();
23
23
  const account = (0, react_3.useActiveAccount)();
24
- const setIsAuthenticating = (0, react_1.useAuthStore)(state => state.setIsAuthenticating);
25
24
  const isAuthenticating = (0, react_1.useAuthStore)(state => state.isAuthenticating);
26
25
  const isConnected = (0, react_1.useAuthStore)(state => state.isConnected);
27
- const setIsConnected = (0, react_1.useAuthStore)(state => state.setIsConnected);
28
26
  const [refetchCount, setRefetchCount] = (0, react_2.useState)(0);
29
27
  const [refetchError, setRefetchError] = (0, react_2.useState)(null);
30
28
  const { data: signers, refetch: refetchSigners, isFetching: isFetchingSigners, } = (0, react_1.useGetAllTWSigners)({
@@ -34,7 +32,6 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
34
32
  enabled: signersEnabled,
35
33
  },
36
34
  });
37
- const { authenticate } = (0, react_1.useSiwe)();
38
35
  const [refetchQueued, setRefetchQueued] = (0, react_2.useState)(false);
39
36
  // Enhanced refetchSigners function that tracks number of attempts
40
37
  const handleRefetchSigners = (0, react_2.useCallback)(() => {
@@ -145,13 +142,11 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
145
142
  sessionKeyAddress,
146
143
  partnerId,
147
144
  closeAfterLogin,
148
- loginWithSiwe,
149
145
  source: "requestPermissions",
150
146
  });
151
147
  }, [
152
148
  chain,
153
149
  closeAfterLogin,
154
- loginWithSiwe,
155
150
  onError,
156
151
  onLoginSuccess,
157
152
  onSessionKeySuccess,
@@ -161,19 +156,8 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
161
156
  strategies,
162
157
  ]);
163
158
  const handleLoginSuccess = (0, react_2.useCallback)(async (account) => {
164
- debug("Authenticating with B3 via SIWE");
165
- setIsConnected(true);
166
- if (loginWithSiwe) {
167
- debug("setIsAuthenticating:true:1");
168
- setIsAuthenticating(true);
169
- const userAuth = await authenticate(account, partnerId);
170
- setUser(userAuth.user);
171
- }
172
- debug("handleLoginSuccess:account", account);
173
159
  onLoginSuccess?.(account);
174
- debug("setIsAuthenticating:false:1");
175
- setIsAuthenticating(false);
176
- }, [loginWithSiwe, onLoginSuccess, authenticate, partnerId, setUser, setIsConnected, setIsAuthenticating]);
160
+ }, [onLoginSuccess]);
177
161
  (0, react_2.useEffect)(() => {
178
162
  if (step === "permissions") {
179
163
  setB3ModalContentType({
@@ -195,14 +179,14 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
195
179
  if (step === "login") {
196
180
  // Custom strategy
197
181
  if (strategies?.[0] === "privy") {
198
- return (0, jsx_runtime_1.jsx)(SignInWithB3Privy_1.SignInWithB3Privy, { onSuccess: handleLoginSuccess, partnerId: partnerId, chain: chain });
182
+ return (0, jsx_runtime_1.jsx)(SignInWithB3Privy_1.SignInWithB3Privy, { onSuccess: handleLoginSuccess, chain: chain });
199
183
  }
200
184
  // Strategies are explicitly provided
201
185
  if (strategies) {
202
- return ((0, jsx_runtime_1.jsx)(LoginStepCustom_1.LoginStepCustom, { strategies: strategies, partnerId: partnerId, chain: chain, onSuccess: handleLoginSuccess, onError: onError, automaticallySetFirstEoa: !!automaticallySetFirstEoa }));
186
+ return ((0, jsx_runtime_1.jsx)(LoginStepCustom_1.LoginStepCustom, { strategies: strategies, chain: chain, onSuccess: handleLoginSuccess, onError: onError, automaticallySetFirstEoa: !!automaticallySetFirstEoa }));
203
187
  }
204
188
  // Default to handle all strategies we support
205
- return (0, jsx_runtime_1.jsx)(LoginStep_1.LoginStep, { partnerId: partnerId, chain: chain, onSuccess: handleLoginSuccess, onError: onError });
189
+ return (0, jsx_runtime_1.jsx)(LoginStep_1.LoginStep, { chain: chain, onSuccess: handleLoginSuccess, onError: onError });
206
190
  }
207
191
  return null;
208
192
  }
@@ -4,8 +4,7 @@ interface SignInWithB3PrivyProps {
4
4
  onError?: (error: Error) => Promise<void>;
5
5
  onSuccess: (account: Account) => Promise<void>;
6
6
  accessToken?: string;
7
- partnerId: string;
8
7
  chain: Chain;
9
8
  }
10
- export declare function SignInWithB3Privy({ onSuccess, onError, partnerId, chain }: SignInWithB3PrivyProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function SignInWithB3Privy({ onSuccess, onError, chain }: SignInWithB3PrivyProps): import("react/jsx-runtime").JSX.Element;
11
10
  export {};
@@ -6,8 +6,9 @@ const react_1 = require("../../../../global-account/react");
6
6
  const debug_1 = require("../../../../shared/utils/debug");
7
7
  const react_2 = require("react");
8
8
  const debug = (0, debug_1.debugB3React)("SignInWithB3Privy");
9
- function SignInWithB3Privy({ onSuccess, onError, partnerId, chain }) {
10
- const { isLoading, connectTw, fullToken } = (0, react_1.useHandleConnectWithPrivy)(partnerId, chain, onSuccess);
9
+ function SignInWithB3Privy({ onSuccess, onError, chain }) {
10
+ const { partnerId } = (0, react_1.useB3)();
11
+ const { isLoading, connectTw, fullToken } = (0, react_1.useHandleConnectWithPrivy)(chain, onSuccess);
11
12
  const setIsAuthenticating = (0, react_1.useAuthStore)(state => state.setIsAuthenticating);
12
13
  const setIsAuthenticated = (0, react_1.useAuthStore)(state => state.setIsAuthenticated);
13
14
  const { logout } = (0, react_1.useAuthentication)(partnerId);
@@ -9,7 +9,6 @@ interface LoginStepProps {
9
9
  /** Optional callback function called when an error occurs */
10
10
  onError?: (error: Error) => Promise<void>;
11
11
  /** Partner ID used for authentication */
12
- partnerId: string;
13
12
  /** Blockchain chain information */
14
13
  chain: Chain;
15
14
  /** Optional authentication strategy options */
@@ -20,5 +19,5 @@ interface LoginStepContainerProps {
20
19
  partnerId?: string;
21
20
  }
22
21
  export declare function LoginStepContainer({ children, partnerId }: LoginStepContainerProps): import("react/jsx-runtime").JSX.Element;
23
- export declare function LoginStep({ onSuccess, onError, partnerId, chain }: LoginStepProps): import("react/jsx-runtime").JSX.Element;
22
+ export declare function LoginStep({ onSuccess, chain }: LoginStepProps): import("react/jsx-runtime").JSX.Element;
24
23
  export {};
@@ -5,7 +5,6 @@ exports.LoginStep = LoginStep;
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  const react_1 = require("../../../../../global-account/react");
7
7
  const constants_1 = require("../../../../../shared/constants");
8
- const debug_1 = require("../../../../../shared/utils/debug");
9
8
  const thirdweb_1 = require("../../../../../shared/utils/thirdweb");
10
9
  const react_2 = require("thirdweb/react");
11
10
  const wallets_1 = require("thirdweb/wallets");
@@ -19,14 +18,12 @@ function LoginStepContainer({ children, partnerId }) {
19
18
  const partnerLogo = partner?.data?.[0]?.loginCustomization?.logoUrl;
20
19
  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
20
  }
22
- function LoginStep({ onSuccess, onError, partnerId, chain }) {
21
+ function LoginStep({ onSuccess, chain }) {
22
+ const { partnerId, theme } = (0, react_1.useB3)();
23
23
  const wallet = (0, wallets_1.ecosystemWallet)(constants_1.ecosystemWalletId, {
24
24
  partnerId: partnerId,
25
25
  });
26
- const { theme } = (0, react_1.useB3)();
27
- const setIsAuthenticating = (0, react_1.useAuthStore)(state => state.setIsAuthenticating);
28
- const setIsAuthenticated = (0, react_1.useAuthStore)(state => state.setIsAuthenticated);
29
- const { logout } = (0, react_1.useAuthentication)(partnerId);
26
+ const { onConnect } = (0, react_1.useAuthentication)(partnerId);
30
27
  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"
31
28
  ? (0, react_2.lightTheme)({
32
29
  colors: {
@@ -37,50 +34,18 @@ function LoginStep({ onSuccess, onError, partnerId, chain }) {
37
34
  colors: {
38
35
  modalBg: "hsl(var(--b3-react-background))",
39
36
  },
40
- }), autoConnect: true, style: {
37
+ }), style: {
41
38
  width: "100%",
42
39
  height: "100%",
43
40
  border: 0,
44
- },
45
- // TODO: Integrate with SIWE in useSIWE
46
- // auth={{
47
- // isLoggedIn: async (address) => {
48
- // console.log("checking if logged in!", { address });
49
- // return await isLoggedIn();
50
- // },
51
- // doLogin: async (params) => {
52
- // console.log("logging in!");
53
- // await login(params);
54
- // },
55
- // getLoginPayload: async ({ address }) =>
56
- // generatePayload({ address }),
57
- // doLogout: async () => {
58
- // console.log("logging out!");
59
- // await logout();
60
- // },
61
- // }}
62
- header: {
41
+ }, header: {
63
42
  title: "Sign in with B3",
64
43
  titleIcon: "https://cdn.b3.fun/b3_logo.svg",
65
44
  }, className: "b3-login-step", onConnect: async (wallet) => {
66
- try {
67
- setIsAuthenticating(true);
68
- (0, debug_1.debug)("setIsAuthenticating:true:6");
69
- const account = wallet.getAccount();
70
- if (!account)
71
- throw new Error("No account found");
72
- await onSuccess(account);
73
- setIsAuthenticated(true);
74
- console.log("connected!", wallet.id);
75
- }
76
- catch (error) {
77
- await onError?.(error);
78
- await logout();
79
- setIsAuthenticated(false);
80
- }
81
- finally {
82
- (0, debug_1.debug)("setIsAuthenticating:false:6");
83
- setIsAuthenticating(false);
84
- }
45
+ await onConnect(wallet);
46
+ const account = wallet.getAccount();
47
+ if (!account)
48
+ throw new Error("No account found");
49
+ await onSuccess(account);
85
50
  } }) }));
86
51
  }
@@ -5,10 +5,9 @@ interface LoginStepCustomProps {
5
5
  automaticallySetFirstEoa: boolean;
6
6
  onSuccess: (account: Account) => Promise<void>;
7
7
  onError?: (error: Error) => Promise<void>;
8
- partnerId: string;
9
8
  chain: Chain;
10
9
  strategies: AllowedStrategy[];
11
10
  maxInitialWallets?: number;
12
11
  }
13
- export declare function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, maxInitialWallets, automaticallySetFirstEoa, }: LoginStepCustomProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function LoginStepCustom({ onSuccess, onError, chain, strategies, maxInitialWallets, automaticallySetFirstEoa, }: LoginStepCustomProps): import("react/jsx-runtime").JSX.Element;
14
13
  export {};
@@ -9,7 +9,8 @@ const react_2 = require("react");
9
9
  const react_3 = require("thirdweb/react");
10
10
  const wallets_1 = require("thirdweb/wallets");
11
11
  const debug = (0, debug_1.debugB3React)("LoginStepCustom");
12
- function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, maxInitialWallets = 2, automaticallySetFirstEoa, }) {
12
+ function LoginStepCustom({ onSuccess, onError, chain, strategies, maxInitialWallets = 2, automaticallySetFirstEoa, }) {
13
+ const { partnerId } = (0, react_1.useB3)();
13
14
  const [isLoading, setIsLoading] = (0, react_2.useState)(false);
14
15
  const [showAllWallets, setShowAllWallets] = (0, react_2.useState)(false);
15
16
  const { connect } = (0, react_1.useConnect)(partnerId, chain);
@@ -5,8 +5,9 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("../../../../global-account/react");
6
6
  const utils_1 = require("../../../../shared/utils");
7
7
  function ManageAccountButton(props) {
8
+ const { partnerId } = (0, react_1.useB3)();
8
9
  const { setB3ModalOpen, setB3ModalContentType } = (0, react_1.useModalStore)();
9
- const { isConnected } = (0, react_1.useAuthentication)(props.partnerId, props.loginWithSiwe);
10
+ const { isConnected } = (0, react_1.useAuthentication)(partnerId);
10
11
  const handleClickManageAccount = () => {
11
12
  setB3ModalContentType({
12
13
  ...props,