Skip to content

Commit

Permalink
Merge branch 'trunk' into update/sync-hpos-checksum-fields-to-consider
Browse files Browse the repository at this point in the history
  • Loading branch information
darssen committed Aug 5, 2024
2 parents 2f34725 + 01f5401 commit 4a69fe8
Show file tree
Hide file tree
Showing 28 changed files with 327 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const ConnectedProductCard: FC< ConnectedProductCardProps > = ( {
const cardDescription = defaultDescription.replace( /\s(?=[^\s]*$)/, '\u00A0' );

return (
<Text variant="body-small" style={ { flexGrow: 1 } }>
<Text variant="body-small" style={ { flexGrow: 1, marginBottom: '1rem' } }>
{ cardDescription }
</Text>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const BackupCard = props => {
return hasBackups ? (
<WithBackupsValueSection slug={ slug } { ...props } />
) : (
<NoBackupsValueSection slug={ slug } { ...props } />
<ProductCard slug={ slug } { ...props } />
);
};

Expand Down Expand Up @@ -194,6 +194,7 @@ const WithBackupsValueSection = props => {
);
};

// DEPRECATED: this output was more confusing than helpful
const NoBackupsValueSection = props => {
const { data: backupStats, isLoading } = useSimpleQuery( {
name: QUERY_BACKUP_STATS_KEY,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
import { useCallback, type FC } from 'react';
import { type FC } from 'react';
import ProductCard from '../../connected-product-card';
import ProtectValueSection from './protect-value-section';

const ProtectCard: FC< { admin: boolean; recommendation?: boolean } > = props => {
const slug = 'protect';

// This is a workaround to remove the Description from the product card. However if we end
// up needing to remove the Description from additional cards in the future, we might consider
// extending <ProductCard /> functionality to support that.
const noDescription = useCallback( () => null, [] );

return (
<ProductCard
{ ...props }
slug={ slug }
upgradeInInterstitial={ true }
Description={ noDescription }
>
<ProductCard { ...props } slug={ slug } upgradeInInterstitial={ true }>
<ProtectValueSection />
</ProductCard>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

copy updates
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static function get_title() {
* @return string
*/
public static function get_description() {
return __( 'Stop comment and form spam', 'jetpack-my-jetpack' );
return __( 'Keep your site free from spam and bots', 'jetpack-my-jetpack' );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/my-jetpack/src/products/class-backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static function get_description() {
return __( 'Save every change', 'jetpack-my-jetpack' );
}

return __( 'Your site is not backed up', 'jetpack-my-jetpack' );
return __( 'Secure your site with automatic backups and one-click restores', 'jetpack-my-jetpack' );
}

/**
Expand Down
4 changes: 2 additions & 2 deletions projects/packages/my-jetpack/src/products/class-boost.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static function get_title() {
* @return string
*/
public static function get_description() {
return __( 'Speed up your site in seconds', 'jetpack-my-jetpack' );
return __( 'Speed up your site and improve SEO in seconds', 'jetpack-my-jetpack' );
}

/**
Expand All @@ -98,7 +98,7 @@ public static function get_description() {
* @return string
*/
public static function get_long_description() {
return __( 'Jetpack Boost gives your site the same performance advantages as the world’s leading websites, no developer required.', 'jetpack-my-jetpack' );
return __( 'Fast sites get more page visits, more conversions, and better SEO rankings. Boost speeds up your site in seconds.', 'jetpack-my-jetpack' );
}

/**
Expand Down
4 changes: 2 additions & 2 deletions projects/packages/my-jetpack/src/products/class-creator.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static function get_title() {
* @return string
*/
public static function get_description() {
return __( 'Create, grow, and monetize your audience', 'jetpack-my-jetpack' );
return __( 'Get more subscribers and keep them engaged with our creator tools', 'jetpack-my-jetpack' );
}

/**
Expand All @@ -89,7 +89,7 @@ public static function get_description() {
* @return string
*/
public static function get_long_description() {
return __( 'Create, grow, and monetize your audience with powerful tools for creators.', 'jetpack-my-jetpack' );
return __( 'Craft stunning content, boost your subscriber base, and monetize your audience with subscriptions.', 'jetpack-my-jetpack' );
}

/**
Expand Down
4 changes: 2 additions & 2 deletions projects/packages/my-jetpack/src/products/class-crm.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static function get_title() {
* @return string
*/
public static function get_description() {
return __( 'Nurture your contacts to grow your business', 'jetpack-my-jetpack' );
return __( 'Strengthen customer relationships and grow your business', 'jetpack-my-jetpack' );
}

/**
Expand All @@ -93,7 +93,7 @@ public static function get_description() {
* @return string
*/
public static function get_long_description() {
return __( 'All of your contacts in one place. Build better relationships with your customers and clients.', 'jetpack-my-jetpack' );
return __( 'Build better relationships with your customers and grow your business.', 'jetpack-my-jetpack' );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public static function get_next_usage_tier() {
* @return string
*/
public static function get_description() {
return __( 'The most powerful AI tool for WordPress', 'jetpack-my-jetpack' );
return __( 'Enhance your writing and productivity with our AI suite', 'jetpack-my-jetpack' );
}

/**
Expand Down
4 changes: 2 additions & 2 deletions projects/packages/my-jetpack/src/products/class-protect.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static function get_title() {
* @return string
*/
public static function get_description() {
return __( 'Powerful, automated site security', 'jetpack-my-jetpack' );
return __( 'Guard against malware and bad actors 24/7', 'jetpack-my-jetpack' );
}

/**
Expand All @@ -101,7 +101,7 @@ public static function get_description() {
* @return string
*/
public static function get_long_description() {
return __( 'Protect your site and scan for security vulnerabilities listed in our database.', 'jetpack-my-jetpack' );
return __( 'Protect your site from bad actors and malware 24/7. Clean up security vulnerabilities with one click.', 'jetpack-my-jetpack' );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/my-jetpack/src/products/class-search.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static function get_title() {
* @return string
*/
public static function get_description() {
return __( 'Custom instant site search', 'jetpack-my-jetpack' );
return __( 'Help your visitors find what they are looking for with instant search results', 'jetpack-my-jetpack' );
}

/**
Expand Down
4 changes: 2 additions & 2 deletions projects/packages/my-jetpack/src/products/class-social.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public static function get_title() {
* @return string
*/
public static function get_description() {
return __( 'Auto-publish to social media', 'jetpack-my-jetpack' );
return __( 'Effortlessly share content across social media. Right from within WordPress', 'jetpack-my-jetpack' );
}

/**
Expand All @@ -95,7 +95,7 @@ public static function get_description() {
* @return string
*/
public static function get_long_description() {
return __( 'Promote your content on social media by automatically publishing when you publish on your site.', 'jetpack-my-jetpack' );
return __( 'Grow your following by sharing your content across social media automatically.', 'jetpack-my-jetpack' );
}

/**
Expand Down
4 changes: 2 additions & 2 deletions projects/packages/my-jetpack/src/products/class-stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static function get_title() {
* @return string
*/
public static function get_description() {
return __( 'Simple, yet powerful analytics', 'jetpack-my-jetpack' );
return __( 'The simplest way to track visitor insights and unlock your site’s growth', 'jetpack-my-jetpack' );
}

/**
Expand All @@ -100,7 +100,7 @@ public static function get_description() {
* @return string
*/
public static function get_long_description() {
return __( 'With Jetpack Stats, you don’t need to be a data scientist to see how your site is performing.', 'jetpack-my-jetpack' );
return __( 'With Jetpack Stats, you don’t need to be a data scientist to see how your site is performing, understand your visitors, and grow your site.', 'jetpack-my-jetpack' );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static function get_title() {
* @return string
*/
public static function get_description() {
return __( 'High quality, ad-free video', 'jetpack-my-jetpack' );
return __( 'High-quality, ad-free video built specifically for WordPress', 'jetpack-my-jetpack' );
}

/**
Expand Down
4 changes: 4 additions & 0 deletions projects/packages/sync/changelog/fix-sync-hpos-checksums
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Jetpack Sync: Take order type into account when performing HPOS Checksums
2 changes: 1 addition & 1 deletion projects/packages/sync/src/class-package-version.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
class Package_Version {

const PACKAGE_VERSION = '3.5.0-alpha';
const PACKAGE_VERSION = '3.4.1-alpha';

Check failure on line 15 in projects/packages/sync/src/class-package-version.php

View workflow job for this annotation

GitHub Actions / Changelogger validity

Version mismatch, expected 3.5.0-alpha but found 3.4.1-alpha! Please run `tools/project-version.sh -f -u 3.5.0-alpha packages/sync` or `tools/fixup-project-versions.sh`, commit, and push the generated changes to fix this.

const PACKAGE_SLUG = 'sync';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,11 @@ public function __construct() {
/**
* Get order types that we want to sync. Adding a new type here is not enough, we would also need to add its prop in filter_order_data method.
*
* @access private
*
* @param bool $prefixed Whether to return prefixed types with shop_ or not.
*
* @return array Order types to sync.
*/
private function get_order_types_to_sync( $prefixed = false ) {
public static function get_order_types_to_sync( $prefixed = false ) {
$types = array( 'order', 'order_refund' );
if ( $prefixed ) {
$types = array_map(
Expand All @@ -87,7 +85,7 @@ function ( $type ) {
* @param callable $callable Action handler callable.
*/
public function init_listeners( $callable ) {
foreach ( $this->get_order_types_to_sync() as $type ) {
foreach ( self::get_order_types_to_sync() as $type ) {
add_action( "woocommerce_after_{$type}_object_save", $callable );
add_filter( "jetpack_sync_before_enqueue_woocommerce_after_{$type}_object_save", array( $this, 'expand_order_object' ) );
}
Expand Down Expand Up @@ -167,7 +165,7 @@ public function get_objects_by_id( $object_type, $ids ) {
$orders = wc_get_orders(
array(
'post__in' => $ids,
'type' => $this->get_order_types_to_sync( true ),
'type' => self::get_order_types_to_sync( true ),
'post_status' => $this->get_all_possible_order_status_keys(),
'limit' => -1,
)
Expand Down Expand Up @@ -420,7 +418,7 @@ public function enqueue_full_sync_actions( $config, $max_items_to_enqueue, $stat
public function get_where_sql( $config ) {
global $wpdb;
$parent_where = parent::get_where_sql( $config );
$order_types = $this->get_order_types_to_sync( true );
$order_types = self::get_order_types_to_sync( true );
$order_type_placeholder = implode( ', ', array_fill( 0, count( $order_types ), '%s' ) );
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare -- Query is prepared.
$where_sql = $wpdb->prepare( "type IN ( $order_type_placeholder )", $order_types );
Expand Down
14 changes: 13 additions & 1 deletion projects/packages/sync/src/replicastore/class-table-checksum.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace Automattic\Jetpack\Sync\Replicastore;

use Automattic\Jetpack\Sync;
use Automattic\Jetpack\Sync\Modules\WooCommerce_HPOS_Orders;
use Exception;
use WP_Error;

Expand Down Expand Up @@ -313,14 +314,22 @@ protected function get_default_tables() {
'key_fields' => array( 'id' ),
'checksum_fields' => array( 'date_updated_gmt', 'total_amount' ),
'checksum_text_fields' => array( 'type', 'status' ),
'filter_values' => array(),
'filter_values' => array(
'type' => array(
'operator' => 'IN',
'values' => WooCommerce_HPOS_Orders::get_order_types_to_sync( true ),
),
),
'is_table_enabled_callback' => 'Automattic\Jetpack\Sync\Replicastore\Table_Checksum::enable_woocommerce_hpos_tables',
),
'wc_order_addresses' => array(
'table' => "{$wpdb->prefix}wc_order_addresses",
'range_field' => 'order_id',
'key_fields' => array( 'order_id', 'address_type' ),
'checksum_text_fields' => array( 'address_type' ),
'parent_table' => 'wc_orders',
'parent_join_field' => 'id',
'table_join_field' => 'order_id',
'filter_values' => array(),
'is_table_enabled_callback' => 'Automattic\Jetpack\Sync\Replicastore\Table_Checksum::enable_woocommerce_hpos_tables',
),
Expand All @@ -330,6 +339,9 @@ protected function get_default_tables() {
'key_fields' => array( 'order_id' ),
'checksum_fields' => array( 'date_paid_gmt', 'date_completed_gmt' ),
'checksum_text_fields' => array( 'order_key' ),
'parent_table' => 'wc_orders',
'parent_join_field' => 'id',
'table_join_field' => 'order_id',
'filter_values' => array(),
'is_table_enabled_callback' => 'Automattic\Jetpack\Sync\Replicastore\Table_Checksum::enable_woocommerce_hpos_tables',
),
Expand Down
Loading

0 comments on commit 4a69fe8

Please sign in to comment.