diff --git a/FeatureFlags.js b/FeatureFlags.js index af178b6f3..a7bfdf73f 100644 --- a/FeatureFlags.js +++ b/FeatureFlags.js @@ -38,7 +38,13 @@ const MAGAZINE_INDEX = [...GLOBAL_PROD, ...GLOBAL_DEV] const LOCAL_NEWS = [...GLOBAL_PROD, ...GLOBAL_DEV] const SEARCH = [...GLOBAL_PROD, ...GLOBAL_DEV] const EVENT = [...GLOBAL_PROD, ...GLOBAL_DEV] -const FORMS = [...GLOBAL_PROD, ...GLOBAL_DEV] + +const SUBSCRIBE_FORM = [...GLOBAL_PROD, ...GLOBAL_DEV] +const CAREERS_CONTACT_FORM = [...GLOBAL_PROD, ...GLOBAL_DEV] +const CONTACT_EQUINOR_FORM = [...GLOBAL_PROD, ...GLOBAL_DEV] +const ORDER_REPORT_FORM = [...GLOBAL_PROD, ...GLOBAL_DEV] +const CAREER_FAIR_AND_VISITS_FORM = [...GLOBAL_PROD, ...GLOBAL_DEV, 'brazil'] + const FANCY_MENU = [...GLOBAL_PROD, ...GLOBAL_DEV] /* LANDING_PAGE requires FANCY_MENU to work */ const LANDING_PAGE = [...GLOBAL_PROD, ...GLOBAL_DEV] @@ -62,7 +68,19 @@ export default (dataset) => ({ HAS_LOCAL_NEWS: LOCAL_NEWS.includes(dataset), HAS_SEARCH: SEARCH.includes(dataset), HAS_EVENT: EVENT.includes(dataset), - HAS_FORMS: FORMS.includes(dataset), + HAS_FORMS: + CAREERS_CONTACT_FORM.includes(dataset) || + CAREER_FAIR_AND_VISITS_FORM.includes(dataset) || + CONTACT_EQUINOR_FORM.includes(dataset) || + ORDER_REPORT_FORM.includes(dataset) || + SUBSCRIBE_FORM.includes(dataset), + + HAS_SUBSCRIBE_FORM: SUBSCRIBE_FORM.includes(dataset), + HAS_CAREERS_CONTACT_FORM: CAREERS_CONTACT_FORM.includes(dataset), + HAS_CAREER_FAIR_AND_VISITS_FORM: CAREER_FAIR_AND_VISITS_FORM.includes(dataset), + HAS_ORDER_REPORT_FORM: ORDER_REPORT_FORM.includes(dataset), + HAS_CONTACT_EQUINOR_FORM: CONTACT_EQUINOR_FORM.includes(dataset), + HAS_FANCY_MENU: FANCY_MENU.includes(dataset), /* LANDING_PAGE requires FANCY_MENU to work */ HAS_LANDING_PAGE: FANCY_MENU.includes(dataset) && LANDING_PAGE.includes(dataset), diff --git a/sanityv3/schemas/objects/form.tsx b/sanityv3/schemas/objects/form.tsx index 1d7b2f918..1b6e264fb 100644 --- a/sanityv3/schemas/objects/form.tsx +++ b/sanityv3/schemas/objects/form.tsx @@ -4,6 +4,7 @@ import CompactBlockEditor from '../components/CompactBlockEditor' import { configureBlockContent, configureTitleBlockContent } from '../editors' import { validateRequiredIfVisible } from '../validations/validateRequiredIfVisible' import { DownloadableFile } from './files' +import { Flags } from '../../src/lib/datasetHelpers' const titleContentType = configureTitleBlockContent() @@ -58,12 +59,15 @@ export default { title: 'Type of form', options: { list: [ - { title: 'Subscribe Form', value: 'subscribeForm' }, - { title: 'Contact Equinor form', value: 'contactEquinorForm' }, - { title: 'Careers contact form', value: 'careersContactForm' }, - { title: 'Order reports', value: 'orderReportsForm' }, - { title: 'Career fairs and visits', value: 'careerFairAndVisitsForm' }, - ], + Flags.HAS_SUBSCRIBE_FORM && { title: 'Subscribe Form', value: 'subscribeForm' }, + Flags.HAS_CONTACT_EQUINOR_FORM && { title: 'Contact Equinor form', value: 'contactEquinorForm' }, + Flags.HAS_CAREERS_CONTACT_FORM && { title: 'Careers contact form', value: 'careersContactForm' }, + Flags.HAS_ORDER_REPORT_FORM && { title: 'Order reports', value: 'orderReportsForm' }, + Flags.HAS_CAREER_FAIR_AND_VISITS_FORM && { + title: 'Career fairs and visits', + value: 'careerFairAndVisitsForm', + }, + ].filter((e) => e), layout: 'dropdown', }, validation: (Rule: Rule) => Rule.required(), diff --git a/sanityv3/schemas/textSnippets.ts b/sanityv3/schemas/textSnippets.ts index cd3aa14c1..c3d46e68e 100644 --- a/sanityv3/schemas/textSnippets.ts +++ b/sanityv3/schemas/textSnippets.ts @@ -5,11 +5,11 @@ export const groups = { magazine: { title: 'Magazine', hidden: !Flags.HAS_MAGAZINE }, search: { title: 'Search', hidden: !Flags.HAS_SEARCH }, eventPromotion: { title: 'Event', hidden: !Flags.HAS_EVENT }, - subscribeForm: { title: 'Subscribe form', hidden: !Flags.HAS_FORMS }, - careerFairForm: { title: 'Career fair form', hidden: !Flags.HAS_FORMS }, - contactForm: { title: 'Contact form', hidden: !Flags.HAS_FORMS }, - careerContactForm: { title: 'Careers Contact Form', hidden: !Flags.HAS_FORMS }, - orderAnnualReportsForm: { title: 'Order annual reports form', hidden: !Flags.HAS_FORMS }, + subscribeForm: { title: 'Subscribe form', hidden: !Flags.HAS_SUBSCRIBE_FORM }, + careerFairForm: { title: 'Career fair form', hidden: !Flags.HAS_CAREER_FAIR_AND_VISITS_FORM }, + contactForm: { title: 'Contact form', hidden: !Flags.HAS_CONTACT_EQUINOR_FORM }, + careerContactForm: { title: 'Careers Contact Form', hidden: !Flags.HAS_CAREERS_CONTACT_FORM }, + orderAnnualReportsForm: { title: 'Order annual reports form', hidden: !Flags.HAS_ORDER_REPORT_FORM }, form: { title: 'Form', hidden: !Flags.HAS_FORMS }, cookie: { title: 'Cookie' }, others: { title: 'Others' },