diff --git a/.github/workflows/bygg-branch.yml b/.github/workflows/bygg-branch.yml index 491294320..2be4548f1 100644 --- a/.github/workflows/bygg-branch.yml +++ b/.github/workflows/bygg-branch.yml @@ -13,15 +13,19 @@ jobs: bygg: name: Bygg branch runs-on: ubuntu-latest + permissions: + contents: 'read' + id-token: 'write' + packages: 'write' steps: - name: Sjekk ut kode - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - uses: actions/setup-node@v3 with: - node-version: '16.14.2' + node-version: '18' registry-url: https://npm.pkg.github.com/ cache: 'npm' @@ -32,6 +36,8 @@ jobs: - run: npm run lint - run: npm run build + env: + PUBLIC_URL: https://cdn.nav.no/fager/min-side-arbeidsgiver/build/ - uses: docker/login-action@v1 with: @@ -44,3 +50,10 @@ jobs: docker build --tag $IMAGE_BASE:$GITHUB_SHA . echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u $GITHUB_REPOSITORY --password-stdin docker push $IMAGE_BASE:$GITHUB_SHA + + - id: upload + uses: navikt/frontend/actions/cdn-upload/v1@main + with: + cdn-team-name: fager + source: ./build/ + destination: '/min-side-arbeidsgiver' diff --git a/.github/workflows/bygg-og-deploy-master.yml b/.github/workflows/bygg-og-deploy-master.yml index 9163002ad..d6db928db 100644 --- a/.github/workflows/bygg-og-deploy-master.yml +++ b/.github/workflows/bygg-og-deploy-master.yml @@ -35,13 +35,17 @@ jobs: runs-on: ubuntu-latest needs: test if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' + permissions: + contents: 'read' + id-token: 'write' + packages: 'write' steps: - name: Sjekk ut kode - uses: actions/checkout@v2 + uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '16.14.2' + node-version: '18' registry-url: https://npm.pkg.github.com/ cache: 'npm' @@ -53,6 +57,8 @@ jobs: - run: npm run lint - run: npm run build + env: + PUBLIC_URL: https://cdn.nav.no/fager/min-side-arbeidsgiver/build/ - uses: docker/login-action@v1 with: @@ -66,6 +72,13 @@ jobs: echo $GITHUB_TOKEN | docker login docker.pkg.github.com -u $GITHUB_REPOSITORY --password-stdin docker push $IMAGE + - id: upload + uses: navikt/frontend/actions/cdn-upload/v1@main + with: + cdn-team-name: fager + source: ./build/ + destination: '/min-side-arbeidsgiver' + - name: Lag sentry release continue-on-error: true env: diff --git a/nais/dev-gcp.yaml b/nais/dev-gcp.yaml index b60299e75..6b36b3d1f 100644 --- a/nais/dev-gcp.yaml +++ b/nais/dev-gcp.yaml @@ -42,22 +42,23 @@ spec: value: http://notifikasjon-bruker-api.fager.svc.cluster.local - name: GIT_COMMIT value: {{commit}} - - name: SYKEFRAVAER_DOMAIN - value: https://sykefravarsstatistikk.intern.dev.nav.no - name: MILJO value: dev accessPolicy: outbound: external: - host: arbeidsgiver-gcp.dev.nav.no - - host: sykefravarsstatistikk.intern.dev.nav.no - host: arbeidsgiver.intern.dev.nav.no - host: tiltak-proxy.dev-fss-pub.nais.io + - host: aareg-innsyn-arbeidsgiver-api.dev-fss-pub.nais.io rules: - application: min-side-arbeidsgiver-api - application: notifikasjon-bruker-api - application: tiltak-proxy namespace: arbeidsgiver cluster: dev-fss + - application: aareg-innsyn-arbeidsgiver-api + namespace: arbeidsforhold + cluster: dev-fss - application: presenterte-kandidater-api namespace: toi diff --git a/nais/experimental-labs-gcp.yaml b/nais/experimental-labs-gcp.yaml index 059dad525..90fec314c 100644 --- a/nais/experimental-labs-gcp.yaml +++ b/nais/experimental-labs-gcp.yaml @@ -36,8 +36,6 @@ spec: value: http://localhost:8081 - name: GIT_COMMIT value: {{commit}} - - name: SYKEFRAVAER_DOMAIN - value: https://arbeidsgiver.labs.nav.no - name: MILJO value: demo accessPolicy: diff --git a/nais/labs-gcp.yaml b/nais/labs-gcp.yaml index 9f9d6064f..6360f41a0 100644 --- a/nais/labs-gcp.yaml +++ b/nais/labs-gcp.yaml @@ -36,8 +36,6 @@ spec: value: http://localhost:8081 - name: GIT_COMMIT value: {{commit}} - - name: SYKEFRAVAER_DOMAIN - value: https://arbeidsgiver.labs.nav.no - name: MILJO value: demo accessPolicy: diff --git a/nais/prod-gcp.yaml b/nais/prod-gcp.yaml index 41f952144..a5f650af0 100644 --- a/nais/prod-gcp.yaml +++ b/nais/prod-gcp.yaml @@ -42,8 +42,6 @@ spec: value: http://notifikasjon-bruker-api.fager.svc.cluster.local - name: GIT_COMMIT value: {{commit}} - - name: SYKEFRAVAER_DOMAIN - value: https://arbeidsgiver.nav.no - name: MILJO value: prod accessPolicy: @@ -51,11 +49,15 @@ spec: external: - host: arbeidsgiver.nav.no - host: tiltak-proxy.prod-fss-pub.nais.io + - host: aareg-innsyn-arbeidsgiver-api.prod-fss-pub.nais.io rules: - application: min-side-arbeidsgiver-api - application: notifikasjon-bruker-api - application: tiltak-proxy namespace: arbeidsgiver cluster: prod-fss + - application: aareg-innsyn-arbeidsgiver-api + namespace: arbeidsforhold + cluster: prod-fss - application: presenterte-kandidater-api namespace: toi diff --git a/package-lock.json b/package-lock.json index bae6da614..a2ffdeaa3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "@navikt/ds-icons": "3.4.3", "@navikt/ds-react": "^4.9.0", "@navikt/fnrvalidator": "^1.1.3", - "@navikt/nav-dekoratoren-moduler": "1.6.18", + "@navikt/nav-dekoratoren-moduler": "2.1.3", "@sentry/react": "^6.7.0", "@types/amplitude-js": "^8.9.0", "@types/classnames": "^2.2.7", @@ -4363,17 +4363,21 @@ "license": "MIT" }, "node_modules/@navikt/nav-dekoratoren-moduler": { - "version": "1.6.18", - "resolved": "https://npm.pkg.github.com/download/@navikt/nav-dekoratoren-moduler/1.6.18/0d0bdb286e023e0c31886d329ac7f069ac59352b", - "integrity": "sha512-mZV2Epn68h6yF7Sbw4gthe/KwT6SuDRGbZT9UxDTd/IA76D8LN73oX9eTzSs5qYosKIzXCWfQmIPy7ExpaRDsA==", + "version": "2.1.3", + "resolved": "https://npm.pkg.github.com/download/@navikt/nav-dekoratoren-moduler/2.1.3/e2081da2da26254fa4eeaf564286e19452ec790f", + "integrity": "sha512-jjiRlW4xPoZHyudAwZForfvO7LZiRXkMpPLMXE3OvO/GR2Guk2eacAKxkvwrKPN/r5jQvgREI1CJnYuYMFN9Lw==", "license": "MIT", "dependencies": { - "html-react-parser": "^1.2.7", - "jsdom": "^16.6.0", - "node-cache": "^5.1.2", - "node-fetch": "^2.6.1", - "prop-types": "^15.7.2", - "react": "^17.0.2" + "csp-header": "^5.1.0", + "html-react-parser": "^3.0.16", + "node-cache": "^5.1.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "jsdom": ">=16.x", + "react": "17.x || 18.x" } }, "node_modules/@nicolo-ribaudo/eslint-scope-5-internals": { @@ -7683,6 +7687,14 @@ "node": ">=8" } }, + "node_modules/csp-header": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/csp-header/-/csp-header-5.2.1.tgz", + "integrity": "sha512-qOJNu39JZkPrbrAM40a1tQCePEPYVIoI6nMDhX4RA07QjU8efS+zyd/zE83XJu85KKazH9NjKlvvlswFMteMgg==", + "engines": { + "node": ">=10" + } + }, "node_modules/css-blank-pseudo": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/css-blank-pseudo/-/css-blank-pseudo-3.0.3.tgz", @@ -8577,9 +8589,9 @@ } }, "node_modules/entities": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz", - "integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", "engines": { "node": ">=0.12" }, @@ -10652,12 +10664,26 @@ } }, "node_modules/html-dom-parser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/html-dom-parser/-/html-dom-parser-1.2.0.tgz", - "integrity": "sha512-2HIpFMvvffsXHFUFjso0M9LqM+1Lm22BF+Df2ba+7QHJXjk63pWChEnI6YG27eaWqUdfnh5/Vy+OXrNTtepRsg==", + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/html-dom-parser/-/html-dom-parser-3.1.7.tgz", + "integrity": "sha512-cDgNF4YgF6J3H+d9mcldGL19p0GzVdS3iGuDNzYWQpU47q3+IRM85X3Xo07E+nntF4ek4s78A9V24EwxlPTjig==", "dependencies": { - "domhandler": "4.3.1", - "htmlparser2": "7.2.0" + "domhandler": "5.0.3", + "htmlparser2": "8.0.2" + } + }, + "node_modules/html-dom-parser/node_modules/domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "dependencies": { + "domelementtype": "^2.3.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" } }, "node_modules/html-encoding-sniffer": { @@ -10702,19 +10728,33 @@ } }, "node_modules/html-react-parser": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/html-react-parser/-/html-react-parser-1.4.14.tgz", - "integrity": "sha512-pxhNWGie8Y+DGDpSh8cTa0k3g8PsDcwlfolA+XxYo1AGDeB6e2rdlyv4ptU9bOTiZ2i3fID+6kyqs86MN0FYZQ==", + "version": "3.0.16", + "resolved": "https://registry.npmjs.org/html-react-parser/-/html-react-parser-3.0.16.tgz", + "integrity": "sha512-ysQZtRFPcg+McVb4B05oNWSnqM14zagpvTgGcI5e1/BvCl38YwzWzKibrbBmXeemg70olN1bAoeixo7o06G5Eg==", "dependencies": { - "domhandler": "4.3.1", - "html-dom-parser": "1.2.0", + "domhandler": "5.0.3", + "html-dom-parser": "3.1.7", "react-property": "2.0.0", - "style-to-js": "1.1.1" + "style-to-js": "1.1.3" }, "peerDependencies": { "react": "0.14 || 15 || 16 || 17 || 18" } }, + "node_modules/html-react-parser/node_modules/domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "dependencies": { + "domelementtype": "^2.3.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, "node_modules/html-webpack-plugin": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-5.5.0.tgz", @@ -10738,9 +10778,9 @@ } }, "node_modules/htmlparser2": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-7.2.0.tgz", - "integrity": "sha512-H7MImA4MS6cw7nbyURtLPO1Tms7C5H602LRETv95z1MxO/7CP7rDVROehUYeYBUYEON94NXXDEPmZuq+hX4sog==", + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz", + "integrity": "sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==", "funding": [ "https://github.com/fb55/htmlparser2?sponsor=1", { @@ -10749,10 +10789,50 @@ } ], "dependencies": { - "domelementtype": "^2.0.1", - "domhandler": "^4.2.2", - "domutils": "^2.8.0", - "entities": "^3.0.1" + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3", + "domutils": "^3.0.1", + "entities": "^4.4.0" + } + }, + "node_modules/htmlparser2/node_modules/dom-serializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/htmlparser2/node_modules/domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "dependencies": { + "domelementtype": "^2.3.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/htmlparser2/node_modules/domutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", + "integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==", + "dependencies": { + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" } }, "node_modules/http-deceiver": { @@ -14560,6 +14640,7 @@ "version": "2.6.7", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dev": true, "dependencies": { "whatwg-url": "^5.0.0" }, @@ -14578,17 +14659,20 @@ "node_modules/node-fetch/node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true }, "node_modules/node-fetch/node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true }, "node_modules/node-fetch/node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dev": true, "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" @@ -18268,17 +18352,17 @@ } }, "node_modules/style-to-js": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.1.tgz", - "integrity": "sha512-RJ18Z9t2B02sYhZtfWKQq5uplVctgvjTfLWT7+Eb1zjUjIrWzX5SdlkwLGQozrqarTmEzJJ/YmdNJCUNI47elg==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.3.tgz", + "integrity": "sha512-zKI5gN/zb7LS/Vm0eUwjmjrXWw8IMtyA8aPBJZdYiQTXj4+wQ3IucOLIOnF7zCHxvW8UhIGh/uZh/t9zEHXNTQ==", "dependencies": { - "style-to-object": "0.3.0" + "style-to-object": "0.4.1" } }, "node_modules/style-to-object": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-0.3.0.tgz", - "integrity": "sha512-CzFnRRXhzWIdItT3OmF8SQfWyahHhjq3HwcMNCNLn+N7klOOqPjMeG/4JSu77D7ypZdGvSzvkrbyeTMizz2VrA==", + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-0.4.1.tgz", + "integrity": "sha512-HFpbb5gr2ypci7Qw+IOhnP2zOU7e77b+rzM+wTzXzfi1PrtBCX0E7Pk4wL4iTLnhzZ+JgEGAhX81ebTg/aYjQw==", "dependencies": { "inline-style-parser": "0.1.1" } @@ -23389,16 +23473,13 @@ "integrity": "sha512-GsLa9ioYPGsDMBHcgKUNoYbZor09KyFIqSaWy8jy1I7f06q6DgUhdpZuRTHLVRCPjWqF2aLzKtvAfrw5dSeakg==" }, "@navikt/nav-dekoratoren-moduler": { - "version": "1.6.18", - "resolved": "https://npm.pkg.github.com/download/@navikt/nav-dekoratoren-moduler/1.6.18/0d0bdb286e023e0c31886d329ac7f069ac59352b", - "integrity": "sha512-mZV2Epn68h6yF7Sbw4gthe/KwT6SuDRGbZT9UxDTd/IA76D8LN73oX9eTzSs5qYosKIzXCWfQmIPy7ExpaRDsA==", + "version": "2.1.3", + "resolved": "https://npm.pkg.github.com/download/@navikt/nav-dekoratoren-moduler/2.1.3/e2081da2da26254fa4eeaf564286e19452ec790f", + "integrity": "sha512-jjiRlW4xPoZHyudAwZForfvO7LZiRXkMpPLMXE3OvO/GR2Guk2eacAKxkvwrKPN/r5jQvgREI1CJnYuYMFN9Lw==", "requires": { - "html-react-parser": "^1.2.7", - "jsdom": "^16.6.0", - "node-cache": "^5.1.2", - "node-fetch": "^2.6.1", - "prop-types": "^15.7.2", - "react": "^17.0.2" + "csp-header": "^5.1.0", + "html-react-parser": "^3.0.16", + "node-cache": "^5.1.2" } }, "@nicolo-ribaudo/eslint-scope-5-internals": { @@ -25936,6 +26017,11 @@ "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==" }, + "csp-header": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/csp-header/-/csp-header-5.2.1.tgz", + "integrity": "sha512-qOJNu39JZkPrbrAM40a1tQCePEPYVIoI6nMDhX4RA07QjU8efS+zyd/zE83XJu85KKazH9NjKlvvlswFMteMgg==" + }, "css-blank-pseudo": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/css-blank-pseudo/-/css-blank-pseudo-3.0.3.tgz", @@ -26564,9 +26650,9 @@ } }, "entities": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz", - "integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==" + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==" }, "error-ex": { "version": "1.3.2", @@ -28112,12 +28198,22 @@ } }, "html-dom-parser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/html-dom-parser/-/html-dom-parser-1.2.0.tgz", - "integrity": "sha512-2HIpFMvvffsXHFUFjso0M9LqM+1Lm22BF+Df2ba+7QHJXjk63pWChEnI6YG27eaWqUdfnh5/Vy+OXrNTtepRsg==", + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/html-dom-parser/-/html-dom-parser-3.1.7.tgz", + "integrity": "sha512-cDgNF4YgF6J3H+d9mcldGL19p0GzVdS3iGuDNzYWQpU47q3+IRM85X3Xo07E+nntF4ek4s78A9V24EwxlPTjig==", "requires": { - "domhandler": "4.3.1", - "htmlparser2": "7.2.0" + "domhandler": "5.0.3", + "htmlparser2": "8.0.2" + }, + "dependencies": { + "domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "requires": { + "domelementtype": "^2.3.0" + } + } } }, "html-encoding-sniffer": { @@ -28153,14 +28249,24 @@ } }, "html-react-parser": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/html-react-parser/-/html-react-parser-1.4.14.tgz", - "integrity": "sha512-pxhNWGie8Y+DGDpSh8cTa0k3g8PsDcwlfolA+XxYo1AGDeB6e2rdlyv4ptU9bOTiZ2i3fID+6kyqs86MN0FYZQ==", + "version": "3.0.16", + "resolved": "https://registry.npmjs.org/html-react-parser/-/html-react-parser-3.0.16.tgz", + "integrity": "sha512-ysQZtRFPcg+McVb4B05oNWSnqM14zagpvTgGcI5e1/BvCl38YwzWzKibrbBmXeemg70olN1bAoeixo7o06G5Eg==", "requires": { - "domhandler": "4.3.1", - "html-dom-parser": "1.2.0", + "domhandler": "5.0.3", + "html-dom-parser": "3.1.7", "react-property": "2.0.0", - "style-to-js": "1.1.1" + "style-to-js": "1.1.3" + }, + "dependencies": { + "domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "requires": { + "domelementtype": "^2.3.0" + } + } } }, "html-webpack-plugin": { @@ -28176,14 +28282,44 @@ } }, "htmlparser2": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-7.2.0.tgz", - "integrity": "sha512-H7MImA4MS6cw7nbyURtLPO1Tms7C5H602LRETv95z1MxO/7CP7rDVROehUYeYBUYEON94NXXDEPmZuq+hX4sog==", + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz", + "integrity": "sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==", "requires": { - "domelementtype": "^2.0.1", - "domhandler": "^4.2.2", - "domutils": "^2.8.0", - "entities": "^3.0.1" + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3", + "domutils": "^3.0.1", + "entities": "^4.4.0" + }, + "dependencies": { + "dom-serializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "requires": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + } + }, + "domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "requires": { + "domelementtype": "^2.3.0" + } + }, + "domutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", + "integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==", + "requires": { + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3" + } + } } }, "http-deceiver": { @@ -31003,6 +31139,7 @@ "version": "2.6.7", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dev": true, "requires": { "whatwg-url": "^5.0.0" }, @@ -31010,17 +31147,20 @@ "tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true }, "webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true }, "whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dev": true, "requires": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" @@ -33540,17 +33680,17 @@ "requires": {} }, "style-to-js": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.1.tgz", - "integrity": "sha512-RJ18Z9t2B02sYhZtfWKQq5uplVctgvjTfLWT7+Eb1zjUjIrWzX5SdlkwLGQozrqarTmEzJJ/YmdNJCUNI47elg==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.3.tgz", + "integrity": "sha512-zKI5gN/zb7LS/Vm0eUwjmjrXWw8IMtyA8aPBJZdYiQTXj4+wQ3IucOLIOnF7zCHxvW8UhIGh/uZh/t9zEHXNTQ==", "requires": { - "style-to-object": "0.3.0" + "style-to-object": "0.4.1" } }, "style-to-object": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-0.3.0.tgz", - "integrity": "sha512-CzFnRRXhzWIdItT3OmF8SQfWyahHhjq3HwcMNCNLn+N7klOOqPjMeG/4JSu77D7ypZdGvSzvkrbyeTMizz2VrA==", + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-0.4.1.tgz", + "integrity": "sha512-HFpbb5gr2ypci7Qw+IOhnP2zOU7e77b+rzM+wTzXzfi1PrtBCX0E7Pk4wL4iTLnhzZ+JgEGAhX81ebTg/aYjQw==", "requires": { "inline-style-parser": "0.1.1" } diff --git a/package.json b/package.json index 3672f3cf7..b9d95f091 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "@navikt/ds-icons": "3.4.3", "@navikt/ds-react": "^4.9.0", "@navikt/fnrvalidator": "^1.1.3", - "@navikt/nav-dekoratoren-moduler": "1.6.18", + "@navikt/nav-dekoratoren-moduler": "2.1.3", "@sentry/react": "^6.7.0", "@types/amplitude-js": "^8.9.0", "@types/classnames": "^2.2.7", diff --git a/server/mock/antallArbeidsforholdMock.js b/server/mock/antallArbeidsforholdMock.js new file mode 100644 index 000000000..f24512d94 --- /dev/null +++ b/server/mock/antallArbeidsforholdMock.js @@ -0,0 +1,9 @@ +export const mock = (app) => { + app.use('/min-side-arbeidsgiver/antall-arbeidsforhold', (req, res) => { + const antall = 502; + const missing = Math.floor(Math.random() * 10) === 0; + setTimeout(() => { + res.send({ first: '131488434', second: missing ? -1 : antall }); + }, 1000); + }); +}; diff --git "a/server/mock/sykefrav\303\246rMock.js" "b/server/mock/sykefrav\303\246rMock.js" index 6d91661be..d59213e0a 100644 --- "a/server/mock/sykefrav\303\246rMock.js" +++ "b/server/mock/sykefrav\303\246rMock.js" @@ -16,7 +16,7 @@ const bedriftEllerBransjeRespons = () => { export const mock = (app) => { app.use( - `/min-side-arbeidsgiver/sykefravaer/:orgnr/sykefravarshistorikk/legemeldtsykefravarsprosent`, + `/min-side-arbeidsgiver/api/sykefravaerstatistikk/:orgnr`, (req, res) => { res.send(bedriftEllerBransjeRespons()); }, diff --git a/server/server.js b/server/server.js index 6929e1f5b..961f59547 100644 --- a/server/server.js +++ b/server/server.js @@ -22,7 +22,6 @@ const { NAIS_CLUSTER_NAME = 'local', BACKEND_API_URL = 'http://localhost:8080', PROXY_LOG_LEVEL = 'info', - SYKEFRAVAER_DOMAIN = 'http://localhost:8080', MILJO = 'local', } = process.env; @@ -97,6 +96,7 @@ const main = async () => { (await import('./mock/altinnMeldingsboksMock.js')).mock(app); (await import('./mock/altinnBeOmTilgangMock.js')).mock(app); (await import('./mock/enhetsRegisteretMock.js')).mock(app); + (await import('./mock/antallArbeidsforholdMock.js')).mock(app); (await import('./mock/tiltakApiMock.js')).mock(app); (await import('./mock/sykefraværMock.js')).mock(app); (await import('./mock/refusjonsStatusMock.js')).mock(app); @@ -190,6 +190,28 @@ const main = async () => { }) ); + app.use( + '/min-side-arbeidsgiver/antall-arbeidsforhold', + tokenXMiddleware({ + log: log, + audience: { + dev: 'dev-fss:arbeidsforhold:aareg-innsyn-arbeidsgiver-api', + prod: 'prod-fss:arbeidsforhold:aareg-innsyn-arbeidsgiver-api', + }[MILJO], + }), + createProxyMiddleware({ + ...proxyOptions, + pathRewrite: { + '^/min-side-arbeidsgiver/antall-arbeidsforhold': + '/arbeidsgiver-arbeidsforhold-api/antall-arbeidsforhold', + }, + target: { + dev: 'https://aareg-innsyn-arbeidsgiver-api.dev-fss-pub.nais.io', + prod: 'https://aareg-innsyn-arbeidsgiver-api.prod-fss-pub.nais.io', + }[MILJO], + }) + ); + app.use( '/min-side-arbeidsgiver/api', tokenXMiddleware({ @@ -226,21 +248,6 @@ const main = async () => { }) ); - app.use( - '/min-side-arbeidsgiver/sykefravaer', - /* Ingen tokenx her fordi vi går mot deres frackend. - * Vi har på backlocken å skrive oss over til kafka-versjonen, - * så da blir vi kvitt dette unntaket. - */ - createProxyMiddleware({ - ...proxyOptions, - target: SYKEFRAVAER_DOMAIN, - pathRewrite: { - '^/min-side-arbeidsgiver/sykefravaer': '/sykefravarsstatistikk/api/', - }, - }) - ); - app.get('/min-side-arbeidsgiver/redirect-til-login', (req, res) => { const target = new URL(LOGIN_URL); target.searchParams.set('redirect', req.get('referer')); diff --git a/src/App/Hovedside/TjenesteBoksContainer/Arbeidsforholdboks/Arbeidsforholdboks.tsx b/src/App/Hovedside/TjenesteBoksContainer/Arbeidsforholdboks/Arbeidsforholdboks.tsx index 4fee5cb42..f81c0f01d 100644 --- a/src/App/Hovedside/TjenesteBoksContainer/Arbeidsforholdboks/Arbeidsforholdboks.tsx +++ b/src/App/Hovedside/TjenesteBoksContainer/Arbeidsforholdboks/Arbeidsforholdboks.tsx @@ -1,25 +1,48 @@ -import React from 'react'; -import {innsynAaregURL} from '../../../../lenker'; +import React, { useContext, useEffect, useState } from 'react'; +import { innsynAaregURL } from '../../../../lenker'; import arbeidsforholdikon from './arbeidsforholdikon.svg'; +import { hentAntallArbeidsforholdFraAareg } from '../../../../api/arbeidsforholdApi'; +import { OrganisasjonsDetaljerContext } from '../../../OrganisasjonDetaljerProvider'; import './ArbeidsforholdBoks.css'; -import {Tjenesteboks} from "../Tjenesteboks"; +import { Tjenesteboks } from '../Tjenesteboks'; const Arbeidsforholdboks = () => { + const { valgtOrganisasjon } = useContext(OrganisasjonsDetaljerContext); + const [antallArbeidsforhold, setAntallArbeidsforhold] = useState('–'); + useEffect(() => { + if (valgtOrganisasjon) + hentAntallArbeidsforholdFraAareg( + valgtOrganisasjon.organisasjon.OrganizationNumber, + valgtOrganisasjon.organisasjon.ParentOrganizationNumber ?? '' + ).then((antallArbeidsforholdRespons) => + setAntallArbeidsforhold( + antallArbeidsforholdRespons > 0 ? antallArbeidsforholdRespons.toString() : '–' + ) + ); + }, [valgtOrganisasjon]); const orgnummerFraUrl = new URLSearchParams(window.location.search).get('bedrift') ?? ''; const href = innsynAaregURL + (orgnummerFraUrl === '' ? '' : `?bedrift=${orgnummerFraUrl}`); - return -
- Arbeidsforhold (aktive og avsluttede) -
innrapportert til Arbeidsgiver- og arbeidstakerregisteret (Aa-registeret) + return ( + +
+ + {' '} + {antallArbeidsforhold} + arbeidsforhold (aktive og avsluttede){' '} + +
+ {' '} + innrapportert til Arbeidsgiver- og arbeidstakerregisteret (Aa-registeret) +
-
- ; + + ); }; export default Arbeidsforholdboks; diff --git "a/src/App/Hovedside/TjenesteBoksContainer/ForebyggeFrav\303\246rboks/ForebyggeFrav\303\246rboks.tsx" "b/src/App/Hovedside/TjenesteBoksContainer/ForebyggeFrav\303\246rboks/ForebyggeFrav\303\246rboks.tsx" index ae3ec11ef..a48757609 100644 --- "a/src/App/Hovedside/TjenesteBoksContainer/ForebyggeFrav\303\246rboks/ForebyggeFrav\303\246rboks.tsx" +++ "b/src/App/Hovedside/TjenesteBoksContainer/ForebyggeFrav\303\246rboks/ForebyggeFrav\303\246rboks.tsx" @@ -1,5 +1,5 @@ import {lenkeTilForebyggefravar} from '../../../../lenker'; -import React, { useContext, useEffect, useState } from 'react'; +import React, {useContext, useEffect, useState} from 'react'; import * as Sentry from "@sentry/browser"; import ForebyggeFraværIkon from './ForebyggeFraværIkon.svg'; import './ForebyggeFraværboks.css'; @@ -19,7 +19,7 @@ const ForebyggeFraværboks = () => { href={lenkeTilForebyggefravar + valgtbedrift()} tittel='Forebygge fravær' aria-label={beskrivelse} - > + > ; }; @@ -27,15 +27,14 @@ const ForebyggeFraværboks = () => { const beskrivelse = 'Verktøy for å forebygge fravær i din virksomhet.' const Beskrivelse = () => { - const { valgtOrganisasjon } = useContext(OrganisasjonsDetaljerContext); + const {valgtOrganisasjon} = useContext(OrganisasjonsDetaljerContext); const [sykefravær, setSykefravær] = useState(undefined); - const statistikktype = (type:string) => { + const statistikktype = (type: string) => { switch (type) { + case 'NÆRING': case 'BRANSJE': return 'bransje' - case 'NÆRING': - return 'næring' default : return 'bedrift' } diff --git a/src/api/arbeidsforholdApi.ts b/src/api/arbeidsforholdApi.ts new file mode 100644 index 000000000..dc8d162aa --- /dev/null +++ b/src/api/arbeidsforholdApi.ts @@ -0,0 +1,35 @@ +import { z } from 'zod'; +import * as Sentry from '@sentry/browser'; +import { Severity } from '@sentry/react'; + +const Oversikt = z.object({ + second: z.number().optional(), +}); + +export async function hentAntallArbeidsforholdFraAareg( + underenhet: string, + enhet: string +): Promise { + const respons = await fetch('/min-side-arbeidsgiver/antall-arbeidsforhold', { + headers: { + jurenhet: enhet, + orgnr: underenhet, + }, + }); + + if (!respons.ok) { + Sentry.captureMessage( + `hent antall arbeidsforhold fra aareg feilet med ${respons.status}`, + Severity.Warning + ); + return -1; + } + + try { + const { second = 0 } = Oversikt.parse(await respons.json()); + return second === 0 ? -1 : second; + } catch (error) { + Sentry.captureException(error); + return -1; + } +} diff --git "a/src/api/sykefrav\303\246rStatistikkApi.ts" "b/src/api/sykefrav\303\246rStatistikkApi.ts" index 62f9970d7..b16c78e2c 100644 --- "a/src/api/sykefrav\303\246rStatistikkApi.ts" +++ "b/src/api/sykefrav\303\246rStatistikkApi.ts" @@ -11,7 +11,7 @@ export type Sykefraværsrespons = z.infer | undefine export async function hentSykefravær( orgnr: string, ): Promise { - const url = `/min-side-arbeidsgiver/sykefravaer/${orgnr}/sykefravarshistorikk/legemeldtsykefravarsprosent`; + const url = `/min-side-arbeidsgiver/api/sykefravaerstatistikk/${orgnr}`; const respons = await fetch(url); if (respons.ok) { try { diff --git a/src/index.tsx b/src/index.tsx index 1836b6c30..41babad43 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,3 +1,4 @@ +import 'react-app-polyfill/ie11'; import 'core-js/stable'; import 'regenerator-runtime/runtime'; import React from 'react'; @@ -7,11 +8,11 @@ import * as Sentry from '@sentry/react'; import 'whatwg-fetch'; import 'abortcontroller-polyfill/dist/polyfill-patch-fetch'; import smoothscroll from 'smoothscroll-polyfill'; -import environment, {gittMiljo} from './utils/environment'; +import environment, { gittMiljo } from './utils/environment'; import '@navikt/ds-css'; import App from './App/App'; import * as SentryTypes from '@sentry/types'; -import {injectDecoratorClientSide} from '@navikt/nav-dekoratoren-moduler' +import { injectDecoratorClientSide } from '@navikt/nav-dekoratoren-moduler'; raf.polyfill(); smoothscroll.polyfill(); @@ -22,8 +23,8 @@ class SentryDebugTransport implements SentryTypes.Transport { } sendEvent(event: SentryTypes.Event): PromiseLike { - console.error("would have sent to sentry", event) - return Promise.resolve({status: "success"}); + console.error('would have sent to sentry', event); + return Promise.resolve({ status: 'success' }); } } @@ -36,49 +37,55 @@ Sentry.init({ prod: {}, other: { transport: SentryDebugTransport, - } + }, }), ignoreErrors: [ - "Error: Failed to fetch", - "TypeError: Failed to fetch", - "Error: NetworkError when attempting to fetch resource.", - "TypeError: NetworkError when attempting to fetch resource.", - "Error: Load failed", - "TypeError: Load failed", - "Error: cancelled", - "TypeError: cancelled", - "Error: avbrutt", - "TypeError: avbrutt", - "Error: cancelado", - "TypeError: cancelado", - "Error: anulowane", - "TypeError: anulowane", - "Error: avbruten", - "TypeError: avbruten", - "Error: anulat", - "TypeError: anulat", - "Error: The operation was aborted.", - "AbortError: The operation was aborted.", + 'Error: Failed to fetch', + 'TypeError: Failed to fetch', + 'Error: NetworkError when attempting to fetch resource.', + 'TypeError: NetworkError when attempting to fetch resource.', + 'Error: Load failed', + 'TypeError: Load failed', + 'Error: cancelled', + 'TypeError: cancelled', + 'Error: avbrutt', + 'TypeError: avbrutt', + 'Error: cancelado', + 'TypeError: cancelado', + 'Error: anulowane', + 'TypeError: anulowane', + 'Error: avbruten', + 'TypeError: avbruten', + 'Error: anulat', + 'TypeError: anulat', + 'Error: The operation was aborted.', + 'AbortError: The operation was aborted.', ], }); injectDecoratorClientSide({ env: gittMiljo({ - prod: "prod", - other: "dev", + prod: 'prod', + other: 'dev', }), - urlLookupTable: false, - context: 'arbeidsgiver', - redirectToApp: true, - level: 'Level4' + params: { + urlLookupTable: false, + context: 'arbeidsgiver', + redirectToApp: true, + level: 'Level4', + logoutWarning: true, + }, }).catch(Sentry.captureException); ReactDOM.render( gittMiljo({ - prod: , - other: + prod: , + other: ( + + {' '} + {' '} + + ), }), document.getElementById('root') ); - -