@griddo/cx 1.64.2 → 1.64.3

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/gatsby-ssr.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable node/no-missing-require */
2
- import React from 'react';
2
+ import * as React from 'react';
3
3
  import parse from 'html-react-parser';
4
4
  const { ssr } = require('components');
5
5
 
@@ -13,61 +13,58 @@ export const wrapPageElement = ({ props }) => {
13
13
  const {
14
14
  pageContext: {
15
15
  siteScript,
16
- page: {
17
- dimensions
18
- }
19
- }
16
+ page: { dimensions },
17
+ },
20
18
  } = props;
21
19
 
22
20
  //Añadir el script. Dependiendo de si lo que recibe es el trackingId o el script
23
21
  const src = `https://www.googletagmanager.com/gtag/js?id=${siteScript}`;
24
- const scriptCode = siteScript.includes('<script') ? [parse(siteScript)] : [<script async key="site-script" dangerouslySetInnerHTML={{__html: siteScript}}/>]
25
-
26
- analyticsScript=siteScript && siteScript.startsWith('UA-') ?
27
- [<script async src={src}></script>]
28
- :
29
- (siteScript ? scriptCode : []);
30
- ;
22
+ const scriptCode = siteScript?.includes('<script')
23
+ ? [parse(siteScript)]
24
+ : [
25
+ <script
26
+ async
27
+ key="site-script"
28
+ dangerouslySetInnerHTML={{ __html: siteScript }}
29
+ />,
30
+ ];
31
31
 
32
+ analyticsScript =
33
+ siteScript && siteScript.startsWith('UA-')
34
+ ? [<script async src={src}></script>]
35
+ : siteScript
36
+ ? scriptCode
37
+ : [];
32
38
  //Las dimensiones o DataLayer
33
39
  const dimensionValues = JSON.stringify(dimensions?.values);
34
- analyticsDimensions = dimensionValues && (dimensions?.values) !== null ?
35
- [<script
36
- async
37
- key="site-script"
38
- dangerouslySetInnerHTML={{
39
- __html: `dataLayer.push(${dimensionValues})`
40
- }}/>]
41
- :
42
- []
43
- ;
40
+ analyticsDimensions =
41
+ dimensionValues && dimensions?.values !== null
42
+ ? [
43
+ <script
44
+ async
45
+ key="site-script"
46
+ dangerouslySetInnerHTML={{
47
+ __html: `dataLayer.push(${dimensionValues})`,
48
+ }}
49
+ />,
50
+ ]
51
+ : [];
44
52
  };
45
53
 
46
54
  export const onRenderBody = props => {
47
55
  if (ssr.onRenderBody) {
48
56
  ssr.onRenderBody(props);
49
57
  }
50
- const {
51
- setHeadComponents,
52
- setPreBodyComponents,
53
- setPostBodyComponents,
54
- setHtmlAttributes,
55
- setBodyAttributes,
56
- setBodyProps,
57
- } = props;
58
+ const { setHeadComponents, setPostBodyComponents } = props;
58
59
 
59
60
  const additionalHeadComponents = [
60
- <script>window.dataLayer = window.dataLayer || [];</script>
61
+ <script>window.dataLayer = window.dataLayer || [];</script>,
61
62
  ];
62
63
 
63
- const additionalBodyComponents = [
64
- ...analyticsScript,
65
- ...analyticsDimensions
66
- ];
64
+ const additionalBodyComponents = [...analyticsScript, ...analyticsDimensions];
67
65
 
68
66
  setHeadComponents([...additionalHeadComponents]);
69
67
  setPostBodyComponents([...additionalBodyComponents]);
70
-
71
68
  };
72
69
 
73
70
  export const onPreRenderHTML = props => {
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.64.2",
4
+ "version": "1.64.3",
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.64.2",
67
+ "@griddo/eslint-config-back": "^1.64.3",
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": "5db7cf23a29ddbaefa77db1dd1be23a1035d16d3"
99
+ "gitHead": "994ccbcebae872939bd955db70601a828bc0ca1d"
100
100
  }
@@ -69,7 +69,6 @@ export default function SEO(props) {
69
69
  <meta property="twitter:title" content={openGraph.title || title} />
70
70
  <meta property="twitter:description" content={openGraph.description} />
71
71
  <meta property="twitter:image" content={openGraph.twitterImage} />
72
- <html lang={locale} />
73
72
 
74
73
  {/* Lang */}
75
74
  <html lang={locale} />