Skip to content
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

Partner Compatibility: Adding a unique connection screen for customers who receive a coupon from a Jetpack partner #21813

Merged
merged 39 commits into from
Nov 29, 2021

Conversation

rcoll
Copy link
Member

@rcoll rcoll commented Nov 18, 2021

Changes proposed in this Pull Request:

  • This PR accepts a coupon code via URL parameter. The code is stored in the database and forwarded to checkout upon user connection.
  • This PR adds new copy and imagery to the ConnectScreen component if a partner coupon is stored in the database.

Prerequisite

Jetpack product discussion

  • PT: pbtFPC-2c3-p2
  • Design: p1HpG7-dvB-p2

Does this pull request change what data or activity we track or use?

This PR introduces 2 new tracking events:

  • jetpack_partner_coupon_redeem_view: This event is triggered whenever the new PartnerCouponRedeem is rendered (if connected*).
  • jetpack_partner_coupon_redeem_click: This event is triggered when a user clicks the Redeem <Product name> button (if connected*).

If connected*: the "redeem coupon" component is shown in two instances:
a) Instead of the pre-connection screen so we both connect the site and direct them to checkout with their partner coupon.
b) As a specific screen that can be directly accessed if the site is already connected.
Because we only track events after the user has connected Jetpack, we can only track stats for the latter "connected" scenario.

Needs to be done before merge

  • We need to run tools/project-version.sh -f -u 1.14.0-alpha packages/options to bump the dependency version of Jetpack options, but it introduces a lot of "noice" (~28 touched files), so we're waiting with this until the rest of the PR has been approved.

Testing instructions:

Setup

  • Add the code snippet below to your WordPress installation (e.g.: in 0-sandbox.php if you use Jetpack Docker). This will allow the test coupon to be recognised as a valid coupon.
add_filter( 'jetpack_partner_coupon_supported_partners', function ( $partners ) {
	$partners['JPTST'] = 'Jetpack Test';

	return $partners;
} );

add_filter( 'jetpack_partner_coupon_supported_presets', function ( $presets ) {
	$presets['JPTA'] = 'jetpack_backup_daily';

	return $presets;
} );

Functional test: Pre-connection screen
This assumes that you've done the "setup" steps above.

  • Login to your WordPress site and make sure you use this branch of Jetpack.
  • Go to /wp-admin/admin.php?jetpack-partner-coupon=JPTST_JPTA_123AB.
  • You should now be redirect to a screen that says "Welcome to Jetpack Jetpack Test traveler!"
  • Click the "Set up & redeem Jetpack Backup" button.
  • Approve that Jetpack is allowed to use site data.
  • You should now be directed to checkout with a 100% discounted Jetpack Backup Daily product.

Functional test: Connected Jetpack
This assumes that you've done the "setup" steps above.

  • Login to your WordPress site and make sure you use this branch of Jetpack.
  • Create a Jetpack connection.
  • Go to /wp-admin/admin.php?jetpack-partner-coupon=JPTST_JPTA_123AB.
  • You should now be redirect to a screen that says "Welcome to Jetpack Jetpack Test traveler!"
  • Click the "Redeem Jetpack Backup" button (this should not say "Set up" in the button since we're already connected).
  • You should now be directed to checkout with a 100% discounted Jetpack Backup Daily product.

Tracking

If you have completed the Functional test: Connected Jetpack test, you should have automatically triggered both events described in the "Does this pull request change what data or activity we track or use?" section.
You'll probably have to wait between 5-20min before it appears in the live tracks tool: PCYsg-5hv-p2.

Both events should contain the following event properties:

  • connected: expected to be yes with test instruction coupon.
  • coupon: expected to be JPTST_JPTA_123AB with test instruction coupon.
  • partner: expected to be JPTST with test instruction coupon.
  • preset: expected to be JPTA with test instruction coupon.

Screenshots

Notice: some of the styling differs from the purposed design since we want to lean into the existing "Connection screen" but all the same messages/ideas should be conveyed as the design.

Pre-connection screen: "desktop"

Screenshot 2021-11-24 at 02 41 04

Pre-connection screen: "tablet"
Screenshot 2021-11-24 at 02 54 44

Pre-connection screen: "phone"

Screenshot 2021-11-24 at 02 56 17

Connected screen: "desktop"

Screenshot 2021-11-24 at 02 52 02

Connected screen: "tablet"

Screenshot 2021-11-24 at 02 54 19

Connected screen: "phone"

Screenshot 2021-11-24 at 02 55 59

@rcoll rcoll added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it Connect Flow Connection banners, buttons, ... [Size] M labels Nov 18, 2021
@rcoll rcoll requested a review from kallehauge November 18, 2021 22:26
@github-actions github-actions bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ Admin Page React-powered dashboard under the Jetpack menu labels Nov 18, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Nov 18, 2021

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ⚠️ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team review" label and ask someone from your team review the code.
Once you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.


Jetpack plugin:

  • Next scheduled release: December 7, 2021.
  • Scheduled code freeze: November 30, 2021.

Backup plugin:

  • Next scheduled release: December 7, 2021.
  • Scheduled code freeze: November 29, 2021.

Boost plugin:

  • Next scheduled release: November 30, 2021.
  • Scheduled code freeze: November 23, 2021.

@github-actions github-actions bot added the [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! label Nov 18, 2021
Copy link
Contributor

@kallehauge kallehauge left a comment

Choose a reason for hiding this comment

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

@rcoll, do you think we can perhaps connect-right-partner.png reduce the size of this image? (e.g.: https://tinypng.com/).
Also, this image looks a lot like the one use in the product description view for backups, so perhaps we can re-use the image from there and show product specific images?

@kallehauge
Copy link
Contributor

kallehauge commented Nov 19, 2021

@rcoll I've addressed some of my own suggestions and done the following:

  • Refactored some of the coupon logic, so we no longer pass a string to JS but instead an object.
  • Added some partner + preset validation logic so we don't display the redeem coupon screens if there for some reason is an empty string or similar.
  • Now fetching partner and product descriptions from Jetpack::get_products_for_purchase. While I worked with this one I also noticed that the previous copy (taken from design) is for the new tiered version of Backup whereas the IONOS coupons - at least for now - are for Backup Daily.
  • I've added "Jetpack Daily" back in the plugin (was recently removed in Products: Update links on Backup/Security cards to direct to checkout for real-time products #21674) to support the above scenario.
  • Added "purge coupon code" logic.

@kallehauge
Copy link
Contributor

Oi! I've also added three new filters:

  1. jetpack_get_products_for_purchase
  2. jetpack_partner_coupon_supported_presets
  3. jetpack_partner_coupon_supported_partners

Technically these will allow future partners to add backwards compatibility for coupons by adding their name and presets to e.g. a MU plugin for all sites they want to give coupons for.
Or just existing partners who want to start offering new products/presets.

@github-actions github-actions bot added the [Package] Options This package no longer exists in the monorepo. It was merged into [Package] Connection. label Nov 19, 2021
@kallehauge kallehauge removed the [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! label Nov 26, 2021
@kallehauge kallehauge added the [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. label Nov 26, 2021
@ederrengifo
Copy link

LGTM! Great job 🙌

@leogermani
Copy link
Contributor

@kallehauge

I gave it another round of tests and everything worked this time! Every possible case

  • From a disconnected site
  • From a fully connected site
  • From a site-only connected site

As for the amount of files. I think it's fine - we can navigate the noise of all the boiler plate

@kallehauge
Copy link
Contributor

kallehauge commented Nov 26, 2021

That sounds great @leogermani !

@rcanepa has (indirectly) done manual tests of this PR over at Automattic/wp-calypso#58552 as well which included some edge-cases with sites that had unattached licenses and/or partner ids, so I'm feeling pretty confident we're about there 😄

I'm going to give p9dueE-wa-p2 a go to see why we get the wpcom - Could not cleanly apply this PR to synced wpcom files error.

If there's anything else, then please don't hold back! I'm pretty stocked to get this in 10.4 😛

Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

This looks good to me, it should be good to merge! I only have one question, but that's not blocking or anything.

Comment on lines -12 to -16
<filter>
<whitelist processUncoveredFilesFromWhitelist="false">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
Copy link
Member

Choose a reason for hiding this comment

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

I don't quite understand why this needs to be removed. Does this change anything here?

Copy link
Contributor

@kallehauge kallehauge Nov 29, 2021

Choose a reason for hiding this comment

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

It's because it's deprecated 😄 When you run PHPUnit you'll get the following warning:

Warning:       Your XML configuration validates against a deprecated schema.
Suggestion:    Migrate your XML configuration using "--migrate-configuration"!

Technically we could convert it to <coverage> instead but I think it's unnecessary 😅 I think we're covered by the <directory prefix="test" suffix=".php">tests/php</directory> definition (only test prefixes in PHP files, in the tests/php directory).
That being said; I'm not a PHPUnit configuration master - more of a general user - so there might be something I'm missing.

<!--
<filter>
    <whitelist processUncoveredFilesFromWhitelist="false">
        <directory suffix=".php">src</directory>
    </whitelist>
</filter>
-->
<coverage processUncoveredFiles="false">
    <include>
        <directory suffix=".php">src</directory>
    </include>
</coverage>

@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Nov 29, 2021
@jeherve
Copy link
Member

jeherve commented Nov 29, 2021

Do you have time to make a few quick bullets of what actions you took? E.g.:

I cannot reproduce today, the coupon seems to work now. Not sure what I did wrong the last time around, but you can ignore it now :)

@kallehauge kallehauge merged commit 2344848 into master Nov 29, 2021
@kallehauge kallehauge deleted the add/partner-coupon-connection branch November 29, 2021 13:05
@github-actions github-actions bot removed the [Status] Ready to Merge Go ahead, you can push that green button! label Nov 29, 2021
@jeherve jeherve added the [Status] Needs Testing We need to add this change to the testing call for this month's release label Nov 29, 2021
@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello rcoll! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer and confirm D70760-code works as expected before merging this PR. Once this PR is merged, please commit the changes to WP.com. Thank you!
This revision will be updated with each commit to this PR

@kallehauge
Copy link
Contributor

r235750-wpcom

@jeherve jeherve removed the [Status] Needs Testing We need to add this change to the testing call for this month's release label Nov 30, 2021
davidlonjon added a commit that referenced this pull request Dec 2, 2021
* master: (22 commits)
  Update storybook monorepo to v6.4.0 (#21897)
  Refresh the site's modules and settings after successful product activation (#21886)
  Plugin Install: Bump MC stat on success or fail. (#21893)
  Nav Unification: Use correct user capability for the Inbox menu item (#21882)
  Jetpack: Extend disconnection dialog component to handle multiple steps and accept more props (#21048)
  Disable CSSTidy property shorthand optimization in the editor or headstart (#21891)
  Connection UI: Update Composer instructions in README.md (#21890)
  Partner Compatibility: Adding a unique connection screen for customers who receive a coupon from a Jetpack partner (#21813)
  Search package: move search dashboard to package - the base (#21865)
  JITM: wrap CTA below text on small viewports (#21688)
  Licensing JS Package – fix icon positioning and width (#21878)
  JITM: new JS and CSS builder (#21874)
  Support site_intent for `/me/sites` endpoint (#21880)
  Don't render Critical CSS while generating CritCSS. (#21879)
  ConnectScreen: make button full width on small screens (#21683)
  Improve the copy of the license activation banner (#21876)
  Rename Webpack-built files back from `.min.js` and remove hashes (#21748)
  Search: Migrate more helper classes to package (#21751)
  Search: migrate/add search rest API (#21584)
  Add initial state to the connection package (#21864)
  ...
@coder-karen coder-karen removed the [Status] Needs Privacy Updates Our support docs will need to be updated to take this change into account label Dec 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin Page React-powered dashboard under the Jetpack menu Connect Flow Connection banners, buttons, ... [JS Package] Partner Coupon [Package] Connection [Package] Heartbeat This package no longer exists in the monorepo. It was merged into [Package] Connection. [Package] Identity Crisis This package no longer exists in the monorepo. It was merged into [Package] Connection. [Package] Jitm [Package] Licensing [Package] Options This package no longer exists in the monorepo. It was merged into [Package] Connection. [Package] Partner This package no longer exists in the monorepo. It was merged into [Package] Connection. [Package] Sync [Package] Terms of Service This package no longer exists in the monorepo. It was merged into [Package] Connection. [Package] Tracking This package no longer exists in the monorepo. It was merged into [Package] Connection. [Plugin] Backup A plugin that allows users to save every change and get back online quickly with one-click restores. [Plugin] Boost A feature to speed up the site and improve performance. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ RNA [Size] M [Status] Design Review Complete Touches WP.com Files [Type] Feature Request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants