@griddo/cx 10.2.11 → 10.2.13

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.
@@ -43,4 +43,4 @@ ${p}
43
43
  ${y}
44
44
 
45
45
  =============
46
- `))}Xc.default.config();var pi=process.env.API_URL,Ie=`${pi}/site/`,Ee={GET_ALL:`${pi}/sites/all`,GET_PAGE:[`${pi}/page/`,""],INFO:[`${Ie}`,"/all"],LANGUAGES:[`${Ie}`,"/languages"],BUILD_START:[`${Ie}`,"/build/start"],BUILD_END:[`${Ie}`,"/build/end"],GET_DISTRIBUTOR_DATA:[`${Ie}`,"/distributor"],GET_SITEMAP:[`${Ie}`,"/sitemap"],SOCIALS:[`${Ie}`,"/socials"],GET_PAGES:[`${Ie}`,"/pages?pagination=false"]},Nr=class{static async getAll(){let{GET_ALL:t}=Ee;return await Te({endpoint:t})}static async getPage(t,r){let{GET_PAGE:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}static async getInfo(t,r=""){let{INFO:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}static async getLanguages(t,r=""){let{LANGUAGES:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}static async startSiteRender(t){let{BUILD_START:[r,n]}=Ee;return await Te({endpoint:`${r}${t}${n}`})}static async endSiteRender(t,r){let{BUILD_END:[n,i]}=Ee;return await di({endpoint:`${n}${t}${i}`,body:r})}static async getDistributorData(t,r,n){let{GET_DISTRIBUTOR_DATA:[i,s]}=Ee,{language:o,site:a}=t;return await di({endpoint:`${i}${a}${s}`,body:r,headers:{lang:o},cacheKey:n})}static async getSitemap(t){let{GET_SITEMAP:[r,n]}=Ee;return await Te({endpoint:`${r}${t}${n}`})}static async getSocials(t,r=""){let{SOCIALS:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}};var fp=Qc.default.sync(Lr.default.resolve(__dirname,"../..")),Zc=Lr.default.resolve(fp,"exports/sites");async function el(e){await cr.login();let t=e.sites.map(r=>{let{siteId:n,...i}=r;return ft(`Deploying ending call to site ${n}:`),Nr.endSiteRender(n,i)});await Promise.all(t),ft(`Build end signal sent for ${e.sites.length} site(s)`)}function hp(){return jr.default.readdirSync(Zc)}function dp(e){let t=[];for(let r of e){let n=Lr.default.resolve(Zc,r,"dist","__build-report__.json");if(!jr.default.existsSync(n)){console.log(`Build report "${n}" not found.`);continue}let i=JSON.parse(jr.default.readFileSync(n,"utf-8"));t.push(i)}return t}async function pp(){let e=hp(),t=dp(e);for(let r of t)await el(r)}pp();0&&(module.exports={buildComplete});
46
+ `))}Xc.default.config();var pi=process.env.API_URL,Ie=`${pi}/site/`,Ee={GET_ALL:`${pi}/sites/all`,GET_PAGE:[`${pi}/page/`,""],INFO:[`${Ie}`,"/all"],LANGUAGES:[`${Ie}`,"/languages"],BUILD_START:[`${Ie}`,"/build/start"],BUILD_END:[`${Ie}`,"/build/end"],GET_DISTRIBUTOR_DATA:[`${Ie}`,"/distributor"],GET_SITEMAP:[`${Ie}`,"/sitemap"],SOCIALS:[`${Ie}`,"/socials"],GET_PAGES:[`${Ie}`,"/pages?pagination=false"]},Nr=class{static async getAll(){let{GET_ALL:t}=Ee;return await Te({endpoint:t})}static async getPage(t,r){let{GET_PAGE:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}static async getInfo(t,r=""){let{INFO:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}static async getLanguages(t,r=""){let{LANGUAGES:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}static async startSiteRender(t){let{BUILD_START:[r,n]}=Ee;return await Te({endpoint:`${r}${t}${n}`})}static async endSiteRender(t,r){let{BUILD_END:[n,i]}=Ee;return await di({endpoint:`${n}${t}${i}`,body:r})}static async getDistributorData(t,r,n,i,s){let{GET_DISTRIBUTOR_DATA:[o,a]}=Ee,u=i||t.site,d=s||t.language;return await di({endpoint:`${o}${u}${a}`,body:r,headers:{lang:d},cacheKey:n})}static async getSitemap(t){let{GET_SITEMAP:[r,n]}=Ee;return await Te({endpoint:`${r}${t}${n}`})}static async getSocials(t,r=""){let{SOCIALS:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}};var fp=Qc.default.sync(Lr.default.resolve(__dirname,"../..")),Zc=Lr.default.resolve(fp,"exports/sites");async function el(e){await cr.login();let t=e.sites.map(r=>{let{siteId:n,...i}=r;return ft(`Deploying ending call to site ${n}:`),Nr.endSiteRender(n,i)});await Promise.all(t),ft(`Build end signal sent for ${e.sites.length} site(s)`)}function hp(){return jr.default.readdirSync(Zc)}function dp(e){let t=[];for(let r of e){let n=Lr.default.resolve(Zc,r,"dist","__build-report__.json");if(!jr.default.existsSync(n)){console.log(`Build report "${n}" not found.`);continue}let i=JSON.parse(jr.default.readFileSync(n,"utf-8"));t.push(i)}return t}async function pp(){let e=hp(),t=dp(e);for(let r of t)await el(r)}pp();0&&(module.exports={buildComplete});
package/build/index.js CHANGED
@@ -25,7 +25,7 @@ GFS4: `),console.error(e)});z[Z]||(ws=global[Z]||[],xs(z,ws),z.close=function(e)
25
25
  \u2502 Access credentials failure \u2502
26
26
  \u2502 Check that the login details are correct in your .env file \u2502
27
27
  \u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F
28
- `)),process.exit(1)}}},Ar=new Kn;var el=K(Yn()),tl=K(gt()),rl=K(Gt());var yp=K(gt()),Vu=K(Gt()),gp=K(gn()),Yu=K(Wu());var Ju="10.2.11";Vu.default.config();var vp=!!process.env.GRIDDO_BUILD_LOGS&&!!JSON.parse(process.env.GRIDDO_BUILD_LOGS)||!!process.env.LOGS&&!!JSON.parse(process.env.LOGS);function Ku(e){let t=e.length,r=e.length+2,n=" ".repeat(Math.floor((r-t)/2)),i=`\u256D${"\u2500".repeat(r)}\u256E
28
+ `)),process.exit(1)}}},Ar=new Kn;var el=K(Yn()),tl=K(gt()),rl=K(Gt());var yp=K(gt()),Vu=K(Gt()),gp=K(gn()),Yu=K(Wu());var Ju="10.2.13";Vu.default.config();var vp=!!process.env.GRIDDO_BUILD_LOGS&&!!JSON.parse(process.env.GRIDDO_BUILD_LOGS)||!!process.env.LOGS&&!!JSON.parse(process.env.LOGS);function Ku(e){let t=e.length,r=e.length+2,n=" ".repeat(Math.floor((r-t)/2)),i=`\u256D${"\u2500".repeat(r)}\u256E
29
29
  `,s=`
30
30
  \u2570${"\u2500".repeat(r)}\u256F`,o=`\u2502${n}${e}${n}\u2502`;console.log(`${i}${o}${s}`)}function fi(e){vp&&console.info(e.replace(/(\s)\s+/g,"$1"))}function Xu(e){return new Promise(t=>setTimeout(t,e))}function Dr(e,t=3){return(e/1e3).toFixed(t)}function hi(e){return"site"in e&&e.site?e?.site:void 0}function di(...e){let t=performance.now();return e.forEach(r=>r()),Dr(performance.now()-t)}function Qu(){let e=`
31
31
  \xB7\xB7
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": "10.2.11",
4
+ "version": "10.2.13",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Diego M. Béjar <diego.bejar@secuoyas.com>",
@@ -68,7 +68,7 @@
68
68
  "react-helmet": "^6.0.0"
69
69
  },
70
70
  "devDependencies": {
71
- "@griddo/eslint-config-back": "^10.2.11",
71
+ "@griddo/eslint-config-back": "^10.2.13",
72
72
  "@types/babel__core": "^7.20.0",
73
73
  "@types/babel__preset-env": "^7.9.2",
74
74
  "@types/csvtojson": "^2.0.0",
@@ -116,5 +116,5 @@
116
116
  "publishConfig": {
117
117
  "access": "public"
118
118
  },
119
- "gitHead": "fadf0b0c9ced3461dea8670ad2df493d5cbf754a"
119
+ "gitHead": "f1f00452bac5e4e6342947c1903ced3e2b5a309c"
120
120
  }
@@ -87,6 +87,7 @@ class DistributorService {
87
87
  component: { data },
88
88
  cacheKey,
89
89
  } = props;
90
+ const { site, lang } = data;
90
91
 
91
92
  // Distrubutor with `hasDistributorDat: true` but without `data` prop
92
93
  if (!data) {
@@ -101,7 +102,9 @@ class DistributorService {
101
102
  const response = await SitesService.getDistributorData(
102
103
  page,
103
104
  body,
104
- cacheKey
105
+ cacheKey,
106
+ site,
107
+ lang
105
108
  );
106
109
 
107
110
  return response;
@@ -128,14 +128,19 @@ class SitesService {
128
128
  static async getDistributorData(
129
129
  page: Core.Page,
130
130
  body: DistributorBody,
131
- cacheKey: string
131
+ cacheKey: string,
132
+ dataSiteId?: number,
133
+ dataLangID?: number
132
134
  ) {
133
135
  const {
134
136
  GET_DISTRIBUTOR_DATA: [prefix, suffix],
135
137
  } = ENDPOINTS;
136
- const { language: lang, site: id } = page;
138
+
139
+ const site = dataSiteId || page.site;
140
+ const lang = dataLangID || page.language;
141
+
137
142
  const response = await post<DistributorResponse>({
138
- endpoint: `${prefix}${id}${suffix}`,
143
+ endpoint: `${prefix}${site}${suffix}`,
139
144
  body,
140
145
  headers: { lang },
141
146
  cacheKey,