gatsby-core-theme 41.1.13 → 41.1.15
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 +52 -0
- package/gatsby-browser.js +0 -19
- package/gatsby-node.mjs +4 -32
- package/jest.config.js +1 -1
- package/package.json +1 -1
- package/src/components/atoms/disquss/index.js +37 -8
- package/src/components/molecules/main/index.js +1 -11
- package/src/components/molecules/module/index.js +2 -0
- package/src/components/organisms/anchor/template-one/index.js +7 -2
- package/src/components/organisms/anchor/template-two/index.js +8 -3
- package/src/constants/pick-keys.mjs +13 -0
- package/src/helpers/api.mjs +77 -27
- package/src/helpers/fetch-site-settings.mjs +8 -1
- package/src/helpers/processor/common.mjs +0 -1
- package/src/helpers/processor/common.test.js +54 -31
- package/src/helpers/processor/game.mjs +11 -11
- package/src/helpers/processor/game.test.js +2 -0
- package/src/helpers/processor/games.mjs +1 -1
- package/src/helpers/processor/games.test.js +64 -0
- package/src/helpers/processor/index.mjs +41 -72
- package/src/helpers/processor/modules.mjs +1 -1
- package/src/helpers/processor/operators.mjs +3 -3
- package/src/helpers/processor/relations.mjs +4 -0
- package/src/helpers/processor/sports-relations.mjs +167 -0
- package/src/helpers/processor/sports-relations.test.js +198 -0
- package/src/helpers/schedule.mjs +23 -3
- package/src/helpers/processor/sports.mjs +0 -212
- package/src/helpers/processor/sports.test.js +0 -288
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,55 @@
|
|
|
1
|
+
## [41.1.15](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v41.1.14...v41.1.15) (2024-12-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* .env ([13bb9ac](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/13bb9acbfef49eb6a4a713b5ed2d2bdc045681a9))
|
|
7
|
+
* .env ([0c2a7a2](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/0c2a7a2c6bc19403cf3efcb154c6f2de87ba1725))
|
|
8
|
+
* .env ([bd707c8](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/bd707c8aea264afee8bb27c63b2a9106001802fa))
|
|
9
|
+
* add as template the disquss ([e6e502d](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/e6e502dae6753c7a15bb0d71dc6c5cec421d9f61))
|
|
10
|
+
* added featured with tournament pages] ([1408818](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/1408818727af95ee455a8f4e798e3c8e2b8a2c0f))
|
|
11
|
+
* added jerseys ([7d1eecb](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/7d1eecb9308faa6fd7228da0234bef282e6947ae))
|
|
12
|
+
* added team kits to event pages ([e77db98](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/e77db98e6e8ace1a3cf645557e59f0a9752f558b))
|
|
13
|
+
* added team kits to event pages ([41d4399](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/41d43992e8a178bea54058f56f69ea0a605b5f38))
|
|
14
|
+
* aligned with master branch ([2b422da](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/2b422da69b84c7fa5c8c99b81257e156bd8e983e))
|
|
15
|
+
* conflict ([b83f852](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/b83f852cf17a78959e955b09b663c5c3858d74ea))
|
|
16
|
+
* increased limit for jersey kits ([2a1bfd5](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/2a1bfd551f77ad14fac460920e9d1dde9fc9850f))
|
|
17
|
+
* jerseys ([a96e7a3](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/a96e7a3e6422085796aec19ce258fe58264f071a))
|
|
18
|
+
* merged master ([7532b1e](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/7532b1ea179d403c7b98a43d5b21a908af602cfc))
|
|
19
|
+
* merged master and fixes tests ([2e7ea4f](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/2e7ea4f5bebbd8346db1d1ca6e4bb307a5fcf443))
|
|
20
|
+
* moved disquss js into component sicne it is now a tempalte block ([9448b13](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/9448b1316614c686966e7aea8add8726ae85985a))
|
|
21
|
+
* new sports data structure ([4e73685](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/4e736852d4ac25b7d6fa023a11f93eef0d521d2a))
|
|
22
|
+
* preview button link for multimarket ([0020ba4](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/0020ba46ef3a0dcd7e37f044c4cc615e9fe6d57c))
|
|
23
|
+
* reducing data in event pages ([a9c8658](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/a9c8658c07f0372e472360de3d777b70184be882))
|
|
24
|
+
* reducing data in event pages ([c91d090](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/c91d090c90116e158062a6e49e732bebad81fae6))
|
|
25
|
+
* reducing data in event pages ([fc6fb74](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/fc6fb74ab10fb6912ee4f57670a703de7bde1eb3))
|
|
26
|
+
* reducing data in event pages ([88d4b47](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/88d4b4791da56e84e541c3bfa27997ef1ddccf98))
|
|
27
|
+
* removed event pages without relation ([c7c845d](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/c7c845d04fafbae0dafa846f03421f1339d75181))
|
|
28
|
+
* schedule data ([819d277](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/819d27760679603ed69638eb7f24c7f887aae9a8))
|
|
29
|
+
* schedule data ([ac6c495](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/ac6c495adbcff1ee3bacd2e722434d4013df7f59))
|
|
30
|
+
* schedule data ([f1c70a2](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/f1c70a222737fc990d70fb2dc17dbc351d4d6187))
|
|
31
|
+
* schedule fixes and added new team jersey endpoint ([b4a69ef](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/b4a69eff81d586a12a1f25621688d72f556b647b))
|
|
32
|
+
* schedule fixes and added new team jersey endpoint ([22ac289](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/22ac289a618987f67800fb6e032c469c7b8629e9))
|
|
33
|
+
* schedule object, added today attribute ([36683e2](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/36683e21e33849c42f0933c6d24db51c74110127))
|
|
34
|
+
* sports data bug ([b7806ed](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/b7806edf2c73e42c115597aa3b14f4b572e82cd1))
|
|
35
|
+
* temp ([269a99a](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/269a99a414070223114d5aeeeab18e7ef250fbb8))
|
|
36
|
+
* tests ([f512e7e](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/f512e7ec8b60269fd3350a74b59ac83d19902e15))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
* Merge branch 'tm-5002-disquss' into 'master' ([f53848b](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/f53848b219f81f9693f17035343bff725a399946))
|
|
40
|
+
* Merge branch 'sports-data' into 'master' ([ce30060](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/ce3006045c708e8783e5c45ddab3c31f6abd2e6c))
|
|
41
|
+
* Merge branch 'master' into sports-data ([026b867](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/026b867ade17f92414b47db354fb643d58b55fa5))
|
|
42
|
+
|
|
43
|
+
## [41.1.14](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v41.1.13...v41.1.14) (2024-12-23)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Bug Fixes
|
|
47
|
+
|
|
48
|
+
* add placeholder for anchor ([1982603](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/19826038e2f94a1664ef01e11238c422a7a1fc76))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
* Merge branch 'TM-5018-anchor-placeholder' into 'master' ([328a58b](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/328a58b9e15063c8b0adf0c15dd4578369d8051e))
|
|
52
|
+
|
|
1
53
|
## [41.1.13](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v41.1.12...v41.1.13) (2024-12-17)
|
|
2
54
|
|
|
3
55
|
|
package/gatsby-browser.js
CHANGED
|
@@ -117,21 +117,6 @@ const piguard = () =>{
|
|
|
117
117
|
document.head.appendChild(script);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
const disquss = () =>{
|
|
121
|
-
// eslint-disable-next-line no-unused-vars, func-names, camelcase
|
|
122
|
-
var disqus_config = function () {
|
|
123
|
-
this.page.url = window.location.href;
|
|
124
|
-
this.page.identifier = window.location.pathname; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
var d = document,
|
|
128
|
-
s = d.createElement('script');
|
|
129
|
-
s.src = `${process.env.DISQUSS_URL}`;
|
|
130
|
-
s.id = 'disquss-code';
|
|
131
|
-
s.setAttribute('data-timestamp', +new Date());
|
|
132
|
-
(d.head || d.body).appendChild(s);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
120
|
function scrollEvent(event) {
|
|
136
121
|
initGTM();
|
|
137
122
|
|
|
@@ -139,10 +124,6 @@ function scrollEvent(event) {
|
|
|
139
124
|
piguard();
|
|
140
125
|
}
|
|
141
126
|
|
|
142
|
-
if (!document.getElementById('disquss-code') && process.env.ENABLE_DISQUSS === 'true') {
|
|
143
|
-
disquss();
|
|
144
|
-
}
|
|
145
|
-
|
|
146
127
|
if (process.env.ENABLE_MICROSOFT === 'true' && !document.getElementById('microsoft-code'))
|
|
147
128
|
microsoftAdvertising();
|
|
148
129
|
|
package/gatsby-node.mjs
CHANGED
|
@@ -305,7 +305,8 @@ export const createPages = async (
|
|
|
305
305
|
return;
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
-
|
|
308
|
+
// TO DO: Move this logic in sports relation
|
|
309
|
+
if (page.relation_type === "event" && !page.relation) {
|
|
309
310
|
return;
|
|
310
311
|
}
|
|
311
312
|
|
|
@@ -372,39 +373,9 @@ export const createPages = async (
|
|
|
372
373
|
});
|
|
373
374
|
});
|
|
374
375
|
|
|
376
|
+
|
|
375
377
|
// Generating Affiliate Tracker Link
|
|
376
378
|
const pageTemplate = "tracker";
|
|
377
|
-
if (["rage_seo", "rage_ppc"].includes(siteGeneralData.type)) {
|
|
378
|
-
Object.keys(
|
|
379
|
-
( sportsData &&
|
|
380
|
-
sportsData.providers) ||
|
|
381
|
-
{}
|
|
382
|
-
).forEach((providerId) => {
|
|
383
|
-
const provider = sportsData.providers[providerId];
|
|
384
|
-
const tracker = generateTrackerLink(provider, "main", true, pageTemplate);
|
|
385
|
-
const trackerPageObject = {
|
|
386
|
-
meta_title: "Tracker",
|
|
387
|
-
template: pageTemplate,
|
|
388
|
-
title: "Tracker",
|
|
389
|
-
relation_type: "page",
|
|
390
|
-
language: defaultLanguage,
|
|
391
|
-
path: tracker,
|
|
392
|
-
meta_robots: ["noindex", "nofollow"],
|
|
393
|
-
};
|
|
394
|
-
createPage({
|
|
395
|
-
path: tracker,
|
|
396
|
-
component: `${__dirname}/src/components/app.js`,
|
|
397
|
-
context: {
|
|
398
|
-
page: trackerPageObject,
|
|
399
|
-
siteGeneralData,
|
|
400
|
-
provider,
|
|
401
|
-
isTracker: true,
|
|
402
|
-
isLiveStreamProvider: true,
|
|
403
|
-
meta_robots: ["noindex", "nofollow"],
|
|
404
|
-
},
|
|
405
|
-
});
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
379
|
|
|
409
380
|
// Creating Tracking links
|
|
410
381
|
Object.keys(operators || {}).forEach((operatorId) => {
|
|
@@ -582,6 +553,7 @@ export const sourceNodes = async ({
|
|
|
582
553
|
updated_at: page.updated_at,
|
|
583
554
|
market: page.market,
|
|
584
555
|
language: page.language,
|
|
556
|
+
type: page.type
|
|
585
557
|
};
|
|
586
558
|
|
|
587
559
|
const nodeMeta = {
|
package/jest.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,14 +1,43 @@
|
|
|
1
|
+
/* eslint-disable no-var */
|
|
2
|
+
/* eslint-disable one-var */
|
|
3
|
+
/* eslint-disable no-unused-vars */
|
|
4
|
+
/* eslint-disable func-names */
|
|
5
|
+
/* eslint-disable camelcase */
|
|
6
|
+
/* eslint-disable vars-on-top */
|
|
1
7
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2
8
|
/* eslint-disable react/no-this-in-sfc */
|
|
3
9
|
/* eslint-disable no-undef */
|
|
4
|
-
import React, { useEffect } from
|
|
5
|
-
import PropTypes from
|
|
10
|
+
import React, { useEffect } from "react";
|
|
11
|
+
import PropTypes from "prop-types";
|
|
6
12
|
|
|
7
|
-
import { getUrl } from
|
|
13
|
+
import { getUrl } from "~helpers/getters";
|
|
14
|
+
|
|
15
|
+
const Disquss = ({ page }) => {
|
|
16
|
+
// Function to load Disqus
|
|
17
|
+
const disquss = () => {
|
|
18
|
+
if (document.getElementById("disquss-code")) {
|
|
19
|
+
return; // Prevent multiple script injections
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// eslint-disable-next-line no-var
|
|
23
|
+
var disqus_config = function () {
|
|
24
|
+
this.page.url = window.location.href;
|
|
25
|
+
this.page.identifier = window.location.pathname;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
var d = document,
|
|
29
|
+
s = d.createElement("script");
|
|
30
|
+
s.src = `${process.env.DISQUSS_URL}`; // Replace with your Disqus URL
|
|
31
|
+
s.id = "disquss-code";
|
|
32
|
+
s.setAttribute("data-timestamp", +new Date());
|
|
33
|
+
|
|
34
|
+
(d.head || d.body).appendChild(s);
|
|
35
|
+
};
|
|
8
36
|
|
|
9
|
-
const Disquss = ({page}) => {
|
|
10
37
|
useEffect(() => {
|
|
11
|
-
|
|
38
|
+
disquss();
|
|
39
|
+
|
|
40
|
+
if (typeof DISQUS !== "undefined") {
|
|
12
41
|
DISQUS.reset({
|
|
13
42
|
reload: true,
|
|
14
43
|
config() {
|
|
@@ -17,7 +46,7 @@ const Disquss = ({page}) => {
|
|
|
17
46
|
},
|
|
18
47
|
});
|
|
19
48
|
}
|
|
20
|
-
}, []);
|
|
49
|
+
}, []);
|
|
21
50
|
|
|
22
51
|
return (
|
|
23
52
|
<div className="module">
|
|
@@ -29,8 +58,8 @@ const Disquss = ({page}) => {
|
|
|
29
58
|
Disquss.propTypes = {
|
|
30
59
|
page: PropTypes.shape({
|
|
31
60
|
title: PropTypes.string,
|
|
32
|
-
path: PropTypes.string
|
|
33
|
-
})
|
|
61
|
+
path: PropTypes.string,
|
|
62
|
+
}),
|
|
34
63
|
};
|
|
35
64
|
|
|
36
65
|
export default Disquss;
|
|
@@ -37,10 +37,7 @@ const Main = ({
|
|
|
37
37
|
const NotFound = page?.path?.includes("404")
|
|
38
38
|
? lazy(() => import(`~atoms/not-found`))
|
|
39
39
|
: null;
|
|
40
|
-
|
|
41
|
-
const Disquss =
|
|
42
|
-
page.type === "operator" && process.env.ENABLE_DISQUSS === 'true' ? lazy(() => import(`~atoms/disquss`)) : null;
|
|
43
|
-
|
|
40
|
+
|
|
44
41
|
const Newsletter = showNewsletter
|
|
45
42
|
? lazy(() => import("~molecules/newsletter"))
|
|
46
43
|
: null;
|
|
@@ -66,13 +63,6 @@ const Main = ({
|
|
|
66
63
|
modulePosition={index + 1}
|
|
67
64
|
/>
|
|
68
65
|
))}
|
|
69
|
-
|
|
70
|
-
{Disquss && (
|
|
71
|
-
<Suspense fallback={<></>}>
|
|
72
|
-
<Disquss page={pageContext.page} />
|
|
73
|
-
</Suspense>
|
|
74
|
-
)}
|
|
75
|
-
|
|
76
66
|
{NotFound && (
|
|
77
67
|
<Suspense fallback={<></>}>
|
|
78
68
|
<NotFound pageContext={pageContext} />
|
|
@@ -11,6 +11,7 @@ import { IoIosArrowForward } from "@react-icons/all-files/io/IoIosArrowForward";
|
|
|
11
11
|
import isSticky from "~hooks/stickyOnScroll";
|
|
12
12
|
import keygen from "~helpers/keygen";
|
|
13
13
|
import { anchorLink, removeSymbols } from "~helpers/strings";
|
|
14
|
+
import { generatePlaceholderString } from "~helpers/generators";
|
|
14
15
|
|
|
15
16
|
import useTranslate from "~hooks/useTranslate/useTranslate";
|
|
16
17
|
import styles from "./anchor.module.scss";
|
|
@@ -27,10 +28,11 @@ function Anchor({
|
|
|
27
28
|
buttonScroll = 200,
|
|
28
29
|
leftButtonIcon = <IoIosArrowBack />,
|
|
29
30
|
rightButtonIcon = <IoIosArrowForward />,
|
|
31
|
+
page
|
|
30
32
|
}) {
|
|
31
33
|
const [scrollX, setScrollX] = useState(0);
|
|
32
34
|
const [scrollEnd, setScrollEnd] = useState(false);
|
|
33
|
-
|
|
35
|
+
|
|
34
36
|
const itemsRef = useRef([]);
|
|
35
37
|
const anchorContainerRef = useRef(null);
|
|
36
38
|
const anchorListRef = useRef(null);
|
|
@@ -126,7 +128,7 @@ function Anchor({
|
|
|
126
128
|
ref={(el) => (itemsRef.current[index] = el)}
|
|
127
129
|
href={`#${item?.id && item.id}`}
|
|
128
130
|
>
|
|
129
|
-
{useTranslate(item.slug, item.label)}
|
|
131
|
+
{generatePlaceholderString(useTranslate(item.slug, item.label),null, page?.relation)}
|
|
130
132
|
{icon}
|
|
131
133
|
</a>
|
|
132
134
|
</li>
|
|
@@ -200,6 +202,9 @@ Anchor.propTypes = {
|
|
|
200
202
|
rightButtonIcon: PropTypes.shape({}),
|
|
201
203
|
minCharactersForButtons: PropTypes.number,
|
|
202
204
|
setShowButtons: PropTypes.bool,
|
|
205
|
+
page: PropTypes.shape({
|
|
206
|
+
relation:PropTypes.shape({})
|
|
207
|
+
})
|
|
203
208
|
};
|
|
204
209
|
|
|
205
210
|
export default Anchor;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
1
2
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
3
|
/* eslint-disable no-unused-expressions */
|
|
3
4
|
/* eslint-disable prefer-destructuring */
|
|
@@ -10,9 +11,11 @@ import ScollX from 'gatsby-core-theme/src/hooks/scroll-x';
|
|
|
10
11
|
import keygen from '~helpers/keygen';
|
|
11
12
|
import { anchorLink, removeSymbols } from '~helpers/strings';
|
|
12
13
|
import useTranslate from '~hooks/useTranslate/useTranslate';
|
|
14
|
+
import { generatePlaceholderString } from "~helpers/generators";
|
|
15
|
+
|
|
13
16
|
import styles from './template-two.module.scss';
|
|
14
17
|
|
|
15
|
-
function Anchor({ module: { items }, icon = null, showTitle = true, exclOperator = false }) {
|
|
18
|
+
function Anchor({ module: { items }, icon = null, showTitle = true, exclOperator = false, page }) {
|
|
16
19
|
const itemsRef = useRef([]);
|
|
17
20
|
const anchorContainerRef = useRef(null);
|
|
18
21
|
const anchorListRef = useRef(null);
|
|
@@ -49,7 +52,7 @@ function Anchor({ module: { items }, icon = null, showTitle = true, exclOperator
|
|
|
49
52
|
ref={(el) => (itemsRef.current[index] = el)}
|
|
50
53
|
href={`#${item?.id && item.id}`}
|
|
51
54
|
>
|
|
52
|
-
{useTranslate(item.slug, item.label)}
|
|
55
|
+
{generatePlaceholderString(useTranslate(item.slug, item.label), null, page?.relation)}
|
|
53
56
|
{icon}
|
|
54
57
|
</a>
|
|
55
58
|
</li>
|
|
@@ -70,10 +73,12 @@ Anchor.propTypes = {
|
|
|
70
73
|
})
|
|
71
74
|
),
|
|
72
75
|
}).isRequired,
|
|
73
|
-
headerOffset: PropTypes.number,
|
|
74
76
|
styles: PropTypes.shape({}),
|
|
75
77
|
icon: PropTypes.element,
|
|
76
78
|
showTitle: PropTypes.string,
|
|
79
|
+
page: PropTypes.shape({
|
|
80
|
+
relation: PropTypes.shape({})
|
|
81
|
+
})
|
|
77
82
|
};
|
|
78
83
|
|
|
79
84
|
export default Anchor;
|
|
@@ -110,6 +110,19 @@ export const pickRelationKeys = {
|
|
|
110
110
|
"license_objects",
|
|
111
111
|
"launch_date"
|
|
112
112
|
],
|
|
113
|
+
operator_simplified: [
|
|
114
|
+
"short_name",
|
|
115
|
+
"name",
|
|
116
|
+
"links",
|
|
117
|
+
"bonuses",
|
|
118
|
+
"operator_id",
|
|
119
|
+
"id",
|
|
120
|
+
"rating",
|
|
121
|
+
"logo",
|
|
122
|
+
"type",
|
|
123
|
+
"market",
|
|
124
|
+
"status"
|
|
125
|
+
],
|
|
113
126
|
game: [
|
|
114
127
|
"id",
|
|
115
128
|
"game_id",
|
package/src/helpers/api.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import axios from
|
|
1
|
+
import axios from "axios";
|
|
2
2
|
|
|
3
|
-
import chalk from
|
|
4
|
-
import { groupBy } from
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { groupBy } from "./getters.mjs";
|
|
5
5
|
|
|
6
6
|
// const axios = require('axios');
|
|
7
7
|
// const chalk = require('chalk');
|
|
@@ -13,13 +13,13 @@ const API_URL = process.env.GATSBY_API_URL;
|
|
|
13
13
|
function callAPIV2(endpointPath) {
|
|
14
14
|
const headers = {
|
|
15
15
|
headers: {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
"X-ID": process.env.GATSBY_API_V2_X_ID,
|
|
17
|
+
"X-Signature": process.env.GATSBY_API_V2_X_SIGNATURE,
|
|
18
18
|
},
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
const path = `${process.env.GATSBY_API_URL_V2}/${endpointPath}`;
|
|
22
|
-
console.log(chalk.magenta(
|
|
22
|
+
console.log(chalk.magenta("calling ") + chalk.whiteBright(path));
|
|
23
23
|
const start = new Date();
|
|
24
24
|
return new Promise((resolve, reject) => {
|
|
25
25
|
axios
|
|
@@ -28,7 +28,8 @@ function callAPIV2(endpointPath) {
|
|
|
28
28
|
const end = new Date() - start;
|
|
29
29
|
|
|
30
30
|
console.log(
|
|
31
|
-
chalk.green(
|
|
31
|
+
chalk.green("success") +
|
|
32
|
+
chalk.whiteBright(` calling ${endpointPath} API - %ds`),
|
|
32
33
|
end / 1000
|
|
33
34
|
);
|
|
34
35
|
resolve(response.data.result);
|
|
@@ -40,20 +41,25 @@ function callAPIV2(endpointPath) {
|
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
|
|
44
44
|
export async function getResponsableGamings(siteName) {
|
|
45
|
-
const affSettings = await callAPIV2(
|
|
45
|
+
const affSettings = await callAPIV2(
|
|
46
|
+
`v0.1/operators/operators-sorted-v2/settings/${siteName}`
|
|
47
|
+
);
|
|
46
48
|
|
|
47
|
-
const allResponsibleGaming = await callAPIV2(
|
|
48
|
-
|
|
49
|
+
const allResponsibleGaming = await callAPIV2(
|
|
50
|
+
`v0.1/operators/responsible-gamings/sorted`
|
|
51
|
+
);
|
|
52
|
+
const allResponsibleGamingByID = groupBy(allResponsibleGaming, "id");
|
|
49
53
|
|
|
50
54
|
const allMarketsData = Object.values(affSettings)[0].markets_data;
|
|
51
55
|
const allRespGamings = {};
|
|
52
56
|
Object.keys(allMarketsData).map((key) => {
|
|
53
|
-
const value = allMarketsData[key]
|
|
54
|
-
const marketRespGamings = value.responsible_gaming_ids.map(
|
|
57
|
+
const value = allMarketsData[key];
|
|
58
|
+
const marketRespGamings = value.responsible_gaming_ids.map(
|
|
59
|
+
(id) => allResponsibleGamingByID[id][0]
|
|
60
|
+
);
|
|
55
61
|
allRespGamings[key] = marketRespGamings;
|
|
56
|
-
})
|
|
62
|
+
});
|
|
57
63
|
|
|
58
64
|
return allRespGamings;
|
|
59
65
|
}
|
|
@@ -67,15 +73,19 @@ export async function getPages(siteName) {
|
|
|
67
73
|
}
|
|
68
74
|
|
|
69
75
|
export async function getRibbons(params) {
|
|
70
|
-
return callAPIV2(`v0.1/globals/ribbons/sorted${params ? `?${params}` :
|
|
76
|
+
return callAPIV2(`v0.1/globals/ribbons/sorted${params ? `?${params}` : ""}`);
|
|
71
77
|
}
|
|
72
78
|
|
|
73
79
|
export async function getTranslations(siteName, params) {
|
|
74
|
-
return callAPIV2(
|
|
80
|
+
return callAPIV2(
|
|
81
|
+
`v0.1/translations/sorted/${siteName}${params ? `?${params}` : ""}`
|
|
82
|
+
);
|
|
75
83
|
}
|
|
76
84
|
|
|
77
85
|
export async function getOperators(params) {
|
|
78
|
-
return callAPIV2(
|
|
86
|
+
return callAPIV2(
|
|
87
|
+
`v0.1/operators/operators-sorted-v2${params ? `?${params}` : ""}`
|
|
88
|
+
);
|
|
79
89
|
}
|
|
80
90
|
|
|
81
91
|
export async function getCurrencies() {
|
|
@@ -91,11 +101,13 @@ export async function getToplists(siteName) {
|
|
|
91
101
|
}
|
|
92
102
|
|
|
93
103
|
export async function getContent(siteName) {
|
|
94
|
-
return callAPIV2(`v0.1/content/sorted/${siteName}`)
|
|
104
|
+
return callAPIV2(`v0.1/content/sorted/${siteName}`);
|
|
95
105
|
}
|
|
96
106
|
|
|
97
107
|
export async function getPayments(markets = []) {
|
|
98
|
-
return callAPIV2(
|
|
108
|
+
return callAPIV2(
|
|
109
|
+
`v0.1/globals/deposit-methods/sorted-v2/?market_short_codes=${markets.toString()}`
|
|
110
|
+
);
|
|
99
111
|
}
|
|
100
112
|
|
|
101
113
|
export async function getProviders() {
|
|
@@ -103,27 +115,65 @@ export async function getProviders() {
|
|
|
103
115
|
}
|
|
104
116
|
|
|
105
117
|
export async function getGames(params) {
|
|
106
|
-
return callAPIV2(`v0.1/games/games-sorted-v2${params ? `?${params}` :
|
|
118
|
+
return callAPIV2(`v0.1/games/games-sorted-v2${params ? `?${params}` : ""}`);
|
|
107
119
|
}
|
|
108
120
|
|
|
109
|
-
// TO MODIFY and use the new sports API
|
|
121
|
+
// TO MODIFY and use the new sports API
|
|
110
122
|
export async function getSportsData(siteName) {
|
|
111
123
|
let path = `${API_URL}/sites/v0.1/pages/sorted?site_name=${siteName}`;
|
|
112
|
-
|
|
113
|
-
path +=
|
|
114
|
-
console.log(chalk.magenta(
|
|
115
|
-
|
|
124
|
+
|
|
125
|
+
path += "&reverse_order=1&relations=1";
|
|
126
|
+
console.log(chalk.magenta("calling ") + chalk.whiteBright(path));
|
|
127
|
+
|
|
116
128
|
const start = new Date();
|
|
117
129
|
return new Promise((resolve, reject) => {
|
|
118
130
|
axios
|
|
119
131
|
.get(path)
|
|
120
132
|
.then((response) => {
|
|
121
133
|
const end = new Date() - start;
|
|
122
|
-
console.log(
|
|
134
|
+
console.log(
|
|
135
|
+
chalk.green("success") + chalk.whiteBright(` calling hercules - %ds`),
|
|
136
|
+
end / 1000
|
|
137
|
+
);
|
|
123
138
|
resolve(response.data.result.relations.sports_data);
|
|
124
139
|
})
|
|
125
140
|
.catch((error) => {
|
|
126
141
|
reject(error.response.data.errors.join());
|
|
127
142
|
});
|
|
128
143
|
});
|
|
129
|
-
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export async function getTeamJerseys(teamIds) {
|
|
147
|
+
const path = `https://enigma.micro7s.com/v1/sports-api/participants/teamkits?page_size=100`;
|
|
148
|
+
|
|
149
|
+
const config = {
|
|
150
|
+
method: "post",
|
|
151
|
+
url: path,
|
|
152
|
+
headers: {
|
|
153
|
+
"Content-Type": "application/json",
|
|
154
|
+
},
|
|
155
|
+
data: JSON.stringify({
|
|
156
|
+
team_kits_ids: teamIds
|
|
157
|
+
}),
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
console.log(chalk.magenta("calling ") + chalk.whiteBright(path));
|
|
161
|
+
const start = new Date();
|
|
162
|
+
return new Promise((resolve, reject) => {
|
|
163
|
+
axios(config)
|
|
164
|
+
.then((response) => {
|
|
165
|
+
const end = new Date() - start;
|
|
166
|
+
|
|
167
|
+
console.log(
|
|
168
|
+
chalk.green("success") +
|
|
169
|
+
chalk.whiteBright(` calling ${path} API - %ds`),
|
|
170
|
+
end / 1000
|
|
171
|
+
);
|
|
172
|
+
resolve(response.data.results);
|
|
173
|
+
})
|
|
174
|
+
.catch((error) => {
|
|
175
|
+
console.log(error);
|
|
176
|
+
reject(error.response.data.errors.join());
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
}
|
|
@@ -12,12 +12,15 @@ import {
|
|
|
12
12
|
getCurrencies,
|
|
13
13
|
getPayments,
|
|
14
14
|
getProviders,
|
|
15
|
-
getSportsData
|
|
15
|
+
getSportsData,
|
|
16
|
+
getTeamJerseys
|
|
16
17
|
} from "./api.mjs";
|
|
18
|
+
import { groupBy } from "./getters.mjs";
|
|
17
19
|
import { transformOperators } from "./processor/operators.mjs";
|
|
18
20
|
import { transformGames } from "./processor/games.mjs";
|
|
19
21
|
import { transformPayments } from "./processor/payment.mjs";
|
|
20
22
|
import { transformProvider } from "./processor/providers.mjs";
|
|
23
|
+
import { extractParticipantIds } from "./processor/sports-relations.mjs";
|
|
21
24
|
|
|
22
25
|
export const fetchSiteSettings = async (siteName) => {
|
|
23
26
|
const siteSettingsPromise = getSiteSettings(siteName);
|
|
@@ -100,8 +103,12 @@ export const fetchSiteSettings = async (siteName) => {
|
|
|
100
103
|
});
|
|
101
104
|
|
|
102
105
|
let sportsData = null;
|
|
106
|
+
// let teamKitsData = null;
|
|
103
107
|
if(["rage_seo", "rage_ppc", "sports"].includes(siteSettingsData.general[siteId].type)) {
|
|
104
108
|
sportsData = await getSportsData(process.env.GATSBY_SITE_NAME);
|
|
109
|
+
const participantsIds = extractParticipantIds(sportsData.teams)
|
|
110
|
+
const teamKits = await getTeamJerseys(participantsIds);
|
|
111
|
+
sportsData.team_kits = groupBy(teamKits, 'participant_id');
|
|
105
112
|
}
|
|
106
113
|
|
|
107
114
|
return {
|