@kenyaemr/esm-patient-registration-app 6.0.1-pre.1.0.5 → 6.0.2

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/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.24.0"},"pages":[{"component":"root","route":"patient-registration","online":true,"offline":true},{"component":"editPatient","routeRegex":"patient\\/([a-zA-Z0-9\\-]+)\\/edit","online":true,"offline":true}],"extensions":[{"component":"addPatientLink","name":"add-patient-action","slot":"top-nav-actions-slot","online":true,"offline":true},{"component":"cancelPatientEditModal","name":"cancel-patient-edit-modal","online":true,"offline":true},{"component":"patientPhotoExtension","name":"patient-photo-widget","slot":"patient-photo-slot","online":true,"offline":true},{"component":"editPatientDetailsButton","name":"edit-patient-details-button","slot":"patient-actions-slot","online":true,"offline":true},{"component":"editPatientDetailsButton","name":"edit-patient-details-button","slot":"patient-search-actions-slot","online":true,"offline":true},{"component":"deleteIdentifierConfirmationModal","name":"delete-identifier-confirmation-modal","online":true,"offline":true},{"component":"emptyClientRegistryModal","name":"empty-client-registry-modal","online":true,"offline":true},{"component":"confirmClientRegistryModal","name":"confirm-client-registry-modal","online":true,"offline":true}],"version":"6.0.1-pre.1.0.4"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.24.0"},"pages":[{"component":"root","route":"patient-registration","online":true,"offline":true},{"component":"editPatient","routeRegex":"patient\\/([a-zA-Z0-9\\-]+)\\/edit","online":true,"offline":true}],"extensions":[{"component":"addPatientLink","name":"add-patient-action","slot":"top-nav-actions-slot","online":true,"offline":true},{"component":"cancelPatientEditModal","name":"cancel-patient-edit-modal","online":true,"offline":true},{"component":"patientPhotoExtension","name":"patient-photo-widget","slot":"patient-photo-slot","online":true,"offline":true},{"component":"editPatientDetailsButton","name":"edit-patient-details-button","slot":"patient-actions-slot","online":true,"offline":true},{"component":"editPatientDetailsButton","name":"edit-patient-details-button","slot":"patient-search-actions-slot","online":true,"offline":true},{"component":"deleteIdentifierConfirmationModal","name":"delete-identifier-confirmation-modal","online":true,"offline":true},{"component":"emptyClientRegistryModal","name":"empty-client-registry-modal","online":true,"offline":true},{"component":"confirmClientRegistryModal","name":"confirm-client-registry-modal","online":true,"offline":true}],"version":"6.0.1-pre.1.0.6"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kenyaemr/esm-patient-registration-app",
3
- "version": "6.0.1-pre.1.0.5",
3
+ "version": "6.0.2",
4
4
  "description": "Patient registration microfrontend for the OpenMRS SPA",
5
5
  "browser": "dist/kenyaemr-esm-patient-registration-app.js",
6
6
  "main": "src/index.ts",
@@ -189,7 +189,6 @@ export class FormManager {
189
189
  );
