@beinformed/ui 1.34.2 → 1.35.0

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 (292) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/esm/models/filters/StringFilterModel.js +3 -2
  3. package/esm/models/filters/StringFilterModel.js.map +1 -1
  4. package/esm/react-server/serverNoSSR.js +4 -0
  5. package/esm/react-server/serverNoSSR.js.map +1 -1
  6. package/lib/constants/Constants.js +66 -33
  7. package/lib/constants/Constants.js.map +1 -1
  8. package/lib/constants/LayoutHintConfig.js +2 -1
  9. package/lib/constants/LayoutHintConfig.js.map +1 -1
  10. package/lib/constants/LayoutHints.js +36 -18
  11. package/lib/constants/LayoutHints.js.map +1 -1
  12. package/lib/constants/Settings.js +6 -3
  13. package/lib/constants/Settings.js.map +1 -1
  14. package/lib/exceptions/ConfigurationException.js +2 -1
  15. package/lib/exceptions/ConfigurationException.js.map +1 -1
  16. package/lib/exceptions/IllegalArgumentException.js +2 -1
  17. package/lib/exceptions/IllegalArgumentException.js.map +1 -1
  18. package/lib/exceptions/IllegalReturnException.js +2 -1
  19. package/lib/exceptions/IllegalReturnException.js.map +1 -1
  20. package/lib/exceptions/IllegalStateException.js +2 -1
  21. package/lib/exceptions/IllegalStateException.js.map +1 -1
  22. package/lib/exceptions/JsonParseException.js +2 -1
  23. package/lib/exceptions/JsonParseException.js.map +1 -1
  24. package/lib/exceptions/MissingPropertyException.js +2 -1
  25. package/lib/exceptions/MissingPropertyException.js.map +1 -1
  26. package/lib/exceptions/NetworkException.js +2 -1
  27. package/lib/exceptions/NetworkException.js.map +1 -1
  28. package/lib/exceptions/NotAllowedUriException.js +2 -1
  29. package/lib/exceptions/NotAllowedUriException.js.map +1 -1
  30. package/lib/exceptions/NotFoundException.js +2 -1
  31. package/lib/exceptions/NotFoundException.js.map +1 -1
  32. package/lib/exceptions/ServerRequestException.js +2 -1
  33. package/lib/exceptions/ServerRequestException.js.map +1 -1
  34. package/lib/exceptions/ThemePropertyException.js +2 -1
  35. package/lib/exceptions/ThemePropertyException.js.map +1 -1
  36. package/lib/exceptions/TimeoutException.js +2 -1
  37. package/lib/exceptions/TimeoutException.js.map +1 -1
  38. package/lib/exceptions/UnauthorizedException.js +2 -1
  39. package/lib/exceptions/UnauthorizedException.js.map +1 -1
  40. package/lib/exceptions/UnsupportedOperationException.js +2 -1
  41. package/lib/exceptions/UnsupportedOperationException.js.map +1 -1
  42. package/lib/hooks/useDeepCompareEffect.js +2 -1
  43. package/lib/hooks/useDeepCompareEffect.js.map +1 -1
  44. package/lib/i18n/Locale.js +2 -1
  45. package/lib/i18n/Locale.js.map +1 -1
  46. package/lib/i18n/Locales.js +4 -2
  47. package/lib/i18n/Locales.js.map +1 -1
  48. package/lib/i18n/Message.js +2 -1
  49. package/lib/i18n/Message.js.map +1 -1
  50. package/lib/i18n/languages.js +2 -1
  51. package/lib/i18n/languages.js.map +1 -1
  52. package/lib/i18n/translations/beinformed_error_messages_en.nl.js +2 -1
  53. package/lib/i18n/translations/beinformed_error_messages_en.nl.js.map +1 -1
  54. package/lib/i18n/translations/beinformed_error_messages_nl.nl.js +2 -1
  55. package/lib/i18n/translations/beinformed_error_messages_nl.nl.js.map +1 -1
  56. package/lib/i18n/withMessage.js +2 -1
  57. package/lib/i18n/withMessage.js.map +1 -1
  58. package/lib/models/attributes/AttributeCollection.js +2 -1
  59. package/lib/models/attributes/AttributeCollection.js.map +1 -1
  60. package/lib/models/attributes/AttributeContent.js +2 -1
  61. package/lib/models/attributes/AttributeContent.js.map +1 -1
  62. package/lib/models/attributes/AttributeDataHelper.js +2 -1
  63. package/lib/models/attributes/AttributeDataHelper.js.map +1 -1
  64. package/lib/models/attributes/ChoiceAttributeOptionCollection.js +2 -1
  65. package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
  66. package/lib/models/attributes/ChoiceAttributeOptionModel.js +2 -1
  67. package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  68. package/lib/models/attributes/CompositeAttributeChildCollection.js +2 -1
  69. package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
  70. package/lib/models/attributes/CompositeAttributeModel.js +2 -1
  71. package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
  72. package/lib/models/attributes/DatetimeAttributeModel.js +2 -1
  73. package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
  74. package/lib/models/attributes/_createAttribute.js +2 -1
  75. package/lib/models/attributes/_createAttribute.js.map +1 -1
  76. package/lib/models/attributes/input-constraints/BSNConstraint.js +2 -1
  77. package/lib/models/attributes/input-constraints/BSNConstraint.js.map +1 -1
  78. package/lib/models/attributes/input-constraints/DateBoundaryConstraint.js +2 -1
  79. package/lib/models/attributes/input-constraints/DateBoundaryConstraint.js.map +1 -1
  80. package/lib/models/attributes/input-constraints/DateTimeDateFormatConstraint.js +2 -1
  81. package/lib/models/attributes/input-constraints/DateTimeDateFormatConstraint.js.map +1 -1
  82. package/lib/models/attributes/input-constraints/DateTimeTimeFormatConstraint.js +2 -1
  83. package/lib/models/attributes/input-constraints/DateTimeTimeFormatConstraint.js.map +1 -1
  84. package/lib/models/attributes/input-constraints/DatetimeFormatConstraint.js +2 -1
  85. package/lib/models/attributes/input-constraints/DatetimeFormatConstraint.js.map +1 -1
  86. package/lib/models/attributes/input-constraints/FileExtensionConstraint.js +2 -1
  87. package/lib/models/attributes/input-constraints/FileExtensionConstraint.js.map +1 -1
  88. package/lib/models/attributes/input-constraints/FileSizeConstraint.js +2 -1
  89. package/lib/models/attributes/input-constraints/FileSizeConstraint.js.map +1 -1
  90. package/lib/models/attributes/input-constraints/IBANConstraint.js +2 -1
  91. package/lib/models/attributes/input-constraints/IBANConstraint.js.map +1 -1
  92. package/lib/models/attributes/input-constraints/MandatoryConstraint.js +2 -1
  93. package/lib/models/attributes/input-constraints/MandatoryConstraint.js.map +1 -1
  94. package/lib/models/attributes/input-constraints/MandatoryRangeConstraint.js +2 -1
  95. package/lib/models/attributes/input-constraints/MandatoryRangeConstraint.js.map +1 -1
  96. package/lib/models/attributes/input-constraints/NumberBoundaryConstraint.js +2 -1
  97. package/lib/models/attributes/input-constraints/NumberBoundaryConstraint.js.map +1 -1
  98. package/lib/models/attributes/input-constraints/NumberFormatConstraint.js +2 -1
  99. package/lib/models/attributes/input-constraints/NumberFormatConstraint.js.map +1 -1
  100. package/lib/models/attributes/input-constraints/NumberGroupingConstraint.js +2 -1
  101. package/lib/models/attributes/input-constraints/NumberGroupingConstraint.js.map +1 -1
  102. package/lib/models/attributes/input-constraints/PasswordConfirmConstraint.js +2 -1
  103. package/lib/models/attributes/input-constraints/PasswordConfirmConstraint.js.map +1 -1
  104. package/lib/models/attributes/input-constraints/PasswordLowerAndUpperCaseConstraint.js +2 -1
  105. package/lib/models/attributes/input-constraints/PasswordLowerAndUpperCaseConstraint.js.map +1 -1
  106. package/lib/models/attributes/input-constraints/PasswordMinNumericCharactersConstraint.js +2 -1
  107. package/lib/models/attributes/input-constraints/PasswordMinNumericCharactersConstraint.js.map +1 -1
  108. package/lib/models/attributes/input-constraints/PasswordMinSpecialCharactersConstraint.js +2 -1
  109. package/lib/models/attributes/input-constraints/PasswordMinSpecialCharactersConstraint.js.map +1 -1
  110. package/lib/models/attributes/input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint.js +2 -1
  111. package/lib/models/attributes/input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint.js.map +1 -1
  112. package/lib/models/attributes/input-constraints/RangeConstraint.js +2 -1
  113. package/lib/models/attributes/input-constraints/RangeConstraint.js.map +1 -1
  114. package/lib/models/attributes/input-constraints/RegexConstraint.js +2 -1
  115. package/lib/models/attributes/input-constraints/RegexConstraint.js.map +1 -1
  116. package/lib/models/attributes/input-constraints/StringLengthConstraint.js +2 -1
  117. package/lib/models/attributes/input-constraints/StringLengthConstraint.js.map +1 -1
  118. package/lib/models/attributes/input-constraints/XMLConstraint.js +2 -1
  119. package/lib/models/attributes/input-constraints/XMLConstraint.js.map +1 -1
  120. package/lib/models/attributes/layouthint-rules/BaseLayoutHintRule.js +2 -1
  121. package/lib/models/attributes/layouthint-rules/BaseLayoutHintRule.js.map +1 -1
  122. package/lib/models/attributes/layouthint-rules/DependentAttribute.js +2 -1
  123. package/lib/models/attributes/layouthint-rules/DependentAttribute.js.map +1 -1
  124. package/lib/models/attributes/layouthint-rules/LayoutHintRuleCollection.js +2 -1
  125. package/lib/models/attributes/layouthint-rules/LayoutHintRuleCollection.js.map +1 -1
  126. package/lib/models/attributes/layouthint-rules/RemainingTotalUploadSize.js +2 -1
  127. package/lib/models/attributes/layouthint-rules/RemainingTotalUploadSize.js.map +1 -1
  128. package/lib/models/base/BaseCollection.js +2 -1
  129. package/lib/models/base/BaseCollection.js.map +1 -1
  130. package/lib/models/base/BaseModel.js +2 -1
  131. package/lib/models/base/BaseModel.js.map +1 -1
  132. package/lib/models/base/ResourceCollection.js +2 -1
  133. package/lib/models/base/ResourceCollection.js.map +1 -1
  134. package/lib/models/base/ResourceModel.js +2 -1
  135. package/lib/models/base/ResourceModel.js.map +1 -1
  136. package/lib/models/concepts/BusinessScenarioModel.js +2 -1
  137. package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
  138. package/lib/models/concepts/ConceptTypeDetailModel.js +2 -1
  139. package/lib/models/concepts/ConceptTypeDetailModel.js.map +1 -1
  140. package/lib/models/concepts/SourceReferenceModel.js +2 -1
  141. package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
  142. package/lib/models/content/SectionModel.js +2 -1
  143. package/lib/models/content/SectionModel.js.map +1 -1
  144. package/lib/models/contentconfiguration/ContentConfigurationElements.js +2 -1
  145. package/lib/models/contentconfiguration/ContentConfigurationElements.js.map +1 -1
  146. package/lib/models/contentconfiguration/ContentConfigurationEndResults.js +2 -1
  147. package/lib/models/contentconfiguration/ContentConfigurationEndResults.js.map +1 -1
  148. package/lib/models/contentconfiguration/ContentConfigurationQuestions.js +2 -1
  149. package/lib/models/contentconfiguration/ContentConfigurationQuestions.js.map +1 -1
  150. package/lib/models/contentconfiguration/ContentConfigurationResults.js +2 -1
  151. package/lib/models/contentconfiguration/ContentConfigurationResults.js.map +1 -1
  152. package/lib/models/error/ErrorModel.js +2 -1
  153. package/lib/models/error/ErrorModel.js.map +1 -1
  154. package/lib/models/filters/StringFilterModel.js +2 -2
  155. package/lib/models/filters/StringFilterModel.js.flow +2 -2
  156. package/lib/models/filters/StringFilterModel.js.map +1 -1
  157. package/lib/models/form/FormModel.js +2 -1
  158. package/lib/models/form/FormModel.js.map +1 -1
  159. package/lib/models/href/Href.js +2 -1
  160. package/lib/models/href/Href.js.map +1 -1
  161. package/lib/models/links/LinkModel.js +2 -1
  162. package/lib/models/links/LinkModel.js.map +1 -1
  163. package/lib/models/links/normalizeLinkJSON.js +2 -1
  164. package/lib/models/links/normalizeLinkJSON.js.map +1 -1
  165. package/lib/models/list/ListItemCollection.js +2 -1
  166. package/lib/models/list/ListItemCollection.js.map +1 -1
  167. package/lib/models/lookup/LookupOptionCollection.js +2 -1
  168. package/lib/models/lookup/LookupOptionCollection.js.map +1 -1
  169. package/lib/models/parameter/Parameter.js +2 -1
  170. package/lib/models/parameter/Parameter.js.map +1 -1
  171. package/lib/models/resolveModel.js +2 -1
  172. package/lib/models/resolveModel.js.map +1 -1
  173. package/lib/models/sorting/SortOptionModel.js +2 -1
  174. package/lib/models/sorting/SortOptionModel.js.map +1 -1
  175. package/lib/models/sorting/SortingModel.js +2 -1
  176. package/lib/models/sorting/SortingModel.js.map +1 -1
  177. package/lib/models/user/UserServicesModel.js +2 -1
  178. package/lib/models/user/UserServicesModel.js.map +1 -1
  179. package/lib/modularui/Authenticate.js +2 -1
  180. package/lib/modularui/Authenticate.js.map +1 -1
  181. package/lib/modularui/CaptchaRequest.js +2 -1
  182. package/lib/modularui/CaptchaRequest.js.map +1 -1
  183. package/lib/modularui/ModularUIError.js +2 -1
  184. package/lib/modularui/ModularUIError.js.map +1 -1
  185. package/lib/modularui/ModularUIRequest.js +2 -1
  186. package/lib/modularui/ModularUIRequest.js.map +1 -1
  187. package/lib/modularui/ModularUIResponse.js +2 -1
  188. package/lib/modularui/ModularUIResponse.js.map +1 -1
  189. package/lib/modularui/UploadRequest.js +2 -1
  190. package/lib/modularui/UploadRequest.js.map +1 -1
  191. package/lib/react/ErrorBoundary.js +2 -1
  192. package/lib/react/ErrorBoundary.js.map +1 -1
  193. package/lib/react/ErrorBoundaryFallback.js +2 -1
  194. package/lib/react/ErrorBoundaryFallback.js.map +1 -1
  195. package/lib/react-client/rehydrate.js +2 -1
  196. package/lib/react-client/rehydrate.js.map +1 -1
  197. package/lib/react-server/createSSRComplete.js +2 -1
  198. package/lib/react-server/createSSRComplete.js.map +1 -1
  199. package/lib/react-server/htmlpage.js +2 -1
  200. package/lib/react-server/htmlpage.js.map +1 -1
  201. package/lib/react-server/renderSSRComplete.js +2 -1
  202. package/lib/react-server/renderSSRComplete.js.map +1 -1
  203. package/lib/react-server/renderSSRMinimal.js +2 -1
  204. package/lib/react-server/renderSSRMinimal.js.map +1 -1
  205. package/lib/react-server/serverNoSSR.js +6 -1
  206. package/lib/react-server/serverNoSSR.js.flow +5 -0
  207. package/lib/react-server/serverNoSSR.js.map +1 -1
  208. package/lib/react-server/serverSSR.js +2 -1
  209. package/lib/react-server/serverSSR.js.map +1 -1
  210. package/lib/react-theme/ThemeProvider.js +2 -1
  211. package/lib/react-theme/ThemeProvider.js.map +1 -1
  212. package/lib/react-theme/createTheme.js +2 -1
  213. package/lib/react-theme/createTheme.js.map +1 -1
  214. package/lib/redux/_modularui/ModularUIConnector.js +2 -1
  215. package/lib/redux/_modularui/ModularUIConnector.js.map +1 -1
  216. package/lib/redux/_modularui/ModularUISelectors.js +2 -1
  217. package/lib/redux/_modularui/ModularUISelectors.js.map +1 -1
  218. package/lib/redux/_modularui/withModularUI.js +2 -1
  219. package/lib/redux/_modularui/withModularUI.js.map +1 -1
  220. package/lib/redux/_router/RouterConnectors.js +10 -5
  221. package/lib/redux/_router/RouterConnectors.js.map +1 -1
  222. package/lib/redux/connectors/Application.js +2 -1
  223. package/lib/redux/connectors/Application.js.map +1 -1
  224. package/lib/redux/connectors/Breadcrumb.js +2 -1
  225. package/lib/redux/connectors/Breadcrumb.js.map +1 -1
  226. package/lib/redux/connectors/CaseView.js +2 -1
  227. package/lib/redux/connectors/CaseView.js.map +1 -1
  228. package/lib/redux/connectors/ConceptDetail.js +2 -1
  229. package/lib/redux/connectors/ConceptDetail.js.map +1 -1
  230. package/lib/redux/connectors/ContentBrowser.js +2 -1
  231. package/lib/redux/connectors/ContentBrowser.js.map +1 -1
  232. package/lib/redux/connectors/ContentDetail.js +2 -1
  233. package/lib/redux/connectors/ContentDetail.js.map +1 -1
  234. package/lib/redux/connectors/ContentDetailSection.js +2 -1
  235. package/lib/redux/connectors/ContentDetailSection.js.map +1 -1
  236. package/lib/redux/connectors/Form.js +2 -1
  237. package/lib/redux/connectors/Form.js.map +1 -1
  238. package/lib/redux/connectors/FormAttributeSet.js +2 -1
  239. package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
  240. package/lib/redux/connectors/ListDetail.js +2 -1
  241. package/lib/redux/connectors/ListDetail.js.map +1 -1
  242. package/lib/redux/connectors/Modal.js +2 -1
  243. package/lib/redux/connectors/Modal.js.map +1 -1
  244. package/lib/redux/connectors/ModelCatalog.js +2 -1
  245. package/lib/redux/connectors/ModelCatalog.js.map +1 -1
  246. package/lib/redux/connectors/Notification.js +2 -1
  247. package/lib/redux/connectors/Notification.js.map +1 -1
  248. package/lib/redux/connectors/PanelRenderer.js +2 -1
  249. package/lib/redux/connectors/PanelRenderer.js.map +1 -1
  250. package/lib/redux/connectors/Progress.js +2 -1
  251. package/lib/redux/connectors/Progress.js.map +1 -1
  252. package/lib/redux/connectors/ProgressIndicator.js +2 -1
  253. package/lib/redux/connectors/ProgressIndicator.js.map +1 -1
  254. package/lib/redux/connectors/QuickSearch.js +2 -1
  255. package/lib/redux/connectors/QuickSearch.js.map +1 -1
  256. package/lib/redux/connectors/SignIn.js +2 -1
  257. package/lib/redux/connectors/SignIn.js.map +1 -1
  258. package/lib/redux/connectors/SignOut.js +2 -1
  259. package/lib/redux/connectors/SignOut.js.map +1 -1
  260. package/lib/redux/connectors/Tab.js +2 -1
  261. package/lib/redux/connectors/Tab.js.map +1 -1
  262. package/lib/redux/reducers/AuthReducer.js +2 -1
  263. package/lib/redux/reducers/AuthReducer.js.map +1 -1
  264. package/lib/redux/reducers/ErrorReducer.js +2 -1
  265. package/lib/redux/reducers/ErrorReducer.js.map +1 -1
  266. package/lib/redux/reducers/ModalsReducer.js +2 -1
  267. package/lib/redux/reducers/ModalsReducer.js.map +1 -1
  268. package/lib/redux/reducers/NotificationReducer.js +2 -1
  269. package/lib/redux/reducers/NotificationReducer.js.map +1 -1
  270. package/lib/redux/reducers/PreferencesReducer.js +2 -1
  271. package/lib/redux/reducers/PreferencesReducer.js.map +1 -1
  272. package/lib/redux/reducers/ProgressIndicatorReducer.js +2 -1
  273. package/lib/redux/reducers/ProgressIndicatorReducer.js.map +1 -1
  274. package/lib/redux/store/configureStore.js +2 -1
  275. package/lib/redux/store/configureStore.js.map +1 -1
  276. package/lib/utils/browser/Cache.js +2 -1
  277. package/lib/utils/browser/Cache.js.map +1 -1
  278. package/lib/utils/datetime/DateTimeUtil.js +8 -4
  279. package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
  280. package/lib/utils/fetch/universalFetch.js +2 -1
  281. package/lib/utils/fetch/universalFetch.js.map +1 -1
  282. package/lib/utils/fetch/xhr.js +2 -1
  283. package/lib/utils/fetch/xhr.js.map +1 -1
  284. package/lib/utils/helpers/createUUID.js +2 -1
  285. package/lib/utils/helpers/createUUID.js.map +1 -1
  286. package/lib/utils/number/DecimalFormat.js +2 -1
  287. package/lib/utils/number/DecimalFormat.js.map +1 -1
  288. package/lib/utils/number/formatValue.js +2 -1
  289. package/lib/utils/number/formatValue.js.map +1 -1
  290. package/package.json +1 -1
  291. package/src/models/filters/StringFilterModel.js +2 -2
  292. package/src/react-server/serverNoSSR.js +5 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ModularUIResponse.js","names":["_objects","require","ModularUIResponse","constructor","_defineProperty2","default","create","input","response","has","dataKey","_keys","data","contributionsKey","contributions","key","locale","_locale","_key","_data","_contributions","parameters","_parameters","rehydrate","modelData","_default","exports"],"sources":["../../src/modularui/ModularUIResponse.js"],"sourcesContent":["// @flow\nimport { has } from \"../utils/helpers/objects\";\n\nimport type Parameter from \"../models/parameter/Parameter\";\n\n/**\n */\nclass ModularUIResponse {\n _key: string = \"unknown\";\n _data: Object;\n _contributions: Object;\n _locale: string = \"en\";\n _parameters: Array<Parameter> = [];\n\n /**\n */\n static create(input: {\n key: string,\n data: Object,\n contributions: Object,\n }): ModularUIResponse {\n const response = new ModularUIResponse();\n\n if (has(input, \"data\") && has(input, \"contributions\")) {\n const [dataKey] = Object.keys(input.data);\n const [contributionsKey] = Object.keys(input.contributions);\n\n response.key = input.key ?? contributionsKey;\n response.data = input.data?.[dataKey];\n response.contributions = input.contributions?.[contributionsKey];\n }\n\n return response;\n }\n\n /**\n */\n set locale(locale: string) {\n this._locale = locale;\n }\n\n /**\n */\n get locale(): string {\n return this._locale;\n }\n\n /**\n */\n set key(key: string) {\n this._key = key;\n }\n\n /**\n */\n get key(): string {\n return this._key;\n }\n\n /**\n */\n set data(data: Object) {\n this._data = data;\n }\n\n /**\n */\n get data(): Object {\n return this._data;\n }\n\n /**\n */\n set contributions(contributions: Object) {\n this._contributions = contributions;\n }\n\n /**\n */\n get contributions(): Object {\n return this._contributions;\n }\n\n /**\n */\n set parameters(parameters: Array<Parameter>) {\n this._parameters = parameters;\n }\n\n /**\n */\n get parameters(): Array<Parameter> {\n return this._parameters;\n }\n\n /**\n */\n static rehydrate(data: {\n key: string,\n locale: string,\n data: Object,\n contributions: Object,\n }): ModularUIResponse {\n const modelData = new ModularUIResponse();\n\n modelData.locale = data.locale;\n modelData.key = data.key;\n modelData.data = data.data;\n modelData.contributions = data.contributions;\n\n return modelData;\n }\n}\n\nexport default ModularUIResponse;\n"],"mappings":";;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAIA;AACA;AACA,MAAMC,iBAAiB,CAAC;EAAAC,YAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,gBACP,SAAS;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA,mBAGN,IAAI;IAAA,IAAAD,gBAAA,CAAAC,OAAA,uBACU,EAAE;EAAA;EAElC;AACF;EACE,OAAOC,MAAMA,CAACC,KAIb,EAAqB;IACpB,MAAMC,QAAQ,GAAG,IAAIN,iBAAiB,CAAC,CAAC;IAExC,IAAI,IAAAO,YAAG,EAACF,KAAK,EAAE,MAAM,CAAC,IAAI,IAAAE,YAAG,EAACF,KAAK,EAAE,eAAe,CAAC,EAAE;MACrD,MAAM,CAACG,OAAO,CAAC,GAAG,IAAAC,KAAA,CAAAN,OAAA,EAAYE,KAAK,CAACK,IAAI,CAAC;MACzC,MAAM,CAACC,gBAAgB,CAAC,GAAG,IAAAF,KAAA,CAAAN,OAAA,EAAYE,KAAK,CAACO,aAAa,CAAC;MAE3DN,QAAQ,CAACO,GAAG,GAAGR,KAAK,CAACQ,GAAG,IAAIF,gBAAgB;MAC5CL,QAAQ,CAACI,IAAI,GAAGL,KAAK,CAACK,IAAI,GAAGF,OAAO,CAAC;MACrCF,QAAQ,CAACM,aAAa,GAAGP,KAAK,CAACO,aAAa,GAAGD,gBAAgB,CAAC;IAClE;IAEA,OAAOL,QAAQ;EACjB;;EAEA;AACF;EACE,IAAIQ,MAAMA,CAACA,MAAc,EAAE;IACzB,IAAI,CAACC,OAAO,GAAGD,MAAM;EACvB;;EAEA;AACF;EACE,IAAIA,MAAMA,CAAA,EAAW;IACnB,OAAO,IAAI,CAACC,OAAO;EACrB;;EAEA;AACF;EACE,IAAIF,GAAGA,CAACA,GAAW,EAAE;IACnB,IAAI,CAACG,IAAI,GAAGH,GAAG;EACjB;;EAEA;AACF;EACE,IAAIA,GAAGA,CAAA,EAAW;IAChB,OAAO,IAAI,CAACG,IAAI;EAClB;;EAEA;AACF;EACE,IAAIN,IAAIA,CAACA,IAAY,EAAE;IACrB,IAAI,CAACO,KAAK,GAAGP,IAAI;EACnB;;EAEA;AACF;EACE,IAAIA,IAAIA,CAAA,EAAW;IACjB,OAAO,IAAI,CAACO,KAAK;EACnB;;EAEA;AACF;EACE,IAAIL,aAAaA,CAACA,aAAqB,EAAE;IACvC,IAAI,CAACM,cAAc,GAAGN,aAAa;EACrC;;EAEA;AACF;EACE,IAAIA,aAAaA,CAAA,EAAW;IAC1B,OAAO,IAAI,CAACM,cAAc;EAC5B;;EAEA;AACF;EACE,IAAIC,UAAUA,CAACA,UAA4B,EAAE;IAC3C,IAAI,CAACC,WAAW,GAAGD,UAAU;EAC/B;;EAEA;AACF;EACE,IAAIA,UAAUA,CAAA,EAAqB;IACjC,OAAO,IAAI,CAACC,WAAW;EACzB;;EAEA;AACF;EACE,OAAOC,SAASA,CAACX,IAKhB,EAAqB;IACpB,MAAMY,SAAS,GAAG,IAAItB,iBAAiB,CAAC,CAAC;IAEzCsB,SAAS,CAACR,MAAM,GAAGJ,IAAI,CAACI,MAAM;IAC9BQ,SAAS,CAACT,GAAG,GAAGH,IAAI,CAACG,GAAG;IACxBS,SAAS,CAACZ,IAAI,GAAGA,IAAI,CAACA,IAAI;IAC1BY,SAAS,CAACV,aAAa,GAAGF,IAAI,CAACE,aAAa;IAE5C,OAAOU,SAAS;EAClB;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAArB,OAAA,GAEcH,iBAAiB"}
