@griddo/cx 11.10.4-rc.1 → 11.10.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/build/commands/prepare-domains-render.js +1 -1
- package/build/commands/prepare-domains-render.js.map +2 -2
- package/build/commands/start-render.js +11 -11
- package/build/commands/start-render.js.map +3 -3
- package/build/react/GriddoIntegrations/utils.d.ts +1 -2
- package/build/react/index.js +3 -1
- package/exporter/react/GriddoIntegrations/index.tsx +9 -11
- package/exporter/react/GriddoIntegrations/utils.ts +0 -17
- package/exporter/ssg-adapters/gatsby/shared/sync-render.ts +1 -2
- package/package.json +4 -3
|
@@ -4,10 +4,10 @@ import type { Dimensions } from "../../shared/types/pages";
|
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
|
|
6
6
|
import { generateAutomaticDimensions } from "@griddo-instance";
|
|
7
|
+
import parse from "html-react-parser";
|
|
7
8
|
|
|
8
9
|
import {
|
|
9
10
|
composeAnalytics,
|
|
10
|
-
extractScriptContent,
|
|
11
11
|
filterBodyIntegrationFromPosition,
|
|
12
12
|
filterHeadIntegrations,
|
|
13
13
|
} from "./utils";
|
|
@@ -66,13 +66,9 @@ function GriddoIntegrations(props: GriddoIntegrationsProps) {
|
|
|
66
66
|
`https://www.googletagmanager.com/gtag/js?id=${analyticsScript}`) ||
|
|
67
67
|
null;
|
|
68
68
|
|
|
69
|
-
const siteScriptContent = extractScriptContent(siteScript);
|
|
70
|
-
|
|
71
69
|
return (
|
|
72
70
|
<>
|
|
73
71
|
{integrationsOrdered?.map((integration, key) => {
|
|
74
|
-
const integrationScriptContent = extractScriptContent(integration.content);
|
|
75
|
-
|
|
76
72
|
/* Data Layer */
|
|
77
73
|
if (integration.type === "datalayer") {
|
|
78
74
|
return (
|
|
@@ -91,16 +87,18 @@ function GriddoIntegrations(props: GriddoIntegrationsProps) {
|
|
|
91
87
|
return <script key={key} src={analyticsWithUA} data-griddo-id={id} />;
|
|
92
88
|
}
|
|
93
89
|
|
|
94
|
-
return
|
|
95
|
-
<
|
|
96
|
-
|
|
90
|
+
return (
|
|
91
|
+
<React.Fragment key={key}>
|
|
92
|
+
{siteScript && parse(siteScript, { trim: true })}
|
|
93
|
+
</React.Fragment>
|
|
94
|
+
);
|
|
97
95
|
}
|
|
98
96
|
|
|
99
97
|
/* Integration integration.type === "addon" */
|
|
100
98
|
if (integration.type === "addon") {
|
|
101
|
-
return
|
|
102
|
-
<
|
|
103
|
-
)
|
|
99
|
+
return (
|
|
100
|
+
<React.Fragment key={key}>{parse(integration.content, { trim: true })}</React.Fragment>
|
|
101
|
+
);
|
|
104
102
|
}
|
|
105
103
|
|
|
106
104
|
return null;
|
|
@@ -109,25 +109,8 @@ function composeAnalytics(
|
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
function extractScriptContent(rawInput?: unknown) {
|
|
113
|
-
if (typeof rawInput !== "string" || !rawInput) {
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const trimmedInput = rawInput.trim();
|
|
118
|
-
|
|
119
|
-
if (!trimmedInput.startsWith("<script>") || !trimmedInput.endsWith("</script>")) {
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const content = trimmedInput.replace(/<script>|<\/script>/g, "").trim();
|
|
124
|
-
|
|
125
|
-
return content || null;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
112
|
export {
|
|
129
113
|
composeAnalytics,
|
|
130
|
-
extractScriptContent,
|
|
131
114
|
filterBodyIntegrationFromPosition,
|
|
132
115
|
filterHeadIntegrations,
|
|
133
116
|
filterPositionIntegrations,
|
|
@@ -5,7 +5,6 @@ import pLimit from "p-limit";
|
|
|
5
5
|
|
|
6
6
|
import { findFilesBySuffix } from "../../../core/fs";
|
|
7
7
|
import { GriddoLog } from "../../../core/GriddoLog";
|
|
8
|
-
import { addLogToBuffer } from "../../../core/logger";
|
|
9
8
|
import { GRIDDO_SSG_BUNDLE_ANALYZER } from "../../../shared/envs";
|
|
10
9
|
import { getAssetsDiffBetweenRenders, patchHtmlFile } from "./diff-assets";
|
|
11
10
|
|
|
@@ -185,7 +184,7 @@ class SyncRender {
|
|
|
185
184
|
const changedHtmlFilePaths = this.state.htmlToAdd.map(({ from }) => from);
|
|
186
185
|
|
|
187
186
|
for (const htmlFilePath of changedHtmlFilePaths) {
|
|
188
|
-
|
|
187
|
+
GriddoLog.build(`Patching HTML file ${htmlFilePath} with the new webpackCompilationHash`);
|
|
189
188
|
await patchHtmlFile(htmlFilePath, webpackCompilationHash);
|
|
190
189
|
}
|
|
191
190
|
}
|
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.10.4
|
|
4
|
+
"version": "11.10.4",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Hisco <francis.vega@griddo.io>"
|
|
7
7
|
],
|
|
@@ -56,7 +56,8 @@
|
|
|
56
56
|
"watch:ts-lint": "tsc --noEmit --watch"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"gatsby": "5.15.0"
|
|
59
|
+
"gatsby": "5.15.0",
|
|
60
|
+
"html-react-parser": "^5.2.10"
|
|
60
61
|
},
|
|
61
62
|
"devDependencies": {
|
|
62
63
|
"@biomejs/biome": "2.3.4",
|
|
@@ -93,5 +94,5 @@
|
|
|
93
94
|
"publishConfig": {
|
|
94
95
|
"access": "public"
|
|
95
96
|
},
|
|
96
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "91fc938c684b01ce9c63d8359c0f0336f43fcd07"
|
|
97
98
|
}
|