1(()=>{const CHAT_BUBBLE_TEMPLATE_STYLE1=` 2 <div id="kenytChatBubble" class="unreadcount"> 3 <div id="kenytBubbleContainer" class="kchannels-container"> 4 <div class="kchannel-group"> 5 </div> 6 </div> 7 8 <div id="messageWrapperBox" class="kpopup-container chatWithUsMessageWrapper ktext-color"> 9 <div class="kpopup-text chatWithUsMessage"> 10 11 </div> 12 <button id="chatNowBtn" class="kprimary-color">Chat Now</button> 13 </div> 14 <div class="kbubble-container kprimary-bg kprimary-border"> 15 <div id="bubbleTail"></div> 16 <div class="img-container"> 17 </div> 18 </div> 19 <div class="kconnectors-container kprimary-bg kprimary-border"> 20 <div id="krazorpay-btn" class="krazorpay-btn k-hide connector"> 21 </div> 22 23 <div id="kcashfree-btn" class="kcashfree-btn k-hide connector"> 24 </div> 25 </div> 26 </div>`;const CHAT_BUBBLE_TEMPLATE_STYLE2=` 27 <div id="kenytChatBubble" class="unreadcount"> 28 <div class="kchannels-container"> 29 <div class="kstrip"> 30 </div> 31 <div class="kchannel-group"> 32 </div> 33 </div> 34 <div class="kpopup-container ksecondary-bg ktext-color"> 35 <div class="kpopup-text"> 36 </div> 37 </div> 38 <div class="kbubble-container kprimary-bg"> 39 <div class="img-container"> 40 </div> 41 </div> 42 <div class="kconnectors-container kprimary-bg kprimary-border"> 43 <div id="krazorpay-btn" class="krazorpay-btn k-hide connector"> 44 </div> 45 46 <div id="kcashfree-btn" class="kcashfree-btn k-hide connector"> 47 </div> 48 </div> 49 </div >`;const CHAT_BUBBLE_TEMPLATE_STYLE3=` 50 <div id="kenytChatBubble" class="unreadcount"> 51 <div id="kenytBubbleContainer" class="kchannels-container"> 52 <div class="kchannel-group"> 53 </div> 54 </div> 55 56 <div id="messageWrapperBox" class="kpopup-container chatWithUsMessageWrapper ktext-color"> 57 <div class="kpopup-text chatWithUsMessage"> 58 59 </div> 60 <button id="chatNowBtn" class="kprimary-color">Chat Now</button> 61 </div> 62 <div class="kbubble-container kprimary-bg kprimary-border"> 63 <div id="bubbleTail"></div> 64 <div class="img-container"> 65 </div> 66 </div> 67 <div class="kconnectors-container kprimary-bg kprimary-border"> 68 <div id="krazorpay-btn" class="krazorpay-btn k-hide connector"> 69 </div> 70 71 <div id="kcashfree-btn" class="kcashfree-btn k-hide connector"> 72 </div> 73 </div> 74 </div>`;const CHAT_BUBBLE_TEMPLATE_EMBEDDED=` 75 <div id="kenytChatBubble"> 76 <div class="kchannels-container k-d-none"> 77 <div class="kstrip"> 78 </div> 79 <div class="kchannel-group"> 80 </div> 81 </div> 82 <div class="kpopup-container ksecondary-bg ktext-color k-d-none"> 83 <div class="kpopup-text"> 84 </div> 85 </div> 86 <div class="kbubble-container kprimary-bg"> 87 <div class="img-container"> 88 </div> 89 </div> 90 <div class="kconnectors-container kprimary-bg kprimary-border k-d-none"> 91 <div id="krazorpay-btn" class="krazorpay-btn k-hide connector"> 92 </div> 93 94 <div id="kcashfree-btn" class="kcashfree-btn k-hide connector"> 95 </div> 96 </div> 97 </div >`;const BUBBLE_PRIMARY_BG="kprimary-bg";const BUBBLE_SECONDARY_BG="ksecondary-bg";const BUBBLE_SECONDARY_BG_VERTICAL="ksecondary-bg-v";const BUBBLE_TEXT_COLOR="ktext-color";const BUBBLE_PRIMARY_COLOR="kprimary-color";const BUBBLE_PRIMARY_BORDER="kprimary-border";const ENDPOINT="/api/chatwindow/getthemeconfig";const TRACKING_CONFIG_ENDPOINT="/api/tracking/config" 98const PROD_PREFIX="/botapp";const CHATBUBBLE_ID="kenytChatBubble";const TEXTBUBBLE_ID="kenytTextBubble";const WHATSAPPBUBBLE_ID="kenytWhatsappBubble";const FACEBOOKBUBBLE_ID="kenytFacebookBubble";const INSTAGRMBUBBLE_ID="kenytInstagramBubble";const PHONEBUBBLE_ID="kenytPhoneBubble";const EMAILBUBBLE_ID="kenytEmailBubble";const kenytChatWindowContainerId="chatbox-container";const IFRAME_ID="kenytChatWindow";const SCRIPT_NAME="bot-loader.js";const POSITION_RIGHT="right";const UNREAD_COUNT_SESSION_KEY="__kenytUnreadCount";const unreadCountAttribute="data-unreadcount";const POPUP_ANIMATION_TIME_SECONDS=2;const POPUP_READ_TIME_SECONDS=4;const POPUP_WAIT_TIME_SECONDS=10;const POPUP_CLOSE_AFTER_TIME=(POPUP_ANIMATION_TIME_SECONDS+POPUP_READ_TIME_SECONDS)*1000;const POPUP_REOPEN_TIME=(POPUP_WAIT_TIME_SECONDS+POPUP_READ_TIME_SECONDS+2*POPUP_ANIMATION_TIME_SECONDS)*1000;const CHANNEL_TYPE_WHATSAPP="whatsapp";const CHANNEL_TYPE_PHONE="phone";const CHANNEL_TYPE_EMAIL="email";const CHANNEL_TYPE_FACEBOOK="facebook";const CHANNEL_TYPE_INSTAGRAM="instagram";const CHANNEL_TYPE_SMS="sms";var whatsappWindow=null;var channelConfig=null;const CHANNEL_ICON_ANIMATION_TIME_SECONDS=1.5;const CHANNEL_ICON_BUFFER_TIME_SECONDS=3.00;const positionClasses={center:"position-center",left:"position-left",right:"position-right",bottom:"position-bottom",};const BUBBLE_DEFAULT_STYLE="style1";const BUBBLE_STYLE_2="style2";const BUBBLE_STYLE_3="style3";const EMBED_STYLE="style-embed";var iframeEventType={UnreadMessage:'kenytUnreadMessage',CustomEventDispatch:'kenytCustomEventDispatch',Custom_ContactFormSubmit:'kenyt_ContactFormSubmit',GenericFormSubmit:'kenyt_GenericFormSubmit',UpdateAttentionMessage:'kenytUpdateAttentionMessage',FirebaseToken:'kenytFirebaseToken',UserGeneratedEvent:'user_generated_event',UpdateSssionPing:"update_session_ping"};var enableUserTracking=!1;var enableWebPushNotification=!1;var kenytChatIFrame=null;var googleTagManagerInitialized=!1;var googleAnalyticsInitialized=!1;var facebookPixelInitialized=!1;const handleKenytEvent=(event)=>{if(event.detail.eventType==="kenyt_Load"){const iframe=document.getElementById('kenytChatWindow');kenytChatIFrame=iframe;userActivityTracking();askForWebPushPermision()}};document.addEventListener('kenytEvent',handleKenytEvent);function userActivityTracking(){function getBrowserName(){const ua=navigator.userAgent.toLowerCase();if(ua.includes("edg"))return"Edge";if(ua.includes("opr")||ua.includes("opera"))return"Opera";if(ua.includes("crios"))return"Chrome";if(ua.includes("chrome")&&!ua.includes("edg"))return"Chrome";if(ua.includes("firefox"))return"Firefox";if(ua.includes("safari")&&!ua.includes("chrome")&&!ua.includes("crios"))return"Safari";return"Unknown Browser"} 99function getOSName(){const ua=navigator.userAgent;if(/android/i.test(ua))return"Android";if(/iphone|ipad|ipod/i.test(ua))return"iOS";if(/macintosh/i.test(ua))return"MacOS";if(/windows/i.test(ua))return"Windows";if(/linux/i.test(ua))return"Linux";return"Unknown OS"} 100function getPlatformName(){const ua=navigator.userAgent.toLowerCase();if(/ipad/i.test(ua))return"Tablet";if(/(android|webos)/i.test(ua)&&!/mobile/i.test(ua))return"Tablet";if(/mobile|iphone|ipod|android/i.test(ua))return"Mobile";return"Desktop"} 101var userEvents={eventCount:1,clickEventList:[],urlChangeEventList:[],sessionInfo:{browserName:getBrowserName(),osName:getOSName(),platformName:getPlatformName(),channelName:"web",sourceUrl:window.location.href}} 102const clearUserEvents=()=>{userEvents={eventCount:1,clickEventList:[],urlChangeEventList:[],sessionInfo:{browserName:getBrowserName(),osName:getOSName(),platformName:getPlatformName(),channelName:"web",sourceUrl:window.location.href}}} 103let startTime=0;let totalTimeSpent=0;let currentVisibilityState=document.visibilityState;let sendInterval=10;function startTimer(){startTime=Date.now()} 104function stopTimer(){if(startTime>0){const elapsedTime=Date.now()-startTime;totalTimeSpent+=elapsedTime;startTime=0}} 105function logTimeSpent(){const url=new URL(window.location.href);
105const splitPath=url.pathname.split("/").filter(Boolean);userEvents.urlChangeEventList.push({url:`${url.protocol}//${url.hostname}${url.pathname}`,domainName:url.hostname,segment1:splitPath[0]||null,segment2:splitPath[1]||null,segment3:splitPath[2]||null,segment4:splitPath[3]||null,timespent:totalTimeSpent,timestamp:Date.now()}) 106userEvents.eventCount+=1} 107function handleVisibilityChange(){if(document.visibilityState==="visible"){startTimer()}else if(document.visibilityState==="hidden"){stopTimer()} 108currentVisibilityState=document.visibilityState} 109const sendBulkEvent=()=>{if(kenytChatIFrame&&userEvents.eventCount>0){let iframeEvent={type:iframeEventType.UserGeneratedEvent,value:userEvents,};kenytChatIFrame.contentWindow.postMessage(iframeEvent,kenytChatIFrame.src);clearUserEvents()}} 110const startSendingPing=()=>{if(kenytChatIFrame){let iframeEvent={type:iframeEventType.UpdateSssionPing};kenytChatIFrame.contentWindow.postMessage(iframeEvent,kenytChatIFrame.src)} 111setTimeout(()=>(startSendingPing()),60*1000)} 112if(enableUserTracking&&kenytChatIFrame){document.addEventListener("visibilitychange",handleVisibilityChange);window.addEventListener("beforeunload",()=>{stopTimer();logTimeSpent();sendBulkEvent();window.removeEventListener("beforeunload")});startTimer();sendBulkEvent();startSendingPing()}} 113function askForWebPushPermision(){if(enableWebPushNotification&&kenytChatIFrame){saveFirebaseToken()}} 114var scriptElement;for(let i=0;i<document.scripts.length;i++){if(document.scripts[i].src.indexOf(SCRIPT_NAME)>=0){scriptElement=document.scripts[i];break}} 115var API_ENDPOINT;var botName,rootUrl="",botPosition,botPositionClass,bubbleStyle,isTestMode;var origin;var unreadMessageCount=0;var nextUnreadMessage=null;if(!String.prototype.startsWith){String.prototype.startsWith=function(searchString,position){position=position||0;return this.substring(position,position+searchString.length)===searchString}} 116var kenytChatBubble={element:null,primaryColor:null,opacity:null,textColor:null,style:null,channelContainer:{element:null,group:null,channels:[],iconElements:[],},popupContainer:{element:null,container:null,config:null,},bubbleContainer:{element:null,imageUrl:null,},connectorContainer:{element:null,razorpay:{element:null,btn:null,},cashfree:{element:null,btn:null}},stripAnimation:null,};let chatWindow={};let firebaseAppConfig=null;(()=>{rootUrl=extractRootUrl();botName=getScriptParam("data-bot");botPosition=getScriptParam("data-position");bubbleStyle=getScriptParam("data-bubblestyle");isTestMode=(getScriptParam("data-istest")||"").toLowerCase()==="true";document.kenytRootUrl=rootUrl;origin=window.location.href;API_ENDPOINT=detectEndPoint();if(!botName&&origin.indexOf("myshopify.com")>0){botName=origin} 117if(!botName){console.error("[Kenyt.AI] Invalid botname parameter")}else{var request=new XMLHttpRequest();request.addEventListener('load',()=>{let response=JSON.parse(request.response);bootstrap(response)});request.open("GET",`${API_ENDPOINT}?botid=${botName}`,!0);request.send()}})();function bootstrap(themeConfig){channelConfig=themeConfig?.bubble?.channelConfig;if(!botPosition&&themeConfig.botPosition&&typeof themeConfig.botPosition==='string'){let position=themeConfig.botPosition.trim().toLowerCase();if(position){botPosition=position}} 118if(themeConfig&&themeConfig.userActivityTracking){enableUserTracking=themeConfig.userActivityTracking;const origin=window.location.href;if((origin.indexOf("kenyt.ai/dashboard")>0)||(origin.indexOf("kenyt.ai/botapp")>0)){enableUserTracking=!1} 119userActivityTracking()} 120if(themeConfig&&themeConfig.enableWebPushNotifications){enableWebPushNotification=themeConfig.enableWebPushNotifications;askForWebPushPermision()} 121if(!bubbleStyle&&themeConfig.bubbleStyle&&typeof themeConfig.bubbleStyle==='string'){bubbleStyle=themeConfig.bubbleStyle} 122botPositionClass=getPositionClass(botPosition);let hideChatbot=themeConfig.hideChatbot;let hideChatbotv2=themeConfig.hideChatbotV2;if(hideChatbotv2){hideChatbot=hideChatbotv2} 123createChatBubble(themeConfig.bubble,bubbleStyle,botPositionClass);var kenytKioskVoiceGateParentInstalled=!1;function installKenytKioskVoiceParentUI(){if(kenytKioskVoiceGateParentInstalled)return;kenytKioskVoiceGateParentInstalled=!0;var GATE_TYPE='kenytKioskVoiceGate';var START_CMD='kenytKioskVoiceStart';var overlay=null;var startLabelEl=null;var kioskGateDismissed=!1;var kioskRelayoutTimeouts=[];var kioskModalHostWasOpen=!1;var KIOSK_CSS='#kenytKioskVoiceGateOverlay.kvg-overlay{position:fixed;z-index:2147483646;display:none;flex-direction:column;align-items:center;justify-content:center;box-sizing:border-box;padding:clamp(16px,4vw,32px);background:rgba(15,23,42,.5);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);}.kvg-close{position:absolute;top:clamp(12px,3vw,20px);right:clamp(12px,3vw,20px);z-index:4;width:clamp(36px,9vw,44px);height:clamp(36px,9vw,44px);border-radius:50%;border:1px solid rgba(255,255,255,.38);background:rgba(255,255,255,.16);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:clamp(20px,5vw,24px);line-height:1;padding:0;font-weight:400;-webkit-tap-highlight-color:transparent;box-shadow:0 4px 16px rgba(0,0,0,.22),inset 0 1px 0 rgba(255,255,255,.25);transition:background .2s,transform .15s ease;}.kvg-close:hover{background:rgba(255,255,255,.3);transform:scale(1.06);}.kvg-close:focus-visible{outline:2px solid rgba(255,255,255,.75);outline-offset:2px;}.kvg-card{box-sizing:border-box;position:relative;display:flex;flex-direction:column;align-items:stretch;text-align:center;width:min(92vw,400px);min-width:min(92vw,400px);max-width:min(92vw,400px);height:min(500px,84vh);min-height:min(480px,82vh);max-height:min(500px,84vh);padding:clamp(28px,5vw,42px) clamp(22px,4vw,32px);--kvg-frame:#0087ff;background:var(--kvg-frame,#0087ff);border:1px solid rgba(255,255,255,.32);border-radius:clamp(22px,4.5vw,30px);box-shadow:0 28px 56px -10px rgba(0,40,100,.5),inset 0 1px 0 rgba(255,255,255,.28),inset 0 -2px 0 rgba(0,0,0,.12);}.kvg-icon-wrap{flex-shrink:0;width:clamp(88px,18vw,108px);height:clamp(88px,18vw,108px);margin:0 auto clamp(20px,4vw,28px);border-radius:50%;background:rgba(255,255,255,.22);border:2px solid rgba(255,255,255,.48);display:flex;align-items:center;justify-content:center;box-shadow:0 12px 36px rgba(0,35,80,.28),inset 0 1px 0 rgba(255,255,255,.35);}.kvg-icon-wrap svg{width:44%;height:44%;fill:#fff;opacity:.98;filter:drop-shadow(0 2px 4px rgba(0,0,0,.12));}.kvg-title{margin:0 0 10px;flex-shrink:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;font-size:clamp(1.15rem,3.4vw,1.62rem);font-weight:800;color:#fff;letter-spacing:-.025em;line-height:1.2;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis;word-break:break-word;text-shadow:0 1px 2px rgba(0,0,0,.12);}.kvg-subtitle{margin:0 0 clamp(18px,4vw,26px);flex-shrink:0;font-family:system-ui,sans-serif;font-size:clamp(.84rem,2.25vw,1rem);color:rgba(255,255,255,.92);line-height:1.5;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;text-overflow:ellipsis;word-break:break-word;}.kvg-buttons-row{display:flex;flex-direction:column;gap:12px;width:100%;margin-top:auto;padding-top:6px;flex-shrink:0;}.kvg-btn-start,.kvg-btn-text{flex:0 0 auto;min-width:0;width:100%;min-height:54px;display:inline-flex;align-items:center;justify-content:center;gap:12px;font-family:system-ui,sans-serif;font-size:clamp(.88rem,2.35vw,1.06rem);font-weight:700;color:#fff;border:none;border-radius:16px;cursor:pointer;padding:12px 14px;transition:transform .15s ease,box-shadow .15s ease,filter .15s ease;-webkit-tap-highlight-color:transparent;}.kvg-btn-start{background:linear-gradient(180deg,#34d399 0%,#10b981 48%,#059669 100%);box-shadow:0 4px 0 #047857,0 12px 32px rgba(5,150,105,.42);}.kvg-btn-start:hover{filter:brightness(1.08);transform:translateY(-2px);box-shadow:0 4px 0 #047857,0 16px 38px rgba(5,150,105,.52);}.kvg-btn-start:active{transform:translateY(1px);box-shadow:0 2px 0 #047857,0 8px 22px rgba(5,150,105,.38);}.kvg-btn-start:focus-visible{outline:3px solid rgba(255,255,255,.55);outline-offset:3px;}.kvg-btn-text{background:linear-gradient(180deg,#a5b4fc 0%,#6366f1 52
123%,#4f46e5 100%);box-shadow:0 4px 0 #4338ca,0 12px 32px rgba(79,70,229,.4);}.kvg-btn-text:hover{filter:brightness(1.08);transform:translateY(-2px);box-shadow:0 4px 0 #4338ca,0 16px 38px rgba(79,70,229,.48);}.kvg-btn-text:active{transform:translateY(1px);box-shadow:0 2px 0 #4338ca,0 8px 22px rgba(79,70,229,.35);}.kvg-btn-text:focus-visible{outline:3px solid rgba(255,255,255,.55);outline-offset:3px;}.kvg-btn-start-icon,.kvg-btn-text-icon{display:flex;align-items:center;justify-content:center;width:34px;height:34px;flex-shrink:0;border-radius:50%;background:rgba(255,255,255,.28);font-size:.92rem;line-height:1;color:#fff;}.kvg-btn-start-label,.kvg-btn-text-label{letter-spacing:.02em;text-align:left;flex:1;min-width:0;line-height:1.25;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;word-break:break-word;}';var MIC_SVG='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm5.91-3c-.49 0-.9.36-.98.85C16.52 14.2 14.47 16 12 16s-4.52-1.8-4.93-4.15c-.08-.49-.49-.85-.98-.85-.61 0-1.09.54-1 1.14.49 3 2.89 5.35 5.91 5.78V20c0 .55.45 1 1 1s1-.45 1-1v-2.08c3.02-.43 5.42-2.78 5.91-5.78.1-.6-.39-1.14-1-1.14z"/></svg>';function ensureStyles(){if(document.getElementById('kenytKioskVoiceGateStyles'))return;var st=document.createElement('style');st.id='kenytKioskVoiceGateStyles';st.textContent=KIOSK_CSS;document.head.appendChild(st)} 124function getIframeWin(){var f=document.getElementById(IFRAME_ID);return f&&f.contentWindow?f.contentWindow:null} 125var KVG_MIN_PANEL_W=260;var KVG_MIN_PANEL_H=160;function clearKioskGateRelayoutTimeouts(){kioskRelayoutTimeouts.forEach(function(id){try{clearTimeout(id)}catch(e){}});kioskRelayoutTimeouts=[]} 126function blurKioskOverlayFocus(){if(!overlay)return;var ae=document.activeElement;if(ae&&typeof overlay.contains==='function'&&overlay.contains(ae)){try{ae.blur()}catch(e){}}} 127function dismissKioskGateOverlay(){kioskGateDismissed=!0;clearKioskGateRelayoutTimeouts();if(overlay){blurKioskOverlayFocus();overlay.style.display='none';overlay.setAttribute('aria-hidden','true');overlay.style.top='0';overlay.style.left='0';overlay.style.width='0';overlay.style.height='0'}} 128function applyRectToOverlay(r){overlay.style.top=r.top+'px';overlay.style.left=r.left+'px';overlay.style.width=Math.max(0,r.width)+'px';overlay.style.height=Math.max(0,r.height)+'px';overlay.style.display='flex';overlay.setAttribute('aria-hidden','false')} 129function isChatPanelValidOverlayTarget(el){if(!el||!el.isConnected)return!1;if(el.classList&&el.classList.contains('k-hide'))return!1;var cs=window.getComputedStyle(el);if(cs.display==='none'||cs.visibility==='hidden'||Number(cs.opacity)===0)return!1;var r=el.getBoundingClientRect();if(r.width<KVG_MIN_PANEL_W||r.height<KVG_MIN_PANEL_H)return!1;if(r.bottom<=0||r.right<=0)return!1;if(r.top>=window.innerHeight||r.left>=window.innerWidth)return!1;return!0} 130function isIframeValidOverlayTarget(el){if(!el||!el.isConnected)return!1;var cs=window.getComputedStyle(el);if(cs.display==='none'||cs.visibility==='hidden'||Number(cs.opacity)===0)return!1;var r=el.getBoundingClientRect();if(r.width<KVG_MIN_PANEL_W||r.height<KVG_MIN_PANEL_H)return!1;if(r.bottom<=0||r.right<=0)return!1;if(r.top>=window.innerHeight||r.left>=window.innerWidth)return!1;return!0} 131function layoutOverlay(){if(!overlay)return;if(kioskGateDismissed){blurKioskOverlayFocus();overlay.style.display='none';overlay.setAttribute('aria-hidden','true');overlay.style.top='0';overlay.style.left='0';overlay.style.width='0';overlay.style.height='0';return} 132var target=document.getElementById(kenytChatWindowContainerId);if(isChatPanelValidOverlayTarget(target)){applyRectToOverlay(target.getBoundingClientRect());return} 133var iframe=document.getElementById(IFRAME_ID);if(isIframeValidOverlayTarget(iframe)){applyRectToOverlay(iframe.getBoundingClientRect());return} 134blurKioskOverlayFocus();overlay.style.display='none';overlay.setAttribute('aria-hidden','true');overlay.style.top='0';overlay.style.left='0';overlay.style.width='0';overlay.style.height='0'} 135function scheduleKioskGateRelayout(){clearKioskGateRelayoutTimeouts();if(typeof requestAnimationFrame==='function'){requestAnimationFrame(function(){requestAnimationFrame(function(){if(!kioskGateDismissed){layoutOverlay()}})})} 136kioskRelayoutTimeouts.push(setTimeout(function(){if(!kioskGateDismissed){layoutOverlay()}},150));kioskRelayoutTimeouts.push(setTimeout(function(){if(!kioskGateDismissed){layoutOverlay()}},600))} 137function minimizeChatPanelFromKioskGate(ev){if(ev){ev.stopPropagation();ev.preventDefault()} 138dismissKioskGateOverlay();var chatContainer=document.getElementById(kenytChatWindowContainerId);var chatBubble=document.getElementById(CHATBUBBLE_ID);var iw=getIframeWin();try{window.postMessage({type:'kenytChatWindowClose'},'*')}catch(e){}
139if(!chatContainer||!chatContainer.classList.contains('k-hide')){if(chatContainer){chatContainer.classList.add('k-hide')} 140if(chatBubble){chatBubble.classList.remove('k-hide')} 141if(iw){try{iw.postMessage({type:'kenytIsWindowMinimizedResponse',value:!0},'*')}catch(e2){}}}} 142var titleEl=null;var subtitleEl=null;var textLabelEl=null;var startBtnEl=null;var textBtnEl=null;function hexToRgb(hex){hex=hex.replace(/^#/,'');if(hex.length===3)hex=hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];var n=parseInt(hex,16);return{r:(n>>16)&255,g:(n>>8)&255,b:n&255}} 143function shadeHex(hex,pct){var c=hexToRgb(hex);var t=pct<0?0:255;var p=Math.abs(pct);var r=Math.round((t-c.r)*p+c.r);var g=Math.round((t-c.g)*p+c.g);var b=Math.round((t-c.b)*p+c.b);return'#'+((1<<24)+(r<<16)+(g<<8)+b).toString(16).slice(1)} 144function applyBtnColor(btn,baseHex){if(!btn||!baseHex)return;var light=shadeHex(baseHex,0.25);var dark=shadeHex(baseHex,-0.18);var shadow=shadeHex(baseHex,-0.30);btn.style.background='linear-gradient(180deg,'+light+' 0%,'+baseHex+' 50%,'+dark+' 100%)';btn.style.boxShadow='0 4px 0 '+shadow+',0 12px 32px '+baseHex+'6b'} 145function showGate(startText,stopText,textButtonText,titleText,subTitleText,frameColor,cardColor,voiceBtnColor,textBtnColor){ensureStyles();if(!overlay){var staleOverlay=document.getElementById('kenytKioskVoiceGateOverlay');if(staleOverlay)staleOverlay.remove();overlay=document.createElement('div');overlay.id='kenytKioskVoiceGateOverlay';overlay.className='kvg-overlay';overlay.setAttribute('role','dialog');overlay.setAttribute('aria-modal','true');overlay.setAttribute('aria-labelledby','kvgTitle');var card=document.createElement('div');card.className='kvg-card';var closeBtn=document.createElement('button');closeBtn.type='button';closeBtn.className='kvg-close';closeBtn.setAttribute('aria-label','Close');closeBtn.innerHTML='×';closeBtn.addEventListener('click',minimizeChatPanelFromKioskGate);card.appendChild(closeBtn);var iconWrap=document.createElement('div');iconWrap.className='kvg-icon-wrap';iconWrap.innerHTML=MIC_SVG;titleEl=document.createElement('p');titleEl.className='kvg-title';titleEl.id='kvgTitle';subtitleEl=document.createElement('p');subtitleEl.className='kvg-subtitle';var buttonsRow=document.createElement('div');buttonsRow.className='kvg-buttons-row';startBtnEl=document.createElement('button');var startBtn=startBtnEl;startBtn.type='button';startBtn.className='kvg-btn-start';var playIcon=document.createElement('span');playIcon.className='kvg-btn-start-icon';playIcon.setAttribute('aria-hidden','true');playIcon.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm5.91-3c-.49 0-.9.36-.98.85C16.52 14.2 14.47 16 12 16s-4.52-1.8-4.93-4.15c-.08-.49-.49-.85-.98-.85-.61 0-1.09.54-1 1.14.49 3 2.89 5.35 5.91 5.78V20c0 .55.45 1 1 1s1-.45 1-1v-2.08c3.02-.43 5.42-2.78 5.91-5.78.1-.6-.39-1.14-1-1.14z"/></svg>';startLabelEl=document.createElement('span');startLabelEl.className='kvg-btn-start-label';startBtn.appendChild(playIcon);startBtn.appendChild(startLabelEl);startBtn.addEventListener('click',onStartClick);textBtnEl=document.createElement('button');var textBtn=textBtnEl;textBtn.type='button';textBtn.className='kvg-btn-text';var textIcon=document.createElement('span');textIcon.className='kvg-btn-text-icon';textIcon.setAttribute('aria-hidden','true');textIcon.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z"/></svg>';textLabelEl=document.createElement('span');textLabelEl.className='kvg-btn-text-label';textBtn.appendChild(textIcon);textBtn.appendChild(textLabelEl);textBtn.addEventListener('click',onTextClick);buttonsRow.appendChild(startBtn);buttonsRow.appendChild(textBtn);card.appendChild(iconWrap);card.appendChild(titleEl);card.appendChild(subtitleEl);card.appendChild(buttonsRow);overlay.appendChild(card);document.body.appendChild(overlay);window.addEventListener('resize',layoutOverlay);
145window.addEventListener('scroll',layoutOverlay,!0)} 146startLabelEl.textContent=startText||'Voice chat';textLabelEl.textContent=textButtonText||'Text chat';titleEl.textContent=titleText||'Voice assistant';subtitleEl.textContent=subTitleText||'Tap the button below to begin your conversation.';var cardEl=overlay.querySelector('.kvg-card');if(cardEl){var fc=cardColor||frameColor||'#0087ff';cardEl.style.setProperty('--kvg-frame',fc)} 147applyBtnColor(startBtnEl,voiceBtnColor);applyBtnColor(textBtnEl,textBtnColor);kioskGateDismissed=!1;layoutOverlay();scheduleKioskGateRelayout()} 148function onStartClick(){var w=getIframeWin();if(!w)return;clearKioskGateRelayoutTimeouts();kioskGateDismissed=!0;blurKioskOverlayFocus();overlay.style.display='none';overlay.setAttribute('aria-hidden','true');w.postMessage({type:START_CMD},'*')} 149function onTextClick(){var w=getIframeWin();if(!w)return;clearKioskGateRelayoutTimeouts();kioskGateDismissed=!0;blurKioskOverlayFocus();overlay.style.display='none';overlay.setAttribute('aria-hidden','true');w.postMessage({type:'kenytKioskTextStart'},'*')} 150function onGatePayload(value){if(!value)return;showGate(value.startText,value.stopText,value.textButtonText,value.title,value.subTitle,value.frameColor,value.cardColor,value.voiceBtnColor,value.textBtnColor)} 151window.addEventListener('message',function(ev){var d=ev.data;if(d&&d.type===GATE_TYPE&&d.value)onGatePayload(d.value);else if(d&&d.type==='kenytChatWindowClose'){dismissKioskGateOverlay()}else if(d&&d.type==='kenytIsWindowMinimizedResponse'&&d.value===!0){dismissKioskGateOverlay()}});window.addEventListener('kenytKioskVoiceGate',function(ev){if(ev.detail)onGatePayload(ev.detail)});if(window.MutationObserver&&document.body){function isDashboardBotModalOpen(){var host=document.querySelector('ngb-modal-window');if(host){if(host.getAttribute('aria-hidden')==='true')return!1;if(host.classList.contains('show'))return!0;if(host.querySelector&&host.querySelector('.modal.show'))return!0;return!1} 152var bd=document.querySelector('.bot-drawer-modal');if(!bd)return!1;if(bd.getAttribute('aria-hidden')==='true')return!1;if(bd.classList.contains('show'))return!0;return!!(bd.querySelector&&bd.querySelector('.modal.show'))} 153var kioskModalObserver=new MutationObserver(function(){var open=isDashboardBotModalOpen();if(kioskModalHostWasOpen&&!open){dismissKioskGateOverlay()} 154kioskModalHostWasOpen=open});kioskModalObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:['class','style','aria-hidden','aria-modal']});kioskModalHostWasOpen=isDashboardBotModalOpen()} 155document.addEventListener('click',function(ev){var t=ev.target;if(!t||!t.closest)return;if(!t.closest('.close_filter_overlay_right'))return;if(t.closest('ngb-modal-window')||t.closest('.bot-drawer-modal')){dismissKioskGateOverlay()}},!0)} 156function loadChatbot(){installKenytKioskVoiceParentUI();let isHideChatbot=!1;if(hideChatbot=="All"||(hideChatbot=="Mobile"&&isMobileDevice())||(hideChatbot=="Desktop"&&!isMobileDevice())){isHideChatbot=!0&&window.location.host.indexOf("kenyt.ai")<0} 157chatWindow=document.getElementById(kenytChatWindowContainerId) 158if(!chatWindow){chatWindow=createChatWindow(themeConfig.iframeSource,themeConfig.botType,themeConfig.deviceSettings,isHideChatbot,botPositionClass,isTestMode,themeConfig.setUserDataForBot,themeConfig.hideChatHistory,themeConfig.enablePortal,themeConfig.enableHomePortal,themeConfig.enableMessagePortal,themeConfig.forms,themeConfig.enableMessageFeedback)} 159chatWindow.classList.add(bubbleStyle);if(!document.body){console.error('[Kenyt.AI] Cannot inject chatbot - Document load complete, but missing body');console.error(document);setTimeout(loadChatbot,2000)}else{if(document.kenytBotLoaded&&document.kenytBotLoaded===botName){console.warn('[Kenyt.AI] Loader script imported more than once, ignoring duplicate loads')}else{if(document.kenytBotLoaded&&document.kenytBotLoaded!==botName){var oldChatBubble=document.getElementById(CHATBUBBLE_ID);if(oldChatBubble){oldChatBubble.remove()} 160var oldChatWindow=document.getElementById(IFRAME_ID);if(oldChatWindow){oldChatWindow.remove()}} 161document.kenytBotLoaded=botName;if(isHideChatbot){kenytChatBubble.element.style.display="none";chatWindow.style.display="none"}else{initializeGoogleTagManager(themeConfig);injectScripts(themeConfig)}}} 162window.addEventListener('message',function(event){if(typeof event.data==="object"&&event.data.type){let iframeEvent=event.data;if(iframeEvent.type==='openWhatsAppWindow'){openWhatsAppWindow();return} 163if(iframeEvent.type==='closeWhatsAppWindow'){closeWhatsAppWindow();return} 164if(iframeEvent.type==='openWhatsAppUrl'){openWhatsAppUrl(iframeEvent.url);return} 165if(iframeEvent.type==='openEmailWindow'){openEmailWindow();return} 166if(iframeEvent.type==='closeEmailWindow'){closeEmailWindow();return} 167if(iframeEvent.type==='openPhoneWindow'){openPhoneWindow();return} 168if(iframeEvent.type==='closePhoneWindow'){closePhoneWindow();return} 169if(iframeEvent.type===iframeEventType.CustomEventDispatch){let eventInfo=iframeEvent.value;if(eventInfo&&eventInfo.EventName&&eventInfo.EventName===iframeEventType.Custom_ContactFormSubmit){if(kenyt_gtag&&eventInfo.EventData){kenyt_gtag('event','contact_form_submitted',eventInfo.EventData)} 170if(kenyt_gtag&&themeConfig.googleAnalyticsEvents&&themeConfig.googleAnalyticsEvents[iframeEventType.Custom_ContactFormSubmit]){triggerConfiguredGoogleAnalyticsEvents(themeConfig.googleAnalyticsEvents[iframeEventType.Custom_ContactFormSubmit])} 171if(themeConfig.facebookPixelId){initializeFacebookPixel(themeConfig);if(typeof fbq!=='undefined'&&fbq){fbq('track','Lead')}} 172if(themeConfig.googleTagManagerId){initializeGoogleTagManager(themeConfig);window.dataLayer=window.dataLayer||[];var leadEventData={event:'contact_form_submitted'};
172if(eventInfo.EventData&&typeof eventInfo.EventData==='object'){Object.keys(eventInfo.EventData).forEach(function(key){leadEventData[key]=eventInfo.EventData[key]})} 173window.dataLayer.push(leadEventData)}}}else if(iframeEvent.type===iframeEventType.UnreadMessage){unreadMessageCount=getUnreadMessageCount();unreadMessageCount+=1;if(unreadMessageCount>0){setUnreadMessageCount(unreadMessageCount)} 174if(themeConfig.toggleAttentionMessage&&iframeEvent.value&&!nextUnreadMessage){nextUnreadMessage={};nextUnreadMessage.markedEle=iframeEvent.value}}else if(iframeEvent.type===iframeEventType.UpdateAttentionMessage){var data={};if(iframeEvent.value){data.text=iframeEvent.value;setPopupText(data)}else{setPopupText(kenytChatBubble.popupContainer.config)}}else if(iframeEvent.type===iframeEventType.FirebaseToken){saveFirebaseToken()}}},!1)} 175let loadMode=themeConfig.loadMode||"Normal";if(document.readyState==="complete"||document.readyState==="interactive"){switch(loadMode){case "Delayed":window.setTimeout(()=>{loadChatbot()},5000);break;case "Quick":default:loadChatbot();break}}else{switch(loadMode){case "Quick":loadChatbot();break;case "Delayed":window.setTimeout(()=>{loadChatbot()},5000);break;default:window.addEventListener('DOMContentLoaded',()=>{loadChatbot()});break}} 176if(themeConfig.firebaseConfig){firebaseAppConfig=themeConfig.firebaseConfig}} 177function renderChatbot(themeConfig){if(kenytChatBubble.embedElement){kenytChatBubble.embedElement.appendChild(kenytChatBubble.element)}else{document.body.appendChild(kenytChatBubble.element)} 178toggleUnreadMessages();if(kenytChatBubble.channelContainer.iconElements&&kenytChatBubble.channelContainer.iconElements.length){animateChannelIcon(kenytChatBubble.channelContainer.iconElements,kenytChatBubble.channelContainer.iconElements.length-1)} 179if(themeConfig.bubble.shakeInterval>0){setInterval(()=>{try{kenytChatBubble.bubbleContainer.element.classList.remove("shake") 180void kenytChatBubble.bubbleContainer.element.offsetWidth}catch(e){console.log(e)} 181kenytChatBubble.bubbleContainer.element.classList.add("shake")},Number(themeConfig.bubble.shakeInterval)*1000)} 182if(!bubbleStyle||bubbleStyle===BUBBLE_DEFAULT_STYLE){}else{setInterval(function(){toggleUnreadMessages()},POPUP_REOPEN_TIME)} 183document.body.appendChild(chatWindow);initializeGoogleAnalytics(themeConfig);initializeFacebookPixel(themeConfig)} 184function toggleUnreadMessages(){if(nextUnreadMessage){setPopupText(nextUnreadMessage);nextUnreadMessage=null}else{setPopupText(kenytChatBubble.popupContainer.config)}} 185function animateChannelIcon(iconElements,index){if(iconElements&&iconElements.length){if(index<0){index=iconElements.length-1} 186var iconEle=iconElements[index];iconEle.classList.add("kanimate");window.setTimeout(()=>{iconEle.classList.remove("kanimate");window.setTimeout(()=>{animateChannelIcon(iconElements,index-1)},CHANNEL_ICON_BUFFER_TIME_SECONDS*1000)},CHANNEL_ICON_ANIMATION_TIME_SECONDS*1000)}} 187function injectScripts(themeConfig){if(themeConfig){var renderOnLoad=!0 188themeConfig.stylesheet.forEach(linkUrl=>{document.head.appendChild(createLinkNode(`${rootUrl}${linkUrl}`,renderOnLoad,themeConfig));renderOnLoad=!1});themeConfig.resources.forEach(externalResource=>{externalResource.resourceType=externalResource.resourceType||'';let firstStylesheet=document.head.getElementsByTagName("link");if(firstStylesheet&&firstStylesheet.length>0){firstStylesheet=firstStylesheet[0]}else{firstStylesheet=null} 189{switch(externalResource.resourceType){case 'script':if(externalResource.resourceUrl){document.head.appendChild(createScriptNode(externalResource.resourceUrl))}else if(externalResource.resourceContent){} 190break;case 'stylesheet':if(externalResource.resourceUrl){let linkNode=createLinkNode(externalResource.resourceUrl);if(firstStylesheet){document.head.insertBefore(linkNode,firstStylesheet)}else{document.head.appendChild(linkNode)}} 191break;default:console.warn('Unknown external resource type ignored',externalResource.resourceType)}}});if(themeConfig.customCss){let styleNode=document.createElement("style");styleNode.innerText=themeConfig.customCss;document.head.appendChild(styleNode)}}} 192function initializeGoogleTagManager(themeConfig){if(googleTagManagerInitialized||!themeConfig||!themeConfig.googleTagManagerId){return} 193window.dataLayer=window.dataLayer||[];window.dataLayer.push({'gtm.start':new Date().getTime(),event:'gtm.js'});document.head.appendChild(createScriptNode("https://www.googletagmanager.com/gtm.js?id="+themeConfig.googleTagManagerId,!0));googleTagManagerInitialized=!0} 194function initializeGoogleAnalytics(themeConfig){if(googleAnalyticsInitialized||!themeConfig||!themeConfig.googleAnalyticsId){return} 195var trackingId=themeConfig.googleAnalyticsId;if(typeof gtag!=='undefined'&>ag){kenyt_gtag=gtag;kenyt_gtag('config',trackingId);googleAnalyticsInitialized=!0;return} 196window.dataLayer=window.dataLayer||[];kenyt_gtag('js',new Date());kenyt_gtag('config',trackingId);document.head.appendChild(createScriptNode("https://www.googletagmanager.com/gtag/js?i
196d="+trackingId,!0));googleAnalyticsInitialized=!0} 197function triggerConfiguredGoogleAnalyticsEvents(eventConfig){if(!kenyt_gtag||!eventConfig){return} 198var configs=Array.isArray(eventConfig)?eventConfig:[eventConfig];configs.forEach(function(config){if(!config){return} 199if(typeof config==='string'){executeGoogleAnalyticsCallString(config);return} 200if(typeof config==='object'){if(config.event){var params=config.params||config.data||{};if(typeof params!=='object'){params={}} 201kenyt_gtag('event',config.event,params);return} 202for(var key in config){if(config.hasOwnProperty(key)){kenyt_gtag('event',key,config[key])}}}})} 203function executeGoogleAnalyticsCallString(callExpression){if(!callExpression||typeof callExpression!=='string'){return} 204var trimmedExpression=callExpression.trim();if(trimmedExpression.indexOf("gtag(")!==0){return} 205try{var safeExpression=trimmedExpression.replace(/\bgtag\b/g,'kenyt_gtag');var executor=new Function('kenyt_gtag',safeExpression);executor(kenyt_gtag)}catch(error){console.error('[Kenyt.AI] Failed to execute googleAnalyticsEvents entry',error)}} 206function initializeFacebookPixel(themeConfig){if(!themeConfig||!themeConfig.facebookPixelId||facebookPixelInitialized){if(themeConfig&&themeConfig.facebookPixelId&&typeof fbq!=='undefined'&&fbq){facebookPixelInitialized=!0} 207return} 208var pixelId=themeConfig.facebookPixelId;if(typeof fbq==='undefined'||!fbq){(function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)})(window,document,'script','https://connect.facebook.net/en_US/fbevents.js')} 209fbq('init',pixelId);fbq('track','PageView');var img=document.createElement("img");img.src="https://www.facebook.com/tr?id="+pixelId+"&ev=PageView&noscript=1";img.height="1";img.width="1";img.style="display:none";img.alt="";img.setAttribute("role","presentation");document.body.appendChild(img);facebookPixelInitialized=!0} 210function createScriptNode(scriptUrl,isAsync,renderOnLoad){let scriptNode=document.createElement("script");scriptNode.setAttribute("src",scriptUrl);scriptNode.type="text/javascript";scriptNode.async=isAsync;if(scriptUrl.indexOf("portal.js")>-1){Object.entries(scriptElement.attributes).map(([key,value])=>{if(key.startsWith("data-")){scriptNode.setAttribute(key,value)}})} 211if(renderOnLoad){scriptNode.onload=function(){var window=document.getElementById(IFRAME_ID);var srcUrl=window.getAttribute("src_to_set");if(srcUrl){window.removeAttribute("src_to_set");window.setAttribute("src",srcUrl)}}} 212return scriptNode} 213function createScriptNodeByContent(content){let scriptNode=document.createElement("script");scriptNode.text=content;return scriptNode} 214function createLinkNode(stylesheetUrl,renderOnLoad,themeConfig){let linkNode=document.createElement("link");linkNode.setAttribute("href",stylesheetUrl);linkNode.rel="stylesheet";if(renderOnLoad){linkNode.onload=function(){renderChatbot(themeConfig);themeConfig.javascript.forEach(scriptUrl=>{document.head.appendChild(createScriptNode(`${rootUrl}${scriptUrl}`,!1,renderOnLoad));if(renderOnLoad){let nsEle=document.createElement("noscript");nsEle.innerHTML="Enable JavaScript to use the Generative AI powered Kenyt<a href=\"https://www.kenyt.ai/\" rel=\"noopener nofollow\" target=\"_blank\">AI chatbot</a> or AI Assistant.";document.head.appendChild(nsEle)} 215renderOnLoad=!1})}} 216return linkNode} 217function createChatBubble(themeConfig,styleClass,positionClass){kenytChatBubble={};var bubbleTemplate=CHAT_BUBBLE_TEMPLATE_STYLE1;if(!styleClass||styleClass===BUBBLE_DEFAULT_STYLE){styleClass=BUBBLE_DEFAULT_STYLE;bubbleTemplate=CHAT_BUBBLE_TEMPLATE_STYLE1}else if(styleClass===BUBBLE_STYLE_2){styleClass=BUBBLE_STYLE_2;bubbleTemplate=CHAT_BUBBLE_TEMPLATE_STYLE2}else{styleClass=BUBBLE_STYLE_3;bubbleTemplate=CHAT_BUBBLE_TEMPLATE_STYLE3} 218if(themeConfig.embedElementId){kenytChatBubble.embedElement=document.getElementById(themeConfig.embedElementId);if(kenytChatBubble.embedElement){styleClass=EMBED_STYLE;bubbleTemplate=CHAT_BUBBLE_TEMPLATE_EMBEDDED}} 219kenytChatBubble.element=htmlToElement(bubbleTemplate);kenytChatBubble.element.classList.add(styleClass);kenytChatBubble.element.classList.add(positionClass);kenytChatBubble.popupContainer={};
219kenytChatBubble.popupContainer.element=kenytChatBubble.element.getElementsByClassName("kpopup-container")[0];kenytChatBubble.popupContainer.container=kenytChatBubble.popupContainer.element.getElementsByClassName("kpopup-text")[0];kenytChatBubble.channelContainer={};kenytChatBubble.channelContainer.element=kenytChatBubble.element.getElementsByClassName("kchannels-container")[0];kenytChatBubble.channelContainer.container=kenytChatBubble.element.getElementsByClassName("kchannel-group")[0];kenytChatBubble.channelContainer.strip=kenytChatBubble.element.getElementsByClassName("kstrip")[0];kenytChatBubble.channelContainer.iconElements=[];kenytChatBubble.bubbleContainer={};kenytChatBubble.bubbleContainer.element=kenytChatBubble.element.getElementsByClassName("kbubble-container")[0];kenytChatBubble.bubbleContainer.container=kenytChatBubble.element.getElementsByClassName("img-container")[0];if(kenytChatBubble.bubbleContainer.container&&themeConfig.bubbleBackgroundColor){kenytChatBubble.bubbleContainer.container.style.backgroundColor=themeConfig.bubbleBackgroun
219dColor} 220kenytChatBubble.connectorContainer={};kenytChatBubble.connectorContainer.element=kenytChatBubble.element.getElementsByClassName("kconnectors-container")[0];if(kenytChatBubble.connectorContainer.element){kenytChatBubble.connectorContainer.razorpay={};kenytChatBubble.connectorContainer.razorpay.element=kenytChatBubble.connectorContainer.element.getElementsByClassName("krazorpay-btn")[0];kenytChatBubble.connectorContainer.element.style.backgroundColor=themeConfig.bubbleBackgroundColor;kenytChatBubble.connectorContainer.cashfree={};kenytChatBubble.connectorContainer.cashfree.element=kenytChatBubble.connectorContainer.element.getElementsByClassName("kcashfree-btn")[0]} 221if(!styleClass||styleClass===BUBBLE_DEFAULT_STYLE){if(!themeConfig.popupConfig.text){kenytChatBubble.popupContainer.element.style.display="none"}}else{kenytChatBubble.popupContainer.element.style.animationDuration=POPUP_ANIMATION_TIME_SECONDS+"s"} 222kenytChatBubble.popupContainer.element.style.color=themeConfig.textColor;kenytChatBubble.popupContainer.config=themeConfig.popupConfig;if(themeConfig.channelConfig&&themeConfig.channelConfig.channels&&themeConfig.channelConfig.channels.length){themeConfig.channelConfig.channels.forEach(channelEntry=>{var channelDetails=getChannelDetails(channelEntry,themeConfig.ipAddress);if(channelDetails&&channelEntry.imageUrl){let channelIcon;const isPhone=channelEntry.type===CHANNEL_TYPE_PHONE;const isEmail=channelEntry.type===CHANNEL_TYPE_EMAIL;switch(channelEntry.type){case CHANNEL_TYPE_PHONE:if(channelDetails.useNewChatWindow){channelIcon=document.createElement("div")}else{channelIcon=document.createElement("a");if(channelDetails.link){channelIcon.target="_blank";channelIcon.href=channelDetails.link}} 223break;case CHANNEL_TYPE_EMAIL:channelIcon=document.createElement("div");break;case CHANNEL_TYPE_WHATSAPP:case CHANNEL_TYPE_SMS:case CHANNEL_TYPE_FACEBOOK:case CHANNEL_TYPE_INSTAGRAM:default:channelIcon=document.createElement("a");if(channelDetails.link){channelIcon.target="_blank";channelIcon.href=channelDetails.link} 224break} 225channelIcon.id=channelDetails.id;channelIcon.classList.add("kchannel-icon");if(isPhone||isEmail){channelIcon.style.display="flex";channelIcon.style.alignItems="center";channelIcon.style.justifyContent="center"} 226switch(channelEntry.type){case CHANNEL_TYPE_WHATSAPP:channelIcon.addEventListener('click',function(event){event.preventDefault();event.stopPropagation();if(channelDetails.useNewChatWindow){openWhatsAppWindow()}else{let whatsappLink=channelDetails.link;if(channelEntry.body){whatsappLink+=encodeURIComponent(channelEntry.body)} 227window.open(whatsappLink,'_blank')}});break;case CHANNEL_TYPE_EMAIL:channelIcon.addEventListener('click',function(event){event.preventDefault();event.stopPropagation();openEmailWindow()});break;case CHANNEL_TYPE_PHONE:channelIcon.addEventListener('click',function(event){event.preventDefault();event.stopPropagation();if(channelDetails.useNewChatWindow){openPhoneWindow()}else{window.open(channelDetails.link,'_blank')}});break} 228var bkgElement=document.createElement("span");bkgElement.classList.add("khighlight-background");if(channelEntry.type===CHANNEL_TYPE_WHATSAPP){bkgElement.style.position="relative";bkgElement.style.left="0";bkgElement.style.transform="none";bkgElement.style.margin="auto"} 229if((isPhone&&channelDetails.useNewChatWindow)||isEmail){bkgElement.style.borderRadius="50%";bkgElement.style.display="flex";bkgElement.style.position="relative";bkgElement.style.top="0";bkgElement.style.left="0";bkgElement.style.transform="none";bkgElement.style.height="80%";bkgElement.style.width="80%";bkgElement.style.justifyContent="center";bkgElement.style.alignItems="center";bkgElement.style.margin="auto"} 230const bgColor=(channelDetails.windowThemeColor||channelEntry.color||themeConfig.primaryColor);if((isPhone&&channelDetails.useNewChatWindow)||isEmail){if(bgColor)bkgElement.style.backgroundColor=bgColor}else if(channelEntry.color){bkgElement.style.backgroundColor=channelEntry.color} 231if(isPhone&&channelDetails.useNewChatWindow){var phoneIcon=document.createElement("span");phoneIcon.style.marginTop="0";phoneIcon.style.display="flex";phoneIcon.style.alignItems="center";phoneIcon.style.justifyContent="center";phoneIcon.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="none"><path fill="#FFFFFF" d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6A19.79 19.79 0 0 1 2.08 4.18 2 2 0 0 1 4.06 2h3a2 2 0 0 1 2 1.72c.12.9.32 1.77.59 2.6a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.48-1.11a2 2 0 0 1 2.11-.45c.83.27 1.7.47 2.6.59A2 2 0 0 1 22 16.92z"/></svg>';bkgElement.appendChild(phoneIcon)}else if(isEmail){var emailIcon=document.createElement("span");emailIcon.style.marginTop="0";emailIcon.style.display="flex";emailIcon.style.alignItems="center";emailIcon.style.justifyContent="center";emailIcon.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="none"><path fill="#FFFFFF" d="M20 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 4-8 5-8-5V6l8 5 8-5v2z"/></svg>';bkgElement.appendChild(emailIcon)}else{var channelImage=document.createElement("img");channelImage.src=`${rootUrl}${channelEntry.imageUrl}`;channelImage.alt=channelEntry.type?`${channelEntry.type} channel icon`:"Channel icon";channelIcon.appendChild(channelImage)} 232channelIcon.appendChild(bkgElement);kenytChatBubble.channelContainer.iconElements.push(channelIcon);kenytChatBubble.channelContainer.container.appendChild(channelIcon)}})}else{kenytChatBubble.channelContainer.container.classList.add("k-hide")} 233unreadMessageCount=getUnreadMessageCount();setUnreadMessageCount(unreadMessageCount);if(themeConfig.primaryColor){var pelements=kenytChatBubble.element.getElementsByClassName(BUBBLE_PRIMARY_BG);
233Array.from(pelements).forEach(ele=>{ele.style.backgroundColor=themeConfig.primaryColor}) 234pelements=kenytChatBubble.element.getElementsByClassName(BUBBLE_PRIMARY_COLOR);Array.from(pelements).forEach(ele=>{ele.style.color=themeConfig.primaryColor});pelements=kenytChatBubble.element.getElementsByClassName(BUBBLE_PRIMARY_BORDER);Array.from(pelements).forEach(ele=>{ele.style.borderColor=themeConfig.primaryColor})} 235if(themeConfig.secondaryColorGradient){var selements=kenytChatBubble.element.getElementsByClassName(BUBBLE_SECONDARY_BG);Array.from(selements).forEach(ele=>{ele.style.backgroundImage=themeConfig.secondaryColorGradient});if(themeConfig.secondaryColorVGradient){selements=kenytChatBubble.element.getElementsByClassName(BUBBLE_SECONDARY_BG_VERTICAL);Array.from(selements).forEach(ele=>{ele.style.backgroundImage=themeConfig.secondaryColorVGradient})}}else if(themeConfig.secondaryColor){var bgelements=kenytChatBubble.element.getElementsByClassName(BUBBLE_SECONDARY_BG);Array.from(bgelements).forEach(ele=>{ele.style.backgroundColor=themeConfig.secondaryColor})} 236if(themeConfig.imageUrl){var imgEle=document.createElement("img");imgEle.src=`${rootUrl}${themeConfig.imageUrl}`;if(themeConfig.altTextLOGO&&themeConfig.altTextLOGO.length>0){imgEle.alt=themeConfig.altTextLOGO}else{imgEle.alt="Chatbot avatar"} 237kenytChatBubble.bubbleContainer.container.appendChild(imgEle)} 238if(themeConfig.textColor){var tcelements=kenytChatBubble.element.getElementsByClassName(BUBBLE_TEXT_COLOR);Array.from(tcelements).forEach(ele=>{ele.style.color=themeConfig.textColor})}} 239function setPopupText(data){if(data){var contentEle=data.markedEle;if(!contentEle&&data.text){contentEle="<p>"+data.text+"</p>"} 240if(contentEle){removeAllChildNodes(kenytChatBubble.popupContainer.container);kenytChatBubble.popupContainer.element.classList.remove("k-hide");kenytChatBubble.popupContainer.element.classList.add("kpopup-holdanimation");kenytChatBubble.popupContainer.container.style.minWidth="75px";kenytChatBubble.popupContainer.container.innerHTML=contentEle;let maxWidth=240;if(isMobileDevice()&&bubbleStyle===BUBBLE_STYLE_2&&document.body.clientWidth){maxWidth=0.7*(document.body.clientWidth-90)} 241let popupWidth=kenytChatBubble.popupContainer.container.clientWidth-90;if(popupWidth>maxWidth){popupWidth=maxWidth} 242kenytChatBubble.popupContainer.container.style.minWidth=popupWidth+"px";kenytChatBubble.popupContainer.element.classList.remove("kpopup-holdanimation");window.setTimeout(()=>{kenytChatBubble.popupContainer.element.classList.add("k-hide")},POPUP_CLOSE_AFTER_TIME)}}} 243function getChannelDetails(channelEntry,ipAddress){let channelDetails={};channelDetails.render=!0;channelEntry.body=channelEntry.body||"hi";if(channelEntry&&channelEntry.type&&channelEntry.number){switch(channelEntry.type){case CHANNEL_TYPE_SMS:if(isMobileDevice()){var smsdeviceOS=getMobileOperatingSystem();var delimeter="?";if(smsdeviceOS==="iOS"){delimeter="&"} 244channelDetails.link="sms:"+encodeURIComponent(channelEntry.number)+delimeter+"body="+encodeURIComponent(channelEntry.body)} 245channelDetails.id=TEXTBUBBLE_ID;break;case CHANNEL_TYPE_WHATSAPP:var wadeviceOS=getMobileOperatingSystem();if(wadeviceOS==="iOS"){if(channelEntry.number&&channelEntry.number.startsWith('+')){channelEntry.number=channelEntry.number.substr(1)}} 246let text=channelEntry.body;if(channelEntry.trackCampaigns){let contentToEncode="";if(isMobileDevice()){contentToEncode=window.location.href} 247if(ipAddress){contentToEncode=ipAddress+" "+contentToEncode} 248text=getBase4EncodedUrl(contentToEncode)+channelEntry.body} 249channelDetails.link="https://api.whatsapp.com/send?phone="+channelEntry.number+"&text=";channelDetails.id=WHATSAPPBUBBLE_ID;channelDetails.windowThemeColor="#128C7E";channelDetails.contentTitle=channelEntry.contentTitle||"";channelDetails.contentSubtitle=channelEntry.contentSubtitle||"";channelDetails.headerTitle=channelEntry.headerTitle||"";channelDetails.initialMessage=channelEntry.body||"Hi";channelDetails.useNewChatWindow=channelEntry.useNewChatWindow;break;case CHANNEL_TYPE_FACEBOOK:var host=(isMobileDevice())?"http://m.me/":"https://www.messenger.com/t/";channelDetails.link=host+channelEntry.number+"/";channelDetails.id=FACEBOOKBUBBLE_ID;break;case CHANNEL_TYPE_INSTAGRAM:channelDetails.link="https://www.instagram.com/"+channelEntry.number+"/";channelDetails.id=INSTAGRMBUBBLE_ID;break;case CHANNEL_TYPE_PHONE:{channelDetails.link="tel:"+channelEntry.number} 250channelDetails.id=PHONEBUBBLE_ID;channelDetails.windowThemeColor=channelEntry.windowThemeColor||"#007bff";channelDetails.contentTitle=channelEntry.contentTitle||"";channelDetails.contentSubtitle=channelEntry.contentSubtitle||"";channelDetails.headerTitle=channelEntry.headerTitle||"";channelDetails.useNewChatWindow=channelEntry.useNewChatWindow;break;case CHANNEL_TYPE_EMAIL:{let mailtoLink="mailto:"+channelEntry.number;let params=[];if(channelEntry.subject&&channelEntry.subject.trim()!==""){params.push("subject="+encodeURIComponent(channelEntry.subject))} 251params.push("body="+encodeURIComponent(channelEntry.body||""));if(params.length>0){mailtoLink+="?"+params.join("&")} 252channelDetails.link=mailtoLink} 253channelDetails.windowThemeColor=channelEntry.windowThemeColor||"#007bff";channelDetails.contentTitle=channelEntry.contentTitle||"";channelDetails.contentSubtitle=channelEntry.contentSubtitle||"";channelDetails.headerTitle=channelEntry.headerTitle||"";channelDetails.id=EMAILBUBBLE_ID;break;default:channelDetails.render=!1;break}} 254return channelDetails} 255function getBase4EncodedUrl(url){let base4Encoded="";for(var i=0;i<url.length;i++){let base4Bits=url.charCodeAt(i).toString(4);base4Bits=base4Bits.padStart(4,"0");for(var j=0;j<base4Bits.length;j++){switch(base4Bits.charAt(j)){case '0':base4Encoded+="%e2%80%8b";break;case '1':base4Encoded+="%e2%80%8c";break;case '2':base4Encoded+="%e2%80%8d";break;default:base4Encoded+="%e2%80%8e";break}}} 256return base4Encoded} 257function removeAllChildNodes(parent){while(parent.firstChild){parent.removeChild(parent.firstChild)}} 258var isWebStorageAvailable=testSessionStorage();function testSessionStorage(){var test='__feature_test';try{window.sessionStorage.setItem(test,test);window.sessionStorage.removeItem(test);return!0}catch(e){return!1}} 259function getDataAttributesFromBotLoaderScript(){const dataAttributes={};var botLoaderScriptElement=Array.from(document.scripts).find((script)=>script.src.indexOf("bot-loader.js")>-1);for(let i=0;i<botLoaderScriptElement.attributes.length;i++){const attr=botLoaderScriptElement.attributes[i];if(attr.name.startsWith('data-')){const key=attr.name;const value=attr.value;dataAttributes[key]=value}} 260return dataAttributes} 261function createChatWindow(iframeSrc,botType,deviceSettings,preventIframeRender,positionClass,testMode=!0,setUserDataForBot="false",hideChatHistory=!1,enablePortal=!1,enableHomePortal=!1,enableMessagePortal=!1,forms="",enableMessageFeedback=!1){let container=document.createElement("div");let iframe=document.createElement("iframe");let poweredByContainer=document.createElement("div");let poweredBySpan=document.createElement("span");container.setAttribute("id",kenytChatWindowContainerId);container.classList.add("k-hide");let hash=getHash(scriptElement.outerHTML);let parentUrl=origin;if(isWebStorageAvailable){let kenytSession=window.localStorage.getItem("__kenytsession__");
261if(kenytSession){kenytSession=JSON.parse(kenytSession)} 262if(kenytSession&&kenytSession.FirstPageQueryPrm){var index=parentUrl.indexOf("?");if(index>0){var firstPageParams=new URLSearchParams(kenytSession.FirstPageQueryPrm);var firstPageParamsObj=Object.fromEntries(firstPageParams.entries());var currentPageParams=new URLSearchParams(parentUrl.substring(index));var currentPageParamsObj=Object.fromEntries(currentPageParams.entries());for(var attrname in currentPageParamsObj){firstPageParamsObj[attrname]=currentPageParamsObj[attrname]} 263var queryString=Object.keys(firstPageParamsObj).map(key=>key+'='+firstPageParamsObj[key]).join('&');parentUrl=parentUrl.substring(0,index)+"?"+queryString}else{parentUrl+="?"+kenytSession.FirstPageQueryPrm}}} 264const urlObj=new URL(window.parent.location.href);let kenytStartIntent=urlObj.searchParams.get('kenytStartIntent');parentUrl=encodeURIComponent(parentUrl);let srcUrl=`${rootUrl}${iframeSrc}&botid=${botName}&origin=${parentUrl}&enablePortal=${enablePortal}&enableHomePortal=${enableHomePortal}&enableMessagePortal=${enableMessagePortal}&test=${!testMode ? 0 : 1}&hash=${hash}&setuserdataforbot=${setUserDataForBot}&hideChatHistory=${hideChatHistory}&enableMessageFeedback=${enableMessageFeedback}&forms=${forms}&kenytStartIntent=${kenytStartIntent}`;const botLoaderScriptDataAttributes=getDataAttributesFromBotLoaderScript();for(const[key,value]of Object.entries(botLoaderScriptDataAttributes)){srcUrl+=`&${key}=${value}`} 265for(var i=0,atts=scriptElement.attributes,n=atts.length;i<n;i++){var attributeName=atts[i].nodeName;if(attributeName.startsWith("context-")){let encodedVal=encodeURIComponent(atts[i].nodeValue);srcUrl+=`&${attributeName}=${encodedVal}`}else if(attributeName.startsWith("user-")){let encodedVal=encodeURIComponent(atts[i].nodeValue);srcUrl+=`&${attributeName}=${encodedVal}`}} 266iframe.setAttribute("src_to_set",srcUrl);iframe.setAttribute("id",IFRAME_ID);iframe.setAttribute("title","AI Agent conversation window");iframe.setAttribute("allow","geolocation; microphone; camera");iframe.allowFullscreen="allowFullscreen";if(botType){container.classList.add(botType)} 267if(deviceSettings){var device=isMobileDevice()?"mobile":"desktop";if(deviceSettings[device]){if(deviceSettings[device]["open Height"]){container.style.height=deviceSettings[device]["open Height"]} 268if(deviceSettings[device]["open Width"]){container.style.width=deviceSettings[device]["open Width"]}}} 269poweredBySpan.innerHTML=`Powered By <a href="https://www.kenyt.ai" tabindex="-1">Kenyt.AI</a>`;poweredByContainer.appendChild(poweredBySpan);poweredByContainer.id='kenytPoweredBy';if(!preventIframeRender){container.appendChild(iframe)} 270container.classList.add(positionClass);container.appendChild(poweredByContainer);return container} 271function getScriptParam(paramName){let paramValue='';if(scriptElement){let attribute=`${paramName}`;if(scriptElement.hasAttribute(attribute)){paramValue=scriptElement.getAttribute(attribute)}} 272return paramValue} 273function detectEndPoint(){if(rootUrl.indexOf("localhost")>=0){var endpoint=`${rootUrl}${ENDPOINT}`;return endpoint}else if(rootUrl.indexOf("ngrok-free.app")>0){var endPoint="https://"+window.location.hostname+`${PROD_PREFIX}${ENDPOINT}`;return endPoint}else{let endpoint=`${rootUrl}${PROD_PREFIX}${ENDPOINT}` 274return endpoint}} 275function extractRootUrl(){let source=getScriptParam('src');let rootUrl="";if(source){if(source.startsWith("//www.")){source="https:"+source}else if(source.startsWith(".")||source.startsWith("/")){source=window.location.protocol+"//"+window.location.hostname;if(window.location.port){source+=`:${window.location.port}`}} 276let url=new URL(source);rootUrl=url.protocol+"//"+url.hostname;if(url.port){rootUrl+=`:${url.port}`}} 277return rootUrl} 278function getPositionClass(position){if(position&&typeof position==='string'){position=position.trim().toLowerCase();if(position){let keys=Object.keys(positionClasses);for(let i=0;i<keys.length;i++){if(keys[i]===position){return positionClasses[keys[i]]}}}} 279return positionClasses.right} 280function isMobileDevice(){return navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/iPod/i)||navigator.userAgent.match(/BlackBerry/i)||navigator.userAgent.match(/Windows Phone/i)} 281function getMobileOperatingSystem(){var userAgent=navigator.userAgent||window.opera;if(/windows phone/i.test(userAgent)){return"Windows Phone"} 282if(/android/i.test(userAgent)){return"Android"} 283if(/iPad|iPhone|iPod/.test(userAgent)&&!window.MSStream){return"iOS"} 284return"unknown"} 285function kenyt_gtag(){dataLayer.push(arguments)} 286function getHash(text){var hash=0,i,chr;for(i=0;i<text.length;i++){chr=text.charCodeAt(i);hash=((hash<<5)-hash)+chr;hash|=0} 287return hash} 288function htmlToElement(html){html=html.trim();var template=document.createElement('template');template.innerHTML=html;return template.content.firstChild} 289function getUnreadMessageCount(){var count=kenytChatBubble.element.getAttribute(unreadCountAttribute);if(count){count=parseInt(count)} 290if(!count){count=0} 291return count} 292function setUnreadMessageCount(value){if(value===0){clearUnreadMessages()}else{kenytChatBubble.element.setAttribute(unreadCountAttribute,value);saveSessionData(UNREAD_COUNT_SESSION_KEY,`${value}`)}} 293function clearUnreadMessages(){unreadMessageCount=0;
293if(kenytChatBubble.element.hasAttribute(unreadCountAttribute)){kenytChatBubble.element.removeAttribute(unreadCountAttribute)} 294saveSessionData(UNREAD_COUNT_SESSION_KEY,`${unreadMessageCount}`)} 295function saveSessionData(key,value){if(isWebStorageAvailable){window.sessionStorage.setItem(key,value)}} 296async function saveFirebaseToken(){if(firebaseAppConfig){let firebaseApp=await import("https://www.gstatic.com/firebasejs/10.12.0/firebase-app-compat.js");let firebaseMessenger=await import("https://www.gstatic.com/firebasejs/10.12.0/firebase-messaging-compat.js");if(firebaseApp&&firebaseMessenger){firebase.initializeApp(firebaseAppConfig);const firebaseMessaging=firebase.messaging();Notification.requestPermission().then((permission)=>{if(permission==="granted"){navigator.serviceWorker.register('/kenyt-fcm-sw.js').then((registration=>{firebaseMessaging.getToken({vapidKey:"BLKlFVj0v-DBhimtDYEHJRgLilz6fUC8pPkrwtdyHEQLsDQylDaL6qITIa3VM3Yprw8AKyGa1MNaAyhEApoPUwQ",serviceWorkerRegistration:registration}).then((currentToken)=>{if(currentToken){if(kenytChatBubbleJs&&kenytChatBubbleJs.notifyChatWindow){kenytChatBubbleJs.notifyChatWindow(iframeEventType.FirebaseToken,currentToken)}}})}))}});firebaseMessaging.onMessage((payload)=>{const notification=payload.notification;const notificationTitle=notification?.title;const notificationOptions={body:notification?.body,icon:notification?.icon};new Notification(notificationTitle,notificationOptions)})}}} 297function openWhatsAppWindow(){let iframe=document.getElementById(IFRAME_ID);if(!iframe){console.log('Iframe not found');return} 298let whatsappChannelDetails=null;if(channelConfig&&channelConfig.channels){const whatsappChannel=channelConfig.channels.find(channel=>channel.type===CHANNEL_TYPE_WHATSAPP);console.log('WhatsApp channel found:',whatsappChannel);if(whatsappChannel){whatsappChannelDetails=getChannelDetails(whatsappChannel,"");console.log('WhatsApp channel details:',whatsappChannelDetails)}}else{console.log('No WhatsApp channel config found. channelConfig:',channelConfig)} 299iframe.contentWindow.postMessage({type:'openWhatsAppWindow',action:'create',channelDetails:whatsappChannelDetails},'*');const chatContainer=document.getElementById(kenytChatWindowContainerId);if(chatContainer){chatContainer.classList.remove('k-hide');chatContainer.style.display='block'} 300const chatBubble=document.getElementById(CHATBUBBLE_ID);if(chatBubble){chatBubble.classList.add('k-hide')}} 301function closeWhatsAppWindow(){let iframe=document.getElementById(IFRAME_ID);if(iframe){iframe.contentWindow.postMessage({type:'closeWhatsAppWindow',action:'close'},'*')} 302const chatContainer=document.getElementById(kenytChatWindowContainerId);if(chatContainer){chatContainer.classList.add('k-hide')} 303const chatBubble=document.getElementById(CHATBUBBLE_ID);if(chatBubble){chatBubble.classList.remove('k-hide')}} 304function sendWhatsAppMessage(){let iframe=document.getElementById(IFRAME_ID);let iframeDoc=iframe?iframe.contentDocument||iframe.contentWindow.document:null;const input=iframeDoc?iframeDoc.getElementById('whatsappInput'):null;const messagesContainer=whatsappWindow?whatsappWindow.querySelector('div[style*="flex: 1"]'):null;if(input&&input.value.trim()&&messagesContainer&&iframeDoc){const messageDiv=iframeDoc.createElement('div');messageDiv.style.cssText=` 305 background: #dcf8c6; 306 padding: 10px 15px; 307 border-radius: 18px; 308 margin-bottom: 15px; 309 max-width: 80%; 310 margin-left: auto; 311 margin-right: 0; 312 `;messageDiv.textContent=input.value;messagesContainer.appendChild(messageDiv);messagesContainer.scrollTop=messagesContainer.scrollHeight;input.value='';input.style.height='35px';setTimeout(()=>{const responseDiv=iframeDoc.createElement('div');responseDiv.style.cssText=` 313 background: white; 314 padding: 10px 15px; 315 border-radius: 18px; 316 margin-bottom: 15px; 317 max-width: 80%; 318 `;responseDiv.textContent='Thank you for your message! Our support team will get back to you soon.';messagesContainer.appendChild(responseDiv);messagesContainer.scrollTop=messagesContainer.scrollHeight},1000)}} 319function handleWhatsAppKeyPress(event){if(event.key==='Enter'&&!event.shiftKey){event.preventDefault();sendWhatsAppMessage()}} 320function openWhatsAppUrl(url){if(url){console.log('Opening WhatsApp URL:',url);window.open(url,'_blank')}else{console.error('No WhatsApp URL provided')}} 321function openEmailWindow(){let iframe=document.getElementById(IFRAME_ID);if(!iframe){console.log('Iframe not found');return} 322let emailChannelDetails=null;if(channelConfig&&channelConfig.channels){const emailChannel=channelConfig.channels.find(channel=>channel.type===CHANNEL_TYPE_EMAIL);if(emailChannel){emailChannelDetails=getChannelDetails(emailChannel,"")}} 323iframe.contentWindow.postMessage({type:'openEmailWindow',action:'create',channelDetails:emailChannelDetails},'*');const chatContainer=document.getElementById(kenytChatWindowContainerId);if(chatContainer){chatContainer.classList.remove('k-hide');chatContainer.style.display='block'} 324const chatBubble=document.getElementById(CHATBUBBLE_ID);if(chatBubble){chatBubble.classList.add('k-hide')}} 325function openPhoneWindow(){let iframe=document.getElementById(IFRAME_ID);if(!iframe){console.log('Iframe not found');return} 326let phoneChannelDetails=null;if(channelConfig&&channelConfig.channels){const phoneChannel=channelConfig.channels.find(channel=>channel.type===CHANNEL_TYPE_PHONE);if(phoneChannel){phoneChannelDetails=getChannelDetails(phoneChannel,"")}} 327iframe.contentWindow.postMessage({type:'openPhoneWindow',action:'create',channelDetails:phoneChannelDetails},'*');const chatContainer=document.getElementById(kenytChatWindowContainerId);if(chatContainer){chatContainer.classList.remove('k-hide');chatContainer.style.display='block'} 328const chatBubble=document.getElementById(CHATBUBBLE_ID);if(chatBubble){chatBubble.classList.add('k-hide')}} 329function closeEmailWindow(){let iframe=document.getElementById(IFRAME_ID);if(iframe){iframe.contentWindow.postMessage({type:'closeEmailWindow',action:'close'},'*')} 330const chatContainer=document.getElementById(kenytChatWindowContainerId);if(chatContainer){chatContainer.classList.add('k-hide')} 331const chatBubble=document.getElementById(CHATBUBBLE_ID);if(chatBubble){chatBubble.classList.remove('k-hide')}} 332function closePhoneWindow(){let iframe=document.getElementById(IFRAME_ID);if(iframe){iframe.contentWindow.postMessage({type:'closePhoneWindow',action:'close'},'*')} 333const chatContainer=document.getElementById(kenytChatWindowContainerId);if(chatContainer){chatContainer.classList.add('k-hide')} 334const chatBubble=document.getElementById(CHATBUBBLE_ID);if(chatBubble){chatBubble.classList.remove('k-hide')}} 335window.closeWhatsAppWindow=closeWhatsAppWindow;window.sendWhatsAppMessage=sendWhatsAppMessage;window.handleWhatsAppKeyPress=handleWhatsAppKeyPress;window.openEmailWindow=openEmailWindow;window.closeEmailWindow=closeEmailWindow;window.openPhoneWindow=openPhoneWindow;window.closePhoneWindow=closePhoneWindow})()
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.