/*--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.textContent = "Hide All Features"; } else { __tagembed__all_feacture_section.style.display = "none"; __tagembed__all_feacture_button.textContent = "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() { let __tagembed__all_feacture_section = document.querySelector("#__tagembed__all_feacture_section"); let allFeactureRemovableKeys = ['id', 'created', 'modified', 'webEmbed', 'status', 'collaborator', 'collaboratorStatus', 'themes', 'updatesIntervalCron', 'unit_cron', 'retainPost']; let allFeactureIcons = ['apiLimit', 'name', 'retainPostCount', 'support', 'walls', 'feeds', 'linkedInFeedLimit', 'linkedInFeedLimit', 'twitterFeedLimit', 'viewCount'] let freeTrialPlanIds = ['1']; let __tagembed__plan = document.querySelector("#__tagembed__plan"); let __tagembed__toast = new TagembedToast; let formData = new FormData(); formData.append('action', 'tagembed_data'); formData.append('__tagembed__ajax_call_nones', __tagembed__ajax_call_nones); 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) { /*--Start-- Manage Upgrade Plan Section Hide | Show*/ let __tagembed__upgrade_plan_section = document.querySelector("#__tagembed__upgrade_plan_section"); let __tagembed__support_section = document.querySelector("#__tagembed__support_section"); if (response.data.upgradeSection && response.data.upgradeSection === "hide") { if (__tagembed__upgrade_plan_section) { __tagembed__upgrade_plan_section.style.display = "none"; } if (__tagembed__support_section) { __tagembed__support_section.style.display = "block"; } return false; } /*--End-- Manage Upgrade Plan Section Hide | Show*/ /*--Start-- Manage All Feacture Section*/ let allFeactureHTML = ""; let i = 0; for (let indexxxxx in response.data.Product) { if (indexxxxx == "Plan") { for (let indexxxxxx in response.data.Product[indexxxxx]) { if (!freeTrialPlanIds.includes(response.data.Product[indexxxxx][indexxxxxx].Plan.id)) { const selectedKeys = [ 'name', 'walls', 'feeds', 'Networks', 'branding', 'api', 'support', 'apiLimit', 'customCss', 'manualModeration', 'automaticModeration', 'webAnalytic', 'customPost', 'customBanner', 'profanityFilter', 'cta', 'cdn', 'retainPostCount', 'linkedInFeedLimit', 'twitterFeedLimit', 'viewCount' ]; if (i === 0) { allFeactureHTML += ''; for (const key of selectedKeys) { const planRuleData = response.data.Product[indexxxxx][indexxxxxx].PlanRule; if (planRuleData.hasOwnProperty(key) && !allFeactureRemovableKeys.includes(key)) { allFeactureHTML += `${__tagembed__escapeText(key.replace(/([A-Z])/g, ' $1'))}`; } } allFeactureHTML += 'Networks'; } i++; allFeactureHTML += ''; for (const key of selectedKeys) { const planRuleData = response.data.Product[indexxxxx][indexxxxxx].PlanRule; if (planRuleData.hasOwnProperty(key) && !allFeactureRemovableKeys.includes(key)) { if (allFeactureIcons.includes(key)) { allFeactureHTML += `${__tagembed__escapeText(planRuleData[key])}`; } else { if (planRuleData[key] == "1") { allFeactureHTML += `access`; } else { allFeactureHTML += `no-access`; } } } } allFeactureHTML += ''; for (let network of response.data.Product[indexxxxx][indexxxxxx].Planrulenetwork) { allFeactureHTML += ``; } allFeactureHTML += ''; } } } } __tagembed__setSafeHtml(__tagembed__all_feacture_section, ` ${allFeactureHTML}
`); /*--End-- Manage All Feacture Section*/ /*--Start-- Manage Plan Serction Section*/ let elemHTML = ""; for (let indexx in response.data.Product) { if (indexx == "Plan") { for (let indexxx in response.data.Product[indexx]) { elemHTML = `${elemHTML}
`; if (response.data.Product[indexx][indexxx].Plan.id == response.data.Product.ActivePlan.id) elemHTML = `${elemHTML}Current Plan`; elemHTML = `${elemHTML}${__tagembed__escapeText(response.data.Product[indexx][indexxx].Plan.name)}`; let monthelyPrice = response.data.Product[indexx][indexxx].Plan.wordpessMonthlyPrice; let yearlyPrice = response.data.Product[indexx][indexxx].Plan.wordpressYearlyPrice; if (response.data.Product[indexx][indexxx].Plan.id == 67 || response.data.Product[indexx][indexxx].Plan.id == 53) { elemHTML = `${elemHTML}

Free

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

$${__tagembed__escapeText(yearlyPrice)}/Mo

`; } elemHTML = `${elemHTML}

${__tagembed__escapeText(response.data.Product[indexx][indexxx].Plan.description)}

`; elemHTML = `${elemHTML}`; if (response.data.Product[indexx][indexxx].Plan.id != 1) { if (response.data.Product[indexx][indexxx].Plan.id == response.data.Product.ActivePlan.id) { if (response.data.Product[indexx][indexxx].Plan.id != 67 && response.data.Product[indexx][indexxx].Plan.id != 53) { elemHTML = `${elemHTML}Cancel Subscription`; } } else { if (response.data.Product[indexx][indexxx].Plan.id == 67 || response.data.Product[indexx][indexxx].Plan.id == 53) { elemHTML = `${elemHTML}`; elemHTML = `${elemHTML}Select`; } else { elemHTML = `${elemHTML}`; elemHTML = `${elemHTML}Select`; } } } elemHTML = `${elemHTML}
`; } } } __tagembed__setSafeHtml(__tagembed__plan, elemHTML); /* The plan buttons carry their values in data attributes and are wired up here, so no event handler is written into the markup. */ __tagembed__plan.querySelectorAll("[data-tagembed-action]").forEach(function (__tagembed__planButton) { __tagembed__planButton.addEventListener("click", function () { let __tagembed__action = (this.getAttribute("data-tagembed-action") || ""); let __tagembed__planId = (this.getAttribute("data-tagembed-plan-id") || ""); let __tagembed__priceCode = (this.getAttribute("data-tagembed-price-code") || ""); if ("cancel-subscription" === __tagembed__action) __tagembed__cancel_subscription(__tagembed__planId); else if ("lite-payment" === __tagembed__action) __tagembed__make_lite_plan_payment(__tagembed__planId, __tagembed__priceCode); else if ("payment" === __tagembed__action) __tagembed__make_payment(__tagembed__planId, __tagembed__priceCode); }); }); /*--End-- Manage Plan Serction Section*/ /*Manage Upgrade Plan Section Hide | Show */ if (__tagembed__upgrade_plan_section) __tagembed__upgrade_plan_section.style.display = "block"; } else { if (response.hasOwnProperty("message")) { __tagembed__toast.danger({ message: response.message, position: '__tagembed__is-top-right' }); } 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_lite_plan_payment(planId, priceCode) { __tagembed__confirmDialog({ title: 'Opting Free Forever LITE Plan', message: 'Your current plan will be canceled and changed to Lite Plan.', buttonText: 'Confirm', type: 'danger' }, function () { __tagembed__make_payment(planId, priceCode); }); } function __tagembed__make_payment(planId, priceCode) { let __tagembed__toast = new TagembedToast; if (!planId) { __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', 'tagembed_data'); formData.append('__tagembed__ajax_call_nones', __tagembed__ajax_call_nones); formData.append('__tagembed__ajax_action', '__tagembed__make_payment'); formData.append('planId', planId); formData.append('priceCode', priceCode); 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(); if (response.hasOwnProperty("message")) { __tagembed__toast.danger({ message: response.message, position: '__tagembed__is-top-right' }); } 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-- Manage Payment*/ function __tagembed__cancel_subscription(planId) { let __tagembed__toast = new TagembedToast; if (!planId) return __tagembed__toast.danger({ message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right' }); __tagembed__confirmDialog({ title: 'Are you sure!', message: 'Do you want to cancel subscription?', buttonText: 'Yes', type: 'danger' }, function () { let formData = new FormData(); formData.append('planId', planId); formData.append('action', 'tagembed_data'); formData.append('__tagembed__ajax_call_nones', __tagembed__ajax_call_nones); 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 { if (response.hasOwnProperty("message")) { __tagembed__toast.danger({ message: response.message, position: '__tagembed__is-top-right' }); } 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*/