@beinformed/ui 1.58.2 → 1.58.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/esm/hooks/useModelCatalog.js +1 -1
  3. package/esm/hooks/useModelCatalog.js.map +1 -1
  4. package/esm/models/content/SectionModel.js +1 -1
  5. package/esm/models/content/SectionModel.js.map +1 -1
  6. package/esm/models/content/SubSectionModel.js +12 -4
  7. package/esm/models/content/SubSectionModel.js.map +1 -1
  8. package/esm/react-client/client.js +15 -0
  9. package/esm/react-client/client.js.map +1 -1
  10. package/esm/redux/actions/{EntryDate.js → ModelCatalog.js} +1 -1
  11. package/esm/redux/actions/ModelCatalog.js.map +1 -0
  12. package/esm/redux/actions/index.js +1 -1
  13. package/esm/redux/actions/index.js.map +1 -1
  14. package/esm/redux/reducers/ModelCatalogReducer.js +1 -2
  15. package/esm/redux/reducers/ModelCatalogReducer.js.map +1 -1
  16. package/lib/hooks/useModelCatalog.js +2 -2
  17. package/lib/hooks/useModelCatalog.js.flow +1 -1
  18. package/lib/hooks/useModelCatalog.js.map +1 -1
  19. package/lib/models/content/SectionModel.js +1 -1
  20. package/lib/models/content/SectionModel.js.flow +2 -1
  21. package/lib/models/content/SectionModel.js.map +1 -1
  22. package/lib/models/content/SubSectionModel.js +12 -3
  23. package/lib/models/content/SubSectionModel.js.flow +20 -3
  24. package/lib/models/content/SubSectionModel.js.map +1 -1
  25. package/lib/models/content/__tests__/ContentModel.spec.js.flow +3 -3
  26. package/lib/react-client/client.js +17 -1
  27. package/lib/react-client/client.js.flow +17 -1
  28. package/lib/react-client/client.js.map +1 -1
  29. package/lib/redux/actions/{EntryDate.js → ModelCatalog.js} +1 -1
  30. package/lib/redux/actions/ModelCatalog.js.map +1 -0
  31. package/lib/redux/actions/index.js +4 -4
  32. package/lib/redux/actions/index.js.flow +1 -1
  33. package/lib/redux/actions/index.js.map +1 -1
  34. package/lib/redux/reducers/ModelCatalogReducer.js +1 -2
  35. package/lib/redux/reducers/ModelCatalogReducer.js.flow +1 -6
  36. package/lib/redux/reducers/ModelCatalogReducer.js.map +1 -1
  37. package/package.json +2 -2
  38. package/src/hooks/useModelCatalog.js +1 -1
  39. package/src/models/content/SectionModel.js +2 -1
  40. package/src/models/content/SubSectionModel.js +20 -3
  41. package/src/models/content/__tests__/ContentModel.spec.js +3 -3
  42. package/src/react-client/client.js +17 -1
  43. package/src/redux/actions/index.js +1 -1
  44. package/src/redux/reducers/ModelCatalogReducer.js +1 -6
  45. package/esm/redux/actions/EntryDate.js.map +0 -1
  46. package/lib/redux/actions/EntryDate.js.map +0 -1
  47. /package/lib/redux/actions/{EntryDate.js.flow → ModelCatalog.js.flow} +0 -0
  48. /package/src/redux/actions/{EntryDate.js → ModelCatalog.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [1.58.4](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.58.3...v1.58.4) (2024-11-26)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **modelcatalog:** add entry date to related concepts link of subsections ([e0a20dc](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/e0a20dc1b3bb69cc967bd1a1c1dbf4cd677e0f93))
11
+
12
+ ## [1.58.3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.58.2...v1.58.3) (2024-11-20)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * **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))
18
+
5
19
  ## [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
20
 
7
21
 
@@ -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/EntryDate";
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,MAAM,qCAAqC;AACnE,OAAOC,eAAe,MAAM,mCAAmC;AAC/D,OAAOC,YAAY,MAAM,gCAAgC;AAEzD,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,gBAAgB,QAAQ,WAAW;AAE5C,SAASC,YAAY,QAAQ,iCAAiC;AAC9D,SAASC,eAAe,QAAQ,4BAA4B;AAa5D;AACA;AACA,OAAO,MAAMC,eAAe,GAC1BC,OAAqD,IAErDL,iBAAiB,CAAC,cAAc,EAAE,eAAe,EAAE;EACjDM,cAAc,EAAE,CAAC,cAAc,CAAC;EAChCC,WAAW,EAAEf,iBAAiB;EAC9B,GAAGa;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMG,eAAe,GAAG,SAAAA,CAC7BC,IAAmB,EAGI;EAAA,IAFvBC,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,G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D,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,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,gBAAgB,QAAQ,WAAW;AAE5C,SAASC,YAAY,QAAQ,iCAAiC;AAC9D,SAASC,eAAe,QAAQ,+BAA+B;AAa/D;AACA;AACA,OAAO,MAAMC,eAAe,GAC1BC,OAAqD,IAErDL,iBAAiB,CAAC,cAAc,EAAE,eAAe,EAAE;EACjDM,cAAc,EAAE,CAAC,cAAc,CAAC;EAChCC,WAAW,EAAEf,iBAAiB;EAC9B,GAAGa;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMG,eAAe,GAAG,SAAAA,CAC7BC,IAAmB,EAGI;EAAA,IAFvBC,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,cAAc;EAAA,IAC7BN,OAAqD,GAAAM,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAErD,MAAM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AY,EAAG7B,SAAmB,IAAK4B,QAAQ,CAACvC,eAAe,CAACW,SAAS,CAAC;EAC5E,CAAC;AACH,CAAC","ignoreList":[]}
@@ -139,7 +139,7 @@ class SectionModel extends BaseModel {
139
139
  */
140
140
  get subSections() {
141
141
  var _context4;
142
- return this.data.subSections ? _mapInstanceProperty(_context4 = this.data.subSections).call(_context4, subSection => new SubSectionModel(subSection)) : [];
142
+ return this.data.subSections ? _mapInstanceProperty(_context4 = this.data.subSections).call(_context4, subSection => new SubSectionModel(subSection, this.entryDate, this.modelOptions)) : [];
143
143
  }
144
144
 
145
145
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"SectionModel.js","names":["BaseModel","ContentLinkModel","SubSectionModel","createHashFromHref","LinkModel","retrieveText","SectionModel","constructor","data","entryDate","modelOptions","_defineProperty","_entryDate","referred","selflink","_selflink","_links","self","selfhref","href","type","sourceLabel","id","_id","key","label","getData","number","body","childSectionLinks","_context","childSections","_mapInstanceProperty","call","childSection","section","selfContentLink","_childSections","_context2","_context3","_filterInstanceProperty","sections","subSections","_context4","subSection","referenceHash","getReferredSections","push","referredChilds"],"sources":["../../../src/models/content/SectionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport SubSectionModel from \"./SubSectionModel\";\n\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\nimport LinkModel from \"../links/LinkModel\";\n\nimport { retrieveText } from \"../../utils\";\n\nimport type Href from \"../href/Href\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n */\nclass SectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _selflink: ?LinkModel;\n _childSections: Array<SectionModel>;\n\n constructor(\n data: Object,\n entryDate: ISO_DATE | null,\n modelOptions?: ModelOptions,\n ) {\n super(data, {}, modelOptions);\n\n this._entryDate = entryDate;\n }\n\n /**\n */\n get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get selflink(): LinkModel {\n if (!this._selflink) {\n this._selflink = new LinkModel(\n this.data._links?.self,\n null,\n this.modelOptions,\n );\n }\n return this._selflink;\n }\n\n /**\n */\n get selfhref(): Href {\n return this.selflink.href;\n }\n\n /**\n */\n get entryDate(): ISO_DATE | null {\n return this._entryDate;\n }\n\n /**\n */\n get type(): string {\n return this.data.type;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this.data.sourceLabel;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n */\n get key(): string {\n return this.id;\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Get content body\n */\n get body(): ?string {\n return retrieveText(this.data.body);\n }\n\n /**\n * Retrieve child section links\n */\n get childSectionLinks(): Array<ContentLinkModel> {\n return this.data.childSections\n ? this.data.childSections.map(\n (childSection) =>\n new ContentLinkModel(\n {\n section: childSection.id || childSection._id,\n _id: childSection.id || childSection._id,\n label: childSection.label,\n sourceLabel: childSection.sourceLabel,\n _links: childSection._links,\n },\n this.entryDate,\n this.modelOptions,\n ),\n )\n : [];\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(\n {\n section: this.id,\n _id: this.id,\n label: this.data.label,\n sourceLabel: this.data.sourceLabel,\n _links: this.data._links,\n },\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n * Get tree of child sections\n */\n get childSections(): Array<SectionModel> {\n if (!this._childSections && this.data.childSections) {\n this._childSections = this.data.childSections\n .filter((childSection) => \"body\" in childSection)\n .map(\n (childSection) =>\n new SectionModel(childSection, this.entryDate, this.modelOptions),\n );\n }\n return this._childSections || [];\n }\n\n /**\n * set resolved child sections\n */\n set childSections(sections: Array<SectionModel>) {\n this._childSections = sections || [];\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection) => new SubSectionModel(subSection),\n )\n : [];\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n\n /**\n */\n getReferredSections(): Array<SubSectionModel | SectionModel> {\n const sections = [];\n\n for (const subSection of this.subSections) {\n if (subSection.referred) {\n sections.push(subSection);\n }\n\n const referredChilds = subSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n for (const childSection of this.childSections) {\n if (childSection.referred) {\n sections.push(childSection);\n }\n\n const referredChilds = childSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n return sections;\n }\n}\n\nexport default SectionModel;\n"],"mappings":";;;AACA,OAAOA,SAAS,MAAM,mBAAmB;AACzC,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,eAAe,MAAM,mBAAmB;AAE/C,SAASC,kBAAkB,QAAQ,gCAAgC;AACnE,OAAOC,SAAS,MAAM,oBAAoB;AAE1C,SAASC,YAAY,QAAQ,aAAa;AAK1C;AACA;AACA,MAAMC,YAAY,SAASN,SAAS,CAAC;EAKnCO,WAAWA,CACTC,IAAY,EACZC,SAA0B,EAC1BC,YAA2B,EAC3B;IACA,KAAK,CAACF,IAAI,EAAE,CAAC,CAAC,EAAEE,YAAY,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAE9B,IAAI,CAACC,UAAU,GAAGH,SAAS;EAC7B;;EAEA;AACF;EACE,IAAII,QAAQA,CAAA,EAAY;IACtB,OAAO,IAAI,CAACL,IAAI,CAACK,QAAQ;EAC3B;;EAEA;AACF;EACE,IAAIC,QAAQA,CAAA,EAAc;IACxB,IAAI,CAAC,IAAI,CAACC,SAAS,EAAE;MACnB,IAAI,CAACA,SAAS,GAAG,IAAIX,SAAS,CAC5B,IAAI,CAACI,IAAI,CAACQ,MAAM,EAAEC,IAAI,EACtB,IAAI,EACJ,IAAI,CAACP,YACP,CAAC;IACH;IACA,OAAO,IAAI,CAACK,SAAS;EACvB;;EAEA;AACF;EACE,IAAIG,QAAQA,CAAA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EACtC;;EAEA;AACF;AACA;EACE,IAAIC,WAAWA,CAAA,EAA2B;IAAA,IAAAC,SAAA;IACxC,OAAO,IAAI,CAACnC,IAAI,CAACkC,WAAW,GACxBV,oBAAA,CAAAW,SAAA,OAAI,CAACnC,IAAI,CAACkC,WAAW,EAAAT,IAAA,CAAAU,SAAA,EAClBC,UAAU,IAAK,IAAI1C,eAAe,CAAC0C,UAAU,CAChD,CAAC,GACD,EAAE;EACR;;EAEA;AACF;EACE,IAAIC,aAAaA,CAAA,EAAW;IAC1B,OAAO1C,kBAAkB,CAAC,IAAI,CAACe,QAAQ,CAAC;EAC1C;;EAEA;AACF;EACE4B,mBAAmBA,CAAA,EAA0C;IAC3D,MAAML,QAAQ,GAAG,EAAE;IAEnB,KAAK,MAAMG,UAAU,IAAI,IAAI,CAACF,WAAW,EAAE;MACzC,IAAIE,UAAU,CAAC/B,QAAQ,EAAE;QACvB4B,QAAQ,CAACM,IAAI,CAACH,UAAU,CAAC;MAC3B;MAEA,MAAMI,cAAc,GAAGJ,UAAU,CAACE,mBAAmB,CAAC,CAAC;MACvDL,QAAQ,CAACM,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,KAAK,MAAMd,YAAY,IAAI,IAAI,CAACH,aAAa,EAAE;MAC7C,IAAIG,YAAY,CAACrB,QAAQ,EAAE;QACzB4B,QAAQ,CAACM,IAAI,CAACb,YAAY,CAAC;MAC7B;MAEA,MAAMc,cAAc,GAAGd,YAAY,CAACY,mBAAmB,CAAC,CAAC;MACzDL,QAAQ,CAACM,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,OAAOP,QAAQ;EACjB;AACF;AAEA,eAAenC,YAAY","ignoreList":[]}
1
+ {"version":3,"file":"SectionModel.js","names":["BaseModel","ContentLinkModel","SubSectionModel","createHashFromHref","LinkModel","retrieveText","SectionModel","constructor","data","entryDate","modelOptions","_defineProperty","_entryDate","referred","selflink","_selflink","_links","self","selfhref","href","type","sourceLabel","id","_id","key","label","getData","number","body","childSectionLinks","_context","childSections","_mapInstanceProperty","call","childSection","section","selfContentLink","_childSections","_context2","_context3","_filterInstanceProperty","sections","subSections","_context4","subSection","referenceHash","getReferredSections","push","referredChilds"],"sources":["../../../src/models/content/SectionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport SubSectionModel from \"./SubSectionModel\";\n\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\nimport LinkModel from \"../links/LinkModel\";\n\nimport { retrieveText } from \"../../utils\";\n\nimport type Href from \"../href/Href\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n */\nclass SectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _selflink: ?LinkModel;\n _childSections: Array<SectionModel>;\n\n constructor(\n data: Object,\n entryDate: ISO_DATE | null,\n modelOptions?: ModelOptions,\n ) {\n super(data, {}, modelOptions);\n\n this._entryDate = entryDate;\n }\n\n /**\n */\n get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get selflink(): LinkModel {\n if (!this._selflink) {\n this._selflink = new LinkModel(\n this.data._links?.self,\n null,\n this.modelOptions,\n );\n }\n return this._selflink;\n }\n\n /**\n */\n get selfhref(): Href {\n return this.selflink.href;\n }\n\n /**\n */\n get entryDate(): ISO_DATE | null {\n return this._entryDate;\n }\n\n /**\n */\n get type(): string {\n return this.data.type;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this.data.sourceLabel;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n */\n get key(): string {\n return this.id;\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Get content body\n */\n get body(): ?string {\n return retrieveText(this.data.body);\n }\n\n /**\n * Retrieve child section links\n */\n get childSectionLinks(): Array<ContentLinkModel> {\n return this.data.childSections\n ? this.data.childSections.map(\n (childSection) =>\n new ContentLinkModel(\n {\n section: childSection.id || childSection._id,\n _id: childSection.id || childSection._id,\n label: childSection.label,\n sourceLabel: childSection.sourceLabel,\n _links: childSection._links,\n },\n this.entryDate,\n this.modelOptions,\n ),\n )\n : [];\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(\n {\n section: this.id,\n _id: this.id,\n label: this.data.label,\n sourceLabel: this.data.sourceLabel,\n _links: this.data._links,\n },\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n * Get tree of child sections\n */\n get childSections(): Array<SectionModel> {\n if (!this._childSections && this.data.childSections) {\n this._childSections = this.data.childSections\n .filter((childSection) => \"body\" in childSection)\n .map(\n (childSection) =>\n new SectionModel(childSection, this.entryDate, this.modelOptions),\n );\n }\n return this._childSections || [];\n }\n\n /**\n * set resolved child sections\n */\n set childSections(sections: Array<SectionModel>) {\n this._childSections = sections || [];\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection) =>\n new SubSectionModel(subSection, this.entryDate, this.modelOptions),\n )\n : [];\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n\n /**\n */\n getReferredSections(): Array<SubSectionModel | SectionModel> {\n const sections = [];\n\n for (const subSection of this.subSections) {\n if (subSection.referred) {\n sections.push(subSection);\n }\n\n const referredChilds = subSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n for (const childSection of this.childSections) {\n if (childSection.referred) {\n sections.push(childSection);\n }\n\n const referredChilds = childSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n return sections;\n }\n}\n\nexport default SectionModel;\n"],"mappings":";;;AACA,OAAOA,SAAS,MAAM,mBAAmB;AACzC,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,eAAe,MAAM,mBAAmB;AAE/C,SAASC,kBAAkB,QAAQ,gCAAgC;AACnE,OAAOC,SAAS,MA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,IAAI,CAACF,WAAW,EAAE;MACzC,IAAIE,UAAU,CAAC/B,QAAQ,EAAE;QACvB4B,QAAQ,CAACM,IAAI,CAACH,UAAU,CAAC;MAC3B;MAEA,MAAMI,cAAc,GAAGJ,UAAU,CAACE,mBAAmB,CAAC,CAAC;MACvDL,QAAQ,CAACM,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,KAAK,MAAMd,YAAY,IAAI,IAAI,CAACH,aAAa,EAAE;MAC7C,IAAIG,YAAY,CAACrB,QAAQ,EAAE;QACzB4B,QAAQ,CAACM,IAAI,CAACb,YAAY,CAAC;MAC7B;MAEA,MAAMc,cAAc,GAAGd,YAAY,CAACY,mBAAmB,CAAC,CAAC;MACzDL,QAAQ,CAACM,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,OAAOP,QAAQ;EACjB;AACF;AAEA,eAAenC,YAAY","ignoreList":[]}
@@ -7,16 +7,17 @@ import LinkCollection from "../links/LinkCollection";
7
7
  import Href from "../href/Href";
8
8
  import LinkModel from "../links/LinkModel";
9
9
  import { retrieveText } from "../../utils";
10
-
11
10
  /**
12
11
  * Link to a concept
13
12
  */
14
13
  export default class SubSectionModel extends BaseModel {
15
14
  /**
16
15
  */
17
- constructor(data) {
18
- super(data, {});
16
+ constructor(data, entryDate, modelOptions) {
17
+ super(data, {}, modelOptions);
18
+ _defineProperty(this, "_entryDate", void 0);
19
19
  _defineProperty(this, "_links", void 0);
20
+ this._entryDate = entryDate;
20
21
  }
21
22
 
22
23
  /**
@@ -65,7 +66,7 @@ export default class SubSectionModel extends BaseModel {
65
66
  */
66
67
  get subSections() {
67
68
  var _context;
68
- return this.data.subSections ? _mapInstanceProperty(_context = this.data.subSections).call(_context, subSection => new SubSectionModel(subSection)) : [];
69
+ return this.data.subSections ? _mapInstanceProperty(_context = this.data.subSections).call(_context, subSection => new SubSectionModel(subSection, this.entryDate, this.modelOptions)) : [];
69
70
  }
70
71
 
71
72
  /**
@@ -92,6 +93,12 @@ export default class SubSectionModel extends BaseModel {
92
93
  return this.selflink ? this.selflink.href : null;
93
94
  }
94
95
 
96
+ /**
97
+ */
98
+ get entryDate() {
99
+ return this._entryDate;
100
+ }
101
+
95
102
  /**
96
103
  */
97
104
  get relatedConceptsHrefs() {
@@ -121,6 +128,7 @@ export default class SubSectionModel extends BaseModel {
121
128
  href.path = firstPart + "/" + href.hash;
122
129
  href.hash = _includesInstanceProperty(_context3 = href.hash).call(_context3, "#") ? href.hash.substring(href.hash.indexOf("#")) : "";
123
130
  }
131
+ href.addParameter("entryDate", this.entryDate);
124
132
  href.setReferenceHash(this.referenceHash);
125
133
  return href;
126
134
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SubSectionModel.js","names":["createHashFromHref","BaseModel","LinkCollection","Href","LinkModel","retrieveText","SubSectionModel","constructor","data","_defineProperty","referred","id","_id","key","body","getData","number","label","subSections","_context","_mapInstanceProperty","call","subSection","links","_links","contributions","selflink","getLinkByKey","selfhref","href","relatedConceptsHrefs","hrefs","relatedConceptsHref","push","forEach","relatedConceptsLink","_context2","_includesInstanceProperty","hash","_context3","firstPart","path","substring","lastIndexOf","indexOf","setReferenceHash","referenceHash","getReferredSections","sections","referredChilds"],"sources":["../../../src/models/content/SubSectionModel.js"],"sourcesContent":["// @flow\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport LinkCollection from \"../links/LinkCollection\";\nimport Href from \"../href/Href\";\nimport LinkModel from \"../links/LinkModel\";\nimport { retrieveText } from \"../../utils\";\n\n/**\n * Link to a concept\n */\nexport default class SubSectionModel extends BaseModel {\n _links: LinkCollection;\n\n /**\n */\n constructor(data: Object) {\n super(data, {});\n }\n\n /**\n */\n get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n * Retrieve key of subsection\n */\n get key(): ?string {\n return this.id;\n }\n\n /**\n * Retrieve html body\n */\n get body(): string {\n const body = this.getData(\"body\", \"\");\n return retrieveText(body);\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Retrieve label of section\n */\n get label(): ?string {\n return this.data.label;\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection) => new SubSectionModel(subSection),\n )\n : [];\n }\n\n /**\n * Retrieve links of section\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n this.data._links,\n this.contributions._links,\n );\n }\n\n return this._links;\n }\n\n /**\n * Get self link of model\n */\n get selflink(): LinkModel | null {\n return this.links.getLinkByKey(\"self\");\n }\n\n /**\n * Return default self link of resource\n */\n get selfhref(): Href | null {\n return this.selflink ? this.selflink.href : null;\n }\n\n /**\n */\n get relatedConceptsHrefs(): Array<Href> {\n const hrefs = [];\n if (this.relatedConceptsHref) {\n hrefs.push(this.relatedConceptsHref);\n }\n\n this.subSections.forEach((subSection) => {\n hrefs.push(...subSection.relatedConceptsHrefs);\n });\n\n return hrefs;\n }\n\n /**\n * Get related concepts link\n */\n get relatedConceptsHref(): Href | null {\n const relatedConceptsLink = this.links.getLinkByKey(\"relatedConcepts\");\n\n if (relatedConceptsLink) {\n const { href } = relatedConceptsLink;\n\n if (href.hash.includes(\"/relatedConcepts\")) {\n const firstPart = href.path.substring(0, href.path.lastIndexOf(\"/\"));\n href.path = firstPart + \"/\" + href.hash;\n href.hash = href.hash.includes(\"#\")\n ? href.hash.substring(href.hash.indexOf(\"#\"))\n : \"\";\n }\n\n href.setReferenceHash(this.referenceHash);\n return href;\n }\n\n return null;\n }\n\n /**\n */\n get referenceHash(): number {\n const selfhref = this.selfhref || new Href();\n return createHashFromHref(selfhref);\n }\n\n /**\n */\n getReferredSections(): Array<SubSectionModel> {\n const sections = [];\n\n for (const subSection of this.subSections) {\n if (subSection.referred) {\n sections.push(subSection);\n }\n\n const referredChilds = subSection.getReferredSections();\n sections.push(...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reList":[]}
1
+ {"version":3,"file":"SubSectionModel.js","names":["createHashFromHref","BaseModel","LinkCollection","Href","LinkModel","retrieveText","SubSectionModel","constructor","data","entryDate","modelOptions","_defineProperty","_entryDate","referred","id","_id","key","body","getData","number","label","subSections","_context","_mapInstanceProperty","call","subSection","links","_links","contributions","selflink","getLinkByKey","selfhref","href","relatedConceptsHrefs","hrefs","relatedConceptsHref","push","forEach","relatedConceptsLink","_context2","_includesInstanceProperty","hash","_context3","firstPart","path","substring","lastIndexOf","indexOf","addParameter","setReferenceHash","referenceHash","getReferredSections","sections","referredChilds"],"sources":["../../../src/models/content/SubSectionModel.js"],"sourcesContent":["// @flow\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport LinkCollection from \"../links/LinkCollection\";\nimport Href from \"../href/Href\";\nimport LinkModel from \"../links/LinkModel\";\nimport { retrieveText } from \"../../utils\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n * Link to a concept\n */\nexport default class SubSectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _links: LinkCollection;\n\n /**\n */\n constructor(\n data: Object,\n entryDate: ISO_DATE | null,\n modelOptions?: ModelOptions,\n ) {\n super(data, {}, modelOptions);\n\n this._entryDate = entryDate;\n }\n\n /**\n */\n get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n * Retrieve key of subsection\n */\n get key(): ?string {\n return this.id;\n }\n\n /**\n * Retrieve html body\n */\n get body(): string {\n const body = this.getData(\"body\", \"\");\n return retrieveText(body);\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Retrieve label of section\n */\n get label(): ?string {\n return this.data.label;\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection) =>\n new SubSectionModel(subSection, this.entryDate, this.modelOptions),\n )\n : [];\n }\n\n /**\n * Retrieve links of section\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n this.data._links,\n this.contributions._links,\n );\n }\n\n return this._links;\n }\n\n /**\n * Get self link of model\n */\n get selflink(): LinkModel | null {\n return this.links.getLinkByKey(\"self\");\n }\n\n /**\n * Return default self link of resource\n */\n get selfhref(): Href | null {\n return this.selflink ? this.selflink.href : null;\n }\n\n /**\n */\n get entryDate(): ISO_DATE | null {\n return this._entryDate;\n }\n\n /**\n */\n get relatedConceptsHrefs(): Array<Href> {\n const hrefs = [];\n if (this.relatedConceptsHref) {\n hrefs.push(this.relatedConceptsHref);\n }\n\n this.subSections.forEach((subSection) => {\n hrefs.push(...subSection.relatedConceptsHrefs);\n });\n\n return hrefs;\n }\n\n /**\n * Get related concepts link\n */\n get relatedConceptsHref(): Href | null {\n const relatedConceptsLink = this.links.getLinkByKey(\"relatedConcepts\");\n\n if (relatedConceptsLink) {\n const { href } = relatedConceptsLink;\n\n if (href.hash.includes(\"/relatedConcepts\")) {\n const firstPart = href.path.substring(0, href.path.lastIndexOf(\"/\"));\n href.path = firstPart + \"/\" + href.hash;\n href.hash = href.hash.includes(\"#\")\n ? href.hash.substring(href.hash.indexOf(\"#\"))\n : \"\";\n }\n\n href.addParameter(\"entryDate\", this.entryDate);\n href.setReferenceHash(this.referenceHash);\n\n return href;\n }\n\n return null;\n }\n\n /**\n */\n get referenceHash(): number {\n const selfhref = this.selfhref || new Href();\n return createHashFromHref(selfhref);\n }\n\n /**\n */\n getReferredSections(): Array<SubSectionModel> {\n const sections = [];\n\n for (const subSection of this.subSections) {\n if (subSection.referred) {\n sections.push(subSection);\n }\n\n const referredChilds = subSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n return sections;\n }\n}\n"],"mappings":";;;AACA,SAASA,kBAAkB,QAAQ,gCAAgC;AAEnE,OAAOC,SAAS,MAAM,mBAAmB;AACzC,OAAOC,cAAc,MAAM,yBAAyB;AACpD,OAAOC,IAAI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GAAG5B,UAAU,CAAC0B,mBAAmB,CAAC,CAAC;MACvDC,QAAQ,CAAChB,IAAI,CAAC,GAAGiB,cAAc,CAAC;IAClC;IAEA,OAAOD,QAAQ;EACjB;AACF","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,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;AAExE,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,YAAY,QAAQ,yBAAyB;AAEtD,SAASC,cAAc,EAAEC,OAAO,QAAQ,gCAAgC;AAExE,SAASC,kBAAkB,EAAEC,cAAc,QAAQ,eAAe;AAElE,SAASC,IAAI,QAAQ,QAAQ;AAE7B,SAASC,uBAAuB,QAAQ,kCAAkC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AA2B3E;AACA;AACA;AACA,MAAMC,eAAe,GAAIC,IAAY,IAAK;EACxC,IAAI;IACF,OAAOC,IAAI,CAACC,KAAK,CAACF,IAAI,CAAC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AC;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,oBAA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ate => ({
5
5
  type: "UPDATE_ENTRYDATE",
6
6
  payload: entryDate
7
7
  });
8
- //# sourceMappingURL=EntryDate.js.map
8
+ //# sourceMappingURL=ModelCatalog.js.map
@@ -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,6 +1,6 @@
1
1
  export * from "./Application";
2
2
  export * from "./Authorization";
3
- export * from "./EntryDate";
3
+ export * from "./ModelCatalog";
4
4
  export * from "./Error";
5
5
  export * from "./Form";
6
6
  export * from "./FormAttributeSet";
@@ -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 \"./EntryDate\";\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,aAAa;AAC3B,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
+ {"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: typeof window !== "undefined" ? new _URLSearchParams(window.location?.search).get("entryDate") || Cache.getItem("ModelCatalogEntryDate") || DateUtil.now() : null
4
+ entryDate: DateUtil.now()
6
5
  };
7
6
 
8
7
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ModelCatalogReducer.js","names":["DateUtil","Cache","initialState","entryDate","window","_URLSearchParams","location","search","get","getItem","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:\n typeof window !== \"undefined\"\n ? new URLSearchParams(window.location?.search).get(\"entryDate\") ||\n Cache.getItem(\"ModelCatalogEntryDate\") ||\n DateUtil.now()\n : null,\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,EACP,OAAOC,MAAM,KAAK,WAAW,GACzB,IAAAC,gBAAA,CAAoBD,MAAM,CAACE,QAAQ,EAAEC,MAAM,CAAC,CAACC,GAAG,CAAC,WAAW,CAAC,IAC7DP,KAAK,CAACQ,OAAO,CAAC,uBAAuB,CAAC,IACtCT,QAAQ,CAACU,GAAG,CAAC,CAAC,GACd;AACR,CAAC;;AAED;AACA;AACA;AACA,MAAMC,mBAA4D,GAAG,SAAAA,CAAA,EAGhE;EAAA,IAFHC,KAAK,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGX,YAAY;EAAA,IACpBc,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;MACrBhB,KAAK,CAACiB,OAAO,CAAC,uBAAuB,EAAEF,MAAM,CAACG,OAAO,CAAC;MACtD,OAAO;QACL,GAAGP,KAAK;QACRT,SAAS,EAAEa,MAAM,CAACG;MACpB,CAAC;IACH;MACE,OAAOP,KAAK;EAChB;AACF,CAAC;AAED,eAAeD,mBAAmB","ignoreList":[]}
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 _EntryDate = require("../redux/actions/EntryDate");
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, _EntryDate.updateEntryDate)(entryDate))
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/EntryDate";
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,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,UAAA,GAAAd,OAAA;AAaA;AACA;AACO,MAAMe,eAAe,GAC1BC,OAAqD,IAErD,IAAAC,oCAAiB,EAAC,cAAc,EAAE,eAAe,EAAE;EACjDC,cAAc,EAAE,CAAC,cAAc,CAAC;EAChCC,WAAW,EAAEC,0BAAiB;EAC9B,GAAGJ;AACL,CAAC,CAAC;;AAEJ;AACA;AADAK,OAAA,CAAAN,eAAA,GAAAA,eAAA;AAEO,MAAMO,eAAe,GAAG,SAAAA,CAC7BC,IAAmB,EAGI;EAAA,IAFvBC,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,cAAc;EAAA,IAC7BT,OAAqD,GAAAS,SAAA,CAAAC,M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AAqD,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,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,IAA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{
148
148
  var _context4;
149
- return this.data.subSections ? (0, _map.default)(_context4 = this.data.subSections).call(_context4, subSection => new _SubSectionModel.default(subSection)) : [];
149
+ return this.data.subSections ? (0, _map.default)(_context4 = this.data.subSections).call(_context4, subSection => new _SubSectionModel.default(subSection, this.entryDate, this.modelOptions)) : [];
150
150
  }
