@pih/esm-referrals-queue-app 1.0.5 → 2.0.0-pre.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +2 -1
- package/.eslintignore +2 -1
- package/.eslintrc +1 -2
- package/.github/workflows/node.js.yml +17 -17
- package/.husky/pre-commit +7 -0
- package/.prettierignore +13 -3
- package/README.md +14 -3
- package/__mocks__/react-i18next.js +51 -0
- package/dist/132.js +1 -0
- package/dist/147.js +2 -0
- package/dist/147.js.LICENSE.txt +47 -0
- package/dist/281.js +1 -0
- package/dist/294.js +2 -0
- package/dist/294.js.LICENSE.txt +9 -0
- package/dist/574.js +1 -0
- package/dist/595.js +2 -0
- package/dist/595.js.LICENSE.txt +1 -0
- package/dist/879.js +2 -0
- package/dist/879.js.LICENSE.txt +21 -0
- package/dist/90.js +1 -0
- package/dist/main.js +1 -0
- package/dist/pih-esm-referrals-queue-app.js +1 -2
- package/dist/pih-esm-referrals-queue-app.js.buildmanifest.json +265 -0
- package/dist/pih-esm-referrals-queue-app.old +1 -0
- package/jest.config.json +19 -0
- package/package.json +68 -78
- package/src/config-schema.ts +63 -0
- package/src/constants.ts +3 -0
- package/src/declarations.d.tsx +1 -2
- package/src/index.ts +57 -53
- package/src/referrals-queue/referrals-queue.component.tsx +22 -17
- package/src/referrals-queue/{referrals-queue.resource.ts → referrals-queue.resource.tsx} +1 -1
- package/src/referrals-queue/referrals-queue.test.tsx +12 -11
- package/src/root.component.test.tsx +1 -1
- package/src/root.component.tsx +8 -5
- package/src/setup-tests.ts +24 -0
- package/src/table/table.component.tsx +5 -4
- package/src/util.ts +1 -3
- package/translations/en.json +2 -11
- package/tsconfig.json +3 -2
- package/webpack.config.js +1 -71
- package/.babelrc +0 -10
- package/.gitattributes +0 -1
- package/.tx/config +0 -10
- package/.vscode/launch.json +0 -35
- package/__mocks__/openmrs-esm-framework.mock.tsx +0 -64
- package/design-mockup.png +0 -0
- package/dist/1.pih-esm-referrals-queue-app.js +0 -297
- package/dist/1.pih-esm-referrals-queue-app.js.map +0 -1
- package/dist/2.pih-esm-referrals-queue-app.js +0 -2
- package/dist/2.pih-esm-referrals-queue-app.js.map +0 -1
- package/dist/3.pih-esm-referrals-queue-app.js +0 -2
- package/dist/3.pih-esm-referrals-queue-app.js.map +0 -1
- package/dist/4.pih-esm-referrals-queue-app.js +0 -2
- package/dist/4.pih-esm-referrals-queue-app.js.map +0 -1
- package/dist/5.pih-esm-referrals-queue-app.js +0 -2
- package/dist/5.pih-esm-referrals-queue-app.js.map +0 -1
- package/dist/pih-esm-referrals-queue-app.js.map +0 -1
- package/jest.config.js +0 -11
- package/src/set-public-path.ts +0 -3
- package/src/setup-tests.js +0 -13
- package/translations/es.json +0 -13
- package/translations/fr.json +0 -13
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "@testing-library/jest-dom/extend-expect";
|
|
2
|
+
|
|
3
|
+
jest.mock("@openmrs/esm-framework", () => {
|
|
4
|
+
const originalModule = jest.requireActual("@openmrs/esm-framework");
|
|
5
|
+
|
|
6
|
+
return {
|
|
7
|
+
...originalModule,
|
|
8
|
+
useConfig: jest.fn(() => {
|
|
9
|
+
return {
|
|
10
|
+
links: {
|
|
11
|
+
patientDash:
|
|
12
|
+
"${openmrsBase}/coreapps/clinicianfacing/patient.page?patientId=${patientUuid}&app=pih.app.clinicianDashboard",
|
|
13
|
+
visitPage:
|
|
14
|
+
"${openmrsBase}/pihcore/visit/visit.page?patient=${patientUuid}&visit=${visitUuid}&suppressActions=true#/overview",
|
|
15
|
+
homeVisitForm:
|
|
16
|
+
"${openmrsBase}/htmlformentryui/htmlform/editHtmlFormWithStandardUi.page?patientId=${patientUuid}&visitId=${visitUuid}&encounterId=${encounterUuid}&definitionUiResource=file:configuration/pih/htmlforms/section-mch-referral.xml&returnUrl=/mirebalais/spa/referrals-queue",
|
|
17
|
+
},
|
|
18
|
+
pendingStatuses: ["Pending status", "Referral unmet"],
|
|
19
|
+
};
|
|
20
|
+
}),
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
window.getOpenmrsSpaBase = () => "openmrs/spa";
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
ConfigurableLink,
|
|
4
4
|
interpolateString,
|
|
5
|
-
useConfig
|
|
5
|
+
useConfig,
|
|
6
6
|
} from "@openmrs/esm-framework";
|
|
7
7
|
import { Trans } from "react-i18next";
|
|
8
8
|
import styles from "./table.css";
|
|
@@ -47,7 +47,8 @@ export default function Table(props: TableProps) {
|
|
|
47
47
|
<td>
|
|
48
48
|
<ConfigurableLink
|
|
49
49
|
to={interpolateString(config.links.patientDash, {
|
|
50
|
-
patientUuid:
|
|
50
|
+
patientUuid:
|
|
51
|
+
referral.patient_uuid || referral.person_uuid,
|
|
51
52
|
})}
|
|
52
53
|
>
|
|
53
54
|
{referral.zl_emr_id}
|
|
@@ -59,7 +60,7 @@ export default function Table(props: TableProps) {
|
|
|
59
60
|
to={interpolateString(config.links.visitPage, {
|
|
60
61
|
patientUuid:
|
|
61
62
|
referral.patient_uuid || referral.person_uuid,
|
|
62
|
-
visitUuid: referral.visit_uuid
|
|
63
|
+
visitUuid: referral.visit_uuid,
|
|
63
64
|
})}
|
|
64
65
|
>
|
|
65
66
|
{formatDate(referral.referral_date)}
|
|
@@ -76,7 +77,7 @@ export default function Table(props: TableProps) {
|
|
|
76
77
|
patientUuid:
|
|
77
78
|
referral.patient_uuid || referral.person_uuid,
|
|
78
79
|
visitUuid: referral.visit_uuid,
|
|
79
|
-
encounterUuid: referral.encounter_uuid
|
|
80
|
+
encounterUuid: referral.encounter_uuid,
|
|
80
81
|
})}
|
|
81
82
|
>
|
|
82
83
|
{referral.fulfillment_status}
|
package/src/util.ts
CHANGED
|
@@ -11,9 +11,7 @@ export function formatDate(strDate: string) {
|
|
|
11
11
|
date.month() === today.month() &&
|
|
12
12
|
date.year() === today.year()
|
|
13
13
|
) {
|
|
14
|
-
return moment()
|
|
15
|
-
.calendar()
|
|
16
|
-
.split(" ")[0]; // locale-specific 'Today'
|
|
14
|
+
return moment().calendar().split(" ")[0]; // locale-specific 'Today'
|
|
17
15
|
} else if (date.year() === today.year()) {
|
|
18
16
|
return date.format("DD MMM");
|
|
19
17
|
} else {
|
package/translations/en.json
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"emr-id": "EMR ID",
|
|
5
|
-
"filter-by-patient": "Filter by patient",
|
|
6
|
-
"from": "From",
|
|
7
|
-
"name": "Name",
|
|
8
|
-
"referral-date": "Referral Date",
|
|
9
|
-
"referral-type": "Referral Type",
|
|
10
|
-
"referrals-queue": "Referrals Queue",
|
|
11
|
-
"status": "Status",
|
|
12
|
-
"to": "To"
|
|
2
|
+
"casualGreeting": "hey",
|
|
3
|
+
"formalGreeting": "hello"
|
|
13
4
|
}
|
package/tsconfig.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"module": "esnext",
|
|
5
5
|
"allowSyntheticDefaultImports": true,
|
|
6
6
|
"jsx": "react",
|
|
7
|
+
"skipLibCheck": true,
|
|
7
8
|
"moduleResolution": "node",
|
|
8
9
|
"lib": [
|
|
9
10
|
"dom",
|
|
@@ -15,8 +16,8 @@
|
|
|
15
16
|
"es2018",
|
|
16
17
|
"es2020"
|
|
17
18
|
],
|
|
19
|
+
"resolveJsonModule": true,
|
|
18
20
|
"noEmit": true,
|
|
19
21
|
"target": "esnext"
|
|
20
|
-
}
|
|
21
|
-
"include": ["src/**/*"]
|
|
22
|
+
}
|
|
22
23
|
}
|
package/webpack.config.js
CHANGED
|
@@ -1,71 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const CleanWebpackPlugin = require("clean-webpack-plugin").CleanWebpackPlugin;
|
|
3
|
-
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
|
|
4
|
-
|
|
5
|
-
const { peerDependencies } = require("./package.json");
|
|
6
|
-
|
|
7
|
-
const cssLoader = {
|
|
8
|
-
loader: "css-loader",
|
|
9
|
-
options: {
|
|
10
|
-
modules: {
|
|
11
|
-
localIdentName: "esm-referrals-queue__[name]__[local]___[hash:base64:5]"
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
module.exports = {
|
|
17
|
-
entry: [
|
|
18
|
-
path.resolve(__dirname, "src/set-public-path.ts"),
|
|
19
|
-
path.resolve(__dirname, "src/index.ts")
|
|
20
|
-
],
|
|
21
|
-
output: {
|
|
22
|
-
filename: "pih-esm-referrals-queue-app.js",
|
|
23
|
-
libraryTarget: "system",
|
|
24
|
-
path: path.resolve(__dirname, "dist"),
|
|
25
|
-
jsonpFunction: "webpackJsonp_pih_esm_referrals_queue"
|
|
26
|
-
},
|
|
27
|
-
module: {
|
|
28
|
-
rules: [
|
|
29
|
-
{
|
|
30
|
-
parser: {
|
|
31
|
-
system: false
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
test: /\.m?(js|ts|tsx)$/,
|
|
36
|
-
exclude: /(node_modules|bower_components)/,
|
|
37
|
-
use: {
|
|
38
|
-
loader: "babel-loader"
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
test: /\.css$/,
|
|
43
|
-
use: ["style-loader", cssLoader]
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
test: /\.s[ac]ss$/i,
|
|
47
|
-
use: ["style-loader", cssLoader, "sass-loader"]
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
test: /\.(png|jpe?g)$/i,
|
|
51
|
-
use: [
|
|
52
|
-
{
|
|
53
|
-
loader: "file-loader"
|
|
54
|
-
}
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
},
|
|
59
|
-
devtool: "sourcemap",
|
|
60
|
-
devServer: {
|
|
61
|
-
headers: {
|
|
62
|
-
"Access-Control-Allow-Origin": "*"
|
|
63
|
-
},
|
|
64
|
-
disableHostCheck: true
|
|
65
|
-
},
|
|
66
|
-
externals: Object.keys(peerDependencies),
|
|
67
|
-
plugins: [new ForkTsCheckerWebpackPlugin(), new CleanWebpackPlugin()],
|
|
68
|
-
resolve: {
|
|
69
|
-
extensions: [".tsx", ".ts", ".jsx", ".js"]
|
|
70
|
-
}
|
|
71
|
-
};
|
|
1
|
+
module.exports = require("openmrs/default-webpack-config");
|
package/.babelrc
DELETED
package/.gitattributes
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
* text=auto
|
package/.tx/config
DELETED
package/.vscode/launch.json
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Use IntelliSense to learn about possible attributes.
|
|
3
|
-
// Hover to view descriptions of existing attributes.
|
|
4
|
-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
-
"version": "0.2.0",
|
|
6
|
-
"configurations": [
|
|
7
|
-
{
|
|
8
|
-
"type": "node",
|
|
9
|
-
"name": "vscode-jest-tests",
|
|
10
|
-
"request": "launch",
|
|
11
|
-
"args": ["--runInBand"],
|
|
12
|
-
"cwd": "${workspaceFolder}",
|
|
13
|
-
"console": "integratedTerminal",
|
|
14
|
-
"internalConsoleOptions": "neverOpen",
|
|
15
|
-
"disableOptimisticBPs": true,
|
|
16
|
-
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
|
|
17
|
-
"windows": {
|
|
18
|
-
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"type": "node",
|
|
23
|
-
"request": "launch",
|
|
24
|
-
"name": "Jest Current File",
|
|
25
|
-
"program": "${workspaceFolder}/node_modules/.bin/jest",
|
|
26
|
-
"args": ["${fileBasenameNoExtension}"],
|
|
27
|
-
"console": "integratedTerminal",
|
|
28
|
-
"internalConsoleOptions": "neverOpen",
|
|
29
|
-
"disableOptimisticBPs": true,
|
|
30
|
-
"windows": {
|
|
31
|
-
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
]
|
|
35
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { of } from "rxjs";
|
|
3
|
-
|
|
4
|
-
export function openmrsFetch() {
|
|
5
|
-
return new Promise(() => {});
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function openmrsObservableFetch() {
|
|
9
|
-
return of({ data: { entry: [] } });
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function getCurrentUser() {
|
|
13
|
-
return of({ authenticated: false });
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function createErrorHandler() {
|
|
17
|
-
return function errorHandler(err) {
|
|
18
|
-
// eslint-disable-next-line no-console
|
|
19
|
-
console.log(`Received error ${err}`);
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function defineConfigSchema() {}
|
|
24
|
-
|
|
25
|
-
export const validators = {
|
|
26
|
-
isBoolean: jest.fn(),
|
|
27
|
-
isString: jest.fn()
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const validator = () => {};
|
|
31
|
-
|
|
32
|
-
export function useConfig() {
|
|
33
|
-
return {
|
|
34
|
-
links: {
|
|
35
|
-
patientDash: "${openmrsBase}/pt-dash/${patientUuid}",
|
|
36
|
-
visitPage: "${openmrsBase}/visit/${patientUuid}/${visitUuid}",
|
|
37
|
-
homeVisitForm:
|
|
38
|
-
"${openmrsBase}/home-visit-form/${patientUuid}/${visitUuid}/${encounterUuid}"
|
|
39
|
-
},
|
|
40
|
-
pendingStatuses: ["Pending status"]
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export const ModuleNameContext = React.createContext("fake-module-config");
|
|
45
|
-
|
|
46
|
-
export function interpolateString(template: string, params: object): string {
|
|
47
|
-
const names = Object.keys(params);
|
|
48
|
-
return names.reduce(
|
|
49
|
-
(prev, curr) => prev.split("${" + curr + "}").join(params[curr]),
|
|
50
|
-
template
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export const ConfigurableLink = ({ to, children, ...otherProps }) => (
|
|
55
|
-
<a
|
|
56
|
-
onClick={() => {
|
|
57
|
-
window.location.href = interpolateString(to, { openmrsBase: "/openmrs" });
|
|
58
|
-
}}
|
|
59
|
-
href={to}
|
|
60
|
-
{...otherProps}
|
|
61
|
-
>
|
|
62
|
-
{children}
|
|
63
|
-
</a>
|
|
64
|
-
);
|
package/design-mockup.png
DELETED
|
Binary file
|