Technical Refinement - Tiered Fees Custom Discount Message
- de Sousa Santos, Rodrigo
- Augusto Romao, Vinicius
Table of Contents
- 1.1 SANITY
- 1.1.1 Demonstration
- 1.2 WhiteLabel
- 1.3 Screenshots
- 1.4 Unit Test
- 1.5 POC
- 1.1 SANITY
- 2 Impact Analysis
- 3 Useful Links
SANITY
Create an item on the menu;
path:
intl-whitelabel-cms/desk-structure/marketing-content.ts
;This menu needs to be shown just IBERIA markets;
See: https://github.com/rbilabs/intl-whitelabel-cms/tree/poc/IBFEC-1747-fees-custom-message-3
Create the feature structure
for each file add the constant name, title, name, type, and preview structure, All things that need to work.
Create the types file with the types
See: https://github.com/rbilabs/intl-whitelabel-cms/tree/poc/IBFEC-1747-fees-custom-message-3
Create the fee config fields
path:
intl-whitelabel-cms/schemas/fees/documents/fee-config.tsx
path:
intl-whitelabel-cms/schemas/fees/documents/fee-config-list.tsx
Using the method bases create;
See the acceptance criteria: Sanity > Fee Config
Create the Fee Restaurant Config fields
path:
intl-whitelabel-cms/schemas/fees/documents/fee-restaurant-config.tsx
path:
intl-whitelabel-cms/schemas/fees/documents/fee-restaurant-config-list.tsx
Using the method bases create;
After the first publish we will need to disable the fields:
Default Config
Fee Type
As the Fee Config document is used in the Fee Restaurant Config document the user can change the toggle even if the document is already published. As we don’t find a way to control this we need to ensure that the user will not be able to change the value of the toggle after the first publish.
Sanity doc:
https://dev-plk-es-whitelabel-cms.rbi.tools/desk/marketingContent;features;featureFee;feesConfig
To achieve that, we can:
Create a custom publish action (https://www.sanity.io/docs/document-actions)
This action will be responsible for setting
true
on the new custom fieldisPublished
(see below for more details) - and
Condition this new action to be only available for the Fee Config document (without affecting the other documents)
Create a new custom field in the Fee Config option to know if the document is already published or not (the name can be
isPublished
, for example)Add the hidden to this new field, as the user doesn’t need to see it. This field will only be used to control if the toggle is read-only or not (aka disabled)
Add the
readOnly
property to the Default Config toggle using the newisPublished
propSee:
Demonstration
WhiteLabel
Create a new query to get the Sanity values;
Run apollo generate to create the sanity graphql method;
Screenshots
N/A
Unit Test
N/A
POC
intl-whitelabel-cms:
Impact Analysis
N/A
Useful Links
Figma SANITY:
Figma Whitelabel APP: