@paypal/checkout-components 5.0.421 → 5.0.422-alpha-532f0ce.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.421",
3
+ "version": "5.0.422-alpha-532f0ce.0",
4
4
  "description": "PayPal Checkout components, for integrating checkout products.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -94,7 +94,7 @@ import {
94
94
  isSupportedNativeVenmoBrowser,
95
95
  } from "../../funding/util";
96
96
  import { getPixelComponent } from "../pixel";
97
- import { CLASS } from "../../constants";
97
+ import { CLASS, APP_SWITCH_RETURN_HASH } from "../../constants";
98
98
  import { PayPalAppSwitchOverlay } from "../../ui/overlay/paypal-app-switch/overlay";
99
99
 
100
100
  import { containerTemplate } from "./container";
@@ -138,6 +138,29 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
138
138
  if (!resumeFlowParams) {
139
139
  throw new Error("Resume Flow is not supported.");
140
140
  }
141
+
142
+ // For cancel flows, call onCancel directly without the pixel iframe.
143
+ // This avoids a round-trip network request and fires synchronously,
144
+ // preserving responsiveness on Android after a full-page reload cancel.
145
+ if (resumeFlowParams.checkoutState === APP_SWITCH_RETURN_HASH.ONCANCEL) {
146
+ getLogger().metricCounter({
147
+ namespace: "resume_flow.cancel.count",
148
+ event: "info",
149
+ dimensions: {
150
+ orderID: Boolean(resumeFlowParams.orderID),
151
+ },
152
+ });
153
+ const parentProps = parent.getProps();
154
+ // $FlowIgnore[prop-missing] onCancel is incorrectly declared as oncancel in button props
155
+ if (typeof parentProps.onCancel === "function") {
156
+ return parentProps.onCancel(
157
+ { orderID: resumeFlowParams.orderID },
158
+ {}
159
+ );
160
+ }
161
+ return;
162
+ }
163
+
141
164
  getLogger().metricCounter({
142
165
  namespace: "resume_flow.init.count",
143
166
  event: "info",