@beinformed/ui 1.65.24 → 1.65.26

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 (226) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/esm/builder/mergeLayoutHintConfigurations.js +7 -5
  3. package/esm/builder/mergeLayoutHintConfigurations.js.flow +12 -5
  4. package/esm/builder/mergeLayoutHintConfigurations.js.map +1 -1
  5. package/esm/constants/Settings.js +4 -1
  6. package/esm/constants/Settings.js.flow +3 -3
  7. package/esm/constants/Settings.js.map +1 -1
  8. package/esm/hooks/useAuthentication.js +7 -3
  9. package/esm/hooks/useAuthentication.js.flow +6 -3
  10. package/esm/hooks/useAuthentication.js.map +1 -1
  11. package/esm/hooks/useModelCatalog.js +1 -1
  12. package/esm/hooks/useModelCatalog.js.flow +1 -1
  13. package/esm/hooks/useModelCatalog.js.map +1 -1
  14. package/esm/i18n/Locale.js +7 -1
  15. package/esm/i18n/Locale.js.flow +4 -2
  16. package/esm/i18n/Locale.js.map +1 -1
  17. package/esm/models/actions/ActionCollection.js +1 -1
  18. package/esm/models/actions/ActionCollection.js.flow +3 -3
  19. package/esm/models/actions/ActionCollection.js.map +1 -1
  20. package/esm/models/application/ApplicationModel.js +6 -1
  21. package/esm/models/application/ApplicationModel.js.flow +7 -2
  22. package/esm/models/application/ApplicationModel.js.map +1 -1
  23. package/esm/models/attributes/ChoiceAttributeModel.js +3 -5
  24. package/esm/models/attributes/ChoiceAttributeModel.js.flow +3 -5
  25. package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
  26. package/esm/models/attributes/CompositeAttributeModel.js +1 -1
  27. package/esm/models/attributes/CompositeAttributeModel.js.flow +1 -1
  28. package/esm/models/attributes/CompositeAttributeModel.js.map +1 -1
  29. package/esm/models/attributes/NumberAttributeModel.js +3 -1
  30. package/esm/models/attributes/NumberAttributeModel.js.flow +2 -1
  31. package/esm/models/attributes/NumberAttributeModel.js.map +1 -1
  32. package/esm/models/attributes/StringAttributeModel.js +9 -4
  33. package/esm/models/attributes/StringAttributeModel.js.flow +7 -4
  34. package/esm/models/attributes/StringAttributeModel.js.map +1 -1
  35. package/esm/models/attributes/input-constraints/DatetimeFormatConstraint.js +1 -1
  36. package/esm/models/attributes/input-constraints/DatetimeFormatConstraint.js.flow +1 -1
  37. package/esm/models/attributes/input-constraints/DatetimeFormatConstraint.js.map +1 -1
  38. package/esm/models/base/BaseModel.js +8 -5
  39. package/esm/models/base/BaseModel.js.flow +8 -5
  40. package/esm/models/base/BaseModel.js.map +1 -1
  41. package/esm/models/base/ResourceModel.js +6 -7
  42. package/esm/models/base/ResourceModel.js.flow +4 -4
  43. package/esm/models/base/ResourceModel.js.map +1 -1
  44. package/esm/models/concepts/ConceptDetailModel.js +16 -16
  45. package/esm/models/concepts/ConceptDetailModel.js.flow +16 -19
  46. package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
  47. package/esm/models/concepts/SourceReferenceCollection.js +1 -1
  48. package/esm/models/concepts/SourceReferenceCollection.js.flow +1 -2
  49. package/esm/models/concepts/SourceReferenceCollection.js.map +1 -1
  50. package/esm/models/content/ContentLinkModel.js +6 -6
  51. package/esm/models/content/ContentLinkModel.js.flow +6 -6
  52. package/esm/models/content/ContentLinkModel.js.map +1 -1
  53. package/esm/models/filters/BaseFilterModel.js +3 -5
  54. package/esm/models/filters/BaseFilterModel.js.flow +4 -5
  55. package/esm/models/filters/BaseFilterModel.js.map +1 -1
  56. package/esm/models/filters/StringFilterModel.js +4 -2
  57. package/esm/models/filters/StringFilterModel.js.flow +3 -2
  58. package/esm/models/filters/StringFilterModel.js.map +1 -1
  59. package/esm/models/form/FormModel.js +1 -1
  60. package/esm/models/form/FormModel.js.flow +1 -2
  61. package/esm/models/form/FormModel.js.map +1 -1
  62. package/esm/models/form/FormObjectModel.js +1 -1
  63. package/esm/models/form/FormObjectModel.js.flow +2 -3
  64. package/esm/models/form/FormObjectModel.js.map +1 -1
  65. package/esm/models/href/Href.js +2 -2
  66. package/esm/models/href/Href.js.flow +2 -2
  67. package/esm/models/href/Href.js.map +1 -1
  68. package/esm/models/index.js +2 -2
  69. package/esm/models/index.js.flow +1 -2
  70. package/esm/models/index.js.map +1 -1
  71. package/esm/models/links/normalizeLinkJSON.js +1 -1
  72. package/esm/models/links/normalizeLinkJSON.js.flow +1 -1
  73. package/esm/models/links/normalizeLinkJSON.js.map +1 -1
  74. package/esm/modularui/Authenticate.js +7 -2
  75. package/esm/modularui/Authenticate.js.flow +4 -2
  76. package/esm/modularui/Authenticate.js.map +1 -1
  77. package/esm/modularui/ModularUIRequest.js +2 -5
  78. package/esm/modularui/ModularUIRequest.js.flow +2 -6
  79. package/esm/modularui/ModularUIRequest.js.map +1 -1
  80. package/esm/modularui/UploadRequest.js +3 -1
  81. package/esm/modularui/UploadRequest.js.flow +3 -1
  82. package/esm/modularui/UploadRequest.js.map +1 -1
  83. package/esm/react-client/client.js +22 -10
  84. package/esm/react-client/client.js.flow +17 -11
  85. package/esm/react-client/client.js.map +1 -1
  86. package/esm/react-client/contextPath.js +3 -1
  87. package/esm/react-client/contextPath.js.flow +2 -1
  88. package/esm/react-client/contextPath.js.map +1 -1
  89. package/esm/redux/_i18n/I18nReducer.js +1 -4
  90. package/esm/redux/_i18n/I18nReducer.js.flow +1 -4
  91. package/esm/redux/_i18n/I18nReducer.js.map +1 -1
  92. package/esm/redux/_modularui/ModularUIActions.js +1 -4
  93. package/esm/redux/_modularui/ModularUIActions.js.flow +1 -5
  94. package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
  95. package/esm/redux/_modularui/ModularUIConnector.js +3 -4
  96. package/esm/redux/_modularui/ModularUIConnector.js.flow +2 -1
  97. package/esm/redux/_modularui/ModularUIConnector.js.map +1 -1
  98. package/esm/redux/_modularui/ModularUIReducer.js +6 -3
  99. package/esm/redux/_modularui/ModularUIReducer.js.flow +2 -2
  100. package/esm/redux/_modularui/ModularUIReducer.js.map +1 -1
  101. package/esm/redux/actions/Authorization.js +4 -2
  102. package/esm/redux/actions/Authorization.js.flow +3 -2
  103. package/esm/redux/actions/Authorization.js.map +1 -1
  104. package/esm/redux/actions/Preferences.js +4 -4
  105. package/esm/redux/actions/Preferences.js.flow +6 -10
  106. package/esm/redux/actions/Preferences.js.map +1 -1
  107. package/esm/redux/reducers/ModelCatalogReducer.js +7 -9
  108. package/esm/redux/reducers/ModelCatalogReducer.js.flow +8 -9
  109. package/esm/redux/reducers/ModelCatalogReducer.js.map +1 -1
  110. package/esm/redux/store/configureStore.js +6 -1
  111. package/esm/redux/store/configureStore.js.flow +4 -1
  112. package/esm/redux/store/configureStore.js.map +1 -1
  113. package/esm/redux/types.js.flow +10 -1
  114. package/esm/redux/types.js.map +1 -1
  115. package/esm/utils/browser/Cache.js +3 -1
  116. package/esm/utils/browser/Cache.js.flow +2 -1
  117. package/esm/utils/browser/Cache.js.map +1 -1
  118. package/esm/utils/browser/__tests__/Cookies.spec.js.flow +2 -1
  119. package/esm/utils/datetime/DateTimeUtil.js +6 -5
  120. package/esm/utils/datetime/DateTimeUtil.js.flow +5 -11
  121. package/esm/utils/datetime/DateTimeUtil.js.map +1 -1
  122. package/esm/utils/datetime/__tests__/DateTimeFormat.spec.js.flow +0 -6
  123. package/esm/utils/fetch/universalFetch.js +7 -8
  124. package/esm/utils/fetch/universalFetch.js.flow +13 -14
  125. package/esm/utils/fetch/universalFetch.js.map +1 -1
  126. package/esm/utils/fetch/xhr.js +2 -5
  127. package/esm/utils/fetch/xhr.js.flow +2 -6
  128. package/esm/utils/fetch/xhr.js.map +1 -1
  129. package/esm/utils/helpers/createHref.js +4 -1
  130. package/esm/utils/helpers/createHref.js.flow +2 -1
  131. package/esm/utils/helpers/createHref.js.map +1 -1
  132. package/esm/utils/helpers/createUUID.js +2 -1
  133. package/esm/utils/helpers/createUUID.js.flow +1 -1
  134. package/esm/utils/helpers/createUUID.js.map +1 -1
  135. package/esm/utils/number/parseNumbers.js +6 -3
  136. package/esm/utils/number/parseNumbers.js.flow +4 -3
  137. package/esm/utils/number/parseNumbers.js.map +1 -1
  138. package/lib/builder/mergeLayoutHintConfigurations.js +7 -5
  139. package/lib/builder/mergeLayoutHintConfigurations.js.map +1 -1
  140. package/lib/constants/Settings.js +4 -1
  141. package/lib/constants/Settings.js.map +1 -1
  142. package/lib/hooks/useAuthentication.js +7 -3
  143. package/lib/hooks/useAuthentication.js.map +1 -1
  144. package/lib/hooks/useModelCatalog.js +1 -1
  145. package/lib/hooks/useModelCatalog.js.map +1 -1
  146. package/lib/i18n/Locale.js +7 -1
  147. package/lib/i18n/Locale.js.map +1 -1
  148. package/lib/models/actions/ActionCollection.js +1 -1
  149. package/lib/models/actions/ActionCollection.js.map +1 -1
  150. package/lib/models/application/ApplicationModel.js +6 -1
  151. package/lib/models/application/ApplicationModel.js.map +1 -1
  152. package/lib/models/attributes/ChoiceAttributeModel.js +3 -5
  153. package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
  154. package/lib/models/attributes/CompositeAttributeModel.js +1 -1
  155. package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
  156. package/lib/models/attributes/NumberAttributeModel.js +3 -1
  157. package/lib/models/attributes/NumberAttributeModel.js.map +1 -1
  158. package/lib/models/attributes/StringAttributeModel.js +9 -4
  159. package/lib/models/attributes/StringAttributeModel.js.map +1 -1
  160. package/lib/models/attributes/input-constraints/DatetimeFormatConstraint.js +1 -1
  161. package/lib/models/attributes/input-constraints/DatetimeFormatConstraint.js.map +1 -1
  162. package/lib/models/base/BaseModel.js +8 -5
  163. package/lib/models/base/BaseModel.js.map +1 -1
  164. package/lib/models/base/ResourceModel.js +6 -7
  165. package/lib/models/base/ResourceModel.js.map +1 -1
  166. package/lib/models/concepts/ConceptDetailModel.js +16 -16
  167. package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
  168. package/lib/models/concepts/SourceReferenceCollection.js +1 -1
  169. package/lib/models/concepts/SourceReferenceCollection.js.map +1 -1
  170. package/lib/models/content/ContentLinkModel.js +6 -6
  171. package/lib/models/content/ContentLinkModel.js.map +1 -1
  172. package/lib/models/filters/BaseFilterModel.js +3 -5
  173. package/lib/models/filters/BaseFilterModel.js.map +1 -1
  174. package/lib/models/filters/StringFilterModel.js +4 -2
  175. package/lib/models/filters/StringFilterModel.js.map +1 -1
  176. package/lib/models/form/FormModel.js +1 -1
  177. package/lib/models/form/FormModel.js.map +1 -1
  178. package/lib/models/form/FormObjectModel.js +1 -1
  179. package/lib/models/form/FormObjectModel.js.map +1 -1
  180. package/lib/models/href/Href.js +2 -2
  181. package/lib/models/href/Href.js.map +1 -1
  182. package/lib/models/index.js.map +1 -1
  183. package/lib/models/links/normalizeLinkJSON.js +1 -1
  184. package/lib/models/links/normalizeLinkJSON.js.map +1 -1
  185. package/lib/modularui/Authenticate.js +7 -2
  186. package/lib/modularui/Authenticate.js.map +1 -1
  187. package/lib/modularui/ModularUIRequest.js +2 -5
  188. package/lib/modularui/ModularUIRequest.js.map +1 -1
  189. package/lib/modularui/UploadRequest.js +3 -1
  190. package/lib/modularui/UploadRequest.js.map +1 -1
  191. package/lib/react-client/client.js +22 -10
  192. package/lib/react-client/client.js.map +1 -1
  193. package/lib/react-client/contextPath.js +4 -1
  194. package/lib/react-client/contextPath.js.map +1 -1
  195. package/lib/redux/_i18n/I18nReducer.js +1 -4
  196. package/lib/redux/_i18n/I18nReducer.js.map +1 -1
  197. package/lib/redux/_modularui/ModularUIActions.js +1 -4
  198. package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
  199. package/lib/redux/_modularui/ModularUIConnector.js +3 -4
  200. package/lib/redux/_modularui/ModularUIConnector.js.map +1 -1
  201. package/lib/redux/_modularui/ModularUIReducer.js +6 -3
  202. package/lib/redux/_modularui/ModularUIReducer.js.map +1 -1
  203. package/lib/redux/actions/Authorization.js +4 -2
  204. package/lib/redux/actions/Authorization.js.map +1 -1
  205. package/lib/redux/actions/Preferences.js +4 -4
  206. package/lib/redux/actions/Preferences.js.map +1 -1
  207. package/lib/redux/reducers/ModelCatalogReducer.js +7 -9
  208. package/lib/redux/reducers/ModelCatalogReducer.js.map +1 -1
  209. package/lib/redux/store/configureStore.js +6 -1
  210. package/lib/redux/store/configureStore.js.map +1 -1
  211. package/lib/redux/types.js.map +1 -1
  212. package/lib/utils/browser/Cache.js +3 -1
  213. package/lib/utils/browser/Cache.js.map +1 -1
  214. package/lib/utils/datetime/DateTimeUtil.js +6 -5
  215. package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
  216. package/lib/utils/fetch/universalFetch.js +7 -8
  217. package/lib/utils/fetch/universalFetch.js.map +1 -1
  218. package/lib/utils/fetch/xhr.js +2 -5
  219. package/lib/utils/fetch/xhr.js.map +1 -1
  220. package/lib/utils/helpers/createHref.js +4 -1
  221. package/lib/utils/helpers/createHref.js.map +1 -1
  222. package/lib/utils/helpers/createUUID.js +3 -1
  223. package/lib/utils/helpers/createUUID.js.map +1 -1
  224. package/lib/utils/number/parseNumbers.js +6 -3
  225. package/lib/utils/number/parseNumbers.js.map +1 -1
  226. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ModularUIActions.js","names":["_Constants","require","_Href","_interopRequireDefault","_ErrorResponse","_ProgressIndicator","_Error","setModel","key","model","connectKey","type","payload","exports","initModels","models","updateModel","updateForm","removeModelByKey","resetModularUI","updateStatus","status","requestOptions","loadModelSuccessAction","updateHandler","getRequestLocale","optionLocale","navigator","language","split","loadModel","href","options","origin","contextPath","Href","method","HTTP_METHODS","GET","params","data","timeout","headers","events","onProgress","locale","childmodels","targetModel","forceTargetModel","cache","isReload","withCredentials","successAction","errorAction","error","errorResponse","ErrorResponse","isChangePassword","isResourceNotFoundAfterReload","MODULARUI_STATUS","ERROR","loadModularUI","retryCount","retryDelay","dispatch","getState","modularuiStore","modularui","currentRequest","isLoading","LOADING","isDifferentRequest","toString","_promise","default","resolve","setTimeout","startProgress","loadModelPromise","then","finishProgress","catch","handleError","reloadModel","selfhref"],"sources":["../../../src/redux/_modularui/ModularUIActions.js"],"sourcesContent":["// @flow\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\nimport { finishProgress, startProgress } from \"../actions/ProgressIndicator\";\nimport { handleError } from \"../actions/Error\";\n\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { Dispatch, ThunkAction } from \"../types\";\nimport type {\n ModularUIAction,\n SetModelAction,\n InitModelAction,\n UpdateModelAction,\n UpdateFormAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n UpdateStatusAction,\n} from \"./types\";\nimport type {\n RequestModularUIOptions,\n UpdateHandler,\n} from \"../../utils/fetch/types\";\n\n/**\n */\nexport const setModel = (\n key: string,\n model: ModularUIModel,\n): SetModelAction => {\n // set key on model for later reference\n model.connectKey = key;\n return {\n type: \"MODULARUI/SET\",\n payload: {\n key,\n model,\n },\n };\n};\n\n/**\n */\nexport const initModels = (\n models: Array<{ key: string, model: ModularUIModel }>,\n): InitModelAction => ({\n type: \"MODULARUI/INIT\",\n payload: models,\n});\n\n/**\n */\nexport const updateModel = (model: ModularUIModel): UpdateModelAction => ({\n type: \"MODULARUI/UPDATE\",\n payload: model,\n});\n\n/**\n */\nexport const updateForm = (model: ModularUIModel): UpdateFormAction => ({\n type: \"MODULARUI/UPDATE_FORM\",\n payload: model,\n});\n\n/**\n */\nexport const removeModelByKey = (key: string): RemoveModelByKeyAction => ({\n type: \"MODULARUI/REMOVE_KEY\",\n payload: key,\n});\n\n/**\n * Removes all models except the application model from the modular ui reducer\n */\nexport const resetModularUI = (): ResetModularUIAction => ({\n type: \"MODULARUI/RESET\",\n});\n\n/**\n */\nexport const updateStatus = (\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>,\n requestOptions: any,\n): UpdateStatusAction => ({\n type: \"MODULARUI/STATUS\",\n payload: { key, status, requestOptions },\n});\n\n/**\n */\nconst loadModelSuccessAction = (\n key: string,\n model: ModularUIModel,\n updateHandler: UpdateHandler | void,\n): UpdateModelAction | SetModelAction => {\n if (updateHandler) {\n return updateModel(updateHandler(model));\n }\n return setModel(key, model);\n};\n\n/**\n * Retrieve the preferred language for this request, falls back to the browser language or english\n */\nconst getRequestLocale = (optionLocale: ?string): string => {\n if (optionLocale) {\n return optionLocale;\n }\n\n if (typeof navigator !== \"undefined\" && navigator?.language) {\n return navigator.language.split(\"-\")[0] || \"en\";\n }\n\n return \"en\";\n};\n\n/**\n * This action is handled by the modularui middleware\n */\nexport const loadModel = (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions,\n): ModularUIAction => ({\n type: \"MODULARUI/FETCH\",\n payload: {\n key,\n origin: options?.origin,\n contextPath: options?.contextPath,\n href:\n href instanceof Href\n ? href\n : new Href(href, \"\", {\n origin: options?.origin,\n contextPath: options?.contextPath,\n }),\n method: options?.method ?? HTTP_METHODS.GET,\n params: options?.params,\n data: options?.data,\n timeout: options?.timeout,\n headers: options?.headers,\n events: options?.events,\n onProgress: options?.onProgress,\n locale: getRequestLocale(options?.locale),\n childmodels: options?.childmodels,\n targetModel: options?.targetModel,\n forceTargetModel: options?.forceTargetModel,\n cache: options?.cache,\n isReload: options?.isReload,\n withCredentials: options?.withCredentials,\n /**\n */\n successAction: (model) =>\n loadModelSuccessAction(key, model, options?.updateHandler),\n /**\n */\n errorAction: (error) => {\n const errorResponse = new ErrorResponse(error, key, {\n origin: options?.origin,\n contextPath: options?.contextPath,\n });\n if (\n errorResponse.isChangePassword ||\n errorResponse.isResourceNotFoundAfterReload\n ) {\n return removeModelByKey(key);\n }\n return updateStatus(key, MODULARUI_STATUS.ERROR);\n },\n },\n});\n\n/**\n */\nexport const loadModularUI =\n (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions,\n retryCount: number = 3,\n retryDelay: number = 200,\n ): ThunkAction<> =>\n (dispatch: Dispatch, getState) => {\n const modularuiStore = getState()?.modularui;\n const currentRequest = modularuiStore?.[key];\n\n const isLoading = currentRequest?.status === MODULARUI_STATUS.LOADING;\n\n if (isLoading) {\n const isDifferentRequest =\n currentRequest.requestOptions?.href?.toString() !== href.toString();\n if (isDifferentRequest && retryCount > 0) {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(\n dispatch(\n loadModularUI(key, href, options, retryCount - 1, retryDelay),\n ),\n );\n }, retryDelay);\n });\n }\n\n // Same request is already loading — do nothing\n return Promise.resolve();\n }\n\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then(() => dispatch(finishProgress()))\n .catch((error) => dispatch(handleError(error)));\n };\n\n/**\n */\nexport const reloadModel = (\n model: ModularUIModel,\n options?: RequestModularUIOptions,\n): ThunkAction<> =>\n loadModularUI(model.connectKey, model.selfhref, {\n ...options,\n isReload: true,\n });\n"],"mappings":";;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAmBA;AACA;AACO,MAAMM,QAAQ,GAAGA,CACtBC,GAAW,EACXC,KAAqB,KACF;EACnB;EACAA,KAAK,CAACC,UAAU,GAAGF,GAAG;EACtB,OAAO;IACLG,IAAI,EAAE,eAAe;IACrBC,OAAO,EAAE;MACPJ,GAAG;MACHC;IACF;EACF,CAAC;AACH,CAAC;;AAED;AACA;AADAI,OAAA,CAAAN,QAAA,GAAAA,QAAA;AAEO,MAAMO,UAAU,GACrBC,MAAqD,KAChC;EACrBJ,IAAI,EAAE,gBAAgB;EACtBC,OAAO,EAAEG;AACX,CAAC,CAAC;;AAEF;AACA;AADAF,OAAA,CAAAC,UAAA,GAAAA,UAAA;AAEO,MAAME,WAAW,GAAIP,KAAqB,KAAyB;EACxEE,IAAI,EAAE,kBAAkB;EACxBC,OAAO,EAAEH;AACX,CAAC,CAAC;;AAEF;AACA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AC;MAChB,CAAC,CAAC;IACJ;;IAEA;IACA,OAAOU,QAAA,CAAAC,OAAA,CAAQC,OAAO,CAAC,CAAC;EAC1B;EAEAX,QAAQ,CAAC,IAAAa,gCAAa,EAAC,CAAC,CAAC;EAEzB,MAAMC,gBAAgB,GAAGd,QAAQ,CAAClC,SAAS,CAACtB,GAAG,EAAEuB,IAAI,EAAEC,OAAO,CAAC,CAAC;EAEhE,OAAOyC,QAAA,CAAAC,OAAA,CAAQC,OAAO,CAACG,gBAAgB,CAAC,CACrCC,IAAI,CAAC,MAAMf,QAAQ,CAAC,IAAAgB,iCAAc,EAAC,CAAC,CAAC,CAAC,CACtCC,KAAK,CAAE3B,KAAK,IAAKU,QAAQ,CAAC,IAAAkB,kBAAW,EAAC5B,KAAK,CAAC,CAAC,CAAC;AACnD,CAAC;;AAEH;AACA;AADAzC,OAAA,CAAAgD,aAAA,GAAAA,aAAA;AAEO,MAAMsB,WAAW,GAAGA,CACzB1E,KAAqB,EACrBuB,OAAiC,KAEjC6B,aAAa,CAACpD,KAAK,CAACC,UAAU,EAAED,KAAK,CAAC2E,QAAQ,EAAE;EAC9C,GAAGpD,OAAO;EACVkB,QAAQ,EAAE;AACZ,CAAC,CAAC;AAACrC,OAAA,CAAAsE,WAAA,GAAAA,WAAA","ignoreList":[]}
1
+ {"version":3,"file":"ModularUIActions.js","names":["_Constants","require","_Href","_interopRequireDefault","_ErrorResponse","_ProgressIndicator","_Error","setModel","key","model","connectKey","type","payload","exports","initModels","models","updateModel","updateForm","removeModelByKey","resetModularUI","updateStatus","status","requestOptions","loadModelSuccessAction","updateHandler","getRequestLocale","optionLocale","navigator","language","split","loadModel","href","options","origin","contextPath","Href","method","HTTP_METHODS","GET","params","data","timeout","headers","events","onProgress","locale","childmodels","targetModel","forceTargetModel","cache","isReload","withCredentials","successAction","errorAction","error","errorResponse","ErrorResponse","isChangePassword","isResourceNotFoundAfterReload","MODULARUI_STATUS","ERROR","loadModularUI","retryCount","retryDelay","dispatch","getState","modularuiStore","modularui","currentRequest","isLoading","LOADING","isDifferentRequest","toString","_promise","default","resolve","setTimeout","startProgress","loadModelPromise","then","finishProgress","catch","handleError","reloadModel","selfhref"],"sources":["../../../src/redux/_modularui/ModularUIActions.js"],"sourcesContent":["// @flow\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\nimport { finishProgress, startProgress } from \"../actions/ProgressIndicator\";\nimport { handleError } from \"../actions/Error\";\n\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { Dispatch, ThunkAction } from \"../types\";\nimport type {\n ModularUIAction,\n SetModelAction,\n InitModelAction,\n UpdateModelAction,\n UpdateFormAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n UpdateStatusAction,\n} from \"./types\";\nimport type {\n RequestModularUIOptions,\n UpdateHandler,\n} from \"../../utils/fetch/types\";\n\n/**\n */\nexport const setModel = (\n key: string,\n model: ModularUIModel,\n): SetModelAction => {\n // set key on model for later reference\n model.connectKey = key;\n return {\n type: \"MODULARUI/SET\",\n payload: {\n key,\n model,\n },\n };\n};\n\n/**\n */\nexport const initModels = (\n models: Array<{ key: string, model: ModularUIModel }>,\n): InitModelAction => ({\n type: \"MODULARUI/INIT\",\n payload: models,\n});\n\n/**\n */\nexport const updateModel = (model: ModularUIModel): UpdateModelAction => ({\n type: \"MODULARUI/UPDATE\",\n payload: model,\n});\n\n/**\n */\nexport const updateForm = (model: ModularUIModel): UpdateFormAction => ({\n type: \"MODULARUI/UPDATE_FORM\",\n payload: model,\n});\n\n/**\n */\nexport const removeModelByKey = (key: string): RemoveModelByKeyAction => ({\n type: \"MODULARUI/REMOVE_KEY\",\n payload: key,\n});\n\n/**\n * Removes all models except the application model from the modular ui reducer\n */\nexport const resetModularUI = (): ResetModularUIAction => ({\n type: \"MODULARUI/RESET\",\n});\n\n/**\n */\nexport const updateStatus = (\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>,\n requestOptions: any,\n): UpdateStatusAction => ({\n type: \"MODULARUI/STATUS\",\n payload: { key, status, requestOptions },\n});\n\n/**\n */\nconst loadModelSuccessAction = (\n key: string,\n model: ModularUIModel,\n updateHandler: UpdateHandler | void,\n): UpdateModelAction | SetModelAction => {\n if (updateHandler) {\n return updateModel(updateHandler(model));\n }\n return setModel(key, model);\n};\n\n/**\n * Retrieve the preferred language for this request, falls back to the browser language or english\n */\nconst getRequestLocale = (optionLocale: ?string): string => {\n if (optionLocale) {\n return optionLocale;\n }\n\n return navigator?.language?.split(\"-\")[0] || \"en\";\n};\n\n/**\n * This action is handled by the modularui middleware\n */\nexport const loadModel = (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions,\n): ModularUIAction => ({\n type: \"MODULARUI/FETCH\",\n payload: {\n key,\n origin: options?.origin,\n contextPath: options?.contextPath,\n href:\n href instanceof Href\n ? href\n : new Href(href, \"\", {\n origin: options?.origin,\n contextPath: options?.contextPath,\n }),\n method: options?.method ?? HTTP_METHODS.GET,\n params: options?.params,\n data: options?.data,\n timeout: options?.timeout,\n headers: options?.headers,\n events: options?.events,\n onProgress: options?.onProgress,\n locale: getRequestLocale(options?.locale),\n childmodels: options?.childmodels,\n targetModel: options?.targetModel,\n forceTargetModel: options?.forceTargetModel,\n cache: options?.cache,\n isReload: options?.isReload,\n withCredentials: options?.withCredentials,\n /**\n */\n successAction: (model) =>\n loadModelSuccessAction(key, model, options?.updateHandler),\n /**\n */\n errorAction: (error) => {\n const errorResponse = new ErrorResponse(error, key, {\n origin: options?.origin,\n contextPath: options?.contextPath,\n });\n if (\n errorResponse.isChangePassword ||\n errorResponse.isResourceNotFoundAfterReload\n ) {\n return removeModelByKey(key);\n }\n return updateStatus(key, MODULARUI_STATUS.ERROR);\n },\n },\n});\n\n/**\n */\nexport const loadModularUI =\n (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions,\n retryCount: number = 3,\n retryDelay: number = 200,\n ): ThunkAction<> =>\n (dispatch: Dispatch, getState) => {\n const modularuiStore = getState()?.modularui;\n const currentRequest = modularuiStore?.[key];\n\n const isLoading = currentRequest?.status === MODULARUI_STATUS.LOADING;\n\n if (isLoading) {\n const isDifferentRequest =\n currentRequest.requestOptions?.href?.toString() !== href.toString();\n if (isDifferentRequest && retryCount > 0) {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(\n dispatch(\n loadModularUI(key, href, options, retryCount - 1, retryDelay),\n ),\n );\n }, retryDelay);\n });\n }\n\n // Same request is already loading — do nothing\n return Promise.resolve();\n }\n\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then(() => dispatch(finishProgress()))\n .catch((error) => dispatch(handleError(error)));\n };\n\n/**\n */\nexport const reloadModel = (\n model: ModularUIModel,\n options?: RequestModularUIOptions,\n): ThunkAction<> =>\n loadModularUI(model.connectKey, model.selfhref, {\n ...options,\n isReload: true,\n });\n"],"mappings":";;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAmBA;AACA;AACO,MAAMM,QAAQ,GAAGA,CACtBC,GAAW,EACXC,KAAqB,KACF;EACnB;EACAA,KAAK,CAACC,UAAU,GAAGF,GAAG;EACtB,OAAO;IACLG,IAAI,EAAE,eAAe;IACrBC,OAAO,EAAE;MACPJ,GAAG;MACHC;IACF;EACF,CAAC;AACH,CAAC;;AAED;AACA;AADAI,OAAA,CAAAN,QAAA,GAAAA,QAAA;AAEO,MAAMO,UAAU,GACrBC,MAAqD,KAChC;EACrBJ,IAAI,EAAE,gBAAgB;EACtBC,OAAO,EAAEG;AACX,CAAC,CAAC;;AAEF;AACA;AADAF,OAAA,CAAAC,UAAA,GAAAA,UAAA;AAEO,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,EAAEA,UAAU,CAAC;MAChB,CAAC,CAAC;IACJ;;IAEA;IACA,OAAOU,QAAA,CAAAC,OAAA,CAAQC,OAAO,CAAC,CAAC;EAC1B;EAEAX,QAAQ,CAAC,IAAAa,gCAAa,EAAC,CAAC,CAAC;EAEzB,MAAMC,gBAAgB,GAAGd,QAAQ,CAAClC,SAAS,CAACtB,GAAG,EAAEuB,IAAI,EAAEC,OAAO,CAAC,CAAC;EAEhE,OAAOyC,QAAA,CAAAC,OAAA,CAAQC,OAAO,CAACG,gBAAgB,CAAC,CACrCC,IAAI,CAAC,MAAMf,QAAQ,CAAC,IAAAgB,iCAAc,EAAC,CAAC,CAAC,CAAC,CACtCC,KAAK,CAAE3B,KAAK,IAAKU,QAAQ,CAAC,IAAAkB,kBAAW,EAAC5B,KAAK,CAAC,CAAC,CAAC;AACnD,CAAC;;AAEH;AACA;AADAzC,OAAA,CAAAgD,aAAA,GAAAA,aAAA;AAEO,MAAMsB,WAAW,GAAGA,CACzB1E,KAAqB,EACrBuB,OAAiC,KAEjC6B,aAAa,CAACpD,KAAK,CAACC,UAAU,EAAED,KAAK,CAAC2E,QAAQ,EAAE;EAC9C,GAAGpD,OAAO;EACVkB,QAAQ,EAAE;AACZ,CAAC,CAAC;AAACrC,OAAA,CAAAsE,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -37,10 +37,9 @@ const patchUpdateModelOption = oldOptions => {
37
37
  /**
38
38
  * @deprecated - will be removed in the future, use the equivalent hook 'useModularUI' or 'useModularUIBasic' instead
39
39
  */
40
- const modularUIConnector = (name, resource, options = {
41
- propName: "data",
42
- removeOnUnmount: false
43
- }) => {
40
+ const modularUIConnector = (name, resource,
41
+ // $FlowIssue
42
+ options = {}) => {
44
43
  const {
45
44
  propName = "data",
46
45
  removeOnUnmount = false,
@@ -1 +1 @@
1
- {"version":3,"file":"ModularUIConnector.js","names":["_reactRedux","require","_reactRouter","_ModularUIActions","_Href","_interopRequireDefault","_utils","_ModularUIUtils","_useModularUI","_useModularUIBasic","_useI18n","_FormModel","_jsxRuntime","patchUpdateModelOption","oldOptions","updateModel","FormModel","updateHandler","newModel","clonedModel","clone","update","modularUIConnector","name","resource","options","propName","removeOnUnmount","otherOptions","Component","WrappedComponent","props","finalRemoveOnUnmount","dispatch","useDispatch","location","useLocation","locale","useLocale","url","useUrl","model","useModularUIBasic","modelEntry","useModularUI","modelKey","connectKey","handleFetch","href","fetchOptions","loadModularUI","handleManualReload","m","o","reloadModel","newProps","status","lastModification","hasModel","Boolean","fetchModularUI","jsx","displayName","getDisplayName","_default","exports","default"],"sources":["../../../src/redux/_modularui/ModularUIConnector.js"],"sourcesContent":["// @flow\nimport { useDispatch } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport { loadModularUI, reloadModel } from \"./ModularUIActions\";\n\nimport Href from \"../../models/href/Href\";\nimport { getDisplayName } from \"../../react/utils\";\n\nimport { useUrl } from \"./ModularUIUtils\";\nimport { useModularUI } from \"../../hooks/useModularUI\";\nimport { useModularUIBasic } from \"../../hooks/useModularUIBasic\";\n\nimport { useLocale } from \"../../hooks/useI18n\";\n\nimport FormModel from \"../../models/form/FormModel\";\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\nconst patchUpdateModelOption = (oldOptions: Object) => {\n if (\n \"updateModel\" in oldOptions &&\n oldOptions.updateModel instanceof FormModel\n ) {\n return {\n ...oldOptions,\n updateHandler: (newModel: ModularUIModel): ModularUIModel => {\n if (newModel instanceof FormModel) {\n // $FLowFixMe\n const clonedModel: FormModel = oldOptions.updateModel.clone();\n clonedModel.update(newModel);\n return clonedModel;\n }\n return newModel;\n },\n };\n }\n\n return oldOptions;\n};\n\n/**\n * @deprecated - will be removed in the future, use the equivalent hook 'useModularUI' or 'useModularUIBasic' instead\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 finalRemoveOnUnmount = props.removeOnUnmount ?? removeOnUnmount;\n\n const dispatch = useDispatch();\n const location = useLocation();\n const locale = useLocale();\n const url = useUrl(resource, { location, ...props });\n\n // $FlowFixMe\n const model = useModularUIBasic<ModularUIModel>(name, url, options);\n\n const modelEntry = useModularUI(name, url, {\n ...otherOptions,\n removeOnUnmount: finalRemoveOnUnmount,\n });\n const modelKey = model?.connectKey ?? name;\n\n const handleFetch = (href: string | Href, fetchOptions: Object) => {\n dispatch(\n loadModularUI(modelKey, href, patchUpdateModelOption(fetchOptions)),\n );\n };\n\n const handleManualReload = (m: ModularUIModel, o: Object) => {\n dispatch(reloadModel(m, o));\n };\n\n const newProps: InjectedProps = {\n modelKey,\n [propName ?? \"data\"]: model,\n location,\n status: modelEntry?.status ?? null,\n lastModification: modelEntry?.lastModification ?? null,\n hasModel: Boolean(model),\n locale,\n fetchModularUI: handleFetch,\n reloadModel: handleManualReload,\n };\n\n return <Component {...props} {...newProps} />;\n };\n\n WrappedComponent.displayName = `BI.modularui(${getDisplayName(Component, name)})`;\n return WrappedComponent;\n };\n};\n\nexport default modularUIConnector;\n"],"mappings":";;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,iBAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAEA,IAAAM,eAAA,G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jF,OAAOO,gBAAgB;EACzB,CAAC;AACH,CAAC;AAAC,IAAAkC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa5C,kBAAkB","ignoreList":[]}
1
+ {"version":3,"file":"ModularUIConnector.js","names":["_reactRedux","require","_reactRouter","_ModularUIActions","_Href","_interopRequireDefault","_utils","_ModularUIUtils","_useModularUI","_useModularUIBasic","_useI18n","_FormModel","_jsxRuntime","patchUpdateModelOption","oldOptions","updateModel","FormModel","updateHandler","newModel","clonedModel","clone","update","modularUIConnector","name","resource","options","propName","removeOnUnmount","otherOptions","Component","WrappedComponent","props","finalRemoveOnUnmount","dispatch","useDispatch","location","useLocation","locale","useLocale","url","useUrl","model","useModularUIBasic","modelEntry","useModularUI","modelKey","connectKey","handleFetch","href","fetchOptions","loadModularUI","handleManualReload","m","o","reloadModel","newProps","status","lastModification","hasModel","Boolean","fetchModularUI","jsx","displayName","getDisplayName","_default","exports","default"],"sources":["../../../src/redux/_modularui/ModularUIConnector.js"],"sourcesContent":["// @flow\nimport { useDispatch } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport { loadModularUI, reloadModel } from \"./ModularUIActions\";\n\nimport Href from \"../../models/href/Href\";\nimport { getDisplayName } from \"../../react/utils\";\n\nimport { useUrl } from \"./ModularUIUtils\";\nimport { useModularUI } from \"../../hooks/useModularUI\";\nimport { useModularUIBasic } from \"../../hooks/useModularUIBasic\";\n\nimport { useLocale } from \"../../hooks/useI18n\";\n\nimport FormModel from \"../../models/form/FormModel\";\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\nconst patchUpdateModelOption = (oldOptions: Object) => {\n if (\n \"updateModel\" in oldOptions &&\n oldOptions.updateModel instanceof FormModel\n ) {\n return {\n ...oldOptions,\n updateHandler: (newModel: ModularUIModel): ModularUIModel => {\n if (newModel instanceof FormModel) {\n // $FLowFixMe\n const clonedModel: FormModel = oldOptions.updateModel.clone();\n clonedModel.update(newModel);\n return clonedModel;\n }\n return newModel;\n },\n };\n }\n\n return oldOptions;\n};\n\n/**\n * @deprecated - will be removed in the future, use the equivalent hook 'useModularUI' or 'useModularUIBasic' instead\n */\nconst modularUIConnector = (\n name: string,\n resource: string | Function,\n // $FlowIssue\n options: ModularUIOptions = {},\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 finalRemoveOnUnmount = props.removeOnUnmount ?? removeOnUnmount;\n\n const dispatch = useDispatch();\n const location = useLocation();\n const locale = useLocale();\n const url = useUrl(resource, { location, ...props });\n\n // $FlowFixMe\n const model = useModularUIBasic<ModularUIModel>(name, url, options);\n\n const modelEntry = useModularUI(name, url, {\n ...otherOptions,\n removeOnUnmount: finalRemoveOnUnmount,\n });\n const modelKey = model?.connectKey ?? name;\n\n const handleFetch = (href: string | Href, fetchOptions: Object) => {\n dispatch(\n loadModularUI(modelKey, href, patchUpdateModelOption(fetchOptions)),\n );\n };\n\n const handleManualReload = (m: ModularUIModel, o: Object) => {\n dispatch(reloadModel(m, o));\n };\n\n const newProps: InjectedProps = {\n modelKey,\n [propName ?? \"data\"]: model,\n location,\n status: modelEntry?.status ?? null,\n lastModification: modelEntry?.lastModification ?? null,\n hasModel: Boolean(model),\n locale,\n fetchModularUI: handleFetch,\n reloadModel: handleManualReload,\n };\n\n return <Component {...props} {...newProps} />;\n };\n\n WrappedComponent.displayName = `BI.modularui(${getDisplayName(Component, name)})`;\n return WrappedComponent;\n };\n};\n\nexport default modularUIConnector;\n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,SAAS;QAAA,GAAKE,KAAK;QAAA,GAAMwB;MAAQ,CAAG,CAAC;IAC/C,CAAC;IAEDzB,gBAAgB,CAACgC,WAAW,GAAG,gBAAgB,IAAAC,qBAAc,EAAClC,SAAS,EAAEN,IAAI,CAAC,GAAG;IACjF,OAAOO,gBAAgB;EACzB,CAAC;AACH,CAAC;AAAC,IAAAkC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa5C,kBAAkB","ignoreList":[]}
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.ModularUIReducer = void 0;
8
- var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
9
8
  var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
10
9
  var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
11
10
  var _Constants = require("../../constants/Constants");
@@ -61,7 +60,9 @@ const setModel = (state, {
61
60
  /**
62
61
  */
63
62
  const initModularUI = (state, models) => {
64
- const newState = (0, _assign.default)({}, state);
63
+ const newState = {
64
+ ...state
65
+ };
65
66
  models.forEach(({
66
67
  key,
67
68
  model
@@ -104,7 +105,9 @@ const updateModel = (state, model) => {
104
105
  /**
105
106
  */
106
107
  const removeKey = (modelKey, state) => {
107
- const newState = (0, _assign.default)({}, state);
108
+ const newState = {
109
+ ...state
110
+ };
108
111
  delete newState[modelKey];
109
112
  return newState;
110
113
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ModularUIReducer.js","names":["_Constants","require","_models","updateStatus","state","key","status","requestOptions","MODULARUI_STATUS","LOADING","lastModification","Date","now","setModel","model","FINISHED","console","debug","initModularUI","models","newState","_assign","default","forEach","getModelKey","_context","_find","_keys","call","connectKey","updateModel","modelKey","removeKey","resetModularUI","ApplicationModel","initialState","ModularUIReducer","action","type","payload","exports"],"sources":["../../../src/redux/_modularui/ModularUIReducer.js"],"sourcesContent":["// @flow\nimport { MODULARUI_STATUS } from \"../../constants/Constants\";\nimport { ApplicationModel } from \"../../models\";\n\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction } from \"../types\";\nimport type { ModularUIState } from \"./types\";\nimport type { ModularUIModel } from \"../../models\";\n\n/**\n */\nconst updateStatus = (\n state: ModularUIState,\n {\n key,\n status,\n requestOptions,\n }: {\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>,\n requestOptions: any,\n },\n) => {\n // model should always be available when status is not loading\n if (status !== MODULARUI_STATUS.LOADING && !state[key]) {\n return state;\n }\n\n return {\n ...state,\n [key]: {\n ...state[key],\n status,\n lastModification: Date.now(),\n requestOptions: requestOptions || state[key]?.requestOptions,\n },\n };\n};\n\n/**\n */\nconst setModel = (\n state: ModularUIState,\n { key, model }: { key: string, model: ?ModularUIModel },\n) => {\n if (!state[key]) {\n return state;\n }\n\n if (model) {\n return {\n ...state,\n [key]: {\n ...state[key],\n model,\n lastModification: Date.now(),\n status: MODULARUI_STATUS.FINISHED,\n },\n };\n }\n\n // eslint-disable-next-line no-console\n console.debug(\"No model for setModel\");\n return state;\n};\n\n/**\n */\nconst initModularUI = (\n state: ModularUIState,\n models: Array<{ key: string, model: ModularUIModel }>,\n) => {\n const newState = Object.assign({}, state);\n\n models.forEach(({ key, model }) => {\n newState[key] = {\n status: MODULARUI_STATUS.FINISHED,\n lastModification: Date.now(),\n model,\n };\n });\n\n return newState;\n};\n\n/**\n */\nconst getModelKey = (state: ModularUIState, model: ModularUIModel) =>\n Object.keys(state).find((key) => {\n const connectKey = state[key]?.model?.connectKey ?? \"\";\n return connectKey === model.connectKey;\n });\n\n/**\n */\nconst updateModel = (state: ModularUIState, model: ModularUIModel) => {\n const modelKey = getModelKey(state, model);\n\n if (modelKey) {\n return setModel(state, { key: modelKey, model });\n }\n\n // eslint-disable-next-line no-console\n console.debug(\n `ModularUIReducer: Cannot update model with key ${model.connectKey}`,\n );\n return state;\n};\n\n/**\n */\nconst removeKey = (modelKey: string, state: ModularUIState): ModularUIState => {\n const newState = Object.assign({}, state);\n delete newState[modelKey];\n return newState;\n};\n\n/**\n * Remove all but application models\n */\nconst resetModularUI = (state: ModularUIState) => {\n const newState: ModularUIState = {};\n\n for (const key in state) {\n if (state[key].model instanceof ApplicationModel) {\n newState[key] = { ...state[key] };\n }\n }\n\n return newState;\n};\n\nconst initialState: ModularUIState = {};\n\n/**\n * Modular UI Reducer\n */\nexport const ModularUIReducer: Reducer<ModularUIState, ReduxAction> = (\n state = initialState,\n action,\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"MODULARUI/INIT\":\n return initModularUI(state, action.payload);\n\n case \"MODULARUI/RESET\":\n return resetModularUI(state);\n\n case \"MODULARUI/STATUS\":\n return updateStatus(state, action.payload);\n\n case \"MODULARUI/SET\":\n return setModel(state, action.payload);\n\n case \"MODULARUI/UPDATE\":\n case \"MODULARUI/UPDATE_FORM\":\n return updateModel(state, action.payload);\n\n case \"MODULARUI/REMOVE_KEY\":\n return removeKey(action.payload, state);\n\n default:\n return state;\n }\n};\n"],"mappings":";;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAOA;AACA;AACA,MAAME,YAAY,GAAGA,CACnBC,KAAqB,EACrB;EACEC,GAAG;EACHC,MAAM;EACNC;AAKF,CAAC,KACE;EACH;EACA,IAAID,MAAM,KAAKE,2BAAgB,CAACC,OAAO,IAAI,CAACL,KAAK,CAACC,GAAG,CAAC,EAAE;IACtD,OAAOD,KAAK;EACd;EAEA,OAAO;IACL,GAAGA,KAAK;IACR,CAACC,GAAG,GAAG;MACL,GAAGD,KAAK,CAACC,GAAG,CAAC;MACbC,MAAM;MACNI,gBAAgB,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC;MAC5BL,cAAc,EAAEA,cAAc,IAAIH,KAAK,CAACC,GAAG,CAAC,EAAEE;IAChD;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA,MAAMM,QAAQ,GAAGA,C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;MACnB,OAAOpB,aAAa,CAACd,KAAK,EAAEiC,MAAM,CAACE,OAAO,CAAC;IAE7C,KAAK,iBAAiB;MACpB,OAAON,cAAc,CAAC7B,KAAK,CAAC;IAE9B,KAAK,kBAAkB;MACrB,OAAOD,YAAY,CAACC,KAAK,EAAEiC,MAAM,CAACE,OAAO,CAAC;IAE5C,KAAK,eAAe;MAClB,OAAO1B,QAAQ,CAACT,KAAK,EAAEiC,MAAM,CAACE,OAAO,CAAC;IAExC,KAAK,kBAAkB;IACvB,KAAK,uBAAuB;MAC1B,OAAOT,WAAW,CAAC1B,KAAK,EAAEiC,MAAM,CAACE,OAAO,CAAC;IAE3C,KAAK,sBAAsB;MACzB,OAAOP,SAAS,CAACK,MAAM,CAACE,OAAO,EAAEnC,KAAK,CAAC;IAEzC;MACE,OAAOA,KAAK;EAChB;AACF,CAAC;AAACoC,OAAA,CAAAJ,gBAAA,GAAAA,gBAAA","ignoreList":[]}
1
+ {"version":3,"file":"ModularUIReducer.js","names":["_Constants","require","_models","updateStatus","state","key","status","requestOptions","MODULARUI_STATUS","LOADING","lastModification","Date","now","setModel","model","FINISHED","console","debug","initModularUI","models","newState","forEach","getModelKey","_context","_find","default","_keys","call","connectKey","updateModel","modelKey","removeKey","resetModularUI","ApplicationModel","initialState","ModularUIReducer","action","type","payload","exports"],"sources":["../../../src/redux/_modularui/ModularUIReducer.js"],"sourcesContent":["// @flow\nimport { MODULARUI_STATUS } from \"../../constants/Constants\";\nimport { ApplicationModel } from \"../../models\";\n\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction } from \"../types\";\nimport type { ModularUIState } from \"./types\";\nimport type { ModularUIModel } from \"../../models\";\n\n/**\n */\nconst updateStatus = (\n state: ModularUIState,\n {\n key,\n status,\n requestOptions,\n }: {\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>,\n requestOptions: any,\n },\n) => {\n // model should always be available when status is not loading\n if (status !== MODULARUI_STATUS.LOADING && !state[key]) {\n return state;\n }\n\n return {\n ...state,\n [key]: {\n ...state[key],\n status,\n lastModification: Date.now(),\n requestOptions: requestOptions || state[key]?.requestOptions,\n },\n };\n};\n\n/**\n */\nconst setModel = (\n state: ModularUIState,\n { key, model }: { key: string, model: ?ModularUIModel },\n) => {\n if (!state[key]) {\n return state;\n }\n\n if (model) {\n return {\n ...state,\n [key]: {\n ...state[key],\n model,\n lastModification: Date.now(),\n status: MODULARUI_STATUS.FINISHED,\n },\n };\n }\n\n // eslint-disable-next-line no-console\n console.debug(\"No model for setModel\");\n return state;\n};\n\n/**\n */\nconst initModularUI = (\n state: ModularUIState,\n models: Array<{ key: string, model: ModularUIModel }>,\n) => {\n const newState = { ...state };\n\n models.forEach(({ key, model }) => {\n newState[key] = {\n status: MODULARUI_STATUS.FINISHED,\n lastModification: Date.now(),\n model,\n };\n });\n\n return newState;\n};\n\n/**\n */\nconst getModelKey = (state: ModularUIState, model: ModularUIModel) =>\n Object.keys(state).find((key) => {\n const connectKey = state[key]?.model?.connectKey ?? \"\";\n return connectKey === model.connectKey;\n });\n\n/**\n */\nconst updateModel = (state: ModularUIState, model: ModularUIModel) => {\n const modelKey = getModelKey(state, model);\n\n if (modelKey) {\n return setModel(state, { key: modelKey, model });\n }\n\n // eslint-disable-next-line no-console\n console.debug(\n `ModularUIReducer: Cannot update model with key ${model.connectKey}`,\n );\n return state;\n};\n\n/**\n */\nconst removeKey = (modelKey: string, state: ModularUIState): ModularUIState => {\n const newState = { ...state };\n delete newState[modelKey];\n return newState;\n};\n\n/**\n * Remove all but application models\n */\nconst resetModularUI = (state: ModularUIState) => {\n const newState: ModularUIState = {};\n\n for (const key in state) {\n if (state[key].model instanceof ApplicationModel) {\n newState[key] = { ...state[key] };\n }\n }\n\n return newState;\n};\n\nconst initialState: ModularUIState = {};\n\n/**\n * Modular UI Reducer\n */\nexport const ModularUIReducer: Reducer<ModularUIState, ReduxAction> = (\n state = initialState,\n action,\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"MODULARUI/INIT\":\n return initModularUI(state, action.payload);\n\n case \"MODULARUI/RESET\":\n return resetModularUI(state);\n\n case \"MODULARUI/STATUS\":\n return updateStatus(state, action.payload);\n\n case \"MODULARUI/SET\":\n return setModel(state, action.payload);\n\n case \"MODULARUI/UPDATE\":\n case \"MODULARUI/UPDATE_FORM\":\n return updateModel(state, action.payload);\n\n case \"MODULARUI/REMOVE_KEY\":\n return removeKey(action.payload, state);\n\n default:\n return state;\n }\n};\n"],"mappings":";;;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAOA;AACA;AACA,MAAME,YAAY,GAAGA,CACnBC,KAAqB,EACrB;EACEC,GAAG;EACHC,MAAM;EACNC;AAKF,CAAC,KACE;EACH;EACA,IAAID,MAAM,KAAKE,2BAAgB,CAACC,OAAO,IAAI,CAACL,KAAK,CAACC,GAAG,CAAC,EAAE;IACtD,OAAOD,KAAK;EACd;EAEA,OAAO;IACL,GAAGA,KAAK;IACR,CAACC,GAAG,GAAG;MACL,GAAGD,KAAK,CAACC,GAAG,CAAC;MACbC,MAAM;MACNI,gBAAgB,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC;MAC5BL,cAAc,EAAEA,cAAc,IAAIH,KAAK,CAACC,GAAG,CAAC,EAAEE;IAChD;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA,MAAMM,QAAQ,GAAGA,CACfT,KAAqB,EACrB;EAAEC,GAAG;EAAES;AAA+C,CAAC,KACpD;EACH,IAAI,CAACV,KAAK,CAACC,GAAG,CAAC,EAAE;IACf,OAAOD,KAAK;EACd;EAEA,IAAIU,KAAK,EAAE;IACT,OAAO;MACL,GAAGV,KAAK;MACR,CAACC,GAAG,GAAG;QACL,GAAGD,KAAK,CAACC,GAAG,CAAC;QACbS,KAAK;QACLJ,gBAAgB,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC;QAC5BN,MAAM,EAAEE,2BAAgB,CAACO;MAC3B;IACF,CAAC;EACH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P,SAAS,CAACK,MAAM,CAACE,OAAO,EAAElC,KAAK,CAAC;IAEzC;MACE,OAAOA,KAAK;EAChB;AACF,CAAC;AAACmC,OAAA,CAAAJ,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.handleUnauthorized = void 0;
8
+ var _globalThis2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/global-this"));
8
9
  var _ErrorResponse = _interopRequireDefault(require("../../models/error/ErrorResponse"));
9
10
  var _RouterActions = require("../_router/RouterActions");
10
11
  var _SignOut = require("./SignOut");
@@ -29,7 +30,7 @@ const handleUnauthorized = errorResponse => (dispatch, getState) => {
29
30
  if (location?.pathname !== LOGIN_PATH) {
30
31
  const locationFrom = location?.state?.from;
31
32
  return dispatch((0, _RouterActions.replace)(LOGIN_PATH, {
32
- from: locationFrom ? locationFrom : state.router.location,
33
+ from: locationFrom ?? state.router.location,
33
34
  modal: false
34
35
  }));
35
36
  }
@@ -39,7 +40,8 @@ const handleUnauthorized = errorResponse => (dispatch, getState) => {
39
40
  dispatch((0, _ModularUIActions.removeModelByKey)(errorResponse.connectKey));
40
41
  }
41
42
  if ((0, _constants.getSetting)("PAGE_RELOAD_ON_UNAUTHORIZED_ERROR", false) && errorResponse.response?.error) {
42
- window.location.reload();
43
+ // $FlowIssue
44
+ _globalThis2.default.location.reload();
43
45
  return;
44
46
  }
45
47
  const application = (0, _ModularUISelectors.getApplication)(getState());
@@ -1 +1 @@
1
- {"version":3,"file":"Authorization.js","names":["_ErrorResponse","_interopRequireDefault","require","_RouterActions","_SignOut","_Cache","_ModularUIActions","_ModularUISelectors","_Application","_SignIn","_constants","handleUnauthorized","errorResponse","dispatch","getState","finish","logoutSuccess","Cache","removeItem","isInvalidUsername","sendAuthenticationError","message","state","location","router","LOGIN_PATH","getSetting","pathname","locationFrom","from","replace","modal","noAction","connectKey","removeModelByKey","response","error","window","reload","application","getApplication","shouldReload","getItem","isLoggedIn","reloadApplication","then","exports"],"sources":["../../../src/redux/actions/Authorization.js"],"sourcesContent":["// @flow\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\n\nimport { replace } from \"../_router/RouterActions\";\nimport { logoutSuccess } from \"./SignOut\";\n\nimport Cache from \"../../utils/browser/Cache\";\n\nimport { removeModelByKey } from \"../_modularui/ModularUIActions\";\nimport { getApplication } from \"../_modularui/ModularUISelectors\";\nimport { noAction, reloadApplication } from \"./Application\";\nimport { sendAuthenticationError } from \"./SignIn\";\n\nimport { getSetting } from \"../../constants\";\n\nimport type { ThunkAction } from \"../types\";\n\n/**\n */\nexport const handleUnauthorized =\n (errorResponse: ErrorResponse): ThunkAction<> =>\n (dispatch, getState) => {\n const finish = () => {\n dispatch(logoutSuccess());\n Cache.removeItem(\"auth\");\n\n if (errorResponse.isInvalidUsername) {\n dispatch(sendAuthenticationError(errorResponse.message));\n }\n\n const state = getState();\n const location = state.router.location;\n const LOGIN_PATH = getSetting(\"LOGIN_PATH\", \"/signin\");\n\n if (location?.pathname !== LOGIN_PATH) {\n const locationFrom = location?.state?.from;\n return dispatch(\n replace(LOGIN_PATH, {\n from: locationFrom ? locationFrom : state.router.location,\n modal: false,\n }),\n );\n }\n\n return dispatch(noAction());\n };\n\n if (errorResponse.connectKey) {\n dispatch(removeModelByKey(errorResponse.connectKey));\n }\n\n if (\n getSetting(\"PAGE_RELOAD_ON_UNAUTHORIZED_ERROR\", false) &&\n errorResponse.response?.error\n ) {\n window.location.reload();\n return;\n }\n\n const application = getApplication(getState());\n const shouldReload = Cache.getItem(\"auth\") || application?.isLoggedIn;\n\n return shouldReload ? dispatch(reloadApplication()).then(finish) : finish();\n };\n"],"mappings":";;;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA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AC,IACtDd,aAAa,CAACuB,QAAQ,EAAEC,KAAK,EAC7B;IACAC,MAAM,CAACd,QAAQ,CAACe,MAAM,CAAC,CAAC;IACxB;EACF;EAEA,MAAMC,WAAW,GAAG,IAAAC,kCAAc,EAAC1B,QAAQ,CAAC,CAAC,CAAC;EAC9C,MAAM2B,YAAY,GAAGxB,cAAK,CAACyB,OAAO,CAAC,MAAM,CAAC,IAAIH,WAAW,EAAEI,UAAU;EAErE,OAAOF,YAAY,GAAG5B,QAAQ,CAAC,IAAA+B,8BAAiB,EAAC,CAAC,CAAC,CAACC,IAAI,CAAC9B,MAAM,CAAC,GAAGA,MAAM,CAAC,CAAC;AAC7E,CAAC;AAAC+B,OAAA,CAAAnC,kBAAA,GAAAA,kBAAA","ignoreList":[]}
1
+ {"version":3,"file":"Authorization.js","names":["_ErrorResponse","_interopRequireDefault","require","_RouterActions","_SignOut","_Cache","_ModularUIActions","_ModularUISelectors","_Application","_SignIn","_constants","handleUnauthorized","errorResponse","dispatch","getState","finish","logoutSuccess","Cache","removeItem","isInvalidUsername","sendAuthenticationError","message","state","location","router","LOGIN_PATH","getSetting","pathname","locationFrom","from","replace","modal","noAction","connectKey","removeModelByKey","response","error","_globalThis2","default","reload","application","getApplication","shouldReload","getItem","isLoggedIn","reloadApplication","then","exports"],"sources":["../../../src/redux/actions/Authorization.js"],"sourcesContent":["// @flow\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\n\nimport { replace } from \"../_router/RouterActions\";\nimport { logoutSuccess } from \"./SignOut\";\n\nimport Cache from \"../../utils/browser/Cache\";\n\nimport { removeModelByKey } from \"../_modularui/ModularUIActions\";\nimport { getApplication } from \"../_modularui/ModularUISelectors\";\nimport { noAction, reloadApplication } from \"./Application\";\nimport { sendAuthenticationError } from \"./SignIn\";\n\nimport { getSetting } from \"../../constants\";\n\nimport type { ThunkAction } from \"../types\";\n\n/**\n */\nexport const handleUnauthorized =\n (errorResponse: ErrorResponse): ThunkAction<> =>\n (dispatch, getState) => {\n const finish = () => {\n dispatch(logoutSuccess());\n Cache.removeItem(\"auth\");\n\n if (errorResponse.isInvalidUsername) {\n dispatch(sendAuthenticationError(errorResponse.message));\n }\n\n const state = getState();\n const location = state.router.location;\n const LOGIN_PATH = getSetting(\"LOGIN_PATH\", \"/signin\");\n\n if (location?.pathname !== LOGIN_PATH) {\n const locationFrom = location?.state?.from;\n return dispatch(\n replace(LOGIN_PATH, {\n from: locationFrom ?? state.router.location,\n modal: false,\n }),\n );\n }\n\n return dispatch(noAction());\n };\n\n if (errorResponse.connectKey) {\n dispatch(removeModelByKey(errorResponse.connectKey));\n }\n\n if (\n getSetting(\"PAGE_RELOAD_ON_UNAUTHORIZED_ERROR\", false) &&\n errorResponse.response?.error\n ) {\n // $FlowIssue\n globalThis.location.reload();\n return;\n }\n\n const application = getApplication(getState());\n const shouldReload = Cache.getItem(\"auth\") || application?.isLoggedIn;\n\n return shouldReload ? dispatch(reloadApplication()).then(finish) : finish();\n };\n"],"mappings":";;;;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,mBAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAEA,IAAAQ,UAAA,GAAAR,OAAA;AAIA;AACA;AACO,MAAMS,kBAAkB,GAC5BC,aAA4B,IAC7B,CAACC,QAAQ,EAAEC,QAAQ,KAAK;EACtB,MAAMC,MAAM,GAAGA,CAAA,KAAM;IACnBF,QAAQ,CAAC,IAAAG,sBAAa,EAAC,CAAC,CAAC;IACzBC,cAAK,CAACC,UAAU,CAAC,MAAM,CAAC;IAExB,IAAIN,aAAa,CAACO,iBAAiB,EAAE;MACnCN,QAAQ,CAAC,IAAAO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ApC,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -78,9 +78,9 @@ const setThemePreference = configTheme => {
78
78
  exports.setThemePreference = setThemePreference;
79
79
  const setAllContentInDataSetting = state => {
80
80
  let allContentInDataSetting = false;
81
- if (typeof preferencesProvider !== "undefined" && typeof preferencesProvider.getModularUIContentInData !== "undefined") {
81
+ if (typeof preferencesProvider?.getModularUIContentInData === "function") {
82
82
  allContentInDataSetting = preferencesProvider.getModularUIContentInData();
83
- } else if (typeof state !== "undefined") {
83
+ } else if (typeof state?.preferences == "object") {
84
84
  allContentInDataSetting = state.preferences[_constants.ALL_CONTENT_IN_DATA_SETTING];
85
85
  }
86
86
  (0, _Settings.setSetting)(_constants.ALL_CONTENT_IN_DATA_SETTING, !!allContentInDataSetting);
@@ -93,9 +93,9 @@ const setAllContentInDataSetting = state => {
93
93
  exports.setAllContentInDataSetting = setAllContentInDataSetting;
94
94
  const setDateTimeSettings = state => {
95
95
  let isIncludeTimeOffsetInDateTimes = false;
96
- if (typeof preferencesProvider !== "undefined" && typeof preferencesProvider.isIncludeTimeOffsetInDateTimes !== "undefined") {
96
+ if (typeof preferencesProvider?.isIncludeTimeOffsetInDateTimes === "function") {
97
97
  isIncludeTimeOffsetInDateTimes = preferencesProvider.isIncludeTimeOffsetInDateTimes();
98
- } else if (typeof state !== "undefined") {
98
+ } else if (typeof state?.preferences === "object") {
99
99
  isIncludeTimeOffsetInDateTimes = state.preferences[_constants.INCLUDE_TIME_OFFSET];
100
100
  }
101
101
  (0, _Settings.setSetting)(_constants.INCLUDE_TIME_OFFSET, !!isIncludeTimeOffsetInDateTimes);
@@ -1 +1 @@
1
- {"version":3,"file":"Preferences.js","names":["_objects","require","_exceptions","_Settings","_constants","getServerPreferenceValue","preferenceName","defaultValue","type","value","preferencesProvider","getPreferenceByName","_includes","default","call","_context","_map","split","val","_trim","setServerPreference","propertyName","setPreference","exports","propertyValue","payload","setPreferences","preferences","setThemePreference","configTheme","themeData","JSON","parse","error","JsonParseException","isPlainObject","setSettings","settings","setAllContentInDataSetting","state","allContentInDataSetting","getModularUIContentInData","ALL_CONTENT_IN_DATA_SETTING","setSetting","setDateTimeSettings","isIncludeTimeOffsetInDateTimes","INCLUDE_TIME_OFFSET","setLoginPreferences","loginSettings","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING"],"sources":["../../../src/redux/actions/Preferences.js"],"sourcesContent":["// @flow\nimport { isPlainObject } from \"../../utils/helpers/objects\";\n\nimport { JsonParseException } from \"../../exceptions\";\nimport { setSetting, setSettings } from \"../../constants/Settings\";\n\nimport type {\n PreferenceValue,\n ReduxState,\n SetPreferenceAction,\n SetPreferencesAction,\n} from \"../types\";\n\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INCLUDE_TIME_OFFSET,\n LOGIN_TYPE,\n LOGIN_PASSWORD_SETTING,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGOUT_PATH_SETTING,\n} from \"../../constants\";\n\n/**\n */\nconst getServerPreferenceValue = (\n preferenceName: string,\n defaultValue: PreferenceValue = null,\n type?: string,\n) => {\n let value: PreferenceValue = null;\n if (typeof preferencesProvider !== \"undefined\") {\n value = preferencesProvider.getPreferenceByName(preferenceName);\n }\n\n if (value == null) {\n value = defaultValue;\n }\n\n if (typeof value === \"string\" && type !== \"string\" && value.includes(\",\")) {\n value = value.split(\",\").map((val) => val.trim());\n }\n\n return value;\n};\n\n/**\n */\nexport const setServerPreference = (\n propertyName: string,\n defaultValue: PreferenceValue = null,\n type?: string,\n): SetPreferenceAction => {\n const value = getServerPreferenceValue(propertyName, defaultValue, type);\n return setPreference(propertyName, value);\n};\n\n/**\n */\nexport const setPreference = (\n propertyName: string,\n propertyValue: PreferenceValue = null,\n): SetPreferenceAction => ({\n type: \"SET_PREFERENCE\",\n payload: {\n [propertyName]: propertyValue,\n },\n});\n\n/**\n */\nexport const setPreferences = (preferences: Object): SetPreferencesAction => ({\n type: \"SET_PREFERENCES\",\n payload: {\n ...preferences,\n },\n});\n\n/**\n */\nexport const setThemePreference = (\n configTheme: string,\n): SetPreferenceAction => {\n let themeData;\n\n try {\n themeData = configTheme ? JSON.parse(configTheme) : null;\n } catch (error) {\n throw new JsonParseException(`Theme file contains invalid JSON: ${error}`);\n }\n\n if (themeData && isPlainObject(themeData)) {\n setSettings(themeData.settings);\n }\n\n return setPreference(\"theme\", themeData);\n};\n\n/**\n * Make modular-ui-content-in-data preference available client side\n */\nexport const setAllContentInDataSetting = (\n state?: ReduxState,\n): SetPreferenceAction => {\n let allContentInDataSetting: PreferenceValue = false;\n\n if (\n typeof preferencesProvider !== \"undefined\" &&\n typeof preferencesProvider.getModularUIContentInData !== \"undefined\"\n ) {\n allContentInDataSetting = preferencesProvider.getModularUIContentInData();\n } else if (typeof state !== \"undefined\") {\n allContentInDataSetting = state.preferences[ALL_CONTENT_IN_DATA_SETTING];\n }\n\n setSetting(ALL_CONTENT_IN_DATA_SETTING, !!allContentInDataSetting);\n return setPreference(ALL_CONTENT_IN_DATA_SETTING, allContentInDataSetting);\n};\n\n/**\n * Retrieve settings for date time conversion\n */\nexport const setDateTimeSettings = (\n state?: ReduxState,\n): SetPreferenceAction => {\n let isIncludeTimeOffsetInDateTimes: PreferenceValue = false;\n if (\n typeof preferencesProvider !== \"undefined\" &&\n typeof preferencesProvider.isIncludeTimeOffsetInDateTimes !== \"undefined\"\n ) {\n isIncludeTimeOffsetInDateTimes =\n preferencesProvider.isIncludeTimeOffsetInDateTimes();\n } else if (typeof state !== \"undefined\") {\n isIncludeTimeOffsetInDateTimes = state.preferences[INCLUDE_TIME_OFFSET];\n }\n\n setSetting(INCLUDE_TIME_OFFSET, !!isIncludeTimeOffsetInDateTimes);\n return setPreference(INCLUDE_TIME_OFFSET, isIncludeTimeOffsetInDateTimes);\n};\n\n/**\n * Retrieves login settings from runtime preferences and sets them as setting in the preference reducer\n */\nexport const setLoginPreferences = (\n state?: ReduxState,\n): SetPreferencesAction => {\n const loginSettings = {\n [LOGIN_TYPE]: getServerPreferenceValue(\n LOGIN_TYPE,\n state?.preferences[LOGIN_TYPE],\n ),\n [LOGIN_PATH_SETTING]: getServerPreferenceValue(\n LOGIN_PATH_SETTING,\n state?.preferences[LOGIN_PATH_SETTING] ??\n `/callback?client_name=FormClient`,\n ),\n [LOGIN_USERNAME_SETTING]: getServerPreferenceValue(\n LOGIN_USERNAME_SETTING,\n state?.preferences[LOGIN_USERNAME_SETTING] ?? \"j_username\",\n ),\n [LOGIN_PASSWORD_SETTING]: getServerPreferenceValue(\n LOGIN_PASSWORD_SETTING,\n state?.preferences[LOGIN_PASSWORD_SETTING] ?? \"j_password\",\n ),\n [LOGOUT_PATH_SETTING]: getServerPreferenceValue(\n LOGOUT_PATH_SETTING,\n state?.preferences[LOGOUT_PATH_SETTING] ?? `/logout`,\n ),\n };\n\n setSettings(loginSettings);\n return setPreferences(loginSettings);\n};\n"],"mappings":";;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AASA,IAAAG,UAAA,GAAAH,OAAA;AAUA;AACA;AACA,MAAMI,wBAAwB,GAAGA,CAC/BC,cAAsB,EACtBC,YAA6B,GAAG,IAAI,EACpCC,IAAa,KACV;EACH,IAAIC,KAAsB,GAAG,IAAI;EACjC,IAAI,OAAOC,mBAAmB,KAAK,WAAW,EAAE;IAC9CD,KAAK,GAAGC,mBAAmB,CAACC,mBAAmB,CAACL,cAAc,CAAC;EACjE;EAEA,IAAIG,KAAK,IAAI,IAAI,EAAE;IACjBA,KAAK,GAAGF,YAAY;EACtB;EAEA,IAAI,OAAOE,KAAK,KAAK,QAAQ,IAAID,IAAI,KAAK,QAAQ,IAAI,IAAAI,SAAA,CAAAC,OAAA,EAAAJ,KAAK,EAAAK,IAAA,CAALL,KAAK,EAAU,GAAG,CAAC,EAAE;IAAA,IAA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vB,aAAa,CAACwB,8BAAmB,EAAED,8BAA8B,CAAC;AAC3E,CAAC;;AAED;AACA;AACA;AAFAtB,OAAA,CAAAqB,mBAAA,GAAAA,mBAAA;AAGO,MAAMG,mBAAmB,GAC9BR,KAAkB,IACO;EACzB,MAAMS,aAAa,GAAG;IACpB,CAACC,qBAAU,GAAG5C,wBAAwB,CACpC4C,qBAAU,EACVV,KAAK,EAAEZ,WAAW,CAACsB,qBAAU,CAC/B,CAAC;IACD,CAACC,6BAAkB,GAAG7C,wBAAwB,CAC5C6C,6BAAkB,EAClBX,KAAK,EAAEZ,WAAW,CAACuB,6BAAkB,CAAC,IACpC,kCACJ,CAAC;IACD,CAACC,iCAAsB,GAAG9C,wBAAwB,CAChD8C,iCAAsB,EACtBZ,KAAK,EAAEZ,WAAW,CAACwB,iCAAsB,CAAC,IAAI,YAChD,CAAC;IACD,CAACC,iCAAsB,GAAG/C,wBAAwB,CAChD+C,iCAAsB,EACtBb,KAAK,EAAEZ,WAAW,CAACyB,iCAAsB,CAAC,IAAI,YAChD,CAAC;IACD,CAACC,8BAAmB,GAAGhD,wBAAwB,CAC7CgD,8BAAmB,EACnBd,KAAK,EAAEZ,WAAW,CAAC0B,8BAAmB,CAAC,IAAI,SAC7C;EACF,CAAC;EAED,IAAAjB,qBAAW,EAACY,aAAa,CAAC;EAC1B,OAAOtB,cAAc,CAACsB,aAAa,CAAC;AACtC,CAAC;AAACzB,OAAA,CAAAwB,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"file":"Preferences.js","names":["_objects","require","_exceptions","_Settings","_constants","getServerPreferenceValue","preferenceName","defaultValue","type","value","preferencesProvider","getPreferenceByName","_includes","default","call","_context","_map","split","val","_trim","setServerPreference","propertyName","setPreference","exports","propertyValue","payload","setPreferences","preferences","setThemePreference","configTheme","themeData","JSON","parse","error","JsonParseException","isPlainObject","setSettings","settings","setAllContentInDataSetting","state","allContentInDataSetting","getModularUIContentInData","ALL_CONTENT_IN_DATA_SETTING","setSetting","setDateTimeSettings","isIncludeTimeOffsetInDateTimes","INCLUDE_TIME_OFFSET","setLoginPreferences","loginSettings","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING"],"sources":["../../../src/redux/actions/Preferences.js"],"sourcesContent":["// @flow\nimport { isPlainObject } from \"../../utils/helpers/objects\";\n\nimport { JsonParseException } from \"../../exceptions\";\nimport { setSetting, setSettings } from \"../../constants/Settings\";\n\nimport type {\n PreferenceValue,\n ReduxState,\n SetPreferenceAction,\n SetPreferencesAction,\n} from \"../types\";\n\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INCLUDE_TIME_OFFSET,\n LOGIN_TYPE,\n LOGIN_PASSWORD_SETTING,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGOUT_PATH_SETTING,\n} from \"../../constants\";\n\n/**\n */\nconst getServerPreferenceValue = (\n preferenceName: string,\n defaultValue: PreferenceValue = null,\n type?: string,\n): PreferenceValue => {\n let value: PreferenceValue = null;\n if (typeof preferencesProvider !== \"undefined\") {\n value = preferencesProvider.getPreferenceByName(preferenceName);\n }\n\n if (value == null) {\n value = defaultValue;\n }\n\n if (typeof value === \"string\" && type !== \"string\" && value.includes(\",\")) {\n value = value.split(\",\").map((val) => val.trim());\n }\n\n return (value: PreferenceValue);\n};\n\n/**\n */\nexport const setServerPreference = (\n propertyName: string,\n defaultValue: PreferenceValue = null,\n type?: string,\n): SetPreferenceAction => {\n const value = getServerPreferenceValue(propertyName, defaultValue, type);\n return setPreference(propertyName, value);\n};\n\n/**\n */\nexport const setPreference = (\n propertyName: string,\n propertyValue: PreferenceValue = null,\n): SetPreferenceAction => ({\n type: \"SET_PREFERENCE\",\n payload: {\n [propertyName]: propertyValue,\n },\n});\n\n/**\n */\nexport const setPreferences = (preferences: Object): SetPreferencesAction => ({\n type: \"SET_PREFERENCES\",\n payload: {\n ...preferences,\n },\n});\n\n/**\n */\nexport const setThemePreference = (\n configTheme: string,\n): SetPreferenceAction => {\n let themeData;\n\n try {\n themeData = configTheme ? JSON.parse(configTheme) : null;\n } catch (error) {\n throw new JsonParseException(`Theme file contains invalid JSON: ${error}`);\n }\n\n if (themeData && isPlainObject(themeData)) {\n setSettings(themeData.settings);\n }\n\n return setPreference(\"theme\", themeData);\n};\n\n/**\n * Make modular-ui-content-in-data preference available client side\n */\nexport const setAllContentInDataSetting = (\n state?: ReduxState,\n): SetPreferenceAction => {\n let allContentInDataSetting: PreferenceValue = false;\n\n if (typeof preferencesProvider?.getModularUIContentInData === \"function\") {\n allContentInDataSetting = preferencesProvider.getModularUIContentInData();\n } else if (typeof state?.preferences == \"object\") {\n allContentInDataSetting = state.preferences[ALL_CONTENT_IN_DATA_SETTING];\n }\n\n setSetting(ALL_CONTENT_IN_DATA_SETTING, !!allContentInDataSetting);\n return setPreference(ALL_CONTENT_IN_DATA_SETTING, allContentInDataSetting);\n};\n\n/**\n * Retrieve settings for date time conversion\n */\nexport const setDateTimeSettings = (\n state?: ReduxState,\n): SetPreferenceAction => {\n let isIncludeTimeOffsetInDateTimes: PreferenceValue = false;\n if (\n typeof preferencesProvider?.isIncludeTimeOffsetInDateTimes === \"function\"\n ) {\n isIncludeTimeOffsetInDateTimes =\n preferencesProvider.isIncludeTimeOffsetInDateTimes();\n } else if (typeof state?.preferences === \"object\") {\n isIncludeTimeOffsetInDateTimes = state.preferences[INCLUDE_TIME_OFFSET];\n }\n\n setSetting(INCLUDE_TIME_OFFSET, !!isIncludeTimeOffsetInDateTimes);\n return setPreference(INCLUDE_TIME_OFFSET, isIncludeTimeOffsetInDateTimes);\n};\n\n/**\n * Retrieves login settings from runtime preferences and sets them as setting in the preference reducer\n */\nexport const setLoginPreferences = (\n state?: ReduxState,\n): SetPreferencesAction => {\n const loginSettings = {\n [LOGIN_TYPE]: getServerPreferenceValue(\n LOGIN_TYPE,\n state?.preferences[LOGIN_TYPE],\n ),\n [LOGIN_PATH_SETTING]: getServerPreferenceValue(\n LOGIN_PATH_SETTING,\n state?.preferences[LOGIN_PATH_SETTING] ??\n `/callback?client_name=FormClient`,\n ),\n [LOGIN_USERNAME_SETTING]: getServerPreferenceValue(\n LOGIN_USERNAME_SETTING,\n state?.preferences[LOGIN_USERNAME_SETTING] ?? \"j_username\",\n ),\n [LOGIN_PASSWORD_SETTING]: getServerPreferenceValue(\n LOGIN_PASSWORD_SETTING,\n state?.preferences[LOGIN_PASSWORD_SETTING] ?? \"j_password\",\n ),\n [LOGOUT_PATH_SETTING]: getServerPreferenceValue(\n LOGOUT_PATH_SETTING,\n state?.preferences[LOGOUT_PATH_SETTING] ?? `/logout`,\n ),\n };\n\n setSettings(loginSettings);\n return setPreferences(loginSettings);\n};\n"],"mappings":";;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AASA,IAAAG,UAAA,GAAAH,OAAA;AAUA;AACA;AACA,MAAMI,wBAAwB,GAAGA,CAC/BC,cAAsB,EACtBC,YAA6B,GAAG,IAAI,EACpCC,IAAa,KACO;EACpB,IAAIC,KAAsB,GAAG,IAAI;EACjC,IAAI,OAAOC,mBAAmB,KAAK,WAAW,EAAE;IAC9CD,KAAK,GAAGC,mBAAmB,CAACC,mBAAmB,CAACL,cAAc,CAAC;EACjE;EAEA,IAAIG,KAAK,IAAI,IAAI,EAAE;IACjBA,KAAK,GAAGF,YAAY;EACtB;EAEA,IAAI,OAAOE,KAAK,KAAK,QAAQ,IAAID,IAAI,KAAK,QAAQ,IAAI,IAAAI,SAAA,CAAAC,OAAA,EAAAJ,KAAK,EAAAK,IAAA,CAALL,KAAK,EAAU,GAAG,CAAC,EAAE;IAAA,IAAAM,QAAA;IACzEN,KAAK,GAAG,IAAAO,IAAA,CAAAH,OAAA,EAAAE,QAAA,GAAAN,KAAK,CAACQ,KAAK,CAAC,GAAG,CAAC,EAAAH,IAAA,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EACzB,MAAMS,aAAa,GAAG;IACpB,CAACC,qBAAU,GAAG5C,wBAAwB,CACpC4C,qBAAU,EACVV,KAAK,EAAEZ,WAAW,CAACsB,qBAAU,CAC/B,CAAC;IACD,CAACC,6BAAkB,GAAG7C,wBAAwB,CAC5C6C,6BAAkB,EAClBX,KAAK,EAAEZ,WAAW,CAACuB,6BAAkB,CAAC,IACpC,kCACJ,CAAC;IACD,CAACC,iCAAsB,GAAG9C,wBAAwB,CAChD8C,iCAAsB,EACtBZ,KAAK,EAAEZ,WAAW,CAACwB,iCAAsB,CAAC,IAAI,YAChD,CAAC;IACD,CAACC,iCAAsB,GAAG/C,wBAAwB,CAChD+C,iCAAsB,EACtBb,KAAK,EAAEZ,WAAW,CAACyB,iCAAsB,CAAC,IAAI,YAChD,CAAC;IACD,CAACC,8BAAmB,GAAGhD,wBAAwB,CAC7CgD,8BAAmB,EACnBd,KAAK,EAAEZ,WAAW,CAAC0B,8BAAmB,CAAC,IAAI,SAC7C;EACF,CAAC;EAED,IAAAjB,qBAAW,EAACY,aAAa,CAAC;EAC1B,OAAOtB,cAAc,CAACsB,aAAa,CAAC;AACtC,CAAC;AAACzB,OAAA,CAAAwB,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -17,16 +17,14 @@ const ModelCatalogReducer = (state = initialState, action) => {
17
17
  if (!action) {
18
18
  return state;
19
19
  }
20
- switch (action.type) {
21
- case "UPDATE_ENTRYDATE":
22
- _Cache.default.addItem("ModelCatalogEntryDate", action.payload);
23
- return {
24
- ...state,
25
- entryDate: action.payload
26
- };
27
- default:
28
- return state;
20
+ if (action.type === "UPDATE_ENTRYDATE") {
21
+ _Cache.default.addItem("ModelCatalogEntryDate", action.payload);
22
+ return {
23
+ ...state,
24
+ entryDate: action.payload
25
+ };
29
26
  }
27
+ return state;
30
28
  };
31
29
  var _default = exports.default = ModelCatalogReducer;
32
30
  //# sourceMappingURL=ModelCatalogReducer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModelCatalogReducer.js","names":["_Cache","_interopRequireDefault","require","initialState","entryDate","Date","toISOString","split","ModelCatalogReducer","state","action","type","Cache","addItem","payload","_default","exports","default"],"sources":["../../../src/redux/reducers/ModelCatalogReducer.js"],"sourcesContent":["// @flow\nimport Cache from \"../../utils/browser/Cache\";\n\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction, ModelCatalogState } from \"../types\";\n\nconst initialState: ModelCatalogState = {\n entryDate: new Date().toISOString().split(\"T\")[0],\n};\n\n/**\n * Keep track of the entry date for the modelcatalog\n */\nconst ModelCatalogReducer: Reducer<ModelCatalogState, ReduxAction> = (\n state = initialState,\n action,\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"UPDATE_ENTRYDATE\":\n Cache.addItem(\"ModelCatalogEntryDate\", action.payload);\n return {\n ...state,\n entryDate: action.payload,\n };\n default:\n return state;\n }\n};\n\nexport default ModelCatalogReducer;\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,MAAMC,YAA+B,GAAG;EACtCC,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAClD,CAAC;;AAED;AACA;AACA;AACA,MAAMC,mBAA4D,GAAGA,CACnEC,KAAK,GAAGN,YAAY,EACpBO,MAAM,KACH;EACH,IAAI,CAACA,MAAM,EAAE;IACX,OAAOD,KAAK;EACd;EAEA,QAAQC,MAAM,CAACC,IAAI;IACjB,KAAK,kBAAkB;MACrBC,cAAK,CAACC,OAAO,CAAC,uBAAuB,EAAEH,MAAM,CAACI,OAAO,CAAC;MACtD,OAAO;QACL,GAAGL,KAAK;QACRL,SAAS,EAAEM,MAAM,CAACI;MACpB,CAAC;IACH;MACE,OAAOL,KAAK;EAChB;AACF,CAAC;AAAC,IAAAM,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaT,mBAAmB","ignoreList":[]}
1
+ {"version":3,"file":"ModelCatalogReducer.js","names":["_Cache","_interopRequireDefault","require","initialState","entryDate","Date","toISOString","split","ModelCatalogReducer","state","action","type","Cache","addItem","payload","_default","exports","default"],"sources":["../../../src/redux/reducers/ModelCatalogReducer.js"],"sourcesContent":["// @flow\nimport Cache from \"../../utils/browser/Cache\";\n\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction, ModelCatalogState } from \"../types\";\n\nconst initialState: ModelCatalogState = {\n entryDate: new Date().toISOString().split(\"T\")[0],\n};\n\n/**\n * Keep track of the entry date for the modelcatalog\n */\nconst ModelCatalogReducer: Reducer<ModelCatalogState, ReduxAction> = (\n state = initialState,\n action,\n) => {\n if (!action) {\n return state;\n }\n\n if (action.type === \"UPDATE_ENTRYDATE\") {\n Cache.addItem(\"ModelCatalogEntryDate\", action.payload);\n return {\n ...state,\n entryDate: action.payload,\n };\n }\n\n return state;\n};\n\nexport default ModelCatalogReducer;\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,MAAMC,YAA+B,GAAG;EACtCC,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAClD,CAAC;;AAED;AACA;AACA;AACA,MAAMC,mBAA4D,GAAGA,CACnEC,KAAK,GAAGN,YAAY,EACpBO,MAAM,KACH;EACH,IAAI,CAACA,MAAM,EAAE;IACX,OAAOD,KAAK;EACd;EAEA,IAAIC,MAAM,CAACC,IAAI,KAAK,kBAAkB,EAAE;IACtCC,cAAK,CAACC,OAAO,CAAC,uBAAuB,EAAEH,MAAM,CAACI,OAAO,CAAC;IACtD,OAAO;MACL,GAAGL,KAAK;MACRL,SAAS,EAAEM,MAAM,CAACI;IACpB,CAAC;EACH;EAEA,OAAOL,KAAK;AACd,CAAC;AAAC,IAAAM,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaT,mBAAmB","ignoreList":[]}
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
+ var _globalThis2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/global-this"));
8
9
  var _redux = require("redux");
9
10
  var _reduxThunk = _interopRequireDefault(require("redux-thunk"));
10
11
  var _RouterMiddleware = require("../_router/RouterMiddleware");
@@ -16,8 +17,12 @@ var _RouterActions = require("../_router/RouterActions");
16
17
  const configureStore = (routerHistory, customReducers, initialState) => {
17
18
  let composeEnhancers = _redux.compose;
18
19
  if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
19
- composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || _redux.compose;
20
+ composeEnhancers =
21
+ // $FlowIssue
22
+ _globalThis2.default.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || _redux.compose;
20
23
  }
24
+
25
+ // $FlowIssue
21
26
  const thunkExtra = {};
22
27
  const combinedReducers = (0, _redux.combineReducers)({
23
28
  ...customReducers,
@@ -1 +1 @@
1
- {"version":3,"file":"configureStore.js","names":["_redux","require","_reduxThunk","_interopRequireDefault","_RouterMiddleware","_ModularUIMiddleware","_createReducer","_RouterActions","configureStore","routerHistory","customReducers","initialState","composeEnhancers","compose","process","env","NODE_ENV","window","__REDUX_DEVTOOLS_EXTENSION_COMPOSE__","thunkExtra","combinedReducers","combineReducers","createReducer","middleware","applyMiddleware","modularUIMiddleware","routerMiddleware","thunk","withExtraArgument","enhancers","store","createReduxStore","subscribe","router","dispatch","locationChange","location","_default","exports","default"],"sources":["../../../src/redux/store/configureStore.js"],"sourcesContent":["// @flow\nimport {\n applyMiddleware,\n compose,\n combineReducers,\n createStore as createReduxStore,\n} from \"redux\";\nimport thunk from \"redux-thunk\";\n\nimport { routerMiddleware } from \"../_router/RouterMiddleware\";\nimport { modularUIMiddleware } from \"../_modularui/ModularUIMiddleware\";\n\nimport { createReducer } from \"../reducers/createReducer\";\nimport { locationChange } from \"../_router/RouterActions\";\n\nimport type { RouterHistory } from \"react-router\";\nimport type { ReduxAction, ReduxState, ReduxStore } from \"../types\";\nimport type { Reducer } from \"redux\";\n\ntype ThunkExtra = {\n subscribe?: $PropertyType<ReduxStore, \"subscribe\">,\n};\n\n/**\n */\nconst configureStore = (\n routerHistory: RouterHistory,\n customReducers?: Object,\n initialState?: $Shape<ReduxState>,\n): { routerHistory: RouterHistory, store: ReduxStore } => {\n let composeEnhancers = compose;\n\n if (process.env.NODE_ENV !== \"production\" && typeof window !== \"undefined\") {\n composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;\n }\n\n const thunkExtra: ThunkExtra = {};\n\n const combinedReducers: Reducer<ReduxState, ReduxAction> = combineReducers({\n ...customReducers,\n ...createReducer(),\n });\n\n const middleware = applyMiddleware(\n modularUIMiddleware,\n routerMiddleware(routerHistory),\n thunk.withExtraArgument(thunkExtra),\n );\n\n const enhancers = composeEnhancers(middleware);\n\n const store: ReduxStore = createReduxStore(\n combinedReducers,\n initialState,\n enhancers,\n );\n\n // Populate the extra argument with the store's subscribe method -> use to wait on store updates\n thunkExtra.subscribe = store.subscribe;\n\n if (!initialState?.router) {\n store.dispatch(locationChange(routerHistory.location, \"PUSH\"));\n }\n\n return { routerHistory, store };\n};\n\nexport default configureStore;\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAMA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAJ,OAAA;AAEA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AAUA;AACA;AACA,MAAMO,cAAc,GAAGA,CACrBC,aAA4B,EAC5BC,cAAuB,EACvBC,YAAiC,KACuB;EACxD,IAAIC,gBAAgB,GAAGC,cAAO;EAE9B,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;IAC1EL,gBAAgB,GAAGK,MAAM,CAACC,oCAAoC,IAAIL,cAAO;EAC3E;EAEA,MAAMM,UAAsB,GAAG,CAAC,CAAC;EAEjC,MAAMC,gBAAkD,GAAG,IAAAC,sBAAe,EAAC;IACzE,GAAGX,cAAc;IACjB,GAAG,IAAAY,4BAAa,EAAC;EACnB,CAAC,CAAC;EAEF,MAAMC,UAAU,GAAG,IAAAC,sBAAe,EAChCC,wCAAmB,EACnB,IAAAC,kCAAgB,EAACjB,aAAa,CAAC,EAC/BkB,mBAAK,CAACC,iBAAiB,CAACT,UAAU,CACpC,CAAC;EAED,MAAMU,SAAS,GAAGjB,gBAAgB,CAACW,UAAU,CAAC;EAE9C,MAAMO,KAAiB,GAAG,IAAAC,kBAAgB,EACxCX,gBAAgB,EAChBT,YAAY,EACZkB,SACF,CAAC;;EAED;EACAV,UAAU,CAACa,SAAS,GAAGF,KAAK,CAACE,SAAS;EAEtC,IAAI,CAACrB,YAAY,EAAEsB,MAAM,EAAE;IACzBH,KAAK,CAACI,QAAQ,CAAC,IAAAC,6BAAc,EAAC1B,aAAa,CAAC2B,QAAQ,EAAE,MAAM,CAAC,CAAC;EAChE;EAEA,OAAO;IAAE3B,aAAa;IAAEqB;EAAM,CAAC;AACjC,CAAC;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa/B,cAAc","ignoreList":[]}
1
+ {"version":3,"file":"configureStore.js","names":["_redux","require","_reduxThunk","_interopRequireDefault","_RouterMiddleware","_ModularUIMiddleware","_createReducer","_RouterActions","configureStore","routerHistory","customReducers","initialState","composeEnhancers","compose","process","env","NODE_ENV","window","_globalThis2","default","__REDUX_DEVTOOLS_EXTENSION_COMPOSE__","thunkExtra","combinedReducers","combineReducers","createReducer","middleware","applyMiddleware","modularUIMiddleware","routerMiddleware","thunk","withExtraArgument","enhancers","store","createReduxStore","subscribe","router","dispatch","locationChange","location","_default","exports"],"sources":["../../../src/redux/store/configureStore.js"],"sourcesContent":["// @flow\nimport {\n applyMiddleware,\n compose,\n combineReducers,\n createStore as createReduxStore,\n} from \"redux\";\nimport thunk from \"redux-thunk\";\n\nimport { routerMiddleware } from \"../_router/RouterMiddleware\";\nimport { modularUIMiddleware } from \"../_modularui/ModularUIMiddleware\";\n\nimport { createReducer } from \"../reducers/createReducer\";\nimport { locationChange } from \"../_router/RouterActions\";\n\nimport type { RouterHistory } from \"react-router\";\nimport type { ReduxAction, ReduxState, ReduxStore } from \"../types\";\nimport type { Reducer } from \"redux\";\n\ntype ThunkExtra = {\n subscribe?: $PropertyType<ReduxStore, \"subscribe\">,\n};\n\n/**\n */\nconst configureStore = (\n routerHistory: RouterHistory,\n customReducers?: Object,\n initialState?: $Shape<ReduxState>,\n): { routerHistory: RouterHistory, store: ReduxStore } => {\n let composeEnhancers = compose;\n\n if (process.env.NODE_ENV !== \"production\" && typeof window !== \"undefined\") {\n composeEnhancers =\n // $FlowIssue\n globalThis.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;\n }\n\n // $FlowIssue\n const thunkExtra: ThunkExtra = {};\n\n const combinedReducers: Reducer<ReduxState, ReduxAction> = combineReducers({\n ...customReducers,\n ...createReducer(),\n });\n\n const middleware = applyMiddleware(\n modularUIMiddleware,\n routerMiddleware(routerHistory),\n thunk.withExtraArgument(thunkExtra),\n );\n\n const enhancers = composeEnhancers(middleware);\n\n const store: ReduxStore = createReduxStore(\n combinedReducers,\n initialState,\n enhancers,\n );\n\n // Populate the extra argument with the store's subscribe method -> use to wait on store updates\n thunkExtra.subscribe = store.subscribe;\n\n if (!initialState?.router) {\n store.dispatch(locationChange(routerHistory.location, \"PUSH\"));\n }\n\n return { routerHistory, store };\n};\n\nexport default configureStore;\n"],"mappings":";;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAMA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,iBAAA,GAAAH,OAAA;AACA,I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ources":["../../src/redux/types.js"],"sourcesContent":["// @flow\nimport type { Store } from \"redux\";\n\nimport type ErrorResponse from \"../models/error/ErrorResponse\";\n\nimport type FormModel from \"../models/form/FormModel\";\nimport typeof {\n NOTIFICATION_TYPES,\n AUTOSAVE_STATUS,\n} from \"../constants/Constants\";\n\nimport type { MessageObject } from \"../i18n/types\";\nimport type {\n I18nState,\n UpdateLocaleAction,\n SetLocalesAction,\n} from \"./_i18n/types\";\nimport type {\n ModularUIState,\n ModularUIAction,\n UpdateStatusAction,\n SetModelAction,\n UpdateModelAction,\n UpdateFormAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n InitModelAction,\n} from \"./_modularui/types\";\nimport type {\n RouterState,\n LocationChangeAction,\n PushAction,\n ReplaceAction,\n GoAction,\n GoBackAction,\n GoForwardAction,\n} from \"./_router/types\";\n\nexport type PreferenceValue =\n | null\n | string\n | boolean\n | { [key: string]: any }\n | Array<PreferenceValue>;\n\nexport type UpdateFormOptions = {\n autosubmit: boolean,\n autosave: boolean,\n autoupdate: boolean,\n forceUpdate?: boolean,\n /** Default true: Activate/deactivate the form object validate by an update */\n validate?: boolean,\n};\n\nexport type NoAction = {\n type: \"NO_ACTION\",\n};\n\nexport type SaveErrorAction = {\n type: \"SAVE_ERROR\",\n payload: ErrorResponse,\n};\n\nexport type ShowModalAction = {\n type: \"SHOW_MODAL\",\n payload: string,\n};\n\nexport type CloseModalAction = {\n type: \"CLOSE_MODAL\",\n payload: string,\n};\n\nexport type DismissNotificationAction = {\n type: \"DISMISS_NOTIFICATION\",\n};\nexport type ShowNotificationAction = {\n type: \"SHOW_NOTIFICATION\",\n payload: {\n type: $Keys<NOTIFICATION_TYPES>,\n message: MessageObject,\n error: ?ErrorResponse,\n },\n};\n\nexport type SetPreferenceAction = {\n type: \"SET_PREFERENCE\",\n payload: { [name: string]: PreferenceValue },\n};\nexport type SetPreferencesAction = {\n type: \"SET_PREFERENCES\",\n payload: { [name: string]: PreferenceValue },\n};\n\nexport type StartProgressAction = {\n type: \"START_PROGRESS\",\n};\nexport type FinishProgressAction = {\n type: \"FINISH_PROGRESS\",\n};\nexport type ResetProgressAction = {\n type: \"RESET_PROGRESS\",\n};\nexport type UpdateProgressAction = {\n type: \"UPDATE_PROGRESS\",\n payload: { percentComplete: number },\n};\n\nexport type SendAuthenticationErrorAction = {\n type: \"AUTHENTICATION_ERROR\",\n payload: string,\n};\n\nexport type ResetAuthErrorsAction = {\n type: \"AUTHENTICATION_RESET_ERRORS\",\n};\n\nexport type LoginSuccessAction = {\n type: \"AUTHENTICATION_SUCCESS\",\n};\n\nexport type ChangePasswordAction = {\n type: \"CHANGE_PASSWORD\",\n};\n\nexport type LogoutSuccessAction = {\n type: \"AUTHENTICATION_LOGOUT\",\n};\n\nexport type UpdateAutosaveAction = {\n type: \"UPDATE_AUTOSAVE_STATUS\",\n payload: {\n status: $Keys<AUTOSAVE_STATUS>,\n model: FormModel,\n },\n};\n\nexport type UpdateEntryDateAction = {\n type: \"UPDATE_ENTRYDATE\",\n payload: ISO_DATE,\n};\n\nexport type ReduxAction =\n | UpdateStatusAction\n | SetModelAction\n | InitModelAction\n | UpdateModelAction\n | UpdateFormAction\n | RemoveModelByKeyAction\n | ResetModularUIAction\n | SaveErrorAction\n | UpdateLocaleAction\n | SetLocalesAction\n | ShowModalAction\n | CloseModalAction\n | DismissNotificationAction\n | ShowNotificationAction\n | SetPreferenceAction\n | SetPreferencesAction\n | StartProgressAction\n | FinishProgressAction\n | ResetProgressAction\n | UpdateProgressAction\n | ResetAuthErrorsAction\n | SendAuthenticationErrorAction\n | LoginSuccessAction\n | ChangePasswordAction\n | LogoutSuccessAction\n | UpdateAutosaveAction\n | UpdateEntryDateAction\n | LocationChangeAction\n | PushAction\n | ReplaceAction\n | GoAction\n | GoBackAction\n | GoForwardAction\n | ModularUIAction\n | NoAction;\n\n// Redux state\nexport type AuthState = {\n +mustChangePassword: boolean,\n +error: ?string,\n};\n\nexport type ErrorState = null | ErrorResponse;\n\nexport type ModalState = {\n +key: string,\n +visible: boolean,\n +size?: string,\n};\n\nexport type ModalsState = {\n +modals: Array<ModalState>,\n};\n\nexport type NotificationState = {\n +render: boolean,\n +messageType: string | null,\n +message: MessageObject | null,\n +error: ?ErrorResponse | null,\n};\n\nexport type PreferencesState = {\n +[name: string]: PreferenceValue,\n};\n\nexport type ProgressIndicatorState = {\n +count: number,\n +timestamp: number,\n +percentComplete: number,\n};\n\nexport type ModelCatalogState = {\n entryDate: ISO_DATE | null,\n};\n\nexport type ReduxState = {\n +router: RouterState,\n +modularui: ModularUIState,\n +i18n: I18nState,\n +auth: AuthState,\n +modelcatalog: ModelCatalogState,\n +error: ErrorState,\n +modals: ModalsState,\n +notification: NotificationState,\n +progressindicator: ProgressIndicatorState,\n +preferences: PreferencesState,\n ...\n};\n\nexport type GetState = () => ReduxState;\nexport type ThunkExtra = { subscribe: any };\n\n// 1. Define ThunkAction first.\n// We use 'any' for Dispatch here temporarily to break the circularity\n// or use the specialized function type.\nexport type ThunkAction<R = any> = (\n dispatch: Dispatch,\n getState: GetState,\n extra: ThunkExtra,\n) => R;\n\nexport type PromiseAction = Promise<ReduxAction | ThunkAction<any>>;\n\n// 2. Define Dispatch as a naked function type.\n// This is much more reliable in modern Flow than DispatchAPI<...>.\nexport type Dispatch = (\n action: ReduxAction | ThunkAction<any> | PromiseAction,\n) => any;\n\n// 3. Update ReduxStore to use the ReduxAction for the base reducer\n// but our custom Dispatch for the store instance.\nexport type ReduxStore = Store<ReduxState, ReduxAction, Dispatch>;\n\n// 4. Clean up PossibleAction if you still use it elsewhere\nexport type PossibleAction = ReduxAction | ThunkAction<any> | PromiseAction;\n\nexport type CustomReducers = { [reducerKey: string]: any };\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/redux/types.js"],"sourcesContent":["// @flow\nimport type { Store } from \"redux\";\n\nimport type ErrorResponse from \"../models/error/ErrorResponse\";\n\nimport type FormModel from \"../models/form/FormModel\";\nimport typeof {\n NOTIFICATION_TYPES,\n AUTOSAVE_STATUS,\n} from \"../constants/Constants\";\n\nimport type { MessageObject } from \"../i18n/types\";\nimport type {\n I18nState,\n UpdateLocaleAction,\n SetLocalesAction,\n} from \"./_i18n/types\";\nimport type {\n ModularUIState,\n ModularUIAction,\n UpdateStatusAction,\n SetModelAction,\n UpdateModelAction,\n UpdateFormAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n InitModelAction,\n} from \"./_modularui/types\";\nimport type {\n RouterState,\n LocationChangeAction,\n PushAction,\n ReplaceAction,\n GoAction,\n GoBackAction,\n GoForwardAction,\n} from \"./_router/types\";\n\nexport type PreferenceValue =\n | null\n | string\n | boolean\n | { [key: string]: any }\n | Array<PreferenceValue>;\n\nexport type UpdateFormOptions = {\n autosubmit: boolean,\n autosave: boolean,\n autoupdate: boolean,\n forceUpdate?: boolean,\n /** Default true: Activate/deactivate the form object validate by an update */\n validate?: boolean,\n};\n\nexport type NoAction = {\n type: \"NO_ACTION\",\n};\n\nexport type SaveErrorAction = {\n type: \"SAVE_ERROR\",\n payload: ErrorResponse,\n};\n\nexport type ShowModalAction = {\n type: \"SHOW_MODAL\",\n payload: string,\n};\n\nexport type CloseModalAction = {\n type: \"CLOSE_MODAL\",\n payload: string,\n};\n\nexport type DismissNotificationAction = {\n type: \"DISMISS_NOTIFICATION\",\n};\nexport type ShowNotificationAction = {\n type: \"SHOW_NOTIFICATION\",\n payload: {\n type: $Keys<NOTIFICATION_TYPES>,\n message: MessageObject,\n error: ?ErrorResponse,\n },\n};\n\nexport type SetPreferenceAction = {\n type: \"SET_PREFERENCE\",\n payload: { [name: string]: PreferenceValue },\n};\nexport type SetPreferencesAction = {\n type: \"SET_PREFERENCES\",\n payload: { [name: string]: PreferenceValue },\n};\n\nexport type StartProgressAction = {\n type: \"START_PROGRESS\",\n};\nexport type FinishProgressAction = {\n type: \"FINISH_PROGRESS\",\n};\nexport type ResetProgressAction = {\n type: \"RESET_PROGRESS\",\n};\nexport type UpdateProgressAction = {\n type: \"UPDATE_PROGRESS\",\n payload: { percentComplete: number },\n};\n\nexport type SendAuthenticationErrorAction = {\n type: \"AUTHENTICATION_ERROR\",\n payload: string,\n};\n\nexport type ResetAuthErrorsAction = {\n type: \"AUTHENTICATION_RESET_ERRORS\",\n};\n\nexport type LoginSuccessAction = {\n type: \"AUTHENTICATION_SUCCESS\",\n};\n\nexport type ChangePasswordAction = {\n type: \"CHANGE_PASSWORD\",\n};\n\nexport type LogoutSuccessAction = {\n type: \"AUTHENTICATION_LOGOUT\",\n};\n\nexport type UpdateAutosaveAction = {\n type: \"UPDATE_AUTOSAVE_STATUS\",\n payload: {\n status: $Keys<AUTOSAVE_STATUS>,\n model: FormModel,\n },\n};\n\nexport type UpdateEntryDateAction = {\n type: \"UPDATE_ENTRYDATE\",\n payload: ISO_DATE,\n};\n\nexport type ReduxAction =\n | UpdateStatusAction\n | SetModelAction\n | InitModelAction\n | UpdateModelAction\n | UpdateFormAction\n | RemoveModelByKeyAction\n | ResetModularUIAction\n | SaveErrorAction\n | UpdateLocaleAction\n | SetLocalesAction\n | ShowModalAction\n | CloseModalAction\n | DismissNotificationAction\n | ShowNotificationAction\n | SetPreferenceAction\n | SetPreferencesAction\n | StartProgressAction\n | FinishProgressAction\n | ResetProgressAction\n | UpdateProgressAction\n | ResetAuthErrorsAction\n | SendAuthenticationErrorAction\n | LoginSuccessAction\n | ChangePasswordAction\n | LogoutSuccessAction\n | UpdateAutosaveAction\n | UpdateEntryDateAction\n | LocationChangeAction\n | PushAction\n | ReplaceAction\n | GoAction\n | GoBackAction\n | GoForwardAction\n | ModularUIAction\n | NoAction;\n\n// Redux state\nexport type AuthState = {\n +mustChangePassword: boolean,\n +error: ?string,\n};\n\nexport type ErrorState = null | ErrorResponse;\n\nexport type ModalState = {\n +key: string,\n +visible: boolean,\n +size?: string,\n};\n\nexport type ModalsState = {\n +modals: Array<ModalState>,\n};\n\nexport type NotificationState = {\n +render: boolean,\n +messageType: string | null,\n +message: MessageObject | null,\n +error: ?ErrorResponse | null,\n};\n\nexport type PreferencesState = {\n +[name: string]: PreferenceValue,\n};\n\nexport type ProgressIndicatorState = {\n +count: number,\n +timestamp: number,\n +percentComplete: number,\n};\n\nexport type ModelCatalogState = {\n entryDate: ISO_DATE | null,\n};\n\nexport type ReduxState = {\n +router: RouterState,\n +modularui: ModularUIState,\n +i18n: I18nState,\n +auth: AuthState,\n +modelcatalog: ModelCatalogState,\n +error: ErrorState,\n +modals: ModalsState,\n +notification: NotificationState,\n +progressindicator: ProgressIndicatorState,\n +preferences: PreferencesState,\n ...\n};\n\nexport type GetState = () => ReduxState;\n\n/**\n * A function that accepts a listener callback and returns an unsubscribe function.\n */\nexport type Subscribe = (listener: () => void) => () => void;\n\nexport type ThunkExtra = {\n subscribe: Subscribe,\n ...\n};\n\n// 1. Define ThunkAction first.\n// We use 'any' for Dispatch here temporarily to break the circularity\n// or use the specialized function type.\nexport type ThunkAction<R = any> = (\n dispatch: Dispatch,\n getState: GetState,\n extra: ThunkExtra,\n) => R;\n\nexport type PromiseAction = Promise<ReduxAction | ThunkAction<any>>;\n\n// 2. Define Dispatch as a naked function type.\n// This is much more reliable in modern Flow than DispatchAPI<...>.\nexport type Dispatch = (\n action: ReduxAction | ThunkAction<any> | PromiseAction,\n) => any;\n\n// 3. Update ReduxStore to use the ReduxAction for the base reducer\n// but our custom Dispatch for the store instance.\nexport type ReduxStore = Store<ReduxState, ReduxAction, Dispatch>;\n\n// 4. Clean up PossibleAction if you still use it elsewhere\nexport type PossibleAction = ReduxAction | ThunkAction<any> | PromiseAction;\n\nexport type CustomReducers = { [reducerKey: string]: any };\n"],"mappings":"","ignoreList":[]}
@@ -8,6 +8,7 @@ exports.default = void 0;
8
8
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
9
9
  var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
10
10
  var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
11
+ var _globalThis2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/global-this"));
11
12
  var _entries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/entries"));
12
13
  var _startsWith = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/starts-with"));
13
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
@@ -108,7 +109,8 @@ class Cache {
108
109
  /**
109
110
  */
110
111
  loadOtherBrowserTabs(callback) {
111
- window.addEventListener("storage", e => {
112
+ // $FlowIssue
113
+ _globalThis2.default.addEventListener("storage", e => {
112
114
  this.sendSessionStorage(e);
113
115
  this.receiveSessionStorage(e, callback);
114
116
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Cache.js","names":["RESOURCE_CACHE_PREFIX","Cache","constructor","_defineProperty2","default","sessionStorage","_cache","createResourceKey","requestArgs","resourceKey","url","params","locale","getItem","key","cache","cacheItem","JSON","parse","error","hasItem","addItem","value","stringValue","_stringify","setItem","removeItem","clear","pattern","_context","_filter","_keys","call","k","RegExp","test","forEach","loadOtherBrowserTabs","callback","window","addEventListener","e","sendSessionStorage","receiveSessionStorage","length","localStorage","Date","now","toString","_context2","newData","newValue","_entries","_startsWith","_default","exports"],"sources":["../../../src/utils/browser/Cache.js"],"sourcesContent":["// @flow\nimport type { RequestOptions } from \"../fetch/types\";\n\nconst RESOURCE_CACHE_PREFIX = \"res:\";\n\n/**\n * Manage the browser cache\n */\nclass Cache {\n _cache: Storage;\n\n /**\n */\n constructor() {\n if (typeof sessionStorage !== \"undefined\") {\n this._cache = sessionStorage;\n }\n }\n\n /**\n * Create a key that can be used to cache resources, needs the request arguments and uses url, params and header of the request args\n * to create a key that is unique for time versions and locale\n */\n createResourceKey(requestArgs: RequestOptions): string {\n let resourceKey = requestArgs.url;\n\n if (requestArgs.params) {\n resourceKey += `|${requestArgs.params}`;\n }\n\n if (requestArgs.locale) {\n resourceKey += `|${requestArgs.locale}`;\n }\n\n return `${RESOURCE_CACHE_PREFIX}${resourceKey}`;\n }\n\n /**\n * Get a cached item by it's key\n */\n getItem(key: string): any {\n const cache = this._cache;\n\n if (!cache) {\n return null;\n }\n\n const cacheItem = cache.getItem(key);\n\n if (!cacheItem) {\n return null;\n }\n\n try {\n return JSON.parse(cacheItem);\n } catch (error) {\n return this._cache.getItem(key);\n }\n }\n\n /**\n * Check if the item with key exists in the browser cache\n */\n hasItem(key: string): boolean {\n return this.getItem(key) !== null;\n }\n\n /**\n * Add an item to the cache\n */\n addItem(key: string, value: string | Object) {\n const stringValue =\n typeof value === \"string\" ? value : JSON.stringify(value);\n\n this._cache.setItem(key, stringValue);\n }\n\n /**\n */\n setItem(key: string, value: string | Object) {\n this.addItem(key, value);\n }\n\n /**\n */\n removeItem(key: string) {\n this._cache.removeItem(key);\n }\n\n /**\n * Clear complete cache storage\n */\n clear(pattern: ?string) {\n if (!this._cache) {\n return;\n }\n\n if (pattern) {\n Object.keys(this._cache)\n .filter((k) => (pattern ? new RegExp(pattern).test(k) : true))\n .forEach((k) => this._cache.removeItem(k));\n } else {\n this._cache.clear();\n }\n }\n\n // Session storage is not available between different tabs in the same window,\n // this load method copies sessionStorage from other tabs into this tab using localStorage\n // see https://blog.guya.net/2015/06/12/sharing-sessionstorage-between-tabs-for-secure-multi-tab-authentication/\n /**\n */\n loadOtherBrowserTabs(callback: Function) {\n window.addEventListener(\"storage\", (e) => {\n this.sendSessionStorage(e);\n this.receiveSessionStorage(e, callback);\n });\n\n if (this._cache.length === 0) {\n // trigger retrieval of sessionstorage on other tabs\n localStorage.setItem(\"getSessionStorage\", Date.now().toString());\n }\n }\n\n /**\n */\n sendSessionStorage(e: StorageEvent) {\n if (e.key === \"getSessionStorage\") {\n localStorage.setItem(\"sessionStorage\", JSON.stringify(this._cache));\n localStorage.removeItem(\"sessionStorage\");\n }\n }\n\n /**\n */\n receiveSessionStorage(e: StorageEvent, callback: Function): any {\n if (e.key === \"sessionStorage\" && !this.getItem(\"sessionStorageCopied\")) {\n // receive sessionstorage from other tabs\n const newData = e.newValue ? JSON.parse(e.newValue) : {};\n Object.entries(newData)\n .filter(\n ([key]) =>\n !this.hasItem(key) && !key.startsWith(RESOURCE_CACHE_PREFIX),\n )\n .forEach(([key, value]) => {\n this.addItem(key, value);\n });\n\n this.setItem(\"sessionStorageCopied\", Date.now().toString());\n\n return callback();\n }\n\n return null;\n }\n}\n\nexport default (new Cache(): Cache);\n"],"mappings":";;;;;;;;;;;;;AAGA,MAAMA,qBAAqB,GAAG,MAAM;;AAEpC;AACA;AACA;AACA,MAAMC,KAAK,CAAC;EAGV;AACF;EACEC,WAAWA,CAAA,EAAG;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IACZ,IAAI,OAAOC,cAAc,KAAK,WAAW,EAAE;MACzC,IAAI,CAACC,MAAM,GAAGD,cAAc;IAC9B;EACF;;EAEA;AACF;AACA;AACA;EACEE,iBAAiBA,CAACC,WAA2B,EAAU;IACrD,IAAIC,WAAW,GAAGD,WAAW,CAACE,GAAG;IAEjC,IAAIF,WAAW,CAACG,MAAM,EAAE;MACtBF,WAAW,IAAI,IAAID,WAAW,CAACG,MAAM,EAAE;IACzC;IAEA,IAAIH,WAAW,CAACI,MAAM,EAAE;MACtBH,WAAW,IAAI,IAAID,WAAW,CAACI,MAAM,EAAE;IACzC;IAEA,OAAO,GAAGZ,qBAAqB,GAAGS,WAAW,EAAE;EACjD;;EAEA;AACF;AACA;EACEI,OAAOA,CAACC,GAAW,EAAO;IACxB,MAAMC,KAAK,GAAG,IAAI,CAACT,MAAM;IAEzB,IAAI,CAACS,KAAK,EAAE;MACV,OAAO,IAAI;IACb;IAEA,MAAMC,SAAS,GAAGD,KAAK,CAACF,OAAO,CAACC,GAAG,CAAC;IAEpC,IAAI,CAACE,SAAS,EAAE;MACd,OAAO,IAAI;IACb;IAEA,IAAI;MACF,OAAOC,IAAI,CAACC,KAAK,CAACF,SAAS,CAAC;IAC9B,CAAC,CA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O,CAACN,GAAG,CAAC,IAAI,CAAC,IAAAuC,WAAA,CAAAjD,OAAA,EAAAU,GAAG,EAAAkB,IAAA,CAAHlB,GAAG,EAAYd,qBAAqB,CAC/D,CAAC,CACAoC,OAAO,CAAC,CAAC,CAACtB,GAAG,EAAEQ,KAAK,CAAC,KAAK;QACzB,IAAI,CAACD,OAAO,CAACP,GAAG,EAAEQ,KAAK,CAAC;MAC1B,CAAC,CAAC;MAEJ,IAAI,CAACG,OAAO,CAAC,sBAAsB,EAAEqB,IAAI,CAACC,GAAG,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAAC;MAE3D,OAAOV,QAAQ,CAAC,CAAC;IACnB;IAEA,OAAO,IAAI;EACb;AACF;AAAC,IAAAgB,QAAA,GAAAC,OAAA,CAAAnD,OAAA,GAEe,IAAIH,KAAK,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Cache.js","names":["RESOURCE_CACHE_PREFIX","Cache","constructor","_defineProperty2","default","sessionStorage","_cache","createResourceKey","requestArgs","resourceKey","url","params","locale","getItem","key","cache","cacheItem","JSON","parse","error","hasItem","addItem","value","stringValue","_stringify","setItem","removeItem","clear","pattern","_context","_filter","_keys","call","k","RegExp","test","forEach","loadOtherBrowserTabs","callback","_globalThis2","addEventListener","e","sendSessionStorage","receiveSessionStorage","length","localStorage","Date","now","toString","_context2","newData","newValue","_entries","_startsWith","_default","exports"],"sources":["../../../src/utils/browser/Cache.js"],"sourcesContent":["// @flow\nimport type { RequestOptions } from \"../fetch/types\";\n\nconst RESOURCE_CACHE_PREFIX = \"res:\";\n\n/**\n * Manage the browser cache\n */\nclass Cache {\n _cache: Storage;\n\n /**\n */\n constructor() {\n if (typeof sessionStorage !== \"undefined\") {\n this._cache = sessionStorage;\n }\n }\n\n /**\n * Create a key that can be used to cache resources, needs the request arguments and uses url, params and header of the request args\n * to create a key that is unique for time versions and locale\n */\n createResourceKey(requestArgs: RequestOptions): string {\n let resourceKey = requestArgs.url;\n\n if (requestArgs.params) {\n resourceKey += `|${requestArgs.params}`;\n }\n\n if (requestArgs.locale) {\n resourceKey += `|${requestArgs.locale}`;\n }\n\n return `${RESOURCE_CACHE_PREFIX}${resourceKey}`;\n }\n\n /**\n * Get a cached item by it's key\n */\n getItem(key: string): any {\n const cache = this._cache;\n\n if (!cache) {\n return null;\n }\n\n const cacheItem = cache.getItem(key);\n\n if (!cacheItem) {\n return null;\n }\n\n try {\n return JSON.parse(cacheItem);\n } catch (error) {\n return this._cache.getItem(key);\n }\n }\n\n /**\n * Check if the item with key exists in the browser cache\n */\n hasItem(key: string): boolean {\n return this.getItem(key) !== null;\n }\n\n /**\n * Add an item to the cache\n */\n addItem(key: string, value: string | Object) {\n const stringValue =\n typeof value === \"string\" ? value : JSON.stringify(value);\n\n this._cache.setItem(key, stringValue);\n }\n\n /**\n */\n setItem(key: string, value: string | Object) {\n this.addItem(key, value);\n }\n\n /**\n */\n removeItem(key: string) {\n this._cache.removeItem(key);\n }\n\n /**\n * Clear complete cache storage\n */\n clear(pattern: ?string) {\n if (!this._cache) {\n return;\n }\n\n if (pattern) {\n Object.keys(this._cache)\n .filter((k) => (pattern ? new RegExp(pattern).test(k) : true))\n .forEach((k) => this._cache.removeItem(k));\n } else {\n this._cache.clear();\n }\n }\n\n // Session storage is not available between different tabs in the same window,\n // this load method copies sessionStorage from other tabs into this tab using localStorage\n // see https://blog.guya.net/2015/06/12/sharing-sessionstorage-between-tabs-for-secure-multi-tab-authentication/\n /**\n */\n loadOtherBrowserTabs(callback: Function) {\n // $FlowIssue\n globalThis.addEventListener(\"storage\", (e) => {\n this.sendSessionStorage(e);\n this.receiveSessionStorage(e, callback);\n });\n\n if (this._cache.length === 0) {\n // trigger retrieval of sessionstorage on other tabs\n localStorage.setItem(\"getSessionStorage\", Date.now().toString());\n }\n }\n\n /**\n */\n sendSessionStorage(e: StorageEvent) {\n if (e.key === \"getSessionStorage\") {\n localStorage.setItem(\"sessionStorage\", JSON.stringify(this._cache));\n localStorage.removeItem(\"sessionStorage\");\n }\n }\n\n /**\n */\n receiveSessionStorage(e: StorageEvent, callback: Function): any {\n if (e.key === \"sessionStorage\" && !this.getItem(\"sessionStorageCopied\")) {\n // receive sessionstorage from other tabs\n const newData = e.newValue ? JSON.parse(e.newValue) : {};\n Object.entries(newData)\n .filter(\n ([key]) =>\n !this.hasItem(key) && !key.startsWith(RESOURCE_CACHE_PREFIX),\n )\n .forEach(([key, value]) => {\n this.addItem(key, value);\n });\n\n this.setItem(\"sessionStorageCopied\", Date.now().toString());\n\n return callback();\n }\n\n return null;\n }\n}\n\nexport default (new Cache(): Cache);\n"],"mappings":";;;;;;;;;;;;;;AAGA,MAAMA,qBAAqB,GAAG,MAAM;;AAEpC;AACA;AACA;AACA,MAAMC,KAAK,CAAC;EAGV;AACF;EACEC,WAAWA,CAAA,EAAG;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IACZ,IAAI,OAAOC,cAAc,KAAK,WAAW,EAAE;MACzC,IAAI,CAACC,MAAM,GAAGD,cAAc;IAC9B;EACF;;EAEA;AACF;AACA;AACA;EACEE,iBAAiBA,CAACC,WAA2B,EAAU;IACrD,IAAIC,WAAW,GAAGD,WAAW,CAACE,GAAG;IAEjC,IAAIF,WAAW,CAACG,MAAM,EAAE;MACtBF,WAAW,IAAI,IAAID,WAAW,CAACG,MAAM,EAAE;IACzC;IAEA,IAAIH,WAAW,CAACI,MAAM,EAAE;MACtBH,WAAW,IAAI,IAAID,WAAW,CAACI,MAAM,EAAE;IACzC;IAEA,OAAO,GAAGZ,qBAAqB,GAAGS,WAAW,EAAE;EACjD;;EAEA;AACF;AACA;EACEI,OAAOA,CAACC,GAAW,EAAO;IACxB,MAAMC,KAAK,GAAG,IAAI,CAACT,MAAM;IAEzB,IAAI,CAACS,KAAK,EAAE;MACV,OAAO,IAAI;IACb;IAEA,MAAMC,SAAS,GAAGD,KAAK,CAACF,OAAO,CAACC,GAAG,CAAC;IAEpC,IAAI,CAACE,SAAS,EAAE;MACd,OA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AA,EAAe8C,OAAO,CAAC,EAAAlB,IAAA,CAAAiB,SAAA,EAEnB,CAAC,CAACnC,GAAG,CAAC,KACJ,CAAC,IAAI,CAACM,OAAO,CAACN,GAAG,CAAC,IAAI,CAAC,IAAAuC,WAAA,CAAAjD,OAAA,EAAAU,GAAG,EAAAkB,IAAA,CAAHlB,GAAG,EAAYd,qBAAqB,CAC/D,CAAC,CACAoC,OAAO,CAAC,CAAC,CAACtB,GAAG,EAAEQ,KAAK,CAAC,KAAK;QACzB,IAAI,CAACD,OAAO,CAACP,GAAG,EAAEQ,KAAK,CAAC;MAC1B,CAAC,CAAC;MAEJ,IAAI,CAACG,OAAO,CAAC,sBAAsB,EAAEqB,IAAI,CAACC,GAAG,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAAC;MAE3D,OAAOV,QAAQ,CAAC,CAAC;IACnB;IAEA,OAAO,IAAI;EACb;AACF;AAAC,IAAAgB,QAAA,GAAAC,OAAA,CAAAnD,OAAA,GAEe,IAAIH,KAAK,CAAC,CAAC","ignoreList":[]}
@@ -8,6 +8,7 @@ exports.TimestampUtil = exports.TimeUtil = exports.DateUtil = exports.DateTimeUt
8
8
  var _sort = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/sort"));
9
9
  var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
10
10
  var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
11
+ var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
11
12
  var _trunc = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/math/trunc"));
12
13
  var _padStart = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/pad-start"));
13
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
@@ -256,7 +257,7 @@ class BaseDateTimeUtil {
256
257
  return (0, _format.format)(newDate, "HH:mm");
257
258
  });
258
259
  const time = (0, _format.format)(dateTime, "HH:mm");
259
- return a.indexOf(time) > -1;
260
+ return (0, _includes.default)(a).call(a, time);
260
261
  }
261
262
 
262
263
  //////////// CALCULATIONS
@@ -530,10 +531,10 @@ class BaseDateTimeUtil {
530
531
  if ((0, _isValid.isValid)(parsedDate)) {
531
532
  const dateOffset = this.toFormat(parsedDate, _constants.DATETIME_OFFSET_FORMAT);
532
533
  const offsets = this.getTimezoneOffsets();
533
- if (typeof offsets.daylight !== "undefined" && offsets.daylight.value === dateOffset) {
534
- return offsets.daylight;
535
- } else if (typeof offsets.standard !== "undefined" && offsets.standard.value === dateOffset) {
536
- return offsets.standard;
534
+ if (offsets.daylight?.value === dateOffset) {
535
+ return offsets.daylight ?? null;
536
+ } else if (offsets.standard?.value === dateOffset) {
537
+ return offsets.standard ?? null;
537
538
  }
538
539
  }
539
540
  return null;