post_enrollment_app/assets/botman_chat.html

152 lines
5.0 KiB
HTML
Executable File

<!--<!DOCTYPE html>-->
<!--<html lang="en">-->
<!--<head>-->
<!-- <meta charset="UTF-8" />-->
<!-- <style>-->
<!-- #botmanWidgetRoot svg {-->
<!-- display: none !important;-->
<!-- }-->
<!-- </style>-->
<!-- <script>-->
<!-- const APIENDPOINT = 'https://venbait.in/nhance/dev';-->
<!-- const APIAPIENDPOINT = 'https://venbait.in/nhance/dev';-->
<!-- var emp_name = 'Kumar';-->
<!-- var uid = Math.floor(100000 + Math.random() * 900000);-->
<!-- console.log('CURRENT_USER' + uid);-->
<!-- window.botmanWidget = {-->
<!-- chatServer: APIENDPOINT + '/chat',-->
<!-- frameEndpoint: APIAPIENDPOINT + '/widget',-->
<!-- title: 'Ask ILA',-->
<!-- introMessage: '',-->
<!-- bubbleBackground: '#007bff',-->
<!-- mainColor: '#007bff',-->
<!-- placeholderText: 'Type your message here...',-->
<!-- aboutText: 'Insurance Assistant ILA',-->
<!-- enableAttachments: false,-->
<!-- parameters: {-->
<!-- employee_id: '12288',-->
<!-- session_id: 'XYZ789',-->
<!-- origin: 'mobile',-->
<!-- emp_code: 'HTL-007',-->
<!-- client_id: 159,-->
<!-- client_branch_id: 125,-->
<!-- },-->
<!-- };-->
<!-- </script>-->
<!-- <script src="https://cdn.jsdelivr.net/npm/botman-web-widget@0/build/js/widget.js"></script>-->
<!--</head>-->
<!--<body></body>-->
<!--</html>-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Ask ILA</title>
<style>
#botmanWidgetRoot svg {
display: none !important;
}
</style>
</head>
<body>
<div id="botmanWidgetRoot"></div>
<!--<script>-->
<!-- function initBotman(params) {-->
<!--&lt;!&ndash; console.log('[Botman] Params:', params);&ndash;&gt;-->
<!-- console.log('[Botman] Received Params:', JSON.stringify(params, null, 2));-->
<!-- window.botmanWidget = {-->
<!-- chatServer: 'https://venbait.in/nhance/dev/chat',-->
<!-- frameEndpoint: 'https://venbait.in/nhance/dev/widget',-->
<!-- title: 'Ask ILA',-->
<!-- introMessage: '',-->
<!-- bubbleBackground: '#007bff',-->
<!-- mainColor: '#007bff',-->
<!-- placeholderText: 'Type your message here...',-->
<!-- aboutText: 'Insurance Assistant ILA',-->
<!-- enableAttachments: false,-->
<!-- parameters: params-->
<!-- };-->
<!-- const script = document.createElement('script');-->
<!-- script.src = "https://cdn.jsdelivr.net/npm/botman-web-widget@0/build/js/widget.js";-->
<!-- script.onload = () => {-->
<!-- const checkWidget = setInterval(() => {-->
<!-- if (typeof botmanChatWidget !== 'undefined') {-->
<!-- botmanChatWidget.open();-->
<!-- botmanChatWidget.sayAsBot(`Hi ${params.emp_name}, ILA here to assist you.`);-->
<!-- clearInterval(checkWidget);-->
<!-- }-->
<!-- }, 300);-->
<!-- };-->
<!-- document.body.appendChild(script);-->
<!-- }-->
<!--</script>-->
<script>
function initBotman(params) {
console.log('Params:', params);
console.log('[Botman] Received Params:', JSON.stringify(params, null, 2));
window.botmanWidget = {
chatServer: 'https://venbait.in/nhance/dev/chat',
frameEndpoint: 'https://venbait.in/nhance/dev/widget',
title: 'Ask ILA',
introMessage: '', // Must be empty if using sayAsBot()
bubbleBackground: '#007bff',
mainColor: '#007bff',
placeholderText: 'Type your message here...',
aboutText: 'Insurance Assistant ILA',
enableAttachments: false,
parameters: params
};
const script = document.createElement('script');
script.src = "https://cdn.jsdelivr.net/npm/botman-web-widget@0/build/js/widget.js";
script.onload = function () {
console.log("✅ Botman script loaded");
const waitForWidget = setInterval(() => {
if (typeof botmanChatWidget !== 'undefined' && botmanChatWidget.open) {
clearInterval(waitForWidget);
botmanChatWidget.open();
// Send default message after slight delay
setTimeout(() => {
botmanChatWidget.sayAsBot(`Hi ${params.emp_name || 'User'}, ILA here to assist you.`);
}, 800); // Allow chat to render
} else {
console.log("⏳ Waiting for botmanChatWidget...");
}
}, 300);
};
script.onerror = function () {
console.error("❌ Failed to load Botman widget.js");
};
document.body.appendChild(script);
}
</script>
<script>
const queryParams = new URLSearchParams(window.location.search);
const entries = Object.fromEntries(queryParams.entries());
document.write('<pre>' + JSON.stringify(entries, null, 2) + '</pre>');
</script>
</body>
</html>