@openmrs/esm-devtools-app 9.0.3-pre.4533 → 9.0.3-pre.4550

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.
@@ -13,7 +13,18 @@ import {
13
13
  import classNames from 'classnames';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import fuzzy from 'fuzzy';
16
- import { useDebounce, type ImportMap, showModal, resetAllRoutesOverrides } from '@openmrs/esm-framework/src/internal';
16
+ import {
17
+ useDebounce,
18
+ type ImportMap,
19
+ showModal,
20
+ resetRouteMapOverrides,
21
+ getCurrentPageMap,
22
+ getImportMapDefaultMap,
23
+ getImportMapNextPageMap,
24
+ getImportMapOverrideMap,
25
+ getImportMapDisabledOverrides,
26
+ resetImportMapOverrides,
27
+ } from '@openmrs/esm-framework/src/internal';
17
28
  import type { Module } from './types';
18
29
  import styles from './list.scss';
19
30
 
@@ -75,8 +86,7 @@ const initialImportMapState: ImportMapListState = {
75
86
  };
76
87
 
77
88
  function updateToNext(dispatch: Dispatch<ImportMapDispatchAction>) {
78
- return () =>
79
- window.importMapOverrides.getNextPageMap().then((nextPageMap) => dispatch({ type: 'set_next_map', nextPageMap }));
89
+ return () => getImportMapNextPageMap().then((nextPageMap) => dispatch({ type: 'set_next_map', nextPageMap }));
80
90
  }
81
91
 
82
92
  function reducer(state: ImportMapListState, action: ImportMapDispatchAction) {
@@ -103,8 +113,8 @@ function reducer(state: ImportMapListState, action: ImportMapDispatchAction) {
103
113
  dialogModule: null,
104
114
  };
105
115
  case 'reset_all_overrides':
106
- window.importMapOverrides.resetOverrides();
107
- resetAllRoutesOverrides();
116
+ resetImportMapOverrides();
117
+ resetRouteMapOverrides();
108
118
  return state;
109
119
  }
110
120
  }
@@ -118,13 +128,8 @@ const ImportMapList = forwardRef<HTMLDivElement>((props, ref) => {
118
128
  const searchVal = useDebounce(searchQuery);
119
129
 
120
130
  useEffect(() => {
121
- // load initial values from importMapOverrides
122
- window.importMapOverrides
123
- .getDefaultMap()
124
- .then((notOverriddenMap) => dispatch({ type: 'set_default_map', notOverriddenMap }));
125
- window.importMapOverrides
126
- .getCurrentPageMap()
127
- .then((currentPageMap) => dispatch({ type: 'set_current_map', currentPageMap }));
131
+ getImportMapDefaultMap().then((notOverriddenMap) => dispatch({ type: 'set_default_map', notOverriddenMap }));
132
+ getCurrentPageMap().then((currentPageMap) => dispatch({ type: 'set_current_map', currentPageMap }));
128
133
 
129
134
  // focus on the search box
130
135
  inputRef.current?.focus();
@@ -157,9 +162,9 @@ const ImportMapList = forwardRef<HTMLDivElement>((props, ref) => {
157
162
  externalOverrideModules: Array<Module> = [],
158
163
  pendingRefreshDefaultModules: Array<Module> = [];
159
164
 
160
- const overrideMap = window.importMapOverrides.getOverrideMap(true).imports;
165
+ const overrideMap = getImportMapOverrideMap(true).imports;
161
166
  const notOverriddenKeys = Object.keys(state.notOverriddenMap.imports);
162
- const disabledModules = window.importMapOverrides.getDisabledOverrides();
167
+ const disabledModules = getImportMapDisabledOverrides();
163
168
 
164
169
  const searchableKeys = [...new Set([...notOverriddenKeys, ...Object.keys(overrideMap)])];
165
170
  searchableKeys.sort();
@@ -1,4 +1,5 @@
1
1
  import React, { useRef, useEffect } from 'react';
2
+ import { getImportMapOverrideMap } from '@openmrs/esm-framework/src/internal';
2
3
  import ImportMapList from './import-map-list/list.component';
3
4
  import styles from './import-map.styles.css';
4
5
 
@@ -24,9 +25,9 @@ export default function ImportMap({ toggleOverridden }: ImportMapProps) {
24
25
  }
25
26
 
26
27
  export function importMapOverridden(): boolean {
27
- return Object.keys(window.importMapOverrides.getOverrideMap().imports).length > 0;
28
+ return Object.keys(getImportMapOverrideMap().imports).length > 0;
28
29
  }
29
30
 
30
31
  export function isOverriddenInImportMap(esmName: string): boolean {
31
- return window.importMapOverrides.getOverrideMap().imports.hasOwnProperty(esmName);
32
+ return Object.hasOwn(getImportMapOverrideMap().imports, esmName);
32
33
  }
package/tsconfig.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "allowSyntheticDefaultImports": true,
7
7
  "jsx": "react",
8
8
  "skipLibCheck": true,
9
- "moduleResolution": "node",
9
+ "moduleResolution": "bundler",
10
10
  "lib": [
11
11
  "dom",
12
12
  "es5",