gatsby-core-theme 22.0.3 → 22.0.5

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,26 @@
1
+ ## [22.0.5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v22.0.4...v22.0.5) (2023-05-18)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add not recommended to the cardsv2 filter constant ([09475f7](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/09475f7ad3c6043220f975dacfd0126514859da4))
7
+ * preview, translations and menu item fixes ([3ed8ba5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3ed8ba5c25dfa7ae6fa041adbacf26e788ce190b))
8
+
9
+
10
+ * Merge branch 'tm-3461-preview-translations-menu' into 'master' ([635247b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/635247baf344c467106d5c97fc6af9e919e4cd70))
11
+ * Merge branch 'bug-fix-request-add-not-recommended' into 'master' ([a0e8d09](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a0e8d090bd6cff242002e164e6ac7fc43f139db0))
12
+
13
+ ## [22.0.4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v22.0.3...v22.0.4) (2023-05-17)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * rage seo ([d0ada4c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d0ada4c34ffde6d3367646d408de047d9214467a))
19
+ * rage-seo error ([c35ccb7](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c35ccb788af9e4b5ce37853a094319fac9ff150a))
20
+
21
+
22
+ * Merge branch 'rage-seo-fix' into 'master' ([086c818](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/086c8184cc4b012222c9cb427e3aec1914cfef20))
23
+
1
24
  ## [22.0.3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v22.0.2...v22.0.3) (2023-05-16)
2
25
 
3
26
 
@@ -257,7 +257,7 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
257
257
  siteInfo,
258
258
  autogenerated,
259
259
  siteSchema,
260
- translations,
260
+ translations: processed.relations.translations[page.language],
261
261
  authors,
262
262
  ...themeOptions,
263
263
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "22.0.3",
3
+ "version": "22.0.5",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "main": "index.js",
6
6
  "GATSBY_RECAPTCHA_SITEKEY": "6LfoyvMUAAAAAO4nl_MQnqHb4XdHxEiu5cXgIqeB",
