@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.
Files changed (107) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/esm/hooks/__tests__/useAuthentication.spec.js.flow +100 -132
  3. package/esm/hooks/useAuthentication.js +14 -8
  4. package/esm/hooks/useAuthentication.js.flow +23 -23
  5. package/esm/hooks/useAuthentication.js.map +1 -1
  6. package/esm/hooks/useModularUI.js +1 -1
  7. package/esm/hooks/useModularUI.js.flow +1 -1
  8. package/esm/hooks/useModularUI.js.map +1 -1
  9. package/esm/models/filters/RangeFilterModel.js +1 -1
  10. package/esm/models/filters/RangeFilterModel.js.flow +1 -1
  11. package/esm/models/filters/RangeFilterModel.js.map +1 -1
  12. package/esm/models/filters/__tests__/RangeFilterModel.spec.js.flow +5 -7
  13. package/esm/redux/_i18n/I18nActions.js.flow +1 -1
  14. package/esm/redux/_i18n/I18nActions.js.map +1 -1
  15. package/esm/redux/_modularui/ModularUIActions.js.flow +2 -2
  16. package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
  17. package/esm/redux/_modularui/ModularUIConnector.js +2 -2
  18. package/esm/redux/_modularui/ModularUIConnector.js.flow +2 -2
  19. package/esm/redux/_modularui/ModularUIConnector.js.map +1 -1
  20. package/esm/redux/_modularui/ModularUISelectors.js +12 -18
  21. package/esm/redux/_modularui/ModularUISelectors.js.flow +13 -14
  22. package/esm/redux/_modularui/ModularUISelectors.js.map +1 -1
  23. package/esm/redux/_modularui/withModularUI.js.flow +2 -2
  24. package/esm/redux/_modularui/withModularUI.js.map +1 -1
  25. package/esm/redux/actions/Application.js +32 -4
  26. package/esm/redux/actions/Application.js.flow +34 -5
  27. package/esm/redux/actions/Application.js.map +1 -1
  28. package/esm/redux/actions/Authorization.js +20 -25
  29. package/esm/redux/actions/Authorization.js.flow +28 -29
  30. package/esm/redux/actions/Authorization.js.map +1 -1
  31. package/esm/redux/actions/Error.js +2 -0
  32. package/esm/redux/actions/Error.js.flow +5 -4
  33. package/esm/redux/actions/Error.js.map +1 -1
  34. package/esm/redux/actions/Form.js.flow +1 -1
  35. package/esm/redux/actions/Form.js.map +1 -1
  36. package/esm/redux/actions/FormAttributeSet.js.flow +1 -1
  37. package/esm/redux/actions/FormAttributeSet.js.map +1 -1
  38. package/esm/redux/actions/FormAutosave.js.flow +1 -1
  39. package/esm/redux/actions/FormAutosave.js.map +1 -1
  40. package/esm/redux/actions/FormAutosubmit.js.flow +1 -1
  41. package/esm/redux/actions/FormAutosubmit.js.map +1 -1
  42. package/esm/redux/actions/FormAutoupdate.js.flow +1 -1
  43. package/esm/redux/actions/FormAutoupdate.js.map +1 -1
  44. package/esm/redux/actions/FormValidations.js.flow +1 -1
  45. package/esm/redux/actions/FormValidations.js.map +1 -1
  46. package/esm/redux/actions/Notification.js.flow +3 -3
  47. package/esm/redux/actions/Notification.js.map +1 -1
  48. package/esm/redux/actions/SignIn.js +2 -4
  49. package/esm/redux/actions/SignIn.js.flow +4 -7
  50. package/esm/redux/actions/SignIn.js.map +1 -1
  51. package/esm/redux/actions/SignOut.js.flow +1 -1
  52. package/esm/redux/actions/SignOut.js.map +1 -1
  53. package/esm/redux/actions/__tests__/Application.spec.js.flow +67 -29
  54. package/esm/redux/actions/__tests__/Authorization.spec.js.flow +77 -83
  55. package/esm/redux/connectors/Form.js.flow +2 -2
  56. package/esm/redux/connectors/Form.js.map +1 -1
  57. package/esm/redux/connectors/FormAttributeSet.js.flow +2 -5
  58. package/esm/redux/connectors/FormAttributeSet.js.map +1 -1
  59. package/esm/redux/connectors/Progress.js.flow +1 -1
  60. package/esm/redux/connectors/Progress.js.map +1 -1
  61. package/esm/redux/connectors/SignIn.js.flow +1 -1
  62. package/esm/redux/connectors/SignIn.js.map +1 -1
  63. package/esm/redux/connectors/SignOut.js.flow +1 -1
  64. package/esm/redux/connectors/SignOut.js.map +1 -1
  65. package/esm/redux/store/configureStore.js +5 -1
  66. package/esm/redux/store/configureStore.js.flow +10 -1
  67. package/esm/redux/store/configureStore.js.map +1 -1
  68. package/esm/redux/types.js.flow +24 -5
  69. package/esm/redux/types.js.map +1 -1
  70. package/lib/hooks/useAuthentication.js +14 -8
  71. package/lib/hooks/useAuthentication.js.map +1 -1
  72. package/lib/hooks/useModularUI.js +1 -1
  73. package/lib/hooks/useModularUI.js.map +1 -1
  74. package/lib/models/filters/RangeFilterModel.js +1 -1
  75. package/lib/models/filters/RangeFilterModel.js.map +1 -1
  76. package/lib/redux/_i18n/I18nActions.js.map +1 -1
  77. package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
  78. package/lib/redux/_modularui/ModularUIConnector.js +2 -2
  79. package/lib/redux/_modularui/ModularUIConnector.js.map +1 -1
  80. package/lib/redux/_modularui/ModularUISelectors.js +12 -18
  81. package/lib/redux/_modularui/ModularUISelectors.js.map +1 -1
  82. package/lib/redux/_modularui/withModularUI.js.map +1 -1
  83. package/lib/redux/actions/Application.js +33 -4
  84. package/lib/redux/actions/Application.js.map +1 -1
  85. package/lib/redux/actions/Authorization.js +20 -25
  86. package/lib/redux/actions/Authorization.js.map +1 -1
  87. package/lib/redux/actions/Error.js +2 -0
  88. package/lib/redux/actions/Error.js.map +1 -1
  89. package/lib/redux/actions/Form.js.map +1 -1
  90. package/lib/redux/actions/FormAttributeSet.js.map +1 -1
  91. package/lib/redux/actions/FormAutosave.js.map +1 -1
  92. package/lib/redux/actions/FormAutosubmit.js.map +1 -1
  93. package/lib/redux/actions/FormAutoupdate.js.map +1 -1
  94. package/lib/redux/actions/FormValidations.js.map +1 -1
  95. package/lib/redux/actions/Notification.js.map +1 -1
  96. package/lib/redux/actions/SignIn.js +2 -4
  97. package/lib/redux/actions/SignIn.js.map +1 -1
  98. package/lib/redux/actions/SignOut.js.map +1 -1
  99. package/lib/redux/connectors/Form.js.map +1 -1
  100. package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
  101. package/lib/redux/connectors/Progress.js.map +1 -1
  102. package/lib/redux/connectors/SignIn.js.map +1 -1
  103. package/lib/redux/connectors/SignOut.js.map +1 -1
  104. package/lib/redux/store/configureStore.js +5 -1
  105. package/lib/redux/store/configureStore.js.map +1 -1
  106. package/lib/redux/types.js.map +1 -1
  107. package/package.json +11 -11
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  import configureMockStore from "redux-mock-store";
2
3
  import thunk from "redux-thunk";
3
4
  import { reloadApplication } from "../Application";
@@ -5,48 +6,85 @@ import { reloadApplication } from "../Application";
5
6
  import application from "../../../models/application/__mock__/application";
6
7
  import Href from "../../../models/href/Href";
7
8
 
8
- const middlewares = [thunk];
9
- const mockStore = configureMockStore(middlewares);
9
+ /**
10
+ * Setup Thunk Extra Argument with a mock subscribe.
11
+ */
12
+ const thunkExtra = {
13
+ subscribe: jest.fn((cb) => {
14
+ if (typeof cb === "function") {
15
+ setImmediate(cb);
16
+ }
17
+ return jest.fn();
18
+ }),
19
+ };
20
+
21
+ const middlewares = [thunk.withExtraArgument(thunkExtra)];
22
+
23
+ /**
24
+ * Cast the creator to 'any' to bypass the strict Dispatch
25
+ * definition in the redux-mock-store flow-typed file.
26
+ */
27
+ const mockStoreCreator: (state: Object) => any =
28
+ configureMockStore(middlewares);
10
29
 
