Overskrifter
H1
H2
H3
H4
H5
H6
2
1
7
22
13
0
[H1]
[H1] AkongCuan • Portal Agen Slot Gacor Dengan Minimal Deposit 5000
[H2] Pertanyaan Seputar AKONGCUAN
[H3] RECENT SEARCH
[H3] YOU MAY ALSO LIKE
[H3] customize your flower board
[H3] Complete Your Order
[H3] ${data?.song}
[H3] '}${data?.artist ? `${data?.artist}` : ''}`
// console.log(html)
$(".spotifyAddons").append(html)
$(`[data-index=${idx}]`).show()
if (preLink !== '') {
$(".btn-action .btn").attr("disabled", false)
} else {
$(".btn-action .btn").attr("disabled", true)
}
return html
}
$(".spotifyLinkFirst").keyup(async function(){
const v = $(this).val()
if(v.includes('spotify:user:spotify')) {
const correct = v.split('user:spotify:')[1]
console.log(correct, 'BNER')
$(this).val(correct)
return
}
if(v.includes("spotify:") || v.includes("https://open.spotify.com/")){
const data = await trackUrl(v)
if(!data || !data.status) {
$(this).parent().addClass("error")
// $(this).parent().append(`Make sure you copy the complete and correct link from Spotify. Ex: https://open.spotify.com/track/0C3xZJueyBvvMSsl0cETA6`)
$("#personalizeBtnSpotify .btn").attr("disabled", true)
return
}
$(this).parent().removeClass("error")
// $(this).parent().remove("txt-error")
$("#personalizeBtnSpotify .btn").attr("disabled", false)
} else {
$("#personalizeBtnSpotify .btn").attr("disabled", true)
}
})
$(".purchaseAddon").delegate(".next-addon", "click", function(){
const parent = $(this).parents(".purchaseAddon")
const next = parent.next(".sectionPurchase")
if(next.hasClass("purchaseAddress")) {
if(productType !== '') {
console.log("clarity event " + productType + ' purchaseDelivery')
window.clarity("event", `${productType} purchaseDelivery`)
// window.clarity("set", productType, `purchaseDelivery - ${productDate}`)
}
}
const data = $("#itemAddons").find(".selected")
const length = $(".quantity-cart-46067682607319").val()
const checked = data.length;
if(checked > 0) {
if(length > 0) {
$(".purchaseAddon").addClass("purchaseAddonSpotify")
customSpotify(1, length, 'addon')
} else {
listAddon()
}
} else {
parent.addClass("hide")
next.removeClass("hide")
}
})
$("#personalizeBtnSpotify .btn").click(async function(){
const isCity = $("#cities[required]")
const isDate = $("#propDeliveryDate[required]")
if((isDate.length > 0 && isCity.length > 0) && (isCity.val() === '' || isDate.val() === '')) {
alert('Please choose Delivery City & Delivery Date')
return
}
const data = await customSpotify(1, 1, 'product')
if(data) {
$("#backgroundPopup").fadeIn("slow");
$(".purchasePopupSpotify").fadeIn("slow");
if(productType !== '') {
console.log("clarity event " + productType + ' spotify')
window.clarity("event", `${productType} spotify`)
// window.clarity("set", productType, `purchaseDelivery - ${productDate}`)
}
}
})
function formatBytes(bytes, decimals = 2) {
if (!+bytes) return '0 Bytes'
const k = 1024
const dm = decimals < 0 ? 0 : decimals
const sizes = ['B', 'KB', 'MB']
const i = Math.floor(Math.log(bytes) / Math.log(k))
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`
}
async function trackUrl(link){
try {
let trackId = link.split('/').pop().split('?')[0];
let type = ''
if(link.includes("spotify:")) {
const uri = link.split('spotify:')[1]
trackId = uri.split(':')[1]
type = uri.split(':')[0] + 's'
} else {
if(link.match('track')){
type = 'tracks'
} else if(link.match('playlist')) {
type = 'playlists'
} else if(link.match('artist')) {
type = 'artists'
} else if(link.match('album')) {
type = 'albums'
}
}
console.log(`${host}/api/spotify/${type}/${trackId}`)
const data = await getFetch(`${host}/api/spotify/${type}/${trackId}`)
console.log(data, 'DATA')
const song = data?.data?.name
const artist = data?.data?.artist
return {
song, artist, type, trackId, status: data.status
}
} catch(err) {
console.log(err)
}
}
$(".spotifyAddons").delegate(".uploadPhotoSpotify", "change", async function(){
const parent = $(this).parents("[data-index]")
const preview = parent.find(".previewImage")
const file = $(this)[0].files[0];
if (file) {
const reader = new FileReader();
reader.onload = async function(e) {
parent.find(".uploadResult label").hide()
parent.find(".uploadedResult").remove()
parent.find(".uploadResult").append(`
${file.name} (${formatBytes(file.size)}) is uploaded
Change
`)
parent.find(".frameImageUploaded svg").hide()
parent.find(".frameImage").addClass("uploaded")
preview.attr("src", e.target.result);
preview.show();
let formData = new FormData();
formData.append("file", file);
const response = await fetch(`${host}/api/upload?name=${file.name}&type=image/jpeg&r=${Date.parse(new Date)}`, {
method: "POST",
body: formData
})
const result = await response.json();
if(result){
parent.find(".resultPhotoSpotify").val(result.url)
}
}
reader.readAsDataURL(file);
} else {
preview.hide();
}
});
$(".spotifyAddons").delegate(".uploadResult", "click", function(){
$(this).next("input[type=file]").trigger("click")
})
$(".spotifyAddons").delegate(".changeUpload", "click", function(){
$(this).parents("input[type=file]").trigger("click")
})
$(".spotifyAddons").delegate(".removeUpload", "click", function(){
const parent = $(this).parents("[data-index]")
parent.find(".uploadPhotoSpotify").val("")
parent.find(".uploadResult label").show()
parent.find(".uploadedResult").remove()
parent.find(".frameImageUploaded svg").show()
parent.find(".previewImage").hide()
parent.find(".frameImage").removeClass("uploaded")
})
$(".spotifyAddons").delegate("label.checkbox", "click", function(){
const parent = $(this).parents("[data-index]")
parent.toggleClass("checked")
})
$(".spotifyAddons").delegate(".spotifyLink", "change", async function(){
const parent = $(this).parents("[data-index]")
const link = $(this).val()
const data = await trackUrl(link)
console.log(data)
if(data.song) {
parent.find(".spotifySong").val(data.song)
parent.find(".spotifyData").find("h3").text(data.song)
}
if(data.artist) {
parent.find(".spotifyArtist").val(data.artist)
parent.find(".spotifyData").find("p").text(data.artist)
}
parent.find(".spotifyCode img").attr("src", `https://scannables.scdn.co/uri/plain/png/FFFFFF/black/640/spotify:${data.type.slice(0, -1)}:${data.trackId}`)
// https://scannables.scdn.co/uri/plain/png/FFFFFF/black/640/spotify:track:1er51HCEBhIAtoEemKuC3M
if (data.status === true) {
parent.find(".btn-action .btn").attr("disabled", false)
} else {
parent.find(".btn-action .btn").attr("disabled", true)
}
})
$(".spotifyAddons").delegate(".spotifySong", "keyup", async function(){
const parent = $(this).parents("[data-index]")
const v = $(this).val()
parent.find(".spotifyData h3").text(v)
})
$(".spotifyAddons").delegate(".spotifyArtist", "keyup", async function(){
const parent = $(this).parents("[data-index]")
const v = $(this).val()
parent.find(".spotifyData p").text(v)
})
$(".spotifyAddons").delegate(".btn-action .btn:not(.no-addon)", "click", async function(){
const parent = $(this).parents("[data-index]")
const length = parent.data("length")
const index = parent.data("index")
const indexNext = Number(index) + 1
customSpotify(indexNext, length, 'addon')
})
$(".spotifyAddons").delegate(".btn-action .btn.finished", "click", async function(){
const parent = $(this).parents(".purchaseAddon")
const next = parent.next(".sectionPurchase")
parent.addClass("hide")
next.removeClass("hide")
next.find(".purchase-button").show()
listAddon()
})
$(".spotifyAddons").delegate(".back-spotify", "click", async function(){
const t = $(this).parents("[data-index]")
const parent = $(this).parents(".sectionPurchase")
const current = t.data("index")
const prevCurrent = Number(current) - 1
if(current == 1) {
parent.removeClass("purchaseAddonSpotify")
parent.find(".purchase-button").show()
parent.find(".headerPurchase h3").text("Make It More Special with Add-Ons!")
$(".spotifyAddons").empty()
$(".regulerAddons").show()
return
}
t.hide()
t.prev("[data-index]").show()
t.remove()
parent.find(".headerPurchase h3").text(`personalize spotify photo print - ${prevCurrent}`)
})
$("#personalizeBtn .btn").click(async function() {
loadPopupPersonalize()
});
$(".sectionPurchaseSpotify").delegate(".btn[data-type=card]", "click", function(){
$(".sectionPurchaseSpotify").hide()
loadPopupPersonalize()
})
$(".close-purchase-popup").click(function() {
disablePopup();
});
$("#backgroundPopup").click(function() {
// disablePopup();
});
$("#popupCart .close-purchase-popup").click(function() {
location.reload()
});
$('#popupCart').on('hide.bs.modal', function (e) {
location.reload()
})
$(".next-card").click(function(){
const parent = $(this).parents(".sectionPurchase")
const next = parent.next(".sectionPurchase")
parent.addClass("hide")
next.removeClass("hide")
})
$(".back-purchase-button").click(function(){
const parent = $(this).parents(".sectionPurchase")
const prev = parent.prev(".sectionPurchase")
parent.addClass("hide")
prev.removeClass("hide")
})
$(document).keypress(function(e) {
if (e.keyCode == 27 && popupStatus == 1) {
disablePopup();
}
});
const parentImg = $(".case-img-preview")
const parentVid = $(".case-video-preview")
function readURL(input) {
if (input.files && input.files[0]) {
let reader = new FileReader();
let type = 'image/jpeg'
const size = input.files[0].size
if(input.files[0].type.match('video/')){
type = 'video/mp4'
if(size > 15728640) {
alert('File size exceeds maximum limit 15 MB')
return
}
} else {
if(size > 5242880) {
alert('File size exceeds maximum limit 5 MB')
return
}
}
reader.onload = function (e) {
$(".nextBtn").attr("disabled", true)
if(type === 'image/jpeg') {
$('.placeholder-image').hide();
$('.preview-image').show()
$('.preview-image').attr('src', e.target.result);
} else {
// parentVid.find(".ajax-loader").show();
$(".steps-card-preview").addClass("loading")
}
}
reader.readAsDataURL(input.files[0]);
}
}
async function readURLPapan(input) {
if (input.files && input.files[0]) {
let reader = new FileReader();
reader.onload = function (e) {
$('.btn-upload-papan').siblings('label').hide();
$('.btn-upload-papan img').attr('src', e.target.result);
$('.btn-upload-papan img').show();
$('.svgLogoPapan').hide();
}
const type = 'image/jpeg'
const name = `logo-8144957800663-${Date.parse(new Date())}`
let formData = new FormData();
formData.append("file", input.files[0]);
const response = await fetch(`${host}/api/upload?name=${name}&type=${type}&r=${randomString(3, '0123456789')}`, {
method: "POST",
body: formData
})
const result = await response.json();
if(result) {
const url = result.url
$("[data-properties=papan-logo]").val(url)
}
reader.readAsDataURL(input.files[0]);
}
}
async function readURLAddress(input) {
console.log(input, 'readURLAddress')
if (input.files && input.files[0]) {
let reader = new FileReader();
reader.onload = function (e) {
$('.photo-address').attr('src', e.target.result);
$('.photo-address').show();
}
const type = 'image/jpeg'
const name = input.files[0].name?.split('.')[0]
let formData = new FormData();
formData.append("file", input.files[0]);
const response = await fetch(`${host}/api/upload?name=${name}&type=${type}&r=${randomString(3, '0123456789')}`, {
method: "POST",
body: formData
})
const result = await response.json();
reader.readAsDataURL(input.files[0]);
return result
}
}
async function addToCartUang() {
var productAddOnId1 = 42122101162199;
var productAddOnId2 = 42122101194967;
var product_id = 8144957800663
const data = {
items: [
{
quantity: $("#Quantity-" + productAddOnId1).val(),
id: productAddOnId1,
"properties": { "Time": $("#properties-time").val() }
},
{
quantity: $("#Quantity-" + productAddOnId2).val(),
id: productAddOnId2,
"properties": { "Time": $("#properties-time").val() }
}
]
}
await fetch(window.Shopify.routes.root + 'cart/add.js', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => {
console.error('Sukses Buket Uang:', response);
$(".form-flower").submit()
})
.catch((error) => {
console.error('Error Buket Uang:', error);
$(".form-flower").submit()
});
}
async function saveCard(){
let isCard = true
const kartu_penerima = $("[data-properties=penerima]").val() !== '' ? $("[data-properties=penerima]").val() : ''
const kartu_pengirim = $("[data-properties=pengirim]").val() !== '' ? $("[data-properties=pengirim]").val() : ''
const kartu_ucapan = $("[data-properties=ucapan]").val() !== '' ? $("[data-properties=ucapan]").val() : ''
const foto = $("#properties-photo").val()
const video = $("#properties-video").val()
const data = JSON.stringify({
"id": qrID,
"penerima": $("#properties-nama-penerima").val(),
"kartu_penerima": kartu_penerima,
"kartu_ucapan": kartu_ucapan,
"kartu_pengirim": kartu_pengirim,
"foto": foto,
"video": video,
"productId": "8144957800663",
"order_name": "",
"status": "Cart"
})
}
async function additem(items){
try {
let formData = items
if(items?.length) {
formData = {
'items': items
};
}
const add = await fetch(window.Shopify.routes.root + 'cart/add.js', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Requested-With':'xmlhttprequest' /* XMLHttpRequest is ok too, it's case insensitive */
},
body: JSON.stringify(formData)
})
const data = await add.json();
return data
} catch(err){
console.log('Error additem', err)
}
}
async function addons(){
let items = []
$(".addon-item").each(function(){
const p = $(this)
const props = p.next(".propsAddonSpotify")
const id = $(this).data("id")
const quantity = $(this).data("qty")
const propId = $("#properties-time").val()
let properties = {}
if(id === 46067682607319) {
const link = props.find(".spotifyLinkAddon").text()
const photo = props.find(".spotifyFotoAddon").text()
const song = props.find(".spotifySongAddon").text()
const artist = props.find(".spotifyArtistAddon").text()
properties = {
id: propId,
"Spotify Link": link !== '' ? link : '-',
"Spotify Photo": photo !== '' ? photo : '-',
"Spotify Song": song !== '' ? song : '-',
"Spotify Artist": artist !== '' ? artist : '-',
type: 'addon'
}
} else {
properties = {
"id": propId,
"type": "addon"
}
}
items.push({
id,
quantity,
properties
})
})
return items
}
async function propItems() {
let props = {}
$("[data-properties]").each(function(e){
let elementType = this.tagName;
const k = $(this).data("properties")
if(k !== 'penerima' && k !== 'ucapan' && k !== 'pengirim' && k !== 'nama-penerima' && k !== 'alamat-penerima' && k !== 'telepon-penerima' && k !== 'company' && k !== 'province' && k !== 'foto-alamat' && k !== 'papan-logo') {
const v = elementType === 'SELECT' ? $(this).find(":selected").val() : $(this).val();
if(v !== '') {
props[k] = v?.replace(/[\s\n]/g, '');
}
}
})
return props
}
async function showPopupCart(items){
if(productType !== '') {
console.log("clarity event " + productType + ' completeOrder')
window.clarity("event", `${productType} completeOrder`)
// window.clarity("set", productType, `completeOrder - ${productDate}`)
}
$("#popupCart").show()
$(".propDeliveryCity").text($("#cities").val())
$(".propDeliveryDate").text($("#propDeliveryDate").val())
$(".propDeliveryTime").text($("#propDeliveryTime").val())
$(".propDeliveryName").text($("[data-properties=nama-penerima]").val())
$(".propDeliveryAddress").text($("[data-properties=alamat-penerima]").val())
$(".propDeliveryPhone").text($("[data-properties=telepon-penerima]").val())
$(".propDeliveryProv").text($("#province").val())
$(".propDeliveryZip").text($("#zip").val())
const addons = []
if(items && items.length > 0) {
for(let i = 1; i < items.length; i++) {
const spotifyLink = items[i].properties['Spotify Link']
const spotifyPhoto = items[i].properties['Spotify Photo']
const spotifySong = items[i].properties['Spotify Song']
const spotifyArtist = items[i].properties['Spotify Artist']
const price = items[i].price / 100
const props = spotifyLink ? `
spotify link
${spotifyLink}
Upload Photo
${spotifyPhoto}
song / playlist name
${spotifySong}
artist name
${spotifyArtist}
` : '';
addons.push(`
${items[i].title}
[H3] {{{totalPrice}}}
[H4] Rp 348.000
[H4] Rp 588.000
[H4] Rp 788.000
[H4] Rp 988.000
[H4] Rp 285.000
[H4] Rp 235.000
[H4] Rp 285.000
[H4] Rp 285.000
[H4] Rp 285.000
[H4] Rp 285.000
[H4] Drag & Drop Photo file or Browse
[H4] WAKTUNYA DAFTAR AKUN BARU DI SITUS SLOT - AKONGCUAN!
[H4] Ciptakan Kemenanganmu Dengan Atur Tanggal Bermain SLOT
[H4] SEO AKongCuan.
[H4] recipient delivery address
[H4] how you want to input your address
[H4] add-ons
[H4] delivery option detail
[H4] delivery option detail
[H4] add-ons (0)
[H4] upload photo
[H4] Add your Spotify link here
[H5] Mid Autumn of Love Mooncake
[H5] Mid Autumn of Joy Mooncake
[H5] Mid Autumn of Fortune Mooncake
[H5] Mid Autumn Festival Mooncake
[H5] The Jade Bouquet
[H5] The Selena Bouquet
[H5] The Viola Bouquet
[H5] The Minerva Bouquet
[H5] Congraduations Bouquet
[H5] Grad & Gorgeous Bouquet
[H5] ${title}
[H5] ${title}
[H5] Send without a greeting card
Udvid
Minimer