forked from firebase/firebaseui-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirebaseui-externs.js
639 lines (554 loc) · 16.4 KB
/
firebaseui-externs.js
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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
/**
* @fileoverview Firebase Authentication API.
*
* Copyright 2018 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @externs
*/
/**
* The FirebaseUI namespace.
* @namespace
*/
var firebaseui = {};
/**
* The FirebaseUI auth namespace.
* @namespace
*/
firebaseui.auth = {};
/**
* The FirebaseUI Anonymous Auth Provider namespace.
* @constructor
*/
firebaseui.auth.AnonymousAuthProvider = {};
/**
* The FirebaseUI Anonymous Auth Provider ID.
* @const {string}
*/
firebaseui.auth.AnonymousAuthProvider.PROVIDER_ID = 'anonymous';
/**
* @param {!firebase.auth.Auth} auth The Firebase Auth instance.
* @param {string=} appId The optional app id.
* @constructor
*/
firebaseui.auth.AuthUI = function(auth, appId) {};
/**
* Returns the AuthUI instance corresponding to the appId provided.
*
* @param {?string=} appId The optional app ID whose instance is to be
* provided.
* @return {?firebaseui.auth.AuthUI} The AuthUI instance corresponding to the
* app ID provided.
*/
firebaseui.auth.AuthUI.getInstance = function(appId) {};
/**
* Disables One-Tap auto sign-in.
*/
firebaseui.auth.AuthUI.prototype.disableAutoSignIn = function() {};
/**
* Handles the FirebaseUI operation.
* An `Error` is thrown if the developer tries to run this operation
* more than once.
*
* @param {string|!Element} element The container element or the query selector.
* @param {!firebaseui.auth.Config} config The configuration for the rendered
* UI.
*/
firebaseui.auth.AuthUI.prototype.start = function(element, config) {};
/**
* Sets the app configuration.
*
* @param {!firebaseui.auth.Config} config The application configuration.
*/
firebaseui.auth.AuthUI.prototype.setConfig = function(config) {};
/**
* Triggers the sign-in flow.
*/
firebaseui.auth.AuthUI.prototype.signIn = function() {};
/** Reset rendered widget and removes it from display. */
firebaseui.auth.AuthUI.prototype.reset = function() {};
/**
* Destroys the AuthUI instance.
*
* @return {!Promise<void>} The promise that resolves when the instance is
* successfully deleted.
*/
firebaseui.auth.AuthUI.prototype.delete = function() {};
/**
* Returns true if there is any pending redirect operation to be resolved by
* the widget.
*
* @return {boolean} Whether the app has pending redirect operations to be
* performed or there is a pending incoming sign in with email link
* operation waiting to be completed.
*/
firebaseui.auth.AuthUI.prototype.isPendingRedirect = function() {};
/**
* FirebaseUI related error typically returned via `signInFailure` callback.
*
* @interface
* @extends {Error}
*/
firebaseui.auth.AuthUIError = function() {};
/**
* The short error code.
*
* @type {string}
*/
firebaseui.auth.AuthUIError.prototype.code;
/**
* The human-readable error message.
*
* @type {string}
*/
firebaseui.auth.AuthUIError.prototype.message;
/**
* Any sign in associated Firebase Auth credential used to help recover from an
* error.
*
* @type {?firebase.auth.AuthCredential}
*/
firebaseui.auth.AuthUIError.prototype.credential;
/**
* @return {!Object} The plain object representation of the error.
*/
firebaseui.auth.AuthUIError.prototype.toJSON = function() {};
/**
* The FirebaseUI credential helpers available.
*
* @enum {string}
*/
firebaseui.auth.CredentialHelper = {
ACCOUNT_CHOOSER_COM: 'accountchooser.com',
GOOGLE_YOLO: 'googleyolo',
NONE: 'none'
};
/**
* FirebaseUI application related configuration settings.
*
* @interface
*/
firebaseui.auth.Config = function() {};
/**
* The accountchooser.com configuration when it is selected as credential
* helper.
*
* @type {!Object|undefined}
*/
firebaseui.auth.Config.prototype.acUiConfig;
/**
* Whether to upgrade anonymous users on sign-in. The default is false.
*
* @type {boolean|undefined}
*/
firebaseui.auth.Config.prototype.autoUpgradeAnonymousUsers;
/**
* The callbacks to trigger on operations like sign-in success, failure, etc.
*
* @type {!firebaseui.auth.Callbacks|undefined}
*/
firebaseui.auth.Config.prototype.callbacks;
/**
* Determines which credential helper to use. The default is accountchooser.com.
*
* @type {!firebaseui.auth.CredentialHelper|undefined}
*/
firebaseui.auth.Config.prototype.credentialHelper;
/**
* Whether to open the sign-in widget in a popup when `signIn` is called. The
* default is false.
*
* @type {!boolean|undefined}
*/
firebaseui.auth.Config.prototype.popupMode;
/**
* Determines the query key name for successful sign-in URL. The default is
* 'signInSuccessUrl'.
*
* @type {string|undefined}
*/
firebaseui.auth.Config.prototype.queryParameterForSignInSuccessUrl;
/**
* Determines the query key name for the widget mode. The default is 'mode'.
*
* @type {string|undefined}
*/
firebaseui.auth.Config.prototype.queryParameterForWidgetMode;
/**
* Determines the sign-in flow, 'popup' or 'redirect'. The former will use
* signInWithPopup whereas the latter will use the default signInWithRedirect
* when a federated sign-in is triggered.
*
* @type {string|undefined}
*/
firebaseui.auth.Config.prototype.signInFlow;
/**
* Determines the list of IdPs for handling federated sign-in, phone number as
* well as password account sign-up.
*
* @type {!Array<!firebaseui.auth.SignInOption|string>|undefined}
*/
firebaseui.auth.Config.prototype.signInOptions;
/**
* The URL to redirect to on sign in success.
*
* @type {string|undefined}
*/
firebaseui.auth.Config.prototype.signInSuccessUrl;
/**
* The application display name.
*
* @type {string|undefined}
*/
firebaseui.auth.Config.prototype.siteName;
/**
* The terms of service URL/callback.
*
* @type {string|function()|undefined}
*/
firebaseui.auth.Config.prototype.tosUrl;
/**
* The privacy policy URL/callback.
*
* @type {string|function()|undefined}
*/
firebaseui.auth.Config.prototype.privacyPolicyUrl;
/**
* The sign-in widget URL. If not provided, this is the current URL.
*
* @type {string|undefined}
*/
firebaseui.auth.Config.prototype.widgetUrl;
/**
* Defines all the FirebaseUI callbacks that can be passed to a
* `firebaseui.auth.Config` object.
*
* @interface
*/
firebaseui.auth.Callbacks = function() {};
/**
* Defines the sign-in success callback which will get triggered on successful
* sign-in.
*
* @param {!firebase.auth.UserCredential} authResult The
* `firebase.auth.UserCredential` corresponding to the signed in user.
* @param {string=} redirectUrl The redirect URL if it was previously appended
* to the page URL.
* @return {boolean} Whether to automatically redirect to the
* `signInSuccessUrl`.
*/
firebaseui.auth.Callbacks.prototype.signInSuccessWithAuthResult =
function(authResult, redirectUrl) {};
/**
* The `signInFailure` callback is provided to handle any unrecoverable error
* encountered during the sign-in process. The error provided here is a
* `firebaseui.auth.AuthUIError` error.
*
* @param {!firebaseui.auth.AuthUIError} error The FirebaseUI error identifying
* the reason behind the failure.
* @return {!Promise<void>} A promise that resolves when the merge conflict
* is completed.
*/
firebaseui.auth.Callbacks.prototype.signInFailure = function(error) {};
/**
* Defines the callback which gets triggered when the initial UI is rendered.
*/
firebaseui.auth.Callbacks.prototype.uiShown = function() {};
/**
* Defines the sign-in option needed to configure the FirebaseUI sign-in widget.
*
* @interface
*/
firebaseui.auth.SignInOption = function() {};
/**
* The provider ID for the provided sign in option,
* eg: `firebase.auth.GoogleAuthProvider.PROVIDER_ID`.
*
* @type {string}
*/
firebaseui.auth.SignInOption.prototype.provider;
/**
* Defines the sign-in option needed to configure the FirebaseUI federated
* sign-in widget.
*
* @interface
* @extends {firebaseui.auth.SignInOption}
*/
firebaseui.auth.FederatedSignInOption = function() {};
/**
* The Auth method (typically the authorization endpoint) needed for one-tap
* sign-up, eg: 'https://accounts.google.com'.
*
* @type {string|undefined}
*/
firebaseui.auth.FederatedSignInOption.prototype.authMethod;
/**
* The OAuth client ID needed for one-tap sign-up credential helper.
*
* @type {string|undefined}
*/
firebaseui.auth.FederatedSignInOption.prototype.clientId;
/**
* The list of additional OAuth scopes for the selected provider.
*
* @example
* var scopes = [
* 'https://www.googleapis.com/auth/plus.login'
* ];
*
* @type {!Array<string>|undefined}
*/
firebaseui.auth.FederatedSignInOption.prototype.scopes;
/**
* The custom OAuth parameters for the selected OAuth provider.
*
* @example
* var customParameters = {
* // Forces account selection even when one account
* // is available.
* prompt: 'select_account'
* };
*
* @type {!Object|undefined}
*/
firebaseui.auth.FederatedSignInOption.prototype.customParameters;
/**
* Defines the sign-in option needed to configure the FirebaseUI SAML
* sign-in widget.
*
* @interface
* @extends {firebaseui.auth.SignInOption}
*/
firebaseui.auth.SamlSignInOption = function() {};
/**
* The provider name displayed to end users
* (sign-in button label/linking prompt).
* Default: provider ID
*
* @type {string|undefined}
*/
firebaseui.auth.SamlSignInOption.prototype.providerName;
/**
* The color of the sign-in button.
*
* @type {string}
*/
firebaseui.auth.SamlSignInOption.prototype.buttonColor;
/**
* The URL of the Identity Provider's icon. This will be displayed on the
* provider's sign-in button, etc.
*
* @type {string}
*/
firebaseui.auth.SamlSignInOption.prototype.iconUrl;
/**
* Defines the sign-in option needed to configure the FirebaseUI generic OAuth
* sign-in widget.
*
* @interface
* @extends {firebaseui.auth.SignInOption}
*/
firebaseui.auth.OAuthSignInOption = function() {};
/**
* The provider name displayed to end users
* (sign-in button label/linking prompt),
* eg. "Microsoft". Default: provider ID, eg. "microsoft.com"
*
* @type {string|undefined}
*/
firebaseui.auth.OAuthSignInOption.prototype.providerName;
/**
* The color of the sign-in button.
*
* @type {string}
*/
firebaseui.auth.OAuthSignInOption.prototype.buttonColor;
/**
* The URL of the Identity Provider's icon. This will be displayed on the
* provider's sign-in button, etc.
*
* @type {string}
*/
firebaseui.auth.OAuthSignInOption.prototype.iconUrl;
/**
* The list of additional OAuth 2.0 scopes beyond basic profile that you want
* to request from the authentication provider.
*
* @type {!Array<string>|undefined}
*/
firebaseui.auth.OAuthSignInOption.prototype.scopes;
/**
* The custom OAuth parameters for the selected OAuth provider.
*
* @type {!Object|undefined}
*/
firebaseui.auth.OAuthSignInOption.prototype.customParameters;
/**
* The key of the custom parameter, with which the login hint can be passed to
* the provider. This is useful in case a user previously signs up with an IdP
* like Microsoft and then tries to sign in with email using the same Microsoft
* email. FirebaseUI can then ask the user to sign in with that email to the
* already registered account with Microsoft. For Microsoft and Yahoo, this
* field is `login_hint`.
*
* @type {string|undefined}
*/
firebaseui.auth.OAuthSignInOption.prototype.loginHintKey;
/**
* Defines the sign-in option needed to configure the FirebaseUI OIDC
* sign-in widget.
*
* @interface
* @extends {firebaseui.auth.SignInOption}
*/
firebaseui.auth.OidcSignInOption = function() {};
/**
* The provider name displayed to end users
* (sign-in button label/linking prompt).
* Default: provider ID
*
* @type {string|undefined}
*/
firebaseui.auth.OidcSignInOption.prototype.providerName;
/**
* The color of the sign-in button.
*
* @type {string}
*/
firebaseui.auth.OidcSignInOption.prototype.buttonColor;
/**
* The URL of the Identity Provider's icon. This will be displayed on the
* provider's sign-in button, etc.
*
* @type {string}
*/
firebaseui.auth.OidcSignInOption.prototype.iconUrl;
/**
* The list of additional custom parameters that the OIDC provider supports.
*
* @type {!Object|undefined}
*/
firebaseui.auth.OidcSignInOption.prototype.customParameters;
/**
* Defines the sign-in option needed to configure the FirebaseUI email sign-in
* widget.
*
* @interface
* @extends {firebaseui.auth.SignInOption}
*/
firebaseui.auth.EmailSignInOption = function() {};
/**
* Whether to require the display name to be provided for email/password user
* creation flow.
*
* @type {boolean|undefined}
*/
firebaseui.auth.EmailSignInOption.prototype.requireDisplayName;
/**
* The sign-in method to support for email sign-in. This can be either
* 'password' or 'emailLink'. The default is 'password'.
*
* @type {string|undefined}
*/
firebaseui.auth.EmailSignInOption.prototype.signInMethod;
/**
* Whether to force same device flow. If false, opening the link on a different
* device will display an error message. This should be true when
* used with anonymous user upgrade flows. The default is false.
*
* @type {boolean|undefined}
*/
firebaseui.auth.EmailSignInOption.prototype.forceSameDevice;
/**
* Defines the optional callback function to return
* `firebase.auth.ActionCodeSettings` configuration to use when sending the
* link. This provides the ability to specify how the link can be handled,
* custom dynamic link, additional state in the deep link, etc.
* When not provided, the current URL is used and a web only flow is triggered.
*
* @type {(function():!firebase.auth.ActionCodeSettings)|undefined}
*/
firebaseui.auth.EmailSignInOption.prototype.emailLinkSignIn;
/**
* Defines the sign-in option needed to configure the FirebaseUI phone sign-in
* widget.
*
* @interface
* @extends {firebaseui.auth.SignInOption}
*/
firebaseui.auth.PhoneSignInOption = function() {};
/**
* The reCAPTCHA parameters needed to customize the reCAPTCHA for phone
* authentication flows.
*
* @example
* var recaptchaParameters = {
* type: 'image', // 'audio'
* size: 'normal', // 'invisible' or 'compact'
* badge: 'bottomleft' //' bottomright' or 'inline' applies to invisible.
* };
*
* @type {{
* type: (string|undefined),
* size: (string|undefined),
* badge: (string|undefined)
* }|undefined}
*/
firebaseui.auth.PhoneSignInOption.prototype.recaptchaParameters;
/**
* Sets the default country, eg. (GB) for the United Kingdom.
*
* @type {string|undefined}
*/
firebaseui.auth.PhoneSignInOption.prototype.defaultCountry;
/**
* The default national number which will be prefilled when the phone sign-in
* screen is rendered, eg: '1234567890'
* This will only be observed if only phone Auth provider is used since
* for multiple providers, the NASCAR screen will always render first
* with a 'sign in with phone number' button.
*
* @type {string|undefined}
*/
firebaseui.auth.PhoneSignInOption.prototype.defaultNationalNumber;
/**
* The full phone number string instead of the 'defaultCountry' and
* 'defaultNationalNumber'. The 'defaultCountry' and 'defaultNationaNumber'
* will always have higher priority than 'loginHint' which will be ignored in
* their favor.
* Example: '+11234567890'
*
* @type {string|undefined}
*/
firebaseui.auth.PhoneSignInOption.prototype.loginHint;
/**
* Sets the whitelisted countries. Accept either ISO (alpha-2) or E164 formatted
* country codes. Invalid country code will be ignored. If `defaultCountry` is
* provided, it must be whitelisted. `whitelistedCountries` and
* `blacklistedCountries` cannot be specified at the same time.
* Example: ['US', '+44']
*
* @type {!Array<string>|undefined}
*/
firebaseui.auth.PhoneSignInOption.prototype.whitelistedCountries;
/**
* Sets the blacklisted countries. Accept either ISO (alpha-2) or E164 formatted
* country codes. Invalid country code will be ignored. If `defaultCountry` is
* provided, it must not be blacklisted. `whitelistedCountries` and
* `blacklistedCountries` cannot be specified at the same time.
* Example: ['US', '+44']
*
* @type {!Array<string>|undefined}
*/
firebaseui.auth.PhoneSignInOption.prototype.blacklistedCountries;