libphonenumber-js 1.12.17 → 1.12.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -2
- package/METADATA.md +2 -0
- package/README.md +255 -165
- package/build/AsYouType.js +6 -8
- package/build/AsYouType.js.map +1 -1
- package/build/AsYouType.test.js +13 -14
- package/build/AsYouType.test.js.map +1 -1
- package/build/AsYouTypeFormatter.complete.js +4 -4
- package/build/AsYouTypeFormatter.complete.js.map +1 -1
- package/build/AsYouTypeFormatter.js +4 -4
- package/build/AsYouTypeFormatter.js.map +1 -1
- package/build/AsYouTypeParser.js +42 -29
- package/build/AsYouTypeParser.js.map +1 -1
- package/build/AsYouTypeState.js +21 -17
- package/build/AsYouTypeState.js.map +1 -1
- package/build/PhoneNumber.js +2 -2
- package/build/PhoneNumber.js.map +1 -1
- package/build/findNumbers/Leniency.js +0 -1
- package/build/findNumbers/Leniency.js.map +1 -1
- package/build/format.js +4 -4
- package/build/format.js.map +1 -1
- package/build/formatPhoneNumberForMobileDialing.js +2 -2
- package/build/formatPhoneNumberForMobileDialing.js.map +1 -1
- package/build/helpers/checkNumberLength.js +39 -7
- package/build/helpers/checkNumberLength.js.map +1 -1
- package/build/helpers/checkNumberLength.test.js +51 -12
- package/build/helpers/checkNumberLength.test.js.map +1 -1
- package/build/helpers/extractCountryCallingCode.js +13 -10
- package/build/helpers/extractCountryCallingCode.js.map +1 -1
- package/build/helpers/extractCountryCallingCode.test.js +3 -3
- package/build/helpers/extractCountryCallingCode.test.js.map +1 -1
- package/build/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +10 -8
- package/build/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js.map +1 -1
- package/build/helpers/extractNationalNumber.js +15 -5
- package/build/helpers/extractNationalNumber.js.map +1 -1
- package/build/helpers/extractNationalNumber.test.js +10 -2
- package/build/helpers/extractNationalNumber.test.js.map +1 -1
- package/build/helpers/getCountryByCallingCode.js +3 -2
- package/build/helpers/getCountryByCallingCode.js.map +1 -1
- package/build/helpers/getCountryByNationalNumber.js +27 -6
- package/build/helpers/getCountryByNationalNumber.js.map +1 -1
- package/build/helpers/matchesEntirely.js +4 -4
- package/build/helpers/matchesEntirely.js.map +1 -1
- package/build/isPossible.js +4 -4
- package/build/isPossible.js.map +1 -1
- package/build/isPossible.test.js +9 -0
- package/build/isPossible.test.js.map +1 -1
- package/build/isPossiblePhoneNumber.test.js +6 -0
- package/build/isPossiblePhoneNumber.test.js.map +1 -1
- package/build/metadata.js +2 -2
- package/build/metadata.js.map +1 -1
- package/build/parse.js +9 -7
- package/build/parse.js.map +1 -1
- package/build/parseIncompletePhoneNumber.js +7 -7
- package/build/parseIncompletePhoneNumber.js.map +1 -1
- package/build/parsePhoneNumber.test.js +15 -0
- package/build/parsePhoneNumber.test.js.map +1 -1
- package/build/validatePhoneNumberLength.js +1 -1
- package/build/validatePhoneNumberLength.js.map +1 -1
- package/build-scripts/check-for-metadata-changes-and-create-pull-request.js +87 -0
- package/build-scripts/check-for-metadata-changes-and-release.js +92 -0
- package/build-scripts/check-for-uncommitted-files.js +11 -0
- package/{runnable/json-to-js.js → build-scripts/create-js-file-for-json-file.js} +2 -2
- package/{runnable/metadata-branch.js → build-scripts/create-metadata-update-branch.js} +6 -1
- package/{runnable/generate-country-codes.js → build-scripts/generate-country-codes-list-in-typescript.js} +1 -0
- package/{runnable/generate.js → build-scripts/generate-metadata-from-google-metadata.js} +8 -14
- package/{runnable/modules → build-scripts/helpers}/commit.js +1 -0
- package/{runnable/modules → build-scripts/helpers}/exec.js +1 -0
- package/build-scripts/helpers/getUncommittedChanges.js +33 -0
- package/{runnable/modules/update-metadata.js → build-scripts/helpers/update-metadata-from-google-metadata.js} +9 -7
- package/{runnable/download.js → build-scripts/pull-google-metadata.js} +12 -4
- package/bundle/libphonenumber-js.min.js +1 -1
- package/bundle/libphonenumber-js.min.js.map +1 -1
- package/bundle/libphonenumber-max.js +1 -1
- package/bundle/libphonenumber-max.js.map +1 -1
- package/bundle/libphonenumber-min.js +1 -1
- package/bundle/libphonenumber-min.js.map +1 -1
- package/bundle/libphonenumber-mobile.js +1 -1
- package/bundle/libphonenumber-mobile.js.map +1 -1
- package/core/index.d.cts +1 -1
- package/core/index.d.ts +1 -1
- package/custom.d.ts +1 -1
- package/es6/AsYouType.js +6 -8
- package/es6/AsYouType.js.map +1 -1
- package/es6/AsYouType.test.js +13 -14
- package/es6/AsYouType.test.js.map +1 -1
- package/es6/AsYouTypeFormatter.complete.js +4 -4
- package/es6/AsYouTypeFormatter.complete.js.map +1 -1
- package/es6/AsYouTypeFormatter.js +4 -4
- package/es6/AsYouTypeFormatter.js.map +1 -1
- package/es6/AsYouTypeParser.js +42 -29
- package/es6/AsYouTypeParser.js.map +1 -1
- package/es6/AsYouTypeState.js +21 -17
- package/es6/AsYouTypeState.js.map +1 -1
- package/es6/PhoneNumber.js +1 -2
- package/es6/PhoneNumber.js.map +1 -1
- package/es6/findNumbers/Leniency.js +0 -1
- package/es6/findNumbers/Leniency.js.map +1 -1
- package/es6/format.js +4 -4
- package/es6/format.js.map +1 -1
- package/es6/formatPhoneNumberForMobileDialing.js +2 -2
- package/es6/formatPhoneNumberForMobileDialing.js.map +1 -1
- package/es6/helpers/checkNumberLength.js +39 -7
- package/es6/helpers/checkNumberLength.js.map +1 -1
- package/es6/helpers/checkNumberLength.test.js +49 -12
- package/es6/helpers/checkNumberLength.test.js.map +1 -1
- package/es6/helpers/extractCountryCallingCode.js +13 -10
- package/es6/helpers/extractCountryCallingCode.js.map +1 -1
- package/es6/helpers/extractCountryCallingCode.test.js +3 -3
- package/es6/helpers/extractCountryCallingCode.test.js.map +1 -1
- package/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +10 -8
- package/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js.map +1 -1
- package/es6/helpers/extractNationalNumber.js +15 -5
- package/es6/helpers/extractNationalNumber.js.map +1 -1
- package/es6/helpers/extractNationalNumber.test.js +10 -2
- package/es6/helpers/extractNationalNumber.test.js.map +1 -1
- package/es6/helpers/getCountryByCallingCode.js +3 -2
- package/es6/helpers/getCountryByCallingCode.js.map +1 -1
- package/es6/helpers/getCountryByNationalNumber.js +28 -6
- package/es6/helpers/getCountryByNationalNumber.js.map +1 -1
- package/es6/helpers/matchesEntirely.js +4 -4
- package/es6/helpers/matchesEntirely.js.map +1 -1
- package/es6/isPossible.js +4 -4
- package/es6/isPossible.js.map +1 -1
- package/es6/isPossible.test.js +9 -0
- package/es6/isPossible.test.js.map +1 -1
- package/es6/isPossiblePhoneNumber.test.js +6 -0
- package/es6/isPossiblePhoneNumber.test.js.map +1 -1
- package/es6/metadata.js +2 -2
- package/es6/metadata.js.map +1 -1
- package/es6/parse.js +9 -7
- package/es6/parse.js.map +1 -1
- package/es6/parseIncompletePhoneNumber.js +7 -7
- package/es6/parseIncompletePhoneNumber.js.map +1 -1
- package/es6/parsePhoneNumber.test.js +15 -0
- package/es6/parsePhoneNumber.test.js.map +1 -1
- package/es6/validatePhoneNumberLength.js +1 -1
- package/es6/validatePhoneNumberLength.js.map +1 -1
- package/index.d.cts +1 -1
- package/index.d.ts +1 -1
- package/max/index.d.cts +1 -1
- package/max/index.d.ts +1 -1
- package/min/index.d.cts +1 -1
- package/min/index.d.ts +1 -1
- package/mobile/index.d.cts +1 -1
- package/mobile/index.d.ts +1 -1
- package/package.json +17 -23
- package/source/AsYouType.js +8 -10
- package/source/AsYouType.test.js +13 -14
- package/source/AsYouTypeFormatter.complete.js +4 -4
- package/source/AsYouTypeFormatter.js +4 -4
- package/source/AsYouTypeParser.js +45 -28
- package/source/AsYouTypeState.js +21 -17
- package/source/PhoneNumber.js +1 -2
- package/source/findNumbers/Leniency.js +0 -1
- package/source/format.js +4 -4
- package/source/formatPhoneNumberForMobileDialing.js +2 -2
- package/source/helpers/checkNumberLength.js +40 -7
- package/source/helpers/checkNumberLength.test.js +54 -12
- package/source/helpers/extractCountryCallingCode.js +15 -10
- package/source/helpers/extractCountryCallingCode.test.js +3 -3
- package/source/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +19 -8
- package/source/helpers/extractNationalNumber.js +15 -5
- package/source/helpers/extractNationalNumber.test.js +11 -2
- package/source/helpers/getCountryByCallingCode.js +2 -2
- package/source/helpers/getCountryByNationalNumber.js +27 -6
- package/source/helpers/matchesEntirely.js +4 -4
- package/source/isPossible.js +4 -4
- package/source/isPossible.test.js +11 -0
- package/source/isPossiblePhoneNumber.test.js +7 -0
- package/source/metadata.js +2 -2
- package/source/parse.js +9 -5
- package/source/parseIncompletePhoneNumber.js +7 -7
- package/source/parsePhoneNumber.test.js +17 -0
- package/source/validatePhoneNumberLength.js +1 -1
- package/runnable/metadata-update-and-push-and-pull-request.js +0 -47
- package/runnable/metadata-update-and-push.js +0 -30
- package/runnable/metadata-update-and-release.js +0 -36
- /package/{runnable/create-commonjs-package-json.js → build-scripts/create-commonjs-package-json-file.js} +0 -0
package/build/AsYouType.js
CHANGED
|
@@ -120,7 +120,7 @@ var AsYouType = exports["default"] = /*#__PURE__*/function () {
|
|
|
120
120
|
this.state = new _AsYouTypeState["default"]({
|
|
121
121
|
onCountryChange: function onCountryChange(country) {
|
|
122
122
|
// Before version `1.6.0`, the official `AsYouType` formatter API
|
|
123
|
-
// included
|
|
123
|
+
// included a `.country` property on an `AsYouType` instance.
|
|
124
124
|
// Since that property (along with the others) have been moved to
|
|
125
125
|
// `this.state`, `this.country` property is emulated for compatibility
|
|
126
126
|
// with the old versions.
|
|
@@ -280,10 +280,10 @@ var AsYouType = exports["default"] = /*#__PURE__*/function () {
|
|
|
280
280
|
value: function getNonFormattedNationalNumberWithPrefix() {
|
|
281
281
|
var _this$state = this.state,
|
|
282
282
|
nationalSignificantNumber = _this$state.nationalSignificantNumber,
|
|
283
|
-
|
|
283
|
+
prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix = _this$state.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix,
|
|
284
284
|
nationalPrefix = _this$state.nationalPrefix;
|
|
285
285
|
var number = nationalSignificantNumber;
|
|
286
|
-
var prefix =
|
|
286
|
+
var prefix = prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix || nationalPrefix;
|
|
287
287
|
if (prefix) {
|
|
288
288
|
number = prefix + number;
|
|
289
289
|
}
|
|
@@ -292,8 +292,8 @@ var AsYouType = exports["default"] = /*#__PURE__*/function () {
|
|
|
292
292
|
}, {
|
|
293
293
|
key: "getNonFormattedNumber",
|
|
294
294
|
value: function getNonFormattedNumber() {
|
|
295
|
-
var
|
|
296
|
-
return this.getFullNumber(
|
|
295
|
+
var nationalSignificantNumberIsModified = this.state.nationalSignificantNumberIsModified;
|
|
296
|
+
return this.getFullNumber(nationalSignificantNumberIsModified ? this.state.getNationalDigits() : this.getNonFormattedNationalNumberWithPrefix());
|
|
297
297
|
}
|
|
298
298
|
}, {
|
|
299
299
|
key: "getNonFormattedTemplate",
|
|
@@ -311,7 +311,7 @@ var AsYouType = exports["default"] = /*#__PURE__*/function () {
|
|
|
311
311
|
return countryCodes && countryCodes.length > 1;
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
-
// Determines the country of the phone number
|
|
314
|
+
// Determines the exact country of the phone number
|
|
315
315
|
// entered so far based on the country phone code
|
|
316
316
|
// and the national phone number.
|
|
317
317
|
}, {
|
|
@@ -319,7 +319,6 @@ var AsYouType = exports["default"] = /*#__PURE__*/function () {
|
|
|
319
319
|
value: function determineTheCountry() {
|
|
320
320
|
this.state.setCountry((0, _getCountryByCallingCode["default"])(this.isInternational() ? this.state.callingCode : this.defaultCallingCode, {
|
|
321
321
|
nationalNumber: this.state.nationalSignificantNumber,
|
|
322
|
-
defaultCountry: this.defaultCountry,
|
|
323
322
|
metadata: this.metadata
|
|
324
323
|
}));
|
|
325
324
|
}
|
|
@@ -424,7 +423,6 @@ var AsYouType = exports["default"] = /*#__PURE__*/function () {
|
|
|
424
423
|
if (ambiguousCountries.length > 1) {
|
|
425
424
|
var exactCountry = (0, _getCountryByNationalNumber["default"])(nationalSignificantNumber, {
|
|
426
425
|
countries: ambiguousCountries,
|
|
427
|
-
defaultCountry: this.defaultCountry,
|
|
428
426
|
metadata: this.metadata.metadata
|
|
429
427
|
});
|
|
430
428
|
if (exactCountry) {
|
package/build/AsYouType.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsYouType.js","names":["_metadata","_interopRequireDefault","require","_PhoneNumber","_AsYouTypeState","_AsYouTypeFormatter","_interopRequireWildcard","_AsYouTypeParser","_getCountryByCallingCode","_getCountryByNationalNumber","_isObject","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Symbol","iterator","constructor","prototype","_slicedToArray","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","a","_arrayLikeToArray","toString","slice","name","Array","from","test","length","l","u","next","done","push","value","isArray","_classCallCheck","_defineProperties","enumerable","configurable","writable","_toPropertyKey","key","_createClass","_toPrimitive","toPrimitive","String","Number","USE_NON_GEOGRAPHIC_COUNTRY_CODE","AsYouType","exports","optionsOrDefaultCountry","metadata","Metadata","_this$getCountryAndCa","getCountryAndCallingCode","_this$getCountryAndCa2","defaultCountry","defaultCallingCode","reset","isObject","hasCountry","undefined","isNonGeographicCallingCode","input","text","_this$parser$input","parser","state","digits","justLeadingPlus","formattedOutput","determineTheCountryIfNeeded","nationalSignificantNumber","formatter","narrowDownMatchingFormats","formattedNationalNumber","hasSelectedNumberingPlan","format","reExtractNationalSignificantNumber","nationalDigits","getNationalDigits","getFullNumber","getNonFormattedNumber","_this","AsYouTypeState","onCountryChange","country","onCallingCodeChange","callingCode","selectNumberingPlan","numberingPlan","AsYouTypeFormatter","AsYouTypeParser","onNationalSignificantNumberChange","isInternational","international","getCallingCode","getCountryCallingCode","getCountry","_getCountry","isCountryCallingCodeAmbiguous","determineTheCountry","_this2","prefix","getInternationalPrefixBeforeCountryCallingCode","spacing","concat","getDigitsWithoutInternationalPrefix","getNonFormattedNationalNumberWithPrefix","_this$state","complexPrefixBeforeNationalSignificantNumber","nationalPrefix","number","nationalSignificantNumberMatchesInput","getNonFormattedTemplate","replace","DIGIT_PLACEHOLDER","countryCodes","getCountryCodesForCallingCode","setCountry","getCountryByCallingCode","nationalNumber","getNumberValue","_this$state2","callingCode_","countryCallingCode","getNumber","_this$state3","carrierCode","ambiguousCountries","exactCountry","getCountryByNationalNumber","countries","phoneNumber","PhoneNumber","isPossible","isValid","getNationalNumber","getChars","getTemplate"],"sources":["../source/AsYouType.js"],"sourcesContent":["import Metadata from './metadata.js'\r\nimport PhoneNumber from './PhoneNumber.js'\r\nimport AsYouTypeState from './AsYouTypeState.js'\r\nimport AsYouTypeFormatter, { DIGIT_PLACEHOLDER } from './AsYouTypeFormatter.js'\r\nimport AsYouTypeParser, { extractFormattedDigitsAndPlus } from './AsYouTypeParser.js'\r\nimport getCountryByCallingCode from './helpers/getCountryByCallingCode.js'\r\nimport getCountryByNationalNumber from './helpers/getCountryByNationalNumber.js'\r\nimport isObject from './helpers/isObject.js'\r\n\r\nconst USE_NON_GEOGRAPHIC_COUNTRY_CODE = false\r\n\r\nexport default class AsYouType {\r\n\t/**\r\n\t * @param {(string|object)?} [optionsOrDefaultCountry] - The default country used for parsing non-international phone numbers. Can also be an `options` object.\r\n\t * @param {Object} metadata\r\n\t */\r\n\tconstructor(optionsOrDefaultCountry, metadata) {\r\n\t\tthis.metadata = new Metadata(metadata)\r\n\t\tconst [defaultCountry, defaultCallingCode] = this.getCountryAndCallingCode(optionsOrDefaultCountry)\r\n\t\t// `this.defaultCountry` and `this.defaultCallingCode` aren't required to be in sync.\r\n\t\t// For example, `this.defaultCountry` could be `\"AR\"` and `this.defaultCallingCode` could be `undefined`.\r\n\t\t// So `this.defaultCountry` and `this.defaultCallingCode` are totally independent.\r\n\t\tthis.defaultCountry = defaultCountry\r\n\t\tthis.defaultCallingCode = defaultCallingCode\r\n\t\tthis.reset()\r\n\t}\r\n\r\n\tgetCountryAndCallingCode(optionsOrDefaultCountry) {\r\n\t\t// Set `defaultCountry` and `defaultCallingCode` options.\r\n\t\tlet defaultCountry\r\n\t\tlet defaultCallingCode\r\n\t\t// Turns out `null` also has type \"object\". Weird.\r\n\t\tif (optionsOrDefaultCountry) {\r\n\t\t\tif (isObject(optionsOrDefaultCountry)) {\r\n\t\t\t\tdefaultCountry = optionsOrDefaultCountry.defaultCountry\r\n\t\t\t\tdefaultCallingCode = optionsOrDefaultCountry.defaultCallingCode\r\n\t\t\t} else {\r\n\t\t\t\tdefaultCountry = optionsOrDefaultCountry\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (defaultCountry && !this.metadata.hasCountry(defaultCountry)) {\r\n\t\t\tdefaultCountry = undefined\r\n\t\t}\r\n\t\tif (defaultCallingCode) {\r\n\t\t\t/* istanbul ignore if */\r\n\t\t\tif (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\r\n\t\t\t\tif (this.metadata.isNonGeographicCallingCode(defaultCallingCode)) {\r\n\t\t\t\t\tdefaultCountry = '001'\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn [defaultCountry, defaultCallingCode]\r\n\t}\r\n\r\n\t/**\r\n\t * Inputs \"next\" phone number characters.\r\n\t * @param {string} text\r\n\t * @return {string} Formatted phone number characters that have been input so far.\r\n\t */\r\n\tinput(text) {\r\n\t\tconst {\r\n\t\t\tdigits,\r\n\t\t\tjustLeadingPlus\r\n\t\t} = this.parser.input(text, this.state)\r\n\t\tif (justLeadingPlus) {\r\n\t\t\tthis.formattedOutput = '+'\r\n\t\t} else if (digits) {\r\n\t\t\tthis.determineTheCountryIfNeeded()\r\n\t\t\t// Match the available formats by the currently available leading digits.\r\n\t\t\tif (this.state.nationalSignificantNumber) {\r\n\t\t\t\tthis.formatter.narrowDownMatchingFormats(this.state)\r\n\t\t\t}\r\n\t\t\tlet formattedNationalNumber\r\n\t\t\tif (this.metadata.hasSelectedNumberingPlan()) {\r\n\t\t\t\tformattedNationalNumber = this.formatter.format(digits, this.state)\r\n\t\t\t}\r\n\t\t\tif (formattedNationalNumber === undefined) {\r\n\t\t\t\t// See if another national (significant) number could be re-extracted.\r\n\t\t\t\tif (this.parser.reExtractNationalSignificantNumber(this.state)) {\r\n\t\t\t\t\tthis.determineTheCountryIfNeeded()\r\n\t\t\t\t\t// If it could, then re-try formatting the new national (significant) number.\r\n\t\t\t\t\tconst nationalDigits = this.state.getNationalDigits()\r\n\t\t\t\t\tif (nationalDigits) {\r\n\t\t\t\t\t\tformattedNationalNumber = this.formatter.format(nationalDigits, this.state)\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.formattedOutput = formattedNationalNumber\r\n\t\t\t\t? this.getFullNumber(formattedNationalNumber)\r\n\t\t\t\t: this.getNonFormattedNumber()\r\n\t\t}\r\n\t\treturn this.formattedOutput\r\n\t}\r\n\r\n\treset() {\r\n\t\tthis.state = new AsYouTypeState({\r\n\t\t\tonCountryChange: (country) => {\r\n\t\t\t\t// Before version `1.6.0`, the official `AsYouType` formatter API\r\n\t\t\t\t// included the `.country` property of an `AsYouType` instance.\r\n\t\t\t\t// Since that property (along with the others) have been moved to\r\n\t\t\t\t// `this.state`, `this.country` property is emulated for compatibility\r\n\t\t\t\t// with the old versions.\r\n\t\t\t\tthis.country = country\r\n\t\t\t},\r\n\t\t\tonCallingCodeChange: (callingCode, country) => {\r\n\t\t\t\tthis.metadata.selectNumberingPlan(country, callingCode)\r\n\t\t\t\tthis.formatter.reset(this.metadata.numberingPlan, this.state)\r\n\t\t\t\tthis.parser.reset(this.metadata.numberingPlan)\r\n\t\t\t}\r\n\t\t})\r\n\t\tthis.formatter = new AsYouTypeFormatter({\r\n\t\t\tstate: this.state,\r\n\t\t\tmetadata: this.metadata\r\n\t\t})\r\n\t\tthis.parser = new AsYouTypeParser({\r\n\t\t\tdefaultCountry: this.defaultCountry,\r\n\t\t\tdefaultCallingCode: this.defaultCallingCode,\r\n\t\t\tmetadata: this.metadata,\r\n\t\t\tstate: this.state,\r\n\t\t\tonNationalSignificantNumberChange: () => {\r\n\t\t\t\tthis.determineTheCountryIfNeeded()\r\n\t\t\t\tthis.formatter.reset(this.metadata.numberingPlan, this.state)\r\n\t\t\t}\r\n\t\t})\r\n\t\tthis.state.reset({\r\n\t\t\tcountry: this.defaultCountry,\r\n\t\t\tcallingCode: this.defaultCallingCode\r\n\t\t})\r\n\t\tthis.formattedOutput = ''\r\n\t\treturn this\r\n\t}\r\n\r\n\t/**\r\n\t * Returns `true` if the phone number is being input in international format.\r\n\t * In other words, returns `true` if and only if the parsed phone number starts with a `\"+\"`.\r\n\t * @return {boolean}\r\n\t */\r\n\tisInternational() {\r\n\t\treturn this.state.international\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the \"calling code\" part of the phone number when it's being input\r\n\t * in an international format.\r\n\t * If no valid calling code has been entered so far, returns `undefined`.\r\n\t * @return {string} [callingCode]\r\n\t */\r\n\tgetCallingCode() {\r\n\t\t // If the number is being input in national format and some \"default calling code\"\r\n\t\t // has been passed to `AsYouType` constructor, then `this.state.callingCode`\r\n\t\t // is equal to that \"default calling code\".\r\n\t\t //\r\n\t\t // If the number is being input in national format and no \"default calling code\"\r\n\t\t // has been passed to `AsYouType` constructor, then returns `undefined`,\r\n\t\t // even if a \"default country\" has been passed to `AsYouType` constructor.\r\n\t\t //\r\n\t\tif (this.isInternational()) {\r\n\t\t\treturn this.state.callingCode\r\n\t\t}\r\n\t}\r\n\r\n\t// A legacy alias.\r\n\tgetCountryCallingCode() {\r\n\t\treturn this.getCallingCode()\r\n\t}\r\n\r\n\t/**\r\n\t * Returns a two-letter country code of the phone number.\r\n\t * Returns `undefined` for \"non-geographic\" phone numbering plans.\r\n\t * Returns `undefined` if no phone number has been input yet.\r\n\t * @return {string} [country]\r\n\t */\r\n\tgetCountry() {\r\n\t\tconst { digits } = this.state\r\n\t\t// Return `undefined` if no digits have been input yet.\r\n\t\tif (digits) {\r\n\t\t\treturn this._getCountry()\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Returns a two-letter country code of the phone number.\r\n\t * Returns `undefined` for \"non-geographic\" phone numbering plans.\r\n\t * @return {string} [country]\r\n\t */\r\n\t_getCountry() {\r\n\t\tconst { country } = this.state\r\n\t\t/* istanbul ignore if */\r\n\t\tif (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\r\n\t\t\t// `AsYouType.getCountry()` returns `undefined`\r\n\t\t\t// for \"non-geographic\" phone numbering plans.\r\n\t\t\tif (country === '001') {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn country\r\n\t}\r\n\r\n\tdetermineTheCountryIfNeeded() {\r\n\t\t// Suppose a user enters a phone number in international format,\r\n\t\t// and there're several countries corresponding to that country calling code,\r\n\t\t// and a country has been derived from the number, and then\r\n\t\t// a user enters one more digit and the number is no longer\r\n\t\t// valid for the derived country, so the country should be re-derived\r\n\t\t// on every new digit in those cases.\r\n\t\t//\r\n\t\t// If the phone number is being input in national format,\r\n\t\t// then it could be a case when `defaultCountry` wasn't specified\r\n\t\t// when creating `AsYouType` instance, and just `defaultCallingCode` was specified,\r\n\t\t// and that \"calling code\" could correspond to a \"non-geographic entity\",\r\n\t\t// or there could be several countries corresponding to that country calling code.\r\n\t\t// In those cases, `this.country` is `undefined` and should be derived\r\n\t\t// from the number. Again, if country calling code is ambiguous, then\r\n\t\t// `this.country` should be re-derived with each new digit.\r\n\t\t//\r\n\t\tif (!this.state.country || this.isCountryCallingCodeAmbiguous()) {\r\n\t\t\tthis.determineTheCountry()\r\n\t\t}\r\n\t}\r\n\r\n\t// Prepends `+CountryCode ` in case of an international phone number\r\n\tgetFullNumber(formattedNationalNumber) {\r\n\t\tif (this.isInternational()) {\r\n\t\t\tconst prefix = (text) => this.formatter.getInternationalPrefixBeforeCountryCallingCode(this.state, {\r\n\t\t\t\tspacing: text ? true : false\r\n\t\t\t}) + text\r\n\t\t\tconst { callingCode } = this.state\r\n\t\t\tif (!callingCode) {\r\n\t\t\t\treturn prefix(`${this.state.getDigitsWithoutInternationalPrefix()}`)\r\n\t\t\t}\r\n\t\t\tif (!formattedNationalNumber) {\r\n\t\t\t\treturn prefix(callingCode)\r\n\t\t\t}\r\n\t\t\treturn prefix(`${callingCode} ${formattedNationalNumber}`)\r\n\t\t}\r\n\t\treturn formattedNationalNumber\r\n\t}\r\n\r\n\tgetNonFormattedNationalNumberWithPrefix() {\r\n\t\tconst {\r\n\t\t\tnationalSignificantNumber,\r\n\t\t\tcomplexPrefixBeforeNationalSignificantNumber,\r\n\t\t\tnationalPrefix\r\n\t\t} = this.state\r\n\t\tlet number = nationalSignificantNumber\r\n\t\tconst prefix = complexPrefixBeforeNationalSignificantNumber || nationalPrefix\r\n\t\tif (prefix) {\r\n\t\t\tnumber = prefix + number\r\n\t\t}\r\n\t\treturn number\r\n\t}\r\n\r\n\tgetNonFormattedNumber() {\r\n\t\tconst { nationalSignificantNumberMatchesInput } = this.state\r\n\t\treturn this.getFullNumber(\r\n\t\t\tnationalSignificantNumberMatchesInput\r\n\t\t\t\t? this.getNonFormattedNationalNumberWithPrefix()\r\n\t\t\t\t: this.state.getNationalDigits()\r\n\t\t)\r\n\t}\r\n\r\n\tgetNonFormattedTemplate() {\r\n\t\tconst number = this.getNonFormattedNumber()\r\n\t\tif (number) {\r\n\t\t\treturn number.replace(/[\\+\\d]/g, DIGIT_PLACEHOLDER)\r\n\t\t}\r\n\t}\r\n\r\n\tisCountryCallingCodeAmbiguous() {\r\n\t\tconst { callingCode } = this.state\r\n\t\tconst countryCodes = this.metadata.getCountryCodesForCallingCode(callingCode)\r\n\t\treturn countryCodes && countryCodes.length > 1\r\n\t}\r\n\r\n\t// Determines the country of the phone number\r\n\t// entered so far based on the country phone code\r\n\t// and the national phone number.\r\n\tdetermineTheCountry() {\r\n\t\tthis.state.setCountry(getCountryByCallingCode(\r\n\t\t\tthis.isInternational() ? this.state.callingCode : this.defaultCallingCode,\r\n\t\t\t{\r\n\t\t\t\tnationalNumber: this.state.nationalSignificantNumber,\r\n\t\t\t\tdefaultCountry: this.defaultCountry,\r\n\t\t\t\tmetadata: this.metadata\r\n\t\t\t}\r\n\t\t))\r\n\t}\r\n\r\n\t/**\r\n\t * Returns a E.164 phone number value for the user's input.\r\n\t *\r\n\t * For example, for country `\"US\"` and input `\"(222) 333-4444\"`\r\n\t * it will return `\"+12223334444\"`.\r\n\t *\r\n\t * For international phone number input, it will also auto-correct\r\n\t * some minor errors such as using a national prefix when writing\r\n\t * an international phone number. For example, if the user inputs\r\n\t * `\"+44 0 7400 000000\"` then it will return an auto-corrected\r\n\t * `\"+447400000000\"` phone number value.\r\n\t *\r\n\t * Will return `undefined` if no digits have been input,\r\n\t * or when inputting a phone number in national format and no\r\n\t * default country or default \"country calling code\" have been set.\r\n\t *\r\n\t * @return {string} [value]\r\n\t */\r\n\tgetNumberValue() {\r\n\t\tconst {\r\n\t\t\tdigits,\r\n\t\t\tcallingCode,\r\n\t\t\tcountry,\r\n\t\t\tnationalSignificantNumber\r\n\t\t} = this.state\r\n\r\n\t \t// Will return `undefined` if no digits have been input.\r\n\t\tif (!digits) {\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\tif (this.isInternational()) {\r\n\t\t\tif (callingCode) {\r\n\t\t\t\treturn '+' + callingCode + nationalSignificantNumber\r\n\t\t\t} else {\r\n\t\t\t\treturn '+' + digits\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (country || callingCode) {\r\n\t\t\t\tconst callingCode_ = country ? this.metadata.countryCallingCode() : callingCode\r\n\t\t\t\treturn '+' + callingCode_ + nationalSignificantNumber\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Returns an instance of `PhoneNumber` class.\r\n\t * Will return `undefined` if no national (significant) number\r\n\t * digits have been entered so far, or if no `defaultCountry` has been\r\n\t * set and the user enters a phone number not in international format.\r\n\t */\r\n\tgetNumber() {\r\n\t\tconst {\r\n\t\t\tnationalSignificantNumber,\r\n\t\t\tcarrierCode,\r\n\t\t\tcallingCode\r\n\t\t} = this.state\r\n\r\n\t\t// `this._getCountry()` is basically same as `this.state.country`\r\n\t\t// with the only change that it return `undefined` in case of a\r\n\t\t// \"non-geographic\" numbering plan instead of `\"001\"` \"internal use\" value.\r\n\t\tlet country = this._getCountry()\r\n\r\n\t\tif (!nationalSignificantNumber) {\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\t// `state.country` and `state.callingCode` aren't required to be in sync.\r\n\t\t// For example, `country` could be `\"AR\"` and `callingCode` could be `undefined`.\r\n\t\t// So `country` and `callingCode` are totally independent.\r\n\r\n\t\tif (!country && !callingCode) {\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\t// By default, if `defaultCountry` parameter was passed when\r\n\t\t// creating `AsYouType` instance, `state.country` is gonna be\r\n\t\t// that `defaultCountry`, which doesn't entirely conform with\r\n\t\t// `parsePhoneNumber()`'s behavior where it attempts to determine\r\n\t\t// the country more precisely in cases when multiple countries\r\n\t\t// could correspond to the same `countryCallingCode`.\r\n\t\t// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/103#note_1417192969\r\n\t\t//\r\n\t\t// Because `AsYouType.getNumber()` method is supposed to be a 1:1\r\n\t\t// equivalent for `parsePhoneNumber(AsYouType.getNumberValue())`,\r\n\t\t// then it should also behave accordingly in cases of `country` ambiguity.\r\n\t\t// That's how users of this library would expect it to behave anyway.\r\n\t\t//\r\n\t\tif (country) {\r\n\t\t\tif (country === this.defaultCountry) {\r\n\t\t\t\t// `state.country` and `state.callingCode` aren't required to be in sync.\r\n\t\t\t\t// For example, `state.country` could be `\"AR\"` and `state.callingCode` could be `undefined`.\r\n\t\t\t\t// So `state.country` and `state.callingCode` are totally independent.\r\n\t\t\t\tconst metadata = new Metadata(this.metadata.metadata)\r\n\t\t\t\tmetadata.selectNumberingPlan(country)\r\n\t\t\t\tconst callingCode = metadata.numberingPlan.callingCode()\r\n\t\t\t\tconst ambiguousCountries = this.metadata.getCountryCodesForCallingCode(callingCode)\r\n\t\t\t\tif (ambiguousCountries.length > 1) {\r\n\t\t\t\t\tconst exactCountry = getCountryByNationalNumber(nationalSignificantNumber, {\r\n\t\t\t\t\t\tcountries: ambiguousCountries,\r\n\t\t\t\t\t\tdefaultCountry: this.defaultCountry,\r\n\t\t\t\t\t\tmetadata: this.metadata.metadata\r\n\t\t\t\t\t})\r\n\t\t\t\t\tif (exactCountry) {\r\n\t\t\t\t\t\tcountry = exactCountry\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconst phoneNumber = new PhoneNumber(\r\n\t\t\tcountry || callingCode,\r\n\t\t\tnationalSignificantNumber,\r\n\t\t\tthis.metadata.metadata\r\n\t\t)\r\n\t\tif (carrierCode) {\r\n\t\t\tphoneNumber.carrierCode = carrierCode\r\n\t\t}\r\n\t\t// Phone number extensions are not supported by \"As You Type\" formatter.\r\n\t\treturn phoneNumber\r\n\t}\r\n\r\n\t/**\r\n\t * Returns `true` if the phone number is \"possible\".\r\n\t * Is just a shortcut for `PhoneNumber.isPossible()`.\r\n\t * @return {boolean}\r\n\t */\r\n\tisPossible() {\r\n\t\tconst phoneNumber = this.getNumber()\r\n\t\tif (!phoneNumber) {\r\n\t\t\treturn false\r\n\t\t}\r\n\t\treturn phoneNumber.isPossible()\r\n\t}\r\n\r\n\t/**\r\n\t * Returns `true` if the phone number is \"valid\".\r\n\t * Is just a shortcut for `PhoneNumber.isValid()`.\r\n\t * @return {boolean}\r\n\t */\r\n\tisValid() {\r\n\t\tconst phoneNumber = this.getNumber()\r\n\t\tif (!phoneNumber) {\r\n\t\t\treturn false\r\n\t\t}\r\n\t\treturn phoneNumber.isValid()\r\n\t}\r\n\r\n\t/**\r\n\t * @deprecated\r\n\t * This method is used in `react-phone-number-input/source/input-control.js`\r\n\t * in versions before `3.0.16`.\r\n\t */\r\n\tgetNationalNumber() {\r\n\t\treturn this.state.nationalSignificantNumber\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the phone number characters entered by the user.\r\n\t * @return {string}\r\n\t */\r\n\tgetChars() {\r\n\t\treturn (this.state.international ? '+' : '') + this.state.digits\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the template for the formatted phone number.\r\n\t * @return {string}\r\n\t */\r\n\tgetTemplate() {\r\n\t\treturn this.formatter.getTemplate(this.state) || this.getNonFormattedTemplate() || ''\r\n\t}\r\n}"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAD,uBAAA,CAAAJ,OAAA;AACA,IAAAM,wBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,2BAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,SAAA,GAAAT,sBAAA,CAAAC,OAAA;AAA4C,SAAAI,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,wBAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,mBAAAT,CAAA,iBAAAA,CAAA,gBAAAU,OAAA,CAAAV,CAAA,0BAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,G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EAIA,SAAA0G,WAAWA,CAAA,EAAG;MACb,OAAO,IAAI,CAAClE,SAAS,CAACkE,WAAW,CAAC,IAAI,CAACxE,KAAK,CAAC,IAAI,IAAI,CAAC+C,uBAAuB,CAAC,CAAC,IAAI,EAAE;IACtF;EAAC;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"AsYouType.js","names":["_metadata","_interopRequireDefault","require","_PhoneNumber","_AsYouTypeState","_AsYouTypeFormatter","_interopRequireWildcard","_AsYouTypeParser","_getCountryByCallingCode","_getCountryByNationalNumber","_isObject","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Symbol","iterator","constructor","prototype","_slicedToArray","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","a","_arrayLikeToArray","toString","slice","name","Array","from","test","length","l","u","next","done","push","value","isArray","_classCallCheck","_defineProperties","enumerable","configurable","writable","_toPropertyKey","key","_createClass","_toPrimitive","toPrimitive","String","Number","USE_NON_GEOGRAPHIC_COUNTRY_CODE","AsYouType","exports","optionsOrDefaultCountry","metadata","Metadata","_this$getCountryAndCa","getCountryAndCallingCode","_this$getCountryAndCa2","defaultCountry","defaultCallingCode","reset","isObject","hasCountry","undefined","isNonGeographicCallingCode","input","text","_this$parser$input","parser","state","digits","justLeadingPlus","formattedOutput","determineTheCountryIfNeeded","nationalSignificantNumber","formatter","narrowDownMatchingFormats","formattedNationalNumber","hasSelectedNumberingPlan","format","reExtractNationalSignificantNumber","nationalDigits","getNationalDigits","getFullNumber","getNonFormattedNumber","_this","AsYouTypeState","onCountryChange","country","onCallingCodeChange","callingCode","selectNumberingPlan","numberingPlan","AsYouTypeFormatter","AsYouTypeParser","onNationalSignificantNumberChange","isInternational","international","getCallingCode","getCountryCallingCode","getCountry","_getCountry","isCountryCallingCodeAmbiguous","determineTheCountry","_this2","prefix","getInternationalPrefixBeforeCountryCallingCode","spacing","concat","getDigitsWithoutInternationalPrefix","getNonFormattedNationalNumberWithPrefix","_this$state","prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix","nationalPrefix","number","nationalSignificantNumberIsModified","getNonFormattedTemplate","replace","DIGIT_PLACEHOLDER","countryCodes","getCountryCodesForCallingCode","setCountry","getCountryByCallingCode","nationalNumber","getNumberValue","_this$state2","callingCode_","countryCallingCode","getNumber","_this$state3","carrierCode","ambiguousCountries","exactCountry","getCountryByNationalNumber","countries","phoneNumber","PhoneNumber","isPossible","isValid","getNationalNumber","getChars","getTemplate"],"sources":["../source/AsYouType.js"],"sourcesContent":["import Metadata from './metadata.js'\r\nimport PhoneNumber from './PhoneNumber.js'\r\nimport AsYouTypeState from './AsYouTypeState.js'\r\nimport AsYouTypeFormatter, { DIGIT_PLACEHOLDER } from './AsYouTypeFormatter.js'\r\nimport AsYouTypeParser, { extractFormattedDigitsAndPlus } from './AsYouTypeParser.js'\r\nimport getCountryByCallingCode from './helpers/getCountryByCallingCode.js'\r\nimport getCountryByNationalNumber from './helpers/getCountryByNationalNumber.js'\r\nimport isObject from './helpers/isObject.js'\r\n\r\nconst USE_NON_GEOGRAPHIC_COUNTRY_CODE = false\r\n\r\nexport default class AsYouType {\r\n\t/**\r\n\t * @param {(string|object)?} [optionsOrDefaultCountry] - The default country used for parsing non-international phone numbers. Can also be an `options` object.\r\n\t * @param {Object} metadata\r\n\t */\r\n\tconstructor(optionsOrDefaultCountry, metadata) {\r\n\t\tthis.metadata = new Metadata(metadata)\r\n\t\tconst [defaultCountry, defaultCallingCode] = this.getCountryAndCallingCode(optionsOrDefaultCountry)\r\n\t\t// `this.defaultCountry` and `this.defaultCallingCode` aren't required to be in sync.\r\n\t\t// For example, `this.defaultCountry` could be `\"AR\"` and `this.defaultCallingCode` could be `undefined`.\r\n\t\t// So `this.defaultCountry` and `this.defaultCallingCode` are totally independent.\r\n\t\tthis.defaultCountry = defaultCountry\r\n\t\tthis.defaultCallingCode = defaultCallingCode\r\n\t\tthis.reset()\r\n\t}\r\n\r\n\tgetCountryAndCallingCode(optionsOrDefaultCountry) {\r\n\t\t// Set `defaultCountry` and `defaultCallingCode` options.\r\n\t\tlet defaultCountry\r\n\t\tlet defaultCallingCode\r\n\t\t// Turns out `null` also has type \"object\". Weird.\r\n\t\tif (optionsOrDefaultCountry) {\r\n\t\t\tif (isObject(optionsOrDefaultCountry)) {\r\n\t\t\t\tdefaultCountry = optionsOrDefaultCountry.defaultCountry\r\n\t\t\t\tdefaultCallingCode = optionsOrDefaultCountry.defaultCallingCode\r\n\t\t\t} else {\r\n\t\t\t\tdefaultCountry = optionsOrDefaultCountry\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (defaultCountry && !this.metadata.hasCountry(defaultCountry)) {\r\n\t\t\tdefaultCountry = undefined\r\n\t\t}\r\n\t\tif (defaultCallingCode) {\r\n\t\t\t/* istanbul ignore if */\r\n\t\t\tif (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\r\n\t\t\t\tif (this.metadata.isNonGeographicCallingCode(defaultCallingCode)) {\r\n\t\t\t\t\tdefaultCountry = '001'\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn [defaultCountry, defaultCallingCode]\r\n\t}\r\n\r\n\t/**\r\n\t * Inputs \"next\" phone number characters.\r\n\t * @param {string} text\r\n\t * @return {string} Formatted phone number characters that have been input so far.\r\n\t */\r\n\tinput(text) {\r\n\t\tconst {\r\n\t\t\tdigits,\r\n\t\t\tjustLeadingPlus\r\n\t\t} = this.parser.input(text, this.state)\r\n\t\tif (justLeadingPlus) {\r\n\t\t\tthis.formattedOutput = '+'\r\n\t\t} else if (digits) {\r\n\t\t\tthis.determineTheCountryIfNeeded()\r\n\t\t\t// Match the available formats by the currently available leading digits.\r\n\t\t\tif (this.state.nationalSignificantNumber) {\r\n\t\t\t\tthis.formatter.narrowDownMatchingFormats(this.state)\r\n\t\t\t}\r\n\t\t\tlet formattedNationalNumber\r\n\t\t\tif (this.metadata.hasSelectedNumberingPlan()) {\r\n\t\t\t\tformattedNationalNumber = this.formatter.format(digits, this.state)\r\n\t\t\t}\r\n\t\t\tif (formattedNationalNumber === undefined) {\r\n\t\t\t\t// See if another national (significant) number could be re-extracted.\r\n\t\t\t\tif (this.parser.reExtractNationalSignificantNumber(this.state)) {\r\n\t\t\t\t\tthis.determineTheCountryIfNeeded()\r\n\t\t\t\t\t// If it could, then re-try formatting the new national (significant) number.\r\n\t\t\t\t\tconst nationalDigits = this.state.getNationalDigits()\r\n\t\t\t\t\tif (nationalDigits) {\r\n\t\t\t\t\t\tformattedNationalNumber = this.formatter.format(nationalDigits, this.state)\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.formattedOutput = formattedNationalNumber\r\n\t\t\t\t? this.getFullNumber(formattedNationalNumber)\r\n\t\t\t\t: this.getNonFormattedNumber()\r\n\t\t}\r\n\t\treturn this.formattedOutput\r\n\t}\r\n\r\n\treset() {\r\n\t\tthis.state = new AsYouTypeState({\r\n\t\t\tonCountryChange: (country) => {\r\n\t\t\t\t// Before version `1.6.0`, the official `AsYouType` formatter API\r\n\t\t\t\t// included a `.country` property on an `AsYouType` instance.\r\n\t\t\t\t// Since that property (along with the others) have been moved to\r\n\t\t\t\t// `this.state`, `this.country` property is emulated for compatibility\r\n\t\t\t\t// with the old versions.\r\n\t\t\t\tthis.country = country\r\n\t\t\t},\r\n\t\t\tonCallingCodeChange: (callingCode, country) => {\r\n\t\t\t\tthis.metadata.selectNumberingPlan(country, callingCode)\r\n\t\t\t\tthis.formatter.reset(this.metadata.numberingPlan, this.state)\r\n\t\t\t\tthis.parser.reset(this.metadata.numberingPlan)\r\n\t\t\t}\r\n\t\t})\r\n\t\tthis.formatter = new AsYouTypeFormatter({\r\n\t\t\tstate: this.state,\r\n\t\t\tmetadata: this.metadata\r\n\t\t})\r\n\t\tthis.parser = new AsYouTypeParser({\r\n\t\t\tdefaultCountry: this.defaultCountry,\r\n\t\t\tdefaultCallingCode: this.defaultCallingCode,\r\n\t\t\tmetadata: this.metadata,\r\n\t\t\tstate: this.state,\r\n\t\t\tonNationalSignificantNumberChange: () => {\r\n\t\t\t\tthis.determineTheCountryIfNeeded()\r\n\t\t\t\tthis.formatter.reset(this.metadata.numberingPlan, this.state)\r\n\t\t\t}\r\n\t\t})\r\n\t\tthis.state.reset({\r\n\t\t\tcountry: this.defaultCountry,\r\n\t\t\tcallingCode: this.defaultCallingCode\r\n\t\t})\r\n\t\tthis.formattedOutput = ''\r\n\t\treturn this\r\n\t}\r\n\r\n\t/**\r\n\t * Returns `true` if the phone number is being input in international format.\r\n\t * In other words, returns `true` if and only if the parsed phone number starts with a `\"+\"`.\r\n\t * @return {boolean}\r\n\t */\r\n\tisInternational() {\r\n\t\treturn this.state.international\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the \"calling code\" part of the phone number when it's being input\r\n\t * in an international format.\r\n\t * If no valid calling code has been entered so far, returns `undefined`.\r\n\t * @return {string} [callingCode]\r\n\t */\r\n\tgetCallingCode() {\r\n\t\t // If the number is being input in national format and some \"default calling code\"\r\n\t\t // has been passed to `AsYouType` constructor, then `this.state.callingCode`\r\n\t\t // is equal to that \"default calling code\".\r\n\t\t //\r\n\t\t // If the number is being input in national format and no \"default calling code\"\r\n\t\t // has been passed to `AsYouType` constructor, then returns `undefined`,\r\n\t\t // even if a \"default country\" has been passed to `AsYouType` constructor.\r\n\t\t //\r\n\t\tif (this.isInternational()) {\r\n\t\t\treturn this.state.callingCode\r\n\t\t}\r\n\t}\r\n\r\n\t// A legacy alias.\r\n\tgetCountryCallingCode() {\r\n\t\treturn this.getCallingCode()\r\n\t}\r\n\r\n\t/**\r\n\t * Returns a two-letter country code of the phone number.\r\n\t * Returns `undefined` for \"non-geographic\" phone numbering plans.\r\n\t * Returns `undefined` if no phone number has been input yet.\r\n\t * @return {string} [country]\r\n\t */\r\n\tgetCountry() {\r\n\t\tconst { digits } = this.state\r\n\t\t// Return `undefined` if no digits have been input yet.\r\n\t\tif (digits) {\r\n\t\t\treturn this._getCountry()\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Returns a two-letter country code of the phone number.\r\n\t * Returns `undefined` for \"non-geographic\" phone numbering plans.\r\n\t * @return {string} [country]\r\n\t */\r\n\t_getCountry() {\r\n\t\tconst { country } = this.state\r\n\t\t/* istanbul ignore if */\r\n\t\tif (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\r\n\t\t\t// `AsYouType.getCountry()` returns `undefined`\r\n\t\t\t// for \"non-geographic\" phone numbering plans.\r\n\t\t\tif (country === '001') {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn country\r\n\t}\r\n\r\n\tdetermineTheCountryIfNeeded() {\r\n\t\t// Suppose a user enters a phone number in international format,\r\n\t\t// and there're several countries corresponding to that country calling code,\r\n\t\t// and a country has been derived from the number, and then\r\n\t\t// a user enters one more digit and the number is no longer\r\n\t\t// valid for the derived country, so the country should be re-derived\r\n\t\t// on every new digit in those cases.\r\n\t\t//\r\n\t\t// If the phone number is being input in national format,\r\n\t\t// then it could be a case when `defaultCountry` wasn't specified\r\n\t\t// when creating `AsYouType` instance, and just `defaultCallingCode` was specified,\r\n\t\t// and that \"calling code\" could correspond to a \"non-geographic entity\",\r\n\t\t// or there could be several countries corresponding to that country calling code.\r\n\t\t// In those cases, `this.country` is `undefined` and should be derived\r\n\t\t// from the number. Again, if country calling code is ambiguous, then\r\n\t\t// `this.country` should be re-derived with each new digit.\r\n\t\t//\r\n\t\tif (!this.state.country || this.isCountryCallingCodeAmbiguous()) {\r\n\t\t\tthis.determineTheCountry()\r\n\t\t}\r\n\t}\r\n\r\n\t// Prepends `+CountryCode ` in case of an international phone number\r\n\tgetFullNumber(formattedNationalNumber) {\r\n\t\tif (this.isInternational()) {\r\n\t\t\tconst prefix = (text) => this.formatter.getInternationalPrefixBeforeCountryCallingCode(this.state, {\r\n\t\t\t\tspacing: text ? true : false\r\n\t\t\t}) + text\r\n\t\t\tconst { callingCode } = this.state\r\n\t\t\tif (!callingCode) {\r\n\t\t\t\treturn prefix(`${this.state.getDigitsWithoutInternationalPrefix()}`)\r\n\t\t\t}\r\n\t\t\tif (!formattedNationalNumber) {\r\n\t\t\t\treturn prefix(callingCode)\r\n\t\t\t}\r\n\t\t\treturn prefix(`${callingCode} ${formattedNationalNumber}`)\r\n\t\t}\r\n\t\treturn formattedNationalNumber\r\n\t}\r\n\r\n\tgetNonFormattedNationalNumberWithPrefix() {\r\n\t\tconst {\r\n\t\t\tnationalSignificantNumber,\r\n\t\t\tprefixBeforeNationalSignificantNumberThatIsNotNationalPrefix,\r\n\t\t\tnationalPrefix\r\n\t\t} = this.state\r\n\t\tlet number = nationalSignificantNumber\r\n\t\tconst prefix = prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix || nationalPrefix\r\n\t\tif (prefix) {\r\n\t\t\tnumber = prefix + number\r\n\t\t}\r\n\t\treturn number\r\n\t}\r\n\r\n\tgetNonFormattedNumber() {\r\n\t\tconst { nationalSignificantNumberIsModified } = this.state\r\n\t\treturn this.getFullNumber(\r\n\t\t\tnationalSignificantNumberIsModified\r\n\t\t\t\t? this.state.getNationalDigits()\r\n\t\t\t\t: this.getNonFormattedNationalNumberWithPrefix()\r\n\t\t)\r\n\t}\r\n\r\n\tgetNonFormattedTemplate() {\r\n\t\tconst number = this.getNonFormattedNumber()\r\n\t\tif (number) {\r\n\t\t\treturn number.replace(/[\\+\\d]/g, DIGIT_PLACEHOLDER)\r\n\t\t}\r\n\t}\r\n\r\n\tisCountryCallingCodeAmbiguous() {\r\n\t\tconst { callingCode } = this.state\r\n\t\tconst countryCodes = this.metadata.getCountryCodesForCallingCode(callingCode)\r\n\t\treturn countryCodes && countryCodes.length > 1\r\n\t}\r\n\r\n\t// Determines the exact country of the phone number\r\n\t// entered so far based on the country phone code\r\n\t// and the national phone number.\r\n\tdetermineTheCountry() {\r\n\t\tthis.state.setCountry(getCountryByCallingCode(\r\n\t\t\tthis.isInternational() ? this.state.callingCode : this.defaultCallingCode,\r\n\t\t\t{\r\n\t\t\t\tnationalNumber: this.state.nationalSignificantNumber,\r\n\t\t\t\tmetadata: this.metadata\r\n\t\t\t}\r\n\t\t))\r\n\t}\r\n\r\n\t/**\r\n\t * Returns a E.164 phone number value for the user's input.\r\n\t *\r\n\t * For example, for country `\"US\"` and input `\"(222) 333-4444\"`\r\n\t * it will return `\"+12223334444\"`.\r\n\t *\r\n\t * For international phone number input, it will also auto-correct\r\n\t * some minor errors such as using a national prefix when writing\r\n\t * an international phone number. For example, if the user inputs\r\n\t * `\"+44 0 7400 000000\"` then it will return an auto-corrected\r\n\t * `\"+447400000000\"` phone number value.\r\n\t *\r\n\t * Will return `undefined` if no digits have been input,\r\n\t * or when inputting a phone number in national format and no\r\n\t * default country or default \"country calling code\" have been set.\r\n\t *\r\n\t * @return {string} [value]\r\n\t */\r\n\tgetNumberValue() {\r\n\t\tconst {\r\n\t\t\tdigits,\r\n\t\t\tcallingCode,\r\n\t\t\tcountry,\r\n\t\t\tnationalSignificantNumber\r\n\t\t} = this.state\r\n\r\n\t \t// Will return `undefined` if no digits have been input.\r\n\t\tif (!digits) {\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\tif (this.isInternational()) {\r\n\t\t\tif (callingCode) {\r\n\t\t\t\treturn '+' + callingCode + nationalSignificantNumber\r\n\t\t\t} else {\r\n\t\t\t\treturn '+' + digits\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (country || callingCode) {\r\n\t\t\t\tconst callingCode_ = country ? this.metadata.countryCallingCode() : callingCode\r\n\t\t\t\treturn '+' + callingCode_ + nationalSignificantNumber\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Returns an instance of `PhoneNumber` class.\r\n\t * Will return `undefined` if no national (significant) number\r\n\t * digits have been entered so far, or if no `defaultCountry` has been\r\n\t * set and the user enters a phone number not in international format.\r\n\t */\r\n\tgetNumber() {\r\n\t\tconst {\r\n\t\t\tnationalSignificantNumber,\r\n\t\t\tcarrierCode,\r\n\t\t\tcallingCode\r\n\t\t} = this.state\r\n\r\n\t\t// `this._getCountry()` is basically same as `this.state.country`\r\n\t\t// with the only change that it return `undefined` in case of a\r\n\t\t// \"non-geographic\" numbering plan instead of `\"001\"` \"internal use\" value.\r\n\t\tlet country = this._getCountry()\r\n\r\n\t\tif (!nationalSignificantNumber) {\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\t// `state.country` and `state.callingCode` aren't required to be in sync.\r\n\t\t// For example, `country` could be `\"AR\"` and `callingCode` could be `undefined`.\r\n\t\t// So `country` and `callingCode` are totally independent.\r\n\r\n\t\tif (!country && !callingCode) {\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\t// By default, if `defaultCountry` parameter was passed when\r\n\t\t// creating `AsYouType` instance, `state.country` is gonna be\r\n\t\t// that `defaultCountry`, which doesn't entirely conform with\r\n\t\t// `parsePhoneNumber()`'s behavior where it attempts to determine\r\n\t\t// the country more precisely in cases when multiple countries\r\n\t\t// could correspond to the same `countryCallingCode`.\r\n\t\t// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/103#note_1417192969\r\n\t\t//\r\n\t\t// Because `AsYouType.getNumber()` method is supposed to be a 1:1\r\n\t\t// equivalent for `parsePhoneNumber(AsYouType.getNumberValue())`,\r\n\t\t// then it should also behave accordingly in cases of `country` ambiguity.\r\n\t\t// That's how users of this library would expect it to behave anyway.\r\n\t\t//\r\n\t\tif (country) {\r\n\t\t\tif (country === this.defaultCountry) {\r\n\t\t\t\t// `state.country` and `state.callingCode` aren't required to be in sync.\r\n\t\t\t\t// For example, `state.country` could be `\"AR\"` and `state.callingCode` could be `undefined`.\r\n\t\t\t\t// So `state.country` and `state.callingCode` are totally independent.\r\n\t\t\t\tconst metadata = new Metadata(this.metadata.metadata)\r\n\t\t\t\tmetadata.selectNumberingPlan(country)\r\n\t\t\t\tconst callingCode = metadata.numberingPlan.callingCode()\r\n\t\t\t\tconst ambiguousCountries = this.metadata.getCountryCodesForCallingCode(callingCode)\r\n\t\t\t\tif (ambiguousCountries.length > 1) {\r\n\t\t\t\t\tconst exactCountry = getCountryByNationalNumber(nationalSignificantNumber, {\r\n\t\t\t\t\t\tcountries: ambiguousCountries,\r\n\t\t\t\t\t\tmetadata: this.metadata.metadata\r\n\t\t\t\t\t})\r\n\t\t\t\t\tif (exactCountry) {\r\n\t\t\t\t\t\tcountry = exactCountry\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconst phoneNumber = new PhoneNumber(\r\n\t\t\tcountry || callingCode,\r\n\t\t\tnationalSignificantNumber,\r\n\t\t\tthis.metadata.metadata\r\n\t\t)\r\n\t\tif (carrierCode) {\r\n\t\t\tphoneNumber.carrierCode = carrierCode\r\n\t\t}\r\n\t\t// Phone number extensions are not supported by \"As You Type\" formatter.\r\n\t\treturn phoneNumber\r\n\t}\r\n\r\n\t/**\r\n\t * Returns `true` if the phone number is \"possible\".\r\n\t * Is just a shortcut for `PhoneNumber.isPossible()`.\r\n\t * @return {boolean}\r\n\t */\r\n\tisPossible() {\r\n\t\tconst phoneNumber = this.getNumber()\r\n\t\tif (!phoneNumber) {\r\n\t\t\treturn false\r\n\t\t}\r\n\t\treturn phoneNumber.isPossible()\r\n\t}\r\n\r\n\t/**\r\n\t * Returns `true` if the phone number is \"valid\".\r\n\t * Is just a shortcut for `PhoneNumber.isValid()`.\r\n\t * @return {boolean}\r\n\t */\r\n\tisValid() {\r\n\t\tconst phoneNumber = this.getNumber()\r\n\t\tif (!phoneNumber) {\r\n\t\t\treturn false\r\n\t\t}\r\n\t\treturn phoneNumber.isValid()\r\n\t}\r\n\r\n\t/**\r\n\t * @deprecated\r\n\t * This method is used in `react-phone-number-input/source/input-control.js`\r\n\t * in versions before `3.0.16`.\r\n\t */\r\n\tgetNationalNumber() {\r\n\t\treturn this.state.nationalSignificantNumber\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the phone number characters entered by the user.\r\n\t * @return {string}\r\n\t */\r\n\tgetChars() {\r\n\t\treturn (this.state.international ? '+' : '') + this.state.digits\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the template for the formatted phone number.\r\n\t * @return {string}\r\n\t */\r\n\tgetTemplate() {\r\n\t\treturn this.formatter.getTemplate(this.state) || this.getNonFormattedTemplate() || ''\r\n\t}\r\n}"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAD,uBAAA,CAAAJ,OAAA;AACA,IAAAM,wBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,2BAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,SAAA,GAAAT,sBAAA,CAAAC,OAAA;AAA4C,SAAAI,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,wBAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,mBAAAT,CAAA,iBAAAA,CAAA,gBAAAU,OAAA,CAAAV,CAAA,0BAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,cAAAM,EAAA,IAAAd,CAAA,gBAAAc,E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ignoreList":[]}
|
package/build/AsYouType.test.js
CHANGED
|
@@ -593,17 +593,16 @@ describe('AsYouType', function () {
|
|
|
593
593
|
expect(asYouType.input('0343515551212')).to.equal('03435 15-55-1212');
|
|
594
594
|
});
|
|
595
595
|
it('should return non-formatted phone number when no format matches and national (significant) number has digits added', function () {
|
|
596
|
-
// When
|
|
597
|
-
//
|
|
596
|
+
// When inputting "0343515551212999" Argentinian mobile number,
|
|
597
|
+
// the parsed national (significant) number is "93435551212999".
|
|
598
|
+
// There, one can see how it stripped "0" national prefix and prepended a "9",
|
|
599
|
+
// because that's how it is instructed to do in Argentina's metadata.
|
|
600
|
+
//
|
|
601
|
+
// So in this case, national (significant) number doesn't match the input
|
|
602
|
+
// and, therefore, `state.nationalSignificantNumberIsModified` flag is `true`.
|
|
603
|
+
//
|
|
598
604
|
var asYouType = new AsYouType('AR');
|
|
599
|
-
//
|
|
600
|
-
// (no `9` is prepended).
|
|
601
|
-
// First parses national (significant) number by prepending `9` to it
|
|
602
|
-
// and stripping `15` from it.
|
|
603
|
-
// Then uses `$2 15-$3-$4` format that strips the leading `9`
|
|
604
|
-
// and adds `15`.
|
|
605
|
-
// `this.nationalSignificantNumberMatchesInput` is `false` in this case,
|
|
606
|
-
// so `getNonFormattedNumber()` returns `getFullNumber(getNationalDigits())`.
|
|
605
|
+
// This line checks that the formatter didn't alter the output digits compared to the input digits.
|
|
607
606
|
expect(asYouType.input('0343515551212999')).to.equal('0343515551212999');
|
|
608
607
|
});
|
|
609
608
|
it('should format Argentina numbers (starting with 011) (digit by digit)', function () {
|
|
@@ -678,7 +677,7 @@ describe('AsYouType', function () {
|
|
|
678
677
|
// After leading digits < 3 matching was implemented:
|
|
679
678
|
expect(formatter.input('081')).to.equal('081');
|
|
680
679
|
});
|
|
681
|
-
it('should prepend `
|
|
680
|
+
it('should prepend `prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix` (not a complete number)', function () {
|
|
682
681
|
// A country having `national_prefix_for_parsing` with a "capturing group".
|
|
683
682
|
// National prefix is either not used in a format or is optional.
|
|
684
683
|
// Input phone number without a national prefix.
|
|
@@ -690,9 +689,9 @@ describe('AsYouType', function () {
|
|
|
690
689
|
// `formatter.digits` is not always `formatter.nationalPrefix`
|
|
691
690
|
// plus `formatter.nationalNumberDigits`.
|
|
692
691
|
expect(formatter.state.nationalPrefix).to.be.undefined;
|
|
693
|
-
expect(formatter.state.
|
|
692
|
+
expect(formatter.state.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix).to.equal('1831');
|
|
694
693
|
});
|
|
695
|
-
it('should prepend `
|
|
694
|
+
it('should prepend `prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix` (complete number)', function () {
|
|
696
695
|
// A country having `national_prefix_for_parsing` with a "capturing group".
|
|
697
696
|
// National prefix is either not used in a format or is optional.
|
|
698
697
|
// Input phone number without a national prefix.
|
|
@@ -704,7 +703,7 @@ describe('AsYouType', function () {
|
|
|
704
703
|
// `formatter.digits` is not always `formatter.nationalPrefix`
|
|
705
704
|
// plus `formatter.nationalNumberDigits`.
|
|
706
705
|
expect(formatter.state.nationalPrefix).to.be.undefined;
|
|
707
|
-
expect(formatter.state.
|
|
706
|
+
expect(formatter.state.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix).to.equal('1831');
|
|
708
707
|
});
|
|
709
708
|
it('should work with Mexico numbers', function () {
|
|
710
709
|
var asYouType = new AsYouType('MX');
|