diff --git a/index.html b/index.html index aa244c644..1fd92d973 100644 --- a/index.html +++ b/index.html @@ -25,9 +25,11 @@ - diff --git a/src/app/internarbeidsflatedecorator/decoratorprops.ts b/src/app/internarbeidsflatedecorator/decoratorprops.ts index 17d584667..b4f054c82 100644 --- a/src/app/internarbeidsflatedecorator/decoratorprops.ts +++ b/src/app/internarbeidsflatedecorator/decoratorprops.ts @@ -62,4 +62,5 @@ export interface DecoratorPropsV3 { onEnhetChanged: (enhet?: string | null, enhetValue?: Enhet) => void; onLinkClick?: (link: { text: string; url: string }) => void; onFnrChanged: (fnr?: string | null) => void; + websocketUrl?: string | undefined; } diff --git a/src/app/internarbeidsflatedecorator/useDecoratorConfig.tsx b/src/app/internarbeidsflatedecorator/useDecoratorConfig.tsx index 7fe756ab2..f8ecf1f28 100644 --- a/src/app/internarbeidsflatedecorator/useDecoratorConfig.tsx +++ b/src/app/internarbeidsflatedecorator/useDecoratorConfig.tsx @@ -13,6 +13,7 @@ import { useGjeldendeBruker } from '../../redux/gjeldendeBruker/types'; import { getDomainFromHost, getEnvFromHost } from '../../utils/environment'; import { useRouteMatch } from 'react-router'; import config from '../../config'; +import { getWindowFeature } from '../../utils/featureToggles'; export function useDecoratorConfig() { const valgtEnhet = useValgtenhet(); @@ -79,6 +80,8 @@ function lagConfigV3( const urlFormat = getDomainFromHost(); + const brukNyContext = getWindowFeature('contextholderNext'); + return { appName: 'Modia personoversikt', fnr: onsketFnr ?? undefined, @@ -103,14 +106,13 @@ function lagConfigV3( }, hotkeys: getHotkeys(), enableHotkeys: true, - // modiacontextholder kjører på samme domene som modiapersonoversikt. - // Som default brukes app.adeo.no, så her tvinger vi dekoratøren over på nytt domene - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment proxy: import.meta.env.PROD ? `https://${window.location.host}${import.meta.env.BASE_URL}proxy/modiacontextholder` - : (import.meta.env.VITE_CONTEXTHOLDER_URL ?? `${import.meta.env.BASE_URL}proxy/modiacontextholder`), + : ((import.meta.env.VITE_CONTEXTHOLDER_URL as string) ?? + `${import.meta.env.BASE_URL}proxy/modiacontextholder`), environment, urlFormat: import.meta.env.PROD ? urlFormat : 'LOCAL', + websocketUrl: brukNyContext ? 'wss://modiacontextholder-next.intern.dev.nav.no/ws/' : undefined, showEnheter: true, showSearchArea: true, fetchActiveUserOnMount: true, @@ -126,7 +128,7 @@ function getFnrFraUrl(): { sokFnr: string | null; userKey: string | null; urlFnr const queryParams = parseQueryString<{ sokFnr?: string; userKey?: string }>(location.search); return { - urlFnr, + urlFnr: urlFnr ?? null, sokFnr: queryParams.sokFnr ?? null, userKey: queryParams.userKey ?? null }; diff --git a/src/components/featureToggle/toggleIDs.ts b/src/components/featureToggle/toggleIDs.ts index bce2e259b..1824637a4 100644 --- a/src/components/featureToggle/toggleIDs.ts +++ b/src/components/featureToggle/toggleIDs.ts @@ -4,5 +4,6 @@ export enum FeatureToggles { BrukNyDecorator = 'modiapersonoversikt.decorator-v3', JournalforUtenSvar = 'modiapersonoversikt.meldinger-uten-svar-kan-journalfores', VisDraftStatus = 'modiapersonoversikt.vis-draft-status', - BrukNyTiltakspenger = 'modiapersonoversikt.bruk-ny-tiltakspenger' + BrukNyTiltakspenger = 'modiapersonoversikt.bruk-ny-tiltakspenger', + BrukContextholderNext = 'modiapersonoversikt.bruk-contextholder-next' }