1
+ {"version":3,"file":"ModularUIResponse.js","names":["_objects","require","ModularUIResponse","constructor","_defineProperty2","default","create","input","response","has","dataKey","_keys","data","contributionsKey","contributions","key","locale","_locale","_key","_data","_contributions","parameters","_parameters","rehydrate","modelData","_default","exports"],"sources":["../../src/modularui/ModularUIResponse.js"],"sourcesContent":["// @flow\nimport { has } from \"../utils/helpers/objects\";\n\nimport type Parameter from \"../models/parameter/Parameter\";\n\n/**\n */\nclass ModularUIResponse {\n _key: string = \"unknown\";\n _data: Object;\n _contributions: Object;\n _locale: string = \"en\";\n _parameters: Array<Parameter> = [];\n\n /**\n */\n static create(input: {\n key: string,\n data: Object,\n contributions: Object,\n }): ModularUIResponse {\n const response = new ModularUIResponse();\n\n if (has(input, \"data\") && has(input, \"contributions\")) {\n const [dataKey] = Object.keys(input.data);\n const [contributionsKey] = Object.keys(input.contributions);\n\n response.key = input.key ?? contributionsKey;\n response.data = input.data?.[dataKey];\n response.contributions = input.contributions?.[contributionsKey];\n }\n\n return response;\n }\n\n /**\n */\n set locale(locale: string) {\n this._locale = locale;\n }\n\n /**\n */\n get locale(): string {\n return this._locale;\n }\n\n /**\n */\n set key(key: string) {\n this._key = key;\n }\n\n /**\n */\n get key(): string {\n return this._key;\n }\n\n /**\n */\n set data(data: Object) {\n this._data = data;\n }\n\n /**\n */\n get data(): Object {\n return this._data;\n }\n\n /**\n */\n set contributions(contributions: Object) {\n this._contributions = contributions;\n }\n\n /**\n */\n get contributions(): Object {\n return this._contributions;\n }\n\n /**\n */\n set parameters(parameters: Array<Parameter>) {\n this._parameters = parameters;\n }\n\n /**\n */\n get parameters(): Array<Parameter> {\n return this._parameters;\n }\n\n /**\n */\n static rehydrate(data: {\n key: string,\n locale: string,\n data: Object,\n contributions: Object,\n }): ModularUIResponse {\n const modelData = new ModularUIResponse();\n\n modelData.locale = data.locale;\n modelData.key = data.key;\n modelData.data = data.data;\n modelData.contributions = data.contributions;\n\n return modelData;\n }\n}\n\nexport default ModularUIResponse;\n"],"mappings":";;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAIA;AACA;AACA,MAAMC,iBAAiB,CAAC;EAAAC,YAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,gBACP,SAAS;IAAA,IAAAD,gBAAA,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nB;;EAEA;AACF;EACE,IAAIA,IAAIA,CAAA,EAAW;IACjB,OAAO,IAAI,CAACO,KAAK;EACnB;;EAEA;AACF;EACE,IAAIL,aAAaA,CAACA,aAAqB,EAAE;IACvC,IAAI,CAACM,cAAc,GAAGN,aAAa;EACrC;;EAEA;AACF;EACE,IAAIA,aAAaA,CAAA,EAAW;IAC1B,OAAO,IAAI,CAACM,cAAc;EAC5B;;EAEA;AACF;EACE,IAAIC,UAAUA,CAACA,UAA4B,EAAE;IAC3C,IAAI,CAACC,WAAW,GAAGD,UAAU;EAC/B;;EAEA;AACF;EACE,IAAIA,UAAUA,CAAA,EAAqB;IACjC,OAAO,IAAI,CAACC,WAAW;EACzB;;EAEA;AACF;EACE,OAAOC,SAASA,CAACX,IAKhB,EAAqB;IACpB,MAAMY,SAAS,GAAG,IAAItB,iBAAiB,CAAC,CAAC;IAEzCsB,SAAS,CAACR,MAAM,GAAGJ,IAAI,CAACI,MAAM;IAC9BQ,SAAS,CAACT,GAAG,GAAGH,IAAI,CAACG,GAAG;IACxBS,SAAS,CAACZ,IAAI,GAAGA,IAAI,CAACA,IAAI;IAC1BY,SAAS,CAACV,aAAa,GAAGF,IAAI,CAACE,aAAa;IAE5C,OAAOU,SAAS;EAClB;AACF;AAAC,IAAAC,QAAA,GAEcvB,iBAAiB;AAAAwB,OAAA,CAAArB,OAAA,GAAAoB,QAAA"}
@@ -95,5 +95,6 @@ class UploadRequest {
95
95
  });
96
96
  }
97
97
  }
98
- var _default = exports.default = UploadRequest;
98
+ var _default = UploadRequest;
99
+ exports.default = _default;
99
100
  //# sourceMappingURL=UploadRequest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UploadRequest.js","names":["_constants","require","_xhr","_interopRequireDefault","_ErrorModel","UploadRequest","constructor","uploadConstraints","progressHandler","_defineProperty2","default","_uploadConstraints","_progressHandler","getFileExtension","file","name","split","pop","toLowerCase","isNotAllowedFileType","allowedFileTypes","fileTypes","length","fileExtension","some","fileType","_context","_includes","extensions","call","exceedsMaxFileSize","maxFileSize","fileSize","size","uploadFile","error","_promise","reject","ErrorModel","extension","join","xhr","url","getUploadPath","method","HTTP_METHODS","POST","headers","type","encodeURIComponent","toString","onProgress","e","lengthComputable","progress","Math","ceil","loaded","total","data","then","response","token","_default","exports"],"sources":["../../src/modularui/UploadRequest.js"],"sourcesContent":["// @flow\nimport { getUploadPath, HTTP_METHODS } from \"../constants\";\n\nimport xhr from \"../utils/fetch/xhr\";\n\nimport type {\n FilesizeConstraintsType,\n FiletypeConstraintsType,\n} from \"../models\";\nimport ErrorModel from \"../models/error/ErrorModel\";\n\ntype ProgressHandler = (file: File, uploadInfo: Object) => void;\n\ntype UploadResponse = {\n token: string,\n};\n\n/**\n * Upload a file to the upload file service of Be Informed\n */\nclass UploadRequest {\n _uploadConstraints: {\n fileTypes: FiletypeConstraintsType,\n maxFileSize: FilesizeConstraintsType,\n acceptedFiles: Array<string>,\n };\n _progressHandler: ProgressHandler;\n\n constructor(\n uploadConstraints: {\n fileTypes: FiletypeConstraintsType,\n maxFileSize: FilesizeConstraintsType,\n acceptedFiles: Array<string>,\n },\n progressHandler: ProgressHandler,\n ) {\n this._uploadConstraints = uploadConstraints;\n this._progressHandler = progressHandler;\n }\n\n /**\n */\n getFileExtension(file: File): string {\n return file.name.split(\".\").pop().toLowerCase();\n }\n\n /**\n */\n isNotAllowedFileType(file: File): boolean {\n const allowedFileTypes = this._uploadConstraints.fileTypes;\n\n if (allowedFileTypes.length > 0) {\n const fileExtension = this.getFileExtension(file);\n\n return !allowedFileTypes.some((fileType) =>\n fileType.extensions.includes(fileExtension),\n );\n }\n\n return false;\n }\n\n /**\n */\n exceedsMaxFileSize(file: File): boolean {\n const maxFileSize = this._uploadConstraints?.maxFileSize?.fileSize ?? -1;\n return maxFileSize > -1 && file.size > maxFileSize;\n }\n\n /**\n */\n uploadFile(file: File): Promise<UploadResponse> {\n const maxFileSize = this._uploadConstraints?.maxFileSize?.fileSize ?? -1;\n\n if (this.exceedsMaxFileSize(file)) {\n this._progressHandler(file, { error: \"errorExceedsMaxFileSize\" });\n return Promise.reject(\n new ErrorModel(\n \"Constraint.File.MaxFileSizeExceeded\",\n \"Maximum file upload size is ${max-filesize}\",\n {\n \"max-filesize\": maxFileSize,\n },\n true,\n ),\n );\n }\n\n if (this.isNotAllowedFileType(file)) {\n this._progressHandler(file, { error: \"errorExtensionNotAllowed\" });\n return Promise.reject(\n new ErrorModel(\n \"Constraint.File.InvalidExtension\",\n \"Allowed extensions are: ${extensions}\",\n {\n extension: this.getFileExtension(file),\n extensions: this._uploadConstraints.fileTypes.join(\", \"),\n },\n true,\n ),\n );\n }\n\n return xhr({\n url: getUploadPath(),\n method: HTTP_METHODS.POST,\n headers: {\n \"Content-Type\": file.type,\n \"x-filename\": encodeURIComponent(file.name),\n \"x-filesize\": file.size.toString(),\n },\n onProgress: (e: ProgressEvent) => {\n if (this._progressHandler && e.lengthComputable) {\n this._progressHandler(file, {\n progress: Math.ceil((e.loaded / e.total) * 100),\n });\n }\n },\n data: file,\n }).then((response) => {\n this._progressHandler(file, { progress: 100, token: response.token });\n return response;\n });\n }\n}\n\nexport default UploadRequest;\n"],"mappings":";;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAC,sBAAA,CAAAF,OAAA;AAMA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AAQA;AACA;AACA;AACA,MAAMI,aAAa,CAAC;EAQlBC,WAAWA,CACTC,iBAIC,EACDC,eAAgC,EAChC;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IACA,IAAI,CAACC,kBAAkB,GAAGJ,iBAAiB;IAC3C,IAAI,CAACK,gBAAgB,GAAGJ,eAAe;EACzC;;EAEA;AACF;EACEK,gBAAgBA,CAACC,IAAU,EAAU;IACnC,OAAOA,IAAI,CAACC,IAAI,CAACC,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CA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C,OAAA,CAAAtD,OAAA,GAEcL,aAAa"}