11
30
  describe("application actions", () => {
31
+ beforeEach(() => {
32
+ jest.clearAllMocks();
33
+ });
34
+
12
35
  it("loads an application when no application exists", async () => {
13
36
  expect.assertions(1);
14
- const store = mockStore({ modularui: {}, i18n: { locale: "en" } });
37
+
38
+ // Use the casted creator here
39
+ const store = mockStoreCreator({
40
+ modularui: {
41
+ "application(/)(en)": { status: "FINISHED", model: application },
42
+ },
43
+ i18n: { locale: "en" },
44
+ });
15
45
 
16
46
  await store.dispatch(reloadApplication());
17
47
 
18
- expect(store.getActions()).toStrictEqual([
19
- { type: "START_PROGRESS" },
20
- expect.objectContaining({
21
- type: "MODULARUI/FETCH",
22
- payload: expect.objectContaining({
23
- key: "application(/)(en)",
24
- href: new Href("/", "Application"),
48
+ expect(store.getActions()).toEqual(
49
+ expect.arrayContaining([
50
+ { type: "START_PROGRESS" },
51
+ expect.objectContaining({
52
+ type: "MODULARUI/FETCH",
53
+ payload: expect.objectContaining({
54
+ key: "application(/)(en)",
55
+ href: new Href("/", "Application"),
56
+ }),
25
57
  }),
26
- }),
27
- { type: "FINISH_PROGRESS" },
28
- ]);
58
+ ]),
59
+ );
29
60
  });
30
61
 
31
- it("no reloads when application exists", () => {
32
- const store = mockStore({
33
- modularui: { "/": { connectKey: "/", model: application } },
62
+ it("no reloads when application exists", async () => {
63
+ // Use the casted creator here
64
+ const store = mockStoreCreator({
65
+ modularui: {
66
+ "/": { connectKey: "/", model: application },
67
+ "application(/)(en)": { status: "FINISHED", model: application },
68
+ },
69
+ i18n: { locale: "en" },
34
70
  });
35
71
 
36
- store.dispatch(reloadApplication());
72
+ await store.dispatch(reloadApplication());
37
73
 
38
- expect(store.getActions()).toStrictEqual([
39
- {
40
- type: "MODULARUI/REMOVE_KEY",
41
- payload: "/",
42
- },
43
- { type: "START_PROGRESS" },
44
- expect.objectContaining({
45
- type: "MODULARUI/FETCH",
46
- payload: expect.objectContaining({
47
- href: new Href("/", "Application"),
74
+ expect(store.getActions()).toEqual(
75
+ expect.arrayContaining([
76
+ expect.objectContaining({
77
+ type: "MODULARUI/REMOVE_KEY",
78
+ payload: "/",
79
+ }),
80
+ { type: "START_PROGRESS" },
81
+ expect.objectContaining({
82
+ type: "MODULARUI/FETCH",
83
+ payload: expect.objectContaining({
84
+ href: new Href("/", "Application"),
85
+ }),
48
86
  }),
49
- }),
50
- ]);
87
+ ]),
88
+ );
51
89
  });
52
90
  });
@@ -1,121 +1,115 @@
1
+ // @flow
1
2
  import configureMockStore from "redux-mock-store";
2
3
  import thunk from "redux-thunk";
3
4
  import { handleUnauthorized } from "../Authorization";
4
5
 
5
6
  import application from "../../../models/application/__mock__/application";
6
- import Href from "../../../models/href/Href";
7
7
  import { MODULARUI_STATUS } from "../../../constants";
8
8
  import { ErrorResponse } from "../../../models";
9
9
  import { Cache } from "../../../utils";
10
10
 
11
- const middlewares = [thunk];
12
- const mockStore = configureMockStore(middlewares);
11
+ const thunkExtra = {
12
+ subscribe: jest.fn((cb) => {
13
+ if (typeof cb === "function") {
14
+ setImmediate(cb);
15
+ }
16
+ return jest.fn();
17
+ }),
18
+ };
19
+
20
+ const middlewares = [thunk.withExtraArgument(thunkExtra)];
21
+
22
+ /**
23
+ * We cast the creator to 'any' then to a function that returns 'any'
24
+ * to bypass the strict Dispatch definition in the redux-mock-store flow-typed file.
25
+ */
26
+ const mockStoreCreator: (state: Object) => any =
27
+ configureMockStore(middlewares);
13
28
 
14
29
  describe("authorization actions", () => {
15
- it("handle unauthorized with application present when logged in", () => {
30
+ beforeEach(() => {
31
+ jest.clearAllMocks();
32
+ Cache.removeItem("auth");
33
+ });
34
+
35
+ it("handle unauthorized with application present when logged in", async () => {
36
+ const connectKey = "application(/)(en)";
16
37
  Cache.setItem("auth", true);
17
- application.connectKey = "/";
18
- const store = mockStore({
38
+
39
+ const store = mockStoreCreator({
19
40
  modularui: {
20
- "/": {
21
- connectKey: "/",
41
+ [connectKey]: {
42
+ connectKey: connectKey,
22
43
  model: application,
23
44
  status: MODULARUI_STATUS.FINISHED,
24
45
  },
25
46
  },
26
- router: {},
47
+ router: { location: { pathname: "/current-page" } },
48
+ i18n: { locale: "en" },
27
49
  });
28
50
 
29
51
  const errorResponse = new ErrorResponse(
30
- {
31
- id: "Error.Authentication.InvalidUsername",
32
- },
33
- "/",
52
+ { id: "Error.Authentication.InvalidUsername" },
53
+ connectKey,
34
54
  );
35
- store.dispatch(handleUnauthorized(errorResponse));
36
55
 
37
- expect(store.getActions()).toStrictEqual([
38
- {
39
- type: "MODULARUI/REMOVE_KEY",
40
- payload: "/",
41
- },
42
- {
43
- type: "MODULARUI/REMOVE_KEY",
44
- payload: "/",
45
- },
46
- {
47
- type: "START_PROGRESS",
48
- },
49
- {
50
- type: "MODULARUI/FETCH",
51
- payload: expect.objectContaining({
52
- href: new Href("/", "Application"),
53
- }),
54
- },
55
- {
56
- type: "AUTHENTICATION_LOGOUT",
57
- },
58
- {
59
- type: "AUTHENTICATION_ERROR",
60
- payload: "Error.Authentication.InvalidUsername",
61
- },
62
- {
63
- type: "ROUTER/REPLACE",
64
- payload: {
65
- location: "/signin",
66
- state: {
67
- from: undefined,
68
- modal: false,
69
- },
70
- },
71
- },
72
- ]);
56
+ await store.dispatch(handleUnauthorized(errorResponse));
57
+
58
+ const actions = store.getActions();
59
+
60
+ expect(actions).toEqual(
61
+ expect.arrayContaining([
62
+ { type: "MODULARUI/REMOVE_KEY", payload: connectKey },
63
+ { type: "START_PROGRESS" },
64
+ { type: "AUTHENTICATION_LOGOUT" },
65
+ ]),
66
+ );
73
67
  });
74
68
 
75
- it("handle unauthorized with application present when logged out", () => {
76
- Cache.removeItem("auth");
77
- application.connectKey = "/";
78
- const store = mockStore({
69
+ it("handle unauthorized when no auth cache and logged out", async () => {
70
+ const store = mockStoreCreator({
79
71
  modularui: {
80
72
  "/": {
81
73
  connectKey: "/",
82
- model: application,
74
+ model: { ...application, isLoggedIn: false },
83
75
  status: MODULARUI_STATUS.FINISHED,
84
76
  },
85
77
  },
86
- router: {},
78
+ router: { location: { pathname: "/dashboard" } },
79
+ i18n: { locale: "en" },
87
80
  });
88
81
 
89
82
  const errorResponse = new ErrorResponse(
90
- {
91
- id: "Error.Authentication.InvalidUsername",
92
- },
83
+ { id: "Error.Authentication.InvalidUsername" },
93
84
  "/",
94
85
  );
95
- store.dispatch(handleUnauthorized(errorResponse));
96
86
 
97
- expect(store.getActions()).toStrictEqual([
98
- {
99
- type: "MODULARUI/REMOVE_KEY",
100
- payload: "/",
101
- },
102
- {
103
- type: "AUTHENTICATION_LOGOUT",
104
- },
105
- {
106
- type: "AUTHENTICATION_ERROR",
107
- payload: "Error.Authentication.InvalidUsername",
108
- },
109
- {
110
- type: "ROUTER/REPLACE",
111
- payload: {
112
- location: "/signin",
113
- state: {
114
- from: undefined,
115
- modal: false,
116
- },
117
- },
118
- },
119
- ]);
87
+ await store.dispatch(handleUnauthorized(errorResponse));
88
+
89
+ expect(store.getActions()).toEqual(
90
+ expect.arrayContaining([{ type: "AUTHENTICATION_LOGOUT" }]),
91
+ );
92
+ });
93
+
94
+ it("adds current location to 'from' state during redirect", async () => {
95
+ const currentLocation = { pathname: "/orders", search: "?id=1" };
96
+ const store = mockStoreCreator({
97
+ modularui: {},
98
+ router: { location: currentLocation },
99
+ i18n: { locale: "en" },
100
+ });
101
+
102
+ // Fix: ErrorResponse expects string or undefined, not null
103
+ const errorResponse = new ErrorResponse({ id: "ERR" }, undefined);
104
+
105
+ await store.dispatch(handleUnauthorized(errorResponse));
106
+
107
+ const actions = store.getActions();
108
+ // Fix: Cast the found action to ReplaceAction to allow .payload access
109
+ const replaceAction = (actions.find(
110
+ (a) => typeof a === "object" && a.type === "ROUTER/REPLACE",
111
+ ): any);
112
+
113
+ expect(replaceAction?.payload.state.from).toEqual(currentLocation);
120
114
  });
121
115
  });
@@ -31,8 +31,8 @@ type StateProps = {
31
31
 
32
32
  type DispatchProps = {
33
33
  onPrevious: (form: FormModel) => UpdateFormAction,
34
- onCancel: (form: FormModel) => ThunkAction,
35
- showFormNotification: (form: FormModel) => ThunkAction,
34
+ onCancel: (form: FormModel) => ThunkAction<>,
35
+ showFormNotification: (form: FormModel) => ThunkAction<>,
36
36
  };
37
37
 
38
38
  type Props = {
@@ -1 +1 @@
1
- {"version":3,"file":"Form.js","names":["compose","connect","modularui","HTTP_METHODS","getSetting","cancelForm","previousObject","showFormNotification","Href","mapStateToProps","state","ownProps","isModal","router","location","modal","mapDispatchToProps","onPrevious","onCancel","reduxConnectedForm","moduiConnectedForm","href","formHref","pathname","search","addParameter","propName","method","POST","connectForm"],"sources":["../../../src/redux/connectors/Form.js"],"sourcesContent":["// @flow\nimport { compose } from \"redux\";\nimport { connect } from \"react-redux\";\n\nimport modularui from \"../_modularui/ModularUIConnector\";\n\nimport { HTTP_METHODS } from \"../../constants/Constants\";\nimport { getSetting } from \"../../constants/Settings\";\n\nimport { cancelForm, previousObject } from \"../actions/Form\";\nimport { showFormNotification } from \"../actions/Notification\";\n\nimport Href from \"../../models/href/Href\";\n\nimport type { AbstractComponent } from \"react\";\nimport type FormModel from \"../../models/form/FormModel\";\nimport type { ContextRouter } from \"react-router\";\nimport type { ReduxState, ThunkAction } from \"../types\";\nimport type { ModularUIConnector, UpdateFormAction } from \"../_modularui/types\";\n\ntype OwnProps = {\n ...?ContextRouter,\n href?: Href,\n isModal?: boolean,\n redirectTo?: string,\n};\n\ntype StateProps = {\n isModal: boolean,\n};\n\ntype DispatchProps = {\n onPrevious: (form: FormModel) => UpdateFormAction,\n onCancel: (form: FormModel) => ThunkAction,\n showFormNotification: (form: FormModel) => ThunkAction,\n};\n\ntype Props = {\n ...OwnProps,\n ...StateProps,\n ...DispatchProps,\n};\n\nconst mapStateToProps = (\n state: ReduxState,\n ownProps: OwnProps,\n): StateProps => ({\n isModal: state.router.location?.state?.modal || ownProps.isModal || false,\n});\n\nconst mapDispatchToProps: DispatchProps = {\n onPrevious: previousObject,\n onCancel: cancelForm,\n showFormNotification,\n};\n\nconst reduxConnectedForm = connect<Props, OwnProps, StateProps, _, _, _>(\n mapStateToProps,\n mapDispatchToProps,\n);\n\nconst moduiConnectedForm: ModularUIConnector = modularui(\n \"Form\",\n ({ href, location }) => {\n const formHref = href || new Href(`${location.pathname}${location.search}`);\n\n if (getSetting(\"ALWAYS_COMMIT_FORM\")) {\n return formHref;\n }\n\n return formHref.addParameter(\"commit\", \"false\");\n },\n { propName: \"form\", method: HTTP_METHODS.POST },\n);\n\n/**\n * @deprecated - will be removed in the future, use the equivalent hook 'useForm' instead\n */\nexport const connectForm: (\n Component: AbstractComponent<Props>,\n) => AbstractComponent<OwnProps> = compose(\n moduiConnectedForm,\n reduxConnectedForm,\n);\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,OAAO,QAAQ,aAAa;AAErC,OAAOC,SAAS,MAAM,kCAAkC;AAExD,SAASC,YAAY,QAAQ,2BAA2B;AACxD,SAASC,UAAU,QAAQ,0BAA0B;AAErD,SAASC,UAAU,EAAEC,cAAc,QAAQ,iBAAiB;AAC5D,SAASC,oBAAoB,QAAQ,yBAAyB;AAE9D,OAAOC,IAAI,MAAM,wBAAwB;AA+BzC,MAAMC,eAAe,GAAGA,CACtBC,KAAiB,EACjBC,QAAkB,MACF;EAChBC,OAAO,EAAEF,KAAK,CAACG,MAAM,CAACC,QAAQ,EAAEJ,KAAK,EAAEK,KAAK,IAAIJ,QAAQ,CAACC,OAAO,IAAI;AACtE,CAAC,CAAC;AAEF,MAAMI,kBAAiC,GAAG;EACxCC,UAAU,EAAEX,cAAc;EAC1BY,QAAQ,EAAEb,UAAU;EACpBE;AACF,CAAC;AAED,MAAMY,kBAAkB,GAAGlB,OAAO,CAChCQ,eAAe,EACfO,kBACF,CAAC;AAED,MAAMI,kBAAsC,GAAGlB,SAAS,CACtD,MAAM,EACN,CAAC;EAAEmB,IAAI;EAAEP;AAAS,CAAC,KAAK;EACtB,MAAMQ,QAAQ,GAAGD,IAAI,IAAI,IAAIb,IAAI,CAAC,GAAGM,QAAQ,CAACS,QAAQ,GAAGT,QAAQ,CAACU,MAAM,EAAE,CAAC;EAE3E,IAAIpB,UAAU,CAAC,oBAAoB,CAAC,EAAE;IACpC,OAAOkB,QAAQ;EACjB;EAEA,OAAOA,QAAQ,CAACG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC;AACjD,CAAC,EACD;EAAEC,QAAQ,EAAE,MAAM;EAAEC,MAAM,EAAExB,YAAY,CAACyB;AAAK,CAChD,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,WAEmB,GAAG7B,OAAO,CACxCoB,kBAAkB,EAClBD,kBACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Form.js","names":["compose","connect","modularui","HTTP_METHODS","getSetting","cancelForm","previousObject","showFormNotification","Href","mapStateToProps","state","ownProps","isModal","router","location","modal","mapDispatchToProps","onPrevious","onCancel","reduxConnectedForm","moduiConnectedForm","href","formHref","pathname","search","addParameter","propName","method","POST","connectForm"],"sources":["../../../src/redux/connectors/Form.js"],"sourcesContent":["// @flow\nimport { compose } from \"redux\";\nimport { connect } from \"react-redux\";\n\nimport modularui from \"../_modularui/ModularUIConnector\";\n\nimport { HTTP_METHODS } from \"../../constants/Constants\";\nimport { getSetting } from \"../../constants/Settings\";\n\nimport { cancelForm, previousObject } from \"../actions/Form\";\nimport { showFormNotification } from \"../actions/Notification\";\n\nimport Href from \"../../models/href/Href\";\n\nimport type { AbstractComponent } from \"react\";\nimport type FormModel from \"../../models/form/FormModel\";\nimport type { ContextRouter } from \"react-router\";\nimport type { ReduxState, ThunkAction } from \"../types\";\nimport type { ModularUIConnector, UpdateFormAction } from \"../_modularui/types\";\n\ntype OwnProps = {\n ...?ContextRouter,\n href?: Href,\n isModal?: boolean,\n redirectTo?: string,\n};\n\ntype StateProps = {\n isModal: boolean,\n};\n\ntype DispatchProps = {\n onPrevious: (form: FormModel) => UpdateFormAction,\n onCancel: (form: FormModel) => ThunkAction<>,\n showFormNotification: (form: FormModel) => ThunkAction<>,\n};\n\ntype Props = {\n ...OwnProps,\n ...StateProps,\n ...DispatchProps,\n};\n\nconst mapStateToProps = (\n state: ReduxState,\n ownProps: OwnProps,\n): StateProps => ({\n isModal: state.router.location?.state?.modal || ownProps.isModal || false,\n});\n\nconst mapDispatchToProps: DispatchProps = {\n onPrevious: previousObject,\n onCancel: cancelForm,\n showFormNotification,\n};\n\nconst reduxConnectedForm = connect<Props, OwnProps, StateProps, _, _, _>(\n mapStateToProps,\n mapDispatchToProps,\n);\n\nconst moduiConnectedForm: ModularUIConnector = modularui(\n \"Form\",\n ({ href, location }) => {\n const formHref = href || new Href(`${location.pathname}${location.search}`);\n\n if (getSetting(\"ALWAYS_COMMIT_FORM\")) {\n return formHref;\n }\n\n return formHref.addParameter(\"commit\", \"false\");\n },\n { propName: \"form\", method: HTTP_METHODS.POST },\n);\n\n/**\n * @deprecated - will be removed in the future, use the equivalent hook 'useForm' instead\n */\nexport const connectForm: (\n Component: AbstractComponent<Props>,\n) => AbstractComponent<OwnProps> = compose(\n moduiConnectedForm,\n reduxConnectedForm,\n);\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,OAAO,QAAQ,aAAa;AAErC,OAAOC,SAAS,MAAM,kCAAkC;AAExD,SAASC,YAAY,QAAQ,2BAA2B;AACxD,SAASC,UAAU,QAAQ,0BAA0B;AAErD,SAASC,UAAU,EAAEC,cAAc,QAAQ,iBAAiB;AAC5D,SAASC,oBAAoB,QAAQ,yBAAyB;AAE9D,OAAOC,IAAI,MAAM,wBAAwB;AA+BzC,MAAMC,eAAe,GAAGA,CACtBC,KAAiB,EACjBC,QAAkB,MACF;EAChBC,OAAO,EAAEF,KAAK,CAACG,MAAM,CAACC,QAAQ,EAAEJ,KAAK,EAAEK,KAAK,IAAIJ,QAAQ,CAACC,OAAO,IAAI;AACtE,CAAC,CAAC;AAEF,MAAMI,kBAAiC,GAAG;EACxCC,UAAU,EAAEX,cAAc;EAC1BY,QAAQ,EAAEb,UAAU;EACpBE;AACF,CAAC;AAED,MAAMY,kBAAkB,GAAGlB,OAAO,CAChCQ,eAAe,EACfO,kBACF,CAAC;AAED,MAAMI,kBAAsC,GAAGlB,SAAS,CACtD,MAAM,EACN,CAAC;EAAEmB,IAAI;EAAEP;AAAS,CAAC,KAAK;EACtB,MAAMQ,QAAQ,GAAGD,IAAI,IAAI,IAAIb,IAAI,CAAC,GAAGM,QAAQ,CAACS,QAAQ,GAAGT,QAAQ,CAACU,MAAM,EAAE,CAAC;EAE3E,IAAIpB,UAAU,CAAC,oBAAoB,CAAC,EAAE;IACpC,OAAOkB,QAAQ;EACjB;EAEA,OAAOA,QAAQ,CAACG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC;AACjD,CAAC,EACD;EAAEC,QAAQ,EAAE,MAAM;EAAEC,MAAM,EAAExB,YAAY,CAACyB;AAAK,CAChD,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,WAEmB,GAAG7B,OAAO,CACxCoB,kBAAkB,EAClBD,kBACF,CAAC","ignoreList":[]}
@@ -8,16 +8,13 @@ import {
8
8
  removeRepeatableAttributeSet,
9
9
  } from "../actions/FormAttributeSetRepeatable";
10
10
 
11
- import type { ThunkAction, UpdateFormOptions } from "../types";
11
+ import type { ThunkAction, UpdateFormOptions, Dispatch } from "../types";
12
12
  import type { UpdateFormAction } from "../_modularui/types";
13
13
  import type { AttributeType } from "../../models/types";
14
14
  import type FormModel from "../../models/form/FormModel";
15
15
  import type FormObjectModel from "../../models/form/FormObjectModel";
16
- import type { DispatchAPI } from "redux";
17
16
  import type { ComponentType } from "react";
18
17
 
19
- type Dispatch = DispatchAPI<UpdateFormAction> & DispatchAPI<ThunkAction>;
20
-
21
18
  type OwnProps = {
22
19
  form: FormModel,
23
20
  object: FormObjectModel,
@@ -32,7 +29,7 @@ type DispatchProps = {
32
29
  attribute: AttributeType,
33
30
  value: string,
34
31
  options: UpdateFormOptions,
35
- ) => ThunkAction,
32
+ ) => ThunkAction<>,
36
33
  onAddAttributeSetClick: () => UpdateFormAction,
37
34
  onCancelAttributeSetClick: (formObject: FormObjectModel) => UpdateFormAction,
38
35
  onRemoveAttributeSetClick: (formObject: FormObjectModel) => UpdateFormAction,
@@ -1 +1 @@
1
- {"version":3,"file":"FormAttributeSet.js","names":["connect","updateFormAttribute","addRepeatableAttributeSet","cancelRepeatableAttributeSet","removeRepeatableAttributeSet","mapDispatchToProps","dispatch","ownProps","onAttributeChange","attribute","value","options","autosubmit","autosave","autoupdate","form","object","onAddAttributeSetClick","onCancelAttributeSetClick","formObject","onRemoveAttributeSetClick","connectFormAttributeSet"],"sources":["../../../src/redux/connectors/FormAttributeSet.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { updateFormAttribute } from \"../actions/FormAttributeSet\";\nimport {\n addRepeatableAttributeSet,\n cancelRepeatableAttributeSet,\n removeRepeatableAttributeSet,\n} from \"../actions/FormAttributeSetRepeatable\";\n\nimport type { ThunkAction, UpdateFormOptions } from \"../types\";\nimport type { UpdateFormAction } from \"../_modularui/types\";\nimport type { AttributeType } from \"../../models/types\";\nimport type FormModel from \"../../models/form/FormModel\";\nimport type FormObjectModel from \"../../models/form/FormObjectModel\";\nimport type { DispatchAPI } from \"redux\";\nimport type { ComponentType } from \"react\";\n\ntype Dispatch = DispatchAPI<UpdateFormAction> & DispatchAPI<ThunkAction>;\n\ntype OwnProps = {\n form: FormModel,\n object: FormObjectModel,\n formLayout?: \"vertical\" | \"horizontal\" | \"compact\",\n autosubmit?: boolean,\n autosave?: boolean,\n autoupdate?: boolean,\n};\n\ntype DispatchProps = {\n onAttributeChange: (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions,\n ) => ThunkAction,\n onAddAttributeSetClick: () => UpdateFormAction,\n onCancelAttributeSetClick: (formObject: FormObjectModel) => UpdateFormAction,\n onRemoveAttributeSetClick: (formObject: FormObjectModel) => UpdateFormAction,\n};\n\ntype Props = {\n ...OwnProps,\n ...DispatchProps,\n};\n\nconst mapDispatchToProps = (\n dispatch: Dispatch,\n ownProps: OwnProps,\n): DispatchProps => ({\n onAttributeChange: (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions = {\n autosubmit: ownProps.autosubmit ?? false,\n autosave: ownProps.autosave ?? false,\n autoupdate: ownProps.autoupdate ?? false,\n },\n ) =>\n dispatch(\n updateFormAttribute(\n ownProps.form,\n ownProps.object,\n attribute,\n value,\n options,\n ),\n ),\n onAddAttributeSetClick: () =>\n dispatch(addRepeatableAttributeSet(ownProps.form)),\n onCancelAttributeSetClick: (formObject: FormObjectModel) =>\n dispatch(cancelRepeatableAttributeSet(ownProps.form, formObject)),\n onRemoveAttributeSetClick: (formObject: FormObjectModel) =>\n dispatch(removeRepeatableAttributeSet(ownProps.form, formObject)),\n});\n\n/**\n * @deprecated - will be removed in the future, use the equivalent hook 'useAttributeSet' or 'useFormNavigation' instead\n */\nexport const connectFormAttributeSet: ComponentType<any> = connect<\n Props,\n OwnProps,\n _,\n DispatchProps,\n _,\n _,\n>(null, mapDispatchToProps);\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,aAAa;AAErC,SAASC,mBAAmB,QAAQ,6BAA6B;AACjE,SACEC,yBAAyB,EACzBC,4BAA4B,EAC5BC,4BAA4B,QACvB,uCAAuC;AAqC9C,MAAMC,kBAAkB,GAAGA,CACzBC,QAAkB,EAClBC,QAAkB,MACC;EACnBC,iBAAiB,EAAEA,CACjBC,SAAwB,EACxBC,KAAa,EACbC,OAA0B,GAAG;IAC3BC,UAAU,EAAEL,QAAQ,CAACK,UAAU,IAAI,KAAK;IACxCC,QAAQ,EAAEN,QAAQ,CAACM,QAAQ,IAAI,KAAK;IACpCC,UAAU,EAAEP,QAAQ,CAACO,UAAU,IAAI;EACrC,CAAC,KAEDR,QAAQ,CACNL,mBAAmB,CACjBM,QAAQ,CAACQ,IAAI,EACbR,QAAQ,CAACS,MAAM,EACfP,SAAS,EACTC,KAAK,EACLC,OACF,CACF,CAAC;EACHM,sBAAsB,EAAEA,CAAA,KACtBX,QAAQ,CAACJ,yBAAyB,CAACK,QAAQ,CAACQ,IAAI,CAAC,CAAC;EACpDG,yBAAyB,EAAGC,UAA2B,IACrDb,QAAQ,CAACH,4BAA4B,CAACI,QAAQ,CAACQ,IAAI,EAAEI,UAAU,CAAC,CAAC;EACnEC,yBAAyB,EAAGD,UAA2B,IACrDb,QAAQ,CAACF,4BAA4B,CAACG,QAAQ,CAACQ,IAAI,EAAEI,UAAU,CAAC;AACpE,CAAC,CAAC;;AAEF;AACA;AACA;AACA,OAAO,MAAME,uBAA2C,GAAGrB,OAAO,CAOhE,IAAI,EAAEK,kBAAkB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"FormAttributeSet.js","names":["connect","updateFormAttribute","addRepeatableAttributeSet","cancelRepeatableAttributeSet","removeRepeatableAttributeSet","mapDispatchToProps","dispatch","ownProps","onAttributeChange","attribute","value","options","autosubmit","autosave","autoupdate","form","object","onAddAttributeSetClick","onCancelAttributeSetClick","formObject","onRemoveAttributeSetClick","connectFormAttributeSet"],"sources":["../../../src/redux/connectors/FormAttributeSet.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { updateFormAttribute } from \"../actions/FormAttributeSet\";\nimport {\n addRepeatableAttributeSet,\n cancelRepeatableAttributeSet,\n removeRepeatableAttributeSet,\n} from \"../actions/FormAttributeSetRepeatable\";\n\nimport type { ThunkAction, UpdateFormOptions, Dispatch } from \"../types\";\nimport type { UpdateFormAction } from \"../_modularui/types\";\nimport type { AttributeType } from \"../../models/types\";\nimport type FormModel from \"../../models/form/FormModel\";\nimport type FormObjectModel from \"../../models/form/FormObjectModel\";\nimport type { ComponentType } from \"react\";\n\ntype OwnProps = {\n form: FormModel,\n object: FormObjectModel,\n formLayout?: \"vertical\" | \"horizontal\" | \"compact\",\n autosubmit?: boolean,\n autosave?: boolean,\n autoupdate?: boolean,\n};\n\ntype DispatchProps = {\n onAttributeChange: (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions,\n ) => ThunkAction<>,\n onAddAttributeSetClick: () => UpdateFormAction,\n onCancelAttributeSetClick: (formObject: FormObjectModel) => UpdateFormAction,\n onRemoveAttributeSetClick: (formObject: FormObjectModel) => UpdateFormAction,\n};\n\ntype Props = {\n ...OwnProps,\n ...DispatchProps,\n};\n\nconst mapDispatchToProps = (\n dispatch: Dispatch,\n ownProps: OwnProps,\n): DispatchProps => ({\n onAttributeChange: (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions = {\n autosubmit: ownProps.autosubmit ?? false,\n autosave: ownProps.autosave ?? false,\n autoupdate: ownProps.autoupdate ?? false,\n },\n ) =>\n dispatch(\n updateFormAttribute(\n ownProps.form,\n ownProps.object,\n attribute,\n value,\n options,\n ),\n ),\n onAddAttributeSetClick: () =>\n dispatch(addRepeatableAttributeSet(ownProps.form)),\n onCancelAttributeSetClick: (formObject: FormObjectModel) =>\n dispatch(cancelRepeatableAttributeSet(ownProps.form, formObject)),\n onRemoveAttributeSetClick: (formObject: FormObjectModel) =>\n dispatch(removeRepeatableAttributeSet(ownProps.form, formObject)),\n});\n\n/**\n * @deprecated - will be removed in the future, use the equivalent hook 'useAttributeSet' or 'useFormNavigation' instead\n */\nexport const connectFormAttributeSet: ComponentType<any> = connect<\n Props,\n OwnProps,\n _,\n DispatchProps,\n _,\n _,\n>(null, mapDispatchToProps);\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,aAAa;AAErC,SAASC,mBAAmB,QAAQ,6BAA6B;AACjE,SACEC,yBAAyB,EACzBC,4BAA4B,EAC5BC,4BAA4B,QACvB,uCAAuC;AAkC9C,MAAMC,kBAAkB,GAAGA,CACzBC,QAAkB,EAClBC,QAAkB,MACC;EACnBC,iBAAiB,EAAEA,CACjBC,SAAwB,EACxBC,KAAa,EACbC,OAA0B,GAAG;IAC3BC,UAAU,EAAEL,QAAQ,CAACK,UAAU,IAAI,KAAK;IACxCC,QAAQ,EAAEN,QAAQ,CAACM,QAAQ,IAAI,KAAK;IACpCC,UAAU,EAAEP,QAAQ,CAACO,UAAU,IAAI;EACrC,CAAC,KAEDR,QAAQ,CACNL,mBAAmB,CACjBM,QAAQ,CAACQ,IAAI,EACbR,QAAQ,CAACS,MAAM,EACfP,SAAS,EACTC,KAAK,EACLC,OACF,CACF,CAAC;EACHM,sBAAsB,EAAEA,CAAA,KACtBX,QAAQ,CAACJ,yBAAyB,CAACK,QAAQ,CAACQ,IAAI,CAAC,CAAC;EACpDG,yBAAyB,EAAGC,UAA2B,IACrDb,QAAQ,CAACH,4BAA4B,CAACI,QAAQ,CAACQ,IAAI,EAAEI,UAAU,CAAC,CAAC;EACnEC,yBAAyB,EAAGD,UAA2B,IACrDb,QAAQ,CAACF,4BAA4B,CAACG,QAAQ,CAACQ,IAAI,EAAEI,UAAU,CAAC;AACpE,CAAC,CAAC;;AAEF;AACA;AACA;AACA,OAAO,MAAME,uBAA2C,GAAGrB,OAAO,CAOhE,IAAI,EAAEK,kBAAkB,CAAC","ignoreList":[]}
@@ -14,7 +14,7 @@ import type { ComponentType } from "react";
14
14
  type DispatchProps = {
15
15
  onStartProgress: () => StartProgressAction,
16
16
  onFinishProgress: () => FinishProgressAction,
17
- onError: (error: Error | FetchException) => ThunkAction,
17
+ onError: (error: Error | FetchException) => ThunkAction<>,
18
18
  };
19
19
 
20
20
  const mapDispatchToProps: DispatchProps = {
@@ -1 +1 @@
1
- {"version":3,"file":"Progress.js","names":["connect","finishProgress","startProgress","handleError","mapDispatchToProps","onStartProgress","onFinishProgress","onError","connectProgress"],"sources":["../../../src/redux/connectors/Progress.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\nimport { finishProgress, startProgress } from \"../actions/ProgressIndicator\";\nimport { handleError } from \"../actions/Error\";\n\nimport type {\n StartProgressAction,\n FinishProgressAction,\n ThunkAction,\n} from \"../types\";\nimport type FetchException from \"../../exceptions/FetchException\";\nimport type { ComponentType } from \"react\";\n\ntype DispatchProps = {\n onStartProgress: () => StartProgressAction,\n onFinishProgress: () => FinishProgressAction,\n onError: (error: Error | FetchException) => ThunkAction,\n};\n\nconst mapDispatchToProps: DispatchProps = {\n onStartProgress: startProgress,\n onFinishProgress: finishProgress,\n onError: handleError,\n};\n\n/**\n * @deprecated - will be removed in the future, use the equivalent hook 'useProgressIndicator' instead\n */\nexport const connectProgress: ComponentType<any> = connect<\n DispatchProps,\n {},\n _,\n _,\n _,\n _,\n>(null, mapDispatchToProps);\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,aAAa;AACrC,SAASC,cAAc,EAAEC,aAAa,QAAQ,8BAA8B;AAC5E,SAASC,WAAW,QAAQ,kBAAkB;AAgB9C,MAAMC,kBAAiC,GAAG;EACxCC,eAAe,EAAEH,aAAa;EAC9BI,gBAAgB,EAAEL,cAAc;EAChCM,OAAO,EAAEJ;AACX,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMK,eAAmC,GAAGR,OAAO,CAOxD,IAAI,EAAEI,kBAAkB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Progress.js","names":["connect","finishProgress","startProgress","handleError","mapDispatchToProps","onStartProgress","onFinishProgress","onError","connectProgress"],"sources":["../../../src/redux/connectors/Progress.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\nimport { finishProgress, startProgress } from \"../actions/ProgressIndicator\";\nimport { handleError } from \"../actions/Error\";\n\nimport type {\n StartProgressAction,\n FinishProgressAction,\n ThunkAction,\n} from \"../types\";\nimport type FetchException from \"../../exceptions/FetchException\";\nimport type { ComponentType } from \"react\";\n\ntype DispatchProps = {\n onStartProgress: () => StartProgressAction,\n onFinishProgress: () => FinishProgressAction,\n onError: (error: Error | FetchException) => ThunkAction<>,\n};\n\nconst mapDispatchToProps: DispatchProps = {\n onStartProgress: startProgress,\n onFinishProgress: finishProgress,\n onError: handleError,\n};\n\n/**\n * @deprecated - will be removed in the future, use the equivalent hook 'useProgressIndicator' instead\n */\nexport const connectProgress: ComponentType<any> = connect<\n DispatchProps,\n {},\n _,\n _,\n _,\n _,\n>(null, mapDispatchToProps);\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,aAAa;AACrC,SAASC,cAAc,EAAEC,aAAa,QAAQ,8BAA8B;AAC5E,SAASC,WAAW,QAAQ,kBAAkB;AAgB9C,MAAMC,kBAAiC,GAAG;EACxCC,eAAe,EAAEH,aAAa;EAC9BI,gBAAgB,EAAEL,cAAc;EAChCM,OAAO,EAAEJ;AACX,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMK,eAAmC,GAAGR,OAAO,CAOxD,IAAI,EAAEI,kBAAkB,CAAC","ignoreList":[]}
@@ -14,7 +14,7 @@ type StateProps = {
14
14
  };
15
15
 
16
16
  type DispatchProps = {
17
- onSubmit: (username: string, password: string) => ThunkAction,
17
+ onSubmit: (username: string, password: string) => ThunkAction<>,
18
18
  };
19
19
 
20
20
  type Props = {
@@ -1 +1 @@
1
- {"version":3,"file":"SignIn.js","names":["connect","login","getApplication","mapStateToProps","state","application","isAuthenticated","isLoggedIn","errorMessage","auth","error","mapDispatchToProps","onSubmit","connectSignIn"],"sources":["../../../src/redux/connectors/SignIn.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { login } from \"../actions/SignIn\";\n\nimport { getApplication } from \"../_modularui/ModularUISelectors\";\n\nimport type { ReduxState, ThunkAction } from \"../types\";\nimport type { ComponentType } from \"react\";\n\ntype StateProps = {\n isAuthenticated: boolean,\n errorMessage: ?string,\n};\n\ntype DispatchProps = {\n onSubmit: (username: string, password: string) => ThunkAction,\n};\n\ntype Props = {\n ...StateProps,\n ...DispatchProps,\n};\n\nconst mapStateToProps = (state: ReduxState): StateProps => {\n const application = getApplication(state);\n\n return {\n isAuthenticated: application?.isLoggedIn ?? false,\n errorMessage: state.auth.error,\n };\n};\n\nconst mapDispatchToProps: DispatchProps = {\n onSubmit: login,\n};\n\n/**\n * @deprecated - will be removed in the future, use the equivalent hook 'useLogin' instead\n */\nexport const connectSignIn: ComponentType<any> = connect<\n Props,\n {},\n StateProps,\n _,\n _,\n _,\n>(mapStateToProps, mapDispatchToProps);\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,aAAa;AAErC,SAASC,KAAK,QAAQ,mBAAmB;AAEzC,SAASC,cAAc,QAAQ,kCAAkC;AAmBjE,MAAMC,eAAe,GAAIC,KAAiB,IAAiB;EACzD,MAAMC,WAAW,GAAGH,cAAc,CAACE,KAAK,CAAC;EAEzC,OAAO;IACLE,eAAe,EAAED,WAAW,EAAEE,UAAU,IAAI,KAAK;IACjDC,YAAY,EAAEJ,KAAK,CAACK,IAAI,CAACC;EAC3B,CAAC;AACH,CAAC;AAED,MAAMC,kBAAiC,GAAG;EACxCC,QAAQ,EAAEX;AACZ,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMY,aAAiC,GAAGb,OAAO,CAOtDG,eAAe,EAAEQ,kBAAkB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"SignIn.js","names":["connect","login","getApplication","mapStateToProps","state","application","isAuthenticated","isLoggedIn","errorMessage","auth","error","mapDispatchToProps","onSubmit","connectSignIn"],"sources":["../../../src/redux/connectors/SignIn.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { login } from \"../actions/SignIn\";\n\nimport { getApplication } from \"../_modularui/ModularUISelectors\";\n\nimport type { ReduxState, ThunkAction } from \"../types\";\nimport type { ComponentType } from \"react\";\n\ntype StateProps = {\n isAuthenticated: boolean,\n errorMessage: ?string,\n};\n\ntype DispatchProps = {\n onSubmit: (username: string, password: string) => ThunkAction<>,\n};\n\ntype Props = {\n ...StateProps,\n ...DispatchProps,\n};\n\nconst mapStateToProps = (state: ReduxState): StateProps => {\n const application = getApplication(state);\n\n return {\n isAuthenticated: application?.isLoggedIn ?? false,\n errorMessage: state.auth.error,\n };\n};\n\nconst mapDispatchToProps: DispatchProps = {\n onSubmit: login,\n};\n\n/**\n * @deprecated - will be removed in the future, use the equivalent hook 'useLogin' instead\n */\nexport const connectSignIn: ComponentType<any> = connect<\n Props,\n {},\n StateProps,\n _,\n _,\n _,\n>(mapStateToProps, mapDispatchToProps);\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,aAAa;AAErC,SAASC,KAAK,QAAQ,mBAAmB;AAEzC,SAASC,cAAc,QAAQ,kCAAkC;AAmBjE,MAAMC,eAAe,GAAIC,KAAiB,IAAiB;EACzD,MAAMC,WAAW,GAAGH,cAAc,CAACE,KAAK,CAAC;EAEzC,OAAO;IACLE,eAAe,EAAED,WAAW,EAAEE,UAAU,IAAI,KAAK;IACjDC,YAAY,EAAEJ,KAAK,CAACK,IAAI,CAACC;EAC3B,CAAC;AACH,CAAC;AAED,MAAMC,kBAAiC,GAAG;EACxCC,QAAQ,EAAEX;AACZ,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMY,aAAiC,GAAGb,OAAO,CAOtDG,eAAe,EAAEQ,kBAAkB,CAAC","ignoreList":[]}
@@ -12,7 +12,7 @@ type StateProps = {
12
12
  };
13
13
 
14
14
  type DispatchProps = {
15
- doLogout: () => ThunkAction,
15
+ doLogout: () => ThunkAction<>,
16
16
  };
17
17
 
18
18
  type Props = {
@@ -1 +1 @@
1
- {"version":3,"file":"SignOut.js","names":["connect","logout","getApplication","mapStateToProps","state","isAuthenticated","isLoggedIn","mapDispatchToProps","doLogout","connectSignOut"],"sources":["../../../src/redux/connectors/SignOut.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { logout } from \"../actions/SignOut\";\n\nimport type { ReduxState, ThunkAction } from \"../types\";\nimport type { ComponentType } from \"react\";\nimport { getApplication } from \"../_modularui\";\n\ntype StateProps = {\n isAuthenticated: boolean,\n};\n\ntype DispatchProps = {\n doLogout: () => ThunkAction,\n};\n\ntype Props = {\n ...StateProps,\n ...DispatchProps,\n};\n\nconst mapStateToProps = (state: ReduxState): StateProps => ({\n isAuthenticated: getApplication(state)?.isLoggedIn ?? false,\n});\n\nconst mapDispatchToProps = { doLogout: logout };\n\n/**\n * @deprecated - will be removed in the future, use the equivalent hook 'useLogout' instead\n */\nexport const connectSignOut: ComponentType<any> = connect<\n Props,\n {},\n StateProps,\n _,\n _,\n _,\n>(mapStateToProps, mapDispatchToProps);\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,aAAa;AAErC,SAASC,MAAM,QAAQ,oBAAoB;AAI3C,SAASC,cAAc,QAAQ,eAAe;AAe9C,MAAMC,eAAe,GAAIC,KAAiB,KAAkB;EAC1DC,eAAe,EAAEH,cAAc,CAACE,KAAK,CAAC,EAAEE,UAAU,IAAI;AACxD,CAAC,CAAC;AAEF,MAAMC,kBAAkB,GAAG;EAAEC,QAAQ,EAAEP;AAAO,CAAC;;AAE/C;AACA;AACA;AACA,OAAO,MAAMQ,cAAkC,GAAGT,OAAO,CAOvDG,eAAe,EAAEI,kBAAkB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"SignOut.js","names":["connect","logout","getApplication","mapStateToProps","state","isAuthenticated","isLoggedIn","mapDispatchToProps","doLogout","connectSignOut"],"sources":["../../../src/redux/connectors/SignOut.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { logout } from \"../actions/SignOut\";\n\nimport type { ReduxState, ThunkAction } from \"../types\";\nimport type { ComponentType } from \"react\";\nimport { getApplication } from \"../_modularui\";\n\ntype StateProps = {\n isAuthenticated: boolean,\n};\n\ntype DispatchProps = {\n doLogout: () => ThunkAction<>,\n};\n\ntype Props = {\n ...StateProps,\n ...DispatchProps,\n};\n\nconst mapStateToProps = (state: ReduxState): StateProps => ({\n isAuthenticated: getApplication(state)?.isLoggedIn ?? false,\n});\n\nconst mapDispatchToProps = { doLogout: logout };\n\n/**\n * @deprecated - will be removed in the future, use the equivalent hook 'useLogout' instead\n */\nexport const connectSignOut: ComponentType<any> = connect<\n Props,\n {},\n StateProps,\n _,\n _,\n _,\n>(mapStateToProps, mapDispatchToProps);\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,aAAa;AAErC,SAASC,MAAM,QAAQ,oBAAoB;AAI3C,SAASC,cAAc,QAAQ,eAAe;AAe9C,MAAMC,eAAe,GAAIC,KAAiB,KAAkB;EAC1DC,eAAe,EAAEH,cAAc,CAACE,KAAK,CAAC,EAAEE,UAAU,IAAI;AACxD,CAAC,CAAC;AAEF,MAAMC,kBAAkB,GAAG;EAAEC,QAAQ,EAAEP;AAAO,CAAC;;AAE/C;AACA;AACA;AACA,OAAO,MAAMQ,cAAkC,GAAGT,OAAO,CAOvDG,eAAe,EAAEI,kBAAkB,CAAC","ignoreList":[]}
@@ -11,13 +11,17 @@ const configureStore = (routerHistory, customReducers, initialState) => {
11
11
  if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
12
12
  composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
13
13
  }
14
+ const thunkExtra = {};
14
15
  const combinedReducers = combineReducers({
15
16
  ...customReducers,
16
17
  ...createReducer()
17
18
  });
18
- const middleware = applyMiddleware(modularUIMiddleware, routerMiddleware(routerHistory), thunk);
19
+ const middleware = applyMiddleware(modularUIMiddleware, routerMiddleware(routerHistory), thunk.withExtraArgument(thunkExtra));
19
20
  const enhancers = composeEnhancers(middleware);
20
21
  const store = createReduxStore(combinedReducers, initialState, enhancers);
22
+
23
+ // Populate the extra argument with the store's subscribe method -> use to wait on store updates
24
+ thunkExtra.subscribe = store.subscribe;
21
25
  if (!initialState?.router) {
22
26
  store.dispatch(locationChange(routerHistory.location, "PUSH"));
23
27
  }
@@ -17,6 +17,10 @@ import type { RouterHistory } from "react-router";
17
17
  import type { ReduxAction, ReduxState, ReduxStore } from "../types";
18
18
  import type { Reducer } from "redux";
19
19
 
20
+ type ThunkExtra = {
21
+ subscribe?: $PropertyType<ReduxStore, "subscribe">,
22
+ };
23
+
20
24
  /**
21
25
  */
22
26
  const configureStore = (
@@ -30,6 +34,8 @@ const configureStore = (
30
34
  composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
31
35
  }
32
36
 
37
+ const thunkExtra: ThunkExtra = {};
38
+
33
39
  const combinedReducers: Reducer<ReduxState, ReduxAction> = combineReducers({
34
40
  ...customReducers,
35
41
  ...createReducer(),
@@ -38,7 +44,7 @@ const configureStore = (
38
44
  const middleware = applyMiddleware(
39
45
  modularUIMiddleware,
40
46
  routerMiddleware(routerHistory),
41
- thunk,
47
+ thunk.withExtraArgument(thunkExtra),
42
48
  );
43
49
 
44
50
  const enhancers = composeEnhancers(middleware);
@@ -49,6 +55,9 @@ const configureStore = (
49
55
  enhancers,
50
56
  );
51
57
 
58
+ // Populate the extra argument with the store's subscribe method -> use to wait on store updates
59
+ thunkExtra.subscribe = store.subscribe;
60
+
52
61
  if (!initialState?.router) {
53
62
  store.dispatch(locationChange(routerHistory.location, "PUSH"));
54
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"configureStore.js","names":["applyMiddleware","compose","combineReducers","createStore","createReduxStore","thunk","routerMiddleware","modularUIMiddleware","createReducer","locationChange","configureStore","routerHistory","customReducers","initialState","composeEnhancers","process","env","NODE_ENV","window","__REDUX_DEVTOOLS_EXTENSION_COMPOSE__","combinedReducers","middleware","enhancers","store","router","dispatch","location"],"sources":["../../../src/redux/store/configureStore.js"],"sourcesContent":["// @flow\nimport {\n applyMiddleware,\n compose,\n combineReducers,\n createStore as createReduxStore,\n} from \"redux\";\nimport thunk from \"redux-thunk\";\n\nimport { routerMiddleware } from \"../_router/RouterMiddleware\";\nimport { modularUIMiddleware } from \"../_modularui/ModularUIMiddleware\";\n\nimport { createReducer } from \"../reducers/createReducer\";\nimport { locationChange } from \"../_router/RouterActions\";\n\nimport type { RouterHistory } from \"react-router\";\nimport type { ReduxAction, ReduxState, ReduxStore } from \"../types\";\nimport type { Reducer } from \"redux\";\n\n/**\n */\nconst configureStore = (\n routerHistory: RouterHistory,\n customReducers?: Object,\n initialState?: $Shape<ReduxState>,\n): { routerHistory: RouterHistory, store: ReduxStore } => {\n let composeEnhancers = compose;\n\n if (process.env.NODE_ENV !== \"production\" && typeof window !== \"undefined\") {\n composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;\n }\n\n const combinedReducers: Reducer<ReduxState, ReduxAction> = combineReducers({\n ...customReducers,\n ...createReducer(),\n });\n\n const middleware = applyMiddleware(\n modularUIMiddleware,\n routerMiddleware(routerHistory),\n thunk,\n );\n\n const enhancers = composeEnhancers(middleware);\n\n const store: ReduxStore = createReduxStore(\n combinedReducers,\n initialState,\n enhancers,\n );\n\n if (!initialState?.router) {\n store.dispatch(locationChange(routerHistory.location, \"PUSH\"));\n }\n\n return { routerHistory, store };\n};\n\nexport default configureStore;\n"],"mappings":"AACA,SACEA,eAAe,EACfC,OAAO,EACPC,eAAe,EACfC,WAAW,IAAIC,gBAAgB,QAC1B,OAAO;AACd,OAAOC,KAAK,MAAM,aAAa;AAE/B,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,mBAAmB,QAAQ,mCAAmC;AAEvE,SAASC,aAAa,QAAQ,2BAA2B;AACzD,SAASC,cAAc,QAAQ,0BAA0B;AAMzD;AACA;AACA,MAAMC,cAAc,GAAGA,CACrBC,aAA4B,EAC5BC,cAAuB,EACvBC,YAAiC,KACuB;EACxD,IAAIC,gBAAgB,GAAGb,OAAO;EAE9B,IAAIc,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;IAC1EJ,gBAAgB,GAAGI,MAAM,CAACC,oCAAoC,IAAIlB,OAAO;EAC3E;EAEA,MAAMmB,gBAAkD,GAAGlB,eAAe,CAAC;IACzE,GAAGU,cAAc;IACjB,GAAGJ,aAAa,CAAC;EACnB,CAAC,CAAC;EAEF,MAAMa,UAAU,GAAGrB,eAAe,CAChCO,mBAAmB,EACnBD,gBAAgB,CAACK,aAAa,CAAC,EAC/BN,KACF,CAAC;EAED,MAAMiB,SAAS,GAAGR,gBAAgB,CAACO,UAAU,CAAC;EAE9C,MAAME,KAAiB,GAAGnB,gBAAgB,CACxCgB,gBAAgB,EAChBP,YAAY,EACZS,SACF,CAAC;EAED,IAAI,CAACT,YAAY,EAAEW,MAAM,EAAE;IACzBD,KAAK,CAACE,QAAQ,CAAChB,cAAc,CAACE,aAAa,CAACe,QAAQ,EAAE,MAAM,CAAC,CAAC;EAChE;EAEA,OAAO;IAAEf,aAAa;IAAEY;EAAM,CAAC;AACjC,CAAC;AAED,eAAeb,cAAc","ignoreList":[]}
1
+ {"version":3,"file":"configureStore.js","names":["applyMiddleware","compose","combineReducers","createStore","createReduxStore","thunk","routerMiddleware","modularUIMiddleware","createReducer","locationChange","configureStore","routerHistory","customReducers","initialState","composeEnhancers","process","env","NODE_ENV","window","__REDUX_DEVTOOLS_EXTENSION_COMPOSE__","thunkExtra","combinedReducers","middleware","withExtraArgument","enhancers","store","subscribe","router","dispatch","location"],"sources":["../../../src/redux/store/configureStore.js"],"sourcesContent":["// @flow\nimport {\n applyMiddleware,\n compose,\n combineReducers,\n createStore as createReduxStore,\n} from \"redux\";\nimport thunk from \"redux-thunk\";\n\nimport { routerMiddleware } from \"../_router/RouterMiddleware\";\nimport { modularUIMiddleware } from \"../_modularui/ModularUIMiddleware\";\n\nimport { createReducer } from \"../reducers/createReducer\";\nimport { locationChange } from \"../_router/RouterActions\";\n\nimport type { RouterHistory } from \"react-router\";\nimport type { ReduxAction, ReduxState, ReduxStore } from \"../types\";\nimport type { Reducer } from \"redux\";\n\ntype ThunkExtra = {\n subscribe?: $PropertyType<ReduxStore, \"subscribe\">,\n};\n\n/**\n */\nconst configureStore = (\n routerHistory: RouterHistory,\n customReducers?: Object,\n initialState?: $Shape<ReduxState>,\n): { routerHistory: RouterHistory, store: ReduxStore } => {\n let composeEnhancers = compose;\n\n if (process.env.NODE_ENV !== \"production\" && typeof window !== \"undefined\") {\n composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;\n }\n\n const thunkExtra: ThunkExtra = {};\n\n const combinedReducers: Reducer<ReduxState, ReduxAction> = combineReducers({\n ...customReducers,\n ...createReducer(),\n });\n\n const middleware = applyMiddleware(\n modularUIMiddleware,\n routerMiddleware(routerHistory),\n thunk.withExtraArgument(thunkExtra),\n );\n\n const enhancers = composeEnhancers(middleware);\n\n const store: ReduxStore = createReduxStore(\n combinedReducers,\n initialState,\n enhancers,\n );\n\n // Populate the extra argument with the store's subscribe method -> use to wait on store updates\n thunkExtra.subscribe = store.subscribe;\n\n if (!initialState?.router) {\n store.dispatch(locationChange(routerHistory.location, \"PUSH\"));\n }\n\n return { routerHistory, store };\n};\n\nexport default configureStore;\n"],"mappings":"AACA,SACEA,eAAe,EACfC,OAAO,EACPC,eAAe,EACfC,WAAW,IAAIC,gBAAgB,QAC1B,OAAO;AACd,OAAOC,KAAK,MAAM,aAAa;AAE/B,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,mBAAmB,QAAQ,mCAAmC;AAEvE,SAASC,aAAa,QAAQ,2BAA2B;AACzD,SAASC,cAAc,QAAQ,0BAA0B;AAUzD;AACA;AACA,MAAMC,cAAc,GAAGA,CACrBC,aAA4B,EAC5BC,cAAuB,EACvBC,YAAiC,KACuB;EACxD,IAAIC,gBAAgB,GAAGb,OAAO;EAE9B,IAAIc,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;IAC1EJ,gBAAgB,GAAGI,MAAM,CAACC,oCAAoC,IAAIlB,OAAO;EAC3E;EAEA,MAAMmB,UAAsB,GAAG,CAAC,CAAC;EAEjC,MAAMC,gBAAkD,GAAGnB,eAAe,CAAC;IACzE,GAAGU,cAAc;IACjB,GAAGJ,aAAa,CAAC;EACnB,CAAC,CAAC;EAEF,MAAMc,UAAU,GAAGtB,eAAe,CAChCO,mBAAmB,EACnBD,gBAAgB,CAACK,aAAa,CAAC,EAC/BN,KAAK,CAACkB,iBAAiB,CAACH,UAAU,CACpC,CAAC;EAED,MAAMI,SAAS,GAAGV,gBAAgB,CAACQ,UAAU,CAAC;EAE9C,MAAMG,KAAiB,GAAGrB,gBAAgB,CACxCiB,gBAAgB,EAChBR,YAAY,EACZW,SACF,CAAC;;EAED;EACAJ,UAAU,CAACM,SAAS,GAAGD,KAAK,CAACC,SAAS;EAEtC,IAAI,CAACb,YAAY,EAAEc,MAAM,EAAE;IACzBF,KAAK,CAACG,QAAQ,CAACnB,cAAc,CAACE,aAAa,CAACkB,QAAQ,EAAE,MAAM,CAAC,CAAC;EAChE;EAEA,OAAO;IAAElB,aAAa;IAAEc;EAAM,CAAC;AACjC,CAAC;AAED,eAAef,cAAc","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  // @flow
2
- import type { Store, DispatchAPI } from "redux";
2
+ import type { Store } from "redux";
3
3
 
4
4
  import type ErrorResponse from "../models/error/ErrorResponse";
5
5
 
@@ -231,11 +231,30 @@ export type ReduxState = {
231
231
  };
232
232
 
233
233
  export type GetState = () => ReduxState;
234
- export type ThunkAction = (dispatch: Dispatch, getState: GetState) => any;
235
- export type PromiseAction = Promise<PossibleAction>;
236
- export type Dispatch = DispatchAPI<PossibleAction>;
234
+ export type ThunkExtra = { subscribe: any };
235
+
236
+ // 1. Define ThunkAction first.
237
+ // We use 'any' for Dispatch here temporarily to break the circularity
238
+ // or use the specialized function type.
239
+ export type ThunkAction<R = any> = (
240
+ dispatch: Dispatch,
241
+ getState: GetState,
242
+ extra: ThunkExtra,
243
+ ) => R;
244
+
245
+ export type PromiseAction = Promise<ReduxAction | ThunkAction<any>>;
246
+
247
+ // 2. Define Dispatch as a naked function type.
248
+ // This is much more reliable in modern Flow than DispatchAPI<...>.
249
+ export type Dispatch = (
250
+ action: ReduxAction | ThunkAction<any> | PromiseAction,
251
+ ) => any;
252
+
253
+ // 3. Update ReduxStore to use the ReduxAction for the base reducer
254
+ // but our custom Dispatch for the store instance.
237
255
  export type ReduxStore = Store<ReduxState, ReduxAction, Dispatch>;
238
256
 
239
- export type PossibleAction = ReduxAction | ThunkAction | PromiseAction;
257
+ // 4. Clean up PossibleAction if you still use it elsewhere
258
+ export type PossibleAction = ReduxAction | ThunkAction<any> | PromiseAction;
240
259
 
241
260
  export type CustomReducers = { [reducerKey: string]: any };
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/redux/types.js"],"sourcesContent":["// @flow\nimport type { Store, DispatchAPI } from \"redux\";\n\nimport type ErrorResponse from \"../models/error/ErrorResponse\";\n\nimport type FormModel from \"../models/form/FormModel\";\nimport typeof {\n NOTIFICATION_TYPES,\n AUTOSAVE_STATUS,\n} from \"../constants/Constants\";\n\nimport type { MessageObject } from \"../i18n/types\";\nimport type {\n I18nState,\n UpdateLocaleAction,\n SetLocalesAction,\n} from \"./_i18n/types\";\nimport type {\n ModularUIState,\n ModularUIAction,\n UpdateStatusAction,\n SetModelAction,\n UpdateModelAction,\n UpdateFormAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n InitModelAction,\n} from \"./_modularui/types\";\nimport type {\n RouterState,\n LocationChangeAction,\n PushAction,\n ReplaceAction,\n GoAction,\n GoBackAction,\n GoForwardAction,\n} from \"./_router/types\";\n\nexport type PreferenceValue =\n | null\n | string\n | boolean\n | { [key: string]: any }\n | Array<PreferenceValue>;\n\nexport type UpdateFormOptions = {\n autosubmit: boolean,\n autosave: boolean,\n autoupdate: boolean,\n forceUpdate?: boolean,\n /** Default true: Activate/deactivate the form object validate by an update */\n validate?: boolean,\n};\n\nexport type NoAction = {\n type: \"NO_ACTION\",\n};\n\nexport type SaveErrorAction = {\n type: \"SAVE_ERROR\",\n payload: ErrorResponse,\n};\n\nexport type ShowModalAction = {\n type: \"SHOW_MODAL\",\n payload: string,\n};\n\nexport type CloseModalAction = {\n type: \"CLOSE_MODAL\",\n payload: string,\n};\n\nexport type DismissNotificationAction = {\n type: \"DISMISS_NOTIFICATION\",\n};\nexport type ShowNotificationAction = {\n type: \"SHOW_NOTIFICATION\",\n payload: {\n type: $Keys<NOTIFICATION_TYPES>,\n message: MessageObject,\n error: ?ErrorResponse,\n },\n};\n\nexport type SetPreferenceAction = {\n type: \"SET_PREFERENCE\",\n payload: { [name: string]: PreferenceValue },\n};\nexport type SetPreferencesAction = {\n type: \"SET_PREFERENCES\",\n payload: { [name: string]: PreferenceValue },\n};\n\nexport type StartProgressAction = {\n type: \"START_PROGRESS\",\n};\nexport type FinishProgressAction = {\n type: \"FINISH_PROGRESS\",\n};\nexport type ResetProgressAction = {\n type: \"RESET_PROGRESS\",\n};\nexport type UpdateProgressAction = {\n type: \"UPDATE_PROGRESS\",\n payload: { percentComplete: number },\n};\n\nexport type SendAuthenticationErrorAction = {\n type: \"AUTHENTICATION_ERROR\",\n payload: string,\n};\n\nexport type ResetAuthErrorsAction = {\n type: \"AUTHENTICATION_RESET_ERRORS\",\n};\n\nexport type LoginSuccessAction = {\n type: \"AUTHENTICATION_SUCCESS\",\n};\n\nexport type ChangePasswordAction = {\n type: \"CHANGE_PASSWORD\",\n};\n\nexport type LogoutSuccessAction = {\n type: \"AUTHENTICATION_LOGOUT\",\n};\n\nexport type UpdateAutosaveAction = {\n type: \"UPDATE_AUTOSAVE_STATUS\",\n payload: {\n status: $Keys<AUTOSAVE_STATUS>,\n model: FormModel,\n },\n};\n\nexport type UpdateEntryDateAction = {\n type: \"UPDATE_ENTRYDATE\",\n payload: ISO_DATE,\n};\n\nexport type ReduxAction =\n | UpdateStatusAction\n | SetModelAction\n | InitModelAction\n | UpdateModelAction\n | UpdateFormAction\n | RemoveModelByKeyAction\n | ResetModularUIAction\n | SaveErrorAction\n | UpdateLocaleAction\n | SetLocalesAction\n | ShowModalAction\n | CloseModalAction\n | DismissNotificationAction\n | ShowNotificationAction\n | SetPreferenceAction\n | SetPreferencesAction\n | StartProgressAction\n | FinishProgressAction\n | ResetProgressAction\n | UpdateProgressAction\n | ResetAuthErrorsAction\n | SendAuthenticationErrorAction\n | LoginSuccessAction\n | ChangePasswordAction\n | LogoutSuccessAction\n | UpdateAutosaveAction\n | UpdateEntryDateAction\n | LocationChangeAction\n | PushAction\n | ReplaceAction\n | GoAction\n | GoBackAction\n | GoForwardAction\n | ModularUIAction\n | NoAction;\n\n// Redux state\nexport type AuthState = {\n +mustChangePassword: boolean,\n +error: ?string,\n};\n\nexport type ErrorState = null | ErrorResponse;\n\nexport type ModalState = {\n +key: string,\n +visible: boolean,\n +size?: string,\n};\n\nexport type ModalsState = {\n +modals: Array<ModalState>,\n};\n\nexport type NotificationState = {\n +render: boolean,\n +messageType: string | null,\n +message: MessageObject | null,\n +error: ?ErrorResponse | null,\n};\n\nexport type PreferencesState = {\n +[name: string]: PreferenceValue,\n};\n\nexport type ProgressIndicatorState = {\n +count: number,\n +timestamp: number,\n +percentComplete: number,\n};\n\nexport type ModelCatalogState = {\n entryDate: ISO_DATE | null,\n};\n\nexport type ReduxState = {\n +router: RouterState,\n +modularui: ModularUIState,\n +i18n: I18nState,\n +auth: AuthState,\n +modelcatalog: ModelCatalogState,\n +error: ErrorState,\n +modals: ModalsState,\n +notification: NotificationState,\n +progressindicator: ProgressIndicatorState,\n +preferences: PreferencesState,\n ...\n};\n\nexport type GetState = () => ReduxState;\nexport type ThunkAction = (dispatch: Dispatch, getState: GetState) => any;\nexport type PromiseAction = Promise<PossibleAction>;\nexport type Dispatch = DispatchAPI<PossibleAction>;\nexport type ReduxStore = Store<ReduxState, ReduxAction, Dispatch>;\n\nexport type PossibleAction = ReduxAction | ThunkAction | PromiseAction;\n\nexport type CustomReducers = { [reducerKey: string]: any };\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/redux/types.js"],"sourcesContent":["// @flow\nimport type { Store } from \"redux\";\n\nimport type ErrorResponse from \"../models/error/ErrorResponse\";\n\nimport type FormModel from \"../models/form/FormModel\";\nimport typeof {\n NOTIFICATION_TYPES,\n AUTOSAVE_STATUS,\n} from \"../constants/Constants\";\n\nimport type { MessageObject } from \"../i18n/types\";\nimport type {\n I18nState,\n UpdateLocaleAction,\n SetLocalesAction,\n} from \"./_i18n/types\";\nimport type {\n ModularUIState,\n ModularUIAction,\n UpdateStatusAction,\n SetModelAction,\n UpdateModelAction,\n UpdateFormAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n InitModelAction,\n} from \"./_modularui/types\";\nimport type {\n RouterState,\n LocationChangeAction,\n PushAction,\n ReplaceAction,\n GoAction,\n GoBackAction,\n GoForwardAction,\n} from \"./_router/types\";\n\nexport type PreferenceValue =\n | null\n | string\n | boolean\n | { [key: string]: any }\n | Array<PreferenceValue>;\n\nexport type UpdateFormOptions = {\n autosubmit: boolean,\n autosave: boolean,\n autoupdate: boolean,\n forceUpdate?: boolean,\n /** Default true: Activate/deactivate the form object validate by an update */\n validate?: boolean,\n};\n\nexport type NoAction = {\n type: \"NO_ACTION\",\n};\n\nexport type SaveErrorAction = {\n type: \"SAVE_ERROR\",\n payload: ErrorResponse,\n};\n\nexport type ShowModalAction = {\n type: \"SHOW_MODAL\",\n payload: string,\n};\n\nexport type CloseModalAction = {\n type: \"CLOSE_MODAL\",\n payload: string,\n};\n\nexport type DismissNotificationAction = {\n type: \"DISMISS_NOTIFICATION\",\n};\nexport type ShowNotificationAction = {\n type: \"SHOW_NOTIFICATION\",\n payload: {\n type: $Keys<NOTIFICATION_TYPES>,\n message: MessageObject,\n error: ?ErrorResponse,\n },\n};\n\nexport type SetPreferenceAction = {\n type: \"SET_PREFERENCE\",\n payload: { [name: string]: PreferenceValue },\n};\nexport type SetPreferencesAction = {\n type: \"SET_PREFERENCES\",\n payload: { [name: string]: PreferenceValue },\n};\n\nexport type StartProgressAction = {\n type: \"START_PROGRESS\",\n};\nexport type FinishProgressAction = {\n type: \"FINISH_PROGRESS\",\n};\nexport type ResetProgressAction = {\n type: \"RESET_PROGRESS\",\n};\nexport type UpdateProgressAction = {\n type: \"UPDATE_PROGRESS\",\n payload: { percentComplete: number },\n};\n\nexport type SendAuthenticationErrorAction = {\n type: \"AUTHENTICATION_ERROR\",\n payload: string,\n};\n\nexport type ResetAuthErrorsAction = {\n type: \"AUTHENTICATION_RESET_ERRORS\",\n};\n\nexport type LoginSuccessAction = {\n type: \"AUTHENTICATION_SUCCESS\",\n};\n\nexport type ChangePasswordAction = {\n type: \"CHANGE_PASSWORD\",\n};\n\nexport type LogoutSuccessAction = {\n type: \"AUTHENTICATION_LOGOUT\",\n};\n\nexport type UpdateAutosaveAction = {\n type: \"UPDATE_AUTOSAVE_STATUS\",\n payload: {\n status: $Keys<AUTOSAVE_STATUS>,\n model: FormModel,\n },\n};\n\nexport type UpdateEntryDateAction = {\n type: \"UPDATE_ENTRYDATE\",\n payload: ISO_DATE,\n};\n\nexport type ReduxAction =\n | UpdateStatusAction\n | SetModelAction\n | InitModelAction\n | UpdateModelAction\n | UpdateFormAction\n | RemoveModelByKeyAction\n | ResetModularUIAction\n | SaveErrorAction\n | UpdateLocaleAction\n | SetLocalesAction\n | ShowModalAction\n | CloseModalAction\n | DismissNotificationAction\n | ShowNotificationAction\n | SetPreferenceAction\n | SetPreferencesAction\n | StartProgressAction\n | FinishProgressAction\n | ResetProgressAction\n | UpdateProgressAction\n | ResetAuthErrorsAction\n | SendAuthenticationErrorAction\n | LoginSuccessAction\n | ChangePasswordAction\n | LogoutSuccessAction\n | UpdateAutosaveAction\n | UpdateEntryDateAction\n | LocationChangeAction\n | PushAction\n | ReplaceAction\n | GoAction\n | GoBackAction\n | GoForwardAction\n | ModularUIAction\n | NoAction;\n\n// Redux state\nexport type AuthState = {\n +mustChangePassword: boolean,\n +error: ?string,\n};\n\nexport type ErrorState = null | ErrorResponse;\n\nexport type ModalState = {\n +key: string,\n +visible: boolean,\n +size?: string,\n};\n\nexport type ModalsState = {\n +modals: Array<ModalState>,\n};\n\nexport type NotificationState = {\n +render: boolean,\n +messageType: string | null,\n +message: MessageObject | null,\n +error: ?ErrorResponse | null,\n};\n\nexport type PreferencesState = {\n +[name: string]: PreferenceValue,\n};\n\nexport type ProgressIndicatorState = {\n +count: number,\n +timestamp: number,\n +percentComplete: number,\n};\n\nexport type ModelCatalogState = {\n entryDate: ISO_DATE | null,\n};\n\nexport type ReduxState = {\n +router: RouterState,\n +modularui: ModularUIState,\n +i18n: I18nState,\n +auth: AuthState,\n +modelcatalog: ModelCatalogState,\n +error: ErrorState,\n +modals: ModalsState,\n +notification: NotificationState,\n +progressindicator: ProgressIndicatorState,\n +preferences: PreferencesState,\n ...\n};\n\nexport type GetState = () => ReduxState;\nexport type ThunkExtra = { subscribe: any };\n\n// 1. Define ThunkAction first.\n// We use 'any' for Dispatch here temporarily to break the circularity\n// or use the specialized function type.\nexport type ThunkAction<R = any> = (\n dispatch: Dispatch,\n getState: GetState,\n extra: ThunkExtra,\n) => R;\n\nexport type PromiseAction = Promise<ReduxAction | ThunkAction<any>>;\n\n// 2. Define Dispatch as a naked function type.\n// This is much more reliable in modern Flow than DispatchAPI<...>.\nexport type Dispatch = (\n action: ReduxAction | ThunkAction<any> | PromiseAction,\n) => any;\n\n// 3. Update ReduxStore to use the ReduxAction for the base reducer\n// but our custom Dispatch for the store instance.\nexport type ReduxStore = Store<ReduxState, ReduxAction, Dispatch>;\n\n// 4. Clean up PossibleAction if you still use it elsewhere\nexport type PossibleAction = ReduxAction | ThunkAction<any> | PromiseAction;\n\nexport type CustomReducers = { [reducerKey: string]: any };\n"],"mappings":"","ignoreList":[]}