@mherman22/esm-act-app 1.0.1-pre.22

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 (140) hide show
  1. package/.editorconfig +12 -0
  2. package/.husky/pre-commit +7 -0
  3. package/.husky/pre-push +6 -0
  4. package/.prettierignore +14 -0
  5. package/.turbo.json +18 -0
  6. package/.yarn/plugins/@yarnpkg/plugin-outdated.cjs +35 -0
  7. package/LICENSE +401 -0
  8. package/README.md +115 -0
  9. package/SECURITY.md +12 -0
  10. package/__mocks__/react-i18next.js +50 -0
  11. package/dist/117.js +1 -0
  12. package/dist/117.js.map +1 -0
  13. package/dist/131.css +1 -0
  14. package/dist/131.css.map +1 -0
  15. package/dist/131.js +1 -0
  16. package/dist/131.js.map +1 -0
  17. package/dist/197.js +1 -0
  18. package/dist/197.js.map +1 -0
  19. package/dist/237.js +1 -0
  20. package/dist/237.js.map +1 -0
  21. package/dist/29.js +1 -0
  22. package/dist/29.js.map +1 -0
  23. package/dist/338.css +1 -0
  24. package/dist/338.css.map +1 -0
  25. package/dist/338.js +1 -0
  26. package/dist/338.js.map +1 -0
  27. package/dist/362.js +1 -0
  28. package/dist/362.js.map +1 -0
  29. package/dist/379.js +1 -0
  30. package/dist/379.js.map +1 -0
  31. package/dist/410.js +1 -0
  32. package/dist/410.js.map +1 -0
  33. package/dist/430.css +1 -0
  34. package/dist/430.css.map +1 -0
  35. package/dist/430.js +1 -0
  36. package/dist/430.js.map +1 -0
  37. package/dist/450.css +1 -0
  38. package/dist/450.css.map +1 -0
  39. package/dist/450.js +1 -0
  40. package/dist/450.js.map +1 -0
  41. package/dist/517.js +1 -0
  42. package/dist/517.js.map +1 -0
  43. package/dist/538.js +1 -0
  44. package/dist/538.js.map +1 -0
  45. package/dist/578.js +1 -0
  46. package/dist/578.js.map +1 -0
  47. package/dist/638.js +1 -0
  48. package/dist/638.js.map +1 -0
  49. package/dist/708.css +1 -0
  50. package/dist/708.css.map +1 -0
  51. package/dist/708.js +1 -0
  52. package/dist/708.js.map +1 -0
  53. package/dist/749.js +1 -0
  54. package/dist/749.js.map +1 -0
  55. package/dist/823.css +1 -0
  56. package/dist/823.css.map +1 -0
  57. package/dist/823.js +1 -0
  58. package/dist/823.js.map +1 -0
  59. package/dist/898.js +1 -0
  60. package/dist/898.js.map +1 -0
  61. package/dist/943.js +1 -0
  62. package/dist/943.js.map +1 -0
  63. package/dist/957.css +1 -0
  64. package/dist/957.css.map +1 -0
  65. package/dist/957.js +43 -0
  66. package/dist/957.js.map +1 -0
  67. package/dist/977.js +1 -0
  68. package/dist/977.js.map +1 -0
  69. package/dist/98.js +1 -0
  70. package/dist/98.js.map +1 -0
  71. package/dist/997.js +1 -0
  72. package/dist/997.js.map +1 -0
  73. package/dist/999.js +6 -0
  74. package/dist/999.js.map +1 -0
  75. package/dist/mherman22-esm-act-app.js +3 -0
  76. package/dist/mherman22-esm-act-app.js.buildmanifest.json +781 -0
  77. package/dist/mherman22-esm-act-app.js.map +1 -0
  78. package/dist/routes.json +1 -0
  79. package/eslint.config.mjs +20 -0
  80. package/package.json +99 -0
  81. package/prettier.config.js +8 -0
  82. package/rspack.config.js +1 -0
  83. package/src/access/act-dashboard-link.component.tsx +16 -0
  84. package/src/access/screen-access.component.tsx +15 -0
  85. package/src/access/screen-access.test.tsx +81 -0
  86. package/src/access/sign-in.test-helper.ts +24 -0
  87. package/src/act-home/act-home-card.component.tsx +27 -0
  88. package/src/act-home/act-home-card.scss +25 -0
  89. package/src/act-home/act-home-dashboard-link.component.tsx +7 -0
  90. package/src/act-home/act-home-dashboard-link.test.tsx +32 -0
  91. package/src/act-home/act-home-dashboard.component.tsx +30 -0
  92. package/src/act-home/act-home-dashboard.test.tsx +43 -0
  93. package/src/act-home/act-home.meta.ts +8 -0
  94. package/src/act-home/act-home.scss +22 -0
  95. package/src/act-home/care-cascade.component.tsx +77 -0
  96. package/src/act-home/care-cascade.scss +42 -0
  97. package/src/act-home/care-cascade.test.tsx +128 -0
  98. package/src/act-home/quick-actions.component.tsx +32 -0
  99. package/src/act-home/quick-actions.scss +32 -0
  100. package/src/act-home/quick-actions.test.tsx +51 -0
  101. package/src/act-home/worklist-tiles.component.tsx +69 -0
  102. package/src/act-home/worklist-tiles.scss +50 -0
  103. package/src/act-home/worklist-tiles.test.tsx +133 -0
  104. package/src/config-schema.test.ts +83 -0
  105. package/src/config-schema.ts +129 -0
  106. package/src/declarations.d.ts +19 -0
  107. package/src/fetch-all.ts +20 -0
  108. package/src/flag-gaps/flag-gaps.resource.test.ts +57 -0
  109. package/src/flag-gaps/flag-gaps.resource.ts +69 -0
  110. package/src/flag-gaps/flag-gaps.scss +19 -0
  111. package/src/flag-gaps/flag-gaps.workspace.test.tsx +208 -0
  112. package/src/flag-gaps/flag-gaps.workspace.tsx +149 -0
  113. package/src/index.ts +33 -0
  114. package/src/registry/csv.ts +16 -0
  115. package/src/registry/registry-bpg.test.tsx +84 -0
  116. package/src/registry/registry-csv.test.tsx +100 -0
  117. package/src/registry/registry-dashboard-link.component.tsx +7 -0
  118. package/src/registry/registry-dashboard-link.test.tsx +32 -0
  119. package/src/registry/registry-filters.test.tsx +218 -0
  120. package/src/registry/registry-filters.ts +81 -0
  121. package/src/registry/registry-flags.test.tsx +67 -0
  122. package/src/registry/registry.component.tsx +255 -0
  123. package/src/registry/registry.fixture.ts +14 -0
  124. package/src/registry/registry.meta.ts +6 -0
  125. package/src/registry/registry.scss +41 -0
  126. package/src/registry/registry.test.tsx +147 -0
  127. package/src/reports/report-dataset.resource.test.tsx +189 -0
  128. package/src/reports/report-dataset.resource.ts +51 -0
  129. package/src/reports/report-date.test.ts +18 -0
  130. package/src/reports/report-date.ts +12 -0
  131. package/src/rhd-flags/rhd-flag-lists.resource.test.tsx +240 -0
  132. package/src/rhd-flags/rhd-flag-lists.resource.ts +88 -0
  133. package/src/routes.json +66 -0
  134. package/src/routes.test.ts +32 -0
  135. package/tools/i18next-parser.config.js +89 -0
  136. package/tools/setup-tests.ts +5 -0
  137. package/tools/update-openmrs-deps.mjs +42 -0
  138. package/translations/en.json +52 -0
  139. package/tsconfig.json +24 -0
  140. package/vitest.config.ts +21 -0
@@ -0,0 +1,32 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { readFileSync } from 'node:fs';
3
+ import routes from './routes.json';
4
+ import { actHomeDashboardMeta, actHomeWidgetsSlot } from './act-home/act-home.meta';
5
+ import { registryDashboardMeta } from './registry/registry.meta';
6
+
7
+ describe('routes.json', () => {
8
+ it('registers every component it names', () => {
9
+ const entry = readFileSync('src/index.ts', 'utf8');
10
+ const exported = [...entry.matchAll(/^export const (\w+) =/gm)].map(([, name]) => name);
11
+ const components = [...routes.extensions, ...routes.workspaces2].map((registration) => registration.component);
12
+
13
+ expect(components.filter((component) => !exported.includes(component))).toEqual([]);
14
+ });
15
+
16
+ it('adds ACT home to the home app under the name and slot its dashboard renders', () => {
17
+ const link = routes.extensions.find((extension) => extension.slot === 'homepage-dashboard-slot');
18
+ const dashboard = routes.extensions.find((extension) => extension.slot === actHomeDashboardMeta.slot);
19
+
20
+ expect(link.meta).toEqual(actHomeDashboardMeta);
21
+ expect(dashboard.component).toBe('actHomeDashboard');
22
+ expect(actHomeWidgetsSlot).not.toBe(actHomeDashboardMeta.slot);
23
+ });
24
+
25
+ it('adds the registry to the home app under the name and slot its page renders', () => {
26
+ const link = routes.extensions.find((extension) => extension.component === 'registryDashboardLink');
27
+ const page = routes.extensions.find((extension) => extension.slot === registryDashboardMeta.slot);
28
+
29
+ expect(link.meta).toEqual(registryDashboardMeta);
30
+ expect(page.component).toBe('registryDashboard');
31
+ });
32
+ });
@@ -0,0 +1,89 @@
1
+ module.exports = {
2
+ contextSeparator: '_',
3
+ // Key separator used in your translation keys
4
+
5
+ createOldCatalogs: false,
6
+ // Save the \_old files
7
+
8
+ defaultNamespace: 'translations',
9
+ // Default namespace used in your i18next config
10
+
11
+ defaultValue: '',
12
+ // Default value to give to empty keys
13
+ // You may also specify a function accepting the locale, namespace, and key as arguments
14
+
15
+ indentation: 2,
16
+ // Indentation of the catalog files
17
+
18
+ keepRemoved: false,
19
+ // Keep keys from the catalog that are no longer in code
20
+
21
+ keySeparator: '.',
22
+ // Key separator used in your translation keys
23
+ // If you want to use plain english keys, separators such as `.` and `:` will conflict. You might want to set `keySeparator: false` and `namespaceSeparator: false`. That way, `t('Status: Loading...')` will not think that there are a namespace and three separator dots for instance.
24
+
25
+ // see below for more details
26
+ lexers: {
27
+ hbs: ['HandlebarsLexer'],
28
+ handlebars: ['HandlebarsLexer'],
29
+
30
+ htm: ['HTMLLexer'],
31
+ html: ['HTMLLexer'],
32
+
33
+ mjs: ['JavascriptLexer'],
34
+ js: ['JavascriptLexer'], // if you're writing jsx inside .js files, change this to JsxLexer
35
+ ts: ['JavascriptLexer'],
36
+ jsx: ['JsxLexer'],
37
+ tsx: ['JsxLexer'],
38
+
39
+ default: ['JavascriptLexer'],
40
+ },
41
+
42
+ lineEnding: 'auto',
43
+ // Control the line ending. See options at https://github.com/ryanve/eol
44
+
45
+ locales: ['en'],
46
+ // An array of the locales in your applications
47
+
48
+ namespaceSeparator: ':',
49
+ // Namespace separator used in your translation keys
50
+ // If you want to use plain english keys, separators such as `.` and `:` will conflict. You might want to set `keySeparator: false` and `namespaceSeparator: false`. That way, `t('Status: Loading...')` will not think that there are a namespace and three separator dots for instance.
51
+
52
+ output: '$NAMESPACE/$LOCALE.json',
53
+ // Supports $LOCALE and $NAMESPACE injection
54
+ // Supports JSON (.json) and YAML (.yml) file formats
55
+ // Where to write the locale files relative to process.cwd()
56
+
57
+ pluralSeparator: '_',
58
+ // Plural separator used in your translation keys
59
+ // If you want to use plain english keys, separators such as `_` might conflict. You might want to set `pluralSeparator` to a different string that does not occur in your keys.
60
+
61
+ input: undefined,
62
+ // An array of globs that describe where to look for source files
63
+ // relative to the location of the configuration file
64
+
65
+ sort: true,
66
+ // Whether or not to sort the catalog
67
+
68
+ useKeysAsDefaultValue: false,
69
+ // Whether to use the keys as the default value; ex. "Hello": "Hello", "World": "World"
70
+ // This option takes precedence over the `defaultValue` and `skipDefaultValues` options
71
+ // You may also specify a function accepting the locale and namespace as arguments
72
+
73
+ verbose: false,
74
+ // Display info about the parsing including some stats
75
+
76
+ failOnWarnings: false,
77
+ // Exit with an exit code of 1 on warnings
78
+
79
+ customValueTemplate: null,
80
+ // If you wish to customize the value output the value as an object, you can set your own format.
81
+ // ${defaultValue} is the default value you set in your translation function.
82
+ // Any other custom property will be automatically extracted.
83
+ //
84
+ // Example:
85
+ // {
86
+ // message: "${defaultValue}",
87
+ // description: "${maxLength}", // t('my-key', {maxLength: 150})
88
+ // }
89
+ };
@@ -0,0 +1,5 @@
1
+ import '@testing-library/jest-dom/vitest';
2
+ import { afterEach } from 'vitest';
3
+ import { cleanup } from '@testing-library/react';
4
+
5
+ afterEach(cleanup);
@@ -0,0 +1,42 @@
1
+ import { execSync } from 'node:child_process';
2
+
3
+ try {
4
+ execSync(`yarn up --fixed '@openmrs/esm-framework@next' '@openmrs/esm-styleguide@next' 'openmrs@next'`, {
5
+ stdio: ['ignore', 'inherit', 'inherit'],
6
+ windowsHide: true,
7
+ });
8
+ } catch (error) {
9
+ console.error(`Error while updating dependencies: ${error.message ?? error}`);
10
+ process.exit(1);
11
+ }
12
+
13
+ try {
14
+ execSync(`yarn dedupe`, {
15
+ stdio: ['ignore', 'inherit', 'inherit'],
16
+ windowsHide: true,
17
+ });
18
+ } catch (error) {
19
+ console.error(`Error while deduplicating dependencies: ${error.message ?? error}`);
20
+ process.exit(1);
21
+ }
22
+
23
+ try {
24
+ execSync(`git diff-index --quiet HEAD --`, {
25
+ stdio: 'ignore',
26
+ windowsHide: true,
27
+ });
28
+ process.exit(0);
29
+ } catch (error) {
30
+ // git diff-index --quite HEAD --
31
+ // exits with status 1 if there are changes; we only need to run yarn verify if there are changes
32
+ }
33
+
34
+ try {
35
+ execSync(`yarn verify`, {
36
+ stdio: ['ignore', 'inherit', 'inherit'],
37
+ windowsHide: true,
38
+ });
39
+ } catch (error) {
40
+ console.error(`Error while running yarn verify: ${error.message ?? error}. Updates require manual intervention.`);
41
+ process.exit(1);
42
+ }
@@ -0,0 +1,52 @@
1
+ {
2
+ "actHome": "ACT home",
3
+ "actId": "ACT ID",
4
+ "actions": "Actions",
5
+ "adherence": "Adherence",
6
+ "age": "Age",
7
+ "all": "All",
8
+ "allLists": "All lists",
9
+ "bpgStatus": "BPG status",
10
+ "cardiacClinic": "Cardiac clinic",
11
+ "careCascade": "Care cascade",
12
+ "cascadeReportDate": "Report date: {{date}}",
13
+ "categoryAtDiagnosis": "Category at diagnosis",
14
+ "couldNotLoadCareCascade": "Could not load the care cascade",
15
+ "couldNotLoadGaps": "Could not load the missing data",
16
+ "couldNotLoadRegistry": "Could not load the registry",
17
+ "couldNotLoadWorklists": "Could not load the worklists",
18
+ "couldNotOpenForm": "Could not open the form",
19
+ "date": "Date",
20
+ "daysPending": "Days pending",
21
+ "diagnosisCategory": "Diagnosis category",
22
+ "downloadCsv": "Download CSV",
23
+ "enterProphylaxis": "Enter prophylaxis",
24
+ "findPatient": "Find a patient",
25
+ "flags": "Flags",
26
+ "form": "Form",
27
+ "missing": "Missing",
28
+ "missingData": "Missing data",
29
+ "name": "Name",
30
+ "nextConsultation": "Next consultation",
31
+ "noAccessToActHome": "You do not have access to ACT home.",
32
+ "noAccessToRegistry": "You do not have access to the registry.",
33
+ "noActHomeWidgets": "No widgets have been added to ACT home yet.",
34
+ "noCareCascadeData": "No care cascade data",
35
+ "noGapList": "This flag does not list its missing data.",
36
+ "noGapLists": "None of this patient's flags lists its missing data.",
37
+ "noRegistryMatches": "No patients match these filters.",
38
+ "noRegistryPatients": "No patients are enrolled in the registry.",
39
+ "noRhdFlagLists": "No RHD flag lists found",
40
+ "noSavedForm": "No saved form is waiting to be completed. Record the missing data on a new form.",
41
+ "openClinicalForms": "Open clinical forms",
42
+ "openForm": "Open form",
43
+ "primaryCareClinic": "Primary care clinic",
44
+ "prophylaxisRegimen": "Prophylaxis regimen",
45
+ "registerPatient": "Register patient",
46
+ "registry": "Registry",
47
+ "report": "Report",
48
+ "searchRegistry": "Search by name or ACT ID",
49
+ "sex": "Sex",
50
+ "status": "Status",
51
+ "worklists": "Worklists"
52
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "esModuleInterop": true,
4
+ "module": "esnext",
5
+ "allowSyntheticDefaultImports": true,
6
+ "jsx": "react",
7
+ "skipLibCheck": true,
8
+ "moduleResolution": "bundler",
9
+ "lib": [
10
+ "dom",
11
+ "es5",
12
+ "scripthost",
13
+ "es2015",
14
+ "es2015.promise",
15
+ "es2016.array.include",
16
+ "es2018",
17
+ "es2020",
18
+ "es2022",
19
+ ],
20
+ "resolveJsonModule": true,
21
+ "noEmit": true,
22
+ "target": "esnext"
23
+ }
24
+ }
@@ -0,0 +1,21 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ environment: 'happy-dom',
6
+ globals: true,
7
+ mockReset: true,
8
+ setupFiles: ['./tools/setup-tests.ts'],
9
+ exclude: ['**/node_modules/**', '**/e2e/**', '**/dist/**'],
10
+ server: {
11
+ deps: {
12
+ inline: [/@openmrs/],
13
+ },
14
+ },
15
+ alias: {
16
+ '@openmrs/esm-framework/src/internal': '@openmrs/esm-framework/mock',
17
+ '@openmrs/esm-framework': '@openmrs/esm-framework/mock',
18
+ 'react-i18next': new URL('./__mocks__/react-i18next.js', import.meta.url).pathname,
19
+ },
20
+ },
21
+ });