@griddo/cx 11.7.11 → 11.7.12-rc.0

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.
Files changed (302) hide show
  1. package/README.md +27 -226
  2. package/build/adapters/gatsby/actions/clean.js +10 -0
  3. package/build/adapters/gatsby/actions/clean.js.map +1 -0
  4. package/build/adapters/gatsby/actions/close.js +14 -0
  5. package/build/adapters/gatsby/actions/close.js.map +1 -0
  6. package/build/adapters/gatsby/actions/data.js +18 -0
  7. package/build/adapters/gatsby/actions/data.js.map +1 -0
  8. package/build/adapters/gatsby/actions/healthCheck.js +10 -0
  9. package/build/adapters/gatsby/actions/healthCheck.js.map +1 -0
  10. package/build/adapters/gatsby/actions/init.js +22 -0
  11. package/build/adapters/gatsby/actions/init.js.map +1 -0
  12. package/build/adapters/gatsby/actions/logs.js +9 -0
  13. package/build/adapters/gatsby/actions/logs.js.map +1 -0
  14. package/build/adapters/gatsby/actions/meta.js +13 -0
  15. package/build/adapters/gatsby/actions/meta.js.map +1 -0
  16. package/build/adapters/gatsby/actions/prepare.js +9 -0
  17. package/build/adapters/gatsby/actions/prepare.js.map +1 -0
  18. package/build/adapters/gatsby/actions/relocation.js +15 -0
  19. package/build/adapters/gatsby/actions/relocation.js.map +1 -0
  20. package/build/adapters/gatsby/actions/restore.js +26 -0
  21. package/build/adapters/gatsby/actions/restore.js.map +1 -0
  22. package/build/adapters/gatsby/actions/ssg.js +9 -0
  23. package/build/adapters/gatsby/actions/ssg.js.map +1 -0
  24. package/build/adapters/gatsby/actions/sync.js +51 -0
  25. package/build/adapters/gatsby/actions/sync.js.map +1 -0
  26. package/build/adapters/gatsby/index.js +78 -0
  27. package/build/adapters/gatsby/index.js.map +1 -0
  28. package/build/adapters/gatsby/shared/artifacts.js +20 -0
  29. package/build/adapters/gatsby/shared/artifacts.js.map +1 -0
  30. package/build/adapters/gatsby/shared/context.js +31 -0
  31. package/build/adapters/gatsby/shared/context.js.map +1 -0
  32. package/build/adapters/gatsby/shared/diff-assets.js +101 -0
  33. package/build/adapters/gatsby/shared/diff-assets.js.map +1 -0
  34. package/build/adapters/gatsby/shared/extract-assets.js +58 -0
  35. package/build/adapters/gatsby/shared/extract-assets.js.map +1 -0
  36. package/build/adapters/gatsby/shared/gatsby-build.js +55 -0
  37. package/build/adapters/gatsby/shared/gatsby-build.js.map +1 -0
  38. package/build/adapters/gatsby/shared/sync-render.js +210 -0
  39. package/build/adapters/gatsby/shared/sync-render.js.map +1 -0
  40. package/build/adapters/gatsby/shared/types.js +3 -0
  41. package/build/adapters/gatsby/shared/types.js.map +1 -0
  42. package/build/commands/end-render.js +87 -0
  43. package/build/commands/end-render.js.map +1 -0
  44. package/build/commands/prepare-assets-directory.js +30 -0
  45. package/build/commands/prepare-assets-directory.js.map +1 -0
  46. package/build/commands/prepare-domains-render.js +133 -0
  47. package/build/commands/prepare-domains-render.js.map +1 -0
  48. package/build/commands/reset-render.js +21 -0
  49. package/build/commands/reset-render.js.map +1 -0
  50. package/build/commands/start-render.js +44 -0
  51. package/build/commands/start-render.js.map +1 -0
  52. package/build/commands/upload-search-content.js +180 -0
  53. package/build/commands/upload-search-content.js.map +1 -0
  54. package/build/constants/endpoints.js +43 -0
  55. package/build/constants/endpoints.js.map +1 -0
  56. package/build/constants/envs.js +68 -0
  57. package/build/constants/envs.js.map +1 -0
  58. package/build/constants/errors.js +81 -0
  59. package/build/constants/errors.js.map +1 -0
  60. package/build/services/auth.js +40 -0
  61. package/build/services/auth.js.map +1 -0
  62. package/build/services/db-class.js +49 -0
  63. package/build/services/db-class.js.map +1 -0
  64. package/build/services/db.js +34 -0
  65. package/build/services/db.js.map +1 -0
  66. package/build/services/navigation.js +96 -0
  67. package/build/services/navigation.js.map +1 -0
  68. package/build/services/reference-fields.js +131 -0
  69. package/build/services/reference-fields.js.map +1 -0
  70. package/build/services/robots.js +60 -0
  71. package/build/services/robots.js.map +1 -0
  72. package/build/services/sites.js +110 -0
  73. package/build/services/sites.js.map +1 -0
  74. package/build/services/store.js +257 -0
  75. package/build/services/store.js.map +1 -0
  76. package/build/types/api.js +3 -0
  77. package/build/types/api.js.map +1 -0
  78. package/build/types/global.js +3 -0
  79. package/build/types/global.js.map +1 -0
  80. package/build/types/navigation.js +3 -0
  81. package/build/types/navigation.js.map +1 -0
  82. package/build/types/pages.js +3 -0
  83. package/build/types/pages.js.map +1 -0
  84. package/build/types/render.js +10 -0
  85. package/build/types/render.js.map +1 -0
  86. package/build/types/sites.js +3 -0
  87. package/build/types/sites.js.map +1 -0
  88. package/build/types/templates.js +3 -0
  89. package/build/types/templates.js.map +1 -0
  90. package/build/utils/api.js +165 -0
  91. package/build/utils/api.js.map +1 -0
  92. package/build/utils/artifacts.js +38 -0
  93. package/build/utils/artifacts.js.map +1 -0
  94. package/build/utils/brush.js +30 -0
  95. package/build/utils/brush.js.map +1 -0
  96. package/build/utils/cache.js +106 -0
  97. package/build/utils/cache.js.map +1 -0
  98. package/build/utils/check-environment-health.js +69 -0
  99. package/build/utils/check-environment-health.js.map +1 -0
  100. package/build/utils/core-utils.js +270 -0
  101. package/build/utils/core-utils.js.map +1 -0
  102. package/build/utils/domains.js +37 -0
  103. package/build/utils/domains.js.map +1 -0
  104. package/build/utils/errors.js +30 -0
  105. package/build/utils/errors.js.map +1 -0
  106. package/build/utils/folders.js +341 -0
  107. package/build/utils/folders.js.map +1 -0
  108. package/build/utils/images.js +45 -0
  109. package/build/utils/images.js.map +1 -0
  110. package/build/utils/instance.js +66 -0
  111. package/build/utils/instance.js.map +1 -0
  112. package/build/utils/loggin.js +119 -0
  113. package/build/utils/loggin.js.map +1 -0
  114. package/build/utils/npm-deps/find-up-simple.js +75 -0
  115. package/build/utils/npm-deps/find-up-simple.js.map +1 -0
  116. package/build/utils/npm-deps/pkg-dir.js +20 -0
  117. package/build/utils/npm-deps/pkg-dir.js.map +1 -0
  118. package/build/utils/npm-deps/xml-parser.js +49 -0
  119. package/build/utils/npm-deps/xml-parser.js.map +1 -0
  120. package/build/utils/pages.js +359 -0
  121. package/build/utils/pages.js.map +1 -0
  122. package/build/utils/render.js +168 -0
  123. package/build/utils/render.js.map +1 -0
  124. package/build/utils/sitemaps.js +110 -0
  125. package/build/utils/sitemaps.js.map +1 -0
  126. package/build/utils/sites.js +105 -0
  127. package/build/utils/sites.js.map +1 -0
  128. package/build/utils/store.js +193 -0
  129. package/build/utils/store.js.map +1 -0
  130. package/exporter/adapters/gatsby/actions/clean.ts +14 -0
  131. package/exporter/adapters/gatsby/actions/close.ts +20 -0
  132. package/exporter/adapters/gatsby/actions/data.ts +25 -0
  133. package/exporter/adapters/gatsby/actions/healthCheck.ts +10 -0
  134. package/exporter/adapters/gatsby/actions/init.ts +26 -0
  135. package/exporter/adapters/gatsby/actions/logs.ts +10 -0
  136. package/exporter/adapters/gatsby/actions/meta.ts +16 -0
  137. package/exporter/adapters/gatsby/actions/prepare.ts +9 -0
  138. package/exporter/adapters/gatsby/actions/relocation.ts +15 -0
  139. package/exporter/adapters/gatsby/actions/restore.ts +36 -0
  140. package/exporter/adapters/gatsby/actions/ssg.ts +12 -0
  141. package/exporter/adapters/gatsby/actions/sync.ts +71 -0
  142. package/exporter/adapters/gatsby/index.ts +73 -153
  143. package/exporter/adapters/gatsby/shared/artifacts.ts +16 -0
  144. package/exporter/adapters/gatsby/shared/context.ts +50 -0
  145. package/exporter/adapters/gatsby/shared/diff-assets.ts +113 -0
  146. package/exporter/adapters/gatsby/shared/extract-assets.ts +61 -0
  147. package/exporter/adapters/gatsby/shared/gatsby-build.ts +58 -0
  148. package/exporter/adapters/gatsby/shared/sync-render.ts +276 -0
  149. package/exporter/adapters/gatsby/shared/types.ts +35 -0
  150. package/exporter/build-esbuild.noop +42 -0
  151. package/exporter/build.sh +4 -38
  152. package/exporter/commands/end-render.ts +72 -70
  153. package/exporter/commands/prepare-assets-directory.ts +30 -0
  154. package/exporter/commands/prepare-domains-render.ts +143 -31
  155. package/exporter/commands/reset-render.ts +10 -3
  156. package/exporter/commands/start-render.ts +22 -45
  157. package/exporter/commands/upload-search-content.ts +194 -21
  158. package/exporter/constants/endpoints.ts +2 -1
  159. package/exporter/constants/envs.ts +57 -55
  160. package/exporter/{errors/errors-data.ts → constants/errors.ts} +24 -14
  161. package/exporter/services/auth.ts +7 -6
  162. package/exporter/services/db-class.ts +54 -0
  163. package/exporter/services/db.ts +32 -0
  164. package/exporter/services/navigation.ts +4 -10
  165. package/exporter/services/reference-fields.ts +9 -24
  166. package/exporter/services/robots.ts +9 -16
  167. package/exporter/services/sites.ts +36 -24
  168. package/exporter/services/store.ts +107 -96
  169. package/exporter/types/api.ts +27 -28
  170. package/exporter/types/global.ts +8 -11
  171. package/exporter/types/navigation.ts +1 -1
  172. package/exporter/types/pages.ts +2 -3
  173. package/exporter/types/render.ts +59 -0
  174. package/exporter/types/sites.ts +1 -2
  175. package/exporter/utils/api.ts +55 -75
  176. package/exporter/utils/artifacts.ts +38 -0
  177. package/exporter/utils/brush.ts +34 -0
  178. package/exporter/utils/cache.ts +37 -62
  179. package/exporter/utils/check-environment-health.ts +80 -0
  180. package/exporter/utils/core-utils.ts +133 -272
  181. package/exporter/utils/domains.ts +10 -7
  182. package/exporter/{errors/index.ts → utils/errors.ts} +10 -9
  183. package/exporter/utils/folders.ts +163 -98
  184. package/exporter/utils/images.ts +1 -6
  185. package/exporter/utils/instance.ts +9 -13
  186. package/exporter/utils/loggin.ts +44 -91
  187. package/exporter/utils/npm-deps/find-up-simple.ts +100 -0
  188. package/exporter/utils/npm-deps/pkg-dir.ts +17 -0
  189. package/exporter/utils/npm-deps/xml-parser.ts +57 -0
  190. package/exporter/utils/pages.ts +23 -88
  191. package/exporter/utils/render.ts +180 -48
  192. package/exporter/utils/sitemaps.ts +129 -0
  193. package/exporter/utils/sites.ts +19 -197
  194. package/exporter/utils/store.ts +87 -180
  195. package/gatsby-browser.tsx +41 -58
  196. package/gatsby-config.ts +10 -17
  197. package/gatsby-node.ts +17 -78
  198. package/gatsby-ssr.tsx +2 -1
  199. package/package.json +35 -86
  200. package/plugins/gatsby-plugin-svgr-loader/gatsby-node.js +55 -0
  201. package/plugins/gatsby-plugin-svgr-loader/package.json +8 -0
  202. package/react/DynamicScript/index.tsx +33 -0
  203. package/{exporter/react → react}/Favicon/index.tsx +1 -7
  204. package/{exporter/react → react}/GriddoIntegrations/index.tsx +16 -22
  205. package/{exporter/react → react}/GriddoIntegrations/utils.ts +21 -9
  206. package/{build/react/index.d.ts → react/index.tsx} +1 -0
  207. package/src/components/Head.tsx +13 -46
  208. package/src/components/template.tsx +8 -30
  209. package/src/gatsby-node-utils.ts +73 -2
  210. package/src/html.tsx +2 -11
  211. package/src/types.ts +5 -5
  212. package/tsconfig.commands.json +36 -0
  213. package/tsconfig.exporter.json +19 -0
  214. package/tsconfig.json +5 -3
  215. package/build/adapters/gatsby/index.d.ts +0 -4
  216. package/build/adapters/gatsby/utils.d.ts +0 -22
  217. package/build/artifacts/index.d.ts +0 -6
  218. package/build/commands/end-render.d.ts +0 -2
  219. package/build/commands/move-assets.d.ts +0 -1
  220. package/build/commands/prepare-domains-render.d.ts +0 -1
  221. package/build/commands/reset-render.d.ts +0 -2
  222. package/build/commands/start-render.d.ts +0 -2
  223. package/build/commands/upload-search-content.d.ts +0 -2
  224. package/build/constants/endpoints.d.ts +0 -19
  225. package/build/constants/envs.d.ts +0 -37
  226. package/build/constants/index.d.ts +0 -57
  227. package/build/end-render.js +0 -74
  228. package/build/end-render.js.map +0 -7
  229. package/build/errors/errors-data.d.ts +0 -22
  230. package/build/errors/index.d.ts +0 -15
  231. package/build/index.d.ts +0 -29
  232. package/build/index.js +0 -73
  233. package/build/index.js.map +0 -7
  234. package/build/prepare-domains-render.js +0 -73
  235. package/build/prepare-domains-render.js.map +0 -7
  236. package/build/react/Favicon/index.d.ts +0 -5
  237. package/build/react/Favicon/utils.d.ts +0 -9
  238. package/build/react/GriddoIntegrations/index.d.ts +0 -20
  239. package/build/react/GriddoIntegrations/utils.d.ts +0 -26
  240. package/build/react/index.js +0 -3
  241. package/build/registers/api.d.ts +0 -9
  242. package/build/registers/gatsby.d.ts +0 -9
  243. package/build/registers/index.d.ts +0 -3
  244. package/build/reset-render.js +0 -74
  245. package/build/reset-render.js.map +0 -7
  246. package/build/services/auth.d.ts +0 -10
  247. package/build/services/domains.d.ts +0 -6
  248. package/build/services/navigation.d.ts +0 -50
  249. package/build/services/reference-fields.d.ts +0 -20
  250. package/build/services/register.d.ts +0 -36
  251. package/build/services/robots.d.ts +0 -19
  252. package/build/services/settings.d.ts +0 -4
  253. package/build/services/sites.d.ts +0 -29
  254. package/build/services/store.d.ts +0 -6
  255. package/build/start-render.js +0 -100
  256. package/build/start-render.js.map +0 -7
  257. package/build/types/api.d.ts +0 -142
  258. package/build/types/global.d.ts +0 -84
  259. package/build/types/navigation.d.ts +0 -28
  260. package/build/types/pages.d.ts +0 -144
  261. package/build/types/sites.d.ts +0 -57
  262. package/build/types/templates.d.ts +0 -8
  263. package/build/upload-search-content.js +0 -74
  264. package/build/upload-search-content.js.map +0 -7
  265. package/build/utils/alerts.d.ts +0 -3
  266. package/build/utils/api.d.ts +0 -23
  267. package/build/utils/cache.d.ts +0 -35
  268. package/build/utils/core-utils.d.ts +0 -107
  269. package/build/utils/create-build-data.d.ts +0 -8
  270. package/build/utils/domains.d.ts +0 -13
  271. package/build/utils/folders.d.ts +0 -53
  272. package/build/utils/health-checks.d.ts +0 -7
  273. package/build/utils/images.d.ts +0 -16
  274. package/build/utils/instance.d.ts +0 -21
  275. package/build/utils/loggin.d.ts +0 -51
  276. package/build/utils/pages.d.ts +0 -34
  277. package/build/utils/render.d.ts +0 -13
  278. package/build/utils/searches.d.ts +0 -15
  279. package/build/utils/sites.d.ts +0 -31
  280. package/build/utils/store.d.ts +0 -81
  281. package/cx.config.d.ts +0 -5
  282. package/cx.config.js +0 -36
  283. package/exporter/adapters/gatsby/utils.ts +0 -161
  284. package/exporter/artifacts/README.md +0 -34
  285. package/exporter/artifacts/index.ts +0 -33
  286. package/exporter/commands/move-assets.ts +0 -11
  287. package/exporter/constants/index.ts +0 -129
  288. package/exporter/index.ts +0 -82
  289. package/exporter/react/index.tsx +0 -11
  290. package/exporter/registers/api.ts +0 -14
  291. package/exporter/registers/gatsby.ts +0 -14
  292. package/exporter/registers/index.ts +0 -4
  293. package/exporter/services/domains.ts +0 -16
  294. package/exporter/services/register.ts +0 -113
  295. package/exporter/services/settings.ts +0 -17
  296. package/exporter/utils/alerts.ts +0 -29
  297. package/exporter/utils/create-build-data.ts +0 -17
  298. package/exporter/utils/health-checks.ts +0 -64
  299. package/exporter/utils/searches.ts +0 -156
  300. package/src/README.md +0 -7
  301. package/start-render.js +0 -7
  302. /package/{exporter/react → react}/Favicon/utils.ts +0 -0
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.7.11",
4
+ "version": "11.7.12-rc.0",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Diego M. Béjar <diego.bejar@secuoyas.com>",
@@ -15,120 +15,69 @@
15
15
  "type": "git",
