procode-lowcode-core 1.0.2 → 1.0.3

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,2 +1,2 @@
1
- declare const setupStoreAction: (dispatch: any, eventService: any) => void;
1
+ declare const setupStoreAction: (dispatch: any, eventService: any, store: any) => void;
2
2
  export default setupStoreAction;
@@ -5,12 +5,12 @@ export declare const commonStore: import("@reduxjs/toolkit/dist/configureStore")
5
5
  loadedSchema: {};
6
6
  pendingRequests: number;
7
7
  };
8
- }, import("redux").AnyAction, [import("@reduxjs/toolkit").ThunkMiddleware<{
8
+ }, import("redux").AnyAction, import("@reduxjs/toolkit").MiddlewareArray<[import("@reduxjs/toolkit").ThunkMiddleware<{
9
9
  commonData: {
10
10
  enableHeader: boolean;
11
11
  enableFooter: boolean;
12
12
  loadedSchema: {};
13
13
  pendingRequests: number;
14
14
  };
15
- }, import("redux").AnyAction, undefined>]>;
15
+ }, import("redux").AnyAction, undefined>]>>;
16
16
  export type CommonState = ReturnType<typeof commonStore.getState>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "procode-lowcode-core",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "ProCode Core Library - React framework for low-code applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -14,6 +14,7 @@ import { EventService } from "../Services/EventService";
14
14
  import { ScreenSchema } from "../UIElement/UIElementDefinations/ScreenSchema";
15
15
  import { ViewModel } from "../DataModel/ViewModel";
16
16
  import { appActions } from "../Store/Slices/appSlice";
17
+ import { useStore } from "react-redux";
17
18
 
18
19
  export type screenInitializerProps = {
19
20
  children?: prcElement;
@@ -27,6 +28,7 @@ const ScreenInitializer = (props: screenInitializerProps): prcElement => {
27
28
  const location = useLocation();
28
29
  const params = useParams();
29
30
  const dispatch = useDispatch();
31
+ const store = useStore();
30
32
 
31
33
  const saveMeta = (uiMetaData: ScreenSchema) => {
32
34
  dispatch(metaDataActions.save(uiMetaData));
@@ -55,7 +57,7 @@ const ScreenInitializer = (props: screenInitializerProps): prcElement => {
55
57
  }, [props.uiMetaData?.screenId]);
56
58
 
57
59
  const initializeScreen = async () => {
58
- setupStoreAction(dispatch, props.eventService);
60
+ setupStoreAction(dispatch, props.eventService, store);
59
61
  saveMeta(props.uiMetaData);
60
62
  enableHeader();
61
63
  enableFooter();
@@ -98,4 +100,4 @@ const ScreenInitializer = (props: screenInitializerProps): prcElement => {
98
100
  );
99
101
  };
100
102
 
101
- export default ScreenInitializer;
103
+ export default ScreenInitializer;
@@ -2,11 +2,12 @@ import { eventServiceType } from "../../Constant";
2
2
  import { appActions } from "../../Store/Slices/appSlice";
3
3
  import { metaDataActions } from "../../Store/Slices/metaDataSlice";
4
4
 
5
- const setupStoreAction = (dispatch: any, eventService: any) => {
5
+ const setupStoreAction = (dispatch: any, eventService: any, store: any) => {
6
6
  const actions = {
7
7
  [eventServiceType.DATASTATE_ACTION]: appActions,
8
8
  [eventServiceType.UI_SCHEMA_ACTION]: metaDataActions,
9
9
  [eventServiceType.DISPATCH_STORE]: dispatch,
10
+ [eventServiceType.DATASTATE]: () => store.getState().app.viewModel,
10
11
  };
11
12
 
12
13
  Object.entries(actions).forEach(([eventType, action]) => {
@@ -14,4 +15,4 @@ const setupStoreAction = (dispatch: any, eventService: any) => {
14
15
  });
15
16
  };
16
17
 
17
- export default setupStoreAction;
18
+ export default setupStoreAction;
package/src/Constant.ts CHANGED
@@ -32,7 +32,7 @@ export const eventServiceType = {
32
32
  DISPATCH_STORE: "DISPATCH_STORE",
33
33
  UI_SCHEMA_ACTION: "UI_SCHEMA_ACTION",
34
34
  UISCHEMA: "UISCHEMA",
35
- DATASTATE:"DATASTATE",
35
+ DATASTATE: "DATASTATE",
36
36
  };
37
37
  export const parentRoute = ":parentslug/*";
38
38
  export const childRoute = "section/:childslug/*";
@@ -5,5 +5,9 @@ export const commonStore = configureStore({
5
5
  reducer: {
6
6
  commonData: commonDataReducer,
7
7
  },
8
+ middleware: (getDefaultMiddleware) =>
9
+ getDefaultMiddleware({
10
+ serializableCheck: false
11
+ })
8
12
  });
9
- export type CommonState = ReturnType<typeof commonStore.getState>;
13
+ export type CommonState = ReturnType<typeof commonStore.getState>;
@@ -14,10 +14,13 @@ export const createStore = () => {
14
14
  metaData: metaDataReducer,
15
15
  },
16
16
  middleware: (getDefaultMiddleware) =>
17
- getDefaultMiddleware({ thunk: false })
17
+ getDefaultMiddleware({
18
+ thunk: false,
19
+ serializableCheck: false
20
+ })
18
21
  .concat(saga)
19
22
  .concat(syncStoresMiddleware(commonStore)),
20
23
  }),
21
24
  saga,
22
25
  };
23
- };
26
+ };