@griddo/cx 1.67.7 → 1.67.8

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@griddo/cx",
3
3
  "description": "Griddo SSG based on Gatsby",
4
- "version": "1.67.7",
4
+ "version": "1.67.8",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Carlos Torres <carlos.torres@secuoyas.com>",
@@ -64,7 +64,7 @@
64
64
  "react-helmet": "^6.0.0"
65
65
  },
66
66
  "devDependencies": {
67
- "@griddo/eslint-config-back": "^1.67.7",
67
+ "@griddo/eslint-config-back": "^1.67.8",
68
68
  "eslint": "^7.5.0",
69
69
  "eslint-plugin-node": "^11.1.0",
70
70
  "eslint-plugin-react": "7.14.3",
@@ -96,5 +96,5 @@
96
96
  "publishConfig": {
97
97
  "access": "public"
98
98
  },
99
- "gitHead": "1f30909d372622d6dac5eebcce131d7d6b086fd5"
99
+ "gitHead": "c8f6997813536836cf6a0532662a65d73a3d6152"
100
100
  }
@@ -30,6 +30,9 @@ export default function SEO(props) {
30
30
  const showMetaRobots =
31
31
  showBasicMetaRobots || metaRobots !== 'index,follow,translate';
32
32
 
33
+
34
+ const emptyCodeScript = { props: { dangerouslySetInnerHTML: {} } };
35
+
33
36
  const analyticsSrc =
34
37
  (analyticsScript &&
35
38
  analyticsScript.startsWith('UA-') &&
@@ -38,7 +41,9 @@ export default function SEO(props) {
38
41
  const analyticsCode =
39
42
  analyticsScript && !analyticsSrc && analyticsScript.includes('<script')
40
43
  ? parse(analyticsScript)
41
- : { props: { dangerouslySetInnerHTML: {} } };
44
+ : emptyCodeScript;
45
+
46
+ const fixedAnalyticsCode = Array.isArray(analyticsCode) ? analyticsCode.find(item => item.type === 'script') || emptyCodeScript : analyticsCode;
42
47
 
43
48
  const {
44
49
  props: {
@@ -47,7 +52,7 @@ export default function SEO(props) {
47
52
  children: analyticsScriptChildren,
48
53
  ...analyticsScriptProps
49
54
  },
50
- } = analyticsCode;
55
+ } = fixedAnalyticsCode;
51
56
 
52
57
  // Resize favicon
53
58
  // If favicon is a Griddo DAM url, returns a griddo image url with params,
@@ -32,11 +32,6 @@ export default data => {
32
32
  sitePages,
33
33
  } = data.pageContext;
34
34
 
35
- const { analyticsScript, analyticsDimensions } = composeAnalytics(
36
- data,
37
- generateAutomaticDimensions
38
- );
39
-
40
35
  const library = {
41
36
  components,
42
37
  templates,
@@ -44,6 +39,12 @@ export default data => {
44
39
 
45
40
  const mappedTheme = theme || 'default-theme';
46
41
 
42
+ const { analyticsScript, analyticsDimensions } = composeAnalytics(
43
+ data,
44
+ generateAutomaticDimensions
45
+ );
46
+
47
+ if (analyticsDimensions) delete analyticsDimensions.__HIDDEN;
47
48
  if (!content.dimensions) content.dimensions = [];
48
49
  content.dimensions.values = analyticsDimensions;
49
50
 
@@ -15,13 +15,13 @@ class NavigationService {
15
15
  get navigations() {
16
16
  return this._navigations
17
17
  }
18
-
18
+
19
19
  getDefaultFooters() {
20
20
  const safeFooters = [...this.navigations.footers];
21
21
  const defaultFooters = safeFooters.filter(footer => !!footer.setAsDefault);
22
22
  const defaultFootersByLang = defaultFooters.reduce((prev, footer) => {
23
23
  const { language } = footer;
24
- return {...prev, [language]: footer };
24
+ return { ...prev, [language]: footer };
25
25
  }, {});
26
26
  return defaultFootersByLang;
27
27
  }
@@ -31,7 +31,7 @@ class NavigationService {
31
31
  const defaultHeaders = safeHeaders.filter(header => !!header.setAsDefault);
32
32
  const defaultHeadersByLang = defaultHeaders.reduce((prev, header) => {
33
33
  const { language } = header;
34
- return {...prev, [language]: header };
34
+ return { ...prev, [language]: header };
35
35
  }, {});
36
36
  return defaultHeadersByLang;
37
37
  }
@@ -48,10 +48,10 @@ class NavigationService {
48
48
  return pageFooter;
49
49
  }
50
50
 
51
- getPageNavigations (page) {
52
- const { header: headerID, footer: footerID, language } = page;
53
- const header = !!headerID ? this.getPageHeader(headerID): this._defaultHeaders[language];
54
- const footer = !!footerID ? this.getPageFooter(footerID): this._defaultFooters[language];
51
+ getPageNavigations(page) {
52
+ const { header: headerID, footer: footerID, language } = page;
53
+ const header = headerID ? this.getPageHeader(headerID) : (headerID === 0 ? null : this._defaultHeaders[language]);
54
+ const footer = footerID ? this.getPageFooter(footerID) : (footerID === 0 ? null : this._defaultFooters[language]);
55
55
 
56
56
  return {
57
57
  header,