@kenyaemr/esm-patient-registration-app 6.0.1-pre.1.0.4 → 6.0.1-pre.1.0.6

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.3"}
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-local.0"}
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.4",
3
+ "version": "6.0.1-pre.1.0.6",
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",
@@ -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;
@@ -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,
@@ -1,10 +1,10 @@
1
1
  import React, { useState } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
- import { Tile, ComboBox, Layer, Button, Search, InlineLoading, InlineNotification } from '@carbon/react';
3
+ import { Tile, ComboBox, Layer, Button, Search, InlineLoading } from '@carbon/react';
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';
@@ -48,17 +48,10 @@ const PatientVerification: React.FC<PatientVerificationProps> = ({ props }) => {
48
48
  }
49
49
  };
50
50
 
51
- if (!error) {
51
+ if (error) {
52
52
  return (
53
53
  <Tile className={styles.errorWrapper}>
54
- <InlineNotification
55
- aria-label="closes notification"
56
- kind="error"
57
- statusIconDescription="notification"
58
- 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."
59
- title="Error: Failed to reach client registry."
60
- lowContrast={true}
61
- />
54
+ <p>Error occurred while reaching the client registry, please proceed with registration and try again later</p>
62
55
  </Tile>
63
56
  );
64
57
  }
@@ -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",