File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,19 @@ interface TypeSpecificVariablePayload {
3030 tabIndex : number ;
3131}
3232
33+ export function getCountryCodeFromLocale (
34+ callback : ( countryCode : string ) => void ,
35+ ) : void {
36+ try {
37+ const locale = navigator . language || 'en-US' ;
38+ const parts = locale . split ( '-' ) ;
39+ const countryCode = parts [ parts . length - 1 ] ?. toLowerCase ( ) ; // handle things like en-US / zh-Hans-CN
40+ callback ( countryCode || 'us' ) ;
41+ } catch ( error ) {
42+ callback ( 'us' ) ;
43+ }
44+ }
45+
3346export default class ChannelCaptureContainer {
3447 public smsInputFieldIsValid = true ;
3548 public emailInputFieldIsValid = true ;
@@ -194,6 +207,8 @@ export default class ChannelCaptureContainer {
194207 {
195208 autoPlaceholder : 'off' ,
196209 separateDialCode : true ,
210+ initialCountry : 'auto' ,
211+ geoIpLookup : getCountryCodeFromLocale ,
197212 } ,
198213 ) ;
199214 } else {
You can’t perform that action at this time.
0 commit comments