16
16
  "url": "https://github.com/griddo/griddo"
17
17
  },
18
- "bin": {
19
- "griddo-cx": "./start-render.js",
20
- "griddo-start-render": "./start-render.js"
21
- },
22
- "exports": {
23
- ".": {
24
- "import": "./build/index.js",
25
- "require": "./build/index.js",
26
- "types": "./build/index.d.ts"
27
- },
28
- "./react": {
29
- "import": "./build/react/index.js",
30
- "require": "./build/react/index.js",
31
- "types": "./build/react/index.d.ts"
32
- }
33
- },
34
18
  "scripts": {
35
19
  "// NPM": "",
36
20
  "prepare": "yarn run build",
37
21
  "// BUILD": "",
38
- "build": "sh ./exporter/build.sh",
39
- "build:debug": "sh ./exporter/build.sh --debug",
22
+ "build": "rm -rf build && sh ./exporter/build.sh",
23
+ "build:debug": "rm -rf build && sh ./exporter/build.sh --debug",
40
24
  "// TESTS": "",
41
- "test": "NODE_OPTIONS='--import tsx' env-cmd node --test ./__tests__/*",
42
- "test:create-render-fixtures": "env-cmd tsx ./__tests__/utils/create-fixtures.ts",
43
- "test:remove-render-fixtures": "env-cmd tsx ./__tests__/utils/remove-fixtures.ts",
25
+ "test": "npm run test:compile && npm run test:create-render-fixtures && env-cmd node --test ./__tests__/* && npm run test:remove-render-fixtures",
26
+ "test:create-render-fixtures": "env-cmd node ./build/__tests__/utils/create-fixtures",
27
+ "test:remove-render-fixtures": "env-cmd node ./build/__tests__/utils/remove-fixtures",
28
+ "test:compile": "tsgo --project tsconfig.tests.json",
44
29
  "// INFRA SCRIPTS": "",
45
- "upload-search-content": "node ./build/upload-search-content.js",
46
- "complete-render": "node ./build/end-render.js",
47
- "end-render": "node ./build/end-render.js",
48
- "start-render": "node ./build/start-render.js",
49
- "reset-render": "node ./build/reset-render.js",
50
- "prepare-domains-render": "node ./build/prepare-domains-render.js",
51
- "// SSG": "",
52
- "clean": "gatsby clean; rm -rf assets .cx-cache caches store apiCache build .render-sentinel",
53
- "gatsby-build": "gatsby telemetry --disable && gatsby build --prefix-paths",
54
- "// LINTER": "",
55
- "run:ts-lint": "tsc --noEmit",
56
- "watch:ts-lint": "tsc --noEmit --watch",
57
- "run:eslint": "eslint .",
58
- "run:lint": "yarn run:ts-lint && yarn run:eslint",
59
- "// FORMATTER": "",
60
- "run:format": "prettier --write ."
30
+ "prepare-domains-render": "node ./build/commands/prepare-domains-render",
31
+ "start-render": "node ./build/commands/start-render",
32
+ "end-render": "node ./build/commands/end-render",
33
+ "upload-search-content": "node ./build/commands/upload-search-content",
34
+ "reset-render": "node ./build/commands/reset-render",
35
+ "// ONLY LOCAL SCRIPTS": "",
36
+ "prepare-assets-directory": "node ./build/commands/prepare-assets-directory",
37
+ "// LINTER & FORMATTER": "",
38
+ "lint": "biome check --write",
39
+ "format": "biome format --write",
40
+ "flint": "npm run lint && npm run format",
41
+ "ts-lint": "tsgo --noEmit",
42
+ "watch:ts-lint": "tsc --noEmit --watch"
61
43
  },
