File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,17 +16,20 @@ export default class PhoneInputComponent extends Component {
1616 initialCountry : 'auto' ,
1717 separateDialCode : true ,
1818 formatAsYouType : true ,
19- geoIpLookup : async ( success , failure ) => {
19+ geoIpLookup : async ( success ) => {
2020 try {
2121 const ipData = await lookupUserIp ( ) ;
2222 if ( ipData && ipData . country_code ) {
2323 success ( ipData . country_code ) ;
2424 } else {
25- throw new Error ( 'No country code in IP lookup response' ) ;
25+ // Fallback to US if no country code in response
26+ debug ( 'No country code in IP lookup response, defaulting to US' ) ;
27+ success ( 'us' ) ;
2628 }
2729 } catch ( error ) {
28- debug ( 'Failed to lookup country code with frontend IP lookup:' , error . message ) ;
29- failure ( error ) ;
30+ // Always succeed with US fallback on error
31+ debug ( 'Failed to lookup country code, defaulting to US: ' + error . message ) ;
32+ success ( 'us' ) ;
3033 }
3134 } ,
3235 utilsScript : '/assets/libphonenumber/utils.js' ,
You can’t perform that action at this time.
0 commit comments