UNPKG

@0xsequence/connect

Version:
50 lines 1.96 kB
/** * Represents formatted email conflict information returned by the hook. * This is a user-friendly version of the EmailConflictInfo from the WaaS service. */ export type FormattedEmailConflictInfo = { /** The email address that caused the conflict */ email: string; /** User-friendly description of the account type (e.g., 'Google login', 'Email login') */ type: string; }; /** * Hook to handle email conflict detection and resolution for WaaS (Wallet-as-a-Service) authentication. * * This hook monitors all WaaS connectors for email conflicts that occur during sign-in attempts. * A conflict happens when a user tries to sign up with an email that's already associated with * a different authentication method (e.g., trying to use Google sign-in when the email was * previously used with Apple sign-in). * * @returns An object containing: * - `toggleEmailConflictModal` - Function to manually show/hide the conflict modal * - `isEmailConflictOpen` - Whether the conflict modal is currently open * - `emailConflictInfo` - Formatted information about the conflict (email and account type) * - `forceCreate` - Function to force create a new account despite the conflict * * @example * ```tsx * const { * isEmailConflictOpen, * emailConflictInfo, * toggleEmailConflictModal * } = useEmailConflict() * * // When a conflict is detected * if (isEmailConflictOpen && emailConflictInfo) { * console.log( * `Email ${emailConflictInfo.email} is already used with ${emailConflictInfo.type}` * ) * } * * // Close the conflict modal * toggleEmailConflictModal(false) * ``` */ export declare const useEmailConflict: () => { toggleEmailConflictModal: import("react").Dispatch<import("react").SetStateAction<boolean>>; isEmailConflictOpen: boolean; emailConflictInfo: FormattedEmailConflictInfo; forceCreate: () => Promise<void | undefined>; }; //# sourceMappingURL=useWaasEmailConflict.d.ts.map