@beinformed/ui 1.58.2 → 1.58.3
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.
- package/CHANGELOG.md +7 -0
- package/esm/hooks/useModelCatalog.js +1 -1
- package/esm/hooks/useModelCatalog.js.map +1 -1
- package/esm/react-client/client.js +15 -0
- package/esm/react-client/client.js.map +1 -1
- package/esm/redux/actions/{EntryDate.js → ModelCatalog.js} +1 -1
- package/esm/redux/actions/ModelCatalog.js.map +1 -0
- package/esm/redux/actions/index.js +1 -1
- package/esm/redux/actions/index.js.map +1 -1
- package/esm/redux/reducers/ModelCatalogReducer.js +1 -2
- package/esm/redux/reducers/ModelCatalogReducer.js.map +1 -1
- package/lib/hooks/useModelCatalog.js +2 -2
- package/lib/hooks/useModelCatalog.js.flow +1 -1
- package/lib/hooks/useModelCatalog.js.map +1 -1
- package/lib/react-client/client.js +17 -1
- package/lib/react-client/client.js.flow +17 -1
- package/lib/react-client/client.js.map +1 -1
- package/lib/redux/actions/{EntryDate.js → ModelCatalog.js} +1 -1
- package/lib/redux/actions/ModelCatalog.js.map +1 -0
- package/lib/redux/actions/index.js +4 -4
- package/lib/redux/actions/index.js.flow +1 -1
- package/lib/redux/actions/index.js.map +1 -1
- package/lib/redux/reducers/ModelCatalogReducer.js +1 -2
- package/lib/redux/reducers/ModelCatalogReducer.js.flow +1 -6
- package/lib/redux/reducers/ModelCatalogReducer.js.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useModelCatalog.js +1 -1
- package/src/react-client/client.js +17 -1
- package/src/redux/actions/index.js +1 -1
- package/src/redux/reducers/ModelCatalogReducer.js +1 -6
- package/esm/redux/actions/EntryDate.js.map +0 -1
- package/lib/redux/actions/EntryDate.js.map +0 -1
- /package/lib/redux/actions/{EntryDate.js.flow → ModelCatalog.js.flow} +0 -0
- /package/src/redux/actions/{EntryDate.js → ModelCatalog.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
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.58.3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.58.2...v1.58.3) (2024-11-20)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **modelcatalog:** set initial entry date from querystring or cache if available ([ec162c3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/ec162c351368e3df947ae8b86d15dd6415c35f8d))
|
|
11
|
+
|
|
5
12
|
## [1.58.2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.58.1...v1.58.2) (2024-11-20)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -12,7 +12,7 @@ import ContentModel from "../models/content/ContentModel";
|
|
|
12
12
|
import { useModularUIBasic } from "./useModularUIBasic";
|
|
13
13
|
import { ContentTypeModel } from "../models";
|
|
14
14
|
import { getEntryDate } from "../redux/selectors/modelcatalog";
|
|
15
|
-
import { updateEntryDate } from "../redux/actions/
|
|
15
|
+
import { updateEntryDate } from "../redux/actions/ModelCatalog";
|
|
16
16
|
/**
|
|
17
17
|
*/
|
|
18
18
|
export const useModelCatalog = options => useModularUIBasic("modelcatalog", "/modelcatalog", {
|
|
@@ -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/EntryDate\";\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 return {\n entryDate,\n setEntryDate: (entryDate: ISO_DATE) => dispatch(updateEntryDate(entryDate)),\n };\n};\n"],"mappings":";AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,aAAa;AACtD,SAASC,WAAW,QAAQ,aAAa;AAEzC,SAASC,UAAU,EAAEC,gBAAgB,QAAQ,6BAA6B;AAE1E,OAAOC,iBAAiB,MAAM,0CAA0C;AACxE,OAAOC,iBAAiB,MAAM,sCAAsC;AACpE,OAAOC,kBAAkB,MAAM,uCAAuC;AACtE,SAASC,OAAO,IAAIC,qBAAqB,QAAQ,0CAA0C;AAC3F,OAAOC,iBAAiB,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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 { 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 return {\n entryDate,\n setEntryDate: (entryDate: ISO_DATE) => dispatch(updateEntryDate(entryDate)),\n };\n};\n"],"mappings":";AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,aAAa;AACtD,SAASC,WAAW,QAAQ,aAAa;AAEzC,SAASC,UAAU,EAAEC,gBAAgB,QAAQ,6BAA6B;AAE1E,OAAOC,iBAAiB,MAAM,0CAA0C;AACxE,OAAOC,iBAAiB,MAAM,sCAAsC;AACpE,OAAOC,kBAAkB,MAAM,uCAAuC;AACtE,SAASC,OAAO,IAAIC,qBAAqB,QAAQ,0CAA0C;AAC3F,OAAOC,iBAAiB,MAAM,qCAAqC;AACnE,OAAOC,eAAe,MAAM,mCAAmC;AAC/D,OAAOC,YAAY,MAAM,gCAAgC;AAEzD,SAASC,iBAAi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AO,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":[]}
|
|
@@ -14,6 +14,7 @@ import { setAllContentInDataSetting, setLoginPreferences } from "../redux/action
|
|
|
14
14
|
import { showXHRErrorNotification } from "../redux/actions/Notification";
|
|
15
15
|
import { handleError } from "../redux/actions/Error";
|
|
16
16
|
import { loginSuccess } from "../redux/actions/SignIn";
|
|
17
|
+
import { updateEntryDate } from "../redux/actions/ModelCatalog";
|
|
17
18
|
import { locationChange, replace } from "../redux/_router/RouterActions";
|
|
18
19
|
import { JsonParseException, FetchException } from "../exceptions";
|
|
19
20
|
import { Init } from "./Init";
|
|
@@ -79,6 +80,19 @@ const handleRedirectURI = store => {
|
|
|
79
80
|
}
|
|
80
81
|
};
|
|
81
82
|
|
|
83
|
+
/**
|
|
84
|
+
*/
|
|
85
|
+
export const setModelCatalogEntryDate = store => {
|
|
86
|
+
if (typeof window !== "undefined") {
|
|
87
|
+
const entryDateFromUrl = new _URLSearchParams(window.location?.search).get("entryDate");
|
|
88
|
+
if (entryDateFromUrl) {
|
|
89
|
+
store.dispatch(updateEntryDate(entryDateFromUrl));
|
|
90
|
+
} else if (Cache.hasItem("ModelCatalogEntryDate")) {
|
|
91
|
+
store.dispatch(Cache.getItem("ModelCatalogEntryDate"));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
82
96
|
/**
|
|
83
97
|
*/
|
|
84
98
|
export const setupClient = function () {
|
|
@@ -101,6 +115,7 @@ export const setupClient = function () {
|
|
|
101
115
|
store
|
|
102
116
|
} = configureStore(browserHistory, customReducers, rehydrate(data));
|
|
103
117
|
handleRedirectURI(store);
|
|
118
|
+
setModelCatalogEntryDate(store);
|
|
104
119
|
setAllContentInDataSetting(store.getState());
|
|
105
120
|
setLoginPreferences(store.getState());
|
|
106
121
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["hydrate","render","has","setImmediate","Cache","xhr","createBrowserHistory","configureStore","rehydrate","getBasePathModularUI","getBasePathServer","getSetting","setAllContentInDataSetting","setLoginPreferences","showXHRErrorNotification","handleError","loginSuccess","locationChange","replace","JsonParseException","FetchException","Init","handleBeforeRenderHooks","jsx","_jsx","parseDataToJSON","data","JSON","parse","error","getDataFromServer","_context","dataElement","document","querySelector","Error","_trimInstanceProperty","textContent","call","setUnhandledRejectionEvent","store","window","onunhandledrejection","event","detail","errorMessage","reason","message","toString","dispatch","handleRedirectURI","urlParams","_URLSearchParams","location","search","redirectURI","get","url","catch","e","id","LOGIN_PATH","from","pathname","modal","setupClient","customReducers","arguments","length","undefined","beforeRenderHooks","contextPath","clear","browserHistory","basename","routerHistory","getState","loadOtherBrowserTabs","getItem","response","listen","action","body","className","addContentLoadedEvent","theme","ErrorFallbackComponent","mount","addEventListener","applicationNode","children","mountClient","element","isSSR","client","_ref"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\n// eslint-disable-next-line react/no-deprecated\nimport { hydrate, render } from \"react-dom\";\n\nimport { has } from \"../utils/helpers/objects\";\nimport setImmediate from \"setimmediate\";\n\nimport Cache from \"../utils/browser/Cache\";\n\nimport xhr from \"../utils/fetch/xhr\";\n\nimport { createBrowserHistory } from \"history\";\nimport configureStore from \"../redux/store/configureStore\";\n\nimport rehydrate from \"./rehydrate\";\nimport {\n getBasePathModularUI,\n getBasePathServer,\n getSetting,\n} from \"../constants/Settings\";\n\nimport {\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\nimport { showXHRErrorNotification } from \"../redux/actions/Notification\";\n\nimport { handleError } from \"../redux/actions/Error\";\nimport { loginSuccess } from \"../redux/actions/SignIn\";\n\nimport { locationChange, replace } from \"../redux/_router/RouterActions\";\n\nimport { JsonParseException, FetchException } from \"../exceptions\";\n\nimport { Init } from \"./Init\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport type {\n ComponentType,\n Element as ReactElement,\n ElementType,\n} from \"react\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { CustomReducers, ReduxStore } from \"../redux/types\";\nimport type { RouterHistory } from \"react-router\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\n\ntype RenderFunction = () => ReactElement<ElementType>;\ntype MountFunction = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => void;\ntype Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n mount: MountFunction,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\nconst parseDataToJSON = (data: string) => {\n try {\n return JSON.parse(data);\n } catch (error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n\nconst getDataFromServer = () => {\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]',\n );\n\n if (!dataElement) {\n throw new Error(\"Error loading state, json not found\");\n } else if (dataElement.textContent.trim() === \"\") {\n return {};\n }\n\n return parseDataToJSON(dataElement.textContent);\n};\n\n/**\n */\nexport const setUnhandledRejectionEvent = (store: ReduxStore) => {\n window.onunhandledrejection = (event) => {\n if (event.detail) {\n return setImmediate(() => {\n const errorMessage = event.detail.reason.message.toString();\n\n store.dispatch(showXHRErrorNotification(errorMessage));\n throw event.detail.reason;\n });\n }\n\n return event;\n };\n};\n\n/**\n * The redirectURI querystring parameter is available when the server is redirecting an unauthorized deep link\n * @param store\n */\nconst handleRedirectURI = (store: ReduxStore) => {\n const urlParams = new URLSearchParams(window.location.search);\n const redirectURI = urlParams.get(\"redirectURI\");\n if (redirectURI) {\n xhr({ url: `${getBasePathModularUI()}${redirectURI}` }).catch((e) => {\n if (\n e.id === \"UnauthorizedException\" ||\n e.id === \"Error.NotAuthorized\" ||\n e.id === \"Error.Authentication.Required\" ||\n e.id === \"Error.Authentication.InvalidCredentials\"\n ) {\n const LOGIN_PATH = getSetting(\"LOGIN_PATH\", \"/signin\");\n store.dispatch(\n replace(LOGIN_PATH, {\n from: { pathname: redirectURI },\n modal: false,\n }),\n );\n }\n });\n }\n};\n\n/**\n */\nexport const setupClient = (\n customReducers: CustomReducers = {},\n beforeRenderHooks: ?Array<BeforeRenderHook>,\n): { store: ReduxStore, routerHistory: RouterHistory } => {\n if (typeof window.contextPath === \"undefined\") {\n throw new Error(\"Missing contextPath on window object\");\n }\n\n const data = getDataFromServer();\n\n // remove all resources from cache\n Cache.clear(\"^res:\");\n\n // $FlowExpectedError\n const browserHistory: RouterHistory = createBrowserHistory({\n basename: getBasePathServer(),\n });\n const { routerHistory, store } = configureStore(\n browserHistory,\n customReducers,\n rehydrate(data),\n );\n\n handleRedirectURI(store);\n\n setAllContentInDataSetting(store.getState());\n setLoginPreferences(store.getState());\n\n // load existing cache from other browser tabs\n Cache.loadOtherBrowserTabs(() => {\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n });\n\n if (has(data, \"error.name\")) {\n const error = new FetchException(data?.error?.response);\n store.dispatch(handleError(error));\n }\n\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n\n // listen to history change and update the redux router store\n routerHistory.listen((location, action) => {\n store.dispatch(locationChange(location, action));\n });\n\n setUnhandledRejectionEvent(store);\n\n if (document.body) {\n document.body.className = \"js\";\n }\n\n if (beforeRenderHooks) {\n handleBeforeRenderHooks(beforeRenderHooks, { store });\n }\n\n return { store, routerHistory };\n};\n\n/**\n */\nexport const addContentLoadedEvent = (\n store: ReduxStore,\n routerHistory: RouterHistory,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n mount: MountFunction,\n) => {\n window.addEventListener(\"DOMContentLoaded\", () => {\n const applicationNode = document.querySelector(\"#application\");\n if (!applicationNode) {\n throw new Error(\n \"No DOM element with id application found to attach client to\",\n );\n }\n\n mount(\n applicationNode,\n <Init\n store={store}\n routerHistory={routerHistory}\n contextPath={window.contextPath}\n theme={theme}\n ErrorFallbackComponent={ErrorFallbackComponent}\n >\n {render()}\n </Init>,\n );\n });\n};\n\n/**\n */\nconst mountClient = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => {\n const isSSR = applicationNode.querySelector(\".application\");\n if (isSSR) {\n hydrate(element, applicationNode);\n } else {\n render(element, applicationNode);\n }\n};\n\n/**\n * Mount the webapplication to the DOM, setup redux store and caches, add unhandledRejectionEvent, used client side when JavaScript is enabled.\n */\nexport const client = ({\n customReducers,\n theme,\n render,\n beforeRenderHooks,\n ErrorFallbackComponent,\n mount,\n}: Props) => {\n const { store, routerHistory } = setupClient(\n customReducers,\n beforeRenderHooks,\n );\n\n addContentLoadedEvent(\n store,\n routerHistory,\n theme,\n render,\n ErrorFallbackComponent,\n mount ?? mountClient,\n );\n};\n"],"mappings":";;AACA;AACA,SAASA,OAAO,EAAEC,MAAM,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sBAAsB,EAAEA,sBAAuB;MAAAI,QAAA,EAE9CzF,MAAM,CAAC;IAAC,CACL,CACR,CAAC;EACH,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA,MAAM0F,WAAW,GAAGA,CAClBF,eAAwB,EACxBG,OAAkC,KAC/B;EACH,MAAMC,KAAK,GAAGJ,eAAe,CAACvD,aAAa,CAAC,cAAc,CAAC;EAC3D,IAAI2D,KAAK,EAAE;IACT7F,OAAO,CAAC4F,OAAO,EAAEH,eAAe,CAAC;EACnC,CAAC,MAAM;IACLxF,MAAM,CAAC2F,OAAO,EAAEH,eAAe,CAAC;EAClC;AACF,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMK,MAAM,GAAGC,IAAA,IAOT;EAAA,IAPU;IACrB7B,cAAc;IACdmB,KAAK;IACLpF,MAAM;IACNqE,iBAAiB;IACjBgB,sBAAsB;IACtBC;EACK,CAAC,GAAAQ,IAAA;EACN,MAAM;IAAEvD,KAAK;IAAEmC;EAAc,CAAC,GAAGV,WAAW,CAC1CC,cAAc,EACdI,iBACF,CAAC;EAEDc,qBAAqB,CACnB5C,KAAK,EACLmC,aAAa,EACbU,KAAK,EACLpF,MAAM,EACNqF,sBAAsB,EACtBC,KAAK,IAAII,WACX,CAAC;AACH,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"client.js","names":["hydrate","render","has","setImmediate","Cache","xhr","createBrowserHistory","configureStore","rehydrate","getBasePathModularUI","getBasePathServer","getSetting","setAllContentInDataSetting","setLoginPreferences","showXHRErrorNotification","handleError","loginSuccess","updateEntryDate","locationChange","replace","JsonParseException","FetchException","Init","handleBeforeRenderHooks","jsx","_jsx","parseDataToJSON","data","JSON","parse","error","getDataFromServer","_context","dataElement","document","querySelector","Error","_trimInstanceProperty","textContent","call","setUnhandledRejectionEvent","store","window","onunhandledrejection","event","detail","errorMessage","reason","message","toString","dispatch","handleRedirectURI","urlParams","_URLSearchParams","location","search","redirectURI","get","url","catch","e","id","LOGIN_PATH","from","pathname","modal","setModelCatalogEntryDate","entryDateFromUrl","hasItem","getItem","setupClient","customReducers","arguments","length","undefined","beforeRenderHooks","contextPath","clear","browserHistory","basename","routerHistory","getState","loadOtherBrowserTabs","response","listen","action","body","className","addContentLoadedEvent","theme","ErrorFallbackComponent","mount","addEventListener","applicationNode","children","mountClient","element","isSSR","client","_ref"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\n// eslint-disable-next-line react/no-deprecated\nimport { hydrate, render } from \"react-dom\";\n\nimport { has } from \"../utils/helpers/objects\";\nimport setImmediate from \"setimmediate\";\n\nimport Cache from \"../utils/browser/Cache\";\n\nimport xhr from \"../utils/fetch/xhr\";\n\nimport { createBrowserHistory } from \"history\";\nimport configureStore from \"../redux/store/configureStore\";\n\nimport rehydrate from \"./rehydrate\";\nimport {\n getBasePathModularUI,\n getBasePathServer,\n getSetting,\n} from \"../constants/Settings\";\n\nimport {\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\nimport { showXHRErrorNotification } from \"../redux/actions/Notification\";\nimport { handleError } from \"../redux/actions/Error\";\nimport { loginSuccess } from \"../redux/actions/SignIn\";\nimport { updateEntryDate } from \"../redux/actions/ModelCatalog\";\n\nimport { locationChange, replace } from \"../redux/_router/RouterActions\";\n\nimport { JsonParseException, FetchException } from \"../exceptions\";\n\nimport { Init } from \"./Init\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport type {\n ComponentType,\n Element as ReactElement,\n ElementType,\n} from \"react\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { CustomReducers, ReduxStore } from \"../redux/types\";\nimport type { RouterHistory } from \"react-router\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\n\ntype RenderFunction = () => ReactElement<ElementType>;\ntype MountFunction = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => void;\ntype Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n mount: MountFunction,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\nconst parseDataToJSON = (data: string) => {\n try {\n return JSON.parse(data);\n } catch (error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n\nconst getDataFromServer = () => {\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]',\n );\n\n if (!dataElement) {\n throw new Error(\"Error loading state, json not found\");\n } else if (dataElement.textContent.trim() === \"\") {\n return {};\n }\n\n return parseDataToJSON(dataElement.textContent);\n};\n\n/**\n */\nexport const setUnhandledRejectionEvent = (store: ReduxStore) => {\n window.onunhandledrejection = (event) => {\n if (event.detail) {\n return setImmediate(() => {\n const errorMessage = event.detail.reason.message.toString();\n\n store.dispatch(showXHRErrorNotification(errorMessage));\n throw event.detail.reason;\n });\n }\n\n return event;\n };\n};\n\n/**\n * The redirectURI querystring parameter is available when the server is redirecting an unauthorized deep link\n * @param store\n */\nconst handleRedirectURI = (store: ReduxStore) => {\n const urlParams = new URLSearchParams(window.location.search);\n const redirectURI = urlParams.get(\"redirectURI\");\n if (redirectURI) {\n xhr({ url: `${getBasePathModularUI()}${redirectURI}` }).catch((e) => {\n if (\n e.id === \"UnauthorizedException\" ||\n e.id === \"Error.NotAuthorized\" ||\n e.id === \"Error.Authentication.Required\" ||\n e.id === \"Error.Authentication.InvalidCredentials\"\n ) {\n const LOGIN_PATH = getSetting(\"LOGIN_PATH\", \"/signin\");\n store.dispatch(\n replace(LOGIN_PATH, {\n from: { pathname: redirectURI },\n modal: false,\n }),\n );\n }\n });\n }\n};\n\n/**\n */\nexport const setModelCatalogEntryDate = (store: ReduxStore) => {\n if (typeof window !== \"undefined\") {\n const entryDateFromUrl = new URLSearchParams(window.location?.search).get(\n \"entryDate\",\n );\n if (entryDateFromUrl) {\n store.dispatch(updateEntryDate(entryDateFromUrl));\n } else if (Cache.hasItem(\"ModelCatalogEntryDate\")) {\n store.dispatch(Cache.getItem(\"ModelCatalogEntryDate\"));\n }\n }\n};\n\n/**\n */\nexport const setupClient = (\n customReducers: CustomReducers = {},\n beforeRenderHooks: ?Array<BeforeRenderHook>,\n): { store: ReduxStore, routerHistory: RouterHistory } => {\n if (typeof window.contextPath === \"undefined\") {\n throw new Error(\"Missing contextPath on window object\");\n }\n\n const data = getDataFromServer();\n\n // remove all resources from cache\n Cache.clear(\"^res:\");\n\n // $FlowExpectedError\n const browserHistory: RouterHistory = createBrowserHistory({\n basename: getBasePathServer(),\n });\n const { routerHistory, store } = configureStore(\n browserHistory,\n customReducers,\n rehydrate(data),\n );\n\n handleRedirectURI(store);\n setModelCatalogEntryDate(store);\n\n setAllContentInDataSetting(store.getState());\n setLoginPreferences(store.getState());\n\n // load existing cache from other browser tabs\n Cache.loadOtherBrowserTabs(() => {\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n });\n\n if (has(data, \"error.name\")) {\n const error = new FetchException(data?.error?.response);\n store.dispatch(handleError(error));\n }\n\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n\n // listen to history change and update the redux router store\n routerHistory.listen((location, action) => {\n store.dispatch(locationChange(location, action));\n });\n\n setUnhandledRejectionEvent(store);\n\n if (document.body) {\n document.body.className = \"js\";\n }\n\n if (beforeRenderHooks) {\n handleBeforeRenderHooks(beforeRenderHooks, { store });\n }\n\n return { store, routerHistory };\n};\n\n/**\n */\nexport const addContentLoadedEvent = (\n store: ReduxStore,\n routerHistory: RouterHistory,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n mount: MountFunction,\n) => {\n window.addEventListener(\"DOMContentLoaded\", () => {\n const applicationNode = document.querySelector(\"#application\");\n if (!applicationNode) {\n throw new Error(\n \"No DOM element with id application found to attach client to\",\n );\n }\n\n mount(\n applicationNode,\n <Init\n store={store}\n routerHistory={routerHistory}\n contextPath={window.contextPath}\n theme={theme}\n ErrorFallbackComponent={ErrorFallbackComponent}\n >\n {render()}\n </Init>,\n );\n });\n};\n\n/**\n */\nconst mountClient = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => {\n const isSSR = applicationNode.querySelector(\".application\");\n if (isSSR) {\n hydrate(element, applicationNode);\n } else {\n render(element, applicationNode);\n }\n};\n\n/**\n * Mount the webapplication to the DOM, setup redux store and caches, add unhandledRejectionEvent, used client side when JavaScript is enabled.\n */\nexport const client = ({\n customReducers,\n theme,\n render,\n beforeRenderHooks,\n ErrorFallbackComponent,\n mount,\n}: Props) => {\n const { store, routerHistory } = setupClient(\n customReducers,\n beforeRenderHooks,\n );\n\n addContentLoadedEvent(\n store,\n routerHistory,\n theme,\n render,\n ErrorFallbackComponent,\n mount ?? mountClient,\n );\n};\n"],"mappings":";;AACA;AACA,SAASA,OAAO,EAAEC,MAAM,QAAQ,WAAW;AAE3C,SAASC,GAAG,QAAQ,0BAA0B;AAC9C,OAAOC,YAAY,MAAM,cAAc;AAEvC,OAAOC,KAAK,MAAM,wBAAwB;AAE1C,OAAOC,GAAG,MAAM,oBAAoB;AAEpC,SAASC,oBAAoB,QAAQ,SAAS;AAC9C,OAAOC,cAAc,MAAM,+BAA+B;AAE1D,OAAOC,SAAS,MAAM,aAAa;AACnC,SACEC,oBAAoB,EACpBC,iBAAiB,EACjBC,UAAU,QACL,uBAAuB;AAE9B,SACEC,0BAA0B,EAC1BC,mBAAmB,QACd,8BAA8B;AACrC,SAASC,wBAAwB,QAAQ,+BAA+B;AACxE,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,YAAY,QAAQ,yBAAyB;AACtD,SAASC,eAAe,QAAQ,+BAA+B;AAE/D,SAASC,cAAc,EAAEC,OAAO,QAAQ,gCAAgC;AAExE,SAASC,kBAAkB,EAAEC,cAAc,QAAQ,eAAe;AAElE,SAASC,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CAAC;IAAC,CACL,CACR,CAAC;EACH,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA,MAAM8F,WAAW,GAAGA,CAClBF,eAAwB,EACxBG,OAAkC,KAC/B;EACH,MAAMC,KAAK,GAAGJ,eAAe,CAAC1D,aAAa,CAAC,cAAc,CAAC;EAC3D,IAAI8D,KAAK,EAAE;IACTjG,OAAO,CAACgG,OAAO,EAAEH,eAAe,CAAC;EACnC,CAAC,MAAM;IACL5F,MAAM,CAAC+F,OAAO,EAAEH,eAAe,CAAC;EAClC;AACF,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMK,MAAM,GAAGC,IAAA,IAOT;EAAA,IAPU;IACrB5B,cAAc;IACdkB,KAAK;IACLxF,MAAM;IACN0E,iBAAiB;IACjBe,sBAAsB;IACtBC;EACK,CAAC,GAAAQ,IAAA;EACN,MAAM;IAAE1D,KAAK;IAAEuC;EAAc,CAAC,GAAGV,WAAW,CAC1CC,cAAc,EACdI,iBACF,CAAC;EAEDa,qBAAqB,CACnB/C,KAAK,EACLuC,aAAa,EACbS,KAAK,EACLxF,MAAM,EACNyF,sBAAsB,EACtBC,KAAK,IAAII,WACX,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelCatalog.js","names":["updateEntryDate","entryDate","type","payload"],"sources":["../../../src/redux/actions/ModelCatalog.js"],"sourcesContent":["// @flow\nimport type { UpdateEntryDateAction } from \"../types\";\n\n/**\n * Update the entry date being used in the modelcatalog\n */\nexport const updateEntryDate = (\n entryDate: ISO_DATE,\n): UpdateEntryDateAction => ({\n type: \"UPDATE_ENTRYDATE\",\n payload: entryDate,\n});\n"],"mappings":"AAGA;AACA;AACA;AACA,OAAO,MAAMA,eAAe,GAC1BC,SAAmB,KACQ;EAC3BC,IAAI,EAAE,kBAAkB;EACxBC,OAAO,EAAEF;AACX,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/redux/actions/index.js"],"sourcesContent":["// @flow\nexport * from \"./Application\";\nexport * from \"./Authorization\";\nexport * from \"./
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/redux/actions/index.js"],"sourcesContent":["// @flow\nexport * from \"./Application\";\nexport * from \"./Authorization\";\nexport * from \"./ModelCatalog\";\nexport * from \"./Error\";\nexport * from \"./Form\";\nexport * from \"./FormAttributeSet\";\nexport * from \"./FormAttributeSetRepeatable\";\nexport * from \"./FormAutosave\";\nexport * from \"./FormAutosubmit\";\nexport * from \"./FormValidations\";\nexport * from \"./Modals\";\nexport * from \"./Notification\";\nexport * from \"./Preferences\";\nexport * from \"./ProgressIndicator\";\nexport * from \"./SignIn\";\nexport * from \"./SignOut\";\n"],"mappings":"AACA,cAAc,eAAe;AAC7B,cAAc,iBAAiB;AAC/B,cAAc,gBAAgB;AAC9B,cAAc,SAAS;AACvB,cAAc,QAAQ;AACtB,cAAc,oBAAoB;AAClC,cAAc,8BAA8B;AAC5C,cAAc,gBAAgB;AAC9B,cAAc,kBAAkB;AAChC,cAAc,mBAAmB;AACjC,cAAc,UAAU;AACxB,cAAc,gBAAgB;AAC9B,cAAc,eAAe;AAC7B,cAAc,qBAAqB;AACnC,cAAc,UAAU;AACxB,cAAc,WAAW","ignoreList":[]}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import _URLSearchParams from "@babel/runtime-corejs3/core-js-stable/url-search-params";
|
|
2
1
|
import { DateUtil } from "../../utils";
|
|
3
2
|
import Cache from "../../utils/browser/Cache";
|
|
4
3
|
const initialState = {
|
|
5
|
-
entryDate:
|
|
4
|
+
entryDate: DateUtil.now()
|
|
6
5
|
};
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelCatalogReducer.js","names":["DateUtil","Cache","initialState","entryDate","
|
|
1
|
+
{"version":3,"file":"ModelCatalogReducer.js","names":["DateUtil","Cache","initialState","entryDate","now","ModelCatalogReducer","state","arguments","length","undefined","action","type","addItem","payload"],"sources":["../../../src/redux/reducers/ModelCatalogReducer.js"],"sourcesContent":["// @flow\nimport { DateUtil } from \"../../utils\";\nimport Cache from \"../../utils/browser/Cache\";\n\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction, ModelCatalogState } from \"../types\";\n\nconst initialState: ModelCatalogState = {\n entryDate: DateUtil.now(),\n};\n\n/**\n * Keep track of the entry date for the modelcatalog\n */\nconst ModelCatalogReducer: Reducer<ModelCatalogState, ReduxAction> = (\n state = initialState,\n action,\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"UPDATE_ENTRYDATE\":\n Cache.addItem(\"ModelCatalogEntryDate\", action.payload);\n return {\n ...state,\n entryDate: action.payload,\n };\n default:\n return state;\n }\n};\n\nexport default ModelCatalogReducer;\n"],"mappings":"AACA,SAASA,QAAQ,QAAQ,aAAa;AACtC,OAAOC,KAAK,MAAM,2BAA2B;AAK7C,MAAMC,YAA+B,GAAG;EACtCC,SAAS,EAAEH,QAAQ,CAACI,GAAG,CAAC;AAC1B,CAAC;;AAED;AACA;AACA;AACA,MAAMC,mBAA4D,GAAG,SAAAA,CAAA,EAGhE;EAAA,IAFHC,KAAK,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGL,YAAY;EAAA,IACpBQ,MAAM,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAEN,IAAI,CAACC,MAAM,EAAE;IACX,OAAOJ,KAAK;EACd;EAEA,QAAQI,MAAM,CAACC,IAAI;IACjB,KAAK,kBAAkB;MACrBV,KAAK,CAACW,OAAO,CAAC,uBAAuB,EAAEF,MAAM,CAACG,OAAO,CAAC;MACtD,OAAO;QACL,GAAGP,KAAK;QACRH,SAAS,EAAEO,MAAM,CAACG;MACpB,CAAC;IACH;MACE,OAAOP,KAAK;EAChB;AACF,CAAC;AAED,eAAeD,mBAAmB","ignoreList":[]}
|
|
@@ -19,7 +19,7 @@ var _ContentModel = _interopRequireDefault(require("../models/content/ContentMod
|
|
|
19
19
|
var _useModularUIBasic = require("./useModularUIBasic");
|
|
20
20
|
var _models = require("../models");
|
|
21
21
|
var _modelcatalog = require("../redux/selectors/modelcatalog");
|
|
22
|
-
var
|
|
22
|
+
var _ModelCatalog = require("../redux/actions/ModelCatalog");
|
|
23
23
|
/**
|
|
24
24
|
*/
|
|
25
25
|
const useModelCatalog = options => (0, _useModularUIBasic.useModularUIBasic)("modelcatalog", "/modelcatalog", {
|
|
@@ -175,7 +175,7 @@ const useEntryDate = () => {
|
|
|
175
175
|
const entryDate = (0, _reactRedux.useSelector)(_modelcatalog.getEntryDate);
|
|
176
176
|
return {
|
|
177
177
|
entryDate,
|
|
178
|
-
setEntryDate: entryDate => dispatch((0,
|
|
178
|
+
setEntryDate: entryDate => dispatch((0, _ModelCatalog.updateEntryDate)(entryDate))
|
|
179
179
|
};
|
|
180
180
|
};
|
|
181
181
|
exports.useEntryDate = useEntryDate;
|
|
@@ -16,7 +16,7 @@ import { useModularUIBasic } from "./useModularUIBasic";
|
|
|
16
16
|
import { ContentTypeModel } from "../models";
|
|
17
17
|
|
|
18
18
|
import { getEntryDate } from "../redux/selectors/modelcatalog";
|
|
19
|
-
import { updateEntryDate } from "../redux/actions/
|
|
19
|
+
import { updateEntryDate } from "../redux/actions/ModelCatalog";
|
|
20
20
|
|
|
21
21
|
import type Href from "../models/href/Href";
|
|
22
22
|
import type { UseModularUIBasicOptions } from "./useModularUIBasic";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModelCatalog.js","names":["_reactRedux","require","_useRouter","_createHref","_ModelCatalogModel","_interopRequireDefault","_ConceptIndexModel","_ConceptDetailModel","_BusinessScenarioModel","_ContentIndexModel","_ContentTOCModel","_ContentModel","_useModularUIBasic","_models","_modelcatalog","_EntryDate","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/EntryDate\";\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 return {\n entryDate,\n setEntryDate: (entryDate: ISO_DATE) => dispatch(updateEntryDate(entryDate)),\n };\n};\n"],"mappings":";;;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAA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O,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,0BAAe,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 { 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 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;AACO,MAAMe,eAAe,GAC1BC,OAAqD,IAErD,IAAAC,oCAAiB,EAAC,cAAc,EAAE,eAAe,EAAE;EACjDC,cAAc,EAAE,CAAC,cAAc,CAAC;EAChC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;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":[]}
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.setupClient = exports.setUnhandledRejectionEvent = exports.client = exports.addContentLoadedEvent = void 0;
|
|
7
|
+
exports.setupClient = exports.setUnhandledRejectionEvent = exports.setModelCatalogEntryDate = exports.client = exports.addContentLoadedEvent = void 0;
|
|
8
8
|
var _trim = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/trim"));
|
|
9
9
|
var _urlSearchParams = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/url-search-params"));
|
|
10
10
|
var _reactDom = require("react-dom");
|
|
@@ -20,6 +20,7 @@ var _Preferences = require("../redux/actions/Preferences");
|
|
|
20
20
|
var _Notification = require("../redux/actions/Notification");
|
|
21
21
|
var _Error = require("../redux/actions/Error");
|
|
22
22
|
var _SignIn = require("../redux/actions/SignIn");
|
|
23
|
+
var _ModelCatalog = require("../redux/actions/ModelCatalog");
|
|
23
24
|
var _RouterActions = require("../redux/_router/RouterActions");
|
|
24
25
|
var _exceptions = require("../exceptions");
|
|
25
26
|
var _Init = require("./Init");
|
|
@@ -89,6 +90,20 @@ const handleRedirectURI = store => {
|
|
|
89
90
|
|
|
90
91
|
/**
|
|
91
92
|
*/
|
|
93
|
+
const setModelCatalogEntryDate = store => {
|
|
94
|
+
if (typeof window !== "undefined") {
|
|
95
|
+
const entryDateFromUrl = new _urlSearchParams.default(window.location?.search).get("entryDate");
|
|
96
|
+
if (entryDateFromUrl) {
|
|
97
|
+
store.dispatch((0, _ModelCatalog.updateEntryDate)(entryDateFromUrl));
|
|
98
|
+
} else if (_Cache.default.hasItem("ModelCatalogEntryDate")) {
|
|
99
|
+
store.dispatch(_Cache.default.getItem("ModelCatalogEntryDate"));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
*/
|
|
106
|
+
exports.setModelCatalogEntryDate = setModelCatalogEntryDate;
|
|
92
107
|
const setupClient = function () {
|
|
93
108
|
let customReducers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
94
109
|
let beforeRenderHooks = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -109,6 +124,7 @@ const setupClient = function () {
|
|
|
109
124
|
store
|
|
110
125
|
} = (0, _configureStore.default)(browserHistory, customReducers, (0, _rehydrate.default)(data));
|
|
111
126
|
handleRedirectURI(store);
|
|
127
|
+
setModelCatalogEntryDate(store);
|
|
112
128
|
(0, _Preferences.setAllContentInDataSetting)(store.getState());
|
|
113
129
|
(0, _Preferences.setLoginPreferences)(store.getState());
|
|
114
130
|
|
|
@@ -24,9 +24,9 @@ import {
|
|
|
24
24
|
setLoginPreferences,
|
|
25
25
|
} from "../redux/actions/Preferences";
|
|
26
26
|
import { showXHRErrorNotification } from "../redux/actions/Notification";
|
|
27
|
-
|
|
28
27
|
import { handleError } from "../redux/actions/Error";
|
|
29
28
|
import { loginSuccess } from "../redux/actions/SignIn";
|
|
29
|
+
import { updateEntryDate } from "../redux/actions/ModelCatalog";
|
|
30
30
|
|
|
31
31
|
import { locationChange, replace } from "../redux/_router/RouterActions";
|
|
32
32
|
|
|
@@ -130,6 +130,21 @@ const handleRedirectURI = (store: ReduxStore) => {
|
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
+
/**
|
|
134
|
+
*/
|
|
135
|
+
export const setModelCatalogEntryDate = (store: ReduxStore) => {
|
|
136
|
+
if (typeof window !== "undefined") {
|
|
137
|
+
const entryDateFromUrl = new URLSearchParams(window.location?.search).get(
|
|
138
|
+
"entryDate",
|
|
139
|
+
);
|
|
140
|
+
if (entryDateFromUrl) {
|
|
141
|
+
store.dispatch(updateEntryDate(entryDateFromUrl));
|
|
142
|
+
} else if (Cache.hasItem("ModelCatalogEntryDate")) {
|
|
143
|
+
store.dispatch(Cache.getItem("ModelCatalogEntryDate"));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
133
148
|
/**
|
|
134
149
|
*/
|
|
135
150
|
export const setupClient = (
|
|
@@ -156,6 +171,7 @@ export const setupClient = (
|
|
|
156
171
|
);
|
|
157
172
|
|
|
158
173
|
handleRedirectURI(store);
|
|
174
|
+
setModelCatalogEntryDate(store);
|
|
159
175
|
|
|
160
176
|
setAllContentInDataSetting(store.getState());
|
|
161
177
|
setLoginPreferences(store.getState());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["_reactDom","require","_objects","_setimmediate","_interopRequireDefault","_Cache","_xhr","_history","_configureStore","_rehydrate","_Settings","_Preferences","_Notification","_Error","_SignIn","_RouterActions","_exceptions","_Init","_beforeRenderHooks","_jsxRuntime","parseDataToJSON","data","JSON","parse","error","JsonParseException","getDataFromServer","_context","dataElement","document","querySelector","Error","_trim","default","textContent","call","setUnhandledRejectionEvent","store","window","onunhandledrejection","event","detail","setImmediate","errorMessage","reason","message","toString","dispatch","showXHRErrorNotification","exports","handleRedirectURI","urlParams","_urlSearchParams","location","search","redirectURI","get","xhr","url","getBasePathModularUI","catch","e","id","LOGIN_PATH","getSetting","replace","from","pathname","modal","setupClient","customReducers","arguments","length","undefined","beforeRenderHooks","contextPath","Cache","clear","browserHistory","createBrowserHistory","basename","getBasePathServer","routerHistory","configureStore","rehydrate","setAllContentInDataSetting","getState","setLoginPreferences","loadOtherBrowserTabs","getItem","loginSuccess","has","FetchException","response","handleError","listen","action","locationChange","body","className","handleBeforeRenderHooks","addContentLoadedEvent","theme","render","ErrorFallbackComponent","mount","addEventListener","applicationNode","jsx","Init","children","mountClient","element","isSSR","hydrate","client","_ref"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\n// eslint-disable-next-line react/no-deprecated\nimport { hydrate, render } from \"react-dom\";\n\nimport { has } from \"../utils/helpers/objects\";\nimport setImmediate from \"setimmediate\";\n\nimport Cache from \"../utils/browser/Cache\";\n\nimport xhr from \"../utils/fetch/xhr\";\n\nimport { createBrowserHistory } from \"history\";\nimport configureStore from \"../redux/store/configureStore\";\n\nimport rehydrate from \"./rehydrate\";\nimport {\n getBasePathModularUI,\n getBasePathServer,\n getSetting,\n} from \"../constants/Settings\";\n\nimport {\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\nimport { showXHRErrorNotification } from \"../redux/actions/Notification\";\n\nimport { handleError } from \"../redux/actions/Error\";\nimport { loginSuccess } from \"../redux/actions/SignIn\";\n\nimport { locationChange, replace } from \"../redux/_router/RouterActions\";\n\nimport { JsonParseException, FetchException } from \"../exceptions\";\n\nimport { Init } from \"./Init\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport type {\n ComponentType,\n Element as ReactElement,\n ElementType,\n} from \"react\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { CustomReducers, ReduxStore } from \"../redux/types\";\nimport type { RouterHistory } from \"react-router\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\n\ntype RenderFunction = () => ReactElement<ElementType>;\ntype MountFunction = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => void;\ntype Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n mount: MountFunction,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\nconst parseDataToJSON = (data: string) => {\n try {\n return JSON.parse(data);\n } catch (error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n\nconst getDataFromServer = () => {\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]',\n );\n\n if (!dataElement) {\n throw new Error(\"Error loading state, json not found\");\n } else if (dataElement.textContent.trim() === \"\") {\n return {};\n }\n\n return parseDataToJSON(dataElement.textContent);\n};\n\n/**\n */\nexport const setUnhandledRejectionEvent = (store: ReduxStore) => {\n window.onunhandledrejection = (event) => {\n if (event.detail) {\n return setImmediate(() => {\n const errorMessage = event.detail.reason.message.toString();\n\n store.dispatch(showXHRErrorNotification(errorMessage));\n throw event.detail.reason;\n });\n }\n\n return event;\n };\n};\n\n/**\n * The redirectURI querystring parameter is available when the server is redirecting an unauthorized deep link\n * @param store\n */\nconst handleRedirectURI = (store: ReduxStore) => {\n const urlParams = new URLSearchParams(window.location.search);\n const redirectURI = urlParams.get(\"redirectURI\");\n if (redirectURI) {\n xhr({ url: `${getBasePathModularUI()}${redirectURI}` }).catch((e) => {\n if (\n e.id === \"UnauthorizedException\" ||\n e.id === \"Error.NotAuthorized\" ||\n e.id === \"Error.Authentication.Required\" ||\n e.id === \"Error.Authentication.InvalidCredentials\"\n ) {\n const LOGIN_PATH = getSetting(\"LOGIN_PATH\", \"/signin\");\n store.dispatch(\n replace(LOGIN_PATH, {\n from: { pathname: redirectURI },\n modal: false,\n }),\n );\n }\n });\n }\n};\n\n/**\n */\nexport const setupClient = (\n customReducers: CustomReducers = {},\n beforeRenderHooks: ?Array<BeforeRenderHook>,\n): { store: ReduxStore, routerHistory: RouterHistory } => {\n if (typeof window.contextPath === \"undefined\") {\n throw new Error(\"Missing contextPath on window object\");\n }\n\n const data = getDataFromServer();\n\n // remove all resources from cache\n Cache.clear(\"^res:\");\n\n // $FlowExpectedError\n const browserHistory: RouterHistory = createBrowserHistory({\n basename: getBasePathServer(),\n });\n const { routerHistory, store } = configureStore(\n browserHistory,\n customReducers,\n rehydrate(data),\n );\n\n handleRedirectURI(store);\n\n setAllContentInDataSetting(store.getState());\n setLoginPreferences(store.getState());\n\n // load existing cache from other browser tabs\n Cache.loadOtherBrowserTabs(() => {\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n });\n\n if (has(data, \"error.name\")) {\n const error = new FetchException(data?.error?.response);\n store.dispatch(handleError(error));\n }\n\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n\n // listen to history change and update the redux router store\n routerHistory.listen((location, action) => {\n store.dispatch(locationChange(location, action));\n });\n\n setUnhandledRejectionEvent(store);\n\n if (document.body) {\n document.body.className = \"js\";\n }\n\n if (beforeRenderHooks) {\n handleBeforeRenderHooks(beforeRenderHooks, { store });\n }\n\n return { store, routerHistory };\n};\n\n/**\n */\nexport const addContentLoadedEvent = (\n store: ReduxStore,\n routerHistory: RouterHistory,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n mount: MountFunction,\n) => {\n window.addEventListener(\"DOMContentLoaded\", () => {\n const applicationNode = document.querySelector(\"#application\");\n if (!applicationNode) {\n throw new Error(\n \"No DOM element with id application found to attach client to\",\n );\n }\n\n mount(\n applicationNode,\n <Init\n store={store}\n routerHistory={routerHistory}\n contextPath={window.contextPath}\n theme={theme}\n ErrorFallbackComponent={ErrorFallbackComponent}\n >\n {render()}\n </Init>,\n );\n });\n};\n\n/**\n */\nconst mountClient = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => {\n const isSSR = applicationNode.querySelector(\".application\");\n if (isSSR) {\n hydrate(element, applicationNode);\n } else {\n render(element, applicationNode);\n }\n};\n\n/**\n * Mount the webapplication to the DOM, setup redux store and caches, add unhandledRejectionEvent, used client side when JavaScript is enabled.\n */\nexport const client = ({\n customReducers,\n theme,\n render,\n beforeRenderHooks,\n ErrorFallbackComponent,\n mount,\n}: Props) => {\n const { store, routerHistory } = setupClient(\n customReducers,\n beforeRenderHooks,\n );\n\n addContentLoadedEvent(\n store,\n routerHistory,\n theme,\n render,\n ErrorFallbackComponent,\n mount ?? mountClient,\n );\n};\n"],"mappings":";;;;;;;;;AAEA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAD,sBAAA,CAAAH,OAAA;AAEA,IAAAK,IAAA,GAAAF,sBAAA,CAAAH,OAAA;AAEA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAJ,sBAAA,CAAAH,OAAA;AAEA,IAAAQ,UAAA,GAAAL,sBAAA,CAAAH,OAAA;AACA,IAAAS,SAAA,GAAAT,OAAA;AAMA,IAAAU,YAAA,GAAAV,OAAA;AAIA,IA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qBAAA;AAEA,MAAMU,WAAW,GAAGA,CAClBJ,eAAwB,EACxBK,OAAkC,KAC/B;EACH,MAAMC,KAAK,GAAGN,eAAe,CAAC7E,aAAa,CAAC,cAAc,CAAC;EAC3D,IAAImF,KAAK,EAAE;IACT,IAAAC,iBAAO,EAACF,OAAO,EAAEL,eAAe,CAAC;EACnC,CAAC,MAAM;IACL,IAAAJ,gBAAM,EAACS,OAAO,EAAEL,eAAe,CAAC;EAClC;AACF,CAAC;;AAED;AACA;AACA;AACO,MAAMQ,MAAM,GAAGC,IAAA,IAOT;EAAA,IAPU;IACrB9C,cAAc;IACdgC,KAAK;IACLC,MAAM;IACN7B,iBAAiB;IACjB8B,sBAAsB;IACtBC;EACK,CAAC,GAAAW,IAAA;EACN,MAAM;IAAE/E,KAAK;IAAE6C;EAAc,CAAC,GAAGb,WAAW,CAC1CC,cAAc,EACdI,iBACF,CAAC;EAED2B,qBAAqB,CACnBhE,KAAK,EACL6C,aAAa,EACboB,KAAK,EACLC,MAAM,EACNC,sBAAsB,EACtBC,KAAK,IAAIM,WACX,CAAC;AACH,CAAC;AAAC9D,OAAA,CAAAkE,MAAA,GAAAA,MAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"client.js","names":["_reactDom","require","_objects","_setimmediate","_interopRequireDefault","_Cache","_xhr","_history","_configureStore","_rehydrate","_Settings","_Preferences","_Notification","_Error","_SignIn","_ModelCatalog","_RouterActions","_exceptions","_Init","_beforeRenderHooks","_jsxRuntime","parseDataToJSON","data","JSON","parse","error","JsonParseException","getDataFromServer","_context","dataElement","document","querySelector","Error","_trim","default","textContent","call","setUnhandledRejectionEvent","store","window","onunhandledrejection","event","detail","setImmediate","errorMessage","reason","message","toString","dispatch","showXHRErrorNotification","exports","handleRedirectURI","urlParams","_urlSearchParams","location","search","redirectURI","get","xhr","url","getBasePathModularUI","catch","e","id","LOGIN_PATH","getSetting","replace","from","pathname","modal","setModelCatalogEntryDate","entryDateFromUrl","updateEntryDate","Cache","hasItem","getItem","setupClient","customReducers","arguments","length","undefined","beforeRenderHooks","contextPath","clear","browserHistory","createBrowserHistory","basename","getBasePathServer","routerHistory","configureStore","rehydrate","setAllContentInDataSetting","getState","setLoginPreferences","loadOtherBrowserTabs","loginSuccess","has","FetchException","response","handleError","listen","action","locationChange","body","className","handleBeforeRenderHooks","addContentLoadedEvent","theme","render","ErrorFallbackComponent","mount","addEventListener","applicationNode","jsx","Init","children","mountClient","element","isSSR","hydrate","client","_ref"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\n// eslint-disable-next-line react/no-deprecated\nimport { hydrate, render } from \"react-dom\";\n\nimport { has } from \"../utils/helpers/objects\";\nimport setImmediate from \"setimmediate\";\n\nimport Cache from \"../utils/browser/Cache\";\n\nimport xhr from \"../utils/fetch/xhr\";\n\nimport { createBrowserHistory } from \"history\";\nimport configureStore from \"../redux/store/configureStore\";\n\nimport rehydrate from \"./rehydrate\";\nimport {\n getBasePathModularUI,\n getBasePathServer,\n getSetting,\n} from \"../constants/Settings\";\n\nimport {\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\nimport { showXHRErrorNotification } from \"../redux/actions/Notification\";\nimport { handleError } from \"../redux/actions/Error\";\nimport { loginSuccess } from \"../redux/actions/SignIn\";\nimport { updateEntryDate } from \"../redux/actions/ModelCatalog\";\n\nimport { locationChange, replace } from \"../redux/_router/RouterActions\";\n\nimport { JsonParseException, FetchException } from \"../exceptions\";\n\nimport { Init } from \"./Init\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport type {\n ComponentType,\n Element as ReactElement,\n ElementType,\n} from \"react\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { CustomReducers, ReduxStore } from \"../redux/types\";\nimport type { RouterHistory } from \"react-router\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\n\ntype RenderFunction = () => ReactElement<ElementType>;\ntype MountFunction = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => void;\ntype Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n mount: MountFunction,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\nconst parseDataToJSON = (data: string) => {\n try {\n return JSON.parse(data);\n } catch (error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n\nconst getDataFromServer = () => {\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]',\n );\n\n if (!dataElement) {\n throw new Error(\"Error loading state, json not found\");\n } else if (dataElement.textContent.trim() === \"\") {\n return {};\n }\n\n return parseDataToJSON(dataElement.textContent);\n};\n\n/**\n */\nexport const setUnhandledRejectionEvent = (store: ReduxStore) => {\n window.onunhandledrejection = (event) => {\n if (event.detail) {\n return setImmediate(() => {\n const errorMessage = event.detail.reason.message.toString();\n\n store.dispatch(showXHRErrorNotification(errorMessage));\n throw event.detail.reason;\n });\n }\n\n return event;\n };\n};\n\n/**\n * The redirectURI querystring parameter is available when the server is redirecting an unauthorized deep link\n * @param store\n */\nconst handleRedirectURI = (store: ReduxStore) => {\n const urlParams = new URLSearchParams(window.location.search);\n const redirectURI = urlParams.get(\"redirectURI\");\n if (redirectURI) {\n xhr({ url: `${getBasePathModularUI()}${redirectURI}` }).catch((e) => {\n if (\n e.id === \"UnauthorizedException\" ||\n e.id === \"Error.NotAuthorized\" ||\n e.id === \"Error.Authentication.Required\" ||\n e.id === \"Error.Authentication.InvalidCredentials\"\n ) {\n const LOGIN_PATH = getSetting(\"LOGIN_PATH\", \"/signin\");\n store.dispatch(\n replace(LOGIN_PATH, {\n from: { pathname: redirectURI },\n modal: false,\n }),\n );\n }\n });\n }\n};\n\n/**\n */\nexport const setModelCatalogEntryDate = (store: ReduxStore) => {\n if (typeof window !== \"undefined\") {\n const entryDateFromUrl = new URLSearchParams(window.location?.search).get(\n \"entryDate\",\n );\n if (entryDateFromUrl) {\n store.dispatch(updateEntryDate(entryDateFromUrl));\n } else if (Cache.hasItem(\"ModelCatalogEntryDate\")) {\n store.dispatch(Cache.getItem(\"ModelCatalogEntryDate\"));\n }\n }\n};\n\n/**\n */\nexport const setupClient = (\n customReducers: CustomReducers = {},\n beforeRenderHooks: ?Array<BeforeRenderHook>,\n): { store: ReduxStore, routerHistory: RouterHistory } => {\n if (typeof window.contextPath === \"undefined\") {\n throw new Error(\"Missing contextPath on window object\");\n }\n\n const data = getDataFromServer();\n\n // remove all resources from cache\n Cache.clear(\"^res:\");\n\n // $FlowExpectedError\n const browserHistory: RouterHistory = createBrowserHistory({\n basename: getBasePathServer(),\n });\n const { routerHistory, store } = configureStore(\n browserHistory,\n customReducers,\n rehydrate(data),\n );\n\n handleRedirectURI(store);\n setModelCatalogEntryDate(store);\n\n setAllContentInDataSetting(store.getState());\n setLoginPreferences(store.getState());\n\n // load existing cache from other browser tabs\n Cache.loadOtherBrowserTabs(() => {\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n });\n\n if (has(data, \"error.name\")) {\n const error = new FetchException(data?.error?.response);\n store.dispatch(handleError(error));\n }\n\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n\n // listen to history change and update the redux router store\n routerHistory.listen((location, action) => {\n store.dispatch(locationChange(location, action));\n });\n\n setUnhandledRejectionEvent(store);\n\n if (document.body) {\n document.body.className = \"js\";\n }\n\n if (beforeRenderHooks) {\n handleBeforeRenderHooks(beforeRenderHooks, { store });\n }\n\n return { store, routerHistory };\n};\n\n/**\n */\nexport const addContentLoadedEvent = (\n store: ReduxStore,\n routerHistory: RouterHistory,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n mount: MountFunction,\n) => {\n window.addEventListener(\"DOMContentLoaded\", () => {\n const applicationNode = document.querySelector(\"#application\");\n if (!applicationNode) {\n throw new Error(\n \"No DOM element with id application found to attach client to\",\n );\n }\n\n mount(\n applicationNode,\n <Init\n store={store}\n routerHistory={routerHistory}\n contextPath={window.contextPath}\n theme={theme}\n ErrorFallbackComponent={ErrorFallbackComponent}\n >\n {render()}\n </Init>,\n );\n });\n};\n\n/**\n */\nconst mountClient = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => {\n const isSSR = applicationNode.querySelector(\".application\");\n if (isSSR) {\n hydrate(element, applicationNode);\n } else {\n render(element, applicationNode);\n }\n};\n\n/**\n * Mount the webapplication to the DOM, setup redux store and caches, add unhandledRejectionEvent, used client side when JavaScript is enabled.\n */\nexport const client = ({\n customReducers,\n theme,\n render,\n beforeRenderHooks,\n ErrorFallbackComponent,\n mount,\n}: Props) => {\n const { store, routerHistory } = setupClient(\n customReducers,\n beforeRenderHooks,\n );\n\n addContentLoadedEvent(\n store,\n routerHistory,\n theme,\n render,\n ErrorFallbackComponent,\n mount ?? mountClient,\n );\n};\n"],"mappings":";;;;;;;;;AAEA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAD,sBAAA,CAAAH,OAAA;AAEA,IAAAK,IAAA,GAAAF,sBAAA,CAAAH,OAAA;AAEA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAJ,sBAAA,CAAAH,OAAA;AAEA,IAAAQ,UAAA,GAAAL,sBAAA,CAAAH,OAAA;AACA,IAAAS,SAAA,GAAAT,OAAA;AAMA,IAAAU,YAAA,GAAAV,OAAA;AAIA,IAAAW,aAAA,GAAAX,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AACA,IAAAa,OAAA,GAAAb,OAAA;AACA,IAAAc,aAAA,GAAAd,OAAA;AAEA,IAAAe,cAAA,GAAAf,OAAA;AAEA,IA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|
1
|
+
{"version":3,"file":"ModelCatalog.js","names":["updateEntryDate","entryDate","type","payload","exports"],"sources":["../../../src/redux/actions/ModelCatalog.js"],"sourcesContent":["// @flow\nimport type { UpdateEntryDateAction } from \"../types\";\n\n/**\n * Update the entry date being used in the modelcatalog\n */\nexport const updateEntryDate = (\n entryDate: ISO_DATE,\n): UpdateEntryDateAction => ({\n type: \"UPDATE_ENTRYDATE\",\n payload: entryDate,\n});\n"],"mappings":";;;;;;AAGA;AACA;AACA;AACO,MAAMA,eAAe,GAC1BC,SAAmB,KACQ;EAC3BC,IAAI,EAAE,kBAAkB;EACxBC,OAAO,EAAEF;AACX,CAAC,CAAC;AAACG,OAAA,CAAAJ,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -26,14 +26,14 @@ _Object$keys(_Authorization).forEach(function (key) {
|
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
|
-
var
|
|
30
|
-
_Object$keys(
|
|
29
|
+
var _ModelCatalog = require("./ModelCatalog");
|
|
30
|
+
_Object$keys(_ModelCatalog).forEach(function (key) {
|
|
31
31
|
if (key === "default" || key === "__esModule") return;
|
|
32
|
-
if (key in exports && exports[key] ===
|
|
32
|
+
if (key in exports && exports[key] === _ModelCatalog[key]) return;
|
|
33
33
|
Object.defineProperty(exports, key, {
|
|
34
34
|
enumerable: true,
|
|
35
35
|
get: function () {
|
|
36
|
-
return
|
|
36
|
+
return _ModelCatalog[key];
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Application","require","_Object$keys","forEach","key","exports","Object","defineProperty","enumerable","get","_Authorization","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Application","require","_Object$keys","forEach","key","exports","Object","defineProperty","enumerable","get","_Authorization","_ModelCatalog","_Error","_Form","_FormAttributeSet","_FormAttributeSetRepeatable","_FormAutosave","_FormAutosubmit","_FormValidations","_Modals","_Notification","_Preferences","_ProgressIndicator","_SignIn","_SignOut"],"sources":["../../../src/redux/actions/index.js"],"sourcesContent":["// @flow\nexport * from \"./Application\";\nexport * from \"./Authorization\";\nexport * from \"./ModelCatalog\";\nexport * from \"./Error\";\nexport * from \"./Form\";\nexport * from \"./FormAttributeSet\";\nexport * from \"./FormAttributeSetRepeatable\";\nexport * from \"./FormAutosave\";\nexport * from \"./FormAutosubmit\";\nexport * from \"./FormValidations\";\nexport * from \"./Modals\";\nexport * from \"./Notification\";\nexport * from \"./Preferences\";\nexport * from \"./ProgressIndicator\";\nexport * from \"./SignIn\";\nexport * from \"./SignOut\";\n"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAAC,YAAA,CAAAF,YAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAJ,YAAA,CAAAI,GAAA;EAAAE,MAAA,CAAAC,cAAA,CAAAF,OAAA,EAAAD,GAAA;IAAAI,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,YAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,cAAA,GAAAT,OAAA;AAAAC,YAAA,CAAAQ,cAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,cAAA,CAAAN,GAAA;EAAAE,MAAA,CAAAC,cAAA,CAAAF,OAAA,EAAAD,GAAA;IAAAI,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,cAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,aAAA,GAAAV,OAAA;AAAAC,YAAA,CAAAS,aAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAA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earchParams = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/url-search-params"));
|
|
9
8
|
var _utils = require("../../utils");
|
|
10
9
|
var _Cache = _interopRequireDefault(require("../../utils/browser/Cache"));
|
|
11
10
|
const initialState = {
|
|
12
|
-
entryDate:
|
|
11
|
+
entryDate: _utils.DateUtil.now()
|
|
13
12
|
};
|
|
14
13
|
|
|
15
14
|
/**
|
|
@@ -6,12 +6,7 @@ import type { Reducer } from "redux";
|
|
|
6
6
|
import type { ReduxAction, ModelCatalogState } from "../types";
|
|
7
7
|
|
|
8
8
|
const initialState: ModelCatalogState = {
|
|
9
|
-
entryDate:
|
|
10
|
-
typeof window !== "undefined"
|
|
11
|
-
? new URLSearchParams(window.location?.search).get("entryDate") ||
|
|
12
|
-
Cache.getItem("ModelCatalogEntryDate") ||
|
|
13
|
-
DateUtil.now()
|
|
14
|
-
: null,
|
|
9
|
+
entryDate: DateUtil.now(),
|
|
15
10
|
};
|
|
16
11
|
|
|
17
12
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelCatalogReducer.js","names":["_utils","require","_Cache","_interopRequireDefault","initialState","entryDate","
|
|
1
|
+
{"version":3,"file":"ModelCatalogReducer.js","names":["_utils","require","_Cache","_interopRequireDefault","initialState","entryDate","DateUtil","now","ModelCatalogReducer","state","arguments","length","undefined","action","type","Cache","addItem","payload","_default","exports","default"],"sources":["../../../src/redux/reducers/ModelCatalogReducer.js"],"sourcesContent":["// @flow\nimport { DateUtil } from \"../../utils\";\nimport Cache from \"../../utils/browser/Cache\";\n\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction, ModelCatalogState } from \"../types\";\n\nconst initialState: ModelCatalogState = {\n entryDate: DateUtil.now(),\n};\n\n/**\n * Keep track of the entry date for the modelcatalog\n */\nconst ModelCatalogReducer: Reducer<ModelCatalogState, ReduxAction> = (\n state = initialState,\n action,\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"UPDATE_ENTRYDATE\":\n Cache.addItem(\"ModelCatalogEntryDate\", action.payload);\n return {\n ...state,\n entryDate: action.payload,\n };\n default:\n return state;\n }\n};\n\nexport default ModelCatalogReducer;\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,MAAMG,YAA+B,GAAG;EACtCC,SAAS,EAAEC,eAAQ,CAACC,GAAG,CAAC;AAC1B,CAAC;;AAED;AACA;AACA;AACA,MAAMC,mBAA4D,GAAG,SAAAA,CAAA,EAGhE;EAAA,IAFHC,KAAK,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGN,YAAY;EAAA,IACpBS,MAAM,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAEN,IAAI,CAACC,MAAM,EAAE;IACX,OAAOJ,KAAK;EACd;EAEA,QAAQI,MAAM,CAACC,IAAI;IACjB,KAAK,kBAAkB;MACrBC,cAAK,CAACC,OAAO,CAAC,uBAAuB,EAAEH,MAAM,CAACI,OAAO,CAAC;MACtD,OAAO;QACL,GAAGR,KAAK;QACRJ,SAAS,EAAEQ,MAAM,CAACI;MACpB,CAAC;IACH;MACE,OAAOR,KAAK;EAChB;AACF,CAAC;AAAC,IAAAS,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaZ,mBAAmB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@ import { useModularUIBasic } from "./useModularUIBasic";
|
|
|
16
16
|
import { ContentTypeModel } from "../models";
|
|
17
17
|
|
|
18
18
|
import { getEntryDate } from "../redux/selectors/modelcatalog";
|
|
19
|
-
import { updateEntryDate } from "../redux/actions/
|
|
19
|
+
import { updateEntryDate } from "../redux/actions/ModelCatalog";
|
|
20
20
|
|
|
21
21
|
import type Href from "../models/href/Href";
|
|
22
22
|
import type { UseModularUIBasicOptions } from "./useModularUIBasic";
|
|
@@ -24,9 +24,9 @@ import {
|
|
|
24
24
|
setLoginPreferences,
|
|
25
25
|
} from "../redux/actions/Preferences";
|
|
26
26
|
import { showXHRErrorNotification } from "../redux/actions/Notification";
|
|
27
|
-
|
|
28
27
|
import { handleError } from "../redux/actions/Error";
|
|
29
28
|
import { loginSuccess } from "../redux/actions/SignIn";
|
|
29
|
+
import { updateEntryDate } from "../redux/actions/ModelCatalog";
|
|
30
30
|
|
|
31
31
|
import { locationChange, replace } from "../redux/_router/RouterActions";
|
|
32
32
|
|
|
@@ -130,6 +130,21 @@ const handleRedirectURI = (store: ReduxStore) => {
|
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
+
/**
|
|
134
|
+
*/
|
|
135
|
+
export const setModelCatalogEntryDate = (store: ReduxStore) => {
|
|
136
|
+
if (typeof window !== "undefined") {
|
|
137
|
+
const entryDateFromUrl = new URLSearchParams(window.location?.search).get(
|
|
138
|
+
"entryDate",
|
|
139
|
+
);
|
|
140
|
+
if (entryDateFromUrl) {
|
|
141
|
+
store.dispatch(updateEntryDate(entryDateFromUrl));
|
|
142
|
+
} else if (Cache.hasItem("ModelCatalogEntryDate")) {
|
|
143
|
+
store.dispatch(Cache.getItem("ModelCatalogEntryDate"));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
133
148
|
/**
|
|
134
149
|
*/
|
|
135
150
|
export const setupClient = (
|
|
@@ -156,6 +171,7 @@ export const setupClient = (
|
|
|
156
171
|
);
|
|
157
172
|
|
|
158
173
|
handleRedirectURI(store);
|
|
174
|
+
setModelCatalogEntryDate(store);
|
|
159
175
|
|
|
160
176
|
setAllContentInDataSetting(store.getState());
|
|
161
177
|
setLoginPreferences(store.getState());
|
|
@@ -6,12 +6,7 @@ import type { Reducer } from "redux";
|
|
|
6
6
|
import type { ReduxAction, ModelCatalogState } from "../types";
|
|
7
7
|
|
|
8
8
|
const initialState: ModelCatalogState = {
|
|
9
|
-
entryDate:
|
|
10
|
-
typeof window !== "undefined"
|
|
11
|
-
? new URLSearchParams(window.location?.search).get("entryDate") ||
|
|
12
|
-
Cache.getItem("ModelCatalogEntryDate") ||
|
|
13
|
-
DateUtil.now()
|
|
14
|
-
: null,
|
|
9
|
+
entryDate: DateUtil.now(),
|
|
15
10
|
};
|
|
16
11
|
|
|
17
12
|
/**
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EntryDate.js","names":["updateEntryDate","entryDate","type","payload"],"sources":["../../../src/redux/actions/EntryDate.js"],"sourcesContent":["// @flow\nimport type { UpdateEntryDateAction } from \"../types\";\n\n/**\n * Update the entry date being used in the modelcatalog\n */\nexport const updateEntryDate = (\n entryDate: ISO_DATE,\n): UpdateEntryDateAction => ({\n type: \"UPDATE_ENTRYDATE\",\n payload: entryDate,\n});\n"],"mappings":"AAGA;AACA;AACA;AACA,OAAO,MAAMA,eAAe,GAC1BC,SAAmB,KACQ;EAC3BC,IAAI,EAAE,kBAAkB;EACxBC,OAAO,EAAEF;AACX,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EntryDate.js","names":["updateEntryDate","entryDate","type","payload","exports"],"sources":["../../../src/redux/actions/EntryDate.js"],"sourcesContent":["// @flow\nimport type { UpdateEntryDateAction } from \"../types\";\n\n/**\n * Update the entry date being used in the modelcatalog\n */\nexport const updateEntryDate = (\n entryDate: ISO_DATE,\n): UpdateEntryDateAction => ({\n type: \"UPDATE_ENTRYDATE\",\n payload: entryDate,\n});\n"],"mappings":";;;;;;AAGA;AACA;AACA;AACO,MAAMA,eAAe,GAC1BC,SAAmB,KACQ;EAC3BC,IAAI,EAAE,kBAAkB;EACxBC,OAAO,EAAEF;AACX,CAAC,CAAC;AAACG,OAAA,CAAAJ,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
File without changes
|
|
File without changes
|