62
44
  "dependencies": {
63
- "@babel/core": "7.26.0",
64
- "@babel/plugin-transform-class-properties": "7.25.9",
65
- "@babel/preset-env": "7.26.0",
66
- "@babel/preset-react": "7.26.3",
67
- "@babel/preset-typescript": "7.26.0",
68
- "@griddo/core": "11.7.11",
69
- "@svgr/webpack": "5.5.0",
70
- "axios": "1.7.9",
71
- "babel-loader": "9.2.1",
72
- "babel-plugin-transform-runtime": "6.23.0",
73
- "babel-polyfill": "6.26.0",
74
- "dotenv": "16.4.5",
75
- "esbuild": "0.24.0",
76
- "find-up": "5.0.0",
77
- "fs-extra": "11.2.0",
78
- "gatsby": "5.14.0",
79
- "gatsby-plugin-svgr-loader": "0.1.0",
80
- "html-react-parser": "5.2.0",
81
- "js2xmlparser": "5.0.0",
82
- "kleur": "4.1.5",
83
- "p-limit": "3.1.0",
84
- "path-browserify": "1.0.1",
85
- "pkg-dir": "5.0.0",
86
- "typescript": "5.7.2",
87
- "webpack": "5.76.1"
45
+ "gatsby": "5.15.0",
46
+ "p-limit": "7.1.1"
88
47
  },
