@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.
Files changed (63) hide show
  1. package/.editorconfig +2 -1
  2. package/.eslintignore +2 -1
  3. package/.eslintrc +1 -2
  4. package/.github/workflows/node.js.yml +17 -17
  5. package/.husky/pre-commit +7 -0
  6. package/.prettierignore +13 -3
  7. package/README.md +14 -3
  8. package/__mocks__/react-i18next.js +51 -0
  9. package/dist/132.js +1 -0
  10. package/dist/147.js +2 -0
  11. package/dist/147.js.LICENSE.txt +47 -0
  12. package/dist/281.js +1 -0
  13. package/dist/294.js +2 -0
  14. package/dist/294.js.LICENSE.txt +9 -0
  15. package/dist/574.js +1 -0
  16. package/dist/595.js +2 -0
  17. package/dist/595.js.LICENSE.txt +1 -0
  18. package/dist/879.js +2 -0
  19. package/dist/879.js.LICENSE.txt +21 -0
  20. package/dist/90.js +1 -0
  21. package/dist/main.js +1 -0
  22. package/dist/pih-esm-referrals-queue-app.js +1 -2
  23. package/dist/pih-esm-referrals-queue-app.js.buildmanifest.json +265 -0
  24. package/dist/pih-esm-referrals-queue-app.old +1 -0
  25. package/jest.config.json +19 -0
  26. package/package.json +68 -78
  27. package/src/config-schema.ts +63 -0
  28. package/src/constants.ts +3 -0
  29. package/src/declarations.d.tsx +1 -2
  30. package/src/index.ts +57 -53
  31. package/src/referrals-queue/referrals-queue.component.tsx +22 -17
  32. package/src/referrals-queue/{referrals-queue.resource.ts → referrals-queue.resource.tsx} +1 -1
  33. package/src/referrals-queue/referrals-queue.test.tsx +12 -11
  34. package/src/root.component.test.tsx +1 -1
  35. package/src/root.component.tsx +8 -5
  36. package/src/setup-tests.ts +24 -0
  37. package/src/table/table.component.tsx +5 -4
  38. package/src/util.ts +1 -3
  39. package/translations/en.json +2 -11
  40. package/tsconfig.json +3 -2
  41. package/webpack.config.js +1 -71
  42. package/.babelrc +0 -10
  43. package/.gitattributes +0 -1
  44. package/.tx/config +0 -10
  45. package/.vscode/launch.json +0 -35
  46. package/__mocks__/openmrs-esm-framework.mock.tsx +0 -64
  47. package/design-mockup.png +0 -0
  48. package/dist/1.pih-esm-referrals-queue-app.js +0 -297
  49. package/dist/1.pih-esm-referrals-queue-app.js.map +0 -1
  50. package/dist/2.pih-esm-referrals-queue-app.js +0 -2
  51. package/dist/2.pih-esm-referrals-queue-app.js.map +0 -1
  52. package/dist/3.pih-esm-referrals-queue-app.js +0 -2
  53. package/dist/3.pih-esm-referrals-queue-app.js.map +0 -1
  54. package/dist/4.pih-esm-referrals-queue-app.js +0 -2
  55. package/dist/4.pih-esm-referrals-queue-app.js.map +0 -1
  56. package/dist/5.pih-esm-referrals-queue-app.js +0 -2
  57. package/dist/5.pih-esm-referrals-queue-app.js.map +0 -1
  58. package/dist/pih-esm-referrals-queue-app.js.map +0 -1
  59. package/jest.config.js +0 -11
  60. package/src/set-public-path.ts +0 -3
  61. package/src/setup-tests.js +0 -13
  62. package/translations/es.json +0 -13
  63. package/translations/fr.json +0 -13
package/.editorconfig CHANGED
@@ -6,6 +6,7 @@ indent_size = 2
6
6
  charset = utf-8
7
7
  trim_trailing_whitespace = true
8
8
  insert_final_newline = true
9
+ end_of_line = lf
9
10
 
10
11
  [*.md]
