(function(){
window.tampilkanSocialProof = function(data, position = "bottom") {
let index = 0;
const box = document.createElement("div");
box.style.position = "fixed";
box.style[`${position}`] = "20px";
box.style.left = "20px";
box.style.background = "#fff";
box.style.border = "1px solid #ddd";
box.style.padding = "10px";
box.style.borderRadius = "8px";
box.style.boxShadow = "0 2px 8px rgba(0,0,0,0.2)";
box.style.fontFamily = "Arial, sans-serif";
box.style.fontSize = "14px";
box.style.zIndex = "9999";
box.style.display = "flex";
box.style.alignItems = "center";
box.style.maxWidth = "300px";
box.style.transition = "opacity 0.5s ease";
document.body.appendChild(box);
function tampilkanBerikutnya() {
if (index >= data.length) index = 0;
const item = data[index++];
const waktu = formatTimeAgo(item.timestamp);
box.innerHTML = `
${item.text}
${waktu}
`;
box.style.opacity = "1";
setTimeout(() => box.style.opacity = "0", 6000);
setTimeout(tampilkanBerikutnya, 8000);
}
function maskNama(nama) {
return nama.length > 3 ? nama.substring(0, 3) + '****' : nama;
}
function formatTimeAgo(timestamp) {
const now = Math.floor(Date.now() / 1000);
const diff = now - timestamp;
if (diff < 60) return "baru saja";
if (diff < 3600) return `${Math.floor(diff / 60)} menit lalu`;
if (diff < 86400) return `${Math.floor(diff / 3600)} jam lalu`;
return `${Math.floor(diff / 86400)} hari lalu`;
}
tampilkanBerikutnya();
};
window.tampilkanSocialProof([{"nama":"QONITA","produk":"EbookGPT","foto":"https:\/\/cuanify.id\/uploads\/Foto%20Produk%20%289%29.png","text":"QONITA<\/b> telah order produk EbookGPT","timestamp":1759540962},{"nama":"Moza ","produk":"EbookGPT","foto":"https:\/\/cuanify.id\/uploads\/Foto%20Produk%20%289%29.png","text":"Moza <\/b> telah order produk EbookGPT","timestamp":1759294008},{"nama":"Titik winarti","produk":"EbookGPT","foto":"https:\/\/cuanify.id\/uploads\/Foto%20Produk%20%289%29.png","text":"Titik winarti<\/b> telah order produk EbookGPT","timestamp":1759283480},{"nama":"Eva Sari","produk":"EbookGPT","foto":"https:\/\/cuanify.id\/uploads\/Foto%20Produk%20%289%29.png","text":"Eva Sari<\/b> telah order produk EbookGPT","timestamp":1758877023},{"nama":"David ","produk":"EbookGPT","foto":"https:\/\/cuanify.id\/uploads\/Foto%20Produk%20%289%29.png","text":"David <\/b> telah order produk EbookGPT","timestamp":1758638280},{"nama":"Suyanto","produk":"EbookGPT","foto":"https:\/\/cuanify.id\/uploads\/Foto%20Produk%20%289%29.png","text":"Suyanto<\/b> telah order produk EbookGPT","timestamp":1758113703},{"nama":"Susiandri","produk":"EbookGPT","foto":"https:\/\/cuanify.id\/uploads\/Foto%20Produk%20%289%29.png","text":"Susiandri<\/b> telah order produk EbookGPT","timestamp":1757854868},{"nama":"Ramadhan Fitria","produk":"EbookGPT","foto":"https:\/\/cuanify.id\/uploads\/Foto%20Produk%20%289%29.png","text":"Ramadhan Fitria<\/b> telah order produk EbookGPT","timestamp":1756010425},{"nama":"Oche Rebbes ","produk":"EbookGPT","foto":"https:\/\/cuanify.id\/uploads\/Foto%20Produk%20%289%29.png","text":"Oche Rebbes <\/b> telah order produk EbookGPT","timestamp":1755793515},{"nama":"Srikandi Utami","produk":"EbookGPT","foto":"https:\/\/cuanify.id\/uploads\/Foto%20Produk%20%289%29.png","text":"Srikandi Utami<\/b> telah order produk EbookGPT","timestamp":1755585752}], 'bottom');
})();