gatsby-core-theme 18.0.6 → 18.0.8
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 +43 -0
- package/gatsby-node.esm.js +1 -0
- package/package.json +1 -1
- package/src/constants/pick-keys.js +2 -0
- package/src/helpers/processor/common.js +1 -1
- package/src/helpers/processor/index.js +15 -65
- package/src/helpers/processor/index.test.js +10 -1
- package/src/helpers/processor/relations.js +63 -0
- package/src/helpers/processor/relations.test.js +92 -0
- package/src/hooks/lazy-image/index.js +1 -3
- package/tests/factories/authors/author.factory.js +54 -0
- package/tests/factories/data/data.factory.js +23 -0
- package/tests/factories/pages/multiple-markets-pages.factory.js +114 -0
- package/tests/factories/pages/page.factory.js +52 -0
- package/tests/factories/relations/relation.factory.js +50 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,46 @@
|
|
|
1
|
+
## [18.0.8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v18.0.7...v18.0.8) (2023-02-06)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add validation for bonus ([476287e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/476287eb552f51e3ce1aa6d433479017ad71e79e))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
* Merge branch 'validation-bonus' into 'master' ([cf8b25b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cf8b25b5efa4f5f81eb123543116f42b1ea7fe77))
|
|
10
|
+
|
|
11
|
+
## [18.0.7](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v18.0.6...v18.0.7) (2023-02-02)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* added path prefix ([2d88a75](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2d88a75e6d01c78afe4cc89a8c2a36c9842e72d2))
|
|
17
|
+
* change the site name ([037f0a5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/037f0a5a64e3264ded54ccdce2f7ab9777bd78d3))
|
|
18
|
+
* fix the error for search data ([224dde4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/224dde4c6a6a73969cbeace342c988160c9bc48c))
|
|
19
|
+
* multiple markets ([d139442](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d139442e4ba49d076f6d649827a31d1898b86957))
|
|
20
|
+
* multiple markets fixes and test ([f8cdbc6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f8cdbc6a54bf3e9af6e90822ba3bfc7bfa9a6a55))
|
|
21
|
+
* show missing img ([f971226](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f971226e5a6bac7898b87b0816d6879266dac0f1))
|
|
22
|
+
* test ([1a44359](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1a443599e9f5093392acf1be01b54f01afd1a160))
|
|
23
|
+
* yarn lock update ([93607f0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/93607f000ab6233a1b22309e4245aa9cb9167841))
|
|
24
|
+
* yarn lock update ([6254c20](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6254c20aaeff7af8c11fcc20d713c1e7e624cbca))
|
|
25
|
+
* yarn lock update ([7132e41](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7132e41df63cccd0c300db258433d0d0a28f341e))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Code Refactoring
|
|
29
|
+
|
|
30
|
+
* add relations func in processor helper ([65615c5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/65615c5c7f02fb0a742f072535fdf3eff0c9294d))
|
|
31
|
+
* add relations func testing factories ([deabda0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/deabda06612f9318a60ebe4529745e7ed9a37350))
|
|
32
|
+
* add relations func tests ([eeaf474](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/eeaf474bb5878713e2308dade1d9cb714c8314d7))
|
|
33
|
+
* update relations func in processor helper ([1178570](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1178570b3d3b52eb21ad4a1ba4e4196b52e34203))
|
|
34
|
+
* update relations func testing factories ([12fc2e5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/12fc2e576d3fe3ec3dce7db13999a95e55bd6787))
|
|
35
|
+
* update relations func tests to bump tests ([0d3a2c0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0d3a2c0fde5313ef53c4a035eedc5d3d915e0f59))
|
|
36
|
+
* update test factories missing data ([808c30c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/808c30cbb070ae6b09653d2210a3f2eb8faa2a3e))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
* Merge branch 'tm-3264-show-missing-img' into 'master' ([09127aa](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/09127aaf36f6968f9747cfc07b9111dd1c085b10))
|
|
40
|
+
* Merge branch 'tm-3268-enable-multiple-markets' into 'master' ([0473611](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/047361125d11bc977a2e99cdac414dc02d8ce460))
|
|
41
|
+
* Merge branch 'tm-3271-author-header-update' into 'master' ([f2f1c0c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f2f1c0c568efbfb43825daa328dcd6a70a6b98de))
|
|
42
|
+
* Merge branch 'master' into 'tm-3268-enable-multiple-markets' ([a1b6590](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a1b6590e5d3b82ff9bc494f19ad5b819619e3239))
|
|
43
|
+
|
|
1
44
|
## [18.0.6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v18.0.5...v18.0.6) (2023-01-31)
|
|
2
45
|
|
|
3
46
|
|
package/gatsby-node.esm.js
CHANGED
|
@@ -174,6 +174,7 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
|
|
|
174
174
|
|
|
175
175
|
preconnectLinks = themeOptions.preconnectLinks || [];
|
|
176
176
|
console.log(chalk.magenta('info') + chalk.whiteBright(' starting processor'));
|
|
177
|
+
|
|
177
178
|
// add data to modules
|
|
178
179
|
const processed = processor.run(response, themeOptions, fs);
|
|
179
180
|
pages = processed.pages;
|
package/package.json
CHANGED
|
@@ -17,6 +17,7 @@ export const topListPickKeys = [
|
|
|
17
17
|
'logo_url',
|
|
18
18
|
'one_liner',
|
|
19
19
|
'one_liners',
|
|
20
|
+
'market',
|
|
20
21
|
'bonus',
|
|
21
22
|
'links',
|
|
22
23
|
'type',
|
|
@@ -39,6 +40,7 @@ export const pickRelationKeys = {
|
|
|
39
40
|
tournament: ['tournaments'],
|
|
40
41
|
operator: [
|
|
41
42
|
'standardised_logo_url_object',
|
|
43
|
+
'market',
|
|
42
44
|
'logo_url_object',
|
|
43
45
|
'logo_url',
|
|
44
46
|
'one_liner',
|
|
@@ -69,7 +69,7 @@ export function clonePageForCards(item, style) {
|
|
|
69
69
|
|
|
70
70
|
const object = pick(item, pickPageKeys);
|
|
71
71
|
object.relation = pick(item.relation, pickRelationKeys[item.type]);
|
|
72
|
-
if (item.type === 'operator' && style !== 'comparison_table') {
|
|
72
|
+
if (item.type === 'operator' && style !== 'comparison_table' && object.relation.bonus) {
|
|
73
73
|
delete object.relation.bonus.deposit_methods;
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -16,6 +16,7 @@ import { shouldSavePrefilled, processModule } from './modules';
|
|
|
16
16
|
// eslint-disable-next-line import/no-cycle
|
|
17
17
|
import { clonePageForCards, groupBy, removeTags } from './common';
|
|
18
18
|
import { prepareSportsData, addSportsDataToPage, addExtraFieldsToShowcaseEvents } from './sports';
|
|
19
|
+
import { processRelations } from './relations';
|
|
19
20
|
import { zeroPadding } from '../schedule';
|
|
20
21
|
import { getRoundMinutes } from '../getters';
|
|
21
22
|
import { checkForInactiveOperatorToplist } from '../validateData';
|
|
@@ -37,6 +38,7 @@ let menus = null;
|
|
|
37
38
|
let prefilledMarketModules = null;
|
|
38
39
|
let prefilledMarketModulesRaw = null;
|
|
39
40
|
let sportsData = null;
|
|
41
|
+
const searchData = [];
|
|
40
42
|
|
|
41
43
|
export function processSitemapPages(pages, markets) {
|
|
42
44
|
const pageListByMarket = [];
|
|
@@ -73,14 +75,21 @@ export function transform(response) {
|
|
|
73
75
|
Object.keys(response.pages[language]).forEach((pageType) => {
|
|
74
76
|
transformed[siteMarket][pageType] = [];
|
|
75
77
|
Object.keys(response.pages[language][pageType]).forEach((pagePath) => {
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
const page = response.pages[language][pageType][pagePath][siteMarket];
|
|
79
|
+
if (response.site_markets[siteMarket].path_prefix && page) {
|
|
80
|
+
// set page prefix for multiple markets
|
|
81
|
+
page.path = `${response.site_markets[siteMarket].path_prefix}${
|
|
82
|
+
page.path !== '/' ? `/${page.path}` : page.path
|
|
83
|
+
}`;
|
|
84
|
+
transformed[siteMarket][pageType].push(page);
|
|
85
|
+
} else if (page) {
|
|
86
|
+
transformed[siteMarket][pageType].push(page);
|
|
87
|
+
}
|
|
80
88
|
});
|
|
81
89
|
});
|
|
82
90
|
});
|
|
83
91
|
console.log('transform done');
|
|
92
|
+
|
|
84
93
|
return transformed;
|
|
85
94
|
}
|
|
86
95
|
|
|
@@ -244,7 +253,6 @@ export default {
|
|
|
244
253
|
}
|
|
245
254
|
|
|
246
255
|
Object.keys(data.site_markets).forEach((market) => {
|
|
247
|
-
const searchData = [];
|
|
248
256
|
relations = data.relations;
|
|
249
257
|
pages = transformedPages[market];
|
|
250
258
|
menus = data.menus;
|
|
@@ -253,69 +261,11 @@ export default {
|
|
|
253
261
|
Object.keys(transformedPages[market]).forEach((pageType) => {
|
|
254
262
|
transformedPages[market][pageType].forEach((page, index) => {
|
|
255
263
|
// process page extra fields
|
|
256
|
-
processExtraFields(page.extra_fields);
|
|
264
|
+
page.extra_fields && processExtraFields(page.extra_fields);
|
|
257
265
|
updatePlaceholders(page, data);
|
|
258
266
|
|
|
259
267
|
// set page relation
|
|
260
|
-
|
|
261
|
-
page.type !== 'page' &&
|
|
262
|
-
page.relation_id &&
|
|
263
|
-
relations[page.type] &&
|
|
264
|
-
relations[page.type].hasOwnProperty(page.relation_id)
|
|
265
|
-
) {
|
|
266
|
-
transformedPages[market][pageType][index].relation =
|
|
267
|
-
relations[page.type][page.relation_id] || null;
|
|
268
|
-
|
|
269
|
-
if (page.type === 'operator') {
|
|
270
|
-
// eslint-disable-next-line camelcase, prefer-const
|
|
271
|
-
const { ribbons, extra_fields, bonus } = page.relation;
|
|
272
|
-
|
|
273
|
-
// Add path of page for payment
|
|
274
|
-
bonus.deposit_methods &&
|
|
275
|
-
bonus.deposit_methods.forEach((e) => {
|
|
276
|
-
const el =
|
|
277
|
-
pages.payment_method &&
|
|
278
|
-
pages.payment_method.find((el) => e.id === el.relation_id);
|
|
279
|
-
if (el) e.path = el.path;
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
const { operator_url, support_email, operator_name } = page.relation.bonus;
|
|
283
|
-
|
|
284
|
-
page.relation.url = operator_url || page.relation.url;
|
|
285
|
-
|
|
286
|
-
page.relation.email = support_email || page.relation.email;
|
|
287
|
-
|
|
288
|
-
page.relation.name = operator_name || page.relation.name;
|
|
289
|
-
|
|
290
|
-
// eslint-disable-next-line no-unused-expressions
|
|
291
|
-
ribbons.length > 0 &&
|
|
292
|
-
ribbons.forEach((res, index) => {
|
|
293
|
-
ribbons[index] = data.ribbons[res] ? data.ribbons[res].label : res;
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
if (ribbons.length === 0 && extra_fields.ribbon_text) {
|
|
297
|
-
page.relation.ribbons = extra_fields.ribbon_text.split(',');
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
// Linking game provider path to the game
|
|
301
|
-
if (page.type === 'game') {
|
|
302
|
-
const providerId =
|
|
303
|
-
transformedPages[market][pageType][index].relation.game_provider.id;
|
|
304
|
-
const providerPage = transformedPages[market].software_provider
|
|
305
|
-
? transformedPages[market].software_provider.filter(
|
|
306
|
-
(provider) => providerId === provider.relation_id
|
|
307
|
-
)
|
|
308
|
-
: [];
|
|
309
|
-
transformedPages[market][pageType][index].relation.game_provider.path =
|
|
310
|
-
providerPage.length > 0 ? providerPage[0].path : null;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
// add page styles object to page
|
|
314
|
-
if (page.style_id !== null && Object.values(data.page_styles).length) {
|
|
315
|
-
transformedPages[market][pageType][index].page_styles =
|
|
316
|
-
data.page_styles[page.style_id];
|
|
317
|
-
}
|
|
318
|
-
}
|
|
268
|
+
processRelations(page, pageType, transformedPages, market, data, index);
|
|
319
269
|
|
|
320
270
|
// add author object to page
|
|
321
271
|
if (page.author_id !== null && data.authors[page.author_id]) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { transform, processExtraFields, processSections } from './index';
|
|
1
|
+
import { transform, processExtraFields, processSections, processSitemapPages } from './index';
|
|
2
2
|
import pages from '~tests/factories/pages/pages.factory.js';
|
|
3
|
+
import multipleMarketsPages from '~tests/factories/pages/multiple-markets-pages.factory.js';
|
|
3
4
|
|
|
4
5
|
describe('Index Processor', () => {
|
|
5
6
|
test('Transform', () => {
|
|
@@ -7,6 +8,14 @@ describe('Index Processor', () => {
|
|
|
7
8
|
expect(results?.za_en?.page).toBeTruthy();
|
|
8
9
|
});
|
|
9
10
|
|
|
11
|
+
test('Transform multiple markets', () => {
|
|
12
|
+
const results = transform(multipleMarketsPages);
|
|
13
|
+
Object.keys(multipleMarketsPages.site_markets).forEach((siteMarket) => {
|
|
14
|
+
const prefix = multipleMarketsPages.site_markets[siteMarket].path_prefix;
|
|
15
|
+
expect(results[siteMarket].page[0].path).toBe(`${prefix ? `${prefix}/` : ''}test-page`);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
|
|
10
19
|
test('processExtraFields', () => {
|
|
11
20
|
const extraFields = {
|
|
12
21
|
logos: { value: 339, type: 'default' },
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export const processRelations = (page, pageType, transformedPages, market, data, index) => {
|
|
2
|
+
if (page.type !== 'page' && page.relation_id) {
|
|
3
|
+
const hasRelation =
|
|
4
|
+
data.relations[page.type] && data.relations[page.type].hasOwnProperty(page.relation_id);
|
|
5
|
+
transformedPages[market][pageType][index].relation = hasRelation
|
|
6
|
+
? data.relations[page.type][page.relation_id]
|
|
7
|
+
: null;
|
|
8
|
+
switch (page.type) {
|
|
9
|
+
// Add path for payment page from payment method
|
|
10
|
+
case 'operator':
|
|
11
|
+
if (hasRelation) {
|
|
12
|
+
// eslint-disable-next-line camelcase, prefer-const
|
|
13
|
+
const { ribbons, extra_fields, bonus } = page.relation;
|
|
14
|
+
bonus.deposit_methods &&
|
|
15
|
+
bonus.deposit_methods.forEach((e) => {
|
|
16
|
+
const el =
|
|
17
|
+
transformedPages[market].payment_method &&
|
|
18
|
+
transformedPages[market].payment_method.find((el) => e.id === el.relation_id);
|
|
19
|
+
if (el) e.path = el.path;
|
|
20
|
+
});
|
|
21
|
+
const { operator_url, support_email, operator_name } = page.relation.bonus;
|
|
22
|
+
page.relation.url = operator_url || page.relation.url;
|
|
23
|
+
page.relation.email = support_email || page.relation.email;
|
|
24
|
+
page.relation.name = operator_name || page.relation.name;
|
|
25
|
+
// eslint-disable-next-line no-unused-expressions
|
|
26
|
+
ribbons.length > 0 &&
|
|
27
|
+
ribbons.forEach((res, index) => {
|
|
28
|
+
ribbons[index] = data.ribbons[res] ? data.ribbons[res].label : res;
|
|
29
|
+
});
|
|
30
|
+
if (ribbons.length === 0 && extra_fields.ribbon_text) {
|
|
31
|
+
page.relation.ribbons = extra_fields.ribbon_text.split(',');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
break;
|
|
35
|
+
// Add path for game page from game provider
|
|
36
|
+
case 'game':
|
|
37
|
+
if (hasRelation) {
|
|
38
|
+
const providerId = transformedPages[market][pageType][index].relation.game_provider.id;
|
|
39
|
+
const providerPage = transformedPages[market].software_provider
|
|
40
|
+
? transformedPages[market].software_provider.filter(
|
|
41
|
+
(provider) => providerId === provider.relation_id
|
|
42
|
+
)
|
|
43
|
+
: [];
|
|
44
|
+
transformedPages[market][pageType][index].relation.game_provider.path =
|
|
45
|
+
providerPage.length > 0 ? providerPage[0].path : null;
|
|
46
|
+
}
|
|
47
|
+
break;
|
|
48
|
+
// Add author for page from authors
|
|
49
|
+
case 'author':
|
|
50
|
+
if (!hasRelation) {
|
|
51
|
+
transformedPages[market][pageType][index].relation = data.authors[page.relation_id];
|
|
52
|
+
}
|
|
53
|
+
break;
|
|
54
|
+
default:
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Add styles for page from styles object
|
|
59
|
+
if (hasRelation && page.style_id !== null && Object.values(data.page_styles).length) {
|
|
60
|
+
transformedPages[market][pageType][index].page_styles = data.page_styles[page.style_id];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { cleanup } from '@testing-library/react';
|
|
2
|
+
import { processRelations } from './relations';
|
|
3
|
+
import getData from '~tests/factories/data/data.factory';
|
|
4
|
+
import getPageList from '~tests/factories/pages/page.factory';
|
|
5
|
+
|
|
6
|
+
describe('Processor Relations', () => {
|
|
7
|
+
test('Operator', () => {
|
|
8
|
+
const type = 'operator';
|
|
9
|
+
const market = 'ie_en';
|
|
10
|
+
const data = getData({ template: type, count: 8 });
|
|
11
|
+
const pages = {
|
|
12
|
+
[market]: {
|
|
13
|
+
[type]: getPageList({ template: type, count: 3, relation_id: 5 }),
|
|
14
|
+
payment_method: [{ id: 1, path: 'payment/path' }],
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
pages[market][type].forEach((page, index) => {
|
|
19
|
+
processRelations(page, type, pages, market, data, index);
|
|
20
|
+
expect(page.type).toEqual(type);
|
|
21
|
+
});
|
|
22
|
+
expect(pages[market][type]).toHaveLength(3);
|
|
23
|
+
});
|
|
24
|
+
test('Game', () => {
|
|
25
|
+
const type = 'game';
|
|
26
|
+
const market = 'ie_en';
|
|
27
|
+
const data = getData({ template: type, count: 3 });
|
|
28
|
+
const pages = {
|
|
29
|
+
[market]: {
|
|
30
|
+
[type]: getPageList({ template: type, count: 3, relation_id: 2 }),
|
|
31
|
+
software_provider: [{ id: 3 }],
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
pages[market][type].forEach((page, index) => {
|
|
36
|
+
processRelations(page, type, pages, market, data, index);
|
|
37
|
+
expect(page.type).toEqual(type);
|
|
38
|
+
expect(page.relation.id).toEqual(2);
|
|
39
|
+
});
|
|
40
|
+
expect(pages[market][type]).toHaveLength(3);
|
|
41
|
+
});
|
|
42
|
+
test('Author', () => {
|
|
43
|
+
const type = 'author';
|
|
44
|
+
const market = 'ie_en';
|
|
45
|
+
const data = getData({ template: type, relations: {} });
|
|
46
|
+
const pages = {
|
|
47
|
+
[market]: {
|
|
48
|
+
[type]: getPageList({ template: type, count: 3, relation: null, relation_id: 5 }),
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
pages[market][type].forEach((page, index) => {
|
|
53
|
+
processRelations(page, type, pages, market, data, index);
|
|
54
|
+
expect(page.type).toEqual(type);
|
|
55
|
+
expect(page.relation.name).toEqual('Author 5 Name');
|
|
56
|
+
});
|
|
57
|
+
expect(pages[market][type]).toHaveLength(3);
|
|
58
|
+
});
|
|
59
|
+
test('Default', () => {
|
|
60
|
+
const type = 'author';
|
|
61
|
+
const market = 'ie_en';
|
|
62
|
+
const data = getData({ template: type });
|
|
63
|
+
const pages = {
|
|
64
|
+
[market]: { [type]: getPageList({ template: type, relation_id: 5, type: 'default' }) },
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
pages[market][type].forEach((page, index) => {
|
|
68
|
+
processRelations(page, type, pages, market, data, index);
|
|
69
|
+
expect(page.type).toEqual('default');
|
|
70
|
+
expect(page.relation).toEqual(null);
|
|
71
|
+
});
|
|
72
|
+
expect(pages[market][type]).toHaveLength(1);
|
|
73
|
+
});
|
|
74
|
+
test('Styles', () => {
|
|
75
|
+
const type = 'game';
|
|
76
|
+
const market = 'ie_en';
|
|
77
|
+
const data = getData({ template: type });
|
|
78
|
+
const pages = {
|
|
79
|
+
[market]: { [type]: getPageList({ template: type, style_id: 1 }) },
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
pages[market][type].forEach((page, index) => {
|
|
83
|
+
processRelations(page, type, pages, market, data, index);
|
|
84
|
+
expect(page.page_styles.style).toEqual('Test Style');
|
|
85
|
+
});
|
|
86
|
+
expect(pages[market][type]).toHaveLength(1);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
afterEach(() => {
|
|
91
|
+
cleanup();
|
|
92
|
+
});
|
|
@@ -15,7 +15,6 @@ export default function LazyImage({
|
|
|
15
15
|
defaultImg,
|
|
16
16
|
loading = 'lazy',
|
|
17
17
|
}) {
|
|
18
|
-
const [errorImage, setErrorImage] = useState(false);
|
|
19
18
|
const [nonNativeLazyLoaded, setNonNativeLazyLoaded] = useState(false);
|
|
20
19
|
const [imageSrc, setImageSrc] = useState(src);
|
|
21
20
|
|
|
@@ -28,7 +27,7 @@ export default function LazyImage({
|
|
|
28
27
|
});
|
|
29
28
|
}, [src]);
|
|
30
29
|
|
|
31
|
-
if (
|
|
30
|
+
if (defaultImg && !src) {
|
|
32
31
|
return defaultImg;
|
|
33
32
|
}
|
|
34
33
|
|
|
@@ -41,7 +40,6 @@ export default function LazyImage({
|
|
|
41
40
|
width={width}
|
|
42
41
|
alt={alt}
|
|
43
42
|
style={style}
|
|
44
|
-
onError={() => setErrorImage(true)}
|
|
45
43
|
/>
|
|
46
44
|
) : (
|
|
47
45
|
<>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const getDefaultProps = (index = 1) => ({
|
|
2
|
+
name: `Author ${index} Name`,
|
|
3
|
+
image_alt: `Author ${index} Name Alt`,
|
|
4
|
+
profile_page_path: `about-us/test-author/${index}`,
|
|
5
|
+
ribbon_label: 'Sportsbook Expert',
|
|
6
|
+
expertise: ['Sports Betting', 'Betting Sites', 'Sportsbook Analysis'],
|
|
7
|
+
image_asset_id: 96414,
|
|
8
|
+
biography: `Author ${index} Biography`,
|
|
9
|
+
site_id: 1,
|
|
10
|
+
country_id: 102,
|
|
11
|
+
language_id: 1,
|
|
12
|
+
twitter_profile: 'https://twitter.com/',
|
|
13
|
+
facebook_profile: 'https://facebook.com/',
|
|
14
|
+
linkedin_profile: 'https://linkedin.com/',
|
|
15
|
+
instagram_profile: 'https://instagram.com/',
|
|
16
|
+
tik_tok: 'https://tiktok.com/',
|
|
17
|
+
personal_website: '/',
|
|
18
|
+
email_address: `test.author.${index}@site.com`,
|
|
19
|
+
author_title: 'Irish Sportsbook Specialist',
|
|
20
|
+
additional_url: null,
|
|
21
|
+
image: '1666946055/siobhan-aslett.png',
|
|
22
|
+
image_object: {
|
|
23
|
+
width: '124',
|
|
24
|
+
height: '124',
|
|
25
|
+
url: 'https://assets-srv.s3.eu-west-1.amazonaws.com/1666946055/siobhan-aslett.png',
|
|
26
|
+
title: `Author ${index} Image Title `,
|
|
27
|
+
alt: `Author ${index} Image Title Alt`,
|
|
28
|
+
filename: '1666946055/siobhan-aslett.png',
|
|
29
|
+
},
|
|
30
|
+
country: {
|
|
31
|
+
id: 102,
|
|
32
|
+
code: 'IE',
|
|
33
|
+
name: 'Ireland',
|
|
34
|
+
},
|
|
35
|
+
language: {
|
|
36
|
+
id: 1,
|
|
37
|
+
code: 'en',
|
|
38
|
+
name: 'English',
|
|
39
|
+
},
|
|
40
|
+
knows_abouts: ['Thing One', 'Thing Two'],
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export default function getAuthorList({ template, count = 1, id = 1, ...customProps }) {
|
|
44
|
+
const authorList = {};
|
|
45
|
+
// eslint-disable-next-line no-plusplus
|
|
46
|
+
for (let index = id; index < id + count; index++) {
|
|
47
|
+
authorList[index] = {
|
|
48
|
+
id: index,
|
|
49
|
+
...getDefaultProps(index),
|
|
50
|
+
...customProps,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return authorList;
|
|
54
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import getRealationList from '../relations/relation.factory';
|
|
2
|
+
import getAuthorList from '../authors/author.factory';
|
|
3
|
+
|
|
4
|
+
const getDefaultProps = (template, count) => ({
|
|
5
|
+
relations: { [template]: getRealationList({ template, count }) },
|
|
6
|
+
ribbons: {
|
|
7
|
+
1: { id: 1, label: 'Ribbon Label 1', language_id: 1, site_id: 1 },
|
|
8
|
+
2: { id: 2, label: 'Ribbon Label 2', language_id: 2, site_id: 1 },
|
|
9
|
+
},
|
|
10
|
+
authors: getAuthorList({ count }),
|
|
11
|
+
page_styles: {
|
|
12
|
+
1: {
|
|
13
|
+
style: 'Test Style',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export default function getData({ template, count = 10, ...customProps } = {}) {
|
|
19
|
+
return {
|
|
20
|
+
...getDefaultProps(template, count),
|
|
21
|
+
...customProps,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
site_markets: {
|
|
3
|
+
za_en: { path_prefix: null },
|
|
4
|
+
es_en: {
|
|
5
|
+
path_prefix: 'es',
|
|
6
|
+
},
|
|
7
|
+
},
|
|
8
|
+
pages: {
|
|
9
|
+
en: {
|
|
10
|
+
page: {
|
|
11
|
+
'test-page': {
|
|
12
|
+
za_en: {
|
|
13
|
+
id: 99408,
|
|
14
|
+
market_id: 67,
|
|
15
|
+
updated_at: '2021-12-08',
|
|
16
|
+
created_at: '2021-12-08 16:15:50',
|
|
17
|
+
template_id: 97,
|
|
18
|
+
page_hreflang_group_id: null,
|
|
19
|
+
page_hreflang_combined: 0,
|
|
20
|
+
relation_id: 0,
|
|
21
|
+
relation_type: 'page',
|
|
22
|
+
market: 'za_en',
|
|
23
|
+
region_code: null,
|
|
24
|
+
author: null,
|
|
25
|
+
hard_coded_breadcrumbs: 0,
|
|
26
|
+
breadcrumb_ids: null,
|
|
27
|
+
categories: [],
|
|
28
|
+
author_id: null,
|
|
29
|
+
style_id: null,
|
|
30
|
+
language: 'en',
|
|
31
|
+
description: null,
|
|
32
|
+
meta_title: null,
|
|
33
|
+
meta_robots: null,
|
|
34
|
+
robot_options: {
|
|
35
|
+
page_index: 0,
|
|
36
|
+
links_followed: 0,
|
|
37
|
+
images_index: 0,
|
|
38
|
+
show_snippet: 0,
|
|
39
|
+
},
|
|
40
|
+
meta_description: null,
|
|
41
|
+
seo_keywords: null,
|
|
42
|
+
seo_raw_js: '',
|
|
43
|
+
seo_json_schema: null,
|
|
44
|
+
seo_json_schemas: [],
|
|
45
|
+
page_custom_hreflangs: null,
|
|
46
|
+
title: 'test-page',
|
|
47
|
+
vanity_label: null,
|
|
48
|
+
path: 'test-page',
|
|
49
|
+
type: 'page',
|
|
50
|
+
template: 'default',
|
|
51
|
+
extra_fields: [],
|
|
52
|
+
banner: null,
|
|
53
|
+
featured_image: null,
|
|
54
|
+
canonical_url: null,
|
|
55
|
+
canonical_url_page_id: null,
|
|
56
|
+
status: 'active',
|
|
57
|
+
page_group_id: null,
|
|
58
|
+
page_group_combined: 0,
|
|
59
|
+
page_group_custom_items: null,
|
|
60
|
+
},
|
|
61
|
+
es_en: {
|
|
62
|
+
id: 99408,
|
|
63
|
+
market_id: 67,
|
|
64
|
+
updated_at: '2021-12-08',
|
|
65
|
+
created_at: '2021-12-08 16:15:50',
|
|
66
|
+
template_id: 97,
|
|
67
|
+
page_hreflang_group_id: null,
|
|
68
|
+
page_hreflang_combined: 0,
|
|
69
|
+
relation_id: 0,
|
|
70
|
+
relation_type: 'page',
|
|
71
|
+
market: 'za_en',
|
|
72
|
+
region_code: null,
|
|
73
|
+
author: null,
|
|
74
|
+
hard_coded_breadcrumbs: 0,
|
|
75
|
+
breadcrumb_ids: null,
|
|
76
|
+
categories: [],
|
|
77
|
+
author_id: null,
|
|
78
|
+
style_id: null,
|
|
79
|
+
language: 'en',
|
|
80
|
+
description: null,
|
|
81
|
+
meta_title: null,
|
|
82
|
+
meta_robots: null,
|
|
83
|
+
robot_options: {
|
|
84
|
+
page_index: 0,
|
|
85
|
+
links_followed: 0,
|
|
86
|
+
images_index: 0,
|
|
87
|
+
show_snippet: 0,
|
|
88
|
+
},
|
|
89
|
+
meta_description: null,
|
|
90
|
+
seo_keywords: null,
|
|
91
|
+
seo_raw_js: '',
|
|
92
|
+
seo_json_schema: null,
|
|
93
|
+
seo_json_schemas: [],
|
|
94
|
+
page_custom_hreflangs: null,
|
|
95
|
+
title: 'test-page',
|
|
96
|
+
vanity_label: null,
|
|
97
|
+
path: 'test-page',
|
|
98
|
+
type: 'page',
|
|
99
|
+
template: 'default',
|
|
100
|
+
extra_fields: [],
|
|
101
|
+
banner: null,
|
|
102
|
+
featured_image: null,
|
|
103
|
+
canonical_url: null,
|
|
104
|
+
canonical_url_page_id: null,
|
|
105
|
+
status: 'active',
|
|
106
|
+
page_group_id: null,
|
|
107
|
+
page_group_combined: 0,
|
|
108
|
+
page_group_custom_items: null,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import getRealationList from '../relations/relation.factory';
|
|
2
|
+
|
|
3
|
+
const getDefaultProps = (index = 1, template) => ({
|
|
4
|
+
type: 'page',
|
|
5
|
+
name: `Page ${index} Name`,
|
|
6
|
+
title: `Page ${index} Title`,
|
|
7
|
+
meta_title: `Page ${index} Meta Title`,
|
|
8
|
+
meta_description: `Page ${index} Meta Description`,
|
|
9
|
+
meta_robots: ['one', 'two', 'three'],
|
|
10
|
+
language: 'en',
|
|
11
|
+
template_id: '1',
|
|
12
|
+
path: `sport/brand/${index}`,
|
|
13
|
+
url: 'https://test-site.com',
|
|
14
|
+
logo_url: '#',
|
|
15
|
+
banner: '313df295c19d7c5f137ceda9d0cc5df7.jpeg',
|
|
16
|
+
rating: '4.88',
|
|
17
|
+
sections: { main: { extra_fields: { logos: { value: 339, type: 'default' } } } },
|
|
18
|
+
extra_fields: { related_operator: {} },
|
|
19
|
+
breadcrumbs: [{ label: 'Sport', path: 'sport' }],
|
|
20
|
+
preconnect_links: ['1', '2', '3'],
|
|
21
|
+
robot_options: { page_index: 1 },
|
|
22
|
+
seo_json_schema: ['custom_json_schema'],
|
|
23
|
+
relation_id: 1,
|
|
24
|
+
relation: getRealationList({ template })[1],
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const getTemplateProps = (template) =>
|
|
28
|
+
({
|
|
29
|
+
operator: {
|
|
30
|
+
type: 'operator',
|
|
31
|
+
},
|
|
32
|
+
game: {
|
|
33
|
+
type: 'game',
|
|
34
|
+
},
|
|
35
|
+
author: {
|
|
36
|
+
type: 'author',
|
|
37
|
+
},
|
|
38
|
+
}[template] || {});
|
|
39
|
+
|
|
40
|
+
export default function getPageList({ template = 'page', count = 1, id = 1, ...customProps } = {}) {
|
|
41
|
+
const pageList = [];
|
|
42
|
+
// eslint-disable-next-line no-plusplus
|
|
43
|
+
for (let index = id; index < id + count; index++) {
|
|
44
|
+
pageList.push({
|
|
45
|
+
id: index,
|
|
46
|
+
...getDefaultProps(index, template),
|
|
47
|
+
...getTemplateProps(template),
|
|
48
|
+
...customProps,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return pageList;
|
|
52
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const getDefaultProps = (index = 1) => ({
|
|
2
|
+
status: 'active',
|
|
3
|
+
name: `Relation ${index} Name`,
|
|
4
|
+
short_name: `Relation ${index} Short Name`,
|
|
5
|
+
url: 'https://test-site.com',
|
|
6
|
+
logo_url: 'rizk-logopng7ed316ac19-original.png',
|
|
7
|
+
iframe: 'https://www.youtube.com/embed/DU1Pio4n_N0',
|
|
8
|
+
extra_fields: {
|
|
9
|
+
summary_background: 'fe63f69ca1618cf2e7ff810197001dec.png',
|
|
10
|
+
summary: 'Summary',
|
|
11
|
+
},
|
|
12
|
+
bonus: {
|
|
13
|
+
one_liners: { main: { one_liner: 'Oneliner' } },
|
|
14
|
+
deposit_methods: {},
|
|
15
|
+
},
|
|
16
|
+
one_liners: {
|
|
17
|
+
main: { one_liner: '100% Bonus + 50 free spins' },
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const getTemplateProps = (template) =>
|
|
22
|
+
({
|
|
23
|
+
operator: {
|
|
24
|
+
type: 'casino',
|
|
25
|
+
ribbons: [],
|
|
26
|
+
bonus: { deposit_methods: [{ id: 1 }] },
|
|
27
|
+
extra_fields: { ribbon_text: 'Recommended,New Casino' },
|
|
28
|
+
},
|
|
29
|
+
game: {
|
|
30
|
+
type: 'game',
|
|
31
|
+
game_provider: { id: 1 },
|
|
32
|
+
},
|
|
33
|
+
author: {
|
|
34
|
+
type: 'author',
|
|
35
|
+
},
|
|
36
|
+
}[template] || {});
|
|
37
|
+
|
|
38
|
+
export default function getRealationList({ template, count = 1, id = 1, ...customProps } = {}) {
|
|
39
|
+
const realationList = [];
|
|
40
|
+
// eslint-disable-next-line no-plusplus
|
|
41
|
+
for (let index = id; index < id + count; index++) {
|
|
42
|
+
realationList[index] = {
|
|
43
|
+
id: index,
|
|
44
|
+
...getDefaultProps(index),
|
|
45
|
+
...getTemplateProps(template),
|
|
46
|
+
...customProps,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return realationList;
|
|
50
|
+
}
|