@beinformed/ui 1.59.9 → 1.59.11

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 (38) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/esm/hooks/useModelCatalog.js +1 -4
  3. package/esm/hooks/useModelCatalog.js.map +1 -1
  4. package/esm/redux/_modularui/ModularUIActions.js +1 -5
  5. package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
  6. package/esm/redux/actions/Application.js +6 -0
  7. package/esm/redux/actions/Application.js.map +1 -1
  8. package/esm/redux/actions/Authorization.js +3 -6
  9. package/esm/redux/actions/Authorization.js.map +1 -1
  10. package/esm/redux/actions/Error.js +2 -3
  11. package/esm/redux/actions/Error.js.map +1 -1
  12. package/esm/utils/helpers/createHref.js.map +1 -1
  13. package/lib/hooks/__tests__/useModelCatalog.spec.js.flow +1 -1
  14. package/lib/hooks/useModelCatalog.js +1 -4
  15. package/lib/hooks/useModelCatalog.js.flow +1 -4
  16. package/lib/hooks/useModelCatalog.js.map +1 -1
  17. package/lib/redux/_modularui/ModularUIActions.js +1 -5
  18. package/lib/redux/_modularui/ModularUIActions.js.flow +4 -6
  19. package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
  20. package/lib/redux/actions/Application.js +8 -1
  21. package/lib/redux/actions/Application.js.flow +7 -1
  22. package/lib/redux/actions/Application.js.map +1 -1
  23. package/lib/redux/actions/Authorization.js +2 -4
  24. package/lib/redux/actions/Authorization.js.flow +3 -3
  25. package/lib/redux/actions/Authorization.js.map +1 -1
  26. package/lib/redux/actions/Error.js +2 -3
  27. package/lib/redux/actions/Error.js.flow +2 -1
  28. package/lib/redux/actions/Error.js.map +1 -1
  29. package/lib/utils/helpers/createHref.js.flow +1 -1
  30. package/lib/utils/helpers/createHref.js.map +1 -1
  31. package/package.json +4 -4
  32. package/src/hooks/__tests__/useModelCatalog.spec.js +1 -1
  33. package/src/hooks/useModelCatalog.js +1 -4
  34. package/src/redux/_modularui/ModularUIActions.js +4 -6
  35. package/src/redux/actions/Application.js +7 -1
  36. package/src/redux/actions/Authorization.js +3 -3
  37. package/src/redux/actions/Error.js +2 -1
  38. package/src/utils/helpers/createHref.js +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [1.59.11](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.59.10...v1.59.11) (2024-12-17)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **contenttype-hook:** remove entrydate from href ([e2bf9f3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/e2bf9f3b7f5af2806433364eb0546e231cd1488c))
11
+
12
+ ## [1.59.10](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.59.9...v1.59.10) (2024-12-16)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * **load-model:** remove load models that won't finish ([bd34d8f](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/bd34d8fdc207aa4f55261585df79ce92fe2d31b4))
18
+
5
19
  ## [1.59.9](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.59.8...v1.59.9) (2024-12-13)
6
20
 
7
21
  ## [1.59.8](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.59.7...v1.59.8) (2024-12-12)
@@ -105,10 +105,7 @@ export const useContent = function (contentSection) {
105
105
  export const useContentType = function (contentType) {
106
106
  let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "contenttypes";
107
107
  let options = arguments.length > 2 ? arguments[2] : undefined;
108
- const {
109
- entryDate
110
- } = useEntryDate();
111
- const href = createHref("contenttypes", contentType, entryDate, null, []);
108
+ const href = createHref("contenttypes", contentType, null, null, []);
112
109
  return useModularUIBasic(key, href, {
113
110
  expectedModels: ["ContentType"],
114
111
  targetModel: ContentTypeModel,
@@ -1 +1 @@
1
- {"version":3,"file":"useModelCatalog.js","names":["useSelector","useDispatch","useLocation","createHref","filterParameters","ModelCatalogModel","ConceptIndexModel","ConceptDetailModel","default","BusinessScenarioModel","ContentIndexModel","ContentTOCModel","ContentModel","useModularUIBasic","ContentTypeModel","getEntryDate","updateEntryDate","useModelCatalog","options","expectedModels","targetModel","useConceptIndex","href","key","arguments","length","undefined","entryDate","useEntryDate","url","setParameter","useConceptDetail","concept","location","useContentIndex","useContentTOC","content","useContent","contentSection","useContentType","contentType","getSearchHref","uri","filters","filterString","_Object$keys","filterValue","value","Array","isArray","join","replace","push","useConceptSearch","useContentSearch","dispatch","setEntryDate"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { useLocation } from \"./useRouter\";\n\nimport { createHref, filterParameters } from \"../utils/helpers/createHref\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\nimport { getEntryDate } from \"../redux/selectors/modelcatalog\";\nimport { updateEntryDate } from \"../redux/actions/ModelCatalog\";\n\nimport type Href from \"../models/href/Href\";\nimport type { UseModularUIBasicOptions } from \"./useModularUIBasic\";\nimport type { UpdateEntryDateAction } from \"../redux\";\nexport type SearchFilter = {\n index?: string,\n label?: string,\n type?: string | Array<string>,\n modelCategory?: string | Array<string>,\n entryDate?: string,\n};\n\n/**\n */\nexport const useModelCatalog = (\n options?: UseModularUIBasicOptions<ModelCatalogModel>,\n): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n ...options,\n });\n\n/**\n */\nexport const useConceptIndex = (\n href: string | Href,\n key?: string = \"conceptindex\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\n \"index\",\n \"label\",\n \"modelcategory\",\n \"type\",\n ]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string | Href,\n key?: string = \"conceptdetail\",\n options?: UseModularUIBasicOptions<\n ConceptDetailModel | BusinessScenarioModel,\n >,\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, entryDate, location, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentIndex = (\n href: string | Href,\n key?: string = \"contentindex\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentTOC = (\n content: string | Href,\n key?: string = \"contenttoc\",\n options?: UseModularUIBasicOptions<ContentTOCModel>,\n): ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContent = (\n contentSection: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel => {\n const { entryDate } = useEntryDate();\n\n const href = createHref(\"content\", contentSection, entryDate, null, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\"],\n targetModel: ContentModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentType = (\n contentType: string | Href,\n key?: string = \"contenttypes\",\n options?: UseModularUIBasicOptions<ContentTypeModel>,\n): ?ContentTypeModel => {\n const { entryDate } = useEntryDate();\n\n const href = createHref(\"contenttypes\", contentType, entryDate, null, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n ...options,\n });\n};\n\n/**\n */\nconst getSearchHref = (uri: string, filters: SearchFilter): string => {\n const filterString = [];\n\n for (const key of Object.keys(filters)) {\n const filterValue = filters[key];\n if (filterValue) {\n let value: string = Array.isArray(filterValue)\n ? filterValue.join(\",\")\n : filterValue;\n if (key === \"type\") {\n value = value.replace(\"#\", \"%23\"); // handles un-encoded #\n }\n filterString.push(`${key}=${value}`);\n }\n }\n\n return filterString.length ? `${uri}?${filterString.join(\"&\")}` : uri;\n};\n\n/**\n */\nexport const useConceptSearch = (\n filters: SearchFilter,\n key?: string = \"conceptSearch\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const href = getSearchHref(\"/concepts\", filters);\n return useConceptIndex(href, key, options);\n};\n\n/**\n */\nexport const useContentSearch = (\n filters: SearchFilter,\n key?: string = \"contentSearch\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const href = getSearchHref(\"/content\", filters);\n return useContentIndex(href, key, options);\n};\n\n/**\n * Retrieve and update the entrydate for the modelcatalog\n */\nexport const useEntryDate = (): ({\n entryDate: ISO_DATE,\n setEntryDate: (entryDate: ISO_DATE) => UpdateEntryDateAction,\n}) => {\n const dispatch = useDispatch();\n const entryDate = useSelector(getEntryDate);\n\n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,GAAG,IAAIE,YAAY,CAACM,IAAI,CAAC,GAAG,CAAC,EAAE,GAAGR,GAAG;AACvE,CAAC;;AAED;AACA;AACA,OAAO,MAAMW,gBAAgB,GAAG,SAAAA,CAC9BV,OAAqB,EAGE;EAAA,IAFvBpB,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,eAAe;EAAA,IAC9BN,OAAqD,GAAAM,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAErD,MAAMJ,IAAI,GAAGmB,aAAa,CAAC,WAAW,EAAEE,OAAO,CAAC;EAChD,OAAOtB,eAAe,CAACC,IAAI,EAAEC,GAAG,EAAEL,OAAO,CAAC;AAC5C,CAAC;;AAED;AACA;AACA,OAAO,MAAMoC,gBAAgB,GAAG,SAAAA,CAC9BX,OAAqB,EAGE;EAAA,IAFvBpB,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,eAAe;EAAA,IAC9BN,OAAqD,GAAAM,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAErD,MAAMJ,IAAI,GAAGmB,aAAa,CAAC,UAAU,EAAEE,OAAO,CAAC;EAC/C,OAAOT,eAAe,CAACZ,IAAI,EAAEC,GAAG,EAAEL,OAAO,CAAC;AAC5C,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMU,YAAY,GAAGA,CAAA,KAGtB;EACJ,MAAM2B,QAAQ,GAAGtD,WAAW,CAAC,CAAC;EAC9B,MAAM0B,SAAS,GAAG3B,WAAW,CAACe,YAAY,CAAC;EAE3C,OAAO;IACLY,SAAS;IACT6B,YAAY,EAAG7B,SAAmB,IAAK4B,QAAQ,CAACvC,eAAe,CAACW,SAAS,CAAC;EAC5E,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"useModelCatalog.js","names":["useSelector","useDispatch","useLocation","createHref","filterParameters","ModelCatalogModel","ConceptIndexModel","ConceptDetailModel","default","BusinessScenarioModel","ContentIndexModel","ContentTOCModel","ContentModel","useModularUIBasic","ContentTypeModel","getEntryDate","updateEntryDate","useModelCatalog","options","expectedModels","targetModel","useConceptIndex","href","key","arguments","length","undefined","entryDate","useEntryDate","url","setParameter","useConceptDetail","concept","location","useContentIndex","useContentTOC","content","useContent","contentSection","useContentType","contentType","getSearchHref","uri","filters","filterString","_Object$keys","filterValue","value","Array","isArray","join","replace","push","useConceptSearch","useContentSearch","dispatch","setEntryDate"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { useLocation } from \"./useRouter\";\n\nimport { createHref, filterParameters } from \"../utils/helpers/createHref\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\nimport { getEntryDate } from \"../redux/selectors/modelcatalog\";\nimport { updateEntryDate } from \"../redux/actions/ModelCatalog\";\n\nimport type Href from \"../models/href/Href\";\nimport type { UseModularUIBasicOptions } from \"./useModularUIBasic\";\nimport type { UpdateEntryDateAction } from \"../redux\";\nexport type SearchFilter = {\n index?: string,\n label?: string,\n type?: string | Array<string>,\n modelCategory?: string | Array<string>,\n entryDate?: string,\n};\n\n/**\n */\nexport const useModelCatalog = (\n options?: UseModularUIBasicOptions<ModelCatalogModel>,\n): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n ...options,\n });\n\n/**\n */\nexport const useConceptIndex = (\n href: string | Href,\n key?: string = \"conceptindex\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\n \"index\",\n \"label\",\n \"modelcategory\",\n \"type\",\n ]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string | Href,\n key?: string = \"conceptdetail\",\n options?: UseModularUIBasicOptions<\n ConceptDetailModel | BusinessScenarioModel,\n >,\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, entryDate, location, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentIndex = (\n href: string | Href,\n key?: string = \"contentindex\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentTOC = (\n content: string | Href,\n key?: string = \"contenttoc\",\n options?: UseModularUIBasicOptions<ContentTOCModel>,\n): ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContent = (\n contentSection: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel => {\n const { entryDate } = useEntryDate();\n\n const href = createHref(\"content\", contentSection, entryDate, null, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\"],\n targetModel: ContentModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentType = (\n contentType: string | Href,\n key?: string = \"contenttypes\",\n options?: UseModularUIBasicOptions<ContentTypeModel>,\n): ?ContentTypeModel => {\n const href = createHref(\"contenttypes\", contentType, null, null, []);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n ...options,\n });\n};\n\n/**\n */\nconst getSearchHref = (uri: string, filters: SearchFilter): string => {\n const filterString = [];\n\n for (const key of Object.keys(filters)) {\n const filterValue = filters[key];\n if (filterValue) {\n let value: string = Array.isArray(filterValue)\n ? filterValue.join(\",\")\n : filterValue;\n if (key === \"type\") {\n value = value.replace(\"#\", \"%23\"); // handles un-encoded #\n }\n filterString.push(`${key}=${value}`);\n }\n }\n\n return filterString.length ? `${uri}?${filterString.join(\"&\")}` : uri;\n};\n\n/**\n */\nexport const useConceptSearch = (\n filters: SearchFilter,\n key?: string = \"conceptSearch\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const href = getSearchHref(\"/concepts\", filters);\n return useConceptIndex(href, key, options);\n};\n\n/**\n */\nexport const useContentSearch = (\n filters: SearchFilter,\n key?: string = \"contentSearch\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const href = getSearchHref(\"/content\", filters);\n return useContentIndex(href, key, options);\n};\n\n/**\n * Retrieve and update the entrydate for the modelcatalog\n */\nexport const useEntryDate = (): ({\n entryDate: ISO_DATE,\n setEntryDate: (entryDate: ISO_DATE) => UpdateEntryDateAction,\n}) => {\n const dispatch = useDispatch();\n const entryDate = useSelector(getEntryDate);\n\n return {\n entryDate,\n setEntryDate: (entryDate: ISO_DATE) => dispatch(updateEntryDate(entryDate)),\n };\n};\n"],"mappings":";AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,aAAa;AACtD,SAASC,W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MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,eAAe;EAAA,IAC9BN,OAAqD,GAAAM,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAErD,MAAMJ,IAAI,GAAGmB,aAAa,CAAC,WAAW,EAAEE,OAAO,CAAC;EAChD,OAAOtB,eAAe,CAACC,IAAI,EAAEC,GAAG,EAAEL,OAAO,CAAC;AAC5C,CAAC;;AAED;AACA;AACA,OAAO,MAAMoC,gBAAgB,GAAG,SAAAA,CAC9BX,OAAqB,EAGE;EAAA,IAFvBpB,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,eAAe;EAAA,IAC9BN,OAAqD,GAAAM,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAErD,MAAMJ,IAAI,GAAGmB,aAAa,CAAC,UAAU,EAAEE,OAAO,CAAC;EAC/C,OAAOT,eAAe,CAACZ,IAAI,EAAEC,GAAG,EAAEL,OAAO,CAAC;AAC5C,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMU,YAAY,GAAGA,CAAA,KAGtB;EACJ,MAAM2B,QAAQ,GAAGtD,WAAW,CAAC,CAAC;EAC9B,MAAM0B,SAAS,GAAG3B,WAAW,CAACe,YAAY,CAAC;EAE3C,OAAO;IACLY,SAAS;IACT6B,YAAY,EAAG7B,SAAmB,IAAK4B,QAAQ,CAACvC,eAAe,CAACW,SAAS,CAAC;EAC5E,CAAC;AACH,CAAC","ignoreList":[]}
@@ -102,11 +102,7 @@ export const loadModel = (key, href, options) => ({
102
102
  origin: options?.origin,
103
103
  contextPath: options?.contextPath
104
104
  });
105
- if (errorResponse.isChangePassword) {
106
- return {
107
- type: "NO_ACTION"
108
- };
109
- } else if (errorResponse.isResourceNotFoundAfterReload) {
105
+ if (errorResponse.isChangePassword || errorResponse.isResourceNotFoundAfterReload) {
110
106
  return removeModelByKey(key);
111
107
  }
112
108
  return updateStatus(key, MODULARUI_STATUS.ERROR);
@@ -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","origin","contextPath","method","GET","data","locale","childmodels","targetModel","forceTargetModel","cache","successAction","errorAction","error","errorResponse","isChangePassword","isResourceNotFoundAfterReload","ERROR","loadModularUI","dispatch","getState","modularuiStore","modularui","LOADING","_Promise","resolve","loadModelPromise","then","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 key,\n origin: options?.origin,\n contextPath: options?.contextPath,\n href:\n href instanceof Href\n ? href\n : new Href(href, \"\", {\n origin: options?.origin,\n contextPath: options?.contextPath,\n }),\n method: options?.method ?? HTTP_METHODS.GET,\n 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 origin: options?.origin,\n contextPath: options?.contextPath,\n });\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, getState) => {\n const modularuiStore = getState()?.modularui;\n if (\n modularuiStore &&\n modularuiStore[key]?.status === MODULARUI_STATUS.LOADING\n ) {\n return Promise.resolve();\n }\n\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then(() => dispatch(finishProgress()))\n .catch((error) => dispatch(handleError(error)));\n };\n\n/**\n */\nexport const reloadModel = (\n model: ModularUIModel,\n options?: RequestModularUIOptions,\n): ThunkAction =>\n loadModularUI(model.connectKey, model.selfhref, {\n ...options,\n isReload: true,\n });\n"],"mappings":";AACA,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,MAAM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AAQC,OAAO,CAACC,gBAAgB,CAAC,CACrCC,IAAI,CAAC,MAAMR,QAAQ,CAACxC,cAAc,CAAC,CAAC,CAAC,CAAC,CACtCiD,KAAK,CAAEf,KAAK,IAAKM,QAAQ,CAACtC,WAAW,CAACgC,KAAK,CAAC,CAAC,CAAC;AACnD,CAAC;;AAEH;AACA;AACA,OAAO,MAAMgB,WAAW,GAAGA,CACzB7C,KAAqB,EACrBgB,OAAiC,KAEjCkB,aAAa,CAAClC,KAAK,CAACC,UAAU,EAAED,KAAK,CAAC8C,QAAQ,EAAE;EAC9C,GAAG9B,OAAO;EACV+B,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","getState","modularuiStore","modularui","LOADING","_Promise","resolve","loadModelPromise","then","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 key,\n origin: options?.origin,\n contextPath: options?.contextPath,\n href:\n href instanceof Href\n ? href\n : new Href(href, \"\", {\n origin: options?.origin,\n contextPath: options?.contextPath,\n }),\n method: options?.method ?? HTTP_METHODS.GET,\n 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 origin: options?.origin,\n contextPath: options?.contextPath,\n });\n if (\n errorResponse.isChangePassword ||\n errorResponse.isResourceNotFoundAfterReload\n ) {\n return removeModelByKey(key);\n }\n return updateStatus(key, MODULARUI_STATUS.ERROR);\n },\n },\n});\n\n/**\n */\nexport const loadModularUI =\n (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions,\n ): ThunkAction =>\n (dispatch: Dispatch, getState) => {\n const modularuiStore = getState()?.modularui;\n if (\n modularuiStore &&\n modularuiStore[key]?.status === MODULARUI_STATUS.LOADING\n ) {\n return Promise.resolve();\n }\n\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then(() => dispatch(finishProgress()))\n .catch((error) => dispatch(handleError(error)));\n };\n\n/**\n */\nexport const reloadModel = (\n model: ModularUIModel,\n options?: RequestModularUIOptions,\n): ThunkAction =>\n loadModularUI(model.connectKey, model.selfhref, {\n ...options,\n isReload: true,\n });\n"],"mappings":";AACA,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,MAAq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,CAAC,EAAEY,MAAM,KAAKnB,gBAAgB,CAAC+C,OAAO,EACxD;IACA,OAAOC,QAAA,CAAQC,OAAO,CAAC,CAAC;EAC1B;EAEAN,QAAQ,CAACvC,aAAa,CAAC,CAAC,CAAC;EAEzB,MAAM8C,gBAAgB,GAAGP,QAAQ,CAACrB,SAAS,CAACf,GAAG,EAAEgB,IAAI,EAAEC,OAAO,CAAC,CAAC;EAEhE,OAAOwB,QAAA,CAAQC,OAAO,CAACC,gBAAgB,CAAC,CACrCC,IAAI,CAAC,MAAMR,QAAQ,CAACxC,cAAc,CAAC,CAAC,CAAC,CAAC,CACtCiD,KAAK,CAAEf,KAAK,IAAKM,QAAQ,CAACtC,WAAW,CAACgC,KAAK,CAAC,CAAC,CAAC;AACnD,CAAC;;AAEH;AACA;AACA,OAAO,MAAMgB,WAAW,GAAGA,CACzB7C,KAAqB,EACrBgB,OAAiC,KAEjCkB,aAAa,CAAClC,KAAK,CAACC,UAAU,EAAED,KAAK,CAAC8C,QAAQ,EAAE;EAC9C,GAAG9B,OAAO;EACV+B,QAAQ,EAAE;AACZ,CAAC,CAAC","ignoreList":[]}
@@ -21,4 +21,10 @@ export const reloadApplication = () => (dispatch, getState) => {
21
21
  targetModel: ApplicationModel
22
22
  }));
23
23
  };
