Srinivasulu kethanaboina commited on
Commit
0655866
·
verified ·
1 Parent(s): 990556b

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +1238 -172
index.html CHANGED
@@ -3,263 +3,1329 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>RedFerns Tech Chatbot</title>
7
- <link rel="stylesheet" href="style.css">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  </head>
9
  <body>
10
-
11
- <!-- Form Container -->
12
- <div id="form-container">
13
- <form id="user-form">
14
- <h2>We need basic information to guide you</h2>
15
- <input type="text" id="name" placeholder="Your Name" required>
16
- <input type="text" id="company" placeholder="Company Name" required>
17
- <input type="email" id="email" placeholder="Your Email" required>
18
-
19
- <div>
20
- <!-- Country Code Dropdown -->
21
- <select id="country-code" required>
22
- <option value="">Select a country</option>
23
- <option value="AF">Afghanistan (+93)</option>
24
- <option value="AL">Albania (+355)</option>
25
- </select>
26
- <input type="tel" id="phone" placeholder="Your Phone Number" required>
27
- </div>
28
-
29
- <button type="submit">Start Chat</button>
30
- </form>
31
  </div>
32
 
33
- <!-- Chatbox -->
34
- <div id="chat-box">
35
- <div id="chat-header">
 
36
  <span>FernAI</span>
37
- <span id="close-chat">&times;</span>
38
  </div>
39
- <div id="chat-body"></div>
40
- </div>
41
 
42
- <!-- Gradio Iframe -->
43
- <div id="gradio-iframe">
44
- <div id="gradio-header">
45
- <span>Chat With Expert</span>
46
- <span id="back-button">&larr;</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  </div>
48
- <iframe src="" id="gradio-frame" frameborder="0" style="width: 100%; height: 100%;"></iframe>
49
- </div>
50
 
51
- <!-- Chat Icon -->
52
- <div id="chat-icon">
53
- <img src="https://raw.githubusercontent.com/SRINIVASULU-2003/srinu/main/static/bot.png" alt="Chat Icon">
 
 
54
  </div>
55
 
56
  <script>
57
- // Elements
58
- const chatIcon = document.getElementById('chat-icon');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  const formContainer = document.getElementById('form-container');
60
  const chatBox = document.getElementById('chat-box');
 
61
  const gradioIframe = document.getElementById('gradio-iframe');
62
  const gradioFrame = document.getElementById('gradio-frame');
63
- const closeChat = document.getElementById('close-chat');
64
- const backButton = document.getElementById('back-button');
65
- const userForm = document.getElementById('user-form');
66
- const chatBody = document.getElementById('chat-body');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
  // Function to handle user input and display chat responses
69
  function handleUserInput(input) {
70
  // Display user message
71
  const userMessage = document.createElement('div');
72
- userMessage.className = 'message user-message';
73
  userMessage.textContent = input;
74
  chatBody.appendChild(userMessage);
 
75
  // Create bot response
76
  const botMessage = document.createElement('div');
77
- botMessage.className = 'message bot-message';
 
 
78
  switch (input) {
79
  case 'Know more about RedFerns Tech':
80
  botMessage.innerHTML = `
81
- RedFerns Tech is a leading technology solutions provider specializing in Salesforce consultancy, Zoho services, ServiceNow implementation, and Data Science solutions.
82
- <button onclick="handleUserInput('Menu')">Menu</button>
 
 
83
  `;
84
  break;
85
  case 'Our services':
86
  botMessage.innerHTML = `
87
  We offer a range of services tailored to your needs. Please choose one:
88
- <button onclick="handleUserInput('Salesforce')">Salesforce</button>
89
- <button onclick="handleUserInput('Zoho')">Zoho</button>
90
- <button onclick="handleUserInput('Machine Learning')">Machine Learning</button>
91
- <button onclick="handleUserInput('Data Science')">Data Science</button>
92
- <button onclick="handleUserInput('Menu')">Menu</button>
 
 
93
  `;
94
  break;
95
  case 'Salesforce':
96
  botMessage.innerHTML = `
97
  We offer a range of services tailored to your needs. Please choose one:
98
- <button onclick="handleUserInput('Lightning Service')">Lightning Service</button>
99
- <button onclick="handleUserInput('Admin Support')">Admin Support</button>
100
- <button onclick="handleUserInput('App Development')">App Development</button>
101
- <button onclick="handleUserInput('Sites and Communities')">Sites and Communities</button>
102
- <button onclick="handleUserInput('Menu')">Menu</button>
 
 
103
  `;
104
  break;
105
  case 'Our products':
106
  botMessage.innerHTML = `
107
  We offer a range of services tailored to your needs. Please choose one:
108
- <button onclick="handleUserInput('currency conversion app')">Currency Conversion App</button>
109
- <button onclick="handleUserInput('mass approvals app')">Mass Approvals App</button>
110
- <button onclick="handleUserInput('thumbnail viewer app')">Thumbnail Viewer App</button>
111
- <button onclick="handleUserInput('product filter app')">Product Filter App</button>
112
- <button onclick="handleUserInput('Menu')">Menu</button>
113
- `;
114
- break;
115
- case 'Menu':
116
- botMessage.innerHTML = `
117
- <p>Hi! Welcome to RedFerns Tech! I'm FernAI, here to help you explore our innovative solutions and services. Please select from below:</p>
118
- <button onclick="handleUserInput('Know more about RedFerns Tech')">Know more about RedFerns Tech</button>
119
- <button onclick="handleUserInput('Our services')">Our services</button>
120
- <button onclick="handleUserInput('Our products')">Our products</button>
121
- <button onclick="handleUserInput('career opportunities')">Career Opportunities</button>
122
- <button onclick="handleUserInput('chat with expert')">Chat With Expert</button>
123
- <button onclick="handleUserInput('Appointment Booking')">Appointment Booking</button>
124
  `;
125
  break;
126
- case 'Appointment Booking':
127
- botMessage.innerHTML = `
128
- Please provide the following details to book an appointment:
129
- <br><br>
130
- <label for="phoneNumber">Phone Number:</label>
131
- <input type="text" id="phoneNumber" placeholder="Enter your phone number" />
132
- <br>
133
- <label for="appointmentDate">Preferred Date:</label>
134
- <input type="date" id="appointmentDate" />
135
- <br>
136
- <label for="appointmentTime">Preferred Time:</label>
137
- <input type="time" id="appointmentTime" />
138
- <br><br>
139
- <button onclick="submitAppointment()">Submit Appointment</button>
 
 
 
 
 
140
  `;
141
  break;
 
 
142
  case 'Zoho':
143
- botMessage.textContent = 'Link is Opening';
144
- window.open('https://redfernstech.com/services-list/zoho-crm/', '_blank');
 
 
 
 
145
  break;
146
  case 'Machine Learning':
147
- botMessage.textContent = 'Link is Opening';
148
- window.open('https://redfernstech.com/services-list/machine-learning/', '_blank');
 
 
 
 
149
  break;
150
  case 'Data Science':
151
- botMessage.textContent = 'Link is Opening';
152
- window.open('https://redfernstech.com/services-list/data-science/', '_blank');
 
 
 
 
153
  break;
154
  case 'Lightning Service':
155
- botMessage.textContent = 'Link is Opening';
156
- window.open('https://redfernstech.com/services-list/salesforce-lightning-services/', '_blank');
 
 
 
 
157
  break;
158
  case 'App Development':
159
- botMessage.textContent = 'Link is Opening';
160
- window.open('https://redfernstech.com/services-list/salesforce-app-development/', '_blank');
 
 
 
 
161
  break;
162
- case 'Sites and Communities':
163
- botMessage.textContent = 'Link is Opening';
164
- window.open('https://redfernstech.com/services-list/salesforce-sites-communities/', '_blank');
 
 
 
 
165
  break;
166
  case 'Admin Support':
167
- botMessage.textContent = 'Link is Opening';
168
- window.open('https://redfernstech.com/services-list/salesforce-admin-and-support/', '_blank');
 
 
 
 
169
  break;
170
  case 'career opportunities':
171
- botMessage.textContent = 'Link is Opening';
172
- window.open('https://redfernstech.com/careers/', '_blank');
 
 
 
 
173
  break;
174
  case 'product filter app':
175
- botMessage.textContent = 'Link is Opening';
176
- window.open('https://appexchange.salesforce.com/appxListingDetail?listingId=a0N4V00000K23xNUAR', '_blank');
 
 
 
 
177
  break;
178
  case 'thumbnail viewer app':
179
- botMessage.textContent = 'Link is Opening';
180
- window.open('https://appexchange.salesforce.com/appxListingDetail?listingId=a0N4V00000K8u1dUAB', '_blank');
 
 
 
 
181
  break;
182
  case 'mass approvals app':
183
- botMessage.textContent = 'Link is Opening';
184
- window.open('https://appexchange.salesforce.com/appxListingDetail?listingId=a0N4V00000K24EdUAJ', '_blank');
 
 
 
 
185
  break;
186
  case 'currency conversion app':
187
- botMessage.textContent = 'Link is Opening';
188
- window.open('https://appexchange.salesforce.com/appxListingDetail?listingId=a0N4V00000K23oVUAR', '_blank');
 
 
 
 
 
 
 
 
 
 
 
 
189
  break;
190
  default:
191
- botMessage.textContent = 'Sorry, I didn\'t understand that.';
 
192
  }
193
  chatBody.appendChild(botMessage);
194
- chatBody.scrollTop = chatBody.scrollHeight; // Scroll to the bottom
195
  }
