Skip to content

Commit

Permalink
🚩Enable career contact form on brazil #2343 (#2345)
Browse files Browse the repository at this point in the history
* 🚩 Enable forms on brazil #2343

* :flag: Create separate feature flags for forms #2343

* 🐛 Filter false values from form selection list #2343

* 🚩Enable career fair form not contact form #2343
  • Loading branch information
padms authored Jun 6, 2024
1 parent 93c41fa commit 7d04877
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 13 deletions.
22 changes: 20 additions & 2 deletions FeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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),
Expand Down
16 changes: 10 additions & 6 deletions sanityv3/schemas/objects/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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(),
Expand Down
10 changes: 5 additions & 5 deletions sanityv3/schemas/textSnippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
Expand Down

0 comments on commit 7d04877

Please sign in to comment.