@griddo/cx 1.57.3 → 1.57.8

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,16 +1,11 @@
1
- import { Page } from './src/components/Page';
1
+ import PageElement from './src/components/PageElement';
2
+
3
+ export const wrapPageElement = PageElement;
2
4
 
3
- export const wrapPageElement = Page;
4
5
  const measurableHeaderSelector = '.griddo-header';
5
6
 
6
7
  export const onRouteUpdate = ({ location }) => {
7
- if (
8
- !window ||
9
- !document ||
10
- !location ||
11
- !location.hash
12
- )
13
- return;
8
+ if (!window || !document || !location || !location.hash) return;
14
9
 
15
10
  const headerHeight =
16
11
  document.querySelector(measurableHeaderSelector)?.offsetHeight || 0;
package/gatsby-node.js CHANGED
@@ -32,7 +32,7 @@ const componentsVersion = getComponentsVersion();
32
32
  // -----------------------------------------------------------------------------
33
33
  // Component System alias
34
34
  // -----------------------------------------------------------------------------
35
- exports.onCreateWebpackConfig = ({ actions, loaders, getConfig }) => {
35
+ exports.onCreateWebpackConfig = ({ actions, plugins, loaders, getConfig }) => {
36
36
  if (isComponentLibraryEnv) {
37
37
  const config = getConfig();
38
38
  config.module.rules = [
@@ -53,7 +53,13 @@ exports.onCreateWebpackConfig = ({ actions, loaders, getConfig }) => {
53
53
  }
54
54
 
55
55
  // Add component-system aliases to Webpack's Resolve:
56
- actions.setWebpackConfig({ resolve: { alias: projectAliases } });
56
+ actions.setWebpackConfig({
57
+ resolve: {
58
+ fallback: { path: require.resolve('path-browserify') },
59
+ alias: projectAliases,
60
+ },
61
+ plugins: [plugins.provide({ process: 'process/browser' })],
62
+ });
57
63
  };
58
64
 
59
65
  // -----------------------------------------------------------------------------
package/gatsby-ssr.js CHANGED
@@ -1,10 +1,10 @@
1
1
  // Gatsby SSR API
2
2
  // https://www.gatsbyjs.com/docs/reference/config-files/gatsby-ssr/
3
3
 
4
- import { Page } from './src/components/Page';
4
+ import { PageElement } from './src/components/PageElement';
5
5
  import { onRenderBody as onRenderBodyFromClient } from 'components';
6
6
 
7
- export const wrapPageElement = Page;
7
+ export const wrapPageElement = PageElement;
8
8
 
9
9
  export const onRenderBody = ({
10
10
  setHeadComponents,
@@ -23,10 +23,10 @@ export const onRenderBody = ({
23
23
  bodyProps,
24
24
  } = onRenderBodyFromClient || {};
25
25
 
26
- setHeadComponents(headComponents);
27
- setPreBodyComponents(preBodyComponents);
28
- setPostBodyComponents(postBodyComponents);
29
- setHtmlAttributes(htmlAttributes);
30
- setBodyAttributes(bodyAttributes);
31
- setBodyProps(bodyProps);
26
+ headComponents && setHeadComponents(headComponents);
27
+ preBodyComponents && setPreBodyComponents(preBodyComponents);
28
+ postBodyComponents && setPostBodyComponents(postBodyComponents);
29
+ htmlAttributes && setHtmlAttributes(htmlAttributes);
30
+ bodyAttributes && setBodyAttributes(bodyAttributes);
31
+ bodyProps && setBodyProps(bodyProps);
32
32
  };
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.57.3",
4
+ "version": "1.57.8",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Carlos Torres <carlos.torres@secuoyas.com>",
@@ -33,6 +33,7 @@
33
33
  "@babel/plugin-proposal-class-properties": "^7.7.4",
34
34
  "@babel/preset-env": "^7.14.5",
35
35
  "@babel/preset-react": "^7.14.5",
36
+ "@babel/preset-typescript": "^7.16.5",
36
37
  "@svgr/webpack": "^5.5.0",
37
38
  "babel-loader": "^8.0.6",
38
39
  "babel-plugin-styled-components": "^1.10.7",
@@ -44,24 +45,26 @@
44
45
  "dotenv": "^8.1.0",
45
46
  "find-up": "^5.0.0",
46
47
  "fs-extra": "^9.0.1",
47
- "gatsby": "^2.4.0",
48
+ "gatsby": "^3.0.0",
48
49
  "gatsby-plugin-canonical-urls": "2.1.6",
49
- "gatsby-plugin-catch-links": "^2.0.0",
50
+ "gatsby-plugin-catch-links": "^3.0.0",
50
51
  "gatsby-plugin-force-trailing-slashes": "^1.0.4",
51
- "gatsby-plugin-no-sourcemaps": "2.2.0",
52
+ "gatsby-plugin-no-sourcemaps": "^3.0.0",
52
53
  "gatsby-plugin-polyfill-io": "1.1.0",
53
- "gatsby-plugin-react-helmet": "3.6.0",
54
+ "gatsby-plugin-react-helmet": "^4.0.0",
54
55
  "gatsby-plugin-react-svg": "^3.0.1",
55
56
  "gatsby-plugin-remove-generator": "^1.1.0",
56
- "gatsby-plugin-styled-components": "3.3.0",
57
+ "gatsby-plugin-styled-components": "^4.0.0",
57
58
  "gatsby-plugin-svgr": "2.1.0",
58
59
  "js2xmlparser": "^4.0.1",
59
60
  "opn": "^6.0.0",
61
+ "path-browserify": "^1.0.1",
60
62
  "pkg-dir": "^5.0.0",
63
+ "process": "^0.11.10",
61
64
  "react-helmet": "^6.0.0"
62
65
  },
63
66
  "devDependencies": {
64
- "@griddo/eslint-config-back": "^1.57.3",
67
+ "@griddo/eslint-config-back": "^1.57.8",
65
68
  "eslint": "^7.5.0",
66
69
  "eslint-plugin-node": "^11.1.0",
67
70
  "eslint-plugin-react": "7.14.3",
@@ -93,5 +96,5 @@
93
96
  "publishConfig": {
94
97
  "access": "public"
95
98
  },
96
- "gitHead": "419582349c3dc66afdbfce7af4ad78a9138eda4f"
99
+ "gitHead": "94bdcbf2205bdb913a38ae73a828ff9ea3c3cda2"
97
100
  }
@@ -0,0 +1,4 @@
1
+ export default function Page(props) {
2
+ const { element } = props;
3
+ return element;
4
+ }
@@ -1,8 +1,17 @@
1
1
  import * as React from 'react';
2
+ import { Link } from 'gatsby';
2
3
  import Seo from './seo';
3
- import { core, components, templates } from 'components';
4
+ import {
5
+ core,
6
+ components,
7
+ templates,
8
+ providers,
9
+ cloudinaryDefaults,
10
+ translations,
11
+ } from 'components';
4
12
 
5
- const { Page } = core;
13
+ const { Page: RenderGriddoPage } = core;
14
+ const { SiteProvider } = providers;
6
15
 
7
16
  export default data => {
8
17
  const {
@@ -15,6 +24,13 @@ export default data => {
15
24
  siteMetadata,
16
25
  componentsVersion,
17
26
  showBasicMetaRobots,
27
+ theme,
28
+ cloudinaryName,
29
+ socials,
30
+ siteLangs,
31
+ BUILD_MODE,
32
+ page: { site: siteId, apiUrl, publicApiUrl },
33
+ sitePages,
18
34
  } = data.pageContext;
19
35
 
20
36
  const library = {
@@ -22,9 +38,26 @@ export default data => {
22
38
  templates,
23
39
  };
24
40
 
41
+ const mappedTheme = theme || 'default-theme';
42
+
25
43
  return (
26
- <>
27
- {/* PAGE SEO */}
44
+ <SiteProvider
45
+ theme={mappedTheme}
46
+ cloudinaryCloudName={cloudinaryName}
47
+ linkComponent={Link}
48
+ googleMapAPIKey="AIzaSyBVJ_qu0_-4EzAVuLVoP93f7wLlXHzVVPQ"
49
+ socials={socials}
50
+ siteLangs={siteLangs}
51
+ translations={translations}
52
+ cloudinaryDefaults={cloudinaryDefaults}
53
+ siteMetadata={siteMetadata}
54
+ renderer="gatsby"
55
+ buildMode={BUILD_MODE}
56
+ siteId={siteId}
57
+ apiUrl={apiUrl}
58
+ publicApiUrl={publicApiUrl}
59
+ sitePages={sitePages}
60
+ >
28
61
  <Seo
29
62
  siteMetadata={siteMetadata}
30
63
  openGraph={openGraph}
@@ -38,8 +71,33 @@ export default data => {
38
71
  showBasicMetaRobots={showBasicMetaRobots}
39
72
  />
40
73
 
41
- {/* PAGE CONTENT */}
42
- <Page
74
+ {/*
75
+
76
+ El componente Page de @griddo/core se encarga de renderizar header,
77
+ footer y los módulos mediante un bucle interno.
78
+
79
+ +---------------------------+ --> +---------------------------+
80
+ | header | | <SiteProvider/> |
81
+ +---------------------------+ --> | <PageProvider/> |
82
+ | template{} | | <Header/> |
83
+ | -> section 0 -> modules[] | --> | |
84
+ | -> section n -> modules[] | | <HeroSection/> |
85
+ +---------------------------+ --> | <Module/> |
86
+ | footer | | |
87
+ +---------------------------+ --> | <MainSection/> |
88
+ | <Module/> |
89
+ | <Module/> |
90
+ | <Module/> |
91
+ | <Module/> |
92
+ | |
93
+ | <Footer/> |
94
+ | <PageProvider/> |
95
+ | <SiteProvider/> |
96
+ +---------------------------+
97
+
98
+ */}
99
+
100
+ <RenderGriddoPage
43
101
  content={content}
44
102
  header={header}
45
103
  footer={footer}
@@ -48,6 +106,6 @@ export default data => {
48
106
  languageId={content.language}
49
107
  pageLanguages={content.pageLanguages}
50
108
  />
51
- </>
109
+ </SiteProvider>
52
110
  );
53
111
  };
@@ -1,54 +0,0 @@
1
- import React from 'react';
2
- import { providers, translations, cloudinaryDefaults } from 'components';
3
-
4
- import { Link } from 'gatsby';
5
-
6
- const { SiteProvider } = providers;
7
-
8
- export const Page = props => {
9
- const {
10
- element,
11
- props: {
12
- pageContext: {
13
- theme,
14
- socials,
15
- siteLangs,
16
- cloudinaryName,
17
- siteMetadata,
18
- BUILD_MODE,
19
- page: { site: siteId, apiUrl, publicApiUrl },
20
- sitePages,
21
- },
22
- },
23
- } = props;
24
-
25
- const mappedTheme = !!theme ? theme : 'default-theme';
26
-
27
- return (
28
- <SiteProvider
29
- theme={mappedTheme}
30
- cloudinaryCloudName={cloudinaryName}
31
- linkComponent={Link}
32
- googleMapAPIKey="AIzaSyBVJ_qu0_-4EzAVuLVoP93f7wLlXHzVVPQ"
33
- socials={socials}
34
- siteLangs={siteLangs}
35
- translations={translations}
36
- cloudinaryDefaults={cloudinaryDefaults}
37
- siteMetadata={siteMetadata}
38
- renderer="gatsby"
39
- buildMode={BUILD_MODE}
40
- siteId={siteId}
41
- // {apiUrl} también se está enviando en el PageProvider en el archivo
42
- // template.js. Se va a dejar por motivos de retrocompatibilidad
43
- // (Se sabe que el proyecto de IE lo está usando desde el PageProvider)
44
- // En alguna versión se procederá a deprecarlo y ya solo se podrá obtener
45
- // la url de la api pública mediante el proveedor de site <SiteProvider>
46
- // utilizando convenientemente el hook useSite()
47
- apiUrl={apiUrl}
48
- publicApiUrl={publicApiUrl}
49
- sitePages={sitePages}
50
- >
51
- {element}
52
- </SiteProvider>
53
- );
54
- };