gatsby-core-theme 44.22.2 → 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 +11 -0
- package/package.json +1 -1
- package/src/resolver/common.mjs +8 -3
- package/src/resolver/common.test.js +66 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
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
|
+
|
|
1
12
|
## [44.22.2](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.22.1...v44.22.2) (2026-04-24)
|
|
2
13
|
|
|
3
14
|
|
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);
|