nurseitaly-components 0.0.11 → 0.0.12

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.
@@ -0,0 +1,2 @@
1
+ /** Registers CommonContext.dispatch for non-React callers (e.g. axios interceptors). */
2
+ export default function CommonDispatchBridge(): null;
@@ -0,0 +1,12 @@
1
+ import { useContext, useEffect } from 'react';
2
+ import CommonContext from './CommonContext';
3
+ import { registerCommonDispatch } from './commonDispatch';
4
+ /** Registers CommonContext.dispatch for non-React callers (e.g. axios interceptors). */
5
+ export default function CommonDispatchBridge() {
6
+ const { dispatch } = useContext(CommonContext);
7
+ useEffect(() => {
8
+ registerCommonDispatch(dispatch);
9
+ return () => registerCommonDispatch(() => undefined);
10
+ }, [dispatch]);
11
+ return null;
12
+ }
@@ -0,0 +1,5 @@
1
+ import type { SessionAction } from './sessionTypes';
2
+ type CommonDispatch = (action: SessionAction) => void;
3
+ export declare function registerCommonDispatch(dispatch: CommonDispatch): void;
4
+ export declare function getCommonDispatch(): CommonDispatch | null;
5
+ export {};
@@ -0,0 +1,7 @@
1
+ let commonDispatch = null;
2
+ export function registerCommonDispatch(dispatch) {
3
+ commonDispatch = dispatch;
4
+ }
5
+ export function getCommonDispatch() {
6
+ return commonDispatch;
7
+ }
@@ -1,4 +1,6 @@
1
1
  export { default as CommonContext, CommonProvider } from './CommonContext';
2
+ export { default as CommonDispatchBridge } from './CommonDispatchBridge';
3
+ export { getCommonDispatch, registerCommonDispatch, } from './commonDispatch';
2
4
  export { default as CookieStorage } from './CookieStorage';
3
5
  export { commonLocalization, commonResources, featureResources, mergeResources, } from './Localization';
4
6
  export { default as ProfileService } from './services/ProfileService';
@@ -1,4 +1,6 @@
1
1
  export { default as CommonContext, CommonProvider } from './CommonContext';
2
+ export { default as CommonDispatchBridge } from './CommonDispatchBridge';
3
+ export { getCommonDispatch, registerCommonDispatch, } from './commonDispatch';
2
4
  export { default as CookieStorage } from './CookieStorage';
3
5
  export { commonLocalization, commonResources, featureResources, mergeResources, } from './Localization';
4
6
  export { default as ProfileService } from './services/ProfileService';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nurseitaly-components",
3
3
  "private": false,
4
- "version": "0.0.11",
4
+ "version": "0.0.12",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {