@beinformed/ui 1.65.23 → 1.65.25

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 (299) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/esm/builder/mergeLayoutHintConfigurations.js +6 -5
  3. package/esm/builder/mergeLayoutHintConfigurations.js.flow +11 -5
  4. package/esm/builder/mergeLayoutHintConfigurations.js.map +1 -1
  5. package/esm/constants/Settings.js +4 -1
  6. package/esm/constants/Settings.js.flow +3 -3
  7. package/esm/constants/Settings.js.map +1 -1
  8. package/esm/hooks/__tests__/useAuthentication.spec.js.flow +100 -132
  9. package/esm/hooks/useAuthentication.js +21 -11
  10. package/esm/hooks/useAuthentication.js.flow +29 -26
  11. package/esm/hooks/useAuthentication.js.map +1 -1
  12. package/esm/hooks/useModelCatalog.js +1 -1
  13. package/esm/hooks/useModelCatalog.js.flow +1 -1
  14. package/esm/hooks/useModelCatalog.js.map +1 -1
  15. package/esm/hooks/useModularUI.js +1 -1
  16. package/esm/hooks/useModularUI.js.flow +1 -1
  17. package/esm/hooks/useModularUI.js.map +1 -1
  18. package/esm/i18n/Locale.js +3 -1
  19. package/esm/i18n/Locale.js.flow +2 -2
  20. package/esm/i18n/Locale.js.map +1 -1
  21. package/esm/models/actions/ActionCollection.js +1 -1
  22. package/esm/models/actions/ActionCollection.js.flow +3 -3
  23. package/esm/models/actions/ActionCollection.js.map +1 -1
  24. package/esm/models/application/ApplicationModel.js +6 -1
  25. package/esm/models/application/ApplicationModel.js.flow +7 -2
  26. package/esm/models/application/ApplicationModel.js.map +1 -1
  27. package/esm/models/attributes/ChoiceAttributeModel.js +3 -5
  28. package/esm/models/attributes/ChoiceAttributeModel.js.flow +3 -5
  29. package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
  30. package/esm/models/attributes/CompositeAttributeModel.js +1 -1
  31. package/esm/models/attributes/CompositeAttributeModel.js.flow +1 -1
  32. package/esm/models/attributes/CompositeAttributeModel.js.map +1 -1
  33. package/esm/models/attributes/NumberAttributeModel.js +3 -1
  34. package/esm/models/attributes/NumberAttributeModel.js.flow +2 -1
  35. package/esm/models/attributes/NumberAttributeModel.js.map +1 -1
  36. package/esm/models/attributes/StringAttributeModel.js +5 -4
  37. package/esm/models/attributes/StringAttributeModel.js.flow +4 -4
  38. package/esm/models/attributes/StringAttributeModel.js.map +1 -1
  39. package/esm/models/attributes/input-constraints/DatetimeFormatConstraint.js +1 -1
  40. package/esm/models/attributes/input-constraints/DatetimeFormatConstraint.js.flow +1 -1
  41. package/esm/models/attributes/input-constraints/DatetimeFormatConstraint.js.map +1 -1
  42. package/esm/models/base/BaseModel.js +6 -5
  43. package/esm/models/base/BaseModel.js.flow +7 -5
  44. package/esm/models/base/BaseModel.js.map +1 -1
  45. package/esm/models/base/ResourceModel.js +6 -7
  46. package/esm/models/base/ResourceModel.js.flow +4 -4
  47. package/esm/models/base/ResourceModel.js.map +1 -1
  48. package/esm/models/concepts/ConceptDetailModel.js +16 -16
  49. package/esm/models/concepts/ConceptDetailModel.js.flow +16 -19
  50. package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
  51. package/esm/models/concepts/SourceReferenceCollection.js +1 -1
  52. package/esm/models/concepts/SourceReferenceCollection.js.flow +1 -2
  53. package/esm/models/concepts/SourceReferenceCollection.js.map +1 -1
  54. package/esm/models/content/ContentLinkModel.js +6 -6
  55. package/esm/models/content/ContentLinkModel.js.flow +6 -6
  56. package/esm/models/content/ContentLinkModel.js.map +1 -1
  57. package/esm/models/filters/BaseFilterModel.js +3 -5
  58. package/esm/models/filters/BaseFilterModel.js.flow +4 -5
  59. package/esm/models/filters/BaseFilterModel.js.map +1 -1
  60. package/esm/models/filters/StringFilterModel.js +3 -2
  61. package/esm/models/filters/StringFilterModel.js.flow +2 -2
  62. package/esm/models/filters/StringFilterModel.js.map +1 -1
  63. package/esm/models/form/FormModel.js +1 -1
  64. package/esm/models/form/FormModel.js.flow +1 -2
  65. package/esm/models/form/FormModel.js.map +1 -1
  66. package/esm/models/form/FormObjectModel.js +1 -1
  67. package/esm/models/form/FormObjectModel.js.flow +2 -3
  68. package/esm/models/form/FormObjectModel.js.map +1 -1
  69. package/esm/models/href/Href.js +2 -2
  70. package/esm/models/href/Href.js.flow +2 -2
  71. package/esm/models/href/Href.js.map +1 -1
  72. package/esm/models/index.js +2 -2
  73. package/esm/models/index.js.flow +1 -2
  74. package/esm/models/index.js.map +1 -1
  75. package/esm/models/links/normalizeLinkJSON.js +1 -1
  76. package/esm/models/links/normalizeLinkJSON.js.flow +1 -1
  77. package/esm/models/links/normalizeLinkJSON.js.map +1 -1
  78. package/esm/modularui/Authenticate.js +7 -2
  79. package/esm/modularui/Authenticate.js.flow +4 -2
  80. package/esm/modularui/Authenticate.js.map +1 -1
  81. package/esm/modularui/ModularUIRequest.js +2 -5
  82. package/esm/modularui/ModularUIRequest.js.flow +2 -6
  83. package/esm/modularui/ModularUIRequest.js.map +1 -1
  84. package/esm/modularui/UploadRequest.js +3 -1
  85. package/esm/modularui/UploadRequest.js.flow +3 -1
  86. package/esm/modularui/UploadRequest.js.map +1 -1
  87. package/esm/react-client/client.js +22 -10
  88. package/esm/react-client/client.js.flow +17 -11
  89. package/esm/react-client/client.js.map +1 -1
  90. package/esm/react-client/contextPath.js +3 -1
  91. package/esm/react-client/contextPath.js.flow +2 -1
  92. package/esm/react-client/contextPath.js.map +1 -1
  93. package/esm/redux/_i18n/I18nActions.js.flow +1 -1
  94. package/esm/redux/_i18n/I18nActions.js.map +1 -1
  95. package/esm/redux/_i18n/I18nReducer.js +1 -4
  96. package/esm/redux/_i18n/I18nReducer.js.flow +1 -4
  97. package/esm/redux/_i18n/I18nReducer.js.map +1 -1
  98. package/esm/redux/_modularui/ModularUIActions.js +1 -4
  99. package/esm/redux/_modularui/ModularUIActions.js.flow +3 -7
  100. package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
  101. package/esm/redux/_modularui/ModularUIConnector.js +2 -5
  102. package/esm/redux/_modularui/ModularUIConnector.js.flow +2 -2
  103. package/esm/redux/_modularui/ModularUIConnector.js.map +1 -1
  104. package/esm/redux/_modularui/ModularUIReducer.js +6 -3
  105. package/esm/redux/_modularui/ModularUIReducer.js.flow +2 -2
  106. package/esm/redux/_modularui/ModularUIReducer.js.map +1 -1
  107. package/esm/redux/_modularui/ModularUISelectors.js +12 -18
  108. package/esm/redux/_modularui/ModularUISelectors.js.flow +13 -14
  109. package/esm/redux/_modularui/ModularUISelectors.js.map +1 -1
  110. package/esm/redux/_modularui/withModularUI.js.flow +2 -2
  111. package/esm/redux/_modularui/withModularUI.js.map +1 -1
  112. package/esm/redux/actions/Application.js +32 -4
  113. package/esm/redux/actions/Application.js.flow +34 -5
  114. package/esm/redux/actions/Application.js.map +1 -1
  115. package/esm/redux/actions/Authorization.js +23 -26
  116. package/esm/redux/actions/Authorization.js.flow +30 -30
  117. package/esm/redux/actions/Authorization.js.map +1 -1
  118. package/esm/redux/actions/Error.js +2 -0
  119. package/esm/redux/actions/Error.js.flow +5 -4
  120. package/esm/redux/actions/Error.js.map +1 -1
  121. package/esm/redux/actions/Form.js.flow +1 -1
  122. package/esm/redux/actions/Form.js.map +1 -1
  123. package/esm/redux/actions/FormAttributeSet.js.flow +1 -1
  124. package/esm/redux/actions/FormAttributeSet.js.map +1 -1
  125. package/esm/redux/actions/FormAutosave.js.flow +1 -1
  126. package/esm/redux/actions/FormAutosave.js.map +1 -1
  127. package/esm/redux/actions/FormAutosubmit.js.flow +1 -1
  128. package/esm/redux/actions/FormAutosubmit.js.map +1 -1
  129. package/esm/redux/actions/FormAutoupdate.js.flow +1 -1
  130. package/esm/redux/actions/FormAutoupdate.js.map +1 -1
  131. package/esm/redux/actions/FormValidations.js.flow +1 -1
  132. package/esm/redux/actions/FormValidations.js.map +1 -1
  133. package/esm/redux/actions/Notification.js.flow +3 -3
  134. package/esm/redux/actions/Notification.js.map +1 -1
  135. package/esm/redux/actions/Preferences.js +4 -4
  136. package/esm/redux/actions/Preferences.js.flow +6 -10
  137. package/esm/redux/actions/Preferences.js.map +1 -1
  138. package/esm/redux/actions/SignIn.js +2 -4
  139. package/esm/redux/actions/SignIn.js.flow +4 -7
  140. package/esm/redux/actions/SignIn.js.map +1 -1
  141. package/esm/redux/actions/SignOut.js.flow +1 -1
  142. package/esm/redux/actions/SignOut.js.map +1 -1
  143. package/esm/redux/actions/__tests__/Application.spec.js.flow +67 -29
  144. package/esm/redux/actions/__tests__/Authorization.spec.js.flow +77 -83
  145. package/esm/redux/connectors/Form.js.flow +2 -2
  146. package/esm/redux/connectors/Form.js.map +1 -1
  147. package/esm/redux/connectors/FormAttributeSet.js.flow +2 -5
  148. package/esm/redux/connectors/FormAttributeSet.js.map +1 -1
  149. package/esm/redux/connectors/Progress.js.flow +1 -1
  150. package/esm/redux/connectors/Progress.js.map +1 -1
  151. package/esm/redux/connectors/SignIn.js.flow +1 -1
  152. package/esm/redux/connectors/SignIn.js.map +1 -1
  153. package/esm/redux/connectors/SignOut.js.flow +1 -1
  154. package/esm/redux/connectors/SignOut.js.map +1 -1
  155. package/esm/redux/reducers/ModelCatalogReducer.js +7 -9
  156. package/esm/redux/reducers/ModelCatalogReducer.js.flow +8 -9
  157. package/esm/redux/reducers/ModelCatalogReducer.js.map +1 -1
  158. package/esm/redux/store/configureStore.js +9 -2
  159. package/esm/redux/store/configureStore.js.flow +13 -2
  160. package/esm/redux/store/configureStore.js.map +1 -1
  161. package/esm/redux/types.js.flow +33 -5
  162. package/esm/redux/types.js.map +1 -1
  163. package/esm/utils/browser/Cache.js +3 -1
  164. package/esm/utils/browser/Cache.js.flow +2 -1
  165. package/esm/utils/browser/Cache.js.map +1 -1
  166. package/esm/utils/browser/__tests__/Cookies.spec.js.flow +2 -1
  167. package/esm/utils/datetime/DateTimeUtil.js +6 -5
  168. package/esm/utils/datetime/DateTimeUtil.js.flow +5 -11
  169. package/esm/utils/datetime/DateTimeUtil.js.map +1 -1
  170. package/esm/utils/datetime/__tests__/DateTimeFormat.spec.js.flow +0 -6
  171. package/esm/utils/fetch/universalFetch.js +7 -8
  172. package/esm/utils/fetch/universalFetch.js.flow +13 -14
  173. package/esm/utils/fetch/universalFetch.js.map +1 -1
  174. package/esm/utils/fetch/xhr.js +2 -5
  175. package/esm/utils/fetch/xhr.js.flow +2 -6
  176. package/esm/utils/fetch/xhr.js.map +1 -1
  177. package/esm/utils/helpers/createHref.js +2 -1
  178. package/esm/utils/helpers/createHref.js.flow +1 -1
  179. package/esm/utils/helpers/createHref.js.map +1 -1
  180. package/esm/utils/helpers/createUUID.js +2 -1
  181. package/esm/utils/helpers/createUUID.js.flow +1 -1
  182. package/esm/utils/helpers/createUUID.js.map +1 -1
  183. package/esm/utils/number/parseNumbers.js +4 -3
  184. package/esm/utils/number/parseNumbers.js.flow +3 -3
  185. package/esm/utils/number/parseNumbers.js.map +1 -1
  186. package/lib/builder/mergeLayoutHintConfigurations.js +6 -5
  187. package/lib/builder/mergeLayoutHintConfigurations.js.map +1 -1
  188. package/lib/constants/Settings.js +4 -1
  189. package/lib/constants/Settings.js.map +1 -1
  190. package/lib/hooks/useAuthentication.js +21 -11
  191. package/lib/hooks/useAuthentication.js.map +1 -1
  192. package/lib/hooks/useModelCatalog.js +1 -1
  193. package/lib/hooks/useModelCatalog.js.map +1 -1
  194. package/lib/hooks/useModularUI.js +1 -1
  195. package/lib/hooks/useModularUI.js.map +1 -1
  196. package/lib/i18n/Locale.js +3 -1
  197. package/lib/i18n/Locale.js.map +1 -1
  198. package/lib/models/actions/ActionCollection.js +1 -1
  199. package/lib/models/actions/ActionCollection.js.map +1 -1
  200. package/lib/models/application/ApplicationModel.js +6 -1
  201. package/lib/models/application/ApplicationModel.js.map +1 -1
  202. package/lib/models/attributes/ChoiceAttributeModel.js +3 -5
  203. package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
  204. package/lib/models/attributes/CompositeAttributeModel.js +1 -1
  205. package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
  206. package/lib/models/attributes/NumberAttributeModel.js +3 -1
  207. package/lib/models/attributes/NumberAttributeModel.js.map +1 -1
  208. package/lib/models/attributes/StringAttributeModel.js +5 -4
  209. package/lib/models/attributes/StringAttributeModel.js.map +1 -1
  210. package/lib/models/attributes/input-constraints/DatetimeFormatConstraint.js +1 -1
  211. package/lib/models/attributes/input-constraints/DatetimeFormatConstraint.js.map +1 -1
  212. package/lib/models/base/BaseModel.js +6 -5
  213. package/lib/models/base/BaseModel.js.map +1 -1
  214. package/lib/models/base/ResourceModel.js +6 -7
  215. package/lib/models/base/ResourceModel.js.map +1 -1
  216. package/lib/models/concepts/ConceptDetailModel.js +16 -16
  217. package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
  218. package/lib/models/concepts/SourceReferenceCollection.js +1 -1
  219. package/lib/models/concepts/SourceReferenceCollection.js.map +1 -1
  220. package/lib/models/content/ContentLinkModel.js +6 -6
  221. package/lib/models/content/ContentLinkModel.js.map +1 -1
  222. package/lib/models/filters/BaseFilterModel.js +3 -5
  223. package/lib/models/filters/BaseFilterModel.js.map +1 -1
  224. package/lib/models/filters/StringFilterModel.js +3 -2
  225. package/lib/models/filters/StringFilterModel.js.map +1 -1
  226. package/lib/models/form/FormModel.js +1 -1
  227. package/lib/models/form/FormModel.js.map +1 -1
  228. package/lib/models/form/FormObjectModel.js +1 -1
  229. package/lib/models/form/FormObjectModel.js.map +1 -1
  230. package/lib/models/href/Href.js +2 -2
  231. package/lib/models/href/Href.js.map +1 -1
  232. package/lib/models/index.js.map +1 -1
  233. package/lib/models/links/normalizeLinkJSON.js +1 -1
  234. package/lib/models/links/normalizeLinkJSON.js.map +1 -1
  235. package/lib/modularui/Authenticate.js +7 -2
  236. package/lib/modularui/Authenticate.js.map +1 -1
  237. package/lib/modularui/ModularUIRequest.js +2 -5
  238. package/lib/modularui/ModularUIRequest.js.map +1 -1
  239. package/lib/modularui/UploadRequest.js +3 -1
  240. package/lib/modularui/UploadRequest.js.map +1 -1
  241. package/lib/react-client/client.js +22 -10
  242. package/lib/react-client/client.js.map +1 -1
  243. package/lib/react-client/contextPath.js +4 -1
  244. package/lib/react-client/contextPath.js.map +1 -1
  245. package/lib/redux/_i18n/I18nActions.js.map +1 -1
  246. package/lib/redux/_i18n/I18nReducer.js +1 -4
  247. package/lib/redux/_i18n/I18nReducer.js.map +1 -1
  248. package/lib/redux/_modularui/ModularUIActions.js +1 -4
  249. package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
  250. package/lib/redux/_modularui/ModularUIConnector.js +2 -5
  251. package/lib/redux/_modularui/ModularUIConnector.js.map +1 -1
  252. package/lib/redux/_modularui/ModularUIReducer.js +6 -3
  253. package/lib/redux/_modularui/ModularUIReducer.js.map +1 -1
  254. package/lib/redux/_modularui/ModularUISelectors.js +12 -18
  255. package/lib/redux/_modularui/ModularUISelectors.js.map +1 -1
  256. package/lib/redux/_modularui/withModularUI.js.map +1 -1
  257. package/lib/redux/actions/Application.js +33 -4
  258. package/lib/redux/actions/Application.js.map +1 -1
  259. package/lib/redux/actions/Authorization.js +23 -26
  260. package/lib/redux/actions/Authorization.js.map +1 -1
  261. package/lib/redux/actions/Error.js +2 -0
  262. package/lib/redux/actions/Error.js.map +1 -1
  263. package/lib/redux/actions/Form.js.map +1 -1
  264. package/lib/redux/actions/FormAttributeSet.js.map +1 -1
  265. package/lib/redux/actions/FormAutosave.js.map +1 -1
  266. package/lib/redux/actions/FormAutosubmit.js.map +1 -1
  267. package/lib/redux/actions/FormAutoupdate.js.map +1 -1
  268. package/lib/redux/actions/FormValidations.js.map +1 -1
  269. package/lib/redux/actions/Notification.js.map +1 -1
  270. package/lib/redux/actions/Preferences.js +4 -4
  271. package/lib/redux/actions/Preferences.js.map +1 -1
  272. package/lib/redux/actions/SignIn.js +2 -4
  273. package/lib/redux/actions/SignIn.js.map +1 -1
  274. package/lib/redux/actions/SignOut.js.map +1 -1
  275. package/lib/redux/connectors/Form.js.map +1 -1
  276. package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
  277. package/lib/redux/connectors/Progress.js.map +1 -1
  278. package/lib/redux/connectors/SignIn.js.map +1 -1
  279. package/lib/redux/connectors/SignOut.js.map +1 -1
  280. package/lib/redux/reducers/ModelCatalogReducer.js +7 -9
  281. package/lib/redux/reducers/ModelCatalogReducer.js.map +1 -1
  282. package/lib/redux/store/configureStore.js +9 -2
  283. package/lib/redux/store/configureStore.js.map +1 -1
  284. package/lib/redux/types.js.map +1 -1
  285. package/lib/utils/browser/Cache.js +3 -1
  286. package/lib/utils/browser/Cache.js.map +1 -1
  287. package/lib/utils/datetime/DateTimeUtil.js +6 -5
  288. package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
  289. package/lib/utils/fetch/universalFetch.js +7 -8
  290. package/lib/utils/fetch/universalFetch.js.map +1 -1
  291. package/lib/utils/fetch/xhr.js +2 -5
  292. package/lib/utils/fetch/xhr.js.map +1 -1
  293. package/lib/utils/helpers/createHref.js +2 -1
  294. package/lib/utils/helpers/createHref.js.map +1 -1
  295. package/lib/utils/helpers/createUUID.js +3 -1
  296. package/lib/utils/helpers/createUUID.js.map +1 -1
  297. package/lib/utils/number/parseNumbers.js +4 -3
  298. package/lib/utils/number/parseNumbers.js.map +1 -1
  299. package/package.json +9 -9
