Show Blaze Traffic card for coming-soon sites - #112463
Conversation
Jetpack Cloud Live (direct link)
Automattic for Agencies Live (direct link)
Dashboard Live (dotcom) (direct link)
|
There was a problem hiding this comment.
Pull request overview
This PR updates the Marketing → Traffic settings page to keep the Blaze promo card discoverable for “coming soon” sites and ensures the CTA routes through Calypso’s Advertising flow (so users hit the existing “Site is not published” gate instead of a wp-admin missing-page error).
Changes:
- Loosen Blaze card visibility so it can show for coming-soon sites even when
can_blazeis false. - Route the Blaze CTA to
/advertising/:sitewhen a site slug is available, falling back to the wp-admin URL otherwise. - Add unit tests for the Blaze visibility and URL helper functions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| client/sites/marketing/traffic/traffic.jsx | Adds Blaze visibility/URL helpers; uses site slug to route CTA through Calypso Advertising. |
| client/sites/marketing/traffic/test/traffic.jsx | Adds focused tests for the new helper functions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export const shouldShowBlazeAdvertisingOption = ( state, siteId ) => { | ||
| const site = getRawSite( state, siteId ); | ||
|
|
||
| return isBlazeEnabled( state, siteId ) || Boolean( site?.is_coming_soon ); | ||
| }; |
| describe( 'shouldShowBlazeAdvertisingOption', () => { | ||
| test( 'returns true when the site can use Blaze', () => { | ||
| const state = getState( { canBlaze: true } ); | ||
|
|
||
| expect( shouldShowBlazeAdvertisingOption( state, siteId ) ).toBe( true ); | ||
| } ); | ||
|
|
||
| test( 'returns true when the site is coming soon', () => { | ||
| const state = getState( { canBlaze: false, isComingSoon: true } ); | ||
|
|
||
| expect( shouldShowBlazeAdvertisingOption( state, siteId ) ).toBe( true ); | ||
| } ); | ||
|
|
||
| test( 'returns false when the site cannot use Blaze and is not coming soon', () => { | ||
| const state = getState( { canBlaze: false } ); | ||
|
|
||
| expect( shouldShowBlazeAdvertisingOption( state, siteId ) ).toBe( false ); | ||
| } ); | ||
| } ); |
|
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~114 bytes added 📈 [gzipped]) DetailsSections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~73 bytes removed 📉 [gzipped]) DetailsReact 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. Generated by performance advisor bot at iscalypsofastyet.com. |
c7aab1c to
fd53392
Compare
Fixes https://linear.app/a8c/issue/ADS-1379/jetpack-traffic-inconsistent-blaze-module
Proposed Changes
can_blazeis false./advertising/{site}route when a site slug is available, so coming-soon sites land on the existing "Site is not published" Blaze gate instead of a generic wp-admin missing-page error.Why are these changes being made?
can_blaze: falsefor unlaunched sites, and the Traffic page used that campaign eligibility flag as the card visibility flag.Media
Testing Instructions
corepack yarn test-client client/sites/marketing/traffic --runInBandcorepack yarn eslint --ext .js,.jsx,.ts,.tsx,.mjs,.json client/sites/marketing/traffic/traffic.jsx client/sites/marketing/traffic/test/traffic.jsxgit diff --checkcorepack yarn typecheck-client/marketing/traffic/:site.v24.15.0./marketing/traffic/:site./advertising/:site, shows "Site is not published", includes the launch guidance, and does not show the generic wp-admin missing-page error./marketing/traffic/:site./advertising/:siteand shows the Blaze Advertising dashboard with campaign content.Pre-merge Checklist