Skip to content

Commit

Permalink
Merge branch 'trunk' into update/plugins-search-category-selected
Browse files Browse the repository at this point in the history
  • Loading branch information
WBerredo committed Jul 5, 2023
2 parents 5f1cf5d + 76d9365 commit 739d272
Show file tree
Hide file tree
Showing 232 changed files with 3,134 additions and 1,393 deletions.
5 changes: 0 additions & 5 deletions apps/blaze-dashboard/src/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ async function AppBoot() {
// To do this, we are showing the correct version of the path (after fixing it)
page.show( fixPath( window.location.hash ) );
} );

// Disable conflicting Jetpack stylesheets
document.querySelectorAll( 'link#forms-css' ).forEach( ( item ) => {
item.disabled = true;
} );
}

AppBoot();
2 changes: 1 addition & 1 deletion apps/blaze-dashboard/src/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

.section-nav-tab {
&.is-selected {
height: 36px;
height: 36px !important;
}

.section-nav-tab__link {
Expand Down
63 changes: 61 additions & 2 deletions apps/blaze-dashboard/src/styles/promote-widget.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,68 @@
// Overrides styles for the Create campaign widget
.blazepress-widget {
div.MuiPopover-root,
div.MuiPickersPopper-root,
div.MuiDialog-root,
div.MuiModal-root {
z-index: 99999;
}

// Fixes double scrolls on widget creation overlay
html.has-blank-canvas body {
html.has-blank-canvas {
overflow: hidden;
body {
overflow: hidden;
}
}
.blazepress-widget {
z-index: 99999;

// Fix conflict with the WP forms-css file
input[type="text"],
input[type="password"],
input[type="color"],
input[type="date"],
input[type="datetime"],
input[type="datetime-local"],
input[type="email"],
input[type="month"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="time"],
input[type="url"],
input[type="week"],
select {
box-shadow: none;
border-radius: 0;
border: none;
background-color: inherit;
color: currentcolor;

padding: 16.5px 14px;
line-height: inherit;
min-height: inherit;

&:focus {
outline: none;
}
}
textarea {
box-shadow: none;
border-radius: 0;
border: none;
background-color: inherit;
color: currentcolor;

padding: 0;
line-height: inherit;
min-height: inherit;
height: auto;

&:focus {
outline: none;
}
}
input.MuiInputBase-inputAdornedStart {
padding: 0;
}
}
Original file line number Diff line number Diff line change
@@ -1,31 +1,56 @@
import { localizeUrl } from '@automattic/i18n-utils';
import { addFilter } from '@wordpress/hooks';
import './style.css';

declare global {
interface Window {
_currentSiteId: number;
_currentSiteType: string;
wpcomDocumentationLinksLocale: string;
}
}

function overrideCoreDocumentationLinksToWpcom( translation: string, text: string ) {
switch ( text ) {
case 'https://wordpress.org/support/article/excerpt/':
case 'https://wordpress.org/support/article/settings-sidebar/#excerpt':
return 'https://wordpress.com/support/excerpts/';
case 'https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt':
return localizeUrl(
'https://wordpress.com/support/excerpts/',
window.wpcomDocumentationLinksLocale
);
case 'https://wordpress.org/support/article/writing-posts/#post-field-descriptions':
case 'https://wordpress.org/support/article/settings-sidebar/#permalink':
return 'https://wordpress.com/support/permalinks-and-slugs/';
case 'https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink':
return localizeUrl(
'https://wordpress.com/support/permalinks-and-slugs/',
window.wpcomDocumentationLinksLocale
);
case 'https://wordpress.org/support/article/wordpress-editor/':
return 'https://wordpress.com/support/wordpress-editor/';
return localizeUrl(
'https://wordpress.com/support/wordpress-editor/',
window.wpcomDocumentationLinksLocale
);
case 'https://wordpress.org/support/article/site-editor/':
return 'https://wordpress.com/support/site-editor/';
return localizeUrl(
'https://wordpress.com/support/site-editor/',
window.wpcomDocumentationLinksLocale
);
case 'https://wordpress.org/support/article/block-based-widgets-editor/':
return 'https://wordpress.com/support/widgets/';
return localizeUrl(
'https://wordpress.com/support/widgets/',
window.wpcomDocumentationLinksLocale
);
case 'https://wordpress.org/plugins/classic-widgets/':
return 'https://wordpress.com/plugins/classic-widgets';
return localizeUrl(
'https://wordpress.com/plugins/classic-widgets',
window.wpcomDocumentationLinksLocale
);
case 'https://wordpress.org/support/article/styles-overview/':
return 'https://wordpress.com/support/using-styles/';
return localizeUrl(
'https://wordpress.com/support/using-styles/',
window.wpcomDocumentationLinksLocale
);
}

return translation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,22 @@ function wpcom_global_styles_enqueue_block_editor_assets() {
true
);
wp_set_script_translations( 'wpcom-global-styles-editor', 'full-site-editing' );
$is_global_styles_in_personal_plan = wpcom_site_has_global_styles_in_personal_plan();
$plan = $is_global_styles_in_personal_plan ? 'personal-bundle' : 'value_bundle';

$reset_global_styles_support_url = 'https://wordpress.com/support/using-styles/#reset-all-styles';
if ( class_exists( 'WPCom_Languages' ) ) {
$reset_global_styles_support_url = WPCom_Languages::localize_url( $reset_global_styles_support_url );
}
wp_localize_script(
'wpcom-global-styles-editor',
'wpcomGlobalStyles',
array(
'assetsUrl' => plugins_url( 'dist/', __FILE__ ),
'upgradeUrl' => "$calypso_domain/plans/$site_slug?plan=value_bundle&feature=style-customization",
'wpcomBlogId' => wpcom_global_styles_get_wpcom_current_blog_id(),
'assetsUrl' => plugins_url( 'dist/', __FILE__ ),
'upgradeUrl' => "$calypso_domain/plans/$site_slug?plan=$plan&feature=style-customization",
'wpcomBlogId' => wpcom_global_styles_get_wpcom_current_blog_id(),
'globalStylesInPersonalPlan' => $is_global_styles_in_personal_plan,
'resetGlobalStylesSupportUrl' => $reset_global_styles_support_url,
)
);
wp_enqueue_style(
Expand Down Expand Up @@ -427,7 +436,8 @@ function wpcom_display_global_styles_launch_bar( $bar_controls ) {
$site_slug = wp_parse_url( $home_url, PHP_URL_HOST );
}

$upgrade_url = 'https://wordpress.com/plans/' . $site_slug . '?plan=value_bundle&feature=style-customization';
$plan = wpcom_site_has_global_styles_in_personal_plan() ? 'personal-bundle' : 'value_bundle';
$upgrade_url = "https://wordpress.com/plans/$site_slug?plan=$plan&feature=style-customization";

if ( wpcom_is_previewing_global_styles() ) {
$preview_location = add_query_arg( 'hide-global-styles', '' );
Expand Down Expand Up @@ -464,11 +474,26 @@ function wpcom_display_global_styles_launch_bar( $bar_controls ) {
</div>
<div class="launch-bar-global-styles-message">
<?php
$message = sprintf(
// @TODO Remove after global styles on personal plans A/B test is complete.
if ( wpcom_site_has_global_styles_in_personal_plan() ) {
$message = sprintf(
/* translators: %s - documentation URL. */
__( 'Your site includes <a href="%s" target="_blank">customized styles</a> that are only visible to visitors after upgrading to the Premium plan or higher.', 'full-site-editing' ),
'https://wordpress.com/support/using-styles/'
);
__(
'Your site includes <a href="%s" target="_blank">customized styles</a> that are only visible to visitors after upgrading to the Personal plan or higher.',
'full-site-editing'
),
'https://wordpress.com/support/using-styles/'
);
} else {
$message = sprintf(
/* translators: %s - documentation URL. */
__(
'Your site includes <a href="%s" target="_blank">customized styles</a> that are only visible to visitors after upgrading to the Premium plan or higher.',
'full-site-editing'
),
'https://wordpress.com/support/using-styles/'
);
}
echo sprintf(
wp_kses(
$message,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { useGlobalStylesConfig } from './use-global-styles-config';
import { usePreview } from './use-preview';
import './notice.scss';

const GLOBAL_STYLES_TREATMENT_GROUP = '1';

const trackEvent = ( eventName, isSiteEditor = true ) =>
recordTracksEvent( eventName, {
context: isSiteEditor ? 'site-editor' : 'post-editor',
Expand All @@ -28,25 +30,32 @@ function GlobalStylesWarningNotice() {
return null;
}

let upgradeTranslation;
if ( wpcomGlobalStyles?.globalStylesInPersonalPlan === GLOBAL_STYLES_TREATMENT_GROUP ) {
upgradeTranslation = __(
'Your site includes customized styles that are only visible to visitors after <a>upgrading to the Personal plan or higher</a>.',
'full-site-editing'
);
} else {
upgradeTranslation = __(
'Your site includes customized styles that are only visible to visitors after <a>upgrading to the Premium plan or higher</a>.',
'full-site-editing'
);
}

return (
<Notice status="warning" isDismissible={ false } className="wpcom-global-styles-notice">
{ createInterpolateElement(
__(
'Your site includes customized styles that are only visible to visitors after <a>upgrading to the Premium plan or higher</a>.',
'full-site-editing'
{ createInterpolateElement( upgradeTranslation, {
a: (
<ExternalLink
href={ wpcomGlobalStyles.upgradeUrl }
target="_blank"
onClick={ () =>
trackEvent( 'calypso_global_styles_gating_notice_view_canvas_upgrade_click' )
}
/>
),
{
a: (
<ExternalLink
href={ wpcomGlobalStyles.upgradeUrl }
target="_blank"
onClick={ () =>
trackEvent( 'calypso_global_styles_gating_notice_view_canvas_upgrade_click' )
}
/>
),
}
) }
} ) }
</Notice>
);
}
Expand Down Expand Up @@ -117,7 +126,7 @@ function GlobalStylesEditNotice() {
}, [ editEntityRecord, globalStylesId, isSiteEditor ] );

const openResetGlobalStylesSupport = useCallback( () => {
window.open( 'https://wordpress.com/support/using-styles/#reset-all-styles', '_blank' ).focus();
window.open( wpcomGlobalStyles.resetGlobalStylesSupportUrl, '_blank' ).focus();
trackEvent( 'calypso_global_styles_gating_notice_reset_support_click', isSiteEditor );
}, [ isSiteEditor ] );

Expand Down Expand Up @@ -152,16 +161,29 @@ function GlobalStylesEditNotice() {
: 'wpcom-global-styles-action-has-icon wpcom-global-styles-action-is-external wpcom-global-styles-action-is-support',
} );

createWarningNotice(
__(
'Your site includes customized styles that are only visible to visitors after upgrading to the Premium plan or higher.',
'full-site-editing'
),
{
id: NOTICE_ID,
actions: actions,
}
);
if ( wpcomGlobalStyles?.globalStylesInPersonalPlan === GLOBAL_STYLES_TREATMENT_GROUP ) {
createWarningNotice(
__(
'Your site includes customized styles that are only visible to visitors after upgrading to the Personal plan or higher.',
'full-site-editing'
),
{
id: NOTICE_ID,
actions: actions,
}
);
} else {
createWarningNotice(
__(
'Your site includes customized styles that are only visible to visitors after upgrading to the Premium plan or higher.',
'full-site-editing'
),
{
id: NOTICE_ID,
actions: actions,
}
);
}

trackEvent( 'calypso_global_styles_gating_notice_show', isSiteEditor );
}, [
Expand Down
21 changes: 21 additions & 0 deletions client/blocks/jetpack-benefits/feature-checks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import {
PRODUCT_JETPACK_VIDEOPRESS,
PRODUCT_JETPACK_VIDEOPRESS_MONTHLY,
FEATURE_CLOUD_CRITICAL_CSS,
isJetpackStatsSlug,
isJetpackStatsPaidProductSlug,
} from '@automattic/calypso-products';

export const productHasBackups = ( productSlug: string ): boolean => {
Expand Down Expand Up @@ -77,6 +79,25 @@ export const productHasSearch = ( productSlug: string ): boolean => {
);
};

export const productHasStats = ( productSlug: string, onlyPaid = false ): boolean => {
// Check for standalone stats product
if ( isJetpackStatsSlug( productSlug ) ) {
return ! onlyPaid || isJetpackStatsPaidProductSlug( productSlug );
}
// Check for stats features in plans
if ( isJetpackPlanSlug( productSlug ) && onlyPaid ) {
return planHasAtLeastOneFeature( productSlug, [
/** TODO: STATS PAID FEATURE NAME */
] );
}
if ( isJetpackPlanSlug( productSlug ) && ! onlyPaid ) {
return planHasAtLeastOneFeature( productSlug, [
/** TODO: STATS FEATURE NAME */
] );
}
return false;
};

export const productHasAntiSpam = ( productSlug: string ): boolean => {
const ANTISPAM_FEATURES = [ FEATURE_JETPACK_ANTI_SPAM, FEATURE_JETPACK_ANTI_SPAM_MONTHLY ];

Expand Down
Loading

0 comments on commit 739d272

Please sign in to comment.