89
48
  "devDependencies": {
90
- "@types/cheerio": "0.22.35",
91
- "@types/eslint": "8.56.10",
92
- "@types/fs-extra": "11.0.4",
93
- "@types/node": "20.17.10",
94
- "@types/webpack": "5.28.5",
95
- "@typescript-eslint/eslint-plugin": "^8.0.0",
96
- "@typescript-eslint/parser": "^8.0.0",
97
- "cheerio": "1.0.0",
98
- "eslint": "^9.0.0",
99
- "eslint-plugin-import": "2.31.0",
100
- "eslint-plugin-node": "11.1.0",
101
- "eslint-plugin-react": "7.37.4",
102
- "eslint-plugin-react-hooks": "^4.6.0",
103
- "eslint-plugin-testing-library": "^6.2.0",
104
- "globals": "^16.0.0",
105
- "prettier": "3.4.2"
49
+ "@biomejs/biome": "2.2.4",
50
+ "@types/node": "20.19.2",
51
+ "@typescript/native-preview": "7.0.0-dev.20250916.1",
52
+ "cheerio": "1.1.2",
53
+ "typescript": "5.9.2"
106
54
  },
107
55
  "peerDependencies": {
108
- "@types/react": ">=18 <19",
109
- "@types/react-dom": ">=18 <19",
56
+ "@griddo/core": "*",
110
57
  "react": ">=18 <19",
111
58
  "react-dom": ">=18 <19"
112
59
  },
