UNPKG

isomtrik-quickchat

Version:

isomtrik-quickchat is a lightweight, real-time chat component built with Stencil JS. It is designed to be seamlessly integrated into web applications, offering customizable and responsive chat functionalities. The module supports both CommonJS and ES modu

2 lines 1.91 kB
export{f as format}from"./p-b07dd267.js";const t=function(t){if(!t.conversationId||!t.licenseKey||!t.appSecret||!t.userSecret||!t.userToken||!t.isometrikUserId||!t.projectId||!t.keysetId||!t.accountId){console.error("Missing required props to Initialize chat!");return}const o=document.getElementById(`${t.conversationId}`);if(o){console.warn(`Chat component for ${t.conversationId} already exists.`);return}const n=document.createElement("chat-test");n.id=t.conversationId;n.baseUrl=(t===null||t===void 0?void 0:t.baseUrl)||"https://apis.isometrik.io";n.hostUrl=(t===null||t===void 0?void 0:t.hostUrl)||"wss://connections.isometrik.io:2053/mqtt";n.licenseKey=t.licenseKey;n.appSecret=t.appSecret;n.userSecret=t.userSecret;n.userToken=t.userToken;n.isometrikUserId=t.isometrikUserId;n.projectId=t.projectId;n.keysetId=t.keysetId;n.accountId=t.accountId;n.conversationId=t.conversationId;n.isDark=t.defaultTheme=="dark"?true:false;n.darkThemeUrl=t.darkThemeUrl||"https://isometrik-website-bucket.s3.ap-south-1.amazonaws.com/styles/chat-dark-theme.css";n.lightThemeUrl=t.lightThemeUrl||"https://isometrik-website-bucket.s3.ap-south-1.amazonaws.com/styles/chat-light-theme.css";document.body.appendChild(n)};const o=function(t){if(!t){console.error("conversationId is require to closeChat");return}const o=document.getElementById(t);if(o){o.baseUrl=null;o.hostUrl=null;o.licenseKey=null;o.appSecret=null;o.userSecret=null;o.userToken=null;o.isometrikUserId=null;o.projectId=null;o.keysetId=null;o.accountId=null;o.conversationId=null;document.body.removeChild(o)}};const n=function(t){const o=document.getElementsByTagName("CHAT-TEST");for(let n=0;n<o.length;n++){const s=o[n];s.isDark=t=="dark"?true:false}};if(typeof window!=="undefined"){window.initializeChat=t;window.closeChat=o;window.switchChatTheme=n}export{o as closeChat,t as initializeChat,n as switchChatTheme}; //# sourceMappingURL=index.esm.js.map