-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Added feature for payment gateways banner #32697
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
Conversation
cd644f3 to
bbb1af4
Compare
This reverts commit 1a7c403.
38059c9 to
6151f40
Compare
|
|
||
| const WcPayBanner = () => { | ||
| const WC_PAY_SETUP_URL = | ||
| './admin.php?page=wc-settings&tab=checkout§ion=woocommerce_payments'; |
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.
I think we could use getAdminLink here:
woocommerce/plugins/woocommerce-admin/client/tasks/fills/products/products.js
Lines 64 to 66 in feba6a8
| href: getAdminLink( | |
| 'post-new.php?post_type=product&wc_onboarding_active_task=products&tutorial=true' | |
| ), |
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.
Hmm... that's new to me... however I can't actually find the source for @woocommerce/settings and the only mention I've seen of it is in the changelog where it says its been removed
How does this work? 👀👀👀
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.
Hmm...I think it's still injected into our code via the Dependency Extraction Webpack Plugin, though I also don't know how it exactly works.
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.
however I can't actually find the source for @woocommerce/settings and the only mention I've seen of it is in the changelog where it says its been removed
The settings package used to be under WCAdmin, but now lives in blocks https://github.com/woocommerce/woocommerce-gutenberg-products-block/tree/trunk/assets/js/settings/shared
P2: p90Yrv-2B5-p2
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.
Changed in 3ee2fca
| Discover, | ||
| JCB, | ||
| UnionPay, | ||
| } from './cards'; |
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.
Nice work for refactoring this!
| }; | ||
| } ); | ||
|
|
||
| const supportsWCPayments = |
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.
Looks like payment-recommendations.tsx also has the same code. How about creating a util function for this?
woocommerce/plugins/woocommerce-admin/client/payments/payment-recommendations.tsx
Lines 84 to 94 in 6151f40
| const supportsWCPayments = | |
| paymentGatewaySuggestions && | |
| paymentGatewaySuggestions.filter( | |
| ( paymentGatewaySuggestion: Plugin ) => { | |
| return ( | |
| paymentGatewaySuggestion.id.indexOf( | |
| 'woocommerce_payments' | |
| ) === 0 | |
| ); | |
| } | |
| ).length === 1; |
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.
Yea good call! I was planning to extract the entire hook and everything but ended up realising I only needed a small part of the useSelect and forgot that there was this part below that's duplicated
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.
Updated in 11f321a
chihsuan
left a comment
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.
Tested well on my local for all scenarios. 👍 Just left some suggestions.
ilyasfoo
left a comment
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.
Tested well for me. Great work, @rjchow! The only thing left I think is to finalize the experiment name if we intend to do it dynamically.
| ); | ||
|
|
||
| const [ isLoadingExperiment, experimentAssignment ] = useExperiment( | ||
| 'woocommerce_payments_settings_banner_2022_04' |
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.
I think this is meant to be a dynamic experiment? If so, we should use dynamic month & year
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.
Done in 2398fdf
|
I'll be working on my own feedback soon. @chihsuan, would you like to address your feedback as well or would you think it's better to address it as a follow-up? |
|
@ilyasfoo I think we need to dismiss your review to merge? 🤔 |
Sounds good!
Oops sorry missed this, I've approved it instead! |
|
@adrianduffell do you think we should attempt to merge from trunk to see if it fixes checks? Or should we just merge it anyway? |
@ilyasfoo Ah yep, I think we should run the checks. I'll push a commit with the merge from trunk. |
|
Looks like the e2e tests are failing on the payments settings screen. I'll take a closer look tomorrow. |
|
@adrianduffell I think that may be related to the "Payment Methods" header missing. I'll take a look instead, I suspect changing it to detect its table is better as RJ suggested |
|
I think I've fixed e2e with d947699, but it seems some checks are failing due to unrelated errors. I'm not sure yet what it is, but it may have come with merge from |
|
Checks are successful now, merging |
|
Hi @ilyasfoo, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:
|
All Submissions:
Changes proposed in this Pull Request:
This PR makes a set of changes in order to implement the feature for a payment gateways banner.
There were two possible approaches to implement this - fully in PHP and the other to embed a React tree on a new element that is introduced on the PHP side.
The decision was made to embed a React tree for ease of future maintenance, and also to make the new mount point an experimental Slotfill so that we can add future items to it.
Explat post: pbxNRc-1yD-p2
Closes #32414 .
Control:
Treatment:
How to test the changes in this Pull Request:
There are 5 scenarios to test:
Other information:
pnpm nx affected --target=changelog?FOR PR REVIEWER ONLY: