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

Recommendations: Add Jetpack Product Suggestions step #20814

Merged
merged 43 commits into from
Aug 30, 2021

Conversation

kallehauge
Copy link
Contributor

@kallehauge kallehauge commented Aug 25, 2021

Changes proposed in this Pull Request:

  • [API] Add support for new /jetpack/v4/recommendations/product-suggestions endpoint.
  • [Plugin] Change the illustrationPath attribute of <PromptLayout> to be optional, so we can use the same layout component for full width content.
  • [Plugin] Add a new <MoneyBackGuarantee> component.
  • [Plugin] Add a new Query Data component to fetch Product Suggestions (<QueryRecommendationsProductSuggestions>).
  • [Plugin] Add a new Product Suggestions step in the Jetpack Assistant (done by adding it to the Recommendations routing system and two new components: <ProductSuggestions> and <ProductSuggestion>).
  • [Plugin] Add a new hidden "landing page" like step to the Jetpack Assistant (<ProductPurchased>) that will only be displayed if a user is directly forwarded to it (used as return URL from the checkout)

Jetpack product discussion

  • PT: pbNhbs-Yp-p2
  • Design: p6TEKc-5bW-p2
  • Task: 1161179020265237-as-1200537408139848
  • API: D66016-code

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

This Pull Request adds the following Analytics Tracking Events:

  • jetpack_recommendations_product_suggestion_click: When a user selects one of the suggested products.
  • jetpack_recommendations_product_suggestion_learn_more_click: When a user clicks one of the "Learn More" links located at the suggested products.
  • jetpack_recommendations_product_suggestion_purchased: When a user has gone through checkout and been returned to the Jetpack Assistant.
  • jetpack_recommendations_product_suggestions_decide_later_click: When a user skips the Purchase Product step.

Testing instructions:

Initial setup and how to find the Product Suggestion step

  1. Get a local version of the repository running.
  2. Create a successful Jetpack connection (you can do this by connection the website with a Jetpack Free plan).
  3. Go to /wp-admin/admin.php?page=jetpack#/recommendations.
  4. On the second step of the Recommendations wizard you should see the Product Suggestions step.

Things to test

  • Click on the Product Learn More links. These should open in a new tab.
  • When you press the Decide later link you should be taken to either the WooCommerce step or Monitor step depending on your website.
  • When you click the Continue with [Product Name] button you should be redirected to checkout where the product is pre-selected.
  • When you are finished in the checkout you should be redirected to the new landing page which should display 3 bullets if you purchased Jetpack Backup Daily or 5 bullets if you selected Jetpack Security Daily.
  • When you've purchased a product on the product suggestions step, you should no longer see any upsell/upgrade suggestions on the final summary screen with all the features.

Screenshots

Product Suggestion step: Desktop

Screenshot 2021-08-24 at 23 51 57

Product Suggestion step: Tablet

Screenshot 2021-08-25 at 00 24 40

Product Suggestion step: Phone

Screenshot 2021-08-30 at 17 29 03

Product Purchased step: Desktop

Screenshot 2021-08-25 at 01 56 05

Product Purchased step: Tablet

Screenshot 2021-08-25 at 01 56 26

Product Purchased step: Phone

Screenshot 2021-08-25 at 01 57 26

Product Purchased step: Jetpack Backup Daily example

Screenshot 2021-08-25 at 14 36 11

@kallehauge kallehauge requested a review from IanRamosC August 25, 2021 12:38
@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 Aug 25, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Aug 25, 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: September 7, 2021.
  • Scheduled code freeze: August 30, 2021.

Backup plugin:

  • Next scheduled release: September 7, 2021.
  • Scheduled code freeze: August 30, 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 Aug 25, 2021
@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello kallehauge! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer and confirm D66036-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 kallehauge removed the request for review from IanRamosC August 29, 2021 15:50
It was possible that the product-suggestions-selection value was not set before the user was redirected to the checkout which would cause the purchased step/landing page to not display any information.
@kallehauge
Copy link
Contributor Author

I'll let Design weigh in on this, but maybe it would make sense to center things on mobile?

CC: @Automattic/jetpack-design (just to make sure Jeremy's comment isn't lost 😄 🔔 )

@kallehauge
Copy link
Contributor Author

kallehauge commented Aug 30, 2021

Thank you very much for the review @jeherve and your help with the dependencies files! 🙇


In some cases (not sure what caused it), I would get a blank screen when the suggestions loaded, and a js error:

react-dom.min.js?ver=16.13.1:125 TypeError: o.map is not a function
    at admin.js?ver=10.1-alpha:formatted:42613