1
+ {"version":3,"file":"UploadRequest.js","names":["_constants","require","_xhr","_interopRequireDefault","_ErrorModel","UploadRequest","constructor","uploadConstraints","progressHandler","_defineProperty2","default","_uploadConstraints","_progressHandler","getFileExtension","file","name","split","pop","toLowerCase","isNotAllowedFileType","allowedFileTypes","fileTypes","length","fileExtension","some","fileType","_context","_includes","extensions","call","exceedsMaxFileSize","maxFileSize","fileSize","size","uploadFile","error","_promise","reject","ErrorModel","extension","join","xhr","url","getUploadPath","method","HTTP_METHODS","POST","headers","type","encodeURIComponent","toString","onProgress","e","lengthComputable","progress","Math","ceil","loaded","total","data","then","response","token","_default","exports"],"sources":["../../src/modularui/UploadRequest.js"],"sourcesContent":["// @flow\nimport { getUploadPath, HTTP_METHODS } from \"../constants\";\n\nimport xhr from \"../utils/fetch/xhr\";\n\nimport type {\n FilesizeConstraintsType,\n FiletypeConstraintsType,\n} from \"../models\";\nimport ErrorModel from \"../models/error/ErrorModel\";\n\ntype ProgressHandler = (file: File, uploadInfo: Object) => void;\n\ntype UploadResponse = {\n token: string,\n};\n\n/**\n * Upload a file to the upload file service of Be Informed\n */\nclass UploadRequest {\n _uploadConstraints: {\n fileTypes: FiletypeConstraintsType,\n maxFileSize: FilesizeConstraintsType,\n acceptedFiles: Array<string>,\n };\n _progressHandler: ProgressHandler;\n\n constructor(\n uploadConstraints: {\n fileTypes: FiletypeConstraintsType,\n maxFileSize: FilesizeConstraintsType,\n acceptedFiles: Array<string>,\n },\n progressHandler: ProgressHandler,\n ) {\n this._uploadConstraints = uploadConstraints;\n this._progressHandler = progressHandler;\n }\n\n /**\n */\n getFileExtension(file: File): string {\n return file.name.split(\".\").pop().toLowerCase();\n }\n\n /**\n */\n isNotAllowedFileType(file: File): boolean {\n const allowedFileTypes = this._uploadConstraints.fileTypes;\n\n if (allowedFileTypes.length > 0) {\n const fileExtension = this.getFileExtension(file);\n\n return !allowedFileTypes.some((fileType) =>\n fileType.extensions.includes(fileExtension),\n );\n }\n\n return false;\n }\n\n /**\n */\n exceedsMaxFileSize(file: File): boolean {\n const maxFileSize = this._uploadConstraints?.maxFileSize?.fileSize ?? -1;\n return maxFileSize > -1 && file.size > maxFileSize;\n }\n\n /**\n */\n uploadFile(file: File): Promise<UploadResponse> {\n const maxFileSize = this._uploadConstraints?.maxFileSize?.fileSize ?? -1;\n\n if (this.exceedsMaxFileSize(file)) {\n this._progressHandler(file, { error: \"errorExceedsMaxFileSize\" });\n return Promise.reject(\n new ErrorModel(\n \"Constraint.File.MaxFileSizeExceeded\",\n \"Maximum file upload size is ${max-filesize}\",\n {\n \"max-filesize\": maxFileSize,\n },\n true,\n ),\n );\n }\n\n if (this.isNotAllowedFileType(file)) {\n this._progressHandler(file, { error: \"errorExtensionNotAllowed\" });\n return Promise.reject(\n new ErrorModel(\n \"Constraint.File.InvalidExtension\",\n \"Allowed extensions are: ${extensions}\",\n {\n extension: this.getFileExtension(file),\n extensions: this._uploadConstraints.fileTypes.join(\", \"),\n },\n true,\n ),\n );\n }\n\n return xhr({\n url: getUploadPath(),\n method: HTTP_METHODS.POST,\n headers: {\n \"Content-Type\": file.type,\n \"x-filename\": encodeURIComponent(file.name),\n \"x-filesize\": file.size.toString(),\n },\n onProgress: (e: ProgressEvent) => {\n if (this._progressHandler && e.lengthComputable) {\n this._progressHandler(file, {\n progress: Math.ceil((e.loaded / e.total) * 100),\n });\n }\n },\n data: file,\n }).then((response) => {\n this._progressHandler(file, { progress: 100, token: response.token });\n return response;\n });\n }\n}\n\nexport default UploadRequest;\n"],"mappings":";;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAC,sBAAA,CAAAF,OAAA;AAMA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AAQA;AACA;AACA;AACA,MAAMI,aAAa,CAAC;EAQlBC,WAAWA,CACTC,iBAIC,EACDC,eAAgC,EAChC;IAAA,IAAAC,gBAAA,CAAAC,OA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ACR,CAAC,CAAC,CAAC8C,IAAI,CAAEC,QAAQ,IAAK;MACpB,IAAI,CAACjD,gBAAgB,CAACE,IAAI,EAAE;QAAEwC,QAAQ,EAAE,GAAG;QAAEQ,KAAK,EAAED,QAAQ,CAACC;MAAM,CAAC,CAAC;MACrE,OAAOD,QAAQ;IACjB,CAAC,CAAC;EACJ;AACF;AAAC,IAAAE,QAAA,GAEc1D,aAAa;AAAA2D,OAAA,CAAAtD,OAAA,GAAAqD,QAAA"}
@@ -52,5 +52,6 @@ class ErrorBoundary extends _react.Component {
52
52
  FallbackComponent: _ErrorBoundaryFallback.default
53
53
  });
54
54
  ErrorBoundary.displayName = "BI.ErrorBoundary";
55
- var _default = exports.default = ErrorBoundary;
55
+ var _default = ErrorBoundary;
56
+ exports.default = _default;
56
57
  //# sourceMappingURL=ErrorBoundary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorBoundary.js","names":["_react","require","_ErrorBoundaryFallback","_interopRequireDefault","_jsxRuntime","ErrorBoundary","Component","constructor","arguments","_defineProperty2","default","error","errorInfo","componentDidCatch","setState","render","children","FallbackComponent","props","state","jsx","componentStack","ErrorBoundaryFallback","displayName","_default","exports"],"sources":["../../src/react/ErrorBoundary.js"],"sourcesContent":["// @flow\nimport { Component } from \"react\";\n\nimport ErrorBoundaryFallback from \"./ErrorBoundaryFallback\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { Props as FallbackProps } from \"./ErrorBoundaryFallback\";\nexport type Props = {\n +children: ?Node,\n +FallbackComponent: ComponentType<FallbackProps>,\n};\n\ntype ErrorInfo = {\n componentStack: string,\n ...\n};\n\ntype State = {\n error: ?Error,\n errorInfo: ?ErrorInfo,\n};\n\n/**\n */\nclass ErrorBoundary extends Component<Props, State> {\n static defaultProps: { FallbackComponent: ComponentType<FallbackProps> } = {\n FallbackComponent: ErrorBoundaryFallback,\n };\n\n state: State = {\n error: null,\n errorInfo: null,\n };\n\n /**\n */\n componentDidCatch(error: Error, errorInfo: ErrorInfo): void {\n this.setState({ error, errorInfo });\n }\n\n /**\n */\n render(): Node {\n const { children, FallbackComponent } = this.props; // NOSONAR\n const { error, errorInfo } = this.state;\n\n if (error != null) {\n return (\n <FallbackComponent\n componentStack={errorInfo ? errorInfo.componentStack : \"\"}\n error={error}\n />\n );\n }\n\n return children ?? null;\n }\n}\nErrorBoundary.displayName = \"BI.ErrorBoundary\";\n\nexport default ErrorBoundary;\n"],"mappings":";;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,sBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA4D,IAAAG,WAAA,GAAAH,OAAA;AAmB5D;AACA;AACA,MAAMI,aAAa,SAASC,gBAAS,CAAe;EAAAC,YAAA;IAAA,SAAAC,SAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,iBAKnC;MACbC,KAAK,EAAE,IAAI;MACXC,SAAS,EAAE;IACb,CAAC;EAAA;EAED;AACF;EACEC,iBAAiBA,CAACF,KAAY,EAAEC,SAAoB,EAAQ;IAC1D,IAAI,CAACE,QAAQ,CAAC;MAAEH,KAAK;MAAEC;IAAU,CAAC,CAAC;EACrC;;EAEA;AACF;EACEG,MAAMA,CAAA,EAAS;IACb,MAAM;MAAEC,QAAQ;MAAEC;IAAkB,CAAC,GAAG,IAAI,CAACC,KAAK,CAAC,CAAC;IACpD,MAAM;MAAEP,KAAK;MAAEC;IAAU,CAAC,GAAG,IAAI,CAACO,KAAK;IAEvC,IAAIR,KAAK,IAAI,IAAI,EAAE;MACjB,oBACE,IAAAP,WAAA,CAAAgB,GAAA,EAACH,iBAAiB;QAChBI,cAAc,EAAET,SAAS,GAAGA,SAAS,CAACS,cAAc,GAAG,EAAG;QAC1DV,KAAK,EAAEA;MAAM,CACd,CAAC;IAEN;IAEA,OAAOK,QAAQ,IAAI,IAAI;EACzB;AACF;AAAC,IAAAP,gBAAA,CAAAC,OAAA,EAjCKL,aAAa,kBAC0D;EACzEY,iBAAiB,EAAEK;AACrB,CAAC;AA+BHjB,aAAa,CAACkB,WAAW,GAAG,kBAAkB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAf,OAAA,GAEhCL,aAAa"}
1
+ {"version":3,"file":"ErrorBoundary.js","names":["_react","require","_ErrorBoundaryFallback","_interopRequireDefault","_jsxRuntime","ErrorBoundary","Component","constructor","arguments","_defineProperty2","default","error","errorInfo","componentDidCatch","setState","render","children","FallbackComponent","props","state","jsx","componentStack","ErrorBoundaryFallback","displayName","_default","exports"],"sources":["../../src/react/ErrorBoundary.js"],"sourcesContent":["// @flow\nimport { Component } from \"react\";\n\nimport ErrorBoundaryFallback from \"./ErrorBoundaryFallback\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { Props as FallbackProps } from \"./ErrorBoundaryFallback\";\nexport type Props = {\n +children: ?Node,\n +FallbackComponent: ComponentType<FallbackProps>,\n};\n\ntype ErrorInfo = {\n componentStack: string,\n ...\n};\n\ntype State = {\n error: ?Error,\n errorInfo: ?ErrorInfo,\n};\n\n/**\n */\nclass ErrorBoundary extends Component<Props, State> {\n static defaultProps: { FallbackComponent: ComponentType<FallbackProps> } = {\n FallbackComponent: ErrorBoundaryFallback,\n };\n\n state: State = {\n error: null,\n errorInfo: null,\n };\n\n /**\n */\n componentDidCatch(error: Error, errorInfo: ErrorInfo): void {\n this.setState({ error, errorInfo });\n }\n\n /**\n */\n render(): Node {\n const { children, FallbackComponent } = this.props; // NOSONAR\n const { error, errorInfo } = this.state;\n\n if (error != null) {\n return (\n <FallbackComponent\n componentStack={errorInfo ? errorInfo.componentStack : \"\"}\n error={error}\n />\n );\n }\n\n return children ?? null;\n }\n}\nErrorBoundary.displayName = \"BI.ErrorBoundary\";\n\nexport default ErrorBoundary;\n"],"mappings":";;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,sBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA4D,IAAAG,WAAA,GAAAH,OAAA;AAmB5D;AACA;AACA,MAAMI,aAAa,SAASC,gBAAS,CAAe;EAAAC,YAAA;IAAA,SAAAC,SAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,iBAKnC;MACbC,KAAK,EAAE,IAAI;MACXC,SAAS,EAAE;IACb,CAAC;EAAA;EAED;AACF;EACEC,iBAAiBA,CAACF,KAAY,EAAEC,SAAoB,EAAQ;IAC1D,IAAI,CAACE,QAAQ,CAAC;MAAEH,KAAK;MAAEC;IAAU,CAAC,CAAC;EACrC;;EAEA;AACF;EACEG,MAAMA,CAAA,EAAS;IACb,MAAM;MAAEC,QAAQ;MAAEC;IAAkB,CAAC,GAAG,IAAI,CAACC,KAAK,CAAC,CAAC;IACpD,MAAM;MAAEP,KAAK;MAAEC;IAAU,CAAC,GAAG,IAAI,CAACO,KAAK;IAEvC,IAAIR,KAAK,IAAI,IAAI,EAAE;MACjB,oBACE,IAAAP,WAAA,CAAAgB,GAAA,EAACH,iBAAiB;QAChBI,cAAc,EAAET,SAAS,GAAGA,SAAS,CAACS,cAAc,GAAG,EAAG;QAC1DV,KAAK,EAAEA;MAAM,CACd,CAAC;IAEN;IAEA,OAAOK,QAAQ,IAAI,IAAI;EACzB;AACF;AAAC,IAAAP,gBAAA,CAAAC,OAAA,EAjCKL,aAAa,kBAC0D;EACzEY,iBAAiB,EAAEK;AACrB,CAAC;AA+BHjB,aAAa,CAACkB,WAAW,GAAG,kBAAkB;AAAC,IAAAC,QAAA,GAEhCnB,aAAa;AAAAoB,OAAA,CAAAf,OAAA,GAAAc,QAAA"}
@@ -37,5 +37,6 @@ const ErrorBoundaryFallback = _ref => {
37
37
  });
38
38
  };
39
39
  ErrorBoundaryFallback.displayName = "BI.ErrorBoundaryFallback";
40
- var _default = exports.default = ErrorBoundaryFallback;
40
+ var _default = ErrorBoundaryFallback;
41
+ exports.default = _default;
41
42
  //# sourceMappingURL=ErrorBoundaryFallback.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorBoundaryFallback.js","names":["_styledComponents","_interopRequireDefault","require","_spacers","_jsxRuntime","StyledBoundary","styled","div","withConfig","componentId","spacers","spacer","StyledStack","pre","ErrorBoundaryFallback","_ref","className","componentStack","error","jsxs","children","jsx","toString","displayName","_default","exports","default"],"sources":["../../src/react/ErrorBoundaryFallback.js"],"sourcesContent":["// @flow\nimport styled from \"styled-components\";\nimport { spacers, spacer } from \"../react-theme/utils/spacers\";\n\nimport type { StyledComponent } from \"styled-components\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { Node } from \"react\";\n\nexport type Props = {\n +className?: string,\n +componentStack: string,\n +error: Error,\n};\n\n// $FlowFixMe\nconst StyledBoundary: StyledComponent<{}, Theme, *> = styled.div`\n padding: ${spacers(2, 1)};\n margin-bottom: ${spacer(2)};\n background-color: #e9ecef;\n border-radius: 0.3em;\n`;\n\n// $FlowFixMe\nconst StyledStack = styled.pre`\n display: block;\n font-size: 87.5%;\n color: #212529;\n font-style: italic;\n`;\n\n/**\n */\nconst ErrorBoundaryFallback = ({\n className,\n componentStack,\n error,\n}: Props): Node => (\n <StyledBoundary className={className}>\n <h2>{error.toString()}</h2>\n <StyledStack className=\"debug\">{componentStack}</StyledStack>\n </StyledBoundary>\n);\n\nErrorBoundaryFallback.displayName = \"BI.ErrorBoundaryFallback\";\n\nexport default ErrorBoundaryFallback;\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAA+D,IAAAE,WAAA,GAAAF,OAAA;AAY/D;AACA,MAAMG,cAA6C,gBAAGC,yBAAM,CAACC,GAAG,CAAAC,UAAA;EAAAC,WAAA;AAAA,sFACnD,IAAAC,gBAAO,EAAC,CAAC,EAAE,CAAC,CAAC,EACP,IAAAC,eAAM,EAAC,CAAC,CAAC,CAG3B;;AAED;AACA,MAAMC,WAAW,gBAAGN,yBAAM,CAACO,GAAG,CAAAL,UAAA;EAAAC,WAAA;AAAA,sEAK7B;;AAED;AACA;AACA,MAAMK,qBAAqB,GAAGC,IAAA;EAAA,IAAC;IAC7BC,SAAS;IACTC,cAAc;IACdC;EACK,CAAC,GAAAH,IAAA;EAAA,oBACN,IAAAX,WAAA,CAAAe,IAAA,EAACd,cAAc;IAACW,SAAS,EAAEA,SAAU;IAAAI,QAAA,gBACnC,IAAAhB,WAAA,CAAAiB,GAAA;MAAAD,QAAA,EAAKF,KAAK,CAACI,QAAQ,CAAC;IAAC,CAAK,CAAC,eAC3B,IAAAlB,WAAA,CAAAiB,GAAA,EAACT,WAAW;MAACI,SAAS,EAAC,OAAO;MAAAI,QAAA,EAAEH;IAAc,CAAc,CAAC;EAAA,CAC/C,CAAC;AAAA,CAClB;AAEDH,qBAAqB,CAACS,WAAW,GAAG,0BAA0B;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEhDZ,qBAAqB"}
1
+ {"version":3,"file":"ErrorBoundaryFallback.js","names":["_styledComponents","_interopRequireDefault","require","_spacers","_jsxRuntime","StyledBoundary","styled","div","withConfig","componentId","spacers","spacer","StyledStack","pre","ErrorBoundaryFallback","_ref","className","componentStack","error","jsxs","children","jsx","toString","displayName","_default","exports","default"],"sources":["../../src/react/ErrorBoundaryFallback.js"],"sourcesContent":["// @flow\nimport styled from \"styled-components\";\nimport { spacers, spacer } from \"../react-theme/utils/spacers\";\n\nimport type { StyledComponent } from \"styled-components\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { Node } from \"react\";\n\nexport type Props = {\n +className?: string,\n +componentStack: string,\n +error: Error,\n};\n\n// $FlowFixMe\nconst StyledBoundary: StyledComponent<{}, Theme, *> = styled.div`\n padding: ${spacers(2, 1)};\n margin-bottom: ${spacer(2)};\n background-color: #e9ecef;\n border-radius: 0.3em;\n`;\n\n// $FlowFixMe\nconst StyledStack = styled.pre`\n display: block;\n font-size: 87.5%;\n color: #212529;\n font-style: italic;\n`;\n\n/**\n */\nconst ErrorBoundaryFallback = ({\n className,\n componentStack,\n error,\n}: Props): Node => (\n <StyledBoundary className={className}>\n <h2>{error.toString()}</h2>\n <StyledStack className=\"debug\">{componentStack}</StyledStack>\n </StyledBoundary>\n);\n\nErrorBoundaryFallback.displayName = \"BI.ErrorBoundaryFallback\";\n\nexport default ErrorBoundaryFallback;\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAA+D,IAAAE,WAAA,GAAAF,OAAA;AAY/D;AACA,MAAMG,cAA6C,gBAAGC,yBAAM,CAACC,GAAG,CAAAC,UAAA;EAAAC,WAAA;AAAA,sFACnD,IAAAC,gBAAO,EAAC,CAAC,EAAE,CAAC,CAAC,EACP,IAAAC,eAAM,EAAC,CAAC,CAAC,CAG3B;;AAED;AACA,MAAMC,WAAW,gBAAGN,yBAAM,CAACO,GAAG,CAAAL,UAAA;EAAAC,WAAA;AAAA,sEAK7B;;AAED;AACA;AACA,MAAMK,qBAAqB,GAAGC,IAAA;EAAA,IAAC;IAC7BC,SAAS;IACTC,cAAc;IACdC;EACK,CAAC,GAAAH,IAAA;EAAA,oBACN,IAAAX,WAAA,CAAAe,IAAA,EAACd,cAAc;IAACW,SAAS,EAAEA,SAAU;IAAAI,QAAA,gBACnC,IAAAhB,WAAA,CAAAiB,GAAA;MAAAD,QAAA,EAAKF,KAAK,CAACI,QAAQ,CAAC;IAAC,CAAK,CAAC,eAC3B,IAAAlB,WAAA,CAAAiB,GAAA,EAACT,WAAW;MAACI,SAAS,EAAC,OAAO;MAAAI,QAAA,EAAEH;IAAc,CAAc,CAAC;EAAA,CAC/C,CAAC;AAAA,CAClB;AAEDH,qBAAqB,CAACS,WAAW,GAAG,0BAA0B;AAAC,IAAAC,QAAA,GAEhDV,qBAAqB;AAAAW,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -71,5 +71,6 @@ const rehydrate = state => {
71
71
  });
