@paypal/checkout-components 5.0.223 → 5.0.226
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/button.js +1 -1
- package/package.json +1 -1
- package/src/zoid/buttons/component.jsx +37 -4
- package/src/zoid/buttons/util.js +1 -3
- package/src/zoid/checkout/component.jsx +10 -0
package/package.json
CHANGED
|
@@ -671,12 +671,47 @@ export const getButtonsComponent : () => ButtonsComponent = memoize(() => {
|
|
|
671
671
|
required: false,
|
|
672
672
|
type: 'string',
|
|
673
673
|
value: ({ props }) => {
|
|
674
|
-
const { commit, createBillingAgreement, currency, disableFunding = [], fundingEligibility, locale,
|
|
674
|
+
const { env, clientID, merchantID, commit, createBillingAgreement, currency, disableFunding = [], experience, fundingEligibility, locale, style: { layout }, vault } = props || {};
|
|
675
|
+
|
|
676
|
+
if (experience === 'inline') {
|
|
677
|
+
return EXPERIENCE.INLINE;
|
|
678
|
+
}
|
|
675
679
|
|
|
676
680
|
const inlineCheckoutEligibility : InlineXOEligibilityType = __INLINE_CHECKOUT_ELIGIBILITY__ || {
|
|
677
681
|
eligible: false
|
|
678
682
|
};
|
|
679
|
-
|
|
683
|
+
|
|
684
|
+
let alphaEligible = true;
|
|
685
|
+
if (env === 'sandbox') {
|
|
686
|
+
const validMerchantIDs = [
|
|
687
|
+
'PJEHAEK4YBEDJ',
|
|
688
|
+
'RMADGM9SZGSPJ',
|
|
689
|
+
'5AZBQ2LU7HVE6',
|
|
690
|
+
'SMJKX2JD3V27L',
|
|
691
|
+
'RB28JB2TP9RA4'
|
|
692
|
+
];
|
|
693
|
+
const eligibleMerchantID = merchantID && merchantID.length && merchantID.reduce((acc, id) => {
|
|
694
|
+
return acc && validMerchantIDs.indexOf(id) !== -1;
|
|
695
|
+
}, true);
|
|
696
|
+
|
|
697
|
+
alphaEligible = clientID === 'AbUf2xGyVtp8HedZjyx9we1V2eRV9-Q7bLTVfr9Y-FFpG8dbWAaQ0AFqeh2dq_HYHrV_1GUPXGv6GMKp'
|
|
698
|
+
&& eligibleMerchantID;
|
|
699
|
+
} else if (env === 'production') {
|
|
700
|
+
const validMerchantIDs = [
|
|
701
|
+
'G4Z8SJD6PEZ2G'
|
|
702
|
+
];
|
|
703
|
+
|
|
704
|
+
const eligibleMerchantID = merchantID && merchantID.length && merchantID.reduce((acc, id) => {
|
|
705
|
+
return acc && validMerchantIDs.indexOf(id) !== -1;
|
|
706
|
+
}, true);
|
|
707
|
+
|
|
708
|
+
if (clientID === 'AT2hsh6PFa_pvqYVni64Ik2Ojaluh_l9DU3KwXuHb-sgj8q9zZrmob2TUsmvu4rjJ869oHUAlIAqJf9R') {
|
|
709
|
+
alphaEligible = eligibleMerchantID;
|
|
710
|
+
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
return inlineCheckoutEligibility && inlineCheckoutEligibility.eligible && alphaEligible && isInlineXOEligible({ props: {
|
|
680
715
|
commit,
|
|
681
716
|
createBillingAgreement,
|
|
682
717
|
currency,
|
|
@@ -684,8 +719,6 @@ export const getButtonsComponent : () => ButtonsComponent = memoize(() => {
|
|
|
684
719
|
fundingEligibility,
|
|
685
720
|
layout,
|
|
686
721
|
locale,
|
|
687
|
-
merchantID,
|
|
688
|
-
onComplete,
|
|
689
722
|
vault
|
|
690
723
|
} }) ? EXPERIENCE.INLINE : '';
|
|
691
724
|
}
|
package/src/zoid/buttons/util.js
CHANGED
|
@@ -311,7 +311,7 @@ type InlineCheckoutEligibilityProps = {|
|
|
|
311
311
|
|};
|
|
312
312
|
|
|
313
313
|
export function isInlineXOEligible({ props } : {| props : InlineCheckoutEligibilityProps |}) : boolean {
|
|
314
|
-
const { commit, currency, createBillingAgreement, disableFunding, fundingEligibility, layout, locale,
|
|
314
|
+
const { commit, currency, createBillingAgreement, disableFunding, fundingEligibility, layout, locale, vault } = props;
|
|
315
315
|
|
|
316
316
|
const isEligible = (
|
|
317
317
|
locale.country === COUNTRY.US &&
|
|
@@ -321,8 +321,6 @@ export function isInlineXOEligible({ props } : {| props : InlineCheckoutEligibil
|
|
|
321
321
|
(disableFunding?.indexOf(FUNDING.CARD) === -1) &&
|
|
322
322
|
(fundingEligibility?.card?.eligible || false) &&
|
|
323
323
|
layout === BUTTON_LAYOUT.VERTICAL &&
|
|
324
|
-
merchantID?.length === 0 &&
|
|
325
|
-
Boolean(onComplete) &&
|
|
326
324
|
vault === false
|
|
327
325
|
);
|
|
328
326
|
|
|
@@ -201,6 +201,16 @@ export function getCheckoutComponent() : CheckoutComponent {
|
|
|
201
201
|
type: 'function',
|
|
202
202
|
required: false
|
|
203
203
|
},
|
|
204
|
+
|
|
205
|
+
onShippingAddressChange: {
|
|
206
|
+
type: 'function',
|
|
207
|
+
required: false
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
onShippingOptionsChange: {
|
|
211
|
+
type: 'function',
|
|
212
|
+
required: false
|
|
213
|
+
},
|
|
204
214
|
|
|
205
215
|
clientMetadataID: {
|
|
206
216
|
type: 'string',
|