@beinformed/ui 1.25.0 → 1.25.1-beta.1

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 (534) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/esm/builder/mergeLayoutHintConfigurations.js.map +1 -1
  3. package/esm/constants/Settings.js.map +1 -1
  4. package/esm/hooks/useAuthentication.js +1 -1
  5. package/esm/hooks/useAuthentication.js.map +1 -1
  6. package/esm/hooks/useModelCatalog.js +0 -1
  7. package/esm/hooks/useModelCatalog.js.map +1 -1
  8. package/esm/hooks/useModels.js +1 -1
  9. package/esm/hooks/useModels.js.map +1 -1
  10. package/esm/hooks/useModularUI.js +1 -1
  11. package/esm/hooks/useModularUI.js.map +1 -1
  12. package/esm/hooks/useModularUIBasic.js +4 -1
  13. package/esm/hooks/useModularUIBasic.js.map +1 -1
  14. package/esm/hooks/useRouter.js +1 -1
  15. package/esm/hooks/useRouter.js.map +1 -1
  16. package/esm/models/attributes/AttributeCollection.js.map +1 -1
  17. package/esm/models/attributes/AttributeModel.js.map +1 -1
  18. package/esm/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
  19. package/esm/models/attributes/NumberAttributeModel.js +5 -2
  20. package/esm/models/attributes/NumberAttributeModel.js.map +1 -1
  21. package/esm/models/attributes/_createAttribute.js.map +1 -1
  22. package/esm/models/attributes/layouthint-rules/BaseLayoutHintRule.js.map +1 -1
  23. package/esm/models/attributes/layouthint-rules/DependentAttribute.js.map +1 -1
  24. package/esm/models/base/ResourceModel.js.map +1 -1
  25. package/esm/models/content/ContentTOCModel.js.map +1 -1
  26. package/esm/models/filters/FilterCollection.js.map +1 -1
  27. package/esm/models/form/FormModel.js.map +1 -1
  28. package/esm/models/links/LinkModel.js +3 -1
  29. package/esm/models/links/LinkModel.js.map +1 -1
  30. package/esm/models/links/normalizeLinkJSON.js.map +1 -1
  31. package/esm/models/list/ListModel.js.map +1 -1
  32. package/esm/models/parameter/Parameter.js +1 -1
  33. package/esm/models/parameter/Parameter.js.map +1 -1
  34. package/esm/models/types.js.map +1 -1
  35. package/esm/modularui/ModularUIRequest.js.map +1 -1
  36. package/esm/react-client/client.js +1 -1
  37. package/esm/react-client/client.js.map +1 -1
  38. package/esm/react-client/rehydrate.js.map +1 -1
  39. package/esm/react-server/createSSRComplete.js.map +1 -1
  40. package/esm/react-server/renderSSRComplete.js +4 -2
  41. package/esm/react-server/renderSSRComplete.js.map +1 -1
  42. package/esm/react-server/serverUtil.js +18 -9
  43. package/esm/react-server/serverUtil.js.map +1 -1
  44. package/esm/react-theme/ThemeProvider.js +1 -1
  45. package/esm/react-theme/ThemeProvider.js.map +1 -1
  46. package/esm/react-theme/createTheme.js +8 -3
  47. package/esm/react-theme/createTheme.js.map +1 -1
  48. package/esm/react-theme/utils/contrast.js +3 -1
  49. package/esm/react-theme/utils/contrast.js.map +1 -1
  50. package/esm/react-theme/utils/corners.js +3 -1
  51. package/esm/react-theme/utils/corners.js.map +1 -1
  52. package/esm/react-theme/utils/spacers.js +9 -3
  53. package/esm/react-theme/utils/spacers.js.map +1 -1
  54. package/esm/redux/_i18n/{actions.js → I18nActions.js} +1 -1
  55. package/esm/redux/_i18n/I18nActions.js.map +1 -0
  56. package/esm/redux/_i18n/{reducer.js → I18nReducer.js} +1 -1
  57. package/esm/redux/_i18n/I18nReducer.js.map +1 -0
  58. package/esm/redux/_i18n/index.js +2 -2
  59. package/esm/redux/_i18n/index.js.map +1 -1
  60. package/esm/redux/_modularui/{actions.js → ModularUIActions.js} +1 -1
  61. package/esm/redux/_modularui/ModularUIActions.js.map +1 -0
  62. package/esm/redux/_modularui/{connector.js → ModularUIConnector.js} +5 -5
  63. package/esm/redux/_modularui/ModularUIConnector.js.map +1 -0
  64. package/esm/redux/_modularui/{middleware.js → ModularUIMiddleware.js} +2 -2
  65. package/esm/redux/_modularui/ModularUIMiddleware.js.map +1 -0
  66. package/esm/redux/_modularui/{reducer.js → ModularUIReducer.js} +4 -6
  67. package/esm/redux/_modularui/ModularUIReducer.js.map +1 -0
  68. package/esm/redux/_modularui/{selectors.js → ModularUISelectors.js} +1 -1
  69. package/esm/redux/_modularui/ModularUISelectors.js.map +1 -0
  70. package/esm/redux/_modularui/{modularuiUtils.js → ModularUIUtils.js} +1 -1
  71. package/esm/redux/_modularui/{modularuiUtils.js.map → ModularUIUtils.js.map} +1 -1
  72. package/esm/redux/_modularui/index.js +6 -6
  73. package/esm/redux/_modularui/index.js.map +1 -1
  74. package/esm/redux/_modularui/types.js.map +1 -1
  75. package/esm/redux/_modularui/withModularUI.js +1 -1
  76. package/esm/redux/_modularui/withModularUI.js.map +1 -1
  77. package/esm/redux/_router/{actions.js → RouterActions.js} +1 -1
  78. package/esm/redux/_router/RouterActions.js.map +1 -0
  79. package/esm/redux/_router/{connectors.js → RouterConnectors.js} +2 -2
  80. package/esm/redux/_router/RouterConnectors.js.map +1 -0
  81. package/esm/redux/_router/{middleware.js → RouterMiddleware.js} +1 -1
  82. package/esm/redux/_router/RouterMiddleware.js.map +1 -0
  83. package/esm/redux/_router/{reducer.js → RouterReducer.js} +1 -1
  84. package/esm/redux/_router/RouterReducer.js.map +1 -0
  85. package/esm/redux/_router/index.js +4 -4
  86. package/esm/redux/_router/index.js.map +1 -1
  87. package/esm/redux/actions/Application.js +2 -2
  88. package/esm/redux/actions/Application.js.map +1 -1
  89. package/esm/redux/actions/Authorization.js +3 -3
  90. package/esm/redux/actions/Authorization.js.map +1 -1
  91. package/esm/redux/actions/Error.js +1 -1
  92. package/esm/redux/actions/Error.js.map +1 -1
  93. package/esm/redux/actions/Form.js +2 -2
  94. package/esm/redux/actions/Form.js.map +1 -1
  95. package/esm/redux/actions/FormAttributeSet.js +1 -1
  96. package/esm/redux/actions/FormAttributeSet.js.map +1 -1
  97. package/esm/redux/actions/FormAttributeSetRepeatable.js +1 -1
  98. package/esm/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
  99. package/esm/redux/actions/FormAutosave.js +1 -1
  100. package/esm/redux/actions/FormAutosave.js.map +1 -1
  101. package/esm/redux/actions/FormAutosubmit.js +1 -1
  102. package/esm/redux/actions/FormAutosubmit.js.map +1 -1
  103. package/esm/redux/actions/FormValidations.js +1 -1
  104. package/esm/redux/actions/FormValidations.js.map +1 -1
  105. package/esm/redux/actions/Notification.js.map +1 -1
  106. package/esm/redux/actions/Preferences.js +1 -1
  107. package/esm/redux/actions/Preferences.js.map +1 -1
  108. package/esm/redux/actions/SignIn.js +1 -1
  109. package/esm/redux/actions/SignIn.js.map +1 -1
  110. package/esm/redux/actions/SignOut.js +1 -1
  111. package/esm/redux/actions/SignOut.js.map +1 -1
  112. package/esm/redux/connectors/Application.js +1 -1
  113. package/esm/redux/connectors/Application.js.map +1 -1
  114. package/esm/redux/connectors/Breadcrumb.js +1 -1
  115. package/esm/redux/connectors/Breadcrumb.js.map +1 -1
  116. package/esm/redux/connectors/CaseView.js +1 -1
  117. package/esm/redux/connectors/CaseView.js.map +1 -1
  118. package/esm/redux/connectors/ConceptDetail.js +1 -1
  119. package/esm/redux/connectors/ConceptDetail.js.map +1 -1
  120. package/esm/redux/connectors/ContentBrowser.js +1 -1
  121. package/esm/redux/connectors/ContentBrowser.js.map +1 -1
  122. package/esm/redux/connectors/ContentDetail.js +1 -1
  123. package/esm/redux/connectors/ContentDetail.js.map +1 -1
  124. package/esm/redux/connectors/ContentDetailSection.js +1 -1
  125. package/esm/redux/connectors/ContentDetailSection.js.map +1 -1
  126. package/esm/redux/connectors/Form.js +1 -1
  127. package/esm/redux/connectors/Form.js.map +1 -1
  128. package/esm/redux/connectors/ListDetail.js +1 -1
  129. package/esm/redux/connectors/ListDetail.js.map +1 -1
  130. package/esm/redux/connectors/ModelCatalog.js +1 -1
  131. package/esm/redux/connectors/ModelCatalog.js.map +1 -1
  132. package/esm/redux/connectors/PanelRenderer.js +1 -1
  133. package/esm/redux/connectors/PanelRenderer.js.map +1 -1
  134. package/esm/redux/connectors/Preferences.js.map +1 -1
  135. package/esm/redux/connectors/QuickSearch.js +2 -2
  136. package/esm/redux/connectors/QuickSearch.js.map +1 -1
  137. package/esm/redux/connectors/SignIn.js +1 -1
  138. package/esm/redux/connectors/SignIn.js.map +1 -1
  139. package/esm/redux/connectors/SignOut.js.map +1 -1
  140. package/esm/redux/connectors/Tab.js +1 -1
  141. package/esm/redux/connectors/Tab.js.map +1 -1
  142. package/esm/redux/reducers/ModalsReducer.js.map +1 -1
  143. package/esm/redux/reducers/ProgressIndicatorReducer.js.map +1 -1
  144. package/esm/redux/reducers/createReducer.js +3 -3
  145. package/esm/redux/reducers/createReducer.js.map +1 -1
  146. package/esm/redux/store/configureStore.js +4 -4
  147. package/esm/redux/store/configureStore.js.map +1 -1
  148. package/esm/utils/fetch/universalFetch.js +3 -2
  149. package/esm/utils/fetch/universalFetch.js.map +1 -1
  150. package/esm/utils/fetch/xhr.js.map +1 -1
  151. package/esm/utils/helpers/objects.js +4 -3
  152. package/esm/utils/helpers/objects.js.map +1 -1
  153. package/esm/utils/helpers/sanitizeHtml.js.map +1 -1
  154. package/esm/utils/number/parseNumbers.js.map +1 -1
  155. package/lib/builder/mergeLayoutHintConfigurations.js.flow +1 -1
  156. package/lib/builder/mergeLayoutHintConfigurations.js.map +1 -1
  157. package/lib/constants/Settings.js.flow +1 -1
  158. package/lib/constants/Settings.js.map +1 -1
  159. package/lib/hooks/useAuthentication.js +3 -3
  160. package/lib/hooks/useAuthentication.js.flow +1 -1
  161. package/lib/hooks/useAuthentication.js.map +1 -1
  162. package/lib/hooks/useModelCatalog.js.flow +2 -1
  163. package/lib/hooks/useModelCatalog.js.map +1 -1
  164. package/lib/hooks/useModels.js +2 -2
  165. package/lib/hooks/useModels.js.flow +1 -1
  166. package/lib/hooks/useModels.js.map +1 -1
  167. package/lib/hooks/useModularUI.js +3 -3
  168. package/lib/hooks/useModularUI.js.flow +4 -1
  169. package/lib/hooks/useModularUI.js.map +1 -1
  170. package/lib/hooks/useModularUIBasic.js +4 -1
  171. package/lib/hooks/useModularUIBasic.js.flow +1 -1
  172. package/lib/hooks/useModularUIBasic.js.map +1 -1
  173. package/lib/hooks/useRouter.js +6 -6
  174. package/lib/hooks/useRouter.js.flow +7 -1
  175. package/lib/hooks/useRouter.js.map +1 -1
  176. package/lib/models/attributes/AttributeCollection.js.flow +8 -6
  177. package/lib/models/attributes/AttributeCollection.js.map +1 -1
  178. package/lib/models/attributes/AttributeModel.js.flow +18 -16
  179. package/lib/models/attributes/AttributeModel.js.map +1 -1
  180. package/lib/models/attributes/CompositeAttributeChildCollection.js.flow +1 -1
  181. package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
  182. package/lib/models/attributes/NumberAttributeModel.js +5 -2
  183. package/lib/models/attributes/NumberAttributeModel.js.flow +7 -3
  184. package/lib/models/attributes/NumberAttributeModel.js.map +1 -1
  185. package/lib/models/attributes/_createAttribute.js.flow +1 -1
  186. package/lib/models/attributes/_createAttribute.js.map +1 -1
  187. package/lib/models/attributes/layouthint-rules/BaseLayoutHintRule.js.flow +1 -1
  188. package/lib/models/attributes/layouthint-rules/BaseLayoutHintRule.js.map +1 -1
  189. package/lib/models/attributes/layouthint-rules/DependentAttribute.js.flow +1 -1
  190. package/lib/models/attributes/layouthint-rules/DependentAttribute.js.map +1 -1
  191. package/lib/models/base/ResourceModel.js.flow +1 -1
  192. package/lib/models/base/ResourceModel.js.map +1 -1
  193. package/lib/models/content/ContentTOCModel.js.flow +4 -1
  194. package/lib/models/content/ContentTOCModel.js.map +1 -1
  195. package/lib/models/filters/FilterCollection.js.flow +1 -1
  196. package/lib/models/filters/FilterCollection.js.map +1 -1
  197. package/lib/models/form/FormModel.js.flow +2 -2
  198. package/lib/models/form/FormModel.js.map +1 -1
  199. package/lib/models/links/LinkModel.js +3 -1
  200. package/lib/models/links/LinkModel.js.flow +4 -2
  201. package/lib/models/links/LinkModel.js.map +1 -1
  202. package/lib/models/links/normalizeLinkJSON.js.flow +1 -1
  203. package/lib/models/links/normalizeLinkJSON.js.map +1 -1
  204. package/lib/models/list/ListModel.js.flow +1 -1
  205. package/lib/models/list/ListModel.js.map +1 -1
  206. package/lib/models/parameter/Parameter.js +1 -1
  207. package/lib/models/parameter/Parameter.js.flow +1 -1
  208. package/lib/models/parameter/Parameter.js.map +1 -1
  209. package/lib/models/types.js.flow +6 -6
  210. package/lib/models/types.js.map +1 -1
  211. package/lib/modularui/ModularUIRequest.js.flow +6 -6
  212. package/lib/modularui/ModularUIRequest.js.map +1 -1
  213. package/lib/react-client/client.js +2 -2
  214. package/lib/react-client/client.js.flow +8 -8
  215. package/lib/react-client/client.js.map +1 -1
  216. package/lib/react-client/rehydrate.js.flow +2 -2
  217. package/lib/react-client/rehydrate.js.map +1 -1
  218. package/lib/react-server/createSSRComplete.js.flow +3 -3
  219. package/lib/react-server/createSSRComplete.js.map +1 -1
  220. package/lib/react-server/renderSSRComplete.js +4 -2
  221. package/lib/react-server/renderSSRComplete.js.flow +2 -2
  222. package/lib/react-server/renderSSRComplete.js.map +1 -1
  223. package/lib/react-server/serverUtil.js +19 -10
  224. package/lib/react-server/serverUtil.js.flow +20 -11
  225. package/lib/react-server/serverUtil.js.map +1 -1
  226. package/lib/react-theme/ThemeProvider.js +1 -1
  227. package/lib/react-theme/ThemeProvider.js.flow +1 -1
  228. package/lib/react-theme/ThemeProvider.js.map +1 -1
  229. package/lib/react-theme/__tests__/ThemeProvider.spec.js.flow +2 -0
  230. package/lib/react-theme/__tests__/createTheme.spec.js.flow +3 -0
  231. package/lib/react-theme/createTheme.js +8 -3
  232. package/lib/react-theme/createTheme.js.flow +7 -5
  233. package/lib/react-theme/createTheme.js.map +1 -1
  234. package/lib/react-theme/utils/contrast.js +3 -1
  235. package/lib/react-theme/utils/contrast.js.flow +1 -1
  236. package/lib/react-theme/utils/contrast.js.map +1 -1
  237. package/lib/react-theme/utils/corners.js +3 -1
  238. package/lib/react-theme/utils/corners.js.flow +1 -1
  239. package/lib/react-theme/utils/corners.js.map +1 -1
  240. package/lib/react-theme/utils/spacers.js +9 -3
  241. package/lib/react-theme/utils/spacers.js.flow +3 -3
  242. package/lib/react-theme/utils/spacers.js.map +1 -1
  243. package/lib/redux/_i18n/{actions.js → I18nActions.js} +1 -1
  244. package/lib/redux/_i18n/{actions.js.flow → I18nActions.js.flow} +0 -0
  245. package/lib/redux/_i18n/I18nActions.js.map +1 -0
  246. package/lib/redux/_i18n/{reducer.js → I18nReducer.js} +1 -1
  247. package/{src/redux/_i18n/reducer.js → lib/redux/_i18n/I18nReducer.js.flow} +5 -2
  248. package/lib/redux/_i18n/I18nReducer.js.map +1 -0
  249. package/lib/redux/_i18n/__tests__/actions.spec.js.flow +1 -1
  250. package/lib/redux/_i18n/__tests__/reducer.spec.js.flow +1 -1
  251. package/lib/redux/_i18n/index.js +8 -8
  252. package/lib/redux/_i18n/index.js.flow +2 -2
  253. package/lib/redux/_i18n/index.js.map +1 -1
  254. package/lib/redux/_modularui/{actions.js → ModularUIActions.js} +1 -1
  255. package/lib/redux/_modularui/{actions.js.flow → ModularUIActions.js.flow} +1 -1
  256. package/lib/redux/_modularui/ModularUIActions.js.map +1 -0
  257. package/lib/redux/_modularui/{connector.js → ModularUIConnector.js} +11 -11
  258. package/{src/redux/_modularui/connector.js → lib/redux/_modularui/ModularUIConnector.js.flow} +8 -4
  259. package/lib/redux/_modularui/ModularUIConnector.js.map +1 -0
  260. package/lib/redux/_modularui/{middleware.js → ModularUIMiddleware.js} +4 -4
  261. package/lib/redux/_modularui/{middleware.js.flow → ModularUIMiddleware.js.flow} +20 -5
  262. package/lib/redux/_modularui/ModularUIMiddleware.js.map +1 -0
  263. package/lib/redux/_modularui/{reducer.js → ModularUIReducer.js} +4 -6
  264. package/lib/redux/_modularui/{reducer.js.flow → ModularUIReducer.js.flow} +14 -8
  265. package/lib/redux/_modularui/ModularUIReducer.js.map +1 -0
  266. package/lib/redux/_modularui/{selectors.js → ModularUISelectors.js} +1 -1
  267. package/lib/redux/_modularui/{selectors.js.flow → ModularUISelectors.js.flow} +3 -2
  268. package/lib/redux/_modularui/ModularUISelectors.js.map +1 -0
  269. package/lib/redux/_modularui/{modularuiUtils.js → ModularUIUtils.js} +1 -1
  270. package/lib/redux/_modularui/{modularuiUtils.js.flow → ModularUIUtils.js.flow} +0 -0
  271. package/lib/redux/_modularui/{modularuiUtils.js.map → ModularUIUtils.js.map} +1 -1
  272. package/lib/redux/_modularui/__tests__/actions.spec.js.flow +1 -1
  273. package/lib/redux/_modularui/__tests__/reducer.spec.js.flow +6 -4
  274. package/lib/redux/_modularui/__tests__/selectors.spec.js.flow +1 -1
  275. package/lib/redux/_modularui/index.js +22 -22
  276. package/lib/redux/_modularui/index.js.flow +6 -6
  277. package/lib/redux/_modularui/index.js.map +1 -1
  278. package/lib/redux/_modularui/types.js.flow +10 -4
  279. package/lib/redux/_modularui/types.js.map +1 -1
  280. package/lib/redux/_modularui/withModularUI.js +2 -2
  281. package/lib/redux/_modularui/withModularUI.js.flow +1 -1
  282. package/lib/redux/_modularui/withModularUI.js.map +1 -1
  283. package/lib/redux/_router/{actions.js → RouterActions.js} +1 -1
  284. package/lib/redux/_router/{actions.js.flow → RouterActions.js.flow} +0 -0
  285. package/lib/redux/_router/RouterActions.js.map +1 -0
  286. package/lib/redux/_router/{connectors.js → RouterConnectors.js} +7 -7
  287. package/lib/redux/_router/{connectors.js.flow → RouterConnectors.js.flow} +1 -1
  288. package/lib/redux/_router/RouterConnectors.js.map +1 -0
  289. package/lib/redux/_router/{middleware.js → RouterMiddleware.js} +1 -1
  290. package/lib/redux/_router/{middleware.js.flow → RouterMiddleware.js.flow} +0 -0
  291. package/lib/redux/_router/RouterMiddleware.js.map +1 -0
  292. package/lib/redux/_router/{reducer.js → RouterReducer.js} +1 -1
  293. package/lib/redux/_router/{reducer.js.flow → RouterReducer.js.flow} +0 -0
  294. package/lib/redux/_router/RouterReducer.js.map +1 -0
  295. package/lib/redux/_router/__tests__/actions.spec.js.flow +1 -1
  296. package/lib/redux/_router/__tests__/middleware.spec.js.flow +2 -2
  297. package/lib/redux/_router/__tests__/reducer.spec.js.flow +1 -1
  298. package/lib/redux/_router/index.js +16 -16
  299. package/lib/redux/_router/index.js.flow +4 -4
  300. package/lib/redux/_router/index.js.map +1 -1
  301. package/lib/redux/actions/Application.js +5 -5
  302. package/lib/redux/actions/Application.js.flow +5 -2
  303. package/lib/redux/actions/Application.js.map +1 -1
  304. package/lib/redux/actions/Authorization.js +6 -6
  305. package/lib/redux/actions/Authorization.js.flow +3 -3
  306. package/lib/redux/actions/Authorization.js.map +1 -1
  307. package/lib/redux/actions/Error.js +2 -2
  308. package/lib/redux/actions/Error.js.flow +2 -2
  309. package/lib/redux/actions/Error.js.map +1 -1
  310. package/lib/redux/actions/Form.js +5 -5
  311. package/lib/redux/actions/Form.js.flow +2 -2
  312. package/lib/redux/actions/Form.js.map +1 -1
  313. package/lib/redux/actions/FormAttributeSet.js +2 -2
  314. package/lib/redux/actions/FormAttributeSet.js.flow +1 -1
  315. package/lib/redux/actions/FormAttributeSet.js.map +1 -1
  316. package/lib/redux/actions/FormAttributeSetRepeatable.js +4 -4
  317. package/lib/redux/actions/FormAttributeSetRepeatable.js.flow +1 -1
  318. package/lib/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
  319. package/lib/redux/actions/FormAutosave.js +2 -2
  320. package/lib/redux/actions/FormAutosave.js.flow +1 -1
  321. package/lib/redux/actions/FormAutosave.js.map +1 -1
  322. package/lib/redux/actions/FormAutosubmit.js +2 -2
  323. package/lib/redux/actions/FormAutosubmit.js.flow +1 -1
  324. package/lib/redux/actions/FormAutosubmit.js.map +1 -1
  325. package/lib/redux/actions/FormValidations.js +2 -2
  326. package/lib/redux/actions/FormValidations.js.flow +5 -3
  327. package/lib/redux/actions/FormValidations.js.map +1 -1
  328. package/lib/redux/actions/Notification.js.flow +1 -1
  329. package/lib/redux/actions/Notification.js.map +1 -1
  330. package/lib/redux/actions/Preferences.js +1 -1
  331. package/lib/redux/actions/Preferences.js.flow +3 -3
  332. package/lib/redux/actions/Preferences.js.map +1 -1
  333. package/lib/redux/actions/SignIn.js +2 -2
  334. package/lib/redux/actions/SignIn.js.flow +1 -1
  335. package/lib/redux/actions/SignIn.js.map +1 -1
  336. package/lib/redux/actions/SignOut.js +2 -2
  337. package/lib/redux/actions/SignOut.js.flow +1 -1
  338. package/lib/redux/actions/SignOut.js.map +1 -1
  339. package/lib/redux/connectors/Application.js +2 -2
  340. package/lib/redux/connectors/Application.js.flow +1 -1
  341. package/lib/redux/connectors/Application.js.map +1 -1
  342. package/lib/redux/connectors/Breadcrumb.js +2 -2
  343. package/lib/redux/connectors/Breadcrumb.js.flow +1 -1
  344. package/lib/redux/connectors/Breadcrumb.js.map +1 -1
  345. package/lib/redux/connectors/CaseView.js +2 -2
  346. package/lib/redux/connectors/CaseView.js.flow +1 -1
  347. package/lib/redux/connectors/CaseView.js.map +1 -1
  348. package/lib/redux/connectors/ConceptDetail.js +2 -2
  349. package/lib/redux/connectors/ConceptDetail.js.flow +1 -1
  350. package/lib/redux/connectors/ConceptDetail.js.map +1 -1
  351. package/lib/redux/connectors/ContentBrowser.js +2 -2
  352. package/lib/redux/connectors/ContentBrowser.js.flow +1 -1
  353. package/lib/redux/connectors/ContentBrowser.js.map +1 -1
  354. package/lib/redux/connectors/ContentDetail.js +2 -2
  355. package/lib/redux/connectors/ContentDetail.js.flow +1 -1
  356. package/lib/redux/connectors/ContentDetail.js.map +1 -1
  357. package/lib/redux/connectors/ContentDetailSection.js +2 -2
  358. package/lib/redux/connectors/ContentDetailSection.js.flow +1 -1
  359. package/lib/redux/connectors/ContentDetailSection.js.map +1 -1
  360. package/lib/redux/connectors/Form.js +2 -2
  361. package/lib/redux/connectors/Form.js.flow +1 -1
  362. package/lib/redux/connectors/Form.js.map +1 -1
  363. package/lib/redux/connectors/ListDetail.js +2 -2
  364. package/lib/redux/connectors/ListDetail.js.flow +1 -1
  365. package/lib/redux/connectors/ListDetail.js.map +1 -1
  366. package/lib/redux/connectors/ModelCatalog.js +2 -2
  367. package/lib/redux/connectors/ModelCatalog.js.flow +1 -1
  368. package/lib/redux/connectors/ModelCatalog.js.map +1 -1
  369. package/lib/redux/connectors/PanelRenderer.js +2 -2
  370. package/lib/redux/connectors/PanelRenderer.js.flow +1 -1
  371. package/lib/redux/connectors/PanelRenderer.js.map +1 -1
  372. package/lib/redux/connectors/Preferences.js.flow +5 -2
  373. package/lib/redux/connectors/Preferences.js.map +1 -1
  374. package/lib/redux/connectors/QuickSearch.js +4 -4
  375. package/lib/redux/connectors/QuickSearch.js.flow +2 -2
  376. package/lib/redux/connectors/QuickSearch.js.map +1 -1
  377. package/lib/redux/connectors/SignIn.js +2 -2
  378. package/lib/redux/connectors/SignIn.js.flow +1 -1
  379. package/lib/redux/connectors/SignIn.js.map +1 -1
  380. package/lib/redux/connectors/SignOut.js.flow +2 -2
  381. package/lib/redux/connectors/SignOut.js.map +1 -1
  382. package/lib/redux/connectors/Tab.js +2 -2
  383. package/lib/redux/connectors/Tab.js.flow +1 -1
  384. package/lib/redux/connectors/Tab.js.map +1 -1
  385. package/lib/redux/reducers/ModalsReducer.js.flow +2 -2
  386. package/lib/redux/reducers/ModalsReducer.js.map +1 -1
  387. package/lib/redux/reducers/ProgressIndicatorReducer.js.flow +1 -1
  388. package/lib/redux/reducers/ProgressIndicatorReducer.js.map +1 -1
  389. package/lib/redux/reducers/createReducer.js +6 -6
  390. package/lib/redux/reducers/createReducer.js.flow +3 -3
  391. package/lib/redux/reducers/createReducer.js.map +1 -1
  392. package/lib/redux/store/configureStore.js +5 -5
  393. package/lib/redux/store/configureStore.js.flow +4 -4
  394. package/lib/redux/store/configureStore.js.map +1 -1
  395. package/lib/utils/fetch/universalFetch.js +5 -3
  396. package/lib/utils/fetch/universalFetch.js.flow +8 -6
  397. package/lib/utils/fetch/universalFetch.js.map +1 -1
  398. package/lib/utils/fetch/xhr.js.flow +21 -21
  399. package/lib/utils/fetch/xhr.js.map +1 -1
  400. package/lib/utils/helpers/objects.js.flow +5 -3
  401. package/lib/utils/helpers/objects.js.map +1 -1
  402. package/lib/utils/helpers/sanitizeHtml.js.flow +1 -1
  403. package/lib/utils/helpers/sanitizeHtml.js.map +1 -1
  404. package/lib/utils/number/parseNumbers.js.flow +8 -2
  405. package/lib/utils/number/parseNumbers.js.map +1 -1
  406. package/package.json +8 -8
  407. package/src/builder/mergeLayoutHintConfigurations.js +1 -1
  408. package/src/constants/Settings.js +1 -1
  409. package/src/hooks/useAuthentication.js +1 -1
  410. package/src/hooks/useModelCatalog.js +2 -1
  411. package/src/hooks/useModels.js +1 -1
  412. package/src/hooks/useModularUI.js +4 -1
  413. package/src/hooks/useModularUIBasic.js +1 -1
  414. package/src/hooks/useRouter.js +7 -1
  415. package/src/models/attributes/AttributeCollection.js +8 -6
  416. package/src/models/attributes/AttributeModel.js +18 -16
  417. package/src/models/attributes/CompositeAttributeChildCollection.js +1 -1
  418. package/src/models/attributes/NumberAttributeModel.js +7 -3
  419. package/src/models/attributes/_createAttribute.js +1 -1
  420. package/src/models/attributes/layouthint-rules/BaseLayoutHintRule.js +1 -1
  421. package/src/models/attributes/layouthint-rules/DependentAttribute.js +1 -1
  422. package/src/models/base/ResourceModel.js +1 -1
  423. package/src/models/content/ContentTOCModel.js +4 -1
  424. package/src/models/filters/FilterCollection.js +1 -1
  425. package/src/models/form/FormModel.js +2 -2
  426. package/src/models/links/LinkModel.js +4 -2
  427. package/src/models/links/normalizeLinkJSON.js +1 -1
  428. package/src/models/list/ListModel.js +1 -1
  429. package/src/models/parameter/Parameter.js +1 -1
  430. package/src/models/types.js +6 -6
  431. package/src/modularui/ModularUIRequest.js +6 -6
  432. package/src/react-client/client.js +8 -8
  433. package/src/react-client/rehydrate.js +2 -2
  434. package/src/react-server/createSSRComplete.js +3 -3
  435. package/src/react-server/renderSSRComplete.js +2 -2
  436. package/src/react-server/serverUtil.js +20 -11
  437. package/src/react-theme/ThemeProvider.js +1 -1
  438. package/src/react-theme/__tests__/ThemeProvider.spec.js +2 -0
  439. package/src/react-theme/__tests__/createTheme.spec.js +3 -0
  440. package/src/react-theme/createTheme.js +7 -5
  441. package/src/react-theme/utils/contrast.js +1 -1
  442. package/src/react-theme/utils/corners.js +1 -1
  443. package/src/react-theme/utils/spacers.js +3 -3
  444. package/src/redux/_i18n/{actions.js → I18nActions.js} +0 -0
  445. package/{lib/redux/_i18n/reducer.js.flow → src/redux/_i18n/I18nReducer.js} +5 -2
  446. package/src/redux/_i18n/__tests__/actions.spec.js +1 -1
  447. package/src/redux/_i18n/__tests__/reducer.spec.js +1 -1
  448. package/src/redux/_i18n/index.js +2 -2
  449. package/src/redux/_modularui/{actions.js → ModularUIActions.js} +1 -1
  450. package/{lib/redux/_modularui/connector.js.flow → src/redux/_modularui/ModularUIConnector.js} +8 -4
  451. package/src/redux/_modularui/{middleware.js → ModularUIMiddleware.js} +20 -5
  452. package/src/redux/_modularui/{reducer.js → ModularUIReducer.js} +14 -8
  453. package/src/redux/_modularui/{selectors.js → ModularUISelectors.js} +3 -2
  454. package/src/redux/_modularui/{modularuiUtils.js → ModularUIUtils.js} +0 -0
  455. package/src/redux/_modularui/__tests__/actions.spec.js +1 -1
  456. package/src/redux/_modularui/__tests__/reducer.spec.js +6 -4
  457. package/src/redux/_modularui/__tests__/selectors.spec.js +1 -1
  458. package/src/redux/_modularui/index.js +6 -6
  459. package/src/redux/_modularui/types.js +10 -4
  460. package/src/redux/_modularui/withModularUI.js +1 -1
  461. package/src/redux/_router/{actions.js → RouterActions.js} +0 -0
  462. package/src/redux/_router/{connectors.js → RouterConnectors.js} +1 -1
  463. package/src/redux/_router/{middleware.js → RouterMiddleware.js} +0 -0
  464. package/src/redux/_router/{reducer.js → RouterReducer.js} +0 -0
  465. package/src/redux/_router/__tests__/actions.spec.js +1 -1
  466. package/src/redux/_router/__tests__/middleware.spec.js +2 -2
  467. package/src/redux/_router/__tests__/reducer.spec.js +1 -1
  468. package/src/redux/_router/index.js +4 -4
  469. package/src/redux/actions/Application.js +5 -2
  470. package/src/redux/actions/Authorization.js +3 -3
  471. package/src/redux/actions/Error.js +2 -2
  472. package/src/redux/actions/Form.js +2 -2
  473. package/src/redux/actions/FormAttributeSet.js +1 -1
  474. package/src/redux/actions/FormAttributeSetRepeatable.js +1 -1
  475. package/src/redux/actions/FormAutosave.js +1 -1
  476. package/src/redux/actions/FormAutosubmit.js +1 -1
  477. package/src/redux/actions/FormValidations.js +5 -3
  478. package/src/redux/actions/Notification.js +1 -1
  479. package/src/redux/actions/Preferences.js +3 -3
  480. package/src/redux/actions/SignIn.js +1 -1
  481. package/src/redux/actions/SignOut.js +1 -1
  482. package/src/redux/connectors/Application.js +1 -1
  483. package/src/redux/connectors/Breadcrumb.js +1 -1
  484. package/src/redux/connectors/CaseView.js +1 -1
  485. package/src/redux/connectors/ConceptDetail.js +1 -1
  486. package/src/redux/connectors/ContentBrowser.js +1 -1
  487. package/src/redux/connectors/ContentDetail.js +1 -1
  488. package/src/redux/connectors/ContentDetailSection.js +1 -1
  489. package/src/redux/connectors/Form.js +1 -1
  490. package/src/redux/connectors/ListDetail.js +1 -1
  491. package/src/redux/connectors/ModelCatalog.js +1 -1
  492. package/src/redux/connectors/PanelRenderer.js +1 -1
  493. package/src/redux/connectors/Preferences.js +5 -2
  494. package/src/redux/connectors/QuickSearch.js +2 -2
  495. package/src/redux/connectors/SignIn.js +1 -1
  496. package/src/redux/connectors/SignOut.js +2 -2
  497. package/src/redux/connectors/Tab.js +1 -1
  498. package/src/redux/reducers/ModalsReducer.js +2 -2
  499. package/src/redux/reducers/ProgressIndicatorReducer.js +1 -1
  500. package/src/redux/reducers/createReducer.js +3 -3
  501. package/src/redux/store/configureStore.js +4 -4
  502. package/src/utils/fetch/universalFetch.js +8 -6
  503. package/src/utils/fetch/xhr.js +21 -21
  504. package/src/utils/helpers/objects.js +5 -3
  505. package/src/utils/helpers/sanitizeHtml.js +1 -1
  506. package/src/utils/number/parseNumbers.js +8 -2
  507. package/types/models/concepts/ConceptDetailModel.d.ts +3 -3
  508. package/types/models/concepts/ConceptRelationModel.d.ts +2 -1
  509. package/types/models/types.d.ts +17 -3
  510. package/types/redux/_modularui/types.d.ts +3 -1
  511. package/types/utils/fetch/universalFetch.d.ts +3 -3
  512. package/types/utils/helpers/objects.d.ts +10 -2
  513. package/esm/redux/_i18n/actions.js.map +0 -1
  514. package/esm/redux/_i18n/reducer.js.map +0 -1
  515. package/esm/redux/_modularui/actions.js.map +0 -1
  516. package/esm/redux/_modularui/connector.js.map +0 -1
  517. package/esm/redux/_modularui/middleware.js.map +0 -1
  518. package/esm/redux/_modularui/reducer.js.map +0 -1
  519. package/esm/redux/_modularui/selectors.js.map +0 -1
  520. package/esm/redux/_router/actions.js.map +0 -1
  521. package/esm/redux/_router/connectors.js.map +0 -1
  522. package/esm/redux/_router/middleware.js.map +0 -1
  523. package/esm/redux/_router/reducer.js.map +0 -1
  524. package/lib/redux/_i18n/actions.js.map +0 -1
  525. package/lib/redux/_i18n/reducer.js.map +0 -1
  526. package/lib/redux/_modularui/actions.js.map +0 -1
  527. package/lib/redux/_modularui/connector.js.map +0 -1
  528. package/lib/redux/_modularui/middleware.js.map +0 -1
  529. package/lib/redux/_modularui/reducer.js.map +0 -1
  530. package/lib/redux/_modularui/selectors.js.map +0 -1
  531. package/lib/redux/_router/actions.js.map +0 -1
  532. package/lib/redux/_router/connectors.js.map +0 -1
  533. package/lib/redux/_router/middleware.js.map +0 -1
  534. package/lib/redux/_router/reducer.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  // @flow
