gatsby-core-theme 44.12.0 → 44.12.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 +19 -0
- package/package.json +1 -1
- package/src/components/molecules/toplist/default-row/index.js +4 -2
- package/src/components/organisms/anchor/template-two/index.js +2 -1
- package/src/constants/pick-keys.mjs +4 -2
- package/src/helpers/getters.mjs +43 -40
- package/src/helpers/getters.test.js +32 -0
- package/src/resolver/archive.mjs +2 -11
- package/src/resolver/archive.test.js +7 -22
- package/src/resolver/index.mjs +10 -1
- package/src/resolver/modules.mjs +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## [44.12.2](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.12.1...v44.12.2) (2026-01-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* fix the toplist tracker cta ([d1d001c](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/d1d001c1155326e63bf9fb6ea96f67280387f332))
|
|
7
|
+
|
|
8
|
+
## [44.12.1](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.12.0...v44.12.1) (2026-01-15)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* add the order based on the created at and updated at ([a883416](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/a883416fe9270702c62ca8c336b578100ed8aed2))
|
|
14
|
+
* pass site market as argument ([a2be2eb](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/a2be2eb829673c1e8a35eccd9dd1a174e2ede3d2))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
* Merge branch 'en-303-placholder' into 'master' ([0f940a3](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/0f940a37ce804ad94c7c4409dc2b63fb286146b4))
|
|
18
|
+
* Merge branch 'en-144-order-archive-items' into 'master' ([24d8b52](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/24d8b524955f0c80f41f81d57116709efec79feb))
|
|
19
|
+
|
|
1
20
|
# [44.12.0](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.11.0...v44.12.0) (2026-01-14)
|
|
2
21
|
|
|
3
22
|
|
package/package.json
CHANGED
|
@@ -40,6 +40,8 @@ const Row = ({
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
|
|
44
|
+
|
|
43
45
|
return (
|
|
44
46
|
<li
|
|
45
47
|
className={`${className || ''} ${styles.row || ''} ${
|
|
@@ -68,7 +70,7 @@ const Row = ({
|
|
|
68
70
|
<Bonus
|
|
69
71
|
moduleName={moduleName}
|
|
70
72
|
item={item}
|
|
71
|
-
tracker={item
|
|
73
|
+
tracker={item?.toplist_bonus || oneliner}
|
|
72
74
|
modulePosition={modulePosition}
|
|
73
75
|
itemPosition={itemPosition}
|
|
74
76
|
/>
|
|
@@ -84,7 +86,7 @@ const Row = ({
|
|
|
84
86
|
)}
|
|
85
87
|
<OperatorCta
|
|
86
88
|
operator={item}
|
|
87
|
-
tracker={tracker}
|
|
89
|
+
tracker={item?.toplist_item_tracker_name || tracker}
|
|
88
90
|
gtmClass="toplist-operator-cta-gtm"
|
|
89
91
|
pageTemplate={pageTemplate}
|
|
90
92
|
moduleName={moduleName}
|
|
@@ -59,7 +59,7 @@ function Anchor({
|
|
|
59
59
|
{generatePlaceholderString(
|
|
60
60
|
useTranslate(item.slug, item.label),
|
|
61
61
|
null,
|
|
62
|
-
page?.relation
|
|
62
|
+
{ ...page?.relation, market: page?.market }
|
|
63
63
|
)}
|
|
64
64
|
{icon}
|
|
65
65
|
</a>
|
|
@@ -86,6 +86,7 @@ Anchor.propTypes = {
|
|
|
86
86
|
showTitle: PropTypes.bool,
|
|
87
87
|
page: PropTypes.shape({
|
|
88
88
|
relation: PropTypes.shape({}),
|
|
89
|
+
market: PropTypes.string,
|
|
89
90
|
}),
|
|
90
91
|
};
|
|
91
92
|
|
|
@@ -54,7 +54,8 @@ export const topListPickKeys = [
|
|
|
54
54
|
"author_email",
|
|
55
55
|
"updatedAt",
|
|
56
56
|
"operator_id",
|
|
57
|
-
"toplist_bonus"
|
|
57
|
+
"toplist_bonus",
|
|
58
|
+
'toplist_item_tracker_name'
|
|
58
59
|
];
|
|
59
60
|
|
|
60
61
|
export const pickTrackerOperatorKeys = [
|
|
@@ -133,7 +134,8 @@ export const pickRelationKeys = {
|
|
|
133
134
|
'average_withdrawal_times',
|
|
134
135
|
'best_game',
|
|
135
136
|
'rating_comments',
|
|
136
|
-
'toplist_bonus'
|
|
137
|
+
'toplist_bonus',
|
|
138
|
+
'toplist_item_tracker_name'
|
|
137
139
|
],
|
|
138
140
|
operator_simplified: [
|
|
139
141
|
"short_name",
|
package/src/helpers/getters.mjs
CHANGED
|
@@ -133,12 +133,8 @@ export function isBrowserWebpCompatable(feature, callback) {
|
|
|
133
133
|
img.src = `data:image/webp;base64,${kTestImages[feature]}`;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
export function imagePrettyUrl(
|
|
137
|
-
filename
|
|
138
|
-
width = null,
|
|
139
|
-
height = null
|
|
140
|
-
) {
|
|
141
|
-
if(filename){
|
|
136
|
+
export function imagePrettyUrl(filename, width = null, height = null) {
|
|
137
|
+
if (filename) {
|
|
142
138
|
const extension = getImageExtension(filename);
|
|
143
139
|
|
|
144
140
|
const hasFilters = extension !== "svg" && extension !== "gif";
|
|
@@ -148,18 +144,17 @@ export function imagePrettyUrl(
|
|
|
148
144
|
: process.env.IMAGE_CDN_URL
|
|
149
145
|
? process.env.IMAGE_CDN_URL.replace("/filters:format(webp)", "")
|
|
150
146
|
: "") || process.env.STORYBOOK_IMAGE_CDN_URL;
|
|
151
|
-
|
|
147
|
+
|
|
152
148
|
if (width && height && hasFilters) {
|
|
153
149
|
const urlPath = "/fit-in";
|
|
154
150
|
const urlSize = `/${width}x${height}`;
|
|
155
|
-
|
|
151
|
+
|
|
156
152
|
return `${cdnURL}${urlPath}${urlSize}/${filename}`;
|
|
157
153
|
}
|
|
158
|
-
|
|
154
|
+
|
|
159
155
|
return `${cdnURL}/${filename}`;
|
|
160
156
|
}
|
|
161
|
-
return
|
|
162
|
-
|
|
157
|
+
return "/images/placeholder-image.jpg";
|
|
163
158
|
}
|
|
164
159
|
|
|
165
160
|
export function getPageImage(page) {
|
|
@@ -242,7 +237,6 @@ export function getBonus(name, operator) {
|
|
|
242
237
|
}
|
|
243
238
|
|
|
244
239
|
export function getPromoCode(item, tracker) {
|
|
245
|
-
|
|
246
240
|
if (!item) {
|
|
247
241
|
return null;
|
|
248
242
|
}
|
|
@@ -251,8 +245,6 @@ export function getPromoCode(item, tracker) {
|
|
|
251
245
|
item.bonuses.hasOwnProperty(tracker) &&
|
|
252
246
|
item.bonuses[tracker].promo_code !== ""
|
|
253
247
|
) {
|
|
254
|
-
|
|
255
|
-
|
|
256
248
|
return item.bonuses[tracker].promo_code;
|
|
257
249
|
}
|
|
258
250
|
return null;
|
|
@@ -372,7 +364,9 @@ export function getUrl(path) {
|
|
|
372
364
|
return process.env.GATSBY_SITE_URL;
|
|
373
365
|
}
|
|
374
366
|
|
|
375
|
-
return `${process.env.GATSBY_SITE_URL}${path.replace(/^\//, "")}${
|
|
367
|
+
return `${process.env.GATSBY_SITE_URL}${path.replace(/^\//, "")}${
|
|
368
|
+
process.env.TRALING_SLASH ? "/" : ""
|
|
369
|
+
}`;
|
|
376
370
|
}
|
|
377
371
|
|
|
378
372
|
export function getLanguage(language) {
|
|
@@ -540,33 +534,42 @@ export const filterNonNullValues = (data) =>
|
|
|
540
534
|
return acc;
|
|
541
535
|
}, {});
|
|
542
536
|
|
|
543
|
-
|
|
544
537
|
export function setName(string) {
|
|
545
538
|
const [name] = string.split(".");
|
|
546
539
|
return name[0].toUpperCase() + name.slice(1);
|
|
547
540
|
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
(
|
|
562
|
-
|
|
563
|
-
|
|
541
|
+
export const trailingSlash = (content) => {
|
|
542
|
+
if (!content || process.env.TRAILING_SLASH !== "true") return content;
|
|
543
|
+
|
|
544
|
+
const baseUrl = process.env.GATSBY_SITE_URL;
|
|
545
|
+
const escapedBaseUrl = baseUrl.replace(/\./g, "\\.");
|
|
546
|
+
|
|
547
|
+
return content
|
|
548
|
+
.replace(
|
|
549
|
+
/(<a[^>]*?\shref=")(\/[^"]*?)(?<!\/)"(?=[^>]*>)/g,
|
|
550
|
+
(match, p1, p2) => `${p1}${p2}/"`
|
|
551
|
+
)
|
|
552
|
+
.replace(
|
|
553
|
+
new RegExp(
|
|
554
|
+
`(<a[^>]*?\\shref=")(${escapedBaseUrl}[^"]*?)(?<!\/)"(?=[^>]*>)`,
|
|
555
|
+
"g"
|
|
556
|
+
),
|
|
557
|
+
(match, p1, p2) => `${p1}${p2}/"`
|
|
558
|
+
);
|
|
559
|
+
};
|
|
564
560
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
561
|
+
export const removeDomain = (url) => {
|
|
562
|
+
try {
|
|
563
|
+
const domainRegex = /^https?:\/\/[^/]+/;
|
|
564
|
+
return url.replace(domainRegex, "");
|
|
565
|
+
} catch (error) {
|
|
566
|
+
return null; // Return null if the URL is invalid
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
export const sortArchivePages = (pages, sortBy, sortOrder) =>
|
|
571
|
+
pages.sort((a, b) => {
|
|
572
|
+
const dateA = new Date(a[sortBy].replace(" ", "T"));
|
|
573
|
+
const dateB = new Date(b[sortBy].replace(" ", "T"));
|
|
574
|
+
return sortOrder === "ascending" ? dateA - dateB : dateB - dateA;
|
|
575
|
+
});
|
|
@@ -554,4 +554,36 @@ describe('Getters Helper', () => {
|
|
|
554
554
|
};
|
|
555
555
|
expect(Getters.getPromoCode(item, "exclusive")).toBe("EXCL2025");
|
|
556
556
|
});
|
|
557
|
+
|
|
558
|
+
test('sortArchivePages()', () => {
|
|
559
|
+
const pages = [
|
|
560
|
+
{ date: "2023-01-01" },
|
|
561
|
+
{ date: "2023-02-01" },
|
|
562
|
+
];
|
|
563
|
+
const sortedPages = Getters.sortArchivePages(pages, "date", "ascending");
|
|
564
|
+
expect(sortedPages).toEqual([
|
|
565
|
+
{ date: "2023-01-01" },
|
|
566
|
+
{ date: "2023-02-01" },
|
|
567
|
+
]);
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
test('sortArchivePages() descending', () => {
|
|
571
|
+
const pages = [
|
|
572
|
+
{ date: "2023-01-01" },
|
|
573
|
+
{ date: "2023-02-01" },
|
|
574
|
+
];
|
|
575
|
+
const sortedPages = Getters.sortArchivePages(pages, "date", "descending");
|
|
576
|
+
expect(sortedPages).toEqual([
|
|
577
|
+
{ date: "2023-02-01" },
|
|
578
|
+
{ date: "2023-01-01" },
|
|
579
|
+
]);
|
|
580
|
+
});
|
|
581
|
+
test('sortArchivePages() random', () => {
|
|
582
|
+
const pages = [
|
|
583
|
+
{ date: "2023-01-01" },
|
|
584
|
+
{ date: "2023-02-01" },
|
|
585
|
+
];
|
|
586
|
+
const sortedPages = Getters.sortArchivePages(pages, "date", "random");
|
|
587
|
+
expect(sortedPages.length).toBe(2);
|
|
588
|
+
});
|
|
557
589
|
});
|
package/src/resolver/archive.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
2
|
import loadash from "lodash/index.js";
|
|
3
3
|
import { clonePageForCards } from "./common.mjs";
|
|
4
|
+
import { sortArchivePages } from "../helpers/getters.mjs";
|
|
4
5
|
|
|
5
6
|
const { cloneDeep, chunk } = loadash;
|
|
6
7
|
|
|
@@ -25,17 +26,7 @@ export const getArchivePages = (
|
|
|
25
26
|
pages[pageObject.market][archiveModule.model_type]
|
|
26
27
|
);
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
archivePages = archivePages.sort((a, b) => {
|
|
30
|
-
const key = archiveModule.sort_by;
|
|
31
|
-
const dateA = new Date(a[key].replace(" ", "T"));
|
|
32
|
-
const dateB = new Date(b[key].replace(" ", "T"));
|
|
33
|
-
|
|
34
|
-
return archiveModule.sort_order === "ascending"
|
|
35
|
-
? dateA - dateB
|
|
36
|
-
: dateB - dateA;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
29
|
+
archivePages = sortArchivePages(archivePages, archiveModule.sort_by, archiveModule.sort_order);
|
|
39
30
|
|
|
40
31
|
if (process.env.CUSTOM_CONTENT_PAGES_PATH && archivePages) {
|
|
41
32
|
// eslint-disable-next-line array-callback-return
|
|
@@ -8,6 +8,13 @@ jest.mock("./common.mjs", () => ({
|
|
|
8
8
|
|
|
9
9
|
jest.mock("../helpers/getters.mjs", () => ({
|
|
10
10
|
translate: jest.fn((obj, key, fallback) => obj?.[key] || fallback),
|
|
11
|
+
sortArchivePages: jest.fn((pages, sortBy, sortOrder) =>
|
|
12
|
+
pages.sort((a, b) => {
|
|
13
|
+
const dateA = new Date(a[sortBy].replace(" ", "T"));
|
|
14
|
+
const dateB = new Date(b[sortBy].replace(" ", "T"));
|
|
15
|
+
return sortOrder === "ascending" ? dateA - dateB : dateB - dateA;
|
|
16
|
+
})
|
|
17
|
+
),
|
|
11
18
|
}));
|
|
12
19
|
|
|
13
20
|
describe("getArchivePages", () => {
|
|
@@ -64,28 +71,6 @@ describe("getArchivePages", () => {
|
|
|
64
71
|
);
|
|
65
72
|
});
|
|
66
73
|
|
|
67
|
-
it("should sort archive pages by date ascending", () => {
|
|
68
|
-
const unsortedPages = [
|
|
69
|
-
{ path: "/page-2", date: "2023-02-01" },
|
|
70
|
-
{ path: "/page-1", date: "2023-01-01" },
|
|
71
|
-
];
|
|
72
|
-
pages.us.articles = unsortedPages;
|
|
73
|
-
|
|
74
|
-
const result = getArchivePages(
|
|
75
|
-
pageObject,
|
|
76
|
-
marketSections,
|
|
77
|
-
prefilledModules,
|
|
78
|
-
translate,
|
|
79
|
-
translationsData,
|
|
80
|
-
pages,
|
|
81
|
-
siteGeneralData,
|
|
82
|
-
allMarketsData
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
const { items } = result[0].context.page.sections.main.modules[0];
|
|
86
|
-
expect(items[0].date).toBe("2023-01-01");
|
|
87
|
-
expect(items[1].date).toBe("2023-02-01");
|
|
88
|
-
});
|
|
89
74
|
|
|
90
75
|
it("should filter inactive operators", () => {
|
|
91
76
|
const archivePages = [
|
package/src/resolver/index.mjs
CHANGED
|
@@ -214,7 +214,12 @@ export function processSections(
|
|
|
214
214
|
menus,
|
|
215
215
|
pageId,
|
|
216
216
|
translations,
|
|
217
|
-
{
|
|
217
|
+
{
|
|
218
|
+
...relationData,
|
|
219
|
+
siteName,
|
|
220
|
+
pageTitle: page?.title,
|
|
221
|
+
market: page?.market,
|
|
222
|
+
},
|
|
218
223
|
markets,
|
|
219
224
|
data,
|
|
220
225
|
toplists,
|
|
@@ -335,6 +340,7 @@ function updatePlaceholders(page, data, translationsData) {
|
|
|
335
340
|
generatePlaceholderString(page.title, translationsData, {
|
|
336
341
|
siteName: data.site_name,
|
|
337
342
|
pageTitle: page.title,
|
|
343
|
+
market: page.market,
|
|
338
344
|
});
|
|
339
345
|
|
|
340
346
|
page.meta_title =
|
|
@@ -342,6 +348,7 @@ function updatePlaceholders(page, data, translationsData) {
|
|
|
342
348
|
generatePlaceholderString(page.meta_title, translationsData, {
|
|
343
349
|
siteName: data.site_name,
|
|
344
350
|
pageTitle: page.title,
|
|
351
|
+
market: page.market,
|
|
345
352
|
});
|
|
346
353
|
|
|
347
354
|
page.meta_description =
|
|
@@ -349,6 +356,7 @@ function updatePlaceholders(page, data, translationsData) {
|
|
|
349
356
|
generatePlaceholderString(page.meta_description, translationsData, {
|
|
350
357
|
siteName: data.site_name,
|
|
351
358
|
pageTitle: page.title,
|
|
359
|
+
market: page.market,
|
|
352
360
|
});
|
|
353
361
|
}
|
|
354
362
|
|
|
@@ -468,6 +476,7 @@ export default {
|
|
|
468
476
|
{
|
|
469
477
|
siteName: generalData.site_name,
|
|
470
478
|
pageTitle: page.title,
|
|
479
|
+
market: page.market,
|
|
471
480
|
}
|
|
472
481
|
);
|
|
473
482
|
}
|
package/src/resolver/modules.mjs
CHANGED
|
@@ -416,6 +416,7 @@ export function processTopListModule(
|
|
|
416
416
|
|
|
417
417
|
operatorRelation.updated_at = item.updated_at;
|
|
418
418
|
operatorRelation.toplist_bonus = item.bonus_name;
|
|
419
|
+
operatorRelation.toplist_item_tracker_name = item.tracker_name;
|
|
419
420
|
|
|
420
421
|
const operatorPage =
|
|
421
422
|
pages && pages.operator && operatorRelation
|