gatsby-core-theme 44.22.3 → 44.23.0
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 +38 -0
- package/gatsby-browser.js +66 -24
- package/package.json +1 -1
- package/src/components/molecules/cookie-modal/index.js +22 -2
- package/src/components/molecules/link-list/index.js +54 -30
- package/src/components/molecules/module/index.js +2 -46
- package/src/components/molecules/spotlights_v2/index.js +42 -0
- package/src/components/molecules/spotlights_v2/sport-odds/template-one/index.js +153 -0
- package/src/components/molecules/spotlights_v2/sport-odds/template-one/template-one.module.scss +121 -0
- package/src/components/molecules/spotlights_v2/sport-odds/template-one/template-one.stories.js +84 -0
- package/src/components/molecules/spotlights_v2/sport-odds/template-one/template-one.test.js +57 -0
- package/src/components/molecules/spotlights_v2/sport-odds/template-two/index.js +162 -0
- package/src/components/molecules/spotlights_v2/sport-odds/template-two/template-two.module.scss +117 -0
- package/src/components/molecules/spotlights_v2/sport-odds/template-two/template-two.stories.js +80 -0
- package/src/components/molecules/spotlights_v2/sport-odds/template-two/template-two.test.js +57 -0
- package/src/components/organisms/cookie-consent/cookie-consent.test.js +6 -1
- package/src/components/organisms/cookie-consent/index.js +92 -22
- package/src/constants/cookies.js +16 -0
- package/src/context/MainProvider.js +29 -0
- package/src/helpers/cookies.mjs +21 -0
- package/src/images/icons/funIcon.js +24 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
+
# [44.23.0](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.22.4...v44.23.0) (2026-04-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* per-category cookie is authoritative; legacy fallback only when unset ([4dd15ad](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/4dd15adbe30a688bf6b7a255e54cf190864ce958))
|
|
7
|
+
* revert ([76d3a86](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/76d3a86e475a75b8949ee75591c34d53165b86e3))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Code Refactoring
|
|
11
|
+
|
|
12
|
+
* extract consent gates into cookies helper for site-level reuse ([1be4643](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/1be4643e6917c44eeaaf650d1559172ea26b05ae))
|
|
13
|
+
* self-remove consent listener after all gated categories init ([e502ecd](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/e502ecdf7e5dcd004e7591c5f601c2a5d2ab4a72))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
* Merge branch 'en-492-cookie-consent' into 'master' ([b7e3d5b](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/b7e3d5b20f264814d77b3409445be72aa903071e))
|
|
17
|
+
* Merge branch 'en-492-cookie-consent' into 'master' ([c7e21bd](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/c7e21bd7a3e98a38d3da6351ffccb8b9a68d8c55))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* add functionality category, gate optinmonster on it ([41c2d47](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/41c2d4725424d621824412f50af555118703a7e8))
|
|
23
|
+
* enable cookie consent on demo ([7dc252f](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/7dc252fb1c8ca024fff6e32b4868400f39f7866e))
|
|
24
|
+
* per-category script gating with site-level toggle ([7f7230c](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/7f7230cfef830356342c8afca2c7724a515564b3))
|
|
25
|
+
* reopen cookie settings modal via context + link-list sentinel ([6e68856](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/6e68856451984653f3578f1552f45936d821f693))
|
|
26
|
+
* script loading gated by cookie consent ([09ce499](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/09ce499b5567acf10ccca4611f7027f88781639b))
|
|
27
|
+
|
|
28
|
+
## [44.22.4](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.22.3...v44.22.4) (2026-04-28)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* add as props the transaltions ([28b263c](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/28b263c9b790482b35e8e3abab6cc16c9d94dc4e))
|
|
34
|
+
* add new mode for spotlight ([ff84c7f](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/ff84c7f124190ca5f7fee9dac749919b7cd61b8a))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
* Merge branch 'EN-266-Spotlight' into 'master' ([3c9b8a5](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/3c9b8a599924ed5b0cb136c448d014b78ae8fdb8))
|
|
38
|
+
|
|
1
39
|
## [44.22.3](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.22.2...v44.22.3) (2026-04-27)
|
|
2
40
|
|
|
3
41
|
|
package/gatsby-browser.js
CHANGED
|
@@ -26,7 +26,16 @@ async function yieldToMain() {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
const {
|
|
30
|
+
isAnalyticalGranted,
|
|
31
|
+
isMarketingGranted,
|
|
32
|
+
isFunctionalityGranted,
|
|
33
|
+
} = require("./src/helpers/cookies.mjs");
|
|
34
|
+
|
|
35
|
+
let piguardDidInit = false;
|
|
36
|
+
let analyticalDidInit = false;
|
|
37
|
+
let marketingDidInit = false;
|
|
38
|
+
let functionalityDidInit = false;
|
|
30
39
|
|
|
31
40
|
function initGTM() {
|
|
32
41
|
if (
|
|
@@ -141,30 +150,23 @@ const piguard = () => {
|
|
|
141
150
|
document.head.appendChild(script);
|
|
142
151
|
};
|
|
143
152
|
|
|
144
|
-
|
|
145
|
-
if (
|
|
146
|
-
|
|
147
|
-
await yieldToMain();
|
|
148
|
-
initGTM();
|
|
149
|
-
|
|
153
|
+
function initPiguardCategory() {
|
|
154
|
+
if (piguardDidInit) return;
|
|
155
|
+
piguardDidInit = true;
|
|
150
156
|
if (
|
|
151
157
|
!document.getElementById("piguard") &&
|
|
152
158
|
process.env.ENABLE_PIGUARD === "true"
|
|
153
159
|
) {
|
|
154
160
|
piguard();
|
|
155
161
|
}
|
|
162
|
+
}
|
|
156
163
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
164
|
+
function initAnalyticalCategory() {
|
|
165
|
+
if (analyticalDidInit) return;
|
|
166
|
+
if (!isAnalyticalGranted()) return;
|
|
167
|
+
analyticalDidInit = true;
|
|
168
|
+
initGTM();
|
|
162
169
|
|
|
163
|
-
if (
|
|
164
|
-
process.env.ENABLE_OPTINMONSTR === "true" &&
|
|
165
|
-
!document.getElementById("optin-monstr")
|
|
166
|
-
)
|
|
167
|
-
optinMonster();
|
|
168
170
|
if (
|
|
169
171
|
process.env.ENABLE_PIXEL === "true" &&
|
|
170
172
|
!document.getElementById("pixel-code")
|
|
@@ -174,33 +176,73 @@ async function scrollEvent() {
|
|
|
174
176
|
window.location.pathname !== process.env.PAGE_EXCLUDE_PIXEL
|
|
175
177
|
) {
|
|
176
178
|
loadFacebookPixel();
|
|
177
|
-
|
|
178
179
|
fbq("init", process.env.PIXEL_ID);
|
|
179
|
-
|
|
180
|
-
// Initialize and track the PageView event
|
|
181
180
|
fbq("track", "PageView");
|
|
182
181
|
}
|
|
183
182
|
}
|
|
184
183
|
}
|
|
185
184
|
|
|
185
|
+
function initMarketingCategory() {
|
|
186
|
+
if (marketingDidInit) return;
|
|
187
|
+
if (!isMarketingGranted()) return;
|
|
188
|
+
marketingDidInit = true;
|
|
189
|
+
|
|
190
|
+
if (
|
|
191
|
+
process.env.ENABLE_MICROSOFT === "true" &&
|
|
192
|
+
!document.getElementById("microsoft-code")
|
|
193
|
+
)
|
|
194
|
+
microsoftAdvertising();
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function initFunctionalityCategory() {
|
|
198
|
+
if (functionalityDidInit) return;
|
|
199
|
+
if (!isFunctionalityGranted()) return;
|
|
200
|
+
functionalityDidInit = true;
|
|
201
|
+
|
|
202
|
+
if (
|
|
203
|
+
process.env.ENABLE_OPTINMONSTR === "true" &&
|
|
204
|
+
!document.getElementById("optin-monstr")
|
|
205
|
+
)
|
|
206
|
+
optinMonster();
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
async function tryInitTrackingScripts() {
|
|
210
|
+
await yieldToMain();
|
|
211
|
+
initPiguardCategory();
|
|
212
|
+
initAnalyticalCategory();
|
|
213
|
+
initMarketingCategory();
|
|
214
|
+
initFunctionalityCategory();
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const allGatedCategoriesInitialized = () =>
|
|
218
|
+
analyticalDidInit && marketingDidInit && functionalityDidInit;
|
|
219
|
+
|
|
186
220
|
exports.onClientEntry = () => {
|
|
221
|
+
const consentHandler = async () => {
|
|
222
|
+
await tryInitTrackingScripts();
|
|
223
|
+
if (allGatedCategoriesInitialized()) {
|
|
224
|
+
window.removeEventListener("consent:accepted", consentHandler);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
window.addEventListener("consent:accepted", consentHandler);
|
|
228
|
+
|
|
187
229
|
if (
|
|
188
230
|
process.env.PPC === "true" ||
|
|
189
231
|
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
190
232
|
navigator.userAgent
|
|
191
233
|
)
|
|
192
234
|
) {
|
|
193
|
-
|
|
235
|
+
tryInitTrackingScripts();
|
|
194
236
|
} else {
|
|
195
|
-
document.addEventListener("scroll",
|
|
237
|
+
document.addEventListener("scroll", tryInitTrackingScripts, {
|
|
196
238
|
passive: true,
|
|
197
239
|
once: true,
|
|
198
240
|
});
|
|
199
|
-
document.addEventListener("mousemove",
|
|
241
|
+
document.addEventListener("mousemove", tryInitTrackingScripts, {
|
|
200
242
|
passive: true,
|
|
201
243
|
once: true,
|
|
202
244
|
});
|
|
203
|
-
document.addEventListener("touchstart",
|
|
245
|
+
document.addEventListener("touchstart", tryInitTrackingScripts, {
|
|
204
246
|
passive: true,
|
|
205
247
|
once: true,
|
|
206
248
|
});
|
package/package.json
CHANGED
|
@@ -14,10 +14,24 @@ import Button from "~atoms/button/button";
|
|
|
14
14
|
import styles from "./cookie-modal.module.scss";
|
|
15
15
|
import cookiesContent from '../../../constants/cookies';
|
|
16
16
|
import { parseCookieTextWithLinks } from '../../../helpers/generators.mjs';
|
|
17
|
+
import { getCookie } from '~helpers/cookies';
|
|
18
|
+
|
|
19
|
+
const initialCategoryStates = () => {
|
|
20
|
+
const states = {};
|
|
21
|
+
(cookiesContent.modal?.categories || []).forEach((cat, idx) => {
|
|
22
|
+
if (cat.hasToggle === false) {
|
|
23
|
+
states[idx] = true;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
states[idx] = cat.cookieName ? getCookie(cat.cookieName) === 'true' : false;
|
|
27
|
+
});
|
|
28
|
+
return states;
|
|
29
|
+
};
|
|
17
30
|
|
|
18
31
|
const CookieModal = ({
|
|
19
32
|
handleAcceptCookies,
|
|
20
33
|
handleDeclineCookies,
|
|
34
|
+
handleConfirmChoices,
|
|
21
35
|
declineButtonType = "secondary",
|
|
22
36
|
acceptButtonType = "primary",
|
|
23
37
|
buttonSize = "m",
|
|
@@ -27,7 +41,7 @@ const CookieModal = ({
|
|
|
27
41
|
hide,
|
|
28
42
|
}) => {
|
|
29
43
|
const [categorySection, setCategorySection] = useState(0);
|
|
30
|
-
const [categoryStates, setCategoryStates] = useState(
|
|
44
|
+
const [categoryStates, setCategoryStates] = useState(initialCategoryStates);
|
|
31
45
|
const [menage, setMenage] = useState(true);
|
|
32
46
|
|
|
33
47
|
const modal = useRef(null);
|
|
@@ -68,6 +82,7 @@ const CookieModal = ({
|
|
|
68
82
|
textKey: item?.description?.translationKey,
|
|
69
83
|
defaultText: item?.description?.label,
|
|
70
84
|
alwaysEnabledLabel: item?.alwaysEnabledLabel,
|
|
85
|
+
cookieName: item?.cookieName,
|
|
71
86
|
}));
|
|
72
87
|
|
|
73
88
|
|
|
@@ -204,7 +219,11 @@ const CookieModal = ({
|
|
|
204
219
|
{!templateTwo && (
|
|
205
220
|
<div className={styles?.lastButton || ""}>
|
|
206
221
|
<Button
|
|
207
|
-
onClick={() =>
|
|
222
|
+
onClick={() =>
|
|
223
|
+
handleConfirmChoices
|
|
224
|
+
? handleConfirmChoices(categoryStates)
|
|
225
|
+
: handleAcceptCookies()
|
|
226
|
+
}
|
|
208
227
|
btnText={useTranslate(
|
|
209
228
|
modalSettings?.confirmButton?.translationKey,
|
|
210
229
|
modalSettings?.confirmButton?.label
|
|
@@ -224,6 +243,7 @@ const CookieModal = ({
|
|
|
224
243
|
CookieModal.propTypes = {
|
|
225
244
|
handleAcceptCookies: PropTypes.func,
|
|
226
245
|
handleDeclineCookies: PropTypes.func,
|
|
246
|
+
handleConfirmChoices: PropTypes.func,
|
|
227
247
|
closeModal: PropTypes.func,
|
|
228
248
|
logo: PropTypes.string,
|
|
229
249
|
buttonSize: PropTypes.string,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable arrow-body-style */
|
|
2
2
|
/* eslint-disable no-nested-ternary */
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { useContext } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
|
|
6
6
|
import keygen from '~helpers/keygen';
|
|
@@ -8,6 +8,10 @@ import { imagePrettyUrl } from '~helpers/getters';
|
|
|
8
8
|
import { getAltText } from '~helpers/image';
|
|
9
9
|
import Link from '~hooks/link';
|
|
10
10
|
import LazyImage from '~hooks/lazy-image';
|
|
11
|
+
import { Context } from '~context/MainProvider';
|
|
12
|
+
|
|
13
|
+
const COOKIE_SETTINGS_SENTINEL =
|
|
14
|
+
process.env.GATSBY_COOKIE_SETTINGS_SENTINEL || '#cookie-settings';
|
|
11
15
|
|
|
12
16
|
/* eslint-disable react/jsx-no-target-blank */
|
|
13
17
|
|
|
@@ -25,6 +29,8 @@ const LinkList = ({
|
|
|
25
29
|
gtmClass = '',
|
|
26
30
|
showLinks = true,
|
|
27
31
|
}) => {
|
|
32
|
+
const { openCookieSettings } = useContext(Context)?.cookieConsentContext || {};
|
|
33
|
+
|
|
28
34
|
function renderLinkContent(item, index) {
|
|
29
35
|
const icon = listIcon[index];
|
|
30
36
|
|
|
@@ -56,41 +62,59 @@ const LinkList = ({
|
|
|
56
62
|
);
|
|
57
63
|
}
|
|
58
64
|
|
|
59
|
-
function
|
|
65
|
+
function renderLinkWrapper(item, index) {
|
|
60
66
|
const link = item?.value || item?.url;
|
|
67
|
+
const content = renderLinkContent(item, index);
|
|
68
|
+
const ariaLabel = `${item.title || item.name || item.url} Link`;
|
|
69
|
+
|
|
70
|
+
if (link === COOKIE_SETTINGS_SENTINEL) {
|
|
71
|
+
return (
|
|
72
|
+
<button
|
|
73
|
+
type="button"
|
|
74
|
+
onClick={() => openCookieSettings && openCookieSettings()}
|
|
75
|
+
title={item.title || item.name}
|
|
76
|
+
className={gtmClass || ''}
|
|
77
|
+
aria-label={ariaLabel}
|
|
78
|
+
>
|
|
79
|
+
{content}
|
|
80
|
+
</button>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (!link) return content;
|
|
85
|
+
|
|
86
|
+
if (link.includes('http') || link.includes('www')) {
|
|
87
|
+
return (
|
|
88
|
+
<a
|
|
89
|
+
href={link}
|
|
90
|
+
title={item.title || item.name}
|
|
91
|
+
rel={`noreferrer ${item.nofollow ? 'nofollow' : ''}`}
|
|
92
|
+
target="_blank"
|
|
93
|
+
className={gtmClass || ''}
|
|
94
|
+
aria-label={ariaLabel}
|
|
95
|
+
>
|
|
96
|
+
{content}
|
|
97
|
+
</a>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
61
100
|
|
|
62
101
|
return (
|
|
63
|
-
<
|
|
64
|
-
{
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
aria-label={`${item.title || item.name} Link`}
|
|
73
|
-
>
|
|
74
|
-
{renderLinkContent(item, index)}
|
|
75
|
-
</a>
|
|
76
|
-
) : (
|
|
77
|
-
<Link
|
|
78
|
-
to={showLinks && link}
|
|
79
|
-
title={item.title || item.name}
|
|
80
|
-
className={gtmClass || ''}
|
|
81
|
-
rel={item.nofollow ? 'nofollow' : ''}
|
|
82
|
-
aria-label={`${item.title || item.url} Link`}
|
|
83
|
-
>
|
|
84
|
-
{renderLinkContent(item, index)}
|
|
85
|
-
</Link>
|
|
86
|
-
)
|
|
87
|
-
) : (
|
|
88
|
-
renderLinkContent(item, index)
|
|
89
|
-
)}
|
|
90
|
-
</li>
|
|
102
|
+
<Link
|
|
103
|
+
to={showLinks && link}
|
|
104
|
+
title={item.title || item.name}
|
|
105
|
+
className={gtmClass || ''}
|
|
106
|
+
rel={item.nofollow ? 'nofollow' : ''}
|
|
107
|
+
aria-label={ariaLabel}
|
|
108
|
+
>
|
|
109
|
+
{content}
|
|
110
|
+
</Link>
|
|
91
111
|
);
|
|
92
112
|
}
|
|
93
113
|
|
|
114
|
+
function renderItems(item, index) {
|
|
115
|
+
return <li key={keygen()}>{renderLinkWrapper(item, index)}</li>;
|
|
116
|
+
}
|
|
117
|
+
|
|
94
118
|
const renderSingleList = () => {
|
|
95
119
|
return (
|
|
96
120
|
<ul className={classes}>
|
|
@@ -10,6 +10,7 @@ import Toplist from "~organisms/toplist";
|
|
|
10
10
|
import AdminButton from "~atoms/admin/button";
|
|
11
11
|
import Accordian from "~organisms/accordion";
|
|
12
12
|
import Anchor from "~organisms/anchor/template-one";
|
|
13
|
+
import getSpotlightComponent from "~molecules/spotlights_v2";
|
|
13
14
|
|
|
14
15
|
const Modules = ({ module, page, pageContext, modulePosition }) => {
|
|
15
16
|
const { admin } = useContext(Context) || {};
|
|
@@ -63,52 +64,7 @@ const Modules = ({ module, page, pageContext, modulePosition }) => {
|
|
|
63
64
|
case "comments":
|
|
64
65
|
return lazy(() => import("~organisms/comments"));
|
|
65
66
|
case "spotlights":
|
|
66
|
-
|
|
67
|
-
if (module?.style === "template_two") {
|
|
68
|
-
return lazy(() =>
|
|
69
|
-
import("~molecules/spotlights_v2/image-text/template-two")
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
if (module?.style === "template_three") {
|
|
73
|
-
return lazy(() =>
|
|
74
|
-
import("~molecules/spotlights_v2/image-text/template-three")
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
if (module?.style === "template_four") {
|
|
78
|
-
return lazy(() =>
|
|
79
|
-
import("~molecules/spotlights_v2/image-text/template-four")
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
if (module?.style === "template_five") {
|
|
83
|
-
return lazy(() =>
|
|
84
|
-
import("~molecules/spotlights_v2/image-text/template-five")
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
if (module?.style === "template_six") {
|
|
88
|
-
return lazy(() =>
|
|
89
|
-
import("~molecules/spotlights_v2/image-text/template-six")
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
return lazy(() =>
|
|
93
|
-
import("~molecules/spotlights_v2/image-text/template-one")
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
if (module?.mode === "icon") {
|
|
97
|
-
return lazy(() =>
|
|
98
|
-
import("~molecules/spotlights_v2/icon/template-one")
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
if (module?.mode === "image") {
|
|
102
|
-
if (module?.style === "template_two") {
|
|
103
|
-
return lazy(() =>
|
|
104
|
-
import("~molecules/spotlights_v2/image/template-two")
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
return lazy(() =>
|
|
108
|
-
import("~molecules/spotlights_v2/image/template-one")
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
break;
|
|
67
|
+
return getSpotlightComponent(module);
|
|
112
68
|
case "disquss":
|
|
113
69
|
return lazy(() => import(`~atoms/disquss`));
|
|
114
70
|
default:
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { lazy } from "react";
|
|
2
|
+
|
|
3
|
+
const getSpotlightComponent = (module) => {
|
|
4
|
+
const { mode, style } = module || {};
|
|
5
|
+
|
|
6
|
+
if (mode === "image_text") {
|
|
7
|
+
switch (style) {
|
|
8
|
+
case "template_two":
|
|
9
|
+
return lazy(() => import("~molecules/spotlights_v2/image-text/template-two"));
|
|
10
|
+
case "template_three":
|
|
11
|
+
return lazy(() => import("~molecules/spotlights_v2/image-text/template-three"));
|
|
12
|
+
case "template_four":
|
|
13
|
+
return lazy(() => import("~molecules/spotlights_v2/image-text/template-four"));
|
|
14
|
+
case "template_five":
|
|
15
|
+
return lazy(() => import("~molecules/spotlights_v2/image-text/template-five"));
|
|
16
|
+
case "template_six":
|
|
17
|
+
return lazy(() => import("~molecules/spotlights_v2/image-text/template-six"));
|
|
18
|
+
default:
|
|
19
|
+
return lazy(() => import("~molecules/spotlights_v2/image-text/template-one"));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (mode === "icon") {
|
|
24
|
+
return lazy(() => import("~molecules/spotlights_v2/icon/template-one"));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (mode === "image") {
|
|
28
|
+
return style === "template_two"
|
|
29
|
+
? lazy(() => import("~molecules/spotlights_v2/image/template-two"))
|
|
30
|
+
: lazy(() => import("~molecules/spotlights_v2/image/template-one"));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (mode === "sport_odds") {
|
|
34
|
+
return style === "template_two"
|
|
35
|
+
? lazy(() => import("~molecules/spotlights_v2/sport-odds/template-two"))
|
|
36
|
+
: lazy(() => import("~molecules/spotlights_v2/sport-odds/template-one"));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return null;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default getSpotlightComponent;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import keygen from "~helpers/keygen";
|
|
4
|
+
import LazyImage from "~hooks/lazy-image";
|
|
5
|
+
import Button from "../../../../atoms/button/operator-cta";
|
|
6
|
+
import Tnc from '../../../tnc'
|
|
7
|
+
import useTranslate from "~hooks/useTranslate/useTranslate";
|
|
8
|
+
import FunIcon from "../../../../../images/icons/funIcon";
|
|
9
|
+
import styles from "./template-one.module.scss";
|
|
10
|
+
|
|
11
|
+
const DEFAULT_CTA_TRANSLATE = {
|
|
12
|
+
active: { translationKey: 'play_now', defaultValue: 'Visit' },
|
|
13
|
+
not_recommended: {
|
|
14
|
+
translationKey: 'not_recommended',
|
|
15
|
+
defaultValue: 'Not Recommended'
|
|
16
|
+
},
|
|
17
|
+
coming_soon: {
|
|
18
|
+
translationKey: 'coming_soon',
|
|
19
|
+
defaultValue: 'Soon Available'
|
|
20
|
+
},
|
|
21
|
+
inactive: {
|
|
22
|
+
translationKey: 'inactive',
|
|
23
|
+
defaultValue: 'Not Accepting New Players'
|
|
24
|
+
},
|
|
25
|
+
blacklisted: { translationKey: 'blacklisted', defaultValue: 'Blacklisted' }
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default function TemplateOne({
|
|
29
|
+
module,
|
|
30
|
+
showOperatorHeader = false,
|
|
31
|
+
ctaTranslate = DEFAULT_CTA_TRANSLATE,
|
|
32
|
+
}) {
|
|
33
|
+
const items = module?.items;
|
|
34
|
+
const ctaText = module?.link_text;
|
|
35
|
+
const date = useTranslate('date', 'Date:');
|
|
36
|
+
const funbetLabel = useTranslate('funbet', 'Funbet');
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div className={styles.sportOdds}>
|
|
40
|
+
{(items || []).map((item) => {
|
|
41
|
+
const operatorName = item?.relation?.name;
|
|
42
|
+
const operatorLogo = item?.relation?.logo;
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<div key={keygen()} className={styles.card}>
|
|
46
|
+
<div className={styles.header}>
|
|
47
|
+
{
|
|
48
|
+
showOperatorHeader ?
|
|
49
|
+
<>
|
|
50
|
+
{operatorLogo?.url ? (
|
|
51
|
+
<LazyImage
|
|
52
|
+
src={operatorLogo.url}
|
|
53
|
+
width={20}
|
|
54
|
+
height={20}
|
|
55
|
+
alt={operatorLogo.alt || operatorName}
|
|
56
|
+
/>
|
|
57
|
+
) : (
|
|
58
|
+
<span className={styles.operatorIcon} aria-hidden="true" />
|
|
59
|
+
)}
|
|
60
|
+
{operatorName && <span>{operatorName}</span>}
|
|
61
|
+
</> : <>
|
|
62
|
+
<FunIcon />
|
|
63
|
+
<span>{funbetLabel}</span>
|
|
64
|
+
</>
|
|
65
|
+
}
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<div className={styles.body}>
|
|
69
|
+
<div className={styles.main}>
|
|
70
|
+
<div className={styles.info}>
|
|
71
|
+
{item?.main_title && (
|
|
72
|
+
<p className={styles.title}>{item.main_title}</p>
|
|
73
|
+
)}
|
|
74
|
+
{item?.secondary_title && (
|
|
75
|
+
<p className={styles.time}>{date}<span>{item.secondary_title}</span></p>
|
|
76
|
+
)}
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<div className={styles.action}>
|
|
80
|
+
{(item?.odds_text || item?.odds_value) && (
|
|
81
|
+
<div className={styles.odds}>
|
|
82
|
+
{operatorLogo?.url && (
|
|
83
|
+
<LazyImage
|
|
84
|
+
src={operatorLogo.url}
|
|
85
|
+
width={48}
|
|
86
|
+
height={48}
|
|
87
|
+
alt={operatorLogo.alt || operatorName}
|
|
88
|
+
/>
|
|
89
|
+
)}
|
|
90
|
+
<span>
|
|
91
|
+
{item?.odds_text}
|
|
92
|
+
{item?.odds_text && item?.odds_value ? ": " : ""}
|
|
93
|
+
{item?.odds_value}
|
|
94
|
+
</span>
|
|
95
|
+
</div>
|
|
96
|
+
)}
|
|
97
|
+
|
|
98
|
+
<Button
|
|
99
|
+
operator={item?.relation}
|
|
100
|
+
buttonType="primary"
|
|
101
|
+
buttonSize="m"
|
|
102
|
+
btnText={ctaText}
|
|
103
|
+
isInternalLink={false}
|
|
104
|
+
targetBlank
|
|
105
|
+
moduleName={module?.name}
|
|
106
|
+
tracker={module?.bonus?.tracking_link_name || 'main'}
|
|
107
|
+
translationsObj={ctaTranslate}
|
|
108
|
+
/>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<Tnc operator={item?.relation} tracker={item?.bonus?.tracking_link_name} />
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
);
|
|
116
|
+
})}
|
|
117
|
+
</div>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
TemplateOne.propTypes = {
|
|
122
|
+
module: PropTypes.shape({
|
|
123
|
+
items: PropTypes.arrayOf(PropTypes.shape({})),
|
|
124
|
+
link_text: PropTypes.string,
|
|
125
|
+
name: PropTypes.string,
|
|
126
|
+
bonus: PropTypes.shape({
|
|
127
|
+
tracking_link_name: PropTypes.string,
|
|
128
|
+
}),
|
|
129
|
+
}),
|
|
130
|
+
showOperatorHeader: PropTypes.bool,
|
|
131
|
+
ctaTranslate: PropTypes.shape({
|
|
132
|
+
active: PropTypes.shape({
|
|
133
|
+
translationKey: PropTypes.string,
|
|
134
|
+
defaultValue: PropTypes.string,
|
|
135
|
+
}),
|
|
136
|
+
not_recommended: PropTypes.shape({
|
|
137
|
+
translationKey: PropTypes.string,
|
|
138
|
+
defaultValue: PropTypes.string,
|
|
139
|
+
}),
|
|
140
|
+
coming_soon: PropTypes.shape({
|
|
141
|
+
translationKey: PropTypes.string,
|
|
142
|
+
defaultValue: PropTypes.string,
|
|
143
|
+
}),
|
|
144
|
+
inactive: PropTypes.shape({
|
|
145
|
+
translationKey: PropTypes.string,
|
|
146
|
+
defaultValue: PropTypes.string,
|
|
147
|
+
}),
|
|
148
|
+
blacklisted: PropTypes.shape({
|
|
149
|
+
translationKey: PropTypes.string,
|
|
150
|
+
defaultValue: PropTypes.string,
|
|
151
|
+
}),
|
|
152
|
+
}),
|
|
153
|
+
};
|