@cc-openmrs/cc-esm-active-prescriptions 1.0.30 → 1.0.31

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(n,t,e){e.r(t),e.d(t,{default:()=>p});var c=e(6072),a=e(4504),o=e(4424),i=e(2076),r="active-prescriptions-workspace",s="[active-prescriptions-action-button]";const p=function(n){var t=n.patientUuid,e=n.closeOverflowMenu,p=(0,(0,i.useTranslation)().t)("prescriptionsActionButton","Active prescriptions"),l=(0,c.useCallback)(function(){var n=window.location.pathname,c=function(n){return/\/patient\/[^/]+\/chart(?:\/|$)/.test(n)}(n);if(console.info("".concat(s," click"),{patientUuid:t,hasCloseOverflowMenu:Boolean(e),pathname:n,inPatientChart:c}),t){try{if(c)console.info("".concat(s," launching workspace in current context"),{workspaceName:r,patientUuid:t}),(0,o.launchWorkspace)(r,{patientUuid:t});else{var a="".concat(window.getOpenmrsSpaBase(),"patient/").concat(t,"/chart"),i="patient/".concat(t);console.info("".concat(s," navigating to patient chart and launching workspace"),{workspaceName:r,patientUuid:t,targetUrl:a,contextKey:i}),(0,o.navigateAndLaunchWorkspace)({targetUrl:a,contextKey:i,workspaceName:r,additionalProps:{patientUuid:t}})}console.info("".concat(s," workspace launch dispatched"))}catch(n){return void console.error("".concat(s," workspace launch failed"),n)}e&&(console.info("".concat(s," closing overflow menu")),e())}else console.warn("".concat(s," patientUuid missing; workspace launch aborted"))},[t,e]);return c.createElement(a.XSD,{itemText:p,onClick:l})}}}]);
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:()=>l});var n=o(6072),t=o(4504),i=o(4424),a=o(2076),s="active-prescriptions-workspace",r="[active-prescriptions-action-button]";const l=function(c){var e=c.patientUuid,o=c.closeOverflowMenu,l=(0,(0,a.useTranslation)().t)("prescriptionsActionButton","Active prescriptions"),p=(0,n.useCallback)(function(){if(console.info("".concat(r," click"),{patientUuid:e,hasCloseOverflowMenu:Boolean(o)}),e){try{console.info("".concat(r," launching workspace"),{workspaceName:s,patientUuid:e}),(0,i.launchWorkspace)(s,{patientUuid:e}),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:l,onClick:p})}}}]);
@@ -337,9 +337,9 @@
337
337
  "initial": false,
338
338
  "entry": false,
339
339
  "recorded": false,
340
- "size": 3099,
340
+ "size": 1843,
341
341
  "sizes": {
342
- "javascript": 3099
342
+ "javascript": 1843
343
343
  },
344
344
  "names": [],
345
345
  "idHints": [],
@@ -353,7 +353,7 @@
353
353
  "auxiliaryFiles": [
354
354
  "477.js.map"
355
355
  ],
356
- "hash": "d03147dd6335beac",
356
+ "hash": "d77eb5587a305825",
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.30"}
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-chart-actions-slot","order":10,"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"}],"workspaces2":[{"name":"active-prescriptions-workspace","component":"root","window":"active-prescriptions"}],"workspaceWindows2":[{"name":"active-prescriptions","group":"patient-chart"}],"workspaceGroups2":[{"name":"patient-chart","scopePattern":"/patient/([^/]+)/chart"}],"version":"1.0.31"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cc-openmrs/cc-esm-active-prescriptions",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "license": "MPL-2.0",
5
5
  "description": "An OpenMRS seed application for building microfrontends",
6
6
  "browser": "dist/openmrs-esm-template-app.js",
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback } from 'react';
2
2
  import { OverflowMenuItem } from '@carbon/react';
3
- import { launchWorkspace, navigateAndLaunchWorkspace } from '@openmrs/esm-framework';
3
+ import { launchWorkspace } from '@openmrs/esm-framework';
4
4
  import { useTranslation } from 'react-i18next';
5
5
 
6
6
  interface PrescriptionsActionButtonProps {
@@ -11,8 +11,6 @@ interface PrescriptionsActionButtonProps {
11
11
  const workspaceName = 'active-prescriptions-workspace';
12
12
  const logPrefix = '[active-prescriptions-action-button]';
13
13
 
14
- const isPatientChartPath = (pathname: string) => /\/patient\/[^/]+\/chart(?:\/|$)/.test(pathname);
15
-
16
14
  const PrescriptionsActionButton: React.FC<PrescriptionsActionButtonProps> = ({
17
15
  patientUuid,
18
16
  closeOverflowMenu,
@@ -21,14 +19,9 @@ const PrescriptionsActionButton: React.FC<PrescriptionsActionButtonProps> = ({
21
19
  const label = t('prescriptionsActionButton', 'Active prescriptions');
22
20
 
23
21
  const handleClick = useCallback(() => {
24
- const pathname = window.location.pathname;
25
- const inPatientChart = isPatientChartPath(pathname);
26
-
27
22
  console.info(`${logPrefix} click`, {
28
23
  patientUuid,
29
24
  hasCloseOverflowMenu: Boolean(closeOverflowMenu),
30
- pathname,
31
- inPatientChart,
32
25
  });
33
26
 
34
27
  if (!patientUuid) {
@@ -37,32 +30,10 @@ const PrescriptionsActionButton: React.FC<PrescriptionsActionButtonProps> = ({
37
30
  }
38
31
 
39
32
  try {
40
- if (inPatientChart) {
41
- console.info(`${logPrefix} launching workspace in current context`, { workspaceName, patientUuid });
42
- launchWorkspace(workspaceName, {
43
- patientUuid,
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
- });
55
-
56
- navigateAndLaunchWorkspace({
57
- targetUrl,
58
- contextKey,
59
- workspaceName,
60
- additionalProps: {
61
- patientUuid,
62
- },
63
- });
64
- }
65
-
33
+ console.info(`${logPrefix} launching workspace`, { workspaceName, patientUuid });
34
+ launchWorkspace(workspaceName, {
35
+ patientUuid,
36
+ });
66
37
  console.info(`${logPrefix} workspace launch dispatched`);
67
38
  } catch (error) {
68
39
  console.error(`${logPrefix} workspace launch failed`, error);
package/src/routes.json CHANGED
@@ -23,8 +23,11 @@
23
23
  {
24
24
  "name": "prescriptions-action",
25
25
  "component": "prescriptionsActionButton",
26
- "slot": "patient-actions-slot",
27
- "order": 50
26
+ "slot": "patient-chart-actions-slot",
27
+ "order": 10,
28
+ "meta": {
29
+ "fullWidth": false
30
+ }
28
31
  }
29
32
  ],
30
33
  "pages": [
@@ -42,5 +45,24 @@
42
45
  "canHide": true,
43
46
  "width": "wider"
44
47
  }
48
+ ],
49
+ "workspaces2": [
50
+ {
51
+ "name": "active-prescriptions-workspace",
52
+ "component": "root",
53
+ "window": "active-prescriptions"
54
+ }
55
+ ],
56
+ "workspaceWindows2": [
57
+ {
58
+ "name": "active-prescriptions",
59
+ "group": "patient-chart"
60
+ }
61
+ ],
62
+ "workspaceGroups2": [
63
+ {
64
+ "name": "patient-chart",
65
+ "scopePattern": "/patient/([^/]+)/chart"
66
+ }
45
67
  ]
46
68
  }