@paypal/checkout-components 5.0.225 → 5.0.228

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 CHANGED
@@ -1,3 +1,21 @@
1
+ ## <small>5.0.228 (2022-06-22)</small>
2
+
3
+ * Inline XO: Experiment (#1955) ([86f0b47](https://github.com/paypal/paypal-checkout-components/commit/86f0b47)), closes [#1955](https://github.com/paypal/paypal-checkout-components/issues/1955)
4
+
5
+
6
+
7
+ ## <small>5.0.227 (2022-06-10)</small>
8
+
9
+ * chore: log screen information for SFVC path (#1951) ([6eb2270](https://github.com/paypal/paypal-checkout-components/commit/6eb2270)), closes [#1951](https://github.com/paypal/paypal-checkout-components/issues/1951)
10
+
11
+
12
+
13
+ ## <small>5.0.226 (2022-06-06)</small>
14
+
15
+ * Inline XO: Fix production eligibility logic ([ad8b0d0](https://github.com/paypal/paypal-checkout-components/commit/ad8b0d0))
16
+
17
+
18
+
1
19
  ## <small>5.0.225 (2022-06-02)</small>
2
20
 
3
21
  * Inline XO: Force Eligibility ([3f56a06](https://github.com/paypal/paypal-checkout-components/commit/3f56a06))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paypal/checkout-components",
3
- "version": "5.0.225",
3
+ "version": "5.0.228",
4
4
  "description": "PayPal Checkout components, for integrating checkout products.",
5
5
  "main": "index.js",
6
6
  "engines": {
@@ -5,7 +5,8 @@
5
5
  import { getLogger, getLocale, getClientID, getEnv, getIntent, getCommit, getVault, getDisableFunding, getDisableCard,
6
6
  getMerchantID, getPayPalDomainRegex, getCurrency, getSDKMeta, getCSPNonce, getBuyerCountry, getClientAccessToken, getPlatform,
7
7
  getPartnerAttributionID, getCorrelationID, getEnableThreeDomainSecure, getDebug, getComponents, getStageHost, getAPIStageHost, getPayPalDomain,
8
- getUserIDToken, getClientMetadataID, getAmount, getEnableFunding, getStorageID, getUserExperienceFlow, getMerchantRequestedPopupsDisabled, getVersion } from '@paypal/sdk-client/src';
8
+ getUserIDToken, getClientMetadataID, getAmount, getEnableFunding, getStorageID, getUserExperienceFlow, getMerchantRequestedPopupsDisabled,
9
+ createExperiment, getVersion } from '@paypal/sdk-client/src';
9
10
  import { rememberFunding, getRememberedFunding, getRefinedFundingEligibility } from '@paypal/funding-components/src';
10
11
  import { ZalgoPromise } from '@krakenjs/zalgo-promise/src';
11
12
  import { create, EVENT, type ZoidComponent } from '@krakenjs/zoid/src';
@@ -705,11 +706,13 @@ export const getButtonsComponent : () => ButtonsComponent = memoize(() => {
705
706
  return acc && validMerchantIDs.indexOf(id) !== -1;
706
707
  }, true);
707
708
 
708
- alphaEligible = clientID === 'AT2hsh6PFa_pvqYVni64Ik2Ojaluh_l9DU3KwXuHb-sgj8q9zZrmob2TUsmvu4rjJ869oHUAlIAqJf9R'
709
- && eligibleMerchantID;
709
+ if (clientID === 'AT2hsh6PFa_pvqYVni64Ik2Ojaluh_l9DU3KwXuHb-sgj8q9zZrmob2TUsmvu4rjJ869oHUAlIAqJf9R') {
710
+ alphaEligible = eligibleMerchantID;
711
+
712
+ }
710
713
  }
711
714
 
712
- return inlineCheckoutEligibility && inlineCheckoutEligibility.eligible && alphaEligible && isInlineXOEligible({ props: {
715
+ const eligible = inlineCheckoutEligibility && inlineCheckoutEligibility.eligible && alphaEligible && isInlineXOEligible({ props: {
713
716
  commit,
714
717
  createBillingAgreement,
715
718
  currency,
@@ -718,7 +721,32 @@ export const getButtonsComponent : () => ButtonsComponent = memoize(() => {
718
721
  layout,
719
722
  locale,
720
723
  vault
721
- } }) ? EXPERIENCE.INLINE : '';
724
+ } });
725
+
726
+ const logger = getLogger();
727
+
728
+ logger
729
+ .info('isInlineXOEligible props', { props: JSON.stringify(props) })
730
+ .info('isInlineXOEligible eligible', { eligible: String(eligible) })
731
+ .track({
732
+ [ FPTI_KEY.TRANSITION ]: `inline_xo_eligibility_${ String(eligible) }`
733
+ }).flush();
734
+
735
+ if (eligible) {
736
+ const inlinexoExperiment = createExperiment('inlinexo', 50, logger);
737
+ const treatment = inlinexoExperiment.getTreatment();
738
+
739
+ logger
740
+ .info(treatment)
741
+ .track({
742
+ [FPTI_KEY.EXPERIMENT_NAME]: 'inlinexo',
743
+ [FPTI_KEY.TREATMENT_NAME]: treatment
744
+ }).flush();
745
+
746
+ return inlinexoExperiment.isEnabled() ? EXPERIENCE.INLINE : '';
747
+ }
748
+
749
+ return '';
722
750
  }
723
751
  },
724
752
 
@@ -1,6 +1,6 @@
1
1
  /* @flow */
2
- import { supportsPopups as userAgentSupportsPopups, isAndroid, isChrome, isIos, isSafari, isSFVC, type Experiment, isDevice, isTablet, getElement, isLocalStorageEnabled } from '@krakenjs/belter/src';
3
- import { COUNTRY, CURRENCY, ENV, FPTI_KEY, FUNDING, type LocaleType } from '@paypal/sdk-constants/src';
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';
4
4
  import { getEnableFunding, getDisableFunding, getLogger, createExperiment, getFundingEligibility, getPlatform, getComponents, getEnv, type FundingEligibilityType } from '@paypal/sdk-client/src';
5
5
  import { getRefinedFundingEligibility } from '@paypal/funding-components/src';
6
6
 
@@ -15,6 +15,28 @@ type DetermineFlowOptions = {|
15
15
  createSubscription : CreateSubscription
16
16
  |};
17
17
 
18
+ /**
19
+ * log information about screen to debug. currently in use to test if sfvc logic triggers
20
+ *
21
+ * @param {string} key for logging
22
+ */
23
+ const logNativeScreenInformation = once((key = 'screenInformation') => {
24
+ if (window) {
25
+ const height = window.innerHeight;
26
+ const outerHeight = window.outerHeight;
27
+ const scale = Math.round(window.screen.width / window.innerWidth * 100) / 100;
28
+ const computedHeight = Math.round(height * scale);
29
+ const ios14 = isIOS14();
30
+ const standAlone = isStandAlone();
31
+
32
+ const screenInformation = { computedHeight, height, ios14, outerHeight, scale, standAlone };
33
+
34
+ getLogger()
35
+ // $FlowFixMe - object is mixed values when this expects all of the same value types
36
+ .info(key, screenInformation)
37
+ }
38
+ });
39
+
18
40
  export function determineFlow(props : DetermineFlowOptions) : $Values<typeof BUTTON_FLOW> {
19
41
 
20
42
  if (props.createBillingAgreement) {
@@ -36,6 +58,7 @@ export function isSupportedNativeBrowser() : boolean {
36
58
  }
37
59
 
38
60
  if (isSFVC()) {
61
+ logNativeScreenInformation('sfvcScreenInformation');
39
62
  return false;
40
63
  }
41
64
 
@@ -324,12 +347,5 @@ export function isInlineXOEligible({ props } : {| props : InlineCheckoutEligibil
324
347
  vault === false
325
348
  );
326
349
 
327
- getLogger()
328
- .info('isInlineXOEligible props', { props: JSON.stringify(props) })
329
- .info('isInlineXOEligible eligible', { eligible: String(isEligible) })
330
- .track({
331
- [ FPTI_KEY.TRANSITION ]: `inline_xo_eligibility_${ String(isEligible) }`
332
- }).flush();
333
-
334
350
  return isEligible;
335
351
  }