gatsby-core-theme 41.1.27 → 41.1.28

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,20 @@
1
+ ## [41.1.28](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v41.1.27...v41.1.28) (2025-01-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add extra data on processor ([a6fb1e9](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/a6fb1e92de07681e4915de17c78a110615017dbf))
7
+ * add new tests for module ([b9be671](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/b9be671b30b18d9183c8c32eeeb88b32fc19f8f5))
8
+ * conflict ([d0a3e5b](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/d0a3e5b0875463398a603895d49853cb28e01f34))
9
+ * disquss loading ([1631094](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/16310943baa3510f27a0d54c405103cb00878f4d))
10
+ * get latest changes ([1c71701](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/1c71701732d17f19af0746e491ff9bd26e3d8e9c))
11
+ * test ([2f01557](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/2f01557a7190ca2a93bf7e5899e398cece7a3cf6))
12
+ * update tests ([89014c0](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/89014c08ee468baed30168a49acbc797e7ed1a33))
13
+ * update tests ([343b32f](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/343b32fcd126d1c314711ffc896faabc538db8a2))
14
+
15
+
16
+ * Merge branch 'tm-5077-processor-extra-data' into 'master' ([2b5e2e0](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/2b5e2e044cdb8ae21243bf3759539176fa095921))
17
+
1
18
  ## [41.1.27](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v41.1.26...v41.1.27) (2025-01-20)
2
19
 
3
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "41.1.27",
3
+ "version": "41.1.28",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -1,43 +1,70 @@
1
- /* eslint-disable no-var */
2
- /* eslint-disable one-var */
3
- /* eslint-disable no-unused-vars */
4
- /* eslint-disable func-names */
5
- /* eslint-disable camelcase */
6
- /* eslint-disable vars-on-top */
7
- /* eslint-disable react-hooks/exhaustive-deps */
8
- /* eslint-disable react/no-this-in-sfc */
9
- /* eslint-disable no-undef */
10
- import React, { useEffect } from "react";
11
- import PropTypes from "prop-types";
12
-
13
- import { getUrl } from "~helpers/getters";
1
+ /* eslint-disable */
2
+ import React, { useEffect, useRef, useState } from 'react';
3
+ import PropTypes from 'prop-types';
4
+
5
+ import { getUrl } from '~helpers/getters';
6
+
7
+ function useInViewport(callback) {
8
+ const elementRef = useRef(null);
9
+
10
+ useEffect(() => {
11
+ if (typeof window === 'undefined') {
12
+ return;
13
+ }
14
+
15
+ const observer = new IntersectionObserver(
16
+ ([entry]) => {
17
+ if (entry.isIntersecting) {
18
+ callback();
19
+ }
20
+ },
21
+ { threshold: 0.1 }
22
+ );
23
+
24
+ if (elementRef.current) {
25
+ observer.observe(elementRef.current);
26
+ }
27
+
28
+ return () => {
29
+ if (elementRef.current) {
30
+ observer.unobserve(elementRef.current);
31
+ }
32
+ };
33
+ }, [callback]);
34
+
35
+ return elementRef;
36
+ }
14
37
 
