gatsby-core-theme 30.0.21 → 30.0.23
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 +18 -0
- package/gatsby-node.mjs +10 -2
- package/package.json +1 -1
- package/src/components/atoms/button/operator-cta.js +16 -2
- package/src/components/atoms/search/autocomplete/operator.js +1 -1
- package/src/components/molecules/bonus/template-one/index.js +5 -1
- package/src/components/molecules/bonus/template-two/index.js +5 -1
- package/src/components/molecules/bonus-box/template-three/index.js +4 -0
- package/src/components/molecules/bonus-box/template-two/index.js +3 -0
- package/src/components/molecules/toplist/default-row/index.js +4 -1
- package/src/components/organisms/toplist/index.js +2 -1
- package/src/components/organisms/toplist/list/index.js +3 -0
- package/src/components/pages/body/index.js +6 -1
- package/src/components/pages/tracker/index-ssr.js +203 -0
- package/src/components/pages/tracker/index.js +4 -2
- package/src/helpers/getters.mjs +17 -2
- package/src/helpers/tracker.mjs +23 -0
- package/src/hooks/scroll-x/index.js +20 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## [30.0.23](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v30.0.22...v30.0.23) (2023-11-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* added new tracker page for the tracking link API ([f17c62e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f17c62e15ce6a5eb227ee295872e6525254f5663))
|
|
7
|
+
* added new tracker page for the tracking link API ([5c810bc](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5c810bcf68286a73ac8e835982d7153abd7ae771))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
* Merge branch 'tm-3833-tracking-links-api' into 'master' ([870c02c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/870c02cd48756a0135304ab5022cc0843b002fe7))
|
|
11
|
+
|
|
12
|
+
## [30.0.22](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v30.0.21...v30.0.22) (2023-11-22)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* add scroll event ([eee64c4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/eee64c4f48461b246a1420749fa2bb93d7c3f0f5))
|
|
18
|
+
|
|
1
19
|
## [30.0.21](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v30.0.20...v30.0.21) (2023-11-21)
|
|
2
20
|
|
|
3
21
|
|
package/gatsby-node.mjs
CHANGED
|
@@ -283,7 +283,10 @@ export const createPages = async ({ actions: { createPage } }, themeOptions) =>
|
|
|
283
283
|
|
|
284
284
|
if (page.path === '404') {
|
|
285
285
|
context404 = contextData;
|
|
286
|
-
} else if (
|
|
286
|
+
} else if (
|
|
287
|
+
page.path ===
|
|
288
|
+
`${pathPrefix || ''}${translate(contextData.translations, 'sitemap', 'sitemap')}`
|
|
289
|
+
) {
|
|
287
290
|
createPage({
|
|
288
291
|
path: `/${page.path}`,
|
|
289
292
|
component: `${__dirname}/src/components/app.js`,
|
|
@@ -413,6 +416,11 @@ export const createPages = async ({ actions: { createPage } }, themeOptions) =>
|
|
|
413
416
|
);
|
|
414
417
|
const marketOperator = operator.market.match(/_(\w+)/)[1];
|
|
415
418
|
|
|
419
|
+
const trackerComp =
|
|
420
|
+
process.env.IS_TRACKING_SSR === 'true'
|
|
421
|
+
? `${__dirname}/src/components/pages/tracker/index-ssr.js`
|
|
422
|
+
: `${__dirname}/src/components/pages/tracker/index.js`;
|
|
423
|
+
|
|
416
424
|
tracker.forEach((trackerPath) => {
|
|
417
425
|
// Create splash page
|
|
418
426
|
if (trackerPath) {
|
|
@@ -428,7 +436,7 @@ export const createPages = async ({ actions: { createPage } }, themeOptions) =>
|
|
|
428
436
|
};
|
|
429
437
|
createPage({
|
|
430
438
|
path: trackerPath,
|
|
431
|
-
component:
|
|
439
|
+
component: trackerComp,
|
|
432
440
|
context: {
|
|
433
441
|
page: trackerPageObject,
|
|
434
442
|
siteInfo,
|
package/package.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable no-unused-expressions */
|
|
1
2
|
import React, { useContext } from 'react';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import { Context } from '~context/MainProvider';
|
|
@@ -7,10 +8,11 @@ import styles from './button.module.scss';
|
|
|
7
8
|
|
|
8
9
|
const OperatorCtaButton = ({
|
|
9
10
|
operator,
|
|
10
|
-
pageTemplate,
|
|
11
|
+
pageTemplate = null,
|
|
11
12
|
gtmClass = '',
|
|
12
13
|
buttonType = 'primary',
|
|
13
14
|
buttonSize = '',
|
|
15
|
+
module = null,
|
|
14
16
|
tracker = 'main',
|
|
15
17
|
icon = null,
|
|
16
18
|
translationsObj = {
|
|
@@ -24,7 +26,18 @@ const OperatorCtaButton = ({
|
|
|
24
26
|
const { translations } = useContext(Context) || {};
|
|
25
27
|
const status = operator?.status || '';
|
|
26
28
|
const trackerType = tracker?.toLowerCase()?.replace(' ', '_');
|
|
27
|
-
|
|
29
|
+
|
|
30
|
+
const urlParams = [];
|
|
31
|
+
|
|
32
|
+
if (process.env.IS_TRACKING_SSR === 'true') {
|
|
33
|
+
pageTemplate && urlParams.push(`template=${pageTemplate}`);
|
|
34
|
+
module && urlParams.push(`module=${module}`);
|
|
35
|
+
tracker !== 'main' && urlParams.push(`tracker_name=${tracker}`);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const prettyLink = `${prettyTracker(operator, trackerType, false, pageTemplate)}${
|
|
39
|
+
urlParams.length > 0 ? `?${urlParams.join('&')}` : ''
|
|
40
|
+
}`;
|
|
28
41
|
|
|
29
42
|
const translateBtn =
|
|
30
43
|
status && translationsObj[status]
|
|
@@ -73,6 +86,7 @@ OperatorCtaButton.propTypes = {
|
|
|
73
86
|
buttonSize: PropTypes.string,
|
|
74
87
|
buttonType: PropTypes.string,
|
|
75
88
|
tracker: PropTypes.string,
|
|
89
|
+
module: PropTypes.string,
|
|
76
90
|
translationsObj: PropTypes.shape({
|
|
77
91
|
active: PropTypes.shape({
|
|
78
92
|
translationKey: PropTypes.string,
|
|
@@ -14,7 +14,7 @@ const Operator = ({ item = {} }) => {
|
|
|
14
14
|
<div className={styles.row || ''}>
|
|
15
15
|
<LazyImage width={56} height={56} src={imagePrettyUrl(img, 56, 56)} alt={item.title} />
|
|
16
16
|
<h3>{item.title}</h3>
|
|
17
|
-
<OperatorCta operator={relation} gtmClass="toplist-operator-cta-gtm" />
|
|
17
|
+
<OperatorCta module="search" operator={relation} gtmClass="toplist-operator-cta-gtm" />
|
|
18
18
|
</div>
|
|
19
19
|
);
|
|
20
20
|
};
|
|
@@ -13,7 +13,9 @@ import styles from './bonus.module.scss';
|
|
|
13
13
|
export default function Bonus({
|
|
14
14
|
operator,
|
|
15
15
|
pageTemplate,
|
|
16
|
-
module
|
|
16
|
+
module = {
|
|
17
|
+
name: 'bonus',
|
|
18
|
+
},
|
|
17
19
|
tncEnable = true,
|
|
18
20
|
tncFixed = false,
|
|
19
21
|
}) {
|
|
@@ -60,6 +62,7 @@ export default function Bonus({
|
|
|
60
62
|
operator={operator}
|
|
61
63
|
pageTemplate={pageTemplate}
|
|
62
64
|
tracker={module?.tracking_link_name || 'main'}
|
|
65
|
+
module={module.name}
|
|
63
66
|
icon={<FaArrowRight fontSize={20} title="Right-pointing Arrow Icon" />}
|
|
64
67
|
/>
|
|
65
68
|
{showTncFixed && <Tnc hasCollapse={false} operator={operator} />}
|
|
@@ -90,5 +93,6 @@ Bonus.propTypes = {
|
|
|
90
93
|
module: PropTypes.shape({
|
|
91
94
|
tracking_link_name: PropTypes.string,
|
|
92
95
|
type: PropTypes.string,
|
|
96
|
+
name: PropTypes.string,
|
|
93
97
|
}),
|
|
94
98
|
};
|
|
@@ -17,7 +17,9 @@ export default function TemplateOne({
|
|
|
17
17
|
operator,
|
|
18
18
|
stickyOffset = 0,
|
|
19
19
|
pageTemplate,
|
|
20
|
-
module
|
|
20
|
+
module = {
|
|
21
|
+
name: 'bonus',
|
|
22
|
+
},
|
|
21
23
|
tncEnable = true,
|
|
22
24
|
tncFixed = false,
|
|
23
25
|
showOnLoad = false,
|
|
@@ -103,6 +105,7 @@ export default function TemplateOne({
|
|
|
103
105
|
|
|
104
106
|
<OperatorCta
|
|
105
107
|
operator={operator}
|
|
108
|
+
module={module.name}
|
|
106
109
|
pageTemplate={pageTemplate}
|
|
107
110
|
tracker={module?.tracking_link_name || 'main'}
|
|
108
111
|
icon={<FaArrowRight fontSize={20} title="Right-pointing Arrow Icon" />}
|
|
@@ -148,5 +151,6 @@ TemplateOne.propTypes = {
|
|
|
148
151
|
module: PropTypes.shape({
|
|
149
152
|
tracking_link_name: PropTypes.string,
|
|
150
153
|
type: PropTypes.string,
|
|
154
|
+
name: PropTypes.string,
|
|
151
155
|
}),
|
|
152
156
|
};
|
|
@@ -18,6 +18,7 @@ export default function BonusBox({
|
|
|
18
18
|
splitBy = '+',
|
|
19
19
|
feSeparator = '+',
|
|
20
20
|
buttonType = 'primary',
|
|
21
|
+
module = null,
|
|
21
22
|
}) {
|
|
22
23
|
const { translations } = useContext(Context) || {};
|
|
23
24
|
const welcomeBonusTranslation = translate(translations, 'welcome_bonus', 'Welcome Bonus');
|
|
@@ -53,6 +54,7 @@ export default function BonusBox({
|
|
|
53
54
|
operator={item}
|
|
54
55
|
icon={<FaArrowRight title="Right-pointing Arrow Icon" />}
|
|
55
56
|
buttonType={buttonType}
|
|
57
|
+
module={module}
|
|
56
58
|
/>
|
|
57
59
|
)}
|
|
58
60
|
</>
|
|
@@ -64,6 +66,7 @@ export default function BonusBox({
|
|
|
64
66
|
operator={item}
|
|
65
67
|
icon={<FaArrowRight title="Right-pointing Arrow Icon" />}
|
|
66
68
|
buttonType={buttonType}
|
|
69
|
+
module={module}
|
|
67
70
|
/>
|
|
68
71
|
)}
|
|
69
72
|
{showVariablesComponent && variableInsideContainer && <VariableComponent item={item} />}
|
|
@@ -86,4 +89,5 @@ BonusBox.propTypes = {
|
|
|
86
89
|
feSeparator: PropTypes.string,
|
|
87
90
|
buttonType: PropTypes.string,
|
|
88
91
|
variableInsideContainer: PropTypes.bool,
|
|
92
|
+
module: PropTypes.string,
|
|
89
93
|
};
|
|
@@ -12,6 +12,7 @@ export default function BonusBox({
|
|
|
12
12
|
splitBy = '+',
|
|
13
13
|
feSeparator = '+',
|
|
14
14
|
buttonType = 'primary',
|
|
15
|
+
module = null,
|
|
15
16
|
}) {
|
|
16
17
|
const prettyLink = prettyTracker(item, tracker, false, pageTemplate);
|
|
17
18
|
const data = getBonusData(item, tracker, splitBy);
|
|
@@ -33,6 +34,7 @@ export default function BonusBox({
|
|
|
33
34
|
operator={item}
|
|
34
35
|
icon={<FaArrowRight title="Right-pointing Arrow Icon" />}
|
|
35
36
|
buttonType={buttonType}
|
|
37
|
+
module={module}
|
|
36
38
|
/>
|
|
37
39
|
</div>
|
|
38
40
|
);
|
|
@@ -45,4 +47,5 @@ BonusBox.propTypes = {
|
|
|
45
47
|
splitBy: PropTypes.string,
|
|
46
48
|
feSeparator: PropTypes.string,
|
|
47
49
|
buttonType: PropTypes.string,
|
|
50
|
+
module: PropTypes.string,
|
|
48
51
|
};
|
|
@@ -20,8 +20,9 @@ const Row = ({
|
|
|
20
20
|
itemRefs,
|
|
21
21
|
index,
|
|
22
22
|
className,
|
|
23
|
+
module,
|
|
23
24
|
}) => {
|
|
24
|
-
const prettyLink = prettyTracker(item,
|
|
25
|
+
const prettyLink = prettyTracker(item, tracker, false, pageTemplate);
|
|
25
26
|
// const itemRating = item.rating;
|
|
26
27
|
const reviewPath = item.review_link ? `/${item.review_link}` : item.path || null;
|
|
27
28
|
|
|
@@ -79,6 +80,7 @@ const Row = ({
|
|
|
79
80
|
tracker={tracker}
|
|
80
81
|
gtmClass="toplist-operator-cta-gtm"
|
|
81
82
|
pageTemplate={pageTemplate}
|
|
83
|
+
module={module}
|
|
82
84
|
/>
|
|
83
85
|
</li>
|
|
84
86
|
);
|
|
@@ -88,6 +90,7 @@ Row.propTypes = {
|
|
|
88
90
|
oneliner: PropTypes.string,
|
|
89
91
|
layout: PropTypes.string,
|
|
90
92
|
tracker: PropTypes.string,
|
|
93
|
+
module: PropTypes.string,
|
|
91
94
|
item: PropTypes.shape({
|
|
92
95
|
name: PropTypes.string,
|
|
93
96
|
ribbons: PropTypes.arrayOf(PropTypes.string),
|
|
@@ -20,6 +20,7 @@ const TopList = ({ module, toplistHeading, page }) => {
|
|
|
20
20
|
initItemsCount={toplist.num_items_initial_load}
|
|
21
21
|
loadItemsCount={toplist.num_items_load_more}
|
|
22
22
|
pageTemplate={page?.template}
|
|
23
|
+
module={module.name}
|
|
23
24
|
/>
|
|
24
25
|
</div>
|
|
25
26
|
));
|
|
@@ -35,7 +36,7 @@ const TopList = ({ module, toplistHeading, page }) => {
|
|
|
35
36
|
|
|
36
37
|
TopList.propTypes = {
|
|
37
38
|
// eslint-disable-next-line react/forbid-prop-types
|
|
38
|
-
module: PropTypes.shape({ items: PropTypes.arrayOf(PropTypes.object) }),
|
|
39
|
+
module: PropTypes.shape({ name: PropTypes.string, items: PropTypes.arrayOf(PropTypes.object) }),
|
|
39
40
|
toplistHeading: PropTypes.element,
|
|
40
41
|
page: PropTypes.shape({ template: PropTypes.string }),
|
|
41
42
|
};
|
|
@@ -12,6 +12,7 @@ export default function List({
|
|
|
12
12
|
initItemsCount,
|
|
13
13
|
loadItemsCount,
|
|
14
14
|
pageTemplate,
|
|
15
|
+
module,
|
|
15
16
|
}) {
|
|
16
17
|
const initLoadItems = Number(initItemsCount) !== 0 ? Number(initItemsCount) : 10000;
|
|
17
18
|
const loadingItems = Number(loadItemsCount) !== 0 ? Number(loadItemsCount) : 10000;
|
|
@@ -47,6 +48,7 @@ export default function List({
|
|
|
47
48
|
itemRefs={elRefs}
|
|
48
49
|
oneliner={toplist.one_liner}
|
|
49
50
|
index={index}
|
|
51
|
+
module={module}
|
|
50
52
|
/>
|
|
51
53
|
))}
|
|
52
54
|
</ul>
|
|
@@ -78,4 +80,5 @@ List.propTypes = {
|
|
|
78
80
|
initItemsCount: PropTypes.string,
|
|
79
81
|
loadItemsCount: PropTypes.string,
|
|
80
82
|
pageTemplate: PropTypes.string,
|
|
83
|
+
module: PropTypes.string,
|
|
81
84
|
};
|
|
@@ -70,7 +70,12 @@ function Body({ pageContext, children, hideOperatorBanner, serverData }) {
|
|
|
70
70
|
<Main serverData={serverData} section={main} pageContext={pageContext} />
|
|
71
71
|
)}
|
|
72
72
|
{OperatorBanner && (
|
|
73
|
-
<OperatorBanner
|
|
73
|
+
<OperatorBanner
|
|
74
|
+
pageTemplate={template}
|
|
75
|
+
module={{ name: 'operator_banner', tracking_link_name: 'main' }}
|
|
76
|
+
floating
|
|
77
|
+
operator={pageContext.page.relation}
|
|
78
|
+
/>
|
|
74
79
|
)}
|
|
75
80
|
{children && <main>{children}</main>}
|
|
76
81
|
<ScrollToTop />
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Button from '~atoms/button/button';
|
|
4
|
+
import LazyImage from '~hooks/lazy-image';
|
|
5
|
+
import { imagePrettyUrl, getAltText, translate, stripTrailingSlash } from '~helpers/getters';
|
|
6
|
+
import { generateTrackerLink } from '~helpers/generators';
|
|
7
|
+
import styles from './tracker.module.scss';
|
|
8
|
+
import { getAffiliateLink } from '~helpers/tracker';
|
|
9
|
+
|
|
10
|
+
const Tracker = ({
|
|
11
|
+
pageContext,
|
|
12
|
+
path,
|
|
13
|
+
mainText = 'One sec, while we load [operator_name] for you..',
|
|
14
|
+
redirectText = 'If the casino has not loaded within a few seconds',
|
|
15
|
+
btnText = 'Click Here!',
|
|
16
|
+
bgImage = '',
|
|
17
|
+
bgVideo = '',
|
|
18
|
+
redirectTimer = 5000,
|
|
19
|
+
logo = '../../../../../images/logo.svg',
|
|
20
|
+
counter = false,
|
|
21
|
+
isStory = false,
|
|
22
|
+
operatorLogo = false,
|
|
23
|
+
operatorLogoWidth = '80',
|
|
24
|
+
operatorLogoHeight = '80',
|
|
25
|
+
serverData,
|
|
26
|
+
}) => {
|
|
27
|
+
const { operator, page } = pageContext;
|
|
28
|
+
const translations = page?.translations;
|
|
29
|
+
const trackerLinks = operator ? Object.keys(operator.links) : [];
|
|
30
|
+
|
|
31
|
+
let tracker = '';
|
|
32
|
+
for (let i = 0; i < trackerLinks.length; i += 1) {
|
|
33
|
+
const trackerLink = trackerLinks[i].toLowerCase().replace(' ', '_');
|
|
34
|
+
if (
|
|
35
|
+
generateTrackerLink(operator, trackerLink, false, page.template) === stripTrailingSlash(path)
|
|
36
|
+
) {
|
|
37
|
+
tracker =
|
|
38
|
+
operator.links[
|
|
39
|
+
Object.keys(operator.links).find((key) => key.toLowerCase() === trackerLink.toLowerCase())
|
|
40
|
+
];
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
if (path.includes('ppc_fallback')) {
|
|
44
|
+
// eslint-disable-next-line react/prop-types
|
|
45
|
+
tracker = operator.links['PPC Fallback'];
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
tracker = operator.links.main;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const showSplashScreen = typeof window !== 'undefined';
|
|
52
|
+
|
|
53
|
+
function redirect() {
|
|
54
|
+
if (typeof window !== 'undefined' && !isStory) {
|
|
55
|
+
if (serverData.success && serverData.result.link) {
|
|
56
|
+
console.log('FROM API');
|
|
57
|
+
window.location.replace(serverData.result.link);
|
|
58
|
+
} else {
|
|
59
|
+
console.log('FROM LOCAL');
|
|
60
|
+
window.location.replace(tracker);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function manualRedirect(e) {
|
|
66
|
+
if (!isStory) {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
redirect();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* eslint consistent-return: 0 */
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
window.loadGTM = false;
|
|
75
|
+
if (!isStory) {
|
|
76
|
+
const timer = setTimeout(() => redirect(), redirectTimer);
|
|
77
|
+
|
|
78
|
+
return () => {
|
|
79
|
+
clearTimeout(timer);
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
let background = <></>;
|
|
85
|
+
if (bgVideo) {
|
|
86
|
+
background = (
|
|
87
|
+
<video muted autoPlay loop className={styles.background} poster={bgImage && bgImage}>
|
|
88
|
+
<source src={bgVideo} type="video/webm" />
|
|
89
|
+
</video>
|
|
90
|
+
);
|
|
91
|
+
} else if (bgImage) {
|
|
92
|
+
background = <LazyImage className={styles.background} src={bgImage} alt="background image" />;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const imageObject = operator?.standardised_logo_url_object || operator?.logo_url_object;
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<>
|
|
99
|
+
{showSplashScreen && (
|
|
100
|
+
<>
|
|
101
|
+
<div className={styles.container || ''}>
|
|
102
|
+
{background}
|
|
103
|
+
<div className={styles.content || ''}>
|
|
104
|
+
<LazyImage alt="Site logo" src={logo} />
|
|
105
|
+
<p
|
|
106
|
+
className={`${styles.mainText || ''} ${
|
|
107
|
+
operatorLogo && (styles.mainTextWithlogo || '')
|
|
108
|
+
}`}
|
|
109
|
+
>{`${translate(translations, 'splash_screen_main_text', mainText).replace(
|
|
110
|
+
'[operator_name]',
|
|
111
|
+
operator?.bonus?.operator_name || operator.name
|
|
112
|
+
)}`}</p>
|
|
113
|
+
{operatorLogo && (
|
|
114
|
+
<LazyImage
|
|
115
|
+
src={imagePrettyUrl(
|
|
116
|
+
imageObject?.filename || operator?.logo_url,
|
|
117
|
+
operatorLogoWidth,
|
|
118
|
+
operatorLogoHeight
|
|
119
|
+
)}
|
|
120
|
+
alt={getAltText(imageObject, operator.name)}
|
|
121
|
+
loading="eager"
|
|
122
|
+
width={operatorLogoWidth}
|
|
123
|
+
height={operatorLogoHeight}
|
|
124
|
+
className={styles.operatorlogo || ''}
|
|
125
|
+
/>
|
|
126
|
+
)}
|
|
127
|
+
<div className={styles.bar || ''} />
|
|
128
|
+
{counter ? (
|
|
129
|
+
redirectText
|
|
130
|
+
) : (
|
|
131
|
+
<div
|
|
132
|
+
className={styles.redirectText || ''}
|
|
133
|
+
// eslint-disable-next-line react/no-danger
|
|
134
|
+
dangerouslySetInnerHTML={{
|
|
135
|
+
__html: translate(translations, 'splash_screen_redirect_text', redirectText),
|
|
136
|
+
}}
|
|
137
|
+
/>
|
|
138
|
+
)}
|
|
139
|
+
<Button
|
|
140
|
+
onClick={(e) => manualRedirect(e)}
|
|
141
|
+
btnText={translate(translations, 'splash_screen_button', btnText)}
|
|
142
|
+
targetBlank={false}
|
|
143
|
+
isInternalLink={false}
|
|
144
|
+
gtmClass="tracker-gtm btn-cta"
|
|
145
|
+
/>
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
148
|
+
</>
|
|
149
|
+
)}
|
|
150
|
+
</>
|
|
151
|
+
);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
Tracker.propTypes = {
|
|
155
|
+
redirectText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
156
|
+
mainText: PropTypes.string,
|
|
157
|
+
btnText: PropTypes.string,
|
|
158
|
+
bgImage: PropTypes.string,
|
|
159
|
+
bgVideo: PropTypes.string,
|
|
160
|
+
path: PropTypes.string,
|
|
161
|
+
logo: PropTypes.string,
|
|
162
|
+
counter: PropTypes.bool,
|
|
163
|
+
redirectTimer: PropTypes.number,
|
|
164
|
+
isStory: PropTypes.bool,
|
|
165
|
+
operatorLogo: PropTypes.bool,
|
|
166
|
+
operatorLogoWidth: PropTypes.string,
|
|
167
|
+
operatorLogoHeight: PropTypes.string,
|
|
168
|
+
pageContext: PropTypes.shape({
|
|
169
|
+
operator: PropTypes.shape({
|
|
170
|
+
bonus: PropTypes.shape({
|
|
171
|
+
operator_name: PropTypes.string,
|
|
172
|
+
}),
|
|
173
|
+
name: PropTypes.string,
|
|
174
|
+
standardised_logo_url_object: PropTypes.shape({}),
|
|
175
|
+
logo_url_object: PropTypes.shape({}),
|
|
176
|
+
logo_url: PropTypes.string,
|
|
177
|
+
links: PropTypes.shape({
|
|
178
|
+
main: PropTypes.string,
|
|
179
|
+
terms_and_conditions: PropTypes.string,
|
|
180
|
+
}),
|
|
181
|
+
}).isRequired,
|
|
182
|
+
page: PropTypes.shape({
|
|
183
|
+
template: PropTypes.string,
|
|
184
|
+
translations: PropTypes.shape({}),
|
|
185
|
+
}),
|
|
186
|
+
}),
|
|
187
|
+
serverData: PropTypes.shape({
|
|
188
|
+
success: PropTypes.bool,
|
|
189
|
+
result: PropTypes.shape({
|
|
190
|
+
link: PropTypes.string,
|
|
191
|
+
}),
|
|
192
|
+
}),
|
|
193
|
+
styles: PropTypes.shape({}),
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export async function getServerData({ pageContext, url }) {
|
|
197
|
+
let res = '';
|
|
198
|
+
|
|
199
|
+
res = await getAffiliateLink(pageContext.operator, url);
|
|
200
|
+
return res;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export default Tracker;
|
|
@@ -2,7 +2,7 @@ import React, { useEffect } from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import Button from '~atoms/button/button';
|
|
4
4
|
import LazyImage from '~hooks/lazy-image';
|
|
5
|
-
import {
|
|
5
|
+
import { stripTrailingSlash, imagePrettyUrl, getAltText, translate } from '~helpers/getters';
|
|
6
6
|
import { generateTrackerLink } from '~helpers/generators';
|
|
7
7
|
import styles from './tracker.module.scss';
|
|
8
8
|
|
|
@@ -30,7 +30,9 @@ const Tracker = ({
|
|
|
30
30
|
for (let i = 0; i < trackerLinks.length; i += 1) {
|
|
31
31
|
const trackerLink = trackerLinks[i].toLowerCase().replace(' ', '_');
|
|
32
32
|
|
|
33
|
-
if (
|
|
33
|
+
if (
|
|
34
|
+
generateTrackerLink(operator, trackerLink, false, page.template) === stripTrailingSlash(path)
|
|
35
|
+
) {
|
|
34
36
|
tracker =
|
|
35
37
|
operator.links[
|
|
36
38
|
Object.keys(operator.links).find((key) => key.toLowerCase() === trackerLink.toLowerCase())
|
package/src/helpers/getters.mjs
CHANGED
|
@@ -169,6 +169,19 @@ export function getPageImage(page) {
|
|
|
169
169
|
return null;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
export function getParameterCaseInsensitive(object, key) {
|
|
173
|
+
const asLowercase = key.toLowerCase();
|
|
174
|
+
return object[Object.keys(object)
|
|
175
|
+
.find(k => k.toLowerCase() === asLowercase)
|
|
176
|
+
];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export function stripTrailingSlash(str) {
|
|
180
|
+
return str.endsWith('/') ?
|
|
181
|
+
str.slice(0, -1) :
|
|
182
|
+
str;
|
|
183
|
+
};
|
|
184
|
+
|
|
172
185
|
export function prettyTracker(
|
|
173
186
|
operator,
|
|
174
187
|
trackerType = 'main',
|
|
@@ -178,14 +191,16 @@ export function prettyTracker(
|
|
|
178
191
|
if (pageTemplateName && operator && operator.links && operator.links[pageTemplateName]) {
|
|
179
192
|
return generateTrackerLink(operator, pageTemplateName, provider);
|
|
180
193
|
}
|
|
194
|
+
|
|
181
195
|
if (!operator || !operator.short_name || (operator.status && operator.status !== 'active')) {
|
|
182
196
|
return null;
|
|
183
197
|
}
|
|
198
|
+
|
|
184
199
|
// if tracker is not main, check if the tracker exists, if not use main
|
|
185
|
-
if (trackerType !== 'main' && operator.links && operator.links
|
|
200
|
+
if (trackerType !== 'main' && operator.links && getParameterCaseInsensitive(operator.links, trackerType) === undefined) {
|
|
186
201
|
trackerType = 'main';
|
|
187
202
|
}
|
|
188
|
-
|
|
203
|
+
|
|
189
204
|
return generateTrackerLink(operator, trackerType, provider);
|
|
190
205
|
}
|
|
191
206
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* eslint-disable import/prefer-default-export */
|
|
2
|
+
export async function getAffiliateLink(operator, url) {
|
|
3
|
+
let urlParams = `site_id=${process.env.SITE_ID}&operator_short_name=${
|
|
4
|
+
operator.short_name
|
|
5
|
+
}&operator_type=${operator.type}&language=${operator.market.split('_')[1]}&market_short_code=${
|
|
6
|
+
operator.market
|
|
7
|
+
}`;
|
|
8
|
+
|
|
9
|
+
const urlSplit = url.split('?');
|
|
10
|
+
|
|
11
|
+
if (urlSplit.length === 2) {
|
|
12
|
+
urlParams += `&${urlSplit[1]}`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const res = await fetch(`${process.env.GATSBY_TRACKING_API_URL}?${urlParams}`).catch(
|
|
16
|
+
(err) => null
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const data = res ? await res.json() : { success: false };
|
|
20
|
+
return {
|
|
21
|
+
props: data,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
1
2
|
import React, { useEffect } from 'react';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
const ScrollX = ({
|
|
6
|
+
children,
|
|
7
|
+
refTag = {},
|
|
8
|
+
scroll = false,
|
|
9
|
+
stopScrolling = () => {},
|
|
10
|
+
onScroll = () => {},
|
|
11
|
+
}) => {
|
|
6
12
|
let pos = { top: 0, left: 0, x: 0, y: 0 };
|
|
7
13
|
|
|
8
14
|
const preventDefaultEvents = (e) => {
|
|
@@ -53,14 +59,22 @@ const ScrollX = ({ children, refTag = {}, scroll = false, stopScrolling = () =>
|
|
|
53
59
|
refTag.current.addEventListener('mouseleave', mouseUp);
|
|
54
60
|
};
|
|
55
61
|
|
|
62
|
+
const handleScroll = () => {
|
|
63
|
+
onScroll(refTag.current.scrollLeft);
|
|
64
|
+
};
|
|
65
|
+
|
|
56
66
|
useEffect(() => {
|
|
57
67
|
if (scroll) {
|
|
58
68
|
refTag.current.style.cursor = 'grab';
|
|
59
69
|
refTag.current.addEventListener('mousedown', mouseDown);
|
|
70
|
+
refTag.current.addEventListener('scroll', handleScroll);
|
|
60
71
|
}
|
|
61
72
|
|
|
62
|
-
|
|
63
|
-
|
|
73
|
+
return () => {
|
|
74
|
+
refTag.current?.removeEventListener('mousedown', mouseDown);
|
|
75
|
+
refTag.current?.removeEventListener('scroll', handleScroll);
|
|
76
|
+
};
|
|
77
|
+
}, [scroll]);
|
|
64
78
|
|
|
65
79
|
return <>{children}</>;
|
|
66
80
|
};
|
|
@@ -69,6 +83,8 @@ ScrollX.propTypes = {
|
|
|
69
83
|
children: PropTypes.node,
|
|
70
84
|
refTag: PropTypes.shape({}),
|
|
71
85
|
scroll: PropTypes.bool,
|
|
86
|
+
onScroll: PropTypes.func,
|
|
87
|
+
stopScrolling: PropTypes.func,
|
|
72
88
|
};
|
|
73
89
|
|
|
74
90
|
export default ScrollX;
|