@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.
- package/dist/130.js +1 -1
- package/dist/130.js.map +1 -1
- package/dist/271.js +1 -0
- package/dist/319.js +1 -1
- package/dist/330.js +1 -1
- package/dist/460.js +1 -1
- package/dist/537.js +1 -1
- package/dist/574.js +1 -1
- package/dist/59.js +1 -1
- package/dist/59.js.map +1 -1
- package/dist/619.js +1 -0
- package/dist/619.js.map +1 -0
- package/dist/644.js +1 -0
- package/dist/735.js +1 -1
- package/dist/757.js +1 -1
- package/dist/784.js +1 -1
- package/dist/788.js +1 -1
- package/dist/807.js +1 -1
- package/dist/833.js +1 -1
- package/dist/895.js +2 -0
- package/dist/{388.js.LICENSE.txt → 895.js.LICENSE.txt} +4 -2
- package/dist/895.js.map +1 -0
- package/dist/{openmrs-esm-patient-registration-app.js → kenyaemr-esm-patient-registration-app.js} +1 -1
- package/dist/{openmrs-esm-patient-registration-app.js.buildmanifest.json → kenyaemr-esm-patient-registration-app.js.buildmanifest.json} +117 -73
- package/dist/kenyaemr-esm-patient-registration-app.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.LICENSE.txt +4 -2
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +6 -5
- package/src/add-patient-link.test.tsx +9 -7
- package/src/config-schema.ts +31 -38
- package/src/constants.ts +1 -1
- package/src/offline.resources.ts +13 -18
- package/src/offline.ts +8 -6
- package/src/patient-registration/before-save-prompt.tsx +2 -1
- package/src/patient-registration/field/__mocks__/field.resource.ts +1 -1
- package/src/patient-registration/field/address/address-field.component.tsx +5 -4
- package/src/patient-registration/field/address/address-hierarchy.resource.tsx +2 -2
- package/src/patient-registration/field/address/address-search.component.tsx +1 -14
- package/src/patient-registration/field/address/custom-address-field.component.tsx +1 -1
- package/src/patient-registration/field/address/tests/address-hierarchy.test.tsx +3 -3
- package/src/patient-registration/field/address/tests/address-search-component.test.tsx +14 -7
- package/src/patient-registration/field/custom-field.component.tsx +1 -1
- package/src/patient-registration/field/dob/dob.component.tsx +2 -2
- package/src/patient-registration/field/dob/dob.test.tsx +0 -3
- package/src/patient-registration/field/field.component.tsx +4 -1
- package/src/patient-registration/field/field.resource.ts +4 -4
- package/src/patient-registration/field/field.test.tsx +98 -95
- package/src/patient-registration/field/gender/gender-field.component.tsx +4 -4
- package/src/patient-registration/field/gender/gender-field.test.tsx +7 -14
- package/src/patient-registration/field/id/id-field.component.tsx +6 -6
- package/src/patient-registration/field/id/id-field.test.tsx +9 -7
- package/src/patient-registration/field/id/identifier-selection-overlay.component.tsx +1 -1
- package/src/patient-registration/field/name/name-field.component.tsx +1 -1
- package/src/patient-registration/field/obs/obs-field.component.tsx +35 -33
- package/src/patient-registration/field/obs/obs-field.test.tsx +106 -28
- package/src/patient-registration/field/person-attributes/coded-attributes.component.tsx +1 -1
- package/src/patient-registration/field/person-attributes/coded-person-attribute-field.component.tsx +70 -24
- package/src/patient-registration/field/person-attributes/coded-person-attribute-field.test.tsx +54 -30
- package/src/patient-registration/field/person-attributes/person-attribute-field.component.tsx +4 -3
- package/src/patient-registration/field/person-attributes/person-attribute-field.test.tsx +1 -1
- package/src/patient-registration/field/person-attributes/{person-attributes.resource.tsx → person-attributes.resource.ts} +3 -3
- package/src/patient-registration/field/person-attributes/text-person-attribute-field.component.tsx +1 -1
- package/src/patient-registration/field/phone/phone-field.component.tsx +16 -0
- package/src/patient-registration/form-manager.test.ts +1 -1
- package/src/patient-registration/form-manager.ts +22 -24
- package/src/patient-registration/input/basic-input/select/select-input.test.tsx +3 -3
- package/src/patient-registration/input/custom-input/autosuggest/autosuggest.component.tsx +5 -5
- package/src/patient-registration/input/custom-input/autosuggest/autosuggest.test.tsx +70 -58
- package/src/patient-registration/input/custom-input/identifier/identifier-input.component.tsx +2 -2
- package/src/patient-registration/input/custom-input/identifier/identifier-input.test.tsx +2 -5
- package/src/patient-registration/input/custom-input/identifier/utils.ts +1 -1
- package/src/patient-registration/input/dummy-data/dummy-data-input.component.tsx +1 -1
- package/src/patient-registration/input/dummy-data/dummy-data-input.test.tsx +6 -6
- package/src/patient-registration/patient-registration-context.ts +3 -4
- package/src/patient-registration/patient-registration-hooks.ts +25 -20
- package/src/patient-registration/patient-registration-utils.ts +7 -7
- package/src/patient-registration/patient-registration.component.tsx +20 -10
- package/src/patient-registration/patient-registration.resource.test.tsx +3 -3
- package/src/patient-registration/{patient-registration.resource.tsx → patient-registration.resource.ts} +15 -15
- package/src/patient-registration/patient-registration.test.tsx +270 -251
- package/src/patient-registration/{patient-registration.types.tsx → patient-registration.types.ts} +12 -3
- package/src/patient-registration/section/death-info/death-info-section.test.tsx +33 -45
- package/src/patient-registration/section/demographics/demographics-section.test.tsx +1 -2
- package/src/patient-registration/section/generic-section.component.tsx +1 -1
- package/src/patient-registration/section/patient-relationships/relationships-section.component.tsx +3 -3
- package/src/patient-registration/section/patient-relationships/relationships-section.test.tsx +17 -5
- package/src/patient-registration/section/patient-relationships/relationships.resource.tsx +4 -4
- package/src/patient-registration/section/section-wrapper.component.tsx +1 -1
- package/src/patient-registration/section/section.component.tsx +1 -1
- package/src/patient-registration/validation/patient-registration-validation.test.tsx +140 -126
- package/src/patient-registration/validation/patient-registration-validation.tsx +54 -46
- package/src/patient-verification/patient-verification-hook.tsx +13 -4
- package/src/patient-verification/patient-verification-utils.ts +20 -12
- package/src/patient-verification/patient-verification.component.tsx +13 -6
- package/src/patient-verification/patient-verification.scss +0 -1
- package/src/patient-verification/verification-modal/confirm-prompt.component.tsx +2 -11
- package/src/routes.json +1 -0
- package/src/widgets/cancel-patient-edit.test.tsx +7 -4
- package/src/widgets/delete-identifier-confirmation-modal.test.tsx +7 -4
- package/src/widgets/display-photo.test.tsx +1 -1
- package/src/widgets/edit-patient-details-button.test.tsx +12 -7
- package/translations/am.json +30 -14
- package/translations/ar.json +30 -14
- package/translations/en.json +11 -11
- package/translations/es.json +34 -22
- package/translations/fr.json +48 -40
- package/translations/he.json +22 -2
- package/translations/km.json +22 -2
- package/translations/zh.json +97 -0
- package/translations/zh_CN.json +97 -0
- package/tsconfig.json +1 -1
- package/__mocks__/autogenerationoptions.mock.ts +0 -34
- package/dist/388.js +0 -2
- package/dist/388.js.map +0 -1
- package/dist/598.js +0 -1
- package/dist/598.js.map +0 -1
- package/dist/openmrs-esm-patient-registration-app.js.map +0 -1
- package/src/patient-registration/field/__mocks__/identifier-types.mock.ts +0 -76
- package/src/patient-registration/field/__mocks__/identifiers.mock.ts +0 -27
- 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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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 =
|
|
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(
|
|
184
|
+
openmrsFetch(`${restBaseUrl}/patient?q=${query}`, {
|
|
185
185
|
signal: abortController.signal,
|
|
186
186
|
}),
|
|
187
|
-
openmrsFetch(
|
|
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(
|
|
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(
|
|
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(
|
|
229
|
+
return openmrsFetch(`${restBaseUrl}/patient/${patientUuid}/identifier/${patientIdentifierUuid}?purge`, {
|
|
230
230
|
method: 'DELETE',
|
|
231
231
|
headers: {
|
|
232
232
|
'Content-Type': 'application/json',
|