diff --git a/libs/application/templates/health-insurance/project.json b/libs/application/templates/health-insurance/project.json index c5b6337c69fe..0a1d94683d7a 100644 --- a/libs/application/templates/health-insurance/project.json +++ b/libs/application/templates/health-insurance/project.json @@ -21,7 +21,7 @@ "extract-strings": { "executor": "nx:run-commands", "options": { - "command": "yarn ts-node -P libs/localization/tsconfig.lib.json libs/localization/scripts/extract libs/application/templates/health-insurance/src/forms/messages.ts" + "command": "yarn ts-node -P libs/localization/tsconfig.lib.json libs/localization/scripts/extract libs/application/templates/health-insurance/src/lib/messages/*.ts" } } } diff --git a/libs/application/templates/health-insurance/src/assets/Logo.tsx b/libs/application/templates/health-insurance/src/assets/Logo.tsx index dc0c1de9e194..14957f4ea67d 100644 --- a/libs/application/templates/health-insurance/src/assets/Logo.tsx +++ b/libs/application/templates/health-insurance/src/assets/Logo.tsx @@ -1,6 +1,4 @@ -import React, { FC } from 'react' - -const Logo: FC> = () => ( +export const Logo = () => ( > = () => ( /> ) - -export default Logo diff --git a/libs/application/templates/health-insurance/src/assets/ManOnBenchIllustration.tsx b/libs/application/templates/health-insurance/src/assets/ManOnBenchIllustration.tsx deleted file mode 100644 index 6be7c64ac9e7..000000000000 --- a/libs/application/templates/health-insurance/src/assets/ManOnBenchIllustration.tsx +++ /dev/null @@ -1,1773 +0,0 @@ -import React, { FC } from 'react' - -const ManOnBenchIllustration: FC> = () => ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -) - -export default ManOnBenchIllustration diff --git a/libs/application/templates/health-insurance/src/fields/AgentComment/AgentComment.tsx b/libs/application/templates/health-insurance/src/fields/AgentComment/AgentComment.tsx deleted file mode 100644 index ab0835be0430..000000000000 --- a/libs/application/templates/health-insurance/src/fields/AgentComment/AgentComment.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import React, { FC } from 'react' -import { formatText, getValueViaPath } from '@island.is/application/core' -import { FieldBaseProps } from '@island.is/application/types' -import { Text, Stack } from '@island.is/island-ui/core' -import { useLocale } from '@island.is/localization' -import { m } from '../../forms/messages' - -const AgentComment: FC> = ({ - application, -}) => { - const agentComments = getValueViaPath( - application.answers, - 'agentComments', - ) as string - const { formatMessage } = useLocale() - - return ( - - - {formatText(m.agentCommentsTitle, application, formatMessage)} - - - {agentComments - ? agentComments - : formatText(m.agentCommentsEmpty, application, formatMessage)} - - - ) -} - -export default AgentComment diff --git a/libs/application/templates/health-insurance/src/fields/ChildrenInfoMessage/ChildrenInfoMessage.css.ts b/libs/application/templates/health-insurance/src/fields/ChildrenInfoMessage/ChildrenInfoMessage.css.ts deleted file mode 100644 index be79cd764be3..000000000000 --- a/libs/application/templates/health-insurance/src/fields/ChildrenInfoMessage/ChildrenInfoMessage.css.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { style } from '@vanilla-extract/css' - -export const marginFix = style({ - marginTop: '-8px', -}) diff --git a/libs/application/templates/health-insurance/src/fields/ChildrenInfoMessage/ChildrenInfoMessage.tsx b/libs/application/templates/health-insurance/src/fields/ChildrenInfoMessage/ChildrenInfoMessage.tsx deleted file mode 100644 index 9ef1c5e184dd..000000000000 --- a/libs/application/templates/health-insurance/src/fields/ChildrenInfoMessage/ChildrenInfoMessage.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import React, { FC } from 'react' -import { formatText } from '@island.is/application/core' -import { FieldBaseProps } from '@island.is/application/types' -import { AlertMessage, Box } from '@island.is/island-ui/core' -import { useLocale } from '@island.is/localization' -import * as styles from './ChildrenInfoMessage.css' -import { m } from '../../forms/messages' - -const ChildrenInfoMessage: FC> = ({ - application, -}) => { - const { formatMessage } = useLocale() - - return ( - - - - ) -} - -export default ChildrenInfoMessage diff --git a/libs/application/templates/health-insurance/src/fields/CitizenshipField/CitizenshipField.tsx b/libs/application/templates/health-insurance/src/fields/CitizenshipField/CitizenshipField.tsx deleted file mode 100644 index d176bb593568..000000000000 --- a/libs/application/templates/health-insurance/src/fields/CitizenshipField/CitizenshipField.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import React, { FC, useEffect, useState } from 'react' -import { useFormContext } from 'react-hook-form' -import { getValueViaPath } from '@island.is/application/core' -import { FieldBaseProps } from '@island.is/application/types' -import { Box, Input } from '@island.is/island-ui/core' -import { ExternalDataNationalRegistry } from '../../types' - -const CitizenshipField: FC> = ({ - field, - application, -}) => { - const { id } = field - const citizenship = ( - getValueViaPath( - application.externalData, - 'nationalRegistry', - ) as ExternalDataNationalRegistry - )?.data?.citizenship - - const [countryData, setCountryData] = useState( - JSON.stringify(citizenship), - ) - const { register } = useFormContext() - - useEffect(() => { - setCountryData(JSON.stringify({ ...citizenship })) - }, [citizenship]) - - return ( - - ) -} - -export default CitizenshipField diff --git a/libs/application/templates/health-insurance/src/fields/ConfirmCheckbox/ConfirmCheckbox.tsx b/libs/application/templates/health-insurance/src/fields/ConfirmCheckbox/ConfirmCheckbox.tsx deleted file mode 100644 index 6ee0f96b98a0..000000000000 --- a/libs/application/templates/health-insurance/src/fields/ConfirmCheckbox/ConfirmCheckbox.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import React, { FC } from 'react' -import { Controller, useFormContext } from 'react-hook-form' -import { formatText, getValueViaPath } from '@island.is/application/core' -import { FieldBaseProps } from '@island.is/application/types' -import { Box, Checkbox } from '@island.is/island-ui/core' -import { useLocale } from '@island.is/localization' -import { m } from '../../forms/messages' - -const ConfirmCheckbox: FC> = ({ - error, - field, - application, -}) => { - const { id, disabled } = field - const { setValue } = useFormContext() - const defaultValue = getValueViaPath( - application.answers, - id as string, - false, - ) as boolean - const { formatMessage } = useLocale() - - return ( - { - return ( - - { - onChange(e.target.checked) - setValue(id as string, e.target.checked) - }} - /> - - ) - }} - /> - ) -} - -export default ConfirmCheckbox diff --git a/libs/application/templates/health-insurance/src/fields/HiddenDateField/HiddenDateField.tsx b/libs/application/templates/health-insurance/src/fields/HiddenDateField/HiddenDateField.tsx index 3a2fa12ead78..c8b60e1d337a 100644 --- a/libs/application/templates/health-insurance/src/fields/HiddenDateField/HiddenDateField.tsx +++ b/libs/application/templates/health-insurance/src/fields/HiddenDateField/HiddenDateField.tsx @@ -1,13 +1,10 @@ -import React, { FC } from 'react' import { getValueViaPath } from '@island.is/application/core' import { FieldBaseProps } from '@island.is/application/types' import { Input, Box } from '@island.is/island-ui/core' import { useFormContext } from 'react-hook-form' -import { MissingInfoType } from '../../types' +import { MissingInfoType } from '../../utils/types' -const HiddenDateField: FC> = ({ - application, -}) => { +export const HiddenDateField = ({ application }: FieldBaseProps) => { const { register } = useFormContext() const missingInfo = (getValueViaPath( @@ -31,5 +28,3 @@ const HiddenDateField: FC> = ({ ) } - -export default HiddenDateField diff --git a/libs/application/templates/health-insurance/src/fields/MissingInfoRemarks/MissingInfoRemarks.tsx b/libs/application/templates/health-insurance/src/fields/MissingInfoRemarks/MissingInfoRemarks.tsx index 12739a72138e..38d6891a8560 100644 --- a/libs/application/templates/health-insurance/src/fields/MissingInfoRemarks/MissingInfoRemarks.tsx +++ b/libs/application/templates/health-insurance/src/fields/MissingInfoRemarks/MissingInfoRemarks.tsx @@ -1,16 +1,15 @@ -import React, { FC } from 'react' import { formatText, getValueViaPath } from '@island.is/application/core' import { Input } from '@island.is/island-ui/core' import { useLocale } from '@island.is/localization' import { useFormContext } from 'react-hook-form' -import { m } from '../../forms/messages' -import { MissingInfoType, ReviewFieldProps } from '../../types' +import { m } from '../../lib/messages/messages' +import { MissingInfoType, ReviewFieldProps } from '../../utils/types' -const MissingInfoRemarks: FC> = ({ +export const MissingInfoRemarks = ({ application, isEditable = true, index = 0, -}) => { +}: ReviewFieldProps) => { const { register } = useFormContext() const { formatMessage } = useLocale() @@ -40,5 +39,3 @@ const MissingInfoRemarks: FC> = ({ /> ) } - -export default MissingInfoRemarks diff --git a/libs/application/templates/health-insurance/src/fields/PrerequisiteSummary/PrerequisiteSummary.tsx b/libs/application/templates/health-insurance/src/fields/PrerequisiteSummary/PrerequisiteSummary.tsx index eeba777f4129..cf446bf0a86a 100644 --- a/libs/application/templates/health-insurance/src/fields/PrerequisiteSummary/PrerequisiteSummary.tsx +++ b/libs/application/templates/health-insurance/src/fields/PrerequisiteSummary/PrerequisiteSummary.tsx @@ -1,17 +1,14 @@ -import { FC } from 'react' -import { m } from '../../forms/messages' +import { m } from '../../lib/messages/messages' import { FieldBaseProps } from '@island.is/application/types' import { Box } from '@island.is/island-ui/core' -import SummaryItem from './SummaryItem' +import { SummaryItem } from './SummaryItem' import { hasHealthInsurance, hasNoIcelandicAddress, } from '../../healthInsuranceUtils' import { useLocale } from '@island.is/localization' -const PrerequisiteSummary: FC> = ({ - application, -}) => { +export const PrerequisiteSummary = ({ application }: FieldBaseProps) => { const { formatMessage } = useLocale() const externalData = application.externalData @@ -78,7 +75,7 @@ const PrerequisiteSummary: FC> = ({ {prerequisites.map((prerequisite, i) => { return ( > = ({ ) } - -export default PrerequisiteSummary diff --git a/libs/application/templates/health-insurance/src/fields/PrerequisiteSummary/SummaryItem.tsx b/libs/application/templates/health-insurance/src/fields/PrerequisiteSummary/SummaryItem.tsx index 185f7cb28d63..93e9b7cc6812 100644 --- a/libs/application/templates/health-insurance/src/fields/PrerequisiteSummary/SummaryItem.tsx +++ b/libs/application/templates/health-insurance/src/fields/PrerequisiteSummary/SummaryItem.tsx @@ -1,4 +1,3 @@ -import React, { FC } from 'react' import { Box, Button, Icon, Tag, Text } from '@island.is/island-ui/core' import * as styles from './SummaryItem.css' @@ -23,7 +22,7 @@ type SummaryItemProps = { tagText: string } -const SummaryItem: FC> = ({ +export const SummaryItem = ({ title, description, furtherInformationTitle, @@ -33,7 +32,7 @@ const SummaryItem: FC> = ({ buttonLink, tagText, index, -}) => { +}: SummaryItemProps) => { return ( > = ({ ) } - -export default SummaryItem diff --git a/libs/application/templates/health-insurance/src/fields/Review/ContactInfo.tsx b/libs/application/templates/health-insurance/src/fields/Review/ContactInfo.tsx index b05f938dd53e..00fd8d4fdd69 100644 --- a/libs/application/templates/health-insurance/src/fields/Review/ContactInfo.tsx +++ b/libs/application/templates/health-insurance/src/fields/Review/ContactInfo.tsx @@ -1,4 +1,3 @@ -import React, { FC } from 'react' import { useFormContext } from 'react-hook-form' import { formatText, getValueViaPath } from '@island.is/application/core' import { @@ -10,16 +9,14 @@ import { } from '@island.is/island-ui/core' import { useLocale } from '@island.is/localization' import { FieldDescription } from '@island.is/shared/form-fields' -import { m } from '../../forms/messages' +import { m } from '../../lib/messages/messages' import { ExternalDataNationalRegistry, ExternalDataUserProfile, ReviewFieldProps, -} from '../../types' +} from '../../utils/types' -const ContactInfo: FC> = ({ - application, -}) => { +export const ContactInfo = ({ application }: ReviewFieldProps) => { const { register } = useFormContext() const { formatMessage } = useLocale() @@ -133,5 +130,3 @@ const ContactInfo: FC> = ({ ) } - -export default ContactInfo diff --git a/libs/application/templates/health-insurance/src/fields/Review/FormerInsurance.tsx b/libs/application/templates/health-insurance/src/fields/Review/FormerInsurance.tsx index 94b767bb8128..68ca88344fa8 100644 --- a/libs/application/templates/health-insurance/src/fields/Review/FormerInsurance.tsx +++ b/libs/application/templates/health-insurance/src/fields/Review/FormerInsurance.tsx @@ -1,4 +1,4 @@ -import React, { FC, useState } from 'react' +import { useState } from 'react' import { useFormContext } from 'react-hook-form' import { formatText, getValueViaPath } from '@island.is/application/core' import { @@ -14,25 +14,25 @@ import { FieldDescription, RadioController, } from '@island.is/shared/form-fields' -import TextWithTooltip from '../TextWithTooltip/TextWithTooltip' -import { YES, NO, FILE_SIZE_LIMIT } from '../../shared' -import { m } from '../../forms/messages' +import { TextWithTooltip } from '../TextWithTooltip/TextWithTooltip' +import { m } from '../../lib/messages/messages' import { FormerInsurance as FormerInsuranceType, ReviewFieldProps, -} from '../../types' +} from '../../utils/types' import { requireConfirmationOfResidency, extractKeyFromStringObject, } from '../../healthInsuranceUtils' import { FileUploadController } from '@island.is/application/ui-components' +import { FILE_SIZE_LIMIT, NO, YES } from '../../utils/constants' -const FormerInsurance: FC> = ({ +export const FormerInsurance = ({ application, isEditable, field, error, -}) => { +}: ReviewFieldProps) => { const { register } = useFormContext() const { formatMessage } = useLocale() @@ -251,5 +251,3 @@ const FormerInsurance: FC> = ({ ) } - -export default FormerInsurance diff --git a/libs/application/templates/health-insurance/src/fields/Review/ReviewAdditionalInfo.tsx b/libs/application/templates/health-insurance/src/fields/Review/ReviewAdditionalInfo.tsx index d29d1adde8cd..a0a1a479a856 100644 --- a/libs/application/templates/health-insurance/src/fields/Review/ReviewAdditionalInfo.tsx +++ b/libs/application/templates/health-insurance/src/fields/Review/ReviewAdditionalInfo.tsx @@ -1,4 +1,3 @@ -import React, { FC } from 'react' import { formatText } from '@island.is/application/core' import { Box, @@ -9,23 +8,23 @@ import { Input, } from '@island.is/island-ui/core' import { useLocale } from '@island.is/localization' -import { AdditionalInfoType, ReviewFieldProps } from '../../types' -import { m } from '../../forms/messages' +import { AdditionalInfoType, ReviewFieldProps } from '../../utils/types' +import { m } from '../../lib/messages/messages' import { FieldDescription, RadioController, } from '@island.is/shared/form-fields' -import { NO, YES } from '../../shared' +import { NO, YES } from '../../utils/constants' interface Props extends ReviewFieldProps { additionalInfo: AdditionalInfoType } -const ReviewMissingInfo: FC> = ({ +export const ReviewMissingInfo = ({ application, isEditable, - additionalInfo = {}, -}) => { + additionalInfo = { remarks: '' }, +}: Props) => { const { formatMessage } = useLocale() return ( @@ -86,5 +85,3 @@ const ReviewMissingInfo: FC> = ({ ) } - -export default ReviewMissingInfo diff --git a/libs/application/templates/health-insurance/src/fields/Review/ReviewMissingInfo.tsx b/libs/application/templates/health-insurance/src/fields/Review/ReviewMissingInfo.tsx index 3f3176d8f0d1..d6827c02f724 100644 --- a/libs/application/templates/health-insurance/src/fields/Review/ReviewMissingInfo.tsx +++ b/libs/application/templates/health-insurance/src/fields/Review/ReviewMissingInfo.tsx @@ -1,29 +1,41 @@ -import React, { FC } from 'react' -import { formatText } from '@island.is/application/core' +import { formatText, getValueViaPath } from '@island.is/application/core' import { Box, Bullet, BulletList, Stack, Text } from '@island.is/island-ui/core' import { useLocale } from '@island.is/localization' -import { MissingInfoType, ReviewFieldProps } from '../../types' -import AgentComment from '../AgentComment/AgentComment' -import MissingInfoRemarks from '../MissingInfoRemarks/MissingInfoRemarks' -import { m } from '../../forms/messages' +import { MissingInfoType, ReviewFieldProps } from '../../utils/types' +import { MissingInfoRemarks } from '../MissingInfoRemarks/MissingInfoRemarks' +import { m } from '../../lib/messages/messages' interface Props extends ReviewFieldProps { missingInfo: MissingInfoType } -const ReviewMissingInfo: FC> = ({ +export const ReviewMissingInfo = ({ application, field, isEditable, - missingInfo = {}, + missingInfo = { date: '', remarks: '' }, index: missingInfoIndex, -}) => { +}: Props) => { const { formatMessage } = useLocale() + const agentComments = getValueViaPath( + application.answers, + 'agentComments', + ) as string + return ( - + + + {formatText(m.agentCommentsTitle, application, formatMessage)} + + + {agentComments + ? agentComments + : formatText(m.agentCommentsEmpty, application, formatMessage)} + + {formatText(m.missingInfoAnswersTitle, application, formatMessage)} @@ -53,5 +65,3 @@ const ReviewMissingInfo: FC> = ({ ) } - -export default ReviewMissingInfo diff --git a/libs/application/templates/health-insurance/src/fields/Review/StatusAndChildren.tsx b/libs/application/templates/health-insurance/src/fields/Review/StatusAndChildren.tsx index 1c1b82649914..fe81a97a0ead 100644 --- a/libs/application/templates/health-insurance/src/fields/Review/StatusAndChildren.tsx +++ b/libs/application/templates/health-insurance/src/fields/Review/StatusAndChildren.tsx @@ -1,4 +1,4 @@ -import React, { FC, useState } from 'react' +import { useState } from 'react' import { formatText, getValueViaPath } from '@island.is/application/core' import { Box, Stack, Text } from '@island.is/island-ui/core' import { useLocale } from '@island.is/localization' @@ -6,19 +6,25 @@ import { FieldDescription, RadioController, } from '@island.is/shared/form-fields' -import { YES, NO, FILE_SIZE_LIMIT, StatusTypes } from '../../shared' -import { ReviewFieldProps, Status } from '../../types' -import ChildrenInfoMessage from '../ChildrenInfoMessage/ChildrenInfoMessage' -import TextWithTooltip from '../TextWithTooltip/TextWithTooltip' -import { m } from '../../forms/messages' +import { ReviewFieldProps, Status } from '../../utils/types' +// import { ChildrenInfoMessage } from '../ChildrenInfoMessage/ChildrenInfoMessage' +import { TextWithTooltip } from '../TextWithTooltip/TextWithTooltip' + +import { m } from '../../lib/messages/messages' import { FileUploadController } from '@island.is/application/ui-components' +import { + FILE_SIZE_LIMIT, + NO, + EmploymentStatus, + YES, +} from '../../utils/constants' -const StatusAndChildren: FC> = ({ +export const StatusAndChildren = ({ application, isEditable, field, -}) => { +}: ReviewFieldProps) => { const { formatMessage } = useLocale() const [status, setStatus] = useState( @@ -43,12 +49,12 @@ const StatusAndChildren: FC> = ({ largeButtons={true} split={'1/2'} onSelect={(value) => - setStatus({ ...status, type: value as StatusTypes }) + setStatus({ ...status, type: value as EmploymentStatus }) } options={[ { label: formatText(m.statusEmployed, application, formatMessage), - value: StatusTypes.EMPLOYED, + value: EmploymentStatus.EMPLOYED, tooltip: formatText( m.statusEmployedInformation, application, @@ -57,7 +63,7 @@ const StatusAndChildren: FC> = ({ }, { label: formatText(m.statusStudent, application, formatMessage), - value: StatusTypes.STUDENT, + value: EmploymentStatus.STUDENT, tooltip: formatText( m.statusStudentInformation, application, @@ -70,7 +76,7 @@ const StatusAndChildren: FC> = ({ application, formatMessage, ), - value: StatusTypes.PENSIONER, + value: EmploymentStatus.PENSIONER, tooltip: formatText( m.statusPensionerInformation, application, @@ -79,7 +85,7 @@ const StatusAndChildren: FC> = ({ }, { label: formatText(m.statusOther, application, formatMessage), - value: StatusTypes.OTHER, + value: EmploymentStatus.OTHER, tooltip: formatText( m.statusOtherInformation, application, @@ -89,7 +95,7 @@ const StatusAndChildren: FC> = ({ ]} /> - {status.type === StatusTypes.STUDENT && ( + {status.type === EmploymentStatus.STUDENT && ( > = ({ ]} /> + {/* + TODO: Refactor the whole review section when build accordion field merges and add this back in {children === YES && ( - )} + )} */} ) } - -export default StatusAndChildren diff --git a/libs/application/templates/health-insurance/src/fields/Review/index.tsx b/libs/application/templates/health-insurance/src/fields/Review/index.tsx index 476feb5dd1d3..2bbd53dcc527 100644 --- a/libs/application/templates/health-insurance/src/fields/Review/index.tsx +++ b/libs/application/templates/health-insurance/src/fields/Review/index.tsx @@ -1,17 +1,13 @@ -import React, { FC } from 'react' import { formatText } from '@island.is/application/core' import { FieldBaseProps } from '@island.is/application/types' import { Accordion, AccordionItem, Box } from '@island.is/island-ui/core' import { useLocale } from '@island.is/localization' -import { m } from '../../forms/messages' -import FormerInsurance from './FormerInsurance' -import StatusAndChildren from './StatusAndChildren' -import ContactInfo from './ContactInfo' +import { m } from '../../lib/messages/messages' +import { FormerInsurance } from './FormerInsurance' +import { StatusAndChildren } from './StatusAndChildren' +import { ContactInfo } from './ContactInfo' -const Review: FC> = ({ - field, - application, -}) => { +export const Review = ({ field, application }: FieldBaseProps) => { const { formatMessage } = useLocale() const isEditable = field.id !== 'submittedData' @@ -53,5 +49,3 @@ const Review: FC> = ({ ) } - -export default Review diff --git a/libs/application/templates/health-insurance/src/fields/TextWithTooltip/TextWithTooltip.tsx b/libs/application/templates/health-insurance/src/fields/TextWithTooltip/TextWithTooltip.tsx index 53c86d642c82..94760bfc3279 100644 --- a/libs/application/templates/health-insurance/src/fields/TextWithTooltip/TextWithTooltip.tsx +++ b/libs/application/templates/health-insurance/src/fields/TextWithTooltip/TextWithTooltip.tsx @@ -1,4 +1,3 @@ -import React, { FC } from 'react' import { formatText } from '@island.is/application/core' import { FieldBaseProps } from '@island.is/application/types' import { Box, Text, Tooltip } from '@island.is/island-ui/core' @@ -10,12 +9,12 @@ export interface Props extends FieldBaseProps { description?: string } -const TextWithTooltip: FC> = ({ +export const TextWithTooltip = ({ application, field, title = '', description = '', -}) => { +}: Props) => { const { formatMessage } = useLocale() return ( @@ -38,5 +37,3 @@ const TextWithTooltip: FC> = ({ ) } - -export default TextWithTooltip diff --git a/libs/application/templates/health-insurance/src/fields/index.ts b/libs/application/templates/health-insurance/src/fields/index.ts index 244d57dade79..cb80c23a9bc8 100644 --- a/libs/application/templates/health-insurance/src/fields/index.ts +++ b/libs/application/templates/health-insurance/src/fields/index.ts @@ -1,9 +1,5 @@ -export { default as Review } from './Review' -export { default as ConfirmCheckbox } from './ConfirmCheckbox/ConfirmCheckbox' -export { default as AgentComment } from './AgentComment/AgentComment' -export { default as HiddenDateField } from './HiddenDateField/HiddenDateField' -export { default as MissingInfoRemarks } from './MissingInfoRemarks/MissingInfoRemarks' -export { default as ChildrenInfoMessage } from './ChildrenInfoMessage/ChildrenInfoMessage' -export { default as TextWithTooltip } from './TextWithTooltip/TextWithTooltip' -export { default as CitizenshipField } from './CitizenshipField/CitizenshipField' -export { default as PrerequisiteSummary } from './PrerequisiteSummary/PrerequisiteSummary' +export { Review } from './Review' +export { HiddenDateField } from './HiddenDateField/HiddenDateField' +export { MissingInfoRemarks } from './MissingInfoRemarks/MissingInfoRemarks' +export { TextWithTooltip } from './TextWithTooltip/TextWithTooltip' +export { PrerequisiteSummary } from './PrerequisiteSummary/PrerequisiteSummary' diff --git a/libs/application/templates/health-insurance/src/forms/ConfirmationScreen.ts b/libs/application/templates/health-insurance/src/forms/ConfirmationScreen.ts index 13ee2e8ec88c..ed972adf9968 100644 --- a/libs/application/templates/health-insurance/src/forms/ConfirmationScreen.ts +++ b/libs/application/templates/health-insurance/src/forms/ConfirmationScreen.ts @@ -1,7 +1,7 @@ import { buildForm } from '@island.is/application/core' import { Form, FormModes } from '@island.is/application/types' -import { m } from './messages' -import Logo from '../assets/Logo' +import { m } from '../lib/messages/messages' +import { Logo } from '../assets/Logo' import { buildFormConclusionSection } from '@island.is/application/ui-forms' export const HealthInsuranceConfirmation: Form = buildForm({ diff --git a/libs/application/templates/health-insurance/src/forms/HealthInsuranceForm.ts b/libs/application/templates/health-insurance/src/forms/HealthInsuranceForm.ts deleted file mode 100644 index a567db4bc189..000000000000 --- a/libs/application/templates/health-insurance/src/forms/HealthInsuranceForm.ts +++ /dev/null @@ -1,373 +0,0 @@ -import { - buildCustomField, - buildDividerField, - buildFileUploadField, - buildForm, - buildDescriptionField, - buildMultiField, - buildRadioField, - buildSection, - buildSubmitField, - buildTextField, - buildSelectField, - buildAlertMessageField, -} from '@island.is/application/core' -import { - Form, - FormModes, - Comparators, - FormValue, -} from '@island.is/application/types' -import { m } from './messages' -import { YES, NO, FILE_SIZE_LIMIT, StatusTypes } from '../shared' -import Logo from '../assets/Logo' -import { - requireConfirmationOfResidency, - requireWaitingPeriod, -} from '../healthInsuranceUtils' -import { Countries } from '../lib/Countries' -import { - applicantInformationMultiField, - buildFormConclusionSection, -} from '@island.is/application/ui-forms' - -export const HealthInsuranceForm: Form = buildForm({ - id: 'HealthInsuranceDraft', - title: m.formTitle, - logo: Logo, - mode: FormModes.DRAFT, - children: [ - buildSection({ - id: 'applicantInfoSection', - title: m.applicantInfoSection, - children: [applicantInformationMultiField()], - }), - buildSection({ - id: 'statusAndChildrenSection', - title: m.statusAndChildren, - children: [ - buildMultiField({ - id: 'statusAndChildren', - title: m.statusAndChildren, - children: [ - buildCustomField({ - id: 'citizenship', - title: '', - component: 'CitizenshipField', - }), - buildRadioField({ - id: 'status.type', - title: '', - description: m.statusDescription, - width: 'half', - required: true, - largeButtons: true, - options: [ - { - label: m.statusEmployed, - value: StatusTypes.EMPLOYED, - tooltip: m.statusEmployedInformation, - }, - { - label: m.statusStudent, - value: StatusTypes.STUDENT, - tooltip: m.statusStudentInformation, - }, - { - label: m.statusPensioner, - value: StatusTypes.PENSIONER, - tooltip: m.statusPensionerInformation, - }, - { - label: m.statusOther, - value: StatusTypes.OTHER, - tooltip: m.statusOtherInformation, - }, - ], - }), - buildDescriptionField({ - id: 'confirmationOfStudiesDescription', - title: '', - description: m.confirmationOfStudies, - tooltip: m.confirmationOfStudiesTooltip, - condition: (answers) => - (answers.status as { type: string })?.type === - StatusTypes.STUDENT, - }), - buildFileUploadField({ - id: 'status.confirmationOfStudies', - title: '', - introduction: '', - maxSize: FILE_SIZE_LIMIT, - uploadHeader: m.fileUploadHeader, - uploadDescription: m.fileUploadDescription, - uploadButtonLabel: m.fileUploadButton, - condition: (answers) => - (answers.status as { type: string })?.type === - StatusTypes.STUDENT, - }), - buildRadioField({ - id: 'children', - title: '', - description: m.childrenDescription, - width: 'half', - largeButtons: true, - required: true, - options: [ - { label: m.noOptionLabel, value: NO }, - { label: m.yesOptionLabel, value: YES }, - ], - }), - buildCustomField({ - id: 'childrenInfo', - title: '', - component: 'ChildrenInfoMessage', - condition: (answers) => answers.children === YES, - }), - ], - }), - ], - }), - buildSection({ - id: 'formerInsuranceSection', - title: m.formerInsuranceSection, - children: [ - buildMultiField({ - id: 'formerInsurance', - title: m.formerInsuranceTitle, - children: [ - buildRadioField({ - id: 'formerInsurance.registration', - title: '', - description: m.formerInsuranceRegistration, - largeButtons: true, - required: true, - options: [ - { label: m.formerInsuranceNoOption, value: NO }, - { label: m.yesOptionLabel, value: YES }, - ], - }), - buildSelectField({ - id: 'formerInsurance.country', - title: m.formerInsuranceCountry, - description: m.formerInsuranceDetails, - placeholder: m.formerInsuranceCountryPlaceholder, - required: true, - backgroundColor: 'blue', - options: Countries.map(({ name, alpha2Code: countryCode }) => { - const option = { name, countryCode } - return { - label: name, - value: JSON.stringify(option), - } - }), - }), - buildTextField({ - id: 'formerInsurance.personalId', - title: m.formerPersonalId, - width: 'half', - backgroundColor: 'blue', - required: true, - }), - buildTextField({ - id: 'formerInsurance.institution', - title: m.formerInsuranceInstitution, - width: 'half', - backgroundColor: 'blue', - required: true, - }), - buildAlertMessageField({ - id: 'waitingPeriodInfo', - title: m.waitingPeriodTitle, - message: m.waitingPeriodDescription, - alertType: 'error', - condition: (answers: FormValue) => { - const formerCountry = ( - answers as { - formerInsurance: { country: string } - } - )?.formerInsurance?.country - const citizenship = ( - answers as { - citizenship: string - } - )?.citizenship - return ( - !!formerCountry && - requireWaitingPeriod(formerCountry, citizenship) - ) - }, - }), - buildFileUploadField({ - id: 'formerInsurance.confirmationOfResidencyDocument', - title: '', - maxSize: FILE_SIZE_LIMIT, - introduction: m.confirmationOfResidencyFileUpload, - uploadHeader: m.fileUploadHeader, - uploadDescription: m.fileUploadDescription, - uploadButtonLabel: m.fileUploadButton, - condition: (answers: FormValue) => { - const formerCountry = ( - answers as { - formerInsurance: { country: string } - } - )?.formerInsurance?.country - return requireConfirmationOfResidency(formerCountry) - }, - }), - buildDividerField({ - title: ' ', - color: 'transparent', - }), - buildDescriptionField({ - id: 'formerInsurance.entitlementDescription', - title: '', - description: m.formerInsuranceEntitlement, - tooltip: m.formerInsuranceEntitlementTooltip, - condition: (answers: FormValue) => { - const formerCountry = ( - answers as { - formerInsurance: { country: string } - } - )?.formerInsurance?.country - const citizenship = ( - answers as { - citizenship: string - } - )?.citizenship - return !requireWaitingPeriod(formerCountry, citizenship) - }, - }), - buildRadioField({ - id: 'formerInsurance.entitlement', - title: '', - width: 'half', - largeButtons: true, - options: [ - { label: m.noOptionLabel, value: NO }, - { label: m.yesOptionLabel, value: YES }, - ], - condition: (answers: FormValue) => { - const formerCountry = ( - answers as { - formerInsurance: { country: string } - } - )?.formerInsurance?.country - const citizenship = ( - answers as { - citizenship: string - } - ).citizenship - return !requireWaitingPeriod(formerCountry, citizenship) - }, - }), - buildTextField({ - id: 'formerInsurance.entitlementReason', - title: m.formerInsuranceAdditionalInformation, - placeholder: m.formerInsuranceAdditionalInformationPlaceholder, - variant: 'textarea', - rows: 4, - backgroundColor: 'blue', - condition: (answers: FormValue) => { - const formerCountry = ( - answers as { - formerInsurance: { country: string } - } - )?.formerInsurance?.country - const citizenship = ( - answers as { - citizenship: string - } - )?.citizenship - return !requireWaitingPeriod(formerCountry, citizenship) - }, - }), - ], - }), - ], - }), - buildSection({ - id: 'confirm', - title: m.confirmationSection, - children: [ - buildMultiField({ - id: '', - title: m.confirmationTitle, - children: [ - buildCustomField({ - id: 'review', - title: '', - component: 'Review', - }), - buildRadioField({ - id: 'hasAdditionalInfo', - title: '', - description: m.additionalInfo, - largeButtons: true, - width: 'half', - options: [ - { value: NO, label: m.noOptionLabel }, - { value: YES, label: m.yesOptionLabel }, - ], - }), - buildTextField({ - id: 'additionalRemarks', - title: m.additionalRemarks, - variant: 'textarea', - rows: 4, - placeholder: m.additionalRemarksPlaceholder, - backgroundColor: 'blue', - condition: { - questionId: 'hasAdditionalInfo', - comparator: Comparators.EQUALS, - value: YES, - }, - }), - buildFileUploadField({ - id: 'additionalFiles', - title: '', - introduction: '', - maxSize: FILE_SIZE_LIMIT, - uploadHeader: m.fileUploadHeader, - uploadDescription: m.fileUploadDescription, - uploadButtonLabel: m.fileUploadButton, - condition: { - questionId: 'hasAdditionalInfo', - comparator: Comparators.EQUALS, - value: YES, - }, - }), - buildDividerField({ - title: ' ', - color: 'transparent', - condition: { - questionId: 'hasAdditionalInfo', - comparator: Comparators.EQUALS, - value: YES, - }, - }), - buildCustomField({ - id: 'confirmCorrectInfo', - title: '', - component: 'ConfirmCheckbox', - }), - buildSubmitField({ - id: 'submit', - title: m.submitLabel, - placement: 'footer', - actions: [ - { event: 'SUBMIT', name: m.submitLabel, type: 'primary' }, - ], - }), - ], - }), - ], - }), - buildFormConclusionSection({ - alertTitle: m.successfulSubmissionTitle, - alertMessage: m.successfulSubmissionMessage, - expandableHeader: m.successfulExpendableHeader, - expandableDescription: m.nextStepReviewTime, - }), - ], -}) diff --git a/libs/application/templates/health-insurance/src/forms/HealthInsuranceForm/aplicantInformationSection.ts b/libs/application/templates/health-insurance/src/forms/HealthInsuranceForm/aplicantInformationSection.ts new file mode 100644 index 000000000000..9d3ed1ac1158 --- /dev/null +++ b/libs/application/templates/health-insurance/src/forms/HealthInsuranceForm/aplicantInformationSection.ts @@ -0,0 +1,9 @@ +import { buildSection } from '@island.is/application/core' +import { m } from '../../lib/messages/messages' +import { applicantInformationMultiField } from '@island.is/application/ui-forms' + +export const applicantInformationSection = buildSection({ + id: 'applicantInfoSection', + title: m.applicantInfoSection, + children: [applicantInformationMultiField()], +}) diff --git a/libs/application/templates/health-insurance/src/forms/HealthInsuranceForm/confirmSection.ts b/libs/application/templates/health-insurance/src/forms/HealthInsuranceForm/confirmSection.ts new file mode 100644 index 000000000000..39157b108c6f --- /dev/null +++ b/libs/application/templates/health-insurance/src/forms/HealthInsuranceForm/confirmSection.ts @@ -0,0 +1,94 @@ +import { + buildCheckboxField, + buildCustomField, + buildDividerField, + buildFileUploadField, + buildMultiField, + buildRadioField, + buildSection, + buildSubmitField, + buildTextField, +} from '@island.is/application/core' +import { m } from '../../lib/messages/messages' +import { FILE_SIZE_LIMIT, YES } from '../../utils/constants' +import { Comparators } from '@island.is/application/types' +import { getYesNoOptions } from '../../utils/options' + +export const confirmSection = buildSection({ + id: 'confirm', + title: m.confirmationSection, + children: [ + buildMultiField({ + id: '', + title: m.confirmationTitle, + children: [ + buildCustomField({ + id: 'review', + title: '', + component: 'Review', + }), + buildRadioField({ + id: 'hasAdditionalInfo', + title: '', + description: m.additionalInfo, + largeButtons: true, + width: 'half', + options: getYesNoOptions({}), + }), + buildTextField({ + id: 'additionalRemarks', + title: m.additionalRemarks, + variant: 'textarea', + rows: 4, + placeholder: m.additionalRemarksPlaceholder, + backgroundColor: 'blue', + condition: { + questionId: 'hasAdditionalInfo', + comparator: Comparators.EQUALS, + value: YES, + }, + }), + buildFileUploadField({ + id: 'additionalFiles', + title: '', + introduction: '', + maxSize: FILE_SIZE_LIMIT, + uploadHeader: m.fileUploadHeader, + uploadDescription: m.fileUploadDescription, + uploadButtonLabel: m.fileUploadButton, + condition: { + questionId: 'hasAdditionalInfo', + comparator: Comparators.EQUALS, + value: YES, + }, + }), + buildDividerField({ + title: ' ', + color: 'transparent', + condition: { + questionId: 'hasAdditionalInfo', + comparator: Comparators.EQUALS, + value: YES, + }, + }), + buildCheckboxField({ + id: 'confirmCorrectInfo', + title: '', + required: true, + options: [ + { + value: YES, + label: m.confirmCorrectInfo, + }, + ], + }), + buildSubmitField({ + id: 'submit', + title: m.submitLabel, + placement: 'footer', + actions: [{ event: 'SUBMIT', name: m.submitLabel, type: 'primary' }], + }), + ], + }), + ], +}) diff --git a/libs/application/templates/health-insurance/src/forms/HealthInsuranceForm/formerInsuranceSection.ts b/libs/application/templates/health-insurance/src/forms/HealthInsuranceForm/formerInsuranceSection.ts new file mode 100644 index 000000000000..7aaae743edf9 --- /dev/null +++ b/libs/application/templates/health-insurance/src/forms/HealthInsuranceForm/formerInsuranceSection.ts @@ -0,0 +1,123 @@ +import { + buildAlertMessageField, + buildDescriptionField, + buildDividerField, + buildFileUploadField, + buildMultiField, + buildRadioField, + buildSection, + buildSelectField, + buildTextField, + getValueViaPath, +} from '@island.is/application/core' +import { m } from '../../lib/messages/messages' +import { FormValue } from '@island.is/application/types' +import { + requireConfirmationOfResidency, + requireWaitingPeriod, +} from '../../healthInsuranceUtils' +import { FILE_SIZE_LIMIT } from '../../utils/constants' +import { countryOptions, getYesNoOptions } from '../../utils/options' +import { + formerInsuranceCondition, + getFormerCountryAndCitizenship, +} from '../../utils/getFormerCountryAndCitizenship' + +export const formerInsuranceSection = buildSection({ + id: 'formerInsuranceSection', + title: m.formerInsuranceSection, + children: [ + buildMultiField({ + id: 'formerInsurance', + title: m.formerInsuranceTitle, + children: [ + buildRadioField({ + id: 'formerInsurance.registration', + title: '', + description: m.formerInsuranceRegistration, + largeButtons: true, + required: true, + options: getYesNoOptions({ no: m.formerInsuranceNoOption }), + }), + buildSelectField({ + id: 'formerInsurance.country', + title: m.formerInsuranceCountry, + description: m.formerInsuranceDetails, + placeholder: m.formerInsuranceCountryPlaceholder, + required: true, + backgroundColor: 'blue', + options: countryOptions, + }), + buildTextField({ + id: 'formerInsurance.personalId', + title: m.formerPersonalId, + width: 'half', + backgroundColor: 'blue', + required: true, + }), + buildTextField({ + id: 'formerInsurance.institution', + title: m.formerInsuranceInstitution, + width: 'half', + backgroundColor: 'blue', + required: true, + }), + buildAlertMessageField({ + id: 'waitingPeriodInfo', + title: m.waitingPeriodTitle, + message: m.waitingPeriodDescription, + alertType: 'error', + condition: (answers: FormValue) => { + const { formerCountry, citizenship } = + getFormerCountryAndCitizenship(answers) + return ( + !!formerCountry && + requireWaitingPeriod(formerCountry, citizenship) + ) + }, + }), + buildFileUploadField({ + id: 'formerInsurance.confirmationOfResidencyDocument', + title: '', + maxSize: FILE_SIZE_LIMIT, + introduction: m.confirmationOfResidencyFileUpload, + uploadHeader: m.fileUploadHeader, + uploadDescription: m.fileUploadDescription, + uploadButtonLabel: m.fileUploadButton, + condition: (answers: FormValue) => { + const { formerCountry } = getFormerCountryAndCitizenship(answers) + return requireConfirmationOfResidency(formerCountry) + }, + }), + buildDividerField({ + title: ' ', + color: 'transparent', + }), + buildDescriptionField({ + id: 'formerInsurance.entitlementDescription', + title: '', + description: m.formerInsuranceEntitlement, + tooltip: m.formerInsuranceEntitlementTooltip, + condition: (answers: FormValue) => formerInsuranceCondition(answers), + }), + buildRadioField({ + id: 'formerInsurance.entitlement', + title: '', + width: 'half', + largeButtons: true, + options: getYesNoOptions({}), + condition: (answers: FormValue) => formerInsuranceCondition(answers), + }), + buildTextField({ + id: 'formerInsurance.entitlementReason', + title: m.formerInsuranceAdditionalInformation, + placeholder: m.formerInsuranceAdditionalInformationPlaceholder, + variant: 'textarea', + rows: 4, + backgroundColor: 'blue', + condition: (answers: FormValue) => formerInsuranceCondition(answers), + }), + ], + }), + ], +}) diff --git a/libs/application/templates/health-insurance/src/forms/HealthInsuranceForm/index.ts b/libs/application/templates/health-insurance/src/forms/HealthInsuranceForm/index.ts new file mode 100644 index 000000000000..69e0645ddb8b --- /dev/null +++ b/libs/application/templates/health-insurance/src/forms/HealthInsuranceForm/index.ts @@ -0,0 +1,28 @@ +import { buildForm } from '@island.is/application/core' +import { Form, FormModes } from '@island.is/application/types' +import { m } from '../../lib/messages/messages' +import { Logo } from '../../assets/Logo' +import { buildFormConclusionSection } from '@island.is/application/ui-forms' +import { applicantInformationSection } from './aplicantInformationSection' +import { statusAndChildrenSection } from './statusAndChildrenSection' +import { formerInsuranceSection } from './formerInsuranceSection' +import { confirmSection } from './confirmSection' + +export const HealthInsuranceForm: Form = buildForm({ + id: 'HealthInsuranceDraft', + title: m.formTitle, + logo: Logo, + mode: FormModes.DRAFT, + children: [ + applicantInformationSection, + statusAndChildrenSection, + formerInsuranceSection, + confirmSection, + buildFormConclusionSection({ + alertTitle: m.successfulSubmissionTitle, + alertMessage: m.successfulSubmissionMessage, + expandableHeader: m.successfulExpendableHeader, + expandableDescription: m.nextStepReviewTime, + }), + ], +}) diff --git a/libs/application/templates/health-insurance/src/forms/HealthInsuranceForm/statusAndChildrenSection.ts b/libs/application/templates/health-insurance/src/forms/HealthInsuranceForm/statusAndChildrenSection.ts new file mode 100644 index 000000000000..90862cc5933a --- /dev/null +++ b/libs/application/templates/health-insurance/src/forms/HealthInsuranceForm/statusAndChildrenSection.ts @@ -0,0 +1,92 @@ +import { + buildAlertMessageField, + buildDescriptionField, + buildFileUploadField, + buildHiddenInput, + buildMultiField, + buildRadioField, + buildSection, + getValueViaPath, +} from '@island.is/application/core' +import { m } from '../../lib/messages/messages' +import { + EmploymentStatus, + FILE_SIZE_LIMIT, + NO, + YES, +} from '../../utils/constants' +import { getYesNoOptions, statusTypeOptions } from '../../utils/options' +import { Application } from '@island.is/application/types' +import { ExternalDataNationalRegistry } from '../../utils/types' + +export const statusAndChildrenSection = buildSection({ + id: 'statusAndChildrenSection', + title: m.statusAndChildren, + children: [ + buildMultiField({ + id: 'statusAndChildren', + title: m.statusAndChildren, + children: [ + buildHiddenInput({ + id: 'citizenship', + defaultValue: (application: Application) => { + const citizenship = ( + getValueViaPath( + application.externalData, + 'nationalRegistry', + ) as ExternalDataNationalRegistry + )?.data?.citizenship + + return JSON.stringify(citizenship) + }, + }), + buildRadioField({ + id: 'status.type', + title: '', + description: m.statusDescription, + width: 'half', + required: true, + largeButtons: true, + options: statusTypeOptions, + }), + buildDescriptionField({ + id: 'confirmationOfStudiesDescription', + title: '', + description: m.confirmationOfStudies, + tooltip: m.confirmationOfStudiesTooltip, + condition: (answers) => + (answers.status as { type: string })?.type === + EmploymentStatus.STUDENT, + }), + buildFileUploadField({ + id: 'status.confirmationOfStudies', + title: '', + introduction: '', + maxSize: FILE_SIZE_LIMIT, + uploadHeader: m.fileUploadHeader, + uploadDescription: m.fileUploadDescription, + uploadButtonLabel: m.fileUploadButton, + condition: (answers) => + (answers.status as { type: string })?.type === + EmploymentStatus.STUDENT, + }), + buildRadioField({ + id: 'children', + title: '', + description: m.childrenDescription, + width: 'half', + largeButtons: true, + required: true, + options: getYesNoOptions({}), + }), + buildAlertMessageField({ + id: 'childrenInfo', + title: m.childrenInfoMessageTitle, + message: m.childrenInfoMessageText, + alertType: 'info', + condition: (answers) => answers.children === YES, + }), + ], + }), + ], +}) diff --git a/libs/application/templates/health-insurance/src/forms/MissingInfoForm.ts b/libs/application/templates/health-insurance/src/forms/MissingInfoForm.ts index 81eaa9d3bb6f..2c4ffdc6ba94 100644 --- a/libs/application/templates/health-insurance/src/forms/MissingInfoForm.ts +++ b/libs/application/templates/health-insurance/src/forms/MissingInfoForm.ts @@ -1,19 +1,24 @@ import { + buildCheckboxField, buildCustomField, + buildDescriptionField, buildDividerField, buildFileUploadField, buildForm, buildMultiField, buildSection, buildSubmitField, + getValueViaPath, } from '@island.is/application/core' -import { Form, FormModes } from '@island.is/application/types' +import { Application, Form, FormModes, YES } from '@island.is/application/types' import { buildFormConclusionSection } from '@island.is/application/ui-forms' -import { m } from './messages' +import { m } from '../lib/messages/messages' +import { Logo } from '../assets/Logo' export const MissingInfoForm: Form = buildForm({ id: 'HealthInsuranceReview', title: m.formTitle, + logo: Logo, mode: FormModes.IN_PROGRESS, children: [ buildSection({ @@ -25,10 +30,13 @@ export const MissingInfoForm: Form = buildForm({ title: m.missingInfoSection, description: '', children: [ - buildCustomField({ + buildDescriptionField({ id: 'description', - title: 'Agent comments', - component: 'AgentComment', + title: m.agentCommentsTitle, + titleVariant: 'h4', + description: (application: Application) => + getValueViaPath(application.answers, 'agentComments') ?? + m.agentCommentsEmpty, }), buildDividerField({ title: m.missingInfoAnswersTitle, @@ -58,10 +66,15 @@ export const MissingInfoForm: Form = buildForm({ title: '', component: 'Review', }), - buildCustomField({ + buildCheckboxField({ id: 'confirmMissingInfo', title: '', - component: 'ConfirmCheckbox', + options: [ + { + value: YES, + label: m.confirmCorrectInfo, + }, + ], }), buildSubmitField({ id: 'submit', diff --git a/libs/application/templates/health-insurance/src/forms/PrerequisitesForm.ts b/libs/application/templates/health-insurance/src/forms/PrerequisitesForm.ts index 811e16208f4d..9ea4cde1017e 100644 --- a/libs/application/templates/health-insurance/src/forms/PrerequisitesForm.ts +++ b/libs/application/templates/health-insurance/src/forms/PrerequisitesForm.ts @@ -18,8 +18,8 @@ import { NationalRegistryUserApi, UserProfileApi, } from '../dataProviders' -import { m } from './messages' -import Logo from '../assets/Logo' +import { m } from '../lib/messages/messages' +import { Logo } from '../assets/Logo' import { prerequisitesFailed } from '../healthInsuranceUtils' export const PrerequisitesForm: Form = buildForm({ @@ -68,11 +68,13 @@ export const PrerequisitesForm: Form = buildForm({ subTitle: m.dataProvidersMoreInfo, }), buildDataProviderItem({ + id: 'userProfile', provider: UserProfileApi, title: '', subTitle: '', }), buildDataProviderItem({ + id: 'healthInsurance', provider: HealthInsuranceApi, title: '', subTitle: '', @@ -82,7 +84,7 @@ export const PrerequisitesForm: Form = buildForm({ buildMultiField({ id: 'externalDataSuccessPrerequisites', title: m.prerequisiteCheckScreenTitle, - condition: (formValue: FormValue, externalData: ExternalData) => { + condition: (_formValue: FormValue, externalData: ExternalData) => { return !prerequisitesFailed(externalData) }, children: [ @@ -110,7 +112,7 @@ export const PrerequisitesForm: Form = buildForm({ buildMultiField({ id: 'externalDataFailedPrerequisites', title: m.prerequisiteCheckScreenTitle, - condition: (formValue: FormValue, externalData: ExternalData) => { + condition: (_formValue: FormValue, externalData: ExternalData) => { return prerequisitesFailed(externalData) }, children: [ diff --git a/libs/application/templates/health-insurance/src/forms/ReviewApplication.ts b/libs/application/templates/health-insurance/src/forms/ReviewApplication.ts index 93fdfadfb373..54a0dcbf467f 100644 --- a/libs/application/templates/health-insurance/src/forms/ReviewApplication.ts +++ b/libs/application/templates/health-insurance/src/forms/ReviewApplication.ts @@ -7,11 +7,13 @@ import { buildTextField, } from '@island.is/application/core' import { Form, FormModes } from '@island.is/application/types' -import { m } from './messages' +import { m } from '../lib/messages/messages' +import { Logo } from '../assets/Logo' export const ReviewApplication: Form = buildForm({ id: 'HealthInsuranceDraft', title: m.formTitle, + logo: Logo, mode: FormModes.DRAFT, children: [ buildSection({ diff --git a/libs/application/templates/health-insurance/src/healthInsuranceUtils.ts b/libs/application/templates/health-insurance/src/healthInsuranceUtils.ts index 36a67a16d40a..207c831ee159 100644 --- a/libs/application/templates/health-insurance/src/healthInsuranceUtils.ts +++ b/libs/application/templates/health-insurance/src/healthInsuranceUtils.ts @@ -1,9 +1,10 @@ import { ExternalData } from '@island.is/application/types' import { NationalRegistryAddress as Address } from '@island.is/api/schema' import { Applications } from './dataProviders/APIDataTypes' -import { NordicCountriesCountryCode } from './shared' -import { EU } from './lib/EU' -import { EFTA } from './lib/EFTA' + +import { EU } from './utils/EU' +import { EFTA } from './utils/EFTA' +import { NordicCountriesCountryCode } from './utils/constants' export const getDraftApplications = (applications: Applications[]) => { return applications?.filter((application) => application.state === 'draft') diff --git a/libs/application/templates/health-insurance/src/index.ts b/libs/application/templates/health-insurance/src/index.ts index 36a1feb551d7..a12e40c0dbfd 100644 --- a/libs/application/templates/health-insurance/src/index.ts +++ b/libs/application/templates/health-insurance/src/index.ts @@ -3,6 +3,6 @@ import HealthInsuranceTemplate from './lib/HealthInsuranceTemplate' export const getDataProviders = () => import('./dataProviders/') export const getFields = () => import('./fields/') -export type { ExternalDataNationalRegistry } from './types' +export type { ExternalDataNationalRegistry } from './utils/types' export default HealthInsuranceTemplate diff --git a/libs/application/templates/health-insurance/src/lib/HealthInsuranceTemplate.spec.ts b/libs/application/templates/health-insurance/src/lib/HealthInsuranceTemplate.spec.ts deleted file mode 100644 index 15966cb8a56c..000000000000 --- a/libs/application/templates/health-insurance/src/lib/HealthInsuranceTemplate.spec.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { ApplicationTemplateHelper } from '@island.is/application/core' -import { - Application, - ApplicationTypes, - ExternalData, - DefaultEvents, - FormValue, - ApplicationStatus, -} from '@island.is/application/types' -import HealthInsuranceTemplate from './HealthInsuranceTemplate' - -function buildApplication(data: { - answers?: FormValue - externalData?: ExternalData - state?: string -}): Application { - const { answers = {}, externalData = {}, state = 'draft' } = data - return { - id: '12345', - assignees: [], - applicant: '123456-7890', - typeId: ApplicationTypes.HEALTH_INSURANCE, - created: new Date(), - status: ApplicationStatus.IN_PROGRESS, - modified: new Date(), - applicantActors: [], - answers, - state, - externalData, - } -} - -describe('Health Insurance Application Template', () => { - describe('state transitions', () => { - it('should transition from draft to inReview on submit', () => { - const helper = new ApplicationTemplateHelper( - buildApplication({ - answers: { - confirmCorrectInfo: true, - }, - }), - HealthInsuranceTemplate, - ) - const [hasChanged, newState] = helper.changeState({ - type: DefaultEvents.SUBMIT, - }) - expect(hasChanged).toBe(true) - expect(newState).toBe('inReview') - }) - }) -}) diff --git a/libs/application/templates/health-insurance/src/lib/HealthInsuranceTemplate.ts b/libs/application/templates/health-insurance/src/lib/HealthInsuranceTemplate.ts index 419220d957c9..68c0222e2a9a 100644 --- a/libs/application/templates/health-insurance/src/lib/HealthInsuranceTemplate.ts +++ b/libs/application/templates/health-insurance/src/lib/HealthInsuranceTemplate.ts @@ -16,10 +16,9 @@ import { UserProfileApi, ApplicationConfigurations, } from '@island.is/application/types' -import { API_MODULE } from '../shared' -import { answerValidators } from './answerValidators' -import { m } from '../forms/messages' -import { HealthInsuranceSchema } from './dataSchema' +import { m } from './messages/messages' +import { dataSchema } from './dataSchema' +import { API_MODULE } from '../utils/constants' type Events = { type: DefaultEvents.SUBMIT } @@ -45,7 +44,7 @@ const HealthInsuranceTemplate: ApplicationTemplate< > = { type: ApplicationTypes.HEALTH_INSURANCE, name: applicationName, - dataSchema: HealthInsuranceSchema, + dataSchema, translationNamespaces: [configuration.translation], allowMultipleApplicationsInDraft: false, stateMachineConfig: { @@ -172,7 +171,6 @@ const HealthInsuranceTemplate: ApplicationTemplate< } return undefined }, - answerValidators, } export default HealthInsuranceTemplate diff --git a/libs/application/templates/health-insurance/src/lib/answerValidators.spec.ts b/libs/application/templates/health-insurance/src/lib/answerValidators.spec.ts deleted file mode 100644 index 95345cbd293c..000000000000 --- a/libs/application/templates/health-insurance/src/lib/answerValidators.spec.ts +++ /dev/null @@ -1,306 +0,0 @@ -import { - ApplicationWithAttachments as Application, - ApplicationStatus, - ApplicationTypes, -} from '@island.is/application/types' -import { NO, YES, StatusTypes } from '../shared' - -import { answerValidators } from './answerValidators' - -describe('answerValidators', () => { - const baseApplication: Application = { - answers: { - fieldId: 'some answer', - citizenship: '{"code":"IS","name":"Ísland"}', - }, - assignees: [], - applicant: '', - applicantActors: [], - status: ApplicationStatus.IN_PROGRESS, - created: new Date(), - attachments: {}, - externalData: { - nationalRegistry: { - date: new Date(), - status: 'success', - data: {}, - }, - userProfile: { - date: new Date(), - status: 'success', - data: {}, - }, - }, - id: '', - modified: new Date(), - state: '', - typeId: ApplicationTypes.HEALTH_INSURANCE, - } - - it('should return error when status type is not a defined type', () => { - const newStatusAnswers = { - type: 'someType', - } - - expect( - answerValidators['status'](newStatusAnswers, baseApplication), - ).toStrictEqual({ - message: 'You must select one of the above', - path: 'status.type', - values: undefined, - }) - }) - - it('should not return any error when status type a defined type', () => { - const newStatusAnswers = { - type: StatusTypes.OTHER, - } - - expect( - answerValidators['status'](newStatusAnswers, baseApplication), - ).toStrictEqual(undefined) - }) - - it('should return error when student has not attached a file', () => { - const newStatusAnswers = { - type: StatusTypes.STUDENT, - confirmationOfStudies: [], - } - - expect( - answerValidators['status'](newStatusAnswers, baseApplication), - ).toStrictEqual({ - message: 'Please attach a confirmation of studies', - path: 'status.confirmationOfStudies', - values: undefined, - }) - }) - - it('should not return error when student has attached a file', () => { - const newStatusAnswers = { - type: StatusTypes.STUDENT, - confirmationOfStudies: [ - { name: 'some filename', key: 'uuid', url: 'url to file' }, - ], - } - - expect( - answerValidators['status'](newStatusAnswers, baseApplication), - ).toStrictEqual(undefined) - }) - - it('should return error when former insurance registration is empty', () => { - const newFormerInsuranceAnswers = { - registration: '', - } - - expect( - answerValidators['formerInsurance']( - newFormerInsuranceAnswers, - baseApplication, - ), - ).toStrictEqual({ - message: 'You must select one of the above', - path: 'formerInsurance.registration', - values: undefined, - }) - }) - - it('should return error if waiting period is required due to moving form country outside of EU', () => { - const newFormerInsuranceAnswers = { - registration: YES, - country: 'Outside of EU', - } - - expect( - answerValidators['formerInsurance']( - newFormerInsuranceAnswers, - baseApplication, - ), - ).toStrictEqual({ - message: '', - path: 'formerInsurance', - values: undefined, - }) - }) - - it('should return error if waiting period is required due to citizenship outside of EU', () => { - const newApplication = { - ...baseApplication, - answers: { citizenship: 'outside EU' }, - } as Application - - const newFormerInsuranceAnswers = { - registration: YES, - country: JSON.stringify({ name: 'Belgium', countryCode: 'BE' }), - } - - expect( - answerValidators['formerInsurance']( - newFormerInsuranceAnswers, - newApplication, - ), - ).toStrictEqual({ - message: '', - path: 'formerInsurance', - values: undefined, - }) - }) - - it('should return error if personal id is undefined', () => { - const newFormerInsuranceAnswers = { - registration: YES, - country: JSON.stringify({ name: 'Greenland', countryCode: 'GL' }), - } - - expect( - answerValidators['formerInsurance']( - newFormerInsuranceAnswers, - baseApplication, - ), - ).toStrictEqual({ - message: 'Please fill in your ID number in previous country', - path: 'formerInsurance.personalId', - values: undefined, - }) - }) - - it('should return error if personal id is greater than 20', () => { - const newFormerInsuranceAnswers = { - registration: YES, - country: JSON.stringify({ name: 'Greenland', countryCode: 'GL' }), - personalId: '012345678901234567890', - } - - expect( - answerValidators['formerInsurance']( - newFormerInsuranceAnswers, - baseApplication, - ), - ).toStrictEqual({ - message: 'Should be at most 20 characters long', - path: 'formerInsurance.personalId', - values: undefined, - }) - }) - - it('should return error if personal id is less than 6', () => { - const newFormerInsuranceAnswers = { - registration: YES, - country: JSON.stringify({ name: 'Greenland', countryCode: 'GL' }), - personalId: '000', - } - - expect( - answerValidators['formerInsurance']( - newFormerInsuranceAnswers, - baseApplication, - ), - ).toStrictEqual({ - message: 'Should be at least 6 characters', - path: 'formerInsurance.personalId', - values: undefined, - }) - }) - - it('should return error if moving from Greenland but not attached file', () => { - const newFormerInsuranceAnswers = { - registration: YES, - personalId: 'some id', - country: JSON.stringify({ name: 'Greenland', countryCode: 'GL' }), - confirmationOfResidencyDocument: [], - } - - expect( - answerValidators['formerInsurance']( - newFormerInsuranceAnswers, - baseApplication, - ), - ).toStrictEqual({ - message: 'Please attach a confirmation of residency', - path: 'formerInsurance.confirmationOfResidencyDocument', - values: undefined, - }) - }) - - it('should return next error if moving from Greenland and attached file', () => { - const newFormerInsuranceAnswers = { - registration: YES, - personalId: 'some id', - country: JSON.stringify({ name: 'Greenland', countryCode: 'GL' }), - confirmationOfResidencyDocument: [ - { name: 'some filename', key: 'uuid', url: 'url to file' }, - ], - } - - expect( - answerValidators['formerInsurance']( - newFormerInsuranceAnswers, - baseApplication, - ), - ).toStrictEqual({ - message: 'You must select one of the above', - path: 'formerInsurance.entitlement', - values: undefined, - }) - }) - - it('should return error if entitelment is not a defined answer', () => { - const newFormerInsuranceAnswers = { - registration: YES, - personalId: 'some id', - country: JSON.stringify({ name: 'Greenland', countryCode: 'GL' }), - confirmationOfResidencyDocument: [ - { name: 'some filename', key: 'uuid', url: 'url to file' }, - ], - entitelment: 'some answer', - } - - expect( - answerValidators['formerInsurance']( - newFormerInsuranceAnswers, - baseApplication, - ), - ).toStrictEqual({ - message: 'You must select one of the above', - path: 'formerInsurance.entitlement', - values: undefined, - }) - }) - - it('should return error if user is entitled but doesnt explain why', () => { - const newFormerInsuranceAnswers = { - registration: YES, - personalId: 'some id', - country: JSON.stringify({ name: 'Belgium', countryCode: 'BE' }), - entitlement: YES, - } - - expect( - answerValidators['formerInsurance']( - newFormerInsuranceAnswers, - baseApplication, - ), - ).toStrictEqual({ - message: 'Please fill in a reason', - path: 'formerInsurance.entitlementReason', - values: undefined, - }) - }) - - it('should not return error if all is filled and country does not require attachment nor waiting period', () => { - const newFormerInsuranceAnswers = { - registration: YES, - personalId: 'some id', - country: JSON.stringify({ name: 'Belgium', countryCode: 'BE' }), - entitlement: NO, - } - - expect( - answerValidators['formerInsurance']( - newFormerInsuranceAnswers, - baseApplication, - ), - ).toStrictEqual(undefined) - }) -}) diff --git a/libs/application/templates/health-insurance/src/lib/answerValidators.ts b/libs/application/templates/health-insurance/src/lib/answerValidators.ts deleted file mode 100644 index 263e2c074a94..000000000000 --- a/libs/application/templates/health-insurance/src/lib/answerValidators.ts +++ /dev/null @@ -1,113 +0,0 @@ -import { - AnswerValidator, - getValueViaPath, - buildValidationError, -} from '@island.is/application/core' -import { Application } from '@island.is/application/types' -import { Status, FormerInsurance } from '../types' -import { NO, YES, StatusTypes } from '../shared' -import { - requireConfirmationOfResidency, - requireWaitingPeriod, -} from '../healthInsuranceUtils' - -const STATUS = 'status' -const FORMER_INSURANCE = 'formerInsurance' - -// TODO: Add translation messages here -export const answerValidators: Record = { - [STATUS]: (newAnswer: unknown, _application: Application) => { - const status = newAnswer as Status - - if (!Object.values(StatusTypes).includes(status.type)) { - const field = `${STATUS}.type` - const buildError = buildValidationError(field) - return buildError('You must select one of the above', field) - } - if ( - status.type === StatusTypes.STUDENT && - !status.confirmationOfStudies.length - ) { - const field = `${STATUS}.confirmationOfStudies` - const buildError = buildValidationError(field) - return buildError('Please attach a confirmation of studies', field) - } - - return undefined - }, - [FORMER_INSURANCE]: (newAnswer: unknown, application: Application) => { - const formerInsurance = newAnswer as FormerInsurance - const { - registration, - country, - personalId, - confirmationOfResidencyDocument, - entitlement, - entitlementReason, - } = formerInsurance - - const citizenship = getValueViaPath( - application.answers, - 'citizenship', - ) as string - - /* Registration must be Yes / No */ - if (registration !== YES && registration !== NO) { - const field = `${FORMER_INSURANCE}.registration` - const buildError = buildValidationError(field) - return buildError('You must select one of the above', field) - } - - if (!requireWaitingPeriod(country, citizenship)) { - const personalIdField = `${FORMER_INSURANCE}.personalId` - - if (personalId) { - /* Check that personal ID in former country length is as specified in Sjukra's api */ - if (personalId.length < 6) { - const buildError = buildValidationError(personalIdField) - return buildError('Should be at least 6 characters', personalIdField) - } else if (personalId.length > 20) { - const buildError = buildValidationError(personalIdField) - return buildError( - 'Should be at most 20 characters long', - personalIdField, - ) - } - } else { - /* Check that personal ID is not empty */ - const buildError = buildValidationError(personalIdField) - return buildError( - 'Please fill in your ID number in previous country', - personalIdField, - ) - } - /* Check file upload if country is Greenland / Faroe */ - if ( - requireConfirmationOfResidency(country) && - !confirmationOfResidencyDocument.length - ) { - const field = `${FORMER_INSURANCE}.confirmationOfResidencyDocument` - const buildError = buildValidationError(field) - return buildError('Please attach a confirmation of residency', field) - } - /* Check that entitlement is Yes / No */ - if (entitlement !== YES && entitlement !== NO) { - const field = `${FORMER_INSURANCE}.entitlement` - const buildError = buildValidationError(field) - return buildError('You must select one of the above', field) - } - /* Check that entitelmentReason is not empty if field is rendered (rendered if entitlement === YES) */ - if (entitlement === YES && !entitlementReason) { - const field = `${FORMER_INSURANCE}.entitlementReason` - const buildError = buildValidationError(field) - return buildError('Please fill in a reason', field) - } - } else { - /* User that requires waiting period, should not be allowed to continue */ - const buildError = buildValidationError(`${FORMER_INSURANCE}`) - return buildError('') - } - - return undefined - }, -} diff --git a/libs/application/templates/health-insurance/src/lib/dataSchema.ts b/libs/application/templates/health-insurance/src/lib/dataSchema.ts index d400210b880b..3190c3b98ec7 100644 --- a/libs/application/templates/health-insurance/src/lib/dataSchema.ts +++ b/libs/application/templates/health-insurance/src/lib/dataSchema.ts @@ -1,23 +1,32 @@ import { applicantInformationSchema } from '@island.is/application/ui-forms' import * as z from 'zod' -import { NO, YES } from '../shared' +import { EmploymentStatus, YES, YesOrNo } from '../utils/constants' -export const HealthInsuranceSchema = z.object({ +const FileSchema = z.object({ + name: z.string(), + key: z.string(), + url: z.string().optional(), +}) + +const formerInsurance = z.object({ + registration: z.nativeEnum(YesOrNo), + country: z.string().min(1), + personalId: z.string().min(1), + institution: z.string().min(1), + confirmationOfResidencyDocument: FileSchema.optional(), + entitlement: z.nativeEnum(YesOrNo).optional(), + entitlementReason: z.string().optional(), +}) + +export const dataSchema = z.object({ approveExternalData: z.boolean().refine((v) => v), - status: z.object({ - type: z.enum(['employed', 'student', 'pensioner', 'other']), - }), applicant: applicantInformationSchema(), + status: z.object({ type: z.nativeEnum(EmploymentStatus) }), + children: z.nativeEnum(YesOrNo), citizenship: z.string().optional(), - formerInsurance: z.object({ - registration: z.enum([YES, NO]), - country: z.string().min(1), - personalId: z.string().min(1), - institution: z.string().min(1), - entitlementReason: z.string().optional(), - }), - children: z.enum([YES, NO]), - hasAdditionalInfo: z.enum([YES, NO]), + formerInsurance, + hasAdditionalInfo: z.nativeEnum(YesOrNo), additionalRemarks: z.string().optional(), - confirmCorrectInfo: z.boolean().refine((v) => v), + additionalFiles: z.array(FileSchema).optional(), + confirmCorrectInfo: z.array(z.enum([YES])).length(1), }) diff --git a/libs/application/templates/health-insurance/src/lib/messages/countries.ts b/libs/application/templates/health-insurance/src/lib/messages/countries.ts new file mode 100644 index 000000000000..7c5ca243117a --- /dev/null +++ b/libs/application/templates/health-insurance/src/lib/messages/countries.ts @@ -0,0 +1,1262 @@ +import { defineMessages } from 'react-intl' + +export const messagesCountries = { + Afghanistan: { + id: 'hi.application:afghanistan', + defaultMessage: 'Afganistan', + description: 'Name of the country Afghanistan', + }, + 'Åland Islands': { + id: 'hi.application:ålandislands', + defaultMessage: 'Álandseyjar', + description: 'Name of the country Åland Islands', + }, + Albania: { + id: 'hi.application:albania', + defaultMessage: 'Albanía', + description: 'Name of the country Albania', + }, + Algeria: { + id: 'hi.application:algeria', + defaultMessage: 'Alsír', + description: 'Name of the country Algeria', + }, + 'American Samoa': { + id: 'hi.application:americansamoa', + defaultMessage: 'Bandaríska Samóa', + description: 'Name of the country American Samoa', + }, + Andorra: { + id: 'hi.application:andorra', + defaultMessage: 'Andorra', + description: 'Name of the country Andorra', + }, + Angola: { + id: 'hi.application:angola', + defaultMessage: 'Angóla', + description: 'Name of the country Angola', + }, + Anguilla: { + id: 'hi.application:anguilla', + defaultMessage: 'Angvilla', + description: 'Name of the country Anguilla', + }, + Antarctica: { + id: 'hi.application:antarctica', + defaultMessage: 'Suðurskautslandið', + description: 'Name of the country Antarctica', + }, + 'Antigua and Barbuda': { + id: 'hi.application:antiguaandbarbuda', + defaultMessage: 'Antígva og Barbúda', + description: 'Name of the country Antigua and Barbuda', + }, + Argentina: { + id: 'hi.application:argentina', + defaultMessage: 'Argentína', + description: 'Name of the country Argentina', + }, + Armenia: { + id: 'hi.application:armenia', + defaultMessage: 'Armenía', + description: 'Name of the country Armenia', + }, + Aruba: { + id: 'hi.application:aruba', + defaultMessage: 'Arúba', + description: 'Name of the country Aruba', + }, + Australia: { + id: 'hi.application:australia', + defaultMessage: 'Ástralía', + description: 'Name of the country Australia', + }, + Austria: { + id: 'hi.application:austria', + defaultMessage: 'Austurríki', + description: 'Name of the country Austria', + }, + Azerbaijan: { + id: 'hi.application:azerbaijan', + defaultMessage: 'Aserbaídsjan', + description: 'Name of the country Azerbaijan', + }, + Bahamas: { + id: 'hi.application:bahamas', + defaultMessage: 'Bahamaeyjar', + description: 'Name of the country Bahamas', + }, + Bahrain: { + id: 'hi.application:bahrain', + defaultMessage: 'Barein', + description: 'Name of the country Bahrain', + }, + Bangladesh: { + id: 'hi.application:bangladesh', + defaultMessage: 'Bangladess', + description: 'Name of the country Bangladesh', + }, + Barbados: { + id: 'hi.application:barbados', + defaultMessage: 'Barbados', + description: 'Name of the country Barbados', + }, + Belarus: { + id: 'hi.application:belarus', + defaultMessage: 'Belarús', + description: 'Name of the country Belarus', + }, + Belgium: { + id: 'hi.application:belgium', + defaultMessage: 'Belgía', + description: 'Name of the country Belgium', + }, + Belize: { + id: 'hi.application:belize', + defaultMessage: 'Belís', + description: 'Name of the country Belize', + }, + Benin: { + id: 'hi.application:benin', + defaultMessage: 'Benín', + description: 'Name of the country Benin', + }, + Bermuda: { + id: 'hi.application:bermuda', + defaultMessage: 'Bermúda', + description: 'Name of the country Bermuda', + }, + Bhutan: { + id: 'hi.application:bhutan', + defaultMessage: 'Bútan', + description: 'Name of the country Bhutan', + }, + 'Bolivia (Plurinational State of)': { + id: 'hi.application:bolivia(plurinationalstateof)', + defaultMessage: 'Bólivía', + description: 'Name of the country Bolivia (Plurinational State of)', + }, + 'Bonaire, Sint Eustatius and Saba': { + id: 'hi.application:bonaire,sinteustatiusandsaba', + defaultMessage: 'Bonaire, Sint Eustatius og Saba', + description: 'Name of the country Bonaire, Sint Eustatius and Saba', + }, + 'Bosnia and Herzegovina': { + id: 'hi.application:bosniaandherzegovina', + defaultMessage: 'Bosnía og Hersegóvína', + description: 'Name of the country Bosnia and Herzegovina', + }, + Botswana: { + id: 'hi.application:botswana', + defaultMessage: 'Botsvana', + description: 'Name of the country Botswana', + }, + 'Bouvet Island': { + id: 'hi.application:bouvetisland', + defaultMessage: 'Bouveteyja', + description: 'Name of the country Bouvet Island', + }, + Brazil: { + id: 'hi.application:brazil', + defaultMessage: 'Brasilía', + description: 'Name of the country Brazil', + }, + 'British Indian Ocean Territory': { + id: 'hi.application:britishindianoceanterritory', + defaultMessage: 'Breska Indlandshafssvæðið', + description: 'Name of the country British Indian Ocean Territory', + }, + 'United States Minor Outlying Islands': { + id: 'hi.application:unitedstatesminoroutlyingislands', + defaultMessage: 'Smáeyjar Bandaríkjanna', + description: 'Name of the country United States Minor Outlying Islands', + }, + 'Virgin Islands (British)': { + id: 'hi.application:virginislands(british)', + defaultMessage: 'Bresku Jómfrúaeyjar', + description: 'Name of the country Virgin Islands (British)', + }, + 'Virgin Islands (U.S.)': { + id: 'hi.application:virginislands(u.s.)', + defaultMessage: 'Bandarísku Jómfrúaeyjar', + description: 'Name of the country Virgin Islands (U.S.)', + }, + 'Brunei Darussalam': { + id: 'hi.application:bruneidarussalam', + defaultMessage: 'Brúnei', + description: 'Name of the country Brunei Darussalam', + }, + Bulgaria: { + id: 'hi.application:bulgaria', + defaultMessage: 'Búlgaría', + description: 'Name of the country Bulgaria', + }, + 'Burkina Faso': { + id: 'hi.application:burkinafaso', + defaultMessage: 'Búrkína Fasó', + description: 'Name of the country Burkina Faso', + }, + Burundi: { + id: 'hi.application:burundi', + defaultMessage: 'Búrúndí', + description: 'Name of the country Burundi', + }, + Cambodia: { + id: 'hi.application:cambodia', + defaultMessage: 'Kambódía', + description: 'Name of the country Cambodia', + }, + Cameroon: { + id: 'hi.application:cameroon', + defaultMessage: 'Kamerún', + description: 'Name of the country Cameroon', + }, + Canada: { + id: 'hi.application:canada', + defaultMessage: 'Kanada', + description: 'Name of the country Canada', + }, + 'Cabo Verde': { + id: 'hi.application:caboverde', + defaultMessage: 'Grænhöfðaeyjar', + description: 'Name of the country Cabo Verde', + }, + 'Cayman Islands': { + id: 'hi.application:caymanislands', + defaultMessage: 'Caymaneyjar', + description: 'Name of the country Cayman Islands', + }, + 'Central African Republic': { + id: 'hi.application:centralafricanrepublic', + defaultMessage: 'Mið-Afríkulýðveldið', + description: 'Name of the country Central African Republic', + }, + Chad: { + id: 'hi.application:chad', + defaultMessage: 'Tsjad', + description: 'Name of the country Chad', + }, + Chile: { + id: 'hi.application:chile', + defaultMessage: 'Síle', + description: 'Name of the country Chile', + }, + China: { + id: 'hi.application:china', + defaultMessage: 'Kína', + description: 'Name of the country China', + }, + 'Christmas Island': { + id: 'hi.application:christmas_island', + defaultMessage: 'Jólaeyja', + description: 'Name of the country Christmas Island', + }, + 'Cocos (Keeling) Islands': { + id: 'hi.application:cocos_keeling_islands', + defaultMessage: 'Kókoseyjar', + description: 'Name of the country Cocos (Keeling) Islands', + }, + Colombia: { + id: 'hi.application:colombia', + defaultMessage: 'Kólumbía', + description: 'Name of the country Colombia', + }, + Comoros: { + id: 'hi.application:comoros', + defaultMessage: 'Kómoreyjar', + description: 'Name of the country Comoros', + }, + Congo: { + id: 'hi.application:congo', + defaultMessage: 'Kongó', + description: 'Name of the country Congo', + }, + 'Congo (Democratic Republic of the)': { + id: 'hi.application:congo_democratic_republic', + defaultMessage: 'Líðveldið Kongó', + description: 'Name of the country Congo (Democratic Republic of the)', + }, + 'Cook Islands': { + id: 'hi.application:cook_islands', + defaultMessage: 'Cooks eyjar', + description: 'Name of the country Cook Islands', + }, + 'Costa Rica': { + id: 'hi.application:costa_rica', + defaultMessage: 'Kosta Ríka', + description: 'Name of the country Costa Rica', + }, + Croatia: { + id: 'hi.application:croatia', + defaultMessage: 'Króatía', + description: 'Name of the country Croatia', + }, + Cuba: { + id: 'hi.application:cuba', + defaultMessage: 'Kúba', + description: 'Name of the country Cuba', + }, + Curaçao: { + id: 'hi.application:curacao', + defaultMessage: 'Curacao', + description: 'Name of the country Curaçao', + }, + Cyprus: { + id: 'hi.application:cyprus', + defaultMessage: 'Kýpur', + description: 'Name of the country Cyprus', + }, + 'Czech Republic': { + id: 'hi.application:czech_republic', + defaultMessage: 'Tékkland', + description: 'Name of the country Czech Republic', + }, + Denmark: { + id: 'hi.application:denmark', + defaultMessage: 'Danmörk', + description: 'Name of the country Denmark', + }, + Djibouti: { + id: 'hi.application:djibouti', + defaultMessage: 'Djíbútí', + description: 'Name of the country Djibouti', + }, + Dominica: { + id: 'hi.application:dominica', + defaultMessage: 'Dominíka', + description: 'Name of the country Dominica', + }, + 'Dominican Republic': { + id: 'hi.application:dominican_republic', + defaultMessage: 'Dóminíska lýðveldið', + description: 'Name of the country Dominican Republic', + }, + Ecuador: { + id: 'hi.application:ecuador', + defaultMessage: 'Ekvador', + description: 'Name of the country Ecuador', + }, + Egypt: { + id: 'hi.application:egypt', + defaultMessage: 'Egyptaland', + description: 'Name of the country Egypt', + }, + 'El Salvador': { + id: 'hi.application:el_salvador', + defaultMessage: 'El Salvador', + description: 'Name of the country El Salvador', + }, + 'Equatorial Guinea': { + id: 'hi.application:equatorial_guinea', + defaultMessage: 'Miðbaugs Gínea', + description: 'Name of the country Equatorial Guinea', + }, + Eritrea: { + id: 'hi.application:eritrea', + defaultMessage: 'Eritrea', + description: 'Name of the country Eritrea', + }, + Estonia: { + id: 'hi.application:estonia', + defaultMessage: 'Eistland', + description: 'Name of the country Estonia', + }, + Ethiopia: { + id: 'hi.application:ethiopia', + defaultMessage: 'Eþíópía', + description: 'Name of the country Ethiopia', + }, + 'Falkland Islands (Malvinas)': { + id: 'hi.application:falkland_islands', + defaultMessage: 'Falklandseyjar', + description: 'Name of the country Falkland Islands (Malvinas)', + }, + 'Faroe Islands': { + id: 'hi.application:faroe_islands', + defaultMessage: 'Færeyjar', + description: 'Name of the country Faroe Islands', + }, + Fiji: { + id: 'hi.application:fiji', + defaultMessage: 'Fídji', + description: 'Name of the country Fiji', + }, + Finland: { + id: 'hi.application:finland', + defaultMessage: 'Finnland', + description: 'Name of the country Finland', + }, + France: { + id: 'hi.application:france', + defaultMessage: 'Frakkland', + description: 'Name of the country France', + }, + 'French Guiana': { + id: 'hi.application:french_guiana', + defaultMessage: 'Franska Gvæjana', + description: 'Name of the country French Guiana', + }, + 'French Polynesia': { + id: 'hi.application:french_polynesia', + defaultMessage: 'Franska Pólýnesía', + description: 'Name of the country French Polynesia', + }, + 'French Southern Territories': { + id: 'hi.application:french_southern_territories', + defaultMessage: 'Frönsku suðlægu landsvæðin', + description: 'Name of the country French Southern Territories', + }, + Gabon: { + id: 'hi.application:gabon', + defaultMessage: 'Gabon', + description: 'Name of the country Gabon', + }, + Gambia: { + id: 'hi.application:gambia', + defaultMessage: 'Gambía', + description: 'Name of the country Gambia', + }, + Georgia: { + id: 'hi.application:georgia', + defaultMessage: 'Georgía', + description: 'Name of the country Georgia', + }, + Germany: { + id: 'hi.application:germany', + defaultMessage: 'Þýskaland', + description: 'Name of the country Germany', + }, + Ghana: { + id: 'hi.application:ghana', + defaultMessage: 'Gana', + description: 'Name of the country Ghana', + }, + Gibraltar: { + id: 'hi.application:gibraltar', + defaultMessage: 'Gíbraltar', + description: 'Name of the country Gibraltar', + }, + Greece: { + id: 'hi.application:greece', + defaultMessage: 'Grikkland', + description: 'Name of the country Greece', + }, + Greenland: { + id: 'hi.application:greenland', + defaultMessage: 'Grænland', + description: 'Name of the country Greenland', + }, + Grenada: { + id: 'hi.application:grenada', + defaultMessage: 'Grenada', + description: 'Name of the country Grenada', + }, + Guadeloupe: { + id: 'hi.application:guadeloupe', + defaultMessage: 'Guadelúp', + description: 'Name of the country Guadeloupe', + }, + Guam: { + id: 'hi.application:guam', + defaultMessage: 'Guam', + description: 'Name of the country Guam', + }, + Guatemala: { + id: 'hi.application:guatemala', + defaultMessage: 'Gvatemala', + description: 'Name of the country Guatemala', + }, + Guernsey: { + id: 'hi.application:guernsey', + defaultMessage: 'Guernsey', + description: 'Name of the country Guernsey', + }, + Guinea: { + id: 'hi.application:guinea', + defaultMessage: 'Gínea', + description: 'Name of the country Guinea', + }, + 'Guinea-Bissau': { + id: 'hi.application:guinea-bissau', + defaultMessage: 'Gíneu-Bissau', + description: 'Name of the country Guinea-Bissau', + }, + Guyana: { + id: 'hi.application:guyana', + defaultMessage: 'Gvæjana', + description: 'Name of the country Guyana', + }, + Haiti: { + id: 'hi.application:haiti', + defaultMessage: 'Haítí', + description: 'Name of the country Haiti', + }, + 'Heard Island and McDonald Islands': { + id: 'hi.application:heard_island_and_mcdonald_islands', + defaultMessage: 'Heard eyja og McDonald eyar', + description: 'Name of the country Heard Island and McDonald Islands', + }, + 'Holy See': { + id: 'hi.application:holy_see', + defaultMessage: 'Páfastóll', + description: 'Name of the country Holy See', + }, + Honduras: { + id: 'hi.application:honduras', + defaultMessage: 'Hondúras', + description: 'Name of the country Honduras', + }, + 'Hong Kong': { + id: 'hi.application:hong_kong', + defaultMessage: 'Hong Kong', + description: 'Name of the country Hong Kong', + }, + Hungary: { + id: 'hi.application:hungary', + defaultMessage: 'Ungverjaland', + description: 'Name of the country Hungary', + }, + Iceland: { + id: 'hi.application:iceland', + defaultMessage: 'Ísland', + description: 'Name of the country Iceland', + }, + India: { + id: 'hi.application:india', + defaultMessage: 'Indland', + description: 'Name of the country India', + }, + Indonesia: { + id: 'hi.application:indonesia', + defaultMessage: 'Indónesía', + description: 'Name of the country Indonesia', + }, + "Côte d'Ivoire": { + id: 'hi.application:cote_divoire', + defaultMessage: 'Fílabeinsströndin', + description: "Name of the country Côte d'Ivoire", + }, + 'Iran (Islamic Republic of)': { + id: 'hi.application:iran', + defaultMessage: 'Íran', + description: 'Name of the country Iran (Islamic Republic of)', + }, + Iraq: { + id: 'hi.application:iraq', + defaultMessage: 'Írak', + description: 'Name of the country Iraq', + }, + Ireland: { + id: 'hi.application:ireland', + defaultMessage: 'Írland', + description: 'Name of the country Ireland', + }, + 'Isle of Man': { + id: 'hi.application:isle_of_man', + defaultMessage: 'Mön', + description: 'Name of the country Isle of Man', + }, + Israel: { + id: 'hi.application:israel', + defaultMessage: 'Ísrael', + description: 'Name of the country Israel', + }, + Italy: { + id: 'hi.application:italy', + defaultMessage: 'Ítalía', + description: 'Name of the country Italy', + }, + Jamaica: { + id: 'hi.application:jamaica', + defaultMessage: 'Jamaíka', + description: 'Name of the country Jamaica', + }, + Japan: { + id: 'hi.application:japan', + defaultMessage: 'Japan', + description: 'Name of the country Japan', + }, + Jersey: { + id: 'hi.application:jersey', + defaultMessage: 'Jersey', + description: 'Name of the country Jersey', + }, + Jordan: { + id: 'hi.application:jordan', + defaultMessage: 'Jórdanía', + description: 'Name of the country Jordan', + }, + Kazakhstan: { + id: 'hi.application:kazakhstan', + defaultMessage: 'Kasakstan', + description: 'Name of the country Kazakhstan', + }, + Kenya: { + id: 'hi.application:kenya', + defaultMessage: 'Kenýa', + description: 'Name of the country Kenya', + }, + Kiribati: { + id: 'hi.application:kiribati', + defaultMessage: 'Kiribati', + description: 'Name of the country Kiribati', + }, + Kuwait: { + id: 'hi.application:kuwait', + defaultMessage: 'Kúveit', + description: 'Name of the country Kuwait', + }, + Kyrgyzstan: { + id: 'hi.application:kyrgyzstan', + defaultMessage: 'Kirgisstan', + description: 'Name of the country Kyrgyzstan', + }, + "Lao People's Democratic Republic": { + id: 'hi.application:lao_people_democratic_republic', + defaultMessage: 'Laos', + description: "Name of the country Lao People's Democratic Republic", + }, + Latvia: { + id: 'hi.application:latvia', + defaultMessage: 'Lettland', + description: 'Name of the country Latvia', + }, + Lebanon: { + id: 'hi.application:lebanon', + defaultMessage: 'Lebanon', + description: 'Name of the country Lebanon', + }, + Lesotho: { + id: 'hi.application:lesotho', + defaultMessage: 'Lesótó', + description: 'Name of the country Lesotho', + }, + Liberia: { + id: 'hi.application:liberia', + defaultMessage: 'Libería', + description: 'Name of the country Liberia', + }, + Libya: { + id: 'hi.application:libya', + defaultMessage: 'Líbía', + description: 'Name of the country Libya', + }, + Liechtenstein: { + id: 'hi.application:liechtenstein', + defaultMessage: 'Liechtenstein', + description: 'Name of the country Liechtenstein', + }, + Lithuania: { + id: 'hi.application:lithuania', + defaultMessage: 'Litháen', + description: 'Name of the country Lithuania', + }, + Luxembourg: { + id: 'hi.application:luxembourg', + defaultMessage: 'Lúxemborg', + description: 'Name of the country Luxembourg', + }, + Macao: { + id: 'hi.application:macao', + defaultMessage: 'Macao', + description: 'Name of the country Macao', + }, + 'Macedonia (the former Yugoslav Republic of)': { + id: 'hi.application:macedonia', + defaultMessage: 'Norður Makedónía', + description: + 'Name of the country Macedonia (the former Yugoslav Republic of)', + }, + Madagascar: { + id: 'hi.application:madagascar', + defaultMessage: 'Madagaskar', + description: 'Name of the country Madagascar', + }, + Malawi: { + id: 'hi.application:malawi', + defaultMessage: 'Malaví', + description: 'Name of the country Malawi', + }, + Malaysia: { + id: 'hi.application:malaysia', + defaultMessage: 'Malasía', + description: 'Name of the country Malaysia', + }, + Maldives: { + id: 'hi.application:maldives', + defaultMessage: 'Maldíveyjar', + description: 'Name of the country Maldives', + }, + Mali: { + id: 'hi.application:mali', + defaultMessage: 'Malí', + description: 'Name of the country Mali', + }, + Malta: { + id: 'hi.application:malta', + defaultMessage: 'Malta', + description: 'Name of the country Malta', + }, + 'Marshall Islands': { + id: 'hi.application:marshallislands', + defaultMessage: 'Marshalleyjar', + description: 'Name of the country Marshall Islands', + }, + Martinique: { + id: 'hi.application:martinique', + defaultMessage: 'Martiník', + description: 'Name of the country Martinique', + }, + Mauritania: { + id: 'hi.application:mauritania', + defaultMessage: 'Máritanía', + description: 'Name of the country Mauritania', + }, + Mauritius: { + id: 'hi.application:mauritius', + defaultMessage: 'Mauritíus', + description: 'Name of the country Mauritius', + }, + Mayotte: { + id: 'hi.application:mayotte', + defaultMessage: 'Mayotte', + description: 'Name of the country Mayotte', + }, + Mexico: { + id: 'hi.application:mexico', + defaultMessage: 'Mexíkó', + description: 'Name of the country Mexico', + }, + 'Micronesia (Federated States of)': { + id: 'hi.application:micronesia', + defaultMessage: 'Míkrónesía', + description: 'Name of the country Micronesia (Federated States of)', + }, + 'Moldova (Republic of)': { + id: 'hi.application:moldova', + defaultMessage: 'Moldóva', + description: 'Name of the country Moldova (Republic of)', + }, + Monaco: { + id: 'hi.application:monaco', + defaultMessage: 'Monakó', + description: 'Name of the country Monaco', + }, + Mongolia: { + id: 'hi.application:mongolia', + defaultMessage: 'Mongólía', + description: 'Name of the country Mongolia', + }, + Montenegro: { + id: 'hi.application:montenegro', + defaultMessage: 'Svartfjallaland', + description: 'Name of the country Montenegro', + }, + Montserrat: { + id: 'hi.application:montserrat', + defaultMessage: 'Montserrat', + description: 'Name of the country Montserrat', + }, + Morocco: { + id: 'hi.application:morocco', + defaultMessage: 'Marokkó', + description: 'Name of the country Morocco', + }, + Mozambique: { + id: 'hi.application:mozambique', + defaultMessage: 'Mósambík', + description: 'Name of the country Mozambique', + }, + Myanmar: { + id: 'hi.application:myanmar', + defaultMessage: 'Mjanmar', + description: 'Name of the country Myanmar', + }, + Namibia: { + id: 'hi.application:namibia', + defaultMessage: 'Namibía', + description: 'Name of the country Namibia', + }, + Nauru: { + id: 'hi.application:nauru', + defaultMessage: 'Nauru', + description: 'Name of the country Nauru', + }, + Nepal: { + id: 'hi.application:nepal', + defaultMessage: 'Nepal', + description: 'Name of the country Nepal', + }, + Netherlands: { + id: 'hi.application:netherlands', + defaultMessage: 'Holland', + description: 'Name of the country Netherlands', + }, + 'New Caledonia': { + id: 'hi.application:newcaledonia', + defaultMessage: 'Nýja Kaledónía', + description: 'Name of the country New Caledonia', + }, + 'New Zealand': { + id: 'hi.application:newzealand', + defaultMessage: 'Nýja Sjáland', + description: 'Name of the country New Zealand', + }, + Nicaragua: { + id: 'hi.application:nicaragua', + defaultMessage: 'Níkaragva', + description: 'Name of the country Nicaragua', + }, + Niger: { + id: 'hi.application:niger', + defaultMessage: 'Níger', + description: 'Name of the country Niger', + }, + Nigeria: { + id: 'hi.application:nigeria', + defaultMessage: 'Nígería', + description: 'Name of the country Nigeria', + }, + Niue: { + id: 'hi.application:niue', + defaultMessage: 'Niue', + description: 'Name of the country Niue', + }, + 'Norfolk Island': { + id: 'hi.application:norfolkisland', + defaultMessage: 'Norfolkey', + description: 'Name of the country Norfolk Island', + }, + "Korea (Democratic People's Republic of)": { + id: 'hi.application:koreademocratic', + defaultMessage: 'Norður-Kórea', + description: "Name of the country Korea (Democratic People's Republic of)", + }, + 'Northern Mariana Islands': { + id: 'hi.application:northernmariana', + defaultMessage: 'Norður-Maríanaeyjar', + description: 'Name of the country Northern Mariana Islands', + }, + Norway: { + id: 'hi.application:norway', + defaultMessage: 'Noregur', + description: 'Name of the country Norway', + }, + Oman: { + id: 'hi.application:oman', + defaultMessage: 'Óman', + description: 'Name of the country Oman', + }, + Pakistan: { + id: 'hi.application:pakistan', + defaultMessage: 'Pakistan', + description: 'Name of the country Pakistan', + }, + Palau: { + id: 'hi.application:palau', + defaultMessage: 'Palau', + description: 'Name of the country Palau', + }, + 'Palestine, State of': { + id: 'hi.application:palestine', + defaultMessage: 'Palestína', + description: 'Name of the country Palestine, State of', + }, + Panama: { + id: 'hi.application:panama', + defaultMessage: 'Panama', + description: 'Name of the country Panama', + }, + 'Papua New Guinea': { + id: 'hi.application:papuanewguinea', + defaultMessage: 'Papúa Nýja-Guínea', + description: 'Name of the country Papua New Guinea', + }, + Paraguay: { + id: 'hi.application:paraguay', + defaultMessage: 'Paragvæ', + description: 'Name of the country Paraguay', + }, + Peru: { + id: 'hi.application:peru', + defaultMessage: 'Perú', + description: 'Name of the country Peru', + }, + Philippines: { + id: 'hi.application:philippines', + defaultMessage: 'Filippseyjar', + description: 'Name of the country Philippines', + }, + Pitcairn: { + id: 'hi.application:pitcairn', + defaultMessage: 'Pitcairn', + description: 'Name of the territory Pitcairn', + }, + Poland: { + id: 'hi.application:poland', + defaultMessage: 'Pólland', + description: 'Name of the country Poland', + }, + Portugal: { + id: 'hi.application:portugal', + defaultMessage: 'Portúgal', + description: 'Name of the country Portugal', + }, + 'Puerto Rico': { + id: 'hi.application:puertorico', + defaultMessage: 'Púerto Ríkó', + description: 'Name of the territory Puerto Rico', + }, + Qatar: { + id: 'hi.application:qatar', + defaultMessage: 'Katar', + description: 'Name of the country Qatar', + }, + 'Republic of Kosovo': { + id: 'hi.application:kosovo', + defaultMessage: 'Kosóvó', + description: 'Name of the country Republic of Kosovo', + }, + Réunion: { + id: 'hi.application:reunion', + defaultMessage: 'Réunion', + description: 'Name of the territory Réunion', + }, + Romania: { + id: 'hi.application:romania', + defaultMessage: 'Rúmenía', + description: 'Name of the country Romania', + }, + 'Russian Federation': { + id: 'hi.application:russianfederation', + defaultMessage: 'Rússland', + description: 'Name of the country Russian Federation', + }, + Rwanda: { + id: 'hi.application:rwanda', + defaultMessage: 'Rúanda', + description: 'Name of the country Rwanda', + }, + 'Saint Barthélemy': { + id: 'hi.application:saintbarthelemy', + defaultMessage: 'Saint Barthélemy', + description: 'Name of the territory Saint Barthélemy', + }, + 'Saint Helena, Ascension and Tristan da Cunha': { + id: 'hi.application:sainthelena', + defaultMessage: 'Saint Helena, Ascension og Tristan da Cunha', + description: + 'Name of the territory Saint Helena, Ascension and Tristan da Cunha', + }, + 'Saint Kitts and Nevis': { + id: 'hi.application:saintkittsandnevis', + defaultMessage: 'Saint Kitts og Nevis', + description: 'Name of the country Saint Kitts and Nevis', + }, + 'Saint Lucia': { + id: 'hi.application:saintlucia', + defaultMessage: 'Saint Lucia', + description: 'Name of the country Saint Lucia', + }, + 'Saint Martin (French part)': { + id: 'hi.application:saintmartin', + defaultMessage: 'Saint Martin (frönsku hluti)', + description: 'Name of the territory Saint Martin (French part)', + }, + 'Saint Pierre and Miquelon': { + id: 'hi.application:saintpierre', + defaultMessage: 'Saint Pierre og Miquelon', + description: 'Name of the territory Saint Pierre and Miquelon', + }, + 'Saint Vincent and the Grenadines': { + id: 'hi.application:saintvincentandthegrenadines', + defaultMessage: 'Saint Vincent og Grenadíneyjar', + description: 'Name of the country Saint Vincent and the Grenadines', + }, + Samoa: { + id: 'hi.application:samoa', + defaultMessage: 'Samoa', + description: 'Name of the country Samoa', + }, + 'San Marino': { + id: 'hi.application:sanmarino', + defaultMessage: 'San Marínó', + description: 'Name of the country San Marino', + }, + 'Sao Tome and Principe': { + id: 'hi.application:sao-tome-and-principe', + defaultMessage: 'Sao Tóme og Príncípe', + description: 'Name of the country Sao Tome and Principe', + }, + 'Saudi Arabia': { + id: 'hi.application:saudiarabia', + defaultMessage: 'Saudi-Arabía', + description: 'Name of the country Saudi Arabia', + }, + Senegal: { + id: 'hi.application:senegal', + defaultMessage: 'Senegal', + description: 'Name of the country Senegal', + }, + Serbia: { + id: 'hi.application:serbia', + defaultMessage: 'Serbía', + description: 'Name of the country Serbia', + }, + Seychelles: { + id: 'hi.application:seychelles', + defaultMessage: 'Seychelles', + description: 'Name of the country Seychelles', + }, + 'Sierra Leone': { + id: 'hi.application:sieraleone', + defaultMessage: 'Síerra Léone', + description: 'Name of the country Sierra Leone', + }, + Singapore: { + id: 'hi.application:singapore', + defaultMessage: 'Singapúr', + description: 'Name of the country Singapore', + }, + 'Sint Maarten (Dutch part)': { + id: 'hi.application:sintmaarten', + defaultMessage: 'Sint Maarten', + description: 'Name of the territory Sint Maarten (Dutch part)', + }, + Slovakia: { + id: 'hi.application:slovakia', + defaultMessage: 'Slóvakía', + description: 'Name of the country Slovakia', + }, + Slovenia: { + id: 'hi.application:slovenia', + defaultMessage: 'Slóvenía', + description: 'Name of the country Slovenia', + }, + 'Solomon Islands': { + id: 'hi.application:solomonislands', + defaultMessage: 'Salómonseyjar', + description: 'Name of the country Solomon Islands', + }, + Somalia: { + id: 'hi.application:somalia', + defaultMessage: 'Sómalía', + description: 'Name of the country Somalia', + }, + 'South Africa': { + id: 'hi.application:southafrica', + defaultMessage: 'Suður-Afríka', + description: 'Name of the country South Africa', + }, + 'South Georgia and the South Sandwich Islands': { + id: 'hi.application:southgeorgia', + defaultMessage: 'Suður-Georgía og Suður-Sandvíkureyjar', + description: + 'Name of the territory South Georgia and the South Sandwich Islands', + }, + 'Korea (Republic of)': { + id: 'hi.application:korea', + defaultMessage: 'Suður Kórea', + description: 'Name of the country Korea (Republic of)', + }, + 'South Sudan': { + id: 'hi.application:southsudan', + defaultMessage: 'Suður Súdan', + description: 'Name of the country South Sudan', + }, + Spain: { + id: 'hi.application:spain', + defaultMessage: 'Spánn', + description: 'Name of the country Spain', + }, + 'Sri Lanka': { + id: 'hi.application:srilanka', + defaultMessage: 'Sri Lanka', + description: 'Name of the country Sri Lanka', + }, + Sudan: { + id: 'hi.application:sudan', + defaultMessage: 'Súdan', + description: 'Name of the country Sudan', + }, + Suriname: { + id: 'hi.application:suriname', + defaultMessage: 'Suriname', + description: 'Name of the country Suriname', + }, + 'Svalbard and Jan Mayen': { + id: 'hi.application:svalbardandjanmayen', + defaultMessage: 'Svalbarði og Jan Mayen', + description: 'Name of the territory Svalbard and Jan Mayen', + }, + Swaziland: { + id: 'hi.application:swaziland', + defaultMessage: 'Svasíland', + description: 'Name of the country Swaziland', + }, + Sweden: { + id: 'hi.application:sweden', + defaultMessage: 'Svíþjóð', + description: 'Name of the country Sweden', + }, + Switzerland: { + id: 'hi.application:switzerland', + defaultMessage: 'Sviss', + description: 'Name of the country Switzerland', + }, + 'Syrian Arab Republic': { + id: 'hi.application:syrianarabrepublic', + defaultMessage: 'Sýrland', + description: 'Name of the country Syrian Arab Republic', + }, + Taiwan: { + id: 'hi.application:taiwan', + defaultMessage: 'Taívan', + description: 'Name of the country Taiwan', + }, + Tajikistan: { + id: 'hi.application:tajikistan', + defaultMessage: 'Tadsjikistan', + description: 'Name of the country Tajikistan', + }, + 'Tanzania, United Republic of': { + id: 'hi.application:tanzaniaunitedrepublic', + defaultMessage: 'Tansanía', + description: 'Name of the country Tanzania, United Republic of', + }, + Thailand: { + id: 'hi.application:thailand', + defaultMessage: 'Taíland', + description: 'Name of the country Thailand', + }, + 'Timor-Leste': { + id: 'hi.application:timorleste', + defaultMessage: 'Timor-Leste', + description: 'Name of the country Timor-Leste', + }, + Togo: { + id: 'hi.application:togo', + defaultMessage: 'Tógó', + description: 'Name of the country Togo', + }, + Tokelau: { + id: 'hi.application:tokelau', + defaultMessage: 'Tókelá', + description: 'Name of the country Tokelau', + }, + Tonga: { + id: 'hi.application:tonga', + defaultMessage: 'Tonga', + description: 'Name of the country Tonga', + }, + 'Trinidad and Tobago': { + id: 'hi.application:trinidadandtobago', + defaultMessage: 'Trínidad og Tóbagó', + description: 'Name of the country Trinidad and Tobago', + }, + Tunisia: { + id: 'hi.application:tunisia', + defaultMessage: 'Túnis', + description: 'Name of the country Tunisia', + }, + Turkey: { + id: 'hi.application:turkey', + defaultMessage: 'Tyrkland', + description: 'Name of the country Turkey', + }, + Turkmenistan: { + id: 'hi.application:turkmenistan', + defaultMessage: 'Turkmenistan', + description: 'Name of the country Turkmenistan', + }, + 'Turks and Caicos Islands': { + id: 'hi.application:turksandcaicos', + defaultMessage: 'Túrks- og Caicoseyjar', + description: 'Name of the country Turks and Caicos Islands', + }, + Tuvalu: { + id: 'hi.application:tuvalu', + defaultMessage: 'Túvalú', + description: 'Name of the country Tuvalu', + }, + Uganda: { + id: 'hi.application:uganda', + defaultMessage: 'Úganda', + description: 'Name of the country Uganda', + }, + Ukraine: { + id: 'hi.application:ukraine', + defaultMessage: 'Úkraína', + description: 'Name of the country Ukraine', + }, + 'United Arab Emirates': { + id: 'hi.application:unitedarabeirates', + defaultMessage: 'Sameinuðu arabísku furstadæmin', + description: 'Name of the country United Arab Emirates', + }, + 'United Kingdom of Great Britain and Northern Ireland': { + id: 'hi.application:unitedkingdom', + defaultMessage: 'Bretland', + description: + 'Name of the country United Kingdom of Great Britain and Northern Ireland', + }, + 'United States of America': { + id: 'hi.application:unitedstates', + defaultMessage: 'Bandaríkin', + description: 'Name of the country United States of America', + }, + Uruguay: { + id: 'hi.application:uruguay', + defaultMessage: 'Úrúgvæ', + description: 'Name of the country Uruguay', + }, + Uzbekistan: { + id: 'hi.application:uzbekistan', + defaultMessage: 'Úzbekistan', + description: 'Name of the country Uzbekistan', + }, + Vanuatu: { + id: 'hi.application:vanuatu', + defaultMessage: 'Vanúatú', + description: 'Name of the country Vanuatu', + }, + 'Venezuela (Bolivarian Republic of)': { + id: 'hi.application:venezuela', + defaultMessage: 'Venesúela', + description: 'Name of the country Venezuela (Bolivarian Republic of)', + }, + 'Viet Nam': { + id: 'hi.application:vietnam', + defaultMessage: 'Vítenam', + description: 'Name of the country Vietnam', + }, + 'Wallis and Futuna': { + id: 'hi.application:wallisandfutuna', + defaultMessage: 'Wallis og Futuna', + description: 'Name of the country Wallis and Futuna', + }, + 'Western Sahara': { + id: 'hi.application:westernahara', + defaultMessage: 'Vestur Sahara', + description: 'Name of the country Western Sahara', + }, + Yemen: { + id: 'hi.application:yemen', + defaultMessage: 'Jemen', + description: 'Name of the country Yemen', + }, + Zambia: { + id: 'hi.application:zambia', + defaultMessage: 'Sambía', + description: 'Name of the country Zambia', + }, + Zimbabwe: { + id: 'hi.application:zimbabwe', + defaultMessage: 'Simbabve', + description: 'Name of the country Zimbabwe', + }, +} + +export type messagesCountries = keyof typeof messagesCountries + +export const m = defineMessages(messagesCountries) diff --git a/libs/application/templates/health-insurance/src/forms/messages.ts b/libs/application/templates/health-insurance/src/lib/messages/messages.ts similarity index 100% rename from libs/application/templates/health-insurance/src/forms/messages.ts rename to libs/application/templates/health-insurance/src/lib/messages/messages.ts diff --git a/libs/application/templates/health-insurance/src/shared/index.ts b/libs/application/templates/health-insurance/src/shared/index.ts deleted file mode 100644 index f87cf0102a14..000000000000 --- a/libs/application/templates/health-insurance/src/shared/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './constants' diff --git a/libs/application/templates/health-insurance/src/lib/EFTA.ts b/libs/application/templates/health-insurance/src/utils/EFTA.ts similarity index 100% rename from libs/application/templates/health-insurance/src/lib/EFTA.ts rename to libs/application/templates/health-insurance/src/utils/EFTA.ts diff --git a/libs/application/templates/health-insurance/src/lib/EU.ts b/libs/application/templates/health-insurance/src/utils/EU.ts similarity index 100% rename from libs/application/templates/health-insurance/src/lib/EU.ts rename to libs/application/templates/health-insurance/src/utils/EU.ts diff --git a/libs/application/templates/health-insurance/src/shared/constants.ts b/libs/application/templates/health-insurance/src/utils/constants.ts similarity index 84% rename from libs/application/templates/health-insurance/src/shared/constants.ts rename to libs/application/templates/health-insurance/src/utils/constants.ts index 634b845ed2be..9efbbdbaca49 100644 --- a/libs/application/templates/health-insurance/src/shared/constants.ts +++ b/libs/application/templates/health-insurance/src/utils/constants.ts @@ -5,18 +5,23 @@ export enum API_MODULE { export const YES = 'yes' export const NO = 'no' -export const FILE_SIZE_LIMIT = 10000000 - -export const EU = 'EU' -export const EFTA = 'EFTA' +export enum YesOrNo { + YES = 'yes', + NO = 'no', +} -export enum StatusTypes { +export enum EmploymentStatus { + EMPLOYED = 'employed', PENSIONER = 'pensioner', STUDENT = 'student', OTHER = 'other', - EMPLOYED = 'employed', } +export const FILE_SIZE_LIMIT = 10000000 + +export const EU = 'EU' +export const EFTA = 'EFTA' + export enum NordicCountriesCountryCode { 'NO', 'DK', diff --git a/libs/application/templates/health-insurance/src/lib/Countries.ts b/libs/application/templates/health-insurance/src/utils/countries.ts similarity index 99% rename from libs/application/templates/health-insurance/src/lib/Countries.ts rename to libs/application/templates/health-insurance/src/utils/countries.ts index 8c35cc0ac9d7..63a90310555b 100644 --- a/libs/application/templates/health-insurance/src/lib/Countries.ts +++ b/libs/application/templates/health-insurance/src/utils/countries.ts @@ -1,4 +1,4 @@ -export const Countries = [ +export const countries = [ { name: 'Afghanistan', topLevelDomain: ['.af'], diff --git a/libs/application/templates/health-insurance/src/utils/getFormerCountryAndCitizenship.ts b/libs/application/templates/health-insurance/src/utils/getFormerCountryAndCitizenship.ts new file mode 100644 index 000000000000..9d4e84f22cb9 --- /dev/null +++ b/libs/application/templates/health-insurance/src/utils/getFormerCountryAndCitizenship.ts @@ -0,0 +1,17 @@ +import { getValueViaPath } from '@island.is/application/core' +import { FormValue } from '@island.is/application/types' +import { requireWaitingPeriod } from '../healthInsuranceUtils' + +export const getFormerCountryAndCitizenship = (answers: FormValue) => { + const formerCountry = getValueViaPath( + answers, + 'formerInsurance.country', + ) as string + const citizenship = getValueViaPath(answers, 'citizenship') as string + return { formerCountry, citizenship } +} + +export const formerInsuranceCondition = (answers: FormValue) => { + const { formerCountry, citizenship } = getFormerCountryAndCitizenship(answers) + return !requireWaitingPeriod(formerCountry, citizenship) +} diff --git a/libs/application/templates/health-insurance/src/utils/options.ts b/libs/application/templates/health-insurance/src/utils/options.ts new file mode 100644 index 000000000000..4e0c961e39c7 --- /dev/null +++ b/libs/application/templates/health-insurance/src/utils/options.ts @@ -0,0 +1,55 @@ +import { m } from '../lib/messages/messages' +import { EmploymentStatus, NO, YES } from './constants' +import { m as cm, messagesCountries } from '../lib/messages/countries' +import { countries } from './countries' +import { FormText } from '@island.is/application/types' + +export const statusTypeOptions = [ + { + label: m.statusEmployed, + value: EmploymentStatus.EMPLOYED, + tooltip: m.statusEmployedInformation, + }, + { + label: m.statusStudent, + value: EmploymentStatus.STUDENT, + tooltip: m.statusStudentInformation, + }, + { + label: m.statusPensioner, + value: EmploymentStatus.PENSIONER, + tooltip: m.statusPensionerInformation, + }, + { + label: m.statusOther, + value: EmploymentStatus.OTHER, + tooltip: m.statusOtherInformation, + }, +] + +export const countryOptions = countries.map( + ({ name, alpha2Code: countryCode }) => { + const option = { name, countryCode } + return { + label: () => { + if (name in messagesCountries) { + return cm[name as keyof typeof cm] + } + return name + }, + value: JSON.stringify(option), + } + }, +) + +type YesNoOptions = { + yes?: FormText + no?: FormText +} + +export const getYesNoOptions = ({ yes, no }: YesNoOptions) => { + return [ + { label: no ?? m.noOptionLabel, value: NO }, + { label: yes ?? m.yesOptionLabel, value: YES }, + ] +} diff --git a/libs/application/templates/health-insurance/src/types.ts b/libs/application/templates/health-insurance/src/utils/types.ts similarity index 94% rename from libs/application/templates/health-insurance/src/types.ts rename to libs/application/templates/health-insurance/src/utils/types.ts index 1d840763daff..159b1dbce41c 100644 --- a/libs/application/templates/health-insurance/src/types.ts +++ b/libs/application/templates/health-insurance/src/utils/types.ts @@ -4,10 +4,10 @@ import { NationalRegistryIndividual, } from '@island.is/application/types' import { UserProfile } from '@island.is/api/schema' -import { StatusTypes } from './shared' +import { EmploymentStatus } from './constants' export interface Status { - type: StatusTypes + type: EmploymentStatus confirmationOfStudies: FileType[] }