-
Notifications
You must be signed in to change notification settings - Fork 219
Product Collection - logic to hide upgrade notice #10494
Product Collection - logic to hide upgrade notice #10494
Conversation
The release ZIP for this PR is accessible via:
Script Dependencies ReportThere is no changed script dependency between this branch and trunk. This comment was automatically generated by the TypeScript Errors Report
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 assets/js/data/cart/push-changes.ts |
Size Change: +312 B (0%) Total Size: 1.34 MB
ℹ️ View Unchanged
|
…roduct-collection-logic-to-hide-upgrade-notice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @kmanijak, fantastic job! 🚀 I truly appreciate your thoroughness in addressing all the edge cases. I've tested the changes, and everything is functioning as anticipated. I've left a few minor suggestions, but I'm pre-approving the PR since they aren't blockers. 🚢
assets/js/blocks/migration-products-to-product-collection/constants.ts
Outdated
Show resolved
Hide resolved
assets/js/blocks/migration-products-to-product-collection/constants.ts
Outdated
Show resolved
Hide resolved
assets/js/blocks/product-collection/inspector-controls/upgrade-notice.tsx
Outdated
Show resolved
Hide resolved
46ca3da
into
add/products-migration-upgrade-notice-logic
…ction (#10267) * WIP of Upgrade Notice state * Extend the state options with seeing option * Move the logic to the dedicated folder * Subscribe only if not reverted * Refactor the way UpgradeNotice is rendered * Simplify the logic of keeping the Upgrade Notice state in local storage * Improve types organisation * Lift the functions interacting with local storage to the Inspector Controls of Product Colelction * Simplify logic of showing Upgrade Notice * Disable auto migration * Refactoring * Use useLocalStorageState hook * Fix incorrect merge * Final improvements * Allow to display Upgrade Notice after revert and manual upgrade * Fix incorrect merge * Improve the unsubscribe process * Trigger auto-update from Product Collection only * Remove weird console.log * Abstract manual update from Product Query * Fix the taxQuery migration from Product Collection to Products * Product Collection - logic to hide upgrade notice (#10494) * 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
This PR adds the logic of hiding Upgrade Notice after:
(as per #10267 (comment))
There's also a new logic added: after converting Products to Product Collection and reverting back to Products ONLY initially converted Products block will be converted back. So if the merchant added others Product Collection blocks manually, they won't get converted.
If some of the conditions to stop displaying Upgrade Notice are met:
then Product Collection blocks will be unmarked as converted from Products. This is to prevent showing the Notice after a longer period of time when the user switched the browser/machine or for some reason cleared the local storage. In that cases the notice could've been displayed if blocks were not unmarked as converted.
Part of #9703
Testing
Automated Tests
User Facing Testing
Prerequisites:
true
SCENARIO 1. Ignore the Upgrade Notice (display 4 times)
SCENARIO 2. Ignore the Upgrade Notice (display 72h)
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/60
(1 minute) or1/30
(2 minutes).SCENARIO 3. Don't display Upgrade Notice on another browser
WooCommerce Visibility