Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Add logic of Upgrade Notice after upgrading Products to Product Collection #10267

Merged
merged 27 commits into from
Aug 18, 2023

Conversation

kmanijak
Copy link
Contributor

@kmanijak kmanijak commented Jul 19, 2023

This PR adds a logic of displaying an Upgrade Notice after the automatic update of Products block to Product Collection with the following rules:

  • Upgrade Notice is displayed with the first focus on Product Collection block after migration
  • Upgrade Notice won't be displayed again if the user dismissed it or reverted the migration.
  • Automatic migration will be disabled if the user reverted back to Products (Beta) blocks.

This PR contains changes from #10494 that were tested separately.

Fixes #9703

Testing

Automated Tests

  • Changes in this PR are covered by Automated Tests.
    • Unit tests
    • E2E tests

User Facing Testing

Prerequisites:

  1. Edit two templates by adding Products (Beta) blocks to them and save them, for example:
    • Product Catalog: add three Products (Beta) blocks
    • Products by Attribute: add two Products (Beta) blocks
  2. Enable auto migration by changing https://github.com/woocommerce/woocommerce-blocks/pull/10267/files#diff-e9517b2fd3bcc6d45a42d1f2eea15b221e8d7285a41c4f3df6fa2eb8db2de3acR1 to true
SCENARIO 1. Acknowledge and ignore the Upgrade Notice
  1. Go to Editor and start editing Product Template
  2. All Products (Beta) blocks should be replaced with Product Collection blocks
  3. Focus on one of Product Collection block
  4. Expected: Upgrade Notice should be visible in Inspector Controls