24
+
25
+ /**
26
+ */
27
+ export const noAction = () => ({
28
+ type: "NO_ACTION"
29
+ });
24
30
  //# sourceMappingURL=Application.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Application.js","names":["loadModularUI","removeModelByKey","allKeysByHref","getApplication","ApplicationModel","Href","getLocale","reloadApplication","dispatch","getState","state","applicationHref","application","contextPath","origin","allKeys","key","modelKey","targetModel"],"sources":["../../../src/redux/actions/Application.js"],"sourcesContent":["// @flow\nimport {\n loadModularUI,\n removeModelByKey,\n} from \"../_modularui/ModularUIActions\";\nimport {\n allKeysByHref,\n getApplication,\n} 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 state = getState();\n\n let applicationHref = new Href(\"/\", \"Application\");\n const application = getApplication(state);\n if (application) {\n applicationHref.contextPath = application.contextPath;\n applicationHref.origin = application.origin;\n }\n\n const allKeys = allKeysByHref(state, applicationHref);\n for (const key of allKeys) {\n dispatch(removeModelByKey(key));\n }\n\n const modelKey = `application(/)(${getLocale(state)})`;\n return dispatch(\n loadModularUI(modelKey, applicationHref, {\n targetModel: ApplicationModel,\n }),\n );\n };\n"],"mappings":"AACA,SACEA,aAAa,EACbC,gBAAgB,QACX,gCAAgC;AACvC,SACEC,aAAa,EACbC,cAAc,QACT,kCAAkC;AACzC,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,KAAK,GAAGD,QAAQ,CAAC,CAAC;EAExB,IAAIE,eAAe,GAAG,IAAIN,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC;EAClD,MAAMO,WAAW,GAAGT,cAAc,CAACO,KAAK,CAAC;EACzC,IAAIE,WAAW,EAAE;IACfD,eAAe,CAACE,WAAW,GAAGD,WAAW,CAACC,WAAW;IACrDF,eAAe,CAACG,MAAM,GAAGF,WAAW,CAACE,MAAM;EAC7C;EAEA,MAAMC,OAAO,GAAGb,aAAa,CAACQ,KAAK,EAAEC,eAAe,CAAC;EACrD,KAAK,MAAMK,GAAG,IAAID,OAAO,EAAE;IACzBP,QAAQ,CAACP,gBAAgB,CAACe,GAAG,CAAC,CAAC;EACjC;EAEA,MAAMC,QAAQ,GAAG,kBAAkBX,SAAS,CAACI,KAAK,CAAC,GAAG;EACtD,OAAOF,QAAQ,CACbR,aAAa,CAACiB,QAAQ,EAAEN,eAAe,EAAE;IACvCO,WAAW,EAAEd;EACf,CAAC,CACH,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Application.js","names":["loadModularUI","removeModelByKey","allKeysByHref","getApplication","ApplicationModel","Href","getLocale","reloadApplication","dispatch","getState","state","applicationHref","application","contextPath","origin","allKeys","key","modelKey","targetModel","noAction","type"],"sources":["../../../src/redux/actions/Application.js"],"sourcesContent":["// @flow\nimport {\n loadModularUI,\n removeModelByKey,\n} from \"../_modularui/ModularUIActions\";\nimport {\n allKeysByHref,\n getApplication,\n} from \"../_modularui/ModularUISelectors\";\nimport { ApplicationModel, Href } from \"../../models\";\nimport { getLocale } from \"../selectors/i18n\";\n\nimport type { Dispatch, GetState, ThunkAction, NoAction } from \"../types\";\n\n/**\n */\nexport const reloadApplication =\n (): ThunkAction => (dispatch: Dispatch, getState: GetState) => {\n const state = getState();\n\n let applicationHref = new Href(\"/\", \"Application\");\n const application = getApplication(state);\n if (application) {\n applicationHref.contextPath = application.contextPath;\n applicationHref.origin = application.origin;\n }\n\n const allKeys = allKeysByHref(state, applicationHref);\n for (const key of allKeys) {\n dispatch(removeModelByKey(key));\n }\n\n const modelKey = `application(/)(${getLocale(state)})`;\n return dispatch(\n loadModularUI(modelKey, applicationHref, {\n targetModel: ApplicationModel,\n }),\n );\n };\n\n/**\n */\nexport const noAction = (): NoAction => ({\n type: \"NO_ACTION\",\n});\n"],"mappings":"AACA,SACEA,aAAa,EACbC,gBAAgB,QACX,gCAAgC;AACvC,SACEC,aAAa,EACbC,cAAc,QACT,kCAAkC;AACzC,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,KAAK,GAAGD,QAAQ,CAAC,CAAC;EAExB,IAAIE,eAAe,GAAG,IAAIN,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC;EAClD,MAAMO,WAAW,GAAGT,cAAc,CAACO,KAAK,CAAC;EACzC,IAAIE,WAAW,EAAE;IACfD,eAAe,CAACE,WAAW,GAAGD,WAAW,CAACC,WAAW;IACrDF,eAAe,CAACG,MAAM,GAAGF,WAAW,CAACE,MAAM;EAC7C;EAEA,MAAMC,OAAO,GAAGb,aAAa,CAACQ,KAAK,EAAEC,eAAe,CAAC;EACrD,KAAK,MAAMK,GAAG,IAAID,OAAO,EAAE;IACzBP,QAAQ,CAACP,gBAAgB,CAACe,GAAG,CAAC,CAAC;EACjC;EAEA,MAAMC,QAAQ,GAAG,kBAAkBX,SAAS,CAACI,KAAK,CAAC,GAAG;EACtD,OAAOF,QAAQ,CACbR,aAAa,CAACiB,QAAQ,EAAEN,eAAe,EAAE;IACvCO,WAAW,EAAEd;EACf,CAAC,CACH,CAAC;AACH,CAAC;;AAEH;AACA;AACA,OAAO,MAAMe,QAAQ,GAAGA,CAAA,MAAiB;EACvCC,IAAI,EAAE;AACR,CAAC,CAAC","ignoreList":[]}
@@ -4,10 +4,9 @@ import { logoutSuccess } from "./SignOut";
4
4
  import Cache from "../../utils/browser/Cache";
5
5
  import { removeModelByKey } from "../_modularui/ModularUIActions";
6
6
  import { getApplication } from "../_modularui/ModularUISelectors";
7
- import { reloadApplication } from "./Application";
8
- import { getSetting } from "../../constants";
7
+ import { noAction, reloadApplication } from "./Application";
9
8
  import { sendAuthenticationError } from "./SignIn";
10
-
9
+ import { getSetting } from "../../constants";
11
10
  /**
12
11
  */
13
12
  export const handleUnauthorized = errorResponse => (dispatch, getState) => {
@@ -43,8 +42,6 @@ export const handleUnauthorized = errorResponse => (dispatch, getState) => {
43
42
  modal: false
44
43
  }));
45
44
  }
46
- return {
47
- type: "NO_ACTION"
48
- };
45
+ return dispatch(noAction());
49
46
  };
