@cc-openmrs/cc-esm-active-prescriptions 1.0.63 → 1.0.64

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cc-openmrs/cc-esm-active-prescriptions",
3
- "version": "1.0.63",
3
+ "version": "1.0.64",
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",
@@ -45,71 +45,62 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@carbon/react": "^1.83.0",
48
- "classnames": "^2.5.1",
49
- "lodash-es": "^4.17.21",
50
- "react-to-print": "^2.14.13"
48
+ "lodash-es": "^4.17.21"
51
49
  },
52
50
  "peerDependencies": {
53
51
  "@openmrs/esm-framework": "9.x",
54
52
  "dayjs": "1.x",
55
53
  "react": "18.x",
56
- "react-dom": "18.x",
57
54
  "react-i18next": "16.x",
58
- "rxjs": "6.x",
59
- "swr": "2.x"
55
+ "react-router-dom": "6.x",
56
+ "rxjs": "6.x"
60
57
  },
61
58
  "devDependencies": {
62
59
  "@openmrs/esm-framework": "next",
60
+ "@openmrs/esm-styleguide": "next",
63
61
  "@playwright/test": "^1.52.0",
64
62
  "@swc/cli": "^0.3.12",
65
- "@swc/core": "^1.7.14",
63
+ "@swc/core": "^1.3.68",
66
64
  "@swc/jest": "^0.2.36",
67
- "@testing-library/dom": "^8.20.1",
68
- "@testing-library/jest-dom": "^5.17.0",
69
- "@testing-library/react": "^13.4.0",
65
+ "@testing-library/dom": "^10.1.0",
66
+ "@testing-library/jest-dom": "^6.4.5",
67
+ "@testing-library/react": "^15.0.6",
70
68
  "@testing-library/user-event": "^14.5.2",
71
- "@types/jest": "^28.1.4",
69
+ "@types/jest": "^29.5.12",
72
70
  "@types/react": "^18.3.21",
73
71
  "@types/react-dom": "^18.3.0",
74
72
  "@types/react-router": "^5.1.20",
75
- "@types/react-router-dom": "^5.1.7",
76
- "@types/webpack-env": "^1.16.0",
77
- "@typescript-eslint/eslint-plugin": "^8.54.0",
78
- "@typescript-eslint/parser": "^8.54.0",
79
- "css-loader": "^6.8.1",
73
+ "@types/react-router-dom": "^5.3.3",
74
+ "@types/webpack-env": "^1.18.1",
75
+ "@typescript-eslint/eslint-plugin": "^7.8.0",
76
+ "@typescript-eslint/parser": "^7.8.0",
80
77
  "dayjs": "^1.11.13",
81
- "dotenv": "^16.3.1",
82
- "eslint": "^8.57.0",
78
+ "dotenv": "^16.0.3",
79
+ "eslint": "^8.50.0",
83
80
  "eslint-config-prettier": "^8.8.0",
84
- "eslint-plugin-import": "^2.31.0",
85
81
  "eslint-plugin-jest-dom": "^5.4.0",
86
82
  "eslint-plugin-prettier": "^5.1.3",
87
- "eslint-plugin-react-hooks": "^5.0.0",
88
- "eslint-plugin-unused-imports": "^4.3.0",
89
- "husky": "^6.0.0",
83
+ "eslint-plugin-react-hooks": "^4.6.2",
84
+ "husky": "^8.0.3",
90
85
  "i18next": "^25.0.0",
91
86
  "i18next-parser": "^9.3.0",
92
87
  "identity-obj-proxy": "^3.0.0",
93
- "jest": "^28.1.3",
94
- "jest-cli": "^28.1.3",
95
- "jest-environment-jsdom": "^28.1.3",
96
- "lint-staged": "^15.2.9",
88
+ "jest": "^29.7.0",
89
+ "jest-cli": "^29.7.0",
90
+ "jest-environment-jsdom": "^29.7.0",
91
+ "lint-staged": "^15.2.2",
97
92
  "openmrs": "next",
98
- "prettier": "^3.2.5",
93
+ "prettier": "^3.3.3",
99
94
  "react": "^18.3.1",
100
95
  "react-dom": "^18.3.1",
101
96
  "react-i18next": "^16.0.0",
102
- "react-router-dom": "^6.3.0",
97
+ "react-router-dom": "^6.14.1",
103
98
  "rxjs": "^6.6.7",
104
- "swr": "^2.2.5",
105
- "swc-loader": "^0.2.3",
106
99
  "turbo": "^2.5.2",
107
- "typescript": "^5.0.0",
108
- "webpack": "^5.99.9",
109
- "webpack-cli": "^6.0.1"
100
+ "typescript": "^5.0.0"
110
101
  },
