gatsby-core-theme 44.0.1 → 44.0.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 CHANGED
@@ -1,3 +1,16 @@
1
+ ## [44.0.2](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.0.1...v44.0.2) (2025-03-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * author bug ([ee6c416](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/ee6c416689bd928c9cfe0f30118d0052419b2d57))
7
+ * new preview endpoint ([ef219ae](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/ef219ae542957f27a43eab05fff7f60639f6ab4d))
8
+ * redirects with trailing slash ([2c261cd](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/2c261cd83b4829d7f4301559141173c72dbebf35))
9
+
10
+
11
+ * Merge branch 'tm-5328-pages-preview' into 'master' ([13043a2](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/13043a2f3628cdd282a0769774c1efa7239fde9f))
12
+ * Merge branch 'master' into tm-5328-pages-preview ([eb24459](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/eb244594bfb7a16147a5d68883ea13005a7cf493))
13
+
1
14
  ## [44.0.1](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.0.0...v44.0.1) (2025-03-13)
2
15
 
3
16
 
package/gatsby-node.mjs CHANGED
@@ -84,7 +84,7 @@ function createArchivePage(
84
84
  }
85
85
  if (!archivePages) {
86
86
  console.log(`Archive for ${pageObject.path} broken`);
87
- }
87
+ }
88
88
 
89
89
  if (archiveModule.pagination_type !== "load_more") {
90
90
  const numOfColumns = archiveModule.desktop_num_of_columns;
@@ -116,8 +116,10 @@ function createArchivePage(
116
116
  pageObject.path.charAt(0) !== "/"
117
117
  ? `/${pageObject.path}`
118
118
  : pageObject.path;
119
-
120
- archive.items = activeItems.map((item) => processor.clonePage(item, false));
119
+
120
+ archive.items = activeItems.map((item) =>
121
+ processor.clonePage(item, false)
122
+ );
121
123
  switch (archive.currentPage) {
122
124
  case 1:
123
125
  page.path = pageObject.path;
@@ -133,25 +135,31 @@ function createArchivePage(
133
135
  translationsData[pageObject.language],
134
136
  "archive_title_prefix",
135
137
  ""
136
- ).replace("[number]", archive.currentPage)} ${
137
- page.meta_title
138
- } ${process.env.ARCHIVE_SHOW_SUFFIX === 'true' ? translate(
139
- translationsData[pageObject.language],
140
- "archive_title_prefix",
141
- " - Page [number]"
142
- ).replace("[number]", archive.currentPage) : ''}`;
143
-
138
+ ).replace("[number]", archive.currentPage)} ${page.meta_title} ${
139
+ process.env.ARCHIVE_SHOW_SUFFIX === "true"
140
+ ? translate(
141
+ translationsData[pageObject.language],
142
+ "archive_title_prefix",
143
+ " - Page [number]"
144
+ ).replace("[number]", archive.currentPage)
145
+ : ""
146
+ }`;
147
+
144
148
  page.meta_description = `${translate(
145
149
  translationsData[pageObject.language],
146
150
  "archive_description_prefix",
147
151
  ""
148
152
  ).replace("[number]", archive.currentPage)} ${
149
153
  page.meta_description
150
- } ${process.env.ARCHIVE_SHOW_SUFFIX === 'true' ? translate(
151
- translationsData[pageObject.language],
152
- "archive_description_suffix",
153
- " - Page [number]"
154
- ).replace("[number]", archive.currentPage) : ''}`;
154
+ } ${
155
+ process.env.ARCHIVE_SHOW_SUFFIX === "true"
156
+ ? translate(
157
+ translationsData[pageObject.language],
158
+ "archive_description_suffix",
159
+ " - Page [number]"
160
+ ).replace("[number]", archive.currentPage)
161
+ : ""
162
+ }`;
155
163
  break;
156
164
  }
157
165
  page.sections.main.modules[archiveModuleIndex] = archive;
@@ -186,7 +194,7 @@ function createArchivePage(
186
194
  } else {
187
195
  const page = cloneDeep(pageObject);
188
196
  const numOfItemsPerPage = Math.sign(archiveModule.num_of_items);
189
-
197
+
190
198
  const archive = cloneDeep(page.sections.main.modules[archiveModuleIndex]);
191
199
  archive.items = cloneDeep(archivePages)
192
200
  .filter((item) =>
@@ -252,11 +260,12 @@ export const createPages = async (
252
260
  if ([301, 302].includes(parseInt(value.type))) {
253
261
  const redirectName =
254
262
  parseInt(value.type) === 301 ? "permanent" : "redirect";
263
+
264
+ const to = normalizedTo !== "/" ? (process.env.TRAILING_SLASH === 'true' ? `${normalizedTo}/` : normalizedTo) : normalizedTo;
265
+ console.log(to);
266
+
255
267
  stream.write(
256
- `rewrite (?i)^${normalizedFrom}/?$ ${normalizedTo.replace(
257
- /[{}]/g,
258
- ""
259
- )} ${redirectName}; \n`
268
+ `rewrite (?i)^${normalizedFrom}/?$ ${to} ${redirectName}; \n`
260
269
  );
261
270
  }
262
271
 
@@ -383,7 +392,10 @@ export const createPages = async (
383
392
  templates: templatesData,
384
393
  },
385
394
  });
386
- } else if (page.path === `${pathPrefix || ""}s` || page.template === 'search') {
395
+ } else if (
396
+ page.path === `${pathPrefix || ""}s` ||
397
+ page.template === "search"
398
+ ) {
387
399
  createPage({
388
400
  path: `/${page.path}`,
389
401
  component: `${__dirname}/src/components/app-ssr.js`,
@@ -644,8 +656,10 @@ export const onCreateWebpackConfig = ({ actions, stage, getConfig }) => {
644
656
  if (miniCssExtractPlugin) {
645
657
  miniCssExtractPlugin.options.ignoreOrder = true;
646
658
  }
647
- // Update the config.
648
- actions.replaceWebpackConfig(config);
659
+
660
+ actions.replaceWebpackConfig({
661
+ ...config,
662
+ });
649
663
  }
650
664
 
651
665
  actions.setWebpackConfig({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "44.0.1",
3
+ "version": "44.0.2",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -68,7 +68,12 @@ export async function getSiteSettings(siteName) {
68
68
  return callAPIV2(`v0.1/sites/settings/sorted-v2/${siteName}`);
69
69
  }
70
70
 
71
- export async function getPages(siteName) {
71
+ export async function getPages(siteName, previewPath=null) {
72
+ if(previewPath) {
73
+ console.log(`v0.1/sites/pages/sorted-v2-preview/${siteName}?path=${previewPath}&non_preview_page_attributes=id,path,market_id,relation_id,relation_type,meta_title,title,type,template_id,market`);
74
+
75
+ return callAPIV2(`v0.1/sites/pages/sorted-v2-preview/${siteName}?path=${previewPath}&non_preview_page_attributes=id,path,market_id,relation_id,relation_type,meta_title,title,type,template_id,market`);
76
+ }
72
77
  return callAPIV2(`v0.1/sites/pages/sorted-v2/${siteName}`);
73
78
  }
74
79
 
@@ -27,7 +27,7 @@ import { transformGames, transformGamesJackpot } from "./processor/games.mjs";
27
27
  import { transformPayments } from "./processor/payment.mjs";
28
28
  import { transformProvider } from "./processor/providers.mjs";
29
29
 
30
- export const fetchSiteSettings = async (siteName) => {
30
+ export const fetchSiteSettings = async (siteName, previewPath = null) => {
31
31
  const siteSettingsPromise = getSiteSettings(siteName);
32
32
  const ribbonsPromise = getRibbons(`site=${process.env.GATSBY_SITE_NAME}`);
33
33
 
@@ -60,7 +60,8 @@ export const fetchSiteSettings = async (siteName) => {
60
60
  const paymentPromise = getPayments(Object.keys(allMarketsData));
61
61
 
62
62
  const contentPromise = getContent(process.env.GATSBY_SITE_NAME);
63
- const pagesPromise = getPages(process.env.GATSBY_SITE_NAME);
63
+
64
+ const pagesPromise = getPages(process.env.GATSBY_SITE_NAME, previewPath);
64
65
 
65
66
  let sportsPromise = Promise.resolve({});
66
67
  if(["rage_seo", "rage_ppc", "sports"].includes(siteSettingsData.general[siteId].type)) {
@@ -458,7 +458,7 @@ export default {
458
458
  transformedPages[market][pageType][index].categories;
459
459
  transformedPages[market][pageType][index].categoryIds = categoryIds;
460
460
 
461
- if (categoryIds.length) {
461
+ if (categoryIds && categoryIds.length) {
462
462
  transformedPages[market][pageType][index].categories =
463
463
  transformCategories(categoryIds, data);
464
464
  }
@@ -483,7 +483,7 @@ export default {
483
483
 
484
484
  const sectionList = postSectionsMap[page.relation_type];
485
485
 
486
- sectionList &&
486
+ page.sections && sectionList &&
487
487
  sectionList.forEach((res) => {
488
488
  if (data.market_sections[market][res]) {
489
489
  if (page.sections.main) {
@@ -21,8 +21,8 @@ export const processRelations = (
21
21
  const hasRelation =
22
22
  data.relations[page.relation_type] &&
23
23
  data.relations[page.relation_type].hasOwnProperty(page.relation_id);
24
-
25
- transformedPages[market][isPreview ? "preview" : page.relation_type][
24
+
25
+ transformedPages[market][page.relation_type][
26
26
  index
27
27
  ].relation = hasRelation
28
28
  ? cloneDeep(data.relations[page.relation_type][page.relation_id])
@@ -27,7 +27,7 @@ export async function getAPIData(page, url, headers, preview) {
27
27
  paymentData,
28
28
  gamesData,
29
29
  providersData,
30
- } = await fetchSiteSettings(siteName, true);
30
+ } = await fetchSiteSettings(siteName, params?.path);
31
31
 
32
32
  const processed = processor.run(
33
33
  {