@beinformed/ui 1.56.0 → 1.57.0-contextpath.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/esm/constants/Settings.js +4 -1
  3. package/esm/constants/Settings.js.map +1 -1
  4. package/esm/hooks/useForm.js +3 -1
  5. package/esm/hooks/useForm.js.map +1 -1
  6. package/esm/hooks/useModularUIBasic.js +11 -1
  7. package/esm/hooks/useModularUIBasic.js.map +1 -1
  8. package/esm/hooks/useModularUIModel.js +36 -25
  9. package/esm/hooks/useModularUIModel.js.map +1 -1
  10. package/esm/models/actions/ActionCollection.js +2 -2
  11. package/esm/models/actions/ActionCollection.js.map +1 -1
  12. package/esm/models/actions/ActionModel.js +27 -8
  13. package/esm/models/actions/ActionModel.js.map +1 -1
  14. package/esm/models/application/ApplicationModel.js +1 -1
  15. package/esm/models/application/ApplicationModel.js.map +1 -1
  16. package/esm/models/base/ResourceModel.js +25 -3
  17. package/esm/models/base/ResourceModel.js.map +1 -1
  18. package/esm/models/caseview/CaseViewModel.js +2 -2
  19. package/esm/models/caseview/CaseViewModel.js.map +1 -1
  20. package/esm/models/concepts/ConceptLinkModel.js +1 -0
  21. package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
  22. package/esm/models/concepts/SourceReferenceModel.js +2 -1
  23. package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
  24. package/esm/models/content/ContentIndexModel.js +2 -2
  25. package/esm/models/content/ContentIndexModel.js.map +1 -1
  26. package/esm/models/content/ContentLinkModel.js +2 -0
  27. package/esm/models/content/ContentLinkModel.js.map +1 -1
  28. package/esm/models/content/SectionModel.js +1 -0
  29. package/esm/models/content/SectionModel.js.map +1 -1
  30. package/esm/models/detail/DetailModel.js +1 -1
  31. package/esm/models/detail/DetailModel.js.map +1 -1
  32. package/esm/models/error/ErrorResponse.js +2 -0
  33. package/esm/models/error/ErrorResponse.js.map +1 -1
  34. package/esm/models/form/FormModel.js +1 -1
  35. package/esm/models/form/FormModel.js.map +1 -1
  36. package/esm/models/href/Href.js +50 -3
  37. package/esm/models/href/Href.js.map +1 -1
  38. package/esm/models/href/ListHref.js +1 -1
  39. package/esm/models/href/ListHref.js.map +1 -1
  40. package/esm/models/links/LinkCollection.js +3 -1
  41. package/esm/models/links/LinkCollection.js.map +1 -1
  42. package/esm/models/links/LinkModel.js +10 -9
  43. package/esm/models/links/LinkModel.js.map +1 -1
  44. package/esm/models/list/ListItemModel.js +3 -1
  45. package/esm/models/list/ListItemModel.js.map +1 -1
  46. package/esm/models/list/ListModel.js +1 -1
  47. package/esm/models/list/ListModel.js.map +1 -1
  48. package/esm/models/panels/GroupingPanelModel.js +1 -1
  49. package/esm/models/panels/GroupingPanelModel.js.map +1 -1
  50. package/esm/models/tab/TabModel.js +2 -2
  51. package/esm/models/tab/TabModel.js.map +1 -1
  52. package/esm/models/taskgroup/TaskGroupModel.js +4 -2
  53. package/esm/models/taskgroup/TaskGroupModel.js.map +1 -1
  54. package/esm/modularui/Authenticate.js +2 -1
  55. package/esm/modularui/Authenticate.js.map +1 -1
  56. package/esm/modularui/ModularUIRequest.js +43 -7
  57. package/esm/modularui/ModularUIRequest.js.map +1 -1
  58. package/esm/modularui/ModularUIResponse.js +31 -0
  59. package/esm/modularui/ModularUIResponse.js.map +1 -1
  60. package/esm/redux/_modularui/ModularUIActions.js +3 -1
  61. package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
  62. package/esm/redux/_modularui/ModularUIMiddleware.js +6 -0
  63. package/esm/redux/_modularui/ModularUIMiddleware.js.map +1 -1
  64. package/esm/redux/_modularui/types.js.map +1 -1
  65. package/esm/redux/actions/Application.js +2 -0
  66. package/esm/redux/actions/Application.js.map +1 -1
  67. package/esm/redux/connectors/PanelRenderer.js +2 -0
  68. package/esm/redux/connectors/PanelRenderer.js.map +1 -1
  69. package/esm/utils/fetch/types.js.map +1 -1
  70. package/esm/utils/helpers/checkResource.js +2 -0
  71. package/esm/utils/helpers/checkResource.js.map +1 -1
  72. package/lib/constants/Settings.js +4 -1
  73. package/lib/constants/Settings.js.flow +2 -2
  74. package/lib/constants/Settings.js.map +1 -1
  75. package/lib/hooks/useForm.js +3 -1
  76. package/lib/hooks/useForm.js.flow +2 -0
  77. package/lib/hooks/useForm.js.map +1 -1
  78. package/lib/hooks/useModularUIBasic.js +11 -1
  79. package/lib/hooks/useModularUIBasic.js.flow +14 -0
  80. package/lib/hooks/useModularUIBasic.js.map +1 -1
  81. package/lib/hooks/useModularUIModel.js +36 -24
  82. package/lib/hooks/useModularUIModel.js.flow +58 -11
  83. package/lib/hooks/useModularUIModel.js.map +1 -1
  84. package/lib/models/actions/ActionCollection.js +2 -2
  85. package/lib/models/actions/ActionCollection.js.flow +14 -2
  86. package/lib/models/actions/ActionCollection.js.map +1 -1
  87. package/lib/models/actions/ActionModel.js +31 -12
  88. package/lib/models/actions/ActionModel.js.flow +38 -16
  89. package/lib/models/actions/ActionModel.js.map +1 -1
  90. package/lib/models/application/ApplicationModel.js +1 -1
  91. package/lib/models/application/ApplicationModel.js.flow +7 -1
  92. package/lib/models/application/ApplicationModel.js.map +1 -1
  93. package/lib/models/base/ResourceModel.js +24 -3
  94. package/lib/models/base/ResourceModel.js.flow +35 -10
  95. package/lib/models/base/ResourceModel.js.map +1 -1
  96. package/lib/models/caseview/CaseViewModel.js +2 -2
  97. package/lib/models/caseview/CaseViewModel.js.flow +3 -1
  98. package/lib/models/caseview/CaseViewModel.js.map +1 -1
  99. package/lib/models/concepts/ConceptLinkModel.js +1 -0
  100. package/lib/models/concepts/ConceptLinkModel.js.flow +1 -0
  101. package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
  102. package/lib/models/concepts/SourceReferenceModel.js +2 -1
  103. package/lib/models/concepts/SourceReferenceModel.js.flow +2 -1
  104. package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
  105. package/lib/models/content/ContentIndexModel.js +2 -2
  106. package/lib/models/content/ContentIndexModel.js.flow +2 -2
  107. package/lib/models/content/ContentIndexModel.js.map +1 -1
  108. package/lib/models/content/ContentLinkModel.js +2 -0
  109. package/lib/models/content/ContentLinkModel.js.flow +2 -0
  110. package/lib/models/content/ContentLinkModel.js.map +1 -1
  111. package/lib/models/content/SectionModel.js +1 -0
  112. package/lib/models/content/SectionModel.js.flow +1 -0
  113. package/lib/models/content/SectionModel.js.map +1 -1
  114. package/lib/models/detail/DetailModel.js +1 -1
  115. package/lib/models/detail/DetailModel.js.flow +2 -0
  116. package/lib/models/detail/DetailModel.js.map +1 -1
  117. package/lib/models/error/ErrorResponse.js +2 -0
  118. package/lib/models/error/ErrorResponse.js.flow +2 -0
  119. package/lib/models/error/ErrorResponse.js.map +1 -1
  120. package/lib/models/form/FormModel.js +1 -1
  121. package/lib/models/form/FormModel.js.flow +1 -1
  122. package/lib/models/form/FormModel.js.map +1 -1
  123. package/lib/models/href/Href.js +50 -3
  124. package/lib/models/href/Href.js.flow +58 -3
  125. package/lib/models/href/Href.js.map +1 -1
  126. package/lib/models/href/ListHref.js +1 -1
  127. package/lib/models/href/ListHref.js.flow +1 -1
  128. package/lib/models/href/ListHref.js.map +1 -1
  129. package/lib/models/links/LinkCollection.js +3 -1
  130. package/lib/models/links/LinkCollection.js.flow +8 -2
  131. package/lib/models/links/LinkCollection.js.map +1 -1
  132. package/lib/models/links/LinkModel.js +10 -9
  133. package/lib/models/links/LinkModel.js.flow +24 -16
  134. package/lib/models/links/LinkModel.js.map +1 -1
  135. package/lib/models/list/ListItemModel.js +3 -1
  136. package/lib/models/list/ListItemModel.js.flow +4 -0
  137. package/lib/models/list/ListItemModel.js.map +1 -1
  138. package/lib/models/list/ListModel.js +1 -1
  139. package/lib/models/list/ListModel.js.flow +6 -1
  140. package/lib/models/list/ListModel.js.map +1 -1
  141. package/lib/models/panels/GroupingPanelModel.js +1 -1
  142. package/lib/models/panels/GroupingPanelModel.js.flow +2 -0
  143. package/lib/models/panels/GroupingPanelModel.js.map +1 -1
  144. package/lib/models/tab/TabModel.js +2 -2
  145. package/lib/models/tab/TabModel.js.flow +4 -0
  146. package/lib/models/tab/TabModel.js.map +1 -1
  147. package/lib/models/taskgroup/TaskGroupModel.js +4 -2
  148. package/lib/models/taskgroup/TaskGroupModel.js.flow +6 -0
  149. package/lib/models/taskgroup/TaskGroupModel.js.map +1 -1
  150. package/lib/modularui/Authenticate.js +2 -1
  151. package/lib/modularui/Authenticate.js.flow +2 -1
  152. package/lib/modularui/Authenticate.js.map +1 -1
  153. package/lib/modularui/ModularUIRequest.js +43 -7
  154. package/lib/modularui/ModularUIRequest.js.flow +49 -8
  155. package/lib/modularui/ModularUIRequest.js.map +1 -1
  156. package/lib/modularui/ModularUIResponse.js +31 -0
  157. package/lib/modularui/ModularUIResponse.js.flow +35 -0
  158. package/lib/modularui/ModularUIResponse.js.map +1 -1
  159. package/lib/modularui/__tests__/CustomContextPath.spec.js.flow +61 -0
  160. package/lib/redux/_modularui/ModularUIActions.js +3 -1
  161. package/lib/redux/_modularui/ModularUIActions.js.flow +6 -1
  162. package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
  163. package/lib/redux/_modularui/ModularUIMiddleware.js +6 -0
  164. package/lib/redux/_modularui/ModularUIMiddleware.js.flow +10 -0
  165. package/lib/redux/_modularui/ModularUIMiddleware.js.map +1 -1
  166. package/lib/redux/_modularui/types.js.flow +2 -0
  167. package/lib/redux/_modularui/types.js.map +1 -1
  168. package/lib/redux/actions/Application.js +2 -0
  169. package/lib/redux/actions/Application.js.flow +1 -0
  170. package/lib/redux/actions/Application.js.map +1 -1
  171. package/lib/redux/connectors/PanelRenderer.js +2 -0
  172. package/lib/redux/connectors/PanelRenderer.js.flow +1 -0
  173. package/lib/redux/connectors/PanelRenderer.js.map +1 -1
  174. package/lib/utils/fetch/types.js.flow +2 -0
  175. package/lib/utils/fetch/types.js.map +1 -1
  176. package/lib/utils/helpers/checkResource.js +2 -0
  177. package/lib/utils/helpers/checkResource.js.flow +2 -0
  178. package/lib/utils/helpers/checkResource.js.map +1 -1
  179. package/package.json +1 -1
  180. package/src/constants/Settings.js +2 -2
  181. package/src/hooks/useForm.js +2 -0
  182. package/src/hooks/useModularUIBasic.js +14 -0
  183. package/src/hooks/useModularUIModel.js +58 -11
  184. package/src/models/actions/ActionCollection.js +14 -2
  185. package/src/models/actions/ActionModel.js +38 -16
  186. package/src/models/application/ApplicationModel.js +7 -1
  187. package/src/models/base/ResourceModel.js +35 -10
  188. package/src/models/caseview/CaseViewModel.js +3 -1
  189. package/src/models/concepts/ConceptLinkModel.js +1 -0
  190. package/src/models/concepts/SourceReferenceModel.js +2 -1
  191. package/src/models/content/ContentIndexModel.js +2 -2
  192. package/src/models/content/ContentLinkModel.js +2 -0
  193. package/src/models/content/SectionModel.js +1 -0
  194. package/src/models/detail/DetailModel.js +2 -0
  195. package/src/models/error/ErrorResponse.js +2 -0
  196. package/src/models/form/FormModel.js +1 -1
  197. package/src/models/href/Href.js +58 -3
  198. package/src/models/href/ListHref.js +1 -1
  199. package/src/models/links/LinkCollection.js +8 -2
  200. package/src/models/links/LinkModel.js +24 -16
  201. package/src/models/list/ListItemModel.js +4 -0
  202. package/src/models/list/ListModel.js +6 -1
  203. package/src/models/panels/GroupingPanelModel.js +2 -0
  204. package/src/models/tab/TabModel.js +4 -0
  205. package/src/models/taskgroup/TaskGroupModel.js +6 -0
  206. package/src/modularui/Authenticate.js +2 -1
  207. package/src/modularui/ModularUIRequest.js +49 -8
  208. package/src/modularui/ModularUIResponse.js +35 -0
  209. package/src/modularui/__tests__/CustomContextPath.spec.js +61 -0
  210. package/src/modularui/__tests__/contributions.json +312 -0
  211. package/src/modularui/__tests__/data.json +263 -0
  212. package/src/redux/_modularui/ModularUIActions.js +6 -1
  213. package/src/redux/_modularui/ModularUIMiddleware.js +10 -0
  214. package/src/redux/_modularui/types.js +2 -0
  215. package/src/redux/actions/Application.js +1 -0
  216. package/src/redux/connectors/PanelRenderer.js +1 -0
  217. package/src/utils/fetch/types.js +2 -0
  218. package/src/utils/helpers/checkResource.js +2 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ModularUIActions.js","names":["HTTP_METHODS","MODULARUI_STATUS","Href","ErrorResponse","finishProgress","startProgress","handleError","setModel","key","model","connectKey","type","payload","initModels","models","updateModel","updateForm","removeModelByKey","resetModularUI","updateStatus","status","loadModelSuccessAction","updateHandler","loadModel","href","options","method","GET","data","locale","childmodels","targetModel","forceTargetModel","cache","successAction","errorAction","error","errorResponse","isChangePassword","isResourceNotFoundAfterReload","ERROR","loadModularUI","dispatch","LOADING","loadModelPromise","_Promise","resolve","then","response","FINISHED","catch","reloadModel","selfhref","isReload"],"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): UpdateStatusAction => ({\n type: \"MODULARUI/STATUS\",\n payload: { key, status },\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 * 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 href: href instanceof Href ? href : new Href(href),\n method: options?.method ?? HTTP_METHODS.GET,\n data: options?.data,\n locale: options?.locale ?? \"en\",\n childmodels: options?.childmodels,\n targetModel: options?.targetModel,\n forceTargetModel: options?.forceTargetModel,\n cache: options?.cache,\n /**\n */\n successAction: (model) =>\n loadModelSuccessAction(key, model, options?.updateHandler),\n /**\n */\n errorAction: (error) => {\n const errorResponse = new ErrorResponse(error, key);\n if (errorResponse.isChangePassword) {\n return {\n type: \"NO_ACTION\",\n };\n } else if (errorResponse.isResourceNotFoundAfterReload) {\n return removeModelByKey(key);\n }\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 ): ThunkAction =>\n (dispatch: Dispatch) => {\n dispatch(updateStatus(key, MODULARUI_STATUS.LOADING));\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then((response) => {\n if (response?.type === \"FINISH_PROGRESS\") {\n dispatch(updateStatus(key, MODULARUI_STATUS.FINISHED));\n }\n\n return dispatch(finishProgress());\n })\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,SAASA,YAAY,EAAEC,gBAAgB,QAAQ,2BAA2B;AAC1E,OAAOC,IAAI,MAAM,wBAAwB;AACzC,OAAOC,aAAa,MAAM,kCAAkC;AAC5D,SAASC,cAAc,EAAEC,aAAa,QAAQ,8BAA8B;AAC5E,SAASC,WAAW,QAAQ,kBAAkB;AAmB9C;AACA;AACA,OAAO,MAAMC,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;AACA,OAAO,MAAMI,UAAU,GACrBC,MAAqD,KAChC;EACrBH,IAAI,EAAE,gBAAgB;EACtBC,OAAO,EAAEE;AACX,CAAC,CAAC;;AAEF;AACA;AACA,OAAO,MAAMC,WAAW,GAAIN,KAAqB,KAAyB;EACxEE,IAAI,EAAE,kBAAkB;EACxBC,OAAO,EAAEH;AACX,CAAC,CAAC;;AAEF;AACA;AACA,OAAO,MAAMO,UAAU,GAAIP,KAAqB,KAAwB;EACtEE,IAAI,EAAE,uBAAuB;EAC7BC,OAAO,EAAEH;AACX,CAAC,CAAC;;AAEF;AACA;AACA,OAAO,MAAMQ,gBAAgB,GAAIT,GAAW,KAA8B;EACxEG,IAAI,EAAE,sBAAsB;EAC5BC,OAAO,EAAEJ;AACX,CAAC,CAAC;;AAEF;AACA;AACA;AAC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O;EACV4B,QAAQ,EAAE;AACZ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"ModularUIActions.js","names":["HTTP_METHODS","MODULARUI_STATUS","Href","ErrorResponse","finishProgress","startProgress","handleError","setModel","key","model","connectKey","type","payload","initModels","models","updateModel","updateForm","removeModelByKey","resetModularUI","updateStatus","status","loadModelSuccessAction","updateHandler","loadModel","href","options","origin","contextPath","method","GET","data","locale","childmodels","targetModel","forceTargetModel","cache","successAction","errorAction","error","errorResponse","isChangePassword","isResourceNotFoundAfterReload","ERROR","loadModularUI","dispatch","LOADING","loadModelPromise","_Promise","resolve","then","response","FINISHED","catch","reloadModel","selfhref","isReload"],"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): UpdateStatusAction => ({\n type: \"MODULARUI/STATUS\",\n payload: { key, status },\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 * 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 origin: options?.origin,\n contextPath: options?.contextPath,\n href:\n href instanceof Href\n ? href\n : new Href(href, \"\", options?.origin, options?.contextPath),\n method: options?.method ?? HTTP_METHODS.GET,\n data: options?.data,\n locale: options?.locale ?? \"en\",\n childmodels: options?.childmodels,\n targetModel: options?.targetModel,\n forceTargetModel: options?.forceTargetModel,\n cache: options?.cache,\n /**\n */\n successAction: (model) =>\n loadModelSuccessAction(key, model, options?.updateHandler),\n /**\n */\n errorAction: (error) => {\n const errorResponse = new ErrorResponse(error, key);\n if (errorResponse.isChangePassword) {\n return {\n type: \"NO_ACTION\",\n };\n } else if (errorResponse.isResourceNotFoundAfterReload) {\n return removeModelByKey(key);\n }\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 ): ThunkAction =>\n (dispatch: Dispatch) => {\n dispatch(updateStatus(key, MODULARUI_STATUS.LOADING));\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then((response) => {\n if (response?.type === \"FINISH_PROGRESS\") {\n dispatch(updateStatus(key, MODULARUI_STATUS.FINISHED));\n }\n\n return dispatch(finishProgress());\n })\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,SAASA,YAAY,EAAEC,gBAAgB,QAAQ,2BAA2B;AAC1E,OAAOC,IAAI,MAAM,wBAAwB;AACzC,OAAOC,aAAa,MAAM,kCAAkC;AAC5D,SAASC,cAAc,EAAEC,aAAa,QAAQ,8BAA8B;AAC5E,SAASC,WAAW,QAAQ,kBAAkB;AAmB9C;AACA;AACA,OAAO,MAAMC,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;AACA,OAAO,MAAMI,UAAU,GACrBC,MAAqD,KAChC;EACrBH,IAAI,EAAE,gBAAgB;EACtBC,OAAO,EAAEE;AACX,CAAC,CAAC;;AAEF;AACA;AACA,OAAO,MAAMC,WAAW,GAAIN,KAAqB,KAAyB;EACxEE,IAAI,EAAE,kBAAkB;EACxBC,OAAO,EAAEH;AACX,CAAC,CAAC;;AAEF;AACA;AACA,OAAO,MAAMO,UAAU,GAAIP,KAAqB,KAAwB;EACtEE,IAAI,EAAE,uBAAuB;EAC7BC,OAAO,EAAEH;AACX,CAAC,CAAC;;AAEF;AACA;AACA,OAAO,MAAMQ,gBAAgB,GAAIT,GAAW,KAA8B;EACxEG,IAAI,EA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AACgC,KAAK,CAAC,CAAC,CAAC;AACnD,CAAC;;AAEH;AACA;AACA,OAAO,MAAMe,WAAW,GAAGA,CACzB5C,KAAqB,EACrBgB,OAAiC,KAEjCkB,aAAa,CAAClC,KAAK,CAACC,UAAU,EAAED,KAAK,CAAC6C,QAAQ,EAAE;EAC9C,GAAG7B,OAAO;EACV8B,QAAQ,EAAE;AACZ,CAAC,CAAC","ignoreList":[]}
@@ -15,6 +15,12 @@ const createRequest = modularui => {
15
15
  isReload: modularui.isReload,
16
16
  cache: modularui.cache
17
17
  });
18
+ if (modularui.origin) {
19
+ request.origin = modularui.origin;
20
+ }
21
+ if (modularui.contextPath) {
22
+ request.contextPath = modularui.contextPath;
23
+ }
18
24
  if (modularui.targetModel) {
19
25
  request.targetModel = modularui.targetModel;
20
26
  request.forceTargetModel = modularui.forceTargetModel ?? false;
@@ -1 +1 @@
1
- {"version":3,"file":"ModularUIMiddleware.js","names":["ModularUIRequest","HTTP_METHODS","startProgress","finishProgress","handleError","createRequest","modularui","request","href","method","GET","data","locale","childmodels","isReload","cache","targetModel","forceTargetModel","responseHandler","next","dispatch","successAction","model","successResult","_Promise","then","result","catch","error","Error","errorHandler","errorAction","err","errorResult","handleFetch","action","requestOptions","payload","modularuiRequest","fetch","modularUIMiddleware","api","type","getState","i18n"],"sources":["../../../src/redux/_modularui/ModularUIMiddleware.js"],"sourcesContent":["// @flow\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\nimport { HTTP_METHODS } from \"../../constants/Constants\";\n\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport { handleError } from \"../actions/Error\";\n\nimport type { Middleware, MiddlewareAPI } from \"redux\";\nimport type {\n ReduxAction,\n ReduxState,\n Dispatch,\n PossibleAction,\n} from \"../types\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { ModularUIAction, SuccessAction, ErrorAction } from \"./types\";\nimport type { TargetModel } from \"../../modularui/types\";\n\ntype RequestOptions = {\n href: Href,\n method?: $Keys<typeof HTTP_METHODS>,\n data?: any,\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n isReload?: boolean,\n cache?: boolean,\n};\n\n/**\n * Symbol key that carries API call info interpreted by this Redux middleware.\n */\nconst createRequest = (modularui: RequestOptions): ModularUIRequest => {\n const request = new ModularUIRequest(modularui.href, {\n method: modularui.method || HTTP_METHODS.GET,\n data: modularui.data || {},\n locale: modularui.locale,\n childmodels: modularui.childmodels ?? true,\n isReload: modularui.isReload,\n cache: modularui.cache,\n });\n\n if (modularui.targetModel) {\n request.targetModel = modularui.targetModel;\n request.forceTargetModel = modularui.forceTargetModel ?? false;\n }\n\n return request;\n};\n\n/**\n */\nconst responseHandler = (\n next: Dispatch,\n dispatch: Dispatch,\n successAction: SuccessAction,\n model: ModularUIModel,\n) => {\n if (successAction) {\n const successResult = successAction(model);\n\n if (successResult instanceof Promise) {\n successResult\n .then((result) => {\n dispatch(result);\n })\n .catch((error) => {\n next(handleError(error));\n });\n } else {\n try {\n dispatch(successResult);\n } catch (error) {\n throw new Error(\n `Result of successResult is not a valid redux action: ${error}`,\n );\n }\n }\n }\n\n return next(finishProgress());\n};\n\n/**\n */\nconst errorHandler = (\n next: Dispatch,\n dispatch: Dispatch,\n errorAction: ?ErrorAction,\n err: any,\n) => {\n dispatch(finishProgress());\n\n if (errorAction) {\n const errorResult = errorAction(err);\n\n if (errorResult instanceof Promise) {\n errorResult.then((result) => dispatch(result));\n } else {\n dispatch(errorResult);\n }\n }\n\n return next(handleError(err));\n};\n\n/**\n */\nconst handleFetch = (\n action: ModularUIAction,\n locale: string,\n dispatch: Dispatch,\n next: Dispatch,\n) => {\n dispatch(startProgress());\n\n const { successAction, errorAction, ...requestOptions } = action.payload;\n requestOptions.locale = locale;\n\n const modularuiRequest = createRequest(requestOptions);\n\n return modularuiRequest\n .fetch()\n .then((model) => responseHandler(next, dispatch, successAction, model))\n .catch((error) => errorHandler(next, dispatch, errorAction, error));\n};\n\n/**\n */\nexport const modularUIMiddleware: Middleware<\n ReduxState,\n ReduxAction,\n Dispatch,\n> =\n (api: MiddlewareAPI<ReduxState, ReduxAction, Dispatch>) =>\n (next: Dispatch) =>\n (action: PossibleAction) => {\n if (action.type === \"MODULARUI/FETCH\") {\n return handleFetch(\n // $FlowExpectedError[incompatible-exact]\n action,\n api.getState().i18n.locale,\n api.dispatch,\n next,\n );\n }\n\n return next(action);\n };\n"],"mappings":";AACA,OAAOA,gBAAgB,MAAM,kCAAkC;AAC/D,SAASC,YAAY,QAAQ,2BAA2B;AAExD,SAASC,aAAa,EAAEC,cAAc,QAAQ,8BAA8B;AAE5E,SAASC,WAAW,QAAQ,kBAAkB;AA0B9C;AACA;AACA;AACA,MAAMC,aAAa,GAAIC,SAAyB,IAAuB;EACrE,MAAMC,OAAO,GAAG,IAAIP,gBAAgB,CAACM,SAAS,CAACE,IAAI,EAAE;IACnDC,MAAM,EAAEH,SAAS,CAACG,MAAM,IAAIR,YAAY,CAACS,GAAG;IAC5CC,IAAI,EAAEL,SAAS,CAACK,IAAI,IAAI,CAAC,CAAC;IAC1BC,MAAM,EAAEN,SAAS,CAACM,MAAM;IACxBC,WAAW,EAAEP,SAAS,CAACO,WAAW,IAAI,IAAI;IAC1CC,QAAQ,EAAER,SAAS,CAACQ,QAAQ;IAC5BC,KAAK,EAAET,SAAS,CAACS;EACnB,CAAC,CAAC;EAEF,IAAIT,SAAS,CAACU,WAAW,EAAE;IACzBT,OAAO,CAACS,WAAW,GAAGV,SAAS,CAACU,WAAW;IAC3CT,OAAO,CAACU,gBAAgB,GAAGX,SAAS,CAACW,gBAAgB,IAAI,KAAK;EAChE;EAEA,OAAOV,OAAO;AAChB,CAAC;;AAED;AACA;AACA,MAAMW,eAAe,GAAGA,CACtBC,IAAc,EACdC,QAAkB,EAClBC,aAA4B,EAC5BC,KAAqB,KAClB;EACH,IAAID,aAAa,EAAE;IACjB,MAAME,aAAa,GAAGF,aAAa,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,MAAM0B,gBAAgB,GAAGjC,aAAa,CAAC+B,cAAc,CAAC;EAEtD,OAAOE,gBAAgB,CACpBC,KAAK,CAAC,CAAC,CACPd,IAAI,CAAEH,KAAK,IAAKJ,eAAe,CAACC,IAAI,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,KAAK,CAAC,CAAC,CACtEK,KAAK,CAAEC,KAAK,IAAKE,YAAY,CAACX,IAAI,EAAEC,QAAQ,EAAEW,WAAW,EAAEH,KAAK,CAAC,CAAC;AACvE,CAAC;;AAED;AACA;AACA,OAAO,MAAMY,mBAIZ,GACEC,GAAqD,IACrDtB,IAAc,IACdgB,MAAsB,IAAK;EAC1B,IAAIA,MAAM,CAACO,IAAI,KAAK,iBAAiB,EAAE;IACrC,OAAOR,WAAW;IAChB;IACAC,MAAM,EACNM,GAAG,CAACE,QAAQ,CAAC,CAAC,CAACC,IAAI,CAAChC,MAAM,EAC1B6B,GAAG,CAACrB,QAAQ,EACZD,IACF,CAAC;EACH;EAEA,OAAOA,IAAI,CAACgB,MAAM,CAAC;AACrB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"ModularUIMiddleware.js","names":["ModularUIRequest","HTTP_METHODS","startProgress","finishProgress","handleError","createRequest","modularui","request","href","method","GET","data","locale","childmodels","isReload","cache","origin","contextPath","targetModel","forceTargetModel","responseHandler","next","dispatch","successAction","model","successResult","_Promise","then","result","catch","error","Error","errorHandler","errorAction","err","errorResult","handleFetch","action","requestOptions","payload","modularuiRequest","fetch","modularUIMiddleware","api","type","getState","i18n"],"sources":["../../../src/redux/_modularui/ModularUIMiddleware.js"],"sourcesContent":["// @flow\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\nimport { HTTP_METHODS } from \"../../constants/Constants\";\n\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport { handleError } from \"../actions/Error\";\n\nimport type { Middleware, MiddlewareAPI } from \"redux\";\nimport type {\n ReduxAction,\n ReduxState,\n Dispatch,\n PossibleAction,\n} from \"../types\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { ModularUIAction, SuccessAction, ErrorAction } from \"./types\";\nimport type { TargetModel } from \"../../modularui/types\";\n\ntype RequestOptions = {\n origin?: string,\n contextPath?: string,\n href: Href,\n method?: $Keys<typeof HTTP_METHODS>,\n data?: any,\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n isReload?: boolean,\n cache?: boolean,\n};\n\n/**\n * Symbol key that carries API call info interpreted by this Redux middleware.\n */\nconst createRequest = (modularui: RequestOptions): ModularUIRequest => {\n const request = new ModularUIRequest(modularui.href, {\n method: modularui.method || HTTP_METHODS.GET,\n data: modularui.data || {},\n locale: modularui.locale,\n childmodels: modularui.childmodels ?? true,\n isReload: modularui.isReload,\n cache: modularui.cache,\n });\n\n if (modularui.origin) {\n request.origin = modularui.origin;\n }\n\n if (modularui.contextPath) {\n request.contextPath = modularui.contextPath;\n }\n\n if (modularui.targetModel) {\n request.targetModel = modularui.targetModel;\n request.forceTargetModel = modularui.forceTargetModel ?? false;\n }\n\n return request;\n};\n\n/**\n */\nconst responseHandler = (\n next: Dispatch,\n dispatch: Dispatch,\n successAction: SuccessAction,\n model: ModularUIModel,\n) => {\n if (successAction) {\n const successResult = successAction(model);\n\n if (successResult instanceof Promise) {\n successResult\n .then((result) => {\n dispatch(result);\n })\n .catch((error) => {\n next(handleError(error));\n });\n } else {\n try {\n dispatch(successResult);\n } catch (error) {\n throw new Error(\n `Result of successResult is not a valid redux action: ${error}`,\n );\n }\n }\n }\n\n return next(finishProgress());\n};\n\n/**\n */\nconst errorHandler = (\n next: Dispatch,\n dispatch: Dispatch,\n errorAction: ?ErrorAction,\n err: any,\n) => {\n dispatch(finishProgress());\n\n if (errorAction) {\n const errorResult = errorAction(err);\n\n if (errorResult instanceof Promise) {\n errorResult.then((result) => dispatch(result));\n } else {\n dispatch(errorResult);\n }\n }\n\n return next(handleError(err));\n};\n\n/**\n */\nconst handleFetch = (\n action: ModularUIAction,\n locale: string,\n dispatch: Dispatch,\n next: Dispatch,\n) => {\n dispatch(startProgress());\n\n const { successAction, errorAction, ...requestOptions } = action.payload;\n requestOptions.locale = locale;\n\n const modularuiRequest = createRequest(requestOptions);\n\n return modularuiRequest\n .fetch()\n .then((model) => responseHandler(next, dispatch, successAction, model))\n .catch((error) => errorHandler(next, dispatch, errorAction, error));\n};\n\n/**\n */\nexport const modularUIMiddleware: Middleware<\n ReduxState,\n ReduxAction,\n Dispatch,\n> =\n (api: MiddlewareAPI<ReduxState, ReduxAction, Dispatch>) =>\n (next: Dispatch) =>\n (action: PossibleAction) => {\n if (action.type === \"MODULARUI/FETCH\") {\n return handleFetch(\n // $FlowExpectedError[incompatible-exact]\n action,\n api.getState().i18n.locale,\n api.dispatch,\n next,\n );\n }\n\n return next(action);\n };\n"],"mappings":";AACA,OAAOA,gBAAgB,MAAM,kCAAkC;AAC/D,SAASC,YAAY,QAAQ,2BAA2B;AAExD,SAASC,aAAa,EAAEC,cAAc,QAAQ,8BAA8B;AAE5E,SAASC,WAAW,QAAQ,kBAAkB;AA4B9C;AACA;AACA;AACA,MAAMC,aAAa,GAAIC,SAAyB,IAAuB;EACrE,MAAMC,OAAO,GAAG,IAAIP,gBAAgB,CAACM,SAAS,CAACE,IAAI,EAAE;IACnDC,MAAM,EAAEH,SAAS,CAACG,MAAM,IAAIR,YAAY,CAACS,GAAG;IAC5CC,IAAI,EAAEL,SAAS,CAACK,IAAI,IAAI,CAAC,CAAC;IAC1BC,MAAM,EAAEN,SAAS,CAACM,MAAM;IACxBC,WAAW,EAAEP,SAAS,CAACO,WAAW,IAAI,IAAI;IAC1CC,QAAQ,EAAER,SAAS,CAACQ,QAAQ;IAC5BC,KAAK,EAAET,SAAS,CAACS;EACnB,CAAC,CAAC;EAEF,IAAIT,SAAS,CAACU,MAAM,EAAE;IACpBT,OAAO,CAACS,MAAM,GAAGV,SAAS,CAACU,MAAM;EACnC;EAEA,IA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AAQ,CAACM,MAAM,CAAC,CAAC;IAChD,CAAC,MAAM;MACLN,QAAQ,CAACa,WAAW,CAAC;IACvB;EACF;EAEA,OAAOd,IAAI,CAACjB,WAAW,CAAC8B,GAAG,CAAC,CAAC;AAC/B,CAAC;;AAED;AACA;AACA,MAAME,WAAW,GAAGA,CAClBC,MAAuB,EACvBzB,MAAc,EACdU,QAAkB,EAClBD,IAAc,KACX;EACHC,QAAQ,CAACpB,aAAa,CAAC,CAAC,CAAC;EAEzB,MAAM;IAAEqB,aAAa;IAAEU,WAAW;IAAE,GAAGK;EAAe,CAAC,GAAGD,MAAM,CAACE,OAAO;EACxED,cAAc,CAAC1B,MAAM,GAAGA,MAAM;EAE9B,MAAM4B,gBAAgB,GAAGnC,aAAa,CAACiC,cAAc,CAAC;EAEtD,OAAOE,gBAAgB,CACpBC,KAAK,CAAC,CAAC,CACPd,IAAI,CAAEH,KAAK,IAAKJ,eAAe,CAACC,IAAI,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,KAAK,CAAC,CAAC,CACtEK,KAAK,CAAEC,KAAK,IAAKE,YAAY,CAACX,IAAI,EAAEC,QAAQ,EAAEW,WAAW,EAAEH,KAAK,CAAC,CAAC;AACvE,CAAC;;AAED;AACA;AACA,OAAO,MAAMY,mBAIZ,GACEC,GAAqD,IACrDtB,IAAc,IACdgB,MAAsB,IAAK;EAC1B,IAAIA,MAAM,CAACO,IAAI,KAAK,iBAAiB,EAAE;IACrC,OAAOR,WAAW;IAChB;IACAC,MAAM,EACNM,GAAG,CAACE,QAAQ,CAAC,CAAC,CAACC,IAAI,CAAClC,MAAM,EAC1B+B,GAAG,CAACrB,QAAQ,EACZD,IACF,CAAC;EACH;EAEA,OAAOA,IAAI,CAACgB,MAAM,CAAC;AACrB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_modularui/types.js"],"sourcesContent":["// @flow\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { FetchException } from \"../../exceptions\";\nimport type { NoAction } from \"../types\";\nimport typeof {\n HTTP_METHODS,\n MODULARUI_STATUS,\n} from \"../../constants/Constants\";\nimport type { ComponentType } from \"react\";\nimport type { TargetModel } from \"../../modularui/types\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\nexport type ModularUIOptions = {\n propName?: string,\n removeOnUnmount?: boolean,\n ...RequestModularUIOptions,\n};\n\nexport type ModelEntry = {\n +status: string,\n +model: ModularUIModel,\n +lastModification: number,\n};\n\nexport type ModularUIState = {\n [string]: ModelEntry,\n ...\n};\n\nexport type SetModelAction = {\n type: \"MODULARUI/SET\",\n payload: {\n key: string,\n model: ?ModularUIModel,\n },\n};\n\nexport type InitModelAction = {\n type: \"MODULARUI/INIT\",\n payload: Array<{\n key: string,\n model: ModularUIModel,\n }>,\n};\n\nexport type UpdateModelAction = {\n type: \"MODULARUI/UPDATE\",\n payload: ModularUIModel,\n};\n\nexport type UpdateFormAction = {\n type: \"MODULARUI/UPDATE_FORM\",\n payload: ModularUIModel,\n};\n\nexport type SuccessAction = (\n model: ModularUIModel,\n) => UpdateModelAction | SetModelAction;\n\nexport type ErrorAction = (\n error: FetchException,\n) => UpdateStatusAction | RemoveModelByKeyAction | NoAction;\n\nexport type ModularUIAction = {\n type: \"MODULARUI/FETCH\",\n payload: {\n href: Href,\n method?: $Keys<HTTP_METHODS>,\n data?: any,\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n cache?: boolean,\n successAction: (\n model: ModularUIModel,\n ) => UpdateModelAction | SetModelAction,\n errorAction?: ErrorAction,\n },\n};\n\nexport type RemoveModelByKeyAction = {\n type: \"MODULARUI/REMOVE_KEY\",\n payload: string,\n};\n\nexport type ResetModularUIAction = {\n type: \"MODULARUI/RESET\",\n};\n\nexport type UpdateStatusAction = {\n type: \"MODULARUI/STATUS\",\n payload: {\n key: string,\n status: $Keys<MODULARUI_STATUS>,\n },\n};\n\nexport type ModularUIConnector = (\n Component: ComponentType<any>,\n) => ComponentType<any>;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_modularui/types.js"],"sourcesContent":["// @flow\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { FetchException } from \"../../exceptions\";\nimport type { NoAction } from \"../types\";\nimport typeof {\n HTTP_METHODS,\n MODULARUI_STATUS,\n} from \"../../constants/Constants\";\nimport type { ComponentType } from \"react\";\nimport type { TargetModel } from \"../../modularui/types\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\nexport type ModularUIOptions = {\n propName?: string,\n removeOnUnmount?: boolean,\n ...RequestModularUIOptions,\n};\n\nexport type ModelEntry = {\n +status: string,\n +model: ModularUIModel,\n +lastModification: number,\n};\n\nexport type ModularUIState = {\n [string]: ModelEntry,\n ...\n};\n\nexport type SetModelAction = {\n type: \"MODULARUI/SET\",\n payload: {\n key: string,\n model: ?ModularUIModel,\n },\n};\n\nexport type InitModelAction = {\n type: \"MODULARUI/INIT\",\n payload: Array<{\n key: string,\n model: ModularUIModel,\n }>,\n};\n\nexport type UpdateModelAction = {\n type: \"MODULARUI/UPDATE\",\n payload: ModularUIModel,\n};\n\nexport type UpdateFormAction = {\n type: \"MODULARUI/UPDATE_FORM\",\n payload: ModularUIModel,\n};\n\nexport type SuccessAction = (\n model: ModularUIModel,\n) => UpdateModelAction | SetModelAction;\n\nexport type ErrorAction = (\n error: FetchException,\n) => UpdateStatusAction | RemoveModelByKeyAction | NoAction;\n\nexport type ModularUIAction = {\n type: \"MODULARUI/FETCH\",\n payload: {\n origin?: string,\n contextPath?: string,\n href: Href,\n method?: $Keys<HTTP_METHODS>,\n data?: any,\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n cache?: boolean,\n successAction: (\n model: ModularUIModel,\n ) => UpdateModelAction | SetModelAction,\n errorAction?: ErrorAction,\n },\n};\n\nexport type RemoveModelByKeyAction = {\n type: \"MODULARUI/REMOVE_KEY\",\n payload: string,\n};\n\nexport type ResetModularUIAction = {\n type: \"MODULARUI/RESET\",\n};\n\nexport type UpdateStatusAction = {\n type: \"MODULARUI/STATUS\",\n payload: {\n key: string,\n status: $Keys<MODULARUI_STATUS>,\n },\n};\n\nexport type ModularUIConnector = (\n Component: ComponentType<any>,\n) => ComponentType<any>;\n"],"mappings":"","ignoreList":[]}
@@ -9,6 +9,8 @@ export const reloadApplication = () => (dispatch, getState) => {
9
9
  for (const key of allKeys) {
10
10
  dispatch(removeModelByKey(key));
11
11
  }
12
+
13
+ // TODO SBO: origin and context
12
14
  const modelKey = `application(/)(${getLocale(getState())})`;
13
15
  return dispatch(loadModularUI(modelKey, new Href("/", "Application"), {
14
16
  targetModel: ApplicationModel
@@ -1 +1 @@
1
- {"version":3,"file":"Application.js","names":["loadModularUI","removeModelByKey","allKeysByHref","ApplicationModel","Href","getLocale","reloadApplication","dispatch","getState","allKeys","key","modelKey","targetModel"],"sources":["../../../src/redux/actions/Application.js"],"sourcesContent":["// @flow\nimport {\n loadModularUI,\n removeModelByKey,\n} from \"../_modularui/ModularUIActions\";\nimport { allKeysByHref } from \"../_modularui/ModularUISelectors\";\nimport { ApplicationModel, Href } from \"../../models\";\nimport { getLocale } from \"../selectors/i18n\";\n\nimport type { Dispatch, GetState, ThunkAction } from \"../types\";\n\n/**\n */\nexport const reloadApplication =\n (): ThunkAction => (dispatch: Dispatch, getState: GetState) => {\n const allKeys = allKeysByHref(getState(), \"/\");\n for (const key of allKeys) {\n dispatch(removeModelByKey(key));\n }\n\n const modelKey = `application(/)(${getLocale(getState())})`;\n return dispatch(\n loadModularUI(modelKey, new Href(\"/\", \"Application\"), {\n targetModel: ApplicationModel,\n }),\n );\n };\n"],"mappings":"AACA,SACEA,aAAa,EACbC,gBAAgB,QACX,gCAAgC;AACvC,SAASC,aAAa,QAAQ,kCAAkC;AAChE,SAASC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AACrD,SAASC,SAAS,QAAQ,mBAAmB;AAI7C;AACA;AACA,OAAO,MAAMC,iBAAiB,GAC5BA,CAAA,KAAmB,CAACC,QAAkB,EAAEC,QAAkB,KAAK;EAC7D,MAAMC,OAAO,GAAGP,aAAa,CAACM,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;EAC9C,KAAK,MAAME,GAAG,IAAID,OAAO,EAAE;IACzBF,QAAQ,CAACN,gBAAgB,CAACS,GAAG,CAAC,CAAC;EACjC;EAEA,MAAMC,QAAQ,GAAG,kBAAkBN,SAAS,CAACG,QAAQ,CAAC,CAAC,CAAC,GAAG;EAC3D,OAAOD,QAAQ,CACbP,aAAa,CAACW,QAAQ,EAAE,IAAIP,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC,EAAE;IACpDQ,WAAW,EAAET;EACf,CAAC,CACH,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Application.js","names":["loadModularUI","removeModelByKey","allKeysByHref","ApplicationModel","Href","getLocale","reloadApplication","dispatch","getState","allKeys","key","modelKey","targetModel"],"sources":["../../../src/redux/actions/Application.js"],"sourcesContent":["// @flow\nimport {\n loadModularUI,\n removeModelByKey,\n} from \"../_modularui/ModularUIActions\";\nimport { allKeysByHref } from \"../_modularui/ModularUISelectors\";\nimport { ApplicationModel, Href } from \"../../models\";\nimport { getLocale } from \"../selectors/i18n\";\n\nimport type { Dispatch, GetState, ThunkAction } from \"../types\";\n\n/**\n */\nexport const reloadApplication =\n (): ThunkAction => (dispatch: Dispatch, getState: GetState) => {\n const allKeys = allKeysByHref(getState(), \"/\");\n for (const key of allKeys) {\n dispatch(removeModelByKey(key));\n }\n\n // TODO SBO: origin and context\n const modelKey = `application(/)(${getLocale(getState())})`;\n return dispatch(\n loadModularUI(modelKey, new Href(\"/\", \"Application\"), {\n targetModel: ApplicationModel,\n }),\n );\n };\n"],"mappings":"AACA,SACEA,aAAa,EACbC,gBAAgB,QACX,gCAAgC;AACvC,SAASC,aAAa,QAAQ,kCAAkC;AAChE,SAASC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AACrD,SAASC,SAAS,QAAQ,mBAAmB;AAI7C;AACA;AACA,OAAO,MAAMC,iBAAiB,GAC5BA,CAAA,KAAmB,CAACC,QAAkB,EAAEC,QAAkB,KAAK;EAC7D,MAAMC,OAAO,GAAGP,aAAa,CAACM,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;EAC9C,KAAK,MAAME,GAAG,IAAID,OAAO,EAAE;IACzBF,QAAQ,CAACN,gBAAgB,CAACS,GAAG,CAAC,CAAC;EACjC;;EAEA;EACA,MAAMC,QAAQ,GAAG,kBAAkBN,SAAS,CAACG,QAAQ,CAAC,CAAC,CAAC,GAAG;EAC3D,OAAOD,QAAQ,CACbP,aAAa,CAACW,QAAQ,EAAE,IAAIP,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC,EAAE;IACpDQ,WAAW,EAAET;EACf,CAAC,CACH,CAAC;AACH,CAAC","ignoreList":[]}
@@ -11,6 +11,8 @@ export const connectPanel = modularui("PanelRenderer", _ref => {
11
11
  if (!href && !match) {
12
12
  throw new Error("Cannot determine panel url because of missing href and match");
13
13
  }
14
+
15
+ // TODO SBO: origin and context?
14
16
  const panelHref = href ? new Href(href) : new Href(match.url);
15
17
  if (match && match.isExact) {
16
18
  panelHref.addParametersFromString(querystring);
@@ -1 +1 @@
1
- {"version":3,"file":"PanelRenderer.js","names":["modularui","Href","connectPanel","_ref","href","match","querystring","Error","panelHref","url","isExact","addParametersFromString","propName"],"sources":["../../../src/redux/connectors/PanelRenderer.js"],"sourcesContent":["// @flow\nimport modularui from \"../_modularui/ModularUIConnector\";\nimport Href from \"../../models/href/Href\";\n\nimport type { ModularUIConnector } from \"../_modularui/types\";\n\n/**\n */\nexport const connectPanel: ModularUIConnector = modularui(\n \"PanelRenderer\",\n ({ href, match, querystring = \"\" }) => {\n if (!href && !match) {\n throw new Error(\n \"Cannot determine panel url because of missing href and match\",\n );\n }\n\n const panelHref = href ? new Href(href) : new Href(match.url);\n\n if (match && match.isExact) {\n panelHref.addParametersFromString(querystring);\n }\n\n return panelHref;\n },\n {\n propName: \"panel\",\n },\n);\n"],"mappings":"AACA,OAAOA,SAAS,MAAM,kCAAkC;AACxD,OAAOC,IAAI,MAAM,wBAAwB;AAIzC;AACA;AACA,OAAO,MAAMC,YAAgC,GAAGF,SAAS,CACvD,eAAe,EACfG,IAAA,IAAuC;EAAA,IAAtC;IAAEC,IAAI;IAAEC,KAAK;IAAEC,WAAW,GAAG;EAAG,CAAC,GAAAH,IAAA;EAChC,IAAI,CAACC,IAAI,IAAI,CAACC,KAAK,EAAE;IACnB,MAAM,IAAIE,KAAK,CACb,8DACF,CAAC;EACH;EAEA,MAAMC,SAAS,GAAGJ,IAAI,GAAG,IAAIH,IAAI,CAACG,IAAI,CAAC,GAAG,IAAIH,IAAI,CAACI,KAAK,CAACI,GAAG,CAAC;EAE7D,IAAIJ,KAAK,IAAIA,KAAK,CAACK,OAAO,EAAE;IAC1BF,SAAS,CAACG,uBAAuB,CAACL,WAAW,CAAC;EAChD;EAEA,OAAOE,SAAS;AAClB,CAAC,EACD;EACEI,QAAQ,EAAE;AACZ,CACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"PanelRenderer.js","names":["modularui","Href","connectPanel","_ref","href","match","querystring","Error","panelHref","url","isExact","addParametersFromString","propName"],"sources":["../../../src/redux/connectors/PanelRenderer.js"],"sourcesContent":["// @flow\nimport modularui from \"../_modularui/ModularUIConnector\";\nimport Href from \"../../models/href/Href\";\n\nimport type { ModularUIConnector } from \"../_modularui/types\";\n\n/**\n */\nexport const connectPanel: ModularUIConnector = modularui(\n \"PanelRenderer\",\n ({ href, match, querystring = \"\" }) => {\n if (!href && !match) {\n throw new Error(\n \"Cannot determine panel url because of missing href and match\",\n );\n }\n\n // TODO SBO: origin and context?\n const panelHref = href ? new Href(href) : new Href(match.url);\n\n if (match && match.isExact) {\n panelHref.addParametersFromString(querystring);\n }\n\n return panelHref;\n },\n {\n propName: \"panel\",\n },\n);\n"],"mappings":"AACA,OAAOA,SAAS,MAAM,kCAAkC;AACxD,OAAOC,IAAI,MAAM,wBAAwB;AAIzC;AACA;AACA,OAAO,MAAMC,YAAgC,GAAGF,SAAS,CACvD,eAAe,EACfG,IAAA,IAAuC;EAAA,IAAtC;IAAEC,IAAI;IAAEC,KAAK;IAAEC,WAAW,GAAG;EAAG,CAAC,GAAAH,IAAA;EAChC,IAAI,CAACC,IAAI,IAAI,CAACC,KAAK,EAAE;IACnB,MAAM,IAAIE,KAAK,CACb,8DACF,CAAC;EACH;;EAEA;EACA,MAAMC,SAAS,GAAGJ,IAAI,GAAG,IAAIH,IAAI,CAACG,IAAI,CAAC,GAAG,IAAIH,IAAI,CAACI,KAAK,CAACI,GAAG,CAAC;EAE7D,IAAIJ,KAAK,IAAIA,KAAK,CAACK,OAAO,EAAE;IAC1BF,SAAS,CAACG,uBAAuB,CAACL,WAAW,CAAC;EAChD;EAEA,OAAOE,SAAS;AAClB,CAAC,EACD;EACEI,QAAQ,EAAE;AACZ,CACF,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/utils/fetch/types.js"],"sourcesContent":["// @flow\nimport typeof { HTTP_METHODS } from \"../../constants/Constants\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { TargetModel } from \"../../modularui/types\";\n\nexport type RequestURLOptions = {\n url: string,\n};\n\nexport type RequestBaseOptions = {\n method?: $Keys<HTTP_METHODS>,\n params?: string,\n data?: any,\n timeout?: number,\n responseType?: string,\n headers?: {\n [headerName: string]: string,\n Accept?: string,\n \"Accept-Language\"?: string,\n \"Content-Type\"?: string,\n \"x-filename\"?: string,\n \"x-filesize\"?: string,\n },\n events?: { [eventName: string]: () => void },\n onProgress?: ProgressEventHandler,\n includeContext?: boolean,\n locale?: string,\n cache?: boolean,\n isReload?: boolean,\n};\n\nexport type RequestOptions = { ...RequestURLOptions, ...RequestBaseOptions };\n\nexport type UpdateHandler = (newModel: ModularUIModel) => ModularUIModel;\nexport type RequestModularUIOptions = {\n ...RequestBaseOptions,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n updateHandler?: UpdateHandler | void,\n childmodels?: boolean,\n isValidationRequest?: boolean,\n removeOnUnmount?: boolean,\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/utils/fetch/types.js"],"sourcesContent":["// @flow\nimport typeof { HTTP_METHODS } from \"../../constants/Constants\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { TargetModel } from \"../../modularui/types\";\n\nexport type RequestURLOptions = {\n url: string,\n};\n\nexport type RequestBaseOptions = {\n origin?: string,\n contextPath?: string,\n method?: $Keys<HTTP_METHODS>,\n params?: string,\n data?: any,\n timeout?: number,\n responseType?: string,\n headers?: {\n [headerName: string]: string,\n Accept?: string,\n \"Accept-Language\"?: string,\n \"Content-Type\"?: string,\n \"x-filename\"?: string,\n \"x-filesize\"?: string,\n },\n events?: { [eventName: string]: () => void },\n onProgress?: ProgressEventHandler,\n includeContext?: boolean,\n locale?: string,\n cache?: boolean,\n isReload?: boolean,\n};\n\nexport type RequestOptions = { ...RequestURLOptions, ...RequestBaseOptions };\n\nexport type UpdateHandler = (newModel: ModularUIModel) => ModularUIModel;\nexport type RequestModularUIOptions = {\n ...RequestBaseOptions,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n updateHandler?: UpdateHandler | void,\n childmodels?: boolean,\n isValidationRequest?: boolean,\n removeOnUnmount?: boolean,\n};\n"],"mappings":"","ignoreList":[]}
@@ -9,6 +9,7 @@ import Href from "../../models/href/Href";
9
9
  * @returns {boolean}
10
10
  */
11
11
  export const resourceExists = url => {
12
+ // TODO SBO: origin and context?
12
13
  const fullUrl = new Href(url).absolutehref;
13
14
  const xhr = new XMLHttpRequest();
14
15
  xhr.open("HEAD", fullUrl, false);
@@ -25,6 +26,7 @@ export const resourceExists = url => {
25
26
  * @returns {boolean}
26
27
  */
27
28
  export const resourceRedirectsToSecureLogin = url => {
29
+ // TODO SBO: origin and context?
28
30
  const fullUrl = new Href(url).absolutehref;
29
31
  const xhr = new XMLHttpRequest();
30
32
  xhr.open("HEAD", fullUrl, false);
@@ -1 +1 @@
1
- {"version":3,"file":"checkResource.js","names":["Href","resourceExists","url","fullUrl","absolutehref","xhr","XMLHttpRequest","open","setRequestHeader","send","status","resourceRedirectsToSecureLogin","responseURL","_endsWithInstanceProperty","call"],"sources":["../../../src/utils/helpers/checkResource.js"],"sourcesContent":["// @flow\nimport Href from \"../../models/href/Href\";\n\n/**\n * Checks if a given url to a modular ui resource exists using a HEAD request to the resource (synchronous)\n * When the resource returns a 404, the resource does not exists and the method returns false\n *\n * @param url\n * @returns {boolean}\n */\nexport const resourceExists = (url: string | Href): boolean => {\n const fullUrl = new Href(url).absolutehref;\n\n const xhr = new XMLHttpRequest();\n xhr.open(\"HEAD\", fullUrl, false);\n xhr.setRequestHeader(\"Accept\", \"application/json\");\n xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n xhr.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\n\n xhr.send();\n\n return xhr.status !== 404;\n};\n\n/**\n * Indicates if a request to the given url resuls in a redirect to /secureRedirect\n * @param url\n * @returns {boolean}\n */\nexport const resourceRedirectsToSecureLogin = (url: string | Href): boolean => {\n const fullUrl = new Href(url).absolutehref;\n\n const xhr = new XMLHttpRequest();\n xhr.open(\"HEAD\", fullUrl, false);\n xhr.setRequestHeader(\"Accept\", \"application/json\");\n xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n xhr.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\n xhr.send();\n\n const responseURL = xhr.responseURL ?? \"\";\n\n return xhr.status === 400 && responseURL.endsWith(\"/secureLogin\");\n};\n"],"mappings":";AACA,OAAOA,IAAI,MAAM,wBAAwB;;AAEzC;AACA;AACA;AACA;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kResource.js","names":["Href","resourceExists","url","fullUrl","absolutehref","xhr","XMLHttpRequest","open","setRequestHeader","send","status","resourceRedirectsToSecureLogin","responseURL","_endsWithInstanceProperty","call"],"sources":["../../../src/utils/helpers/checkResource.js"],"sourcesContent":["// @flow\nimport Href from \"../../models/href/Href\";\n\n/**\n * Checks if a given url to a modular ui resource exists using a HEAD request to the resource (synchronous)\n * When the resource returns a 404, the resource does not exists and the method returns false\n *\n * @param url\n * @returns {boolean}\n */\nexport const resourceExists = (url: string | Href): boolean => {\n // TODO SBO: origin and context?\n const fullUrl = new Href(url).absolutehref;\n\n const xhr = new XMLHttpRequest();\n xhr.open(\"HEAD\", fullUrl, false);\n xhr.setRequestHeader(\"Accept\", \"application/json\");\n xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n xhr.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\n\n xhr.send();\n\n return xhr.status !== 404;\n};\n\n/**\n * Indicates if a request to the given url resuls in a redirect to /secureRedirect\n * @param url\n * @returns {boolean}\n */\nexport const resourceRedirectsToSecureLogin = (url: string | Href): boolean => {\n // TODO SBO: origin and context?\n const fullUrl = new Href(url).absolutehref;\n\n const xhr = new XMLHttpRequest();\n xhr.open(\"HEAD\", fullUrl, false);\n xhr.setRequestHeader(\"Accept\", \"application/json\");\n xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n xhr.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\n xhr.send();\n\n const responseURL = xhr.responseURL ?? \"\";\n\n return xhr.status === 400 && responseURL.endsWith(\"/secureLogin\");\n};\n"],"mappings":";AACA,OAAOA,IAAI,MAAM,wBAAwB;;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GAAIC,GAAkB,IAAc;EAC7D;EACA,MAAMC,OAAO,GAAG,IAAIH,IAAI,CAACE,GAAG,CAAC,CAACE,YAAY;EAE1C,MAAMC,GAAG,GAAG,IAAIC,cAAc,CAAC,CAAC;EAChCD,GAAG,CAACE,IAAI,CAAC,MAAM,EAAEJ,OAAO,EAAE,KAAK,CAAC;EAChCE,GAAG,CAACG,gBAAgB,CAAC,QAAQ,EAAE,kBAAkB,CAAC;EAClDH,GAAG,CAACG,gBAAgB,CAAC,cAAc,EAAE,kBAAkB,CAAC;EACxDH,GAAG,CAACG,gBAAgB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;EAE1DH,GAAG,CAACI,IAAI,CAAC,CAAC;EAEV,OAAOJ,GAAG,CAACK,MAAM,KAAK,GAAG;AAC3B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,8BAA8B,GAAIT,GAAkB,IAAc;EAC7E;EACA,MAAMC,OAAO,GAAG,IAAIH,IAAI,CAACE,GAAG,CAAC,CAACE,YAAY;EAE1C,MAAMC,GAAG,GAAG,IAAIC,cAAc,CAAC,CAAC;EAChCD,GAAG,CAACE,IAAI,CAAC,MAAM,EAAEJ,OAAO,EAAE,KAAK,CAAC;EAChCE,GAAG,CAACG,gBAAgB,CAAC,QAAQ,EAAE,kBAAkB,CAAC;EAClDH,GAAG,CAACG,gBAAgB,CAAC,cAAc,EAAE,kBAAkB,CAAC;EACxDH,GAAG,CAACG,gBAAgB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;EAC1DH,GAAG,CAACI,IAAI,CAAC,CAAC;EAEV,MAAMG,WAAW,GAAGP,GAAG,CAACO,WAAW,IAAI,EAAE;EAEzC,OAAOP,GAAG,CAACK,MAAM,KAAK,GAAG,IAAIG,yBAAA,CAAAD,WAAW,EAAAE,IAAA,CAAXF,WAAW,EAAU,cAAc,CAAC;AACnE,CAAC","ignoreList":[]}
@@ -148,7 +148,10 @@ const loginType = () => getSetting(_Constants.LOGIN_TYPE, _Constants.INTERNAL_LO
148
148
  /**
149
149
  */
150
150
  exports.loginType = loginType;
151
- const loginPath = () => getSetting(_Constants.LOGIN_PATH_SETTING, "/callback?client_name=FormClient");
151
+ const loginPath = function () {
152
+ let clientName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "FormClient";
153
+ return getSetting(_Constants.LOGIN_PATH_SETTING, `/callback?client_name=${clientName}`);
154
+ };
152
155
  /**
153
156
  */
154
157
  exports.loginPath = loginPath;
@@ -194,8 +194,8 @@ export const loginType = (): string =>
194
194
 
195
195
  /**
196
196
  */
197
- export const loginPath = (): string =>
198
- getSetting(LOGIN_PATH_SETTING, "/callback?client_name=FormClient");
197
+ export const loginPath = (clientName: string = "FormClient"): string =>
198
+ getSetting(LOGIN_PATH_SETTING, `/callback?client_name=${clientName}`);
199
199
  /**
200
200
  */
201
201
  export const loginUsernameField = (): string =>
@@ -1 +1 @@
1
- {"version":3,"file":"Settings.js","names":["_objects","require","_repositoryResource","_Constants","serverBase","__CONTEXT_PATH__","defaultSettings","CONTEXT_PATH","window","contextPath","CACHE_CONTRIBUTIONS","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_GLOBAL_LOGIN_PAGE","RENDER_GLOBAL_LOGOUT_PAGE","RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE","LOGIN_PATH","ADMINISTRATOR_LOGIN_PATH","LOGOUT_PATH","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","XHR_TIMEOUT_MS","HIDE_WHEN_EMPTY_IGNORE_TASKS","SHOW_AVATARS","settings","setSettings","config","isPlainObject","_assign","default","exports","getSetting","key","defaultValue","has","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getUploadPath","UPLOAD_PATH","getCaptchaPath","CAPTCHA_PATH","hasAllContentInData","ALL_CONTENT_IN_DATA_SETTING","loginType","LOGIN_TYPE","INTERNAL_LOGIN_TYPE","JAAS","loginPath","LOGIN_PATH_SETTING","loginUsernameField","LOGIN_USERNAME_SETTING","loginPasswordField","LOGIN_PASSWORD_SETTING","logoutPath","LOGOUT_PATH_SETTING","getSwimLaneDiagramConfiguration","configLocation","_startsWith","call","getRepositoryResourceUrl","setContextPath","BASE"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport { getRepositoryResourceUrl } from \"../utils/helpers/repositoryResource\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INTERNAL_LOGIN_TYPE,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n UPLOAD_PATH,\n CAPTCHA_PATH,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst serverBase =\n typeof __CONTEXT_PATH__ === \"undefined\" ? null : __CONTEXT_PATH__;\n\nconst defaultSettings: { [name: string]: Setting } = {\n // This uses contextPath set from property from server\n CONTEXT_PATH:\n serverBase ??\n (typeof window !== \"undefined\" && window.contextPath\n ? window.contextPath\n : \"/BeInformed\"),\n\n // Indicates if contributions should be cached\n CACHE_CONTRIBUTIONS: true,\n\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Renders the global log in page\n RENDER_GLOBAL_LOGIN_PAGE: false,\n\n // Renders the global log out page\n RENDER_GLOBAL_LOGOUT_PAGE: false,\n\n // Renders the login variants as option on the global logout page\n RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,\n\n // Path to login page / component\n LOGIN_PATH: \"/signin\",\n\n // Path to administrator login page / component\n ADMINISTRATOR_LOGIN_PATH: \"\",\n\n // Path to logout page / component\n LOGOUT_PATH: \"/signout\",\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/System\",\n ],\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n\n XHR_TIMEOUT_MS: 300000,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: false,\n\n SHOW_AVATARS: true,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nexport const setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nexport const getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`,\n );\n }\n\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nexport const setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nexport const allSettings = (): { [name: string]: Setting } => settings;\n\n/**\n * Indicates if contributions must be cached\n */\nexport const cacheContributions = (): boolean =>\n getSetting(\"CACHE_CONTRIBUTIONS\", true);\n\n/**\n * Base path\n * This uses contextPath set from property from server\n * When requesting a remote server with CORS enabled, add the origin, for example:\n * export const BEINFORMED_PATH = 'http://192.168.128.61:8080/BeInformed';\n */\nexport const getBasePath = (): string =>\n getSetting(\"CONTEXT_PATH\", \"/BeInformed\");\n\n/**\n * Path to upload service\n */\nexport const getUploadPath = (): string => `${getBasePath()}${UPLOAD_PATH}`;\n\n/**\n * Path to captcha service\n */\nexport const getCaptchaPath = (): string => `${getBasePath()}${CAPTCHA_PATH}`;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n * Login type, only available when pac4j is configured\n *\n * Preview does not support pac4j, thus is probably not configured when started, which results in login type JAAS\n */\nexport const loginType = (): string =>\n getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);\n\n/**\n */\nexport const loginPath = (): string =>\n getSetting(LOGIN_PATH_SETTING, \"/callback?client_name=FormClient\");\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/logout\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n\n/**\n * Model overview swim lane configuration\n */\nexport const getSwimLaneDiagramConfiguration: Object = () => {\n let configLocation = getSetting(\n \"SWIM_LANE_DIAGRAM_CONFIGURATION\",\n \"/Library/Diagrams/Overviews.json\",\n );\n if (!configLocation.startsWith(\"/\")) {\n configLocation = `/${configLocation}`;\n }\n return getRepositoryResourceUrl(configLocation);\n};\n\n/**\n * Set the context path for requests to be informed\n */\nexport const setContextPath = (contextPath: string) => {\n setSetting(\"CONTEXT_PATH\", contextPath);\n};\n\n/**\n * Backwards compatible export of BASE constant\n */\nexport const BASE: string = getBasePath();\n"],"mappings":";;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAcA,MAAMG,UAAU,GACd,OAAOC,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAGA,gBAAgB;AAEnE,MAAMC,eAA4C,GAAG;EACnD;EACAC,YAAY,EACVH,UAAU,KACT,OAAOI,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,WAAW,GAChDD,MAAM,CAACC,WA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B,iCAAiC,EACjC,kCACF,CAAC;EACD,IAAI,CAAC,IAAA+B,WAAA,CAAAjC,OAAA,EAAAgC,cAAc,EAAAE,IAAA,CAAdF,cAAc,EAAY,GAAG,CAAC,EAAE;IACnCA,cAAc,GAAG,IAAIA,cAAc,EAAE;EACvC;EACA,OAAO,IAAAG,4CAAwB,EAACH,cAAc,CAAC;AACjD,CAAC;;AAED;AACA;AACA;AAFA/B,OAAA,CAAA8B,+BAAA,GAAAA,+BAAA;AAGO,MAAMK,cAAc,GAAI1E,WAAmB,IAAK;EACrD8C,UAAU,CAAC,cAAc,EAAE9C,WAAW,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AAFAuC,OAAA,CAAAmC,cAAA,GAAAA,cAAA;AAGO,MAAMC,IAAY,GAAApC,OAAA,CAAAoC,IAAA,GAAGzB,WAAW,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Settings.js","names":["_objects","require","_repositoryResource","_Constants","serverBase","__CONTEXT_PATH__","defaultSettings","CONTEXT_PATH","window","contextPath","CACHE_CONTRIBUTIONS","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_GLOBAL_LOGIN_PAGE","RENDER_GLOBAL_LOGOUT_PAGE","RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE","LOGIN_PATH","ADMINISTRATOR_LOGIN_PATH","LOGOUT_PATH","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","XHR_TIMEOUT_MS","HIDE_WHEN_EMPTY_IGNORE_TASKS","SHOW_AVATARS","settings","setSettings","config","isPlainObject","_assign","default","exports","getSetting","key","defaultValue","has","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getUploadPath","UPLOAD_PATH","getCaptchaPath","CAPTCHA_PATH","hasAllContentInData","ALL_CONTENT_IN_DATA_SETTING","loginType","LOGIN_TYPE","INTERNAL_LOGIN_TYPE","JAAS","loginPath","clientName","arguments","length","LOGIN_PATH_SETTING","loginUsernameField","LOGIN_USERNAME_SETTING","loginPasswordField","LOGIN_PASSWORD_SETTING","logoutPath","LOGOUT_PATH_SETTING","getSwimLaneDiagramConfiguration","configLocation","_startsWith","call","getRepositoryResourceUrl","setContextPath","BASE"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport { getRepositoryResourceUrl } from \"../utils/helpers/repositoryResource\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INTERNAL_LOGIN_TYPE,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n UPLOAD_PATH,\n CAPTCHA_PATH,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst serverBase =\n typeof __CONTEXT_PATH__ === \"undefined\" ? null : __CONTEXT_PATH__;\n\nconst defaultSettings: { [name: string]: Setting } = {\n // This uses contextPath set from property from server\n CONTEXT_PATH:\n serverBase ??\n (typeof window !== \"undefined\" && window.contextPath\n ? window.contextPath\n : \"/BeInformed\"),\n\n // Indicates if contributions should be cached\n CACHE_CONTRIBUTIONS: true,\n\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Renders the global log in page\n RENDER_GLOBAL_LOGIN_PAGE: false,\n\n // Renders the global log out page\n RENDER_GLOBAL_LOGOUT_PAGE: false,\n\n // Renders the login variants as option on the global logout page\n RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,\n\n // Path to login page / component\n LOGIN_PATH: \"/signin\",\n\n // Path to administrator login page / component\n ADMINISTRATOR_LOGIN_PATH: \"\",\n\n // Path to logout page / component\n LOGOUT_PATH: \"/signout\",\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/System\",\n ],\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n\n XHR_TIMEOUT_MS: 300000,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: false,\n\n SHOW_AVATARS: true,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nexport const setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nexport const getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`,\n );\n }\n\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nexport const setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nexport const allSettings = (): { [name: string]: Setting } => settings;\n\n/**\n * Indicates if contributions must be cached\n */\nexport const cacheContributions = (): boolean =>\n getSetting(\"CACHE_CONTRIBUTIONS\", true);\n\n/**\n * Base path\n * This uses contextPath set from property from server\n * When requesting a remote server with CORS enabled, add the origin, for example:\n * export const BEINFORMED_PATH = 'http://192.168.128.61:8080/BeInformed';\n */\nexport const getBasePath = (): string =>\n getSetting(\"CONTEXT_PATH\", \"/BeInformed\");\n\n/**\n * Path to upload service\n */\nexport const getUploadPath = (): string => `${getBasePath()}${UPLOAD_PATH}`;\n\n/**\n * Path to captcha service\n */\nexport const getCaptchaPath = (): string => `${getBasePath()}${CAPTCHA_PATH}`;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n * Login type, only available when pac4j is configured\n *\n * Preview does not support pac4j, thus is probably not configured when started, which results in login type JAAS\n */\nexport const loginType = (): string =>\n getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);\n\n/**\n */\nexport const loginPath = (clientName: string = \"FormClient\"): string =>\n getSetting(LOGIN_PATH_SETTING, `/callback?client_name=${clientName}`);\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/logout\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n\n/**\n * Model overview swim lane configuration\n */\nexport const getSwimLaneDiagramConfiguration: Object = () => {\n let configLocation = getSetting(\n \"SWIM_LANE_DIAGRAM_CONFIGURATION\",\n \"/Library/Diagrams/Overviews.json\",\n );\n if (!configLocation.startsWith(\"/\")) {\n configLocation = `/${configLocation}`;\n }\n return getRepositoryResourceUrl(configLocation);\n};\n\n/**\n * Set the context path for requests to be informed\n */\nexport const setContextPath = (contextPath: string) => {\n setSetting(\"CONTEXT_PATH\", contextPath);\n};\n\n/**\n * Backwards compatible export of BASE constant\n */\nexport const BASE: string = getBasePath();\n"],"mappings":";;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAcA,MAAMG,UAAU,GACd,OAAOC,gBAAgB,KAAK,WAAW,GAAG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AChC,OAAA,CAAA+B,UAAA,GAAAA,UAAA;AAEtC,MAAMvD,UAAkB,GAAAwB,OAAA,CAAAxB,UAAA,GAAG8C,SAAS,CAAC,CAAC;AACtC,MAAM5C,WAAmB,GAAAsB,OAAA,CAAAtB,WAAA,GAAGqD,UAAU,CAAC,CAAC;;AAE/C;AACA;AACA;AACO,MAAME,+BAAuC,GAAGA,CAAA,KAAM;EAC3D,IAAIC,cAAc,GAAGjC,UAAU,CAC7B,iCAAiC,EACjC,kCACF,CAAC;EACD,IAAI,CAAC,IAAAkC,WAAA,CAAApC,OAAA,EAAAmC,cAAc,EAAAE,IAAA,CAAdF,cAAc,EAAY,GAAG,CAAC,EAAE;IACnCA,cAAc,GAAG,IAAIA,cAAc,EAAE;EACvC;EACA,OAAO,IAAAG,4CAAwB,EAACH,cAAc,CAAC;AACjD,CAAC;;AAED;AACA;AACA;AAFAlC,OAAA,CAAAiC,+BAAA,GAAAA,+BAAA;AAGO,MAAMK,cAAc,GAAI7E,WAAmB,IAAK;EACrD8C,UAAU,CAAC,cAAc,EAAE9C,WAAW,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AAFAuC,OAAA,CAAAsC,cAAA,GAAAA,cAAA;AAGO,MAAMC,IAAY,GAAAvC,OAAA,CAAAuC,IAAA,GAAG5B,WAAW,CAAC,CAAC","ignoreList":[]}
@@ -24,7 +24,9 @@ const useForm = (href, data) => {
24
24
  method: _constants.HTTP_METHODS.POST,
25
25
  targetModel: _FormModel.default,
26
26
  removeOnUnmount: true,
27
- data
27
+ data,
28
+ origin: formHref.origin,
29
+ contextPath: formHref.contextPath
28
30
  });
29
31
  if (form?.model) {
30
32
  return form.model;
@@ -62,6 +62,8 @@ export const useForm = (href: string | Href, data?: Object): ?FormModel => {
62
62
  targetModel: FormModel,
63
63
  removeOnUnmount: true,
64
64
  data,
65
+ origin: formHref.origin,
66
+ contextPath: formHref.contextPath,
65
67
  });
66
68
 
67
69
  if (form?.model) {
@@ -1 +1 @@
1
- {"version":3,"file":"useForm.js","names":["_reactRedux","require","_Href","_interopRequireDefault","_constants","_modularui","_useModularUI","_actions","_FormModel","useForm","href","data","formHref","Href","getSetting","addParameter","form","useModularUI","method","HTTP_METHODS","POST","targetModel","FormModel","removeOnUnmount","model","exports","useFormNavigation","dispatch","useDispatch","previous","previousObject","cancel","cancelForm","submit","loadModularUI","connectKey","selfhref","formdata","updateHandler","newModel","clonedModel","clone","update","remove","removeModelByKey","showFormNotificationAction","showFormNotification","useAttributeUpdate","object","attribute","value","options","updateFormAttribute","useAttributeSet","save","addRepeatableAttributeSet","cancelRepeatableAttributeSet","removeRepeatableAttributeSet"],"sources":["../../src/hooks/useForm.js"],"sourcesContent":["// @flow\nimport { useDispatch } from \"react-redux\";\n\nimport Href from \"../models/href/Href\";\n\nimport { getSetting, HTTP_METHODS } from \"../constants\";\n\nimport type {\n RemoveModelByKeyAction,\n UpdateFormAction,\n} from \"../redux/_modularui\";\nimport { loadModularUI, removeModelByKey } from \"../redux/_modularui\";\nimport { useModularUI } from \"./useModularUI\";\n\nimport {\n addRepeatableAttributeSet,\n cancelForm,\n cancelRepeatableAttributeSet,\n previousObject,\n removeRepeatableAttributeSet,\n showFormNotification,\n updateFormAttribute,\n} from \"../redux/actions\";\n\nimport FormModel from \"../models/form/FormModel\";\n\nimport type { AttributeType, FormObjectModel, ModularUIModel } from \"../models\";\nimport type { UpdateFormOptions } from \"../redux/types\";\n\ntype FormNavigationHook = {\n previous: (form: FormModel) => UpdateFormAction,\n cancel: (form: FormModel) => void,\n submit: (form: FormModel) => void,\n showFormNotification: (form: FormModel) => void,\n remove: (form: FormModel) => RemoveModelByKeyAction,\n};\n\ntype AttributeSetHook = {\n save: () => UpdateFormAction,\n cancel: (object: FormObjectModel) => UpdateFormAction,\n remove: (object: FormObjectModel) => UpdateFormAction,\n};\n\ntype AttributeUpdateHook = (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions,\n) => void;\n\n/**\n * Load a form by href\n */\nexport const useForm = (href: string | Href, data?: Object): ?FormModel => {\n const formHref = new Href(href);\n\n if (!getSetting(\"ALWAYS_COMMIT_FORM\")) {\n formHref.addParameter(\"commit\", \"false\");\n }\n\n const form = useModularUI(\"form\", formHref, {\n method: HTTP_METHODS.POST,\n targetModel: FormModel,\n removeOnUnmount: true,\n data,\n });\n\n if (form?.model) {\n return form.model;\n }\n};\n\n/**\n * Form navigation methods\n */\nexport const useFormNavigation = (): FormNavigationHook => {\n const dispatch = useDispatch();\n\n const previous = (form: FormModel) => dispatch(previousObject(form));\n\n const cancel = (form: FormModel) => dispatch(cancelForm(form));\n\n const submit = (form: FormModel) =>\n dispatch(\n loadModularUI(form.connectKey, form.selfhref, {\n method: HTTP_METHODS.POST,\n data: form.formdata,\n updateHandler: (newModel: ModularUIModel): ModularUIModel => {\n if (newModel instanceof FormModel) {\n const clonedModel: FormModel = form.clone();\n clonedModel.update(newModel);\n return clonedModel;\n }\n return newModel;\n },\n targetModel: FormModel,\n }),\n );\n\n const remove = (form: FormModel) =>\n dispatch(removeModelByKey(form.connectKey));\n\n const showFormNotificationAction = (form: FormModel) =>\n dispatch(showFormNotification(form));\n\n return {\n previous,\n cancel,\n submit,\n remove,\n showFormNotification: showFormNotificationAction,\n };\n};\n\n/**\n * Hook that returns a function to update attributes of a form object.\n * <br >\n * The returned function accepts the following options:\n *\n * - autosubmit: Automatically submit the form after a change\n * - autosav: Automatically save the form (in the background) after a change\n * - autoupdate: Automatically update the current form object after a change\n * - forceUpdate: Force the update even if conditions are not met.\n * - validate: Activate/deactivate the form object validation by an update.\n */\nexport const useAttributeUpdate = (\n form: FormModel,\n object: FormObjectModel,\n): AttributeUpdateHook => {\n const dispatch = useDispatch();\n\n return (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions,\n ) => dispatch(updateFormAttribute(form, object, attribute, value, options));\n};\n\n/**\n * Attributeset actions\n */\nexport const useAttributeSet = (form: FormModel): AttributeSetHook => {\n const dispatch = useDispatch();\n\n return {\n save: () => dispatch(addRepeatableAttributeSet(form)),\n cancel: (object: FormObjectModel) =>\n dispatch(cancelRepeatableAttributeSet(form, object)),\n remove: (object: FormObjectModel) =>\n dispatch(removeRepeatableAttributeSet(form, object)),\n };\n};\n"],"mappings":";;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AAMA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AAEA,IAAAM,QAAA,GAAAN,OAAA;AAUA,IAAAO,UAAA,GAAAL,sBAAA,CAAAF,OAAA;AAyBA;AACA;AACA;AACO,MAAMQ,OAAO,GAAGA,CAACC,IAAmB,EAAEC,IAAa,KAAiB;EACzE,MAAMC,QAAQ,GAAG,IAAIC,aAAI,CAACH,IAAI,CAAC;EAE/B,IAAI,CAAC,IAAAI,qBAAU,EAAC,oBAAoB,CAAC,EAAE;IACrCF,QAAQ,CAACG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC;EAC1C;EAEA,MAAMC,IAAI,GAAG,IAAAC,0BAAY,EAAC,MAAM,EAAEL,QAAQ,EAAE;IAC1CM,MAAM,EAAEC,uBAAY,CAACC,IAAI;IACzBC,WAAW,EAAEC,kBAAS;IACtBC,eAAe,EAAE,IAAI;IACrBZ;EACF,CAAC,CAAC;EAEF,IAAIK,IAAI,EAAEQ,KAAK,EAAE;IACf,OAAOR,IAAI,CAACQ,KAAK;EACnB;AACF,CAAC;;AAED;AACA;AACA;AAFAC,OAAA,CAAAhB,OAAA,GAAAA,OAAA;AAGO,MAAMiB,iBAAiB,GAAGA,CAAA,KAA0B;EACzD,MAAMC,QAAQ,GAAG,IAAAC,uBAAW,EAAC,CAAC;EAE9B,MAAMC,QAAQ,GAAIb,IAAe,IAAKW,QAAQ,CAAC,IAAAG,uBAAc,EAACd,IAAI,CAAC,CAAC;EAEpE,MAAMe,MAAM,GAAIf,IAAe,IAAKW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AK,EAAEC,OAAO,CAAC,CAAC;AAC7E,CAAC;;AAED;AACA;AACA;AAFA1B,OAAA,CAAAsB,kBAAA,GAAAA,kBAAA;AAGO,MAAMM,eAAe,GAAIrC,IAAe,IAAuB;EACpE,MAAMW,QAAQ,GAAG,IAAAC,uBAAW,EAAC,CAAC;EAE9B,OAAO;IACL0B,IAAI,EAAEA,CAAA,KAAM3B,QAAQ,CAAC,IAAA4B,kCAAyB,EAACvC,IAAI,CAAC,CAAC;IACrDe,MAAM,EAAGiB,MAAuB,IAC9BrB,QAAQ,CAAC,IAAA6B,qCAA4B,EAACxC,IAAI,EAAEgC,MAAM,CAAC,CAAC;IACtDL,MAAM,EAAGK,MAAuB,IAC9BrB,QAAQ,CAAC,IAAA8B,qCAA4B,EAACzC,IAAI,EAAEgC,MAAM,CAAC;EACvD,CAAC;AACH,CAAC;AAACvB,OAAA,CAAA4B,eAAA,GAAAA,eAAA","ignoreList":[]}
1
+ {"version":3,"file":"useForm.js","names":["_reactRedux","require","_Href","_interopRequireDefault","_constants","_modularui","_useModularUI","_actions","_FormModel","useForm","href","data","formHref","Href","getSetting","addParameter","form","useModularUI","method","HTTP_METHODS","POST","targetModel","FormModel","removeOnUnmount","origin","contextPath","model","exports","useFormNavigation","dispatch","useDispatch","previous","previousObject","cancel","cancelForm","submit","loadModularUI","connectKey","selfhref","formdata","updateHandler","newModel","clonedModel","clone","update","remove","removeModelByKey","showFormNotificationAction","showFormNotification","useAttributeUpdate","object","attribute","value","options","updateFormAttribute","useAttributeSet","save","addRepeatableAttributeSet","cancelRepeatableAttributeSet","removeRepeatableAttributeSet"],"sources":["../../src/hooks/useForm.js"],"sourcesContent":["// @flow\nimport { useDispatch } from \"react-redux\";\n\nimport Href from \"../models/href/Href\";\n\nimport { getSetting, HTTP_METHODS } from \"../constants\";\n\nimport type {\n RemoveModelByKeyAction,\n UpdateFormAction,\n} from \"../redux/_modularui\";\nimport { loadModularUI, removeModelByKey } from \"../redux/_modularui\";\nimport { useModularUI } from \"./useModularUI\";\n\nimport {\n addRepeatableAttributeSet,\n cancelForm,\n cancelRepeatableAttributeSet,\n previousObject,\n removeRepeatableAttributeSet,\n showFormNotification,\n updateFormAttribute,\n} from \"../redux/actions\";\n\nimport FormModel from \"../models/form/FormModel\";\n\nimport type { AttributeType, FormObjectModel, ModularUIModel } from \"../models\";\nimport type { UpdateFormOptions } from \"../redux/types\";\n\ntype FormNavigationHook = {\n previous: (form: FormModel) => UpdateFormAction,\n cancel: (form: FormModel) => void,\n submit: (form: FormModel) => void,\n showFormNotification: (form: FormModel) => void,\n remove: (form: FormModel) => RemoveModelByKeyAction,\n};\n\ntype AttributeSetHook = {\n save: () => UpdateFormAction,\n cancel: (object: FormObjectModel) => UpdateFormAction,\n remove: (object: FormObjectModel) => UpdateFormAction,\n};\n\ntype AttributeUpdateHook = (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions,\n) => void;\n\n/**\n * Load a form by href\n */\nexport const useForm = (href: string | Href, data?: Object): ?FormModel => {\n const formHref = new Href(href);\n\n if (!getSetting(\"ALWAYS_COMMIT_FORM\")) {\n formHref.addParameter(\"commit\", \"false\");\n }\n\n const form = useModularUI(\"form\", formHref, {\n method: HTTP_METHODS.POST,\n targetModel: FormModel,\n removeOnUnmount: true,\n data,\n origin: formHref.origin,\n contextPath: formHref.contextPath,\n });\n\n if (form?.model) {\n return form.model;\n }\n};\n\n/**\n * Form navigation methods\n */\nexport const useFormNavigation = (): FormNavigationHook => {\n const dispatch = useDispatch();\n\n const previous = (form: FormModel) => dispatch(previousObject(form));\n\n const cancel = (form: FormModel) => dispatch(cancelForm(form));\n\n const submit = (form: FormModel) =>\n dispatch(\n loadModularUI(form.connectKey, form.selfhref, {\n method: HTTP_METHODS.POST,\n data: form.formdata,\n updateHandler: (newModel: ModularUIModel): ModularUIModel => {\n if (newModel instanceof FormModel) {\n const clonedModel: FormModel = form.clone();\n clonedModel.update(newModel);\n return clonedModel;\n }\n return newModel;\n },\n targetModel: FormModel,\n }),\n );\n\n const remove = (form: FormModel) =>\n dispatch(removeModelByKey(form.connectKey));\n\n const showFormNotificationAction = (form: FormModel) =>\n dispatch(showFormNotification(form));\n\n return {\n previous,\n cancel,\n submit,\n remove,\n showFormNotification: showFormNotificationAction,\n };\n};\n\n/**\n * Hook that returns a function to update attributes of a form object.\n * <br >\n * The returned function accepts the following options:\n *\n * - autosubmit: Automatically submit the form after a change\n * - autosav: Automatically save the form (in the background) after a change\n * - autoupdate: Automatically update the current form object after a change\n * - forceUpdate: Force the update even if conditions are not met.\n * - validate: Activate/deactivate the form object validation by an update.\n */\nexport const useAttributeUpdate = (\n form: FormModel,\n object: FormObjectModel,\n): AttributeUpdateHook => {\n const dispatch = useDispatch();\n\n return (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions,\n ) => dispatch(updateFormAttribute(form, object, attribute, value, options));\n};\n\n/**\n * Attributeset actions\n */\nexport const useAttributeSet = (form: FormModel): AttributeSetHook => {\n const dispatch = useDispatch();\n\n return {\n save: () => dispatch(addRepeatableAttributeSet(form)),\n cancel: (object: FormObjectModel) =>\n dispatch(cancelRepeatableAttributeSet(form, object)),\n remove: (object: FormObjectModel) =>\n dispatch(removeRepeatableAttributeSet(form, object)),\n };\n};\n"],"mappings":";;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AAMA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AAEA,IAAAM,QAAA,GAAAN,OAAA;AAUA,IAAAO,UAAA,GAAAL,sBAAA,CAAAF,OAAA;AAyBA;AACA;AACA;AACO,MAAMQ,OAAO,GAAGA,CAACC,IAAmB,EAAEC,IAAa,KAAiB;EACzE,MAAMC,QAAQ,GAAG,IAAIC,aAAI,CAACH,IAAI,CAAC;EAE/B,IAAI,CAAC,IAAAI,qBAAU,EAAC,oBAAoB,CAAC,E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vD,CAAC;AACH,CAAC;AAACvB,OAAA,CAAA4B,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -16,13 +16,17 @@ const useModularUIBasic = function (key, href) {
16
16
  let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
17
17
  expectedModels: [],
18
18
  targetModel: undefined,
19
- forceTargetModel: false
19
+ forceTargetModel: false,
20
+ origin: undefined,
21
+ contextPath: undefined
20
22
  };
21
23
  const location = (0, _useRouter.useLocation)();
22
24
  const useModularUIOptions = {
23
25
  targetModel: undefined,
24
26
  forceTargetModel: undefined,
25
27
  isReload: false,
28
+ origin: undefined,
29
+ contextPath: undefined,
26
30
  cache: false
27
31
  };
28
32
  if (options.targetModel) {
@@ -37,6 +41,12 @@ const useModularUIBasic = function (key, href) {
37
41
  if (location.state?.reload && (0, _startsWith.default)(_context = location.pathname).call(_context, href.toString())) {
38
42
  useModularUIOptions.isReload = true;
39
43
  }
44
+ if (options.origin) {
45
+ useModularUIOptions.origin = options.origin;
46
+ }
47
+ if (options.contextPath) {
48
+ useModularUIOptions.contextPath = options.contextPath;
49
+ }
40
50
 
41
51
  // $FlowFixMe[incompatible-call]
42
52
  const modularUI = (0, _useModularUI.useModularUI)(key, href, useModularUIOptions);
@@ -11,6 +11,8 @@ export type UseModularUIBasicOptions<T: ModularUIModel> = {
11
11
  expectedModels?: Array<string>,
12
12
  targetModel?: Class<T> | Array<Class<T>>,
13
13
  forceTargetModel?: boolean,
14
+ origin?: string,
15
+ contextPath?: string,
14
16
  cache?: boolean,
15
17
  };
16
18
 
@@ -23,6 +25,8 @@ export const useModularUIBasic = <T: ModularUIModel>(
23
25
  expectedModels: [],
24
26
  targetModel: undefined,
25
27
  forceTargetModel: false,
28
+ origin: undefined,
29
+ contextPath: undefined,
26
30
  },
27
31
  ): T | null => {
28
32
  const location = useLocation();
@@ -31,6 +35,8 @@ export const useModularUIBasic = <T: ModularUIModel>(
31
35
  targetModel: undefined,
32
36
  forceTargetModel: undefined,
33
37
  isReload: false,
38
+ origin: undefined,
39
+ contextPath: undefined,
34
40
  cache: false,
35
41
  };
36
42
  if (options.targetModel) {
@@ -47,6 +53,14 @@ export const useModularUIBasic = <T: ModularUIModel>(
47
53
  useModularUIOptions.isReload = true;
48
54
  }
49
55
 
56
+ if (options.origin) {
57
+ useModularUIOptions.origin = options.origin;
58
+ }
59
+
60
+ if (options.contextPath) {
61
+ useModularUIOptions.contextPath = options.contextPath;
62
+ }
63
+
50
64
  // $FlowFixMe[incompatible-call]
51
65
  const modularUI = useModularUI(key, href, useModularUIOptions);
52
66
 
@@ -1 +1 @@
1
- {"version":3,"file":"useModularUIBasic.js","names":["_useModularUI","require","_useRouter","_exceptions","useModularUIBasic","key","href","_context","options","arguments","length","undefined","expectedModels","targetModel","forceTargetModel","location","useLocation","useModularUIOptions","isReload","cache","state","reload","_startsWith","default","pathname","call","toString","modularUI","useModularUI","model","isCorrectModel","some","expectedModel","type","console","error","IllegalStateException","exports"],"sources":["../../src/hooks/useModularUIBasic.js"],"sourcesContent":["// @flow\nimport { useModularUI } from \"./useModularUI\";\n\nimport { useLocation } from \"./useRouter\";\n\nimport { IllegalStateException } from \"../exceptions\";\n\nimport type { ModularUIModel, Href } from \"../models\";\n\nexport type UseModularUIBasicOptions<T: ModularUIModel> = {\n expectedModels?: Array<string>,\n targetModel?: Class<T> | Array<Class<T>>,\n forceTargetModel?: boolean,\n cache?: boolean,\n};\n\n/**\n */\nexport const useModularUIBasic = <T: ModularUIModel>(\n key: string,\n href: string | Href,\n options: UseModularUIBasicOptions<T> = {\n expectedModels: [],\n targetModel: undefined,\n forceTargetModel: false,\n },\n): T | null => {\n const location = useLocation();\n\n const useModularUIOptions = {\n targetModel: undefined,\n forceTargetModel: undefined,\n isReload: false,\n cache: false,\n };\n if (options.targetModel) {\n useModularUIOptions.targetModel = options.targetModel;\n useModularUIOptions.forceTargetModel = options.forceTargetModel;\n }\n\n if (options.cache) {\n useModularUIOptions.cache = options.cache;\n }\n\n // reload when the modular service starts with the current location\n if (location.state?.reload && location.pathname.startsWith(href.toString())) {\n useModularUIOptions.isReload = true;\n }\n\n // $FlowFixMe[incompatible-call]\n const modularUI = useModularUI(key, href, useModularUIOptions);\n\n if (modularUI?.model) {\n const { model } = modularUI;\n\n const expectedModels = options.expectedModels ?? [];\n if (expectedModels.length > 0) {\n const isCorrectModel = expectedModels.some((expectedModel) => {\n return model.type === expectedModel;\n });\n\n if (!isCorrectModel) {\n console.error(modularUI, \"is not of instance\", expectedModels);\n throw new IllegalStateException(\"Resolved model has incorrect type\");\n }\n }\n\n return model;\n }\n\n return null;\n};\n"],"mappings":";;;;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAWA;AACA;AACO,MAAMG,iBAAiB,GAAG,SAAAA,CAC/BC,GAAW,EACXC,IAAmB,EAMN;EAAA,IAAAC,QAAA;EAAA,IALbC,OAAoC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG;IACrCG,cAAc,EAAE,EAAE;IAClBC,WAAW,EAAEF,SAAS;IACtBG,gBAAgB,EAAE;EACpB,CAAC;EAED,MAAMC,QAAQ,GAAG,IAAAC,sBAAW,EAAC,CAAC;EAE9B,MAAMC,mBAAmB,GAAG;IAC1BJ,WAAW,EAAEF,SAAS;IACtBG,gBAAgB,EAAEH,SAAS;IAC3BO,QAAQ,EAAE,KAAK;IACfC,KAAK,EAAE;EACT,CAAC;EACD,IAAIX,OAAO,CAACK,WAAW,EAAE;IACvBI,mBAAmB,CAACJ,WAAW,GAAGL,OAAO,CAACK,WAAW;IACrDI,mBAAmB,CAACH,gBAAgB,GAAGN,OAAO,CAACM,gBAAgB;EACjE;EAEA,IAAIN,OAAO,CAACW,KAAK,EAAE;IACjBF,mBAAmB,CAACE,KAAK,GAAGX,OAAO,CAACW,KAAK;EAC3C;;EAEA;EACA,IAAIJ,QAAQ,CAACK,KAAK,EAAEC,MAAM,IAAI,IAAAC,WAAA,CAAAC,OAAA,EAAAhB,QAAA,GAAAQ,QAAQ,CAACS,QAAQ,EAAAC,IAAA,CAAAlB,QAAA,EAAYD,IAAI,CAACoB,QAAQ,CAAC,CAAC,CAAC,EAAE;IAC3ET,mBAAmB,CAACC,QAAQ,GAAG,IAAI;EACrC;;EAEA;EACA,MAAMS,SAAS,GAAG,IAAAC,0BAAY,EAACvB,GAAG,EAAEC,IAAI,EAAEW,mBAAmB,CAAC;EAE9D,IAAIU,SAAS,EAAEE,KAAK,EAAE;IACpB,MAAM;MAAEA;IAAM,CAAC,GAAGF,SAAS;IAE3B,MAAMf,cAAc,GAAGJ,OAAO,CAACI,cAAc,IAAI,EAAE;IACnD,IAAIA,cAAc,CAACF,MAAM,GAAG,CAAC,EAAE;MAC7B,MAAMoB,cAAc,GAAGlB,cAAc,CAACmB,IAAI,CAAEC,aAAa,IAAK;QAC5D,OAAOH,KAAK,CAACI,IAAI,KAAKD,aAAa;MACrC,CAAC,CAAC;MAEF,IAAI,CAACF,cAAc,EAAE;QACnBI,OAAO,CAACC,KAAK,CAACR,SAAS,EAAE,oBAAoB,EAAEf,cAAc,CAAC;QAC9D,MAAM,IAAIwB,iCAAqB,CAAC,mCAAmC,CAAC;MACtE;IACF;IAEA,OAAOP,KAAK;EACd;EAEA,OAAO,IAAI;AACb,CAAC;AAACQ,OAAA,CAAAjC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
1
+ {"version":3,"file":"useModularUIBasic.js","names":["_useModularUI","require","_useRouter","_exceptions","useModularUIBasic","key","href","_context","options","arguments","length","undefined","expectedModels","targetModel","forceTargetModel","origin","contextPath","location","useLocation","useModularUIOptions","isReload","cache","state","reload","_startsWith","default","pathname","call","toString","modularUI","useModularUI","model","isCorrectModel","some","expectedModel","type","console","error","IllegalStateException","exports"],"sources":["../../src/hooks/useModularUIBasic.js"],"sourcesContent":["// @flow\nimport { useModularUI } from \"./useModularUI\";\n\nimport { useLocation } from \"./useRouter\";\n\nimport { IllegalStateException } from \"../exceptions\";\n\nimport type { ModularUIModel, Href } from \"../models\";\n\nexport type UseModularUIBasicOptions<T: ModularUIModel> = {\n expectedModels?: Array<string>,\n targetModel?: Class<T> | Array<Class<T>>,\n forceTargetModel?: boolean,\n origin?: string,\n contextPath?: string,\n cache?: boolean,\n};\n\n/**\n */\nexport const useModularUIBasic = <T: ModularUIModel>(\n key: string,\n href: string | Href,\n options: UseModularUIBasicOptions<T> = {\n expectedModels: [],\n targetModel: undefined,\n forceTargetModel: false,\n origin: undefined,\n contextPath: undefined,\n },\n): T | null => {\n const location = useLocation();\n\n const useModularUIOptions = {\n targetModel: undefined,\n forceTargetModel: undefined,\n isReload: false,\n origin: undefined,\n contextPath: undefined,\n cache: false,\n };\n if (options.targetModel) {\n useModularUIOptions.targetModel = options.targetModel;\n useModularUIOptions.forceTargetModel = options.forceTargetModel;\n }\n\n if (options.cache) {\n useModularUIOptions.cache = options.cache;\n }\n\n // reload when the modular service starts with the current location\n if (location.state?.reload && location.pathname.startsWith(href.toString())) {\n useModularUIOptions.isReload = true;\n }\n\n if (options.origin) {\n useModularUIOptions.origin = options.origin;\n }\n\n if (options.contextPath) {\n useModularUIOptions.contextPath = options.contextPath;\n }\n\n // $FlowFixMe[incompatible-call]\n const modularUI = useModularUI(key, href, useModularUIOptions);\n\n if (modularUI?.model) {\n const { model } = modularUI;\n\n const expectedModels = options.expectedModels ?? [];\n if (expectedModels.length > 0) {\n const isCorrectModel = expectedModels.some((expectedModel) => {\n return model.type === expectedModel;\n });\n\n if (!isCorrectModel) {\n console.error(modularUI, \"is not of instance\", expectedModels);\n throw new IllegalStateException(\"Resolved model has incorrect type\");\n }\n }\n\n return model;\n }\n\n return null;\n};\n"],"mappings":";;;;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAaA;AACA;AACO,MAAMG,i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AO,CAACQ,WAAW;EACvD;;EAEA;EACA,MAAMa,SAAS,GAAG,IAAAC,0BAAY,EAACzB,GAAG,EAAEC,IAAI,EAAEa,mBAAmB,CAAC;EAE9D,IAAIU,SAAS,EAAEE,KAAK,EAAE;IACpB,MAAM;MAAEA;IAAM,CAAC,GAAGF,SAAS;IAE3B,MAAMjB,cAAc,GAAGJ,OAAO,CAACI,cAAc,IAAI,EAAE;IACnD,IAAIA,cAAc,CAACF,MAAM,GAAG,CAAC,EAAE;MAC7B,MAAMsB,cAAc,GAAGpB,cAAc,CAACqB,IAAI,CAAEC,aAAa,IAAK;QAC5D,OAAOH,KAAK,CAACI,IAAI,KAAKD,aAAa;MACrC,CAAC,CAAC;MAEF,IAAI,CAACF,cAAc,EAAE;QACnBI,OAAO,CAACC,KAAK,CAACR,SAAS,EAAE,oBAAoB,EAAEjB,cAAc,CAAC;QAC9D,MAAM,IAAI0B,iCAAqB,CAAC,mCAAmC,CAAC;MACtE;IACF;IAEA,OAAOP,KAAK;EACd;EAEA,OAAO,IAAI;AACb,CAAC;AAACQ,OAAA,CAAAnC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
@@ -18,99 +18,111 @@ var _useModularUIBasic = require("./useModularUIBasic");
18
18
  /**
19
19
  * Load application
20
20
  */
21
- const useApplication = () => (0, _useModularUIBasic.useModularUIBasic)("application", "/", {
21
+ const useApplication = options => (0, _useModularUIBasic.useModularUIBasic)("application", "/", {
22
22
  expectedModels: ["Application"],
23
- targetModel: _ApplicationModel.default
23
+ targetModel: _ApplicationModel.default,
24
+ ...options
24
25
  });
25
26
 
26
27
  /**
27
28
  * Load a tab by href
28
29
  */
29
30
  exports.useApplication = useApplication;
30
- const useTab = href => (0, _useModularUIBasic.useModularUIBasic)("tab", href, {
31
+ const useTab = (href, options) => (0, _useModularUIBasic.useModularUIBasic)("tab", href, {
31
32
  expectedModels: ["Tab"],
32
- targetModel: _TabModel.default
33
+ targetModel: _TabModel.default,
34
+ ...options
33
35
  });
34
36
 
35
37
  /**
36
38
  * Load caseview by href
37
39
  */
38
40
  exports.useTab = useTab;
39
- const useCaseView = href => (0, _useModularUIBasic.useModularUIBasic)("caseview", href, {
41
+ const useCaseView = (href, options) => (0, _useModularUIBasic.useModularUIBasic)("caseview", href, {
40
42
  expectedModels: ["CaseView"],
41
- targetModel: _CaseViewModel.default
43
+ targetModel: _CaseViewModel.default,
44
+ ...options
42
45
  });
43
46
 
44
47
  /**
45
48
  */
46
49
  exports.useCaseView = useCaseView;
47
- const usePanel = href => (0, _useModularUIBasic.useModularUIBasic)("panel", href, {
48
- expectedModels: ["List", "GroupingPanel", "Detail"]
50
+ const usePanel = (href, options) => (0, _useModularUIBasic.useModularUIBasic)("panel", href, {
51
+ expectedModels: ["List", "GroupingPanel", "Detail"],
52
+ ...options
49
53
  });
50
54
 
51
55
  /**
52
56
  */
53
57
  exports.usePanel = usePanel;
54
- const useList = href => (0, _useModularUIBasic.useModularUIBasic)("list", href, {
58
+ const useList = (href, options) => (0, _useModularUIBasic.useModularUIBasic)("list", href, {
55
59
  expectedModels: ["List"],
56
- targetModel: _ListModel.default
60
+ targetModel: _ListModel.default,
61
+ ...options
57
62
  });
58
63
 
59
64
  /**
60
65
  */
61
66
  exports.useList = useList;
62
- const useListOrDetail = href => (0, _useModularUIBasic.useModularUIBasic)("list", href, {
67
+ const useListOrDetail = (href, options) => (0, _useModularUIBasic.useModularUIBasic)("list", href, {
63
68
  expectedModels: ["List", "Detail"],
64
- targetModel: [_ListModel.default, _DetailModel.default]
69
+ targetModel: [_ListModel.default, _DetailModel.default],
70
+ ...options
65
71
  });
66
72
 
67
73
  /**
68
74
  */
69
75
  exports.useListOrDetail = useListOrDetail;
70
- const useListDetail = href => (0, _useModularUIBasic.useModularUIBasic)("listdetail", href, {
76
+ const useListDetail = (href, options) => (0, _useModularUIBasic.useModularUIBasic)("listdetail", href, {
71
77
  expectedModels: ["ListDetail"],
72
78
  targetModel: _ListDetailModel.default,
73
- forceTargetModel: true
79
+ forceTargetModel: true,
80
+ ...options
74
81
  });
75
82
 
76
83
  /**
77
84
  */
78
85
  exports.useListDetail = useListDetail;
79
- const useGroupingPanel = href => (0, _useModularUIBasic.useModularUIBasic)("groupingpanel", href, {
86
+ const useGroupingPanel = (href, options) => (0, _useModularUIBasic.useModularUIBasic)("groupingpanel", href, {
80
87
  expectedModels: ["GroupingPanel"],
81
- targetModel: _GroupingPanelModel.default
88
+ targetModel: _GroupingPanelModel.default,
89
+ ...options
82
90
  });
83
91
 
84
92
  /**
85
93
  */
86
94
  exports.useGroupingPanel = useGroupingPanel;
87
- const useDetailPanel = href => (0, _useModularUIBasic.useModularUIBasic)("detailpanel", href, {
95
+ const useDetailPanel = (href, options) => (0, _useModularUIBasic.useModularUIBasic)("detailpanel", href, {
88
96
  expectedModels: ["Detail"],
89
- targetModel: _DetailModel.default
97
+ targetModel: _DetailModel.default,
98
+ ...options
90
99
  });
91
100
 
92
101
  /**
93
102
  */
94
103
  exports.useDetailPanel = useDetailPanel;
95
- const useQuicksearch = href => (0, _useModularUIBasic.useModularUIBasic)("quicksearch", href, {
104
+ const useQuicksearch = (href, options) => (0, _useModularUIBasic.useModularUIBasic)("quicksearch", href, {
96
105
  expectedModels: ["CaseSearch"],
97
- targetModel: _CaseSearchModel.default
106
+ targetModel: _CaseSearchModel.default,
107
+ ...options
98
108
  });
99
109
 
100
110
  /**
101
111
  */
102
112
  exports.useQuicksearch = useQuicksearch;
103
- const useSearch = href => (0, _useModularUIBasic.useModularUIBasic)("search", href, {
113
+ const useSearch = (href, options) => (0, _useModularUIBasic.useModularUIBasic)("search", href, {
104
114
  expectedModels: ["CaseSearch"],
105
- targetModel: _CaseSearchModel.default
115
+ targetModel: _CaseSearchModel.default,
116
+ ...options
106
117
  });
107
118
 
108
119
  /**
109
120
  */
110
121
  exports.useSearch = useSearch;
111
- const useUserProfile = href => (0, _useModularUIBasic.useModularUIBasic)("userprofile", href, {
122
+ const useUserProfile = (href, options) => (0, _useModularUIBasic.useModularUIBasic)("userprofile", href, {
112
123
  expectedModels: ["UserProfile"],
113
- targetModel: _UserProfileModel.default
124
+ targetModel: _UserProfileModel.default,
125
+ ...options
114
126
  });
115
127
  exports.useUserProfile = useUserProfile;
116
128
  //# sourceMappingURL=useModularUIModel.js.map