Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +17 -14
templates/index.html
CHANGED
@@ -121,8 +121,10 @@
|
|
121 |
let response = event.results[0][0].transcript.trim().toLowerCase();
|
122 |
recognition.stop();
|
123 |
if (response.includes("new")) {
|
|
|
124 |
captureEmail();
|
125 |
} else if (response.includes("existing")) {
|
|
|
126 |
captureEmail();
|
127 |
} else {
|
128 |
speak("I didn't understand. Please say 'new' for registration or 'existing' for login.", askLoginOrRegister);
|
@@ -152,20 +154,16 @@
|
|
152 |
}
|
153 |
|
154 |
function checkEmailExists(email) {
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
})
|
166 |
-
.catch(() => {
|
167 |
-
speak("Error checking email. Please try again.");
|
168 |
-
});
|
169 |
}
|
170 |
|
171 |
function showRegistrationForm() {
|
@@ -173,6 +171,11 @@
|
|
173 |
document.getElementById('loginForm').style.display = 'none';
|
174 |
}
|
175 |
|
|
|
|
|
|
|
|
|
|
|
176 |
function captureMobile() {
|
177 |
speak("Please say your 12-digit mobile number.", function () {
|
178 |
recognition.start();
|
|
|
121 |
let response = event.results[0][0].transcript.trim().toLowerCase();
|
122 |
recognition.stop();
|
123 |
if (response.includes("new")) {
|
124 |
+
showRegistrationForm();
|
125 |
captureEmail();
|
126 |
} else if (response.includes("existing")) {
|
127 |
+
showLoginForm();
|
128 |
captureEmail();
|
129 |
} else {
|
130 |
speak("I didn't understand. Please say 'new' for registration or 'existing' for login.", askLoginOrRegister);
|
|
|
154 |
}
|
155 |
|
156 |
function checkEmailExists(email) {
|
157 |
+
// Simulate checking if email exists in Salesforce (you can replace this with an actual API call)
|
158 |
+
const existingEmails = ["existing@domain.com"];
|
159 |
+
if (existingEmails.includes(email)) {
|
160 |
+
speak("Welcome back! You are logged in.");
|
161 |
+
document.getElementById('loginForm').style.display = 'block';
|
162 |
+
document.getElementById('registrationForm').style.display = 'none';
|
163 |
+
} else {
|
164 |
+
speak("You are a new customer. Please proceed with registration.");
|
165 |
+
showRegistrationForm();
|
166 |
+
}
|
|
|
|
|
|
|
|
|
167 |
}
|
168 |
|
169 |
function showRegistrationForm() {
|
|
|
171 |
document.getElementById('loginForm').style.display = 'none';
|
172 |
}
|
173 |
|
174 |
+
function showLoginForm() {
|
175 |
+
document.getElementById('loginForm').style.display = 'block';
|
176 |
+
document.getElementById('registrationForm').style.display = 'none';
|
177 |
+
}
|
178 |
+
|
179 |
function captureMobile() {
|
180 |
speak("Please say your 12-digit mobile number.", function () {
|
181 |
recognition.start();
|