196
 
197
- // Handle the form submission
198
- userForm.addEventListener('submit', async (event) => {
199
- event.preventDefault(); // Prevent default form submission
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
 
201
- // Gather form data
202
- const name = document.getElementById('name').value;
203
- const company = document.getElementById('company').value;
204
- const email = document.getElementById('email').value;
205
- const countryCode = document.getElementById('country-code').value;
206
- const phone = document.getElementById('phone').value;
207
-
208
- // Prepare data to send to the server
209
- const formData = {
210
- name,
211
- company,
212
- email,
213
- countryCode,
214
- phone
215
- };
216
-
217
- try {
218
- // Send data to the new server URL
219
- const response = await fetch('https://srinuksv-fastapiyes.hf.space/webhook', {
220
- method: 'POST',
221
- headers: {
222
- 'Content-Type': 'application/json',
223
- },
224
- body: JSON.stringify(formData)
225
- });
226
-
227
- if (!response.ok) {
228
- throw new Error('Network response was not ok');
229
- }
230
 
231
- const result = await response.json();
232
- // Assuming the response contains a unique ID
233
- const uniqueID = result.id; // Update according to your server response structure
234
 
235
- // Open Gradio URL with unique ID
236
- gradioFrame.src = `https://srinuksv-fastapiyes.hf.space/ch/${uniqueID}`;
 
 
237
 
238
- // Hide form container and show Gradio iframe
239
- formContainer.style.display = 'none';
240
- gradioIframe.style.display = 'block';
 
 
241
 
242
- } catch (error) {
243
- console.error('There was a problem with the fetch operation:', error);
244
- // Handle error gracefully
245
- }
246
- });
247
 
248
- // Event listeners for chat icon and buttons
249
- chatIcon.addEventListener('click', () => {
250
- formContainer.style.display = 'block';
251
- chatBox.style.display = 'none';
252
- });
 
 
 
 
 
253
 
254
- closeChat.addEventListener('click', () => {
255
- chatBox.style.display = 'none';
256
- formContainer.style.display = 'block';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
  });
 
 
 
 
 
 
 
 
 
 
258
 
259
- backButton.addEventListener('click', () => {
 
 
 
 
 
 
 
260
  gradioIframe.style.display = 'none';
261
- formContainer.style.display = 'block';
262
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  </script>
264
  </body>
265
  </html>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Chatbot with Morph and Fade Animations</title>
7
+ <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap" rel="stylesheet">
8
+ <style>
9
+ body {
10
+ font-family: 'Poppins', sans-serif;
11
+ margin: 0;
12
+ padding: 0;
13
+ background-color: #ffffff00;
14
+ display: flex;
15
+ justify-content: center;
16
+ align-items: center;
17
+ height: 100vh;
18
+ }
19
+
20
+ .hover-button {
21
+ position: fixed;
22
+ bottom: 20px;
23
+ right: 20px;
24
+ width: auto;
25
+ height: 60px;
26
+ border-radius: 30px;
27
+ background-color: #de2127;
28
+ display: flex;
29
+ justify-content: center;
30
+ align-items: center;
31
+ cursor: pointer;
32
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
33
+ transition: transform 0.3s ease, opacity 0.3s ease;
34
+ z-index: 999;
35
+ padding: 0 20px;
36
+ box-sizing: border-box;
37
+ overflow: hidden;
38
+ }
39
+
40
+ .hover-button:hover {
41
+ transform: scale(1.05);
42
+ }
43
+
44
+ .hover-button img {
45
+ width: 30px;
46
+ height: 30px;
47
+ margin-right: 10px;
48
+ filter: invert(0.0) sepia(0.2) saturate(4) hue-rotate(300deg) brightness(0.8);
49
+ }
50
+
51
+ .hover-button span {
52
+ color: white;
53
+ font-size: 1em;
54
+ font-weight: bold;
55
+ }
56
+
57
+ .chatbot-popup {
58
+ position: fixed;
59
+ bottom: 20px;
60
+ right: 20px;
61
+ background: linear-gradient(135deg, #f0f4ff 0%, #ffd1d1 100%);
62
+ border-radius: 10px;
63
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
64
+ width: 450px;
65
+ max-height: 90vh;
66
+ height: 719px;
67
+ z-index: 10000;
68
+ display: flex;
69
+ flex-direction: column;
70
+ overflow: hidden;
71
+ opacity: 0;
72
+ transform: scale(0.7);
73
+ transition: transform 0.3s ease, opacity 0.3s ease;
74
+ visibility: hidden; /* Hidden by default */
75
+ }
76
+
77
+ .chatbot-popup.visible {
78
+ opacity: 1;
79
+ transform: scale(1);
80
+ visibility: visible;
81
+ }
82
+
83
+ .chat-header {
84
+ background-color: #CF2E2E;
85
+ color: #fff;
86
+ padding: 10px;
87
+ border-top-left-radius: 10px;
88
+ border-top-right-radius: 10px;
89
+ display: flex;
90
+ justify-content: space-between;
91
+ align-items: center;
92
+ }
93
+
94
+ .chat-header span {
95
+ font-weight: bold;
96
+ }
97
+
98
+ #close-btn {
99
+ background-color: transparent;
100
+ border: none;
101
+ color: #fff;
102
+ font-size: 24px;
103
+ cursor: pointer;
104
+ line-height: 1;
105
+ }
106
+
107
+ .chat-content {
108
+ flex: 1;
109
+ display: none; /* Initially hidden */
110
+ flex-direction: column;
111
+ overflow-y: auto;
112
+ padding: 20px;
113
+ max-height: calc(80vh - 60px);
114
+ }
115
+
116
+ .user-message, .bot-message {
117
+ padding: 10px 15px;
118
+ margin: 10px 0;
119
+ border-radius: 10px;
120
+ max-width: 80%;
121
+ word-wrap: break-word;
122
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
123
+ }
124
+
125
+ .user-message {
126
+ background-color: #E5E5EA;
127
+ align-self: flex-end;
128
+ display: flex;
129
+ align-items: center;
130
+ }
131
+
132
+ .bot-message {
133
+ background-color: #F1F0F0;
134
+ align-self: flex-start;
135
+ display: flex;
136
+ align-items: flex-start;
137
+ flex-direction: column;
138
+ max-width: 100%;
139
+ padding: 10px 15px;
140
+ margin: 10px 0;
141
+ border-radius: 10px;
142
+ box-shadow: 0 1px 3px rgba(0, 0, 0 ,0.1);
143
+ }
144
+
145
+ .message-content {
146
+ margin-left: 10px;
147
+ }
148
+
149
+ .user-message::before, .bot-message::before {
150
+ content: '';
151
+ width: 30px;
152
+ height: 30px;
153
+ background-size: cover;
154
+ border-radius: 50%;
155
+ }
156
+
157
+ .user-message::before {
158
+ background-image: url('https://github.com/SRINIVASULU-2003/srinu/blob/main/static/user.jpeg?raw=true');
159
+ }
160
+
161
+ .bot-message::before {
162
+ background-image: url('https://github.com/SRINIVASULU-2003/srinu/blob/main/static/bot.jpeg?raw=true');
163
+ }
164
+
165
+ .button-container {
166
+ display: grid;
167
+ grid-template-columns: 1fr 1fr;
168
+ gap: 10px;
169
+ margin-top: 10px;
170
+ width: 100%;
171
+ }
172
+
173
+ .button-container button {
174
+ background-color: #ef6a61;
175
+ color: #fff;
176
+ border: none;
177
+ border-radius: 5px;
178
+ padding: 10px 15px;
179
+ cursor: pointer;
180
+ font-size: 14px;
181
+ transition: background-color 0.3s ease;
182
+ text-align: center;
183
+ min-height: 44px;
184
+ }
185
+
186
+ .button-container button.large-button {
187
+ grid-column: span 2;
188
+ }
189
+
190
+ .button-container button:hover {
191
+ background-color: #f63838;
192
+ }
193
+
194
+ .gradio-container {
195
+ display: none;
196
+ margin-top: 10px;
197
+ height: calc(100% - 60px); /* Adjusted to fit within the chatbot */
198
+ position: relative; /* Added for positioning the back button */
199
+ }
200
+
201
+ .form-container {
202
+ padding: 20px 30px 30px 30px;
203
+ height: auto;
204
+ opacity: 1;
205
+ transition: opacity 0.3s ease;
206
+ overflow-y: auto;
207
+ max-height: calc(100vh - 150px);
208
+ flex: 1;
209
+ display: none; /* Initially hidden */
210
+ }
211
+
212
+ .form-container.visible {
213
+ display: block; /* Show when active */
214
+ }
215
+
216
+ .form-container h2 {
217
+ text-align: left;
218
+ margin-bottom: 5px;
219
+ font-size: 1.4em;
220
+ color: #333;
221
+ }
222
+
223
+ .form-container p {
224
+ text-align: left;
225
+ margin-bottom: 10px;
226
+ color: #666;
227
+ font-size: 0.9em;
228
+ }
229
+
230
+ .form {
231
+ width: 100%;
232
+ }
233
+
234
+ .form-control {
235
+ width: 100%;
236
+ margin-bottom: 10px;
237
+ }
238
+
239
+ .form-control label {
240
+ display: block;
241
+ margin-bottom: 5px;
242
+ font-size: 0.9em;
243
+ color: #333;
244
+ }
245
+
246
+ .form-control input, .form-control select {
247
+ width: 100%;
248
+ padding: 10px;
249
+ border: 1px solid #ddd;
250
+ border-radius: 8px;
251
+ box-sizing: border-box;
252
+ font-size: 1em;
253
+ background-color: #f9f9f9;
254
+ }
255
+
256
+ .form-control input:focus, .form-control select:focus {
257
+ outline: none;
258
+ border-color: #4a90e2;
259
+ background-color: #fff;
260
+ }
261
+
262
+ .required {
263
+ color: red;
264
+ }
265
+
266
+ .begin-button {
267
+ width: 100%;
268
+ padding: 10px;
269
+ background: #de2127;
270
+ border: none;
271
+ color: white;
272
+ font-size: 1em;
273
+ border-radius: 30px;
274
+ cursor: pointer;
275
+ transition: background-color 0.3s;
276
+ }
277
+
278
+ .begin-button:hover {
279
+ background-color: #a81a1d;
280
+ }
281
+
282
+ .close-button {
283
+ background-color: transparent;
284
+ border: none;
285
+ color: #fff;
286
+ font-size: 24px;
287
+ cursor: pointer;
288
+ line-height: 1;
289
+ }
290
+
291
+ .g-recaptcha {
292
+ display: flex;
293
+ justify-content: center;
294
+ margin-bottom: 10px;
295
+ transform: scale(0.8);
296
+ }
297
+
298
+ .g-recaptcha > div {
299
+ width: auto !important;
300
+ }
301
+
302
+ #back-to-chatbot-btn {
303
+ position: absolute;
304
+ top: 10px;
305
+ right: 10px;
306
+ background-color: #de2127;
307
+ color: white;
308
+ border: none;
309
+ padding: 5px 10px;
310
+ border-radius: 5px;
311
+ cursor: pointer;
312
+ font-size: 14px;
313
+ z-index: 1000;
314
+ }
315
+
316
+ #back-to-chatbot-btn:hover {
317
+ background-color: #a81a1d;
318
+ }
319
+ </style>
320
+ <script src="https://www.google.com/recaptcha/api.js" async defer></script>
321
  </head>
322
  <body>
323
+ <!-- Hover Button -->
324
+ <div class="hover-button" id="chatbot-button">
325
+ <img src="https://www.svgrepo.com/show/209115/chat.svg" alt="Chat Icon">
326
+ <span>How can I help you?</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
327
  </div>
328
 
329
+ <!-- Chatbot Popup -->
330
+ <div class="chatbot-popup" id="chatbot-popup">
331
+ <!-- Chat Header -->
332
+ <div class="chat-header">
333
  <span>FernAI</span>
334
+ <button id="close-btn" class="close-button">×</button>
335
  </div>
 
 
336
 
337
+ <!-- Form Container -->
338
+ <div id="form-container" class="form-container">
339
+ <h2>To guide you better, we need some basic information</h2>
340
+ <form id="form" class="form">
341
+ <div class="form-control">
342
+ <label for="username">Name <span class="required">*</span></label>
343
+ <input type="text" placeholder="First and Last Name" id="username" required />
344
+ </div>
345
+ <div class="form-control">
346
+ <label for="companyname">Company Name <span class="required">*</span></label>
347
+ <input type="text" placeholder="Company name" id="companyname" required />
348
+ </div>
349
+ <div class="form-control">
350
+ <label for="email">Email <span class="required">*</span></label>
351
+ <input type="email" placeholder="[email protected]" id="email" required />
352
+ </div>
353
+ <div class="form-control">
354
+ <label for="country">Country <span class="required">*</span></label>
355
+ <select id="country" required>
356
+ <option value="">Select a country</option>
357
+ <option value="AF">Afghanistan (+93)</option>
358
+ <option value="AL">Albania (+355)</option>
359
+ <option value="DZ">Algeria (+213)</option>
360
+ <option value="AS">American Samoa (+1-684)</option>
361
+ <option value="AD">Andorra (+376)</option>
362
+ <option value="AO">Angola (+244)</option>
363
+ <option value="AI">Anguilla (+1-264)</option>
364
+ <option value="AG">Antigua and Barbuda (+1-268)</option>
365
+ <option value="AR">Argentina (+54)</option>
366
+ <option value="AM">Armenia (+374)</option>
367
+ <option value="AW">Aruba (+297)</option>
368
+ <option value="AU">Australia (+61)</option>
369
+ <option value="AT">Austria (+43)</option>
370
+ <option value="AZ">Azerbaijan (+994)</option>
371
+ <option value="BS">Bahamas (+1-242)</option>
372
+ <option value="BH">Bahrain (+973)</option>
373
+ <option value="BD">Bangladesh (+880)</option>
374
+ <option value="BB">Barbados (+1-246)</option>
375
+ <option value="BY">Belarus (+375)</option>
376
+ <option value="BE">Belgium (+32)</option>
377
+ <option value="BZ">Belize (+501)</option>
378
+ <option value="BJ">Benin (+229)</option>
379
+ <option value="BM">Bermuda (+1-441)</option>
380
+ <option value="BT">Bhutan (+975)</option>
381
+ <option value="BO">Bolivia (+591)</option>
382
+ <option value="BA">Bosnia and Herzegovina (+387)</option>
383
+ <option value="BW">Botswana (+267)</option>
384
+ <option value="BR">Brazil (+55)</option>
385
+ <option value="IO">British Indian Ocean Territory (+246)</option>
386
+ <option value="VG">British Virgin Islands (+1-284)</option>
387
+ <option value="BN">Brunei (+673)</option>
388
+ <option value="BG">Bulgaria (+359)</option>
389
+ <option value="BF">Burkina Faso (+226)</option>
390
+ <option value="BI">Burundi (+257)</option>
391
+ <option value="KH">Cambodia (+855)</option>
392
+ <option value="CM">Cameroon (+237)</option>
393
+ <option value="CA">Canada (+1)</option>
394
+ <option value="CV">Cape Verde (+238)</option>
395
+ <option value="KY">Cayman Islands (+1-345)</option>
396
+ <option value="CF">Central African Republic (+236)</option>
397
+ <option value="TD">Chad (+235)</option>
398
+ <option value="CL">Chile (+56)</option>
399
+ <option value="CN">China (+86)</option>
400
+ <option value="CX">Christmas Island (+61)</option>
401
+ <option value="CC">Cocos Islands (+61)</option>
402
+ <option value="CO">Colombia (+57)</option>
403
+ <option value="KM">Comoros (+269)</option>
404
+ <option value="CK">Cook Islands (+682)</option>
405
+ <option value="CR">Costa Rica (+506)</option>
406
+ <option value="HR">Croatia (+385)</option>
407
+ <option value="CU">Cuba (+53)</option>
408
+ <option value="CW">Curacao (+599)</option>
409
+ <option value="CY">Cyprus (+357)</option>
410
+ <option value="CZ">Czech Republic (+420)</option>
411
+ <option value="CD">Democratic Republic of the Congo (+243)</option>
412
+ <option value="DK">Denmark (+45)</option>
413
+ <option value="DJ">Djibouti (+253)</option>
414
+ <option value="DM">Dominica (+1-767)</option>
415
+ <option value="DO">Dominican Republic (+1-809)</option>
416
+ <option value="TL">East Timor (+670)</option>
417
+ <option value="EC">Ecuador (+593)</option>
418
+ <option value="EG">Egypt (+20)</option>
419
+ <option value="SV">El Salvador (+503)</option>
420
+ <option value="GQ">Equatorial Guinea (+240)</option>
421
+ <option value="ER">Eritrea (+291)</option>
422
+ <option value="EE">Estonia (+372)</option>
423
+ <option value="ET">Ethiopia (+251)</option>
424
+ <option value="FK">Falkland Islands (+500)</option>
425
+ <option value="FO">Faroe Islands (+298)</option>
426
+ <option value="FJ">Fiji (+679)</option>
427
+ <option value="FI">Finland (+358)</option>
428
+ <option value="FR">France (+33)</option>
429
+ <option value="PF">French Polynesia (+689)</option>
430
+ <option value="GA">Gabon (+241)</option>
431
+ <option value="GM">Gambia (+220)</option>
432
+ <option value="GE">Georgia (+995)</option>
433
+ <option value="DE">Germany (+49)</option>
434
+ <option value="GH">Ghana (+233)</option>
435
+ <option value="GI">Gibraltar (+350)</option>
436
+ <option value="GR">Greece (+30)</option>
437
+ <option value="GL">Greenland (+299)</option>
438
+ <option value="GD">Grenada (+1-473)</option>
439
+ <option value="GU">Guam (+1-671)</option>
440
+ <option value="GT">Guatemala (+502)</option>
441
+ <option value="GN">Guinea (+224)</option>
442
+ <option value="GW">Guinea-Bissau (+245)</option>
443
+ <option value="GY">Guyana (+592)</option>
444
+ <option value="HT">Haiti (+509)</option>
445
+ <option value="HN">Honduras (+504)</option>
446
+ <option value="HK">Hong Kong (+852)</option>
447
+ <option value="HU">Hungary (+36)</option>
448
+ <option value="IS">Iceland (+354)</option>
449
+ <option value="IN">India (+91)</option>
450
+ <option value="ID">Indonesia (+62)</option>
451
+ <option value="IR">Iran (+98)</option>
452
+ <option value="IQ">Iraq (+964)</option>
453
+ <option value="IE">Ireland (+353)</option>
454
+ <option value="IM">Isle of Man (+44-1624)</option>
455
+ <option value="IL">Israel (+972)</option>
456
+ <option value="IT">Italy (+39)</option>
457
+ <option value="CI">Ivory Coast (+225)</option>
458
+ <option value="JM">Jamaica (+1-876)</option>
459
+ <option value="JP">Japan (+81)</option>
460
+ <option value="JE">Jersey (+44-1534)</option>
461
+ <option value="JO">Jordan (+962)</option>
462
+ <option value="KZ">Kazakhstan (+7)</option>
463
+ <option value="KE">Kenya (+254)</option>
464
+ <option value="KI">Kiribati (+686)</option>
465
+ <option value="XK">Kosovo (+383)</option>
466
+ <option value="KW">Kuwait (+965)</option>
467
+ <option value="KG">Kyrgyzstan (+996)</option>
468
+ <option value="LA">Laos (+856)</option>
469
+ <option value="LV">Latvia (+371)</option>
470
+ <option value="LB">Lebanon (+961)</option>
471
+ <option value="LS">Lesotho (+266)</option>
472
+ <option value="LR">Liberia (+231)</option>
473
+ <option value="LY">Libya (+218)</option>
474
+ <option value="LI">Liechtenstein (+423)</option>
475
+ <option value="LT">Lithuania (+370)</option>
476
+ <option value="LU">Luxembourg (+352)</option>
477
+ <option value="MO">Macau (+853)</option>
478
+ <option value="MK">Macedonia (+389)</option>
479
+ <option value="MG">Madagascar (+261)</option>
480
+ <option value="MW">Malawi (+265)</option>
481
+ <option value="MY">Malaysia (+60)</option>
482
+ <option value="MV">Maldives (+960)</option>
483
+ <option value="ML">Mali (+223)</option>
484
+ <option value="MT">Malta (+356)</option>
485
+ <option value="MH">Marshall Islands (+692)</option>
486
+ <option value="MR">Mauritania (+222)</option>
487
+ <option value="MU">Mauritius (+230)</option>
488
+ <option value="YT">Mayotte (+262)</option>
489
+ <option value="MX">Mexico (+52)</option>
490
+ <option value="FM">Micronesia (+691)</option>
491
+ <option value="MD">Moldova (+373)</option>
492
+ <option value="MC">Monaco (+377)</option>
493
+ <option value="MN">Mongolia (+976)</option>
494
+ <option value="ME">Montenegro (+382)</option>
495
+ <option value="MS">Montserrat (+1-664)</option>
496
+ <option value="MA">Morocco (+212)</option>
497
+ <option value="MZ">Mozambique (+258)</option>
498
+ <option value="MM">Myanmar (+95)</option>
499
+ <option value="NA">Namibia (+264)</option>
500
+ <option value="NR">Nauru (+674)</option>
501
+ <option value="NP">Nepal (+977)</option>
502
+ <option value="NL">Netherlands (+31)</option>
503
+ <option value="NC">New Caledonia (+687)</option>
504
+ <option value="NZ">New Zealand (+64)</option>
505
+ <option value="NI">Nicaragua (+505)</option>
506
+ <option value="NE">Niger (+227)</option>
507
+ <option value="NG">Nigeria (+234)</option>
508
+ <option value="NU">Niue (+683)</option>
509
+ <option value="KP">North Korea (+850)</option>
510
+ <option value="MP">Northern Mariana Islands (+1-670)</option>
511
+ <option value="NO">Norway (+47)</option>
512
+ <option value="OM">Oman (+968)</option>
513
+ <option value="PK">Pakistan (+92)</option>
514
+ <option value="PW">Palau (+680)</option>
515
+ <option value="PS">Palestine (+970)</option>
516
+ <option value="PA">Panama (+507)</option>
517
+ <option value="PG">Papua New Guinea (+675)</option>
518
+ <option value="PY">Paraguay (+595)</option>
519
+ <option value="PE">Peru (+51)</option>
520
+ <option value="PH">Philippines (+63)</option>
521
+ <option value="PN">Pitcairn (+64)</option>
522
+ <option value="PL">Poland (+48)</option>
523
+ <option value="PT">Portugal (+351)</option>
524
+ <option value="PR">Puerto Rico (+1-787)</option>
525
+ <option value="QA">Qatar (+974)</option>
526
+ <option value="CG">Republic of the Congo (+242)</option>
527
+ <option value="RE">Reunion (+262)</option>
528
+ <option value="RO">Romania (+40)</option>
529
+ <option value="RU">Russia (+7)</option>
530
+ <option value="RW">Rwanda (+250)</option>
531
+ <option value="BL">Saint Barthelemy (+590)</option>
532
+ <option value="SH">Saint Helena (+290)</option>
533
+ <option value="KN">Saint Kitts and Nevis (+1-869)</option>
534
+ <option value="LC">Saint Lucia (+1-758)</option>
535
+ <option value="MF">Saint Martin (+590)</option>
536
+ <option value="PM">Saint Pierre and Miquelon (+508)</option>
537
+ <option value="VC">Saint Vincent and the Grenadines (+1-784)</option>
538
+ <option value="WS">Samoa (+685)</option>
539
+ <option value="SM">San Marino (+378)</option>
540
+ <option value="ST">Sao Tome and Principe (+239)</option>
541
+ <option value="SA">Saudi Arabia (+966)</option>
542
+ <option value="SN">Senegal (+221)</option>
543
+ <option value="RS">Serbia (+381)</option>
544
+ <option value="SC">Seychelles (+248)</option>
545
+ <option value="SL">Sierra Leone (+232)</option>
546
+ <option value="SG">Singapore (+65)</option>
547
+ <option value="SX">Sint Maarten (+1-721)</option>
548
+ <option value="SK">Slovakia (+421)</option>
549
+ <option value="SI">Slovenia (+386)</option>
550
+ <option value="SB">Solomon Islands (+677)</option>
551
+ <option value="SO">Somalia (+252)</option>
552
+ <option value="ZA">South Africa (+27)</option>
553
+ <option value="KR">South Korea (+82)</option>
554
+ <option value="SS">South Sudan (+211)</option>
555
+ <option value="ES">Spain (+34)</option>
556
+ <option value="LK">Sri Lanka (+94)</option>
557
+ <option value="SD">Sudan (+249)</option>
558
+ <option value="SR">Suriname (+597)</option>
559
+ <option value="SJ">Svalbard and Jan Mayen (+47)</option>
560
+ <option value="SZ">Swaziland (+268)</option>
561
+ <option value="SE">Sweden (+46)</option>
562
+ <option value="CH">Switzerland (+41)</option>
563
+ <option value="SY">Syria (+963)</option>
564
+ <option value="TW">Taiwan (+886)</option>
565
+ <option value="TJ">Tajikistan (+992)</option>
566
+ <option value="TZ">Tanzania (+255)</option>
567
+ <option value="TH">Thailand (+66)</option>
568
+ <option value="TG">Togo (+228)</option>
569
+ <option value="TK">Tokelau (+690)</option>
570
+ <option value="TO">Tonga (+676)</option>
571
+ <option value="TT">Trinidad and Tobago (+1-868)</option>
572
+ <option value="TN">Tunisia (+216)</option>
573
+ <option value="TR">Turkey (+90)</option>
574
+ <option value="TM">Turkmenistan (+993)</option>
575
+ <option value="TC">Turks and Caicos Islands (+1-649)</option>
576
+ <option value="TV">Tuvalu (+688)</option>
577
+ <option value="VI">U.S. Virgin Islands (+1-340)</option>
578
+ <option value="UG">Uganda (+256)</option>
579
+ <option value="UA">Ukraine (+380)</option>
580
+ <option value="AE">United Arab Emirates (+971)</option>
581
+ <option value="GB">United Kingdom (+44)</option>
582
+ <option value="US">United States (+1)</option>
583
+ <option value="UY">Uruguay (+598)</option>
584
+ <option value="UZ">Uzbekistan (+998)</option>
585
+ <option value="VU">Vanuatu (+678)</option>
586
+ <option value="VA">Vatican (+39-06)</option>
587
+ <option value="VE">Venezuela (+58)</option>
588
+ <option value="VN">Vietnam (+84)</option>
589
+ <option value="WF">Wallis and Futuna (+681)</option>
590
+ <option value="EH">Western Sahara (+212)</option>
591
+ <option value="YE">Yemen (+967)</option>
592
+ <option value="ZM">Zambia (+260)</option>
593
+ <option value="ZW">Zimbabwe (+263)</option>
594
+ </select>
595
+ </div>
596
+ <div class="form-control">
597
+ <label for="phone">Phone</label>
598
+ <input type="tel" placeholder="Phone" id="phone" />
599
+ </div>
600
+ <div class="g-recaptcha" data-sitekey="6LfAXQIqAAAAANA8I1vdofDPvxatWH8H3Als1XfM"></div>
601
+ <button type="submit" class="begin-button">Let's Begin</button>
602
+ </form>
603
+ </div>
604
+
605
+ <!-- Chat Content -->
606
+ <div id="chat-box" class="chat-content">
607
+ <div id="chat-body" class="chat-body"></div>
608
  </div>
 
 
