@paypal/checkout-components 5.0.390 → 5.0.392

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@paypal/checkout-components",
3
- "version": "5.0.390",
3
+ "version": "5.0.392",
4
4
  "description": "PayPal Checkout components, for integrating checkout products.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -40,6 +40,7 @@ export function getCreditConfig(): FundingSourceConfig {
40
40
  BUTTON_FLOW.PURCHASE,
41
41
  BUTTON_FLOW.BILLING_SETUP,
42
42
  BUTTON_FLOW.SUBSCRIPTION_SETUP,
43
+ BUTTON_FLOW.VAULT_WITHOUT_PURCHASE,
43
44
  ],
44
45
 
45
46
  layouts: [BUTTON_LAYOUT.HORIZONTAL, BUTTON_LAYOUT.VERTICAL],
@@ -89,6 +89,15 @@ export function isFundingEligible(
89
89
  userAgent,
90
90
  }: IsFundingEligibleOptions
91
91
  ): boolean {
92
+ // Temporary: Force credit to be eligible if the experiment is enabled
93
+ if (
94
+ source === FUNDING.CREDIT &&
95
+ experiment?.paypalCreditButtonCreateVaultSetupTokenExists &&
96
+ flow === BUTTON_FLOW.VAULT_WITHOUT_PURCHASE
97
+ ) {
98
+ return true;
99
+ }
100
+
92
101
  if (!fundingEligibility[source] || !fundingEligibility[source].eligible) {
93
102
  return false;
94
103
  }
@@ -142,8 +142,7 @@ export class ThreeDomainSecureComponent {
142
142
  }
143
143
  // eslint-disable-next-line compat/compat
144
144
  return new Promise((resolve, reject) => {
145
- let authenticationState,
146
- liabilityShift;
145
+ let authenticationState, liabilityShift;
147
146
  const cancelThreeDS = () => {
148
147
  return ZalgoPromise.try(() => {
149
148
  this.logger.warn("3DS Cancelled");
package/src/types.js CHANGED
@@ -67,6 +67,7 @@ export type Experiment = {|
67
67
  isWebViewEnabled?: boolean,
68
68
  venmoEnableWebOnNonNativeBrowser?: boolean,
69
69
  spbEagerOrderCreation?: boolean,
70
+ paypalCreditButtonCreateVaultSetupTokenExists?: boolean,
70
71
  |};
71
72
 
72
73
  export type Requires = {|
@@ -47,7 +47,6 @@ import {
47
47
  getSDKInitTime,
48
48
  getSDKToken,
49
49
  getShopperSessionId,
50
- getGlobalSessionID,
51
50
  } from "@paypal/sdk-client/src";
52
51
  import {
53
52
  rememberFunding,
@@ -250,14 +249,22 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
250
249
  style = {},
251
250
  enableFunding = getEnableFunding(),
252
251
  fundingEligibility = getRefinedFundingEligibility(),
253
- supportsPopups = userAgentSupportsPopups(),
254
- supportedNativeBrowser = isSupportedNativeBrowser(),
252
+ supportsPopups = props.fundingSource === FUNDING.VENMO
253
+ ? supportsVenmoPopups(
254
+ props.experiment,
255
+ userAgentSupportsPopups(),
256
+ getUserAgent()
257
+ )
258
+ : userAgentSupportsPopups(),
259
+ supportedNativeBrowser = props.fundingSource === FUNDING.VENMO
260
+ ? isSupportedNativeVenmoBrowser(props.experiment, getUserAgent())
261
+ : isSupportedNativeBrowser(),
255
262
  experiment = getButtonExperiments(),
256
263
  createBillingAgreement,
257
264
  createSubscription,
258
265
  createVaultSetupToken,
259
266
  displayOnly,
260
- userAgent,
267
+ userAgent = getUserAgent(),
261
268
  } = props;
262
269
 
263
270
  const flow = determineFlow({
@@ -814,12 +821,6 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
814
821
  },
815
822
  },
816
823
 
817
- globalSessionID: {
818
- type: "string",
819
- required: false,
820
- value: getGlobalSessionID,
821
- },
822
-
823
824
  hostedButtonId: {
824
825
  type: "string",
825
826
  required: false,
@@ -25,7 +25,6 @@ import {
25
25
  getUserIDToken,
26
26
  getSDKToken,
27
27
  getClientMetadataID,
28
- isPayPalDomain,
29
28
  } from "@paypal/sdk-client/src";
30
29
  import { getRefinedFundingEligibility } from "@paypal/funding-components/src";
31
30
  import {
@@ -249,23 +248,21 @@ export const getCardFieldsComponent: () => CardFieldsComponent = memoize(
249
248
  value: ({ props }) => props.parent.props.createOrder,
250
249
  },
251
250
 
252
- ...(isPayPalDomain() && {
253
- createSubscription: {
254
- type: "function",
255
- required: false,
256
- value: ({ props }) => {
257
- if (
258
- props.parent.props.createSubscription &&
259
- !props.parent.props.sdkToken
260
- ) {
261
- throw new ValidationError(
262
- `SDK Token must be passed in for createSubscription`
263
- );
264
- }
265
- return props.parent.props.createSubscription;
266
- },
251
+ createSubscription: {
252
+ type: "function",
253
+ required: false,
254
+ value: ({ props }) => {
255
+ if (
256
+ props.parent.props.createSubscription &&
257
+ !props.parent.props.sdkToken
258
+ ) {
259
+ throw new ValidationError(
260
+ `SDK Token must be passed in for createSubscription`
261
+ );
262
+ }
263
+ return props.parent.props.createSubscription;
267
264
  },
268
- }),
265
+ },
269
266
 
270
267
  createVaultSetupToken: {
271
268
  type: "function",
@@ -601,20 +598,18 @@ export const getCardFieldsComponent: () => CardFieldsComponent = memoize(
601
598
  required: false,
602
599
  },
603
600
 
604
- ...(isPayPalDomain() && {
605
- createSubscription: {
606
- type: "function",
607
- required: false,
608
- value: ({ props }) => {
609
- if (props.createSubscription && !props.sdkToken) {
610
- throw new ValidationError(
611
- `SDK Token must be passed in for createSubscription`
612
- );
613
- }
614
- return props.createSubscription;
615
- },
601
+ createSubscription: {
602
+ type: "function",
603
+ required: false,
604
+ value: ({ props }) => {
605
+ if (props.createSubscription && !props.sdkToken) {
606
+ throw new ValidationError(
607
+ `SDK Token must be passed in for createSubscription`
608
+ );
609
+ }
610
+ return props.createSubscription;
616
611
  },
617
- }),
612
+ },
618
613
 
619
614
  createVaultSetupToken: {
620
615
  type: "function",