@griddo/cx 1.62.0 → 1.62.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-browser.js CHANGED
@@ -1,15 +1,120 @@
1
- import PageElement from './src/components/PageElement';
1
+ /* eslint-disable node/no-missing-require */
2
2
 
3
- export const wrapPageElement = PageElement;
3
+ const { browser } = require('components');
4
4
 
5
- const measurableHeaderSelector = '.griddo-header';
5
+ exports.disableCorePrefetching = () => {
6
+ if (browser.disableCorePrefetching) {
7
+ browser.disableCorePrefetching();
8
+ }
9
+ };
10
+
11
+ exports.onClientEntry = () => {
12
+ if (browser.onClientEntry) {
13
+ browser.onClientEntry();
14
+ }
15
+ };
16
+
17
+ exports.onInitialClientRender = () => {
18
+ if (browser.onInitialClientRender) {
19
+ browser.onInitialClientRender();
20
+ }
21
+ };
22
+
23
+ exports.onPostPrefetchPathname = props => {
24
+ if (browser.onPostPrefetchPathname) {
25
+ browser.onPostPrefetchPathname(props);
26
+ }
27
+ };
28
+
29
+ exports.onPreRouteUpdate = props => {
30
+ if (browser.onPreRouteUpdate) {
31
+ browser.onPreRouteUpdate(props);
32
+ }
33
+ };
6
34
 
7
- export const onRouteUpdate = ({ location }) => {
35
+ exports.onPrefetchPathname = props => {
36
+ if (browser.onPrefetchPathname) {
37
+ browser.onPrefetchPathname(props);
38
+ }
39
+ };
40
+
41
+ exports.onRouteUpdateDelayed = props => {
42
+ if (browser.onServiceWorkerActive) {
43
+ browser.onRouteUpdateDelayed(props);
44
+ }
45
+ };
46
+
47
+ exports.onServiceWorkerActive = props => {
48
+ if (browser.onServiceWorkerActive) {
49
+ browser.onServiceWorkerActive(props);
50
+ }
51
+ };
52
+
53
+ exports.onServiceWorkerInstalled = props => {
54
+ if (browser.onServiceWorkerInstalled) {
55
+ browser.onServiceWorkerInstalled(props);
56
+ }
57
+ };
58
+
59
+ exports.onServiceWorkerRedundant = props => {
60
+ if (browser.onServiceWorkerRedundant) {
61
+ browser.onServiceWorkerRedundant(props);
62
+ }
63
+ };
64
+
65
+ exports.onServiceWorkerUpdateFound = props => {
66
+ if (browser.onServiceWorkerUpdateFound) {
67
+ browser.onServiceWorkerUpdateFound(props);
68
+ }
69
+ };
70
+
71
+ exports.onServiceWorkerUpdateReady = props => {
72
+ if (browser.onServiceWorkerUpdateReady) {
73
+ browser.onServiceWorkerUpdateReady(props);
74
+ }
75
+ };
76
+
77
+ exports.registerServiceWorker = () => {
78
+ if (browser.registerServiceWorker) {
79
+ browser.registerServiceWorker();
80
+ }
81
+ };
82
+
83
+ exports.replaceHydrateFunction = () => {
84
+ if (browser.replaceHydrateFunction) {
85
+ browser.replaceHydrateFunction();
86
+ }
87
+ };
88
+
89
+ exports.shouldUpdateScroll = props => {
90
+ if (browser.shouldUpdateScroll) {
91
+ browser.shouldUpdateScroll(props);
92
+ }
93
+ };
94
+
95
+ exports.wrapRootElement = props => {
96
+ if (browser.wrapPageElement) {
97
+ return browser.wrapRootElement(props);
98
+ }
99
+ };
100
+
101
+ exports.wrapRootElement = props => {
102
+ if (browser.wrapRootElement) {
103
+ return browser.wrapRootElement(props);
104
+ }
105
+ };
106
+
107
+ exports.onRouteUpdate = props => {
108
+ // Instance onRouteUpdate
109
+ if (browser.onRouteUpdate) {
110
+ browser.onRouteUpdate(props);
111
+ }
112
+
113
+ // Griddo onRouteUpdate
8
114
  if (!window || !document || !location || !location.hash) return;
9
115
 
10
116
  const headerHeight =
11
- document.querySelector(measurableHeaderSelector)?.offsetHeight || 0;
12
-
117
+ document.querySelector('.griddo-header')?.offsetHeight || 0;
13
118
  if (location.hash !== '') {
14
119
  window.scrollTo({
15
120
  left: 0,
@@ -19,9 +124,10 @@ export const onRouteUpdate = ({ location }) => {
19
124
  }
20
125
  };
21
126
 
127
+ // Functions
128
+
22
129
  function getOffset(el) {
23
130
  const rect = document?.querySelector(el)?.getBoundingClientRect();
24
-
25
131
  return {
26
132
  left: rect?.left + window?.scrollX,
27
133
  top: rect?.top + window?.scrollY,
package/gatsby-config.js CHANGED
@@ -4,13 +4,14 @@ require('dotenv').config();
4
4
 
5
5
  const assetPrefix = process.env.ASSET_PREFIX || undefined;
6
6
 
7
- // Gatsby plugins configuration file from client
8
- // TODO: Filter the configuration to allow just supported plugins?
9
- const { plugins } = require(computils.resolveComponentsPath(
7
+ // Gatsby configuration file from client
8
+ const { plugins, ...gatsbyConfig } = require(computils.resolveComponentsPath(
10
9
  'builder.config.js'
11
10
  ));
12
11
 
13
12
  const CONFIG = {
13
+ // cliente config
14
+ ...gatsbyConfig,
14
15
  plugins: [
15
16
  // client plugins
16
17
  ...plugins,
package/gatsby-ssr.js CHANGED
@@ -1,32 +1,33 @@
1
- // Gatsby SSR API
2
- // https://www.gatsbyjs.com/docs/reference/config-files/gatsby-ssr/
1
+ /* eslint-disable node/no-missing-require */
3
2
 
4
- import PageElement from './src/components/PageElement';
5
- import { onRenderBody as onRenderBodyFromClient } from 'components';
3
+ const { ssr } = require('components');
6
4
 
7
- export const wrapPageElement = PageElement;
5
+ exports.onRenderBody = props => {
6
+ if (ssr.onRenderBody) {
7
+ ssr.onRenderBody(props);
8
+ }
9
+ };
10
+
11
+ exports.onPreRenderHTML = props => {
12
+ if (ssr.onPreRenderHTML) {
13
+ ssr.onPreRenderHTML(props);
14
+ }
15
+ };
8
16
 
9
- export const onRenderBody = ({
10
- setHeadComponents,
11
- setPreBodyComponents,
12
- setPostBodyComponents,
13
- setHtmlAttributes,
14
- setBodyAttributes,
15
- setBodyProps,
16
- }) => {
17
- const {
18
- headComponents,
19
- preBodyComponents,
20
- postBodyComponents,
21
- htmlAttributes,
22
- bodyAttributes,
23
- bodyProps,
24
- } = onRenderBodyFromClient || {};
17
+ exports.replaceRenderer = props => {
18
+ if (ssr.replaceRenderer) {
19
+ ssr.replaceRenderer(props);
20
+ }
21
+ };
22
+
23
+ exports.wrapPageElement = props => {
24
+ if (ssr.wrapPageElement) {
25
+ return ssr.wrapPageElement(props);
26
+ }
27
+ };
25
28
 
26
- headComponents && setHeadComponents(headComponents);
27
- preBodyComponents && setPreBodyComponents(preBodyComponents);
28
- postBodyComponents && setPostBodyComponents(postBodyComponents);
29
- htmlAttributes && setHtmlAttributes(htmlAttributes);
30
- bodyAttributes && setBodyAttributes(bodyAttributes);
31
- bodyProps && setBodyProps(bodyProps);
29
+ exports.wrapRootElement = props => {
30
+ if (ssr.wrapRootElement) {
31
+ return ssr.wrapRootElement(props);
32
+ }
32
33
  };
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.62.0",
4
+ "version": "1.62.3",
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.62.0",
69
+ "@griddo/eslint-config-back": "^1.62.3",
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": "ccd43cb7570877ce9c1e21d7656202dd35ec500f"
101
+ "gitHead": "a06d325550a9963c24c2072634bfa751a063f2ac"
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
- googleMapAPIKey="AIzaSyBVJ_qu0_-4EzAVuLVoP93f7wLlXHzVVPQ"
48
+ navigate={navigate}
49
+ location={data.location}
49
50
  socials={socials}
50
51
  siteLangs={siteLangs}
51
52
  translations={translations}
@@ -1,4 +0,0 @@
1
- export default function Page(props) {
2
- const { element } = props;
3
- return element;
4
- }