I have not been able to product the error by just using the Assistant but I'm assuming you experienced one of two scenarios:

  1. You received an errors response from the Product Suggestions API endpoint which - from the previous code - was still a successful response and not an array which .map relies on.
  2. The reducer gave us the default state instead of an array and the logic had a fatal error so we never got to the point where we actually received the suggestions array instead - it just stopped.

Both basically means the same from a "what can we do to avoid it" perspective: The error and response handling might not have been the best. So I've added an isArray condition as part of a better loading experience of which should eliminate us trying to iterate over suggestions before we're really, really ready.

Reference:


I saw no benefits mentioned when upgrading to a Backup daily plan. Oddly enough, purchasedProductSlug was set to false:

The only reason purchasedProductSlug would be false is if we have to resort to the default value of getDataByKey and it does look like we hit an oldie here, where we try to store data while also redirecting the user to a new page and not just update the state and replace a component on the same page.

(I'm still relatively new to React and worked from an assumptions about combining onClick and useCallback would help us with this scenario but that is what happens when you work from assumptions and not validation 😅 ).

I have done the following:

@kallehauge kallehauge requested a review from jeherve August 30, 2021 01:30
@kallehauge kallehauge added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Aug 30, 2021
We do this instead of relying on the onClick data since it will always be tricky and have a chance of failing when we redirect to another site.
@Luchadores
Copy link
Contributor

Luchadores commented Aug 30, 2021

Looks good to me 🙌 And liked promised, here is the screenshot for the mobile change regarding the pricing position.
image

Thank you! 🚀

@sdixon194 sdixon194 added this to the jetpack/10.1 milestone Aug 30, 2021
We change the layout to use grid instead of flex so we could place the price inbetween the description and actions on small devices but move it to the right of the other content on smaller phones.
@kallehauge
Copy link
Contributor Author

kallehauge commented Aug 30, 2021

Looks good to me 🙌 And liked promised, here is the screenshot for the mobile change regarding the pricing position.

Awesome work @Luchadores! I have implemented the suggestion and updated the screenshot in the PR description.

Related:

  • p1630330099088000-slack-C0D96691V

Copy link
Contributor

@sdixon194 sdixon194 left a comment

Choose a reason for hiding this comment

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

This works well for me! Let's do it 👍

@sdixon194 sdixon194 enabled auto-merge (squash) August 30, 2021 17:51
@sdixon194 sdixon194 merged commit a9e0e05 into master Aug 30, 2021
@sdixon194 sdixon194 deleted the add/recommendation-product-suggestion-step branch August 30, 2021 18:03
@github-actions github-actions bot removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Status] Design Input Requested [Status] Needs Design Review Design has been added. Needs a review! labels Aug 30, 2021
@github-actions
Copy link
Contributor

Great news! One last step: head over to your WordPress.com diff, D66036-code, and commit it.
Once you've done so, come back to this PR and add a comment with your changeset ID.

Thank you!

davidlonjon added a commit that referenced this pull request Aug 31, 2021
* master: (34 commits)
  Fix issue templates (#20880)
  Social Icon Widget: Fix Icons Not Saving (#20862)
  Dashboard: Add a specific message for a site that is too new to have a rewind status (#20863)
  Add additional properties to WC Analytics events (#20812)
  Connection: add spinner for the "Connect" button (#20872)
  Update storybook monorepo to v6.3.7 (#20877)
  Lightweight PHPCS (#20876)
  Recommendations: Add Jetpack Product Suggestions step (#20814)
  Update babel monorepo (#20875)
  Update wordpress monorepo (#20873)
  cli: Check subprocess exit statuses in docker commands (#20861)
  Facebook Widget: Fix URL error when adding widget (#20864)
  Stats: make nudges collapsible (#20765)
  Remove temporary Newspack block override css (#20868)
  Allow ZIP uploads via Calypso (#20860)
  Sync Package Release v1.26.0 (#20870)
  Connection: remove in-place in secondary flows (#20739)
  BUILD_DIR -> BUILD_BASE in initial checks (#20857)
  E2E tests: Fix missing action for atomic workflow (#20866)
  Boost: Fix skip proxy origins to load css during critical CSS generation (#20793)
  ...
@anomiex
Copy link
Contributor

anomiex commented Aug 31, 2021

r231018-wpcom

@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 [JS Package] API [JS Package] Connection [Package] Connection UI This package no longer exists in the monorepo. [Plugin] Backup A plugin that allows users to save every change and get back online quickly with one-click restores. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ Touches WP.com Files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants