@paypal/checkout-components 5.0.360 → 5.0.361-alpha-3852179.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.360",
3
+ "version": "5.0.361-alpha-3852179.0",
4
4
  "description": "PayPal Checkout components, for integrating checkout products.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -112,11 +112,9 @@ export type ButtonsComponent = ZoidComponent<
112
112
  ButtonExtensions
113
113
  >;
114
114
 
115
- // $FlowIssue
116
115
  export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
117
116
  const queriedEligibleFunding = [];
118
117
 
119
- // $FlowIssue
120
118
  return create({
121
119
  tag: "paypal-buttons",
122
120
  url: () => `${getPayPalDomain()}${__PAYPAL_CHECKOUT__.__URI__.__BUTTONS__}`,
@@ -125,7 +123,10 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
125
123
  getExtensions: (parent) => {
126
124
  return {
127
125
  hasReturned: () => {
128
- return isAppSwitchResumeFlow();
126
+ return (
127
+ isAppSwitchResumeFlow() &&
128
+ !parent.getHelpers()?.state?.appSwitchState
129
+ );
129
130
  },
130
131
  resume: () => {
131
132
  const resumeFlowParams = getAppSwitchResumeParams();
@@ -356,22 +357,28 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
356
357
  type: "function",
357
358
  sendToChild: false,
358
359
  queryParam: false,
359
- value: () => (event) => {
360
- sendPostRobotMessageToButtonIframe({
361
- eventName: "paypal-hashchange",
362
- payload: {
363
- url: event.newURL,
364
- },
365
- });
366
- },
360
+ value:
361
+ ({ state }) =>
362
+ (event) => {
363
+ state.appSwitchState = "returned";
364
+
365
+ sendPostRobotMessageToButtonIframe({
366
+ eventName: "paypal-hashchange",
367
+ payload: {
368
+ url: event.newURL,
369
+ },
370
+ });
371
+ },
367
372
  },
368
373
 
369
374
  listenForHashChanges: {
370
375
  type: "function",
371
376
  queryParam: false,
372
377
  value:
373
- ({ props }) =>
378
+ ({ props, state }) =>
374
379
  () => {
380
+ state.appSwitchState = "pending";
381
+
375
382
  window.addEventListener("hashchange", props.hashChangeHandler);
376
383
  },
377
384
  },
@@ -390,24 +397,29 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
390
397
  type: "function",
391
398
  sendToChild: false,
392
399
  queryParam: false,
393
- value: () => () => {
394
- sendPostRobotMessageToButtonIframe({
395
- eventName: "paypal-visibilitychange",
396
- payload: {
397
- url: window.location.href,
400
+ value:
401
+ ({ state }) =>
402
+ () => {
403
+ state.appSwitchState = "returned";
398
404
 
399
- visibilityState: document.visibilityState,
400
- },
401
- });
402
- },
405
+ sendPostRobotMessageToButtonIframe({
406
+ eventName: "paypal-visibilitychange",
407
+ payload: {
408
+ url: window.location.href,
409
+ visibilityState: document.visibilityState,
410
+ },
411
+ });
412
+ },
403
413
  },
404
414
 
405
415
  listenForVisibilityChange: {
406
416
  type: "function",
407
417
  queryParam: false,
408
418
  value:
409
- ({ props }) =>
419
+ ({ props, state }) =>
410
420
  () => {
421
+ state.appSwitchState = "pending";
422
+
411
423
  window.addEventListener(
412
424
  "visibilitychange",
413
425
  props.visibilityChangeHandler