Skip to content

Commit

Permalink
Oppdateringer frå master (#6365)
Browse files Browse the repository at this point in the history
* Dev-next1 branch deployment til k9-next.dev.intern.nav.no (#6340)

* nais deploy konfigurasjon for dev-next1 oppretta.

name, ingress og replicas konfigurasjon for nais dev deploy trekt ut i separate filer.

dev.yaml inneheld samme konfigurasjonsverdier som før var hardkoda i dev-fss-k9saksbehandling.yml, for normal utrulling til Q

dev-next1.yaml inneheld konfigurasjonsverdier for utrulling til ny dev-next1 instans.

* Build and deploy dev-next1 workflow oppretta.

Denne vil ved push til dev-next1 branch bygge og rulle ut instans av k9-sak-web til k9.dev-next1.intern.navn.no, slik at meir eksperimentelle ting kan testast der før det går til master.

* Fiks ingress url til gyldig verdi.

* Bumper ft-pakke (#6346)

* Fjerner gammal proxy referanse til diagnosekoder service. (#6351)

Ikkje i bruk lenger.

* Aktiverer det nye meldingspanelet i testmiljø. (#6336)

* Fiks maks lengde på brevtekst. (#6354)

Hadde brukt makslengde verdi frå FritekstbrevinnholdDto server har, men maks lengde er faktisk ulik alt etter om malen som er valgt er av type som større fritekst og tittel, eller berre fritekst.

Endre til å bruke BestillBrevDto makslengde når mal ikkje støtter tittel,og FritekstbrevinnholdDto sin makslengde når mal støtter tittel.

Endre også slik at fritekst prop ikkje blir satt (sendt til server) når det er brev med tittel og tekst, sidan den då vil kunne bli for lang.

* Sjekker om exception er definert før bruk (#6355)

* Bump @navikt/k9-sak-typescript-client (#6359)

Bumps [@navikt/k9-sak-typescript-client](https://github.com/navikt/k9-sak) from 1.0.20240620093339 to 1.0.20240708134619.
- [Commits](https://github.com/navikt/k9-sak/commits)

---
updated-dependencies:
- dependency-name: "@navikt/k9-sak-typescript-client"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump the patch group across 1 directory with 6 updates (#6350)

Bumps the patch group with 6 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [@playwright/test](https://github.com/microsoft/playwright) | `1.45.0` | `1.45.1` |
| [postcss](https://github.com/postcss/postcss) | `8.4.38` | `8.4.39` |
| [typescript](https://github.com/Microsoft/TypeScript) | `5.5.2` | `5.5.3` |
| [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) | `5.3.2` | `5.3.3` |
| [@editorjs/header](https://github.com/editor-js/header) | `2.8.1` | `2.8.5` |
| [@editorjs/paragraph](https://github.com/editor-js/paragraph) | `2.11.5` | `2.11.6` |



Updates `@playwright/test` from 1.45.0 to 1.45.1
- [Release notes](https://github.com/microsoft/playwright/releases)
- [Commits](microsoft/playwright@v1.45.0...v1.45.1)

Updates `postcss` from 8.4.38 to 8.4.39
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](postcss/postcss@8.4.38...8.4.39)

Updates `typescript` from 5.5.2 to 5.5.3
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](microsoft/TypeScript@v5.5.2...v5.5.3)

Updates `vite` from 5.3.2 to 5.3.3
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.3.3/packages/vite)

Updates `@editorjs/header` from 2.8.1 to 2.8.5
- [Commits](https://github.com/editor-js/header/commits)

Updates `@editorjs/paragraph` from 2.11.5 to 2.11.6
- [Commits](https://github.com/editor-js/paragraph/commits)

---
updated-dependencies:
- dependency-name: "@playwright/test"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: patch
- dependency-name: postcss
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: patch
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: patch
- dependency-name: vite
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: patch
- dependency-name: "@editorjs/header"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch
- dependency-name: "@editorjs/paragraph"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jostein Stuhaug <[email protected]>

* Advarsel om søker ikke er sammen med barnet i sykdomssteget. (#6360)

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Hallvard Andreas Stark <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ramin Esfandiari <[email protected]>
  • Loading branch information
4 people authored Jul 9, 2024
1 parent 995cbf8 commit 2e00bbc
Show file tree
Hide file tree
Showing 25 changed files with 137 additions and 114 deletions.
2 changes: 1 addition & 1 deletion deploy/dev-fss-k9saksbehandling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ spec:
- name: "OVERSTYRING_UTTAK"
value: "true"
- name: "BRUK_V2_MELDINGER"
value: "false"
value: "true"
- name: NYE_NOKKELTALL
value: "true"
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"vite-plugin-svgr": "4.2.0"
},
"devDependencies": {
"@playwright/test": "^1.45.0",
"@playwright/test": "^1.45.1",
"@sentry/cli": "2.32.1",
"@storybook/addon-a11y": "^8.1.11",
"@storybook/addon-actions": "^8.1.11",
Expand Down Expand Up @@ -119,15 +119,15 @@
"stylelint-order": "6.0.4",
"tailwindcss": "^3.4.4",
"typed-css-modules": "^0.9.1",
"typescript": "5.5.2",
"vite": "^5.3.2",
"typescript": "5.5.3",
"vite": "^5.3.3",
"vite-plugin-html": "^3.2.2",
"vitest": "1.6.0",
"vitest-axe": "0.1.0",
"webpack-merge": "5.10.0"
},
"resolutions": {
"postcss": "8.4.38",
"postcss": "8.4.39",
"parse-url": "8.1.0",
"@types/react": "17",
"@editorjs/editorjs": "2.27.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/behandling-frisinn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@k9-sak-web/rest-api-hooks": "1.0.0",
"@k9-sak-web/types": "1.0.0",
"@navikt/ft-fakta-beregning-redesign": "1.2.17",
"@navikt/ft-prosess-beregningsgrunnlag": "6.5.21",
"@navikt/ft-prosess-beregningsgrunnlag": "6.5.22",
"react": "18.3.1",
"react-intl": "6.6.8"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/behandling-omsorgspenger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@k9-sak-web/types": "1.0.0",
"@navikt/ft-fakta-beregning-redesign": "1.2.17",
"@navikt/ft-fakta-fordel-beregningsgrunnlag": "7.5.18",
"@navikt/ft-prosess-beregningsgrunnlag": "6.5.21",
"@navikt/ft-prosess-beregningsgrunnlag": "6.5.22",
"react": "18.3.1",
"react-intl": "6.6.8"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/behandling-opplaeringspenger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@k9-sak-web/types": "1.0.0",
"@navikt/ft-fakta-beregning-redesign": "1.2.17",
"@navikt/ft-fakta-fordel-beregningsgrunnlag": "7.5.18",
"@navikt/ft-prosess-beregningsgrunnlag": "6.5.21",
"@navikt/ft-prosess-beregningsgrunnlag": "6.5.22",
"axios": "1.7.2",
"react": "18.3.1",
"react-intl": "6.6.8"
Expand Down
2 changes: 1 addition & 1 deletion packages/behandling-pleiepenger-sluttfase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@k9-sak-web/types": "1.0.0",
"@navikt/ft-fakta-beregning-redesign": "1.2.17",
"@navikt/ft-fakta-fordel-beregningsgrunnlag": "7.5.18",
"@navikt/ft-prosess-beregningsgrunnlag": "6.5.21",
"@navikt/ft-prosess-beregningsgrunnlag": "6.5.22",
"axios": "1.7.2",
"react": "18.3.1",
"react-intl": "6.6.8"
Expand Down
2 changes: 1 addition & 1 deletion packages/behandling-pleiepenger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@navikt/diagnosekoder": "^1.2024.0",
"@navikt/ft-fakta-beregning-redesign": "1.2.17",
"@navikt/ft-fakta-fordel-beregningsgrunnlag": "7.5.18",
"@navikt/ft-prosess-beregningsgrunnlag": "6.5.21",
"@navikt/ft-prosess-beregningsgrunnlag": "6.5.22",
"axios": "1.7.2",
"react": "18.3.1",
"react-intl": "6.6.8"
Expand Down
2 changes: 1 addition & 1 deletion packages/fakta-etablert-tilsyn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dev": "vite serve"
},
"devDependencies": {
"vite": "^5.3.2",
"vite": "^5.3.3",
"vite-plugin-node-polyfills": "^0.22.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/fakta-inntektsmelding/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"license": "MIT",
"devDependencies": {
"msw": "2.3.1",
"vite": "^5.3.2",
"vite": "^5.3.3",
"vite-plugin-node-polyfills": "^0.22.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/fakta-medisinsk-vilkår/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"devDependencies": {
"cors": "^2.8.5",
"msw": "2.3.1",
"vite": "^5.3.2",
"vite": "^5.3.3",
"vite-plugin-node-polyfills": "^0.22.0"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ interface SykdomsstegStatusResponse {
nyttDokumentHarIkkekontrollertEksisterendeVurderinger: boolean;
manglerVurderingAvILivetsSluttfase?: true;
manglerVurderingAvLangvarigSykdom?: boolean;
ikkeSammenMedBarnet: boolean;
}

export default SykdomsstegStatusResponse;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { httpUtils } from '@fpsak-frontend/utils';
import { ExclamationmarkTriangleFillIcon } from '@navikt/aksel-icons';
import { Tabs } from '@navikt/ds-react';
import { Alert, HStack, Tabs } from '@navikt/ds-react';
import { Box, ChildIcon, Infostripe, Margin, PageContainer } from '@navikt/ft-plattform-komponenter';
import { useQuery } from '@tanstack/react-query';
import classnames from 'classnames';
Expand Down Expand Up @@ -216,6 +216,7 @@ const MedisinskVilkår = (): JSX.Element => {
};

const kanLøseAksjonspunkt = sykdomsstegStatus?.kanLøseAksjonspunkt;
const ikkeSammenMedBarnet = sykdomsstegStatus?.ikkeSammenMedBarnet;
const harDataSomIkkeHarBlittTattMedIBehandling = sykdomsstegStatus?.harDataSomIkkeHarBlittTattMedIBehandling;
const manglerVurderingAvNyeDokumenter = sykdomsstegStatus?.nyttDokumentHarIkkekontrollertEksisterendeVurderinger;

Expand Down Expand Up @@ -256,7 +257,15 @@ const MedisinskVilkår = (): JSX.Element => {
/>

<div className={styles.medisinskVilkår}>
<h1 style={{ fontSize: 22 }}>{sykdomTittel(fagsakYtelseType)}</h1>
<HStack gap="2">
<h1 style={{ fontSize: 22 }}>{sykdomTittel(fagsakYtelseType)}</h1>
{ikkeSammenMedBarnet === true && (
<Alert inline variant="warning" style={{ paddingTop: '1rem' }}>
Søker har opplyst om utenlandsopphold uten barnet i søknadsperioden. Sjekk søknaden og korriger den
aktuelle perioden via punsj, slik at det ikke utbetales pleiepenger for perioden søker ikke pleier barnet.
</Alert>
)}
</HStack>
<WriteAccessBoundContent
contentRenderer={() => (
<Box marginBottom={Margin.medium}>
Expand Down
2 changes: 1 addition & 1 deletion packages/fakta-om-barnet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"devDependencies": {
"msw": "2.3.1",
"vite": "^5.3.2",
"vite": "^5.3.3",
"vite-plugin-node-polyfills": "^0.22.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/fakta-omsorgen-for/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"devDependencies": {
"msw": "2.3.1",
"vite": "^5.3.2",
"vite": "^5.3.3",
"vite-plugin-node-polyfills": "^0.22.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/prosess-omsorgsdager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dev": "vite serve"
},
"devDependencies": {
"vite": "^5.3.2",
"vite": "^5.3.3",
"vite-plugin-node-polyfills": "^0.22.0",
"vitest-axe": "^0.1.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/prosess-uttak/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"author": "NAV IT",
"license": "MIT",
"devDependencies": {
"vite": "^5.3.2",
"vite": "^5.3.3",
"vite-plugin-node-polyfills": "^0.22.0"
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/prosess-vedtak/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"private": true,
"dependencies": {
"@editorjs/editorjs": "2.29.1",
"@editorjs/header": "2.8.1",
"@editorjs/header": "2.8.5",
"@editorjs/list": "1.9.0",
"@editorjs/paragraph": "2.11.5",
"@editorjs/paragraph": "2.11.6",
"@fpsak-frontend/form": "1.0.0",
"@fpsak-frontend/kodeverk": "1.0.0",
"@fpsak-frontend/prop-types": "1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/sak-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@navikt/ft-fakta-beregning-redesign": "1.2.17",
"@navikt/ft-form-hooks": "4.4.16",
"@navikt/ft-plattform-komponenter": "3.0.1",
"@navikt/ft-prosess-beregningsgrunnlag": "6.5.21",
"@navikt/ft-prosess-beregningsgrunnlag": "6.5.22",
"@navikt/ft-ui-komponenter": "2.3.16",
"@sentry/browser": "8.13.0",
"@sentry/react": "^8.13.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/sak-app/src/bootstrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ init({
beforeSend: (event, hint) => {
const exception = hint.originalException;
// @ts-ignore
if (exception.isAxiosError) {
if (exception?.isAxiosError) {
// @ts-ignore
const requestUrl = new URL(exception.request.responseURL);
// eslint-disable-next-line no-param-reassign
Expand Down
2 changes: 1 addition & 1 deletion packages/v2/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
},
"dependencies": {
"@navikt/k9-klage-typescript-client": "1.0.20240513162434-997f3da",
"@navikt/k9-sak-typescript-client": "1.0.20240620093339"
"@navikt/k9-sak-typescript-client": "1.0.20240708134619"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const Default: StoryObj<typeof FritekstInput> = {
args: {
språk: 'NB', // SPRAAK_KODE
show: true,
showTitle: true,
fritekstModus: 'EnkelFritekst',
showValidation: true,
},
};
40 changes: 24 additions & 16 deletions packages/v2/gui/src/sak/meldinger/FritekstInput.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { type ForwardedRef, forwardRef, useEffect, useImperativeHandle, useReducer } from 'react';
import { Tag, type TagProps, Textarea, TextField } from '@navikt/ds-react';
import { $FritekstbrevinnholdDto } from '@k9-sak-web/backend/k9sak/generated';
import { $BestillBrevDto, $FritekstbrevinnholdDto } from '@k9-sak-web/backend/k9sak/generated';
import { validateTextCharacters } from '../../utils/validation/validateTextCharacters.js';

type Valid = {
Expand All @@ -25,10 +25,13 @@ export interface FritekstInputInvalid {
readonly tekst?: never;
}

// Sending av brev med fritekst har to ulike varianter. Ein kort enkel fritekst eller lengre tekst med tittel.
export type FritekstModus = 'EnkelFritekst' | 'StørreFritekstOgTittel';

type FritekstInputProps = {
readonly språk: string;
readonly show: boolean;
readonly showTitle: boolean;
readonly fritekstModus: FritekstModus;
readonly showValidation: boolean;
readonly defaultValue?: FritekstInputValue;
readonly onChange?: (value: FritekstInputValue | FritekstInputInvalid) => void;
Expand All @@ -40,8 +43,9 @@ export interface FritekstInputMethods {
setValue(value: FritekstInputValue): void;
}

const fritekstMaxLength = $FritekstbrevinnholdDto.properties.brødtekst.maxLength;
const tittelMaxLength = $FritekstbrevinnholdDto.properties.overskrift.maxLength;
const storFritekstMaxLength = $FritekstbrevinnholdDto.properties.brødtekst.maxLength;
const litenFritekstMaxLength = $BestillBrevDto.properties.fritekst.maxLength;

const validateTittel = (newValue: string | undefined): Valid | Error => {
const input = newValue || '';
Expand All @@ -57,11 +61,12 @@ const validateTittel = (newValue: string | undefined): Valid | Error => {

const tittelReducer = (_: Valid | Error, newValue: string | undefined): Valid | Error => validateTittel(newValue);

const validateTekst = (newValue: string | undefined): Valid | Error => {
const input = newValue || '';
const len = newValue?.trim().length || 0;
if (newValue !== undefined && len > 0 && len <= fritekstMaxLength) {
const charValidationResult = validateTextCharacters(newValue);
const validateTekst = (tekst: string | undefined, fritekstModus: FritekstModus): Valid | Error => {
const input = tekst || '';
const fritekstMaxLength = fritekstModus === 'StørreFritekstOgTittel' ? storFritekstMaxLength : litenFritekstMaxLength;
const len = tekst?.trim().length || 0;
if (tekst !== undefined && len > 0 && len <= fritekstMaxLength) {
const charValidationResult = validateTextCharacters(tekst);
if (charValidationResult.ok) {
// validation ok
return { valid: true, input };
Expand All @@ -76,7 +81,8 @@ const validateTekst = (newValue: string | undefined): Valid | Error => {
return { valid: false, input, error: `Fritekst kan være maks ${fritekstMaxLength} tegn` };
};

const tekstReducer = (_: Valid | Error, newValue: string | undefined): Valid | Error => validateTekst(newValue);
const tekstReducer = (_: Valid | Error, newValue: { tekst: string | undefined; modus: FritekstModus }): Valid | Error =>
validateTekst(newValue.tekst, newValue.modus);

const resolveLanguageName = (språk: string): string => {
switch (språk.toUpperCase()) {
Expand Down Expand Up @@ -106,15 +112,15 @@ const resolveLanguageTagVariant = (språk: string): TagProps['variant'] =>
*/
const FritekstInput = forwardRef(
(
{ språk, show, showTitle, showValidation = false, defaultValue, onChange }: FritekstInputProps,
{ språk, show, fritekstModus, showValidation = false, defaultValue, onChange }: FritekstInputProps,
ref: ForwardedRef<FritekstInputMethods>,
) => {
const [tittel, setTittel] = useReducer(tittelReducer, validateTittel(defaultValue?.tittel));
const [tekst, setTekst] = useReducer(tekstReducer, validateTekst(defaultValue?.tekst));
const [tekst, setTekst] = useReducer(tekstReducer, validateTekst(defaultValue?.tekst, fritekstModus));

const getValue = (): FritekstInputValue | FritekstInputInvalid => {
if (tekst.valid) {
if (!showTitle) {
if (fritekstModus === 'EnkelFritekst') {
return { tittel: undefined, tekst: tekst.input };
}
if (tittel.valid) {
Expand All @@ -125,24 +131,26 @@ const FritekstInput = forwardRef(
};
const setValue = (value: FritekstInputValue | undefined) => {
setTittel(value?.tekst);
setTekst(value?.tekst);
setTekst({ tekst: value?.tekst, modus: fritekstModus });
};

useEffect(() => {
if (onChange !== undefined) {
onChange(getValue());
}
}, [tittel, tekst, showTitle, onChange]);
}, [tittel, tekst, fritekstModus, onChange]);
useImperativeHandle(ref, () => {
const reset = () => setValue(defaultValue);
return { reset, getValue, setValue };
});

if (show) {
const fritekstMaxLength =
fritekstModus === 'StørreFritekstOgTittel' ? storFritekstMaxLength : litenFritekstMaxLength;
return (
<>
{
showTitle ? (
fritekstModus === 'StørreFritekstOgTittel' ? (
<TextField
value={tittel.input}
size="small"
Expand All @@ -169,7 +177,7 @@ const FritekstInput = forwardRef(
resize="vertical"
defaultValue={defaultValue?.tekst}
error={showValidation && tekst?.error}
onChange={ev => setTekst(ev.target.value)}
onChange={ev => setTekst({ tekst: ev.target.value, modus: fritekstModus })}
/>
</>
);
Expand Down
13 changes: 10 additions & 3 deletions packages/v2/gui/src/sak/meldinger/Messages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import FritekstInput, {
type FritekstInputInvalid,
type FritekstInputMethods,
type FritekstInputValue,
type FritekstModus,
} from './FritekstInput.js';
import MalSelect from './MalSelect.jsx';
import type { BehandlingInfo } from '../BehandlingInfo.js';
Expand Down Expand Up @@ -238,13 +239,19 @@ const Messages = ({
onValgtMalChanged(valgtMal);
}, [valgtMal]);

const fritekstModus: FritekstModus = valgtMal?.støtterTittelOgFritekst ? 'StørreFritekstOgTittel' : 'EnkelFritekst';

const showFritekstInput = (valgtMal?.støtterFritekst || valgtMal?.støtterTittelOgFritekst) ?? false;

// FritekstbrevinnholdDto must be undefined or have props set with string value
const resolveFritekstbrevinnholdDto = (
fritekstInputValue: FritekstInputValue | FritekstInputInvalid | undefined,
): FritekstbrevinnholdDto | undefined => {
if (fritekstInputValue?.tittel !== undefined && fritekstInputValue?.tekst !== undefined) {
if (
fritekstModus === 'StørreFritekstOgTittel' &&
fritekstInputValue?.tittel !== undefined &&
fritekstInputValue?.tekst !== undefined
) {
return {
overskrift: fritekstInputValue.tittel,
brødtekst: fritekstInputValue.tekst,
Expand Down Expand Up @@ -280,7 +287,7 @@ const Messages = ({
const fritekstbrev = resolveFritekstbrevinnholdDto(fritekstInputValue);
// Ut frå oppførsel til gammal kode ser det ut til at fritekst skal settast når valgt mal ikkje støtter tittel.
// Ellers skal fritekstbrev prop settast.
const fritekst = fritekstInputValue?.tekst;
const fritekst = fritekstModus === 'EnkelFritekst' ? fritekstInputValue?.tekst : undefined;
const overstyrtMottaker = resolveOvertyrtMottaker();
// Viss valg for sending til tredjepartsmottaker er aktivt må overstyrtMottaker vere definert
if (tredjepartsmottakerAktivert && overstyrtMottaker === undefined) {
Expand Down Expand Up @@ -386,7 +393,7 @@ const Messages = ({
defaultValue={valgtFritekstInputValue}
ref={fritekstInputRef}
show={showFritekstInput}
showTitle={valgtMal?.støtterTittelOgFritekst === true}
fritekstModus={fritekstModus}
showValidation={showValidation}
/>
<HStack gap="3">
Expand Down
Loading

0 comments on commit 2e00bbc

Please sign in to comment.