@beinformed/ui 1.65.22 → 1.65.24
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/CHANGELOG.md +16 -0
- package/esm/hooks/__tests__/useAuthentication.spec.js.flow +100 -132
- package/esm/hooks/useAuthentication.js +14 -8
- package/esm/hooks/useAuthentication.js.flow +23 -23
- package/esm/hooks/useAuthentication.js.map +1 -1
- package/esm/hooks/useModularUI.js +1 -1
- package/esm/hooks/useModularUI.js.flow +1 -1
- package/esm/hooks/useModularUI.js.map +1 -1
- package/esm/models/filters/RangeFilterModel.js +1 -1
- package/esm/models/filters/RangeFilterModel.js.flow +1 -1
- package/esm/models/filters/RangeFilterModel.js.map +1 -1
- package/esm/models/filters/__tests__/RangeFilterModel.spec.js.flow +5 -7
- package/esm/redux/_i18n/I18nActions.js.flow +1 -1
- package/esm/redux/_i18n/I18nActions.js.map +1 -1
- package/esm/redux/_modularui/ModularUIActions.js.flow +2 -2
- package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
- package/esm/redux/_modularui/ModularUIConnector.js +2 -2
- package/esm/redux/_modularui/ModularUIConnector.js.flow +2 -2
- package/esm/redux/_modularui/ModularUIConnector.js.map +1 -1
- package/esm/redux/_modularui/ModularUISelectors.js +12 -18
- package/esm/redux/_modularui/ModularUISelectors.js.flow +13 -14
- package/esm/redux/_modularui/ModularUISelectors.js.map +1 -1
- package/esm/redux/_modularui/withModularUI.js.flow +2 -2
- package/esm/redux/_modularui/withModularUI.js.map +1 -1
- package/esm/redux/actions/Application.js +32 -4
- package/esm/redux/actions/Application.js.flow +34 -5
- package/esm/redux/actions/Application.js.map +1 -1
- package/esm/redux/actions/Authorization.js +20 -25
- package/esm/redux/actions/Authorization.js.flow +28 -29
- package/esm/redux/actions/Authorization.js.map +1 -1
- package/esm/redux/actions/Error.js +2 -0
- package/esm/redux/actions/Error.js.flow +5 -4
- package/esm/redux/actions/Error.js.map +1 -1
- package/esm/redux/actions/Form.js.flow +1 -1
- package/esm/redux/actions/Form.js.map +1 -1
- package/esm/redux/actions/FormAttributeSet.js.flow +1 -1
- package/esm/redux/actions/FormAttributeSet.js.map +1 -1
- package/esm/redux/actions/FormAutosave.js.flow +1 -1
- package/esm/redux/actions/FormAutosave.js.map +1 -1
- package/esm/redux/actions/FormAutosubmit.js.flow +1 -1
- package/esm/redux/actions/FormAutosubmit.js.map +1 -1
- package/esm/redux/actions/FormAutoupdate.js.flow +1 -1
- package/esm/redux/actions/FormAutoupdate.js.map +1 -1
- package/esm/redux/actions/FormValidations.js.flow +1 -1
- package/esm/redux/actions/FormValidations.js.map +1 -1
- package/esm/redux/actions/Notification.js.flow +3 -3
- package/esm/redux/actions/Notification.js.map +1 -1
- package/esm/redux/actions/SignIn.js +2 -4
- package/esm/redux/actions/SignIn.js.flow +4 -7
- package/esm/redux/actions/SignIn.js.map +1 -1
- package/esm/redux/actions/SignOut.js.flow +1 -1
- package/esm/redux/actions/SignOut.js.map +1 -1
- package/esm/redux/actions/__tests__/Application.spec.js.flow +67 -29
- package/esm/redux/actions/__tests__/Authorization.spec.js.flow +77 -83
- package/esm/redux/connectors/Form.js.flow +2 -2
- package/esm/redux/connectors/Form.js.map +1 -1
- package/esm/redux/connectors/FormAttributeSet.js.flow +2 -5
- package/esm/redux/connectors/FormAttributeSet.js.map +1 -1
- package/esm/redux/connectors/Progress.js.flow +1 -1
- package/esm/redux/connectors/Progress.js.map +1 -1
- package/esm/redux/connectors/SignIn.js.flow +1 -1
- package/esm/redux/connectors/SignIn.js.map +1 -1
- package/esm/redux/connectors/SignOut.js.flow +1 -1
- package/esm/redux/connectors/SignOut.js.map +1 -1
- package/esm/redux/store/configureStore.js +5 -1
- package/esm/redux/store/configureStore.js.flow +10 -1
- package/esm/redux/store/configureStore.js.map +1 -1
- package/esm/redux/types.js.flow +24 -5
- package/esm/redux/types.js.map +1 -1
- package/lib/hooks/useAuthentication.js +14 -8
- package/lib/hooks/useAuthentication.js.map +1 -1
- package/lib/hooks/useModularUI.js +1 -1
- package/lib/hooks/useModularUI.js.map +1 -1
- package/lib/models/filters/RangeFilterModel.js +1 -1
- package/lib/models/filters/RangeFilterModel.js.map +1 -1
- package/lib/redux/_i18n/I18nActions.js.map +1 -1
- package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
- package/lib/redux/_modularui/ModularUIConnector.js +2 -2
- package/lib/redux/_modularui/ModularUIConnector.js.map +1 -1
- package/lib/redux/_modularui/ModularUISelectors.js +12 -18
- package/lib/redux/_modularui/ModularUISelectors.js.map +1 -1
- package/lib/redux/_modularui/withModularUI.js.map +1 -1
- package/lib/redux/actions/Application.js +33 -4
- package/lib/redux/actions/Application.js.map +1 -1
- package/lib/redux/actions/Authorization.js +20 -25
- package/lib/redux/actions/Authorization.js.map +1 -1
- package/lib/redux/actions/Error.js +2 -0
- package/lib/redux/actions/Error.js.map +1 -1
- package/lib/redux/actions/Form.js.map +1 -1
- package/lib/redux/actions/FormAttributeSet.js.map +1 -1
- package/lib/redux/actions/FormAutosave.js.map +1 -1
- package/lib/redux/actions/FormAutosubmit.js.map +1 -1
- package/lib/redux/actions/FormAutoupdate.js.map +1 -1
- package/lib/redux/actions/FormValidations.js.map +1 -1
- package/lib/redux/actions/Notification.js.map +1 -1
- package/lib/redux/actions/SignIn.js +2 -4
- package/lib/redux/actions/SignIn.js.map +1 -1
- package/lib/redux/actions/SignOut.js.map +1 -1
- package/lib/redux/connectors/Form.js.map +1 -1
- package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
- package/lib/redux/connectors/Progress.js.map +1 -1
- package/lib/redux/connectors/SignIn.js.map +1 -1
- package/lib/redux/connectors/SignOut.js.map +1 -1
- package/lib/redux/store/configureStore.js +5 -1
- package/lib/redux/store/configureStore.js.map +1 -1
- package/lib/redux/types.js.map +1 -1
- package/package.json +11 -11
|
@@ -18,8 +18,33 @@ import type { ThunkAction } from "../types";
|
|
|
18
18
|
/**
|
|
19
19
|
*/
|
|
20
20
|
export const handleUnauthorized =
|
|
21
|
-
(errorResponse: ErrorResponse): ThunkAction =>
|
|
21
|
+
(errorResponse: ErrorResponse): ThunkAction<> =>
|
|
22
22
|
(dispatch, getState) => {
|
|
23
|
+
const finish = () => {
|
|
24
|
+
dispatch(logoutSuccess());
|
|
25
|
+
Cache.removeItem("auth");
|
|
26
|
+
|
|
27
|
+
if (errorResponse.isInvalidUsername) {
|
|
28
|
+
dispatch(sendAuthenticationError(errorResponse.message));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const state = getState();
|
|
32
|
+
const location = state.router.location;
|
|
33
|
+
const LOGIN_PATH = getSetting("LOGIN_PATH", "/signin");
|
|
34
|
+
|
|
35
|
+
if (location?.pathname !== LOGIN_PATH) {
|
|
36
|
+
const locationFrom = location?.state?.from;
|
|
37
|
+
return dispatch(
|
|
38
|
+
replace(LOGIN_PATH, {
|
|
39
|
+
from: locationFrom ? locationFrom : state.router.location,
|
|
40
|
+
modal: false,
|
|
41
|
+
}),
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return dispatch(noAction());
|
|
46
|
+
};
|
|
47
|
+
|
|
23
48
|
if (errorResponse.connectKey) {
|
|
24
49
|
dispatch(removeModelByKey(errorResponse.connectKey));
|
|
25
50
|
}
|
|
@@ -32,34 +57,8 @@ export const handleUnauthorized =
|
|
|
32
57
|
return;
|
|
33
58
|
}
|
|
34
59
|
|
|
35
|
-
// reload application when flag auth is set or isLogged
|
|
36
60
|
const application = getApplication(getState());
|
|
37
|
-
|
|
38
|
-
dispatch(reloadApplication());
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// set logged out
|
|
42
|
-
dispatch(logoutSuccess());
|
|
43
|
-
|
|
44
|
-
Cache.removeItem("auth");
|
|
45
|
-
|
|
46
|
-
if (errorResponse.isInvalidUsername) {
|
|
47
|
-
dispatch(sendAuthenticationError(errorResponse.message));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// add current location as from location before redirect
|
|
51
|
-
const location = getState().router.location;
|
|
52
|
-
const LOGIN_PATH = getSetting("LOGIN_PATH", "/signin");
|
|
53
|
-
if (location?.pathname !== LOGIN_PATH) {
|
|
54
|
-
const locationFrom = location?.state?.from;
|
|
55
|
-
return dispatch(
|
|
56
|
-
replace(LOGIN_PATH, {
|
|
57
|
-
from: locationFrom ? locationFrom : getState().router.location,
|
|
58
|
-
// cannot open login in a modal, because of previous locations that might be secure
|
|
59
|
-
modal: false,
|
|
60
|
-
}),
|
|
61
|
-
);
|
|
62
|
-
}
|
|
61
|
+
const shouldReload = Cache.getItem("auth") || application?.isLoggedIn;
|
|
63
62
|
|
|
64
|
-
return dispatch(
|
|
63
|
+
return shouldReload ? dispatch(reloadApplication()).then(finish) : finish();
|
|
65
64
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Authorization.js","names":["ErrorResponse","replace","logoutSuccess","Cache","removeModelByKey","getApplication","noAction","reloadApplication","sendAuthenticationError","getSetting","handleUnauthorized","errorResponse","dispatch","getState","
|
|
1
|
+
{"version":3,"file":"Authorization.js","names":["ErrorResponse","replace","logoutSuccess","Cache","removeModelByKey","getApplication","noAction","reloadApplication","sendAuthenticationError","getSetting","handleUnauthorized","errorResponse","dispatch","getState","finish","removeItem","isInvalidUsername","message","state","location","router","LOGIN_PATH","pathname","locationFrom","from","modal","connectKey","response","error","window","reload","application","shouldReload","getItem","isLoggedIn","then"],"sources":["../../../src/redux/actions/Authorization.js"],"sourcesContent":["// @flow\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\n\nimport { replace } from \"../_router/RouterActions\";\nimport { logoutSuccess } from \"./SignOut\";\n\nimport Cache from \"../../utils/browser/Cache\";\n\nimport { removeModelByKey } from \"../_modularui/ModularUIActions\";\nimport { getApplication } from \"../_modularui/ModularUISelectors\";\nimport { noAction, reloadApplication } from \"./Application\";\nimport { sendAuthenticationError } from \"./SignIn\";\n\nimport { getSetting } from \"../../constants\";\n\nimport type { ThunkAction } from \"../types\";\n\n/**\n */\nexport const handleUnauthorized =\n (errorResponse: ErrorResponse): ThunkAction<> =>\n (dispatch, getState) => {\n const finish = () => {\n dispatch(logoutSuccess());\n Cache.removeItem(\"auth\");\n\n if (errorResponse.isInvalidUsername) {\n dispatch(sendAuthenticationError(errorResponse.message));\n }\n\n const state = getState();\n const location = state.router.location;\n const LOGIN_PATH = getSetting(\"LOGIN_PATH\", \"/signin\");\n\n if (location?.pathname !== LOGIN_PATH) {\n const locationFrom = location?.state?.from;\n return dispatch(\n replace(LOGIN_PATH, {\n from: locationFrom ? locationFrom : state.router.location,\n modal: false,\n }),\n );\n }\n\n return dispatch(noAction());\n };\n\n if (errorResponse.connectKey) {\n dispatch(removeModelByKey(errorResponse.connectKey));\n }\n\n if (\n getSetting(\"PAGE_RELOAD_ON_UNAUTHORIZED_ERROR\", false) &&\n errorResponse.response?.error\n ) {\n window.location.reload();\n return;\n }\n\n const application = getApplication(getState());\n const shouldReload = Cache.getItem(\"auth\") || application?.isLoggedIn;\n\n return shouldReload ? dispatch(reloadApplication()).then(finish) : finish();\n };\n"],"mappings":"AACA,OAAOA,aAAa,MAAM,kCAAkC;AAE5D,SAASC,OAAO,QAAQ,0BAA0B;AAClD,SAASC,aAAa,QAAQ,WAAW;AAEzC,OAAOC,KAAK,MAAM,2BAA2B;AAE7C,SAASC,gBAAgB,QAAQ,gCAAgC;AACjE,SAASC,cAAc,QAAQ,kCAAkC;AACjE,SAASC,QAAQ,EAAEC,iBAAiB,QAAQ,eAAe;AAC3D,SAASC,uBAAuB,QAAQ,UAAU;AAElD,SAASC,UAAU,QAAQ,iBAAiB;AAI5C;AACA;AACA,OAAO,MAAMC,kBAAkB,GAC5BC,aAA4B,IAC7B,CAACC,QAAQ,EAAEC,QAAQ,KAAK;EACtB,MAAMC,MAAM,GAAGA,CAAA,KAAM;IACnBF,QAAQ,CAACV,aAAa,CAAC,CAAC,CAAC;IACzBC,KAAK,CAACY,UAAU,CAAC,MAAM,CAAC;IAExB,IAAIJ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import { noAction } from "./Application";
|
|
|
14
14
|
import type { FetchException } from "../../exceptions";
|
|
15
15
|
import type { Dispatch, SaveErrorAction, ThunkAction } from "../types";
|
|
16
16
|
|
|
17
|
-
type DefaultErrorResponseHandler = (error: ErrorResponse) => ThunkAction
|
|
17
|
+
type DefaultErrorResponseHandler = (error: ErrorResponse) => ThunkAction<>;
|
|
18
18
|
type CustomErrorResponseHandler = (
|
|
19
19
|
errorResponse: ErrorResponse,
|
|
20
20
|
defaultHandler: DefaultErrorResponseHandler,
|
|
21
|
-
) => ThunkAction
|
|
21
|
+
) => ThunkAction<>;
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
*/
|
|
@@ -30,7 +30,7 @@ const saveError = (error: ErrorResponse): SaveErrorAction => ({
|
|
|
30
30
|
/**
|
|
31
31
|
*/
|
|
32
32
|
const defaultErrorResponseHandler: DefaultErrorResponseHandler =
|
|
33
|
-
(error: ErrorResponse): ThunkAction =>
|
|
33
|
+
(error: ErrorResponse): ThunkAction<> =>
|
|
34
34
|
(dispatch: Dispatch) => {
|
|
35
35
|
if (error.isResourceNotFoundAfterReload || error.isRemoteServiceException) {
|
|
36
36
|
return dispatch(noAction());
|
|
@@ -53,6 +53,7 @@ const defaultErrorResponseHandler: DefaultErrorResponseHandler =
|
|
|
53
53
|
return dispatch(saveError(error));
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
// trigger a global error, not being caught by a promise
|
|
56
57
|
setTimeout(() => {
|
|
57
58
|
throw error.error;
|
|
58
59
|
});
|
|
@@ -83,7 +84,7 @@ export const setCustomErrorResponseHandler = (
|
|
|
83
84
|
* Handle errors by sending an error notification message
|
|
84
85
|
*/
|
|
85
86
|
export const handleError =
|
|
86
|
-
(error: Error | FetchException): ThunkAction =>
|
|
87
|
+
(error: Error | FetchException): ThunkAction<> =>
|
|
87
88
|
(dispatch: Dispatch) => {
|
|
88
89
|
dispatch(resetProgress());
|
|
89
90
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Error.js","names":["IS_SERVER","getSetting","ErrorResponse","push","showXHRErrorNotification","resetProgress","changePassword","handleUnauthorized","noAction","saveError","error","type","payload","defaultErrorResponseHandler","dispatch","isResourceNotFoundAfterReload","isRemoteServiceException","isUnauthorized","isBlocked","isConcurrentUser","isInvalidUsername","LOGOUT_PATH","isChangePassword","setTimeout","customErrorResponseHandler","errorResponse","defaultHandler","setCustomErrorResponseHandler","handler","handleError"],"sources":["../../../src/redux/actions/Error.js"],"sourcesContent":["// @flow\nimport { IS_SERVER } from \"../../constants/Constants\";\nimport { getSetting } from \"../../constants/Settings\";\n\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\n\nimport { push } from \"../_router/RouterActions\";\nimport { showXHRErrorNotification } from \"./Notification\";\nimport { resetProgress } from \"./ProgressIndicator\";\nimport { changePassword } from \"./SignIn\";\nimport { handleUnauthorized } from \"./Authorization\";\nimport { noAction } from \"./Application\";\n\nimport type { FetchException } from \"../../exceptions\";\nimport type { Dispatch, SaveErrorAction, ThunkAction } from \"../types\";\n\ntype DefaultErrorResponseHandler = (error: ErrorResponse) => ThunkAction
|
|
1
|
+
{"version":3,"file":"Error.js","names":["IS_SERVER","getSetting","ErrorResponse","push","showXHRErrorNotification","resetProgress","changePassword","handleUnauthorized","noAction","saveError","error","type","payload","defaultErrorResponseHandler","dispatch","isResourceNotFoundAfterReload","isRemoteServiceException","isUnauthorized","isBlocked","isConcurrentUser","isInvalidUsername","LOGOUT_PATH","isChangePassword","setTimeout","customErrorResponseHandler","errorResponse","defaultHandler","setCustomErrorResponseHandler","handler","handleError"],"sources":["../../../src/redux/actions/Error.js"],"sourcesContent":["// @flow\nimport { IS_SERVER } from \"../../constants/Constants\";\nimport { getSetting } from \"../../constants/Settings\";\n\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\n\nimport { push } from \"../_router/RouterActions\";\nimport { showXHRErrorNotification } from \"./Notification\";\nimport { resetProgress } from \"./ProgressIndicator\";\nimport { changePassword } from \"./SignIn\";\nimport { handleUnauthorized } from \"./Authorization\";\nimport { noAction } from \"./Application\";\n\nimport type { FetchException } from \"../../exceptions\";\nimport type { Dispatch, SaveErrorAction, ThunkAction } from \"../types\";\n\ntype DefaultErrorResponseHandler = (error: ErrorResponse) => ThunkAction<>;\ntype CustomErrorResponseHandler = (\n errorResponse: ErrorResponse,\n defaultHandler: DefaultErrorResponseHandler,\n) => ThunkAction<>;\n\n/**\n */\nconst saveError = (error: ErrorResponse): SaveErrorAction => ({\n type: \"SAVE_ERROR\",\n payload: error,\n});\n\n/**\n */\nconst defaultErrorResponseHandler: DefaultErrorResponseHandler =\n (error: ErrorResponse): ThunkAction<> =>\n (dispatch: Dispatch) => {\n if (error.isResourceNotFoundAfterReload || error.isRemoteServiceException) {\n return dispatch(noAction());\n }\n\n if (error.isUnauthorized) {\n return dispatch(handleUnauthorized(error));\n }\n\n if (error.isBlocked || error.isConcurrentUser || error.isInvalidUsername) {\n const LOGOUT_PATH = getSetting(\"LOGOUT_PATH\", \"/signout\");\n dispatch(push(LOGOUT_PATH));\n }\n\n if (error.isChangePassword) {\n return dispatch(changePassword());\n }\n\n if (IS_SERVER) {\n return dispatch(saveError(error));\n }\n\n // trigger a global error, not being caught by a promise\n setTimeout(() => {\n throw error.error;\n });\n\n return dispatch(showXHRErrorNotification(error));\n };\n\n/**\n * Standard Custom error response, acts as a proxy and can be overwritten by {@link setCustomErrorResponseHandler}\n */\nlet customErrorResponseHandler: CustomErrorResponseHandler =\n (errorResponse, defaultHandler) => (dispatch: Dispatch) =>\n dispatch(defaultHandler(errorResponse));\n\n/**\n * Set a custom error response handler,\n * can be used when custom functionality is needed on certain (error) response\n * of the modular ui, for example when custom logic is needed when a user is unauthorized<br>\n * It receives an {@link ErrorResponse} and the {@link defaultErrorResponseHandler}\n */\nexport const setCustomErrorResponseHandler = (\n handler: CustomErrorResponseHandler,\n) => {\n customErrorResponseHandler = handler;\n};\n\n/**\n * Handle errors by sending an error notification message\n */\nexport const handleError =\n (error: Error | FetchException): ThunkAction<> =>\n (dispatch: Dispatch) => {\n dispatch(resetProgress());\n\n const errorResponse = new ErrorResponse(error);\n\n return dispatch(\n customErrorResponseHandler(errorResponse, defaultErrorResponseHandler),\n );\n };\n"],"mappings":"AACA,SAASA,SAAS,QAAQ,2BAA2B;AACrD,SAASC,UAAU,QAAQ,0BAA0B;AAErD,OAAOC,aAAa,MAAM,kCAAkC;AAE5D,SAASC,IAAI,QAAQ,0BAA0B;AAC/C,SAASC,wBAAwB,QAAQ,gBAAgB;AACzD,SAASC,aAAa,QAAQ,qBAAqB;AACnD,SAASC,cAAc,QAAQ,UAAU;AACzC,SAASC,kBAAkB,QAAQ,iBAAiB;AACpD,SAASC,QAAQ,QAAQ,eAAe;AAWxC;AACA;AACA,MAAMC,SAAS,GAAIC,KAAoB,KAAuB;EAC5DC,IAAI,EAAE,YAAY;EAClBC,OAAO,EAAEF;AACX,CAAC,CAAC;;AAEF;AACA;AACA,MAAMG,2BAAwD,GAC3DH,KAAoB,IACpBI,QAAkB,IAAK;EACtB,IAAIJ,KAAK,CAACK,6BAA6B,IAAIL,KAAK,CAACM,wBAAwB,EAAE;IACzE,OAAOF,QAAQ,CAACN,QAAQ,CAAC,CAAC,CAAC;EAC7B;EAEA,IAAIE,KAAK,CAACO,cAAc,EAAE;IACxB,OAAOH,QAAQ,CAACP,kBAAkB,CAACG,KAAK,CAAC,CAAC;EAC5C;EAEA,IAAIA,KAAK,CAACQ,SAAS,IAAIR,KAAK,CAACS,gBAAgB,IAAIT,KAAK,CAACU,iBAAiB,EAAE;IACxE,MAAMC,WAAW,GAAGpB,UAAU,CAAC,aAAa,EAAE,UAAU,CAAC;IACzDa,QAAQ,CAACX,IAAI,CAACkB,WAAW,CAAC,CAAC;EAC7B;EAEA,IAAIX,KAAK,CAACY,gBAAgB,EAAE;IAC1B,OAAOR,QAAQ,CAACR,cAAc,CAAC,CAAC,CAAC;EACnC;EAEA,IAAIN,SAAS,EAAE;IACb,OAAOc,QAAQ,CAACL,SAAS,CAACC,KAAK,CAAC,CAAC;EACnC;;EAEA;EACAa,UAAU,CAAC,MAAM;IACf,MAAMb,KAAK,CAACA,KAAK;EACnB,CAAC,CAAC;EAEF,OAAOI,QAAQ,CAACV,wBAAwB,CAACM,KAAK,CAAC,CAAC;AAClD,CAAC;;AAEH;AACA;AACA;AACA,IAAIc,0BAAsD,GACxDA,CAACC,aAAa,EAAEC,cAAc,KAAMZ,QAAkB,IACpDA,QAAQ,CAACY,cAAc,CAACD,aAAa,CAAC,CAAC;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,6BAA6B,GACxCC,OAAmC,IAChC;EACHJ,0BAA0B,GAAGI,OAAO;AACtC,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GACrBnB,KAA6B,IAC7BI,QAAkB,IAAK;EACtBA,QAAQ,CAACT,aAAa,CAAC,CAAC,CAAC;EAEzB,MAAMoB,aAAa,GAAG,IAAIvB,aAAa,CAACQ,KAAK,CAAC;EAE9C,OAAOI,QAAQ,CACbU,0BAA0B,CAACC,aAAa,EAAEZ,2BAA2B,CACvE,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -25,7 +25,7 @@ export const previousObject = (form: FormModel): UpdateFormAction => {
|
|
|
25
25
|
/**
|
|
26
26
|
*/
|
|
27
27
|
export const cancelForm =
|
|
28
|
-
(form: FormModel): ThunkAction =>
|
|
28
|
+
(form: FormModel): ThunkAction<> =>
|
|
29
29
|
(dispatch: Dispatch, getState: GetState) => {
|
|
30
30
|
if (form.key === "ChangePassword" && getState().auth.mustChangePassword) {
|
|
31
31
|
dispatch(startProgress());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.js","names":["goBack","updateForm","logoutSuccess","reloadApplication","startProgress","finishProgress","Authenticate","previousObject","form","newForm","clone","setPreviousObject","cancelForm","dispatch","getState","key","auth","mustChangePassword","logout","then"],"sources":["../../../src/redux/actions/Form.js"],"sourcesContent":["// @flow\nimport { goBack } from \"../_router/RouterActions\";\nimport { updateForm } from \"../_modularui/ModularUIActions\";\nimport { logoutSuccess } from \"./SignOut\";\nimport { reloadApplication } from \"./Application\";\nimport { startProgress, finishProgress } from \"./ProgressIndicator\";\n\nimport Authenticate from \"../../modularui/Authenticate\";\n\nimport type { Dispatch, GetState, ThunkAction } from \"../types\";\nimport type FormModel from \"../../models/form/FormModel\";\nimport type { UpdateFormAction } from \"../_modularui/types\";\n\n/**\n * Go back to previous object (back button on form)\n */\nexport const previousObject = (form: FormModel): UpdateFormAction => {\n const newForm = form.clone();\n\n newForm.setPreviousObject();\n\n return updateForm(newForm);\n};\n\n/**\n */\nexport const cancelForm =\n (form: FormModel): ThunkAction =>\n (dispatch: Dispatch, getState: GetState) => {\n if (form.key === \"ChangePassword\" && getState().auth.mustChangePassword) {\n dispatch(startProgress());\n return new Authenticate().logout().then(() => {\n dispatch(logoutSuccess());\n dispatch(reloadApplication());\n dispatch(finishProgress());\n\n return dispatch(goBack());\n });\n }\n\n return dispatch(goBack());\n };\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,0BAA0B;AACjD,SAASC,UAAU,QAAQ,gCAAgC;AAC3D,SAASC,aAAa,QAAQ,WAAW;AACzC,SAASC,iBAAiB,QAAQ,eAAe;AACjD,SAASC,aAAa,EAAEC,cAAc,QAAQ,qBAAqB;AAEnE,OAAOC,YAAY,MAAM,8BAA8B;AAMvD;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GAAIC,IAAe,IAAuB;EACnE,MAAMC,OAAO,GAAGD,IAAI,CAACE,KAAK,CAAC,CAAC;EAE5BD,OAAO,CAACE,iBAAiB,CAAC,CAAC;EAE3B,OAAOV,UAAU,CAACQ,OAAO,CAAC;AAC5B,CAAC;;AAED;AACA;AACA,OAAO,MAAMG,UAAU,GACpBJ,IAAe,IAChB,CAACK,QAAkB,EAAEC,QAAkB,KAAK;EAC1C,IAAIN,IAAI,CAACO,GAAG,KAAK,gBAAgB,IAAID,QAAQ,CAAC,CAAC,CAACE,IAAI,CAACC,kBAAkB,EAAE;IACvEJ,QAAQ,CAACT,aAAa,CAAC,CAAC,CAAC;IACzB,OAAO,IAAIE,YAAY,CAAC,CAAC,CAACY,MAAM,CAAC,CAAC,CAACC,IAAI,CAAC,MAAM;MAC5CN,QAAQ,CAACX,aAAa,CAAC,CAAC,CAAC;MACzBW,QAAQ,CAACV,iBAAiB,CAAC,CAAC,CAAC;MAC7BU,QAAQ,CAACR,cAAc,CAAC,CAAC,CAAC;MAE1B,OAAOQ,QAAQ,CAACb,MAAM,CAAC,CAAC,CAAC;IAC3B,CAAC,CAAC;EACJ;EAEA,OAAOa,QAAQ,CAACb,MAAM,CAAC,CAAC,CAAC;AAC3B,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Form.js","names":["goBack","updateForm","logoutSuccess","reloadApplication","startProgress","finishProgress","Authenticate","previousObject","form","newForm","clone","setPreviousObject","cancelForm","dispatch","getState","key","auth","mustChangePassword","logout","then"],"sources":["../../../src/redux/actions/Form.js"],"sourcesContent":["// @flow\nimport { goBack } from \"../_router/RouterActions\";\nimport { updateForm } from \"../_modularui/ModularUIActions\";\nimport { logoutSuccess } from \"./SignOut\";\nimport { reloadApplication } from \"./Application\";\nimport { startProgress, finishProgress } from \"./ProgressIndicator\";\n\nimport Authenticate from \"../../modularui/Authenticate\";\n\nimport type { Dispatch, GetState, ThunkAction } from \"../types\";\nimport type FormModel from \"../../models/form/FormModel\";\nimport type { UpdateFormAction } from \"../_modularui/types\";\n\n/**\n * Go back to previous object (back button on form)\n */\nexport const previousObject = (form: FormModel): UpdateFormAction => {\n const newForm = form.clone();\n\n newForm.setPreviousObject();\n\n return updateForm(newForm);\n};\n\n/**\n */\nexport const cancelForm =\n (form: FormModel): ThunkAction<> =>\n (dispatch: Dispatch, getState: GetState) => {\n if (form.key === \"ChangePassword\" && getState().auth.mustChangePassword) {\n dispatch(startProgress());\n return new Authenticate().logout().then(() => {\n dispatch(logoutSuccess());\n dispatch(reloadApplication());\n dispatch(finishProgress());\n\n return dispatch(goBack());\n });\n }\n\n return dispatch(goBack());\n };\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,0BAA0B;AACjD,SAASC,UAAU,QAAQ,gCAAgC;AAC3D,SAASC,aAAa,QAAQ,WAAW;AACzC,SAASC,iBAAiB,QAAQ,eAAe;AACjD,SAASC,aAAa,EAAEC,cAAc,QAAQ,qBAAqB;AAEnE,OAAOC,YAAY,MAAM,8BAA8B;AAMvD;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GAAIC,IAAe,IAAuB;EACnE,MAAMC,OAAO,GAAGD,IAAI,CAACE,KAAK,CAAC,CAAC;EAE5BD,OAAO,CAACE,iBAAiB,CAAC,CAAC;EAE3B,OAAOV,UAAU,CAACQ,OAAO,CAAC;AAC5B,CAAC;;AAED;AACA;AACA,OAAO,MAAMG,UAAU,GACpBJ,IAAe,IAChB,CAACK,QAAkB,EAAEC,QAAkB,KAAK;EAC1C,IAAIN,IAAI,CAACO,GAAG,KAAK,gBAAgB,IAAID,QAAQ,CAAC,CAAC,CAACE,IAAI,CAACC,kBAAkB,EAAE;IACvEJ,QAAQ,CAACT,aAAa,CAAC,CAAC,CAAC;IACzB,OAAO,IAAIE,YAAY,CAAC,CAAC,CAACY,MAAM,CAAC,CAAC,CAACC,IAAI,CAAC,MAAM;MAC5CN,QAAQ,CAACX,aAAa,CAAC,CAAC,CAAC;MACzBW,QAAQ,CAACV,iBAAiB,CAAC,CAAC,CAAC;MAC7BU,QAAQ,CAACR,cAAc,CAAC,CAAC,CAAC;MAE1B,OAAOQ,QAAQ,CAACb,MAAM,CAAC,CAAC,CAAC;IAC3B,CAAC,CAAC;EACJ;EAEA,OAAOa,QAAQ,CAACb,MAAM,CAAC,CAAC,CAAC;AAC3B,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormAttributeSet.js","names":["updateForm","getSetting","validateFormObject","autosaveFormObject","autosubmitFormObject","autoupdateFormObject","updateFormAttribute","form","formObject","attribute","inputvalue","options","autosubmit","autosave","autoupdate","forceUpdate","validate","dispatch","newForm","clone","undefined","currentFormObject","equals","updateAttribute","completedFormObjects","forEach","completeObject","isValid","autosubmitAction","autoupdateAction","handleAutoSave","handleValidate","isChanged","hasDynamicValidations"],"sources":["../../../src/redux/actions/FormAttributeSet.js"],"sourcesContent":["// @flow\nimport { updateForm } from \"../_modularui/ModularUIActions\";\n\nimport { getSetting } from \"../../constants/Settings\";\n\nimport { validateFormObject } from \"./FormValidations\";\nimport { autosaveFormObject } from \"./FormAutosave\";\nimport { autosubmitFormObject } from \"./FormAutosubmit\";\nimport { autoupdateFormObject } from \"./FormAutoupdate\";\n\nimport type { Dispatch, ThunkAction, UpdateFormOptions } from \"../types\";\nimport type { AttributeType } from \"../../models/types\";\nimport type FormModel from \"../../models/form/FormModel\";\nimport type FormObjectModel from \"../../models/form/FormObjectModel\";\n\n/**\n * Update an attribute on a form\n */\nexport const updateFormAttribute =\n (\n form: FormModel,\n formObject: FormObjectModel,\n attribute: AttributeType,\n inputvalue: string,\n options: UpdateFormOptions = {\n autosubmit: false,\n autosave: false, // autosave commits the form in the background\n autoupdate: false, // autoupdate does not commit and updates the form with for example a new dynamicschema (work-around for form-tree iq)\n forceUpdate: false,\n validate: true,\n },\n ): ThunkAction =>\n (dispatch: Dispatch) => {\n const newForm = form.clone();\n\n if (options.validate === undefined) {\n options.validate = true;\n }\n\n if (newForm.currentFormObject?.equals(formObject)) {\n newForm.currentFormObject.updateAttribute(attribute, inputvalue);\n } else {\n newForm.completedFormObjects.forEach((completeObject) => {\n if (completeObject.equals(formObject)) {\n completeObject.updateAttribute(attribute, inputvalue);\n }\n });\n }\n\n if (options.autosubmit && newForm.isValid) {\n const autosubmitAction = autosubmitFormObject(\n newForm,\n attribute,\n options.forceUpdate,\n );\n if (autosubmitAction) {\n return dispatch(autosubmitAction);\n }\n }\n\n if (options.autoupdate && newForm.isValid) {\n const autoupdateAction = autoupdateFormObject(newForm, attribute);\n if (autoupdateAction) {\n return dispatch(autoupdateAction);\n }\n }\n\n handleAutoSave(dispatch, newForm, options);\n\n handleValidate(dispatch, newForm, options);\n\n return dispatch(updateForm(newForm));\n };\n\nconst handleAutoSave = (\n dispatch: Dispatch,\n newForm: FormModel,\n options: UpdateFormOptions,\n) => {\n if (options.autosave && newForm.isValid && newForm.isChanged()) {\n dispatch(autosaveFormObject(newForm));\n }\n};\n\nconst handleValidate = (\n dispatch: Dispatch,\n newForm: FormModel,\n options: UpdateFormOptions,\n) => {\n if (\n options.validate &&\n newForm.currentFormObject?.hasDynamicValidations &&\n getSetting(\"USE_INSTANT_SERVER_VALIDATION\")\n ) {\n // server form validations happens async, don't wait for the form to return\n dispatch(validateFormObject(newForm));\n }\n};\n"],"mappings":"AACA,SAASA,UAAU,QAAQ,gCAAgC;AAE3D,SAASC,UAAU,QAAQ,0BAA0B;AAErD,SAASC,kBAAkB,QAAQ,mBAAmB;AACtD,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SAASC,oBAAoB,QAAQ,kBAAkB;AACvD,SAASC,oBAAoB,QAAQ,kBAAkB;AAOvD;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAC9BA,CACEC,IAAe,EACfC,UAA2B,EAC3BC,SAAwB,EACxBC,UAAkB,EAClBC,OAA0B,GAAG;EAC3BC,UAAU,EAAE,KAAK;EACjBC,QAAQ,EAAE,KAAK;EAAE;EACjBC,UAAU,EAAE,KAAK;EAAE;EACnBC,WAAW,EAAE,KAAK;EAClBC,QAAQ,EAAE;AACZ,CAAC,KAEFC,QAAkB,IAAK;EACtB,MAAMC,OAAO,GAAGX,IAAI,CAACY,KAAK,CAAC,CAAC;EAE5B,IAAIR,OAAO,CAACK,QAAQ,KAAKI,SAAS,EAAE;IAClCT,OAAO,CAACK,QAAQ,GAAG,IAAI;EACzB;EAEA,IAAIE,OAAO,CAACG,iBAAiB,EAAEC,MAAM,CAACd,UAAU,CAAC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OAAkB,EAClBP,OAA0B,KACvB;EACH,IACEA,OAAO,CAACK,QAAQ,IAChBE,OAAO,CAACG,iBAAiB,EAAEY,qBAAqB,IAChDhC,UAAU,CAAC,+BAA+B,CAAC,EAC3C;IACA;IACAgB,QAAQ,CAACf,kBAAkB,CAACgB,OAAO,CAAC,CAAC;EACvC;AACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FormAttributeSet.js","names":["updateForm","getSetting","validateFormObject","autosaveFormObject","autosubmitFormObject","autoupdateFormObject","updateFormAttribute","form","formObject","attribute","inputvalue","options","autosubmit","autosave","autoupdate","forceUpdate","validate","dispatch","newForm","clone","undefined","currentFormObject","equals","updateAttribute","completedFormObjects","forEach","completeObject","isValid","autosubmitAction","autoupdateAction","handleAutoSave","handleValidate","isChanged","hasDynamicValidations"],"sources":["../../../src/redux/actions/FormAttributeSet.js"],"sourcesContent":["// @flow\nimport { updateForm } from \"../_modularui/ModularUIActions\";\n\nimport { getSetting } from \"../../constants/Settings\";\n\nimport { validateFormObject } from \"./FormValidations\";\nimport { autosaveFormObject } from \"./FormAutosave\";\nimport { autosubmitFormObject } from \"./FormAutosubmit\";\nimport { autoupdateFormObject } from \"./FormAutoupdate\";\n\nimport type { Dispatch, ThunkAction, UpdateFormOptions } from \"../types\";\nimport type { AttributeType } from \"../../models/types\";\nimport type FormModel from \"../../models/form/FormModel\";\nimport type FormObjectModel from \"../../models/form/FormObjectModel\";\n\n/**\n * Update an attribute on a form\n */\nexport const updateFormAttribute =\n (\n form: FormModel,\n formObject: FormObjectModel,\n attribute: AttributeType,\n inputvalue: string,\n options: UpdateFormOptions = {\n autosubmit: false,\n autosave: false, // autosave commits the form in the background\n autoupdate: false, // autoupdate does not commit and updates the form with for example a new dynamicschema (work-around for form-tree iq)\n forceUpdate: false,\n validate: true,\n },\n ): ThunkAction<> =>\n (dispatch: Dispatch) => {\n const newForm = form.clone();\n\n if (options.validate === undefined) {\n options.validate = true;\n }\n\n if (newForm.currentFormObject?.equals(formObject)) {\n newForm.currentFormObject.updateAttribute(attribute, inputvalue);\n } else {\n newForm.completedFormObjects.forEach((completeObject) => {\n if (completeObject.equals(formObject)) {\n completeObject.updateAttribute(attribute, inputvalue);\n }\n });\n }\n\n if (options.autosubmit && newForm.isValid) {\n const autosubmitAction = autosubmitFormObject(\n newForm,\n attribute,\n options.forceUpdate,\n );\n if (autosubmitAction) {\n return dispatch(autosubmitAction);\n }\n }\n\n if (options.autoupdate && newForm.isValid) {\n const autoupdateAction = autoupdateFormObject(newForm, attribute);\n if (autoupdateAction) {\n return dispatch(autoupdateAction);\n }\n }\n\n handleAutoSave(dispatch, newForm, options);\n\n handleValidate(dispatch, newForm, options);\n\n return dispatch(updateForm(newForm));\n };\n\nconst handleAutoSave = (\n dispatch: Dispatch,\n newForm: FormModel,\n options: UpdateFormOptions,\n) => {\n if (options.autosave && newForm.isValid && newForm.isChanged()) {\n dispatch(autosaveFormObject(newForm));\n }\n};\n\nconst handleValidate = (\n dispatch: Dispatch,\n newForm: FormModel,\n options: UpdateFormOptions,\n) => {\n if (\n options.validate &&\n newForm.currentFormObject?.hasDynamicValidations &&\n getSetting(\"USE_INSTANT_SERVER_VALIDATION\")\n ) {\n // server form validations happens async, don't wait for the form to return\n dispatch(validateFormObject(newForm));\n }\n};\n"],"mappings":"AACA,SAASA,UAAU,QAAQ,gCAAgC;AAE3D,SAASC,UAAU,QAAQ,0BAA0B;AAErD,SAASC,kBAAkB,QAAQ,mBAAmB;AACtD,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SAASC,oBAAoB,QAAQ,kBAAkB;AACvD,SAASC,oBAAoB,QAAQ,kBAAkB;AAOvD;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAC9BA,CACEC,IAAe,EACfC,UAA2B,EAC3BC,SAAwB,EACxBC,UAAkB,EAClBC,OAA0B,GAAG;EAC3BC,UAAU,EAAE,KAAK;EACjBC,QAAQ,EAAE,KAAK;EAAE;EACjBC,UAAU,EAAE,K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;AACtC,CAAC;AAEH,MAAMY,cAAc,GAAGA,CACrBb,QAAkB,EAClBC,OAAkB,EAClBP,OAA0B,KACvB;EACH,IAAIA,OAAO,CAACE,QAAQ,IAAIK,OAAO,CAACS,OAAO,IAAIT,OAAO,CAACc,SAAS,CAAC,CAAC,EAAE;IAC9Df,QAAQ,CAACd,kBAAkB,CAACe,OAAO,CAAC,CAAC;EACvC;AACF,CAAC;AAED,MAAMa,cAAc,GAAGA,CACrBd,QAAkB,EAClBC,OAAkB,EAClBP,OAA0B,KACvB;EACH,IACEA,OAAO,CAACK,QAAQ,IAChBE,OAAO,CAACG,iBAAiB,EAAEY,qBAAqB,IAChDhC,UAAU,CAAC,+BAA+B,CAAC,EAC3C;IACA;IACAgB,QAAQ,CAACf,kBAAkB,CAACgB,OAAO,CAAC,CAAC;EACvC;AACF,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormAutosave.js","names":["debounce","ModularUIRequest","FormModel","HTTP_METHODS","VALIDATE_DEBOUNCE_TIMEOUT","AUTOSAVE_STATUS","updateForm","updateAutosave","status","model","type","payload","autosave","dispatch","form","START","formdata","getFormData","selfhref","setParameter","method","POST","data","childmodels","locale","fetch","then","savedForm","lastServerUpdate","FINISHED","debouncedAutosave","autosaveFormObject"],"sources":["../../../src/redux/actions/FormAutosave.js"],"sourcesContent":["// @flow\nimport debounce from \"lodash/debounce\";\n\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\nimport FormModel from \"../../models/form/FormModel\";\n\nimport {\n HTTP_METHODS,\n VALIDATE_DEBOUNCE_TIMEOUT,\n AUTOSAVE_STATUS,\n} from \"../../constants/Constants\";\n\nimport { updateForm } from \"../_modularui/ModularUIActions\";\n\nimport type { UpdateAutosaveAction, ThunkAction, Dispatch } from \"../types\";\n\n/**\n * Update validations of the form currently in the reducer\n * because of the debounce timeout there might have been an update on the form during validation\n */\nconst updateAutosave = (\n status: $Keys<typeof AUTOSAVE_STATUS>,\n model: FormModel,\n): UpdateAutosaveAction => ({\n type: \"UPDATE_AUTOSAVE_STATUS\",\n payload: {\n status,\n model,\n },\n});\n\n/**\n */\nconst autosave = (dispatch: Dispatch, form: FormModel) => {\n dispatch(updateAutosave(AUTOSAVE_STATUS.START, form));\n\n const formdata = form.getFormData(true, false);\n\n new ModularUIRequest(form.selfhref.setParameter(\"commit\", \"true\"), {\n method: HTTP_METHODS.POST,\n data: formdata,\n childmodels: false,\n locale: form.locale,\n })\n .fetch()\n .then((savedForm) => {\n if (savedForm instanceof FormModel) {\n // update last server update to indicate an update has happened\n // send the existing form to prevent updates in the ui based on autosave results\n form.lastServerUpdate = savedForm.lastServerUpdate;\n\n dispatch(updateForm(form));\n dispatch(updateAutosave(AUTOSAVE_STATUS.FINISHED, savedForm));\n }\n });\n};\n\n/**\n * Validates form objects debounced to prevent overloading the (form) service\n * When a form with new errors (or complete) arrives, we send the validations\n * to the current form model where the errors are processed\n * A new form with the new constraints is send to the store\n */\nconst debouncedAutosave = debounce((dispatch, form) => {\n autosave(dispatch, form);\n}, VALIDATE_DEBOUNCE_TIMEOUT);\n\n/**\n */\nexport const autosaveFormObject =\n (form: FormModel): ThunkAction =>\n (dispatch) =>\n debouncedAutosave(dispatch, form);\n"],"mappings":"AACA,OAAOA,QAAQ,MAAM,iBAAiB;AAEtC,OAAOC,gBAAgB,MAAM,kCAAkC;AAC/D,OAAOC,SAAS,MAAM,6BAA6B;AAEnD,SACEC,YAAY,EACZC,yBAAyB,EACzBC,eAAe,QACV,2BAA2B;AAElC,SAASC,UAAU,QAAQ,gCAAgC;AAI3D;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAGA,CACrBC,MAAqC,EACrCC,KAAgB,MACU;EAC1BC,IAAI,EAAE,wBAAwB;EAC9BC,OAAO,EAAE;IACPH,MAAM;IACNC;EACF;AACF,CAAC,CAAC;;AAEF;AACA;AACA,MAAMG,QAAQ,GAAGA,CAACC,QAAkB,EAAEC,IAAe,KAAK;EACxDD,QAAQ,CAACN,cAAc,CAACF,eAAe,CAACU,KAAK,EAAED,IAAI,CAAC,CAAC;EAErD,MAAME,QAAQ,GAAGF,IAAI,CAACG,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC;EAE9C,IAAIhB,gBAAgB,CAACa,IAAI,CAACI,QAAQ,CAACC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE;IACjEC,MAAM,EAAEjB,YAAY,CAACkB,IAAI;IACzBC,IAAI,EAAEN,QAAQ;IACdO,WAAW,EAAE,KAAK;IAClBC,MAAM,EAAEV,IAAI,CAACU;EACf,CAAC,CAAC,CACCC,KAAK,CAAC,CAAC,CACPC,IAAI,CAAEC,SAAS,IAAK;IACnB,IAAIA,SAAS,YAAYzB,SAAS,EAAE;MAClC;MACA;MACAY,IAAI,CAACc,gBAAgB,GAAGD,SAAS,CAACC,gBAAgB;MAElDf,QAAQ,CAACP,UAAU,CAACQ,IAAI,CAAC,CAAC;MAC1BD,QAAQ,CAACN,cAAc,CAACF,eAAe,CAACwB,QAAQ,EAAEF,SAAS,CAAC,CAAC;IAC/D;EACF,CAAC,CAAC;AACN,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,iBAAiB,GAAG9B,QAAQ,CAAC,CAACa,QAAQ,EAAEC,IAAI,KAAK;EACrDF,QAAQ,CAACC,QAAQ,EAAEC,IAAI,CAAC;AAC1B,CAAC,EAAEV,yBAAyB,CAAC;;AAE7B;AACA;AACA,OAAO,MAAM2B,kBAAkB,GAC5BjB,IAAe,IACfD,QAAQ,IACPiB,iBAAiB,CAACjB,QAAQ,EAAEC,IAAI,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FormAutosave.js","names":["debounce","ModularUIRequest","FormModel","HTTP_METHODS","VALIDATE_DEBOUNCE_TIMEOUT","AUTOSAVE_STATUS","updateForm","updateAutosave","status","model","type","payload","autosave","dispatch","form","START","formdata","getFormData","selfhref","setParameter","method","POST","data","childmodels","locale","fetch","then","savedForm","lastServerUpdate","FINISHED","debouncedAutosave","autosaveFormObject"],"sources":["../../../src/redux/actions/FormAutosave.js"],"sourcesContent":["// @flow\nimport debounce from \"lodash/debounce\";\n\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\nimport FormModel from \"../../models/form/FormModel\";\n\nimport {\n HTTP_METHODS,\n VALIDATE_DEBOUNCE_TIMEOUT,\n AUTOSAVE_STATUS,\n} from \"../../constants/Constants\";\n\nimport { updateForm } from \"../_modularui/ModularUIActions\";\n\nimport type { UpdateAutosaveAction, ThunkAction, Dispatch } from \"../types\";\n\n/**\n * Update validations of the form currently in the reducer\n * because of the debounce timeout there might have been an update on the form during validation\n */\nconst updateAutosave = (\n status: $Keys<typeof AUTOSAVE_STATUS>,\n model: FormModel,\n): UpdateAutosaveAction => ({\n type: \"UPDATE_AUTOSAVE_STATUS\",\n payload: {\n status,\n model,\n },\n});\n\n/**\n */\nconst autosave = (dispatch: Dispatch, form: FormModel) => {\n dispatch(updateAutosave(AUTOSAVE_STATUS.START, form));\n\n const formdata = form.getFormData(true, false);\n\n new ModularUIRequest(form.selfhref.setParameter(\"commit\", \"true\"), {\n method: HTTP_METHODS.POST,\n data: formdata,\n childmodels: false,\n locale: form.locale,\n })\n .fetch()\n .then((savedForm) => {\n if (savedForm instanceof FormModel) {\n // update last server update to indicate an update has happened\n // send the existing form to prevent updates in the ui based on autosave results\n form.lastServerUpdate = savedForm.lastServerUpdate;\n\n dispatch(updateForm(form));\n dispatch(updateAutosave(AUTOSAVE_STATUS.FINISHED, savedForm));\n }\n });\n};\n\n/**\n * Validates form objects debounced to prevent overloading the (form) service\n * When a form with new errors (or complete) arrives, we send the validations\n * to the current form model where the errors are processed\n * A new form with the new constraints is send to the store\n */\nconst debouncedAutosave = debounce((dispatch, form) => {\n autosave(dispatch, form);\n}, VALIDATE_DEBOUNCE_TIMEOUT);\n\n/**\n */\nexport const autosaveFormObject =\n (form: FormModel): ThunkAction<> =>\n (dispatch) =>\n debounced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,GAAG9B,QAAQ,CAAC,CAACa,QAAQ,EAAEC,IAAI,KAAK;EACrDF,QAAQ,CAACC,QAAQ,EAAEC,IAAI,CAAC;AAC1B,CAAC,EAAEV,yBAAyB,CAAC;;AAE7B;AACA;AACA,OAAO,MAAM2B,kBAAkB,GAC5BjB,IAAe,IACfD,QAAQ,IACPiB,iBAAiB,CAACjB,QAAQ,EAAEC,IAAI,CAAC","ignoreList":[]}
|
|
@@ -12,7 +12,7 @@ export const autosubmitFormObject = (
|
|
|
12
12
|
form: FormModel,
|
|
13
13
|
attribute: AttributeType,
|
|
14
14
|
forceUpdate: boolean = false,
|
|
15
|
-
):
|
|
15
|
+
): ThunkAction<> | null => {
|
|
16
16
|
// As long as we have form objects,
|
|
17
17
|
// and the current attribute is not found in the current form object, go back.
|
|
18
18
|
// When a form has a result, the current form object is null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormAutosubmit.js","names":["loadModularUI","HTTP_METHODS","FormModel","autosubmitFormObject","form","attribute","forceUpdate","allObjects","length","currentFormObject","hasAttributeByKey","key","setPreviousObject","isChanged","connectKey","selfhref","method","POST","data","formdata","updateHandler","newModel","clonedModel","clone","update"],"sources":["../../../src/redux/actions/FormAutosubmit.js"],"sourcesContent":["// @flow\nimport { loadModularUI } from \"../_modularui/ModularUIActions\";\nimport { HTTP_METHODS } from \"../../constants/Constants\";\nimport FormModel from \"../../models/form/FormModel\";\n\nimport type { ModularUIModel, AttributeType } from \"../../models/types\";\nimport type { ThunkAction } from \"../types\";\n\n/**\n */\nexport const autosubmitFormObject = (\n form: FormModel,\n attribute: AttributeType,\n forceUpdate: boolean = false,\n):
|
|
1
|
+
{"version":3,"file":"FormAutosubmit.js","names":["loadModularUI","HTTP_METHODS","FormModel","autosubmitFormObject","form","attribute","forceUpdate","allObjects","length","currentFormObject","hasAttributeByKey","key","setPreviousObject","isChanged","connectKey","selfhref","method","POST","data","formdata","updateHandler","newModel","clonedModel","clone","update"],"sources":["../../../src/redux/actions/FormAutosubmit.js"],"sourcesContent":["// @flow\nimport { loadModularUI } from \"../_modularui/ModularUIActions\";\nimport { HTTP_METHODS } from \"../../constants/Constants\";\nimport FormModel from \"../../models/form/FormModel\";\n\nimport type { ModularUIModel, AttributeType } from \"../../models/types\";\nimport type { ThunkAction } from \"../types\";\n\n/**\n */\nexport const autosubmitFormObject = (\n form: FormModel,\n attribute: AttributeType,\n forceUpdate: boolean = false,\n): ThunkAction<> | null => {\n // As long as we have form objects,\n // and the current attribute is not found in the current form object, go back.\n // When a form has a result, the current form object is null\n while (\n form.allObjects.length > 0 &&\n (!form.currentFormObject ||\n !form.currentFormObject.hasAttributeByKey(attribute.key))\n ) {\n form.setPreviousObject();\n }\n\n if (form.isChanged() || forceUpdate) {\n return loadModularUI(form.connectKey, form.selfhref, {\n method: HTTP_METHODS.POST,\n data: form.formdata,\n updateHandler: (newModel: ModularUIModel): ModularUIModel => {\n if (newModel instanceof FormModel) {\n const clonedModel: FormModel = form.clone();\n clonedModel.update(newModel);\n return clonedModel;\n }\n return newModel;\n },\n });\n }\n\n return null;\n};\n"],"mappings":"AACA,SAASA,aAAa,QAAQ,gCAAgC;AAC9D,SAASC,YAAY,QAAQ,2BAA2B;AACxD,OAAOC,SAAS,MAAM,6BAA6B;AAKnD;AACA;AACA,OAAO,MAAMC,oBAAoB,GAAGA,CAClCC,IAAe,EACfC,SAAwB,EACxBC,WAAoB,GAAG,KAAK,KACH;EACzB;EACA;EACA;EACA,OACEF,IAAI,CAACG,UAAU,CAACC,MAAM,GAAG,CAAC,KACzB,CAACJ,IAAI,CAACK,iBAAiB,IACtB,CAACL,IAAI,CAACK,iBAAiB,CAACC,iBAAiB,CAACL,SAAS,CAACM,GAAG,CAAC,CAAC,EAC3D;IACAP,IAAI,CAACQ,iBAAiB,CAAC,CAAC;EAC1B;EAEA,IAAIR,IAAI,CAACS,SAAS,CAAC,CAAC,IAAIP,WAAW,EAAE;IACnC,OAAON,aAAa,CAACI,IAAI,CAACU,UAAU,EAAEV,IAAI,CAACW,QAAQ,EAAE;MACnDC,MAAM,EAAEf,YAAY,CAACgB,IAAI;MACzBC,IAAI,EAAEd,IAAI,CAACe,QAAQ;MACnBC,aAAa,EAAGC,QAAwB,IAAqB;QAC3D,IAAIA,QAAQ,YAAYnB,SAAS,EAAE;UACjC,MAAMoB,WAAsB,GAAGlB,IAAI,CAACmB,KAAK,CAAC,CAAC;UAC3CD,WAAW,CAACE,MAAM,CAACH,QAAQ,CAAC;UAC5B,OAAOC,WAAW;QACpB;QACA,OAAOD,QAAQ;MACjB;IACF,CAAC,CAAC;EACJ;EAEA,OAAO,IAAI;AACb,CAAC","ignoreList":[]}
|
|
@@ -12,7 +12,7 @@ import type { ThunkAction } from "../types";
|
|
|
12
12
|
export const autoupdateFormObject = (
|
|
13
13
|
form: FormModel,
|
|
14
14
|
attribute: AttributeType,
|
|
15
|
-
):
|
|
15
|
+
): ThunkAction<> | null => {
|
|
16
16
|
// As long as we have form objects,
|
|
17
17
|
// and the current attribute is not found in the current form object, go back.
|
|
18
18
|
// When a form has a result, the current form object is null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormAutoupdate.js","names":["loadModularUI","HTTP_METHODS","FormModel","autoupdateFormObject","form","attribute","allObjects","length","currentFormObject","hasAttributeByKey","key","setPreviousObject","isChanged","connectKey","selfhref","setParameter","method","POST","data","formdata","updateHandler","newModel","clonedModel","clone","updateCurrentFormObject"],"sources":["../../../src/redux/actions/FormAutoupdate.js"],"sourcesContent":["// @flow\nimport { loadModularUI } from \"../_modularui/ModularUIActions\";\nimport { HTTP_METHODS } from \"../../constants/Constants\";\n\nimport FormModel from \"../../models/form/FormModel\";\n\nimport type { AttributeType, ModularUIModel } from \"../../models/types\";\nimport type { ThunkAction } from \"../types\";\n\n/**\n */\nexport const autoupdateFormObject = (\n form: FormModel,\n attribute: AttributeType,\n):
|
|
1
|
+
{"version":3,"file":"FormAutoupdate.js","names":["loadModularUI","HTTP_METHODS","FormModel","autoupdateFormObject","form","attribute","allObjects","length","currentFormObject","hasAttributeByKey","key","setPreviousObject","isChanged","connectKey","selfhref","setParameter","method","POST","data","formdata","updateHandler","newModel","clonedModel","clone","updateCurrentFormObject"],"sources":["../../../src/redux/actions/FormAutoupdate.js"],"sourcesContent":["// @flow\nimport { loadModularUI } from \"../_modularui/ModularUIActions\";\nimport { HTTP_METHODS } from \"../../constants/Constants\";\n\nimport FormModel from \"../../models/form/FormModel\";\n\nimport type { AttributeType, ModularUIModel } from \"../../models/types\";\nimport type { ThunkAction } from \"../types\";\n\n/**\n */\nexport const autoupdateFormObject = (\n form: FormModel,\n attribute: AttributeType,\n): ThunkAction<> | null => {\n // As long as we have form objects,\n // and the current attribute is not found in the current form object, go back.\n // When a form has a result, the current form object is null\n while (\n form.allObjects.length > 0 &&\n (!form.currentFormObject ||\n !form.currentFormObject.hasAttributeByKey(attribute.key))\n ) {\n form.setPreviousObject();\n }\n\n if (form.isChanged()) {\n return loadModularUI(\n form.connectKey,\n form.selfhref.setParameter(\"commit\", \"false\"),\n {\n method: HTTP_METHODS.POST,\n data: form.formdata,\n updateHandler: (newModel: ModularUIModel): ModularUIModel => {\n if (newModel instanceof FormModel) {\n const clonedModel: FormModel = form.clone();\n clonedModel.updateCurrentFormObject(newModel);\n return clonedModel;\n }\n return newModel;\n },\n },\n );\n }\n\n return null;\n};\n"],"mappings":"AACA,SAASA,aAAa,QAAQ,gCAAgC;AAC9D,SAASC,YAAY,QAAQ,2BAA2B;AAExD,OAAOC,SAAS,MAAM,6BAA6B;AAKnD;AACA;AACA,OAAO,MAAMC,oBAAoB,GAAGA,CAClCC,IAAe,EACfC,SAAwB,KACC;EACzB;EACA;EACA;EACA,OACED,IAAI,CAACE,UAAU,CAACC,MAAM,GAAG,CAAC,KACzB,CAACH,IAAI,CAACI,iBAAiB,IACtB,CAACJ,IAAI,CAACI,iBAAiB,CAACC,iBAAiB,CAACJ,SAAS,CAACK,GAAG,CAAC,CAAC,EAC3D;IACAN,IAAI,CAACO,iBAAiB,CAAC,CAAC;EAC1B;EAEA,IAAIP,IAAI,CAACQ,SAAS,CAAC,CAAC,EAAE;IACpB,OAAOZ,aAAa,CAClBI,IAAI,CAACS,UAAU,EACfT,IAAI,CAACU,QAAQ,CAACC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,EAC7C;MACEC,MAAM,EAAEf,YAAY,CAACgB,IAAI;MACzBC,IAAI,EAAEd,IAAI,CAACe,QAAQ;MACnBC,aAAa,EAAGC,QAAwB,IAAqB;QAC3D,IAAIA,QAAQ,YAAYnB,SAAS,EAAE;UACjC,MAAMoB,WAAsB,GAAGlB,IAAI,CAACmB,KAAK,CAAC,CAAC;UAC3CD,WAAW,CAACE,uBAAuB,CAACH,QAAQ,CAAC;UAC7C,OAAOC,WAAW;QACpB;QACA,OAAOD,QAAQ;MACjB;IACF,CACF,CAAC;EACH;EAEA,OAAO,IAAI;AACb,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormValidations.js","names":["debounce","updateForm","ModularUIRequest","HTTP_METHODS","VALIDATE_DEBOUNCE_TIMEOUT","FormModel","updateValidations","form","formWithValidations","dispatch","getState","currentForm","modularui","connectKey","validatedForm","model","clone","data","debouncedValidateFormObject","selfhref","setParameter","method","POST","validationData","childmodels","isValidationRequest","locale","fetch","then","leading","trailing","validateFormObject"],"sources":["../../../src/redux/actions/FormValidations.js"],"sourcesContent":["// @flow\nimport debounce from \"lodash/debounce\";\n\nimport { updateForm } from \"../_modularui/ModularUIActions\";\n\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\n\nimport {\n HTTP_METHODS,\n VALIDATE_DEBOUNCE_TIMEOUT,\n} from \"../../constants/Constants\";\n\nimport FormModel from \"../../models/form/FormModel\";\n\nimport type { Dispatch, GetState, ThunkAction } from \"../types\";\nimport type { ModularUIModel } from \"../../models\";\n\n/**\n * Update validations of the form currently in the reducer\n * because of the debounce timeout there might have been an update on the form during validation\n */\nconst updateValidations =\n (form: FormModel, formWithValidations: ModularUIModel) =>\n (dispatch: Dispatch, getState: GetState) => {\n const currentForm = getState().modularui[form.connectKey];\n\n if (currentForm) {\n const validatedForm = currentForm.model.clone();\n if (validatedForm instanceof FormModel) {\n validatedForm.updateValidations(formWithValidations.data);\n }\n\n dispatch(updateForm(validatedForm));\n }\n };\n\n/**\n * Validates form objects debounced to prevent overloading the (form) service\n * When a form with new errors (or complete) arrives, we send the validations\n * to the current form model where the errors are processed\n * A new form with the new constraints is send to the store\n */\nconst debouncedValidateFormObject = debounce<\n (dispatch: Dispatch, form: FormModel) => void,\n>(\n (dispatch, form: FormModel) => {\n new ModularUIRequest(form.selfhref.setParameter(\"commit\", \"false\"), {\n method: HTTP_METHODS.POST,\n data: form.validationData,\n childmodels: false,\n isValidationRequest: true,\n locale: form.locale,\n })\n .fetch()\n .then((formWithValidations) =>\n dispatch(updateValidations(form, formWithValidations)),\n );\n },\n VALIDATE_DEBOUNCE_TIMEOUT,\n {\n leading: true,\n trailing: true,\n },\n);\n\n/**\n */\nexport const validateFormObject =\n (form: FormModel): ThunkAction =>\n (dispatch) =>\n debouncedValidateFormObject(dispatch, form);\n"],"mappings":"AACA,OAAOA,QAAQ,MAAM,iBAAiB;AAEtC,SAASC,UAAU,QAAQ,gCAAgC;AAE3D,OAAOC,gBAAgB,MAAM,kCAAkC;AAE/D,SACEC,YAAY,EACZC,yBAAyB,QACpB,2BAA2B;AAElC,OAAOC,SAAS,MAAM,6BAA6B;AAKnD;AACA;AACA;AACA;AACA,MAAMC,iBAAiB,GACrBA,CAACC,IAAe,EAAEC,mBAAmC,KACrD,CAACC,QAAkB,EAAEC,QAAkB,KAAK;EAC1C,MAAMC,WAAW,GAAGD,QAAQ,CAAC,CAAC,CAACE,SAAS,CAACL,IAAI,CAACM,UAAU,CAAC;EAEzD,IAAIF,WAAW,EAAE;IACf,MAAMG,aAAa,GAAGH,WAAW,CAACI,KAAK,CAACC,KAAK,CAAC,CAAC;IAC/C,IAAIF,aAAa,YAAYT,SAAS,EAAE;MACtCS,aAAa,CAACR,iBAAiB,CAACE,mBAAmB,CAACS,IAAI,CAAC;IAC3D;IAEAR,QAAQ,CAACR,UAAU,CAACa,aAAa,CAAC,CAAC;EACrC;AACF,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,2BAA2B,GAAGlB,QAAQ,CAG1C,CAACS,QAAQ,EAAEF,IAAe,KAAK;EAC7B,IAAIL,gBAAgB,CAACK,IAAI,CAACY,QAAQ,CAACC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE;IAClEC,MAAM,EAAElB,YAAY,CAACmB,IAAI;IACzBL,IAAI,EAAEV,IAAI,CAACgB,cAAc;IACzBC,WAAW,EAAE,KAAK;IAClBC,mBAAmB,EAAE,IAAI;IACzBC,MAAM,EAAEnB,IAAI,CAACmB;EACf,CAAC,CAAC,CACCC,KAAK,CAAC,CAAC,CACPC,IAAI,CAAEpB,mBAAmB,IACxBC,QAAQ,CAACH,iBAAiB,CAACC,IAAI,EAAEC,mBAAmB,CAAC,CACvD,CAAC;AACL,CAAC,EACDJ,yBAAyB,EACzB;EACEyB,OAAO,EAAE,IAAI;EACbC,QAAQ,EAAE;AACZ,CACF,CAAC;;AAED;AACA;AACA,OAAO,MAAMC,kBAAkB,GAC5BxB,IAAe,IACfE,QAAQ,IACPS,2BAA2B,CAACT,QAAQ,EAAEF,IAAI,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FormValidations.js","names":["debounce","updateForm","ModularUIRequest","HTTP_METHODS","VALIDATE_DEBOUNCE_TIMEOUT","FormModel","updateValidations","form","formWithValidations","dispatch","getState","currentForm","modularui","connectKey","validatedForm","model","clone","data","debouncedValidateFormObject","selfhref","setParameter","method","POST","validationData","childmodels","isValidationRequest","locale","fetch","then","leading","trailing","validateFormObject"],"sources":["../../../src/redux/actions/FormValidations.js"],"sourcesContent":["// @flow\nimport debounce from \"lodash/debounce\";\n\nimport { updateForm } from \"../_modularui/ModularUIActions\";\n\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\n\nimport {\n HTTP_METHODS,\n VALIDATE_DEBOUNCE_TIMEOUT,\n} from \"../../constants/Constants\";\n\nimport FormModel from \"../../models/form/FormModel\";\n\nimport type { Dispatch, GetState, ThunkAction } from \"../types\";\nimport type { ModularUIModel } from \"../../models\";\n\n/**\n * Update validations of the form currently in the reducer\n * because of the debounce timeout there might have been an update on the form during validation\n */\nconst updateValidations =\n (form: FormModel, formWithValidations: ModularUIModel) =>\n (dispatch: Dispatch, getState: GetState) => {\n const currentForm = getState().modularui[form.connectKey];\n\n if (currentForm) {\n const validatedForm = currentForm.model.clone();\n if (validatedForm instanceof FormModel) {\n validatedForm.updateValidations(formWithValidations.data);\n }\n\n dispatch(updateForm(validatedForm));\n }\n };\n\n/**\n * Validates form objects debounced to prevent overloading the (form) service\n * When a form with new errors (or complete) arrives, we send the validations\n * to the current form model where the errors are processed\n * A new form with the new constraints is send to the store\n */\nconst debouncedValidateFormObject = debounce<\n (dispatch: Dispatch, form: FormModel) => void,\n>(\n (dispatch, form: FormModel) => {\n new ModularUIRequest(form.selfhref.setParameter(\"commit\", \"false\"), {\n method: HTTP_METHODS.POST,\n data: form.validationData,\n childmodels: false,\n isValidationRequest: true,\n locale: form.locale,\n })\n .fetch()\n .then((formWithValidations) =>\n dispatch(updateValidations(form, formWithValidations)),\n );\n },\n VALIDATE_DEBOUNCE_TIMEOUT,\n {\n leading: true,\n trailing: true,\n },\n);\n\n/**\n */\nexport const validateFormObject =\n (form: FormModel): ThunkAction<> =>\n (dispatch) =>\n debouncedValidateFormObject(dispatch, form);\n"],"mappings":"AACA,OAAOA,QAAQ,MAAM,iBAAiB;AAEtC,SAASC,UAAU,QAAQ,gCAAgC;AAE3D,OAAOC,gBAAgB,MAAM,kCAAkC;AAE/D,SACEC,YAAY,EACZC,yBAAyB,QACpB,2BAA2B;AAElC,OAAOC,SAAS,MAAM,6BAA6B;AAK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showNotification =
|
|
|
25
25
|
message: MessageObject,
|
|
26
26
|
error?: ?ErrorResponse,
|
|
27
27
|
timeout?: ?number,
|
|
28
|
-
): ThunkAction =>
|
|
28
|
+
): ThunkAction<> =>
|
|
29
29
|
(dispatch) => {
|
|
30
30
|
dispatch({
|
|
31
31
|
type: "SHOW_NOTIFICATION",
|
|
@@ -65,7 +65,7 @@ const getNotificationMessageId = (form: FormModel) => {
|
|
|
65
65
|
* Show form notification
|
|
66
66
|
*/
|
|
67
67
|
export const showFormNotification =
|
|
68
|
-
(form: FormModel): ThunkAction =>
|
|
68
|
+
(form: FormModel): ThunkAction<> =>
|
|
69
69
|
(dispatch) => {
|
|
70
70
|
dispatch(startProgress());
|
|
71
71
|
|
|
@@ -86,7 +86,7 @@ export const showFormNotification =
|
|
|
86
86
|
* Show error notification
|
|
87
87
|
*/
|
|
88
88
|
export const showXHRErrorNotification =
|
|
89
|
-
(error: ErrorResponse): ThunkAction =>
|
|
89
|
+
(error: ErrorResponse): ThunkAction<> =>
|
|
90
90
|
(dispatch) =>
|
|
91
91
|
dispatch(
|
|
92
92
|
showNotification(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notification.js","names":["startProgress","finishProgress","getSetting","NOTIFICATION_TYPES","dismissNotification","type","showNotification","message","error","timeout","dispatch","payload","setTimeout","getNotificationMessageId","form","actiontype","showFormNotification","SUCCESS","id","showXHRErrorNotification","ERROR","defaultMessage","parameters","properties"],"sources":["../../../src/redux/actions/Notification.js"],"sourcesContent":["// @flow\nimport { startProgress, finishProgress } from \"./ProgressIndicator\";\n\nimport { getSetting } from \"../../constants/Settings\";\n\nimport { NOTIFICATION_TYPES } from \"../../constants/Constants\";\n\nimport type { DismissNotificationAction, ThunkAction } from \"../types\";\nimport type { MessageObject } from \"../../i18n/types\";\nimport type ErrorResponse from \"../../models/error/ErrorResponse\";\nimport type FormModel from \"../../models/form/FormModel\";\n\n/**\n * Dismiss notification message\n */\nexport const dismissNotification = (): DismissNotificationAction => ({\n type: \"DISMISS_NOTIFICATION\",\n});\n\n/**\n */\nexport const showNotification =\n (\n type: $Keys<typeof NOTIFICATION_TYPES>,\n message: MessageObject,\n error?: ?ErrorResponse,\n timeout?: ?number,\n ): ThunkAction =>\n (dispatch) => {\n dispatch({\n type: \"SHOW_NOTIFICATION\",\n payload: {\n type,\n message,\n error,\n },\n });\n\n if (timeout) {\n setTimeout(() => {\n dispatch(dismissNotification());\n }, timeout);\n }\n };\n\n/**\n */\nconst getNotificationMessageId = (form: FormModel) => {\n if (form.actiontype === \"create\") {\n return \"Notification.Msg.Create\";\n }\n\n if (form.actiontype === \"update\") {\n return \"Notification.Msg.Update\";\n }\n\n if (form.actiontype === \"delete\") {\n return \"Notification.Msg.Delete\";\n }\n\n return \"Notification.Msg.Generic\";\n};\n\n/**\n * Show form notification\n */\nexport const showFormNotification =\n (form: FormModel): ThunkAction =>\n (dispatch) => {\n dispatch(startProgress());\n\n dispatch(\n showNotification(NOTIFICATION_TYPES.SUCCESS, {\n id: getNotificationMessageId(form),\n }),\n );\n\n setTimeout(() => {\n dispatch(dismissNotification());\n }, getSetting(\"HIDE_NOTIFICATION_TIMEOUT\"));\n\n return dispatch(finishProgress());\n };\n\n/**\n * Show error notification\n */\nexport const showXHRErrorNotification =\n (error: ErrorResponse): ThunkAction =>\n (dispatch) =>\n dispatch(\n showNotification(\n NOTIFICATION_TYPES.ERROR,\n {\n id: error.id,\n defaultMessage: error.message,\n parameters: error.properties,\n },\n error,\n ),\n );\n"],"mappings":"AACA,SAASA,aAAa,EAAEC,cAAc,QAAQ,qBAAqB;AAEnE,SAASC,UAAU,QAAQ,0BAA0B;AAErD,SAASC,kBAAkB,QAAQ,2BAA2B;AAO9D;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAGA,CAAA,MAAkC;EACnEC,IAAI,EAAE;AACR,CAAC,CAAC;;AAEF;AACA;AACA,OAAO,MAAMC,gBAAgB,GAC3BA,CACED,IAAsC,EACtCE,OAAs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;EACZG,cAAc,EAAEb,KAAK,CAACD,OAAO;EAC7Be,UAAU,EAAEd,KAAK,CAACe;AACpB,CAAC,EACDf,KACF,CACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Notification.js","names":["startProgress","finishProgress","getSetting","NOTIFICATION_TYPES","dismissNotification","type","showNotification","message","error","timeout","dispatch","payload","setTimeout","getNotificationMessageId","form","actiontype","showFormNotification","SUCCESS","id","showXHRErrorNotification","ERROR","defaultMessage","parameters","properties"],"sources":["../../../src/redux/actions/Notification.js"],"sourcesContent":["// @flow\nimport { startProgress, finishProgress } from \"./ProgressIndicator\";\n\nimport { getSetting } from \"../../constants/Settings\";\n\nimport { NOTIFICATION_TYPES } from \"../../constants/Constants\";\n\nimport type { DismissNotificationAction, ThunkAction } from \"../types\";\nimport type { MessageObject } from \"../../i18n/types\";\nimport type ErrorResponse from \"../../models/error/ErrorResponse\";\nimport type FormModel from \"../../models/form/FormModel\";\n\n/**\n * Dismiss notification message\n */\nexport const dismissNotification = (): DismissNotificationAction => ({\n type: \"DISMISS_NOTIFICATION\",\n});\n\n/**\n */\nexport const showNotification =\n (\n type: $Keys<typeof NOTIFICATION_TYPES>,\n message: MessageObject,\n error?: ?ErrorResponse,\n timeout?: ?number,\n ): ThunkAction<> =>\n (dispatch) => {\n dispatch({\n type: \"SHOW_NOTIFICATION\",\n payload: {\n type,\n message,\n error,\n },\n });\n\n if (timeout) {\n setTimeout(() => {\n dispatch(dismissNotification());\n }, timeout);\n }\n };\n\n/**\n */\nconst getNotificationMessageId = (form: FormModel) => {\n if (form.actiontype === \"create\") {\n return \"Notification.Msg.Create\";\n }\n\n if (form.actiontype === \"update\") {\n return \"Notification.Msg.Update\";\n }\n\n if (form.actiontype === \"delete\") {\n return \"Notification.Msg.Delete\";\n }\n\n return \"Notification.Msg.Generic\";\n};\n\n/**\n * Show form notification\n */\nexport const showFormNotification =\n (form: FormModel): ThunkAction<> =>\n (dispatch) => {\n dispatch(startProgress());\n\n dispatch(\n showNotification(NOTIFICATION_TYPES.SUCCESS, {\n id: getNotificationMessageId(form),\n }),\n );\n\n setTimeout(() => {\n dispatch(dismissNotification());\n }, getSetting(\"HIDE_NOTIFICATION_TIMEOUT\"));\n\n return dispatch(finishProgress());\n };\n\n/**\n * Show error notification\n */\nexport const showXHRErrorNotification =\n (error: ErrorResponse): ThunkAction<> =>\n (dispatch) =>\n dispatch(\n showNotification(\n NOTIFICATION_TYPES.ERROR,\n {\n id: error.id,\n defaultMessage: error.message,\n parameters: error.properties,\n },\n error,\n ),\n );\n"],"mappings":"AACA,SAASA,aAAa,EAAEC,cAAc,QAAQ,qBAAqB;AAEnE,SAASC,UAAU,QAAQ,0BAA0B;AAErD,SAASC,kBAAkB,QAAQ,2BAA2B;AAO9D;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAGA,CAAA,MAAkC;EACnEC,IAAI,EAAE;AACR,CAAC,CAAC;;AAEF;AACA;AACA,OAAO,MAAMC,gBAAgB,GAC3BA,CACED,IAAsC,EACtCE,OAAsB,EACtBC,KAAsB,EACtBC,OAAiB,KAElBC,QAAQ,IAAK;EACZA,QAAQ,CAAC;IACPL,IAAI,EAAE,mBAAmB;IACzBM,OAAO,EAAE;MACPN,IAAI;MACJE,OAAO;MACPC;IACF;EACF,CAAC,CAAC;EAEF,IAAIC,OAAO,EAAE;IACXG,UAAU,CAAC,MAAM;MACfF,QAAQ,CAACN,mBAAmB,CAAC,CAAC,CAAC;IACjC,CAAC,EAAEK,OAAO,CAAC;EACb;AACF,CAAC;;AAEH;AACA;AACA,MAAMI,wBAAwB,GAAIC,IAAe,IAAK;EACpD,IAAIA,IAAI,CAACC,UAAU,KAAK,QAAQ,EAAE;IAChC,OAAO,yBAAyB;EAClC;EAEA,IAAID,IAAI,CAACC,UAAU,KAAK,QAAQ,EAAE;IAChC,OAAO,yBAAyB;EAClC;EAEA,IAAID,IAAI,CAACC,UAAU,KAAK,QAAQ,EAAE;IAChC,OAAO,yBAAyB;EAClC;EAEA,OAAO,0BAA0B;AACnC,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,GAC9BF,IAAe,IACfJ,QAAQ,IAAK;EACZA,QAAQ,CAACV,aAAa,CAAC,CAAC,CAAC;EAEzBU,QAAQ,CACNJ,gBAAgB,CAACH,kBAAkB,CAACc,OAAO,EAAE;IAC3CC,EAAE,EAAEL,wBAAwB,CAACC,IAAI;EACnC,CAAC,CACH,CAAC;EAEDF,UAAU,CAAC,MAAM;IACfF,QAAQ,CAACN,mBAAmB,CAAC,CAAC,CAAC;EACjC,CAAC,EAAEF,UAAU,CAAC,2BAA2B,CAAC,CAAC;EAE3C,OAAOQ,QAAQ,CAACT,cAAc,CAAC,CAAC,CAAC;AACnC,CAAC;;AAEH;AACA;AACA;AACA,OAAO,MAAMkB,wBAAwB,GAClCX,KAAoB,IACpBE,QAAQ,IACPA,QAAQ,CACNJ,gBAAgB,CACdH,kBAAkB,CAACiB,KAAK,EACxB;EACEF,EAAE,EAAEV,KAAK,CAACU,EAAE;EACZG,cAAc,EAAEb,KAAK,CAACD,OAAO;EAC7Be,UAAU,EAAEd,KAAK,CAACe;AACpB,CAAC,EACDf,KACF,CACF,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Cache from "../../utils/browser/Cache";
|
|
2
2
|
import Authenticate from "../../modularui/Authenticate";
|
|
3
|
-
import { getApplication } from "../_modularui/ModularUISelectors";
|
|
4
3
|
import { reloadApplication } from "./Application";
|
|
5
4
|
import { startProgress, finishProgress } from "./ProgressIndicator";
|
|
6
5
|
import { push } from "../_router/RouterActions";
|
|
@@ -49,13 +48,12 @@ export const changePassword = () => (dispatch, getState) => {
|
|
|
49
48
|
|
|
50
49
|
/**
|
|
51
50
|
*/
|
|
52
|
-
export const login = (username, password) => async
|
|
51
|
+
export const login = (username, password) => async dispatch => {
|
|
53
52
|
dispatch(startProgress());
|
|
54
53
|
try {
|
|
55
54
|
const response = await new Authenticate().login(username, password);
|
|
56
|
-
await dispatch(reloadApplication());
|
|
55
|
+
const application = await dispatch(reloadApplication());
|
|
57
56
|
Cache.addItem("auth", true);
|
|
58
|
-
const application = getApplication(getState());
|
|
59
57
|
if (application?.userMustChangePassword) {
|
|
60
58
|
dispatch(changePassword());
|
|
61
59
|
} else {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import Cache from "../../utils/browser/Cache";
|
|
3
3
|
import Authenticate from "../../modularui/Authenticate";
|
|
4
|
-
import { getApplication } from "../_modularui/ModularUISelectors";
|
|
5
4
|
|
|
6
5
|
import { reloadApplication } from "./Application";
|
|
7
6
|
import { startProgress, finishProgress } from "./ProgressIndicator";
|
|
@@ -50,7 +49,7 @@ export const loginSuccess = (): LoginSuccessAction => ({
|
|
|
50
49
|
/**
|
|
51
50
|
* Send change password action
|
|
52
51
|
*/
|
|
53
|
-
export const changePassword = (): ThunkAction => (dispatch, getState) => {
|
|
52
|
+
export const changePassword = (): ThunkAction<> => (dispatch, getState) => {
|
|
54
53
|
dispatch({
|
|
55
54
|
type: "CHANGE_PASSWORD",
|
|
56
55
|
});
|
|
@@ -68,17 +67,15 @@ export const changePassword = (): ThunkAction => (dispatch, getState) => {
|
|
|
68
67
|
/**
|
|
69
68
|
*/
|
|
70
69
|
export const login =
|
|
71
|
-
(username: string, password: string): ThunkAction =>
|
|
72
|
-
async (dispatch
|
|
70
|
+
(username: string, password: string): ThunkAction<> =>
|
|
71
|
+
async (dispatch) => {
|
|
73
72
|
dispatch(startProgress());
|
|
74
73
|
|
|
75
74
|
try {
|
|
76
75
|
const response = await new Authenticate().login(username, password);
|
|
77
76
|
|
|
78
|
-
await dispatch(reloadApplication());
|
|
79
|
-
|
|
77
|
+
const application = await dispatch(reloadApplication());
|
|
80
78
|
Cache.addItem("auth", true);
|
|
81
|
-
const application = getApplication(getState());
|
|
82
79
|
|
|
83
80
|
if (application?.userMustChangePassword) {
|
|
84
81
|
dispatch(changePassword());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignIn.js","names":["Cache","Authenticate","
|
|
1
|
+
{"version":3,"file":"SignIn.js","names":["Cache","Authenticate","reloadApplication","startProgress","finishProgress","push","CHANGEPASSWORD_PATH","loginFailed","errorMessage","sendAuthenticationError","type","payload","resetAuthErrors","loginSuccess","changePassword","dispatch","getState","isModal","router","location","state","modal","locationFrom","from","login","username","password","response","application","addItem","userMustChangePassword","error","id"],"sources":["../../../src/redux/actions/SignIn.js"],"sourcesContent":["// @flow\nimport Cache from \"../../utils/browser/Cache\";\nimport Authenticate from \"../../modularui/Authenticate\";\n\nimport { reloadApplication } from \"./Application\";\nimport { startProgress, finishProgress } from \"./ProgressIndicator\";\n\nimport { push } from \"../_router/RouterActions\";\nimport { CHANGEPASSWORD_PATH } from \"../../constants/Constants\";\n\nimport type {\n SendAuthenticationErrorAction,\n ResetAuthErrorsAction,\n LoginSuccessAction,\n ThunkAction,\n} from \"../types\";\n\n/**\n * Send login failed action\n */\nexport const loginFailed = (\n errorMessage: string,\n): SendAuthenticationErrorAction => sendAuthenticationError(errorMessage);\n\n/**\n * Send authentication error action\n */\nexport const sendAuthenticationError = (\n errorMessage: string,\n): SendAuthenticationErrorAction => ({\n type: \"AUTHENTICATION_ERROR\",\n payload: errorMessage,\n});\n\n/**\n * Resets any authentication errors\n */\nexport const resetAuthErrors = (): ResetAuthErrorsAction => ({\n type: \"AUTHENTICATION_RESET_ERRORS\",\n});\n\n/**\n * Send login success action\n */\nexport const loginSuccess = (): LoginSuccessAction => ({\n type: \"AUTHENTICATION_SUCCESS\",\n});\n\n/**\n * Send change password action\n */\nexport const changePassword = (): ThunkAction<> => (dispatch, getState) => {\n dispatch({\n type: \"CHANGE_PASSWORD\",\n });\n\n const isModal = getState().router.location?.state?.modal;\n const locationFrom = getState().router.location?.state?.from;\n return dispatch(\n push(CHANGEPASSWORD_PATH, {\n from: locationFrom ? locationFrom : getState().router.location,\n modal: isModal,\n }),\n );\n};\n\n/**\n */\nexport const login =\n (username: string, password: string): ThunkAction<> =>\n async (dispatch) => {\n dispatch(startProgress());\n\n try {\n const response = await new Authenticate().login(username, password);\n\n const application = await dispatch(reloadApplication());\n Cache.addItem(\"auth\", true);\n\n if (application?.userMustChangePassword) {\n dispatch(changePassword());\n } else {\n dispatch(loginSuccess());\n }\n\n dispatch(finishProgress());\n return response;\n } catch (error) {\n if (error.id === \"Error.ChangePasswordRequired\") {\n await dispatch(reloadApplication());\n Cache.addItem(\"auth\", true);\n dispatch(changePassword());\n } else {\n dispatch(loginFailed(error.id));\n }\n dispatch(finishProgress());\n return error;\n }\n };\n"],"mappings":"AACA,OAAOA,KAAK,MAAM,2BAA2B;AAC7C,OAAOC,YAAY,MAAM,8BAA8B;AAEvD,SAASC,iBAAiB,QAAQ,eAAe;AACjD,SAASC,aAAa,EAAEC,cAAc,QAAQ,qBAAqB;AAEnE,SAASC,IAAI,QAAQ,0BAA0B;AAC/C,SAASC,mBAAmB,QAAQ,2BAA2B;AAS/D;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GACtBC,YAAoB,IACcC,uBAAuB,CAACD,YAAY,CAAC;;AAEzE;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAClCD,YAAoB,KACe;EACnCE,IAAI,EAAE,sBAAsB;EAC5BC,OAAO,EAAEH;AACX,CAAC,CAAC;;AAEF;AACA;AACA;AACA,OAAO,MAAMI,eAAe,GAAGA,CAAA,MAA8B;EAC3DF,IAAI,EAAE;AACR,CAAC,CAAC;;AAEF;AACA;AACA;AACA,OAAO,MAAMG,YAAY,GAAGA,CAAA,MAA2B;EACrDH,IAAI,EAAE;AACR,CAAC,CAAC;;AAEF;AACA;AACA;AACA,OAAO,MAAMI,cAAc,GAAGA,CAAA,KAAqB,CAACC,QAAQ,EAAEC,QAAQ,KAAK;EACzED,QAAQ,CAAC;IACPL,IAAI,EAAE;EACR,CAAC,CAAC;EAEF,MAAMO,OAAO,GAAGD,QAAQ,CAAC,CAAC,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ACLC,QAAQ,CAACR,WAAW,CAACwB,KAAK,CAACC,EAAE,CAAC,CAAC;IACjC;IACAjB,QAAQ,CAACX,cAAc,CAAC,CAAC,CAAC;IAC1B,OAAO2B,KAAK;EACd;AACF,CAAC","ignoreList":[]}
|
|
@@ -15,7 +15,7 @@ export const logoutSuccess = (): LogoutSuccessAction => ({
|
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
*/
|
|
18
|
-
export const logout = (): ThunkAction => (dispatch: Dispatch) => {
|
|
18
|
+
export const logout = (): ThunkAction<> => (dispatch: Dispatch) => {
|
|
19
19
|
dispatch(startProgress());
|
|
20
20
|
|
|
21
21
|
return new Authenticate()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignOut.js","names":["Authenticate","startProgress","finishProgress","resetModularUI","reloadApplication","logoutSuccess","type","logout","dispatch","then"],"sources":["../../../src/redux/actions/SignOut.js"],"sourcesContent":["// @flow\nimport Authenticate from \"../../modularui/Authenticate\";\nimport { startProgress, finishProgress } from \"./ProgressIndicator\";\nimport { resetModularUI } from \"../_modularui/ModularUIActions\";\nimport { reloadApplication } from \"./Application\";\n\nimport type { Dispatch, LogoutSuccessAction, ThunkAction } from \"../types\";\n\n/**\n * Send logout success action\n */\nexport const logoutSuccess = (): LogoutSuccessAction => ({\n type: \"AUTHENTICATION_LOGOUT\",\n});\n\n/**\n */\nexport const logout = (): ThunkAction => (dispatch: Dispatch) => {\n dispatch(startProgress());\n\n return new Authenticate()\n .logout()\n .then(() => dispatch(resetModularUI()))\n .then(() => dispatch(reloadApplication()))\n .then(() => {\n dispatch(logoutSuccess());\n return dispatch(finishProgress());\n });\n};\n"],"mappings":"AACA,OAAOA,YAAY,MAAM,8BAA8B;AACvD,SAASC,aAAa,EAAEC,cAAc,QAAQ,qBAAqB;AACnE,SAASC,cAAc,QAAQ,gCAAgC;AAC/D,SAASC,iBAAiB,QAAQ,eAAe;AAIjD;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GAAGA,CAAA,MAA4B;EACvDC,IAAI,EAAE;AACR,CAAC,CAAC;;AAEF;AACA;AACA,OAAO,MAAMC,MAAM,GAAGA,CAAA,
|
|
1
|
+
{"version":3,"file":"SignOut.js","names":["Authenticate","startProgress","finishProgress","resetModularUI","reloadApplication","logoutSuccess","type","logout","dispatch","then"],"sources":["../../../src/redux/actions/SignOut.js"],"sourcesContent":["// @flow\nimport Authenticate from \"../../modularui/Authenticate\";\nimport { startProgress, finishProgress } from \"./ProgressIndicator\";\nimport { resetModularUI } from \"../_modularui/ModularUIActions\";\nimport { reloadApplication } from \"./Application\";\n\nimport type { Dispatch, LogoutSuccessAction, ThunkAction } from \"../types\";\n\n/**\n * Send logout success action\n */\nexport const logoutSuccess = (): LogoutSuccessAction => ({\n type: \"AUTHENTICATION_LOGOUT\",\n});\n\n/**\n */\nexport const logout = (): ThunkAction<> => (dispatch: Dispatch) => {\n dispatch(startProgress());\n\n return new Authenticate()\n .logout()\n .then(() => dispatch(resetModularUI()))\n .then(() => dispatch(reloadApplication()))\n .then(() => {\n dispatch(logoutSuccess());\n return dispatch(finishProgress());\n });\n};\n"],"mappings":"AACA,OAAOA,YAAY,MAAM,8BAA8B;AACvD,SAASC,aAAa,EAAEC,cAAc,QAAQ,qBAAqB;AACnE,SAASC,cAAc,QAAQ,gCAAgC;AAC/D,SAASC,iBAAiB,QAAQ,eAAe;AAIjD;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GAAGA,CAAA,MAA4B;EACvDC,IAAI,EAAE;AACR,CAAC,CAAC;;AAEF;AACA;AACA,OAAO,MAAMC,MAAM,GAAGA,CAAA,KAAsBC,QAAkB,IAAK;EACjEA,QAAQ,CAACP,aAAa,CAAC,CAAC,CAAC;EAEzB,OAAO,IAAID,YAAY,CAAC,CAAC,CACtBO,MAAM,CAAC,CAAC,CACRE,IAAI,CAAC,MAAMD,QAAQ,CAACL,cAAc,CAAC,CAAC,CAAC,CAAC,CACtCM,IAAI,CAAC,MAAMD,QAAQ,CAACJ,iBAAiB,CAAC,CAAC,CAAC,CAAC,CACzCK,IAAI,CAAC,MAAM;IACVD,QAAQ,CAACH,aAAa,CAAC,CAAC,CAAC;IACzB,OAAOG,QAAQ,CAACN,cAAc,CAAC,CAAC,CAAC;EACnC,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|