Skip to content

Add PayPal App Switch Overlay #2484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 15, 2025
Merged

Conversation

nikrom17
Copy link
Contributor

@nikrom17 nikrom17 commented Apr 1, 2025

Description

We need a new overlay for the new flow PayPal App Switch

Why are we making these changes? Include references to any related Jira tasks or GitHub Issues

https://paypal.atlassian.net/browse/DTPPCPSDK-2897

Reproduction Steps (if applicable)

Screenshots (if applicable)

PayPal.App.Switch.Overlay.mov

Dependent Changes (if applicable)

Groups who should review (if applicable)

❤️ Thank you!

@nikrom17 nikrom17 requested a review from a team as a code owner April 1, 2025 17:13
Copy link
Contributor

@ravishekhar ravishekhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good apart from the one comment 👍

@@ -501,6 +501,15 @@ export type ButtonExtensions = {|
resume: () => void,
|};

type ShowPayPalAppSwitchOverlay = {|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also need to accept the universal link to render the continue link to app.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added that logic in the focus function in setupOverlays

I can update the focus function to take the args props.redirect & url.href and call props.redirect(url.href) from inside the overlay component

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ravishekhar , I attempted a solution that took the url as an argument and ran into issues running the karma tests with the redirect call now being a part of overlay.jsx

With the Karma framework, there is no way to mock location.href or location.redirect. When the redirect is called, the karma test runner is interrupted and the tests fail.

}
} catch {
// an error will be thrown if the overlay is not found, which means overlay was removed successfully
done();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this line have a done() inside the catch, while line 188 doesn't?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getElementRecursive(".paypal-checkout-sandbox") will return an error if it does not find what it is looking for. For this test, I am expecting no overlay to be found so I want the done condition to be called in the catch statement.

Copy link
Contributor

@ravishekhar ravishekhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on offline discussions we will be taking up the changes to refactor the postMessage passing between SDK and Buttons as a followup PR.

@nikrom17 nikrom17 merged commit 8980daa into main Apr 15, 2025
3 checks passed
@nikrom17 nikrom17 deleted the feature/paypal-app-switch-overlay branch April 15, 2025 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants