@kenyaemr/esm-patient-registration-app 5.2.2 → 6.0.0

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 (122) hide show
  1. package/dist/130.js +1 -1
  2. package/dist/130.js.map +1 -1
  3. package/dist/271.js +1 -0
  4. package/dist/319.js +1 -1
  5. package/dist/330.js +1 -1
  6. package/dist/460.js +1 -1
  7. package/dist/537.js +1 -1
  8. package/dist/574.js +1 -1
  9. package/dist/59.js +1 -1
  10. package/dist/59.js.map +1 -1
  11. package/dist/619.js +1 -0
  12. package/dist/619.js.map +1 -0
  13. package/dist/644.js +1 -0
  14. package/dist/735.js +1 -1
  15. package/dist/757.js +1 -1
  16. package/dist/784.js +1 -1
  17. package/dist/788.js +1 -1
  18. package/dist/807.js +1 -1
  19. package/dist/833.js +1 -1
  20. package/dist/895.js +2 -0
  21. package/dist/{388.js.LICENSE.txt → 895.js.LICENSE.txt} +4 -2
  22. package/dist/895.js.map +1 -0
  23. package/dist/{openmrs-esm-patient-registration-app.js → kenyaemr-esm-patient-registration-app.js} +1 -1
  24. package/dist/{openmrs-esm-patient-registration-app.js.buildmanifest.json → kenyaemr-esm-patient-registration-app.js.buildmanifest.json} +117 -73
  25. package/dist/kenyaemr-esm-patient-registration-app.js.map +1 -0
  26. package/dist/main.js +1 -1
  27. package/dist/main.js.LICENSE.txt +4 -2
  28. package/dist/main.js.map +1 -1
  29. package/dist/routes.json +1 -1
  30. package/package.json +6 -5
  31. package/src/add-patient-link.test.tsx +9 -7
  32. package/src/config-schema.ts +31 -38
  33. package/src/constants.ts +1 -1
  34. package/src/offline.resources.ts +13 -18
  35. package/src/offline.ts +8 -6
  36. package/src/patient-registration/before-save-prompt.tsx +2 -1
  37. package/src/patient-registration/field/__mocks__/field.resource.ts +1 -1
  38. package/src/patient-registration/field/address/address-field.component.tsx +5 -4
  39. package/src/patient-registration/field/address/address-hierarchy.resource.tsx +2 -2
  40. package/src/patient-registration/field/address/address-search.component.tsx +1 -14
  41. package/src/patient-registration/field/address/custom-address-field.component.tsx +1 -1
  42. package/src/patient-registration/field/address/tests/address-hierarchy.test.tsx +3 -3
  43. package/src/patient-registration/field/address/tests/address-search-component.test.tsx +14 -7
  44. package/src/patient-registration/field/custom-field.component.tsx +1 -1
  45. package/src/patient-registration/field/dob/dob.component.tsx +2 -2
  46. package/src/patient-registration/field/dob/dob.test.tsx +0 -3
  47. package/src/patient-registration/field/field.component.tsx +4 -1
  48. package/src/patient-registration/field/field.resource.ts +4 -4
  49. package/src/patient-registration/field/field.test.tsx +98 -95
  50. package/src/patient-registration/field/gender/gender-field.component.tsx +4 -4
  51. package/src/patient-registration/field/gender/gender-field.test.tsx +7 -14
  52. package/src/patient-registration/field/id/id-field.component.tsx +6 -6
  53. package/src/patient-registration/field/id/id-field.test.tsx +9 -7
  54. package/src/patient-registration/field/id/identifier-selection-overlay.component.tsx +1 -1
  55. package/src/patient-registration/field/name/name-field.component.tsx +1 -1
  56. package/src/patient-registration/field/obs/obs-field.component.tsx +35 -33
  57. package/src/patient-registration/field/obs/obs-field.test.tsx +106 -28
  58. package/src/patient-registration/field/person-attributes/coded-attributes.component.tsx +1 -1
  59. package/src/patient-registration/field/person-attributes/coded-person-attribute-field.component.tsx +70 -24
  60. package/src/patient-registration/field/person-attributes/coded-person-attribute-field.test.tsx +54 -30
  61. package/src/patient-registration/field/person-attributes/person-attribute-field.component.tsx +4 -3
  62. package/src/patient-registration/field/person-attributes/person-attribute-field.test.tsx +1 -1
  63. package/src/patient-registration/field/person-attributes/{person-attributes.resource.tsx → person-attributes.resource.ts} +3 -3
  64. package/src/patient-registration/field/person-attributes/text-person-attribute-field.component.tsx +1 -1
  65. package/src/patient-registration/field/phone/phone-field.component.tsx +16 -0
  66. package/src/patient-registration/form-manager.test.ts +1 -1
  67. package/src/patient-registration/form-manager.ts +22 -24
  68. package/src/patient-registration/input/basic-input/select/select-input.test.tsx +3 -3
  69. package/src/patient-registration/input/custom-input/autosuggest/autosuggest.component.tsx +5 -5
  70. package/src/patient-registration/input/custom-input/autosuggest/autosuggest.test.tsx +70 -58
  71. package/src/patient-registration/input/custom-input/identifier/identifier-input.component.tsx +2 -2
  72. package/src/patient-registration/input/custom-input/identifier/identifier-input.test.tsx +2 -5
  73. package/src/patient-registration/input/custom-input/identifier/utils.ts +1 -1
  74. package/src/patient-registration/input/dummy-data/dummy-data-input.component.tsx +1 -1
  75. package/src/patient-registration/input/dummy-data/dummy-data-input.test.tsx +6 -6
  76. package/src/patient-registration/patient-registration-context.ts +3 -4
  77. package/src/patient-registration/patient-registration-hooks.ts +25 -20
  78. package/src/patient-registration/patient-registration-utils.ts +7 -7
  79. package/src/patient-registration/patient-registration.component.tsx +20 -10
  80. package/src/patient-registration/patient-registration.resource.test.tsx +3 -3
  81. package/src/patient-registration/{patient-registration.resource.tsx → patient-registration.resource.ts} +15 -15
  82. package/src/patient-registration/patient-registration.test.tsx +270 -251
  83. package/src/patient-registration/{patient-registration.types.tsx → patient-registration.types.ts} +12 -3
  84. package/src/patient-registration/section/death-info/death-info-section.test.tsx +33 -45
  85. package/src/patient-registration/section/demographics/demographics-section.test.tsx +1 -2
  86. package/src/patient-registration/section/generic-section.component.tsx +1 -1
  87. package/src/patient-registration/section/patient-relationships/relationships-section.component.tsx +3 -3
  88. package/src/patient-registration/section/patient-relationships/relationships-section.test.tsx +17 -5
  89. package/src/patient-registration/section/patient-relationships/relationships.resource.tsx +4 -4
  90. package/src/patient-registration/section/section-wrapper.component.tsx +1 -1
  91. package/src/patient-registration/section/section.component.tsx +1 -1
  92. package/src/patient-registration/validation/patient-registration-validation.test.tsx +140 -126
  93. package/src/patient-registration/validation/patient-registration-validation.tsx +54 -46
  94. package/src/patient-verification/patient-verification-hook.tsx +13 -4
  95. package/src/patient-verification/patient-verification-utils.ts +20 -12
  96. package/src/patient-verification/patient-verification.component.tsx +13 -6
  97. package/src/patient-verification/patient-verification.scss +0 -1
  98. package/src/patient-verification/verification-modal/confirm-prompt.component.tsx +2 -11
  99. package/src/routes.json +1 -0
  100. package/src/widgets/cancel-patient-edit.test.tsx +7 -4
  101. package/src/widgets/delete-identifier-confirmation-modal.test.tsx +7 -4
  102. package/src/widgets/display-photo.test.tsx +1 -1
  103. package/src/widgets/edit-patient-details-button.test.tsx +12 -7
  104. package/translations/am.json +30 -14
  105. package/translations/ar.json +30 -14
  106. package/translations/en.json +11 -11
  107. package/translations/es.json +34 -22
  108. package/translations/fr.json +48 -40
  109. package/translations/he.json +22 -2
  110. package/translations/km.json +22 -2
  111. package/translations/zh.json +97 -0
  112. package/translations/zh_CN.json +97 -0
  113. package/tsconfig.json +1 -1
  114. package/__mocks__/autogenerationoptions.mock.ts +0 -34
  115. package/dist/388.js +0 -2
  116. package/dist/388.js.map +0 -1
  117. package/dist/598.js +0 -1
  118. package/dist/598.js.map +0 -1
  119. package/dist/openmrs-esm-patient-registration-app.js.map +0 -1
  120. package/src/patient-registration/field/__mocks__/identifier-types.mock.ts +0 -76
  121. package/src/patient-registration/field/__mocks__/identifiers.mock.ts +0 -27
  122. package/src/patient-registration/field/address/tests/mocks.ts +0 -98
@@ -1,4 +1,4 @@
1
- import { openmrsFetch } from '@openmrs/esm-framework';
1
+ import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
2
2
  import { savePatient } from './patient-registration.resource';
3
3
 
4
4
  const mockOpenmrsFetch = openmrsFetch as jest.Mock;
@@ -15,12 +15,12 @@ describe('savePatient', () => {
15
15
  it('appends patient uuid in url if provided', () => {
16
16
  mockOpenmrsFetch.mockImplementationOnce((url) => url);
17
17
  savePatient(null, '1234');
18
- expect(mockOpenmrsFetch.mock.calls[0][0]).toEqual('/ws/rest/v1/patient/1234');
18
+ expect(mockOpenmrsFetch.mock.calls[0][0]).toEqual(`${restBaseUrl}/patient/1234`);
19
19
  });
20
20
 
21
21
  it('does not append patient uuid in url', () => {
22
22
  mockOpenmrsFetch.mockImplementationOnce(() => {});
23
23
  savePatient(null);
24
- expect(mockOpenmrsFetch.mock.calls[0][0]).toEqual('/ws/rest/v1/patient/');
24
+ expect(mockOpenmrsFetch.mock.calls[0][0]).toEqual(`${restBaseUrl}/patient/`);
25
25
  });
26
26
  });
@@ -1,6 +1,6 @@
1
1
  import useSWR from 'swr';
2
- import { openmrsFetch, useConfig } from '@openmrs/esm-framework';
3
- import { Patient, Relationship, PatientIdentifier, Encounter } from './patient-registration.types';
2
+ import { openmrsFetch, restBaseUrl, useConfig } from '@openmrs/esm-framework';
3
+ import { type Patient, type Relationship, type PatientIdentifier, type Encounter } from './patient-registration.types';
4
4
 
5
5
  export const uuidIdentifier = '05a29f94-c0ed-11e2-94be-8c13b969e334';
6
6
  export const uuidTelephoneNumber = '14d4f066-15f5-102d-96e4-000c29c2a5d7';
@@ -22,7 +22,7 @@ function dataURItoFile(dataURI: string) {
22
22
  export function savePatient(patient: Patient | null, updatePatientUuid?: string) {
23
23
  const abortController = new AbortController();
24
24
 
25
- return openmrsFetch(`/ws/rest/v1/patient/${updatePatientUuid || ''}`, {
25
+ return openmrsFetch(`${restBaseUrl}/patient/${updatePatientUuid || ''}`, {
26
26
  headers: {
27
27
  'Content-Type': 'application/json',
28
28
  },
@@ -35,7 +35,7 @@ export function savePatient(patient: Patient | null, updatePatientUuid?: string)
35
35
  export function saveEncounter(encounter: Encounter) {
36
36
  const abortController = new AbortController();
37
37
 
38
- return openmrsFetch(`/ws/rest/v1/encounter`, {
38
+ return openmrsFetch(`${restBaseUrl}/encounter`, {
39
39
  headers: {
40
40
  'Content-Type': 'application/json',
41
41
  },
@@ -48,7 +48,7 @@ export function saveEncounter(encounter: Encounter) {
48
48
  export function generateIdentifier(source: string) {
49
49
  const abortController = new AbortController();
50
50
 
51
- return openmrsFetch(`/ws/rest/v1/idgen/identifiersource/${source}/identifier`, {
51
+ return openmrsFetch(`${restBaseUrl}/idgen/identifiersource/${source}/identifier`, {
52
52
  headers: {
53
53
  'Content-Type': 'application/json',
54
54
  },
@@ -61,7 +61,7 @@ export function generateIdentifier(source: string) {
61
61
  export function deletePersonName(nameUuid: string, personUuid: string) {
62
62
  const abortController = new AbortController();
63
63
 
64
- return openmrsFetch(`/ws/rest/v1/person/${personUuid}/name/${nameUuid}`, {
64
+ return openmrsFetch(`${restBaseUrl}/person/${personUuid}/name/${nameUuid}`, {
65
65
  method: 'DELETE',
66
66
  signal: abortController.signal,
67
67
  });
@@ -70,7 +70,7 @@ export function deletePersonName(nameUuid: string, personUuid: string) {
70
70
  export function saveRelationship(relationship: Relationship) {
71
71
  const abortController = new AbortController();
72
72
 
73
- return openmrsFetch('/ws/rest/v1/relationship', {
73
+ return openmrsFetch(`${restBaseUrl}/relationship`, {
74
74
  headers: {
75
75
  'Content-Type': 'application/json',
76
76
  },
@@ -83,7 +83,7 @@ export function saveRelationship(relationship: Relationship) {
83
83
  export function updateRelationship(relationshipUuid, relationship: { relationshipType: string }) {
84
84
  const abortController = new AbortController();
85
85
 
86
- return openmrsFetch(`/ws/rest/v1/relationship/${relationshipUuid}`, {
86
+ return openmrsFetch(`${restBaseUrl}/relationship/${relationshipUuid}`, {
87
87
  headers: {
88
88
  'Content-Type': 'application/json',
89
89
  },
@@ -96,7 +96,7 @@ export function updateRelationship(relationshipUuid, relationship: { relationshi
96
96
  export function deleteRelationship(relationshipUuid) {
97
97
  const abortController = new AbortController();
98
98
 
99
- return openmrsFetch(`/ws/rest/v1/relationship/${relationshipUuid}`, {
99
+ return openmrsFetch(`${restBaseUrl}/relationship/${relationshipUuid}`, {
100
100
  headers: {
101
101
  'Content-Type': 'application/json',
102
102
  },
@@ -161,7 +161,7 @@ export function usePatientPhoto(patientUuid: string): UsePatientPhotoResult {
161
161
  const {
162
162
  concepts: { patientPhotoUuid },
163
163
  } = useConfig();
164
- const url = `/ws/rest/v1/obs?patient=${patientUuid}&concept=${patientPhotoUuid}&v=full`;
164
+ const url = `${restBaseUrl}/obs?patient=${patientUuid}&concept=${patientPhotoUuid}&v=full`;
165
165
 
166
166
  const { data, error, isLoading } = useSWR<{ data: ObsFetchResponse }, Error>(patientUuid ? url : null, openmrsFetch);
167
167
 
@@ -181,10 +181,10 @@ export function usePatientPhoto(patientUuid: string): UsePatientPhotoResult {
181
181
 
182
182
  export async function fetchPerson(query: string, abortController: AbortController) {
183
183
  const [patientsRes, personsRes] = await Promise.all([
184
- openmrsFetch(`/ws/rest/v1/patient?q=${query}`, {
184
+ openmrsFetch(`${restBaseUrl}/patient?q=${query}`, {
185
185
  signal: abortController.signal,
186
186
  }),
187
- openmrsFetch(`/ws/rest/v1/person?q=${query}`, {
187
+ openmrsFetch(`${restBaseUrl}/person?q=${query}`, {
188
188
  signal: abortController.signal,
189
189
  }),
190
190
  ]);
@@ -202,7 +202,7 @@ export async function fetchPerson(query: string, abortController: AbortControlle
202
202
 
203
203
  export async function addPatientIdentifier(patientUuid: string, patientIdentifier: PatientIdentifier) {
204
204
  const abortController = new AbortController();
205
- return openmrsFetch(`/ws/rest/v1/patient/${patientUuid}/identifier/`, {
205
+ return openmrsFetch(`${restBaseUrl}/patient/${patientUuid}/identifier/`, {
206
206
  method: 'POST',
207
207
  headers: {
208
208
  'Content-Type': 'application/json',
@@ -214,7 +214,7 @@ export async function addPatientIdentifier(patientUuid: string, patientIdentifie
214
214
 
215
215
  export async function updatePatientIdentifier(patientUuid: string, identifierUuid: string, identifier: string) {
216
216
  const abortController = new AbortController();
217
- return openmrsFetch(`/ws/rest/v1/patient/${patientUuid}/identifier/${identifierUuid}`, {
217
+ return openmrsFetch(`${restBaseUrl}/patient/${patientUuid}/identifier/${identifierUuid}`, {
218
218
  method: 'POST',
219
219
  headers: {
220
220
  'Content-Type': 'application/json',
@@ -226,7 +226,7 @@ export async function updatePatientIdentifier(patientUuid: string, identifierUui
226
226
 
227
227
  export async function deletePatientIdentifier(patientUuid: string, patientIdentifierUuid: string) {
228
228
  const abortController = new AbortController();
229
- return openmrsFetch(`/ws/rest/v1/patient/${patientUuid}/identifier/${patientIdentifierUuid}?purge`, {
229
+ return openmrsFetch(`${restBaseUrl}/patient/${patientUuid}/identifier/${patientIdentifierUuid}?purge`, {
230
230
  method: 'DELETE',
231
231
  headers: {
232
232
  'Content-Type': 'application/json',