Skip to content

Commit

Permalink
ta i bruk ny amplitude client
Browse files Browse the repository at this point in the history
  • Loading branch information
kenglxn committed Nov 4, 2024
1 parent 01a57f4 commit f8a42c3
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 134 deletions.
173 changes: 67 additions & 106 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"homepage": "/min-side-arbeidsgiver",
"type": "module",
"dependencies": {
"@amplitude/analytics-browser": "2.11.8",
"@faker-js/faker": "8.4.1",
"@grafana/faro-web-sdk": "1.3.6",
"@navikt/aksel-icons": "^5.17.2",
Expand All @@ -13,7 +14,6 @@
"@navikt/ds-icons": "3.4.3",
"@navikt/ds-react": "^6.15.0",
"@navikt/nav-dekoratoren-moduler": "2.1.6",
"amplitude-js": "^8.21.9",
"fuzzysort": "^1.1.4",
"immutable": "^4.3.6",
"msw": "2.3.1",
Expand All @@ -31,7 +31,6 @@
"@graphql-codegen/typescript-react-apollo": "^4.3.0",
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/react": "^16.0.0",
"@types/amplitude-js": "^8.16.5",
"@types/jest-axe": "^3.5.9",
"@types/node": "^20.14.9",
"@types/react": "18.3.3",
Expand Down
10 changes: 6 additions & 4 deletions src/Pages/OrganisasjonerOgTilgangerProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Map, Set } from 'immutable';
import { useUserInfo } from '../hooks/useUserInfo';
import { ManglerTilganger } from './ManglerTilganger/ManglerTilganger';
import { SpinnerMedBanner } from './Banner';
import { Identify } from '@amplitude/analytics-browser';

type orgnr = string;

Expand Down Expand Up @@ -90,10 +91,11 @@ const useBeregnOrganisasjoner = (): Record<orgnr, OrganisasjonInfo> | undefined
setSystemAlert('UserInfoDigiSyfo', userInfo?.digisyfoError ?? false);

if (userInfo !== undefined) {
amplitude.setUserProperties({
syfotilgang: userInfo.digisyfoOrganisasjoner.length > 0,
buildTimestamp,
});
amplitude.identify(
new Identify()
.set('syfotilgang', userInfo.digisyfoOrganisasjoner.length > 0)
.set('buildTimestamp', buildTimestamp)
);
}
}, [userInfo]);

Expand Down
Loading

0 comments on commit f8a42c3

Please sign in to comment.