Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Commit

Permalink
use new metrics sending package
Browse files Browse the repository at this point in the history
  • Loading branch information
tharaldyo committed Aug 17, 2023
1 parent 7c4313d commit 3d8bc3c
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 6 deletions.
3 changes: 1 addition & 2 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
ignore-scripts true

ignore-scripts true
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@navikt/ds-react": "^4.7.0",
"@navikt/fnrvalidator": "^1.3.0",
"@navikt/nav-dekoratoren-moduler": "^1.6.9",
"@navikt/ia-metrikker-client": "^1.5.0",
"@testing-library/react-hooks": "8.0.1",
"amplitude-js": "^8.21.9",
"browserslist": "^4.21.9",
Expand All @@ -48,6 +49,7 @@
"@craco/types": "^7.1.0",
"@navikt/arbeidsgiver-notifikasjoner-brukerapi-mock": "^6.2.2",
"@navikt/eslint-config-teamia": "^1.0.5",
"@navikt/ia-metrikker-client": "^1.5.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
Expand Down
4 changes: 2 additions & 2 deletions src/Forside/Forside.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Statistikkategori } from '../domene/statistikkategori';
import { Alert, BodyShort, Button, Heading, Skeleton } from '@navikt/ds-react';
import ReactToPrint from 'react-to-print';
import { sendKnappEvent } from '../amplitude/events';
import { sendIaTjenesteMetrikkMottatt } from '../metrikker/iatjenester';
import { sendIaTjenesteMetrikk } from '../metrikker/iatjenester';
import Tabell, { hentTabellProps } from '../Historikk/Tabell/Tabell';
import { SlikHarViKommetFramTilDittResultat } from './SlikHarViKommetFramTilDittResultat/SlikHarViKommetFramTilDittResultat';
import { PeriodeForStatistikk } from './PeriodeForStatistikk';
Expand Down Expand Up @@ -136,7 +136,7 @@ export const Forside: FunctionComponent<SykefraværAppData> = (appData) => {
<ReactToPrint
onBeforePrint={() => {
sendKnappEvent('skriv ut');
sendIaTjenesteMetrikkMottatt(orgnr);
sendIaTjenesteMetrikk(orgnr);
}}
onAfterPrint={() => {
if (lastNedKnappRef.current) {
Expand Down
4 changes: 2 additions & 2 deletions src/Forside/Sammenligningspaneler/Sammenligningspaneler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { RestAggregertStatistikk } from '../../hooks/useAggregertStatistikk';
import { Statistikkategori } from '../../domene/statistikkategori';
import { getBransjeEllerNæringKategori } from './GetBransjeEllerNæringKategori';
import { Skeleton } from '@navikt/ds-react';
import { sendIaTjenesteMetrikkMottatt } from '../../metrikker/iatjenester';
import { sendIaTjenesteMetrikk } from '../../metrikker/iatjenester';

interface Props {
aggregertStatistikk: RestAggregertStatistikk;
Expand All @@ -22,7 +22,7 @@ export const Sammenligningspaneler: FunctionComponent<Props> = ({
useEffect(() => {
const timer = setTimeout(() => {
if (skalSendeMetrikkerAutomatisk) {
sendIaTjenesteMetrikkMottatt(orgnr);
sendIaTjenesteMetrikk(orgnr);
}
}, 5000);
return () => clearTimeout(timer);
Expand Down
15 changes: 15 additions & 0 deletions src/metrikker/iatjenester.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
import { BASE_PATH } from '../konstanter';
import {
getIaMetrikkerApiUrl,
MetrikkKilde,
MetrikkType,
sendIaMetrikk,
} from '@navikt/ia-metrikker-client';

export const sendIaTjenesteMetrikk = async (orgnr: string) => {
return sendIaMetrikk(
orgnr,
MetrikkType.DIGITAL_IA_TJENESTE,
MetrikkKilde.SYKEFRAVÆRSSTATISTIKK,
getIaMetrikkerApiUrl(BASE_PATH)
);
};

export type Virksomhet = { orgnr: string };

Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2283,6 +2283,11 @@
resolved "https://npm.pkg.github.com/download/@navikt/fnrvalidator/1.3.3/8414963a30e59e3056c9befea7bb022498a2a742#8414963a30e59e3056c9befea7bb022498a2a742"
integrity sha512-GsLa9ioYPGsDMBHcgKUNoYbZor09KyFIqSaWy8jy1I7f06q6DgUhdpZuRTHLVRCPjWqF2aLzKtvAfrw5dSeakg==

"@navikt/ia-metrikker-client@^1.5.0":
version "1.5.0"
resolved "https://npm.pkg.github.com/download/@navikt/ia-metrikker-client/1.5.0/2039286dcbef6b9574ef17bf6e63d5cfa4b21a4a#2039286dcbef6b9574ef17bf6e63d5cfa4b21a4a"
integrity sha512-bOtvP9mf+LMCR2w5ByXXEPASr9HWLLjpaIiCA9z5+jjNMtCJdaYh5NkisTGqay0LpIjNGOdYLnW8Y9mofra9UA==

"@navikt/nav-dekoratoren-moduler@^1.6.9":
version "1.9.0"
resolved "https://npm.pkg.github.com/download/@navikt/nav-dekoratoren-moduler/1.9.0/846eb07e61407c96215bfff3070933d7a858b55a#846eb07e61407c96215bfff3070933d7a858b55a"
Expand Down

0 comments on commit 3d8bc3c

Please sign in to comment.