diff --git a/.github/workflows/smoke-test-daily.yml b/.github/workflows/smoke-test-daily.yml index d168350f512..e859ad41ed3 100644 --- a/.github/workflows/smoke-test-daily.yml +++ b/.github/workflows/smoke-test-daily.yml @@ -39,5 +39,4 @@ jobs: E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }} E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }} run: | - npx wc-e2e docker:up npx wc-e2e test:e2e diff --git a/.github/workflows/update-feedback-labels.yml b/.github/workflows/update-feedback-labels.yml index b353c28032d..bb0af46f64b 100644 --- a/.github/workflows/update-feedback-labels.yml +++ b/.github/workflows/update-feedback-labels.yml @@ -20,3 +20,8 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} labels: 'needs feedback' + - name: remove stale + uses: actions-ecosystem/action-remove-labels@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + labels: Stale diff --git a/assets/css/admin.scss b/assets/css/admin.scss index 3dca45bdf8c..6ea357b8e2a 100644 --- a/assets/css/admin.scss +++ b/assets/css/admin.scss @@ -161,6 +161,43 @@ } } + .addons-promotion-block { + display: flex; + padding: 20px; + + .addons-img { + height: auto; + width: 200px; + } + } + + .addons-promotion-block-content { + display: flex; + flex-direction: column; + margin-left: 24px; + } + + .addons-promotion-block-description { + margin-bottom: 20px; + } + + .addons-promotion-block-title { + margin: 0 0 16px; + padding: 0; + } + + .addons-promotion-block-buttons { + margin-top: auto; + + .addons-button { + margin-right: 8px; + + &:last-child { + margin-right: 0; + } + } + } + .addons-shipping-methods .addons-wcs-banner-block { margin-left: 0; margin-right: 0; @@ -364,6 +401,12 @@ color: #fff; } + .addons-button-expandable { + display: inline-block; + padding: 0 16px; + width: auto; + } + .addons-button-solid:hover { color: #fff; opacity: 0.8; @@ -2642,6 +2685,30 @@ ul.wc_coupon_list_block { float: right; } } + + .wc_addons_wrap { + + .addons-promotion-block { + flex-direction: column; + padding: 24px; + + .addons-img { + height: auto; + width: 100%; + max-width: 240px; + margin: 0 auto 20px; + } + } + + .addons-promotion-block-content { + display: block; + margin-left: 0; + } + + .addons-promotion-block-title { + margin-top: 4px; + } + } } .column-customer_message .note-on { diff --git a/assets/js/admin/api-keys.js b/assets/js/admin/api-keys.js index f51a2cf7e0d..5c22ef3640e 100644 --- a/assets/js/admin/api-keys.js +++ b/assets/js/admin/api-keys.js @@ -53,7 +53,7 @@ .on( 'click', css_class, function( evt ) { evt.preventDefault(); if ( ! document.queryCommandSupported( 'copy' ) ) { - $( css_class ).parent().find( 'input' ).focus().select(); + $( css_class ).parent().find( 'input' ).trigger( 'focus' ).trigger( 'select' ); $( '#copy-error' ).text( woocommerce_admin_api_keys.clipboard_failed ); } else { $( '#copy-error' ).text( '' ); @@ -69,10 +69,10 @@ 'fadeIn': 50, 'fadeOut': 50, 'delay': 0 - } ).focus(); + } ).trigger( 'focus' ); } ) .on( 'aftercopyerror', css_class, function() { - $( css_class ).parent().find( 'input' ).focus().select(); + $( css_class ).parent().find( 'input' ).trigger( 'focus' ).trigger( 'select' ); $( '#copy-error' ).text( woocommerce_admin_api_keys.clipboard_failed ); } ); }, diff --git a/assets/js/admin/backbone-modal.js b/assets/js/admin/backbone-modal.js index 63cca56422a..061a37c8bae 100644 --- a/assets/js/admin/backbone-modal.js +++ b/assets/js/admin/backbone-modal.js @@ -72,7 +72,7 @@ _.bindAll( this, 'render' ); this.render(); - $( window ).resize(function() { + $( window ).on( 'resize', function() { view.resizeContent(); }); }, @@ -88,7 +88,7 @@ }).append( this.$el ); this.resizeContent(); - this.$( '.wc-backbone-modal-content' ).attr( 'tabindex' , '0' ).focus(); + this.$( '.wc-backbone-modal-content' ).attr( 'tabindex' , '0' ).trigger( 'focus' ); $( document.body ).trigger( 'init_tooltips' ); diff --git a/assets/js/admin/meta-boxes-coupon.js b/assets/js/admin/meta-boxes-coupon.js index c4327f33644..594726739c0 100644 --- a/assets/js/admin/meta-boxes-coupon.js +++ b/assets/js/admin/meta-boxes-coupon.js @@ -61,7 +61,7 @@ jQuery(function( $ ) { ); } $result = woocommerce_admin_meta_boxes_coupon.prefix + $result + woocommerce_admin_meta_boxes_coupon.suffix; - $coupon_code_field.focus().val( $result ); + $coupon_code_field.trigger( 'focus' ).val( $result ); $coupon_code_label.addClass( 'screen-reader-text' ); } }; diff --git a/assets/js/admin/meta-boxes-order.js b/assets/js/admin/meta-boxes-order.js index 2267afe26ed..f108dff0ec6 100644 --- a/assets/js/admin/meta-boxes-order.js +++ b/assets/js/admin/meta-boxes-order.js @@ -22,7 +22,7 @@ jQuery( function ( $ ) { this.states = JSON.parse( woocommerce_admin_meta_boxes_order.countries.replace( /"/g, '"' ) ); } - $( '.js_field-country' ).selectWoo().change( this.change_country ); + $( '.js_field-country' ).selectWoo().on( 'change', this.change_country ); $( '.js_field-country' ).trigger( 'change', [ true ] ); $( document.body ).on( 'change', 'select.js_field-state', this.change_state ); $( '#woocommerce-order-actions input, #woocommerce-order-actions a' ).on( 'click', function() { @@ -140,7 +140,7 @@ jQuery( function ( $ ) { is_billing = Boolean( $edit_address.find( 'input[name^="_billing_"]' ).length ); $address.hide(); - $this.parent().find( 'a' ).toggle(); + $this.parent().find( 'a' ).trigger( 'toggle' ); if ( ! $country_input.val() ) { $country_input.val( woocommerce_admin_meta_boxes_order.default_country ).trigger( 'change' ); @@ -1470,7 +1470,7 @@ jQuery( function ( $ ) { 'fadeIn': 50, 'fadeOut': 50, 'delay': 0 - }).focus(); + }).trigger( 'focus' ); }, /** @@ -1483,7 +1483,7 @@ jQuery( function ( $ ) { 'fadeIn': 50, 'fadeOut': 50, 'delay': 0 - }).focus(); + }).trigger( 'focus' ); } }; diff --git a/assets/js/admin/meta-boxes-product-variation.js b/assets/js/admin/meta-boxes-product-variation.js index 551ad33a114..fbb9701f04d 100644 --- a/assets/js/admin/meta-boxes-product-variation.js +++ b/assets/js/admin/meta-boxes-product-variation.js @@ -594,7 +594,7 @@ jQuery( function( $ ) { $( '.woocommerce-notice-invalid-variation' ).remove(); $( '#variable_product_options' ).find( '.woocommerce_variations' ).prepend( variation ); - $( 'button.cancel-variation-changes, button.save-variation-changes' ).removeAttr( 'disabled' ); + $( 'button.cancel-variation-changes, button.save-variation-changes' ).prop( 'disabled', false ); $( '#variable_product_options' ).trigger( 'woocommerce_variations_added', 1 ); wc_meta_boxes_product_variations_ajax.unblock(); }); @@ -700,7 +700,7 @@ jQuery( function( $ ) { .closest( '.woocommerce_variation' ) .addClass( 'variation-needs-update' ); - $( 'button.cancel-variation-changes, button.save-variation-changes' ).removeAttr( 'disabled' ); + $( 'button.cancel-variation-changes, button.save-variation-changes' ).prop( 'disabled', false ); $( '#variable_product_options' ).trigger( 'woocommerce_variations_input_changed' ); }, @@ -714,7 +714,7 @@ jQuery( function( $ ) { .find( '.woocommerce_variation:first' ) .addClass( 'variation-needs-update' ); - $( 'button.cancel-variation-changes, button.save-variation-changes' ).removeAttr( 'disabled' ); + $( 'button.cancel-variation-changes, button.save-variation-changes' ).prop( 'disabled', false ); $( '#variable_product_options' ).trigger( 'woocommerce_variations_defaults_changed' ); }, diff --git a/assets/js/admin/meta-boxes-product.js b/assets/js/admin/meta-boxes-product.js index 6d00cbc7a7b..e9cad28e4c6 100644 --- a/assets/js/admin/meta-boxes-product.js +++ b/assets/js/admin/meta-boxes-product.js @@ -34,17 +34,23 @@ jQuery( function( $ ) { } $( function() { - // Prevent inputs in meta box headings opening/closing contents. - $( '#woocommerce-product-data' ).find( '.hndle' ).unbind( 'click.postboxes' ); + var woocommerce_product_data = $( '#woocommerce-product-data' ); - $( '#woocommerce-product-data' ).on( 'click', '.hndle', function( event ) { + // Prevent inputs in meta box headings opening/closing contents. + woocommerce_product_data.find( '.hndle' ).off( 'click.postboxes' ); + + woocommerce_product_data.on( 'click', '.hndle', function( event ) { // If the user clicks on some form input inside the h3 the box should not be toggled. if ( $( event.target ).filter( 'input, option, label, select' ).length ) { return; } - $( '#woocommerce-product-data' ).toggleClass( 'closed' ); + if ( woocommerce_product_data.hasClass( 'closed' ) ) { + woocommerce_product_data.removeClass( 'closed' ); + } else { + woocommerce_product_data.addClass( 'closed' ); + } }); }); @@ -77,7 +83,7 @@ jQuery( function( $ ) { var current_visibility = $( '#current_visibility' ).val(); var current_featured = $( '#current_featured' ).val(); - $( 'input[name=_visibility]' ).removeAttr( 'checked' ); + $( 'input[name=_visibility]' ).prop( 'checked', false ); $( 'input[name=_visibility][value=' + current_visibility + ']' ).attr( 'checked', 'checked' ); var label = $( 'input[name=_visibility]:checked' ).attr( 'data-label' ); @@ -86,7 +92,7 @@ jQuery( function( $ ) { label = label + ', ' + woocommerce_admin_meta_boxes.featured_label; $( 'input[name=_featured]' ).attr( 'checked', 'checked' ); } else { - $( 'input[name=_featured]' ).removeAttr( 'checked' ); + $( 'input[name=_featured]' ).prop( 'checked', false ); } $( '#catalog-visibility-display' ).text( label ); @@ -94,7 +100,7 @@ jQuery( function( $ ) { }); // Product type specific options. - $( 'select#product-type' ).change( function() { + $( 'select#product-type' ).on( 'change', function() { // Get value. var select_val = $( this ).val(); @@ -102,13 +108,13 @@ jQuery( function( $ ) { if ( 'variable' === select_val ) { $( 'input#_manage_stock' ).trigger( 'change' ); $( 'input#_downloadable' ).prop( 'checked', false ); - $( 'input#_virtual' ).removeAttr( 'checked' ); + $( 'input#_virtual' ).prop( 'checked', false ); } else if ( 'grouped' === select_val ) { $( 'input#_downloadable' ).prop( 'checked', false ); - $( 'input#_virtual' ).removeAttr( 'checked' ); + $( 'input#_virtual' ).prop( 'checked', false ); } else if ( 'external' === select_val ) { $( 'input#_downloadable' ).prop( 'checked', false ); - $( 'input#_virtual' ).removeAttr( 'checked' ); + $( 'input#_virtual' ).prop( 'checked', false ); } show_and_hide_panels(); @@ -119,7 +125,7 @@ jQuery( function( $ ) { }).trigger( 'change' ); - $( 'input#_downloadable, input#_virtual' ).change( function() { + $( 'input#_downloadable, input#_virtual' ).on( 'change', function() { show_and_hide_panels(); }); @@ -239,7 +245,7 @@ jQuery( function( $ ) { }); // Stock options. - $( 'input#_manage_stock' ).change( function() { + $( 'input#_manage_stock' ).on( 'change', function() { if ( $( this ).is( ':checked' ) ) { $( 'div.stock_fields' ).show(); $( 'p.stock_status_field' ).hide(); @@ -361,7 +367,7 @@ jQuery( function( $ ) { }); $( '.product_attributes' ).on( 'click', 'button.select_no_attributes', function() { - $( this ).closest( 'td' ).find( 'select option' ).removeAttr( 'selected' ); + $( this ).closest( 'td' ).find( 'select option' ).prop( 'selected', false ); $( this ).closest( 'td' ).find( 'select' ).trigger( 'change' ); return false; }); @@ -373,7 +379,7 @@ jQuery( function( $ ) { if ( $parent.is( '.taxonomy' ) ) { $parent.find( 'select, input[type=text]' ).val( '' ); $parent.hide(); - $( 'select.attribute_taxonomy' ).find( 'option[value="' + $parent.data( 'taxonomy' ) + '"]' ).removeAttr( 'disabled' ); + $( 'select.attribute_taxonomy' ).find( 'option[value="' + $parent.data( 'taxonomy' ) + '"]' ).prop( 'disabled', false ); } else { $parent.find( 'select, input[type=text]' ).val( '' ); $parent.hide(); diff --git a/assets/js/admin/meta-boxes.js b/assets/js/admin/meta-boxes.js index 1f82968994f..a815b38315c 100644 --- a/assets/js/admin/meta-boxes.js +++ b/assets/js/admin/meta-boxes.js @@ -17,7 +17,19 @@ jQuery( function ( $ ) { runTipTip(); $( '.wc-metaboxes-wrapper' ).on( 'click', '.wc-metabox > h3', function() { - $( this ).parent( '.wc-metabox' ).toggleClass( 'closed' ).toggleClass( 'open' ); + var metabox = $( this ).parent( '.wc-metabox' ); + + if ( metabox.hasClass( 'closed' ) ) { + metabox.removeClass( 'closed' ); + } else { + metabox.addClass( 'closed' ); + } + + if ( metabox.hasClass( 'open' ) ) { + metabox.removeClass( 'open' ); + } else { + metabox.addClass( 'open' ); + } }); // Tabbed Panels diff --git a/assets/js/admin/quick-edit.js b/assets/js/admin/quick-edit.js index 8c64a049f33..c15b76f580d 100644 --- a/assets/js/admin/quick-edit.js +++ b/assets/js/admin/quick-edit.js @@ -57,7 +57,7 @@ jQuery( 'select[name="_visibility"] option, ' + 'select[name="_stock_status"] option, ' + 'select[name="_backorders"] option' - ).removeAttr( 'selected' ); + ).prop( 'selected', false ); var is_variable_product = 'variable' === product_type; $( 'select[name="_stock_status"] ~ .wc-quick-edit-warning', '.inline-edit-row' ).toggle( is_variable_product ); @@ -72,7 +72,7 @@ jQuery( if ( 'yes' === featured ) { $( 'input[name="_featured"]', '.inline-edit-row' ).attr( 'checked', 'checked' ); } else { - $( 'input[name="_featured"]', '.inline-edit-row' ).removeAttr( 'checked' ); + $( 'input[name="_featured"]', '.inline-edit-row' ).prop( 'checked', false ); } // Conditional display. diff --git a/assets/js/admin/settings-views-html-settings-tax.js b/assets/js/admin/settings-views-html-settings-tax.js index 061c2bd1af7..f7c79fe01c1 100644 --- a/assets/js/admin/settings-views-html-settings-tax.js +++ b/assets/js/admin/settings-views-html-settings-tax.js @@ -167,7 +167,7 @@ // Postcode and city don't have `name` values by default. // They're only created if the contents changes, to save on database queries (I think) - this.$el.find( 'td.postcode input, td.city input' ).change( function() { + this.$el.find( 'td.postcode input, td.city input' ).on( 'change', function() { $( this ).attr( 'name', $( this ).data( 'name' ) ); }); diff --git a/assets/js/admin/settings.js b/assets/js/admin/settings.js index de5931fd25d..702b0ae1a19 100644 --- a/assets/js/admin/settings.js +++ b/assets/js/admin/settings.js @@ -2,7 +2,7 @@ ( function( $, params, wp ) { $( function() { // Sell Countries - $( 'select#woocommerce_allowed_countries' ).change( function() { + $( 'select#woocommerce_allowed_countries' ).on( 'change', function() { if ( 'specific' === $( this ).val() ) { $( this ).closest('tr').next( 'tr' ).hide(); $( this ).closest('tr').next().next( 'tr' ).show(); @@ -16,7 +16,7 @@ }).trigger( 'change' ); // Ship Countries - $( 'select#woocommerce_ship_to_countries' ).change( function() { + $( 'select#woocommerce_ship_to_countries' ).on( 'change', function() { if ( 'specific' === $( this ).val() ) { $( this ).closest('tr').next( 'tr' ).show(); } else { @@ -25,7 +25,7 @@ }).trigger( 'change' ); // Stock management - $( 'input#woocommerce_manage_stock' ).change( function() { + $( 'input#woocommerce_manage_stock' ).on( 'change', function() { if ( $( this ).is(':checked') ) { $( this ).closest('tbody').find( '.manage_stock_field' ).closest( 'tr' ).show(); } else { @@ -48,15 +48,15 @@ event.stopPropagation(); $( '.iris-picker' ).hide(); $( this ).closest( 'td' ).find( '.iris-picker' ).show(); - $( this ).data( 'original-value', $( this ).val() ); + $( this ).data( 'originalValue', $( this ).val() ); }) .on( 'change', function() { if ( $( this ).is( '.iris-error' ) ) { - var original_value = $( this ).data( 'original-value' ); + var original_value = $( this ).data( 'originalValue' ); if ( original_value.match( /^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/ ) ) { - $( this ).val( $( this ).data( 'original-value' ) ).trigger( 'change' ); + $( this ).val( $( this ).data( 'originalValue' ) ).trigger( 'change' ); } else { $( this ).val( '' ).trigger( 'change' ); } @@ -71,7 +71,7 @@ $( function() { var changed = false; - $( 'input, textarea, select, checkbox' ).change( function() { + $( 'input, textarea, select, checkbox' ).on( 'change', function() { if ( ! changed ) { window.onbeforeunload = function() { return params.i18n_nav_warning; @@ -110,13 +110,13 @@ // Select all/none $( '.woocommerce' ).on( 'click', '.select_all', function() { - $( this ).closest( 'td' ).find( 'select option' ).attr( 'selected', 'selected' ); + $( this ).closest( 'td' ).find( 'select option' ).prop( 'selected', true ); $( this ).closest( 'td' ).find( 'select' ).trigger( 'change' ); return false; }); $( '.woocommerce' ).on( 'click', '.select_none', function() { - $( this ).closest( 'td' ).find( 'select option' ).removeAttr( 'selected' ); + $( this ).closest( 'td' ).find( 'select option' ).prop( 'selected', false ); $( this ).closest( 'td' ).find( 'select' ).trigger( 'change' ); return false; }); @@ -126,7 +126,7 @@ var moveBtn = $( this ), $row = moveBtn.closest( 'tr' ); - moveBtn.focus(); + moveBtn.trigger( 'focus' ); var isMoveUp = moveBtn.is( '.wc-move-up' ), isMoveDown = moveBtn.is( '.wc-move-down' ); @@ -147,7 +147,7 @@ } } - moveBtn.focus(); // Re-focus after the container was moved. + moveBtn.trigger( 'focus' ); // Re-focus after the container was moved. moveBtn.closest( 'table' ).trigger( 'updateMoveButtons' ); } ); diff --git a/assets/js/admin/system-status.js b/assets/js/admin/system-status.js index cb84c875444..a2457530a5a 100644 --- a/assets/js/admin/system-status.js +++ b/assets/js/admin/system-status.js @@ -33,11 +33,11 @@ jQuery( function ( $ ) { $( '.wc_status_table thead, .wc_status_table tbody' ).each( function() { if ( $( this ).is( 'thead' ) ) { - var label = $( this ).find( 'th:eq(0)' ).data( 'export-label' ) || $( this ).text(); + var label = $( this ).find( 'th:eq(0)' ).data( 'exportLabel' ) || $( this ).text(); report = report + '\n### ' + label.trim() + ' ###\n\n'; } else { $( 'tr', $( this ) ).each( function() { - var label = $( this ).find( 'td:eq(0)' ).data( 'export-label' ) || $( this ).find( 'td:eq(0)' ).text(); + var label = $( this ).find( 'td:eq(0)' ).data( 'exportLabel' ) || $( this ).find( 'td:eq(0)' ).text(); var the_name = label.trim().replace( /(<([^>]+)>)/ig, '' ); // Remove HTML. // Find value @@ -68,7 +68,7 @@ jQuery( function ( $ ) { try { $( '#debug-report' ).slideDown(); - $( '#debug-report' ).find( 'textarea' ).val( '`' + report + '`' ).focus().select(); + $( '#debug-report' ).find( 'textarea' ).val( '`' + report + '`' ).trigger( 'focus' ).trigger( 'select' ); $( this ).fadeOut(); return false; } catch ( e ) { @@ -100,7 +100,7 @@ jQuery( function ( $ ) { 'fadeIn': 50, 'fadeOut': 50, 'delay': 0 - }).focus(); + }).trigger( 'focus' ); }, /** @@ -108,7 +108,7 @@ jQuery( function ( $ ) { */ copyFail: function() { $( '.copy-error' ).removeClass( 'hidden' ); - $( '#debug-report' ).find( 'textarea' ).focus().select(); + $( '#debug-report' ).find( 'textarea' ).trigger( 'focus' ).trigger( 'select' ); } }; diff --git a/assets/js/admin/users.js b/assets/js/admin/users.js index cb2b816604e..2d6c1fa7138 100644 --- a/assets/js/admin/users.js +++ b/assets/js/admin/users.js @@ -12,7 +12,7 @@ jQuery( function ( $ ) { this.states = JSON.parse( wc_users_params.countries.replace( /"/g, '"' ) ); } - $( '.js_field-country' ).selectWoo().change( this.change_country ); + $( '.js_field-country' ).selectWoo().on( 'change', this.change_country ); $( '.js_field-country' ).trigger( 'change', [ true ] ); $( document.body ).on( 'change', 'select.js_field-state', this.change_state ); diff --git a/assets/js/admin/wc-clipboard.js b/assets/js/admin/wc-clipboard.js index fc009d02041..8a2391213ae 100644 --- a/assets/js/admin/wc-clipboard.js +++ b/assets/js/admin/wc-clipboard.js @@ -17,7 +17,7 @@ function wcSetClipboard( data, $el ) { } var $temp_input = jQuery( '