2
- import modularui from "../_modularui/connector";
2
+ import modularui from "../_modularui/ModularUIConnector";
3
3
 
4
4
  import type { ModularUIConnector } from "../_modularui/types";
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"Tab.js","names":["connectTab","modularui","match","url","propName"],"sources":["../../../src/redux/connectors/Tab.js"],"sourcesContent":["// @flow\nimport modularui from \"../_modularui/connector\";\n\nimport type { ModularUIConnector } from \"../_modularui/types\";\n\n/**\n */\nexport const connectTab: ModularUIConnector = modularui(\n \"Tab\",\n ({ match }) => match.url,\n {\n propName: \"tab\",\n }\n);\n"],"mappings":";;;;;;;AACA;AAIA;AACA;AACO,MAAMA,UAA8B,GAAG,IAAAC,kBAAS,EACrD,KAAK,EACL;EAAA,IAAC;IAAEC;EAAM,CAAC;EAAA,OAAKA,KAAK,CAACC,GAAG;AAAA,GACxB;EACEC,QAAQ,EAAE;AACZ,CAAC,CACF;AAAC"}
1
+ {"version":3,"file":"Tab.js","names":["connectTab","modularui","match","url","propName"],"sources":["../../../src/redux/connectors/Tab.js"],"sourcesContent":["// @flow\nimport modularui from \"../_modularui/ModularUIConnector\";\n\nimport type { ModularUIConnector } from \"../_modularui/types\";\n\n/**\n */\nexport const connectTab: ModularUIConnector = modularui(\n \"Tab\",\n ({ match }) => match.url,\n {\n propName: \"tab\",\n }\n);\n"],"mappings":";;;;;;;AACA;AAIA;AACA;AACO,MAAMA,UAA8B,GAAG,IAAAC,2BAAS,EACrD,KAAK,EACL;EAAA,IAAC;IAAEC;EAAM,CAAC;EAAA,OAAKA,KAAK,CAACC,GAAG;AAAA,GACxB;EACEC,QAAQ,EAAE;AACZ,CAAC,CACF;AAAC"}
@@ -2,7 +2,7 @@
2
2
  import type { Reducer } from "redux";
