Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Repos that we’ll change

RBI Sanity Shared Schemas Intl Sanity Shared Schemas: https://github.com/rbilabs/rbiintl-sanity-shared-schemas - Connect your Github account/

Whitelabel CMS: https://github.com/rbilabs/intl-whitelabel-cms - Connect your Github account

...

  • Motivation: this toggle will enable the new feature integration for “free/promotional items” on the cart

  • Label: Make options Options in this section as free add-onsSection as Free Add Ons

  • Description: By turning this on, guests will be able to add the options in the list of add-ons for free to their order. You can choose which items in the order are eligible to grant free add-ons and also how many add-on units will be free of charge per item.

    Rules:

    Toggle should only be visible by Intl market: hidden: () => !ctx.isIntl

    Note: to list add-ons as free, there needs to be a 0.00 PLU item configured respectively to the regular price PLU.

 

PATH FOR THE SOLUTION

  • Add the new toggle on /src/schemas/menu/documents/add-on-section.tsx

...

  • The initial value for this toggle: FALSEThis toggle should only be visible to Intl market hidden: () => !ctx.isIntl

 

Task 2: Extend the Option item to have new fields

...

We’ll have two new fields: “Free addon item” and “Menu items to offer the free item” on the add-on-section-option.ts:

“Free addon Item”

  • Label: (to be defined) Free Option

  • Description: (to be defined) The free option needs to be a 0.00 PLU version of the regular price option. If the options listed here are not 0.00 PLU, they will NOT appear as free for the guest.

  • Rules:

    • Type reference to type item (as the “Option” that we already have on the screen)

    • Should be hidden if:

      • !ctx.isIntl AND !ctxTest.document.enableAddonAsFreeItem

    • Required/invalid if:

      • context?.document?.enableAddonAsFreeItem && !value (validation prop with custom rule)

...

“Menu items to offer the free item”

  • Label: (to be defined) Menu Options that Offer the Free Options Above

  • Description: (to be defined) The option listed above in the “Free option” section will be offered by the ones listed here for the guests that have them in their cart at checkout.

  • Rules:

    • Type array to type addOnSectionMenuOptions (suggestion of name… we’ll create the new object that will be used here)

    • Should be hidden if:

      • !ctx.isIntl AND !ctxTest.document.enableAddonAsFreeItem

    • Required/invalid if:

      • context?.document?.enableAddonAsFreeItem && !value (validation prop with custom rule)

...

For this object we’ll have:

“Free quantity”

  • Label: (to be defined) Maximum Free Add-On Amount

  • Description: (to be defined) This is the max limit for the Free Add On Item that will be offered by this Menu Option.

  • Rules:

    • validation: (Rule: any) => Rule.min(1)

    • Required (can’t be empty)

    • initialValue: 1

    • Type: number

 

“Menu item”

  • Label: (to be defined)

  • Description: (to be defined)

  • Menu Option

  • Rules:

    • Type reference to type item (as the “Option” that we already have on the screen)

    • validation: (Rule: any) => Rule.required()

...

  • Motivation: configure the add-ons free modal. The fieldset will help the organization, by grouping the fields

  • Label: (to be defined)Description: (to be defined)Free Add On Modal

  • Description: When a guest has a Menu Option that offers a Free Add On Item in their cart at checkout, this modal will appear for them to add the Free Add On Item.

  • 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 for add-on free items is ON

...

We also will have the following fields inside this fieldset:

  • Image field

    Image Removed

...

  • Modal toggle (to show/hide on the Whitelabel App):

    • Label: (to be defined)Description: (to be defined)Show Free Add-On Modal at Checkout

  • Image field

    Image Added

...

  • Modal title field

    • Label: (to be defined)Description: (to be defined)Title

  • Modal description field

    • Label: (to be defined)Description

    • Description: (to be defined)Used to provide context to the guest why they‘re seeing the modal and what is the offer.

  • Modal primary button field

    • Label: (to be defined)CTA

    • Description: (to be defined)This is the action to add the Free Add-On item to the order.

  • Rules:

    • If the toggle is ON

      • The title and primary button should be filled in and are required. This is needed to prevent the user from publishing the document and to not show an empty modal on the Whitelabel App

      • Description and image fields are optional

      • Important: these fields need to be localized ones

 

PATH FOR THE SOLUTION

  • For the fieldset, we have the Hero example on the Intl CMS repo and the doc from Sanity above

  • For the image, we can take a look at the item document from the CMS or other documents that have an image field and make the same

...

 

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