111
102
  "lint-staged": {
112
- "*.{ts,tsx}": "eslint --cache --fix --max-warnings 0",
103
+ "packages/**/src/**/*.{ts,tsx}": "eslint --cache --fix --max-warnings 0",
113
104
  "*.{css,scss,ts,tsx}": "prettier --write --list-different"
114
105
  },
115
106
  "packageManager": "yarn@4.10.3"
package/src/index.ts CHANGED
@@ -4,11 +4,7 @@
4
4
  * connects the app shell to the React application(s) that make up this
5
5
  * microfrontend.
6
6
  */
7
- import React, { type ComponentType } from 'react';
8
- import ReactDOM from 'react-dom';
9
- import { defineConfigSchema } from '@openmrs/esm-framework';
10
- import { openmrsComponentDecorator } from '../node_modules/@openmrs/esm-react-utils/dist/openmrsComponentDecorator.js';
11
- import singleSpaReact from 'single-spa-react';
7
+ import { getAsyncLifecycle, defineConfigSchema, getSyncLifecycle } from '@openmrs/esm-framework';
12
8
  import { configSchema } from './config-schema';
13
9
 
14
10
  import prescriptionsActionButtonComponent from './prescriptions-actions/prescriptions-action-button.component';
@@ -20,26 +16,6 @@ const options = {
20
16
  moduleName,
21
17
  };
22
18
 
23
- function getCompatibleLifecycle<T>(Component: ComponentType<T>, lifecycleOptions: typeof options) {
24
- return singleSpaReact({
25
- React,
26
- ReactDOM,
27
- renderType: 'render',
28
- rootComponent: openmrsComponentDecorator(lifecycleOptions)(Component as any) as any,
29
- });
30
- }
31
-
32
- function getCompatibleAsyncLifecycle<T>(
33
- lazy: () => Promise<{ default: ComponentType<T> }>,
34
- lifecycleOptions: typeof options,
35
- ) {
36
- return () => lazy().then(({ default: Component }) => getCompatibleLifecycle(Component, lifecycleOptions));
37
- }
38
-
39
- function getCompatibleSyncLifecycle<T>(Component: ComponentType<T>, lifecycleOptions: typeof options) {
40
- return () => Promise.resolve(getCompatibleLifecycle(Component, lifecycleOptions));
41
- }
42
-
43
19
  /**
44
20
  * This tells the app shell how to obtain translation files: that they
45
21
  * are JSON files in the directory `../translations` (which you should
@@ -60,11 +36,11 @@ export function startupApp() {
60
36
  /**
61
37
  * The following are named exports for the extensions defined in this frontend modules. See the `routes.json` file to see how these are used.
62
38
  */
63
- export const redBox = getCompatibleAsyncLifecycle(() => import('./boxes/extensions/red-box.component'), options);
64
- export const blueBox = getCompatibleAsyncLifecycle(() => import('./boxes/extensions/blue-box.component'), options);
65
- export const brandBox = getCompatibleAsyncLifecycle(() => import('./boxes/extensions/brand-box.component'), options);
39
+ export const redBox = getAsyncLifecycle(() => import('./boxes/extensions/red-box.component'), options);
40
+ export const blueBox = getAsyncLifecycle(() => import('./boxes/extensions/blue-box.component'), options);
41
+ export const brandBox = getAsyncLifecycle(() => import('./boxes/extensions/brand-box.component'), options);
66
42
 
67
- export const prescriptionsActionButton = getCompatibleSyncLifecycle(prescriptionsActionButtonComponent, options);
43
+ export const prescriptionsActionButton = getSyncLifecycle(prescriptionsActionButtonComponent, options);
68
44
 
69
45
  /**
70
46
  * This named export tells the app shell that the default export of `root.component.tsx`
@@ -72,4 +48,4 @@ export const prescriptionsActionButton = getCompatibleSyncLifecycle(prescription
72
48
  * will be `openmrsSpaBase() + 'root'`, which is usually
73
49
  * `/openmrs/spa/root`.
74
50
  */
75
- export const root = getCompatibleAsyncLifecycle(() => import('./root.component'), options);
51
+ export const root = getAsyncLifecycle(() => import('./root.component'), options);
@@ -1,10 +1,10 @@
1
- import React from 'react';
2
- import { ActionMenuButton, launchWorkspace } from '@openmrs/esm-framework';
1
+ import React, { useCallback } from 'react';
2
+ import { launchWorkspace } from '@openmrs/esm-framework';
3
3
  import { Events } from '@carbon/react/icons';
