gatsby-core-theme 44.2.2 → 44.2.4
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/CHANGELOG.md +39 -0
- package/package.json +1 -1
- package/src/components/atoms/breadcrumbs/index.js +3 -6
- package/src/constants/excluded.mjs +7 -0
- package/src/constants/metaTags.js +10 -4
- package/src/constants/site-settings/{main.js → main.mjs} +7 -0
- package/src/helpers/path.mjs +18 -0
- package/src/helpers/path.test.js +34 -3
- package/src/helpers/processor/index.mjs +55 -25
- package/src/helpers/processor/modules.mjs +10 -7
- package/src/helpers/validateData.mjs +12 -8
- package/src/helpers/validateData.test.js +1 -1
- package/src/constants/excludedTemplates.js +0 -2
- package/src/helpers/path.js +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
1
|
+
## [44.2.4](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.2.3...v44.2.4) (2025-06-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add reading time for article for specific sites ([d5c1a3a](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/d5c1a3aa49cb950121d4ee822be76bd4ad25c965))
|
|
7
|
+
* better structure ([f29d9cc](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/f29d9cc1bc4aacf563c01b047fd1f51b1aa5bfcf))
|
|
8
|
+
* build issue ([669e6f4](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/669e6f4280aeea67affe1051d49a6ee1739a3d40))
|
|
9
|
+
* env ([581fcd2](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/581fcd24304f851ee913df5fdeaaa05d2ba3433c))
|
|
10
|
+
* fix test ([43eb3b4](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/43eb3b4966559cdbe72cf58dfe2990895f8a1ab6))
|
|
11
|
+
* fix test ([41290f2](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/41290f2f6e156873a55ca38eff0cbf3d2e288171))
|
|
12
|
+
* fix test ([951ea3d](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/951ea3dfb53fcc7d241ca2044a4019583882b26f))
|
|
13
|
+
* fix tests ([f41c118](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/f41c11889ae6a2f1a7a7039cf12473c0fb5d1ec9))
|
|
14
|
+
* issue ([4621b2a](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/4621b2a2240a2671fd631a8f606c12b74eb674ed))
|
|
15
|
+
* make a fix ([bd46cb1](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/bd46cb11901d8d27d2034cb4c39851cbf70d810d))
|
|
16
|
+
* path js to mjs ([7392666](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/739266641290e2c9d7eaaec80a386defd227732f))
|
|
17
|
+
* remove the inactive toplist for comming soon at pcsa ([d48eda7](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/d48eda74d84d715813baf0d4319acfb97f035090))
|
|
18
|
+
* review link ([3de1d41](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/3de1d414cc78ec36a635c400f7487e3b4989848b))
|
|
19
|
+
* review link ([83d9a24](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/83d9a24d8b9b3dc58b39dd55eda0f3478f83a817))
|
|
20
|
+
* reviewLink ([b23dd60](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/b23dd604857faabeb62a4b5f871e607a576dc25f))
|
|
21
|
+
* test this way ([2267bb2](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/2267bb2cf3ad0c5335fd39516552fe3f04832333))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
* Merge branch 'tm-5486-disable-premain-toplist-coming-soon' into 'master' ([9662ce8](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/9662ce8e50b4d56a8f1d9111618ba63b990075c8))
|
|
25
|
+
* Merge branch 'reviewlink-issue' into 'master' ([1893749](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/1893749134fb1f8c33668a589e76c9d411e6eff5))
|
|
26
|
+
* Merge branch 'tm-5491-reading-time' into 'master' ([96c45e1](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/96c45e1aafb6be54fb99b57909e018f60d5ebf15))
|
|
27
|
+
* Merge branch 'master' into tm-5491-reading-time ([997ae4d](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/997ae4df78abcfa773cfe405a92a9737b8b51850))
|
|
28
|
+
* Merge branch 'master' into tm-5486-disable-premain-toplist-coming-soon ([9e045bf](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/9e045bf5f916d916f671500efca0b3089a2ed819))
|
|
29
|
+
|
|
30
|
+
## [44.2.3](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.2.2...v44.2.3) (2025-06-10)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* update metatags ([7b4759a](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/7b4759ae04d4e47c2d0c669cd62db6147482af1a))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
* Merge branch 'tm-5511-update-matrix-theme-sites' into 'master' ([639eaaf](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/639eaaf32e2d7f4d52cc9d5439a5150acd517ca0))
|
|
39
|
+
|
|
1
40
|
## [44.2.2](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.2.1...v44.2.2) (2025-06-10)
|
|
2
41
|
|
|
3
42
|
|
package/package.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable no-unused-expressions */
|
|
1
2
|
import React from "react";
|
|
2
3
|
|
|
3
4
|
import PropTypes from "prop-types";
|
|
@@ -5,7 +6,7 @@ import Link from "~hooks/link";
|
|
|
5
6
|
|
|
6
7
|
import styles from "./breadcrumbs.module.scss";
|
|
7
8
|
import keygen from "~helpers/keygen";
|
|
8
|
-
import { excludeTemplates } from "../../../constants/
|
|
9
|
+
import { excludeTemplates } from "../../../constants/excluded.mjs";
|
|
9
10
|
import useTranslate from "~hooks/useTranslate/useTranslate";
|
|
10
11
|
|
|
11
12
|
function Breadcrumbs({
|
|
@@ -20,11 +21,7 @@ function Breadcrumbs({
|
|
|
20
21
|
);
|
|
21
22
|
const getTranslationArray = () => {
|
|
22
23
|
const translationArray = ["Home", `home_${page.type}`];
|
|
23
|
-
|
|
24
|
-
translationArray.push(
|
|
25
|
-
`home_${page.template}_${page.categories[0].short_name}`
|
|
26
|
-
);
|
|
27
|
-
}
|
|
24
|
+
page?.categories?.length && translationArray.push(`home_${page.template}_${page.categories[0].short_name}`);
|
|
28
25
|
return translationArray;
|
|
29
26
|
};
|
|
30
27
|
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
/* eslint-disable camelcase */
|
|
2
2
|
import parse from 'html-react-parser';
|
|
3
|
-
import { getLanguage,
|
|
4
|
-
import {
|
|
3
|
+
import { getLanguage, getPageImage, imagePrettyUrl } from "~helpers/getters";
|
|
4
|
+
import {
|
|
5
|
+
getRobotOptions,
|
|
6
|
+
getCanonicalUrl,
|
|
7
|
+
transformMetaTitle,
|
|
8
|
+
getTwitterUsername,
|
|
9
|
+
getLocale,
|
|
10
|
+
} from "~helpers/head";
|
|
5
11
|
|
|
6
12
|
|
|
7
13
|
|
|
@@ -24,7 +30,7 @@ export default (page, isTracker) => {
|
|
|
24
30
|
{
|
|
25
31
|
type: "meta",
|
|
26
32
|
property: "og:site_name",
|
|
27
|
-
content: siteInfo?.site_name ?
|
|
33
|
+
content: siteInfo?.site_name ? siteInfo?.site_name : "",
|
|
28
34
|
},
|
|
29
35
|
{ type: "meta", property: "og:description", content: parsedMetaDescr },
|
|
30
36
|
{
|
|
@@ -42,7 +48,7 @@ export default (page, isTracker) => {
|
|
|
42
48
|
type: "meta",
|
|
43
49
|
property: "og:locale",
|
|
44
50
|
content:
|
|
45
|
-
getLanguage(page.market)
|
|
51
|
+
getLanguage(getLocale(page.market))
|
|
46
52
|
},
|
|
47
53
|
{ type: "meta", name:'geo.placename', content: process.env.PLACENAME },
|
|
48
54
|
{ type: "meta", name:'geo.region', content: process.env.COUNTRY },
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* eslint-disable import/prefer-default-export */
|
|
2
|
+
export function formatPath(path) {
|
|
3
|
+
let link = path;
|
|
4
|
+
if (path.charAt(0) !== '/') {
|
|
5
|
+
link = `/${path}`;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
return link;
|
|
9
|
+
}
|
|
10
|
+
/* eslint-disable import/prefer-default-export */
|
|
11
|
+
export function stripDomainAndLeadingSlash(url) {
|
|
12
|
+
try {
|
|
13
|
+
const parsed = new URL(url);
|
|
14
|
+
return parsed.pathname.replace(/^\/+/, '') + parsed.search + parsed.hash;
|
|
15
|
+
} catch {
|
|
16
|
+
return url;
|
|
17
|
+
}
|
|
18
|
+
}
|
package/src/helpers/path.test.js
CHANGED
|
@@ -1,17 +1,48 @@
|
|
|
1
|
-
import { formatPath } from './path';
|
|
1
|
+
import { formatPath, stripDomainAndLeadingSlash } from './path';
|
|
2
2
|
|
|
3
3
|
describe('Path format component', () => {
|
|
4
4
|
test('path format adding /', () => {
|
|
5
5
|
const path = formatPath('test/link');
|
|
6
6
|
expect(typeof path).toEqual('string');
|
|
7
|
-
|
|
8
7
|
expect(path).toBe('/test/link');
|
|
9
8
|
});
|
|
10
9
|
|
|
11
10
|
test('path format keep initial /', () => {
|
|
12
11
|
const path = formatPath('/test/link');
|
|
13
12
|
expect(typeof path).toEqual('string');
|
|
14
|
-
|
|
15
13
|
expect(path).toBe('/test/link');
|
|
16
14
|
});
|
|
17
15
|
});
|
|
16
|
+
|
|
17
|
+
describe('stripDomainAndLeadingSlash', () => {
|
|
18
|
+
test('strips domain and leading slash from full URL', () => {
|
|
19
|
+
const url = 'https://www.playcasino.co.za/';
|
|
20
|
+
const result = stripDomainAndLeadingSlash(url);
|
|
21
|
+
expect(result).toBe('');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('strips domain and leading slash review', () => {
|
|
25
|
+
const url = 'https://www.playcasino.co.za/yebo-casino-review';
|
|
26
|
+
const result = stripDomainAndLeadingSlash(url);
|
|
27
|
+
expect(result).toBe('yebo-casino-review');
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
test('strips only leading slashes if no domain', () => {
|
|
32
|
+
const url = '/yebo-casino-review';
|
|
33
|
+
const result = stripDomainAndLeadingSlash(url);
|
|
34
|
+
expect(result).toBe('/yebo-casino-review');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('returns original input if invalid URL', () => {
|
|
38
|
+
const url = 'not a real url';
|
|
39
|
+
const result = stripDomainAndLeadingSlash(url);
|
|
40
|
+
expect(result).toBe(url);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('handles URLs with multiple leading slashes', () => {
|
|
44
|
+
const url = 'https://example.com///deep/path';
|
|
45
|
+
const result = stripDomainAndLeadingSlash(url);
|
|
46
|
+
expect(result).toBe('deep/path');
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -20,9 +20,11 @@ import {
|
|
|
20
20
|
groupBy,
|
|
21
21
|
removeTags,
|
|
22
22
|
updateMenuPrefixPath,
|
|
23
|
-
filterRelation
|
|
23
|
+
filterRelation,
|
|
24
24
|
} from "./common.mjs";
|
|
25
25
|
|
|
26
|
+
import { mainSettings } from "../../constants/site-settings/main.mjs";
|
|
27
|
+
|
|
26
28
|
import {
|
|
27
29
|
generateHreflangs,
|
|
28
30
|
transformCategories,
|
|
@@ -35,7 +37,7 @@ import { processRelations } from "./relations.mjs";
|
|
|
35
37
|
import { processSportsRelations } from "./sports-relations.mjs";
|
|
36
38
|
import { zeroPadding } from "../schedule.mjs";
|
|
37
39
|
import { getRoundMinutes } from "../getters.mjs";
|
|
38
|
-
import
|
|
40
|
+
import checkForInactiveOperatorToplist from "../validateData.mjs";
|
|
39
41
|
|
|
40
42
|
const { cloneDeep, pick } = loadash;
|
|
41
43
|
const postSectionsMap = {
|
|
@@ -45,7 +47,6 @@ const postSectionsMap = {
|
|
|
45
47
|
};
|
|
46
48
|
|
|
47
49
|
let pages = null;
|
|
48
|
-
let pagesCloned = null;
|
|
49
50
|
const pagesMappedById = [];
|
|
50
51
|
let relations = null;
|
|
51
52
|
let menus = null;
|
|
@@ -114,8 +115,9 @@ export function transform(response) {
|
|
|
114
115
|
|
|
115
116
|
if (response.site_markets[siteMarket].path_prefix && page) {
|
|
116
117
|
// set page prefix for multiple markets
|
|
117
|
-
page.path = `${response.site_markets[siteMarket].path_prefix}${
|
|
118
|
-
}
|
|
118
|
+
page.path = `${response.site_markets[siteMarket].path_prefix}${
|
|
119
|
+
page.path !== "/" ? `/${page.path}` : ""
|
|
120
|
+
}`;
|
|
119
121
|
transformed[siteMarket][pageType].push(page);
|
|
120
122
|
} else if (page) {
|
|
121
123
|
transformed[siteMarket][pageType].push(page);
|
|
@@ -159,6 +161,7 @@ export function processSections(
|
|
|
159
161
|
content
|
|
160
162
|
);
|
|
161
163
|
}
|
|
164
|
+
|
|
162
165
|
if (sections[sectionKey] && sections[sectionKey].modules) {
|
|
163
166
|
sections[sectionKey].modules.forEach((module, key) => {
|
|
164
167
|
if (
|
|
@@ -193,7 +196,6 @@ export function processSections(
|
|
|
193
196
|
processModule(
|
|
194
197
|
module,
|
|
195
198
|
pages,
|
|
196
|
-
pagesCloned,
|
|
197
199
|
relations,
|
|
198
200
|
pagesMappedById,
|
|
199
201
|
menus,
|
|
@@ -219,7 +221,7 @@ export function processSections(
|
|
|
219
221
|
return sections;
|
|
220
222
|
}
|
|
221
223
|
|
|
222
|
-
export function getReadingTime(sections) {
|
|
224
|
+
export function getReadingTime(sections, content) {
|
|
223
225
|
let minutes = 0;
|
|
224
226
|
let seconds = 0;
|
|
225
227
|
|
|
@@ -228,7 +230,7 @@ export function getReadingTime(sections) {
|
|
|
228
230
|
sections[sectionKey].modules.forEach((module) => {
|
|
229
231
|
// calculate reading time
|
|
230
232
|
if (module.name === "content") {
|
|
231
|
-
const nrOfWords = removeTags(module.value).split(" ").length / 250;
|
|
233
|
+
const nrOfWords = removeTags(content ? content[module.value] : module.value).split(" ").length / 250;
|
|
232
234
|
const minPerModule = Math.floor(nrOfWords);
|
|
233
235
|
const secPerModule = Math.floor((nrOfWords % 1) * 60);
|
|
234
236
|
|
|
@@ -310,7 +312,7 @@ function updatePlaceholders(page, data, translationsData) {
|
|
|
310
312
|
page.title &&
|
|
311
313
|
generatePlaceholderString(page.title, translationsData, {
|
|
312
314
|
siteName: data.site_name,
|
|
313
|
-
pageTitle: page.title
|
|
315
|
+
pageTitle: page.title,
|
|
314
316
|
});
|
|
315
317
|
|
|
316
318
|
page.meta_title =
|
|
@@ -421,7 +423,9 @@ export default {
|
|
|
421
423
|
}
|
|
422
424
|
|
|
423
425
|
// map countries with the author
|
|
424
|
-
data.authors = data.relations.countries
|
|
426
|
+
data.authors = data.relations.countries
|
|
427
|
+
? mapAuthorsWithCountries(data.authors, data.relations.countries)
|
|
428
|
+
: data.authors;
|
|
425
429
|
|
|
426
430
|
// Add multiple Page authors
|
|
427
431
|
transformedPages[market][pageType][index].allAuthors =
|
|
@@ -489,17 +493,34 @@ export default {
|
|
|
489
493
|
|
|
490
494
|
pagesMappedById[page.id] = page;
|
|
491
495
|
|
|
492
|
-
|
|
493
496
|
// add search data
|
|
494
497
|
if (searchTemplatesAcitve.includes(page.template) && searchEnabled) {
|
|
495
|
-
const {
|
|
498
|
+
const {
|
|
499
|
+
title,
|
|
500
|
+
path,
|
|
501
|
+
status,
|
|
502
|
+
banner,
|
|
503
|
+
type,
|
|
504
|
+
relation,
|
|
505
|
+
author,
|
|
506
|
+
extra_fields,
|
|
507
|
+
} = transformedPages[market][pageType][index];
|
|
496
508
|
|
|
497
|
-
const filteredRelation = filterRelation(
|
|
509
|
+
const filteredRelation = filterRelation(
|
|
510
|
+
relation,
|
|
511
|
+
searchReleationPickKeys[type]
|
|
512
|
+
);
|
|
498
513
|
|
|
499
|
-
const allowedAuthorRelationKeys = [
|
|
500
|
-
const filteredAuthorRelation =
|
|
514
|
+
const allowedAuthorRelationKeys = ["image", "name"];
|
|
515
|
+
const filteredAuthorRelation =
|
|
516
|
+
author && filterRelation(author, allowedAuthorRelationKeys);
|
|
501
517
|
|
|
502
|
-
const operatorExtraFileds =
|
|
518
|
+
const operatorExtraFileds =
|
|
519
|
+
extra_fields?.operator &&
|
|
520
|
+
filterRelation(
|
|
521
|
+
extra_fields?.operator,
|
|
522
|
+
searchReleationPickKeys.operator
|
|
523
|
+
);
|
|
503
524
|
|
|
504
525
|
const minimalPage = {
|
|
505
526
|
title,
|
|
@@ -513,10 +534,8 @@ export default {
|
|
|
513
534
|
...(relation?.game_id && { game_id: relation.game_id }),
|
|
514
535
|
};
|
|
515
536
|
|
|
516
|
-
if (status ===
|
|
517
|
-
searchSimpleData[page.market].push(
|
|
518
|
-
cloneDeep(minimalPage)
|
|
519
|
-
);
|
|
537
|
+
if (status === "active") {
|
|
538
|
+
searchSimpleData[page.market].push(cloneDeep(minimalPage));
|
|
520
539
|
searchData[page.market].push(
|
|
521
540
|
cloneDeep({
|
|
522
541
|
...minimalPage,
|
|
@@ -530,12 +549,12 @@ export default {
|
|
|
530
549
|
})
|
|
531
550
|
);
|
|
532
551
|
}
|
|
533
|
-
|
|
534
552
|
}
|
|
535
553
|
|
|
536
554
|
const sectionList = postSectionsMap[page.relation_type];
|
|
537
555
|
|
|
538
|
-
page.sections &&
|
|
556
|
+
page.sections &&
|
|
557
|
+
sectionList &&
|
|
539
558
|
sectionList.forEach((res) => {
|
|
540
559
|
if (data.market_sections[market][res]) {
|
|
541
560
|
if (page.sections.main) {
|
|
@@ -547,6 +566,7 @@ export default {
|
|
|
547
566
|
const postSectionModules =
|
|
548
567
|
data.market_sections[market][res].modules || [];
|
|
549
568
|
postSectionModules.forEach((item) => {
|
|
569
|
+
|
|
550
570
|
if (!page.sections.main) {
|
|
551
571
|
return;
|
|
552
572
|
}
|
|
@@ -561,6 +581,7 @@ export default {
|
|
|
561
581
|
ModuleValue.VALUE_TYPE_PREFILLED_MODULE_MARKET,
|
|
562
582
|
});
|
|
563
583
|
} else {
|
|
584
|
+
|
|
564
585
|
if (
|
|
565
586
|
transformedPages[market][pageType][index].relation &&
|
|
566
587
|
checkForInactiveOperatorToplist(
|
|
@@ -581,7 +602,6 @@ export default {
|
|
|
581
602
|
});
|
|
582
603
|
});
|
|
583
604
|
|
|
584
|
-
pagesCloned = cloneDeep(transformedPages[market]);
|
|
585
605
|
|
|
586
606
|
// fill market sections
|
|
587
607
|
if (data.market_sections[market]) {
|
|
@@ -608,6 +628,16 @@ export default {
|
|
|
608
628
|
(page.sections && !previewPageID) ||
|
|
609
629
|
(previewPageID && page.id === previewPageID)
|
|
610
630
|
) {
|
|
631
|
+
|
|
632
|
+
if (
|
|
633
|
+
mainSettings[page.relation_type] && mainSettings[page.relation_type].reading_time &&
|
|
634
|
+
mainSettings[page.relation_type].reading_time[
|
|
635
|
+
process.env.GATSBY_SITE_NAME
|
|
636
|
+
]
|
|
637
|
+
) {
|
|
638
|
+
page.reading_time = getReadingTime(page.sections, data.content);
|
|
639
|
+
}
|
|
640
|
+
|
|
611
641
|
transformedPages[market][pageType][index] = Object.assign(page, {
|
|
612
642
|
sections: processSections(
|
|
613
643
|
page.sections,
|
|
@@ -636,12 +666,12 @@ export default {
|
|
|
636
666
|
const end = new Date() - start;
|
|
637
667
|
console.log(
|
|
638
668
|
chalk.green("success") +
|
|
639
|
-
|
|
669
|
+
chalk.whiteBright(` processed module values - %ds`),
|
|
640
670
|
end / 1000
|
|
641
671
|
);
|
|
642
672
|
return data;
|
|
643
673
|
},
|
|
644
674
|
clonePage(item, extraFields) {
|
|
645
|
-
return clonePageForCards(item,
|
|
675
|
+
return clonePageForCards(item, "", null, extraFields);
|
|
646
676
|
},
|
|
647
677
|
};
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
getModuleTitle,
|
|
19
19
|
trailingSlash,
|
|
20
20
|
} from "../getters.mjs";
|
|
21
|
+
import { stripDomainAndLeadingSlash } from "../path.mjs";
|
|
21
22
|
|
|
22
23
|
const pagesGroupedByTemplateId = [];
|
|
23
24
|
const cardItems = {};
|
|
@@ -305,8 +306,7 @@ export function processCardsV2(
|
|
|
305
306
|
}
|
|
306
307
|
|
|
307
308
|
// modify page so it doesn't have too much data
|
|
308
|
-
module.items = module.items.map((item) =>
|
|
309
|
-
clonePageForCards(cloneDeep(item), module.style, content)
|
|
309
|
+
module.items = module.items.map((item) => clonePageForCards(cloneDeep(item), module.style, content)
|
|
310
310
|
);
|
|
311
311
|
}
|
|
312
312
|
|
|
@@ -388,9 +388,13 @@ export function processTopListModule(
|
|
|
388
388
|
)
|
|
389
389
|
: [];
|
|
390
390
|
|
|
391
|
-
const reviewLink =
|
|
391
|
+
const reviewLink =
|
|
392
|
+
process.env.DMS_REVIEW_LINKS_ENABLED === 'true'
|
|
393
|
+
? stripDomainAndLeadingSlash(operatorRelation?.review_link) || operatorPage[0]?.path
|
|
394
|
+
: operatorPage[0]?.path;
|
|
395
|
+
|
|
392
396
|
const authorTitle = operatorPage[0] && operatorPage[0]?.author?.author_title;
|
|
393
|
-
const authorSameAs = operatorPage[0] && operatorPage[0]?.author?.knows_abouts && operatorPage[0].author.knows_abouts.map(knowsAboutItem =>
|
|
397
|
+
const authorSameAs = operatorPage[0] && operatorPage[0]?.author?.knows_abouts && operatorPage[0].author.knows_abouts.map(knowsAboutItem =>
|
|
394
398
|
knowsAboutItem.links.map((link) => link.link)[0]
|
|
395
399
|
)
|
|
396
400
|
|
|
@@ -401,7 +405,7 @@ export function processTopListModule(
|
|
|
401
405
|
toplists && toplists[listItem.id].label
|
|
402
406
|
);
|
|
403
407
|
|
|
404
|
-
return Object.assign(clone, {
|
|
408
|
+
return Object.assign(clone, {
|
|
405
409
|
review_link: reviewLink,
|
|
406
410
|
author_title: authorTitle,
|
|
407
411
|
author_same_as: authorSameAs
|
|
@@ -545,7 +549,6 @@ export function processAnchor(module = {}, relationData, translations) {
|
|
|
545
549
|
export function processModule(
|
|
546
550
|
module,
|
|
547
551
|
pages,
|
|
548
|
-
pagesCloned,
|
|
549
552
|
relations,
|
|
550
553
|
pagesMappedById,
|
|
551
554
|
menus,
|
|
@@ -576,7 +579,7 @@ export function processModule(
|
|
|
576
579
|
}
|
|
577
580
|
|
|
578
581
|
if (module.name === "cards_v2") {
|
|
579
|
-
processCardsV2(module,
|
|
582
|
+
processCardsV2(module, pages, pagesMappedById, pageId, content);
|
|
580
583
|
} else if (module.name === "content") {
|
|
581
584
|
processContentModule(module, translations, relationData, content);
|
|
582
585
|
} else if (module.name === "bonus") {
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
/* eslint-disable no-useless-return */
|
|
2
2
|
// eslint-disable-next-line import/prefer-default-export
|
|
3
|
-
|
|
3
|
+
import { excludeStatusInactiveToplist } from '../constants/excluded.mjs';
|
|
4
|
+
|
|
5
|
+
export default function checkForInactiveOperatorToplist(item, status) {
|
|
4
6
|
const shortCode = item && item.items && item.items.length && item.items[0].value;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
)
|
|
10
|
-
|
|
7
|
+
const siteName = process.env.GATSBY_SITE_NAME;
|
|
8
|
+
const excludeStatus = excludeStatusInactiveToplist[siteName] || excludeStatusInactiveToplist.default;
|
|
9
|
+
if (
|
|
10
|
+
((item.name === "top_list" && shortCode === "inactive_operator_toplist" && excludeStatus.includes(status)) ||
|
|
11
|
+
(item.name === "cards_v2" && status === "active"))
|
|
12
|
+
) {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
11
15
|
|
|
12
16
|
return false;
|
|
13
|
-
}
|
|
17
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import checkForInactiveOperatorToplist from './validateData';
|
|
2
2
|
|
|
3
3
|
describe('checkForInactiveOperatorToplist', () => {
|
|
4
4
|
it('should not return anything if the item is an active toplist with short code inactive_operator_toplist', () => {
|