import { CSSProperties, ReactChild, ReactNode } from "react"; interface KakaoError { error: string; error_description: string; } interface LoginResponse { token_type: string; access_token: string; expires_in: string; refresh_token: string; refresh_token_expires_in: number; scope: string; } interface LoginParams { throughTalk?: boolean; persistAccessToken?: boolean; scope?: string; success: (response: LoginResponse) => void; fail: (error: KakaoError) => void; } declare type LogoutCallback = () => void; interface KakaoAuth { login: (params: LoginParams) => void; loginForm: (params: LoginParams) => void; logout: (callback: LogoutCallback) => void; getAccessToken: () => string | null; } interface Profile { nickname: string; profile_image: string; thumbnail_image_url: string; profile_needs_agreement?: boolean; } interface KakaoAccount { profile: Profile; email: string; age_range: string; birthday: string; birthyear: string; gender: "female" | "male"; phone_number: string; ci: string; } interface UserProfile { id: number; kakao_account: KakaoAccount; synched_at: string; connected_at: string; properties: Profile; } interface RequestParams { url: string; success: (profile: UserProfile) => void; fail: (error: KakaoError) => void; } interface KakaoAPI { request: (params: RequestParams) => void; } interface Kakao { init: (...args: any[]) => void; Auth: KakaoAuth; API: KakaoAPI; } export interface ExtendedWindow extends Window { Kakao: Kakao; } declare type Scope = "id" | "kakao_account" | "synched_at" | "connected_at" | "properties"; export interface Props { token: string; onSuccess: (response: { response: LoginResponse; profile?: UserProfile; }) => void; onFail: (error: KakaoError) => void; onLogout?: (token?: string | null) => void; scopes?: Scope[]; needProfile?: boolean; throughTalk?: boolean; useLoginForm?: boolean; persistAccessToken?: boolean; children?: ReactChild; style?: CSSProperties; render?: ({ onClick }: { onClick: () => void; }) => ReactNode; className?: string; } export interface State { isLoggedIn: boolean; } export {};