@cc-openmrs/cc-esm-active-prescriptions 1.0.30 → 1.0.33
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/477.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_cc_openmrs_cc_esm_active_prescriptions=globalThis.webpackChunk_cc_openmrs_cc_esm_active_prescriptions||[]).push([[477],{4477(
|
|
1
|
+
"use strict";(globalThis.webpackChunk_cc_openmrs_cc_esm_active_prescriptions=globalThis.webpackChunk_cc_openmrs_cc_esm_active_prescriptions||[]).push([[477],{4477(c,e,o){o.r(e),o.d(e,{default:()=>p});var n=o(6072),t=o(4504),a=o(4424),i=o(2076),s="active-prescriptions-workspace",r="[active-prescriptions-action-button]";const p=function(c){var e=c.patientUuid,o=c.closeMenu,p=(0,(0,i.useTranslation)().t)("prescriptionsActionButton","Active prescriptions"),l=(0,n.useCallback)(function(){if(console.info("".concat(r," click"),{patientUuid:e,hasCloseMenu:Boolean(o),workspaceName:s}),e){try{console.info("".concat(r," launching workspace (v1)"),{workspaceName:s,patientUuid:e}),(0,a.launchWorkspace)(s,{patientUuid:e,openedFrom:"patient-actions-slot"}),console.info("".concat(r," workspace launch dispatched"))}catch(c){return void console.error("".concat(r," workspace launch failed"),c)}o&&(console.info("".concat(r," closing overflow menu")),o())}else console.warn("".concat(r," patientUuid missing; workspace launch aborted"))},[e,o]);return n.createElement(t.XSD,{itemText:p,onClick:l})}}}]);
|
|
@@ -337,9 +337,9 @@
|
|
|
337
337
|
"initial": false,
|
|
338
338
|
"entry": false,
|
|
339
339
|
"recorded": false,
|
|
340
|
-
"size":
|
|
340
|
+
"size": 2105,
|
|
341
341
|
"sizes": {
|
|
342
|
-
"javascript":
|
|
342
|
+
"javascript": 2105
|
|
343
343
|
},
|
|
344
344
|
"names": [],
|
|
345
345
|
"idHints": [],
|
|
@@ -353,7 +353,7 @@
|
|
|
353
353
|
"auxiliaryFiles": [
|
|
354
354
|
"477.js.map"
|
|
355
355
|
],
|
|
356
|
-
"hash": "
|
|
356
|
+
"hash": "5fe86c5947905ede",
|
|
357
357
|
"childrenByOrder": {}
|
|
358
358
|
},
|
|
359
359
|
{
|
package/dist/routes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":">=2.2.0"},"extensions":[{"name":"Red box","component":"redBox","slot":"Boxes"},{"name":"Blue box","component":"blueBox","slot":"Boxes"},{"name":"Brand box","component":"brandBox","slot":"Boxes"},{"name":"prescriptions-action","component":"prescriptionsActionButton","slot":"patient-actions-slot","order":50}],"pages":[{"component":"root","route":"root"}],"workspaces":[{"name":"active-prescriptions-workspace","title":"Active prescriptions","type":"active-prescriptions","component":"root","canHide":true,"width":"wider"}],"version":"1.0.
|
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":">=2.2.0"},"extensions":[{"name":"Red box","component":"redBox","slot":"Boxes"},{"name":"Blue box","component":"blueBox","slot":"Boxes"},{"name":"Brand box","component":"brandBox","slot":"Boxes"},{"name":"prescriptions-action","component":"prescriptionsActionButton","slot":"patient-actions-slot","order":50,"meta":{"fullWidth":false}}],"pages":[{"component":"root","route":"root"}],"workspaces":[{"name":"active-prescriptions-workspace","title":"Active prescriptions","type":"active-prescriptions","component":"root","canHide":true,"width":"wider"}],"version":"1.0.33"}
|
package/package.json
CHANGED
|
@@ -1,34 +1,33 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { OverflowMenuItem } from '@carbon/react';
|
|
3
|
-
import { launchWorkspace
|
|
3
|
+
import { launchWorkspace } from '@openmrs/esm-framework';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
|
|
6
6
|
interface PrescriptionsActionButtonProps {
|
|
7
|
+
/**
|
|
8
|
+
* In patient-chart actions, this is typically provided by the slot context.
|
|
9
|
+
*/
|
|
7
10
|
patientUuid?: string;
|
|
8
|
-
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The patient actions overflow menu commonly provides this callback as `closeMenu`.
|
|
14
|
+
* (Using `closeMenu` aligns with core implementations.)
|
|
15
|
+
*/
|
|
16
|
+
closeMenu?: () => void;
|
|
9
17
|
}
|
|
10
18
|
|
|
11
19
|
const workspaceName = 'active-prescriptions-workspace';
|
|
12
20
|
const logPrefix = '[active-prescriptions-action-button]';
|
|
13
21
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const PrescriptionsActionButton: React.FC<PrescriptionsActionButtonProps> = ({
|
|
17
|
-
patientUuid,
|
|
18
|
-
closeOverflowMenu,
|
|
19
|
-
}) => {
|
|
22
|
+
const PrescriptionsActionButton: React.FC<PrescriptionsActionButtonProps> = ({ patientUuid, closeMenu }) => {
|
|
20
23
|
const { t } = useTranslation();
|
|
21
24
|
const label = t('prescriptionsActionButton', 'Active prescriptions');
|
|
22
25
|
|
|
23
26
|
const handleClick = useCallback(() => {
|
|
24
|
-
const pathname = window.location.pathname;
|
|
25
|
-
const inPatientChart = isPatientChartPath(pathname);
|
|
26
|
-
|
|
27
27
|
console.info(`${logPrefix} click`, {
|
|
28
28
|
patientUuid,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
inPatientChart,
|
|
29
|
+
hasCloseMenu: Boolean(closeMenu),
|
|
30
|
+
workspaceName,
|
|
32
31
|
});
|
|
33
32
|
|
|
34
33
|
if (!patientUuid) {
|
|
@@ -37,43 +36,27 @@ const PrescriptionsActionButton: React.FC<PrescriptionsActionButtonProps> = ({
|
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
try {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
});
|
|
45
|
-
} else {
|
|
46
|
-
const targetUrl = `${window.getOpenmrsSpaBase()}patient/${patientUuid}/chart`;
|
|
47
|
-
const contextKey = `patient/${patientUuid}`;
|
|
48
|
-
|
|
49
|
-
console.info(`${logPrefix} navigating to patient chart and launching workspace`, {
|
|
50
|
-
workspaceName,
|
|
51
|
-
patientUuid,
|
|
52
|
-
targetUrl,
|
|
53
|
-
contextKey,
|
|
54
|
-
});
|
|
39
|
+
// IMPORTANT:
|
|
40
|
+
// - Your current @openmrs/esm-framework does NOT export launchWorkspace2 (TS error).
|
|
41
|
+
// - So we use v1: launchWorkspace + routes.json "workspaces" (not "workspaces2").
|
|
42
|
+
console.info(`${logPrefix} launching workspace (v1)`, { workspaceName, patientUuid });
|
|
55
43
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
additionalProps: {
|
|
61
|
-
patientUuid,
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
}
|
|
44
|
+
launchWorkspace(workspaceName, {
|
|
45
|
+
patientUuid,
|
|
46
|
+
openedFrom: 'patient-actions-slot',
|
|
47
|
+
});
|
|
65
48
|
|
|
66
49
|
console.info(`${logPrefix} workspace launch dispatched`);
|
|
67
|
-
} catch (error) {
|
|
50
|
+
} catch (error: any) {
|
|
68
51
|
console.error(`${logPrefix} workspace launch failed`, error);
|
|
69
52
|
return;
|
|
70
53
|
}
|
|
71
54
|
|
|
72
|
-
if (
|
|
55
|
+
if (closeMenu) {
|
|
73
56
|
console.info(`${logPrefix} closing overflow menu`);
|
|
74
|
-
|
|
57
|
+
closeMenu();
|
|
75
58
|
}
|
|
76
|
-
}, [patientUuid,
|
|
59
|
+
}, [patientUuid, closeMenu]);
|
|
77
60
|
|
|
78
61
|
return <OverflowMenuItem itemText={label} onClick={handleClick} />;
|
|
79
62
|
};
|