@griddo/cx 11.2.6 → 11.2.7

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.
@@ -48,9 +48,6 @@ function GriddoIntegrations(props: GriddoIntegrationsProps) {
48
48
 
49
49
  const integrationsOrdered = integrationsGroupedBy[location];
50
50
 
51
- // Analytics GTM + Dimensions
52
- const emptyCodeScript = { props: { dangerouslySetInnerHTML: {} } };
53
-
54
51
  // `pageInfo` no viene si <GriddoIntegrations> no es llamado desde
55
52
  // `Head.tsx`. En ese caso `composeAnalytics()` daría error. Además que lo
56
53
  // estaríamos llamando para nada, porque si no se llama desde `Head.tsx` no
@@ -67,32 +64,12 @@ function GriddoIntegrations(props: GriddoIntegrationsProps) {
67
64
  )
68
65
  : { analyticsDimensions: null, analyticsScript: null };
69
66
 
70
- const analyticsScriptSrc =
67
+ // GTAG WITH UA
68
+ const analyticsWithUA =
71
69
  (analyticsScript?.startsWith("UA-") &&
72
70
  `https://www.googletagmanager.com/gtag/js?id=${analyticsScript}`) ||
73
71
  null;
74
72
 
75
- // <script.../> parseado (jsx) || emptyCodeScript
76
- const analyticsCodeSnippet =
77
- analyticsScript &&
78
- !analyticsScriptSrc &&
79
- analyticsScript.includes("<script")
80
- ? parse(analyticsScript, { trim: true })
81
- : emptyCodeScript;
82
-
83
- // Este "fix" parece que evita errores si `analyticsCodeSnippet` es un
84
- // array. ¿Puede que sea si el usuario mete más de un script en la caja de
85
- // AX?
86
- const fixedAnalyticsCode: any = Array.isArray(analyticsCodeSnippet)
87
- ? analyticsCodeSnippet.find((item) => item.type === "script") ||
88
- emptyCodeScript
89
- : analyticsCodeSnippet;
90
-
91
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
92
- const { dangerouslySetInnerHTML, children, ...analyticsScriptProps } =
93
- fixedAnalyticsCode.props;
94
- const analyticsScriptCode = dangerouslySetInnerHTML?.__html;
95
-
96
73
  return (
97
74
  <>
98
75
  {integrationsOrdered?.map((integration, key) => {
@@ -109,16 +86,16 @@ function GriddoIntegrations(props: GriddoIntegrationsProps) {
109
86
  }
110
87
 
111
88
  if (integration.type === "analytics") {
89
+ // If UA- is provided
90
+ if (analyticsWithUA) {
91
+ return (
92
+ <script key={key} src={analyticsWithUA} data-griddo-id={id} />
93
+ );
94
+ }
95
+
112
96
  return (
113
97
  <React.Fragment key={key}>
114
- {/* Analytics with UA- */}
115
- {analyticsScriptSrc && <script src={analyticsScriptSrc} />}
116
- {/* Analytics with js snippet */}
117
- {(analyticsScriptProps?.src || analyticsScriptCode) && (
118
- <script {...analyticsScriptProps} data-griddo-id={id}>
119
- {analyticsScriptCode}
120
- </script>
121
- )}
98
+ {siteScript && parse(siteScript, { trim: true })}
122
99
  </React.Fragment>
123
100
  );
124
101
  }
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": "11.2.6",
4
+ "version": "11.2.7",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Diego M. Béjar <diego.bejar@secuoyas.com>",
@@ -65,7 +65,7 @@
65
65
  "@babel/preset-env": "7.26.0",
66
66
  "@babel/preset-react": "7.26.3",
67
67
  "@babel/preset-typescript": "7.26.0",
68
- "@griddo/core": "11.2.6",
68
+ "@griddo/core": "11.2.7",
69
69
  "@svgr/webpack": "5.5.0",
70
70
  "axios": "1.7.9",
71
71
  "babel-loader": "9.2.1",
@@ -133,5 +133,5 @@
133
133
  "publishConfig": {
134
134
  "access": "public"
135
135
  },
136
- "gitHead": "26934c501923afc606ad39bd2bbcd4c77b565d59"
136
+ "gitHead": "00d121423c0ca1d1cb8333b5db4f2939059c1987"
137
137
  }