11
- trim_trailing_whitespace = false
12
+ trim_trailing_whitespace = false
package/.eslintignore CHANGED
@@ -1 +1,2 @@
1
- coverage
1
+ src/**/*.test.tsx
2
+ **/*.d.tsx
package/.eslintrc CHANGED
@@ -1,5 +1,4 @@
1
1
  {
2
- "extends": ["ts-react-important-stuff", "plugin:prettier/recommended"],
3
2
  "parser": "@typescript-eslint/parser",
4
- "ignorePatterns": ["*.d.tsx"]
3
+ "extends": ["ts-react-important-stuff", "plugin:prettier/recommended"]
5
4
  }
@@ -2,16 +2,16 @@ name: Node.js CI
2
2
 
3
3
  on:
4
4
  push:
5
- branches: [master]
5
+ branches: [main]
6
6
  pull_request:
7
- branches: [master]
7
+ branches: [main]
8
8
  release:
9
9
  types:
10
10
  - created
11
11
 
12
12
  env:
13
13
  ESM_NAME: "@pih/esm-referrals-queue-app"
14
- JS_NAME: "pih-esm-referrals-queue-app.js"
14
+ JS_NAME: "esm-referrals-queue-app.js"
15
15
 
16
16
  jobs:
17
17
  build:
@@ -22,12 +22,12 @@ jobs:
22
22
  - name: Use Node.js
23
23
  uses: actions/setup-node@v1
24
24
  with:
25
- node-version: "14.x"
26
- - run: npm install
27
- - run: npm run lint
28
- - run: npm run coverage
29
- - run: npm run typescript
30
- - run: npm run build --if-present
25
+ node-version: "16.x"
26
+ - run: yarn
27
+ - run: yarn lint
28
+ - run: yarn coverage
29
+ - run: yarn typescript
30
+ - run: yarn build
31
31
  - name: Upload Artifacts
32
32
  uses: actions/upload-artifact@v2
33
33
  with:
@@ -49,11 +49,11 @@ jobs:
49
49
  - name: Use Node.js
50
50
  uses: actions/setup-node@v1
51
51
  with:
52
- node-version: "14.x"
53
- registry-url: "https://registry.npmjs.org"
54
- - run: npm install
52
+ node-version: "16.x"
53
+ registry-url: "https://registry.npmjs.org"
54
+ - run: yarn install
55
55
  - run: sed -i -e "s/\(\"version\":\\s\+\"\([0-9]\+\.\?\)\+\)/\1-pre.${{ github.run_number }}/" 'package.json'
56
- - run: npm publish --access public --tag next
56
+ - run: yarn publish --access public --tag next
57
57
  env:
58
58
  NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
59
59
 
@@ -71,9 +71,9 @@ jobs:
71
71
  - name: Use Node.js
72
72
  uses: actions/setup-node@v1
73
73
  with:
74
- node-version: "14.x"
75
- registry-url: "https://registry.npmjs.org"
76
- - run: npm install
77
- - run: npm publish --access public
74
+ node-version: "16.x"
75
+ registry-url: 'https://registry.npmjs.org'
76
+ - run: yarn
77
+ - run: yarn publish --access public
78
78
  env:
79
79
  NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ set -e # die on error
5
+
6
+ npx pretty-quick --staged
7
+ yarn verify
package/.prettierignore CHANGED
@@ -1,4 +1,14 @@
1
- .gitignore
2
- .prettierignore
1
+ # directories
2
+ .husky/
3
+ dist/
4
+ node_modules/
5
+
6
+ # dotfiles and generated
7
+ .*
3
8
  yarn.lock
4
- package-lock.json
9
+
10
+ # by file type
11
+ **/*.css
12
+ **/*.scss
13
+ **/*.md
14
+ **/*.json
package/README.md CHANGED
@@ -6,15 +6,26 @@ A page for viewing the J9 Home Visits from CommCare
6
6
 
7
7
  ## Design Notes
8
8
 
9
- *Copied from [PIH Confluence](https://pihemr.atlassian.net/wiki/spaces/DSS/pages/538116104/PIH+EMR+Referrals+Queue)*
10
-
11
- ![design](https://raw.githubusercontent.com/PIH/pih-esm-referrals-queue/master/design-mockup.png)
9
+ *See from [PIH Confluence](https://pihemr.atlassian.net/wiki/spaces/DSS/pages/538116104/PIH+EMR+Referrals+Queue)*
12
10
 
13
11
  There should be one row per referral in this list (not one per encounter). Some encounters may result in multiple referrals. See the Referral Type logic below.
14
12
 
15
13
  Note that the basic referrals workflow would be for J9 clinicians/managers to view the list of referrals here, then take action upon them one by one by clicking on the “pending” referrals. This will bring them into editing the Home Visit form from which the referral came. From there they specify any action taken on the referral and navigate back to this list.
16
14
  Check out the [design doc](https://pihemr.atlassian.net/wiki/spaces/DSS/pages/538116104/PIH+EMR+Referrals+Queue).
17
15
 
16
+ ## Development
17
+ ```sh
18
+ # to install dependencies
19
+ yarn
20
+
21
+ # will run against a local OpenMRS server at localhost:8080, serving the frontend from 8081
22
+ yarn start --backend "http://localhost:8080/" --port 8081
23
+
24
+ # run against HUM-CI, serving the frontend from 8080
25
+ yarn start --backend "http://humci.pih-emr.org/" --api-url /mirebalais/
26
+ ```
27
+
28
+
18
29
 
19
30
  ## Configuration
20
31
  <!-- GENERATED BY OPENMRS CONFIG CLI -->
@@ -0,0 +1,51 @@
1
+ /** At present, this entire mock is boilerplate. */
2
+
3
+ const React = require('react');
4
+ const reactI18next = require('react-i18next');
5
+
6
+ const hasChildren = node => node && (node.children || (node.props && node.props.children));
7
+
8
+ const getChildren = node => (node && node.children ? node.children : node.props && node.props.children);
9
+
10
+ const renderNodes = reactNodes => {
11
+ if (typeof reactNodes === 'string') {
12
+ return reactNodes;
13
+ }
14
+
15
+ return Object.keys(reactNodes).map((key, i) => {
16
+ const child = reactNodes[key];
17
+ const isElement = React.isValidElement(child);
18
+
19
+ if (typeof child === 'string') {
20
+ return child;
21
+ }
22
+ if (hasChildren(child)) {
23
+ const inner = renderNodes(getChildren(child));
24
+ return React.cloneElement(child, { ...child.props, key: i }, inner);
25
+ }
26
+ if (typeof child === 'object' && !isElement) {
27
+ return Object.keys(child).reduce((str, childKey) => `${str}${child[childKey]}`, '');
28
+ }
29
+
30
+ return child;
31
+ });
32
+ };
33
+
34
+ const useMock = [k => k, {}];
35
+ useMock.t = (k, o) => (o && o.defaultValue) || (typeof o === 'string' ? o : k);
36
+ useMock.i18n = {};
37
+
38
+ module.exports = {
39
+ // this mock makes sure any components using the translate HoC receive the t function as a prop
40
+ Trans: ({ children }) => renderNodes(children),
41
+ Translation: ({ children }) => children(k => k, { i18n: {} }),
42
+ useTranslation: () => useMock,
43
+
44
+ // mock if needed
45
+ I18nextProvider: reactI18next.I18nextProvider,
46
+ initReactI18next: reactI18next.initReactI18next,
47
+ setDefaults: reactI18next.setDefaults,
48
+ getDefaults: reactI18next.getDefaults,
49
+ setI18n: reactI18next.setI18n,
50
+ getI18n: reactI18next.getI18n,
51
+ };
package/dist/132.js ADDED
@@ -0,0 +1 @@
1
+ (self.webpackChunk_pih_esm_referrals_queue_app=self.webpackChunk_pih_esm_referrals_queue_app||[]).push([[132],{8132:(e,i,t)=>{"use strict";t.r(i),t.d(i,{backendDependencies:()=>p,importTranslation:()=>s,setupOpenMRS:()=>u,version:()=>n});var r=t(311),a={links:{patientDash:{_type:r.Type.String,_default:"${openmrsBase}/coreapps/clinicianfacing/patient.page?patientId=${patientUuid}&app=pih.app.clinicianDashboard",_validators:[r.validators.isUrlWithTemplateParameters(["patientUuid"])]},visitPage:{_type:r.Type.String,_default:"${openmrsBase}/pihcore/visit/visit.page?patient=${patientUuid}&visit=${visitUuid}&suppressActions=true#/overview",_validators:[r.validators.isUrlWithTemplateParameters(["patientUuid","visitUuid"])]},homeVisitForm:{_type:r.Type.String,_default:"${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",_validators:[r.validators.isUrlWithTemplateParameters(["patientUuid","visitUuid","encounterUuid"])]}},pendingStatuses:{_type:r.Type.Array,_default:["Pending status","Referral unmet"],_elements:{_type:r.Type.String}}},n="2.0.0",s=t(3979),p={};function u(){var e="@pih/esm-referrals-queue-app",i={featureName:"referrals-queue",moduleName:e};return(0,r.defineConfigSchema)(e,a),(0,r.registerBreadcrumbs)([{path:"".concat(window.spaBase,"/referrals-queue"),title:"Referrals Queue"}]),{pages:[{load:(0,r.getAsyncLifecycle)((function(){return Promise.all([t.e(147),t.e(672),t.e(281)]).then(t.bind(t,4605))}),i),route:"referrals-queue"}]}}},3979:(e,i,t)=>{var r={"./en.json":[3574,574]};function a(e){if(!t.o(r,e))return Promise.resolve().then((()=>{var i=new Error("Cannot find module '"+e+"'");throw i.code="MODULE_NOT_FOUND",i}));var i=r[e],a=i[0];return t.e(i[1]).then((()=>t(a)))}a.keys=()=>Object.keys(r),a.id=3979,e.exports=a}}]);