190
190
  } else {
191
191
  const encounterToSave: Encounter = {
192
- encounterDatetime: new Date(),
193
192
  patient: savePatientResponse.data.uuid,
194
193
  encounterType: config.registrationObs.encounterTypeUuid,
195
194
  location: currentLocation,
@@ -121,6 +121,26 @@ export const PatientRegistration: React.FC<PatientRegistrationProps> = ({ savePa
121
121
 
122
122
  setTarget(redirectUrl);
123
123
  } catch (error) {
124
+ const fieldErrors = Object.entries(error.responseBody?.error?.fieldErrors || {}) as Array<
125
+ [string, Array<{ code: string; message: string }>]
126
+ >;
127
+
128
+ if (savePatientTransactionManager.current.patientSaved) {
129
+ fieldErrors.forEach(([field, error]) => {
130
+ const errorMessage = error.map((e) => e.message).join(', ');
131
+ showSnackbar({
132
+ subtitle: errorMessage,
133
+ title: `Patient registration successful, with errors for registration encounter`,
134
+ kind: 'warning',
135
+ timeoutInMs: 8000,
136
+ });
137
+ });
138
+ const afterUrl = new URLSearchParams(search).get('afterUrl');
139
+ const redirectUrl = interpolateUrl(afterUrl || config.links.submitButton, { patientUuid: values.patientUuid });
140
+
141
+ setTarget(redirectUrl);
142
+ }
143
+
124
144
  if (error.responseBody?.error?.globalErrors) {
125
145
  error.responseBody.error.globalErrors.forEach((error) => {
126
146
  showSnackbar({
@@ -141,6 +161,7 @@ export const PatientRegistration: React.FC<PatientRegistrationProps> = ({ savePa
141
161
  });
142
162
  } else {
143
163
  createErrorHandler()(error);
164
+ console.error(error);
144
165
  }
145
166
 
146
167
  helpers.setSubmitting(false);
@@ -118,7 +118,7 @@ export type Patient = {
118
118
  };
119
119
 
120
120
  export interface Encounter {
121
- encounterDatetime: Date;
121
+ encounterDatetime?: Date;
122
122
  patient: string;
123
123
  encounterType: string;
124
124
  location: string;
@@ -177,7 +177,11 @@ export const RelationshipsSection = () => {
177
177
  uuid: type.uuid,
178
178
  direction: 'bIsToA',
179
179
  };
180
- aIsToB.display === bIsToA.display ? tmp.push(aIsToB) : tmp.push(aIsToB, bIsToA);
180
+ aIsToB.display === bIsToA.display
181
+ ? tmp.push(aIsToB)
182
+ : bIsToA.display === 'Patient'
183
+ ? tmp.push(aIsToB, { display: `Patient (${aIsToB.display})`, uuid: type.uuid, direction: 'bIsToA' })
184
+ : tmp.push(aIsToB, bIsToA);
181
185
  });
182
186
  setDisplayRelationshipTypes(tmp);
183
187
  }
@@ -7,5 +7,5 @@ export const countries = [
7
7
  export const verificationIdentifierTypes = [
8
8
  { name: 'National ID', value: 'national-id' },
9
9
  { name: 'Passport', value: 'passport' },
10
- { name: 'Birth certificate number', value: 'birth-certificate-number' },
10
+ { name: 'Birth certificate number', value: 'birth-certificate' },
11
11
  ];
@@ -62,7 +62,7 @@ export function handleClientRegistryResponse(
62
62
  required: false,
63
63
  identifierTypeUuid: '49af6cdc-7968-4abb-bf46-de10d7f4859f',
64
64
  identifierName: 'National ID',
65
- identifierValue: identifications !== undefined && identifications[0]?.identificationNumber?.trim(),
65
+ identifierValue: identifications !== undefined && identifications[0]?.identificationNumber,
66
66
  },
67
67
 
68
68
  ['nationalUniquePatientIdentifier']: {
@@ -81,9 +81,9 @@ export function handleClientRegistryResponse(
81
81
  onConfirm: () => {
82
82
  props.setValues({
83
83
  ...props.values,
84
- familyName: lastName?.trim() ?? '',
85
- middleName: middleName?.trim() ?? '',
86
- givenName: firstName.trim() ?? '',
84
+ familyName: lastName,
85
+ middleName: middleName,
86
+ givenName: firstName,
87
87
  gender: clientResponse.client.gender,
88
88
  birthdate: new Date(dateOfBirth),
89
89
  isDead: !isAlive,
@@ -4,7 +4,7 @@ import { Tile, ComboBox, Layer, Button, Search, InlineLoading, InlineNotificatio
4
4
  import styles from './patient-verification.scss';
5
5
  import { countries, verificationIdentifierTypes } from './assets/verification-assets';
6
6
  import { searchClientRegistry, useGlobalProperties } from './patient-verification-hook';
7
- import { showSnackbar } from '@openmrs/esm-framework';
7
+ import { showSnackbar, showToast } from '@openmrs/esm-framework';
8
8
  import { handleClientRegistryResponse } from './patient-verification-utils';
9
9
  import { type FormikProps } from 'formik';
10
10
  import { type FormValues } from '../patient-registration/patient-registration.types';
@@ -57,6 +57,20 @@ const PatientVerification: React.FC<PatientVerificationProps> = ({ props }) => {
57
57
  <Layer>
58
58
  {isLoading && <InlineLoading status="active" iconDescription="Loading" description="Loading data..." />}
59
59
  </Layer>
60
+ {error && (
61
+ <InlineNotification
62
+ className={styles.errorWrapper}
63
+ aria-label="closes notification"
64
+ kind="error"
65
+ lowContrast
66
+ statusIconDescription="notification"
67
+ subtitle={t(
68
+ 'clientRegistryErrorSubtitle',
69
+ 'Please proceed with registration contact system admin and try again later',
70
+ )}
71
+ title={t('clientRegistryError', 'Error occurred while reaching the client registry')}
72
+ />
73
+ )}
60
74
  <Tile className={styles.verificationWrapper}>
61
75
  <Layer>
62
76
  <ComboBox
@@ -68,7 +82,7 @@ const PatientVerification: React.FC<PatientVerificationProps> = ({ props }) => {
68
82
  titleText={t('selectCountry', 'Select country')}
69
83
  initialSelectedItem={countries[0]}
70
84
  onChange={({ selectedItem }) =>
71
- setVerificationCriteria({ ...verificationCriteria, countryCode: selectedItem.initials })
85
+ setVerificationCriteria({ ...verificationCriteria, countryCode: selectedItem?.initials })
72
86
  }
73
87
  />
74
88
  </Layer>
@@ -81,7 +95,7 @@ const PatientVerification: React.FC<PatientVerificationProps> = ({ props }) => {
81
95
  label="Select identifier type"
82
96
  titleText={t('selectIdentifierType', 'Select identifier type')}
83
97
  onChange={({ selectedItem }) =>
84
- setVerificationCriteria({ ...verificationCriteria, identifierType: selectedItem.value })
98
+ setVerificationCriteria({ ...verificationCriteria, identifierType: selectedItem?.value })
85
99
  }
86
100
  />
87
101
  </Layer>
@@ -103,18 +117,6 @@ const PatientVerification: React.FC<PatientVerificationProps> = ({ props }) => {
103
117
  )}
104
118
  </Tile>
105
119
  </div>
106
- {error && (
107
- <Tile className={styles.errorWrapper}>
108
- <InlineNotification
109
- aria-label="closes notification"
110
- kind="error"
111
- statusIconDescription="notification"
112
- subtitle="Access to national client registry may be blocked by a proxy server. Please proceed with registration and try again later. Contact your system administrator if the issue persists."
113
- title="Error: Failed to reach client registry."
114
- lowContrast={true}
115
- />
116
- </Tile>
117
- )}
118
120
  </div>
119
121
  );
120
122
  };
@@ -21,9 +21,5 @@
21
21
  }
22
22
 
23
23
  .errorWrapper {
24
- color: colors.$red-50;
25
24
  margin: 0 0 1rem 0;
26
- display: flex;
27
- justify-content: center;
28
- align-items: center;
29
25
  }
@@ -39,7 +39,7 @@ const ConfirmPrompt: React.FC<ConfirmPromptProps> = ({ close, onConfirm, patient
39
39
  <div style={{ display: 'flex', margin: '1rem' }}>
40
40
  <ExtensionSlot
41
41
  style={{ display: 'flex', alignItems: 'center' }}
42
- extensionSlotName="patient-photo-slot"
42
+ name="patient-photo-slot"
43
43
  state={{ patientName: `${patient?.firstName} ${patient?.lastName}` }}
44
44
  />
45
45
  <div style={{ width: '100%', marginLeft: '0.625rem' }}>
@@ -65,7 +65,7 @@
65
65
  "negativeYears": "Negative years",
66
66
  "no": "No",
67
67
  "numberInNameDubious": "Number in name is dubious",
68
- "nupi": "NUPI",
68
+ "NUPI": "",
69
69
  "obsFieldUnknownDatatype": "Concept for obs field '{{fieldDefinitionId}}' has unknown datatype '{{datatypeName}}'",
70
70
  "optional": "optional",
71
71
  "other": "Other",
@@ -97,7 +97,7 @@
97
97
  "selectCountry": "Select country",
98
98
  "selectIdentifierType": "Select identifier type",
99
99
  "sexFieldLabelText": "Sex",
100
- "shaNumber": "SHA Number",
100
+ "SHA Number": "",
101
101
  "source": "Source",
102
102
  "stroke": "Stroke",
103
103
  "submitting": "Submitting",
@@ -45,7 +45,7 @@
45
45
  "givenNameLabelText": "名字",
46
46
  "givenNameRequired": "名字是必填项",
47
47
  "identifierValueRequired": "ID标识是必填项",
48
- "idFieldLabelText": "ID标识",
48
+ "idFieldLabelText": "ID",
49
49
  "IDInstructions": "选择您想为该患者添加的ID标识:",
50
50
  "incompleteForm": "表单未填完",
51
51
  "invalidEmail": "需要提供一个有效的电子邮件地址",
@@ -45,7 +45,7 @@
45
45
  "givenNameLabelText": "名字",
46
46
  "givenNameRequired": "名字是必填项",
47
47
  "identifierValueRequired": "ID标识是必填项",
48
- "idFieldLabelText": "ID标识",
48
+ "idFieldLabelText": "ID",
49
49
  "IDInstructions": "选择您想为该患者添加的ID标识:",
50
50
  "incompleteForm": "表单未填完",
51
51
  "invalidEmail": "需要提供一个有效的电子邮件地址",