609
 
610
+ <!-- Gradio Container -->
611
+ <div class="gradio-container" id="gradio-iframe">
612
+ <iframe id="gradio-frame" src="" style="width:100%; height:100%; border:none;"></iframe>
613
+ <button id="back-to-chatbot-btn">Back to Chatbot</button>
614
+ </div>
615
  </div>
616
 
617
  <script>
618
+
619
+ const countrySelect = document.getElementById('country');
620
+ const phoneInput = document.getElementById('phone');
621
+
622
+ const countryCodes = {
623
+ 'AF': '+93',
624
+ 'AL': '+355',
625
+ 'DZ': '+213',
626
+ 'AS': '+1-684',
627
+ 'AD': '+376',
628
+ 'AO': '+244',
629
+ 'AI': '+1-264',
630
+ 'AG': '+1-268',
631
+ 'AR': '+54',
632
+ 'AM': '+374',
633
+ 'AW': '+297',
634
+ 'AU': '+61',
635
+ 'AT': '+43',
636
+ 'AZ': '+994',
637
+ 'BS': '+1-242',
638
+ 'BH': '+973',
639
+ 'BD': '+880',
640
+ 'BB': '+1-246',
641
+ 'BY': '+375',
642
+ 'BE': '+32',
643
+ 'BZ': '+501',
644
+ 'BJ': '+229',
645
+ 'BM': '+1-441',
646
+ 'BT': '+975',
647
+ 'BO': '+591',
648
+ 'BA': '+387',
649
+ 'BW': '+267',
650
+ 'BR': '+55',
651
+ 'IO': '+246',
652
+ 'VG': '+1-284',
653
+ 'BN': '+673',
654
+ 'BG': '+359',
655
+ 'BF': '+226',
656
+ 'BI': '+257',
657
+ 'KH': '+855',
658
+ 'CM': '+237',
659
+ 'CA': '+1',
660
+ 'CV': '+238',
661
+ 'KY': '+1-345',
662
+ 'CF': '+236',
663
+ 'TD': '+235',
664
+ 'CL': '+56',
665
+ 'CN': '+86',
666
+ 'CX': '+61',
667
+ 'CC': '+61',
668
+ 'CO': '+57',
669
+ 'KM': '+269',
670
+ 'CK': '+682',
671
+ 'CR': '+506',
672
+ 'HR': '+385',
673
+ 'CU': '+53',
674
+ 'CW': '+599',
675
+ 'CY': '+357',
676
+ 'CZ': '+420',
677
+ 'CD': '+243',
678
+ 'DK': '+45',
679
+ 'DJ': '+253',
680
+ 'DM': '+1-767',
681
+ 'DO': '+1-809',
682
+ 'TL': '+670',
683
+ 'EC': '+593',
684
+ 'EG': '+20',
685
+ 'SV': '+503',
686
+ 'GQ': '+240',
687
+ 'ER': '+291',
688
+ 'EE': '+372',
689
+ 'ET': '+251',
690
+ 'FK': '+500',
691
+ 'FO': '+298',
692
+ 'FJ': '+679',
693
+ 'FI': '+358',
694
+ 'FR': '+33',
695
+ 'PF': '+689',
696
+ 'GA': '+241',
697
+ 'GM': '+220',
698
+ 'GE': '+995',
699
+ 'DE': '+49',
700
+ 'GH': '+233',
701
+ 'GI': '+350',
702
+ 'GR': '+30',
703
+ 'GL': '+299',
704
+ 'GD': '+1-473',
705
+ 'GU': '+1-671',
706
+ 'GT': '+502',
707
+ 'GN': '+224',
708
+ 'GW': '+245',
709
+ 'GY': '+592',
710
+ 'HT': '+509',
711
+ 'HN': '+504',
712
+ 'HK': '+852',
713
+ 'HU': '+36',
714
+ 'IS': '+354',
715
+ 'IN': '+91',
716
+ 'ID': '+62',
717
+ 'IR': '+98',
718
+ 'IQ': '+964',
719
+ 'IE': '+353',
720
+ 'IM': '+44-1624',
721
+ 'IL': '+972',
722
+ 'IT': '+39',
723
+ 'CI': '+225',
724
+ 'JM': '+1-876',
725
+ 'JP': '+81',
726
+ 'JE': '+44-1534',
727
+ 'JO': '+962',
728
+ 'KZ': '+7',
729
+ 'KE': '+254',
730
+ 'KI': '+686',
731
+ 'XK': '+383',
732
+ 'KW': '+965',
733
+ 'KG': '+996',
734
+ 'LA': '+856',
735
+ 'LV': '+371',
736
+ 'LB': '+961',
737
+ 'LS': '+266',
738
+ 'LR': '+231',
739
+ 'LY': '+218',
740
+ 'LI': '+423',
741
+ 'LT': '+370',
742
+ 'LU': '+352',
743
+ 'MO': '+853',
744
+ 'MK': '+389',
745
+ 'MG': '+261',
746
+ 'MW': '+265',
747
+ 'MY': '+60',
748
+ 'MV': '+960',
749
+ 'ML': '+223',
750
+ 'MT': '+356',
751
+ 'MH': '+692',
752
+ 'MR': '+222',
753
+ 'MU': '+230',
754
+ 'YT': '+262',
755
+ 'MX': '+52',
756
+ 'FM': '+691',
757
+ 'MD': '+373',
758
+ 'MC': '+377',
759
+ 'MN': '+976',
760
+ 'ME': '+382',
761
+ 'MS': '+1-664',
762
+ 'MA': '+212',
763
+ 'MZ': '+258',
764
+ 'MM': '+95',
765
+ 'NA': '+264',
766
+ 'NR': '+674',
767
+ 'NP': '+977',
768
+ 'NL': '+31',
769
+ 'NC': '+687',
770
+ 'NZ': '+64',
771
+ 'NI': '+505',
772
+ 'NE': '+227',
773
+ 'NG': '+234',
774
+ 'NU': '+683',
775
+ 'KP': '+850',
776
+ 'MP': '+1-670',
777
+ 'NO': '+47',
778
+ 'OM': '+968',
779
+ 'PK': '+92',
780
+ 'PW': '+680',
781
+ 'PS': '+970',
782
+ 'PA': '+507',
783
+ 'PG': '+675',
784
+ 'PY': '+595',
785
+ 'PE': '+51',
786
+ 'PH': '+63',
787
+ 'PN': '+64',
788
+ 'PL': '+48',
789
+ 'PT': '+351',
790
+ 'PR': '+1-787',
791
+ 'QA': '+974',
792
+ 'CG': '+242',
793
+ 'RE': '+262',
794
+ 'RO': '+40',
795
+ 'RU': '+7',
796
+ 'RW': '+250',
797
+ 'BL': '+590',
798
+ 'SH': '+290',
799
+ 'KN': '+1-869',
800
+ 'LC': '+1-758',
801
+ 'MF': '+590',
802
+ 'PM': '+508',
803
+ 'VC': '+1-784',
804
+ 'WS': '+685',
805
+ 'SM': '+378',
806
+ 'ST': '+239',
807
+ 'SA': '+966',
808
+ 'SN': '+221',
809
+ 'RS': '+381',
810
+ 'SC': '+248',
811
+ 'SL': '+232',
812
+ 'SG': '+65',
813
+ 'SX': '+1-721',
814
+ 'SK': '+421',
815
+ 'SI': '+386',
816
+ 'SB': '+677',
817
+ 'SO': '+252',
818
+ 'ZA': '+27',
819
+ 'KR': '+82',
820
+ 'SS': '+211',
821
+ 'ES': '+34',
822
+ 'LK': '+94',
823
+ 'SD': '+249',
824
+ 'SR': '+597',
825
+ 'SJ': '+47',
826
+ 'SZ': '+268',
827
+ 'SE': '+46',
828
+ 'CH': '+41',
829
+ 'SY': '+963',
830
+ 'TW': '+886',
831
+ 'TJ': '+992',
832
+ 'TZ': '+255',
833
+ 'TH': '+66',
834
+ 'TG': '+228',
835
+ 'TK': '+690',
836
+ 'TO': '+676',
837
+ 'TT': '+1-868',
838
+ 'TN': '+216',
839
+ 'TR': '+90',
840
+ 'TM': '+993',
841
+ 'TC': '+1-649',
842
+ 'TV': '+688',
843
+ 'VI': '+1-340',
844
+ 'UG': '+256',
845
+ 'UA': '+380',
846
+ 'AE': '+971',
847
+ 'GB': '+44',
848
+ 'US': '+1',
849
+ 'UY': '+598',
850
+ 'UZ': '+998',
851
+ 'VU': '+678',
852
+ 'VA': '+39-06',
853
+ 'VE': '+58',
854
+ 'VN': '+84',
855
+ 'WF': '+681',
856
+ 'EH': '+212',
857
+ 'YE': '+967',
858
+ 'ZM': '+260',
859
+ 'ZW': '+263'
860
+ };
861
+
862
+ countrySelect.addEventListener('change', function() {
863
+ const selectedCountry = this.value;
864
+ if (selectedCountry in countryCodes) {
865
+ phoneInput.value = countryCodes[selectedCountry] + ' ';
866
+ } else {
867
+ phoneInput.value = '';
868
+ }
869
+ });
870
+ // Get DOM Elements
871
+ const chatbotButton = document.getElementById('chatbot-button');
872
+ const chatbotPopup = document.getElementById('chatbot-popup');
873
  const formContainer = document.getElementById('form-container');