50
47
  //# sourceMappingURL=Authorization.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Authorization.js","names":["ErrorResponse","replace","logoutSuccess","Cache","removeModelByKey","getApplication","reloadApplication","getSetting","sendAuthenticationError","handleUnauthorized","errorResponse","dispatch","getState","connectKey","response","error","window","location","reload","application","getItem","isLoggedIn","removeItem","isInvalidUsername","message","router","LOGIN_PATH","pathname","locationFrom","state","from","modal","type"],"sources":["../../../src/redux/actions/Authorization.js"],"sourcesContent":["// @flow\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\n\nimport { replace } from \"../_router/RouterActions\";\nimport { logoutSuccess } from \"./SignOut\";\n\nimport Cache from \"../../utils/browser/Cache\";\n\nimport { removeModelByKey } from \"../_modularui/ModularUIActions\";\nimport { getApplication } from \"../_modularui/ModularUISelectors\";\nimport { reloadApplication } from \"./Application\";\n\nimport { getSetting } from \"../../constants\";\n\nimport type { ThunkAction } from \"../types\";\nimport { sendAuthenticationError } from \"./SignIn\";\n\n/**\n */\nexport const handleUnauthorized =\n (errorResponse: ErrorResponse): ThunkAction =>\n (dispatch, getState) => {\n if (errorResponse.connectKey) {\n dispatch(removeModelByKey(errorResponse.connectKey));\n }\n\n if (\n getSetting(\"PAGE_RELOAD_ON_UNAUTHORIZED_ERROR\", false) &&\n errorResponse.response?.error\n ) {\n window.location.reload();\n return;\n }\n\n // reload application when flag auth is set or isLogged\n const application = getApplication(getState());\n if (Cache.getItem(\"auth\") || application?.isLoggedIn) {\n dispatch(reloadApplication());\n }\n\n // set logged out\n dispatch(logoutSuccess());\n\n Cache.removeItem(\"auth\");\n\n if (errorResponse.isInvalidUsername) {\n dispatch(sendAuthenticationError(errorResponse.message));\n }\n\n // add current location as from location before redirect\n const location = getState().router.location;\n const LOGIN_PATH = getSetting(\"LOGIN_PATH\", \"/signin\");\n if (location?.pathname !== LOGIN_PATH) {\n const locationFrom = location?.state?.from;\n return dispatch(\n replace(LOGIN_PATH, {\n from: locationFrom ? locationFrom : getState().router.location,\n // cannot open login in a modal, because of previous locations that might be secure\n modal: false,\n }),\n );\n }\n\n return { type: \"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C,YAAY,EAAE,SAAS,CAAC;EACtD,IAAIU,QAAQ,EAAEU,QAAQ,KAAKD,UAAU,EAAE;IACrC,MAAME,YAAY,GAAGX,QAAQ,EAAEY,KAAK,EAAEC,IAAI;IAC1C,OAAOnB,QAAQ,CACbV,OAAO,CAACyB,UAAU,EAAE;MAClBI,IAAI,EAAEF,YAAY,GAAGA,YAAY,GAAGhB,QAAQ,CAAC,CAAC,CAACa,MAAM,CAACR,QAAQ;MAC9D;MACAc,KAAK,EAAE;IACT,CAAC,CACH,CAAC;EACH;EAEA,OAAO;IAAEC,IAAI,EAAE;EAAY,CAAC;AAC9B,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Authorization.js","names":["ErrorResponse","replace","logoutSuccess","Cache","removeModelByKey","getApplication","noAction","reloadApplication","sendAuthenticationError","getSetting","handleUnauthorized","errorResponse","dispatch","getState","connectKey","response","error","window","location","reload","application","getItem","isLoggedIn","removeItem","isInvalidUsername","message","router","LOGIN_PATH","pathname","locationFrom","state","from","modal"],"sources":["../../../src/redux/actions/Authorization.js"],"sourcesContent":["// @flow\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\n\nimport { replace } from \"../_router/RouterActions\";\nimport { logoutSuccess } from \"./SignOut\";\n\nimport Cache from \"../../utils/browser/Cache\";\n\nimport { removeModelByKey } from \"../_modularui/ModularUIActions\";\nimport { getApplication } from \"../_modularui/ModularUISelectors\";\nimport { noAction, reloadApplication } from \"./Application\";\nimport { sendAuthenticationError } from \"./SignIn\";\n\nimport { getSetting } from \"../../constants\";\n\nimport type { ThunkAction } from \"../types\";\n\n/**\n */\nexport const handleUnauthorized =\n (errorResponse: ErrorResponse): ThunkAction =>\n (dispatch, getState) => {\n if (errorResponse.connectKey) {\n dispatch(removeModelByKey(errorResponse.connectKey));\n }\n\n if (\n getSetting(\"PAGE_RELOAD_ON_UNAUTHORIZED_ERROR\", false) &&\n errorResponse.response?.error\n ) {\n window.location.reload();\n return;\n }\n\n // reload application when flag auth is set or isLogged\n const application = getApplication(getState());\n if (Cache.getItem(\"auth\") || application?.isLoggedIn) {\n dispatch(reloadApplication());\n }\n\n // set logged out\n dispatch(logoutSuccess());\n\n Cache.removeItem(\"auth\");\n\n if (errorResponse.isInvalidUsername) {\n dispatch(sendAuthenticationError(errorResponse.message));\n }\n\n // add current location as from location before redirect\n const location = getState().router.location;\n const LOGIN_PATH = getSetting(\"LOGIN_PATH\", \"/signin\");\n if (location?.pathname !== LOGIN_PATH) {\n const locationFrom = location?.state?.from;\n return dispatch(\n replace(LOGIN_PATH, {\n from: locationFrom ? locationFrom : getState().router.location,\n // cannot open login in a modal, because of previous locations that might be secure\n modal: false,\n }),\n );\n }\n\n return dispatch(noAction());\n };\n"],"mappings":"AACA,OAAOA,aAAa,MAAM,kCAAkC;AAE5D,SAASC,OAAO,QAAQ,0BAA0B;AAClD,SAASC,aAAa,QAAQ,WAAW;AAEzC,OAAOC,KAAK,MAAM,2BAA2B;AAE7C,SAASC,gBAAgB,QAAQ,gCAAgC;AACjE,SAASC,cAAc,QAAQ,kCAAkC;AACjE,SAASC,QAAQ,EAAEC,iBAAiB,QAAQ,eAAe;AAC3D,SAASC,uBAAuB,QAAQ,UAAU;AAElD,SAASC,UAAU,QAAQ,iBAAiB;AAI5C;AACA;AACA,OAAO,MAAMC,kBAAkB,GAC5BC,aAA4B,IAC7B,CAACC,QAAQ,EAAEC,QAAQ,KAAK;EACtB,IAAIF,aAAa,CAACG,UAAU,EAAE;IAC5BF,QAAQ,CAACR,gBAAgB,CAACO,aAAa,CAACG,UAAU,CAAC,CAAC;EACtD;EAEA,IACEL,UAAU,CAAC,mCAAmC,EAAE,KAAK,CAAC,IACtDE,aAAa,CAACI,QAAQ,EAAEC,KAAK,EAC7B;IACAC,MAAM,CAACC,QAAQ,CAACC,MAAM,CAAC,CAAC;IACxB;EACF;;EAEA;EACA,MAAMC,WAAW,GAAGf,cAAc,CAACQ,QAAQ,CAAC,CAAC,CAAC;EAC9C,IAAIV,KAAK,CAACkB,OAAO,CAAC,MAAM,CAAC,IAAID,WAAW,EAAEE,UAAU,EAAE;IACpDV,QAAQ,CAACL,iBAAiB,CAAC,CAAC,CAAC;EAC/B;;EAEA;EACAK,QAAQ,CAACV,aAAa,CAAC,CAAC,CAAC;EAEzBC,KAAK,CAACoB,UAAU,CAAC,MAAM,CAAC;EAExB,IAAIZ,aAAa,CAACa,iBAAiB,EAAE;IACnCZ,QAAQ,CAACJ,uBAAuB,CAACG,aAAa,CAACc,OAAO,CAAC,CAAC;EAC1D;;EAEA;EACA,MAAMP,QAAQ,GAAGL,QAAQ,CAAC,CAAC,CAACa,MAAM,CAACR,QAAQ;EAC3C,MAAMS,UAAU,GAAGlB,UAAU,CAAC,YAAY,EAAE,SAAS,CAAC;EACtD,IAAIS,QAAQ,EAAEU,QAAQ,KAAKD,UAAU,EAAE;IACrC,MAAME,YAAY,GAAGX,QAAQ,EAAEY,KAAK,EAAEC,IAAI;IAC1C,OAAOnB,QAAQ,CACbX,OAAO,CAAC0B,UAAU,EAAE;MAClBI,IAAI,EAAEF,YAAY,GAAGA,YAAY,GAAGhB,QAAQ,CAAC,CAAC,CAACa,MAAM,CAACR,QAAQ;MAC9D;MACAc,KAAK,EAAE;IACT,CAAC,CACH,CAAC;EACH;EAEA,OAAOpB,QAAQ,CAACN,QAAQ,CAAC,CAAC,CAAC;AAC7B,CAAC","ignoreList":[]}
@@ -6,6 +6,7 @@ import { showXHRErrorNotification } from "./Notification";
6
6
  import { resetProgress } from "./ProgressIndicator";
7
7
  import { changePassword } from "./SignIn";
8
8
  import { handleUnauthorized } from "./Authorization";
9
+ import { noAction } from "./Application";
9
10
  /**
10
11
  */
