@studyportals/fawkes 8.1.3-1 → 8.1.3-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.
- package/dist/src/structured-data/ScholarshipStructuredDataFactory.d.ts +1 -1
- package/dist/src/structured-data/ScholarshipStructuredDataFactory.js +2 -2
- package/dist/src/structured-data/SearchStructuredDataFactory.d.ts +2 -10
- package/dist/src/structured-data/SearchStructuredDataFactory.js +4 -13
- package/package.json +1 -1
|
@@ -9,6 +9,6 @@ export declare class ScholarshipStructuredDataFactory extends SearchStructuredDa
|
|
|
9
9
|
constructor(currencyConversionService: StructuredDataCurrencyConversionService);
|
|
10
10
|
protected buildStructuredDataForCard(entity: EntityDTO<IScholarshipCard>): Promise<MonetaryGrant | undefined>;
|
|
11
11
|
protected getOfferData(card: IScholarshipCard): Promise<OfferDTO | undefined>;
|
|
12
|
-
protected getPaywallData(
|
|
12
|
+
protected getPaywallData(): PaywallDTO | undefined;
|
|
13
13
|
private buildAmount;
|
|
14
14
|
}
|
|
@@ -33,14 +33,14 @@ export class ScholarshipStructuredDataFactory extends SearchStructuredDataFactor
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
36
|
-
getPaywallData(
|
|
36
|
+
getPaywallData() {
|
|
37
37
|
const currentIndex = this.cardIndex++;
|
|
38
38
|
if (currentIndex < 2) {
|
|
39
39
|
return undefined;
|
|
40
40
|
}
|
|
41
41
|
return {
|
|
42
42
|
isAccessibleForFree: false,
|
|
43
|
-
cssSelector: '.
|
|
43
|
+
cssSelector: '.Paywalled',
|
|
44
44
|
accessMode: 'registration'
|
|
45
45
|
};
|
|
46
46
|
}
|
|
@@ -6,7 +6,7 @@ import { FAQItemDto } from './dto/FAQItemDto';
|
|
|
6
6
|
import { BreadcrumbDTO } from './dto/BreadcrumbDTO';
|
|
7
7
|
import { PaywallDTO } from './dto/PaywallDTO';
|
|
8
8
|
export declare abstract class SearchStructuredDataFactory<TCard> {
|
|
9
|
-
buildStructuredData(title: string, description: string, cards: TCard[], faqItems?: FAQItemDto[], breadcrumbs?: BreadcrumbDTO[]
|
|
9
|
+
buildStructuredData(title: string, description: string, cards: TCard[], faqItems?: FAQItemDto[], breadcrumbs?: BreadcrumbDTO[]): Promise<WithContext<SearchResultsPage>>;
|
|
10
10
|
protected abstract buildStructuredDataForCard(entity: EntityDTO<TCard>): Promise<Thing | undefined> | Thing | undefined;
|
|
11
11
|
/**
|
|
12
12
|
* Get the rating for a card.
|
|
@@ -26,15 +26,7 @@ export declare abstract class SearchStructuredDataFactory<TCard> {
|
|
|
26
26
|
* @protected
|
|
27
27
|
*/
|
|
28
28
|
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;
|
|
29
|
+
protected getPaywallData(): PaywallDTO | undefined;
|
|
38
30
|
private constructOptionalPageOffers;
|
|
39
31
|
protected constructOptionalFaqPage(faqItems: FAQItemDto[]): FAQPage | undefined;
|
|
40
32
|
private constructOptionalPageParts;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
export class SearchStructuredDataFactory {
|
|
2
|
-
async buildStructuredData(title, description, cards, faqItems = [], breadcrumbs = []
|
|
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
|
|
13
|
+
entities.push({ card, offer, reviewRating });
|
|
15
14
|
}
|
|
16
15
|
const mainEntities = [];
|
|
17
16
|
for (const entity of entities) {
|
|
@@ -27,6 +26,7 @@ export class SearchStructuredDataFactory {
|
|
|
27
26
|
description,
|
|
28
27
|
'mainEntity': mainEntities
|
|
29
28
|
};
|
|
29
|
+
const paywallData = this.getPaywallData();
|
|
30
30
|
data.offers = this.constructOptionalPageOffers(offersData);
|
|
31
31
|
data.hasPart = this.constructOptionalPageParts(faqItems, paywallData);
|
|
32
32
|
data.breadcrumb = this.constructOptionalBreadcrumbs(breadcrumbs);
|
|
@@ -59,16 +59,7 @@ export class SearchStructuredDataFactory {
|
|
|
59
59
|
getOfferData(card) {
|
|
60
60
|
return Promise.resolve(undefined);
|
|
61
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) {
|
|
62
|
+
getPaywallData() {
|
|
72
63
|
return undefined;
|
|
73
64
|
}
|
|
74
65
|
constructOptionalPageOffers(offersData) {
|