@movable/behavioral-app
Advanced tools
Comparing version 1.0.7 to 1.1.0
@@ -60,2 +60,3 @@ import CD from "cropduster"; | ||
this.options.item = item; | ||
// Be sure to update extraData as necessary, if adding logic to modify the items returned by watson | ||
this.options.extraData = extraData; | ||
@@ -70,8 +71,5 @@ | ||
render() { | ||
// Additional business logic, like sorting or filtering, can be added as a new Promise | ||
this.verifyOptions() | ||
.then(() => this.getItemsByType()) | ||
.then(payload => this.makeCall(payload)) | ||
.then(raw => { | ||
parseData(raw) { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
let { data, status, contentType, response } = raw; // eslint-disable-line | ||
@@ -87,9 +85,24 @@ | ||
const $doc = $(data); | ||
// Rendering code goes here | ||
const imageUrl = $doc.find('').eq(0).attr('data-src'); | ||
// Cropping code goes here | ||
const tagContent = { | ||
mi_item_title: $doc.find('').text().trim(), | ||
mi_item_price: $doc.find('').text().trim() | ||
mi_item_price: $doc.find('').text().trim(), | ||
imageUrl: $doc.find('').eq(0).attr('data-src') | ||
}; | ||
resolve(tagContent); | ||
} catch (error) { | ||
reject(error); | ||
} | ||
}); | ||
} | ||
render() { | ||
// Additional business logic, like sorting or filtering, can be added as a new Promise | ||
this.verifyOptions() | ||
.then(() => this.getItemsByType()) | ||
.then(payload => this.makeCall(payload)) | ||
.then(raw => this.parseData(raw)) | ||
.then(tagContent => { | ||
CD.setExtraData(this.options.extraData); | ||
@@ -99,6 +112,7 @@ CD.setClickthrough(this.options.item.u); | ||
$('.itemImage img').attr('src', imageUrl); | ||
$('.itemImage img').attr('src', tagContent.imageUrl); | ||
this.autoresizeTags(); | ||
this.waitForImageAssets(); | ||
window.APP_SUCCESSFULLY_RENDERED = true; | ||
@@ -105,0 +119,0 @@ }) |
{ | ||
"name": "@movable/behavioral-app", | ||
"version": "1.0.7", | ||
"version": "1.1.0", | ||
"description": "Movable CLI blueprint for initializing a new behavioral application.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
99507
476