gatsby-core-theme 40.0.36 → 40.0.38
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,22 @@
|
|
|
1
|
+
## [40.0.38](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v40.0.37...v40.0.38) (2024-11-20)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* betamerica issue ([3640184](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/36401841ab582b79273cfd9594523fc83059aff4))
|
|
7
|
+
* preview ([67752fb](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/67752fbafacfa464331a3936d20d8a1c80ac0f48))
|
|
8
|
+
* search data json ([74b4bc3](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/74b4bc36548c786305c82caae9e879c8a069fd5a))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
* Merge branch 'market-issue' into 'master' ([c343693](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/c3436931dfb8416d7ca26889058d54e65be7c189))
|
|
12
|
+
|
|
13
|
+
## [40.0.37](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v40.0.36...v40.0.37) (2024-11-18)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* remove trim from anchor ([5866c2c](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/5866c2cb7bf966b3b83d635cdba89849c4331e5b))
|
|
19
|
+
|
|
1
20
|
## [40.0.36](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v40.0.35...v40.0.36) (2024-11-14)
|
|
2
21
|
|
|
3
22
|
|
package/package.json
CHANGED
|
@@ -88,33 +88,34 @@ export function processSitemapPages(pages, markets) {
|
|
|
88
88
|
return pageListByMarket;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
const
|
|
92
|
-
const
|
|
91
|
+
const groupByMarketAndType = (data) => Object.values(data).reduce((acc, item) => {
|
|
92
|
+
const market = item.market;
|
|
93
93
|
const type = item.type;
|
|
94
94
|
|
|
95
95
|
// Initialize language and type groupings if not already present
|
|
96
|
-
if (!acc[
|
|
97
|
-
if (!acc[
|
|
96
|
+
if (!acc[market]) acc[market] = {};
|
|
97
|
+
if (!acc[market][type]) acc[market][type] = [];
|
|
98
98
|
|
|
99
99
|
// Add the item to the appropriate group
|
|
100
|
-
acc[
|
|
100
|
+
acc[market][type].push(item);
|
|
101
101
|
return acc;
|
|
102
102
|
}, {});
|
|
103
103
|
|
|
104
104
|
export function transform(response) {
|
|
105
105
|
const transformed = {};
|
|
106
106
|
|
|
107
|
-
const pages =
|
|
107
|
+
const pages = groupByMarketAndType(response.pages);
|
|
108
|
+
|
|
108
109
|
|
|
109
110
|
Object.keys(response.site_markets).forEach((siteMarket) => {
|
|
110
|
-
const
|
|
111
|
+
const market = siteMarket
|
|
111
112
|
transformed[siteMarket] = {};
|
|
112
113
|
|
|
113
|
-
if (pages[
|
|
114
|
-
Object.keys(pages[
|
|
114
|
+
if (pages[market]) {
|
|
115
|
+
Object.keys(pages[market]).forEach((pageType) => {
|
|
115
116
|
transformed[siteMarket][pageType] = [];
|
|
116
|
-
Object.keys(pages[
|
|
117
|
-
const page = pages[
|
|
117
|
+
Object.keys(pages[market][pageType]).forEach((pageId) => {
|
|
118
|
+
const page = pages[market][pageType][pageId];
|
|
118
119
|
|
|
119
120
|
if (response.site_markets[siteMarket].path_prefix && page) {
|
|
120
121
|
// set page prefix for multiple markets
|
|
@@ -279,6 +280,7 @@ export function processExtraFields(
|
|
|
279
280
|
return;
|
|
280
281
|
}
|
|
281
282
|
Object.keys(extraFields).forEach((key) => {
|
|
283
|
+
if (key && extraFields[key]) {
|
|
282
284
|
const { type, value } = extraFields[key];
|
|
283
285
|
|
|
284
286
|
if (type === "operator") {
|
|
@@ -300,6 +302,7 @@ export function processExtraFields(
|
|
|
300
302
|
} else {
|
|
301
303
|
extraFields[key] = value;
|
|
302
304
|
}
|
|
305
|
+
}
|
|
303
306
|
});
|
|
304
307
|
}
|
|
305
308
|
|
|
@@ -554,10 +557,6 @@ export default {
|
|
|
554
557
|
});
|
|
555
558
|
});
|
|
556
559
|
|
|
557
|
-
if (searchEnabled) {
|
|
558
|
-
processSearchData(searchData, fs);
|
|
559
|
-
}
|
|
560
|
-
|
|
561
560
|
pagesCloned = cloneDeep(transformedPages[market]);
|
|
562
561
|
|
|
563
562
|
// fill market sections
|
|
@@ -603,6 +602,10 @@ export default {
|
|
|
603
602
|
}
|
|
604
603
|
});
|
|
605
604
|
|
|
605
|
+
if (searchEnabled) {
|
|
606
|
+
processSearchData(searchData, fs);
|
|
607
|
+
}
|
|
608
|
+
|
|
606
609
|
data.pages = transformedPages;
|
|
607
610
|
const end = new Date() - start;
|
|
608
611
|
console.log(
|
|
@@ -4,37 +4,38 @@
|
|
|
4
4
|
import loadSource from '~helpers/search-source';
|
|
5
5
|
import { deparam } from '~helpers/strings';
|
|
6
6
|
import { groupBy } from '~helpers/getters';
|
|
7
|
-
import {getData} from '~helpers/api'
|
|
7
|
+
import { getData } from '~helpers/api'
|
|
8
8
|
import processor from "./processor/index.mjs";
|
|
9
9
|
import { fetchSiteSettings } from './fetch-site-settings.mjs';
|
|
10
|
-
|
|
11
|
-
export async function getAPIData(page, url, headers, preview) {
|
|
10
|
+
|
|
11
|
+
export async function getAPIData(page, url, headers, preview) {
|
|
12
12
|
if (preview) {
|
|
13
13
|
try {
|
|
14
|
-
const siteName = process.env.GATSBY_SITE_NAME;
|
|
14
|
+
const siteName = process.env.GATSBY_SITE_NAME;
|
|
15
15
|
const params = deparam(url.split('?')[1]);
|
|
16
16
|
// eslint-disable-next-line camelcase
|
|
17
17
|
const response = await getData(siteName, params?.path, params?.market_id, true);
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const { siteSettingsData, siteGeneralData, responsableGamingData, toplistData, contentData, ribbonsData } = await fetchSiteSettings(siteName, true);
|
|
19
|
+
|
|
20
20
|
const pagePreview = response.pages.preview;
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
const processed = processor.run({
|
|
23
23
|
...response,
|
|
24
24
|
siteSettingsData,
|
|
25
25
|
general: siteGeneralData,
|
|
26
|
-
prefilled_market_modules:siteSettingsData.prefilled_modules,
|
|
26
|
+
prefilled_market_modules: siteSettingsData.prefilled_modules,
|
|
27
27
|
responsible_gamings: responsableGamingData,
|
|
28
28
|
toplists: toplistData,
|
|
29
29
|
content: contentData,
|
|
30
30
|
ribbons: ribbonsData
|
|
31
|
-
},{}, null, null, true);
|
|
32
|
-
|
|
31
|
+
}, {}, null, null, true);
|
|
32
|
+
|
|
33
|
+
|
|
33
34
|
const pagePreviewProcessed = processed.pages[pagePreview.market][
|
|
34
35
|
pagePreview.relation_type
|
|
35
36
|
// eslint-disable-next-line no-shadow
|
|
36
|
-
]
|
|
37
|
-
|
|
37
|
+
][0]
|
|
38
|
+
|
|
38
39
|
return {
|
|
39
40
|
props: {
|
|
40
41
|
marketSections: processed.market_sections[pagePreview.market],
|
|
@@ -49,23 +50,23 @@ export async function getAPIData(page, url, headers, preview) {
|
|
|
49
50
|
console.log("Error fetching preview data:", error);
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
|
-
|
|
53
|
+
|
|
53
54
|
const results = await loadSource(page.market);
|
|
54
55
|
if (page.path.endsWith('/s') || page.path === 's') {
|
|
55
56
|
let urlParams = null;
|
|
56
57
|
if (url && url.split('?').length === 2) {
|
|
57
58
|
urlParams = deparam(`${url.split('?')[1]}`);
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
+
|
|
60
61
|
const searchData = urlParams
|
|
61
62
|
? urlParams.hasOwnProperty('s')
|
|
62
63
|
? groupBy(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
results.filter((item) => item.title.toLowerCase().includes(urlParams.s.toLowerCase())),
|
|
65
|
+
'type'
|
|
66
|
+
)
|
|
66
67
|
: null
|
|
67
68
|
: null;
|
|
68
|
-
|
|
69
|
+
|
|
69
70
|
return {
|
|
70
71
|
props: {
|
|
71
72
|
data: searchData,
|
|
@@ -73,10 +74,10 @@ export async function getAPIData(page, url, headers, preview) {
|
|
|
73
74
|
},
|
|
74
75
|
};
|
|
75
76
|
}
|
|
76
|
-
|
|
77
|
+
|
|
77
78
|
const res = await fetch(`https://random-data-api.com/api/appliance/random_appliance/`);
|
|
78
79
|
const data = await res.json();
|
|
79
|
-
|
|
80
|
+
|
|
80
81
|
return {
|
|
81
82
|
props: data.equipment,
|
|
82
83
|
};
|