72
72
  return mappedState;
73
73
  };
74
- var _default = exports.default = rehydrate;
74
+ var _default = rehydrate;
75
+ exports.default = _default;
75
76
  //# sourceMappingURL=rehydrate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rehydrate.js","names":["_objects","require","_Locales","_interopRequireDefault","_resolveModel","_ModularUIResponse","recreateModel","data","modelData","ModularUIResponse","rehydrate","Model","resolveModel","_context","model","childModels","_map","default","call","childModel","addChildModels","isModularUIModelData","has","rehydratedValue","stateKey","stateValue","Array","isArray","stateItem","locales","Locales","locale","noFurtherRehydration","_includes","state","mappedState","_keys","forEach","_default","exports"],"sources":["../../src/react-client/rehydrate.js"],"sourcesContent":["// @flow\nimport { has } from \"../utils/helpers/objects\";\nimport Locales from \"../i18n/Locales\";\n\nimport resolveModel from \"../models/resolveModel\";\n\nimport ModularUIResponse from \"../modularui/ModularUIResponse\";\n\n/**\n * Recreate a model from dehydrated data obtained after a server render.\n */\nconst recreateModel = (data: Object) => {\n const modelData = ModularUIResponse.rehydrate(data);\n\n const Model = resolveModel(modelData);\n\n if (Model) {\n const model = new Model(modelData);\n model.rehydrate(data);\n\n const childModels = data.childModels.map((childModel) =>\n recreateModel(childModel),\n );\n\n model.addChildModels(childModels);\n\n return model;\n }\n\n return data;\n};\n\n/**\n */\nconst isModularUIModelData = (data: any) =>\n data != null &&\n typeof data === \"object\" &&\n has(data, \"data\") &&\n has(data, \"contributions\");\n\n/**\n */\nconst rehydratedValue = (stateKey: string, stateValue: any) => {\n if (Array.isArray(stateValue)) {\n return stateValue.map((stateItem) => rehydrate(stateItem)); // NOSONAR\n }\n\n if (isModularUIModelData(stateValue)) {\n return recreateModel(stateValue);\n }\n\n if (\n stateKey === \"i18n\" &&\n has(stateValue, \"locales\") &&\n has(stateValue, \"locale\")\n ) {\n return {\n locales: Locales.rehydrate(stateValue.locales),\n locale: stateValue?.locale,\n };\n }\n\n const noFurtherRehydration = [\"preferences\", \"router\", \"progressindicator\"];\n if (noFurtherRehydration.includes(stateKey)) {\n return stateValue;\n }\n\n if (stateValue !== null && typeof stateValue === \"object\") {\n return rehydrate(stateValue); // NOSONAR\n }\n\n return stateValue;\n};\n\n/**\n * Maps dehydrated state to models that can be used to rehydrated the application.\n */\nconst rehydrate = (state: Object): { ... } => {\n const mappedState: { [string]: any } = {};\n\n Object.keys(state).forEach((stateKey) => {\n const stateValue = state[stateKey];\n mappedState[stateKey] = rehydratedValue(stateKey, stateValue);\n });\n\n return mappedState;\n};\n\nexport default rehydrate;\n"],"mappings":";;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,aAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,kBAAA,GAAAF,sBAAA,CAAAF,OAAA;AAEA;AACA;AACA;AACA,MAAMK,aAAa,GAAIC,IAAY,IAAK;EACtC,MAAMC,SAAS,GAAGC,0BAAiB,CAACC,SAAS,CAACH,IAAI,CAAC;EAEnD,MAAMI,KAAK,GAAG,IAAAC,qBAAY,EAACJ,SAAS,CAAC;EAErC,IAAIG,KAAK,EAAE;IAAA,IAAAE,QAAA;IACT,MAAMC,KAAK,GAAG,IAAIH,KAAK,CAACH,SAAS,CAAC;IAClCM,KAAK,CAACJ,SAAS,CAACH,IAAI,CAAC;IAErB,MAAMQ,WAAW,GAAG,IAAAC,IAAA,CAAAC,OAAA,EAAAJ,QAAA,GAAAN,IAAI,CAACQ,WAAW,EAAAG,IAAA,CAAAL,QAAA,EAAMM,UAAU,IAClDb,aAAa,CAACa,UAAU,CAC1B,CAAC;IAEDL,KAAK,CAACM,cAAc,CAACL,WAAW,CAAC;IAEjC,OAAOD,KAAK;EACd;EAEA,OAAOP,IAAI;AACb,CAAC;;AAED;AACA;AACA,MAAMc,oBAAoB,GAAId,IAAS,IACrCA,IAAI,IAAI,IAAI,IACZ,OAAOA,IAAI,KAAK,QAAQ,IACxB,IAAAe,YAAG,EAACf,IAAI,EAAE,MAAM,CAAC,IACjB,IAAAe,YAAG,EAACf,IAAI,EAAE,eAAe,CAAC;;AAE5B;AACA;AACA,M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W,WAAW,CAACX,QAAQ,CAAC,GAAGD,eAAe,CAACC,QAAQ,EAAEC,UAAU,CAAC;EAC/D,CAAC,CAAC;EAEF,OAAOU,WAAW;AACpB,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAtB,OAAA,GAEaP,SAAS"}
1
+ {"version":3,"file":"rehydrate.js","names":["_objects","require","_Locales","_interopRequireDefault","_resolveModel","_ModularUIResponse","recreateModel","data","modelData","ModularUIResponse","rehydrate","Model","resolveModel","_context","model","childModels","_map","default","call","childModel","addChildModels","isModularUIModelData","has","rehydratedValue","stateKey","stateValue","Array","isArray","stateItem","locales","Locales","locale","noFurtherRehydration","_includes","state","mappedState","_keys","forEach","_default","exports"],"sources":["../../src/react-client/rehydrate.js"],"sourcesContent":["// @flow\nimport { has } from \"../utils/helpers/objects\";\nimport Locales from \"../i18n/Locales\";\n\nimport resolveModel from \"../models/resolveModel\";\n\nimport ModularUIResponse from \"../modularui/ModularUIResponse\";\n\n/**\n * Recreate a model from dehydrated data obtained after a server render.\n */\nconst recreateModel = (data: Object) => {\n const modelData = ModularUIResponse.rehydrate(data);\n\n const Model = resolveModel(modelData);\n\n if (Model) {\n const model = new Model(modelData);\n model.rehydrate(data);\n\n const childModels = data.childModels.map((childModel) =>\n recreateModel(childModel),\n );\n\n model.addChildModels(childModels);\n\n return model;\n }\n\n return data;\n};\n\n/**\n */\nconst isModularUIModelData = (data: any) =>\n data != null &&\n typeof data === \"object\" &&\n has(data, \"data\") &&\n has(data, \"contributions\");\n\n/**\n */\nconst rehydratedValue = (stateKey: string, stateValue: any) => {\n if (Array.isArray(stateValue)) {\n return stateValue.map((stateItem) => rehydrate(stateItem)); // NOSONAR\n }\n\n if (isModularUIModelData(stateValue)) {\n return recreateModel(stateValue);\n }\n\n if (\n stateKey === \"i18n\" &&\n has(stateValue, \"locales\") &&\n has(stateValue, \"locale\")\n ) {\n return {\n locales: Locales.rehydrate(stateValue.locales),\n locale: stateValue?.locale,\n };\n }\n\n const noFurtherRehydration = [\"preferences\", \"router\", \"progressindicator\"];\n if (noFurtherRehydration.includes(stateKey)) {\n return stateValue;\n }\n\n if (stateValue !== null && typeof stateValue === \"object\") {\n return rehydrate(stateValue); // NOSONAR\n }\n\n return stateValue;\n};\n\n/**\n * Maps dehydrated state to models that can be used to rehydrated the application.\n */\nconst rehydrate = (state: Object): { ... } => {\n const mappedState: { [string]: any } = {};\n\n Object.keys(state).forEach((stateKey) => {\n const stateValue = state[stateKey];\n mappedState[stateKey] = rehydratedValue(stateKey, stateValue);\n });\n\n return mappedState;\n};\n\nexport default rehydrate;\n"],"mappings":";;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,aAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,kBAAA,GAAAF,sBAAA,CAAAF,OAAA;AAEA;AACA;AACA;AACA,MAAMK,aAAa,GAAIC,IAAY,IAAK;EACtC,MAAMC,SAAS,GAAGC,0BAAiB,CAACC,SAAS,CAACH,IAAI,CAAC;EAEnD,MAAMI,KAAK,GAAG,IAAAC,qBAAY,EAACJ,SAAS,CAAC;EAErC,IAAIG,KAAK,EAAE;IAAA,IAAAE,QAAA;IACT,MAAMC,KAAK,GAAG,IAAIH,KAAK,CAACH,SAAS,CAAC;IAClCM,KAAK,CAACJ,SAAS,CAACH,IAAI,CAAC;IAErB,MAAMQ,WAAW,GAAG,IAAAC,IAAA,CAAAC,OAAA,EAAAJ,QAAA,GAAAN,IAAI,CAACQ,WAAW,EAAAG,IAAA,CAAAL,QAAA,EAAMM,UAAU,IAClDb,aAAa,CAACa,UAAU,CAC1B,CAAC;IAEDL,KAAK,CAACM,cAAc,CAACL,WAAW,CAAC;IAEjC,OAAOD,KAAK;EACd;EAEA,OAAOP,IAAI;AACb,CAAC;;AAED;AACA;AACA,MAAMc,oBAAoB,GAAId,IAAS,IACrCA,IAAI,IAAI,IAAI,IACZ,OA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EzC,IAAAC,KAAA,CAAAnB,OAAA,EAAYiB,KAAK,CAAC,CAACG,OAAO,CAAEb,QAAQ,IAAK;IACvC,MAAMC,UAAU,GAAGS,KAAK,CAACV,QAAQ,CAAC;IAClCW,WAAW,CAACX,QAAQ,CAAC,GAAGD,eAAe,CAACC,QAAQ,EAAEC,UAAU,CAAC;EAC/D,CAAC,CAAC;EAEF,OAAOU,WAAW;AACpB,CAAC;AAAC,IAAAG,QAAA,GAEa5B,SAAS;AAAA6B,OAAA,CAAAtB,OAAA,GAAAqB,QAAA"}
@@ -57,5 +57,6 @@ const createSSRComplete = (store, render) => {
57
57
  }
58
58
  });
59
59
  };
60
- var _default = exports.default = createSSRComplete;
60
+ var _default = createSSRComplete;
61
+ exports.default = _default;
61
62
  //# sourceMappingURL=createSSRComplete.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createSSRComplete.js","names":["_Constants","require","noLoading","state","_context","_filter","default","_keys","modularui","call","key","status","MODULARUI_STATUS","LOADING","length","loadingCounter","_context2","createSSRComplete","store","render","loadingCount","getState","html","_promise","resolve","reject","unsubscribe","subscribe","previousCount","error","_default","exports"],"sources":["../../src/react-server/createSSRComplete.js"],"sourcesContent":["// @flow\nimport { MODULARUI_STATUS } from \"../constants/Constants\";\n\nimport type { ReduxStore, ReduxState } from \"../redux/types\";\n\n/**\n */\nconst noLoading = (state: ReduxState) =>\n Object.keys(state.modularui).filter(\n (key) => state.modularui[key].status === MODULARUI_STATUS.LOADING,\n ).length === 0;\n\n/**\n */\nconst loadingCounter = (state: ReduxState) =>\n Object.keys(state.modularui).filter(\n (key) => state.modularui[key].status === MODULARUI_STATUS.LOADING,\n ).length;\n\n/**\n */\nconst createSSRComplete = (\n store: ReduxStore,\n render: Function,\n): Promise<string> => {\n let loadingCount = loadingCounter(store.getState());\n let html = \"<div>Nothing to render</div>\";\n\n return new Promise((resolve, reject) => {\n const unsubscribe = store.subscribe(() => {\n const previousCount = loadingCount;\n loadingCount = loadingCounter(store.getState());\n\n if (previousCount !== loadingCount && noLoading(store.getState())) {\n try {\n html = render();\n } catch (error) {\n reject(error);\n return;\n }\n\n if (noLoading(store.getState())) {\n unsubscribe();\n resolve(html);\n }\n }\n });\n\n try {\n html = render();\n } catch (error) {\n reject(error);\n return;\n }\n\n if (noLoading(store.getState())) {\n unsubscribe();\n resolve(html);\n }\n });\n};\n\nexport default createSSRComplete;\n"],"mappings":";;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAIA;AACA;AACA,MAAMC,SAAS,GAAIC,KAAiB;EAAA,IAAAC,QAAA;EAAA,OAClC,IAAAC,OAAA,CAAAC,OAAA,EAAAF,QAAA,OAAAG,KAAA,CAAAD,OAAA,EAAYH,KAAK,CAACK,SAAS,CAAC,EAAAC,IAAA,CAAAL,QAAA,EACzBM,GAAG,IAAKP,KAAK,CAACK,SAAS,CAACE,GAAG,CAAC,CAACC,MAAM,KAAKC,2BAAgB,CAACC,OAC5D,CAAC,CAACC,MAAM,KAAK,CAAC;AAAA;;AAEhB;AACA;AACA,MAAMC,cAAc,GAAIZ,KAAiB;EAAA,IAAAa,SAAA;EAAA,OACvC,IAAAX,OAAA,CAAAC,OAAA,EAAAU,SAAA,OAAAT,KAAA,CAAAD,OAAA,EAAYH,KAAK,CAACK,SAAS,CAAC,EAAAC,IAAA,CAAAO,SAAA,EACzBN,GAAG,IAAKP,KAAK,CAACK,SAAS,CAACE,GAAG,CAAC,CAACC,MAAM,KAAKC,2BAAgB,CAACC,OAC5D,CAAC,CAACC,MAAM;AAAA;;AAEV;AACA;AACA,MAAMG,iBAAiB,GAAGA,CACxBC,KAAiB,EACjBC,MAAgB,KACI;EACpB,IAAIC,YAAY,GAAGL,cAAc,CAACG,KAAK,CAACG,QAAQ,CAAC,CAAC,CAAC;EACnD,IAAIC,IAAI,GAAG,8BAA8B;EAEzC,OAAO,IAAAC,QAAA,CAAAjB,OAAA,CAAY,CAACkB,OAAO,EAAEC,MAAM,KAAK;IACtC,MAAMC,WAAW,GAAGR,KAAK,CAACS,SAAS,CAAC,MAAM;MACxC,MAAMC,aAAa,GAAGR,YAAY;MAClCA,YAAY,GAAGL,cAAc,CAACG,KAAK,CAACG,QAAQ,CAAC,CAAC,CAAC;MAE/C,IAAIO,aAAa,KAAKR,YAAY,IAAIlB,SAAS,CAACgB,KAAK,CAACG,QAAQ,CAAC,CAAC,CAAC,EAAE;QACjE,IAAI;UACFC,IAAI,GAAGH,MAAM,CAAC,CAAC;QACjB,CAAC,CAAC,OAAOU,KAAK,EAAE;UACdJ,MAAM,CAACI,KAAK,CAAC;UACb;QACF;QAEA,IAAI3B,SAAS,CAACgB,KAAK,CAACG,QAAQ,CAAC,CAAC,CAAC,EAAE;UAC/BK,WAAW,CAAC,CAAC;UACbF,OAAO,CAACF,IAAI,CAAC;QACf;MACF;IACF,CAAC,CAAC;IAEF,IAAI;MACFA,IAAI,GAAGH,MAAM,CAAC,CAAC;IACjB,CAAC,CAAC,OAAOU,KAAK,EAAE;MACdJ,MAAM,CAACI,KAAK,CAAC;MACb;IACF;IAEA,IAAI3B,SAAS,CAACgB,KAAK,CAACG,QAAQ,CAAC,CAAC,CAAC,EAAE;MAC/BK,WAAW,CAAC,CAAC;MACbF,OAAO,CAACF,IAAI,CAAC;IACf;EACF,CAAC,CAAC;AACJ,CAAC;AAAC,IAAAQ,QAAA,GAAAC,OAAA,CAAAzB,OAAA,GAEaW,iBAAiB"}
1
+ {"version":3,"file":"createSSRComplete.js","names":["_Constants","require","noLoading","state","_context","_filter","default","_keys","modularui","call","key","status","MODULARUI_STATUS","LOADING","length","loadingCounter","_context2","createSSRComplete","store","render","loadingCount","getState","html","_promise","resolve","reject","unsubscribe","subscribe","previousCount","error","_default","exports"],"sources":["../../src/react-server/createSSRComplete.js"],"sourcesContent":["// @flow\nimport { MODULARUI_STATUS } from \"../constants/Constants\";\n\nimport type { ReduxStore, ReduxState } from \"../redux/types\";\n\n/**\n */\nconst noLoading = (state: ReduxState) =>\n Object.keys(state.modularui).filter(\n (key) => state.modularui[key].status === MODULARUI_STATUS.LOADING,\n ).length === 0;\n\n/**\n */\nconst loadingCounter = (state: ReduxState) =>\n Object.keys(state.modularui).filter(\n (key) => state.modularui[key].status === MODULARUI_STATUS.LOADING,\n ).length;\n\n/**\n */\nconst createSSRComplete = (\n store: ReduxStore,\n render: Function,\n): Promise<string> => {\n let loadingCount = loadingCounter(store.getState());\n let html = \"<div>Nothing to render</div>\";\n\n return new Promise((resolve, reject) => {\n const unsubscribe = store.subscribe(() => {\n const previousCount = loadingCount;\n loadingCount = loadingCounter(store.getState());\n\n if (previousCount !== loadingCount && noLoading(store.getState())) {\n try {\n html = render();\n } catch (error) {\n reject(error);\n return;\n }\n\n if (noLoading(store.getState())) {\n unsubscribe();\n resolve(html);\n }\n }\n });\n\n try {\n html = render();\n } catch (error) {\n reject(error);\n return;\n }\n\n if (noLoading(store.getState())) {\n unsubscribe();\n resolve(html);\n }\n });\n};\n\nexport default createSSRComplete;\n"],"mappings":";;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAIA;AACA;AACA,MAAMC,SAAS,GAAIC,KAAiB;EAAA,IAAAC,QAAA;EAAA,OAClC,IAAAC,OAAA,CAAAC,OAAA,EAAAF,QAAA,OAAAG,KAAA,CAAAD,OAAA,EAAYH,KAAK,CAACK,SAAS,CAAC,EAAAC,IAAA,CAAAL,QAAA,EACzBM,GAAG,IAAKP,KAAK,CAACK,SAAS,CAACE,GAAG,CAAC,CAACC,MAAM,KAAKC,2BAAgB,CAACC,OAC5D,CAAC,CAACC,MAAM,KAAK,CAAC;AAAA;;AAEhB;AACA;AACA,MAAMC,cAAc,GAAIZ,KAAiB;EAAA,IAAAa,SAAA;EAAA,OACvC,IAAAX,OAAA,CAAAC,OAAA,EAAAU,SAAA,OAAAT,KAAA,CAAAD,OAAA,EAAYH,KAAK,CAACK,SAAS,CAAC,EAAAC,IAAA,CAAAO,SAAA,EACzBN,GAAG,IAAKP,KAAK,CAACK,SAAS,CAACE,GA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wB,QAAA"}
@@ -50,5 +50,6 @@ const htmlpage = props => {
50
50
  // these templates must be pure strings to make it possible to add the context path in all situations
51
51
  return (0, _trim.default)(_context3 = template.replace(/{CONTEXT_PATH}/g, props.contextPath)).call(_context3);
52
52
  };
