@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.
- package/CHANGELOG.md +14 -0
- package/esm/hooks/useModelCatalog.js +1 -1
- package/esm/hooks/useModelCatalog.js.map +1 -1
- package/esm/models/content/SectionModel.js +1 -1
- package/esm/models/content/SectionModel.js.map +1 -1
- package/esm/models/content/SubSectionModel.js +12 -4
- package/esm/models/content/SubSectionModel.js.map +1 -1
- package/esm/react-client/client.js +15 -0
- package/esm/react-client/client.js.map +1 -1
- package/esm/redux/actions/{EntryDate.js → ModelCatalog.js} +1 -1
- package/esm/redux/actions/ModelCatalog.js.map +1 -0
- package/esm/redux/actions/index.js +1 -1
- package/esm/redux/actions/index.js.map +1 -1
- package/esm/redux/reducers/ModelCatalogReducer.js +1 -2
- package/esm/redux/reducers/ModelCatalogReducer.js.map +1 -1
- package/lib/hooks/useModelCatalog.js +2 -2
- package/lib/hooks/useModelCatalog.js.flow +1 -1
- package/lib/hooks/useModelCatalog.js.map +1 -1
- package/lib/models/content/SectionModel.js +1 -1
- package/lib/models/content/SectionModel.js.flow +2 -1
- package/lib/models/content/SectionModel.js.map +1 -1
- package/lib/models/content/SubSectionModel.js +12 -3
- package/lib/models/content/SubSectionModel.js.flow +20 -3
- package/lib/models/content/SubSectionModel.js.map +1 -1
- package/lib/models/content/__tests__/ContentModel.spec.js.flow +3 -3
- package/lib/react-client/client.js +17 -1
- package/lib/react-client/client.js.flow +17 -1
- package/lib/react-client/client.js.map +1 -1
- package/lib/redux/actions/{EntryDate.js → ModelCatalog.js} +1 -1
- package/lib/redux/actions/ModelCatalog.js.map +1 -0
- package/lib/redux/actions/index.js +4 -4
- package/lib/redux/actions/index.js.flow +1 -1
- package/lib/redux/actions/index.js.map +1 -1
- package/lib/redux/reducers/ModelCatalogReducer.js +1 -2
- package/lib/redux/reducers/ModelCatalogReducer.js.flow +1 -6
- package/lib/redux/reducers/ModelCatalogReducer.js.map +1 -1
- package/package.json +2 -2
- package/src/hooks/useModelCatalog.js +1 -1
- package/src/models/content/SectionModel.js +2 -1
- package/src/models/content/SubSectionModel.js +20 -3
- package/src/models/content/__tests__/ContentModel.spec.js +3 -3
- package/src/react-client/client.js +17 -1
- package/src/redux/actions/index.js +1 -1
- package/src/redux/reducers/ModelCatalogReducer.js +1 -6
- package/esm/redux/actions/EntryDate.js.map +0 -1
- package/lib/redux/actions/EntryDate.js.map +0 -1
- /package/lib/redux/actions/{EntryDate.js.flow → ModelCatalog.js.flow} +0 -0
- /package/src/redux/actions/{EntryDate.js → ModelCatalog.js} +0 -0
|
@@ -20,9 +20,11 @@ var _utils = require("../../utils");
|
|
|
20
20
|
class SubSectionModel extends _BaseModel.default {
|
|
21
21
|
/**
|
|
22
22
|
*/
|
|
23
|
-
constructor(data) {
|
|
24
|
-
super(data, {});
|
|
23
|
+
constructor(data, entryDate, modelOptions) {
|
|
24
|
+
super(data, {}, modelOptions);
|
|
25
|
+
(0, _defineProperty2.default)(this, "_entryDate", void 0);
|
|
25
26
|
(0, _defineProperty2.default)(this, "_links", void 0);
|
|
27
|
+
this._entryDate = entryDate;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
/**
|
|
@@ -71,7 +73,7 @@ class SubSectionModel extends _BaseModel.default {
|
|
|
71
73
|
*/
|
|
72
74
|
get subSections() {
|
|
73
75
|
var _context;
|
|
74
|
-
return this.data.subSections ? (0, _map.default)(_context = this.data.subSections).call(_context, subSection => new SubSectionModel(subSection)) : [];
|
|
76
|
+
return this.data.subSections ? (0, _map.default)(_context = this.data.subSections).call(_context, subSection => new SubSectionModel(subSection, this.entryDate, this.modelOptions)) : [];
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
/**
|
|
@@ -98,6 +100,12 @@ class SubSectionModel extends _BaseModel.default {
|
|
|
98
100
|
return this.selflink ? this.selflink.href : null;
|
|
99
101
|
}
|
|
100
102
|
|
|
103
|
+
/**
|
|
104
|
+
*/
|
|
105
|
+
get entryDate() {
|
|
106
|
+
return this._entryDate;
|
|
107
|
+
}
|
|
108
|
+
|
|
101
109
|
/**
|
|
102
110
|
*/
|
|
103
111
|
get relatedConceptsHrefs() {
|
|
@@ -127,6 +135,7 @@ class SubSectionModel extends _BaseModel.default {
|
|
|
127
135
|
href.path = firstPart + "/" + href.hash;
|
|
128
136
|
href.hash = (0, _includes.default)(_context3 = href.hash).call(_context3, "#") ? href.hash.substring(href.hash.indexOf("#")) : "";
|
|
129
137
|
}
|
|
138
|
+
href.addParameter("entryDate", this.entryDate);
|
|
130
139
|
href.setReferenceHash(this.referenceHash);
|
|
131
140
|
return href;
|
|
132
141
|
}
|
|
@@ -6,17 +6,25 @@ import LinkCollection from "../links/LinkCollection";
|
|
|
6
6
|
import Href from "../href/Href";
|
|
7
7
|
import LinkModel from "../links/LinkModel";
|
|
8
8
|
import { retrieveText } from "../../utils";
|
|
9
|
+
import type { ModelOptions } from "../types";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Link to a concept
|
|
12
13
|
*/
|
|
13
14
|
export default class SubSectionModel extends BaseModel {
|
|
15
|
+
_entryDate: ISO_DATE | null;
|
|
14
16
|
_links: LinkCollection;
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
*/
|
|
18
|
-
constructor(
|
|
19
|
-
|
|
20
|
+
constructor(
|
|
21
|
+
data: Object,
|
|
22
|
+
entryDate: ISO_DATE | null,
|
|
23
|
+
modelOptions?: ModelOptions,
|
|
24
|
+
) {
|
|
25
|
+
super(data, {}, modelOptions);
|
|
26
|
+
|
|
27
|
+
this._entryDate = entryDate;
|
|
20
28
|
}
|
|
21
29
|
|
|
22
30
|
/**
|
|
@@ -66,7 +74,8 @@ export default class SubSectionModel extends BaseModel {
|
|
|
66
74
|
get subSections(): Array<SubSectionModel> {
|
|
67
75
|
return this.data.subSections
|
|
68
76
|
? this.data.subSections.map(
|
|
69
|
-
(subSection) =>
|
|
77
|
+
(subSection) =>
|
|
78
|
+
new SubSectionModel(subSection, this.entryDate, this.modelOptions),
|
|
70
79
|
)
|
|
71
80
|
: [];
|
|
72
81
|
}
|
|
@@ -99,6 +108,12 @@ export default class SubSectionModel extends BaseModel {
|
|
|
99
108
|
return this.selflink ? this.selflink.href : null;
|
|
100
109
|
}
|
|
101
110
|
|
|
111
|
+
/**
|
|
112
|
+
*/
|
|
113
|
+
get entryDate(): ISO_DATE | null {
|
|
114
|
+
return this._entryDate;
|
|
115
|
+
}
|
|
116
|
+
|
|
102
117
|
/**
|
|
103
118
|
*/
|
|
104
119
|
get relatedConceptsHrefs(): Array<Href> {
|
|
@@ -131,7 +146,9 @@ export default class SubSectionModel extends BaseModel {
|
|
|
131
146
|
: "";
|
|
132
147
|
}
|
|
133
148
|
|
|
149
|
+
href.addParameter("entryDate", this.entryDate);
|
|
134
150
|
href.setReferenceHash(this.referenceHash);
|
|
151
|
+
|
|
135
152
|
return href;
|
|
136
153
|
}
|
|
137
154
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubSectionModel.js","names":["_createHash","require","_BaseModel","_interopRequireDefault","_LinkCollection","_Href","_LinkModel","_utils","SubSectionModel","BaseModel","constructor","data","_defineProperty2","default","referred","id","_id","key","body","getData","retrieveText","number","label","subSections","_context","_map","call","subSection","links","_links","LinkCollection","contributions","selflink","getLinkByKey","selfhref","href","relatedConceptsHrefs","hrefs","relatedConceptsHref","push","forEach","relatedConceptsLink","_context2","_includes","hash","_context3","firstPart","path","substring","lastIndexOf","indexOf","setReferenceHash","referenceHash","Href","createHashFromHref","getReferredSections","sections","referredChilds","exports"],"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)
|
|
1
|
+
{"version":3,"file":"SubSectionModel.js","names":["_createHash","require","_BaseModel","_interopRequireDefault","_LinkCollection","_Href","_LinkModel","_utils","SubSectionModel","BaseModel","constructor","data","entryDate","modelOptions","_defineProperty2","default","_entryDate","referred","id","_id","key","body","getData","retrieveText","number","label","subSections","_context","_map","call","subSection","links","_links","LinkCollection","contributions","selflink","getLinkByKey","selfhref","href","relatedConceptsHrefs","hrefs","relatedConceptsHref","push","forEach","relatedConceptsLink","_context2","_includes","hash","_context3","firstPart","path","substring","lastIndexOf","indexOf","addParameter","setReferenceHash","referenceHash","Href","createHashFromHref","getReferredSections","sections","referredChilds","exports"],"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,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,eAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,KAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,UAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAGA;AACA;AACA;AACe,MAAMO,eAAe,SAASC,kBAAS,CAAC;EAIrD;AACF;EACEC,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;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,EAAEA,CAAA,EAAW;IACf,OAAO,IAAI,CAACP,IAAI,CAACO,EAAE,IAAI,IAAI,CAACP,IAAI,CAACQ,GAAG;EACtC;;EAEA;AACF;AACA;EACE,IAAIC,GAAGA,CAAA,EAAY;IACjB,OAAO,IAAI,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,CAACS,IAAI,CAACM,OAAO,CAAC,GAAG,CAAC,CAAC,GAC3C,EAAE;MACR;MAEAf,IAAI,CAACgB,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC1C,SAAS,CAAC;MAC9C0B,IAAI,CAACiB,gBAAgB,CAAC,IAAI,CAACC,aAAa,CAAC;MAEzC,OAAOlB,IAAI;IACb;IAEA,OAAO,IAAI;EACb;;EAEA;AACF;EACE,IAAIkB,aAAaA,CAAA,EAAW;IAC1B,MAAMnB,QAAQ,GAAG,IAAI,CAACA,QAAQ,IAAI,IAAIoB,aAAI,CAAC,CAAC;IAC5C,OAAO,IAAAC,8BAAkB,EAACrB,QAAQ,CAAC;EACrC;;EAEA;AACF;EACEsB,mBAAmBA,CAAA,EAA2B;IAC5C,MAAMC,QAAQ,GAAG,EAAE;IAEnB,KAAK,MAAM9B,UAAU,IAAI,IAAI,CAACJ,WAAW,EAAE;MACzC,IAAII,UAAU,CAACb,QAAQ,EAAE;QACvB2C,QAAQ,CAAClB,IAAI,CAACZ,UAAU,CAAC;MAC3B;MAEA,MAAM+B,cAAc,GAAG/B,UAAU,CAAC6B,mBAAmB,CAAC,CAAC;MACvDC,QAAQ,CAAClB,IAAI,CAAC,GAAGmB,cAAc,CAAC;IAClC;IAEA,OAAOD,QAAQ;EACjB;AACF;AAACE,OAAA,CAAA/C,OAAA,GAAAP,eAAA","ignoreList":[]}
|
|
@@ -133,10 +133,10 @@ describe("contentmodel", () => {
|
|
|
133
133
|
"/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1/relatedConcepts?entryDate=2024-07-17",
|
|
134
134
|
);
|
|
135
135
|
expect(contentModel.relatedConceptsHrefs[1].toString()).toBe(
|
|
136
|
-
"/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1a/relatedConcepts",
|
|
136
|
+
"/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1a/relatedConcepts?entryDate=2024-07-17",
|
|
137
137
|
);
|
|
138
138
|
expect(contentModel.relatedConceptsHrefs[2].toString()).toBe(
|
|
139
|
-
"/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1b/relatedConcepts",
|
|
139
|
+
"/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1b/relatedConcepts?entryDate=2024-07-17",
|
|
140
140
|
);
|
|
141
141
|
});
|
|
142
142
|
|
|
@@ -196,7 +196,7 @@ describe("contentmodel", () => {
|
|
|
196
196
|
);
|
|
197
197
|
expect(firstSubSection.relatedConceptsHrefs).toHaveLength(1);
|
|
198
198
|
expect(firstSubSection.relatedConceptsHref.href.toString()).toBe(
|
|
199
|
-
"/content/Incident/Business design/Content/Blaastest subsections.formalsource/Pass/relatedConcepts",
|
|
199
|
+
"/content/Incident/Business design/Content/Blaastest subsections.formalsource/Pass/relatedConcepts?entryDate=2021-08-31",
|
|
200
200
|
);
|
|
201
201
|
expect(firstSubSection.relatedConceptsHref.getReferenceHash()).toBe(
|
|
202
202
|
145842294,
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.setupClient = exports.setUnhandledRejectionEvent = exports.client = exports.addContentLoadedEvent = void 0;
|
|
7
|
+
exports.setupClient = exports.setUnhandledRejectionEvent = exports.setModelCatalogEntryDate = exports.client = exports.addContentLoadedEvent = void 0;
|
|
8
8
|
var _trim = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/trim"));
|
|
9
9
|
var _urlSearchParams = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/url-search-params"));
|
|
10
10
|
var _reactDom = require("react-dom");
|
|
@@ -20,6 +20,7 @@ var _Preferences = require("../redux/actions/Preferences");
|
|
|
20
20
|
var _Notification = require("../redux/actions/Notification");
|
|
21
21
|
var _Error = require("../redux/actions/Error");
|
|
22
22
|
var _SignIn = require("../redux/actions/SignIn");
|
|
23
|
+
var _ModelCatalog = require("../redux/actions/ModelCatalog");
|
|
23
24
|
var _RouterActions = require("../redux/_router/RouterActions");
|
|
24
25
|
var _exceptions = require("../exceptions");
|
|
25
26
|
var _Init = require("./Init");
|
|
@@ -89,6 +90,20 @@ const handleRedirectURI = store => {
|
|
|
89
90
|
|
|
90
91
|
/**
|
|
91
92
|
*/
|
|
93
|
+
const setModelCatalogEntryDate = store => {
|
|
94
|
+
if (typeof window !== "undefined") {
|
|
95
|
+
const entryDateFromUrl = new _urlSearchParams.default(window.location?.search).get("entryDate");
|
|
96
|
+
if (entryDateFromUrl) {
|
|
97
|
+
store.dispatch((0, _ModelCatalog.updateEntryDate)(entryDateFromUrl));
|
|
98
|
+
} else if (_Cache.default.hasItem("ModelCatalogEntryDate")) {
|
|
99
|
+
store.dispatch(_Cache.default.getItem("ModelCatalogEntryDate"));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
*/
|
|
106
|
+
exports.setModelCatalogEntryDate = setModelCatalogEntryDate;
|
|
92
107
|
const setupClient = function () {
|
|
93
108
|
let customReducers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
94
109
|
let beforeRenderHooks = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -109,6 +124,7 @@ const setupClient = function () {
|
|
|
109
124
|
store
|
|
110
125
|
} = (0, _configureStore.default)(browserHistory, customReducers, (0, _rehydrate.default)(data));
|
|
111
126
|
handleRedirectURI(store);
|
|
127
|
+
setModelCatalogEntryDate(store);
|
|
112
128
|
(0, _Preferences.setAllContentInDataSetting)(store.getState());
|
|
113
129
|
(0, _Preferences.setLoginPreferences)(store.getState());
|
|
114
130
|
|
|
@@ -24,9 +24,9 @@ import {
|
|
|
24
24
|
setLoginPreferences,
|
|
25
25
|
} from "../redux/actions/Preferences";
|
|
26
26
|
import { showXHRErrorNotification } from "../redux/actions/Notification";
|
|
27
|
-
|
|
28
27
|
import { handleError } from "../redux/actions/Error";
|
|
29
28
|
import { loginSuccess } from "../redux/actions/SignIn";
|
|
29
|
+
import { updateEntryDate } from "../redux/actions/ModelCatalog";
|
|
30
30
|
|
|
31
31
|
import { locationChange, replace } from "../redux/_router/RouterActions";
|
|
32
32
|
|
|
@@ -130,6 +130,21 @@ const handleRedirectURI = (store: ReduxStore) => {
|
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
+
/**
|
|
134
|
+
*/
|
|
135
|
+
export const setModelCatalogEntryDate = (store: ReduxStore) => {
|
|
136
|
+
if (typeof window !== "undefined") {
|
|
137
|
+
const entryDateFromUrl = new URLSearchParams(window.location?.search).get(
|
|
138
|
+
"entryDate",
|
|
139
|
+
);
|
|
140
|
+
if (entryDateFromUrl) {
|
|
141
|
+
store.dispatch(updateEntryDate(entryDateFromUrl));
|
|
142
|
+
} else if (Cache.hasItem("ModelCatalogEntryDate")) {
|
|
143
|
+
store.dispatch(Cache.getItem("ModelCatalogEntryDate"));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
133
148
|
/**
|
|
134
149
|
*/
|
|
135
150
|
export const setupClient = (
|
|
@@ -156,6 +171,7 @@ export const setupClient = (
|
|
|
156
171
|
);
|
|
157
172
|
|
|
158
173
|
handleRedirectURI(store);
|
|
174
|
+
setModelCatalogEntryDate(store);
|
|
159
175
|
|
|
160
176
|
setAllContentInDataSetting(store.getState());
|
|
161
177
|
setLoginPreferences(store.getState());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["_reactDom","require","_objects","_setimmediate","_interopRequireDefault","_Cache","_xhr","_history","_configureStore","_rehydrate","_Settings","_Preferences","_Notification","_Error","_SignIn","_RouterActions","_exceptions","_Init","_beforeRenderHooks","_jsxRuntime","parseDataToJSON","data","JSON","parse","error","JsonParseException","getDataFromServer","_context","dataElement","document","querySelector","Error","_trim","default","textContent","call","setUnhandledRejectionEvent","store","window","onunhandledrejection","event","detail","setImmediate","errorMessage","reason","message","toString","dispatch","showXHRErrorNotification","exports","handleRedirectURI","urlParams","_urlSearchParams","location","search","redirectURI","get","xhr","url","getBasePathModularUI","catch","e","id","LOGIN_PATH","getSetting","replace","from","pathname","modal","setupClient","customReducers","arguments","length","undefined","beforeRenderHooks","contextPath","Cache","clear","browserHistory","createBrowserHistory","basename","getBasePathServer","routerHistory","configureStore","rehydrate","setAllContentInDataSetting","getState","setLoginPreferences","loadOtherBrowserTabs","getItem","loginSuccess","has","FetchException","response","handleError","listen","action","locationChange","body","className","handleBeforeRenderHooks","addContentLoadedEvent","theme","render","ErrorFallbackComponent","mount","addEventListener","applicationNode","jsx","Init","children","mountClient","element","isSSR","hydrate","client","_ref"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\n// eslint-disable-next-line react/no-deprecated\nimport { hydrate, render } from \"react-dom\";\n\nimport { has } from \"../utils/helpers/objects\";\nimport setImmediate from \"setimmediate\";\n\nimport Cache from \"../utils/browser/Cache\";\n\nimport xhr from \"../utils/fetch/xhr\";\n\nimport { createBrowserHistory } from \"history\";\nimport configureStore from \"../redux/store/configureStore\";\n\nimport rehydrate from \"./rehydrate\";\nimport {\n getBasePathModularUI,\n getBasePathServer,\n getSetting,\n} from \"../constants/Settings\";\n\nimport {\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\nimport { showXHRErrorNotification } from \"../redux/actions/Notification\";\n\nimport { handleError } from \"../redux/actions/Error\";\nimport { loginSuccess } from \"../redux/actions/SignIn\";\n\nimport { locationChange, replace } from \"../redux/_router/RouterActions\";\n\nimport { JsonParseException, FetchException } from \"../exceptions\";\n\nimport { Init } from \"./Init\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport type {\n ComponentType,\n Element as ReactElement,\n ElementType,\n} from \"react\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { CustomReducers, ReduxStore } from \"../redux/types\";\nimport type { RouterHistory } from \"react-router\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\n\ntype RenderFunction = () => ReactElement<ElementType>;\ntype MountFunction = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => void;\ntype Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n mount: MountFunction,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\nconst parseDataToJSON = (data: string) => {\n try {\n return JSON.parse(data);\n } catch (error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n\nconst getDataFromServer = () => {\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]',\n );\n\n if (!dataElement) {\n throw new Error(\"Error loading state, json not found\");\n } else if (dataElement.textContent.trim() === \"\") {\n return {};\n }\n\n return parseDataToJSON(dataElement.textContent);\n};\n\n/**\n */\nexport const setUnhandledRejectionEvent = (store: ReduxStore) => {\n window.onunhandledrejection = (event) => {\n if (event.detail) {\n return setImmediate(() => {\n const errorMessage = event.detail.reason.message.toString();\n\n store.dispatch(showXHRErrorNotification(errorMessage));\n throw event.detail.reason;\n });\n }\n\n return event;\n };\n};\n\n/**\n * The redirectURI querystring parameter is available when the server is redirecting an unauthorized deep link\n * @param store\n */\nconst handleRedirectURI = (store: ReduxStore) => {\n const urlParams = new URLSearchParams(window.location.search);\n const redirectURI = urlParams.get(\"redirectURI\");\n if (redirectURI) {\n xhr({ url: `${getBasePathModularUI()}${redirectURI}` }).catch((e) => {\n if (\n e.id === \"UnauthorizedException\" ||\n e.id === \"Error.NotAuthorized\" ||\n e.id === \"Error.Authentication.Required\" ||\n e.id === \"Error.Authentication.InvalidCredentials\"\n ) {\n const LOGIN_PATH = getSetting(\"LOGIN_PATH\", \"/signin\");\n store.dispatch(\n replace(LOGIN_PATH, {\n from: { pathname: redirectURI },\n modal: false,\n }),\n );\n }\n });\n }\n};\n\n/**\n */\nexport const setupClient = (\n customReducers: CustomReducers = {},\n beforeRenderHooks: ?Array<BeforeRenderHook>,\n): { store: ReduxStore, routerHistory: RouterHistory } => {\n if (typeof window.contextPath === \"undefined\") {\n throw new Error(\"Missing contextPath on window object\");\n }\n\n const data = getDataFromServer();\n\n // remove all resources from cache\n Cache.clear(\"^res:\");\n\n // $FlowExpectedError\n const browserHistory: RouterHistory = createBrowserHistory({\n basename: getBasePathServer(),\n });\n const { routerHistory, store } = configureStore(\n browserHistory,\n customReducers,\n rehydrate(data),\n );\n\n handleRedirectURI(store);\n\n setAllContentInDataSetting(store.getState());\n setLoginPreferences(store.getState());\n\n // load existing cache from other browser tabs\n Cache.loadOtherBrowserTabs(() => {\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n });\n\n if (has(data, \"error.name\")) {\n const error = new FetchException(data?.error?.response);\n store.dispatch(handleError(error));\n }\n\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n\n // listen to history change and update the redux router store\n routerHistory.listen((location, action) => {\n store.dispatch(locationChange(location, action));\n });\n\n setUnhandledRejectionEvent(store);\n\n if (document.body) {\n document.body.className = \"js\";\n }\n\n if (beforeRenderHooks) {\n handleBeforeRenderHooks(beforeRenderHooks, { store });\n }\n\n return { store, routerHistory };\n};\n\n/**\n */\nexport const addContentLoadedEvent = (\n store: ReduxStore,\n routerHistory: RouterHistory,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n mount: MountFunction,\n) => {\n window.addEventListener(\"DOMContentLoaded\", () => {\n const applicationNode = document.querySelector(\"#application\");\n if (!applicationNode) {\n throw new Error(\n \"No DOM element with id application found to attach client to\",\n );\n }\n\n mount(\n applicationNode,\n <Init\n store={store}\n routerHistory={routerHistory}\n contextPath={window.contextPath}\n theme={theme}\n ErrorFallbackComponent={ErrorFallbackComponent}\n >\n {render()}\n </Init>,\n );\n });\n};\n\n/**\n */\nconst mountClient = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => {\n const isSSR = applicationNode.querySelector(\".application\");\n if (isSSR) {\n hydrate(element, applicationNode);\n } else {\n render(element, applicationNode);\n }\n};\n\n/**\n * Mount the webapplication to the DOM, setup redux store and caches, add unhandledRejectionEvent, used client side when JavaScript is enabled.\n */\nexport const client = ({\n customReducers,\n theme,\n render,\n beforeRenderHooks,\n ErrorFallbackComponent,\n mount,\n}: Props) => {\n const { store, routerHistory } = setupClient(\n customReducers,\n beforeRenderHooks,\n );\n\n addContentLoadedEvent(\n store,\n routerHistory,\n theme,\n render,\n ErrorFallbackComponent,\n mount ?? mountClient,\n );\n};\n"],"mappings":";;;;;;;;;AAEA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAD,sBAAA,CAAAH,OAAA;AAEA,IAAAK,IAAA,GAAAF,sBAAA,CAAAH,OAAA;AAEA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAJ,sBAAA,CAAAH,OAAA;AAEA,IAAAQ,UAAA,GAAAL,sBAAA,CAAAH,OAAA;AACA,IAAAS,SAAA,GAAAT,OAAA;AAMA,IAAAU,YAAA,GAAAV,OAAA;AAIA,IAAAW,aAAA,GAAAX,OAAA;AAEA,IAAAY,MAAA,GAAAZ,OAAA;AACA,IAAAa,OAAA,GAAAb,OAAA;AAEA,IAAAc,cAAA,GAAAd,O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CAAC,cAAc,CAAC;EAC3D,IAAImF,KAAK,EAAE;IACT,IAAAC,iBAAO,EAACF,OAAO,EAAEL,eAAe,CAAC;EACnC,CAAC,MAAM;IACL,IAAAJ,gBAAM,EAACS,OAAO,EAAEL,eAAe,CAAC;EAClC;AACF,CAAC;;AAED;AACA;AACA;AACO,MAAMQ,MAAM,GAAGC,IAAA,IAOT;EAAA,IAPU;IACrB9C,cAAc;IACdgC,KAAK;IACLC,MAAM;IACN7B,iBAAiB;IACjB8B,sBAAsB;IACtBC;EACK,CAAC,GAAAW,IAAA;EACN,MAAM;IAAE/E,KAAK;IAAE6C;EAAc,CAAC,GAAGb,WAAW,CAC1CC,cAAc,EACdI,iBACF,CAAC;EAED2B,qBAAqB,CACnBhE,KAAK,EACL6C,aAAa,EACboB,KAAK,EACLC,MAAM,EACNC,sBAAsB,EACtBC,KAAK,IAAIM,WACX,CAAC;AACH,CAAC;AAAC9D,OAAA,CAAAkE,MAAA,GAAAA,MAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"client.js","names":["_reactDom","require","_objects","_setimmediate","_interopRequireDefault","_Cache","_xhr","_history","_configureStore","_rehydrate","_Settings","_Preferences","_Notification","_Error","_SignIn","_ModelCatalog","_RouterActions","_exceptions","_Init","_beforeRenderHooks","_jsxRuntime","parseDataToJSON","data","JSON","parse","error","JsonParseException","getDataFromServer","_context","dataElement","document","querySelector","Error","_trim","default","textContent","call","setUnhandledRejectionEvent","store","window","onunhandledrejection","event","detail","setImmediate","errorMessage","reason","message","toString","dispatch","showXHRErrorNotification","exports","handleRedirectURI","urlParams","_urlSearchParams","location","search","redirectURI","get","xhr","url","getBasePathModularUI","catch","e","id","LOGIN_PATH","getSetting","replace","from","pathname","modal","setModelCatalogEntryDate","entryDateFromUrl","updateEntryDate","Cache","hasItem","getItem","setupClient","customReducers","arguments","length","undefined","beforeRenderHooks","contextPath","clear","browserHistory","createBrowserHistory","basename","getBasePathServer","routerHistory","configureStore","rehydrate","setAllContentInDataSetting","getState","setLoginPreferences","loadOtherBrowserTabs","loginSuccess","has","FetchException","response","handleError","listen","action","locationChange","body","className","handleBeforeRenderHooks","addContentLoadedEvent","theme","render","ErrorFallbackComponent","mount","addEventListener","applicationNode","jsx","Init","children","mountClient","element","isSSR","hydrate","client","_ref"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\n// eslint-disable-next-line react/no-deprecated\nimport { hydrate, render } from \"react-dom\";\n\nimport { has } from \"../utils/helpers/objects\";\nimport setImmediate from \"setimmediate\";\n\nimport Cache from \"../utils/browser/Cache\";\n\nimport xhr from \"../utils/fetch/xhr\";\n\nimport { createBrowserHistory } from \"history\";\nimport configureStore from \"../redux/store/configureStore\";\n\nimport rehydrate from \"./rehydrate\";\nimport {\n getBasePathModularUI,\n getBasePathServer,\n getSetting,\n} from \"../constants/Settings\";\n\nimport {\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\nimport { showXHRErrorNotification } from \"../redux/actions/Notification\";\nimport { handleError } from \"../redux/actions/Error\";\nimport { loginSuccess } from \"../redux/actions/SignIn\";\nimport { updateEntryDate } from \"../redux/actions/ModelCatalog\";\n\nimport { locationChange, replace } from \"../redux/_router/RouterActions\";\n\nimport { JsonParseException, FetchException } from \"../exceptions\";\n\nimport { Init } from \"./Init\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport type {\n ComponentType,\n Element as ReactElement,\n ElementType,\n} from \"react\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { CustomReducers, ReduxStore } from \"../redux/types\";\nimport type { RouterHistory } from \"react-router\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\n\ntype RenderFunction = () => ReactElement<ElementType>;\ntype MountFunction = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => void;\ntype Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n mount: MountFunction,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\nconst parseDataToJSON = (data: string) => {\n try {\n return JSON.parse(data);\n } catch (error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n\nconst getDataFromServer = () => {\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]',\n );\n\n if (!dataElement) {\n throw new Error(\"Error loading state, json not found\");\n } else if (dataElement.textContent.trim() === \"\") {\n return {};\n }\n\n return parseDataToJSON(dataElement.textContent);\n};\n\n/**\n */\nexport const setUnhandledRejectionEvent = (store: ReduxStore) => {\n window.onunhandledrejection = (event) => {\n if (event.detail) {\n return setImmediate(() => {\n const errorMessage = event.detail.reason.message.toString();\n\n store.dispatch(showXHRErrorNotification(errorMessage));\n throw event.detail.reason;\n });\n }\n\n return event;\n };\n};\n\n/**\n * The redirectURI querystring parameter is available when the server is redirecting an unauthorized deep link\n * @param store\n */\nconst handleRedirectURI = (store: ReduxStore) => {\n const urlParams = new URLSearchParams(window.location.search);\n const redirectURI = urlParams.get(\"redirectURI\");\n if (redirectURI) {\n xhr({ url: `${getBasePathModularUI()}${redirectURI}` }).catch((e) => {\n if (\n e.id === \"UnauthorizedException\" ||\n e.id === \"Error.NotAuthorized\" ||\n e.id === \"Error.Authentication.Required\" ||\n e.id === \"Error.Authentication.InvalidCredentials\"\n ) {\n const LOGIN_PATH = getSetting(\"LOGIN_PATH\", \"/signin\");\n store.dispatch(\n replace(LOGIN_PATH, {\n from: { pathname: redirectURI },\n modal: false,\n }),\n );\n }\n });\n }\n};\n\n/**\n */\nexport const setModelCatalogEntryDate = (store: ReduxStore) => {\n if (typeof window !== \"undefined\") {\n const entryDateFromUrl = new URLSearchParams(window.location?.search).get(\n \"entryDate\",\n );\n if (entryDateFromUrl) {\n store.dispatch(updateEntryDate(entryDateFromUrl));\n } else if (Cache.hasItem(\"ModelCatalogEntryDate\")) {\n store.dispatch(Cache.getItem(\"ModelCatalogEntryDate\"));\n }\n }\n};\n\n/**\n */\nexport const setupClient = (\n customReducers: CustomReducers = {},\n beforeRenderHooks: ?Array<BeforeRenderHook>,\n): { store: ReduxStore, routerHistory: RouterHistory } => {\n if (typeof window.contextPath === \"undefined\") {\n throw new Error(\"Missing contextPath on window object\");\n }\n\n const data = getDataFromServer();\n\n // remove all resources from cache\n Cache.clear(\"^res:\");\n\n // $FlowExpectedError\n const browserHistory: RouterHistory = createBrowserHistory({\n basename: getBasePathServer(),\n });\n const { routerHistory, store } = configureStore(\n browserHistory,\n customReducers,\n rehydrate(data),\n );\n\n handleRedirectURI(store);\n setModelCatalogEntryDate(store);\n\n setAllContentInDataSetting(store.getState());\n setLoginPreferences(store.getState());\n\n // load existing cache from other browser tabs\n Cache.loadOtherBrowserTabs(() => {\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n });\n\n if (has(data, \"error.name\")) {\n const error = new FetchException(data?.error?.response);\n store.dispatch(handleError(error));\n }\n\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n\n // listen to history change and update the redux router store\n routerHistory.listen((location, action) => {\n store.dispatch(locationChange(location, action));\n });\n\n setUnhandledRejectionEvent(store);\n\n if (document.body) {\n document.body.className = \"js\";\n }\n\n if (beforeRenderHooks) {\n handleBeforeRenderHooks(beforeRenderHooks, { store });\n }\n\n return { store, routerHistory };\n};\n\n/**\n */\nexport const addContentLoadedEvent = (\n store: ReduxStore,\n routerHistory: RouterHistory,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n mount: MountFunction,\n) => {\n window.addEventListener(\"DOMContentLoaded\", () => {\n const applicationNode = document.querySelector(\"#application\");\n if (!applicationNode) {\n throw new Error(\n \"No DOM element with id application found to attach client to\",\n );\n }\n\n mount(\n applicationNode,\n <Init\n store={store}\n routerHistory={routerHistory}\n contextPath={window.contextPath}\n theme={theme}\n ErrorFallbackComponent={ErrorFallbackComponent}\n >\n {render()}\n </Init>,\n );\n });\n};\n\n/**\n */\nconst mountClient = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => {\n const isSSR = applicationNode.querySelector(\".application\");\n if (isSSR) {\n hydrate(element, applicationNode);\n } else {\n render(element, applicationNode);\n }\n};\n\n/**\n * Mount the webapplication to the DOM, setup redux store and caches, add unhandledRejectionEvent, used client side when JavaScript is enabled.\n */\nexport const client = ({\n customReducers,\n theme,\n render,\n beforeRenderHooks,\n ErrorFallbackComponent,\n mount,\n}: Props) => {\n const { store, routerHistory } = setupClient(\n customReducers,\n beforeRenderHooks,\n );\n\n addContentLoadedEvent(\n store,\n routerHistory,\n theme,\n render,\n ErrorFallbackComponent,\n mount ?? mountClient,\n );\n};\n"],"mappings":";;;;;;;;;AAEA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAD,sBAAA,CAAAH,OAAA;AAEA,IAAAK,IAAA,GAAAF,sBAAA,CAAAH,OAAA;AAEA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAJ,sBAAA,CAAAH,OAAA;AAEA,IAAAQ,UAAA,GAAAL,sBAAA,CAAAH,OAAA;AACA,IAAAS,SAAA,GAAAT,OAAA;AAMA,IAAAU,YAAA,GAAAV,OAAA;AAIA,IAAAW,aAAA,GAAAX,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AACA,IAAAa,OAAA,GAAAb,OAAA;AACA,IAAAc,aAAA,GAAAd,OAAA;AAEA,IAAAe,cAAA,GAAAf,OAAA;AAEA,IAAAgB,WAAA,GAAAhB,OAAA;AAEA,IAAAiB,KAAA,GAAAjB,OAAA;AAEA,IAAAkB,kBAAA,GAAAlB,OAAA;AAA2E,IAAAmB,WAA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,eACf,IAAA5F,WAAA,CAAA6F,GAAA,EAAC/F,KAAA,CAAAgG,IAAI;MACH5E,KAAK,EAAEA,KAAM;MACbkD,aAAa,EAAEA,aAAc;MAC7BN,WAAW,EAAE3C,MAAM,CAAC2C,WAAY;MAChCyB,KAAK,EAAEA,KAAM;MACbE,sBAAsB,EAAEA,sBAAuB;MAAAM,QAAA,EAE9CP,MAAM,CAAC;IAAC,CACL,CACR,CAAC;EACH,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AADA1D,OAAA,CAAAwD,qBAAA,GAAAA,qBAAA;AAEA,MAAMU,WAAW,GAAGA,CAClBJ,eAAwB,EACxBK,OAAkC,KAC/B;EACH,MAAMC,KAAK,GAAGN,eAAe,CAACjF,aAAa,CAAC,cAAc,CAAC;EAC3D,IAAIuF,KAAK,EAAE;IACT,IAAAC,iBAAO,EAACF,OAAO,EAAEL,eAAe,CAAC;EACnC,CAAC,MAAM;IACL,IAAAJ,gBAAM,EAACS,OAAO,EAAEL,eAAe,CAAC;EAClC;AACF,CAAC;;AAED;AACA;AACA;AACO,MAAMQ,MAAM,GAAGC,IAAA,IAOT;EAAA,IAPU;IACrB5C,cAAc;IACd8B,KAAK;IACLC,MAAM;IACN3B,iBAAiB;IACjB4B,sBAAsB;IACtBC;EACK,CAAC,GAAAW,IAAA;EACN,MAAM;IAAEnF,KAAK;IAAEkD;EAAc,CAAC,GAAGZ,WAAW,CAC1CC,cAAc,EACdI,iBACF,CAAC;EAEDyB,qBAAqB,CACnBpE,KAAK,EACLkD,aAAa,EACbmB,KAAK,EACLC,MAAM,EACNC,sBAAsB,EACtBC,KAAK,IAAIM,WACX,CAAC;AACH,CAAC;AAAClE,OAAA,CAAAsE,MAAA,GAAAA,MAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelCatalog.js","names":["updateEntryDate","entryDate","type","payload","exports"],"sources":["../../../src/redux/actions/ModelCatalog.js"],"sourcesContent":["// @flow\nimport type { UpdateEntryDateAction } from \"../types\";\n\n/**\n * Update the entry date being used in the modelcatalog\n */\nexport const updateEntryDate = (\n entryDate: ISO_DATE,\n): UpdateEntryDateAction => ({\n type: \"UPDATE_ENTRYDATE\",\n payload: entryDate,\n});\n"],"mappings":";;;;;;AAGA;AACA;AACA;AACO,MAAMA,eAAe,GAC1BC,SAAmB,KACQ;EAC3BC,IAAI,EAAE,kBAAkB;EACxBC,OAAO,EAAEF;AACX,CAAC,CAAC;AAACG,OAAA,CAAAJ,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -26,14 +26,14 @@ _Object$keys(_Authorization).forEach(function (key) {
|
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
|
-
var
|
|
30
|
-
_Object$keys(
|
|
29
|
+
var _ModelCatalog = require("./ModelCatalog");
|
|
30
|
+
_Object$keys(_ModelCatalog).forEach(function (key) {
|
|
31
31
|
if (key === "default" || key === "__esModule") return;
|
|
32
|
-
if (key in exports && exports[key] ===
|
|
32
|
+
if (key in exports && exports[key] === _ModelCatalog[key]) return;
|
|
33
33
|
Object.defineProperty(exports, key, {
|
|
34
34
|
enumerable: true,
|
|
35
35
|
get: function () {
|
|
36
|
-
return
|
|
36
|
+
return _ModelCatalog[key];
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Application","require","_Object$keys","forEach","key","exports","Object","defineProperty","enumerable","get","_Authorization","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Application","require","_Object$keys","forEach","key","exports","Object","defineProperty","enumerable","get","_Authorization","_ModelCatalog","_Error","_Form","_FormAttributeSet","_FormAttributeSetRepeatable","_FormAutosave","_FormAutosubmit","_FormValidations","_Modals","_Notification","_Preferences","_ProgressIndicator","_SignIn","_SignOut"],"sources":["../../../src/redux/actions/index.js"],"sourcesContent":["// @flow\nexport * from \"./Application\";\nexport * from \"./Authorization\";\nexport * from \"./ModelCatalog\";\nexport * from \"./Error\";\nexport * from \"./Form\";\nexport * from \"./FormAttributeSet\";\nexport * from \"./FormAttributeSetRepeatable\";\nexport * from \"./FormAutosave\";\nexport * from \"./FormAutosubmit\";\nexport * from \"./FormValidations\";\nexport * from \"./Modals\";\nexport * from \"./Notification\";\nexport * from \"./Preferences\";\nexport * from \"./ProgressIndicator\";\nexport * from \"./SignIn\";\nexport * from \"./SignOut\";\n"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAAC,YAAA,CAAAF,YAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAJ,YAAA,CAAAI,GAAA;EAAAE,MAAA,CAAAC,cAAA,CAAAF,OAAA,EAAAD,GAAA;IAAAI,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,YAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,cAAA,GAAAT,OAAA;AAAAC,YAAA,CAAAQ,cAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,cAAA,CAAAN,GAAA;EAAAE,MAAA,CAAAC,cAAA,CAAAF,OAAA,EAAAD,GAAA;IAAAI,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,cAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,aAAA,GAAAV,OAAA;AAAAC,YAAA,CAAAS,aAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,aAAA,CAAAP,GAAA;EAAAE,MAAA,CAAAC,cAAA,CAAAF,OAAA,EA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GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAkB,kBAAA,CAAAlB,GAAA;EAAAE,MAAA,CAAAC,cAAA,CAAAF,OAAA,EAAAD,GAAA;IAAAI,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAa,kBAAA,CAAAlB,GAAA;IAAA;EAAA;AAAA;AACA,IAAAmB,OAAA,GAAAtB,OAAA;AAAAC,YAAA,CAAAqB,OAAA,EAAApB,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAmB,OAAA,CAAAnB,GAAA;EAAAE,MAAA,CAAAC,cAAA,CAAAF,OAAA,EAAAD,GAAA;IAAAI,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAc,OAAA,CAAAnB,GAAA;IAAA;EAAA;AAAA;AACA,IAAAoB,QAAA,GAAAvB,OAAA;AAAAC,YAAA,CAAAsB,QAAA,EAAArB,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAoB,QAAA,CAAApB,GAAA;EAAAE,MAAA,CAAAC,cAAA,CAAAF,OAAA,EAAAD,GAAA;IAAAI,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAe,QAAA,CAAApB,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -5,11 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _urlSearchParams = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/url-search-params"));
|
|
9
8
|
var _utils = require("../../utils");
|
|
10
9
|
var _Cache = _interopRequireDefault(require("../../utils/browser/Cache"));
|
|
11
10
|
const initialState = {
|
|
12
|
-
entryDate:
|
|
11
|
+
entryDate: _utils.DateUtil.now()
|
|
13
12
|
};
|
|
14
13
|
|
|
15
14
|
/**
|
|
@@ -6,12 +6,7 @@ import type { Reducer } from "redux";
|
|
|
6
6
|
import type { ReduxAction, ModelCatalogState } from "../types";
|
|
7
7
|
|
|
8
8
|
const initialState: ModelCatalogState = {
|
|
9
|
-
entryDate:
|
|
10
|
-
typeof window !== "undefined"
|
|
11
|
-
? new URLSearchParams(window.location?.search).get("entryDate") ||
|
|
12
|
-
Cache.getItem("ModelCatalogEntryDate") ||
|
|
13
|
-
DateUtil.now()
|
|
14
|
-
: null,
|
|
9
|
+
entryDate: DateUtil.now(),
|
|
15
10
|
};
|
|
16
11
|
|
|
17
12
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelCatalogReducer.js","names":["_utils","require","_Cache","_interopRequireDefault","initialState","entryDate","
|
|
1
|
+
{"version":3,"file":"ModelCatalogReducer.js","names":["_utils","require","_Cache","_interopRequireDefault","initialState","entryDate","DateUtil","now","ModelCatalogReducer","state","arguments","length","undefined","action","type","Cache","addItem","payload","_default","exports","default"],"sources":["../../../src/redux/reducers/ModelCatalogReducer.js"],"sourcesContent":["// @flow\nimport { DateUtil } from \"../../utils\";\nimport Cache from \"../../utils/browser/Cache\";\n\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction, ModelCatalogState } from \"../types\";\n\nconst initialState: ModelCatalogState = {\n entryDate: DateUtil.now(),\n};\n\n/**\n * Keep track of the entry date for the modelcatalog\n */\nconst ModelCatalogReducer: Reducer<ModelCatalogState, ReduxAction> = (\n state = initialState,\n action,\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"UPDATE_ENTRYDATE\":\n Cache.addItem(\"ModelCatalogEntryDate\", action.payload);\n return {\n ...state,\n entryDate: action.payload,\n };\n default:\n return state;\n }\n};\n\nexport default ModelCatalogReducer;\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,MAAMG,YAA+B,GAAG;EACtCC,SAAS,EAAEC,eAAQ,CAACC,GAAG,CAAC;AAC1B,CAAC;;AAED;AACA;AACA;AACA,MAAMC,mBAA4D,GAAG,SAAAA,CAAA,EAGhE;EAAA,IAFHC,KAAK,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGN,YAAY;EAAA,IACpBS,MAAM,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAEN,IAAI,CAACC,MAAM,EAAE;IACX,OAAOJ,KAAK;EACd;EAEA,QAAQI,MAAM,CAACC,IAAI;IACjB,KAAK,kBAAkB;MACrBC,cAAK,CAACC,OAAO,CAAC,uBAAuB,EAAEH,MAAM,CAACI,OAAO,CAAC;MACtD,OAAO;QACL,GAAGR,KAAK;QACRJ,SAAS,EAAEQ,MAAM,CAACI;MACpB,CAAC;IACH;MACE,OAAOR,KAAK;EAChB;AACF,CAAC;AAAC,IAAAS,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaZ,mBAAmB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beinformed/ui",
|
|
3
|
-
"version": "1.58.
|
|
3
|
+
"version": "1.58.4",
|
|
4
4
|
"description": "Toolbox for be informed javascript layouts",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"bugs": "http://support.beinformed.com",
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"jscodeshift": "^17.1.1",
|
|
142
142
|
"lint-staged": "^15.2.10",
|
|
143
143
|
"polished": "^4.0.0",
|
|
144
|
-
"prettier": "^3.
|
|
144
|
+
"prettier": "^3.4.0",
|
|
145
145
|
"react": "^18.3.1",
|
|
146
146
|
"react-dom": "^18.3.1",
|
|
147
147
|
"react-helmet-async": "^2.0.5",
|
|
@@ -16,7 +16,7 @@ import { useModularUIBasic } from "./useModularUIBasic";
|
|
|
16
16
|
import { ContentTypeModel } from "../models";
|
|
17
17
|
|
|
18
18
|
import { getEntryDate } from "../redux/selectors/modelcatalog";
|
|
19
|
-
import { updateEntryDate } from "../redux/actions/
|
|
19
|
+
import { updateEntryDate } from "../redux/actions/ModelCatalog";
|
|
20
20
|
|
|
21
21
|
import type Href from "../models/href/Href";
|
|
22
22
|
import type { UseModularUIBasicOptions } from "./useModularUIBasic";
|
|
@@ -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) =>
|
|
173
|
+
(subSection) =>
|
|
174
|
+
new SubSectionModel(subSection, this.entryDate, this.modelOptions),
|
|
174
175
|
)
|
|
175
176
|
: [];
|
|
176
177
|
}
|
|
@@ -6,17 +6,25 @@ import LinkCollection from "../links/LinkCollection";
|
|
|
6
6
|
import Href from "../href/Href";
|
|
7
7
|
import LinkModel from "../links/LinkModel";
|
|
8
8
|
import { retrieveText } from "../../utils";
|
|
9
|
+
import type { ModelOptions } from "../types";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Link to a concept
|
|
12
13
|
*/
|
|
13
14
|
export default class SubSectionModel extends BaseModel {
|
|
15
|
+
_entryDate: ISO_DATE | null;
|
|
14
16
|
_links: LinkCollection;
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
*/
|
|
18
|
-
constructor(
|
|
19
|
-
|
|
20
|
+
constructor(
|
|
21
|
+
data: Object,
|
|
22
|
+
entryDate: ISO_DATE | null,
|
|
23
|
+
modelOptions?: ModelOptions,
|
|
24
|
+
) {
|
|
25
|
+
super(data, {}, modelOptions);
|
|
26
|
+
|
|
27
|
+
this._entryDate = entryDate;
|
|
20
28
|
}
|
|
21
29
|
|
|
22
30
|
/**
|
|
@@ -66,7 +74,8 @@ export default class SubSectionModel extends BaseModel {
|
|
|
66
74
|
get subSections(): Array<SubSectionModel> {
|
|
67
75
|
return this.data.subSections
|
|
68
76
|
? this.data.subSections.map(
|
|
69
|
-
(subSection) =>
|
|
77
|
+
(subSection) =>
|
|
78
|
+
new SubSectionModel(subSection, this.entryDate, this.modelOptions),
|
|
70
79
|
)
|
|
71
80
|
: [];
|
|
72
81
|
}
|
|
@@ -99,6 +108,12 @@ export default class SubSectionModel extends BaseModel {
|
|
|
99
108
|
return this.selflink ? this.selflink.href : null;
|
|
100
109
|
}
|
|
101
110
|
|
|
111
|
+
/**
|
|
112
|
+
*/
|
|
113
|
+
get entryDate(): ISO_DATE | null {
|
|
114
|
+
return this._entryDate;
|
|
115
|
+
}
|
|
116
|
+
|
|
102
117
|
/**
|
|
103
118
|
*/
|
|
104
119
|
get relatedConceptsHrefs(): Array<Href> {
|
|
@@ -131,7 +146,9 @@ export default class SubSectionModel extends BaseModel {
|
|
|
131
146
|
: "";
|
|
132
147
|
}
|
|
133
148
|
|
|
149
|
+
href.addParameter("entryDate", this.entryDate);
|
|
134
150
|
href.setReferenceHash(this.referenceHash);
|
|
151
|
+
|
|
135
152
|
return href;
|
|
136
153
|
}
|
|
137
154
|
|
|
@@ -133,10 +133,10 @@ describe("contentmodel", () => {
|
|
|
133
133
|
"/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1/relatedConcepts?entryDate=2024-07-17",
|
|
134
134
|
);
|
|
135
135
|
expect(contentModel.relatedConceptsHrefs[1].toString()).toBe(
|
|
136
|
-
"/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1a/relatedConcepts",
|
|
136
|
+
"/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1a/relatedConcepts?entryDate=2024-07-17",
|
|
137
137
|
);
|
|
138
138
|
expect(contentModel.relatedConceptsHrefs[2].toString()).toBe(
|
|
139
|
-
"/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1b/relatedConcepts",
|
|
139
|
+
"/content/bundle-nl.government.grant.funding.agreement.source/Grant%20Funding%20Agreement/Grant%20Funding%20Agreement.formalsource/Chapter5_1b/relatedConcepts?entryDate=2024-07-17",
|
|
140
140
|
);
|
|
141
141
|
});
|
|
142
142
|
|
|
@@ -196,7 +196,7 @@ describe("contentmodel", () => {
|
|
|
196
196
|
);
|
|
197
197
|
expect(firstSubSection.relatedConceptsHrefs).toHaveLength(1);
|
|
198
198
|
expect(firstSubSection.relatedConceptsHref.href.toString()).toBe(
|
|
199
|
-
"/content/Incident/Business design/Content/Blaastest subsections.formalsource/Pass/relatedConcepts",
|
|
199
|
+
"/content/Incident/Business design/Content/Blaastest subsections.formalsource/Pass/relatedConcepts?entryDate=2021-08-31",
|
|
200
200
|
);
|
|
201
201
|
expect(firstSubSection.relatedConceptsHref.getReferenceHash()).toBe(
|
|
202
202
|
145842294,
|
|
@@ -24,9 +24,9 @@ import {
|
|
|
24
24
|
setLoginPreferences,
|
|
25
25
|
} from "../redux/actions/Preferences";
|
|
26
26
|
import { showXHRErrorNotification } from "../redux/actions/Notification";
|
|
27
|
-
|
|
28
27
|
import { handleError } from "../redux/actions/Error";
|
|
29
28
|
import { loginSuccess } from "../redux/actions/SignIn";
|
|
29
|
+
import { updateEntryDate } from "../redux/actions/ModelCatalog";
|
|
30
30
|
|
|
31
31
|
import { locationChange, replace } from "../redux/_router/RouterActions";
|
|
32
32
|
|
|
@@ -130,6 +130,21 @@ const handleRedirectURI = (store: ReduxStore) => {
|
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
+
/**
|
|
134
|
+
*/
|
|
135
|
+
export const setModelCatalogEntryDate = (store: ReduxStore) => {
|
|
136
|
+
if (typeof window !== "undefined") {
|
|
137
|
+
const entryDateFromUrl = new URLSearchParams(window.location?.search).get(
|
|
138
|
+
"entryDate",
|
|
139
|
+
);
|
|
140
|
+
if (entryDateFromUrl) {
|
|
141
|
+
store.dispatch(updateEntryDate(entryDateFromUrl));
|
|
142
|
+
} else if (Cache.hasItem("ModelCatalogEntryDate")) {
|
|
143
|
+
store.dispatch(Cache.getItem("ModelCatalogEntryDate"));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
133
148
|
/**
|
|
134
149
|
*/
|
|
135
150
|
export const setupClient = (
|
|
@@ -156,6 +171,7 @@ export const setupClient = (
|
|
|
156
171
|
);
|
|
157
172
|
|
|
158
173
|
handleRedirectURI(store);
|
|
174
|
+
setModelCatalogEntryDate(store);
|
|
159
175
|
|
|
160
176
|
setAllContentInDataSetting(store.getState());
|
|
161
177
|
setLoginPreferences(store.getState());
|