gatsby-core-theme 24.0.2 → 24.0.4

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,29 @@
1
+ ## [24.0.4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v24.0.3...v24.0.4) (2023-07-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add categoryids we need for them in cards v2 module to filter cards ([5379774](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5379774c4b78cb16fc0aa2723e17d095a114050f))
7
+ * fix bug ([5ca1006](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5ca10064d321eeba1890ef3ae63e07ef55c73e03))
8
+ * fix bug for hreflangs ([b5327ef](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b5327ef42fba0730f822e044bc139907fb61060c))
9
+ * splash screen operator name ([b044a45](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b044a45581c60cc5399aa798993382be9e731510))
10
+
11
+
12
+ * Merge branch 'hreflangs' into 'master' ([c97602b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c97602bd5b7bbea64326724fecc5968b8d53e552))
13
+ * Merge branch 'tm-3548-splash-screen' into 'master' ([74647fc](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/74647fc48c55af1981601ff5ad65a79306ca6d6d))
14
+ * Merge branch 'tm-3414-cards' into 'master' ([f380b1a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f380b1a9da7391292c1f3800a5eb0f1887d8acd6))
15
+
16
+ ## [24.0.3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v24.0.2...v24.0.3) (2023-07-04)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * make test for content ([c943167](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c943167615cb964d6edd5a5732b9c54c2df7be44))
22
+ * validate if h2 isn't empty ([2b42f4b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2b42f4b83c93a15471191cd3464f1c06488eddec))
23
+
24
+
25
+ * Merge branch 'fix-bug-placheloder' into 'master' ([5346c7b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5346c7b20a2163aa8b7f144c486ea168b4cb4d97))
26
+
1
27
  ## [24.0.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v24.0.1...v24.0.2) (2023-07-04)
2
28
 
3
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "24.0.2",
3
+ "version": "24.0.4",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "main": "index.js",
6
6
  "GATSBY_RECAPTCHA_SITEKEY": "6LfoyvMUAAAAAO4nl_MQnqHb4XdHxEiu5cXgIqeB",
@@ -1,10 +1,31 @@
1
1
  import React from 'react';
2
- import { render, cleanup, fireEvent } from '@testing-library/react';
2
+ import { render, cleanup, fireEvent, screen } from '@testing-library/react';
3
+ import { generatePlaceholderString } from '../../../helpers/generators';
3
4
  import '@testing-library/jest-dom/extend-expect';
4
5
  import { getSingleContentData } from '~tests/factories/modules/content.factory';
5
6
  import Content from '.';
6
7
 
