@paypal/checkout-components 5.0.227 → 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,9 @@
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
+
1
7
  ## <small>5.0.227 (2022-06-10)</small>
2
8
 
3
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)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paypal/checkout-components",
3
- "version": "5.0.227",
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';
@@ -711,7 +712,7 @@ export const getButtonsComponent : () => ButtonsComponent = memoize(() => {
711
712
  }
712
713
  }
713
714
 
714
- return inlineCheckoutEligibility && inlineCheckoutEligibility.eligible && alphaEligible && isInlineXOEligible({ props: {
715
+ const eligible = inlineCheckoutEligibility && inlineCheckoutEligibility.eligible && alphaEligible && isInlineXOEligible({ props: {
715
716
  commit,
716
717
  createBillingAgreement,
717
718
  currency,
@@ -720,7 +721,32 @@ export const getButtonsComponent : () => ButtonsComponent = memoize(() => {
720
721
  layout,
721
722
  locale,
722
723
  vault
723
- } }) ? 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 '';
724
750
  }
725
751
  },
726
752
 
@@ -1,6 +1,6 @@
1
1
  /* @flow */
2
- import { supportsPopups as userAgentSupportsPopups, isAndroid, isChrome, isIos, isIOS14, isSafari, isSFVC, type Experiment, isDevice, isTablet, getElement, isLocalStorageEnabled, isStandAlone } 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
 
@@ -20,7 +20,7 @@ type DetermineFlowOptions = {|
20
20
  *
21
21
  * @param {string} key for logging
22
22
  */
23
- function logNativeScreenInformation(key = 'screenInformation') {
23
+ const logNativeScreenInformation = once((key = 'screenInformation') => {
24
24
  if (window) {
25
25
  const height = window.innerHeight;
26
26
  const outerHeight = window.outerHeight;
@@ -35,7 +35,7 @@ function logNativeScreenInformation(key = 'screenInformation') {
35
35
  // $FlowFixMe - object is mixed values when this expects all of the same value types
36
36
  .info(key, screenInformation)
37
37
  }
38
- }
38
+ });
39
39
 
40
40
  export function determineFlow(props : DetermineFlowOptions) : $Values<typeof BUTTON_FLOW> {
41
41
 
@@ -347,12 +347,5 @@ export function isInlineXOEligible({ props } : {| props : InlineCheckoutEligibil
347
347
  vault === false
348
348
  );
349
349
 
350
- getLogger()
351
- .info('isInlineXOEligible props', { props: JSON.stringify(props) })
352
- .info('isInlineXOEligible eligible', { eligible: String(isEligible) })
353
- .track({
354
- [ FPTI_KEY.TRANSITION ]: `inline_xo_eligibility_${ String(isEligible) }`
355
- }).flush();
356
-
357
350
  return isEligible;
358
351
  }