874
  const chatBox = document.getElementById('chat-box');
875
+ const chatBody = document.getElementById('chat-body');
876
  const gradioIframe = document.getElementById('gradio-iframe');
877
  const gradioFrame = document.getElementById('gradio-frame');
878
+ const closeButton = document.getElementById('close-btn');
879
+ const form = document.getElementById('form');
880
+ const backToChatbotBtn = document.getElementById('back-to-chatbot-btn');
881
+
882
+ // Check if the form was already submitted in the current session
883
+ const formSubmitted = sessionStorage.getItem('formSubmitted') === 'true';
884
+ let globalUniqueID; // Declare a global variable
885
+
886
+ const userForm = document.getElementById('form');
887
+
888
+ userForm.addEventListener('submit', async (event) => {
889
+ event.preventDefault(); // Prevent default form submission
890
+
891
+ // Gather form data
892
+ const name = document.getElementById('username').value;
893
+ const company = document.getElementById('companyname').value;
894
+ const email = document.getElementById('email').value;
895
+ const countryCode = document.getElementById('country').value;
896
+ const phone = document.getElementById('phone').value;
897
+
898
+ // Prepare data to send to the server
899
+ const formData = {
900
+ name,
901
+ company,
902
+ email,
903
+ countryCode,
904
+ phone
905
+ };
906
+
907
+ try {
908
+ // Send data to the new server URL
909
+ const response = await fetch('https://srinuksv-fastapiyes.hf.space/webhook', {
910
+ method: 'POST',
911
+ headers: {
912
+ 'Content-Type': 'application/json',
913
+ },
914
+ body: JSON.stringify(formData)
915
+ });
916
+
917
+ if (!response.ok) {
918
+ throw new Error('Network response was not ok');
919
+ }
920
+
921
+ const result = await response.json();
922
+ // Store the unique ID in the global variable
923
+ globalUniqueID = result.id;
924
+ console.log('Unique ID:', globalUniqueID);
925
+ } catch (error) {
926
+ console.error('Error:', error);
927
+ }
928
+ });
929
+
930
+
931
+
932
+
933
+ // Function to Open Chatbot
934
+ function openChatbot() {
935
+ chatbotPopup.classList.add('visible'); // Add the visible class to show the popup
936
+ chatbotButton.style.opacity = '0'; // Fade out the hover button
937
+ setTimeout(() => {
938
+ chatbotButton.style.display = 'none'; // Hide the hover button after fade out
939
+ }, 300);
940
+
941
+ if (formSubmitted) {
942
+ formContainer.style.display = 'none';
943
+ chatBox.style.display = 'flex';
944
+ initializeChat(); // Start chat if the form was already submitted
945
+ } else {
946
+ formContainer.style.display = 'block'; // Show form when opening
947
+ chatBox.style.display = 'none';
948
+ }
949
+ }
950
+
951
+ // Function to Close Chatbot
952
+ function closeChatbot() {
953
+ chatbotPopup.classList.remove('visible'); // Remove the visible class to hide the popup
954
+ setTimeout(() => {
955
+ chatbotButton.style.display = 'flex'; // Display the hover button before fading in
956
+ setTimeout(() => {
957
+ chatbotButton.style.opacity = '1'; // Fade in the hover button
958
+ }, 50);
959
+ }, 300);
960
+ }
961
+
962
+ // Handle Form Submission
963
+ form.addEventListener('submit', function(event) {
964
+ event.preventDefault(); // Prevent default form submission
965
+
966
+ let isValid = true;
967
+ const formControls = document.querySelectorAll('.form-control');
968
+
969
+ formControls.forEach(function(control) {
970
+ const input = control.querySelector('input, select');
971
+ if (input.hasAttribute('required') && !input.value.trim()) {
972
+ input.style.borderColor = 'red';
973
+ isValid = false;
974
+ } else {
975
+ input.style.borderColor = '#ddd';
976
+ }
977
+ });
978
+
979
+ const recaptchaResponse = grecaptcha.getResponse();
980
+ if (recaptchaResponse.length === 0) {
981
+ alert('Please complete the reCAPTCHA.');
982
+ isValid = false;
983
+ }
984
+
985
+ if (isValid) {
986
+ formContainer.style.display = 'none';
987
+ chatBox.style.display = 'flex';
988
+ sessionStorage.setItem('formSubmitted', 'true');
989
+ initializeChat(); // Initialize the chat after form submission
990
+ }
991
+ });
992
 
