@kenyaemr/esm-service-queues-app 7.0.3-pre.88 → 7.0.3-pre.94

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.
Files changed (186) hide show
  1. package/.turbo/turbo-build.log +18 -17
  2. package/dist/130.js +1 -1
  3. package/dist/130.js.map +1 -1
  4. package/dist/199.js +1 -1
  5. package/dist/236.js +1 -0
  6. package/dist/236.js.map +1 -0
  7. package/dist/265.js +1 -0
  8. package/dist/265.js.map +1 -0
  9. package/dist/271.js +1 -1
  10. package/dist/282.js +1 -0
  11. package/dist/282.js.map +1 -0
  12. package/dist/319.js +1 -1
  13. package/dist/366.js +1 -0
  14. package/dist/366.js.map +1 -0
  15. package/dist/392.js +1 -0
  16. package/dist/392.js.map +1 -0
  17. package/dist/460.js +1 -1
  18. package/dist/484.js +2 -0
  19. package/dist/484.js.map +1 -0
  20. package/dist/574.js +1 -1
  21. package/dist/6.js +1 -1
  22. package/dist/604.js +1 -0
  23. package/dist/604.js.map +1 -0
  24. package/dist/644.js +1 -1
  25. package/dist/670.js +1 -0
  26. package/dist/670.js.map +1 -0
  27. package/dist/727.js +1 -0
  28. package/dist/727.js.map +1 -0
  29. package/dist/752.js +1 -1
  30. package/dist/757.js +1 -1
  31. package/dist/760.js +1 -0
  32. package/dist/760.js.map +1 -0
  33. package/dist/788.js +1 -1
  34. package/dist/800.js +1 -1
  35. package/dist/807.js +1 -1
  36. package/dist/818.js +1 -0
  37. package/dist/818.js.map +1 -0
  38. package/dist/828.js +1 -1
  39. package/dist/833.js +1 -1
  40. package/dist/911.js +1 -0
  41. package/dist/911.js.map +1 -0
  42. package/dist/kenyaemr-esm-service-queues-app.js +1 -1
  43. package/dist/kenyaemr-esm-service-queues-app.js.buildmanifest.json +160 -160
  44. package/dist/kenyaemr-esm-service-queues-app.js.map +1 -1
  45. package/dist/main.js +1 -1
  46. package/dist/main.js.map +1 -1
  47. package/dist/routes.json +1 -1
  48. package/package.json +1 -1
  49. package/src/active-visits/active-visits-table.resource.ts +1 -1
  50. package/src/active-visits/change-status-dialog.scss +11 -11
  51. package/src/active-visits/change-status-dialog.test.tsx +36 -31
  52. package/src/add-patient-toqueue/add-patient-toqueue-dialog.scss +10 -10
  53. package/src/add-provider-queue-room/add-provider-queue-room.component.tsx +4 -4
  54. package/src/add-provider-queue-room/add-provider-queue-room.resource.ts +2 -2
  55. package/src/add-provider-queue-room/add-provider-queue-room.scss +6 -6
  56. package/src/add-provider-queue-room/add-provider-queue-room.test.tsx +44 -38
  57. package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.component.tsx +1 -1
  58. package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.scss +2 -3
  59. package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.test.tsx +15 -15
  60. package/src/config-schema.ts +84 -84
  61. package/src/current-visit/current-visit-summary.component.tsx +1 -1
  62. package/src/current-visit/current-visit-summary.test.tsx +12 -11
  63. package/src/current-visit/current-visit.resource.ts +1 -1
  64. package/src/current-visit/current-visit.scss +4 -4
  65. package/src/current-visit/hooks/useVitalsConceptMetadata.tsx +1 -1
  66. package/src/current-visit/visit-details/triage-note.scss +11 -11
  67. package/src/helpers/helpers.test.ts +24 -0
  68. package/src/helpers/helpers.ts +41 -14
  69. package/src/home.test.tsx +10 -12
  70. package/src/hooks/useQueueService.ts +16 -10
  71. package/src/past-visit/past-visit-details/past-visit-summary.scss +8 -8
  72. package/src/past-visit/past-visit.component.tsx +1 -1
  73. package/src/past-visit/past-visit.resource.ts +1 -1
  74. package/src/past-visit/past-visit.scss +17 -17
  75. package/src/past-visit/past-visit.test.tsx +8 -13
  76. package/src/patient-info/appointment-details.scss +7 -7
  77. package/src/patient-info/appointment-details.test.tsx +11 -6
  78. package/src/patient-info/appointments.resource.ts +1 -1
  79. package/src/patient-info/patient-info.scss +9 -9
  80. package/src/patient-info/patient-info.test.tsx +3 -14
  81. package/src/patient-queue-header/patient-queue-header.component.tsx +4 -1
  82. package/src/patient-queue-header/patient-queue-header.scss +11 -11
  83. package/src/patient-queue-metrics/clinic-metrics.component.tsx +1 -1
  84. package/src/patient-queue-metrics/clinic-metrics.resource.ts +2 -2
  85. package/src/patient-queue-metrics/clinic-metrics.scss +4 -4
  86. package/src/patient-queue-metrics/clinic-metrics.test.tsx +40 -45
  87. package/src/patient-queue-metrics/metrics-card.scss +11 -11
  88. package/src/patient-queue-metrics/metrics-header.scss +2 -2
  89. package/src/patient-search/advanced-search.scss +27 -27
  90. package/src/patient-search/advanced-search.test.tsx +6 -9
  91. package/src/patient-search/basic-search.scss +14 -14
  92. package/src/patient-search/basic-search.test.tsx +2 -7
  93. package/src/patient-search/hooks/useDefaultLocation.ts +1 -1
  94. package/src/patient-search/hooks/useQueueLocations.tsx +1 -0
  95. package/src/patient-search/hooks/useScheduledVisits.ts +1 -1
  96. package/src/patient-search/patient-scheduled-visits.component.tsx +4 -4
  97. package/src/patient-search/patient-scheduled-visits.scss +17 -17
  98. package/src/patient-search/patient-scheduled-visits.test.tsx +18 -23
  99. package/src/patient-search/patient-search.scss +7 -7
  100. package/src/patient-search/patient-search.workspace.tsx +4 -4
  101. package/src/patient-search/search-results.scss +11 -11
  102. package/src/patient-search/search-results.test.tsx +2 -10
  103. package/src/patient-search/visit-form/visit-form.scss +12 -13
  104. package/src/patient-search/visit-form/visit-type-selector.component.tsx +9 -11
  105. package/src/patient-search/visit-form/visit-type-selector.scss +13 -13
  106. package/src/patient-search/visit-form/visit-type-selector.test.tsx +4 -3
  107. package/src/patient-search/visit-form-queue-fields/visit-form-queue-fields.scss +1 -3
  108. package/src/patient-search/visit-form-queue-fields/visit-form-queue-fields.test.tsx +15 -9
  109. package/src/queue-entry-table-components/edit-entry.scss +1 -1
  110. package/src/queue-entry-table-components/queue-priority.scss +3 -4
  111. package/src/queue-entry-table-components/transition-entry.scss +1 -1
  112. package/src/queue-patient-linelists/queue-linelist-base-table.scss +16 -17
  113. package/src/queue-patient-linelists/queue-linelist-base-table.test.tsx +7 -8
  114. package/src/queue-patient-linelists/queue-linelist-filter.scss +13 -13
  115. package/src/queue-patient-linelists/queue-linelist-filter.test.tsx +9 -6
  116. package/src/queue-patient-linelists/queue-linelist.resource.ts +4 -4
  117. package/src/queue-patient-linelists/scheduled-appointments-table.test.tsx +10 -7
  118. package/src/queue-rooms/queue-room-form.scss +13 -13
  119. package/src/queue-rooms/queue-room-form.test.tsx +10 -8
  120. package/src/queue-screen/queue-screen.scss +6 -4
  121. package/src/queue-screen/queue-screen.test.tsx +6 -6
  122. package/src/queue-services/queue-service-form.scss +13 -13
  123. package/src/queue-services/queue-service-form.test.tsx +15 -8
  124. package/src/queue-table/cells/queue-table-action-cell.component.tsx +2 -2
  125. package/src/queue-table/cells/queue-table-coming-from-cell.component.tsx +1 -1
  126. package/src/queue-table/default-queue-table.component.tsx +63 -61
  127. package/src/queue-table/default-queue-table.test.tsx +61 -61
  128. package/src/queue-table/queue-entry-actions/queue-entry-actions-modal.scss +36 -0
  129. package/src/queue-table/queue-entry-actions/queue-entry-actions.modal.tsx +30 -10
  130. package/src/queue-table/queue-entry-actions/queue-entry-actions.test.tsx +34 -103
  131. package/src/queue-table/queue-entry-actions/queue-entry-confirm-action.test.tsx +42 -25
  132. package/src/queue-table/queue-entry-actions/queue-entry-undo-actions.test.tsx +19 -14
  133. package/src/queue-table/queue-table-by-status-skeleton.component.tsx +1 -5
  134. package/src/queue-table/queue-table-expanded-row.component.tsx +1 -2
  135. package/src/queue-table/queue-table-metrics-card.scss +7 -7
  136. package/src/queue-table/queue-table-metrics.scss +3 -3
  137. package/src/queue-table/queue-table.component.tsx +8 -11
  138. package/src/queue-table/queue-table.scss +32 -26
  139. package/src/queue-table/queue-table.test.tsx +46 -21
  140. package/src/remove-queue-entry-dialog/remove-queue-entry.resource.ts +1 -1
  141. package/src/remove-queue-entry-dialog/remove-queue-entry.scss +2 -2
  142. package/src/remove-queue-entry-dialog/remove-queue-entry.test.tsx +13 -12
  143. package/src/side-menu/side-menu.test.tsx +0 -1
  144. package/src/transition-queue-entry/transition-queue-entry-dialog.component.tsx +1 -1
  145. package/src/transition-queue-entry/transition-queue-entry-dialog.scss +5 -5
  146. package/src/transition-queue-entry/transition-queue-entry-dialog.test.tsx +33 -44
  147. package/src/views/queue-tables-for-all-statuses.component.tsx +14 -14
  148. package/src/visits-missing-inqueue/visits-missing-inqueue.component.tsx +1 -1
  149. package/src/visits-missing-inqueue/visits-missing-inqueue.resource.ts +1 -1
  150. package/src/visits-missing-inqueue/visits-missing-inqueue.scss +17 -14
  151. package/translations/am.json +4 -2
  152. package/translations/ar.json +4 -2
  153. package/translations/en.json +1 -0
  154. package/translations/es.json +4 -2
  155. package/translations/fr.json +39 -37
  156. package/translations/he.json +4 -2
  157. package/translations/km.json +4 -2
  158. package/translations/zh.json +4 -2
  159. package/translations/zh_CN.json +4 -2
  160. package/dist/276.js +0 -1
  161. package/dist/276.js.map +0 -1
  162. package/dist/384.js +0 -2
  163. package/dist/384.js.map +0 -1
  164. package/dist/401.js +0 -1
  165. package/dist/401.js.map +0 -1
  166. package/dist/430.js +0 -1
  167. package/dist/430.js.map +0 -1
  168. package/dist/60.js +0 -1
  169. package/dist/60.js.map +0 -1
  170. package/dist/600.js +0 -1
  171. package/dist/600.js.map +0 -1
  172. package/dist/647.js +0 -1
  173. package/dist/647.js.map +0 -1
  174. package/dist/650.js +0 -1
  175. package/dist/650.js.map +0 -1
  176. package/dist/669.js +0 -1
  177. package/dist/669.js.map +0 -1
  178. package/dist/764.js +0 -1
  179. package/dist/764.js.map +0 -1
  180. package/dist/877.js +0 -1
  181. package/dist/877.js.map +0 -1
  182. package/dist/917.js +0 -1
  183. package/dist/917.js.map +0 -1
  184. package/src/queue-table/queue-entry-actions/queue-entry-actons-modal.scss +0 -36
  185. package/src/root.scss +0 -15
  186. /package/dist/{384.js.LICENSE.txt → 484.js.LICENSE.txt} +0 -0
