/*--Start--Manage All Feacture Hide Show*/ function __tagembed__manageAllFeactureHideShow() { let __tagembed__all_feacture_section = document.querySelector("#__tagembed__all_feacture_section"); let __tagembed__all_feacture_button = document.querySelector("#__tagembed__all_feacture_button"); if (__tagembed__all_feacture_section.style.display === "none") { __tagembed__all_feacture_section.style.display = "block"; __tagembed__all_feacture_button.innerHTML = "Hide All Features"; } else { __tagembed__all_feacture_section.style.display = "none"; __tagembed__all_feacture_button.innerHTML = "Show All Features"; } } /*--End--Manage All Feacture Hide Show*/ /*--Start--Manage All Feacture Hide Show*/ function __tagembed__manageSelectPlanPrice(timePeriod) { let __tagembbed__monthely_price_button = document.querySelector("#__tagembbed__monthely_price_button"); let __tagembbed__yearly_price_button = document.querySelector("#__tagembbed__yearly_price_button"); if (timePeriod == "monthely") { document.querySelectorAll('.__tagembed__yearly_plan').forEach(function (el) { el.style.display = 'none'; }); document.querySelectorAll('.__tagembed__monthely_plan').forEach(function (el) { el.style.display = 'block'; }); document.querySelectorAll('.__tagembed__selectbtn_yearly').forEach(function (el) { el.style.display = 'none'; }); document.querySelectorAll('.__tagembed__selectbtn_monthely').forEach(function (el) { el.style.display = 'block'; }); __tagembbed__monthely_price_button.classList.add("__tagembed__active"); __tagembbed__yearly_price_button.classList.remove("__tagembed__active"); } else if (timePeriod == "yearly") { document.querySelectorAll('.__tagembed__yearly_plan').forEach(function (el) { el.style.display = 'block'; }); document.querySelectorAll('.__tagembed__monthely_plan').forEach(function (el) { el.style.display = 'none'; }); document.querySelectorAll('.__tagembed__selectbtn_yearly').forEach(function (el) { el.style.display = 'block'; }); document.querySelectorAll('.__tagembed__selectbtn_monthely').forEach(function (el) { el.style.display = 'none'; }); __tagembbed__yearly_price_button.classList.add("__tagembed__active"); __tagembbed__monthely_price_button.classList.remove("__tagembed__active"); } } /*--End--Manage All Feacture Hide Show*/ /*--Start-- Get User Accounts Details*/ window.addEventListener ? window.addEventListener("load", __tagembed__get_account_details, false) : window.attachEvent && window.attachEvent("onload", __tagembed__get_account_details); function __tagembed__get_account_details() { /*if (__tagembed__manageApiCall()) return;*/ let __tagembed__plan = document.querySelector("#__tagembed__plan"); let __tagembed__toast = new TagembedToast; let formData = new FormData(); formData.append('action', 'data'); formData.append('__tagembed__ajax_action', '__tagembed__get_account_details'); __tagembed__open_loader(); fetch(__tagembed__ajax_url, { method: 'POST', headers: { 'x-requested-with': 'XMLHttpRequest', }, body: formData, }).then(response => { return response.json() }).then(response => { __tagembed__close_loader(); if (response.status == true) { let elemHTML = ""; for (let index in response.data) { for (let indexx in response.data[index].Product) { if (indexx == "Plan") { for (let indexxx in response.data[index].Product[indexx]) { elemHTML = `${elemHTML}
`; if (response.data[index].Product[indexx][indexxx].Plan.id == response.data[index].Product.Subscription.planId) elemHTML = `${elemHTML}Current Plan`; elemHTML = `${elemHTML}${response.data[index].Product[indexx][indexxx].Plan.name}`; /*Manage Plan Price*/ let monthelyPrice = ""; let yearlyPrice = ""; switch (response.data[index].Product[indexx][indexxx].Plan.id) { case "1": yearlyPrice = "0"; monthelyPrice = "0"; break; case "28": yearlyPrice = "1"; monthelyPrice = "1"; break; case "42": yearlyPrice = "9"; monthelyPrice = "11"; break; case "29": yearlyPrice = "19"; monthelyPrice = "24"; break; case "13": yearlyPrice = "39"; monthelyPrice = "49"; break; } if (response.data[index].Product[indexx][indexxx].Plan.id == 28) { elemHTML = `${elemHTML}

Free

`; } else { elemHTML = `${elemHTML}`; elemHTML = `${elemHTML}

$${yearlyPrice}/Mo

`; } elemHTML = `${elemHTML}

${response.data[index].Product[indexx][indexxx].Plan.description}

`; elemHTML = `${elemHTML}`; if (response.data[index].Product[indexx][indexxx].Plan.id != 1) { if (response.data[index].Product[indexx][indexxx].Plan.id == response.data[index].Product.Subscription.planId) { if (response.data[index].Product[indexx][indexxx].Plan.id != 28) { elemHTML = `${elemHTML}Cancel Subscription`; } } else { elemHTML = `${elemHTML}`; elemHTML = `${elemHTML}Select`; } } elemHTML = `${elemHTML}
`; } } } } __tagembed__plan.innerHTML = elemHTML; } else { __tagembed__toast.danger({message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right'}); } }).catch((error) => { console.log(error); __tagembed__close_loader(); __tagembed__toast.danger({message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right'}); }); } /*--End-- Get User Accounts Details*/ /*--Start-- Manage Payment*/ function __tagembed__make_payment(plan, price) { let __tagembed__toast = new TagembedToast; if (!plan || !price) { __tagembed__toast.danger({message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right'}); } else { __tagembed__open_loader(); let formData = new FormData(); formData.append('action', 'data'); formData.append('__tagembed__ajax_action', '__tagembed__make_payment'); formData.append('plan', plan); formData.append('price', price); fetch(__tagembed__ajax_url, { method: 'POST', headers: { 'x-requested-with': 'XMLHttpRequest', }, body: formData, }).then(response => { return response.json() }).then(response => { if (response.status == true) { window.open(response.data.redirectUrl + '?__tagembed__paymentData=' + response.data.__tagembed__paymentData + '&__tagembed__requestCallBackUrl=' + response.data.__tagembed__requestCallBackUrl, '_self'); } else { __tagembed__close_loader(); __tagembed__toast.danger({message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right'}); } }).catch((error) => { console.log(error); __tagembed__close_loader(); __tagembed__toast.danger({message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right'}); }); } } /*--End-- Manage Payment*/ function __tagembed__cancel_subscription(plan) { let __tagembed__toast = new TagembedToast; if (!plan) return __tagembed__toast.danger({message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right'}); confirmDialog({title: 'Are you sure!', message: 'Do you want to cancel subscription?', buttonText: 'Yes', type: 'danger'}, function () { let formData = new FormData(); formData.append('plan', plan); formData.append('action', 'data'); formData.append('__tagembed__ajax_action', '__tagembed__cancel_subscription'); __tagembed__open_loader(); var __tagembed__toast = new TagembedToast; fetch(__tagembed__ajax_url, { method: 'POST', headers: { 'x-requested-with': 'XMLHttpRequest', }, body: formData, }).then(response => { return response.json() }).then(response => { __tagembed__close_loader(); if (response.status == true) { if (response.data.hasOwnProperty("message")) { __tagembed__toast.success({message: response.data.message, position: '__tagembed__is-top-right'}); } setTimeout(function () { window.open('https://tagembed.com/subscription-cancelled/', '_blank'); }, 3000); } else { __tagembed__toast.danger({message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right'}); } }).catch((error) => { console.log(error); __tagembed__close_loader(); __tagembed__toast.danger({message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right'}); }); }); } /*--Start--Hide Account Upgrade Modal*/ function __tagembed__hide_upgrade_account_popup() { let __tagembed__upgrade_account_popup = document.querySelector("#__tagembed__upgrade_account_popup"); __tagembed__upgrade_account_popup.style.display = "none"; } /*--End--Hide Account Upgrade Modal*/