@kasko/fe-toolbelt
Advanced tools
Comparing version 2.0.1-beta.21 to 2.0.1-beta.22
{ | ||
"license": "UNLICENSED", | ||
"name": "@kasko/fe-toolbelt", | ||
"version": "2.0.1-beta.21", | ||
"version": "2.0.1-beta.22", | ||
"engines": { | ||
@@ -6,0 +6,0 @@ "node": ">=8.11.x" |
@@ -10,20 +10,13 @@ const axios = require('../../axios'); | ||
const url = `${kaskoConfig.feApiUrl}/touchpoints/${kaskoConfig.touchpointId}/items/${item.id}`; | ||
const { data } = await axios.get(url, { | ||
params: { | ||
language: kaskoConfig.language, | ||
key: kaskoConfig.publicKey, | ||
}, | ||
}) | ||
.catch((error) => { | ||
throw error; | ||
}); | ||
let data; | ||
try { | ||
data = await axios.get(url, { | ||
params: { | ||
language: kaskoConfig.language, | ||
key: kaskoConfig.publicKey, | ||
}, | ||
}) | ||
.catch((error) => { | ||
// throw error; | ||
throw new Error('ERROR 6'); | ||
}); | ||
} catch (e) { | ||
throw new Error('ERROR 5'); | ||
} | ||
if (!data.data) { | ||
if (!data) { | ||
throw new Error('No item data'); | ||
@@ -33,7 +26,7 @@ } | ||
return { | ||
id: data.data.id, | ||
name: data.data.content.item_title || data.data.id, | ||
contents: data.data.content.data || {}, | ||
fields: data.data.field_definition || [], | ||
manifest: data.data.webapp_manifest || {}, | ||
id: data.id, | ||
name: data.content.item_title || data.id, | ||
contents: data.content.data || {}, | ||
fields: data.field_definition || [], | ||
manifest: data.webapp_manifest || {}, | ||
}; | ||
@@ -40,0 +33,0 @@ } |
@@ -15,19 +15,13 @@ const axios = require('../../axios'); | ||
const url = `${kaskoConfig.feApiUrl}/touchpoints/${kaskoConfig.touchpointId}`; | ||
let data; | ||
try { | ||
data = await axios.get(url, { | ||
params: { | ||
language: kaskoConfig.language, | ||
key: kaskoConfig.publicKey, | ||
}, | ||
}) | ||
.catch((error) => { | ||
// throw error; | ||
throw new Error('ERROR 4'); | ||
}); | ||
} catch (e) { | ||
throw new Error('ERROR 3'); | ||
} | ||
const { data } = await axios.get(url, { | ||
params: { | ||
language: kaskoConfig.language, | ||
key: kaskoConfig.publicKey, | ||
}, | ||
}) | ||
.catch((error) => { | ||
throw error; | ||
}); | ||
if (!data.data) { | ||
if (!data) { | ||
throw new Error('No touchpoint data'); | ||
@@ -37,7 +31,7 @@ } | ||
return { | ||
id: data.data.id || kaskoConfig.touchpointId, | ||
productName: data.data.title, | ||
contents: data.data.content.data || {}, | ||
items: data.data.items || [], | ||
manifest: data.data.webapp_manifest || {}, | ||
id: data.id || kaskoConfig.touchpointId, | ||
productName: data.title, | ||
contents: data.content.data || {}, | ||
items: data.items || [], | ||
manifest: data.webapp_manifest || {}, | ||
}; | ||
@@ -44,0 +38,0 @@ } |
@@ -1,4 +0,3 @@ | ||
// const axios = require('../../axios'); | ||
// const fetch = require('node-fetch'); | ||
const { default: fetch } = require('node-fetch'); | ||
const axios = require('../../axios'); | ||
// const { default: fetch } = require('node-fetch'); | ||
@@ -14,11 +13,18 @@ const getProduct = require('./getProduct'); | ||
async function getWebappData(url) { | ||
let data; | ||
try { | ||
const urlTest = 'https://apps.eu1.kaskocloud.com/pk_test_YjelaXzVMPGEDp8PePy2LxRq1rKd5Qmo/tp_256da351104839a521980c1937aa3'; | ||
const response = await fetch(urlTest); | ||
data = await response.text(); | ||
} catch (e) { | ||
throw new Error(`ERROR 1: ${e.message}, ${JSON.stringify(process.env)}`); | ||
} | ||
// let data; | ||
// try { | ||
// const urlTest = 'https://apps.eu1.kaskocloud.com/pk_test_YjelaXzVMPGEDp8PePy2LxRq1rKd5Qmo/tp_256da351104839a521980c1937aa3'; | ||
// const response = await fetch(urlTest); | ||
// data = await response.text(); | ||
// } catch (e) { | ||
// throw new Error(`ERROR 1: ${e.message}, ${JSON.stringify(process.env)}`); | ||
// } | ||
const urlTest = 'https://apps.eu1.kaskocloud.com/pk_test_YjelaXzVMPGEDp8PePy2LxRq1rKd5Qmo/tp_256da351104839a521980c1937aa3'; | ||
// const { data } = await axios.get(url) | ||
const { data } = await axios.get(urlTest) | ||
.catch((error) => { | ||
throw error; | ||
}); | ||
if (typeof data !== 'string' || !data) { | ||
@@ -25,0 +31,0 @@ throw new Error('Webapp couldn\'t be loaded'); |
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
19
0
72579
61
1806