paypal-braintree-web-client
Advanced tools
Comparing version 4.0.36 to 4.0.37
{ | ||
"name": "paypal-braintree-web-client", | ||
"version": "4.0.36", | ||
"version": "4.0.37", | ||
"description": "Shared config between PayPal/Braintree.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
/* @flow */ | ||
import { COUNTRY, ENV } from 'paypal-sdk-constants/src'; | ||
import { ENV } from 'paypal-sdk-constants/src'; | ||
@@ -13,4 +13,2 @@ declare var __HOST__ : string; | ||
declare var __ENV__ : $Values<typeof ENV>; | ||
declare var __BUYER_COUNTRY__: $Values<typeof COUNTRY>; | ||
declare var __LOCALE_COUNTRY__ : $Values<typeof COUNTRY>; | ||
declare var __DEBUG__ : boolean; | ||
@@ -17,0 +15,0 @@ declare var __STAGE__ : boolean; |
/* @flow */ | ||
import { COUNTRY, ENV } from 'paypal-sdk-constants/src'; | ||
import { ENV } from 'paypal-sdk-constants/src'; | ||
@@ -25,11 +25,2 @@ export function getHost() : string { | ||
export function getBuyerCountry() : $Values<typeof COUNTRY> { | ||
if (typeof __BUYER_COUNTRY__ !== 'undefined') { | ||
return __BUYER_COUNTRY__; | ||
} | ||
// Remove | ||
return __LOCALE_COUNTRY__; | ||
} | ||
export function getDefaultStageHost() : string { | ||
@@ -36,0 +27,0 @@ return __STAGE_HOST__; |
@@ -9,3 +9,3 @@ /* @flow */ | ||
import { getPayPalLoggerUrl } from './config'; | ||
import { getEnv, getVersion, getCorrelationID, getBuyerCountry } from './globals'; | ||
import { getEnv, getVersion, getCorrelationID } from './globals'; | ||
import { getPartnerAttributionID, getClientID, getMerchantID, getCommit, getLocale } from './script'; | ||
@@ -44,3 +44,2 @@ import { isEligible } from './eligibility'; | ||
[FPTI_KEY.LOCALE]: `${ lang }_${ country }`, | ||
[FPTI_KEY.BUYER_COUNTRY]: getBuyerCountry(), | ||
[FPTI_KEY.INTEGRATION_IDENTIFIER]: getClientID(), | ||
@@ -47,0 +46,0 @@ [FPTI_KEY.PARTNER_ATTRIBUTION_ID]: getPartnerAttributionID(), |
@@ -7,3 +7,3 @@ /* @flow */ | ||
import { getHost, getPath, getDefaultStageHost, getBuyerCountry } from './globals'; | ||
import { getHost, getPath, getDefaultStageHost } from './globals'; | ||
@@ -131,19 +131,22 @@ export const CLIENT_ID_ALIAS = { | ||
} | ||
const buyerCountry = getBuyerCountry(); | ||
const potentialLangs = COUNTRY_LANGS[buyerCountry]; | ||
let localeLang = potentialLangs[0]; | ||
for (const { country, lang } of getBrowserLocales()) { | ||
if (country && country === buyerCountry && potentialLangs.indexOf(lang) !== -1) { | ||
// $FlowFixMe | ||
if (COUNTRY_LANGS.hasOwnProperty(country) && COUNTRY_LANGS[country].indexOf(lang) !== -1) { | ||
// $FlowFixMe | ||
localeLang = lang; | ||
break; | ||
return { country, lang }; | ||
} | ||
} | ||
for (const { country } of getBrowserLocales()) { | ||
// $FlowFixMe | ||
if (COUNTRY_LANGS.hasOwnProperty(country)) { | ||
// $FlowFixMe | ||
return { country, lang: COUNTRY_LANGS[country][0] }; | ||
} | ||
} | ||
return { | ||
// $FlowFixMe | ||
lang: localeLang, | ||
country: buyerCountry | ||
lang: LANG.EN, | ||
country: COUNTRY.US | ||
}; | ||
@@ -150,0 +153,0 @@ } |
46111
781