diff --git a/packages/@magic-ext/farcaster/src/index.ts b/packages/@magic-ext/farcaster/src/index.ts index 8d6e78214..84e857d07 100644 --- a/packages/@magic-ext/farcaster/src/index.ts +++ b/packages/@magic-ext/farcaster/src/index.ts @@ -1,4 +1,4 @@ -import { Extension } from '@magic-sdk/commons'; +import {Extension, FarcasterLoginEventEmit} from '@magic-sdk/commons'; import { FarcasterPayloadMethod } from './types'; import { isMainFrame, isMobile } from './utils'; @@ -67,6 +67,8 @@ type FarcasterLoginEventHandlers = { [FarcasterLoginEventOnReceived.OpenChannel]: (channel: CreateChannelAPIResponse) => void; [FarcasterLoginEventOnReceived.Success]: (data: StatusAPIResponse) => void; [FarcasterLoginEventOnReceived.Failed]: (error: AuthClientError) => void; + + [FarcasterLoginEventEmit.Cancel]: () => void; }; export class FarcasterExtension extends Extension.Internal<'farcaster'> { @@ -92,6 +94,10 @@ export class FarcasterExtension extends Extension.Internal<'farcaster'> { } }); + handle.on(FarcasterLoginEventEmit.Cancel, () => { + this.createIntermediaryEvent(FarcasterLoginEventEmit.Cancel, payload.id as string)(); + }); + return handle; }; } diff --git a/packages/@magic-sdk/types/src/modules/auth-types.ts b/packages/@magic-sdk/types/src/modules/auth-types.ts index 916777fc6..8190cb729 100644 --- a/packages/@magic-sdk/types/src/modules/auth-types.ts +++ b/packages/@magic-sdk/types/src/modules/auth-types.ts @@ -227,7 +227,7 @@ export enum AuthEventOnReceived { } export enum FarcasterLoginEventEmit { - SuccessSignIn = 'Farcaster/success_sign_in', + Cancel = 'Farcaster/cancel', } export enum EnableMFAEventOnReceived { diff --git a/packages/@magic-sdk/types/src/modules/intermediary-types.ts b/packages/@magic-sdk/types/src/modules/intermediary-types.ts index 03e907162..a1e640d38 100644 --- a/packages/@magic-sdk/types/src/modules/intermediary-types.ts +++ b/packages/@magic-sdk/types/src/modules/intermediary-types.ts @@ -2,7 +2,6 @@ import { AuthEventOnReceived, DeviceVerificationEventEmit, DeviceVerificationEventOnReceived, - FarcasterLoginEventEmit, LoginWithEmailOTPEventEmit, LoginWithSmsOTPEventEmit, LoginWithEmailOTPEventOnReceived, @@ -17,6 +16,7 @@ import { EnableMFAEventOnReceived, DisableMFAEventOnReceived, DisableMFAEventEmit, + FarcasterLoginEventEmit, } from './auth-types'; import { NftCheckoutIntermediaryEvents } from './nft-types';