151
151
 
152
152
  /**
@@ -170,7 +170,8 @@ class SectionModel extends BaseModel {
170
170
  get subSections(): Array<SubSectionModel> {
171
171
  return this.data.subSections
172
172
  ? this.data.subSections.map(
173
- (subSection) => new SubSectionModel(subSection),
173
+ (subSection) =>
174
+ new SubSectionModel(subSection, this.entryDate, this.modelOptions),
174
175
  )
175
176
  : [];
176
177
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SectionModel.js","names":["_BaseModel","_interopRequireDefault","require","_ContentLinkModel","_SubSectionModel","_createHash","_LinkModel","_utils","SectionModel","BaseModel","constructor","data","entryDate","modelOptions","_defineProperty2","default","_entryDate","referred","selflink","_selflink","LinkModel","_links","self","selfhref","href","type","sourceLabel","id","_id","key","label","getData","number","body","retrieveText","childSectionLinks","_context","childSections","_map","call","childSection","ContentLinkModel","section","selfContentLink","_childSections","_context2","_context3","_filter","sections","subSections","_context4","subSection","SubSectionModel","referenceHash","createHashFromHref","getReferredSections","push","referredChilds","_default","exports"],"sources":["../../../src/models/content/SectionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport SubSectionModel from \"./SubSectionModel\";\n\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\nimport LinkModel from \"../links/LinkModel\";\n\nimport { retrieveText } from \"../../utils\";\n\nimport type Href from \"../href/Href\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n */\nclass SectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _selflink: ?LinkModel;\n _childSections: Array<SectionModel>;\n\n constructor(\n data: Object,\n entryDate: ISO_DATE | null,\n modelOptions?: ModelOptions,\n ) {\n super(data, {}, modelOptions);\n\n this._entryDate = entryDate;\n }\n\n /**\n */\n get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get selflink(): LinkModel {\n if (!this._selflink) {\n this._selflink = new LinkModel(\n this.data._links?.self,\n null,\n this.modelOptions,\n );\n }\n return this._selflink;\n }\n\n /**\n */\n get selfhref(): Href {\n return this.selflink.href;\n }\n\n /**\n */\n get entryDate(): ISO_DATE | null {\n return this._entryDate;\n }\n\n /**\n */\n get type(): string {\n return this.data.type;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this.data.sourceLabel;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n */\n get key(): string {\n return this.id;\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Get content body\n */\n get body(): ?string {\n return retrieveText(this.data.body);\n }\n\n /**\n * Retrieve child section links\n */\n get childSectionLinks(): Array<ContentLinkModel> {\n return this.data.childSections\n ? this.data.childSections.map(\n (childSection) =>\n new ContentLinkModel(\n {\n section: childSection.id || childSection._id,\n _id: childSection.id || childSection._id,\n label: childSection.label,\n sourceLabel: childSection.sourceLabel,\n _links: childSection._links,\n },\n this.entryDate,\n this.modelOptions,\n ),\n )\n : [];\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(\n {\n section: this.id,\n _id: this.id,\n label: this.data.label,\n sourceLabel: this.data.sourceLabel,\n _links: this.data._links,\n },\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n * Get tree of child sections\n */\n get childSections(): Array<SectionModel> {\n if (!this._childSections && this.data.childSections) {\n this._childSections = this.data.childSections\n .filter((childSection) => \"body\" in childSection)\n .map(\n (childSection) =>\n new SectionModel(childSection, this.entryDate, this.modelOptions),\n );\n }\n return this._childSections || [];\n }\n\n /**\n * set resolved child sections\n */\n set childSections(sections: Array<SectionModel>) {\n this._childSections = sections || [];\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection) => new SubSectionModel(subSection),\n )\n : [];\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n\n /**\n */\n getReferredSections(): Array<SubSectionModel | SectionModel> {\n const sections = [];\n\n for (const subSection of this.subSections) {\n if (subSection.referred) {\n sections.push(subSection);\n }\n\n const referredChilds = subSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n for (const childSection of this.childSections) {\n if (childSection.referred) {\n sections.push(childSection);\n }\n\n const referredChilds = childSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n return sections;\n }\n}\n\nexport default SectionModel;\n"],"mappings":";;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,gBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAL,sBAAA,CAAAC,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AAKA;AACA;AACA,MAAMM,YAAY,SAASC,kBAAS,CAAC;EAKnCC,WAAWA,CACTC,IAAY,EACZC,SAA0B,EAC1BC,YAA2B,EAC3B;IACA,KAAK,CAACF,IAAI,EAAE,CAAC,CAAC,EAAEE,YAAY,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAE9B,IAAI,CAACC,UAAU,GAAGJ,SAAS;EAC7B;;EAEA;AACF;EACE,IAAIK,QAAQA,CAAA,EAAY;IACtB,OAAO,IAAI,CAACN,IAAI,CAACM,QAAQ;EAC3B;;EAEA;AACF;EACE,IAAIC,QAAQA,CAAA,EAAc;IACxB,IAAI,CAAC,IAA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B,YAAY,CAACe,mBAAmB,CAAC,CAAC;MACzDP,QAAQ,CAACQ,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,OAAOT,QAAQ;EACjB;AACF;AAAC,IAAAU,QAAA,GAAAC,OAAA,CAAA5C,OAAA,GAEcP,YAAY","ignoreList":[]}
1
+ {"version":3,"file":"SectionModel.js","names":["_BaseModel","_interopRequireDefault","require","_ContentLinkModel","_SubSectionModel","_createHash","_LinkModel","_utils","SectionModel","BaseModel","constructor","data","entryDate","modelOptions","_defineProperty2","default","_entryDate","referred","selflink","_selflink","LinkModel","_links","self","selfhref","href","type","sourceLabel","id","_id","key","label","getData","number","body","retrieveText","childSectionLinks","_context","childSections","_map","call","childSection","ContentLinkModel","section","selfContentLink","_childSections","_context2","_context3","_filter","sections","subSections","_context4","subSection","SubSectionModel","referenceHash","createHashFromHref","getReferredSections","push","referredChilds","_default","exports"],"sources":["../../../src/models/content/SectionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport SubSectionModel from \"./SubSectionModel\";\n\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\nimport LinkModel from \"../links/LinkModel\";\n\nimport { retrieveText } from \"../../utils\";\n\nimport type Href from \"../href/Href\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n */\nclass SectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _selflink: ?LinkModel;\n _childSections: Array<SectionModel>;\n\n constructor(\n data: Object,\n entryDate: ISO_DATE | null,\n modelOptions?: ModelOptions,\n ) {\n super(data, {}, modelOptions);\n\n this._entryDate = entryDate;\n }\n\n /**\n */\n get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get selflink(): LinkModel {\n if (!this._selflink) {\n this._selflink = new LinkModel(\n this.data._links?.self,\n null,\n this.modelOptions,\n );\n }\n return this._selflink;\n }\n\n /**\n */\n get selfhref(): Href {\n return this.selflink.href;\n }\n\n /**\n */\n get entryDate(): ISO_DATE | null {\n return this._entryDate;\n }\n\n /**\n */\n get type(): string {\n return this.data.type;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this.data.sourceLabel;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n */\n get key(): string {\n return this.id;\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Get content body\n */\n get body(): ?string {\n return retrieveText(this.data.body);\n }\n\n /**\n * Retrieve child section links\n */\n get childSectionLinks(): Array<ContentLinkModel> {\n return this.data.childSections\n ? this.data.childSections.map(\n (childSection) =>\n new ContentLinkModel(\n {\n section: childSection.id || childSection._id,\n _id: childSection.id || childSection._id,\n label: childSection.label,\n sourceLabel: childSection.sourceLabel,\n _links: childSection._links,\n },\n this.entryDate,\n this.modelOptions,\n ),\n )\n : [];\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(\n {\n section: this.id,\n _id: this.id,\n label: this.data.label,\n sourceLabel: this.data.sourceLabel,\n _links: this.data._links,\n },\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n * Get tree of child sections\n */\n get childSections(): Array<SectionModel> {\n if (!this._childSections && this.data.childSections) {\n this._childSections = this.data.childSections\n .filter((childSection) => \"body\" in childSection)\n .map(\n (childSection) =>\n new SectionModel(childSection, this.entryDate, this.modelOptions),\n );\n }\n return this._childSections || [];\n }\n\n /**\n * set resolved child sections\n */\n set childSections(sections: Array<SectionModel>) {\n this._childSections = sections || [];\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection) =>\n new SubSectionModel(subSection, this.entryDate, this.modelOptions),\n )\n : [];\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n\n /**\n */\n getReferredSections(): Array<SubSectionModel | SectionModel> {\n const sections = [];\n\n for (const subSection of this.subSections) {\n if (subSection.referred) {\n sections.push(subSection);\n }\n\n const referredChilds = subSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n for (const childSection of this.childSections) {\n if (childSection.referred) {\n sections.push(childSection);\n }\n\n const referredChilds = childSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n return sections;\n }\n}\n\nexport default SectionModel;\n"],"mappings":";;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,gBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAL,sBAAA,CAAAC,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AAKA;AACA;AACA,MAAMM,YAAY,SAASC,kBAAS,CAAC;EAKnCC,WAAWA,CACTC,IAAY,EACZC,SAA0B,EAC1BC,YAA2B,EAC3B;IACA,KAAK,CAACF,IAAI,EAAE,CAAC,CAAC,EAAEE,YAAY,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAE9B,IAAI,CAACC,UAAU,GAAGJ,SAAS;EAC7B;;EAEA;AACF;EACE,IAAIK,QAAQA,CAAA,EAAY;IACtB,OAAO,IAAI,CAACN,IAAI,CAACM,QAAQ;EAC3B;;EAEA;AACF;EACE,IAAIC,QAAQA,CAAA,EAAc;IACxB,IAAI,CAAC,IAAI,CAACC,SAAS,EAAE;MACnB,IAAI,CAACA,SAAS,GAAG,IAAIC,kBAAS,CAC5B,IAAI,CAACT,IAAI,CAACU,MAAM,EAAEC,IAAI,EACtB,IAAI,EACJ,IAAI,CAACT,YACP,CAAC;IACH;IACA,OAAO,IAAI,CAACM,SAAS;EACvB;;EAEA;AACF;EACE,IAAII,QAAQA,C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