magento / pwa-studio

🛠Development tools to build, optimize and deploy Progressive Web Applications for Magento 2.
https://developer.adobe.com/commerce/pwa-studio/
Open Software License 3.0
1.06k stars 682 forks source link

[feature]: Cart event pub/sub #2987

Open abrhim opened 3 years ago

abrhim commented 3 years ago

Is your feature request related to a problem? Please describe. Data Solutions uses cart events to track user behavior. Right now we are looking thru Peregrine to find talons and wrapping handleAddToCart and handleRemoveFromCart functions, but this is proving to be difficult because these functions are callbacks called within a react hook later. This removes the ability to call any of our custom hooks within these functions.

Describe the solution you'd like An internal pub/sub that publishes cart events.

Describe alternatives you've considered wrapping the useMiniCart and hitting the graphql cache on every render, maintaining the previous value and comparing it to the current to determine if items were added/removed from cart.

Additional context none

Please let us know what packages this feature is in regards to:

m2-assistant[bot] commented 3 years ago

Hi @abrhim. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.

Please, add a comment to assign the issue: @magento I am working on this


sirugh commented 3 years ago

@magento export issue to JIRA project PWA as Story

github-jira-sync-bot commented 3 years ago

:white_check_mark: Jira issue (https://jira.corp.magento.com/browse/PWA-1444) is successfully created for this issue.

sirugh commented 3 years ago

This is blocked internally by a spike to research possibilities for a secure, built-in eventing system, PWA-1389.