gatsby-core-theme 44.2.3 → 44.2.5

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 CHANGED
@@ -1,3 +1,40 @@
1
+ ## [44.2.5](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.2.4...v44.2.5) (2025-06-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add reading time during tranformin the pages ([f5f6bc6](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/f5f6bc62874412da28bf60a50dc41b58fa3baa70))
7
+ * add rel as a props for disclamer ([e3608d5](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/e3608d5c40c98c5a8181c5cfad94bc6b1202d04f))
8
+
9
+ ## [44.2.4](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.2.3...v44.2.4) (2025-06-11)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * add reading time for article for specific sites ([d5c1a3a](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/d5c1a3aa49cb950121d4ee822be76bd4ad25c965))
15
+ * better structure ([f29d9cc](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/f29d9cc1bc4aacf563c01b047fd1f51b1aa5bfcf))
16
+ * build issue ([669e6f4](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/669e6f4280aeea67affe1051d49a6ee1739a3d40))
17
+ * env ([581fcd2](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/581fcd24304f851ee913df5fdeaaa05d2ba3433c))
18
+ * fix test ([43eb3b4](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/43eb3b4966559cdbe72cf58dfe2990895f8a1ab6))
19
+ * fix test ([41290f2](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/41290f2f6e156873a55ca38eff0cbf3d2e288171))
20
+ * fix test ([951ea3d](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/951ea3dfb53fcc7d241ca2044a4019583882b26f))
21
+ * fix tests ([f41c118](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/f41c11889ae6a2f1a7a7039cf12473c0fb5d1ec9))
22
+ * issue ([4621b2a](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/4621b2a2240a2671fd631a8f606c12b74eb674ed))
23
+ * make a fix ([bd46cb1](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/bd46cb11901d8d27d2034cb4c39851cbf70d810d))
24
+ * path js to mjs ([7392666](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/739266641290e2c9d7eaaec80a386defd227732f))
25
+ * remove the inactive toplist for comming soon at pcsa ([d48eda7](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/d48eda74d84d715813baf0d4319acfb97f035090))
26
+ * review link ([3de1d41](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/3de1d414cc78ec36a635c400f7487e3b4989848b))
27
+ * review link ([83d9a24](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/83d9a24d8b9b3dc58b39dd55eda0f3478f83a817))
28
+ * reviewLink ([b23dd60](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/b23dd604857faabeb62a4b5f871e607a576dc25f))
29
+ * test this way ([2267bb2](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/2267bb2cf3ad0c5335fd39516552fe3f04832333))
30
+
31
+
32
+ * Merge branch 'tm-5486-disable-premain-toplist-coming-soon' into 'master' ([9662ce8](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/9662ce8e50b4d56a8f1d9111618ba63b990075c8))
33
+ * Merge branch 'reviewlink-issue' into 'master' ([1893749](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/1893749134fb1f8c33668a589e76c9d411e6eff5))
34
+ * Merge branch 'tm-5491-reading-time' into 'master' ([96c45e1](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/96c45e1aafb6be54fb99b57909e018f60d5ebf15))
35
+ * Merge branch 'master' into tm-5491-reading-time ([997ae4d](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/997ae4df78abcfa773cfe405a92a9737b8b51850))
36
+ * Merge branch 'master' into tm-5486-disable-premain-toplist-coming-soon ([9e045bf](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/9e045bf5f916d916f671500efca0b3089a2ed819))
37
+
1
38
  ## [44.2.3](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.2.2...v44.2.3) (2025-06-10)
2
39
 
