gatsby-core-theme 44.3.1 → 45.0.0-beta.1
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 +6 -161
- package/gatsby-node.mjs +0 -3
- package/package.json +1 -1
- package/src/components/atoms/admin/bar/layout-section/index.js +5 -5
- package/src/components/atoms/button/operator-cta.js +3 -1
- package/src/components/atoms/notifications/notification-items/cards-v2/index.js +33 -15
- package/src/components/molecules/bonus-box/template-one/index.js +0 -1
- package/src/components/molecules/bonus-box/template-three/index.js +1 -2
- package/src/components/molecules/floating-area/index.js +22 -22
- package/src/components/organisms/cookie-consent/cookie-consent.module.scss +1 -2
- package/src/components/organisms/cookie-consent/index.js +1 -1
- package/src/components/organisms/search/index.js +14 -11
- package/src/components/organisms/search/variable/index.js +1 -1
- package/src/components/organisms/search/variable/searchVariable.test.js +2 -0
- package/src/constants/site-settings/main.mjs +1 -1
- package/src/constants/site-settings/navigation.js +0 -1
- package/src/context/MainProvider.js +4 -12
- package/src/helpers/date-time.js +0 -22
- package/src/helpers/date-time.test.js +1 -16
- package/src/helpers/getters.mjs +0 -17
- package/src/helpers/getters.test.js +0 -52
- package/src/resolver/archive.mjs +0 -1
- package/src/resolver/common.mjs +1 -1
- package/src/resolver/index.mjs +33 -40
- package/src/resolver/modules.mjs +85 -116
- package/src/resolver/relations.mjs +0 -21
- package/src/resolver/sports-relations.mjs +0 -1
- package/src/services/api.mjs +0 -4
- package/src/services/fetch.mjs +4 -8
- package/src/resolver/build-toplist-filter.mjs +0 -66
- package/src/resolver/build-toplist-filter.test.js +0 -104
package/src/helpers/getters.mjs
CHANGED
|
@@ -241,23 +241,6 @@ export function getBonus(name, operator) {
|
|
|
241
241
|
return null;
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
export function getPromoCode(item, tracker) {
|
|
245
|
-
|
|
246
|
-
if (!item) {
|
|
247
|
-
return null;
|
|
248
|
-
}
|
|
249
|
-
if (
|
|
250
|
-
item.bonuses &&
|
|
251
|
-
item.bonuses.hasOwnProperty(tracker) &&
|
|
252
|
-
item.bonuses[tracker].promo_code !== ""
|
|
253
|
-
) {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
return item.bonuses[tracker].promo_code;
|
|
257
|
-
}
|
|
258
|
-
return null;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
244
|
export function getGameExtraField(relation, key) {
|
|
262
245
|
if (
|
|
263
246
|
relation &&
|
|
@@ -502,56 +502,4 @@ describe('Getters Helper', () => {
|
|
|
502
502
|
test('should handle null content', () => {
|
|
503
503
|
expect(Getters.trailingSlash(null)).toBeNull();
|
|
504
504
|
});
|
|
505
|
-
test("returns null if item is null", () => {
|
|
506
|
-
expect(Getters.getPromoCode(null, "main")).toBeNull();
|
|
507
|
-
});
|
|
508
|
-
|
|
509
|
-
test("returns null if bonuses object is missing", () => {
|
|
510
|
-
const item = {};
|
|
511
|
-
expect(Getters.getPromoCode(item, "main")).toBeNull();
|
|
512
|
-
});
|
|
513
|
-
|
|
514
|
-
test("returns null if promo code is an empty string", () => {
|
|
515
|
-
const item = {
|
|
516
|
-
bonuses: {
|
|
517
|
-
main: {
|
|
518
|
-
promo_code: "",
|
|
519
|
-
},
|
|
520
|
-
},
|
|
521
|
-
};
|
|
522
|
-
expect(Getters.getPromoCode(item, "main")).toBeNull();
|
|
523
|
-
});
|
|
524
|
-
|
|
525
|
-
test("returns correct promo code when it exists for tracker", () => {
|
|
526
|
-
const item = {
|
|
527
|
-
bonuses: {
|
|
528
|
-
main: {
|
|
529
|
-
promo_code: "PROMO123",
|
|
530
|
-
},
|
|
531
|
-
},
|
|
532
|
-
};
|
|
533
|
-
expect(Getters.getPromoCode(item, "main")).toBe("PROMO123");
|
|
534
|
-
});
|
|
535
|
-
|
|
536
|
-
test("returns null if tracker does not exist in bonuses", () => {
|
|
537
|
-
const item = {
|
|
538
|
-
bonuses: {
|
|
539
|
-
other: {
|
|
540
|
-
promo_code: "SOMECODE",
|
|
541
|
-
},
|
|
542
|
-
},
|
|
543
|
-
};
|
|
544
|
-
expect(Getters.getPromoCode(item, "main")).toBeNull();
|
|
545
|
-
});
|
|
546
|
-
|
|
547
|
-
test("returns correct promo code for non-main tracker", () => {
|
|
548
|
-
const item = {
|
|
549
|
-
bonuses: {
|
|
550
|
-
exclusive: {
|
|
551
|
-
promo_code: "EXCL2025",
|
|
552
|
-
},
|
|
553
|
-
},
|
|
554
|
-
};
|
|
555
|
-
expect(Getters.getPromoCode(item, "exclusive")).toBe("EXCL2025");
|
|
556
|
-
});
|
|
557
505
|
});
|
package/src/resolver/archive.mjs
CHANGED
package/src/resolver/common.mjs
CHANGED
|
@@ -171,7 +171,7 @@ export function removeUnwantedSections(obj, pageType, ribbonsData) {
|
|
|
171
171
|
]);
|
|
172
172
|
|
|
173
173
|
// Filter the object to retain only the sections in the sectionsToKeep set
|
|
174
|
-
const filteredObject = Object.keys(obj
|
|
174
|
+
const filteredObject = Object.keys(obj).reduce((acc, key) => {
|
|
175
175
|
if (sectionsToKeep.has(key)) {
|
|
176
176
|
acc[key] = obj[key];
|
|
177
177
|
|
package/src/resolver/index.mjs
CHANGED
|
@@ -113,20 +113,21 @@ export function transform(response) {
|
|
|
113
113
|
Object.keys(pages[market][pageType]).forEach((pageId) => {
|
|
114
114
|
const page = pages[market][pageType][pageId];
|
|
115
115
|
if (
|
|
116
|
-
mainSettings[page.relation_type] &&
|
|
117
|
-
mainSettings[page.relation_type].reading_time &&
|
|
116
|
+
mainSettings[page.relation_type] && mainSettings[page.relation_type].reading_time &&
|
|
118
117
|
mainSettings[page.relation_type].reading_time[
|
|
119
118
|
process.env.GATSBY_SITE_NAME
|
|
120
119
|
]
|
|
121
120
|
) {
|
|
122
121
|
page.reading_time = getReadingTime(page.sections, response.content);
|
|
123
122
|
}
|
|
123
|
+
|
|
124
124
|
|
|
125
125
|
if (response.site_markets[siteMarket].path_prefix && page) {
|
|
126
126
|
// set page prefix for multiple markets
|
|
127
127
|
page.path = `${response.site_markets[siteMarket].path_prefix}${
|
|
128
128
|
page.path !== "/" ? `/${page.path}` : ""
|
|
129
129
|
}`;
|
|
130
|
+
|
|
130
131
|
transformed[siteMarket][pageType].push(page);
|
|
131
132
|
} else if (page) {
|
|
132
133
|
transformed[siteMarket][pageType].push(page);
|
|
@@ -177,19 +178,13 @@ export function processSections(
|
|
|
177
178
|
shouldSavePrefilled(module, siteName) &&
|
|
178
179
|
savedModules[module.module_value_id]
|
|
179
180
|
) {
|
|
180
|
-
const filteredModule = cloneDeep(
|
|
181
|
-
savedModules[module.module_value_id]
|
|
182
|
-
);
|
|
181
|
+
const filteredModule = cloneDeep(savedModules[module.module_value_id]);
|
|
183
182
|
|
|
184
183
|
const relationID = pagesMappedById[pageId]?.relation_id;
|
|
185
|
-
if (
|
|
186
|
-
filteredModule.
|
|
187
|
-
relationID &&
|
|
188
|
-
filteredModule.items
|
|
184
|
+
if (filteredModule.name === 'cards_v2' &&
|
|
185
|
+
relationID && filteredModule.items
|
|
189
186
|
) {
|
|
190
|
-
filteredModule.items = filteredModule.items.filter(
|
|
191
|
-
(item) => !item.relation || item.relation.id !== relationID
|
|
192
|
-
);
|
|
187
|
+
filteredModule.items = filteredModule.items.filter((item) => !item.relation || item.relation.id !== relationID);
|
|
193
188
|
}
|
|
194
189
|
|
|
195
190
|
Object.assign(module, filteredModule);
|
|
@@ -200,11 +195,13 @@ export function processSections(
|
|
|
200
195
|
module = {
|
|
201
196
|
...cloneDeep(
|
|
202
197
|
prefilledMarketModules[module.module_value_id] ||
|
|
203
|
-
|
|
198
|
+
prefilledMarketModules[module.value_id]
|
|
204
199
|
),
|
|
205
200
|
value_type: ModuleValue.VALUE_TYPE_PREFILLED_MODULE_MARKET,
|
|
206
201
|
};
|
|
207
202
|
}
|
|
203
|
+
|
|
204
|
+
|
|
208
205
|
processModule(
|
|
209
206
|
module,
|
|
210
207
|
pages,
|
|
@@ -219,14 +216,9 @@ export function processSections(
|
|
|
219
216
|
toplists,
|
|
220
217
|
content
|
|
221
218
|
);
|
|
219
|
+
|
|
222
220
|
sections[sectionKey].modules[key] = module;
|
|
223
|
-
|
|
224
|
-
if (!page?.topListFilters) {
|
|
225
|
-
page.toplistFilters = module.filters;
|
|
226
|
-
module.topListFilters = true;
|
|
227
|
-
}
|
|
228
|
-
delete module.filters;
|
|
229
|
-
}
|
|
221
|
+
|
|
230
222
|
if (shouldSavePrefilled(module, siteName)) {
|
|
231
223
|
savedModules[module.module_value_id] = module;
|
|
232
224
|
}
|
|
@@ -247,10 +239,7 @@ export function getReadingTime(sections, content) {
|
|
|
247
239
|
sections[sectionKey].modules.forEach((module) => {
|
|
248
240
|
// calculate reading time
|
|
249
241
|
if (module.name === "content") {
|
|
250
|
-
const nrOfWords =
|
|
251
|
-
removeTags(content ? content[module.value] : module.value).split(
|
|
252
|
-
" "
|
|
253
|
-
).length / 250;
|
|
242
|
+
const nrOfWords = removeTags(content ? content[module.value] : module.value).split(" ").length / 250;
|
|
254
243
|
const minPerModule = Math.floor(nrOfWords);
|
|
255
244
|
const secPerModule = Math.floor((nrOfWords % 1) * 60);
|
|
256
245
|
|
|
@@ -288,7 +277,7 @@ function processSearchData(data, fs, filename) {
|
|
|
288
277
|
if (error) {
|
|
289
278
|
console.log(
|
|
290
279
|
chalk.magenta("info") +
|
|
291
|
-
|
|
280
|
+
chalk.whiteBright(` Error writing search json file : ${error}`)
|
|
292
281
|
);
|
|
293
282
|
}
|
|
294
283
|
}
|
|
@@ -327,6 +316,7 @@ export function processExtraFields(
|
|
|
327
316
|
}
|
|
328
317
|
|
|
329
318
|
function updatePlaceholders(page, data, translationsData) {
|
|
319
|
+
|
|
330
320
|
page.title =
|
|
331
321
|
page.title &&
|
|
332
322
|
generatePlaceholderString(page.title, translationsData, {
|
|
@@ -338,21 +328,21 @@ function updatePlaceholders(page, data, translationsData) {
|
|
|
338
328
|
page.meta_title &&
|
|
339
329
|
generatePlaceholderString(page.meta_title, translationsData, {
|
|
340
330
|
siteName: data.site_name,
|
|
341
|
-
pageTitle: page.title
|
|
331
|
+
pageTitle: page.title
|
|
342
332
|
});
|
|
343
333
|
|
|
344
334
|
page.meta_description =
|
|
345
335
|
page.meta_description &&
|
|
346
336
|
generatePlaceholderString(page.meta_description, translationsData, {
|
|
347
337
|
siteName: data.site_name,
|
|
348
|
-
pageTitle: page.title
|
|
338
|
+
pageTitle: page.title
|
|
349
339
|
});
|
|
350
340
|
}
|
|
351
341
|
|
|
352
342
|
export default {
|
|
353
343
|
run(data, themeOptions, fs, translationsData, previewPageID = null) {
|
|
354
344
|
const start = new Date();
|
|
355
|
-
const transformedPages = transform(data);
|
|
345
|
+
const transformedPages = transform(data);
|
|
356
346
|
|
|
357
347
|
const allResponsibleGaming = data.responsible_gamings || null;
|
|
358
348
|
const generalData = data.general;
|
|
@@ -375,11 +365,12 @@ export default {
|
|
|
375
365
|
|
|
376
366
|
const searchEnabled =
|
|
377
367
|
themeOptions.searchEnabled !== undefined &&
|
|
378
|
-
|
|
368
|
+
themeOptions.searchEnabled !== null
|
|
379
369
|
? themeOptions.searchEnabled
|
|
380
370
|
: true;
|
|
381
371
|
|
|
382
372
|
menus = data.menus;
|
|
373
|
+
|
|
383
374
|
// Menu changes when there is a path prefix configured on hercules
|
|
384
375
|
Object.keys(menus).forEach((menu) => {
|
|
385
376
|
if (data?.site_markets[menus[menu]?.market]?.path_prefix !== null) {
|
|
@@ -389,6 +380,7 @@ export default {
|
|
|
389
380
|
);
|
|
390
381
|
}
|
|
391
382
|
});
|
|
383
|
+
|
|
392
384
|
Object.keys(data.site_markets).forEach((market) => {
|
|
393
385
|
relations = data.relations;
|
|
394
386
|
pages = transformedPages[market];
|
|
@@ -401,12 +393,10 @@ export default {
|
|
|
401
393
|
|
|
402
394
|
Object.keys(transformedPages[market]).forEach((pageType) => {
|
|
403
395
|
transformedPages[market][pageType].forEach((page, index) => {
|
|
404
|
-
// Check if it should build fuilters for this template
|
|
405
396
|
const translations = translationsData
|
|
406
397
|
? translationsData[page.language]
|
|
407
398
|
: {};
|
|
408
399
|
// process page extra fields
|
|
409
|
-
//
|
|
410
400
|
page.extra_fields &&
|
|
411
401
|
processExtraFields(
|
|
412
402
|
page.extra_fields,
|
|
@@ -414,6 +404,7 @@ export default {
|
|
|
414
404
|
relations,
|
|
415
405
|
data.content
|
|
416
406
|
);
|
|
407
|
+
|
|
417
408
|
updatePlaceholders(page, generalData, translations);
|
|
418
409
|
|
|
419
410
|
// Set Affiliate relations
|
|
@@ -537,7 +528,7 @@ export default {
|
|
|
537
528
|
extra_fields?.operator &&
|
|
538
529
|
filterRelation(
|
|
539
530
|
extra_fields?.operator,
|
|
540
|
-
searchReleationPickKeys
|
|
531
|
+
searchReleationPickKeys.operator
|
|
541
532
|
);
|
|
542
533
|
|
|
543
534
|
const minimalPage = {
|
|
@@ -558,14 +549,12 @@ export default {
|
|
|
558
549
|
cloneDeep({
|
|
559
550
|
...minimalPage,
|
|
560
551
|
...(filteredRelation && { relation: filteredRelation }),
|
|
561
|
-
...(filteredAuthorRelation && {
|
|
562
|
-
|
|
563
|
-
}),
|
|
564
|
-
...(operatorExtraFileds && {
|
|
552
|
+
...(filteredAuthorRelation && { author: filteredAuthorRelation }),
|
|
553
|
+
...operatorExtraFileds && {
|
|
565
554
|
extra_fields: {
|
|
566
|
-
operator: operatorExtraFileds
|
|
567
|
-
}
|
|
568
|
-
}
|
|
555
|
+
operator: operatorExtraFileds
|
|
556
|
+
}
|
|
557
|
+
},
|
|
569
558
|
})
|
|
570
559
|
);
|
|
571
560
|
}
|
|
@@ -586,6 +575,7 @@ export default {
|
|
|
586
575
|
const postSectionModules =
|
|
587
576
|
data.market_sections[market][res].modules || [];
|
|
588
577
|
postSectionModules.forEach((item) => {
|
|
578
|
+
|
|
589
579
|
if (!page.sections.main) {
|
|
590
580
|
return;
|
|
591
581
|
}
|
|
@@ -600,6 +590,7 @@ export default {
|
|
|
600
590
|
ModuleValue.VALUE_TYPE_PREFILLED_MODULE_MARKET,
|
|
601
591
|
});
|
|
602
592
|
} else {
|
|
593
|
+
|
|
603
594
|
if (
|
|
604
595
|
transformedPages[market][pageType][index].relation &&
|
|
605
596
|
checkForInactiveOperatorToplist(
|
|
@@ -620,6 +611,7 @@ export default {
|
|
|
620
611
|
});
|
|
621
612
|
});
|
|
622
613
|
|
|
614
|
+
|
|
623
615
|
// fill market sections
|
|
624
616
|
if (data.market_sections[market]) {
|
|
625
617
|
data.market_sections[market] = processSections(
|
|
@@ -634,7 +626,7 @@ export default {
|
|
|
634
626
|
data.content
|
|
635
627
|
);
|
|
636
628
|
}
|
|
637
|
-
|
|
629
|
+
|
|
638
630
|
// fill page sections
|
|
639
631
|
if (transformedPages[market]) {
|
|
640
632
|
Object.keys(transformedPages[market]).forEach((pageType) => {
|
|
@@ -645,6 +637,7 @@ export default {
|
|
|
645
637
|
(page.sections && !previewPageID) ||
|
|
646
638
|
(previewPageID && page.id === previewPageID)
|
|
647
639
|
) {
|
|
640
|
+
|
|
648
641
|
transformedPages[market][pageType][index] = Object.assign(page, {
|
|
649
642
|
sections: processSections(
|
|
650
643
|
page.sections,
|
package/src/resolver/modules.mjs
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import loadash from "lodash/index.js";
|
|
6
6
|
import { generatePlaceholderString } from "../helpers/generators.mjs";
|
|
7
7
|
import { anchorLink, removeSymbols } from "../helpers/strings.mjs";
|
|
8
|
-
import { stripDomainAndLeadingSlash } from "../helpers/path.mjs";
|
|
9
8
|
import {
|
|
10
9
|
clonePageForCards,
|
|
11
10
|
groupBy,
|
|
@@ -15,12 +14,7 @@ import {
|
|
|
15
14
|
import { sanitizeOperatorData } from "./operators.mjs";
|
|
16
15
|
import settings from "../constants/settings.mjs";
|
|
17
16
|
import ModuleValue from "../constants/module-value.mjs";
|
|
18
|
-
import {
|
|
19
|
-
shiftFirstOperator,
|
|
20
|
-
getModuleTitle,
|
|
21
|
-
trailingSlash,
|
|
22
|
-
} from "../helpers/getters.mjs";
|
|
23
|
-
import buildToplistFilter from "./build-toplist-filter.mjs";
|
|
17
|
+
import { shiftFirstOperator, getModuleTitle, trailingSlash } from "../helpers/getters.mjs";
|
|
24
18
|
|
|
25
19
|
const pagesGroupedByTemplateId = [];
|
|
26
20
|
const cardItems = {};
|
|
@@ -190,7 +184,7 @@ export function processCardsV2(
|
|
|
190
184
|
// Populate pagesList if page type and template exists
|
|
191
185
|
pagesList =
|
|
192
186
|
!pagesGroupedByTemplateId[`${cardType}_${market}`] ||
|
|
193
|
-
|
|
187
|
+
!pagesGroupedByTemplateId[`${cardType}_${market}`][pageTemplateId]
|
|
194
188
|
? []
|
|
195
189
|
: pagesGroupedByTemplateId[`${cardType}_${market}`][pageTemplateId];
|
|
196
190
|
} else {
|
|
@@ -282,6 +276,7 @@ export function processCardsV2(
|
|
|
282
276
|
}
|
|
283
277
|
}
|
|
284
278
|
|
|
279
|
+
|
|
285
280
|
if (styleName !== "comparison_table") {
|
|
286
281
|
const relationID = pagesMappedById[pageId]?.relation_id;
|
|
287
282
|
|
|
@@ -292,6 +287,7 @@ export function processCardsV2(
|
|
|
292
287
|
}
|
|
293
288
|
}
|
|
294
289
|
|
|
290
|
+
|
|
295
291
|
if (
|
|
296
292
|
styleName === "comparison_table" &&
|
|
297
293
|
pageId !== null &&
|
|
@@ -306,8 +302,7 @@ export function processCardsV2(
|
|
|
306
302
|
}
|
|
307
303
|
|
|
308
304
|
// modify page so it doesn't have too much data
|
|
309
|
-
module.items = module.items.map((item) =>
|
|
310
|
-
clonePageForCards(cloneDeep(item), module.style, content)
|
|
305
|
+
module.items = module.items.map((item) => clonePageForCards(cloneDeep(item), module.style, content)
|
|
311
306
|
);
|
|
312
307
|
}
|
|
313
308
|
|
|
@@ -332,33 +327,19 @@ export function processTopListModule(
|
|
|
332
327
|
data,
|
|
333
328
|
toplists
|
|
334
329
|
) {
|
|
335
|
-
const filterEnabled = module.style === "filter";
|
|
336
|
-
const filters = {
|
|
337
|
-
popular_filters: {
|
|
338
|
-
best_online: { items: [] },
|
|
339
|
-
crypto: { items: [] },
|
|
340
|
-
mobile_optimized: { items: [] },
|
|
341
|
-
best_live: { items: [] },
|
|
342
|
-
},
|
|
343
|
-
rating: {
|
|
344
|
-
1: { items: [] },
|
|
345
|
-
2: { items: [] },
|
|
346
|
-
3: { items: [] },
|
|
347
|
-
4: { items: [] },
|
|
348
|
-
5: { items: [] },
|
|
349
|
-
},
|
|
350
|
-
game_categories: {},
|
|
351
|
-
deposit_methods: {},
|
|
352
|
-
withdrawal_method: {},
|
|
353
|
-
payout_time: {},
|
|
354
|
-
payout_rate: {},
|
|
355
|
-
licenses: {},
|
|
356
|
-
};
|
|
357
|
-
|
|
358
330
|
module.items = module.items.map((listItem) => {
|
|
359
331
|
const { type } = listItem;
|
|
360
|
-
const showLoadMore =
|
|
361
|
-
const itemsCount =
|
|
332
|
+
const showLoadMore = listItem.show_load_more || 0;
|
|
333
|
+
const itemsCount = listItem.num_items_initial_load
|
|
334
|
+
? Number(listItem.num_items_initial_load)
|
|
335
|
+
: 0;
|
|
336
|
+
|
|
337
|
+
if (showLoadMore === 0 && itemsCount > 0) {
|
|
338
|
+
listItem.items = listItem.items
|
|
339
|
+
? listItem.items.slice(0, itemsCount)
|
|
340
|
+
: [];
|
|
341
|
+
}
|
|
342
|
+
|
|
362
343
|
if (listItem.id && toplists && toplists[listItem.id.toString()]) {
|
|
363
344
|
listItem.market = toplists[listItem.id].market?.short_code;
|
|
364
345
|
listItem.items = toplists[listItem.id].items;
|
|
@@ -366,84 +347,74 @@ export function processTopListModule(
|
|
|
366
347
|
listItem.tracker = toplists[listItem.id].tracker;
|
|
367
348
|
}
|
|
368
349
|
|
|
369
|
-
if (!showLoadMore && itemsCount) {
|
|
370
|
-
listItem.items = listItem.items?.slice(0, itemsCount);
|
|
371
|
-
}
|
|
372
|
-
|
|
373
350
|
listItem.items = listItem.items
|
|
374
351
|
? listItem.items.map((item) => {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
352
|
+
const operatorRelation = cloneDeep(
|
|
353
|
+
Object.values(relations.operator).find(
|
|
354
|
+
(operator) =>
|
|
355
|
+
operator.operator_id === item.operator_id &&
|
|
356
|
+
operator.market === listItem.market &&
|
|
357
|
+
type === operator.type
|
|
358
|
+
)
|
|
359
|
+
);
|
|
360
|
+
|
|
361
|
+
if (operatorRelation) {
|
|
362
|
+
operatorRelation.ribbons =
|
|
363
|
+
item.ribbon_ids && item.ribbon_ids.length === 0
|
|
364
|
+
? operatorRelation.ribbons
|
|
365
|
+
: item.ribbon_ids;
|
|
366
|
+
|
|
367
|
+
operatorRelation.selling_points =
|
|
368
|
+
item.selling_points && item.selling_points.length === 0
|
|
369
|
+
? operatorRelation.selling_points
|
|
370
|
+
: item.selling_points;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
operatorRelation.updated_at = item.updated_at;
|
|
374
|
+
operatorRelation.toplist_bonus = item.bonus_name;
|
|
375
|
+
|
|
376
|
+
const operatorPage =
|
|
377
|
+
pages && pages.operator && operatorRelation
|
|
378
|
+
? pages.operator.filter(
|
|
379
|
+
(page) =>
|
|
380
|
+
page.relation &&
|
|
381
|
+
page.relation.operator_id ===
|
|
382
|
+
operatorRelation.operator_id &&
|
|
383
|
+
page.relation.type === operatorRelation.type
|
|
381
384
|
)
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
operatorPage[0]?.path
|
|
414
|
-
: operatorPage[0]?.path;
|
|
415
|
-
|
|
416
|
-
const authorTitle =
|
|
417
|
-
operatorPage[0] && operatorPage[0]?.author?.author_title;
|
|
418
|
-
|
|
419
|
-
const clone = sanitizeOperatorData(
|
|
420
|
-
cloneDeep(operatorRelation),
|
|
421
|
-
operatorPage,
|
|
422
|
-
data,
|
|
423
|
-
toplists && toplists[listItem.id].label
|
|
424
|
-
);
|
|
425
|
-
|
|
426
|
-
const socialAuthorLinks = [
|
|
427
|
-
"facebook_profile",
|
|
428
|
-
"twitter_profile",
|
|
429
|
-
"instagram_profile",
|
|
430
|
-
"linkedin_profile",
|
|
431
|
-
];
|
|
432
|
-
if (filterEnabled) {
|
|
433
|
-
buildToplistFilter(filters, clone);
|
|
434
|
-
}
|
|
435
|
-
return Object.assign(clone, {
|
|
436
|
-
review_link: reviewLink,
|
|
437
|
-
author_title: authorTitle,
|
|
438
|
-
author_same_as:
|
|
439
|
-
operatorPage[0] &&
|
|
440
|
-
operatorPage[0]?.author &&
|
|
441
|
-
socialAuthorLinks
|
|
442
|
-
.map((socialLink) => operatorPage[0]?.author?.[socialLink])
|
|
443
|
-
.filter((socialLink) => socialLink),
|
|
444
|
-
});
|
|
445
|
-
})
|
|
385
|
+
: [];
|
|
386
|
+
|
|
387
|
+
const reviewLink =
|
|
388
|
+
process.env.DMS_REVIEW_LINKS_ENABLED === 'true'
|
|
389
|
+
? stripDomainAndLeadingSlash(operatorRelation?.review_link) || operatorPage[0]?.path
|
|
390
|
+
: operatorPage[0]?.path;
|
|
391
|
+
|
|
392
|
+
const authorTitle = operatorPage[0] && operatorPage[0]?.author?.author_title;
|
|
393
|
+
|
|
394
|
+
const clone = sanitizeOperatorData(
|
|
395
|
+
cloneDeep(operatorRelation),
|
|
396
|
+
operatorPage,
|
|
397
|
+
data,
|
|
398
|
+
toplists && toplists[listItem.id].label
|
|
399
|
+
);
|
|
400
|
+
|
|
401
|
+
const socialAuthorLinks = [
|
|
402
|
+
'facebook_profile',
|
|
403
|
+
'twitter_profile',
|
|
404
|
+
'instagram_profile',
|
|
405
|
+
'linkedin_profile',
|
|
406
|
+
];
|
|
407
|
+
|
|
408
|
+
return Object.assign(clone, {
|
|
409
|
+
review_link: reviewLink,
|
|
410
|
+
author_title: authorTitle,
|
|
411
|
+
author_same_as: operatorPage[0] && operatorPage[0]?.author && socialAuthorLinks
|
|
412
|
+
.map((socialLink) => operatorPage[0]?.author?.[socialLink])
|
|
413
|
+
.filter((socialLink) => socialLink),
|
|
414
|
+
});
|
|
415
|
+
})
|
|
446
416
|
: [];
|
|
417
|
+
|
|
447
418
|
const latestItems = listItem.items
|
|
448
419
|
.map((toplist) => ({
|
|
449
420
|
...toplist,
|
|
@@ -469,10 +440,10 @@ export function processTopListModule(
|
|
|
469
440
|
// eslint-disable-next-line no-restricted-globals
|
|
470
441
|
latestUpdatedDate instanceof Date && !isNaN(latestUpdatedDate)
|
|
471
442
|
? new Intl.DateTimeFormat("en-US", {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
443
|
+
year: "numeric",
|
|
444
|
+
month: "long",
|
|
445
|
+
day: "numeric",
|
|
446
|
+
}).format(latestUpdatedDate)
|
|
476
447
|
: null;
|
|
477
448
|
|
|
478
449
|
listItem.latest_items = formattedLatestItems;
|
|
@@ -480,8 +451,6 @@ export function processTopListModule(
|
|
|
480
451
|
|
|
481
452
|
return listItem;
|
|
482
453
|
});
|
|
483
|
-
|
|
484
|
-
if (filterEnabled) module.filters = filters;
|
|
485
454
|
}
|
|
486
455
|
|
|
487
456
|
export function processContentModule(
|
|
@@ -553,7 +522,7 @@ export function processFaq(module = {}, content, relationData) {
|
|
|
553
522
|
null,
|
|
554
523
|
relationData
|
|
555
524
|
)) ||
|
|
556
|
-
|
|
525
|
+
item.question
|
|
557
526
|
);
|
|
558
527
|
item.answer = trailingSlash(
|
|
559
528
|
(content && content[item.answer]) || item.answer
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-unused-expressions */
|
|
2
1
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
2
|
import loadash from "lodash/index.js";
|
|
4
3
|
import { pickRelationKeys } from "../constants/pick-keys.mjs";
|
|
@@ -29,26 +28,6 @@ export const processRelations = (
|
|
|
29
28
|
? cloneDeep(data.relations[page.relation_type][page.relation_id])
|
|
30
29
|
: null;
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
// Add path for software and license
|
|
34
|
-
if(page.relation_type === "operator" && (process.env.ENABLE_PATH_SOFTWARE_AND_LICENSE === 'true')) {
|
|
35
|
-
// Software
|
|
36
|
-
transformedPages[market][page.relation_type][
|
|
37
|
-
index
|
|
38
|
-
]?.relation?.software?.forEach(software => {
|
|
39
|
-
const mappedSoftware = transformedPages[market]?.software_provider?.filter(pr => pr.relation_id === software.id)[0];
|
|
40
|
-
mappedSoftware && (software.path = mappedSoftware.path);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
// License
|
|
44
|
-
transformedPages[market][page.relation_type][
|
|
45
|
-
index
|
|
46
|
-
]?.relation?.license_objects?.forEach(license => {
|
|
47
|
-
const mappedLicense = transformedPages[market]?.operators_license?.filter(l => l.relation_id === license.id)[0];
|
|
48
|
-
mappedLicense && (license.path = mappedLicense.path);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
31
|
switch (page.relation_type) {
|
|
53
32
|
// // Add path for game page from game provider
|
|
54
33
|
case "game":
|
package/src/services/api.mjs
CHANGED
|
@@ -118,10 +118,6 @@ export async function getProviders() {
|
|
|
118
118
|
return callAPIV2(`v0.1/globals/software-sorted-v2`);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
export async function getLicenses() {
|
|
122
|
-
return callAPIV2(`v0.1/operators/licenses/sorted`);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
121
|
export async function getGames(params) {
|
|
126
122
|
return callAPIV2(`v0.1/games/games-sorted-v2${params ? `?${params}` : ""}`);
|
|
127
123
|
}
|