@pih/esm-referrals-queue-app 1.0.5 → 2.0.0-pre.11

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 (248) 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-push +7 -0
  6. package/.prettierignore +13 -3
  7. package/README.md +14 -3
  8. package/__mocks__/react-i18next.js +51 -0
  9. package/dist/022d7839fbf0b01f1279.woff2 +0 -0
  10. package/dist/02e1d2dbd3774a8f5658.woff2 +0 -0
  11. package/dist/066f70960ee0bd4c07f5.woff +0 -0
  12. package/dist/0755d9c25fe86099a1fb.woff2 +0 -0
  13. package/dist/091d3a63042974d54d8a.woff +0 -0
  14. package/dist/0befeb0f9f061f052717.woff +0 -0
  15. package/dist/0c7e37865f4bb741d719.woff2 +0 -0
  16. package/dist/0e49dbb9071356a97aa7.woff +0 -0
  17. package/dist/0e5132569fd3eaea21cc.woff +0 -0
  18. package/dist/0eb6e423b08540bb2757.woff2 +0 -0
  19. package/dist/1223fdf597c1c7a57096.woff +0 -0
  20. package/dist/132.js +1 -0
  21. package/dist/13aa346ec359eaa168e2.woff +0 -0
  22. package/dist/144035d867f964f2c13d.woff2 +0 -0
  23. package/dist/152.js +2 -0
  24. package/dist/152.js.LICENSE.txt +47 -0
  25. package/dist/160c450b41a6dfc1bebe.woff2 +0 -0
  26. package/dist/164bc7c64a15028f6b19.woff +0 -0
  27. package/dist/178f507500fb1dabcf4e.woff +0 -0
  28. package/dist/189265eddd933218a2c4.woff2 +0 -0
  29. package/dist/19239848cb5cdf02953e.woff2 +0 -0
  30. package/dist/1ac9d0b721a47c618f27.woff2 +0 -0
  31. package/dist/1b3c2f1d45dbb745b4cf.woff +0 -0
  32. package/dist/2034d12242df27d980b8.woff +0 -0
  33. package/dist/22f2f7f20d522f25d8ec.woff2 +0 -0
  34. package/dist/247.js +1 -0
  35. package/dist/257967d345c4d73a616e.woff +0 -0
  36. package/dist/27626c129fe4aa22e2e6.woff2 +0 -0
  37. package/dist/2861a6629748147a32ea.woff2 +0 -0
  38. package/dist/294.js +2 -0
  39. package/dist/294.js.LICENSE.txt +9 -0
  40. package/dist/2b531494817a7008521c.woff +0 -0
  41. package/dist/2d855afa565d0006f5fa.woff2 +0 -0
  42. package/dist/2e0b1ce3e5a1765917d0.woff2 +0 -0
  43. package/dist/3028d912b8189a439418.woff2 +0 -0
  44. package/dist/319.js +1 -0
  45. package/dist/32a6fcddf51918f011f5.woff2 +0 -0
  46. package/dist/332d509af7965c98d5af.woff +0 -0
  47. package/dist/347e5ea493b441f06459.woff2 +0 -0
  48. package/dist/34ca7aaefd825bca9d62.woff +0 -0
  49. package/dist/362a779400aac0be5a12.woff2 +0 -0
  50. package/dist/3647330588ae297a0bd4.woff +0 -0
  51. package/dist/390315031483cbc78b20.woff +0 -0
  52. package/dist/3afa7954e621de8a516a.woff +0 -0
  53. package/dist/3f0da7edcbb8d01dcb97.woff +0 -0
  54. package/dist/3f4766bc8c4721b8d7a6.woff +0 -0
  55. package/dist/3fb99cf388da08c31bd7.woff2 +0 -0
  56. package/dist/404c0909c893f95ee0dc.woff2 +0 -0
  57. package/dist/40e1012bdd73a02c83f8.woff +0 -0
  58. package/dist/422493740da495c4413f.woff2 +0 -0
  59. package/dist/42423f4a1cfd745854a5.woff +0 -0
  60. package/dist/42c5469340604f5e79d5.woff2 +0 -0
  61. package/dist/42df6ba8755c7591afbe.woff2 +0 -0
  62. package/dist/44c432e4a678791737ca.woff2 +0 -0
  63. package/dist/452cc78a1baf50168631.woff +0 -0
  64. package/dist/4882dd164789ce7f44fe.woff2 +0 -0
  65. package/dist/49290aeb66b58f856f84.woff +0 -0
  66. package/dist/49b97d3a9224cb6bd5ac.woff +0 -0
  67. package/dist/4c3ed2a3f44451a96594.woff2 +0 -0
  68. package/dist/4f0c4a9ba045ef843752.woff +0 -0
  69. package/dist/4f746f1bbc05d6e9497f.woff2 +0 -0
  70. package/dist/5192df154d7f8cb9b76c.woff +0 -0
  71. package/dist/54028f60020ee6ac16c1.woff +0 -0
  72. package/dist/5687219882cd972495e6.woff +0 -0
  73. package/dist/56c52b5b71ff7d0decad.woff +0 -0
  74. package/dist/574.js +1 -0
  75. package/dist/578aae4082fb12898fe3.woff2 +0 -0
  76. package/dist/595.js +2 -0
  77. package/dist/595.js.LICENSE.txt +1 -0
  78. package/dist/5a07c14cd7519e0fa02d.woff +0 -0
  79. package/dist/5d3700da8be3c5172b76.woff2 +0 -0
  80. package/dist/5e1440da12d78046c31a.woff2 +0 -0
  81. package/dist/608bff2bb28ccfd74ca0.woff +0 -0
  82. package/dist/62f5f45b32f0702031ad.woff2 +0 -0
  83. package/dist/62fd670eebf4976bb6df.woff2 +0 -0
  84. package/dist/6305238484fd3cc045b0.woff2 +0 -0
  85. package/dist/64e1054a50262b9083ab.woff2 +0 -0
  86. package/dist/6557a3c33c4218db6066.woff2 +0 -0
  87. package/dist/66e70aaa5d9c7be2b7d9.woff +0 -0
  88. package/dist/68.js +2 -0
  89. package/dist/68.js.LICENSE.txt +21 -0
  90. package/dist/68c556c669c532459374.woff2 +0 -0
  91. package/dist/6956fe0f5e625049f7e2.woff2 +0 -0
  92. package/dist/6bdf3ec568a6634a4aea.woff2 +0 -0
  93. package/dist/6d9b6411704ee0e26f31.woff2 +0 -0
  94. package/dist/6dc1395379557355e28d.woff2 +0 -0
  95. package/dist/6fcf28e2972af1d72ef8.woff +0 -0
  96. package/dist/712.js +2 -0
  97. package/dist/712.js.LICENSE.txt +18 -0
  98. package/dist/723a4b364f38da1e93e0.woff2 +0 -0
  99. package/dist/729e5174c878b0a30035.woff2 +0 -0
  100. package/dist/74025371289e2bab9590.woff2 +0 -0
  101. package/dist/757.js +1 -0
  102. package/dist/762888d30d179075ea6c.woff +0 -0
  103. package/dist/784d3444a92b4f1b77bc.woff +0 -0
  104. package/dist/794699869c58056513c7.woff +0 -0
  105. package/dist/79752c5c990ac51471f4.woff2 +0 -0
  106. package/dist/7984062acac19d00de83.woff2 +0 -0
  107. package/dist/79bc83792898f002dfc0.woff +0 -0
  108. package/dist/7d46ea83f372f13d40a0.woff +0 -0
  109. package/dist/7f15c4783287134ac710.woff +0 -0
  110. package/dist/8000079133e696898c7e.woff2 +0 -0
  111. package/dist/806a7a7745e7bd864174.woff +0 -0
  112. package/dist/8212ca4bb829a5d9f858.woff2 +0 -0
  113. package/dist/830.js +1 -0
  114. package/dist/86c57595c1697937314b.woff +0 -0
  115. package/dist/88cb07ee53507d19f992.woff2 +0 -0
  116. package/dist/8a014da16bb5df1e9830.woff2 +0 -0
  117. package/dist/8af6b3d1e1a4ac4fdd49.woff2 +0 -0
  118. package/dist/8bbf2e3b118b1732ea16.woff2 +0 -0
  119. package/dist/8cd3fae70878b55de45b.woff +0 -0
  120. package/dist/8e05df04c42299bc9c31.woff +0 -0
  121. package/dist/9022078be982e16dc192.woff2 +0 -0
  122. package/dist/907c442ef0bf7886cbbc.woff2 +0 -0
  123. package/dist/90822629c9f43acb1cf8.woff2 +0 -0
  124. package/dist/92086fc1b9953ba20acd.woff +0 -0
  125. package/dist/92f1cafa16c646cffd37.woff2 +0 -0
  126. package/dist/9326d3d6ca3411249fd4.woff2 +0 -0
  127. package/dist/9340a047e2c400a8eff4.woff +0 -0
  128. package/dist/951b1b92a4b8315c27a1.woff +0 -0
  129. package/dist/957995d81ad3284f963f.woff2 +0 -0
  130. package/dist/95b38dc2556a6c46dc6c.woff2 +0 -0
  131. package/dist/95db32b85d6efe3f0c92.woff2 +0 -0
  132. package/dist/962cfb135eb81a80c239.woff +0 -0
  133. package/dist/96a9036ba12617504616.woff +0 -0
  134. package/dist/983c50a737da66c0bd02.woff2 +0 -0
  135. package/dist/987d18f198bd7d9fa265.woff2 +0 -0
  136. package/dist/9924e57202230ba397b0.woff2 +0 -0
  137. package/dist/9b6742916c10378bb045.woff +0 -0
  138. package/dist/9df11ababf0dd515e6a3.woff +0 -0
  139. package/dist/9e3f7d82b48ac62c7cb5.woff2 +0 -0
  140. package/dist/a07b795a96fa2b6691d1.woff +0 -0
  141. package/dist/a1c1f2f0c32534ae4785.woff2 +0 -0
  142. package/dist/a1f7181f7c86baf1c351.woff2 +0 -0
  143. package/dist/a32f901b42b9ddcc6e85.woff +0 -0
  144. package/dist/a34802c95c44f5903e18.woff2 +0 -0
  145. package/dist/a7c1ee99b038bc0777e0.woff +0 -0
  146. package/dist/a81d5c10cd640839a4b8.woff2 +0 -0
  147. package/dist/aa343b4fcab1658acc56.woff2 +0 -0
  148. package/dist/ab33fa58a6e7146d03f0.woff +0 -0
  149. package/dist/abeb6d68a7f128eaa1cd.woff +0 -0
  150. package/dist/aec9738277936824e421.woff +0 -0
  151. package/dist/b02a06390388409ab8cd.woff +0 -0
  152. package/dist/b0afed71b45a7f38e794.woff +0 -0
  153. package/dist/b0ec1af29941e0f52305.woff2 +0 -0
  154. package/dist/b3bbe4705c54760ade6b.woff +0 -0
  155. package/dist/b55f8f00b5929160ed27.woff +0 -0
  156. package/dist/b649469b999b248dbb70.woff +0 -0
  157. package/dist/b691d8c0c5110ea3659e.woff +0 -0
  158. package/dist/b729b57f022eb1d859fc.woff +0 -0
  159. package/dist/b8020bf5b1afb9556569.woff +0 -0
  160. package/dist/bb730844c9185c864437.woff2 +0 -0
  161. package/dist/bbae2f8ceda944a1ecd5.woff +0 -0
  162. package/dist/bfefc1c5dd4c689b4f0f.woff2 +0 -0
  163. package/dist/c204ba906a18b66bed05.woff +0 -0
  164. package/dist/c25bc2c3e5c0f0b089a2.woff +0 -0
  165. package/dist/c26797e2920f701bf68f.woff2 +0 -0
  166. package/dist/c32b0c98c77e458414dc.woff +0 -0
  167. package/dist/c3a84513ace37e633e6c.woff +0 -0
  168. package/dist/c6dd22ce106021638df7.woff2 +0 -0
  169. package/dist/c781dd3e68cf4db696e2.woff2 +0 -0
  170. package/dist/c81d3db94f7270abbebf.woff +0 -0
  171. package/dist/c8298f275f960d821949.woff +0 -0
  172. package/dist/c89e876b0e1fd2a0c661.woff2 +0 -0
  173. package/dist/c8cf918de7d9deffd15c.woff2 +0 -0
  174. package/dist/cacfd1d7dbd14067b970.woff2 +0 -0
  175. package/dist/cc33f663568d938071a0.woff +0 -0
  176. package/dist/cc628a3da5e5810acebe.woff +0 -0
  177. package/dist/cd9a0204454ff0e22880.woff2 +0 -0
  178. package/dist/cdb54c58914c803c9ed6.woff +0 -0
  179. package/dist/cf8cdfc9a1ead9d332f5.woff2 +0 -0
  180. package/dist/d55e14dce62503dcad5f.woff +0 -0
  181. package/dist/d69d5111a1f16e74d2fb.woff2 +0 -0
  182. package/dist/d6f3290223965413af92.woff +0 -0
  183. package/dist/d96e5a614e96c351c453.woff +0 -0
  184. package/dist/dacaf9bef27fac67fb17.woff2 +0 -0
  185. package/dist/dd406a41dc851acc7615.woff +0 -0
  186. package/dist/e0d279d30dd9df7831ce.woff2 +0 -0
  187. package/dist/e26dfdb6948e56dcf16c.woff +0 -0
  188. package/dist/e5317022888823405337.woff2 +0 -0
  189. package/dist/e589f9b7ff20e7e011ee.woff2 +0 -0
  190. package/dist/e5b7f5835bf8b91304bf.woff +0 -0
  191. package/dist/e655f59b8f3ed3b7c9fe.woff2 +0 -0
  192. package/dist/e7c487ed0bd3af889f66.woff2 +0 -0
  193. package/dist/eb36767a3caa8dfc71e8.woff2 +0 -0
  194. package/dist/efbc47072be0090327f8.woff +0 -0
  195. package/dist/f064c7d4889d1db43518.woff +0 -0
  196. package/dist/f31b6425f37c2b71c3fc.woff2 +0 -0
  197. package/dist/f3938458fa6048e8a833.woff +0 -0
  198. package/dist/f4031df8380579c41ed7.woff +0 -0
  199. package/dist/f432bafd941d9016122c.woff +0 -0
  200. package/dist/f4367aaef942e4cbea24.woff +0 -0
  201. package/dist/f5b2fe58c9057281ea3f.woff +0 -0
  202. package/dist/f5be008474d38b4cf15a.woff +0 -0
  203. package/dist/f968050d6a8297e66619.woff2 +0 -0
  204. package/dist/fdef8ecc502e23149bcc.woff +0 -0
  205. package/dist/main.js +1 -0
  206. package/dist/pih-esm-referrals-queue-app.js +1 -2
  207. package/dist/pih-esm-referrals-queue-app.js.buildmanifest.json +516 -0
  208. package/dist/pih-esm-referrals-queue-app.old +1 -0
  209. package/jest.config.json +19 -0
  210. package/package.json +68 -78
  211. package/src/config-schema.ts +63 -0
  212. package/src/constants.ts +3 -0
  213. package/src/declarations.d.tsx +1 -2
  214. package/src/index.ts +57 -53
  215. package/src/referrals-queue/referrals-queue.component.tsx +86 -94
  216. package/src/referrals-queue/{referrals-queue.resource.ts → referrals-queue.resource.tsx} +1 -1
  217. package/src/referrals-queue/referrals-queue.scss +39 -0
  218. package/src/referrals-queue/referrals-queue.test.tsx +16 -15
  219. package/src/root.component.test.tsx +1 -1
  220. package/src/root.component.tsx +8 -5
  221. package/src/setup-tests.ts +24 -0
  222. package/src/table/{table.component.tsx → referrals-table.component.tsx} +46 -38
  223. package/src/util.ts +1 -3
  224. package/tsconfig.json +3 -2
  225. package/webpack.config.js +1 -71
  226. package/.babelrc +0 -10
  227. package/.gitattributes +0 -1
  228. package/.tx/config +0 -10
  229. package/.vscode/launch.json +0 -35
  230. package/__mocks__/openmrs-esm-framework.mock.tsx +0 -64
  231. package/design-mockup.png +0 -0
  232. package/dist/1.pih-esm-referrals-queue-app.js +0 -297
  233. package/dist/1.pih-esm-referrals-queue-app.js.map +0 -1
  234. package/dist/2.pih-esm-referrals-queue-app.js +0 -2
  235. package/dist/2.pih-esm-referrals-queue-app.js.map +0 -1
  236. package/dist/3.pih-esm-referrals-queue-app.js +0 -2
  237. package/dist/3.pih-esm-referrals-queue-app.js.map +0 -1
  238. package/dist/4.pih-esm-referrals-queue-app.js +0 -2
  239. package/dist/4.pih-esm-referrals-queue-app.js.map +0 -1
  240. package/dist/5.pih-esm-referrals-queue-app.js +0 -2
  241. package/dist/5.pih-esm-referrals-queue-app.js.map +0 -1
  242. package/dist/pih-esm-referrals-queue-app.js.map +0 -1
  243. package/jest.config.js +0 -11
  244. package/src/referrals-queue/react-dates-overrides.css +0 -39
  245. package/src/referrals-queue/referrals-queue.css +0 -63
  246. package/src/set-public-path.ts +0 -3
  247. package/src/setup-tests.js +0 -13
  248. package/src/table/table.css +0 -16
package/package.json CHANGED
@@ -1,110 +1,100 @@
1
1
  {
2
2
  "name": "@pih/esm-referrals-queue-app",
3
- "version": "1.0.5",
4
- "description": "A page for viewing the J9 Home Visits from CommCare",
5
- "main": "dist/pih-esm-referrals-queue-app.js",
6
- "types": "src/pih-esm-referrals-queue.d.tsx",
3
+ "version": "2.0.0-pre.11",
7
4
  "license": "MPL-2.0",
8
- "homepage": "https://pihemr.atlassian.net/wiki/spaces/DSS/pages/538116104/PIH+EMR+Referrals+Queue",
5
+ "description": "A page for viewing the J9 Home Visits from CommCare",
6
+ "browser": "dist/pih-esm-referrals-queue-app.js",
7
+ "main": "src/index.ts",
8
+ "source": true,
9
9
  "scripts": {
10
- "start": "openmrs debug --run-project --backend https://humci.pih-emr.org/ --api-url /mirebalais/",
11
- "serve": "webpack-dev-server",
10
+ "start": "openmrs develop",
11
+ "serve": "webpack serve --mode=development",
12
12
  "build": "webpack --mode production",
13
13
  "analyze": "webpack --mode=production --env.analyze=true",
14
- "lint": "eslint src --ext tsx",
15
- "prettier": "prettier 'src/**/*' --write",
14
+ "lint": "eslint src --ext js,jsx,ts,tsx",
15
+ "prettier": "prettier --write \"src/**/*.{ts,tsx}\"",
16
16
  "typescript": "tsc",
17
- "prepublishOnly": "npm run build",
18
- "test": "jest",
19
- "coverage": "npm test -- --coverage",
20
- "update-translations": "tx pull"
17
+ "test": "jest --config jest.config.json",
18
+ "verify": "concurrently 'yarn:lint' 'yarn:test' 'yarn:typescript'",
19
+ "coverage": "yarn test -- --coverage",
20
+ "prepare": "husky install"
21
+ },
22
+ "husky": {
23
+ "hooks": {
24
+ "pre-commit": "pretty-quick --staged && yarn verify"
25
+ }
21
26
  },
22
27
  "browserslist": [
23
28
  "extends browserslist-config-openmrs"
24
29
  ],
25
30
  "keywords": [
26
- "openmrs"
31
+ "openmrs",
32
+ "microfrontends"
27
33
  ],
28
- "publishConfig": {
29
- "access": "public"
30
- },
31
- "husky": {
32
- "hooks": {
33
- "pre-commit": "pretty-quick --staged && concurrently 'npm:lint' 'npm:test' 'npm:typescript' 'npm:update-translations' && git add translations/*.json"
34
- }
35
- },
36
34
  "repository": {
37
35
  "type": "git",
38
- "url": "git+https://github.com/pih/esm-referrals-queue.git"
36
+ "url": "git+https://github.com/pih/pih-esm-referrals-queue.git"
37
+ },
38
+ "homepage": "https://github.com/pih/pih-esm-referrals-queue#readme",
39
+ "publishConfig": {
40
+ "access": "public"
39
41
  },
40
42
  "bugs": {
41
- "url": "https://github.com/pih/esm-referrals-queue/issues"
43
+ "url": "https://github.com/pih/pih-esm-referrals-queue/issues"
42
44
  },
43
45
  "dependencies": {
44
- "systemjs-webpack-interop": "^1.1.2"
46
+ "lodash-es": "^4.17.15"
45
47
  },
46
48
  "peerDependencies": {
47
- "@openmrs/esm-framework": "3.x",
48
- "dayjs": "^1.x",
49
- "react": "16.x",
50
- "react-dom": "16.x",
51
- "react-i18next": "^11.x"
49
+ "@carbon/react": "^1.9.0",
50
+ "@openmrs/esm-framework": "next",
51
+ "dayjs": "1.x",
52
+ "react": "18.x",
53
+ "react-i18next": "11.x",
54
+ "react-router-dom": "6.x",
55
+ "rxjs": "6.x"
52
56
  },
53
57
  "devDependencies": {
54
- "@babel/core": "^7.8.4",
55
- "@babel/plugin-proposal-class-properties": "^7.8.3",
56
- "@babel/plugin-transform-runtime": "^7.9.0",
57
- "@babel/preset-env": "^7.8.4",
58
- "@babel/preset-react": "^7.8.3",
59
- "@babel/preset-typescript": "^7.8.3",
58
+ "@carbon/icons-react": "^10.18.0",
59
+ "@carbon/react": "1.9.0",
60
60
  "@openmrs/esm-framework": "next",
61
- "@testing-library/jest-dom": "^5.0.2",
62
- "@testing-library/react": "^11.2.6",
63
- "@types/jest": "^24.9.1",
64
- "@types/moment": "^2.13.0",
65
- "@types/react": "^16.9.19",
66
- "@types/react-dates": "^17.1.10",
67
- "@types/react-dom": "^16.9.5",
68
- "@types/systemjs": "^6.1.0",
69
- "@types/webpack-env": "^1.15.1",
70
- "@typescript-eslint/parser": "^2.18.0",
71
- "babel-eslint": "^10.0.3",
72
- "babel-jest": "^24.9.0",
73
- "babel-loader": "^8.0.6",
74
- "browserslist-config-openmrs": "^1.0.0",
75
- "clean-webpack-plugin": "^3.0.0",
76
- "concurrently": "^5.1.0",
77
- "coveralls": "^3.0.7",
78
- "css-loader": "^3.4.2",
79
- "eslint": "^6.6.0",
80
- "eslint-config-prettier": "^6.6.0",
81
- "eslint-config-ts-react-important-stuff": "^2.0.0",
82
- "eslint-plugin-prettier": "^3.1.1",
83
- "fork-ts-checker-webpack-plugin": "^1.6.0",
84
- "husky": "^3.0.9",
85
- "i18next": "^19.1.0",
61
+ "@swc/core": "^1.2.203",
62
+ "@swc/jest": "^0.2.21",
63
+ "@testing-library/dom": "^7.20.0",
64
+ "@testing-library/jest-dom": "^5.16.5",
65
+ "@testing-library/react": "^13.3.0",
66
+ "@testing-library/user-event": "^14.4.3",
67
+ "@types/jest": "^28.1.4",
68
+ "@types/react": "^18.0.14",
69
+ "@types/react-dates": "^21.8.0",
70
+ "@types/react-dom": "^18.0.5",
71
+ "@types/react-router": "^5.1.14",
72
+ "@types/react-router-dom": "^5.1.7",
73
+ "@types/webpack-env": "^1.16.0",
74
+ "@typescript-eslint/parser": "^5.28.0",
75
+ "concurrently": "^6.2.0",
76
+ "css-loader": "^6.7.1",
77
+ "eslint": "^7.27.0",
78
+ "eslint-config-prettier": "^8.3.0",
79
+ "eslint-config-ts-react-important-stuff": "^3.0.0",
80
+ "eslint-plugin-prettier": "^3.4.0",
81
+ "husky": "^6.0.0",
86
82
  "identity-obj-proxy": "^3.0.0",
87
- "jest": "^26.6.3",
88
- "lint-staged": "^9.4.3",
89
- "mockdate": "^2.0.5",
90
- "moment": "^2.24.0",
83
+ "jest": "^27.0.4",
84
+ "jest-cli": "^27.0.4",
85
+ "mockdate": "^3.0.5",
91
86
  "openmrs": "next",
92
- "prettier": "^1.19.1",
93
- "pretty-quick": "^1.11.1",
87
+ "prettier": "^2.3.0",
88
+ "pretty-quick": "^3.1.0",
89
+ "react": "^18.2.0",
94
90
  "react-dates": "^21.8.0",
95
- "react-i18next": "^11.3.1",
96
- "react-router": "^5.1.2",
97
- "react-router-dom": "^5.1.2",
91
+ "react-dom": "^18.2.0",
92
+ "react-i18next": "^11.7.0",
93
+ "react-router-dom": "^6.3.0",
98
94
  "rxjs": "^6.5.4",
99
- "style-loader": "^1.1.3",
100
- "typescript": "^3.7.5",
101
- "webpack": "^4.41.5",
102
- "webpack-cli": "^3.3.10",
103
- "webpack-config-single-spa-react": "^1.3.0",
104
- "webpack-dev-server": "^3.10.1",
105
- "webpack-merge": "^4.2.2"
95
+ "typescript": "^4.3.2"
106
96
  },
107
97
  "resolutions": {
108
- "@types/react": "16.14.6"
98
+ "**/@types/react": "^18.0.14"
109
99
  }
110
100
  }
