-
Notifications
You must be signed in to change notification settings - Fork 69
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
refactor: separate BNPL methods from settings list #9268
refactor: separate BNPL methods from settings list #9268
Conversation
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
<SettingsSection | ||
description={ PaymentMethodsDescription } | ||
id="payment-methods" | ||
> | ||
<LoadableSettingsSection numLines={ 60 }> | ||
<ErrorBoundary> | ||
<PaymentMethods /> | ||
</ErrorBoundary> | ||
</LoadableSettingsSection> | ||
</SettingsSection> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved into the PaymentMethodsSection
component.
Size Change: +1.19 kB (0%) Total Size: 1.32 MB
ℹ️ View Unchanged
|
@@ -0,0 +1,205 @@ | |||
/** @format */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is basically the old client/payment-methods/index.js
component, but modified to accept a methodIds
props - an array that represents the payment methods to render.
They could be BNPL methods on the good ol' UPE methods.
@@ -39,7 +39,7 @@ import CurrencyInformationForMethods from './currency-information-for-methods'; | |||
import { getMissingCurrenciesTooltipMessage } from 'wcpay/multi-currency/missing-currencies-message'; | |||
import { upeCapabilityStatuses, upeMethods } from '../constants'; | |||
import paymentMethodsMap from '../../payment-methods-map'; | |||
import ConfirmPaymentMethodActivationModal from 'wcpay/payment-methods/activation-modal'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unfortunate that this add-payment-methods-task
component needs to tap into another component's directory.
It was like this before, and it still is the case.
If I were to refactor it too, this would have been a much larger PR (on top of all the other changes that preceded it in #9261 #9265 #9255 #9262 #9260 ).
re-assigning after talking with @gpressutto5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One very minor nitpick that was probably there when you started, but this looks good and works as described!
Fixes #8248
Changes proposed in this Pull Request
Separating BNPLs into their own section in the settings.
They're already separate in onboarding, so this should be the only area they need to be separated.
The component rendering the list of payment methods (
client/payment-methods/index.js
) has some specific logic to show a modal on deletion, show duplicate payment method information, and do some other business logic.I wanted to ensure we could render the payment methods in two section using the same component, without duplicating the logic.
So I made the
client/payment-methods/index.js
component "reusable" by passing a list of payment methods to render. I moved it toclient/settings/payment-methods-list/index.js
. And I wrapped it by the newly createdBuyNowPayLaterSection
andPaymentMethodsSection
.There's some files moved around (mainly everything from
client/payment-methods
moved toclient/settings/payment-methods-list
). So that's why there's lots of changes.After:
Testing instructions
npm run changelog
to add a changelog file, choosepatch
to leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge