@griddo/cx 1.61.7 → 1.62.2
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-browser.js +131 -7
- package/gatsby-ssr.js +45 -27
- package/package.json +3 -3
- package/src/components/template.js +3 -2
- package/src/components/PageElement.js +0 -4
package/gatsby-browser.js
CHANGED
|
@@ -1,15 +1,138 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable node/no-unpublished-require */
|
|
2
|
+
/* eslint-disable node/no-missing-require */
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
let builderBrowserConfig;
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
// Intance Gatsby Browser configuration file
|
|
7
|
+
// Se intenta hacer require del archivo builder.config que solo está en la
|
|
8
|
+
// instancia. De no existir, se avisa por consola.
|
|
9
|
+
// TODO: Añadir un método infalible para saber si es monorepo o instancia.
|
|
10
|
+
try {
|
|
11
|
+
builderBrowserConfig = require('../../../builder.browser');
|
|
12
|
+
console.log('Instance build.config loaded');
|
|
13
|
+
} catch (e) {
|
|
14
|
+
builderBrowserConfig = require('../griddo-components/builder.browser');
|
|
15
|
+
console.warn('Loading builder.config from Griddo monorepo');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Gatsby API Browser
|
|
19
|
+
// Si builderBrowserConfig.* es "truthy" es que `builderBrowserConfig` no es `undefined`, es decir se
|
|
20
|
+
// está ejecutando en la instancia y * está definido en el archivo de la
|
|
21
|
+
// instancia para ejecutar código.
|
|
22
|
+
|
|
23
|
+
exports.disableCorePrefetching = () => {
|
|
24
|
+
if (builderBrowserConfig.disableCorePrefetching) {
|
|
25
|
+
builderBrowserConfig.disableCorePrefetching();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
exports.onClientEntry = () => {
|
|
30
|
+
if (builderBrowserConfig.onClientEntry) {
|
|
31
|
+
builderBrowserConfig.onClientEntry();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
exports.onInitialClientRender = () => {
|
|
36
|
+
if (builderBrowserConfig.onInitialClientRender) {
|
|
37
|
+
builderBrowserConfig.onInitialClientRender();
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
exports.onPostPrefetchPathname = props => {
|
|
42
|
+
if (builderBrowserConfig.onPostPrefetchPathname) {
|
|
43
|
+
builderBrowserConfig.onPostPrefetchPathname(props);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
exports.onPreRouteUpdate = props => {
|
|
48
|
+
if (builderBrowserConfig.onPreRouteUpdate) {
|
|
49
|
+
builderBrowserConfig.onPreRouteUpdate(props);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
exports.onPrefetchPathname = props => {
|
|
54
|
+
if (builderBrowserConfig.onPrefetchPathname) {
|
|
55
|
+
builderBrowserConfig.onPrefetchPathname(props);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
exports.onRouteUpdateDelayed = props => {
|
|
60
|
+
if (builderBrowserConfig.onServiceWorkerActive) {
|
|
61
|
+
builderBrowserConfig.onRouteUpdateDelayed(props);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
exports.onServiceWorkerActive = props => {
|
|
66
|
+
if (builderBrowserConfig.onServiceWorkerActive) {
|
|
67
|
+
builderBrowserConfig.onServiceWorkerActive(props);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
exports.onServiceWorkerInstalled = props => {
|
|
72
|
+
if (builderBrowserConfig.onServiceWorkerInstalled) {
|
|
73
|
+
builderBrowserConfig.onServiceWorkerInstalled(props);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
6
76
|
|
|
7
|
-
|
|
77
|
+
exports.onServiceWorkerRedundant = props => {
|
|
78
|
+
if (builderBrowserConfig.onServiceWorkerRedundant) {
|
|
79
|
+
builderBrowserConfig.onServiceWorkerRedundant(props);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
exports.onServiceWorkerUpdateFound = props => {
|
|
84
|
+
if (builderBrowserConfig.onServiceWorkerUpdateFound) {
|
|
85
|
+
builderBrowserConfig.onServiceWorkerUpdateFound(props);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
exports.onServiceWorkerUpdateReady = props => {
|
|
90
|
+
if (builderBrowserConfig.onServiceWorkerUpdateReady) {
|
|
91
|
+
builderBrowserConfig.onServiceWorkerUpdateReady(props);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
exports.registerServiceWorker = () => {
|
|
96
|
+
if (builderBrowserConfig.registerServiceWorker) {
|
|
97
|
+
builderBrowserConfig.registerServiceWorker();
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
exports.replaceHydrateFunction = () => {
|
|
102
|
+
if (builderBrowserConfig.replaceHydrateFunction) {
|
|
103
|
+
builderBrowserConfig.replaceHydrateFunction();
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
exports.shouldUpdateScroll = props => {
|
|
108
|
+
if (builderBrowserConfig.shouldUpdateScroll) {
|
|
109
|
+
builderBrowserConfig.shouldUpdateScroll(props);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
exports.wrapRootElement = props => {
|
|
114
|
+
if (builderBrowserConfig.wrapPageElement) {
|
|
115
|
+
return builderBrowserConfig.wrapRootElement(props);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
exports.wrapRootElement = props => {
|
|
120
|
+
if (builderBrowserConfig.wrapRootElement) {
|
|
121
|
+
return builderBrowserConfig.wrapRootElement(props);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
exports.onRouteUpdate = props => {
|
|
126
|
+
// Instance onRouteUpdate
|
|
127
|
+
if (builderBrowserConfig.onRouteUpdate) {
|
|
128
|
+
builderBrowserConfig.onRouteUpdate(props);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Griddo onRouteUpdate
|
|
8
132
|
if (!window || !document || !location || !location.hash) return;
|
|
9
133
|
|
|
10
134
|
const headerHeight =
|
|
11
|
-
document.querySelector(
|
|
12
|
-
|
|
135
|
+
document.querySelector('.griddo-header')?.offsetHeight || 0;
|
|
13
136
|
if (location.hash !== '') {
|
|
14
137
|
window.scrollTo({
|
|
15
138
|
left: 0,
|
|
@@ -19,9 +142,10 @@ export const onRouteUpdate = ({ location }) => {
|
|
|
19
142
|
}
|
|
20
143
|
};
|
|
21
144
|
|
|
145
|
+
// Functions
|
|
146
|
+
|
|
22
147
|
function getOffset(el) {
|
|
23
148
|
const rect = document?.querySelector(el)?.getBoundingClientRect();
|
|
24
|
-
|
|
25
149
|
return {
|
|
26
150
|
left: rect?.left + window?.scrollX,
|
|
27
151
|
top: rect?.top + window?.scrollY,
|
package/gatsby-ssr.js
CHANGED
|
@@ -1,32 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/* eslint-disable node/no-unpublished-require */
|
|
2
|
+
/* eslint-disable node/no-missing-require */
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
import { onRenderBody as onRenderBodyFromClient } from 'components';
|
|
4
|
+
let builderSSRConfig;
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
// Intance Gatsby Browser configuration file
|
|
7
|
+
// Se intenta hacer require del archivo builder.config que solo está en la
|
|
8
|
+
// instancia. De no existir, se avisa por consola.
|
|
9
|
+
// TODO: Añadir un método infalible para saber si es monorepo o instancia.
|
|
10
|
+
try {
|
|
11
|
+
builderSSRConfig = require('../../../builder.ssr');
|
|
12
|
+
console.log('Instance build.ssr loaded');
|
|
13
|
+
} catch (e) {
|
|
14
|
+
builderSSRConfig = require('../griddo-components/builder.ssr');
|
|
15
|
+
console.warn('Loading builder.ssr from Griddo monorepo');
|
|
16
|
+
}
|
|
8
17
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
// Gatsby SSR Browser
|
|
19
|
+
// Si builderSSRConfig.* es "truthy" es que `builderSSRConfig` no es `undefined`, es decir se
|
|
20
|
+
// está ejecutando en la instancia y * está definido en el archivo de la
|
|
21
|
+
// instancia para ejecutar código.
|
|
22
|
+
exports.onRenderBody = props => {
|
|
23
|
+
if (builderSSRConfig.onRenderBody) {
|
|
24
|
+
builderSSRConfig.onRenderBody(props);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
exports.onPreRenderHTML = props => {
|
|
29
|
+
if (builderSSRConfig.onPreRenderHTML) {
|
|
30
|
+
builderSSRConfig.onPreRenderHTML(props);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
exports.replaceRenderer = props => {
|
|
35
|
+
if (builderSSRConfig.replaceRenderer) {
|
|
36
|
+
builderSSRConfig.replaceRenderer(props);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
exports.wrapPageElement = props => {
|
|
41
|
+
if (builderSSRConfig.wrapPageElement) {
|
|
42
|
+
return builderSSRConfig.wrapPageElement(props);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
25
45
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
bodyAttributes && setBodyAttributes(bodyAttributes);
|
|
31
|
-
bodyProps && setBodyProps(bodyProps);
|
|
46
|
+
exports.wrapRootElement = props => {
|
|
47
|
+
if (builderSSRConfig.wrapRootElement) {
|
|
48
|
+
return builderSSRConfig.wrapRootElement(props);
|
|
49
|
+
}
|
|
32
50
|
};
|
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.
|
|
4
|
+
"version": "1.62.2",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"react-helmet": "^6.0.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@griddo/eslint-config-back": "^1.
|
|
69
|
+
"@griddo/eslint-config-back": "^1.62.2",
|
|
70
70
|
"eslint": "^7.5.0",
|
|
71
71
|
"eslint-plugin-node": "^11.1.0",
|
|
72
72
|
"eslint-plugin-react": "7.14.3",
|
|
@@ -98,5 +98,5 @@
|
|
|
98
98
|
"publishConfig": {
|
|
99
99
|
"access": "public"
|
|
100
100
|
},
|
|
101
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "df32ddb1e4be034954e3f1f8af032af0e56453c6"
|
|
102
102
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Link } from 'gatsby';
|
|
2
|
+
import { Link, navigate } from 'gatsby';
|
|
3
3
|
import Seo from './seo';
|
|
4
4
|
import {
|
|
5
5
|
core,
|
|
@@ -45,7 +45,8 @@ export default data => {
|
|
|
45
45
|
theme={mappedTheme}
|
|
46
46
|
cloudinaryCloudName={cloudinaryName}
|
|
47
47
|
linkComponent={Link}
|
|
48
|
-
|
|
48
|
+
navigate={navigate}
|
|
49
|
+
location={data.location}
|
|
49
50
|
socials={socials}
|
|
50
51
|
siteLangs={siteLangs}
|
|
51
52
|
translations={translations}
|