LouisMazel / maz-ui

Vue & Nuxt library of standalone components & tools to build interfaces

Home Page:https://maz-ui.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: MazPhoneNumberInput: The country 419 is not available

JorgeMantillaHernandez opened this issue · comments

hi, I have the following error, in production it works but not locally.

I am running from linux and from windows and I get the same error.
"maz-ui": "^2.3.5",


client.js?06a0:97 Error: Unknown country: 419
    at getCountryCallingCode (metadata.js?07f3:631)
    at withMetadata (metadata.js?3d4a:10)
    at getCountryCallingCode (getCountryCallingCode.js?4037:5)
    at VueComponent.callingCode (maz-phone-number-input.js?5d60:3422)
    at Watcher.get (vue.runtime.esm.js?2b0e:4479)
    at Watcher.evaluate (vue.runtime.esm.js?2b0e:4584)
    at VueComponent.computedGetter [as callingCode] (vue.runtime.esm.js?2b0e:4836)
    at Object.get (vue.runtime.esm.js?2b0e:2072)
    at Proxy.render (maz-phone-number-input.js?5d60:2784)
    at VueComponent.Vue._render (vue.runtime.esm.js?2b0e:3548)

maz-phone-number-input.js?5d60:3015 Uncaught (in promise) Error: MazPhoneNumberInput: The country 419 is not available
    at _callee$ (maz-phone-number-input.js?5d60:3015)
    at c (runtime.js:63)
    at Generator._invoke (runtime.js:293)
    at Generator.next (runtime.js:118)
    at asyncGeneratorStep (maz-phone-number-input.js?5d60:2978)
    at _next (maz-phone-number-input.js?5d60:2980)
    at eval (maz-phone-number-input.js?5d60:2980)
    at new Promise (<anonymous>)
    at eval (maz-phone-number-input.js?5d60:2980)
    at isCountryAvailable (maz-phone-number-input.js?5d60:3026)

commented

Hi @JorsMantilla ,

What is your browser locale ?
You can disable the fetch by the props attribut no-use-browser-locale

Hey @LouisMazel , I have the same issue and I do not understand how it is connected with the browser locale?

Error: MazPhoneNumberInput: The country 419 is not available

As I understand, if I set no-use-browser-locale to true, that will fix an issue. But I want to understand clearly what the issue is, why am I getting it and what the fix does?

commented

@seyfer
The component will try to guess the user locale with the browser API

window.navigator.language

Sometimes the locale returns is not supported by libphonenumber-js library. So you to fix it, you just have to disable the browser locale

@LouisMazel thanks. If this option will be disabled, then default-country-code will be used? There will be no guessing at all?

As I understand from docs:

Multi options to getting country code : By default the component get the country code via the browser (disable it with no-> use-browser-locale) or you can use - fetch-country to get the country code via https://ip2c.org/s (network needed) - you
can use default-country-code option instead to set one

Or could this error Error: MazPhoneNumberInput: The country 419 is not available be just ignored?
If it can be ignored, could it be handled in MazPhoneNumberInput and not be sent to the console?

I can imagine the following logic: try to determine the country, if it fails, try to use default default-country-code, if it is not defined, only then throw an error to the console.

@LouisMazel could this error handling be added to MazPhoneNumberInput please?