intl-tel-input icon indicating copy to clipboard operation
intl-tel-input copied to clipboard

Invalid country data for French overseas territories

Open DynamoRed opened this issue 1 year ago • 1 comments

Steps to reproduce

  1. Have an IP from an overseas territory (such as Guadeloupe, Martinique, etc.) in France
  2. Load a page with intl-tel-input and IPAPI configured as geoIpLookup callback

Expected behaviour

The phone number should have a French format and a French flag should appear

Actual behaviour

The error "No country data for 'gp'" appears and no flag or format is correctly selected by default

Initialisation options

  • IPAPI returns gp or mq for example for Guadeloupe and Martinique
  • The code for geoIpLookup is as follows:
geoIpLookup: callback => {
  fetch("https://ipapi.co/json")
    .then(res => res.json())
    .then(data => callback(data.country_code))
    .catch(() => callback("fr"));
},

DynamoRed avatar May 07 '24 14:05 DynamoRed

Can you log the value of data.country_code that is being passed to the callback?

Because when I test it, passing "gp", it seems to work fine: https://codepen.io/jackocnr/pen/mdYdbPa

Some more questions:

  • Which version of the plugin are you using?
  • Are you using any other initialisation options? e.g. onlyCountries?
  • Is there a number in the input when you initialise the plugin?

jackocnr avatar May 08 '24 21:05 jackocnr

Closing due to inactivity.

jackocnr avatar May 15 '24 23:05 jackocnr