| 1 |
/*--Start-- Manage Account Views*/ |
| 2 |
function __tagembed__manage_account_view(accountType) { |
| 3 |
if (accountType == 'login') { |
| 4 |
let __tagembed__account_error = document.querySelector("#__tagembed__account_error"); |
| 5 |
__tagembed__account_error.style.display = 'none'; |
| 6 |
let __tagembed__account_tab_view = document.querySelector("#__tagembed__account_tab_view"); |
| 7 |
__tagembed__account_tab_view.style.display = 'block'; |
| 8 |
let __tagembed__account_register = document.querySelector("#__tagembed__account_register"); |
| 9 |
__tagembed__account_register.classList.remove('active'); |
| 10 |
let __tagembed__account_login = document.querySelector("#__tagembed__account_login"); |
| 11 |
__tagembed__account_login.classList.add('active'); |
| 12 |
let __tagembed__account_login_view = document.querySelector("#__tagembed__account_login_view"); |
| 13 |
__tagembed__account_login_view.style.display = 'block'; |
| 14 |
let __tagembed__account_register_view = document.querySelector("#__tagembed__account_register_view"); |
| 15 |
__tagembed__account_register_view.style.display = 'none'; |
| 16 |
|
| 17 |
/*let __tagembed__account_forgot_password_view = document.querySelector("#__tagembed__account_forgot_password_view"); |
| 18 |
__tagembed__account_forgot_password_view.style.display = 'none';*/ |
| 19 |
|
| 20 |
} else if (accountType == 'register') { |
| 21 |
let __tagembed__account_error = document.querySelector("#__tagembed__account_error"); |
| 22 |
__tagembed__account_error.style.display = 'none'; |
| 23 |
let __tagembed__account_tab_view = document.querySelector("#__tagembed__account_tab_view"); |
| 24 |
__tagembed__account_tab_view.style.display = 'block'; |
| 25 |
let __tagembed__account_register = document.querySelector("#__tagembed__account_login"); |
| 26 |
__tagembed__account_register.classList.remove('active'); |
| 27 |
let __tagembed__account_login = document.querySelector("#__tagembed__account_register"); |
| 28 |
__tagembed__account_login.classList.add('active'); |
| 29 |
let __tagembed__account_login_view = document.querySelector("#__tagembed__account_login_view"); |
| 30 |
__tagembed__account_login_view.style.display = 'none'; |
| 31 |
let __tagembed__account_register_view = document.querySelector("#__tagembed__account_register_view"); |
| 32 |
__tagembed__account_register_view.style.display = 'block'; |
| 33 |
/*let __tagembed__account_forgot_password_view = document.querySelector("#__tagembed__account_forgot_password_view"); |
| 34 |
__tagembed__account_forgot_password_view.style.display = 'none';*/ |
| 35 |
} else if (accountType == 'forgotPassword') { |
| 36 |
let __tagembed__account_error = document.querySelector("#__tagembed__account_error"); |
| 37 |
__tagembed__account_error.style.display = 'none'; |
| 38 |
let __tagembed__account_tab_view = document.querySelector("#__tagembed__account_tab_view"); |
| 39 |
__tagembed__account_tab_view.style.display = 'none'; |
| 40 |
let __tagembed__account_login_view = document.querySelector("#__tagembed__account_login_view"); |
| 41 |
__tagembed__account_login_view.style.display = 'none'; |
| 42 |
let __tagembed__account_register_view = document.querySelector("#__tagembed__account_register_view"); |
| 43 |
__tagembed__account_register_view.style.display = 'none'; |
| 44 |
/* let __tagembed__account_forgot_password_view = document.querySelector("#__tagembed__account_forgot_password_view"); |
| 45 |
__tagembed__account_forgot_password_view.style.display = 'block';*/ |
| 46 |
} else { |
| 47 |
|
| 48 |
} |
| 49 |
} |
| 50 |
/*--End-- Manage Account Views*/ |
| 51 |
|
| 52 |
/*--Start-- Manage Other Plugin Account Popup*/ |
| 53 |
function __tagembed__manage_other_plugin_account(otherPluginInstallStatus, pluginUrl, existingPluginUser, otherPluginInstallUrl) { |
| 54 |
let elemHTML = `<div id="__tagembed__upgrade_plan_overlay" style="left:0;position:fixed;width:100%;height:100%;background:rgba(0,0,0,0.8);z-index:999;"></div>`; |
| 55 |
elemHTML = `${elemHTML}<div class="__tagembed__popupwrap __tagembed__popup_xl">`; |
| 56 |
elemHTML = `${elemHTML}<button onclick="__tagembed__hide_other_plugin_account_popup_close();" type="button" class="__tagembed__closebtn"></button>`; |
| 57 |
elemHTML = `${elemHTML}<div class="__tagembed__popupinn">`; |
| 58 |
elemHTML = `${elemHTML}<div class="__tagembed__header"><h2>Taggbox & Tagembed Are Now One 🤝</h2></div>`; |
| 59 |
elemHTML = `${elemHTML}<hr class="__tagembed__horizontaborder">`; |
| 60 |
elemHTML = `${elemHTML}<div class="__tagembed__formwbody">`; |
| 61 |
elemHTML = `${elemHTML}<div class="__tagembed__formwrow">`; |
| 62 |
elemHTML = `${elemHTML}<p style="text-align: center;"> You already have an account on <strong style="text-transform: capitalize;">${existingPluginUser}</strong> Plugin. Install and Use the same credentials to log in Or to continue sign up with a different email.</p>`; |
| 63 |
elemHTML = `${elemHTML}</div></div>`; |
| 64 |
elemHTML = `${elemHTML}<div class="__tagembed__btnwrap text-center">`; |
| 65 |
|
| 66 |
if (otherPluginInstallStatus) { |
| 67 |
elemHTML = `${elemHTML}<a href="${otherPluginInstallUrl}" style="" class="__tagembed__okaybtn">Login</a>`; |
| 68 |
} else { |
| 69 |
elemHTML = `${elemHTML}<a href="${pluginUrl}" target="_blank" style="" class="__tagembed__okaybtn">Install <strong style="text-transform: capitalize;">${existingPluginUser}</strong> Plugin</a>`; |
| 70 |
} |
| 71 |
elemHTML = `${elemHTML}</div>`; |
| 72 |
elemHTML = `${elemHTML}</div></div>`; |
| 73 |
let __tagembed__other_plugin_popup = document.getElementById("__tagembed__other_plugin_popup"); |
| 74 |
__tagembed__other_plugin_popup.innerHTML = elemHTML; |
| 75 |
__tagembed__other_plugin_popup.style.display = "block"; |
| 76 |
} |
| 77 |
function __tagembed__hide_other_plugin_account_popup_close() { |
| 78 |
let __tagembed__other_plugin_popup = document.querySelector("#__tagembed__other_plugin_popup") |
| 79 |
__tagembed__other_plugin_popup.style.display = "none"; |
| 80 |
} |
| 81 |
/*--End-- Manage Other Plugin Account Popup*/ |
| 82 |
|
| 83 |
/*--Start-- Get Country Code For Register*/ |
| 84 |
window.addEventListener ? window.addEventListener("load", __tagembed__getCallingCode, false) : window.attachEvent && window.attachEvent("onload", __tagembed__getCallingCode); |
| 85 |
function __tagembed__getCallingCode() { |
| 86 |
/*Manage Customizaton Section Hide Show*/ |
| 87 |
let __tagembed__toast = new TagembedToast; |
| 88 |
let formData = new FormData(); |
| 89 |
formData.append('action', 'data'); |
| 90 |
formData.append('__tagembed__ajax_call_nones', __tagembed__ajax_call_nones); |
| 91 |
formData.append('__tagembed__ajax_action', '__tagembed__getCallingCode'); |
| 92 |
__tagembed__open_loader(); |
| 93 |
fetch(__tagembed__ajax_url, { |
| 94 |
method: 'POST', |
| 95 |
headers: { |
| 96 |
'x-requested-with': 'XMLHttpRequest', |
| 97 |
}, |
| 98 |
body: formData, |
| 99 |
}).then(response => { |
| 100 |
return response.json() |
| 101 |
}).then(response => { |
| 102 |
__tagembed__close_loader(); |
| 103 |
if (response.status == true) { |
| 104 |
let callingCodes = response.data.callingCode; |
| 105 |
let select = document.getElementById("__tagembed__callingCode"); |
| 106 |
callingCodes.forEach((callingCode, index) => { |
| 107 |
let option = document.createElement("option"); |
| 108 |
option.value = callingCode.callingCode; |
| 109 |
option.textContent = `${callingCode.flag} ${callingCode.name} (${callingCode.callingCode})`; |
| 110 |
if (callingCode.status == 1) |
| 111 |
option.selected = true; |
| 112 |
select.appendChild(option); |
| 113 |
}); |
| 114 |
} |
| 115 |
}).catch((error) => { |
| 116 |
console.log(error); |
| 117 |
__tagembed__close_loader(); |
| 118 |
__tagembed__toast.danger({ message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right' }); |
| 119 |
}); |
| 120 |
} |
| 121 |
/*--End-- Get Country Code For Register*/ |
| 122 |
|
| 123 |
/*--Start-- Register*/ |
| 124 |
var __tagembed__register_form = document.querySelector("#__tagembed__register_form"); |
| 125 |
if (__tagembed__register_form) { |
| 126 |
__tagembed__register_form.addEventListener("submit", function (event) { |
| 127 |
__tagembed__manage_account_view('register'); |
| 128 |
let __tagembed__register_full_name_error = document.querySelector("#__tagembed__register_full_name_error"); |
| 129 |
__tagembed__register_full_name_error.style.display = 'none'; |
| 130 |
let __tagembed__register_email_id_error = document.querySelector("#__tagembed__register_email_id_error"); |
| 131 |
__tagembed__register_email_id_error.style.display = 'none'; |
| 132 |
let __tagembed__register_password_error = document.querySelector("#__tagembed__register_password_error"); |
| 133 |
__tagembed__register_password_error.style.display = 'none'; |
| 134 |
let __tagembed__register_contact_no_error = document.querySelector("#__tagembed__register_contact_no_error"); |
| 135 |
__tagembed__register_contact_no_error.style.display = 'none'; |
| 136 |
let __tagembed__register_calling_code_error = document.querySelector("#__tagembed__register_calling_code_error"); |
| 137 |
__tagembed__register_calling_code_error.style.display = 'none'; |
| 138 |
__tagembed__open_loader(); |
| 139 |
let __tagembed__toast = new TagembedToast; |
| 140 |
let formData = document.querySelector("#__tagembed__register_form") |
| 141 |
formData = new FormData(formData); |
| 142 |
formData.append('action', 'data'); |
| 143 |
formData.append('__tagembed__ajax_call_nones', __tagembed__ajax_call_nones); |
| 144 |
formData.append('__tagembed__ajax_action', '__tagembed__register'); |
| 145 |
fetch(__tagembed__ajax_url, { |
| 146 |
method: 'POST', |
| 147 |
headers: { |
| 148 |
'x-requested-with': 'XMLHttpRequest', |
| 149 |
}, |
| 150 |
body: formData, |
| 151 |
}).then(response => { |
| 152 |
return response.json(); |
| 153 |
}).then(response => { |
| 154 |
__tagembed__close_loader(); |
| 155 |
if (response.status == true) { |
| 156 |
if (response.hasOwnProperty("data") && Object.keys(response.data).length > 0) { |
| 157 |
if (response.data.hasOwnProperty("accountAlreadyOtherPluginStatus")) { |
| 158 |
if (response.data.accountAlreadyOtherPluginStatus == true) |
| 159 |
__tagembed__manage_other_plugin_account(response.data.otherPluginInstallStatus, response.data.pluginUrl, response.data.existingPluginUser, response.data.otherPluginInstallUrl); |
| 160 |
} else { |
| 161 |
window.location.replace(response.data.redirectUrl); |
| 162 |
} |
| 163 |
} |
| 164 |
} else { |
| 165 |
if (response.hasOwnProperty("data") && Object.keys(response.data).length > 0) { |
| 166 |
if (response.data.hasOwnProperty("fullName")) { |
| 167 |
__tagembed__register_full_name_error.style.display = 'block'; |
| 168 |
__tagembed__register_full_name_error.textContent = response.data.fullName; |
| 169 |
} |
| 170 |
if (response.data.hasOwnProperty("emailId")) { |
| 171 |
__tagembed__register_email_id_error.style.display = 'block'; |
| 172 |
__tagembed__register_email_id_error.textContent = response.data.emailId; |
| 173 |
} |
| 174 |
if (response.data.hasOwnProperty("password")) { |
| 175 |
__tagembed__register_password_error.style.display = 'block'; |
| 176 |
__tagembed__register_password_error.textContent = response.data.password; |
| 177 |
} |
| 178 |
if (response.data.hasOwnProperty("contact_no")) { |
| 179 |
__tagembed__register_contact_no_error.style.display = 'block'; |
| 180 |
__tagembed__register_contact_no_error.textContent = response.data.contact_no; |
| 181 |
} |
| 182 |
if (response.data.hasOwnProperty("calling_code")) { |
| 183 |
__tagembed__register_calling_code_error.style.display = 'block'; |
| 184 |
__tagembed__register_calling_code_error.textContent = response.data.calling_code; |
| 185 |
} |
| 186 |
/*--End-- Manage Validation Error*/ |
| 187 |
} else { |
| 188 |
if (response.hasOwnProperty("message")) { |
| 189 |
let __tagembed__account_error = document.querySelector("#__tagembed__account_error"); |
| 190 |
__tagembed__account_error.style.display = 'block'; |
| 191 |
__tagembed__account_error.textContent = response.message; |
| 192 |
} else { |
| 193 |
__tagembed__toast.danger({ message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right' }); |
| 194 |
} |
| 195 |
} |
| 196 |
} |
| 197 |
}).catch((error) => { |
| 198 |
console.log(error); |
| 199 |
__tagembed__close_loader(); |
| 200 |
__tagembed__toast.danger({ message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right' }); |
| 201 |
|
| 202 |
}); |
| 203 |
}); |
| 204 |
} |
| 205 |
/*--End-- Register*/ |
| 206 |
/*--Start-- Login*/ |
| 207 |
var __tagembed__login_form = document.querySelector("#__tagembed__login_form"); |
| 208 |
if (__tagembed__login_form) { |
| 209 |
__tagembed__login_form.addEventListener("submit", function (event) { |
| 210 |
__tagembed__manage_account_view('login'); |
| 211 |
let __tagembed__login_email_id_error = document.querySelector("#__tagembed__login_email_id_error"); |
| 212 |
__tagembed__login_email_id_error.style.display = 'none'; |
| 213 |
let __tagembed__login_password_error = document.querySelector("#__tagembed__login_password_error"); |
| 214 |
__tagembed__login_password_error.style.display = 'none'; |
| 215 |
__tagembed__open_loader(); |
| 216 |
let __tagembed__toast = new TagembedToast; |
| 217 |
let formData = document.querySelector("#__tagembed__login_form") |
| 218 |
formData = new FormData(formData); |
| 219 |
formData.append('action', 'data'); |
| 220 |
formData.append('__tagembed__ajax_call_nones', __tagembed__ajax_call_nones); |
| 221 |
formData.append('__tagembed__ajax_action', '__tagembed__login'); |
| 222 |
fetch(__tagembed__ajax_url, { |
| 223 |
method: 'POST', |
| 224 |
headers: { |
| 225 |
'x-requested-with': 'XMLHttpRequest', |
| 226 |
}, |
| 227 |
body: formData, |
| 228 |
}).then(response => { |
| 229 |
return response.json(); |
| 230 |
}).then(response => { |
| 231 |
__tagembed__close_loader(); |
| 232 |
if (response.status == true) { |
| 233 |
if (response.hasOwnProperty("data") && Object.keys(response.data).length > 0) { |
| 234 |
if (response.data.hasOwnProperty("accountAlreadyOtherPluginStatus")) { |
| 235 |
if (response.data.accountAlreadyOtherPluginStatus == true) |
| 236 |
__tagembed__manage_other_plugin_account(response.data.otherPluginInstallStatus, response.data.pluginUrl, response.data.existingPluginUser, response.data.otherPluginInstallUrl); |
| 237 |
} else { |
| 238 |
window.location.replace(response.data.redirectUrl); |
| 239 |
} |
| 240 |
} |
| 241 |
} else { |
| 242 |
if (response.hasOwnProperty("data") && Object.keys(response.data).length > 0) { |
| 243 |
if (response.data.hasOwnProperty("emailId")) { |
| 244 |
__tagembed__login_email_id_error.style.display = 'block'; |
| 245 |
__tagembed__login_email_id_error.textContent = response.data.emailId; |
| 246 |
} |
| 247 |
if (response.data.hasOwnProperty("password")) { |
| 248 |
__tagembed__login_password_error.style.display = 'block'; |
| 249 |
__tagembed__login_password_error.textContent = response.data.password; |
| 250 |
} |
| 251 |
} else { |
| 252 |
if (response.hasOwnProperty("message")) { |
| 253 |
let __tagembed__account_error = document.querySelector("#__tagembed__account_error"); |
| 254 |
__tagembed__account_error.style.display = 'block'; |
| 255 |
__tagembed__account_error.textContent = response.message; |
| 256 |
} else { |
| 257 |
__tagembed__toast.danger({ message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right' }); |
| 258 |
} |
| 259 |
} |
| 260 |
} |
| 261 |
}).catch((error) => { |
| 262 |
console.log(error); |
| 263 |
__tagembed__close_loader(); |
| 264 |
__tagembed__toast.danger({ message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right' }); |
| 265 |
|
| 266 |
}); |
| 267 |
}); |
| 268 |
} |
| 269 |
/*--End-- Login*/ |