Merge remote-tracking branch 'origin/trunk' into add/reviews-into-marketplace-product-card

This commit is contained in:
Timur Gogolev 2021-10-14 14:18:59 +03:00
commit 5b28b29dbd
9 changed files with 302 additions and 46 deletions

View File

@ -809,21 +809,27 @@
}
.storefront {
max-width: 990px;
background: url(../images/storefront-bg.jpg) bottom right #f6f6f6;
border: 1px solid #ddd;
margin-top: 1em;
padding: 20px;
margin: 1em auto;
padding: 24px;
overflow: hidden;
zoom: 1;
img {
width: 278px;
display: block;
width: 100%;
max-width: 400px;
height: auto;
float: left;
margin: 0 20px 0 0;
margin: 0 auto 16px;
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
}
p:last-of-type {
margin-bottom: 0;
}
p {
max-width: 750px;
}
@ -7746,5 +7752,18 @@ table.bar_chart {
.marketplace-header {
padding-left: 84px;
}
.storefront {
h2 {
margin-top: 0;
}
img {
float: left;
margin: 0 16px 0 auto;
width: 278px;
}
}
}
}

View File

@ -1,5 +1,78 @@
== Changelog ==
= 5.8.0 2021-10-12 =
**WooCommerce**
* Add - `modified_before` and `modified_after` filtering parameters to REST API for products, orders and coupons. #30585
* Add - `woocommerce_quantity_input_min_admin` and `woocommerce_quantity_input_step_admin` filters. #30705
* Dev - Action Scheduler updated to 3.3.0. #30719
* Dev - Add order argument to `woocommerce_order_actions` filter. #30475
* Fix - During product quick edit, the featured setting is sometimes not shown correctly as checked. #30639
* Fix - Offsets not calculated correctly sometimes on select2 dropdowns causing usability issues. #30690
* Fix - Select2 dropdown search input not getting focus when select2 dropdown element gets focused. #30626
* Tweak - Add individual item remove notices based on the context of the line item in the order. #30650
* Tweak - Change the shop page summary which was not relevant to the public. #30573
* Tweak - Deleted unneeded double spaces in text strings. #30487
* Tweak - Open Browse all extensions link in a new tab. #30640
** WooCommerce Admin - 2.7.1 & 2.7.2**
* Fix - Fix analytics crashing on daylight saving. #7763
* Fix - Allow super admins all capabilities within WooCommerce Admin. #7489
* Fix - Fix end date for last periods. #6584
* Fix - Fix up onboarding profiler not working when opted out of tracking. #7490
* Fix - Making Business Details sticky in onboarding wizard. #7426
* Fix - Missing RTL for onboarding styles. #7531
* Fix - Skip scheduling action if Action Scheduler tables have not been set up. #7521
* Fix - Update country region typeahead for better autofill support. #7497
* Fix - Use installable extensions for local state versus free extensions. #7585
* Fix - Fix fatal error and unrelated results in analytics. #7682
* Fix - Harden the reports directory. #7691
* Fix - Update task-item logic to only display content when expanded is true. #7611
* Add - Show Pinterest in installed marketing extensions (if installed). #7417
* Add - Added MailchimpScheduler that runs daily to subscribe store_email in the profile data. #7579
* Add - Added shipping plugin recommendations to settings page. #7446
* Add - Adding endpoint to snooze onboarding task. #7539
* Add - Adding undo snooze task endpoint. #7560
* Add - Add task dismissal endpoints. #7538
* Update - Add HK and SG countries to WC Pay intl support. #7558
* Update - Create task list REST API endpoint. #7512
* Update - Deleted OnboardingEmailMarketing note class. #7595
* Update - Removes the use of the depreciated woocommerce_shared_settings hook. #7480
* Update - Removes non WooCommerce Admin specific settings from the `wc_admin` namespace in the `wc/data` settings store (ex: countries). #7480
* Update - Updating eway logo in payment suggestions defaults. #7562
* Update - Update marketing task completion logic. #7586
* Dev - Add email address field to OBW. #7552
* Tweak - Add navigation items for the Marketplace menu. #7529
* Tweak - Change all analytics strings and labels to sentence case. #6501
* Tweak - Delete unneeded double spaces in text strings. #7502
* Tweak - Remove the preloaded onboarding options. #7338
* Tweak - Update analytics card header text styles. #6506
* Enhancement - Align Table fields with the fallback on isNumeric. #7431
**WooCommerce Blocks - 5.7.1 & 5.8.0 & 5.9.0 & 5.9.1**
* Add - Extensibility point for extensions to filter payment methods. #4668
* Add - "Filter Products by Stock" block. #4145
* Add - Introduced the `__experimental_woocommerce_blocks_checkout_update_order_from_request` hook to the Checkout Store API. #4610.
* Fix - Add label element to `<BlockTitle>` component. #4585
* Fix - Disable Cart, Checkout, All Products & filters blocks from the widgets screen.
* Fix - Infinite recursion when removing an attribute filter from the Active filters block. #4816
* Fix - Prevent Product Category List from displaying incorrectly when used on the shop page. #4587
* Fix - Product Search block displaying incorrectly. #4740
* Tweak - Add Extensibility info to Store API readme. #4605
* Tweak - Update documentation for the snackbarNoticeVisibility filter. #4508
* Tweak - Add documentation for `extensionCartUpdate` method - this allows extensions to update the client-side cart after it has been modified on the server. #4377
**Action Scheduler 3.3.0**
* Enhancement - Adds as_has_scheduled_action() to provide a performant way to test for existing actions. #645
* Dev - Now supports queries that use multiple statuses. #649
* Dev - Minimum requirements for WordPress and PHP bumped (to 5.2 and 5.6 respectively). #723
* Fix - Improves compatibility with environments where NO_ZERO_DATE is enabled. #519
* Fix - Adds safety checks to guard against errors when our database tables cannot be created. #645
= 5.7.1 2021-09-23 =
**WooCommerce**

