Repos that we’ll change
...
Task 1: Add a new toggle to enable the “free items” on AddOnSection
Task 2: Add a new options section but for the selection of the items that will have free add-on items
Task 3: Create a new section (fieldset) for the free-addon modal
Whitelabel:
Task 1: Create a new feature flag (
enable-free-addon-on-cart
)This flag will condition the new logic added in the AddOnsItemsContainer
Task 2: Update types and graphql after changes in the CMS repo
...
Tasks breakdown
RBI Sanity Shared Schemas
...
Motivation: the client wants to control freely the number of items. This will solve other business problems.
Label: Quantity of free add-ons
Description: (to be defined)
DOD-LIKE
Add the new options on the UI
Condition the new options to be visible only if the new toggle is TRUE.
The modal for “+ Add item” should have:
Quantity of free items field
Item dropdown
...
Motivation: configure the add-ons free modal. The fieldset will help with the organization to group the fields
Label: (to be defined)
Description: (to be defined)
Rules:
The fieldset should not be collapsed when appears (DOC)
All fields should be children of the fieldset
The fieldset should only be visible if the toggle is TRUE
...
Image field
...
Modal title field
Label: (to be defined)
Description: (to be defined)
Modal description field
Label: (to be defined)
Description: (to be defined)
Modal button field
Label: (to be defined)
Description: (to be defined)
DOD-LIKE
All the fields should be children of the modal fieldset
The fieldset should not be collapsed when appears
Condition the new fieldset to be visible only if the new toggle is TRUE
...
Whitelabel
Task 2: Update types and graphql after changes in the CMS repo
Add the new interfaces in the
add-on-section.graphql
Path:
src/queries/sanity/fragments/add-on-section.graphql
yarn run apollo:generate
Clear the generated file just with the needed changes
Update the Interface for the
use-feature-menu-add-on.tsx
Path:
src/hooks/use-feature-menu-add-on.tsx
Some unit tests will break and we’ll need to adjust them
PATH FOR THE SOLUTION
As we’ll have other options we’ll have something equal to the original options (with different names). For the new toggle, we’ll have another flag as the “showSectionItemsOnCart”.
Create another Fragment for the new option following the example of the original options
DOD-LIKE
After adding the new interfaces open the AddOnsItemsContainer component and add a console log to see if the values from Sanity will be available in the sections. Do some tests (changing the values on Sanity) to see if all is good