@@ -60,33 +60,18 @@ export const defaultQueueTable: TableDefinitions = {
60
60
  };
61
61
 
62
62
  export const configSchema = {
63
- dashboardTitle: {
64
- _type: Type.Object,
65
- _description: 'The title to be displayed on the service queues dashboard',
66
- key: {
67
- _type: Type.String,
68
- _description: 'The translation key of the title to be displayed on the service queues dashboard',
69
- },
70
- value: {
71
- _type: Type.String,
72
- _description: 'The translation value of the title to be displayed on the service queues dashboard',
73
- },
74
- _default: {
75
- key: 'serviceQueues',
76
- value: 'Service queues',
77
- },
63
+ appointmentStatuses: {
64
+ _type: Type.Array,
65
+ _description: 'Configurable appointment status (status of appointments)',
66
+ _default: ['Requested', 'Scheduled', 'CheckedIn', 'Completed', 'Cancelled', 'Missed'],
78
67
  },
68
+ biometrics: biometricsConfigSchema,
79
69
  concepts: {
80
70
  defaultPriorityConceptUuid: {
81
71
  _type: Type.ConceptUuid,
82
72
  _description: 'The UUID of the default priority for the queues eg Not urgent.',
83
73
  _default: 'f4620bfa-3625-4883-bd3f-84c2cce14470',
84
74
  },
85
- emergencyPriorityConceptUuid: {
86
- _type: Type.ConceptUuid,
87
- _description: 'The UUID of the priority with the highest sort weight for the queues eg Emergency.',
88
- _default: '04f6f7e0-e3cb-4e13-a133-4479f759574e',
89
- },
90
75
  defaultStatusConceptUuid: {
91
76
  _type: Type.ConceptUuid,
92
77
  _description: 'The UUID of the default status for the queues eg Waiting.',
@@ -97,42 +82,47 @@ export const configSchema = {
97
82
  _description: 'The UUID of the default status for attending a service in the queues eg In Service.',
98
83
  _default: 'ca7494ae-437f-4fd0-8aae-b88b9a2ba47d',
99
84
  },
100
- systolicBloodPressureUuid: {
101
- _type: Type.ConceptUuid,
102
- _default: '5085AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
103
- },
104
85
  diastolicBloodPressureUuid: {
105
86
  _type: Type.ConceptUuid,
106
87
  _default: '5086AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
107
88
  },
108
- pulseUuid: {
89
+ emergencyPriorityConceptUuid: {
109
90
  _type: Type.ConceptUuid,
110
- _default: '5087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
91
+ _description: 'The UUID of the priority with the highest sort weight for the queues eg Emergency.',
92
+ _default: '04f6f7e0-e3cb-4e13-a133-4479f759574e',
111
93
  },
112
- temperatureUuid: {
94
+ heightUuid: {
113
95
  _type: Type.ConceptUuid,
114
- _default: '5088AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
96
+ _default: '5090AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
97
+ },
98
+ historicalObsConceptUuid: {
99
+ _type: Type.Array,
100
+ _description: 'The Uuids of the obs that are displayed on the previous visit modal',
101
+ _default: ['161643AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'],
115
102
  },
116
103
  oxygenSaturationUuid: {
117
104
  _type: Type.ConceptUuid,
118
105
  _default: '5092AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
119
106
  },
120
- heightUuid: {
121
- _type: Type.ConceptUuid,
122
- _default: '5090AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
123
- },
124
- weightUuid: {
107
+ pulseUuid: {
125
108
  _type: Type.ConceptUuid,
126
- _default: '5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
109
+ _default: '5087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
127
110
  },
128
111
  respiratoryRateUuid: {
129
112
  _type: Type.ConceptUuid,
130
113
  _default: '5242AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
131
114
  },
132
- historicalObsConceptUuid: {
133
- _type: Type.Array,
134
- _description: 'The Uuids of the obs that are displayed on the previous visit modal',
135
- _default: ['161643AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'],
115
+ systolicBloodPressureUuid: {
116
+ _type: Type.ConceptUuid,
117
+ _default: '5085AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
118
+ },
119
+ temperatureUuid: {
120
+ _type: Type.ConceptUuid,
121
+ _default: '5088AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
122
+ },
123
+ weightUuid: {
124
+ _type: Type.ConceptUuid,
125
+ _default: '5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
136
126
  },
137
127
  },
138
128
  contactAttributeType: {
@@ -141,31 +131,6 @@ export const configSchema = {
141
131
  'The UUID of the person attribute type that captures contact information such as `Next of kin contact details`',
142
132
  _default: '',
143
133
  },
144
- vitals: vitalsConfigSchema,
145
- biometrics: biometricsConfigSchema,
146
- appointmentStatuses: {
147
- _type: Type.Array,
148
- _description: 'Configurable appointment status (status of appointments)',
149
- _default: ['Requested', 'Scheduled', 'CheckedIn', 'Completed', 'Cancelled', 'Missed'],
150
- },
151
- defaultIdentifierTypes: {
152
- _type: Type.Array,
153
- _element: {
154
- _type: Type.String,
155
- },
156
- _description: 'The identifier types to be display on all patient search result page',
157
- _default: ['05ee9cf4-7242-4a17-b4d4-00f707265c8a', 'f85081e2-b4be-4e48-b3a4-7994b69bb101'],
158
- },
159
- showRecommendedVisitTypeTab: {
160
- _type: Type.Boolean,
161
- _description: 'Whether start visit form should display recommended visit type tab. Requires `visitTypeResourceUrl`',
162
- _default: false,
163
- },
164
- visitTypeResourceUrl: {
165
- _type: Type.String,
166
- _description: 'The `visitTypeResourceUrl`',
167
- _default: null,
168
- },
169
134
  customPatientChartUrl: {
170
135
  _type: Type.String,
171
136
  _default: '${openmrsSpaBase}/patient/${patientUuid}/chart',
@@ -174,15 +139,34 @@ export const configSchema = {
174
139
  (openmrsSpaBase and openBase are available to any <ConfigurableLink>)`,
175
140
  _validators: [validators.isUrlWithTemplateParameters(['patientUuid'])],
176
141
  },
142
+ dashboardTitle: {
143
+ _type: Type.Object,
144
+ _description: 'The title to be displayed on the service queues dashboard',
145
+ key: {
146
+ _type: Type.String,
147
+ _description: 'The translation key of the title to be displayed on the service queues dashboard',
148
+ },
149
+ value: {
150
+ _type: Type.String,
151
+ _description: 'The translation value of the title to be displayed on the service queues dashboard',
152
+ },
153
+ _default: {
154
+ key: 'serviceQueues',
155
+ value: 'Service queues',
156
+ },
157
+ },
177
158
  defaultFacilityUrl: {
178
159
  _type: Type.String,
179
160
  _default: '',
180
161
  _description: 'Custom URL to load default facility if it is not in the session',
181
162
  },
182
- visitQueueNumberAttributeUuid: {
183
- _type: Type.String,
184
- _description: 'The UUID of the visit attribute that contains the visit queue number.',
185
- _default: null,
163
+ defaultIdentifierTypes: {
164
+ _type: Type.Array,
165
+ _element: {
166
+ _type: Type.String,
167
+ },
168
+ _description: 'The identifier types to be display on all patient search result page',
169
+ _default: ['05ee9cf4-7242-4a17-b4d4-00f707265c8a', 'f85081e2-b4be-4e48-b3a4-7994b69bb101'],
186
170
  },
187
171
  queueTables: {
188
172
  columnDefinitions: {
@@ -368,6 +352,22 @@ export const configSchema = {
368
352
  ),
369
353
  ],
370
354
  },
355
+ showRecommendedVisitTypeTab: {
356
+ _type: Type.Boolean,
357
+ _description: 'Whether start visit form should display recommended visit type tab. Requires `visitTypeResourceUrl`',
358
+ _default: false,
359
+ },
360
+ visitQueueNumberAttributeUuid: {
361
+ _type: Type.String,
362
+ _description: 'The UUID of the visit attribute that contains the visit queue number.',
363
+ _default: null,
364
+ },
365
+ visitTypeResourceUrl: {
366
+ _type: Type.String,
367
+ _description: 'The `visitTypeResourceUrl`',
368
+ _default: null,
369
+ },
370
+ vitals: vitalsConfigSchema,
371
371
  _validators: [
372
372
  validator((config: ConfigObject) => {
373
373
  const queueNumberColumnDefs = [
@@ -393,35 +393,35 @@ function columnHasType(columnDef: ColumnDefinition, type: ColumnType): boolean {
393
393
  }
394
394
 
395
395
  export interface ConfigObject {
396
- dashboardTitle: {
397
- key: string;
398
- value: string;
399
- };
396
+ appointmentStatuses: Array<string>;
397
+ biometrics: BiometricsConfigObject;
400
398
  concepts: {
401
399
  defaultPriorityConceptUuid: string;
402
400
  defaultStatusConceptUuid: string;
403
401
  defaultTransitionStatus: string;
404
- systolicBloodPressureUuid: string;
405
402
  diastolicBloodPressureUuid: string;
403
+ emergencyPriorityConceptUuid: string;
404
+ heightUuid: string;
405
+ historicalObsConceptUuid: Array<string>;
406
+ oxygenSaturationUuid: string;
406
407
  pulseUuid: string;
408
+ respiratoryRateUuid: string;
409
+ systolicBloodPressureUuid: string;
407
410
  temperatureUuid: string;
408
- oxygenSaturationUuid: string;
409
- heightUuid: string;
410
411
  weightUuid: string;
411
- respiratoryRateUuid: string;
412
- emergencyPriorityConceptUuid: string;
413
- historicalObsConceptUuid: Array<string>;
414
412
  };
415
413
  contactAttributeType: Array<string>;
416
- vitals: VitalsConfigObject;
417
- biometrics: BiometricsConfigObject;
418
- appointmentStatuses: Array<string>;
414
+ customPatientChartUrl: string;
419
415
  defaultIdentifierTypes: Array<string>;
416
+ dashboardTitle: {
417
+ key: string;
418
+ value: string;
419
+ };
420
+ queueTables: TablesConfig;
420
421
  showRecommendedVisitTypeTab: boolean;
421
- customPatientChartUrl: string;
422
- visitTypeResourceUrl: string;
423
422
  visitQueueNumberAttributeUuid: string | null;
424
- queueTables: TablesConfig;
423
+ visitTypeResourceUrl: string;
424
+ vitals: VitalsConfigObject;
425
425
  }
426
426
 
427
427
  interface TablesConfig {
@@ -431,7 +431,7 @@ interface TablesConfig {
431
431
  A list of table definitions. A queue table (whether it is displaying entries from a
432
432
  particular queue+status combination, from a particular queue, or from multiple queues)
433
433
  will determine what columns to show based on these definitions. If multiple TableDefinitions
434
- have matching appliedTo criteria, the first one will be used.
434
+ have matching appliedTo criteria, the first one will be used.
435
435
  */
436
436
  tableDefinitions: TableDefinitions[];
437
437
  }
@@ -12,7 +12,7 @@ interface CurrentVisitProps {
12
12
 
13
13
  const CurrentVisit: React.FC<CurrentVisitProps> = ({ patientUuid, visitUuid }) => {
14
14
  const { t } = useTranslation();
15
- const { visit, isError, isLoading } = useVisit(visitUuid);
15
+ const { visit, isLoading } = useVisit(visitUuid);
16
16
 
17
17
  if (isLoading) {
18
18
  return <DataTableSkeleton role="progressbar" />;
@@ -1,20 +1,20 @@
1
1
  import React from 'react';
2
2
  import { render, screen } from '@testing-library/react';
3
- import { useVisit } from './current-visit.resource';
4
3
  import { mockPastVisit } from '__mocks__';
4
+ import { useVisit } from './current-visit.resource';
5
5
  import CurrentVisit from './current-visit-summary.component';
6
6
 
7
- const useVisitMock = useVisit as jest.Mock;
7
+ const useVisitMock = jest.mocked(useVisit);
8
8
 
9
9
  jest.mock('./current-visit.resource', () => ({
10
- useVisit: jest.fn(() => ({
10
+ useVisit: jest.fn().mockReturnValue({
11
11
  visit: {
12
12
  visitType: { display: 'Visit Type' },
13
13
  encounters: [],
14
14
  },
15
- isError: false,
15
+ error: null,
16
16
  isLoading: false,
17
- })),
17
+ }),
18
18
  }));
19
19
 
20
20
  const patientUuid = mockPastVisit.data.results[0].patient.uuid;
@@ -24,17 +24,18 @@ describe('CurrentVisit', () => {
24
24
  it('renders visit details correctly', async () => {
25
25
  render(<CurrentVisit patientUuid={patientUuid} visitUuid={visitUuid} />);
26
26
 
27
- expect(screen.queryByRole('progressbar')).toBeNull();
27
+ expect(screen.queryByRole('progressbar')).not.toBeInTheDocument();
28
28
  expect(screen.getByText('Visit Type')).toBeInTheDocument();
29
29
  expect(screen.getByText('Scheduled for today')).toBeInTheDocument();
30
30
  expect(screen.getByText('On time')).toBeInTheDocument();
31
31
  });
32
- it('should render skeleton when loading', async () => {
33
- useVisitMock.mockImplementationOnce(() => ({
34
- visit: undefined,
35
- isError: false,
32
+ it('renders a loading skeleton when fetching data', async () => {
33
+ useVisitMock.mockReturnValue({
34
+ visit: null,
35
+ error: null,
36
36
  isLoading: true,
37
- }));
37
+ isValidating: false,
38
+ });
38
39
 
39
40
  render(<CurrentVisit patientUuid={patientUuid} visitUuid={visitUuid} />);
40
41
 
@@ -26,7 +26,7 @@ export function useVisit(visitUuid: string) {
26
26
 
27
27
  return {
28
28
  visit: data ? data.data : null,
29
- isError: error,
29
+ error,
30
30
  isLoading,
31
31
  isValidating,
32
32
  };
@@ -1,6 +1,6 @@
1
- @use '@carbon/styles/scss/spacing';
2
- @use '@carbon/styles/scss/type';
3
- @import '~@openmrs/esm-styleguide/src/vars';
1
+ @use '@carbon/layout';
2
+ @use '@carbon/type';
3
+ @use '@openmrs/esm-styleguide/src/vars' as *;
4
4
 
5
5
  .visitContainer {
6
6
  background-color: $ui-background;
@@ -30,5 +30,5 @@
30
30
  }
31
31
 
32
32
  .wrapper {
33
- margin: spacing.$spacing-03;
33
+ margin: layout.$spacing-03;
34
34
  }
@@ -21,7 +21,7 @@ export function useVitalsConceptMetadata() {
21
21
  : new Map<string, string>([]);
22
22
  return {
23
23
  data: conceptUnits,
24
- isError: error,
24
+ error,
25
25
  isLoading,
26
26
  conceptMetadata,
27
27
  };
@@ -1,6 +1,6 @@
1
- @use '@carbon/styles/scss/spacing';
2
- @use '@carbon/styles/scss/type';
3
- @import '~@openmrs/esm-styleguide/src/vars';
1
+ @use '@carbon/layout';
2
+ @use '@carbon/type';
3
+ @use '@openmrs/esm-styleguide/src/vars' as *;
4
4
 
5
5
  .subHeading {
6
6
  @include type.type-style('label-01');
@@ -8,20 +8,20 @@
8
8
  }
9
9
 
10
10
  .emptyText {
11
- padding: spacing.$spacing-05;
11
+ padding: layout.$spacing-05;
12
12
  @include type.type-style('body-02');
13
13
  }
14
14
 
15
15
  .unit {
16
16
  @include type.type-style('body-compact-01');
17
17
  color: var(--text-02);
18
- margin-left: spacing.$spacing-02;
18
+ margin-left: layout.$spacing-02;
19
19
  }
20
20
 
21
21
  .vitalValues {
22
22
  @include type.type-style('body-compact-02');
23
23
  color: $ui-05;
24
- margin-left: spacing.$spacing-02;
24
+ margin-left: layout.$spacing-02;
25
25
  }
26
26
 
27
27
  .grid {
@@ -39,13 +39,13 @@
39
39
 
40
40
  .danger-icon {
41
41
  color: $danger;
42
- height: spacing.$spacing-02;
43
- width: spacing.$spacing-02;
44
- margin-left: spacing.$spacing-02;
42
+ height: layout.$spacing-02;
43
+ width: layout.$spacing-02;
44
+ margin-left: layout.$spacing-02;
45
45
  }
46
46
 
47
47
  .iconWrapper {
48
- margin-left: spacing.$spacing-02;
48
+ margin-left: layout.$spacing-02;
49
49
  }
50
50
 
51
51
  .critically-low,
@@ -81,7 +81,7 @@
81
81
  display: flex;
82
82
  justify-content: space-between;
83
83
  align-items: center;
84
- margin: 0.25rem 0.5rem;
84
+ margin: layout.$spacing-02 layout.$spacing-03;
85
85
  }
86
86
 
87
87
  .tile {
@@ -0,0 +1,24 @@
1
+ import { updateValueInSessionStorage } from './helpers';
2
+
3
+ describe('Testing updateValueInSessionStorage', () => {
4
+ beforeEach(() => {
5
+ sessionStorage.clear();
6
+ });
7
+
8
+ it('should save value in the session storage if valid value is passed', () => {
9
+ updateValueInSessionStorage('key', 'value');
10
+ expect(sessionStorage.getItem('key')).toBe('value');
11
+ });
12
+
13
+ it('should delete the key of the value passed is null or undefined', () => {
14
+ updateValueInSessionStorage('key1', 'v1');
15
+ expect(sessionStorage.getItem('key1')).toBe('v1');
16
+ updateValueInSessionStorage('key1', null);
17
+ expect(sessionStorage.getItem('key1')).toBe(null);
18
+
19
+ updateValueInSessionStorage('key2', 'v2');
20
+ expect(sessionStorage.getItem('key2')).toBe('v2');
21
+ updateValueInSessionStorage('key2', undefined);
22
+ expect(sessionStorage.getItem('key2')).toBe(null);
23
+ });
24
+ });
@@ -14,17 +14,42 @@ export const getServiceCountByAppointmentType = (
14
14
  .reduce((count, val) => count + val, 0);
15
15
  };
16
16
 
17
- const initialQueueLocationNameState = { queueLocationName: sessionStorage.getItem('queueLocationName') };
18
- const initialQueueLocationUuidState = { queueLocationUuid: sessionStorage.getItem('queueLocationUuid') };
17
+ /**
18
+ * This function is mainly useful for not writing null/ undefined in the session storage
19
+ */
20
+ export function updateValueInSessionStorage(key: string, value: string) {
21
+ if (value === undefined || value === null) {
22
+ sessionStorage.removeItem(key);
23
+ } else {
24
+ sessionStorage.setItem(key, value);
25
+ }
26
+ }
27
+
28
+ /**
29
+ * This function fetches the value for the passed key from session storage
30
+ */
31
+ export function getValueFromSessionStorage(key: string): string | null {
32
+ return sessionStorage.getItem(key);
33
+ }
34
+
35
+ const initialQueueLocationNameState = {
36
+ queueLocationName: getValueFromSessionStorage('queueLocationName'),
37
+ };
38
+ const initialQueueLocationUuidState = {
39
+ queueLocationUuid: getValueFromSessionStorage('queueLocationUuid'),
40
+ };
19
41
  const initialServiceUuidState = {
20
- serviceUuid: sessionStorage.getItem('queueServiceUuid'),
21
- serviceDisplay: sessionStorage.getItem('queueServiceDisplay'),
42
+ serviceUuid: getValueFromSessionStorage('queueServiceUuid'),
43
+ serviceDisplay: getValueFromSessionStorage('queueServiceDisplay'),
44
+ };
45
+ const intialAppointmentStatusNameState = { status: '' };
46
+ const initialQueueStatusState = {
47
+ statusUuid: getValueFromSessionStorage('queueStatusUuid'),
48
+ statusDisplay: getValueFromSessionStorage('queueStatusDisplay'),
22
49
  };
23
- const intialStatusNameState = { status: '' };
24
- const initialQueueStatusState = { statusUuid: null, statusDisplay: null };
25
50
  const initialSelectedQueueRoomTimestamp = { providerQueueRoomTimestamp: new Date() };
26
51
  const initialPermanentProviderQueueRoomState = {
27
- isPermanentProviderQueueRoom: sessionStorage.getItem('isPermanentProviderQueueRoom'),
52
+ isPermanentProviderQueueRoom: getValueFromSessionStorage('isPermanentProviderQueueRoom'),
28
53
  };
29
54
 
30
55
  export function getSelectedService() {
@@ -35,7 +60,7 @@ export function getSelectedService() {
35
60
  }
36
61
 
37
62
  export function getSelectedAppointmentStatus() {
38
- return getGlobalStore<{ status: string }>('appointmentSelectedStatus', intialStatusNameState);
63
+ return getGlobalStore<{ status: string }>('appointmentSelectedStatus', intialAppointmentStatusNameState);
39
64
  }
40
65
 
41
66
  export function getSelectedQueueLocationName() {
@@ -69,8 +94,8 @@ export function getIsPermanentProviderQueueRoom() {
69
94
 
70
95
  export const updateSelectedService = (currentServiceUuid: string, currentServiceDisplay: string) => {
71
96
  const store = getSelectedService();
72
- sessionStorage.setItem('queueServiceDisplay', currentServiceDisplay);
73
- sessionStorage.setItem('queueServiceUuid', currentServiceUuid);
97
+ updateValueInSessionStorage('queueServiceDisplay', currentServiceDisplay);
98
+ updateValueInSessionStorage('queueServiceUuid', currentServiceUuid);
74
99
  store.setState({ serviceUuid: currentServiceUuid, serviceDisplay: currentServiceDisplay });
75
100
  };
76
101
 
@@ -81,13 +106,13 @@ export const updateSelectedAppointmentStatus = (currentAppointmentStatus: string
81
106
 
82
107
  export const updateSelectedQueueLocationName = (currentLocationName: string) => {
83
108
  const store = getSelectedQueueLocationName();
84
- sessionStorage.setItem('queueLocationName', currentLocationName);
109
+ updateValueInSessionStorage('queueLocationName', currentLocationName);
85
110
  store.setState({ queueLocationName: currentLocationName });
86
111
  };
87
112
 
88
113
  export const updateSelectedQueueLocationUuid = (currentLocationUuid: string) => {
89
114
  const store = getSelectedQueueLocationUuid();
90
- sessionStorage.setItem('queueLocationUuid', currentLocationUuid);
115
+ updateValueInSessionStorage('queueLocationUuid', currentLocationUuid);
91
116
  store.setState({ queueLocationUuid: currentLocationUuid });
92
117
  };
93
118
 
@@ -98,12 +123,14 @@ export const updatedSelectedQueueRoomTimestamp = (currentProviderRoomTimestamp:
98
123
 
99
124
  export const updateIsPermanentProviderQueueRoom = (currentIsPermanentProviderQueueRoom) => {
100
125
  const store = getIsPermanentProviderQueueRoom();
101
- sessionStorage.setItem('isPermanentProviderQueueRoom', currentIsPermanentProviderQueueRoom);
126
+ updateValueInSessionStorage('isPermanentProviderQueueRoom', currentIsPermanentProviderQueueRoom);
102
127
  store.setState({ isPermanentProviderQueueRoom: currentIsPermanentProviderQueueRoom });
103
128
  };
104
129
 
105
130
  export const updateSelectedQueueStatus = (currentQueueStatusUuid: string, currentQueueStatusDisplay: string) => {
106
131
  const store = getSelectedQueueStatus();
132
+ updateValueInSessionStorage('queueStatusUuid', currentQueueStatusUuid);
133
+ updateValueInSessionStorage('queueStatusDisplay', currentQueueStatusDisplay);
107
134
  store.setState({ statusUuid: currentQueueStatusUuid, statusDisplay: currentQueueStatusDisplay });
108
135
  };
109
136
 
@@ -117,7 +144,7 @@ export const useSelectedService = () => {
117
144
  };
118
145
 
119
146
  export const useSelectedAppointmentStatus = () => {
120
- const [currentAppointmentStatus, setCurrentAppointmentStatus] = useState(intialStatusNameState.status);
147
+ const [currentAppointmentStatus, setCurrentAppointmentStatus] = useState(intialAppointmentStatusNameState.status);
121
148
 
122
149
  useEffect(() => {
123
150
  getSelectedAppointmentStatus().subscribe(({ status }) => setCurrentAppointmentStatus(status));
package/src/home.test.tsx CHANGED
@@ -1,29 +1,27 @@
1
1
  import React from 'react';
2
2
  import { render, screen } from '@testing-library/react';
3
- import Home from './home.component';
4
3
  import { getDefaultsFromConfigSchema, useConfig } from '@openmrs/esm-framework';
5
- import { configSchema } from './config-schema';
6
-
7
- const mockedUseConfig = useConfig as jest.Mock;
4
+ import { type ConfigObject, configSchema } from './config-schema';
5
+ import Home from './home.component';
8
6
 
9
- mockedUseConfig.mockReturnValue({
10
- ...getDefaultsFromConfigSchema(configSchema),
11
- concepts: {
12
- visitQueueNumberAttributeUuid: 'c61ce16f-272a-41e7-9924-4c555d0932c5',
13
- },
14
- });
7
+ const mockUseConfig = jest.mocked(useConfig<ConfigObject>);
15
8
 
16
9
  jest.mock('./helpers/helpers', () => ({
17
10
  ...jest.requireActual('./helpers/helpers'),
18
11
  useSelectedQueueLocationName: jest.fn(() => 'Test Location'),
19
12
  }));
20
13
 
14
+ mockUseConfig.mockReturnValue({
15
+ ...getDefaultsFromConfigSchema(configSchema),
16
+ visitQueueNumberAttributeUuid: 'c61ce16f-272a-41e7-9924-4c555d0932c5',
17
+ });
18
+
21
19
  describe('Home Component', () => {
22
20
  it('renders PatientQueueHeader, ClinicMetrics when activeTicketScreen is not "screen"', () => {
23
21
  // Mock window.location.pathname
24
22
  const originalLocation = window.location;
25
23
  delete window.location;
26
- window.location = { pathname: '/some-path' };
24
+ window.location = { pathname: '/some-path' } as Location;
27
25
 
28
26
  render(<Home />);
29
27
 
@@ -38,7 +36,7 @@ describe('Home Component', () => {
38
36
  it('renders QueueScreen when activeTicketScreen is "screen"', () => {
39
37
  const originalLocation = window.location;
40
38
  delete window.location;
41
- window.location = { pathname: '/some-path/screen' };
39
+ window.location = { pathname: '/some-path/screen' } as Location;
42
40
 
43
41
  render(<Home />);
44
42
  expect(screen.getByText(/patients currently in queue/i)).toBeInTheDocument();
@@ -1,19 +1,25 @@
1
1
  import { getLocale } from '@openmrs/esm-framework';
2
2
  import { useMemo } from 'react';
3
3
  import { useQueues } from './useQueues';
4
+ import uniqBy from 'lodash-es/uniqBy';
5
+ import { useSelectedQueueLocationUuid } from '../helpers/helpers';
4
6
 
5
- function useQueueServices(locationUuid?: string) {
6
- const { queues, isLoading } = useQueues(locationUuid);
7
+ function useQueueServices() {
8
+ const currentQueueLocation = useSelectedQueueLocationUuid();
9
+ const { queues, isLoading } = useQueues(currentQueueLocation);
7
10
 
8
- const results = useMemo(
9
- () => ({
10
- services: [...new Set(queues?.map((queue) => queue.service) ?? [])].sort((a, b) =>
11
- a.display.localeCompare(b.display, getLocale()),
12
- ),
11
+ const results = useMemo(() => {
12
+ const uniqueServices = uniqBy(
13
+ queues.flatMap((queue) => queue.service),
14
+ (service) => service?.uuid,
15
+ );
16
+ const sortedServices = uniqueServices.sort((a, b) => a.display.localeCompare(b.display, getLocale()));
17
+
18
+ return {
19
+ services: sortedServices,
13
20
  isLoadingQueueServices: isLoading,
14
- }),
15
- [queues, isLoading],
16
- );
21
+ };
22
+ }, [queues, isLoading]);
17
23
 
18
24
  return results;
19
25
  }