gatsby-core-theme 6.1.7 → 7.0.0
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 +50 -0
- package/package.json +1 -1
- package/src/components/atoms/spotlights/index.js +1 -1
- package/src/components/atoms/spotlights/spotlights.module.scss +5 -1
- package/src/components/molecules/header/header.test.js +1 -1
- package/src/components/molecules/header/index.js +8 -0
- package/src/components/molecules/module/index.js +11 -5
- package/src/constants/pick-keys.js +1 -0
- package/src/helpers/getters.js +35 -5
- package/src/helpers/getters.test.js +32 -0
- package/src/helpers/processor/index.js +15 -2
- package/src/helpers/processor/modules.js +12 -3
- package/src/helpers/schema.js +3 -43
- package/src/helpers/schema.test.js +18 -21
- package/tests/factories/pagesMappedById/index.js +117 -0
- package/tests/factories/sections/header.factory.js +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,53 @@
|
|
|
1
|
+
# [7.0.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.9...v7.0.0) (2022-05-03)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Code Refactoring
|
|
5
|
+
|
|
6
|
+
* add factor checker ([cdc5192](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cdc519230240daf883b1de48ccd7297a88cb81eb))
|
|
7
|
+
* add reviewer object to page and change test script to reflect ([ac16823](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ac16823efc52a33fa3a6e2c613929eb590c1a909))
|
|
8
|
+
* align spotlight links ([235cb3e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/235cb3e8dbdcea6459b23ddaa21ef29b6eaccaf6))
|
|
9
|
+
* remove matrix specific schema and update tests ([4401079](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4401079658c2cb922b0d7a909331c39039667f8e))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* Merge branch 'tm-2801-fact-checker' into 'master' ([03be105](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/03be105386f4462e6b367cb50a858831729f44ba))
|
|
13
|
+
* Merge branch 'tm-2880-spotlight-links' into 'master' ([4f89cfb](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4f89cfb955dc9e906f7285835776d8db185d93ec))
|
|
14
|
+
* Merge branch 'master' into tm-2801-fact-checker ([2b769fd](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2b769fd65099798d4edf621dc262db154707e698))
|
|
15
|
+
* Merge branch 'tm-2708-remove-matrix-specific-schema' into 'master' ([cb883ed](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cb883ed7504aaddc24bf25e33d7aef4698097818))
|
|
16
|
+
|
|
17
|
+
## [6.1.9](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.8...v6.1.9) (2022-04-28)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* add getRoundMinutes function in gatsby theme ([e74c629](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e74c62918852b7ee9fe304fc8c6b633e75e543a9))
|
|
23
|
+
* add getRoundMinutes function in getters and testes && updated the project with git pull ([5b61f4b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5b61f4b0b912b4be7eee3eb9dbb9b2ad42b66bd9))
|
|
24
|
+
* added new field in toplist keys ([fbe30a9](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/fbe30a9072c58022b914c1e0c21a4652dce6e557))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
* Merge branch 'tm-2814-launch-date' into 'master' ([0c48e60](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0c48e601a1364155b84727eab3c8781493528ae7))
|
|
28
|
+
* Merge branch 'tm-2832-fix-time-to-read-in-OG' into 'master' ([6792364](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/67923641c04f38e10a514e93b4db7bcd8140fac9))
|
|
29
|
+
|
|
30
|
+
## [6.1.8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.7...v6.1.8) (2022-04-26)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* add operator related to the page as the first item in the comparison table automatically ([1fed78a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1fed78afc28bb072420556896dd350bb7351b69d))
|
|
36
|
+
* add unit testing ([a0d4f03](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a0d4f0352553280e80ce08e3b8c533c78ffb6dfc))
|
|
37
|
+
* change map to find ([756e648](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/756e6481ef95b7b080c0e0c1fdbcc0c0caabd8fb))
|
|
38
|
+
* cleanup code ([c3f76aa](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c3f76aa2866fa0011e8323c2a61e5ec5d815006e))
|
|
39
|
+
* include module introduction on all modules ([d9e0d01](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d9e0d016503f0afee00cfe1724db48179b77020d))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Code Refactoring
|
|
43
|
+
|
|
44
|
+
* add condition for null module ([369fa6e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/369fa6ec03b789a08542092c1355ab835d07cd14))
|
|
45
|
+
* fix typo ([e3248a3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e3248a306a12f6a27112ab9515ffb2484590ffe5))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
* Merge branch 'tm-2823-removing-review' into 'master' ([5a1301c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5a1301c75bcad1b055918d024358f93295c3e1a6))
|
|
49
|
+
* Merge branch 'tm-2689-add-paragraph' into 'master' ([2cf135d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2cf135dd4619e1a1698aacdeb08a85c10ce70be2))
|
|
50
|
+
|
|
1
51
|
## [6.1.7](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.6...v6.1.7) (2022-04-19)
|
|
2
52
|
|
|
3
53
|
|
package/package.json
CHANGED
|
@@ -75,7 +75,7 @@ const Spotlights = ({ module, themeStyles = {} }) => {
|
|
|
75
75
|
|
|
76
76
|
{mode === 'image_text' &&
|
|
77
77
|
(item.link.value ? (
|
|
78
|
-
<div>
|
|
78
|
+
<div className={styles.spotlightsTextCTA}>
|
|
79
79
|
<div dangerouslySetInnerHTML={{ __html: item.text }} />
|
|
80
80
|
{item.link.type === 'external' ? (
|
|
81
81
|
<a
|
|
@@ -14,7 +14,7 @@ describe('header component', () => {
|
|
|
14
14
|
expect(container.querySelectorAll('.headerContent')).toHaveLength(1);
|
|
15
15
|
|
|
16
16
|
// Inner HTML
|
|
17
|
-
expect(container.querySelectorAll('p')).toHaveLength(
|
|
17
|
+
expect(container.querySelectorAll('p')).toHaveLength(3);
|
|
18
18
|
expect(container.querySelectorAll('i')).toHaveLength(1);
|
|
19
19
|
|
|
20
20
|
// Testing image
|
|
@@ -75,6 +75,12 @@ function Header({ section, content = null, backgroundImage = true }) {
|
|
|
75
75
|
<p className={styles.readingTime}>
|
|
76
76
|
Reading Time: <span>{section.page.reading_time}</span>
|
|
77
77
|
</p>
|
|
78
|
+
{section.page.reviewer && (
|
|
79
|
+
<p className={styles.readingTime}>
|
|
80
|
+
Fact checked by:{' '}
|
|
81
|
+
<a href={section.page.reviewer.profile_page_path}>{section.page.reviewer.name}</a>
|
|
82
|
+
</p>
|
|
83
|
+
)}
|
|
78
84
|
<div className={!content && styles.headerText}>{headerContent()}</div>
|
|
79
85
|
</div>
|
|
80
86
|
</header>
|
|
@@ -90,10 +96,12 @@ Header.propTypes = {
|
|
|
90
96
|
updated_at: PropTypes.string,
|
|
91
97
|
created_at: PropTypes.string,
|
|
92
98
|
reading_time: PropTypes.string,
|
|
99
|
+
reviewer: PropTypes.string,
|
|
93
100
|
author: PropTypes.shape({
|
|
94
101
|
name: PropTypes.string,
|
|
95
102
|
profile_page_path: PropTypes.string,
|
|
96
103
|
}),
|
|
104
|
+
authors: PropTypes.shape([PropTypes.shape({})]),
|
|
97
105
|
sections: PropTypes.shape({
|
|
98
106
|
header: PropTypes.shape({
|
|
99
107
|
extra_fields: PropTypes.shape({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react/no-danger */
|
|
1
2
|
/* eslint-disable react/prop-types */
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import PropTypes from 'prop-types';
|
|
@@ -10,13 +11,15 @@ import { prettyTracker } from '~helpers/getters';
|
|
|
10
11
|
|
|
11
12
|
const Modules = ({ module, page, pageContext }) => {
|
|
12
13
|
const GetModuleComponent = (moduleItem) => {
|
|
13
|
-
|
|
14
|
+
const { items, name } = moduleItem || {};
|
|
15
|
+
|
|
16
|
+
switch (name) {
|
|
14
17
|
case 'content':
|
|
15
18
|
return loadable(() => import('~molecules/content'));
|
|
16
19
|
case 'top_list':
|
|
17
20
|
return loadable(() => import('~organisms/toplist'));
|
|
18
21
|
case 'archive':
|
|
19
|
-
if (!
|
|
22
|
+
if (!items || items.length === 0) return null;
|
|
20
23
|
return loadable(() => import('~organisms/archive'));
|
|
21
24
|
case 'counter':
|
|
22
25
|
return loadable(() => import('~molecules/counter'));
|
|
@@ -28,14 +31,14 @@ const Modules = ({ module, page, pageContext }) => {
|
|
|
28
31
|
case 'accordion':
|
|
29
32
|
return loadable(() => import('~organisms/accordion'));
|
|
30
33
|
case 'anchor':
|
|
31
|
-
if (
|
|
34
|
+
if (items && items.length > 0) {
|
|
32
35
|
return loadable(() => import('~organisms/anchor'));
|
|
33
36
|
}
|
|
34
37
|
return null;
|
|
35
38
|
case 'carousel':
|
|
36
39
|
if (
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
items.length > 0 && // has items
|
|
41
|
+
items.filter((item) => item.image === null).length === 0 // not filled with null items
|
|
39
42
|
) {
|
|
40
43
|
return loadable(() => import('~organisms/carousel'));
|
|
41
44
|
}
|
|
@@ -79,6 +82,9 @@ const Modules = ({ module, page, pageContext }) => {
|
|
|
79
82
|
} ${styles.module} ${module?.style && styles[module.style]} module`}
|
|
80
83
|
>
|
|
81
84
|
<ModuleTitle module={module} />
|
|
85
|
+
{module.module_introduction && (
|
|
86
|
+
<div dangerouslySetInnerHTML={{ __html: module?.module_introduction }} />
|
|
87
|
+
)}
|
|
82
88
|
<ModuleComponent module={module} page={page} pageContext={pageContext} {...extraProps} />
|
|
83
89
|
</div>
|
|
84
90
|
)
|
package/src/helpers/getters.js
CHANGED
|
@@ -31,8 +31,8 @@ export function getExtraField(extraFields, key, defaultValue) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export function getSection(shortCode, pageContext) {
|
|
34
|
-
const page = pageContext
|
|
35
|
-
const marketSections = pageContext
|
|
34
|
+
const page = pageContext && pageContext.page;
|
|
35
|
+
const marketSections = pageContext && pageContext.marketSections;
|
|
36
36
|
// eslint-disable-next-line
|
|
37
37
|
if (!page || !page.hasOwnProperty('sections') || !page.sections.hasOwnProperty(shortCode)) {
|
|
38
38
|
return null;
|
|
@@ -91,7 +91,7 @@ export function image(filename, width, height, fit = 'cover') {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
export function getImageFilename(src) {
|
|
94
|
-
const srcArr = src
|
|
94
|
+
const srcArr = src && src.substring(src.lastIndexOf('/') + 1).split('.');
|
|
95
95
|
if (!srcArr.length) {
|
|
96
96
|
return '';
|
|
97
97
|
}
|
|
@@ -321,7 +321,7 @@ export function copyrightText() {
|
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
export function getFirstModuleByName(section, moduleName) {
|
|
324
|
-
if (section && section.modules && section.modules[0]
|
|
324
|
+
if (section && section.modules && section.modules[0].name === moduleName) {
|
|
325
325
|
return section.modules[0];
|
|
326
326
|
}
|
|
327
327
|
return null;
|
|
@@ -329,7 +329,7 @@ export function getFirstModuleByName(section, moduleName) {
|
|
|
329
329
|
|
|
330
330
|
export function translate(translations, key, defaultValue = '') {
|
|
331
331
|
// eslint-disable-next-line
|
|
332
|
-
if (translations
|
|
332
|
+
if (translations && translations.hasOwnProperty(key)) {
|
|
333
333
|
return translations[key];
|
|
334
334
|
}
|
|
335
335
|
return defaultValue;
|
|
@@ -338,3 +338,33 @@ export function translate(translations, key, defaultValue = '') {
|
|
|
338
338
|
export function getAws(imageName) {
|
|
339
339
|
return `https://assets-srv.s3.eu-west-1.amazonaws.com/${imageName}`;
|
|
340
340
|
}
|
|
341
|
+
|
|
342
|
+
// This part of the code, help us to add operator related to the page as the first item in the comparison table automatically
|
|
343
|
+
// example: if we are on the operator review page(Rizk) that should be first in the comparison table
|
|
344
|
+
// First, we check if we have that item in the array, if that item is in the array, we check its position
|
|
345
|
+
// If the item isn't in the array we will add it automatically
|
|
346
|
+
export function shiftFirstOperator(pageId, module, pagesMappedById) {
|
|
347
|
+
let index = null;
|
|
348
|
+
// check if exist that element in array
|
|
349
|
+
const checkIfExistElement = module.items.find((item, i) => {
|
|
350
|
+
if (item.id === pageId) {
|
|
351
|
+
index = i;
|
|
352
|
+
if (index > 0) {
|
|
353
|
+
// eslint-disable-next-line no-nested-ternary
|
|
354
|
+
module.items.sort((x, y) => (x.id === pageId ? -1 : y.id === pageId ? 1 : 0));
|
|
355
|
+
}
|
|
356
|
+
return true;
|
|
357
|
+
}
|
|
358
|
+
return false;
|
|
359
|
+
});
|
|
360
|
+
if (!checkIfExistElement) {
|
|
361
|
+
// eslint-disable-next-line no-unused-expressions
|
|
362
|
+
pagesMappedById[pageId] && module.items.unshift(pagesMappedById[pageId]);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export const getRoundMinutes = (time) => {
|
|
367
|
+
const [minutes, seconds] = time.split(':');
|
|
368
|
+
const value = seconds > 30 ? Number(minutes) + 1 : Number(minutes);
|
|
369
|
+
return value === 0 ? 1 : value;
|
|
370
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as Getters from './getters';
|
|
2
|
+
import pagesMappedById from '../../tests/factories/pagesMappedById';
|
|
2
3
|
|
|
3
4
|
describe('Getters Helper', () => {
|
|
4
5
|
const { location } = window;
|
|
@@ -228,4 +229,35 @@ describe('Getters Helper', () => {
|
|
|
228
229
|
expect(Getters.translate(object, 'hello')).toEqual('world');
|
|
229
230
|
expect(Getters.translate(object, 'foo', 'bar')).toEqual('bar');
|
|
230
231
|
});
|
|
232
|
+
|
|
233
|
+
const module = {
|
|
234
|
+
items: [
|
|
235
|
+
{
|
|
236
|
+
id: 12300,
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
id: 13212,
|
|
240
|
+
},
|
|
241
|
+
],
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
test('add the operator item', () => {
|
|
245
|
+
Getters.shiftFirstOperator(11607, module, pagesMappedById);
|
|
246
|
+
expect(module.items[0].id).toBe(11607);
|
|
247
|
+
});
|
|
248
|
+
test('move opeartor first postion', () => {
|
|
249
|
+
Getters.shiftFirstOperator(13212, module, pagesMappedById);
|
|
250
|
+
expect(module.items[0].id).toBe(13212);
|
|
251
|
+
});
|
|
252
|
+
test('check when we have the operator in first postion', () => {
|
|
253
|
+
Getters.shiftFirstOperator(13212, module, pagesMappedById);
|
|
254
|
+
expect(module.items[0].id).toBe(13212);
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
test('If the reading time is bigger than half, it should return the next number ', () => {
|
|
258
|
+
expect(Getters.getRoundMinutes('3:52')).toBe(4);
|
|
259
|
+
});
|
|
260
|
+
test('If reading time is less than half, it should return the last number ', () => {
|
|
261
|
+
expect(Getters.getRoundMinutes('3:29')).toBe(3);
|
|
262
|
+
});
|
|
231
263
|
});
|
|
@@ -15,6 +15,7 @@ import { shouldSavePrefilled, processModule } from './modules';
|
|
|
15
15
|
import { clonePageForCards, groupBy, removeTags } from './common';
|
|
16
16
|
import { prepareSportsData, addSportsDataToPage, addExtraFieldsToShowcaseEvents } from './sports';
|
|
17
17
|
import { zeroPadding } from '../schedule';
|
|
18
|
+
import { getRoundMinutes } from '../getters';
|
|
18
19
|
|
|
19
20
|
const previewMode = process.env.GATSBY_PREVIEW_MODE || false;
|
|
20
21
|
const postSectionsMap = {
|
|
@@ -78,6 +79,10 @@ export function transform(response) {
|
|
|
78
79
|
const savedModules = {};
|
|
79
80
|
export function processSections(sections, skipPost = false, page) {
|
|
80
81
|
const siteName = page && page.siteInfo && page.siteInfo.site_name;
|
|
82
|
+
|
|
83
|
+
// pagedId we will use it just on operator review pages
|
|
84
|
+
const pageId = page && page.type === 'operator' ? page.id : null;
|
|
85
|
+
|
|
81
86
|
let minutes = 0;
|
|
82
87
|
let seconds = 0;
|
|
83
88
|
|
|
@@ -100,7 +105,8 @@ export function processSections(sections, skipPost = false, page) {
|
|
|
100
105
|
relations,
|
|
101
106
|
pagesMappedById,
|
|
102
107
|
menus,
|
|
103
|
-
previewMode
|
|
108
|
+
previewMode,
|
|
109
|
+
pageId
|
|
104
110
|
);
|
|
105
111
|
|
|
106
112
|
if (shouldSavePrefilled(module, siteName)) {
|
|
@@ -130,7 +136,7 @@ export function processSections(sections, skipPost = false, page) {
|
|
|
130
136
|
}
|
|
131
137
|
|
|
132
138
|
if (page) {
|
|
133
|
-
page.reading_time = `${zeroPadding(minutes, 2)}:${zeroPadding(seconds, 2)}
|
|
139
|
+
page.reading_time = getRoundMinutes(`${zeroPadding(minutes, 2)}:${zeroPadding(seconds, 2)}`);
|
|
134
140
|
}
|
|
135
141
|
|
|
136
142
|
return sections;
|
|
@@ -242,6 +248,13 @@ export default {
|
|
|
242
248
|
transformedPages[market][pageType][index].author = data.authors[page.author_id];
|
|
243
249
|
}
|
|
244
250
|
|
|
251
|
+
// add reviewer object to page
|
|
252
|
+
if (page.reviewer !== null && Object.values(data.authors).length) {
|
|
253
|
+
transformedPages[market][pageType][index].reviewer = Object.values(data.authors).find(
|
|
254
|
+
(each) => each.name === page.reviewer
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
|
|
245
258
|
// add breadcrumbs array to page
|
|
246
259
|
const pageBreadcrumbIds = transformedPages[market][pageType][index].breadcrumb_ids;
|
|
247
260
|
if (pageBreadcrumbIds) {
|
|
@@ -5,6 +5,7 @@ import { clonePageForCards, groupBy, removeDuplicates } from './common';
|
|
|
5
5
|
import settings from '../../constants/settings';
|
|
6
6
|
import ModuleValue from '../../constants/module-value';
|
|
7
7
|
import { topListPickKeys } from '../../constants/pick-keys';
|
|
8
|
+
import { shiftFirstOperator } from '../getters';
|
|
8
9
|
|
|
9
10
|
const pagesGroupedByTemplateId = [];
|
|
10
11
|
|
|
@@ -105,16 +106,18 @@ export function filterOperators(pages, selectedProviders, selectedTypes) {
|
|
|
105
106
|
return pagesFiltered;
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
export function processCardsV2(module, pagesCloned, pagesMappedById) {
|
|
109
|
+
export function processCardsV2(module, pagesCloned, pagesMappedById, pageId) {
|
|
109
110
|
const pageType = module.cards_page_type;
|
|
110
111
|
const pageTemplateId = module.cards_page_type_id;
|
|
111
112
|
const sortType = module.cards_selector_filters_sort_by;
|
|
112
113
|
const cardSelector = module.cards_selector;
|
|
114
|
+
const styleName = module.style;
|
|
113
115
|
const moduleSelectedProviders =
|
|
114
116
|
module.cards_selector_filters && module.cards_selector_filters.providers;
|
|
115
117
|
const moduleSelectedCategories =
|
|
116
118
|
module.cards_selector_filters && module.cards_selector_filters.categories;
|
|
117
119
|
const moduleSelectedTypes = module.cards_selector_filters && module.cards_selector_filters.types;
|
|
120
|
+
|
|
118
121
|
module.items = [];
|
|
119
122
|
|
|
120
123
|
if (cardSelector === 'select_manually') {
|
|
@@ -204,6 +207,11 @@ export function processCardsV2(module, pagesCloned, pagesMappedById) {
|
|
|
204
207
|
}
|
|
205
208
|
}
|
|
206
209
|
}
|
|
210
|
+
|
|
211
|
+
if (styleName === 'comparison_table' && pageId !== null) {
|
|
212
|
+
shiftFirstOperator(pageId, module, pagesMappedById);
|
|
213
|
+
}
|
|
214
|
+
|
|
207
215
|
// modify page so it doesn't have too much data
|
|
208
216
|
module.items = module.items.map((item) => clonePageForCards(cloneDeep(item), module.style));
|
|
209
217
|
}
|
|
@@ -249,12 +257,13 @@ export function processModule(
|
|
|
249
257
|
relations,
|
|
250
258
|
pagesMappedById,
|
|
251
259
|
menus,
|
|
252
|
-
previewMode
|
|
260
|
+
previewMode,
|
|
261
|
+
pageId
|
|
253
262
|
) {
|
|
254
263
|
if (module.name === 'cards') {
|
|
255
264
|
processCardsModule(module, pages, pagesCloned, pagesMappedById);
|
|
256
265
|
} else if (module.name === 'cards_v2') {
|
|
257
|
-
processCardsV2(module, pagesCloned, pagesMappedById);
|
|
266
|
+
processCardsV2(module, pagesCloned, pagesMappedById, pageId);
|
|
258
267
|
} else if (module.name === 'bonus') {
|
|
259
268
|
processBonus(module, relations);
|
|
260
269
|
} else if (module.name === 'archive' && previewMode) {
|
package/src/helpers/schema.js
CHANGED
|
@@ -2,45 +2,6 @@ import { getGameRating, getUrl, getLanguage } from './getters';
|
|
|
2
2
|
import { cleanHTML } from './strings';
|
|
3
3
|
|
|
4
4
|
/* HardCoded Start */
|
|
5
|
-
const isIL = process.env.GATSBY_SITE_NAME === 'irishluck.ie';
|
|
6
|
-
const isNSA = process.env.GATSBY_SITE_NAME === 'norskespilleautomater.com';
|
|
7
|
-
const publishingPrinciples = isIL
|
|
8
|
-
? 'https://www.irishluck.ie/editorial-principles'
|
|
9
|
-
: 'https://www.norskespilleautomater.com/om-oss/prinsipper';
|
|
10
|
-
const knowsAbout = [
|
|
11
|
-
{
|
|
12
|
-
'@type': 'Thing',
|
|
13
|
-
name: 'Norway',
|
|
14
|
-
sameAs: [
|
|
15
|
-
'https://no.wikipedia.org/wiki/Norge',
|
|
16
|
-
'https://www.google.no/search?q=Norge&pws=0&nord=1&hl=no&gl=NO',
|
|
17
|
-
],
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
'@type': 'Thing',
|
|
21
|
-
name: 'LottStift',
|
|
22
|
-
sameAs: [
|
|
23
|
-
'https://no.wikipedia.org/wiki/Lotteri-_og_stiftelsestilsynet',
|
|
24
|
-
'https://www.google.no/search?q=lottstift&pws=0&nord=1&hl=no&gl=NO',
|
|
25
|
-
],
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
'@type': 'Thing',
|
|
29
|
-
name: 'Kasino',
|
|
30
|
-
sameAs: [
|
|
31
|
-
'https://no.wikipedia.org/wiki/Kasino',
|
|
32
|
-
'https://www.google.no/search?q=Kasino&pws=0&nord=1&hl=no&gl=NO',
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
'@type': 'Thing',
|
|
37
|
-
name: 'Norsk Tipping Kommisjonær',
|
|
38
|
-
sameAs: [
|
|
39
|
-
'https://no.wikipedia.org/wiki/Norsk_Tipping',
|
|
40
|
-
'https://www.google.no/search?q=norsk+tipping&pws=0&nord=1&hl=no&gl=NO',
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
];
|
|
44
5
|
const customSchema = {
|
|
45
6
|
// Matrix
|
|
46
7
|
'playcasino.co.za': 'Playcasino',
|
|
@@ -60,7 +21,6 @@ const customSchema = {
|
|
|
60
21
|
'verfutbolonline.net': 'Ver Futbol Online',
|
|
61
22
|
'watchsport.gr': 'Watch Sport',
|
|
62
23
|
};
|
|
63
|
-
/* HardCoded End */
|
|
64
24
|
|
|
65
25
|
const socialLinks = [
|
|
66
26
|
'facebook',
|
|
@@ -71,6 +31,7 @@ const socialLinks = [
|
|
|
71
31
|
'wikipedia',
|
|
72
32
|
'youtube',
|
|
73
33
|
];
|
|
34
|
+
/* HardCoded End */
|
|
74
35
|
|
|
75
36
|
function checkSchemaProp(prop) {
|
|
76
37
|
return (
|
|
@@ -138,8 +99,7 @@ export function webPageSchema(page, pageImage) {
|
|
|
138
99
|
name: page.siteSchema?.site_name || '',
|
|
139
100
|
alternateName: page.siteSchema?.alias_site_name || '',
|
|
140
101
|
foundingDate: page.siteSchema?.organization_founding_date || '',
|
|
141
|
-
publishingPrinciples:
|
|
142
|
-
page.siteSchema?.publishing_principles || (isIL || isNSA ? publishingPrinciples : null),
|
|
102
|
+
publishingPrinciples: page.siteSchema?.publishing_principles,
|
|
143
103
|
logo: {
|
|
144
104
|
'@type': 'ImageObject',
|
|
145
105
|
url: pageImage,
|
|
@@ -154,7 +114,7 @@ export function webPageSchema(page, pageImage) {
|
|
|
154
114
|
sameAs: socialLinks
|
|
155
115
|
.map((socialLink) => page.siteSchema?.[socialLink])
|
|
156
116
|
.filter((socialLink) => socialLink),
|
|
157
|
-
...(
|
|
117
|
+
...(page.knowsAbout ? { knowsAbout: page.knowsAbout } : {}),
|
|
158
118
|
},
|
|
159
119
|
};
|
|
160
120
|
|
|
@@ -9,8 +9,6 @@ const parseCheckSchema = (schema) => {
|
|
|
9
9
|
return json;
|
|
10
10
|
};
|
|
11
11
|
const pageImage = 'pageImage/pageImage.jpg';
|
|
12
|
-
const isIL = process.env.GATSBY_SITE_NAME === 'irishluck.ie';
|
|
13
|
-
const isNSA = process.env.GATSBY_SITE_NAME === 'norskespilleautomater.com';
|
|
14
12
|
|
|
15
13
|
describe('Schema Helper', () => {
|
|
16
14
|
test('breadcrumbsSchema()', () => {
|
|
@@ -97,15 +95,7 @@ describe('Schema Helper', () => {
|
|
|
97
95
|
expect(json.author.name).toEqual('Site Name');
|
|
98
96
|
expect(json.author.alternateName).toEqual('Alias Site Name');
|
|
99
97
|
expect(json.author.foundingDate).toEqual('01/02/03');
|
|
100
|
-
|
|
101
|
-
expect(json.author.publishingPrinciples).toEqual(
|
|
102
|
-
isNSA
|
|
103
|
-
? 'https://www.norskespilleautomater.com/om-oss/prinsipper'
|
|
104
|
-
: 'https://www.irishluck.ie/editorial-principles'
|
|
105
|
-
);
|
|
106
|
-
} else {
|
|
107
|
-
expect(json.author.publishingPrinciples).toEqual(null);
|
|
108
|
-
}
|
|
98
|
+
expect(json.author.publishingPrinciples).toEqual(undefined);
|
|
109
99
|
|
|
110
100
|
expect(Object.prototype.toString.call(json.author.logo)).toEqual('[object Object]');
|
|
111
101
|
expect(json.author.logo['@type']).toEqual('ImageObject');
|
|
@@ -131,16 +121,7 @@ describe('Schema Helper', () => {
|
|
|
131
121
|
expect(json.author.sameAs[0]).toEqual('author_linkedin');
|
|
132
122
|
expect(json.author.sameAs[1]).toEqual('author_spotify');
|
|
133
123
|
expect(json.author.sameAs[2]).toEqual('author_wikipedia');
|
|
134
|
-
|
|
135
|
-
if (isNSA) {
|
|
136
|
-
expect(Object.prototype.toString.call(json.author.knowsAbout)).toEqual('[object Array]');
|
|
137
|
-
expect(json.author.knowsAbout).toHaveLength(4);
|
|
138
|
-
expect(Object.prototype.toString.call(json.author.knowsAbout[0])).toEqual('[object Object]');
|
|
139
|
-
expect(json.author.knowsAbout[0]['@type']).toEqual('Thing');
|
|
140
|
-
expect(json.author.knowsAbout[0].name).toEqual('Norway');
|
|
141
|
-
} else {
|
|
142
|
-
expect(json.author.knowsAbout).toEqual(undefined);
|
|
143
|
-
}
|
|
124
|
+
expect(json.author.knowsAbout).toEqual(undefined);
|
|
144
125
|
|
|
145
126
|
expect(Object.prototype.toString.call(json.keywords)).toEqual('[object Array]');
|
|
146
127
|
expect(json.keywords).toHaveLength(2);
|
|
@@ -174,6 +155,13 @@ describe('Schema Helper', () => {
|
|
|
174
155
|
expect(json.sameAs[2]).toEqual('organization_wikipedia');
|
|
175
156
|
});
|
|
176
157
|
|
|
158
|
+
test('moduleSchemas(null)', () => {
|
|
159
|
+
const output = Schema.moduleSchemas([{ name: 'other' }], '/');
|
|
160
|
+
|
|
161
|
+
expect(output).toHaveLength(0);
|
|
162
|
+
expect(output[0]).toEqual(undefined);
|
|
163
|
+
});
|
|
164
|
+
|
|
177
165
|
test('moduleSchemas(faq)', () => {
|
|
178
166
|
const output = Schema.moduleSchemas(
|
|
179
167
|
[
|
|
@@ -221,6 +209,15 @@ describe('Schema Helper', () => {
|
|
|
221
209
|
expect(json.mainEntity[2].acceptedAnswer.text).toEqual('Answer C');
|
|
222
210
|
});
|
|
223
211
|
|
|
212
|
+
test('templateSchemas(null)', () => {
|
|
213
|
+
const output = Schema.templateSchemas({
|
|
214
|
+
type: 'other',
|
|
215
|
+
path: 'other_page',
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
expect(output).toEqual(null);
|
|
219
|
+
});
|
|
220
|
+
|
|
224
221
|
test('templateSchemas(article)', () => {
|
|
225
222
|
const output = Schema.templateSchemas({
|
|
226
223
|
type: 'article',
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
11607: {
|
|
3
|
+
id: 11607,
|
|
4
|
+
market_id: 7,
|
|
5
|
+
updated_at: '2021-10-28',
|
|
6
|
+
created_at: '2020-02-14 14:12:45',
|
|
7
|
+
template_id: 11,
|
|
8
|
+
page_hreflang_group_id: null,
|
|
9
|
+
page_hreflang_combined: 0,
|
|
10
|
+
relation_id: 3148,
|
|
11
|
+
relation_type: 'game',
|
|
12
|
+
market: 'no_no',
|
|
13
|
+
region_code: null,
|
|
14
|
+
crawler_location_market: null,
|
|
15
|
+
author: {
|
|
16
|
+
name: 'Ida Moen Olsen',
|
|
17
|
+
profile_page_path: 'om-oss/ida-moen-olsen',
|
|
18
|
+
image_asset_id: 64615,
|
|
19
|
+
image_alt: null,
|
|
20
|
+
site_id: 2,
|
|
21
|
+
country_id: null,
|
|
22
|
+
language_id: null,
|
|
23
|
+
twitter_profile: null,
|
|
24
|
+
facebook_profile: null,
|
|
25
|
+
linkedin_profile: null,
|
|
26
|
+
instagram_profile: null,
|
|
27
|
+
personal_website: null,
|
|
28
|
+
email_address: null,
|
|
29
|
+
author_title: null,
|
|
30
|
+
additional_url: null,
|
|
31
|
+
image: 'ida-moen-olsen.webp',
|
|
32
|
+
image_object: [],
|
|
33
|
+
country: null,
|
|
34
|
+
language: null,
|
|
35
|
+
},
|
|
36
|
+
reviewer: null,
|
|
37
|
+
hard_coded_breadcrumbs: 0,
|
|
38
|
+
breadcrumb_ids: [174],
|
|
39
|
+
categories: [],
|
|
40
|
+
author_id: 47,
|
|
41
|
+
reviewer_id: null,
|
|
42
|
+
style_id: null,
|
|
43
|
+
language: 'no',
|
|
44
|
+
description: null,
|
|
45
|
+
meta_title: "Caishen's Arrival - Norske Spilleautomater",
|
|
46
|
+
meta_robots: null,
|
|
47
|
+
robot_options: {
|
|
48
|
+
page_index: 1,
|
|
49
|
+
links_followed: 1,
|
|
50
|
+
images_index: 1,
|
|
51
|
+
show_snippet: 1,
|
|
52
|
+
},
|
|
53
|
+
meta_description:
|
|
54
|
+
'Caishens Arrival er en asiatisk inspirert automat med gratisspinn og en massiv multiplikator på x 35,000. Du kan spille automaten gratis her',
|
|
55
|
+
page_custom_hreflangs: null,
|
|
56
|
+
title: "Caishen's Arrival",
|
|
57
|
+
vanity_label: null,
|
|
58
|
+
path: 'caishens-arrival-spilleautomater',
|
|
59
|
+
type: 'game',
|
|
60
|
+
template: 'game_review',
|
|
61
|
+
banner: '5af66017a898b7a5d6349b9396c1c680.jpeg',
|
|
62
|
+
featured_image: '5af66017a898b7a5d6349b9396c1c680.jpeg',
|
|
63
|
+
canonical_url: null,
|
|
64
|
+
canonical_url_page_id: null,
|
|
65
|
+
status: 'active',
|
|
66
|
+
page_group_id: null,
|
|
67
|
+
page_group_combined: 0,
|
|
68
|
+
page_group_custom_items: null,
|
|
69
|
+
sections: {
|
|
70
|
+
main: [],
|
|
71
|
+
header: [],
|
|
72
|
+
navigation: null,
|
|
73
|
+
footer: null,
|
|
74
|
+
post_main_games: null,
|
|
75
|
+
},
|
|
76
|
+
featured_image_object: {
|
|
77
|
+
width: '400',
|
|
78
|
+
height: '250',
|
|
79
|
+
url: 'https://assets-srv.s3.eu-west-1.amazonaws.com/5af66017a898b7a5d6349b9396c1c680.jpeg',
|
|
80
|
+
filename: '5af66017a898b7a5d6349b9396c1c680.jpeg',
|
|
81
|
+
},
|
|
82
|
+
relation: {
|
|
83
|
+
id: 3148,
|
|
84
|
+
name: "Caishen's Arrival",
|
|
85
|
+
short_name: 'caishens_arrival',
|
|
86
|
+
first_rating: '2',
|
|
87
|
+
second_rating: '4',
|
|
88
|
+
third_rating: '4',
|
|
89
|
+
fourth_rating: '2',
|
|
90
|
+
average_rating: '',
|
|
91
|
+
volatility: 2,
|
|
92
|
+
iframe: '',
|
|
93
|
+
freespins: 1,
|
|
94
|
+
rtp: 95.74,
|
|
95
|
+
launch_date: '2019-10-16',
|
|
96
|
+
number_of_reels: 5,
|
|
97
|
+
winning_lines: 25,
|
|
98
|
+
jackpots: 0,
|
|
99
|
+
vegas: 0,
|
|
100
|
+
fruit: 0,
|
|
101
|
+
wilds: 0,
|
|
102
|
+
sticky_wilds: 0,
|
|
103
|
+
respins: 0,
|
|
104
|
+
mega_ways: 0,
|
|
105
|
+
bonus_rounds: 0,
|
|
106
|
+
recommended: 0,
|
|
107
|
+
exclusive: 0,
|
|
108
|
+
new: 0,
|
|
109
|
+
hot: 0,
|
|
110
|
+
game_provider: [],
|
|
111
|
+
markets: [],
|
|
112
|
+
enabled: true,
|
|
113
|
+
game_categories: [],
|
|
114
|
+
game_screenshots: [],
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
};
|
|
@@ -22,6 +22,13 @@ export default function getHeaderSection() {
|
|
|
22
22
|
image_alt: null,
|
|
23
23
|
image_asset_id: 37728,
|
|
24
24
|
},
|
|
25
|
+
reviewer: {
|
|
26
|
+
name: 'Cameron Murphy',
|
|
27
|
+
image: 'cameron-murphy.jpeg',
|
|
28
|
+
image_alt: null,
|
|
29
|
+
image_asset_id: 37728,
|
|
30
|
+
profile_page_path: 'about-us/cameron-murphy',
|
|
31
|
+
},
|
|
25
32
|
},
|
|
26
33
|
};
|
|
27
34
|
|