-
Notifications
You must be signed in to change notification settings - Fork 136
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
POC: Tree shaking with new operator #2323
Merged
ribeiroguilherme
merged 140 commits into
v6
from
poc/component-tree-shaking-new-operator-v2
Oct 18, 2023
Merged
POC: Tree shaking with new operator #2323
ribeiroguilherme
merged 140 commits into
v6
from
poc/component-tree-shaking-new-operator-v2
Oct 18, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…e new keyword. No checkout.create fn called
…sing createFromAction
…igned isAvailable
ribeiroguilherme
requested review from
marcperez,
pabloai,
sponglord,
m1aw and
longyulongyu
as code owners
October 17, 2023 14:16
sponglord
approved these changes
Oct 17, 2023
SonarCloud Quality Gate failed. 6 Bugs 85.0% Coverage Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
ribeiroguilherme
deleted the
poc/component-tree-shaking-new-operator-v2
branch
October 18, 2023 10:17
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
In order to support tree shaking, we need to slightly change how merchants integrate with us.
Importing AdyenCheckout and Components
@adyen/adyen-web/auto
, which will have all Components registered internally by default.That means that there is no need to pass
paymentMethodComponents
property to Drop-in@adyen/adyen-web
:checkoutshopper
, theAdyenWeb
will be assigned to the window. The merchant can access it to pick up the required classes:Translations
All translations are being exported now. The library itself fallback to
en-US
forlocale
property, and it will always useen-US
translations as fallback mechanism.If any other language is desired, then it needs to be imported and passed to the library in the
translationFile
parameter:Creating Components
Components now are created using their own classes with the
new
keyword:Drop-in (tree shakeable way)
Card:
Standalone Redirect:
Tested scenarios
Testing using local playground:
yarn && yarn build && yarn start
Testing ESM with tree shaking: (All commands must be used within Vagrant)
yarn build
npm pack
to generate the tarball fileadyen-web
project, and extract the tarball file in that folder;package.json
and remove the script tasksprepublishOnly
andprepare
from itnpm link
npm link "@adyen/adyen-web"
. This will link the adyen-web library to the folder that you just creatednew
instead ofcheckout.create
. etc..). Check that everything works finepackage.json
: "analyze": "source-map-explorer 'dist/*.js' --html report.html"yarn build && yarn analyze
- it will build the project and then analyze the bundle, creating the report.html file where you can visualize the bundle files