Skip to content

Commit eaef32b

Browse files
shiatsumatbojeil-google
authored andcommitted
Fix types for sign-in options (#470)
Fixes signinoption types
1 parent 33b7c7c commit eaef32b

File tree

2 files changed

+42
-14
lines changed

2 files changed

+42
-14
lines changed

externs/firebaseui-externs.js

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ firebaseui.auth.Config.prototype.signInFlow;
231231
* Determines the list of IdPs for handling federated sign-in, phone number as
232232
* well as password account sign-up.
233233
*
234-
* @type {!Array<!firebaseui.auth.SignInOption>|undefined}
234+
* @type {!Array<!firebaseui.auth.SignInOption|string>|undefined}
235235
*/
236236
firebaseui.auth.Config.prototype.signInOptions;
237237

@@ -326,20 +326,29 @@ firebaseui.auth.SignInOption = function() {};
326326
*/
327327
firebaseui.auth.SignInOption.prototype.provider;
328328

329+
/**
330+
* Defines the sign-in option needed to configure the FirebaseUI federated
331+
* sign-in widget.
332+
*
333+
* @interface
334+
* @extends {firebaseui.auth.SignInOption}
335+
*/
336+
firebaseui.auth.FederatedSignInOption = function() {};
337+
329338
/**
330339
* The Auth method (typically the authorization endpoint) needed for one-tap
331340
* sign-up, eg: 'https://accounts.google.com'.
332341
*
333342
* @type {string|undefined}
334343
*/
335-
firebaseui.auth.SignInOption.prototype.authMethod;
344+
firebaseui.auth.FederatedSignInOption.prototype.authMethod;
336345

337346
/**
338347
* The OAuth client ID needed for one-tap sign-up credential helper.
339348
*
340349
* @type {string|undefined}
341350
*/
342-
firebaseui.auth.SignInOption.prototype.clientId;
351+
firebaseui.auth.FederatedSignInOption.prototype.clientId;
343352

344353
/**
345354
* The list of additional OAuth scopes for the selected provider.
@@ -351,7 +360,7 @@ firebaseui.auth.SignInOption.prototype.clientId;
351360
*
352361
* @type {!Array<string>|undefined}
353362
*/
354-
firebaseui.auth.SignInOption.prototype.scopes;
363+
firebaseui.auth.FederatedSignInOption.prototype.scopes;
355364

356365
/**
357366
* The custom OAuth parameters for the selected OAuth provider.
@@ -365,15 +374,33 @@ firebaseui.auth.SignInOption.prototype.scopes;
365374
*
366375
* @type {!Object|undefined}
367376
*/
368-
firebaseui.auth.SignInOption.prototype.customParameters;
377+
firebaseui.auth.FederatedSignInOption.prototype.customParameters;
378+
379+
/**
380+
* Defines the sign-in option needed to configure the FirebaseUI email sign-in
381+
* widget.
382+
*
383+
* @interface
384+
* @extends {firebaseui.auth.SignInOption}
385+
*/
386+
firebaseui.auth.EmailSignInOption = function() {};
369387

370388
/**
371389
* Whether to require the display name to be provided for email/password user
372390
* creation flow.
373391
*
374392
* @type {boolean|undefined}
375393
*/
376-
firebaseui.auth.SignInOption.prototype.requireDisplayName;
394+
firebaseui.auth.EmailSignInOption.prototype.requireDisplayName;
395+
396+
/**
397+
* Defines the sign-in option needed to configure the FirebaseUI phone sign-in
398+
* widget.
399+
*
400+
* @interface
401+
* @extends {firebaseui.auth.SignInOption}
402+
*/
403+
firebaseui.auth.PhoneSignInOption = function() {};
377404

378405
/**
379406
* The reCAPTCHA parameters needed to customize the reCAPTCHA for phone
@@ -392,14 +419,14 @@ firebaseui.auth.SignInOption.prototype.requireDisplayName;
392419
* badge: (string|undefined)
393420
* }|undefined}
394421
*/
395-
firebaseui.auth.SignInOption.prototype.recaptchaParameters;
422+
firebaseui.auth.PhoneSignInOption.prototype.recaptchaParameters;
396423

397424
/**
398425
* Sets the default country, eg. (GB) for the United Kingdom.
399426
*
400427
* @type {string|undefined}
401428
*/
402-
firebaseui.auth.SignInOption.prototype.defaultCountry;
429+
firebaseui.auth.PhoneSignInOption.prototype.defaultCountry;
403430

404431
/**
405432
* The default national number which will be prefilled when the phone sign-in
@@ -410,7 +437,7 @@ firebaseui.auth.SignInOption.prototype.defaultCountry;
410437
*
411438
* @type {string|undefined}
412439
*/
413-
firebaseui.auth.SignInOption.prototype.defaultNationalNumber;
440+
firebaseui.auth.PhoneSignInOption.prototype.defaultNationalNumber;
414441

415442
/**
416443
* The full phone number string instead of the 'defaultCountry' and
@@ -421,7 +448,7 @@ firebaseui.auth.SignInOption.prototype.defaultNationalNumber;
421448
*
422449
* @type {string|undefined}
423450
*/
424-
firebaseui.auth.SignInOption.prototype.loginHint;
451+
firebaseui.auth.PhoneSignInOption.prototype.loginHint;
425452

426453
/**
427454
* Sets the whitelisted countries. Accept either ISO (alpha-2) or E164 formatted
@@ -432,7 +459,7 @@ firebaseui.auth.SignInOption.prototype.loginHint;
432459
*
433460
* @type {!Array<string>|undefined}
434461
*/
435-
firebaseui.auth.SignInOption.prototype.whitelistedCountries;
462+
firebaseui.auth.PhoneSignInOption.prototype.whitelistedCountries;
436463

437464
/**
438465
* Sets the blacklisted countries. Accept either ISO (alpha-2) or E164 formatted
@@ -443,4 +470,4 @@ firebaseui.auth.SignInOption.prototype.whitelistedCountries;
443470
*
444471
* @type {!Array<string>|undefined}
445472
*/
446-
firebaseui.auth.SignInOption.prototype.blacklistedCountries;
473+
firebaseui.auth.PhoneSignInOption.prototype.blacklistedCountries;

types/index.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* limitations under the License.
1313
*/
1414

15-
declare namespace firebaseui {}
15+
declare namespace firebaseui { }
1616

1717
export as namespace firebaseui;
1818

@@ -66,7 +66,8 @@ declare namespace firebaseui.auth {
6666
queryParameterForSignInSuccessUrl?: string;
6767
queryParameterForWidgetMode?: string;
6868
signInFlow?: string;
69-
signInOptions?: Array<string | SignInOption>;
69+
signInOptions?: Array<string
70+
| FederatedSignInOption | EmailSignInOption | PhoneSignInOption>;
7071
signInSuccessUrl?: string;
7172
siteName?: string;
7273
tosUrl?: string;

0 commit comments

Comments
 (0)