113
60
  "engines": {
114
- "node": ">=20"
61
+ "node": ">=20.19"
115
62
  },
116
63
  "files": [
117
64
  "build",
118
65
  "exporter",
119
66
  "src",
120
- "cx.config.d.ts",
121
- "cx.config.js",
67
+ "react",
122
68
  "gatsby-browser.tsx",
123
69
  "gatsby-config.ts",
124
70
  "gatsby-node.ts",
125
71
  "gatsby-ssr.tsx",
126
72
  "global.d.ts",
127
73
  "start-render.js",
128
- "tsconfig.json"
74
+ "tsconfig.commands.json",
75
+ "tsconfig.exporter.json",
76
+ "tsconfig.json",
77
+ "plugins"
129
78
  ],
130
79
  "publishConfig": {
131
80
  "access": "public"
132
81
  },
133
- "gitHead": "1ee0074395f691b8101fb8cf2ad7238d57a43f31"
82
+ "gitHead": "c7e40c899abb683a6c53cbe36f1bd19135c9670e"
134
83
  }
@@ -0,0 +1,55 @@
1
+ exports.onCreateWebpackConfig = (
2
+ { stage, actions, getConfig, rules },
3
+ { rule: ruleProps = {} },
4
+ ) => {
5
+ const { include, exclude, options, ...otherProps } = ruleProps;
6
+
7
+ if (["develop", "develop-html", "build-html", "build-javascript"].includes(stage)) {
8
+ // Add the react-svg-loader rule
9
+ actions.setWebpackConfig({
10
+ module: {
11
+ rules: [
12
+ {
13
+ test: /\.svg$/,
14
+ include,
15
+ exclude,
16
+ ...otherProps,
17
+ use: [
18
+ {
19
+ loader: "@svgr/webpack",
20
+ options,
21
+ },
22
+ ],
23
+ },
24
+ ],
25
+ },
26
+ });
27
+ const cfg = getConfig();
28
+ const imgsRule = rules.images();
29
+
30
+ const newUrlLoaderRule =
31
+ include || exclude
32
+ ? {
33
+ ...imgsRule,
34
+ include: exclude,
35
+ exclude: include,
36
+ }
37
+ : {
38
+ ...imgsRule,
39
+ test: new RegExp(imgsRule.test.toString().replace("svg|", "").slice(1, -1)),
40
+ };
41
+
42
+ cfg.module.rules = [
43
+ // Remove the base url-loader images rule entirely
44
+ ...cfg.module.rules.filter((rule) => {
45
+ if (rule.test) {
46
+ return rule.test.toString() !== imgsRule.test.toString();
47
+ }
48
+ return true;
49
+ }),
50
+ // Put it back without SVG loading
51
+ newUrlLoaderRule,
52
+ ];
53
+ actions.replaceWebpackConfig(cfg);
54
+ }
55
+ };
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "gatsby-plugin-svgr-loader",
3
+ "version": "0.1.0",
4
+ "main": "gatsby-node.js",
5
+ "dependencies": {
6
+ "@svgr/webpack": "^4.3.2"
7
+ }
8
+ }
@@ -0,0 +1,33 @@
1
+ import { useEffect } from "react";
2
+
3
+ const DynamicScript = (props: { scriptContent: string }) => {
4
+ const { scriptContent } = props;
5
+
6
+ useEffect(() => {
7
+ if (!scriptContent) {
8
+ return;
9
+ }
10
+
11
+ const scriptText = scriptContent.replace(/<script>|<\/script>/g, "");
12
+ if (!scriptText.trim()) {
13
+ return;
14
+ }
15
+
16
+ const script = document.createElement("script");
17
+ script.innerHTML = scriptText;
18
+ script.async = true;
19
+
20
+ document.body.appendChild(script);
21
+
22
+ return () => {
23
+ // Hacemos un chequeo por si el script ya fue removido por otro proceso.
24
+ if (document.body.contains(script)) {
25
+ document.body.removeChild(script);
26
+ }
27
+ };
28
+ }, [scriptContent]);
29
+
30
+ return null;
31
+ };
32
+
33
+ export { DynamicScript };
@@ -1,5 +1,3 @@
1
- import * as React from "react";
2
-
3
1
  import { formatImage } from "./utils";
