@beinformed/ui 1.62.1 → 1.62.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/esm/models/concepts/ConceptLinkModel.d.ts +4 -7
  3. package/esm/models/concepts/ConceptLinkModel.js +7 -1
  4. package/esm/models/concepts/ConceptLinkModel.js.flow +8 -8
  5. package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
  6. package/esm/models/concepts/SourceReferenceModel.d.ts +3 -0
  7. package/esm/models/concepts/SourceReferenceModel.js +7 -1
  8. package/esm/models/concepts/SourceReferenceModel.js.flow +7 -1
  9. package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
  10. package/esm/models/concepts/__tests__/RelatedConcepts.spec.js.flow +6 -8
  11. package/esm/models/concepts/__tests__/SourceReferenceModel.spec.js.flow +3 -3
  12. package/esm/models/content/ContentLinkModel.js +3 -1
  13. package/esm/models/content/ContentLinkModel.js.flow +1 -1
  14. package/esm/models/content/ContentLinkModel.js.map +1 -1
  15. package/esm/models/content/__tests__/Formalsource.spec.js.flow +30 -0
  16. package/esm/models/types.d.ts +0 -1
  17. package/esm/models/types.js.flow +0 -1
  18. package/esm/models/types.js.map +1 -1
  19. package/lib/models/concepts/ConceptLinkModel.d.ts +4 -7
  20. package/lib/models/concepts/ConceptLinkModel.js +7 -1
  21. package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
  22. package/lib/models/concepts/SourceReferenceModel.d.ts +3 -0
  23. package/lib/models/concepts/SourceReferenceModel.js +7 -1
  24. package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
  25. package/lib/models/content/ContentLinkModel.js +3 -1
  26. package/lib/models/content/ContentLinkModel.js.map +1 -1
  27. package/lib/models/types.d.ts +0 -1
  28. package/lib/models/types.js.map +1 -1
  29. package/package.json +1 -1
  30. package/src/models/concepts/ConceptLinkModel.js +8 -8
  31. package/src/models/concepts/SourceReferenceModel.js +7 -1
  32. package/src/models/concepts/__mock__/related_concepts_data.json +871 -755
  33. package/src/models/concepts/__tests__/RelatedConcepts.spec.js +6 -8
  34. package/src/models/concepts/__tests__/SourceReferenceModel.spec.js +3 -3
  35. package/src/models/content/ContentLinkModel.js +1 -1
  36. package/src/models/content/__tests__/Formalsource.spec.js +30 -0
  37. package/src/models/types.js +0 -1
