Skip to content

Commit c4fbf8b

Browse files
bojeil-googlejshcrowthe
authored andcommitted
fix(externs): Added externs for 4.3.0 release. (#140)
* fix(externs): Added externs for 4.3.0 release. * docs(typings): updating typings from externs
1 parent 3652c1d commit c4fbf8b

File tree

3 files changed

+172
-6
lines changed

3 files changed

+172
-6
lines changed

externs/firebase-auth-externs.js

Lines changed: 160 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,59 @@ firebase.User.prototype.reload = function() {};
215215
* The verification process is completed by calling
216216
* {@link firebase.auth.Auth#applyActionCode}
217217
*
218+
* <h4>Error Codes</h4>
219+
* <dl>
220+
* <dt>auth/missing-android-pkg-name</dt>
221+
* <dd>An Android package name must be provided if the Android app is required
222+
* to be installed.</dd>
223+
* <dt>auth/missing-continue-uri</dt>
224+
* <dd>A continue URL must be provided in the request.</dd>
225+
* <dt>auth/missing-ios-bundle-id</dt>
226+
* <dd>An iOS bundle ID must be provided if an App Store ID is provided.</dd>
227+
* <dt>auth/invalid-continue-uri</dt>
228+
* <dd>The continue URL provided in the request is invalid.</dd>
229+
* <dt>auth/unauthorized-continue-uri</dt>
230+
* <dd>The domain of the continue URL is not whitelisted. Whitelist
231+
* the domain in the Firebase console.</dd>
232+
* </dl>
233+
*
234+
* @example
235+
* var actionCodeSettings = {
236+
* url: 'https://www.example.com/cart?email=user@example.com&cartId=123',
237+
* iOS: {
238+
* bundleId: 'com.example.ios'
239+
* },
240+
* android: {
241+
* packageName: 'com.example.android',
242+
* installApp: true,
243+
* minimumVersion: '12'
244+
* },
245+
* handleCodeInApp: true
246+
* };
247+
* firebase.auth().currentUser.sendEmailVerification(actionCodeSettings)
248+
* .then(function() {
249+
* // Verification email sent.
250+
* })
251+
* .catch(function(error) {
252+
* // Error occurred. Inspect error.code.
253+
* });
254+
*
255+
* @param {?firebase.auth.ActionCodeSettings=} actionCodeSettings The action
256+
* code settings. If specified, the state/continue URL will be set as the
257+
* "continueUrl" parameter in the email verification link. The default email
258+
* verification landing page will use this to display a link to go back to
259+
* the app if it is installed.
260+
* If the actionCodeSettings is not specified, no URL is appended to the
261+
* action URL.
262+
* The state URL provided must belong to a domain that is whitelisted by the
263+
* developer in the console. Otherwise an error will be thrown.
264+
* Mobile app redirects will only be applicable if the developer configures
265+
* and accepts the Firebase Dynamic Links terms of condition.
266+
* The Android package name and iOS bundle ID will be respected only if they
267+
* are configured in the same Firebase Auth project used.
218268
* @return {!firebase.Promise<void>}
219269
*/
220-
firebase.User.prototype.sendEmailVerification = function() {};
270+
firebase.User.prototype.sendEmailVerification = function(actionCodeSettings) {};
221271

222272

223273
/**
@@ -709,6 +759,48 @@ firebase.auth.ActionCodeInfo = function() {};
709759
firebase.auth.ActionCodeInfo.prototype.data;
710760

711761

762+
/**
763+
* This is the interface that defines the required continue/state URL with
764+
* optional Android and iOS bundle identifiers.
765+
* The action code setting fields are:
766+
* <ul>
767+
* <li><p>url: Sets the link continue/state URL, which has different meanings
768+
* in different contexts:</p>
769+
* <ul>
770+
* <li>When the link is handled in the web action widgets, this is the deep
771+
* link in the continueUrl query parameter.</li>
772+
* <li>When the link is handled in the app directly, this is the continueUrl
773+
* query parameter in the deep link of the Dynamic Link.</li>
774+
* </ul>
775+
* </li>
776+
* <li>iOS: Sets the iOS bundle ID. This will try to open the link in an iOS app
777+
* if it is installed.</li>
778+
* <li>android: Sets the Android package name. This will try to open the link in
779+
* an android app if it is installed. If installApp is passed, it specifies
780+
* whether to install the Android app if the device supports it and the app
781+
* is not already installed. If this field is provided without a
782+
* packageName, an error is thrown explaining that the packageName must be
783+
* provided in conjunction with this field.
784+
* If minimumVersion is specified, and an older version of the app is
785+
* installed, the user is taken to the Play Store to upgrade the app.</li>
786+
* <li>handleCodeInApp: The default is false. When set to true, the action code
787+
* link will be be sent as a Universal Link or Android App Link and will be
788+
* opened by the app if installed. In the false case, the code will be sent
789+
* to the web widget first and then on continue will redirect to the app if
790+
* installed.</li>
791+
* </ul>
792+
*
793+
* @typedef {{
794+
* url: string,
795+
* iOS: ({bundleId: string}|undefined),
796+
* android: ({packageName: string, installApp: (boolean|undefined),
797+
* minimumVersion: (string|undefined)}|undefined),
798+
* handleCodeInApp: (boolean|undefined)
799+
* }}
800+
*/
801+
firebase.auth.ActionCodeSettings;
802+
803+
712804
/**
713805
* Checks a verification code sent to the user by email or other out-of-band
714806
* mechanism.
@@ -857,6 +949,24 @@ firebase.auth.Auth.Persistence = {
857949
*/
858950
firebase.auth.Auth.prototype.setPersistence = function(persistence) {};
859951

952+
/**
953+
* The current Auth instance's language code. This is a readable/writable
954+
* property. When set to null, the default Firebase Console language setting
955+
* is applied. The language code will propagate to email action templates
956+
* (password reset, email verification and email change revocation), SMS
957+
* templates for phone authentication, reCAPTCHA verifier and OAuth
958+
* popup/redirect operations provided the specified providers support
959+
* localization with the language code specified.
960+
*
961+
* @type {string|null}
962+
*/
963+
firebase.auth.Auth.prototype.languageCode;
964+
965+
/**
966+
* Sets the current language to the default device/browser preference.
967+
*/
968+
firebase.auth.Auth.prototype.useDeviceLanguage = function() {};
969+
860970
/**
861971
* Creates a new user account associated with the specified email address and
862972
* password.
@@ -987,14 +1097,62 @@ firebase.auth.Auth.prototype.onIdTokenChanged = function(
9871097
* <dl>
9881098
* <dt>auth/invalid-email</dt>
9891099
* <dd>Thrown if the email address is not valid.</dd>
1100+
* <dt>auth/missing-android-pkg-name</dt>
1101+
* <dd>An Android package name must be provided if the Android app is required
1102+
* to be installed.</dd>
1103+
* <dt>auth/missing-continue-uri</dt>
1104+
* <dd>A continue URL must be provided in the request.</dd>
1105+
* <dt>auth/missing-ios-bundle-id</dt>
1106+
* <dd>An iOS Bundle ID must be provided if an App Store ID is provided.</dd>
1107+
* <dt>auth/invalid-continue-uri</dt>
1108+
* <dd>The continue URL provided in the request is invalid.</dd>
1109+
* <dt>auth/unauthorized-continue-uri</dt>
1110+
* <dd>The domain of the continue URL is not whitelisted. Whitelist
1111+
* the domain in the Firebase console.</dd>
9901112
* <dt>auth/user-not-found</dt>
9911113
* <dd>Thrown if there is no user corresponding to the email address.</dd>
9921114
* </dl>
9931115
*
1116+
* @example
1117+
* var actionCodeSettings = {
1118+
* url: 'https://www.example.com/?email=user@example.com',
1119+
* iOS: {
1120+
* bundleId: 'com.example.ios'
1121+
* },
1122+
* android: {
1123+
* packageName: 'com.example.android',
1124+
* installApp: true,
1125+
* minimumVersion: '12'
1126+
* },
1127+
* handleCodeInApp: true
1128+
* };
1129+
* firebase.auth().sendPasswordResetEmail(
1130+
* '[email protected]', actionCodeSettings)
1131+
* .then(function() {
1132+
* // Password reset email sent.
1133+
* })
1134+
* .catch(function(error) {
1135+
* // Error occurred. Inspect error.code.
1136+
* });
1137+
*
9941138
* @param {string} email The email address with the password to be reset.
1139+
* @param {?firebase.auth.ActionCodeSettings=} actionCodeSettings The action
1140+
* code settings. If specified, the state/continue URL will be set as the
1141+
* "continueUrl" parameter in the password reset link. The default password
1142+
* reset landing page will use this to display a link to go back to the app
1143+
* if it is installed.
1144+
* If the actionCodeSettings is not specified, no URL is appended to the
1145+
* action URL.
1146+
* The state URL provided must belong to a domain that is whitelisted by the
1147+
* developer in the console. Otherwise an error will be thrown.
1148+
* Mobile app redirects will only be applicable if the developer configures
1149+
* and accepts the Firebase Dynamic Links terms of condition.
1150+
* The Android package name and iOS bundle ID will be respected only if they
1151+
* are configured in the same Firebase Auth project used.
9951152
* @return {!firebase.Promise<void>}
9961153
*/
997-
firebase.auth.Auth.prototype.sendPasswordResetEmail = function(email) {};
1154+
firebase.auth.Auth.prototype.sendPasswordResetEmail =
1155+
function(email, actionCodeSettings) {};
9981156

9991157

10001158
/**

typings/app.d.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ declare namespace firebase {
6969
reauthenticateWithRedirect (provider : firebase.auth.AuthProvider ) : firebase.Promise < any > ;
7070
refreshToken : string ;
7171
reload ( ) : firebase.Promise < any > ;
72-
sendEmailVerification ( ) : firebase.Promise < any > ;
72+
sendEmailVerification (actionCodeSettings ? : firebase.auth.ActionCodeSettings | null ) : firebase.Promise < any > ;
7373
toJSON ( ) : Object ;
7474
unlink (providerId : string ) : firebase.Promise < any > ;
7575
updateEmail (newEmail : string ) : firebase.Promise < any > ;
@@ -118,6 +118,8 @@ declare namespace firebase.auth {
118118
interface ActionCodeInfo {
119119
}
120120

121+
type ActionCodeSettings = { android ? : { installApp ? : boolean , minimumVersion ? : string , packageName : string } , handleCodeInApp ? : boolean , iOS ? : { bundleId : string } , url : string } ;
122+
121123
type AdditionalUserInfo = { profile : Object | null , providerId : string , username ? : string | null } ;
122124

123125
interface ApplicationVerifier {
@@ -134,9 +136,10 @@ declare namespace firebase.auth {
134136
currentUser : firebase.User | null ;
135137
fetchProvidersForEmail (email : string ) : firebase.Promise < any > ;
136138
getRedirectResult ( ) : firebase.Promise < any > ;
139+
languageCode : string | null ;
137140
onAuthStateChanged (nextOrObserver : firebase.Observer < any , any > | ( (a : firebase.User | null ) => any ) , error ? : (a : firebase.auth.Error ) => any , completed ? : firebase.Unsubscribe ) : firebase.Unsubscribe ;
138141
onIdTokenChanged (nextOrObserver : firebase.Observer < any , any > | ( (a : firebase.User | null ) => any ) , error ? : (a : firebase.auth.Error ) => any , completed ? : firebase.Unsubscribe ) : firebase.Unsubscribe ;
139-
sendPasswordResetEmail (email : string ) : firebase.Promise < any > ;
142+
sendPasswordResetEmail (email : string , actionCodeSettings ? : firebase.auth.ActionCodeSettings | null ) : firebase.Promise < any > ;
140143
setPersistence (persistence : firebase.auth.Auth.Persistence ) : firebase.Promise < any > ;
141144
signInAndRetrieveDataWithCredential (credential : firebase.auth.AuthCredential ) : firebase.Promise < any > ;
142145
signInAnonymously ( ) : firebase.Promise < any > ;
@@ -147,6 +150,7 @@ declare namespace firebase.auth {
147150
signInWithPopup (provider : firebase.auth.AuthProvider ) : firebase.Promise < any > ;
148151
signInWithRedirect (provider : firebase.auth.AuthProvider ) : firebase.Promise < any > ;
149152
signOut ( ) : firebase.Promise < any > ;
153+
useDeviceLanguage ( ) : any ;
150154
verifyPasswordResetCode (code : string ) : firebase.Promise < any > ;
151155
}
152156

typings/firebase.d.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ declare namespace firebase {
6969
reauthenticateWithRedirect (provider : firebase.auth.AuthProvider ) : firebase.Promise < any > ;
7070
refreshToken : string ;
7171
reload ( ) : firebase.Promise < any > ;
72-
sendEmailVerification ( ) : firebase.Promise < any > ;
72+
sendEmailVerification (actionCodeSettings ? : firebase.auth.ActionCodeSettings | null ) : firebase.Promise < any > ;
7373
toJSON ( ) : Object ;
7474
unlink (providerId : string ) : firebase.Promise < any > ;
7575
updateEmail (newEmail : string ) : firebase.Promise < any > ;
@@ -118,6 +118,8 @@ declare namespace firebase.auth {
118118
interface ActionCodeInfo {
119119
}
120120

121+
type ActionCodeSettings = { android ? : { installApp ? : boolean , minimumVersion ? : string , packageName : string } , handleCodeInApp ? : boolean , iOS ? : { bundleId : string } , url : string } ;
122+
121123
type AdditionalUserInfo = { profile : Object | null , providerId : string , username ? : string | null } ;
122124

123125
interface ApplicationVerifier {
@@ -134,9 +136,10 @@ declare namespace firebase.auth {
134136
currentUser : firebase.User | null ;
135137
fetchProvidersForEmail (email : string ) : firebase.Promise < any > ;
136138
getRedirectResult ( ) : firebase.Promise < any > ;
139+
languageCode : string | null ;
137140
onAuthStateChanged (nextOrObserver : firebase.Observer < any , any > | ( (a : firebase.User | null ) => any ) , error ? : (a : firebase.auth.Error ) => any , completed ? : firebase.Unsubscribe ) : firebase.Unsubscribe ;
138141
onIdTokenChanged (nextOrObserver : firebase.Observer < any , any > | ( (a : firebase.User | null ) => any ) , error ? : (a : firebase.auth.Error ) => any , completed ? : firebase.Unsubscribe ) : firebase.Unsubscribe ;
139-
sendPasswordResetEmail (email : string ) : firebase.Promise < any > ;
142+
sendPasswordResetEmail (email : string , actionCodeSettings ? : firebase.auth.ActionCodeSettings | null ) : firebase.Promise < any > ;
140143
setPersistence (persistence : firebase.auth.Auth.Persistence ) : firebase.Promise < any > ;
141144
signInAndRetrieveDataWithCredential (credential : firebase.auth.AuthCredential ) : firebase.Promise < any > ;
142145
signInAnonymously ( ) : firebase.Promise < any > ;
@@ -147,6 +150,7 @@ declare namespace firebase.auth {
147150
signInWithPopup (provider : firebase.auth.AuthProvider ) : firebase.Promise < any > ;
148151
signInWithRedirect (provider : firebase.auth.AuthProvider ) : firebase.Promise < any > ;
149152
signOut ( ) : firebase.Promise < any > ;
153+
useDeviceLanguage ( ) : any ;
150154
verifyPasswordResetCode (code : string ) : firebase.Promise < any > ;
151155
}
152156

0 commit comments

Comments
 (0)