Skip to content

Conversation

@chihsuan
Copy link
Member

@chihsuan chihsuan commented Apr 14, 2023

Submission Review Guidelines:

Changes proposed in this Pull Request:

Closes #37190.

This PR migrates the Purchase task to TS. To archive that, I migrated the dashboard/utils.js as well.

Besides, this PR also fixes a wrong type definition (productTypes) in @woocommerce/data onboarding store.

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

CI should pass

  1. Go to the WooCommerce onboarding wizard.
  2. Continue to Onboarding wizard > Product Types tab (/wp-admin/admin.php?page=wc-admin&path=%2Fsetup-wizard&step=product-types)
  3. Select a paid product type, such as Memberships
  4. Complete OBW
  5. Go to WooCommerce > Home
  6. Observe that there is a Add ... product to my store task (for example: Add Memberships and 1 more product to my store)
  7. Click on that task.
  8. Observe that a modal pop up with title Would you like to add the following paid features to your store now?
  9. Click on Buy now button
  10. It should redirect you to checkout page (https://woocommerce.com/checkout/...).

@chihsuan chihsuan self-assigned this Apr 14, 2023
@github-actions github-actions bot added focus: react admin [team:Ghidorah] package: @woocommerce/data issues related to @woocommerce/data plugin: woocommerce Issues related to the WooCommerce Core plugin. labels Apr 14, 2023
profileItems: ProfileItems;
taskLists: Record< string, TaskListType >;
paymentMethods: Plugin[];
productTypes: OnboardingProductType[];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Onboarding productTypes is an object of objects.

Screenshot 2023-04-14 at 16 59 01

Screenshot 2023-04-14 at 16 11 30

@github-actions
Copy link
Contributor

github-actions bot commented Apr 14, 2023

Test Results Summary

Commit SHA: ea8ea3f

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests26700202690m 52s
E2E Tests1870010019716m 29s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

@chihsuan chihsuan marked this pull request as ready for review April 14, 2023 09:12
@chihsuan chihsuan force-pushed the update/migrate-purchase-task-to-ts branch from ab08c78 to e929bbc Compare April 14, 2023 10:11
let theme = null;
if ( onboarding && onboarding.themes ) {
theme = onboarding.themes.find(
// @ts-expect-error Ignore TS error here, as we're removing the theme step and these code from OBW in another PR.
Copy link
Member Author

@chihsuan chihsuan Apr 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See e863d28

@chihsuan chihsuan requested review from a team, adrianduffell and moon0326 April 14, 2023 10:14
@github-actions
Copy link
Contributor

Hi @moon0326, @adrianduffell, @woocommerce/ghidorah

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

@chihsuan chihsuan force-pushed the update/migrate-purchase-task-to-ts branch from 9040f6d to d749df1 Compare April 17, 2023 04:06
@chihsuan chihsuan force-pushed the update/migrate-purchase-task-to-ts branch from d749df1 to ea8ea3f Compare April 26, 2023 01:37
Copy link
Contributor

@adrianduffell adrianduffell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tested perfect, thanks @chihsuan! 🚀

Nice catch with the productTypes definition

Copy link
Contributor

@ilyasfoo ilyasfoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, LGTM!

*/
export function getPriceValue( string ) {
return Number( decodeEntities( string ).replace( /[^0-9.-]+/g, '' ) );
return {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice touch! This feels more react-like

generalSettings?.woocommerce_default_country
)
),
woocommerceTaxCountries.includes( countryCode ),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@chihsuan chihsuan merged commit 4a237ca into trunk May 9, 2023
@chihsuan chihsuan deleted the update/migrate-purchase-task-to-ts branch May 9, 2023 03:28
@github-actions github-actions bot added this to the 7.8.0 milestone May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: @woocommerce/data issues related to @woocommerce/data plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate purchase.js and index.js in ./tasks/fills to TS

4 participants