@@ -9,10 +9,10 @@ describe("Related concepts", () => {
9
9
 
10
10
  expect(relatedConcepts.label).toBe("Related concepts of content");
11
11
  expect(relatedConcepts.selfhref.toString()).toBe(
12
- "/content/bundle-com.beinformed.source.Highlevelrequirements/ResearchGrant/High%20level%20requirements.formalsource/relatedConcepts?entryDate=2025-06-03",
12
+ "/content/bundle-com.beinformed.source.Highlevelrequirements/ResearchGrant/High%20level%20requirements.formalsource/relatedConcepts?entryDate=2025-06-04",
13
13
  );
14
14
 
15
- expect(relatedConcepts.entryDate).toBe("2025-06-03");
15
+ expect(relatedConcepts.entryDate).toBe("2025-06-04");
16
16
  expect(relatedConcepts.modelCategoryFilter.label).toBe("Model category");
17
17
 
18
18
  expect(relatedConcepts.items.size).toBe(116);
@@ -26,16 +26,14 @@ describe("Related concepts", () => {
26
26
  );
27
27
  expect(firstItem.modelCategory).toBe("Requirements");
28
28
  expect(firstItem.selfhref.toString()).toBe(
29
- "/concepts/bundle-com.beinformed.frames.ResearchGrantRequirements/frames.beimodel.json/SystemMustSendAutomatedNotificationsForStatusChanges?entryDate=2025-06-03",
29
+ "/concepts/bundle-com.beinformed.frames.ResearchGrantRequirements/frames.beimodel.json/SystemMustSendAutomatedNotificationsForStatusChanges?entryDate=2025-06-04",
30
30
  );
31
31
  expect(firstItem.conceptTypeLink.href.toString()).toBe(
32
32
  "/concepttypes/bundle-com.beinformed.research.grant.metamodels/High%20level%20requirements.bixml/ArchitecturalSignificantRequirement",
33
33
  );
34
34
 
35
- expect(firstItem.fragment.sectionId).toBe(
36
- "AutomatedNotifications_Requirement",
37
- );
38
- expect(firstItem.fragment.text).toBeUndefined();
35
+ expect(firstItem.sectionId).toBe("AutomatedNotifications_Requirement");
36
+ expect(firstItem.fragment).toBeUndefined();
39
37
 
40
38
  const secondItem = relatedConcepts.items.get(1);
41
39
 
@@ -48,7 +46,7 @@ describe("Related concepts", () => {
48
46
 
49
47
  expect(secondItem.modelCategory).toBe("Requirements");
50
48
 
51
- expect(secondItem.fragment.sectionId).toBe(
49
+ expect(secondItem.sectionId).toBe(
52
50
  "MaximumFlexibilityWithinPolicyConstraints",
53
51
  );
54
52
  expect(secondItem.fragment.text).toBe(
@@ -14,8 +14,8 @@ const data = {
14
14
  href: "/content/bundle-com.beinformed.source.GrantFundingAgreementTermsandConditions/Grant%20Funding%20Agreement.formalsource",
15
15
  },
16
16
  },
17
+ sectionId: "Chapter4",
17
18
  sectionFragment: {
18
- sectionId: "Chapter4",
19
19
  text: "Research Grant",
20
20
  startOffset: 32,
21
21
  endOffset: 18,
@@ -39,6 +39,8 @@ describe("sourceReferenceModel", () => {
39
39
  expect(sourceReference.type).toBe("Reference");
40
40
  expect(sourceReference.sourceAbbreviation).toBe("GFA-TC-01");
41
41
  expect(sourceReference.referenceHash).toBe(10443215482258);
42
+
43
+ expect(sourceReference.sectionId).toBe("Chapter4");
42
44
  expect(sourceReference.fragment.text).toBe("Research Grant");
43
45
  expect(sourceReference.fragment.startOffset).toBe(32);
44
46
  expect(sourceReference.fragment.endOffset).toBe(18);
@@ -60,7 +62,6 @@ describe("sourceReferenceModel", () => {
60
62
  contextPath: "/BeInformed",
61
63
  fragment: {
62
64
  endOffset: 18,
63
- sectionId: "Chapter4",
64
65
  startOffset: 32,
65
66
  text: "Research Grant",
66
67
  },
@@ -95,7 +96,6 @@ describe("sourceReferenceModel", () => {
95
96
  contextPath: "/BeInformed",
96
97
  fragment: {
97
98
  endOffset: 18,
98
- sectionId: "Chapter4",
99
99
  startOffset: 32,
100
100
  text: "Research Grant",
101
101
  },
@@ -183,7 +183,7 @@ export default class ContentLinkModel
183
183
  selflink = this.links.getLinkByKey("content");
184
184
  }
185
185
 
186
- if (selflink != null) {
186
+ if (selflink != null && !selflink.href.path.endsWith(this.data.section)) {
187
187
  selflink.href.addParameter("complete", "true");
188
188
  selflink.href.hash = this.data.section;
189
189
  }
@@ -9,6 +9,7 @@ import sectionContributions from "./formalsource-section-contributions.json";
9
9
 
10
10
  import ContentTOCModel from "../ContentTOCModel";
11
11
  import ContentModel from "../ContentModel";
12
+ import { setSetting } from "../../../constants";
12
13
 
13
14
  describe("formalsource", () => {
14
15
  it("TOC model", () => {
@@ -37,6 +38,8 @@ describe("formalsource", () => {
37
38
  });
38
39
 
39
40
  it("Complete model", () => {
41
+ setSetting("COMPLETE_SOURCE", true);
42
+
40
43
  const response = ModularUIResponse.create({
41
44
  key: "contentmodel",
42
45
  data: complete,
@@ -62,6 +65,9 @@ describe("formalsource", () => {
62
65
  expect(completeModel.isCompleteSource).toBe(true);
63
66
 
64
67
  const firstSection = completeModel.sections[0];
68
+ expect(firstSection.selfhref.toString()).toBe(
69
+ "/content/bundle-com.beinformed.source.GrantFundingAgreementTermsandConditions/Grant%20Funding%20Agreement.formalsource/Chapter1",
70
+ );
65
71
  expect(firstSection.label).toBe("Introduction");
66
72
  expect(firstSection.number).toBe("1.");
67
73
  expect(firstSection.body).toBe(null);
@@ -75,6 +81,8 @@ describe("formalsource", () => {
75
81
  expect(secondSection.sections[0].label).toBe("Payment of Grant");
76
82
  expect(secondSection.sections[0].number).toBe("2.1");
77
83
  expect(secondSection.sections[0].body).toHaveLength(222);
84
+
85
+ setSetting("COMPLETE_SOURCE", false);
78
86
  });
79
87
 
80
88
  it("Section model", () => {
@@ -92,4 +100,26 @@ describe("formalsource", () => {
92
100
 
93
101
  expect(sectionModel.childSectionLinks).toHaveLength(2);
94
102
  });
103
+
104
+ it("Can handle complete sources setting", () => {
105
+ setSetting("COMPLETE_SOURCE", true);
106
+
107
+ const response = ModularUIResponse.create({
108
+ key: "contentmodel",
109
+ data: section,
110
+ contributions: sectionContributions,
111
+ });
112
+ const sectionModel = new ContentModel(response);
113
+
114
+ expect(sectionModel.subSections).toHaveLength(0);
115
+ expect(sectionModel.childSectionLinks).toHaveLength(2);
116
+
117
+ const firstChildSection = sectionModel.childSectionLinks[0];
118
+ expect(firstChildSection.label).toBe("2.1 Payment of Grant");
119
+ expect(firstChildSection.selfhref.toString()).toBe(
120
+ "/content/bundle-com.beinformed.source.GrantFundingAgreementTermsandConditions/Grant%20Funding%20Agreement.formalsource/Chapter2_1?entryDate=2025-05-28",
121
+ );
122
+
123
+ setSetting("COMPLETE_SOURCE", false);
124
+ });
95
125
  });
@@ -263,7 +263,6 @@ export type ContentData = {
263
263
  };
264
264
 
265
265
  export type SectionFragment = {
266
- sectionId?: string,
267
266
  text: string,
268
267
  startOffset: number,
269
268
  endOffset: number,