@studyportals/fawkes 8.1.3-0 → 8.2.0

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 (149) 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 +27 -1
  4. package/dist/src/enums/FilterCombinations.js +27 -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/CountryFormat.js +1 -1
  42. package/dist/src/programmes/policies/CountrySpecialProgrammes.d.ts +16 -0
  43. package/dist/src/programmes/policies/CountrySpecialProgrammes.js +48 -0
  44. package/dist/src/programmes/policies/DegreeArea.d.ts +15 -0
  45. package/dist/src/programmes/policies/DegreeArea.js +46 -0
  46. package/dist/src/programmes/policies/DegreeAreaTuitionFee.d.ts +16 -0
  47. package/dist/src/programmes/policies/DegreeAreaTuitionFee.js +54 -0
  48. package/dist/src/programmes/policies/DegreeAttendanceDiscipline.d.ts +2 -1
  49. package/dist/src/programmes/policies/DegreeAttendanceDiscipline.js +12 -12
  50. package/dist/src/programmes/policies/DegreeAttendanceFormat.d.ts +17 -0
  51. package/dist/src/programmes/policies/DegreeAttendanceFormat.js +56 -0
  52. package/dist/src/programmes/policies/DegreeAttendanceSpecialProgrammes.d.ts +17 -0
  53. package/dist/src/programmes/policies/DegreeAttendanceSpecialProgrammes.js +58 -0
  54. package/dist/src/programmes/policies/DegreeAttendanceTuitionFee.d.ts +18 -0
  55. package/dist/src/programmes/policies/DegreeAttendanceTuitionFee.js +59 -0
  56. package/dist/src/programmes/policies/DegreeContinent.d.ts +16 -0
  57. package/dist/src/programmes/policies/DegreeContinent.js +46 -0
  58. package/dist/src/programmes/policies/DegreeContinentTuitionFee.d.ts +16 -0
  59. package/dist/src/programmes/policies/DegreeContinentTuitionFee.js +52 -0
  60. package/dist/src/programmes/policies/DegreeCountryAttendance.js +3 -3
  61. package/dist/src/programmes/policies/DegreeCountryTuitionFee.js +2 -2
  62. package/dist/src/programmes/policies/DegreeDuration.d.ts +17 -0
  63. package/dist/src/programmes/policies/DegreeDuration.js +50 -0
  64. package/dist/src/programmes/policies/DegreeFormat.d.ts +16 -0
  65. package/dist/src/programmes/policies/DegreeFormat.js +48 -0
  66. package/dist/src/programmes/policies/DegreeFormatTuitionFee.d.ts +18 -0
  67. package/dist/src/programmes/policies/DegreeFormatTuitionFee.js +56 -0
  68. package/dist/src/programmes/policies/DegreeSpecialProgrammes.d.ts +17 -0
  69. package/dist/src/programmes/policies/DegreeSpecialProgrammes.js +52 -0
  70. package/dist/src/programmes/policies/DegreeTuitionFee.d.ts +16 -0
  71. package/dist/src/programmes/policies/DegreeTuitionFee.js +49 -0
  72. package/dist/src/programmes/policies/DisciplineArea.d.ts +1 -1
  73. package/dist/src/programmes/policies/DisciplineArea.js +1 -1
  74. package/dist/src/programmes/policies/DisciplineContinentAttendance.d.ts +16 -0
  75. package/dist/src/programmes/policies/DisciplineContinentAttendance.js +54 -0
  76. package/dist/src/programmes/policies/DisciplineCountryAttendance.d.ts +16 -0
  77. package/dist/src/programmes/policies/DisciplineCountryAttendance.js +54 -0
  78. package/dist/src/programmes/policies/DisciplineCountryDegree.d.ts +16 -0
  79. package/dist/src/programmes/policies/DisciplineCountryDegree.js +53 -0
  80. package/dist/src/programmes/policies/DisciplineCountryFormat.d.ts +16 -0
  81. package/dist/src/programmes/policies/DisciplineCountryFormat.js +54 -0
  82. package/dist/src/programmes/policies/DisciplineDuration.d.ts +2 -2
  83. package/dist/src/programmes/policies/DisciplineDuration.js +2 -2
  84. package/dist/src/programmes/policies/DisciplineSpecialProgrammes.d.ts +16 -0
  85. package/dist/src/programmes/policies/DisciplineSpecialProgrammes.js +48 -0
  86. package/dist/src/programmes/policies/DisciplineTuitionFee.js +1 -1
  87. package/dist/src/programmes/policies/Duration.d.ts +16 -0
  88. package/dist/src/programmes/policies/Duration.js +40 -0
  89. package/dist/src/programmes/policies/Format.d.ts +15 -0
  90. package/dist/src/programmes/policies/Format.js +36 -0
  91. package/dist/src/programmes/policies/SpecialProgrammes.d.ts +1 -2
  92. package/dist/src/programmes/policies/SpecialProgrammes.js +0 -2
  93. package/dist/src/programmes/policies/index.d.ts +29 -1
  94. package/dist/src/programmes/policies/index.js +29 -1
  95. package/dist/src/programmes/rules/AtLeastSevenResultsRule.d.ts +15 -0
  96. package/dist/src/programmes/rules/AtLeastSevenResultsRule.js +30 -0
  97. package/dist/src/programmes/rules/BlendedOrOnlineAttendanceRule.d.ts +6 -0
  98. package/dist/src/programmes/rules/BlendedOrOnlineAttendanceRule.js +18 -0
  99. package/dist/src/programmes/rules/DegreeAttendanceSpecificRule.d.ts +10 -0
  100. package/dist/src/programmes/rules/DegreeAttendanceSpecificRule.js +42 -0
  101. package/dist/src/programmes/rules/DegreeCountrySpecificRule.d.ts +10 -0
  102. package/dist/src/programmes/rules/DegreeCountrySpecificRule.js +43 -0
  103. package/dist/src/programmes/rules/DegreeCountryTuitionFeeRule.d.ts +11 -0
  104. package/dist/src/programmes/rules/DegreeCountryTuitionFeeRule.js +40 -0
  105. package/dist/src/programmes/rules/ErasmusOrExecutiveSpecialProgrammeRule.d.ts +6 -0
  106. package/dist/src/programmes/rules/ErasmusOrExecutiveSpecialProgrammeRule.js +19 -0
  107. package/dist/src/programmes/rules/ErasmusOrJointSpecialProgrammesRule.js +2 -2
  108. package/dist/src/programmes/rules/ErasmusSpecialProgrammeRule.d.ts +6 -0
  109. package/dist/src/programmes/rules/ErasmusSpecialProgrammeRule.js +19 -0
  110. package/dist/src/programmes/rules/ExecutiveSpecialProgrammeRule.d.ts +6 -0
  111. package/dist/src/programmes/rules/ExecutiveSpecialProgrammeRule.js +19 -0
  112. package/dist/src/programmes/rules/MBACountryAttendanceRule.d.ts +11 -0
  113. package/dist/src/programmes/rules/MBACountryAttendanceRule.js +40 -0
  114. package/dist/src/programmes/rules/MasterOfArtsDisciplineRule.d.ts +10 -0
  115. package/dist/src/programmes/rules/MasterOfArtsDisciplineRule.js +41 -0
  116. package/dist/src/programmes/rules/MasterOfEducationCountryDisciplineRule.d.ts +11 -0
  117. package/dist/src/programmes/rules/MasterOfEducationCountryDisciplineRule.js +69 -0
  118. package/dist/src/programmes/rules/MasterOfLawsCountryAttendanceRule.d.ts +12 -0
  119. package/dist/src/programmes/rules/MasterOfLawsCountryAttendanceRule.js +43 -0
  120. package/dist/src/programmes/rules/MasterOfLawsCountryTuitionFeeRule.d.ts +12 -0
  121. package/dist/src/programmes/rules/MasterOfLawsCountryTuitionFeeRule.js +46 -0
  122. package/dist/src/programmes/rules/MasterOfPhilosophyCountryAttendanceRule.d.ts +12 -0
  123. package/dist/src/programmes/rules/MasterOfPhilosophyCountryAttendanceRule.js +43 -0
  124. package/dist/src/programmes/rules/MasterOfScienceDisciplineRule.d.ts +10 -0
  125. package/dist/src/programmes/rules/MasterOfScienceDisciplineRule.js +41 -0
  126. package/dist/src/programmes/rules/OneOrTwoYearDurationRule.d.ts +6 -0
  127. package/dist/src/programmes/rules/OneOrTwoYearDurationRule.js +19 -0
  128. package/dist/src/programmes/rules/OneYearOnlyRule.d.ts +11 -0
  129. package/dist/src/programmes/rules/OneYearOnlyRule.js +34 -0
  130. package/dist/src/programmes/rules/OnlineAttendanceRule.d.ts +6 -0
  131. package/dist/src/programmes/rules/OnlineAttendanceRule.js +15 -0
  132. package/dist/src/programmes/rules/TwoYearDurationRule.d.ts +6 -0
  133. package/dist/src/programmes/rules/TwoYearDurationRule.js +19 -0
  134. package/dist/src/sitemap-generator/BaseSitemapUrlGeneratorManager.js +0 -1
  135. package/dist/src/sitemap-generator/IPageNumberProvider.d.ts +3 -0
  136. package/dist/src/sitemap-generator/IPageNumberProvider.js +1 -0
  137. package/dist/src/sitemap-generator/ProgrammesSitemapUrlGeneratorManager.js +29 -4
  138. package/dist/src/structured-data/SearchStructuredDataFactory.d.ts +2 -22
  139. package/dist/src/structured-data/SearchStructuredDataFactory.js +7 -64
  140. package/dist/src/structured-data/dto/EntityDTO.d.ts +0 -2
  141. package/dist/src/structured-data/dto/index.d.ts +0 -1
  142. package/dist/src/structured-data/dto/index.js +0 -1
  143. package/dist/src/structured-data/index.d.ts +0 -1
  144. package/dist/src/structured-data/index.js +0 -1
  145. package/package.json +6 -6
  146. package/dist/src/structured-data/ScholarshipStructuredDataFactory.d.ts +0 -14
  147. package/dist/src/structured-data/ScholarshipStructuredDataFactory.js +0 -69
  148. package/dist/src/structured-data/dto/PaywallDTO.d.ts +0 -14
  149. /package/dist/src/{structured-data/dto/PaywallDTO.js → common/IPolicyMetaData.js} +0 -0
@@ -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';
@@ -1,4 +1,3 @@
1
1
  export * from './ProgrammeStructuredDataFactory';
2
2
  export * from './OrganisationStructuredDataFactory';
3
- export * from './ScholarshipStructuredDataFactory';
4
3
  export * from './dto';
@@ -1,4 +1,3 @@
1
1
  export * from './ProgrammeStructuredDataFactory';
2
2
  export * from './OrganisationStructuredDataFactory';
3
- export * from './ScholarshipStructuredDataFactory';
4
3
  export * from './dto';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studyportals/fawkes",
3
- "version": "8.1.3-0",
3
+ "version": "8.2.0",
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: 'registration'
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
- }