@studyportals/fawkes 8.1.2-1 → 8.1.2-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/src/common/IPolicyMetaData.d.ts +6 -0
  2. package/dist/src/common/rules/BaseFilterKeyValueRule.js +10 -3
  3. package/dist/src/enums/FilterCombinations.d.ts +26 -1
  4. package/dist/src/enums/FilterCombinations.js +26 -1
  5. package/dist/src/organisations/OrganisationsRuleBasedIndexabilityPolicy.d.ts +11 -0
  6. package/dist/src/organisations/OrganisationsRuleBasedIndexabilityPolicy.js +19 -0
  7. package/dist/src/organisations/rules/AtLeastTwoRankedResultsRule.d.ts +13 -0
  8. package/dist/src/organisations/rules/AtLeastTwoRankedResultsRule.js +26 -0
  9. package/dist/src/organisations/rules/OnlineAttendanceRule.d.ts +6 -0
  10. package/dist/src/organisations/rules/OnlineAttendanceRule.js +14 -0
  11. package/dist/src/presenters/AttendancePresenter.js +4 -0
  12. package/dist/src/presenters/FormatPresenter.js +4 -1
  13. package/dist/src/presenters/SpecialProgrammesPresenter.js +4 -0
  14. package/dist/src/programmes/IProgrammeSearchApplicationState.d.ts +4 -0
  15. package/dist/src/programmes/IProgrammeSearchApplicationState.js +1 -0
  16. package/dist/src/programmes/IProgrammeSearchDependencies.d.ts +7 -0
  17. package/dist/src/programmes/IProgrammeSearchDependencies.js +1 -0
  18. package/dist/src/programmes/IProgrammesSeoDependencies.d.ts +2 -0
  19. package/dist/src/programmes/IProgrammesSeoDependencies.js +1 -0
  20. package/dist/src/programmes/SearchIndexabilityManager.js +31 -3
  21. package/dist/src/programmes/policies/AttendanceArea.d.ts +16 -0
  22. package/dist/src/programmes/policies/AttendanceArea.js +48 -0
  23. package/dist/src/programmes/policies/AttendanceContinent.d.ts +16 -0
  24. package/dist/src/programmes/policies/AttendanceContinent.js +46 -0
  25. package/dist/src/programmes/policies/AttendanceDegree.d.ts +3 -3
  26. package/dist/src/programmes/policies/AttendanceDegree.js +4 -4
  27. package/dist/src/programmes/policies/AttendanceDuration.d.ts +17 -0
  28. package/dist/src/programmes/policies/AttendanceDuration.js +50 -0
  29. package/dist/src/programmes/policies/AttendanceFormat.d.ts +16 -0
  30. package/dist/src/programmes/policies/AttendanceFormat.js +48 -0
  31. package/dist/src/programmes/policies/AttendanceTuitionFee.d.ts +17 -0
  32. package/dist/src/programmes/policies/AttendanceTuitionFee.js +51 -0
  33. package/dist/src/programmes/policies/ContinentDuration.d.ts +16 -0
  34. package/dist/src/programmes/policies/ContinentDuration.js +48 -0
  35. package/dist/src/programmes/policies/ContinentFormat.d.ts +16 -0
  36. package/dist/src/programmes/policies/ContinentFormat.js +48 -0
  37. package/dist/src/programmes/policies/ContinentSpecialProgrammes.d.ts +16 -0
  38. package/dist/src/programmes/policies/ContinentSpecialProgrammes.js +48 -0
  39. package/dist/src/programmes/policies/CountryDuration.d.ts +2 -2
  40. package/dist/src/programmes/policies/CountryDuration.js +6 -4
  41. package/dist/src/programmes/policies/CountrySpecialProgrammes.d.ts +16 -0
  42. package/dist/src/programmes/policies/CountrySpecialProgrammes.js +48 -0
  43. package/dist/src/programmes/policies/DegreeArea.d.ts +15 -0
  44. package/dist/src/programmes/policies/DegreeArea.js +46 -0
  45. package/dist/src/programmes/policies/DegreeAreaTuitionFee.d.ts +16 -0
  46. package/dist/src/programmes/policies/DegreeAreaTuitionFee.js +54 -0
  47. package/dist/src/programmes/policies/DegreeAttendanceDiscipline.d.ts +2 -1
  48. package/dist/src/programmes/policies/DegreeAttendanceDiscipline.js +12 -12
  49. package/dist/src/programmes/policies/DegreeAttendanceFormat.d.ts +17 -0
  50. package/dist/src/programmes/policies/DegreeAttendanceFormat.js +56 -0
  51. package/dist/src/programmes/policies/DegreeAttendanceSpecialProgrammes.d.ts +17 -0
  52. package/dist/src/programmes/policies/DegreeAttendanceSpecialProgrammes.js +58 -0
  53. package/dist/src/programmes/policies/DegreeAttendanceTuitionFee.d.ts +18 -0
  54. package/dist/src/programmes/policies/DegreeAttendanceTuitionFee.js +59 -0
  55. package/dist/src/programmes/policies/DegreeContinent.d.ts +16 -0
  56. package/dist/src/programmes/policies/DegreeContinent.js +46 -0
  57. package/dist/src/programmes/policies/DegreeContinentTuitionFee.d.ts +16 -0
  58. package/dist/src/programmes/policies/DegreeContinentTuitionFee.js +52 -0
  59. package/dist/src/programmes/policies/DegreeCountryAttendance.js +3 -3
  60. package/dist/src/programmes/policies/DegreeCountryTuitionFee.js +2 -2
  61. package/dist/src/programmes/policies/DegreeDuration.d.ts +17 -0
  62. package/dist/src/programmes/policies/DegreeDuration.js +50 -0
  63. package/dist/src/programmes/policies/DegreeFormat.d.ts +16 -0
  64. package/dist/src/programmes/policies/DegreeFormat.js +48 -0
  65. package/dist/src/programmes/policies/DegreeFormatTuitionFee.d.ts +18 -0
  66. package/dist/src/programmes/policies/DegreeFormatTuitionFee.js +56 -0
  67. package/dist/src/programmes/policies/DegreeSpecialProgrammes.d.ts +17 -0
  68. package/dist/src/programmes/policies/DegreeSpecialProgrammes.js +52 -0
  69. package/dist/src/programmes/policies/DegreeTuitionFee.d.ts +16 -0
  70. package/dist/src/programmes/policies/DegreeTuitionFee.js +49 -0
  71. package/dist/src/programmes/policies/DisciplineArea.d.ts +1 -1
  72. package/dist/src/programmes/policies/DisciplineArea.js +1 -1
  73. package/dist/src/programmes/policies/DisciplineContinentAttendance.d.ts +16 -0
  74. package/dist/src/programmes/policies/DisciplineContinentAttendance.js +54 -0
  75. package/dist/src/programmes/policies/DisciplineCountryAttendance.d.ts +16 -0
  76. package/dist/src/programmes/policies/DisciplineCountryAttendance.js +54 -0
  77. package/dist/src/programmes/policies/DisciplineCountryDegree.d.ts +16 -0
  78. package/dist/src/programmes/policies/DisciplineCountryDegree.js +53 -0
  79. package/dist/src/programmes/policies/DisciplineCountryFormat.d.ts +16 -0
  80. package/dist/src/programmes/policies/DisciplineCountryFormat.js +54 -0
  81. package/dist/src/programmes/policies/DisciplineDuration.d.ts +2 -2
  82. package/dist/src/programmes/policies/DisciplineDuration.js +2 -2
  83. package/dist/src/programmes/policies/DisciplineSpecialProgrammes.d.ts +16 -0
  84. package/dist/src/programmes/policies/DisciplineSpecialProgrammes.js +48 -0
  85. package/dist/src/programmes/policies/DisciplineTuitionFee.js +1 -1
  86. package/dist/src/programmes/policies/Duration.d.ts +16 -0
  87. package/dist/src/programmes/policies/Duration.js +40 -0
  88. package/dist/src/programmes/policies/Format.d.ts +15 -0
  89. package/dist/src/programmes/policies/Format.js +38 -0
  90. package/dist/src/programmes/policies/SpecialProgrammes.d.ts +1 -2
  91. package/dist/src/programmes/policies/SpecialProgrammes.js +0 -2
  92. package/dist/src/programmes/policies/index.d.ts +27 -1
  93. package/dist/src/programmes/policies/index.js +27 -1
  94. package/dist/src/programmes/rules/AtLeastSevenResultsRule.d.ts +15 -0
  95. package/dist/src/programmes/rules/AtLeastSevenResultsRule.js +30 -0
  96. package/dist/src/programmes/rules/BlendedOrOnlineAttendanceRule.d.ts +6 -0
  97. package/dist/src/programmes/rules/BlendedOrOnlineAttendanceRule.js +18 -0
  98. package/dist/src/programmes/rules/DegreeAttendanceSpecificRule.d.ts +10 -0
  99. package/dist/src/programmes/rules/DegreeAttendanceSpecificRule.js +42 -0
  100. package/dist/src/programmes/rules/DegreeCountrySpecificRule.d.ts +10 -0
  101. package/dist/src/programmes/rules/DegreeCountrySpecificRule.js +43 -0
  102. package/dist/src/programmes/rules/DegreeCountryTuitionFeeRule.d.ts +11 -0
  103. package/dist/src/programmes/rules/DegreeCountryTuitionFeeRule.js +40 -0
  104. package/dist/src/programmes/rules/ErasmusOrExecutiveSpecialProgrammeRule.d.ts +6 -0
  105. package/dist/src/programmes/rules/ErasmusOrExecutiveSpecialProgrammeRule.js +19 -0
  106. package/dist/src/programmes/rules/ErasmusOrJointSpecialProgrammesRule.js +2 -2
  107. package/dist/src/programmes/rules/ErasmusSpecialProgrammeRule.d.ts +6 -0
  108. package/dist/src/programmes/rules/ErasmusSpecialProgrammeRule.js +19 -0
  109. package/dist/src/programmes/rules/ExecutiveSpecialProgrammeRule.d.ts +6 -0
  110. package/dist/src/programmes/rules/ExecutiveSpecialProgrammeRule.js +19 -0
  111. package/dist/src/programmes/rules/MBACountryAttendanceRule.d.ts +11 -0
  112. package/dist/src/programmes/rules/MBACountryAttendanceRule.js +40 -0
  113. package/dist/src/programmes/rules/MasterOfArtsDisciplineRule.d.ts +10 -0
  114. package/dist/src/programmes/rules/MasterOfArtsDisciplineRule.js +41 -0
  115. package/dist/src/programmes/rules/MasterOfEducationCountryDisciplineRule.d.ts +11 -0
  116. package/dist/src/programmes/rules/MasterOfEducationCountryDisciplineRule.js +69 -0
  117. package/dist/src/programmes/rules/MasterOfLawsCountryAttendanceRule.d.ts +12 -0
  118. package/dist/src/programmes/rules/MasterOfLawsCountryAttendanceRule.js +43 -0
  119. package/dist/src/programmes/rules/MasterOfLawsCountryTuitionFeeRule.d.ts +12 -0
  120. package/dist/src/programmes/rules/MasterOfLawsCountryTuitionFeeRule.js +46 -0
  121. package/dist/src/programmes/rules/MasterOfPhilosophyCountryAttendanceRule.d.ts +12 -0
  122. package/dist/src/programmes/rules/MasterOfPhilosophyCountryAttendanceRule.js +43 -0
  123. package/dist/src/programmes/rules/MasterOfScienceDisciplineRule.d.ts +10 -0
  124. package/dist/src/programmes/rules/MasterOfScienceDisciplineRule.js +41 -0
  125. package/dist/src/programmes/rules/OneOrTwoYearDurationRule.d.ts +6 -0
  126. package/dist/src/programmes/rules/OneOrTwoYearDurationRule.js +19 -0
  127. package/dist/src/programmes/rules/OneYearOnlyRule.d.ts +11 -0
  128. package/dist/src/programmes/rules/OneYearOnlyRule.js +34 -0
  129. package/dist/src/programmes/rules/OnlineAttendanceRule.d.ts +6 -0
  130. package/dist/src/programmes/rules/OnlineAttendanceRule.js +15 -0
  131. package/dist/src/programmes/rules/TwoYearDurationRule.d.ts +6 -0
  132. package/dist/src/programmes/rules/TwoYearDurationRule.js +19 -0
  133. package/dist/src/sitemap-generator/BaseSitemapUrlGeneratorManager.js +0 -1
  134. package/dist/src/sitemap-generator/IPageNumberProvider.d.ts +3 -0
  135. package/dist/src/sitemap-generator/IPageNumberProvider.js +1 -0
  136. package/dist/src/sitemap-generator/ProgrammesSitemapUrlGeneratorManager.js +117 -32
  137. package/dist/src/structured-data/SearchStructuredDataFactory.d.ts +2 -22
  138. package/dist/src/structured-data/SearchStructuredDataFactory.js +7 -64
  139. package/dist/src/structured-data/dto/EntityDTO.d.ts +0 -2
  140. package/dist/src/structured-data/dto/index.d.ts +0 -1
  141. package/dist/src/structured-data/dto/index.js +0 -1
  142. package/package.json +6 -6
  143. package/dist/src/structured-data/ScholarshipStructuredDataFactory.d.ts +0 -14
  144. package/dist/src/structured-data/ScholarshipStructuredDataFactory.js +0 -69
  145. package/dist/src/structured-data/dto/PaywallDTO.d.ts +0 -14
  146. /package/dist/src/{structured-data/dto/PaywallDTO.js → common/IPolicyMetaData.js} +0 -0