53
- var _default = exports.default = htmlpage;
53
+ var _default = htmlpage;
54
+ exports.default = _default;
54
55
  //# sourceMappingURL=htmlpage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"htmlpage.js","names":["_exceptions","require","htmlpage","props","_context","_context2","_context3","contextPath","undefined","IllegalArgumentException","html","head","template","htmlAttributes","toString","_map","default","_filter","_keys","call","key","join","UUID","state","_trim","replace","_default","exports"],"sources":["../../src/react-server/htmlpage.js"],"sourcesContent":["// @flow\nimport { IllegalArgumentException } from \"../exceptions\";\n\nexport type TemplateProps = {\n contextPath: string,\n html: string,\n head: Object,\n state: string,\n UUID: string,\n};\n\n/**\n */\nconst htmlpage = (props: TemplateProps): string => {\n if (props?.contextPath === undefined) {\n throw new IllegalArgumentException(\"Missing contextPath argument\");\n }\n if (props.html === undefined) {\n throw new IllegalArgumentException(\"Missing html for server\");\n }\n\n const { head = {} } = props;\n\n const template = `\n <!doctype html>\n <html ${head.htmlAttributes ? head.htmlAttributes.toString() : \"\"}>\n <head>\n <meta charset=\"utf-8\" />\n ${Object.keys(head)\n .filter((key) => key !== \"htmlAttributes\")\n .map((key) => head[key].toString())\n .join(\"\")}\n {CSSASSETS:<link rel=\"stylesheet\" type=\"text/css\" href=\"{CONTEXT_PATH}/{FILE}\" />:CSSASSETS}\n </head>\n <body class=\"nojs\">\n <div id=\"application\">${props.html}</div>\n <div id=\"portal\"></div>\n <script\n type=\"application/json\"\n data-app-state=\"app-json\"\n data-app-contextpath=\"{CONTEXT_PATH}\"\n data-app-filepath=\"{FILEPATH}\"\n data-app-nonce=\"${props.UUID ?? \"\"}\">${props.state ?? \"\"}</script>\n {JSASSETS:<script src=\"{CONTEXT_PATH}/{FILE}\"></script>:JSASSETS}\n </body>\n </html>\n`;\n\n // It is important to replace the context afterwards,\n // the JSASSESTS and CSSASSETS parts act as a small template for all generated javascript and css files\n // these templates must be pure strings to make it possible to add the context path in all situations\n return template.replace(/{CONTEXT_PATH}/g, props.contextPath).trim();\n};\n\nexport default htmlpage;\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAUA;AACA;AACA,MAAMC,QAAQ,GAAIC,KAAoB,IAAa;EAAA,IAAAC,QAAA,EAAAC,SAAA,EAAAC,SAAA;EACjD,IAAIH,KAAK,EAAEI,WAAW,KAAKC,SAAS,EAAE;IACpC,MAAM,IAAIC,oCAAwB,CAAC,8BAA8B,CAAC;EACpE;EACA,IAAIN,KAAK,CAACO,IAAI,KAAKF,SAAS,EAAE;IAC5B,MAAM,IAAIC,oCAAwB,CAAC,yBAAyB,CAAC;EAC/D;EAEA,MAAM;IAAEE,IAAI,GAAG,CAAC;EAAE,CAAC,GAAGR,KAAK;EAE3B,MAAMS,QAAQ,GAAI;AACpB;AACA,UAAUD,IAAI,CAACE,cAAc,GAAGF,IAAI,CAACE,cAAc,CAACC,QAAQ,CAAC,CAAC,GAAG,EAAG;AACpE;AACA;AACA,QAAQ,IAAAC,IAAA,CAAAC,OAAA,EAAAZ,QAAA,OAAAa,OAAA,CAAAD,OAAA,EAAAX,SAAA,OAAAa,KAAA,CAAAF,OAAA,EAAYL,IAAI,CAAC,EAAAQ,IAAA,CAAAd,SAAA,EACRe,GAAG,IAAKA,GAAG,KAAK,gBAAgB,CAAC,EAAAD,IAAA,CAAAf,QAAA,EACpCgB,GAAG,IAAKT,IAAI,CAACS,GAAG,CAAC,CAACN,QAAQ,CAAC,CAAC,CAAC,CAClCO,IAAI,CAAC,EAAE,CAAE;AAClB;AACA;AACA;AACA,8BAA8BlB,KAAK,CAACO,IAAK;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0BP,KAAK,CAACmB,IAAI,IAAI,EAAG,KAAInB,KAAK,CAACoB,KAAK,IAAI,EAAG;AACjE;AACA;AACA;AACA,CAAC;;EAEC;EACA;EACA;EACA,OAAO,IAAAC,KAAA,CAAAR,OAAA,EAAAV,SAAA,GAAAM,QAAQ,CAACa,OAAO,CAAC,iBAAiB,EAAEtB,KAAK,CAACI,WAAW,CAAC,EAAAY,IAAA,CAAAb,SAAM,CAAC;AACtE,CAAC;AAAC,IAAAoB,QAAA,GAAAC,OAAA,CAAAX,OAAA,GAEad,QAAQ"}
1
+ {"version":3,"file":"htmlpage.js","names":["_exceptions","require","htmlpage","props","_context","_context2","_context3","contextPath","undefined","IllegalArgumentException","html","head","template","htmlAttributes","toString","_map","default","_filter","_keys","call","key","join","UUID","state","_trim","replace","_default","exports"],"sources":["../../src/react-server/htmlpage.js"],"sourcesContent":["// @flow\nimport { IllegalArgumentException } from \"../exceptions\";\n\nexport type TemplateProps = {\n contextPath: string,\n html: string,\n head: Object,\n state: string,\n UUID: string,\n};\n\n/**\n */\nconst htmlpage = (props: TemplateProps): string => {\n if (props?.contextPath === undefined) {\n throw new IllegalArgumentException(\"Missing contextPath argument\");\n }\n if (props.html === undefined) {\n throw new IllegalArgumentException(\"Missing html for server\");\n }\n\n const { head = {} } = props;\n\n const template = `\n <!doctype html>\n <html ${head.htmlAttributes ? head.htmlAttributes.toString() : \"\"}>\n <head>\n <meta charset=\"utf-8\" />\n ${Object.keys(head)\n .filter((key) => key !== \"htmlAttributes\")\n .map((key) => head[key].toString())\n .join(\"\")}\n {CSSASSETS:<link rel=\"stylesheet\" type=\"text/css\" href=\"{CONTEXT_PATH}/{FILE}\" />:CSSASSETS}\n </head>\n <body class=\"nojs\">\n <div id=\"application\">${props.html}</div>\n <div id=\"portal\"></div>\n <script\n type=\"application/json\"\n data-app-state=\"app-json\"\n data-app-contextpath=\"{CONTEXT_PATH}\"\n data-app-filepath=\"{FILEPATH}\"\n data-app-nonce=\"${props.UUID ?? \"\"}\">${props.state ?? \"\"}</script>\n {JSASSETS:<script src=\"{CONTEXT_PATH}/{FILE}\"></script>:JSASSETS}\n </body>\n </html>\n`;\n\n // It is important to replace the context afterwards,\n // the JSASSESTS and CSSASSETS parts act as a small template for all generated javascript and css files\n // these templates must be pure strings to make it possible to add the context path in all situations\n return template.replace(/{CONTEXT_PATH}/g, props.contextPath).trim();\n};\n\nexport default htmlpage;\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAUA;AACA;AACA,MAAMC,QAAQ,GAAIC,KAAoB,IAAa;EAAA,IAAAC,QAAA,EAAAC,SAAA,EAAAC,SAAA;EACjD,IAAIH,KAAK,EAAEI,WAAW,KAAKC,SAAS,EAAE;IACpC,MAAM,IAAIC,oCAAwB,CAAC,8BAA8B,CAAC;EACpE;EACA,IAAIN,KAAK,CAACO,IAAI,KAAKF,SAAS,EAAE;IAC5B,MAAM,IAAIC,oCAAwB,CAAC,yBAAyB,CAAC;EAC/D;EAEA,MAAM;IAAEE,IAAI,GAAG,CAAC;EAAE,CAAC,GAAGR,KAAK;EAE3B,MAAMS,QAAQ,GAAI;AACpB;AACA,UAAUD,IAAI,CAACE,cAAc,GAAGF,IAAI,CAACE,cAAc,CAACC,QAAQ,CAAC,CAAC,GAAG,EAAG;AACpE;AACA;AACA,QAAQ,IAAAC,IAAA,CAAAC,OAAA,EAAAZ,QAAA,OAAAa,OAAA,CAAAD,OAAA,EAAAX,SAAA,OAAAa,KAAA,CAAAF,OAAA,EAAYL,IAAI,CAAC,EAAAQ,IAAA,CAAAd,SAAA,EACRe,GAAG,IAAKA,GAAG,KAAK,gBAAgB,CAAC,EAAAD,IAAA,CAAAf,QAAA,EACpCgB,GAAG,IAAKT,IAAI,CAACS,GAAG,CAAC,CAACN,QAAQ,CAAC,CAAC,CAAC,CAClCO,IAAI,CAAC,EAAE,CAAE;AAClB;AACA;AACA;AACA,8BAA8BlB,KAAK,CAACO,IAAK;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0BP,KAAK,CAACmB,IAAI,IAAI,EAAG,KAAInB,KAAK,CAACoB,KAAK,IAAI,EAAG;AACjE;AACA;AACA;AACA,CAAC;;EAEC;EACA;EACA;EACA,OAAO,IAAAC,KAAA,CAAAR,OAAA,EAAAV,SAAA,GAAAM,QAAQ,CAACa,OAAO,CAAC,iBAAiB,EAAEtB,KAAK,CAACI,WAAW,CAAC,EAAAY,IAAA,CAAAb,SAAM,CAAC;AACtE,CAAC;AAAC,IAAAoB,QAAA,GAEaxB,QAAQ;AAAAyB,OAAA,CAAAX,OAAA,GAAAU,QAAA"}
@@ -87,5 +87,6 @@ const renderSSRComplete = _ref => {
87
87
  UUID
88
88
  }));
89
89
  };
90
- var _default = exports.default = renderSSRComplete;
90
+ var _default = renderSSRComplete;
91
+ exports.default = _default;
91
92
  //# sourceMappingURL=renderSSRComplete.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderSSRComplete.js","names":["_server","require","_reactRedux","_reactRouter","_reactHelmetAsync","_styledComponents","_createSSRComplete","_interopRequireDefault","_htmlpage","_Settings","_ThemeProvider","_ErrorBoundary","_serverUtil","_jsxRuntime","renderSSRComplete","_ref","store","theme","UUID","requestHref","render","ErrorPage","template","htmlpage","helmetContext","helmet","routerContext","sheet","ServerStyleSheet","location","toLocation","basePath","getBasePath","createSSRComplete","renderToString","jsx","Provider","children","StyleSheetManager","instance","default","HelmetProvider","context","StaticRouter","basename","then","appHTML","handleErrors","head","createHead","contextPath","html","state","dehydrate","catch","error","errorMessage","message","errorResource","fileName","errorLine","lineNumber","errorStack","stack","_default","exports"],"sources":["../../src/react-server/renderSSRComplete.js"],"sourcesContent":["// @flow\nimport { renderToString } from \"react-dom/server\";\nimport { Provider } from \"react-redux\";\nimport { StaticRouter as Router } from \"react-router\";\n\nimport { HelmetProvider } from \"react-helmet-async\";\n\nimport { ServerStyleSheet, StyleSheetManager } from \"styled-components\";\n\nimport createSSRComplete from \"./createSSRComplete\";\nimport htmlpage from \"./htmlpage\";\n\nimport { getBasePath } from \"../constants/Settings\";\n\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\nimport ErrorBoundary from \"../react/ErrorBoundary\";\n\nimport { createHead, handleErrors, dehydrate } from \"./serverUtil\";\n\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type Href from \"../models/href/Href\";\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { Location } from \"react-router\";\n\ntype Props = {\n store: ReduxStore,\n theme: Theme,\n UUID: string,\n requestHref: Href,\n render: Function,\n ErrorPage: any,\n template?: (TemplateProps) => string,\n};\n/**\n */\nconst renderSSRComplete = ({\n store,\n theme,\n UUID = \"\",\n requestHref,\n render,\n ErrorPage,\n template = htmlpage,\n}: Props): Promise<string> => {\n const helmetContext = { helmet: {} };\n const routerContext = {};\n\n const sheet = new ServerStyleSheet();\n\n // $FlowFixMe[incompatible-type]\n // $FlowFixMe[prop-missing]\n const location: Location = requestHref.toLocation();\n\n const basePath = getBasePath();\n\n return createSSRComplete(store, () =>\n renderToString(\n <Provider store={store}>\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>\n <HelmetProvider context={helmetContext}>\n <ErrorBoundary>\n <Router\n basename={basePath}\n location={location}\n context={routerContext}\n >\n {render()}\n </Router>\n </ErrorBoundary>\n </HelmetProvider>\n </ThemeProvider>\n </StyleSheetManager>\n </Provider>,\n ),\n )\n .then((appHTML) => {\n handleErrors(store);\n const head = createHead(sheet, UUID, helmetContext);\n return template({\n contextPath: basePath,\n html: appHTML,\n head,\n state: dehydrate(store),\n UUID,\n });\n })\n .catch((error) =>\n template({\n contextPath: basePath,\n html: renderToString(\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>\n <ErrorPage\n errorMessage={error.message}\n errorResource={error.fileName}\n errorLine={error.lineNumber}\n errorStack={error.stack}\n />\n </ThemeProvider>\n </StyleSheetManager>,\n ),\n head: helmetContext.helmet,\n state: \"\",\n UUID,\n }),\n );\n};\n\nexport default renderSSRComplete;\n"],"mappings":";;;;;;;AACA,IAA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GAAA,EAACd,SAAS;UACRmC,YAAY,EAAED,KAAK,CAACE,OAAQ;UAC5BC,aAAa,EAAEH,KAAK,CAACI,QAAS;UAC9BC,SAAS,EAAEL,KAAK,CAACM,UAAW;UAC5BC,UAAU,EAAEP,KAAK,CAACQ;QAAM,CACzB;MAAC,CACW;IAAC,CACC,CACrB,CAAC;IACDf,IAAI,EAAExB,aAAa,CAACC,MAAM;IAC1B2B,KAAK,EAAE,EAAE;IACTlC;EACF,CAAC,CACH,CAAC;AACL,CAAC;AAAC,IAAA8C,QAAA,GAAAC,OAAA,CAAAzB,OAAA,GAEa1B,iBAAiB"}
1
+ {"version":3,"file":"renderSSRComplete.js","names":["_server","require","_reactRedux","_reactRouter","_reactHelmetAsync","_styledComponents","_createSSRComplete","_interopRequireDefault","_htmlpage","_Settings","_ThemeProvider","_ErrorBoundary","_serverUtil","_jsxRuntime","renderSSRComplete","_ref","store","theme","UUID","requestHref","render","ErrorPage","template","htmlpage","helmetContext","helmet","routerContext","sheet","ServerStyleSheet","location","toLocation","basePath","getBasePath","createSSRComplete","renderToString","jsx","Provider","children","StyleSheetManager","instance","default","HelmetProvider","context","StaticRouter","basename","then","appHTML","handleErrors","head","createHead","contextPath","html","state","dehydrate","catch","error","errorMessage","message","errorResource","fileName","errorLine","lineNumber","errorStack","stack","_default","exports"],"sources":["../../src/react-server/renderSSRComplete.js"],"sourcesContent":["// @flow\nimport { renderToString } from \"react-dom/server\";\nimport { Provider } from \"react-redux\";\nimport { StaticRouter as Router } from \"react-router\";\n\nimport { HelmetProvider } from \"react-helmet-async\";\n\nimport { ServerStyleSheet, StyleSheetManager } from \"styled-components\";\n\nimport createSSRComplete from \"./createSSRComplete\";\nimport htmlpage from \"./htmlpage\";\n\nimport { getBasePath } from \"../constants/Settings\";\n\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\nimport ErrorBoundary from \"../react/ErrorBoundary\";\n\nimport { createHead, handleErrors, dehydrate } from \"./serverUtil\";\n\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type Href from \"../models/href/Href\";\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { Location } from \"react-router\";\n\ntype Props = {\n store: ReduxStore,\n theme: Theme,\n UUID: string,\n requestHref: Href,\n render: Function,\n ErrorPage: any,\n template?: (TemplateProps) => string,\n};\n/**\n */\nconst renderSSRComplete = ({\n store,\n theme,\n UUID = \"\",\n requestHref,\n render,\n ErrorPage,\n template = htmlpage,\n}: Props): Promise<string> => {\n const helmetContext = { helmet: {} };\n const routerContext = {};\n\n const sheet = new ServerStyleSheet();\n\n // $FlowFixMe[incompatible-type]\n // $FlowFixMe[prop-missing]\n const location: Location = requestHref.toLocation();\n\n const basePath = getBasePath();\n\n return createSSRComplete(store, () =>\n renderToString(\n <Provider store={store}>\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>\n <HelmetProvider context={helmetContext}>\n <ErrorBoundary>\n <Router\n basename={basePath}\n location={location}\n context={routerContext}\n >\n {render()}\n </Router>\n </ErrorBoundary>\n </HelmetProvider>\n </ThemeProvider>\n </StyleSheetManager>\n </Provider>,\n ),\n )\n .then((appHTML) => {\n handleErrors(store);\n const head = createHead(sheet, UUID, helmetContext);\n return template({\n contextPath: basePath,\n html: appHTML,\n head,\n state: dehydrate(store),\n UUID,\n });\n })\n .catch((error) =>\n template({\n contextPath: basePath,\n html: renderToString(\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>\n <ErrorPage\n errorMessage={error.message}\n errorResource={error.fileName}\n errorLine={error.lineNumber}\n errorStack={error.stack}\n />\n </ThemeProvider>\n </StyleSheetManager>,\n ),\n head: helmetContext.helmet,\n state: \"\",\n UUID,\n }),\n );\n};\n\nexport default renderSSRComplete;\n"],"mappings":";;;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEA,IAAAG,iBAAA,G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AS,EAAEL,KAAK,CAACM,UAAW;UAC5BC,UAAU,EAAEP,KAAK,CAACQ;QAAM,CACzB;MAAC,CACW;IAAC,CACC,CACrB,CAAC;IACDf,IAAI,EAAExB,aAAa,CAACC,MAAM;IAC1B2B,KAAK,EAAE,EAAE;IACTlC;EACF,CAAC,CACH,CAAC;AACL,CAAC;AAAC,IAAA8C,QAAA,GAEalD,iBAAiB;AAAAmD,OAAA,CAAAzB,OAAA,GAAAwB,QAAA"}
@@ -43,5 +43,6 @@ const renderSSRMinimal = _ref => {
43
43
  UUID
44
44
  });
