1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | import { Auth, AuthProvider, Persistence, PopupRedirectResolver, UserCredential } from './public_types';
|
18 | import { FirebaseError } from '@firebase/util';
|
19 | import { AuthPopup } from '../platform_browser/util/popup';
|
20 | import { AuthInternal } from './auth';
|
21 | import { UserCredentialInternal } from './user';
|
22 | export declare const enum EventFilter {
|
23 | POPUP = 0,
|
24 | REDIRECT = 1
|
25 | }
|
26 | export declare const enum GapiOutcome {
|
27 | ACK = "ACK",
|
28 | ERROR = "ERROR"
|
29 | }
|
30 | export interface GapiAuthEvent extends gapi.iframes.Message {
|
31 | authEvent: AuthEvent;
|
32 | }
|
33 |
|
34 |
|
35 |
|
36 | export declare const enum AuthEventType {
|
37 | LINK_VIA_POPUP = "linkViaPopup",
|
38 | LINK_VIA_REDIRECT = "linkViaRedirect",
|
39 | REAUTH_VIA_POPUP = "reauthViaPopup",
|
40 | REAUTH_VIA_REDIRECT = "reauthViaRedirect",
|
41 | SIGN_IN_VIA_POPUP = "signInViaPopup",
|
42 | SIGN_IN_VIA_REDIRECT = "signInViaRedirect",
|
43 | UNKNOWN = "unknown",
|
44 | VERIFY_APP = "verifyApp"
|
45 | }
|
46 | export interface AuthEventError extends Error {
|
47 | code: string;
|
48 | message: string;
|
49 | }
|
50 |
|
51 |
|
52 |
|
53 | export interface AuthEvent {
|
54 | type: AuthEventType;
|
55 | eventId: string | null;
|
56 | urlResponse: string | null;
|
57 | sessionId: string | null;
|
58 | postBody: string | null;
|
59 | tenantId: string | null;
|
60 | error?: AuthEventError;
|
61 | }
|
62 |
|
63 |
|
64 |
|
65 | export interface AuthEventConsumer {
|
66 | readonly filter: AuthEventType[];
|
67 | eventId: string | null;
|
68 | onAuthEvent(event: AuthEvent): unknown;
|
69 | onError(error: FirebaseError): unknown;
|
70 | }
|
71 |
|
72 |
|
73 |
|
74 | export interface EventManager {
|
75 | registerConsumer(authEventConsumer: AuthEventConsumer): void;
|
76 | unregisterConsumer(authEventConsumer: AuthEventConsumer): void;
|
77 | }
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 | export interface PopupRedirectResolverInternal extends PopupRedirectResolver {
|
85 | _shouldInitProactively: boolean;
|
86 | _initialize(auth: AuthInternal): Promise<EventManager>;
|
87 | _openPopup(auth: AuthInternal, provider: AuthProvider, authType: AuthEventType, eventId?: string): Promise<AuthPopup>;
|
88 | _openRedirect(auth: AuthInternal, provider: AuthProvider, authType: AuthEventType, eventId?: string): Promise<void | never>;
|
89 | _isIframeWebStorageSupported(auth: AuthInternal, cb: (support: boolean) => unknown): void;
|
90 | _redirectPersistence: Persistence;
|
91 | _originValidation(auth: Auth): Promise<void>;
|
92 | _completeRedirectFn: (auth: Auth, resolver: PopupRedirectResolver, bypassAuthState: boolean) => Promise<UserCredential | null>;
|
93 | _overrideRedirectResult: (auth: AuthInternal, resultGetter: () => Promise<UserCredentialInternal | null>) => void;
|
94 | }
|