@@ -1,6 +1,64 @@
1
1
  import { DependencyTypes } from '../enums/DependencyTypes';
2
2
  import { BaseSitemapUrlGeneratorManager } from './BaseSitemapUrlGeneratorManager';
3
- import { Area, Attendance, AttendanceDegree, Continent, ContinentTuitionFee, Country, CountryAttendance, Discipline, SpecialProgrammes, TuitionFee, Unfiltered, CountryAttendanceDegree, CountryDuration, CountryDurationDegree, CountryEducationalForm, CountryFormat, CountryTuitionFee, DegreeAttendanceDiscipline, DegreeCountryAttendance, DegreeCountryDiscipline, DegreeCountryTuitionFee, DisciplineArea, DisciplineAttendance, DisciplineContinent, DisciplineCountry, DisciplineCountryEducationalForm, DisciplineDegree, DisciplineDuration, DisciplineEducationalForm, DisciplineFormat, DisciplineTuitionFee, DisciplineTuitionFeeAttendance, CountryDegree } from '../programmes/policies';
3
+ import {
4
+ // Area,
5
+ // Attendance,
6
+ AttendanceDegree,
7
+ // Continent,
8
+ // ContinentTuitionFee,
9
+ // Country,
10
+ // CountryAttendance,
11
+ // Discipline,
12
+ SpecialProgrammes,
13
+ // TuitionFee,
14
+ Unfiltered,
15
+ // CountryAttendanceDegree,
16
+ // CountryDuration,
17
+ // CountryDurationDegree,
18
+ // CountryEducationalForm,
19
+ // CountryFormat,
20
+ // CountryTuitionFee,
21
+ // DegreeAttendanceDiscipline,
22
+ // DegreeCountryAttendance,
23
+ // DegreeCountryDiscipline,
24
+ // DegreeCountryTuitionFee,
25
+ // Format,
26
+ // DisciplineAttendance,
27
+ // DisciplineContinent,
28
+ // DisciplineCountry,
29
+ // DisciplineCountryEducationalForm,
30
+ // DisciplineDegree,
31
+ DisciplineDuration,
32
+ // DisciplineEducationalForm,
33
+ // DisciplineFormat,
34
+ // DisciplineTuitionFee,
35
+ // DisciplineTuitionFeeAttendance,
36
+ // CountryDegree,
37
+ // DegreeFormat,
38
+ // DegreeContinent,
39
+ // DegreeAttendanceTuitionFee,
40
+ // DegreeArea,
41
+ // DegreeTuitionFee,
42
+ // AttendanceTuitionFee,
43
+ Duration,
44
+ // AttendanceDuration,
45
+ // DegreeAreaTuitionFee,
46
+ // DisciplineContinentAttendance,
47
+ // DegreeContinentTuitionFee,
48
+ // AttendanceFormat,
49
+ // ContinentFormat,
50
+ // AttendanceContinent,
51
+ // DegreeDuration,
52
+ ContinentSpecialProgrammes, CountrySpecialProgrammes,
53
+ // AttendanceArea,
54
+ // DegreeFormatTuitionFee,
55
+ // ContinentDuration,
56
+ // DegreeAttendanceFormat,
57
+ // DisciplineCountryAttendance,
58
+ // DisciplineCountryFormat,
59
+ // DegreeSpecialProgrammes,
60
+ // Degree
61
+ } from '../programmes/policies';
4
62
  import { FilterKey } from '@studyportals/search-filters/server-side';
