getPhoneAuthDefaultCountry()

in javascript/widgets/config.js [510:525]


  getPhoneAuthDefaultCountry() {
    const signInOptions = this.getSignInOptionsForProvider_(
        firebase.auth.PhoneAuthProvider.PROVIDER_ID);
    const iso2 = signInOptions && signInOptions['defaultCountry'] || null;
    const countries = iso2 && country.getCountriesByIso2(iso2);
    // Check if loginHint passed. If so, get the country ID from there.
    // If no defaultCountry passed, use this value instead.
    let defaultPhoneNumber = null;
    if (signInOptions && typeof (signInOptions['loginHint']) === 'string') {
      defaultPhoneNumber = PhoneNumber.fromString(
          /** @type {string} */ (signInOptions['loginHint']));
    }
    // If there are multiple entries, pick the first one.
    return (countries && countries[0]) ||
        (defaultPhoneNumber && defaultPhoneNumber.getCountry()) || null;
  }