${function() {
const result = data && data.result;
if (!result || !result.on_going || !result.over) {
return '';
}
const timeleftSeconds = result.diffTime / 1000;
let onGoingTitle = result.on_going.title || '';
let onGoingDesc = result.on_going.body || '';
let overTitle = result.over.title || '';
let overDesc = result.over.body || '';
if (result.hasDiscount) {
const discountElement =
result.discountType === 'discount'
? `-${result.discountPercent}%`
: `- `;
onGoingTitle = onGoingTitle.split(/\{discount\}/).map((text) => `${text}`).join(discountElement);
onGoingDesc = onGoingDesc.split(/\{discount\}/).map((text) => `${text}`).join(discountElement);
overTitle = overTitle.split(/\{discount\}/).map((text) => `${text}`).join(discountElement);
overDesc = overDesc.split(/\{discount\}/).map((text) => `${text}`).join(discountElement);
}
return `
`;
}()}
${onGoingTitle}
${onGoingDesc}
${overTitle}
${overDesc}