@griddo/cx 1.62.1 → 1.62.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/gatsby-browser.js CHANGED
@@ -1,29 +1,111 @@
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
+ };
34
+
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
+ };
6
52
 
7
- export const onRouteUpdate = ({ location }) => {
8
- if (!window || !document || !location || !location.hash) return;
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
+ };
9
70
 
10
- const headerHeight =
11
- document.querySelector(measurableHeaderSelector)?.offsetHeight || 0;
71
+ exports.onServiceWorkerUpdateReady = props => {
72
+ if (browser.onServiceWorkerUpdateReady) {
73
+ browser.onServiceWorkerUpdateReady(props);
74
+ }
75
+ };
12
76
 
13
- if (location.hash !== '') {
14
- window.scrollTo({
15
- left: 0,
16
- top: getOffset(location.hash).top - headerHeight,
17
- behavior: 'smooth',
18
- });
77
+ exports.registerServiceWorker = () => {
78
+ if (browser.registerServiceWorker) {
79
+ browser.registerServiceWorker();
19
80
  }
20
81
  };
21
82
 
22
- function getOffset(el) {
23
- const rect = document?.querySelector(el)?.getBoundingClientRect();
83
+ exports.replaceHydrateFunction = () => {
84
+ if (browser.replaceHydrateFunction) {
85
+ browser.replaceHydrateFunction();
86
+ }
87
+ };
24
88
 
25
- return {
26
- left: rect?.left + window?.scrollX,
27
- top: rect?.top + window?.scrollY,
28
- };
29
- }
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
+ if (browser.onRouteUpdate) {
109
+ browser.onRouteUpdate(props);
110
+ }
111
+ };
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.1",
4
+ "version": "1.62.4",
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.1",
69
+ "@griddo/eslint-config-back": "^1.62.4",
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": "36e527f0b4a08d89fb6170a11b38bea5798438d0"
101
+ "gitHead": "880c563378704e4a44a22a794b0fafee9fad88e6"
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
- }