45
45
  };
46
- var _default = exports.default = renderSSRMinimal;
46
+ var _default = renderSSRMinimal;
47
+ exports.default = _default;
47
48
  //# sourceMappingURL=renderSSRMinimal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderSSRMinimal.js","names":["_server","require","_reactRedux","_styledComponents","_ThemeProvider","_interopRequireDefault","_Settings","_serverUtil","_htmlpage","_jsxRuntime","renderSSRMinimal","_ref","store","theme","UUID","render","template","htmlpage","sheet","ServerStyleSheet","appHTML","renderToString","jsx","Provider","children","StyleSheetManager","instance","default","head","createHead","contextPath","getBasePath","html","state","dehydrate","_default","exports"],"sources":["../../src/react-server/renderSSRMinimal.js"],"sourcesContent":["// @flow\nimport { renderToString } from \"react-dom/server\";\n\nimport { Provider } from \"react-redux\";\n\nimport { ServerStyleSheet, StyleSheetManager } from \"styled-components\";\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\n\nimport { getBasePath } from \"../constants/Settings\";\n\nimport { createHead, dehydrate } from \"./serverUtil\";\nimport htmlpage from \"./htmlpage\";\n\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type { TemplateProps } from \"./htmlpage\";\ntype Props = {\n store: ReduxStore,\n theme?: Theme | Array<Theme>,\n UUID: string,\n render: Function,\n template?: (TemplateProps) => string,\n};\n\n/**\n */\nconst renderSSRMinimal = ({\n store,\n theme,\n UUID = \"\",\n render,\n template = htmlpage,\n}: Props): string => {\n const sheet = new ServerStyleSheet();\n\n const appHTML = renderToString(\n <Provider store={store}>\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>{render()}</ThemeProvider>\n </StyleSheetManager>\n </Provider>,\n );\n\n const head = createHead(sheet, UUID);\n return template({\n contextPath: getBasePath(),\n html: appHTML,\n head,\n state: dehydrate(store),\n UUID,\n });\n};\n\nexport default renderSSRMinimal;\n"],"mappings":";;;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,IAAAK,SAAA,GAAAL,OAAA;AAEA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAH,sBAAA,CAAAJ,OAAA;AAAkC,IAAAQ,WAAA,GAAAR,OAAA;AAalC;AACA;AACA,MAAMS,gBAAgB,GAAGC,IAAA,IAMJ;EAAA,IANK;IACxBC,KAAK;IACLC,KAAK;IACLC,IAAI,GAAG,EAAE;IACTC,MAAM;IACNC,QAAQ,GAAGC;EACN,CAAC,GAAAN,IAAA;EACN,MAAMO,KAAK,GAAG,IAAIC,kCAAgB,CAAC,CAAC;EAEpC,MAAMC,OAAO,GAAG,IAAAC,sBAAc,gBAC5B,IAAAZ,WAAA,CAAAa,GAAA,EAACpB,WAAA,CAAAqB,QAAQ;IAACX,KAAK,EAAEA,KAAM;IAAAY,QAAA,eACrB,IAAAf,WAAA,CAAAa,GAAA,EAACnB,iBAAA,CAAAsB,iBAAiB;MAACP,KAAK,EAAEA,KAAK,CAACQ,QAAS;MAAAF,QAAA,eACvC,IAAAf,WAAA,CAAAa,GAAA,EAAClB,cAAA,CAAAuB,OAAa;QAACd,KAAK,EAAEA,KAAM;QAAAW,QAAA,EAAET,MAAM,CAAC;MAAC,CAAgB;IAAC,CACtC;EAAC,CACZ,CACZ,CAAC;EAED,MAAMa,IAAI,GAAG,IAAAC,sBAAU,EAACX,KAAK,EAAEJ,IAAI,CAAC;EACpC,OAAOE,QAAQ,CAAC;IACdc,WAAW,EAAE,IAAAC,qBAAW,EAAC,CAAC;IAC1BC,IAAI,EAAEZ,OAAO;IACbQ,IAAI;IACJK,KAAK,EAAE,IAAAC,qBAAS,EAACtB,KAAK,CAAC;IACvBE;EACF,CAAC,CAAC;AACJ,CAAC;AAAC,IAAAqB,QAAA,GAAAC,OAAA,CAAAT,OAAA,GAEajB,gBAAgB"}
1
+ {"version":3,"file":"renderSSRMinimal.js","names":["_server","require","_reactRedux","_styledComponents","_ThemeProvider","_interopRequireDefault","_Settings","_serverUtil","_htmlpage","_jsxRuntime","renderSSRMinimal","_ref","store","theme","UUID","render","template","htmlpage","sheet","ServerStyleSheet","appHTML","renderToString","jsx","Provider","children","StyleSheetManager","instance","default","head","createHead","contextPath","getBasePath","html","state","dehydrate","_default","exports"],"sources":["../../src/react-server/renderSSRMinimal.js"],"sourcesContent":["// @flow\nimport { renderToString } from \"react-dom/server\";\n\nimport { Provider } from \"react-redux\";\n\nimport { ServerStyleSheet, StyleSheetManager } from \"styled-components\";\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\n\nimport { getBasePath } from \"../constants/Settings\";\n\nimport { createHead, dehydrate } from \"./serverUtil\";\nimport htmlpage from \"./htmlpage\";\n\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type { TemplateProps } from \"./htmlpage\";\ntype Props = {\n store: ReduxStore,\n theme?: Theme | Array<Theme>,\n UUID: string,\n render: Function,\n template?: (TemplateProps) => string,\n};\n\n/**\n */\nconst renderSSRMinimal = ({\n store,\n theme,\n UUID = \"\",\n render,\n template = htmlpage,\n}: Props): string => {\n const sheet = new ServerStyleSheet();\n\n const appHTML = renderToString(\n <Provider store={store}>\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>{render()}</ThemeProvider>\n </StyleSheetManager>\n </Provider>,\n );\n\n const head = createHead(sheet, UUID);\n return template({\n contextPath: getBasePath(),\n html: appHTML,\n head,\n state: dehydrate(store),\n UUID,\n });\n};\n\nexport default renderSSRMinimal;\n"],"mappings":";;;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,IAAAK,SAAA,GAAAL,OAAA;AAEA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAH,sBAAA,CAAAJ,OAAA;AAAkC,IAAAQ,WAAA,GAAAR,OAAA;AAalC;AACA;AACA,MAAMS,gBAAgB,GAAGC,IAAA,IAMJ;EAAA,IANK;IACxBC,KAAK;IACLC,KAAK;IACLC,IAAI,GAAG,EAAE;IACTC,MAAM;IACNC,QAAQ,GAAGC;EACN,CAAC,GAAAN,IAAA;EACN,MAAMO,KAAK,GAAG,IAAIC,kCAAgB,CAAC,CAAC;EAEpC,MAAMC,OAAO,GAAG,IAAAC,sBAAc,gBAC5B,IAAAZ,WAAA,CAAAa,GAAA,EAACpB,WAAA,CAAAqB,QAAQ;IAACX,KAAK,EAAEA,KAAM;IAAAY,QAAA,eACrB,IAAAf,WAAA,CAAAa,GAAA,EAACnB,iBAAA,CAAAsB,iBAAiB;MAACP,KAAK,EAAEA,KAAK,CAACQ,QAAS;MAAAF,QAAA,eACvC,IAAAf,WAAA,CAAAa,GAAA,EAAClB,cAAA,CAAAuB,OAAa;QAACd,KAAK,EAAEA,KAAM;QAAAW,QAAA,EAAET,MAAM,CAAC;MAAC,CAAgB;IAAC,CACtC;EAAC,CACZ,CACZ,CAAC;EAED,MAAMa,IAAI,GAAG,IAAAC,sBAAU,EAACX,KAAK,EAAEJ,IAAI,CAAC;EACpC,OAAOE,QAAQ,CAAC;IACdc,WAAW,EAAE,IAAAC,qBAAW,EAAC,CAAC;IAC1BC,IAAI,EAAEZ,OAAO;IACbQ,IAAI;IACJK,KAAK,EAAE,IAAAC,qBAAS,EAACtB,KAAK,CAAC;IACvBE;EACF,CAAC,CAAC;AACJ,CAAC;AAAC,IAAAqB,QAAA,GAEazB,gBAAgB;AAAA0B,OAAA,CAAAT,OAAA,GAAAQ,QAAA"}
@@ -26,6 +26,10 @@ const serverNoSSR = _ref => {
26
26
  beforeRenderHooks,
27
27
  preloadApplication = true
28
28
  } = _ref;
29
+ const isPreviewCheck = request.getHeader("X-BI-Preview-Available");
30
+ if (isPreviewCheck) {
31
+ return "<h1>Preview Available</h1>";
32
+ }
29
33
  const UUID = (0, _createUUID.default)();
30
34
  __webpack_nonce__ = UUID; // NOSONAR
31
35
 
@@ -55,5 +59,6 @@ const serverNoSSR = _ref => {
55
59
  template
56
60
  });
57
61
  };
58
- var _default = exports.default = serverNoSSR;
62
+ var _default = serverNoSSR;
63
+ exports.default = _default;
59
64
  //# sourceMappingURL=serverNoSSR.js.map
@@ -50,6 +50,11 @@ const serverNoSSR = ({
50
50
  beforeRenderHooks,
51
51
  preloadApplication = true,
52
52
  }: serverProps): string => {
53
+ const isPreviewCheck = request.getHeader("X-BI-Preview-Available");
54
+ if (isPreviewCheck) {
55
+ return "<h1>Preview Available</h1>";
56
+ }
57
+
53
58
  const UUID = createUUID();
54
59
  __webpack_nonce__ = UUID; // NOSONAR
55
60
 
@@ -1 +1 @@
1
- {"version":3,"file":"serverNoSSR.js","names":["require","_createUUID","_interopRequireDefault","_requestInformation","_serverUtil","_beforeRenderHooks","_renderSSRMinimal","_createTheme","serverNoSSR","_ref","request","locales","customReducers","serverPreferences","theme","render","template","beforeRenderHooks","preloadApplication","UUID","createUUID","__webpack_nonce__","requestHref","getFullRequestHref","store","createReduxStore","setServerPreferences","setConfigurationTheme","storedTheme","getState","preferences","createTheme","setI18n","setApplication","handleErrors","handleBeforeRenderHooks","renderSSRMinimal","_default","exports","default"],"sources":["../../src/react-server/serverNoSSR.js"],"sourcesContent":["// @flow\nimport \"./contextPath\";\n\nimport createUUID from \"../utils/helpers/createUUID\";\nimport { getFullRequestHref } from \"./requestInformation\";\n\nimport {\n createReduxStore,\n setI18n,\n setApplication,\n setServerPreferences,\n setConfigurationTheme,\n handleErrors,\n} from \"./serverUtil\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport renderSSRMinimal from \"./renderSSRMinimal\";\n\nimport createTheme from \"../react-theme/createTheme\";\n\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { PreferenceValue } from \"./serverUtil\";\nimport type { LocaleConfiguration } from \"../i18n/types\";\nimport type { Theme } from \"../react-theme/types\";\n\ntype serverProps = {\n request: HttpServletRequestJava,\n locales?: Array<LocaleConfiguration>,\n customReducers?: Object,\n theme?: Theme | Array<Theme>,\n serverPreferences?: Array<string | PreferenceValue>,\n render: Function,\n template?: (TemplateProps) => string,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n preloadApplication?: boolean,\n};\n\n/**\n */\nconst serverNoSSR = ({\n request,\n locales,\n customReducers,\n serverPreferences = [],\n theme,\n render,\n template,\n beforeRenderHooks,\n preloadApplication = true,\n}: serverProps): string => {\n const UUID = createUUID();\n __webpack_nonce__ = UUID; // NOSONAR\n\n const requestHref = getFullRequestHref(request);\n\n const store = createReduxStore(requestHref, customReducers);\n\n setServerPreferences(store, serverPreferences);\n setConfigurationTheme(store);\n\n if (theme) {\n const storedTheme = store.getState()?.preferences?.theme;\n //$FlowFixMe[incompatible-call]\n createTheme(storedTheme, theme);\n }\n\n setI18n(store, locales, request);\n\n if (preloadApplication) {\n setApplication(store);\n }\n\n handleErrors(store);\n\n handleBeforeRenderHooks(beforeRenderHooks, { store, request });\n\n return renderSSRMinimal({ store, theme, UUID, render, template });\n};\n\nexport default serverNoSSR;\n"],"mappings":";;;;;;;AACAA,OAAA;AAEA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,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EV,KAAK;IAAEK,IAAI;IAAEJ,MAAM;IAAEC;EAAS,CAAC,CAAC;AACnE,CAAC;AAAC,IAAAqB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa/B,WAAW"}
1
+ {"version":3,"file":"serverNoSSR.js","names":["require","_createUUID","_interopRequireDefault","_requestInformation","_serverUtil","_beforeRenderHooks","_renderSSRMinimal","_createTheme","serverNoSSR","_ref","request","locales","customReducers","serverPreferences","theme","render","template","beforeRenderHooks","preloadApplication","isPreviewCheck","getHeader","UUID","createUUID","__webpack_nonce__","requestHref","getFullRequestHref","store","createReduxStore","setServerPreferences","setConfigurationTheme","storedTheme","getState","preferences","createTheme","setI18n","setApplication","handleErrors","handleBeforeRenderHooks","renderSSRMinimal","_default","exports","default"],"sources":["../../src/react-server/serverNoSSR.js"],"sourcesContent":["// @flow\nimport \"./contextPath\";\n\nimport createUUID from \"../utils/helpers/createUUID\";\nimport { getFullRequestHref } from \"./requestInformation\";\n\nimport {\n createReduxStore,\n setI18n,\n setApplication,\n setServerPreferences,\n setConfigurationTheme,\n handleErrors,\n} from \"./serverUtil\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport renderSSRMinimal from \"./renderSSRMinimal\";\n\nimport createTheme from \"../react-theme/createTheme\";\n\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { PreferenceValue } from \"./serverUtil\";\nimport type { LocaleConfiguration } from \"../i18n/types\";\nimport type { Theme } from \"../react-theme/types\";\n\ntype serverProps = {\n request: HttpServletRequestJava,\n locales?: Array<LocaleConfiguration>,\n customReducers?: Object,\n theme?: Theme | Array<Theme>,\n serverPreferences?: Array<string | PreferenceValue>,\n render: Function,\n template?: (TemplateProps) => string,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n preloadApplication?: boolean,\n};\n\n/**\n */\nconst serverNoSSR = ({\n request,\n locales,\n customReducers,\n serverPreferences = [],\n theme,\n render,\n template,\n beforeRenderHooks,\n preloadApplication = true,\n}: serverProps): string => {\n const isPreviewCheck = request.getHeader(\"X-BI-Preview-Available\");\n if (isPreviewCheck) {\n return \"<h1>Preview Available</h1>\";\n }\n\n const UUID = createUUID();\n __webpack_nonce__ = UUID; // NOSONAR\n\n const requestHref = getFullRequestHref(request);\n\n const store = createReduxStore(requestHref, customReducers);\n\n setServerPreferences(store, serverPreferences);\n setConfigurationTheme(store);\n\n if (theme) {\n const storedTheme = store.getState()?.preferences?.theme;\n //$FlowFixMe[incompatible-call]\n createTheme(storedTheme, theme);\n }\n\n setI18n(store, locales, request);\n\n if (preloadApplication) {\n setApplication(store);\n }\n\n handleErrors(store);\n\n handleBeforeRenderHooks(beforeRenderHooks, { store, request });\n\n return renderSSRMinimal({ store, theme, UUID, render, template });\n};\n\nexport default serverNoSSR;\n"],"mappings":";;;;;;;AACAA,OAAA;AAEA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AAEA,IAAAI,WAAA,GAAAJ,OAAA;AASA,IAAAK,kBAAA,GAAAL,OAAA;AAEA,IAAAM,iBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAEA,IAAAO,YAAA,GAAAL,sBAAA,CAAAF,OAAA;AAoBA;AACA;AACA,MAAMQ,WAAW,GAAGC,IAAA,IAUO;EAAA,IAVN;IACnBC,OAAO;IACPC,OAAO;IACPC,cAAc;IACdC,iBAAiB,GAAG,EAAE;IACtBC,KAAK;IACLC,MAAM;IACNC,QAAQ;IACRC,iBAAiB;IACjBC,kBAAkB,GAAG;EACV,CAAC,GAAAT,IAAA;EACZ,MAAMU,cAAc,GAAGT,OAAO,CAACU,SAAS,CAAC,wBAAwB,CAAC;EAClE,IAAID,cAAc,EAAE;IAClB,OAAO,4BAA4B;EACrC;EAEA,MAAME,IAAI,GAAG,IAAAC,mBAAU,EAAC,CAAC;EACzBC,iBAAiB,GAAGF,IAAI,CAAC,CAAC;;EAE1B,MAAMG,WAAW,GAAG,IAAAC,sCAAkB,EAACf,OAAO,CAAC;EAE/C,MAAMgB,KAAK,GAAG,IAAAC,4BAAgB,EAACH,WAAW,EAAEZ,cAAc,CAAC;EAE3D,IAAAgB,gCAAoB,EAACF,KAAK,EAAEb,iBAAiB,CAAC;EAC9C,IAAAgB,iCAAqB,EAACH,KAAK,CAAC;EAE5B,IAAIZ,KAAK,EAAE;IACT,MAAMgB,WAAW,GAAGJ,KAAK,CAACK,QAAQ,CAAC,CAAC,EAAEC,WAAW,EAAElB,KAAK;IACxD;IACA,IAAAmB,oBAAW,EAACH,WAAW,EAAEhB,KAAK,CAAC;EACjC;EAEA,IAAAoB,mBAAO,EAACR,KAAK,EAAEf,OAAO,EAAED,OAAO,CAAC;EAEhC,IAAIQ,kBAAkB,EAAE;IACtB,IAAAiB,0BAAc,EAACT,KAAK,CAAC;EACvB;EAEA,IAAAU,wBAAY,EAACV,KAAK,CAAC;EAEnB,IAAAW,0CAAuB,EAACpB,iBAAiB,EAAE;IAAES,KAAK;IAAEhB;EAAQ,CAAC,CAAC;EAE9D,OAAO,IAAA4B,yBAAgB,EAAC;IAAEZ,KAAK;IAAEZ,KAAK;IAAEO,IAAI;IAAEN,MAAM;IAAEC;EAAS,CAAC,CAAC;AACnE,CAAC;AAAC,IAAAuB,QAAA,GAEa/B,WAAW;AAAAgC,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -47,5 +47,6 @@ const serverSSR = _ref => {
47
47
  template
48
48
  });
