@studyportals/fawkes 7.5.1-0 → 7.5.1-3

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 (73) hide show
  1. package/README.md +176 -176
  2. package/dist/src/programmes/SearchIndexabilityManager.js +2 -0
  3. package/dist/src/programmes/policies/AttendanceArea.js +1 -1
  4. package/dist/src/programmes/policies/AttendanceDegree.d.ts +2 -1
  5. package/dist/src/programmes/policies/AttendanceDegree.js +3 -1
  6. package/dist/src/programmes/policies/AttendanceDuration.d.ts +2 -1
  7. package/dist/src/programmes/policies/AttendanceDuration.js +3 -1
  8. package/dist/src/programmes/policies/AttendanceTuitionFee.d.ts +2 -1
  9. package/dist/src/programmes/policies/AttendanceTuitionFee.js +3 -1
  10. package/dist/src/programmes/policies/ContinentDuration.d.ts +2 -1
  11. package/dist/src/programmes/policies/ContinentDuration.js +2 -0
  12. package/dist/src/programmes/policies/ContinentFormat.d.ts +2 -1
  13. package/dist/src/programmes/policies/ContinentFormat.js +2 -0
  14. package/dist/src/programmes/policies/ContinentSpecialProgrammes.d.ts +2 -1
  15. package/dist/src/programmes/policies/ContinentSpecialProgrammes.js +2 -0
  16. package/dist/src/programmes/policies/CountryAttendanceDegree.js +1 -1
  17. package/dist/src/programmes/policies/CountryDurationDegree.js +1 -1
  18. package/dist/src/programmes/policies/CountryEducationalForm.js +1 -1
  19. package/dist/src/programmes/policies/CountrySpecialProgrammes.d.ts +2 -1
  20. package/dist/src/programmes/policies/CountrySpecialProgrammes.js +2 -0
  21. package/dist/src/programmes/policies/DegreeAreaTuitionFee.d.ts +2 -1
  22. package/dist/src/programmes/policies/DegreeAreaTuitionFee.js +3 -1
  23. package/dist/src/programmes/policies/DegreeAttendanceFormat.d.ts +3 -1
  24. package/dist/src/programmes/policies/DegreeAttendanceFormat.js +4 -0
  25. package/dist/src/programmes/policies/DegreeAttendanceSpecialProgrammes.d.ts +2 -1
  26. package/dist/src/programmes/policies/DegreeAttendanceSpecialProgrammes.js +4 -2
  27. package/dist/src/programmes/policies/DegreeAttendanceTuitionFee.d.ts +3 -1
  28. package/dist/src/programmes/policies/DegreeAttendanceTuitionFee.js +5 -1
  29. package/dist/src/programmes/policies/DegreeDuration.d.ts +2 -1
  30. package/dist/src/programmes/policies/DegreeDuration.js +3 -1
  31. package/dist/src/programmes/policies/DegreeFormatTuitionFee.d.ts +3 -1
  32. package/dist/src/programmes/policies/DegreeFormatTuitionFee.js +5 -1
  33. package/dist/src/programmes/policies/DegreeSpecialProgrammes.d.ts +3 -1
  34. package/dist/src/programmes/policies/DegreeSpecialProgrammes.js +4 -0
  35. package/dist/src/programmes/policies/DegreeTuitionFee.d.ts +2 -1
  36. package/dist/src/programmes/policies/DegreeTuitionFee.js +2 -0
  37. package/dist/src/programmes/policies/DisciplineCountryDegree.js +1 -1
  38. package/dist/src/programmes/policies/DisciplineCountryEducationalForm.js +1 -1
  39. package/dist/src/programmes/policies/DisciplineCountryFormat.d.ts +2 -1
  40. package/dist/src/programmes/policies/DisciplineCountryFormat.js +2 -0
  41. package/dist/src/programmes/policies/DisciplineEducationalForm.js +1 -1
  42. package/dist/src/programmes/policies/DisciplineSpecialProgrammes.d.ts +2 -1
  43. package/dist/src/programmes/policies/DisciplineSpecialProgrammes.js +2 -0
  44. package/dist/src/programmes/policies/Duration.d.ts +2 -1
  45. package/dist/src/programmes/policies/Duration.js +3 -1
  46. package/dist/src/programmes/policies/SpecialProgrammes.js +1 -1
  47. package/dist/src/programmes/rules/BlendedOrOnlineAttendanceRule.d.ts +6 -0
  48. package/dist/src/programmes/rules/BlendedOrOnlineAttendanceRule.js +18 -0
  49. package/dist/src/programmes/rules/DegreeCountryTuitionFeeRule.js +2 -1
  50. package/dist/src/programmes/rules/ErasmusOrExecutiveSpecialProgrammeRule.d.ts +6 -0
  51. package/dist/src/programmes/rules/ErasmusOrExecutiveSpecialProgrammeRule.js +19 -0
  52. package/dist/src/programmes/rules/ErasmusSpecialProgrammeRule.d.ts +6 -0
  53. package/dist/src/programmes/rules/ErasmusSpecialProgrammeRule.js +19 -0
  54. package/dist/src/programmes/rules/ExecutiveSpecialProgrammeRule.d.ts +6 -0
  55. package/dist/src/programmes/rules/ExecutiveSpecialProgrammeRule.js +19 -0
  56. package/dist/src/programmes/rules/MasterOfLawsCountryAttendanceRule.js +2 -1
  57. package/dist/src/programmes/rules/MasterOfLawsCountryTuitionFeeRule.js +2 -1
  58. package/dist/src/programmes/rules/MasterOfPhilosophyCountryAttendanceRule.js +2 -1
  59. package/dist/src/programmes/rules/OneOrTwoYearDurationRule.d.ts +6 -0
  60. package/dist/src/programmes/rules/OneOrTwoYearDurationRule.js +19 -0
  61. package/dist/src/programmes/rules/TwoYearDurationRule.d.ts +6 -0
  62. package/dist/src/programmes/rules/TwoYearDurationRule.js +19 -0
  63. package/package.json +105 -105
  64. package/dist/src/common/IPolicyMetaData.d.ts +0 -6
  65. package/dist/src/common/IPolicyMetaData.js +0 -1
  66. package/dist/src/programmes/rules/DegreeAttendanceSpecificRule.d.ts +0 -10
  67. package/dist/src/programmes/rules/DegreeAttendanceSpecificRule.js +0 -42
  68. package/dist/src/programmes/rules/MasterOfArtsDisciplineRule.d.ts +0 -10
  69. package/dist/src/programmes/rules/MasterOfArtsDisciplineRule.js +0 -41
  70. package/dist/src/programmes/rules/MasterOfScienceDisciplineRule.d.ts +0 -10
  71. package/dist/src/programmes/rules/MasterOfScienceDisciplineRule.js +0 -41
  72. package/dist/src/sitemap-generator/IPageNumberProvider.d.ts +0 -3
  73. package/dist/src/sitemap-generator/IPageNumberProvider.js +0 -1
