@paypal/checkout-components
Advanced tools
Comparing version 5.0.42 to 5.0.43
{ | ||
"name": "@paypal/checkout-components", | ||
"version": "5.0.42", | ||
"version": "5.0.43", | ||
"description": "PayPal Checkout components, for integrating checkout products.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -156,3 +156,3 @@ /* @flow */ | ||
components : $ReadOnlyArray<$Values<typeof COMPONENTS>>, | ||
onShippingChange : ?Function | ||
onShippingChange : ?OnShippingChange | ||
|}; | ||
@@ -190,3 +190,3 @@ | ||
buttonSessionID : string, | ||
onShippingChange : ?Function, | ||
onShippingChange : ?OnShippingChange, | ||
nonce : string | ||
@@ -193,0 +193,0 @@ |}; |
@@ -8,3 +8,3 @@ /* @flow */ | ||
import { CLASS, BUTTON_NUMBER, BUTTON_LAYOUT } from '../../constants'; | ||
import { determineEligibleFunding, determineVaultedFunding } from '../../funding'; | ||
import { determineEligibleFunding, determineVaultedFunding, isVaultedFundingEligible } from '../../funding'; | ||
import { normalizeButtonProps, type ButtonPropsInputs } from '../props'; | ||
@@ -36,3 +36,6 @@ | ||
const vaultedFunding = determineVaultedFunding({ fundingEligibility, layout }); | ||
const vaultedFunding = isVaultedFundingEligible({ layout, onShippingChange }) | ||
? determineVaultedFunding({ fundingEligibility }) | ||
: []; | ||
const { PayInstantly } = buttonContent[lang]; | ||
@@ -39,0 +42,0 @@ |
@@ -79,3 +79,3 @@ /* @flow */ | ||
} | ||
// Otherwise default to show card buttons | ||
@@ -82,0 +82,0 @@ return true; |
@@ -8,2 +8,3 @@ /* @flow */ | ||
import type { FundingEligibilityType } from '../types'; | ||
import type { OnShippingChange } from '../buttons/props'; | ||
@@ -57,3 +58,15 @@ import { FUNDING_PRIORITY, getFundingConfig } from './config'; | ||
export function determineVaultedFunding({ fundingEligibility, layout } : {| fundingEligibility : FundingEligibilityType, layout : $Values<typeof BUTTON_LAYOUT> |}) : | ||
export function isVaultedFundingEligible({ layout, onShippingChange } : { layout : $Values<typeof BUTTON_LAYOUT>, onShippingChange : ?OnShippingChange }) : boolean { | ||
if (layout !== BUTTON_LAYOUT.VERTICAL) { | ||
return false; | ||
} | ||
if (onShippingChange) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
export function determineVaultedFunding({ fundingEligibility } : {| fundingEligibility : FundingEligibilityType |}) : | ||
$ReadOnlyArray<{ fundingSource : $Values<typeof FUNDING>, paymentMethodID : string, vendor? : $Values<typeof CARD>, label : string }> { | ||
@@ -63,6 +76,2 @@ | ||
if (layout !== BUTTON_LAYOUT.VERTICAL) { | ||
return vaultedFunding; | ||
} | ||
for (const fundingSource of values(FUNDING)) { | ||
@@ -69,0 +78,0 @@ const fundingConfig = fundingEligibility[fundingSource]; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
614066
3719