@studyportals/fawkes 8.5.2 → 8.5.3-1

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.
@@ -73,6 +73,8 @@ export declare enum FilterCombinations {
73
73
  RANKED_CONTINENT = "rankedContinent",
74
74
  RANKED_CONTINENT_ATTENDANCE = "rankedContinentAttendance",
75
75
  RANKED_COUNTRY = "rankedCountry",
76
+ RANKED_COUNTRY_CITY = "rankedCountryCity",
77
+ RANKED_COUNTRY_AREA_CITY = "rankedCountryAreaCity",
76
78
  RANKED_COUNTRY_ATTENDANCE = "rankedCountryAttendance",
77
79
  RANKED_DISCIPLINE_COUNTRY = "rankedDisciplineCountry",
78
80
  RANKED_DISCIPLINE = "rankedDiscipline",
@@ -74,6 +74,8 @@ export var FilterCombinations;
74
74
  FilterCombinations["RANKED_CONTINENT"] = "rankedContinent";
75
75
  FilterCombinations["RANKED_CONTINENT_ATTENDANCE"] = "rankedContinentAttendance";
76
76
  FilterCombinations["RANKED_COUNTRY"] = "rankedCountry";
77
+ FilterCombinations["RANKED_COUNTRY_CITY"] = "rankedCountryCity";
78
+ FilterCombinations["RANKED_COUNTRY_AREA_CITY"] = "rankedCountryAreaCity";
77
79
  FilterCombinations["RANKED_COUNTRY_ATTENDANCE"] = "rankedCountryAttendance";
78
80
  FilterCombinations["RANKED_DISCIPLINE_COUNTRY"] = "rankedDisciplineCountry";
79
81
  FilterCombinations["RANKED_DISCIPLINE"] = "rankedDiscipline";
@@ -1,5 +1,5 @@
1
1
  import { DependencyTypes } from '../enums/DependencyTypes';
2
- import { Area, AreaAttendance, Attendance, Continent, Country, CountryAttendance, Unfiltered, RankedArea, RankedAreaDiscipline, RankedAttendance, RankedAttendanceDiscipline, RankedContinent, RankedContinentAttendance, RankedCountry, RankedCountryAttendance, RankedCountryDiscipline, RankedDiscipline, RankedUnfiltered, CountryCity, CountryAreaCity } from '../organisations/policies';
2
+ import { Area, AreaAttendance, Attendance, Continent, Country, CountryAttendance, Unfiltered, RankedArea, RankedAreaDiscipline, RankedAttendance, RankedAttendanceDiscipline, RankedContinent, RankedContinentAttendance, RankedCountry, RankedCountryAttendance, RankedCountryDiscipline, RankedDiscipline, RankedUnfiltered, CountryCity, CountryAreaCity, RankedCountryCity, RankedCountryAreaCity } from '../organisations/policies';
3
3
  export class SearchIndexabilityManager {
4
4
  policies;
5
5
  constructor(portalType, seoInfoBase, filterState, sortingState, applicationState) {
@@ -31,6 +31,8 @@ export class SearchIndexabilityManager {
31
31
  new RankedCountryAttendance(dependencies),
32
32
  new RankedCountryDiscipline(dependencies),
33
33
  new RankedDiscipline(dependencies),
34
+ new RankedCountryCity(dependencies),
35
+ new RankedCountryAreaCity(dependencies),
34
36
  new RankedUnfiltered(dependencies)
35
37
  ];
36
38
  }
@@ -18,3 +18,5 @@ export * from './ranked/RankedCountryAttendance';
18
18
  export * from './ranked/RankedCountryDiscipline';
19
19
  export * from './ranked/RankedDiscipline';
20
20
  export * from './ranked/RankedUnfiltered';
21
+ export * from './ranked/RankedCountryCity';
22
+ export * from './ranked/RankedCountryAreaCity';
@@ -18,3 +18,5 @@ export * from './ranked/RankedCountryAttendance';
18
18
  export * from './ranked/RankedCountryDiscipline';
19
19
  export * from './ranked/RankedDiscipline';
20
20
  export * from './ranked/RankedUnfiltered';
21
+ export * from './ranked/RankedCountryCity';
22
+ export * from './ranked/RankedCountryAreaCity';
@@ -0,0 +1,13 @@
1
+ import { RankedOrganisationsSeoIndexabilityPolicy } from "../RankedOrganisationsSeoIndexabilityPolicy";
2
+ import { IOrganisationsSeoDependencies } from "../../../organisations/types/IOrganisationsSeoDependencies";
3
+ import { OnlyFiltersSelectedRule } from "../../../common/rules/OnlyFiltersSelectedRule";
4
+ import { SingleValueSelectedForFilterRule } from "../../../common/rules/SingleValueSelectedForFilterRule";
5
+ import { FilterCombinations } from "../../../enums/FilterCombinations";
6
+ export declare class RankedCountryAreaCity extends RankedOrganisationsSeoIndexabilityPolicy {
7
+ readonly name: string;
8
+ readonly description: string;
9
+ protected readonly baseRules: (SingleValueSelectedForFilterRule | OnlyFiltersSelectedRule)[];
10
+ constructor(dependencies: IOrganisationsSeoDependencies);
11
+ protected generateUrls(): Promise<string[]>;
12
+ get filterCombination(): FilterCombinations;
13
+ }
@@ -0,0 +1,43 @@
1
+ import { RankedOrganisationsSeoIndexabilityPolicy } from "../RankedOrganisationsSeoIndexabilityPolicy";
2
+ import { OnlyFiltersSelectedRule } from "../../../common/rules/OnlyFiltersSelectedRule";
3
+ import { FilterKey } from "@studyportals/search-filters/server-side";
4
+ import { SingleValueSelectedForFilterRule } from "../../../common/rules/SingleValueSelectedForFilterRule";
5
+ import { CityPresenter } from "../../../presenters/CityPresenter";
6
+ import { FilterCombinations } from "../../../enums/FilterCombinations";
7
+ export class RankedCountryAreaCity extends RankedOrganisationsSeoIndexabilityPolicy {
8
+ name = 'Ranked Country/Area/City Policy';
9
+ description = 'Regulates indexability of ranking-sorted country, area, and city-level filtered pages, prioritizing high-value geographic views with quality-based sorting.';
10
+ baseRules = [
11
+ new SingleValueSelectedForFilterRule(FilterKey.CONTINENT),
12
+ new OnlyFiltersSelectedRule([FilterKey.CONTINENT])
13
+ ];
14
+ constructor(dependencies) {
15
+ super(dependencies);
16
+ }
17
+ async generateUrls() {
18
+ const cityFragments = await CityPresenter
19
+ .getInstance(this.dependencies.searchApiClient)
20
+ .getFragments();
21
+ const paths = [];
22
+ const filteredFragmentsForCountryAreaCity = cityFragments.filter(city => city.areaId !== null && city.areaId !== undefined);
23
+ for (const city of filteredFragmentsForCountryAreaCity) {
24
+ const areaId = city.areaId?.toString() || '';
25
+ if (areaId === '') {
26
+ continue;
27
+ }
28
+ const filterKeyValues = new Map([
29
+ [FilterKey.CITY, [city.id]],
30
+ [FilterKey.AREA, [areaId]],
31
+ [FilterKey.COUNTRY, [city.countryId]]
32
+ ]);
33
+ const result = await this.checkRulesForSitemap(filterKeyValues);
34
+ if (result) {
35
+ paths.push(this.getPathWithSortingOption(city.path));
36
+ }
37
+ }
38
+ return paths;
39
+ }
40
+ get filterCombination() {
41
+ return FilterCombinations.RANKED_COUNTRY_AREA_CITY;
42
+ }
43
+ }
@@ -0,0 +1,14 @@
1
+ import { RankedOrganisationsSeoIndexabilityPolicy } from "../RankedOrganisationsSeoIndexabilityPolicy";
2
+ import { IOrganisationsSeoDependencies } from "../../../organisations/types/IOrganisationsSeoDependencies";
3
+ import { OnlyFiltersSelectedRule } from "../../../common/rules/OnlyFiltersSelectedRule";
4
+ import { SingleValueSelectedForFilterRule } from "../../../common/rules/SingleValueSelectedForFilterRule";
5
+ import { ExcludeByIdForCitiesRule } from "../../../organisations/rules/ExcludeByIdForCitiesRule";
6
+ import { FilterCombinations } from "../../../enums/FilterCombinations";
7
+ export declare class RankedCountryCity extends RankedOrganisationsSeoIndexabilityPolicy {
8
+ readonly name: string;
9
+ readonly description: string;
10
+ protected readonly baseRules: (SingleValueSelectedForFilterRule | OnlyFiltersSelectedRule | ExcludeByIdForCitiesRule)[];
11
+ constructor(dependencies: IOrganisationsSeoDependencies);
12
+ protected generateUrls(): Promise<string[]>;
13
+ get filterCombination(): FilterCombinations;
14
+ }
@@ -0,0 +1,41 @@
1
+ import { RankedOrganisationsSeoIndexabilityPolicy } from "../RankedOrganisationsSeoIndexabilityPolicy";
2
+ import { OnlyFiltersSelectedRule } from "../../../common/rules/OnlyFiltersSelectedRule";
3
+ import { FilterKey } from "@studyportals/search-filters/server-side";
4
+ import { SingleValueSelectedForFilterRule } from "../../../common/rules/SingleValueSelectedForFilterRule";
5
+ import { ExcludeByIdForCitiesRule } from "../../../organisations/rules/ExcludeByIdForCitiesRule";
6
+ import { CityPresenter } from "../../../presenters/CityPresenter";
7
+ import { FilterCombinations } from "../../../enums/FilterCombinations";
8
+ export class RankedCountryCity extends RankedOrganisationsSeoIndexabilityPolicy {
9
+ name = 'Ranked Country/City Policy';
10
+ description = 'Regulates indexability of ranking-sorted country, and city-level filtered pages, prioritizing high-value geographic views with quality-based sorting.';
11
+ baseRules = [
12
+ new SingleValueSelectedForFilterRule(FilterKey.CITY),
13
+ new SingleValueSelectedForFilterRule(FilterKey.COUNTRY),
14
+ new OnlyFiltersSelectedRule([FilterKey.CITY, FilterKey.COUNTRY]),
15
+ new ExcludeByIdForCitiesRule(FilterKey.CITY)
16
+ ];
17
+ constructor(dependencies) {
18
+ super(dependencies);
19
+ }
20
+ async generateUrls() {
21
+ const cityFragments = await CityPresenter
22
+ .getInstance(this.dependencies.searchApiClient)
23
+ .getFragments();
24
+ const paths = [];
25
+ const filteredFragmentsForCountryCity = cityFragments.filter(city => city.areaId === null || city.areaId === undefined);
26
+ for (const city of filteredFragmentsForCountryCity) {
27
+ const filterKeyValues = new Map([
28
+ [FilterKey.CITY, [city.id]],
29
+ [FilterKey.COUNTRY, [city.countryId]]
30
+ ]);
31
+ const result = await this.checkRulesForSitemap(filterKeyValues);
32
+ if (result) {
33
+ paths.push(this.getPathWithSortingOption(city.path));
34
+ }
35
+ }
36
+ return paths;
37
+ }
38
+ get filterCombination() {
39
+ return FilterCombinations.RANKED_COUNTRY_CITY;
40
+ }
41
+ }
@@ -1,6 +1,6 @@
1
1
  import { DependencyTypes } from '../enums/DependencyTypes';
2
2
  import { BaseSitemapUrlGeneratorManager } from './BaseSitemapUrlGeneratorManager';
3
- import { Area, AreaAttendance, Attendance, Continent, Country, CountryCity, CountryAttendance, RankedArea, RankedAreaDiscipline, RankedAttendance, RankedAttendanceDiscipline, RankedContinent, RankedContinentAttendance, RankedCountry, RankedCountryAttendance, RankedCountryDiscipline, RankedDiscipline, RankedUnfiltered, Unfiltered } from '../organisations/policies';
3
+ import { Area, AreaAttendance, Attendance, Continent, Country, CountryCity, CountryAttendance, RankedArea, RankedAreaDiscipline, RankedAttendance, RankedAttendanceDiscipline, RankedContinent, RankedContinentAttendance, RankedCountry, RankedCountryAttendance, RankedCountryDiscipline, RankedDiscipline, RankedUnfiltered, Unfiltered, RankedCountryCity, RankedCountryAreaCity } from '../organisations/policies';
4
4
  import { AreaPresenter } from '../presenters/AreaPresenter';
5
5
  import { AttendancePresenter } from '../presenters/AttendancePresenter';
6
6
  import { ContinentPresenter } from '../presenters/ContinentPresenter';
@@ -39,6 +39,8 @@ export class OrganisationsSitemapUrlGeneratorManager extends BaseSitemapUrlGener
39
39
  new RankedContinent(dependencies),
40
40
  new RankedContinentAttendance(dependencies),
41
41
  new RankedCountry(dependencies),
42
+ new RankedCountryCity(dependencies),
43
+ new RankedCountryAreaCity(dependencies),
42
44
  new RankedCountryAttendance(dependencies),
43
45
  new RankedCountryDiscipline(dependencies),
44
46
  new RankedDiscipline(dependencies),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studyportals/fawkes",
3
- "version": "8.5.2",
3
+ "version": "8.5.3-1",
4
4
  "description": "A package to centralize SEO related logic for SBLP and Sitemap Generator.",
5
5
  "files": [
6
6
  "./dist"