Skip to content
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

Add 'redirectFromTop' config prop to allow top level redirect when Checkout loaded in an iframe #2325

Merged
merged 2 commits into from
Sep 11, 2023

Conversation

sponglord
Copy link
Contributor

@sponglord sponglord commented Sep 11, 2023

Summary

If the merchant is running their site within an iframe*, they can now specify a redirectFromTopWhenInIframe boolean in the Checkout config.
Then, if we end up with a Redirect action, we check for ourselves if the site is running in an iframe and, if it is, and redirectFromTopWhenInIframe is set to true, then we will attempt to perform the redirect on the top level, parent, window rather than the window holding the iframe

*Caveat: We don't recommend the use of iframes for hosting Checkout. We cannot guarantee that all payment methods will work when inside an iframe (ApplePay, GooglePay etc). Nor can we guarantee that pages outside of our control e.g. Issuer created pages that are part of the 3DS2 process, will perform correctly.

Tested scenarios

Manually tested that both form submits and window.location.assign happen on the top level window when checkout hosted in an iframe and redirectFromTopWhenInIframe is set to true.
New unit test added.

Fixed issue: #2316

@changeset-bot
Copy link

changeset-bot bot commented Sep 11, 2023

🦋 Changeset detected

Latest commit: 19b6c8c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@adyen/adyen-web Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Sep 11, 2023

Size Change: +420 B (0%)

Total Size: 1.07 MB

Filename Size Change
packages/lib/dist/adyen.js 283 kB +105 B (0%)
packages/lib/dist/cjs/index.js 245 kB +105 B (0%)
packages/lib/dist/es.modern/index.js 118 kB +103 B (0%)
packages/lib/dist/es/index.js 138 kB +107 B (0%)
ℹ️ View Unchanged
Filename Size
packages/lib/dist/es.modern/ar.js 6.41 kB
packages/lib/dist/es.modern/cs-CZ.js 5.79 kB
packages/lib/dist/es.modern/da-DK.js 5.27 kB
packages/lib/dist/es.modern/de-DE.js 5.66 kB
packages/lib/dist/es.modern/el-GR.js 7.29 kB
packages/lib/dist/es.modern/es-ES.js 5.36 kB
packages/lib/dist/es.modern/fi-FI.js 5.35 kB
packages/lib/dist/es.modern/fr-FR.js 5.47 kB
packages/lib/dist/es.modern/hr-HR.js 5.49 kB
packages/lib/dist/es.modern/hu-HU.js 5.78 kB
packages/lib/dist/es.modern/it-IT.js 5.34 kB
packages/lib/dist/es.modern/ja-JP.js 6.18 kB
packages/lib/dist/es.modern/ko-KR.js 5.78 kB
packages/lib/dist/es.modern/nl-NL.js 5.37 kB
packages/lib/dist/es.modern/no-NO.js 5.25 kB
packages/lib/dist/es.modern/pl-PL.js 5.76 kB
packages/lib/dist/es.modern/pt-BR.js 5.32 kB
packages/lib/dist/es.modern/pt-PT.js 5.45 kB
packages/lib/dist/es.modern/ro-RO.js 5.58 kB
packages/lib/dist/es.modern/ru-RU.js 6.76 kB
packages/lib/dist/es.modern/sk-SK.js 5.85 kB
packages/lib/dist/es.modern/sl-SI.js 5.43 kB
packages/lib/dist/es.modern/sv-SE.js 5.23 kB
packages/lib/dist/es.modern/zh-CN.js 5.62 kB
packages/lib/dist/es.modern/zh-TW.js 5.74 kB
packages/lib/dist/es/ar.js 6.41 kB
packages/lib/dist/es/cs-CZ.js 5.79 kB
packages/lib/dist/es/da-DK.js 5.27 kB
packages/lib/dist/es/de-DE.js 5.66 kB
packages/lib/dist/es/el-GR.js 7.29 kB
packages/lib/dist/es/es-ES.js 5.36 kB
packages/lib/dist/es/fi-FI.js 5.35 kB
packages/lib/dist/es/fr-FR.js 5.47 kB
packages/lib/dist/es/hr-HR.js 5.49 kB
packages/lib/dist/es/hu-HU.js 5.78 kB
packages/lib/dist/es/it-IT.js 5.34 kB
packages/lib/dist/es/ja-JP.js 6.18 kB
packages/lib/dist/es/ko-KR.js 5.78 kB
packages/lib/dist/es/nl-NL.js 5.37 kB
packages/lib/dist/es/no-NO.js 5.25 kB
packages/lib/dist/es/pl-PL.js 5.76 kB
packages/lib/dist/es/pt-BR.js 5.32 kB
packages/lib/dist/es/pt-PT.js 5.45 kB
packages/lib/dist/es/ro-RO.js 5.58 kB
packages/lib/dist/es/ru-RU.js 6.76 kB
packages/lib/dist/es/sk-SK.js 5.85 kB
packages/lib/dist/es/sl-SI.js 5.43 kB
packages/lib/dist/es/sv-SE.js 5.23 kB
packages/lib/dist/es/zh-CN.js 5.62 kB
packages/lib/dist/es/zh-TW.js 5.74 kB

compressed-size-action

@sonarcloud
Copy link

sonarcloud bot commented Sep 11, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

36.4% 36.4% Coverage
0.0% 0.0% Duplication

@sponglord sponglord merged commit 0f5f834 into main Sep 11, 2023
10 checks passed
@sponglord sponglord deleted the feature/allow_redirect_from_top_window branch September 11, 2023 13:49
@github-actions github-actions bot mentioned this pull request Sep 11, 2023
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.

2 participants