@griddo/cx 1.55.6 → 1.55.10
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-node.js +20 -20
- package/package.json +3 -3
- package/src/services/distributors.js +7 -13
package/gatsby-node.js
CHANGED
|
@@ -148,31 +148,31 @@ exports.createPages = async ({ actions }) => {
|
|
|
148
148
|
|
|
149
149
|
additionalInfo.navigations = NavService.getPageNavigations(page);
|
|
150
150
|
|
|
151
|
-
const isList = distributorTemplate
|
|
151
|
+
const isList = distributorTemplate?.type?.mode?.toLowerCase() === 'list';
|
|
152
152
|
|
|
153
153
|
// Multi-page (pagination) or single-page
|
|
154
154
|
isList
|
|
155
155
|
? await utils.renderMultiplePages(
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
156
|
+
{
|
|
157
|
+
rootPage: page,
|
|
158
|
+
pages: utils.getList(distributorTemplate),
|
|
159
|
+
isRoot: false,
|
|
160
|
+
defaultLang,
|
|
161
|
+
distributorTemplate,
|
|
162
|
+
},
|
|
163
|
+
additionalInfo,
|
|
164
|
+
actions.createPage
|
|
165
|
+
)
|
|
166
166
|
: await utils.renderSinglePage(
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
167
|
+
{
|
|
168
|
+
...page,
|
|
169
|
+
template: distributorTemplate,
|
|
170
|
+
isRoot: false,
|
|
171
|
+
defaultLang,
|
|
172
|
+
},
|
|
173
|
+
additionalInfo,
|
|
174
|
+
actions.createPage
|
|
175
|
+
);
|
|
176
176
|
|
|
177
177
|
buildProcessData[siteID].publishHashes.push(page.hash);
|
|
178
178
|
}
|
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.55.
|
|
4
|
+
"version": "1.55.10",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"react-helmet": "^6.0.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@griddo/eslint-config-back": "^1.55.
|
|
64
|
+
"@griddo/eslint-config-back": "^1.55.10",
|
|
65
65
|
"eslint": "^7.5.0",
|
|
66
66
|
"eslint-plugin-node": "^11.1.0",
|
|
67
67
|
"eslint-plugin-react": "7.14.3",
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"publishConfig": {
|
|
94
94
|
"access": "public"
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "75dc93fbad8db8bcdafbd47d3f126b0f645b46c6"
|
|
97
97
|
}
|
|
@@ -20,6 +20,10 @@ class DistributorService {
|
|
|
20
20
|
|
|
21
21
|
static async fetchData({ page, component }) {
|
|
22
22
|
const { data } = component;
|
|
23
|
+
if (!data) {
|
|
24
|
+
console.log(`======= ERROR: Página ${page.id} tiene un hasDistributorData pero no un elemento data con la configuración del distribuidor en el mismo nivel.`);
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
23
27
|
const body = this.getBody(data);
|
|
24
28
|
const response = await SitesService.getDistributorData(page, body);
|
|
25
29
|
return response;
|
|
@@ -46,20 +50,10 @@ class DistributorService {
|
|
|
46
50
|
};
|
|
47
51
|
|
|
48
52
|
const getDistributors = async (template) => {
|
|
49
|
-
await getDistributorsContent(template);
|
|
50
|
-
|
|
51
|
-
const mappedTemplate = template.hasDistributorData
|
|
52
|
-
? {
|
|
53
|
-
...template,
|
|
54
|
-
queriedItems: await this.fetchData({ page, component: template }),
|
|
55
|
-
}
|
|
56
|
-
: {
|
|
57
|
-
...template,
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
return mappedTemplate;
|
|
53
|
+
await getDistributorsContent([template]); // ==> En array para que también revise la propia template como objeto.
|
|
54
|
+
return template;
|
|
61
55
|
};
|
|
62
|
-
|
|
56
|
+
|
|
63
57
|
const response = await getDistributors(template);
|
|
64
58
|
return response;
|
|
65
59
|
} catch (e) {
|