gatsby-core-theme 44.22.1 → 44.22.3
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 +21 -0
- package/package.json +1 -1
- package/src/resolver/common.mjs +8 -3
- package/src/resolver/common.test.js +66 -0
- package/src/resolver/modules.mjs +55 -47
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## [44.22.3](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.22.2...v44.22.3) (2026-04-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add unlimited popup items feature ([3f94e3c](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/3f94e3cea9b3df95f3a8f47e2634d532c767c8b8))
|
|
7
|
+
* fix test ([cc755db](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/cc755dbe11e633a0bad4c70690ac8df3482d6f55))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
* Merge branch 'add-unlimited-popup-items-feature' into 'master' ([6da3990](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/6da3990039afc5afad4880d1fb6ab10d7ff3a459))
|
|
11
|
+
|
|
12
|
+
## [44.22.2](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.22.1...v44.22.2) (2026-04-24)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* mapped spotlight mode sports_odds ([e8d5757](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/e8d575769e213645f7b0096589b7297c93f63d24))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
* Merge branch 'EN-497-Enable-new-spotlight-mode' into 'master' ([0e1f54d](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/0e1f54d2b36cf678fbbad1199c041d7996624d73))
|
|
21
|
+
|
|
1
22
|
## [44.22.1](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.22.0...v44.22.1) (2026-04-21)
|
|
2
23
|
|
|
3
24
|
|
package/package.json
CHANGED
package/src/resolver/common.mjs
CHANGED
|
@@ -142,6 +142,7 @@ export function clean(object) {
|
|
|
142
142
|
|
|
143
143
|
export function removeUnwantedSections(obj, pageType, ribbonsData) {
|
|
144
144
|
const limit = process.env.RECOMMENDED_CASINOS_NUMBER || 3;
|
|
145
|
+
const unlimitedPopupItems = process.env.UNLIMITED_POPUP_ITEMS === "true";
|
|
145
146
|
const marketSection = {
|
|
146
147
|
games: ["post_main_games", "pre_main_games"],
|
|
147
148
|
operator: [
|
|
@@ -181,9 +182,13 @@ export function removeUnwantedSections(obj, pageType, ribbonsData) {
|
|
|
181
182
|
(key === "recommended_casinos" || key === "popup") &&
|
|
182
183
|
Array.isArray(acc[key]?.modules?.[0]?.items?.[0]?.items)
|
|
183
184
|
) {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
const shouldLimitItems = key !== "popup" || !unlimitedPopupItems;
|
|
186
|
+
|
|
187
|
+
if (shouldLimitItems) {
|
|
188
|
+
acc[key].modules[0].items[0].items = acc[
|
|
189
|
+
key
|
|
190
|
+
].modules[0].items[0].items.slice(0, limit);
|
|
191
|
+
}
|
|
187
192
|
const { items } = acc[key].modules[0].items[0];
|
|
188
193
|
|
|
189
194
|
// Connect ribbons ID to label
|
|
@@ -135,6 +135,72 @@ describe("Common Helper", () => {
|
|
|
135
135
|
});
|
|
136
136
|
});
|
|
137
137
|
|
|
138
|
+
test("limits popup and recommended_casinos by default", () => {
|
|
139
|
+
const previousLimit = process.env.RECOMMENDED_CASINOS_NUMBER;
|
|
140
|
+
const previousUnlimitedUpper = process.env.UNLIMITED_POPUP_ITEMS;
|
|
141
|
+
process.env.RECOMMENDED_CASINOS_NUMBER = "2";
|
|
142
|
+
delete process.env.UNLIMITED_POPUP_ITEMS;
|
|
143
|
+
|
|
144
|
+
const sections = {
|
|
145
|
+
popup: {
|
|
146
|
+
modules: [{
|
|
147
|
+
items: [{
|
|
148
|
+
items: [{ id: 1 }, { id: 2 }, { id: 3 }],
|
|
149
|
+
}],
|
|
150
|
+
}],
|
|
151
|
+
},
|
|
152
|
+
recommended_casinos: {
|
|
153
|
+
modules: [{
|
|
154
|
+
items: [{
|
|
155
|
+
items: [{ id: 11 }, { id: 12 }, { id: 13 }],
|
|
156
|
+
}],
|
|
157
|
+
}],
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const result = removeUnwantedSections(sections, "operator", {});
|
|
162
|
+
expect(result.popup.modules[0].items[0].items).toHaveLength(2);
|
|
163
|
+
expect(result.recommended_casinos.modules[0].items[0].items).toHaveLength(2);
|
|
164
|
+
|
|
165
|
+
if (previousLimit === undefined) delete process.env.RECOMMENDED_CASINOS_NUMBER;
|
|
166
|
+
else process.env.RECOMMENDED_CASINOS_NUMBER = previousLimit;
|
|
167
|
+
if (previousUnlimitedUpper === undefined) delete process.env.UNLIMITED_POPUP_ITEMS;
|
|
168
|
+
else process.env.UNLIMITED_POPUP_ITEMS = previousUnlimitedUpper;
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
test("does not limit popup when UNLIMITED_POPUP_ITEMS is true", () => {
|
|
172
|
+
const previousLimit = process.env.RECOMMENDED_CASINOS_NUMBER;
|
|
173
|
+
const previousUnlimitedUpper = process.env.UNLIMITED_POPUP_ITEMS;
|
|
174
|
+
process.env.RECOMMENDED_CASINOS_NUMBER = "2";
|
|
175
|
+
process.env.UNLIMITED_POPUP_ITEMS = "true";
|
|
176
|
+
|
|
177
|
+
const sections = {
|
|
178
|
+
popup: {
|
|
179
|
+
modules: [{
|
|
180
|
+
items: [{
|
|
181
|
+
items: [{ id: 1 }, { id: 2 }, { id: 3 }],
|
|
182
|
+
}],
|
|
183
|
+
}],
|
|
184
|
+
},
|
|
185
|
+
recommended_casinos: {
|
|
186
|
+
modules: [{
|
|
187
|
+
items: [{
|
|
188
|
+
items: [{ id: 11 }, { id: 12 }, { id: 13 }],
|
|
189
|
+
}],
|
|
190
|
+
}],
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const result = removeUnwantedSections(sections, "operator", {});
|
|
195
|
+
expect(result.popup.modules[0].items[0].items).toHaveLength(3);
|
|
196
|
+
expect(result.recommended_casinos.modules[0].items[0].items).toHaveLength(2);
|
|
197
|
+
|
|
198
|
+
if (previousLimit === undefined) delete process.env.RECOMMENDED_CASINOS_NUMBER;
|
|
199
|
+
else process.env.RECOMMENDED_CASINOS_NUMBER = previousLimit;
|
|
200
|
+
if (previousUnlimitedUpper === undefined) delete process.env.UNLIMITED_POPUP_ITEMS;
|
|
201
|
+
else process.env.UNLIMITED_POPUP_ITEMS = previousUnlimitedUpper;
|
|
202
|
+
});
|
|
203
|
+
|
|
138
204
|
test("removes null and undefined values from objects", () => {
|
|
139
205
|
const input = { a: 1, b: null, c: undefined, d: 2 };
|
|
140
206
|
const output = clean(input);
|
package/src/resolver/modules.mjs
CHANGED
|
@@ -387,7 +387,7 @@ export function processTopListModule(
|
|
|
387
387
|
const itemsCount = +listItem.num_items_initial_load;
|
|
388
388
|
const toplistItem = toplists && listItem.id
|
|
389
389
|
? toplists[listItem.id.toString()] ||
|
|
390
|
-
|
|
390
|
+
toplists[`g_${listItem.id.toString()}`]
|
|
391
391
|
: undefined;
|
|
392
392
|
if (toplistItem) {
|
|
393
393
|
listItem.market = toplistItem.market?.short_code;
|
|
@@ -413,24 +413,24 @@ export function processTopListModule(
|
|
|
413
413
|
// build top list
|
|
414
414
|
listItem.items = listItem.items
|
|
415
415
|
? listItem.items
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
416
|
+
.filter(
|
|
417
|
+
(item) =>
|
|
418
|
+
Object.values(relations.operator).find(
|
|
419
|
+
(operator) =>
|
|
420
|
+
operator.operator_id === item.operator_id &&
|
|
421
|
+
operator.market === listItem.market &&
|
|
422
|
+
type === operator.type
|
|
423
|
+
) ||
|
|
424
|
+
Object.values(relations.game).find(
|
|
425
|
+
(game) => game.game_id === item.game_id
|
|
426
|
+
)
|
|
427
|
+
)
|
|
428
|
+
.map((item) => {
|
|
429
|
+
if (item.operator_id) return processOperatorToplist(item, ctx);
|
|
430
|
+
if (item.game_id) return processGameToplist(item, ctx);
|
|
431
|
+
return null;
|
|
432
|
+
})
|
|
433
|
+
.filter(Boolean)
|
|
434
434
|
: [];
|
|
435
435
|
const latestItems = listItem.items
|
|
436
436
|
.map((toplist) => ({
|
|
@@ -456,10 +456,10 @@ export function processTopListModule(
|
|
|
456
456
|
// eslint-disable-next-line no-restricted-globals
|
|
457
457
|
latestUpdatedDate instanceof Date && !isNaN(latestUpdatedDate)
|
|
458
458
|
? new Intl.DateTimeFormat("en-US", {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
459
|
+
year: "numeric",
|
|
460
|
+
month: "long",
|
|
461
|
+
day: "numeric",
|
|
462
|
+
}).format(latestUpdatedDate)
|
|
463
463
|
: null;
|
|
464
464
|
|
|
465
465
|
listItem.latest_items = formattedLatestItems;
|
|
@@ -513,15 +513,22 @@ export function shouldSavePrefilled(module = {}, siteName) {
|
|
|
513
513
|
);
|
|
514
514
|
}
|
|
515
515
|
|
|
516
|
-
export function processSpotlightModule(module = {}, content, previewPageID) {
|
|
517
|
-
module.
|
|
518
|
-
item
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
)
|
|
524
|
-
|
|
516
|
+
export function processSpotlightModule(module = {}, content, relations, ribbons, previewPageID) {
|
|
517
|
+
if (module.mode === "sport_odds") {
|
|
518
|
+
module.items.forEach((item) => {
|
|
519
|
+
item.relation = relations?.[item.page.relation_id];
|
|
520
|
+
item.page.ribbons = item.page.ribbon_ids.map((id) => ribbons?.[id]);
|
|
521
|
+
});
|
|
522
|
+
} else {
|
|
523
|
+
module.items.forEach((item) => {
|
|
524
|
+
item.content = trailingSlash(
|
|
525
|
+
previewPageID ? item.content : (content && content[item.content]) || ""
|
|
526
|
+
);
|
|
527
|
+
item.text = trailingSlash(
|
|
528
|
+
previewPageID ? item.text : (content && content[item.text]) || "",
|
|
529
|
+
);
|
|
530
|
+
});
|
|
531
|
+
}
|
|
525
532
|
|
|
526
533
|
return module;
|
|
527
534
|
}
|
|
@@ -542,23 +549,23 @@ export function processFaq(module = {}, content, relationData, previewPageID) {
|
|
|
542
549
|
previewPageID
|
|
543
550
|
? generatePlaceholderString(item.question, null, relationData)
|
|
544
551
|
: (content
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
552
|
+
? generatePlaceholderString(
|
|
553
|
+
content[item.question],
|
|
554
|
+
null,
|
|
555
|
+
relationData
|
|
556
|
+
)
|
|
557
|
+
: "") || ""
|
|
551
558
|
);
|
|
552
559
|
item.answer = trailingSlash(
|
|
553
560
|
previewPageID
|
|
554
561
|
? generatePlaceholderString(item.answer, null, relationData)
|
|
555
562
|
: (content &&
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
563
|
+
generatePlaceholderString(
|
|
564
|
+
content[item.answer],
|
|
565
|
+
null,
|
|
566
|
+
relationData
|
|
567
|
+
)) ||
|
|
568
|
+
""
|
|
562
569
|
);
|
|
563
570
|
});
|
|
564
571
|
}
|
|
@@ -599,13 +606,14 @@ export function processModule(
|
|
|
599
606
|
prefilledMarketModules,
|
|
600
607
|
previewPageID
|
|
601
608
|
) {
|
|
609
|
+
|
|
602
610
|
module.module_title =
|
|
603
611
|
module.module_title &&
|
|
604
612
|
generatePlaceholderString(module.module_title, translations, relationData);
|
|
605
613
|
module.title =
|
|
606
614
|
module.title &&
|
|
607
615
|
generatePlaceholderString(module.title, translations, relationData);
|
|
608
|
-
|
|
616
|
+
|
|
609
617
|
module.anchor_slug =
|
|
610
618
|
module.anchor_slug &&
|
|
611
619
|
generatePlaceholderString(module.anchor_slug, translations, relationData);
|
|
@@ -616,7 +624,7 @@ export function processModule(
|
|
|
616
624
|
module.module_introduction,
|
|
617
625
|
translations,
|
|
618
626
|
relationData,
|
|
619
|
-
);
|
|
627
|
+
);
|
|
620
628
|
|
|
621
629
|
// See more link
|
|
622
630
|
if (
|
|
@@ -663,7 +671,7 @@ export function processModule(
|
|
|
663
671
|
} else if (module.name === "anchor") {
|
|
664
672
|
processAnchor(module, relationData, translations);
|
|
665
673
|
} else if (module.name === "spotlights") {
|
|
666
|
-
processSpotlightModule(module, content, previewPageID);
|
|
674
|
+
processSpotlightModule(module, content, relations?.operator, data?.ribbons, previewPageID);
|
|
667
675
|
} else if (module.name === "menu" && menus && menus[module.menu_id]) {
|
|
668
676
|
module = Object.assign(module, menus[module.menu_id]);
|
|
669
677
|
} else if (module.name === "statistics_counter") {
|