@@ -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":[]}
@@ -10,16 +10,14 @@ const ModelCatalogReducer = (state = initialState, action) => {
10
10
  if (!action) {
11
11
  return state;
12
12
  }
13
- switch (action.type) {
14
- case "UPDATE_ENTRYDATE":
15
- Cache.addItem("ModelCatalogEntryDate", action.payload);
16
- return {
17
- ...state,
18
- entryDate: action.payload
19
- };
20
- default:
21
- return state;
13
+ if (action.type === "UPDATE_ENTRYDATE") {
14
+ Cache.addItem("ModelCatalogEntryDate", action.payload);
15
+ return {
16
+ ...state,
17
+ entryDate: action.payload
18
+ };
22
19
  }
20
+ return state;
23
21
  };
24
22
  export default ModelCatalogReducer;
25
23
  //# sourceMappingURL=ModelCatalogReducer.js.map
@@ -19,16 +19,15 @@ const ModelCatalogReducer: Reducer<ModelCatalogState, ReduxAction> = (
19
19
  return state;
20
20
  }
21
21
 
22
- switch (action.type) {
23
- case "UPDATE_ENTRYDATE":
24
- Cache.addItem("ModelCatalogEntryDate", action.payload);
25
- return {
26
- ...state,
27
- entryDate: action.payload,
28
- };
29
- default:
30
- return state;
22
+ if (action.type === "UPDATE_ENTRYDATE") {
23
+ Cache.addItem("ModelCatalogEntryDate", action.payload);
24
+ return {
25
+ ...state,
26
+ entryDate: action.payload,
27
+ };
31
28
  }
29
+
30
+ return state;
32
31
  };
33
32
 
34
33
  export default ModelCatalogReducer;
@@ -1 +1 @@
1
- {"version":3,"file":"ModelCatalogReducer.js","names":["Cache","initialState","entryDate","Date","toISOString","split","ModelCatalogReducer","state","action","type","addItem","payload"],"sources":["../../../src/redux/reducers/ModelCatalogReducer.js"],"sourcesContent":["// @flow\nimport Cache from \"../../utils/browser/Cache\";\n\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction, ModelCatalogState } from \"../types\";\n\nconst initialState: ModelCatalogState = {\n entryDate: new Date().toISOString().split(\"T\")[0],\n};\n\n/**\n * Keep track of the entry date for the modelcatalog\n */\nconst ModelCatalogReducer: Reducer<ModelCatalogState, ReduxAction> = (\n state = initialState,\n action,\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"UPDATE_ENTRYDATE\":\n Cache.addItem(\"ModelCatalogEntryDate\", action.payload);\n return {\n ...state,\n entryDate: action.payload,\n };\n default:\n return state;\n }\n};\n\nexport default ModelCatalogReducer;\n"],"mappings":"AACA,OAAOA,KAAK,MAAM,2BAA2B;AAK7C,MAAMC,YAA+B,GAAG;EACtCC,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAClD,CAAC;;AAED;AACA;AACA;AACA,MAAMC,mBAA4D,GAAGA,CACnEC,KAAK,GAAGN,YAAY,EACpBO,MAAM,KACH;EACH,IAAI,CAACA,MAAM,EAAE;IACX,OAAOD,KAAK;EACd;EAEA,QAAQC,MAAM,CAACC,IAAI;IACjB,KAAK,kBAAkB;MACrBT,KAAK,CAACU,OAAO,CAAC,uBAAuB,EAAEF,MAAM,CAACG,OAAO,CAAC;MACtD,OAAO;QACL,GAAGJ,KAAK;QACRL,SAAS,EAAEM,MAAM,CAACG;MACpB,CAAC;IACH;MACE,OAAOJ,KAAK;EAChB;AACF,CAAC;AAED,eAAeD,mBAAmB","ignoreList":[]}
1
+ {"version":3,"file":"ModelCatalogReducer.js","names":["Cache","initialState","entryDate","Date","toISOString","split","ModelCatalogReducer","state","action","type","addItem","payload"],"sources":["../../../src/redux/reducers/ModelCatalogReducer.js"],"sourcesContent":["// @flow\nimport Cache from \"../../utils/browser/Cache\";\n\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction, ModelCatalogState } from \"../types\";\n\nconst initialState: ModelCatalogState = {\n entryDate: new Date().toISOString().split(\"T\")[0],\n};\n\n/**\n * Keep track of the entry date for the modelcatalog\n */\nconst ModelCatalogReducer: Reducer<ModelCatalogState, ReduxAction> = (\n state = initialState,\n action,\n) => {\n if (!action) {\n return state;\n }\n\n if (action.type === \"UPDATE_ENTRYDATE\") {\n Cache.addItem(\"ModelCatalogEntryDate\", action.payload);\n return {\n ...state,\n entryDate: action.payload,\n };\n }\n\n return state;\n};\n\nexport default ModelCatalogReducer;\n"],"mappings":"AACA,OAAOA,KAAK,MAAM,2BAA2B;AAK7C,MAAMC,YAA+B,GAAG;EACtCC,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAClD,CAAC;;AAED;AACA;AACA;AACA,MAAMC,mBAA4D,GAAGA,CACnEC,KAAK,GAAGN,YAAY,EACpBO,MAAM,KACH;EACH,IAAI,CAACA,MAAM,EAAE;IACX,OAAOD,KAAK;EACd;EAEA,IAAIC,MAAM,CAACC,IAAI,KAAK,kBAAkB,EAAE;IACtCT,KAAK,CAACU,OAAO,CAAC,uBAAuB,EAAEF,MAAM,CAACG,OAAO,CAAC;IACtD,OAAO;MACL,GAAGJ,KAAK;MACRL,SAAS,EAAEM,MAAM,CAACG;IACpB,CAAC;EACH;EAEA,OAAOJ,KAAK;AACd,CAAC;AAED,eAAeD,mBAAmB","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ import _globalThis from "@babel/runtime-corejs3/core-js/global-this";
1
2
  import { applyMiddleware, compose, combineReducers, createStore as createReduxStore } from "redux";
2
3
  import thunk from "redux-thunk";
3
4
  import { routerMiddleware } from "../_router/RouterMiddleware";
@@ -9,15 +10,21 @@ import { locationChange } from "../_router/RouterActions";
9
10
  const configureStore = (routerHistory, customReducers, initialState) => {
10
11
  let composeEnhancers = compose;
11
12
  if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
12
- composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
13
+ composeEnhancers =
14
+ // $FlowIssue
15
+ _globalThis.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
13
16
  }
17
+ const thunkExtra = {};
14
18
  const combinedReducers = combineReducers({
15
19
  ...customReducers,
16
20
  ...createReducer()
17
21
  });
18
- const middleware = applyMiddleware(modularUIMiddleware, routerMiddleware(routerHistory), thunk);
22
+ const middleware = applyMiddleware(modularUIMiddleware, routerMiddleware(routerHistory), thunk.withExtraArgument(thunkExtra));
19
23
  const enhancers = composeEnhancers(middleware);
20
24
  const store = createReduxStore(combinedReducers, initialState, enhancers);
25
+
26
+ // Populate the extra argument with the store's subscribe method -> use to wait on store updates
27
+ thunkExtra.subscribe = store.subscribe;
21
28
  if (!initialState?.router) {
22
29
  store.dispatch(locationChange(routerHistory.location, "PUSH"));
23
30
  }
@@ -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 = (
@@ -27,9 +31,13 @@ const configureStore = (
27
31
  let composeEnhancers = compose;
28
32
 
29
33
  if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
30
- composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
34
+ composeEnhancers =
35
+ // $FlowIssue
36
+ globalThis.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
31
37
  }
32
38
 
39
+ const thunkExtra: ThunkExtra = {};
40
+
33
41
  const combinedReducers: Reducer<ReduxState, ReduxAction> = combineReducers({
34
42
  ...customReducers,
35
43
  ...createReducer(),
@@ -38,7 +46,7 @@ const configureStore = (
38
46
  const middleware = applyMiddleware(
39
47
  modularUIMiddleware,
40
48
  routerMiddleware(routerHistory),
41
- thunk,
49
+ thunk.withExtraArgument(thunkExtra),
42
50
  );
43
51
 
44
52
  const enhancers = composeEnhancers(middleware);
@@ -49,6 +57,9 @@ const configureStore = (
49
57
  enhancers,
50
58
  );
51
59
 
60
+ // Populate the extra argument with the store's subscribe method -> use to wait on store updates
61
+ thunkExtra.subscribe = store.subscribe;
62
+
52
63
  if (!initialState?.router) {
53
64
  store.dispatch(locationChange(routerHistory.location, "PUSH"));
54
65
  }
@@ -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","_globalThis","__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 =\n // $FlowIssue\n globalThis.__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;IACd;IACAK,WAAA,CAAWC,oCAAoC,IAAInB,OAAO;EAC9D;EAEA,MAAMoB,UAAsB,GAAG,CAAC,CAAC;EAEjC,MAAMC,gBAAkD,GAAGpB,eAAe,CAAC;IACzE,GAAGU,cAAc;IACjB,GAAGJ,aAAa,CAAC;EACnB,CAAC,CAAC;EAEF,MAAMe,UAAU,GAAGvB,eAAe,CAChCO,mBAAmB,EACnBD,gBAAgB,CAACK,aAAa,CAAC,EAC/BN,KAAK,CAACmB,iBAAiB,CAACH,UAAU,CACpC,CAAC;EAED,MAAMI,SAAS,GAAGX,gBAAgB,CAACS,UAAU,CAAC;EAE9C,MAAMG,KAAiB,GAAGtB,gBAAgB,CACxCkB,gBAAgB,EAChBT,YAAY,EACZY,SACF,CAAC;;EAED;EACAJ,UAAU,CAACM,SAAS,GAAGD,KAAK,CAACC,SAAS;EAEtC,IAAI,CAACd,YAAY,EAAEe,MAAM,EAAE;IACzBF,KAAK,CAACG,QAAQ,CAACpB,cAAc,CAACE,aAAa,CAACmB,QAAQ,EAAE,MAAM,CAAC,CAAC;EAChE;EAEA,OAAO;IAAEnB,aAAa;IAAEe;EAAM,CAAC;AACjC,CAAC;AAED,eAAehB,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,39 @@ 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
+
235
+ /**
236
+ * A function that accepts a listener callback and returns an unsubscribe function.
237
+ */
238
+ export type Subscribe = (listener: () => void) => () => void;
239
+
240
+ export type ThunkExtra = {
241
+ subscribe: Subscribe,
242
+ ...
243
+ };
244
+
245
+ // 1. Define ThunkAction first.
246
+ // We use 'any' for Dispatch here temporarily to break the circularity
247
+ // or use the specialized function type.
248
+ export type ThunkAction<R = any> = (
249
+ dispatch: Dispatch,
250
+ getState: GetState,
251
+ extra: ThunkExtra,
252
+ ) => R;
253
+
254
+ export type PromiseAction = Promise<ReduxAction | ThunkAction<any>>;
255
+
256
+ // 2. Define Dispatch as a naked function type.
257
+ // This is much more reliable in modern Flow than DispatchAPI<...>.
258
+ export type Dispatch = (
259
+ action: ReduxAction | ThunkAction<any> | PromiseAction,
260
+ ) => any;
261
+
262
+ // 3. Update ReduxStore to use the ReduxAction for the base reducer
263
+ // but our custom Dispatch for the store instance.
237
264
  export type ReduxStore = Store<ReduxState, ReduxAction, Dispatch>;
238
265
 
239
- export type PossibleAction = ReduxAction | ThunkAction | PromiseAction;
266
+ // 4. Clean up PossibleAction if you still use it elsewhere
267
+ export type PossibleAction = ReduxAction | ThunkAction<any> | PromiseAction;
240
268
 
241
269
  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;\n\n/**\n * A function that accepts a listener callback and returns an unsubscribe function.\n */\nexport type Subscribe = (listener: () => void) => () => void;\n\nexport type ThunkExtra = {\n subscribe: Subscribe,\n ...\n};\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":[]}
@@ -2,6 +2,7 @@ import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
2
2
  import _JSON$stringify from "@babel/runtime-corejs3/core-js-stable/json/stringify";
3
3
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
4
4
  import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
5
+ import _globalThis from "@babel/runtime-corejs3/core-js/global-this";
5
6
  import _Object$entries from "@babel/runtime-corejs3/core-js-stable/object/entries";
6
7
  import _startsWithInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/starts-with";
7
8
  const RESOURCE_CACHE_PREFIX = "res:";
@@ -101,7 +102,8 @@ class Cache {
101
102
  /**
102
103
  */
103
104
  loadOtherBrowserTabs(callback) {
104
- window.addEventListener("storage", e => {
105
+ // $FlowIssue
106
+ _globalThis.addEventListener("storage", e => {
105
107
  this.sendSessionStorage(e);
106
108
  this.receiveSessionStorage(e, callback);
107
109
  });
@@ -110,7 +110,8 @@ class Cache {
110
110
  /**
111
111
  */
112
112
  loadOtherBrowserTabs(callback: Function) {
113
- window.addEventListener("storage", (e) => {
113
+ // $FlowIssue
114
+ globalThis.addEventListener("storage", (e) => {
114
115
  this.sendSessionStorage(e);
115
116
  this.receiveSessionStorage(e, callback);
116
117
  });