@arcteryx/js-cms
Advanced tools
Comparing version 1.27.18 to 1.27.19
@@ -6,2 +6,10 @@ # Change Log | ||
## [1.27.19](https://bitbucket.org/arcteryx/arcteryx-js-helpers/compare/@arcteryx/js-cms@1.27.18...@arcteryx/js-cms@1.27.19) (2020-10-20) | ||
**Note:** Version bump only for package @arcteryx/js-cms | ||
## [1.27.18](https://bitbucket.org/arcteryx/arcteryx-js-helpers/compare/@arcteryx/js-cms@1.27.17...@arcteryx/js-cms@1.27.18) (2020-10-17) | ||
@@ -8,0 +16,0 @@ |
@@ -128,2 +128,6 @@ 'use strict'; | ||
if (!Array.isArray(json.data)) { | ||
json.data = new Array(json.data); | ||
} | ||
return (_json$data = json.data) === null || _json$data === void 0 ? void 0 : _json$data.map(label => flattenCMSJson(label, json.included)); | ||
@@ -297,3 +301,3 @@ }).catch(e => { | ||
if (catIntroId === null) { | ||
if (catIntroId === null || !catIntroId) { | ||
catIntroId = await getCategoryIntroId(cmsUrl, market, null, language, path); | ||
@@ -353,4 +357,4 @@ } | ||
const catIntros = await Promise.all(requestUrls.map(url => getDrupalData(url, fetchOptions))).then(json => json); | ||
const catIntrosNoEmpties = catIntros.filter(catIntro => catIntro.length); | ||
return catIntrosNoEmpties[catIntrosNoEmpties.length - 1]; | ||
const catIntrosNoEmpties = catIntros.filter(catIntro => catIntro === null || catIntro === void 0 ? void 0 : catIntro.length); | ||
return catIntrosNoEmpties[(catIntrosNoEmpties === null || catIntrosNoEmpties === void 0 ? void 0 : catIntrosNoEmpties.length) - 1]; | ||
} catch (e) { | ||
@@ -357,0 +361,0 @@ console.error(e); |
@@ -124,2 +124,6 @@ /** | ||
if (!Array.isArray(json.data)) { | ||
json.data = new Array(json.data); | ||
} | ||
return (_json$data = json.data) === null || _json$data === void 0 ? void 0 : _json$data.map(label => flattenCMSJson(label, json.included)); | ||
@@ -293,3 +297,3 @@ }).catch(e => { | ||
if (catIntroId === null) { | ||
if (catIntroId === null || !catIntroId) { | ||
catIntroId = await getCategoryIntroId(cmsUrl, market, null, language, path); | ||
@@ -349,4 +353,4 @@ } | ||
const catIntros = await Promise.all(requestUrls.map(url => getDrupalData(url, fetchOptions))).then(json => json); | ||
const catIntrosNoEmpties = catIntros.filter(catIntro => catIntro.length); | ||
return catIntrosNoEmpties[catIntrosNoEmpties.length - 1]; | ||
const catIntrosNoEmpties = catIntros.filter(catIntro => catIntro === null || catIntro === void 0 ? void 0 : catIntro.length); | ||
return catIntrosNoEmpties[(catIntrosNoEmpties === null || catIntrosNoEmpties === void 0 ? void 0 : catIntrosNoEmpties.length) - 1]; | ||
} catch (e) { | ||
@@ -353,0 +357,0 @@ console.error(e); |
@@ -135,2 +135,6 @@ (function (global, factory) { | ||
if (!Array.isArray(json.data)) { | ||
json.data = new Array(json.data); | ||
} | ||
return (_json$data = json.data) === null || _json$data === void 0 ? void 0 : _json$data.map(label => flattenCMSJson(label, json.included)); | ||
@@ -304,3 +308,3 @@ }).catch(e => { | ||
if (catIntroId === null) { | ||
if (catIntroId === null || !catIntroId) { | ||
catIntroId = await getCategoryIntroId(cmsUrl, market, null, language, path); | ||
@@ -360,4 +364,4 @@ } | ||
const catIntros = await Promise.all(requestUrls.map(url => getDrupalData(url, fetchOptions))).then(json => json); | ||
const catIntrosNoEmpties = catIntros.filter(catIntro => catIntro.length); | ||
return catIntrosNoEmpties[catIntrosNoEmpties.length - 1]; | ||
const catIntrosNoEmpties = catIntros.filter(catIntro => catIntro === null || catIntro === void 0 ? void 0 : catIntro.length); | ||
return catIntrosNoEmpties[(catIntrosNoEmpties === null || catIntrosNoEmpties === void 0 ? void 0 : catIntrosNoEmpties.length) - 1]; | ||
} catch (e) { | ||
@@ -364,0 +368,0 @@ console.error(e); |
{ | ||
"name": "@arcteryx/js-cms", | ||
"version": "1.27.18", | ||
"version": "1.27.19", | ||
"source": "src/index.js", | ||
@@ -32,3 +32,3 @@ "main": "dist/cjs/index.js", | ||
"license": "ISC", | ||
"gitHead": "ff50d273211ce6c137388e2bc4a388e211145bbe", | ||
"gitHead": "9f3012fc7c4eb95b1def6afc86331852ef69e606", | ||
"files": [ | ||
@@ -35,0 +35,0 @@ "dist", |
@@ -107,3 +107,8 @@ import { toQueryParams } from "@arcteryx/js-url"; | ||
.then(resp => resp.json()) | ||
.then(json => json.data?.map(label => flattenCMSJson(label, json.included))) | ||
.then(json => { | ||
if (!Array.isArray(json.data)) { | ||
json.data = new Array(json.data); | ||
} | ||
return json.data?.map(label => flattenCMSJson(label, json.included)); | ||
}) | ||
.catch(e => { | ||
@@ -275,3 +280,3 @@ console.error(e.message); | ||
// If No catIntroId found with country filter, then try to find with no country set in CMS | ||
if (catIntroId === null) { | ||
if (catIntroId === null || !catIntroId) { | ||
catIntroId = await getCategoryIntroId(cmsUrl, market, null, language, path); | ||
@@ -298,3 +303,2 @@ } | ||
const catIntroPaths = getCategoryIntroPaths(market, path); | ||
const cmsApi = await getCmsApiForCategoryIntro(cmsUrl, market, country, language, path, previewDraft); | ||
@@ -348,4 +352,4 @@ | ||
const catIntros = await Promise.all(requestUrls.map(url => getDrupalData(url, fetchOptions))).then(json => json); | ||
const catIntrosNoEmpties = catIntros.filter(catIntro => catIntro.length); | ||
return catIntrosNoEmpties[catIntrosNoEmpties.length - 1]; | ||
const catIntrosNoEmpties = catIntros.filter(catIntro => catIntro?.length); | ||
return catIntrosNoEmpties[catIntrosNoEmpties?.length - 1]; | ||
} catch (e) { | ||
@@ -352,0 +356,0 @@ console.error(e); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
159870
1321