@paypal/checkout-components 5.0.320 → 5.0.321

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.320",
3
+ "version": "5.0.321",
4
4
  "description": "PayPal Checkout components, for integrating checkout products.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -2,6 +2,8 @@
2
2
 
3
3
  export const CLASS = {
4
4
  CONTAINER: ("paypal-button-container": "paypal-button-container"),
5
+ AUTORESIZE_CONTAINER:
6
+ ("paypal-autoresize-container": "paypal-autoresize-container"),
5
7
  BUTTON_ROW: ("paypal-button-row": "paypal-button-row"),
6
8
  BUTTON: ("paypal-button": "paypal-button"),
7
9
  BUTTON_LABEL:
@@ -259,6 +259,7 @@ export function Buttons(props: ButtonsProps): ElementNode {
259
259
  <div
260
260
  class={[
261
261
  CLASS.CONTAINER,
262
+ CLASS.AUTORESIZE_CONTAINER,
262
263
  `${CLASS.LAYOUT}-${layout}`,
263
264
  `${CLASS.SHAPE}-${shape}`,
264
265
  `${CLASS.NUMBER}-${
@@ -55,7 +55,6 @@ import {
55
55
  isApplePaySupported,
56
56
  supportsPopups as userAgentSupportsPopups,
57
57
  noop,
58
- isLocalStorageEnabled,
59
58
  } from "@krakenjs/belter/src";
60
59
  import {
61
60
  FUNDING,
@@ -80,6 +79,7 @@ import {
80
79
  type ButtonProps,
81
80
  } from "../../ui/buttons/props";
82
81
  import { isFundingEligible } from "../../funding";
82
+ import { CLASS } from "../../constants";
83
83
 
84
84
  import { containerTemplate } from "./container";
85
85
  import { PrerenderedButtons } from "./prerender";
@@ -107,6 +107,7 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
107
107
  autoResize: {
108
108
  width: false,
109
109
  height: true,
110
+ element: `.${CLASS.AUTORESIZE_CONTAINER}`,
110
111
  },
111
112
 
112
113
  containerTemplate,
@@ -122,18 +123,6 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
122
123
  prerenderTemplate: ({ state, props, doc, event }) => {
123
124
  const { buttonSessionID } = props;
124
125
 
125
- if (!isLocalStorageEnabled()) {
126
- getLogger()
127
- .info("localstorage_inaccessible_possible_private_browsing")
128
- .track({
129
- [FPTI_KEY.BUTTON_SESSION_UID]: buttonSessionID,
130
- [FPTI_KEY.CONTEXT_TYPE]: "button_session_id",
131
- [FPTI_KEY.CONTEXT_ID]: buttonSessionID,
132
- [FPTI_KEY.TRANSITION]:
133
- "localstorage_inaccessible_possible_private_browsing",
134
- });
135
- }
136
-
137
126
  event.on(EVENT.PRERENDERED, () => {
138
127
  // CPL stands for Consumer Perceived Latency
139
128
  logLatencyInstrumentationPhase({
@@ -149,17 +138,13 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
149
138
  [FPTI_KEY.PAGE]: "main:xo:paypal-components:smart-payment-buttons",
150
139
  [FPTI_KEY.CPL_COMP_METRICS]: JSON.stringify(cplPhases?.comp || {}),
151
140
  };
152
- getLogger()
153
- .info("CPL_LATENCY_METRICS_FIRST_RENDER")
154
- .track(cplLatencyMetrics);
141
+ getLogger().track(cplLatencyMetrics);
155
142
  } catch (err) {
156
- getLogger()
157
- .info("button_render_CPL_instrumentation_log_error")
158
- .track({
159
- err: err.message || "CPL_LOG_PHASE_ERROR",
160
- details: err.details,
161
- stack: JSON.stringify(err.stack || err),
162
- });
143
+ getLogger().track({
144
+ err: err.message || "CPL_LOG_PHASE_ERROR",
145
+ details: err.details,
146
+ stack: JSON.stringify(err.stack || err),
147
+ });
163
148
  }
164
149
  });
165
150
 
@@ -49,15 +49,18 @@ export function PrerenderedButtons({
49
49
  |}
50
50
  ) => {
51
51
  getLogger()
52
- .info("button_prerender_click")
52
+ .info("paypal_js_sdk_v5_button_prerender_click", {
53
+ fundingSource,
54
+ card,
55
+ buttonsSessionID: props.buttonSessionID,
56
+ })
53
57
  .track({
54
58
  [FPTI_KEY.BUTTON_SESSION_UID]: props.buttonSessionID,
55
59
  [FPTI_KEY.CONTEXT_TYPE]: "button_session_id",
56
60
  [FPTI_KEY.CONTEXT_ID]: props.buttonSessionID,
57
61
  [FPTI_KEY.TRANSITION]: "process_button_prerender_click",
58
62
  [FPTI_KEY.CHOSEN_FUNDING]: fundingSource,
59
- })
60
- .flush();
63
+ });
61
64
 
62
65
  if (fundingSource === FUNDING.VENMO || fundingSource === FUNDING.APPLEPAY) {
63
66
  // wait for button to load
@@ -50,7 +50,7 @@ type DetermineFlowOptions = {|
50
50
  *
51
51
  * @param {string} key for logging
52
52
  */
53
- const logNativeScreenInformation = once((key = "screenInformation") => {
53
+ const logNativeScreenInformation = once(() => {
54
54
  if (window) {
55
55
  const height = window.innerHeight;
56
56
  const outerHeight = window.outerHeight;
@@ -60,18 +60,16 @@ const logNativeScreenInformation = once((key = "screenInformation") => {
60
60
  const ios14 = isIOS14();
61
61
  const standAlone = isStandAlone();
62
62
 
63
- const screenInformation = {
64
- computedHeight,
65
- height,
66
- ios14,
67
- outerHeight,
68
- scale,
69
- standAlone,
70
- };
71
-
72
63
  getLogger()
73
64
  // $FlowFixMe - object is mixed values when this expects all of the same value types
74
- .info(key, screenInformation);
65
+ .info("sfvcScreenInformation", {
66
+ computedHeight,
67
+ height,
68
+ ios14,
69
+ outerHeight,
70
+ scale,
71
+ standAlone,
72
+ });
75
73
  }
76
74
  });
77
75
 
@@ -90,7 +88,7 @@ export function determineFlow(
90
88
  }
91
89
 
92
90
  export function isSupportedNativeBrowser(): boolean {
93
- logNativeScreenInformation("sfvcScreenInformation");
91
+ logNativeScreenInformation();
94
92
 
95
93
  if (typeof window === "undefined") {
96
94
  return false;