paypal-checkout
Advanced tools
Comparing version 4.0.291 to 4.0.292
{ | ||
"name": "paypal-checkout", | ||
"version": "4.0.291", | ||
"version": "4.0.292", | ||
"description": "PayPal Checkout components, for integrating checkout products.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -39,3 +39,3 @@ /* @flow */ | ||
const { label, funding, layout, locale, max, sources } = normalizeProps(props, { locale: getBrowserLocale() }); | ||
const { label, funding, layout, locale, max, sources, env } = normalizeProps(props, { locale: getBrowserLocale() }); | ||
const { allowed } = funding; | ||
@@ -64,3 +64,3 @@ const { country } = locale; | ||
if (isFundingIneligible(FUNDING.CREDIT, { funding, locale, layout })) { | ||
if (isFundingIneligible(FUNDING.CREDIT, { funding, locale, layout, env })) { | ||
return false; | ||
@@ -152,3 +152,3 @@ } | ||
if (smartThrottle.isEnabled() || props.enableNativeCheckout || env !== ENV.PRODUCTION) { | ||
if (props.enableNativeCheckout) { | ||
return url.replace('/webapps/hermes/button', '/smart/button'); | ||
@@ -155,0 +155,0 @@ } |
@@ -55,3 +55,4 @@ /* @flow */ | ||
NEED_OPT_IN: 'The funding source needs to be allowed in funding.allowed', | ||
COMMIT_NOT_SET: 'The funding source is not enabled when commit is not set as true' | ||
COMMIT_NOT_SET: 'The funding source is not enabled when commit is not set as true', | ||
INVALID_ENV: 'The funding source is not supported in this environment' | ||
}; | ||
@@ -58,0 +59,0 @@ |
@@ -10,4 +10,4 @@ /* @flow */ | ||
export function isFundingIneligible(source : FundingSource, { locale, funding, layout, commit } : | ||
{ locale : LocaleType, funding : FundingSelection, layout : string, commit? : boolean }) : ?string { | ||
export function isFundingIneligible(source : FundingSource, { locale, funding, layout, commit, env } : | ||
{ locale : LocaleType, funding : FundingSelection, layout : string, commit? : boolean, env : string }) : ?string { | ||
@@ -39,2 +39,7 @@ const isVertical = layout === BUTTON_LAYOUT.VERTICAL; | ||
} | ||
const allowedEnvs = getFundingConfig(source, 'allowedEnvs'); | ||
if (allowedEnvs && allowedEnvs.indexOf(env) === -1) { | ||
return FUNDING_ELIGIBILITY_REASON.INVALID_ENV; | ||
} | ||
} | ||
@@ -77,3 +82,3 @@ | ||
const ineligibleReason = isFundingIneligible(source, { locale, funding, layout, commit }); | ||
const ineligibleReason = isFundingIneligible(source, { locale, funding, layout, commit, env }); | ||
@@ -80,0 +85,0 @@ if (ineligibleReason) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
6606713
71034