@@ -18,6 +18,7 @@ const App = ({ pageContext }) => {
18
18
  getPreview(
19
19
  pageContext.siteName,
20
20
  !staticPath ? searchParams.get('path') || '/' : staticPath,
21
+ searchParams.get('market_id'),
21
22
  pageContext
22
23
  ).then((previewResponse) => {
23
24
  if (previewResponse.page) {
@@ -39,12 +40,12 @@ const App = ({ pageContext }) => {
39
40
  window.location = `${window.location.origin}/preview?path=/`;
40
41
  }
41
42
  getData(searchParams);
42
- globalHistory.listen(({ location }) => {
43
- const searchParams2 =
44
- typeof window !== 'undefined' ? new URLSearchParams(location.search) : null;
45
- setIsLoading(true);
46
- window.location = `${window.location.origin}/preview?path=${searchParams2.get('path')}`;
47
- });
43
+ // globalHistory.listen(({ location }) => {
44
+ // const searchParams2 =
45
+ // typeof window !== 'undefined' ? new URLSearchParams(location.search) : null;
46
+ // setIsLoading(true);
47
+ // window.location = `${window.location.origin}/preview?path=${searchParams2.get('path')}&market_id=${searchParams2.get('market_id')}`;
48
+ // });
48
49
  }
49
50
  // eslint-disable-next-line react-hooks/exhaustive-deps
50
51
  }, []);
@@ -15,7 +15,8 @@ export default {
15
15
  'norskespilleautomater.com': ['inactive', 'blacklisted', 'coming_soon'],
16
16
  'playcasino.co.za': ['inactive', 'blacklisted', 'coming_soon'],
17
17
  'onlinegamblingsa.co.za': ['inactive', 'blacklisted', 'coming_soon'],
18
- 'onlinegamblingsa.com': ['inactive', 'blacklisted', 'coming_soon'],
18
+ 'onlinegamblingsa.com': ['inactive', 'blacklisted', 'coming_soon', 'not_recommended'],
19
+ 'onlinecasinosouthafrica.net': ['inactive', 'blacklisted', 'coming_soon', 'not_recommended'],
19
20
  'sporttheme.com': ['inactive', 'blacklisted'],
20
21
  'partnerships.gigmedia.com': ['inactive', 'blacklisted'],
21
22
  'habibibet.org': ['inactive', 'blacklisted'],
@@ -6,25 +6,27 @@ const API_URL = process.env.GATSBY_API_URL;
6
6
 
7
7
  /* eslint no-console: ["error", { allow: ["log"] }] */
8
8
 
9
- export async function getPreview(siteName, page = null, themeOptions) {
9
+ export async function getPreview(siteName, page = null, marketId, themeOptions) {
10
10
  return new Promise((resolve, reject) => {
11
11
  axios
12
12
  .get(
13
- `${API_URL}/sites/v0.1/pages/sorted?site_name=${siteName}&path=${page}&preview=1&relations=1`
13
+ `${API_URL}/sites/v0.1/pages/sorted?site_name=${siteName}&path=${page}&market_id=${marketId}&preview=1&relations=1`
14
14
  )
15
15
  .then((response) => {
16
16
  console.log(response);
17
+ const pagePreview = response.data.result.pages.preview;
17
18
  const processed = processor.run(response.data.result, themeOptions);
18
- const siteMarket = Object.keys(processed.site_markets)[0];
19
19
 
20
- const pagePreview = processed.pages[siteMarket].preview[0];
21
- const pagePreviewProcessed = processed.pages[siteMarket][pagePreview.relation_type].find(
22
- (page) => page.path === pagePreview.path
23
- );
20
+ const { path } = processed.pages[pagePreview.market].preview[0];
21
+
22
+ const pagePreviewProcessed = processed.pages[pagePreview.market][
23
+ pagePreview.relation_type
24
+ // eslint-disable-next-line no-shadow
25
+ ].find((page) => page.path === path);
24
26
 
25
27
  resolve({
26
- marketSections: processed.market_sections[siteMarket],
27
- prefilledModules: processed.prefilled_market_modules[siteMarket],
28
+ marketSections: processed.market_sections[pagePreview.market],
29
+ prefilledModules: processed.prefilled_market_modules[pagePreview.market],
28
30
  page: pagePreviewProcessed,
29
31
  allMarkets: processed.site_markets,
30
32
  siteInfo: processed.general,
@@ -8,7 +8,9 @@ export function previewFormat(path) {
8
8
  }
9
9
 
10
10
  export function previewPath(path) {
11
- return `/preview?path=${previewFormat(path)}`;
11
+ // eslint-disable-next-line no-restricted-globals
12
+ const searchParams2 = typeof window !== 'undefined' ? new URLSearchParams(location.search) : null;
13
+ return `/preview?path=${previewFormat(path)}&market_id=${searchParams2.get('market_id')}`;
12
14
  }
13
15
 
14
16
  export function formatPath(path) {
@@ -26,13 +26,13 @@ describe('Path format component', () => {
26
26
  const path = previewPath('/test/link');
27
27
  expect(typeof path).toEqual('string');
28
28
 
29
- expect(path).toBe('/preview?path=test/link');
29
+ expect(path).toBe('/preview?path=test/link&market_id=null');
30
30
  });
31
31
 
32
32
  test('preview mode path navigation keep no initial / on path param', () => {
33
33
  const path = previewPath('test/link');
34
34
 
35
35
  expect(typeof path).toEqual('string');
36
- expect(path).toBe('/preview?path=test/link');
36
+ expect(path).toBe('/preview?path=test/link&market_id=null');
37
37
  });
38
38
  });
@@ -116,3 +116,15 @@ export function removeCurrentPage(list, id) {
116
116
  }
117
117
  return list;
118
118
  }
119
+
120
+ export function updateMenuPrefixPath(menu, prefixPath) {
121
+ menu.map((item) => {
122
+ item.value = item.value === '/' ? prefixPath : `${prefixPath}/${item.value}`;
123
+
124
+ if (item.children) {
125
+ updateMenuPrefixPath(item.children, prefixPath);
126
+ }
127
+
128
+ return true;
129
+ });
130
+ }
@@ -1,4 +1,10 @@
1
- import { groupBy, removeDuplicates, clonePageForCards, removeCurrentPage } from './common';
1
+ import {
2
+ groupBy,
3
+ removeDuplicates,
4
+ clonePageForCards,
5
+ removeCurrentPage,
6
+ updateMenuPrefixPath,
7
+ } from './common';
2
8
  import getPageDataList from '~tests/factories/pages/list.factory';
3
9
 
4
10
  describe('Common Helper', () => {
@@ -30,4 +36,52 @@ describe('Common Helper', () => {
30
36
  const result = removeCurrentPage(data, 2);
31
37
  expect(result.id === 2).toBeFalsy();
32
38
  });
39
+
40
+ test('menu update function', () => {
41
+ const data = [
42
+ {
43
+ value: 'test',
44
+ children: [
45
+ {
46
+ value: 'test2',
47
+ },
48
+ {
49
+ value: 'test3',
50
+ children: [
51
+ {
52
+ value: 'test4',
53
+ children: [
54
+ {
55
+ value: 'test5',
56
+ },
57
+ ],
58
+ },
59
+ ],
60
+ },
61
+ {
62
+ value: 'test6',
63
+ },
64
+ ],
65
+ },
66
+ {
67
+ value: 'test3',
68
+ children: [
69
+ {
70
+ value: 'test4',
71
+ children: [
72
+ {
73
+ value: 'test5',
74
+ },
75
+ ],
76
+ },
77
+ ],
78
+ },
79
+ ];
80
+
81
+ updateMenuPrefixPath(data, 'prefix/');
82
+ data.map((menuItem) => {
83
+ expect(menuItem.value).toContain('prefix/');
84
+ return true;
85
+ });
86
+ });
33
87
  });
@@ -14,7 +14,7 @@ import { generatePlaceholderString } from '../generators';
14
14
  // eslint-disable-next-line import/no-cycle
15
15
  import { shouldSavePrefilled, processModule } from './modules';
16
16
  // eslint-disable-next-line import/no-cycle
17
- import { clonePageForCards, groupBy, removeTags } from './common';
17
+ import { clonePageForCards, groupBy, removeTags, updateMenuPrefixPath } from './common';
18
18
  import { prepareSportsData, addSportsDataToPage, addExtraFieldsToShowcaseEvents } from './sports';
19
19
  import { processRelations } from './relations';
20
20
  import { zeroPadding } from '../schedule';
@@ -255,10 +255,22 @@ export default {
255
255
  sportsData = prepareSportsData(data.relations.sports_data);
256
256
  }
257
257
 
258
+ menus = data.menus;
259
+
260
+ // Menu changes when there is a path prefix configured on hercules
261
+ Object.keys(menus).forEach((menu) => {
262
+ if (data.site_markets[menus[menu].market].path_prefix) {
263
+ updateMenuPrefixPath(
264
+ menus[menu].children,
265
+ data.site_markets[menus[menu].market].path_prefix
266
+ );
267
+ }
268
+ });
269
+
258
270
  Object.keys(data.site_markets).forEach((market) => {
259
271
  relations = data.relations;
260
272
  pages = transformedPages[market];
261
- menus = data.menus;
273
+
262
274
  prefilledMarketModules = data.prefilled_market_modules || {};
263
275
  prefilledMarketModulesRaw = cloneDeep(data.prefilled_market_modules);
264
276
  Object.keys(transformedPages[market]).forEach((pageType) => {
@@ -313,6 +325,7 @@ export default {
313
325
 
314
326
  // add responsible gaming to pages
315
327
  const gamingIds =
328
+ data.relations.dms_affiliate_settings.markets_data &&
316
329
  data.relations.dms_affiliate_settings.markets_data[market] &&
317
330
  data.relations.dms_affiliate_settings.markets_data[market].responsible_gaming_ids
318
331
  ? data.relations.dms_affiliate_settings.markets_data[market].responsible_gaming_ids