Repository navigation
Expand file tree
/
Copy pathindex.d.ts
More file actions
295 lines (281 loc) · 11.4 KB
/
Copy pathindex.d.ts
File metadata and controls
295 lines (281 loc) · 11.4 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
import * as i0 from '@angular/core';
import { EventEmitter, Type, NgZone, Injector, ModuleWithProviders, ElementRef } from '@angular/core';
import { Observable } from 'rxjs';
import * as i1 from '@angular/common';
declare class SocialUser {
provider: string;
id: string;
email: string;
name: string;
photoUrl: string;
firstName: string;
lastName: string;
authToken: string;
idToken: string;
authorizationCode: string;
response: any;
}
interface LoginProvider {
readonly changeUser?: EventEmitter<SocialUser>;
initialize(autoLogin?: boolean, lang?: string): Promise<void>;
getLoginStatus(): Promise<SocialUser>;
signIn(signInOptions?: object): Promise<SocialUser>;
signOut(revoke?: boolean): Promise<void>;
refreshToken?(): Promise<SocialUser | null>;
}
/**
* An interface to define the shape of the service configuration options.
*/
interface SocialAuthServiceConfig {
autoLogin?: boolean;
lang?: string;
providers: {
id: string;
provider: LoginProvider | Type<LoginProvider>;
}[];
onError?: (error: any) => any;
}
/**
* The service encapsulating the social login functionality. Exposes methods like
* `signIn`, `signOut`. Also, exposes an `authState` `Observable` that one can
* subscribe to get the current logged in user information.
*
* @dynamic
*/
declare class SocialAuthService {
private readonly _ngZone;
private readonly _injector;
private static readonly ERR_LOGIN_PROVIDER_NOT_FOUND;
private static readonly ERR_NOT_LOGGED_IN;
private static readonly ERR_NOT_INITIALIZED;
private static readonly ERR_NOT_SUPPORTED_FOR_REFRESH_TOKEN;
private static readonly ERR_NOT_SUPPORTED_FOR_ACCESS_TOKEN;
private providers;
private autoLogin;
private lang;
private _user;
private _authState;
private initialized;
private _initState;
/** An `Observable` that one can subscribe to get the current logged in user information */
get authState(): Observable<SocialUser>;
/** An `Observable` to communicate the readiness of the service and associated login providers */
get initState(): Observable<boolean>;
/**
* @param config A `SocialAuthServiceConfig` object or a `Promise` that resolves to a `SocialAuthServiceConfig` object
*/
constructor(config: SocialAuthServiceConfig | Promise<SocialAuthServiceConfig>, _ngZone: NgZone, _injector: Injector);
private initialize;
getAccessToken(providerId: string): Promise<string>;
refreshAuthToken(providerId: string): Promise<void>;
refreshAccessToken(providerId: string): Promise<void>;
/**
* A method used to sign in a user with a specific `LoginProvider`.
*
* @param providerId Id with which the `LoginProvider` has been registered with the service
* @param signInOptions Optional `LoginProvider` specific arguments
* @returns A `Promise` that resolves to the authenticated user information
*/
signIn(providerId: string, signInOptions?: any): Promise<SocialUser>;
/**
* A method used to sign out the currently loggen in user.
*
* @param revoke Optional parameter to specify whether a hard sign out is to be performed
* @returns A `Promise` that resolves if the operation is successful, rejects otherwise
*/
signOut(revoke?: boolean): Promise<void>;
private setUser;
static ɵfac: i0.ɵɵFactoryDeclaration<SocialAuthService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<SocialAuthService>;
}
/**
* The main module of angularx-social-login library.
*/
declare class SocialLoginModule {
static initialize(config: SocialAuthServiceConfig): ModuleWithProviders<SocialLoginModule>;
constructor(parentModule: SocialLoginModule);
static ɵfac: i0.ɵɵFactoryDeclaration<SocialLoginModule, [{ optional: true; skipSelf: true; }]>;
static ɵmod: i0.ɵɵNgModuleDeclaration<SocialLoginModule, never, [typeof i1.CommonModule], never>;
static ɵinj: i0.ɵɵInjectorDeclaration<SocialLoginModule>;
}
declare abstract class BaseLoginProvider implements LoginProvider {
constructor();
readonly changeUser?: EventEmitter<SocialUser>;
abstract initialize(autoLogin?: boolean, lang?: string): Promise<void>;
abstract getLoginStatus(): Promise<SocialUser>;
abstract signIn(signInOptions?: object): Promise<SocialUser>;
abstract signOut(revoke?: boolean): Promise<void>;
refreshToken?(): Promise<SocialUser | null>;
protected loadScript(id: string, src: string, onload: any, parentElement?: any): void;
}
declare class DummyLoginProvider extends BaseLoginProvider {
static readonly PROVIDER_ID: string;
static readonly DEFAULT_USER: {
id: string;
name: string;
email: string;
firstName: string;
lastName: string;
authToken: string;
photoUrl: string;
provider: string;
idToken: string;
authorizationCode: string;
response: {};
};
private dummy;
private loggedIn;
constructor(dummy?: SocialUser);
getLoginStatus(): Promise<SocialUser>;
initialize(): Promise<void>;
signIn(): Promise<SocialUser>;
signOut(revoke?: boolean): Promise<void>;
}
interface GoogleInitOptions {
/**
* enables the One Tap mechanism, and makes auto-login possible
*/
oneTapEnabled?: boolean;
/**
* list of permission scopes to grant in case we request an access token
*/
scopes?: string | string[];
/**
* This attribute sets the DOM ID of the container element. If it's not set, the One Tap prompt is displayed in the top-right corner of the window.
*/
prompt_parent_id?: string;
/**
* Optional, defaults to 'select_account'.
* A space-delimited, case-sensitive list of prompts to present the
* user.
* Possible values are:
* empty string The user will be prompted only the first time your
* app requests access. Cannot be specified with other values.
* 'none' Do not display any authentication or consent screens. Must
* not be specified with other values.
* 'consent' Prompt the user for consent.
* 'select_account' Prompt the user to select an account.
*/
prompt?: '' | 'none' | 'consent' | 'select_account';
}
declare class GoogleLoginProvider extends BaseLoginProvider {
private clientId;
private readonly initOptions?;
static readonly PROVIDER_ID: string;
readonly changeUser: EventEmitter<SocialUser>;
private readonly _socialUser;
private readonly _accessToken;
private readonly _receivedAccessToken;
private _tokenClient;
constructor(clientId: string, initOptions?: GoogleInitOptions);
initialize(autoLogin?: boolean, lang?: string): Promise<void>;
getLoginStatus(): Promise<SocialUser>;
refreshToken(): Promise<SocialUser | null>;
getAccessToken(): Promise<string>;
revokeAccessToken(): Promise<void>;
signIn(): Promise<SocialUser>;
signOut(): Promise<void>;
private createSocialUser;
private decodeJwt;
private getGoogleLoginScriptSrc;
}
declare class FacebookLoginProvider extends BaseLoginProvider {
private clientId;
static readonly PROVIDER_ID: string;
private requestOptions;
constructor(clientId: string, initOptions?: Object);
initialize(): Promise<void>;
getLoginStatus(): Promise<SocialUser>;
signIn(signInOptions?: any): Promise<SocialUser>;
signOut(): Promise<void>;
}
declare class AmazonLoginProvider extends BaseLoginProvider {
private clientId;
private initOptions;
static readonly PROVIDER_ID: string;
constructor(clientId: string, initOptions?: any);
initialize(): Promise<void>;
getLoginStatus(): Promise<SocialUser>;
signIn(signInOptions?: any): Promise<SocialUser>;
signOut(): Promise<void>;
private persistToken;
private retrieveToken;
private clearToken;
}
declare class VKLoginProvider extends BaseLoginProvider {
private clientId;
private initOptions;
constructor(clientId: string, initOptions?: {
fields: string;
version: string;
});
static readonly PROVIDER_ID: string;
private readonly VK_API_URL;
private readonly VK_API_GET_USER;
initialize(): Promise<void>;
getLoginStatus(): Promise<SocialUser>;
signIn(permissions: string[]): Promise<SocialUser>;
signOut(): Promise<void>;
private signInInternal;
private getUser;
private getLoginStatusInternal;
private createUser;
}
/**
* Protocol modes supported by MSAL.
*/
declare enum ProtocolMode {
AAD = "AAD",
OIDC = "OIDC"
}
/**
* Initialization Options for Microsoft Provider: https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/initialization.md
* Details (not all options are supported): https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/configuration.md
*/
type MicrosoftOptions = {
redirect_uri?: string;
logout_redirect_uri?: string;
authority?: string;
knownAuthorities?: string[];
protocolMode?: ProtocolMode;
clientCapabilities?: string[];
cacheLocation?: string;
scopes?: string[];
prompt?: string;
};
/**
* Microsoft Authentication using MSAL v2: https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-browser
*/
declare class MicrosoftLoginProvider extends BaseLoginProvider {
private clientId;
private _instance;
static readonly PROVIDER_ID: string;
private initOptions;
constructor(clientId: string, initOptions?: MicrosoftOptions);
initialize(): Promise<void>;
private getSocialUser;
getLoginStatus(): Promise<SocialUser>;
signIn(): Promise<SocialUser>;
signOut(revoke?: boolean): Promise<void>;
}
declare class GoogleSigninButtonDirective {
type: 'icon' | 'standard';
size: 'small' | 'medium' | 'large';
text: 'signin_with' | 'signup_with' | 'continue_with';
shape: 'square' | 'circle' | 'pill' | 'rectangular';
theme: 'outline' | 'filled_blue' | 'filled_black';
logo_alignment: 'left' | 'center';
width: number;
locale: string;
constructor(el: ElementRef, socialAuthService: SocialAuthService);
static ɵfac: i0.ɵɵFactoryDeclaration<GoogleSigninButtonDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<GoogleSigninButtonDirective, "asl-google-signin-button", never, { "type": { "alias": "type"; "required": false; }; "size": { "alias": "size"; "required": false; }; "text": { "alias": "text"; "required": false; }; "shape": { "alias": "shape"; "required": false; }; "theme": { "alias": "theme"; "required": false; }; "logo_alignment": { "alias": "logo_alignment"; "required": false; }; "width": { "alias": "width"; "required": false; }; "locale": { "alias": "locale"; "required": false; }; }, {}, never, never, true, never>;
}
declare class GoogleSigninButtonModule {
static ɵfac: i0.ɵɵFactoryDeclaration<GoogleSigninButtonModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<GoogleSigninButtonModule, never, [typeof GoogleSigninButtonDirective], [typeof GoogleSigninButtonDirective]>;
static ɵinj: i0.ɵɵInjectorDeclaration<GoogleSigninButtonModule>;
}
export { AmazonLoginProvider, BaseLoginProvider, DummyLoginProvider, FacebookLoginProvider, GoogleLoginProvider, GoogleSigninButtonDirective, GoogleSigninButtonModule, MicrosoftLoginProvider, SocialAuthService, SocialLoginModule, SocialUser, VKLoginProvider };
export type { GoogleInitOptions, LoginProvider, SocialAuthServiceConfig };
//# sourceMappingURL=index.d.ts.map