gatsby-core-theme 44.10.0 → 44.10.11
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/.ci.yml +1 -0
- package/CHANGELOG.md +97 -0
- package/gatsby-config.js +3 -3
- package/gatsby-node.mjs +1 -0
- package/package.json +1 -1
- package/src/components/app-ssr.js +16 -18
- package/src/components/atoms/admin/bar/index.js +6 -2
- package/src/components/atoms/admin/button/index.js +4 -3
- package/src/components/atoms/contact-form/index.js +2 -2
- package/src/components/atoms/market-dropdown/index.js +7 -9
- package/src/components/atoms/notifications/index.js +2 -3
- package/src/components/atoms/ratings/index.js +7 -6
- package/src/components/atoms/review-link/index.js +16 -11
- package/src/components/atoms/search/autocomplete/article/index.js +13 -9
- package/src/components/atoms/search/autocomplete/default/index.js +13 -9
- package/src/components/atoms/search/autocomplete/game/index.js +22 -12
- package/src/components/atoms/search/autocomplete/operator/index.js +26 -18
- package/src/components/molecules/bonus/template-one/index.js +15 -2
- package/src/components/molecules/bonus/template-two/index.js +7 -1
- package/src/components/molecules/cookie-modal/index.js +1 -1
- package/src/components/molecules/floating-area/index.js +6 -12
- package/src/components/molecules/footer/index.js +35 -27
- package/src/components/molecules/footer/variants/template-one/template-one.stories.js +70 -67
- package/src/components/molecules/footer/variants/template-one/template-one.test.js +92 -69
- package/src/components/molecules/footer/variants/template-three/template-three.stories.js +4 -4
- package/src/components/molecules/footer/variants/template-three/template-three.test.js +98 -73
- package/src/components/molecules/footer/variants/template-two/template-two.stories.js +3 -3
- package/src/components/molecules/footer/variants/template-two/template-two.test.js +96 -73
- package/src/components/molecules/header/variants/default/template-one/index.js +15 -13
- package/src/components/molecules/header/variants/default/template-one/template-one.test.js +37 -29
- package/src/components/molecules/header/variants/slot/template-one/templateone.test.js +32 -29
- package/src/components/molecules/leave-comment-form/index.js +90 -79
- package/src/components/molecules/main/index.js +5 -7
- package/src/components/molecules/menu/index.js +28 -30
- package/src/components/molecules/newsletter/form/index.js +2 -2
- package/src/components/molecules/newsletter/index.js +23 -19
- package/src/components/molecules/tnc/index.js +4 -2
- package/src/components/organisms/anchor/template-two/index.js +33 -18
- package/src/components/organisms/footer-navigation/index.js +10 -9
- package/src/components/organisms/navigation/index.js +12 -19
- package/src/constants/ratings-constant.js +7 -9
- package/src/helpers/getters.mjs +3 -3
- package/src/helpers/processImageNode.js +38 -30
- package/src/helpers/processImageNode.test.js +33 -24
- package/src/helpers/replaceMedia.js +2 -2
- package/src/resolver/games.mjs +1 -1
- package/src/resolver/operators.mjs +23 -13
package/src/helpers/getters.mjs
CHANGED
|
@@ -347,9 +347,9 @@ export function getGameIframe(relation, language = null) {
|
|
|
347
347
|
return null;
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
-
export function getOperatorTnc(operator) {
|
|
351
|
-
return operator?.bonuses?.
|
|
352
|
-
? operator.bonuses?.
|
|
350
|
+
export function getOperatorTnc(operator, tracker = "main") {
|
|
351
|
+
return operator?.bonuses?.[tracker]?.terms_and_conditions_enabled
|
|
352
|
+
? operator.bonuses?.[tracker]?.terms_and_conditions
|
|
353
353
|
: null;
|
|
354
354
|
}
|
|
355
355
|
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
// imageProcessor.js
|
|
2
|
-
import React from
|
|
3
|
-
import LazyImage from
|
|
4
|
-
import { parseContentImageUrl } from
|
|
5
|
-
import { parseCss } from
|
|
6
|
-
import styles from
|
|
2
|
+
import React from "react";
|
|
3
|
+
import LazyImage from "~hooks/lazy-image";
|
|
4
|
+
import { parseContentImageUrl } from "~helpers/strings";
|
|
5
|
+
import { parseCss } from "~helpers/css-parser";
|
|
6
|
+
import styles from "../components/molecules/content/content.module.scss";
|
|
7
7
|
|
|
8
8
|
const getValueFromStyle = (style, cssAttribute) => {
|
|
9
|
-
const regex = new RegExp(
|
|
9
|
+
const regex = new RegExp(
|
|
10
|
+
`${cssAttribute}:\\s*([0-9]+(?:\\.[0-9]+)?)px?`,
|
|
11
|
+
"i"
|
|
12
|
+
);
|
|
10
13
|
const match = style?.match(regex);
|
|
11
14
|
return match ? Math?.floor(parseFloat(match[1])) : null;
|
|
12
15
|
};
|
|
@@ -14,44 +17,49 @@ const getValueFromStyle = (style, cssAttribute) => {
|
|
|
14
17
|
const processImageNode = (node, moduleWidth = 960, loading) => {
|
|
15
18
|
let stylesClass = null;
|
|
16
19
|
const classes = node.attribs.class;
|
|
17
|
-
if (classes?.includes(
|
|
18
|
-
stylesClass =
|
|
19
|
-
} else if (classes?.includes(
|
|
20
|
-
stylesClass =
|
|
21
|
-
} else if (classes?.includes(
|
|
22
|
-
stylesClass =
|
|
23
|
-
} else if (classes?.includes(
|
|
24
|
-
stylesClass =
|
|
25
|
-
} else if (classes?.includes(
|
|
26
|
-
stylesClass =
|
|
20
|
+
if (classes?.includes("content-image--float-left")) {
|
|
21
|
+
stylesClass = "floatLeft";
|
|
22
|
+
} else if (classes?.includes("content-image--float-right")) {
|
|
23
|
+
stylesClass = "floatRight";
|
|
24
|
+
} else if (classes?.includes("content-image--align-center")) {
|
|
25
|
+
stylesClass = "alignCenter";
|
|
26
|
+
} else if (classes?.includes("content-image--align-left")) {
|
|
27
|
+
stylesClass = "alignLeft";
|
|
28
|
+
} else if (classes?.includes("content-image--align-right")) {
|
|
29
|
+
stylesClass = "alignRight";
|
|
27
30
|
}
|
|
28
31
|
|
|
29
|
-
const imgWidthData =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
||
|
|
32
|
+
const imgWidthData =
|
|
33
|
+
node?.attribs?.width ||
|
|
34
|
+
node?.attribs?.["data-width"] ||
|
|
35
|
+
getValueFromStyle(node?.attribs?.style, "width") ||
|
|
36
|
+
"";
|
|
33
37
|
|
|
34
|
-
const imgHeightData =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
||
|
|
38
|
+
const imgHeightData =
|
|
39
|
+
node?.attribs?.height ||
|
|
40
|
+
node?.attribs?.["data-height"] ||
|
|
41
|
+
getValueFromStyle(node?.attribs?.style, "height") ||
|
|
42
|
+
"";
|
|
38
43
|
|
|
39
44
|
// Parse the width and height as numbers
|
|
40
45
|
const originalWidth = parseFloat(imgWidthData);
|
|
41
|
-
const originalHeight =
|
|
46
|
+
const originalHeight =
|
|
47
|
+
imgHeightData === "auto" ? 298 : parseFloat(imgHeightData);
|
|
42
48
|
|
|
43
49
|
// If width is greater than moduleWidth, adjust the width to moduleWidth and scale height accordingly
|
|
44
|
-
const imgWidth =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
const imgWidth =
|
|
51
|
+
originalWidth > moduleWidth ? moduleWidth : originalWidth || "";
|
|
52
|
+
const imgHeight =
|
|
53
|
+
originalWidth > moduleWidth
|
|
54
|
+
? Math.round((originalHeight / originalWidth) * moduleWidth)
|
|
55
|
+
: originalHeight || "";
|
|
48
56
|
|
|
49
57
|
const lazyProps = {
|
|
50
58
|
src: parseContentImageUrl(node.attribs.src, imgWidth, imgHeight),
|
|
51
59
|
width: imgWidth,
|
|
52
60
|
height: imgHeight,
|
|
53
61
|
style: node.attribs.style ? parseCss(node.attribs.style) : null,
|
|
54
|
-
alt: node.attribs.alt ? node.attribs.alt :
|
|
62
|
+
alt: node.attribs.alt ? node.attribs.alt : "",
|
|
55
63
|
className: styles[stylesClass],
|
|
56
64
|
};
|
|
57
65
|
|
|
@@ -1,41 +1,50 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { render } from
|
|
3
|
-
import processImageNode from
|
|
4
|
-
import LazyImage from
|
|
5
|
-
import { parseContentImageUrl } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@testing-library/react";
|
|
3
|
+
import processImageNode from "./processImageNode";
|
|
4
|
+
import LazyImage from "~hooks/lazy-image";
|
|
5
|
+
import { parseContentImageUrl } from "~helpers/strings";
|
|
6
6
|
|
|
7
|
-
jest.mock(
|
|
8
|
-
jest.mock(
|
|
7
|
+
jest.mock("~hooks/lazy-image", () => jest.fn());
|
|
8
|
+
jest.mock("~helpers/strings", () => ({
|
|
9
9
|
parseContentImageUrl: jest.fn(),
|
|
10
10
|
}));
|
|
11
11
|
|
|
12
|
-
describe(
|
|
12
|
+
describe("processImageNode", () => {
|
|
13
13
|
const node = {
|
|
14
14
|
attribs: {
|
|
15
|
-
class:
|
|
16
|
-
src:
|
|
17
|
-
width:
|
|
18
|
-
height:
|
|
19
|
-
style:
|
|
20
|
-
alt:
|
|
15
|
+
class: "content-image--align-center",
|
|
16
|
+
src: "image-src",
|
|
17
|
+
width: "500px",
|
|
18
|
+
height: "auto",
|
|
19
|
+
style: "width: 500px; height: auto;",
|
|
20
|
+
alt: "image description",
|
|
21
21
|
},
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
beforeEach(() => {
|
|
25
|
-
LazyImage.mockImplementation(
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
LazyImage.mockImplementation(
|
|
26
|
+
({ src, width, height, style, alt, className }) => (
|
|
27
|
+
<img
|
|
28
|
+
src={src}
|
|
29
|
+
width={width}
|
|
30
|
+
height={height}
|
|
31
|
+
style={style}
|
|
32
|
+
alt={alt}
|
|
33
|
+
className={className}
|
|
34
|
+
/>
|
|
35
|
+
)
|
|
36
|
+
);
|
|
28
37
|
});
|
|
29
38
|
|
|
30
|
-
test(
|
|
31
|
-
parseContentImageUrl.mockReturnValue(
|
|
39
|
+
test("renders LazyImage with correct props", () => {
|
|
40
|
+
parseContentImageUrl.mockReturnValue("parsed-image-url");
|
|
32
41
|
|
|
33
42
|
const { getByAltText } = render(processImageNode(node));
|
|
34
|
-
const img = getByAltText(
|
|
43
|
+
const img = getByAltText("image description");
|
|
35
44
|
|
|
36
|
-
expect(img).toHaveAttribute(
|
|
37
|
-
expect(img).toHaveAttribute(
|
|
38
|
-
expect(img).toHaveAttribute(
|
|
39
|
-
expect(img).toHaveClass(
|
|
45
|
+
expect(img).toHaveAttribute("src", "parsed-image-url");
|
|
46
|
+
expect(img).toHaveAttribute("width", "500");
|
|
47
|
+
expect(img).toHaveAttribute("height", "298");
|
|
48
|
+
expect(img).toHaveClass("alignCenter");
|
|
40
49
|
});
|
|
41
50
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable react/destructuring-assignment */
|
|
2
2
|
import React from "react";
|
|
3
|
-
import Iframe from "
|
|
4
|
-
import { isTrackerLink } from "
|
|
3
|
+
import Iframe from "~atoms/iframe";
|
|
4
|
+
import { isTrackerLink } from "~helpers/tracker.mjs";
|
|
5
5
|
import processImageNode from "./processImageNode.js";
|
|
6
6
|
import { TrackingKeys } from "~constants/tracking-api";
|
|
7
7
|
import PrettyLink from "~atoms/pretty-link";
|
package/src/resolver/games.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
2
|
import loadash from "lodash/index.js";
|
|
3
|
-
import { filterNonNullValues } from "
|
|
3
|
+
import { filterNonNullValues } from "../helpers/getters.mjs";
|
|
4
4
|
import { pickRelationKeys } from "../constants/pick-keys.mjs";
|
|
5
5
|
import { getProviderData } from "./providers.mjs";
|
|
6
6
|
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
2
|
import loadash from "lodash/index.js";
|
|
3
|
-
import {
|
|
4
|
-
getExtraField,
|
|
5
|
-
filterNonNullValues,
|
|
6
|
-
} from "gatsby-core-theme/src/helpers/getters.mjs";
|
|
3
|
+
import { getExtraField, filterNonNullValues } from "../helpers/getters.mjs";
|
|
7
4
|
import { pickRelationKeys } from "../constants/pick-keys.mjs";
|
|
8
5
|
import {
|
|
9
6
|
processLogo,
|
|
@@ -11,13 +8,18 @@ import {
|
|
|
11
8
|
processCountries,
|
|
12
9
|
processCurrencies,
|
|
13
10
|
processProviders,
|
|
14
|
-
processGamblingCompanies
|
|
11
|
+
processGamblingCompanies,
|
|
15
12
|
} from "./relations.mjs";
|
|
16
13
|
|
|
17
14
|
const { cloneDeep, pick } = loadash;
|
|
18
15
|
|
|
19
16
|
// eslint-disable-next-line import/prefer-default-export
|
|
20
|
-
export function sanitizeOperatorData(
|
|
17
|
+
export function sanitizeOperatorData(
|
|
18
|
+
operator,
|
|
19
|
+
operatorPage = [],
|
|
20
|
+
data = [],
|
|
21
|
+
toplistLabel = null
|
|
22
|
+
) {
|
|
21
23
|
if (!operator) {
|
|
22
24
|
return null;
|
|
23
25
|
}
|
|
@@ -65,10 +67,15 @@ export function sanitizeOperatorData(operator, operatorPage = [], data = [], top
|
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
if (operatorPage.length >= 1) {
|
|
68
|
-
operatorClone.review_link = operatorPage[0].path
|
|
70
|
+
operatorClone.review_link = operatorPage[0].path;
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
return pick(
|
|
73
|
+
return pick(
|
|
74
|
+
operatorClone,
|
|
75
|
+
toplistLabel && toplistLabel.includes("simplified")
|
|
76
|
+
? pickRelationKeys.operator_simplified
|
|
77
|
+
: pickRelationKeys.operator
|
|
78
|
+
);
|
|
72
79
|
}
|
|
73
80
|
|
|
74
81
|
export function transformOperators(jsonData, relationsData, pages) {
|
|
@@ -139,9 +146,12 @@ export function transformOperators(jsonData, relationsData, pages) {
|
|
|
139
146
|
// // Best_game
|
|
140
147
|
if (newOperatorData?.best_game_id) {
|
|
141
148
|
const bestGameKey = Object?.keys(relationsData?.games)?.find(
|
|
142
|
-
(key) =>
|
|
149
|
+
(key) =>
|
|
150
|
+
relationsData?.games[key]?.game_id ===
|
|
151
|
+
newOperatorData?.best_game_id
|
|
143
152
|
);
|
|
144
|
-
newOperatorData.best_game =
|
|
153
|
+
newOperatorData.best_game =
|
|
154
|
+
relationsData?.games?.[bestGameKey] || null;
|
|
145
155
|
}
|
|
146
156
|
|
|
147
157
|
// Providers
|
|
@@ -151,11 +161,11 @@ export function transformOperators(jsonData, relationsData, pages) {
|
|
|
151
161
|
);
|
|
152
162
|
const operatorPage = Object.values(pages).filter(
|
|
153
163
|
(page) =>
|
|
154
|
-
page.relation_type === "operator" &&
|
|
164
|
+
page.relation_type === "operator" &&
|
|
165
|
+
page.type === "operator" &&
|
|
155
166
|
page.relation_id === newOperatorData.id
|
|
156
|
-
|
|
157
167
|
);
|
|
158
|
-
|
|
168
|
+
|
|
159
169
|
operators[affiliate.id] = sanitizeOperatorData(
|
|
160
170
|
newOperatorData,
|
|
161
171
|
operatorPage,
|