@digihmis/esm-patient-registration-app 1.0.0 → 1.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":{"fhir2":">=1.2","webservices.rest":"^2.24.0"},"extensions":[{"name":"registration-dashboard-link","slot":"registration-dashboard-slot","component":"leftPanelLink","meta":{"name":"patient-registration","slot":"registration-homepage-dashboard-slot","title":"search"}},{"name":"search-dashboard","slot":"search-dashboard-slot","component":"searchDashboard"},{"name":"registration-form","slot":"registration-form-slot","component":"registrationForm"},{"name":"visit-tag","slot":"patient-banner-tags-slot","component":"visitTag","online":true,"offline":true},{"name":"deceased-patient-tag","slot":"patient-banner-tags-slot","component":"deceasedPatientTag","online":true,"offline":true}],"workspaces":[{"name":"configure-identifiers","component":"identifierConfigureForm","title":"configureIdentifiersForm","type":"other-form","canMaximize":true,"width":"extra-wide"},{"name":"check-in-form","component":"checkInWorkspace","title":"checkInFormTitle","type":"other-form","canMaximize":true,"width":"extra-wide"}],"version":"1.0.0"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":">=2.24.0"},"extensions":[{"name":"registration-dashboard-link","slot":"registration-dashboard-slot","component":"leftPanelLink","meta":{"name":"patient-registration","slot":"registration-homepage-dashboard-slot","title":"search"}},{"name":"search-dashboard","slot":"search-dashboard-slot","component":"searchDashboard"},{"name":"registration-form","slot":"registration-form-slot","component":"registrationForm"},{"name":"visit-tag","slot":"patient-banner-tags-slot","component":"visitTag","online":true,"offline":true},{"name":"deceased-patient-tag","slot":"patient-banner-tags-slot","component":"deceasedPatientTag","online":true,"offline":true}],"workspaces":[{"name":"configure-identifiers","component":"identifierConfigureForm","title":"configureIdentifiersForm","type":"other-form","canMaximize":true,"width":"extra-wide"},{"name":"check-in-form","component":"checkInWorkspace","title":"checkInFormTitle","type":"other-form","canMaximize":true,"width":"extra-wide"}],"version":"1.0.2"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digihmis/esm-patient-registration-app",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Patient Registration microfrontend for the OpenMRS SPA",
5
5
  "browser": "dist/digihmis-esm-patient-registration-app.js",
6
6
  "main": "src/index.ts",
@@ -18,7 +18,8 @@
18
18
  "start": "openmrs develop",
19
19
  "test": "cross-env TZ=UTC jest --config jest.config.js --verbose false --passWithNoTests",
20
20
  "test:watch": "cross-env TZ=UTC jest --watch --config jest.config.js",
21
- "typescript": "tsc"
21
+ "typescript": "tsc",
22
+ "prepublishOnly": "rspack --mode=production"
22
23
  },
23
24
  "browserslist": [
24
25
  "extends browserslist-config-openmrs"
@@ -37,6 +38,7 @@
37
38
  "url": "https://github.com/its-kios09/DigiHMIS-apps/issues"
38
39
  },
39
40
  "dependencies": {
41
+ "@digihmis/esm-commons-lib": "1.0.0",
40
42
  "lodash-es": "^4.17.15",
41
43
  "react-to-print": "2.14.13"
42
44
  },