3
40
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "44.2.3",
3
+ "version": "44.2.5",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -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/excludedTemplates";
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
- if (page.categories?.length > 0) {
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,3 +1,4 @@
1
+ /* eslint-disable react/jsx-no-target-blank */
1
2
  /* eslint-disable no-return-assign */
2
3
  /* eslint-disable no-plusplus */
3
4
  /* eslint-disable no-var */
@@ -5,7 +6,7 @@ import React, { useRef } from 'react';
5
6
  import PropTypes from 'prop-types';
6
7
  import LazyImage from '~hooks/lazy-image';
7
8
 
8
- const Disclaimer = ({ dmcaImage, imgWidth = 100, imgHeight = 33, loading = 'eager' }) => {
9
+ const Disclaimer = ({ dmcaImage, imgWidth = 100, imgHeight = 33, loading = 'eager', rel = 'noreferrer' }) => {
9
10
  const anchorElement = useRef(null);
10
11
 
11
12
  function dmca() {
@@ -30,7 +31,7 @@ const Disclaimer = ({ dmcaImage, imgWidth = 100, imgHeight = 33, loading = 'eage
30
31
  href={`//www.dmca.com/Protection/Status.aspx?ID=${process.env.DMCA_PROTECTION_ID}`}
31
32
  title="DMCA.com Protection Status"
32
33
  target="_blank"
33
- rel="noreferrer"
34
+ rel={rel}
34
35
  >
35
36
  <LazyImage
36
37
  alt="DMCA.com Protection Status"
@@ -50,4 +51,5 @@ Disclaimer.propTypes = {
50
51
  imgWidth: PropTypes.number,
51
52
  imgHeight: PropTypes.number,
52
53
  loading: PropTypes.string,
54
+ rel: PropTypes.string,
53
55
  };
@@ -0,0 +1,7 @@
1
+ // eslint-disable-next-line import/prefer-default-export
2
+ export const excludeTemplates = ["ppc", "responsible_gambling_guide"];
3
+
4
+ export const excludeStatusInactiveToplist = {
5
+ "playcasino.co.za": ["active", "coming_soon"],
6
+ default: ["active"],
7
+ };
@@ -12,4 +12,11 @@ export const mainSettings = {
12
12
  recommendedCasinos: true,
13
13
  topSearches: true,
14
14
  },
15
+ article: {
16
+ reading_time: {
17
+ "spielhallen.com": true,
18
+ "demo-matrix-theme.gigmedia.com": true,
19
+ default: false,
20
+ },
21
+ },
15
22
  };
@@ -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
+ }
@@ -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 { checkForInactiveOperatorToplist } from "../validateData.mjs";
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;
@@ -111,11 +112,22 @@ export function transform(response) {
111
112
  transformed[siteMarket][pageType] = [];
112
113
  Object.keys(pages[market][pageType]).forEach((pageId) => {
113
114
  const page = pages[market][pageType][pageId];
115
+ if (
116
+ mainSettings[page.relation_type] && mainSettings[page.relation_type].reading_time &&
117
+ mainSettings[page.relation_type].reading_time[
118
+ process.env.GATSBY_SITE_NAME
119
+ ]
120
+ ) {
121
+ page.reading_time = getReadingTime(page.sections, response.content);
122
+ }
123
+
114
124
 
115
125
  if (response.site_markets[siteMarket].path_prefix && page) {
116
126
  // set page prefix for multiple markets
117
- page.path = `${response.site_markets[siteMarket].path_prefix}${page.path !== "/" ? `/${page.path}` : ""
118
- }`;
127
+ page.path = `${response.site_markets[siteMarket].path_prefix}${
128
+ page.path !== "/" ? `/${page.path}` : ""
129
+ }`;
130
+
119
131
  transformed[siteMarket][pageType].push(page);
120
132
  } else if (page) {
121
133
  transformed[siteMarket][pageType].push(page);
@@ -159,6 +171,7 @@ export function processSections(
159
171
  content
160
172
  );
161
173
  }
174
+
162
175
  if (sections[sectionKey] && sections[sectionKey].modules) {
163
176
  sections[sectionKey].modules.forEach((module, key) => {
164
177
  if (
@@ -190,10 +203,10 @@ export function processSections(
190
203
  };
191
204
  }
192
205
 
206
+
193
207
  processModule(
194
208
  module,
195
209
  pages,
196
- pagesCloned,
197
210
  relations,
198
211
  pagesMappedById,
199
212
  menus,
@@ -219,7 +232,7 @@ export function processSections(
219
232
  return sections;
220
233
  }
221
234
 
222
- export function getReadingTime(sections) {
235
+ export function getReadingTime(sections, content) {
223
236
  let minutes = 0;
224
237
  let seconds = 0;
225
238
 
@@ -228,7 +241,7 @@ export function getReadingTime(sections) {
228
241
  sections[sectionKey].modules.forEach((module) => {
229
242
  // calculate reading time
230
243
  if (module.name === "content") {
231
- const nrOfWords = removeTags(module.value).split(" ").length / 250;
244
+ const nrOfWords = removeTags(content ? content[module.value] : module.value).split(" ").length / 250;
232
245
  const minPerModule = Math.floor(nrOfWords);
233
246
  const secPerModule = Math.floor((nrOfWords % 1) * 60);
234
247
 
@@ -310,7 +323,7 @@ function updatePlaceholders(page, data, translationsData) {
310
323
  page.title &&
311
324
  generatePlaceholderString(page.title, translationsData, {
312
325
  siteName: data.site_name,
313
- pageTitle: page.title
326
+ pageTitle: page.title,
314
327
  });
315
328
 
316
329
  page.meta_title =
@@ -331,7 +344,7 @@ function updatePlaceholders(page, data, translationsData) {
331
344
  export default {
332
345
  run(data, themeOptions, fs, translationsData, previewPageID = null) {
333
346
  const start = new Date();
334
- const transformedPages = transform(data);
347
+ const transformedPages = transform(data);
335
348
 
336
349
  const allResponsibleGaming = data.responsible_gamings || null;
337
350
  const generalData = data.general;
@@ -421,7 +434,9 @@ export default {
421
434
  }
422
435
 
423
436
  // map countries with the author
424
- data.authors = data.relations.countries ? mapAuthorsWithCountries(data.authors, data.relations.countries) : data.authors;
437
+ data.authors = data.relations.countries
438
+ ? mapAuthorsWithCountries(data.authors, data.relations.countries)
439
+ : data.authors;
425
440
 
426
441
  // Add multiple Page authors
427
442
  transformedPages[market][pageType][index].allAuthors =
@@ -489,17 +504,34 @@ export default {
489
504
 
490
505
  pagesMappedById[page.id] = page;
491
506
 
492
-
493
507
  // add search data
494
508
  if (searchTemplatesAcitve.includes(page.template) && searchEnabled) {
495
- const { title, path, status, banner, type, relation, author, extra_fields } = transformedPages[market][pageType][index];
509
+ const {
510
+ title,
511
+ path,
512
+ status,
513
+ banner,
514
+ type,
515
+ relation,
516
+ author,
517
+ extra_fields,
518
+ } = transformedPages[market][pageType][index];
496
519
 
497
- const filteredRelation = filterRelation(relation, searchReleationPickKeys[type]);
520
+ const filteredRelation = filterRelation(
521
+ relation,
522
+ searchReleationPickKeys[type]
523
+ );
498
524
 
499
- const allowedAuthorRelationKeys = ['image', 'name'];
500
- const filteredAuthorRelation = author && filterRelation(author, allowedAuthorRelationKeys);
525
+ const allowedAuthorRelationKeys = ["image", "name"];
526
+ const filteredAuthorRelation =
527
+ author && filterRelation(author, allowedAuthorRelationKeys);
501
528
 
502
- const operatorExtraFileds = extra_fields?.operator && filterRelation(extra_fields?.operator, searchReleationPickKeys['operator']);
529
+ const operatorExtraFileds =
530
+ extra_fields?.operator &&
531
+ filterRelation(
532
+ extra_fields?.operator,
533
+ searchReleationPickKeys.operator
534
+ );
503
535
 
504
536
  const minimalPage = {
505
537
  title,
@@ -513,10 +545,8 @@ export default {
513
545
  ...(relation?.game_id && { game_id: relation.game_id }),
514
546
  };
515
547
 
516
- if (status === 'active') {
517
- searchSimpleData[page.market].push(
518
- cloneDeep(minimalPage)
519
- );
548
+ if (status === "active") {
549
+ searchSimpleData[page.market].push(cloneDeep(minimalPage));
520
550
  searchData[page.market].push(
521
551
  cloneDeep({
522
552
  ...minimalPage,
@@ -530,12 +560,12 @@ export default {
530
560
  })
531
561
  );
532
562
  }
533
-
534
563
  }
535
564
 
536
565
  const sectionList = postSectionsMap[page.relation_type];
537
566
 
538
- page.sections && sectionList &&
567
+ page.sections &&
568
+ sectionList &&
539
569
  sectionList.forEach((res) => {
540
570
  if (data.market_sections[market][res]) {
541
571
  if (page.sections.main) {
@@ -547,6 +577,7 @@ export default {
547
577
  const postSectionModules =
548
578
  data.market_sections[market][res].modules || [];
549
579
  postSectionModules.forEach((item) => {
580
+
550
581
  if (!page.sections.main) {
551
582
  return;
552
583
  }
@@ -561,6 +592,7 @@ export default {
561
592
  ModuleValue.VALUE_TYPE_PREFILLED_MODULE_MARKET,
562
593
  });
563
594
  } else {
595
+
564
596
  if (
565
597
  transformedPages[market][pageType][index].relation &&
566
598
  checkForInactiveOperatorToplist(
@@ -581,7 +613,6 @@ export default {
581
613
  });
582
614
  });
583
615
 
584
- pagesCloned = cloneDeep(transformedPages[market]);
585
616
 
586
617
  // fill market sections
587
618
  if (data.market_sections[market]) {
@@ -597,7 +628,7 @@ export default {
597
628
  data.content
598
629
  );
599
630
  }
600
-
631
+
601
632
  // fill page sections
602
633
  if (transformedPages[market]) {
603
634
  Object.keys(transformedPages[market]).forEach((pageType) => {
@@ -608,6 +639,7 @@ export default {
608
639
  (page.sections && !previewPageID) ||
609
640
  (previewPageID && page.id === previewPageID)
610
641
  ) {
642
+
611
643
  transformedPages[market][pageType][index] = Object.assign(page, {
612
644
  sections: processSections(
613
645
  page.sections,
@@ -636,12 +668,12 @@ export default {
636
668
  const end = new Date() - start;
637
669
  console.log(
638
670
  chalk.green("success") +
639
- chalk.whiteBright(` processed module values - %ds`),
671
+ chalk.whiteBright(` processed module values - %ds`),
640
672
  end / 1000
641
673
  );
642
674
  return data;
643
675
  },
644
676
  clonePage(item, extraFields) {
645
- return clonePageForCards(item, '', null, extraFields);
677
+ return clonePageForCards(item, "", null, extraFields);
646
678
  },
647
679
  };
@@ -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 = operatorPage.length > 0 ? operatorPage[0].path : null;
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, pagesCloned, pagesMappedById, pageId, content);
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
- export const checkForInactiveOperatorToplist = (item, status, res) => {
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
- if (
6
- ((item.name === "top_list" && shortCode === "inactive_operator_toplist") ||
7
- (item.name === "cards_v2" && res === "pre_main_operators")) &&
8
- status === "active"
9
- )
10
- return true;
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 { checkForInactiveOperatorToplist } from './validateData';
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', () => {
@@ -1,2 +0,0 @@
1
- // eslint-disable-next-line import/prefer-default-export
2
- export const excludeTemplates = ['ppc', 'responsible_gambling_guide'];
@@ -1,9 +0,0 @@
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
- }