993
  // Function to handle user input and display chat responses
994
  function handleUserInput(input) {
995
  // Display user message
996
  const userMessage = document.createElement('div');
997
+ userMessage.className = 'user-message';
998
  userMessage.textContent = input;
999
  chatBody.appendChild(userMessage);
1000
+
1001
  // Create bot response
1002
  const botMessage = document.createElement('div');
1003
+ botMessage.className = 'bot-message';
1004
+
1005
+ // Define bot responses based on user input
1006
  switch (input) {
1007
  case 'Know more about RedFerns Tech':
1008
  botMessage.innerHTML = `
1009
+ RedFerns Tech is a leading technology solutions provider specializing in Salesforce consultancy, Zoho services, ServiceNow implementation and Data Science solutions.
1010
+ <div class="button-container">
1011
+ <button onclick="handleUserInput('Menu')">Menu</button>
1012
+ </div>
1013
  `;
1014
  break;
1015
  case 'Our services':
1016
  botMessage.innerHTML = `
1017
  We offer a range of services tailored to your needs. Please choose one:
1018
+ <div class="button-container">
1019
+ <button onclick="handleUserInput('Salesforce')">Salesforce</button>
1020
+ <button onclick="handleUserInput('Zoho')">Zoho</button>
1021
+ <button onclick="handleUserInput('Machine Learning')">Machine Learning</button>
1022
+ <button onclick="handleUserInput('Data Science')">Data Science</button>
1023
+ <button onclick="handleUserInput('Menu')">Menu</button>
1024
+ </div>
1025
  `;
1026
  break;
1027
  case 'Salesforce':
1028
  botMessage.innerHTML = `
1029
  We offer a range of services tailored to your needs. Please choose one:
1030
+ <div class="button-container">
1031
+ <button onclick="handleUserInput('Lightning Service')">Lightning Service</button>
1032
+ <button onclick="handleUserInput('Admin Support')">Admin Support</button>
1033
+ <button onclick="handleUserInput('App Development')">App Development</button>
1034
+ <button onclick="handleUserInput('Sites and Communities')">Sites and Communities</button>
1035
+ <button onclick="handleUserInput('Menu')">Menu</button>
1036
+ </div>
1037
  `;
1038
  break;
1039
  case 'Our products':
1040
  botMessage.innerHTML = `
1041
  We offer a range of services tailored to your needs. Please choose one:
1042
+ <div class="button-container">
1043
+ <button onclick="handleUserInput('currency conversion app')">Currency Conversion App</button>
1044
+ <button onclick="handleUserInput('mass approvals app')">Mass Approvals App</button>
1045
+ <button onclick="handleUserInput('thumbnail viewer app')">Thumbnail Viewer App</button>
1046
+ <button onclick="handleUserInput('product filter app')">Product Filter App</button>
1047
+ <button onclick="handleUserInput('Menu')">Menu</button>
1048
+ </div>
 
 
 
 
 
 
 
 
 
1049
  `;
1050
  break;
1051
+ case 'Menu':
1052
+ botMessage.innerHTML = `
1053
+ <p>Hi! Welcome to RedFerns Tech! I'm FernAI, here to help you explore our innovative solutions and services. Please select from below:</p>
1054
+ <div class="button-container">
1055
+ <button onclick="handleUserInput('Know more about RedFerns Tech')">Know more about RedFerns Tech</button>
1056
+ <button onclick="handleUserInput('Our services')">Our services</button>
1057
+ <button onclick="handleUserInput('Our products')">Our products</button>
1058
+ <button onclick="handleUserInput('career opportunities')">Career Opportunities</button>
1059
+ <button onclick="handleUserInput('chat with expert')">Chat With Expert</button>
1060
+ <button onclick="handleUserInput('Appointment Booking')">Appointment Booking</button>
1061
+ `;
1062
+ break;
1063
+
1064
+ case 'Appointment Booking':
1065
+ window.open('https://calendly.com/contactus-redfernstech', '_blank');
1066
+ botMessage.innerHTML = `
1067
+ <p>Book an Appointment or Go back to Menu:</p>
1068
+ <div class="button-container"w>
1069
+ <button onclick="handleUserInput('Menu')">Menu</button>
1070
  `;
1071
  break;
1072
+
1073
+
1074
  case 'Zoho':
1075
+ window.open('https://redfernstech.com/services-list/zoho-crm/', '_blank');
1076
+ botMessage.innerHTML = `
1077
+ <p>View Zoho Page or Go back to Menu:</p>
1078
+ <div class="button-container">
1079
+ <button onclick="handleUserInput('Menu')">Menu</button>
1080
+ `;
1081
  break;
1082
  case 'Machine Learning':
1083
+ window.open('https://redfernstech.com/services-list/machine-learning/', '_blank');
1084
+ botMessage.innerHTML = `
1085
+ <p>View Machine Learning Page or Go back to Menu:</p>
1086
+ <div class="button-container">
1087
+ <button onclick="handleUserInput('Menu')">Menu</button>
1088
+ `;
1089
  break;
1090
  case 'Data Science':
1091
+ window.open('https://redfernstech.com/services-list/data-science/', '_blank');
1092
+ botMessage.innerHTML = `
1093
+ <p>View Data Science Page or Go back to Menu:</p>
1094
+ <div class="button-container">
1095
+ <button onclick="handleUserInput('Menu')">Menu</button>
1096
+ `;
1097
  break;
1098
  case 'Lightning Service':
1099
+ window.open('https://redfernstech.com/services-list/salesforce-lightning-services/', '_blank');
1100
+ botMessage.innerHTML = `
1101
+ <p>View Lightning Service Page or Go back to Menu:</p>
1102
+ <div class="button-container">
1103
+ <button onclick="handleUserInput('Menu')">Menu</button>
1104
+ `;
1105
  break;
1106
  case 'App Development':
1107
+ window.open('https://redfernstech.com/services-list/salesforce-app-development/', '_blank');
1108
+ botMessage.innerHTML = `
1109
+ <p>View App Development Page or Go back to Menu:</p>
1110
+ <div class="button-container">
1111
+ <button onclick="handleUserInput('Menu')">Menu</button>
1112
+ `;
1113
  break;
1114
+ case 'Sites and Communities':
1115
+ window.open('https://redfernstech.com/services-list/salesforce-sites-communities/', '_blank');
1116
+ botMessage.innerHTML = `
1117
+ <p>View Sites and Communities Page or Go back to Menu:</p>
1118
+ <div class="button-container">
1119
+ <button onclick="handleUserInput('Menu')">Menu</button>
1120
+ `;
1121
  break;
1122
  case 'Admin Support':
1123
+ window.open('https://redfernstech.com/services-list/salesforce-admin-and-support/', '_blank');
1124
+ botMessage.innerHTML = `
1125
+ <p>View Admin Support Page or Go back to Menu:</p>
1126
+ <div class="button-container">
1127
+ <button onclick="handleUserInput('Menu')">Menu</button>
1128
+ `;
1129
  break;
1130
  case 'career opportunities':
1131
+ window.open('https://redfernstech.com/careers/', '_blank');
1132
+ botMessage.innerHTML = `
1133
+ <p>View Careers Page or Go back to Menu:</p>
1134
+ <div class="button-container">
1135
+ <button onclick="handleUserInput('Menu')">Menu</button>
1136
+ `;
1137
  break;
1138
  case 'product filter app':
1139
+ window.open('https://appexchange.salesforce.com/appxListingDetail?listingId=a0N4V00000K23xNUAR', '_blank');
1140
+ botMessage.innerHTML = `
1141
+ <p>View Product Filter App Page or Go back to Menu:</p>
1142
+ <div class="button-container">
1143
+ <button onclick="handleUserInput('Menu')">Menu</button>
1144
+ `;
1145
  break;
1146
  case 'thumbnail viewer app':
1147
+ window.open('https://appexchange.salesforce.com/appxListingDetail?listingId=a0N4V00000K8u1dUAB', '_blank');
1148
+ botMessage.innerHTML = `
1149
+ <p>View Thumbnail Viewer App Page or Go back to Menu:</p>
1150
+ <div class="button-container">
1151
+ <button onclick="handleUserInput('Menu')">Menu</button>
1152
+ `;
1153
  break;
1154
  case 'mass approvals app':
1155
+ window.open('https://appexchange.salesforce.com/appxListingDetail?listingId=a0N4V00000K24EdUAJ', '_blank');
1156
+ botMessage.innerHTML = `
1157
+ <p>View Mass Approvals App Page or Go back to Menu:</p>
1158
+ <div class="button-container">
1159
+ <button onclick="handleUserInput('Menu')">Menu</button>
1160
+ `;
1161
  break;
1162
  case 'currency conversion app':
1163
+ window.open('https://appexchange.salesforce.com/appxListingDetail?listingId=a0N4V00000Is77CUAR', '_blank');
1164
+ botMessage.innerHTML = `
1165
+ <p>View Currency Conversion App Page or Go back to Menu:</p>
1166
+ <div class="button-container">
1167
+ <button onclick="handleUserInput('Menu')">Menu</button>
1168
+ `;
1169
+ break;
1170
+ case 'chat with expert':
1171
+ // Show the iframe with the Gradio chatbot URL
1172
+ gradioIframe.style.display = 'flex';
1173
+ chatBox.style.display = 'none';
1174
+ formContainer.style.display = 'none';
1175
+ botMessage.textContent = 'Loading Salesforce chatbot...'; // Optional: Notify the user
1176
+ gradioFrame.src = `https://srinuksv-fastapiyes.hf.space/ch/${globalUniqueID}`; // Replace with your Gradio chatbot URL
1177
  break;
1178
  default:
1179
+ botMessage.textContent = 'Sorry, I didnt understand that. Can you please choose another option?';
1180
+ break;
1181
  }
1182
  chatBody.appendChild(botMessage);
1183
+ chatBody.scrollTop = chatBody.scrollHeight;
1184
  }
