PluginProbe
Tagembed: Social Media Feeds and Customer Reviews Widget / 7.4
Tagembed: Social Media Feeds and Customer Reviews Widget v7.4
7.8 7.5 7.6 7.7 7.4 trunk 3.10 3.9 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 5.0 5.1 5.2 5.3 5.4 5.5 5.6 All 43 releases
tagembed-widget / assets / js / upgrade / tagembed.upgrade.script.js

tagembed.upgrade.script.js in Tagembed: Social Media Feeds and Customer Reviews Widget 7.4, at assets/js/upgrade/tagembed.upgrade.script.js

318 lines 17.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*--Start--Manage All Feacture Hide Show*/
2 function __tagembed__manageAllFeactureHideShow() {
3 let __tagembed__all_feacture_section = document.querySelector("#__tagembed__all_feacture_section");
4 let __tagembed__all_feacture_button = document.querySelector("#__tagembed__all_feacture_button");
5 if (__tagembed__all_feacture_section.style.display === "none") {
6 __tagembed__all_feacture_section.style.display = "block";
7 __tagembed__all_feacture_button.innerHTML = "Hide All Features";
8 } else {
9 __tagembed__all_feacture_section.style.display = "none";
10 __tagembed__all_feacture_button.innerHTML = "Show All Features";
11 }
12 }
13 /*--End--Manage All Feacture Hide Show*/
14 /*--Start--Manage All Feacture Hide Show*/
15 function __tagembed__manageSelectPlanPrice(timePeriod) {
16 let __tagembbed__monthely_price_button = document.querySelector("#__tagembbed__monthely_price_button");
17 let __tagembbed__yearly_price_button = document.querySelector("#__tagembbed__yearly_price_button");
18 if (timePeriod == "monthely") {
19 document.querySelectorAll('.__tagembed__yearly_plan').forEach(function (el) {
20 el.style.display = 'none';
21 });
22 document.querySelectorAll('.__tagembed__monthely_plan').forEach(function (el) {
23 el.style.display = 'block';
24 });
25 document.querySelectorAll('.__tagembed__selectbtn_yearly').forEach(function (el) {
26 el.style.display = 'none';
27 });
28 document.querySelectorAll('.__tagembed__selectbtn_monthely').forEach(function (el) {
29 el.style.display = 'block';
30 });
31 __tagembbed__monthely_price_button.classList.add("__tagembed__active");
32 __tagembbed__yearly_price_button.classList.remove("__tagembed__active");
33 } else if (timePeriod == "yearly") {
34 document.querySelectorAll('.__tagembed__yearly_plan').forEach(function (el) {
35 el.style.display = 'block';
36 });
37 document.querySelectorAll('.__tagembed__monthely_plan').forEach(function (el) {
38 el.style.display = 'none';
39 });
40 document.querySelectorAll('.__tagembed__selectbtn_yearly').forEach(function (el) {
41 el.style.display = 'block';
42 });
43 document.querySelectorAll('.__tagembed__selectbtn_monthely').forEach(function (el) {
44 el.style.display = 'none';
45 });
46 __tagembbed__yearly_price_button.classList.add("__tagembed__active");
47 __tagembbed__monthely_price_button.classList.remove("__tagembed__active");
48 }
49 }
50 /*--End--Manage All Feacture Hide Show*/
51 /*--Start-- Get User Accounts Details*/
52 window.addEventListener ? window.addEventListener("load", __tagembed__get_account_details, false) : window.attachEvent && window.attachEvent("onload", __tagembed__get_account_details);
53 function __tagembed__get_account_details() {
54 let __tagembed__all_feacture_section = document.querySelector("#__tagembed__all_feacture_section");
55 let allFeactureRemovableKeys = ['id', 'created', 'modified', 'webEmbed', 'status', 'collaborator', 'collaboratorStatus', 'themes', 'updatesIntervalCron', 'unit_cron', 'retainPost'];
56 let allFeactureIcons = ['apiLimit', 'name', 'retainPostCount', 'support', 'walls', 'feeds', 'linkedInFeedLimit', 'linkedInFeedLimit', 'twitterFeedLimit', 'viewCount']
57 let freeTrialPlanIds = ['1'];
58 let __tagembed__plan = document.querySelector("#__tagembed__plan");
59 let __tagembed__toast = new TagembedToast;
60 let formData = new FormData();
61 formData.append('action', 'data');
62 formData.append('__tagembed__ajax_call_nones', __tagembed__ajax_call_nones);
63 formData.append('__tagembed__ajax_action', '__tagembed__get_account_details');
64 __tagembed__open_loader();
65 fetch(__tagembed__ajax_url, {
66 method: 'POST',
67 headers: {
68 'x-requested-with': 'XMLHttpRequest',
69 },
70 body: formData,
71 }).then(response => {
72 return response.json()
73 }).then(response => {
74 __tagembed__close_loader();
75 if (response.status == true) {
76
77 /*--Start-- Manage Upgrade Plan Section Hide | Show*/
78 let __tagembed__upgrade_plan_section = document.querySelector("#__tagembed__upgrade_plan_section");
79 let __tagembed__support_section = document.querySelector("#__tagembed__support_section");
80 if (response.data.upgradeSection && response.data.upgradeSection === "hide") {
81 if (__tagembed__upgrade_plan_section) {
82 __tagembed__upgrade_plan_section.style.display = "none";
83 }
84 if (__tagembed__support_section) {
85 __tagembed__support_section.style.display = "block";
86 }
87 return false;
88 }
89 /*--End-- Manage Upgrade Plan Section Hide | Show*/
90
91 /*--Start-- Manage All Feacture Section*/
92 let allFeactureHTML = "";
93 let i = 0;
94 for (let indexxxxx in response.data.Product) {
95 if (indexxxxx == "Plan") {
96 for (let indexxxxxx in response.data.Product[indexxxxx]) {
97 if (!freeTrialPlanIds.includes(response.data.Product[indexxxxx][indexxxxxx].Plan.id)) {
98 const selectedKeys = [
99 'name', 'walls', 'feeds', 'Networks', 'branding', 'api', 'support', 'apiLimit',
100 'customCss', 'manualModeration', 'automaticModeration', 'webAnalytic',
101 'customPost', 'customBanner', 'profanityFilter', 'cta', 'cdn', 'retainPostCount',
102 'linkedInFeedLimit', 'twitterFeedLimit', 'viewCount'
103 ];
104 if (i === 0) {
105 allFeactureHTML += '<tr>';
106
107 for (const key of selectedKeys) {
108 const planRuleData = response.data.Product[indexxxxx][indexxxxxx].PlanRule;
109 if (planRuleData.hasOwnProperty(key) && !allFeactureRemovableKeys.includes(key)) {
110 allFeactureHTML += `<th>${key.replace(/([A-Z])/g, ' $1')}</th>`;
111 }
112 }
113 allFeactureHTML += '<th>Networks</th></tr>';
114 }
115 i++;
116 allFeactureHTML += '<tr>';
117
118 for (const key of selectedKeys) {
119 const planRuleData = response.data.Product[indexxxxx][indexxxxxx].PlanRule;
120 if (planRuleData.hasOwnProperty(key) && !allFeactureRemovableKeys.includes(key)) {
121 if (allFeactureIcons.includes(key)) {
122 allFeactureHTML += `<td>${planRuleData[key]}</td>`;
123 } else {
124 if (planRuleData[key] == "1") {
125 allFeactureHTML += `<td class="text-center mb-0"><img src="${__tagembed__plugin_url_for_js}assets/images/plan-ok.svg" alt="access" class="img-fluid"></td>`;
126 } else {
127 allFeactureHTML += `<td class="text-center mb-0"><img src="${__tagembed__plugin_url_for_js}assets/images/plan-cross.svg" alt="no-access" class="img-fluid"></td>`;
128 }
129 }
130 }
131 }
132 allFeactureHTML += '<td>';
133 for (let network of response.data.Product[indexxxxx][indexxxxxx].Planrulenetwork) {
134 allFeactureHTML += `<img style="height:14px; margin:2px;" src="${__tagembed__plugin_url_for_js}assets/images/network/${network.network}.png"/>`;
135 }
136 allFeactureHTML += '</td></tr>';
137 }
138 }
139 }
140 }
141 __tagembed__all_feacture_section.innerHTML = `<table> ${allFeactureHTML}</table>`;
142 /*--End-- Manage All Feacture Section*/
143 /*--Start-- Manage Plan Serction Section*/
144 let elemHTML = "";
145 for (let indexx in response.data.Product) {
146 if (indexx == "Plan") {
147 for (let indexxx in response.data.Product[indexx]) {
148 elemHTML = `${elemHTML}<div class="__tagembed__planbox ${(response.data.Product[indexx][indexxx].Plan.id == response.data.Product.ActivePlan.id) ? '__tagembed__activeplan' : ''}">`;
149 if (response.data.Product[indexx][indexxx].Plan.id == response.data.Product.ActivePlan.id)
150 elemHTML = `${elemHTML}<span class="__tagembed__currentplan">Current Plan</span>`;
151 elemHTML = `${elemHTML}<strong>${response.data.Product[indexx][indexxx].Plan.name}</strong>`;
152 let monthelyPrice = response.data.Product[indexx][indexxx].Plan.wordpessMonthlyPrice;
153 let yearlyPrice = response.data.Product[indexx][indexxx].Plan.wordpressYearlyPrice;
154 if (response.data.Product[indexx][indexxx].Plan.id == 67 || response.data.Product[indexx][indexxx].Plan.id == 53) {
155 elemHTML = `${elemHTML}<h2>Free</h2>`;
156 } else {
157 elemHTML = `${elemHTML}<h2 class="__tagembed__monthely_plan" style="display:none;">$${monthelyPrice}/Mo</h2>`;
158 elemHTML = `${elemHTML}<h2 class="__tagembed__yearly_plan">$${yearlyPrice}/Mo</h2>`;
159 }
160 elemHTML = `${elemHTML}<p>${response.data.Product[indexx][indexxx].Plan.description}</p>`;
161 elemHTML = `${elemHTML}<ul>`;
162 elemHTML = `${elemHTML}<li><img src="${__tagembed__plugin_url_for_js}assets/images/plan-ok.svg" alt="access" />${response.data.Product[indexx][indexxx].PlanRule.feeds} ${response.data.Product[indexx][indexxx].Plan.id == 67 || response.data.Product[indexx][indexxx].Plan.id == 53 ? `Feed` : `Feeds`}</li>`;
163 elemHTML = `${elemHTML}<li><img src="${__tagembed__plugin_url_for_js}assets/images/plan-ok.svg" alt="access" />${response.data.Product[indexx][indexxx].PlanRule.viewCount} Views/Month</li>`;
164 if (response.data.Product[indexx][indexxx].Plan.id != 67 && response.data.Product[indexx][indexxx].Plan.id != 53) {
165 if (response.data.Product[indexx][indexxx].PlanRule.linkedInFeedLimit != 0) {
166 elemHTML = `${elemHTML}<li><img src="${__tagembed__plugin_url_for_js}assets/images/plan-ok.svg" alt="access" />LinkedIn Auto Update (Max ${response.data.Product[indexx][indexxx].PlanRule.linkedInFeedLimit} Feeds)</li>`;
167 } else {
168 elemHTML = `${elemHTML}<li><img src="${__tagembed__plugin_url_for_js}assets/images/plan-ok.svg" alt="access" />LinkedIn Manual</li>`;
169 }
170 } else {
171 elemHTML = `${elemHTML}<li><img src="${__tagembed__plugin_url_for_js}assets/images/plan-cross.svg" alt="no-access" />LinkedIn Feed</li>`;
172 }
173 elemHTML = `${elemHTML}<li><img src="${__tagembed__plugin_url_for_js}assets/images/plan-ok.svg" alt="access" />${response.data.Product[indexx][indexxx].PlanRule.updatesIntervalCron} ${(response.data.Product[indexx][indexxx].PlanRule.unit_cron == 3600) ? "Hours" : "Mins"} Update Time</li>`;
174 if (response.data.Product[indexx][indexxx].PlanRule.customCss == 0) {
175 elemHTML = `${elemHTML}<li><img src="${__tagembed__plugin_url_for_js}assets/images/plan-cross.svg" alt="no-access" />No Custom CSS</li>`;
176 } else {
177 elemHTML = `${elemHTML}<li><img src="${__tagembed__plugin_url_for_js}assets/images/plan-ok.svg" alt="access" />Custom CSS</li>`;
178 }
179 if (response.data.Product[indexx][indexxx].PlanRule.branding == 0) {
180 elemHTML = `${elemHTML}<li><img src="${__tagembed__plugin_url_for_js}assets/images/plan-cross.svg" alt="no-access" />No Tagembed Branding</li>`;
181 } else {
182 elemHTML = `${elemHTML}<li><img src="${__tagembed__plugin_url_for_js}assets/images/plan-ok.svg" alt="access" />Tagembed Branding</li>`;
183 }
184 elemHTML = `${elemHTML}</ul>`;
185 if (response.data.Product[indexx][indexxx].Plan.id != 1) {
186 if (response.data.Product[indexx][indexxx].Plan.id == response.data.Product.ActivePlan.id) {
187 if (response.data.Product[indexx][indexxx].Plan.id != 67 && response.data.Product[indexx][indexxx].Plan.id != 53) {
188 elemHTML = `${elemHTML}<a href="javascript:void(0);" onclick="__tagembed__cancel_subscription('${response.data.Product[indexx][indexxx].Plan.id}');" class="__tagembed__selectbtn">Cancel Subscription</a>`;
189 }
190 } else {
191 if (response.data.Product[indexx][indexxx].Plan.id == 67 || response.data.Product[indexx][indexxx].Plan.id == 53) {
192 elemHTML = `${elemHTML}<a href="javascript:void(0);" onclick="__tagembed__make_lite_plan_payment('${response.data.Product[indexx][indexxx].Plan.id}','${response.data.Product[indexx][indexxx].Plan.wordpressStripeMonthlyPriceCode}');" class="__tagembed__selectbtn __tagembed__selectbtn_monthely" style="display:none;">Select</a>`;
193 elemHTML = `${elemHTML}<a href="javascript:void(0);" onclick="__tagembed__make_lite_plan_payment('${response.data.Product[indexx][indexxx].Plan.id}','${response.data.Product[indexx][indexxx].Plan.wordpressStripeYearlyPriceCode}');" class="__tagembed__selectbtn __tagembed__selectbtn_yearly">Select</a>`;
194 } else {
195 elemHTML = `${elemHTML}<a href="javascript:void(0);" onclick="__tagembed__make_payment('${response.data.Product[indexx][indexxx].Plan.id}','${response.data.Product[indexx][indexxx].Plan.wordpressStripeMonthlyPriceCode}');" class="__tagembed__selectbtn __tagembed__selectbtn_monthely" style="display:none;">Select</a>`;
196 elemHTML = `${elemHTML}<a href="javascript:void(0);" onclick="__tagembed__make_payment('${response.data.Product[indexx][indexxx].Plan.id}','${response.data.Product[indexx][indexxx].Plan.wordpressStripeYearlyPriceCode}');" class="__tagembed__selectbtn __tagembed__selectbtn_yearly">Select</a>`;
197 }
198 }
199 }
200 elemHTML = `${elemHTML}</div>`;
201 }
202 }
203 }
204 __tagembed__plan.innerHTML = elemHTML;
205 /*--End-- Manage Plan Serction Section*/
206
207 /*Manage Upgrade Plan Section Hide | Show */
208 if (__tagembed__upgrade_plan_section)
209 __tagembed__upgrade_plan_section.style.display = "block";
210
211 } else {
212 if (response.hasOwnProperty("message")) {
213 __tagembed__toast.danger({ message: response.message, position: '__tagembed__is-top-right' });
214 } else {
215 __tagembed__toast.danger({ message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right' });
216 }
217 }
218 }).catch((error) => {
219 console.log(error);
220 __tagembed__close_loader();
221 __tagembed__toast.danger({ message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right' });
222 });
223 }
224 /*--End-- Get User Accounts Details*/
225 /*--Start-- Manage Payment*/
226 function __tagembed__make_lite_plan_payment(planId, priceCode) {
227 confirmDialog({ title: 'Opting Free Forever LITE Plan', message: 'Your current plan will be canceled and changed to Lite Plan.', buttonText: 'Confirm', type: 'danger' }, function () {
228 __tagembed__make_payment(planId, priceCode);
229 });
230 }
231 function __tagembed__make_payment(planId, priceCode) {
232 let __tagembed__toast = new TagembedToast;
233 if (!planId || !priceCode) {
234 __tagembed__toast.danger({ message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right' });
235 } else {
236 __tagembed__open_loader();
237 let formData = new FormData();
238 formData.append('action', 'data');
239 formData.append('__tagembed__ajax_call_nones', __tagembed__ajax_call_nones);
240 formData.append('__tagembed__ajax_action', '__tagembed__make_payment');
241 formData.append('planId', planId);
242 formData.append('priceCode', priceCode);
243 fetch(__tagembed__ajax_url, {
244 method: 'POST',
245 headers: {
246 'x-requested-with': 'XMLHttpRequest',
247 },
248 body: formData,
249 }).then(response => {
250 return response.json()
251 }).then(response => {
252 if (response.status == true) {
253 window.open(response.data.redirectUrl + '?__tagembed__paymentData=' + response.data.__tagembed__paymentData + '&__tagembed__requestCallBackUrl=' + response.data.__tagembed__requestCallBackUrl, '_self');
254 } else {
255 __tagembed__close_loader();
256 if (response.hasOwnProperty("message")) {
257 __tagembed__toast.danger({ message: response.message, position: '__tagembed__is-top-right' });
258 } else {
259 __tagembed__toast.danger({ message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right' });
260 }
261 }
262 }).catch((error) => {
263 console.log(error);
264 __tagembed__close_loader();
265 __tagembed__toast.danger({ message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right' });
266 });
267 }
268 }
269 /*--End-- Manage Payment*/
270 function __tagembed__cancel_subscription(planId) {
271 let __tagembed__toast = new TagembedToast;
272 if (!planId)
273 return __tagembed__toast.danger({ message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right' });
274 confirmDialog({ title: 'Are you sure!', message: 'Do you want to cancel subscription?', buttonText: 'Yes', type: 'danger' }, function () {
275 let formData = new FormData();
276 formData.append('planId', planId);
277 formData.append('action', 'data');
278 formData.append('__tagembed__ajax_call_nones', __tagembed__ajax_call_nones);
279 formData.append('__tagembed__ajax_action', '__tagembed__cancel_subscription');
280 __tagembed__open_loader();
281 var __tagembed__toast = new TagembedToast;
282 fetch(__tagembed__ajax_url, {
283 method: 'POST',
284 headers: {
285 'x-requested-with': 'XMLHttpRequest',
286 },
287 body: formData,
288 }).then(response => {
289 return response.json()
290 }).then(response => {
291 __tagembed__close_loader();
292 if (response.status == true) {
293 if (response.data.hasOwnProperty("message")) {
294 __tagembed__toast.success({ message: response.data.message, position: '__tagembed__is-top-right' });
295 }
296 setTimeout(function () {
297 window.open('https://tagembed.com/subscription-cancelled/', '_blank');
298 }, 3000);
299 } else {
300 if (response.hasOwnProperty("message")) {
301 __tagembed__toast.danger({ message: response.message, position: '__tagembed__is-top-right' });
302 } else {
303 __tagembed__toast.danger({ message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right' });
304 }
305 }
306 }).catch((error) => {
307 console.log(error);
308 __tagembed__close_loader();
309 __tagembed__toast.danger({ message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right' });
310 });
311 });
312 }
313 /*--Start--Hide Account Upgrade Modal*/
314 function __tagembed__hide_upgrade_account_popup() {
315 let __tagembed__upgrade_account_popup = document.querySelector("#__tagembed__upgrade_account_popup");
316 __tagembed__upgrade_account_popup.style.display = "none";
317 }
318 /*--End--Hide Account Upgrade Modal*/