gatsby-core-theme 44.0.25 → 44.0.26

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,19 @@
1
+ ## [44.0.26](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.0.25...v44.0.26) (2025-04-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * a bit of clean up ([6bdad07](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/6bdad07a58ba234d930af762a2610d8e22279e8c))
7
+ * added standardised ([7907cfa](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/7907cfa372f3297faad022ae7eb8711a8c1a93c2))
8
+ * import ([f326a4e](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/f326a4e213da5e93b423c720bac415a023d6067e))
9
+ * jest ([b5f4a87](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/b5f4a87b92666c16009dcce722adaac1013383f4))
10
+ * logo ([cdd2ddf](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/cdd2ddfa8ce4814263d168399e09eecfb91d4c34))
11
+ * move function to helpers ([631ef01](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/631ef01e21d3e25aea4d01af22c389df8a567222))
12
+ * search relation ([ed0b4d3](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/ed0b4d3f77186698031c0337254ee8dea99861d9))
13
+
14
+
15
+ * Merge branch 'search-relation' into 'master' ([4de5948](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/4de5948af8fd81ff81556f57a95a34c5fa52b796))
16
+
1
17
  ## [44.0.25](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.0.24...v44.0.25) (2025-04-24)
2
18
 
3
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "44.0.25",
3
+ "version": "44.0.26",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -7,7 +7,7 @@ import { imagePrettyUrl } from '~helpers/getters';
7
7
  import styles from './game.module.scss';
8
8
 
9
9
  const Game = ({ item = {}, width = 56, height = 56, btnText = '', icon = <FaArrowRight title="Right-pointing Arrow Icon" /> }) => {
10
- const { logo } = item;
10
+ const { relation } = item;
11
11
 
12
12
  return (
13
13
  <li className={styles.row || ''}>
@@ -15,7 +15,7 @@ const Game = ({ item = {}, width = 56, height = 56, btnText = '', icon = <FaArro
15
15
  className={styles.gameImage}
16
16
  width={width}
17
17
  height={height}
18
- src={logo ? imagePrettyUrl(logo, width, height) : '/images/default-slot.jpg'}
18
+ src={relation?.logo?.filename ? imagePrettyUrl(relation?.logo?.filename, width, height) : '/images/default-slot.jpg'}
19
19
  alt={item.title}
20
20
  />
21
21
  <h3 className={styles.gameTitle}>{item.title}</h3>
@@ -7,14 +7,15 @@ import { imagePrettyUrl } from '~helpers/getters';
7
7
  import styles from './operator.module.scss';
8
8
 
9
9
  const Operator = ({ item = {}, width = 56, height = 56, btnText = '', icon = <FaArrowRight title="Right-pointing Arrow Icon" /> }) => {
10
- const { logo } = item;
10
+ const { relation } = item;
11
+
11
12
  return (
12
13
  <li className={styles.row || ''}>
13
14
  <LazyImage
14
15
  className={styles.operatorImage}
15
16
  width={width}
16
17
  height={height}
17
- src={imagePrettyUrl(logo, width, height)}
18
+ src={imagePrettyUrl(relation?.logo?.filename, width, height)}
18
19
  alt={item.title}
19
20
  />
20
21
  <h3 className={styles.operatorTitle}>{item.title}</h3>
@@ -0,0 +1,24 @@
1
+ /* eslint-disable import/prefer-default-export */
2
+ export const searchReleationPickKeys = [
3
+ 'bonuses',
4
+ 'logo',
5
+ 'path',
6
+ 'short_name',
7
+ 'status',
8
+ "type",
9
+ "selling_points",
10
+ "support_types",
11
+ "ribbons",
12
+ "rating",
13
+ 'name',
14
+ "standardised_logo_filename_object",
15
+ "game_provider",
16
+ "average_rating",
17
+ "first_rating",
18
+ "second_rating",
19
+ "third_rating",
20
+ "fourth_rating",
21
+ "extra_fields",
22
+ 'rtp',
23
+ 'volatility',
24
+ ];
@@ -162,4 +162,15 @@ export function removeUnwantedSections(obj, pageType) {
162
162
  }, {});
163
163
 
164
164
  return filteredObject;
165
- }
165
+ }
166
+
167
+ export function filterRelation (relation, allowedKeys) {
168
+ if (!relation) return undefined;
169
+
170
+ return allowedKeys.reduce((acc, key) => {
171
+ if (relation[key]) {
172
+ acc[key] = relation[key];
173
+ }
174
+ return acc;
175
+ }, {});
176
+ };
@@ -6,6 +6,7 @@ import {
6
6
  removeUnwantedSections,
7
7
  updateMenuPrefixPath,
8
8
  clean,
9
+ filterRelation
9
10
  } from "./common";
10
11
  import getPageDataList from "~tests/factories/pages/list.factory";
11
12
 
@@ -151,4 +152,52 @@ describe("Common Helper", () => {
151
152
  const output = clean(input);
152
153
  expect(output).toEqual({ f: 3 });
153
154
  });
155
+
156
+ test('returns filtered object with allowed keys', () => {
157
+ const relation = {
158
+ short_name: 'Some Name',
159
+ logo: 'logo.png',
160
+ game_id: 123,
161
+ extra_key: 'should not appear',
162
+ };
163
+
164
+ const allowedKeys = ['short_name', 'game_id'];
165
+
166
+ const result = filterRelation(relation, allowedKeys);
167
+
168
+ expect(result).toEqual({
169
+ short_name: 'Some Name',
170
+ game_id: 123,
171
+ });
172
+ });
173
+
174
+ test('returns undefined if relation is falsy', () => {
175
+ expect(filterRelation(null, ['short_name'])).toBeUndefined();
176
+ expect(filterRelation(undefined, ['short_name'])).toBeUndefined();
177
+ });
178
+
179
+ test('returns empty object if no allowed keys match', () => {
180
+ const relation = {
181
+ foo: 'bar',
182
+ };
183
+ const allowedKeys = ['short_name', 'logo'];
184
+
185
+ const result = filterRelation(relation, allowedKeys);
186
+
187
+ expect(result).toEqual({});
188
+ });
189
+
190
+ test('ignores falsy values in relation', () => {
191
+ const relation = {
192
+ short_name: '',
193
+ logo: null,
194
+ game_id: 0,
195
+ title: 'keep this',
196
+ };
197
+ const allowedKeys = ['short_name', 'logo', 'game_id', 'title'];
198
+
199
+ const result = filterRelation(relation, allowedKeys);
200
+
201
+ expect(result).toEqual({ title: 'keep this' });
202
+ });
154
203
  });
@@ -10,6 +10,7 @@
10
10
  import loadash from "lodash/index.js";
11
11
  import chalk from "chalk";
12
12
  import ModuleValue from "../../constants/module-value.mjs";
13
+ import { searchReleationPickKeys } from "../../constants/searchReleationPickKeys.mjs";
13
14
  import { pickHTMLSitemapPageKeys } from "../../constants/pick-keys.mjs";
14
15
  import { generatePlaceholderString } from "../generators.mjs";
15
16
  // eslint-disable-next-line import/no-cycle
@@ -19,6 +20,7 @@ import {
19
20
  groupBy,
20
21
  removeTags,
21
22
  updateMenuPrefixPath,
23
+ filterRelation
22
24
  } from "./common.mjs";
23
25
 
24
26
  import {
@@ -83,7 +85,7 @@ export function processSitemapPages(pages, markets) {
83
85
 
84
86
  const groupByMarketAndType = (data) =>
85
87
  Object.values(data).reduce((acc, item) => {
86
- const {market, type} = item;
88
+ const { market, type } = item;
87
89
 
88
90
  // Initialize language and type groupings if not already present
89
91
  if (!acc[market]) acc[market] = {};
@@ -111,9 +113,8 @@ export function transform(response) {
111
113
 
112
114
  if (response.site_markets[siteMarket].path_prefix && page) {
113
115
  // set page prefix for multiple markets
114
- page.path = `${response.site_markets[siteMarket].path_prefix}${
115
- page.path !== "/" ? `/${page.path}` : ""
116
- }`;
116
+ page.path = `${response.site_markets[siteMarket].path_prefix}${page.path !== "/" ? `/${page.path}` : ""
117
+ }`;
117
118
  transformed[siteMarket][pageType].push(page);
118
119
  } else if (page) {
119
120
  transformed[siteMarket][pageType].push(page);
@@ -171,7 +172,7 @@ export function processSections(
171
172
  module = {
172
173
  ...cloneDeep(
173
174
  prefilledMarketModules[module.module_value_id] ||
174
- prefilledMarketModules[module.value_id]
175
+ prefilledMarketModules[module.value_id]
175
176
  ),
176
177
  value_type: ModuleValue.VALUE_TYPE_PREFILLED_MODULE_MARKET,
177
178
  };
@@ -253,7 +254,7 @@ function processSearchData(data, fs) {
253
254
  if (error) {
254
255
  console.log(
255
256
  chalk.magenta("info") +
256
- chalk.whiteBright(` Error writing search json file : ${error}`)
257
+ chalk.whiteBright(` Error writing search json file : ${error}`)
257
258
  );
258
259
  }
259
260
  }
@@ -341,7 +342,7 @@ export default {
341
342
 
342
343
  const searchEnabled =
343
344
  themeOptions.searchEnabled !== undefined &&
344
- themeOptions.searchEnabled !== null
345
+ themeOptions.searchEnabled !== null
345
346
  ? themeOptions.searchEnabled
346
347
  : true;
347
348
 
@@ -473,17 +474,26 @@ export default {
473
474
 
474
475
  pagesMappedById[page.id] = page;
475
476
 
477
+
476
478
  // add search data
477
479
  if (searchTemplatesAcitve.includes(page.template) && searchEnabled) {
478
- const { title, path, status, relation } = transformedPages[market][pageType][index];
480
+ const { title, path, status, type, relation, author } = transformedPages[market][pageType][index];
479
481
 
480
- const minimalPage = {
481
- title,
482
+ const filteredRelation = filterRelation(relation, searchReleationPickKeys);
483
+
484
+ const allowedAuthorRelationKeys = ['image', 'name'];
485
+ const filteredAuthorRelation = filterRelation(author, allowedAuthorRelationKeys);
486
+
487
+ const minimalPage = {
488
+ title,
482
489
  pageType,
483
- path,
484
- ...(relation?.short_name && { short_name: relation.short_name }),
485
- ...(relation?.logo && { logo: relation.logo.filename }),
486
- ...(relation?.game_id && { game_id: relation.game_id })
490
+ path,
491
+ ...(relation?.short_name && { short_name: relation.short_name }),
492
+ // ...(relation?.logo && { logo: relation.logo.filename }),
493
+ ...(relation?.game_id && { game_id: relation.game_id }),
494
+ type,
495
+ ...(filteredRelation && { relation: filteredRelation }),
496
+ ...(filteredAuthorRelation && { author: filteredAuthorRelation }),
487
497
  };
488
498
 
489
499
  status === 'active' && searchData[page.market].push(
@@ -593,7 +603,7 @@ export default {
593
603
  const end = new Date() - start;
594
604
  console.log(
595
605
  chalk.green("success") +
596
- chalk.whiteBright(` processed module values - %ds`),
606
+ chalk.whiteBright(` processed module values - %ds`),
597
607
  end / 1000
598
608
  );
599
609
  return data;