1185
 
1186
+ // Show form container
1187
+ function showForm() {
1188
+ formContainer.style.display = 'flex';
1189
+ chatBox.style.display = 'none';
1190
+ gradioIframe.style.display = 'none'; // Hide Gradio iframe if visible
1191
+ }
1192
+
1193
+ // Show chat box
1194
+ function showChat() {
1195
+ formContainer.style.display = 'none';
1196
+ chatBox.style.display = 'flex';
1197
+ gradioIframe.style.display = 'none'; // Hide Gradio iframe if visible
1198
+ initializeChat();
1199
+ }
1200
+
1201
+ // Show Gradio iframe
1202
+ function openGradioChat() {
1203
+ const chatbots = ["Lily", "Clara"];
1204
+ const selectedChatbot = chatbots[Math.floor(Math.random() * chatbots.length)];
1205
 
1206
+ // Hide form and chat box, display Gradio iframe
1207
+ formContainer.style.display = 'none';
1208
+ chatBox.style.display = 'none';
1209
+ gradioIframe.style.display = 'flex';
1210
+
1211
+ // Set the iframe source based on the selected chatbot
1212
+ if (selectedChatbot === "Clara") {
1213
+ gradioIframe.src = `https://srinuksv-fastapiyes.hf.space/ch/${globalUniqueID}`;
1214
+ } else {
1215
+ gradioIframe.src = `https://srinuksv-fastapiyes.hf.space/ch/${globalUniqueID}`;
1216
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1217
 
1218
+ }
 
 
1219
 
1220
+ function submitAppointment() {
1221
+ const phoneNumber = document.getElementById('phoneNumber').value;
1222
+ const appointmentDate = document.getElementById('appointmentDate').value;
1223
+ const appointmentTime = document.getElementById('appointmentTime').value;
1224
 
1225
+ // Split the date into year, month, and day
1226
+ const dateParts = appointmentDate.split('-'); // Assuming the format is YYYY-MM-DD
1227
+ const year = dateParts[0];
1228
+ const month = dateParts[1]; // Google Forms uses 1-indexed months
1229
+ const day = dateParts[2];
1230
 
1231
+ // Split the time into hour and minute
1232
+ const timeParts = appointmentTime.split(':'); // Assuming the format is HH:MM
1233
+ const hour = timeParts[0];
1234
+ const minute = timeParts[1];
 
1235
 
1236
+ if (phoneNumber && appointmentDate && appointmentTime) {
1237
+ // Google Form submission URL and entry IDs
1238
+ const googleFormURL = 'https://docs.google.com/forms/u/0/d/e/1FAIpQLSdLLMPObehQAPIJe26ALLP-uGiR_rTbFomaQ6jrYSDKDpC53Q/formResponse';
1239
+ const formData = new FormData();
1240
+ formData.append('entry.399768569', phoneNumber); // Phone number
1241
+ formData.append('entry.524576831_hour', hour); // Appointment hour
1242
+ formData.append('entry.524576831_minute', minute); // Appointment minute
1243
+ formData.append('entry.277009627_year', year); // Appointment year
1244
+ formData.append('entry.277009627_month', month); // Appointment month
1245
+ formData.append('entry.277009627_day', day); // Appointment day
1246
 
1247
+ // Send data to Google Form
1248
+ fetch(googleFormURL, {
1249
+ method: 'POST',
1250
+ body: formData,
1251
+ mode: 'no-cors' // To avoid CORS issues
1252
+ }).then(() => {
1253
+ const botMessage = document.createElement('div');
1254
+ botMessage.className = 'message bot-message';
1255
+ botMessage.innerHTML = `
1256
+ Appointment booked for ${appointmentDate} at ${appointmentTime}. We will contact you at ${phoneNumber}.
1257
+ <br><br>What would you like to do next?
1258
+ <button onclick="handleUserInput('Menu')">Return to Menu</button>
1259
+ `;
1260
+ chatBody.appendChild(botMessage);
1261
+ }).catch(() => {
1262
+ const botMessage = document.createElement('div');
1263
+ botMessage.className = 'message bot-message';
1264
+ botMessage.innerHTML = `
1265
+ There was an error booking your appointment. Please try again.
1266
+ <br><br>What would you like to do next?
1267
+ <button onclick="handleUserInput('Menu')">Return to Menu</button>
1268
+ `;
1269
+ chatBody.appendChild(botMessage);
1270
  });
1271
+ } else {
1272
+ const botMessage = document.createElement('div');
1273
+ botMessage.className = 'message bot-message';
1274
+ botMessage.innerHTML = `
1275
+ Please fill in all the details.
1276
+ <br><br>What would you like to do next?
1277
+ <button onclick="handleUserInput('Menu')">Return to Menu</button>
1278
+ `;
1279
+ chatBody.appendChild(botMessage);
1280
+ }
1281
 
1282
+ chatBody.scrollTop = chatBody.scrollHeight;
1283
+ }
1284
+
1285
+
1286
+ // Hide Gradio iframe and show chat box
1287
+ function goBackToChat() {
1288
+ formContainer.style.display = 'none';
1289
+ chatBox.style.display = 'flex';
1290
  gradioIframe.style.display = 'none';
1291
+ initializeChat();
1292
+ }
1293
+
1294
+ // Initialize chat
1295
+ function initializeChat() {
1296
+ chatBody.innerHTML = '';
1297
+ const welcomeMessage = document.createElement('div');
1298
+ welcomeMessage.className = 'message bot-message';
1299
+ welcomeMessage.innerHTML = `
1300
+ <p>Hi! Welcome to RedFerns Tech! I'm FernAI, here to help you explore our innovative solutions and services. Please select from below:</p>
1301
+ <div class="button-container">
1302
+ <button onclick="handleUserInput('Know more about RedFerns Tech')">Know more about RedFerns Tech</button>
1303
+ <button onclick="handleUserInput('Our services')">Our services</button>
1304
+ <button onclick="handleUserInput('Our products')">Our products</button>
1305
+ <button onclick="handleUserInput('career opportunities')">Career Opportunities</button>
1306
+ <button onclick="handleUserInput('chat with expert')">Chat With Expert</button>
1307
+ <button onclick="handleUserInput('Appointment Booking')">Appointment Booking</button>
1308
+ `;
1309
+ chatBody.appendChild(welcomeMessage);
1310
+ chatBody.scrollTop = chatBody.scrollHeight;
1311
+ }
1312
+
1313
+
1314
+ // Event Listeners
1315
+ chatbotButton.addEventListener('click', openChatbot);
1316
+ closeButton.addEventListener('click', closeChatbot);
1317
+ backToChatbotBtn.addEventListener('click', goBackToChat);
1318
+
1319
+ // Automatically open the chatbot if the form was submitted in the current session
1320
+ if (formSubmitted) {
1321
+ openChatbot();
1322
+ }
1323
+
1324
+
1325
+
1326
+
1327
+
1328
+
1329
  </script>
1330
  </body>
1331
  </html>