static fromString(phoneNumberStr) {
    // Ideally libPhoneNumber should be used to parse the phone number string
    // but that dependency is too large to bundle with FirebaseUI-web, so we
    // will attempt a best effort approach to parse the 2 components.
    var trimmedPhoneNumber = goog.string.trim(phoneNumberStr);
    // Get matching countries if national number countains it.
    var countries =
        firebaseui.auth.data.country.LOOKUP_TREE.search(trimmedPhoneNumber);
    if (countries.length > 0) {
      var countryId;
      // Parse the country ID and national number components.
      // If the country code is +1, use US as default code.
      // Otherwise, just pick the first country.
      if (countries[0].e164_cc == '1') {
        countryId = firebaseui.auth.PhoneNumber.DEFAULT_COUNTRY_ID;
      } else {
        countryId = countries[0].e164_key;
      }
      // Get the national number. Add the + char to the e164_cc string.
      var nationalNumber =
          trimmedPhoneNumber.substr(countries[0].e164_cc.length + 1);
      // Return the phone number object.
      return new firebaseui.auth.PhoneNumber(
          countryId, goog.string.trim(nationalNumber));
    }
    return null;
  }
Converts a phone number string to a firebaseui.auth.PhoneNumber object.
Returns null if invalid.
@param {string} phoneNumberStr The full phone number string.
@return {?firebaseui.auth.PhoneNumber} The corresponding
    `firebaseui.auth.PhoneNumber` representation.