3
3
  import type { ReduxAction, ModalsState } from "../types";
4
4
 
5
- const showModal = (state, modalKey) => [
5
+ const showModal = (state: ModalsState, modalKey: string) => [
6
6
  ...state.modals.map((modal) => ({
7
7
  ...modal,
8
8
  visible: false,
@@ -13,7 +13,7 @@ const showModal = (state, modalKey) => [
13
13
  },
14
14
  ];
15
15
 
16
- const closeModal = (state, modalKey) =>
16
+ const closeModal = (state: ModalsState, modalKey: string) =>
17
17
  state.modals
18
18
  .filter((modal) => modal.key !== modalKey)
19
19
  .map((modal, idx, arr) => ({
@@ -1 +1 @@
1
- {"version":3,"file":"ModalsReducer.js","names":["showModal","state","modalKey","modals","modal","visible","key","closeModal","idx","arr","length","initialState","ModalsReducer","action","type","payload"],"sources":["../../../src/redux/reducers/ModalsReducer.js"],"sourcesContent":["// @flow\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction, ModalsState } from \"../types\";\n\nconst showModal = (state, modalKey) => [\n ...state.modals.map((modal) => ({\n ...modal,\n visible: false,\n })),\n {\n key: modalKey,\n visible: true,\n },\n];\n\nconst closeModal = (state, modalKey) =>\n state.modals\n .filter((modal) => modal.key !== modalKey)\n .map((modal, idx, arr) => ({\n ...modal,\n visible: arr.length === idx + 1,\n }));\n\n// REDUCER\nconst initialState: ModalsState = {\n modals: [],\n};\n\n/**\n * Modals reducer\n */\nconst ModalsReducer: Reducer<ModalsState, ReduxAction> = (\n state = initialState,\n action\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"SHOW_MODAL\":\n return {\n ...state,\n modals: showModal(state, action.payload),\n };\n\n case \"CLOSE_MODAL\":\n return {\n ...state,\n modals: closeModal(state, action.payload),\n };\n\n default:\n return state;\n }\n};\n\nexport default ModalsReducer;\n"],"mappings":";;;;;;;;;AAIA,MAAMA,SAAS,GAAG,CAACC,KAAK,EAAEC,QAAQ;EAAA;EAAA,OAAK,CACrC,GAAG,6BAAAD,KAAK,CAACE,MAAM,iBAAMC,KAAK,KAAM;IAC9B,GAAGA,KAAK;IACRC,OAAO,EAAE;EACX,CAAC,CAAC,CAAC,EACH;IACEC,GAAG,EAAEJ,QAAQ;IACbG,OAAO,EAAE;EACX,CAAC,CACF;AAAA;AAED,MAAME,UAAU,GAAG,CAACN,KAAK,EAAEC,QAAQ;EAAA;EAAA,OACjC,+DAAAD,KAAK,CAACE,MAAM,kBACDC,KAAK,IAAKA,KAAK,CAACE,GAAG,KAAKJ,QAAQ,CAAC,kBACrC,CAACE,KAAK,EAAEI,GAAG,EAAEC,GAAG,MAAM;IACzB,GAAGL,KAAK;IACRC,OAAO,EAAEI,GAAG,CAACC,MAAM,KAAKF,GAAG,GAAG;EAChC,CAAC,CAAC,CAAC;AAAA;;AAEP;AACA,MAAMG,YAAyB,GAAG;EAChCR,MAAM,EAAE;AACV,CAAC;;AAED;AACA;AACA;AACA,MAAMS,aAAgD,GAAG,YAGpD;EAAA,IAFHX,KAAK,uEAAGU,YAAY;EAAA,IACpBE,MAAM;EAEN,IAAI,CAACA,MAAM,EAAE;IACX,OAAOZ,KAAK;EACd;EAEA,QAAQY,MAAM,CAACC,IAAI;IACjB,KAAK,YAAY;MACf,OAAO;QACL,GAAGb,KAAK;QACRE,MAAM,EAAEH,SAAS,CAACC,KAAK,EAAEY,MAAM,CAACE,OAAO;MACzC,CAAC;IAEH,KAAK,aAAa;MAChB,OAAO;QACL,GAAGd,KAAK;QACRE,MAAM,EAAEI,UAAU,CAACN,KAAK,EAAEY,MAAM,CAACE,OAAO;MAC1C,CAAC;IAEH;MACE,OAAOd,KAAK;EAAC;AAEnB,CAAC;AAAC,eAEaW,aAAa;AAAA"}
1
+ {"version":3,"file":"ModalsReducer.js","names":["showModal","state","modalKey","modals","modal","visible","key","closeModal","idx","arr","length","initialState","ModalsReducer","action","type","payload"],"sources":["../../../src/redux/reducers/ModalsReducer.js"],"sourcesContent":["// @flow\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction, ModalsState } from \"../types\";\n\nconst showModal = (state: ModalsState, modalKey: string) => [\n ...state.modals.map((modal) => ({\n ...modal,\n visible: false,\n })),\n {\n key: modalKey,\n visible: true,\n },\n];\n\nconst closeModal = (state: ModalsState, modalKey: string) =>\n state.modals\n .filter((modal) => modal.key !== modalKey)\n .map((modal, idx, arr) => ({\n ...modal,\n visible: arr.length === idx + 1,\n }));\n\n// REDUCER\nconst initialState: ModalsState = {\n modals: [],\n};\n\n/**\n * Modals reducer\n */\nconst ModalsReducer: Reducer<ModalsState, ReduxAction> = (\n state = initialState,\n action\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"SHOW_MODAL\":\n return {\n ...state,\n modals: showModal(state, action.payload),\n };\n\n case \"CLOSE_MODAL\":\n return {\n ...state,\n modals: closeModal(state, action.payload),\n };\n\n default:\n return state;\n }\n};\n\nexport default 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10
10
  };
11
11
 
12
- const finishProgress = (state) => {
12
+ const finishProgress = (state: ProgressIndicatorState) => {
13
13
  const isFinalFinish = state.count - 1 === 0;
14
14
  return {
15
15
  ...state,
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressIndicatorReducer.js","names":["initialState","count","timestamp","percentComplete","finishProgress","state","isFinalFinish","Date","now","progressIndicatorReducer","action","type","payload"],"sources":["../../../src/redux/reducers/ProgressIndicatorReducer.js"],"sourcesContent":["// @flow\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction, ProgressIndicatorState } from \"../types\";\n\n// REDUCER\nconst initialState: ProgressIndicatorState = {\n count: 0,\n timestamp: 0,\n percentComplete: 0,\n};\n\nconst finishProgress = (state) => {\n const isFinalFinish = state.count - 1 === 0;\n return {\n ...state,\n count: state.count <= 0 ? 0 : state.count - 1,\n timestamp: isFinalFinish ? Date.now() : state.timestamp,\n percentComplete: isFinalFinish ? 0 : state.percentComplete,\n };\n};\n\n/**\n * Keep state for the progress indicator\n */\nconst progressIndicatorReducer: Reducer<ProgressIndicatorState, ReduxAction> = (\n state = initialState,\n action\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"UPDATE_PROGRESS\":\n return {\n ...state,\n percentComplete: action.payload?.percentComplete,\n };\n\n case \"FINISH_PROGRESS\":\n return finishProgress(state);\n\n case \"START_PROGRESS\":\n return {\n ...state,\n count: state.count + 1,\n };\n\n case \"RESET_PROGRESS\":\n return {\n ...state,\n count: 0,\n };\n\n default:\n return state;\n }\n};\n\nexport default progressIndicatorReducer;\n"],"mappings":";;;;;;AAIA;AACA,MAAMA,YAAoC,GAAG;EAC3CC,KAAK,EAAE,CAAC;EACRC,SAAS,EAAE,CAAC;EACZC,eAAe,EAAE;AACnB,CAAC;AAED,MAAMC,cAAc,GAAIC,KAAK,IAAK;EAChC,MAAMC,aAAa,GAAGD,KAAK,CAACJ,KAAK,GAAG,CAAC,KAAK,CAAC;EAC3C,OAAO;IACL,GAAGI,KAAK;IACRJ,KAAK,EAAEI,KAAK,CAACJ,KAAK,IAAI,CAAC,GAAG,CAAC,GAAGI,KAAK,CAACJ,KAAK,GAAG,CAAC;IAC7CC,SAAS,EAAEI,aAAa,GAAGC,IAAI,CAACC,GAAG,EAAE,GAAGH,KAAK,CAACH,SAAS;IACvDC,eAAe,EAAEG,aAAa,GAAG,CAAC,GAAGD,KAAK,CAACF;EAC7C,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA,MAAMM,wBAAsE,GAAG,YAG1E;EAAA,IAFHJ,KAAK,uEAAGL,YAAY;EAAA,IACpBU,MAAM;EAEN,IAAI,CAACA,MAAM,EAAE;IACX,OAAOL,KAAK;EACd;EAEA,QAAQK,MAAM,CAACC,IAAI;IACjB,KAAK,iBAAiB;MACpB,OAAO;QACL,GAAGN,KAAK;QACRF,eAAe,EAAEO,MAAM,CAACE,OAAO,EAAET;MACnC,CAAC;IAEH,KAAK,iBAAiB;MACpB,OAAOC,cAAc,CAACC,KAAK,CAAC;IAE9B,KAAK,gBAAgB;MACnB,OAAO;QACL,GAAGA,KAAK;QACRJ,KAAK,EAAEI,KAAK,CAACJ,KAAK,GAAG;MACvB,CAAC;IAEH,KAAK,gBAAgB;MACnB,OAAO;QACL,GAAGI,KAAK;QACRJ,KAAK,EAAE;MACT,CAAC;IAEH;MACE,OAAOI,KAAK;EAAC;AAEnB,CAAC;AAAC,eAEaI,wBAAwB;AAAA"}
1
+ {"version":3,"file":"ProgressIndicatorReducer.js","names":["initialState","count","timestamp","percentComplete","finishProgress","state","isFinalFinish","Date","now","progressIndicatorReducer","action","type","payload"],"sources":["../../../src/redux/reducers/ProgressIndicatorReducer.js"],"sourcesContent":["// @flow\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction, ProgressIndicatorState } from \"../types\";\n\n// REDUCER\nconst initialState: ProgressIndicatorState = {\n count: 0,\n timestamp: 0,\n percentComplete: 0,\n};\n\nconst finishProgress = (state: ProgressIndicatorState) => {\n const isFinalFinish = state.count - 1 === 0;\n return {\n ...state,\n count: state.count <= 0 ? 0 : state.count - 1,\n timestamp: isFinalFinish ? Date.now() : state.timestamp,\n percentComplete: isFinalFinish ? 0 : state.percentComplete,\n };\n};\n\n/**\n * Keep state for the progress indicator\n */\nconst progressIndicatorReducer: Reducer<ProgressIndicatorState, ReduxAction> = (\n state = initialState,\n action\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"UPDATE_PROGRESS\":\n return {\n ...state,\n percentComplete: action.payload?.percentComplete,\n };\n\n case \"FINISH_PROGRESS\":\n return finishProgress(state);\n\n case \"START_PROGRESS\":\n return {\n ...state,\n count: state.count + 1,\n };\n\n case \"RESET_PROGRESS\":\n return {\n ...state,\n count: 0,\n };\n\n default:\n return state;\n }\n};\n\nexport default progressIndicatorReducer;\n"],"mappings":";;;;;;AAIA;AACA,MAAMA,YAAoC,GAAG;EAC3CC,KAAK,EAAE,CAAC;EACRC,SAAS,EAAE,CAAC;EACZC,eAAe,EAAE;AACnB,CAAC;AAED,MAAMC,cAAc,GAAIC,KAA6B,IAAK;EACxD,MAAMC,aAAa,GAAGD,KAAK,CAACJ,KAAK,GAAG,CAAC,KAAK,CAAC;EAC3C,OAAO;IACL,GAAGI,KAAK;IACRJ,KAAK,EAAEI,KAAK,CAACJ,KAAK,IAAI,CAAC,GAAG,CAAC,GAAGI,KAAK,CAACJ,KAAK,GAAG,CAAC;IAC7CC,SAAS,EAAEI,aAAa,GAAGC,IAAI,CAACC,GAAG,EAAE,GAAGH,KAAK,CAACH,SAAS;IACvDC,eAAe,EAAEG,aAAa,GAAG,CAAC,GAAGD,KAAK,CAACF;EAC7C,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA,MAAMM,wBAAsE,GAAG,YAG1E;EAAA,IAFHJ,KAAK,uEAAGL,YAAY;EAAA,IACpBU,MAAM;EAEN,IAAI,CAACA,MAAM,EAAE;IACX,OAAOL,KAAK;EACd;EAEA,QAAQK,MAAM,CAACC,IAAI;IACjB,KAAK,iBAAiB;MACpB,OAAO;QACL,GAAGN,KAAK;QACRF,eAAe,EAAEO,MAAM,CAACE,OAAO,EAAET;MACnC,CAAC;IAEH,KAAK,iBAAiB;MACpB,OAAOC,cAAc,CAACC,KAAK,CAAC;IAE9B,KAAK,gBAAgB;MACnB,OAAO;QACL,GAAGA,KAAK;QACRJ,KAAK,EAAEI,KAAK,CAACJ,KAAK,GAAG;MACvB,CAAC;IAEH,KAAK,gBAAgB;MACnB,OAAO;QACL,GAAGI,KAAK;QACRJ,KAAK,EAAE;MACT,CAAC;IAEH;MACE,OAAOI,KAAK;EAAC;AAEnB,CAAC;AAAC,eAEaI,wBAAwB;AAAA"}
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.createReducer = void 0;
8
- var _reducer = require("../_router/reducer");
9
- var _reducer2 = require("../_modularui/reducer");
10
- var _reducer3 = require("../_i18n/reducer");
8
+ var _RouterReducer = require("../_router/RouterReducer");
9
+ var _ModularUIReducer = require("../_modularui/ModularUIReducer");
10
+ var _I18nReducer = require("../_i18n/I18nReducer");
11
11
  var _ModalsReducer = _interopRequireDefault(require("./ModalsReducer"));
12
12
  var _AuthReducer = _interopRequireDefault(require("./AuthReducer"));
13
13
  var _ErrorReducer = _interopRequireDefault(require("./ErrorReducer"));
@@ -17,9 +17,9 @@ var _PreferencesReducer = _interopRequireDefault(require("./PreferencesReducer")
17
17
  /**
18
18
  */
19
19
  const createReducer = () => ({
20
- router: _reducer.RouterReducer,
21
- modularui: _reducer2.ModularUIReducer,
22
- i18n: _reducer3.I18nReducer,
20
+ router: _RouterReducer.RouterReducer,
21
+ modularui: _ModularUIReducer.ModularUIReducer,
22
+ i18n: _I18nReducer.I18nReducer,
23
23
  auth: _AuthReducer.default,
24
24
  error: _ErrorReducer.default,
25
25
  modals: _ModalsReducer.default,
@@ -1,7 +1,7 @@
1
1
  // @flow
2
- import { RouterReducer } from "../_router/reducer";
3
- import { ModularUIReducer } from "../_modularui/reducer";
4
- import { I18nReducer } from "../_i18n/reducer";
2
+ import { RouterReducer } from "../_router/RouterReducer";
3
+ import { ModularUIReducer } from "../_modularui/ModularUIReducer";
4
+ import { I18nReducer } from "../_i18n/I18nReducer";
5
5
 
6
6
  import ModalsReducer from "./ModalsReducer";
7
7
  import AuthReducer from "./AuthReducer";
@@ -1 +1 @@
1
- {"version":3,"file":"createReducer.js","names":["createReducer","router","RouterReducer","modularui","ModularUIReducer","i18n","I18nReducer","auth","AuthReducer","error","ErrorReducer","modals","ModalsReducer","notification","NotificationReducer","progressindicator","ProgressIndicatorReducer","preferences","PreferencesReducer"],"sources":["../../../src/redux/reducers/createReducer.js"],"sourcesContent":["// @flow\nimport { RouterReducer } from \"../_router/reducer\";\nimport { ModularUIReducer } from \"../_modularui/reducer\";\nimport { I18nReducer } from \"../_i18n/reducer\";\n\nimport ModalsReducer from \"./ModalsReducer\";\nimport AuthReducer from \"./AuthReducer\";\nimport ErrorReducer from \"./ErrorReducer\";\nimport NotificationReducer from \"./NotificationReducer\";\nimport ProgressIndicatorReducer from \"./ProgressIndicatorReducer\";\nimport PreferencesReducer from \"./PreferencesReducer\";\n\nimport type { Reducer } from \"redux\";\nimport type {\n ReduxAction,\n ProgressIndicatorState,\n PreferencesState,\n NotificationState,\n ModalsState,\n ErrorState,\n AuthState,\n} from \"../types\";\nimport type { RouterState } from \"../_router/types\";\nimport type { ModularUIState } from \"../_modularui/types\";\nimport type { I18nState } from \"../_i18n/types\";\n\ntype Reducers = {\n auth: Reducer<AuthState, ReduxAction>,\n error: Reducer<ErrorState, ReduxAction>,\n i18n: Reducer<I18nState, ReduxAction>,\n modals: Reducer<ModalsState, ReduxAction>,\n modularui: Reducer<ModularUIState, ReduxAction>,\n notification: Reducer<NotificationState, ReduxAction>,\n preferences: Reducer<PreferencesState, ReduxAction>,\n progressindicator: Reducer<ProgressIndicatorState, ReduxAction>,\n router: Reducer<RouterState, ReduxAction>,\n};\n\n/**\n */\nexport const createReducer = (): Reducers => ({\n router: RouterReducer,\n modularui: ModularUIReducer,\n i18n: I18nReducer,\n auth: AuthReducer,\n error: ErrorReducer,\n modals: ModalsReducer,\n notification: NotificationReducer,\n progressindicator: ProgressIndicatorReducer,\n preferences: PreferencesReducer,\n});\n"],"mappings":";;;;;;;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AA4BA;AACA;AACO,MAAMA,aAAa,GAAG,OAAiB;EAC5CC,MAAM,EAAEC,sBAAa;EACrBC,SAAS,EAAEC,0BAAgB;EAC3BC,IAAI,EAAEC,qBAAW;EACjBC,IAAI,EAAEC,oBAAW;EACjBC,KAAK,EAAEC,qBAAY;EACnBC,MAAM,EAAEC,sBAAa;EACrBC,YAAY,EAAEC,4BAAmB;EACjCC,iBAAiB,EAAEC,iCAAwB;EAC3CC,WAAW,EAAEC;AACf,CAAC,CAAC;AAAC"}
1
+ {"version":3,"file":"createReducer.js","names":["createReducer","router","RouterReducer","modularui","ModularUIReducer","i18n","I18nReducer","auth","AuthReducer","error","ErrorReducer","modals","ModalsReducer","notification","NotificationReducer","progressindicator","ProgressIndicatorReducer","preferences","PreferencesReducer"],"sources":["../../../src/redux/reducers/createReducer.js"],"sourcesContent":["// @flow\nimport { RouterReducer } from \"../_router/RouterReducer\";\nimport { ModularUIReducer } from \"../_modularui/ModularUIReducer\";\nimport { I18nReducer } from \"../_i18n/I18nReducer\";\n\nimport ModalsReducer from \"./ModalsReducer\";\nimport AuthReducer from \"./AuthReducer\";\nimport ErrorReducer from \"./ErrorReducer\";\nimport NotificationReducer from \"./NotificationReducer\";\nimport ProgressIndicatorReducer from \"./ProgressIndicatorReducer\";\nimport PreferencesReducer from \"./PreferencesReducer\";\n\nimport type { Reducer } from \"redux\";\nimport type {\n ReduxAction,\n ProgressIndicatorState,\n PreferencesState,\n NotificationState,\n ModalsState,\n ErrorState,\n AuthState,\n} from \"../types\";\nimport type { RouterState } from \"../_router/types\";\nimport type { ModularUIState } from \"../_modularui/types\";\nimport type { I18nState } from \"../_i18n/types\";\n\ntype Reducers = {\n auth: Reducer<AuthState, ReduxAction>,\n error: Reducer<ErrorState, ReduxAction>,\n i18n: Reducer<I18nState, ReduxAction>,\n modals: Reducer<ModalsState, ReduxAction>,\n modularui: Reducer<ModularUIState, ReduxAction>,\n notification: Reducer<NotificationState, ReduxAction>,\n preferences: Reducer<PreferencesState, ReduxAction>,\n progressindicator: Reducer<ProgressIndicatorState, ReduxAction>,\n router: Reducer<RouterState, ReduxAction>,\n};\n\n/**\n */\nexport const createReducer = (): Reducers => ({\n router: RouterReducer,\n modularui: ModularUIReducer,\n i18n: I18nReducer,\n auth: AuthReducer,\n error: ErrorReducer,\n modals: ModalsReducer,\n notification: NotificationReducer,\n progressindicator: ProgressIndicatorReducer,\n preferences: PreferencesReducer,\n});\n"],"mappings":";;;;;;;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AA4BA;AACA;AACO,MAAMA,aAAa,GAAG,OAAiB;EAC5CC,MAAM,EAAEC,4BAAa;EACrBC,SAAS,EAAEC,kCAAgB;EAC3BC,IAAI,EAAEC,wBAAW;EACjBC,IAAI,EAAEC,oBAAW;EACjBC,KAAK,EAAEC,qBAAY;EACnBC,MAAM,EAAEC,sBAAa;EACrBC,YAAY,EAAEC,4BAAmB;EACjCC,iBAAiB,EAAEC,iCAAwB;EAC3CC,WAAW,EAAEC;AACf,CAAC,CAAC;AAAC"}
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _redux = require("redux");
9
9
  var _reduxThunk = _interopRequireDefault(require("redux-thunk"));
10
- var _middleware = require("../_router/middleware");
11
- var _middleware2 = require("../_modularui/middleware");
10
+ var _RouterMiddleware = require("../_router/RouterMiddleware");
11
+ var _ModularUIMiddleware = require("../_modularui/ModularUIMiddleware");
12
12
  var _createReducer = require("../reducers/createReducer");
13
- var _actions = require("../_router/actions");
13
+ var _RouterActions = require("../_router/RouterActions");
14
14
  /**
15
15
  */
16
16
  const configureStore = (history, customReducers, initialState) => {
@@ -22,11 +22,11 @@ const configureStore = (history, customReducers, initialState) => {
22
22
  ...customReducers,
23
23
  ...(0, _createReducer.createReducer)()
24
24
  });
25
- const middleware = (0, _redux.applyMiddleware)(_middleware2.modularuiMiddleware, (0, _middleware.routerMiddleware)(history), _reduxThunk.default);
25
+ const middleware = (0, _redux.applyMiddleware)(_ModularUIMiddleware.modularUIMiddleware, (0, _RouterMiddleware.routerMiddleware)(history), _reduxThunk.default);
26
26
  const enhancers = composeEnhancers(middleware);
27
27
  const store = (0, _redux.createStore)(combinedReducers, initialState, enhancers);
28
28
  if (!initialState) {
29
- store.dispatch((0, _actions.locationChange)(history.location, "PUSH"));
29
+ store.dispatch((0, _RouterActions.locationChange)(history.location, "PUSH"));
30
30
  }
31
31
  return {
32
32
  history,
@@ -7,11 +7,11 @@ import {
7
7
  } from "redux";
8
8
  import thunk from "redux-thunk";
9
9
 
10
- import { routerMiddleware } from "../_router/middleware";
11
- import { modularuiMiddleware } from "../_modularui/middleware";
10
+ import { routerMiddleware } from "../_router/RouterMiddleware";
11
+ import { modularUIMiddleware } from "../_modularui/ModularUIMiddleware";
12
12
 
13
13
  import { createReducer } from "../reducers/createReducer";
14
- import { locationChange } from "../_router/actions";
14
+ import { locationChange } from "../_router/RouterActions";
15
15
 
16
16
  import type { RouterHistory } from "react-router";
17
17
  import type { ReduxAction, ReduxState, ReduxStore } from "../types";
@@ -36,7 +36,7 @@ const configureStore = (
36
36
  });
37
37
 
38
38
  const middleware = applyMiddleware(
39
- modularuiMiddleware,
39
+ modularUIMiddleware,
40
40
  routerMiddleware(history),
41
41
  thunk
42
42
  );
@@ -1 +1 @@
1
- {"version":3,"file":"configureStore.js","names":["configureStore","history","customReducers","initialState","composeEnhancers","compose","process","env","NODE_ENV","window","__REDUX_DEVTOOLS_EXTENSION_COMPOSE__","combinedReducers","combineReducers","createReducer","middleware","applyMiddleware","modularuiMiddleware","routerMiddleware","thunk","enhancers","store","createReduxStore","dispatch","locationChange","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/middleware\";\nimport { modularuiMiddleware } from \"../_modularui/middleware\";\n\nimport { createReducer } from \"../reducers/createReducer\";\nimport { locationChange } from \"../_router/actions\";\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 history: RouterHistory,\n customReducers?: Object,\n initialState?: $Shape<ReduxState>\n): { history: 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(history),\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) {\n store.dispatch(locationChange(history.location, \"PUSH\"));\n }\n return { history, store };\n};\n\nexport default configureStore;\n"],"mappings":";;;;;;;AACA;AAMA;AAEA;AACA;AAEA;AACA;AAMA;AACA;AACA,MAAMA,cAAc,GAAG,CACrBC,OAAsB,EACtBC,cAAuB,EACvBC,YAAiC,KACiB;EAClD,IAAIC,gBAAgB,GAAGC,cAAO;EAE9B,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;IAC1EL,gBAAgB,GAAGK,MAAM,CAACC,oCAAoC,IAAIL,cAAO;EAC3E;EAEA,MAAMM,gBAAkD,GAAG,IAAAC,sBAAe,EAAC;IACzE,GAAGV,cAAc;IACjB,GAAG,IAAAW,4BAAa;EAClB,CAAC,CAAC;EAEF,MAAMC,UAAU,GAAG,IAAAC,sBAAe,EAChCC,gCAAmB,EACnB,IAAAC,4BAAgB,EAAChB,OAAO,CAAC,EACzBiB,mBAAK,CACN;EAED,MAAMC,SAAS,GAAGf,gBAAgB,CAACU,UAAU,CAAC;EAE9C,MAAMM,KAAiB,GAAG,IAAAC,kBAAgB,EACxCV,gBAAgB,EAChBR,YAAY,EACZgB,SAAS,CACV;EAED,IAAI,CAAChB,YAAY,EAAE;IACjBiB,KAAK,CAACE,QAAQ,CAAC,IAAAC,uBAAc,EAACtB,OAAO,CAACuB,QAAQ,EAAE,MAAM,CAAC,CAAC;EAC1D;EACA,OAAO;IAAEvB,OAAO;IAAEmB;EAAM,CAAC;AAC3B,CAAC;AAAC,eAEapB,cAAc;AAAA"}
1
+ {"version":3,"file":"configureStore.js","names":["configureStore","history","customReducers","initialState","composeEnhancers","compose","process","env","NODE_ENV","window","__REDUX_DEVTOOLS_EXTENSION_COMPOSE__","combinedReducers","combineReducers","createReducer","middleware","applyMiddleware","modularUIMiddleware","routerMiddleware","thunk","enhancers","store","createReduxStore","dispatch","locationChange","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 history: RouterHistory,\n customReducers?: Object,\n initialState?: $Shape<ReduxState>\n): { history: 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(history),\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) {\n store.dispatch(locationChange(history.location, \"PUSH\"));\n }\n return { history, store };\n};\n\nexport default configureStore;\n"],"mappings":";;;;;;;AACA;AAMA;AAEA;AACA;AAEA;AACA;AAMA;AACA;AACA,MAAMA,cAAc,GAAG,CACrBC,OAAsB,EACtBC,cAAuB,EACvBC,YAAiC,KACiB;EAClD,IAAIC,gBAAgB,GAAGC,cAAO;EAE9B,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;IAC1EL,gBAAgB,GAAGK,MAAM,CAACC,oCAAoC,IAAIL,cAAO;EAC3E;EAEA,MAAMM,gBAAkD,GAAG,IAAAC,sBAAe,EAAC;IACzE,GAAGV,cAAc;IACjB,GAAG,IAAAW,4BAAa;EAClB,CAAC,CAAC;EAEF,MAAMC,UAAU,GAAG,IAAAC,sBAAe,EAChCC,wCAAmB,EACnB,IAAAC,kCAAgB,EAAChB,OAAO,CAAC,EACzBiB,mBAAK,CACN;EAED,MAAMC,SAAS,GAAGf,gBAAgB,CAACU,UAAU,CAAC;EAE9C,MAAMM,KAAiB,GAAG,IAAAC,kBAAgB,EACxCV,gBAAgB,EAChBR,YAAY,EACZgB,SAAS,CACV;EAED,IAAI,CAAChB,YAAY,EAAE;IACjBiB,KAAK,CAACE,QAAQ,CAAC,IAAAC,6BAAc,EAACtB,OAAO,CAACuB,QAAQ,EAAE,MAAM,CAAC,CAAC;EAC1D;EACA,OAAO;IAAEvB,OAAO;IAAEmB;EAAM,CAAC;AAC3B,CAAC;AAAC,eAEapB,cAAc;AAAA"}
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = universalFetch;
7
+ exports.default = void 0;
8
8
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
9
9
  var _objects = require("../helpers/objects");
10
10
  var _Constants = require("../../constants/Constants");
@@ -70,7 +70,7 @@ const browserFetch = args => {
70
70
  /**
71
71
  * Request data from server, uses server datafetcher or xhr in browser.
72
72
  */
73
- function universalFetch(args) {
73
+ const universalFetch = args => {
74
74
  // Set locale as Accept-Language header
75
75
  if (args.locale) {
76
76
  args.headers = {
@@ -86,5 +86,7 @@ function universalFetch(args) {
86
86
  return (0, _serverFetch.default)(args);
87
87
  }
88
88
  return browserFetch(args);
89
- }
89
+ };
90
+ var _default = universalFetch;
91
+ exports.default = _default;
90
92
  //# sourceMappingURL=universalFetch.js.map
@@ -8,7 +8,7 @@ import Cache from "../browser/Cache";
8
8
 
9
9
  import type { RequestOptions } from "./types";
10
10
 
11
- type CachedResponse = string | { ... };
11
+ type CachedResponse = any;
12
12
 
13
13
  const IS_FETCHING = "is-fetching";
14
14
 
@@ -16,7 +16,7 @@ const IS_FETCHING = "is-fetching";
16
16
  * Checks each x ms if a cache item is set after fetching the item.
17
17
  * @private
18
18
  */
19
- const waitForCachedItem = (cacheKey) => {
19
+ const waitForCachedItem = (cacheKey: string) => {
20
20
  let TIMEOUT = 3000;
21
21
  const CHECK_TIMEOUT = 100;
22
22
 
@@ -44,7 +44,7 @@ const waitForCachedItem = (cacheKey) => {
44
44
  /**
45
45
  * @private
46
46
  */
47
- const browserFetch = (args) => {
47
+ const browserFetch = (args: RequestOptions) => {
48
48
  if (USE_CACHE && args.cache) {
49
49
  const cacheKey = Cache.createResourceKey(args);
50
50
 
@@ -77,9 +77,9 @@ const browserFetch = (args) => {
77
77
  /**
78
78
  * Request data from server, uses server datafetcher or xhr in browser.
79
79
  */
80
- export default function universalFetch(
80
+ const universalFetch = (
81
81
  args: RequestOptions
82
- ): Promise<CachedResponse> | Promise<?(string | { ... })> {
82
+ ): Promise<CachedResponse> | Promise<any> => {
83
83
  // Set locale as Accept-Language header
84
84
  if (args.locale) {
85
85
  args.headers = {
@@ -97,4 +97,6 @@ export default function universalFetch(
97
97
  }
98
98
 
99
99
  return browserFetch(args);
100
- }
100
+ };
101
+
102
+ export default universalFetch;
@@ -1 +1 @@
1
- {"version":3,"file":"universalFetch.js","names":["IS_FETCHING","waitForCachedItem","cacheKey","TIMEOUT","CHECK_TIMEOUT","resolve","reject","check","Cache","getItem","cachedItem","Error","setTimeout","browserFetch","args","USE_CACHE","cache","createResourceKey","hasItem","cacheItem","isPlainObject","addItem","xhr","then","response","universalFetch","locale","headers","includeContext","url","IS_SYNC","serverFetch"],"sources":["../../../src/utils/fetch/universalFetch.js"],"sourcesContent":["// @flow\nimport { isPlainObject } from \"../helpers/objects\";\n\nimport { IS_SYNC, USE_CACHE } from \"../../constants/Constants\";\nimport serverFetch from \"./serverFetch\";\nimport xhr from \"./xhr\";\nimport Cache from \"../browser/Cache\";\n\nimport type { RequestOptions } from \"./types\";\n\ntype CachedResponse = string | { ... };\n\nconst IS_FETCHING = \"is-fetching\";\n\n/**\n * Checks each x ms if a cache item is set after fetching the item.\n * @private\n */\nconst waitForCachedItem = (cacheKey) => {\n let TIMEOUT = 3000;\n const CHECK_TIMEOUT = 100;\n\n return new Promise<CachedResponse>((resolve, reject) => {\n const check = () => {\n if (Cache.getItem(cacheKey) !== IS_FETCHING) {\n const cachedItem = Cache.getItem(cacheKey);\n if (cachedItem != null) {\n resolve(cachedItem);\n } else {\n reject(new Error(\"Empty cached item\"));\n }\n } else if (TIMEOUT <= 0) {\n reject(new Error(\"Empty cached item\"));\n } else {\n TIMEOUT = TIMEOUT - CHECK_TIMEOUT;\n setTimeout(check, CHECK_TIMEOUT);\n }\n };\n\n setTimeout(check, CHECK_TIMEOUT);\n });\n};\n\n/**\n * @private\n */\nconst browserFetch = (args) => {\n if (USE_CACHE && args.cache) {\n const cacheKey = Cache.createResourceKey(args);\n\n if (Cache.hasItem(cacheKey)) {\n const cacheItem = Cache.getItem(cacheKey);\n\n if (cacheItem != null) {\n if (cacheItem === IS_FETCHING) {\n return waitForCachedItem(cacheKey);\n } else if (isPlainObject(cacheItem)) {\n return Promise.resolve(cacheItem);\n }\n }\n }\n\n Cache.addItem(cacheKey, IS_FETCHING);\n }\n\n return xhr(args).then((response) => {\n if (USE_CACHE && args.cache) {\n const cacheKey = Cache.createResourceKey(args);\n\n Cache.addItem(cacheKey, response);\n }\n\n return response;\n });\n};\n\n/**\n * Request data from server, uses server datafetcher or xhr in browser.\n */\nexport default function universalFetch(\n args: RequestOptions\n): Promise<CachedResponse> | Promise<?(string | { ... })> {\n // Set locale as Accept-Language header\n if (args.locale) {\n args.headers = {\n \"Accept-Language\": args.locale,\n };\n }\n\n if (args.includeContext) {\n args.url = `${args.url}?includeContext=true`;\n }\n\n // server side no access to the browser cache apis, no cache available\n if (IS_SYNC) {\n return serverFetch(args);\n }\n\n return browserFetch(args);\n}\n"],"mappings":";;;;;;;;AACA;AAEA;AACA;AACA;AACA;AAMA,MAAMA,WAAW,GAAG,aAAa;;AAEjC;AACA;AACA;AACA;AACA,MAAMC,iBAAiB,GAAIC,QAAQ,IAAK;EACtC,IAAIC,OAAO,GAAG,IAAI;EAClB,MAAMC,aAAa,GAAG,GAAG;EAEzB,OAAO,qBAA4B,CAACC,OAAO,EAAEC,MAAM,KAAK;IACtD,MAAMC,KAAK,GAAG,MAAM;MAClB,IAAIC,cAAK,CAACC,OAAO,CAACP,QAAQ,CAAC,KAAKF,WAAW,EAAE;QAC3C,MAAMU,UAAU,GAAGF,cAAK,CAACC,OAAO,CAACP,QAAQ,CAAC;QAC1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iB,CAACH,IAAI,CAAC;MAE9CN,cAAK,CAACa,OAAO,CAACnB,QAAQ,EAAEsB,QAAQ,CAAC;IACnC;IAEA,OAAOA,QAAQ;EACjB,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACe,SAASC,cAAc,CACpCX,IAAoB,EACoC;EACxD;EACA,IAAIA,IAAI,CAACY,MAAM,EAAE;IACfZ,IAAI,CAACa,OAAO,GAAG;MACb,iBAAiB,EAAEb,IAAI,CAACY;IAC1B,CAAC;EACH;EAEA,IAAIZ,IAAI,CAACc,cAAc,EAAE;IACvBd,IAAI,CAACe,GAAG,GAAI,GAAEf,IAAI,CAACe,GAAI,sBAAqB;EAC9C;;EAEA;EACA,IAAIC,kBAAO,EAAE;IACX,OAAO,IAAAC,oBAAW,EAACjB,IAAI,CAAC;EAC1B;EAEA,OAAOD,YAAY,CAACC,IAAI,CAAC;AAC3B"}
1
+ {"version":3,"file":"universalFetch.js","names":["IS_FETCHING","waitForCachedItem","cacheKey","TIMEOUT","CHECK_TIMEOUT","resolve","reject","check","Cache","getItem","cachedItem","Error","setTimeout","browserFetch","args","USE_CACHE","cache","createResourceKey","hasItem","cacheItem","isPlainObject","addItem","xhr","then","response","universalFetch","locale","headers","includeContext","url","IS_SYNC","serverFetch"],"sources":["../../../src/utils/fetch/universalFetch.js"],"sourcesContent":["// @flow\nimport { isPlainObject } from \"../helpers/objects\";\n\nimport { IS_SYNC, USE_CACHE } from \"../../constants/Constants\";\nimport serverFetch from \"./serverFetch\";\nimport xhr from \"./xhr\";\nimport Cache from \"../browser/Cache\";\n\nimport type { RequestOptions } from \"./types\";\n\ntype CachedResponse = any;\n\nconst IS_FETCHING = \"is-fetching\";\n\n/**\n * Checks each x ms if a cache item is set after fetching the item.\n * @private\n */\nconst waitForCachedItem = (cacheKey: string) => {\n let TIMEOUT = 3000;\n const CHECK_TIMEOUT = 100;\n\n return new Promise<CachedResponse>((resolve, reject) => {\n const check = () => {\n if (Cache.getItem(cacheKey) !== IS_FETCHING) {\n const cachedItem = Cache.getItem(cacheKey);\n if (cachedItem != null) {\n resolve(cachedItem);\n } else {\n reject(new Error(\"Empty cached item\"));\n }\n } else if (TIMEOUT <= 0) {\n reject(new Error(\"Empty cached item\"));\n } else {\n TIMEOUT = TIMEOUT - CHECK_TIMEOUT;\n setTimeout(check, CHECK_TIMEOUT);\n }\n };\n\n setTimeout(check, CHECK_TIMEOUT);\n });\n};\n\n/**\n * @private\n */\nconst browserFetch = (args: RequestOptions) => {\n if (USE_CACHE && args.cache) {\n const cacheKey = Cache.createResourceKey(args);\n\n if (Cache.hasItem(cacheKey)) {\n const cacheItem = Cache.getItem(cacheKey);\n\n if (cacheItem != null) {\n if (cacheItem === IS_FETCHING) {\n return waitForCachedItem(cacheKey);\n } else if (isPlainObject(cacheItem)) {\n return Promise.resolve(cacheItem);\n }\n }\n }\n\n Cache.addItem(cacheKey, IS_FETCHING);\n }\n\n return xhr(args).then((response) => {\n if (USE_CACHE && args.cache) {\n const cacheKey = Cache.createResourceKey(args);\n\n Cache.addItem(cacheKey, response);\n }\n\n return response;\n });\n};\n\n/**\n * Request data from server, uses server datafetcher or xhr in browser.\n */\nconst universalFetch = (\n args: RequestOptions\n): Promise<CachedResponse> | Promise<any> => {\n // Set locale as Accept-Language header\n if (args.locale) {\n args.headers = {\n \"Accept-Language\": args.locale,\n };\n }\n\n if (args.includeContext) {\n args.url = `${args.url}?includeContext=true`;\n }\n\n // server side no access to the browser cache apis, no cache available\n if (IS_SYNC) {\n return serverFetch(args);\n }\n\n return browserFetch(args);\n};\n\nexport default universalFetch;\n"],"mappings":";;;;;;;;AACA;AAEA;AACA;AACA;AACA;AAMA,MAAMA,WAAW,GAAG,aAAa;;AAEjC;AACA;AACA;AACA;AACA,MAAMC,iBAAiB,GAAIC,QAAgB,IAAK;EAC9C,IAAIC,OAAO,GAAG,IAAI;EAClB,MAAMC,aAAa,GAAG,GAAG;EAEzB,OAAO,qBAA4B,CAACC,OAAO,EAAEC,MAAM,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ACtC;EAEA,OAAO,IAAAsB,YAAG,EAACR,IAAI,CAAC,CAACS,IAAI,CAAEC,QAAQ,IAAK;IAClC,IAAIT,oBAAS,IAAID,IAAI,CAACE,KAAK,EAAE;MAC3B,MAAMd,QAAQ,GAAGM,cAAK,CAACS,iBAAiB,CAACH,IAAI,CAAC;MAE9CN,cAAK,CAACa,OAAO,CAACnB,QAAQ,EAAEsB,QAAQ,CAAC;IACnC;IAEA,OAAOA,QAAQ;EACjB,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA,MAAMC,cAAc,GAClBX,IAAoB,IACuB;EAC3C;EACA,IAAIA,IAAI,CAACY,MAAM,EAAE;IACfZ,IAAI,CAACa,OAAO,GAAG;MACb,iBAAiB,EAAEb,IAAI,CAACY;IAC1B,CAAC;EACH;EAEA,IAAIZ,IAAI,CAACc,cAAc,EAAE;IACvBd,IAAI,CAACe,GAAG,GAAI,GAAEf,IAAI,CAACe,GAAI,sBAAqB;EAC9C;;EAEA;EACA,IAAIC,kBAAO,EAAE;IACX,OAAO,IAAAC,oBAAW,EAACjB,IAAI,CAAC;EAC1B;EAEA,OAAOD,YAAY,CAACC,IAAI,CAAC;AAC3B,CAAC;AAAC,eAEaW,cAAc;AAAA"}
@@ -45,19 +45,19 @@ class XHR {
45
45
 
46
46
  /**
47
47
  */
48
- get xmlhttp() {
48
+ get xmlhttp(): XMLHttpRequest {
49
49
  return this._xmlhttp;
50
50
  }
51
51
 
52
52
  /**
53
53
  */
54
- set xmlhttp(xmlhttp) {
54
+ set xmlhttp(xmlhttp: XMLHttpRequest) {
55
55
  this._xmlhttp = xmlhttp;
56
56
  }
57
57
 
58
58
  /**
59
59
  */
60
- get options() {
60
+ get options(): RequestOptions {
61
61
  return this._options;
62
62
  }
63
63
 
@@ -69,20 +69,20 @@ class XHR {
69
69
 
70
70
  /**
71
71
  */
72
- get attempts() {
72
+ get attempts(): number {
73
73
  return this._attempts;
74
74
  }
75
75
 
76
76
  /**
77
77
  */
78
- set attempts(attempts) {
78
+ set attempts(attempts: number) {
79
79
  this._attempts = attempts;
80
80
  }
81
81
 
82
82
  /**
83
83
  * Create and fix url when params or both querystring and params exist.
84
84
  */
85
- get url() {
85
+ get url(): string {
86
86
  const { url } = this.options;
87
87
  if (this.params !== "") {
88
88
  if (url.includes("?")) {
@@ -99,31 +99,31 @@ class XHR {
99
99
 
100
100
  /**
101
101
  */
102
- get params() {
102
+ get params(): string {
103
103
  return this.options.params || "";
104
104
  }
105
105
 
106
106
  /**
107
107
  */
108
- get data() {
108
+ get data(): string | { [key: string]: string } | null {
109
109
  return this.options.data || null;
110
110
  }
111
111
 
112
112
  /**
113
113
  */
114
- get method() {
114
+ get method(): $Keys<typeof HTTP_METHODS> {
115
115
  return this.options.method || HTTP_METHODS.GET;
116
116
  }
117
117
 
118
118
  /**
119
119
  */
120
- get timeout() {
120
+ get timeout(): number {
121
121
  return this.options.timeout || getSetting("XHR_TIMEOUT_MS", 300000);
122
122
  }
123
123
 
124
124
  /**
125
125
  */
126
- get responseType() {
126
+ get responseType(): string {
127
127
  return this.options.responseType || "json";
128
128
  }
129
129
 
@@ -141,13 +141,13 @@ class XHR {
141
141
 
142
142
  /**
143
143
  */
144
- get events() {
144
+ get events(): { [eventName: string]: () => void } {
145
145
  return this.options.events || {};
146
146
  }
147
147
 
148
148
  /**
149
149
  */
150
- get headers() {
150
+ get headers(): { [string]: string } {
151
151
  const baseHeaders = {
152
152
  Accept: JSON_TYPE,
153
153
  "Content-Type": JSON_TYPE,
@@ -171,13 +171,13 @@ class XHR {
171
171
 
172
172
  /**
173
173
  */
174
- timeoutHandler(reject) {
174
+ timeoutHandler(reject: Function): any {
175
175
  return reject(new TimeoutException(this.url, this.method));
176
176
  }
177
177
 
178
178
  /**
179
179
  */
180
- errorHandler(reject, responseJSON = null) {
180
+ errorHandler(reject: Function, responseJSON: any = null): any {
181
181
  const { status } = this.xmlhttp;
182
182
  const { isReload } = this.options;
183
183
 
@@ -200,7 +200,7 @@ class XHR {
200
200
 
201
201
  /**
202
202
  */
203
- getResponse() {
203
+ getResponse(): any {
204
204
  const { responseType, response } = this.xmlhttp;
205
205
 
206
206
  if (
@@ -223,7 +223,7 @@ class XHR {
223
223
 
224
224
  /**
225
225
  */
226
- responseHandler(resolve, reject) {
226
+ responseHandler(resolve: Function, reject: Function): any {
227
227
  const { status } = this.xmlhttp;
228
228
 
229
229
  let response = null;
@@ -245,7 +245,7 @@ class XHR {
245
245
 
246
246
  /**
247
247
  */
248
- setEventListeners(resolve, reject) {
248
+ setEventListeners(resolve: Function, reject: Function) {
249
249
  if (this.options.onProgress) {
250
250
  ["load", "loadend", "loadstart", "progress"].forEach((eventType) => {
251
251
  this.xmlhttp.addEventListener(eventType, this.onProgress);
@@ -289,7 +289,7 @@ class XHR {
289
289
 
290
290
  /**
291
291
  */
292
- getResponseHeader(headerName) {
292
+ getResponseHeader(headerName: string): string | null {
293
293
  return this.xmlhttp.getResponseHeader(headerName);
294
294
  }
295
295
 
@@ -323,7 +323,7 @@ class XHR {
323
323
 
324
324
  /**
325
325
  */
326
- setXMLHttpRequest() {
326
+ setXMLHttpRequest(): Promise<any> {
327
327
  return new Promise((resolve, reject) => {
328
328
  this.xmlhttp = new XMLHttpRequest();
329
329
 
@@ -343,7 +343,7 @@ class XHR {
343
343
 
344
344
  /**
345
345
  */
346
- async fetch() {
346
+ async fetch(): Promise<any> {
347
347
  try {
348
348
  return await this.setXMLHttpRequest();
349
349
  } catch (err) {
@@ -1 +1 @@
1
- {"version":3,"file":"xhr.js","names":["NETWORK_ERROR_CODE","SUCCESS_CODE","CLIENT_ERROR_CODE","UNAUTHORIZED_CODE","REDIRECTION_CODE","NOT_FOUND_CODE","JSON_TYPE","XHR","constructor","options","_options","_attempts","xmlhttp","_xmlhttp","attempts","url","params","aUrl","split","data","method","HTTP_METHODS","GET","timeout","getSetting","responseType","onProgress","events","headers","baseHeaders","Accept","timeoutHandler","reject","TimeoutException","errorHandler","responseJSON","status","isReload","NetworkException","NotFoundException","UnauthorizedException","FetchException","getResponse","response","getResponseHeader","isPlainObject","JSON","parse","error","JsonParseException","responseHandler","resolve","has","setEventListeners","forEach","eventType","addEventListener","eventName","openConnection","open","setBasicAuthentication","Cache","hasItem","withCredentials","basicToken","getItem","setRequestHeader","headerName","setCustomHeaders","setOtherOptions","sendData","send","stringData","setXMLHttpRequest","XMLHttpRequest","fetch","err","validateInputArguments","args","IllegalArgumentException","toString","xhr"],"sources":["../../../src/utils/fetch/xhr.js"],"sourcesContent":["// @flow\nimport { has, isPlainObject } from \"../helpers/objects\";\n\nimport {\n IllegalArgumentException,\n UnauthorizedException,\n FetchException,\n TimeoutException,\n NotFoundException,\n JsonParseException,\n NetworkException,\n} from \"../../exceptions\";\n\nimport Cache from \"../browser/Cache\";\n\nimport { HTTP_METHODS } from \"../../constants/Constants\";\n\nimport { getSetting } from \"../../constants/Settings\";\n\nimport type { RequestOptions } from \"./types\";\n\nconst NETWORK_ERROR_CODE = 0;\nconst SUCCESS_CODE = 200;\nconst CLIENT_ERROR_CODE = 400;\nconst UNAUTHORIZED_CODE = 401;\nconst REDIRECTION_CODE = 300;\nconst NOT_FOUND_CODE = 404;\n\nconst JSON_TYPE = \"application/json\";\n\n/**\n * @private\n */\nclass XHR {\n _options: RequestOptions;\n _xmlhttp: XMLHttpRequest;\n _attempts: number;\n\n /**\n */\n constructor(options: RequestOptions) {\n this._options = options;\n this._attempts = 0;\n }\n\n /**\n */\n get xmlhttp() {\n return this._xmlhttp;\n }\n\n /**\n */\n set xmlhttp(xmlhttp) {\n this._xmlhttp = xmlhttp;\n }\n\n /**\n */\n get options() {\n return this._options;\n }\n\n /**\n */\n set options(options: RequestOptions) {\n this._options = options;\n }\n\n /**\n */\n get attempts() {\n return this._attempts;\n }\n\n /**\n */\n set attempts(attempts) {\n this._attempts = attempts;\n }\n\n /**\n * Create and fix url when params or both querystring and params exist.\n */\n get url() {\n const { url } = this.options;\n if (this.params !== \"\") {\n if (url.includes(\"?\")) {\n const aUrl = url.split(\"?\");\n\n return `${aUrl[0]}?${aUrl[1]}&${this.params}`;\n }\n\n return `${url}?${this.params}`;\n }\n\n return url;\n }\n\n /**\n */\n get params() {\n return this.options.params || \"\";\n }\n\n /**\n */\n get data() {\n return this.options.data || null;\n }\n\n /**\n */\n get method() {\n return this.options.method || HTTP_METHODS.GET;\n }\n\n /**\n */\n get timeout() {\n return this.options.timeout || getSetting(\"XHR_TIMEOUT_MS\", 300000);\n }\n\n /**\n */\n get responseType() {\n return this.options.responseType || \"json\";\n }\n\n /**\n */\n get onProgress(): ProgressEventHandler {\n if (this.options.onProgress) {\n return this.options.onProgress;\n }\n\n return () => {\n // do nothing\n };\n }\n\n /**\n */\n get events() {\n return this.options.events || {};\n }\n\n /**\n */\n get headers() {\n const baseHeaders = {\n Accept: JSON_TYPE,\n \"Content-Type\": JSON_TYPE,\n\n // needed for csrf, see: https://plaza.beinformed.com/amdoc/csrf-protection-in-modular-ui-services-40054554.html\n \"X-Requested-With\": \"XMLHttpRequest\",\n\n \"Accept-Language\": \"en\",\n };\n\n if (this.options.headers) {\n // $FlowFixMe[cannot-spread-indexer]\n return {\n ...baseHeaders,\n ...this.options.headers,\n };\n }\n\n return baseHeaders;\n }\n\n /**\n */\n timeoutHandler(reject) {\n return reject(new TimeoutException(this.url, this.method));\n }\n\n /**\n */\n errorHandler(reject, responseJSON = null) {\n const { status } = this.xmlhttp;\n const { isReload } = this.options;\n\n if (status === NETWORK_ERROR_CODE) {\n return reject(new NetworkException(this.url, this.method));\n }\n\n if (status === NOT_FOUND_CODE) {\n return reject(new NotFoundException(this.url, this.method, isReload));\n }\n\n if (status === UNAUTHORIZED_CODE) {\n return reject(\n new UnauthorizedException(this.url, this.method, responseJSON)\n );\n }\n\n return reject(new FetchException(responseJSON, this.xmlhttp, this.options));\n }\n\n /**\n */\n getResponse() {\n const { responseType, response } = this.xmlhttp;\n\n if (\n (responseType === \"\" || responseType === \"text\") &&\n this.getResponseHeader(\"Content-Type\") === JSON_TYPE\n ) {\n if (isPlainObject(response)) {\n return response;\n }\n\n try {\n return JSON.parse(response);\n } catch (error) {\n throw new JsonParseException(error);\n }\n }\n\n return response;\n }\n\n /**\n */\n responseHandler(resolve, reject) {\n const { status } = this.xmlhttp;\n\n let response = null;\n try {\n response = this.getResponse();\n } catch (error) {\n return reject(error);\n }\n\n if (\n (status >= SUCCESS_CODE && status < REDIRECTION_CODE) ||\n (status === CLIENT_ERROR_CODE && has(response, \"formresponse\"))\n ) {\n return resolve(response);\n }\n\n return this.errorHandler(reject, response);\n }\n\n /**\n */\n setEventListeners(resolve, reject) {\n if (this.options.onProgress) {\n [\"load\", \"loadend\", \"loadstart\", \"progress\"].forEach((eventType) => {\n this.xmlhttp.addEventListener(eventType, this.onProgress);\n });\n }\n\n [\"abort\", \"error\"].forEach((eventType) => {\n this.xmlhttp.addEventListener(eventType, () => this.errorHandler(reject));\n });\n\n this.xmlhttp.addEventListener(\"timeout\", () => this.timeoutHandler(reject));\n\n this.xmlhttp.addEventListener(\"load\", () =>\n this.responseHandler(resolve, reject)\n );\n\n // Set custom events\n Object.keys(this.events).forEach((eventName) => {\n this.xmlhttp.addEventListener(eventName, this.events[eventName]);\n });\n }\n\n /**\n */\n openConnection() {\n this.xmlhttp.open(this.method, this.url, true);\n }\n\n /**\n */\n setBasicAuthentication() {\n if (Cache.hasItem(\"basic\")) {\n this.xmlhttp.withCredentials = true;\n const basicToken = Cache.getItem(\"basic\");\n\n if (typeof basicToken === \"string\") {\n this.xmlhttp.setRequestHeader(\"Authorization\", `Basic ${basicToken}`);\n }\n }\n }\n\n /**\n */\n getResponseHeader(headerName) {\n return this.xmlhttp.getResponseHeader(headerName);\n }\n\n /**\n */\n setCustomHeaders() {\n Object.keys(this.headers).forEach((headerName) => {\n this.xmlhttp.setRequestHeader(headerName, this.headers[headerName]);\n });\n }\n\n /**\n */\n setOtherOptions() {\n this.xmlhttp.responseType = this.responseType;\n this.xmlhttp.timeout = this.timeout;\n }\n\n /**\n */\n sendData() {\n if (this.data == null) {\n this.xmlhttp.send();\n } else {\n const stringData = isPlainObject(this.data)\n ? JSON.stringify(this.data)\n : this.data;\n this.xmlhttp.send(stringData);\n }\n }\n\n /**\n */\n setXMLHttpRequest() {\n return new Promise((resolve, reject) => {\n this.xmlhttp = new XMLHttpRequest();\n\n this.setEventListeners(resolve, reject);\n\n this.openConnection();\n\n this.setBasicAuthentication();\n\n this.setCustomHeaders();\n\n this.setOtherOptions();\n\n this.sendData();\n });\n }\n\n /**\n */\n async fetch() {\n try {\n return await this.setXMLHttpRequest();\n } catch (err) {\n if (err instanceof NetworkException && this.attempts < 2) {\n this.attempts += 1;\n return this.fetch();\n }\n\n throw err;\n }\n }\n}\n\n/**\n */\nconst validateInputArguments = (args: RequestOptions) => {\n if (args == null) {\n throw new IllegalArgumentException(\n \"Missing request options, expecting an object as argument for xhr\"\n );\n }\n\n if (!isPlainObject(args)) {\n throw new IllegalArgumentException(\n `Expecting an object as argument for xhr, but received: ${args.toString()}`\n );\n }\n\n if (!has(args, \"url\")) {\n throw new IllegalArgumentException(\n `No url property found in arguments of xhr, received: ${JSON.stringify(\n args\n )}`\n );\n }\n\n return true;\n};\n\n/**\n */\nconst xhr = (args: RequestOptions): Promise<any> => {\n validateInputArguments(args);\n\n return new XHR(args).fetch();\n};\n\nexport default xhr;\n"],"mappings":";;;;;;;;;;;;AACA;AAEA;AAUA;AAEA;AAEA;AAIA,MAAMA,kBAAkB,GAAG,CAAC;AAC5B,MAAMC,YAAY,GAAG,GAAG;AACxB,MAAMC,iBAAiB,GAAG,GAAG;AAC7B,MAAMC,iBAAiB,GAAG,GAAG;AAC7B,MAAMC,gBAAgB,GAAG,GAAG;AAC5B,MAAMC,cAAc,GAAG,GAAG;AAE1B,MAAMC,SAAS,GAAG,kBAAkB;;AAEpC;AACA;AACA;AACA,MAAMC,GAAG,CAAC;EAKR;AACF;EACEC,WAAW,CAACC,OAAuB,EAAE;IAAA;IAAA;IAAA;IACnC,IAAI,CAACC,QAAQ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,IAAI,CAAC,EAAE;IACxB,MAAM,IAAIC,oCAAwB,CAC/B,0DAAyDD,IAAI,CAACE,QAAQ,EAAG,EAAC,CAC5E;EACH;EAEA,IAAI,CAAC,IAAA5B,YAAG,EAAC0B,IAAI,EAAE,KAAK,CAAC,EAAE;IACrB,MAAM,IAAIC,oCAAwB,CAC/B,wDAAuD,wBACtDD,IAAI,CACJ,EAAC,CACJ;EACH;EAEA,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA,MAAMG,GAAG,GAAIH,IAAoB,IAAmB;EAClDD,sBAAsB,CAACC,IAAI,CAAC;EAE5B,OAAO,IAAIvE,GAAG,CAACuE,IAAI,CAAC,CAACH,KAAK,EAAE;AAC9B,CAAC;AAAC,eAEaM,GAAG;AAAA"}
1
+ {"version":3,"file":"xhr.js","names":["NETWORK_ERROR_CODE","SUCCESS_CODE","CLIENT_ERROR_CODE","UNAUTHORIZED_CODE","REDIRECTION_CODE","NOT_FOUND_CODE","JSON_TYPE","XHR","constructor","options","_options","_attempts","xmlhttp","_xmlhttp","attempts","url","params","aUrl","split","data","method","HTTP_METHODS","GET","timeout","getSetting","responseType","onProgress","events","headers","baseHeaders","Accept","timeoutHandler","reject","TimeoutException","errorHandler","responseJSON","status","isReload","NetworkException","NotFoundException","UnauthorizedException","FetchException","getResponse","response","getResponseHeader","isPlainObject","JSON","parse","error","JsonParseException","responseHandler","resolve","has","setEventListeners","forEach","eventType","addEventListener","eventName","openConnection","open","setBasicAuthentication","Cache","hasItem","withCredentials","basicToken","getItem","setRequestHeader","headerName","setCustomHeaders","setOtherOptions","sendData","send","stringData","setXMLHttpRequest","XMLHttpRequest","fetch","err","validateInputArguments","args","IllegalArgumentException","toString","xhr"],"sources":["../../../src/utils/fetch/xhr.js"],"sourcesContent":["// @flow\nimport { has, isPlainObject } from \"../helpers/objects\";\n\nimport {\n IllegalArgumentException,\n UnauthorizedException,\n FetchException,\n TimeoutException,\n NotFoundException,\n JsonParseException,\n NetworkException,\n} from \"../../exceptions\";\n\nimport Cache from \"../browser/Cache\";\n\nimport { HTTP_METHODS } from \"../../constants/Constants\";\n\nimport { getSetting } from \"../../constants/Settings\";\n\nimport type { RequestOptions } from \"./types\";\n\nconst NETWORK_ERROR_CODE = 0;\nconst SUCCESS_CODE = 200;\nconst CLIENT_ERROR_CODE = 400;\nconst UNAUTHORIZED_CODE = 401;\nconst REDIRECTION_CODE = 300;\nconst NOT_FOUND_CODE = 404;\n\nconst JSON_TYPE = \"application/json\";\n\n/**\n * @private\n */\nclass XHR {\n _options: RequestOptions;\n _xmlhttp: XMLHttpRequest;\n _attempts: number;\n\n /**\n */\n constructor(options: RequestOptions) {\n this._options = options;\n this._attempts = 0;\n }\n\n /**\n */\n get xmlhttp(): XMLHttpRequest {\n return this._xmlhttp;\n }\n\n /**\n */\n set xmlhttp(xmlhttp: XMLHttpRequest) {\n this._xmlhttp = xmlhttp;\n }\n\n /**\n */\n get options(): RequestOptions {\n return this._options;\n }\n\n /**\n */\n set options(options: RequestOptions) {\n this._options = options;\n }\n\n /**\n */\n get attempts(): number {\n return this._attempts;\n }\n\n /**\n */\n set attempts(attempts: number) {\n this._attempts = attempts;\n }\n\n /**\n * Create and fix url when params or both querystring and params exist.\n */\n get url(): string {\n const { url } = this.options;\n if (this.params !== \"\") {\n if (url.includes(\"?\")) {\n const aUrl = url.split(\"?\");\n\n return `${aUrl[0]}?${aUrl[1]}&${this.params}`;\n }\n\n return `${url}?${this.params}`;\n }\n\n return url;\n }\n\n /**\n */\n get params(): string {\n return this.options.params || \"\";\n }\n\n /**\n */\n get data(): string | { [key: string]: string } | null {\n return this.options.data || null;\n }\n\n /**\n */\n get method(): $Keys<typeof HTTP_METHODS> {\n return this.options.method || HTTP_METHODS.GET;\n }\n\n /**\n */\n get timeout(): number {\n return this.options.timeout || getSetting(\"XHR_TIMEOUT_MS\", 300000);\n }\n\n /**\n */\n get responseType(): string {\n return this.options.responseType || \"json\";\n }\n\n /**\n */\n get onProgress(): ProgressEventHandler {\n if (this.options.onProgress) {\n return this.options.onProgress;\n }\n\n return () => {\n // do nothing\n };\n }\n\n /**\n */\n get events(): { [eventName: string]: () => void } {\n return this.options.events || {};\n }\n\n /**\n */\n get headers(): { [string]: string } {\n const baseHeaders = {\n Accept: JSON_TYPE,\n \"Content-Type\": JSON_TYPE,\n\n // needed for csrf, see: https://plaza.beinformed.com/amdoc/csrf-protection-in-modular-ui-services-40054554.html\n \"X-Requested-With\": \"XMLHttpRequest\",\n\n \"Accept-Language\": \"en\",\n };\n\n if (this.options.headers) {\n // $FlowFixMe[cannot-spread-indexer]\n return {\n ...baseHeaders,\n ...this.options.headers,\n };\n }\n\n return baseHeaders;\n }\n\n /**\n */\n timeoutHandler(reject: Function): any {\n return reject(new TimeoutException(this.url, this.method));\n }\n\n /**\n */\n errorHandler(reject: Function, responseJSON: any = null): any {\n const { status } = this.xmlhttp;\n const { isReload } = this.options;\n\n if (status === NETWORK_ERROR_CODE) {\n return reject(new NetworkException(this.url, this.method));\n }\n\n if (status === NOT_FOUND_CODE) {\n return reject(new NotFoundException(this.url, this.method, isReload));\n }\n\n if (status === UNAUTHORIZED_CODE) {\n return reject(\n new UnauthorizedException(this.url, this.method, responseJSON)\n );\n }\n\n return reject(new FetchException(responseJSON, this.xmlhttp, this.options));\n }\n\n /**\n */\n getResponse(): any {\n const { responseType, response } = this.xmlhttp;\n\n if (\n (responseType === \"\" || responseType === \"text\") &&\n this.getResponseHeader(\"Content-Type\") === JSON_TYPE\n ) {\n if (isPlainObject(response)) {\n return response;\n }\n\n try {\n return JSON.parse(response);\n } catch (error) {\n throw new JsonParseException(error);\n }\n }\n\n return response;\n }\n\n /**\n */\n responseHandler(resolve: Function, reject: Function): any {\n const { status } = this.xmlhttp;\n\n let response = null;\n try {\n response = this.getResponse();\n } catch (error) {\n return reject(error);\n }\n\n if (\n (status >= SUCCESS_CODE && status < REDIRECTION_CODE) ||\n (status === CLIENT_ERROR_CODE && has(response, \"formresponse\"))\n ) {\n return resolve(response);\n }\n\n return this.errorHandler(reject, response);\n }\n\n /**\n */\n setEventListeners(resolve: Function, reject: Function) {\n if (this.options.onProgress) {\n [\"load\", \"loadend\", \"loadstart\", \"progress\"].forEach((eventType) => {\n this.xmlhttp.addEventListener(eventType, this.onProgress);\n });\n }\n\n [\"abort\", \"error\"].forEach((eventType) => {\n this.xmlhttp.addEventListener(eventType, () => this.errorHandler(reject));\n });\n\n this.xmlhttp.addEventListener(\"timeout\", () => this.timeoutHandler(reject));\n\n this.xmlhttp.addEventListener(\"load\", () =>\n this.responseHandler(resolve, reject)\n );\n\n // Set custom events\n Object.keys(this.events).forEach((eventName) => {\n this.xmlhttp.addEventListener(eventName, this.events[eventName]);\n });\n }\n\n /**\n */\n openConnection() {\n this.xmlhttp.open(this.method, this.url, true);\n }\n\n /**\n */\n setBasicAuthentication() {\n if (Cache.hasItem(\"basic\")) {\n this.xmlhttp.withCredentials = true;\n const basicToken = Cache.getItem(\"basic\");\n\n if (typeof basicToken === \"string\") {\n this.xmlhttp.setRequestHeader(\"Authorization\", `Basic ${basicToken}`);\n }\n }\n }\n\n /**\n */\n getResponseHeader(headerName: string): string | null {\n return this.xmlhttp.getResponseHeader(headerName);\n }\n\n /**\n */\n setCustomHeaders() {\n Object.keys(this.headers).forEach((headerName) => {\n this.xmlhttp.setRequestHeader(headerName, this.headers[headerName]);\n });\n }\n\n /**\n */\n setOtherOptions() {\n this.xmlhttp.responseType = this.responseType;\n this.xmlhttp.timeout = this.timeout;\n }\n\n /**\n */\n sendData() {\n if (this.data == null) {\n this.xmlhttp.send();\n } else {\n const stringData = isPlainObject(this.data)\n ? JSON.stringify(this.data)\n : this.data;\n this.xmlhttp.send(stringData);\n }\n }\n\n /**\n */\n setXMLHttpRequest(): Promise<any> {\n return new Promise((resolve, reject) => {\n this.xmlhttp = new XMLHttpRequest();\n\n this.setEventListeners(resolve, reject);\n\n this.openConnection();\n\n this.setBasicAuthentication();\n\n this.setCustomHeaders();\n\n this.setOtherOptions();\n\n this.sendData();\n });\n }\n\n /**\n */\n async fetch(): Promise<any> {\n try {\n return await this.setXMLHttpRequest();\n } catch (err) {\n if (err instanceof NetworkException && this.attempts < 2) {\n this.attempts += 1;\n return this.fetch();\n }\n\n throw err;\n }\n }\n}\n\n/**\n */\nconst validateInputArguments = (args: RequestOptions) => {\n if (args == null) {\n throw new IllegalArgumentException(\n \"Missing request options, expecting an object as argument for xhr\"\n );\n }\n\n if (!isPlainObject(args)) {\n throw new IllegalArgumentException(\n `Expecting an object as argument for xhr, but received: ${args.toString()}`\n );\n }\n\n if (!has(args, \"url\")) {\n throw new IllegalArgumentException(\n `No url property found in arguments of xhr, received: ${JSON.stringify(\n args\n )}`\n );\n }\n\n return true;\n};\n\n/**\n */\nconst xhr = (args: RequestOptions): Promise<any> => {\n validateInputArguments(args);\n\n return new XHR(args).fetch();\n};\n\nexport default xhr;\n"],"mappings":";;;;;;;;;;;;AACA;AAEA;AAUA;AAEA;AAEA;AAIA,MAAMA,kBAAkB,GAAG,CAAC;AAC5B,MAAMC,YAAY,GAAG,GAAG;AACxB,MAAMC,iBAAiB,GAAG,GAAG;AAC7B,MAAMC,iBAAiB,GAAG,GAAG;AAC7B,MAAMC,gBAAgB,GAAG,GAAG;AAC5B,MAAMC,cAAc,GAAG,GAAG;AAE1B,MAAMC,SAAS,GAAG,kBAAkB;;AAEpC;AACA;AACA;AACA,MAAMC,GAAG,CAAC;EAKR;AACF;EACEC,WAAW,CAACC,OAAuB,EAAE;IAAA;IAAA;IAAA;IACnC,IAAI,CAACC,QAAQ,GAAGD,OAAO;IACvB,IAAI,CAACE,SAAS,GAAG,CAAC;EACpB;;EAEA;AACF;EACE,IAAIC,OAAO,GAAmB;IAC5B,OAAO,IAAI,CAACC,QAAQ;EACtB;;EAEA;AACF;EACE,IAAID,OAAO,CAACA,OAAuB,EAAE;IACnC,IAAI,CAACC,QAAQ,GAAGD,OAAO;EACzB;;EAEA;AACF;EACE,IAAIH,OAAO,GAAmB;IAC5B,OAAO,IAA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C,CACJ;EACH;EAEA,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA,MAAMG,GAAG,GAAIH,IAAoB,IAAmB;EAClDD,sBAAsB,CAACC,IAAI,CAAC;EAE5B,OAAO,IAAIvE,GAAG,CAACuE,IAAI,CAAC,CAACH,KAAK,EAAE;AAC9B,CAAC;AAAC,eAEaM,GAAG;AAAA"}
@@ -4,11 +4,11 @@ import _isPlainObject from "lodash/isPlainObject";
4
4
 
5
5
  /**
6
6
  */
7
- export const isPlainObject = (value: any): boolean => _isPlainObject(value);
7
+ const isPlainObject = (value: any): boolean => _isPlainObject(value);
8
8
 
9
9
  /**
10
10
  */
11
- export const has = (obj: any, propName: string): boolean => {
11
+ const has = (obj: any, propName: string): boolean => {
12
12
  if (!isPlainObject(obj)) {
13
13
  return false;
14
14
  }
@@ -20,7 +20,7 @@ export const has = (obj: any, propName: string): boolean => {
20
20
  * Retrieve property of an object
21
21
  * When path is only one deep better use optional chaining
22
22
  */
23
- export const get = (obj: { ... }, path: string, defaultValue?: any): any =>
23
+ const get = (obj: Object, path: string, defaultValue?: any): any =>
24
24
  String(path)
25
25
  .split(".")
26
26
  .reduce((acc, v) => {
@@ -29,3 +29,5 @@ export const get = (obj: { ... }, path: string, defaultValue?: any): any =>
29
29
  }
30
30
  return defaultValue;
31
31
  }, obj);
32
+
33
+ export { get, has, isPlainObject };
@@ -1 +1 @@
1
- {"version":3,"file":"objects.js","names":["isPlainObject","value","_isPlainObject","has","obj","propName","_has","get","path","defaultValue","String","split","reduce","acc","v"],"sources":["../../../src/utils/helpers/objects.js"],"sourcesContent":["// @flow\nimport _has from \"lodash/has\";\nimport _isPlainObject from \"lodash/isPlainObject\";\n\n/**\n */\nexport const isPlainObject = (value: any): boolean => _isPlainObject(value);\n\n/**\n */\nexport const has = (obj: any, propName: string): boolean => {\n if (!isPlainObject(obj)) {\n return false;\n }\n\n return _has(obj, propName);\n};\n\n/**\n * Retrieve property of an object\n * When path is only one deep better use optional chaining\n */\nexport const get = (obj: { ... }, path: string, defaultValue?: any): any =>\n String(path)\n .split(\".\")\n .reduce((acc, v) => {\n if (typeof acc === \"object\") {\n return acc[v] ?? defaultValue;\n }\n return defaultValue;\n }, obj);\n"],"mappings":";;;;;;;AACA;AACA;AAEA;AACA;AACO,MAAMA,aAAa,GAAIC,KAAU,IAAc,IAAAC,uBAAc,EAACD,KAAK,CAAC;;AAE3E;AACA;AADA;AAEO,MAAME,GAAG,GAAG,CAACC,GAAQ,EAAEC,QAAgB,KAAc;EAC1D,IAAI,CAACL,aAAa,CAACI,GAAG,CAAC,EAAE;IACvB,OAAO,KAAK;EACd;EAEA,OAAO,IAAAE,aAAI,EAACF,GAAG,EAAEC,QAAQ,CAAC;AAC5B,CAAC;;AAED;AACA;AACA;AACA;AAHA;AAIO,MAAME,GAAG,GAAG,CAACH,GAAY,EAAEI,IAAY,EAAEC,YAAkB,KAChEC,MAAM,CAACF,IAAI,CAAC,CACTG,KAAK,CAAC,GAAG,CAAC,CACVC,MAAM,CAAC,CAACC,GAAG,EAAEC,CAAC,KAAK;EAClB,IAAI,OAAOD,GAAG,KAAK,QAAQ,EAAE;IAC3B,OAAOA,GAAG,CAACC,CAAC,CAAC,IAAIL,YAAY;EAC/B;EACA,OAAOA,YAAY;AACrB,CAAC,EAAEL,GAAG,CAAC;AAAC"}
1
+ {"version":3,"file":"objects.js","names":["isPlainObject","value","_isPlainObject","has","obj","propName","_has","get","path","defaultValue","String","split","reduce","acc","v"],"sources":["../../../src/utils/helpers/objects.js"],"sourcesContent":["// @flow\nimport _has from \"lodash/has\";\nimport _isPlainObject from \"lodash/isPlainObject\";\n\n/**\n */\nconst isPlainObject = (value: any): boolean => _isPlainObject(value);\n\n/**\n */\nconst has = (obj: any, propName: string): boolean => {\n if (!isPlainObject(obj)) {\n return false;\n }\n\n return _has(obj, propName);\n};\n\n/**\n * Retrieve property of an object\n * When path is only one deep better use optional chaining\n */\nconst get = (obj: Object, path: string, defaultValue?: any): any =>\n String(path)\n .split(\".\")\n .reduce((acc, v) => {\n if (typeof acc === \"object\") {\n return acc[v] ?? defaultValue;\n }\n return defaultValue;\n }, obj);\n\nexport { get, has, isPlainObject };\n"],"mappings":";;;;;;;AACA;AACA;AAEA;AACA;AACA,MAAMA,aAAa,GAAIC,KAAU,IAAc,IAAAC,uBAAc,EAACD,KAAK,CAAC;;AAEpE;AACA;AADA;AAEA,MAAME,GAAG,GAAG,CAACC,GAAQ,EAAEC,QAAgB,KAAc;EACnD,IAAI,CAACL,aAAa,CAACI,GAAG,CAAC,EAAE;IACvB,OAAO,KAAK;EACd;EAEA,OAAO,IAAAE,aAAI,EAACF,GAAG,EAAEC,QAAQ,CAAC;AAC5B,CAAC;;AAED;AACA;AACA;AACA;AAHA;AAIA,MAAME,GAAG,GAAG,CAACH,GAAW,EAAEI,IAAY,EAAEC,YAAkB,KACxDC,MAAM,CAACF,IAAI,CAAC,CACTG,KAAK,CAAC,GAAG,CAAC,CACVC,MAAM,CAAC,CAACC,GAAG,EAAEC,CAAC,KAAK;EAClB,IAAI,OAAOD,GAAG,KAAK,QAAQ,EAAE;IAC3B,OAAOA,GAAG,CAACC,CAAC,CAAC,IAAIL,YAAY;EAC/B;EACA,OAAOA,YAAY;AACrB,CAAC,EAAEL,GAAG,CAAC;AAAC"}
@@ -11,7 +11,7 @@ type removeUnwantedHtmlOptions = {
11
11
  * Translates html entities to their correct decimal equivalent
12
12
  * When path is only one deep better use optional chaining
13
13
  */
14
- const properEntityEncoding = (html) => {
14
+ const properEntityEncoding = (html: string) => {
15
15
  const escapedGt = html.replace(/</g, "[");
16
16
  const escapedLt = escapedGt.replace(/>/g, "]");
17
17