-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(new-price-calculator): proper reset after adding offer to cart (#…
…4860) ## Describe your changes _Reset_ new price calculator after adding offer to cart ## Justify why they are needed ### The issue As can be seen in the following video, when you navigate back to price calculator page after adding an offer to the cart you end up in a misleading state of price calculator which might make you add multiple insurances for the same dog. Observe that for being able to add multiple products to the same dog, the user would need to take some actions that would make a **different** offer to be added to the cart like changing deductible for example. Changing _start date_ doesn't causes that, that's why you can still see only one offer in your cart when _add to cart_ button get's clicked: https://github.com/user-attachments/assets/3df963db-ccf4-48bc-a344-88d32489ca8e The same occurs for non multi products as well - like rent. The difference tho is that you can only have a single product of that type in your cart in all scenarios. So repeating the steps for rent would show a error dialog, which makes sense. ### The solution What this solution does is: * Update new price calculator so it works the same way as the old one when it comes about price intent reseting: whenever a new product get's added to the cart we create a new price intent for that product. * `PurchaseSummary` is not rendered as a step of `PurchaseFormV2`. Instead we alternate between then inside `PriceCalculatorCmsPageContent`. With that, reseting the price intent and synchronizing price calculator atoms which it would cause any issues with `PurchaseSummary`. * Code scout: since now old and new price calculator have the same "reset" price intent logic we don't need `useResetPriceIntent` hook anymore so I'm deleting it. https://github.com/user-attachments/assets/4e8c085f-ecde-4c10-b8d7-43d74120574b
- Loading branch information
Showing
9 changed files
with
58 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters