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.
Files changed (47) hide show
  1. package/.ci.yml +1 -0
  2. package/CHANGELOG.md +97 -0
  3. package/gatsby-config.js +3 -3
  4. package/gatsby-node.mjs +1 -0
  5. package/package.json +1 -1
  6. package/src/components/app-ssr.js +16 -18
  7. package/src/components/atoms/admin/bar/index.js +6 -2
  8. package/src/components/atoms/admin/button/index.js +4 -3
  9. package/src/components/atoms/contact-form/index.js +2 -2
  10. package/src/components/atoms/market-dropdown/index.js +7 -9
  11. package/src/components/atoms/notifications/index.js +2 -3
  12. package/src/components/atoms/ratings/index.js +7 -6
  13. package/src/components/atoms/review-link/index.js +16 -11
  14. package/src/components/atoms/search/autocomplete/article/index.js +13 -9
  15. package/src/components/atoms/search/autocomplete/default/index.js +13 -9
  16. package/src/components/atoms/search/autocomplete/game/index.js +22 -12
  17. package/src/components/atoms/search/autocomplete/operator/index.js +26 -18
  18. package/src/components/molecules/bonus/template-one/index.js +15 -2
  19. package/src/components/molecules/bonus/template-two/index.js +7 -1
  20. package/src/components/molecules/cookie-modal/index.js +1 -1
  21. package/src/components/molecules/floating-area/index.js +6 -12
  22. package/src/components/molecules/footer/index.js +35 -27
  23. package/src/components/molecules/footer/variants/template-one/template-one.stories.js +70 -67
  24. package/src/components/molecules/footer/variants/template-one/template-one.test.js +92 -69
  25. package/src/components/molecules/footer/variants/template-three/template-three.stories.js +4 -4
  26. package/src/components/molecules/footer/variants/template-three/template-three.test.js +98 -73
  27. package/src/components/molecules/footer/variants/template-two/template-two.stories.js +3 -3
  28. package/src/components/molecules/footer/variants/template-two/template-two.test.js +96 -73
  29. package/src/components/molecules/header/variants/default/template-one/index.js +15 -13
  30. package/src/components/molecules/header/variants/default/template-one/template-one.test.js +37 -29
  31. package/src/components/molecules/header/variants/slot/template-one/templateone.test.js +32 -29
  32. package/src/components/molecules/leave-comment-form/index.js +90 -79
  33. package/src/components/molecules/main/index.js +5 -7
  34. package/src/components/molecules/menu/index.js +28 -30
  35. package/src/components/molecules/newsletter/form/index.js +2 -2
  36. package/src/components/molecules/newsletter/index.js +23 -19
  37. package/src/components/molecules/tnc/index.js +4 -2
  38. package/src/components/organisms/anchor/template-two/index.js +33 -18
  39. package/src/components/organisms/footer-navigation/index.js +10 -9
  40. package/src/components/organisms/navigation/index.js +12 -19
  41. package/src/constants/ratings-constant.js +7 -9
  42. package/src/helpers/getters.mjs +3 -3
  43. package/src/helpers/processImageNode.js +38 -30
  44. package/src/helpers/processImageNode.test.js +33 -24
  45. package/src/helpers/replaceMedia.js +2 -2
  46. package/src/resolver/games.mjs +1 -1
  47. package/src/resolver/operators.mjs +23 -13
@@ -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?.main?.terms_and_conditions_enabled
352
- ? operator.bonuses?.main?.terms_and_conditions
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 'react';
3
- import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
4
- import { parseContentImageUrl } from 'gatsby-core-theme/src/helpers/strings';
5
- import { parseCss } from 'gatsby-core-theme/src/helpers/css-parser';
6
- import styles from '../components/molecules/content/content.module.scss';
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(`${cssAttribute}:\\s*([0-9]+(?:\\.[0-9]+)?)px?`, 'i');
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('content-image--float-left')) {
18
- stylesClass = 'floatLeft';
19
- } else if (classes?.includes('content-image--float-right')) {
20
- stylesClass = 'floatRight';
21
- } else if (classes?.includes('content-image--align-center')) {
22
- stylesClass = 'alignCenter';
23
- } else if (classes?.includes('content-image--align-left')) {
24
- stylesClass = 'alignLeft';
25
- } else if (classes?.includes('content-image--align-right')) {
26
- stylesClass = 'alignRight';
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 = node?.attribs?.width
30
- || node?.attribs?.['data-width']
31
- || getValueFromStyle(node?.attribs?.style, 'width')
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 = node?.attribs?.height
35
- || node?.attribs?.['data-height']
36
- || getValueFromStyle(node?.attribs?.style, 'height')
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 = (imgHeightData === 'auto') ? 298 : parseFloat(imgHeightData);
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 = originalWidth > moduleWidth ? moduleWidth : originalWidth || '';
45
- const imgHeight = originalWidth > moduleWidth
46
- ? Math.round((originalHeight / originalWidth) * moduleWidth)
47
- : originalHeight || '';
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 'react';
2
- import { render } from '@testing-library/react';
3
- import processImageNode from './processImageNode';
4
- import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
5
- import { parseContentImageUrl } from 'gatsby-core-theme/src/helpers/strings';
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('gatsby-core-theme/src/hooks/lazy-image', () => jest.fn());
8
- jest.mock('gatsby-core-theme/src/helpers/strings', () => ({
7
+ jest.mock("~hooks/lazy-image", () => jest.fn());
8
+ jest.mock("~helpers/strings", () => ({
9
9
  parseContentImageUrl: jest.fn(),
10
10
  }));
11
11
 
12
- describe('processImageNode', () => {
12
+ describe("processImageNode", () => {
13
13
  const node = {
14
14
  attribs: {
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',
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(({ src, width, height, style, alt, className }) => (
26
- <img src={src} width={width} height={height} style={style} alt={alt} className={className} />
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('renders LazyImage with correct props', () => {
31
- parseContentImageUrl.mockReturnValue('parsed-image-url');
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('image description');
43
+ const img = getByAltText("image description");
35
44
 
36
- expect(img).toHaveAttribute('src', 'parsed-image-url');
37
- expect(img).toHaveAttribute('width', '500');
38
- expect(img).toHaveAttribute('height', '298');
39
- expect(img).toHaveClass('alignCenter');
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 "gatsby-core-theme/src/components/atoms/iframe";
4
- import { isTrackerLink } from "gatsby-core-theme/src/helpers/tracker.mjs";
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";
@@ -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 "gatsby-core-theme/src/helpers/getters.mjs";
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(operator, operatorPage = [], data = [], toplistLabel = null) {
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(operatorClone, toplistLabel && toplistLabel.includes('simplified') ? pickRelationKeys.operator_simplified : pickRelationKeys.operator);
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) => relationsData?.games[key]?.game_id === newOperatorData?.best_game_id
149
+ (key) =>
150
+ relationsData?.games[key]?.game_id ===
151
+ newOperatorData?.best_game_id
143
152
  );
144
- newOperatorData.best_game = relationsData?.games?.[bestGameKey] || null;
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" && page.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,