@studyportals/fawkes 1.0.1-9 → 2.0.0-21
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/fawkes.js +2 -0
- package/dist/fawkes.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/organisations-seo/index.d.ts +0 -2
- package/dist/organisations-seo/index.js +1 -0
- package/dist/scholarships-seo/index.d.ts +8 -3
- package/dist/scholarships-seo/index.js +3 -0
- package/dist/scholarships-seo.js +1 -1
- package/dist/scholarships-seo.js.map +1 -1
- package/dist/sitemap-generator-seo/index.js +1 -0
- package/dist/src/common/BaseSeoIndexabilityPolicy.d.ts +10 -5
- package/dist/src/common/BaseSeoIndexabilityPolicy.js +15 -0
- package/dist/src/common/DisciplinePresenter.d.ts +6 -0
- package/dist/src/common/DisciplinePresenter.js +47 -0
- package/dist/src/common/IPrettyPathGenerator.js +1 -0
- package/dist/src/common/IRankingApiClient.js +1 -0
- package/dist/src/common/ISearchIndexabilityManager.js +1 -0
- package/dist/src/common/ISeoFilterOptions.js +1 -0
- package/dist/src/common/ISeoFilterState.js +1 -0
- package/dist/src/common/ISeoIndexabilityPolicy.js +1 -0
- package/dist/src/common/ISeoInfoBase.js +1 -0
- package/dist/src/common/ISeoSearchApplicationState.js +1 -0
- package/dist/src/common/fragments/Fragment.d.ts +6 -0
- package/dist/src/common/fragments/Fragment.js +8 -0
- package/dist/src/common/fragments/IFragment.d.ts +4 -0
- package/dist/src/common/fragments/IFragment.js +1 -0
- package/dist/src/common/index.d.ts +2 -1
- package/dist/src/common/index.js +1 -0
- package/dist/src/organisations/FilterKeyValuePairs.js +1 -0
- package/dist/src/organisations/IOrganisationsProvider.js +1 -0
- package/dist/src/organisations/ISeoInfoBaseOrganisations.js +1 -0
- package/dist/src/organisations/ISortState.js +1 -0
- package/dist/src/organisations/SearchIndexabilityManager.js +6 -0
- package/dist/src/organisations/SeoIndexabilityPolicy.d.ts +1 -1
- package/dist/src/organisations/SeoIndexabilityPolicy.js +12 -0
- package/dist/src/organisations/SeoRuleBasedIndexabilityPolicy.d.ts +1 -1
- package/dist/src/organisations/SeoRuleBasedIndexabilityPolicy.js +6 -0
- package/dist/src/organisations/SortingOptions.js +5 -0
- package/dist/src/organisations/index.d.ts +0 -2
- package/dist/src/organisations/index.js +1 -0
- package/dist/src/scholarships/CustomRules.d.ts +6 -0
- package/dist/src/scholarships/CustomRules.js +18 -0
- package/dist/src/scholarships/SearchIndexabilityManager.d.ts +7 -3
- package/dist/src/scholarships/SearchIndexabilityManager.js +22 -0
- package/dist/src/scholarships/index.d.ts +2 -1
- package/dist/src/scholarships/index.js +4 -0
- package/dist/src/scholarships/policies/AreaPolicy.d.ts +10 -8
- package/dist/src/scholarships/policies/AreaPolicy.js +27 -0
- package/dist/src/scholarships/policies/CountryPolicy.d.ts +6 -4
- package/dist/src/scholarships/policies/CountryPolicy.js +17 -0
- package/dist/src/scholarships/policies/DisciplineAreaPolicy.d.ts +10 -4
- package/dist/src/scholarships/policies/DisciplineAreaPolicy.js +34 -0
- package/dist/src/scholarships/policies/DisciplineCountryPolicy.d.ts +10 -7
- package/dist/src/scholarships/policies/DisciplineCountryPolicy.js +26 -0
- package/dist/src/scholarships/policies/DisciplinePolicy.d.ts +6 -4
- package/dist/src/scholarships/policies/DisciplinePolicy.js +17 -0
- package/dist/src/scholarships/policies/UnfilteredPolicy.d.ts +6 -4
- package/dist/src/scholarships/policies/UnfilteredPolicy.js +12 -0
- package/dist/src/scholarships/policies/UniversityCountryPolicy.d.ts +6 -4
- package/dist/src/scholarships/policies/UniversityCountryPolicy.js +21 -0
- package/dist/src/scholarships/types.d.ts +7 -0
- package/dist/src/scholarships/types.js +7 -0
- package/dist/src/sitemap-generator/CombinationType.js +3 -0
- package/dist/src/sitemap-generator/ISitemapPathGeneratorChain.js +1 -0
- package/dist/src/sitemap-generator/SitemapPathGeneratorChain.js +9 -0
- package/dist/src/sitemap-generator/index.d.ts +0 -1
- package/dist/src/sitemap-generator/index.js +2 -0
- package/package.json +20 -18
- package/dist/src/organisations/SearchPolicyChain.d.ts +0 -5
- /package/dist/src/{sitemap-generator → common}/IRankingApiClient.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { ISeoFilterState } from "./ISeoFilterState";
|
|
2
|
+
import { IPrettyPathGenerator } from "./IPrettyPathGenerator";
|
|
3
|
+
import { ISeoIndexabilityPolicy } from "./ISeoIndexabilityPolicy";
|
|
4
|
+
import { ISeoInfoBase } from "@/common/ISeoInfoBase";
|
|
5
|
+
export declare abstract class BaseSeoIndexabilityPolicy implements ISeoIndexabilityPolicy, IPrettyPathGenerator {
|
|
6
|
+
protected seoInfoBase: ISeoInfoBase;
|
|
7
|
+
protected filterState: ISeoFilterState;
|
|
8
|
+
constructor(seoInfoBase: ISeoInfoBase, filterState: ISeoFilterState);
|
|
5
9
|
shouldIndex(): Promise<boolean>;
|
|
6
|
-
|
|
10
|
+
abstract generatePaths(): string[];
|
|
11
|
+
protected matchesFilters(): Promise<boolean>;
|
|
7
12
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export class BaseSeoIndexabilityPolicy {
|
|
2
|
+
seoInfoBase;
|
|
3
|
+
filterState;
|
|
4
|
+
constructor(seoInfoBase, filterState) {
|
|
5
|
+
this.seoInfoBase = seoInfoBase;
|
|
6
|
+
this.filterState = filterState;
|
|
7
|
+
}
|
|
8
|
+
async shouldIndex() {
|
|
9
|
+
return this.matchesFilters();
|
|
10
|
+
}
|
|
11
|
+
async matchesFilters() {
|
|
12
|
+
// Default implementation
|
|
13
|
+
return Promise.resolve(false);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { disciplinesAll } from '@studyportals/static-domain-data/disciplines/disciplines';
|
|
2
|
+
// import { subdisciplinesAll } from '@studyportals/static-domain-data/disciplines/subdisciplines';
|
|
3
|
+
import { disciplineGetVirtualPath } from '@studyportals/static-domain-data/disciplines/discipline-get-virtual-path';
|
|
4
|
+
import { Fragment } from './fragments/Fragment';
|
|
5
|
+
export class DisciplinePresenter {
|
|
6
|
+
fragments;
|
|
7
|
+
constructor() {
|
|
8
|
+
this.fragments = this.getFragments();
|
|
9
|
+
}
|
|
10
|
+
// private fragments: IFragment[];
|
|
11
|
+
// private generatePaths(): IFragment[] {
|
|
12
|
+
// const disciplines: IFragment[] = [];
|
|
13
|
+
// const allDisciplines = [...disciplinesAll, ...subdisciplinesAll];
|
|
14
|
+
// allDisciplines.forEach((discipline) => {
|
|
15
|
+
// const path = disciplineGetVirtualPath(discipline.id);
|
|
16
|
+
// if (path === null) {
|
|
17
|
+
// return;
|
|
18
|
+
// }
|
|
19
|
+
// disciplines.push(new Fragment(discipline.id, path));
|
|
20
|
+
// });
|
|
21
|
+
// return disciplines;
|
|
22
|
+
// }
|
|
23
|
+
// private generatePaths(): IFragment[] {
|
|
24
|
+
// const allDisciplines = [...disciplinesAll, ...subdisciplinesAll];
|
|
25
|
+
// const allDisciplines = [...disciplinesAll];
|
|
26
|
+
// const disciplines = allDisciplines.map((discipline) => {
|
|
27
|
+
// return new Fragment(
|
|
28
|
+
// discipline.id,
|
|
29
|
+
// disciplineGetVirtualPath(discipline.id) ?? ""
|
|
30
|
+
// );
|
|
31
|
+
// }).filter((d) => d.path !== "");
|
|
32
|
+
// return disciplines;
|
|
33
|
+
// }
|
|
34
|
+
getFragments() {
|
|
35
|
+
const disciplines = [];
|
|
36
|
+
// const allDisciplines = [...disciplinesAll, ...subdisciplinesAll];
|
|
37
|
+
const allDisciplines = [...disciplinesAll];
|
|
38
|
+
allDisciplines.forEach((discipline) => {
|
|
39
|
+
const path = disciplineGetVirtualPath(discipline.id);
|
|
40
|
+
if (path === null) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
disciplines.push(new Fragment(discipline.id, path));
|
|
44
|
+
});
|
|
45
|
+
return disciplines;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,4 +2,5 @@ import { ISeoInfoBase } from "./ISeoInfoBase";
|
|
|
2
2
|
import { ISeoFilterState } from "./ISeoFilterState";
|
|
3
3
|
import { ISeoFilterOptions } from "./ISeoFilterOptions";
|
|
4
4
|
import { ISeoSearchApplicationState } from "./ISeoSearchApplicationState";
|
|
5
|
-
|
|
5
|
+
import { ISearchIndexabilityManager } from "./ISearchIndexabilityManager";
|
|
6
|
+
export { ISeoFilterOptions, ISeoInfoBase, ISeoFilterState, ISeoSearchApplicationState, ISearchIndexabilityManager };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,7 +2,7 @@ import { BaseSeoIndexabilityPolicy } from "../common/BaseSeoIndexabilityPolicy";
|
|
|
2
2
|
import { ISeoFilterState } from "../common/ISeoFilterState";
|
|
3
3
|
import { ISeoInfoBase } from "../common/ISeoInfoBase";
|
|
4
4
|
import { IOrganisationsProvider } from "./IOrganisationsProvider";
|
|
5
|
-
import { IRankingApiClient } from "@/
|
|
5
|
+
import { IRankingApiClient } from "@/common/IRankingApiClient";
|
|
6
6
|
import { ISortState } from "./ISortState";
|
|
7
7
|
export declare abstract class SeoIndexabilityPolicy<T> extends BaseSeoIndexabilityPolicy {
|
|
8
8
|
protected readonly organisationsProvider: IOrganisationsProvider<T>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseSeoIndexabilityPolicy } from "../common/BaseSeoIndexabilityPolicy";
|
|
2
|
+
export class SeoIndexabilityPolicy extends BaseSeoIndexabilityPolicy {
|
|
3
|
+
organisationsProvider;
|
|
4
|
+
rankingApiClient;
|
|
5
|
+
sortState;
|
|
6
|
+
constructor(seoInfoBase, filterState, organisationsProvider, rankingApiClient, sortState) {
|
|
7
|
+
super(seoInfoBase, filterState);
|
|
8
|
+
this.organisationsProvider = organisationsProvider;
|
|
9
|
+
this.rankingApiClient = rankingApiClient;
|
|
10
|
+
this.sortState = sortState;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -2,7 +2,7 @@ import { SeoIndexabilityPolicy } from "@/organisations/SeoIndexabilityPolicy";
|
|
|
2
2
|
import { ISeoFilterState } from "@/common/ISeoFilterState";
|
|
3
3
|
import { ISeoInfoBase } from "@/common/ISeoInfoBase";
|
|
4
4
|
import { IOrganisationsProvider } from "@/organisations/IOrganisationsProvider";
|
|
5
|
-
import { IRankingApiClient } from "@/
|
|
5
|
+
import { IRankingApiClient } from "@/common/IRankingApiClient";
|
|
6
6
|
import { FilterKeyValuePairs } from "@/organisations/FilterKeyValuePairs";
|
|
7
7
|
import { ISortState } from "@/organisations/ISortState";
|
|
8
8
|
export declare abstract class SeoRuleBasedIndexabilityPolicy<T> extends SeoIndexabilityPolicy<T> {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SeoIndexabilityPolicy } from "@/organisations/SeoIndexabilityPolicy";
|
|
2
|
+
export class SeoRuleBasedIndexabilityPolicy extends SeoIndexabilityPolicy {
|
|
3
|
+
constructor(seoInfoBase, filterState, organisationsProvider, rankingApiClient, sortState) {
|
|
4
|
+
super(seoInfoBase, filterState, organisationsProvider, rankingApiClient, sortState);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ISeoFilterOptions } from "@/common/ISeoFilterOptions";
|
|
2
|
+
import { ISeoSearchApplicationState } from "scholarships-seo";
|
|
3
|
+
export declare class CustomRules {
|
|
4
|
+
static isPartOfAustralia(filterOptions: ISeoFilterOptions, areaId?: string): boolean;
|
|
5
|
+
static hasMoreThan31Results(applicationState: ISeoSearchApplicationState): boolean;
|
|
6
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FilterKey } from "@studyportals/search-filters";
|
|
2
|
+
export class CustomRules {
|
|
3
|
+
static isPartOfAustralia(filterOptions, areaId) {
|
|
4
|
+
const australiaCode = 202;
|
|
5
|
+
if (!areaId) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
const areas = filterOptions.getOptionsInformationFor(FilterKey.AREA);
|
|
9
|
+
const identifiedArea = areas.find((area) => area.optionValue === areaId);
|
|
10
|
+
if (identifiedArea === undefined) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
return identifiedArea.countryIdentity === australiaCode.toString();
|
|
14
|
+
}
|
|
15
|
+
static hasMoreThan31Results(applicationState) {
|
|
16
|
+
return applicationState.getNumberOfResults() > 31;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { ISeoInfoBase } from "@/common/ISeoInfoBase";
|
|
2
|
+
import { ISeoFilterState } from "@/common/ISeoFilterState";
|
|
3
|
+
import { ISearchIndexabilityManager } from "@/common/ISearchIndexabilityManager";
|
|
4
|
+
export declare class SearchIndexabilityManager implements ISearchIndexabilityManager {
|
|
5
|
+
private policies;
|
|
6
|
+
private disciplinePresenter;
|
|
7
|
+
constructor(seoInfoBase: ISeoInfoBase, filterState: ISeoFilterState);
|
|
4
8
|
shouldIndex(): Promise<boolean>;
|
|
5
9
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// import { ISeoSearchApplicationState } from "@/common/ISeoSearchApplicationState";
|
|
2
|
+
import { DisciplinePolicy } from "./policies/DisciplinePolicy";
|
|
3
|
+
import { DisciplinePresenter } from "@/common/DisciplinePresenter";
|
|
4
|
+
export class SearchIndexabilityManager {
|
|
5
|
+
policies;
|
|
6
|
+
disciplinePresenter = new DisciplinePresenter();
|
|
7
|
+
constructor(seoInfoBase, filterState) {
|
|
8
|
+
this.policies = [
|
|
9
|
+
// new AreaPolicy(seoInfoBase, filterState, filterOptions),
|
|
10
|
+
// new CountryPolicy(seoInfoBase, filterState),
|
|
11
|
+
// new DisciplineAreaPolicy(seoInfoBase, filterState, filterOptions, applicationState),
|
|
12
|
+
// new DisciplineCountryPolicy(seoInfoBase, filterState, applicationState),
|
|
13
|
+
new DisciplinePolicy(seoInfoBase, filterState),
|
|
14
|
+
// new UniversityCountryPolicy(seoInfoBase, filterState),
|
|
15
|
+
// new UnfilteredPolicy(seoInfoBase, filterState)
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
async shouldIndex() {
|
|
19
|
+
const results = await Promise.all(this.policies.map(policy => policy.shouldIndex()));
|
|
20
|
+
return results.some(result => result);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { BaseSeoIndexabilityPolicy } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { BaseSeoIndexabilityPolicy } from '@/common/BaseSeoIndexabilityPolicy';
|
|
2
|
+
import { ISeoFilterState } from '@/common/ISeoFilterState';
|
|
3
|
+
import { ISeoInfoBase } from '@/common/ISeoInfoBase';
|
|
4
|
+
import { ISeoIndexabilityPolicy } from '@/common/ISeoIndexabilityPolicy';
|
|
5
|
+
import { ISeoFilterOptions } from '@/common/ISeoFilterOptions';
|
|
6
|
+
export declare class AreaPolicy extends BaseSeoIndexabilityPolicy implements ISeoIndexabilityPolicy {
|
|
7
|
+
private readonly filterOptions;
|
|
8
|
+
constructor(seoInfoBase: ISeoInfoBase, filterState: ISeoFilterState, filterOptions: ISeoFilterOptions);
|
|
9
|
+
protected matchesFilters(): Promise<boolean>;
|
|
10
|
+
generatePaths(): string[];
|
|
9
11
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FilterKey } from '@studyportals/search-filters';
|
|
2
|
+
import { BaseSeoIndexabilityPolicy } from '@/common/BaseSeoIndexabilityPolicy';
|
|
3
|
+
import { CustomRules } from '../CustomRules';
|
|
4
|
+
export class AreaPolicy extends BaseSeoIndexabilityPolicy {
|
|
5
|
+
filterOptions;
|
|
6
|
+
constructor(seoInfoBase, filterState, filterOptions) {
|
|
7
|
+
super(seoInfoBase, filterState);
|
|
8
|
+
this.filterOptions = filterOptions;
|
|
9
|
+
}
|
|
10
|
+
async matchesFilters() {
|
|
11
|
+
const singleAreaSelected = await this.seoInfoBase.singleSelectionFor(FilterKey.AREA, this.filterState);
|
|
12
|
+
const singleCountrySelected = await this.seoInfoBase.singleSelectionFor(FilterKey.COUNTRY, this.filterState);
|
|
13
|
+
const onlyAreaAndCountrySelected = await this.seoInfoBase.selectionOnlyFor([
|
|
14
|
+
FilterKey.AREA,
|
|
15
|
+
FilterKey.COUNTRY
|
|
16
|
+
], this.filterState);
|
|
17
|
+
const areaSelected = this.seoInfoBase.getFilterOptionValueBy(FilterKey.AREA, this.filterState);
|
|
18
|
+
const isPartOfAustralia = CustomRules.isPartOfAustralia(this.filterOptions, areaSelected ?? undefined);
|
|
19
|
+
return singleAreaSelected
|
|
20
|
+
&& singleCountrySelected
|
|
21
|
+
&& onlyAreaAndCountrySelected
|
|
22
|
+
&& !isPartOfAustralia;
|
|
23
|
+
}
|
|
24
|
+
generatePaths() {
|
|
25
|
+
throw new Error('Method not implemented.');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { BaseSeoIndexabilityPolicy } from
|
|
1
|
+
import { BaseSeoIndexabilityPolicy } from '@/common/BaseSeoIndexabilityPolicy';
|
|
2
|
+
import { ISeoFilterState } from '@/common/ISeoFilterState';
|
|
3
|
+
import { ISeoInfoBase } from '@/common/ISeoInfoBase';
|
|
2
4
|
export declare class CountryPolicy extends BaseSeoIndexabilityPolicy {
|
|
3
|
-
constructor(seoInfoBase:
|
|
4
|
-
matchesFilters(): Promise<
|
|
5
|
-
generatePaths():
|
|
5
|
+
constructor(seoInfoBase: ISeoInfoBase, filterState: ISeoFilterState);
|
|
6
|
+
protected matchesFilters(): Promise<boolean>;
|
|
7
|
+
generatePaths(): string[];
|
|
6
8
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FilterKey } from '@studyportals/search-filters';
|
|
2
|
+
import { BaseSeoIndexabilityPolicy } from '@/common/BaseSeoIndexabilityPolicy';
|
|
3
|
+
export class CountryPolicy extends BaseSeoIndexabilityPolicy {
|
|
4
|
+
constructor(seoInfoBase, filterState) {
|
|
5
|
+
super(seoInfoBase, filterState);
|
|
6
|
+
}
|
|
7
|
+
async matchesFilters() {
|
|
8
|
+
const singleCountrySelected = await this.seoInfoBase.singleSelectionFor(FilterKey.COUNTRY, this.filterState);
|
|
9
|
+
const onlyCountrySelected = await this.seoInfoBase.selectionOnlyFor([
|
|
10
|
+
FilterKey.COUNTRY
|
|
11
|
+
], this.filterState);
|
|
12
|
+
return singleCountrySelected && onlyCountrySelected;
|
|
13
|
+
}
|
|
14
|
+
generatePaths() {
|
|
15
|
+
throw new Error('Method not implemented.');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { BaseSeoIndexabilityPolicy } from
|
|
1
|
+
import { BaseSeoIndexabilityPolicy } from '@/common/BaseSeoIndexabilityPolicy';
|
|
2
|
+
import { ISeoFilterState } from '@/common/ISeoFilterState';
|
|
3
|
+
import { ISeoInfoBase } from '@/common/ISeoInfoBase';
|
|
4
|
+
import { ISeoFilterOptions } from '@/common/ISeoFilterOptions';
|
|
5
|
+
import { ISeoSearchApplicationState } from 'scholarships-seo';
|
|
2
6
|
export declare class DisciplineAreaPolicy extends BaseSeoIndexabilityPolicy {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
private filterOptions;
|
|
8
|
+
private applicationState;
|
|
9
|
+
constructor(seoInfoBase: ISeoInfoBase, filterState: ISeoFilterState, filterOptions: ISeoFilterOptions, applicationState: ISeoSearchApplicationState);
|
|
10
|
+
protected matchesFilters(): Promise<boolean>;
|
|
11
|
+
generatePaths(): string[];
|
|
6
12
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FilterKey } from '@studyportals/search-filters';
|
|
2
|
+
import { BaseSeoIndexabilityPolicy } from '@/common/BaseSeoIndexabilityPolicy';
|
|
3
|
+
import { CustomRules } from '../CustomRules';
|
|
4
|
+
export class DisciplineAreaPolicy extends BaseSeoIndexabilityPolicy {
|
|
5
|
+
filterOptions;
|
|
6
|
+
applicationState;
|
|
7
|
+
constructor(seoInfoBase, filterState, filterOptions, applicationState) {
|
|
8
|
+
super(seoInfoBase, filterState);
|
|
9
|
+
this.filterOptions = filterOptions;
|
|
10
|
+
this.applicationState = applicationState;
|
|
11
|
+
}
|
|
12
|
+
async matchesFilters() {
|
|
13
|
+
const singleDisciplineSelected = await this.seoInfoBase.singleSelectionFor(FilterKey.DISCIPLINES, this.filterState);
|
|
14
|
+
const singleCountrySelected = await this.seoInfoBase.singleSelectionFor(FilterKey.COUNTRY, this.filterState);
|
|
15
|
+
const singleAreaSelected = await this.seoInfoBase.singleSelectionFor(FilterKey.AREA, this.filterState);
|
|
16
|
+
const onlyDisciplineAndAreaSelected = await this.seoInfoBase.selectionOnlyFor([
|
|
17
|
+
FilterKey.DISCIPLINES,
|
|
18
|
+
FilterKey.COUNTRY,
|
|
19
|
+
FilterKey.AREA
|
|
20
|
+
], this.filterState);
|
|
21
|
+
const areaSelected = this.seoInfoBase.getFilterOptionValueBy(FilterKey.AREA, this.filterState);
|
|
22
|
+
const isPartOfAustralia = CustomRules.isPartOfAustralia(this.filterOptions, areaSelected ?? undefined);
|
|
23
|
+
const hasMoreThan31Results = CustomRules.hasMoreThan31Results(this.applicationState);
|
|
24
|
+
return singleDisciplineSelected
|
|
25
|
+
&& singleCountrySelected
|
|
26
|
+
&& singleAreaSelected
|
|
27
|
+
&& onlyDisciplineAndAreaSelected
|
|
28
|
+
&& !isPartOfAustralia
|
|
29
|
+
&& hasMoreThan31Results;
|
|
30
|
+
}
|
|
31
|
+
generatePaths() {
|
|
32
|
+
throw new Error('Method not implemented.');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { BaseSeoIndexabilityPolicy } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { BaseSeoIndexabilityPolicy } from '@/common/BaseSeoIndexabilityPolicy';
|
|
2
|
+
import { ISeoSearchApplicationState } from '@/common/ISeoSearchApplicationState';
|
|
3
|
+
import { ISeoFilterState } from '@/common/ISeoFilterState';
|
|
4
|
+
import { ISeoInfoBase } from '@/common/ISeoInfoBase';
|
|
5
|
+
import { ISeoIndexabilityPolicy } from '@/common/ISeoIndexabilityPolicy';
|
|
6
|
+
export declare class DisciplineCountryPolicy extends BaseSeoIndexabilityPolicy implements ISeoIndexabilityPolicy {
|
|
7
|
+
private applicationState;
|
|
8
|
+
constructor(seoInfoBase: ISeoInfoBase, filterState: ISeoFilterState, applicationState: ISeoSearchApplicationState);
|
|
9
|
+
protected matchesFilters(): Promise<boolean>;
|
|
10
|
+
generatePaths(): string[];
|
|
8
11
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FilterKey } from '@studyportals/search-filters';
|
|
2
|
+
import { BaseSeoIndexabilityPolicy } from '@/common/BaseSeoIndexabilityPolicy';
|
|
3
|
+
import { CustomRules } from '../CustomRules';
|
|
4
|
+
export class DisciplineCountryPolicy extends BaseSeoIndexabilityPolicy {
|
|
5
|
+
applicationState;
|
|
6
|
+
constructor(seoInfoBase, filterState, applicationState) {
|
|
7
|
+
super(seoInfoBase, filterState);
|
|
8
|
+
this.applicationState = applicationState;
|
|
9
|
+
}
|
|
10
|
+
async matchesFilters() {
|
|
11
|
+
const singleDisciplineSelected = await this.seoInfoBase.singleSelectionFor(FilterKey.DISCIPLINES, this.filterState);
|
|
12
|
+
const singleCountrySelected = await this.seoInfoBase.singleSelectionFor(FilterKey.COUNTRY, this.filterState);
|
|
13
|
+
const onlyDisciplineAndCountrySelected = await this.seoInfoBase.selectionOnlyFor([
|
|
14
|
+
FilterKey.DISCIPLINES,
|
|
15
|
+
FilterKey.COUNTRY
|
|
16
|
+
], this.filterState);
|
|
17
|
+
const hasEnoughResults = CustomRules.hasMoreThan31Results(this.applicationState);
|
|
18
|
+
return singleDisciplineSelected
|
|
19
|
+
&& singleCountrySelected
|
|
20
|
+
&& onlyDisciplineAndCountrySelected
|
|
21
|
+
&& hasEnoughResults;
|
|
22
|
+
}
|
|
23
|
+
generatePaths() {
|
|
24
|
+
throw new Error('Method not implemented.');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { BaseSeoIndexabilityPolicy } from
|
|
1
|
+
import { BaseSeoIndexabilityPolicy } from '@/common/BaseSeoIndexabilityPolicy';
|
|
2
|
+
import { ISeoFilterState } from '@/common/ISeoFilterState';
|
|
3
|
+
import { ISeoInfoBase } from '@/common/ISeoInfoBase';
|
|
2
4
|
export declare class DisciplinePolicy extends BaseSeoIndexabilityPolicy {
|
|
3
|
-
constructor(seoInfoBase:
|
|
4
|
-
matchesFilters(): Promise<
|
|
5
|
-
generatePaths():
|
|
5
|
+
constructor(seoInfoBase: ISeoInfoBase, filterState: ISeoFilterState);
|
|
6
|
+
protected matchesFilters(): Promise<boolean>;
|
|
7
|
+
generatePaths(): string[];
|
|
6
8
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FilterKey } from '@studyportals/search-filters';
|
|
2
|
+
import { BaseSeoIndexabilityPolicy } from '@/common/BaseSeoIndexabilityPolicy';
|
|
3
|
+
export class DisciplinePolicy extends BaseSeoIndexabilityPolicy {
|
|
4
|
+
constructor(seoInfoBase, filterState) {
|
|
5
|
+
super(seoInfoBase, filterState);
|
|
6
|
+
}
|
|
7
|
+
async matchesFilters() {
|
|
8
|
+
const singleDisciplineSelected = await this.seoInfoBase.singleSelectionFor(FilterKey.DISCIPLINES, this.filterState);
|
|
9
|
+
const onlyDisciplineSelected = await this.seoInfoBase.selectionOnlyFor([
|
|
10
|
+
FilterKey.DISCIPLINES
|
|
11
|
+
], this.filterState);
|
|
12
|
+
return singleDisciplineSelected && onlyDisciplineSelected;
|
|
13
|
+
}
|
|
14
|
+
generatePaths() {
|
|
15
|
+
throw new Error('Method not implemented.');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ISeoInfoBase } from '@/common/ISeoInfoBase';
|
|
2
|
+
import { ISeoFilterState } from '@/common/ISeoFilterState';
|
|
3
|
+
import { BaseSeoIndexabilityPolicy } from '@/common/BaseSeoIndexabilityPolicy';
|
|
2
4
|
export declare class UnfilteredPolicy extends BaseSeoIndexabilityPolicy {
|
|
3
|
-
constructor(seoInfoBase:
|
|
4
|
-
matchesFilters(): Promise<boolean>;
|
|
5
|
-
generatePaths():
|
|
5
|
+
constructor(seoInfoBase: ISeoInfoBase, filterState: ISeoFilterState);
|
|
6
|
+
protected matchesFilters(): Promise<boolean>;
|
|
7
|
+
generatePaths(): string[];
|
|
6
8
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseSeoIndexabilityPolicy } from '@/common/BaseSeoIndexabilityPolicy';
|
|
2
|
+
export class UnfilteredPolicy extends BaseSeoIndexabilityPolicy {
|
|
3
|
+
constructor(seoInfoBase, filterState) {
|
|
4
|
+
super(seoInfoBase, filterState);
|
|
5
|
+
}
|
|
6
|
+
async matchesFilters() {
|
|
7
|
+
return Promise.resolve(this.seoInfoBase.getSelectionTypeCount(this.filterState) === 0);
|
|
8
|
+
}
|
|
9
|
+
generatePaths() {
|
|
10
|
+
throw new Error('Method not implemented.');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { BaseSeoIndexabilityPolicy } from
|
|
1
|
+
import { BaseSeoIndexabilityPolicy } from '@/common/BaseSeoIndexabilityPolicy';
|
|
2
|
+
import { ISeoFilterState } from '@/common/ISeoFilterState';
|
|
3
|
+
import { ISeoInfoBase } from '@/common/ISeoInfoBase';
|
|
2
4
|
export declare class UniversityCountryPolicy extends BaseSeoIndexabilityPolicy {
|
|
3
|
-
constructor(seoInfoBase:
|
|
4
|
-
matchesFilters(): Promise<
|
|
5
|
-
generatePaths():
|
|
5
|
+
constructor(seoInfoBase: ISeoInfoBase, filterState: ISeoFilterState);
|
|
6
|
+
protected matchesFilters(): Promise<boolean>;
|
|
7
|
+
generatePaths(): string[];
|
|
6
8
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FilterKey } from '@studyportals/search-filters';
|
|
2
|
+
import { BaseSeoIndexabilityPolicy } from '@/common/BaseSeoIndexabilityPolicy';
|
|
3
|
+
export class UniversityCountryPolicy extends BaseSeoIndexabilityPolicy {
|
|
4
|
+
constructor(seoInfoBase, filterState) {
|
|
5
|
+
super(seoInfoBase, filterState);
|
|
6
|
+
}
|
|
7
|
+
async matchesFilters() {
|
|
8
|
+
const singleUniversitySelected = await this.seoInfoBase.singleSelectionFor(FilterKey.ORGANISATIONS, this.filterState);
|
|
9
|
+
const singleCountrySelected = await this.seoInfoBase.singleSelectionFor(FilterKey.COUNTRY, this.filterState);
|
|
10
|
+
const onlyUniversityAndDisciplineSelected = await this.seoInfoBase.selectionOnlyFor([
|
|
11
|
+
FilterKey.ORGANISATIONS,
|
|
12
|
+
FilterKey.COUNTRY
|
|
13
|
+
], this.filterState);
|
|
14
|
+
return singleUniversitySelected
|
|
15
|
+
&& singleCountrySelected
|
|
16
|
+
&& onlyUniversityAndDisciplineSelected;
|
|
17
|
+
}
|
|
18
|
+
generatePaths() {
|
|
19
|
+
throw new Error('Method not implemented.');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const types = {
|
|
2
|
+
ISeoInfoBase: Symbol.for("ISeoInfoBase"),
|
|
3
|
+
ISeoFilterState: Symbol.for("ISeoFilterState"),
|
|
4
|
+
ISeoSearchApplicationState: Symbol.for("ISeoSearchApplicationState"),
|
|
5
|
+
ISeoFilterOptions: Symbol.for("ISeoFilterOptions"),
|
|
6
|
+
SearchIndexabilityManager: Symbol.for("SearchIndexabilityManager"),
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|