gatsby-core-theme 35.0.2 → 35.0.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## [35.0.3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v35.0.2...v35.0.3) (2024-07-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* added tests ([c9ae199](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c9ae1999426a2d70f82f688dcc000d5a715924ee))
|
|
7
|
+
* fix data for extra fields ([f05d381](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f05d38125e0d616ca6ab1cea6d2479b0d71d9e3a))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
* Merge branch 'tm-4583-operator-as-extrafields' into 'master' ([19633b1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/19633b1f230e7c9b95ae781367360f186aac3210))
|
|
11
|
+
|
|
1
12
|
## [35.0.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v35.0.1...v35.0.2) (2024-07-18)
|
|
2
13
|
|
|
3
14
|
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import loadash from 'lodash/index.js';
|
|
9
9
|
import chalk from 'chalk';
|
|
10
10
|
import ModuleValue from '../../constants/module-value.mjs';
|
|
11
|
-
import { pickHTMLSitemapPageKeys } from '../../constants/pick-keys.mjs';
|
|
11
|
+
import { pickHTMLSitemapPageKeys, pickRelationKeys } from '../../constants/pick-keys.mjs';
|
|
12
12
|
import { generatePlaceholderString } from '../generators.mjs';
|
|
13
13
|
// eslint-disable-next-line import/no-cycle
|
|
14
14
|
import { shouldSavePrefilled, processModule } from './modules.mjs';
|
|
@@ -22,6 +22,7 @@ import { processRelations } from './relations.mjs';
|
|
|
22
22
|
import { zeroPadding } from '../schedule.mjs';
|
|
23
23
|
import { getRoundMinutes } from '../getters.mjs';
|
|
24
24
|
import { checkForInactiveOperatorToplist } from '../validateData.mjs';
|
|
25
|
+
import { sanitizeOperatorData } from './operators.mjs';
|
|
25
26
|
|
|
26
27
|
const { cloneDeep, pick } = loadash;
|
|
27
28
|
const previewMode = process.env.GATSBY_PREVIEW_MODE || false;
|
|
@@ -110,7 +111,7 @@ export function processSections(sections, skipPost = false, page, translations,
|
|
|
110
111
|
return;
|
|
111
112
|
}
|
|
112
113
|
if (sections[sectionKey] && sections[sectionKey].hasOwnProperty('extra_fields')) {
|
|
113
|
-
processExtraFields(sections[sectionKey].extra_fields);
|
|
114
|
+
processExtraFields(sections[sectionKey].extra_fields, translations, relations);
|
|
114
115
|
}
|
|
115
116
|
if (sections[sectionKey] && sections[sectionKey].modules) {
|
|
116
117
|
sections[sectionKey].modules.forEach((module, key) => {
|
|
@@ -199,14 +200,14 @@ function processSearchData(data, fs) {
|
|
|
199
200
|
});
|
|
200
201
|
}
|
|
201
202
|
|
|
202
|
-
export function processExtraFields(extraFields, translations) {
|
|
203
|
+
export function processExtraFields(extraFields, translations, relations) {
|
|
203
204
|
if (!extraFields) {
|
|
204
205
|
return;
|
|
205
206
|
}
|
|
206
207
|
Object.keys(extraFields).forEach((key) => {
|
|
207
208
|
const { type, value } = extraFields[key];
|
|
208
209
|
if (type === 'operator') {
|
|
209
|
-
extraFields[key] = relations[type][value];
|
|
210
|
+
extraFields[key] = relations && relations[type][value] && pick(sanitizeOperatorData(relations[type][value]), pickRelationKeys.operator);
|
|
210
211
|
} else if (type === 'menu') {
|
|
211
212
|
extraFields[key] = menus[value];
|
|
212
213
|
} else if (type === 'text') {
|
|
@@ -302,7 +303,7 @@ export default {
|
|
|
302
303
|
Object.keys(transformedPages[market]).forEach((pageType) => {
|
|
303
304
|
transformedPages[market][pageType].forEach((page, index) => {
|
|
304
305
|
// process page extra fields
|
|
305
|
-
page.extra_fields && processExtraFields(page.extra_fields, translations);
|
|
306
|
+
page.extra_fields && processExtraFields(page.extra_fields, translations, relations);
|
|
306
307
|
updatePlaceholders(page, data);
|
|
307
308
|
// set page relation
|
|
308
309
|
processRelations(
|
|
@@ -2,6 +2,7 @@ import { transform, processExtraFields, processSections, getReadingTime } from '
|
|
|
2
2
|
import pages from '~tests/factories/pages/pages.factory.js';
|
|
3
3
|
import getPageList from '~tests/factories/pages/page.factory';
|
|
4
4
|
import multipleMarketsPages from '~tests/factories/pages/multiple-markets-pages.factory.js';
|
|
5
|
+
import getOperatorData from '../../../tests/factories/relations/operator.factory';
|
|
5
6
|
|
|
6
7
|
const tempContent = {
|
|
7
8
|
value: `What is Lorem Ipsum?
|
|
@@ -16,6 +17,19 @@ const tempContent = {
|
|
|
16
17
|
name: 'content',
|
|
17
18
|
};
|
|
18
19
|
|
|
20
|
+
const translations = {
|
|
21
|
+
placeholder1: 'Translated Placeholder 1',
|
|
22
|
+
placeholder2: 'Translated Placeholder 2',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const relations = {
|
|
26
|
+
operator: {
|
|
27
|
+
123: {
|
|
28
|
+
...getOperatorData(),
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
19
33
|
describe('Index Processor', () => {
|
|
20
34
|
test('Transform', () => {
|
|
21
35
|
const results = transform(pages);
|
|
@@ -37,6 +51,7 @@ describe('Index Processor', () => {
|
|
|
37
51
|
processExtraFields(extraFields);
|
|
38
52
|
expect(extraFields?.logos).toBe(339);
|
|
39
53
|
});
|
|
54
|
+
|
|
40
55
|
test('processExtraFields null', () => {
|
|
41
56
|
const result = processExtraFields(false);
|
|
42
57
|
expect(result).toBeFalsy();
|
|
@@ -52,6 +67,40 @@ describe('Index Processor', () => {
|
|
|
52
67
|
expect(extraField.logos).toContain('2024');
|
|
53
68
|
});
|
|
54
69
|
|
|
70
|
+
test('processExtraFields text', () => {
|
|
71
|
+
const extraField = {
|
|
72
|
+
logos: { value: 'test ts [YEAR] asca', type: 'text' },
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
processExtraFields(extraField);
|
|
76
|
+
|
|
77
|
+
expect(extraField.logos).toContain('2024');
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test('processExtraFields operator', () => {
|
|
81
|
+
const extraFields = {
|
|
82
|
+
key1: {
|
|
83
|
+
type: 'operator',
|
|
84
|
+
value: '123',
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
delete relations.operator['123'].logo;
|
|
88
|
+
processExtraFields(extraFields, translations, relations);
|
|
89
|
+
expect(extraFields.key1.logo.filename).toEqual('norskelodd-logo.png');
|
|
90
|
+
expect(extraFields.key1.name).toEqual('Ice Casino');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('processExtraFields without operator data', () => {
|
|
94
|
+
const extraFields = {
|
|
95
|
+
key1: {
|
|
96
|
+
type: 'operator',
|
|
97
|
+
value: '123',
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
processExtraFields(extraFields);
|
|
101
|
+
expect(extraFields).toHaveProperty('key1');
|
|
102
|
+
});
|
|
103
|
+
|
|
55
104
|
test('processSections', () => {
|
|
56
105
|
const result = processSections(pages.prefilled_market_modules);
|
|
57
106
|
expect(result).toBeTruthy();
|
|
@@ -65,7 +65,7 @@ export function sanitizeOperatorData(
|
|
|
65
65
|
}))
|
|
66
66
|
: [];
|
|
67
67
|
|
|
68
|
-
if (operatorPage[0]?.extra_fields) {
|
|
68
|
+
if (operatorPage.length > 0 && operatorPage[0]?.extra_fields) {
|
|
69
69
|
clone.reviewSummery = getExtraField(
|
|
70
70
|
operatorPage[0]?.extra_fields,
|
|
71
71
|
'operator_review_summary',
|
|
@@ -198,6 +198,14 @@ export default function getOperatorData(
|
|
|
198
198
|
types: ['casino', 'livecasino', 'sportsbook', 'bonus'],
|
|
199
199
|
url: 'www.ice-casino.com',
|
|
200
200
|
},
|
|
201
|
+
standardised_logo_url_object: {
|
|
202
|
+
width: '412',
|
|
203
|
+
height: '412',
|
|
204
|
+
title: 'Norskelodd logo',
|
|
205
|
+
alt: 'Logo image for Norskelodd',
|
|
206
|
+
url: 'https://assets-srv.s3.eu-west-1.amazonaws.com/1651670827/norskelodd-logo.png',
|
|
207
|
+
filename: 'norskelodd-logo.png',
|
|
208
|
+
},
|
|
201
209
|
extra_fields: {
|
|
202
210
|
summary_background: 'fe63f69ca1618cf2e7ff810197001dec.png',
|
|
203
211
|
summary: 'Summary',
|