2
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "f694e88349087e677d5ae262107235de",
"content-hash": "ed397d52c25da204154232b3dd4b529f",
"packages": [
{
"name": "automattic/jetpack-autoloader",

View File

@ -7,6 +7,7 @@
*/
use Automattic\Jetpack\Constants;
use Automattic\WooCommerce\Admin\RemoteInboxNotifications as PromotionRuleEngine;
if ( ! defined( 'ABSPATH' ) ) {
exit;
@ -81,10 +82,10 @@ class WC_Admin_Addons {
* @param string $term Search terms.
* @param string $country Store country.
*
* @return array of extensions
* @return object of extensions and promotions.
*/
public static function get_extension_data( $category, $term, $country ) {
$parameters = self::build_parameter_string( $category, $term, $country );
$parameters = self::build_parameter_string( $category, $term, $country );
$headers = array();
$auth = WC_Helper_Options::get( 'auth' );
@ -99,7 +100,7 @@ class WC_Admin_Addons {
);
if ( ! is_wp_error( $raw_extensions ) ) {
$addons = json_decode( wp_remote_retrieve_body( $raw_extensions ) )->products;
$addons = json_decode( wp_remote_retrieve_body( $raw_extensions ) );
}
return $addons;
}
@ -522,6 +523,37 @@ class WC_Admin_Addons {
<?php
}
/**
* Output the HTML for the promotion block.
*
* @param array $promotion Array of promotion block data.
* @return void
*/
public static function output_search_promotion_block( array $promotion ) {
?>
<div class="addons-wcs-banner-block">
<div class="addons-wcs-banner-block-image">
<img
class="addons-img"
src="<?php echo esc_url( $promotion['image'] ); ?>"
alt="<?php echo esc_attr( $promotion['image_alt'] ); ?>"
/>
</div>
<div class="addons-wcs-banner-block-content">
<h1><?php echo esc_html( $promotion['title'] ); ?></h1>
<p><?php echo esc_html( $promotion['description'] ); ?></p>
<?php
if ( ! empty( $promotion['actions'] ) ) {
foreach ( $promotion['actions'] as $action ) {
self::output_promotion_action( $action );
}
}
?>
</div>
</div>
<?php
}
/**
* Handles the output of a full-width block.
*
@ -563,7 +595,6 @@ class WC_Admin_Addons {
</div>
<div class="addons-promotion-block-buttons">
<?php
if ( $section['button_1'] ) {
self::output_button(
$section['button_1_href'],
@ -581,7 +612,6 @@ class WC_Admin_Addons {
$section['plugin']
);
}
?>
</div>
</div>
@ -680,6 +710,26 @@ class WC_Admin_Addons {
<?php
}
/**
* Output HTML for a promotion action.
*
* @param array $action Array of action properties.
* @return void
*/
public static function output_promotion_action( array $action ) {
if ( empty( $action ) ) {
return;
}
$style = ( ! empty( $action['primary'] ) && $action['primary'] ) ? 'addons-button-solid' : 'addons-button-outline-purple';
?>
<a
class="addons-button <?php echo esc_attr( $style ); ?>"
href="<?php echo esc_url( $action['url'] ); ?>">
<?php echo esc_html( $action['label'] ); ?>
</a>
<?php
}
/**
* Handles output of the addons page in admin.
@ -710,13 +760,33 @@ class WC_Admin_Addons {
$sections = self::get_sections();
$theme = wp_get_theme();
$current_section = isset( $_GET['section'] ) ? $section : '_featured';
$promotions = array();
$addons = array();
if ( '_featured' !== $current_section ) {
$category = $section ? $section : null;
$term = $search ? $search : null;
$country = WC()->countries->get_base_country();
$addons = self::get_extension_data( $category, $term, $country );
$category = $section ? $section : null;
$term = $search ? $search : null;
$country = WC()->countries->get_base_country();
$extension_data = self::get_extension_data( $category, $term, $country );
$addons = $extension_data->products;
$promotions = ! empty( $extension_data->promotions ) ? $extension_data->promotions : array();
}
// We need Automattic\WooCommerce\Admin\RemoteInboxNotifications for the next part, if not remove all promotions.
if ( ! WC()->is_wc_admin_active() ) {
$promotions = array();
}
// Check for existence of promotions and evaluate out if we should show them.
if ( ! empty( $promotions ) ) {
foreach ( $promotions as $promo_id => $promotion ) {
$evaluator = new PromotionRuleEngine\RuleEvaluator();
$passed = $evaluator->evaluate( $promotion->rules );
if ( ! $passed ) {
unset( $promotions[ $promo_id ] );
}
}
// Transform promotions to the correct format ready for output.
$promotions = self::format_promotions( $promotions );
}
/**
@ -845,4 +915,73 @@ class WC_Admin_Addons {
// Don't show a golden star otherwise.
return 'no-fill';
}
/**
* Take an action object and return the URL based on properties of the action.
*
* @param object $action Action object.
* @return string URL.
*/
public static function get_action_url( $action ): string {
if ( ! isset( $action->url ) ) {
return '';
}
if ( isset( $action->url_is_admin_query ) && $action->url_is_admin_query ) {
return wc_admin_url( $action->url );
}
if ( isset( $action->url_is_admin_nonce_query ) && $action->url_is_admin_nonce_query ) {
if ( empty( $action->nonce ) ) {
return '';
}
return wp_nonce_url(
admin_url( $action->url ),
$action->nonce
);
}
return $action->url;
}
/**
* Format the promotion data ready for display, ie fetch locales and actions.
*
* @param array $promotions Array of promotoin objects.
* @return array Array of formatted promotions ready for output.
*/
public static function format_promotions( array $promotions ): array {
$formatted_promotions = array();
foreach ( $promotions as $promotion ) {
// Get the matching locale or fall back to en-US.
$locale = PromotionRuleEngine\SpecRunner::get_locale( $promotion->locales );
if ( null === $locale ) {
continue;
}
$promotion_actions = array();
if ( ! empty( $promotion->actions ) ) {
foreach ( $promotion->actions as $action ) {
$action_locale = PromotionRuleEngine\SpecRunner::get_action_locale( $action->locales );
$url = self::get_action_url( $action );
$promotion_actions[] = array(
'name' => $action->name,
'label' => $action_locale->label,
'url' => $url,
'primary' => isset( $action->is_primary ) ? $action->is_primary : false,
);
}
}
$formatted_promotions[] = array(
'title' => $locale->title,
'description' => $locale->description,
'image' => ( 'http' === substr( $locale->image, 0, 4 ) ) ? $locale->image : WC()->plugin_url() . $locale->image,
'image_alt' => $locale->image_alt,
'actions' => $promotion_actions,
);
}
return $formatted_promotions;
}
}

View File

@ -5,8 +5,11 @@
* @package WooCommerce\Admin
* @var string $view
* @var object $addons
* @var object $promotions
*/
use Automattic\WooCommerce\Admin\RemoteInboxNotifications as PromotionRuleEngine;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -81,16 +84,13 @@ $current_section_name = __( 'Browse Categories', 'woocommerce' );
</div>
<?php endif; ?>
<?php if ( '_featured' !== $current_section && $addons ) : ?>
<?php if ( 'shipping_methods' === $current_section ) : ?>
<div class="addons-shipping-methods">
<?php WC_Admin_Addons::output_wcs_banner_block(); ?>
</div>
<?php endif; ?>
<?php if ( 'payment-gateways' === $current_section ) : ?>
<div class="addons-shipping-methods">
<?php WC_Admin_Addons::output_wcpay_banner_block(); ?>
</div>
<?php endif; ?>
<?php
if ( ! empty( $promotions ) && WC()->is_wc_admin_active() ) {
foreach ( $promotions as $promotion ) {
WC_Admin_Addons::output_search_promotion_block( $promotion );
}
}
?>
<ul class="products">
<?php foreach ( $addons as $addon ) : ?>
<?php
@ -200,13 +200,16 @@ $current_section_name = __( 'Browse Categories', 'woocommerce' );
<?php endif; ?>
<?php if ( 'Storefront' !== $theme['Name'] && '_featured' !== $current_section ) : ?>
<?php
$storefront_url = WC_Admin_Addons::add_in_app_purchase_url_params( 'https://woocommerce.com/storefront/?utm_source=extensionsscreen&utm_medium=product&utm_campaign=wcaddon' );
?>
<div class="storefront">
<a href="<?php echo esc_url( 'https://woocommerce.com/storefront/' ); ?>" target="_blank"><img src="<?php echo esc_url( WC()->plugin_url() ); ?>/assets/images/storefront.png" alt="<?php esc_attr_e( 'Storefront', 'woocommerce' ); ?>" /></a>
<a href="<?php echo esc_url( $storefront_url ); ?>" target="_blank"><img src="<?php echo esc_url( WC()->plugin_url() ); ?>/assets/images/storefront.png" alt="<?php esc_attr_e( 'Storefront', 'woocommerce' ); ?>" /></a>
<h2><?php esc_html_e( 'Looking for a WooCommerce theme?', 'woocommerce' ); ?></h2>
<p><?php echo wp_kses_post( __( 'We recommend Storefront, the <em>official</em> WooCommerce theme.', 'woocommerce' ) ); ?></p>
<p><?php echo wp_kses_post( __( 'Storefront is an intuitive, flexible and <strong>free</strong> WordPress theme offering deep integration with WooCommerce and many of the most popular customer-facing extensions.', 'woocommerce' ) ); ?></p>
<p>
<a href="https://woocommerce.com/storefront/" target="_blank" class="button"><?php esc_html_e( 'Read all about it', 'woocommerce' ); ?></a>
<a href="<?php echo esc_url( $storefront_url ); ?>" target="_blank" class="button"><?php esc_html_e( 'Read all about it', 'woocommerce' ); ?></a>
<a href="<?php echo esc_url( wp_nonce_url( self_admin_url( 'update.php?action=install-theme&theme=storefront' ), 'install-theme_storefront' ) ); ?>" class="button button-primary"><?php esc_html_e( 'Download &amp; install', 'woocommerce' ); ?></a>
</p>
</div>

View File

@ -915,6 +915,12 @@ add_action( 'woocommerce_order_status_cancelled', 'wc_update_coupon_usage_counts
function wc_cancel_unpaid_orders() {
$held_duration = get_option( 'woocommerce_hold_stock_minutes' );
// Re-schedule the event before cancelling orders
// this way in case of a DB timeout or (plugin) crash the event is always scheduled for retry.
wp_clear_scheduled_hook( 'woocommerce_cancel_unpaid_orders' );
$cancel_unpaid_interval = apply_filters( 'woocommerce_cancel_unpaid_orders_interval_minutes', absint( $held_duration ) );
wp_schedule_single_event( time() + ( absint( $cancel_unpaid_interval ) * 60 ), 'woocommerce_cancel_unpaid_orders' );
if ( $held_duration < 1 || 'yes' !== get_option( 'woocommerce_manage_stock' ) ) {
return;
}
@ -931,9 +937,6 @@ function wc_cancel_unpaid_orders() {
}
}
}
wp_clear_scheduled_hook( 'woocommerce_cancel_unpaid_orders' );
$cancel_unpaid_interval = apply_filters( 'woocommerce_cancel_unpaid_orders_interval_minutes', absint( $held_duration ) );
wp_schedule_single_event( time() + ( absint( $cancel_unpaid_interval ) * 60 ), 'woocommerce_cancel_unpaid_orders' );
}
add_action( 'woocommerce_cancel_unpaid_orders', 'wc_cancel_unpaid_orders' );

View File

@ -4,7 +4,7 @@ Tags: e-commerce, store, sales, sell, woo, shop, cart, checkout, downloadable, d
Requires at least: 5.6
Tested up to: 5.8
Requires PHP: 7.0
Stable tag: 5.7.1
Stable tag: 5.8.0
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

View File

@ -765,6 +765,26 @@
"dev": true,
"requires": {
"axios": "^0.19.0"
},
"dependencies": {
"axios": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz",
"integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==",
"dev": true,
"requires": {
"follow-redirects": "1.5.10"
}
},
"follow-redirects": {
"version": "1.5.10",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
"dev": true,
"requires": {
"debug": "=3.1.0"
}
}
}
},
"@types/node": {
@ -988,11 +1008,11 @@
"dev": true
},
"axios": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz",
"integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==",
"version": "0.21.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.2.tgz",
"integrity": "sha512-87otirqUw3e8CzHTMO+/9kh/FSgXt/eVDvipijwDtEuwbkySWZ9SBm6VEubmJ/kLKEoLQV/POhxXFb66bfekfg==",
"requires": {
"follow-redirects": "1.5.10"
"follow-redirects": "^1.14.0"
}
},
"babel-jest": {
@ -1492,6 +1512,7 @@
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"dev": true,
"requires": {
"ms": "2.0.0"
}
@ -1889,12 +1910,9 @@
}
},
"follow-redirects": {
"version": "1.5.10",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
"requires": {
"debug": "=3.1.0"
}
"version": "1.14.4",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.4.tgz",
"integrity": "sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g=="
},
"for-in": {
"version": "1.0.2",
@ -3249,7 +3267,8 @@
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"dev": true
},
"nanomatch": {
"version": "1.2.13",
@ -4494,9 +4513,9 @@
"dev": true
},
"tmpl": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz",
"integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=",
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
"integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==",
"dev": true
},
"to-fast-properties": {

View File

@ -34,7 +34,7 @@
"test": "jest"
},
"dependencies": {
"axios": "0.19.2",
"axios": "0.21.2",
"create-hmac": "1.1.7",
"oauth-1.0a": "2.2.6"
},