@@ -0,0 +1,19 @@
1
+ import { FilterKey } from '@studyportals/search-filters/server-side';
2
+ import { DurationFilterOptionValue } from '@studyportals/search-filters/server-side';
3
+ import { BaseProgrammeFilterKeyValueRule } from '../BaseProgrammeFilterKeyValueRule';
4
+ export class OneOrTwoYearDurationRule extends BaseProgrammeFilterKeyValueRule {
5
+ constructor() {
6
+ const filterKeyValues = new Map([[
7
+ FilterKey.DURATION,
8
+ [DurationFilterOptionValue.ONE_YEAR, DurationFilterOptionValue.TWO_YEARS]
9
+ ]
10
+ ]);
11
+ super(filterKeyValues);
12
+ }
13
+ getName() {
14
+ return 'OneOrTwoYearDurationRule';
15
+ }
16
+ getDescription() {
17
+ return 'Is indexable if the selected duration is one or two years.';
18
+ }
19
+ }
@@ -0,0 +1,6 @@
1
+ import { BaseProgrammeFilterKeyValueRule } from '../BaseProgrammeFilterKeyValueRule';
2
+ export declare class TwoYearDurationRule extends BaseProgrammeFilterKeyValueRule {
3
+ constructor();
4
+ getName(): string;
5
+ getDescription(): string;
6
+ }
@@ -0,0 +1,19 @@
1
+ import { FilterKey } from '@studyportals/search-filters/server-side';
2
+ import { DurationFilterOptionValue } from '@studyportals/search-filters/server-side';
3
+ import { BaseProgrammeFilterKeyValueRule } from '../BaseProgrammeFilterKeyValueRule';
4
+ export class TwoYearDurationRule extends BaseProgrammeFilterKeyValueRule {
5
+ constructor() {
6
+ const filterKeyValues = new Map([[
7
+ FilterKey.DURATION,
8
+ [DurationFilterOptionValue.TWO_YEARS]
9
+ ]
10
+ ]);
11
+ super(filterKeyValues);
12
+ }
13
+ getName() {
14
+ return 'TwoYearDurationRule';
15
+ }
16
+ getDescription() {
17
+ return 'Is indexable if the selected duration is two years.';
18
+ }
19
+ }
package/package.json CHANGED
@@ -1,105 +1,105 @@
1
- {
2
- "name": "@studyportals/fawkes",
3
- "version": "7.5.1-0",
4
- "description": "A package to centralize SEO related logic for SBLP and Sitemap Generator.",
5
- "files": [
6
- "./dist"
7
- ],
8
- "scripts": {
9
- "prepush": "npm run test",
10
- "precommit": "npm run lint",
11
- "compile": "npx tsc && tsc-alias && rm -r ./dist/tests",
12
- "build": "npm run clean && npm run compile",
13
- "clean": "rimraf \"!(node_modules)/**/dist\"",
14
- "prepare-deployment": "npm run test && npm run build",
15
- "publish-major": "npm run prepare-deployment && npm version major && npm publish",
16
- "publish-beta": "npm run prepare-deployment && npm version prerelease && npm publish --tag beta --access=public",
17
- "publish-patch": "npm run prepare-deployment && npm version patch && npm publish",
18
- "publish-minor": "npm run prepare-deployment && npm version minor && npm publish",
19
- "prepare": "husky install",
20
- "test": "vitest run --coverage",
21
- "test:dev": "vitest --coverage tests/programmes",
22
- "lint": "eslint . --ext .ts",
23
- "lint:fix": "eslint . --ext .ts --fix",
24
- "prettier:fix": "npx prettier --use-tabs --ignore-path .gitignore --write ."
25
- },
26
- "exports": {
27
- "./organisations-search-seo": {
28
- "import": "./dist/organisations-seo/index.js",
29
- "require": "./dist/organisations-seo/index.js",
30
- "types": "./dist/organisations-seo/index.d.ts"
31
- },
32
- "./programmes-search-seo": {
33
- "import": "./dist/programmes-seo/index.js",
34
- "require": "./dist/programmes-seo/index.js",
35
- "types": "./dist/programmes-seo/index.d.ts"
36
- },
37
- "./scholarships-search-seo": {
38
- "import": "./dist/scholarships-seo/index.js",
39
- "require": "./dist/scholarships-seo/index.js",
40
- "types": "./dist/scholarships-seo/index.d.ts"
41
- },
42
- "./sitemap-generator-seo": {
43
- "import": "./dist/sitemap-generator-seo/index.js",
44
- "require": "./dist/sitemap-generator-seo/index.js",
45
- "types": "./dist/sitemap-generator-seo/index.d.ts"
46
- },
47
- "./structured-data-seo": {
48
- "import": "./dist/structured-data-seo/index.js",
49
- "require": "./dist/structured-data-seo/index.js",
50
- "types": "./dist/structured-data-seo/index.d.ts"
51
- }
52
- },
53
- "typesVersions": {
54
- "*": {
55
- "organisations-search-seo": [
56
- "dist/organisations-seo/index.d.ts"
57
- ],
58
- "programmes-search-seo": [
59
- "dist/programmes-seo/index.d.ts"
60
- ],
61
- "scholarships-search-seo": [
62
- "dist/scholarships-seo/index.d.ts"
63
- ],
64
- "sitemap-generator-seo": [
65
- "dist/sitemap-generator-seo/index.d.ts"
66
- ],
67
- "structured-data-seo": [
68
- "dist/structured-data-seo/index.d.ts"
69
- ],
70
- "*": [
71
- "dist/index.d.ts"
72
- ]
73
- }
74
- },
75
- "author": "The Jedi Council",
76
- "license": "ISC",
77
- "devDependencies": {
78
- "@adobe/structured-data-validator": "^1.4.1",
79
- "@studyportals/code-style": "^2.2.1",
80
- "@studyportals/webpack-helper": "^6.0.6",
81
- "@vitest/coverage-istanbul": "^2.1.8",
82
- "husky": "^8.0.3",
83
- "jsdom": "^26.0.0",
84
- "prettier": "^3.5.3",
85
- "schema-dts": "^1.1.5",
86
- "ts-loader": "^9.5.2",
87
- "tsc-alias": "^1.8.11",
88
- "typemoq": "^2.1.0",
89
- "typescript": "^5.7.3",
90
- "vitest": "^2.1.8"
91
- },
92
- "dependencies": {
93
- "@studyportals/domain-client": "7.1.0",
94
- "@studyportals/ranking-api-interface": "^1.3.12",
95
- "@studyportals/search-filters": "^6.1.0",
96
- "@studyportals/static-domain-data": "^6.1.0"
97
- },
98
- "optionalDependencies": {
99
- "@rollup/rollup-linux-x64-gnu": "4.24.0"
100
- },
101
- "engines": {
102
- "node": ">=18 <=22",
103
- "npm": ">=8 <=10"
104
- }
105
- }
1
+ {
2
+ "name": "@studyportals/fawkes",
3
+ "version": "7.5.1-3",
4
+ "description": "A package to centralize SEO related logic for SBLP and Sitemap Generator.",
5
+ "files": [
6
+ "./dist"
7
+ ],
8
+ "scripts": {
9
+ "prepush": "npm run test",
10
+ "precommit": "npm run lint",
11
+ "compile": "npx tsc && tsc-alias && rm -r ./dist/tests",
12
+ "build": "npm run clean && npm run compile",
13
+ "clean": "rimraf \"!(node_modules)/**/dist\"",
14
+ "prepare-deployment": "npm run test && npm run build",
15
+ "publish-major": "npm run prepare-deployment && npm version major && npm publish",
16
+ "publish-beta": "npm run prepare-deployment && npm version prerelease && npm publish --tag beta --access=public",
17
+ "publish-patch": "npm run prepare-deployment && npm version patch && npm publish",
18
+ "publish-minor": "npm run prepare-deployment && npm version minor && npm publish",
19
+ "prepare": "husky install",
20
+ "test": "vitest run --coverage",
21
+ "test:dev": "vitest --coverage tests/programmes",
22
+ "lint": "eslint . --ext .ts",
23
+ "lint:fix": "eslint . --ext .ts --fix",
24
+ "prettier:fix": "npx prettier --use-tabs --ignore-path .gitignore --write ."
25
+ },
26
+ "exports": {
27
+ "./organisations-search-seo": {
28
+ "import": "./dist/organisations-seo/index.js",
29
+ "require": "./dist/organisations-seo/index.js",
30
+ "types": "./dist/organisations-seo/index.d.ts"
31
+ },
32
+ "./programmes-search-seo": {
33
+ "import": "./dist/programmes-seo/index.js",
34
+ "require": "./dist/programmes-seo/index.js",
35
+ "types": "./dist/programmes-seo/index.d.ts"
36
+ },
37
+ "./scholarships-search-seo": {
38
+ "import": "./dist/scholarships-seo/index.js",
39
+ "require": "./dist/scholarships-seo/index.js",
40
+ "types": "./dist/scholarships-seo/index.d.ts"
41
+ },
42
+ "./sitemap-generator-seo": {
43
+ "import": "./dist/sitemap-generator-seo/index.js",
44
+ "require": "./dist/sitemap-generator-seo/index.js",
45
+ "types": "./dist/sitemap-generator-seo/index.d.ts"
46
+ },
47
+ "./structured-data-seo": {
48
+ "import": "./dist/structured-data-seo/index.js",
49
+ "require": "./dist/structured-data-seo/index.js",
50
+ "types": "./dist/structured-data-seo/index.d.ts"
51
+ }
52
+ },
53
+ "typesVersions": {
54
+ "*": {
55
+ "organisations-search-seo": [
56
+ "dist/organisations-seo/index.d.ts"
57
+ ],
58
+ "programmes-search-seo": [
59
+ "dist/programmes-seo/index.d.ts"
60
+ ],
61
+ "scholarships-search-seo": [
62
+ "dist/scholarships-seo/index.d.ts"
63
+ ],
64
+ "sitemap-generator-seo": [
65
+ "dist/sitemap-generator-seo/index.d.ts"
66
+ ],
67
+ "structured-data-seo": [
68
+ "dist/structured-data-seo/index.d.ts"
69
+ ],
70
+ "*": [
71
+ "dist/index.d.ts"
72
+ ]
73
+ }
74
+ },
75
+ "author": "The Jedi Council",
76
+ "license": "ISC",
77
+ "devDependencies": {
78
+ "@adobe/structured-data-validator": "^1.4.1",
79
+ "@studyportals/code-style": "^2.2.1",
80
+ "@studyportals/webpack-helper": "^6.0.6",
81
+ "@vitest/coverage-istanbul": "^2.1.8",
82
+ "husky": "^8.0.3",
83
+ "jsdom": "^26.0.0",
84
+ "prettier": "^3.5.3",
85
+ "schema-dts": "^1.1.5",
86
+ "ts-loader": "^9.5.2",
87
+ "tsc-alias": "^1.8.11",
88
+ "typemoq": "^2.1.0",
89
+ "typescript": "^5.7.3",
90
+ "vitest": "^2.1.8"
91
+ },
92
+ "dependencies": {
93
+ "@studyportals/domain-client": "7.1.0",
94
+ "@studyportals/ranking-api-interface": "^1.3.12",
95
+ "@studyportals/search-filters": "^6.1.0",
96
+ "@studyportals/static-domain-data": "^6.1.0"
97
+ },
98
+ "optionalDependencies": {
99
+ "@rollup/rollup-linux-x64-gnu": "4.24.0"
100
+ },
101
+ "engines": {
102
+ "node": ">=18 <=22",
103
+ "npm": ">=8 <=10"
104
+ }
105
+ }
@@ -1,6 +0,0 @@
1
- import { IRule } from "./IRule";
2
- export interface IPolicyMetaData {
3
- getAllRules(): IRule[];
4
- getName(): string;
5
- getDescription(): string;
6
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- import { ISearchDependencies } from '../../common/ISearchDependencies';
2
- import { FilterKeyValuesMap } from '../../common/FilterKeyValuesMap';
3
- import { BaseProgrammeRule } from '../BaseProgrammeRule';
4
- export declare class DegreeAttendanceSpecificRule extends BaseProgrammeRule {
5
- private readonly validCombinations;
6
- getName(): string;
7
- getDescription(): string;
8
- forSearch(dependencies: ISearchDependencies): Promise<boolean>;
9
- forSitemapGenerator(filterKeyValues: FilterKeyValuesMap): Promise<boolean>;
10
- }
@@ -1,42 +0,0 @@
1
- import { FilterKey } from '@studyportals/search-filters';
2
- import { BaseProgrammeRule } from '../BaseProgrammeRule';
3
- export class DegreeAttendanceSpecificRule extends BaseProgrammeRule {
4
- validCombinations = {
5
- 'master-of-science': ['online'], // MSc with online attendance
6
- 'master-of-arts': ['online'], // MA with online attendance
7
- 'master-of-business-administration': ['online'] // MBA with online attendance
8
- };
9
- getName() {
10
- return 'DegreeAttendanceSpecificRule';
11
- }
12
- getDescription() {
13
- return 'Indexes: master-of-science (online); master-of-arts (online); master-of-business-administration (online)';
14
- }
15
- forSearch(dependencies) {
16
- const { seoInfoBase, filterState } = dependencies;
17
- const degreeTypeValue = seoInfoBase.getFilterOptionValueBy(FilterKey.DEGREE_TYPE, filterState);
18
- const attendanceValue = seoInfoBase.getFilterOptionValueBy(FilterKey.DELIVERY_METHOD, filterState);
19
- if (!degreeTypeValue || !attendanceValue) {
20
- return Promise.resolve(false);
21
- }
22
- const allowedAttendance = this.validCombinations[degreeTypeValue];
23
- if (!allowedAttendance) {
24
- return Promise.resolve(false);
25
- }
26
- return Promise.resolve(allowedAttendance.includes(attendanceValue));
27
- }
28
- forSitemapGenerator(filterKeyValues) {
29
- const degreeTypeValues = filterKeyValues.get(FilterKey.DEGREE_TYPE);
30
- const attendanceValues = filterKeyValues.get(FilterKey.DELIVERY_METHOD);
31
- if (!degreeTypeValues?.length || !attendanceValues?.length) {
32
- return Promise.resolve(false);
33
- }
34
- const degreeTypeValue = degreeTypeValues[0];
35
- const attendanceValue = attendanceValues[0];
36
- const allowedAttendance = this.validCombinations[degreeTypeValue];
37
- if (!allowedAttendance) {
38
- return Promise.resolve(false);
39
- }
40
- return Promise.resolve(allowedAttendance.includes(attendanceValue));
41
- }
42
- }
@@ -1,10 +0,0 @@
1
- import { ISearchDependencies } from '../../common/ISearchDependencies';
2
- import { FilterKeyValuesMap } from '../../common/FilterKeyValuesMap';
3
- import { BaseProgrammeRule } from '../BaseProgrammeRule';
4
- export declare class MasterOfArtsDisciplineRule extends BaseProgrammeRule {
5
- private readonly degreeValue;
6
- getName(): string;
7
- getDescription(): string;
8
- forSearch(dependencies: ISearchDependencies): Promise<boolean>;
9
- forSitemapGenerator(filterKeyValues: FilterKeyValuesMap): Promise<boolean>;
10
- }
@@ -1,41 +0,0 @@
1
- import { FilterKey } from '@studyportals/search-filters';
2
- import { BaseProgrammeRule } from '../BaseProgrammeRule';
3
- export class MasterOfArtsDisciplineRule extends BaseProgrammeRule {
4
- // Master of Arts accepts all disciplines
5
- degreeValue = 'master-of-arts';
6
- getName() {
7
- return 'MasterOfArtsDisciplineRule';
8
- }
9
- getDescription() {
10
- return 'Indexes: master-of-arts + all disciplines';
11
- }
12
- forSearch(dependencies) {
13
- const { seoInfoBase, filterState } = dependencies;
14
- const degreeTypeValue = seoInfoBase.getFilterOptionValueBy(FilterKey.DEGREE_TYPE, filterState);
15
- const disciplineValue = seoInfoBase.getFilterOptionValueBy(FilterKey.DISCIPLINES, filterState);
16
- // This rule only applies to Master of Arts
17
- if (degreeTypeValue !== this.degreeValue) {
18
- return Promise.resolve(true); // Rule doesn't apply to other degrees
19
- }
20
- // Must have a discipline selected
21
- if (!disciplineValue) {
22
- return Promise.resolve(false);
23
- }
24
- // Master of Arts accepts all disciplines
25
- return Promise.resolve(true);
26
- }
27
- forSitemapGenerator(filterKeyValues) {
28
- const degreeTypeValues = filterKeyValues.get(FilterKey.DEGREE_TYPE);
29
- const disciplineValues = filterKeyValues.get(FilterKey.DISCIPLINES);
30
- if (!degreeTypeValues?.length || !disciplineValues?.length) {
31
- return Promise.resolve(false);
32
- }
33
- const degreeTypeValue = degreeTypeValues[0];
34
- // This rule only applies to Master of Arts
35
- if (degreeTypeValue !== this.degreeValue) {
36
- return Promise.resolve(true); // Rule doesn't apply to other degrees
37
- }
38
- // Master of Arts accepts all disciplines
39
- return Promise.resolve(true);
40
- }
41
- }
@@ -1,10 +0,0 @@
1
- import { ISearchDependencies } from '../../common/ISearchDependencies';
2
- import { FilterKeyValuesMap } from '../../common/FilterKeyValuesMap';
3
- import { BaseProgrammeRule } from '../BaseProgrammeRule';
4
- export declare class MasterOfScienceDisciplineRule extends BaseProgrammeRule {
5
- private readonly degreeValue;
6
- getName(): string;
7
- getDescription(): string;
8
- forSearch(dependencies: ISearchDependencies): Promise<boolean>;
9
- forSitemapGenerator(filterKeyValues: FilterKeyValuesMap): Promise<boolean>;
10
- }
@@ -1,41 +0,0 @@
1
- import { FilterKey } from '@studyportals/search-filters';
2
- import { BaseProgrammeRule } from '../BaseProgrammeRule';
3
- export class MasterOfScienceDisciplineRule extends BaseProgrammeRule {
4
- // Master of Science accepts all disciplines
5
- degreeValue = 'master-of-science';
6
- getName() {
7
- return 'MasterOfScienceDisciplineRule';
8
- }
9
- getDescription() {
10
- return 'Indexes: master-of-science + all disciplines';
11
- }
12
- forSearch(dependencies) {
13
- const { seoInfoBase, filterState } = dependencies;
14
- const degreeTypeValue = seoInfoBase.getFilterOptionValueBy(FilterKey.DEGREE_TYPE, filterState);
15
- const disciplineValue = seoInfoBase.getFilterOptionValueBy(FilterKey.DISCIPLINES, filterState);
16
- // This rule only applies to Master of Science
17
- if (degreeTypeValue !== this.degreeValue) {
18
- return Promise.resolve(true); // Rule doesn't apply to other degrees
19
- }
20
- // Must have a discipline selected
21
- if (!disciplineValue) {
22
- return Promise.resolve(false);
23
- }
24
- // Master of Science accepts all disciplines
25
- return Promise.resolve(true);
26
- }
27
- forSitemapGenerator(filterKeyValues) {
28
- const degreeTypeValues = filterKeyValues.get(FilterKey.DEGREE_TYPE);
29
- const disciplineValues = filterKeyValues.get(FilterKey.DISCIPLINES);
30
- if (!degreeTypeValues?.length || !disciplineValues?.length) {
31
- return Promise.resolve(false);
32
- }
33
- const degreeTypeValue = degreeTypeValues[0];
34
- // This rule only applies to Master of Science
35
- if (degreeTypeValue !== this.degreeValue) {
36
- return Promise.resolve(true); // Rule doesn't apply to other degrees
37
- }
38
- // Master of Science accepts all disciplines
39
- return Promise.resolve(true);
40
- }
41
- }
@@ -1,3 +0,0 @@
1
- export interface IPageNumberProvider {
2
- getPageNumber(): number;
3
- }
@@ -1 +0,0 @@
1
- export {};