@@ -0,0 +1,63 @@
1
+ import { Type, validators } from "@openmrs/esm-framework";
2
+
3
+ /**
4
+ * This is the config schema. It expects a configuration object which
5
+ * looks like this:
6
+ *
7
+ * ```json
8
+ * { "casualGreeting": true, "whoToGreet": ["Mom"] }
9
+ * ```
10
+ *
11
+ * In OpenMRS Microfrontends, all config parameters are optional. Thus,
12
+ * all elements must have a reasonable default. A good default is one
13
+ * that works well with the reference application.
14
+ *
15
+ * To understand the schema below, please read the configuration system
16
+ * documentation:
17
+ * https://openmrs.github.io/openmrs-esm-core/#/main/config
18
+ * Note especially the section "How do I make my module configurable?"
19
+ * https://openmrs.github.io/openmrs-esm-core/#/main/config?id=im-developing-an-esm-module-how-do-i-make-it-configurable
20
+ * and the Schema Reference
21
+ * https://openmrs.github.io/openmrs-esm-core/#/main/config?id=schema-reference
22
+ */
23
+ export const configSchema = {
24
+ links: {
25
+ patientDash: {
26
+ _type: Type.String,
27
+ _default:
28
+ "${openmrsBase}/coreapps/clinicianfacing/patient.page?patientId=${patientUuid}&app=pih.app.clinicianDashboard",
29
+ _validators: [validators.isUrlWithTemplateParameters(["patientUuid"])],
30
+ },
31
+ visitPage: {
32
+ _type: Type.String,
33
+ _default:
34
+ "${openmrsBase}/pihcore/visit/visit.page?patient=${patientUuid}&visit=${visitUuid}&suppressActions=true#/overview",
35
+ _validators: [
36
+ validators.isUrlWithTemplateParameters(["patientUuid", "visitUuid"]),
37
+ ],
38
+ },
39
+ homeVisitForm: {
40
+ _type: Type.String,
41
+ _default:
42
+ "${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",
43
+ _validators: [
44
+ validators.isUrlWithTemplateParameters([
45
+ "patientUuid",
46
+ "visitUuid",
47
+ "encounterUuid",
48
+ ]),
49
+ ],
50
+ },
51
+ },
52
+ pendingStatuses: {
53
+ _type: Type.Array,
54
+ _default: ["Pending status", "Referral unmet"],
55
+ _elements: {
56
+ _type: Type.String,
57
+ },
58
+ },
59
+ };
60
+
61
+ export type Config = {
62
+ // TODO
63
+ };
@@ -0,0 +1,3 @@
1
+ export const spaBase = window.spaBase;
2
+ export const appBase = `/referrals-queue`;
3
+ export const appPath = `${spaBase}${appBase}`;
@@ -1,8 +1,7 @@
1
- // This entire file will be deleted once we have typescript definitions
2
- // for @openmrs/esm-api published to npm
3
1
  declare type Observable<T> = import("rxjs").Observable<T>;