4
2
 
5
3
  function Favicon({ url }: { url: string | undefined }) {
@@ -26,11 +24,7 @@ function Favicon({ url }: { url: string | undefined }) {
26
24
  sizes="180x180"
27
25
  href={formatImage(url, { width: 180, height: 180, format: "png" })}
28
26
  />
29
- <link
30
- rel="icon"
31
- type="image/svg+xml"
32
- href={formatImage(url, { format: "svg" })}
33
- />
27
+ <link rel="icon" type="image/svg+xml" href={formatImage(url, { format: "svg" })} />
34
28
  </>
35
29
  );
36
30
  }
@@ -1,12 +1,13 @@
1
- import type { Dimensions } from "../../types/pages";
2
1
  import type { Core } from "@griddo/core";
2
+ import type { Dimensions } from "../../exporter/types/pages";
3
3
 
4
- import { generateAutomaticDimensions } from "@griddo-instance";
5
- import parse from "html-react-parser";
6
4
  import * as React from "react";
7
5
 
6
+ import { generateAutomaticDimensions } from "@griddo-instance";
7
+
8
8
  import {
9
9
  composeAnalytics,
10
+ extractScriptContent,
10
11
  filterBodyIntegrationFromPosition,
11
12
  filterHeadIntegrations,
12
13
  } from "./utils";
