gatsby-core-theme 24.0.0 → 24.0.2
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 +34 -0
- package/package.json +1 -1
- package/src/components/atoms/author-box/author-box.test.js +23 -1
- package/src/components/atoms/menu/items/item/item.test.js +41 -0
- package/src/components/molecules/content/index.js +15 -2
- package/src/components/molecules/module/index.js +1 -2
- package/src/components/molecules/operator-banner/index.js +19 -4
- package/src/components/organisms/head/index.js +4 -0
- package/src/helpers/processor/index.js +22 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
## [24.0.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v24.0.1...v24.0.2) (2023-07-04)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* remove console log ([1a3396b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1a3396beec0e5b887c109acac812e8bc82b92ce7))
|
|
7
|
+
|
|
8
|
+
## [24.0.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v24.0.0...v24.0.1) (2023-07-04)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* add alternate linls ([15cb91d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/15cb91d4e8fe78abc021ccf3edbf8f7d9bedc608))
|
|
14
|
+
* add default market ([bf1c2c2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/bf1c2c2ee7dc76d4282bc25dff01beecdb27765b))
|
|
15
|
+
* add placeholder for h1,h2,h3 ([79b793b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/79b793b9d564b4497bc655ff1f085b8323b24ece))
|
|
16
|
+
* add tracker type in the bonus module ([42acf68](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/42acf68f747060e6c887e5abc324946811b3c2b3))
|
|
17
|
+
* add trcaker type ([6e92571](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6e92571f257274e6c3e56f939d777543effcdedb))
|
|
18
|
+
* fix name of label ([e39bd21](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e39bd21b8d811ff2f6a9d3e7e76154aac1627616))
|
|
19
|
+
* hreflang ([375c89d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/375c89d0e28d39af60d18ab10a1b374876cb6697))
|
|
20
|
+
* pass data for sitename, operator_name and title ([4e398ca](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4e398ca23a87f01e24d8a1bc97bef32f557b6a3f))
|
|
21
|
+
* refactor ([c8b071f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c8b071fb531d7529e11587108c9fb4e47bb562c9))
|
|
22
|
+
* refactor code ([d026394](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d02639498926eaab05851ad9b3df720b448fb87b))
|
|
23
|
+
* refactor code ([0ae55f1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0ae55f1954cabef399c4742c2df23946626a214e))
|
|
24
|
+
* tests ([8c2c651](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8c2c651a609f7b41edb53446fac57ef50d523641))
|
|
25
|
+
* tests ([3d1d567](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3d1d567518406d9d5e304ae2a39c920bc2b98e0a))
|
|
26
|
+
* validate hreflangs ([306c09a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/306c09a67a74254b3a1b8797c9da683ff5bd4c0d))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
* Merge branch 'tm-3396-bonus' into 'master' ([d8f27df](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d8f27dfffaff66945cb71ef2f34d99796f7f084c))
|
|
30
|
+
* Merge branch 'tm-3526-multi-markets' into 'master' ([715c9c9](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/715c9c995b82005d8c0ef6a3aa279dec710058d2))
|
|
31
|
+
* Merge branch 'master' into tm-3526-multi-markets ([2d8b4ad](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2d8b4addd5c765962b4c29ddea26034ccb9f309b))
|
|
32
|
+
* Merge branch 'tm-3086' into 'master' ([d0ba16f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d0ba16fdab86de26b2bd6ef725ee8b8ded7d4386))
|
|
33
|
+
* Merge branch 'master' into tm-3526-multi-markets ([16b9caa](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/16b9caad374c8e7a78a7718c59be7e029d954647))
|
|
34
|
+
|
|
1
35
|
# [24.0.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v23.0.2...v24.0.0) (2023-06-27)
|
|
2
36
|
|
|
3
37
|
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render, cleanup } from '@testing-library/react';
|
|
2
|
+
import { render, cleanup, fireEvent, waitFor } from '@testing-library/react';
|
|
3
3
|
import '@testing-library/jest-dom/extend-expect';
|
|
4
4
|
|
|
5
5
|
import { authorObject } from '~tests/factories/modules/author-box.factory';
|
|
@@ -26,6 +26,28 @@ describe('author box component', () => {
|
|
|
26
26
|
// CTA
|
|
27
27
|
expect(getByText('More about Ida')).toBeTruthy();
|
|
28
28
|
});
|
|
29
|
+
|
|
30
|
+
test('render with read more ', async () => {
|
|
31
|
+
const author = authorObject;
|
|
32
|
+
|
|
33
|
+
author.biography =
|
|
34
|
+
"The purpose of lorem ipsum is to create a natural looking block of text (sentence, paragraph, page, etc.) that doesn't distract from the layout. A practice not without controversy, laying out";
|
|
35
|
+
|
|
36
|
+
const { container, getByText } = render(<AuthorBox author={author} />);
|
|
37
|
+
|
|
38
|
+
expect(container).toBeTruthy();
|
|
39
|
+
expect(
|
|
40
|
+
getByText(
|
|
41
|
+
"The purpose of lorem ipsum is to create a natural looking block of text (sentence, paragraph, page, etc.) that doesn't distract from the layout. A practice not without controversy, laying..."
|
|
42
|
+
)
|
|
43
|
+
).toBeTruthy();
|
|
44
|
+
const button = container.querySelector('.contReadText');
|
|
45
|
+
fireEvent.click(button);
|
|
46
|
+
|
|
47
|
+
await waitFor(() => {
|
|
48
|
+
expect(getByText(author.biography)).toBeTruthy();
|
|
49
|
+
}, 4000);
|
|
50
|
+
});
|
|
29
51
|
});
|
|
30
52
|
afterEach(() => {
|
|
31
53
|
cleanup();
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, cleanup, waitFor, fireEvent } from '@testing-library/react';
|
|
3
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
4
|
+
|
|
5
|
+
import getNavigation from '~tests/factories/sections/navigationStatic.factory';
|
|
6
|
+
import { getMenuObj } from '~helpers/menu';
|
|
7
|
+
import Item from '.';
|
|
8
|
+
|
|
9
|
+
let data;
|
|
10
|
+
let section;
|
|
11
|
+
let menus;
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
data = getNavigation();
|
|
15
|
+
section = {
|
|
16
|
+
modules: [data],
|
|
17
|
+
};
|
|
18
|
+
menus = getMenuObj(section.modules, 'menu');
|
|
19
|
+
});
|
|
20
|
+
describe('Menu Component', () => {
|
|
21
|
+
test('render menu link item', async () => {
|
|
22
|
+
const { container, getByText } = render(<Item item={menus.children[3]} />);
|
|
23
|
+
await waitFor(() => {
|
|
24
|
+
expect(container).toBeTruthy();
|
|
25
|
+
expect(container.querySelectorAll('a')).toHaveLength(1);
|
|
26
|
+
expect(getByText('Sportsbooks').getAttribute('href')).toEqual('/sportsbooks');
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test('render item ', async () => {
|
|
31
|
+
const { container, getByText } = render(<Item item={menus.children[3]} />);
|
|
32
|
+
await waitFor(() => {
|
|
33
|
+
expect(container).toBeTruthy();
|
|
34
|
+
expect(container.querySelectorAll('a')).toHaveLength(1);
|
|
35
|
+
expect(getByText('Sportsbooks').getAttribute('href')).toEqual('/sportsbooks');
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
afterEach(() => {
|
|
40
|
+
cleanup();
|
|
41
|
+
});
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
/* eslint-disable camelcase */
|
|
2
2
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
3
|
-
import React, { useState } from 'react';
|
|
3
|
+
import React, { useState, useContext } from 'react';
|
|
4
4
|
import parse from 'html-react-parser';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
|
|
7
7
|
import { parseCss } from 'gatsby-core-theme/src/helpers/css-parser';
|
|
8
8
|
import loadable from '@loadable/component';
|
|
9
9
|
import { parseContentImageUrl } from 'gatsby-core-theme/src/helpers/strings';
|
|
10
|
+
import { generatePlaceholderString } from '../../../helpers/generators';
|
|
11
|
+
import { Context } from '~context/MainProvider';
|
|
10
12
|
import styles from './content.module.scss';
|
|
11
13
|
|
|
12
|
-
const Content = ({ module, isHomepageFirstModule = false, isModuleIntroduction = '' }) => {
|
|
14
|
+
const Content = ({ module, isHomepageFirstModule = false, isModuleIntroduction = '', page }) => {
|
|
13
15
|
const { show_more_label, show_more_enabled } = module || {};
|
|
16
|
+
const { translations } = useContext(Context) || {};
|
|
14
17
|
const [showMore, setShowMore] = useState(show_more_enabled === '1');
|
|
15
18
|
|
|
16
19
|
const replaceMedia = (node) => {
|
|
@@ -54,6 +57,15 @@ const Content = ({ module, isHomepageFirstModule = false, isModuleIntroduction =
|
|
|
54
57
|
}
|
|
55
58
|
}
|
|
56
59
|
|
|
60
|
+
if (node.name === 'h1' || node.name === 'h2' || node.name === 'h3') {
|
|
61
|
+
const data = {
|
|
62
|
+
siteName: page?.siteInfo?.site_name,
|
|
63
|
+
pageTitle: page?.title,
|
|
64
|
+
name: page?.relation?.name,
|
|
65
|
+
};
|
|
66
|
+
node.children[0].data = generatePlaceholderString(node.children[0].data, translations, data);
|
|
67
|
+
}
|
|
68
|
+
|
|
57
69
|
return null;
|
|
58
70
|
};
|
|
59
71
|
const switchStyle = (style) => {
|
|
@@ -115,6 +127,7 @@ Content.propTypes = {
|
|
|
115
127
|
style: PropTypes.string,
|
|
116
128
|
show_more_content: PropTypes.string,
|
|
117
129
|
}),
|
|
130
|
+
page: PropTypes.shape({}),
|
|
118
131
|
isHomepageFirstModule: PropTypes.bool,
|
|
119
132
|
isModuleIntroduction: PropTypes.string,
|
|
120
133
|
// eslint-disable-next-line react/forbid-prop-types
|
|
@@ -7,7 +7,6 @@ import loadable from '@loadable/component';
|
|
|
7
7
|
import styles from './module.module.scss';
|
|
8
8
|
import ModuleTitle from '~atoms/module-title';
|
|
9
9
|
import { anchorLink, removeSymbols } from '~helpers/strings';
|
|
10
|
-
import { prettyTracker } from '~helpers/getters';
|
|
11
10
|
|
|
12
11
|
const Modules = ({ module, page, pageContext }) => {
|
|
13
12
|
const GetModuleComponent = (moduleItem) => {
|
|
@@ -61,6 +60,7 @@ const Modules = ({ module, page, pageContext }) => {
|
|
|
61
60
|
|
|
62
61
|
const ModuleComponent = GetModuleComponent(module);
|
|
63
62
|
|
|
63
|
+
// eslint-disable-next-line no-nested-ternary
|
|
64
64
|
const anchorLabel = module.anchor_label
|
|
65
65
|
? removeSymbols(anchorLink(module.anchor_label))
|
|
66
66
|
: module.name === 'archive'
|
|
@@ -73,7 +73,6 @@ const Modules = ({ module, page, pageContext }) => {
|
|
|
73
73
|
operator: module?.value,
|
|
74
74
|
logo: module?.value?.logo_url,
|
|
75
75
|
hasLink: true,
|
|
76
|
-
prettyLink: prettyTracker(module?.value, 'main', false, page.template),
|
|
77
76
|
}
|
|
78
77
|
: {
|
|
79
78
|
anchorLabel,
|
|
@@ -19,8 +19,15 @@ export default function OperatorBanner({
|
|
|
19
19
|
sticky = false,
|
|
20
20
|
stickyOffset = 0,
|
|
21
21
|
pageTemplate,
|
|
22
|
+
module,
|
|
22
23
|
}) {
|
|
23
|
-
const prettyLink = prettyTracker(
|
|
24
|
+
const prettyLink = prettyTracker(
|
|
25
|
+
operator,
|
|
26
|
+
module?.tracking_link_name || 'main',
|
|
27
|
+
false,
|
|
28
|
+
pageTemplate
|
|
29
|
+
);
|
|
30
|
+
|
|
24
31
|
const [show, setShow] = useState(!sticky);
|
|
25
32
|
const [closed, setClosed] = useState(false);
|
|
26
33
|
const { cookieAccepted, setBannerActive } = useContext(Context) || {};
|
|
@@ -96,14 +103,18 @@ export default function OperatorBanner({
|
|
|
96
103
|
|
|
97
104
|
{!isPlaceholder && !sticky && (
|
|
98
105
|
<div className={styles.bonusTnc || ''}>
|
|
99
|
-
<Bonus item={operator} tracker=
|
|
106
|
+
<Bonus item={operator} tracker={module?.type || 'main'} />
|
|
100
107
|
{operator?.extra_fields?.terms_and_conditions_text_enabled === '1' && (
|
|
101
108
|
<Tnc hasCollapse={false} operator={operator} />
|
|
102
109
|
)}
|
|
103
110
|
</div>
|
|
104
111
|
)}
|
|
105
|
-
{sticky && <Bonus item={operator} tracker=
|
|
106
|
-
<OperatorCta
|
|
112
|
+
{sticky && <Bonus item={operator} tracker={module?.type || 'main'} />}
|
|
113
|
+
<OperatorCta
|
|
114
|
+
operator={operator}
|
|
115
|
+
pageTemplate={pageTemplate}
|
|
116
|
+
tracker={module?.tracking_link_name || 'main'}
|
|
117
|
+
/>
|
|
107
118
|
{sticky && operator?.extra_fields?.terms_and_conditions_text_enabled === '1' && (
|
|
108
119
|
<Tnc hasCollapse={false} operator={operator} />
|
|
109
120
|
)}
|
|
@@ -137,4 +148,8 @@ OperatorBanner.propTypes = {
|
|
|
137
148
|
sticky: PropTypes.bool,
|
|
138
149
|
stickyOffset: PropTypes.number,
|
|
139
150
|
pageTemplate: PropTypes.string,
|
|
151
|
+
module: PropTypes.shape({
|
|
152
|
+
tracking_link_name: PropTypes.string,
|
|
153
|
+
type: PropTypes.string,
|
|
154
|
+
}),
|
|
140
155
|
};
|
|
@@ -38,6 +38,7 @@ function setName(string) {
|
|
|
38
38
|
|
|
39
39
|
const HeadData = ({ page = {}, siteInfo }) => {
|
|
40
40
|
const pageImage = getPageImage(page) ? getPageImage(page) : imagePrettyUrl(siteInfo?.site_logo);
|
|
41
|
+
|
|
41
42
|
// When google re-indexes dev NSA and IRL, remove lines 28, 41, 42, 43 and process.env.GATSBY_ACTIVE_ENV !== 'development' from lines 24, 25, 27, 29, 43
|
|
42
43
|
return (
|
|
43
44
|
<>
|
|
@@ -54,6 +55,9 @@ const HeadData = ({ page = {}, siteInfo }) => {
|
|
|
54
55
|
<meta name="googlebot" content="noindex,follow" />
|
|
55
56
|
)}
|
|
56
57
|
<link rel="canonical" href={getCanonicalUrl(page)} />
|
|
58
|
+
{page?.hreflangs?.map((link) => {
|
|
59
|
+
return <link rel="alternate" href={getUrl(link.path)} hrefLang={link.language} />;
|
|
60
|
+
})}
|
|
57
61
|
{page.preconnect_links &&
|
|
58
62
|
page.preconnect_links.map((link) => <link key={keygen()} rel="preconnect" href={link} />)}
|
|
59
63
|
<meta name="og:title" content={page.meta_title} />
|
|
@@ -77,6 +77,7 @@ export function transform(response) {
|
|
|
77
77
|
transformed[siteMarket][pageType] = [];
|
|
78
78
|
Object.keys(response.pages[language][pageType]).forEach((pagePath) => {
|
|
79
79
|
const page = response.pages[language][pageType][pagePath][siteMarket];
|
|
80
|
+
|
|
80
81
|
if (response.site_markets[siteMarket].path_prefix && page) {
|
|
81
82
|
// set page prefix for multiple markets
|
|
82
83
|
page.path = `${response.site_markets[siteMarket].path_prefix}${
|
|
@@ -445,6 +446,27 @@ export default {
|
|
|
445
446
|
if (transformedPages[market]) {
|
|
446
447
|
Object.keys(transformedPages[market]).forEach((pageType) => {
|
|
447
448
|
transformedPages[market][pageType].forEach((page, index) => {
|
|
449
|
+
// Href Lang
|
|
450
|
+
let hreflangs = page.page_group_id ? data.page_groups[page.page_group_id] : null;
|
|
451
|
+
if (page.page_custom_hreflangs) {
|
|
452
|
+
hreflangs = hreflangs
|
|
453
|
+
? [...hreflangs, ...page.page_custom_hreflangs]
|
|
454
|
+
: page.page_custom_hreflangs;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
hreflangs &&
|
|
458
|
+
hreflangs.forEach((href, i) => {
|
|
459
|
+
const pagePathPrefix =
|
|
460
|
+
pagesMappedById[href.page_id] &&
|
|
461
|
+
data.site_markets[pagesMappedById[href.page_id].market].path_prefix;
|
|
462
|
+
|
|
463
|
+
if (pagePathPrefix) {
|
|
464
|
+
hreflangs[i].path = `${pagePathPrefix}/${href.path}`;
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
page.hreflangs = hreflangs;
|
|
469
|
+
|
|
448
470
|
if (page.sections) {
|
|
449
471
|
// pre NSA launch dirty loop to add prefilled modules as normal modules (as actual value)
|
|
450
472
|
Object.keys(page.sections).forEach((sectionKey) => {
|