4
+ import { ActionMenuButton } from '@openmrs/esm-styleguide';
4
5
  import { useTranslation } from 'react-i18next';
5
6
 
6
7
  const handleClick = () => launchWorkspace('active-prescriptions');
7
- const getEventsIcon = (props: object) => <Events {...props} />;
8
8
 
9
9
  const PrescriptionsActionButton: React.FC = () => {
10
10
  const { t } = useTranslation();
@@ -12,10 +12,10 @@ const PrescriptionsActionButton: React.FC = () => {
12
12
 
13
13
  return (
14
14
  <ActionMenuButton
15
- getIcon={getEventsIcon}
16
- handler={handleClick}
17
- iconDescription={label}
15
+ getIcon={(props) => <Events {...props} />}
18
16
  label={label}
17
+ iconDescription={label}
18
+ handler={handleClick}
19
19
  type="active-prescriptions"
20
20
  />
21
21
  );
package/dist/225.js DELETED
@@ -1 +0,0 @@
1
- "use strict";(globalThis.webpackChunk_cc_openmrs_cc_esm_active_prescriptions=globalThis.webpackChunk_cc_openmrs_cc_esm_active_prescriptions||[]).push([[225],{4225(e,n,t){t.r(n),t.d(n,{default:()=>c,immutable:()=>o});var r=t(6072),i=t(9888),s=t(8465);const a=r.use||(e=>{if("pending"===e.status)throw e;if("fulfilled"===e.status)return e.value;throw"rejected"===e.status?e.reason:(e.status="pending",e.then(n=>{e.status="fulfilled",e.value=n},n=>{e.status="rejected",e.reason=n}),e)}),d={dedupe:!0};s.OBJECT.defineProperty(s.SWRConfig,"defaultValue",{value:s.defaultConfig});const u=(0,s.withArgs)((e,n,t)=>{const{cache:u,compare:o,suspense:c,fallbackData:l,revalidateOnMount:f,revalidateIfStale:E,refreshInterval:g,refreshWhenHidden:v,refreshWhenOffline:R,keepPreviousData:h}=t,[_,p,U,T]=s.SWRGlobalState.get(u),[V,m]=(0,s.serialize)(e),b=(0,r.useRef)(!1),C=(0,r.useRef)(!1),S=(0,r.useRef)(V),L=(0,r.useRef)(n),O=(0,r.useRef)(t),I=()=>O.current,k=()=>I().isVisible()&&I().isOnline(),[w,D,y,A]=(0,s.createCacheHelper)(u,V),N=(0,r.useRef)({}).current,F=(0,s.isUndefined)(l)?t.fallback[V]:l,P=(e,n)=>{for(const t in N){const r=t;if("data"===r){if(!o(e[r],n[r])){if(!(0,s.isUndefined)(e[r]))return!1;if(!o(z,n[r]))return!1}}else if(n[r]!==e[r])return!1}return!0},M=(0,r.useMemo)(()=>{const e=!!V&&!!n&&((0,s.isUndefined)(f)?!I().isPaused()&&!c&&(!!(0,s.isUndefined)(E)||E):f),t=n=>{const t=(0,s.mergeObjects)(n);return delete t._k,e?{isValidating:!0,isLoading:!0,...t}:t},r=w(),i=A(),a=t(r),d=r===i?a:t(i);let u=a;return[()=>{const e=t(w());return P(e,u)?(u.data=e.data,u.isLoading=e.isLoading,u.isValidating=e.isValidating,u.error=e.error,u):(u=e,e)},()=>d]},[u,V]),W=(0,i.useSyncExternalStore)((0,r.useCallback)(e=>y(V,(n,t)=>{P(t,n)||e()}),[u,V]),M[0],M[1]),j=!b.current,G=_[V]&&_[V].length>0,H=W.data,Y=(0,s.isUndefined)(H)?F:H,q=W.error,x=(0,r.useRef)(Y),z=h?(0,s.isUndefined)(H)?x.current:H:Y,B=!(G&&!(0,s.isUndefined)(q))&&(j&&!(0,s.isUndefined)(f)?f:!I().isPaused()&&(c?!(0,s.isUndefined)(Y)&&E:(0,s.isUndefined)(Y)||E)),J=!!(V&&n&&j&&B),K=(0,s.isUndefined)(W.isValidating)?J:W.isValidating,Q=(0,s.isUndefined)(W.isLoading)?J:W.isLoading,X=(0,r.useCallback)(async e=>{const n=L.current;if(!V||!n||C.current||I().isPaused())return!1;let r,i,a=!0;const d=e||{},u=!U[V]||!d.dedupe,c=()=>s.IS_REACT_LEGACY?!C.current&&V===S.current&&b.current:V===S.current,l={isValidating:!1,isLoading:!1},f=()=>{D(l)},E=()=>{const e=U[V];e&&e[1]===i&&delete U[V]},g={isValidating:!0};(0,s.isUndefined)(w().data)&&(g.isLoading=!0);try{if(u&&(D(g),t.loadingTimeout&&(0,s.isUndefined)(w().data)&&setTimeout(()=>{a&&c()&&I().onLoadingSlow(V,t)},t.loadingTimeout),U[V]=[n(m),(0,s.getTimestamp)()]),[r,i]=U[V],r=await r,u&&setTimeout(E,t.dedupingInterval),!U[V]||U[V][1]!==i)return u&&c()&&I().onDiscarded(V),!1;l.error=s.UNDEFINED;const e=p[V];if(!(0,s.isUndefined)(e)&&(i<=e[0]||i<=e[1]||0===e[1]))return f(),u&&c()&&I().onDiscarded(V),!1;const d=w().data;l.data=o(d,r)?d:r,u&&c()&&I().onSuccess(r,V,t)}catch(e){E();const n=I(),{shouldRetryOnError:t}=n;n.isPaused()||(l.error=e,u&&c()&&(n.onError(e,V,n),(!0===t||(0,s.isFunction)(t)&&t(e))&&(I().revalidateOnFocus&&I().revalidateOnReconnect&&!k()||n.onErrorRetry(e,V,n,e=>{const n=_[V];n&&n[0]&&n[0](s.revalidateEvents.ERROR_REVALIDATE_EVENT,e)},{retryCount:(d.retryCount||0)+1,dedupe:!0}))))}return a=!1,f(),!0},[V,u]),Z=(0,r.useCallback)((...e)=>(0,s.internalMutate)(u,S.current,...e),[]);if((0,s.useIsomorphicLayoutEffect)(()=>{L.current=n,O.current=t,(0,s.isUndefined)(H)||(x.current=H)}),(0,s.useIsomorphicLayoutEffect)(()=>{if(!V)return;const e=X.bind(s.UNDEFINED,d);let n=0;const t=(0,s.subscribeCallback)(V,_,(t,r={})=>{if(t==s.revalidateEvents.FOCUS_EVENT){const t=Date.now();I().revalidateOnFocus&&t>n&&k()&&(n=t+I().focusThrottleInterval,e())}else if(t==s.revalidateEvents.RECONNECT_EVENT)I().revalidateOnReconnect&&k()&&e();else{if(t==s.revalidateEvents.MUTATE_EVENT)return X();if(t==s.revalidateEvents.ERROR_REVALIDATE_EVENT)return X(r)}});return C.current=!1,S.current=V,b.current=!0,D({_k:m}),B&&((0,s.isUndefined)(Y)||s.IS_SERVER?e():(0,s.rAF)(e)),()=>{C.current=!0,t()}},[V]),(0,s.useIsomorphicLayoutEffect)(()=>{let e;function n(){const n=(0,s.isFunction)(g)?g(w().data):g;n&&-1!==e&&(e=setTimeout(t,n))}function t(){w().error||!v&&!I().isVisible()||!R&&!I().isOnline()?n():X(d).then(n)}return n(),()=>{e&&(clearTimeout(e),e=-1)}},[g,v,R,V]),(0,r.useDebugValue)(z),c&&(0,s.isUndefined)(Y)&&V){if(!s.IS_REACT_LEGACY&&s.IS_SERVER)throw new Error("Fallback data is required when using suspense in SSR.");L.current=n,O.current=t,C.current=!1;const e=T[V];if(!(0,s.isUndefined)(e)){const n=Z(e);a(n)}if(!(0,s.isUndefined)(q))throw q;{const e=X(d);(0,s.isUndefined)(z)||(e.status="fulfilled",e.value=!0),a(e)}}return{mutate:Z,get data(){return N.data=!0,z},get error(){return N.error=!0,q},get isValidating(){return N.isValidating=!0,K},get isLoading(){return N.isLoading=!0,Q}}}),o=e=>(n,t,r)=>(r.revalidateOnFocus=!1,r.revalidateIfStale=!1,r.revalidateOnReconnect=!1,e(n,t,r)),c=(0,s.withMiddleware)(u,o)}}]);