@@ -56,12 +57,7 @@ function GriddoIntegrations(props: GriddoIntegrationsProps) {
56
57
  // @shame!
57
58
  // El fix sería llamar a `composeAnalytics()` solo si `pageInfo` existe.
58
59
  const { analyticsScript, analyticsDimensions } = pageInfo
59
- ? composeAnalytics(
60
- siteScript,
61
- dimensions,
62
- pageInfo,
63
- generateAutomaticDimensions,
64
- )
60
+ ? composeAnalytics(siteScript, dimensions, pageInfo, generateAutomaticDimensions)
65
61
  : { analyticsDimensions: null, analyticsScript: null };
66
62
 
67
63
  // GTAG WITH UA
@@ -70,9 +66,13 @@ function GriddoIntegrations(props: GriddoIntegrationsProps) {
70
66
  `https://www.googletagmanager.com/gtag/js?id=${analyticsScript}`) ||
71
67
  null;
72
68
 
69
+ const siteScriptContent = extractScriptContent(siteScript);
70
+
73
71
  return (
74
72
  <>
75
73
  {integrationsOrdered?.map((integration, key) => {
74
+ const integrationScriptContent = extractScriptContent(integration.content);
75
+
76
76
  /* Data Layer */
77
77
  if (integration.type === "datalayer") {
78
78
  return (
@@ -88,25 +88,19 @@ function GriddoIntegrations(props: GriddoIntegrationsProps) {
88
88
  if (integration.type === "analytics") {
89
89
  // If UA- is provided
90
90
  if (analyticsWithUA) {
91
- return (
92
- <script key={key} src={analyticsWithUA} data-griddo-id={id} />
93
- );
91
+ return <script key={key} src={analyticsWithUA} data-griddo-id={id} />;
94
92
  }
95
93
 
96
- return (
97
- <React.Fragment key={key}>
98
- {siteScript && parse(siteScript, { trim: true })}
99
- </React.Fragment>
100
- );
94
+ return siteScriptContent ? (
95
+ <script key={key} dangerouslySetInnerHTML={{ __html: siteScriptContent }} />
96
+ ) : null;
101
97
  }
102
98
 
103
99
  /* Integration integration.type === "addon" */
104
100
  if (integration.type === "addon") {
105
- return (
106
- <React.Fragment key={key}>
107
- {parse(integration.content, { trim: true })}
108
- </React.Fragment>
109
- );
101
+ return integrationScriptContent ? (
102
+ <script key={key} dangerouslySetInnerHTML={{ __html: integrationScriptContent }} />
103
+ ) : null;
110
104
  }
111
105
 
112
106
  return null;
@@ -1,5 +1,5 @@
1
- import type { Dimensions } from "../../types/pages";
2
1
  import type { Core } from "@griddo/core";
2
+ import type { Dimensions } from "../../exporter/types/pages";
3
3
 
4
4
  /**
5
5
  * Return true if the argument is an object (not null)
@@ -70,16 +70,13 @@ function composeAnalytics(
70
70
  };
71
71
  };
72
72
  },
73
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
74
- generateAutomaticDimensions = (page: Record<string, unknown>) => null,
73
+ generateAutomaticDimensions = (_page: Record<string, unknown>) => null,
75
74
  ) {
76
75
  const analyticsScript = siteScriptRaw ? siteScriptRaw.trim() : "";
77
76
 
78
77
  // Las dimensiones o DataLayer
79
78
  const dynamicValuePrefix = "__SCRIPT:";
80
- const dimensionValues = isObject(dimensions?.values)
81
- ? dimensions?.values
82
- : {};
79
+ const dimensionValues = isObject(dimensions?.values) ? dimensions?.values : {};
83
80
  const automaticDimensionValues = generateAutomaticDimensions
84
81
  ? generateAutomaticDimensions(page || {})
85
82
  : {};
@@ -104,9 +101,7 @@ function composeAnalytics(
104
101
  );
105
102
  }
106
103
 
107
- const analyticsDimensions = allDimensions.length
108
- ? `{${allDimensions.join(",")}}`
109
- : null;
104
+ const analyticsDimensions = allDimensions.length ? `{${allDimensions.join(",")}}` : null;
110
105
 
111
106
  return {
112
107
  analyticsScript,
@@ -114,8 +109,25 @@ function composeAnalytics(
114
109
  };
115
110
  }
116
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
+
117
128
  export {
118
129
  composeAnalytics,
130
+ extractScriptContent,
119
131
  filterBodyIntegrationFromPosition,
120
132
  filterHeadIntegrations,
121
133
  filterPositionIntegrations,
@@ -1,3 +1,4 @@
1
1
  import { Favicon } from "./Favicon";
2
2
  import { GriddoIntegrations } from "./GriddoIntegrations";
3
+
3
4
  export { Favicon, GriddoIntegrations };
@@ -1,7 +1,7 @@
1
1
  import type { CustomHeadProps } from "../types";
2
2
 
3
- import { Favicon, GriddoIntegrations } from "@griddo/cx/react";
4
- import * as React from "react";
3
+ import { Favicon } from "../../react/Favicon";
4
+ import { GriddoIntegrations } from "../../react/GriddoIntegrations";
5
5
 
6
6
  /**
7
7
  * Gatsby Head API
@@ -12,13 +12,7 @@ const Head = (props: CustomHeadProps) => {
12
12
  pageContext: {
13
13
  locale,
14
14
  openGraph,
15
- page: {
16
- disableHrefLangs,
17
- fullUrl,
18
- defaultLang,
19
- integrations = [],
20
- dimensions,
21
- },
15
+ page: { disableHrefLangs, fullUrl, defaultLang, integrations = [], dimensions },
22
16
  pageMetadata,
23
17
  siteMetadata,
24
18
  siteOptions,
@@ -31,19 +25,13 @@ const Head = (props: CustomHeadProps) => {
31
25
  );
32
26
 
33
27
  const showMetaRobots =
34
- !!metaRobots &&
35
- (siteOptions?.showBasicMetaRobots || metaRobots !== "index,follow");
28
+ !!metaRobots && (siteOptions?.showBasicMetaRobots || metaRobots !== "index,follow");
36
29
 
37
- // Validate options
38
- const cleanPageLanguages =
39
- pageMetadata?.pageLanguages?.filter((item) => item.isLive) || [];
30
+ const cleanPageLanguages = pageMetadata?.pageLanguages?.filter((item) => item.isLive) || [];
40
31
 
41
32
  const useCanonical =
42
33
  !!pageMetadata?.canonical &&
43
- !(
44
- siteOptions?.avoidSelfReferenceCanonicals &&
45
- pageMetadata?.canonical === fullUrl
46
- );
34
+ !(siteOptions?.avoidSelfReferenceCanonicals && pageMetadata?.canonical === fullUrl);
47
35
 
48
36
  const useHrefLangs =
49
37
  !(
@@ -60,8 +48,7 @@ const Head = (props: CustomHeadProps) => {
60
48
  (useHrefLangs &&
61
49
  !siteOptions?.avoidHrefLangXDefault &&
62
50
  defaultLangId &&
63
- cleanPageLanguages.find((item) => item.languageId === defaultLangId)
64
- ?.url) ||
51
+ cleanPageLanguages.find((item) => item.languageId === defaultLangId)?.url) ||
65
52
  null;
66
53
 
67
54
  return (
@@ -72,12 +59,9 @@ const Head = (props: CustomHeadProps) => {
72
59
  {!!pageMetadata?.description && (
73
60
  <meta name="description" content={pageMetadata?.description} />
74
61
  )}
75
- {siteOptions?.useMetaTitle && (
76
- <meta name="title" content={pageMetadata?.title} />
77
- )}
62
+ {siteOptions?.useMetaTitle && <meta name="title" content={pageMetadata?.title} />}
78
63
  {useCanonical && <link rel="canonical" href={pageMetadata?.canonical} />}
79
64
 
80
- {/* Favicon images */}
81
65
  <Favicon url={siteMetadata?.favicon} />
82
66
 
83
67
  {/* Alternate, solo si se indexa la página y tiene traducciones */}
@@ -98,15 +82,11 @@ const Head = (props: CustomHeadProps) => {
98
82
  {showMetaRobots && <meta name="robots" content={metaRobots} />}
99
83
 
100
84
  {/* Open Graph */}
101
- {!!siteMetadata?.title && (
102
- <meta property="og:site_name" content={siteMetadata?.title} />
103
- )}
85
+ {/* @todo: Create a <GriddoOpenGraph /> component */}
86
+ {!!siteMetadata?.title && <meta property="og:site_name" content={siteMetadata?.title} />}
104
87
  {!!locale && <meta property="og:locale" content={locale} />}
105
88
  {(!!openGraph?.title || !!pageMetadata?.title) && (
106
- <meta
107
- property="og:title"
108
- content={openGraph?.title || pageMetadata?.title}
109
- />
89
+ <meta property="og:title" content={openGraph?.title || pageMetadata?.title} />
110
90
  )}
111
91
  <meta property="og:type" content={openGraph?.type || "website"} />
112
92
  {(!!openGraph?.description || !!pageMetadata?.description) && (
@@ -115,13 +95,8 @@ const Head = (props: CustomHeadProps) => {
115
95
  content={openGraph?.description || pageMetadata?.description}
116
96
  />
117
97
  )}
118
- {!!openGraph?.image && (
119
- <meta property="og:image" content={openGraph?.image} />
120
- )}
121
- <meta
122
- property="og:url"
123
- content={pageMetadata?.canonical || fullUrl || ""}
124
- />
98
+ {!!openGraph?.image && <meta property="og:image" content={openGraph?.image} />}
99
+ <meta property="og:url" content={pageMetadata?.canonical || fullUrl || ""} />
125
100
 
126
101
  {/* Twitter */}
127
102
  <meta property="twitter:card" content="summary_large_image" />
@@ -129,14 +104,6 @@ const Head = (props: CustomHeadProps) => {
129
104
  <meta property="twitter:image" content={openGraph?.twitterImage} />
130
105
  )}
131
106
 
132
- {/* Debug */}
133
- {/* {!siteOptions?.avoidDebugMetas && (
134
- <meta
135
- property="debug"
136
- content={`Griddo v${griddoVersion} @ ${renderDate}}`}
137
- />
138
- )} */}
139
-
140
107
  {/* Keywords */}
141
108
  {siteOptions?.useMetaKeywords && !!pageMetadata?.metaKeywords && (
142
109
  <meta name="keywords" content={pageMetadata.metaKeywords} />
@@ -1,30 +1,17 @@
1
- import type { TemplateProps } from "../types";
2
1
  import type { Core } from "@griddo/core";
2
+ import type { TemplateProps } from "../types";
3
3
 
4
4
  import { Page as RenderGriddoPage } from "@griddo/core";
5
- import { GriddoIntegrations } from "@griddo/cx/react";
6
- import {
7
- components,
8
- SiteProvider,
9
- templates,
10
- formsTemplates,
11
- } from "@griddo-instance";
5
+ import { components, formsTemplates, SiteProvider, templates } from "@griddo-instance";
12
6
  import { Link, navigate } from "gatsby";
13
- import * as React from "react";
14
7
 
15
- // Gatsby Head
8
+ import { GriddoIntegrations } from "../../react/GriddoIntegrations";
9
+
16
10
  export { Head } from "./Head";
17
11
 
18
12
  const Template = (data: TemplateProps) => {
19
13
  const {
20
- pageContext: {
21
- cloudinaryName,
22
- page,
23
- siteLangs,
24
- siteMetadata,
25
- socials,
26
- theme,
27
- },
14
+ pageContext: { cloudinaryName, page, siteLangs, siteMetadata, socials, theme },
28
15
  } = data;
29
16
 
30
17
  const library = {
@@ -33,8 +20,6 @@ const Template = (data: TemplateProps) => {
33
20
  formsTemplates,
34
21
  };
35
22
 
36
- const mappedTheme = theme || "default-theme";
37
-
38
23
  const header = data.pageContext.header as Core.HeaderModule;
39
24
  const footer = data.pageContext.footer as Core.FooterModule;
40
25
 
@@ -52,14 +37,10 @@ const Template = (data: TemplateProps) => {
52
37
  siteLangs={siteLangs}
53
38
  siteMetadata={siteMetadata}
54
39
  socials={socials}
55
- theme={mappedTheme}
40
+ theme={theme}
56
41
  >
57
- <GriddoIntegrations
58
- location="start-body"
59
- integrations={page.integrations}
60
- />
42
+ <GriddoIntegrations location="start-body" integrations={page.integrations} />
61
43
 
62
- {/* Render every page */}
63
44
  <RenderGriddoPage
64
45
  apiUrl={page.apiUrl}
65
46
  content={page}
@@ -70,10 +51,7 @@ const Template = (data: TemplateProps) => {
70
51
  pageLanguages={page.pageLanguages}
71
52
  />
72
53
 
73
- <GriddoIntegrations
74
- location="end-body"
75
- integrations={page.integrations}
76
- />
54
+ <GriddoIntegrations location="end-body" integrations={page.integrations} />
77
55
  </SiteProvider>
78
56
  );
79
57
  };