PluginProbe
Tagembed: Social Media Feeds and Customer Reviews Widget / 4.7
Tagembed: Social Media Feeds and Customer Reviews Widget v4.7
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 / account / tagembed.account.script.js

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

171 lines 9.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 /*--Start-- Register*/
52 var __tagembed__register_form = document.querySelector("#__tagembed__register_form");
53 if (__tagembed__register_form) {
54 __tagembed__register_form.addEventListener("submit", function (event) {
55 __tagembed__manage_account_view('register');
56 let __tagembed__register_full_name_error = document.querySelector("#__tagembed__register_full_name_error");
57 __tagembed__register_full_name_error.style.display = 'none';
58 let __tagembed__register_email_id_error = document.querySelector("#__tagembed__register_email_id_error");
59 __tagembed__register_email_id_error.style.display = 'none';
60 let __tagembed__register_password_error = document.querySelector("#__tagembed__register_password_error");
61 __tagembed__register_password_error.style.display = 'none';
62 __tagembed__open_loader();
63 let __tagembed__toast = new TagembedToast;
64 let formData = document.querySelector("#__tagembed__register_form")
65 formData = new FormData(formData);
66 formData.append('action', 'data');
67 formData.append('__tagembed__ajax_call_nones', __tagembed__ajax_call_nones);
68 formData.append('__tagembed__ajax_action', '__tagembed__register');
69 fetch(__tagembed__ajax_url, {
70 method: 'POST',
71 headers: {
72 'x-requested-with': 'XMLHttpRequest',
73 },
74 body: formData,
75 }).then(response => {
76 return response.json();
77 }).then(response => {
78 __tagembed__close_loader();
79 if (response.status == true) {
80 window.location.replace(response.data.redirectUrl);
81 } else {
82 if (response.hasOwnProperty("data") && Object.keys(response.data).length > 0) {
83 if (response.data.hasOwnProperty("fullName")) {
84 __tagembed__register_full_name_error.style.display = 'block';
85 __tagembed__register_full_name_error.textContent = response.data.fullName;
86 }
87 if (response.data.hasOwnProperty("emailId")) {
88 __tagembed__register_email_id_error.style.display = 'block';
89 __tagembed__register_email_id_error.textContent = response.data.emailId;
90 }
91 if (response.data.hasOwnProperty("password")) {
92 __tagembed__register_password_error.style.display = 'block';
93 __tagembed__register_password_error.textContent = response.data.password;
94 }
95 /*--End-- Manage Validation Error*/
96 } else {
97 if (response.hasOwnProperty("message")) {
98 let __tagembed__account_error = document.querySelector("#__tagembed__account_error");
99 __tagembed__account_error.style.display = 'block';
100 __tagembed__account_error.textContent = response.message;
101 } else {
102 __tagembed__toast.danger({message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right'});
103 }
104 }
105 }
106 }).catch((error) => {
107 console.log(error);
108 __tagembed__close_loader();
109 __tagembed__toast.danger({message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right'});
110
111 });
112 });
113 }
114 /*--End-- Register*/
115 /*--Start-- Login*/
116 var __tagembed__login_form = document.querySelector("#__tagembed__login_form");
117 if (__tagembed__login_form) {
118 __tagembed__login_form.addEventListener("submit", function (event) {
119 __tagembed__manage_account_view('login');
120 let __tagembed__login_email_id_error = document.querySelector("#__tagembed__login_email_id_error");
121 __tagembed__login_email_id_error.style.display = 'none';
122 let __tagembed__login_password_error = document.querySelector("#__tagembed__login_password_error");
123 __tagembed__login_password_error.style.display = 'none';
124 __tagembed__open_loader();
125 let __tagembed__toast = new TagembedToast;
126 let formData = document.querySelector("#__tagembed__login_form")
127 formData = new FormData(formData);
128 formData.append('action', 'data');
129 formData.append('__tagembed__ajax_call_nones', __tagembed__ajax_call_nones);
130 formData.append('__tagembed__ajax_action', '__tagembed__login');
131 fetch(__tagembed__ajax_url, {
132 method: 'POST',
133 headers: {
134 'x-requested-with': 'XMLHttpRequest',
135 },
136 body: formData,
137 }).then(response => {
138 return response.json();
139 }).then(response => {
140 __tagembed__close_loader();
141 if (response.status == true) {
142 window.location.replace(response.data.redirectUrl);
143 } else {
144 if (response.hasOwnProperty("data") && Object.keys(response.data).length > 0) {
145 if (response.data.hasOwnProperty("emailId")) {
146 __tagembed__login_email_id_error.style.display = 'block';
147 __tagembed__login_email_id_error.textContent = response.data.emailId;
148 }
149 if (response.data.hasOwnProperty("password")) {
150 __tagembed__login_password_error.style.display = 'block';
151 __tagembed__login_password_error.textContent = response.data.password;
152 }
153 } else {
154 if (response.hasOwnProperty("message")) {
155 let __tagembed__account_error = document.querySelector("#__tagembed__account_error");
156 __tagembed__account_error.style.display = 'block';
157 __tagembed__account_error.textContent = response.message;
158 } else {
159 __tagembed__toast.danger({message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right'});
160 }
161 }
162 }
163 }).catch((error) => {
164 console.log(error);
165 __tagembed__close_loader();
166 __tagembed__toast.danger({message: "Something went wrong. Please try after sometime", position: '__tagembed__is-top-right'});
167
168 });
169 });
170 }
171 /*--End-- Login*/