@studyportals/fawkes 7.2.2-14 → 7.2.2-15

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.
@@ -2,15 +2,14 @@ import { FilterKey } from '@studyportals/search-filters';
2
2
  import { OnlyFiltersSelectedRule } from '../../common/rules/OnlyFiltersSelectedRule';
3
3
  import { SingleValueSelectedForFilterRule } from '../../common/rules/SingleValueSelectedForFilterRule';
4
4
  import { FilterCombinations } from '../../enums/FilterCombinations';
5
- import { DegreeCountrySpecificRule } from '../rules/DegreeCountrySpecificRule';
6
- import { MasterOfEducationCountryDisciplineRule } from '../rules/MasterOfEducationCountryDisciplineRule';
5
+ import { DegreeCountryDisciplineSpecificRule } from '../rules/DegreeCountryDisciplineSpecificRule';
7
6
  import { ProgrammesBaseIndexabilityPolicy } from '../ProgrammesBaseIndexabilityPolicy';
8
7
  import { IProgrammeSeoDependencies } from '../types/IProgrammeSeoDependencies';
9
8
  export declare class DegreeCountryDiscipline extends ProgrammesBaseIndexabilityPolicy {
10
9
  readonly name: string;
11
10
  readonly description: string;
12
11
  readonly filterKeys: FilterKey[];
13
- protected readonly rules: (SingleValueSelectedForFilterRule | OnlyFiltersSelectedRule | DegreeCountrySpecificRule | MasterOfEducationCountryDisciplineRule)[];
12
+ protected readonly rules: (SingleValueSelectedForFilterRule | OnlyFiltersSelectedRule | DegreeCountryDisciplineSpecificRule)[];
14
13
  constructor(dependencies: IProgrammeSeoDependencies);
15
14
  protected generateUrls(): Promise<string[]>;
16
15
  get filterCombination(): FilterCombinations;
@@ -3,8 +3,7 @@ import { DegreeTypeFilterOptionValue } from '@studyportals/search-filters';
3
3
  import { OnlyFiltersSelectedRule } from '../../common/rules/OnlyFiltersSelectedRule';
4
4
  import { SingleValueSelectedForFilterRule } from '../../common/rules/SingleValueSelectedForFilterRule';
5
5
  import { FilterCombinations } from '../../enums/FilterCombinations';
6
- import { DegreeCountrySpecificRule } from '../rules/DegreeCountrySpecificRule';
7
- import { MasterOfEducationCountryDisciplineRule } from '../rules/MasterOfEducationCountryDisciplineRule';
6
+ import { DegreeCountryDisciplineSpecificRule } from '../rules/DegreeCountryDisciplineSpecificRule';
8
7
  import { ProgrammesBaseIndexabilityPolicy } from '../ProgrammesBaseIndexabilityPolicy';
9
8
  import { DegreePresenter } from '../../presenters/DegreePresenter';
10
9
  import { CountryPresenter } from '../../presenters/CountryPresenter';
@@ -18,8 +17,7 @@ export class DegreeCountryDiscipline extends ProgrammesBaseIndexabilityPolicy {
18
17
  new SingleValueSelectedForFilterRule(FilterKey.COUNTRY),
19
18
  new SingleValueSelectedForFilterRule(FilterKey.DISCIPLINES),
20
19
  new OnlyFiltersSelectedRule([FilterKey.DEGREE_TYPE, FilterKey.COUNTRY, FilterKey.DISCIPLINES]),
21
- new DegreeCountrySpecificRule(),
22
- new MasterOfEducationCountryDisciplineRule()
20
+ new DegreeCountryDisciplineSpecificRule(),
23
21
  ];
24
22
  constructor(dependencies) {
25
23
  super(dependencies);
@@ -0,0 +1,11 @@
1
+ import { ISearchDependencies } from '../../common/ISearchDependencies';
2
+ import { FilterKeyValuesMap } from '../../common/FilterKeyValuesMap';
3
+ import { BaseProgrammeRule } from '../BaseProgrammeRule';
4
+ export declare class DegreeCountryDisciplineSpecificRule extends BaseProgrammeRule {
5
+ private readonly educationDisciplineIds;
6
+ private readonly validCombinations;
7
+ getName(): string;
8
+ getDescription(): string;
9
+ forSearch(dependencies: ISearchDependencies): Promise<boolean>;
10
+ forSitemapGenerator(filterKeyValues: FilterKeyValuesMap): Promise<boolean>;
11
+ }
@@ -0,0 +1,70 @@
1
+ import { FilterKey } from '@studyportals/search-filters';
2
+ import { DegreeTypeFilterOptionValue } from '@studyportals/search-filters';
3
+ import { BaseProgrammeRule } from '../BaseProgrammeRule';
4
+ export class DegreeCountryDisciplineSpecificRule extends BaseProgrammeRule {
5
+ educationDisciplineIds = [
6
+ '289', // Education & Training (main discipline)
7
+ '290', // Adult Education
8
+ '360', // Art Education
9
+ '291', // Coaching
10
+ '292', // School Counselling
11
+ '333', // Early Childhood Education
12
+ '8', // Education
13
+ '349', // Educational Leadership
14
+ '293', // Educational Psychology
15
+ '98', // Educational Research
16
+ '371', // Health Education
17
+ '363', // Higher Education
18
+ '355', // Instructional Design
19
+ '370', // Literacy Education
20
+ '348', // Primary Education
21
+ '97', // Special Education
22
+ '359', // Secondary Education
23
+ '345', // STEM Education
24
+ '295', // Teaching
25
+ '358' // Teaching English as a Foreign Language
26
+ ];
27
+ validCombinations = {
28
+ [DegreeTypeFilterOptionValue.MSC]: ['82', '56', '11', '30'],
29
+ [DegreeTypeFilterOptionValue.MBA]: ['82', '30'],
30
+ [DegreeTypeFilterOptionValue.MED]: ['202', '56']
31
+ };
32
+ getName() {
33
+ return 'DegreeCountrySpecificRule';
34
+ }
35
+ getDescription() {
36
+ return 'Indexes: master-of-science (USA, Canada, Germany, UK); master-of-business-administration (USA, UK); master-of-education (Australia, Canada)';
37
+ }
38
+ forSearch(dependencies) {
39
+ const { seoInfoBase, filterState } = dependencies;
40
+ const degreeTypeValue = seoInfoBase.getFilterOptionValueBy(FilterKey.DEGREE_TYPE, filterState);
41
+ const countryValue = seoInfoBase.getFilterOptionValueBy(FilterKey.COUNTRY, filterState);
42
+ const disciplineValue = seoInfoBase.getFilterOptionValueBy(FilterKey.DISCIPLINES, filterState);
43
+ if (!degreeTypeValue || !countryValue || !disciplineValue) {
44
+ return Promise.resolve(false);
45
+ }
46
+ const allowedCountries = this.validCombinations[degreeTypeValue];
47
+ if (!allowedCountries) {
48
+ return Promise.resolve(false);
49
+ }
50
+ if (degreeTypeValue === DegreeTypeFilterOptionValue.MED) {
51
+ return Promise.resolve(allowedCountries.includes(countryValue) &&
52
+ this.educationDisciplineIds.includes(disciplineValue));
53
+ }
54
+ return Promise.resolve(allowedCountries.includes(countryValue));
55
+ }
56
+ forSitemapGenerator(filterKeyValues) {
57
+ const degreeTypeValues = filterKeyValues.get(FilterKey.DEGREE_TYPE);
58
+ const countryValues = filterKeyValues.get(FilterKey.COUNTRY);
59
+ if (!degreeTypeValues?.length || !countryValues?.length) {
60
+ return Promise.resolve(false);
61
+ }
62
+ const degreeTypeValue = degreeTypeValues[0];
63
+ const countryValue = countryValues[0];
64
+ const allowedCountries = this.validCombinations[degreeTypeValue];
65
+ if (!allowedCountries) {
66
+ return Promise.resolve(false);
67
+ }
68
+ return Promise.resolve(allowedCountries.includes(countryValue));
69
+ }
70
+ }
@@ -40,7 +40,7 @@ export class DegreeDisciplineRule extends BaseProgrammeRule {
40
40
  ];
41
41
  masterOfPhilosophyDisciplineIds = [
42
42
  '118',
43
- '3',
43
+ '23',
44
44
  '335',
45
45
  '71',
46
46
  '281',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studyportals/fawkes",
3
- "version": "7.2.2-14",
3
+ "version": "7.2.2-15",
4
4
  "description": "A package to centralize SEO related logic for SBLP and Sitemap Generator.",
5
5
  "files": [
6
6
  "./dist"