Subscriptions Wizard#64
Conversation
| font-style: normal; | ||
| margin-top: 0; | ||
| color: $muriel-gray-600; | ||
| } |
There was a problem hiding this comment.
Bug fix: The help prop was unstyled for our checkboxes, causing it to go under the checkbox which looked ugly. I've added styling for it to make it look like our designs.
|
|
||
| return ( | ||
| <BaseComponent | ||
| value={ value } |
There was a problem hiding this comment.
Bug fix: Since value was extracted from props above, it wasn't getting passed to BaseComponent, meaning you couldn't properly set a value on selects. I've not investigated whether the same issue happens for disabled, but it likely has the same problem. cc @iuravic
| } | ||
|
|
||
| input[type="text"] { | ||
| input[type="text"], input[type="number"] { |
There was a problem hiding this comment.
Bug fix: number inputs were not getting our styles.
| parent::__construct(); | ||
|
|
||
| add_action( 'rest_api_init', [ $this, 'register_api_endpoints' ] ); | ||
| add_filter( 'woocommerce_product_data_store_cpt_get_products_query', [ $this, 'handle_only_get_newspack_subscriptions_query' ], 10, 2 ); |
There was a problem hiding this comment.
The Subscriptions Wizard only displays and manages products created through the Subscriptions Wizard. I think that's the way to go because it would be super confusing/breaking if we pulled in swag or other such products. This should keep things working nicely.
| <rule ref="PHPCompatibilityWP"/> | ||
| <config name="testVersion" value="5.6-"/> | ||
|
|
||
| <arg name="extensions" value="php,js"/> |
There was a problem hiding this comment.
Tweak: I've removed the js check from phpcs.xml because phpcs freaks out on React code and thinks that e.g. <div> is using greater/less-than operators, so it generates hundreds of style errors. Additionally, now that we have prettier working, we probably don't need this. We can re-approach after this is merged if we want to add it back.
philipjohn
left a comment
There was a problem hiding this comment.
I've not looked at the code yet but have loaded the branch up locally in order to test the user experience first of all, and have some feedback to share mainly on that.
First though, can we split the demo stuff out? I feel like it muddies this PR because it's not just the Subscriptions wizard. Can we instead split out the demo stuff into a separate branch to work on it there?
Also, a relatively minor point - it's best to be descriptive with branch names because something like add/53 means very little to someone coming in from outside, or in the future, and looking at commits. I like having the issue number and often used a format like add/[issue-no]_[description].
The "I'm done adding" link doesn't seem to do anything and feels unnecessary, can we do without it?
I added a name ("Understand") and amount ("12") and clicked "Save" but nothing happened. It looked like it may be because I didn't have pretty permalinks (something we need to catch) but even after applying them, I see this when trying to save:
POST http://newspack.test/wp-json/newspack/v1/wizard/subscriptions?_locale=user 500 (Internal Server Error)
It looks like that is triggered by this fatal:
PHP Fatal error: Uncaught Error: Class 'WC_Product_Subscription' not found in /srv/www/newspack/public_html/wp-content/plugins/newspack-plugin/includes/wizards/class-subscriptions-wizard.php:188
I have installed and activated, but not configured in any way, WooCommerce, WooCommerce Subscriptions and WooCommerce Name Your Price. Are we sure there isn't some extra setup set before that class is available?
I was also expecting the UI to be like the Membership Setup screen in Figma, that we currently have on the "Subscriptions" sub menu item on the master branch:
I won't dig into the code just yet.
|
@philipjohn can you paste your system status report (WooCommerce > Status) so I can reproduce your environment? I'll split out the PR into multiple ones tomorrow also; that should make it easier to review. |
Since this one might be broken into separate PRs I'll hold off on line-by-line review for now, but I'll note some broad architecture questions here. As context, I'm trying to take a long view and think about establishing SPA patterns that we can use for 100% of our wizards, so if any of these points seem like pedantic over-engineering, that's kind of where my head's at.
Overall I found this doc useful: https://reactjs.org/docs/thinking-in-react.html |
|
Will send you the status report via DM... Just to check I actually have this right, I'm using these two plugins:
Also, I'm deliberately playing dumb and doing nothing to them and only interacting with the Newspack wizard. |
Just noting this was because I had the wrong plugins and that it's all working lovely for me with the correct plugins. |
|
See #73 |

All Submissions:
Changes proposed in this Pull Request:
Closes #53 .
Supersedes #15.
This is a rather large PR, however it lays the groundwork for all future wizards, so it should be straightforward after this.
Changes:
One wizard has a simple pattern (in my opinion):
Not implemented in this initial version:
How to test the changes in this Pull Request:
npm ci; npm run clean; npm run build:webpack.Other information: