gatsby-core-theme 41.1.21 → 41.1.23

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,23 @@
1
+ ## [41.1.23](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v41.1.22...v41.1.23) (2025-01-15)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add validation ([786b8e1](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/786b8e1d37a456c25d98fb4096d5faf0f56b9845))
7
+
8
+
9
+ * Merge branch 'add-validation' into 'master' ([6cad763](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/6cad763602669ba1aa2ceb75013d84115108c9ed))
10
+
11
+ ## [41.1.22](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v41.1.21...v41.1.22) (2025-01-15)
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * add some small validation ([a988f4c](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/a988f4cc0ebd187978e9bca21b4f2154591394a8))
17
+
18
+
19
+ * Merge branch 'add-validation' into 'master' ([1ad46e8](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/1ad46e84b2c75fe3c56f2a51d0b35f2bd1efd434))
20
+
1
21
  ## [41.1.21](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v41.1.20...v41.1.21) (2025-01-15)
2
22
 
3
23
 
package/gatsby-node.mjs CHANGED
@@ -512,10 +512,10 @@ export const sourceNodes = async ({
512
512
 
513
513
  let defaultMarket = null;
514
514
  Object.entries(siteSettingsData.site_markets).forEach(([key, value]) => {
515
- if (value.path_prefix === null) {
515
+ if (value.path_prefix === null || value.path_prefix === "") {
516
516
  defaultMarket = key;
517
517
  }
518
- });
518
+ });
519
519
  defaultLanguage = defaultMarket.split("_")[1];
520
520
  translationsData = await getTranslations(process.env.GATSBY_SITE_NAME, keys);
521
521
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "41.1.21",
3
+ "version": "41.1.23",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -24,7 +24,7 @@ const HeaderOperatorBaner = ({
24
24
 
25
25
  const statusText = useTranslate(
26
26
  operator?.status,
27
- operator?.status.replace('_', ' ')
27
+ operator?.status?.replace('_', ' ')
28
28
  )
29
29
 
30
30
  if (['coming_soon', 'inactive'].includes(operator?.status)) {
@@ -49,8 +49,8 @@ export default function FloatingArea({
49
49
  pageTemplate={template}
50
50
  moduleName={TrackingKeys?.BONUS}
51
51
  sticky
52
- logo={pageContext.page.relation.logo_url}
53
- operator={pageContext.page.relation}
52
+ logo={pageContext?.page?.relation?.logo_url}
53
+ operator={pageContext?.page?.relation}
54
54
  closedBanner={closedBanner}
55
55
  setClosedBanner={setClosedBanner}
56
56
  />
@@ -174,11 +174,11 @@ export function getPageImage(page) {
174
174
  return imagePrettyUrl(page.relation?.logo?.filename);
175
175
  }
176
176
 
177
- if (page.relation_type === "game") {
177
+ if (page?.relation_type === "game") {
178
178
  if (page.featured_image) {
179
179
  return imagePrettyUrl(page.featured_image);
180
180
  }
181
- if (page.relation.thumbnail_filename) {
181
+ if (page?.relation?.thumbnail_filename) {
182
182
  return page.relation.thumbnail_filename;
183
183
  }
184
184
  }
@@ -294,10 +294,10 @@ export function getGameRating(object) {
294
294
  // );
295
295
  // }
296
296
  return (
297
- ((object.first_rating ? Number(object.first_rating) : 0) +
298
- (object.second_rating ? Number(object.second_rating) : 0) +
299
- (object.third_rating ? Number(object.third_rating) : 0) +
300
- (object.fourth_rating ? Number(object.fourth_rating) : 0)) /
297
+ ((object?.first_rating ? Number(object.first_rating) : 0) +
298
+ (object?.second_rating ? Number(object.second_rating) : 0) +
299
+ (object?.third_rating ? Number(object.third_rating) : 0) +
300
+ (object?.fourth_rating ? Number(object.fourth_rating) : 0)) /
301
301
  4
302
302
  );
303
303
  }
@@ -457,9 +457,9 @@ export function updateArrayTranslations(array, keysArray, translations) {
457
457
  }
458
458
 
459
459
  export function getObjectValue(obj, path) {
460
- if (!path) return obj;
460
+ if (!path) return obj;
461
461
  const properties = path.split(".");
462
- return getObjectValue(obj[properties.shift()], properties.join("."));
462
+ return obj && getObjectValue(obj[properties.shift()], properties.join("."));
463
463
  }
464
464
 
465
465
  export function getBonusData(item, tracker, splitBy = "+") {
@@ -475,7 +475,7 @@ export function getBonusData(item, tracker, splitBy = "+") {
475
475
 
476
476
  let mainLine = null;
477
477
  let secondLine = null;
478
- if (oneLiner?.one_liner !== null && oneLiner?.one_liner.includes(splitBy)) {
478
+ if (oneLiner?.one_liner !== null && oneLiner?.one_liner?.includes(splitBy)) {
479
479
  mainLine = oneLiner?.one_liner.split(splitBy)[0];
480
480
  secondLine = oneLiner?.one_liner.split(splitBy)[1];
481
481
  } else {
@@ -351,9 +351,7 @@ export function processTopListModule(
351
351
  const operatorPage =
352
352
  pages && pages.operator && operatorRelation
353
353
  ? pages.operator.filter(
354
- (page) =>
355
- page.relation.operator_id === operatorRelation.operator_id
356
- )
354
+ (page) => page.relation && page.relation.operator_id === operatorRelation.operator_id)
357
355
  : [];
358
356
 
359
357
  const reviewLink =
@@ -1,8 +1,10 @@
1
+ /* eslint-disable react-hooks/rules-of-hooks */
1
2
  /* eslint-disable no-plusplus */
2
3
  import { useContext } from 'react';
3
4
  import { Context } from '../../context/MainProvider.js';
4
5
 
5
6
  const useTranslate = (keys, defaultValue) => {
7
+ if(!keys) return;
6
8
  const { translations, language, showTranslationKeys } = useContext(Context) || {};
7
9
  if (typeof keys === 'string') {
8
10
  keys = [keys];