-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IS-2300: internarbeidsflate-decorator-v3 #211
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { post } from "@/api/axios"; | ||
import { MODIACONTEXTHOLDER_ROOT } from "@/api/constants"; | ||
import { useMutation } from "@tanstack/react-query"; | ||
|
||
const NY_AKTIV_BRUKER = "NY_AKTIV_BRUKER"; | ||
|
||
export const useAktivBruker = () => | ||
useMutation({ | ||
mutationFn: (fnr: string) => | ||
post(`${MODIACONTEXTHOLDER_ROOT}/context`, { | ||
verdi: fnr, | ||
eventType: NY_AKTIV_BRUKER, | ||
}), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,67 @@ | ||
interface TogglesConfig { | ||
visVeileder: boolean; | ||
export interface DecoratorProps { | ||
enhet?: string | undefined; // Konfigurasjon av enhet-kontekst | ||
accessToken?: string | undefined; // Manuell innsending av JWT, settes som Authorization-header. Om null sendes cookies vha credentials: 'include' | ||
fnr?: string | undefined; // Konfigurasjon av fødselsnummer-kontekst | ||
userKey?: string | undefined; // Om man ikke ønsker å bruke fnr i urler, kan andre apper kalle contextholder for å generere en midlertidig kode. Hvis App A skal navigere til App B som har dekoratøren, må App A først sende en post request til /fnr-code/generate med {fnr: string} i bodyen, dette returnerer {fnr: string, code: string} til App A. App A kan så navigere til App B og sende med denne koden. App B kan så sende den koden inn til dekoratøren i userKey propen og så henter dekoratøren fnr for den koden fra contextholderen. | ||
enableHotkeys?: boolean | undefined; // Aktivere hurtigtaster | ||
fetchActiveEnhetOnMount?: boolean | undefined; // Om enhet er undefined fra container appen, og denne er satt til true, henter den sist aktiv enhet og bruker denne. | ||
fetchActiveUserOnMount?: boolean | undefined; // Om fnr er undefined fra container appen, og denne er satt til true for at den skal hente siste aktiv fnr. | ||
onEnhetChanged: (enhetId?: string | null, enhet?: Enhet) => void; // Kalles når enheten endres | ||
onFnrChanged: (fnr?: string | null) => void; // Kalles når fnr enheten endres | ||
onLinkClick?: (link: { text: string; url: string }) => void; // Kan brukes for å legge til callbacks ved klikk på lenker i menyen. Merk at callbacken ikke kan awaites og man må selv håndtere at siden lukkes. Nyttig for å f.eks tracke navigasjon events i amplitude | ||
appName: string; // Navn på applikasjonen | ||
hotkeys?: Hotkey[]; // Konfigurasjon av hurtigtaster | ||
markup?: Markup; // Egen HTML | ||
showEnheter: boolean; // Vis enheter | ||
showSearchArea: boolean; // Vis søkefelt | ||
showHotkeys: boolean; // Vis hurtigtaster | ||
environment: Environment; // Miljø som skal brukes. | ||
urlFormat: UrlFormat; // URL format | ||
proxy?: string | undefined; // Manuell overstyring av urlene til BFFs. Gjør alle kall til relativt path hvis true, og bruker verdien som domene om satt til en string. Default: false | ||
} | ||
|
||
interface Markup { | ||
etterSokefelt?: string; | ||
export interface Markup { | ||
etterSokefelt?: string; // Gir muligheten for sende inn egen html som blir en del av dekoratøren | ||
} | ||
|
||
export interface ControlledContextvalue<T> extends BaseContextvalue<T> { | ||
value?: string; | ||
} | ||
interface UncontrolledContextvalue<T> extends BaseContextvalue<T> { | ||
initialValue?: string; | ||
export interface Enhet { | ||
readonly enhetId: string; | ||
readonly navn: string; | ||
} | ||
|
||
interface BaseContextvalue<T> { | ||
display: T; | ||
onChange(value?: string): void; | ||
skipModal?: boolean; | ||
ignoreWsEvents?: boolean; | ||
} | ||
// Miljø | ||
export type Environment = | ||
| "q0" | ||
| "q1" | ||
| "q2" | ||
| "q3" | ||
| "q4" | ||
| "prod" | ||
| "local" | ||
| "mock"; | ||
|
||
export type Contextvalue<T> = | ||
| ControlledContextvalue<T> | ||
| UncontrolledContextvalue<T>; | ||
export type UrlFormat = "LOCAL" | "NAV_NO" | "ANSATT"; // UrlFormat. Brukes om proxy ikke er satt & i url til websocket. | ||
|
||
export enum EnhetDisplay { | ||
ENHET = "ENHET", | ||
ENHET_VALG = "ENHET_VALG", | ||
export interface HotkeyObject { | ||
char: string; | ||
altKey?: boolean; | ||
ctrlKey?: boolean; | ||
metaKey?: boolean; | ||
shiftKey?: boolean; | ||
} | ||
|
||
export enum FnrDisplay { | ||
SOKEFELT = "SOKEFELT", | ||
export interface HotkeyDescription { | ||
key: HotkeyObject; | ||
description: string; | ||
forceOverride?: boolean; | ||
} | ||
|
||
type EnhetContextvalue = Contextvalue<EnhetDisplay>; | ||
type FnrContextvalue = Contextvalue<FnrDisplay>; | ||
type ProxyConfig = boolean | string; | ||
export interface ActionHotKey extends HotkeyDescription { | ||
action(event: KeyboardEvent): void; | ||
} | ||
|
||
export interface DecoratorProps { | ||
appname: string; | ||
fnr?: FnrContextvalue; | ||
enhet?: EnhetContextvalue; | ||
toggles?: TogglesConfig; | ||
markup?: Markup; | ||
useProxy?: ProxyConfig; | ||
accessToken?: string; | ||
export interface DocumentingHotKey extends HotkeyDescription { | ||
documentationOnly: boolean; | ||
} | ||
|
||
export type Hotkey = ActionHotKey | DocumentingHotKey; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tror dette har vært brukket en stund (men kanskje ikke så mange som hopper til syfomodiaperson fra finnfastlege).