gatsby-core-theme 44.0.11 → 44.0.13
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 +21 -0
- package/package.json +1 -1
- package/src/components/atoms/button/button.js +44 -25
- package/src/components/organisms/toplist/index.js +1 -1
- package/src/components/organisms/toplist/list/index.js +28 -25
- package/src/helpers/tracker.mjs +1 -0
- package/src/helpers/tracker.test.js +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## [44.0.13](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.0.12...v44.0.13) (2025-04-04)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add button for load more ([d16d21b](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/d16d21bf6c5bed846a062de234ce443a58fec8f7))
|
|
7
|
+
* load more defaults ([7e00473](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/7e004730369a8efbaac84889b445a5d7af2ed629))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
* Merge branch 'tm-5374-loadmore' into 'master' ([53d0c78](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/53d0c78d6099efbf70484cc93849108a57843367))
|
|
11
|
+
|
|
12
|
+
## [44.0.12](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.0.11...v44.0.12) (2025-04-03)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* include cookie in tracker api ([a4a5968](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/a4a5968cacd3a5dfbcc381e3156f762d0541ff53))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
* Merge branch 'tracker_api' into 'master' ([bba03b2](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/bba03b25cbfb19ecd33865f0aae67c7ee62ecfa4))
|
|
21
|
+
|
|
1
22
|
## [44.0.11](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.0.10...v44.0.11) (2025-04-03)
|
|
2
23
|
|
|
3
24
|
|
package/package.json
CHANGED
|
@@ -1,26 +1,34 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
3
|
|
|
4
|
-
import Link from
|
|
5
|
-
import styles from
|
|
4
|
+
import Link from "~hooks/link";
|
|
5
|
+
import styles from "./button.module.scss";
|
|
6
6
|
|
|
7
7
|
function Button({
|
|
8
8
|
to = null,
|
|
9
|
-
btnText =
|
|
9
|
+
btnText = "Play now",
|
|
10
10
|
targetBlank = false,
|
|
11
|
-
buttonType =
|
|
12
|
-
buttonSize =
|
|
11
|
+
buttonType = "primary",
|
|
12
|
+
buttonSize = "m",
|
|
13
13
|
isInternalLink = true,
|
|
14
14
|
onClick = null,
|
|
15
15
|
icon = null,
|
|
16
|
+
tag = "a",
|
|
16
17
|
}) {
|
|
17
|
-
const classes = `${styles[buttonType] ||
|
|
18
|
+
const classes = `${styles[buttonType] || ""} ${
|
|
19
|
+
buttonSize ? styles[`${buttonSize}_size`] : ""
|
|
20
|
+
} `;
|
|
18
21
|
|
|
19
|
-
const btnTitle = typeof btnText ===
|
|
22
|
+
const btnTitle = typeof btnText === "string" ? btnText : "";
|
|
20
23
|
|
|
21
24
|
if (isInternalLink) {
|
|
22
25
|
return (
|
|
23
|
-
<Link
|
|
26
|
+
<Link
|
|
27
|
+
className={`${classes}`}
|
|
28
|
+
to={to}
|
|
29
|
+
title={btnTitle}
|
|
30
|
+
aria-label={btnTitle}
|
|
31
|
+
>
|
|
24
32
|
{btnText}
|
|
25
33
|
{icon && icon}
|
|
26
34
|
</Link>
|
|
@@ -32,24 +40,34 @@ function Button({
|
|
|
32
40
|
|
|
33
41
|
if (onClick) {
|
|
34
42
|
extraProps = {
|
|
35
|
-
role:
|
|
43
|
+
role: "button",
|
|
36
44
|
};
|
|
37
45
|
}
|
|
38
46
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
switch (tag) {
|
|
48
|
+
case "button":
|
|
49
|
+
return (
|
|
50
|
+
<button type="button" onClick={onClick} className={`${classes || ""}`}>
|
|
51
|
+
{btnText}
|
|
52
|
+
{icon && icon}
|
|
53
|
+
</button>
|
|
54
|
+
);
|
|
55
|
+
default:
|
|
56
|
+
return (
|
|
57
|
+
<a
|
|
58
|
+
title={btnTitle}
|
|
59
|
+
aria-label={btnTitle}
|
|
60
|
+
target={targetBlank ? "_blank" : ""}
|
|
61
|
+
rel="nofollow"
|
|
62
|
+
className={`${classes || ""}`}
|
|
63
|
+
{...linkAttr}
|
|
64
|
+
{...extraProps}
|
|
65
|
+
>
|
|
66
|
+
{btnText}
|
|
67
|
+
{icon && icon}
|
|
68
|
+
</a>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
53
71
|
}
|
|
54
72
|
|
|
55
73
|
Button.propTypes = {
|
|
@@ -61,6 +79,7 @@ Button.propTypes = {
|
|
|
61
79
|
buttonType: PropTypes.string,
|
|
62
80
|
buttonSize: PropTypes.string,
|
|
63
81
|
onClick: PropTypes.func,
|
|
82
|
+
tag: PropTypes.string,
|
|
64
83
|
};
|
|
65
84
|
|
|
66
85
|
export default Button;
|
|
@@ -26,7 +26,7 @@ const TopList = ({
|
|
|
26
26
|
toplist={toplist}
|
|
27
27
|
hasLoadMoreButton={toplist.show_load_more}
|
|
28
28
|
initItemsCount={toplist.num_items_initial_load || 0}
|
|
29
|
-
loadItemsCount={toplist.num_items_load_more}
|
|
29
|
+
loadItemsCount={toplist.num_items_load_more || 0}
|
|
30
30
|
pageTemplate={page?.template}
|
|
31
31
|
moduleName={moduleName}
|
|
32
32
|
module={module}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* eslint-disable no-return-assign */
|
|
2
|
-
import React, { useRef } from
|
|
3
|
-
import PropTypes from
|
|
4
|
-
import keygen from
|
|
5
|
-
import Button from
|
|
6
|
-
import Row from
|
|
7
|
-
import styles from
|
|
2
|
+
import React, { useRef } from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import keygen from "~helpers/keygen";
|
|
5
|
+
import Button from "~atoms/button/button";
|
|
6
|
+
import Row from "~molecules/toplist/default-row";
|
|
7
|
+
import styles from "./list.module.scss";
|
|
8
8
|
|
|
9
9
|
export default function List({
|
|
10
10
|
toplist,
|
|
@@ -15,42 +15,44 @@ export default function List({
|
|
|
15
15
|
moduleName,
|
|
16
16
|
pagePath,
|
|
17
17
|
modulePosition,
|
|
18
|
-
buttonType =
|
|
19
|
-
buttonSize =
|
|
18
|
+
buttonType = "tertiary",
|
|
19
|
+
buttonSize = "m",
|
|
20
20
|
}) {
|
|
21
21
|
const initLoadItems =
|
|
22
|
-
Number(initItemsCount) !== 0 ? Number(initItemsCount) : 10000
|
|
22
|
+
Number(initItemsCount) !== 0 ? Number(initItemsCount) : 10000;
|
|
23
23
|
const loadingItems =
|
|
24
|
-
Number(loadItemsCount) !== 0 ? Number(loadItemsCount) : 10000
|
|
24
|
+
Number(loadItemsCount) !== 0 ? Number(loadItemsCount) : 10000;
|
|
25
25
|
|
|
26
|
-
const elRefs = useRef([])
|
|
26
|
+
const elRefs = useRef([]);
|
|
27
27
|
|
|
28
|
-
const loadMoreBtn = useRef(React.createRef())
|
|
28
|
+
const loadMoreBtn = useRef(React.createRef());
|
|
29
29
|
const showLoadMoreButton =
|
|
30
|
-
hasLoadMoreButton ===
|
|
30
|
+
hasLoadMoreButton === "1" && Number(initItemsCount) !== 0;
|
|
31
31
|
|
|
32
32
|
function handleClick() {
|
|
33
33
|
const displayed = elRefs.current.filter((item) =>
|
|
34
34
|
item.classList.contains(styles.show)
|
|
35
|
-
).length
|
|
36
|
-
|
|
35
|
+
).length;
|
|
36
|
+
|
|
37
|
+
const nextItem = loadingItems + displayed;
|
|
38
|
+
|
|
37
39
|
const lastItem =
|
|
38
40
|
nextItem > elRefs.current.length
|
|
39
41
|
? elRefs.current.length + 1
|
|
40
|
-
: displayed + loadingItems
|
|
42
|
+
: displayed + loadingItems;
|
|
41
43
|
|
|
42
44
|
elRefs.current
|
|
43
45
|
.slice(displayed, lastItem)
|
|
44
|
-
.forEach((item) => item.classList.toggle(styles.show))
|
|
46
|
+
.forEach((item) => item.classList.toggle(styles.show));
|
|
45
47
|
|
|
46
|
-
if (loadingItems + displayed
|
|
47
|
-
loadMoreBtn.current.classList.toggle(styles.hide)
|
|
48
|
+
if (loadingItems + displayed >= elRefs.current.length) {
|
|
49
|
+
loadMoreBtn.current.classList.toggle(styles.hide);
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
return (
|
|
52
54
|
<>
|
|
53
|
-
<ol className={styles.list ||
|
|
55
|
+
<ol className={styles.list || ""} key={keygen()}>
|
|
54
56
|
{toplist.items?.map((item, index) => (
|
|
55
57
|
<Row
|
|
56
58
|
pagePath={pagePath}
|
|
@@ -69,29 +71,30 @@ export default function List({
|
|
|
69
71
|
))}
|
|
70
72
|
</ol>
|
|
71
73
|
{showLoadMoreButton && (
|
|
72
|
-
<div ref={loadMoreBtn} className={styles.loadMore ||
|
|
74
|
+
<div ref={loadMoreBtn} className={styles.loadMore || ""}>
|
|
73
75
|
<Button
|
|
74
76
|
isInternalLink={false}
|
|
75
77
|
btnText="Load More"
|
|
76
78
|
onClick={() => handleClick()}
|
|
77
79
|
buttonType={buttonType}
|
|
78
80
|
buttonSize={buttonSize}
|
|
81
|
+
tag="button"
|
|
79
82
|
/>
|
|
80
83
|
</div>
|
|
81
84
|
)}
|
|
82
85
|
</>
|
|
83
|
-
)
|
|
86
|
+
);
|
|
84
87
|
}
|
|
85
88
|
|
|
86
89
|
List.propTypes = {
|
|
87
90
|
toplist: PropTypes.shape({
|
|
88
91
|
items: PropTypes.arrayOf(
|
|
89
92
|
PropTypes.shape({
|
|
90
|
-
name: PropTypes.string
|
|
93
|
+
name: PropTypes.string,
|
|
91
94
|
})
|
|
92
95
|
),
|
|
93
96
|
tracker: PropTypes.string,
|
|
94
|
-
one_liner: PropTypes.string
|
|
97
|
+
one_liner: PropTypes.string,
|
|
95
98
|
}),
|
|
96
99
|
hasLoadMoreButton: PropTypes.number,
|
|
97
100
|
initItemsCount: PropTypes.string,
|
|
@@ -102,4 +105,4 @@ List.propTypes = {
|
|
|
102
105
|
moduleName: PropTypes.string,
|
|
103
106
|
buttonType: PropTypes.string,
|
|
104
107
|
buttonSize: PropTypes.string,
|
|
105
|
-
}
|
|
108
|
+
};
|
package/src/helpers/tracker.mjs
CHANGED
|
@@ -128,6 +128,7 @@ function buildUrlParams(operator, trackerName, headers, cookie, extraParams) {
|
|
|
128
128
|
split_test_variant: cookie.split_test_variant || null,
|
|
129
129
|
pii_guard_id: cookie._gi || null,
|
|
130
130
|
facebook_pixel_id: process.env.PIXEL_ID || null,
|
|
131
|
+
cookie: JSON.stringify(cookie),
|
|
131
132
|
...(affObject || {}),
|
|
132
133
|
...(affObject && !affObject.referer ? { referer: headers?.get("referrer") } : {}),
|
|
133
134
|
...(extraParams || {}),
|
|
@@ -115,10 +115,11 @@ describe("Tracker Helper", () => {
|
|
|
115
115
|
tracker_name: tracker.name,
|
|
116
116
|
market_short_code: operator.market,
|
|
117
117
|
ip_address: "127.0.0.1",
|
|
118
|
+
cookie: '{"affObject":"{}"}'
|
|
118
119
|
};
|
|
119
120
|
|
|
120
|
-
expect(fetch).
|
|
121
|
-
expect(fetch).
|
|
121
|
+
expect(fetch).toHaveBeenCalledTimes(1);
|
|
122
|
+
expect(fetch).toHaveBeenCalledWith(
|
|
122
123
|
`${process.env.GATSBY_TRACKING_API_URL}?${new URLSearchParams(
|
|
123
124
|
urlParam
|
|
124
125
|
).toString()}`,
|
|
@@ -137,7 +138,7 @@ describe("Tracker Helper", () => {
|
|
|
137
138
|
|
|
138
139
|
expect(fetch).toHaveBeenCalledTimes(1);
|
|
139
140
|
expect(fetch).toHaveBeenCalledWith(
|
|
140
|
-
"testlink?site_id=82&operator_short_name=rizk&operator_type=sportsbook&language=en&tracker_name=main&market_short_code=ie_en&ip_address=127.0.0.1&extraparam=val&extraparam2=val2",
|
|
141
|
+
"testlink?site_id=82&operator_short_name=rizk&operator_type=sportsbook&language=en&tracker_name=main&market_short_code=ie_en&ip_address=127.0.0.1&cookie=%7B%22affObject%22%3A%22%7B%7D%22%7D&extraparam=val&extraparam2=val2",
|
|
141
142
|
{ headers: {} }
|
|
142
143
|
);
|
|
143
144
|
});
|