5
63
  import { AreaPresenter } from '../presenters/AreaPresenter';
6
64
  import { AttendancePresenter } from '../presenters/AttendancePresenter';
@@ -13,7 +71,8 @@ import { SpecialProgrammesPresenter } from '../presenters/SpecialProgrammesPrese
13
71
  import { DurationPresenter } from '../presenters/DurationPresenter';
14
72
  import { EducationalFormPresenter } from '../presenters/EducationalFormPresenter';
15
73
  import { FormatPresenter } from '../presenters/FormatPresenter';
16
- import { Degree } from '../programmes/policies/Degree';
74
+ // import { DisciplineSpecialProgrammes } from '../programmes/policies/DisciplineSpecialProgrammes';
75
+ // import { DegreeAttendanceSpecialProgrammes } from '../programmes/policies/DegreeAttendanceSpecialProgrammes';
17
76
  export class ProgrammesSitemapUrlGeneratorManager extends BaseSitemapUrlGeneratorManager {
18
77
  portalType;
19
78
  policies;
@@ -27,40 +86,66 @@ export class ProgrammesSitemapUrlGeneratorManager extends BaseSitemapUrlGenerato
27
86
  portalType
28
87
  };
29
88
  this.policies = [
30
- new Area(dependencies),
31
- new Attendance(dependencies),
89
+ // new Area(dependencies),
90
+ // new Attendance(dependencies),
32
91
  new AttendanceDegree(dependencies),
33
- new Continent(dependencies),
34
- new ContinentTuitionFee(dependencies),
35
- new Country(dependencies),
36
- new CountryAttendance(dependencies),
37
- new Discipline(dependencies),
38
- new Degree(dependencies),
92
+ // new AttendanceDuration(dependencies),
93
+ // new AttendanceContinent(dependencies),
94
+ // new Continent(dependencies),
95
+ // new ContinentTuitionFee(dependencies),
96
+ // new Country(dependencies),
97
+ // new CountryAttendance(dependencies),
98
+ // new Discipline(dependencies),
99
+ // new Degree(dependencies),
39
100
  new SpecialProgrammes(dependencies),
40
- new TuitionFee(dependencies),
101
+ // new TuitionFee(dependencies),
41
102
  new Unfiltered(dependencies),
42
- new CountryAttendanceDegree(dependencies),
43
- new CountryDegree(dependencies),
44
- new CountryDuration(dependencies),
45
- new CountryDurationDegree(dependencies),
46
- new CountryEducationalForm(dependencies),
47
- new CountryFormat(dependencies),
48
- new CountryTuitionFee(dependencies),
49
- new DegreeAttendanceDiscipline(dependencies),
50
- new DegreeCountryAttendance(dependencies),
51
- new DegreeCountryDiscipline(dependencies),
52
- new DegreeCountryTuitionFee(dependencies),
53
- new DisciplineArea(dependencies),
54
- new DisciplineAttendance(dependencies),
55
- new DisciplineContinent(dependencies),
56
- new DisciplineCountry(dependencies),
57
- new DisciplineCountryEducationalForm(dependencies),
58
- new DisciplineDegree(dependencies),
103
+ new Duration(dependencies),
104
+ // new CountryAttendanceDegree(dependencies),
105
+ // new CountryDegree(dependencies),
106
+ // new CountryDuration(dependencies),
107
+ // new CountryDurationDegree(dependencies),
108
+ // new CountryEducationalForm(dependencies),
109
+ // new CountryFormat(dependencies),
110
+ // new CountryTuitionFee(dependencies),
111
+ new CountrySpecialProgrammes(dependencies),
112
+ // new ContinentFormat(dependencies),
113
+ new ContinentSpecialProgrammes(dependencies),
114
+ // new ContinentDuration(dependencies),
115
+ // new DegreeAttendanceDiscipline(dependencies),
116
+ // new DegreeCountryAttendance(dependencies),
117
+ // new DegreeCountryDiscipline(dependencies),
118
+ // new DegreeCountryTuitionFee(dependencies),
119
+ // new DegreeFormat(dependencies),
120
+ // new DegreeContinent(dependencies),
121
+ // new DegreeAttendanceTuitionFee(dependencies),
122
+ // new DegreeArea(dependencies),
123
+ // new DegreeTuitionFee(dependencies),
124
+ // new DegreeAreaTuitionFee(dependencies),
125
+ // new DegreeContinentTuitionFee(dependencies),
126
+ // new DegreeDuration(dependencies),
127
+ // new DegreeFormatTuitionFee(dependencies),
128
+ // new DegreeAttendanceFormat(dependencies),
129
+ // new DegreeSpecialProgrammes(dependencies),
130
+ // new DegreeAttendanceSpecialProgrammes(dependencies),
131
+ // new Format(dependencies),
132
+ // new DisciplineAttendance(dependencies),
133
+ // new DisciplineContinent(dependencies),
134
+ // new DisciplineCountry(dependencies),
135
+ // new DisciplineCountryEducationalForm(dependencies),
136
+ // new DisciplineDegree(dependencies),
59
137
  new DisciplineDuration(dependencies),
60
- new DisciplineEducationalForm(dependencies),
61
- new DisciplineFormat(dependencies),
62
- new DisciplineTuitionFee(dependencies),
63
- new DisciplineTuitionFeeAttendance(dependencies)
138
+ // new DisciplineEducationalForm(dependencies),
139
+ // new DisciplineFormat(dependencies),
140
+ // new DisciplineTuitionFee(dependencies),
141
+ // new DisciplineTuitionFeeAttendance(dependencies),
142
+ // new DisciplineContinentAttendance(dependencies),
143
+ // new DisciplineCountryAttendance(dependencies),
144
+ // new DisciplineCountryFormat(dependencies),
145
+ // new DisciplineSpecialProgrammes(dependencies),
146
+ // new AttendanceTuitionFee(dependencies),
147
+ // new AttendanceFormat(dependencies),
148
+ // new AttendanceArea(dependencies)
64
149
  ];
