gatsby-core-theme 22.0.5 → 22.0.6
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 +13 -0
- package/package.json +1 -1
- package/src/components/atoms/breadcrumbs/breadcrumbs.test.js +10 -1
- package/src/components/atoms/breadcrumbs/index.js +11 -2
- package/src/components/molecules/header/index.js +2 -1
- package/src/constants/settings.js +1 -0
- package/src/helpers/processor/common.js +3 -1
- package/src/helpers/processor/common.test.js +4 -2
- package/src/helpers/processor/index.js +19 -5
- package/src/helpers/processor/modules.js +16 -3
- package/src/helpers/processor/modules.test.js +17 -0
- package/src/hooks/link/index.js +1 -2
- package/tests/factories/modules/toplist.factory.js +1 -1
- package/tests/factories/pages/default.factory.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
## [22.0.6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v22.0.5...v22.0.6) (2023-05-31)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add free-casinos as well ([b36474e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b36474e236aaa2c3cb6156ab6b127b3f2361b9a3))
|
|
7
|
+
* multiple market bugs ([9ea03b7](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9ea03b74137c9ea5013cb68467623698040ac89a))
|
|
8
|
+
* multiple market bugs ([caf25e3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/caf25e31d2d664e727092c3c085dfab59e86b857))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
* Merge branch 'tm-3473-multiple-market-fixes' into 'master' ([37556d3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/37556d3ab485fc89c32b46391c7a16839049ad58))
|
|
12
|
+
* Merge branch 'bug-fix-request-add-not-recommended' into 'master' ([27b345b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/27b345bdda19e4151c82edb7377a176b0894fc44))
|
|
13
|
+
|
|
1
14
|
## [22.0.5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v22.0.4...v22.0.5) (2023-05-18)
|
|
2
15
|
|
|
3
16
|
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import '@testing-library/jest-dom/extend-expect';
|
|
|
4
4
|
|
|
5
5
|
import getPageData from '~tests/factories/pages/default.factory';
|
|
6
6
|
import MainProvider from '~context/MainProvider';
|
|
7
|
-
import Breadcrumbs from '
|
|
7
|
+
import Breadcrumbs from './index';
|
|
8
8
|
|
|
9
9
|
function renderComponent(pageData) {
|
|
10
10
|
return render(
|
|
@@ -72,6 +72,15 @@ describe('Show Breadcrumbs in a page', () => {
|
|
|
72
72
|
const { getByText } = renderComponent(page);
|
|
73
73
|
expect(getByText('Simple Casino')).toBeTruthy();
|
|
74
74
|
});
|
|
75
|
+
test('Breadcrumbs with multiple markets', () => {
|
|
76
|
+
const data = getPageData();
|
|
77
|
+
const { getByText } = render(
|
|
78
|
+
<Breadcrumbs page={data} markets={{ en_za: { path_prefix: 'en' } }} />
|
|
79
|
+
);
|
|
80
|
+
expect(getByText('The Page Title')).toBeTruthy();
|
|
81
|
+
expect(getByText('Home').getAttribute('href')).toEqual('/en');
|
|
82
|
+
expect(getByText('Sport').getAttribute('href')).toEqual('/sport');
|
|
83
|
+
});
|
|
75
84
|
});
|
|
76
85
|
afterEach(() => {
|
|
77
86
|
cleanup();
|
|
@@ -8,8 +8,9 @@ import keygen from '~helpers/keygen';
|
|
|
8
8
|
import { translate } from '~helpers/getters';
|
|
9
9
|
import { Context } from '~context/MainProvider';
|
|
10
10
|
|
|
11
|
-
function Breadcrumbs({ page, separator = <span> / </span
|
|
11
|
+
function Breadcrumbs({ page, separator = <span> / </span>, markets }) {
|
|
12
12
|
const { translations } = useContext(Context) || {};
|
|
13
|
+
const activeMarket = markets && markets[page.market];
|
|
13
14
|
|
|
14
15
|
if (page.path === '/') {
|
|
15
16
|
return <></>;
|
|
@@ -29,7 +30,11 @@ function Breadcrumbs({ page, separator = <span> / </span> }) {
|
|
|
29
30
|
{isPPC ? (
|
|
30
31
|
home
|
|
31
32
|
) : (
|
|
32
|
-
<Link
|
|
33
|
+
<Link
|
|
34
|
+
to={(activeMarket && activeMarket.path_prefix) || '/'}
|
|
35
|
+
title="Home"
|
|
36
|
+
className="breadcrumbs-gtm"
|
|
37
|
+
>
|
|
33
38
|
{home}
|
|
34
39
|
</Link>
|
|
35
40
|
)}
|
|
@@ -55,7 +60,11 @@ function Breadcrumbs({ page, separator = <span> / </span> }) {
|
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
Breadcrumbs.propTypes = {
|
|
63
|
+
markets: PropTypes.shape({
|
|
64
|
+
path_prefix: PropTypes.string,
|
|
65
|
+
}),
|
|
58
66
|
page: PropTypes.shape({
|
|
67
|
+
market: PropTypes.string,
|
|
59
68
|
title: PropTypes.string,
|
|
60
69
|
path: PropTypes.string,
|
|
61
70
|
breadcrumbs: PropTypes.arrayOf(PropTypes.shape({})),
|
|
@@ -59,7 +59,7 @@ function Header({ section, content = null, backgroundImage = true, showAuthor =
|
|
|
59
59
|
}`}
|
|
60
60
|
>
|
|
61
61
|
<div className={styles.topSection || ''}>
|
|
62
|
-
{section.page.path && <Breadcrumbs page={section.page} />}
|
|
62
|
+
{section.page.path && <Breadcrumbs markets={section.allMarkets} page={section.page} />}
|
|
63
63
|
{Author && (
|
|
64
64
|
<div className={styles.authorContainer || ''}>
|
|
65
65
|
<Author
|
|
@@ -90,6 +90,7 @@ function Header({ section, content = null, backgroundImage = true, showAuthor =
|
|
|
90
90
|
Header.propTypes = {
|
|
91
91
|
content: PropTypes.element,
|
|
92
92
|
section: PropTypes.shape({
|
|
93
|
+
allMarkets: PropTypes.shape([PropTypes.shape({})]),
|
|
93
94
|
page: PropTypes.shape({
|
|
94
95
|
template: PropTypes.string,
|
|
95
96
|
relation_type: PropTypes.string,
|
|
@@ -17,6 +17,7 @@ export default {
|
|
|
17
17
|
'onlinegamblingsa.co.za': ['inactive', 'blacklisted', 'coming_soon'],
|
|
18
18
|
'onlinegamblingsa.com': ['inactive', 'blacklisted', 'coming_soon', 'not_recommended'],
|
|
19
19
|
'onlinecasinosouthafrica.net': ['inactive', 'blacklisted', 'coming_soon', 'not_recommended'],
|
|
20
|
+
'free-casinos.co.za': ['inactive', 'blacklisted', 'coming_soon', 'not_recommended'],
|
|
20
21
|
'sporttheme.com': ['inactive', 'blacklisted'],
|
|
21
22
|
'partnerships.gigmedia.com': ['inactive', 'blacklisted'],
|
|
22
23
|
'habibibet.org': ['inactive', 'blacklisted'],
|
|
@@ -119,7 +119,9 @@ export function removeCurrentPage(list, id) {
|
|
|
119
119
|
|
|
120
120
|
export function updateMenuPrefixPath(menu, prefixPath) {
|
|
121
121
|
menu.map((item) => {
|
|
122
|
-
|
|
122
|
+
if (item.value) {
|
|
123
|
+
item.value = item.value === '/' ? prefixPath : `${prefixPath}/${item.value}`;
|
|
124
|
+
}
|
|
123
125
|
|
|
124
126
|
if (item.children) {
|
|
125
127
|
updateMenuPrefixPath(item.children, prefixPath);
|
|
@@ -43,7 +43,7 @@ describe('Common Helper', () => {
|
|
|
43
43
|
value: 'test',
|
|
44
44
|
children: [
|
|
45
45
|
{
|
|
46
|
-
value: '
|
|
46
|
+
value: 'null',
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
value: 'test3',
|
|
@@ -80,7 +80,9 @@ describe('Common Helper', () => {
|
|
|
80
80
|
|
|
81
81
|
updateMenuPrefixPath(data, 'prefix/');
|
|
82
82
|
data.map((menuItem) => {
|
|
83
|
-
|
|
83
|
+
if (menuItem.value) {
|
|
84
|
+
expect(menuItem.value).toContain('prefix/');
|
|
85
|
+
}
|
|
84
86
|
return true;
|
|
85
87
|
});
|
|
86
88
|
});
|
|
@@ -96,7 +96,7 @@ export function transform(response) {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
const savedModules = {};
|
|
99
|
-
export function processSections(sections, skipPost = false, page, translations) {
|
|
99
|
+
export function processSections(sections, skipPost = false, page, translations, markets) {
|
|
100
100
|
const siteName = page && page.siteInfo && page.siteInfo.site_name;
|
|
101
101
|
// pagedId we will use it just on operator review pages
|
|
102
102
|
const pageId = page ? page.id : null;
|
|
@@ -127,7 +127,8 @@ export function processSections(sections, skipPost = false, page, translations)
|
|
|
127
127
|
previewMode,
|
|
128
128
|
pageId,
|
|
129
129
|
translations,
|
|
130
|
-
relationData
|
|
130
|
+
relationData,
|
|
131
|
+
markets
|
|
131
132
|
);
|
|
132
133
|
|
|
133
134
|
if (shouldSavePrefilled(module, siteName)) {
|
|
@@ -302,7 +303,13 @@ export default {
|
|
|
302
303
|
if (pageBreadcrumbIds) {
|
|
303
304
|
let breadcrumbsArray = [];
|
|
304
305
|
for (let i = 0; i < pageBreadcrumbIds.length; i += 1) {
|
|
305
|
-
|
|
306
|
+
const breadcrumbData = cloneDeep(data.breadcrumbs[pageBreadcrumbIds[i]]);
|
|
307
|
+
|
|
308
|
+
if (data.site_markets[market].path_prefix) {
|
|
309
|
+
breadcrumbData[0].path = `${data.site_markets[market].path_prefix}/${breadcrumbData[0].path}`;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
breadcrumbsArray = [...breadcrumbsArray, ...breadcrumbData];
|
|
306
313
|
}
|
|
307
314
|
transformedPages[market][pageType][index].breadcrumbs = breadcrumbsArray;
|
|
308
315
|
}
|
|
@@ -418,7 +425,8 @@ export default {
|
|
|
418
425
|
data.market_sections[market],
|
|
419
426
|
true,
|
|
420
427
|
null,
|
|
421
|
-
translations
|
|
428
|
+
translations,
|
|
429
|
+
data.site_markets
|
|
422
430
|
);
|
|
423
431
|
}
|
|
424
432
|
|
|
@@ -445,7 +453,13 @@ export default {
|
|
|
445
453
|
});
|
|
446
454
|
|
|
447
455
|
transformedPages[market][pageType][index] = Object.assign(page, {
|
|
448
|
-
sections: processSections(
|
|
456
|
+
sections: processSections(
|
|
457
|
+
page.sections,
|
|
458
|
+
false,
|
|
459
|
+
page,
|
|
460
|
+
translations,
|
|
461
|
+
data.site_markets
|
|
462
|
+
),
|
|
449
463
|
});
|
|
450
464
|
}
|
|
451
465
|
});
|
|
@@ -265,7 +265,7 @@ export function processArchiveModule(module, pages) {
|
|
|
265
265
|
module.numOfPages = 1;
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
export function processTopListModule(module, relations, pages) {
|
|
268
|
+
export function processTopListModule(module, relations, pages, markets) {
|
|
269
269
|
module.items = module.items.map((listItem) => {
|
|
270
270
|
listItem.items = listItem.items.map((item) => {
|
|
271
271
|
// Remove the ribbons if are empty, will be add ribbons from operator
|
|
@@ -282,6 +282,18 @@ export function processTopListModule(module, relations, pages) {
|
|
|
282
282
|
clone.authorPath =
|
|
283
283
|
operatorPage[0].author.profile_page_path && operatorPage[0].author.profile_page_path;
|
|
284
284
|
}
|
|
285
|
+
|
|
286
|
+
// Multiple market fix
|
|
287
|
+
if (
|
|
288
|
+
item.review_link &&
|
|
289
|
+
operatorPage.length >= 1 &&
|
|
290
|
+
markets &&
|
|
291
|
+
markets[operatorPage[0].market] &&
|
|
292
|
+
markets[operatorPage[0].market].path_prefix
|
|
293
|
+
) {
|
|
294
|
+
item.review_link = `${markets[operatorPage[0].market].path_prefix}/${item.review_link}`;
|
|
295
|
+
}
|
|
296
|
+
|
|
285
297
|
delete clone.software;
|
|
286
298
|
delete clone.bonus.deposit_methods;
|
|
287
299
|
return Object.assign(clone, item);
|
|
@@ -309,7 +321,8 @@ export function processModule(
|
|
|
309
321
|
previewMode,
|
|
310
322
|
pageId,
|
|
311
323
|
translations,
|
|
312
|
-
relationData
|
|
324
|
+
relationData,
|
|
325
|
+
markets
|
|
313
326
|
) {
|
|
314
327
|
module.module_title =
|
|
315
328
|
module.module_title &&
|
|
@@ -326,7 +339,7 @@ export function processModule(
|
|
|
326
339
|
} else if (module.name === 'archive' && previewMode) {
|
|
327
340
|
processArchiveModule(module, pages);
|
|
328
341
|
} else if (module.name === 'top_list') {
|
|
329
|
-
processTopListModule(module, relations, pages);
|
|
342
|
+
processTopListModule(module, relations, pages, markets);
|
|
330
343
|
} else if (module.name === 'menu' && menus && menus[module.menu_id]) {
|
|
331
344
|
module = Object.assign(module, menus[module.menu_id]);
|
|
332
345
|
}
|
|
@@ -172,6 +172,23 @@ describe('Modules Helper', () => {
|
|
|
172
172
|
expect(singleToplistData.items[0].items[0].bonus.deposit_methods).toHaveLength(1);
|
|
173
173
|
});
|
|
174
174
|
|
|
175
|
+
test('Process TopList module multiple market', () => {
|
|
176
|
+
processTopListModule(
|
|
177
|
+
singleToplistData,
|
|
178
|
+
relationData,
|
|
179
|
+
{
|
|
180
|
+
operator: [{ relation_id: 6342, market: 'en_za' }],
|
|
181
|
+
},
|
|
182
|
+
{ en_za: { path_prefix: 'en' } }
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
expect(singleToplistData.items[0].items[0].review_link).toEqual('en/slotum');
|
|
186
|
+
expect(singleToplistData.items[0].items[0].rating_casino).toEqual('4');
|
|
187
|
+
expect(singleToplistData.items[0].items[0].selling_points).toHaveLength(2);
|
|
188
|
+
expect(singleToplistData.items[0].items[0].short_name).toEqual('slotum');
|
|
189
|
+
expect(singleToplistData.items[0].items[0].bonus.deposit_methods).toHaveLength(1);
|
|
190
|
+
});
|
|
191
|
+
|
|
175
192
|
test('Should Generate Prefilled', () => {
|
|
176
193
|
const objects = objectsHolder('prefilledModules');
|
|
177
194
|
objects.forEach((prefilled) => {
|
package/src/hooks/link/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
3
|
import { Link } from 'gatsby';
|
|
4
|
-
import { navigate } from '@reach/router';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
6
5
|
import { previewFormat, previewPath, formatPath } from '~helpers/path';
|
|
7
6
|
|
|
@@ -30,7 +29,7 @@ function LinkCustom({
|
|
|
30
29
|
{...other}
|
|
31
30
|
onClick={(event) => {
|
|
32
31
|
event.preventDefault();
|
|
33
|
-
|
|
32
|
+
window.location = previewPath(to);
|
|
34
33
|
}}
|
|
35
34
|
>
|
|
36
35
|
{children}
|
|
@@ -439,7 +439,7 @@ export const singleToplistData = {
|
|
|
439
439
|
short_name: 'slotum',
|
|
440
440
|
logo_url: 'slotum-casino-logo-transparentpng6b10407566-original.png',
|
|
441
441
|
rating: '4',
|
|
442
|
-
review_link: '
|
|
442
|
+
review_link: 'slotum',
|
|
443
443
|
selling_points: ['200% Bonus', 'Nice design'],
|
|
444
444
|
links: {
|
|
445
445
|
main: 'https://media.dunderaffiliates.com/redirect.aspx?pid=630524&bid=1477',
|