@b3dotfun/sdk 0.1.1 → 0.1.2-test.0
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.
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +3 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +3 -0
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +3 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +3 -0
- package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +3 -0
- package/package.json +1 -1
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +5 -1
- package/src/global-account/react/stores/useModalStore.ts +3 -0
|
@@ -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, 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, onTurnkeyConnect, }: SignInWithB3ModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -16,7 +16,7 @@ const MAX_REFETCH_ATTEMPTS = 20;
|
|
|
16
16
|
* Component that manages the authentication flow for Sign In With B3
|
|
17
17
|
* Handles different login providers, authentication steps, and session key management
|
|
18
18
|
*/
|
|
19
|
-
function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin = false, source = "signInWithB3Button", signersEnabled = false, }) {
|
|
19
|
+
function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin = false, source = "signInWithB3Button", signersEnabled = false, onTurnkeyConnect, }) {
|
|
20
20
|
const { automaticallySetFirstEoa, enableTurnkey } = (0, react_1.useB3Config)();
|
|
21
21
|
const { user, refetchUser, logout } = (0, react_1.useAuthentication)(partnerId);
|
|
22
22
|
// FIXME Logout before login to ensure a clean state
|
|
@@ -348,6 +348,8 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
348
348
|
setJustCompletedLogin(true);
|
|
349
349
|
// Call the login success callback
|
|
350
350
|
onLoginSuccess?.({});
|
|
351
|
+
// Call the onTurnkeyConnect callback
|
|
352
|
+
onTurnkeyConnect?.(authenticatedUser);
|
|
351
353
|
}, onClose: () => {
|
|
352
354
|
// If user closes Turnkey modal, they can still use wallet connection as fallback
|
|
353
355
|
setTurnkeyAuthCompleted(true);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Users } from "@b3dotfun/b3-api";
|
|
1
2
|
import { components } from "../../../anyspend/types/api";
|
|
2
3
|
import { GenerateSigMintResponse } from "../../../anyspend/types/signatureMint";
|
|
3
4
|
import { AllowedStrategy } from "../../../global-account/react";
|
|
@@ -40,6 +41,8 @@ export interface SignInWithB3ModalProps extends BaseModalProps {
|
|
|
40
41
|
source?: "signInWithB3Button" | "requestPermissions";
|
|
41
42
|
/** Whether to show the signers enabled modal */
|
|
42
43
|
signersEnabled?: boolean;
|
|
44
|
+
/** Callback for turnkey auth */
|
|
45
|
+
onTurnkeyConnect?: (user: Users) => void;
|
|
43
46
|
}
|
|
44
47
|
/**
|
|
45
48
|
* Props for the Turnkey Authentication modal
|
|
@@ -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, 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, onTurnkeyConnect, }: SignInWithB3ModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -13,7 +13,7 @@ const MAX_REFETCH_ATTEMPTS = 20;
|
|
|
13
13
|
* Component that manages the authentication flow for Sign In With B3
|
|
14
14
|
* Handles different login providers, authentication steps, and session key management
|
|
15
15
|
*/
|
|
16
|
-
export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin = false, source = "signInWithB3Button", signersEnabled = false, }) {
|
|
16
|
+
export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin = false, source = "signInWithB3Button", signersEnabled = false, onTurnkeyConnect, }) {
|
|
17
17
|
const { automaticallySetFirstEoa, enableTurnkey } = useB3Config();
|
|
18
18
|
const { user, refetchUser, logout } = useAuthentication(partnerId);
|
|
19
19
|
// FIXME Logout before login to ensure a clean state
|
|
@@ -345,6 +345,8 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
|
|
|
345
345
|
setJustCompletedLogin(true);
|
|
346
346
|
// Call the login success callback
|
|
347
347
|
onLoginSuccess?.({});
|
|
348
|
+
// Call the onTurnkeyConnect callback
|
|
349
|
+
onTurnkeyConnect?.(authenticatedUser);
|
|
348
350
|
}, onClose: () => {
|
|
349
351
|
// If user closes Turnkey modal, they can still use wallet connection as fallback
|
|
350
352
|
setTurnkeyAuthCompleted(true);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Users } from "@b3dotfun/b3-api";
|
|
1
2
|
import { components } from "../../../anyspend/types/api";
|
|
2
3
|
import { GenerateSigMintResponse } from "../../../anyspend/types/signatureMint";
|
|
3
4
|
import { AllowedStrategy } from "../../../global-account/react";
|
|
@@ -40,6 +41,8 @@ export interface SignInWithB3ModalProps extends BaseModalProps {
|
|
|
40
41
|
source?: "signInWithB3Button" | "requestPermissions";
|
|
41
42
|
/** Whether to show the signers enabled modal */
|
|
42
43
|
signersEnabled?: boolean;
|
|
44
|
+
/** Callback for turnkey auth */
|
|
45
|
+
onTurnkeyConnect?: (user: Users) => void;
|
|
43
46
|
}
|
|
44
47
|
/**
|
|
45
48
|
* Props for the Turnkey Authentication modal
|
|
@@ -3,4 +3,4 @@ import { SignInWithB3ModalProps } from "@b3dotfun/sdk/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, 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, onTurnkeyConnect, }: SignInWithB3ModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Users } from "@b3dotfun/b3-api";
|
|
1
2
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
3
|
import { GenerateSigMintResponse } from "@b3dotfun/sdk/anyspend/types/signatureMint";
|
|
3
4
|
import { AllowedStrategy } from "@b3dotfun/sdk/global-account/react";
|
|
@@ -40,6 +41,8 @@ export interface SignInWithB3ModalProps extends BaseModalProps {
|
|
|
40
41
|
source?: "signInWithB3Button" | "requestPermissions";
|
|
41
42
|
/** Whether to show the signers enabled modal */
|
|
42
43
|
signersEnabled?: boolean;
|
|
44
|
+
/** Callback for turnkey auth */
|
|
45
|
+
onTurnkeyConnect?: (user: Users) => void;
|
|
43
46
|
}
|
|
44
47
|
/**
|
|
45
48
|
* Props for the Turnkey Authentication modal
|
package/package.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Users } from "@b3dotfun/b3-api";
|
|
1
2
|
import {
|
|
2
3
|
Loading,
|
|
3
4
|
SignInWithB3ModalProps,
|
|
@@ -34,6 +35,7 @@ export function SignInWithB3Flow({
|
|
|
34
35
|
closeAfterLogin = false,
|
|
35
36
|
source = "signInWithB3Button",
|
|
36
37
|
signersEnabled = false,
|
|
38
|
+
onTurnkeyConnect,
|
|
37
39
|
}: SignInWithB3ModalProps) {
|
|
38
40
|
const { automaticallySetFirstEoa, enableTurnkey } = useB3Config();
|
|
39
41
|
const { user, refetchUser, logout } = useAuthentication(partnerId);
|
|
@@ -395,7 +397,7 @@ export function SignInWithB3Flow({
|
|
|
395
397
|
content = (
|
|
396
398
|
<LoginStepContainer partnerId={partnerId}>
|
|
397
399
|
<TurnkeyAuthModal
|
|
398
|
-
onSuccess={async (authenticatedUser:
|
|
400
|
+
onSuccess={async (authenticatedUser: Users) => {
|
|
399
401
|
debug("Turnkey authentication successful in primary flow", { authenticatedUser });
|
|
400
402
|
setTurnkeyAuthCompleted(true);
|
|
401
403
|
// After Turnkey auth, refetch user to get the full user object
|
|
@@ -408,6 +410,8 @@ export function SignInWithB3Flow({
|
|
|
408
410
|
setJustCompletedLogin(true);
|
|
409
411
|
// Call the login success callback
|
|
410
412
|
onLoginSuccess?.({} as Account);
|
|
413
|
+
// Call the onTurnkeyConnect callback
|
|
414
|
+
onTurnkeyConnect?.(authenticatedUser);
|
|
411
415
|
}}
|
|
412
416
|
onClose={() => {
|
|
413
417
|
// If user closes Turnkey modal, they can still use wallet connection as fallback
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Users } from "@b3dotfun/b3-api";
|
|
1
2
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
3
|
import { GenerateSigMintResponse } from "@b3dotfun/sdk/anyspend/types/signatureMint";
|
|
3
4
|
import { AllowedStrategy } from "@b3dotfun/sdk/global-account/react";
|
|
@@ -43,6 +44,8 @@ export interface SignInWithB3ModalProps extends BaseModalProps {
|
|
|
43
44
|
source?: "signInWithB3Button" | "requestPermissions";
|
|
44
45
|
/** Whether to show the signers enabled modal */
|
|
45
46
|
signersEnabled?: boolean;
|
|
47
|
+
/** Callback for turnkey auth */
|
|
48
|
+
onTurnkeyConnect?: (user: Users) => void;
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
/**
|