@paypal/checkout-components 5.0.424 → 5.0.426-alpha-0439778.0

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.424",
3
+ "version": "5.0.426-alpha-0439778.0",
4
4
  "description": "PayPal Checkout components, for integrating checkout products.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/types.js CHANGED
@@ -70,6 +70,7 @@ export type Experiment = {|
70
70
  paypalCreditButtonCreateVaultSetupTokenExists?: boolean,
71
71
  isPaylaterCobrandedLabelEnabled?: boolean,
72
72
  isPaylaterCobrandedLabelRandomizationEnabled?: boolean,
73
+ isBfcacheEnabled?: boolean,
73
74
  |};
74
75
 
75
76
  export type Requires = {|
@@ -107,9 +107,9 @@ import {
107
107
  getButtonSize,
108
108
  getButtonExperiments,
109
109
  getModal,
110
- sendPostRobotMessageToButtonIframe,
111
110
  isEagerOrderCreationEnabled,
112
111
  resolveMerchantDomain,
112
+ sendPostRobotMessageToButtonIframe,
113
113
  } from "./util";
114
114
 
115
115
  export type ButtonsComponent = ZoidComponent<
@@ -129,6 +129,8 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
129
129
  url: () => `${getPayPalDomain()}${__PAYPAL_CHECKOUT__.__URI__.__BUTTONS__}`,
130
130
 
131
131
  domain: getPayPalDomainRegex(),
132
+ enableBfcache: Boolean(getButtonExperiments()?.isBfcacheEnabled),
133
+
132
134
  getExtensions: (parent) => {
133
135
  return {
134
136
  hasReturned: () => {
@@ -472,6 +474,20 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
472
474
  },
473
475
  },
474
476
 
477
+ onBfcacheRestore: {
478
+ type: "function",
479
+ sendToChild: false,
480
+ queryParam: false,
481
+ value:
482
+ () =>
483
+ ({ cachedDurationMs } = {}) => {
484
+ sendPostRobotMessageToButtonIframe({
485
+ eventName: "bfcache_restore",
486
+ payload: { cachedDurationMs },
487
+ });
488
+ },
489
+ },
490
+
475
491
  // allowBillingPayments prop is used by Honey Extension to render the one-click button
476
492
  // with payment methods & to use the payment methods instead of the Billing Agreement
477
493
  allowBillingPayments: {
@@ -411,6 +411,7 @@ export const sendPostRobotMessageToButtonIframe = ({
411
411
  if (iframes[i].name.includes("zoid__paypal_buttons")) {
412
412
  postRobotSend(iframes[i].contentWindow, eventName, payload, {
413
413
  domain: getPayPalDomain(),
414
+ fireAndForget: true,
414
415
  });
415
416
  }
416
417
  }
@@ -55,6 +55,8 @@ export function getCheckoutComponent(): CheckoutComponent {
55
55
  },
56
56
  },
57
57
 
58
+ enableBfcache: false,
59
+
58
60
  defaultContext: supportsPopups() ? CONTEXT.POPUP : CONTEXT.IFRAME,
59
61
 
60
62
  domain: getPayPalDomainRegex(),