image
  1. Change the focus to another block
  2. Bring back focus to any of the Product Collection block
  3. Expected: Upgrade Notice should be visible in Inspector Controls
  4. Go to Products by Attribute template
  5. Expected: All Products (Beta) blocks should be replaced with Product Collection blocks
  6. Focus on any of the Product Collection blocks
  7. Expected: Upgrade Notice is still visible
    EXTRA STEPS (covered and tested in scope of Product Collection - logic to hide upgrade notice #10494):
  8. Notice will be displayed until:
  • 72 hours have passed since the update (no need to test in scope of this PR)
  • Notice has been displayed four times. (can be tested by changing the focus to another block and going back to Product Collection).
SCENARIO 2. Dismiss the notice

The information about the notice state is kept in Local Storage. Before attempting another scenario, we have to clear that. In order to do that go to Dev Tools > Application > Local Storage and delete wc-blocks_upgraded-products-to-product-collection (Chrome).
The journey may differ between browsers, so please check the way to delete Local Storage entries in your browser.

  1. Repeat steps 1 - 4 from the previous scenario
  2. Instead of changing focus, click the "X" button to dismiss the notice.
  3. Change the focus to another block
  4. Bring back focus to any of the Product Collection block
  5. Expected: Upgrade Notice is not displayed anymore
  6. Go to Products by Attribute template
  7. Expected: All Products (Beta) blocks should be replaced with Product Collection blocks
  8. Focus on any of the Product Collection blocks
  9. Expected: Upgrade Notice is not displayed anymore
SCENARIO 3. Revert the migration

The information about the notice state is kept in Local Storage. Before attempting another scenario, we have to clear that. In order to do that go to Dev Tools > Application > Local Storage and delete wc-blocks_upgraded-products-to-product-collection (Chrome).
The journey may differ between browsers, so please check the way to delete Local Storage entries in your browser.

  1. Repeat steps 1 - 4 from the scenario 1
  2. Click "Revert to Products (Beta)"
  3. Expected: All the Product Collection blocks should be reverted back to Products (Beta) blocks and that will prevent further migration
  4. Go to Products by Attribute template
  5. Expected: Products (Beta) blocks should NOT be replaced with Product Collection blocks
  6. Refresh the page
  7. Expected: Products (Beta) blocks should NOT be replaced with Product Collection blocks
  • Do not include in the Testing Notes

WooCommerce Visibility

  • WooCommerce Core
  • Feature plugin
  • Experimental

@github-actions
Copy link
Contributor

Implement the logic to display option for manual upgrade.

Implement the logic to display option for manual upgrade. before enabling automatic upgrade and in case of reverting manual upgrade.


// @todo: Implement the logic to display option for manual upgrade.
// before enabling automatic upgrade and in case of reverting manual upgrade.
return (
<>
<InspectorControls>
{ displayUpgradeNotice && (
<UpgradeNotice { ...upgradeNoticeProps } />
) }
</InspectorControls>
<BlockEdit { ...props } />

🚀 This comment was generated by the automations bot based on a todo comment in d66a275 in #10267. cc @kmanijak

@github-actions
Copy link
Contributor

github-actions bot commented Jul 19, 2023

The release ZIP for this PR is accessible via:

https://wcblocks.wpcomstaging.com/wp-content/uploads/woocommerce-gutenberg-products-block-10267.zip

Script Dependencies Report

There is no changed script dependency between this branch and trunk.

This comment was automatically generated by the ./github/compare-assets action.

TypeScript Errors Report

  • Files with errors: 477
  • Total errors: 2260

⚠️ ⚠️ This PR introduces new TS errors on 4 files:

assets/js/blocks/migration-products-to-product-collection/migration-from-product-collection-to-products.ts

assets/js/blocks/migration-products-to-product-collection/migration-from-products-to-product-collection.ts

assets/js/blocks/product-collection/inspector-controls/index.tsx

assets/js/blocks/product-query/inspector-controls.tsx

comments-aggregator

@github-actions
Copy link
Contributor

github-actions bot commented Jul 19, 2023

Size Change: +12.9 kB (+1%)

Total Size: 1.35 MB

Filename Size Change
build/active-filters-frontend.js 8.57 kB +5 B (0%)
build/active-filters-wrapper--mini-cart-contents-block/cart-button--mini-cart-contents-block/checkout-but--e791dc6c-style.js 930 B +1 B (0%)
build/active-filters-wrapper-frontend.js 7.58 kB -1 B (0%)
build/active-filters.js 7.51 kB +4 B (0%)
build/all-products-frontend.js 9.95 kB +16 B (0%)
build/all-products-rtl.css 4.39 kB +201 B (+5%) 🔍
build/all-products.css 4.38 kB +190 B (+5%) 🔍
build/all-products.js 41.3 kB +31 B (0%)
build/attribute-filter-frontend.js 22.9 kB -21 B (0%)
build/attribute-filter.js 13.1 kB -14 B (0%)
build/blocks-checkout.js 35.1 kB +75 B (0%)
build/breadcrumbs.js 2.15 kB -1 B (0%)
build/cart-blocks/cart-accepted-payment-methods-frontend.js 1.34 kB +1 B (0%)
build/cart-blocks/cart-cross-sells-frontend.js 250 B +1 B (0%)
build/cart-blocks/cart-cross-sells-products--product-price-frontend.js 2.89 kB +1 B (0%)
build/cart-blocks/cart-cross-sells-products-frontend.js 3.73 kB +4 B (0%)
build/cart-blocks/cart-cross-sells-products-style.js 138 B +1 B (+1%)
build/cart-blocks/cart-express-payment--checkout-blocks/express-payment-frontend.js 5 kB -1 B (0%)
build/cart-blocks/cart-express-payment-frontend.js 711 B -1 B (0%)
build/cart-blocks/cart-items-frontend.js 284 B -2 B (-1%)
build/cart-blocks/cart-line-items--mini-cart-contents-block/products-table-frontend.js 5.34 kB -2 B (0%)
build/cart-blocks/cart-line-items-frontend.js 1.04 kB +1 B (0%)
build/cart-blocks/cart-line-items-style.js 136 B -1 B (-1%)
build/cart-blocks/cart-order-summary-frontend.js 1.24 kB -2 B (0%)
build/cart-blocks/cart-order-summary-style.js 318 B -1 B (0%)
build/cart-blocks/cart-totals-frontend.js 287 B -2 B (-1%)
build/cart-blocks/empty-cart-frontend.js 343 B -2 B (-1%)
build/cart-blocks/filled-cart-frontend.js 651 B +1 B (0%)
build/cart-blocks/order-summary-coupon-form-frontend.js 1.57 kB +1 B (0%)
build/cart-blocks/order-summary-coupon-form-style.js 137 B +2 B (+1%)
build/cart-blocks/order-summary-discount-frontend.js 2.04 kB +3 B (0%)
build/cart-blocks/order-summary-fee-frontend.js 271 B +1 B (0%)
build/cart-blocks/order-summary-heading-frontend.js 325 B -1 B (0%)
build/cart-blocks/order-summary-heading-style.js 325 B -1 B (0%)
build/cart-blocks/order-summary-shipping-frontend.js 12 kB +79 B (+1%)
build/cart-blocks/order-summary-subtotal-frontend.js 271 B +1 B (0%)
build/cart-blocks/order-summary-subtotal-style.js 137 B +1 B (+1%)
build/cart-blocks/order-summary-taxes-frontend.js 433 B -1 B (0%)
build/cart-blocks/order-summary-taxes-style.js 178 B +1 B (+1%)
build/cart-blocks/proceed-to-checkout-frontend.js 1.41 kB +3 B (0%)
build/cart-blocks/proceed-to-checkout-style.js 1.09 kB +1 B (0%)
build/cart-frontend.js 29.7 kB -29 B (0%)
build/cart-rtl.css 9.71 kB +195 B (+2%)
build/cart.css 9.69 kB +196 B (+2%)
build/cart.js 45 kB +116 B (0%)
build/catalog-sorting.js 1.71 kB +2 B (0%)
build/checkout-blocks/actions--checkout-blocks/terms-style.js 487 B +3 B (+1%)
build/checkout-blocks/actions-frontend.js 1.81 kB +5 B (0%)
build/checkout-blocks/actions-style.js 681 B +2 B (0%)
build/checkout-blocks/billing-address-frontend.js 4.3 kB +105 B (+3%)
build/checkout-blocks/billing-address-style.js 530 B -2 B (0%)
build/checkout-blocks/contact-information-frontend.js 2.03 kB +3 B (0%)
build/checkout-blocks/contact-information-style.js 608 B +1 B (0%)
build/checkout-blocks/express-payment-frontend.js 1.12 kB +5 B (0%)
build/checkout-blocks/order-note-frontend.js 1.1 kB +4 B (0%)
build/checkout-blocks/order-summary-cart-items-frontend.js 3.64 kB +4 B (0%)
build/checkout-blocks/order-summary-cart-items-style.js 136 B -1 B (-1%)
build/checkout-blocks/order-summary-coupon-form-frontend.js 1.73 kB +4 B (0%)
build/checkout-blocks/order-summary-discount-frontend.js 2.22 kB +6 B (0%)
build/checkout-blocks/order-summary-fee-frontend.js 274 B +1 B (0%)
build/checkout-blocks/order-summary-frontend.js 1.24 kB -2 B (0%)
build/checkout-blocks/order-summary-shipping-frontend.js 12 kB +68 B (+1%)
build/checkout-blocks/order-summary-subtotal-frontend.js 272 B +1 B (0%)
build/checkout-blocks/order-summary-subtotal-style.js 136 B -1 B (-1%)
build/checkout-blocks/order-summary-taxes-frontend.js 433 B -1 B (0%)
build/checkout-blocks/payment-frontend.js 9.13 kB +2 B (0%)
build/checkout-blocks/payment-style.js 461 B +1 B (0%)
build/checkout-blocks/pickup-options-frontend.js 4.13 kB +4 B (0%)
build/checkout-blocks/shipping-address-frontend.js 4.28 kB +105 B (+3%)
build/checkout-blocks/shipping-address-style.js 474 B -1 B (0%)
build/checkout-blocks/shipping-method-frontend.js 2.59 kB +7 B (0%)
build/checkout-blocks/shipping-method-style.js 1.35 kB +2 B (0%)
build/checkout-blocks/shipping-methods-frontend.js 5.68 kB -9 B (0%)
build/checkout-blocks/shipping-methods-style.js 415 B -2 B (0%)
build/checkout-blocks/terms-frontend.js 1.51 kB +1 B (0%)
build/checkout-blocks/terms-style.js 672 B -1 B (0%)
build/checkout-blocks/totals-frontend.js 333 B +1 B (0%)
build/checkout-blocks/totals-style.js 276 B +1 B (0%)
build/checkout-frontend.js 31.6 kB -30 B (0%)
build/checkout.js 47.7 kB +142 B (0%)
build/featured-category.js 14.9 kB -24 B (0%)
build/featured-product.js 15.1 kB -26 B (0%)
build/filter-wrapper-frontend.js 14.1 kB +7 B (0%)
build/handpicked-products.js 7.97 kB +7 B (0%)
build/legacy-template.js 8.14 kB -13 B (0%)
build/mini-cart-component-frontend.js 30.7 kB -156 B (-1%)
build/mini-cart-contents-block/cart-button-frontend.js 1.69 kB +2 B (0%)
build/mini-cart-contents-block/cart-button-style.js 383 B +2 B (+1%)
build/mini-cart-contents-block/checkout-button-style.js 463 B -1 B (0%)
build/mini-cart-contents-block/empty-cart-frontend.js 358 B +1 B (0%)
build/mini-cart-contents-block/filled-cart-frontend.js 267 B +1 B (0%)
build/mini-cart-contents-block/filled-cart-style.js 267 B -1 B (0%)
build/mini-cart-contents-block/footer-frontend.js 3.77 kB -6 B (0%)
build/mini-cart-contents-block/footer-style.js 2.35 kB +2 B (0%)
build/mini-cart-contents-block/products-table-frontend.js 549 B +3 B (+1%)
build/mini-cart-contents-block/products-table-style.js 5.32 kB +4 B (0%)
build/mini-cart-contents-block/shopping-button-frontend.js 487 B -1 B (0%)
build/mini-cart-contents-block/shopping-button-style.js 394 B -1 B (0%)
build/mini-cart-contents-block/title-frontend.js 1.86 kB +2 B (0%)
build/mini-cart-contents-block/title-items-counter-frontend.js 1.58 kB +3 B (0%)
build/mini-cart-contents-block/title-label-frontend.js 1.51 kB +2 B (0%)
build/mini-cart-contents-block/title-style.js 438 B +1 B (0%)
build/mini-cart-contents.js 17.6 kB -11 B (0%)
build/mini-cart-frontend.js 2.79 kB +1 B (0%)
build/mini-cart.js 6.34 kB -3 B (0%)
build/price-filter-frontend.js 14.5 kB +6 B (0%)
build/price-filter-wrapper-frontend.js 8.57 kB +1 B (0%)
build/price-filter.js 8.51 kB +1 B (0%)
build/product-add-to-cart--product-average-rating--product-button--product-image--product-price--product---1d132d69.js 272 B +1 B (0%)
build/product-add-to-cart-frontend.js 8.5 kB -8 B (0%)
build/product-add-to-cart.js 8.55 kB +3 B (0%)
build/product-average-rating--product-button--product-image--product-price--product-rating--product-ratin--e23975b5.js 934 B +1 B (0%)
build/product-average-rating-frontend.js 1.71 kB -1 B (0%)
build/product-best-sellers.js 8.32 kB -5 B (0%)
build/product-button-frontend.js 4.87 kB +8 B (0%)
build/product-button-rtl.css 1.1 kB +241 B (+28%) 🚨
build/product-button.css 1.1 kB +241 B (+28%) 🚨
build/product-button.js 3.88 kB -2 B (0%)
build/product-categories.js 2.72 kB +3 B (0%)
build/product-category.js 9.28 kB -9 B (0%)
build/product-collection.js 14.9 kB +1.07 kB (+8%) 🔍
build/product-gallery-large-image.js 2.02 kB -1 B (0%)
build/product-gallery-thumbnails.js 3.91 kB +3 B (0%)
build/product-gallery.js 6.08 kB -2 B (0%)
build/product-image-frontend.js 2.65 kB -3 B (0%)
build/product-image.js 1.5 kB -1 B (0%)
build/product-new.js 8.6 kB +2 B (0%)
build/product-on-sale.js 8.61 kB +3 B (0%)
build/product-price.js 1.65 kB +1 B (0%)
build/product-query.js 13.1 kB +257 B (+2%)
build/product-rating-counter-frontend.js 2.01 kB -2 B (0%)
build/product-rating-counter.js 689 B +2 B (0%)
build/product-rating-frontend.js 2.35 kB -2 B (0%)
build/product-rating-stars-frontend.js 2.25 kB -3 B (0%)
build/product-rating-stars.js 940 B +2 B (0%)
build/product-rating.js 1.04 kB +1 B (0%)
build/product-sale-badge-frontend.js 1.8 kB -2 B (0%)
build/product-search.js 2.63 kB +3 B (0%)
build/product-stock-indicator-frontend.js 2.02 kB +2 B (0%)
build/product-stock-indicator.js 708 B -1 B (0%)
build/product-summary-frontend.js 2.18 kB +1 B (0%)
build/product-summary.js 918 B -1 B (0%)
build/product-tag.js 8.78 kB +1 B (0%)
build/product-template.js 3.43 kB +1 B (0%)
build/product-title.js 963 B -2 B (0%)
build/product-top-rated.js 8.87 kB +1 B (0%)
build/products-by-attribute.js 9.63 kB +3 B (0%)
build/rating-filter-frontend.js 21.4 kB -68 B (0%)
build/rating-filter-wrapper-frontend.js 6.62 kB +6 B (0%)
build/rating-filter.js 6.88 kB -6 B (0%)
build/reviews-by-category.js 12 kB -4 B (0%)
build/reviews-by-product.js 13.1 kB -1 B (0%)
build/single-product.js 11.2 kB -12 B (0%)
build/stock-filter-frontend.js 21.6 kB -46 B (0%)
build/stock-filter-wrapper-frontend.js 6.82 kB +1 B (0%)
build/stock-filter.js 7.6 kB -6 B (0%)
build/store-notices.js 1.69 kB -1 B (0%)
build/vendors--attribute-filter-wrapper--cart-blocks/order-summary-coupon-form--cart-blocks/order-summary--48e1e4bb-frontend.js 6.84 kB -14 B (0%)
build/vendors--attribute-filter-wrapper--rating-filter-wrapper--stock-filter-wrapper-frontend.js 8.31 kB +2 B (0%)
build/vendors--cart-blocks/cart-cross-sells-products--cart-blocks/cart-line-items--cart-blocks/cart-order--3c5fe802-frontend.js 5.28 kB -1 B (0%)
build/vendors--cart-blocks/cart-line-items--checkout-blocks/order-summary-cart-items--mini-cart-contents---233ab542-frontend.js 3.55 kB +1 B (0%)
build/vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--decc3dc6-frontend.js 19.4 kB -8 B (0%)
build/vendors--cart-blocks/order-summary-shipping--checkout-blocks/order-summary-shipping--checkout-block--24d3fc0c-frontend.js 8.22 kB +1 B (0%)
build/vendors--checkout-blocks/billing-address--checkout-blocks/shipping-address-frontend.js 5.6 kB +3 B (0%)
build/vendors--checkout-blocks/shipping-method-frontend.js 12.4 kB -6 B (0%)
build/vendors--checkout-blocks/shipping-method-style.js 11.7 kB +5 B (0%)
build/vendors--product-add-to-cart-frontend.js 7.52 kB -3 B (0%)
build/wc-blocks-data.js 21.9 kB -22 B (0%)
build/wc-blocks-registry.js 3.19 kB +4 B (0%)
build/wc-blocks-shared-hocs.js 1.63 kB +2 B (0%)
build/wc-blocks-vendors.js 65.5 kB -5 B (0%)
build/wc-blocks.js 2.63 kB +3 B (0%)
build/wc-interactivity.js 10.8 kB +494 B (+5%) 🔍
build/product-button-interactivity-frontend.js 9.51 kB +9.51 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size
build/active-filters-rtl.css 1.99 kB
build/active-filters-wrapper-rtl.css 1.85 kB
build/active-filters-wrapper.css 1.85 kB
build/active-filters.css 1.99 kB
build/add-to-cart-form-rtl.css 355 B
build/add-to-cart-form.css 354 B
build/all-reviews-rtl.css 1.79 kB
build/all-reviews.css 1.79 kB
build/all-reviews.js 7.77 kB
build/attribute-filter-rtl.css 4.14 kB
build/attribute-filter-wrapper-frontend.js 8.01 kB
build/attribute-filter-wrapper-rtl.css 4.01 kB
build/attribute-filter-wrapper.css 4.01 kB
build/attribute-filter.css 4.14 kB
build/breadcrumbs-rtl.css 232 B
build/breadcrumbs.css 232 B
build/cart-blocks/cart-accepted-payment-methods-style.js 137 B
build/cart-blocks/cart-cross-sells-style.js 250 B
build/cart-blocks/cart-express-payment-style.js 137 B
build/cart-blocks/cart-items-style.js 219 B
build/cart-blocks/cart-totals-style.js 228 B
build/cart-blocks/empty-cart-style.js 336 B
build/cart-blocks/filled-cart-style.js 310 B
build/cart-blocks/order-summary-discount-style.js 137 B
build/cart-blocks/order-summary-fee-style.js 137 B
build/cart-blocks/order-summary-shipping-style.js 177 B
build/catalog-sorting-rtl.css 256 B
build/catalog-sorting.css 256 B
build/checkout-blocks/fields-frontend.js 301 B
build/checkout-blocks/fields-style.js 249 B
build/checkout-blocks/order-summary-coupon-form-style.js 137 B
build/checkout-blocks/order-summary-discount-style.js 136 B
build/checkout-blocks/order-summary-fee-style.js 137 B
build/checkout-blocks/order-summary-shipping-style.js 137 B
build/checkout-blocks/order-summary-style.js 318 B
build/checkout-blocks/order-summary-taxes-style.js 177 B
build/checkout-blocks/pickup-options-style.js 440 B
build/checkout-rtl.css 9.07 kB
build/checkout.css 9.06 kB
build/customer-account-rtl.css 388 B
build/customer-account.css 387 B
build/customer-account.js 3.18 kB
build/featured-category-rtl.css 971 B
build/featured-category.css 970 B
build/featured-product-rtl.css 1.02 kB
build/featured-product.css 1.02 kB
build/filter-wrapper-rtl.css 375 B
build/filter-wrapper.css 375 B
build/filter-wrapper.js 2.39 kB
build/legacy-template-rtl.css 238 B
build/legacy-template.css 238 B
build/mini-cart-contents-block/cart-button--mini-cart-contents-block/checkout-button--mini-cart-contents---358acf4e-style.js 249 B
build/mini-cart-contents-block/checkout-button-frontend.js 1.77 kB
build/mini-cart-contents-block/empty-cart-style.js 355 B
build/mini-cart-contents-block/footer-rtl.css 400 B
build/mini-cart-contents-block/footer.css 400 B
build/mini-cart-contents-block/items-frontend.js 228 B
build/mini-cart-contents-block/items-style.js 228 B
build/mini-cart-contents-block/products-table--product-image--product-title-style.js 316 B
build/mini-cart-contents-block/products-table-rtl.css 2.12 kB
build/mini-cart-contents-block/products-table.css 2.11 kB
build/mini-cart-contents-block/title-items-counter-style.js 302 B
build/mini-cart-contents-block/title-label-style.js 301 B
build/mini-cart-contents-rtl.css 2.66 kB
build/mini-cart-contents.css 2.65 kB
build/mini-cart-rtl.css 2.56 kB
build/mini-cart.css 2.56 kB
build/packages-style-rtl.css 3.55 kB
build/packages-style.css 3.55 kB
build/price-filter-rtl.css 2.67 kB
build/price-filter-wrapper-rtl.css 2.53 kB
build/price-filter-wrapper.css 2.53 kB
build/price-filter.css 2.67 kB
build/price-format.js 1.15 kB
build/product-add-to-cart--product-button--product-rating--product-rating-counter--product-rating-stars.js 150 B
build/product-add-to-cart--product-image--product-title.js 319 B
build/product-add-to-cart-rtl.css 1.35 kB
build/product-add-to-cart.css 1.36 kB
build/product-average-rating.js 400 B
build/product-categories-rtl.css 651 B
build/product-categories.css 649 B
build/product-details-rtl.css 394 B
build/product-details.css 391 B
build/product-gallery-large-image-rtl.css 295 B
build/product-gallery-large-image.css 295 B
build/product-gallery-rtl.css 371 B
build/product-gallery-thumbnails-rtl.css 272 B
build/product-gallery-thumbnails.css 271 B
build/product-gallery.css 373 B
build/product-image-gallery-rtl.css 304 B
build/product-image-gallery.css 303 B
build/product-image-rtl.css 922 B
build/product-image.css 920 B
build/product-price-frontend.js 247 B
build/product-price-rtl.css 667 B
build/product-price.css 665 B
build/product-query-rtl.css 347 B
build/product-query.css 347 B
build/product-rating-rtl.css 244 B
build/product-rating-stars-rtl.css 895 B
build/product-rating-stars.css 897 B
build/product-rating.css 244 B
build/product-results-count-rtl.css 228 B
build/product-results-count.css 228 B
build/product-results-count.js 1.66 kB
build/product-reviews-rtl.css 456 B
build/product-reviews.css 455 B
build/product-sale-badge-rtl.css 369 B
build/product-sale-badge.css 370 B
build/product-sale-badge.js 671 B
build/product-search-rtl.css 415 B
build/product-search.css 415 B
build/product-sku-frontend.js 1.84 kB
build/product-sku-rtl.css 237 B
build/product-sku.css 237 B
build/product-sku.js 522 B
build/product-stock-indicator-rtl.css 229 B
build/product-stock-indicator.css 229 B
build/product-summary-rtl.css 546 B
build/product-summary.css 546 B
build/product-template-rtl.css 418 B
build/product-template.css 418 B
build/product-title-frontend.js 2.21 kB
build/product-title-rtl.css 688 B
build/product-title.css 689 B
build/rating-filter-rtl.css 4.2 kB
build/rating-filter-wrapper-rtl.css 4.07 kB
build/rating-filter-wrapper.css 4.07 kB
build/rating-filter.css 4.19 kB
build/reviews-by-category-rtl.css 1.79 kB
build/reviews-by-category.css 1.79 kB
build/reviews-by-product-rtl.css 1.79 kB
build/reviews-by-product.css 1.79 kB
build/reviews-frontend.js 7.06 kB
build/single-product-rtl.css 375 B
build/single-product.css 375 B
build/stock-filter-rtl.css 4.01 kB
build/stock-filter-wrapper-rtl.css 3.88 kB
build/stock-filter-wrapper.css 3.88 kB
build/stock-filter.css 4.01 kB
build/vendors--active-filters-wrapper--attribute-filter-wrapper--mini-cart-contents-block/cart-button--mi--d6bb29e6-style.js 606 B
build/vendors--cart-blocks/proceed-to-checkout-style.js 179 B
build/vendors--mini-cart-contents-block/products-table--price-filter-wrapper--product-price-style.js 5.27 kB
build/vendors--mini-cart-contents-block/products-table-style.js 3.16 kB
build/wc-blocks-classic-template-revert-button-style-rtl.css 237 B
build/wc-blocks-classic-template-revert-button-style.css 236 B
build/wc-blocks-classic-template-revert-button.js 1.53 kB
build/wc-blocks-editor-style-rtl.css 6.37 kB
build/wc-blocks-editor-style.css 6.38 kB
build/wc-blocks-google-analytics.js 1.55 kB
build/wc-blocks-middleware.js 934 B
build/wc-blocks-rtl.css 2.46 kB
build/wc-blocks-shared-context.js 1.1 kB
build/wc-blocks.css 2.46 kB
build/wc-payment-method-bacs.js 817 B
build/wc-payment-method-cheque.js 813 B
build/wc-payment-method-cod.js 914 B
build/wc-payment-method-paypal.js 852 B
build/wc-settings.js 2.68 kB
build/wc-shipping-method-pickup-location.js 30.4 kB

compressed-size-action

@github-actions
Copy link
Contributor

Read from local storage.

Read from local storage. If reverted - don't subscribe


// @todo Read from local storage. If reverted - don't subscribe
if (
REPLACE_PRODUCTS_WITH_PRODUCT_COLLECTION &&
status !== 'reverted' &&
! productsReplacementUnsubscribe
) {
console.info( 'Subscribed to allow Products block migration' );
productsReplacementUnsubscribe = subscribe( () => {
replaceProductsWithProductCollection();
}, 'core/block-editor' );
}
}

🚀 This comment was generated by the automations bot based on a todo comment in 52e3364 in #10267. cc @kmanijak

@kmanijak kmanijak changed the title Add/products migration upgrade notice logic Add logic of Upgrade Notice after upgrading Products to Product Collection Jul 20, 2023
@kmanijak kmanijak added block-type: product-query Issues related to/affecting all product-query variations. block: product collection Issues related to the Product Collection block labels Jul 20, 2023
@kmanijak kmanijak added the skip-changelog PRs that you don't want to appear in the changelog. label Jul 20, 2023
@kmanijak kmanijak marked this pull request as ready for review July 27, 2023 10:23
@woocommercebot woocommercebot requested review from a team and gigitux and removed request for a team July 27, 2023 10:23
@kmanijak kmanijak requested a review from imanish003 July 27, 2023 10:31
@imanish003
Copy link
Contributor

imanish003 commented Jul 28, 2023

Expected: All the Product Collection blocks should be reverted back to Products (Beta) blocks and that will prevent further migration

I was testing this, and I have one question. For example:

  • A user opens the Product Catalog, and as expected, all Products beta blocks will be replaced with Product Collection blocks.
  • The user makes a good amount of changes to the Product Collection blocks.
  • Now the user saves the Product Catalog.
  • After around 1 month, the user comes back to the Product Catalog template and adds one more Products beta block.
  • The user saves the template and refreshes the page.
  • Then, the user clicks on the Revert to Products (Beta) button.
    • Now the question is, should we revert all old Product Collection blocks to Products beta blocks, which were customized 1 month ago? Because AFAIU as per the current implementation, all Product collection blocks on the page will be replaced with Products beta block.

CC: @jarekmorawski

Copy link
Contributor

@imanish003 imanish003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @kmanijak, great job, and thank you so much for the detailed testing steps! 🙌🏻

Almost everything is working as expected. I left a few minor comments 🙂

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UI for the Notice isn't looking great because there is a significant amount of white space that we are not utilizing properly. However, I don't believe we can improve it unless we contribute upstream. Here is how the UI is appearing on my machine:
Notice UI

I suggest adding some margin at the bottom of the notice. What do you think?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good feedback! I agree that the notice could use some breathing room. Also, can we use a different background color? Maybe Gutenberg-100? We should definitely contribute to removing the white space on the right if we can.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is how the UI is appearing on my machine:

Thanks for raising this. I actually provided the fix upstream in Gutenberg, but it's still in review: WordPress/gutenberg#52240. It was also raised in previous PRs, where the notice was introduced and I consulted with @danieldudzic as well as @gigitux (e.g. here) if should introduce the temporary fix in the WC blocks and we agreed it's better to fix it upstream. But now it's been couple of weeks since the fix was submitted and no movement there. Under such circumstances do you think I should add a temporary fix in this PR?

Also, can we use a different background color? Maybe Gutenberg-100?

I remember that was the design you provided, but Gutenberg's Notice component doesn't support such a color. Is it ok to customize it on a WC Blocks level or is it preferable to keep using whatever Gutenberg provides to keep the UI unified?

Copy link
Contributor Author

@kmanijak kmanijak Aug 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jarekmorawski, I'll be merging this PR, but there's still some time to apply some changes before it's released. Please let me know your thoughts on the above comment 🙏

@jarekmorawski
Copy link

Now the question is, should we revert all old Product Collection blocks to Products beta blocks, which were customized 1 month ago?

Good question. This notice should appear only for existing Products (Beta) blocks, and the user should not be able to add any new ones. We'd only show it for the first 3-5 visits to the editor (or until dismissed manually), so when the user checks back in a month, they wouldn't be able to revert to Products (Beta).

@kmanijak
Copy link
Contributor Author

kmanijak commented Aug 1, 2023

Now the question is, should we revert all old Product Collection blocks to Products beta blocks, which were customized 1 month ago? Because AFAIU as per the current implementation, all Product collection blocks on the page will be replaced with Products beta block.

Good question. This notice should appear only for existing Products (Beta) blocks, and the user should not be able to add any new ones. We'd only show it for the first 3-5 visits to the editor (or until dismissed manually), so when the user checks back in a month, they wouldn't be able to revert to Products (Beta).

Thanks for your input @jarekmorawski. Yes, the idea is that when we enable automatic migration, then Products (Beta) block won't be available in the inserter, unless merchant reverted the migration.

We'd only show it for the first 3-5 visits to the editor

My suggestion is to add two conditions:

  • number of visits and I think at least one focus on Product Collection is necessary to make sure the user saw the notice at least once.
  • time condition, for example, 5 days.

Whichever happens first, we don't show the notice anymore. What do you think about that @imanish003, @jarekmorawski?

Anyway, my idea was to implement this last bit in a separate PR, but great we have that discussion.

@imanish003
Copy link
Contributor

Hey Karol!

number of visits and I think at least one focus on Product Collection is necessary to make sure the user saw the notice at least once.

Sounds good to me, except IMO, visits should be calculated only when:

  • The user's focus is on the Product Collection block.
  • The sidebar is open (Because if the sidebar is not open, then the notice won't be visible).

This way, we show the notice at least 3-5 times to the user unless the user dismisses it.

But this is just my opinion. I think we can go with whatever @jarekmorawski approves 🙂

@kmanijak
Copy link
Contributor Author

kmanijak commented Aug 7, 2023

@jarekmorawski , @shaunandrews , could we get from either of you feedback on this thread. Let me summarise it:

When users migrated the Products (Beta) block to Product Collection (for now manually), we display the Notice:
image

We need to agree on conditions where to hide it. Currently implemented are:

  • when the user reverted the migration,
  • when the user dismissed the notice (proof they've seen it),

But we cannot display the Notice forever. As @jarekmorawski wrote:

We'd only show it for the first 3-5 visits to the editor (or until dismissed manually), so when the user checks back in a month, they wouldn't be able to revert to Products (Beta).

I suggested we add two conditions:

  • number of focuses on the Product Collection block (3-5 as per Jarek's comment). We need to choose a specific number, so I suggest 4,
  • time condition, for example, 24h. So basically if the user doesn't click 4 times on Product Collection for 24h (and more), we should not display the Notice anymore.

Does it make sense? Do you agree with these values: 24h, 4 visits?

@kmanijak
Copy link
Contributor Author

kmanijak commented Aug 7, 2023

Update: the above solution is mostly covered in #10494, but awaits the sign off.

@jarekmorawski
Copy link

Hi @kmanijak 👋 The first condition looks good to me. I'd tweak the second one to 72 hrs because merchants may not visit the editor very often when they're busy running a business. I'd also follow @imanish003's advice to only count a visit when the block is in focus and the sidebar is open. Thanks for handling this!

* Add timestamp to each upgrade notice status change

* Revert back only Product Collections converted from Products block

* Make the time threshold configurable

* Add logic that hides the Upgrade Notice after some amount of displays

* Fix the taxQuery migration from Product Collection to Products

* Change the way to count Product Collection entries

* Fix the problem of multiple display counter increments with Product Collection

* Update Upgrade Notice visibility conditions

* Add contiions to unmark Product Collection as converted from Products

* Change variable name

* Change variable t to time name for better readibility. Improve types

* Replace useState with useRef

* Remove unecessary props passed to UpgradeNotice
@kmanijak
Copy link
Contributor Author

@gigitux , @imanish003 can I ask either of you to review this PR? This PR contains changes from #10494 that were tested separately and now it provides the full-fledged migration from Products (Beta) to Product Collection.

I tried to request a review from you, but this PR is already awaiting review from you hence the comment. Thank you! 🙏

@imanish003
Copy link
Contributor

Hey @kmanijak 👋

It appears that the testing steps might be out of date. Considering that PR #10494 has been merged into this one, it seems necessary to include information about when the notice will disappear i.e.

  • When a user dismisses the notice.
  • After 72 hours have passed.
  • Once the notice has been displayed four times.

I've tested this PR and haven't come across any issues. Once the testing steps are updated, I can review it again. Thanks 🙌🏻

@kmanijak
Copy link
Contributor Author

It appears that the testing steps might be out of date. Considering that PR #10494 has been merged into this one, it seems necessary to include information about when the notice will disappear i.e.

When a user dismisses the notice.
After 72 hours have passed.
Once the notice has been displayed four times.
I've tested this PR and haven't come across any issues. Once the testing steps are updated, I can review it again. Thanks 🙌🏻

Thanks @imanish003! Good catch! I updated the testing steps by adding more information to SCENARIO 1 🙌 Could you check it again, please?

Copy link
Contributor

@imanish003 imanish003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Karol! I appreciate your efforts in updating the testing steps. I've observed that in the section labeled SCENARIO 2. Dismiss the notice, the following step might be inaccurate:

Continue to follow steps 7 - 12.

Could you please review this step once more?

Aside from this, I find everything else to be in good order. You've done an excellent job. Thank you for incorporating the automatic migration. 🙌🏻 🚀

@github-actions github-actions bot added this to the 11.0.0 milestone Aug 17, 2023
@kmanijak kmanijak merged commit de5c3e0 into trunk Aug 18, 2023
41 checks passed
@kmanijak kmanijak deleted the add/products-migration-upgrade-notice-logic branch August 18, 2023 06:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: product collection Issues related to the Product Collection block block-type: product-query Issues related to/affecting all product-query variations. skip-changelog PRs that you don't want to appear in the changelog.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migration path from Products to Products Collection block
3 participants