@@ -277,10 +277,6 @@ const CheckInWorkspace: React.FC<VisitFormProps> = ({
277
277
  ...(config.showExtraVisitAttributesSlot && extraAttributes && { attributes: extraAttributes }),
278
278
  };
279
279
 
280
- if (config.showExtraVisitAttributesSlot) {
281
- handleCreateExtraVisitInfo?.();
282
- }
283
-
284
280
  const abortController = new AbortController();
285
281
  if (isOnline) {
286
282
  const visitRequest = visitToEdit?.uuid
@@ -331,6 +327,11 @@ const CheckInWorkspace: React.FC<VisitFormProps> = ({
331
327
  // to update visit attributes or any other OnVisitCreatedOrUpdated actions
332
328
  const visit = response.data;
333
329
 
330
+ // DigiHMIS bills are visit-scoped, so bill the check-in services now that the visit exists.
331
+ const billingRequest = config.showExtraVisitAttributesSlot
332
+ ? Promise.resolve(handleCreateExtraVisitInfo?.(visit?.uuid))
333
+ : Promise.resolve();
334
+
334
335
  // For visit creation, we need to update:
335
336
  // 1. Current visit data (for critical components like visit summary, action buttons)
336
337
  // 2. Visit history table (for the paginated visit list)
@@ -364,7 +365,7 @@ const CheckInWorkspace: React.FC<VisitFormProps> = ({
364
365
  callbacks.onVisitCreatedOrUpdated(visit),
365
366
  );
366
367
 
367
- return Promise.all([visitAttributesRequest, ...onVisitCreatedOrUpdatedRequests]);
368
+ return Promise.all([visitAttributesRequest, billingRequest, ...onVisitCreatedOrUpdatedRequests]);
368
369
  })
369
370
  .then(() => {
370
371
  closeWorkspace({ ignoreChanges: true });
@@ -375,7 +376,7 @@ const CheckInWorkspace: React.FC<VisitFormProps> = ({
375
376
  } else {
376
377
  createOfflineVisitForPatient(
377
378
  patientUuid,
378
- visitLocation.uuid,
379
+ visitLocation?.uuid,
379
380
  config.offlineVisitTypeUuid,
380
381
  payload.startDatetime,
381
382
  ).then(
@@ -26,7 +26,7 @@ export const configSchema: ConfigSchema = {
26
26
  },
27
27
  OpenmrsIdentifierTypeUuid: {
28
28
  _type: Type.String,
29
- _default: 'dfacd928-0370-4315-99d7-6ec1c9f7ae76',
29
+ _default: '8d793bee-c2cc-11de-8d13-0010c6dffd0f',
30
30
  _description: 'The UUID of the OpenMRS Identifier Type to be used as the main patient identifier.',
31
31
  },
32
32
  fieldConfigurations: {
@@ -51,6 +51,36 @@ export const configSchema: ConfigSchema = {
51
51
  _description: 'Whether cause of death field is required',
52
52
  },
53
53
  },
54
+ phone: {
55
+ _type: Type.Object,
56
+ _default: {
57
+ personAttributeUuid: '3af95db6-7634-4230-a433-1a003cb97c5c',
58
+ validation: { required: false, matches: '' },
59
+ },
60
+ _description: 'Configuration for the phone number field',
61
+ personAttributeUuid: {
62
+ _type: Type.String,
63
+ _default: '3af95db6-7634-4230-a433-1a003cb97c5c',
64
+ _description: 'The person attribute type UUID for the telephone contact',
65
+ },
66
+ validation: {
67
+ _type: Type.Object,
68
+ _default: { required: false, matches: '' },
69
+ _description: 'Validation rules for the phone number field',
70
+ },
71
+ },
72
+ email: {
73
+ _type: Type.Object,
74
+ _default: {
75
+ personAttributeUuid: '5d6639ba-75f3-4a3b-9517-f738d986b684',
76
+ },
77
+ _description: 'Configuration for the email address field',
78
+ personAttributeUuid: {
79
+ _type: Type.String,
80
+ _default: '5d6639ba-75f3-4a3b-9517-f738d986b684',
81
+ _description: 'The person attribute type UUID for the email address',
82
+ },
83
+ },
54
84
  gender: {
55
85
  _type: Type.Array,
56
86
  _default: [
@@ -422,6 +452,16 @@ export interface RegistrationConfig {
422
452
  conceptUuid: string;
423
453
  required: boolean;
424
454
  };
455
+ phone: {
456
+ personAttributeUuid: string;
457
+ validation: {
458
+ required: boolean;
459
+ matches: string;
460
+ };
461
+ };
462
+ email: {
463
+ personAttributeUuid: string;
464
+ };
425
465
  gender: Array<Gender>;
426
466
  };
427
467
  freeTextFieldConceptUuid: string;
@@ -1,17 +1,2 @@
1
- import React from 'react';
2
-
3
- interface IconWrapperProps {
4
- src: string;
5
- alt?: string;
6
- className?: string;
7
- style?: React.CSSProperties;
8
- }
9
-
10
- export const IconWrapper: React.FC<IconWrapperProps> = ({
11
- src,
12
- alt = 'Icon',
13
- className,
14
- style = { width: '100px', height: '148px' },
15
- }) => {
16
- return <img src={src} alt={alt} className={className} style={style} />;
17
- };
1
+ // Moved to the shared library so every app uses one implementation.
2
+ export { IconWrapper, type IconWrapperProps } from '@digihmis/esm-commons-lib';
@@ -1,35 +1,14 @@
1
1
  import React from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
- import { Calendar } from '@carbon/react/icons';
4
- import { useSession, formatDate, ExtensionSlot, useConfig } from '@openmrs/esm-framework';
5
- import styles from './page-header.scss';
6
- import { IconWrapper } from '../icon-wrapper/icon-wrapper.extension';
3
+ import { useConfig } from '@openmrs/esm-framework';
4
+ import { PageHeader as CommonPageHeader } from '@digihmis/esm-commons-lib';
7
5
  import { ConfigObject } from '../config-schema';
8
6
 
7
+ // The shared header lives in @digihmis/esm-commons-lib; this passes the module's title + icon.
9
8
  export const PageHeader: React.FC = () => {
10
9
  const { t } = useTranslation();
11
- const userSession = useSession();
12
10
  const { registrationIcon } = useConfig<ConfigObject>();
13
- const userLocation = userSession?.sessionLocation?.display;
14
-
15
11
  return (
16
- <div className={styles.header}>
17
- <div className={styles['left-justified-items']}>
18
- <IconWrapper src={registrationIcon.src} alt="Registration Dashboard Icon" />
19
- <div className={styles['page-labels']}>
20
- <p className={styles['page-name']}>{userLocation}</p>
21
- <p className={styles['page-subtitle']}>{t('search', 'Search')}</p>
22
- </div>
23
- </div>
24
- <div className={styles['right-justified-items']}>
25
- <div className={styles.extensionSlot}>
26
- <ExtensionSlot name={'provider-banner-slot'} />
27
- <div className={styles['date-and-location']}>
28
- <Calendar size={16} />
29
- <span className={styles.value}>{formatDate(new Date(), { mode: 'wide', noToday: true })}</span>
30
- </div>
31
- </div>
32
- </div>
33
- </div>
12
+ <CommonPageHeader title={t('search', 'Search')} iconSrc={registrationIcon.src} iconAlt="Registration Dashboard Icon" />
34
13
  );
35
14
  };
@@ -698,8 +698,13 @@ export const RegistrationForm: React.FC = () => {
698
698
  }
699
699
 
700
700
  const attributes = {};
701
- if (data.phoneNumber) {
702
- attributes['b2c38640-2603-4629-aebd-3b54f33f1e3a'] = data.phoneNumber;
701
+ const phoneAttributeUuid = fieldConfigurations?.phone?.personAttributeUuid;
702
+ if (data.phoneNumber && phoneAttributeUuid) {
703
+ attributes[phoneAttributeUuid] = data.phoneNumber;
704
+ }
705
+ const emailAttributeUuid = fieldConfigurations?.email?.personAttributeUuid;
706
+ if (data.email && emailAttributeUuid) {
707
+ attributes[emailAttributeUuid] = data.email;
703
708
  }
704
709
 
705
710
  const obs = {};
package/src/routes.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json.openmrs.org/routes.schema.json",
3
3
  "backendDependencies": {
4
4
  "fhir2": ">=1.2",
5
- "webservices.rest": "^2.24.0"
5
+ "webservices.rest": ">=2.24.0"
6
6
  },
7
7
  "extensions": [
8
8
  {
@@ -25,7 +25,7 @@
25
25
  "slot": "registration-form-slot",
26
26
  "component": "registrationForm"
27
27
  },
28
- {
28
+ {
29
29
  "name": "visit-tag",
30
30
  "slot": "patient-banner-tags-slot",
31
31
  "component": "visitTag",
@@ -44,9 +44,9 @@
44
44
  {
45
45
  "name": "configure-identifiers",
46
46
  "component": "identifierConfigureForm",
47
- "title": "configureIdentifiersForm",
47
+ "title": "configureIdentifiersForm",
48
48
  "type": "other-form",
49
- "canMaximize": true,
49
+ "canMaximize": true,
50
50
  "width": "extra-wide"
51
51
  },
52
52
  {
@@ -54,9 +54,8 @@
54
54
  "component": "checkInWorkspace",
55
55
  "title": "checkInFormTitle",
56
56
  "type": "other-form",
57
- "canMaximize": true,
57
+ "canMaximize": true,
58
58
  "width": "extra-wide"
59
59
  }
60
60
  ]
61
-
62
- }
61
+ }