@openmrs/esm-framework 5.3.3-pre.1399 → 5.3.3-pre.1400

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.
@@ -1,4 +1,4 @@
1
- @openmrs/esm-framework:build: cache hit, replaying output 7e5fde656cf5dff6
1
+ @openmrs/esm-framework:build: cache hit, replaying output 313d257abee82df6
2
2
  @openmrs/esm-framework:build: assets by chunk 196 KiB (id hint: vendors)
3
3
  @openmrs/esm-framework:build:  asset 788.openmrs-esm-framework.js 130 KiB [emitted] [minimized] (id hint: vendors) 2 related assets
4
4
  @openmrs/esm-framework:build:  asset 645.openmrs-esm-framework.js 37.2 KiB [emitted] [minimized] (id hint: vendors) 1 related asset
@@ -26,4 +26,4 @@
26
26
  @openmrs/esm-framework:build:  openmrs-esm-framework.js
27
27
  @openmrs/esm-framework:build: 
28
28
  @openmrs/esm-framework:build: 
29
- @openmrs/esm-framework:build: webpack 5.88.0 compiled with 3 warnings in 22513 ms
29
+ @openmrs/esm-framework:build: webpack 5.88.0 compiled with 3 warnings in 21812 ms
package/mock.tsx CHANGED
@@ -3,8 +3,7 @@ import type {} from '@openmrs/esm-globals';
3
3
  import { createStore, type StoreApi } from 'zustand';
4
4
  import { NEVER, of } from 'rxjs';
5
5
  import { type SessionStore } from '@openmrs/esm-api';
6
- import { getDefaultsFromConfigSchema } from '@openmrs/esm-utils';
7
- import { interpolateUrl, type TemplateParams } from '@openmrs/esm-navigation';
6
+ import * as utils from '@openmrs/esm-utils';
8
7
 
9
8
  window.i18next = { ...window.i18next, language: 'en' };
10
9
 
@@ -118,9 +117,11 @@ export enum Type {
118
117
 
119
118
  let configSchema = {};
120
119
 
121
- export const getConfig = jest.fn().mockImplementation(() => Promise.resolve(getDefaultsFromConfigSchema(configSchema)));
120
+ export const getConfig = jest
121
+ .fn()
122
+ .mockImplementation(() => Promise.resolve(utils.getDefaultsFromConfigSchema(configSchema)));
122
123
 
123
- export const useConfig = jest.fn().mockImplementation(() => getDefaultsFromConfigSchema(configSchema));
124
+ export const useConfig = jest.fn().mockImplementation(() => utils.getDefaultsFromConfigSchema(configSchema));
124
125
 
125
126
  export function defineConfigSchema(moduleName, schema) {
126
127
  configSchema = schema;
@@ -167,42 +168,16 @@ export const subscribeToFeatureFlag = jest.fn((name: string, callback) => callba
167
168
 
168
169
  /* esm-navigation */
169
170
  export { interpolateUrl, interpolateString } from '@openmrs/esm-navigation';
170
- export let history = ['https://o3.openmrs.org/home'];
171
- export const navigate = jest.fn(({ to, templateParams }: { to: string; templateParams?: TemplateParams }) => {
172
- let target = interpolateUrl(to, templateParams);
173
- if (target.startsWith('/')) {
174
- target = window.location.origin + target;
175
- }
176
- try {
177
- // Don't mess with the real window.location
178
- if (!(window.location instanceof Location)) {
179
- (window.location as any).href = target;
180
- }
181
- } catch (e) {
182
- // window.location is probably not mocked. Don't worry about it.
183
- }
184
- history.push(target);
185
- });
186
- export const getHistory = jest.fn(() => history);
187
- export const clearHistory = jest.fn(() => {
188
- history = [];
189
- });
190
- export const goBackInHistory = jest.fn(({ toUrl }) => {
191
- const toIndex = history.lastIndexOf(toUrl);
192
- if (toIndex != -1) {
193
- const newHistory = history.slice(0, toIndex + 1);
194
- navigate({ to: history[toIndex] });
195
- history = newHistory;
196
- } else {
197
- throw new Error(`URL ${toUrl} not found in history; cannot go back to it.`);
198
- }
199
- });
171
+ export const navigate = jest.fn();
172
+ export const getHistory = jest.fn(() => ['https://o3.openmrs.org/home']);
173
+ export const clearHistory = jest.fn();
174
+ export const goBackInHistory = jest.fn();
200
175
 
201
176
  /* esm-offline */
202
177
  export const useConnectivity = jest.fn().mockReturnValue(true);
203
178
 
204
179
  /* esm-react-utils */
205
- export { ConfigurableLink } from '@openmrs/esm-react-utils';
180
+ export { ConfigurableLink, isDesktop, useStore, useStoreWithActions, createUseStore } from '@openmrs/esm-react-utils';
206
181
 
207
182
  export const ComponentContext = React.createContext(null);
208
183
 
@@ -232,6 +207,8 @@ export const useSession = jest.fn(() => ({
232
207
 
233
208
  export const useLayoutType = jest.fn(() => 'desktop');
234
209
 
210
+ export const useAssignedExtensions = jest.fn(() => []);
211
+
235
212
  export const useExtensionSlotMeta = jest.fn(() => ({}));
236
213
 
237
214
  export const useConnectedExtensions = jest.fn(() => []);
@@ -246,8 +223,6 @@ export const useExtensionStore = getExtensionStore();
246
223
 
247
224
  export const useFeatureFlag = jest.fn().mockReturnValue(true);
248
225
 
249
- export { isDesktop, useStore, useStoreWithActions, createUseStore } from '@openmrs/esm-react-utils';
250
-
251
226
  export const usePagination = jest.fn().mockImplementation(() => ({
252
227
  currentPage: 1,
253
228
  goTo: () => {},
@@ -286,6 +261,8 @@ export function useOpenmrsSWR(key: string | Array<any>) {
286
261
 
287
262
  export const useDebounce = jest.fn().mockImplementation((value) => value);
288
263
 
264
+ export const useOnClickOutside = jest.fn();
265
+
289
266
  /* esm-styleguide */
290
267
  export const showNotification = jest.fn();
291
268
  export const showActionableNotification = jest.fn();
@@ -293,22 +270,19 @@ export const showToast = jest.fn();
293
270
  export const showSnackbar = jest.fn();
294
271
  export const showModal = jest.fn();
295
272
 
296
- export const LeftNavMenu = jest.fn();
273
+ export const LeftNavMenu = jest.fn(() => <div>Left Nav Menu</div>);
297
274
  export const setLeftNav = jest.fn();
298
275
  export const unsetLeftNav = jest.fn();
299
276
 
300
- export const OpenmrsDatePicker = jest.fn();
277
+ export const OpenmrsDatePicker = jest.fn(() => <div>OpenMRS DatePicker</div>);
301
278
 
302
279
  /* esm-utils */
303
- export {
304
- getDefaultsFromConfigSchema,
305
- parseDate,
306
- formatDate,
307
- formatDatetime,
308
- formatTime,
309
- age,
310
- } from '@openmrs/esm-utils';
280
+ export { getDefaultsFromConfigSchema, parseDate, formatDate, formatDatetime, formatTime } from '@openmrs/esm-utils';
281
+
282
+ export const age = jest.fn((arg) => utils.age(arg));
311
283
 
312
284
  export function isVersionSatisfied() {
313
285
  return true;
314
286
  }
287
+
288
+ export const translateFrom = jest.fn((m, key, fallback) => fallback ?? key);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-framework",
3
- "version": "5.3.3-pre.1399",
3
+ "version": "5.3.3-pre.1400",
4
4
  "license": "MPL-2.0",
5
5
  "browser": "dist/openmrs-esm-framework.js",
6
6
  "main": "src/index.ts",
@@ -37,20 +37,20 @@
37
37
  "access": "public"
38
38
  },
39
39
  "dependencies": {
40
- "@openmrs/esm-api": "5.3.3-pre.1399",
41
- "@openmrs/esm-config": "5.3.3-pre.1399",
42
- "@openmrs/esm-dynamic-loading": "5.3.3-pre.1399",
43
- "@openmrs/esm-error-handling": "5.3.3-pre.1399",
44
- "@openmrs/esm-extensions": "5.3.3-pre.1399",
45
- "@openmrs/esm-feature-flags": "5.3.3-pre.1399",
46
- "@openmrs/esm-globals": "5.3.3-pre.1399",
47
- "@openmrs/esm-navigation": "5.3.3-pre.1399",
48
- "@openmrs/esm-offline": "5.3.3-pre.1399",
49
- "@openmrs/esm-react-utils": "5.3.3-pre.1399",
50
- "@openmrs/esm-routes": "5.3.3-pre.1399",
51
- "@openmrs/esm-state": "5.3.3-pre.1399",
52
- "@openmrs/esm-styleguide": "5.3.3-pre.1399",
53
- "@openmrs/esm-utils": "5.3.3-pre.1399",
40
+ "@openmrs/esm-api": "5.3.3-pre.1400",
41
+ "@openmrs/esm-config": "5.3.3-pre.1400",
42
+ "@openmrs/esm-dynamic-loading": "5.3.3-pre.1400",
43
+ "@openmrs/esm-error-handling": "5.3.3-pre.1400",
44
+ "@openmrs/esm-extensions": "5.3.3-pre.1400",
45
+ "@openmrs/esm-feature-flags": "5.3.3-pre.1400",
46
+ "@openmrs/esm-globals": "5.3.3-pre.1400",
47
+ "@openmrs/esm-navigation": "5.3.3-pre.1400",
48
+ "@openmrs/esm-offline": "5.3.3-pre.1400",
49
+ "@openmrs/esm-react-utils": "5.3.3-pre.1400",
50
+ "@openmrs/esm-routes": "5.3.3-pre.1400",
51
+ "@openmrs/esm-state": "5.3.3-pre.1400",
52
+ "@openmrs/esm-styleguide": "5.3.3-pre.1400",
53
+ "@openmrs/esm-utils": "5.3.3-pre.1400",
54
54
  "dayjs": "^1.10.7"
55
55
  },
56
56
  "peerDependencies": {