65
150
  this.presenters.set(FilterKey.AREA, AreaPresenter.getInstance());
66
151
  this.presenters.set(FilterKey.DELIVERY_METHOD, AttendancePresenter.getInstance());
@@ -4,10 +4,9 @@ import { OfferDTO } from './dto/OfferDTO';
4
4
  import { EntityDTO } from './dto/EntityDTO';
5
5
  import { FAQItemDto } from './dto/FAQItemDto';
6
6
  import { BreadcrumbDTO } from './dto/BreadcrumbDTO';
7
- import { PaywallDTO } from './dto/PaywallDTO';
8
7
  export declare abstract class SearchStructuredDataFactory<TCard> {
9
- buildStructuredData(title: string, description: string, cards: TCard[], faqItems?: FAQItemDto[], breadcrumbs?: BreadcrumbDTO[], paywallData?: PaywallDTO): Promise<WithContext<SearchResultsPage>>;
10
- protected abstract buildStructuredDataForCard(entity: EntityDTO<TCard>): Promise<Thing | undefined> | Thing | undefined;
8
+ buildStructuredData(title: string, description: string, cards: TCard[], faqItems?: FAQItemDto[], breadcrumbs?: BreadcrumbDTO[]): Promise<WithContext<SearchResultsPage>>;
9
+ protected abstract buildStructuredDataForCard(entity: EntityDTO<TCard>): Thing | undefined;
11
10
  /**
12
11
  * Get the rating for a card.
13
12
  * This method should be overridden by subclasses to provide the specific rating logic.
@@ -26,29 +25,10 @@ export declare abstract class SearchStructuredDataFactory<TCard> {
26
25
  * @protected
27
26
  */
28
27
  protected getOfferData(card: TCard): Promise<OfferDTO | undefined>;
29
- /**
30
- * Get the paywall data for a card.
31
- * This method should be overridden by subclasses to provide the specific paywall logic.
32
- * If no paywall data is available, return undefined and no paywall information will be added to the card.
33
- *
34
- * @param card
35
- * @protected
36
- */
37
- protected getPaywallData(card: TCard): PaywallDTO | undefined;
38
28
  private constructOptionalPageOffers;
39
29
  protected constructOptionalFaqPage(faqItems: FAQItemDto[]): FAQPage | undefined;
40
- private constructOptionalPageParts;
41
30
  private constructOptionalBreadcrumbs;
42
- private constructPaywallElement;
43
31
  protected constructAggregateRating(reviewRating?: ReviewRatingDTO): AggregateRating | undefined;
44
32
  protected constructOffer(offerData?: OfferDTO): Offer | undefined;
45
- /**
46
- * Add paywall information to any structured data object
47
- *
48
- * @param structuredData The structured data object to enhance
49
- * @param paywallData The paywall data to add
50
- * @protected
51
- */
52
- protected addPaywallToStructuredData(structuredData: Record<string, any>, paywallData?: PaywallDTO): void;
53
33
  private stripHtmlWithListRetain;
54
34
  }
