jamespot-react-core 1.1.13 → 1.1.20
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/.github/workflows/deploy-dev-branches.yml +1 -1
- package/.github/workflows/increment-npm-version.yml +1 -1
- package/.github/workflows/npm-package.yml +1 -1
- package/build/App.d.ts +9 -6
- package/build/app.bundle.js +255 -236
- package/build/app.bundle.js.map +1 -1
- package/build/components/NoMatch.component.d.ts +1 -0
- package/build/components/types.d.ts +0 -1
- package/build/displayer/components/DisplaySingleValue.component.d.ts +0 -1
- package/build/displayer/list/formatter.d.ts +10 -112
- package/build/displayer/types.d.ts +2 -54
- package/build/redux/slice/Application.slice.d.ts +0 -6
- package/build/redux/slice/Article.slice.d.ts +1 -7
- package/build/redux/slice/Model.slice.d.ts +0 -6
- package/build/redux/slice/Toast.slice.d.ts +1 -7
- package/build/redux/slice/User.slice.d.ts +1 -7
- package/build/redux/store.d.ts +2 -9
- package/build/utils/router.d.ts +13 -0
- package/build/utils/types.d.ts +7 -14
- package/ext-component-list.json +20 -8
- package/package.json +8 -7
- package/src/App.tsx +41 -54
- package/src/components/ExtensionProvider.component.tsx +5 -3
- package/src/components/IfAppIsActivated.component.tsx +2 -1
- package/src/components/NoMatch.component.tsx +5 -0
- package/src/components/types.ts +0 -1
- package/src/displayer/DisplayAttribute.component.tsx +4 -2
- package/src/displayer/components/DisplaySingleValue.component.tsx +0 -6
- package/src/displayer/list/formatter.tsx +14 -182
- package/src/displayer/types.ts +2 -60
- package/src/displayer/useDisplay.ts +17 -33
- package/src/redux/store.tsx +21 -27
- package/src/utils/router.tsx +46 -0
- package/src/utils/types.ts +7 -15
- package/build/294.bundle.js +0 -2
- package/build/294.bundle.js.map +0 -1
- package/build/715.bundle.js +0 -2
- package/build/715.bundle.js.map +0 -1
- package/build/76.bundle.js +0 -2
- package/build/76.bundle.js.map +0 -1
- package/build/862.bundle.js +0 -2
- package/build/862.bundle.js.map +0 -1
- package/build/955.bundle.js +0 -2
- package/build/955.bundle.js.map +0 -1
- package/build/components/AppStateLoader.component.d.ts +0 -7
- package/build/components/index.d.ts +0 -1
- package/build/displayer/DisplayForm.component.d.ts +0 -19
- package/build/displayer/Empty.d.ts +0 -1
- package/build/redux/slice/AppState.slice.d.ts +0 -29
- package/src/components/AppStateLoader.component.tsx +0 -54
- package/src/components/index.tsx +0 -31
- package/src/displayer/DisplayForm.component.tsx +0 -78
- package/src/displayer/Empty.tsx +0 -4
- package/src/redux/slice/AppState.slice.ts +0 -25
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as ListFormatter from './list/formatter';
|
|
2
|
-
import { Fields, Displayer
|
|
2
|
+
import { Fields, Displayer } from './types';
|
|
3
3
|
import { useSelector } from 'react-redux';
|
|
4
4
|
import { Model } from '../utils/types';
|
|
5
|
+
import JRCore from 'App';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
*
|
|
@@ -9,41 +10,24 @@ import { Model } from '../utils/types';
|
|
|
9
10
|
* @param type - model type (user, article, spot...)
|
|
10
11
|
*/
|
|
11
12
|
export function useDisplay<T extends string>(fields: Fields<T>, type: string): Displayer {
|
|
12
|
-
const model: Model<string> = useSelector((state: any) =>
|
|
13
|
+
const model: Model<string> = useSelector((state: any) => JRCore.store.selectors.model.selectById(state, type));
|
|
13
14
|
|
|
14
15
|
if (!model || !model.fields) return [];
|
|
15
16
|
|
|
16
17
|
const configuration = Object.values(model.fields);
|
|
18
|
+
return fields.map((field) => {
|
|
19
|
+
const fieldConfiguration = configuration.find((conf) => conf.name === field);
|
|
20
|
+
if (!fieldConfiguration) return;
|
|
17
21
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return ListFormatter.formatDate(fieldConfiguration);
|
|
30
|
-
case 'text':
|
|
31
|
-
return ListFormatter.formatString(fieldConfiguration);
|
|
32
|
-
case 'number':
|
|
33
|
-
return ListFormatter.formatNumber(fieldConfiguration);
|
|
34
|
-
case 'taxonomy':
|
|
35
|
-
return ListFormatter.formatTaxonomy(fieldConfiguration);
|
|
36
|
-
case 'orientedlinks':
|
|
37
|
-
return ListFormatter.formatOrientedlinks(fieldConfiguration);
|
|
38
|
-
case 'uri':
|
|
39
|
-
return ListFormatter.formatUri(fieldConfiguration);
|
|
40
|
-
case 'radio':
|
|
41
|
-
return ListFormatter.formatRadio(fieldConfiguration);
|
|
42
|
-
case 'checkbox':
|
|
43
|
-
return ListFormatter.formatCheckbox(fieldConfiguration);
|
|
44
|
-
default:
|
|
45
|
-
return ListFormatter.formatDefault(fieldConfiguration);
|
|
46
|
-
}
|
|
47
|
-
})
|
|
48
|
-
.filter((v) => !!v);
|
|
22
|
+
switch (fieldConfiguration.widget.type) {
|
|
23
|
+
case 'text':
|
|
24
|
+
return ListFormatter.formatString(fieldConfiguration);
|
|
25
|
+
case 'number':
|
|
26
|
+
return ListFormatter.formatNumber(fieldConfiguration);
|
|
27
|
+
case 'taxonomy':
|
|
28
|
+
return ListFormatter.formatTaxonomy(fieldConfiguration);
|
|
29
|
+
default:
|
|
30
|
+
return ListFormatter.formatDefault(fieldConfiguration);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
49
33
|
}
|
package/src/redux/store.tsx
CHANGED
|
@@ -8,14 +8,12 @@ import { applicationActions, applicationSelector, applicationSlice } from './sli
|
|
|
8
8
|
import { modelActions, modelSelector, modelSlice } from './slice/Model.slice';
|
|
9
9
|
import { toastSlice } from './slice/Toast.slice';
|
|
10
10
|
import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux';
|
|
11
|
-
import { appStateActions, appStateSelector, appStateSlice } from './slice/AppState.slice';
|
|
12
11
|
|
|
13
12
|
export interface JInjectStore extends ReturnType<typeof createStore> {
|
|
14
13
|
asyncReducers: AsyncReducers;
|
|
15
14
|
add: (key: string, asyncReducer: Reducer) => void;
|
|
16
15
|
selectors: any;
|
|
17
16
|
actions: any;
|
|
18
|
-
useAppDispatch: any;
|
|
19
17
|
}
|
|
20
18
|
|
|
21
19
|
export interface AsyncReducers {
|
|
@@ -30,32 +28,10 @@ const staticReducers = {
|
|
|
30
28
|
users: userSlice.reducer,
|
|
31
29
|
articles: articleSlice.reducer,
|
|
32
30
|
}),
|
|
33
|
-
appState: appStateSlice.reducer,
|
|
34
31
|
form: formReducer,
|
|
35
32
|
toasts: toastSlice.reducer,
|
|
36
33
|
};
|
|
37
34
|
|
|
38
|
-
function createReducer(asyncReducers: AsyncReducers) {
|
|
39
|
-
return combineReducers({
|
|
40
|
-
...staticReducers,
|
|
41
|
-
...asyncReducers,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function createStore(initialAsyncReducers: {}, initialState: any) {
|
|
46
|
-
return configureStore({
|
|
47
|
-
reducer: createReducer(initialAsyncReducers),
|
|
48
|
-
preloadedState: initialState,
|
|
49
|
-
middleware: [thunk, logger],
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export type AppDispatch = ReturnType<typeof createStore>['dispatch'];
|
|
54
|
-
export type RootState = ReturnType<ReturnType<typeof createStore>['getState']>;
|
|
55
|
-
|
|
56
|
-
export const useAppDispatch = () => useDispatch<AppDispatch>();
|
|
57
|
-
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
|
|
58
|
-
|
|
59
35
|
// Configure the store
|
|
60
36
|
export function makeStore(initialState: any) {
|
|
61
37
|
const initialAsyncReducers = {};
|
|
@@ -84,18 +60,36 @@ export function makeStore(initialState: any) {
|
|
|
84
60
|
application: applicationSelector,
|
|
85
61
|
model: modelSelector,
|
|
86
62
|
user: usersSelector,
|
|
87
|
-
appState: appStateSelector,
|
|
88
63
|
},
|
|
89
64
|
actions: {
|
|
90
|
-
appState: appStateActions,
|
|
91
65
|
article: articleActions,
|
|
92
66
|
application: applicationActions,
|
|
93
67
|
model: modelActions,
|
|
94
68
|
user: userActions,
|
|
95
69
|
generic: genericActions,
|
|
96
70
|
},
|
|
97
|
-
useAppDispatch: useAppDispatch,
|
|
98
71
|
};
|
|
99
72
|
|
|
100
73
|
return jStore;
|
|
101
74
|
}
|
|
75
|
+
|
|
76
|
+
function createReducer(asyncReducers: AsyncReducers) {
|
|
77
|
+
return combineReducers({
|
|
78
|
+
...staticReducers,
|
|
79
|
+
...asyncReducers,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function createStore(initialAsyncReducers: {}, initialState: any) {
|
|
84
|
+
return configureStore({
|
|
85
|
+
reducer: createReducer(initialAsyncReducers),
|
|
86
|
+
preloadedState: initialState,
|
|
87
|
+
middleware: [thunk, logger],
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export type AppDispatch = ReturnType<typeof createStore>['dispatch'];
|
|
92
|
+
export type RootState = ReturnType<ReturnType<typeof createStore>['getState']>;
|
|
93
|
+
|
|
94
|
+
export const useAppDispatch = () => useDispatch<AppDispatch>();
|
|
95
|
+
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as ReactDOM from 'react-dom';
|
|
3
|
+
import { ExtensionProvider } from '../components/ExtensionProvider.component';
|
|
4
|
+
import { NoMatch } from '../components/NoMatch.component';
|
|
5
|
+
import { BrowserRouter, useRoutes } from 'react-router-dom';
|
|
6
|
+
import type { RouteObject } from 'react-router-dom';
|
|
7
|
+
|
|
8
|
+
export interface ReactRouter {
|
|
9
|
+
routes: RouteObject[];
|
|
10
|
+
addRoute: (route: RouteObject) => void;
|
|
11
|
+
init: (idDiv: string) => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const Routes = () => {
|
|
15
|
+
const routesObject: RouteObject[] = [
|
|
16
|
+
{
|
|
17
|
+
path: '/ng/rr',
|
|
18
|
+
children: [...J.react.router.routes],
|
|
19
|
+
},
|
|
20
|
+
{ path: '*', element: <NoMatch /> },
|
|
21
|
+
];
|
|
22
|
+
return useRoutes(routesObject);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
class Router implements ReactRouter {
|
|
26
|
+
routes: RouteObject[] = [];
|
|
27
|
+
|
|
28
|
+
addRoute = (route: RouteObject) => {
|
|
29
|
+
this.routes.push(route);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
init = (idDiv: string) => {
|
|
33
|
+
ReactDOM.render(
|
|
34
|
+
<ExtensionProvider>
|
|
35
|
+
<BrowserRouter>
|
|
36
|
+
<Routes />
|
|
37
|
+
</BrowserRouter>
|
|
38
|
+
</ExtensionProvider>,
|
|
39
|
+
document.getElementById(idDiv),
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const router = new Router();
|
|
45
|
+
|
|
46
|
+
export default router;
|
package/src/utils/types.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ReactRegistry } from './registry';
|
|
3
3
|
import { ReactTranslation, SupportedLanguages, TranslationKeys } from './translation';
|
|
4
|
-
export { Configuration, DisplayAttributesProps
|
|
4
|
+
export { Configuration, DisplayAttributesProps } from '../displayer/types';
|
|
5
5
|
export * from '../components/types';
|
|
6
6
|
import { useDisplay } from '../displayer/useDisplay';
|
|
7
7
|
import { Configuration } from '../displayer/types';
|
|
8
|
-
import {
|
|
8
|
+
import { ReactRouter } from './router';
|
|
9
9
|
import { toasts } from '../redux/slice/Toast.slice';
|
|
10
|
-
import { JInjectStore } from '../redux/store';
|
|
11
10
|
|
|
12
|
-
export type
|
|
11
|
+
export type gabarit =
|
|
13
12
|
| 'core-1-cols'
|
|
14
13
|
| 'core-2-cols'
|
|
15
14
|
| 'core-3-cols'
|
|
@@ -22,18 +21,19 @@ export type Gabarit =
|
|
|
22
21
|
|
|
23
22
|
export interface ReactCore {
|
|
24
23
|
extensions: ReactExtensions;
|
|
25
|
-
store:
|
|
24
|
+
store: any;
|
|
26
25
|
actions: object;
|
|
27
26
|
registry: ReactRegistry;
|
|
28
27
|
locale?: SupportedLanguages;
|
|
29
28
|
translation?: ReactTranslation;
|
|
30
29
|
theme: any;
|
|
31
30
|
socket?: ReactSocket;
|
|
31
|
+
router: ReactRouter;
|
|
32
32
|
require: (extensionName: string, args?: any) => void;
|
|
33
33
|
extensionAdd: (extensionName: string, load: () => void) => void;
|
|
34
34
|
toasts: typeof toasts;
|
|
35
35
|
|
|
36
|
-
routeAdd: (route: string, extensionName: string, idDiv: string, gabarit?:
|
|
36
|
+
routeAdd: (route: string, extensionName: string, idDiv: string, gabarit?: gabarit, gabaritOptions?: object) => void;
|
|
37
37
|
transitionTo: (
|
|
38
38
|
stateName: string,
|
|
39
39
|
args: {},
|
|
@@ -120,11 +120,6 @@ export interface WindowJ {
|
|
|
120
120
|
jamespotReactTheme: any;
|
|
121
121
|
applications: Application[];
|
|
122
122
|
models: Model<string>[];
|
|
123
|
-
hook: {
|
|
124
|
-
useTimeout: typeof useTimeout;
|
|
125
|
-
useDebounce: typeof useDebounce;
|
|
126
|
-
useDidMountEffect: typeof useDidMountEffect;
|
|
127
|
-
};
|
|
128
123
|
}
|
|
129
124
|
|
|
130
125
|
export interface Application {
|
|
@@ -173,14 +168,11 @@ export type IsAppActivateProps = {
|
|
|
173
168
|
|
|
174
169
|
export type ReactExtensionProps = {
|
|
175
170
|
extensionName: string;
|
|
176
|
-
moduleName?: string;
|
|
177
171
|
route?: string;
|
|
178
172
|
idAnchor?: string;
|
|
179
173
|
reducerName?: string;
|
|
180
|
-
gabarit?:
|
|
174
|
+
gabarit?: gabarit;
|
|
181
175
|
apiDependency?: string;
|
|
182
176
|
};
|
|
183
177
|
|
|
184
|
-
export * from '../displayer/types';
|
|
185
|
-
|
|
186
178
|
export { RootState } from '../redux/store';
|
package/build/294.bundle.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[294],{7294:(e,c,t)=>{t.r(c),t.d(c,{IfAppIsActivated:()=>n});var s=t(855);const n=e=>{const{isDependencyActivated:c}=(0,s.useSelector)((c=>({isDependencyActivated:J.react.store.selectors.application.selectById(c,e.dependency)})));return c?e.children:null}}}]);
|
|
2
|
-
//# sourceMappingURL=294.bundle.js.map
|
package/build/294.bundle.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"294.bundle.js","mappings":"yJAOO,MAAMA,EAAoBC,IAC7B,MAAM,sBAAEC,IAA0B,IAAAC,cAAaC,IACpC,CACHF,sBAAuBG,EAAEC,MAAMC,MAAMC,UAAUC,YAAYC,WAAWN,EAAOH,EAAMU,gBAG3F,OAAOT,EAAwBD,EAAMW,SAAW","sources":["webpack://ReactCore/./src/components/IfAppIsActivated.component.tsx"],"sourcesContent":["import { useSelector } from 'react-redux';\n\nexport type IfAppIsActivatedProps = {\n dependency: string;\n children: JSX.Element;\n};\n\nexport const IfAppIsActivated = (props: IfAppIsActivatedProps) => {\n const { isDependencyActivated } = useSelector((state: any) => {\n return {\n isDependencyActivated: J.react.store.selectors.application.selectById(state, props.dependency),\n };\n });\n return isDependencyActivated ? props.children : null;\n};\n"],"names":["IfAppIsActivated","props","isDependencyActivated","useSelector","state","J","react","store","selectors","application","selectById","dependency","children"],"sourceRoot":""}
|
package/build/715.bundle.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[715],{715:(e,t,n)=>{n.r(t),n.d(t,{DisplayAttributes:()=>c});var r=n(7363);const s=e=>{const{attribute:t}=e,n=t.components.render,s=t.components.wrapper;return r.createElement(s,null,r.createElement(n,Object.assign({},e)))},c=e=>{const{attributesName:t,object:n,componentsOverride:c}=e;return J.react.useDisplay(t||[],n.type).map((e=>{if(e)return e.components=Object.assign(Object.assign({},e.components),c&&c[e.name]),r.createElement(s,{attribute:e,object:n})}))}}}]);
|
|
2
|
-
//# sourceMappingURL=715.bundle.js.map
|
package/build/715.bundle.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"715.bundle.js","mappings":"0JAMA,MAAMA,EAAmBC,IACrB,MAAM,UAAEC,GAAcD,EAChBE,EAAiED,EAAUE,WAAWC,OACtFC,EAAiDJ,EAAUE,WAAWG,QAE5E,OACI,gBAACD,EAAgB,KACb,gBAACH,EAAe,iBAAKF,MAoBpBO,EAAqBP,IAC9B,MAAM,eAAEQ,EAAc,OAAEC,EAAM,mBAAEC,GAAuBV,EAGvD,OAFeW,EAAEC,MAAMC,WAAWL,GAAkB,GAAIC,EAAOK,MAEjDC,KAAKC,IACf,GAAKA,EAKL,OAJAA,EAAeb,WAAa,OAAH,wBAClBa,EAAeb,YACdO,GAAsBA,EAAmBM,EAAeC,OAEzD,gBAAClB,EAAe,CAACE,UAAWe,EAAgBP,OAAQA","sources":["webpack://ReactCore/./src/displayer/DisplayAttribute.component.tsx"],"sourcesContent":["import * as React from 'react';\nimport { DisplayAttributesProps, RenderAttributeProps } from './types';\n\n/***\n * Choose the component to render according to the type of the object\n */\nconst RenderAttribute = (props: RenderAttributeProps) => {\n const { attribute } = props;\n const RenderComponent: React.FunctionComponent<RenderAttributeProps> = attribute.components.render;\n const WrapperComponent: React.FunctionComponent<any> = attribute.components.wrapper;\n\n return (\n <WrapperComponent>\n <RenderComponent {...props} />\n </WrapperComponent>\n );\n};\n\n/****\n * The jamespot model depend on the platform\n * For example a user can have the size attribute only for a given platform\n * The model specifics of a platform are stored in J.model\n *\n * This component display an array of attributes only if this attribute is activated on the platform\n *\n * @param props.object the object to display (ie the user)\n * @param props.attributesName an array of string : the list of attributes we want to display\n * @param props.componentsOverride we can override the default render of the attribute\n * @param props.componentsOverride.render the whole component logic (we override @DisplayList or @DisplaySingleValue for exemple)\n * @param props.componentsOverride.wrapper the attribute is wrapped inside an element. For a list it can be an UL\n * @param props.componentsOverride.element the component just above the element value\n * Note :If we override the \"render\" you can't override \"wrapper\" and \"element\" because the render rewrite everything\n */\nexport const DisplayAttributes = (props: DisplayAttributesProps) => {\n const { attributesName, object, componentsOverride } = props;\n const config = J.react.useDisplay(attributesName || [], object.type);\n\n return config.map((attributeProps) => {\n if (!attributeProps) return;\n attributeProps.components = {\n ...attributeProps.components,\n ...(componentsOverride && componentsOverride[attributeProps.name]),\n };\n return <RenderAttribute attribute={attributeProps} object={object} />;\n });\n};\n"],"names":["RenderAttribute","props","attribute","RenderComponent","components","render","WrapperComponent","wrapper","DisplayAttributes","attributesName","object","componentsOverride","J","react","useDisplay","type","map","attributeProps","name"],"sourceRoot":""}
|
package/build/76.bundle.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[76],{3076:(e,t,n)=>{n.r(t),n.d(t,{DisplayForm:()=>c});var a=n(7363),r=n(3230),s=n(5181);const o=e=>a.createElement(e.components.input,Object.assign({},e)),c=a.forwardRef(((e,t)=>{const n=(0,s.useIntl)(),c=a.useRef(null),{attributesName:l,object:i,componentsOverride:u}=e,m=J.react.useDisplay(l||[],i.type),p=J.react.registry.getLazyComponent("ValidationButton"),{handleSubmit:b,control:d,reset:f}=(0,r.useForm)({defaultValues:Object.assign({},Object.fromEntries(m.map((e=>[e.accessor,"checkbox"===e.widget.type?[]:""])))),criteriaMode:"all"});return a.useImperativeHandle(t,(()=>({reset:()=>{var e;null===(e=null==c?void 0:c.current)||void 0===e||e.scrollTo(0,0),f()}})),[]),a.createElement("form",{onSubmit:b(e.onSubmit),ref:c},m.map(((e,t)=>(e.components=Object.assign(Object.assign({},e.components),null==u?void 0:u[e.name]),a.createElement(o,Object.assign({key:t,control:d},e))))),a.createElement(p,{type:"submit"},n.formatMessage({id:"APP_ASEI_Modal_Creation_Title"})))}))}}]);
|
|
2
|
-
//# sourceMappingURL=76.bundle.js.map
|
package/build/76.bundle.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"76.bundle.js","mappings":"wKASA,MAAMA,EAAeC,GAA4B,gBAACA,EAAMC,WAAWC,MAAK,iBAAKF,IAkBhEG,EAAc,cAAmD,CAACH,EAAOI,KAClF,MAAMC,GAAO,IAAAC,WAEPC,EAAU,SAA8B,OAExC,eAAEC,EAAc,OAAEC,EAAM,mBAAEC,GAAuBV,EACjDW,EAAaC,EAAEC,MAAMC,WAAWN,GAAkB,GAAIC,EAAOM,MAC7DC,EAAmBJ,EAAEC,MAAMI,SAASC,iBAAiC,qBAErE,aAAEC,EAAY,QAAEC,EAAO,MAAEC,IAAU,IAAAC,SAAQ,CAC7CC,cAAe,OAAF,UAELC,OAAeC,YACfd,EAAWe,KAAKC,GAAgB,CAC5BA,EAAYC,SACgB,aAA5BD,EAAYE,OAAOd,KAAsB,GAAK,QAI1De,aAAc,QAgBlB,OAbA,sBACI1B,GACA,KAAM,CACFiB,MAAO,K,MAEa,QAAhB,EAAAd,MAAAA,OAAO,EAAPA,EAASwB,eAAO,SAAEC,SAAS,EAAG,GAE9BX,QAGR,IAIA,wBAAMY,SAAUd,EAAanB,EAAMiC,UAAW7B,IAAKG,GAC9CI,EAAWe,KAAI,CAACC,EAAaO,KAC1BP,EAAY1B,WAAa,OAAH,wBACf0B,EAAY1B,YACZS,MAAAA,OAAkB,EAAlBA,EAAqBiB,EAAYQ,OAEjC,gBAACpC,EAAW,eAACqC,IAAKF,EAAOd,QAASA,GAAaO,OAG1D,gBAACX,EAAgB,CAACD,KAAK,UAClBV,EAAKgC,cAAc,CAAEC,GAAI","sources":["webpack://ReactCore/./src/displayer/DisplayForm.component.tsx"],"sourcesContent":["import * as React from 'react';\nimport { DisplayFormProps, DisplayFormRef, RenderInputProps } from './types';\nimport { useForm } from 'react-hook-form';\nimport type { JRCButtonProps } from 'jamespot-react-components';\nimport { useIntl } from 'react-intl';\n\n/***\n * Choose the component to render according to the type of the object\n */\nconst RenderInput = (props: RenderInputProps) => <props.components.input {...props} />;\n\n/****\n * The jamespot model depend on the platform\n * For example a user can have the size attribute only for a given platform\n * The model specifics of a platform are stored in J.model\n *\n * This component display an array of attributes only if this attribute is activated on the platform\n *\n * @param props.object the object to display (ie the user)\n * @param props.attributesName an array of string : the list of attributes we want to display\n * @param props.componentsOverride we can override the default render of the attribute\n * @param props.componentsOverride.render the whole component logic (we override @DisplayList or @DisplaySingleValue for exemple)\n * @param props.componentsOverride.wrapper the attribute is wrapped inside an element. For a list it can be an UL\n * @param props.componentsOverride.element the component just above the element value\n * @param props.componentsOverride.input the component input\n * Note :If we override the \"render\" you can't override \"wrapper\" and \"element\" because the render rewrite everything\n */\nexport const DisplayForm = React.forwardRef<DisplayFormRef, DisplayFormProps>((props, ref) => {\n const intl = useIntl();\n\n const formRef = React.useRef<HTMLFormElement>(null);\n\n const { attributesName, object, componentsOverride } = props;\n const formConfig = J.react.useDisplay(attributesName || [], object.type);\n const ValidationButton = J.react.registry.getLazyComponent<JRCButtonProps>('ValidationButton');\n\n const { handleSubmit, control, reset } = useForm({\n defaultValues: {\n // initialize with empty array of checkbox, empty string otherwise\n ...(Object as any).fromEntries(\n formConfig.map((inputConfig) => [\n inputConfig.accessor,\n inputConfig.widget.type === 'checkbox' ? [] : '',\n ]),\n ),\n },\n criteriaMode: 'all',\n });\n\n React.useImperativeHandle(\n ref,\n () => ({\n reset: () => {\n // in case the form is scrollable\n formRef?.current?.scrollTo(0, 0);\n // reset react-hook-form form\n reset();\n },\n }),\n [],\n );\n\n return (\n <form onSubmit={handleSubmit(props.onSubmit)} ref={formRef}>\n {formConfig.map((inputConfig, index) => {\n inputConfig.components = {\n ...inputConfig.components,\n ...componentsOverride?.[inputConfig.name],\n };\n return <RenderInput key={index} control={control} {...inputConfig} />;\n })}\n\n <ValidationButton type=\"submit\">\n {intl.formatMessage({ id: 'APP_ASEI_Modal_Creation_Title' })}\n </ValidationButton>\n </form>\n );\n});\n"],"names":["RenderInput","props","components","input","DisplayForm","ref","intl","useIntl","formRef","attributesName","object","componentsOverride","formConfig","J","react","useDisplay","type","ValidationButton","registry","getLazyComponent","handleSubmit","control","reset","useForm","defaultValues","Object","fromEntries","map","inputConfig","accessor","widget","criteriaMode","current","scrollTo","onSubmit","index","name","key","formatMessage","id"],"sourceRoot":""}
|
package/build/862.bundle.js
DELETED
package/build/862.bundle.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"862.bundle.js","mappings":"+IAGO,MAAMA,EAAQ,IAAM","sources":["webpack://ReactCore/./src/displayer/Empty.tsx"],"sourcesContent":["import * as React from 'react';\n\n// FIXME move to j-react-components + display error if dev mode\nexport const Empty = () => <></>;\n"],"names":["Empty"],"sourceRoot":""}
|
package/build/955.bundle.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[955],{8955:(e,r,t)=>{t.r(r),t.d(r,{AppStateLoader:()=>d});var a=t(7363),s=t.n(a),o=t(5181),n=t(855),c=t(1851);const p=J.react.store.actions.appState,i=J.react.registry.getLazyComponent("Loader"),l=J.react.registry.getLazyComponent("Card"),d=e=>{const r=J.react.store.useAppDispatch(),t=(0,o.useIntl)(),{appState:a}=(0,n.useSelector)((r=>({appState:J.react.store.selectors.appState(r,e.appId)})));return s().useEffect((()=>{e.initPromises&&(r(c.gn.setLoading(e.appId)),Promise.all(e.initPromises).then((()=>r(p.setLoaded(e.appId)))).catch((()=>{r(p.setError({app:e.appId,error:{message:"Error"}})),r(J.react.toasts.error({label:t.formatMessage({id:"GLOBAL_Error_occurred"})}))})))}),[]),a&&a.error?s().createElement(l,{variant:"div",type:"error"},s().createElement(o.FormattedMessage,{id:"GLOBAL_Error_occurred"})):s().createElement(s().Fragment,null,a&&a.isLoading?s().createElement(i,{variant:"skeleton"}):s().createElement(s().Fragment,null,e.children))}}}]);
|
|
2
|
-
//# sourceMappingURL=955.bundle.js.map
|
package/build/955.bundle.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"955.bundle.js","mappings":"8LAMA,MAAMA,EAAiBC,EAAEC,MAAMC,MAAMC,QAAQC,SACvCC,EAASL,EAAEC,MAAMK,SAASC,iBAAiC,UAC3DC,EAAOR,EAAEC,MAAMK,SAASC,iBAA+B,QAShDE,EAAkBC,IAC3B,MAAMC,EAAWX,EAAEC,MAAMC,MAAMU,iBACzBC,GAAO,IAAAC,YAEP,SAAEV,IAAa,IAAAW,cAAaC,IACvB,CACHZ,SAAUJ,EAAEC,MAAMC,MAAMe,UAAUb,SAASY,EAAON,EAAMQ,WAqBhE,OAhBA,eAAgB,KACRR,EAAMS,eACNR,EAAS,gBAA2BD,EAAMQ,QAC1CE,QAAQC,IAAIX,EAAMS,cACbG,MAAK,IAAMX,EAASZ,EAAewB,UAAUb,EAAMQ,UACnDM,OAAM,KACHb,EACIZ,EAAe0B,SAAS,CACpBC,IAAKhB,EAAMQ,MACXS,MAAO,CAAEC,QAAS,YAG1BjB,EAASX,EAAEC,MAAM4B,OAAOF,MAAM,CAAEG,MAAOjB,EAAKkB,cAAc,CAAEC,GAAI,mCAG7E,IACC5B,GAAYA,EAASuB,MAEjB,kBAACnB,EAAI,CAACyB,QAAQ,MAAMC,KAAK,SACrB,kBAAC,EAAAC,iBAAgB,CAACH,GAAG,2BAK1B,oCAAG5B,GAAYA,EAASgC,UAAY,kBAAC/B,EAAM,CAAC4B,QAAQ,aAAgB,oCAAGvB,EAAM2B","sources":["webpack://ReactCore/./src/components/AppStateLoader.component.tsx"],"sourcesContent":["import { JRCCardProps, JRCLoaderProps } from 'jamespot-react-components';\nimport React from 'react';\nimport { FormattedMessage, useIntl } from 'react-intl';\nimport { useSelector } from 'react-redux';\nimport { appStateActions } from 'redux/slice/AppState.slice';\n\nconst appStateAction = J.react.store.actions.appState;\nconst Loader = J.react.registry.getLazyComponent<JRCLoaderProps>('Loader');\nconst Card = J.react.registry.getLazyComponent<JRCCardProps>('Card');\n\nexport type AppStateLoaderProps = {\n appId: string;\n children: JSX.Element;\n loader?: JSX.Element;\n initPromises: Promise<any>[];\n};\n\nexport const AppStateLoader = (props: AppStateLoaderProps) => {\n const dispatch = J.react.store.useAppDispatch();\n const intl = useIntl();\n\n const { appState } = useSelector((state: any) => {\n return {\n appState: J.react.store.selectors.appState(state, props.appId),\n };\n });\n\n // Init Function\n React.useEffect(() => {\n if (props.initPromises) {\n dispatch(appStateActions.setLoading(props.appId));\n Promise.all(props.initPromises)\n .then(() => dispatch(appStateAction.setLoaded(props.appId)))\n .catch(() => {\n dispatch(\n appStateAction.setError({\n app: props.appId,\n error: { message: 'Error' },\n }),\n );\n dispatch(J.react.toasts.error({ label: intl.formatMessage({ id: 'GLOBAL_Error_occurred' }) }));\n });\n }\n }, []);\n if (appState && appState.error) {\n return (\n <Card variant=\"div\" type=\"error\">\n <FormattedMessage id=\"GLOBAL_Error_occurred\" />\n </Card>\n );\n }\n\n return <>{appState && appState.isLoading ? <Loader variant=\"skeleton\" /> : <>{props.children}</>}</>;\n};\n"],"names":["appStateAction","J","react","store","actions","appState","Loader","registry","getLazyComponent","Card","AppStateLoader","props","dispatch","useAppDispatch","intl","useIntl","useSelector","state","selectors","appId","initPromises","Promise","all","then","setLoaded","catch","setError","app","error","message","toasts","label","formatMessage","id","variant","type","FormattedMessage","isLoading","children"],"sourceRoot":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { DisplayFormProps, DisplayFormRef } from './types';
|
|
3
|
-
/****
|
|
4
|
-
* The jamespot model depend on the platform
|
|
5
|
-
* For example a user can have the size attribute only for a given platform
|
|
6
|
-
* The model specifics of a platform are stored in J.model
|
|
7
|
-
*
|
|
8
|
-
* This component display an array of attributes only if this attribute is activated on the platform
|
|
9
|
-
*
|
|
10
|
-
* @param props.object the object to display (ie the user)
|
|
11
|
-
* @param props.attributesName an array of string : the list of attributes we want to display
|
|
12
|
-
* @param props.componentsOverride we can override the default render of the attribute
|
|
13
|
-
* @param props.componentsOverride.render the whole component logic (we override @DisplayList or @DisplaySingleValue for exemple)
|
|
14
|
-
* @param props.componentsOverride.wrapper the attribute is wrapped inside an element. For a list it can be an UL
|
|
15
|
-
* @param props.componentsOverride.element the component just above the element value
|
|
16
|
-
* @param props.componentsOverride.input the component input
|
|
17
|
-
* Note :If we override the "render" you can't override "wrapper" and "element" because the render rewrite everything
|
|
18
|
-
*/
|
|
19
|
-
export declare const DisplayForm: React.ForwardRefExoticComponent<DisplayFormProps & React.RefAttributes<DisplayFormRef>>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const Empty: () => JSX.Element;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
-
import { RootState } from '../store';
|
|
3
|
-
declare type SliceState = {
|
|
4
|
-
[key: string]: {
|
|
5
|
-
isLoading: boolean;
|
|
6
|
-
error?: object;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
export declare const appStateSlice: import("@reduxjs/toolkit").Slice<SliceState, {
|
|
10
|
-
setLoading: (state: SliceState, action: PayloadAction<string>) => void;
|
|
11
|
-
setLoaded: (state: SliceState, action: PayloadAction<string>) => void;
|
|
12
|
-
setError: (state: SliceState, action: PayloadAction<{
|
|
13
|
-
app: string;
|
|
14
|
-
error: object;
|
|
15
|
-
}>) => void;
|
|
16
|
-
}, "appState">;
|
|
17
|
-
export declare const appStateSelector: (state: RootState, appName: string) => {
|
|
18
|
-
isLoading: boolean;
|
|
19
|
-
error?: object | undefined;
|
|
20
|
-
};
|
|
21
|
-
export declare const appStateActions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
22
|
-
setLoading: (state: SliceState, action: PayloadAction<string>) => void;
|
|
23
|
-
setLoaded: (state: SliceState, action: PayloadAction<string>) => void;
|
|
24
|
-
setError: (state: SliceState, action: PayloadAction<{
|
|
25
|
-
app: string;
|
|
26
|
-
error: object;
|
|
27
|
-
}>) => void;
|
|
28
|
-
}>;
|
|
29
|
-
export {};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { JRCCardProps, JRCLoaderProps } from 'jamespot-react-components';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { FormattedMessage, useIntl } from 'react-intl';
|
|
4
|
-
import { useSelector } from 'react-redux';
|
|
5
|
-
import { appStateActions } from 'redux/slice/AppState.slice';
|
|
6
|
-
|
|
7
|
-
const appStateAction = J.react.store.actions.appState;
|
|
8
|
-
const Loader = J.react.registry.getLazyComponent<JRCLoaderProps>('Loader');
|
|
9
|
-
const Card = J.react.registry.getLazyComponent<JRCCardProps>('Card');
|
|
10
|
-
|
|
11
|
-
export type AppStateLoaderProps = {
|
|
12
|
-
appId: string;
|
|
13
|
-
children: JSX.Element;
|
|
14
|
-
loader?: JSX.Element;
|
|
15
|
-
initPromises: Promise<any>[];
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const AppStateLoader = (props: AppStateLoaderProps) => {
|
|
19
|
-
const dispatch = J.react.store.useAppDispatch();
|
|
20
|
-
const intl = useIntl();
|
|
21
|
-
|
|
22
|
-
const { appState } = useSelector((state: any) => {
|
|
23
|
-
return {
|
|
24
|
-
appState: J.react.store.selectors.appState(state, props.appId),
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
// Init Function
|
|
29
|
-
React.useEffect(() => {
|
|
30
|
-
if (props.initPromises) {
|
|
31
|
-
dispatch(appStateActions.setLoading(props.appId));
|
|
32
|
-
Promise.all(props.initPromises)
|
|
33
|
-
.then(() => dispatch(appStateAction.setLoaded(props.appId)))
|
|
34
|
-
.catch(() => {
|
|
35
|
-
dispatch(
|
|
36
|
-
appStateAction.setError({
|
|
37
|
-
app: props.appId,
|
|
38
|
-
error: { message: 'Error' },
|
|
39
|
-
}),
|
|
40
|
-
);
|
|
41
|
-
dispatch(J.react.toasts.error({ label: intl.formatMessage({ id: 'GLOBAL_Error_occurred' }) }));
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}, []);
|
|
45
|
-
if (appState && appState.error) {
|
|
46
|
-
return (
|
|
47
|
-
<Card variant="div" type="error">
|
|
48
|
-
<FormattedMessage id="GLOBAL_Error_occurred" />
|
|
49
|
-
</Card>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return <>{appState && appState.isLoading ? <Loader variant="skeleton" /> : <>{props.children}</>}</>;
|
|
54
|
-
};
|
package/src/components/index.tsx
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Registry } from '../utils/registry';
|
|
2
|
-
|
|
3
|
-
Registry.registerLib(
|
|
4
|
-
[
|
|
5
|
-
{
|
|
6
|
-
name: 'ExtensionProvider',
|
|
7
|
-
module: 'ExtensionProvider',
|
|
8
|
-
},
|
|
9
|
-
],
|
|
10
|
-
import('./ExtensionProvider.component'),
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
Registry.registerLib(
|
|
14
|
-
[
|
|
15
|
-
{
|
|
16
|
-
name: 'IfAppIsActivated',
|
|
17
|
-
module: 'IfAppIsActivated',
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
import('./IfAppIsActivated.component'),
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
Registry.registerLib(
|
|
24
|
-
[
|
|
25
|
-
{
|
|
26
|
-
name: 'AppStateLoader',
|
|
27
|
-
module: 'AppStateLoader',
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
import('./AppStateLoader.component'),
|
|
31
|
-
);
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { DisplayFormProps, DisplayFormRef, RenderInputProps } from './types';
|
|
3
|
-
import { useForm } from 'react-hook-form';
|
|
4
|
-
import type { JRCButtonProps } from 'jamespot-react-components';
|
|
5
|
-
import { useIntl } from 'react-intl';
|
|
6
|
-
|
|
7
|
-
/***
|
|
8
|
-
* Choose the component to render according to the type of the object
|
|
9
|
-
*/
|
|
10
|
-
const RenderInput = (props: RenderInputProps) => <props.components.input {...props} />;
|
|
11
|
-
|
|
12
|
-
/****
|
|
13
|
-
* The jamespot model depend on the platform
|
|
14
|
-
* For example a user can have the size attribute only for a given platform
|
|
15
|
-
* The model specifics of a platform are stored in J.model
|
|
16
|
-
*
|
|
17
|
-
* This component display an array of attributes only if this attribute is activated on the platform
|
|
18
|
-
*
|
|
19
|
-
* @param props.object the object to display (ie the user)
|
|
20
|
-
* @param props.attributesName an array of string : the list of attributes we want to display
|
|
21
|
-
* @param props.componentsOverride we can override the default render of the attribute
|
|
22
|
-
* @param props.componentsOverride.render the whole component logic (we override @DisplayList or @DisplaySingleValue for exemple)
|
|
23
|
-
* @param props.componentsOverride.wrapper the attribute is wrapped inside an element. For a list it can be an UL
|
|
24
|
-
* @param props.componentsOverride.element the component just above the element value
|
|
25
|
-
* @param props.componentsOverride.input the component input
|
|
26
|
-
* Note :If we override the "render" you can't override "wrapper" and "element" because the render rewrite everything
|
|
27
|
-
*/
|
|
28
|
-
export const DisplayForm = React.forwardRef<DisplayFormRef, DisplayFormProps>((props, ref) => {
|
|
29
|
-
const intl = useIntl();
|
|
30
|
-
|
|
31
|
-
const formRef = React.useRef<HTMLFormElement>(null);
|
|
32
|
-
|
|
33
|
-
const { attributesName, object, componentsOverride } = props;
|
|
34
|
-
const formConfig = J.react.useDisplay(attributesName || [], object.type);
|
|
35
|
-
const ValidationButton = J.react.registry.getLazyComponent<JRCButtonProps>('ValidationButton');
|
|
36
|
-
|
|
37
|
-
const { handleSubmit, control, reset } = useForm({
|
|
38
|
-
defaultValues: {
|
|
39
|
-
// initialize with empty array of checkbox, empty string otherwise
|
|
40
|
-
...(Object as any).fromEntries(
|
|
41
|
-
formConfig.map((inputConfig) => [
|
|
42
|
-
inputConfig.accessor,
|
|
43
|
-
inputConfig.widget.type === 'checkbox' ? [] : '',
|
|
44
|
-
]),
|
|
45
|
-
),
|
|
46
|
-
},
|
|
47
|
-
criteriaMode: 'all',
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
React.useImperativeHandle(
|
|
51
|
-
ref,
|
|
52
|
-
() => ({
|
|
53
|
-
reset: () => {
|
|
54
|
-
// in case the form is scrollable
|
|
55
|
-
formRef?.current?.scrollTo(0, 0);
|
|
56
|
-
// reset react-hook-form form
|
|
57
|
-
reset();
|
|
58
|
-
},
|
|
59
|
-
}),
|
|
60
|
-
[],
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<form onSubmit={handleSubmit(props.onSubmit)} ref={formRef}>
|
|
65
|
-
{formConfig.map((inputConfig, index) => {
|
|
66
|
-
inputConfig.components = {
|
|
67
|
-
...inputConfig.components,
|
|
68
|
-
...componentsOverride?.[inputConfig.name],
|
|
69
|
-
};
|
|
70
|
-
return <RenderInput key={index} control={control} {...inputConfig} />;
|
|
71
|
-
})}
|
|
72
|
-
|
|
73
|
-
<ValidationButton type="submit">
|
|
74
|
-
{intl.formatMessage({ id: 'APP_ASEI_Modal_Creation_Title' })}
|
|
75
|
-
</ValidationButton>
|
|
76
|
-
</form>
|
|
77
|
-
);
|
|
78
|
-
});
|
package/src/displayer/Empty.tsx
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
-
import { RootState } from '../store';
|
|
3
|
-
|
|
4
|
-
type SliceState = { [key: string]: { isLoading: boolean; error?: object } };
|
|
5
|
-
|
|
6
|
-
const initialState: SliceState = {};
|
|
7
|
-
|
|
8
|
-
export const appStateSlice = createSlice({
|
|
9
|
-
name: 'appState',
|
|
10
|
-
initialState,
|
|
11
|
-
reducers: {
|
|
12
|
-
setLoading: (state: SliceState, action: PayloadAction<string>) => {
|
|
13
|
-
state[action.payload] = { isLoading: true };
|
|
14
|
-
},
|
|
15
|
-
setLoaded: (state: SliceState, action: PayloadAction<string>) => {
|
|
16
|
-
state[action.payload] = { isLoading: false };
|
|
17
|
-
},
|
|
18
|
-
setError: (state: SliceState, action: PayloadAction<{ app: string; error: object }>) => {
|
|
19
|
-
state[action.payload.app].error = action.payload.error;
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export const appStateSelector = (state: RootState, appName: string) => state.appState[appName];
|
|
25
|
-
export const appStateActions = appStateSlice.actions;
|