7
8
  describe('Content Component', () => {
9
+ const page = {
10
+ siteInfo: {
11
+ site_name: 'My Site',
12
+ },
13
+ title: 'My Page',
14
+ relation: {
15
+ name: 'Page Relation',
16
+ },
17
+ };
18
+
19
+ const module = {
20
+ anchor_label: 'Anchor',
21
+ name: 'Module Name',
22
+ module_title: 'Module Title',
23
+ value: '<h2>[YEAR]</h2>',
24
+ style: 'default',
25
+ show_more_content: '<p>More content</p>',
26
+ show_more_enabled: '1',
27
+ };
28
+
8
29
  test('render content props', () => {
9
30
  const correctData = getSingleContentData('h4');
10
31
  const { container } = render(<Content module={correctData} />);
@@ -200,6 +221,17 @@ describe('Content Component', () => {
200
221
 
201
222
  expect(getByText('More COntent test')).toBeTruthy();
202
223
  });
224
+
225
+ test('renders content with placeholder string for h2', () => {
226
+ const { container } = render(<Content module={module} page={page} />);
227
+ expect(container.querySelector('h2')).toHaveTextContent('2023');
228
+ });
229
+
230
+ test('renders content without placeholder string for h2', () => {
231
+ module.value = '<h2></h2>';
232
+ const { container } = render(<Content module={module} page={page} />);
233
+ expect(container.querySelector('h2')).toHaveTextContent('');
234
+ });
203
235
  });
204
236
  afterEach(() => {
205
237
  cleanup();
@@ -63,7 +63,13 @@ const Content = ({ module, isHomepageFirstModule = false, isModuleIntroduction =
63
63
  pageTitle: page?.title,
64
64
  name: page?.relation?.name,
65
65
  };
66
- node.children[0].data = generatePlaceholderString(node.children[0].data, translations, data);
66
+ // check if h2 is empty
67
+ if (node?.children[0]?.data !== undefined)
68
+ node.children[0].data = generatePlaceholderString(
69
+ node.children[0].data,
70
+ translations,
71
+ data
72
+ );
67
73
  }
68
74
 
69
75
  return null;
@@ -56,6 +56,14 @@ const HeadData = ({ page = {}, siteInfo }) => {
56
56
  )}
57
57
  <link rel="canonical" href={getCanonicalUrl(page)} />
58
58
  {page?.hreflangs?.map((link) => {
59
+ if (link?.default) {
60
+ return (
61
+ <>
62
+ <link rel="alternate" href={getUrl(link.path)} hrefLang="x-default" />;
63
+ <link rel="alternate" href={getUrl(link.path)} hrefLang={link.language} />;
64
+ </>
65
+ );
66
+ }
59
67
  return <link rel="alternate" href={getUrl(link.path)} hrefLang={link.language} />;
60
68
  })}
61
69
  {page.preconnect_links &&
@@ -48,6 +48,9 @@ const Navigation = ({
48
48
 
49
49
  if (stopScrollOnOpen) toggleScroll('', true);
50
50
 
51
+ const activeMarket = pageContext?.allMarkets[pageContext.page.market];
52
+ if (activeMarket) activeMarket.market = pageContext?.page?.market;
53
+
51
54
  const onClickHandler = () => {
52
55
  if (
53
56
  typeof window !== 'undefined' &&
@@ -72,7 +75,7 @@ const Navigation = ({
72
75
  <Link
73
76
  className={`${styles.logo || ''} main-menu-gtm logo-cta`}
74
77
  aria-label="Nav Logo"
75
- to="/"
78
+ to={activeMarket?.path_prefix || '/'}
76
79
  onClick={onClickHandler}
77
80
  >
78
81
  {logoImg}
@@ -116,7 +119,12 @@ Navigation.propTypes = {
116
119
  })
117
120
  ),
118
121
  }).isRequired,
119
- pageContext: PropTypes.shape({}),
122
+ pageContext: PropTypes.shape({
123
+ allMarkets: PropTypes.shape({}),
124
+ page: PropTypes.shape({
125
+ market: PropTypes.shape({}),
126
+ }),
127
+ }),
120
128
  hasSearch: PropTypes.bool,
121
129
  sticky: PropTypes.bool,
122
130
  orientation: PropTypes.oneOf(['horizontal']),
@@ -99,7 +99,7 @@ const Tracker = ({
99
99
  }`}
100
100
  >{`${translate(translations, 'splash_screen_main_text', mainText).replace(
101
101
  '[operator_name]',
102
- operator.name
102
+ operator?.bonus?.operator_name || operator.name
103
103
  )}`}</p>
104
104
  {operatorLogo && (
105
105
  <LazyImage
@@ -120,7 +120,10 @@ export default function TrackerGeo({
120
120
  <LazyImage alt="Site logo" src={logo} />
121
121
  <p
122
122
  className={`${styles.mainText} ${operatorLogo && styles.mainTextWithlogo}`}
123
- >{`${mainText.replace('[operator_name]', operator.name)}`}</p>
123
+ >{`${mainText.replace(
124
+ '[operator_name]',
125
+ operator?.bonus?.operator_name || operator.name
126
+ )}`}</p>
124
127
  {operatorLogo && (
125
128
  <LazyImage
126
129
  src={imagePrettyUrl(
@@ -326,6 +326,8 @@ export default {
326
326
 
327
327
  // add categories object to page
328
328
  const categoryIds = transformedPages[market][pageType][index].categories;
329
+ transformedPages[market][pageType][index].categoryIds = categoryIds;
330
+
329
331
  if (categoryIds.length) {
330
332
  let categoryArray = [];
331
333
  for (let i = 0; i < categoryIds.length; i += 1) {
@@ -456,6 +458,14 @@ export default {
456
458
 
457
459
  hreflangs &&
458
460
  hreflangs.forEach((href, i) => {
461
+ if (
462
+ pagesMappedById[href.page_id] &&
463
+ pagesMappedById[href.page_id].path &&
464
+ !data.site_markets[pagesMappedById[href.page_id].market].path_prefix
465
+ ) {
466
+ hreflangs[i].default = true;
467
+ }
468
+
459
469
  const pagePathPrefix =
460
470
  pagesMappedById[href.page_id] &&
461
471
  data.site_markets[pagesMappedById[href.page_id].market].path_prefix;
@@ -194,7 +194,8 @@ export function processCardsV2(module, pagesCloned, pagesMappedById, pageId) {
194
194
  const pagesFilteredByAuthorAndCategory = filterPages(
195
195
  pagesFilteredByReviewer,
196
196
  selectedCategories,
197
- 'categories'
197
+ 'categoryIds',
198
+ pageId
198
199
  );
199
200
 
200
201
  // Removing any duplicate pages in the final array (because pages may have more than one category)