@@ -1,25 +1,20 @@
1
1
  export class SearchStructuredDataFactory {
2
- async buildStructuredData(title, description, cards, faqItems = [], breadcrumbs = [], paywallData) {
2
+ async buildStructuredData(title, description, cards, faqItems = [], breadcrumbs = []) {
3
3
  const entities = [];
4
4
  const ratings = [];
5
5
  const offersData = [];
6
6
  for (const card of cards) {
7
7
  const reviewRating = this.getRating(card);
8
8
  const offer = await this.getOfferData(card);
9
- const paywall = this.getPaywallData(card);
10
9
  if (reviewRating)
11
10
  ratings.push(reviewRating);
12
11
  if (offer)
13
12
  offersData.push(offer);
14
- entities.push({ card, offer, reviewRating, paywall });
15
- }
16
- const mainEntities = [];
17
- for (const entity of entities) {
18
- const structuredData = await this.buildStructuredDataForCard(entity);
19
- if (!structuredData)
20
- continue;
21
- mainEntities.push(structuredData);
13
+ entities.push({ card, offer, reviewRating });
22
14
  }
15
+ const mainEntities = entities
16
+ .map(entity => this.buildStructuredDataForCard(entity))
17
+ .filter(entity => entity !== undefined);
23
18
  const data = {
24
19
  '@context': 'https://schema.org',
25
20
  '@type': 'SearchResultsPage',
@@ -28,11 +23,8 @@ export class SearchStructuredDataFactory {
28
23
  'mainEntity': mainEntities
29
24
  };
30
25
  data.offers = this.constructOptionalPageOffers(offersData);
31
- data.hasPart = this.constructOptionalPageParts(faqItems, paywallData);
26
+ data.hasPart = this.constructOptionalFaqPage(faqItems);
32
27
  data.breadcrumb = this.constructOptionalBreadcrumbs(breadcrumbs);
33
- if (paywallData) {
34
- data.isAccessibleForFree = paywallData.isAccessibleForFree;
35
- }
36
28
  return data;
37
29
  }
38
30
  /**
@@ -56,19 +48,7 @@ export class SearchStructuredDataFactory {
56
48
  * @protected
57
49
  */
58
50
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
59
- getOfferData(card) {
60
- return Promise.resolve(undefined);
61
- }
62
- /**
63
- * Get the paywall data for a card.
64
- * This method should be overridden by subclasses to provide the specific paywall logic.
65
- * If no paywall data is available, return undefined and no paywall information will be added to the card.
66
- *
67
- * @param card
68
- * @protected
69
- */
70
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
71
- getPaywallData(card) {
51
+ async getOfferData(card) {
72
52
  return undefined;
73
53
  }
74
54
  constructOptionalPageOffers(offersData) {
@@ -114,21 +94,6 @@ export class SearchStructuredDataFactory {
114
94
  }))
115
95
  };
116
96
  }
117
- constructOptionalPageParts(faqItems, paywallData) {
118
- const parts = [];
119
- const faqPage = this.constructOptionalFaqPage(faqItems);
120
- if (faqPage) {
121
- parts.push(faqPage);
122
- }
123
- if (paywallData && paywallData.cssSelector) {
124
- parts.push(this.constructPaywallElement(paywallData));
125
- }
126
- if (parts.length === 0)
127
- return undefined;
128
- if (parts.length === 1 && parts[0]['@type'] === 'FAQPage')
129
- return parts[0];
130
- return parts;
131
- }
132
97
  constructOptionalBreadcrumbs(breadcrumbs) {
133
98
  if (breadcrumbs.length <= 0)
134
99
  return;
@@ -143,16 +108,6 @@ export class SearchStructuredDataFactory {
143
108
  }))
