@paypal/checkout-components 5.0.230 → 5.0.232

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/package.json CHANGED
@@ -1,19 +1,15 @@
1
1
  {
2
2
  "name": "@paypal/checkout-components",
3
- "version": "5.0.230",
3
+ "version": "5.0.232",
4
4
  "description": "PayPal Checkout components, for integrating checkout products.",
5
5
  "main": "index.js",
6
- "engines": {
7
- "node": ">=14.13.1 <16",
8
- "npm": ">=6"
9
- },
10
6
  "scripts": {
11
- "dev": "babel-node $(npm bin)/webpack-dev-server --config webpack.config.dev.js --port 9001 --host localhost.paypal.com --open-page demo/dev/index.htm --https --hot=false --inline=false",
7
+ "dev": "npm run check-node-version && babel-node $(npm bin)/webpack-dev-server --config webpack.config.dev.js --port 9001 --host localhost.paypal.com --open-page demo/dev/index.htm --https --hot=false --inline=false",
12
8
  "lint": "eslint --ext .js --ext .jsx src/ test/ *.js",
13
9
  "flow-typed": "rm -rf flow-typed && flow-typed install && rm flow-typed/npm/puppeteer_*",
14
10
  "flow": "flow",
15
11
  "karma": "cross-env NODE_ENV=test babel-node $(npm bin)/karma start",
16
- "test": "if [ ! $SKIP_TEST ]; then npm run lint && npm run flow-typed && npm run flow && npm run jest-ssr && npm run karma && npm run jest-screenshot; fi;",
12
+ "test": "npm run check-node-version && npm run lint && npm run flow-typed && npm run flow && npm run jest-ssr && npm run karma && npm run jest-screenshot",
17
13
  "webpack": "babel-node $(npm bin)/webpack --progress",
18
14
  "webpack-size": "babel-node $(npm bin)/webpack --progress --config webpack.config.size",
19
15
  "build": "npm run test && npm run webpack",
@@ -31,7 +27,8 @@
31
27
  "jest-e2e": "rm -f ./test/e2e/screenshots/*.png && jest test/e2e",
32
28
  "check-size": "npm run webpack-size && bundlemon && npm run delete-size",
33
29
  "delete-size": "rm dist/size.* dist/report.html",
34
- "prepare": "husky install"
30
+ "prepare": "husky install",
31
+ "check-node-version": "node scripts/check-node-version.js"
35
32
  },
36
33
  "files": [
37
34
  "src/",
@@ -48,7 +45,7 @@
48
45
  ],
49
46
  "repository": {
50
47
  "type": "git",
51
- "url": "git://github.com/paypal/paypal-checkout-components.git"
48
+ "url": "https://github.com/paypal/paypal-checkout-components.git"
52
49
  },
53
50
  "homepage": "https://developer.paypal.com/",
54
51
  "keywords": [
@@ -652,7 +652,7 @@ export const getButtonsComponent : () => ButtonsComponent = memoize(() => {
652
652
  required: false,
653
653
  type: 'string',
654
654
  value: ({ props }) => {
655
- const { env, clientID, merchantID, commit, createBillingAgreement, currency, disableFunding = [], experience, fundingEligibility, locale, style: { layout }, vault } = props || {};
655
+ const { commit, createBillingAgreement, currency, disableFunding = [], experience, fundingEligibility, onComplete, style : { custom = {}, layout }, vault } = props || {};
656
656
 
657
657
  if (experience === 'inline') {
658
658
  return EXPERIENCE.INLINE;
@@ -662,44 +662,15 @@ export const getButtonsComponent : () => ButtonsComponent = memoize(() => {
662
662
  eligible: false
663
663
  };
664
664
 
665
- let alphaEligible = true;
666
- if (env === 'sandbox') {
667
- const validMerchantIDs = [
668
- 'PJEHAEK4YBEDJ',
669
- 'RMADGM9SZGSPJ',
670
- '5AZBQ2LU7HVE6',
671
- 'SMJKX2JD3V27L',
672
- 'RB28JB2TP9RA4'
673
- ];
674
- const eligibleMerchantID = merchantID && merchantID.length && merchantID.reduce((acc, id) => {
675
- return acc && validMerchantIDs.indexOf(id) !== -1;
676
- }, true);
677
-
678
- alphaEligible = clientID === 'AbUf2xGyVtp8HedZjyx9we1V2eRV9-Q7bLTVfr9Y-FFpG8dbWAaQ0AFqeh2dq_HYHrV_1GUPXGv6GMKp'
679
- && eligibleMerchantID;
680
- } else if (env === 'production') {
681
- const validMerchantIDs = [
682
- 'G4Z8SJD6PEZ2G'
683
- ];
684
-
685
- const eligibleMerchantID = merchantID && merchantID.length && merchantID.reduce((acc, id) => {
686
- return acc && validMerchantIDs.indexOf(id) !== -1;
687
- }, true);
688
-
689
- if (clientID === 'AT2hsh6PFa_pvqYVni64Ik2Ojaluh_l9DU3KwXuHb-sgj8q9zZrmob2TUsmvu4rjJ869oHUAlIAqJf9R') {
690
- alphaEligible = eligibleMerchantID;
691
-
692
- }
693
- }
694
-
695
- const eligible = inlineCheckoutEligibility && inlineCheckoutEligibility.eligible && alphaEligible && isInlineXOEligible({ props: {
665
+ const eligible = inlineCheckoutEligibility && inlineCheckoutEligibility.eligible && isInlineXOEligible({ props: {
696
666
  commit,
697
667
  createBillingAgreement,
698
668
  currency,
669
+ custom,
699
670
  disableFunding,
700
671
  fundingEligibility,
701
672
  layout,
702
- locale,
673
+ onComplete,
703
674
  vault
704
675
  } });
705
676
 
@@ -1,6 +1,6 @@
1
1
  /* @flow */
2
2
  import { supportsPopups as userAgentSupportsPopups, isAndroid, isChrome, isIos, isIOS14, isSafari, isSFVC, type Experiment, isDevice, isTablet, getElement, isLocalStorageEnabled, isStandAlone, once } from '@krakenjs/belter/src';
3
- import { COUNTRY, CURRENCY, ENV, FUNDING, type LocaleType } from '@paypal/sdk-constants/src';
3
+ import { CURRENCY, ENV, FUNDING } from '@paypal/sdk-constants/src';
4
4
  import { getEnableFunding, getLogger, createExperiment, getFundingEligibility, getPlatform, getComponents, getEnv, type FundingEligibilityType } from '@paypal/sdk-client/src';
5
5
  import { getRefinedFundingEligibility } from '@paypal/funding-components/src';
6
6
 
@@ -293,17 +293,23 @@ type InlineCheckoutEligibilityProps = {|
293
293
  disableFunding : $ReadOnlyArray<$Values<typeof FUNDING>>,
294
294
  fundingEligibility : FundingEligibilityType,
295
295
  layout : $Values<typeof BUTTON_LAYOUT>,
296
- locale : LocaleType,
297
296
  merchantID? : $ReadOnlyArray<string>,
298
- onComplete? : Function,
297
+ onComplete : Function,
298
+ custom? : ?{|
299
+ css? : {|
300
+ [string] : string
301
+ |},
302
+ label? : string
303
+ |},
299
304
  vault : boolean
300
305
  |};
301
306
 
302
307
  export function isInlineXOEligible({ props } : {| props : InlineCheckoutEligibilityProps |}) : boolean {
303
- const { commit, currency, createBillingAgreement, disableFunding, fundingEligibility, layout, locale, vault } = props;
308
+ const { commit, currency, custom, createBillingAgreement, disableFunding, fundingEligibility, layout, onComplete, vault } = props;
304
309
 
305
310
  const isEligible = (
306
- locale.country === COUNTRY.US &&
311
+ custom?.label && custom.label.length > 0,
312
+ onComplete &&
307
313
  commit === true &&
308
314
  !createBillingAgreement &&
309
315
  currency === CURRENCY.USD &&