@beinformed/ui 1.62.9 → 1.63.1

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 CHANGED
@@ -2,6 +2,25 @@
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.63.1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.63.0...v1.63.1) (2025-07-04)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **server-request:** escape querystring ([d39da26](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/d39da267eb9dc695718001fead168350ad542cec))
11
+
12
+ ## [1.63.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.62.8...v1.63.0) (2025-07-02)
13
+
14
+
15
+ ### Features
16
+
17
+ * **content:** handle rename of childSections to sections ([8ba3298](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/8ba329856ca539c2e24f77c91992134a293667e4))
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **server-request:** escape deeplink ([07c24a7](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/07c24a727806e7cfe3b2fc154886e9187ca93759))
23
+
5
24
  ## [1.62.9](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.62.8...v1.62.9) (2025-06-30)
6
25
 
7
26
 
@@ -55,7 +55,7 @@ const json = {
55
55
  href: "/content/_Context/Police%20incident%20decisions/Content/Breath%20analysis/Breathalyzer%20test.formalsource/Alert.%3A-",
56
56
  },
57
57
  },
58
- childSections: [
58
+ sections: [
59
59
  {
60
60
  id: "pass",
61
61
  label: "Pass",
@@ -94,14 +94,19 @@ class SectionModel extends BaseModel {
94
94
  * Retrieve child section links
95
95
  */
96
96
  get childSectionLinks() {
97
- var _context;
98
- return this.data.childSections ? _mapInstanceProperty(_context = this.data.childSections).call(_context, childSection => new ContentLinkModel({
97
+ let sections = [];
98
+ if (this.data.childSections) {
99
+ sections = this.data.childSections;
100
+ } else if (this.data.sections) {
101
+ sections = this.data.sections;
102
+ }
103
+ return _mapInstanceProperty(sections).call(sections, childSection => new ContentLinkModel({
99
104
  section: childSection.id || childSection._id,
100
105
  _id: childSection.id || childSection._id,
101
106
  label: childSection.label,
102
107
  sourceLabel: childSection.sourceLabel,
103
108
  _links: childSection._links
104
- }, this.entryDate, this.modelOptions)) : [];
109
+ }, this.entryDate, this.modelOptions));
105
110
  }
106
111
 
107
112
  /**
@@ -120,11 +125,17 @@ class SectionModel extends BaseModel {
120
125
  * Get tree of child sections
121
126
  */
122
127
  get childSections() {
123
- if (!this._childSections && this.data.childSections) {
124
- var _context2, _context3;
125
- this._childSections = _mapInstanceProperty(_context2 = _filterInstanceProperty(_context3 = this.data.childSections).call(_context3, childSection => "body" in childSection)).call(_context2, childSection => new SectionModel(childSection, this.entryDate, this.modelOptions));
128
+ if (!this._childSections) {
129
+ var _context;
130
+ let sections = [];
131
+ if (this.data.childSections) {
132
+ sections = this.data.childSections;
133
+ } else if (this.data.sections) {
134
+ sections = this.data.sections;
135
+ }
136
+ this._childSections = _mapInstanceProperty(_context = _filterInstanceProperty(sections).call(sections, childSection => "body" in childSection)).call(_context, childSection => new SectionModel(childSection, this.entryDate, this.modelOptions));
126
137
  }
127
- return this._childSections || [];
138
+ return this._childSections;
128
139
  }
129
140
 
130
141
  /**
@@ -138,8 +149,8 @@ class SectionModel extends BaseModel {
138
149
  */
139
150
  get sections() {
140
151
  if (this.data.sections) {
141
- var _context4;
142
- return _mapInstanceProperty(_context4 = this.data.sections).call(_context4, section => new SectionModel(section, this.entryDate, this.modelOptions));
152
+ var _context2;
153
+ return _mapInstanceProperty(_context2 = this.data.sections).call(_context2, section => new SectionModel(section, this.entryDate, this.modelOptions));
143
154
  }
144
155
  return [];
145
156
  }
@@ -147,8 +158,8 @@ class SectionModel extends BaseModel {
147
158
  * Get sub sections
148
159
  */
149
160
  get subSections() {
150
- var _context5;
151
- return this.data.subSections ? _mapInstanceProperty(_context5 = this.data.subSections).call(_context5, subSection => new SubSectionModel(subSection, this.entryDate, this.modelOptions)) : [];
161
+ var _context3;
162
+ return this.data.subSections ? _mapInstanceProperty(_context3 = this.data.subSections).call(_context3, subSection => new SubSectionModel(subSection, this.entryDate, this.modelOptions)) : [];
152
163
  }
153
164
 
154
165
  /**
@@ -108,22 +108,27 @@ class SectionModel extends BaseModel {
108
108
  * Retrieve child section links
109
109
  */
110
110
  get childSectionLinks(): Array<ContentLinkModel> {
111
- return this.data.childSections
112
- ? this.data.childSections.map(
113
- (childSection) =>
114
- new ContentLinkModel(
115
- {
116
- section: childSection.id || childSection._id,
117
- _id: childSection.id || childSection._id,
118
- label: childSection.label,
119
- sourceLabel: childSection.sourceLabel,
120
- _links: childSection._links,
121
- },
122
- this.entryDate,
123
- this.modelOptions,
124
- ),
125
- )
126
- : [];
111
+ let sections = [];
112
+ if (this.data.childSections) {
113
+ sections = this.data.childSections;
114
+ } else if (this.data.sections) {
115
+ sections = this.data.sections;
116
+ }
117
+
118
+ return sections.map(
119
+ (childSection) =>
120
+ new ContentLinkModel(
121
+ {
122
+ section: childSection.id || childSection._id,
123
+ _id: childSection.id || childSection._id,
124
+ label: childSection.label,
125
+ sourceLabel: childSection.sourceLabel,
126
+ _links: childSection._links,
127
+ },
128
+ this.entryDate,
129
+ this.modelOptions,
130
+ ),
131
+ );
127
132
  }
128
133
 
129
134
  /**
@@ -146,15 +151,23 @@ class SectionModel extends BaseModel {
146
151
  * Get tree of child sections
147
152
  */
148
153
  get childSections(): Array<SectionModel> {
149
- if (!this._childSections && this.data.childSections) {
150
- this._childSections = this.data.childSections
154
+ if (!this._childSections) {
155
+ let sections = [];
156
+ if (this.data.childSections) {
157
+ sections = this.data.childSections;
158
+ } else if (this.data.sections) {
159
+ sections = this.data.sections;
160
+ }
161
+
162
+ this._childSections = sections
151
163
  .filter((childSection) => "body" in childSection)
152
164
  .map(
153
165
  (childSection) =>
154
166
  new SectionModel(childSection, this.entryDate, this.modelOptions),
155
167
  );
156
168
  }
157
- return this._childSections || [];
169
+
170
+ return this._childSections;
158
171
  }
159
172
 
160
173
  /**
@@ -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","_context4","subSections","_context5","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 */\n get sections(): Array<SectionModel> {\n if (this.data.sections) {\n return this.data.sections.map(\n (section) =>\n new SectionModel(section, this.entryDate, this.modelOptions),\n );\n }\n return [];\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,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,EAAS;IACnB,OAAO,IAAI,CAACJ,QAAQ,CAACK,IAAI;EAC3B;;EAEA;AACF;EACE,IAAI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mBAAmB,CAAC,CAAC;MACzDN,QAAQ,CAACO,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,OAAOR,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","sections","childSections","_mapInstanceProperty","call","childSection","section","selfContentLink","_childSections","_context","_filterInstanceProperty","_context2","subSections","_context3","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 let sections = [];\n if (this.data.childSections) {\n sections = this.data.childSections;\n } else if (this.data.sections) {\n sections = this.data.sections;\n }\n\n return sections.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 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) {\n let sections = [];\n if (this.data.childSections) {\n sections = this.data.childSections;\n } else if (this.data.sections) {\n sections = this.data.sections;\n }\n\n this._childSections = sections\n .filter((childSection) => \"body\" in childSection)\n .map(\n (childSection) =>\n new SectionModel(childSection, this.entryDate, this.modelOptions),\n );\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 */\n get sections(): Array<SectionModel> {\n if (this.data.sections) {\n return this.data.sections.map(\n (section) =>\n new SectionModel(section, this.entryDate, this.modelOptions),\n );\n }\n return [];\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,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,E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W,EAAE;MACzC,IAAIE,UAAU,CAAC9B,QAAQ,EAAE;QACvBiB,QAAQ,CAACgB,IAAI,CAACH,UAAU,CAAC;MAC3B;MAEA,MAAMI,cAAc,GAAGJ,UAAU,CAACE,mBAAmB,CAAC,CAAC;MACvDf,QAAQ,CAACgB,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,KAAK,MAAMb,YAAY,IAAI,IAAI,CAACH,aAAa,EAAE;MAC7C,IAAIG,YAAY,CAACrB,QAAQ,EAAE;QACzBiB,QAAQ,CAACgB,IAAI,CAACZ,YAAY,CAAC;MAC7B;MAEA,MAAMa,cAAc,GAAGb,YAAY,CAACW,mBAAmB,CAAC,CAAC;MACzDf,QAAQ,CAACgB,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,OAAOjB,QAAQ;EACjB;AACF;AAEA,eAAexB,YAAY","ignoreList":[]}
@@ -8,6 +8,7 @@ import content from "./content.json";
8
8
  import contentWithSubsections from "./content-with-subsections.json";
9
9
  import contentWithSubsections2 from "./content-with-subsections2.json";
10
10
  import contentWithChildsections from "./content-with-childsections.json";
11
+ import contentWithSections from "./content-with-sections.json";
11
12
  import ContentLinkModel from "../ContentLinkModel";
12
13
 
13
14
  describe("contentmodel", () => {
@@ -119,6 +120,40 @@ describe("contentmodel", () => {
119
120
  );
120
121
  });
121
122
 
123
+ it("can handle content service with sections", () => {
124
+ const response = ModularUIResponse.create({
125
+ key: "contentmodel",
126
+ data: contentWithSections,
127
+ contributions,
128
+ });
129
+
130
+ expect(ContentModel.isApplicableModel(response)).toBe(true);
131
+
132
+ const contentModel = new ContentModel(response);
133
+ expect(contentModel.getInitialChildModelLinks()).toHaveLength(0);
134
+
135
+ expect(contentModel.id).toBe("uitslag");
136
+
137
+ expect(contentModel.childSectionLinks).toHaveLength(4);
138
+ expect(contentModel.childSections).toHaveLength(0);
139
+ expect(contentModel.subSections).toHaveLength(0);
140
+ expect(contentModel.relatedConceptsHrefs).toHaveLength(1);
141
+ expect(contentModel.relatedConceptsHref.href.toString()).toBe(
142
+ "/content/Incident/Business design/Content/Blaastest.textilesource/uitslag/relatedConcepts?entryDate=2021-08-31",
143
+ );
144
+ expect(contentModel.referenceHash).toBe(8236987459042);
145
+
146
+ const firstChildSectionLink = contentModel.childSectionLinks[0];
147
+ expect(firstChildSectionLink instanceof ContentLinkModel).toBe(true);
148
+
149
+ expect(firstChildSectionLink.key).toBe("pass");
150
+ expect(firstChildSectionLink.label).toBe("Pass");
151
+ expect(firstChildSectionLink.sourceLabel).toBeNull();
152
+ expect(firstChildSectionLink.encodedHref.toString()).toBe(
153
+ "/content/Incident%2FBusiness%20design%2FContent%2FBlaastest.textilesource/pass?entryDate=2021-08-31",
154
+ );
155
+ });
156
+
122
157
  it("can handle content service with subsections and correct related concepts", () => {
123
158
  const response = ModularUIResponse.create({
124
159
  key: "contentmodel",
@@ -201,7 +201,8 @@ export type SectionData = {
201
201
  number?: string,
202
202
  body: string | { id?: string, message: string, properties?: Object },
203
203
  _links: { self: { href: string } },
204
- childSections: Array<SectionData>,
204
+ childSections?: Array<SectionData>,
205
+ sections?: Array<SectionData>,
205
206
  subSections: Array<SectionData>,
206
207
  };
207
208
 
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/models/types.js"],"sourcesContent":["// @flow\nimport type ApplicationModel from \"./application/ApplicationModel\";\nimport type BooleanAttributeModel from \"./attributes/BooleanAttributeModel\";\nimport type CaptchaAttributeModel from \"./attributes/CaptchaAttributeModel\";\nimport type ChoiceAttributeModel from \"./attributes/ChoiceAttributeModel\";\nimport type CompositeAttributeModel from \"./attributes/CompositeAttributeModel\";\nimport type DatetimeAttributeModel from \"./attributes/DatetimeAttributeModel\";\nimport type HelptextAttributeModel from \"./attributes/HelptextAttributeModel\";\nimport type LabelAttributeModel from \"./attributes/LabelAttributeModel\";\nimport type MemoAttributeModel from \"./attributes/MemoAttributeModel\";\nimport type MoneyAttributeModel from \"./attributes/MoneyAttributeModel\";\nimport type NumberAttributeModel from \"./attributes/NumberAttributeModel\";\nimport type PasswordAttributeModel from \"./attributes/PasswordAttributeModel\";\nimport type StringAttributeModel from \"./attributes/StringAttributeModel\";\nimport type UploadAttributeModel from \"./attributes/UploadAttributeModel\";\nimport type XMLAttributeModel from \"./attributes/XMLAttributeModel\";\nimport type CaseViewModel from \"./caseview/CaseViewModel\";\nimport type BusinessScenarioModel from \"./concepts/BusinessScenarioModel\";\nimport type ConceptDetailModel from \"./concepts/ConceptDetailModel\";\nimport type ConceptIndexModel from \"./concepts/ConceptIndexModel\";\nimport type ConceptTypeDetailModel from \"./concepts/ConceptTypeDetailModel\";\nimport type ContentIndexModel from \"./content/ContentIndexModel\";\nimport type ContentModel from \"./content/ContentModel\";\nimport type SectionModel from \"./content/SectionModel\";\nimport type ContentTOCModel from \"./content/ContentTOCModel\";\nimport type ContentTypeModel from \"./content/ContentTypeModel\";\nimport type DetailModel from \"./detail/DetailModel\";\nimport type AssignmentFilterModel from \"./filters/AssignmentFilterModel\";\nimport type FilterModel from \"./filters/FilterModel\";\nimport type RangeFilterModel from \"./filters/RangeFilterModel\";\nimport type ConceptIndexFilterModel from \"./filters/ConceptIndexFilterModel\";\nimport type FormModel from \"./form/FormModel\";\nimport type ListDetailModel from \"./list/ListDetailModel\";\nimport type ListModel from \"./list/ListModel\";\nimport type ModelCatalogModel from \"./modelcatalog/ModelCatalogModel\";\nimport type GroupingPanelModel from \"./panels/GroupingPanelModel\";\nimport type CaseSearchModel from \"./search/CaseSearchModel\";\nimport type TabModel from \"./tab/TabModel\";\nimport type TaskGroupModel from \"./taskgroup/TaskGroupModel\";\nimport type UserModel from \"./user/UserModel\";\nimport type UserServicesModel from \"./user/UserServicesModel\";\nimport type LinkModel from \"./links/LinkModel\";\nimport type LookupOptionsModel from \"./lookup/LookupOptionsModel\";\nimport type BaseFilterModel from \"./filters/BaseFilterModel\";\nimport type AttributeCollection from \"./attributes/AttributeCollection\";\nimport type AttributeModel from \"./attributes/AttributeModel\";\nimport type LayoutHintCollection from \"./layouthint/LayoutHintCollection\";\nimport type ErrorResponse from \"./error/ErrorResponse\";\n\nexport type ModularUIModel =\n | ApplicationModel\n | CaseSearchModel\n | CaseViewModel\n | ListDetailModel\n | DetailModel\n | FormModel\n | GroupingPanelModel\n | ListModel\n | TabModel\n | TaskGroupModel\n | UserModel\n | UserServicesModel\n | ModelCatalogModel\n | ConceptIndexModel\n | ConceptDetailModel\n | BusinessScenarioModel\n | ConceptTypeDetailModel\n | ContentIndexModel\n | ContentTOCModel\n | ContentModel\n | ContentTypeModel\n | LookupOptionsModel;\n\nexport type AttributeType =\n | BooleanAttributeModel\n | CaptchaAttributeModel\n | ChoiceAttributeModel\n | DatetimeAttributeModel\n | HelptextAttributeModel\n | LabelAttributeModel\n | MemoAttributeModel\n | MoneyAttributeModel\n | NumberAttributeModel\n | PasswordAttributeModel\n | CompositeAttributeModel\n | StringAttributeModel\n | UploadAttributeModel\n | XMLAttributeModel;\n\nexport type RangeChildAttributeType =\n | NumberAttributeModel\n | DatetimeAttributeModel;\n\nexport type FilterType =\n | BaseFilterModel\n | FilterModel\n | AssignmentFilterModel\n | RangeFilterModel\n | ConceptIndexFilterModel;\n\nexport type FormErrorAnchor = {\n id: string,\n properties?: {\n [propertyName: string]: string | number,\n },\n anchor?: {\n objectid: string,\n elementid?: string,\n _links?: Object,\n index?: number,\n \"index-identifier\"?: string,\n },\n layouthint: LayoutHintCollection,\n message: string,\n param?: {\n name: string,\n },\n};\n\nexport type labelsJSON = {\n _id: string,\n label: string,\n value: string,\n};\n\nexport type propertyJSON = {\n _id: string,\n type: string,\n mandatory: string,\n label: string,\n value: string,\n};\n\nexport type textfragmentJSON = {\n label: string,\n text: string,\n type: string,\n};\n\nexport interface IConstraintModel {\n +id: string;\n +defaultMessage: string;\n +parameters: Object;\n +isMandatoryConstraint: boolean;\n validate(value: any): boolean;\n hasValidation(): boolean;\n}\n\nexport interface ILayoutHintRule {\n process(attribute: AttributeModel, attributes: AttributeCollection): void;\n}\n\nexport interface IModelWithChildModels {\n getInitialChildModelLinks(): Array<LinkModel>;\n setChildModels(\n models: Array<ModularUIModel>,\n errors: Array<ErrorResponse>,\n ): void;\n}\n\nexport type AuthenticationType = {\n name: string,\n authentication: string,\n redirectUri?: string,\n isPrimary: boolean,\n};\n\nexport type FileEntryType = {\n name: string,\n size?: number,\n progress: number,\n error?: string,\n token?: string,\n};\n\nexport type FilesType = {\n [filename: string]: FileEntryType,\n};\n\nexport type FiletypeConstraintsType = Array<{|\n extensions: Array<string>,\n mimeTypes: Array<string>,\n|}>;\n\nexport type FilesizeConstraintsType = {\n fileSize: ?number,\n maxTotalFileSize: ?number,\n isMaxTotal: boolean,\n};\n\nexport type PropertyData = { type: string, label: string, value: string };\nexport type TextFragmentData = {\n type: string,\n label: string,\n text: string | { id?: string, message: string, properties?: Object },\n};\nexport type SectionData = {\n id: string,\n type: string,\n label?: string,\n number?: string,\n body: string | { id?: string, message: string, properties?: Object },\n _links: { self: { href: string } },\n childSections: Array<SectionData>,\n subSections: Array<SectionData>,\n};\n\nexport type PropertyElement = {\n propertyElement: {\n label: string,\n layouthint: Array<string>,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElement = {\n textFragmentElement: {\n label: string,\n layouthint: Array<string>,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElement = {\n contentElement: {\n label: string,\n layouthint: Array<string>,\n sections: Array<SectionData>,\n },\n};\n\nexport type PropertyElementMapped = {\n propertyElement: {\n label: string,\n layouthint: LayoutHintCollection,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElementMapped = {\n textFragmentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElementMapped = {\n contentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n sections: Array<SectionModel>,\n },\n};\n\nexport type ContentAll = Array<\n PropertyElementMapped | TextFragmentElementMapped | ContentElementMapped,\n>;\n\nexport type ContentData = {\n header: {\n label?: string,\n description?: { id?: string, message: string, properties?: Object },\n },\n label?: string,\n elements: Array<PropertyElement | TextFragmentElement | ContentElement>,\n};\n\nexport type SectionFragment = {\n text: string,\n startOffset: number,\n endOffset: number,\n};\n\nexport type ModelOptions = {\n origin?: ?string,\n contextPath?: ?string,\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/models/types.js"],"sourcesContent":["// @flow\nimport type ApplicationModel from \"./application/ApplicationModel\";\nimport type BooleanAttributeModel from \"./attributes/BooleanAttributeModel\";\nimport type CaptchaAttributeModel from \"./attributes/CaptchaAttributeModel\";\nimport type ChoiceAttributeModel from \"./attributes/ChoiceAttributeModel\";\nimport type CompositeAttributeModel from \"./attributes/CompositeAttributeModel\";\nimport type DatetimeAttributeModel from \"./attributes/DatetimeAttributeModel\";\nimport type HelptextAttributeModel from \"./attributes/HelptextAttributeModel\";\nimport type LabelAttributeModel from \"./attributes/LabelAttributeModel\";\nimport type MemoAttributeModel from \"./attributes/MemoAttributeModel\";\nimport type MoneyAttributeModel from \"./attributes/MoneyAttributeModel\";\nimport type NumberAttributeModel from \"./attributes/NumberAttributeModel\";\nimport type PasswordAttributeModel from \"./attributes/PasswordAttributeModel\";\nimport type StringAttributeModel from \"./attributes/StringAttributeModel\";\nimport type UploadAttributeModel from \"./attributes/UploadAttributeModel\";\nimport type XMLAttributeModel from \"./attributes/XMLAttributeModel\";\nimport type CaseViewModel from \"./caseview/CaseViewModel\";\nimport type BusinessScenarioModel from \"./concepts/BusinessScenarioModel\";\nimport type ConceptDetailModel from \"./concepts/ConceptDetailModel\";\nimport type ConceptIndexModel from \"./concepts/ConceptIndexModel\";\nimport type ConceptTypeDetailModel from \"./concepts/ConceptTypeDetailModel\";\nimport type ContentIndexModel from \"./content/ContentIndexModel\";\nimport type ContentModel from \"./content/ContentModel\";\nimport type SectionModel from \"./content/SectionModel\";\nimport type ContentTOCModel from \"./content/ContentTOCModel\";\nimport type ContentTypeModel from \"./content/ContentTypeModel\";\nimport type DetailModel from \"./detail/DetailModel\";\nimport type AssignmentFilterModel from \"./filters/AssignmentFilterModel\";\nimport type FilterModel from \"./filters/FilterModel\";\nimport type RangeFilterModel from \"./filters/RangeFilterModel\";\nimport type ConceptIndexFilterModel from \"./filters/ConceptIndexFilterModel\";\nimport type FormModel from \"./form/FormModel\";\nimport type ListDetailModel from \"./list/ListDetailModel\";\nimport type ListModel from \"./list/ListModel\";\nimport type ModelCatalogModel from \"./modelcatalog/ModelCatalogModel\";\nimport type GroupingPanelModel from \"./panels/GroupingPanelModel\";\nimport type CaseSearchModel from \"./search/CaseSearchModel\";\nimport type TabModel from \"./tab/TabModel\";\nimport type TaskGroupModel from \"./taskgroup/TaskGroupModel\";\nimport type UserModel from \"./user/UserModel\";\nimport type UserServicesModel from \"./user/UserServicesModel\";\nimport type LinkModel from \"./links/LinkModel\";\nimport type LookupOptionsModel from \"./lookup/LookupOptionsModel\";\nimport type BaseFilterModel from \"./filters/BaseFilterModel\";\nimport type AttributeCollection from \"./attributes/AttributeCollection\";\nimport type AttributeModel from \"./attributes/AttributeModel\";\nimport type LayoutHintCollection from \"./layouthint/LayoutHintCollection\";\nimport type ErrorResponse from \"./error/ErrorResponse\";\n\nexport type ModularUIModel =\n | ApplicationModel\n | CaseSearchModel\n | CaseViewModel\n | ListDetailModel\n | DetailModel\n | FormModel\n | GroupingPanelModel\n | ListModel\n | TabModel\n | TaskGroupModel\n | UserModel\n | UserServicesModel\n | ModelCatalogModel\n | ConceptIndexModel\n | ConceptDetailModel\n | BusinessScenarioModel\n | ConceptTypeDetailModel\n | ContentIndexModel\n | ContentTOCModel\n | ContentModel\n | ContentTypeModel\n | LookupOptionsModel;\n\nexport type AttributeType =\n | BooleanAttributeModel\n | CaptchaAttributeModel\n | ChoiceAttributeModel\n | DatetimeAttributeModel\n | HelptextAttributeModel\n | LabelAttributeModel\n | MemoAttributeModel\n | MoneyAttributeModel\n | NumberAttributeModel\n | PasswordAttributeModel\n | CompositeAttributeModel\n | StringAttributeModel\n | UploadAttributeModel\n | XMLAttributeModel;\n\nexport type RangeChildAttributeType =\n | NumberAttributeModel\n | DatetimeAttributeModel;\n\nexport type FilterType =\n | BaseFilterModel\n | FilterModel\n | AssignmentFilterModel\n | RangeFilterModel\n | ConceptIndexFilterModel;\n\nexport type FormErrorAnchor = {\n id: string,\n properties?: {\n [propertyName: string]: string | number,\n },\n anchor?: {\n objectid: string,\n elementid?: string,\n _links?: Object,\n index?: number,\n \"index-identifier\"?: string,\n },\n layouthint: LayoutHintCollection,\n message: string,\n param?: {\n name: string,\n },\n};\n\nexport type labelsJSON = {\n _id: string,\n label: string,\n value: string,\n};\n\nexport type propertyJSON = {\n _id: string,\n type: string,\n mandatory: string,\n label: string,\n value: string,\n};\n\nexport type textfragmentJSON = {\n label: string,\n text: string,\n type: string,\n};\n\nexport interface IConstraintModel {\n +id: string;\n +defaultMessage: string;\n +parameters: Object;\n +isMandatoryConstraint: boolean;\n validate(value: any): boolean;\n hasValidation(): boolean;\n}\n\nexport interface ILayoutHintRule {\n process(attribute: AttributeModel, attributes: AttributeCollection): void;\n}\n\nexport interface IModelWithChildModels {\n getInitialChildModelLinks(): Array<LinkModel>;\n setChildModels(\n models: Array<ModularUIModel>,\n errors: Array<ErrorResponse>,\n ): void;\n}\n\nexport type AuthenticationType = {\n name: string,\n authentication: string,\n redirectUri?: string,\n isPrimary: boolean,\n};\n\nexport type FileEntryType = {\n name: string,\n size?: number,\n progress: number,\n error?: string,\n token?: string,\n};\n\nexport type FilesType = {\n [filename: string]: FileEntryType,\n};\n\nexport type FiletypeConstraintsType = Array<{|\n extensions: Array<string>,\n mimeTypes: Array<string>,\n|}>;\n\nexport type FilesizeConstraintsType = {\n fileSize: ?number,\n maxTotalFileSize: ?number,\n isMaxTotal: boolean,\n};\n\nexport type PropertyData = { type: string, label: string, value: string };\nexport type TextFragmentData = {\n type: string,\n label: string,\n text: string | { id?: string, message: string, properties?: Object },\n};\nexport type SectionData = {\n id: string,\n type: string,\n label?: string,\n number?: string,\n body: string | { id?: string, message: string, properties?: Object },\n _links: { self: { href: string } },\n childSections?: Array<SectionData>,\n sections?: Array<SectionData>,\n subSections: Array<SectionData>,\n};\n\nexport type PropertyElement = {\n propertyElement: {\n label: string,\n layouthint: Array<string>,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElement = {\n textFragmentElement: {\n label: string,\n layouthint: Array<string>,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElement = {\n contentElement: {\n label: string,\n layouthint: Array<string>,\n sections: Array<SectionData>,\n },\n};\n\nexport type PropertyElementMapped = {\n propertyElement: {\n label: string,\n layouthint: LayoutHintCollection,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElementMapped = {\n textFragmentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElementMapped = {\n contentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n sections: Array<SectionModel>,\n },\n};\n\nexport type ContentAll = Array<\n PropertyElementMapped | TextFragmentElementMapped | ContentElementMapped,\n>;\n\nexport type ContentData = {\n header: {\n label?: string,\n description?: { id?: string, message: string, properties?: Object },\n },\n label?: string,\n elements: Array<PropertyElement | TextFragmentElement | ContentElement>,\n};\n\nexport type SectionFragment = {\n text: string,\n startOffset: number,\n endOffset: number,\n};\n\nexport type ModelOptions = {\n origin?: ?string,\n contextPath?: ?string,\n};\n"],"mappings":"","ignoreList":[]}
@@ -92,7 +92,7 @@ describe("requestInformation", () => {
92
92
  queryString: "q=hello world&filter=test",
93
93
  });
94
94
  expect(getFullRequestUrl(request)).toBe(
95
- "/search?q%3Dhello%20world%26filter%3Dtest",
95
+ "/search?q=hello%20world&filter=test",
96
96
  );
97
97
  });
98
98
 
@@ -120,7 +120,7 @@ describe("requestInformation", () => {
120
120
  queryString: "name=John Doe & email=john@example.com",
121
121
  });
122
122
  expect(getFullRequestUrl(request)).toBe(
123
- "/api/data?name%3DJohn%20Doe%20%26%20email%3Djohn%40example.com",
123
+ "/api/data?name=John%20Doe%20&%20email=john%40example.com",
124
124
  );
125
125
  });
126
126
 
@@ -144,11 +144,11 @@ describe("requestInformation", () => {
144
144
  // Verify that Href constructor was called with the correct URL
145
145
  expect(require("../../models/href/Href")).toHaveBeenCalledTimes(1);
146
146
  expect(require("../../models/href/Href")).toHaveBeenCalledWith(
147
- "/products?id%3D123",
147
+ "/products?id=123",
148
148
  );
149
149
 
150
150
  // Verify the returned object is an instance of the mock Href
151
- expect(hrefInstance.url).toBe("/products?id%3D123");
151
+ expect(hrefInstance.url).toBe("/products?id=123");
152
152
  });
153
153
 
154
154
  it("should handle complex URLs and pass them to Href", () => {
@@ -158,10 +158,10 @@ describe("requestInformation", () => {
158
158
  });
159
159
  const hrefInstance = getFullRequestHref(request);
160
160
  expect(require("../../models/href/Href")).toHaveBeenCalledWith(
161
- "/search/results?q%3Djavascript%2520xss%26param%3Dvalue",
161
+ "/search/results?q=javascript%2520xss&param=value",
162
162
  );
163
163
  expect(hrefInstance.url).toBe(
164
- "/search/results?q%3Djavascript%2520xss%26param%3Dvalue",
164
+ "/search/results?q=javascript%2520xss&param=value",
165
165
  );
166
166
  });
167
167
  });
@@ -1,5 +1,21 @@
1
1
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
2
2
  import Href from "../models/href/Href";
3
+ /**
4
+ */
5
+ const encodeQueryString = queryString => {
6
+ if (!queryString) return "";
7
+ const params = [];
8
+ queryString.split("&").forEach(part => {
9
+ const [key, value] = part.split("=");
10
+ if (key && value) {
11
+ params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
12
+ } else if (key) {
13
+ params.push(encodeURIComponent(key));
14
+ }
15
+ });
16
+ return params.join("&");
17
+ };
18
+
3
19
  /**
4
20
  */
5
21
  export const getFullRequestUrl = request => {
@@ -8,7 +24,7 @@ export const getFullRequestUrl = request => {
8
24
  let queryString = request.getQueryString();
9
25
  pathInfo = _mapInstanceProperty(_context = pathInfo.split("/")).call(_context, segment => encodeURIComponent(segment)).join("/");
10
26
  if (queryString) {
11
- return `${pathInfo}?${encodeURIComponent(queryString)}`;
27
+ return `${pathInfo}?${encodeQueryString(queryString)}`;
12
28
  }
13
29
  return pathInfo;
14
30
  };
@@ -3,6 +3,23 @@ import Href from "../models/href/Href";
3
3
 
4
4
  import type Locales from "../i18n/Locales";
5
5
 
6
+ /**
7
+ */
8
+ const encodeQueryString = (queryString: string) => {
9
+ if (!queryString) return "";
10
+
11
+ const params = [];
12
+ queryString.split("&").forEach((part) => {
13
+ const [key, value] = part.split("=");
14
+ if (key && value) {
15
+ params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
16
+ } else if (key) {
17
+ params.push(encodeURIComponent(key));
18
+ }
19
+ });
20
+ return params.join("&");
21
+ };
22
+
6
23
  /**
7
24
  */
8
25
  export const getFullRequestUrl = (request: HttpServletRequestJava): string => {
@@ -15,7 +32,7 @@ export const getFullRequestUrl = (request: HttpServletRequestJava): string => {
15
32
  .join("/");
16
33
 
17
34
  if (queryString) {
18
- return `${pathInfo}?${encodeURIComponent(queryString)}`;
35
+ return `${pathInfo}?${encodeQueryString(queryString)}`;
19
36
  }
20
37
 
21
38
  return pathInfo;
@@ -1 +1 @@
1
- {"version":3,"file":"requestInformation.js","names":["Href","getFullRequestUrl","request","_context","pathInfo","getPathInfo","queryString","getQueryString","_mapInstanceProperty","split","call","segment","encodeURIComponent","join","getFullRequestHref","getCookieFromRequest","cookieName","getCookieByName","getPreferredLocale","locales","languageFromCookie","acceptLanguageHeader","getHeader","availableLocaleCodes"],"sources":["../../src/react-server/requestInformation.js"],"sourcesContent":["// @flow\nimport Href from \"../models/href/Href\";\n\nimport type Locales from \"../i18n/Locales\";\n\n/**\n */\nexport const getFullRequestUrl = (request: HttpServletRequestJava): string => {\n let pathInfo = request.getPathInfo() || \"/\";\n let queryString = request.getQueryString();\n\n pathInfo = pathInfo\n .split(\"/\")\n .map((segment) => encodeURIComponent(segment))\n .join(\"/\");\n\n if (queryString) {\n return `${pathInfo}?${encodeURIComponent(queryString)}`;\n }\n\n return pathInfo;\n};\n\n/**\n */\nexport const getFullRequestHref = (request: HttpServletRequestJava): Href =>\n new Href(getFullRequestUrl(request));\n\n/**\n */\nexport const getCookieFromRequest = (\n request: HttpServletRequestJava,\n cookieName: string,\n): null | string => {\n return request.getCookieByName(cookieName);\n};\n\n/**\n */\nexport const getPreferredLocale = (\n request: HttpServletRequestJava,\n locales: Locales,\n): void | string => {\n const languageFromCookie = getCookieFromRequest(request, \"locale\");\n const acceptLanguageHeader =\n languageFromCookie || request.getHeader(\"Accept-Language\");\n\n // when no accept language header or cookie present, get first locale code\n if (acceptLanguageHeader === null) {\n return locales.availableLocaleCodes[0];\n }\n\n return locales.getPreferredLocale(acceptLanguageHeader);\n};\n"],"mappings":";AACA,OAAOA,IAAI,MAAM,qBAAqB;AAItC;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAIC,OAA+B,IAAa;EAAA,IAAAC,QAAA;EAC5E,IAAIC,QAAQ,GAAGF,OAAO,CAACG,WAAW,CAAC,CAAC,IAAI,GAAG;EAC3C,IAAIC,WAAW,GAAGJ,OAAO,CAACK,cAAc,CAAC,CAAC;EAE1CH,QAAQ,GAAGI,oBAAA,CAAAL,QAAA,GAAAC,QAAQ,CAChBK,KAAK,CAAC,GAAG,CAAC,EAAAC,IAAA,CAAAP,QAAA,EACLQ,OAAO,IAAKC,kBAAkB,CAACD,OAAO,CAAC,CAAC,CAC7CE,IAAI,CAAC,GAAG,CAAC;EAEZ,IAAIP,WAAW,EAAE;IACf,OAAO,GAAGF,QAAQ,IAAIQ,kBAAkB,CAACN,WAAW,CAAC,EAAE;EACzD;EAEA,OAAOF,QAAQ;AACjB,CAAC;;AAED;AACA;AACA,OAAO,MAAMU,kBAAkB,GAAIZ,OAA+B,IAChE,IAAIF,IAAI,CAACC,iBAAiB,CAACC,OAAO,CAAC,CAAC;;AAEtC;AACA;AACA,OAAO,MAAMa,oBAAoB,GAAGA,CAClCb,OAA+B,EAC/Bc,UAAkB,KACA;EAClB,OAAOd,OAAO,CAACe,eAAe,CAACD,UAAU,CAAC;AAC5C,CAAC;;AAED;AACA;AACA,OAAO,MAAME,kBAAkB,GAAGA,CAChChB,OAA+B,EAC/BiB,OAAgB,KACE;EAClB,MAAMC,kBAAkB,GAAGL,oBAAoB,CAACb,OAAO,EAAE,QAAQ,CAAC;EAClE,MAAMmB,oBAAoB,GACxBD,kBAAkB,IAAIlB,OAAO,CAACoB,SAAS,CAAC,iBAAiB,CAAC;;EAE5D;EACA,IAAID,oBAAoB,KAAK,IAAI,EAAE;IACjC,OAAOF,OAAO,CAACI,oBAAoB,CAAC,CAAC,CAAC;EACxC;EAEA,OAAOJ,OAAO,CAACD,kBAAkB,CAACG,oBAAoB,CAAC;AACzD,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"requestInformation.js","names":["Href","encodeQueryString","queryString","params","split","forEach","part","key","value","push","encodeURIComponent","join","getFullRequestUrl","request","_context","pathInfo","getPathInfo","getQueryString","_mapInstanceProperty","call","segment","getFullRequestHref","getCookieFromRequest","cookieName","getCookieByName","getPreferredLocale","locales","languageFromCookie","acceptLanguageHeader","getHeader","availableLocaleCodes"],"sources":["../../src/react-server/requestInformation.js"],"sourcesContent":["// @flow\nimport Href from \"../models/href/Href\";\n\nimport type Locales from \"../i18n/Locales\";\n\n/**\n */\nconst encodeQueryString = (queryString: string) => {\n if (!queryString) return \"\";\n\n const params = [];\n queryString.split(\"&\").forEach((part) => {\n const [key, value] = part.split(\"=\");\n if (key && value) {\n params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);\n } else if (key) {\n params.push(encodeURIComponent(key));\n }\n });\n return params.join(\"&\");\n};\n\n/**\n */\nexport const getFullRequestUrl = (request: HttpServletRequestJava): string => {\n let pathInfo = request.getPathInfo() || \"/\";\n let queryString = request.getQueryString();\n\n pathInfo = pathInfo\n .split(\"/\")\n .map((segment) => encodeURIComponent(segment))\n .join(\"/\");\n\n if (queryString) {\n return `${pathInfo}?${encodeQueryString(queryString)}`;\n }\n\n return pathInfo;\n};\n\n/**\n */\nexport const getFullRequestHref = (request: HttpServletRequestJava): Href =>\n new Href(getFullRequestUrl(request));\n\n/**\n */\nexport const getCookieFromRequest = (\n request: HttpServletRequestJava,\n cookieName: string,\n): null | string => {\n return request.getCookieByName(cookieName);\n};\n\n/**\n */\nexport const getPreferredLocale = (\n request: HttpServletRequestJava,\n locales: Locales,\n): void | string => {\n const languageFromCookie = getCookieFromRequest(request, \"locale\");\n const acceptLanguageHeader =\n languageFromCookie || request.getHeader(\"Accept-Language\");\n\n // when no accept language header or cookie present, get first locale code\n if (acceptLanguageHeader === null) {\n return locales.availableLocaleCodes[0];\n }\n\n return locales.getPreferredLocale(acceptLanguageHeader);\n};\n"],"mappings":";AACA,OAAOA,IAAI,MAAM,qBAAqB;AAItC;AACA;AACA,MAAMC,iBAAiB,GAAIC,WAAmB,IAAK;EACjD,IAAI,CAACA,WAAW,EAAE,OAAO,EAAE;EAE3B,MAAMC,MAAM,GAAG,EAAE;EACjBD,WAAW,CAACE,KAAK,CAAC,GAAG,CAAC,CAACC,OAAO,CAAEC,IAAI,IAAK;IACvC,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAGF,IAAI,CAACF,KAAK,CAAC,GAAG,CAAC;IACpC,IAAIG,GAAG,IAAIC,KAAK,EAAE;MAChBL,MAAM,CAACM,IAAI,CAAC,GAAGC,kBAAkB,CAACH,GAAG,CAAC,IAAIG,kBAAkB,CAACF,KAAK,CAAC,EAAE,CAAC;IACxE,CAAC,MAAM,IAAID,GAAG,EAAE;MACdJ,MAAM,CAACM,IAAI,CAACC,kBAAkB,CAACH,GAAG,CAAC,CAAC;IACtC;EACF,CAAC,CAAC;EACF,OAAOJ,MAAM,CAACQ,IAAI,CAAC,GAAG,CAAC;AACzB,CAAC;;AAED;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAIC,OAA+B,IAAa;EAAA,IAAAC,QAAA;EAC5E,IAAIC,QAAQ,GAAGF,OAAO,CAACG,WAAW,CAAC,CAAC,IAAI,GAAG;EAC3C,IAAId,WAAW,GAAGW,OAAO,CAACI,cAAc,CAAC,CAAC;EAE1CF,QAAQ,GAAGG,oBAAA,CAAAJ,QAAA,GAAAC,QAAQ,CAChBX,KAAK,CAAC,GAAG,CAAC,EAAAe,IAAA,CAAAL,QAAA,EACLM,OAAO,IAAKV,kBAAkB,CAACU,OAAO,CAAC,CAAC,CAC7CT,IAAI,CAAC,GAAG,CAAC;EAEZ,IAAIT,WAAW,EAAE;IACf,OAAO,GAAGa,QAAQ,IAAId,iBAAiB,CAACC,WAAW,CAAC,EAAE;EACxD;EAEA,OAAOa,QAAQ;AACjB,CAAC;;AAED;AACA;AACA,OAAO,MAAMM,kBAAkB,GAAIR,OAA+B,IAChE,IAAIb,IAAI,CAACY,iBAAiB,CAACC,OAAO,CAAC,CAAC;;AAEtC;AACA;AACA,OAAO,MAAMS,oBAAoB,GAAGA,CAClCT,OAA+B,EAC/BU,UAAkB,KACA;EAClB,OAAOV,OAAO,CAACW,eAAe,CAACD,UAAU,CAAC;AAC5C,CAAC;;AAED;AACA;AACA,OAAO,MAAME,kBAAkB,GAAGA,CAChCZ,OAA+B,EAC/Ba,OAAgB,KACE;EAClB,MAAMC,kBAAkB,GAAGL,oBAAoB,CAACT,OAAO,EAAE,QAAQ,CAAC;EAClE,MAAMe,oBAAoB,GACxBD,kBAAkB,IAAId,OAAO,CAACgB,SAAS,CAAC,iBAAiB,CAAC;;EAE5D;EACA,IAAID,oBAAoB,KAAK,IAAI,EAAE;IACjC,OAAOF,OAAO,CAACI,oBAAoB,CAAC,CAAC,CAAC;EACxC;EAEA,OAAOJ,OAAO,CAACD,kBAAkB,CAACG,oBAAoB,CAAC;AACzD,CAAC","ignoreList":[]}
@@ -101,14 +101,19 @@ class SectionModel extends _BaseModel.default {
101
101
  * Retrieve child section links
102
102
  */
103
103
  get childSectionLinks() {
104
- var _context;
105
- return this.data.childSections ? (0, _map.default)(_context = this.data.childSections).call(_context, childSection => new _ContentLinkModel.default({
104
+ let sections = [];
105
+ if (this.data.childSections) {
106
+ sections = this.data.childSections;
107
+ } else if (this.data.sections) {
108
+ sections = this.data.sections;
109
+ }
110
+ return (0, _map.default)(sections).call(sections, childSection => new _ContentLinkModel.default({
106
111
  section: childSection.id || childSection._id,
107
112
  _id: childSection.id || childSection._id,
108
113
  label: childSection.label,
109
114
  sourceLabel: childSection.sourceLabel,
110
115
  _links: childSection._links
111
- }, this.entryDate, this.modelOptions)) : [];
116
+ }, this.entryDate, this.modelOptions));
112
117
  }
113
118
 
114
119
  /**
@@ -127,11 +132,17 @@ class SectionModel extends _BaseModel.default {
127
132
  * Get tree of child sections
128
133
  */
129
134
  get childSections() {
130
- if (!this._childSections && this.data.childSections) {
131
- var _context2, _context3;
132
- this._childSections = (0, _map.default)(_context2 = (0, _filter.default)(_context3 = this.data.childSections).call(_context3, childSection => "body" in childSection)).call(_context2, childSection => new SectionModel(childSection, this.entryDate, this.modelOptions));
135
+ if (!this._childSections) {
136
+ var _context;
137
+ let sections = [];
138
+ if (this.data.childSections) {
139
+ sections = this.data.childSections;
140
+ } else if (this.data.sections) {
141
+ sections = this.data.sections;
142
+ }
143
+ this._childSections = (0, _map.default)(_context = (0, _filter.default)(sections).call(sections, childSection => "body" in childSection)).call(_context, childSection => new SectionModel(childSection, this.entryDate, this.modelOptions));
133
144
  }
134
- return this._childSections || [];
145
+ return this._childSections;
135
146
  }
136
147
 
137
148
  /**
@@ -145,8 +156,8 @@ class SectionModel extends _BaseModel.default {
145
156
  */
146
157
  get sections() {
147
158
  if (this.data.sections) {
148
- var _context4;
149
- return (0, _map.default)(_context4 = this.data.sections).call(_context4, section => new SectionModel(section, this.entryDate, this.modelOptions));
159
+ var _context2;
160
+ return (0, _map.default)(_context2 = this.data.sections).call(_context2, section => new SectionModel(section, this.entryDate, this.modelOptions));
150
161
  }
151
162
  return [];
152
163
  }
@@ -154,8 +165,8 @@ class SectionModel extends _BaseModel.default {
154
165
  * Get sub sections
155
166
  */
156
167
  get subSections() {
157
- var _context5;
158
- return this.data.subSections ? (0, _map.default)(_context5 = this.data.subSections).call(_context5, subSection => new _SubSectionModel.default(subSection, this.entryDate, this.modelOptions)) : [];
168
+ var _context3;
169
+ return this.data.subSections ? (0, _map.default)(_context3 = this.data.subSections).call(_context3, subSection => new _SubSectionModel.default(subSection, this.entryDate, this.modelOptions)) : [];
159
170
  }
160
171
 
161
172
  /**
@@ -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","_context4","subSections","_context5","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 */\n get sections(): Array<SectionModel> {\n if (this.data.sections) {\n return this.data.sections.map(\n (section) =>\n new SectionModel(section, this.entryDate, this.modelOptions),\n );\n }\n return [];\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,IAAI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AG,EAAE;IAEnB,KAAK,MAAMI,UAAU,IAAI,IAAI,CAACF,WAAW,EAAE;MACzC,IAAIE,UAAU,CAACnC,QAAQ,EAAE;QACvB+B,QAAQ,CAACS,IAAI,CAACL,UAAU,CAAC;MAC3B;MAEA,MAAMM,cAAc,GAAGN,UAAU,CAACI,mBAAmB,CAAC,CAAC;MACvDR,QAAQ,CAACS,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,KAAK,MAAMlB,YAAY,IAAI,IAAI,CAACH,aAAa,EAAE;MAC7C,IAAIG,YAAY,CAACvB,QAAQ,EAAE;QACzB+B,QAAQ,CAACS,IAAI,CAACjB,YAAY,CAAC;MAC7B;MAEA,MAAMkB,cAAc,GAAGlB,YAAY,CAACgB,mBAAmB,CAAC,CAAC;MACzDR,QAAQ,CAACS,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,OAAOV,QAAQ;EACjB;AACF;AAAC,IAAAW,QAAA,GAAAC,OAAA,CAAA7C,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","sections","childSections","_map","call","childSection","ContentLinkModel","section","selfContentLink","_childSections","_context","_filter","_context2","subSections","_context3","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 let sections = [];\n if (this.data.childSections) {\n sections = this.data.childSections;\n } else if (this.data.sections) {\n sections = this.data.sections;\n }\n\n return sections.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 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) {\n let sections = [];\n if (this.data.childSections) {\n sections = this.data.childSections;\n } else if (this.data.sections) {\n sections = this.data.sections;\n }\n\n this._childSections = sections\n .filter((childSection) => \"body\" in childSection)\n .map(\n (childSection) =>\n new SectionModel(childSection, this.entryDate, this.modelOptions),\n );\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 */\n get sections(): Array<SectionModel> {\n if (this.data.sections) {\n return this.data.sections.map(\n (section) =>\n new SectionModel(section, this.entryDate, this.modelOptions),\n );\n }\n return [];\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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AC;MACzDlB,QAAQ,CAACmB,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,OAAOpB,QAAQ;EACjB;AACF;AAAC,IAAAqB,QAAA,GAAAC,OAAA,CAAA3C,OAAA,GAEcP,YAAY","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/models/types.js"],"sourcesContent":["// @flow\nimport type ApplicationModel from \"./application/ApplicationModel\";\nimport type BooleanAttributeModel from \"./attributes/BooleanAttributeModel\";\nimport type CaptchaAttributeModel from \"./attributes/CaptchaAttributeModel\";\nimport type ChoiceAttributeModel from \"./attributes/ChoiceAttributeModel\";\nimport type CompositeAttributeModel from \"./attributes/CompositeAttributeModel\";\nimport type DatetimeAttributeModel from \"./attributes/DatetimeAttributeModel\";\nimport type HelptextAttributeModel from \"./attributes/HelptextAttributeModel\";\nimport type LabelAttributeModel from \"./attributes/LabelAttributeModel\";\nimport type MemoAttributeModel from \"./attributes/MemoAttributeModel\";\nimport type MoneyAttributeModel from \"./attributes/MoneyAttributeModel\";\nimport type NumberAttributeModel from \"./attributes/NumberAttributeModel\";\nimport type PasswordAttributeModel from \"./attributes/PasswordAttributeModel\";\nimport type StringAttributeModel from \"./attributes/StringAttributeModel\";\nimport type UploadAttributeModel from \"./attributes/UploadAttributeModel\";\nimport type XMLAttributeModel from \"./attributes/XMLAttributeModel\";\nimport type CaseViewModel from \"./caseview/CaseViewModel\";\nimport type BusinessScenarioModel from \"./concepts/BusinessScenarioModel\";\nimport type ConceptDetailModel from \"./concepts/ConceptDetailModel\";\nimport type ConceptIndexModel from \"./concepts/ConceptIndexModel\";\nimport type ConceptTypeDetailModel from \"./concepts/ConceptTypeDetailModel\";\nimport type ContentIndexModel from \"./content/ContentIndexModel\";\nimport type ContentModel from \"./content/ContentModel\";\nimport type SectionModel from \"./content/SectionModel\";\nimport type ContentTOCModel from \"./content/ContentTOCModel\";\nimport type ContentTypeModel from \"./content/ContentTypeModel\";\nimport type DetailModel from \"./detail/DetailModel\";\nimport type AssignmentFilterModel from \"./filters/AssignmentFilterModel\";\nimport type FilterModel from \"./filters/FilterModel\";\nimport type RangeFilterModel from \"./filters/RangeFilterModel\";\nimport type ConceptIndexFilterModel from \"./filters/ConceptIndexFilterModel\";\nimport type FormModel from \"./form/FormModel\";\nimport type ListDetailModel from \"./list/ListDetailModel\";\nimport type ListModel from \"./list/ListModel\";\nimport type ModelCatalogModel from \"./modelcatalog/ModelCatalogModel\";\nimport type GroupingPanelModel from \"./panels/GroupingPanelModel\";\nimport type CaseSearchModel from \"./search/CaseSearchModel\";\nimport type TabModel from \"./tab/TabModel\";\nimport type TaskGroupModel from \"./taskgroup/TaskGroupModel\";\nimport type UserModel from \"./user/UserModel\";\nimport type UserServicesModel from \"./user/UserServicesModel\";\nimport type LinkModel from \"./links/LinkModel\";\nimport type LookupOptionsModel from \"./lookup/LookupOptionsModel\";\nimport type BaseFilterModel from \"./filters/BaseFilterModel\";\nimport type AttributeCollection from \"./attributes/AttributeCollection\";\nimport type AttributeModel from \"./attributes/AttributeModel\";\nimport type LayoutHintCollection from \"./layouthint/LayoutHintCollection\";\nimport type ErrorResponse from \"./error/ErrorResponse\";\n\nexport type ModularUIModel =\n | ApplicationModel\n | CaseSearchModel\n | CaseViewModel\n | ListDetailModel\n | DetailModel\n | FormModel\n | GroupingPanelModel\n | ListModel\n | TabModel\n | TaskGroupModel\n | UserModel\n | UserServicesModel\n | ModelCatalogModel\n | ConceptIndexModel\n | ConceptDetailModel\n | BusinessScenarioModel\n | ConceptTypeDetailModel\n | ContentIndexModel\n | ContentTOCModel\n | ContentModel\n | ContentTypeModel\n | LookupOptionsModel;\n\nexport type AttributeType =\n | BooleanAttributeModel\n | CaptchaAttributeModel\n | ChoiceAttributeModel\n | DatetimeAttributeModel\n | HelptextAttributeModel\n | LabelAttributeModel\n | MemoAttributeModel\n | MoneyAttributeModel\n | NumberAttributeModel\n | PasswordAttributeModel\n | CompositeAttributeModel\n | StringAttributeModel\n | UploadAttributeModel\n | XMLAttributeModel;\n\nexport type RangeChildAttributeType =\n | NumberAttributeModel\n | DatetimeAttributeModel;\n\nexport type FilterType =\n | BaseFilterModel\n | FilterModel\n | AssignmentFilterModel\n | RangeFilterModel\n | ConceptIndexFilterModel;\n\nexport type FormErrorAnchor = {\n id: string,\n properties?: {\n [propertyName: string]: string | number,\n },\n anchor?: {\n objectid: string,\n elementid?: string,\n _links?: Object,\n index?: number,\n \"index-identifier\"?: string,\n },\n layouthint: LayoutHintCollection,\n message: string,\n param?: {\n name: string,\n },\n};\n\nexport type labelsJSON = {\n _id: string,\n label: string,\n value: string,\n};\n\nexport type propertyJSON = {\n _id: string,\n type: string,\n mandatory: string,\n label: string,\n value: string,\n};\n\nexport type textfragmentJSON = {\n label: string,\n text: string,\n type: string,\n};\n\nexport interface IConstraintModel {\n +id: string;\n +defaultMessage: string;\n +parameters: Object;\n +isMandatoryConstraint: boolean;\n validate(value: any): boolean;\n hasValidation(): boolean;\n}\n\nexport interface ILayoutHintRule {\n process(attribute: AttributeModel, attributes: AttributeCollection): void;\n}\n\nexport interface IModelWithChildModels {\n getInitialChildModelLinks(): Array<LinkModel>;\n setChildModels(\n models: Array<ModularUIModel>,\n errors: Array<ErrorResponse>,\n ): void;\n}\n\nexport type AuthenticationType = {\n name: string,\n authentication: string,\n redirectUri?: string,\n isPrimary: boolean,\n};\n\nexport type FileEntryType = {\n name: string,\n size?: number,\n progress: number,\n error?: string,\n token?: string,\n};\n\nexport type FilesType = {\n [filename: string]: FileEntryType,\n};\n\nexport type FiletypeConstraintsType = Array<{|\n extensions: Array<string>,\n mimeTypes: Array<string>,\n|}>;\n\nexport type FilesizeConstraintsType = {\n fileSize: ?number,\n maxTotalFileSize: ?number,\n isMaxTotal: boolean,\n};\n\nexport type PropertyData = { type: string, label: string, value: string };\nexport type TextFragmentData = {\n type: string,\n label: string,\n text: string | { id?: string, message: string, properties?: Object },\n};\nexport type SectionData = {\n id: string,\n type: string,\n label?: string,\n number?: string,\n body: string | { id?: string, message: string, properties?: Object },\n _links: { self: { href: string } },\n childSections: Array<SectionData>,\n subSections: Array<SectionData>,\n};\n\nexport type PropertyElement = {\n propertyElement: {\n label: string,\n layouthint: Array<string>,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElement = {\n textFragmentElement: {\n label: string,\n layouthint: Array<string>,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElement = {\n contentElement: {\n label: string,\n layouthint: Array<string>,\n sections: Array<SectionData>,\n },\n};\n\nexport type PropertyElementMapped = {\n propertyElement: {\n label: string,\n layouthint: LayoutHintCollection,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElementMapped = {\n textFragmentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElementMapped = {\n contentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n sections: Array<SectionModel>,\n },\n};\n\nexport type ContentAll = Array<\n PropertyElementMapped | TextFragmentElementMapped | ContentElementMapped,\n>;\n\nexport type ContentData = {\n header: {\n label?: string,\n description?: { id?: string, message: string, properties?: Object },\n },\n label?: string,\n elements: Array<PropertyElement | TextFragmentElement | ContentElement>,\n};\n\nexport type SectionFragment = {\n text: string,\n startOffset: number,\n endOffset: number,\n};\n\nexport type ModelOptions = {\n origin?: ?string,\n contextPath?: ?string,\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/models/types.js"],"sourcesContent":["// @flow\nimport type ApplicationModel from \"./application/ApplicationModel\";\nimport type BooleanAttributeModel from \"./attributes/BooleanAttributeModel\";\nimport type CaptchaAttributeModel from \"./attributes/CaptchaAttributeModel\";\nimport type ChoiceAttributeModel from \"./attributes/ChoiceAttributeModel\";\nimport type CompositeAttributeModel from \"./attributes/CompositeAttributeModel\";\nimport type DatetimeAttributeModel from \"./attributes/DatetimeAttributeModel\";\nimport type HelptextAttributeModel from \"./attributes/HelptextAttributeModel\";\nimport type LabelAttributeModel from \"./attributes/LabelAttributeModel\";\nimport type MemoAttributeModel from \"./attributes/MemoAttributeModel\";\nimport type MoneyAttributeModel from \"./attributes/MoneyAttributeModel\";\nimport type NumberAttributeModel from \"./attributes/NumberAttributeModel\";\nimport type PasswordAttributeModel from \"./attributes/PasswordAttributeModel\";\nimport type StringAttributeModel from \"./attributes/StringAttributeModel\";\nimport type UploadAttributeModel from \"./attributes/UploadAttributeModel\";\nimport type XMLAttributeModel from \"./attributes/XMLAttributeModel\";\nimport type CaseViewModel from \"./caseview/CaseViewModel\";\nimport type BusinessScenarioModel from \"./concepts/BusinessScenarioModel\";\nimport type ConceptDetailModel from \"./concepts/ConceptDetailModel\";\nimport type ConceptIndexModel from \"./concepts/ConceptIndexModel\";\nimport type ConceptTypeDetailModel from \"./concepts/ConceptTypeDetailModel\";\nimport type ContentIndexModel from \"./content/ContentIndexModel\";\nimport type ContentModel from \"./content/ContentModel\";\nimport type SectionModel from \"./content/SectionModel\";\nimport type ContentTOCModel from \"./content/ContentTOCModel\";\nimport type ContentTypeModel from \"./content/ContentTypeModel\";\nimport type DetailModel from \"./detail/DetailModel\";\nimport type AssignmentFilterModel from \"./filters/AssignmentFilterModel\";\nimport type FilterModel from \"./filters/FilterModel\";\nimport type RangeFilterModel from \"./filters/RangeFilterModel\";\nimport type ConceptIndexFilterModel from \"./filters/ConceptIndexFilterModel\";\nimport type FormModel from \"./form/FormModel\";\nimport type ListDetailModel from \"./list/ListDetailModel\";\nimport type ListModel from \"./list/ListModel\";\nimport type ModelCatalogModel from \"./modelcatalog/ModelCatalogModel\";\nimport type GroupingPanelModel from \"./panels/GroupingPanelModel\";\nimport type CaseSearchModel from \"./search/CaseSearchModel\";\nimport type TabModel from \"./tab/TabModel\";\nimport type TaskGroupModel from \"./taskgroup/TaskGroupModel\";\nimport type UserModel from \"./user/UserModel\";\nimport type UserServicesModel from \"./user/UserServicesModel\";\nimport type LinkModel from \"./links/LinkModel\";\nimport type LookupOptionsModel from \"./lookup/LookupOptionsModel\";\nimport type BaseFilterModel from \"./filters/BaseFilterModel\";\nimport type AttributeCollection from \"./attributes/AttributeCollection\";\nimport type AttributeModel from \"./attributes/AttributeModel\";\nimport type LayoutHintCollection from \"./layouthint/LayoutHintCollection\";\nimport type ErrorResponse from \"./error/ErrorResponse\";\n\nexport type ModularUIModel =\n | ApplicationModel\n | CaseSearchModel\n | CaseViewModel\n | ListDetailModel\n | DetailModel\n | FormModel\n | GroupingPanelModel\n | ListModel\n | TabModel\n | TaskGroupModel\n | UserModel\n | UserServicesModel\n | ModelCatalogModel\n | ConceptIndexModel\n | ConceptDetailModel\n | BusinessScenarioModel\n | ConceptTypeDetailModel\n | ContentIndexModel\n | ContentTOCModel\n | ContentModel\n | ContentTypeModel\n | LookupOptionsModel;\n\nexport type AttributeType =\n | BooleanAttributeModel\n | CaptchaAttributeModel\n | ChoiceAttributeModel\n | DatetimeAttributeModel\n | HelptextAttributeModel\n | LabelAttributeModel\n | MemoAttributeModel\n | MoneyAttributeModel\n | NumberAttributeModel\n | PasswordAttributeModel\n | CompositeAttributeModel\n | StringAttributeModel\n | UploadAttributeModel\n | XMLAttributeModel;\n\nexport type RangeChildAttributeType =\n | NumberAttributeModel\n | DatetimeAttributeModel;\n\nexport type FilterType =\n | BaseFilterModel\n | FilterModel\n | AssignmentFilterModel\n | RangeFilterModel\n | ConceptIndexFilterModel;\n\nexport type FormErrorAnchor = {\n id: string,\n properties?: {\n [propertyName: string]: string | number,\n },\n anchor?: {\n objectid: string,\n elementid?: string,\n _links?: Object,\n index?: number,\n \"index-identifier\"?: string,\n },\n layouthint: LayoutHintCollection,\n message: string,\n param?: {\n name: string,\n },\n};\n\nexport type labelsJSON = {\n _id: string,\n label: string,\n value: string,\n};\n\nexport type propertyJSON = {\n _id: string,\n type: string,\n mandatory: string,\n label: string,\n value: string,\n};\n\nexport type textfragmentJSON = {\n label: string,\n text: string,\n type: string,\n};\n\nexport interface IConstraintModel {\n +id: string;\n +defaultMessage: string;\n +parameters: Object;\n +isMandatoryConstraint: boolean;\n validate(value: any): boolean;\n hasValidation(): boolean;\n}\n\nexport interface ILayoutHintRule {\n process(attribute: AttributeModel, attributes: AttributeCollection): void;\n}\n\nexport interface IModelWithChildModels {\n getInitialChildModelLinks(): Array<LinkModel>;\n setChildModels(\n models: Array<ModularUIModel>,\n errors: Array<ErrorResponse>,\n ): void;\n}\n\nexport type AuthenticationType = {\n name: string,\n authentication: string,\n redirectUri?: string,\n isPrimary: boolean,\n};\n\nexport type FileEntryType = {\n name: string,\n size?: number,\n progress: number,\n error?: string,\n token?: string,\n};\n\nexport type FilesType = {\n [filename: string]: FileEntryType,\n};\n\nexport type FiletypeConstraintsType = Array<{|\n extensions: Array<string>,\n mimeTypes: Array<string>,\n|}>;\n\nexport type FilesizeConstraintsType = {\n fileSize: ?number,\n maxTotalFileSize: ?number,\n isMaxTotal: boolean,\n};\n\nexport type PropertyData = { type: string, label: string, value: string };\nexport type TextFragmentData = {\n type: string,\n label: string,\n text: string | { id?: string, message: string, properties?: Object },\n};\nexport type SectionData = {\n id: string,\n type: string,\n label?: string,\n number?: string,\n body: string | { id?: string, message: string, properties?: Object },\n _links: { self: { href: string } },\n childSections?: Array<SectionData>,\n sections?: Array<SectionData>,\n subSections: Array<SectionData>,\n};\n\nexport type PropertyElement = {\n propertyElement: {\n label: string,\n layouthint: Array<string>,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElement = {\n textFragmentElement: {\n label: string,\n layouthint: Array<string>,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElement = {\n contentElement: {\n label: string,\n layouthint: Array<string>,\n sections: Array<SectionData>,\n },\n};\n\nexport type PropertyElementMapped = {\n propertyElement: {\n label: string,\n layouthint: LayoutHintCollection,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElementMapped = {\n textFragmentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElementMapped = {\n contentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n sections: Array<SectionModel>,\n },\n};\n\nexport type ContentAll = Array<\n PropertyElementMapped | TextFragmentElementMapped | ContentElementMapped,\n>;\n\nexport type ContentData = {\n header: {\n label?: string,\n description?: { id?: string, message: string, properties?: Object },\n },\n label?: string,\n elements: Array<PropertyElement | TextFragmentElement | ContentElement>,\n};\n\nexport type SectionFragment = {\n text: string,\n startOffset: number,\n endOffset: number,\n};\n\nexport type ModelOptions = {\n origin?: ?string,\n contextPath?: ?string,\n};\n"],"mappings":"","ignoreList":[]}
@@ -7,6 +7,22 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.getPreferredLocale = exports.getFullRequestUrl = exports.getFullRequestHref = exports.getCookieFromRequest = void 0;
8
8
  var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
9
9
  var _Href = _interopRequireDefault(require("../models/href/Href"));
10
+ /**
11
+ */
12
+ const encodeQueryString = queryString => {
13
+ if (!queryString) return "";
14
+ const params = [];
15
+ queryString.split("&").forEach(part => {
16
+ const [key, value] = part.split("=");
17
+ if (key && value) {
18
+ params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
19
+ } else if (key) {
20
+ params.push(encodeURIComponent(key));
21
+ }
22
+ });
23
+ return params.join("&");
24
+ };
25
+
10
26
  /**
11
27
  */
12
28
  const getFullRequestUrl = request => {
@@ -15,7 +31,7 @@ const getFullRequestUrl = request => {
15
31
  let queryString = request.getQueryString();
16
32
  pathInfo = (0, _map.default)(_context = pathInfo.split("/")).call(_context, segment => encodeURIComponent(segment)).join("/");
17
33
  if (queryString) {
18
- return `${pathInfo}?${encodeURIComponent(queryString)}`;
34
+ return `${pathInfo}?${encodeQueryString(queryString)}`;
19
35
  }
20
36
  return pathInfo;
21
37
  };
@@ -1 +1 @@
1
- {"version":3,"file":"requestInformation.js","names":["_Href","_interopRequireDefault","require","getFullRequestUrl","request","_context","pathInfo","getPathInfo","queryString","getQueryString","_map","default","split","call","segment","encodeURIComponent","join","exports","getFullRequestHref","Href","getCookieFromRequest","cookieName","getCookieByName","getPreferredLocale","locales","languageFromCookie","acceptLanguageHeader","getHeader","availableLocaleCodes"],"sources":["../../src/react-server/requestInformation.js"],"sourcesContent":["// @flow\nimport Href from \"../models/href/Href\";\n\nimport type Locales from \"../i18n/Locales\";\n\n/**\n */\nexport const getFullRequestUrl = (request: HttpServletRequestJava): string => {\n let pathInfo = request.getPathInfo() || \"/\";\n let queryString = request.getQueryString();\n\n pathInfo = pathInfo\n .split(\"/\")\n .map((segment) => encodeURIComponent(segment))\n .join(\"/\");\n\n if (queryString) {\n return `${pathInfo}?${encodeURIComponent(queryString)}`;\n }\n\n return pathInfo;\n};\n\n/**\n */\nexport const getFullRequestHref = (request: HttpServletRequestJava): Href =>\n new Href(getFullRequestUrl(request));\n\n/**\n */\nexport const getCookieFromRequest = (\n request: HttpServletRequestJava,\n cookieName: string,\n): null | string => {\n return request.getCookieByName(cookieName);\n};\n\n/**\n */\nexport const getPreferredLocale = (\n request: HttpServletRequestJava,\n locales: Locales,\n): void | string => {\n const languageFromCookie = getCookieFromRequest(request, \"locale\");\n const acceptLanguageHeader =\n languageFromCookie || request.getHeader(\"Accept-Language\");\n\n // when no accept language header or cookie present, get first locale code\n if (acceptLanguageHeader === null) {\n return locales.availableLocaleCodes[0];\n }\n\n return locales.getPreferredLocale(acceptLanguageHeader);\n};\n"],"mappings":";;;;;;;;AACA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA;AACA;AACO,MAAMC,iBAAiB,GAAIC,OAA+B,IAAa;EAAA,IAAAC,QAAA;EAC5E,IAAIC,QAAQ,GAAGF,OAAO,CAACG,WAAW,CAAC,CAAC,IAAI,GAAG;EAC3C,IAAIC,WAAW,GAAGJ,OAAO,CAACK,cAAc,CAAC,CAAC;EAE1CH,QAAQ,GAAG,IAAAI,IAAA,CAAAC,OAAA,EAAAN,QAAA,GAAAC,QAAQ,CAChBM,KAAK,CAAC,GAAG,CAAC,EAAAC,IAAA,CAAAR,QAAA,EACLS,OAAO,IAAKC,kBAAkB,CAACD,OAAO,CAAC,CAAC,CAC7CE,IAAI,CAAC,GAAG,CAAC;EAEZ,IAAIR,WAAW,EAAE;IACf,OAAO,GAAGF,QAAQ,IAAIS,kBAAkB,CAACP,WAAW,CAAC,EAAE;EACzD;EAEA,OAAOF,QAAQ;AACjB,CAAC;;AAED;AACA;AADAW,OAAA,CAAAd,iBAAA,GAAAA,iBAAA;AAEO,MAAMe,kBAAkB,GAAId,OAA+B,IAChE,IAAIe,aAAI,CAAChB,iBAAiB,CAACC,OAAO,CAAC,CAAC;;AAEtC;AACA;AADAa,OAAA,CAAAC,kBAAA,GAAAA,kBAAA;AAEO,MAAME,oBAAoB,GAAGA,CAClChB,OAA+B,EAC/BiB,UAAkB,KACA;EAClB,OAAOjB,OAAO,CAACkB,eAAe,CAACD,UAAU,CAAC;AAC5C,CAAC;;AAED;AACA;AADAJ,OAAA,CAAAG,oBAAA,GAAAA,oBAAA;AAEO,MAAMG,kBAAkB,GAAGA,CAChCnB,OAA+B,EAC/BoB,OAAgB,KACE;EAClB,MAAMC,kBAAkB,GAAGL,oBAAoB,CAAChB,OAAO,EAAE,QAAQ,CAAC;EAClE,MAAMsB,oBAAoB,GACxBD,kBAAkB,IAAIrB,OAAO,CAACuB,SAAS,CAAC,iBAAiB,CAAC;;EAE5D;EACA,IAAID,oBAAoB,KAAK,IAAI,EAAE;IACjC,OAAOF,OAAO,CAACI,oBAAoB,CAAC,CAAC,CAAC;EACxC;EAEA,OAAOJ,OAAO,CAACD,kBAAkB,CAACG,oBAAoB,CAAC;AACzD,CAAC;AAACT,OAAA,CAAAM,kBAAA,GAAAA,kBAAA","ignoreList":[]}
1
+ {"version":3,"file":"requestInformation.js","names":["_Href","_interopRequireDefault","require","encodeQueryString","queryString","params","split","forEach","part","key","value","push","encodeURIComponent","join","getFullRequestUrl","request","_context","pathInfo","getPathInfo","getQueryString","_map","default","call","segment","exports","getFullRequestHref","Href","getCookieFromRequest","cookieName","getCookieByName","getPreferredLocale","locales","languageFromCookie","acceptLanguageHeader","getHeader","availableLocaleCodes"],"sources":["../../src/react-server/requestInformation.js"],"sourcesContent":["// @flow\nimport Href from \"../models/href/Href\";\n\nimport type Locales from \"../i18n/Locales\";\n\n/**\n */\nconst encodeQueryString = (queryString: string) => {\n if (!queryString) return \"\";\n\n const params = [];\n queryString.split(\"&\").forEach((part) => {\n const [key, value] = part.split(\"=\");\n if (key && value) {\n params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);\n } else if (key) {\n params.push(encodeURIComponent(key));\n }\n });\n return params.join(\"&\");\n};\n\n/**\n */\nexport const getFullRequestUrl = (request: HttpServletRequestJava): string => {\n let pathInfo = request.getPathInfo() || \"/\";\n let queryString = request.getQueryString();\n\n pathInfo = pathInfo\n .split(\"/\")\n .map((segment) => encodeURIComponent(segment))\n .join(\"/\");\n\n if (queryString) {\n return `${pathInfo}?${encodeQueryString(queryString)}`;\n }\n\n return pathInfo;\n};\n\n/**\n */\nexport const getFullRequestHref = (request: HttpServletRequestJava): Href =>\n new Href(getFullRequestUrl(request));\n\n/**\n */\nexport const getCookieFromRequest = (\n request: HttpServletRequestJava,\n cookieName: string,\n): null | string => {\n return request.getCookieByName(cookieName);\n};\n\n/**\n */\nexport const getPreferredLocale = (\n request: HttpServletRequestJava,\n locales: Locales,\n): void | string => {\n const languageFromCookie = getCookieFromRequest(request, \"locale\");\n const acceptLanguageHeader =\n languageFromCookie || request.getHeader(\"Accept-Language\");\n\n // when no accept language header or cookie present, get first locale code\n if (acceptLanguageHeader === null) {\n return locales.availableLocaleCodes[0];\n }\n\n return locales.getPreferredLocale(acceptLanguageHeader);\n};\n"],"mappings":";;;;;;;;AACA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA;AACA;AACA,MAAMC,iBAAiB,GAAIC,WAAmB,IAAK;EACjD,IAAI,CAACA,WAAW,EAAE,OAAO,EAAE;E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;AADAS,OAAA,CAAAC,kBAAA,GAAAA,kBAAA;AAEO,MAAME,oBAAoB,GAAGA,CAClCZ,OAA+B,EAC/Ba,UAAkB,KACA;EAClB,OAAOb,OAAO,CAACc,eAAe,CAACD,UAAU,CAAC;AAC5C,CAAC;;AAED;AACA;AADAJ,OAAA,CAAAG,oBAAA,GAAAA,oBAAA;AAEO,MAAMG,kBAAkB,GAAGA,CAChCf,OAA+B,EAC/BgB,OAAgB,KACE;EAClB,MAAMC,kBAAkB,GAAGL,oBAAoB,CAACZ,OAAO,EAAE,QAAQ,CAAC;EAClE,MAAMkB,oBAAoB,GACxBD,kBAAkB,IAAIjB,OAAO,CAACmB,SAAS,CAAC,iBAAiB,CAAC;;EAE5D;EACA,IAAID,oBAAoB,KAAK,IAAI,EAAE;IACjC,OAAOF,OAAO,CAACI,oBAAoB,CAAC,CAAC,CAAC;EACxC;EAEA,OAAOJ,OAAO,CAACD,kBAAkB,CAACG,oBAAoB,CAAC;AACzD,CAAC;AAACT,OAAA,CAAAM,kBAAA,GAAAA,kBAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beinformed/ui",
3
- "version": "1.62.9",
3
+ "version": "1.63.1",
4
4
  "description": "Toolbox for be informed javascript layouts",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "bugs": "https://support.beinformed.com",
@@ -55,7 +55,7 @@ const json = {
55
55
  href: "/content/_Context/Police%20incident%20decisions/Content/Breath%20analysis/Breathalyzer%20test.formalsource/Alert.%3A-",
56
56
  },
57
57
  },
58
- childSections: [
58
+ sections: [
59
59
  {
60
60
  id: "pass",
61
61
  label: "Pass",
@@ -108,22 +108,27 @@ class SectionModel extends BaseModel {
108
108
  * Retrieve child section links
109
109
  */
110
110
  get childSectionLinks(): Array<ContentLinkModel> {
111
- return this.data.childSections
112
- ? this.data.childSections.map(
113
- (childSection) =>
114
- new ContentLinkModel(
115
- {
116
- section: childSection.id || childSection._id,
117
- _id: childSection.id || childSection._id,
118
- label: childSection.label,
119
- sourceLabel: childSection.sourceLabel,
120
- _links: childSection._links,
121
- },
122
- this.entryDate,
123
- this.modelOptions,
124
- ),
125
- )
126
- : [];
111
+ let sections = [];
112
+ if (this.data.childSections) {
113
+ sections = this.data.childSections;
114
+ } else if (this.data.sections) {
115
+ sections = this.data.sections;
116
+ }
117
+
118
+ return sections.map(
119
+ (childSection) =>
120
+ new ContentLinkModel(
121
+ {
122
+ section: childSection.id || childSection._id,
123
+ _id: childSection.id || childSection._id,
124
+ label: childSection.label,
125
+ sourceLabel: childSection.sourceLabel,
126
+ _links: childSection._links,
127
+ },
128
+ this.entryDate,
129
+ this.modelOptions,
130
+ ),
131
+ );
127
132
  }
128
133
 
129
134
  /**
@@ -146,15 +151,23 @@ class SectionModel extends BaseModel {
146
151
  * Get tree of child sections
147
152
  */
148
153
  get childSections(): Array<SectionModel> {
149
- if (!this._childSections && this.data.childSections) {
150
- this._childSections = this.data.childSections
154
+ if (!this._childSections) {
155
+ let sections = [];
156
+ if (this.data.childSections) {
157
+ sections = this.data.childSections;
158
+ } else if (this.data.sections) {
159
+ sections = this.data.sections;
160
+ }
161
+
162
+ this._childSections = sections
151
163
  .filter((childSection) => "body" in childSection)
152
164
  .map(
153
165
  (childSection) =>
154
166
  new SectionModel(childSection, this.entryDate, this.modelOptions),
155
167
  );
156
168
  }
157
- return this._childSections || [];
169
+
170
+ return this._childSections;
158
171
  }
159
172
 
160
173
  /**
@@ -8,6 +8,7 @@ import content from "./content.json";
8
8
  import contentWithSubsections from "./content-with-subsections.json";
9
9
  import contentWithSubsections2 from "./content-with-subsections2.json";
10
10
  import contentWithChildsections from "./content-with-childsections.json";
11
+ import contentWithSections from "./content-with-sections.json";
11
12
  import ContentLinkModel from "../ContentLinkModel";
12
13
 
13
14
  describe("contentmodel", () => {
@@ -119,6 +120,40 @@ describe("contentmodel", () => {
119
120
  );
120
121
  });
121
122
 
123
+ it("can handle content service with sections", () => {
124
+ const response = ModularUIResponse.create({
125
+ key: "contentmodel",
126
+ data: contentWithSections,
127
+ contributions,
128
+ });
129
+
130
+ expect(ContentModel.isApplicableModel(response)).toBe(true);
131
+
132
+ const contentModel = new ContentModel(response);
133
+ expect(contentModel.getInitialChildModelLinks()).toHaveLength(0);
134
+
135
+ expect(contentModel.id).toBe("uitslag");
136
+
137
+ expect(contentModel.childSectionLinks).toHaveLength(4);
138
+ expect(contentModel.childSections).toHaveLength(0);
139
+ expect(contentModel.subSections).toHaveLength(0);
140
+ expect(contentModel.relatedConceptsHrefs).toHaveLength(1);
141
+ expect(contentModel.relatedConceptsHref.href.toString()).toBe(
142
+ "/content/Incident/Business design/Content/Blaastest.textilesource/uitslag/relatedConcepts?entryDate=2021-08-31",
143
+ );
144
+ expect(contentModel.referenceHash).toBe(8236987459042);
145
+
146
+ const firstChildSectionLink = contentModel.childSectionLinks[0];
147
+ expect(firstChildSectionLink instanceof ContentLinkModel).toBe(true);
148
+
149
+ expect(firstChildSectionLink.key).toBe("pass");
150
+ expect(firstChildSectionLink.label).toBe("Pass");
151
+ expect(firstChildSectionLink.sourceLabel).toBeNull();
152
+ expect(firstChildSectionLink.encodedHref.toString()).toBe(
153
+ "/content/Incident%2FBusiness%20design%2FContent%2FBlaastest.textilesource/pass?entryDate=2021-08-31",
154
+ );
155
+ });
156
+
122
157
  it("can handle content service with subsections and correct related concepts", () => {
123
158
  const response = ModularUIResponse.create({
124
159
  key: "contentmodel",
@@ -0,0 +1,105 @@
1
+ {
2
+ "section": {
3
+ "_id": "uitslag",
4
+ "label": "Uitslag blaastest",
5
+ "body": "<p>Nog een sectie voor uitslag blaastest</p>",
6
+ "sections": [
7
+ {
8
+ "_links": {
9
+ "self": {
10
+ "href": "/content/Incident/Business design/Content/Blaastest.textilesource/pass"
11
+ },
12
+ "api_doc": {
13
+ "href": "/api-docs/v3/content/(content-identifier)/(section-identifier)"
14
+ },
15
+ "contributions": {
16
+ "href": "/contributions/content/(content-identifier)/(section-identifier)"
17
+ },
18
+ "relatedConcepts": {
19
+ "href": "/content/Incident/Business design/Content/Blaastest.textilesource/pass/relatedConcepts"
20
+ }
21
+ },
22
+ "_id": "pass",
23
+ "label": "Pass"
24
+ },
25
+ {
26
+ "_links": {
27
+ "self": {
28
+ "href": "/content/Incident/Business design/Content/Blaastest.textilesource/pass_alert"
29
+ },
30
+ "api_doc": {
31
+ "href": "/api-docs/v3/content/(content-identifier)/(section-identifier)"
32
+ },
33
+ "contributions": {
34
+ "href": "/contributions/content/(content-identifier)/(section-identifier)"
35
+ },
36
+ "relatedConcepts": {
37
+ "href": "/content/Incident/Business design/Content/Blaastest.textilesource/pass_alert/relatedConcepts"
38
+ }
39
+ },
40
+ "_id": "pass_alert",
41
+ "label": "Pass / Alert"
42
+ },
43
+ {
44
+ "_links": {
45
+ "self": {
46
+ "href": "/content/Incident/Business design/Content/Blaastest.textilesource/alert"
47
+ },
48
+ "api_doc": {
49
+ "href": "/api-docs/v3/content/(content-identifier)/(section-identifier)"
50
+ },
51
+ "contributions": {
52
+ "href": "/contributions/content/(content-identifier)/(section-identifier)"
53
+ },
54
+ "relatedConcepts": {
55
+ "href": "/content/Incident/Business design/Content/Blaastest.textilesource/alert/relatedConcepts"
56
+ }
57
+ },
58
+ "_id": "alert",
59
+ "label": "Alert"
60
+ },
61
+ {
62
+ "_links": {
63
+ "self": {
64
+ "href": "/content/Incident/Business design/Content/Blaastest.textilesource/fail"
65
+ },
66
+ "api_doc": {
67
+ "href": "/api-docs/v3/content/(content-identifier)/(section-identifier)"
68
+ },
69
+ "contributions": {
70
+ "href": "/contributions/content/(content-identifier)/(section-identifier)"
71
+ },
72
+ "relatedConcepts": {
73
+ "href": "/content/Incident/Business design/Content/Blaastest.textilesource/fail/relatedConcepts"
74
+ }
75
+ },
76
+ "_id": "fail",
77
+ "label": "Fail"
78
+ }
79
+ ],
80
+ "_links": {
81
+ "self": {
82
+ "href": "/content/Incident/Business design/Content/Blaastest.textilesource/uitslag"
83
+ },
84
+ "api_doc": {
85
+ "href": "/api-docs/v3/content/(content-identifier)/(section-identifier)"
86
+ },
87
+ "contributions": {
88
+ "href": "/contributions/content/(content-identifier)/(section-identifier)"
89
+ },
90
+ "relatedConcepts": {
91
+ "href": "/content/Incident/Business design/Content/Blaastest.textilesource/uitslag/relatedConcepts"
92
+ },
93
+ "content": {
94
+ "href": "/content/Incident/Business design/Content/Blaastest.textilesource"
95
+ }
96
+ },
97
+ "filter": {
98
+ "entryDate": {
99
+ "param": "entryDate",
100
+ "name": "entryDate",
101
+ "value": "2021-08-31"
102
+ }
103
+ }
104
+ }
105
+ }
@@ -201,7 +201,8 @@ export type SectionData = {
201
201
  number?: string,
202
202
  body: string | { id?: string, message: string, properties?: Object },
203
203
  _links: { self: { href: string } },
204
- childSections: Array<SectionData>,
204
+ childSections?: Array<SectionData>,
205
+ sections?: Array<SectionData>,
205
206
  subSections: Array<SectionData>,
206
207
  };
207
208
 
@@ -92,7 +92,7 @@ describe("requestInformation", () => {
92
92
  queryString: "q=hello world&filter=test",
93
93
  });
94
94
  expect(getFullRequestUrl(request)).toBe(
95
- "/search?q%3Dhello%20world%26filter%3Dtest",
95
+ "/search?q=hello%20world&filter=test",
96
96
  );
97
97
  });
98
98
 
@@ -120,7 +120,7 @@ describe("requestInformation", () => {
120
120
  queryString: "name=John Doe & email=john@example.com",
121
121
  });
122
122
  expect(getFullRequestUrl(request)).toBe(
123
- "/api/data?name%3DJohn%20Doe%20%26%20email%3Djohn%40example.com",
123
+ "/api/data?name=John%20Doe%20&%20email=john%40example.com",
124
124
  );
125
125
  });
126
126
 
@@ -144,11 +144,11 @@ describe("requestInformation", () => {
144
144
  // Verify that Href constructor was called with the correct URL
145
145
  expect(require("../../models/href/Href")).toHaveBeenCalledTimes(1);
146
146
  expect(require("../../models/href/Href")).toHaveBeenCalledWith(
147
- "/products?id%3D123",
147
+ "/products?id=123",
148
148
  );
149
149
 
150
150
  // Verify the returned object is an instance of the mock Href
151
- expect(hrefInstance.url).toBe("/products?id%3D123");
151
+ expect(hrefInstance.url).toBe("/products?id=123");
152
152
  });
153
153
 
154
154
  it("should handle complex URLs and pass them to Href", () => {
@@ -158,10 +158,10 @@ describe("requestInformation", () => {
158
158
  });
159
159
  const hrefInstance = getFullRequestHref(request);
160
160
  expect(require("../../models/href/Href")).toHaveBeenCalledWith(
161
- "/search/results?q%3Djavascript%2520xss%26param%3Dvalue",
161
+ "/search/results?q=javascript%2520xss&param=value",
162
162
  );
163
163
  expect(hrefInstance.url).toBe(
164
- "/search/results?q%3Djavascript%2520xss%26param%3Dvalue",
164
+ "/search/results?q=javascript%2520xss&param=value",
165
165
  );
166
166
  });
167
167
  });
@@ -3,6 +3,23 @@ import Href from "../models/href/Href";
3
3
 
4
4
  import type Locales from "../i18n/Locales";
5
5
 
6
+ /**
7
+ */
8
+ const encodeQueryString = (queryString: string) => {
9
+ if (!queryString) return "";
10
+
11
+ const params = [];
12
+ queryString.split("&").forEach((part) => {
13
+ const [key, value] = part.split("=");
14
+ if (key && value) {
15
+ params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
16
+ } else if (key) {
17
+ params.push(encodeURIComponent(key));
18
+ }
19
+ });
20
+ return params.join("&");
21
+ };
22
+
6
23
  /**
7
24
  */
8
25
  export const getFullRequestUrl = (request: HttpServletRequestJava): string => {
@@ -15,7 +32,7 @@ export const getFullRequestUrl = (request: HttpServletRequestJava): string => {
15
32
  .join("/");
16
33
 
17
34
  if (queryString) {
18
- return `${pathInfo}?${encodeURIComponent(queryString)}`;
35
+ return `${pathInfo}?${encodeQueryString(queryString)}`;
19
36
  }
20
37
 
21
38
  return pathInfo;