144
109
  };
145
110
  }
146
- constructPaywallElement(paywallData) {
147
- const element = {
148
- '@type': 'WebPageElement',
149
- 'isAccessibleForFree': paywallData.isAccessibleForFree
150
- };
151
- if (paywallData.cssSelector) {
152
- element.cssSelector = paywallData.cssSelector;
153
- }
154
- return element;
155
- }
156
111
  constructAggregateRating(reviewRating) {
157
112
  if (!reviewRating)
158
113
  return;
@@ -176,18 +131,6 @@ export class SearchStructuredDataFactory {
176
131
  'category': 'tuition'
177
132
  };
178
133
  }
179
- /**
180
- * Add paywall information to any structured data object
181
- *
182
- * @param structuredData The structured data object to enhance
183
- * @param paywallData The paywall data to add
184
- * @protected
185
- */
186
- addPaywallToStructuredData(structuredData, paywallData) {
187
- if (!paywallData)
188
- return;
189
- structuredData.isAccessibleForFree = paywallData.isAccessibleForFree;
190
- }
191
134
  stripHtmlWithListRetain(html) {
192
135
  const tempDiv = document.createElement('div');
193
136
  tempDiv.innerHTML = html;
@@ -1,9 +1,7 @@
1
1
  import { OfferDTO } from "./OfferDTO";
2
2
  import { ReviewRatingDTO } from "./ReviewRatingDTO";
3
- import { PaywallDTO } from "./PaywallDTO";
4
3
  export interface EntityDTO<TCard> {
5
4
  card: TCard;
6
5
  offer?: OfferDTO;
7
6
  reviewRating?: ReviewRatingDTO;
8
- paywall?: PaywallDTO;
9
7
  }
@@ -2,6 +2,5 @@ export * from './BreadcrumbDTO';
2
2
  export * from './EntityDTO';
3
3
  export * from './FAQItemDto';
4
4
  export * from './OfferDTO';
5
- export * from './PaywallDTO';
6
5
  export * from './ReviewRatingDTO';
7
6
  export * from './OrganisationDTO';
@@ -2,6 +2,5 @@ export * from './BreadcrumbDTO';
2
2
  export * from './EntityDTO';
3
3
  export * from './FAQItemDto';
4
4
  export * from './OfferDTO';
5
- export * from './PaywallDTO';
6
5
  export * from './ReviewRatingDTO';
7
6
  export * from './OrganisationDTO';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studyportals/fawkes",
3
- "version": "8.1.2-1",
3
+ "version": "8.1.2-3",
4
4
  "description": "A package to centralize SEO related logic for SBLP and Sitemap Generator.",
5
5
  "files": [
6
6
  "./dist"
@@ -82,17 +82,17 @@
82
82
  "husky": "^8.0.3",
83
83
  "jsdom": "^26.0.0",
84
84
  "prettier": "^3.5.3",
85
+ "schema-dts": "^1.1.5",
86
+ "ts-loader": "^9.5.2",
85
87
  "tsc-alias": "^1.8.11",
86
88
  "typemoq": "^2.1.0",
87
89
  "typescript": "^5.7.3",
88
- "vitest": "^2.1.8",
89
- "schema-dts": "^1.1.5",
90
- "ts-loader": "^9.5.2"
90
+ "vitest": "^2.1.8"
91
91
  },
92
92
  "dependencies": {
93
- "@studyportals/domain-client": "^6.3.0",
93
+ "@studyportals/domain-client": "7.1.0",
94
94
  "@studyportals/ranking-api-interface": "^1.3.12",
95
- "@studyportals/search-filters": "^6.1.0",
95
+ "@studyportals/search-filters": "^6.3.1",
96
96
  "@studyportals/static-domain-data": "^6.1.0"
97
97
  },
98
98
  "optionalDependencies": {
@@ -1,14 +0,0 @@
1
- import { MonetaryGrant } from "schema-dts";
2
- import { StructuredDataCurrencyConversionService } from "./interface/StructuredDataCurrencyConversionService";
3
- import { SearchStructuredDataFactory } from "./SearchStructuredDataFactory";
4
- import { IScholarshipCard } from "@studyportals/domain-client";
5
- import { EntityDTO, OfferDTO, PaywallDTO } from "./dto";
6
- export declare class ScholarshipStructuredDataFactory extends SearchStructuredDataFactory<IScholarshipCard> {
7
- private currencyConversionService;
8
- private cardIndex;
9
- constructor(currencyConversionService: StructuredDataCurrencyConversionService);
10
- protected buildStructuredDataForCard(entity: EntityDTO<IScholarshipCard>): Promise<MonetaryGrant | undefined>;
11
- protected getOfferData(card: IScholarshipCard): Promise<OfferDTO | undefined>;
12
- protected getPaywallData(card: IScholarshipCard): PaywallDTO | undefined;
13
- private buildAmount;
14
- }
@@ -1,69 +0,0 @@
1
- import { SearchStructuredDataFactory } from "./SearchStructuredDataFactory";
2
- export class ScholarshipStructuredDataFactory extends SearchStructuredDataFactory {
3
- currencyConversionService;
4
- cardIndex = 0;
5
- constructor(currencyConversionService) {
6
- super();
7
- this.currencyConversionService = currencyConversionService;
8
- }
9
- async buildStructuredDataForCard(entity) {
10
- const url = `https://${window.location.host}/scholarships/${entity.card.getProviderId()}/${entity.card.getScholarshipVirtualName()}`;
11
- const amount = await this.buildAmount(entity.card);
12
- const structuredData = {
13
- "@type": "MonetaryGrant",
14
- name: entity.card.getScholarshipTitle() || undefined,
15
- description: entity.card.getDescriptionOfApplicationBasis() || undefined,
16
- funder: entity.card.getProviderName() || undefined,
17
- url,
18
- amount
19
- };
20
- this.addPaywallToStructuredData(structuredData, entity.paywall);
21
- return structuredData;
22
- }
23
- async getOfferData(card) {
24
- const benefits = card.getDescriptionOfBenefits();
25
- const hasMonetaryValue = benefits && !isNaN(Number(benefits.split(' ')[0]));
26
- if (!hasMonetaryValue)
27
- return;
28
- const [amount, currency] = [Number(benefits.split(' ')[0]), benefits.split(' ')[1]];
29
- return {
30
- price: Math.round(await this.currencyConversionService.convert(amount, currency, 'USD')),
31
- category: 'tuition',
32
- validFrom: undefined
33
- };
34
- }
35
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
36
- getPaywallData(card) {
37
- const currentIndex = this.cardIndex++;
38
- if (currentIndex < 2) {
39
- return undefined;
40
- }
41
- return {
42
- isAccessibleForFree: false,
43
- cssSelector: '.scholarship-paywall',
44
- accessMode: 'subscription'
45
- };
46
- }
47
- async buildAmount(card) {
48
- const benefits = card.getDescriptionOfBenefits();
49
- const hasMonetaryValue = benefits && !isNaN(Number(benefits.split(' ')[0]));
50
- let amount;
51
- let currency;
52
- if (hasMonetaryValue) {
53
- [amount, currency] = [Number(benefits.split(' ')[0]), benefits.split(' ')[1]];
54
- }
55
- let value;
56
- if (hasMonetaryValue) {
57
- value = Math.round(await this.currencyConversionService.convert(amount, currency, 'USD'));
58
- currency = 'USD';
59
- }
60
- else {
61
- value = benefits || undefined;
62
- }
63
- return {
64
- "@type": "MonetaryAmount",
65
- value,
66
- currency
67
- };
68
- }
69
- }
@@ -1,14 +0,0 @@
1
- export interface PaywallDTO {
2
- /**
3
- * Whether the content is behind a paywall
4
- */
5
- isAccessibleForFree: boolean;
6
- /**
7
- * CSS selector for the paywall element (optional)
8
- */
9
- cssSelector?: string;
10
- /**
11
- * Type of access restriction
12
- */
13
- accessMode?: 'subscription' | 'payment' | 'registration' | 'free';
14
- }