4
2
 
5
3
  declare module "*.css";
4
+ declare module "*.scss";
6
5
 
7
6
  type Referral = {
8
7
  details: string;
package/src/index.ts CHANGED
@@ -1,14 +1,32 @@
1
- import "./set-public-path";
1
+ /**
2
+ * This is the entrypoint file of the application. It communicates the
3
+ * important features of this microfrontend to the app shell. It
4
+ * connects the app shell to the React application(s) that make up this
5
+ * microfrontend.
6
+ */
7
+
2
8
  import {
9
+ getAsyncLifecycle,
3
10
  defineConfigSchema,
4
- Type,
5
- validators,
6
11
  registerBreadcrumbs,
7
- getAsyncLifecycle
8
12
  } from "@openmrs/esm-framework";
13
+ import { configSchema } from "./config-schema";
9
14
 
10
- const backendDependencies = {};
15
+ /**
16
+ * This tells the app shell the version of this app. We inject this variable
17
+ * via the Webpack DefinePlugin, so first, in order to keep TypeScript happy,
18
+ * we need to tell it that this is an available variable in this scope. At
19
+ * build-time the __VERSION__ variable is replaced with the version from
20
+ * package.json
21
+ */
22
+ declare var __VERSION__: string;
23
+ const version = __VERSION__;
11
24
 
25
+ /**
26
+ * This tells the app shell how to obtain translation files: that they
27
+ * are JSON files in the directory `../translations` (which you should
28
+ * see in the directory structure).
29
+ */
12
30
  const importTranslation = require.context(
13
31
  "../translations",
14
32
  false,
@@ -16,64 +34,50 @@ const importTranslation = require.context(
16
34
  "lazy"
17
35
  );
18
36
 
19
- function setupOpenMRS() {
20
- defineConfigSchema("@pih/esm-referrals-queue-app", {
21
- links: {
22
- patientDash: {
23
- _type: Type.String,
24
- _default:
25
- "${openmrsBase}/coreapps/clinicianfacing/patient.page?patientId=${patientUuid}&app=pih.app.clinicianDashboard",
26
- _validators: [validators.isUrlWithTemplateParameters(["patientUuid"])]
27
- },
28
- visitPage: {
29
- _type: Type.String,
30
- _default:
31
- "${openmrsBase}/pihcore/visit/visit.page?patient=${patientUuid}&visit=${visitUuid}&suppressActions=true#/overview",
32
- _validators: [
33
- validators.isUrlWithTemplateParameters(["patientUuid", "visitUuid"])
34
- ]
35
- },
36
- homeVisitForm: {
37
- _type: Type.String,
38
- _default:
39
- "${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",
40
- _validators: [
41
- validators.isUrlWithTemplateParameters([
42
- "patientUuid",
43
- "visitUuid",
44
- "encounterUuid"
45
- ])
46
- ]
47
- }
48
- },
49
- pendingStatuses: {
50
- _type: Type.Array,
51
- _default: ["Pending status", "Referral unmet"],
52
- _elements: {
53
- _type: Type.String
54
- }
55
- }
56
- });
37
+ /**
38
+ * This tells the app shell what versions of what OpenMRS backend modules
39
+ * are expected. Warnings will appear if suitable modules are not
40
+ * installed. The keys are the part of the module name after
41
+ * `openmrs-module-`; e.g., `openmrs-module-fhir2` becomes `fhir2`.
42
+ */
43
+ const backendDependencies = {};
57
44
 
45
+ /**
46
+ * This function performs any setup that should happen at microfrontend
47
+ * load-time (such as defining the config schema) and then returns an
48
+ * object which describes how the React application(s) should be
49
+ * rendered.
50
+ *
51
+ * In this example, our return object contains a single page definition.
52
+ * It tells the app shell that the default export of `greeter.tsx`
53
+ * should be rendered when the route matches `hello`. The full route
54
+ * will be `openmrsSpaBase() + 'hello'`, which is usually
55
+ * `/openmrs/spa/hello`.
56
+ */
57
+ function setupOpenMRS() {
58
58
  const moduleName = "@pih/esm-referrals-queue-app";
59
- const pageName = "referrals-queue";
60
-
61
59
  const options = {
62
- featureName: pageName,
63
- moduleName
60
+ featureName: "referrals-queue",
61
+ moduleName,
64
62
  };
65
63
 
64
+ defineConfigSchema(moduleName, configSchema);
65
+
66
66
  registerBreadcrumbs([
67
67
  {
68
- path: `${window.spaBase}/${pageName}`,
69
- title: "Referrals Queue"
70
- }
68
+ path: `${window.spaBase}/referrals-queue`,
69
+ title: "Referrals Queue",
70
+ },
71
71
  ]);
72
72
 
73
73
  return {
74
- lifecycle: getAsyncLifecycle(() => import("./root.component"), options),
75
- activate: pageName
74
+ pages: [
75
+ {
76
+ load: getAsyncLifecycle(() => import("./root.component"), options),
77
+ route: "referrals-queue",
78
+ },
79
+ ],
76
80
  };
77
81
  }
78
82
 
79
- export { backendDependencies, importTranslation, setupOpenMRS };
83
+ export { backendDependencies, importTranslation, setupOpenMRS, version };
@@ -1,19 +1,22 @@
1
1
  import React from "react";
2
2
  import { Trans, useTranslation } from "react-i18next";
3
3
  import "react-dates/initialize";
4
- import { SingleDatePicker } from "react-dates";
5
- import moment, { Moment } from "moment";
4
+ import moment from "moment";
5
+ import {
6
+ Content,
7
+ Tile,
8
+ Heading,
9
+ Search,
10
+ Dropdown,
11
+ DatePicker,
12
+ DatePickerInput,
13
+ } from "@carbon/react";
6
14
  import "moment/locale/fr";
7
15
  import { createErrorHandler } from "@openmrs/esm-framework";
8
- import Table from "../table/table.component";
9
- import styles from "./referrals-queue.css";
16
+ import Table from "../table/referrals-table.component";
17
+ import styles from "./referrals-queue.scss";
10
18
  import { getReferrals } from "./referrals-queue.resource";
11
19
 
12
- // Override the webpack CSS loader config in order to load react-dates styles.
13
- // See thread: https://github.com/webpack-contrib/css-loader/issues/295
14
- import "!style-loader!css-loader!react-dates/lib/css/_datepicker.css";
15
- import "!style-loader!css-loader!./react-dates-overrides.css";
16
-
17
20
  export default function ReferralsQueue(props: ReferralsQueueProps) {
18
21
  const [referrals, setReferrals]: [Referral[], Function] = React.useState([]);
19
22
  const [referralTypeFilter, setReferralTypeFilter] = React.useState("");
@@ -22,11 +25,9 @@ export default function ReferralsQueue(props: ReferralsQueueProps) {
22
25
  const [fromDate, setFromDate] = React.useState(moment().subtract(1, "month"));
23
26
  const [toDate, setToDate] = React.useState(today);
24
27
  const [ptQuery, setPtQuery] = React.useState("");
25
- const [fromDateFocused, setFromDateFocused] = React.useState(false);
26
- const [toDateFocused, setToDateFocused] = React.useState(false);
27
28
  const { t, i18n } = useTranslation();
28
29
 
29
- const languageMatches = i18n.language.match(/^(en|fr|ht).*/);
30
+ const languageMatches = i18n.language?.match(/^(en|fr|ht).*/);
30
31
  const language = (languageMatches && languageMatches[1]) || "en";
31
32
 
32
33
  React.useEffect(() => {
@@ -38,127 +39,118 @@ export default function ReferralsQueue(props: ReferralsQueueProps) {
38
39
  const sub = getReferrals({
39
40
  fromDate: fromDate.format("YYYY-MM-DD"),
40
41
  toDate: toDate.format("YYYY-MM-DD"),
41
- locale: language
42
- }).subscribe(referrals => setReferrals(referrals), createErrorHandler());
42
+ locale: language,
43
+ }).subscribe(
44
+ (referrals) => setReferrals(referrals),
45
+ createErrorHandler()
46
+ );
43
47
  return () => sub.unsubscribe();
44
48
  }
45
49
  }, [fromDate, toDate, language]);
46
50
 
47
- // console.log(referrals);
48
51
  const filteredReferrals = referrals
49
- .filter(r => !referralTypeFilter || r.referral_type == referralTypeFilter)
50
- .filter(r => !statusFilter || r.fulfillment_status == statusFilter)
51
- .filter(r => matchQuery(r, ptQuery));
52
- const referralTypes = [...new Set(referrals.map(r => r.referral_type))];
52
+ .filter(
53
+ (r) =>
54
+ !referralTypeFilter ||
55
+ referralTypeFilter == t("any", "Any") ||
56
+ r.referral_type == referralTypeFilter
57
+ )
58
+ .filter(
59
+ (r) =>
60
+ !statusFilter ||
61
+ statusFilter == t("any", "Any") ||
62
+ r.fulfillment_status == statusFilter
63
+ )
64
+ .filter((r) => matchQuery(r, ptQuery));
65
+
66
+ const referralTypes = [
67
+ t("any", "Any"),
68
+ ...new Set(referrals.map((r) => r.referral_type).filter((r) => r != null)),
69
+ ];
70
+
53
71
  const statuses = [
54
- ...new Set(referrals.map(r => r.fulfillment_status).filter(r => r != null))
72
+ t("any", "Any"),
73
+ ...new Set(
74
+ referrals.map((r) => r.fulfillment_status).filter((r) => r != null)
75
+ ),
55
76
  ];
77
+
56
78
  return (
57
- <div className={styles.container}>
58
- <div className="omrs-card omrs-margin-top-16 omrs-padding-16">
59
- <div className="omrs-type-title-2">
79
+ <Content className={styles.container}>
80
+ <Tile>
81
+ <Heading>
60
82
  <Trans i18nKey="referrals-queue">Referrals Queue</Trans>
61
- </div>
83
+ </Heading>
62
84
  <div className={styles.controlsContainer}>
63
85
  <div className={styles.inputContainer}>
64
86
  <div className={styles.dateInputContainer}>
65
- <label htmlFor="from-date">
66
- <Trans i18nKey="from">From</Trans>
67
- </label>
68
- <SingleDatePicker
69
- id="from-date"
70
- date={fromDate}
71
- onDateChange={date => setFromDate(date)}
72
- focused={fromDateFocused}
73
- onFocusChange={({ focused }) => setFromDateFocused(focused)}
74
- isOutsideRange={(date: Moment) => date.isAfter(today)}
75
- displayFormat="DD MMM YYYY"
76
- numberOfMonths={1}
77
- />
78
- </div>
79
- <div className={styles.dateInputContainer}>
80
- <label htmlFor="to-date">
81
- <Trans i18nKey="to">To</Trans>
82
- </label>
83
- <SingleDatePicker
84
- id="to-date"
85
- date={toDate}
86
- onDateChange={date => setToDate(date)}
87
- focused={toDateFocused}
88
- onFocusChange={({ focused }) => setToDateFocused(focused)}
89
- isOutsideRange={(date: Moment) => date.isAfter(today)}
90
- displayFormat="DD MMM YYYY"
91
- numberOfMonths={1}
92
- />
87
+ <DatePicker
88
+ dateFormat="d/M/Y"
89
+ datePickerType="range"
90
+ locale={language === "ht" ? "fr" : language}
91
+ maxDate={new Date().toISOString()}
92
+ onChange={(date) => {
93
+ if (date && date.length > 0) {
94
+ setFromDate(date ? moment(date[0]) : null);
95
+ if (date.length > 1) {
96
+ setToDate(date ? moment(date[1]) : null);
97
+ }
98
+ }
99
+ }}
100
+ value={[fromDate.toISOString(), toDate.toISOString()]}
101
+ >
102
+ <DatePickerInput id="from-date" labelText={t("from", "From")} />
103
+ <DatePickerInput id="to-date" labelText={t("to", "To")} />
104
+ </DatePicker>
93
105
  </div>
94
106
  </div>
95
107
  <div className={styles.inputContainer}>
96
- <div className="omrs-input-group">
97
- <label htmlFor="referral-type">
98
- <Trans i18nKey="referral-type">Referral Type</Trans>
99
- </label>
100
- <select
108
+ <div style={{ width: 300 }}>
109
+ <Dropdown
101
110
  id="referral-type"
102
- value={referralTypeFilter}
103
- onChange={e => setReferralTypeFilter(e.target.value)}
104
- className={styles.dropdown}
105
- >
106
- <option value="">{t("any", "Any")}</option>
107
- {referralTypes.map(t => (
108
- <option key={t} value={t}>
109
- {t}
110
- </option>
111
- ))}
112
- </select>
111
+ label=""
112
+ titleText={t("referral-type", "Referral Type")}
113
+ items={referralTypes}
114
+ onChange={(e) => setReferralTypeFilter(e.selectedItem)}
115
+ />
113
116
  </div>
114
117
  </div>
115
118
  <div className={styles.inputContainer}>
116
- <div className="omrs-input-group">
119
+ <div>
117
120
  <label htmlFor="query-input">
118
121
  <Trans i18nKey="filter-by-patient">Filter by patient</Trans>
119
122
  </label>
120
- <input
123
+ <Search
121
124
  id="query-input"
122
- type="text"
123
- value={ptQuery}
124
- onChange={e => setPtQuery(e.target.value)}
125
- className="omrs-input-outlined"
125
+ labelText=""
126
+ onChange={(e) => setPtQuery(e.target.value)}
126
127
  />
127
128
  </div>
128
129
  </div>
129
130
  <div className={styles.inputContainer}>
130
- <div className="omrs-input-group">
131
- <label htmlFor="status">
132
- <Trans i18nKey="status">Status</Trans>
133
- </label>
134
- <select
131
+ <div style={{ width: 300 }}>
132
+ <Dropdown
135
133
  id="status"
136
- value={statusFilter}
137
- onChange={e => setStatusFilter(e.target.value)}
138
- className={styles.dropdown}
139
- >
140
- <option value="">{t("any", "Any")}</option>
141
- {statuses.map(t => (
142
- <option key={t} value={t}>
143
- {t}
144
- </option>
145
- ))}
146
- </select>
134
+ label=""
135
+ titleText={t("status", "Status")}
136
+ items={statuses}
137
+ onChange={(e) => setStatusFilter(e.selectedItem)}
138
+ />
147
139
  </div>
148
140
  </div>
149
141
  </div>
150
142
  <div className={styles.tableContainer}>
151
143
  <Table referrals={filteredReferrals} />
152
144
  </div>
153
- </div>
154
- </div>
145
+ </Tile>
146
+ </Content>
155
147
  );
156
148
  }
157
149
 
158
150
  function matchQuery(referral: Referral, query: string): boolean {
159
151
  return (
160
152
  !query ||
161
- prepareQuery(query).every(regexp =>
153
+ prepareQuery(query).every((regexp) =>
162
154
  regexp.test(removeDiacritics(referral.patient_name))
163
155
  ) ||
164
156
  new RegExp(query, "i").test(referral.zl_emr_id)
@@ -166,7 +158,7 @@ function matchQuery(referral: Referral, query: string): boolean {
166
158
  }
167
159
 
168
160
  function prepareQuery(query: string): RegExp[] {
169
- return query.split(/\s/).map(token => {
161
+ return query.split(/\s/).map((token) => {
170
162
  const tokenCleaned = removeDiacritics(token);
171
163
  return new RegExp("\\b" + tokenCleaned, "i");
172
164
  });
@@ -4,7 +4,7 @@ import { map } from "rxjs/operators";
4
4
  export function getReferrals({
5
5
  fromDate,
6
6
  toDate,
7
- locale
7
+ locale,
8
8
  }): Observable<Object[]> {
9
9
  return openmrsObservableFetch(
10
10
  `/ws/rest/v1/reportingrest/reportdata/cd7dfde7-764a-4da6-81c2-d5887ed1df51?startDate=${fromDate}&endDate=${toDate}&locale=${locale}`