Table of Contents
Document Status | PROPOSAL UNDER REVIEW |
---|---|
Document Owner(s) | |
Reviewers |
Context and epic
Epic: - TRX-1894Getting issue details... STATUS
Solution proposal to change the upsell modal trigger behavior
Iberia requirements (can be updated/changed)
The ability to change the trigger to only open the modal for Combo/Picker type items. Today the current behavior is to show the modal for all type of items
Proposal
File to be changed: src/state/order/index.js
Function that is responsible to trigger the logic today: openUpsellModal
The main logic
Adjust the openUpsellModal to handle a new path of logic
The idea is to keep the default behavior if the new logic is not enabled in Sanity: show the modal for any type of item
Create new functions to isolate the new logic (they can also be in a utils file, for example)
Function for the new variation logic (which will change the trigger behavior)
Functions to serve as utilities (for example, to know if the item is Combo/Picker)
Check the
newCartEntries
to be able to identify if the added item is a typePicker
orCombo
We can use Sanity to hold the logic that will change the upsell modal trigger behavior (mode details at https://rbictg.atlassian.net/wiki/spaces/IBC/pages/edit-v2/4940922909#Sanity-to-hold-the-new-trigger-behavior below)
The code below can exemplify how things will be. Of course, this is just an example and will not represent the final solution.
Video explanation:
Upsell modal will only be shown for Pickers/Combos (if the new logic is enabled at Sanity)
When I’ve created a new journey, cleaning the cart and adding a Coca-Cola, the modal did not show as expected because Coca-Cola is a type of item
Sanity to hold the new trigger behavior
Add a new section in Feature Menu to configure the modal trigger behavior
We’ll need to at least develop a new hook to get the desired value configured in the new Sanity section. This hook will encapsulate the query and will be used inside
src/state/order/index.js
. The rest of the implementation will follow the same idea shown at https://rbictg.atlassian.net/wiki/spaces/IBC/pages/edit-v2/4940922909#The-main-logic section.
This Flexible solution. Can be extended or changed with a friendly user UI
Important Feature flags (intl-guest-app)
upsell-modal: If ON will enable/disable the feature for the whole WL App (need to be ON),
enable-checkout-upsell-items-2: need to be ON to show upsell items at the checkout page
mobileCartUpsellLocation: Can be configured to select the position of the Upsell section:
abovePaymentDetails
aboveYourCart
chefRecommendationEngine2: It needs to be configured to use recommendations from Sanity. This will show the menu feature upsell with the new UI. Another option is
Another option to also show the menu feature upsell with the new UI is to configure the deprecate-chef to be false AND the user is not signed in AND the enable-move-signup-after-cart flag is ON. For our case and my analysis, we’ll be safe using only the chefRecommendationEngine2 configured to use Sanity.
How the new upsell current solution looks like (visually speaking)
Upsell Modal
Following our initial business requirements this modal will be shown after we add a Combo/Picker into the cart.
Add Comment