@openmrs/esm-appointments-app 5.2.2-pre.2543 → 5.2.2-pre.2549

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.
@@ -80,10 +80,10 @@
80
80
  "initial": true,
81
81
  "entry": true,
82
82
  "recorded": false,
83
- "size": 4540859,
83
+ "size": 4540693,
84
84
  "sizes": {
85
85
  "consume-shared": 252,
86
- "javascript": 4519937,
86
+ "javascript": 4519771,
87
87
  "share-init": 252,
88
88
  "runtime": 20418
89
89
  },
@@ -100,7 +100,7 @@
100
100
  "auxiliaryFiles": [
101
101
  "main.js.map"
102
102
  ],
103
- "hash": "10a10d83a9e69f3d",
103
+ "hash": "d34c9a4e6044489a",
104
104
  "childrenByOrder": {}
105
105
  },
106
106
  {
@@ -490,9 +490,9 @@
490
490
  "initial": false,
491
491
  "entry": false,
492
492
  "recorded": false,
493
- "size": 482412,
493
+ "size": 482246,
494
494
  "sizes": {
495
- "javascript": 482244,
495
+ "javascript": 482078,
496
496
  "consume-shared": 168
497
497
  },
498
498
  "names": [],
@@ -506,7 +506,7 @@
506
506
  "auxiliaryFiles": [
507
507
  "799.js.map"
508
508
  ],
509
- "hash": "d45aa494f7825f6d",
509
+ "hash": "affd1fc4ba01bbb0",
510
510
  "childrenByOrder": {}
511
511
  },
512
512
  {
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.2.0"},"extensions":[{"name":"home-appointments","slot":"homepage-widgets-slot","component":"homeAppointments","order":1},{"name":"clinical-appointments-dashboard-link","slot":"homepage-dashboard-slot","component":"appointmentsDashboardLink","meta":{"name":"appointments","slot":"clinical-appointments-dashboard-slot","title":"Appointments"}},{"component":"root","name":"clinical-appointments-dashboard","slot":"clinical-appointments-dashboard-slot"},{"name":"appointments-calendar-dashboard-link","slot":"calendar-dashboard-slot","component":"appointmentsCalendarDashboardLink"},{"name":"check-in-appointment-modal","slot":"todays-appointment-slot","component":"checkInModal"},{"name":"todays-appointments-dashboard","slot":"todays-appointment-slot","component":"homeAppointments"},{"name":"expected-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"checked-in-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"completed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"missed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"cancelled-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"early-appointments-panel","component":"earlyAppointments"}],"version":"5.2.2-pre.2543"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.2.0"},"extensions":[{"name":"home-appointments","slot":"homepage-widgets-slot","component":"homeAppointments","order":1},{"name":"clinical-appointments-dashboard-link","slot":"homepage-dashboard-slot","component":"appointmentsDashboardLink","meta":{"name":"appointments","slot":"clinical-appointments-dashboard-slot","title":"Appointments"}},{"component":"root","name":"clinical-appointments-dashboard","slot":"clinical-appointments-dashboard-slot"},{"name":"appointments-calendar-dashboard-link","slot":"calendar-dashboard-slot","component":"appointmentsCalendarDashboardLink"},{"name":"check-in-appointment-modal","slot":"todays-appointment-slot","component":"checkInModal"},{"name":"todays-appointments-dashboard","slot":"todays-appointment-slot","component":"homeAppointments"},{"name":"expected-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"checked-in-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"completed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"missed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"cancelled-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"early-appointments-panel","component":"earlyAppointments"}],"version":"5.2.2-pre.2549"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-appointments-app",
3
- "version": "5.2.2-pre.2543",
3
+ "version": "5.2.2-pre.2549",
4
4
  "description": "Appointments front-end module for the OpenMRS SPA",
5
5
  "browser": "dist/openmrs-esm-appointments-app.js",
6
6
  "main": "src/index.ts",
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
4
4
  import { Form, Formik, type FormikHelpers } from 'formik';
5
5
  import { validationSchema } from './appointment-services-validation';
6
6
  import { useAppointmentServices } from './appointment-services-hook';
7
- import { showNotification, showToast, useLocations } from '@openmrs/esm-framework';
7
+ import { showSnackbar, useLocations } from '@openmrs/esm-framework';
8
8
  import type { AppointmentService } from '../../types';
9
9
  import { closeOverlay } from '../../hooks/useOverlay';
10
10
  import styles from './appointment-services.scss';
