starter-sites-onboarding-notice#465
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a dismissible onboarding promo notice to the Site List step, with localized backend data for visibility, dismissal, license-tier-specific copy, and dashboard redirect URL handling.
Changes:
- Added the promo notice React component and inserted it into the Site List flow.
- Added SCSS styling and imported it into onboarding styles.
- Added AJAX dismissal handling, localization data, tier-aware promo selection, and admin URL fallback data.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
onboarding/src/style.scss |
Imports the new promo notice stylesheet. |
onboarding/src/scss/_onboarding-promo-notice.scss |
Adds layout and responsive styles for the onboarding promo notice. |
onboarding/src/Components/Steps/SiteList.js |
Renders the new promo notice between filters and sites. |
onboarding/src/Components/OnboardingPromoNotice.js |
Implements promo display, tier-specific message, mailto CTA, and dismissal action. |
onboarding/src/Components/Header.js |
Updates exit redirect to use localized admin URL fallback. |
includes/Admin.php |
Adds dismissal option/action, promo localization data, tier decision logic, and admin URL localization. |
Comments suppressed due to low confidence (1)
onboarding/src/Components/OnboardingPromoNotice.js:23
- The mailto subject is user-facing text but is not wrapped in the WordPress i18n helpers used for the visible notice strings. This leaves the generated email subject untranslated for localized users.
const requestSiteLink =
'mailto:contact@themeisle.com?subject=' +
encodeURIComponent( 'Starter Site Request' ) +
'&body=' +
encodeURIComponent( emailBody );
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const dismissNotice = () => { | ||
| setIsVisible( false ); | ||
| ajaxAction( | ||
| tiobDash.onboardingPromoNotice.ajaxURL, | ||
| 'dismiss_onboarding_promo_notice', | ||
| tiobDash.onboardingPromoNotice.nonce | ||
| ).catch( () => null ); |
|
@claude[agent] review the comment in this thread and apply the suggested changes. |
…nd cleanup unused code Agent-Logs-Url: https://github.com/Codeinwp/templates-patterns-collection/sessions/c636c138-2459-452b-a54e-7ec23c3cfe96 Co-authored-by: harshitarora-in <56164789+harshitarora-in@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Codeinwp/templates-patterns-collection/sessions/1a67f28d-97f3-4be1-81ef-6fe9ff05ad79 Co-authored-by: harshitarora-in <56164789+harshitarora-in@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Codeinwp/templates-patterns-collection/sessions/1a67f28d-97f3-4be1-81ef-6fe9ff05ad79 Co-authored-by: harshitarora-in <56164789+harshitarora-in@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
includes/Admin.php:228
- This only normalizes Neve plan categories
1,2, and3, butLicense::NEVE_CATEGORY_MAPPINGdefines valid categories through9and existing Neve plan handling accepts any mapped category. Business/Agency Neve categories such as4,5,6,8, or9skip this branch, so the promo variant can be decided from unrelated TPC tier data instead of the active Neve plan.
if ( in_array( $neve_plan, array( 1, 2, 3 ), true ) ) {
// Normalize Neve plan category to TPC tier using License::NEVE_CATEGORY_MAPPING
$normalized_neve_tier = isset( License::NEVE_CATEGORY_MAPPING[ $neve_plan ] ) ? License::NEVE_CATEGORY_MAPPING[ $neve_plan ] : -1;
return in_array( $normalized_neve_tier, array( 2, 3 ), true );
| $license_key = isset( $license_data->key ) ? strtolower( trim( (string) $license_data->key ) ) : ''; | ||
| $license_tier = License::get_license_tier( 0 ); | ||
| $raw_tier = isset( $license_data->tier ) ? absint( $license_data->tier ) : 0; | ||
| $neve_plan = absint( apply_filters( 'product_neve_license_plan', -1 ) ); |
| * | ||
| * @return bool | ||
| */ | ||
| private function should_show_business_agency_promo_text() { |
| const dismissNotice = () => { | ||
| setIsVisible( false ); | ||
| ajaxAction( | ||
| tiobDash.onboardingPromoNotice.ajaxURL, | ||
| 'dismiss_onboarding_promo_notice', | ||
| tiobDash.onboardingPromoNotice.nonce | ||
| ).catch( () => null ); |
| return; | ||
| } | ||
|
|
||
| if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'dismiss_onboarding_promo_notice' ) ) { |
| unset( $response['code'] ); | ||
| unset( $response['message'] ); | ||
|
|
||
| update_option( self::ONBOARDING_PROMO_NOTICE_DISMISSED, 'yes' ); |
|
@claude[agent] Review the comments in this thread and apply the fixes. |
- Add proper nonce sanitization with wp_unslash and sanitize_text_field - Add capability check (install_plugins) before allowing dismissal - Fix Neve plan default -1 handling by removing absint() to allow fallback to TPC license tier Agent-Logs-Url: https://github.com/Codeinwp/templates-patterns-collection/sessions/69fed254-eb0a-4138-aca4-b87abd12189f Co-authored-by: harshitarora-in <56164789+harshitarora-in@users.noreply.github.com>
Applied all fixes from the review thread in commit 5776780:
|
| // Check Neve plan only if it's a valid category (not -1 default) | ||
| if ( -1 !== $neve_plan && in_array( $neve_plan, array( 1, 2, 3, 4, 5, 6, 7, 8, 9 ), true ) ) { | ||
| // Normalize Neve plan category to TPC tier using License::NEVE_CATEGORY_MAPPING | ||
| $normalized_neve_tier = isset( License::NEVE_CATEGORY_MAPPING[ $neve_plan ] ) ? License::NEVE_CATEGORY_MAPPING[ $neve_plan ] : -1; | ||
| return in_array( $normalized_neve_tier, array( 2, 3 ), true ); |
| private function should_show_business_agency_promo_text() { | ||
| $license_data = License::get_license_data(); | ||
| $license_key = isset( $license_data->key ) ? strtolower( trim( (string) $license_data->key ) ) : ''; | ||
| $license_tier = License::get_license_tier( 0 ); | ||
| $raw_tier = isset( $license_data->tier ) ? absint( $license_data->tier ) : 0; | ||
| $neve_plan = apply_filters( 'product_neve_license_plan', -1 ); | ||
|
|
| <EditorSelector /> | ||
| </div> | ||
| <Filters /> | ||
| <OnboardingPromoNotice /> |
Summary
dismiss_onboarding_promo_notice) and stored in plugin options.request a sitemailto CTA./wp-admin.Will affect visual aspect of the product
YES
Screenshots
Free/personal plan usersBusiness/agency UsersTest instructions
request a sitemailto link.Check before Pull Request is ready:
Closes #.