Skip to content

Commit

Permalink
✨ Updates to career contact form #2338 (#2342)
Browse files Browse the repository at this point in the history
* 🚨 Fix lint issues #2338

* ✨ Updates to career contact form #2338
  • Loading branch information
padms authored Jun 7, 2024
1 parent 7d04877 commit 7b426be
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 17 deletions.
2 changes: 1 addition & 1 deletion web/pageComponents/topicPages/Form/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ContactEquinorForm from './ContactEquinorForm'
import SubscribeForm from './SubscribeForm'
import CareerFairForm from './CareerFairForm'
import OrderReportsForm from './OrderReportsForm'
import CareersContactForm from './CareersContactForm'
import CareersContactForm from './careersContactForm/CareersContactForm'
import type { LinkData, FormData } from '../../../types/types'
import { twMerge } from 'tailwind-merge'
import CallToActions from '@sections/CallToActions'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import {
FormSubmitFailureBox,
} from '@components'
import { BaseSyntheticEvent, useState } from 'react'
import FriendlyCaptcha from './FriendlyCaptcha'
import FriendlyCaptcha from '../FriendlyCaptcha'
import styled from 'styled-components'
import { CareersContactFormCatalogType } from '../../../types'
import getCatalogType from './getRequestType'

type FormValues = {
name: string
Expand Down Expand Up @@ -43,7 +43,7 @@ const CareersContactForm = () => {
body: JSON.stringify({
data,
frcCaptchaSolution: (event?.target as any)['frc-captcha-solution'].value,
catalogType: getCatalog(data.category),
catalogType: getCatalogType(intl, data.category, data.candidateType),
}),
headers: {
'Content-Type': 'application/json',
Expand All @@ -53,18 +53,6 @@ const CareersContactForm = () => {
setSuccessfullySubmitted(res.status == 200)
setServerError(res.status != 200)
}
const getCatalog = (category: string): CareersContactFormCatalogType | null => {
if (
category.includes(
intl.formatMessage({
id: 'careers_contact_form_suspected_recruitment_scam',
defaultMessage: 'Suspected recruitment scam',
}),
)
)
return 'suspectedRecruitmentScamRequest'
else return 'others'
}

const {
handleSubmit,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { CareersContactFormCatalogType } from '../../../../types'
import { IntlShape } from 'react-intl'

export default function getCatalogType(
intl: IntlShape,
category: string,
candidateType: string,
): CareersContactFormCatalogType | null {
const suspectedRecruitmentScam = intl.formatMessage({
id: 'careers_contact_form_suspected_recruitment_scam',
defaultMessage: 'Suspected recruitment scam',
})

const graduates = intl.formatMessage({
id: ' careers_contact_form_graduates',
defaultMessage: 'Graduates',
})

const interns = intl.formatMessage({
id: 'careers_contact_form_interns',
defaultMessage: 'Interns (e.g. summer, academic)',
})
const apprentices = intl.formatMessage({
id: 'careers_contact_form_apprentices',
defaultMessage: 'Apprentices/lærlinger',
})

if (category.includes(suspectedRecruitmentScam)) return 'suspectedRecruitmentScamRequest'
else if (candidateType.includes(graduates) || candidateType.includes(interns) || candidateType.includes(apprentices))
return 'emergingTalentsQueries'
else return 'others'
}
2 changes: 2 additions & 0 deletions web/pages/api/forms/service-now-careers-contact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const getCatalogIdentifier = (catalogType: CareersContactFormCatalogType | null)
switch (catalogType) {
case 'suspectedRecruitmentScamRequest':
return 'b04a9748832d8610347af830feaad382'
case 'emergingTalentsQueries':
return '3971e24c375a3640615af01643990ebf'
default:
return '59e02ac8375a3640615af01643990e7c'
}
Expand Down
2 changes: 1 addition & 1 deletion web/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ export type IframeCarouselData = {

export type ContactFormCatalogType = 'humanRightsInformationRequest' | 'loginIssues'

export type CareersContactFormCatalogType = 'suspectedRecruitmentScamRequest' | 'others'
export type CareersContactFormCatalogType = 'suspectedRecruitmentScamRequest' | 'emergingTalentsQueries' | 'others'

export type KeyNumberItemData = {
type: 'keyNumberItem'
Expand Down

0 comments on commit 7b426be

Please sign in to comment.