-
Notifications
You must be signed in to change notification settings - Fork 844
My Jetpack: Onboarding i4 | Wire up product activation and actions #44088
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
My Jetpack: Onboarding i4 | Wire up product activation and actions #44088
Conversation
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.
Pull Request Overview
This PR wires up the product activation and actions for My Jetpack onboarding, completing MYJP-170.
- Extends product hooks (use-products, use-product, and use-all-products) to include refetching status.
- Updates the activation logic in use-activate-plugins to call a global products refetch and adjusts parameters for site connection handlers.
- Modifies UI components (product cards, action buttons, and related button components) to support new status-driven behavior and a new "compact" size prop.
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| _inc/data/products/use-products.ts | Added refetching status to hook return values. |
| _inc/data/products/use-product.ts | Propagated new isRefetching property in product hook. |
| _inc/data/products/use-all-products.ts | Updated hook to return refetch and isRefetching with type casting adjustment. |
| _inc/data/products/use-activate-plugins.ts | Updated to use refetchAllProducts for global product state updates. |
| _inc/components/product-card/index.ts | Refactored the fixSiteConnectionHandler callback signature. |
| _inc/components/my-jetpack-tab-panel/products/product-card-action.tsx | Split the action rendering into UpgradeAction and DynamicAction based on product status. |
| _inc/components/my-jetpack-tab-panel/products/mappings.ts | Removed unneeded mapping keys. |
| _inc/components/action-button/secondary-button.tsx | Extended size prop to include "compact". |
| js-packages/components/components/button/* | Propagated the new "compact" button size across type definitions and implementation. |
| changelog | Updated changelog reflecting the activation and button size changes. |
projects/packages/my-jetpack/_inc/data/products/use-activate-plugins.ts
Outdated
Show resolved
Hide resolved
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
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 🤖 🔴 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: Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
robertsreberski
left a comment
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.
|
When loading a page, the primary CTAs are not immediately available and can't be clicked (disabled). This does not happen with secondary CTAs. Screen.Recording.2025-06-25.at.15.22.41.mov |
|
Scan is highlighted as a product in the Products page, but it's represented as Protect in the Overview page.
Even though the plan is technically called Scan, my recommendation would be to highlight the Protect and send users through that respective flow. This would mean redirecting to Pinging @augurlu and @Initsogar to get their thoughts. Thanks in advance! Related P2 thread: pgvhYc-7S-p2 |
|
Social is represented as a toggle in the Products page:
When activated, it's counterpart in the Overview page has an Upgrade and a View button:
I understand Social ships fully in Jetpack, just noting that this introduces an inconsistency between the two cards. It's a similar case as VideoPress, which can be enabled from the main plugin, but could benefit from having the SA sideloaded as it offers a much more compelling experience.
We should look at reconciling these differences soon, @grbicsanja! |
…isting product card
Introduces the isRefetching property to useProduct, useProducts, and useAllProducts hooks to better track product data refetching state. Updates ActionButton to consider isRefetching in its busy state logic and ensures plugin activation refetches all products for up-to-date data.
Replaces the module toggle's custom styles with global styles in the tab panel, removes the now-unused styles file, and refactors product card actions to use a new ActivationToggle component. Adds a new useDeactivatePlugins hook for plugin deactivation, and updates logic to handle activation and deactivation states for products. This streamlines toggle UI and improves product activation/deactivation handling.
f341759 to
5c2fa0b
Compare
|
The flow has been updated as per the design, following the conversation - p1750829934087949-slack-C08JR97D3J4 |
|
@keoshi I have fixed the duplication of AI product card. |
Pushed a fix. Thank you for pointing that out. |
…k/onboarding-i4/wire-up-product-activation
|
bugbot run |
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.
Bug
The ProductCardAction component incorrectly determines whether to display an ActivationToggle or an UpgradeAction. The condition if ( product.standalonePluginInfo?.isStandaloneActive ) only shows the ActivationToggle when a standalone plugin is active.
If a standalone plugin exists but is inactive, this condition fails, causing the component to fall through to the switch statement. This leads to two issues:
- An inactive standalone plugin may incorrectly display an
UpgradeAction("Learn more" button). - If the logic falls to the
defaultcase, an inactive standalone plugin will display a disabledActivationTogglethat appears active (due to theactiveprop defaulting totrue), misrepresenting its actual state.
The condition should check for the existence of a standalone plugin (e.g., product.standalonePluginInfo?.hasStandalonePlugin or isStandaloneInstalled) and always pass the plugin's actual active state to the ActivationToggle component.
projects/packages/my-jetpack/_inc/components/my-jetpack-tab-panel/products/product-card-action.tsx#L89-L108
Lines 89 to 108 in 3a08416
| */ | |
| export function ProductCardAction( { product }: ProductCardActionProps ) { | |
| if ( product.standalonePluginInfo?.isStandaloneActive ) { | |
| return <ActivationToggle product={ product } />; | |
| } | |
| switch ( product.status ) { | |
| case PRODUCT_STATUSES.INACTIVE: | |
| case PRODUCT_STATUSES.MODULE_DISABLED: | |
| case PRODUCT_STATUSES.NEEDS_ACTIVATION: | |
| case PRODUCT_STATUSES.NEEDS_PLAN: | |
| case PRODUCT_STATUSES.CAN_UPGRADE: | |
| return <UpgradeAction product={ product } />; | |
| default: | |
| // We assume that the product is active but can't be deactivated | |
| // For example Scan | |
| return <ActivationToggle product={ product } disabled />; | |
| } | |
| } |
Bug: Cache Conflicts in Plugin Activation/Deactivation
The useDeactivatePlugins hook uses QUERY_ACTIVATE_PRODUCT_KEY for its mutation. This causes cache conflicts between activation and deactivation operations, potentially leading to stale data or incorrect cache invalidation. A unique query key, such as QUERY_DEACTIVATE_PRODUCT_KEY, should be used for deactivation.
projects/packages/my-jetpack/_inc/data/products/use-deactivate-plugins.ts#L47-L48
jetpack/projects/packages/my-jetpack/_inc/data/products/use-deactivate-plugins.ts
Lines 47 to 48 in 3a08416
| } = useSimpleMutation< { [ key: string ]: ProductSnakeCase } >( { | |
| name: QUERY_ACTIVATE_PRODUCT_KEY, |
BugBot free trial expires on July 22, 2025
You have used $0.00 of your $50.00 spend limit so far. Manage your spend limit in the Cursor dashboard.
Was this report helpful? Give feedback by reacting with 👍 or 👎
robertsreberski
left a comment
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.
The PR looks good! Let's also wait for @grbicsanja and @keoshi to check it out - but the logic makes sense to me.
One note is that we probably shouldn't install VaultPress plugin when purchasing the product. It leads to the awkward interaction, as seen here:
CleanShot.2025-06-26.at.11.50.35.mp4
Strongly agree with using Protect instead of Scan, it will help users to unlock the full experience of Protect in WP Admin. I added some comments about the ongoing investigation of the Protect flow in pgvhYc-7S-p2#comment-157. cc/ @grbicsanja |
…k/onboarding-i4/wire-up-product-activation
This reverts commit 929811a.
…k/onboarding-i4/wire-up-product-activation
grbicsanja
left a comment
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.
LGTM
b9f9edd
into
feature/my-jetpack/onboarding-i4












Completes MYJP-170
Proposed changes:
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
Screen.Recording.2025-06-26.at.11.25.38.AM.mov