gatsby-core-theme 39.0.0 → 39.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 +29 -0
- package/gatsby-node.mjs +14 -9
- package/package.json +1 -2
- package/src/components/app.js +17 -17
- package/src/components/atoms/button/operator-cta.js +4 -12
- package/src/components/atoms/pretty-link/index.js +23 -12
- package/src/components/atoms/pretty-link/pretty-link.test.js +16 -1
- package/src/components/molecules/bonus/template-one/bonus.module.scss +63 -47
- package/src/components/molecules/menu/index.js +1 -1
- package/src/helpers/getters.mjs +16 -3
- package/src/helpers/getters.test.js +13 -8
- package/src/helpers/strings.js +0 -8
- package/src/helpers/strings.test.js +16 -0
- package/src/helpers/tracker.mjs +8 -0
- package/src/helpers/tracker.test.js +40 -1
- package/src/styles/globals.scss +1 -1
- package/gastby-ssr.js +0 -0
- package/src/pages/ar/404.js +0 -16
- package/src/pages/argentina/404/index.js +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
## [39.0.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v39.0.1...v39.0.2) (2024-09-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* 404 pages ([a2ff967](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a2ff967edf283c7e498e26ea573df75a5b4b2b0f))
|
|
7
|
+
* 404pages for multi market ([4943f82](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4943f82023d162be9045b5bfa4f2ad4f7c0801af))
|
|
8
|
+
* conflict ([7432eac](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7432eac495c761006883894549513b789b2ff759))
|
|
9
|
+
* general styling ([2f28985](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2f289859c3a24167140973ae31cb1b84e478c50a))
|
|
10
|
+
* general styling ([b453746](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b453746f73406ebdc5389eccfa0476f34be2a68b))
|
|
11
|
+
* removed cursor pointer from unclickable divs ([a458d7e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a458d7e5d61b033d630fa8952243bf38259fed99))
|
|
12
|
+
* removed links from operators without tracking links ([ec4b0c3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ec4b0c37f0fbcda51938344cda6e1ef3741a86d8))
|
|
13
|
+
* removed market 404 ([9530231](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/95302317d39872107a00e97fcbc319d300462173))
|
|
14
|
+
* tests ([63f620c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/63f620ca959166c3e6f30b99413e6cb4fc7d46bf))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
* Merge branch 'tm-4127-404-fixes' into 'master' ([99b4e1f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/99b4e1f653d85ff3c8a4246797aec8173e3f0384))
|
|
18
|
+
* Merge branch 'tm-4723-pretty-links' into 'master' ([d4a439f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d4a439fcf911b6e2ebb71f9e80142b6eb42badcb))
|
|
19
|
+
|
|
20
|
+
## [39.0.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v39.0.0...v39.0.1) (2024-09-04)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* fix small issues ([ef8c942](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ef8c9427c466f5307ced6a291582ed1f05f5887b))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
* Merge branch 'addValidation' into 'master' ([fed31fe](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/fed31fe535f2ac7929b03e5f43c88c606741da7a))
|
|
29
|
+
|
|
1
30
|
# [39.0.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v38.0.4...v39.0.0) (2024-09-03)
|
|
2
31
|
|
|
3
32
|
|
package/gatsby-node.mjs
CHANGED
|
@@ -14,9 +14,9 @@ import { getData, getLocalData, getTranslations, getSiteSettings } from './src/h
|
|
|
14
14
|
|
|
15
15
|
import { generateTrackerLink } from './src/helpers/generators.mjs';
|
|
16
16
|
import processor, { processSitemapPages } from './src/helpers/processor/index.mjs';
|
|
17
|
-
import {
|
|
17
|
+
import { pickTrackerOperatorKeys } from './src/constants/pick-keys.mjs';
|
|
18
18
|
import settings from './src/constants/settings.mjs';
|
|
19
|
-
import { translate } from './src/helpers/getters.mjs';
|
|
19
|
+
import { translate, is404Page } from './src/helpers/getters.mjs';
|
|
20
20
|
import { clean } from './src/helpers/processor/common.mjs';
|
|
21
21
|
import { sanitizeOperatorData } from './src/helpers/processor/operators.mjs';
|
|
22
22
|
|
|
@@ -39,6 +39,7 @@ let authors = null;
|
|
|
39
39
|
let translationsData = null;
|
|
40
40
|
let siteSettingsData = null;
|
|
41
41
|
let allMarketsData = null;
|
|
42
|
+
let allMarketPrefixes = [];
|
|
42
43
|
let allMarketSectionsData = null;
|
|
43
44
|
let schemaData = null;
|
|
44
45
|
let templatesData = null;
|
|
@@ -397,26 +398,27 @@ export const createPages = async ({ actions: { createPage } }, themeOptions) =>
|
|
|
397
398
|
|
|
398
399
|
};
|
|
399
400
|
|
|
400
|
-
export const onCreatePage = ({ page, actions }) => {
|
|
401
|
+
export const onCreatePage = async ({ page, actions }) => {
|
|
401
402
|
const { createPage, deletePage } = actions;
|
|
402
|
-
|
|
403
|
+
|
|
404
|
+
if (is404Page(allMarketPrefixes, page.path)) {
|
|
403
405
|
const oldPage = { ...page };
|
|
404
406
|
const langCode = page.path.split(`/`)[1];
|
|
405
407
|
page.matchPath = `/${langCode}/*`;
|
|
406
|
-
const marketCode = Object.keys(
|
|
407
|
-
(key) =>
|
|
408
|
+
const marketCode = await Object.keys(allMarketsData).find(
|
|
409
|
+
(key) => allMarketsData[key].path_prefix === langCode
|
|
408
410
|
);
|
|
411
|
+
|
|
409
412
|
if (marketCode) {
|
|
410
413
|
// Recreate the modified page
|
|
411
414
|
deletePage(oldPage);
|
|
412
415
|
createPage({
|
|
413
416
|
...page,
|
|
414
417
|
context: {
|
|
415
|
-
...context404,
|
|
416
418
|
page: { ...context404.page, market: marketCode, language: langCode },
|
|
419
|
+
lang: langCode,
|
|
417
420
|
marketSections: allMarketSectionsData[marketCode],
|
|
418
421
|
},
|
|
419
|
-
component: `${__dirname}/src/components/app.js`,
|
|
420
422
|
});
|
|
421
423
|
} else {
|
|
422
424
|
deletePage(oldPage);
|
|
@@ -440,10 +442,13 @@ export const onPreBootstrap = async () => {
|
|
|
440
442
|
// Get Data from Hercules
|
|
441
443
|
siteSettingsData = await getSiteSettings(process.env.GATSBY_SITE_NAME);
|
|
442
444
|
allMarketsData = siteSettingsData.site_markets;
|
|
445
|
+
allMarketPrefixes = Object.keys(allMarketsData).map(
|
|
446
|
+
(key) => allMarketsData[key].path_prefix
|
|
447
|
+
).filter(item => !!item);
|
|
443
448
|
schemaData = siteSettingsData.schema;
|
|
444
449
|
templatesData = siteSettingsData.templates;
|
|
445
450
|
allMarketSectionsData = siteSettingsData.market_sections;
|
|
446
|
-
|
|
451
|
+
}
|
|
447
452
|
|
|
448
453
|
export const sourceNodes = async ({ actions, createNodeId, createContentDigest }) => {
|
|
449
454
|
const { createNode } = actions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gatsby-core-theme",
|
|
3
|
-
"version": "39.0.
|
|
3
|
+
"version": "39.0.2",
|
|
4
4
|
"description": "Gatsby Theme NPM Package",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "ISC",
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
"react": "^18.2.0",
|
|
45
45
|
"react-dom": "^18.2.0",
|
|
46
46
|
"react-google-recaptcha": "^2.1.0",
|
|
47
|
-
"react-lazyload": "^3.2.0",
|
|
48
47
|
"react-masonry-css": "^1.0.16",
|
|
49
48
|
"sass": "^1.63.6",
|
|
50
49
|
"uuid": "^9.0.1"
|
package/src/components/app.js
CHANGED
|
@@ -2,16 +2,30 @@
|
|
|
2
2
|
/* eslint-disable react/forbid-prop-types */
|
|
3
3
|
import React, { useEffect, useState } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import { graphql } from 'gatsby';
|
|
5
|
+
import { graphql, useStaticQuery } from 'gatsby';
|
|
6
6
|
import MainProvider from '~context/MainProvider';
|
|
7
7
|
import Body from '~pages/body';
|
|
8
8
|
import HeadData from '~organisms/head';
|
|
9
9
|
|
|
10
|
-
const App = ({ pageContext
|
|
10
|
+
const App = ({ pageContext }) => {
|
|
11
11
|
const { isPreview } = pageContext;
|
|
12
12
|
const [previewContext, setPreviewContext] = useState({});
|
|
13
13
|
const [isLoading, setIsLoading] = useState({});
|
|
14
14
|
|
|
15
|
+
const data = useStaticQuery(graphql`
|
|
16
|
+
query {
|
|
17
|
+
translations: allTranslation(filter: {}) {
|
|
18
|
+
edges {
|
|
19
|
+
node {
|
|
20
|
+
key
|
|
21
|
+
language
|
|
22
|
+
value
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
`);
|
|
28
|
+
|
|
15
29
|
async function getData(searchParams, staticPath = null) {
|
|
16
30
|
const { getPreview } = await import('~helpers/api');
|
|
17
31
|
getPreview(
|
|
@@ -50,7 +64,7 @@ const App = ({ pageContext, data }) => {
|
|
|
50
64
|
}
|
|
51
65
|
|
|
52
66
|
return (
|
|
53
|
-
<MainProvider value={{ translations: data.translations, language: pageContext.page
|
|
67
|
+
<MainProvider value={{ translations: data.translations, language: pageContext.page?.language }}>
|
|
54
68
|
<div
|
|
55
69
|
dir={
|
|
56
70
|
(isPreview ? previewContext.page?.language === 'ar' : pageContext.page?.language === 'ar')
|
|
@@ -65,20 +79,6 @@ const App = ({ pageContext, data }) => {
|
|
|
65
79
|
);
|
|
66
80
|
};
|
|
67
81
|
|
|
68
|
-
export const query = graphql`
|
|
69
|
-
query ($lang: String) {
|
|
70
|
-
translations: allTranslation(filter: {language: {eq: $lang}}) {
|
|
71
|
-
edges {
|
|
72
|
-
node {
|
|
73
|
-
key
|
|
74
|
-
language
|
|
75
|
-
value
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
`;
|
|
81
|
-
|
|
82
82
|
export const Head = ({ pageContext }) => (
|
|
83
83
|
<HeadData page={pageContext.page} siteInfo={pageContext.siteInfo} />
|
|
84
84
|
);
|
|
@@ -6,7 +6,7 @@ import { globalHistory } from '@reach/router';
|
|
|
6
6
|
import useTranslate from '~hooks/useTranslate/useTranslate';
|
|
7
7
|
import { prettyTracker } from '~helpers/getters';
|
|
8
8
|
import { setCookie } from '~helpers/cookies';
|
|
9
|
-
import { getTrackingAPIParams } from '~helpers/tracker';
|
|
9
|
+
import { getTrackingAPIParams, trackerLinkActive } from '~helpers/tracker';
|
|
10
10
|
import keygen from '~helpers/keygen';
|
|
11
11
|
import styles from './button.module.scss';
|
|
12
12
|
|
|
@@ -61,7 +61,7 @@ const OperatorCtaButton = ({
|
|
|
61
61
|
'/'
|
|
62
62
|
);
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
if (process.env.ENABLE_PIXEL === 'true' && typeof window.fbq !== 'undefined') {
|
|
65
65
|
// Call fbq track event
|
|
66
66
|
window.fbq('track', 'InitiateCheckout', { keyID: keygen() });
|
|
67
67
|
}
|
|
@@ -71,19 +71,11 @@ const OperatorCtaButton = ({
|
|
|
71
71
|
buttonSize ? styles[`${buttonSize}_size`] : ''
|
|
72
72
|
} `;
|
|
73
73
|
|
|
74
|
-
// Note: Check if the default link is savailable otherwise hide
|
|
75
|
-
const trackerLinkActive = () => {
|
|
76
|
-
if (!operator || !operator?.links) {
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
return operator?.links?.main
|
|
80
|
-
};
|
|
81
|
-
|
|
82
74
|
return (
|
|
83
|
-
trackerLinkActive() &&
|
|
75
|
+
trackerLinkActive(operator, tracker) &&
|
|
84
76
|
(status === "active" ? (
|
|
85
77
|
<a
|
|
86
|
-
href={prettyLink || "#"}
|
|
78
|
+
href={prettyLink || "#"}
|
|
87
79
|
title={`${typeof translateBtn === "string" ? translateBtn : ""} ${
|
|
88
80
|
titleSuffix || ""
|
|
89
81
|
}`.trimEnd()}
|
|
@@ -5,7 +5,7 @@ import { globalHistory } from '@reach/router'
|
|
|
5
5
|
import { prettyTracker } from '~helpers/getters'
|
|
6
6
|
import { setCookie } from '~helpers/cookies'
|
|
7
7
|
import keygen from '~helpers/keygen'
|
|
8
|
-
import { getTrackingAPIParams } from '~helpers/tracker'
|
|
8
|
+
import { getTrackingAPIParams, trackerLinkActive } from '~helpers/tracker'
|
|
9
9
|
|
|
10
10
|
const PrettyLink = ({
|
|
11
11
|
operator,
|
|
@@ -55,17 +55,28 @@ const PrettyLink = ({
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
return (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
58
|
+
prettyLink && trackerLinkActive(operator, tracker) ? (
|
|
59
|
+
<a
|
|
60
|
+
href={prettyLink || '#'}
|
|
61
|
+
title={`${operator?.name || ''} ${titleSuffix || ''}`.trimEnd() || ''}
|
|
62
|
+
className={className}
|
|
63
|
+
target="_blank"
|
|
64
|
+
rel={rel}
|
|
65
|
+
aria-label={`${operator?.name} ${titleSuffix || 'Link'}`}
|
|
66
|
+
onClick={onCTAClick}
|
|
67
|
+
>
|
|
68
|
+
{children}
|
|
69
|
+
</a>
|
|
70
|
+
) : (
|
|
71
|
+
<div
|
|
72
|
+
title={`${operator?.name || ''} ${titleSuffix || ''}`.trimEnd() || ''}
|
|
73
|
+
className={className}
|
|
74
|
+
aria-label={`${operator?.name} ${titleSuffix || 'Link'}`}
|
|
75
|
+
>
|
|
76
|
+
{children}
|
|
77
|
+
</div>
|
|
78
|
+
)
|
|
79
|
+
|
|
69
80
|
)
|
|
70
81
|
}
|
|
71
82
|
|
|
@@ -11,6 +11,7 @@ const data = (activeStatus = 'active') => ({
|
|
|
11
11
|
status: activeStatus,
|
|
12
12
|
links: {
|
|
13
13
|
main: 'https://www.google.com',
|
|
14
|
+
testing: 'http://localhost/'
|
|
14
15
|
},
|
|
15
16
|
short_name: 'operator',
|
|
16
17
|
},
|
|
@@ -22,7 +23,7 @@ const data = (activeStatus = 'active') => ({
|
|
|
22
23
|
describe('PrettyLink Component', () => {
|
|
23
24
|
test('PrettyLink children and link', () => {
|
|
24
25
|
const { getByText, container } = render(<PrettyLink {...data()} />);
|
|
25
|
-
expect(getByText('Test children')).
|
|
26
|
+
expect(getByText('Test children').tagName.toLowerCase()).toBe('h1');
|
|
26
27
|
expect(container.querySelector('a').getAttribute('href')).toEqual('/no/visit/operator');
|
|
27
28
|
});
|
|
28
29
|
|
|
@@ -46,6 +47,20 @@ describe('PrettyLink Component', () => {
|
|
|
46
47
|
expect(affObject.clicked_element).toEqual('cta');
|
|
47
48
|
});
|
|
48
49
|
|
|
50
|
+
test('Invalid or Empty tracker link', () => {
|
|
51
|
+
const { getByText } = render(
|
|
52
|
+
<PrettyLink
|
|
53
|
+
{...data()}
|
|
54
|
+
pageTemplate="test"
|
|
55
|
+
module="test2"
|
|
56
|
+
tracker="invalid"
|
|
57
|
+
clickedElement="cta"
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
const element = getByText('Test children');
|
|
61
|
+
expect(element.parentElement.tagName.toLowerCase()).toBe('div');
|
|
62
|
+
});
|
|
63
|
+
|
|
49
64
|
test('Default Affiliate object in cookie', () => {
|
|
50
65
|
const { container } = render(<PrettyLink {...data()} />);
|
|
51
66
|
const button = container.querySelector('a');
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
.container {
|
|
2
2
|
@include flex-direction(column);
|
|
3
3
|
@include flex-align(center, center);
|
|
4
|
+
|
|
4
5
|
flex-flow: wrap;
|
|
5
6
|
border-radius: 1.6rem;
|
|
6
7
|
background: var(--operator-banner-backgorund, #f4f4f4);
|
|
7
8
|
padding: 1.6rem;
|
|
8
9
|
gap: 1.6rem;
|
|
10
|
+
|
|
9
11
|
@include min(tablet) {
|
|
10
12
|
padding: 1.6rem 2.4rem;
|
|
13
|
+
|
|
11
14
|
@include flex-direction(row);
|
|
12
15
|
@include flex-align(center, center);
|
|
13
16
|
}
|
|
17
|
+
|
|
14
18
|
> div {
|
|
15
19
|
width: 100%;
|
|
20
|
+
|
|
16
21
|
@include flex-direction(column);
|
|
22
|
+
|
|
17
23
|
gap: 1.6rem;
|
|
18
24
|
}
|
|
19
25
|
|
|
@@ -24,6 +30,7 @@
|
|
|
24
30
|
font-style: normal;
|
|
25
31
|
font-weight: 700;
|
|
26
32
|
line-height: 2.2rem;
|
|
33
|
+
|
|
27
34
|
@include min(tablet) {
|
|
28
35
|
min-height: 5.6rem;
|
|
29
36
|
max-width: 19.7rem;
|
|
@@ -45,13 +52,16 @@
|
|
|
45
52
|
}
|
|
46
53
|
|
|
47
54
|
.logo {
|
|
48
|
-
cursor: pointer;
|
|
49
55
|
height: 7.2rem;
|
|
56
|
+
|
|
50
57
|
@include flex-direction(row);
|
|
58
|
+
|
|
51
59
|
gap: 1.6rem;
|
|
60
|
+
|
|
52
61
|
@include min(tablet) {
|
|
53
62
|
@include flex-direction(row);
|
|
54
63
|
@include flex-align(center, center);
|
|
64
|
+
|
|
55
65
|
height: auto;
|
|
56
66
|
}
|
|
57
67
|
|
|
@@ -60,6 +70,7 @@
|
|
|
60
70
|
width: 7.2rem;
|
|
61
71
|
height: 7.2rem;
|
|
62
72
|
border-radius: 0.8rem;
|
|
73
|
+
|
|
63
74
|
@include min(tablet) {
|
|
64
75
|
min-width: 6.4rem;
|
|
65
76
|
width: 6.4rem;
|
|
@@ -68,58 +79,16 @@
|
|
|
68
79
|
}
|
|
69
80
|
}
|
|
70
81
|
|
|
71
|
-
.details {
|
|
72
|
-
@include flex-direction(column);
|
|
73
|
-
@include flex-align(flex-start, center);
|
|
74
|
-
|
|
75
|
-
@include min(tablet) {
|
|
76
|
-
display: flex;
|
|
77
|
-
flex-direction: column;
|
|
78
|
-
}
|
|
79
|
-
> span:first-of-type {
|
|
80
|
-
color: var(--operator-banner-name-color, #1b1b1c);
|
|
81
|
-
font-size: 1.6rem;
|
|
82
|
-
font-style: normal;
|
|
83
|
-
font-weight: 700;
|
|
84
|
-
line-height: 2.7rem;
|
|
85
|
-
margin-bottom: 0.8rem;
|
|
86
|
-
@include min(tablet) {
|
|
87
|
-
font-size: 1.4rem;
|
|
88
|
-
font-weight: 700;
|
|
89
|
-
line-height: 2.2rem;
|
|
90
|
-
min-width: 11rem;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
> div {
|
|
95
|
-
border-radius: 100px;
|
|
96
|
-
background: #fff;
|
|
97
|
-
border: 0px;
|
|
98
|
-
margin: 0;
|
|
99
|
-
height: 2.9rem;
|
|
100
|
-
width: 7.6rem;
|
|
101
|
-
@include flex-direction(row);
|
|
102
|
-
@include flex-align(center, center);
|
|
103
|
-
|
|
104
|
-
> span:first-of-type {
|
|
105
|
-
margin-right: 0.4rem;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
> span:last-of-type {
|
|
109
|
-
font-size: 11px;
|
|
110
|
-
margin-top: 0.2rem;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
82
|
.bonus {
|
|
116
83
|
border-radius: 0.8rem;
|
|
117
84
|
height: 100%;
|
|
118
85
|
background: var(--operator-banner-backgorund-bonus, #fff);
|
|
119
86
|
min-height: 6.4rem;
|
|
120
87
|
width: 100%;
|
|
88
|
+
|
|
121
89
|
@include flex-direction(column);
|
|
122
90
|
@include flex-align(center, center);
|
|
91
|
+
|
|
123
92
|
border: 1px solid #fff;
|
|
124
93
|
|
|
125
94
|
> div {
|
|
@@ -146,7 +115,7 @@
|
|
|
146
115
|
font-weight: 700;
|
|
147
116
|
line-height: 2.7rem;
|
|
148
117
|
padding-right: 0;
|
|
149
|
-
margin: 0.8rem 0.8rem 0
|
|
118
|
+
margin: 0.8rem 0.8rem 0;
|
|
150
119
|
}
|
|
151
120
|
|
|
152
121
|
span:last-of-type {
|
|
@@ -157,6 +126,53 @@
|
|
|
157
126
|
font-weight: 700;
|
|
158
127
|
line-height: 2.2rem;
|
|
159
128
|
padding: 0;
|
|
160
|
-
margin: 0 0.8rem 0.8rem
|
|
129
|
+
margin: 0 0.8rem 0.8rem;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.details {
|
|
134
|
+
@include flex-direction(column);
|
|
135
|
+
@include flex-align(flex-start, center);
|
|
136
|
+
|
|
137
|
+
@include min(tablet) {
|
|
138
|
+
display: flex;
|
|
139
|
+
flex-direction: column;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
> span:first-of-type {
|
|
143
|
+
color: var(--operator-banner-name-color, #1b1b1c);
|
|
144
|
+
font-size: 1.6rem;
|
|
145
|
+
font-style: normal;
|
|
146
|
+
font-weight: 700;
|
|
147
|
+
line-height: 2.7rem;
|
|
148
|
+
margin-bottom: 0.8rem;
|
|
149
|
+
|
|
150
|
+
@include min(tablet) {
|
|
151
|
+
font-size: 1.4rem;
|
|
152
|
+
font-weight: 700;
|
|
153
|
+
line-height: 2.2rem;
|
|
154
|
+
min-width: 11rem;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
> div {
|
|
159
|
+
border-radius: 100px;
|
|
160
|
+
background: #fff;
|
|
161
|
+
border: 0;
|
|
162
|
+
margin: 0;
|
|
163
|
+
height: 2.9rem;
|
|
164
|
+
width: 7.6rem;
|
|
165
|
+
|
|
166
|
+
@include flex-direction(row);
|
|
167
|
+
@include flex-align(center, center);
|
|
168
|
+
|
|
169
|
+
> span:first-of-type {
|
|
170
|
+
margin-right: 0.4rem;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
> span:last-of-type {
|
|
174
|
+
font-size: 11px;
|
|
175
|
+
margin-top: 0.2rem;
|
|
176
|
+
}
|
|
161
177
|
}
|
|
162
178
|
}
|
package/src/helpers/getters.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable no-prototype-builtins */
|
|
1
2
|
/* eslint-disable no-nested-ternary */
|
|
2
3
|
import { generateTrackerLink } from "./generators.mjs";
|
|
3
4
|
|
|
@@ -28,8 +29,8 @@ export function getExtraField(extraFields, key, defaultValue) {
|
|
|
28
29
|
export function getMarketSection(shortCode, pageContext) {
|
|
29
30
|
const marketSections = pageContext && pageContext.marketSections;
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
if (marketSections[shortCode]) {
|
|
32
|
+
// market has priority over page
|
|
33
|
+
if (marketSections && marketSections[shortCode]) {
|
|
33
34
|
return marketSections[shortCode];
|
|
34
35
|
}
|
|
35
36
|
|
|
@@ -50,7 +51,7 @@ export function getSection(shortCode, pageContext) {
|
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
// market has priority over page
|
|
53
|
-
if (marketSections[shortCode]) {
|
|
54
|
+
if (marketSections && marketSections[shortCode]) {
|
|
54
55
|
return marketSections[shortCode];
|
|
55
56
|
}
|
|
56
57
|
|
|
@@ -524,3 +525,15 @@ export function groupBy(list = {}, keyName = "author_id", single = false) {
|
|
|
524
525
|
);
|
|
525
526
|
return newObj;
|
|
526
527
|
}
|
|
528
|
+
|
|
529
|
+
export function is404Page(allMarketPrefixes, path) {
|
|
530
|
+
let is404 = false;
|
|
531
|
+
// eslint-disable-next-line array-callback-return
|
|
532
|
+
allMarketPrefixes.map((item) => {
|
|
533
|
+
const re = new RegExp(`${item}/404`, 'gi');
|
|
534
|
+
if(path.match(re)) {
|
|
535
|
+
is404 = true;
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
return is404
|
|
539
|
+
}
|
|
@@ -43,8 +43,8 @@ describe('Getters Helper', () => {
|
|
|
43
43
|
|
|
44
44
|
test('group by', () => {
|
|
45
45
|
const pagesNum = 10;
|
|
46
|
-
const
|
|
47
|
-
expect(Object.keys(
|
|
46
|
+
const pagesMappedByIdTest = Getters.groupBy(getPageDataList(pagesNum), 'id');
|
|
47
|
+
expect(Object.keys(pagesMappedByIdTest).length).toBe(pagesNum);
|
|
48
48
|
|
|
49
49
|
const pagesMappedByMetaTitle = Getters.groupBy(getPageDataList(pagesNum), 'meta_title');
|
|
50
50
|
expect(Object.keys(pagesMappedByMetaTitle).length).toBe(2);
|
|
@@ -96,16 +96,12 @@ describe('Getters Helper', () => {
|
|
|
96
96
|
});
|
|
97
97
|
|
|
98
98
|
test('imagePrettyUrl()', () => {
|
|
99
|
-
expect(
|
|
100
|
-
Getters.imagePrettyUrl('photo.jpg', 350, 600).includes('https://cdn.images.com')
|
|
101
|
-
).toBeTruthy();
|
|
102
99
|
expect(Getters.imagePrettyUrl('photo.jpg', 350, 600)).toEqual(
|
|
103
100
|
'https://cdn.images.com/fit-in/350x600/photo.jpg'
|
|
104
101
|
);
|
|
105
102
|
});
|
|
106
103
|
|
|
107
104
|
test('getImageExtension()', () => {
|
|
108
|
-
expect(Getters.getImageExtension('photo.jpg')).toBeTruthy();
|
|
109
105
|
expect(Getters.getImageExtension('photo.jpg')).toEqual('jpg');
|
|
110
106
|
expect(Getters.getImageExtension(null)).toEqual(null);
|
|
111
107
|
});
|
|
@@ -237,7 +233,7 @@ describe('Getters Helper', () => {
|
|
|
237
233
|
terms_and_conditions_link_enabled: true,
|
|
238
234
|
terms_and_condition_link_text: true,
|
|
239
235
|
})
|
|
240
|
-
).
|
|
236
|
+
).toBe(true);
|
|
241
237
|
expect(
|
|
242
238
|
Getters.isTandcEnabled({
|
|
243
239
|
terms_and_conditions: true,
|
|
@@ -250,7 +246,7 @@ describe('Getters Helper', () => {
|
|
|
250
246
|
terms_and_conditions_text_enabled: true,
|
|
251
247
|
terms_and_conditions: true,
|
|
252
248
|
})
|
|
253
|
-
).
|
|
249
|
+
).toBe(true)
|
|
254
250
|
});
|
|
255
251
|
|
|
256
252
|
test('getUrl()', () => {
|
|
@@ -411,4 +407,13 @@ describe('Getters Helper', () => {
|
|
|
411
407
|
secondLine: '50 free spins',
|
|
412
408
|
});
|
|
413
409
|
});
|
|
410
|
+
|
|
411
|
+
test('is404', () => {
|
|
412
|
+
expect(Getters.is404Page([ 'ar' ], 'ar/404')).toBe(true);
|
|
413
|
+
expect(Getters.is404Page([ 'ab' ], 'ar/404')).toBe(false);
|
|
414
|
+
|
|
415
|
+
expect(Getters.is404Page([ 'en', 'de', 'zh' ], '/404')).toBe(false);
|
|
416
|
+
expect(Getters.is404Page([ 'en', 'de', 'zh' ], 'zh/404')).toBe(true);
|
|
417
|
+
expect(Getters.is404Page([ ], '')).toBe(false);
|
|
418
|
+
});
|
|
414
419
|
});
|
package/src/helpers/strings.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { imagePrettyUrl } from './getters';
|
|
3
2
|
|
|
4
3
|
export function capitalize(string) {
|
|
@@ -53,13 +52,6 @@ export function parseContentImageUrl(src, width = null, height = null) {
|
|
|
53
52
|
|
|
54
53
|
export const removeSymbols = (string) => string.replace(/[!?@£#$%^&*():;"'|/.,~`]/g, '');
|
|
55
54
|
|
|
56
|
-
export function replaceWith(string, replaceThis, replacement) {
|
|
57
|
-
return string
|
|
58
|
-
.split(replaceThis)
|
|
59
|
-
.map((item) => <>{item}</>)
|
|
60
|
-
.reduce((acc, x) => (acc === null ? [x] : [acc, replacement, x]), null);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
55
|
export function deparam(paramStr) {
|
|
64
56
|
const paramArr = paramStr.split('&');
|
|
65
57
|
const paramObj = {};
|
|
@@ -28,6 +28,8 @@ describe('Strings Helper', () => {
|
|
|
28
28
|
test('truncateString()', () => {
|
|
29
29
|
expect(Strings.truncateString('hello i think', 5)).toEqual('hello...')
|
|
30
30
|
expect(Strings.truncateString('hello i think', 10)).toEqual('hello i...')
|
|
31
|
+
expect(Strings.truncateString('helloithink', 10)).toEqual('helloithin...')
|
|
32
|
+
expect(Strings.truncateString('', 10)).toEqual('')
|
|
31
33
|
})
|
|
32
34
|
|
|
33
35
|
test('cleanHTML()', () => {
|
|
@@ -42,6 +44,11 @@ describe('Strings Helper', () => {
|
|
|
42
44
|
'https://assets-srv.s3.eu-west-1.amazonaws.com/irishluck-jackpot.jpeg'
|
|
43
45
|
)
|
|
44
46
|
).toEqual('https://cdn.images.com/irishluck-jackpot.jpeg')
|
|
47
|
+
expect(
|
|
48
|
+
Strings.parseContentImageUrl(
|
|
49
|
+
'assets-srv.s3.eu-west-1.amazonaws.com'
|
|
50
|
+
)
|
|
51
|
+
).toEqual('assets-srv.s3.eu-west-1.amazonaws.com')
|
|
45
52
|
})
|
|
46
53
|
|
|
47
54
|
test('stripSuffixSlash()', () => {
|
|
@@ -53,4 +60,13 @@ describe('Strings Helper', () => {
|
|
|
53
60
|
expect(Strings.stripSuffixSlash('cas/ascasc/ascas')).toEqual('cas/ascasc/ascas')
|
|
54
61
|
expect(Strings.stripSuffixSlash('')).toEqual('')
|
|
55
62
|
})
|
|
63
|
+
|
|
64
|
+
test('deparam()', () => {
|
|
65
|
+
const pararmObj = Strings.deparam(
|
|
66
|
+
'param=test¶m2=test'
|
|
67
|
+
)
|
|
68
|
+
expect(
|
|
69
|
+
pararmObj.param
|
|
70
|
+
).toEqual('test');
|
|
71
|
+
})
|
|
56
72
|
})
|
package/src/helpers/tracker.mjs
CHANGED
|
@@ -199,3 +199,11 @@ export function isTrackerLink(link = '') {
|
|
|
199
199
|
|
|
200
200
|
return isValidTrackingLink;
|
|
201
201
|
}
|
|
202
|
+
|
|
203
|
+
// Note: Check if the default link is savailable otherwise hide
|
|
204
|
+
export function trackerLinkActive(operator, tracker = 'main') {
|
|
205
|
+
if (!operator || !operator?.links || !operator?.links[tracker]) {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
return operator?.links[tracker] || operator?.links?.main
|
|
209
|
+
};
|
|
@@ -8,9 +8,38 @@ describe('Tracker Helper', () => {
|
|
|
8
8
|
links: {
|
|
9
9
|
main: 'testing main link',
|
|
10
10
|
ppc: 'testing ppc link',
|
|
11
|
-
christmas: 'testing christmas links'
|
|
11
|
+
christmas: 'testing christmas links',
|
|
12
|
+
'PPC Fallback': 'ppc fallback link'
|
|
12
13
|
}
|
|
13
14
|
}
|
|
15
|
+
const noTrackerOperator = {
|
|
16
|
+
short_name: 'rizk',
|
|
17
|
+
type: 'sportsbook',
|
|
18
|
+
market: 'ie_en',
|
|
19
|
+
links: {}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
test('trackerLinkActive with main tracker', () => {
|
|
23
|
+
const trackerValid = Tracker.trackerLinkActive(
|
|
24
|
+
operator
|
|
25
|
+
)
|
|
26
|
+
expect(trackerValid).toEqual('testing main link')
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
test('trackerLinkActive with custom tracker', () => {
|
|
30
|
+
const trackerValid = Tracker.trackerLinkActive(
|
|
31
|
+
operator,
|
|
32
|
+
'ppc'
|
|
33
|
+
)
|
|
34
|
+
expect(trackerValid).toEqual('testing ppc link')
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
test('trackerLinkActive without tracker', () => {
|
|
38
|
+
const trackerValid = Tracker.trackerLinkActive(
|
|
39
|
+
noTrackerOperator
|
|
40
|
+
)
|
|
41
|
+
expect(trackerValid).toBeFalsy();
|
|
42
|
+
})
|
|
14
43
|
|
|
15
44
|
test('getTrackerName main/default link', () => {
|
|
16
45
|
const trackerObj = Tracker.getTrackerName(
|
|
@@ -52,6 +81,16 @@ describe('Tracker Helper', () => {
|
|
|
52
81
|
expect(trackerObj.value).toEqual('testing main link')
|
|
53
82
|
})
|
|
54
83
|
|
|
84
|
+
test('getTrackerName ppc_fallback', () => {
|
|
85
|
+
const trackerObj = Tracker.getTrackerName(
|
|
86
|
+
operator,
|
|
87
|
+
'default',
|
|
88
|
+
'/no/visit/ppc_fallback/rizk/sportsbook/ppc3'
|
|
89
|
+
)
|
|
90
|
+
expect(trackerObj.name).toEqual('main')
|
|
91
|
+
expect(trackerObj.value).toEqual('ppc fallback link')
|
|
92
|
+
})
|
|
93
|
+
|
|
55
94
|
global.fetch = jest.fn(() =>
|
|
56
95
|
Promise.resolve({
|
|
57
96
|
json: () => Promise.resolve({ success: true })
|
package/src/styles/globals.scss
CHANGED
package/gastby-ssr.js
DELETED
|
File without changes
|
package/src/pages/ar/404.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
import App from 'gatsby-core-theme/src/components/app';
|
|
5
|
-
|
|
6
|
-
const PageNotFound = ({ pageContext }) => <App pageContext={pageContext} />;
|
|
7
|
-
|
|
8
|
-
PageNotFound.propTypes = {
|
|
9
|
-
pageContext: PropTypes.shape({
|
|
10
|
-
page: PropTypes.shape({
|
|
11
|
-
path: PropTypes.string,
|
|
12
|
-
}),
|
|
13
|
-
}).isRequired,
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export default PageNotFound;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
import App from 'gatsby-core-theme/src/components/app';
|
|
5
|
-
|
|
6
|
-
const PageNotFound = ({ pageContext }) => <App pageContext={pageContext} />;
|
|
7
|
-
|
|
8
|
-
PageNotFound.propTypes = {
|
|
9
|
-
pageContext: PropTypes.shape({
|
|
10
|
-
page: PropTypes.shape({
|
|
11
|
-
path: PropTypes.string,
|
|
12
|
-
}),
|
|
13
|
-
}).isRequired,
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export default PageNotFound;
|