-
Notifications
You must be signed in to change notification settings - Fork 798
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
Extend ProductCard component and create recommendations UI #38319
Extend ProductCard component and create recommendations UI #38319
Conversation
0e6c9ae
to
d315d78
Compare
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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. 🔴 Action required: Please add missing changelog entries for the following projects: Use the Jetpack CLI tool to generate changelog entries by running the following command: Once your PR is ready for review, check one last time that all required checks appearing at the bottom of this PR are passing or skipped. |
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good @robertsreberski! Just a couple small suggestions, and then the issue/question about All the products showing a "Start for free" link.
Other than that, everything looks good to me!
projects/packages/my-jetpack/_inc/components/product-card/index.tsx
Outdated
Show resolved
Hide resolved
projects/packages/my-jetpack/_inc/components/product-card/index.tsx
Outdated
Show resolved
Hide resolved
projects/packages/my-jetpack/_inc/components/product-card/recommendation-actions.tsx
Outdated
Show resolved
Hide resolved
Hey @elliottprogrammer ! I've improved the PR and supported all possible states recommendation cards can be in (even though we'll aim not to propose already-owned products - I'll support it in the separate PR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am seeing products that are active in my recommendations
If you rebase, you should be able to use the new is_owned
data to filter out any recommendations that are already owned by the user. Do you think that would be a good idea?
Additionally if you rebase, you'll probably have a decent amount of merge conflicts because of the separation of the owned/unowned products PR that just shipped, as well as the PR that updates how statuses work a bit
projects/packages/my-jetpack/_inc/components/evaluation-recommendations/index.tsx
Outdated
Show resolved
Hide resolved
projects/packages/my-jetpack/_inc/components/evaluation-recommendations/index.tsx
Outdated
Show resolved
Hide resolved
projects/packages/my-jetpack/_inc/components/product-card/action-button.tsx
Outdated
Show resolved
Hide resolved
projects/packages/my-jetpack/_inc/components/product-card/index.tsx
Outdated
Show resolved
Hide resolved
projects/packages/my-jetpack/_inc/components/product-card/pricing-component.tsx
Outdated
Show resolved
Hide resolved
projects/packages/my-jetpack/_inc/components/product-card/recommendation-actions.tsx
Outdated
Show resolved
Hide resolved
projects/packages/my-jetpack/_inc/components/product-card/recommendation-actions.tsx
Outdated
Show resolved
Hide resolved
projects/packages/my-jetpack/_inc/components/product-card/secondary-button.tsx
Outdated
Show resolved
Hide resolved
projects/packages/my-jetpack/_inc/components/product-card/style.module.scss
Outdated
Show resolved
Hide resolved
}; | ||
|
||
const getLearnMoreAction = ( detail: ProductCamelCase ) => { | ||
if ( detail.status !== PRODUCT_STATUSES.ACTIVE && detail.tiers.includes( 'free' ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not all products that have a free offering have the "free" tier in the product detail. You might want to also check the has_free_offering
and potentially even the requires_plan
value that is currently only used on the backend. Just to make sure there is no free offering as Backup (as far as I can remember) should really be the only one without one 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, good point, however, here I wanted to reflect how our interstitials look like (as this is the label of button leading to interstitial). E.g. VideoPress, Stats, Social don't display "Start for free" option in the interstitial, they are also following "tiers" logic from what I understand.
But I'm not completely sure which way we should go here. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VideoPress, Stats, Social don't display "Start for free" option in the interstitial, they are also following "tiers" logic from what I understand.
This is true! However with the updated statuses PR, all of those plans (if they are in the owned section at least) will have an "Activate" button rather than a "Learn More" -> interstitial CTA reducing friction as much as possible. The goal was to allow users to activate and use our free offering if it exists as easily as possible, and some of the interstitials don't offer the free version on them as they should. That will be handled when we redo interstitials but for now I think it'd be best to allow them to start for free as easily as possible, especially if we are specifically recommending it to them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For what it's worth, this isn't a problem for most of these product cards. The only ones I can see that are missing it are VideoPress, CRM, and Social 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Boost as well. It's good point, I'll update the condition here to include all products that have free offering
projects/packages/my-jetpack/_inc/components/evaluation-recommendations/index.tsx
Outdated
Show resolved
Hide resolved
Thanks for the review @CodeyGuyDylan ! I've addressed all your comments.
It's a good idea, I actually plan to first merge everything to |
That sounds like a good plan forward to me 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionally this works well. I left a few nitpick comments as well as suggesting I still think we should show the "Start for free" CTA for all products that have a free offering, but since it's nitpicks and an opinion, I'll approve this 😄
<Col> | ||
<Text> | ||
{ __( | ||
'Here are the features that will best help you with your site:', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sorry, we might also want to use a _n
here as well. Maybe not since plugins have more than one feature each 🤔 Idk it's up to you, just thought i'd point it out 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll note that down, and will ask design team once everything is on feature/welcome-flow
and ready for their review
projects/packages/my-jetpack/_inc/components/product-card/action-button.tsx
Outdated
Show resolved
Hide resolved
projects/packages/my-jetpack/_inc/components/product-card/index.tsx
Outdated
Show resolved
Hide resolved
projects/packages/my-jetpack/_inc/components/product-card/pricing-component.tsx
Outdated
Show resolved
Hide resolved
}; | ||
|
||
const getLearnMoreAction = ( detail: ProductCamelCase ) => { | ||
if ( detail.status !== PRODUCT_STATUSES.ACTIVE && detail.tiers.includes( 'free' ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For what it's worth, this isn't a problem for most of these product cards. The only ones I can see that are missing it are VideoPress, CRM, and Social 😄
Hey @CodeyGuyDylan ! Can you take one more look at how it's handled now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the small improvements! I do have one issue with the CTAs on the cards now. I was hoping it would automatically activate the product rather than go to the interstitial 🤔
I would still say I think we should go that route, but having a "Start for free" CTA that sends the user to an interstitial without a free option to select from isn't ideal and if we are set on sending them to interstitials, then I would retract my suggestion and say we should go back to the "Learn More" CTA in this case
Additionally I am seeing a few products with a free offering on the interstitial have "Learn More" CTAs rather than a "Start for free" one
const hasDiscount = discountPrice && discountPrice !== fullPrice; | ||
return { | ||
wpcomProductSlug, | ||
wpcomProductSlug: ! quantity ? wpcomProductSlug : `${ wpcomProductSlug }:-q-${ quantity }`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh nice catch here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! I left one nitpick but the testing works well as far as I can tell. Will do more in depth testing when you merge everything and create the cleanup PR 😄
} ); | ||
|
||
const handleActivate = useCallback( () => { | ||
activate( {} ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can just have activate()
, I see that used that way elsewhere 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I messed up the typing of useSimpleMutation last time I was working on this, I'll fix it in the cleanup PR, or log it as maintenance task if it's more complex.
* Set WelcomeFlow structure and update WelcomeBanner (async site-only connection) (#37715) * Enhance TermsOfService component * Update MyJetpack connection hook and its usage * Update WelcomeBanner text and add async site registration on click * changelog * Add events and banner dismissal upon connection success * Update versions * Add WelcomeFlow (separate code) structure * Revert WelcomeBanner code * Update banner * Update versions * Hide notices when welcome banner is active * Code improvements * Prevent reloading on site connection * Introduce Notice templating (unify Notices) * Improve displaying notices when welcome banner is active * Improve styling of disabled 'x' button * Add evaluation form to Welcome Flow (#37790) * Enhance TermsOfService component * Update MyJetpack connection hook and its usage * Update WelcomeBanner text and add async site registration on click * changelog * Add events and banner dismissal upon connection success * Update versions * Add WelcomeFlow (separate code) structure * Revert WelcomeBanner code * Update banner * Update versions * Add evaluation form step * Add evaluation processing step and styles * Add evaluation steps to welcome flow * Replace classnames with clsx * Update image filename * Hide notices when welcome banner is active * Code improvements * Prevent reloading on site connection * Introduce Notice templating (unify Notices) * Add 'currentStep' prop to dismiss Tracks event * Add more info to dismiss Tracks event * Code improvements * Add /recommendations/evaluation endpoint handling (#38011) * Enhance TermsOfService component * Update MyJetpack connection hook and its usage * Update WelcomeBanner text and add async site registration on click * changelog * Add events and banner dismissal upon connection success * Update versions * Add WelcomeFlow (separate code) structure * Revert WelcomeBanner code * Update banner * Update versions * Add evaluation form step * Add evaluation processing step and styles * Add evaluation steps to welcome flow * Replace classnames with clsx * Update image filename * Hide notices when welcome banner is active * Code improvements * Prevent reloading on site connection * Introduce Notice templating (unify Notices) * Add 'currentStep' prop to dismiss Tracks event * Add more info to dismiss Tracks event * Code improvements * Improve mutation hook code * Add recommendations evaluation endpoint handling * Implement saving evaluation recommendations * Delete remaining reference * Code improvements and analytics * Fix code review comments * Fix phan * Fix phan 2 * Surpress other parameters * Fix phan completely * Improve Tracks events * Add Evaluation Recommendations logic (#38171) * Add ValueStore logic * Add Evaluation Recommendations logic * changelog * Fix refactor leftover * Improve querying evaluation endpoints * Code review improvements * Extend ProductCard component and create recommendations UI (#38319) * Refactor ProductCard to ts, add 'recommendation' property * Add price component and purchase button * Refactor and cleanup code * Fix backup card * Revert to short descriptions * Improve recommendation button names * Fix additional actions typing * Fix determining state of the recommended product * Fix literal translation handling (transpilation bug) * Fix checkout link redirect * Fix purchase button * Minor code review improvements * Improve handling checkout urls * Fix nitpicks * Improve handling free offerings and upgrade urls * Don't make admin flag required (as it's not required in every case now) * Fix code splitting issue * Activate plugins on 'start for free' action * Add Evaluation Recommendations context menu (#38378) * Refactor ProductCard to ts, add 'recommendation' property * Add price component and purchase button * Refactor and cleanup code * Fix backup card * Revert to short descriptions * Improve recommendation button names * Fix additional actions typing * Fix determining state of the recommended product * Fix literal translation handling (transpilation bug) * Fix boost card popover * Add delete endpoint, unify with others * Extend functionality of Welcome Banner and Evaluation Recommendations hooks * Add context menu to view layer * Fix checkout link redirect * Fix purchase button * Minor code review improvements * Improve handling checkout urls * Code review improvements * Fix nitpicks * Improve handling free offerings and upgrade urls * Don't make admin flag required (as it's not required in every case now) * Fix code splitting issue * Add recommendations initializer tweaks (#38452) * Refactor ProductCard to ts, add 'recommendation' property * Add price component and purchase button * Refactor and cleanup code * Fix backup card * Revert to short descriptions * Improve recommendation button names * Fix additional actions typing * Fix determining state of the recommended product * Fix literal translation handling (transpilation bug) * Fix boost card popover * Add delete endpoint, unify with others * Extend functionality of Welcome Banner and Evaluation Recommendations hooks * Add context menu to view layer * Add silent redBubble alerts - don't show in menu * Hide recommendations when user purchases the product * Fix checkout link redirect * Fix purchase button * Minor code review improvements * Improve handling checkout urls * Code review improvements * Fix nitpicks * Improve handling free offerings and upgrade urls * Don't make admin flag required (as it's not required in every case now) * Fix code splitting issue * Leftover after merge conflict resolution * Welcome Flow: Various tweaks and fixes (#38536) * Various tweaks and fixes * Improve layout of product card, hide boost tooltip on click * Fix Protect tooltips dependency * Display notices when in survey step * Remove red dot on survey step, don't show survey step when user is not new * Fix condition, and add comment * Improve 'start for free' actions and small fixes * Dismiss recommendations instead of deleting them * Fix condition * Redoing recommendations only happens locally * Limit recommendations to 3 * Code review fixes and disabling 'start for free' functionality * Change placement of Boost tooltip and revert click functionality * Welcome Flow: fixes and improvements pt. 2 (#38589) * Apply min-width 300px to cards * Set loading state of site connection button * Fix parsing active modules array * Update changelogger * Fix Tracks events code * Update projects/packages/my-jetpack/_inc/components/product-card/index.tsx Co-authored-by: Ian Ramos <5714212+IanRamosC@users.noreply.github.com> --------- Co-authored-by: jboland88 <18016357+jboland88@users.noreply.github.com> Co-authored-by: Ian Ramos <5714212+IanRamosC@users.noreply.github.com>
Proposed changes:
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
add/recommendations-section-component
branch