11
12
  const saveError = error => ({
@@ -17,9 +18,7 @@ const saveError = error => ({
17
18
  */
18
19
  const defaultErrorResponseHandler = error => dispatch => {
19
20
  if (error.isResourceNotFoundAfterReload || error.isRemoteServiceException) {
20
- return dispatch({
21
- type: "NO_ACTION"
22
- });
21
+ return dispatch(noAction());
23
22
  }
24
23
  if (error.isUnauthorized) {
25
24
  return dispatch(handleUnauthorized(error));
@@ -1 +1 @@
1
- {"version":3,"file":"Error.js","names":["IS_SERVER","getSetting","ErrorResponse","push","showXHRErrorNotification","resetProgress","changePassword","handleUnauthorized","saveError","error","type","payload","defaultErrorResponseHandler","dispatch","isResourceNotFoundAfterReload","isRemoteServiceException","isUnauthorized","isBlocked","isConcurrentUser","isInvalidUsername","LOGOUT_PATH","isChangePassword","setTimeout","customErrorResponseHandler","errorResponse","defaultHandler","setCustomErrorResponseHandler","handler","handleError"],"sources":["../../../src/redux/actions/Error.js"],"sourcesContent":["// @flow\nimport { IS_SERVER } from \"../../constants/Constants\";\nimport { getSetting } from \"../../constants/Settings\";\n\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\n\nimport { push } from \"../_router/RouterActions\";\nimport { showXHRErrorNotification } from \"./Notification\";\nimport { resetProgress } from \"./ProgressIndicator\";\nimport { changePassword } from \"./SignIn\";\nimport { handleUnauthorized } from \"./Authorization\";\n\nimport type { FetchException } from \"../../exceptions\";\nimport type { Dispatch, SaveErrorAction, ThunkAction } from \"../types\";\n\ntype DefaultErrorResponseHandler = (error: ErrorResponse) => ThunkAction;\ntype CustomErrorResponseHandler = (\n errorResponse: ErrorResponse,\n defaultHandler: DefaultErrorResponseHandler,\n) => ThunkAction;\n\n/**\n */\nconst saveError = (error: ErrorResponse): SaveErrorAction => ({\n type: \"SAVE_ERROR\",\n payload: error,\n});\n\n/**\n */\nconst defaultErrorResponseHandler: DefaultErrorResponseHandler =\n (error: ErrorResponse): ThunkAction =>\n (dispatch: Dispatch) => {\n if (error.isResourceNotFoundAfterReload || error.isRemoteServiceException) {\n return dispatch({ type: \"NO_ACTION\" });\n }\n\n if (error.isUnauthorized) {\n return dispatch(handleUnauthorized(error));\n }\n\n if (error.isBlocked || error.isConcurrentUser || error.isInvalidUsername) {\n const LOGOUT_PATH = getSetting(\"LOGOUT_PATH\", \"/signout\");\n dispatch(push(LOGOUT_PATH));\n }\n\n if (error.isChangePassword) {\n return dispatch(changePassword());\n }\n\n if (IS_SERVER) {\n return dispatch(saveError(error));\n }\n\n setTimeout(() => {\n throw error.error;\n });\n\n return dispatch(showXHRErrorNotification(error));\n };\n\n/**\n * Standard Custom error response, acts as a proxy and can be overwritten by {@link setCustomErrorResponseHandler}\n */\nlet customErrorResponseHandler: CustomErrorResponseHandler =\n (errorResponse, defaultHandler) => (dispatch: Dispatch) =>\n dispatch(defaultHandler(errorResponse));\n\n/**\n * Set a custom error response handler,\n * can be used when custom functionality is needed on certain (error) response\n * of the modular ui, for example when custom logic is needed when a user is unauthorized<br>\n * It receives an {@link ErrorResponse} and the {@link defaultErrorResponseHandler}\n */\nexport const setCustomErrorResponseHandler = (\n handler: CustomErrorResponseHandler,\n) => {\n customErrorResponseHandler = handler;\n};\n\n/**\n * Handle errors by sending an error notification message\n */\nexport const handleError =\n (error: Error | FetchException): ThunkAction =>\n (dispatch: Dispatch) => {\n dispatch(resetProgress());\n\n const errorResponse = new ErrorResponse(error);\n\n return dispatch(\n customErrorResponseHandler(errorResponse, defaultErrorResponseHandler),\n );\n };\n"],"mappings":"AACA,SAASA,SAAS,QAAQ,2BAA2B;AACrD,SAASC,UAAU,QAAQ,0BAA0B;AAErD,OAAOC,aAAa,MAAM,kCAAkC;AAE5D,SAASC,IAAI,QAAQ,0BAA0B;AAC/C,SAASC,wBAAwB,QAAQ,gBAAgB;AACzD,SAASC,aAAa,QAAQ,qBAAqB;AACnD,SAASC,cAAc,QAAQ,UAAU;AACzC,SAASC,kBAAkB,QAAQ,iBAAiB;AAWpD;AACA;AACA,MAAMC,SAAS,GAAIC,KAAoB,KAAuB;EAC5DC,IAAI,EAAE,YAAY;EAClBC,OAAO,EAAEF;AACX,CAAC,CAAC;;AAEF;AACA;AACA,MAAMG,2BAAwD,GAC3DH,KAAoB,IACpBI,QAAkB,IAAK;EACtB,IAAIJ,KAAK,CAACK,6BAA6B,IAAIL,KAAK,CAACM,wBAAwB,EAAE;IACzE,OA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ignoreList":[]}
1
+ {"version":3,"file":"Error.js","names":["IS_SERVER","getSetting","ErrorResponse","push","showXHRErrorNotification","resetProgress","changePassword","handleUnauthorized","noAction","saveError","error","type","payload","defaultErrorResponseHandler","dispatch","isResourceNotFoundAfterReload","isRemoteServiceException","isUnauthorized","isBlocked","isConcurrentUser","isInvalidUsername","LOGOUT_PATH","isChangePassword","setTimeout","customErrorResponseHandler","errorResponse","defaultHandler","setCustomErrorResponseHandler","handler","handleError"],"sources":["../../../src/redux/actions/Error.js"],"sourcesContent":["// @flow\nimport { IS_SERVER } from \"../../constants/Constants\";\nimport { getSetting } from \"../../constants/Settings\";\n\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\n\nimport { push } from \"../_router/RouterActions\";\nimport { showXHRErrorNotification } from \"./Notification\";\nimport { resetProgress } from \"./ProgressIndicator\";\nimport { changePassword } from \"./SignIn\";\nimport { handleUnauthorized } from \"./Authorization\";\nimport { noAction } from \"./Application\";\n\nimport type { FetchException } from \"../../exceptions\";\nimport type { Dispatch, SaveErrorAction, ThunkAction } from \"../types\";\n\ntype DefaultErrorResponseHandler = (error: ErrorResponse) => ThunkAction;\ntype CustomErrorResponseHandler = (\n errorResponse: ErrorResponse,\n defaultHandler: DefaultErrorResponseHandler,\n) => ThunkAction;\n\n/**\n */\nconst saveError = (error: ErrorResponse): SaveErrorAction => ({\n type: \"SAVE_ERROR\",\n payload: error,\n});\n\n/**\n */\nconst defaultErrorResponseHandler: DefaultErrorResponseHandler =\n (error: ErrorResponse): ThunkAction =>\n (dispatch: Dispatch) => {\n if (error.isResourceNotFoundAfterReload || error.isRemoteServiceException) {\n return dispatch(noAction());\n }\n\n if (error.isUnauthorized) {\n return dispatch(handleUnauthorized(error));\n }\n\n if (error.isBlocked || error.isConcurrentUser || error.isInvalidUsername) {\n const LOGOUT_PATH = getSetting(\"LOGOUT_PATH\", \"/signout\");\n dispatch(push(LOGOUT_PATH));\n }\n\n if (error.isChangePassword) {\n return dispatch(changePassword());\n }\n\n if (IS_SERVER) {\n return dispatch(saveError(error));\n }\n\n setTimeout(() => {\n throw error.error;\n });\n\n return dispatch(showXHRErrorNotification(error));\n };\n\n/**\n * Standard Custom error response, acts as a proxy and can be overwritten by {@link setCustomErrorResponseHandler}\n */\nlet customErrorResponseHandler: CustomErrorResponseHandler =\n (errorResponse, defaultHandler) => (dispatch: Dispatch) =>\n dispatch(defaultHandler(errorResponse));\n\n/**\n * Set a custom error response handler,\n * can be used when custom functionality is needed on certain (error) response\n * of the modular ui, for example when custom logic is needed when a user is unauthorized<br>\n * It receives an {@link ErrorResponse} and the {@link defaultErrorResponseHandler}\n */\nexport const setCustomErrorResponseHandler = (\n handler: CustomErrorResponseHandler,\n) => {\n customErrorResponseHandler = handler;\n};\n\n/**\n * Handle errors by sending an error notification message\n */\nexport const handleError =\n (error: Error | FetchException): ThunkAction =>\n (dispatch: Dispatch) => {\n dispatch(resetProgress());\n\n const errorResponse = new ErrorResponse(error);\n\n return dispatch(\n customErrorResponseHandler(errorResponse, defaultErrorResponseHandler),\n );\n };\n"],"mappings":"AACA,SAASA,SAAS,QAAQ,2BAA2B;AACrD,SAASC,UAAU,QAAQ,0BAA0B;AAErD,OAAOC,aAAa,MAAM,kCAAkC;AAE5D,SAASC,IAAI,QAAQ,0BAA0B;AAC/C,SAASC,wBAAwB,QAAQ,gBAAgB;AACzD,SAASC,aAAa,QAAQ,qBAAqB;AACnD,SAASC,cAAc,QAAQ,UAAU;AACzC,SAASC,kBAAkB,QAAQ,iBAAiB;AACpD,SAASC,QAAQ,QAAQ,eAAe;AAWxC;AACA;AACA,MAAMC,SAAS,GAAIC,KAAoB,KAAuB;EAC5DC,IAAI,EAAE,YAAY;EAClBC,OAAO,EAAEF;AACX,CAAC,CAAC;;AAEF;AACA;AACA,MAAMG,2BAAwD,GAC3DH,KAAoB,IACpBI,QAAkB,IAAK;EACtB,IAAIJ,KAAK,CAACK,6BAA6B,IAAIL,KAAK,CAACM,wBAAwB,EAAE;IACzE,OAA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]}
@@ -1 +1 @@
1
- {"version":3,"file":"createHref.js","names":["Href","parseUrl","href","path","querystring","hash","_includesInstanceProperty","call","hashSplit","split","qsSplit","filterParameters","allowedParameters","Array","isArray","url","filteredUrl","searchParams","_URLSearchParams","params","_Array$from","_keysInstanceProperty","param","delete","toString","resourcetype","origin","contextPath","createHref","context","dynamicPart","entryDate","location","_startsWithInstanceProperty","replace","search","_context","substring","finalHref","setParameter","removeParameter"],"sources":["../../../src/utils/helpers/createHref.js"],"sourcesContent":["// @flow\nimport Href from \"../../models/href/Href\";\n\nimport type { Location } from \"react-router\";\n\n/**\n */\nexport const parseUrl = (\n href: string | Href,\n): { path: string, querystring: null | string, hash: null | string } => {\n if (href instanceof Href) {\n return {\n path: href.path,\n querystring: href.querystring,\n hash: href.hash,\n };\n }\n\n let path = href;\n let hash = null;\n let querystring = null;\n if (href.includes(\"#\")) {\n const hashSplit = href.split(\"#\");\n path = hashSplit[0];\n hash = hashSplit[1];\n }\n if (href.includes(\"?\")) {\n const qsSplit = path.split(\"?\");\n path = qsSplit[0];\n querystring = qsSplit[1];\n }\n return {\n path,\n querystring,\n hash,\n };\n};\n\n/**\n */\nexport const filterParameters = (\n href: string | Href,\n allowedParameters?: Array<string>,\n): Href => {\n if (!Array.isArray(allowedParameters)) {\n return new Href(href);\n }\n\n const url = parseUrl(href);\n let filteredUrl = url.path;\n if (url.querystring) {\n const searchParams = new URLSearchParams(url.querystring);\n const params = Array.from(searchParams.keys());\n for (const param of params) {\n if (!allowedParameters.includes(param)) {\n searchParams.delete(param);\n }\n }\n filteredUrl = filteredUrl + \"?\" + searchParams.toString();\n }\n if (url.hash) {\n filteredUrl = filteredUrl + \"#\" + url.hash;\n }\n\n if (href instanceof Href) {\n return new Href(filteredUrl, href.resourcetype, {\n origin: href.origin,\n contextPath: href.contextPath,\n });\n }\n\n return new Href(filteredUrl);\n};\n\n/**\n */\nexport const createHref = (\n context: string,\n dynamicPart: string | Href,\n entryDate?: ISO_DATE,\n location?: ?Location,\n allowedParameters?: Array<string>,\n): Href => {\n let href = dynamicPart.toString();\n\n if (!href.startsWith(`/${context}/`)) {\n href = `/${context}/${href}`;\n }\n\n href = href.replace(/\\/\\//g, \"/\");\n\n if (location?.search && !href.includes(\"?\")) {\n const search = location.search.startsWith(\"?\")\n ? location.search.substring(1)\n : location.search;\n href = `${href}?${search}`;\n }\n\n const finalHref =\n dynamicPart instanceof Href\n ? filterParameters(\n new Href(href, dynamicPart.resourcetype, {\n origin: dynamicPart.origin,\n contextPath: dynamicPart.contextPath,\n }),\n allowedParameters,\n )\n : filterParameters(href, allowedParameters);\n\n if (entryDate) {\n finalHref.setParameter(\"entryDate\", entryDate);\n } else {\n finalHref.removeParameter(\"entryDate\");\n }\n\n return finalHref;\n};\n"],"mappings":";;;;;AACA,OAAOA,IAAI,MAAM,wBAAwB;AAIzC;AACA;AACA,OAAO,MAAMC,QAAQ,GACnBC,IAAmB,IACmD;EACtE,IAAIA,IAAI,YAAYF,IAAI,EAAE;IACxB,OAAO;MACLG,IAAI,EAAED,IAAI,CAACC,IAAI;MACfC,WAAW,EAAEF,IAAI,CAACE,WAAW;MAC7BC,IAAI,EAAEH,IAAI,CAACG;IACb,CAAC;EACH;EAEA,IAAIF,IAAI,GAAGD,IAAI;EACf,IAAIG,IAAI,GAAG,IAAI;EACf,IAAID,WAAW,GAAG,IAAI;EACtB,IAAIE,yBAAA,CAAAJ,IAAI,EAAAK,IAAA,CAAJL,IAAI,EAAU,GAAG,CAAC,EAAE;IACtB,MAAMM,SAAS,GAAGN,IAAI,CAACO,KAAK,CAAC,GAAG,CAAC;IACjCN,IAAI,GAAGK,SAAS,CAAC,CAAC,CAAC;IACnBH,IAAI,GAAGG,SAAS,CAAC,CAAC,CAAC;EACrB;EACA,IAAIF,yBAAA,CAAAJ,IAAI,EAAAK,IAAA,CAAJL,IAAI,EAAU,GAAG,CAAC,EAAE;IACtB,MAAMQ,OAAO,GAAGP,IAAI,CAACM,KAAK,CAAC,GAAG,CAAC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O,SAAS,CAACC,YAAY,CAAC,WAAW,EAAER,SAAS,CAAC;EAChD,CAAC,MAAM;IACLO,SAAS,CAACE,eAAe,CAAC,WAAW,CAAC;EACxC;EAEA,OAAOF,SAAS;AAClB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"createHref.js","names":["Href","parseUrl","href","path","querystring","hash","_includesInstanceProperty","call","hashSplit","split","qsSplit","filterParameters","allowedParameters","Array","isArray","url","filteredUrl","searchParams","_URLSearchParams","params","_Array$from","_keysInstanceProperty","param","delete","toString","resourcetype","origin","contextPath","createHref","context","dynamicPart","entryDate","location","_startsWithInstanceProperty","replace","search","_context","substring","finalHref","setParameter","removeParameter"],"sources":["../../../src/utils/helpers/createHref.js"],"sourcesContent":["// @flow\nimport Href from \"../../models/href/Href\";\n\nimport type { Location } from \"react-router\";\n\n/**\n */\nexport const parseUrl = (\n href: string | Href,\n): { path: string, querystring: null | string, hash: null | string } => {\n if (href instanceof Href) {\n return {\n path: href.path,\n querystring: href.querystring,\n hash: href.hash,\n };\n }\n\n let path = href;\n let hash = null;\n let querystring = null;\n if (href.includes(\"#\")) {\n const hashSplit = href.split(\"#\");\n path = hashSplit[0];\n hash = hashSplit[1];\n }\n if (href.includes(\"?\")) {\n const qsSplit = path.split(\"?\");\n path = qsSplit[0];\n querystring = qsSplit[1];\n }\n return {\n path,\n querystring,\n hash,\n };\n};\n\n/**\n */\nexport const filterParameters = (\n href: string | Href,\n allowedParameters?: Array<string>,\n): Href => {\n if (!Array.isArray(allowedParameters)) {\n return new Href(href);\n }\n\n const url = parseUrl(href);\n let filteredUrl = url.path;\n if (url.querystring) {\n const searchParams = new URLSearchParams(url.querystring);\n const params = Array.from(searchParams.keys());\n for (const param of params) {\n if (!allowedParameters.includes(param)) {\n searchParams.delete(param);\n }\n }\n filteredUrl = filteredUrl + \"?\" + searchParams.toString();\n }\n if (url.hash) {\n filteredUrl = filteredUrl + \"#\" + url.hash;\n }\n\n if (href instanceof Href) {\n return new Href(filteredUrl, href.resourcetype, {\n origin: href.origin,\n contextPath: href.contextPath,\n });\n }\n\n return new Href(filteredUrl);\n};\n\n/**\n */\nexport const createHref = (\n context: string,\n dynamicPart: string | Href,\n entryDate?: ?ISO_DATE,\n location?: ?Location,\n allowedParameters?: Array<string>,\n): Href => {\n let href = dynamicPart.toString();\n\n if (!href.startsWith(`/${context}/`)) {\n href = `/${context}/${href}`;\n }\n\n href = href.replace(/\\/\\//g, \"/\");\n\n if (location?.search && !href.includes(\"?\")) {\n const search = location.search.startsWith(\"?\")\n ? location.search.substring(1)\n : location.search;\n href = `${href}?${search}`;\n }\n\n const finalHref =\n dynamicPart instanceof Href\n ? filterParameters(\n new Href(href, dynamicPart.resourcetype, {\n origin: dynamicPart.origin,\n contextPath: dynamicPart.contextPath,\n }),\n allowedParameters,\n )\n : filterParameters(href, allowedParameters);\n\n if (entryDate) {\n finalHref.setParameter(\"entryDate\", entryDate);\n } else {\n finalHref.removeParameter(\"entryDate\");\n }\n\n return finalHref;\n};\n"],"mappings":";;;;;AACA,OAAOA,IAAI,MAAM,wBAAwB;AAIzC;AACA;AACA,OAAO,MAAMC,QAAQ,GACnBC,IAAmB,IACmD;EACtE,IAAIA,IAAI,YAAYF,IAAI,EAAE;IACxB,OAAO;MACLG,IAAI,EAAED,IAAI,CAACC,IAAI;MACfC,WAAW,EAAEF,IAAI,CAACE,WAAW;MAC7BC,IAAI,EAAEH,IAAI,CAACG;IACb,CAAC;EACH;EAEA,IAAIF,IAAI,GAAGD,IAAI;EACf,IAAIG,IAAI,GAAG,IAAI;EACf,IAAID,WAAW,GAAG,IAAI;EACtB,IAAIE,yBAAA,CAAAJ,IAAI,EAAAK,IAAA,CAAJL,IAAI,EAAU,GAAG,CAAC,EAAE;IACtB,MAAMM,SAAS,GAAGN,IAAI,CAACO,KAAK,CAAC,GAAG,CAAC;IACjCN,IAAI,GAAGK,SAAS,CAAC,CAAC,CAAC;IACnBH,IAAI,GAAGG,SAAS,CAAC,CAAC,CAAC;EACrB;E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1BC,WAAW,EAAEG,WAAW,CAACH;EAC3B,CAAC,CAAC,EACFf,iBACF,CAAC,GACDD,gBAAgB,CAACT,IAAI,EAAEU,iBAAiB,CAAC;EAE/C,IAAImB,SAAS,EAAE;IACbO,SAAS,CAACC,YAAY,CAAC,WAAW,EAAER,SAAS,CAAC;EAChD,CAAC,MAAM;IACLO,SAAS,CAACE,eAAe,CAAC,WAAW,CAAC;EACxC;EAEA,OAAOF,SAAS;AAClB,CAAC","ignoreList":[]}
@@ -156,7 +156,7 @@ describe("modelcatalog hooks", () => {
156
156
  assertTargetModel(
157
157
  () => useContentType("/contenttypes/contenttype"),
158
158
  "contenttypes",
159
- "/contenttypes/contenttype?entryDate=" + DateUtil.now(),
159
+ "/contenttypes/contenttype",
160
160
  ContentTypeModel,
161
161
  );
162
162
  });
@@ -118,10 +118,7 @@ exports.useContent = useContent;
118
118
  const useContentType = function (contentType) {
119
119
  let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "contenttypes";
120
120
  let options = arguments.length > 2 ? arguments[2] : undefined;
121
- const {
122
- entryDate
123
- } = useEntryDate();
124
- const href = (0, _createHref.createHref)("contenttypes", contentType, entryDate, null, []);
121
+ const href = (0, _createHref.createHref)("contenttypes", contentType, null, null, []);
125
122
  return (0, _useModularUIBasic.useModularUIBasic)(key, href, {
126
123
  expectedModels: ["ContentType"],
127
124
  targetModel: _models.ContentTypeModel,
@@ -142,10 +142,7 @@ export const useContentType = (
142
142
  key?: string = "contenttypes",
143
143
  options?: UseModularUIBasicOptions<ContentTypeModel>,
144
144
  ): ?ContentTypeModel => {
145
- const { entryDate } = useEntryDate();
146
-
147
- const href = createHref("contenttypes", contentType, entryDate, null, []);
148
-
145
+ const href = createHref("contenttypes", contentType, null, null, []);
149
146
  return useModularUIBasic(key, href, {
150
147
  expectedModels: ["ContentType"],
151
148
  targetModel: ContentTypeModel,
@@ -1 +1 @@
1
- {"version":3,"file":"useModelCatalog.js","names":["_reactRedux","require","_useRouter","_createHref","_ModelCatalogModel","_interopRequireDefault","_ConceptIndexModel","_ConceptDetailModel","_BusinessScenarioModel","_ContentIndexModel","_ContentTOCModel","_ContentModel","_useModularUIBasic","_models","_modelcatalog","_ModelCatalog","useModelCatalog","options","useModularUIBasic","expectedModels","targetModel","ModelCatalogModel","exports","useConceptIndex","href","key","arguments","length","undefined","entryDate","useEntryDate","url","filterParameters","setParameter","ConceptIndexModel","useConceptDetail","concept","location","useLocation","createHref","useContentIndex","ContentIndexModel","useContentTOC","content","ContentTOCModel","useContent","contentSection","ContentModel","useContentType","contentType","ContentTypeModel","getSearchHref","uri","filters","filterString","_keys","default","filterValue","value","Array","isArray","join","replace","push","useConceptSearch","useContentSearch","dispatch","useDispatch","useSelector","getEntryDate","setEntryDate","updateEntryDate"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { useLocation } from \"./useRouter\";\n\nimport { createHref, filterParameters } from \"../utils/helpers/createHref\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\nimport { getEntryDate } from \"../redux/selectors/modelcatalog\";\nimport { updateEntryDate } from \"../redux/actions/ModelCatalog\";\n\nimport type Href from \"../models/href/Href\";\nimport type { UseModularUIBasicOptions } from \"./useModularUIBasic\";\nimport type { UpdateEntryDateAction } from \"../redux\";\nexport type SearchFilter = {\n index?: string,\n label?: string,\n type?: string | Array<string>,\n modelCategory?: string | Array<string>,\n entryDate?: string,\n};\n\n/**\n */\nexport const useModelCatalog = (\n options?: UseModularUIBasicOptions<ModelCatalogModel>,\n): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n ...options,\n });\n\n/**\n */\nexport const useConceptIndex = (\n href: string | Href,\n key?: string = \"conceptindex\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\n \"index\",\n \"label\",\n \"modelcategory\",\n \"type\",\n ]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string | Href,\n key?: string = \"conceptdetail\",\n options?: UseModularUIBasicOptions<\n ConceptDetailModel | BusinessScenarioModel,\n >,\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, entryDate, location, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentIndex = (\n href: string | Href,\n key?: string = \"contentindex\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentTOC = (\n content: string | Href,\n key?: string = \"contenttoc\",\n options?: UseModularUIBasicOptions<ContentTOCModel>,\n): ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContent = (\n contentSection: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel => {\n const { entryDate } = useEntryDate();\n\n const href = createHref(\"content\", contentSection, entryDate, null, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\"],\n targetModel: ContentModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentType = (\n contentType: string | Href,\n key?: string = \"contenttypes\",\n options?: UseModularUIBasicOptions<ContentTypeModel>,\n): ?ContentTypeModel => {\n const { entryDate } = useEntryDate();\n\n const href = createHref(\"contenttypes\", contentType, entryDate, null, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n ...options,\n });\n};\n\n/**\n */\nconst getSearchHref = (uri: string, filters: SearchFilter): string => {\n const filterString = [];\n\n for (const key of Object.keys(filters)) {\n const filterValue = filters[key];\n if (filterValue) {\n let value: string = Array.isArray(filterValue)\n ? filterValue.join(\",\")\n : filterValue;\n if (key === \"type\") {\n value = value.replace(\"#\", \"%23\"); // handles un-encoded #\n }\n filterString.push(`${key}=${value}`);\n }\n }\n\n return filterString.length ? `${uri}?${filterString.join(\"&\")}` : uri;\n};\n\n/**\n */\nexport const useConceptSearch = (\n filters: SearchFilter,\n key?: string = \"conceptSearch\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const href = getSearchHref(\"/concepts\", filters);\n return useConceptIndex(href, key, options);\n};\n\n/**\n */\nexport const useContentSearch = (\n filters: SearchFilter,\n key?: string = \"contentSearch\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const href = getSearchHref(\"/content\", filters);\n return useContentIndex(href, key, options);\n};\n\n/**\n * Retrieve and update the entrydate for the modelcatalog\n */\nexport const useEntryDate = (): ({\n entryDate: ISO_DATE,\n setEntryDate: (entryDate: ISO_DATE) => UpdateEntryDateAction,\n}) => {\n const dispatch = useD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AAU,EAAEE,OAAO,CAAC;EAC/C,OAAOb,eAAe,CAAChB,IAAI,EAAEC,GAAG,EAAER,OAAO,CAAC;AAC5C,CAAC;;AAED;AACA;AACA;AAFAK,OAAA,CAAA2C,gBAAA,GAAAA,gBAAA;AAGO,MAAMnC,YAAY,GAAGA,CAAA,KAGtB;EACJ,MAAMoC,QAAQ,GAAG,IAAAC,uBAAW,EAAC,CAAC;EAC9B,MAAMtC,SAAS,GAAG,IAAAuC,uBAAW,EAACC,0BAAY,CAAC;EAE3C,OAAO;IACLxC,SAAS;IACTyC,YAAY,EAAGzC,SAAmB,IAAKqC,QAAQ,CAAC,IAAAK,6BAAe,EAAC1C,SAAS,CAAC;EAC5E,CAAC;AACH,CAAC;AAACP,OAAA,CAAAQ,YAAA,GAAAA,YAAA","ignoreList":[]}
1
+ {"version":3,"file":"useModelCatalog.js","names":["_reactRedux","require","_useRouter","_createHref","_ModelCatalogModel","_interopRequireDefault","_ConceptIndexModel","_ConceptDetailModel","_BusinessScenarioModel","_ContentIndexModel","_ContentTOCModel","_ContentModel","_useModularUIBasic","_models","_modelcatalog","_ModelCatalog","useModelCatalog","options","useModularUIBasic","expectedModels","targetModel","ModelCatalogModel","exports","useConceptIndex","href","key","arguments","length","undefined","entryDate","useEntryDate","url","filterParameters","setParameter","ConceptIndexModel","useConceptDetail","concept","location","useLocation","createHref","useContentIndex","ContentIndexModel","useContentTOC","content","ContentTOCModel","useContent","contentSection","ContentModel","useContentType","contentType","ContentTypeModel","getSearchHref","uri","filters","filterString","_keys","default","filterValue","value","Array","isArray","join","replace","push","useConceptSearch","useContentSearch","dispatch","useDispatch","useSelector","getEntryDate","setEntryDate","updateEntryDate"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { useLocation } from \"./useRouter\";\n\nimport { createHref, filterParameters } from \"../utils/helpers/createHref\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\nimport { getEntryDate } from \"../redux/selectors/modelcatalog\";\nimport { updateEntryDate } from \"../redux/actions/ModelCatalog\";\n\nimport type Href from \"../models/href/Href\";\nimport type { UseModularUIBasicOptions } from \"./useModularUIBasic\";\nimport type { UpdateEntryDateAction } from \"../redux\";\nexport type SearchFilter = {\n index?: string,\n label?: string,\n type?: string | Array<string>,\n modelCategory?: string | Array<string>,\n entryDate?: string,\n};\n\n/**\n */\nexport const useModelCatalog = (\n options?: UseModularUIBasicOptions<ModelCatalogModel>,\n): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n ...options,\n });\n\n/**\n */\nexport const useConceptIndex = (\n href: string | Href,\n key?: string = \"conceptindex\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\n \"index\",\n \"label\",\n \"modelcategory\",\n \"type\",\n ]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string | Href,\n key?: string = \"conceptdetail\",\n options?: UseModularUIBasicOptions<\n ConceptDetailModel | BusinessScenarioModel,\n >,\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, entryDate, location, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentIndex = (\n href: string | Href,\n key?: string = \"contentindex\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentTOC = (\n content: string | Href,\n key?: string = \"contenttoc\",\n options?: UseModularUIBasicOptions<ContentTOCModel>,\n): ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContent = (\n contentSection: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel => {\n const { entryDate } = useEntryDate();\n\n const href = createHref(\"content\", contentSection, entryDate, null, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\"],\n targetModel: ContentModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentType = (\n contentType: string | Href,\n key?: string = \"contenttypes\",\n options?: UseModularUIBasicOptions<ContentTypeModel>,\n): ?ContentTypeModel => {\n const href = createHref(\"contenttypes\", contentType, null, null, []);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n ...options,\n });\n};\n\n/**\n */\nconst getSearchHref = (uri: string, filters: SearchFilter): string => {\n const filterString = [];\n\n for (const key of Object.keys(filters)) {\n const filterValue = filters[key];\n if (filterValue) {\n let value: string = Array.isArray(filterValue)\n ? filterValue.join(\",\")\n : filterValue;\n if (key === \"type\") {\n value = value.replace(\"#\", \"%23\"); // handles un-encoded #\n }\n filterString.push(`${key}=${value}`);\n }\n }\n\n return filterString.length ? `${uri}?${filterString.join(\"&\")}` : uri;\n};\n\n/**\n */\nexport const useConceptSearch = (\n filters: SearchFilter,\n key?: string = \"conceptSearch\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const href = getSearchHref(\"/concepts\", filters);\n return useConceptIndex(href, key, options);\n};\n\n/**\n */\nexport const useContentSearch = (\n filters: SearchFilter,\n key?: string = \"contentSearch\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const href = getSearchHref(\"/content\", filters);\n return useContentIndex(href, key, options);\n};\n\n/**\n * Retrieve and update the entrydate for the modelcatalog\n */\nexport const useEntryDate = (): ({\n entryDate: ISO_DATE,\n setEntryDate: (entryDate: ISO_DATE) => UpdateEntryDateAction,\n}) => {\n const dispatch = useDispatch();\n const entryDate = useSelector(getEntryDate);\n\n return {\n entryDate,\n setEntryDate: (entryDate: ISO_DATE) => dispatch(updateEntryDate(entryDate)),\n };\n};\n"],"mappings":";;;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,kBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,mBAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,sBAAA,GAAAH,sBAAA,CAAAJ,OAAA;AACA,IAAAQ,kBAAA,GAAAJ,sBAAA,CAAAJ,OAAA;AACA,IAAAS,gBAAA,GAAAL,sBAAA,CAAAJ,OAAA;AACA,IAAAU,aAAA,GAAAN,sBAAA,CAAAJ,OAAA;AAEA,IAAAW,kBAAA,GAAAX,OAAA;AACA,IAAAY,OAAA,GAAAZ,OAAA;AAEA,IAAAa,aAAA,GAAAb,OAAA;AACA,IAAAc,aAAA,GAAAd,OAAA;AAaA;AACA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AAA;EAErD,MAAMJ,IAAI,GAAG2B,aAAa,CAAC,WAAW,EAAEE,OAAO,CAAC;EAChD,OAAO9B,eAAe,CAACC,IAAI,EAAEC,GAAG,EAAER,OAAO,CAAC;AAC5C,CAAC;;AAED;AACA;AADAK,OAAA,CAAA0C,gBAAA,GAAAA,gBAAA;AAEO,MAAMC,gBAAgB,GAAG,SAAAA,CAC9BZ,OAAqB,EAGE;EAAA,IAFvB5B,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,eAAe;EAAA,IAC9BT,OAAqD,GAAAS,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAErD,MAAMJ,IAAI,GAAG2B,aAAa,CAAC,UAAU,EAAEE,OAAO,CAAC;EAC/C,OAAOb,eAAe,CAAChB,IAAI,EAAEC,GAAG,EAAER,OAAO,CAAC;AAC5C,CAAC;;AAED;AACA;AACA;AAFAK,OAAA,CAAA2C,gBAAA,GAAAA,gBAAA;AAGO,MAAMnC,YAAY,GAAGA,CAAA,KAGtB;EACJ,MAAMoC,QAAQ,GAAG,IAAAC,uBAAW,EAAC,CAAC;EAC9B,MAAMtC,SAAS,GAAG,IAAAuC,uBAAW,EAACC,0BAAY,CAAC;EAE3C,OAAO;IACLxC,SAAS;IACTyC,YAAY,EAAGzC,SAAmB,IAAKqC,QAAQ,CAAC,IAAAK,6BAAe,EAAC1C,SAAS,CAAC;EAC5E,CAAC;AACH,CAAC;AAACP,OAAA,CAAAQ,YAAA,GAAAA,YAAA","ignoreList":[]}
@@ -116,11 +116,7 @@ const loadModel = (key, href, options) => ({
116
116
  origin: options?.origin,
117
117
  contextPath: options?.contextPath
118
118
  });
119
- if (errorResponse.isChangePassword) {
120
- return {
121
- type: "NO_ACTION"
122
- };
123
- } else if (errorResponse.isResourceNotFoundAfterReload) {
119
+ if (errorResponse.isChangePassword || errorResponse.isResourceNotFoundAfterReload) {
124
120
  return removeModelByKey(key);
125
121
  }
126
122
  return updateStatus(key, _Constants.MODULARUI_STATUS.ERROR);
@@ -137,14 +137,12 @@ export const loadModel = (
137
137
  origin: options?.origin,
138
138
  contextPath: options?.contextPath,
139
139
  });
140
- if (errorResponse.isChangePassword) {
141
- return {
142
- type: "NO_ACTION",
143
- };
144
- } else if (errorResponse.isResourceNotFoundAfterReload) {
140
+ if (
141
+ errorResponse.isChangePassword ||
142
+ errorResponse.isResourceNotFoundAfterReload
143
+ ) {
145
144
  return removeModelByKey(key);
146
145
  }
147
-
148
146
  return updateStatus(key, MODULARUI_STATUS.ERROR);
149
147
  },
150
148
  },
@@ -1 +1 @@
1
- {"version":3,"file":"ModularUIActions.js","names":["_Constants","require","_Href","_interopRequireDefault","_ErrorResponse","_ProgressIndicator","_Error","setModel","key","model","connectKey","type","payload","exports","initModels","models","updateModel","updateForm","removeModelByKey","resetModularUI","updateStatus","status","loadModelSuccessAction","updateHandler","loadModel","href","options","origin","contextPath","Href","method","HTTP_METHODS","GET","data","locale","childmodels","targetModel","forceTargetModel","cache","successAction","errorAction","error","errorResponse","ErrorResponse","isChangePassword","isResourceNotFoundAfterReload","MODULARUI_STATUS","ERROR","loadModularUI","dispatch","getState","modularuiStore","modularui","LOADING","_promise","default","resolve","startProgress","loadModelPromise","then","finishProgress","catch","handleError","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 key,\n origin: options?.origin,\n contextPath: options?.contextPath,\n href:\n href instanceof Href\n ? href\n : new Href(href, \"\", {\n origin: options?.origin,\n contextPath: options?.contextPath,\n }),\n method: options?.method ?? HTTP_METHODS.GET,\n 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 origin: options?.origin,\n contextPath: options?.contextPath,\n });\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, getState) => {\n const modularuiStore = getState()?.modularui;\n if (\n modularuiStore &&\n modularuiStore[key]?.status === MODULARUI_STATUS.LOADING\n ) {\n return Promise.resolve();\n }\n\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then(() => dispatch(finishProgress()))\n .catch((error) => dispatch(handleError(error)));\n };\n\n/**\n */\nexport const reloadModel = (\n model: ModularUIModel,\n options?: RequestModularUIOptions,\n): ThunkAction =>\n loadModularUI(model.connectKey, model.selfhref, {\n ...options,\n isReload: true,\n });\n"],"mappings":";;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAmBA;AACA;AACO,MAAMM,QAAQ,GAAGA,CACtBC,GAAW,EACXC,KAAqB,KACF;EACnB;EACAA,KAAK,CAACC,UAAU,GAAGF,GAAG;EACtB,OAAO;IACLG,IAAI,EAAE,eAAe;IACrBC,OAAO,EAAE;MACPJ,GAAG;MACHC;IACF;EACF,CAAC;AACH,CAAC;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ModularUIActions.js","names":["_Constants","require","_Href","_interopRequireDefault","_ErrorResponse","_ProgressIndicator","_Error","setModel","key","model","connectKey","type","payload","exports","initModels","models","updateModel","updateForm","removeModelByKey","resetModularUI","updateStatus","status","loadModelSuccessAction","updateHandler","loadModel","href","options","origin","contextPath","Href","method","HTTP_METHODS","GET","data","locale","childmodels","targetModel","forceTargetModel","cache","successAction","errorAction","error","errorResponse","ErrorResponse","isChangePassword","isResourceNotFoundAfterReload","MODULARUI_STATUS","ERROR","loadModularUI","dispatch","getState","modularuiStore","modularui","LOADING","_promise","default","resolve","startProgress","loadModelPromise","then","finishProgress","catch","handleError","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 key,\n origin: options?.origin,\n contextPath: options?.contextPath,\n href:\n href instanceof Href\n ? href\n : new Href(href, \"\", {\n origin: options?.origin,\n contextPath: options?.contextPath,\n }),\n method: options?.method ?? HTTP_METHODS.GET,\n 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 origin: options?.origin,\n contextPath: options?.contextPath,\n });\n if (\n errorResponse.isChangePassword ||\n errorResponse.isResourceNotFoundAfterReload\n ) {\n return removeModelByKey(key);\n }\n return updateStatus(key, MODULARUI_STATUS.ERROR);\n },\n },\n});\n\n/**\n */\nexport const loadModularUI =\n (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions,\n ): ThunkAction =>\n (dispatch: Dispatch, getState) => {\n const modularuiStore = getState()?.modularui;\n if (\n modularuiStore &&\n modularuiStore[key]?.status === MODULARUI_STATUS.LOADING\n ) {\n return Promise.resolve();\n }\n\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then(() => dispatch(finishProgress()))\n .catch((error) => dispatch(handleError(error)));\n };\n\n/**\n */\nexport const reloadModel = (\n model: ModularUIModel,\n options?: RequestModularUIOptions,\n): ThunkAction =>\n loadModularUI(model.connectKey, model.selfhref, {\n ...options,\n isReload: true,\n });\n"],"mappings":";;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAmBA;AACA;AACO,MAAMM,QAAQ,GAAGA,CACtBC,GAAW,EACXC,KAAqB,KACF;EACnB;EACAA,KAAK,CAACC,UAAU,GAAGF,GAAG;EACtB,OAAO;IACLG,IAAI,EAAE,eAAe;IACrBC,OAAO,EAAE;MACPJ,GAAG;MACHC;IACF;EACF,CAAC;AACH,CAAC;;AAED;AACA;AADAI,OAAA,CAAAN,QAAA,GAAAA,QAAA;AAEO,MAAMO,UAAU,GACrBC,MAAqD,KAChC;EACrBJ,IAAI,EAAE,gBAAgB;EACtBC,OAAO,EAAEG;AACX,CAAC,CAAC;;AAEF;AACA;AADAF,OAAA,CAAAC,UAAA,GAAAA,UAAA;AAEO,MAAME,WAAW,GAAIP,KAAqB,KAAyB;EACxEE,IAAI,EAAE,kBAAkB;EACxBC,OAAO,EAAEH;AACX,CAAC,CAAC;;AAEF;AACA;AADAI,OAAA,CAAAG,WAAA,GAAAA,WAAA;AAEO,MAAMC,UAAU,GAAIR,KAAqB,KAAwB;EACtEE,IAAI,EAAE,uBAAuB;EAC7BC,OAA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EAP,QAAQ,CAAC,IAAAQ,gCAAa,EAAC,CAAC,CAAC;EAEzB,MAAMC,gBAAgB,GAAGT,QAAQ,CAACzB,SAAS,CAAChB,GAAG,EAAEiB,IAAI,EAAEC,OAAO,CAAC,CAAC;EAEhE,OAAO4B,QAAA,CAAAC,OAAA,CAAQC,OAAO,CAACE,gBAAgB,CAAC,CACrCC,IAAI,CAAC,MAAMV,QAAQ,CAAC,IAAAW,iCAAc,EAAC,CAAC,CAAC,CAAC,CACtCC,KAAK,CAAEpB,KAAK,IAAKQ,QAAQ,CAAC,IAAAa,kBAAW,EAACrB,KAAK,CAAC,CAAC,CAAC;AACnD,CAAC;;AAEH;AACA;AADA5B,OAAA,CAAAmC,aAAA,GAAAA,aAAA;AAEO,MAAMe,WAAW,GAAGA,CACzBtD,KAAqB,EACrBiB,OAAiC,KAEjCsB,aAAa,CAACvC,KAAK,CAACC,UAAU,EAAED,KAAK,CAACuD,QAAQ,EAAE;EAC9C,GAAGtC,OAAO;EACVuC,QAAQ,EAAE;AACZ,CAAC,CAAC;AAACpD,OAAA,CAAAkD,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.reloadApplication = void 0;
6
+ exports.reloadApplication = exports.noAction = void 0;
7
7
  var _ModularUIActions = require("../_modularui/ModularUIActions");
8
8
  var _ModularUISelectors = require("../_modularui/ModularUISelectors");
9
9
  var _models = require("../../models");
@@ -27,5 +27,12 @@ const reloadApplication = () => (dispatch, getState) => {
27
27
  targetModel: _models.ApplicationModel
28
28
  }));
29
29
  };
30
+
31
+ /**
32
+ */
30
33
  exports.reloadApplication = reloadApplication;
34
+ const noAction = () => ({
35
+ type: "NO_ACTION"
36
+ });
37
+ exports.noAction = noAction;
31
38
  //# sourceMappingURL=Application.js.map
@@ -10,7 +10,7 @@ import {
10
10
  import { ApplicationModel, Href } from "../../models";
11
11
  import { getLocale } from "../selectors/i18n";
12
12
 
13
- import type { Dispatch, GetState, ThunkAction } from "../types";
13
+ import type { Dispatch, GetState, ThunkAction, NoAction } from "../types";
14
14
 
15
15
  /**
16
16
  */
@@ -37,3 +37,9 @@ export const reloadApplication =
37
37
  }),
38
38
  );
39
39
  };
40
+
41
+ /**
42
+ */
43
+ export const noAction = (): NoAction => ({
44
+ type: "NO_ACTION",
45
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"Application.js","names":["_ModularUIActions","require","_ModularUISelectors","_models","_i18n","reloadApplication","dispatch","getState","state","applicationHref","Href","application","getApplication","contextPath","origin","allKeys","allKeysByHref","key","removeModelByKey","modelKey","getLocale","loadModularUI","targetModel","ApplicationModel","exports"],"sources":["../../../src/redux/actions/Application.js"],"sourcesContent":["// @flow\nimport {\n loadModularUI,\n removeModelByKey,\n} from \"../_modularui/ModularUIActions\";\nimport {\n allKeysByHref,\n getApplication,\n} 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 state = getState();\n\n let applicationHref = new Href(\"/\", \"Application\");\n const application = getApplication(state);\n if (application) {\n applicationHref.contextPath = application.contextPath;\n applicationHref.origin = application.origin;\n }\n\n const allKeys = allKeysByHref(state, applicationHref);\n for (const key of allKeys) {\n dispatch(removeModelByKey(key));\n }\n\n const modelKey = `application(/)(${getLocale(state)})`;\n return dispatch(\n loadModularUI(modelKey, applicationHref, {\n targetModel: ApplicationModel,\n }),\n );\n };\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAIA,IAAAC,mBAAA,GAAAD,OAAA;AAIA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAIA;AACA;AACO,MAAMI,iBAAiB,GAC5BA,CAAA,KAAmB,CAACC,QAAkB,EAAEC,QAAkB,KAAK;EAC7D,MAAMC,KAAK,GAAGD,QAAQ,CAAC,CAAC;EAExB,IAAIE,eAAe,GAAG,IAAIC,YAAI,CAAC,GAAG,EAAE,aAAa,CAAC;EAClD,MAAMC,WAAW,GAAG,IAAAC,kCAAc,EAACJ,KAAK,CAAC;EACzC,IAAIG,WAAW,EAAE;IACfF,eAAe,CAACI,WAAW,GAAGF,WAAW,CAACE,WAAW;IACrDJ,eAAe,CAACK,MAAM,GAAGH,WAAW,CAACG,MAAM;EAC7C;EAEA,MAAMC,OAAO,GAAG,IAAAC,iCAAa,EAACR,KAAK,EAAEC,eAAe,CAAC;EACrD,KAAK,MAAMQ,GAAG,IAAIF,OAAO,EAAE;IACzBT,QAAQ,CAAC,IAAAY,kCAAgB,EAACD,GAAG,CAAC,CAAC;EACjC;EAEA,MAAME,QAAQ,GAAG,kBAAkB,IAAAC,eAAS,EAACZ,KAAK,CAAC,GAAG;EACtD,OAAOF,QAAQ,CACb,IAAAe,+BAAa,EAACF,QAAQ,EAAEV,eAAe,EAAE;IACvCa,WAAW,EAAEC;EACf,CAAC,CACH,CAAC;AACH,CAAC;AAACC,OAAA,CAAAnB,iBAAA,GAAAA,iBAAA","ignoreList":[]}
1
+ {"version":3,"file":"Application.js","names":["_ModularUIActions","require","_ModularUISelectors","_models","_i18n","reloadApplication","dispatch","getState","state","applicationHref","Href","application","getApplication","contextPath","origin","allKeys","allKeysByHref","key","removeModelByKey","modelKey","getLocale","loadModularUI","targetModel","ApplicationModel","exports","noAction","type"],"sources":["../../../src/redux/actions/Application.js"],"sourcesContent":["// @flow\nimport {\n loadModularUI,\n removeModelByKey,\n} from \"../_modularui/ModularUIActions\";\nimport {\n allKeysByHref,\n getApplication,\n} from \"../_modularui/ModularUISelectors\";\nimport { ApplicationModel, Href } from \"../../models\";\nimport { getLocale } from \"../selectors/i18n\";\n\nimport type { Dispatch, GetState, ThunkAction, NoAction } from \"../types\";\n\n/**\n */\nexport const reloadApplication =\n (): ThunkAction => (dispatch: Dispatch, getState: GetState) => {\n const state = getState();\n\n let applicationHref = new Href(\"/\", \"Application\");\n const application = getApplication(state);\n if (application) {\n applicationHref.contextPath = application.contextPath;\n applicationHref.origin = application.origin;\n }\n\n const allKeys = allKeysByHref(state, applicationHref);\n for (const key of allKeys) {\n dispatch(removeModelByKey(key));\n }\n\n const modelKey = `application(/)(${getLocale(state)})`;\n return dispatch(\n loadModularUI(modelKey, applicationHref, {\n targetModel: ApplicationModel,\n }),\n );\n };\n\n/**\n */\nexport const noAction = (): NoAction => ({\n type: \"NO_ACTION\",\n});\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAIA,IAAAC,mBAAA,GAAAD,OAAA;AAIA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAIA;AACA;AACO,MAAMI,iBAAiB,GAC5BA,CAAA,KAAmB,CAACC,QAAkB,EAAEC,QAAkB,KAAK;EAC7D,MAAMC,KAAK,GAAGD,QAAQ,CAAC,CAAC;EAExB,IAAIE,eAAe,GAAG,IAAIC,YAAI,CAAC,GAAG,EAAE,aAAa,CAAC;EAClD,MAAMC,WAAW,GAAG,IAAAC,kCAAc,EAACJ,KAAK,CAAC;EACzC,IAAIG,WAAW,EAAE;IACfF,eAAe,CAACI,WAAW,GAAGF,WAAW,CAACE,WAAW;IACrDJ,eAAe,CAACK,MAAM,GAAGH,WAAW,CAACG,MAAM;EAC7C;EAEA,MAAMC,OAAO,GAAG,IAAAC,iCAAa,EAACR,KAAK,EAAEC,eAAe,CAAC;EACrD,KAAK,MAAMQ,GAAG,IAAIF,OAAO,EAAE;IACzBT,QAAQ,CAAC,IAAAY,kCAAgB,EAACD,GAAG,CAAC,CAAC;EACjC;EAEA,MAAME,QAAQ,GAAG,kBAAkB,IAAAC,eAAS,EAACZ,KAAK,CAAC,GAAG;EACtD,OAAOF,QAAQ,CACb,IAAAe,+BAAa,EAACF,QAAQ,EAAEV,eAAe,EAAE;IACvCa,WAAW,EAAEC;EACf,CAAC,CACH,CAAC;AACH,CAAC;;AAEH;AACA;AADAC,OAAA,CAAAnB,iBAAA,GAAAA,iBAAA;AAEO,MAAMoB,QAAQ,GAAGA,CAAA,MAAiB;EACvCC,IAAI,EAAE;AACR,CAAC,CAAC;AAACF,OAAA,CAAAC,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -12,8 +12,8 @@ var _Cache = _interopRequireDefault(require("../../utils/browser/Cache"));
12
12
  var _ModularUIActions = require("../_modularui/ModularUIActions");
13
13
  var _ModularUISelectors = require("../_modularui/ModularUISelectors");
14
14
  var _Application = require("./Application");
15
- var _constants = require("../../constants");
16
15
  var _SignIn = require("./SignIn");
16
+ var _constants = require("../../constants");
17
17
  /**
18
18
  */
19
19
  const handleUnauthorized = errorResponse => (dispatch, getState) => {
@@ -49,9 +49,7 @@ const handleUnauthorized = errorResponse => (dispatch, getState) => {
49
49
  modal: false
50
50
  }));
51
51
  }
52
- return {
53
- type: "NO_ACTION"
54
- };
52
+ return dispatch((0, _Application.noAction)());
55
53
  };
56
54
  exports.handleUnauthorized = handleUnauthorized;
57
55
  //# sourceMappingURL=Authorization.js.map
@@ -8,12 +8,12 @@ import Cache from "../../utils/browser/Cache";
8
8
 
9
9
  import { removeModelByKey } from "../_modularui/ModularUIActions";
10
10
  import { getApplication } from "../_modularui/ModularUISelectors";
11
- import { reloadApplication } from "./Application";
11
+ import { noAction, reloadApplication } from "./Application";
12
+ import { sendAuthenticationError } from "./SignIn";
12
13
 
13
14
  import { getSetting } from "../../constants";
14
15
 
15
16
  import type { ThunkAction } from "../types";
16
- import { sendAuthenticationError } from "./SignIn";
17
17
 
18
18
  /**
19
19
  */
@@ -61,5 +61,5 @@ export const handleUnauthorized =
61
61
  );
62
62
  }
63
63
 
64
- return { type: "NO_ACTION" };
64
+ return dispatch(noAction());
65
65
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Authorization.js","names":["_ErrorResponse","_interopRequireDefault","require","_RouterActions","_SignOut","_Cache","_ModularUIActions","_ModularUISelectors","_Application","_constants","_SignIn","handleUnauthorized","errorResponse","dispatch","getState","connectKey","removeModelByKey","getSetting","response","error","window","location","reload","application","getApplication","Cache","getItem","isLoggedIn","reloadApplication","logoutSuccess","removeItem","isInvalidUsername","sendAuthenticationError","message","router","LOGIN_PATH","pathname","locationFrom","state","from","replace","modal","type","exports"],"sources":["../../../src/redux/actions/Authorization.js"],"sourcesContent":["// @flow\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\n\nimport { replace } from \"../_router/RouterActions\";\nimport { logoutSuccess } from \"./SignOut\";\n\nimport Cache from \"../../utils/browser/Cache\";\n\nimport { removeModelByKey } from \"../_modularui/ModularUIActions\";\nimport { getApplication } from \"../_modularui/ModularUISelectors\";\nimport { reloadApplication } from \"./Application\";\n\nimport { getSetting } from \"../../constants\";\n\nimport type { ThunkAction } from \"../types\";\nimport { sendAuthenticationError } from \"./SignIn\";\n\n/**\n */\nexport const handleUnauthorized =\n (errorResponse: ErrorResponse): ThunkAction =>\n (dispatch, getState) => {\n if (errorResponse.connectKey) {\n dispatch(removeModelByKey(errorResponse.connectKey));\n }\n\n if (\n getSetting(\"PAGE_RELOAD_ON_UNAUTHORIZED_ERROR\", false) &&\n errorResponse.response?.error\n ) {\n window.location.reload();\n return;\n }\n\n // reload application when flag auth is set or isLogged\n const application = getApplication(getState());\n if (Cache.getItem(\"auth\") || application?.isLoggedIn) {\n dispatch(reloadApplication());\n }\n\n // set logged out\n dispatch(logoutSuccess());\n\n Cache.removeItem(\"auth\");\n\n if (errorResponse.isInvalidUsername) {\n dispatch(sendAuthenticationError(errorResponse.message));\n }\n\n // add current location as from location before redirect\n const location = getState().router.location;\n const LOGIN_PATH = getSetting(\"LOGIN_PATH\", \"/signin\");\n if (location?.pathname !== LOGIN_PATH) {\n const locationFrom = location?.state?.from;\n return dispatch(\n replace(LOGIN_PATH, {\n from: locationFrom ? locationFrom : getState().router.location,\n // cannot open login in a modal, because of previ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A,MAAMZ,QAAQ,GAAGP,QAAQ,CAAC,CAAC,CAACoB,MAAM,CAACb,QAAQ;EAC3C,MAAMc,UAAU,GAAG,IAAAlB,qBAAU,EAAC,YAAY,EAAE,SAAS,CAAC;EACtD,IAAII,QAAQ,EAAEe,QAAQ,KAAKD,UAAU,EAAE;IACrC,MAAME,YAAY,GAAGhB,QAAQ,EAAEiB,KAAK,EAAEC,IAAI;IAC1C,OAAO1B,QAAQ,CACb,IAAA2B,sBAAO,EAACL,UAAU,EAAE;MAClBI,IAAI,EAAEF,YAAY,GAAGA,YAAY,GAAGvB,QAAQ,CAAC,CAAC,CAACoB,MAAM,CAACb,QAAQ;MAC9D;MACAoB,KAAK,EAAE;IACT,CAAC,CACH,CAAC;EACH;EAEA,OAAO;IAAEC,IAAI,EAAE;EAAY,CAAC;AAC9B,CAAC;AAACC,OAAA,CAAAhC,kBAAA,GAAAA,kBAAA","ignoreList":[]}
1
+ {"version":3,"file":"Authorization.js","names":["_ErrorResponse","_interopRequireDefault","require","_RouterActions","_SignOut","_Cache","_ModularUIActions","_ModularUISelectors","_Application","_SignIn","_constants","handleUnauthorized","errorResponse","dispatch","getState","connectKey","removeModelByKey","getSetting","response","error","window","location","reload","application","getApplication","Cache","getItem","isLoggedIn","reloadApplication","logoutSuccess","removeItem","isInvalidUsername","sendAuthenticationError","message","router","LOGIN_PATH","pathname","locationFrom","state","from","replace","modal","noAction","exports"],"sources":["../../../src/redux/actions/Authorization.js"],"sourcesContent":["// @flow\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\n\nimport { replace } from \"../_router/RouterActions\";\nimport { logoutSuccess } from \"./SignOut\";\n\nimport Cache from \"../../utils/browser/Cache\";\n\nimport { removeModelByKey } from \"../_modularui/ModularUIActions\";\nimport { getApplication } from \"../_modularui/ModularUISelectors\";\nimport { noAction, reloadApplication } from \"./Application\";\nimport { sendAuthenticationError } from \"./SignIn\";\n\nimport { getSetting } from \"../../constants\";\n\nimport type { ThunkAction } from \"../types\";\n\n/**\n */\nexport const handleUnauthorized =\n (errorResponse: ErrorResponse): ThunkAction =>\n (dispatch, getState) => {\n if (errorResponse.connectKey) {\n dispatch(removeModelByKey(errorResponse.connectKey));\n }\n\n if (\n getSetting(\"PAGE_RELOAD_ON_UNAUTHORIZED_ERROR\", false) &&\n errorResponse.response?.error\n ) {\n window.location.reload();\n return;\n }\n\n // reload application when flag auth is set or isLogged\n const application = getApplication(getState());\n if (Cache.getItem(\"auth\") || application?.isLoggedIn) {\n dispatch(reloadApplication());\n }\n\n // set logged out\n dispatch(logoutSuccess());\n\n Cache.removeItem(\"auth\");\n\n if (errorResponse.isInvalidUsername) {\n dispatch(sendAuthenticationError(errorResponse.message));\n }\n\n // add current location as from location before redirect\n const location = getState().router.location;\n const LOGIN_PATH = getSetting(\"LOGIN_PATH\", \"/signin\");\n if (location?.pathname !== LOGIN_PATH) {\n const locationFrom = location?.state?.from;\n return dispatch(\n replace(LOGIN_PATH, {\n from: locationFrom ? locationFrom : getState().router.location,\n // cannot open login in a modal, because of previous locations that might be secure\n modal: false,\n }),\n );\n }\n\n return dispatch(noAction());\n };\n"],"mappings":";;;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,mBAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAEA,IAAAQ,UAAA,GAAAR,OAAA;AAIA;AACA;AACO,MAAMS,kBAAkB,GAC5BC,aAA4B,IAC7B,CAACC,QAAQ,EAAEC,QAAQ,KAAK;EACtB,IAAIF,aAAa,CAACG,UAAU,EAAE;IAC5BF,QAAQ,CAAC,IAAAG,kCAAgB,EAACJ,aAAa,CAACG,UAAU,CAAC,CAAC;EAC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,6 +13,7 @@ var _Notification = require("./Notification");
13
13
  var _ProgressIndicator = require("./ProgressIndicator");
14
14
  var _SignIn = require("./SignIn");
15
15
  var _Authorization = require("./Authorization");
16
+ var _Application = require("./Application");
16
17
  /**
17
18
  */
18
19
  const saveError = error => ({
@@ -24,9 +25,7 @@ const saveError = error => ({
24
25
  */
25
26
  const defaultErrorResponseHandler = error => dispatch => {
26
27
  if (error.isResourceNotFoundAfterReload || error.isRemoteServiceException) {
27
- return dispatch({
28
- type: "NO_ACTION"
29
- });
28
+ return dispatch((0, _Application.noAction)());
30
29
  }
31
30
  if (error.isUnauthorized) {
32
31
  return dispatch((0, _Authorization.handleUnauthorized)(error));
@@ -9,6 +9,7 @@ import { showXHRErrorNotification } from "./Notification";
9
9
  import { resetProgress } from "./ProgressIndicator";
10
10
  import { changePassword } from "./SignIn";
11
11
  import { handleUnauthorized } from "./Authorization";
12
+ import { noAction } from "./Application";
12
13
 
13
14
  import type { FetchException } from "../../exceptions";
14
15
  import type { Dispatch, SaveErrorAction, ThunkAction } from "../types";
@@ -32,7 +33,7 @@ const defaultErrorResponseHandler: DefaultErrorResponseHandler =
32
33
  (error: ErrorResponse): ThunkAction =>
33
34
  (dispatch: Dispatch) => {
34
35
  if (error.isResourceNotFoundAfterReload || error.isRemoteServiceException) {
35
- return dispatch({ type: "NO_ACTION" });
36
+ return dispatch(noAction());
36
37
  }
37
38
 
38
39
  if (error.isUnauthorized) {
@@ -1 +1 @@
1
- {"version":3,"file":"Error.js","names":["_Constants","require","_Settings","_ErrorResponse","_interopRequireDefault","_RouterActions","_Notification","_ProgressIndicator","_SignIn","_Authorization","saveError","error","type","payload","defaultErrorResponseHandler","dispatch","isResourceNotFoundAfterReload","isRemoteServiceException","isUnauthorized","handleUnauthorized","isBlocked","isConcurrentUser","isInvalidUsername","LOGOUT_PATH","getSetting","push","isChangePassword","changePassword","IS_SERVER","setTimeout","showXHRErrorNotification","customErrorResponseHandler","errorResponse","defaultHandler","setCustomErrorResponseHandler","handler","exports","handleError","resetProgress","ErrorResponse"],"sources":["../../../src/redux/actions/Error.js"],"sourcesContent":["// @flow\nimport { IS_SERVER } from \"../../constants/Constants\";\nimport { getSetting } from \"../../constants/Settings\";\n\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\n\nimport { push } from \"../_router/RouterActions\";\nimport { showXHRErrorNotification } from \"./Notification\";\nimport { resetProgress } from \"./ProgressIndicator\";\nimport { changePassword } from \"./SignIn\";\nimport { handleUnauthorized } from \"./Authorization\";\n\nimport type { FetchException } from \"../../exceptions\";\nimport type { Dispatch, SaveErrorAction, ThunkAction } from \"../types\";\n\ntype DefaultErrorResponseHandler = (error: ErrorResponse) => ThunkAction;\ntype CustomErrorResponseHandler = (\n errorResponse: ErrorResponse,\n defaultHandler: DefaultErrorResponseHandler,\n) => ThunkAction;\n\n/**\n */\nconst saveError = (error: ErrorResponse): SaveErrorAction => ({\n type: \"SAVE_ERROR\",\n payload: error,\n});\n\n/**\n */\nconst defaultErrorResponseHandler: DefaultErrorResponseHandler =\n (error: ErrorResponse): ThunkAction =>\n (dispatch: Dispatch) => {\n if (error.isResourceNotFoundAfterReload || error.isRemoteServiceException) {\n return dispatch({ type: \"NO_ACTION\" });\n }\n\n if (error.isUnauthorized) {\n return dispatch(handleUnauthorized(error));\n }\n\n if (error.isBlocked || error.isConcurrentUser || error.isInvalidUsername) {\n const LOGOUT_PATH = getSetting(\"LOGOUT_PATH\", \"/signout\");\n dispatch(push(LOGOUT_PATH));\n }\n\n if (error.isChangePassword) {\n return dispatch(changePassword());\n }\n\n if (IS_SERVER) {\n return dispatch(saveError(error));\n }\n\n setTimeout(() => {\n throw error.error;\n });\n\n return dispatch(showXHRErrorNotification(error));\n };\n\n/**\n * Standard Custom error response, acts as a proxy and can be overwritten by {@link setCustomErrorResponseHandler}\n */\nlet customErrorResponseHandler: CustomErrorResponseHandler =\n (errorResponse, defaultHandler) => (dispatch: Dispatch) =>\n dispatch(defaultHandler(errorResponse));\n\n/**\n * Set a custom error response handler,\n * can be used when custom functionality is needed on certain (error) response\n * of the modular ui, for example when custom logic is needed when a user is unauthorized<br>\n * It receives an {@link ErrorResponse} and the {@link defaultErrorResponseHandler}\n */\nexport const setCustomErrorResponseHandler = (\n handler: CustomErrorResponseHandler,\n) => {\n customErrorResponseHandler = handler;\n};\n\n/**\n * Handle errors by sending an error notification message\n */\nexport const handleError =\n (error: Error | FetchException): ThunkAction =>\n (dispatch: Dispatch) => {\n dispatch(resetProgress());\n\n const errorResponse = new ErrorResponse(error);\n\n return dispatch(\n customErrorResponseHandler(errorResponse, defaultErrorResponseHandler),\n );\n };\n"],"mappings":";;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,cAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AAWA;AACA;AACA,MAAMS,SAAS,GAAIC,KAAoB,KAAuB;EAC5DC,IAAI,EAAE,YAAY;EAClBC,OAAO,EAAEF;AACX,CAAC,CAAC;;AAEF;AACA;AACA,MAAMG,2BAAwD,GAC3DH,KAAoB,IACpBI,QAAkB,IAAK;EACtB,IAAIJ,KAAK,CAACK,6BAA6B,IAAIL,KAAK,CAACM,wBAAwB,EAAE;IACzE,OAAOF,QAAQ,CAAC;MAAEH,IAAI,EAAE;IAAY,CAAC,CAAC;EACxC;EAEA,IAAID,KAAK,CAACO,cAAc,EAAE;IACxB,OAAOH,QAAQ,CAAC,IAAAI,iCAAkB,EAACR,KAAK,CAAC,CAAC;EAC5C;EAEA,IAAIA,KAAK,CAACS,SAAS,IAAIT,KAAK,CAACU,gBAAgB,IAAIV,KAAK,CAACW,iBAAiB,EAAE;IACxE,MAAMC,WAAW,GAAG,IAAAC,oBAAU,EAAC,aAAa,EAAE,UAAU,CAAC;IACzDT,QAAQ,CAAC,IAAAU,mBAAI,EAACF,WAAW,CAAC,CAAC;EAC7B;EAEA,IAAIZ,KAAK,CAACe,gBAAgB,EAAE;IAC1B,OAAOX,QAAQ,CAAC,IAAAY,sBAAc,EAAC,CAAC,CAAC;EACnC;EAEA,IAAIC,oBAAS,EAAE;IACb,OAAOb,QAAQ,CAACL,SAAS,CAACC,KAAK,CAAC,CAAC;EACnC;EAEAkB,UAAU,CAAC,MAAM;IACf,MAAMlB,KAAK,CAACA,KAAK;EACnB,CAAC,CAAC;EAEF,OAAOI,QAAQ,CAAC,IAAAe,sCAAwB,EAACnB,KAAK,CAAC,CAAC;AAClD,CAAC;;AAEH;AACA;AACA;AACA,IAAIoB,0BAAsD,GACxDA,CAACC,aAAa,EAAEC,cAAc,KAAMlB,QAAkB,IACpDA,QAAQ,CAACkB,cAAc,CAACD,aAAa,CAAC,CAAC;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,6BAA6B,GACxCC,OAAmC,IAChC;EACHJ,0BAA0B,GAAGI,OAAO;AACtC,CAAC;;AAED;AACA;AACA;AAFAC,OAAA,CAAAF,6BAAA,GAAAA,6BAAA;AAGO,MAAMG,WAAW,GACrB1B,KAA6B,IAC7BI,QAAkB,IAAK;EACtBA,QAAQ,CAAC,IAAAuB,gCAAa,EAAC,CAAC,CAAC;EAEzB,MAAMN,aAAa,GAAG,IAAIO,sBAAa,CAAC5B,KAAK,CAAC;EAE9C,OAAOI,QAAQ,CACbgB,0BAA0B,CAACC,aAAa,EAAElB,2BAA2B,CACvE,CAAC;AACH,CAAC;AAACsB,OAAA,CAAAC,WAAA,GAAAA,WAAA","ignoreList":[]}
1
+ {"version":3,"file":"Error.js","names":["_Constants","require","_Settings","_ErrorResponse","_interopRequireDefault","_RouterActions","_Notification","_ProgressIndicator","_SignIn","_Authorization","_Application","saveError","error","type","payload","defaultErrorResponseHandler","dispatch","isResourceNotFoundAfterReload","isRemoteServiceException","noAction","isUnauthorized","handleUnauthorized","isBlocked","isConcurrentUser","isInvalidUsername","LOGOUT_PATH","getSetting","push","isChangePassword","changePassword","IS_SERVER","setTimeout","showXHRErrorNotification","customErrorResponseHandler","errorResponse","defaultHandler","setCustomErrorResponseHandler","handler","exports","handleError","resetProgress","ErrorResponse"],"sources":["../../../src/redux/actions/Error.js"],"sourcesContent":["// @flow\nimport { IS_SERVER } from \"../../constants/Constants\";\nimport { getSetting } from \"../../constants/Settings\";\n\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\n\nimport { push } from \"../_router/RouterActions\";\nimport { showXHRErrorNotification } from \"./Notification\";\nimport { resetProgress } from \"./ProgressIndicator\";\nimport { changePassword } from \"./SignIn\";\nimport { handleUnauthorized } from \"./Authorization\";\nimport { noAction } from \"./Application\";\n\nimport type { FetchException } from \"../../exceptions\";\nimport type { Dispatch, SaveErrorAction, ThunkAction } from \"../types\";\n\ntype DefaultErrorResponseHandler = (error: ErrorResponse) => ThunkAction;\ntype CustomErrorResponseHandler = (\n errorResponse: ErrorResponse,\n defaultHandler: DefaultErrorResponseHandler,\n) => ThunkAction;\n\n/**\n */\nconst saveError = (error: ErrorResponse): SaveErrorAction => ({\n type: \"SAVE_ERROR\",\n payload: error,\n});\n\n/**\n */\nconst defaultErrorResponseHandler: DefaultErrorResponseHandler =\n (error: ErrorResponse): ThunkAction =>\n (dispatch: Dispatch) => {\n if (error.isResourceNotFoundAfterReload || error.isRemoteServiceException) {\n return dispatch(noAction());\n }\n\n if (error.isUnauthorized) {\n return dispatch(handleUnauthorized(error));\n }\n\n if (error.isBlocked || error.isConcurrentUser || error.isInvalidUsername) {\n const LOGOUT_PATH = getSetting(\"LOGOUT_PATH\", \"/signout\");\n dispatch(push(LOGOUT_PATH));\n }\n\n if (error.isChangePassword) {\n return dispatch(changePassword());\n }\n\n if (IS_SERVER) {\n return dispatch(saveError(error));\n }\n\n setTimeout(() => {\n throw error.error;\n });\n\n return dispatch(showXHRErrorNotification(error));\n };\n\n/**\n * Standard Custom error response, acts as a proxy and can be overwritten by {@link setCustomErrorResponseHandler}\n */\nlet customErrorResponseHandler: CustomErrorResponseHandler =\n (errorResponse, defaultHandler) => (dispatch: Dispatch) =>\n dispatch(defaultHandler(errorResponse));\n\n/**\n * Set a custom error response handler,\n * can be used when custom functionality is needed on certain (error) response\n * of the modular ui, for example when custom logic is needed when a user is unauthorized<br>\n * It receives an {@link ErrorResponse} and the {@link defaultErrorResponseHandler}\n */\nexport const setCustomErrorResponseHandler = (\n handler: CustomErrorResponseHandler,\n) => {\n customErrorResponseHandler = handler;\n};\n\n/**\n * Handle errors by sending an error notification message\n */\nexport const handleError =\n (error: Error | FetchException): ThunkAction =>\n (dispatch: Dispatch) => {\n dispatch(resetProgress());\n\n const errorResponse = new ErrorResponse(error);\n\n return dispatch(\n customErrorResponseHandler(errorResponse, defaultErrorResponseHandler),\n );\n };\n"],"mappings":";;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,cAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AAWA;AACA;AACA,MAAMU,SAAS,GAAIC,KAAoB,KAAuB;EAC5DC,IAAI,EAAE,YAAY;EAClBC,OAAO,EAAEF;AACX,CAAC,CAAC;;AAEF;AACA;AACA,MAAMG,2BAAwD,GAC3DH,KAAoB,IACpBI,QAAkB,IAAK;EACtB,IAAIJ,KAAK,CAACK,6BAA6B,IAAIL,KAAK,CAACM,wBAAwB,EAAE;IACzE,OAAOF,QAAQ,CAAC,IAAAG,qBAAQ,EAAC,CAAC,CAAC;EAC7B;EAEA,IAAIP,KAAK,CAACQ,c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AAC;AAACuB,OAAA,CAAAC,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -77,7 +77,7 @@ export const filterParameters = (
77
77
  export const createHref = (
78
78
  context: string,
79
79
  dynamicPart: string | Href,
80
- entryDate?: ISO_DATE,
80
+ entryDate?: ?ISO_DATE,
81
81
  location?: ?Location,
82
82
  allowedParameters?: Array<string>,
83
83
  ): Href => {
@@ -1 +1 @@
1
- {"version":3,"file":"createHref.js","names":["_Href","_interopRequireDefault","require","parseUrl","href","Href","path","querystring","hash","_includes","default","call","hashSplit","split","qsSplit","exports","filterParameters","allowedParameters","Array","isArray","url","filteredUrl","searchParams","_urlSearchParams","params","_from","_keys","param","delete","toString","resourcetype","origin","contextPath","createHref","context","dynamicPart","entryDate","location","_startsWith","replace","search","_context","substring","finalHref","setParameter","removeParameter"],"sources":["../../../src/utils/helpers/createHref.js"],"sourcesContent":["// @flow\nimport Href from \"../../models/href/Href\";\n\nimport type { Location } from \"react-router\";\n\n/**\n */\nexport const parseUrl = (\n href: string | Href,\n): { path: string, querystring: null | string, hash: null | string } => {\n if (href instanceof Href) {\n return {\n path: href.path,\n querystring: href.querystring,\n hash: href.hash,\n };\n }\n\n let path = href;\n let hash = null;\n let querystring = null;\n if (href.includes(\"#\")) {\n const hashSplit = href.split(\"#\");\n path = hashSplit[0];\n hash = hashSplit[1];\n }\n if (href.includes(\"?\")) {\n const qsSplit = path.split(\"?\");\n path = qsSplit[0];\n querystring = qsSplit[1];\n }\n return {\n path,\n querystring,\n hash,\n };\n};\n\n/**\n */\nexport const filterParameters = (\n href: string | Href,\n allowedParameters?: Array<string>,\n): Href => {\n if (!Array.isArray(allowedParameters)) {\n return new Href(href);\n }\n\n const url = parseUrl(href);\n let filteredUrl = url.path;\n if (url.querystring) {\n const searchParams = new URLSearchParams(url.querystring);\n const params = Array.from(searchParams.keys());\n for (const param of params) {\n if (!allowedParameters.includes(param)) {\n searchParams.delete(param);\n }\n }\n filteredUrl = filteredUrl + \"?\" + searchParams.toString();\n }\n if (url.hash) {\n filteredUrl = filteredUrl + \"#\" + url.hash;\n }\n\n if (href instanceof Href) {\n return new Href(filteredUrl, href.resourcetype, {\n origin: href.origin,\n contextPath: href.contextPath,\n });\n }\n\n return new Href(filteredUrl);\n};\n\n/**\n */\nexport const createHref = (\n context: string,\n dynamicPart: string | Href,\n entryDate?: ISO_DATE,\n location?: ?Location,\n allowedParameters?: Array<string>,\n): Href => {\n let href = dynamicPart.toString();\n\n if (!href.startsWith(`/${context}/`)) {\n href = `/${context}/${href}`;\n }\n\n href = href.replace(/\\/\\//g, \"/\");\n\n if (location?.search && !href.includes(\"?\")) {\n const search = location.search.startsWith(\"?\")\n ? location.search.substring(1)\n : location.search;\n href = `${href}?${search}`;\n }\n\n const finalHref =\n dynamicPart instanceof Href\n ? filterParameters(\n new Href(href, dynamicPart.resourcetype, {\n origin: dynamicPart.origin,\n contextPath: dynamicPart.contextPath,\n }),\n allowedParameters,\n )\n : filterParameters(href, allowedParameters);\n\n if (entryDate) {\n finalHref.setParameter(\"entryDate\", entryDate);\n } else {\n finalHref.removeParameter(\"entryDate\");\n }\n\n return finalHref;\n};\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA;AACA;AACO,MAAMC,QAAQ,GACnBC,IAAmB,IACmD;EACtE,IAAIA,IAAI,YAAYC,aAAI,EAAE;IACxB,OAAO;MACLC,IAAI,EAAEF,IAAI,CAACE,IAAI;MACfC,WAAW,EAAEH,IAAI,CAACG,WAAW;MAC7BC,IAAI,EAAEJ,IAAI,CAACI;IACb,CAAC;EACH;EAEA,IAAIF,IAAI,GAAGF,IAAI;EACf,IAAII,IAAI,GAAG,IAAI;EACf,IAAID,WAAW,GAAG,IAAI;EACtB,IAAI,IAAAE,SAAA,CAAAC,OAAA,EAAAN,IAAI,EAAAO,IAAA,CAAJP,IAAI,EAAU,GAAG,CAAC,EAAE;IACtB,MAAMQ,SAAS,GAAGR,IAAI,CAACS,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AAA,CAAA8B,QAAA,EAAY,GAAG,CAAC,GAC1CJ,QAAQ,CAACG,MAAM,CAACE,SAAS,CAAC,CAAC,CAAC,GAC5BL,QAAQ,CAACG,MAAM;IACnBpC,IAAI,GAAG,GAAGA,IAAI,IAAIoC,MAAM,EAAE;EAC5B;EAEA,MAAMG,SAAS,GACbR,WAAW,YAAY9B,aAAI,GACvBW,gBAAgB,CACd,IAAIX,aAAI,CAACD,IAAI,EAAE+B,WAAW,CAACL,YAAY,EAAE;IACvCC,MAAM,EAAEI,WAAW,CAACJ,MAAM;IAC1BC,WAAW,EAAEG,WAAW,CAACH;EAC3B,CAAC,CAAC,EACFf,iBACF,CAAC,GACDD,gBAAgB,CAACZ,IAAI,EAAEa,iBAAiB,CAAC;EAE/C,IAAImB,SAAS,EAAE;IACbO,SAAS,CAACC,YAAY,CAAC,WAAW,EAAER,SAAS,CAAC;EAChD,CAAC,MAAM;IACLO,SAAS,CAACE,eAAe,CAAC,WAAW,CAAC;EACxC;EAEA,OAAOF,SAAS;AAClB,CAAC;AAAC5B,OAAA,CAAAkB,UAAA,GAAAA,UAAA","ignoreList":[]}
1
+ {"version":3,"file":"createHref.js","names":["_Href","_interopRequireDefault","require","parseUrl","href","Href","path","querystring","hash","_includes","default","call","hashSplit","split","qsSplit","exports","filterParameters","allowedParameters","Array","isArray","url","filteredUrl","searchParams","_urlSearchParams","params","_from","_keys","param","delete","toString","resourcetype","origin","contextPath","createHref","context","dynamicPart","entryDate","location","_startsWith","replace","search","_context","substring","finalHref","setParameter","removeParameter"],"sources":["../../../src/utils/helpers/createHref.js"],"sourcesContent":["// @flow\nimport Href from \"../../models/href/Href\";\n\nimport type { Location } from \"react-router\";\n\n/**\n */\nexport const parseUrl = (\n href: string | Href,\n): { path: string, querystring: null | string, hash: null | string } => {\n if (href instanceof Href) {\n return {\n path: href.path,\n querystring: href.querystring,\n hash: href.hash,\n };\n }\n\n let path = href;\n let hash = null;\n let querystring = null;\n if (href.includes(\"#\")) {\n const hashSplit = href.split(\"#\");\n path = hashSplit[0];\n hash = hashSplit[1];\n }\n if (href.includes(\"?\")) {\n const qsSplit = path.split(\"?\");\n path = qsSplit[0];\n querystring = qsSplit[1];\n }\n return {\n path,\n querystring,\n hash,\n };\n};\n\n/**\n */\nexport const filterParameters = (\n href: string | Href,\n allowedParameters?: Array<string>,\n): Href => {\n if (!Array.isArray(allowedParameters)) {\n return new Href(href);\n }\n\n const url = parseUrl(href);\n let filteredUrl = url.path;\n if (url.querystring) {\n const searchParams = new URLSearchParams(url.querystring);\n const params = Array.from(searchParams.keys());\n for (const param of params) {\n if (!allowedParameters.includes(param)) {\n searchParams.delete(param);\n }\n }\n filteredUrl = filteredUrl + \"?\" + searchParams.toString();\n }\n if (url.hash) {\n filteredUrl = filteredUrl + \"#\" + url.hash;\n }\n\n if (href instanceof Href) {\n return new Href(filteredUrl, href.resourcetype, {\n origin: href.origin,\n contextPath: href.contextPath,\n });\n }\n\n return new Href(filteredUrl);\n};\n\n/**\n */\nexport const createHref = (\n context: string,\n dynamicPart: string | Href,\n entryDate?: ?ISO_DATE,\n location?: ?Location,\n allowedParameters?: Array<string>,\n): Href => {\n let href = dynamicPart.toString();\n\n if (!href.startsWith(`/${context}/`)) {\n href = `/${context}/${href}`;\n }\n\n href = href.replace(/\\/\\//g, \"/\");\n\n if (location?.search && !href.includes(\"?\")) {\n const search = location.search.startsWith(\"?\")\n ? location.search.substring(1)\n : location.search;\n href = `${href}?${search}`;\n }\n\n const finalHref =\n dynamicPart instanceof Href\n ? filterParameters(\n new Href(href, dynamicPart.resourcetype, {\n origin: dynamicPart.origin,\n contextPath: dynamicPart.contextPath,\n }),\n allowedParameters,\n )\n : filterParameters(href, allowedParameters);\n\n if (entryDate) {\n finalHref.setParameter(\"entryDate\", entryDate);\n } else {\n finalHref.removeParameter(\"entryDate\");\n }\n\n return finalHref;\n};\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA;A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
3
+ "version": "1.59.11",
4
4
  "description": "Toolbox for be informed javascript layouts",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "bugs": "http://support.beinformed.com",
@@ -110,7 +110,7 @@
110
110
  "@babel/preset-env": "^7.26.0",
111
111
  "@babel/preset-flow": "^7.25.9",
112
112
  "@babel/preset-react": "^7.26.3",
113
- "@commitlint/cli": "^19.6.0",
113
+ "@commitlint/cli": "^19.6.1",
114
114
  "@commitlint/config-conventional": "^19.6.0",
115
115
  "@testing-library/react": "^16.1.0",
116
116
  "auditjs": "^4.0.46",
@@ -126,7 +126,7 @@
126
126
  "eslint-plugin-ft-flow": "^3.0.11",
127
127
  "eslint-plugin-import": "^2.31.0",
128
128
  "eslint-plugin-jest": "^28.9.0",
129
- "eslint-plugin-jsdoc": "^50.6.0",
129
+ "eslint-plugin-jsdoc": "^50.6.1",
130
130
  "eslint-plugin-react": "^7.37.2",
131
131
  "eslint-plugin-react-hooks": "^5.1.0",
132
132
  "eslint-plugin-you-dont-need-lodash-underscore": "^6.14.0",
@@ -141,7 +141,7 @@
141
141
  "jest-junit": "^16.0.0",
142
142
  "jest-sonar-reporter": "^2.0.0",
143
143
  "jscodeshift": "^17.1.1",
144
- "lint-staged": "^15.2.10",
144
+ "lint-staged": "^15.2.11",
145
145
  "polished": "^4.0.0",
146
146
  "prettier": "^3.4.2",
147
147
  "react": "^18.3.1",
@@ -156,7 +156,7 @@ describe("modelcatalog hooks", () => {
156
156
  assertTargetModel(
157
157
  () => useContentType("/contenttypes/contenttype"),
158
158
  "contenttypes",
159
- "/contenttypes/contenttype?entryDate=" + DateUtil.now(),
159
+ "/contenttypes/contenttype",
160
160
  ContentTypeModel,
161
161
  );
162
162
  });
@@ -142,10 +142,7 @@ export const useContentType = (
142
142
  key?: string = "contenttypes",
143
143
  options?: UseModularUIBasicOptions<ContentTypeModel>,
144
144
  ): ?ContentTypeModel => {
145
- const { entryDate } = useEntryDate();
146
-
147
- const href = createHref("contenttypes", contentType, entryDate, null, []);
148
-
145
+ const href = createHref("contenttypes", contentType, null, null, []);
149
146
  return useModularUIBasic(key, href, {
150
147
  expectedModels: ["ContentType"],
151
148
  targetModel: ContentTypeModel,
@@ -137,14 +137,12 @@ export const loadModel = (
137
137
  origin: options?.origin,
138
138
  contextPath: options?.contextPath,
139
139
  });
140
- if (errorResponse.isChangePassword) {
141
- return {
142
- type: "NO_ACTION",
143
- };
144
- } else if (errorResponse.isResourceNotFoundAfterReload) {
140
+ if (
141
+ errorResponse.isChangePassword ||
142
+ errorResponse.isResourceNotFoundAfterReload
143
+ ) {
145
144
  return removeModelByKey(key);
146
145
  }
147
-
148
146
  return updateStatus(key, MODULARUI_STATUS.ERROR);
149
147
  },
150
148
  },
@@ -10,7 +10,7 @@ import {
10
10
  import { ApplicationModel, Href } from "../../models";
11
11
  import { getLocale } from "../selectors/i18n";
12
12
 
13
- import type { Dispatch, GetState, ThunkAction } from "../types";
13
+ import type { Dispatch, GetState, ThunkAction, NoAction } from "../types";
14
14
 
15
15
  /**
16
16
  */
@@ -37,3 +37,9 @@ export const reloadApplication =
37
37
  }),
38
38
  );
39
39
  };
40
+
41
+ /**
42
+ */
43
+ export const noAction = (): NoAction => ({
44
+ type: "NO_ACTION",
45
+ });
@@ -8,12 +8,12 @@ import Cache from "../../utils/browser/Cache";
8
8
 
9
9
  import { removeModelByKey } from "../_modularui/ModularUIActions";
10
10
  import { getApplication } from "../_modularui/ModularUISelectors";
11
- import { reloadApplication } from "./Application";
11
+ import { noAction, reloadApplication } from "./Application";
12
+ import { sendAuthenticationError } from "./SignIn";
12
13
 
13
14
  import { getSetting } from "../../constants";
14
15
 
15
16
  import type { ThunkAction } from "../types";
16
- import { sendAuthenticationError } from "./SignIn";
17
17
 
18
18
  /**
19
19
  */
@@ -61,5 +61,5 @@ export const handleUnauthorized =
61
61
  );
62
62
  }
63
63
 
64
- return { type: "NO_ACTION" };
64
+ return dispatch(noAction());
65
65
  };
@@ -9,6 +9,7 @@ import { showXHRErrorNotification } from "./Notification";
9
9
  import { resetProgress } from "./ProgressIndicator";
10
10
  import { changePassword } from "./SignIn";
11
11
  import { handleUnauthorized } from "./Authorization";
12
+ import { noAction } from "./Application";
12
13
 
13
14
  import type { FetchException } from "../../exceptions";
14
15
  import type { Dispatch, SaveErrorAction, ThunkAction } from "../types";
@@ -32,7 +33,7 @@ const defaultErrorResponseHandler: DefaultErrorResponseHandler =
32
33
  (error: ErrorResponse): ThunkAction =>
33
34
  (dispatch: Dispatch) => {
34
35
  if (error.isResourceNotFoundAfterReload || error.isRemoteServiceException) {
35
- return dispatch({ type: "NO_ACTION" });
36
+ return dispatch(noAction());
36
37
  }
37
38
 
38
39
  if (error.isUnauthorized) {
@@ -77,7 +77,7 @@ export const filterParameters = (
77
77
  export const createHref = (
78
78
  context: string,
79
79
  dynamicPart: string | Href,
80
- entryDate?: ISO_DATE,
80
+ entryDate?: ?ISO_DATE,
81
81
  location?: ?Location,
82
82
  allowedParameters?: Array<string>,
83
83
  ): Href => {