15
38
  const Disquss = ({ page }) => {
39
+ const [disqussLoaded, setDisqussLoaded] = useState(false);
40
+
16
41
  // Function to load Disqus
17
42
  const disquss = () => {
18
- if (document.getElementById("disquss-code")) {
43
+ if (typeof window === 'undefined' || typeof document === 'undefined') {
44
+ return; // Ensure it runs only in the browser
45
+ }
46
+
47
+ if (document.getElementById('disquss-code')) {
19
48
  return; // Prevent multiple script injections
20
49
  }
21
50
 
22
- // eslint-disable-next-line no-var
23
- var disqus_config = function () {
51
+ const disqus_config = function () {
24
52
  this.page.url = window.location.href;
25
53
  this.page.identifier = window.location.pathname;
26
54
  };
27
55
 
28
- var d = document,
29
- s = d.createElement("script");
30
- s.src = `${process.env.DISQUSS_URL}`; // Replace with your Disqus URL
31
- s.id = "disquss-code";
32
- s.setAttribute("data-timestamp", +new Date());
56
+ const script = document.createElement('script');
57
+ script.src = `${process.env.DISQUSS_URL}`; // Replace with your Disqus URL
58
+ script.id = 'disquss-code';
59
+ script.setAttribute('data-timestamp', +new Date());
60
+
61
+ (document.head || document.body).appendChild(script);
33
62
 
34
- (d.head || d.body).appendChild(s);
63
+ setDisqussLoaded(true);
35
64
  };
36
65
 
37
66
  useEffect(() => {
38
- disquss();
39
-
40
- if (typeof DISQUS !== "undefined") {
67
+ if (typeof window !== 'undefined' && typeof DISQUS !== 'undefined') {
41
68
  DISQUS.reset({
42
69
  reload: true,
43
70
  config() {
@@ -46,10 +73,12 @@ const Disquss = ({ page }) => {
46
73
  },
47
74
  });
48
75
  }
49
- }, []);
76
+ }, [disqussLoaded]);
77
+
78
+ const ref = useInViewport(disquss);
50
79
 
51
80
  return (
52
- <div className="module">
81
+ <div className="module" ref={ref}>
53
82
  <div id="disqus_thread" />
54
83
  </div>
55
84
  );
@@ -111,6 +111,7 @@ export const pickRelationKeys = {
111
111
  "license_objects",
112
112
  "launch_date",
113
113
  "game_categories",
114
+ "updated_at",
114
115
  ],
115
116
  operator_simplified: [
116
117
  "short_name",
@@ -101,7 +101,7 @@ export async function getCountries() {
101
101
  }
102
102
 
103
103
  export async function getToplists(siteName) {
104
- return callAPIV2(`v0.1/toplists/lists-sorted/sorted-v2/${siteName}`);
104
+ return callAPIV2(`v0.1/toplists/lists-sorted/sorted-v2/${siteName}?include_timestamps=true`);
105
105
  }
106
106
 
107
107
  export async function getContent(siteName) {
@@ -310,13 +310,6 @@ export function processTopListModule(
310
310
  : [];
311
311
  }
312
312
 
313
- if (listItem.updated_at) {
314
- const date = new Date(listItem?.updated_at);
315
- const options = { year: "numeric", month: "long" };
316
- listItem.formated_date = date
317
- .toLocaleString("en-US", options)
318
- .replace(" ", ", ");
319
- }
320
313
 
321
314
  if (listItem.id && toplists && toplists[listItem.id.toString()]) {
322
315
  listItem.market = toplists[listItem.id].market?.short_code;
@@ -346,6 +339,7 @@ export function processTopListModule(
346
339
  : item.selling_points;
347
340
  }
348
341
 
342
+ operatorRelation.updated_at = item.updated_at;
349
343
  operatorRelation.toplist_bonus = item.bonus_name
350
344
 
351
345
  const operatorPage =
@@ -362,6 +356,41 @@ export function processTopListModule(
362
356
  return Object.assign(clone, { review_link: reviewLink });
363
357
  })
364
358
  : [];
359
+
360
+ const latestItems = listItem.items
361
+ .map((toplist) => ({
362
+ ...toplist,
363
+ updated_at: new Date(toplist.updated_at),
364
+ }))
365
+ .sort((a, b) => b.updated_at - a.updated_at)
366
+ .slice(0, 3);
367
+
368
+ const formattedLatestItems = latestItems
369
+ .map((item) => item.name)
370
+ .reduce((acc, curr, index, array) => {
371
+ if (index === array.length - 1 && array.length > 1) {
372
+ return `${acc} and ${curr}`;
373
+ }
374
+ return acc ? `${acc}, ${curr}` : curr;
375
+ }, "");
376
+
377
+ const latestUpdatedDate = listItem.items
378
+ .map((item) => new Date(item.updated_at))
379
+ .sort((a, b) => b - a)[0];
380
+
381
+ const formattedDate =
382
+ // eslint-disable-next-line no-restricted-globals
383
+ latestUpdatedDate instanceof Date && !isNaN(latestUpdatedDate)
384
+ ? new Intl.DateTimeFormat("en-US", {
385
+ year: "numeric",
386
+ month: "long",
387
+ day: "numeric",
388
+ }).format(latestUpdatedDate)
389
+ : null;
390
+
391
+ listItem.latest_items = formattedLatestItems;
392
+ listItem.latest_updated_date = formattedDate;
393
+
365
394
  return listItem;
366
395
  });
367
396
  }
@@ -420,6 +449,7 @@ export function processCarouselModule(module = {}, content) {
420
449
  export function processFaq(module = {}, content, relationData) {
421
450
  // eslint-disable-next-line no-unused-expressions
422
451
  module.items &&
452
+ // eslint-disable-next-line array-callback-return
423
453
  module.items.map((item) => {
424
454
  item.question = (content && generatePlaceholderString(content[item.question],null,relationData)) || item.question;
425
455
  item.answer = (content && content[item.answer]) || item.answer;
@@ -9,9 +9,12 @@ import {
9
9
  processBonus,
10
10
  processTopListModule,
11
11
  shouldSavePrefilled,
12
- } from "./modules";
12
+ processContentModule,
13
+ processAnchor
14
+ } from "./modules.mjs";
13
15
  import { objectsHolder } from "~tests/factories/modules/modules.factory";
14
16
  import getPageDataList from "~tests/factories/pages/list.factory";
17
+ import getPageData from '~tests/factories/pages/default.factory';
15
18
  import {
16
19
  getSampleCardsV2ModuleManual,
17
20
  getSampleCardsV2Filtered,
@@ -21,8 +24,6 @@ import {
21
24
  relationData,
22
25
  singleToplistItemData,
23
26
  } from "../../../tests/factories/modules/toplist.factory";
24
- import { processContentModule, processAnchor } from "./modules.mjs";
25
- import getPageData from '~tests/factories/pages/default.factory';
26
27
 
27
28
  const { cloneDeep } = loadash;
28
29
 
@@ -261,6 +262,18 @@ describe("Modules Helper", () => {
261
262
  expect(module.show_more_content).toContain(new Date().getFullYear().toString());
262
263
  });
263
264
 
265
+ test("Process TopList module computes latest_items and latest_updated_date correctly", () => {
266
+ const toplistData = cloneDeep(singleToplistItemData);
267
+ expect(toplistData.items[0].latest_items).toBe(undefined);
268
+ expect(toplistData.items[0].latest_updated_date).toBe(undefined);
269
+
270
+ processTopListModule(toplistData, relationData);
271
+
272
+ expect(toplistData.items[0].latest_items).toBe('Slotum, Risk and Casoola');
273
+ expect(toplistData.items[0].latest_updated_date).toBe('January 14, 2025');
274
+ });
275
+
276
+
264
277
  test("Process Anchor module", () => {
265
278
  const module = {
266
279
  items: [
@@ -517,6 +517,7 @@ export const singleToplistData = {
517
517
  logo_url: "slotum-casino-logo-transparentpng6b10407566-original.png",
518
518
  rating: "4",
519
519
  review_link: "slotum",
520
+ updated_at: "2025-01-14 11:04:49",
520
521
  selling_points: ["200% Bonus", "Nice design"],
521
522
  links: {
522
523
  main: "https://media.dunderaffiliates.com/redirect.aspx?pid=630524&bid=1477",
@@ -550,6 +551,7 @@ export const singleToplistData = {
550
551
  },
551
552
  logo_url: "rizk-logopng7ed316ac19-original.png",
552
553
  rating: "4",
554
+ updated_at: "2025-01-12 11:04:49",
553
555
  review_link: "/rizk",
554
556
  selling_points: [
555
557
  "100% Bonus",
@@ -589,6 +591,7 @@ export const singleToplistData = {
589
591
  },
590
592
  logo_url: "casoola-logopng381ab5c04f-original.png",
591
593
  rating: "3",
594
+ updated_at: "2025-01-10 11:04:49",
592
595
  review_link: "/casoola",
593
596
  selling_points: ["25 free spins", "Loyalty scheme"],
594
597
  links: {
@@ -619,6 +622,7 @@ export const singleToplistData = {
619
622
  logo_url: "image-63.png",
620
623
  rating: "3",
621
624
  review_link: "/bet365",
625
+ updated_at: "2025-01-14 11:04:49",
622
626
  selling_points: ["Loyalty programme", "Wager-free free spins"],
623
627
  links: {
624
628
  main: "https://media.dunderaffiliates.com/redirect.aspx?pid=630524&bid=1477",
@@ -958,6 +962,19 @@ export const singleToplistItemData = {
958
962
  operator_id: 6342,
959
963
  selling_points: ["classicslots", "bitcoin", "bingo"],
960
964
  short_name: "slotum",
965
+ updated_at: "2025-01-14 11:04:49",
966
+ },
967
+ {
968
+ operator_id: 6343,
969
+ updated_at: "2025-01-13 11:04:49",
970
+ },
971
+ {
972
+ operator_id: 6344,
973
+ updated_at: "2025-01-12 11:04:49",
974
+ },
975
+ {
976
+ operator_id: 6345,
977
+ updated_at: "2025-01-11 11:04:49",
961
978
  },
962
979
  ],
963
980
  tracker: "main",
@@ -982,6 +999,7 @@ export const relationData = {
982
999
  },
983
1000
  operator: {
984
1001
  6342: {
1002
+ name: "Slotum",
985
1003
  id: 6342,
986
1004
  market_id: 25,
987
1005
  short_name: "slotum",
@@ -990,6 +1008,72 @@ export const relationData = {
990
1008
  rating_casino: "4",
991
1009
  rating_games: "4.3",
992
1010
  rating_bonuses: "4.3",
1011
+ updated_at: "2025-01-14 11:04:49",
1012
+ rating_customer: "4.5",
1013
+ rating_payout: "",
1014
+ rating: "4.3",
1015
+ selling_points: [],
1016
+ per_site_enabled: true,
1017
+ status: "active",
1018
+ date_last_modified: "2020-10-06",
1019
+ links: {
1020
+ main: "https://media.dunderaffiliates.com/redirect.aspx?pid=630524&bid=1477",
1021
+ "PPC Fallback":
1022
+ "https://media.dunderaffiliates.com/redirect.aspx?pid=740444&bid=1803",
1023
+ },
1024
+ custom_links: [],
1025
+ owner: "Burstit Limited",
1026
+ types: ["casino"],
1027
+ type: "casino",
1028
+ deposit_wagering: "0x",
1029
+
1030
+ support_types: "Live chat, Email, Vip Support",
1031
+ deposit_methods: [123, 124],
1032
+ software: [
1033
+ {
1034
+ id: 2,
1035
+ name: "2by2 Gaming",
1036
+ short_name: "2_by_2_gaming",
1037
+ logo_asset_id: 10737,
1038
+ games_count: 1,
1039
+ updated_at: null,
1040
+ },
1041
+ {
1042
+ id: 5,
1043
+ name: "Amaya",
1044
+ short_name: "amaya",
1045
+ logo_asset_id: 0,
1046
+ games_count: 0,
1047
+ updated_at: null,
1048
+ },
1049
+ ],
1050
+ bonuses: {
1051
+ main: {
1052
+ one_liner: "€100 Welcome bonus+ 120 Free Spins",
1053
+ start_date: null,
1054
+ end_date: null,
1055
+ categories: [],
1056
+ percentage: "",
1057
+ amount: "",
1058
+ freespins: "",
1059
+ freemoney: "",
1060
+ freespins_nodeposit_amount: "",
1061
+ freespins_nodeposit_bonuscode: "",
1062
+ freespins_nodeposit_games: "",
1063
+ },
1064
+ },
1065
+ },
1066
+ 6343: {
1067
+ id: 6343,
1068
+ name: "Risk",
1069
+ market_id: 25,
1070
+ short_name: "Risk",
1071
+ operator_id: 6343,
1072
+ review_link: "http://www.irishluck.ie/dunder-casino-review/",
1073
+ rating_casino: "4",
1074
+ rating_games: "4.3",
1075
+ rating_bonuses: "4.3",
1076
+ updated_at: "2025-01-14 11:04:49",
993
1077
  rating_customer: "4.5",
994
1078
  rating_payout: "",
995
1079
  rating: "4.3",
@@ -1007,6 +1091,7 @@ export const relationData = {
1007
1091
  types: ["casino"],
1008
1092
  type: "casino",
1009
1093
  deposit_wagering: "0x",
1094
+
1010
1095
  support_types: "Live chat, Email, Vip Support",
1011
1096
  deposit_methods: [123, 124],
1012
1097
  software: [
@@ -1043,5 +1128,68 @@ export const relationData = {
1043
1128
  },
1044
1129
  },
1045
1130
  },
1131
+ 6344: {
1132
+ name: "Casoola",
1133
+ type: "casino",
1134
+ operator_id: 6344,
1135
+ bonus: {
1136
+ deposit_methods: [],
1137
+ },
1138
+ short_name: "casoola",
1139
+ logo: {
1140
+ filename: "casoola-logopng381ab5c04f-original.png",
1141
+ },
1142
+ logo_url: "casoola-logopng381ab5c04f-original.png",
1143
+ rating: "3",
1144
+ updated_at: "2025-01-10 11:04:49",
1145
+ review_link: "/casoola",
1146
+ selling_points: ["25 free spins", "Loyalty scheme"],
1147
+ links: {
1148
+ main: "https://media.dunderaffiliates.com/redirect.aspx?pid=630524&bid=1477",
1149
+ "PPC Fallback":
1150
+ "https://media.dunderaffiliates.com/redirect.aspx?pid=740444&bid=1803",
1151
+ },
1152
+ bonuses: {
1153
+ main: {
1154
+ one_liner: "80% Bonus + 25 free spins",
1155
+ },
1156
+ secondary: {
1157
+ one_liner: "Up to £100 New Player Bonus!",
1158
+ },
1159
+ },
1160
+ },
1161
+ 6345: {
1162
+ name: "Bet365",
1163
+ type: "casino",
1164
+ operator_id: 6345,
1165
+ bonus: {
1166
+ deposit_methods: [],
1167
+ },
1168
+ short_name: "bet365",
1169
+ logo: {
1170
+ filename: "image-63.png",
1171
+ },
1172
+ logo_url: "image-63.png",
1173
+ rating: "3",
1174
+ review_link: "/bet365",
1175
+ updated_at: "2025-01-14 11:04:49",
1176
+ selling_points: ["Loyalty programme", "Wager-free free spins"],
1177
+ links: {
1178
+ main: "https://media.dunderaffiliates.com/redirect.aspx?pid=630524&bid=1477",
1179
+ "PPC Fallback":
1180
+ "https://media.dunderaffiliates.com/redirect.aspx?pid=740444&bid=1803",
1181
+ },
1182
+ bonuses: {
1183
+ main: {
1184
+ one_liner: "Up to £100 New Player Bonus!",
1185
+ },
1186
+ secondary: {
1187
+ one_liner: "80% Bonus + 25 free spins",
1188
+ },
1189
+ },
1190
+ extra_fields: {
1191
+ terms_and_conditions_text_enabled: "1",
1192
+ },
1193
+ },
1046
1194
  },
1047
1195
  };