diff --git a/package-lock.json b/package-lock.json index 3a56259835a..b0027f9c7be 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,6 @@ "version": "2.5.4", "license": "MIT", "dependencies": { - "@date-io/date-fns": "^2.16.0", "@fontsource/inter": "^5.0.18", "@glennsl/bs-json": "^5.0.4", "@googlemaps/react-wrapper": "^1.1.35", @@ -19,7 +18,7 @@ "@pnotify/mobile": "^5.2.0", "@react-spring/web": "^9.7.3", "@rescript/react": "^0.11.0", - "@sentry/browser": "^7.114.0", + "@sentry/browser": "^8.12.0", "@yaireo/ui-range": "^2.1.15", "@yudiel/react-qr-scanner": "^2.0.0-beta.3", "axios": "^1.6.8", @@ -50,7 +49,7 @@ "react-i18next": "^13.0.1", "react-infinite-scroll-component": "^6.1.0", "react-markdown": "^8.0.7", - "react-pdf": "^7.7.1", + "react-pdf": "^9.0.0", "react-player": "^2.16.0", "react-redux": "^8.1.1", "react-transition-group": "^4.4.5", @@ -2309,27 +2308,6 @@ "ms": "^2.1.1" } }, - "node_modules/@date-io/core": { - "version": "2.17.0", - "resolved": "https://registry.npmjs.org/@date-io/core/-/core-2.17.0.tgz", - "integrity": "sha512-+EQE8xZhRM/hsY0CDTVyayMDDY5ihc4MqXCrPxooKw19yAzUIC6uUqsZeaOFNL9YKTNxYKrJP5DFgE8o5xRCOw==" - }, - "node_modules/@date-io/date-fns": { - "version": "2.17.0", - "resolved": "https://registry.npmjs.org/@date-io/date-fns/-/date-fns-2.17.0.tgz", - "integrity": "sha512-L0hWZ/mTpy3Gx/xXJ5tq5CzHo0L7ry6KEO9/w/JWiFWFLZgiNVo3ex92gOl3zmzjHqY/3Ev+5sehAr8UnGLEng==", - "dependencies": { - "@date-io/core": "^2.17.0" - }, - "peerDependencies": { - "date-fns": "^2.0.0" - }, - "peerDependenciesMeta": { - "date-fns": { - "optional": true - } - } - }, "node_modules/@dependents/detective-less": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/@dependents/detective-less/-/detective-less-4.1.0.tgz", @@ -3134,26 +3112,11 @@ "node-pre-gyp": "bin/node-pre-gyp" } }, - "node_modules/@mapbox/node-pre-gyp/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "optional": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/@mapbox/node-pre-gyp/node_modules/semver": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", - "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", "optional": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, "bin": { "semver": "bin/semver.js" }, @@ -3161,12 +3124,6 @@ "node": ">=10" } }, - "node_modules/@mapbox/node-pre-gyp/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "optional": true - }, "node_modules/@mdx-js/react": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/@mdx-js/react/-/react-3.0.1.tgz", @@ -4198,236 +4155,190 @@ "win32" ] }, - "node_modules/@sentry-internal/feedback": { - "version": "7.114.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-7.114.0.tgz", - "integrity": "sha512-kUiLRUDZuh10QE9JbSVVLgqxFoD9eDPOzT0MmzlPuas8JlTmJuV4FtSANNcqctd5mBuLt2ebNXH0MhRMwyae4A==", + "node_modules/@sentry-internal/browser-utils": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/browser-utils/-/browser-utils-8.12.0.tgz", + "integrity": "sha512-h7HRqED15Qa+DRt8iZGna24Z331nglgjPzdFn4+u+jvnZrehUjH0vjsfuj7qhwSUNZu8Rxi1ZlUYFURjLDTKCA==", "dependencies": { - "@sentry/core": "7.114.0", - "@sentry/types": "7.114.0", - "@sentry/utils": "7.114.0" + "@sentry/core": "8.12.0", + "@sentry/types": "8.12.0", + "@sentry/utils": "8.12.0" }, "engines": { - "node": ">=12" + "node": ">=14.18" } }, - "node_modules/@sentry-internal/feedback/node_modules/@sentry/core": { - "version": "7.114.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.114.0.tgz", - "integrity": "sha512-YnanVlmulkjgZiVZ9BfY9k6I082n+C+LbZo52MTvx3FY6RE5iyiPMpaOh67oXEZRWcYQEGm+bKruRxLVP6RlbA==", + "node_modules/@sentry-internal/browser-utils/node_modules/@sentry/core": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.12.0.tgz", + "integrity": "sha512-y+5Hlf/E45nj2adJy4aUCNBefQbyWIX66Z9bOM6JjnVB0hxCm5H0sYqrFKldYqaeZx6/Q2cgAcGs61krUxNerQ==", "dependencies": { - "@sentry/types": "7.114.0", - "@sentry/utils": "7.114.0" + "@sentry/types": "8.12.0", + "@sentry/utils": "8.12.0" }, "engines": { - "node": ">=8" - } - }, - "node_modules/@sentry-internal/feedback/node_modules/@sentry/types": { - "version": "7.114.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.114.0.tgz", - "integrity": "sha512-tsqkkyL3eJtptmPtT0m9W/bPLkU7ILY7nvwpi1hahA5jrM7ppoU0IMaQWAgTD+U3rzFH40IdXNBFb8Gnqcva4w==", - "engines": { - "node": ">=8" + "node": ">=14.18" } }, - "node_modules/@sentry-internal/feedback/node_modules/@sentry/utils": { - "version": "7.114.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.114.0.tgz", - "integrity": "sha512-319N90McVpupQ6vws4+tfCy/03AdtsU0MurIE4+W5cubHME08HtiEWlfacvAxX+yuKFhvdsO4K4BB/dj54ideg==", - "dependencies": { - "@sentry/types": "7.114.0" - }, + "node_modules/@sentry-internal/browser-utils/node_modules/@sentry/types": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-8.12.0.tgz", + "integrity": "sha512-pKuW64IjgcklWAOHzPJ02Ej480hyL25TLnYCAfl2TDMrYc+N0bbbH1N7ZxqJpTSVK9IxZPY/t2TRxpQBiyPEcg==", "engines": { - "node": ">=8" + "node": ">=14.18" } }, - "node_modules/@sentry-internal/replay-canvas": { - "version": "7.114.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-7.114.0.tgz", - "integrity": "sha512-6rTiqmKi/FYtesdM2TM2U+rh6BytdPjLP65KTUodtxohJ+r/3m+termj2o4BhIYPE1YYOZNmbZfwebkuQPmWeg==", + "node_modules/@sentry-internal/browser-utils/node_modules/@sentry/utils": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-8.12.0.tgz", + "integrity": "sha512-pwYMoOmexz3vsNSOJGPvD2qwp/fsPcr8mkFk67wMM37Y+30KQ8pF4Aq1cc+HBRIn1tKmenzFDPTczSdVPFxm3Q==", "dependencies": { - "@sentry/core": "7.114.0", - "@sentry/replay": "7.114.0", - "@sentry/types": "7.114.0", - "@sentry/utils": "7.114.0" + "@sentry/types": "8.12.0" }, "engines": { - "node": ">=12" + "node": ">=14.18" } }, - "node_modules/@sentry-internal/replay-canvas/node_modules/@sentry/core": { - "version": "7.114.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.114.0.tgz", - "integrity": "sha512-YnanVlmulkjgZiVZ9BfY9k6I082n+C+LbZo52MTvx3FY6RE5iyiPMpaOh67oXEZRWcYQEGm+bKruRxLVP6RlbA==", + "node_modules/@sentry-internal/feedback": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-8.12.0.tgz", + "integrity": "sha512-PvQ14wVOPmzRdYdmXD791CqERZZC4jZa5hnyBKBuF6ZpifIQ4Uk7spPu6ZO+Ympx3GtRlpYjk4dbjHyNSfYTwA==", "dependencies": { - "@sentry/types": "7.114.0", - "@sentry/utils": "7.114.0" + "@sentry/core": "8.12.0", + "@sentry/types": "8.12.0", + "@sentry/utils": "8.12.0" }, "engines": { - "node": ">=8" - } - }, - "node_modules/@sentry-internal/replay-canvas/node_modules/@sentry/types": { - "version": "7.114.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.114.0.tgz", - "integrity": "sha512-tsqkkyL3eJtptmPtT0m9W/bPLkU7ILY7nvwpi1hahA5jrM7ppoU0IMaQWAgTD+U3rzFH40IdXNBFb8Gnqcva4w==", - "engines": { - "node": ">=8" + "node": ">=14.18" } }, - "node_modules/@sentry-internal/replay-canvas/node_modules/@sentry/utils": { - "version": "7.114.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.114.0.tgz", - "integrity": "sha512-319N90McVpupQ6vws4+tfCy/03AdtsU0MurIE4+W5cubHME08HtiEWlfacvAxX+yuKFhvdsO4K4BB/dj54ideg==", + "node_modules/@sentry-internal/feedback/node_modules/@sentry/core": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.12.0.tgz", + "integrity": "sha512-y+5Hlf/E45nj2adJy4aUCNBefQbyWIX66Z9bOM6JjnVB0hxCm5H0sYqrFKldYqaeZx6/Q2cgAcGs61krUxNerQ==", "dependencies": { - "@sentry/types": "7.114.0" + "@sentry/types": "8.12.0", + "@sentry/utils": "8.12.0" }, "engines": { - "node": ">=8" + "node": ">=14.18" } }, - "node_modules/@sentry-internal/tracing": { - "version": "7.109.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.109.0.tgz", - "integrity": "sha512-PzK/joC5tCuh2R/PRh+7dp+uuZl7pTsBIjPhVZHMTtb9+ls65WkdZJ1/uKXPouyz8NOo9Xok7aEvEo9seongyw==", - "dev": true, - "dependencies": { - "@sentry/core": "7.109.0", - "@sentry/types": "7.109.0", - "@sentry/utils": "7.109.0" - }, + "node_modules/@sentry-internal/feedback/node_modules/@sentry/types": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-8.12.0.tgz", + "integrity": "sha512-pKuW64IjgcklWAOHzPJ02Ej480hyL25TLnYCAfl2TDMrYc+N0bbbH1N7ZxqJpTSVK9IxZPY/t2TRxpQBiyPEcg==", "engines": { - "node": ">=8" + "node": ">=14.18" } }, - "node_modules/@sentry/browser": { - "version": "7.114.0", - "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.114.0.tgz", - "integrity": "sha512-ijJ0vOEY6U9JJADVYGkUbLrAbpGSQgA4zV+KW3tcsBLX9M1jaWq4BV1PWHdzDPPDhy4OgfOjIfaMb5BSPn1U+g==", + "node_modules/@sentry-internal/feedback/node_modules/@sentry/utils": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-8.12.0.tgz", + "integrity": "sha512-pwYMoOmexz3vsNSOJGPvD2qwp/fsPcr8mkFk67wMM37Y+30KQ8pF4Aq1cc+HBRIn1tKmenzFDPTczSdVPFxm3Q==", "dependencies": { - "@sentry-internal/feedback": "7.114.0", - "@sentry-internal/replay-canvas": "7.114.0", - "@sentry-internal/tracing": "7.114.0", - "@sentry/core": "7.114.0", - "@sentry/integrations": "7.114.0", - "@sentry/replay": "7.114.0", - "@sentry/types": "7.114.0", - "@sentry/utils": "7.114.0" + "@sentry/types": "8.12.0" }, "engines": { - "node": ">=8" + "node": ">=14.18" } }, - "node_modules/@sentry/browser/node_modules/@sentry-internal/tracing": { - "version": "7.114.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.114.0.tgz", - "integrity": "sha512-dOuvfJN7G+3YqLlUY4HIjyWHaRP8vbOgF+OsE5w2l7ZEn1rMAaUbPntAR8AF9GBA6j2zWNoSo8e7GjbJxVofSg==", + "node_modules/@sentry-internal/replay": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay/-/replay-8.12.0.tgz", + "integrity": "sha512-TJceMtzRnY3SCvt3nFDu9rlT00Le7SaV2RL3D7SyDuijvJbWvIw3DRk7yutpF8c9YKO9j6FMa4NlkCJ+YAnnKQ==", "dependencies": { - "@sentry/core": "7.114.0", - "@sentry/types": "7.114.0", - "@sentry/utils": "7.114.0" + "@sentry-internal/browser-utils": "8.12.0", + "@sentry/core": "8.12.0", + "@sentry/types": "8.12.0", + "@sentry/utils": "8.12.0" }, "engines": { - "node": ">=8" + "node": ">=14.18" } }, - "node_modules/@sentry/browser/node_modules/@sentry/core": { - "version": "7.114.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.114.0.tgz", - "integrity": "sha512-YnanVlmulkjgZiVZ9BfY9k6I082n+C+LbZo52MTvx3FY6RE5iyiPMpaOh67oXEZRWcYQEGm+bKruRxLVP6RlbA==", + "node_modules/@sentry-internal/replay-canvas": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-8.12.0.tgz", + "integrity": "sha512-0slfHZ3TD3MKeBu5NEGuKuecxStX23gts5L3mGFJd/zwsd04A31fhVmo6agIkxnZbOU4GPX/7HPWIeevkvy3ig==", "dependencies": { - "@sentry/types": "7.114.0", - "@sentry/utils": "7.114.0" + "@sentry-internal/replay": "8.12.0", + "@sentry/core": "8.12.0", + "@sentry/types": "8.12.0", + "@sentry/utils": "8.12.0" }, "engines": { - "node": ">=8" + "node": ">=14.18" } }, - "node_modules/@sentry/browser/node_modules/@sentry/types": { - "version": "7.114.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.114.0.tgz", - "integrity": "sha512-tsqkkyL3eJtptmPtT0m9W/bPLkU7ILY7nvwpi1hahA5jrM7ppoU0IMaQWAgTD+U3rzFH40IdXNBFb8Gnqcva4w==", - "engines": { - "node": ">=8" - } - }, - "node_modules/@sentry/browser/node_modules/@sentry/utils": { - "version": "7.114.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.114.0.tgz", - "integrity": "sha512-319N90McVpupQ6vws4+tfCy/03AdtsU0MurIE4+W5cubHME08HtiEWlfacvAxX+yuKFhvdsO4K4BB/dj54ideg==", + "node_modules/@sentry-internal/replay-canvas/node_modules/@sentry/core": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.12.0.tgz", + "integrity": "sha512-y+5Hlf/E45nj2adJy4aUCNBefQbyWIX66Z9bOM6JjnVB0hxCm5H0sYqrFKldYqaeZx6/Q2cgAcGs61krUxNerQ==", "dependencies": { - "@sentry/types": "7.114.0" + "@sentry/types": "8.12.0", + "@sentry/utils": "8.12.0" }, "engines": { - "node": ">=8" + "node": ">=14.18" } }, - "node_modules/@sentry/core": { - "version": "7.109.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.109.0.tgz", - "integrity": "sha512-xwD4U0IlvvlE/x/g/W1I8b4Cfb16SsCMmiEuBf6XxvAa3OfWBxKoqLifb3GyrbxMC4LbIIZCN/SvLlnGJPgszA==", - "dev": true, - "dependencies": { - "@sentry/types": "7.109.0", - "@sentry/utils": "7.109.0" - }, + "node_modules/@sentry-internal/replay-canvas/node_modules/@sentry/types": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-8.12.0.tgz", + "integrity": "sha512-pKuW64IjgcklWAOHzPJ02Ej480hyL25TLnYCAfl2TDMrYc+N0bbbH1N7ZxqJpTSVK9IxZPY/t2TRxpQBiyPEcg==", "engines": { - "node": ">=8" + "node": ">=14.18" } }, - "node_modules/@sentry/integrations": { - "version": "7.114.0", - "resolved": "https://registry.npmjs.org/@sentry/integrations/-/integrations-7.114.0.tgz", - "integrity": "sha512-BJIBWXGKeIH0ifd7goxOS29fBA8BkEgVVCahs6xIOXBjX1IRS6PmX0zYx/GP23nQTfhJiubv2XPzoYOlZZmDxg==", + "node_modules/@sentry-internal/replay-canvas/node_modules/@sentry/utils": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-8.12.0.tgz", + "integrity": "sha512-pwYMoOmexz3vsNSOJGPvD2qwp/fsPcr8mkFk67wMM37Y+30KQ8pF4Aq1cc+HBRIn1tKmenzFDPTczSdVPFxm3Q==", "dependencies": { - "@sentry/core": "7.114.0", - "@sentry/types": "7.114.0", - "@sentry/utils": "7.114.0", - "localforage": "^1.8.1" + "@sentry/types": "8.12.0" }, "engines": { - "node": ">=8" + "node": ">=14.18" } }, - "node_modules/@sentry/integrations/node_modules/@sentry/core": { - "version": "7.114.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.114.0.tgz", - "integrity": "sha512-YnanVlmulkjgZiVZ9BfY9k6I082n+C+LbZo52MTvx3FY6RE5iyiPMpaOh67oXEZRWcYQEGm+bKruRxLVP6RlbA==", + "node_modules/@sentry-internal/replay/node_modules/@sentry/core": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.12.0.tgz", + "integrity": "sha512-y+5Hlf/E45nj2adJy4aUCNBefQbyWIX66Z9bOM6JjnVB0hxCm5H0sYqrFKldYqaeZx6/Q2cgAcGs61krUxNerQ==", "dependencies": { - "@sentry/types": "7.114.0", - "@sentry/utils": "7.114.0" + "@sentry/types": "8.12.0", + "@sentry/utils": "8.12.0" }, "engines": { - "node": ">=8" + "node": ">=14.18" } }, - "node_modules/@sentry/integrations/node_modules/@sentry/types": { - "version": "7.114.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.114.0.tgz", - "integrity": "sha512-tsqkkyL3eJtptmPtT0m9W/bPLkU7ILY7nvwpi1hahA5jrM7ppoU0IMaQWAgTD+U3rzFH40IdXNBFb8Gnqcva4w==", + "node_modules/@sentry-internal/replay/node_modules/@sentry/types": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-8.12.0.tgz", + "integrity": "sha512-pKuW64IjgcklWAOHzPJ02Ej480hyL25TLnYCAfl2TDMrYc+N0bbbH1N7ZxqJpTSVK9IxZPY/t2TRxpQBiyPEcg==", "engines": { - "node": ">=8" + "node": ">=14.18" } }, - "node_modules/@sentry/integrations/node_modules/@sentry/utils": { - "version": "7.114.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.114.0.tgz", - "integrity": "sha512-319N90McVpupQ6vws4+tfCy/03AdtsU0MurIE4+W5cubHME08HtiEWlfacvAxX+yuKFhvdsO4K4BB/dj54ideg==", + "node_modules/@sentry-internal/replay/node_modules/@sentry/utils": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-8.12.0.tgz", + "integrity": "sha512-pwYMoOmexz3vsNSOJGPvD2qwp/fsPcr8mkFk67wMM37Y+30KQ8pF4Aq1cc+HBRIn1tKmenzFDPTczSdVPFxm3Q==", "dependencies": { - "@sentry/types": "7.114.0" + "@sentry/types": "8.12.0" }, "engines": { - "node": ">=8" + "node": ">=14.18" } }, - "node_modules/@sentry/node": { + "node_modules/@sentry-internal/tracing": { "version": "7.109.0", - "resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.109.0.tgz", - "integrity": "sha512-tqMNAES4X/iBl1eZRCmc29p//0id01FBLEiesNo5nk6ECl6/SaGMFAEwu1gsn90h/Bjgr04slwFOS4cR45V2PQ==", + "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.109.0.tgz", + "integrity": "sha512-PzK/joC5tCuh2R/PRh+7dp+uuZl7pTsBIjPhVZHMTtb9+ls65WkdZJ1/uKXPouyz8NOo9Xok7aEvEo9seongyw==", "dev": true, "dependencies": { - "@sentry-internal/tracing": "7.109.0", "@sentry/core": "7.109.0", "@sentry/types": "7.109.0", "@sentry/utils": "7.109.0" @@ -4436,59 +4347,77 @@ "node": ">=8" } }, - "node_modules/@sentry/replay": { - "version": "7.114.0", - "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.114.0.tgz", - "integrity": "sha512-UvEajoLIX9n2poeW3R4Ybz7D0FgCGXoFr/x/33rdUEMIdTypknxjJWxg6fJngIduzwrlrvWpvP8QiZXczYQy2Q==", + "node_modules/@sentry/browser": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-8.12.0.tgz", + "integrity": "sha512-H82dmr7KQWoS2DQc5dJko5wNepltcEro1EM4mBeL2YmVbNRtoZzD3HQTpbxJJuFsTvEMZevvez5HFlpUgxmIwQ==", "dependencies": { - "@sentry-internal/tracing": "7.114.0", - "@sentry/core": "7.114.0", - "@sentry/types": "7.114.0", - "@sentry/utils": "7.114.0" + "@sentry-internal/browser-utils": "8.12.0", + "@sentry-internal/feedback": "8.12.0", + "@sentry-internal/replay": "8.12.0", + "@sentry-internal/replay-canvas": "8.12.0", + "@sentry/core": "8.12.0", + "@sentry/types": "8.12.0", + "@sentry/utils": "8.12.0" }, "engines": { - "node": ">=12" + "node": ">=14.18" } }, - "node_modules/@sentry/replay/node_modules/@sentry-internal/tracing": { - "version": "7.114.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.114.0.tgz", - "integrity": "sha512-dOuvfJN7G+3YqLlUY4HIjyWHaRP8vbOgF+OsE5w2l7ZEn1rMAaUbPntAR8AF9GBA6j2zWNoSo8e7GjbJxVofSg==", + "node_modules/@sentry/browser/node_modules/@sentry/core": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.12.0.tgz", + "integrity": "sha512-y+5Hlf/E45nj2adJy4aUCNBefQbyWIX66Z9bOM6JjnVB0hxCm5H0sYqrFKldYqaeZx6/Q2cgAcGs61krUxNerQ==", "dependencies": { - "@sentry/core": "7.114.0", - "@sentry/types": "7.114.0", - "@sentry/utils": "7.114.0" + "@sentry/types": "8.12.0", + "@sentry/utils": "8.12.0" }, "engines": { - "node": ">=8" + "node": ">=14.18" + } + }, + "node_modules/@sentry/browser/node_modules/@sentry/types": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-8.12.0.tgz", + "integrity": "sha512-pKuW64IjgcklWAOHzPJ02Ej480hyL25TLnYCAfl2TDMrYc+N0bbbH1N7ZxqJpTSVK9IxZPY/t2TRxpQBiyPEcg==", + "engines": { + "node": ">=14.18" } }, - "node_modules/@sentry/replay/node_modules/@sentry/core": { - "version": "7.114.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.114.0.tgz", - "integrity": "sha512-YnanVlmulkjgZiVZ9BfY9k6I082n+C+LbZo52MTvx3FY6RE5iyiPMpaOh67oXEZRWcYQEGm+bKruRxLVP6RlbA==", + "node_modules/@sentry/browser/node_modules/@sentry/utils": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-8.12.0.tgz", + "integrity": "sha512-pwYMoOmexz3vsNSOJGPvD2qwp/fsPcr8mkFk67wMM37Y+30KQ8pF4Aq1cc+HBRIn1tKmenzFDPTczSdVPFxm3Q==", "dependencies": { - "@sentry/types": "7.114.0", - "@sentry/utils": "7.114.0" + "@sentry/types": "8.12.0" }, "engines": { - "node": ">=8" + "node": ">=14.18" } }, - "node_modules/@sentry/replay/node_modules/@sentry/types": { - "version": "7.114.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.114.0.tgz", - "integrity": "sha512-tsqkkyL3eJtptmPtT0m9W/bPLkU7ILY7nvwpi1hahA5jrM7ppoU0IMaQWAgTD+U3rzFH40IdXNBFb8Gnqcva4w==", + "node_modules/@sentry/core": { + "version": "7.109.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.109.0.tgz", + "integrity": "sha512-xwD4U0IlvvlE/x/g/W1I8b4Cfb16SsCMmiEuBf6XxvAa3OfWBxKoqLifb3GyrbxMC4LbIIZCN/SvLlnGJPgszA==", + "dev": true, + "dependencies": { + "@sentry/types": "7.109.0", + "@sentry/utils": "7.109.0" + }, "engines": { "node": ">=8" } }, - "node_modules/@sentry/replay/node_modules/@sentry/utils": { - "version": "7.114.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.114.0.tgz", - "integrity": "sha512-319N90McVpupQ6vws4+tfCy/03AdtsU0MurIE4+W5cubHME08HtiEWlfacvAxX+yuKFhvdsO4K4BB/dj54ideg==", + "node_modules/@sentry/node": { + "version": "7.109.0", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.109.0.tgz", + "integrity": "sha512-tqMNAES4X/iBl1eZRCmc29p//0id01FBLEiesNo5nk6ECl6/SaGMFAEwu1gsn90h/Bjgr04slwFOS4cR45V2PQ==", + "dev": true, "dependencies": { - "@sentry/types": "7.114.0" + "@sentry-internal/tracing": "7.109.0", + "@sentry/core": "7.109.0", + "@sentry/types": "7.109.0", + "@sentry/utils": "7.109.0" }, "engines": { "node": ">=8" @@ -7660,6 +7589,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz", "integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==", + "deprecated": "This package is no longer supported.", "optional": true, "dependencies": { "delegates": "^1.0.0", @@ -13653,6 +13583,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz", "integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==", + "deprecated": "This package is no longer supported.", "optional": true, "dependencies": { "aproba": "^1.0.3 || ^2.0.0", @@ -14660,11 +14591,6 @@ "node": ">= 4" } }, - "node_modules/immediate": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", - "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==" - }, "node_modules/import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -15830,14 +15756,6 @@ "node": ">= 0.8.0" } }, - "node_modules/lie": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz", - "integrity": "sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==", - "dependencies": { - "immediate": "~3.0.5" - } - }, "node_modules/lilconfig": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", @@ -16329,14 +16247,6 @@ "debug": "4.3.4" } }, - "node_modules/localforage": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz", - "integrity": "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==", - "dependencies": { - "lie": "3.1.1" - } - }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -17469,14 +17379,14 @@ "dev": true }, "node_modules/merge-refs": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/merge-refs/-/merge-refs-1.2.2.tgz", - "integrity": "sha512-RwcT7GsQR3KbuLw1rRuodq4Nt547BKEBkliZ0qqsrpyNne9bGTFtsFIsIpx82huWhcl3kOlOlH4H0xkPk/DqVw==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/merge-refs/-/merge-refs-1.3.0.tgz", + "integrity": "sha512-nqXPXbso+1dcKDpPCXvwZyJILz+vSLqGGOnDrYHQYE+B8n9JTCekVLC65AfCpR4ggVyA/45Y0iR9LDyS2iI+zA==", "funding": { "url": "https://github.com/wojtekmaj/merge-refs?sponsor=1" }, "peerDependencies": { - "@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0" + "@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" }, "peerDependenciesMeta": { "@types/react": { @@ -18574,6 +18484,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz", "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==", + "deprecated": "This package is no longer supported.", "optional": true, "dependencies": { "are-we-there-yet": "^2.0.0", @@ -19182,26 +19093,14 @@ } }, "node_modules/path2d": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/path2d/-/path2d-0.1.1.tgz", - "integrity": "sha512-/+S03c8AGsDYKKBtRDqieTJv2GlkMb0bWjnqOgtF6MkjdUQ9a8ARAtxWf9NgKLGm2+WQr6+/tqJdU8HNGsIDoA==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/path2d/-/path2d-0.2.0.tgz", + "integrity": "sha512-KdPAykQX6kmLSOO6Jpu2KNcCED7CKjmaBNGGNuctOsG0hgYO1OdYQaan6cYXJiG0WmXOwZZPILPBimu5QAIw3A==", "optional": true, "engines": { "node": ">=6" } }, - "node_modules/path2d-polyfill": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/path2d-polyfill/-/path2d-polyfill-2.1.1.tgz", - "integrity": "sha512-4Rka5lN+rY/p0CdD8+E+BFv51lFaFvJOrlOhyQ+zjzyQrzyh3ozmxd1vVGGDdIbUFSBtIZLSnspxTgPT0iJhvA==", - "optional": true, - "dependencies": { - "path2d": "0.1.1" - }, - "engines": { - "node": ">=18" - } - }, "node_modules/pathe": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", @@ -19228,15 +19127,15 @@ } }, "node_modules/pdfjs-dist": { - "version": "3.11.174", - "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-3.11.174.tgz", - "integrity": "sha512-TdTZPf1trZ8/UFu5Cx/GXB7GZM30LT+wWUNfsi6Bq8ePLnb+woNKtDymI2mxZYBpMbonNFqKmiz684DIfnd8dA==", + "version": "4.3.136", + "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-4.3.136.tgz", + "integrity": "sha512-gzfnt1qc4yA+U46golPGYtU4WM2ssqP2MvFjKga8GEKOrEnzRPrA/9jogLLPYHiA3sGBPJ+p7BdAq+ytmw3jEg==", "engines": { "node": ">=18" }, "optionalDependencies": { "canvas": "^2.11.2", - "path2d-polyfill": "^2.0.1" + "path2d": "^0.2.0" } }, "node_modules/peek-stream": { @@ -20839,17 +20738,16 @@ } }, "node_modules/react-pdf": { - "version": "7.7.3", - "resolved": "https://registry.npmjs.org/react-pdf/-/react-pdf-7.7.3.tgz", - "integrity": "sha512-a2VfDl8hiGjugpqezBTUzJHYLNB7IS7a2t7GD52xMI9xHg8LdVaTMsnM9ZlNmKadnStT/tvX5IfV0yLn+JvYmw==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/react-pdf/-/react-pdf-9.0.0.tgz", + "integrity": "sha512-J+pza8R2p9oNEOJOHIQJI4o5rFK7ji7bBl2IvsHvz1OOyphvuzVDo5tOJwWAFAbxYauCH3Kt8jOvcMJUOpxYZQ==", "dependencies": { "clsx": "^2.0.0", "dequal": "^2.0.3", "make-cancellable-promise": "^1.3.1", "make-event-props": "^1.6.0", - "merge-refs": "^1.2.1", - "pdfjs-dist": "3.11.174", - "prop-types": "^15.6.2", + "merge-refs": "^1.3.0", + "pdfjs-dist": "4.3.136", "tiny-invariant": "^1.0.0", "warning": "^4.0.0" }, @@ -20857,9 +20755,9 @@ "url": "https://github.com/wojtekmaj/react-pdf?sponsor=1" }, "peerDependencies": { - "@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0", - "react": "^16.8.0 || ^17.0.0 || ^18.0.0", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" + "@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" }, "peerDependenciesMeta": { "@types/react": { diff --git a/package.json b/package.json index 8981eca79c7..e23c97fd517 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,6 @@ "build-storybook": "storybook build" }, "dependencies": { - "@date-io/date-fns": "^2.16.0", "@fontsource/inter": "^5.0.18", "@glennsl/bs-json": "^5.0.4", "@googlemaps/react-wrapper": "^1.1.35", @@ -59,7 +58,7 @@ "@pnotify/mobile": "^5.2.0", "@react-spring/web": "^9.7.3", "@rescript/react": "^0.11.0", - "@sentry/browser": "^7.114.0", + "@sentry/browser": "^8.12.0", "@yaireo/ui-range": "^2.1.15", "@yudiel/react-qr-scanner": "^2.0.0-beta.3", "axios": "^1.6.8", @@ -72,8 +71,8 @@ "echarts-for-react": "^3.0.2", "eslint-mdx": "^3.1.5", "events": "^3.3.0", - "hi-profiles": "^1.0.6", "glob": "^10.3.15", + "hi-profiles": "^1.0.6", "i18next": "^23.11.4", "i18next-browser-languagedetector": "^7.2.1", "lodash-es": "^4.17.21", @@ -90,7 +89,7 @@ "react-i18next": "^13.0.1", "react-infinite-scroll-component": "^6.1.0", "react-markdown": "^8.0.7", - "react-pdf": "^7.7.1", + "react-pdf": "^9.0.0", "react-player": "^2.16.0", "react-redux": "^8.1.1", "react-transition-group": "^4.4.5", diff --git a/src/Components/Common/FacilitySelect.tsx b/src/Components/Common/FacilitySelect.tsx index ac098cc2127..2b820b40d6a 100644 --- a/src/Components/Common/FacilitySelect.tsx +++ b/src/Components/Common/FacilitySelect.tsx @@ -9,7 +9,9 @@ interface FacilitySelectProps { exclude_user?: string; errors?: string | undefined; className?: string; + required?: boolean; searchAll?: boolean; + disabled?: boolean; multiple?: boolean; facilityType?: number; district?: string; @@ -25,10 +27,12 @@ export const FacilitySelect = (props: FacilitySelectProps) => { const { name, exclude_user, + required, multiple, selected, setSelected, searchAll, + disabled = false, showAll = true, showNOptions = 10, className = "", @@ -69,8 +73,10 @@ export const FacilitySelect = (props: FacilitySelectProps) => { return ( { ? "Save current position to selected preset" : "Change camera position to update preset" } - tooltipClassName="translate-y-8 text-xs" + tooltipClassName="translate-x-3 translate-y-8 text-xs" onClick={() => setShowPresetSaveConfirmation(true)} > void; consultationData: ConsultationModel; + referred_to?: FacilityModel | null; afterSubmit?: () => void; new_discharge_reason?: number | null; - discharge_notes?: string; discharge_date?: string; death_datetime?: string; } @@ -53,7 +53,7 @@ const DischargeModal = ({ consultationData, afterSubmit, new_discharge_reason = null, - discharge_notes = "", + referred_to = null, discharge_date = dayjs().format("YYYY-MM-DDTHH:mm"), death_datetime = dayjs().format("YYYY-MM-DDTHH:mm"), }: IProps) => { @@ -62,18 +62,40 @@ const DischargeModal = ({ const [preDischargeForm, setPreDischargeForm] = useState({ new_discharge_reason, - discharge_notes, + discharge_notes: referred_to + ? "Patient Shifted to another facility." + : "", discharge_date, death_datetime, death_confirmed_doctor: undefined, - referred_to_external: null, + referred_to_external: !referred_to?.id ? referred_to?.name : null, + referred_to: referred_to?.id ? referred_to.id : null, }); const [latestClaim, setLatestClaim] = useState(); const [isCreateClaimLoading, setIsCreateClaimLoading] = useState(false); const [isSendingDischargeApi, setIsSendingDischargeApi] = useState(false); - const [facility, setFacility] = useState(); + const [facility, setFacility] = useState(referred_to); const [errors, setErrors] = useState({}); + useEffect(() => { + setPreDischargeForm((prev) => ({ + ...prev, + new_discharge_reason, + discharge_notes: referred_to + ? "Patient Shifted to another facility." + : "", + discharge_date, + death_datetime, + referred_to_external: !referred_to?.id ? referred_to?.name : null, + referred_to: referred_to?.id ? referred_to.id : null, + })); + + setFacility(referred_to); + }, [referred_to, new_discharge_reason, discharge_date, death_datetime]); + + const discharge_reason = + new_discharge_reason ?? preDischargeForm.new_discharge_reason; + const fetchLatestClaim = useCallback(async () => { const res = await dispatch( HCXActions.claims.list({ @@ -111,7 +133,7 @@ const DischargeModal = ({ const handlePatientDischarge = async (value: boolean) => { setIsSendingDischargeApi(true); - if (!preDischargeForm.new_discharge_reason) { + if (!new_discharge_reason && !discharge_reason) { setErrors({ ...errors, new_discharge_reason: "Please select a reason for discharge", @@ -121,8 +143,7 @@ const DischargeModal = ({ } if ( - preDischargeForm.new_discharge_reason == - DISCHARGE_REASONS.find((i) => i.text == "Expired")?.id + discharge_reason == DISCHARGE_REASONS.find((i) => i.text == "Expired")?.id ) { const newErrors: Record = {}; @@ -143,6 +164,7 @@ const DischargeModal = ({ const dischargeDetails = { ...preDischargeForm, discharge: value, + referred_to: referred_to?.id ?? preDischargeForm.referred_to, discharge_date: dayjs(preDischargeForm.discharge_date).toISOString(), }; @@ -157,6 +179,7 @@ const DischargeModal = ({ { ...preDischargeForm, discharge: value, + new_discharge_reason: discharge_reason, discharge_date: dayjs(preDischargeForm.discharge_date).toISOString(), }, { id: consultationData.id }, @@ -174,7 +197,7 @@ const DischargeModal = ({ }; const handleFacilitySelect = (selected?: FacilityModel) => { - setFacility(selected); + setFacility(selected ?? null); setPreDischargeForm((prev) => ({ ...prev, referred_to: selected?.id ?? null, @@ -203,7 +226,7 @@ const DischargeModal = ({ label="Reason" name="discharge_reason" id="discharge_reason" - value={preDischargeForm.new_discharge_reason} + value={discharge_reason} disabled={!!new_discharge_reason} options={DISCHARGE_REASONS} optionValue={({ id }) => id} @@ -216,36 +239,35 @@ const DischargeModal = ({ } error={errors?.new_discharge_reason} /> - {preDischargeForm.new_discharge_reason === + {discharge_reason === DISCHARGE_REASONS.find((i) => i.text == "Referred")?.id && ( - <> -
- Referred to - - handleFacilitySelect(selected as FacilityModel | undefined) - } - selected={facility ?? null} - showAll - freeText - multiple={false} - errors={errors?.referred_to} - className="mb-4" - /> -
- +
+ Referred to + + handleFacilitySelect(selected as FacilityModel | undefined) + } + disabled={!!referred_to} + selected={facility ?? null} + showAll + freeText + multiple={false} + errors={errors?.referred_to} + className="mb-4" + /> +
)} i.text == "Expired")?.id } label={ { "3": "Cause of death", "1": "Discharged Advice", - }[preDischargeForm.new_discharge_reason ?? 0] ?? "Notes" + }[discharge_reason ?? 0] ?? "Notes" } name="discharge_notes" value={preDischargeForm.discharge_notes} @@ -259,13 +281,13 @@ const DischargeModal = ({ /> i.text == "Expired")?.id ? "death_datetime" : "discharge_date" } label={ - preDischargeForm.new_discharge_reason === + discharge_reason === DISCHARGE_REASONS.find((i) => i.text == "Expired")?.id ? "Date of Death" : "Date and Time of Discharge" @@ -273,7 +295,7 @@ const DischargeModal = ({ type="datetime-local" value={ preDischargeForm[ - preDischargeForm.new_discharge_reason === + discharge_reason === DISCHARGE_REASONS.find((i) => i.text == "Expired")?.id ? "death_datetime" : "discharge_date" @@ -293,14 +315,14 @@ const DischargeModal = ({ )} max={dayjs().format("YYYY-MM-DDTHH:mm")} error={ - preDischargeForm.new_discharge_reason === + discharge_reason === DISCHARGE_REASONS.find((i) => i.text == "Expired")?.id ? errors?.death_datetime : errors?.discharge_date } /> - {preDischargeForm.new_discharge_reason === + {discharge_reason === DISCHARGE_REASONS.find((i) => i.text == "Recovered")?.id && ( <>
@@ -313,7 +335,7 @@ const DischargeModal = ({
)} - {preDischargeForm.new_discharge_reason === + {discharge_reason === DISCHARGE_REASONS.find((i) => i.text == "Expired")?.id && ( { { )} {error && ( -
{error}
+
+ {error} +
)} diff --git a/src/Components/Scribe/Scribe.tsx b/src/Components/Scribe/Scribe.tsx index b5149267e24..e29b825124f 100644 --- a/src/Components/Scribe/Scribe.tsx +++ b/src/Components/Scribe/Scribe.tsx @@ -490,7 +490,7 @@ export const Scribe: React.FC = ({ fields, onFormUpdate }) => { ​ -
+

Voice AutoFill diff --git a/src/Components/Shifting/ShiftDetailsUpdate.tsx b/src/Components/Shifting/ShiftDetailsUpdate.tsx index d327e402889..35e77066ef4 100644 --- a/src/Components/Shifting/ShiftDetailsUpdate.tsx +++ b/src/Components/Shifting/ShiftDetailsUpdate.tsx @@ -8,6 +8,7 @@ import { SHIFTING_CHOICES_PEACETIME, SHIFTING_CHOICES_WARTIME, SHIFTING_VEHICLE_CHOICES, + USER_TYPES, } from "../../Common/constants"; import { Cancel, Submit } from "../Common/components/ButtonV2"; @@ -39,6 +40,7 @@ import routes from "../../Redux/api.js"; import { IShift } from "./models.js"; import request from "../../Utils/request/request.js"; import { PatientModel } from "../Patient/models.js"; +import useAuthUser from "../../Common/hooks/useAuthUser.js"; const Loading = lazy(() => import("../Common/Loading")); @@ -48,6 +50,7 @@ interface patientShiftProps { export const ShiftDetailsUpdate = (props: patientShiftProps) => { const { goBack } = useAppHistory(); + const { user_type, home_facility } = useAuthUser(); const { kasp_full_string, kasp_enabled, wartime_shifting } = useConfig(); @@ -60,6 +63,7 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => { {} as ConsultationModel, ); const [showDischargeModal, setShowDischargeModal] = useState(false); + const [dischargeReason, setDischargeReason] = useState(); const { t } = useTranslation(); const initForm: any = { @@ -91,27 +95,6 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => { errors: { ...initError }, }; - let requiredFields: any = { - reason: { - errorText: t("please_enter_a_reason_for_the_shift"), - }, - }; - - if (wartime_shifting) { - requiredFields = { - ...requiredFields, - shifting_approving_facility_object: { - errorText: t("shifting_approving_facility_can_not_be_empty"), - }, - assigned_facility_type: { - errorText: t("please_select_facility_type"), - }, - preferred_vehicle_choice: { - errorText: t("please_select_preferred_vehicle_type"), - }, - }; - } - const shiftFormReducer = (state = initialState, action: any) => { switch (action.type) { case "set_form": { @@ -133,6 +116,45 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => { const [state, dispatch] = useReducer(shiftFormReducer, initialState); + let requiredFields: any = { + assigned_facility_object: { + condition: [ + "DESTINATION APPROVED", + "PATIENT TO BE PICKED UP", + "TRANSFER IN PROGRESS", + "COMPLETED", + ].includes(state.form.status), + errorText: t("please_select_a_facility"), + }, + status: { + errorText: t("please_select_status"), + }, + patient_category: { + errorText: t("please_select_patient_category"), + }, + reason: { + errorText: t("please_enter_a_reason_for_the_shift"), + }, + }; + + if (wartime_shifting) { + requiredFields = { + ...requiredFields, + shifting_approving_facility_object: { + errorText: t("shifting_approving_facility_can_not_be_empty"), + }, + assigned_facility_type: { + errorText: t("please_select_facility_type"), + }, + preferred_vehicle_choice: { + errorText: t("please_select_preferred_vehicle_type"), + }, + breathlessness_level: { + errorText: t("please_select_breathlessness_level"), + }, + }; + } + const { loading: assignedUserLoading } = useQuery(routes.userList, { query: { id: state.form.assigned_to }, prefetch: state.form.assigned_to ? true : false, @@ -145,9 +167,16 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => { const errors = { ...initError }; let isInvalidForm = false; Object.keys(requiredFields).forEach((field) => { - if (!state.form[field] || !/\S+/.test(state.form[field])) { + if ( + (!state.form[field] || !/\S+/.test(state.form[field])) && + ("condition" in requiredFields[field] + ? requiredFields[field].condition + : true) + ) { errors[field] = requiredFields[field].errorText; isInvalidForm = true; + } else { + errors[field] = ""; } }); @@ -188,6 +217,16 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => { if (validForm) { if (!discharged && state.form.status === "PATIENT EXPIRED") { + setDischargeReason( + DISCHARGE_REASONS.find((i) => i.text == "Expired")?.id, + ); + setShowDischargeModal(true); + return; + } + if (!discharged && state.form.status === "COMPLETED") { + setDischargeReason( + DISCHARGE_REASONS.find((i) => i.text == "Referred")?.id, + ); setShowDischargeModal(true); return; } @@ -282,9 +321,8 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => { show={showDischargeModal} onClose={() => setShowDischargeModal(false)} consultationData={consultationData} - new_discharge_reason={ - DISCHARGE_REASONS.find((i) => i.text == "Expired")?.id - } + referred_to={state.form.assigned_facility_object} + new_discharge_reason={dischargeReason} afterSubmit={() => { handleSubmit(true); }} @@ -303,6 +341,13 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => { value={state.form.status} optionLabel={(option) => option.text} optionValue={(option) => option.text} + optionDisabled={(option) => + // disable all options except `Destination Approved` for non-admin destination facility users + home_facility === state.form.assigned_facility_object?.id && + USER_TYPES.findIndex((type) => user_type === type) < + USER_TYPES.findIndex((type) => type === "DistrictAdmin") && + !["DESTINATION APPROVED"].includes(option.text) + } optionSelectedLabel={(option) => option.text} onChange={handleFormFieldChange} className="w-full bg-white md:col-span-1 md:leading-5" @@ -341,16 +386,31 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => { )}
- {t("what_facility_assign_the_patient_to")} + + {t("what_facility_assign_the_patient_to")} + setFacility(obj, "assigned_facility_object") } - errors={state.errors.assigned_facility} + errors={state.errors.assigned_facility_object} />
@@ -402,6 +462,7 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => { onChange={handleFormFieldChange} label="Patient Category" className="md:col-span-2" + error={state.errors.patient_category} /> {wartime_shifting && ( diff --git a/src/Locale/en/Shifting.json b/src/Locale/en/Shifting.json index 0fc177281d5..e1bc1916d89 100644 --- a/src/Locale/en/Shifting.json +++ b/src/Locale/en/Shifting.json @@ -76,6 +76,10 @@ "please_enter_a_reason_for_the_shift": "Please enter a reason for the shift.", "please_select_preferred_vehicle_type": "Please select Preferred Vehicle Type", "please_select_facility_type": "Please select Facility Type", + "please_select_breathlessness_level": "Please select Breathlessness Level", + "please_select_a_facility": "Please select a facility", + "please_select_status": "Please select Status", + "please_select_patient_category": "Please select Patient Category", "shifting_approving_facility_can_not_be_empty": "Shifting approving facility can not be empty.", "redirected_to_create_consultation": "Note: You will be redirected to create consultation form. Please complete the form to finish the transfer process", "mark_this_transfer_as_complete_question": "Are you sure you want to mark this transfer as complete? The Origin facility will no longer have access to this patient",