gatsby-core-theme 44.25.1 → 44.25.2

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 CHANGED
@@ -1,3 +1,16 @@
1
+ ## [44.25.2](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.25.1...v44.25.2) (2026-06-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * generate volatility based on backend possible values ([6a920e5](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/6a920e55890da0d83db773b622e2a41ee9b3848a))
7
+ * generate volatility based on backend possible values ([bd342b1](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/bd342b15b79bad834045c5ed5fcb1da2aa9f049c))
8
+ * generate volatility based on backend values ([6f1e2f0](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/6f1e2f0140c90724fc92b53b88a49b143d807f36))
9
+ * generate volatility based on backend values ([c375b5e](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/c375b5e4bc5339bc13f4795830e1416f014daae3))
10
+
11
+
12
+ * Merge branch 'generate-volatility' into 'master' ([d24c9a3](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/d24c9a30437ec9faf506dd5f17ba5161b3ecbce1))
13
+
1
14
  ## [44.25.1](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.25.0...v44.25.1) (2026-06-02)
2
15
 
3
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "44.25.1",
3
+ "version": "44.25.2",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -4,6 +4,7 @@
4
4
  import React from "react";
5
5
  import PropTypes from "prop-types";
6
6
  import { getObjectValue } from "~helpers/getters";
7
+ import getVolatilityTranslationMeta from "~helpers/volatility";
7
8
  import keygen from "~helpers/keygen";
8
9
  import useTranslate from "~hooks/useTranslate/useTranslate";
9
10
  import { operatorRatings } from "../../../constants/ratings-constant";
@@ -25,12 +26,6 @@ export default function Ratings({
25
26
 
26
27
  const ratings = operatorRatings[typeCheck] || [];
27
28
 
28
- const rangeText = {
29
- 0: useTranslate("range_low", "Low"),
30
- 1: useTranslate("range_medium", "Medium"),
31
- 2: useTranslate("range_high", "High"),
32
- };
33
-
34
29
  if (!ratings.length) {
35
30
  return null;
36
31
  }
@@ -46,11 +41,13 @@ export default function Ratings({
46
41
  const component = componentToUse
47
42
  ? componentToUse(numOfStars, value, currency)
48
43
  : false;
44
+ const volatilityValue = getObjectValue(item, fieldValue);
49
45
 
50
46
  if (component && value) {
51
47
  valueDiplayed = component || "-";
52
48
  } else if (fieldValue.includes("volatility")) {
53
- valueDiplayed = rangeText[getObjectValue(item, fieldValue)] || "-";
49
+ const { key, displayValue } = getVolatilityTranslationMeta(volatilityValue);
50
+ valueDiplayed = key ? useTranslate(key, displayValue) : displayValue;
54
51
  } else {
55
52
  valueDiplayed = value || "-";
56
53
  }
@@ -18,7 +18,7 @@ describe('Rating component', () => {
18
18
  third_rating: '3',
19
19
  fourth_rating: true,
20
20
  type: 'casino',
21
- volatility: 1,
21
+ volatility: 'medium',
22
22
  bonus: {
23
23
  rating: '4',
24
24
  rating_bonuses: '',
@@ -41,7 +41,7 @@ describe('Rating component', () => {
41
41
  expect(container.querySelectorAll('li')).toHaveLength(5);
42
42
 
43
43
  expect(getAllByText(3)).toHaveLength(2);
44
- expect(container.querySelectorAll('.item')[4]).toHaveTextContent('Medium');
44
+ expect(container.querySelectorAll('.item')[4]).toHaveTextContent('medium');
45
45
  });
46
46
 
47
47
  test('Rating no type', () => {
@@ -0,0 +1,17 @@
1
+ function getVolatilityTranslationMeta(value) {
2
+ if (value == null || value === "") {
3
+ return { key: null, displayValue: "-" };
4
+ }
5
+
6
+ const normalizedValue = String(value).trim();
7
+ const normalizedKey = normalizedValue
8
+ .toLowerCase()
9
+ .replace(/[–-\s]/g, "_");
10
+
11
+ return {
12
+ key: `range_${normalizedKey}`,
13
+ displayValue: normalizedValue,
14
+ };
15
+ }
16
+
17
+ export default getVolatilityTranslationMeta;
@@ -0,0 +1,33 @@
1
+ import getVolatilityTranslationMeta from "./volatility";
2
+
3
+ describe("Volatility helper", () => {
4
+ test("maps empty values to dash display value", () => {
5
+ expect(getVolatilityTranslationMeta(null)).toEqual({
6
+ key: null,
7
+ displayValue: "-",
8
+ });
9
+ expect(getVolatilityTranslationMeta(undefined)).toEqual({
10
+ key: null,
11
+ displayValue: "-",
12
+ });
13
+ expect(getVolatilityTranslationMeta("")).toEqual({
14
+ key: null,
15
+ displayValue: "-",
16
+ });
17
+ });
18
+
19
+ test("normalizes text values for translation keys", () => {
20
+ expect(getVolatilityTranslationMeta("medium")).toEqual({
21
+ key: "range_medium",
22
+ displayValue: "medium",
23
+ });
24
+ expect(getVolatilityTranslationMeta(" medium-high ")).toEqual({
25
+ key: "range_medium_high",
26
+ displayValue: "medium-high",
27
+ });
28
+ expect(getVolatilityTranslationMeta("low–medium")).toEqual({
29
+ key: "range_low_medium",
30
+ displayValue: "low–medium",
31
+ });
32
+ });
33
+ });