Automattic / wp-calypso

The JavaScript and API powered WordPress.com
https://developer.wordpress.com
GNU General Public License v2.0
12.43k stars 1.99k forks source link

Plans: Remove references to `withDiscount` in favor of `coupon` #96600

Open jeyip opened 1 day ago

jeyip commented 1 day ago

Related to https://github.com/Automattic/wp-calypso/issues/95702 and https://github.com/Automattic/wp-calypso/pull/95703 and pau2Xa-6sB-p2#comment-16318

Proposed Changes

Emails rely on the discount query param to auto-apply coupons when redirecting to the logged in plans page. The /start onboarding flow plans page, however, relies on the coupon query param for the same purpose. Although behind the scenes we'll continue to support both coupon and discount for the time being on the logged in plans page ( to accommodate legacy outbound marketing emails ), we'll be consolidating to only coupon in the future.

Because of this, we replace instances of the term withDiscount with the term coupon.

These changes also simplify the feature we're implementing here. Refactoring this code allows us to pass a coupon query param prop into PlansFeaturesMain under the name coupon which is already being used throughout the component ( instead of needing to use withDiscount ).

Why are these changes being made?

Testing Instructions

This is a refactoring PR. There should be no functional changes.

Pre-merge Checklist

github-actions[bot] commented 1 day ago
Calypso Live (direct link)
https://calypso.live?image=registry.a8c.com/calypso/app:build-125338
Jetpack Cloud live (direct link)
https://calypso.live?image=registry.a8c.com/calypso/app:build-125338&env=jetpack
Automattic for Agencies live (direct link)
https://calypso.live?image=registry.a8c.com/calypso/app:build-125338&env=a8c-for-agencies
matticbot commented 1 day ago

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~21 bytes removed 📉 [gzipped])

``` name parsed_size gzip_size plans -123 B (-0.0%) -21 B (-0.0%) update-design-flow -93 B (-0.0%) -17 B (-0.0%) plugins -93 B (-0.0%) -17 B (-0.0%) link-in-bio-tld-flow -93 B (-0.0%) -17 B (-0.0%) jetpack-app -93 B (-0.0%) -17 B (-0.0%) ``` Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~17 bytes removed 📉 [gzipped])

``` name parsed_size gzip_size async-load-signup-steps-plans-theme-preselected -93 B (-0.0%) -17 B (-0.0%) async-load-signup-steps-plans -93 B (-0.0%) -17 B (-0.0%) ``` React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size? **Parsed Size:** Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. **Gzip Size:** Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

jeyip commented 1 day ago

@chriskmnds looking for a confidence check with these changes. I made updates several weeks ago to pass the coupon query param from the logged in plans page to checkout https://github.com/Automattic/wp-calypso/pull/95630. Previously, it wasn't working as expected. pau2Xa-6sB-p2#comment-16318

This PR is meant to continue tidying up surrounding code and make the feature change in https://github.com/Automattic/wp-calypso/pull/95703 cleaner.

jeyip commented 15 hours ago

tested /plans/:site?coupon=federate25 but can see the discount visible on all plans. is this expected, something off on my end?

Hmmm...definitely odd. Not seeing it on my end but will investigate 😅

Edit:

I'm unsure where the discount originates from. I notice that the one time discount is being applied to all plans in your screenshot and it's for ~9% off. federate25 should only apply 25% to Business and Commerce plans, so it seems unlikely related to the coupon query param changes.

I suspect this might be some sort of store sandbox strangeness, but can't manage to replicate. Would you mind clearing your browser cache and testing the logged in plans page again?

What I've tried so far to emulate:

matticbot commented 11 hours ago

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

To test WordPress.com changes, run install-plugin.sh $pluginSlug remove/with-discount-prop-from-plans-grid on your sandbox.