49
49
  };
50
- var _default = exports.default = serverSSR;
50
+ var _default = serverSSR;
51
+ exports.default = _default;
51
52
  //# sourceMappingURL=serverSSR.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"serverSSR.js","names":["require","_createUUID","_interopRequireDefault","_requestInformation","_serverUtil","_beforeRenderHooks","_renderSSRComplete","serverSSR","_ref","request","locales","customReducers","serverPreferences","theme","render","ErrorPage","template","beforeRenderHooks","UUID","createUUID","__webpack_nonce__","requestHref","getFullRequestHref","store","createReduxStore","setServerPreferences","setConfigurationTheme","setI18n","handleBeforeRenderHooks","renderSSRComplete","_default","exports","default"],"sources":["../../src/react-server/serverSSR.js"],"sourcesContent":["// @flow\nimport \"./contextPath\";\n\nimport createUUID from \"../utils/helpers/createUUID\";\nimport { getFullRequestHref } from \"./requestInformation\";\n\nimport {\n createReduxStore,\n setI18n,\n setServerPreferences,\n setConfigurationTheme,\n} from \"./serverUtil\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport renderSSRComplete from \"./renderSSRComplete\";\n\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { PreferenceValue } from \"./serverUtil\";\nimport type { LocaleConfiguration } from \"../i18n/types\";\ntype serverProps = {\n request: HttpServletRequestJava,\n locales?: Array<LocaleConfiguration>,\n customReducers?: Object,\n theme?: Object,\n serverPreferences?: Array<string | PreferenceValue>,\n render: Function,\n ErrorPage?: any,\n template?: (TemplateProps) => string,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n};\n\n/**\n */\nconst serverSSR = ({\n request,\n locales,\n customReducers,\n serverPreferences = [],\n theme = null,\n render,\n ErrorPage,\n template,\n beforeRenderHooks,\n}: serverProps): Promise<string> => {\n const UUID = createUUID();\n __webpack_nonce__ = UUID; // NOSONAR\n\n const requestHref = getFullRequestHref(request);\n const store = createReduxStore(requestHref, customReducers);\n\n setServerPreferences(store, serverPreferences);\n setConfigurationTheme(store);\n setI18n(store, locales, request);\n\n handleBeforeRenderHooks(beforeRenderHooks, { request, store });\n\n return renderSSRComplete({\n store,\n theme,\n UUID,\n requestHref,\n render,\n ErrorPage,\n template,\n });\n};\n\nexport default serverSSR;\n"],"mappings":";;;;;;;AACAA,OAAA;AAEA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AAEA,IAAAI,WAAA,GAAAJ,OAAA;AAOA,IAAAK,kBAAA,GAAAL,OAAA;AAEA,IAAAM,kBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAkBA;AACA;AACA,MAAMO,SAAS,GAAGC,IAAA,IAUkB;EAAA,IAVjB;IACjBC,OAAO;IACPC,OAAO;IACPC,cAAc;IACdC,iBAAiB,GAAG,EAAE;IACtBC,KAAK,GAAG,IAAI;IACZC,MAAM;IACNC,SAAS;IACTC,QAAQ;IACRC;EACW,CAAC,GAAAT,IAAA;EACZ,MAAMU,IAAI,GAAG,IAAAC,mBAAU,EAAC,CAAC;EACzBC,iBAAiB,GAAGF,IAAI,CAAC,CAAC;;EAE1B,MAAMG,WAAW,GAAG,IAAAC,sCAAkB,EAACb,OAAO,CAAC;EAC/C,MAAMc,KAAK,GAAG,IAAAC,4BAAgB,EAACH,WAAW,EAAEV,cAAc,CAAC;EAE3D,IAAAc,gCAAoB,EAACF,KAAK,EAAEX,iBAAiB,CAAC;EAC9C,IAAAc,iCAAqB,EAACH,KAAK,CAAC;EAC5B,IAAAI,mBAAO,EAACJ,KAAK,EAAEb,OAAO,EAAED,OAAO,CAAC;EAEhC,IAAAmB,0CAAuB,EAACX,iBAAiB,EAAE;IAAER,OAAO;IAAEc;EAAM,CAAC,CAAC;EAE9D,OAAO,IAAAM,0BAAiB,EAAC;IACvBN,KAAK;IACLV,KAAK;IACLK,IAAI;IACJG,WAAW;IACXP,MAAM;IACNC,SAAS;IACTC;EACF,CAAC,CAAC;AACJ,CAAC;AAAC,IAAAc,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEazB,SAAS"}
1
+ {"version":3,"file":"serverSSR.js","names":["require","_createUUID","_interopRequireDefault","_requestInformation","_serverUtil","_beforeRenderHooks","_renderSSRComplete","serverSSR","_ref","request","locales","customReducers","serverPreferences","theme","render","ErrorPage","template","beforeRenderHooks","UUID","createUUID","__webpack_nonce__","requestHref","getFullRequestHref","store","createReduxStore","setServerPreferences","setConfigurationTheme","setI18n","handleBeforeRenderHooks","renderSSRComplete","_default","exports","default"],"sources":["../../src/react-server/serverSSR.js"],"sourcesContent":["// @flow\nimport \"./contextPath\";\n\nimport createUUID from \"../utils/helpers/createUUID\";\nimport { getFullRequestHref } from \"./requestInformation\";\n\nimport {\n createReduxStore,\n setI18n,\n setServerPreferences,\n setConfigurationTheme,\n} from \"./serverUtil\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport renderSSRComplete from \"./renderSSRComplete\";\n\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { PreferenceValue } from \"./serverUtil\";\nimport type { LocaleConfiguration } from \"../i18n/types\";\ntype serverProps = {\n request: HttpServletRequestJava,\n locales?: Array<LocaleConfiguration>,\n customReducers?: Object,\n theme?: Object,\n serverPreferences?: Array<string | PreferenceValue>,\n render: Function,\n ErrorPage?: any,\n template?: (TemplateProps) => string,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n};\n\n/**\n */\nconst serverSSR = ({\n request,\n locales,\n customReducers,\n serverPreferences = [],\n theme = null,\n render,\n ErrorPage,\n template,\n beforeRenderHooks,\n}: serverProps): Promise<string> => {\n const UUID = createUUID();\n __webpack_nonce__ = UUID; // NOSONAR\n\n const requestHref = getFullRequestHref(request);\n const store = createReduxStore(requestHref, customReducers);\n\n setServerPreferences(store, serverPreferences);\n setConfigurationTheme(store);\n setI18n(store, locales, request);\n\n handleBeforeRenderHooks(beforeRenderHooks, { request, store });\n\n return renderSSRComplete({\n store,\n theme,\n UUID,\n requestHref,\n render,\n ErrorPage,\n template,\n });\n};\n\nexport default serverSSR;\n"],"mappings":";;;;;;;AACAA,OAAA;AAEA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AAEA,IAAAI,WAAA,GAAAJ,OAAA;AAOA,IAAAK,kBAAA,GAAAL,OAAA;AAEA,IAAAM,kBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAkBA;AACA;AACA,MAAMO,SAAS,GAAGC,IAAA,IAUkB;EAAA,IAVjB;IACjBC,OAAO;IACPC,OAAO;IACPC,cAAc;IACdC,iBAAiB,GAAG,EAAE;IACtBC,KAAK,GAAG,IAAI;IACZC,MAAM;IACNC,SAAS;IACTC,QAAQ;IACRC;EACW,CAAC,GAAAT,IAAA;EACZ,MAAMU,IAAI,GAAG,IAAAC,mBAAU,EAAC,CAAC;EACzBC,iBAAiB,GAAGF,IAAI,CAAC,CAAC;;EAE1B,MAAMG,WAAW,GAAG,IAAAC,sCAAkB,EAACb,OAAO,CAAC;EAC/C,MAAMc,KAAK,GAAG,IAAAC,4BAAgB,EAACH,WAAW,EAAEV,cAAc,CAAC;EAE3D,IAAAc,gCAAoB,EAACF,KAAK,EAAEX,iBAAiB,CAAC;EAC9C,IAAAc,iCAAqB,EAACH,KAAK,CAAC;EAC5B,IAAAI,mBAAO,EAACJ,KAAK,EAAEb,OAAO,EAAED,OAAO,CAAC;EAEhC,IAAAmB,0CAAuB,EAACX,iBAAiB,EAAE;IAAER,OAAO;IAAEc;EAAM,CAAC,CAAC;EAE9D,OAAO,IAAAM,0BAAiB,EAAC;IACvBN,KAAK;IACLV,KAAK;IACLK,IAAI;IACJG,WAAW;IACXP,MAAM;IACNC,SAAS;IACTC;EACF,CAAC,CAAC;AACJ,CAAC;AAAC,IAAAc,QAAA,GAEavB,SAAS;AAAAwB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -29,5 +29,6 @@ const ThemeProvider = _ref => {
29
29
  });
30
30
  };
31
31
  ThemeProvider.displayName = "BI.ThemeProvider";
32
- var _default = exports.default = ThemeProvider;
32
+ var _default = ThemeProvider;
33
+ exports.default = _default;
33
34
  //# sourceMappingURL=ThemeProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.js","names":["_reactRedux","require","_styledComponents","_createTheme","_interopRequireDefault","_jsxRuntime","ThemeProvider","_ref","theme","children","storedTheme","useSelector","_ref2","preferences","finalTheme","createTheme","jsx","displayName","_default","exports","default"],"sources":["../../src/react-theme/ThemeProvider.js"],"sourcesContent":["// @flow\nimport { useSelector } from \"react-redux\";\nimport { ThemeProvider as SCThemeProvider } from \"styled-components\";\n\nimport createTheme from \"./createTheme\";\n\nimport type { Node } from \"react\";\nimport type { Theme } from \"./types\";\n\nexport type Props = {\n +theme?: Theme | Array<Theme>,\n +children: Node,\n};\n\n/**\n */\nconst ThemeProvider = ({ theme, children }: Props): Node => {\n const storedTheme = useSelector(({ preferences }) => preferences.theme);\n const finalTheme = createTheme(storedTheme, theme);\n\n return <SCThemeProvider theme={finalTheme}>{children}</SCThemeProvider>;\n};\nThemeProvider.displayName = \"BI.ThemeProvider\";\n\nexport default ThemeProvider;\n"],"mappings":";;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAwC,IAAAI,WAAA,GAAAJ,OAAA;AAUxC;AACA;AACA,MAAMK,aAAa,GAAGC,IAAA,IAAsC;EAAA,IAArC;IAAEC,KAAK;IAAEC;EAAgB,CAAC,GAAAF,IAAA;EAC/C,MAAMG,WAAW,GAAG,IAAAC,uBAAW,EAACC,KAAA;IAAA,IAAC;MAAEC;IAAY,CAAC,GAAAD,KAAA;IAAA,OAAKC,WAAW,CAACL,KAAK;EAAA,EAAC;EACvE,MAAMM,UAAU,GAAG,IAAAC,oBAAW,EAACL,WAAW,EAAEF,KAAK,CAAC;EAElD,oBAAO,IAAAH,WAAA,CAAAW,GAAA,EAACd,iBAAA,CAAAI,aAAe;IAACE,KAAK,EAAEM,UAAW;IAAAL,QAAA,EAAEA;EAAQ,CAAkB,CAAC;AACzE,CAAC;AACDH,aAAa,CAACW,WAAW,GAAG,kBAAkB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEhCd,aAAa"}
1
+ {"version":3,"file":"ThemeProvider.js","names":["_reactRedux","require","_styledComponents","_createTheme","_interopRequireDefault","_jsxRuntime","ThemeProvider","_ref","theme","children","storedTheme","useSelector","_ref2","preferences","finalTheme","createTheme","jsx","displayName","_default","exports","default"],"sources":["../../src/react-theme/ThemeProvider.js"],"sourcesContent":["// @flow\nimport { useSelector } from \"react-redux\";\nimport { ThemeProvider as SCThemeProvider } from \"styled-components\";\n\nimport createTheme from \"./createTheme\";\n\nimport type { Node } from \"react\";\nimport type { Theme } from \"./types\";\n\nexport type Props = {\n +theme?: Theme | Array<Theme>,\n +children: Node,\n};\n\n/**\n */\nconst ThemeProvider = ({ theme, children }: Props): Node => {\n const storedTheme = useSelector(({ preferences }) => preferences.theme);\n const finalTheme = createTheme(storedTheme, theme);\n\n return <SCThemeProvider theme={finalTheme}>{children}</SCThemeProvider>;\n};\nThemeProvider.displayName = \"BI.ThemeProvider\";\n\nexport default ThemeProvider;\n"],"mappings":";;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAwC,IAAAI,WAAA,GAAAJ,OAAA;AAUxC;AACA;AACA,MAAMK,aAAa,GAAGC,IAAA,IAAsC;EAAA,IAArC;IAAEC,KAAK;IAAEC;EAAgB,CAAC,GAAAF,IAAA;EAC/C,MAAMG,WAAW,GAAG,IAAAC,uBAAW,EAACC,KAAA;IAAA,IAAC;MAAEC;IAAY,CAAC,GAAAD,KAAA;IAAA,OAAKC,WAAW,CAACL,KAAK;EAAA,EAAC;EACvE,MAAMM,UAAU,GAAG,IAAAC,oBAAW,EAACL,WAAW,EAAEF,KAAK,CAAC;EAElD,oBAAO,IAAAH,WAAA,CAAAW,GAAA,EAACd,iBAAA,CAAAI,aAAe;IAACE,KAAK,EAAEM,UAAW;IAAAL,QAAA,EAAEA;EAAQ,CAAkB,CAAC;AACzE,CAAC;AACDH,aAAa,CAACW,WAAW,GAAG,kBAAkB;AAAC,IAAAC,QAAA,GAEhCZ,aAAa;AAAAa,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -102,5 +102,6 @@ const createTheme = function (storedTheme) {
102
102
  }
103
103
  return customTheme;
104
104
  };
105
- var _default = exports.default = createTheme;
105
+ var _default = createTheme;
106
+ exports.default = _default;
106
107
  //# sourceMappingURL=createTheme.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createTheme.js","names":["_flattenDeep","_interopRequireDefault","require","_objects","_Settings","replacePlaceholders","inputTheme","_context","possibleKeys","_map","default","_keys","call","key","join","re","RegExp","_entries","forEach","_ref","value","replace","match","capture","generateTheme","storedTheme","generatedTheme","settings","_len","arguments","length","themeElements","Array","_key","element","isPlainObject","createTheme","_len2","themeConfigs","_key2","customTheme","flattenDeep","setSettings","_default","exports"],"sources":["../../src/react-theme/createTheme.js"],"sourcesContent":["// @flow\nimport flattenDeep from \"lodash/flattenDeep\";\n\nimport { isPlainObject } from \"../utils/helpers/objects\";\n\nimport { setSettings } from \"../constants/Settings\";\n\nimport type { Theme } from \"./types\";\n\nconst replacePlaceholders = (inputTheme: Theme) => {\n const possibleKeys = Object.keys(inputTheme)\n .map((key) => `\\\\b${key}\\\\b`)\n .join(\"|\");\n\n const re = new RegExp(`\\\\$(${possibleKeys})`, \"g\");\n Object.entries(inputTheme).forEach(([key, value]) => {\n if (key !== \"settings\" && typeof value === \"string\") {\n inputTheme[key] = value.replace(\n re,\n // $FlowIssue[incompatible-call]\n (match, capture) => inputTheme[capture],\n );\n }\n });\n\n return inputTheme;\n};\n\nconst generateTheme = (storedTheme: Theme, ...themeElements: Array<Theme>) => {\n let generatedTheme = { settings: {} };\n for (const element of themeElements) {\n if (typeof element === \"function\") {\n generatedTheme = element(replacePlaceholders(generatedTheme));\n } else if (isPlainObject(element)) {\n // $FlowFixMe[cannot-spread-indexer]\n generatedTheme = { ...generatedTheme, ...element, ...storedTheme };\n }\n }\n\n // final - replace any assignments inside the theme\n return replacePlaceholders(generatedTheme);\n};\n\n/**\n * Create a theme from multiple theme configuration objects.\n * Properties are overwriten by iterating the configuration objects from left to right.\n *\n * The first argument represents a stored theme part, this is optional. The stored theme part will overwrite every part in the collection of theme parts.\n * Thus a stored configuration is leading as it can be configured by a modeller through the repository.\n *\n * Placeholders can be used, they are replaced before calling a function theme part or at the end of the theme creation.\n *\n * Both objects and function can be used, where a function receives the previous objects as input arguments.\n * For example using the method createTheme(ThemeObject, ThemeObject2, ThemeFunction, ThemeFunction2), will be handled as:\n *\n * ThemeFunction2(ThemeFunction1({ ...ThemeObject, ...ThemeObject2 }))\n *\n * @example\n * Example where the primary color of the default theme is overwritten with a primary color of the custom theme,\n * but the button bg still uses the yiq function of the default theme:\n *\n * const DefaultTheme = {\n * PRIMARY_COLOR: \"#0000ff\",\n * SECONDARY_COLOR: \"#00ff00\",\n * BUTTON_COLOR: \"$PRIMARY_COLOR\"\n * }\n *\n * const createDefaultTheme = (input) => ({\n * ...input,\n * BUTTON_BG: getContrastYIQ(input.BUTTON_COLOR)\n * })\n *\n * const CustomTheme = {\n * PRIMARY_COLOR: \"#ff0000\"\n * }\n *\n * createTheme(null, DefaultTheme, CustomTheme, createDefaultTheme);\n *\n * // Result:\n * {\n * PRIMARY_COLOR: \"#ff0000\",\n * BUTTON_COLOR: \"#ff0000\",\n * BUTTON_BG: \"#fff\",\n * SECONDARY_COLOR: \"#00ff00\",\n * }\n */\nconst createTheme = (\n storedTheme: Theme,\n ...themeConfigs: Array<Theme | Array<Theme> | void>\n):\n | any\n | {}\n | {\n INPUT_FOCUS_BORDER_COLOR?: string,\n LINK_HOVER_COLOR?: string,\n PAGING_HOVER_COLOR?: string,\n settings?: { [settingName: string]: string },\n } => {\n const customTheme = generateTheme(storedTheme, ...flattenDeep(themeConfigs));\n\n if (customTheme) {\n setSettings(customTheme.settings);\n }\n\n return customTheme;\n};\n\nexport default createTheme;\n"],"mappings":";;;;;;;;;;AACA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IA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AK,UAAU,EAAE;MACjCR,cAAc,GAAGQ,OAAO,CAAC7B,mBAAmB,CAACqB,cAAc,CAAC,CAAC;IAC/D,CAAC,MAAM,IAAI,IAAAS,sBAAa,EAACD,OAAO,CAAC,EAAE;MACjC;MACAR,cAAc,GAAG;QAAE,GAAGA,cAAc;QAAE,GAAGQ,OAAO;QAAE,GAAGT;MAAY,CAAC;IACpE;EACF;;EAEA;EACA,OAAOpB,mBAAmB,CAACqB,cAAc,CAAC;AAC5C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMU,WAAW,GAAG,SAAAA,CAClBX,WAAkB,EAUX;EAAA,SAAAY,KAAA,GAAAR,SAAA,CAAAC,MAAA,EATJQ,YAAY,OAAAN,KAAA,CAAAK,KAAA,OAAAA,KAAA,WAAAE,KAAA,MAAAA,KAAA,GAAAF,KAAA,EAAAE,KAAA;IAAZD,YAAY,CAAAC,KAAA,QAAAV,SAAA,CAAAU,KAAA;EAAA;EAUf,MAAMC,WAAW,GAAGhB,aAAa,CAACC,WAAW,EAAE,GAAG,IAAAgB,oBAAW,EAACH,YAAY,CAAC,CAAC;EAE5E,IAAIE,WAAW,EAAE;IACf,IAAAE,qBAAW,EAACF,WAAW,CAACb,QAAQ,CAAC;EACnC;EAEA,OAAOa,WAAW;AACpB,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAlC,OAAA,GAEa0B,WAAW"}
1
+ {"version":3,"file":"createTheme.js","names":["_flattenDeep","_interopRequireDefault","require","_objects","_Settings","replacePlaceholders","inputTheme","_context","possibleKeys","_map","default","_keys","call","key","join","re","RegExp","_entries","forEach","_ref","value","replace","match","capture","generateTheme","storedTheme","generatedTheme","settings","_len","arguments","length","themeElements","Array","_key","element","isPlainObject","createTheme","_len2","themeConfigs","_key2","customTheme","flattenDeep","setSettings","_default","exports"],"sources":["../../src/react-theme/createTheme.js"],"sourcesContent":["// @flow\nimport flattenDeep from \"lodash/flattenDeep\";\n\nimport { isPlainObject } from \"../utils/helpers/objects\";\n\nimport { setSettings } from \"../constants/Settings\";\n\nimport type { Theme } from \"./types\";\n\nconst replacePlaceholders = (inputTheme: Theme) => {\n const possibleKeys = Object.keys(inputTheme)\n .map((key) => `\\\\b${key}\\\\b`)\n .join(\"|\");\n\n const re = new RegExp(`\\\\$(${possibleKeys})`, \"g\");\n Object.entries(inputTheme).forEach(([key, value]) => {\n if (key !== \"settings\" && typeof value === \"string\") {\n inputTheme[key] = value.replace(\n re,\n // $FlowIssue[incompatible-call]\n (match, capture) => inputTheme[capture],\n );\n }\n });\n\n return inputTheme;\n};\n\nconst generateTheme = (storedTheme: Theme, ...themeElements: Array<Theme>) => {\n let generatedTheme = { settings: {} };\n for (const element of themeElements) {\n if (typeof element === \"function\") {\n generatedTheme = element(replacePlaceholders(generatedTheme));\n } else if (isPlainObject(element)) {\n // $FlowFixMe[cannot-spread-indexer]\n generatedTheme = { ...generatedTheme, ...element, ...storedTheme };\n }\n }\n\n // final - replace any assignments inside the theme\n return replacePlaceholders(generatedTheme);\n};\n\n/**\n * Create a theme from multiple theme configuration objects.\n * Properties are overwriten by iterating the configuration objects from left to right.\n *\n * The first argument represents a stored theme part, this is optional. The stored theme part will overwrite every part in the collection of theme parts.\n * Thus a stored configuration is leading as it can be configured by a modeller through the repository.\n *\n * Placeholders can be used, they are replaced before calling a function theme part or at the end of the theme creation.\n *\n * Both objects and function can be used, where a function receives the previous objects as input arguments.\n * For example using the method createTheme(ThemeObject, ThemeObject2, ThemeFunction, ThemeFunction2), will be handled as:\n *\n * ThemeFunction2(ThemeFunction1({ ...ThemeObject, ...ThemeObject2 }))\n *\n * @example\n * Example where the primary color of the default theme is overwritten with a primary color of the custom theme,\n * but the button bg still uses the yiq function of the default theme:\n *\n * const DefaultTheme = {\n * PRIMARY_COLOR: \"#0000ff\",\n * SECONDARY_COLOR: \"#00ff00\",\n * BUTTON_COLOR: \"$PRIMARY_COLOR\"\n * }\n *\n * const createDefaultTheme = (input) => ({\n * ...input,\n * BUTTON_BG: getContrastYIQ(input.BUTTON_COLOR)\n * })\n *\n * const CustomTheme = {\n * PRIMARY_COLOR: \"#ff0000\"\n * }\n *\n * createTheme(null, DefaultTheme, CustomTheme, createDefaultTheme);\n *\n * // Result:\n * {\n * PRIMARY_COLOR: \"#ff0000\",\n * BUTTON_COLOR: \"#ff0000\",\n * BUTTON_BG: \"#fff\",\n * SECONDARY_COLOR: \"#00ff00\",\n * }\n */\nconst createTheme = (\n storedTheme: Theme,\n ...themeConfigs: Array<Theme | Array<Theme> | void>\n):\n | any\n | {}\n | {\n INPUT_FOCUS_BORDER_COLOR?: string,\n LINK_HOVER_COLOR?: string,\n PAGING_HOVER_COLOR?: string,\n settings?: { [settingName: string]: string },\n } => {\n const customTheme = generateTheme(storedTheme, ...flattenDeep(themeConfigs));\n\n if (customTheme) {\n setSettings(customTheme.settings);\n }\n\n return customTheme;\n};\n\nexport default createTheme;\n"],"mappings":";;;;;;;;;;AACA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AAIA,MAAMG,mBAAmB,GAAIC,UAAiB,IAAK;EAAA,IAAAC,QAAA;EACjD,MAAMC,YAAY,GAAG,IAAAC,IAAA,CAAAC,OAAA,EAAAH,QAAA,OAAAI,KAAA,CAAAD,OAAA,EAAYJ,UAAU,CAAC,EAAAM,IAAA,CAAAL,QAAA,EACpCM,GAAG,IAAM,MAAKA,GAAI,KAAI,CAAC,CAC5BC,IAAI,CAAC,GAAG,CAAC;EAEZ,MAAMC,EAAE,GAAG,IAAIC,MAAM,CAAE,OAAMR,YAAa,GAAE,EAAE,GAAG,CA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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMU,WAAW,GAAG,SAAAA,CAClBX,WAAkB,EAUX;EAAA,SAAAY,KAAA,GAAAR,SAAA,CAAAC,MAAA,EATJQ,YAAY,OAAAN,KAAA,CAAAK,KAAA,OAAAA,KAAA,WAAAE,KAAA,MAAAA,KAAA,GAAAF,KAAA,EAAAE,KAAA;IAAZD,YAAY,CAAAC,KAAA,QAAAV,SAAA,CAAAU,KAAA;EAAA;EAUf,MAAMC,WAAW,GAAGhB,aAAa,CAACC,WAAW,EAAE,GAAG,IAAAgB,oBAAW,EAACH,YAAY,CAAC,CAAC;EAE5E,IAAIE,WAAW,EAAE;IACf,IAAAE,qBAAW,EAACF,WAAW,CAACb,QAAQ,CAAC;EACnC;EAEA,OAAOa,WAAW;AACpB,CAAC;AAAC,IAAAG,QAAA,GAEaP,WAAW;AAAAQ,OAAA,CAAAlC,OAAA,GAAAiC,QAAA"}
@@ -95,5 +95,6 @@ const modularUIConnector = function (name, resource) {
95
95
  return WrappedComponent;
96
96
  };
97
97
  };
98
- var _default = exports.default = modularUIConnector;
98
+ var _default = modularUIConnector;
99
+ exports.default = _default;
99
100
  //# sourceMappingURL=ModularUIConnector.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModularUIConnector.js","names":["_react","require","_reactRedux","_reactRouter","_ModularUIActions","_Href","_interopRequireDefault","_utils","_ModularUIUtils","_useModularUI","_useI18n","_jsxRuntime","modularUIConnector","name","resource","options","arguments","length","undefined","propName","removeOnUnmount","otherOptions","Component","WrappedComponent","props","dispatch","useDispatch","location","useLocation","url","useUrl","displayName","getDisplayName","contextId","modelEntry","useModularUI","modelKey","model","connectKey","handleManualReload","reloadOptions","reloadModel","handleFetch","href","fetchOptions","loadModularUI","reload","state","doReload","useReload","useEffect","isReload","removeModelByKey","locale","useLocale","newProps","status","lastModification","hasModel","Boolean","fetchModularUI","jsx","_default","exports","default"],"sources":["../../../src/redux/_modularui/ModularUIConnector.js"],"sourcesContent":["// @flow\nimport { useEffect } from \"react\";\nimport { useDispatch } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport {\n loadModularUI,\n reloadModel,\n removeModelByKey,\n} from \"./ModularUIActions\";\n\nimport Href from \"../../models/href/Href\";\nimport { getDisplayName } from \"../../react/utils\";\n\nimport { useUrl, useReload } from \"./ModularUIUtils\";\nimport { useModularUI } from \"../../hooks/useModularUI\";\nimport { useLocale } from \"../../hooks/useI18n\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { Location } from \"react-router\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { ModularUIOptions } from \"./types\";\n\nexport type InjectedProps = {\n +modelKey: string,\n +location: Location,\n +status: string | null,\n +lastModification: number | null,\n +hasModel: boolean,\n +locale: string,\n +fetchModularUI: (href: string | Href, fetchOptions: Object) => void,\n +reloadModel: (model: ModularUIModel, options: Object) => void,\n +data?: ?ModularUIModel,\n};\n\n/**\n */\nconst modularUIConnector = (\n name: string,\n resource: string | Function,\n options: ModularUIOptions = { propName: \"data\", removeOnUnmount: false },\n): ((Component: ComponentType<any>) => (props: any) => Node) => {\n const {\n propName = \"data\",\n removeOnUnmount = false,\n ...otherOptions\n } = options;\n\n return (Component: ComponentType<any>) => {\n const WrappedComponent = (props: any) => {\n const dispatch = useDispatch();\n const location = useLocation();\n\n const url = useUrl(resource, { location, ...props });\n const displayName = getDisplayName(Component, name, props.contextId);\n\n // Load the model through the useModUI hook\n const modelEntry = useModularUI(displayName, url, otherOptions);\n const modelKey = modelEntry?.model?.connectKey;\n\n // handle manual reload of model\n const handleManualReload = (\n model: ModularUIModel,\n reloadOptions?: Object,\n ) => {\n dispatch(reloadModel(model, reloadOptions));\n };\n\n // Provide connected models with a fetchModularUI method to be able\n // to run the loadModularUI action from a handler / callback in the component\n const handleFetch = (href: string | Href, fetchOptions: Object) => {\n dispatch(loadModularUI(modelKey, href, fetchOptions));\n };\n\n // Check if current model needs a reload\n const reload = location?.state?.reload ?? 0;\n const doReload = useReload(modelEntry, reload);\n useEffect(() => {\n if (doReload) {\n dispatch(\n loadModularUI(modelKey, url, { ...otherOptions, isReload: true }),\n );\n }\n }, [dispatch, doReload, url, modelKey]);\n\n // Remove model when hoc unloads\n useEffect(() => {\n return () => {\n if (removeOnUnmount) {\n dispatch(removeModelByKey(modelKey));\n }\n };\n }, [dispatch, modelKey]);\n\n // Create new properties object to inject modularui properties to own props\n const locale = useLocale();\n const newProps: InjectedProps = {\n modelKey,\n [propName]: modelEntry ? modelEntry.model : null,\n location,\n status: modelEntry ? modelEntry.status : null,\n lastModification: modelEntry ? modelEntry.lastModification : null,\n hasModel: Boolean(modelEntry),\n locale,\n fetchModularUI: handleFetch,\n reloadModel: handleManualReload,\n };\n\n return <Component {...props} {...newProps} />;\n };\n\n WrappedComponent.displayName = `BI.modularui(${getDisplayName(\n WrappedComponent,\n name,\n )}`;\n\n return WrappedComponent;\n };\n};\n\nexport default modularUIConnector;\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEA,IAAAG,iBAAA,GAAAH,OAAA;AAMA,IAAAI,KAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAEA,IAAAO,eAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AAAgD,IAAAU,WAAA,GAAAV,OAAA;AAmBhD;AACA;AACA,MAAMW,kBAAkB,GAAG,SAAAA,CACzBC,IAAY,EACZC,QAA2B,EAEmC;EAAA,IAD9DC,OAAyB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG;IAAEG,QAAQ,EAAE,MAAM;IAAEC,eAAe,EAAE;EA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href","_interopRequireDefault","_utils","_ModularUIUtils","_useModularUI","_useI18n","_jsxRuntime","modularUIConnector","name","resource","options","arguments","length","undefined","propName","removeOnUnmount","otherOptions","Component","WrappedComponent","props","dispatch","useDispatch","location","useLocation","url","useUrl","displayName","getDisplayName","contextId","modelEntry","useModularUI","modelKey","model","connectKey","handleManualReload","reloadOptions","reloadModel","handleFetch","href","fetchOptions","loadModularUI","reload","state","doReload","useReload","useEffect","isReload","removeModelByKey","locale","useLocale","newProps","status","lastModification","hasModel","Boolean","fetchModularUI","jsx","_default","exports","default"],"sources":["../../../src/redux/_modularui/ModularUIConnector.js"],"sourcesContent":["// @flow\nimport { useEffect } from \"react\";\nimport { useDispatch } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport {\n loadModularUI,\n reloadModel,\n removeModelByKey,\n} from \"./ModularUIActions\";\n\nimport Href from \"../../models/href/Href\";\nimport { getDisplayName } from \"../../react/utils\";\n\nimport { useUrl, useReload } from \"./ModularUIUtils\";\nimport { useModularUI } from \"../../hooks/useModularUI\";\nimport { useLocale } from \"../../hooks/useI18n\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { Location } from \"react-router\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { ModularUIOptions } from \"./types\";\n\nexport type InjectedProps = {\n +modelKey: string,\n +location: Location,\n +status: string | null,\n +lastModification: number | null,\n +hasModel: boolean,\n +locale: string,\n +fetchModularUI: (href: string | Href, fetchOptions: Object) => void,\n +reloadModel: (model: ModularUIModel, options: Object) => void,\n +data?: ?ModularUIModel,\n};\n\n/**\n */\nconst modularUIConnector = (\n name: string,\n resource: string | Function,\n options: ModularUIOptions = { propName: \"data\", removeOnUnmount: false },\n): ((Component: ComponentType<any>) => (props: any) => Node) => {\n const {\n propName = \"data\",\n removeOnUnmount = false,\n ...otherOptions\n } = options;\n\n return (Component: ComponentType<any>) => {\n const WrappedComponent = (props: any) => {\n const dispatch = useDispatch();\n const location = useLocation();\n\n const url = useUrl(resource, { location, ...props });\n const displayName = getDisplayName(Component, name, props.contextId);\n\n // Load the model through the useModUI hook\n const modelEntry = useModularUI(displayName, url, otherOptions);\n const modelKey = modelEntry?.model?.connectKey;\n\n // handle manual reload of model\n const handleManualReload = (\n model: ModularUIModel,\n reloadOptions?: Object,\n ) => {\n dispatch(reloadModel(model, reloadOptions));\n };\n\n // Provide connected models with a fetchModularUI method to be able\n // to run the loadModularUI action from a handler / callback in the component\n const handleFetch = (href: string | Href, fetchOptions: Object) => {\n dispatch(loadModularUI(modelKey, href, fetchOptions));\n };\n\n // Check if current model needs a reload\n const reload = location?.state?.reload ?? 0;\n const doReload = useReload(modelEntry, reload);\n useEffect(() => {\n if (doReload) {\n dispatch(\n loadModularUI(modelKey, url, { ...otherOptions, isReload: true }),\n );\n }\n }, [dispatch, doReload, url, modelKey]);\n\n // Remove model when hoc unloads\n useEffect(() => {\n return () => {\n if (removeOnUnmount) {\n dispatch(removeModelByKey(modelKey));\n }\n };\n }, [dispatch, modelKey]);\n\n // Create new properties object to inject modularui properties to own props\n const locale = useLocale();\n const newProps: InjectedProps = {\n modelKey,\n [propName]: modelEntry ? modelEntry.model : null,\n location,\n status: modelEntry ? modelEntry.status : null,\n lastModification: modelEntry ? modelEntry.lastModification : null,\n hasModel: Boolean(modelEntry),\n locale,\n fetchModularUI: handleFetch,\n reloadModel: handleManualReload,\n };\n\n return <Component {...props} {...newProps} />;\n };\n\n WrappedComponent.displayName = `BI.modularui(${getDisplayName(\n WrappedComponent,\n name,\n )}`;\n\n return WrappedComponent;\n };\n};\n\nexport default modularUIConnector;\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEA,IAAAG,iBAAA,GAAAH,OAAA;AAMA,IAAAI,KAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAEA,IAAAO,eAAA,GAAAP,OAAA;A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GAAM+B;MAAQ,CAAG,CAAC;IAC/C,CAAC;IAEDhC,gBAAgB,CAACQ,WAAW,GAAI,gBAAe,IAAAC,qBAAc,EAC3DT,gBAAgB,EAChBV,IACF,CAAE,EAAC;IAEH,OAAOU,gBAAgB;EACzB,CAAC;AACH,CAAC;AAAC,IAAAuC,QAAA,GAEalD,kBAAkB;AAAAmD,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -203,7 +203,7 @@ const getModels = state => {
203
203
  });
204
204
  return models;
205
205
  };
206
- const getActiveModels = exports.getActiveModels = (0, _reselect.createSelectorCreator)(_reselect.defaultMemoize, (value, other) => (0, _stringify.default)(value) === (0, _stringify.default)(other))([getLocation, getModels], (location, models) => {
206
+ const getActiveModels = (0, _reselect.createSelectorCreator)(_reselect.defaultMemoize, (value, other) => (0, _stringify.default)(value) === (0, _stringify.default)(other))([getLocation, getModels], (location, models) => {
207
207
  const contextModels = [];
208
208
  if (location) {
209
209
  const locationParts = location.split("/");
@@ -237,6 +237,7 @@ const getActiveModels = exports.getActiveModels = (0, _reselect.createSelectorCr
237
237
 
238
238
  /**
239
239
  */
240
+ exports.getActiveModels = getActiveModels;
240
241
  const getPreference = (state, preferenceName) => {
241
242
  if (state && state.preferences) {
242
243
  return state.preferences[preferenceName];