forked from anthonyjgrove/react-google-login
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
110 lines (98 loc) · 3.18 KB
/
index.d.ts
File metadata and controls
110 lines (98 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// Type definitions for react-google-login v2.5.4
// Project: https://github.com/anthonyjgrove/react-google-login
// Definitions by: Ruslan Ibragimov <https://github.com/IRus>
import {Component, ReactNode, CSSProperties} from 'react';
export as namespace ReactGoogleLogin;
interface AuthResponse {
readonly access_token: string;
readonly id_token: string;
readonly login_hint: string;
readonly scope: string;
readonly expires_in: number;
readonly first_issued_at: number;
readonly expires_at: number;
}
interface BasicProfile {
getId(): string;
getEmail(): string;
getName(): string;
getGivenName(): string;
getFamilyName(): string;
getImageUrl(): string;
}
// Based on https://developers.google.com/identity/sign-in/web/reference
export interface GoogleLoginResponse {
getBasicProfile(): BasicProfile;
getAuthResponse(): AuthResponse;
reloadAuthResponse(): Promise<AuthResponse>;
getGrantedScopes(): string;
getHostedDomain(): string;
getId(): string;
isSignedIn(): boolean;
hasGrantedScopes(scopes: string): boolean;
disconnect(): void;
grantOfflineAccess(options: GrantOfflineAccessOptions): Promise<GoogleLoginResponseOffline>;
signIn(options: SignInOptions): Promise<any>;
grant(options: SignInOptions): Promise<any>;
}
interface GrantOfflineAccessOptions {
readonly scope?: string;
readonly redirect_uri?: string;
}
interface SignInOptions {
readonly scope?: string;
readonly app_package_name?: string;
readonly fetch_basic_profile?: boolean;
readonly prompt?: string;
}
export interface GoogleLoginResponseOffline {
readonly code: string;
}
export interface GoogleLoginProps {
readonly onSuccess: (response: GoogleLoginResponse | GoogleLoginResponseOffline) => void,
readonly onFailure: (error: any) => void,
readonly clientId: string,
readonly jsSrc?: string,
readonly onRequest?: () => void,
readonly buttonText?: string,
readonly scope?: string,
readonly className?: string,
readonly redirectUri?: string,
readonly cookiePolicy?: string,
readonly loginHint?: string,
readonly hostedDomain?: string,
readonly prompt?: string,
readonly responseType?: string,
readonly children?: ReactNode,
readonly style?: CSSProperties,
readonly tag?: string,
readonly disabled?: boolean;
readonly autoLoad?: boolean;
readonly uxMode?: string;
readonly disabledStyle?: CSSProperties;
readonly fetchBasicProfile?: boolean;
readonly isSignedIn?: boolean;
readonly type?: string;
readonly accessType?: string;
readonly render?: (props?: { onClick: () => void }) => JSX.Element;
}
export class GoogleLogin extends Component<GoogleLoginProps, {}> {
public signIn(e?: Event): void;
}
export interface GoogleLogoutProps {
readonly clientId: string,
readonly onLogoutSuccess?: () => void;
readonly buttonText?: string;
readonly className?: string;
readonly children?: ReactNode;
readonly jsSrc?: string;
readonly style?: CSSProperties;
readonly disabled?: boolean;
readonly disabledStyle?: CSSProperties;
readonly tag?: string;
readonly render?: (props?: { onClick: () => void }) => JSX.Element;
}
export class GoogleLogout extends Component<GoogleLogoutProps, {}> {
public signOut(): void;
}
export default GoogleLogin;