@@ -29,21 +29,20 @@ const AppointmentServices: React.FC<AppointmentServicesProps> = () => {
29
29
  addNewAppointmentService(payload).then(
30
30
  ({ status }) => {
31
31
  if (status === 200) {
32
- showToast({
33
- critical: true,
32
+ showSnackbar({
33
+ isLowContrast: true,
34
34
  kind: 'success',
35
- description: t('appointmentServiceCreate', 'Appointment service created successfully'),
35
+ subtitle: t('appointmentServiceCreate', 'Appointment service created successfully'),
36
36
  title: t('appointmentService', 'Appointment service'),
37
37
  });
38
38
  closeOverlay();
39
39
  }
40
40
  },
41
41
  (error) => {
42
- showNotification({
42
+ showSnackbar({
43
43
  title: t('errorCreatingAppointmentService', 'Error creating appointment service'),
44
44
  kind: 'error',
45
- critical: true,
46
- description: error?.message,
45
+ subtitle: error?.message,
47
46
  });
48
47
  },
49
48
  );
@@ -1,7 +1,7 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import { Button, Layer, TextArea } from '@carbon/react';
4
- import { useSession, showToast, showNotification, ExtensionSlot, usePatient } from '@openmrs/esm-framework';
4
+ import { useSession, showSnackbar, ExtensionSlot, usePatient } from '@openmrs/esm-framework';
5
5
  import { cancelAppointment } from '../forms.resource';
6
6
  import { useSWRConfig } from 'swr';
7
7
  import { useAppointmentDate } from '../../../helpers';
@@ -32,21 +32,20 @@ const CancelAppointment: React.FC<CancelAppointmentProps> = ({ appointment }) =>
32
32
  setIsSubmitting(true);
33
33
  const { status } = await cancelAppointment('Cancelled', appointment.id);
34
34
  if (status === 200) {
35
- showToast({
36
- critical: true,
35
+ showSnackbar({
36
+ isLowContrast: true,
37
37
  kind: 'success',
38
- description: t('cancelledSuccessfully', 'It has been cancelled successfully'),
38
+ subtitle: t('cancelledSuccessfully', 'It has been cancelled successfully'),
39
39
  title: t('appointmentCancelled', 'Appointment cancelled'),
40
40
  });
41
41
  mutate(`/ws/rest/v1/appointment/appointmentStatus?forDate=${currentAppointmentDate}&status=Scheduled`);
42
42
  mutate(`/ws/rest/v1/appointment/appointmentStatus?forDate=${currentAppointmentDate}&status=Cancelled`);
43
43
  closeOverlay();
44
44
  } else {
45
- showNotification({
45
+ showSnackbar({
46
46
  title: t('appointmentCancelError', 'Error cancelling appointment'),
47
47
  kind: 'error',
48
- critical: true,
49
- description: t('errorCancellingAppointment', 'Error cancelling the appointment'),
48
+ subtitle: t('errorCancellingAppointment', 'Error cancelling the appointment'),
50
49
  });
51
50
  setIsSubmitting(false);
52
51
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import userEvent from '@testing-library/user-event';
3
3
  import { screen, render } from '@testing-library/react';
4
- import { showNotification, showToast } from '@openmrs/esm-framework';
4
+ import { showSnackbar } from '@openmrs/esm-framework';
5
5
  import { cancelAppointment } from '../forms.resource';
6
6
  import { mockMappedAppointmentsData } from '__mocks__';
7
7
  import CancelAppointment from './cancel-appointment.component';
@@ -10,9 +10,8 @@ const testProps = {
10
10
  appointment: mockMappedAppointmentsData.data[0],
11
11
  };
12
12
 
13
- const mockShowToast = showToast as jest.Mock;
13
+ const mockShowSnackbar = showSnackbar as jest.Mock;
14
14
  const mockCancelAppointment = cancelAppointment as jest.Mock;
15
- const mockShowNotification = showNotification as jest.Mock;
16
15
 
17
16
  jest.mock('../forms.resource', () => {
18
17
  const originalModule = jest.requireActual('../forms.resource');
@@ -32,7 +31,7 @@ jest.mock('@openmrs/esm-framework', () => {
32
31
  });
33
32
 
34
33
  describe('Cancel appointment form', () => {
35
- it('should update appointment status to cancelled and show toast with success message', async () => {
34
+ it('should update appointment status to cancelled and show snackbar with success message', async () => {
36
35
  const user = userEvent.setup();
37
36
 
38
37
  mockCancelAppointment.mockReturnValueOnce({ status: 200, statusText: 'Appointment cancelled' });
@@ -42,12 +41,12 @@ describe('Cancel appointment form', () => {
42
41
  await user.click(screen.getByRole('textbox', { name: /reason for changes/i }));
43
42
  await user.click(screen.getByRole('button', { name: /cancel appointment/i }));
44
43
 
45
- expect(mockShowToast).toHaveBeenCalledTimes(1);
46
- expect(mockShowToast).toHaveBeenCalledWith({
47
- critical: true,
44
+ expect(mockShowSnackbar).toHaveBeenCalledTimes(1);
45
+ expect(mockShowSnackbar).toHaveBeenCalledWith({
46
+ isLowContrast: true,
48
47
  kind: 'success',
49
48
  title: 'Appointment cancelled',
50
- description: 'It has been cancelled successfully',
49
+ subtitle: 'It has been cancelled successfully',
51
50
  });
52
51
  });
53
52
 
@@ -62,12 +61,11 @@ describe('Cancel appointment form', () => {
62
61
 
63
62
  await user.click(screen.getByRole('textbox', { name: /reason for changes/i }));
64
63
  await user.click(screen.getByRole('button', { name: /cancel appointment/i }));
65
- expect(mockShowNotification).toHaveBeenCalledTimes(1);
66
- expect(mockShowNotification).toHaveBeenCalledWith({
67
- critical: true,
64
+ expect(mockShowSnackbar).toHaveBeenCalledTimes(2);
65
+ expect(mockShowSnackbar).toHaveBeenCalledWith({
68
66
  kind: 'error',
69
67
  title: 'Error cancelling appointment',
70
- description: 'Error cancelling the appointment',
68
+ subtitle: 'Error cancelling the appointment',
71
69
  });
72
70
  });
73
71
  });
@@ -29,8 +29,7 @@ import {
29
29
  } from '@carbon/react';
30
30
  import {
31
31
  ExtensionSlot,
32
- showNotification,
33
- showToast,
32
+ showSnackbar,
34
33
  useConfig,
35
34
  useLayoutType,
36
35
  useLocations,
@@ -128,10 +127,10 @@ const AppointmentForm: React.FC<AppointmentFormProps> = ({ appointment, patientU
128
127
  saveAppointment(appointmentPayload).then(
129
128
  ({ status }) => {
130
129
  if (status === 200) {
131
- showToast({
132
- critical: true,
130
+ showSnackbar({
131
+ isLowContrast: true,
133
132
  kind: 'success',
134
- description: t('appointmentNowVisible', 'It is now visible on the appointments page'),
133
+ subtitle: t('appointmentNowVisible', 'It is now visible on the appointments page'),
135
134
  title: t('appointmentScheduled', 'Appointment scheduled'),
136
135
  });
137
136
  setIsSubmitting(false);
@@ -145,11 +144,10 @@ const AppointmentForm: React.FC<AppointmentFormProps> = ({ appointment, patientU
145
144
  }
146
145
  },
147
146
  (error) => {
148
- showNotification({
147
+ showSnackbar({
149
148
  title: t('appointmentFormError', 'Error scheduling appointment'),
150
149
  kind: 'error',
151
- critical: true,
152
- description: error?.message,
150
+ subtitle: error?.message,
153
151
  });
154
152
  setIsSubmitting(false);
155
153
  },
@@ -27,10 +27,7 @@ import {
27
27
  useVisitTypes,
28
28
  type NewVisitPayload,
29
29
  saveVisit,
30
- toOmrsIsoString,
31
- toDateObjectStrict,
32
- showNotification,
33
- showToast,
30
+ showSnackbar,
34
31
  usePatient,
35
32
  useConfig,
36
33
  useLocations,
@@ -138,10 +135,11 @@ const VisitForm: React.FC<VisitFormProps> = ({ patientUuid, appointment }) => {
138
135
  ({ status }) => {
139
136
  if (status === 201) {
140
137
  mutate();
141
- showToast({
138
+ showSnackbar({
142
139
  kind: 'success',
140
+ isLowContrast: true,
143
141
  title: t('visitStarted', 'Visit started'),
144
- description: t(
142
+ subtitle: t(
145
143
  'queueAddedSuccessfully',
146
144
  `Patient has been added to the queue successfully.`,
147
145
  `${hours} : ${minutes}`,
@@ -150,11 +148,10 @@ const VisitForm: React.FC<VisitFormProps> = ({ patientUuid, appointment }) => {
150
148
  }
151
149
  },
152
150
  (error) => {
153
- showNotification({
151
+ showSnackbar({
154
152
  title: t('queueEntryError', 'Error adding patient to the queue'),
155
153
  kind: 'error',
156
- critical: true,
157
- description: error?.message,
154
+ subtitle: error?.message,
158
155
  });
159
156
  },
160
157
  );
@@ -165,11 +162,10 @@ const VisitForm: React.FC<VisitFormProps> = ({ patientUuid, appointment }) => {
165
162
  }
166
163
  },
167
164
  (error) => {
168
- showNotification({
165
+ showSnackbar({
169
166
  title: t('startVisitError', 'Error starting visit'),
170
167
  kind: 'error',
171
- critical: true,
172
- description: error?.message,
168
+ subtitle: error?.message,
173
169
  });
174
170
  },
175
171
  );